@cortexkit/opencode-magic-context 0.49.46 → 0.49.48
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 +1 -1
- package/dist/chunk-embedding-write-worker.js +1 -1
- package/dist/{context-cb51adcz.js → context-8r125qv3.js} +68 -17
- package/dist/features/magic-context/request-tool-definitions.d.ts +57 -0
- package/dist/features/magic-context/request-tool-definitions.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +6 -3
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/host-checkpoint-ride.d.ts +80 -0
- package/dist/hooks/magic-context/host-checkpoint-ride.d.ts.map +1 -0
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +19 -0
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -1
- package/dist/hooks/magic-context/pending-materialization.d.ts +3 -0
- package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -1
- package/dist/hooks/magic-context/request-tools-release.d.ts +26 -0
- package/dist/hooks/magic-context/request-tools-release.d.ts.map +1 -0
- package/dist/hooks/magic-context/todo-view.d.ts +29 -17
- package/dist/hooks/magic-context/todo-view.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +7 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +9 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-x53gnmce.js → index-4wpfbzks.js} +3 -25
- package/dist/{index-66a50f3e.js → index-6athgjba.js} +66 -14
- package/dist/{index-pwfmcg4e.js → index-8ka0ne8t.js} +4 -4
- package/dist/{index-44pp3vrj.js → index-cgsmttyj.js} +1 -1
- package/dist/{index-gaxktvxm.js → index-cgzpbz78.js} +2 -2
- package/dist/{index-etn2hmb5.js → index-fgft4qjn.js} +1 -1
- package/dist/{index-snztv1f0.js → index-q41sm60t.js} +153 -36
- package/dist/{index-b0xt5qz9.js → index-q6pjqm49.js} +1 -1
- package/dist/{index-5jk4h64j.js → index-qsyx931k.js} +3 -3
- package/dist/{index-xgnh498s.js → index-rvmhyk89.js} +1 -1
- package/dist/{index-kw7azjmy.js → index-t6s0tsp7.js} +2 -2
- package/dist/{index-n9q8c1dr.js → index-ta87fpfs.js} +17 -4
- package/dist/{index-kevd267m.js → index-trkxkgmd.js} +3 -3
- package/dist/{index-a4t7pdmm.js → index-vk6srk5r.js} +5 -5
- package/dist/{index-29gd1zcx.js → index-w6fh4v87.js} +1 -1
- package/dist/{index-tajstyw4.js → index-xh3jyejb.js} +147 -16
- package/dist/{index-55ngkbqa.js → index-zetm0ayn.js} +151 -6
- package/dist/index.js +19 -19
- package/dist/{message-index-bounded-3qpg8dq5.js → message-index-bounded-0q7sy04w.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-7h9f32sz.js → read-session-chunk-7fmg9p5m.js} +2 -2
- package/dist/{recomp-orchestrator-qnactdw7.js → recomp-orchestrator-jqa5z4ar.js} +8 -8
- package/dist/{render-da999saz.js → render-mnqc74ar.js} +7 -7
- package/dist/{search-archive-0z9cxv8e.js → search-archive-df09r8qn.js} +4 -4
- package/dist/{search-0a3hh5x6.js → search-kt764afk.js} +5 -5
- package/dist/{storage-tags-q8erkn48.js → storage-tags-96vyd6ra.js} +1 -1
- package/dist/{store-pd1e9hnr.js → store-h20ny8b8.js} +2 -2
- package/dist/{store-reader-yh19h38c.js → store-reader-3eh1s1m8.js} +1 -1
- package/dist/{transform-postprocess-phase-k9d1r13f.js → transform-postprocess-phase-a7ety10n.js} +9 -9
- package/dist/v2/auto-search-worker.js +1 -1
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-jtqj5e1r.js → context-9x7mnb7x.js} +381 -81
- package/dist/v2/fold/manual-baseline.d.ts +7 -0
- package/dist/v2/fold/manual-baseline.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +8 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-60tdhht5.js → message-index-bounded-hctgp22r.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-9tmsxwb2.js → read-session-chunk-zknadvjr.js} +2 -2
- package/dist/v2/{recomp-orchestrator-7y8smqqp.js → recomp-orchestrator-m5w0eqke.js} +7 -7
- package/dist/v2/{render-j0y57skn.js → render-89asy54r.js} +7 -7
- package/dist/v2/{search-archive-1e2tr8eq.js → search-archive-axz2gbdb.js} +4 -4
- package/dist/v2/{search-qhd2m8kn.js → search-kdtja5rx.js} +4 -4
- package/dist/v2/{server-rjn4msjj.js → server-27kccwe7.js} +17 -4
- package/dist/v2/{server-5vy0xt3p.js → server-4x7n5qz7.js} +1 -1
- package/dist/v2/{server-ymn9w46x.js → server-5zzt9rah.js} +1 -1
- package/dist/v2/{server-t4hk02v1.js → server-7be0ersd.js} +3 -25
- package/dist/v2/{server-3rp821fw.js → server-e3m10ds0.js} +1 -1
- package/dist/v2/{server-4m71jpaj.js → server-jqn7q7tm.js} +2 -2
- package/dist/v2/{server-sscb1r3e.js → server-jra7awr5.js} +2 -2
- package/dist/v2/{server-5dtrzs6j.js → server-nn4hbymt.js} +25 -2
- package/dist/v2/{server-ef1mskas.js → server-rthnpmbp.js} +66 -14
- package/dist/v2/{server-ahy062xr.js → server-yyqmvbvv.js} +151 -6
- package/dist/v2/{server-rshcp4gy.js → server-z3tyd1mx.js} +5 -5
- package/dist/v2/{server-ht0dyq9r.js → server-zahgxer8.js} +2 -2
- package/dist/v2/server.js +2 -2
- package/dist/v2/{storage-tags-ztar1k0g.js → storage-tags-xq8hjqkf.js} +1 -1
- package/dist/v2/{store-reader-cgx47zkp.js → store-reader-yaxtdy6f.js} +1 -1
- package/dist/v2/store-reader.d.ts +22 -1
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{store-pebs9m52.js → store-skkhh3rd.js} +2 -2
- package/dist/v2/{v2-archive-reader-tme5988n.js → v2-archive-reader-ky1wqcws.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-k7m16xze.js → wrapup-orchestrator-6wt67saz.js} +7 -7
- package/dist/{v2-archive-reader-dq5ebwe6.js → v2-archive-reader-665x2x4d.js} +1 -1
- package/dist/{wrapup-orchestrator-4pqwet8p.js → wrapup-orchestrator-7kmb3jf9.js} +9 -9
- package/package.json +1 -1
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
adoptNullOwnerToolTag2,
|
|
75
75
|
getCandidateToolOwners2,
|
|
76
76
|
pickNearestPriorOwner2
|
|
77
|
-
} from "./index-
|
|
77
|
+
} from "./index-4wpfbzks.js";
|
|
78
78
|
import {
|
|
79
79
|
textMentionsRecentCommit,
|
|
80
80
|
hasMeaningfulUserText2,
|
|
@@ -117,14 +117,15 @@ import {
|
|
|
117
117
|
pendingMaterializationOrigin,
|
|
118
118
|
hasPendingMaterializationOrigin,
|
|
119
119
|
clearPendingMaterialization,
|
|
120
|
+
clearPendingMaterializationOrigin,
|
|
120
121
|
saveSourceContent,
|
|
121
122
|
replaceSourceContent,
|
|
122
123
|
getSourceContents
|
|
123
|
-
} from "./index-
|
|
124
|
+
} from "./index-ta87fpfs.js";
|
|
124
125
|
import {
|
|
125
126
|
cleanSearchText,
|
|
126
127
|
matchedSearchSnippet
|
|
127
|
-
} from "./index-
|
|
128
|
+
} from "./index-fgft4qjn.js";
|
|
128
129
|
import {
|
|
129
130
|
stripSystemInjection,
|
|
130
131
|
isTextPart,
|
|
@@ -222,7 +223,7 @@ import {
|
|
|
222
223
|
extractToolCallObservation,
|
|
223
224
|
ToolMutationBatch,
|
|
224
225
|
createToolDropTarget
|
|
225
|
-
} from "./index-
|
|
226
|
+
} from "./index-rvmhyk89.js";
|
|
226
227
|
import {
|
|
227
228
|
isValidLanguageCode
|
|
228
229
|
} from "./index-4dpvnp8k.js";
|
|
@@ -238,7 +239,7 @@ import {
|
|
|
238
239
|
getMessageIndexEpoch,
|
|
239
240
|
isMessageIndexSearchable,
|
|
240
241
|
createAutoSearchDiagnostics
|
|
241
|
-
} from "./index-
|
|
242
|
+
} from "./index-cgsmttyj.js";
|
|
242
243
|
import {
|
|
243
244
|
openCodeDbExists,
|
|
244
245
|
withReadOnlySessionDb,
|
|
@@ -258,6 +259,7 @@ import {
|
|
|
258
259
|
renderCompartmentInjection,
|
|
259
260
|
MaterializeContentionError,
|
|
260
261
|
mustMaterialize,
|
|
262
|
+
stripMemoryMuralBlock,
|
|
261
263
|
hydrateCachedM0Mural,
|
|
262
264
|
prepareCachedM0M1Replay,
|
|
263
265
|
hasCompleteCachedM0M1,
|
|
@@ -266,7 +268,7 @@ import {
|
|
|
266
268
|
peekNoteNudgeText,
|
|
267
269
|
markNoteNudgeDelivered,
|
|
268
270
|
getActiveCompartmentRun
|
|
269
|
-
} from "./index-
|
|
271
|
+
} from "./index-zetm0ayn.js";
|
|
270
272
|
import {
|
|
271
273
|
userFacingFailureCode
|
|
272
274
|
} from "./index-sd2s4t4p.js";
|
|
@@ -2496,7 +2498,7 @@ function hasReclaimRide(signals) {
|
|
|
2496
2498
|
return signals.hardFold || signals.force || signals.explicitFlush || signals.publishedHistory || signals.subagentExecute === true || signals.executeReclaim === true || signals.servedShapeRepair === true;
|
|
2497
2499
|
}
|
|
2498
2500
|
function prefixMutationPermitted(gate) {
|
|
2499
|
-
return !gate.signedThinkingHold || gate.firstRender || gate.emergency;
|
|
2501
|
+
return !gate.signedThinkingHold || gate.firstRender || gate.hostCheckpointHead === true || gate.emergency;
|
|
2500
2502
|
}
|
|
2501
2503
|
function reclaimRidePermitted(signals, gate) {
|
|
2502
2504
|
return prefixMutationPermitted(gate) && hasReclaimRide(signals);
|
|
@@ -3367,6 +3369,93 @@ function degradedPassError(site, error) {
|
|
|
3367
3369
|
return new DegradedPassRefusalError(site, { cause: error });
|
|
3368
3370
|
}
|
|
3369
3371
|
|
|
3372
|
+
// src/hooks/magic-context/host-checkpoint-ride.ts
|
|
3373
|
+
import { createHash } from "node:crypto";
|
|
3374
|
+
var SESSIONS_MAX = 100;
|
|
3375
|
+
var servedHeads = new BoundedSessionMap(SESSIONS_MAX);
|
|
3376
|
+
var commits = new BoundedSessionMap(SESSIONS_MAX);
|
|
3377
|
+
var passes = new BoundedSessionMap(SESSIONS_MAX);
|
|
3378
|
+
function servedHeadDigest(head) {
|
|
3379
|
+
if (head.m0Text == null || head.m1Text == null)
|
|
3380
|
+
return null;
|
|
3381
|
+
const mural = head.muralDataUrl ?? null;
|
|
3382
|
+
const m0 = mural ? head.m0Text : stripMemoryMuralBlock(head.m0Text);
|
|
3383
|
+
return createHash("sha256").update(JSON.stringify([m0, head.m1Text, mural])).digest("hex");
|
|
3384
|
+
}
|
|
3385
|
+
function servedHeadChanged(before, after) {
|
|
3386
|
+
const a = servedHeadDigest(before);
|
|
3387
|
+
return a === null || a !== servedHeadDigest(after);
|
|
3388
|
+
}
|
|
3389
|
+
function noteHostCheckpointCommit(sessionId, commit) {
|
|
3390
|
+
commits.set(sessionId, commit);
|
|
3391
|
+
}
|
|
3392
|
+
function hostCheckpointHeadChange(sessionId, head) {
|
|
3393
|
+
const commit = commits.peek(sessionId);
|
|
3394
|
+
if (commit)
|
|
3395
|
+
return {
|
|
3396
|
+
changed: commit.changed,
|
|
3397
|
+
source: "commit",
|
|
3398
|
+
previousCoverage: commit.previousCoverage
|
|
3399
|
+
};
|
|
3400
|
+
const served = servedHeads.peek(sessionId);
|
|
3401
|
+
const digest = served ? servedHeadDigest(head()) : null;
|
|
3402
|
+
if (!served || digest === null)
|
|
3403
|
+
return { changed: false, source: "none", previousCoverage: null };
|
|
3404
|
+
return {
|
|
3405
|
+
changed: served.digest !== digest,
|
|
3406
|
+
source: "served_head",
|
|
3407
|
+
previousCoverage: served.coverage
|
|
3408
|
+
};
|
|
3409
|
+
}
|
|
3410
|
+
function beginHostCheckpointPass(sessionId, pending) {
|
|
3411
|
+
passes.set(sessionId, {
|
|
3412
|
+
requested: hasPendingMaterializationOrigin(pending, sessionId, "host_compaction"),
|
|
3413
|
+
commit: commits.peek(sessionId),
|
|
3414
|
+
previousRecord: servedHeads.peek(sessionId)
|
|
3415
|
+
});
|
|
3416
|
+
}
|
|
3417
|
+
function stageServedHead(sessionId, head, coverage) {
|
|
3418
|
+
const state = passes.peek(sessionId);
|
|
3419
|
+
if (!state)
|
|
3420
|
+
return;
|
|
3421
|
+
const digest = servedHeadDigest(head);
|
|
3422
|
+
state.staged = digest === null ? null : { digest, coverage };
|
|
3423
|
+
}
|
|
3424
|
+
function completeHostCheckpointPass(sessionId, pending, withdraw) {
|
|
3425
|
+
const state = passes.peek(sessionId);
|
|
3426
|
+
if (!state)
|
|
3427
|
+
return;
|
|
3428
|
+
if (state.staged !== undefined) {
|
|
3429
|
+
if (state.staged)
|
|
3430
|
+
servedHeads.set(sessionId, state.staged);
|
|
3431
|
+
else
|
|
3432
|
+
servedHeads.delete(sessionId);
|
|
3433
|
+
}
|
|
3434
|
+
if (withdraw)
|
|
3435
|
+
clearPendingMaterializationOrigin(pending, sessionId, "host_compaction");
|
|
3436
|
+
if (!hasPendingMaterializationOrigin(pending, sessionId, "host_compaction"))
|
|
3437
|
+
commits.delete(sessionId);
|
|
3438
|
+
}
|
|
3439
|
+
function revertHostCheckpointPass(sessionId, pending) {
|
|
3440
|
+
const state = passes.peek(sessionId);
|
|
3441
|
+
passes.delete(sessionId);
|
|
3442
|
+
if (!state)
|
|
3443
|
+
return;
|
|
3444
|
+
if (state.previousRecord)
|
|
3445
|
+
servedHeads.set(sessionId, state.previousRecord);
|
|
3446
|
+
else
|
|
3447
|
+
servedHeads.delete(sessionId);
|
|
3448
|
+
if (!state.requested)
|
|
3449
|
+
return;
|
|
3450
|
+
if (state.commit)
|
|
3451
|
+
commits.set(sessionId, state.commit);
|
|
3452
|
+
if (!hasPendingMaterializationOrigin(pending, sessionId, "host_compaction"))
|
|
3453
|
+
requestPendingMaterialization(pending, sessionId, "host_compaction");
|
|
3454
|
+
}
|
|
3455
|
+
function forgetHostCheckpointPass(sessionId) {
|
|
3456
|
+
passes.delete(sessionId);
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3370
3459
|
// src/features/magic-context/storage-host-instruction-retention.ts
|
|
3371
3460
|
var NAMESPACE3 = "hostInstructionRetention";
|
|
3372
3461
|
var enabled = true;
|
|
@@ -4943,7 +5032,7 @@ function createExistingTagResolver(sessionId, tagger, db) {
|
|
|
4943
5032
|
// src/hooks/magic-context/transform-stage-logger.ts
|
|
4944
5033
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4945
5034
|
var SLOW_STAGE_MS = 100;
|
|
4946
|
-
var
|
|
5035
|
+
var passes2 = new AsyncLocalStorage;
|
|
4947
5036
|
async function withTransformTimingSummary(run) {
|
|
4948
5037
|
const pass = {
|
|
4949
5038
|
stages: [],
|
|
@@ -4951,7 +5040,7 @@ async function withTransformTimingSummary(run) {
|
|
|
4951
5040
|
closed: false,
|
|
4952
5041
|
sessionId: undefined
|
|
4953
5042
|
};
|
|
4954
|
-
return
|
|
5043
|
+
return passes2.run(pass, async () => {
|
|
4955
5044
|
try {
|
|
4956
5045
|
return await run();
|
|
4957
5046
|
} finally {
|
|
@@ -4964,7 +5053,7 @@ async function withTransformTimingSummary(run) {
|
|
|
4964
5053
|
function logTransformElapsed(sessionId, stage, elapsedMs, extra) {
|
|
4965
5054
|
const elapsed = elapsedMs.toFixed(1);
|
|
4966
5055
|
const suffix = extra ? ` ${extra}` : "";
|
|
4967
|
-
const pass =
|
|
5056
|
+
const pass = passes2.getStore();
|
|
4968
5057
|
if (pass && !pass.closed) {
|
|
4969
5058
|
pass.sessionId = sessionId;
|
|
4970
5059
|
pass.stages.push(`${stage}=${elapsed}ms${extra ? `(${extra})` : ""}`);
|
|
@@ -6345,6 +6434,7 @@ async function runPostTransformPhase2(args) {
|
|
|
6345
6434
|
}
|
|
6346
6435
|
const reasoningMutationExemptMessage = findLatestAssistantReasoningMutationExemptMessage(args.messages);
|
|
6347
6436
|
const pendingMaterializationAtPassStart = args.pendingMaterializationSessions.has(args.sessionId);
|
|
6437
|
+
beginHostCheckpointPass(args.sessionId, args.pendingMaterializationSessions);
|
|
6348
6438
|
const pendingOrigin = pendingMaterializationOrigin(args.pendingMaterializationSessions, args.sessionId);
|
|
6349
6439
|
const deferredMaterializationAtPassStart = args.deferredMaterializationSessions.has(args.sessionId);
|
|
6350
6440
|
let isExplicitFlush = pendingMaterializationAtPassStart;
|
|
@@ -6433,6 +6523,26 @@ async function runPostTransformPhase2(args) {
|
|
|
6433
6523
|
sessionLog2(args.sessionId, "compaction mode switch: stripping signed thinking");
|
|
6434
6524
|
releaseThinkingForRewrite(false, true);
|
|
6435
6525
|
}
|
|
6526
|
+
const hostCheckpointRequested = hasPendingMaterializationOrigin(args.pendingMaterializationSessions, args.sessionId, "host_compaction");
|
|
6527
|
+
const hostCheckpointProof = hostCheckpointRequested && m0M1EnabledForFold ? hostCheckpointHeadChange(args.sessionId, () => {
|
|
6528
|
+
hydrateCachedM0Mural(args.db, args.sessionId, args.sessionMeta);
|
|
6529
|
+
return {
|
|
6530
|
+
m0Text: args.sessionMeta.cachedM0Bytes?.toString("utf8"),
|
|
6531
|
+
m1Text: args.sessionMeta.cachedM1Bytes?.toString("utf8"),
|
|
6532
|
+
muralDataUrl: args.sessionMeta.cachedM0MuralDataUrl ?? null
|
|
6533
|
+
};
|
|
6534
|
+
}) : undefined;
|
|
6535
|
+
const hostCheckpointRide = hostCheckpointProof?.changed === true;
|
|
6536
|
+
if (hostCheckpointRequested) {
|
|
6537
|
+
sessionLog2(args.sessionId, `host checkpoint head: changed=${hostCheckpointRide} proof=${hostCheckpointProof?.source ?? "none"}`);
|
|
6538
|
+
}
|
|
6539
|
+
if (hostCheckpointRide && activeThinkingPrefixHold) {
|
|
6540
|
+
sessionLog2(args.sessionId, "host checkpoint head changed under a signed-thinking hold: stripping signed thinking");
|
|
6541
|
+
releaseThinkingForRewrite(false, true);
|
|
6542
|
+
}
|
|
6543
|
+
if (args.requestToolsChange && args.thinkingBindingRecoveryEnabledForModel === true) {
|
|
6544
|
+
releaseThinkingForRewrite(false, true);
|
|
6545
|
+
}
|
|
6436
6546
|
const foldDueDecision = m0M1EnabledForFold && args.m0M1 && !freezeM0M1 ? mustMaterialize({
|
|
6437
6547
|
db: args.db,
|
|
6438
6548
|
sessionId: args.sessionId,
|
|
@@ -6600,7 +6710,7 @@ async function runPostTransformPhase2(args) {
|
|
|
6600
6710
|
servedShapeRepair: servedShapeRepair.needsRebuild,
|
|
6601
6711
|
executeReclaim: false,
|
|
6602
6712
|
subagentExecute: !args.fullFeatureMode && args.schedulerDecision === "execute",
|
|
6603
|
-
hardFold: rewritingSignedPrefix || foldBustsServedPrefixThisPass || firstRenderBust,
|
|
6713
|
+
hardFold: rewritingSignedPrefix || foldBustsServedPrefixThisPass || firstRenderBust || hostCheckpointRide,
|
|
6604
6714
|
force: forceRide({
|
|
6605
6715
|
bands,
|
|
6606
6716
|
percentage: args.contextUsage.percentage,
|
|
@@ -6630,6 +6740,7 @@ async function runPostTransformPhase2(args) {
|
|
|
6630
6740
|
const publishedWorkDrainAllowed = (!compactionOff || servedShapeRepair.needsRebuild) && reclaimRidePermitted(rideSignals, {
|
|
6631
6741
|
signedThinkingHold: activeThinkingPrefixHold,
|
|
6632
6742
|
firstRender: firstRenderBust,
|
|
6743
|
+
hostCheckpointHead: hostCheckpointRide,
|
|
6633
6744
|
emergency: forceBandConfirmed
|
|
6634
6745
|
});
|
|
6635
6746
|
const shouldApplyPendingOps = !compactionOff && publishedWorkDrainAllowed;
|
|
@@ -6651,7 +6762,7 @@ async function runPostTransformPhase2(args) {
|
|
|
6651
6762
|
servedShapeRepair.apply(isCacheBustingPass);
|
|
6652
6763
|
let unheldSignedTurnBust = false;
|
|
6653
6764
|
if (isCacheBustingPass && !activeThinkingPrefixHold && activeThinkingTurn && args.thinkingBindingRecoveryEnabledForModel === true) {
|
|
6654
|
-
if (foldBustsServedPrefixThisPass || firstRenderBust || publishedM1RefreshedThisPass)
|
|
6765
|
+
if (foldBustsServedPrefixThisPass || firstRenderBust || publishedM1RefreshedThisPass || hostCheckpointRide)
|
|
6655
6766
|
releaseThinkingForRewrite();
|
|
6656
6767
|
else {
|
|
6657
6768
|
unheldSignedTurnBust = true;
|
|
@@ -6661,7 +6772,7 @@ async function runPostTransformPhase2(args) {
|
|
|
6661
6772
|
}
|
|
6662
6773
|
}
|
|
6663
6774
|
const recoveryHasHistoryHead = m0M1EnabledForFold || (args.pendingCompartmentInjection?.compartmentCount ?? 0) > 0;
|
|
6664
|
-
const recoveryHeadChangedThisPass = !prefixPreflightFailed && (foldChangesHeadThisPass || !firstRenderBust && publishedM1RefreshedThisPass || !m0M1EnabledForFold && legacyPublishedHeadChanged(args));
|
|
6775
|
+
const recoveryHeadChangedThisPass = !prefixPreflightFailed && (foldChangesHeadThisPass || hostCheckpointRide || !firstRenderBust && publishedM1RefreshedThisPass || !m0M1EnabledForFold && legacyPublishedHeadChanged(args));
|
|
6665
6776
|
const recoveryHeadlessRebuild = !recoveryHasHistoryHead && (args.schedulerDecision === "execute" || isExplicitFlush || forceMaterialization || emergencyDropEligible);
|
|
6666
6777
|
const recoveredShapeRewriteProof = recoveryHeadChangedThisPass ? "head_bytes" : recoveryExternalFoldCause ?? (recoveryHeadlessRebuild ? "headless_rebuild" : null);
|
|
6667
6778
|
const canNormalizeRecoveredShape = isCacheBustingPass && !activeThinkingPrefixHold && recoveredShapeRewriteProof !== null;
|
|
@@ -6865,7 +6976,7 @@ async function runPostTransformPhase2(args) {
|
|
|
6865
6976
|
wordRules: args.cavemanTextCompression.wordRules
|
|
6866
6977
|
} : undefined;
|
|
6867
6978
|
const heuristicTags = shouldApplyPendingOps ? getActiveTagsBySession2(args.db, args.sessionId) : args.tags;
|
|
6868
|
-
const emergencyRewriteAlreadyPriced = pendingOpsDidMutate || foldBustsServedPrefixThisPass || firstRenderBust || args.historyRebuiltThisPass || args.compartmentInjectionRebuiltFromDb || args.rebuiltHistoryFromInitialPrepare;
|
|
6979
|
+
const emergencyRewriteAlreadyPriced = pendingOpsDidMutate || foldBustsServedPrefixThisPass || firstRenderBust || hostCheckpointRide || args.historyRebuiltThisPass || args.compartmentInjectionRebuiltFromDb || args.rebuiltHistoryFromInitialPrepare;
|
|
6869
6980
|
if (forceBandConfirmed && emergencyRewriteAlreadyPriced && getEmergencyInputSample(args.db, args.sessionId) > 0) {
|
|
6870
6981
|
clearEmergencyDropSample(args.db, args.sessionId);
|
|
6871
6982
|
}
|
|
@@ -7241,6 +7352,11 @@ async function runPostTransformPhase2(args) {
|
|
|
7241
7352
|
if (result.m0RematerializedThisPass) {
|
|
7242
7353
|
m0ComparisonDecision = result.decision;
|
|
7243
7354
|
}
|
|
7355
|
+
stageServedHead(args.sessionId, {
|
|
7356
|
+
m0Text: args.sessionMeta.cachedM0Bytes?.toString("utf8"),
|
|
7357
|
+
m1Text: args.sessionMeta.cachedM1Bytes?.toString("utf8"),
|
|
7358
|
+
muralDataUrl: args.sessionMeta.cachedM0MuralDataUrl ?? null
|
|
7359
|
+
}, args.sessionMeta.cachedM0Bytes == null ? -1 : args.sessionMeta.cachedM0MaxCompartmentSeq);
|
|
7244
7360
|
sessionLog2(args.sessionId, `transform: injected m[0]/m[1] (rematerialized=${result.m0RematerializedThisPass}, reason=${result.decision.reason ?? "cache_hit"})`);
|
|
7245
7361
|
}
|
|
7246
7362
|
} catch (error) {
|
|
@@ -7529,7 +7645,7 @@ async function runPostTransformPhase2(args) {
|
|
|
7529
7645
|
}
|
|
7530
7646
|
const materializeReason = m0MaterializeReason ?? (explicitMaterializedSuccessfully ? pendingOrigin : null);
|
|
7531
7647
|
const materialized = m0RematerializedThisPass || explicitMaterializedSuccessfully || deferredMaterializedSuccessfully;
|
|
7532
|
-
let bustedThisPass = firstApplicationEdits.any || firstRenderBust || pendingOpsDidMutate || heuristicOrReasoningDidMutate || autoReclaimDidMutateThisPass || convertedToolSkeletonsDidMutate || m0RematerializedThisPass || m0M1InjectedThisPass && historyWasConsumedThisPass || historyWasConsumedThisPass;
|
|
7648
|
+
let bustedThisPass = firstApplicationEdits.any || firstRenderBust || hostCheckpointRide || pendingOpsDidMutate || heuristicOrReasoningDidMutate || autoReclaimDidMutateThisPass || convertedToolSkeletonsDidMutate || m0RematerializedThisPass || m0M1InjectedThisPass && historyWasConsumedThisPass || historyWasConsumedThisPass;
|
|
7533
7649
|
const proactiveThinkingStripPermitted = isCacheBustingPass && !activeThinkingPrefixHold;
|
|
7534
7650
|
const tFrozenDecisions = performance.now();
|
|
7535
7651
|
if (reasoningMutationTargetUnknown) {
|
|
@@ -7913,6 +8029,21 @@ async function runPostTransformPhase2(args) {
|
|
|
7913
8029
|
logTransformTiming(args.sessionId, "pp.tailGuard", tTailGuard);
|
|
7914
8030
|
if (bustedThisPass)
|
|
7915
8031
|
clearExecuteReclaimState(args.db, args.sessionId);
|
|
8032
|
+
if (hostCheckpointRide && isCacheBustingPass) {
|
|
8033
|
+
try {
|
|
8034
|
+
rearmChannel2AfterCoverageAdvancingHardFold({
|
|
8035
|
+
db: args.db,
|
|
8036
|
+
sessionId: args.sessionId,
|
|
8037
|
+
foldExecuted: true,
|
|
8038
|
+
compactionOff,
|
|
8039
|
+
previousCoverage: hostCheckpointProof?.previousCoverage ?? null,
|
|
8040
|
+
currentCoverage: args.sessionMeta.cachedM0Bytes == null ? null : args.sessionMeta.cachedM0MaxCompartmentSeq
|
|
8041
|
+
});
|
|
8042
|
+
} catch (error) {
|
|
8043
|
+
sessionLog2(args.sessionId, "channel2 host-checkpoint reset failed (ignored):", error);
|
|
8044
|
+
}
|
|
8045
|
+
}
|
|
8046
|
+
completeHostCheckpointPass(args.sessionId, args.pendingMaterializationSessions, hostCheckpointRequested && (!hostCheckpointRide || isCacheBustingPass || compactionOff));
|
|
7916
8047
|
return {
|
|
7917
8048
|
explicitMaterializedSuccessfully,
|
|
7918
8049
|
deferredMaterializedSuccessfully,
|
|
@@ -7949,4 +8080,4 @@ function checkM0MutationDriftAndSignal2(args) {
|
|
|
7949
8080
|
return false;
|
|
7950
8081
|
}
|
|
7951
8082
|
|
|
7952
|
-
export { makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, removeReasoningParts, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, retainedActiveThinkingParts, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, hostInstructionRetentionEnabled, isHostInstructionRetentionOn, pressureBands, forceRide, heuristicsRunOnPass, routineCleanupRunsOnPass, heuristicsAlreadyRanThisTurn, routinePressureAlreadyApplied, safeReasoningCutoff, isStructuralNoiseSentinel, stripStructuralNoise, prepareStructuralSentinelChoices, renderDroppedText, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, collectForeignTextParts, isLegacyForeignTextTag, withTransformTimingSummary, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, servesThinkingBlock2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
|
|
8083
|
+
export { makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, removeReasoningParts, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, retainedActiveThinkingParts, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, servedHeadChanged, noteHostCheckpointCommit, revertHostCheckpointPass, forgetHostCheckpointPass, hostInstructionRetentionEnabled, isHostInstructionRetentionOn, pressureBands, forceRide, heuristicsRunOnPass, routineCleanupRunsOnPass, heuristicsAlreadyRanThisTurn, routinePressureAlreadyApplied, safeReasoningCutoff, isStructuralNoiseSentinel, stripStructuralNoise, prepareStructuralSentinelChoices, renderDroppedText, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, collectForeignTextParts, isLegacyForeignTextTag, withTransformTimingSummary, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, servesThinkingBlock2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
getRawSessionTagKeysThrough2,
|
|
73
73
|
getLegacyProtectedTailStartOrdinal2,
|
|
74
74
|
readSessionChunk2
|
|
75
|
-
} from "./index-
|
|
75
|
+
} from "./index-rvmhyk89.js";
|
|
76
76
|
import {
|
|
77
77
|
getHarness2,
|
|
78
78
|
harnessOwnsOpenCodeStore2
|
|
@@ -153,7 +153,7 @@ import {
|
|
|
153
153
|
LATEST_SUPPORTED_VERSION,
|
|
154
154
|
getPersistedSchemaVersion,
|
|
155
155
|
openDatabase
|
|
156
|
-
} from "./index-
|
|
156
|
+
} from "./index-q6pjqm49.js";
|
|
157
157
|
import {
|
|
158
158
|
areRustHistorianSyntheticParts2,
|
|
159
159
|
isStrictGapHealingMessage2,
|
|
@@ -239,14 +239,14 @@ import {
|
|
|
239
239
|
getProjectState,
|
|
240
240
|
recordSubagentInvocation,
|
|
241
241
|
getLatestHistorianInvocationId
|
|
242
|
-
} from "./index-
|
|
242
|
+
} from "./index-ta87fpfs.js";
|
|
243
243
|
import {
|
|
244
244
|
clearCompressionDepth,
|
|
245
245
|
clearCompressionDepthRange,
|
|
246
246
|
toMessageIndexSource,
|
|
247
247
|
clearIndexedMessagesInTransaction,
|
|
248
248
|
indexSourcesAfterOrdinal
|
|
249
|
-
} from "./index-
|
|
249
|
+
} from "./index-fgft4qjn.js";
|
|
250
250
|
import {
|
|
251
251
|
stripWellFormedLeadingTagPrefix,
|
|
252
252
|
peelLeadingMcTagNotation,
|
|
@@ -257,7 +257,7 @@ import {
|
|
|
257
257
|
foldShrunkPartTags2,
|
|
258
258
|
getTagNumberByMessageId2,
|
|
259
259
|
getActiveTagsBySession2
|
|
260
|
-
} from "./index-
|
|
260
|
+
} from "./index-4wpfbzks.js";
|
|
261
261
|
import {
|
|
262
262
|
openCodeDbExists,
|
|
263
263
|
withReadOnlySessionDb,
|
|
@@ -7895,6 +7895,151 @@ function describeRequestToolDefinitionChange(previous, current) {
|
|
|
7895
7895
|
}
|
|
7896
7896
|
return { previousHash: before.hash, currentHash: after.hash, firstDifferingTool };
|
|
7897
7897
|
}
|
|
7898
|
+
var v2SchemaDigests = new Map;
|
|
7899
|
+
var V2_SCHEMA_DIGEST_NAMES = 2048;
|
|
7900
|
+
function v2SchemaDigest(name, schema) {
|
|
7901
|
+
let text;
|
|
7902
|
+
try {
|
|
7903
|
+
text = JSON.stringify(schema);
|
|
7904
|
+
} catch {
|
|
7905
|
+
return requestToolSchemaDigest(schema);
|
|
7906
|
+
}
|
|
7907
|
+
if (text === undefined)
|
|
7908
|
+
return requestToolSchemaDigest(schema);
|
|
7909
|
+
const cached = v2SchemaDigests.get(name);
|
|
7910
|
+
if (cached?.text === text)
|
|
7911
|
+
return cached.digest;
|
|
7912
|
+
const digest = requestToolSchemaDigest(schema);
|
|
7913
|
+
if (!cached && v2SchemaDigests.size >= V2_SCHEMA_DIGEST_NAMES) {
|
|
7914
|
+
const oldest = v2SchemaDigests.keys().next().value;
|
|
7915
|
+
if (oldest !== undefined)
|
|
7916
|
+
v2SchemaDigests.delete(oldest);
|
|
7917
|
+
}
|
|
7918
|
+
v2SchemaDigests.set(name, { text, digest });
|
|
7919
|
+
return digest;
|
|
7920
|
+
}
|
|
7921
|
+
function v2RequestToolsFingerprint(tools, messages = []) {
|
|
7922
|
+
const entries = [];
|
|
7923
|
+
for (const [name, tool] of Object.entries(tools)) {
|
|
7924
|
+
if (!tool)
|
|
7925
|
+
continue;
|
|
7926
|
+
const declared = tool;
|
|
7927
|
+
entries.push({
|
|
7928
|
+
name,
|
|
7929
|
+
description: typeof tool.description === "string" ? tool.description : "",
|
|
7930
|
+
schemaDigest: v2SchemaDigest(name, tool.input),
|
|
7931
|
+
deferLoading: declared.defer_loading === true || declared.deferLoading === true
|
|
7932
|
+
});
|
|
7933
|
+
}
|
|
7934
|
+
return requestToolsFingerprint(entries, () => {
|
|
7935
|
+
const referenced = new Set;
|
|
7936
|
+
for (const message of messages)
|
|
7937
|
+
for (const part of message.content) {
|
|
7938
|
+
if (typeof part.type !== "string" || !part.type.includes("tool"))
|
|
7939
|
+
continue;
|
|
7940
|
+
if (typeof part.name === "string")
|
|
7941
|
+
referenced.add(part.name);
|
|
7942
|
+
if (typeof part.tool === "string")
|
|
7943
|
+
referenced.add(part.tool);
|
|
7944
|
+
}
|
|
7945
|
+
return referenced;
|
|
7946
|
+
});
|
|
7947
|
+
}
|
|
7948
|
+
function requestToolsFingerprint(tools, referencedNames) {
|
|
7949
|
+
let referenced;
|
|
7950
|
+
const included = [];
|
|
7951
|
+
for (const tool of tools) {
|
|
7952
|
+
if (tool.deferLoading === true) {
|
|
7953
|
+
referenced ??= referencedNames?.() ?? new Set;
|
|
7954
|
+
if (!referenced.has(tool.name))
|
|
7955
|
+
continue;
|
|
7956
|
+
}
|
|
7957
|
+
included.push(tool);
|
|
7958
|
+
}
|
|
7959
|
+
included.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
7960
|
+
return {
|
|
7961
|
+
names: sha(included.map((tool) => tool.name)),
|
|
7962
|
+
descriptions: sha(included.map((tool) => [tool.name, tool.description])),
|
|
7963
|
+
schemas: sha(included.map((tool) => tool.deferLoading === true ? [tool.name, tool.description, tool.schemaDigest, "defer_loading"] : [tool.name, tool.description, tool.schemaDigest]))
|
|
7964
|
+
};
|
|
7965
|
+
}
|
|
7966
|
+
function classifyRequestToolsChange(previous, current) {
|
|
7967
|
+
if (previous.names !== current.names)
|
|
7968
|
+
return "names";
|
|
7969
|
+
if (previous.descriptions !== current.descriptions)
|
|
7970
|
+
return "descriptions";
|
|
7971
|
+
if (previous.schemas !== current.schemas)
|
|
7972
|
+
return "schemas";
|
|
7973
|
+
return null;
|
|
7974
|
+
}
|
|
7975
|
+
function requestToolSchemaDigest(schema) {
|
|
7976
|
+
const pieces = [];
|
|
7977
|
+
writeCanonicalJson(toJsonValue(schema, ""), [], pieces);
|
|
7978
|
+
return createHash6("sha256").update(pieces.join("")).digest("hex");
|
|
7979
|
+
}
|
|
7980
|
+
function isJsonValue(value) {
|
|
7981
|
+
return value !== undefined && typeof value !== "function" && typeof value !== "symbol";
|
|
7982
|
+
}
|
|
7983
|
+
function toJsonValue(value, key) {
|
|
7984
|
+
if (typeof value !== "object" || value === null)
|
|
7985
|
+
return value;
|
|
7986
|
+
const toJSON = value.toJSON;
|
|
7987
|
+
const resolved = typeof toJSON === "function" ? toJSON.call(value, key) : value;
|
|
7988
|
+
if (resolved instanceof Number)
|
|
7989
|
+
return Number(resolved);
|
|
7990
|
+
if (resolved instanceof String)
|
|
7991
|
+
return String(resolved);
|
|
7992
|
+
if (resolved instanceof Boolean)
|
|
7993
|
+
return resolved.valueOf();
|
|
7994
|
+
return resolved;
|
|
7995
|
+
}
|
|
7996
|
+
function writeCanonicalJson(value, ancestors, out) {
|
|
7997
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") {
|
|
7998
|
+
out.push(JSON.stringify(value));
|
|
7999
|
+
return;
|
|
8000
|
+
}
|
|
8001
|
+
if (typeof value === "number") {
|
|
8002
|
+
out.push(Number.isFinite(value) ? JSON.stringify(value) : "null");
|
|
8003
|
+
return;
|
|
8004
|
+
}
|
|
8005
|
+
if (typeof value === "bigint") {
|
|
8006
|
+
out.push(JSON.stringify(value.toString()));
|
|
8007
|
+
return;
|
|
8008
|
+
}
|
|
8009
|
+
if (typeof value !== "object") {
|
|
8010
|
+
out.push("null");
|
|
8011
|
+
return;
|
|
8012
|
+
}
|
|
8013
|
+
if (ancestors.includes(value)) {
|
|
8014
|
+
out.push('"[Circular]"');
|
|
8015
|
+
return;
|
|
8016
|
+
}
|
|
8017
|
+
ancestors.push(value);
|
|
8018
|
+
if (Array.isArray(value)) {
|
|
8019
|
+
out.push("[");
|
|
8020
|
+
for (let index = 0;index < value.length; index += 1) {
|
|
8021
|
+
if (index > 0)
|
|
8022
|
+
out.push(",");
|
|
8023
|
+
const item = toJsonValue(value[index], String(index));
|
|
8024
|
+
if (isJsonValue(item))
|
|
8025
|
+
writeCanonicalJson(item, ancestors, out);
|
|
8026
|
+
else
|
|
8027
|
+
out.push("null");
|
|
8028
|
+
}
|
|
8029
|
+
out.push("]");
|
|
8030
|
+
} else {
|
|
8031
|
+
const entries = Object.entries(value).map(([key, child]) => [key, toJsonValue(child, key)]).filter(([, child]) => isJsonValue(child)).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
|
|
8032
|
+
out.push("{");
|
|
8033
|
+
entries.forEach(([key, child], index) => {
|
|
8034
|
+
if (index > 0)
|
|
8035
|
+
out.push(",");
|
|
8036
|
+
out.push(JSON.stringify(key), ":");
|
|
8037
|
+
writeCanonicalJson(child, ancestors, out);
|
|
8038
|
+
});
|
|
8039
|
+
out.push("}");
|
|
8040
|
+
}
|
|
8041
|
+
ancestors.pop();
|
|
8042
|
+
}
|
|
7898
8043
|
|
|
7899
8044
|
// src/features/magic-context/user-memory/storage-user-memory.ts
|
|
7900
8045
|
var USER_MEMORY_CANDIDATE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
@@ -18792,4 +18937,4 @@ async function executeContextRecomp(deps, options = {}) {
|
|
|
18792
18937
|
return (await executeContextRecompWithResult(deps, options)).message;
|
|
18793
18938
|
}
|
|
18794
18939
|
|
|
18795
|
-
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, v2ToolDefinitionsHash, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
18940
|
+
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
detectOverflow,
|
|
29
29
|
isAnthropicFamilyRoute,
|
|
30
30
|
readRawSessionMessages2
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-rvmhyk89.js";
|
|
32
32
|
import {
|
|
33
33
|
setHarness2
|
|
34
34
|
} from "./index-pavzsdc6.js";
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
checkCompactionMarkerConsistency,
|
|
85
85
|
clearInjectionCache,
|
|
86
86
|
clearNoteNudgeTriggerOnly
|
|
87
|
-
} from "./index-
|
|
87
|
+
} from "./index-zetm0ayn.js";
|
|
88
88
|
import"./index-sd3egckz.js";
|
|
89
89
|
import {
|
|
90
90
|
hasTrustedAbsoluteWall,
|
|
@@ -171,7 +171,7 @@ import {
|
|
|
171
171
|
parameterDescriptionsFor,
|
|
172
172
|
MagicContextRpcServer,
|
|
173
173
|
applyHiddenSubagentTemperature
|
|
174
|
-
} from "./index-
|
|
174
|
+
} from "./index-q41sm60t.js";
|
|
175
175
|
import {
|
|
176
176
|
resolveOpenCodeDbPath,
|
|
177
177
|
openCodeDbPathExists,
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
createDbLkgPersistence,
|
|
220
220
|
registerLkgPersistence,
|
|
221
221
|
dropSlot
|
|
222
|
-
} from "./index-
|
|
222
|
+
} from "./index-ta87fpfs.js";
|
|
223
223
|
import {
|
|
224
224
|
recordSessionProjectIdentity
|
|
225
225
|
} from "./index-jz5bk7xd.js";
|
|
@@ -234,7 +234,7 @@ import {
|
|
|
234
234
|
openDatabaseAsync,
|
|
235
235
|
isDatabasePersisted,
|
|
236
236
|
getDatabasePersistenceError
|
|
237
|
-
} from "./index-
|
|
237
|
+
} from "./index-q6pjqm49.js";
|
|
238
238
|
import {
|
|
239
239
|
registerExitAbort,
|
|
240
240
|
unregisterExitAbort
|
|
@@ -259,7 +259,7 @@ import"./index-dj2p8653.js";
|
|
|
259
259
|
import {
|
|
260
260
|
getDefaultSubcConnectionFile,
|
|
261
261
|
SubcModuleTransport
|
|
262
|
-
} from "./index-
|
|
262
|
+
} from "./index-qsyx931k.js";
|
|
263
263
|
import"./index-qt1qqasc.js";
|
|
264
264
|
import"./index-fw42ms3m.js";
|
|
265
265
|
import {
|
|
@@ -284,7 +284,7 @@ import {
|
|
|
284
284
|
stripPersistedAssistantText,
|
|
285
285
|
deleteTagsByMessageId2,
|
|
286
286
|
getMaxTagNumberBySession2
|
|
287
|
-
} from "./index-
|
|
287
|
+
} from "./index-4wpfbzks.js";
|
|
288
288
|
import {
|
|
289
289
|
resolveHistorianModel2,
|
|
290
290
|
resolveOpenCodeAgentOverrides2,
|
|
@@ -297,8 +297,8 @@ import {
|
|
|
297
297
|
import"./index-qcz1fy7h.js";
|
|
298
298
|
import {
|
|
299
299
|
deleteIndexedMessage
|
|
300
|
-
} from "./index-
|
|
301
|
-
import"./index-
|
|
300
|
+
} from "./index-fgft4qjn.js";
|
|
301
|
+
import"./index-6athgjba.js";
|
|
302
302
|
import"./index-2qbtqg1w.js";
|
|
303
303
|
import {
|
|
304
304
|
pushNotification2
|
|
@@ -319,13 +319,13 @@ import {
|
|
|
319
319
|
clearToolPermissionDenied,
|
|
320
320
|
collectForeignTextParts,
|
|
321
321
|
resetDegradedCacheCount2
|
|
322
|
-
} from "./index-
|
|
322
|
+
} from "./index-xh3jyejb.js";
|
|
323
323
|
import {
|
|
324
324
|
scheduleClearAndReindex
|
|
325
|
-
} from "./index-
|
|
325
|
+
} from "./index-cgsmttyj.js";
|
|
326
326
|
import {
|
|
327
327
|
runManagedRecomp2
|
|
328
|
-
} from "./index-
|
|
328
|
+
} from "./index-trkxkgmd.js";
|
|
329
329
|
import {
|
|
330
330
|
isValidSemver,
|
|
331
331
|
compareSemverCore
|
|
@@ -333,11 +333,11 @@ import {
|
|
|
333
333
|
import"./index-fmsr7v69.js";
|
|
334
334
|
import {
|
|
335
335
|
runManagedWrapup2
|
|
336
|
-
} from "./index-
|
|
337
|
-
import"./index-
|
|
336
|
+
} from "./index-8ka0ne8t.js";
|
|
337
|
+
import"./index-t6s0tsp7.js";
|
|
338
338
|
import"./index-kaqs6h31.js";
|
|
339
|
-
import"./index-
|
|
340
|
-
import"./index-
|
|
339
|
+
import"./index-vk6srk5r.js";
|
|
340
|
+
import"./index-cgzpbz78.js";
|
|
341
341
|
import {
|
|
342
342
|
isDreamerRunnable,
|
|
343
343
|
isSmartNoteSurfaceAvailable,
|
|
@@ -8205,7 +8205,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
8205
8205
|
// package.json
|
|
8206
8206
|
var package_default = {
|
|
8207
8207
|
name: "@cortexkit/opencode-magic-context",
|
|
8208
|
-
version: "0.49.
|
|
8208
|
+
version: "0.49.48",
|
|
8209
8209
|
type: "module",
|
|
8210
8210
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
8211
8211
|
main: "dist/index.js",
|
|
@@ -12063,7 +12063,7 @@ async function setup(context) {
|
|
|
12063
12063
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
12064
12064
|
log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
|
|
12065
12065
|
}
|
|
12066
|
-
const { registerContext } = await import("./context-
|
|
12066
|
+
const { registerContext } = await import("./context-8r125qv3.js");
|
|
12067
12067
|
setHarness2("opencode2");
|
|
12068
12068
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
12069
12069
|
const duties = await registerContext(context);
|
|
@@ -12536,7 +12536,7 @@ var server = async (ctx) => {
|
|
|
12536
12536
|
rustReplayParticipant: () => magicContextRuntime.magicContext?.getRustReplayParticipant?.() ?? null,
|
|
12537
12537
|
onStorageBusyRefusal: async (sessionId, message) => {
|
|
12538
12538
|
const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-j93pn2hn.js"));
|
|
12539
|
-
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-
|
|
12539
|
+
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-a7ety10n.js"));
|
|
12540
12540
|
await sendStatusNotification(ctx.client, sessionId, message, {
|
|
12541
12541
|
toastDurationMs: 15000
|
|
12542
12542
|
});
|