@cortexkit/opencode-magic-context 0.49.29 → 0.49.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-search-worker.js +1 -1
- package/dist/chunk-embedding-write-worker.js +1 -1
- package/dist/{context-836j3vte.js → context-9a0f8mzh.js} +294 -41
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +3 -3
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +13 -17
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/storage-native-replay.d.ts +2 -0
- package/dist/features/magic-context/storage-native-replay.d.ts.map +1 -1
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +11 -1
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +2 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +11 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-wyt5m81v.js → index-0bjktrjt.js} +3 -3
- package/dist/{index-zhgqgxtt.js → index-0fe4q77z.js} +7 -5
- package/dist/{index-wpcdk76y.js → index-22e7khnr.js} +37 -29
- package/dist/{index-a1h316s9.js → index-3jmx3fae.js} +1 -1
- package/dist/{index-tx68g9nc.js → index-4s4zq97n.js} +1 -1
- package/dist/{index-h4s5jk7f.js → index-hbt0sbv2.js} +1 -1
- package/dist/{index-q9zvphbq.js → index-kmayq4kq.js} +39 -7
- package/dist/{index-bps8vn9r.js → index-qathsvz2.js} +5 -3
- package/dist/{index-wvffze8y.js → index-vtz789ex.js} +1 -1
- package/dist/{index-093c4g1c.js → index-y6ynjghv.js} +2 -2
- package/dist/index.js +13 -13
- package/dist/{message-index-bounded-7qsn4fd3.js → message-index-bounded-zq7a5nm6.js} +2 -2
- package/dist/migration-worker.js +1 -1
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{read-session-chunk-a5d0q3m0.js → read-session-chunk-1ndphmb8.js} +1 -1
- package/dist/{recomp-orchestrator-na34m4c5.js → recomp-orchestrator-ynehxbya.js} +5 -5
- package/dist/{search-archive-66pm17gm.js → search-archive-sr07c6aj.js} +2 -2
- package/dist/{search-0cd6hx7a.js → search-fbaz1m8r.js} +3 -3
- package/dist/shared/marker-only-text.d.ts +2 -0
- package/dist/shared/marker-only-text.d.ts.map +1 -0
- package/dist/shared/tag-transcript.d.ts +4 -1
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/transcript.d.ts +3 -1
- package/dist/shared/transcript.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-27we33af.js → transform-postprocess-phase-50h70ft8.js} +5 -5
- package/dist/v2/auto-search-worker.js +1 -1
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-g4ptae4x.js → context-cdqw9jex.js} +320 -58
- package/dist/v2/fold/owner.d.ts +4 -0
- package/dist/v2/fold/owner.d.ts.map +1 -1
- package/dist/v2/hidden-child-cleanup.d.ts.map +1 -1
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/types.d.ts +3 -0
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-7363502m.js → message-index-bounded-jvgz7vk9.js} +2 -2
- package/dist/v2/message-times.d.ts +17 -0
- package/dist/v2/message-times.d.ts.map +1 -0
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{read-session-chunk-kkppfhft.js → read-session-chunk-djzgm4jg.js} +1 -1
- package/dist/v2/{recomp-orchestrator-f1df1gb8.js → recomp-orchestrator-kdxr4tx8.js} +4 -4
- package/dist/v2/{search-archive-v07jpw25.js → search-archive-n3dhns4r.js} +2 -2
- package/dist/v2/{search-2v3xyzse.js → search-q3jjw6zp.js} +3 -3
- package/dist/v2/{server-976dxaxh.js → server-42nebt63.js} +1 -1
- package/dist/v2/{server-77gznpmf.js → server-d01pe8q5.js} +1 -1
- package/dist/v2/{server-k9je35ev.js → server-hwag0khr.js} +1 -1
- package/dist/v2/{server-mxzj3r0y.js → server-rb8m4vry.js} +7 -5
- package/dist/v2/{server-q50ttc2g.js → server-rdjgz95f.js} +39 -7
- package/dist/v2/{server-w79f8ejn.js → server-rr4cbkr0.js} +1 -1
- package/dist/v2/server.js +2 -2
- package/dist/v2/store-reader.d.ts +14 -2
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-jq33fda8.js → wrapup-orchestrator-prfvyqbb.js} +4 -4
- package/dist/{wrapup-orchestrator-f0xr7pft.js → wrapup-orchestrator-4zhkcsz0.js} +6 -6
- package/package.json +1 -1
- package/src/shared/marker-only-text.ts +8 -0
- package/src/shared/tag-transcript.ts +34 -5
- package/src/shared/transcript.ts +1 -1
|
@@ -266,7 +266,7 @@ import {
|
|
|
266
266
|
snapRangeToCompartments,
|
|
267
267
|
getActiveCompartmentRun,
|
|
268
268
|
startCompartmentAgent
|
|
269
|
-
} from "./index-
|
|
269
|
+
} from "./index-kmayq4kq.js";
|
|
270
270
|
import {
|
|
271
271
|
hasTrustedAbsoluteWall,
|
|
272
272
|
applyProvenInputFloor,
|
|
@@ -487,7 +487,7 @@ import {
|
|
|
487
487
|
readRawSessionMessageById2,
|
|
488
488
|
readSessionChunk2,
|
|
489
489
|
readRawSessionSeedTail2
|
|
490
|
-
} from "./index-
|
|
490
|
+
} from "./index-0fe4q77z.js";
|
|
491
491
|
import {
|
|
492
492
|
BoundedSessionMap,
|
|
493
493
|
getMeasuredToolDefinitionTokens
|
|
@@ -505,7 +505,7 @@ import {
|
|
|
505
505
|
runSqliteOptimize,
|
|
506
506
|
openDatabase,
|
|
507
507
|
openCurrentDatabase
|
|
508
|
-
} from "./index-
|
|
508
|
+
} from "./index-hbt0sbv2.js";
|
|
509
509
|
import {
|
|
510
510
|
registerOwnRpcServerInstance,
|
|
511
511
|
rpcPortDir,
|
|
@@ -574,7 +574,7 @@ import {
|
|
|
574
574
|
clearIndexedMessages,
|
|
575
575
|
indexSingleMessage,
|
|
576
576
|
indexMessagesAfterOrdinal
|
|
577
|
-
} from "./index-
|
|
577
|
+
} from "./index-4s4zq97n.js";
|
|
578
578
|
import {
|
|
579
579
|
renderUserFacingFailure,
|
|
580
580
|
userFacingFailureCode,
|
|
@@ -684,7 +684,7 @@ import {
|
|
|
684
684
|
resolveMemoriesByIdsForSearch2,
|
|
685
685
|
unifiedSearch2,
|
|
686
686
|
formatSearchResults2
|
|
687
|
-
} from "./index-
|
|
687
|
+
} from "./index-vtz789ex.js";
|
|
688
688
|
import {
|
|
689
689
|
flushIgnoredMessages2,
|
|
690
690
|
clearIgnoredMessages2,
|
|
@@ -694,7 +694,7 @@ import {
|
|
|
694
694
|
import {
|
|
695
695
|
setRecompStarting2,
|
|
696
696
|
setRecompTerminal2
|
|
697
|
-
} from "./index-
|
|
697
|
+
} from "./index-y6ynjghv.js";
|
|
698
698
|
import {
|
|
699
699
|
makeToolCompositeKey,
|
|
700
700
|
searchMessageHistoryOffThread,
|
|
@@ -757,7 +757,7 @@ import {
|
|
|
757
757
|
abortSessionFailClosed2,
|
|
758
758
|
evaluateEmergencyFailClosed2,
|
|
759
759
|
runPostTransformPhase2
|
|
760
|
-
} from "./index-
|
|
760
|
+
} from "./index-qathsvz2.js";
|
|
761
761
|
import {
|
|
762
762
|
ANNOUNCEMENT_VERSION2,
|
|
763
763
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -770,7 +770,7 @@ import {
|
|
|
770
770
|
} from "./index-fmsr7v69.js";
|
|
771
771
|
import {
|
|
772
772
|
renderSearchArchiveOffThread2
|
|
773
|
-
} from "./index-
|
|
773
|
+
} from "./index-3jmx3fae.js";
|
|
774
774
|
import {
|
|
775
775
|
COMPACTION_ENABLED_PATH,
|
|
776
776
|
isDreamerRunnable,
|
|
@@ -7013,7 +7013,6 @@ function parseMapMemoriesManifest(text) {
|
|
|
7013
7013
|
}
|
|
7014
7014
|
function validateMapMemoriesManifest(text, expectedIds) {
|
|
7015
7015
|
const parsed = parseMapMemoriesManifest(text);
|
|
7016
|
-
assertParsedManifestNonEmpty(parsed.length, expectedIds.size, text, "mappings", "memory");
|
|
7017
7016
|
assertNoDuplicateManifestIds(parsed.filter((entry) => expectedIds.has(entry.id)).map((entry) => entry.id), "mappings");
|
|
7018
7017
|
return parsed;
|
|
7019
7018
|
}
|
|
@@ -9083,8 +9082,7 @@ function parsePartialVerifyManifest(text, expectedIds) {
|
|
|
9083
9082
|
var VERIFY_BATCH_SIZE = 5;
|
|
9084
9083
|
var VERIFY_TOKENS_PER_MEMORY = 1e5;
|
|
9085
9084
|
var VERIFY_RUN_TOKEN_BUDGET = 2500000;
|
|
9086
|
-
var
|
|
9087
|
-
var VERIFY_IN_FLIGHT_GRACE_MS = 120000;
|
|
9085
|
+
var VERIFY_BATCH_DEFAULT_MS = 240000;
|
|
9088
9086
|
function verifyBatchTokenBudget(size, configured) {
|
|
9089
9087
|
return Math.min(configured ?? Number.MAX_SAFE_INTEGER, size * VERIFY_TOKENS_PER_MEMORY);
|
|
9090
9088
|
}
|
|
@@ -9114,8 +9112,8 @@ function validateVerifyCompletion(messages, text, expectedIds, responseText = te
|
|
|
9114
9112
|
}
|
|
9115
9113
|
var IDENTICAL_PROVIDER_FAILURE_BATCH_LIMIT = 2;
|
|
9116
9114
|
var VERIFY_BATCH_FLOOR_MS = 30000;
|
|
9117
|
-
function computeVerifyBatchSliceMs(remainingMs,
|
|
9118
|
-
return Math.min(remainingMs,
|
|
9115
|
+
function computeVerifyBatchSliceMs(remainingMs, batchesRemaining) {
|
|
9116
|
+
return Math.min(remainingMs, Math.max(VERIFY_BATCH_DEFAULT_MS, remainingMs / Math.max(1, batchesRemaining)));
|
|
9119
9117
|
}
|
|
9120
9118
|
function closeBroadCycle(args, cycleStartAt) {
|
|
9121
9119
|
if (!args.forceBroad || cycleStartAt === undefined)
|
|
@@ -9139,7 +9137,6 @@ async function runVerify(args) {
|
|
|
9139
9137
|
}
|
|
9140
9138
|
async function runVerifyWithCooldown(args) {
|
|
9141
9139
|
const runStartedAt = Date.now();
|
|
9142
|
-
const sliceDeadline = runStartedAt + VERIFY_RUN_SLICE_MS;
|
|
9143
9140
|
const result = {
|
|
9144
9141
|
verified: 0,
|
|
9145
9142
|
updated: 0,
|
|
@@ -9187,12 +9184,10 @@ async function runVerifyWithCooldown(args) {
|
|
|
9187
9184
|
try {
|
|
9188
9185
|
for (let i = 0;i < batches.length; i += 1) {
|
|
9189
9186
|
const now = Date.now();
|
|
9190
|
-
const
|
|
9191
|
-
|
|
9192
|
-
const remainingMs = Math.max(0, hardStop - now);
|
|
9193
|
-
if (now >= startCutoff) {
|
|
9187
|
+
const remainingMs = Math.max(0, args.deadline - now);
|
|
9188
|
+
if (now >= args.deadline) {
|
|
9194
9189
|
result.stopReason = "deadline";
|
|
9195
|
-
log2(`[dreamer] ${args.forceBroad ? "verify-broad" : "verify"}: stopping before batch ${i + 1}/${batches.length} — the run deadline passed ${now -
|
|
9190
|
+
log2(`[dreamer] ${args.forceBroad ? "verify-broad" : "verify"}: stopping before batch ${i + 1}/${batches.length} — the run deadline passed ${now - args.deadline}ms ago`);
|
|
9196
9191
|
break;
|
|
9197
9192
|
}
|
|
9198
9193
|
if (remainingMs < VERIFY_BATCH_FLOOR_MS) {
|
|
@@ -10131,7 +10126,7 @@ function createDreamTaskExecutor(deps) {
|
|
|
10131
10126
|
return { status: "failed", transient: true, error };
|
|
10132
10127
|
}
|
|
10133
10128
|
const processed = result.mapped + result.independent;
|
|
10134
|
-
if (processed > 0) {
|
|
10129
|
+
if (processed > 0 || result.failure === undefined) {
|
|
10135
10130
|
const progress = `map-memories: committed ${processed} mapping(s) (mapped ${result.mapped}, independent ${result.independent}); ${result.remaining} remain`;
|
|
10136
10131
|
recordRun("completed", null, { progress });
|
|
10137
10132
|
return { status: "completed" };
|
|
@@ -13274,6 +13269,13 @@ WHERE session_id = ?
|
|
|
13274
13269
|
AND (time_created > ? OR (time_created = ? AND id > ?))
|
|
13275
13270
|
ORDER BY time_created, id`;
|
|
13276
13271
|
var V2_ASSISTANT_USAGE_ROWS_AFTER_SQL = `
|
|
13272
|
+
WITH newer AS (
|
|
13273
|
+
SELECT id, seq, data FROM session_message
|
|
13274
|
+
WHERE session_id = ? AND type = 'assistant' AND data IS NOT NULL AND seq > ?
|
|
13275
|
+
UNION ALL
|
|
13276
|
+
SELECT id, seq, data FROM session_message
|
|
13277
|
+
WHERE session_id = ? AND type = 'assistant' AND data IS NOT NULL AND seq = ? AND id > ?
|
|
13278
|
+
)
|
|
13277
13279
|
SELECT
|
|
13278
13280
|
json_extract(data, '$.agent') AS agent,
|
|
13279
13281
|
seq AS time_created,
|
|
@@ -13282,14 +13284,10 @@ SELECT
|
|
|
13282
13284
|
+ COALESCE(json_extract(data, '$.tokens.cache.read'), 0)
|
|
13283
13285
|
+ COALESCE(json_extract(data, '$.tokens.cache.write'), 0) AS prompt,
|
|
13284
13286
|
COALESCE(json_extract(data, '$.tokens.output'), 0) AS output
|
|
13285
|
-
FROM
|
|
13286
|
-
WHERE session_id = ?
|
|
13287
|
-
AND type = 'assistant'
|
|
13288
|
-
AND data IS NOT NULL
|
|
13289
|
-
AND (seq > ? OR (seq = ? AND id > ?))
|
|
13287
|
+
FROM newer
|
|
13290
13288
|
ORDER BY seq, id`;
|
|
13291
13289
|
function readAssistantUsageRowsAfter(openCodeDb, sessionId, afterTimeCreated, afterId, generation = "v1") {
|
|
13292
|
-
const rows = openCodeDb.prepare(generation === "v2" ? V2_ASSISTANT_USAGE_ROWS_AFTER_SQL : ASSISTANT_USAGE_ROWS_AFTER_SQL).all(sessionId, afterTimeCreated, afterTimeCreated, afterId);
|
|
13290
|
+
const rows = openCodeDb.prepare(generation === "v2" ? V2_ASSISTANT_USAGE_ROWS_AFTER_SQL : ASSISTANT_USAGE_ROWS_AFTER_SQL).all(...generation === "v2" ? [sessionId, afterTimeCreated, sessionId, afterTimeCreated, afterId] : [sessionId, afterTimeCreated, afterTimeCreated, afterId]);
|
|
13293
13291
|
return rows.map((r) => ({
|
|
13294
13292
|
agent: r.agent ?? null,
|
|
13295
13293
|
timeCreated: Number(r.time_created ?? 0),
|
|
@@ -16523,7 +16521,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16523
16521
|
const db = readDatabase();
|
|
16524
16522
|
if (!db)
|
|
16525
16523
|
return { ok: false, error: "db unavailable" };
|
|
16526
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16524
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-ynehxbya.js"));
|
|
16527
16525
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-vz86nt79.js"));
|
|
16528
16526
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16529
16527
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -16608,7 +16606,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16608
16606
|
const db = readDatabase();
|
|
16609
16607
|
if (!db)
|
|
16610
16608
|
return { ok: false, error: "db unavailable" };
|
|
16611
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16609
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-4zhkcsz0.js"));
|
|
16612
16610
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16613
16611
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16614
16612
|
const ctx = {
|
|
@@ -24802,6 +24800,15 @@ function createTransform(deps) {
|
|
|
24802
24800
|
db,
|
|
24803
24801
|
sessionID: sessionId
|
|
24804
24802
|
}) : undefined;
|
|
24803
|
+
const hostEstimate = deps.hostInputEstimate?.(sessionId);
|
|
24804
|
+
const hostOverWindow = fullFeatureMode && !compactionOff && resolvedContextLimit !== undefined && resolvedContextLimit > 0 && hostEstimate !== undefined && Number.isFinite(hostEstimate.tokens) && Number.isFinite(hostEstimate.pressureTokens) && hostEstimate.tokens > resolvedContextLimit;
|
|
24805
|
+
if (hostOverWindow) {
|
|
24806
|
+
contextUsageEarly = {
|
|
24807
|
+
inputTokens: Math.max(contextUsageEarly.inputTokens, hostEstimate.pressureTokens),
|
|
24808
|
+
percentage: Math.max(100, contextUsageEarly.percentage, hostEstimate.pressureTokens / resolvedContextLimit * 100)
|
|
24809
|
+
};
|
|
24810
|
+
usagePercentageSynthetic = true;
|
|
24811
|
+
}
|
|
24805
24812
|
let unmanagedOverWindowPass = null;
|
|
24806
24813
|
const unmanagedOverWindowCarried = unmanagedOverWindowSessions.has(sessionId);
|
|
24807
24814
|
if (fullFeatureMode && !compactionOff && typeof resolvedContextLimit === "number" && resolvedContextLimit > 0 && (unmanagedOverWindowCarried || isFirstTransformPassForSession && getLastCompartmentEndMessage(db, sessionId) < 0 && getMaxDroppedTagNumber2(db, sessionId) === 0)) {
|
|
@@ -25344,7 +25351,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25344
25351
|
bustReason: calibrationBustReason,
|
|
25345
25352
|
onAdopt: (message) => sessionLog2(sessionId, message)
|
|
25346
25353
|
});
|
|
25347
|
-
let contextUsageFromEstimate =
|
|
25354
|
+
let contextUsageFromEstimate = hostOverWindow;
|
|
25348
25355
|
if (contextUsage.inputTokens <= 0 && protectionCacheBustingPass) {
|
|
25349
25356
|
const overflowRecoveryPass = usagePercentageSynthetic || emergencyRecoveryArmed;
|
|
25350
25357
|
const savedProviderReading = overflowRecoveryPass ? null : savedProviderReadingForPass({
|
|
@@ -25898,6 +25905,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25898
25905
|
sessionId,
|
|
25899
25906
|
systemPromptHash: sessionMeta.systemPromptHash
|
|
25900
25907
|
});
|
|
25908
|
+
deps.onPassPermission?.(sessionId, postTransformResult.prefixMutationPermitted);
|
|
25901
25909
|
};
|
|
25902
25910
|
const timedTransform = (input, output) => withTransformTimingSummary(() => transform(input, output));
|
|
25903
25911
|
return Object.assign(timedTransform, {
|
|
@@ -1279,7 +1279,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1279
1279
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1280
1280
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1281
1281
|
return;
|
|
1282
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1282
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-1ndphmb8.js"));
|
|
1283
1283
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-4qva0b4f.js"));
|
|
1284
1284
|
if (signal.aborted)
|
|
1285
1285
|
return;
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
getRawSessionTagKeysThrough2,
|
|
99
99
|
getLegacyProtectedTailStartOrdinal2,
|
|
100
100
|
readSessionChunk2
|
|
101
|
-
} from "./index-
|
|
101
|
+
} from "./index-0fe4q77z.js";
|
|
102
102
|
import {
|
|
103
103
|
getHarness2,
|
|
104
104
|
harnessOwnsOpenCodeStore2
|
|
@@ -174,7 +174,7 @@ import {
|
|
|
174
174
|
LATEST_SUPPORTED_VERSION,
|
|
175
175
|
getPersistedSchemaVersion,
|
|
176
176
|
openDatabase
|
|
177
|
-
} from "./index-
|
|
177
|
+
} from "./index-hbt0sbv2.js";
|
|
178
178
|
import {
|
|
179
179
|
inRootAsyncContext2,
|
|
180
180
|
Database2,
|
|
@@ -254,7 +254,7 @@ import {
|
|
|
254
254
|
toMessageIndexSource,
|
|
255
255
|
clearIndexedMessagesInTransaction,
|
|
256
256
|
indexSourcesAfterOrdinal
|
|
257
|
-
} from "./index-
|
|
257
|
+
} from "./index-4s4zq97n.js";
|
|
258
258
|
import {
|
|
259
259
|
stripWellFormedLeadingTagPrefix,
|
|
260
260
|
stripTagPrefix,
|
|
@@ -5813,9 +5813,10 @@ class V2StoreReaderPool {
|
|
|
5813
5813
|
this.idleWaiters.clear();
|
|
5814
5814
|
}
|
|
5815
5815
|
}
|
|
5816
|
-
function messageTimesQuery(count) {
|
|
5816
|
+
function messageTimesQuery(count, withVersions = false) {
|
|
5817
5817
|
return `SELECT id, COALESCE(time_created, json_extract(data, '$.time.created')) AS created,
|
|
5818
5818
|
json_extract(data, '$.time.completed') AS completed
|
|
5819
|
+
${withVersions ? ", type, seq, time_created AS version_created, time_updated AS version_updated" : ""}
|
|
5819
5820
|
FROM session_message WHERE +session_id = ? AND id IN (${Array.from({ length: count }, () => "?").join(",")})`;
|
|
5820
5821
|
}
|
|
5821
5822
|
|
|
@@ -6040,16 +6041,46 @@ class V2StoreReader {
|
|
|
6040
6041
|
return row ? decode(row) : null;
|
|
6041
6042
|
});
|
|
6042
6043
|
}
|
|
6043
|
-
|
|
6044
|
-
const
|
|
6044
|
+
messageTimeVersions(sessionID, ids, span) {
|
|
6045
|
+
const versions = new Map;
|
|
6046
|
+
if (ids.length > 0 && span && span.last - span.first < ids.length * 2) {
|
|
6047
|
+
const wanted = new Set(ids);
|
|
6048
|
+
const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
|
|
6049
|
+
FROM session_message WHERE session_id = ? AND seq >= ? AND seq <= ?`).all(sessionID, span.first, span.last);
|
|
6050
|
+
for (const row of rows)
|
|
6051
|
+
if (wanted.has(row.id))
|
|
6052
|
+
versions.set(row.id, row);
|
|
6053
|
+
for (const [id, version] of this.messageTimeVersions(sessionID, ids.filter((id) => !versions.has(id))))
|
|
6054
|
+
versions.set(id, version);
|
|
6055
|
+
return versions;
|
|
6056
|
+
}
|
|
6045
6057
|
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
6046
6058
|
const batch = ids.slice(offset, offset + 500);
|
|
6047
|
-
const rows = this.prepare(
|
|
6059
|
+
const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
|
|
6060
|
+
FROM session_message WHERE +session_id = ? AND id IN (${batch.map(() => "?").join(",")})`).all(sessionID, ...batch);
|
|
6048
6061
|
for (const row of rows)
|
|
6062
|
+
versions.set(row.id, row);
|
|
6063
|
+
}
|
|
6064
|
+
return versions;
|
|
6065
|
+
}
|
|
6066
|
+
messageTimes(sessionID, ids, versions) {
|
|
6067
|
+
const times = new Map;
|
|
6068
|
+
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
6069
|
+
const batch = ids.slice(offset, offset + 500);
|
|
6070
|
+
const rows = this.prepare(messageTimesQuery(batch.length, versions !== undefined)).all(sessionID, ...batch);
|
|
6071
|
+
for (const row of rows) {
|
|
6049
6072
|
times.set(row.id, {
|
|
6050
6073
|
created: typeof row.created === "number" ? row.created : undefined,
|
|
6051
6074
|
completed: typeof row.completed === "number" ? row.completed : undefined
|
|
6052
6075
|
});
|
|
6076
|
+
versions?.set(row.id, {
|
|
6077
|
+
id: row.id,
|
|
6078
|
+
type: row.type,
|
|
6079
|
+
seq: row.seq,
|
|
6080
|
+
created: row.version_created,
|
|
6081
|
+
updated: row.version_updated
|
|
6082
|
+
});
|
|
6083
|
+
}
|
|
6053
6084
|
}
|
|
6054
6085
|
return times;
|
|
6055
6086
|
}
|
|
@@ -8841,6 +8872,7 @@ function decodePiContentDecision(value) {
|
|
|
8841
8872
|
// src/features/magic-context/storage-native-replay.ts
|
|
8842
8873
|
var NATIVE_TOOL_INPUTS = "native tool inputs";
|
|
8843
8874
|
var NATIVE_REASONING_IDS = "native reasoning ids";
|
|
8875
|
+
var nativeWriteBarriers = new WeakMap;
|
|
8844
8876
|
function invalidPersistedReplayState(lane, sessionId) {
|
|
8845
8877
|
return new Error(`invalid persisted ${lane} state for session ${sessionId}`);
|
|
8846
8878
|
}
|
|
@@ -140,11 +140,11 @@ import {
|
|
|
140
140
|
peekNoteNudgeText,
|
|
141
141
|
markNoteNudgeDelivered,
|
|
142
142
|
getActiveCompartmentRun
|
|
143
|
-
} from "./index-
|
|
143
|
+
} from "./index-kmayq4kq.js";
|
|
144
144
|
import {
|
|
145
145
|
cleanSearchText,
|
|
146
146
|
matchedSearchSnippet
|
|
147
|
-
} from "./index-
|
|
147
|
+
} from "./index-4s4zq97n.js";
|
|
148
148
|
import {
|
|
149
149
|
stripSystemInjection,
|
|
150
150
|
isTextPart,
|
|
@@ -242,7 +242,7 @@ import {
|
|
|
242
242
|
extractToolCallObservation,
|
|
243
243
|
ToolMutationBatch,
|
|
244
244
|
createToolDropTarget
|
|
245
|
-
} from "./index-
|
|
245
|
+
} from "./index-0fe4q77z.js";
|
|
246
246
|
import {
|
|
247
247
|
isValidLanguageCode
|
|
248
248
|
} from "./index-nxrsns5x.js";
|
|
@@ -3424,6 +3424,7 @@ function prepareLegacyToolSkeletonConversions(db, sessionId, targets, options =
|
|
|
3424
3424
|
});
|
|
3425
3425
|
};
|
|
3426
3426
|
const rows = readRows(db);
|
|
3427
|
+
options.prepareRemovals?.(rows);
|
|
3427
3428
|
const converted = new Map;
|
|
3428
3429
|
for (const row of rows) {
|
|
3429
3430
|
const target = targets.get(row.tagNumber);
|
|
@@ -7568,6 +7569,7 @@ async function runPostTransformPhase2(args) {
|
|
|
7568
7569
|
emergencyReclaimedTokens,
|
|
7569
7570
|
droppedCount,
|
|
7570
7571
|
emergency,
|
|
7572
|
+
prefixMutationPermitted: isCacheBustingPass,
|
|
7571
7573
|
bustedThisPass,
|
|
7572
7574
|
prefixTrimStatus: deliveredPrefix?.prefixTrimStatus ?? null,
|
|
7573
7575
|
thinkingBindingRecovery,
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./index-h7tgn49j.js";
|
|
4
4
|
import {
|
|
5
5
|
clearEmergencyRecovery
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-0fe4q77z.js";
|
|
7
7
|
import {
|
|
8
8
|
requestPendingMaterialization,
|
|
9
9
|
dropSlot,
|
|
10
10
|
executeContextRecomp
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-kmayq4kq.js";
|
|
12
12
|
import {
|
|
13
13
|
renderUserFacingFailure,
|
|
14
14
|
userFacingFailureCode
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
detectOverflow,
|
|
29
29
|
isAnthropicFamilyRoute,
|
|
30
30
|
readRawSessionMessages2
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-0fe4q77z.js";
|
|
32
32
|
import {
|
|
33
33
|
setHarness2
|
|
34
34
|
} from "./index-pavzsdc6.js";
|
|
@@ -99,7 +99,7 @@ import {
|
|
|
99
99
|
checkCompactionMarkerConsistency,
|
|
100
100
|
clearInjectionCache,
|
|
101
101
|
clearNoteNudgeTriggerOnly
|
|
102
|
-
} from "./index-
|
|
102
|
+
} from "./index-kmayq4kq.js";
|
|
103
103
|
import"./index-sd3egckz.js";
|
|
104
104
|
import {
|
|
105
105
|
hasTrustedAbsoluteWall,
|
|
@@ -187,7 +187,7 @@ import {
|
|
|
187
187
|
parameterDescriptionsFor,
|
|
188
188
|
MagicContextRpcServer,
|
|
189
189
|
applyHiddenSubagentTemperature
|
|
190
|
-
} from "./index-
|
|
190
|
+
} from "./index-22e7khnr.js";
|
|
191
191
|
import {
|
|
192
192
|
resolveOpenCodeDbPath,
|
|
193
193
|
openCodeDbPathExists,
|
|
@@ -211,7 +211,7 @@ import {
|
|
|
211
211
|
openDatabaseAsync,
|
|
212
212
|
isDatabasePersisted,
|
|
213
213
|
getDatabasePersistenceError
|
|
214
|
-
} from "./index-
|
|
214
|
+
} from "./index-hbt0sbv2.js";
|
|
215
215
|
import {
|
|
216
216
|
setHomeProjectPermission,
|
|
217
217
|
ProjectIdentityError,
|
|
@@ -254,7 +254,7 @@ import"./index-wfybj1dw.js";
|
|
|
254
254
|
import {
|
|
255
255
|
getDefaultSubcConnectionFile,
|
|
256
256
|
SubcModuleTransport
|
|
257
|
-
} from "./index-
|
|
257
|
+
} from "./index-vtz789ex.js";
|
|
258
258
|
import"./index-qt1qqasc.js";
|
|
259
259
|
import"./index-rrv26qjz.js";
|
|
260
260
|
import {
|
|
@@ -293,7 +293,7 @@ import {
|
|
|
293
293
|
import"./index-mm93m7y6.js";
|
|
294
294
|
import {
|
|
295
295
|
deleteIndexedMessage
|
|
296
|
-
} from "./index-
|
|
296
|
+
} from "./index-4s4zq97n.js";
|
|
297
297
|
import"./index-pe6b4bhs.js";
|
|
298
298
|
import {
|
|
299
299
|
pushNotification2
|
|
@@ -310,10 +310,10 @@ import {
|
|
|
310
310
|
clearToolPermissionDenied,
|
|
311
311
|
collectForeignTextParts,
|
|
312
312
|
resetDegradedCacheCount2
|
|
313
|
-
} from "./index-
|
|
313
|
+
} from "./index-qathsvz2.js";
|
|
314
314
|
import {
|
|
315
315
|
runManagedRecomp2
|
|
316
|
-
} from "./index-
|
|
316
|
+
} from "./index-y6ynjghv.js";
|
|
317
317
|
import {
|
|
318
318
|
isValidSemver,
|
|
319
319
|
compareSemverCore
|
|
@@ -321,9 +321,9 @@ import {
|
|
|
321
321
|
import"./index-fmsr7v69.js";
|
|
322
322
|
import {
|
|
323
323
|
runManagedWrapup2
|
|
324
|
-
} from "./index-
|
|
324
|
+
} from "./index-0bjktrjt.js";
|
|
325
325
|
import"./index-kaqs6h31.js";
|
|
326
|
-
import"./index-
|
|
326
|
+
import"./index-3jmx3fae.js";
|
|
327
327
|
import {
|
|
328
328
|
isDreamerRunnable,
|
|
329
329
|
isSmartNoteSurfaceAvailable,
|
|
@@ -8191,7 +8191,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
8191
8191
|
// package.json
|
|
8192
8192
|
var package_default = {
|
|
8193
8193
|
name: "@cortexkit/opencode-magic-context",
|
|
8194
|
-
version: "0.49.
|
|
8194
|
+
version: "0.49.31",
|
|
8195
8195
|
type: "module",
|
|
8196
8196
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
8197
8197
|
main: "dist/index.js",
|
|
@@ -12045,7 +12045,7 @@ async function setup(context) {
|
|
|
12045
12045
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
12046
12046
|
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.`);
|
|
12047
12047
|
}
|
|
12048
|
-
const { registerContext } = await import("./context-
|
|
12048
|
+
const { registerContext } = await import("./context-9a0f8mzh.js");
|
|
12049
12049
|
setHarness2("opencode2");
|
|
12050
12050
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
12051
12051
|
const duties = await registerContext(context);
|
|
@@ -12518,7 +12518,7 @@ var server = async (ctx) => {
|
|
|
12518
12518
|
rustReplayParticipant: () => magicContextRuntime.magicContext?.getRustReplayParticipant?.() ?? null,
|
|
12519
12519
|
onStorageBusyRefusal: async (sessionId, message) => {
|
|
12520
12520
|
const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-vz86nt79.js"));
|
|
12521
|
-
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-
|
|
12521
|
+
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-50h70ft8.js"));
|
|
12522
12522
|
await sendStatusNotification(ctx.client, sessionId, message, {
|
|
12523
12523
|
toastDurationMs: 15000
|
|
12524
12524
|
});
|
|
@@ -16,7 +16,7 @@ import"./index-cpjk5jd2.js";
|
|
|
16
16
|
import"./index-rverk2vz.js";
|
|
17
17
|
import"./index-58e3y90n.js";
|
|
18
18
|
import"./index-y1qwzvxn.js";
|
|
19
|
-
import"./index-
|
|
19
|
+
import"./index-0fe4q77z.js";
|
|
20
20
|
import"./index-s1n8dd2n.js";
|
|
21
21
|
import {
|
|
22
22
|
MESSAGE_INDEX_MAX_FTS_BYTES,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
markMessageIndexDirty,
|
|
26
26
|
getIndexableContent,
|
|
27
27
|
indexSingleMessage
|
|
28
|
-
} from "./index-
|
|
28
|
+
} from "./index-4s4zq97n.js";
|
|
29
29
|
import"./index-v15ne3a3.js";
|
|
30
30
|
import"./index-t5pck3ss.js";
|
|
31
31
|
|
package/dist/migration-worker.js
CHANGED
|
@@ -51,7 +51,7 @@ async function main() {
|
|
|
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-sr07c6aj.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-b2sd67v4.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -81,7 +81,7 @@ async function main() {
|
|
|
81
81
|
const { setHarness } = await import("./harness-e4avh192.js");
|
|
82
82
|
setHarness(input.harness ?? "opencode");
|
|
83
83
|
const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
|
|
84
|
-
import("./message-index-bounded-
|
|
84
|
+
import("./message-index-bounded-zq7a5nm6.js"),
|
|
85
85
|
import("./sqlite-context-pragmas-mv9jqwjh.js")
|
|
86
86
|
]);
|
|
87
87
|
configureContextDatabasePragmas(db);
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
10
|
+
} from "./index-y6ynjghv.js";
|
|
11
|
+
import"./index-kmayq4kq.js";
|
|
12
12
|
import"./index-qgh1qwjj.js";
|
|
13
13
|
import"./index-pe6b4bhs.js";
|
|
14
|
-
import"./index-
|
|
14
|
+
import"./index-4s4zq97n.js";
|
|
15
15
|
import"./index-sd3egckz.js";
|
|
16
16
|
import"./index-vnn5405n.js";
|
|
17
17
|
import"./index-gxkhzmjq.js";
|
|
@@ -20,7 +20,7 @@ import"./index-4dhv7mqz.js";
|
|
|
20
20
|
import"./index-spwjbkc7.js";
|
|
21
21
|
import"./index-waktfbjy.js";
|
|
22
22
|
import"./index-qt1qqasc.js";
|
|
23
|
-
import"./index-
|
|
23
|
+
import"./index-0fe4q77z.js";
|
|
24
24
|
import"./index-np3rgfw4.js";
|
|
25
25
|
import"./index-1zx87sdm.js";
|
|
26
26
|
import"./index-y1qwzvxn.js";
|
|
@@ -31,7 +31,7 @@ import"./index-nxrsns5x.js";
|
|
|
31
31
|
import"./index-kfyb3k6n.js";
|
|
32
32
|
import"./index-mm93m7y6.js";
|
|
33
33
|
import"./index-wfybj1dw.js";
|
|
34
|
-
import"./index-
|
|
34
|
+
import"./index-hbt0sbv2.js";
|
|
35
35
|
import"./index-fb3zxn06.js";
|
|
36
36
|
import"./index-7kkphb6c.js";
|
|
37
37
|
import"./index-kq5w68dp.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSearchArchive2,
|
|
3
3
|
renderSearchArchiveOffThread2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-3jmx3fae.js";
|
|
5
5
|
import"./index-kaqs6h31.js";
|
|
6
|
-
import"./index-
|
|
6
|
+
import"./index-0fe4q77z.js";
|
|
7
7
|
import"./index-np3rgfw4.js";
|
|
8
8
|
import"./index-1zx87sdm.js";
|
|
9
9
|
import"./index-y1qwzvxn.js";
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
resolveMemoriesByIdsForSearch2,
|
|
6
6
|
unifiedSearch2,
|
|
7
7
|
formatSearchResults2
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-vtz789ex.js";
|
|
9
9
|
import"./index-kaqs6h31.js";
|
|
10
10
|
import"./index-pe6b4bhs.js";
|
|
11
|
-
import"./index-
|
|
11
|
+
import"./index-4s4zq97n.js";
|
|
12
12
|
import"./index-vnn5405n.js";
|
|
13
13
|
import"./index-gxkhzmjq.js";
|
|
14
14
|
import"./index-jjvbk92s.js";
|
|
15
15
|
import"./index-4dhv7mqz.js";
|
|
16
16
|
import"./index-qt1qqasc.js";
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-0fe4q77z.js";
|
|
18
18
|
import"./index-np3rgfw4.js";
|
|
19
19
|
import"./index-1zx87sdm.js";
|
|
20
20
|
import"./index-y1qwzvxn.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-only-text.d.ts","sourceRoot":"","sources":["../../src/shared/marker-only-text.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD"}
|
|
@@ -52,6 +52,8 @@ import { TEXT_TAG_IDENTITY_MARKER } from "./tag-owner-id";
|
|
|
52
52
|
import type { Transcript } from "./transcript";
|
|
53
53
|
export { TEXT_TAG_IDENTITY_MARKER };
|
|
54
54
|
export interface TagTranscriptOptions {
|
|
55
|
+
/** Independently validated text sources; does not authorize tool accounting reuse. */
|
|
56
|
+
reuseTextMessageIds?: ReadonlySet<string>;
|
|
55
57
|
/** Keep tag-only assistant slots inert when their original text must survive stripping. */
|
|
56
58
|
preserveTagOnlyAssistantText?: boolean;
|
|
57
59
|
/**
|
|
@@ -102,12 +104,13 @@ export interface TagTranscriptOptions {
|
|
|
102
104
|
export interface TagTranscriptResult {
|
|
103
105
|
targets: Map<number, TagTarget>;
|
|
104
106
|
}
|
|
107
|
+
type PersistedDropTag = Pick<TagEntry, "tagNumber" | "messageId" | "type" | "toolOwnerMessageId">;
|
|
105
108
|
/**
|
|
106
109
|
* Bind durable drops to a saved request without tagging it again. Recovery must
|
|
107
110
|
* not allocate identities, inject prefixes, or write accounting while the store
|
|
108
111
|
* is failing. Reuse the normal targets so persisted modes render identically.
|
|
109
112
|
*/
|
|
110
|
-
export declare function buildPersistedDropTargets(transcript: Transcript, tags: readonly
|
|
113
|
+
export declare function buildPersistedDropTargets(transcript: Transcript, tags: readonly PersistedDropTag[], options?: {
|
|
111
114
|
allowReasoningPrefixRewrite?: boolean;
|
|
112
115
|
}): Map<number, TagTarget>;
|
|
113
116
|
export declare function tagTranscript(sessionId: string, transcript: Transcript, tagger: Tagger, db: ContextDatabase, options?: TagTranscriptOptions): TagTranscriptResult;
|