|
core: split the compressor into a package
`navi/core/compressor.py` was 1355 lines covering three different jobs: deciding what a pass summarizes, building and calling the summarizer, and the retry/truncate/persist wrapper around it. Move each to its own module: * `compression/partition.py` — pure partitioning and the single `_plan_compression` decision shared with `would_compress`; * `compression/summarize.py` — prompt formatting, the KEYS line, the meta-summary and `compress_context`; * `compression/compressor.py` — `ContextCompressor` and its fallbacks. `navi/core/compressor.py` stays as a compatibility shim that re-exports the public surface, so imports elsewhere are untouched. Because each module now binds its own `settings`, the tests that override settings patch all of them (and `_meta_summarize`/`compress_context` are patched where they are read, not on the shim). Adds a regression test for the hard-truncate trim inside a single oversized turn, which the moved `_split_turn_tail` import silently broke (ruff F821, no test hit that branch). |
|---|
|
|
| navi/core/compression/__init__.py 0 → 100644 |
|---|
| navi/core/compression/compressor.py 0 → 100644 |
|---|
| navi/core/compression/partition.py 0 → 100644 |
|---|
| navi/core/compression/summarize.py 0 → 100644 |
|---|
| navi/core/compressor.py |
|---|
|
Too large (Show diff)
|
| tests/unit/core/test_compression_breadcrumbs.py |
|---|
| tests/unit/core/test_compressor.py |
|---|
| tests/unit/workers/test_compression_worker.py |
|---|