@cortexkit/opencode-magic-context 0.49.23 → 0.49.25
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/README.md +0 -26
- package/dist/agents/permissions.d.ts +8 -3
- package/dist/agents/permissions.d.ts.map +1 -1
- package/dist/auto-search-worker.js +4 -4
- package/dist/chunk-embedding-write-worker.js +5 -5
- package/dist/{compartment-chunk-embedding-he60aaa2.js → compartment-chunk-embedding-eypvn607.js} +3 -3
- package/dist/{conflict-warning-hook-2r32hyx6.js → conflict-warning-hook-a27bhggg.js} +4 -4
- package/dist/{context-j7hp43a0.js → context-keb00be8.js} +30 -24
- package/dist/{embedding-backfill-dtke6tck.js → embedding-backfill-vddgmem3.js} +5 -5
- package/dist/features/magic-context/dreamer/primer-seed.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +113 -57
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/ask-answer-notice.d.ts +25 -0
- package/dist/hooks/magic-context/ask-answer-notice.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +12 -4
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +8 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +10 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts +42 -0
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-y76rhsnr.js → index-0s8454t2.js} +50 -31
- package/dist/{index-1gtfne2c.js → index-2haxh8h3.js} +1 -1
- package/dist/{index-m32esgmj.js → index-3d5wnkq7.js} +1 -1
- package/dist/{index-jfem3dgz.js → index-7tdtpqrg.js} +5 -1
- package/dist/{index-mnnkgq0q.js → index-awcftgmx.js} +7 -49
- package/dist/{index-1kbznkft.js → index-axjgxeww.js} +10 -8
- package/dist/{index-j32jj2t8.js → index-bhyksfyy.js} +3 -3
- package/dist/{index-ksq50rg0.js → index-c9zrgcnt.js} +1 -1
- package/dist/index-cfaet9cg.js +405 -0
- package/dist/{index-jmq8kfe7.js → index-ebsvmc5s.js} +4 -4
- package/dist/{index-66eby7hx.js → index-jcr6pe7z.js} +1 -1
- package/dist/{index-syaazvy2.js → index-n18sch77.js} +5 -5
- package/dist/{index-a9zvn5fe.js → index-q7ywt6xt.js} +3 -3
- package/dist/{index-x6cbrv9h.js → index-szf8r0ba.js} +1 -1
- package/dist/{index-rxqr723x.js → index-t6j3qxnd.js} +1 -1
- package/dist/{index-11gzxvf4.js → index-y6xpzjzr.js} +98 -48
- package/dist/{index-mnhcdfxg.js → index-yrrsp47d.js} +91 -17
- package/dist/{index-zy67whjr.js → index-z05n7702.js} +1 -1
- package/dist/{index-3svaejkh.js → index-z928hmnp.js} +1 -1
- package/dist/{index-ffzhwfzy.js → index-zzrzjnx5.js} +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -38
- package/dist/{message-fts-rowid-map-e79b7b6x.js → message-fts-rowid-map-9e1getgs.js} +2 -2
- package/dist/{message-index-4q8ek2fc.js → message-index-3g966xn7.js} +7 -7
- package/dist/{message-index-bounded-rydsg9r5.js → message-index-bounded-vaeqhp9w.js} +7 -7
- package/dist/migration-worker.js +4 -4
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-hn529988.js → project-embedding-registry-rstzmb60.js} +4 -4
- package/dist/raw-ordinal-warmup-worker.js +6 -6
- package/dist/{read-session-chunk-t039f0m5.js → read-session-chunk-z5gnc0zb.js} +4 -4
- package/dist/{read-session-raw-aw6jgvwg.js → read-session-raw-s4amywnh.js} +3 -1
- package/dist/{recomp-orchestrator-hbm53jj5.js → recomp-orchestrator-qwqeskhq.js} +14 -14
- package/dist/{search-hea079d7.js → search-84zfqeky.js} +11 -11
- package/dist/{search-archive-weh164mh.js → search-archive-mfabzyn2.js} +5 -5
- package/dist/{send-session-notification-gqzkz7da.js → send-session-notification-ygj4mja0.js} +3 -3
- package/dist/shared/slow-test.d.ts +7 -0
- package/dist/shared/slow-test.d.ts.map +1 -0
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/parameter-descriptions.d.ts +6 -6
- package/dist/tools/parameter-descriptions.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-0b04tm1p.js → transform-postprocess-phase-hr1ntmjj.js} +14 -14
- package/dist/v2/auto-search-worker.js +4 -4
- package/dist/v2/chunk-embedding-write-worker.js +5 -5
- package/dist/v2/{compartment-chunk-embedding-8jjmcgeg.js → compartment-chunk-embedding-tk6g4q80.js} +3 -3
- package/dist/v2/{context-ea3x7smm.js → context-y7wfvdve.js} +106 -50
- package/dist/v2/{embedding-backfill-5e74ae0m.js → embedding-backfill-w5qp7t28.js} +5 -5
- package/dist/v2/hooks/context.d.ts +4 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/{message-fts-rowid-map-n8fdg2ja.js → message-fts-rowid-map-pqk3a55v.js} +2 -2
- package/dist/v2/{message-index-bounded-8rcd7qq9.js → message-index-bounded-te303atj.js} +6 -6
- package/dist/v2/{message-index-qz9wdp82.js → message-index-fz6b4jeh.js} +6 -6
- package/dist/v2/migration-worker.js +4 -4
- package/dist/v2/{project-embedding-registry-v38q4xd5.js → project-embedding-registry-e7zftfvj.js} +4 -4
- package/dist/v2/raw-ordinal-warmup-worker.js +6 -6
- package/dist/v2/{read-session-chunk-wazfyxcg.js → read-session-chunk-knvkq1hf.js} +3 -3
- package/dist/v2/{read-session-raw-b70cpwzj.js → read-session-raw-ppjxnqk4.js} +3 -1
- package/dist/v2/{recomp-orchestrator-b12zaptj.js → recomp-orchestrator-e8a4jpvr.js} +11 -11
- package/dist/v2/{search-archive-x64rtz1z.js → search-archive-vrwgxv6z.js} +4 -4
- package/dist/v2/{search-hza9x72a.js → search-hav4dggf.js} +10 -10
- package/dist/v2/{send-session-notification-8eqe259v.js → send-session-notification-f8scq6ae.js} +1 -1
- package/dist/v2/{server-m4bfaevz.js → server-5brp2rfn.js} +90 -16
- package/dist/v2/{server-ppcd1qxh.js → server-6a8pxpxg.js} +7 -49
- package/dist/v2/server-7d6m1p2b.js +361 -0
- package/dist/v2/{server-zg5y109h.js → server-7weh65vd.js} +45 -27
- package/dist/v2/{server-qteg2kt9.js → server-8j2e7t31.js} +1 -1
- package/dist/v2/{server-d48x3m4x.js → server-9xbbaekh.js} +1 -1
- package/dist/v2/{server-j8h7bsca.js → server-e75vag9d.js} +3 -3
- package/dist/v2/{server-132h8twc.js → server-m6yyn961.js} +2 -2
- package/dist/v2/{server-62g58aaz.js → server-pw21ypwb.js} +1 -1
- package/dist/v2/{server-ad18djzs.js → server-q5z0gag0.js} +1 -1
- package/dist/v2/{server-4kjmrjn4.js → server-swvhxhxz.js} +5 -1
- package/dist/v2/{server-33nqbqkw.js → server-tfawsj08.js} +5 -5
- package/dist/v2/{server-dtp8hcjh.js → server-wxrdher8.js} +1 -1
- package/dist/v2/server.js +5 -5
- package/dist/v2/{wrapup-orchestrator-3ssd5yy1.js → wrapup-orchestrator-ycs8y6n4.js} +11 -11
- package/dist/{wrapup-orchestrator-5vpcd1zx.js → wrapup-orchestrator-f642w8n3.js} +15 -15
- package/package.json +4 -4
- package/src/agents/permissions.ts +22 -6
- package/src/agents/smart-notes-dreamer-gate.golden.json +241 -241
- package/src/agents/smart-notes-on.golden.json +4 -4
- package/src/config/compaction-accessor-guard.test.ts +0 -5
- package/src/config/removed-config-keys.test.ts +12 -26
- package/src/shared/announcement.test.ts +55 -59
- package/src/shared/prompt-surface-a1-golden.md +6 -7
- package/src/shared/slow-test.ts +24 -0
- package/src/shared/stable-json-linear.test.ts +18 -10
- package/dist/index-j76ah6d7.js +0 -120
- package/dist/v2/server-d1dzgvwd.js +0 -120
- package/src/config/latch-permanence-guard.test.ts +0 -258
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
getRawSessionTagKeysThrough2,
|
|
98
98
|
getLegacyProtectedTailStartOrdinal2,
|
|
99
99
|
readSessionChunk2
|
|
100
|
-
} from "./index-
|
|
100
|
+
} from "./index-yrrsp47d.js";
|
|
101
101
|
import {
|
|
102
102
|
getHarness2,
|
|
103
103
|
harnessOwnsOpenCodeStore2
|
|
@@ -164,7 +164,7 @@ import {
|
|
|
164
164
|
LATEST_SUPPORTED_VERSION,
|
|
165
165
|
getPersistedSchemaVersion,
|
|
166
166
|
openDatabase
|
|
167
|
-
} from "./index-
|
|
167
|
+
} from "./index-q7ywt6xt.js";
|
|
168
168
|
import {
|
|
169
169
|
inRootAsyncContext2,
|
|
170
170
|
Database2,
|
|
@@ -181,11 +181,12 @@ import {
|
|
|
181
181
|
isPidAlive
|
|
182
182
|
} from "./index-c7phnbvk.js";
|
|
183
183
|
import {
|
|
184
|
+
areRustHistorianSyntheticParts2,
|
|
184
185
|
isStrictGapHealingMessage2,
|
|
185
186
|
noteRawSessionSummaryRowWritten2,
|
|
186
187
|
RawOrdinalsNotReady2,
|
|
187
188
|
runSessionWarmupWorker
|
|
188
|
-
} from "./index-
|
|
189
|
+
} from "./index-7tdtpqrg.js";
|
|
189
190
|
import {
|
|
190
191
|
layoutLkgPrefix,
|
|
191
192
|
assembleLkgPrefix,
|
|
@@ -212,8 +213,9 @@ import {
|
|
|
212
213
|
claimOpenCodeDbDiagnosticOnce
|
|
213
214
|
} from "./index-58e3y90n.js";
|
|
214
215
|
import {
|
|
216
|
+
BoundedSessionMap,
|
|
215
217
|
getMeasuredToolDefinitionTokens
|
|
216
|
-
} from "./index-
|
|
218
|
+
} from "./index-cfaet9cg.js";
|
|
217
219
|
import {
|
|
218
220
|
invalidateAutoEmbedSession,
|
|
219
221
|
drainBackgroundBatches,
|
|
@@ -222,7 +224,7 @@ import {
|
|
|
222
224
|
getProjectChunkEmbeddingModelId2,
|
|
223
225
|
getProjectEmbeddingMaxInputTokens2,
|
|
224
226
|
embedItemsForProject2
|
|
225
|
-
} from "./index-
|
|
227
|
+
} from "./index-z05n7702.js";
|
|
226
228
|
import {
|
|
227
229
|
buildCanonicalChunkTextFromFts2,
|
|
228
230
|
buildCompartmentSummaryFallbackText2,
|
|
@@ -232,9 +234,8 @@ import {
|
|
|
232
234
|
replaceCompartmentChunkEmbeddings2,
|
|
233
235
|
deleteChunkEmbedBackoffForSession2,
|
|
234
236
|
chunkWindowSourceKey2
|
|
235
|
-
} from "./index-
|
|
237
|
+
} from "./index-3d5wnkq7.js";
|
|
236
238
|
import {
|
|
237
|
-
BoundedSessionMap,
|
|
238
239
|
clearCompressionDepth,
|
|
239
240
|
clearCompressionDepthRange,
|
|
240
241
|
clearLkgFenceProcessState,
|
|
@@ -249,7 +250,7 @@ import {
|
|
|
249
250
|
toMessageIndexSource2,
|
|
250
251
|
clearIndexedMessagesInTransaction2,
|
|
251
252
|
indexSourcesAfterOrdinal2
|
|
252
|
-
} from "./index-
|
|
253
|
+
} from "./index-awcftgmx.js";
|
|
253
254
|
import {
|
|
254
255
|
stripWellFormedLeadingTagPrefix,
|
|
255
256
|
stripTagPrefix,
|
|
@@ -267,7 +268,7 @@ import {
|
|
|
267
268
|
openCodeDbExists,
|
|
268
269
|
withReadOnlySessionDb,
|
|
269
270
|
getMessageTimesFromOpenCodeDb
|
|
270
|
-
} from "./index-
|
|
271
|
+
} from "./index-c9zrgcnt.js";
|
|
271
272
|
import {
|
|
272
273
|
renderUserFacingFailure,
|
|
273
274
|
userFacingFailureCode,
|
|
@@ -276,7 +277,7 @@ import {
|
|
|
276
277
|
insertPrimerCandidates,
|
|
277
278
|
promoteSessionFactsDurable,
|
|
278
279
|
embedPromotedFacts
|
|
279
|
-
} from "./index-
|
|
280
|
+
} from "./index-z928hmnp.js";
|
|
280
281
|
import {
|
|
281
282
|
pushNotification2
|
|
282
283
|
} from "./index-x8a7jmkh.js";
|
|
@@ -296,7 +297,7 @@ import {
|
|
|
296
297
|
} from "./index-qgh1qwjj.js";
|
|
297
298
|
import {
|
|
298
299
|
sendStatusNotification2
|
|
299
|
-
} from "./index-
|
|
300
|
+
} from "./index-jcr6pe7z.js";
|
|
300
301
|
import {
|
|
301
302
|
isCompactionEnabled,
|
|
302
303
|
migrateLegacyAgentEnabledInMemory
|
|
@@ -345,13 +346,14 @@ function denyTaskRoutingToAgents(permission, internalAgentIds) {
|
|
|
345
346
|
const configuredTask = isPermissionAction(task) ? { "*": task } : isPermissionMap(task) ? task : {};
|
|
346
347
|
const internalAgentIdSet = new Set(internalAgentIds);
|
|
347
348
|
const hasAmbientWildcardDeny = configuredTask["*"] === "deny";
|
|
348
|
-
const
|
|
349
|
+
const movesAmbientWildcardDeny = hasAmbientWildcardDeny && Object.keys(configuredTask).every((agentId) => agentId === "*" || internalAgentIdSet.has(agentId));
|
|
350
|
+
const retainedTask = Object.fromEntries(Object.entries(configuredTask).filter(([agentId]) => !internalAgentIdSet.has(agentId) && (agentId !== "*" || !movesAmbientWildcardDeny)));
|
|
349
351
|
return {
|
|
350
352
|
...otherPermissions,
|
|
351
353
|
task: {
|
|
352
354
|
...retainedTask,
|
|
353
355
|
...Object.fromEntries(internalAgentIds.map((agentId) => [agentId, "deny"])),
|
|
354
|
-
...
|
|
356
|
+
...movesAmbientWildcardDeny ? { "*": "deny" } : {}
|
|
355
357
|
}
|
|
356
358
|
};
|
|
357
359
|
}
|
|
@@ -5408,13 +5410,13 @@ function identity(slot) {
|
|
|
5408
5410
|
slot.inputContentDigests
|
|
5409
5411
|
])).update(slot.jsonPrefix).digest("hex");
|
|
5410
5412
|
}
|
|
5411
|
-
function envelope(modelKey, systemPromptTokens, agentName) {
|
|
5413
|
+
function envelope(modelKey, systemPromptTokens, agentName, sessionId) {
|
|
5412
5414
|
const slash = modelKey.indexOf("/");
|
|
5413
5415
|
return JSON.stringify([
|
|
5414
5416
|
modelKey,
|
|
5415
5417
|
systemPromptTokens,
|
|
5416
5418
|
agentName,
|
|
5417
|
-
getMeasuredToolDefinitionTokens(modelKey.slice(0, slash), modelKey.slice(slash + 1), agentName)
|
|
5419
|
+
getMeasuredToolDefinitionTokens(modelKey.slice(0, slash), modelKey.slice(slash + 1), agentName, sessionId)
|
|
5418
5420
|
]);
|
|
5419
5421
|
}
|
|
5420
5422
|
function beginV2LkgRequest(sessionId, modelKey, previousResponseId, responseAfterSequence) {
|
|
@@ -5446,7 +5448,7 @@ function noteCapturedLkgRequest(args) {
|
|
|
5446
5448
|
request,
|
|
5447
5449
|
slot: identity(args.slot),
|
|
5448
5450
|
prefixCount: JSON.parse(args.slot.jsonPrefix).length,
|
|
5449
|
-
envelope: envelope(request.modelKey, args.systemPromptTokens, args.agentName)
|
|
5451
|
+
envelope: envelope(request.modelKey, args.systemPromptTokens, args.agentName, args.sessionId)
|
|
5450
5452
|
});
|
|
5451
5453
|
}
|
|
5452
5454
|
function noteLkgProviderResponse(args) {
|
|
@@ -5477,7 +5479,7 @@ function noteLkgProviderResponse(args) {
|
|
|
5477
5479
|
}
|
|
5478
5480
|
function measuredLkgPrefix(args) {
|
|
5479
5481
|
const capture = captures.get(args.sessionId);
|
|
5480
|
-
if (!capture?.usage || !args.slot || capture.slot !== identity(args.slot) || capture.request.modelKey !== args.modelKey || capture.envelope !== envelope(args.modelKey, args.systemPromptTokens, args.agentName))
|
|
5482
|
+
if (!capture?.usage || !args.slot || capture.slot !== identity(args.slot) || capture.request.modelKey !== args.modelKey || capture.envelope !== envelope(args.modelKey, args.systemPromptTokens, args.agentName, args.sessionId))
|
|
5481
5483
|
return;
|
|
5482
5484
|
const appendedMessages = args.messages.slice(capture.prefixCount);
|
|
5483
5485
|
if (appendedMessages[0]?.info.id !== capture.usage.responseId || appendedMessages[0]?.info.role !== "assistant" || JSON.stringify(args.messages.slice(0, capture.prefixCount)) !== args.slot.jsonPrefix)
|
|
@@ -19639,6 +19641,7 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
19639
19641
|
priorBoundaryOrdinal: ctx.priorBoundaryOrdinal,
|
|
19640
19642
|
migrationFloorActive: ctx.migrationFloorActive,
|
|
19641
19643
|
emergencyTailScale: ctx.emergencyTailScale,
|
|
19644
|
+
liftLivePromptFloor: ctx.liftLivePromptFloor === true ? true : undefined,
|
|
19642
19645
|
providerShapeVersion: ctx.providerShapeVersion,
|
|
19643
19646
|
cacheNamespace: ctx.cacheNamespace,
|
|
19644
19647
|
createdAt,
|
|
@@ -20066,28 +20069,37 @@ function logInconsistentProducerWindowOnce(sessionId, model, window, reserve) {
|
|
|
20066
20069
|
sessionLog2(sessionId, `producer window inconsistent for ${model}: window=${window} reserve=${reserve}; sending unguarded`);
|
|
20067
20070
|
}
|
|
20068
20071
|
var HISTORIAN_ALERT_COOLDOWN_MS = 60 * 1000;
|
|
20069
|
-
function
|
|
20070
|
-
|
|
20071
|
-
return [];
|
|
20072
|
+
function nonNarrativeStoredGapRanges(db, sessionId, compartments) {
|
|
20073
|
+
const rebasedToV2 = readCoordinateRebaseNotice(db, sessionId)?.generation === "v2";
|
|
20072
20074
|
const safeRanges = [];
|
|
20073
|
-
for (let index =
|
|
20075
|
+
for (let index = 0;index < compartments.length; index += 1) {
|
|
20074
20076
|
const previous = compartments[index - 1];
|
|
20075
20077
|
const current = compartments[index];
|
|
20076
|
-
if (!
|
|
20078
|
+
if (!current)
|
|
20077
20079
|
continue;
|
|
20078
|
-
const start = previous.endMessage + 1;
|
|
20080
|
+
const start = previous ? previous.endMessage + 1 : 1;
|
|
20079
20081
|
const end = current.startMessage - 1;
|
|
20080
20082
|
if (end < start)
|
|
20081
20083
|
continue;
|
|
20082
20084
|
const messages = readRawSessionMessageRange2(sessionId, start, end);
|
|
20083
20085
|
const ordinals = new Set(messages.map((message) => message.ordinal));
|
|
20084
|
-
const complete = ordinals.size === end - start + 1 && messages.every((message) => isStrictGapHealingMessage2(message));
|
|
20086
|
+
const complete = ordinals.size === end - start + 1 && messages.every((message) => message.ordinal >= start && message.ordinal <= end && (areRustHistorianSyntheticParts2(message.parts) || index > 0 && rebasedToV2 && isStrictGapHealingMessage2(message)));
|
|
20085
20087
|
if (complete)
|
|
20086
20088
|
safeRanges.push({ start, end });
|
|
20087
20089
|
}
|
|
20088
20090
|
return safeRanges;
|
|
20089
20091
|
}
|
|
20090
20092
|
var lastHistorianAlertBySession = new Map;
|
|
20093
|
+
var loggedStoredValidationFailures = new Map;
|
|
20094
|
+
function logStoredValidationFailureOnce(sessionId, error) {
|
|
20095
|
+
const failureClass = error.split(" ", 2).join(" ");
|
|
20096
|
+
const logged = loggedStoredValidationFailures.get(sessionId) ?? new Set;
|
|
20097
|
+
if (logged.has(failureClass))
|
|
20098
|
+
return;
|
|
20099
|
+
logged.add(failureClass);
|
|
20100
|
+
loggedStoredValidationFailures.set(sessionId, logged);
|
|
20101
|
+
sessionLog2(sessionId, `historian failure: source=existing-validation reason="${error}"`);
|
|
20102
|
+
}
|
|
20091
20103
|
var STORED_COMPARTMENT_FAILURE_BACKOFF_MS = 30 * 60 * 1000;
|
|
20092
20104
|
function storedCompartmentFailureBackingOff(db, sessionId, validationError, now = Date.now()) {
|
|
20093
20105
|
if (getHistorianFailureState(db, sessionId).lastError !== validationError)
|
|
@@ -20232,10 +20244,12 @@ async function runCompartmentAgent(deps) {
|
|
|
20232
20244
|
return;
|
|
20233
20245
|
}
|
|
20234
20246
|
let priorCompartments = getCompartments(db, sessionId);
|
|
20235
|
-
let existingValidationError = validateStoredCompartments(priorCompartments,
|
|
20247
|
+
let existingValidationError = validateStoredCompartments(priorCompartments, nonNarrativeStoredGapRanges(db, sessionId, priorCompartments));
|
|
20236
20248
|
const unresolvedInvolved = existingValidationError !== null && priorCompartments.some((compartment) => compartment.rebaseStatus === "unresolved");
|
|
20237
|
-
if (
|
|
20238
|
-
|
|
20249
|
+
if (existingValidationError && storedCompartmentFailureBackingOff(db, sessionId, existingValidationError)) {
|
|
20250
|
+
if (unresolvedInvolved) {
|
|
20251
|
+
sessionLog2(sessionId, `historian no-op: stored compartments still invalid ("${existingValidationError}"); backing off`);
|
|
20252
|
+
}
|
|
20239
20253
|
telemetry.status = "noop";
|
|
20240
20254
|
telemetry.failureReason = `existing-validation backoff: ${existingValidationError}`;
|
|
20241
20255
|
return;
|
|
@@ -20249,15 +20263,19 @@ async function runCompartmentAgent(deps) {
|
|
|
20249
20263
|
});
|
|
20250
20264
|
if (recovery.rowsRewritten > 0) {
|
|
20251
20265
|
priorCompartments = getCompartments(db, sessionId);
|
|
20252
|
-
existingValidationError = validateStoredCompartments(priorCompartments,
|
|
20266
|
+
existingValidationError = validateStoredCompartments(priorCompartments, nonNarrativeStoredGapRanges(db, sessionId, priorCompartments));
|
|
20253
20267
|
}
|
|
20254
20268
|
}
|
|
20255
20269
|
if (existingValidationError) {
|
|
20256
|
-
|
|
20270
|
+
if (unresolvedInvolved) {
|
|
20271
|
+
sessionLog2(sessionId, `historian failure: source=existing-validation reason="${existingValidationError}"`);
|
|
20272
|
+
} else {
|
|
20273
|
+
logStoredValidationFailureOnce(sessionId, existingValidationError);
|
|
20274
|
+
}
|
|
20257
20275
|
const failCount = incrementHistorianFailure(db, sessionId, existingValidationError);
|
|
20258
20276
|
telemetry.failureReason = `existing-validation: ${existingValidationError}`;
|
|
20277
|
+
retainDrainReservationForRetryThrottle = true;
|
|
20259
20278
|
if (unresolvedInvolved) {
|
|
20260
|
-
retainDrainReservationForRetryThrottle = true;
|
|
20261
20279
|
await notifyHistorianIssue(buildStoredCompartmentsInvalidNotice());
|
|
20262
20280
|
} else {
|
|
20263
20281
|
await notifyHistorianIssue(buildHistorianFailureNotice(failCount, existingValidationError));
|
|
@@ -20297,7 +20315,8 @@ async function runCompartmentAgent(deps) {
|
|
|
20297
20315
|
inputTokens: boundarySnapshot.usageInputTokens
|
|
20298
20316
|
},
|
|
20299
20317
|
usageSource: boundarySnapshot.usageSource,
|
|
20300
|
-
emergencyTailScale: boundarySnapshot.emergencyTailScale
|
|
20318
|
+
emergencyTailScale: boundarySnapshot.emergencyTailScale,
|
|
20319
|
+
liftLivePromptFloor: boundarySnapshot.liftLivePromptFloor === true
|
|
20301
20320
|
});
|
|
20302
20321
|
if (refreshed && hasRunnableCompartmentWindow(refreshed)) {
|
|
20303
20322
|
sessionLog2(sessionId, `historian: refreshed stale protected-tail snapshot at run time (was: ${validation.detail ?? "stale"}) — eligible head ${refreshed.offset}-${refreshed.eligibleEndOrdinal - 1}`);
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./index-wfybj1dw.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-szf8r0ba.js";
|
|
17
17
|
|
|
18
18
|
// src/features/magic-context/compartment-chunk-embedding.ts
|
|
19
19
|
import { createHash } from "node:crypto";
|
|
@@ -18,6 +18,10 @@ import { Worker } from "node:worker_threads";
|
|
|
18
18
|
|
|
19
19
|
// src/hooks/magic-context/read-session-raw.ts
|
|
20
20
|
import { isMainThread } from "node:worker_threads";
|
|
21
|
+
function areRustHistorianSyntheticParts2(parts) {
|
|
22
|
+
const contentParts = parts.filter((part) => part === null || typeof part !== "object" || part.type !== "compaction");
|
|
23
|
+
return contentParts.length > 0 && contentParts.every((part) => part !== null && typeof part === "object" && (part.synthetic === true || part.syntheticTodoMarker === true));
|
|
24
|
+
}
|
|
21
25
|
function isStrictGapHealingMessage2(message) {
|
|
22
26
|
if (message.storeType === "synthetic")
|
|
23
27
|
return true;
|
|
@@ -1293,4 +1297,4 @@ function recordFailure(key, sessionId, failure, detail) {
|
|
|
1293
1297
|
log2(`[magic-context] WARN canonical ordinal warm-up failed for ${sessionId} (${failure}: ${detail}); counts remain bounded and callers must defer or retry`);
|
|
1294
1298
|
}
|
|
1295
1299
|
|
|
1296
|
-
export { isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
|
|
1300
|
+
export { areRustHistorianSyntheticParts2, isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
|
|
@@ -35,17 +35,20 @@ import {
|
|
|
35
35
|
} from "./index-58e3y90n.js";
|
|
36
36
|
import {
|
|
37
37
|
cleanUserText2
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-yrrsp47d.js";
|
|
39
|
+
import {
|
|
40
|
+
BoundedSessionMap
|
|
41
|
+
} from "./index-cfaet9cg.js";
|
|
39
42
|
import {
|
|
40
43
|
recordMessageFtsRowid2,
|
|
41
44
|
recordIndexedMessageTime2,
|
|
42
45
|
messageFtsOrdinalRangeIsMapped2,
|
|
43
46
|
getMessageFtsRowidMapBackfillProgress2,
|
|
44
47
|
deleteUnmappedMessageFtsRows2
|
|
45
|
-
} from "./index-
|
|
48
|
+
} from "./index-szf8r0ba.js";
|
|
46
49
|
import {
|
|
47
50
|
deleteChunkEmbedBackoffForSession2
|
|
48
|
-
} from "./index-
|
|
51
|
+
} from "./index-3d5wnkq7.js";
|
|
49
52
|
import {
|
|
50
53
|
sameProjectDirectory
|
|
51
54
|
} from "./index-knvkbfvh.js";
|
|
@@ -63,51 +66,6 @@ import {
|
|
|
63
66
|
writeStorageFileDurableAtomicSync
|
|
64
67
|
} from "./index-fvnzcnww.js";
|
|
65
68
|
|
|
66
|
-
// src/shared/bounded-session-map.ts
|
|
67
|
-
class BoundedSessionMap {
|
|
68
|
-
maxEntries;
|
|
69
|
-
store = new Map;
|
|
70
|
-
constructor(maxEntries) {
|
|
71
|
-
if (!Number.isFinite(maxEntries) || maxEntries < 1) {
|
|
72
|
-
throw new Error(`BoundedSessionMap: maxEntries must be >= 1, got ${maxEntries}`);
|
|
73
|
-
}
|
|
74
|
-
this.maxEntries = maxEntries;
|
|
75
|
-
}
|
|
76
|
-
get(sessionId) {
|
|
77
|
-
const value = this.store.get(sessionId);
|
|
78
|
-
if (value === undefined)
|
|
79
|
-
return;
|
|
80
|
-
this.store.delete(sessionId);
|
|
81
|
-
this.store.set(sessionId, value);
|
|
82
|
-
return value;
|
|
83
|
-
}
|
|
84
|
-
peek(sessionId) {
|
|
85
|
-
return this.store.get(sessionId);
|
|
86
|
-
}
|
|
87
|
-
has(sessionId) {
|
|
88
|
-
return this.store.has(sessionId);
|
|
89
|
-
}
|
|
90
|
-
set(sessionId, value) {
|
|
91
|
-
if (this.store.has(sessionId)) {
|
|
92
|
-
this.store.delete(sessionId);
|
|
93
|
-
} else if (this.store.size >= this.maxEntries) {
|
|
94
|
-
const oldest = this.store.keys().next().value;
|
|
95
|
-
if (oldest !== undefined)
|
|
96
|
-
this.store.delete(oldest);
|
|
97
|
-
}
|
|
98
|
-
this.store.set(sessionId, value);
|
|
99
|
-
}
|
|
100
|
-
delete(sessionId) {
|
|
101
|
-
return this.store.delete(sessionId);
|
|
102
|
-
}
|
|
103
|
-
clear() {
|
|
104
|
-
this.store.clear();
|
|
105
|
-
}
|
|
106
|
-
get size() {
|
|
107
|
-
return this.store.size;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
69
|
// src/features/magic-context/session-activity.ts
|
|
112
70
|
var PREFIX = "retrospective_activity:";
|
|
113
71
|
var INTERVAL_MS = 15000;
|
|
@@ -2290,4 +2248,4 @@ async function sweepOrphanedOpenCodeMessageIndexesCooperatively2(db, openSource,
|
|
|
2290
2248
|
}));
|
|
2291
2249
|
}
|
|
2292
2250
|
|
|
2293
|
-
export {
|
|
2251
|
+
export { advanceSessionActivity, observeSessionActivity, backfillSessionActivity, clearCompressionDepth, clearCompressionDepthRange, LkgRecoveryFenceError, clearLkgFenceProcessState, lkgServedArrayDigest, takeLkgRecoveryLockSweepPage, hasCleanLkgRecoveryFence, lkgFenceRequiresRebuild, lkgRecoveryFenceUnclean, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, commitLkgWithRecoveryFence, clearLkgRecoveryFence, cleanSearchText, keywordRelevance, matchedSearchSnippet, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, deleteSessionScopedRows, MESSAGE_INDEX_MAX_FTS_BYTES2, messageIndexSkipKey2, toMessageIndexSource2, getMessageIndexSourceIdentity2, isMessageIndexSourceCurrent2, getLastIndexedOrdinal2, getIndexedMessageCorpusSize2, markMessageIndexDirty2, getMessageIndexReconciliationStartOrdinal2, isMessageIndexReconciledThrough2, deleteIndexedMessage2, clearIndexedMessagesInTransaction2, clearIndexedMessages2, getIndexableContent2, indexSingleMessage2, indexMessagesAfterOrdinal2, indexSourcesAfterOrdinal2, sweepOrphanedOpenCodeMessageIndexesCooperatively2 };
|
|
@@ -98,13 +98,13 @@ import {
|
|
|
98
98
|
getProjectEmbeddingSnapshot2,
|
|
99
99
|
embedTextForProject2,
|
|
100
100
|
embedBatchForProject2
|
|
101
|
-
} from "./index-
|
|
101
|
+
} from "./index-z05n7702.js";
|
|
102
102
|
import {
|
|
103
103
|
createWorkerShutdown
|
|
104
104
|
} from "./index-cpjk5jd2.js";
|
|
105
105
|
import {
|
|
106
106
|
runSessionWarmupWorker
|
|
107
|
-
} from "./index-
|
|
107
|
+
} from "./index-7tdtpqrg.js";
|
|
108
108
|
import {
|
|
109
109
|
getMaxM0MutationId,
|
|
110
110
|
getLastCompartmentEndMessage,
|
|
@@ -140,12 +140,11 @@ import {
|
|
|
140
140
|
peekNoteNudgeText,
|
|
141
141
|
markNoteNudgeDelivered,
|
|
142
142
|
getActiveCompartmentRun
|
|
143
|
-
} from "./index-
|
|
143
|
+
} from "./index-0s8454t2.js";
|
|
144
144
|
import {
|
|
145
|
-
BoundedSessionMap,
|
|
146
145
|
cleanSearchText,
|
|
147
146
|
matchedSearchSnippet
|
|
148
|
-
} from "./index-
|
|
147
|
+
} from "./index-awcftgmx.js";
|
|
149
148
|
import {
|
|
150
149
|
stripSystemInjection,
|
|
151
150
|
isTextPart,
|
|
@@ -243,7 +242,7 @@ import {
|
|
|
243
242
|
extractToolCallObservation,
|
|
244
243
|
ToolMutationBatch,
|
|
245
244
|
createToolDropTarget
|
|
246
|
-
} from "./index-
|
|
245
|
+
} from "./index-yrrsp47d.js";
|
|
247
246
|
import {
|
|
248
247
|
isValidLanguageCode
|
|
249
248
|
} from "./index-nxrsns5x.js";
|
|
@@ -254,10 +253,13 @@ import {
|
|
|
254
253
|
openCodeDbExists,
|
|
255
254
|
withReadOnlySessionDb,
|
|
256
255
|
getMessageTimesFromOpenCodeDb
|
|
257
|
-
} from "./index-
|
|
256
|
+
} from "./index-c9zrgcnt.js";
|
|
257
|
+
import {
|
|
258
|
+
BoundedSessionMap
|
|
259
|
+
} from "./index-cfaet9cg.js";
|
|
258
260
|
import {
|
|
259
261
|
userFacingFailureCode
|
|
260
|
-
} from "./index-
|
|
262
|
+
} from "./index-z928hmnp.js";
|
|
261
263
|
import {
|
|
262
264
|
normalizeProtectedToolName,
|
|
263
265
|
mergeProtectedTools
|
|
@@ -6,18 +6,18 @@ import {
|
|
|
6
6
|
} from "./index-gzy5w8ya.js";
|
|
7
7
|
import {
|
|
8
8
|
runSessionWarmupWorker
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-7tdtpqrg.js";
|
|
10
10
|
import {
|
|
11
11
|
estimateTokens
|
|
12
12
|
} from "./index-b88dwwrh.js";
|
|
13
13
|
import {
|
|
14
14
|
openCodeDbExists,
|
|
15
15
|
withReadOnlySessionDb
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-c9zrgcnt.js";
|
|
17
17
|
import {
|
|
18
18
|
hasRawMessageProvider2,
|
|
19
19
|
readRawSessionMessageIdOrdinalsForRange2
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-yrrsp47d.js";
|
|
21
21
|
|
|
22
22
|
// src/tools/ctx-expand/search-archive.ts
|
|
23
23
|
var archiveReadsOnThisThread = 0;
|