vikingowl
|
b0b393517e
|
feat: M6 context intelligence — token tracker + truncation compaction
internal/context/:
- Tracker: monitors token usage with OK/Warning/Critical states
(thresholds from CC: 20K warning buffer, 13K autocompact buffer)
- TruncateStrategy: drops oldest messages, preserves system prompt +
recent N turns, adds compaction boundary marker
- Window: manages message history with auto-compaction trigger,
circuit breaker after 3 consecutive failures
Engine integration:
- Context window tracks usage per turn
- Auto-compacts when critical threshold reached
- History syncs with context window after compaction
TUI status bar:
- Token count with percentage (tokens: 1234 (5%))
- Color-coded: green=ok, yellow=warning, red=critical
Session Status extended: TokensMax, TokenPercent, TokenState.
7 context tests.
|
2026-04-03 18:46:03 +02:00 |
|
vikingowl
|
c6b13f7cc8
|
feat: add session interface with channel-based local implementation
Session interface decouples UI from engine via channels:
- Send(input) starts agentic turn in background goroutine
- Events() returns channel for streaming events
- TurnResult() returns completed Turn after drain
- Cancel() propagates context cancellation
- Status() reports state, provider, model, token usage, turn count
Local implementation: engine runs on dedicated goroutine per turn,
events pushed to buffered channel (64), context cancellation
propagated. 5 tests.
|
2026-04-03 15:12:12 +02:00 |
|