@cortexkit/opencode-magic-context 0.49.44 → 0.49.46
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/dist/auto-search-worker.js +4 -4
- package/dist/chunk-embedding-write-worker.js +7 -7
- package/dist/{compartment-chunk-embedding-ypktm0tk.js → compartment-chunk-embedding-snj51nmg.js} +5 -5
- package/dist/{conflict-warning-hook-b75jn458.js → conflict-warning-hook-w1aw6w5t.js} +4 -4
- package/dist/{context-ws6gbyrr.js → context-cb51adcz.js} +374 -115
- package/dist/{derive-budgets-htj16n4x.js → derive-budgets-nkw09vq7.js} +1 -1
- package/dist/{embedding-backfill-zxj35jkq.js → embedding-backfill-kpy5shsa.js} +8 -8
- package/dist/embedding-worker.js +3 -3
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-query-deadline.d.ts +8 -0
- package/dist/features/magic-context/memory/embedding-query-deadline.d.ts.map +1 -0
- package/dist/features/magic-context/overflow-detection.d.ts +16 -6
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/hooks/auto-update-checker/index.d.ts +6 -0
- package/dist/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +21 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/priced-pass-sizing.d.ts +132 -0
- package/dist/hooks/magic-context/priced-pass-sizing.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/reasoning-budget.d.ts.map +1 -1
- package/dist/hooks/magic-context/recovery-fit.d.ts +51 -0
- package/dist/hooks/magic-context/recovery-fit.d.ts.map +1 -0
- package/dist/hooks/magic-context/routine-cleanup-decision.d.ts +109 -0
- package/dist/hooks/magic-context/routine-cleanup-decision.d.ts.map +1 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +24 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +2 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +15 -2
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +10 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-jggt5gf2.js → index-1hwn96x1.js} +1 -1
- package/dist/{index-ae1ar4v1.js → index-25ka1jza.js} +1 -1
- package/dist/{index-91y4xvx6.js → index-44pp3vrj.js} +2 -2
- package/dist/{index-wapyeb06.js → index-55ngkbqa.js} +36 -17
- package/dist/{index-v64se1t6.js → index-5jk4h64j.js} +8 -8
- package/dist/{index-dnqqqc5f.js → index-8cfnaagj.js} +10 -2
- package/dist/{index-7y8c2n52.js → index-a4t7pdmm.js} +3 -3
- package/dist/{index-4xyjr62e.js → index-ak11t3gm.js} +4 -0
- package/dist/{index-6qnhaaa0.js → index-b0xt5qz9.js} +3 -3
- package/dist/{index-vd2ywmfe.js → index-brj6was5.js} +1 -1
- package/dist/{index-66qexmjw.js → index-d4qw2h43.js} +3 -3
- package/dist/{index-g4t7850m.js → index-dj2p8653.js} +1 -1
- package/dist/{index-m1mttf6y.js → index-etn2hmb5.js} +3 -3
- package/dist/{index-g0mjm7e4.js → index-gaxktvxm.js} +5 -5
- package/dist/{index-b1ydbp95.js → index-h9m41624.js} +1 -1
- package/dist/{index-p6gs3xpx.js → index-hkh8x221.js} +1 -1
- package/dist/{index-24y47287.js → index-kevd267m.js} +4 -4
- package/dist/{index-knnscj54.js → index-kw7azjmy.js} +3 -3
- package/dist/{index-dasvhxwg.js → index-n9q8c1dr.js} +6 -6
- package/dist/{index-g7rrfjkq.js → index-pwfmcg4e.js} +5 -5
- package/dist/{index-dcjkw41m.js → index-qcz1fy7h.js} +3 -3
- package/dist/{index-rhcwddn9.js → index-s79g172v.js} +63 -21
- package/dist/{index-kgk64zyx.js → index-sd2s4t4p.js} +1 -1
- package/dist/{index-jkanybgq.js → index-smtbdmc3.js} +1 -1
- package/dist/{index-ntssp0dt.js → index-snztv1f0.js} +621 -111
- package/dist/{index-8w3y6pxc.js → index-tajstyw4.js} +167 -87
- package/dist/{index-8jjjmhab.js → index-x53gnmce.js} +11 -11
- package/dist/{index-r2epb000.js → index-xa9mmq6c.js} +2 -1
- package/dist/{index-1j8m4ad0.js → index-xgnh498s.js} +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -39
- package/dist/{message-fts-rowid-map-t6qsyg9s.js → message-fts-rowid-map-msffhkve.js} +2 -2
- package/dist/{message-index-bounded-dmq6ne7d.js → message-index-bounded-3qpg8dq5.js} +8 -8
- package/dist/migration-worker.js +5 -5
- package/dist/{project-embedding-registry-m47vg1ce.js → project-embedding-registry-r6xfsrbe.js} +7 -7
- package/dist/raw-ordinal-warmup-worker.js +7 -7
- package/dist/{read-session-chunk-3m7z9v3t.js → read-session-chunk-7h9f32sz.js} +6 -6
- package/dist/{read-session-raw-j7c9w57v.js → read-session-raw-x7a9b3jm.js} +1 -1
- package/dist/{recomp-orchestrator-9wtcpd7d.js → recomp-orchestrator-qnactdw7.js} +20 -20
- package/dist/{render-esw55s0k.js → render-da999saz.js} +13 -13
- package/dist/{search-3b4kbhtw.js → search-0a3hh5x6.js} +16 -16
- package/dist/{search-archive-wna5basn.js → search-archive-0z9cxv8e.js} +8 -8
- package/dist/{send-session-notification-14p3yje4.js → send-session-notification-j93pn2hn.js} +3 -3
- package/dist/shared/window-geometry.d.ts +5 -0
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/{storage-tags-vj0yj7ed.js → storage-tags-q8erkn48.js} +4 -2
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tools/parameter-descriptions.d.ts +6 -6
- package/dist/tools/parameter-descriptions.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-1y6p9ccc.js → transform-postprocess-phase-k9d1r13f.js} +21 -21
- package/dist/v2/auto-search-worker.js +4 -4
- package/dist/v2/chunk-embedding-write-worker.js +7 -7
- package/dist/v2/{compartment-chunk-embedding-qfk791bd.js → compartment-chunk-embedding-nj5nrnbj.js} +5 -5
- package/dist/v2/{context-sfgk72cj.js → context-jtqj5e1r.js} +1090 -260
- package/dist/v2/{derive-budgets-sa0v7bz0.js → derive-budgets-b5cgrtp8.js} +2 -2
- package/dist/v2/{embedding-backfill-ahwzfc7v.js → embedding-backfill-360efh1t.js} +8 -8
- package/dist/v2/embedding-worker.js +3 -3
- package/dist/v2/fold/code-mode-catalog.d.ts +11 -3
- package/dist/v2/fold/code-mode-catalog.d.ts.map +1 -1
- package/dist/v2/fold/instruction-supersession.d.ts +13 -2
- package/dist/v2/fold/instruction-supersession.d.ts.map +1 -1
- package/dist/v2/fold/native-replay.d.ts +5 -0
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/owner.d.ts +14 -0
- package/dist/v2/fold/owner.d.ts.map +1 -1
- package/dist/v2/fold/summary.d.ts +35 -0
- package/dist/v2/fold/summary.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +2 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/lkg-system.d.ts +3 -0
- package/dist/v2/hooks/lkg-system.d.ts.map +1 -1
- package/dist/v2/{message-fts-rowid-map-z86avy0n.js → message-fts-rowid-map-qe7cpksd.js} +2 -2
- package/dist/v2/{message-index-bounded-mapha2ag.js → message-index-bounded-60tdhht5.js} +7 -7
- package/dist/v2/migration-worker.js +5 -5
- package/dist/v2/{project-embedding-registry-mn403rp5.js → project-embedding-registry-ek0cy0d5.js} +7 -7
- package/dist/v2/raw-ordinal-warmup-worker.js +7 -7
- package/dist/v2/{read-session-chunk-svcthp0n.js → read-session-chunk-9tmsxwb2.js} +5 -5
- package/dist/v2/{read-session-raw-qpp6x9kg.js → read-session-raw-yss2ev98.js} +1 -1
- package/dist/v2/{recomp-orchestrator-2bkv46am.js → recomp-orchestrator-7y8smqqp.js} +19 -19
- package/dist/v2/{render-315tv10c.js → render-j0y57skn.js} +12 -12
- package/dist/v2/{search-archive-hnx40ts0.js → search-archive-1e2tr8eq.js} +7 -7
- package/dist/v2/{search-bhrr075t.js → search-qhd2m8kn.js} +14 -14
- package/dist/v2/{send-session-notification-kxp47tsw.js → send-session-notification-na3q825m.js} +1 -1
- package/dist/v2/{server-nmyganc8.js → server-131h608x.js} +1 -1
- package/dist/v2/{server-86sk7h34.js → server-2gjqhmn9.js} +63 -21
- package/dist/v2/{server-xy7w7hrd.js → server-2j87594q.js} +1 -1
- package/dist/v2/{server-g8xvnxcf.js → server-3rp821fw.js} +3 -3
- package/dist/v2/{server-1yx5455s.js → server-4m71jpaj.js} +4 -4
- package/dist/v2/{server-78mc9sxx.js → server-5dtrzs6j.js} +9 -5
- package/dist/v2/{server-t5gxvcc3.js → server-5vy0xt3p.js} +3 -3
- package/dist/v2/{server-969cdpmg.js → server-7vb38e51.js} +4 -0
- package/dist/v2/{server-sd8hvzte.js → server-af1rmkyn.js} +1 -1
- package/dist/v2/{server-ngdrh7rv.js → server-ahy062xr.js} +36 -17
- package/dist/v2/{server-tnzbk64q.js → server-b3r080cm.js} +2 -1
- package/dist/v2/{server-zzgtgqmd.js → server-ddw42d76.js} +1 -1
- package/dist/v2/{server-63cz4w5t.js → server-ht0dyq9r.js} +3 -3
- package/dist/v2/{server-xnz3nrt2.js → server-pej5rnye.js} +1 -1
- package/dist/v2/{server-1c720m9s.js → server-rjn4msjj.js} +5 -5
- package/dist/v2/{server-rqypazrp.js → server-rshcp4gy.js} +3 -3
- package/dist/v2/{server-8xdnk7vz.js → server-sg2qjkrb.js} +1 -1
- package/dist/v2/{server-aqgg41wb.js → server-sr8tf5dt.js} +3 -3
- package/dist/v2/{server-qs0mdpc1.js → server-sscb1r3e.js} +7 -7
- package/dist/v2/{server-xfjjbrkt.js → server-t4hk02v1.js} +11 -11
- package/dist/v2/{server-vjhk8v41.js → server-wa4qhryh.js} +1 -1
- package/dist/v2/{server-cp1a03vc.js → server-y8n33d9j.js} +3 -3
- package/dist/v2/{server-qxzbmtqt.js → server-zt1m5rwj.js} +10 -2
- package/dist/v2/server.js +4 -4
- package/dist/v2/{storage-tags-cw07ky67.js → storage-tags-ztar1k0g.js} +4 -2
- package/dist/v2/{v2-archive-reader-qwn0me88.js → v2-archive-reader-tme5988n.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-ts0sqwp3.js → wrapup-orchestrator-k7m16xze.js} +19 -19
- package/dist/{v2-archive-reader-vqqjkeaq.js → v2-archive-reader-dq5ebwe6.js} +1 -1
- package/dist/{wrapup-orchestrator-qxvbvr4r.js → wrapup-orchestrator-4pqwet8p.js} +21 -21
- package/package.json +1 -1
- package/src/agents/smart-notes-dreamer-gate.golden.json +169 -169
- package/src/shared/prompt-surface-a1-golden.md +4 -4
- package/src/shared/window-geometry.test.ts +85 -0
- package/src/shared/window-geometry.ts +29 -2
|
@@ -210,6 +210,91 @@ describe("window geometry", () => {
|
|
|
210
210
|
expect(escaped.geometry.derivation.absoluteWall).toBe(90_000);
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
+
test("caps the hard wall at a declared input limit", () => {
|
|
214
|
+
// A provider rejects a prompt over its declared input limit however much
|
|
215
|
+
// room the context window leaves after output, so that limit is the wall
|
|
216
|
+
// the 95% emergency lines read, for every geometry.
|
|
217
|
+
const cases = [
|
|
218
|
+
{
|
|
219
|
+
provider: "opencode-go",
|
|
220
|
+
limit: { context: 1_000_000, input: 302_222, output: 65_536 },
|
|
221
|
+
usableHard: 302_222,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
provider: "anthropic",
|
|
225
|
+
limit: { context: 1_000_000, input: 900_000, output: 128_000 },
|
|
226
|
+
usableHard: 900_000,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
provider: "google",
|
|
230
|
+
limit: { context: 1_048_576, input: 1_000_000, output: 65_536 },
|
|
231
|
+
usableHard: 1_000_000,
|
|
232
|
+
},
|
|
233
|
+
] as const;
|
|
234
|
+
for (const { provider, limit, usableHard } of cases) {
|
|
235
|
+
const result = deriveWindowGeometry(provider, "model", limit);
|
|
236
|
+
expect({ usableSoft: result?.usableSoft, usableHard: result?.usableHard }).toEqual({
|
|
237
|
+
usableSoft: limit.input,
|
|
238
|
+
usableHard,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
// Without a declared input limit the wall stays the context less the
|
|
242
|
+
// output the request asks for.
|
|
243
|
+
expect(
|
|
244
|
+
deriveWindowGeometry("opencode-go", "model", { context: 1_000_000, output: 65_536 })
|
|
245
|
+
?.usableHard,
|
|
246
|
+
).toBe(968_000);
|
|
247
|
+
// A configured output reserve narrows the usable window, not the wall.
|
|
248
|
+
const reserved = deriveWindowGeometry(
|
|
249
|
+
"openai-codex",
|
|
250
|
+
"gpt-5.6-sol",
|
|
251
|
+
{ context: 400_000, input: 272_000, output: 128_000 },
|
|
252
|
+
{ outputReserveOverride: 16_384 },
|
|
253
|
+
);
|
|
254
|
+
expect({ usableSoft: reserved?.usableSoft, usableHard: reserved?.usableHard }).toEqual({
|
|
255
|
+
usableSoft: 272_000 - 16_384,
|
|
256
|
+
usableHard: 272_000,
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test("a proven floor above a declared input limit lifts the cap from the hard wall", () => {
|
|
261
|
+
// An accepted request larger than the declared input limit proves that
|
|
262
|
+
// limit wrong. The hard wall goes back to the context less the requested
|
|
263
|
+
// output (968,000) instead of rising to each new high reading, which
|
|
264
|
+
// would put every such reading at 100% of it.
|
|
265
|
+
const limit = { context: 1_000_000, input: 302_222, output: 65_536 };
|
|
266
|
+
const catalog = deriveWindowGeometry("opencode-go", "model", limit);
|
|
267
|
+
expect(catalog?.usableHard).toBe(302_222);
|
|
268
|
+
for (const proven of [400_000, 500_000]) {
|
|
269
|
+
const floored = applyProvenInputFloor(catalog!, proven).geometry;
|
|
270
|
+
expect({ usableSoft: floored.usableSoft, usableHard: floored.usableHard }).toEqual({
|
|
271
|
+
usableSoft: proven,
|
|
272
|
+
usableHard: 968_000,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
// A reading past that wall still raises it, as on a model without an
|
|
276
|
+
// input limit.
|
|
277
|
+
expect(applyProvenInputFloor(catalog!, 990_000).geometry.usableHard).toBe(990_000);
|
|
278
|
+
// A reading within the input limit proves nothing.
|
|
279
|
+
expect(applyProvenInputFloor(catalog!, 250_000).geometry).toEqual(catalog!);
|
|
280
|
+
// A provider-sourced wall is trusted: the reading raises only the soft limit.
|
|
281
|
+
const provider = deriveWindowGeometry("opencode-go", "model", limit, {
|
|
282
|
+
providerLimit: { context: 1_000_000, input: 302_222 },
|
|
283
|
+
});
|
|
284
|
+
const trusted = applyProvenInputFloor(provider!, 400_000).geometry;
|
|
285
|
+
expect({ usableSoft: trusted.usableSoft, usableHard: trusted.usableHard }).toEqual({
|
|
286
|
+
usableSoft: 400_000,
|
|
287
|
+
usableHard: 968_000,
|
|
288
|
+
});
|
|
289
|
+
// Without a declared input limit nothing changes.
|
|
290
|
+
const uncapped = deriveWindowGeometry("opencode-go", "model", {
|
|
291
|
+
context: 1_000_000,
|
|
292
|
+
output: 65_536,
|
|
293
|
+
});
|
|
294
|
+
expect(uncapped?.derivation.hardWithoutInputCap).toBeUndefined();
|
|
295
|
+
expect(applyProvenInputFloor(uncapped!, 990_000).geometry.usableHard).toBe(990_000);
|
|
296
|
+
});
|
|
297
|
+
|
|
213
298
|
test("clamps an inversion and logs it", () => {
|
|
214
299
|
const logs: string[] = [];
|
|
215
300
|
const result = deriveWindowGeometry(
|
|
@@ -31,6 +31,11 @@ export interface WindowDerivation {
|
|
|
31
31
|
absoluteWall: number;
|
|
32
32
|
/** Accepted provider input used to raise the usable denominator above metadata. */
|
|
33
33
|
provenInputTokens?: number;
|
|
34
|
+
/**
|
|
35
|
+
* The usable hard limit before a declared input limit lowered it, present
|
|
36
|
+
* only when it did.
|
|
37
|
+
*/
|
|
38
|
+
hardWithoutInputCap?: number;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
export interface WindowGeometryResult {
|
|
@@ -221,6 +226,17 @@ export function deriveWindowGeometry(
|
|
|
221
226
|
const requestedOutput = Math.min(output ?? OPENCODE_OUTPUT_CAP, OPENCODE_OUTPUT_CAP);
|
|
222
227
|
usableHard = hardWindow - requestedOutput;
|
|
223
228
|
}
|
|
229
|
+
// A declared input limit is the largest prompt the provider accepts, however
|
|
230
|
+
// much of the context window the output leaves free. Without this cap a model
|
|
231
|
+
// whose input limit is 302,222 inside a 1,000,000-token context would put its
|
|
232
|
+
// hard wall at 968,000, and the 95% lines that read it would sit past every
|
|
233
|
+
// prompt the provider accepts. The wall it replaces is kept for the case where
|
|
234
|
+
// an accepted request proves the declared limit wrong (applyProvenInputFloor).
|
|
235
|
+
let hardWithoutInputCap: number | undefined;
|
|
236
|
+
if (isFinitePositive(input) && input < usableHard) {
|
|
237
|
+
hardWithoutInputCap = Math.max(MIN_PLAUSIBLE_CONTEXT_LIMIT, Math.floor(usableHard));
|
|
238
|
+
usableHard = input;
|
|
239
|
+
}
|
|
224
240
|
usableHard = Math.max(MIN_PLAUSIBLE_CONTEXT_LIMIT, Math.floor(usableHard));
|
|
225
241
|
if (usableHard < usableSoft) {
|
|
226
242
|
logGeometryClampOnce(
|
|
@@ -243,6 +259,7 @@ export function deriveWindowGeometry(
|
|
|
243
259
|
geometry,
|
|
244
260
|
windowSource,
|
|
245
261
|
absoluteWall: Math.floor(hardWindow),
|
|
262
|
+
...(hardWithoutInputCap !== undefined ? { hardWithoutInputCap } : {}),
|
|
246
263
|
},
|
|
247
264
|
};
|
|
248
265
|
}
|
|
@@ -289,13 +306,23 @@ export function applyProvenInputFloor(
|
|
|
289
306
|
const window = trustedAbsoluteWall
|
|
290
307
|
? geometry.derivation.window
|
|
291
308
|
: Math.max(geometry.derivation.window, provenInputTokens);
|
|
309
|
+
// An accepted request larger than a declared input limit proves that limit
|
|
310
|
+
// wrong, so the hard limit it capped no longer applies. Without this the
|
|
311
|
+
// capped hard limit would rise to each new high reading, and every such
|
|
312
|
+
// reading would sit at 100% of it, past both 95% lines.
|
|
313
|
+
const inputCapDisproved =
|
|
314
|
+
geometry.derivation.hardWithoutInputCap !== undefined &&
|
|
315
|
+
provenInputTokens > geometry.usableHard;
|
|
316
|
+
const hardBeforeFloor = inputCapDisproved
|
|
317
|
+
? (geometry.derivation.hardWithoutInputCap as number)
|
|
318
|
+
: geometry.usableHard;
|
|
292
319
|
return {
|
|
293
320
|
geometry: {
|
|
294
321
|
...geometry,
|
|
295
322
|
usableSoft: provenInputTokens,
|
|
296
323
|
usableHard: trustedAbsoluteWall
|
|
297
|
-
?
|
|
298
|
-
: Math.max(
|
|
324
|
+
? hardBeforeFloor
|
|
325
|
+
: Math.max(hardBeforeFloor, provenInputTokens),
|
|
299
326
|
derivation: {
|
|
300
327
|
...geometry.derivation,
|
|
301
328
|
window,
|