@cortexkit/opencode-magic-context 0.49.86 → 0.49.87
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 +13 -7
- package/dist/chunk-embedding-write-worker.js +4 -4
- package/dist/{compartment-chunk-embedding-ymc9mtwv.js → compartment-chunk-embedding-fey2bsyf.js} +3 -1
- package/dist/{conflict-warning-hook-a0wrnzch.js → conflict-warning-hook-kbq6ppjf.js} +2 -2
- package/dist/{context-xesm7rj3.js → context-gnk68pyy.js} +126 -46
- package/dist/{embedding-backfill-v6sw58m8.js → embedding-backfill-9khxv6a9.js} +4 -4
- package/dist/{embedding-cache-mgyr73ef.js → embedding-cache-zn4r1c31.js} +5 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -0
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/token-budget.d.ts +8 -3
- package/dist/features/magic-context/dreamer/token-budget.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-cache.d.ts +7 -0
- package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +6 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +2 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +2 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +11 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +1 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-7j2zv9nm.js → index-2qsca7h7.js} +47 -11
- package/dist/{index-25nktq8n.js → index-3jgzd7nz.js} +7 -7
- package/dist/{index-snbpdpa3.js → index-3pdknr07.js} +4 -4
- package/dist/{index-k0tb2z28.js → index-3x4qvp29.js} +2 -2
- package/dist/{index-d0rtbv0f.js → index-5nmqgvz2.js} +21 -14
- package/dist/{index-xrnhxkz7.js → index-60wnwcwz.js} +1 -1
- package/dist/{index-g6hfh4h4.js → index-6zewd2n5.js} +14 -8
- package/dist/{index-nny4gm06.js → index-74sh122g.js} +2 -2
- package/dist/{index-70cv85b0.js → index-78t37mcq.js} +2 -2
- package/dist/{index-stx8zd81.js → index-83qd3n7s.js} +2 -2
- package/dist/{index-jjvbk92s.js → index-9emdjcb5.js} +1 -1
- package/dist/{index-gxdc95cp.js → index-awyqqnd8.js} +585 -82
- package/dist/{index-022w6314.js → index-b364vr04.js} +109 -505
- package/dist/{index-4w5rx7de.js → index-bxrfq3mv.js} +1 -1
- package/dist/{index-1bqkqde0.js → index-c1s40xmj.js} +3 -3
- package/dist/{index-05bm2ndp.js → index-chpzb6xy.js} +1 -1
- package/dist/{index-ttk3trse.js → index-csztadkj.js} +46 -17
- package/dist/{index-798s7c8s.js → index-hdyfvdag.js} +1 -1
- package/dist/{index-4ntnt8ee.js → index-jka4y6mv.js} +1 -1
- package/dist/{index-w6v4dw5f.js → index-kmrv1fw3.js} +4 -4
- package/dist/{index-jrj95cce.js → index-m6dnydf8.js} +9 -2
- package/dist/{index-e32b3x4n.js → index-pmcvg3k1.js} +4 -4
- package/dist/{index-4dhv7mqz.js → index-qjwpqvnf.js} +48 -1
- package/dist/{index-xccywqdj.js → index-rvf1726x.js} +3 -3
- package/dist/{index-1pf5qrx4.js → index-vyfrgwhk.js} +3 -3
- package/dist/{index-s8ks5nz4.js → index-watde7a1.js} +2 -2
- package/dist/{v2/server-fzgyvsb1.js → index-y14pawe1.js} +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -52
- package/dist/{message-index-bounded-6fr624zf.js → message-index-bounded-r1qys471.js} +4 -4
- package/dist/migration-worker.js +3 -3
- package/dist/plugin/messages-transform.d.ts +3 -4
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/refusal-notice.d.ts +3 -0
- package/dist/plugin/refusal-notice.d.ts.map +1 -0
- package/dist/{project-embedding-registry-q80scexh.js → project-embedding-registry-8t0gwf59.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-6wedfths.js → read-session-chunk-xv9f0wgb.js} +3 -3
- package/dist/{recomp-orchestrator-7ecg8ryx.js → recomp-orchestrator-2ztmtxt2.js} +18 -18
- package/dist/{render-yqp7q79f.js → render-d6q6h9hy.js} +10 -10
- package/dist/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
- package/dist/{search-archive-r4h96j2z.js → search-archive-g96jn6p0.js} +5 -5
- package/dist/{search-bw22d7zc.js → search-d5aajhs3.js} +14 -14
- package/dist/{send-session-notification-7x518gew.js → send-session-notification-gzxz88vq.js} +1 -1
- package/dist/shared/assistant-message-extractor.d.ts +2 -0
- package/dist/shared/assistant-message-extractor.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/shared/rpc-notifications.d.ts +1 -1
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
- package/dist/{storage-tags-y2mrb8e6.js → storage-tags-f1ftvjpw.js} +2 -2
- package/dist/{transform-postprocess-phase-t99yj9vt.js → transform-postprocess-phase-b2yjw8by.js} +19 -19
- package/dist/v2/auto-search-worker.js +13 -7
- package/dist/v2/chunk-embedding-write-worker.js +4 -4
- package/dist/v2/{compartment-chunk-embedding-x6qw6mjk.js → compartment-chunk-embedding-knt2468v.js} +3 -1
- package/dist/v2/{context-k8sx1nyy.js → context-s86114yy.js} +219 -62
- package/dist/v2/{embedding-backfill-k8kqnwfq.js → embedding-backfill-tazkbpyg.js} +4 -4
- package/dist/v2/{embedding-cache-mgyr73ef.js → embedding-cache-zn4r1c31.js} +5 -1
- package/dist/v2/fold/native-replay.d.ts +3 -1
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/hidden-child-record.d.ts +1 -0
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-jqy7283g.js → message-index-bounded-b07r9cjv.js} +4 -4
- package/dist/v2/migration-worker.js +3 -3
- package/dist/v2/{project-embedding-registry-2jp1antr.js → project-embedding-registry-ah3gsg48.js} +3 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-n3nhfvd7.js → read-session-chunk-38wdy8nd.js} +3 -3
- package/dist/v2/{recomp-orchestrator-ssde9ft1.js → recomp-orchestrator-kc62xgb9.js} +17 -17
- package/dist/v2/{render-fezgh7pa.js → render-j05per51.js} +10 -10
- package/dist/v2/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
- package/dist/v2/{search-archive-zz1kza50.js → search-archive-b4ptw02k.js} +5 -5
- package/dist/v2/{search-m251amra.js → search-kg31ad2s.js} +13 -13
- package/dist/v2/{send-session-notification-p52rhjzy.js → send-session-notification-zazaxxpf.js} +1 -1
- package/dist/v2/{server-ps6rz88g.js → server-2p0qayr1.js} +1 -1
- package/dist/v2/{server-fsw8kbng.js → server-2r9btf0g.js} +46 -17
- package/dist/v2/{server-wdq85mxj.js → server-6250cxzs.js} +14 -8
- package/dist/v2/{server-brgandk4.js → server-6vnbz81n.js} +2 -2
- package/dist/v2/{server-jjvbk92s.js → server-9emdjcb5.js} +1 -1
- package/dist/v2/{server-ap81bk3c.js → server-9n2qgk29.js} +1 -1
- package/dist/v2/{server-mbkwcwgw.js → server-axdmkvd5.js} +2 -2
- package/dist/v2/{server-2k8tkbhz.js → server-c7awk5s2.js} +10 -4
- package/dist/v2/{server-4wwwm2ya.js → server-ct0gs8fc.js} +4 -4
- package/dist/v2/{server-97w51d8n.js → server-ff5wcfy4.js} +3 -3
- package/dist/v2/{server-ssg29wjg.js → server-gqrw0br5.js} +20 -13
- package/dist/v2/{server-y31y6gws.js → server-gwhj0362.js} +3 -3
- package/dist/v2/{server-w7mpvkpj.js → server-pbp58w5x.js} +1 -1
- package/dist/v2/{server-s15knz0w.js → server-pmws7we9.js} +1 -1
- package/dist/v2/{server-4dhv7mqz.js → server-qjwpqvnf.js} +48 -1
- package/dist/v2/{server-a2f1bhyj.js → server-stjy5dxv.js} +9 -2
- package/dist/v2/{server-hn8b7sfe.js → server-xn7zqs4j.js} +2 -2
- package/dist/{index-fzgyvsb1.js → v2/server-y14pawe1.js} +3 -0
- package/dist/v2/{server-8pdfmc27.js → server-y17r5ryz.js} +4 -4
- package/dist/v2/{server-n5zr7190.js → server-yh2z4gg2.js} +3 -3
- package/dist/v2/{server-sxfbjdye.js → server-yx0nyj1q.js} +2 -2
- package/dist/v2/server.js +3 -3
- package/dist/v2/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
- package/dist/v2/{storage-tags-xq81zgt2.js → storage-tags-pmw33chf.js} +2 -2
- package/dist/v2/{v2-archive-reader-e2w39c3p.js → v2-archive-reader-2ayz16s4.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-eg5b1p89.js → wrapup-orchestrator-e20sjbdz.js} +17 -17
- package/dist/{v2-archive-reader-8dsngf2j.js → v2-archive-reader-x39mzvwn.js} +1 -1
- package/dist/{wrapup-orchestrator-nmk6yf7f.js → wrapup-orchestrator-h3s905vs.js} +19 -19
- package/package.json +1 -1
- package/src/shared/assistant-message-extractor.test.ts +22 -0
- package/src/shared/assistant-message-extractor.ts +13 -0
- package/src/shared/model-suggestion-retry.test.ts +43 -12
- package/src/shared/prompt-async-transport.test.ts +275 -8
- package/src/shared/prompt-async-transport.ts +41 -2
- package/src/shared/reusable-worker.fixture.ts +15 -3
- package/src/shared/reusable-worker.test.ts +20 -10
- package/src/shared/rpc-notifications.ts +4 -1
- package/src/shared/sqlite-foreground-wait.test.ts +2 -2
- package/src/shared/startup-maintenance-policy.test.ts +4 -2
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
foldShrunkPartTags2,
|
|
102
102
|
getTagNumberByMessageId2,
|
|
103
103
|
getActiveTagsBySession2
|
|
104
|
-
} from "./server-
|
|
104
|
+
} from "./server-pmws7we9.js";
|
|
105
105
|
import {
|
|
106
106
|
hasMeaningfulUserText2,
|
|
107
107
|
estimateTokens,
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
} from "./server-y8xjr8rx.js";
|
|
110
110
|
import {
|
|
111
111
|
BoundedSessionMap
|
|
112
|
-
} from "./server-
|
|
112
|
+
} from "./server-stjy5dxv.js";
|
|
113
113
|
import {
|
|
114
114
|
resolveOpenCodeDbPath,
|
|
115
115
|
assertOpenCodeStoreGeneration,
|
|
@@ -156,14 +156,14 @@ import {
|
|
|
156
156
|
getRawSessionTagKeysThrough2,
|
|
157
157
|
getLegacyProtectedTailStartOrdinal2,
|
|
158
158
|
readSessionChunk2
|
|
159
|
-
} from "./server-
|
|
159
|
+
} from "./server-c7awk5s2.js";
|
|
160
160
|
import {
|
|
161
161
|
clearCompressionDepth,
|
|
162
162
|
clearCompressionDepthRange,
|
|
163
163
|
toMessageIndexSource,
|
|
164
164
|
clearIndexedMessagesInTransaction,
|
|
165
165
|
indexSourcesAfterOrdinal
|
|
166
|
-
} from "./server-
|
|
166
|
+
} from "./server-9n2qgk29.js";
|
|
167
167
|
import {
|
|
168
168
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
169
169
|
getCompartmentLeaseBlocker,
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
getProjectState,
|
|
211
211
|
recordSubagentInvocation,
|
|
212
212
|
getLatestHistorianInvocationId
|
|
213
|
-
} from "./server-
|
|
213
|
+
} from "./server-ct0gs8fc.js";
|
|
214
214
|
import {
|
|
215
215
|
invalidateAutoEmbedSession
|
|
216
216
|
} from "./server-2amn2s73.js";
|
|
@@ -223,7 +223,7 @@ import {
|
|
|
223
223
|
replaceCompartmentChunkEmbeddings2,
|
|
224
224
|
deleteChunkEmbedBackoffForSession2,
|
|
225
225
|
chunkWindowSourceKey2
|
|
226
|
-
} from "./server-
|
|
226
|
+
} from "./server-y17r5ryz.js";
|
|
227
227
|
import {
|
|
228
228
|
isMarkerCandidateBasisCurrent2,
|
|
229
229
|
invalidateMarkerCandidateBasis2,
|
|
@@ -245,7 +245,7 @@ import {
|
|
|
245
245
|
getProjectChunkEmbeddingModelId2,
|
|
246
246
|
getProjectEmbeddingMaxInputTokens2,
|
|
247
247
|
embedItemsWindowBounded2
|
|
248
|
-
} from "./server-
|
|
248
|
+
} from "./server-xn7zqs4j.js";
|
|
249
249
|
import {
|
|
250
250
|
V2_MEMORY_CATEGORIES,
|
|
251
251
|
CATEGORY_PRIORITY,
|
|
@@ -256,7 +256,7 @@ import {
|
|
|
256
256
|
userFacingFailureCode,
|
|
257
257
|
promoteSessionFactsDurable,
|
|
258
258
|
embedPromotedFacts
|
|
259
|
-
} from "./server-
|
|
259
|
+
} from "./server-gwhj0362.js";
|
|
260
260
|
import {
|
|
261
261
|
computeCueContentHash,
|
|
262
262
|
getMuralCueState,
|
|
@@ -264,13 +264,13 @@ import {
|
|
|
264
264
|
getMemoriesByProject2,
|
|
265
265
|
getMemoriesByProjects2,
|
|
266
266
|
getMaxMemoryIdForProjects2
|
|
267
|
-
} from "./server-
|
|
267
|
+
} from "./server-9emdjcb5.js";
|
|
268
268
|
import {
|
|
269
269
|
getSchemaFenceRejection,
|
|
270
270
|
LATEST_SUPPORTED_VERSION,
|
|
271
271
|
getPersistedSchemaVersion,
|
|
272
272
|
openDatabase
|
|
273
|
-
} from "./server-
|
|
273
|
+
} from "./server-yh2z4gg2.js";
|
|
274
274
|
import {
|
|
275
275
|
parseCompartmentOutput,
|
|
276
276
|
resolveWorkspaceShareCategories,
|
|
@@ -279,7 +279,7 @@ import {
|
|
|
279
279
|
resolveStoredPathWorkspaceIdentity,
|
|
280
280
|
sourceNameForMemory,
|
|
281
281
|
computeWorkspaceEpochFingerprint
|
|
282
|
-
} from "./server-
|
|
282
|
+
} from "./server-2p0qayr1.js";
|
|
283
283
|
import {
|
|
284
284
|
FAIL_CLOSED_DOCTOR_COMMAND
|
|
285
285
|
} from "./server-39bcszk4.js";
|
|
@@ -287,10 +287,10 @@ import {
|
|
|
287
287
|
getSessionNotes,
|
|
288
288
|
getReadySmartNotes,
|
|
289
289
|
insertPrimerCandidates
|
|
290
|
-
} from "./server-
|
|
290
|
+
} from "./server-pbp58w5x.js";
|
|
291
291
|
import {
|
|
292
292
|
pushNotification2
|
|
293
|
-
} from "./server-
|
|
293
|
+
} from "./server-y14pawe1.js";
|
|
294
294
|
import {
|
|
295
295
|
deriveTriggerBudget2,
|
|
296
296
|
resolveHistorianProducerLimits2,
|
|
@@ -298,7 +298,7 @@ import {
|
|
|
298
298
|
} from "./server-cwtehwbb.js";
|
|
299
299
|
import {
|
|
300
300
|
sendStatusNotification2
|
|
301
|
-
} from "./server-
|
|
301
|
+
} from "./server-6250cxzs.js";
|
|
302
302
|
import {
|
|
303
303
|
retreatPastHostUnservedRows,
|
|
304
304
|
snapTerminalCompartmentToServedRow,
|
|
@@ -3269,6 +3269,10 @@ function hasLengthCappedOutput(value) {
|
|
|
3269
3269
|
}
|
|
3270
3270
|
return Object.values(value).some((item) => hasLengthCappedOutput(item));
|
|
3271
3271
|
}
|
|
3272
|
+
function isLatestAssistantLengthCapped(messages) {
|
|
3273
|
+
const latest = getLatestAssistantMessage(messages);
|
|
3274
|
+
return hasLengthCappedOutput(latest?.info?.finish ? { finish: latest.info.finish } : null) || Array.isArray(latest?.parts) && latest.parts.some((part) => isRecord(part) && part.type === "step-finish" && hasLengthCappedOutput(part));
|
|
3275
|
+
}
|
|
3272
3276
|
function describeAssistantSettlement(output) {
|
|
3273
3277
|
if (isRecord(output) && isRecord(output.tokenLog)) {
|
|
3274
3278
|
return `finish=${String(output.tokenLog.finish_reason ?? "unknown")}, reasoning=${typeof output.reasoning === "string" && output.reasoning.length > 0}`;
|
|
@@ -4415,6 +4419,24 @@ function messageId(message) {
|
|
|
4415
4419
|
const id = infoOf(message).id;
|
|
4416
4420
|
return typeof id === "string" ? id : null;
|
|
4417
4421
|
}
|
|
4422
|
+
function inFlightAtAbort(messages, initialBaseline) {
|
|
4423
|
+
const reply = messages.slice().reverse().find((message) => {
|
|
4424
|
+
const id = messageId(message);
|
|
4425
|
+
return id !== null && !initialBaseline.has(id) && infoOf(message).role === "assistant";
|
|
4426
|
+
});
|
|
4427
|
+
const parts = reply?.parts;
|
|
4428
|
+
const ids = new Set;
|
|
4429
|
+
if (Array.isArray(parts)) {
|
|
4430
|
+
for (const part of parts) {
|
|
4431
|
+
if (part?.type !== "tool" || typeof part.callID !== "string")
|
|
4432
|
+
continue;
|
|
4433
|
+
const state = part.state;
|
|
4434
|
+
if (state?.status === "pending" || state?.status === "running" || state?.status === "error" && state.error === "Tool execution aborted" && state.metadata?.interrupted === true)
|
|
4435
|
+
ids.add(part.callID);
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
return ids;
|
|
4439
|
+
}
|
|
4418
4440
|
function recordedAssistantError(message) {
|
|
4419
4441
|
const info = infoOf(message);
|
|
4420
4442
|
if (info.error != null)
|
|
@@ -4639,7 +4661,7 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
4639
4661
|
finalizing = true;
|
|
4640
4662
|
sessionLog2(sessionId, "dreamer token budget: finalize fired", budget.snapshot());
|
|
4641
4663
|
budgetAbortedSessions.add(sessionId);
|
|
4642
|
-
registerBudgetFinalizeChild(sessionId, budget);
|
|
4664
|
+
const countRefusals = registerBudgetFinalizeChild(sessionId, budget);
|
|
4643
4665
|
if (!session.abort)
|
|
4644
4666
|
throw new DreamTokenBudgetExceeded(sessionId, budget.snapshot().spent);
|
|
4645
4667
|
await session.abort({ path: { id: sessionId } });
|
|
@@ -4653,7 +4675,14 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
4653
4675
|
if (await readStatus(session, sessionId, dir, signal) !== "idle") {
|
|
4654
4676
|
throw new DreamTokenBudgetExceeded(sessionId, budget.snapshot().spent);
|
|
4655
4677
|
}
|
|
4656
|
-
|
|
4678
|
+
const cancelled = await readMessages(session, sessionId, dir, signal);
|
|
4679
|
+
completionBaseline = new Set((cancelled.length ? cancelled : messages).map(messageId).filter((value) => value !== null));
|
|
4680
|
+
const exemptCallIds = inFlightAtAbort(cancelled, initialBaseline);
|
|
4681
|
+
countRefusals(exemptCallIds);
|
|
4682
|
+
sessionLog2(sessionId, "dreamer token budget: counting tool refusals", {
|
|
4683
|
+
snapshot: cancelled.length ? "read" : "unreadable",
|
|
4684
|
+
exemptCallIds: [...exemptCallIds]
|
|
4685
|
+
});
|
|
4657
4686
|
const finalizeResponse = await session.promptAsync?.({
|
|
4658
4687
|
...request,
|
|
4659
4688
|
body: {
|
|
@@ -16748,4 +16777,4 @@ ${failure}`;
|
|
|
16748
16777
|
}
|
|
16749
16778
|
}
|
|
16750
16779
|
|
|
16751
|
-
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, supportsQuietHiddenChildren, matchesHiddenRunLocation, hiddenRunPlacement, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, hiddenModelCooldowns, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, validateStoredCompartments, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, servedHeadTexts, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|
|
16780
|
+
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, supportsQuietHiddenChildren, matchesHiddenRunLocation, hiddenRunPlacement, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, isLatestAssistantLengthCapped, parseProviderModel, modelBodyField, toModelEntry, hiddenModelCooldowns, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, validateStoredCompartments, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, servedHeadTexts, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|
|
@@ -53,11 +53,11 @@ async function trySendTuiToast(sessionId, text, params, forcePersist) {
|
|
|
53
53
|
const message = text.length > 200 ? `${text.slice(0, 200)}…` : text;
|
|
54
54
|
const toastVariant = inferToastVariant(text);
|
|
55
55
|
const duration = params.toastDurationMs ?? 5000;
|
|
56
|
-
const { isTuiConnected: checkTui } = await importPluginModule(() => import("./rpc-notifications-
|
|
56
|
+
const { isTuiConnected: checkTui } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
|
|
57
57
|
if (!checkTui(sessionId))
|
|
58
58
|
return false;
|
|
59
59
|
try {
|
|
60
|
-
const { pushNotification } = await importPluginModule(() => import("./rpc-notifications-
|
|
60
|
+
const { pushNotification } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
|
|
61
61
|
pushNotification("toast", {
|
|
62
62
|
title,
|
|
63
63
|
message,
|
|
@@ -286,7 +286,7 @@ async function sendCommandResult2(client, sessionId, text, params) {
|
|
|
286
286
|
if (shouldHoldIgnoredNotification(sessionId)) {
|
|
287
287
|
return sendIgnoredMessage2(client, sessionId, text, params);
|
|
288
288
|
}
|
|
289
|
-
const { isTuiConnected } = await importPluginModule(() => import("./rpc-notifications-
|
|
289
|
+
const { isTuiConnected } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
|
|
290
290
|
if (isTuiConnected(sessionId))
|
|
291
291
|
return sendIgnoredMessage2(client, sessionId, text, params);
|
|
292
292
|
const session = client?.session;
|
|
@@ -386,13 +386,19 @@ function observeIgnoredNotificationEvent2(event) {
|
|
|
386
386
|
}
|
|
387
387
|
async function sendStatusNotification2(_client, sessionId, text, params) {
|
|
388
388
|
try {
|
|
389
|
-
const { pushNotification } = await importPluginModule(() => import("./rpc-notifications-
|
|
390
|
-
|
|
391
|
-
title: extractToastTitle(text),
|
|
389
|
+
const { pushLiveNotification, pushNotification } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
|
|
390
|
+
const toast = {
|
|
391
|
+
title: params.toastTitle ?? extractToastTitle(text),
|
|
392
392
|
message: text,
|
|
393
|
-
variant: inferToastVariant(text),
|
|
393
|
+
variant: params.toastVariant ?? inferToastVariant(text),
|
|
394
394
|
duration: params.toastDurationMs ?? 5000
|
|
395
|
-
}
|
|
395
|
+
};
|
|
396
|
+
if (params.liveOnly) {
|
|
397
|
+
if (!pushLiveNotification("toast", toast, sessionId))
|
|
398
|
+
return "skipped";
|
|
399
|
+
} else {
|
|
400
|
+
pushNotification("toast", toast, sessionId);
|
|
401
|
+
}
|
|
396
402
|
notifyDelivered(sessionId, params);
|
|
397
403
|
return "sent";
|
|
398
404
|
} catch (error) {
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
rawMessageWorkerSource2,
|
|
20
20
|
rawMessageOffThreadRangeReader2,
|
|
21
21
|
readRawSessionMessageIdOrdinalsForRange2
|
|
22
|
-
} from "./server-
|
|
22
|
+
} from "./server-c7awk5s2.js";
|
|
23
23
|
import {
|
|
24
24
|
readV2ArchiveOffThread2
|
|
25
|
-
} from "./server-
|
|
25
|
+
} from "./server-ff5wcfy4.js";
|
|
26
26
|
|
|
27
27
|
// src/tools/ctx-expand/search-archive.ts
|
|
28
28
|
var archiveReadsOnThisThread = 0;
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
readSearchBackfillCursor2,
|
|
11
11
|
writeSearchBackfillCursor2,
|
|
12
12
|
embedItemsWindowBounded2
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-xn7zqs4j.js";
|
|
14
14
|
import {
|
|
15
15
|
saveEmbeddingIfHashMatches
|
|
16
|
-
} from "./server-
|
|
16
|
+
} from "./server-qjwpqvnf.js";
|
|
17
17
|
|
|
18
18
|
// src/features/magic-context/memory/embedding-backfill.ts
|
|
19
19
|
var SEARCH_BACKFILL_LIMIT = 50;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
estimateMessageTokens,
|
|
7
7
|
getCandidateToolOwners2,
|
|
8
8
|
pickNearestPriorOwner2
|
|
9
|
-
} from "./server-
|
|
9
|
+
} from "./server-pmws7we9.js";
|
|
10
10
|
import {
|
|
11
11
|
OMO_INTERNAL_INITIATOR_MARKER,
|
|
12
12
|
isSystemDirective,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "./server-j8376q08.js";
|
|
28
28
|
import {
|
|
29
29
|
stableStringify
|
|
30
|
-
} from "./server-
|
|
30
|
+
} from "./server-stjy5dxv.js";
|
|
31
31
|
import {
|
|
32
32
|
renderToolTemplate
|
|
33
33
|
} from "./server-rz6g5xne.js";
|
|
@@ -897,8 +897,14 @@ class DreamTokenBudgetExceeded extends Error {
|
|
|
897
897
|
var TOKEN_BUDGET_FINALIZE_MESSAGE = "You're out of token budget. Stop investigating: make no more tool calls and output your result now, covering only what you've already checked; leave the rest out.";
|
|
898
898
|
var TOKEN_BUDGET_TOOL_REFUSAL = "Out of token budget: no more tool calls. Output your result now.";
|
|
899
899
|
var finalizingChildren = new Map;
|
|
900
|
-
function registerBudgetFinalizeChild(sessionId,
|
|
901
|
-
|
|
900
|
+
function registerBudgetFinalizeChild(sessionId, budget) {
|
|
901
|
+
const child = { budget, refusedBeforeSubmission: new Set };
|
|
902
|
+
finalizingChildren.set(sessionId, child);
|
|
903
|
+
return (inFlightAtAbort) => {
|
|
904
|
+
for (const id of child.refusedBeforeSubmission)
|
|
905
|
+
inFlightAtAbort.delete(id);
|
|
906
|
+
child.inFlightAtAbort = inFlightAtAbort;
|
|
907
|
+
};
|
|
902
908
|
}
|
|
903
909
|
function releaseBudgetFinalizeChild(sessionId) {
|
|
904
910
|
finalizingChildren.delete(sessionId);
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./server-ds8vpfkr.js";
|
|
22
22
|
import {
|
|
23
23
|
deleteChunkEmbedBackoffForSession2
|
|
24
|
-
} from "./server-
|
|
24
|
+
} from "./server-y17r5ryz.js";
|
|
25
25
|
import {
|
|
26
26
|
isPidAlive,
|
|
27
27
|
readProcessStartTime
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
getPendingPiCompactionMarkerState,
|
|
59
59
|
logPiCompactionMarkerClear,
|
|
60
60
|
isPrefixBoundThinkingModel
|
|
61
|
-
} from "./server-
|
|
61
|
+
} from "./server-pmws7we9.js";
|
|
62
62
|
import {
|
|
63
63
|
BoundedSessionMap,
|
|
64
64
|
getTableColumnNames,
|
|
@@ -68,14 +68,14 @@ import {
|
|
|
68
68
|
tagRevisionKey,
|
|
69
69
|
tagIdentityRevisionKey,
|
|
70
70
|
deleteTagIdentityRevisions
|
|
71
|
-
} from "./server-
|
|
71
|
+
} from "./server-stjy5dxv.js";
|
|
72
72
|
import {
|
|
73
73
|
withReadOnlySessionDb
|
|
74
74
|
} from "./server-3ap5dmhc.js";
|
|
75
75
|
import {
|
|
76
76
|
layoutLkgPrefix,
|
|
77
77
|
assembleLkgPrefix
|
|
78
|
-
} from "./server-
|
|
78
|
+
} from "./server-2p0qayr1.js";
|
|
79
79
|
import {
|
|
80
80
|
ensurePrivateStorageDirectorySync,
|
|
81
81
|
writeStorageFileSync,
|
|
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
139
139
|
import("./sqlite-zdgm52sv.js"),
|
|
140
140
|
import("./store-reader-2vhx33n6.js"),
|
|
141
141
|
import("./store-y56y034s.js"),
|
|
142
|
-
import("./read-session-chunk-
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
142
|
+
import("./read-session-chunk-38wdy8nd.js"),
|
|
143
|
+
import("./render-j05per51.js"),
|
|
144
|
+
import("./search-archive-b4ptw02k.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./server-rz4snd3x.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-pmws7we9.js";
|
|
19
19
|
import {
|
|
20
20
|
cleanSearchText,
|
|
21
21
|
hintKeywordRelevance,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isMessageIndexReconciledThrough,
|
|
26
26
|
clearIndexedMessages,
|
|
27
27
|
indexMessagesAfterOrdinal
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-9n2qgk29.js";
|
|
29
29
|
import {
|
|
30
30
|
Priority,
|
|
31
31
|
AdmissionClass,
|
|
@@ -38,9 +38,10 @@ import {
|
|
|
38
38
|
import {
|
|
39
39
|
buildCanonicalChunkTextFromFts2,
|
|
40
40
|
loadCompartmentChunkEmbeddingsForSearch2,
|
|
41
|
+
trackCompartmentChunkSearchPool2,
|
|
41
42
|
peekCompartmentChunkSearchPool2,
|
|
42
43
|
warmCompartmentChunkSearchPool2
|
|
43
|
-
} from "./server-
|
|
44
|
+
} from "./server-y17r5ryz.js";
|
|
44
45
|
import {
|
|
45
46
|
saveCommitEmbedding,
|
|
46
47
|
loadProjectCommitEmbeddings,
|
|
@@ -56,13 +57,13 @@ import {
|
|
|
56
57
|
enqueueShadowEmbeddingItems2,
|
|
57
58
|
getProjectEmbeddingSnapshot2,
|
|
58
59
|
embedItemsForProject2
|
|
59
|
-
} from "./server-
|
|
60
|
+
} from "./server-xn7zqs4j.js";
|
|
60
61
|
import {
|
|
61
62
|
recordEmbeddingMeasurement
|
|
62
63
|
} from "./server-2amn2s73.js";
|
|
63
64
|
import {
|
|
64
65
|
getProjectEmbeddings2
|
|
65
|
-
} from "./server-
|
|
66
|
+
} from "./server-qjwpqvnf.js";
|
|
66
67
|
import {
|
|
67
68
|
USER_FACING_FAILURES,
|
|
68
69
|
cosineSimilarity,
|
|
@@ -72,16 +73,16 @@ import {
|
|
|
72
73
|
sanitizeFtsQuery,
|
|
73
74
|
searchMemoriesFTS,
|
|
74
75
|
searchMemoriesFTSUnion
|
|
75
|
-
} from "./server-
|
|
76
|
+
} from "./server-gwhj0362.js";
|
|
76
77
|
import {
|
|
77
78
|
ModuleMemoryAuthorityError2,
|
|
78
79
|
getMemoriesByProject2,
|
|
79
80
|
getMemoriesByProjects2,
|
|
80
81
|
updateMemoryRetrievalCount2
|
|
81
|
-
} from "./server-
|
|
82
|
+
} from "./server-9emdjcb5.js";
|
|
82
83
|
import {
|
|
83
84
|
ensureMemoryEmbeddings2
|
|
84
|
-
} from "./server-
|
|
85
|
+
} from "./server-axdmkvd5.js";
|
|
85
86
|
import {
|
|
86
87
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
87
88
|
withMessageFtsSessionFilter
|
|
@@ -92,11 +93,11 @@ import {
|
|
|
92
93
|
expandWorkspaceIdentitySetWithAliases,
|
|
93
94
|
resolveStoredPathWorkspaceIdentity,
|
|
94
95
|
sourceNameForMemory
|
|
95
|
-
} from "./server-
|
|
96
|
+
} from "./server-2p0qayr1.js";
|
|
96
97
|
import {
|
|
97
98
|
getNotes,
|
|
98
99
|
getActivePrimers
|
|
99
|
-
} from "./server-
|
|
100
|
+
} from "./server-pbp58w5x.js";
|
|
100
101
|
import {
|
|
101
102
|
isKnownAutocommit
|
|
102
103
|
} from "./server-8ajstryz.js";
|
|
@@ -3086,8 +3087,12 @@ async function searchCompartmentChunks(args) {
|
|
|
3086
3087
|
if (args.diagnostics)
|
|
3087
3088
|
args.diagnostics.pool = "no-vector";
|
|
3088
3089
|
args.reportDiagnostics?.();
|
|
3089
|
-
if (args.warmOnly)
|
|
3090
|
-
|
|
3090
|
+
if (args.warmOnly) {
|
|
3091
|
+
if (args.deferWarmup)
|
|
3092
|
+
trackCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
|
|
3093
|
+
else
|
|
3094
|
+
warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
|
|
3095
|
+
}
|
|
3091
3096
|
return [];
|
|
3092
3097
|
}
|
|
3093
3098
|
const cutoff = args.maxOrdinal != null && args.maxOrdinal >= 0 ? args.maxOrdinal : null;
|
|
@@ -3102,7 +3107,8 @@ async function searchCompartmentChunks(args) {
|
|
|
3102
3107
|
args.diagnostics.poolRows = 0;
|
|
3103
3108
|
}
|
|
3104
3109
|
args.reportDiagnostics?.();
|
|
3105
|
-
|
|
3110
|
+
if (!args.deferWarmup)
|
|
3111
|
+
warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
|
|
3106
3112
|
return [];
|
|
3107
3113
|
}
|
|
3108
3114
|
if (args.timings)
|
|
@@ -3512,6 +3518,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3512
3518
|
modelId: chunkModelId && chunkModelId !== "off" ? chunkModelId : null,
|
|
3513
3519
|
dateRange,
|
|
3514
3520
|
warmOnly: options.chunkPoolWarmOnly,
|
|
3521
|
+
deferWarmup: options.deferChunkPoolWarmup,
|
|
3515
3522
|
signal: options.signal,
|
|
3516
3523
|
timings,
|
|
3517
3524
|
diagnostics: options.autoSearchDiagnostics,
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
OpenAICompatibleEmbeddingProvider,
|
|
23
23
|
embedTextForProject2
|
|
24
|
-
} from "./server-
|
|
24
|
+
} from "./server-xn7zqs4j.js";
|
|
25
25
|
import {
|
|
26
26
|
saveEmbeddingIfHashMatches
|
|
27
|
-
} from "./server-
|
|
27
|
+
} from "./server-qjwpqvnf.js";
|
|
28
28
|
import {
|
|
29
29
|
getMemorySelectColumns2,
|
|
30
30
|
isMemoryRow2,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
buildWorkspaceMemorySqlFilter2,
|
|
35
35
|
getMemoryById2,
|
|
36
36
|
updateMemorySeenCount2
|
|
37
|
-
} from "./server-
|
|
37
|
+
} from "./server-9emdjcb5.js";
|
|
38
38
|
import {
|
|
39
39
|
computeNormalizedHash
|
|
40
40
|
} from "./server-2bvekkfy.js";
|
|
@@ -72,6 +72,41 @@ function getMemoryEmbedCoverage(db, projectPath, modelId) {
|
|
|
72
72
|
var DEFAULT_EMBEDDING_CACHE_TTL_MS = 60000;
|
|
73
73
|
var projectEmbeddingCache = new Map;
|
|
74
74
|
var embeddingCacheTtlMs = DEFAULT_EMBEDDING_CACHE_TTL_MS;
|
|
75
|
+
var keptWorkerCaches = new WeakMap;
|
|
76
|
+
function keepWorkerMemoryEmbeddings2(db) {
|
|
77
|
+
keptWorkerCaches.set(db, {
|
|
78
|
+
entries: new Map,
|
|
79
|
+
lastBackgroundReloadAt: -Infinity
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function readDataVersion(db, cache) {
|
|
83
|
+
cache.version ??= db.prepare("PRAGMA data_version");
|
|
84
|
+
return Number(cache.version.get().data_version);
|
|
85
|
+
}
|
|
86
|
+
function loadKeptWorkerEntry(db, cache, projectPath, modelId, version, loadedAt) {
|
|
87
|
+
const embeddings = loadAllEmbeddings(db, projectPath, modelId);
|
|
88
|
+
cache.entries.set(projectPath, {
|
|
89
|
+
projectPath,
|
|
90
|
+
modelId,
|
|
91
|
+
version,
|
|
92
|
+
loadedAt,
|
|
93
|
+
embeddings
|
|
94
|
+
});
|
|
95
|
+
return embeddings;
|
|
96
|
+
}
|
|
97
|
+
function maintainKeptWorkerMemoryEmbeddings2(db) {
|
|
98
|
+
const cache = keptWorkerCaches.get(db);
|
|
99
|
+
const now = Date.now();
|
|
100
|
+
if (!cache?.entries.size || now - cache.lastBackgroundReloadAt < DEFAULT_EMBEDDING_CACHE_TTL_MS)
|
|
101
|
+
return;
|
|
102
|
+
const version = readDataVersion(db, cache);
|
|
103
|
+
for (const entry of cache.entries.values()) {
|
|
104
|
+
if (entry.version === version || now - entry.loadedAt < DEFAULT_EMBEDDING_CACHE_TTL_MS)
|
|
105
|
+
continue;
|
|
106
|
+
cache.lastBackgroundReloadAt = now;
|
|
107
|
+
loadKeptWorkerEntry(db, cache, entry.projectPath, entry.modelId, version, now);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
75
110
|
function cacheKey(projectPath, modelId) {
|
|
76
111
|
return `${projectPath}\x00${modelId}`;
|
|
77
112
|
}
|
|
@@ -87,6 +122,18 @@ function getValidCacheEntry(projectPath, modelId) {
|
|
|
87
122
|
return entry;
|
|
88
123
|
}
|
|
89
124
|
function getProjectEmbeddings2(db, projectPath, modelId) {
|
|
125
|
+
const kept = keptWorkerCaches.get(db);
|
|
126
|
+
if (kept) {
|
|
127
|
+
const now = Date.now();
|
|
128
|
+
const cached = kept.entries.get(projectPath);
|
|
129
|
+
const entry = cached?.modelId === modelId ? cached : undefined;
|
|
130
|
+
if (entry && now - entry.loadedAt < DEFAULT_EMBEDDING_CACHE_TTL_MS)
|
|
131
|
+
return entry.embeddings;
|
|
132
|
+
const version = readDataVersion(db, kept);
|
|
133
|
+
if (entry?.version === version)
|
|
134
|
+
return entry.embeddings;
|
|
135
|
+
return loadKeptWorkerEntry(db, kept, projectPath, modelId, version, now);
|
|
136
|
+
}
|
|
90
137
|
const cached = getValidCacheEntry(projectPath, modelId);
|
|
91
138
|
if (cached) {
|
|
92
139
|
return cached.embeddings;
|
|
@@ -128,4 +175,4 @@ function setEmbeddingCacheTtlForTests2(ttlMs) {
|
|
|
128
175
|
embeddingCacheTtlMs = Math.max(0, Math.floor(ttlMs));
|
|
129
176
|
}
|
|
130
177
|
|
|
131
|
-
export { saveEmbeddingIfHashMatches, getMemoryEmbedCoverage, getProjectEmbeddings2, peekProjectEmbeddings2, invalidateProject2, invalidateMemory2, resetEmbeddingCacheForTests2, setEmbeddingCacheTtlForTests2 };
|
|
178
|
+
export { saveEmbeddingIfHashMatches, getMemoryEmbedCoverage, keepWorkerMemoryEmbeddings2, maintainKeptWorkerMemoryEmbeddings2, getProjectEmbeddings2, peekProjectEmbeddings2, invalidateProject2, invalidateMemory2, resetEmbeddingCacheForTests2, setEmbeddingCacheTtlForTests2 };
|
|
@@ -863,7 +863,10 @@ function recordToolDefinitionSet(providerID, modelID, agentName, tools, sessionI
|
|
|
863
863
|
for (const [toolID, slot] of next)
|
|
864
864
|
writeSlot(route, toolID, slot);
|
|
865
865
|
if (sessionId)
|
|
866
|
-
sessionFlights.set(sessionId, {
|
|
866
|
+
sessionFlights.set(sessionId, {
|
|
867
|
+
key,
|
|
868
|
+
exact: { ...summarize([...next.entries()], true), providerID, modelID }
|
|
869
|
+
});
|
|
867
870
|
}
|
|
868
871
|
function getCurrentToolSetHash(providerID, modelID, agentName, sessionId) {
|
|
869
872
|
return resolve(providerID, modelID, agentName, sessionId)?.hash ?? "";
|
|
@@ -874,6 +877,10 @@ function getToolDefinitionMeasurementSignature(providerID, modelID, agentName, s
|
|
|
874
877
|
function getMeasuredToolDefinitionTokens(providerID, modelID, agentName, sessionId) {
|
|
875
878
|
return resolve(providerID, modelID, agentName, sessionId)?.total;
|
|
876
879
|
}
|
|
880
|
+
function getExactSessionToolDefinitionTokens(providerID, modelID, sessionId) {
|
|
881
|
+
const exact = sessionFlights.peek(sessionId)?.exact;
|
|
882
|
+
return exact && exact.providerID === providerID && exact.modelID === modelID ? exact.total : undefined;
|
|
883
|
+
}
|
|
877
884
|
function getSessionToolDefinitionTokens(sessionId) {
|
|
878
885
|
if (!sessionId)
|
|
879
886
|
return;
|
|
@@ -886,4 +893,4 @@ function getSessionToolDefinitionTokens(sessionId) {
|
|
|
886
893
|
return route ? summarize(currentTools(route), route.live).total : undefined;
|
|
887
894
|
}
|
|
888
895
|
|
|
889
|
-
export { BoundedSessionMap, getTableColumnNames, ensureColumn, healAllNullColumns, stableStringify, stableStringifyHash, setDatabase, loadToolDefinitionMeasurements, recordToolDefinitionSet, getCurrentToolSetHash, getToolDefinitionMeasurementSignature, getMeasuredToolDefinitionTokens, getSessionToolDefinitionTokens, getTemporalDecisions, observeTemporalDecisions, freezeTemporalDecisions, installV95PerfSchema, tagOrderConstraintIndex, tagTombstoneOwnerRange, tagTombstoneOwnerKey, tagRevisionKey, tagIdentityRevisionKey, installTagIdentityRevisionTrigger, deleteTagIdentityRevisions };
|
|
896
|
+
export { BoundedSessionMap, getTableColumnNames, ensureColumn, healAllNullColumns, stableStringify, stableStringifyHash, setDatabase, loadToolDefinitionMeasurements, recordToolDefinitionSet, getCurrentToolSetHash, getToolDefinitionMeasurementSignature, getMeasuredToolDefinitionTokens, getExactSessionToolDefinitionTokens, getSessionToolDefinitionTokens, getTemporalDecisions, observeTemporalDecisions, freezeTemporalDecisions, installV95PerfSchema, tagOrderConstraintIndex, tagTombstoneOwnerRange, tagTombstoneOwnerKey, tagRevisionKey, tagIdentityRevisionKey, installTagIdentityRevisionTrigger, deleteTagIdentityRevisions };
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
countSessionCompartmentEmbedCoverage2,
|
|
61
61
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
62
62
|
countUnembeddedSessionCompartmentsPolite2
|
|
63
|
-
} from "./server-
|
|
63
|
+
} from "./server-y17r5ryz.js";
|
|
64
64
|
import {
|
|
65
65
|
acquireGitSweepLease,
|
|
66
66
|
renewGitSweepLease,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
saveEmbeddingIfHashMatches,
|
|
74
74
|
getMemoryEmbedCoverage,
|
|
75
75
|
invalidateProject2
|
|
76
|
-
} from "./server-
|
|
76
|
+
} from "./server-qjwpqvnf.js";
|
|
77
77
|
import {
|
|
78
78
|
dominantEmbeddingFailure,
|
|
79
79
|
embeddingModelsMatch,
|
|
@@ -17,13 +17,16 @@ function notificationMatchesSink(notification, sink) {
|
|
|
17
17
|
}
|
|
18
18
|
function pushLiveNotification2(type, payload, sessionId) {
|
|
19
19
|
const notification = { id: nextNotificationId++, type, payload, sessionId };
|
|
20
|
+
let delivered = false;
|
|
20
21
|
for (const sink of sinks) {
|
|
21
22
|
if (sink.sessionId !== sessionId)
|
|
22
23
|
continue;
|
|
23
24
|
try {
|
|
24
25
|
sink.send(notification);
|
|
26
|
+
delivered = true;
|
|
25
27
|
} catch {}
|
|
26
28
|
}
|
|
29
|
+
return delivered;
|
|
27
30
|
}
|
|
28
31
|
function pushNotification2(type, payload, sessionId, options) {
|
|
29
32
|
const notification = { id: nextNotificationId++, type, payload, sessionId };
|