|
Separate display history from LLM context; formalize worker system
Architecture change: - session.messages: full display history, never modified by compression - session.context: what the LLM sees, may be compressed by workers - System messages go only into context (not display history) - Image injections (synthetic) go only into context - User/assistant/tool messages go into both SQLite: add context column with backward-compat migration (empty context → initialized from messages on load) Workers (navi/workers/): - Worker ABC + WorkerContext + WorkerResult (base.py) - CompressionWorker: compresses session.context when above threshold - build_default_workers() returns [CompressionWorker()] - Agent accepts workers list, runs them after StreamEnd - Workers injected via deps.py get_workers() (lru_cached singleton) - WebSocket agent construction also receives workers Compressor: compress_context() now takes context[], not messages[] Config: context_keep_recent 6 → 10 Agent: _run_workers() collects events from all workers and yields them Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
|---|
|
|
| navi/api/deps.py |
|---|
| navi/api/websocket.py |
|---|
| navi/config.py |
|---|
| navi/core/agent.py |
|---|
| navi/core/compressor.py |
|---|
| navi/core/session.py |
|---|
| navi/core/sqlite_session_store.py |
|---|
| navi/workers/__init__.py 0 → 100644 |
|---|
| navi/workers/base.py 0 → 100644 |
|---|
| navi/workers/compressor.py 0 → 100644 |
|---|