feat: add multi-model delegation (Phase 0) and context compaction (Phase 1)
Phase 0 — Multi-Model Delegation: - AgentOrchestrator wraps NativeAgent with delegate() for stateless single-turn calls to any model tier (fast/default/complex/local) - DelegationConfig maps task types (compaction, classification, etc.) to model tiers - Delegation prompts for compaction, memory extraction, classification, and tool summarisation - Per-tier usage tracking for cost visibility - Config schema: agents.delegation and agents.primary_tier Phase 1 — Context Compaction: - Token estimation (char/4 heuristic) with context window lookup - shouldCompact() threshold check against context window percentage - compactHistory() splits old/recent messages, delegates summary to fast tier, returns CompactionResult - Automatic compaction in AgentOrchestrator.process() when configured - Force-compact via orchestrator.compact() with session persistence - Session.replaceHistory() with atomic SQLite transaction - /compact TUI command with feedback on compacted token counts - Config schema: compaction.enabled, threshold_pct, keep_turns, summary_max_tokens Tests: 385 passing across 50 files (22 new tests in 2 new test files)
This commit is contained in:
@@ -26,6 +26,10 @@ describe('parseCommand', () => {
|
||||
expect(parseCommand('/fs')).toEqual({ type: 'fullscreen' });
|
||||
});
|
||||
|
||||
it('parses /compact command', () => {
|
||||
expect(parseCommand('/compact')).toEqual({ type: 'compact' });
|
||||
});
|
||||
|
||||
it('parses /model command without argument', () => {
|
||||
expect(parseCommand('/model')).toEqual({ type: 'model' });
|
||||
});
|
||||
@@ -64,6 +68,7 @@ describe('getHelpText', () => {
|
||||
expect(help).toContain('/help');
|
||||
expect(help).toContain('/model');
|
||||
expect(help).toContain('/reset');
|
||||
expect(help).toContain('/compact');
|
||||
expect(help).toContain('/quit');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user