@cortexkit/opencode-magic-context 0.49.72 → 0.49.73
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/{context-830ksymq.js → context-641fmxg4.js} +14 -7
- package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +4 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +12 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +4 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/pending-materialization.d.ts +4 -1
- package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts +0 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-64qpnmjb.js → index-238xbkhk.js} +1 -1
- package/dist/{index-y6q5qvdz.js → index-cpmqvc1c.js} +15 -13
- package/dist/{index-q5rcetym.js → index-h2w3kzkt.js} +2 -2
- package/dist/{index-sc5segqg.js → index-k2rk6z1y.js} +2 -2
- package/dist/{index-cw3j0pwy.js → index-ne2awfqp.js} +10 -1
- package/dist/{index-yh7hxjxm.js → index-t74kawez.js} +49 -18
- package/dist/{index-2m1j98fj.js → index-ypm4aa3h.js} +2 -2
- package/dist/{index-w8sv1v0j.js → index-ztjgymb9.js} +15 -6
- package/dist/index.js +30 -27
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +4 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{recomp-orchestrator-sa4f2mkj.js → recomp-orchestrator-z0m2vgbe.js} +3 -3
- package/dist/{render-qkjgrg31.js → render-rf6dmb9v.js} +1 -1
- package/dist/{search-archive-cmfs3myg.js → search-archive-myb6n35b.js} +2 -2
- package/dist/{transform-postprocess-phase-ecrcsc2w.js → transform-postprocess-phase-r6t8m6qq.js} +3 -3
- package/dist/v2/{context-q846asea.js → context-4rmbpek8.js} +58 -16
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{recomp-orchestrator-egbf57qa.js → recomp-orchestrator-14bek576.js} +2 -2
- package/dist/v2/{render-47vjswds.js → render-rw6tk2fj.js} +1 -1
- package/dist/v2/{search-archive-3tpaqkg4.js → search-archive-w33x2z9z.js} +2 -2
- package/dist/v2/{server-canf6f29.js → server-11rbew2r.js} +10 -1
- package/dist/v2/{server-4nh02tdw.js → server-ds7y8nmk.js} +1 -1
- package/dist/v2/{server-3jggqcpa.js → server-kya7jvx5.js} +2 -2
- package/dist/v2/{server-wb00e7b0.js → server-yspcz6v9.js} +2 -2
- package/dist/v2/server.js +2 -2
- package/dist/v2/{v2-archive-reader-x1yvzqs8.js → v2-archive-reader-cw9fm88j.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-5bccsgy0.js → wrapup-orchestrator-sk2zx55m.js} +14 -12
- package/dist/{v2-archive-reader-xnnwexnw.js → v2-archive-reader-42chk89p.js} +1 -1
- package/dist/{wrapup-orchestrator-yrpqmwc7.js → wrapup-orchestrator-4sfkj8z4.js} +4 -4
- package/package.json +1 -1
|
@@ -220,7 +220,7 @@ import {
|
|
|
220
220
|
startCompartmentAgent,
|
|
221
221
|
setRecompStarting2,
|
|
222
222
|
setRecompTerminal2
|
|
223
|
-
} from "./server-
|
|
223
|
+
} from "./server-kya7jvx5.js";
|
|
224
224
|
import {
|
|
225
225
|
resolveHistorianModel2
|
|
226
226
|
} from "./server-5kym00ag.js";
|
|
@@ -716,7 +716,9 @@ import {
|
|
|
716
716
|
requestPendingMaterialization,
|
|
717
717
|
pendingMaterializationOrigin,
|
|
718
718
|
hasPendingMaterializationOrigin,
|
|
719
|
+
hasExplicitRefreshRequest,
|
|
719
720
|
clearPendingMaterialization,
|
|
721
|
+
clearReclaimedMaterialization,
|
|
720
722
|
clearPendingMaterializationOrigin,
|
|
721
723
|
recordSystemPromptForRequest,
|
|
722
724
|
recordHeldHeadForRequest,
|
|
@@ -794,7 +796,7 @@ import {
|
|
|
794
796
|
saveSourceContent,
|
|
795
797
|
replaceSourceContent,
|
|
796
798
|
getSourceContents
|
|
797
|
-
} from "./server-
|
|
799
|
+
} from "./server-11rbew2r.js";
|
|
798
800
|
import {
|
|
799
801
|
startBootDeadline,
|
|
800
802
|
getUnconfirmedMigrationHolders,
|
|
@@ -999,10 +1001,10 @@ import {
|
|
|
999
1001
|
import"./server-52x68mj4.js";
|
|
1000
1002
|
import {
|
|
1001
1003
|
readV2ArchiveOffThread2
|
|
1002
|
-
} from "./server-
|
|
1004
|
+
} from "./server-yspcz6v9.js";
|
|
1003
1005
|
import {
|
|
1004
1006
|
renderSearchArchiveOffThread2
|
|
1005
|
-
} from "./server-
|
|
1007
|
+
} from "./server-ds7y8nmk.js";
|
|
1006
1008
|
import {
|
|
1007
1009
|
markHostInstructionRow,
|
|
1008
1010
|
hostInstructionRow,
|
|
@@ -2035,6 +2037,28 @@ function resolveTrustedContextLimit(providerID, modelID, ctx) {
|
|
|
2035
2037
|
const persisted = modelMatchedPersistedUsage(ctx?.db, ctx?.sessionID, modelKey);
|
|
2036
2038
|
return isSaneLimit(persisted?.lastUsageContextLimit) ? persisted.lastUsageContextLimit : undefined;
|
|
2037
2039
|
}
|
|
2040
|
+
var WRAPUP_WINDOW_UNAVAILABLE = "Cannot run /ctx-wrapup: the model's context window is unknown. Select a model with a configured context window or send a message with that model, then retry.";
|
|
2041
|
+
function readPersistedWrapupWindow(db, sessionId, modelKey) {
|
|
2042
|
+
const { lastUsageContextLimit, lastObservedModelKey } = getOrCreateSessionMeta(db, sessionId);
|
|
2043
|
+
if (!isSaneLimit(lastUsageContextLimit) || !lastObservedModelKey)
|
|
2044
|
+
return;
|
|
2045
|
+
if (modelKey && piModelRefToCanonical(modelKey) !== piModelRefToCanonical(lastObservedModelKey))
|
|
2046
|
+
return;
|
|
2047
|
+
return { contextLimit: lastUsageContextLimit, modelKey: lastObservedModelKey };
|
|
2048
|
+
}
|
|
2049
|
+
function resolveOpenCodeWrapupWindow(db, sessionId, model) {
|
|
2050
|
+
const route = model ?? findLastAssistantModelFromOpenCodeDb(sessionId);
|
|
2051
|
+
const modelKey = resolveModelKey(route?.providerID, route?.modelID);
|
|
2052
|
+
if (modelKey) {
|
|
2053
|
+
const contextLimit = resolveTrustedContextLimit(route?.providerID, route?.modelID, {
|
|
2054
|
+
db,
|
|
2055
|
+
sessionID: sessionId
|
|
2056
|
+
});
|
|
2057
|
+
if (contextLimit !== undefined)
|
|
2058
|
+
return { contextLimit, modelKey };
|
|
2059
|
+
}
|
|
2060
|
+
return readPersistedWrapupWindow(db, sessionId, modelKey);
|
|
2061
|
+
}
|
|
2038
2062
|
var clampWarnSeen = new Set;
|
|
2039
2063
|
function isFinitePositive(v) {
|
|
2040
2064
|
return typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
@@ -2602,6 +2626,7 @@ var canonicalReasons = new Set([
|
|
|
2602
2626
|
"ttl_idle",
|
|
2603
2627
|
"explicit_flush",
|
|
2604
2628
|
"user_flush",
|
|
2629
|
+
"user_wrapup",
|
|
2605
2630
|
"fit_retry",
|
|
2606
2631
|
"pending_materialization",
|
|
2607
2632
|
"variant_change",
|
|
@@ -11203,6 +11228,7 @@ async function runPostTransformPhase(args) {
|
|
|
11203
11228
|
const pendingMaterializationAtPassStart = args.pendingMaterializationSessions.has(args.sessionId);
|
|
11204
11229
|
beginHostCheckpointPass(args.sessionId, args.pendingMaterializationSessions);
|
|
11205
11230
|
const pendingOrigin = pendingMaterializationOrigin(args.pendingMaterializationSessions, args.sessionId);
|
|
11231
|
+
const wrapupPending = hasPendingMaterializationOrigin(args.pendingMaterializationSessions, args.sessionId, "user_wrapup");
|
|
11206
11232
|
const deferredMaterializationAtPassStart = args.deferredMaterializationSessions.has(args.sessionId);
|
|
11207
11233
|
let isExplicitFlush = pendingMaterializationAtPassStart;
|
|
11208
11234
|
const deferredMaterializationWasPending = deferredMaterializationAtPassStart;
|
|
@@ -11395,6 +11421,7 @@ async function runPostTransformPhase(args) {
|
|
|
11395
11421
|
historyBudgetPolicyIdentity: args.m0M1.historyBudgetPolicyIdentity,
|
|
11396
11422
|
temporalAwareness: args.m0M1.temporalAwareness,
|
|
11397
11423
|
isCacheBustingPass: true,
|
|
11424
|
+
skipPressureRefold: wrapupPending,
|
|
11398
11425
|
contentionFallbackPrefix: cachedPrefixBeforePreflight,
|
|
11399
11426
|
allowFreshContentionFallback: forceMaterialization || emergencyDropEligible,
|
|
11400
11427
|
hardSignals: args.m0M1.hardSignals,
|
|
@@ -11503,7 +11530,7 @@ async function runPostTransformPhase(args) {
|
|
|
11503
11530
|
fromEstimate: args.contextUsageFromEstimate === true,
|
|
11504
11531
|
emergencySample: () => getEmergencyInputSample(args.db, args.sessionId)
|
|
11505
11532
|
}),
|
|
11506
|
-
explicitFlush: isExplicitFlush &&
|
|
11533
|
+
explicitFlush: isExplicitFlush && hasExplicitRefreshRequest(args.pendingMaterializationSessions, args.sessionId),
|
|
11507
11534
|
publishedHistory: !prefixPreflightFailed && (publishedM1RefreshedThisPass || !m0M1EnabledForFold && (args.pendingCompartmentInjection?.compartmentCount ?? 0) > 0 && legacyPublishedHeadChanged(args))
|
|
11508
11535
|
};
|
|
11509
11536
|
const protectedToolTags = protectedToolTagNumbers(args.tags, args.protectedTools);
|
|
@@ -11945,7 +11972,7 @@ async function runPostTransformPhase(args) {
|
|
|
11945
11972
|
heuristicOrReasoningEditBesidesTrim = heuristicMutationCount + clearedReasoning + strippedInline > 0;
|
|
11946
11973
|
droppedCount += clearedReasoning + strippedInline + removedReasoningMessages;
|
|
11947
11974
|
if (pendingMaterializationAtPassStart && !freezeM0M1 && !pendingOps.some((op) => newTargets.get(op.tagId)?.thinkingDropProtected)) {
|
|
11948
|
-
|
|
11975
|
+
clearReclaimedMaterialization(args.pendingMaterializationSessions, args.sessionId);
|
|
11949
11976
|
}
|
|
11950
11977
|
if (args.currentTurnId) {
|
|
11951
11978
|
args.lastHeuristicsTurnId.set(args.sessionId, args.currentTurnId);
|
|
@@ -12151,6 +12178,7 @@ async function runPostTransformPhase(args) {
|
|
|
12151
12178
|
historyBudgetPolicyIdentity: args.m0M1.historyBudgetPolicyIdentity,
|
|
12152
12179
|
temporalAwareness: args.m0M1.temporalAwareness,
|
|
12153
12180
|
isCacheBustingPass: isCacheBustingPass && !freezeM0M1,
|
|
12181
|
+
skipPressureRefold: wrapupPending,
|
|
12154
12182
|
preparedPrefix,
|
|
12155
12183
|
prefixTrimSourceOrder: args.prefixTrimSourceOrder,
|
|
12156
12184
|
allowFreshContentionFallback: forceMaterialization || emergencyDropEligible,
|
|
@@ -12265,8 +12293,13 @@ async function runPostTransformPhase(args) {
|
|
|
12265
12293
|
logTransformTiming(args.sessionId, "pp.nudgeAndSticky", tNudgeBlock);
|
|
12266
12294
|
const tMarker = performance.now();
|
|
12267
12295
|
const explicitRebuildHappened = args.historyRefreshExplicitBeforePrepare && args.rebuiltHistoryFromInitialPrepare;
|
|
12296
|
+
const wrapupServed = wrapupPending && isCacheBustingPass && !freezeM0M1 && deliveredPrefix?.injected === true && !deliveredPrefix.materializationContentionRetryExhausted;
|
|
12297
|
+
if (wrapupServed) {
|
|
12298
|
+
clearPendingMaterializationOrigin(args.pendingMaterializationSessions, args.sessionId, "user_wrapup");
|
|
12299
|
+
}
|
|
12268
12300
|
const materializationSatisfied = !deferredMaterializationWasPending || explicitMaterializedSuccessfully || deferredMaterializedSuccessfully;
|
|
12269
|
-
const
|
|
12301
|
+
const wrapupTrimProven = wrapupServed && (deliveredPrefix?.prefixTrimStatus === "applied" || deliveredPrefix?.prefixTrimStatus === "boundary-precedes-window");
|
|
12302
|
+
const historyWasConsumedThisPass = wrapupTrimProven || (!m0M1Enabled || deliveredPrefix?.injected === true && !deliveredPrefix.materializationContentionRetryExhausted) && args.historyRebuiltThisPass && (args.canConsumeDeferredLate || args.phaseJustAwaitedPublication || explicitRebuildHappened) && materializationSatisfied;
|
|
12270
12303
|
let suppressV12HistoryDrain = false;
|
|
12271
12304
|
let persistedCompactionMarkerState = replaySnapshot?.compactionMarker ?? null;
|
|
12272
12305
|
let markerDrainChangedServedRow = false;
|
|
@@ -21572,7 +21605,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
21572
21605
|
}, {
|
|
21573
21606
|
hardFold: false,
|
|
21574
21607
|
force: contextUsageEarly.percentage >= forceMaterializationPercentage && (contextUsageEarly.percentage >= 95 || getEmergencyInputSample(db, sessionId) === 0),
|
|
21575
|
-
explicitFlush:
|
|
21608
|
+
explicitFlush: hasExplicitRefreshRequest(deps.pendingMaterializationSessions, sessionId),
|
|
21576
21609
|
publishedHistory: isCacheBusting,
|
|
21577
21610
|
permission: {
|
|
21578
21611
|
signedThinkingHold: activeThinkingPrefixHold,
|
|
@@ -21967,7 +22000,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
21967
22000
|
signedThinkingHoldCapPercentage: !compactionOff && signedThinkingHold?.held === true ? signedThinkingHold.capPercentage : undefined,
|
|
21968
22001
|
firstRender: servesHead && !(sessionMeta.cachedM0Bytes != null && sessionMeta.cachedM1Bytes != null) && !hasCompleteCachedM0M1(db, sessionId),
|
|
21969
22002
|
folds: protectionFoldWillBust,
|
|
21970
|
-
explicitFlush:
|
|
22003
|
+
explicitFlush: hasExplicitRefreshRequest(deps.pendingMaterializationSessions, sessionId),
|
|
21971
22004
|
materializationRequested: deps.pendingMaterializationSessions.has(sessionId) || canConsumeDeferredLate && deferredMaterializationSessions.has(sessionId),
|
|
21972
22005
|
historyRebuilt: historyRebuiltThisPass || pendingCompartmentInjection?.rebuiltFromDb === true || rebuiltHistoryFromInitialPrepare,
|
|
21973
22006
|
alreadyRanThisTurn: heuristicsAlreadyRanThisTurn(deps.lastHeuristicsTurnId, sessionId, currentTurnId)
|
|
@@ -26156,7 +26189,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26156
26189
|
const db = readDatabase();
|
|
26157
26190
|
if (!db)
|
|
26158
26191
|
return { ok: false, error: "db unavailable" };
|
|
26159
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
26192
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-14bek576.js"));
|
|
26160
26193
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-8g4r97bp.js"));
|
|
26161
26194
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
26162
26195
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -26241,19 +26274,21 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26241
26274
|
const db = readDatabase();
|
|
26242
26275
|
if (!db)
|
|
26243
26276
|
return { ok: false, error: "db unavailable" };
|
|
26244
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
26245
|
-
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
26246
|
-
const
|
|
26277
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-sk2zx55m.js"));
|
|
26278
|
+
const model = await args.readSelectedSessionModel?.(sessionId) ?? liveSessionState.liveModelBySession.get(sessionId);
|
|
26279
|
+
const window = resolveOpenCodeWrapupWindow(db, sessionId, model);
|
|
26280
|
+
if (!window)
|
|
26281
|
+
return { ok: false, error: WRAPUP_WINDOW_UNAVAILABLE };
|
|
26282
|
+
const { contextLimit, modelKey } = window;
|
|
26247
26283
|
const ctx = {
|
|
26248
26284
|
...await buildManagedCtx(db),
|
|
26249
26285
|
memoryInjectionBudgetTokens: config.memory?.injection_budget_tokens,
|
|
26250
26286
|
contextLimit,
|
|
26251
|
-
executeThresholdPercentage: resolveExecuteThresholdDetail(config.execute_threshold_percentage ?? 65,
|
|
26287
|
+
executeThresholdPercentage: resolveExecuteThresholdDetail(config.execute_threshold_percentage ?? 65, modelKey, 65, {
|
|
26252
26288
|
tokensConfig: config.execute_threshold_tokens,
|
|
26253
26289
|
contextLimit,
|
|
26254
26290
|
sessionId
|
|
26255
|
-
}).percentage
|
|
26256
|
-
hasPendingNaturalBust: (sid) => liveSessionState.historyRefreshSessions.has(sid) || liveSessionState.systemPromptRefreshSessions.has(sid) || liveSessionState.pendingMaterializationSessions.has(sid)
|
|
26291
|
+
}).percentage
|
|
26257
26292
|
};
|
|
26258
26293
|
log2(`[rpc] wrapup requested for session ${sessionId} (keep ${messagesToKeep})`);
|
|
26259
26294
|
args.prepareHistorySession?.(sessionId);
|
|
@@ -58578,6 +58613,13 @@ async function registerContext(context) {
|
|
|
58578
58613
|
return null;
|
|
58579
58614
|
}
|
|
58580
58615
|
},
|
|
58616
|
+
readSelectedSessionModel: async (sessionID) => {
|
|
58617
|
+
try {
|
|
58618
|
+
const model = (await context.session.get({ sessionID })).model;
|
|
58619
|
+
if (model)
|
|
58620
|
+
return { providerID: model.providerID, modelID: model.id };
|
|
58621
|
+
} catch {}
|
|
58622
|
+
},
|
|
58581
58623
|
storageDir,
|
|
58582
58624
|
getDebugMemoryHolders: () => ({ generateReplay: generateReplay.stats() })
|
|
58583
58625
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AA4BxD,OAAO,EACH,KAAK,uBAAuB,EAG/B,MAAM,uDAAuD,CAAC;AAuC/D,OAAO,EACH,KAAK,qBAAqB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AO,6BAA6B,CAAC,EAAE,SAAS,CAAC,EAC/E,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC,GACrF,OAAO,CAAC,IAAI,CAAC,CAwCf;AAyBD,wBAAsB,eAAe,CAAC,OAAO,EAAE,SAAS;;eAsxFvD"}
|
|
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
19
19
|
await main();
|
|
20
20
|
async function main() {
|
|
21
21
|
if (input.v2ArchiveReader) {
|
|
22
|
-
const { serveV2ArchiveReads } = await import("./v2-archive-reader-
|
|
22
|
+
const { serveV2ArchiveReads } = await import("./v2-archive-reader-cw9fm88j.js");
|
|
23
23
|
await serveV2ArchiveReads(port, openConnections);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
51
51
|
await runMessageFtsRowidMapBackfill(db);
|
|
52
52
|
reply = { kind: "fts-rowid-backfill" };
|
|
53
53
|
} else if (input.searchArchive) {
|
|
54
|
-
const { renderSearchArchive } = await import("./search-archive-
|
|
54
|
+
const { renderSearchArchive } = await import("./search-archive-w33x2z9z.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-wg5zc29f.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-kya7jvx5.js";
|
|
11
11
|
import"./server-at0v0z4t.js";
|
|
12
12
|
import"./server-ndkzagjz.js";
|
|
13
13
|
import"./server-rd7v8c8y.js";
|
|
14
14
|
import"./server-jjvbk92s.js";
|
|
15
15
|
import"./server-t091cjj4.js";
|
|
16
16
|
import"./server-4dhv7mqz.js";
|
|
17
|
-
import"./server-
|
|
17
|
+
import"./server-11rbew2r.js";
|
|
18
18
|
import"./server-rbtx6q5v.js";
|
|
19
19
|
import"./server-d0ec5f7b.js";
|
|
20
20
|
import"./server-2amn2s73.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSearchArchive2,
|
|
3
3
|
renderSearchArchiveOffThread2
|
|
4
|
-
} from "./server-
|
|
5
|
-
import"./server-
|
|
4
|
+
} from "./server-ds7y8nmk.js";
|
|
5
|
+
import"./server-yspcz6v9.js";
|
|
6
6
|
import"./server-52x68mj4.js";
|
|
7
7
|
import"./server-k8mj4ccb.js";
|
|
8
8
|
import"./server-cxkb9725.js";
|
|
@@ -1599,11 +1599,20 @@ function pendingMaterializationOrigin(sessions, sessionId) {
|
|
|
1599
1599
|
function hasPendingMaterializationOrigin(sessions, sessionId, origin) {
|
|
1600
1600
|
return sessions.has(sessionId) && causes.get(sessions)?.get(sessionId)?.has(origin) === true;
|
|
1601
1601
|
}
|
|
1602
|
+
function hasExplicitRefreshRequest(sessions, sessionId) {
|
|
1603
|
+
return hasPendingMaterializationOrigin(sessions, sessionId, "user_flush") || hasPendingMaterializationOrigin(sessions, sessionId, "user_wrapup");
|
|
1604
|
+
}
|
|
1602
1605
|
function clearPendingMaterialization(sessions, sessionId) {
|
|
1603
1606
|
sessions.delete(sessionId);
|
|
1604
1607
|
origins.get(sessions)?.delete(sessionId);
|
|
1605
1608
|
causes.get(sessions)?.delete(sessionId);
|
|
1606
1609
|
}
|
|
1610
|
+
function clearReclaimedMaterialization(sessions, sessionId) {
|
|
1611
|
+
const wrapupPending = hasPendingMaterializationOrigin(sessions, sessionId, "user_wrapup");
|
|
1612
|
+
clearPendingMaterialization(sessions, sessionId);
|
|
1613
|
+
if (wrapupPending)
|
|
1614
|
+
requestPendingMaterialization(sessions, sessionId, "user_wrapup");
|
|
1615
|
+
}
|
|
1607
1616
|
function clearPendingMaterializationOrigin(sessions, sessionId, origin) {
|
|
1608
1617
|
const pendingCauses = causes.get(sessions)?.get(sessionId);
|
|
1609
1618
|
if (!sessions.has(sessionId) || !pendingCauses?.has(origin))
|
|
@@ -5145,4 +5154,4 @@ var ERROR_CLASSES = new Set([
|
|
|
5145
5154
|
"permission_denied",
|
|
5146
5155
|
"unknown"
|
|
5147
5156
|
]);
|
|
5148
|
-
export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getNewestCompartmentIds, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginServedRequest, noteServedPassPermission, noteServedModel, noteServedReplay, noteServedHostInput, noteServedRefusal, countServedRefusal, dropServedRecord, forgetServedRecord, commitServedRequest, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, getRecentFailedHistorianRunTimes, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
|
5157
|
+
export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getNewestCompartmentIds, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, hasExplicitRefreshRequest, clearPendingMaterialization, clearReclaimedMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginServedRequest, noteServedPassPermission, noteServedModel, noteServedReplay, noteServedHostInput, noteServedRefusal, countServedRefusal, dropServedRecord, forgetServedRecord, commitServedRequest, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, getRecentFailedHistorianRunTimes, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
|
@@ -209,7 +209,7 @@ import {
|
|
|
209
209
|
getProjectState,
|
|
210
210
|
recordSubagentInvocation,
|
|
211
211
|
getLatestHistorianInvocationId
|
|
212
|
-
} from "./server-
|
|
212
|
+
} from "./server-11rbew2r.js";
|
|
213
213
|
import {
|
|
214
214
|
invalidateAutoEmbedSession
|
|
215
215
|
} from "./server-2amn2s73.js";
|
|
@@ -10448,7 +10448,7 @@ function injectM0M1(options) {
|
|
|
10448
10448
|
const M1_ABSOLUTE_CAP_RATIO = 0.2;
|
|
10449
10449
|
const m1AbsoluteBudget = (options.historyBudgetTokens ?? DEFAULT_HISTORY_BUDGET_TOKENS) * M1_ABSOLUTE_CAP_RATIO;
|
|
10450
10450
|
let driftNeedsRefold = false;
|
|
10451
|
-
if (!rematerialized && !contentionExhausted && m1Recomputed && options.isCacheBustingPass) {
|
|
10451
|
+
if (!rematerialized && !contentionExhausted && m1Recomputed && options.isCacheBustingPass && !options.skipPressureRefold) {
|
|
10452
10452
|
driftNeedsRefold = memoryUpdateCount > 40;
|
|
10453
10453
|
if (!driftNeedsRefold && m1Text !== M1_EMPTY_PLACEHOLDER) {
|
|
10454
10454
|
const m1Tokens = estimateTokens(m1Text);
|
|
@@ -140,8 +140,8 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
140
140
|
import("./store-reader-yaxtdy6f.js"),
|
|
141
141
|
import("./store-4se2a0n0.js"),
|
|
142
142
|
import("./read-session-chunk-eb49qfzz.js"),
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
143
|
+
import("./render-rw6tk2fj.js"),
|
|
144
|
+
import("./search-archive-w33x2z9z.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
package/dist/v2/server.js
CHANGED
|
@@ -7875,7 +7875,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
7875
7875
|
// package.json
|
|
7876
7876
|
var package_default = {
|
|
7877
7877
|
name: "@cortexkit/opencode-magic-context",
|
|
7878
|
-
version: "0.49.
|
|
7878
|
+
version: "0.49.73",
|
|
7879
7879
|
type: "module",
|
|
7880
7880
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
7881
7881
|
main: "dist/index.js",
|
|
@@ -8196,7 +8196,7 @@ async function setup(context) {
|
|
|
8196
8196
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
8197
8197
|
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.`);
|
|
8198
8198
|
}
|
|
8199
|
-
const { registerContext } = await import("./context-
|
|
8199
|
+
const { registerContext } = await import("./context-4rmbpek8.js");
|
|
8200
8200
|
setHarness2("opencode2");
|
|
8201
8201
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
8202
8202
|
const duties = await registerContext(context);
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
renewCompartmentLease,
|
|
11
11
|
releaseCompartmentLeaseBestEffort,
|
|
12
12
|
getCompartments,
|
|
13
|
-
getLastCompartmentEndMessage
|
|
14
|
-
|
|
13
|
+
getLastCompartmentEndMessage,
|
|
14
|
+
requestPendingMaterialization
|
|
15
|
+
} from "./server-11rbew2r.js";
|
|
15
16
|
import"./server-2amn2s73.js";
|
|
16
17
|
import"./server-y8xjr8rx.js";
|
|
17
18
|
import"./server-x6fn9x8q.js";
|
|
@@ -63,7 +64,7 @@ import {
|
|
|
63
64
|
registerActiveCompartmentRun,
|
|
64
65
|
setRecompStarting2,
|
|
65
66
|
setRecompTerminal2
|
|
66
|
-
} from "./server-
|
|
67
|
+
} from "./server-kya7jvx5.js";
|
|
67
68
|
import"./server-qt1qqasc.js";
|
|
68
69
|
import"./server-t091cjj4.js";
|
|
69
70
|
import"./server-jtq03rkb.js";
|
|
@@ -118,11 +119,6 @@ function formatAlreadyRunningMessage(state) {
|
|
|
118
119
|
const through = state.lastCompartmentEnd > 0 ? ` through message ${state.lastCompartmentEnd}` : "";
|
|
119
120
|
return `/ctx-wrapup is already running for this session${chunk}${through}. Wait for it to finish, then run /ctx-wrapup again if more history remains.`;
|
|
120
121
|
}
|
|
121
|
-
function appendFlushHint(ctx, sessionId, message) {
|
|
122
|
-
if (ctx.hasPendingNaturalBust?.(sessionId))
|
|
123
|
-
return message;
|
|
124
|
-
return `${message} If you want it applied on the very next message, run /ctx-flush first.`;
|
|
125
|
-
}
|
|
126
122
|
function buildPlan(ctx, sessionId, messagesToKeep, anchorRawMessageCount) {
|
|
127
123
|
return resolveWrapupProtectedTailBoundary({
|
|
128
124
|
db: ctx.db,
|
|
@@ -308,8 +304,8 @@ ${message}`;
|
|
|
308
304
|
|
|
309
305
|
${message}`;
|
|
310
306
|
}
|
|
311
|
-
|
|
312
|
-
|
|
307
|
+
let startLastEnd = getLastCompartmentEndMessage(ctx.db, sessionId);
|
|
308
|
+
let startCompartmentCount = getCompartments(ctx.db, sessionId).length;
|
|
313
309
|
let chunkIndex = 0;
|
|
314
310
|
let lastEnd = startLastEnd;
|
|
315
311
|
let stoppedForFailure = false;
|
|
@@ -353,6 +349,9 @@ ${message}`;
|
|
|
353
349
|
if (activeAtStart === "timeout") {
|
|
354
350
|
stoppedForFailure = true;
|
|
355
351
|
stoppedReason = "Timed out waiting for the active historian run.";
|
|
352
|
+
} else {
|
|
353
|
+
startLastEnd = lastEnd = getLastCompartmentEndMessage(ctx.db, sessionId);
|
|
354
|
+
startCompartmentCount = getCompartments(ctx.db, sessionId).length;
|
|
356
355
|
}
|
|
357
356
|
if (!stoppedForFailure) {
|
|
358
357
|
try {
|
|
@@ -460,8 +459,11 @@ ${message}`;
|
|
|
460
459
|
try {
|
|
461
460
|
clearEmergencyRecovery(ctx.db, sessionId);
|
|
462
461
|
} catch {}
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
let message = `Wrapped up ${messagesWrapped} messages into ${compartmentsCreated} compartments.`;
|
|
463
|
+
if (compartmentsCreated > 0) {
|
|
464
|
+
requestPendingMaterialization(ctx.liveSessionState.pendingMaterializationSessions, sessionId, "user_wrapup");
|
|
465
|
+
message += " The compacted history applies on your next message, or on the next rebuild if the host restarts first.";
|
|
466
|
+
}
|
|
465
467
|
setRecompTerminal2(ctx.liveSessionState, sessionId, "done", message);
|
|
466
468
|
return message;
|
|
467
469
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runManagedWrapup2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
3
|
+
} from "./index-cpmqvc1c.js";
|
|
4
|
+
import"./index-h2w3kzkt.js";
|
|
5
|
+
import"./index-k2rk6z1y.js";
|
|
6
6
|
import"./index-832w615x.js";
|
|
7
7
|
import"./index-sd3egckz.js";
|
|
8
8
|
import"./index-ve863q40.js";
|
|
@@ -10,7 +10,7 @@ import"./index-q9ywd8b2.js";
|
|
|
10
10
|
import"./index-jjvbk92s.js";
|
|
11
11
|
import"./index-9swgykdd.js";
|
|
12
12
|
import"./index-4dhv7mqz.js";
|
|
13
|
-
import"./index-
|
|
13
|
+
import"./index-ne2awfqp.js";
|
|
14
14
|
import"./index-tebcx987.js";
|
|
15
15
|
import"./index-etm62gd7.js";
|
|
16
16
|
import"./index-2amn2s73.js";
|
package/package.json
CHANGED