@cortexkit/opencode-magic-context 0.49.10 → 0.49.11
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 +3 -3
- package/dist/{conflict-warning-hook-w3crzrar.js → conflict-warning-hook-xwkfncav.js} +3 -3
- package/dist/{context-ey3ap3cc.js → context-twz3s0cg.js} +220 -43
- package/dist/{embedding-backfill-3h2m5n0q.js → embedding-backfill-fjbfh1dt.js} +3 -3
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +12 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/memory-enabled.d.ts +5 -0
- package/dist/features/magic-context/memory-enabled.d.ts.map +1 -0
- package/dist/features/magic-context/search-pool-fixture.d.ts +39 -0
- package/dist/features/magic-context/search-pool-fixture.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +57 -2
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts +12 -2
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +5 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/render-options.d.ts +21 -0
- package/dist/hooks/magic-context/render-options.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +4 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +1 -7
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-pgy3h49n.js → index-0abg88h2.js} +1 -1
- package/dist/{index-0x9cn9w1.js → index-0j6crjgh.js} +2 -2
- package/dist/{index-a43xq1pg.js → index-4ccdr7yw.js} +1 -1
- package/dist/{index-4hb8nt93.js → index-4jkhhpn1.js} +1 -1
- package/dist/{index-ffa8x2as.js → index-84j7jq8a.js} +13 -8
- package/dist/{index-7bjgyaj1.js → index-9159kk15.js} +238 -130
- package/dist/{index-q76br5zn.js → index-bzp9s8z2.js} +24 -19
- package/dist/{index-21919gcq.js → index-g40wgxxt.js} +3 -3
- package/dist/{index-x57ep4fp.js → index-hqnggmxn.js} +215 -75
- package/dist/{index-6k86es2p.js → index-kkvxnbt8.js} +6 -6
- package/dist/{index-nenz4gpb.js → index-q3qck7j2.js} +4 -4
- package/dist/{index-wpwpn7nj.js → index-qr1mkc2y.js} +1 -1
- package/dist/{index-rg1cezmj.js → index-se1w3v2m.js} +1 -1
- package/dist/{index-swgpe402.js → index-xztdf9t7.js} +1 -1
- package/dist/{index-16vwdyy5.js → index-yhrrx7qa.js} +1 -1
- package/dist/{index-3403gbzj.js → index-z7avx6rw.js} +100 -38
- package/dist/index.js +27 -34
- package/dist/{message-index-bounded-fskdyc81.js → message-index-bounded-0rbbg9rd.js} +4 -4
- package/dist/{message-index-6r1x9cqh.js → message-index-ct5x2kwa.js} +4 -4
- package/dist/migration-worker.js +1 -1
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-vy7sv9jt.js → project-embedding-registry-ft9gh2e2.js} +2 -2
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{read-session-chunk-zgpvs423.js → read-session-chunk-y3hhsbzw.js} +2 -2
- package/dist/{recomp-orchestrator-77xc8wpe.js → recomp-orchestrator-67k45s0b.js} +11 -11
- package/dist/{search-72fkjwk2.js → search-jd8xh721.js} +8 -8
- package/dist/{send-session-notification-q8ngbap3.js → send-session-notification-vzhj8bsg.js} +2 -2
- package/dist/shared/prompt-surface-runtime.d.ts +5 -0
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-r8d406j0.js → transform-postprocess-phase-pmqxfq4q.js} +11 -11
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/{context-z2yagwy4.js → context-p1zfcw41.js} +599 -225
- package/dist/v2/{embedding-backfill-vr7wdtrf.js → embedding-backfill-xcw3t6hp.js} +5 -5
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-manual.d.ts +1 -0
- package/dist/v2/hooks/dream-manual.d.ts.map +1 -1
- package/dist/v2/hooks/dream-timer.d.ts +3 -1
- package/dist/v2/hooks/dream-timer.d.ts.map +1 -1
- package/dist/v2/hooks/dream-trigger.d.ts +5 -0
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts +1 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/transform-decision-binding.d.ts +15 -0
- package/dist/v2/hooks/transform-decision-binding.d.ts.map +1 -0
- package/dist/v2/hooks/transform-features.d.ts +39 -0
- package/dist/v2/hooks/transform-features.d.ts.map +1 -0
- package/dist/v2/{message-index-bounded-rqc603f2.js → message-index-bounded-7wcbp975.js} +5 -5
- package/dist/v2/{message-index-9ezq6wze.js → message-index-cjhv92m2.js} +5 -5
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/{project-embedding-registry-ja23aygk.js → project-embedding-registry-g34gcf74.js} +6 -4
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{read-session-chunk-7f87tg2q.js → read-session-chunk-8d3v87vr.js} +3 -3
- package/dist/v2/{recomp-orchestrator-s5tdpsbs.js → recomp-orchestrator-n0pq36f0.js} +13 -13
- package/dist/v2/{search-2td1b1wy.js → search-a1acjwf8.js} +10 -10
- package/dist/v2/{send-session-notification-6n7chhyp.js → send-session-notification-z5mcjdea.js} +2 -2
- package/dist/v2/{server-4qr18rfg.js → server-5x7kmyz8.js} +1 -1
- package/dist/v2/{server-c9w52qss.js → server-7fvmt15t.js} +109 -38
- package/dist/v2/{server-44ryn9rb.js → server-83d71zab.js} +1 -1
- package/dist/v2/{server-z0rjemg1.js → server-d3f4g62c.js} +2 -2
- package/dist/v2/{server-zrwaj29a.js → server-d6t16r89.js} +24 -19
- package/dist/v2/{server-23znwjqk.js → server-erfp0xb6.js} +5 -2
- package/dist/v2/{server-9a6bwc12.js → server-ewqshbs8.js} +251 -131
- package/dist/v2/{server-ak7w74j9.js → server-h3wc20sv.js} +1 -1
- package/dist/v2/{server-7e087rvk.js → server-jc8v585p.js} +1 -1
- package/dist/v2/{server-4zwx20yg.js → server-kn7skz9r.js} +1 -1
- package/dist/v2/{server-2hxypdx5.js → server-pbpp8r8h.js} +13 -8
- package/dist/v2/{server-4rs8sm06.js → server-rxcq4t50.js} +3 -3
- package/dist/v2/{server-4easnf78.js → server-sg68np13.js} +13 -4
- package/dist/v2/{server-gc8x2xdb.js → server-wkhfyzpg.js} +2 -2
- package/dist/v2/server.js +4 -4
- package/dist/v2/store-reader.d.ts +4 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-wg8dmmm9.js → wrapup-orchestrator-87q9d5e2.js} +13 -13
- package/dist/{wrapup-orchestrator-b1z99yg5.js → wrapup-orchestrator-jqapepw0.js} +12 -12
- package/package.json +1 -1
- package/src/shared/chunk-vector-writer-guard.test.ts +72 -0
- package/src/shared/prompt-surface-runtime.test.ts +15 -0
- package/src/shared/prompt-surface-runtime.ts +12 -0
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
cortexKitProjectConfigBasePath,
|
|
18
18
|
resolveLegacyConfigSourcesForHarness,
|
|
19
19
|
loadPluginConfigDetailed
|
|
20
|
-
} from "./server-
|
|
20
|
+
} from "./server-5x7kmyz8.js";
|
|
21
21
|
import {
|
|
22
22
|
catalogOutputReserve,
|
|
23
23
|
getSdkContextLimit,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
resolvePromptSurface,
|
|
31
31
|
DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
32
32
|
LIVE_RELOAD_CONFIG_PATHS
|
|
33
|
-
} from "./server-
|
|
33
|
+
} from "./server-jc8v585p.js";
|
|
34
34
|
import {
|
|
35
35
|
hasMeaningfulUserText2,
|
|
36
36
|
estimateTokens,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
replaceCompartmentChunkEmbeddings,
|
|
53
53
|
deleteChunkEmbedBackoffForSession,
|
|
54
54
|
chunkWindowSourceKey
|
|
55
|
-
} from "./server-
|
|
55
|
+
} from "./server-ewqshbs8.js";
|
|
56
56
|
import {
|
|
57
57
|
isPidAlive
|
|
58
58
|
} from "./server-cxsr0ng6.js";
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
toMessageIndexSource2,
|
|
71
71
|
clearIndexedMessagesInTransaction2,
|
|
72
72
|
indexSourcesAfterOrdinal2
|
|
73
|
-
} from "./server-
|
|
73
|
+
} from "./server-d3f4g62c.js";
|
|
74
74
|
import {
|
|
75
75
|
detectOverflow,
|
|
76
76
|
SESSION_META_SELECT_COLUMNS,
|
|
@@ -163,7 +163,7 @@ import {
|
|
|
163
163
|
getRawSessionTagKeysThrough2,
|
|
164
164
|
getLegacyProtectedTailStartOrdinal2,
|
|
165
165
|
readSessionChunk2
|
|
166
|
-
} from "./server-
|
|
166
|
+
} from "./server-wkhfyzpg.js";
|
|
167
167
|
import {
|
|
168
168
|
getTableColumnNames
|
|
169
169
|
} from "./server-89fcbe37.js";
|
|
@@ -173,7 +173,7 @@ import {
|
|
|
173
173
|
LATEST_SUPPORTED_VERSION,
|
|
174
174
|
getPersistedSchemaVersion,
|
|
175
175
|
openDatabase
|
|
176
|
-
} from "./server-
|
|
176
|
+
} from "./server-erfp0xb6.js";
|
|
177
177
|
import {
|
|
178
178
|
providerMass,
|
|
179
179
|
calibrationForModelKey,
|
|
@@ -205,7 +205,7 @@ import {
|
|
|
205
205
|
import {
|
|
206
206
|
withReadOnlySessionDb,
|
|
207
207
|
getMessageTimesFromOpenCodeDb
|
|
208
|
-
} from "./server-
|
|
208
|
+
} from "./server-d6t16r89.js";
|
|
209
209
|
import {
|
|
210
210
|
getMeasuredToolDefinitionTokens
|
|
211
211
|
} from "./server-xqf2d2mg.js";
|
|
@@ -236,7 +236,7 @@ import {
|
|
|
236
236
|
getProjectChunkEmbeddingModelId2,
|
|
237
237
|
getProjectEmbeddingMaxInputTokens2,
|
|
238
238
|
embedItemsForProject2
|
|
239
|
-
} from "./server-
|
|
239
|
+
} from "./server-sg68np13.js";
|
|
240
240
|
import {
|
|
241
241
|
getSessionNotes,
|
|
242
242
|
getReadySmartNotes,
|
|
@@ -245,7 +245,7 @@ import {
|
|
|
245
245
|
userFacingFailureCode,
|
|
246
246
|
promoteSessionFactsDurable,
|
|
247
247
|
embedPromotedFacts
|
|
248
|
-
} from "./server-
|
|
248
|
+
} from "./server-kn7skz9r.js";
|
|
249
249
|
import {
|
|
250
250
|
isMarkerCandidateBasisCurrent2,
|
|
251
251
|
invalidateMarkerCandidateBasis2,
|
|
@@ -270,7 +270,7 @@ import {
|
|
|
270
270
|
} from "./server-hn9fb3v0.js";
|
|
271
271
|
import {
|
|
272
272
|
sendStatusNotification2
|
|
273
|
-
} from "./server-
|
|
273
|
+
} from "./server-h3wc20sv.js";
|
|
274
274
|
import {
|
|
275
275
|
sameProjectDirectory
|
|
276
276
|
} from "./server-knvkbfvh.js";
|
|
@@ -541,6 +541,15 @@ function getEmbedDrainUiStatus(sessionId, progress) {
|
|
|
541
541
|
}
|
|
542
542
|
return { status: "idle" };
|
|
543
543
|
}
|
|
544
|
+
function clearEmbedSessionState(sessionId) {
|
|
545
|
+
embedPauseBySession.delete(sessionId);
|
|
546
|
+
const ctrl = embedRunStateBySession.get(sessionId);
|
|
547
|
+
if (ctrl) {
|
|
548
|
+
ctrl.abort();
|
|
549
|
+
embedRunStateBySession.delete(sessionId);
|
|
550
|
+
}
|
|
551
|
+
invalidateAutoEmbedSession(sessionId);
|
|
552
|
+
}
|
|
544
553
|
|
|
545
554
|
// src/features/magic-context/compartment-lease.ts
|
|
546
555
|
var COMPARTMENT_LEASE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -1496,6 +1505,21 @@ class V2StoreReader {
|
|
|
1496
1505
|
return row ? decode(row) : null;
|
|
1497
1506
|
});
|
|
1498
1507
|
}
|
|
1508
|
+
messageTimes(sessionID, ids) {
|
|
1509
|
+
const times = new Map;
|
|
1510
|
+
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
1511
|
+
const batch = ids.slice(offset, offset + 500);
|
|
1512
|
+
const rows = this.prepare(`SELECT id, COALESCE(time_created, json_extract(data, '$.time.created')) AS created,
|
|
1513
|
+
json_extract(data, '$.time.completed') AS completed
|
|
1514
|
+
FROM session_message WHERE session_id = ? AND id IN (${batch.map(() => "?").join(",")})`).all(sessionID, ...batch);
|
|
1515
|
+
for (const row of rows)
|
|
1516
|
+
times.set(row.id, {
|
|
1517
|
+
created: typeof row.created === "number" ? row.created : undefined,
|
|
1518
|
+
completed: typeof row.completed === "number" ? row.completed : undefined
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
return times;
|
|
1522
|
+
}
|
|
1499
1523
|
messageExistsById(sessionID, id) {
|
|
1500
1524
|
return trackDecodeOperation("messageExistsById", () => {
|
|
1501
1525
|
const rawTypes = RAW_MESSAGE_TYPES.map(() => "?").join(", ");
|
|
@@ -7883,6 +7907,7 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
7883
7907
|
}
|
|
7884
7908
|
}
|
|
7885
7909
|
// src/shared/prompt-surface-runtime.ts
|
|
7910
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
7886
7911
|
import { existsSync as existsSync2, readFileSync as readFileSync3, statSync as statSync5 } from "node:fs";
|
|
7887
7912
|
import { dirname, isAbsolute, resolve as resolve2 } from "node:path";
|
|
7888
7913
|
|
|
@@ -7914,6 +7939,9 @@ function promptSurfaceHashMaterial(systemContent, preset = "full") {
|
|
|
7914
7939
|
return preset === "full" ? systemContent : `${systemContent}
|
|
7915
7940
|
\x00magic-context-prompt-surface:${preset}`;
|
|
7916
7941
|
}
|
|
7942
|
+
function systemPromptFingerprint(systemContent, preset = "full") {
|
|
7943
|
+
return createHash10("md5").update(promptSurfaceHashMaterial(systemContent, preset)).digest("hex");
|
|
7944
|
+
}
|
|
7917
7945
|
var PROMPT_SURFACE_TOOL_ID_SET = new Set(ACTIVE_TOOL_IDS);
|
|
7918
7946
|
function resolveUserConfigDirectory(options) {
|
|
7919
7947
|
if (options.userConfigDirectory)
|
|
@@ -8271,6 +8299,14 @@ function reconcileForkOrphanedCompactionMarkers(db, sessionId) {
|
|
|
8271
8299
|
}
|
|
8272
8300
|
}
|
|
8273
8301
|
|
|
8302
|
+
// src/features/magic-context/memory-enabled.ts
|
|
8303
|
+
function isProjectMemoryEnabled(enabled) {
|
|
8304
|
+
return enabled !== false;
|
|
8305
|
+
}
|
|
8306
|
+
function readEnabledProjectMemories(enabled, read) {
|
|
8307
|
+
return isProjectMemoryEnabled(enabled) ? read() : [];
|
|
8308
|
+
}
|
|
8309
|
+
|
|
8274
8310
|
// src/hooks/magic-context/historian-prompt.generated.ts
|
|
8275
8311
|
var COMPARTMENT_AGENT_SYSTEM_PROMPT = `# Historian
|
|
8276
8312
|
|
|
@@ -9115,8 +9151,7 @@ function buildCompartmentAgentPrompt(inputs) {
|
|
|
9115
9151
|
parts.push(inputs.seedExamples);
|
|
9116
9152
|
if (inputs.sessionReferences)
|
|
9117
9153
|
parts.push(inputs.sessionReferences);
|
|
9118
|
-
|
|
9119
|
-
parts.push(inputs.projectMemory);
|
|
9154
|
+
parts.push(...readEnabledProjectMemories(inputs.memoryEnabled, () => inputs.projectMemory ? [inputs.projectMemory] : []));
|
|
9120
9155
|
if (inputs.extractionFree) {
|
|
9121
9156
|
parts.push(`<extraction>disabled</extraction>
|
|
9122
9157
|
Structural recomp mode: emit compartments and <meta> only. Do NOT emit <facts>, <events>, <user_observations>, or <primer_candidates>.`);
|
|
@@ -9793,7 +9828,7 @@ function compareMemorySelectionPriority(left, right) {
|
|
|
9793
9828
|
}
|
|
9794
9829
|
|
|
9795
9830
|
// src/features/magic-context/mural/render-trigger.ts
|
|
9796
|
-
import { createHash as
|
|
9831
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
9797
9832
|
|
|
9798
9833
|
// src/features/magic-context/mural/mural-selection.ts
|
|
9799
9834
|
var DEFAULT_MURAL_MEMORY_BUDGET = 8000;
|
|
@@ -10497,7 +10532,7 @@ function ensureMuralRendered(db, projectIdentity, budgetTokens = DEFAULT_MURAL_M
|
|
|
10497
10532
|
return { ...cached.result };
|
|
10498
10533
|
}
|
|
10499
10534
|
const plan = planMuralRender(entries);
|
|
10500
|
-
const textHash =
|
|
10535
|
+
const textHash = createHash11("sha256").update(plan.layout.text).digest("hex");
|
|
10501
10536
|
if (existing && existing.contentHash === textHash && existing.width === plan.width && existing.height === plan.height) {
|
|
10502
10537
|
return rememberRender(db, projectIdentity, key, existing.image, {
|
|
10503
10538
|
hasMural: true,
|
|
@@ -13407,7 +13442,7 @@ ${HISTORIAN_TRUNCATION_MARKER}
|
|
|
13407
13442
|
function fitAtomicHistorianSourceToProducerWindow(args) {
|
|
13408
13443
|
const producerInputLimitTokens = producerInputTokenLimit(args.contextLimitTokens, args.maxOutputTokens, args.inputLimitTokens);
|
|
13409
13444
|
const originalTokens = estimateTokens(args.text);
|
|
13410
|
-
const target = producerInputLimitTokens === undefined ?
|
|
13445
|
+
const target = producerInputLimitTokens === undefined ? args.maxSourceTokens : Math.min(producerInputLimitTokens, args.maxSourceTokens ?? Infinity);
|
|
13411
13446
|
if (target === undefined || originalTokens < target || target <= 0) {
|
|
13412
13447
|
return { text: args.text, producerInputLimitTokens, removedTokens: 0 };
|
|
13413
13448
|
}
|
|
@@ -15307,7 +15342,7 @@ function fitHistorianPrompt(args) {
|
|
|
15307
15342
|
const requested = Math.max(0, Math.floor(args.requestedChunkTokens));
|
|
15308
15343
|
const seeds = selectSeeds(args.sessionId, args.chunkStart);
|
|
15309
15344
|
const references = selectSessionReferences(args.sessionCompartments, seeds, args.sessionId, args.chunkStart);
|
|
15310
|
-
const memories = orderHistorianMemories(args.memories);
|
|
15345
|
+
const memories = orderHistorianMemories(readEnabledProjectMemories(args.memoryEnabled, () => typeof args.memories === "function" ? args.memories() : args.memories));
|
|
15311
15346
|
const render = (refs, memoryCount, seedCount) => ({
|
|
15312
15347
|
seedExamples: renderSeedExamplesBlock(seeds.slice(0, seedCount)),
|
|
15313
15348
|
sessionReferences: renderSessionReferencesBlock(references, refs),
|
|
@@ -15320,26 +15355,38 @@ function fitHistorianPrompt(args) {
|
|
|
15320
15355
|
seeds: seedCount,
|
|
15321
15356
|
seedsTotal: seeds.length
|
|
15322
15357
|
});
|
|
15323
|
-
|
|
15324
|
-
|
|
15358
|
+
let systemLocal;
|
|
15359
|
+
const fitLimitFor = (window) => {
|
|
15360
|
+
const limit = producerInputTokenLimit(window.contextLimitTokens, window.maxOutputTokens, window.inputLimitTokens);
|
|
15361
|
+
if (limit === undefined)
|
|
15362
|
+
return;
|
|
15363
|
+
const calibration = calibrationForModelKey(window.modelKey);
|
|
15364
|
+
systemLocal ??= estimateFixedPromptTokens(args.systemPrompt);
|
|
15365
|
+
const system = systemLocal;
|
|
15325
15366
|
return {
|
|
15326
|
-
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
...render(references.length, memories.length, seeds.length),
|
|
15330
|
-
trimmed: false,
|
|
15331
|
-
kept: kept(references.length, memories.length, seeds.length)
|
|
15367
|
+
modelKey: window.modelKey,
|
|
15368
|
+
limit,
|
|
15369
|
+
mass: (proseLocal) => providerMass({ prose: proseLocal, system }, calibration, true)
|
|
15332
15370
|
};
|
|
15333
|
-
}
|
|
15334
|
-
const
|
|
15335
|
-
|
|
15336
|
-
const mass = (proseLocal) => providerMass({ prose: proseLocal, system: systemLocal }, calibration, true);
|
|
15337
|
-
if (!Number.isFinite(mass(0)) || mass(0) <= 0) {
|
|
15371
|
+
};
|
|
15372
|
+
const primary = fitLimitFor(args.window);
|
|
15373
|
+
if (primary && (!Number.isFinite(primary.mass(0)) || primary.mass(0) <= 0)) {
|
|
15338
15374
|
return {
|
|
15339
15375
|
ok: false,
|
|
15340
15376
|
reason: `producer_prompt_fit_unavailable model=${args.window.modelKey ?? "unknown"}`
|
|
15341
15377
|
};
|
|
15342
15378
|
}
|
|
15379
|
+
const fallbackLimits = (args.fallbackWindows ?? []).map(fitLimitFor).filter((entry) => entry !== undefined && Number.isFinite(entry.mass(0)) && entry.mass(0) > 0);
|
|
15380
|
+
const unguarded = () => ({
|
|
15381
|
+
ok: true,
|
|
15382
|
+
guarded: false,
|
|
15383
|
+
chunkTokens: requested,
|
|
15384
|
+
...render(references.length, memories.length, seeds.length),
|
|
15385
|
+
trimmed: false,
|
|
15386
|
+
kept: kept(references.length, memories.length, seeds.length)
|
|
15387
|
+
});
|
|
15388
|
+
if (!primary && fallbackLimits.length === 0)
|
|
15389
|
+
return unguarded();
|
|
15343
15390
|
const chunkHeader = `Messages ${args.chunkStart}-${args.lastOrdinal}:
|
|
15344
15391
|
|
|
15345
15392
|
`;
|
|
@@ -15358,8 +15405,7 @@ function fitHistorianPrompt(args) {
|
|
|
15358
15405
|
}
|
|
15359
15406
|
return tokens;
|
|
15360
15407
|
};
|
|
15361
|
-
const
|
|
15362
|
-
const fixed = fixedLocal(blocks);
|
|
15408
|
+
const roomUnder = ({ mass, limit }, fixed) => {
|
|
15363
15409
|
if (mass(fixed) > limit)
|
|
15364
15410
|
return -1;
|
|
15365
15411
|
let lo = 0;
|
|
@@ -15375,8 +15421,29 @@ function fitHistorianPrompt(args) {
|
|
|
15375
15421
|
else
|
|
15376
15422
|
hi = mid;
|
|
15377
15423
|
}
|
|
15378
|
-
return
|
|
15424
|
+
return lo;
|
|
15425
|
+
};
|
|
15426
|
+
const roomAmong = (limits, blocks) => {
|
|
15427
|
+
const fixed = fixedLocal(blocks);
|
|
15428
|
+
let room = Infinity;
|
|
15429
|
+
for (const entry of limits) {
|
|
15430
|
+
const one = roomUnder(entry, fixed);
|
|
15431
|
+
if (one < 0)
|
|
15432
|
+
return -1;
|
|
15433
|
+
room = Math.min(room, one);
|
|
15434
|
+
}
|
|
15435
|
+
return Math.max(0, room - FIT_SLACK_TOKENS);
|
|
15379
15436
|
};
|
|
15437
|
+
const floor = Math.min(requested, HISTORIAN_MIN_FIT_CHUNK_TOKENS);
|
|
15438
|
+
const sizedFor = primary ? [primary] : [];
|
|
15439
|
+
for (const entry of fallbackLimits) {
|
|
15440
|
+
const alone = roomAmong([entry], render(0, 0, 0));
|
|
15441
|
+
if (alone >= floor && alone > 0)
|
|
15442
|
+
sizedFor.push(entry);
|
|
15443
|
+
}
|
|
15444
|
+
if (sizedFor.length === 0)
|
|
15445
|
+
return unguarded();
|
|
15446
|
+
const roomFor = (blocks) => roomAmong(sizedFor, blocks);
|
|
15380
15447
|
const accept = (refs, memoryCount, seedCount, chunkTokens) => ({
|
|
15381
15448
|
ok: true,
|
|
15382
15449
|
guarded: true,
|
|
@@ -15408,16 +15475,16 @@ function fitHistorianPrompt(args) {
|
|
|
15408
15475
|
return accept(0, 0, seedCount, requested);
|
|
15409
15476
|
}
|
|
15410
15477
|
}
|
|
15411
|
-
const floor = Math.min(requested, HISTORIAN_MIN_FIT_CHUNK_TOKENS);
|
|
15412
15478
|
const room = roomFor(render(0, 0, 0));
|
|
15413
15479
|
if (room >= floor && room > 0)
|
|
15414
15480
|
return accept(0, 0, 0, Math.min(requested, room));
|
|
15415
|
-
const
|
|
15481
|
+
const refused = sizedFor[0];
|
|
15482
|
+
const fixedTokens = refused.mass(fixedLocal(render(0, 0, 0), `Messages 1-1:
|
|
15416
15483
|
|
|
15417
15484
|
`));
|
|
15418
15485
|
return {
|
|
15419
15486
|
ok: false,
|
|
15420
|
-
reason: `producer_prompt_unfit model=${
|
|
15487
|
+
reason: `producer_prompt_unfit model=${refused.modelKey ?? "unknown"} limit=${refused.limit} fixed_tokens=${fixedTokens} min_chunk_tokens=${floor}`
|
|
15421
15488
|
};
|
|
15422
15489
|
}
|
|
15423
15490
|
|
|
@@ -17333,16 +17400,20 @@ async function runCompartmentAgent(deps) {
|
|
|
17333
17400
|
const producerLimits = { input: producerWindow.inputLimitTokens };
|
|
17334
17401
|
const producerReserve = producerWindow.maxOutputTokens;
|
|
17335
17402
|
const projectPath = resolveProjectIdentity(directory ?? process.cwd());
|
|
17336
|
-
const
|
|
17403
|
+
const fallbackWindows = [
|
|
17404
|
+
...(deps.fallbackModels ?? []).map((entry) => toModelEntry(entry)?.model),
|
|
17405
|
+
deps.fallbackModelId
|
|
17406
|
+
].filter((key) => typeof key === "string" && key !== producerModel).map((key) => resolveHistorianProducerWindow(key, deps.historianMaxOutputTokens));
|
|
17337
17407
|
const promptFit = fitHistorianPrompt({
|
|
17338
17408
|
window: producerWindow,
|
|
17409
|
+
fallbackWindows,
|
|
17339
17410
|
systemPrompt: withContentLanguageDirective(COMPARTMENT_AGENT_SYSTEM_PROMPT, deps.language),
|
|
17340
17411
|
requestedChunkTokens: historianChunkTokens,
|
|
17341
17412
|
sessionId,
|
|
17342
17413
|
chunkStart: Math.max(1, offset),
|
|
17343
17414
|
lastOrdinal: eligibleEndOrdinal - 1,
|
|
17344
17415
|
sessionCompartments: priorCompartments,
|
|
17345
|
-
memories,
|
|
17416
|
+
memories: () => getMemoriesByProject2(db, projectPath, ["active", "permanent"]),
|
|
17346
17417
|
memoryEnabled: deps.memoryEnabled !== false
|
|
17347
17418
|
});
|
|
17348
17419
|
if (!promptFit.ok) {
|
|
@@ -18885,4 +18956,4 @@ ${failure}`;
|
|
|
18885
18956
|
}
|
|
18886
18957
|
}
|
|
18887
18958
|
|
|
18888
|
-
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, embedPauseBySession, embedRunStateBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS,
|
|
18959
|
+
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, embedPauseBySession, embedRunStateBySession, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, clearEmbedSessionState, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, isProjectMemoryEnabled, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./server-89fcbe37.js";
|
|
24
24
|
import {
|
|
25
25
|
cleanUserText2
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-wkhfyzpg.js";
|
|
27
27
|
import {
|
|
28
28
|
recordMessageFtsRowid,
|
|
29
29
|
recordIndexedMessageTime,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./server-cxsr0ng6.js";
|
|
37
37
|
import {
|
|
38
38
|
deleteChunkEmbedBackoffForSession
|
|
39
|
-
} from "./server-
|
|
39
|
+
} from "./server-ewqshbs8.js";
|
|
40
40
|
import {
|
|
41
41
|
ensurePrivateStorageDirectorySync,
|
|
42
42
|
writeStorageFileSync,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getHarness2,
|
|
2
3
|
harnessOwnsOpenCodeStore2
|
|
3
4
|
} from "./server-pavzsdc6.js";
|
|
4
5
|
import {
|
|
@@ -23,20 +24,24 @@ import {
|
|
|
23
24
|
function openCodeDbExists() {
|
|
24
25
|
return harnessOwnsOpenCodeStore2() && openCodeDbPathExists(resolveOpenCodeDbPath());
|
|
25
26
|
}
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var cachedReadOnlyDbs = {
|
|
28
|
+
v1: null,
|
|
29
|
+
v2: null
|
|
30
|
+
};
|
|
31
|
+
function closeCachedReadOnlyDb(generation) {
|
|
32
|
+
const cached = cachedReadOnlyDbs[generation];
|
|
33
|
+
if (!cached) {
|
|
29
34
|
return;
|
|
30
35
|
}
|
|
31
36
|
try {
|
|
32
|
-
closeQuietly(
|
|
37
|
+
closeQuietly(cached.db);
|
|
33
38
|
} catch (error) {
|
|
34
39
|
log2("[magic-context] failed to close cached OpenCode read-only DB:", error);
|
|
35
40
|
} finally {
|
|
36
|
-
|
|
41
|
+
cachedReadOnlyDbs[generation] = null;
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
|
-
function getReadOnlySessionDb() {
|
|
44
|
+
function getReadOnlySessionDb(generation = "v1") {
|
|
40
45
|
if (!harnessOwnsOpenCodeStore2()) {
|
|
41
46
|
throw new Error("OpenCode session database is not readable from a Pi-compatible process; its history lives in Pi sessions");
|
|
42
47
|
}
|
|
@@ -45,18 +50,19 @@ function getReadOnlySessionDb() {
|
|
|
45
50
|
if (!openCodeDbPathExists(resolution)) {
|
|
46
51
|
throw new Error(`OpenCode session database is unavailable at ${dbPath} (source=${resolution.source})`);
|
|
47
52
|
}
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
const cached = cachedReadOnlyDbs[generation];
|
|
54
|
+
if (cached?.path === dbPath) {
|
|
55
|
+
return cached.db;
|
|
50
56
|
}
|
|
51
|
-
closeCachedReadOnlyDb();
|
|
57
|
+
closeCachedReadOnlyDb(generation);
|
|
52
58
|
const db = new Database2(dbPath, { readonly: true });
|
|
53
59
|
try {
|
|
54
|
-
assertOpenCodeStoreGeneration(db,
|
|
60
|
+
assertOpenCodeStoreGeneration(db, generation, dbPath);
|
|
55
61
|
} catch (error) {
|
|
56
62
|
closeQuietly(db);
|
|
57
63
|
throw error;
|
|
58
64
|
}
|
|
59
|
-
|
|
65
|
+
cachedReadOnlyDbs[generation] = { path: dbPath, db };
|
|
60
66
|
clearOpenCodeDbReadFailure();
|
|
61
67
|
return db;
|
|
62
68
|
}
|
|
@@ -317,15 +323,14 @@ function getMessageTimesFromOpenCodeDb(sessionId, messageIds) {
|
|
|
317
323
|
if (messageIds.length === 0 || !harnessOwnsOpenCodeStore2())
|
|
318
324
|
return result;
|
|
319
325
|
try {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
326
|
+
const placeholders = messageIds.map(() => "?").join(",");
|
|
327
|
+
const rows = getHarness2() === "opencode2" ? getReadOnlySessionDb("v2").prepare(`SELECT id, COALESCE(time_created, json_extract(data, '$.time.created')) AS time_created
|
|
328
|
+
FROM session_message WHERE +session_id = ? AND id IN (${placeholders})`).all(sessionId, ...messageIds) : withReadOnlySessionDb((db) => db.prepare(`SELECT id, time_created FROM message WHERE +session_id = ? AND id IN (${placeholders})`).all(sessionId, ...messageIds));
|
|
329
|
+
for (const row of rows) {
|
|
330
|
+
if (typeof row.id === "string" && typeof row.time_created === "number") {
|
|
331
|
+
result.set(row.id, row.time_created);
|
|
327
332
|
}
|
|
328
|
-
}
|
|
333
|
+
}
|
|
329
334
|
} catch (error) {
|
|
330
335
|
logProbeFailureOnce(resolveOpenCodeDbPath(), error);
|
|
331
336
|
}
|
|
@@ -809,6 +809,9 @@ function isFileBackedPath(dbPath) {
|
|
|
809
809
|
const trimmed = dbPath.trim();
|
|
810
810
|
return trimmed !== "" && trimmed !== ":memory:" && !trimmed.startsWith("file:");
|
|
811
811
|
}
|
|
812
|
+
function getDatabasePath(db) {
|
|
813
|
+
return pathByDatabase.get(db) ?? null;
|
|
814
|
+
}
|
|
812
815
|
function migrateLegacyStorageIfNeeded(targetDbPath, targetDbDir) {
|
|
813
816
|
if (existsSync2(targetDbPath))
|
|
814
817
|
return;
|
|
@@ -1209,7 +1212,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1209
1212
|
startMessageFtsRowidMapBackfill(db).then(async () => {
|
|
1210
1213
|
if (!readsOpenCodeStore)
|
|
1211
1214
|
return;
|
|
1212
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1215
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-8d3v87vr.js"));
|
|
1213
1216
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-rz1pnpaj.js"));
|
|
1214
1217
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
1215
1218
|
readPage: readRawSessionMessagePage
|
|
@@ -2701,4 +2704,4 @@ function getDatabasePersistenceError(db) {
|
|
|
2701
2704
|
return persistenceErrorByDatabase.get(db) ?? null;
|
|
2702
2705
|
}
|
|
2703
2706
|
|
|
2704
|
-
export { FAIL_CLOSED_DOCTOR_COMMAND, formatFailClosedBlockingMessage, formatFailClosedBlockingSummary, createFailClosedBlockingError, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, startBootDeadline, getUnconfirmedMigrationHolders, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, BOOT_SQLITE_BUSY_TIMEOUT_MS, getPersistedSchemaVersion, setSqlitePragmaConfig, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError };
|
|
2707
|
+
export { FAIL_CLOSED_DOCTOR_COMMAND, formatFailClosedBlockingMessage, formatFailClosedBlockingSummary, createFailClosedBlockingError, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, startBootDeadline, getUnconfirmedMigrationHolders, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, BOOT_SQLITE_BUSY_TIMEOUT_MS, getDatabasePath, getPersistedSchemaVersion, setSqlitePragmaConfig, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError };
|