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).
Eugene Sukhodolskiy
committed
1 day ago