@cortexkit/opencode-magic-context 0.49.56 → 0.49.57
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-bejy30t5.js → context-a617pcqe.js} +35 -11
- package/dist/features/magic-context/mural/render-mural.d.ts +17 -0
- package/dist/features/magic-context/mural/render-mural.d.ts.map +1 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts +2 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts.map +1 -1
- package/dist/features/magic-context/mural/resolve-mural.d.ts +8 -2
- package/dist/features/magic-context/mural/resolve-mural.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +7 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +9 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts +7 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-failure-report.d.ts +112 -0
- package/dist/hooks/magic-context/historian-failure-report.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +11 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-pxfb7pp8.js → index-0r2jk2na.js} +2 -2
- package/dist/{index-12p4j9wa.js → index-1wsb0e8h.js} +1 -1
- package/dist/{index-3jeq08jv.js → index-3600gm9z.js} +268 -21
- package/dist/{index-wgbp5zch.js → index-bev3zks1.js} +16 -1
- package/dist/{index-3wmp1nb7.js → index-pdnan1e3.js} +3 -3
- package/dist/{index-ffab4edg.js → index-wpcjxzrm.js} +43 -19
- package/dist/{index-5483ntzh.js → index-x8e50d8f.js} +2 -2
- package/dist/{index-qfc1kjh4.js → index-zyanqxtc.js} +2 -2
- package/dist/index.js +11 -11
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{recomp-orchestrator-2tsjqbrm.js → recomp-orchestrator-xwsjrqcs.js} +3 -3
- package/dist/{render-fgxbcmnh.js → render-22ebrmep.js} +1 -1
- package/dist/{search-archive-0mz3p1g1.js → search-archive-bqqf5p7f.js} +2 -2
- package/dist/{transform-postprocess-phase-64xtx439.js → transform-postprocess-phase-nejydt3q.js} +3 -3
- package/dist/v2/{context-5hhm89jw.js → context-4gxr2xd4.js} +65 -21
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/usage-persist.d.ts +7 -1
- package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{recomp-orchestrator-dzdxrgdt.js → recomp-orchestrator-1de5c0zr.js} +2 -2
- package/dist/v2/{render-jfa3hj8z.js → render-g44ksejs.js} +1 -1
- package/dist/v2/{search-archive-p4s9q7a3.js → search-archive-5ycchnyp.js} +2 -2
- package/dist/v2/{server-z6sxv6n3.js → server-dqwx9pdh.js} +268 -21
- package/dist/v2/{server-kyfj1090.js → server-r7nj8ga0.js} +1 -1
- package/dist/v2/{server-8e5m2gre.js → server-t5c8awdm.js} +2 -2
- package/dist/v2/{server-q02z0jq7.js → server-v57wr0r9.js} +16 -1
- package/dist/v2/server.js +2 -2
- package/dist/v2/{v2-archive-reader-jpdh0ktt.js → v2-archive-reader-tgydjgfy.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-5dfj2mcs.js → wrapup-orchestrator-3871zj7c.js} +2 -2
- package/dist/{v2-archive-reader-557b5dn3.js → v2-archive-reader-2czwvyc9.js} +1 -1
- package/dist/{wrapup-orchestrator-21hgybdk.js → wrapup-orchestrator-m1yzmgq4.js} +4 -4
- package/package.json +1 -1
|
@@ -173,6 +173,8 @@ import {
|
|
|
173
173
|
readCoordinateRebaseNotice,
|
|
174
174
|
formatCoordinateRebaseNotice,
|
|
175
175
|
rebaseSessionCoordinatesAsync,
|
|
176
|
+
readHistorianFailureStreak,
|
|
177
|
+
describeHistorianJoinRefusal,
|
|
176
178
|
shouldWaitForNewHistorianHistory,
|
|
177
179
|
EMPTY_READ_REPLY,
|
|
178
180
|
noteTouchedAt,
|
|
@@ -194,7 +196,7 @@ import {
|
|
|
194
196
|
snapRangeToCompartments,
|
|
195
197
|
getActiveCompartmentRun,
|
|
196
198
|
startCompartmentAgent
|
|
197
|
-
} from "./index-
|
|
199
|
+
} from "./index-3600gm9z.js";
|
|
198
200
|
import {
|
|
199
201
|
hasTrustedAbsoluteWall,
|
|
200
202
|
applyProvenInputFloor,
|
|
@@ -286,7 +288,6 @@ import {
|
|
|
286
288
|
setPersistedTodoSyntheticAnchor,
|
|
287
289
|
clearPersistedTodoSyntheticAnchor,
|
|
288
290
|
setNoteLastReadAt,
|
|
289
|
-
getHistorianFailureState,
|
|
290
291
|
clearHistorianFailureState,
|
|
291
292
|
getOverflowState,
|
|
292
293
|
loadTransformPassStateSnapshot,
|
|
@@ -568,7 +569,7 @@ import {
|
|
|
568
569
|
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
569
570
|
getProjectState,
|
|
570
571
|
bumpProjectUserProfileVersion
|
|
571
|
-
} from "./index-
|
|
572
|
+
} from "./index-bev3zks1.js";
|
|
572
573
|
import {
|
|
573
574
|
getLastIndexedOrdinal
|
|
574
575
|
} from "./index-h62j8z2r.js";
|
|
@@ -721,7 +722,7 @@ import {
|
|
|
721
722
|
import {
|
|
722
723
|
setRecompStarting2,
|
|
723
724
|
setRecompTerminal2
|
|
724
|
-
} from "./index-
|
|
725
|
+
} from "./index-x8e50d8f.js";
|
|
725
726
|
import {
|
|
726
727
|
makeToolCompositeKey,
|
|
727
728
|
searchMessageHistoryOffThread,
|
|
@@ -806,7 +807,7 @@ import {
|
|
|
806
807
|
abortSessionFailClosed2,
|
|
807
808
|
evaluateEmergencyFailClosed2,
|
|
808
809
|
runPostTransformPhase2
|
|
809
|
-
} from "./index-
|
|
810
|
+
} from "./index-0r2jk2na.js";
|
|
810
811
|
import {
|
|
811
812
|
ANNOUNCEMENT_VERSION2,
|
|
812
813
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -824,10 +825,10 @@ import {
|
|
|
824
825
|
} from "./index-5gqszjq9.js";
|
|
825
826
|
import {
|
|
826
827
|
readV2ArchiveOffThread2
|
|
827
|
-
} from "./index-
|
|
828
|
+
} from "./index-zyanqxtc.js";
|
|
828
829
|
import {
|
|
829
830
|
renderSearchArchiveOffThread2
|
|
830
|
-
} from "./index-
|
|
831
|
+
} from "./index-1wsb0e8h.js";
|
|
831
832
|
import {
|
|
832
833
|
COMPACTION_ENABLED_PATH,
|
|
833
834
|
isDreamerRunnable,
|
|
@@ -16448,7 +16449,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16448
16449
|
const db = readDatabase();
|
|
16449
16450
|
if (!db)
|
|
16450
16451
|
return { ok: false, error: "db unavailable" };
|
|
16451
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16452
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-xwsjrqcs.js"));
|
|
16452
16453
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-gamjee2f.js"));
|
|
16453
16454
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16454
16455
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -16533,7 +16534,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16533
16534
|
const db = readDatabase();
|
|
16534
16535
|
if (!db)
|
|
16535
16536
|
return { ok: false, error: "db unavailable" };
|
|
16536
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16537
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-m1yzmgq4.js"));
|
|
16537
16538
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16538
16539
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16539
16540
|
const ctx = {
|
|
@@ -24253,10 +24254,18 @@ function historianJoinFailClosedMessage(input) {
|
|
|
24253
24254
|
if (estimate?.trusted === true && Number.isFinite(estimate.tokens) && estimate.tokens > 0 && Number.isFinite(input.contextLimitTokens) && input.contextLimitTokens > 0 && estimate.tokens < input.contextLimitTokens) {
|
|
24254
24255
|
return null;
|
|
24255
24256
|
}
|
|
24256
|
-
|
|
24257
|
-
|
|
24258
|
-
|
|
24259
|
-
|
|
24257
|
+
return describeHistorianJoinRefusal({
|
|
24258
|
+
waitedMs: input.budgetMs ?? HISTORIAN_INLINE_JOIN_BUDGET_MS,
|
|
24259
|
+
usagePercentage: input.usagePercentage,
|
|
24260
|
+
run: input.joinedRun,
|
|
24261
|
+
failures: input.failures ?? {
|
|
24262
|
+
count: 0,
|
|
24263
|
+
lastError: null,
|
|
24264
|
+
lastFailureAt: null,
|
|
24265
|
+
since: null
|
|
24266
|
+
},
|
|
24267
|
+
now: input.now
|
|
24268
|
+
});
|
|
24260
24269
|
}
|
|
24261
24270
|
function runCompartmentPhase(args) {
|
|
24262
24271
|
if (args.historianRunnable !== false && !args.compactionOff && args.canRunCompartments && !getActiveCompartmentRun(args.sessionId) && (args.sessionMeta.compartmentInProgress || args.contextUsage.percentage >= BLOCK_UNTIL_DONE_PERCENTAGE) && isHistorianDrainBudgetSpent({
|
|
@@ -24303,6 +24312,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
24303
24312
|
let rebuiltHistoryThisPass = false;
|
|
24304
24313
|
let historianJoinTimedOut = false;
|
|
24305
24314
|
let historianJoinBudgetMs = null;
|
|
24315
|
+
let historianJoinedRun;
|
|
24306
24316
|
let chainedRecoveryRuns = 0;
|
|
24307
24317
|
const historianRunnable = args.historianRunnable !== false;
|
|
24308
24318
|
if (args.compactionOff) {
|
|
@@ -24320,6 +24330,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
24320
24330
|
rebuiltHistoryThisPass,
|
|
24321
24331
|
historianJoinTimedOut,
|
|
24322
24332
|
historianJoinBudgetMs,
|
|
24333
|
+
historianJoinedRun,
|
|
24323
24334
|
chainedRecoveryRuns,
|
|
24324
24335
|
recoveryHistoryRemains: false
|
|
24325
24336
|
};
|
|
@@ -24375,6 +24386,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
24375
24386
|
if (activeRun.inlineJoinTimedOutBudgetMs !== undefined && !activeRun.settled) {
|
|
24376
24387
|
historianJoinTimedOut = true;
|
|
24377
24388
|
historianJoinBudgetMs = activeRun.inlineJoinTimedOutBudgetMs;
|
|
24389
|
+
historianJoinedRun = activeRun;
|
|
24378
24390
|
sessionLog2(args.sessionId, "transform: compartment inline join budget already exhausted for this run — not waiting again");
|
|
24379
24391
|
return "timed_out";
|
|
24380
24392
|
}
|
|
@@ -24395,6 +24407,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
24395
24407
|
if (result === "timeout") {
|
|
24396
24408
|
activeRun.inlineJoinTimedOutBudgetMs = join.budgetMs;
|
|
24397
24409
|
historianJoinTimedOut = true;
|
|
24410
|
+
historianJoinedRun = activeRun;
|
|
24398
24411
|
sessionLog2(args.sessionId, `transform: compartment await timed out after ${timeoutMs}ms — proceeding without waiting`);
|
|
24399
24412
|
return "timed_out";
|
|
24400
24413
|
}
|
|
@@ -24632,6 +24645,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
24632
24645
|
rebuiltHistoryThisPass,
|
|
24633
24646
|
historianJoinTimedOut,
|
|
24634
24647
|
historianJoinBudgetMs,
|
|
24648
|
+
historianJoinedRun,
|
|
24635
24649
|
chainedRecoveryRuns,
|
|
24636
24650
|
recoveryHistoryRemains
|
|
24637
24651
|
};
|
|
@@ -25090,9 +25104,17 @@ function createTransform(deps) {
|
|
|
25090
25104
|
deps.liveModelBySession.set(sessionId, currentOutgoingModel);
|
|
25091
25105
|
const outgoingModelKey = resolveModelKey(currentOutgoingModel.providerID, currentOutgoingModel.modelID);
|
|
25092
25106
|
const lastUsageModelKey = persistedUsageBeforeResets?.lastObservedModelKey ?? null;
|
|
25093
|
-
|
|
25094
|
-
|
|
25095
|
-
|
|
25107
|
+
const modelChangedSinceUsage = lastUsageModelKey != null && outgoingModelKey != null && piModelRefToCanonical(lastUsageModelKey) !== piModelRefToCanonical(outgoingModelKey);
|
|
25108
|
+
const storedOverflow = getOverflowState(db, sessionId);
|
|
25109
|
+
const detectedLimitForOtherModel = outgoingModelKey != null && storedOverflow.detectedContextLimit > 0 && storedOverflow.detectedContextLimitModelKey !== null && storedOverflow.detectedContextLimitModelKey !== piModelRefToCanonical(outgoingModelKey);
|
|
25110
|
+
if (detectedLimitForOtherModel && !modelChangedSinceUsage) {
|
|
25111
|
+
sessionLog2(sessionId, `transform: clearing detected limit ${storedOverflow.detectedContextLimit} and overflow recovery recorded for ${storedOverflow.detectedContextLimitModelKey}; outgoing model is ${outgoingModelKey}`);
|
|
25112
|
+
clearDetectedContextLimit(db, sessionId);
|
|
25113
|
+
clearEmergencyRecovery(db, sessionId);
|
|
25114
|
+
forgetHistoryBoundaryRecovery(sessionId);
|
|
25115
|
+
}
|
|
25116
|
+
if (modelChangedSinceUsage) {
|
|
25117
|
+
const preserveOutgoingOverflow = storedOverflow.detectedContextLimit > 0 && storedOverflow.detectedContextLimitModelKey !== null && !detectedLimitForOtherModel;
|
|
25096
25118
|
dropSlot(sessionId, "model-change");
|
|
25097
25119
|
sessionLog2(sessionId, `transform: model change since last usage (${lastUsageModelKey} -> ${outgoingModelKey}), clearing stale per-model state`);
|
|
25098
25120
|
updateSessionMeta(db, sessionId, {
|
|
@@ -25106,7 +25128,7 @@ function createTransform(deps) {
|
|
|
25106
25128
|
clearPersistedReasoningWatermark(db, sessionId);
|
|
25107
25129
|
clearEmergencyDropSample(db, sessionId);
|
|
25108
25130
|
if (preserveOutgoingOverflow) {
|
|
25109
|
-
sessionLog2(sessionId, `transform: preserving detected limit ${
|
|
25131
|
+
sessionLog2(sessionId, `transform: preserving detected limit ${storedOverflow.detectedContextLimit} and overflow recovery for outgoing model ${outgoingModelKey}`);
|
|
25110
25132
|
} else {
|
|
25111
25133
|
clearDetectedContextLimit(db, sessionId);
|
|
25112
25134
|
clearEmergencyRecovery(db, sessionId);
|
|
@@ -26396,10 +26418,12 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
26396
26418
|
budgetMs: compartmentPhase.historianJoinBudgetMs,
|
|
26397
26419
|
finalWireEstimate,
|
|
26398
26420
|
contextLimitTokens: boundaryContextLimit,
|
|
26399
|
-
|
|
26421
|
+
joinedRun: compartmentPhase.historianJoinedRun,
|
|
26422
|
+
failures: readHistorianFailureStreak(db, sessionId),
|
|
26423
|
+
usagePercentage: contextUsage.percentage
|
|
26400
26424
|
}) : null;
|
|
26401
26425
|
if (timedOutHistorianFailure) {
|
|
26402
|
-
sessionLog2(sessionId, `transform: ${timedOutHistorianFailure}; finalEstimate=${finalWireEstimate?.tokens ?? "unavailable"} estimateTrusted=${finalWireEstimate?.trusted ?? false} contextLimit=${boundaryContextLimit} emergencyReclaimed=${postTransformResult.emergencyReclaimedTokens}`);
|
|
26426
|
+
sessionLog2(sessionId, `transform: historian join refusal: ${timedOutHistorianFailure}; finalEstimate=${finalWireEstimate?.tokens ?? "unavailable"} estimateTrusted=${finalWireEstimate?.trusted ?? false} contextLimit=${boundaryContextLimit} emergencyReclaimed=${postTransformResult.emergencyReclaimedTokens}`);
|
|
26403
26427
|
keepRecoveryArmed();
|
|
26404
26428
|
throw new EmergencyFailClosedError(timedOutHistorianFailure);
|
|
26405
26429
|
}
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
requestPendingMaterialization,
|
|
9
9
|
dropSlot
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-bev3zks1.js";
|
|
11
11
|
import {
|
|
12
12
|
executeContextRecomp
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-3600gm9z.js";
|
|
14
14
|
import {
|
|
15
15
|
renderUserFacingFailure,
|
|
16
16
|
userFacingFailureCode
|
|
@@ -140,8 +140,8 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
140
140
|
import("./store-reader-3eh1s1m8.js"),
|
|
141
141
|
import("./store-h20ny8b8.js"),
|
|
142
142
|
import("./read-session-chunk-70aam2c1.js"),
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
143
|
+
import("./render-22ebrmep.js"),
|
|
144
|
+
import("./search-archive-bqqf5p7f.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
checkCompactionMarkerConsistency,
|
|
59
59
|
clearInjectionCache,
|
|
60
60
|
clearNoteNudgeTriggerOnly
|
|
61
|
-
} from "./index-
|
|
61
|
+
} from "./index-3600gm9z.js";
|
|
62
62
|
import"./index-sd3egckz.js";
|
|
63
63
|
import {
|
|
64
64
|
hasTrustedAbsoluteWall,
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
parameterDescriptionsFor,
|
|
144
144
|
MagicContextRpcServer,
|
|
145
145
|
applyHiddenSubagentTemperature
|
|
146
|
-
} from "./index-
|
|
146
|
+
} from "./index-wpcjxzrm.js";
|
|
147
147
|
import {
|
|
148
148
|
resolveOpenCodeDbPath,
|
|
149
149
|
openCodeDbPathExists,
|
|
@@ -195,7 +195,7 @@ import {
|
|
|
195
195
|
dropServedRecord,
|
|
196
196
|
registerLkgPersistence,
|
|
197
197
|
dropSlot
|
|
198
|
-
} from "./index-
|
|
198
|
+
} from "./index-bev3zks1.js";
|
|
199
199
|
import {
|
|
200
200
|
recordSessionProjectIdentity
|
|
201
201
|
} from "./index-qperbvjn.js";
|
|
@@ -317,13 +317,13 @@ import {
|
|
|
317
317
|
armBindingRecoverySafely,
|
|
318
318
|
collectForeignTextParts,
|
|
319
319
|
resetDegradedCacheCount2
|
|
320
|
-
} from "./index-
|
|
320
|
+
} from "./index-0r2jk2na.js";
|
|
321
321
|
import {
|
|
322
322
|
scheduleClearAndReindex
|
|
323
323
|
} from "./index-b6rdv8re.js";
|
|
324
324
|
import {
|
|
325
325
|
runManagedRecomp2
|
|
326
|
-
} from "./index-
|
|
326
|
+
} from "./index-x8e50d8f.js";
|
|
327
327
|
import {
|
|
328
328
|
isValidSemver,
|
|
329
329
|
compareSemverCore
|
|
@@ -331,11 +331,11 @@ import {
|
|
|
331
331
|
import"./index-fmsr7v69.js";
|
|
332
332
|
import {
|
|
333
333
|
runManagedWrapup2
|
|
334
|
-
} from "./index-
|
|
334
|
+
} from "./index-pdnan1e3.js";
|
|
335
335
|
import"./index-5gqszjq9.js";
|
|
336
336
|
import"./index-52x68mj4.js";
|
|
337
|
-
import"./index-
|
|
338
|
-
import"./index-
|
|
337
|
+
import"./index-zyanqxtc.js";
|
|
338
|
+
import"./index-1wsb0e8h.js";
|
|
339
339
|
import {
|
|
340
340
|
isDreamerRunnable,
|
|
341
341
|
isSmartNoteSurfaceAvailable,
|
|
@@ -8203,7 +8203,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
8203
8203
|
// package.json
|
|
8204
8204
|
var package_default = {
|
|
8205
8205
|
name: "@cortexkit/opencode-magic-context",
|
|
8206
|
-
version: "0.49.
|
|
8206
|
+
version: "0.49.57",
|
|
8207
8207
|
type: "module",
|
|
8208
8208
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
8209
8209
|
main: "dist/index.js",
|
|
@@ -12080,7 +12080,7 @@ async function setup(context) {
|
|
|
12080
12080
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
12081
12081
|
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.`);
|
|
12082
12082
|
}
|
|
12083
|
-
const { registerContext } = await import("./context-
|
|
12083
|
+
const { registerContext } = await import("./context-a617pcqe.js");
|
|
12084
12084
|
setHarness2("opencode2");
|
|
12085
12085
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
12086
12086
|
const duties = await registerContext(context);
|
|
@@ -12553,7 +12553,7 @@ var server = async (ctx) => {
|
|
|
12553
12553
|
rustReplayParticipant: () => magicContextRuntime.magicContext?.getRustReplayParticipant?.() ?? null,
|
|
12554
12554
|
onStorageBusyRefusal: async (sessionId, message) => {
|
|
12555
12555
|
const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-gamjee2f.js"));
|
|
12556
|
-
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-
|
|
12556
|
+
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-nejydt3q.js"));
|
|
12557
12557
|
await sendStatusNotification(ctx.client, sessionId, message, {
|
|
12558
12558
|
toastDurationMs: 15000
|
|
12559
12559
|
});
|
|
@@ -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-2czwvyc9.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-bqqf5p7f.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-04ger9zt.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
10
|
+
} from "./index-x8e50d8f.js";
|
|
11
|
+
import"./index-3600gm9z.js";
|
|
12
12
|
import"./index-90z05d0p.js";
|
|
13
13
|
import"./index-sd3egckz.js";
|
|
14
14
|
import"./index-pdh4tdcq.js";
|
|
@@ -16,7 +16,7 @@ import"./index-2vsd5064.js";
|
|
|
16
16
|
import"./index-jjvbk92s.js";
|
|
17
17
|
import"./index-sx1sppd6.js";
|
|
18
18
|
import"./index-4dhv7mqz.js";
|
|
19
|
-
import"./index-
|
|
19
|
+
import"./index-bev3zks1.js";
|
|
20
20
|
import"./index-dhdv88e5.js";
|
|
21
21
|
import"./index-h62j8z2r.js";
|
|
22
22
|
import"./index-2amn2s73.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSearchArchive2,
|
|
3
3
|
renderSearchArchiveOffThread2
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-1wsb0e8h.js";
|
|
5
|
+
import"./index-zyanqxtc.js";
|
|
6
6
|
import"./index-52x68mj4.js";
|
|
7
7
|
import"./index-29ff546v.js";
|
|
8
8
|
import"./index-sk6p6esd.js";
|
package/dist/{transform-postprocess-phase-64xtx439.js → transform-postprocess-phase-nejydt3q.js}
RENAMED
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
finalizeMessageRepresentation2,
|
|
20
20
|
runPostTransformPhase2,
|
|
21
21
|
checkM0MutationDriftAndSignal2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-0r2jk2na.js";
|
|
23
23
|
import"./index-b6rdv8re.js";
|
|
24
|
-
import"./index-
|
|
24
|
+
import"./index-3600gm9z.js";
|
|
25
25
|
import"./index-90z05d0p.js";
|
|
26
26
|
import"./index-sd3egckz.js";
|
|
27
27
|
import"./index-pdh4tdcq.js";
|
|
@@ -29,7 +29,7 @@ import"./index-2vsd5064.js";
|
|
|
29
29
|
import"./index-jjvbk92s.js";
|
|
30
30
|
import"./index-sx1sppd6.js";
|
|
31
31
|
import"./index-4dhv7mqz.js";
|
|
32
|
-
import"./index-
|
|
32
|
+
import"./index-bev3zks1.js";
|
|
33
33
|
import"./index-dhdv88e5.js";
|
|
34
34
|
import"./index-h62j8z2r.js";
|
|
35
35
|
import"./index-2amn2s73.js";
|
|
@@ -194,6 +194,8 @@ import {
|
|
|
194
194
|
producerPromptFailureReason,
|
|
195
195
|
resolveHiddenCompletionExecutor,
|
|
196
196
|
createV1HiddenCompletionExecutor,
|
|
197
|
+
readHistorianFailureStreak,
|
|
198
|
+
describeHistorianJoinRefusal,
|
|
197
199
|
shouldWaitForNewHistorianHistory,
|
|
198
200
|
EMPTY_READ_REPLY,
|
|
199
201
|
noteTouchedAt,
|
|
@@ -218,7 +220,7 @@ import {
|
|
|
218
220
|
startCompartmentAgent,
|
|
219
221
|
setRecompStarting2,
|
|
220
222
|
setRecompTerminal2
|
|
221
|
-
} from "./server-
|
|
223
|
+
} from "./server-dqwx9pdh.js";
|
|
222
224
|
import {
|
|
223
225
|
resolveHistorianModel2
|
|
224
226
|
} from "./server-5kym00ag.js";
|
|
@@ -376,7 +378,6 @@ import {
|
|
|
376
378
|
setPersistedTodoSyntheticAnchor,
|
|
377
379
|
clearPersistedTodoSyntheticAnchor,
|
|
378
380
|
setNoteLastReadAt,
|
|
379
|
-
getHistorianFailureState,
|
|
380
381
|
clearHistorianFailureState,
|
|
381
382
|
getOverflowState,
|
|
382
383
|
loadTransformPassStateSnapshot,
|
|
@@ -793,7 +794,7 @@ import {
|
|
|
793
794
|
saveSourceContent,
|
|
794
795
|
replaceSourceContent,
|
|
795
796
|
getSourceContents
|
|
796
|
-
} from "./server-
|
|
797
|
+
} from "./server-v57wr0r9.js";
|
|
797
798
|
import {
|
|
798
799
|
startBootDeadline,
|
|
799
800
|
getUnconfirmedMigrationHolders,
|
|
@@ -999,10 +1000,10 @@ import {
|
|
|
999
1000
|
import"./server-52x68mj4.js";
|
|
1000
1001
|
import {
|
|
1001
1002
|
readV2ArchiveOffThread2
|
|
1002
|
-
} from "./server-
|
|
1003
|
+
} from "./server-t5c8awdm.js";
|
|
1003
1004
|
import {
|
|
1004
1005
|
renderSearchArchiveOffThread2
|
|
1005
|
-
} from "./server-
|
|
1006
|
+
} from "./server-r7nj8ga0.js";
|
|
1006
1007
|
import {
|
|
1007
1008
|
markHostInstructionRow,
|
|
1008
1009
|
hostInstructionRow,
|
|
@@ -20200,10 +20201,18 @@ function historianJoinFailClosedMessage(input) {
|
|
|
20200
20201
|
if (estimate?.trusted === true && Number.isFinite(estimate.tokens) && estimate.tokens > 0 && Number.isFinite(input.contextLimitTokens) && input.contextLimitTokens > 0 && estimate.tokens < input.contextLimitTokens) {
|
|
20201
20202
|
return null;
|
|
20202
20203
|
}
|
|
20203
|
-
|
|
20204
|
-
|
|
20205
|
-
|
|
20206
|
-
|
|
20204
|
+
return describeHistorianJoinRefusal({
|
|
20205
|
+
waitedMs: input.budgetMs ?? HISTORIAN_INLINE_JOIN_BUDGET_MS,
|
|
20206
|
+
usagePercentage: input.usagePercentage,
|
|
20207
|
+
run: input.joinedRun,
|
|
20208
|
+
failures: input.failures ?? {
|
|
20209
|
+
count: 0,
|
|
20210
|
+
lastError: null,
|
|
20211
|
+
lastFailureAt: null,
|
|
20212
|
+
since: null
|
|
20213
|
+
},
|
|
20214
|
+
now: input.now
|
|
20215
|
+
});
|
|
20207
20216
|
}
|
|
20208
20217
|
function runCompartmentPhase(args) {
|
|
20209
20218
|
if (args.historianRunnable !== false && !args.compactionOff && args.canRunCompartments && !getActiveCompartmentRun(args.sessionId) && (args.sessionMeta.compartmentInProgress || args.contextUsage.percentage >= BLOCK_UNTIL_DONE_PERCENTAGE) && isHistorianDrainBudgetSpent({
|
|
@@ -20250,6 +20259,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
20250
20259
|
let rebuiltHistoryThisPass = false;
|
|
20251
20260
|
let historianJoinTimedOut = false;
|
|
20252
20261
|
let historianJoinBudgetMs = null;
|
|
20262
|
+
let historianJoinedRun;
|
|
20253
20263
|
let chainedRecoveryRuns = 0;
|
|
20254
20264
|
const historianRunnable = args.historianRunnable !== false;
|
|
20255
20265
|
if (args.compactionOff) {
|
|
@@ -20267,6 +20277,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
20267
20277
|
rebuiltHistoryThisPass,
|
|
20268
20278
|
historianJoinTimedOut,
|
|
20269
20279
|
historianJoinBudgetMs,
|
|
20280
|
+
historianJoinedRun,
|
|
20270
20281
|
chainedRecoveryRuns,
|
|
20271
20282
|
recoveryHistoryRemains: false
|
|
20272
20283
|
};
|
|
@@ -20322,6 +20333,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
20322
20333
|
if (activeRun.inlineJoinTimedOutBudgetMs !== undefined && !activeRun.settled) {
|
|
20323
20334
|
historianJoinTimedOut = true;
|
|
20324
20335
|
historianJoinBudgetMs = activeRun.inlineJoinTimedOutBudgetMs;
|
|
20336
|
+
historianJoinedRun = activeRun;
|
|
20325
20337
|
sessionLog2(args.sessionId, "transform: compartment inline join budget already exhausted for this run — not waiting again");
|
|
20326
20338
|
return "timed_out";
|
|
20327
20339
|
}
|
|
@@ -20342,6 +20354,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
20342
20354
|
if (result === "timeout") {
|
|
20343
20355
|
activeRun.inlineJoinTimedOutBudgetMs = join.budgetMs;
|
|
20344
20356
|
historianJoinTimedOut = true;
|
|
20357
|
+
historianJoinedRun = activeRun;
|
|
20345
20358
|
sessionLog2(args.sessionId, `transform: compartment await timed out after ${timeoutMs}ms — proceeding without waiting`);
|
|
20346
20359
|
return "timed_out";
|
|
20347
20360
|
}
|
|
@@ -20579,6 +20592,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
20579
20592
|
rebuiltHistoryThisPass,
|
|
20580
20593
|
historianJoinTimedOut,
|
|
20581
20594
|
historianJoinBudgetMs,
|
|
20595
|
+
historianJoinedRun,
|
|
20582
20596
|
chainedRecoveryRuns,
|
|
20583
20597
|
recoveryHistoryRemains
|
|
20584
20598
|
};
|
|
@@ -21028,9 +21042,17 @@ function createTransform(deps) {
|
|
|
21028
21042
|
deps.liveModelBySession.set(sessionId, currentOutgoingModel);
|
|
21029
21043
|
const outgoingModelKey = resolveModelKey(currentOutgoingModel.providerID, currentOutgoingModel.modelID);
|
|
21030
21044
|
const lastUsageModelKey = persistedUsageBeforeResets?.lastObservedModelKey ?? null;
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21045
|
+
const modelChangedSinceUsage = lastUsageModelKey != null && outgoingModelKey != null && piModelRefToCanonical(lastUsageModelKey) !== piModelRefToCanonical(outgoingModelKey);
|
|
21046
|
+
const storedOverflow = getOverflowState(db, sessionId);
|
|
21047
|
+
const detectedLimitForOtherModel = outgoingModelKey != null && storedOverflow.detectedContextLimit > 0 && storedOverflow.detectedContextLimitModelKey !== null && storedOverflow.detectedContextLimitModelKey !== piModelRefToCanonical(outgoingModelKey);
|
|
21048
|
+
if (detectedLimitForOtherModel && !modelChangedSinceUsage) {
|
|
21049
|
+
sessionLog2(sessionId, `transform: clearing detected limit ${storedOverflow.detectedContextLimit} and overflow recovery recorded for ${storedOverflow.detectedContextLimitModelKey}; outgoing model is ${outgoingModelKey}`);
|
|
21050
|
+
clearDetectedContextLimit(db, sessionId);
|
|
21051
|
+
clearEmergencyRecovery(db, sessionId);
|
|
21052
|
+
forgetHistoryBoundaryRecovery(sessionId);
|
|
21053
|
+
}
|
|
21054
|
+
if (modelChangedSinceUsage) {
|
|
21055
|
+
const preserveOutgoingOverflow = storedOverflow.detectedContextLimit > 0 && storedOverflow.detectedContextLimitModelKey !== null && !detectedLimitForOtherModel;
|
|
21034
21056
|
dropSlot(sessionId, "model-change");
|
|
21035
21057
|
sessionLog2(sessionId, `transform: model change since last usage (${lastUsageModelKey} -> ${outgoingModelKey}), clearing stale per-model state`);
|
|
21036
21058
|
updateSessionMeta(db, sessionId, {
|
|
@@ -21044,7 +21066,7 @@ function createTransform(deps) {
|
|
|
21044
21066
|
clearPersistedReasoningWatermark(db, sessionId);
|
|
21045
21067
|
clearEmergencyDropSample(db, sessionId);
|
|
21046
21068
|
if (preserveOutgoingOverflow) {
|
|
21047
|
-
sessionLog2(sessionId, `transform: preserving detected limit ${
|
|
21069
|
+
sessionLog2(sessionId, `transform: preserving detected limit ${storedOverflow.detectedContextLimit} and overflow recovery for outgoing model ${outgoingModelKey}`);
|
|
21048
21070
|
} else {
|
|
21049
21071
|
clearDetectedContextLimit(db, sessionId);
|
|
21050
21072
|
clearEmergencyRecovery(db, sessionId);
|
|
@@ -22334,10 +22356,12 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
22334
22356
|
budgetMs: compartmentPhase.historianJoinBudgetMs,
|
|
22335
22357
|
finalWireEstimate,
|
|
22336
22358
|
contextLimitTokens: boundaryContextLimit,
|
|
22337
|
-
|
|
22359
|
+
joinedRun: compartmentPhase.historianJoinedRun,
|
|
22360
|
+
failures: readHistorianFailureStreak(db, sessionId),
|
|
22361
|
+
usagePercentage: contextUsage.percentage
|
|
22338
22362
|
}) : null;
|
|
22339
22363
|
if (timedOutHistorianFailure) {
|
|
22340
|
-
sessionLog2(sessionId, `transform: ${timedOutHistorianFailure}; finalEstimate=${finalWireEstimate?.tokens ?? "unavailable"} estimateTrusted=${finalWireEstimate?.trusted ?? false} contextLimit=${boundaryContextLimit} emergencyReclaimed=${postTransformResult.emergencyReclaimedTokens}`);
|
|
22364
|
+
sessionLog2(sessionId, `transform: historian join refusal: ${timedOutHistorianFailure}; finalEstimate=${finalWireEstimate?.tokens ?? "unavailable"} estimateTrusted=${finalWireEstimate?.trusted ?? false} contextLimit=${boundaryContextLimit} emergencyReclaimed=${postTransformResult.emergencyReclaimedTokens}`);
|
|
22341
22365
|
keepRecoveryArmed();
|
|
22342
22366
|
throw new EmergencyFailClosedError(timedOutHistorianFailure);
|
|
22343
22367
|
}
|
|
@@ -26049,7 +26073,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26049
26073
|
const db = readDatabase();
|
|
26050
26074
|
if (!db)
|
|
26051
26075
|
return { ok: false, error: "db unavailable" };
|
|
26052
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
26076
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-1de5c0zr.js"));
|
|
26053
26077
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-95p89k7q.js"));
|
|
26054
26078
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
26055
26079
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -26134,7 +26158,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26134
26158
|
const db = readDatabase();
|
|
26135
26159
|
if (!db)
|
|
26136
26160
|
return { ok: false, error: "db unavailable" };
|
|
26137
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
26161
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-3871zj7c.js"));
|
|
26138
26162
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
26139
26163
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
26140
26164
|
const ctx = {
|
|
@@ -56350,17 +56374,26 @@ function persistV2UsageReading(args) {
|
|
|
56350
56374
|
updateSessionMeta(db, sessionID, { lastResponseTime: responseTime });
|
|
56351
56375
|
return;
|
|
56352
56376
|
}
|
|
56353
|
-
|
|
56377
|
+
let limit = reading.limit;
|
|
56378
|
+
const readingModel = reading.modelKey ?? draftModelKey;
|
|
56379
|
+
if (served && clearDisprovedDetectedLimit(db, sessionID, readingModel, reading.inputTokens)) {
|
|
56380
|
+
const slash = readingModel.indexOf("/");
|
|
56381
|
+
const relimit = slash > 0 ? args.limitFor?.(readingModel.slice(0, slash), readingModel.slice(slash + 1)) : undefined;
|
|
56382
|
+
if (typeof relimit === "number" && Number.isFinite(relimit) && relimit > 0) {
|
|
56383
|
+
limit = relimit;
|
|
56384
|
+
}
|
|
56385
|
+
}
|
|
56386
|
+
const percentage = reading.inputTokens / limit * 100;
|
|
56354
56387
|
const updates = {
|
|
56355
56388
|
lastContextPercentage: percentage,
|
|
56356
56389
|
lastInputTokens: reading.inputTokens,
|
|
56357
|
-
lastUsageContextLimit:
|
|
56390
|
+
lastUsageContextLimit: limit,
|
|
56358
56391
|
lastObservedModelKey: reading.modelKey ?? draftModelKey
|
|
56359
56392
|
};
|
|
56360
56393
|
if (responseTime)
|
|
56361
56394
|
updates.lastResponseTime = responseTime;
|
|
56362
56395
|
updateSessionMeta(db, sessionID, updates);
|
|
56363
|
-
sessionLog2(sessionID, `v2 usage: inputTokens=${reading.inputTokens} contextLimit=${
|
|
56396
|
+
sessionLog2(sessionID, `v2 usage: inputTokens=${reading.inputTokens} contextLimit=${limit} percentage=${percentage} responseModel=${reading.modelKey ?? "legacy"} draftContextLimit=${reading.admissionLimit} pressure=${readingMatchesDraft ? "current" : "stale-model-ignored"}`);
|
|
56364
56397
|
if (readingMatchesDraft) {
|
|
56365
56398
|
args.contextUsageMap.set(sessionID, {
|
|
56366
56399
|
usage: { inputTokens: reading.inputTokens, percentage },
|
|
@@ -56371,6 +56404,16 @@ function persistV2UsageReading(args) {
|
|
|
56371
56404
|
args.contextUsageMap.delete(sessionID);
|
|
56372
56405
|
}
|
|
56373
56406
|
}
|
|
56407
|
+
function clearDisprovedDetectedLimit(db, sessionID, readingModel, inputTokens) {
|
|
56408
|
+
const stored = getOverflowState(db, sessionID);
|
|
56409
|
+
if (stored.detectedContextLimit <= 0 || inputTokens <= stored.detectedContextLimit || stored.detectedContextLimitModelKey !== null && stored.detectedContextLimitModelKey !== piModelRefToCanonical(readingModel))
|
|
56410
|
+
return false;
|
|
56411
|
+
clearDetectedContextLimit(db, sessionID);
|
|
56412
|
+
dropSlot(sessionID, "session-cache-invalidated");
|
|
56413
|
+
clearInjectionCache(sessionID);
|
|
56414
|
+
sessionLog2(sessionID, `v2 usage: detected limit ${stored.detectedContextLimit} invalidated by a successful ${inputTokens}-token request on ${readingModel}; using catalog/default`);
|
|
56415
|
+
return true;
|
|
56416
|
+
}
|
|
56374
56417
|
|
|
56375
56418
|
// src/v2/hooks/context.ts
|
|
56376
56419
|
class V2LkgAdmissionReplay extends Error {
|
|
@@ -57237,7 +57280,8 @@ async function registerContext(context) {
|
|
|
57237
57280
|
sessionID: draft.sessionID,
|
|
57238
57281
|
draftModel: draft.model,
|
|
57239
57282
|
reading,
|
|
57240
|
-
contextUsageMap: usage
|
|
57283
|
+
contextUsageMap: usage,
|
|
57284
|
+
limitFor
|
|
57241
57285
|
});
|
|
57242
57286
|
}
|
|
57243
57287
|
} finally {
|
|
@@ -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,EAE7B,MAAM,mDAAmD,CAAC;AA0C3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,qCAAqC,CAAC;AA2B1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAGH,KAAK,oBAAoB,EAC5B,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EACH,KAAK,QAAQ,EA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-context/storage";
|
|
2
2
|
import type { TransformDeps } from "../../hooks/magic-context/transform";
|
|
3
|
-
import { type UsageReading } from "./usage-reading";
|
|
3
|
+
import { type UsageReading, type UsageReadingInput } from "./usage-reading";
|
|
4
4
|
export interface PersistV2UsageReadingArgs {
|
|
5
5
|
db: ContextDatabase;
|
|
6
6
|
sessionID: string;
|
|
@@ -10,6 +10,12 @@ export interface PersistV2UsageReadingArgs {
|
|
|
10
10
|
};
|
|
11
11
|
reading: UsageReading;
|
|
12
12
|
contextUsageMap: TransformDeps["contextUsageMap"];
|
|
13
|
+
/**
|
|
14
|
+
* The window resolver the reading was measured with. When this reading
|
|
15
|
+
* clears a detected limit, the reading's window is resolved again with it,
|
|
16
|
+
* so the recorded percentage is not computed against the cleared limit.
|
|
17
|
+
*/
|
|
18
|
+
limitFor?: UsageReadingInput["limitFor"];
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* Record the usage OpenCode stored for the latest completed reply.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-persist.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/usage-persist.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"usage-persist.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/usage-persist.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,eAAe,EAKvB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAOzE,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEzB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,yBAAyB;IACtC,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAkF3E"}
|