pi-mega-compact 0.21.5 → 0.21.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # pi-mega-compact
2
2
 
3
3
  > **⚠️ LTS — patches only (2026-08-13).** This extension is maintained for bug fixes only. New feature development has moved to **[radcode](https://github.com/TheArchitectit/radcode)**, a Rust pi.dev replacement that has ported mega-compact's compaction/recall/dedup/RAPTOR stack. See [`docs/LTS.md`](docs/LTS.md) and [`docs/SUCCESSION.md`](docs/SUCCESSION.md).
4
-
4
+ >
5
+ Pending public release
6
+ >
5
7
  A local-first context compressor for the [pi coding agent](https://github.com/earendil-works/pi). Keeps long sessions running without overflowing the context window. Local by default — no cloud, no API calls, no telemetry. Bring your own localhost embedder (Ollama, ONNX, TEI) for better semantic matches, or opt in to a remote endpoint if you need to.
6
8
 
7
9
  ## Features
@@ -99,6 +99,23 @@ export function registerContextHandler(pi, runtime, config) {
99
99
  // S27 DB-mirror + VC1B ledger append. Runs BEFORE the fast-gate so every
100
100
  // message is captured, even if we don't compact this turn. Non-fatal.
101
101
  appendMirrorAndLedger(runtime, config, messages);
102
+ // Phase H.1: output-error catch noop guard. When forceCompactNextGate is
103
+ // armed (Phase H: model truncated its output → lengthStop.ts set the flag
104
+ // at turn_end), check piCompactWouldNoop BEFORE evaluateGate consumes the
105
+ // flag. If pi would noop (session too small to summarize — the transcript
106
+ // is under pi's keepRecentTokens floor), clear the flag + return the tail
107
+ // result silently instead of forcing a proceed that will throw "Nothing
108
+ // to compact (session too small)" to the user. The session is genuinely
109
+ // too small to compact — skipping is correct (the model retries on the
110
+ // next turn regardless). Gated by config.outputErrorCompact (default ON;
111
+ // OFF = byte-identical pre-H.1).
112
+ if (config.outputErrorCompact &&
113
+ runtime.rt.forceCompactNextGate &&
114
+ piCompactWouldNoop(ctx)) {
115
+ runtime.rt.forceCompactNextGate = false;
116
+ runtime.diagCtxOutputErrorTrip++;
117
+ return tailResult() ?? undefined;
118
+ }
102
119
  // S29 FAST GATE: drive the auto-trigger off the context percent (see
103
120
  // gateCheck.ts). Returns a tailed view when the gate does not pass.
104
121
  const gate = evaluateGate(runtime, config, { pct, currentTokens, tailResult });
@@ -130,6 +130,26 @@ export function registerContextHandler(
130
130
  // message is captured, even if we don't compact this turn. Non-fatal.
131
131
  appendMirrorAndLedger(runtime, config, messages);
132
132
 
133
+ // Phase H.1: output-error catch noop guard. When forceCompactNextGate is
134
+ // armed (Phase H: model truncated its output → lengthStop.ts set the flag
135
+ // at turn_end), check piCompactWouldNoop BEFORE evaluateGate consumes the
136
+ // flag. If pi would noop (session too small to summarize — the transcript
137
+ // is under pi's keepRecentTokens floor), clear the flag + return the tail
138
+ // result silently instead of forcing a proceed that will throw "Nothing
139
+ // to compact (session too small)" to the user. The session is genuinely
140
+ // too small to compact — skipping is correct (the model retries on the
141
+ // next turn regardless). Gated by config.outputErrorCompact (default ON;
142
+ // OFF = byte-identical pre-H.1).
143
+ if (
144
+ config.outputErrorCompact &&
145
+ runtime.rt.forceCompactNextGate &&
146
+ piCompactWouldNoop(ctx)
147
+ ) {
148
+ runtime.rt.forceCompactNextGate = false;
149
+ runtime.diagCtxOutputErrorTrip++;
150
+ return tailResult() ?? undefined;
151
+ }
152
+
133
153
  // S29 FAST GATE: drive the auto-trigger off the context percent (see
134
154
  // gateCheck.ts). Returns a tailed view when the gate does not pass.
135
155
  const gate = evaluateGate(runtime, config, { pct, currentTokens, tailResult });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-mega-compact",
3
- "version": "0.21.5",
3
+ "version": "0.21.6",
4
4
  "description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
5
5
  "type": "module",
6
6
  "license": "BSD-3-Clause",