feat(status): show session compaction count
Add a compactions row to the /smart-compact overlay counting the session's persisted compaction entries via ctx.sessionManager, so the number stays correct across resume and restart. An in-memory session_compact counter remains as the fallback where sessionManager is unavailable.
This commit is contained in:
1 parent
8599ae8176
commit
dc75ef8a7b
7 files changed
+113
-5
No files matched your search
@@ -66,7 +66,7 @@ Optional. `~/.pi/agent/settings.json` (global) or `.pi/settings.json` (project;
|
||||
|
||||
## Command
|
||||
|
||||
`/smart-compact` opens a centered overlay panel (the `/dcp context` look): current tokens, a usage bar, both effective thresholds (with crossed indicators), and cycle flags. Dismiss it with esc, enter, q, or ctrl+c. Where overlays are unavailable (print/RPC mode) it falls back to a plain notification. Useful for checking what a given model's thresholds resolve to without filling a session.
|
||||
`/smart-compact` opens a centered overlay panel (the `/dcp context` look): current tokens, a usage bar, both effective thresholds (with crossed indicators), cycle flags, and the session's compaction count. The count comes from the session's persisted compaction entries, so it stays correct across restarts and resumes. Dismiss it with esc, enter, q, or ctrl+c. Where overlays are unavailable (print/RPC mode) it falls back to a plain notification. Useful for checking what a given model's thresholds resolve to without filling a session.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -88,7 +88,7 @@ Pi discovers `*/index.ts` one level deep, following the symlink. Reload with `/r
|
||||
## Verification
|
||||
|
||||
- Loads clean under Pi 1.5.2 (`pi -p` smoke test).
|
||||
- 14-test committed harness: `node --test harness.ts` (Node ≥ 22.18 with type stripping). Covers warn-once-per-cycle at the effective threshold, force only at `agent_settled` (never from `turn_end`, not when busy), awaiting compaction completion in the settled handler, the in-flight lock and failure cooldown, the stale-token guard after `session_compact`, per-field config validation (`null`/string/zero/oversized values), cycle reset, `enabled: false`, and the status command.
|
||||
- 23-test committed harness: `node --test harness.ts` (Node ≥ 22.18 with type stripping). Covers warn-once-per-cycle at the effective threshold, force only at `agent_settled` (never from `turn_end`, not when busy), awaiting compaction completion in the settled handler, the in-flight lock and failure cooldown, the stale-token guard after `session_compact`, per-field config validation (`null`/string/zero/oversized values), cycle reset, `enabled: false`, and the status command.
|
||||
- Live-session validation of the first real 100k crossing is still pending — the warn message is a single string in `index.ts` if the wording needs tuning.
|
||||
|
||||
## License
|
||||
|
||||
Reference in new issue
Block a user