pi-mega-compact 0.21.7 → 0.21.8
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.
|
@@ -87,7 +87,21 @@ export function registerContextHandler(pi, runtime, config) {
|
|
|
87
87
|
/* non-fatal */
|
|
88
88
|
}
|
|
89
89
|
runtime.lastCtxPercent = pct ?? null;
|
|
90
|
-
|
|
90
|
+
// Resolve the model window used by the token gate + live-trim tail-cap.
|
|
91
|
+
// Prefer the provider-reported usage window (authoritative when present);
|
|
92
|
+
// fall back to the captured model snapshot's contextWindow (populated from
|
|
93
|
+
// models.json / pi's model registry) when the provider does not report it
|
|
94
|
+
// via getContextUsage(). plexus (OpenAI-compatible) omits contextWindow in
|
|
95
|
+
// usage, so without this fallback lastCtxWindow is 0 for those providers —
|
|
96
|
+
// which silently disables the live-trim tail-cap (guarded on ctxWindow>0)
|
|
97
|
+
// and the token-gate window math, so mega-compact never reserves output
|
|
98
|
+
// headroom and a 32k model's own output overflows the window each turn.
|
|
99
|
+
// Mirrors the gate's existing pct fallback (gateCheck.ts S27).
|
|
100
|
+
const reportedWindow = usage?.contextWindow ?? 0;
|
|
101
|
+
runtime.lastCtxWindow =
|
|
102
|
+
reportedWindow > 0
|
|
103
|
+
? reportedWindow
|
|
104
|
+
: (runtime.currentModel?.contextWindow ?? 0);
|
|
91
105
|
runtime.snapshot(ctx);
|
|
92
106
|
if (!config.auto) {
|
|
93
107
|
const tailed = tailResult();
|
|
@@ -116,7 +116,21 @@ export function registerContextHandler(
|
|
|
116
116
|
/* non-fatal */
|
|
117
117
|
}
|
|
118
118
|
runtime.lastCtxPercent = pct ?? null;
|
|
119
|
-
|
|
119
|
+
// Resolve the model window used by the token gate + live-trim tail-cap.
|
|
120
|
+
// Prefer the provider-reported usage window (authoritative when present);
|
|
121
|
+
// fall back to the captured model snapshot's contextWindow (populated from
|
|
122
|
+
// models.json / pi's model registry) when the provider does not report it
|
|
123
|
+
// via getContextUsage(). plexus (OpenAI-compatible) omits contextWindow in
|
|
124
|
+
// usage, so without this fallback lastCtxWindow is 0 for those providers —
|
|
125
|
+
// which silently disables the live-trim tail-cap (guarded on ctxWindow>0)
|
|
126
|
+
// and the token-gate window math, so mega-compact never reserves output
|
|
127
|
+
// headroom and a 32k model's own output overflows the window each turn.
|
|
128
|
+
// Mirrors the gate's existing pct fallback (gateCheck.ts S27).
|
|
129
|
+
const reportedWindow = usage?.contextWindow ?? 0;
|
|
130
|
+
runtime.lastCtxWindow =
|
|
131
|
+
reportedWindow > 0
|
|
132
|
+
? reportedWindow
|
|
133
|
+
: (runtime.currentModel?.contextWindow ?? 0);
|
|
120
134
|
runtime.snapshot(ctx);
|
|
121
135
|
if (!config.auto) {
|
|
122
136
|
const tailed = tailResult();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mega-compact",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.8",
|
|
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",
|