Files
proffesor-for-testing__agen…/scripts/test-routing-manual.ts
Profa 0a6c799d3c chore(release): bump version to v2.5.5
Closes #144 - RuvLLM/SONA Integration (all 4 phases)
Closes #39 - MCP handler test fixes

## Added
- SONALifecycleManager (717 lines, 72 tests)
  - Automatic lifecycle hooks: onAgentSpawn, onTaskComplete, cleanupAgent
  - Real-time experience capture from agent task completions
  - Integration with AgentRegistry for fleet-wide coordination

- InferenceCostTracker (679 lines, 30 tests)
  - Track local vs cloud inference costs in real-time
  - Support for multiple providers: ruvllm, anthropic, openrouter, openai, onnx
  - Cost savings analysis with multi-format reporting

- AdaptiveModelRouter local routing
  - Local model preference for routine tasks via RuvLLM
  - Fallback cascade: ruvllm → openrouter → anthropic

## Fixed
- Video Vision Analyzer multimodal analysis pipeline
- MCP Handler Tests (36 files stabilized)

## Testing
- 102 new tests (56 + 30 + 16)
- All new code tests passing
- Regression suite verified

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 20:57:15 +00:00

75 lines
2.0 KiB
TypeScript

/**
* Manual test of routing functionality
* This bypasses Jest to verify the implementation works
*/
import { AdaptiveModelRouter } from '../src/core/routing/AdaptiveModelRouter';
import { SwarmMemoryManager } from '../src/core/memory/SwarmMemoryManager';
import { EventBus } from '../src/core/EventBus';
import { TaskComplexity, AIModel } from '../src/core/routing/types';
// Mock fetch for testing
(global as any).fetch = async (url: string) => {
console.log(`Fetch called with: ${url}`);
return { ok: true };
};
async function test() {
console.log('=== Testing AdaptiveModelRouter Local Routing ===\n');
const eventBus = new EventBus();
const memoryStore = new SwarmMemoryManager();
await memoryStore.initialize();
const router = new AdaptiveModelRouter(memoryStore, eventBus, {
enabled: true,
preferLocal: true,
ruvllmEndpoint: 'http://localhost:8080',
enableCostTracking: true,
enableFallback: true,
});
// Wait for initialization
await new Promise(resolve => setTimeout(resolve, 200));
console.log('✓ Router created\n');
// Test routeToLocal
const task = {
id: 'test-1',
type: 'qe-test-generator',
description: 'Generate unit tests',
data: {},
priority: 1,
};
const analysis = {
complexity: TaskComplexity.SIMPLE,
estimatedTokens: 1000,
requiresReasoning: false,
requiresSecurity: false,
requiresPerformance: false,
confidence: 0.95,
};
console.log('Calling routeToLocal...');
const selection = await router.routeToLocal(task, analysis);
console.log('\nResult:');
console.log('- Selection:', selection);
console.log('- Model:', selection?.model);
console.log('- Cost:', selection?.estimatedCost);
console.log('- Reasoning:', selection?.reasoning);
console.log('\n=== Test Complete ===');
// Cleanup
await memoryStore.shutdown();
process.exit(selection ? 0 : 1);
}
test().catch(error => {
console.error('Test failed:', error);
process.exit(1);
});