mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
Expose the Rust IntelligentContextManager (PR-B) to Python as headroom._core.IntelligentContextManager + IcmConfig + ApplyResult. Pattern mirrors SmartCrusher exactly: one #[pyclass] per process, GIL released across apply() so concurrent Python threads keep running through the score-and-drop work. Messages cross the FFI boundary as JSON strings — same wire shape the proxy already has, keeps the binding surface narrow. PR-D will reshim headroom/transforms/intelligent_context.py to delegate to this; this PR ships only the binding + 8 Python smoke tests covering construction, getters, should_apply, apply with drops + CCR markers, frozen prefix protection, and bad-JSON behaviour. Quirks worth noting: - Bad JSON panics (raised as PanicException), matching the SmartCrusher convention. pyo3 0.22's #[pymethods] macro hits a clippy::useless_conversion false positive on PyResult<MyPyclass> return types; panic-on-bad-input dodges it without an allow attr and matches existing bridge methods. - An InMemoryCcrStore is owned per-manager. Sharing the proxy's existing CCR store is a follow-up; PR-C ships the simplest correct contract. |
||
|---|---|---|
| .. | ||
| headroom-core | ||
| headroom-parity | ||
| headroom-proxy | ||
| headroom-py | ||