UNPKG

@stackmemoryai/stackmemory

Version:

Project-scoped memory for AI coding tools. Durable context across sessions with MCP integration, frames, smart retrieval, Claude Code skills, and automatic hooks.

90 lines (74 loc) โ€ข 3.14 kB
#!/usr/bin/env node import 'dotenv/config'; import { ClaudeCodeSubagentClient } from '../dist/integrations/claude-code/subagent-client.js'; async function testRLMSimple() { console.log('๐Ÿš€ Testing RLM Subagent Client (Simple Mode)...\n'); try { // Initialize the subagent client console.log('๐Ÿค– Creating Subagent Client...'); const client = new ClaudeCodeSubagentClient(); // Test with different subagent types const testCases = [ { type: 'planning', task: 'Create a simple hello world function', context: { language: 'JavaScript', style: 'functional' } }, { type: 'code', task: 'Implement a hello world function in JavaScript', context: { requirements: 'Should return "Hello, World!"' } }, { type: 'testing', task: 'Generate tests for a hello world function', context: { code: 'function hello() { return "Hello, World!"; }' } } ]; for (const testCase of testCases) { console.log(`\n๐Ÿ“ Testing ${testCase.type} subagent:`); console.log(` Task: "${testCase.task}"`); // Use mock mode for testing const result = await client.mockTaskToolExecution({ type: testCase.type, task: testCase.task, context: testCase.context }); if (result.success) { console.log(` โœ… Success!`); console.log(` โฑ๏ธ Duration: ${result.duration}ms`); console.log(` ๐Ÿ“Š Tokens: ~${result.tokens || 'N/A'}`); if (testCase.type === 'planning' && result.result?.tasks) { console.log(` ๐Ÿ“‹ Generated ${result.result.tasks.length} subtasks`); } else if (testCase.type === 'code' && result.result?.implementation) { console.log(` ๐Ÿ’ป Generated code (${result.result.implementation.length} chars)`); } else if (testCase.type === 'testing' && result.result?.tests) { console.log(` ๐Ÿงช Generated ${result.result.tests.length} test cases`); } } else { console.log(` โŒ Failed: ${result.error}`); } } console.log('\n\n๐ŸŽฏ Testing Parallel Execution:'); const parallelRequests = [ { type: 'code', task: 'Create add function', context: {} }, { type: 'code', task: 'Create subtract function', context: {} }, { type: 'testing', task: 'Test math functions', context: {} } ]; console.log(` Executing ${parallelRequests.length} subagents in parallel...`); const startTime = Date.now(); const results = await client.executeParallel( parallelRequests.map(req => ({ ...req, type: req.type })) ); const duration = Date.now() - startTime; const successful = results.filter(r => r.success).length; console.log(` โฑ๏ธ Completed in ${duration}ms`); console.log(` โœ… ${successful}/${results.length} successful`); console.log('\nโœจ Test complete!'); } catch (error) { console.error('๐Ÿ’ฅ Test failed:', error); process.exit(1); } } // Run the test testRLMSimple().catch(console.error);