@cortexkit/opencode-magic-context 0.49.5 → 0.49.7
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 +10 -7
- package/dist/{compaction-marker-candidates-dd638ypn.js → compaction-marker-candidates-a0edbqrr.js} +2 -2
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/{conflict-warning-hook-ae8nmv7c.js → conflict-warning-hook-myk5hbt9.js} +5 -5
- package/dist/{context-yg023c5r.js → context-ffr7e0g7.js} +46 -34
- package/dist/{embedding-backfill-aj488s8x.js → embedding-backfill-re16xncd.js} +6 -6
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +6 -3
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +7 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +2 -2
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/primer-seed.d.ts +2 -0
- package/dist/features/magic-context/dreamer/primer-seed.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts +2 -2
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +10 -3
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-replay-document.d.ts +4 -0
- package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +7 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/note-nudger.d.ts +5 -3
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
- package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +7 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/replay-committed-drops.d.ts +9 -0
- package/dist/hooks/magic-context/replay-committed-drops.d.ts.map +1 -0
- package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts +2 -2
- package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +3 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-served-raw.d.ts +29 -0
- package/dist/hooks/magic-context/rust-served-raw.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +23 -24
- 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/tool-drop-target.d.ts +2 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/{index-m4p77myp.js → index-0gyq3djm.js} +1 -1
- package/dist/{index-jpm52v9x.js → index-37q80veb.js} +1 -1
- package/dist/{index-znzgze2v.js → index-4btknbqh.js} +9 -8
- package/dist/{index-v4bqjy56.js → index-5tbvdff4.js} +59 -28
- package/dist/{index-7jzrrxap.js → index-9yyqq3mm.js} +1 -1
- package/dist/{index-qvr78ej6.js → index-a8acx4gc.js} +2 -2
- package/dist/{index-gcdb3rqw.js → index-ax2jhztn.js} +1 -1
- package/dist/{index-2mqps3c1.js → index-ebnngykq.js} +145 -94
- package/dist/{index-41gqa557.js → index-g8qbdb03.js} +1 -1
- package/dist/{index-fst3t0d9.js → index-j58gqrn2.js} +65 -65
- package/dist/{index-xfbfrngb.js → index-j5hce1ab.js} +2 -2
- package/dist/{index-kb9nn0a0.js → index-j8epsc0g.js} +35 -14
- package/dist/{index-7zg9dvx0.js → index-n5a170gs.js} +227 -38
- package/dist/{index-fjtgekd4.js → index-n7kwfw2r.js} +4 -4
- package/dist/{index-dd18gej8.js → index-rwmpkss5.js} +3 -3
- package/dist/{index-7w18gg78.js → index-rzmjkdd6.js} +1 -1
- package/dist/{index-c0b01zrc.js → index-sf94at64.js} +3 -3
- package/dist/{index-yxawqmdd.js → index-sh91t19a.js} +1 -1
- package/dist/{index-x3y1np1h.js → index-tagss15p.js} +857 -125
- package/dist/{index-yqps2zsv.js → index-tmtty2x5.js} +1 -1
- package/dist/{index-bhk710rw.js → index-vt4sf4ep.js} +1 -1
- package/dist/{index-6m7rdv7y.js → index-w4mw92w3.js} +1 -1
- package/dist/{index-7ndnvw7a.js → index-w6bd03dc.js} +1 -1
- package/dist/{index-p2hs3rps.js → index-w6vr754t.js} +4 -4
- package/dist/{index-3wckxwfp.js → index-wq16ahsn.js} +5 -5
- package/dist/index.js +36 -36
- package/dist/{message-index-bounded-pv6ct15d.js → message-index-bounded-04rycpx4.js} +9 -9
- package/dist/{message-index-jqa7qd0s.js → message-index-rqtse28y.js} +9 -9
- package/dist/{message-time-backfill-8x06r9kx.js → message-time-backfill-a5ytnp53.js} +1 -1
- package/dist/migration-worker.js +6 -6
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/{project-embedding-registry-fcmszatg.js → project-embedding-registry-k0sd9k7v.js} +5 -5
- package/dist/raw-ordinal-warmup-worker.js +17 -15
- package/dist/{read-session-chunk-cwgjwjd0.js → read-session-chunk-h1btx938.js} +7 -5
- package/dist/{read-session-raw-z38cn0as.js → read-session-raw-vdf4wh78.js} +2 -2
- package/dist/{recomp-orchestrator-xw9wt5bm.js → recomp-orchestrator-trcgmm23.js} +20 -20
- package/dist/{search-v1t47s2q.js → search-3rbdx6hw.js} +16 -16
- package/dist/{send-session-notification-yp9m5g4p.js → send-session-notification-2tp44tfa.js} +4 -4
- package/dist/shared/processed-image-eligibility.d.ts +22 -0
- package/dist/shared/processed-image-eligibility.d.ts.map +1 -0
- package/dist/shared/recovery-reasoning-prefix.d.ts +9 -0
- package/dist/shared/recovery-reasoning-prefix.d.ts.map +1 -0
- package/dist/shared/sqlite.d.ts +1 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +9 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/{sqlite-mhjkerzq.js → sqlite-j3tvg8r0.js} +1 -1
- package/dist/{storage-memory-07fx57k6.js → storage-memory-8168bgef.js} +2 -2
- package/dist/{storage-tags-0ssbmzg9.js → storage-tags-61z5j2f9.js} +2 -2
- package/dist/tools/ctx-expand/search-archive.d.ts +4 -0
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-ttra554y.js → transform-postprocess-phase-7qts7h54.js} +20 -20
- package/dist/v2/auto-search-worker.js +10 -7
- package/dist/v2/{compaction-marker-candidates-1s21e2fz.js → compaction-marker-candidates-6nypjkpf.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/{context-6en6a8ar.js → context-xq4rtywr.js} +1019 -233
- package/dist/v2/{embedding-backfill-9hbkfvnz.js → embedding-backfill-xd9ygzgd.js} +6 -6
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/{message-index-h8ssgq3q.js → message-index-8e5z2xx8.js} +9 -9
- package/dist/v2/{message-index-bounded-c0810p5w.js → message-index-bounded-5vh1h2g7.js} +9 -9
- package/dist/v2/{message-time-backfill-cje68egj.js → message-time-backfill-2z365239.js} +1 -1
- package/dist/v2/migration-worker.js +6 -6
- package/dist/v2/{project-embedding-registry-42th7k1z.js → project-embedding-registry-b77awytr.js} +5 -5
- package/dist/v2/raw-ordinal-warmup-worker.js +17 -15
- package/dist/v2/{read-session-chunk-n86v9xfg.js → read-session-chunk-4sat83cx.js} +7 -5
- package/dist/v2/{read-session-raw-3b3ehga4.js → read-session-raw-a3hw9jsp.js} +2 -2
- package/dist/v2/{recomp-orchestrator-krvsbnds.js → recomp-orchestrator-n11zv1f1.js} +19 -19
- package/dist/v2/{search-048v8y02.js → search-mvgqtkkz.js} +16 -16
- package/dist/v2/{send-session-notification-a4h2azxa.js → send-session-notification-ppgc8qdz.js} +4 -4
- package/dist/v2/{server-cvgn49tr.js → server-1rfgbjfn.js} +1 -1
- package/dist/v2/{server-3bc6k4k4.js → server-7srtwsa4.js} +5 -5
- package/dist/v2/{server-7jzrrxap.js → server-9yyqq3mm.js} +1 -1
- package/dist/v2/{server-2htmbqbv.js → server-brhj8qtd.js} +1 -1
- package/dist/v2/{server-3dqjhchy.js → server-dd0nja67.js} +1 -1
- package/dist/v2/{server-8wcf79fe.js → server-fpqe39as.js} +1 -1
- package/dist/v2/{server-cjz51jm2.js → server-fw31krgq.js} +3 -3
- package/dist/v2/{server-4n2tknpc.js → server-gtv9wbhq.js} +227 -38
- package/dist/v2/{server-8pqnnmf9.js → server-hcvcxzx7.js} +2 -2
- package/dist/v2/{server-kb9nn0a0.js → server-j8epsc0g.js} +35 -14
- package/dist/v2/{server-rygvffsf.js → server-jdwd03ep.js} +4 -4
- package/dist/v2/{server-q6j5dasr.js → server-kdrezdy0.js} +1 -1
- package/dist/v2/{server-e2v4m8xe.js → server-mv1w7t6z.js} +61 -30
- package/dist/v2/{server-hetyb88z.js → server-nfan6zb6.js} +65 -65
- package/dist/v2/{server-4enr7s6x.js → server-qcw43339.js} +1 -1
- package/dist/v2/{server-5zrpr764.js → server-sy4b1sra.js} +1 -1
- package/dist/v2/{server-9a6v0wth.js → server-v4fwha43.js} +9 -8
- package/dist/v2/{server-pcygfdbs.js → server-w3zeywp1.js} +1 -1
- package/dist/v2/{server-czb2rkpk.js → server-wkdgjjch.js} +1 -1
- package/dist/v2/{server-9290a1mb.js → server-x08d1xf3.js} +1 -1
- package/dist/v2/server.js +4 -4
- package/dist/v2/{sqlite-mhjkerzq.js → sqlite-j3tvg8r0.js} +1 -1
- package/dist/v2/{storage-memory-07fx57k6.js → storage-memory-8168bgef.js} +2 -2
- package/dist/v2/{storage-tags-3a4cavqb.js → storage-tags-j2fzq3sw.js} +2 -2
- package/dist/v2/{wrapup-orchestrator-r2v7kgy3.js → wrapup-orchestrator-s92ebfzv.js} +19 -19
- package/dist/{wrapup-orchestrator-z7agncp8.js → wrapup-orchestrator-df61jmz9.js} +21 -21
- package/package.json +3 -3
- package/src/shared/processed-image-eligibility.test.ts +68 -0
- package/src/shared/processed-image-eligibility.ts +41 -0
- package/src/shared/processed-image-position-review.json +20 -0
- package/src/shared/processed-image-position-review.test.ts +19 -0
- package/src/shared/recovery-reasoning-prefix.test.ts +34 -0
- package/src/shared/recovery-reasoning-prefix.ts +35 -0
- package/src/shared/sqlite-acquisition-routing.test.ts +4 -3
- package/src/shared/sqlite-foreground-wait.test.ts +140 -0
- package/src/shared/sqlite-pass-scope.test.ts +4 -4
- package/src/shared/sqlite-writer-diagnostics.test.ts +31 -0
- package/src/shared/sqlite.ts +64 -23
- package/src/shared/tag-transcript.ts +118 -0
|
@@ -41,10 +41,10 @@ import {
|
|
|
41
41
|
withSqliteBackgroundWriter2,
|
|
42
42
|
withoutSqliteTransformPass2,
|
|
43
43
|
beginSqliteWriterAsync2
|
|
44
|
-
} from "./server-
|
|
44
|
+
} from "./server-j8epsc0g.js";
|
|
45
45
|
import {
|
|
46
46
|
sameProjectDirectory
|
|
47
|
-
} from "./server-
|
|
47
|
+
} from "./server-brhj8qtd.js";
|
|
48
48
|
import {
|
|
49
49
|
buildCanonicalChunkTextFromFts,
|
|
50
50
|
buildCompartmentSummaryFallbackText,
|
|
@@ -54,10 +54,10 @@ import {
|
|
|
54
54
|
replaceCompartmentChunkEmbeddings,
|
|
55
55
|
deleteChunkEmbedBackoffForSession,
|
|
56
56
|
chunkWindowSourceKey
|
|
57
|
-
} from "./server-
|
|
57
|
+
} from "./server-fpqe39as.js";
|
|
58
58
|
import {
|
|
59
59
|
isPidAlive
|
|
60
|
-
} from "./server-
|
|
60
|
+
} from "./server-1rfgbjfn.js";
|
|
61
61
|
import {
|
|
62
62
|
BoundedSessionMap,
|
|
63
63
|
clearCompressionDepth,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
toMessageIndexSource2,
|
|
73
73
|
clearIndexedMessagesInTransaction2,
|
|
74
74
|
indexSourcesAfterOrdinal2
|
|
75
|
-
} from "./server-
|
|
75
|
+
} from "./server-7srtwsa4.js";
|
|
76
76
|
import {
|
|
77
77
|
detectOverflow,
|
|
78
78
|
SESSION_META_SELECT_COLUMNS,
|
|
@@ -138,9 +138,13 @@ import {
|
|
|
138
138
|
THINKING_BINDING_STRIP_ORDER_END_MARKER,
|
|
139
139
|
getMergedReasoningStrippedIds,
|
|
140
140
|
addMergedReasoningStrippedIds,
|
|
141
|
+
parseProcessedImageMarkers,
|
|
142
|
+
serializeProcessedImageMarkers,
|
|
141
143
|
getPendingCompactionMarkerState,
|
|
142
144
|
setPendingCompactionMarkerState,
|
|
143
145
|
clearPendingCompactionMarkerStateIf,
|
|
146
|
+
getPendingPiCompactionMarkerState,
|
|
147
|
+
logPiCompactionMarkerClear,
|
|
144
148
|
resolveHostServedBoundaryId2,
|
|
145
149
|
hasRawMessageProvider2,
|
|
146
150
|
withRawSessionMessageCache2,
|
|
@@ -157,7 +161,7 @@ import {
|
|
|
157
161
|
getRawSessionTagKeysThrough2,
|
|
158
162
|
getLegacyProtectedTailStartOrdinal2,
|
|
159
163
|
readSessionChunk2
|
|
160
|
-
} from "./server-
|
|
164
|
+
} from "./server-gtv9wbhq.js";
|
|
161
165
|
import {
|
|
162
166
|
getTableColumnNames
|
|
163
167
|
} from "./server-6byqfbqf.js";
|
|
@@ -167,7 +171,7 @@ import {
|
|
|
167
171
|
LATEST_SUPPORTED_VERSION,
|
|
168
172
|
getPersistedSchemaVersion,
|
|
169
173
|
openDatabase
|
|
170
|
-
} from "./server-
|
|
174
|
+
} from "./server-v4fwha43.js";
|
|
171
175
|
import {
|
|
172
176
|
providerMass,
|
|
173
177
|
calibrationForModelKey,
|
|
@@ -185,11 +189,11 @@ import {
|
|
|
185
189
|
foldShrunkPartTags2,
|
|
186
190
|
getTagNumberByMessageId2,
|
|
187
191
|
getActiveTagsBySession2
|
|
188
|
-
} from "./server-
|
|
192
|
+
} from "./server-w3zeywp1.js";
|
|
189
193
|
import {
|
|
190
194
|
isStrictGapHealingMessage2,
|
|
191
195
|
noteRawSessionSummaryRowWritten2
|
|
192
|
-
} from "./server-
|
|
196
|
+
} from "./server-dd0nja67.js";
|
|
193
197
|
import {
|
|
194
198
|
resolveOpenCodeDbPath,
|
|
195
199
|
assertOpenCodeStoreGeneration,
|
|
@@ -199,7 +203,7 @@ import {
|
|
|
199
203
|
import {
|
|
200
204
|
withReadOnlySessionDb,
|
|
201
205
|
getMessageTimesFromOpenCodeDb
|
|
202
|
-
} from "./server-
|
|
206
|
+
} from "./server-wkdgjjch.js";
|
|
203
207
|
import {
|
|
204
208
|
getMeasuredToolDefinitionTokens
|
|
205
209
|
} from "./server-7ekna9zs.js";
|
|
@@ -218,11 +222,11 @@ import {
|
|
|
218
222
|
resolveStoredPathWorkspaceIdentity,
|
|
219
223
|
sourceNameForMemory,
|
|
220
224
|
computeWorkspaceEpochFingerprint
|
|
221
|
-
} from "./server-
|
|
225
|
+
} from "./server-hcvcxzx7.js";
|
|
222
226
|
import {
|
|
223
227
|
shouldSkipHomeProjectMemory,
|
|
224
228
|
resolveProjectIdentity
|
|
225
|
-
} from "./server-
|
|
229
|
+
} from "./server-kdrezdy0.js";
|
|
226
230
|
import {
|
|
227
231
|
drainBackgroundBatches,
|
|
228
232
|
contentSha2562,
|
|
@@ -230,7 +234,7 @@ import {
|
|
|
230
234
|
getProjectChunkEmbeddingModelId2,
|
|
231
235
|
getProjectEmbeddingMaxInputTokens2,
|
|
232
236
|
embedItemsForProject2
|
|
233
|
-
} from "./server-
|
|
237
|
+
} from "./server-fw31krgq.js";
|
|
234
238
|
import {
|
|
235
239
|
getSessionNotes,
|
|
236
240
|
getReadySmartNotes,
|
|
@@ -239,13 +243,13 @@ import {
|
|
|
239
243
|
userFacingFailureCode,
|
|
240
244
|
promoteSessionFactsDurable,
|
|
241
245
|
embedPromotedFacts
|
|
242
|
-
} from "./server-
|
|
246
|
+
} from "./server-jdwd03ep.js";
|
|
243
247
|
import {
|
|
244
248
|
isMarkerCandidateBasisCurrent2,
|
|
245
249
|
invalidateMarkerCandidateBasis2,
|
|
246
250
|
readMarkerCandidateBasis2,
|
|
247
251
|
prepareMarkerCandidateBasis2
|
|
248
|
-
} from "./server-
|
|
252
|
+
} from "./server-x08d1xf3.js";
|
|
249
253
|
import {
|
|
250
254
|
computeCueContentHash,
|
|
251
255
|
getMuralCueState,
|
|
@@ -253,7 +257,7 @@ import {
|
|
|
253
257
|
getMemoriesByProject2,
|
|
254
258
|
getMemoriesByProjects2,
|
|
255
259
|
getMaxMemoryIdForProjects2
|
|
256
|
-
} from "./server-
|
|
260
|
+
} from "./server-9yyqq3mm.js";
|
|
257
261
|
import {
|
|
258
262
|
pushNotification2
|
|
259
263
|
} from "./server-x8a7jmkh.js";
|
|
@@ -264,7 +268,7 @@ import {
|
|
|
264
268
|
} from "./server-t528t8qm.js";
|
|
265
269
|
import {
|
|
266
270
|
sendStatusNotification2
|
|
267
|
-
} from "./server-
|
|
271
|
+
} from "./server-qcw43339.js";
|
|
268
272
|
import {
|
|
269
273
|
getErrorMessage,
|
|
270
274
|
describeError
|
|
@@ -1882,13 +1886,17 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
|
|
|
1882
1886
|
function clearSession(db, sessionId, rustModuleCleanupAcknowledged = false, permanentlyDeleted = false) {
|
|
1883
1887
|
cancelAutoSearchWork(sessionId);
|
|
1884
1888
|
let transactionStartedAt = 0;
|
|
1889
|
+
let clearedMarker = null;
|
|
1885
1890
|
withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(() => db.transaction(() => {
|
|
1886
1891
|
transactionStartedAt = performance.now();
|
|
1892
|
+
clearedMarker = getPendingPiCompactionMarkerState(db, sessionId);
|
|
1887
1893
|
deleteSessionScopedRows(db, [sessionId], undefined, {
|
|
1888
1894
|
rustModuleCleanupAcknowledged,
|
|
1889
1895
|
preserveTagRevisionTombstones: !permanentlyDeleted
|
|
1890
1896
|
});
|
|
1891
1897
|
}).immediate()));
|
|
1898
|
+
if (clearedMarker)
|
|
1899
|
+
logPiCompactionMarkerClear(sessionId, clearedMarker, "session-reset");
|
|
1892
1900
|
clearUnpublishedAutoSearchNoHints(sessionId);
|
|
1893
1901
|
logSlowWriteTransaction("clear-session", transactionStartedAt);
|
|
1894
1902
|
}
|
|
@@ -2278,6 +2286,9 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
|
|
|
2278
2286
|
}
|
|
2279
2287
|
const layout = layoutLkgPrefix(slot.jsonPrefix);
|
|
2280
2288
|
try {
|
|
2289
|
+
const inputIdSeq = JSON.stringify(slot.piOutputEntryIds ? { version: 1, inputIds: slot.inputIdSeq, piOutputEntryIds: slot.piOutputEntryIds } : slot.inputIdSeq);
|
|
2290
|
+
const inputContentDigests = JSON.stringify(slot.inputContentDigests);
|
|
2291
|
+
const inputContentSignatures = slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null;
|
|
2281
2292
|
db.transaction(() => {
|
|
2282
2293
|
const storedHashes = new Map;
|
|
2283
2294
|
for (const row of db.prepare("SELECT chunk, hash FROM lkg_slot_chunks WHERE session_id = ?").all(sessionId)) {
|
|
@@ -2309,11 +2320,7 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
|
|
|
2309
2320
|
provider_key = excluded.provider_key,
|
|
2310
2321
|
captured_at = excluded.captured_at,
|
|
2311
2322
|
row_version = excluded.row_version,
|
|
2312
|
-
capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash,
|
|
2313
|
-
version: 1,
|
|
2314
|
-
inputIds: slot.inputIdSeq,
|
|
2315
|
-
piOutputEntryIds: slot.piOutputEntryIds
|
|
2316
|
-
} : slot.inputIdSeq), JSON.stringify(slot.inputContentDigests), slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
|
|
2323
|
+
capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, inputIdSeq, inputContentDigests, inputContentSignatures, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
|
|
2317
2324
|
publishMetadata?.();
|
|
2318
2325
|
}).immediate();
|
|
2319
2326
|
rememberFingerprint(db, sessionId, fingerprint);
|
|
@@ -4227,6 +4234,9 @@ function filterIdBlob(raw, filter) {
|
|
|
4227
4234
|
return "";
|
|
4228
4235
|
}
|
|
4229
4236
|
}
|
|
4237
|
+
function filterProcessedImageBlob(raw, filter) {
|
|
4238
|
+
return serializeProcessedImageMarkers(new Map([...parseProcessedImageMarkers(raw)].filter(([id]) => filter.includeMessageId(id)).map(([id, marker]) => [mapMessageId(filter, id) ?? id, marker])));
|
|
4239
|
+
}
|
|
4230
4240
|
function filterStrippedPlaceholderBlob(raw, filter) {
|
|
4231
4241
|
const state = parseStrippedPlaceholderState(raw);
|
|
4232
4242
|
const keep = (ids) => ids.filter((id) => filter.includeMessageId(id)).map((id) => mapMessageId(filter, id) ?? id);
|
|
@@ -4308,7 +4318,8 @@ function clampWatermark(value, maxCopiedTag) {
|
|
|
4308
4318
|
return Math.min(Math.floor(value), maxCopiedTag);
|
|
4309
4319
|
}
|
|
4310
4320
|
function copySessionStateForClone(db, sourceSessionId, destinationSessionId, filter) {
|
|
4311
|
-
|
|
4321
|
+
let clearedMarker = null;
|
|
4322
|
+
const result = runImmediate(db, () => {
|
|
4312
4323
|
const hasTemporalDecisions = tableExists(db, "temporal_decisions");
|
|
4313
4324
|
if (filter.requireEmptyDestinationMeta === true && countRows(db, "session_meta", destinationSessionId) > 0 || countRows(db, "compartments", destinationSessionId) > 0 || countRows(db, "tags", destinationSessionId) > 0 || hasTemporalDecisions && countRows(db, "temporal_decisions", destinationSessionId) > 0 || filter.copySessionNotesAndFacts === true && (tableExists(db, "notes") && countRows(db, "notes", destinationSessionId) > 0 || tableExists(db, "session_facts") && countRows(db, "session_facts", destinationSessionId) > 0)) {
|
|
4314
4325
|
return {
|
|
@@ -4420,6 +4431,8 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4420
4431
|
FROM session_meta WHERE session_id = ?`).get(sourceSessionId);
|
|
4421
4432
|
const maxCopiedTag = copiedTagNumbers.reduce((max, value) => Math.max(max, value), 0);
|
|
4422
4433
|
const pendingMarker = filter.selectPendingPiMarker(meta?.pending_pi_compaction_marker_state ?? null, copiedCompartments);
|
|
4434
|
+
if (pendingMarker === null)
|
|
4435
|
+
clearedMarker = getPendingPiCompactionMarkerState(db, destinationSessionId);
|
|
4423
4436
|
const todoAnchor = meta?.todo_synthetic_anchor_message_id ?? "";
|
|
4424
4437
|
const migrateTodo = todoAnchor.length > 0 && filter.includeMessageId(todoAnchor);
|
|
4425
4438
|
db.prepare(`INSERT INTO session_meta
|
|
@@ -4446,7 +4459,7 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4446
4459
|
todo_synthetic_anchor_message_id = excluded.todo_synthetic_anchor_message_id,
|
|
4447
4460
|
todo_synthetic_state_json = excluded.todo_synthetic_state_json,
|
|
4448
4461
|
cached_m0_bytes = NULL,
|
|
4449
|
-
cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter),
|
|
4462
|
+
cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter), filterProcessedImageBlob(meta?.processed_image_stripped_ids ?? null, filter), clonePiContentDecisions(meta?.merged_reasoning_stripped_ids ?? null, filter), pendingMarker, migrateTodo ? meta?.last_todo_state ?? "" : "", migrateTodo ? meta?.todo_synthetic_call_id ?? "" : "", migrateTodo ? mapMessageId(filter, todoAnchor) ?? "" : "", migrateTodo ? meta?.todo_synthetic_state_json ?? "" : "");
|
|
4450
4463
|
const metaColumnRows = db.prepare("PRAGMA table_info(session_meta)").all();
|
|
4451
4464
|
const metaColumns = new Set(metaColumnRows.map((column) => column.name));
|
|
4452
4465
|
if (metaColumns.has("trailing_blank_decisions")) {
|
|
@@ -4464,6 +4477,9 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4464
4477
|
pendingMarkerMigrated: pendingMarker !== null
|
|
4465
4478
|
};
|
|
4466
4479
|
});
|
|
4480
|
+
if (clearedMarker)
|
|
4481
|
+
logPiCompactionMarkerClear(destinationSessionId, clearedMarker, "clone-replaced");
|
|
4482
|
+
return result;
|
|
4467
4483
|
}
|
|
4468
4484
|
// src/features/magic-context/historian-failure-reason.ts
|
|
4469
4485
|
var MAX_HISTORIAN_FAILURE_REASON_LENGTH = 512;
|
|
@@ -5507,7 +5523,7 @@ class HiddenCompletionRefusal extends Error {
|
|
|
5507
5523
|
|
|
5508
5524
|
// src/features/magic-context/compaction-marker.ts
|
|
5509
5525
|
import { createHash as createHash7 } from "node:crypto";
|
|
5510
|
-
import { existsSync } from "node:fs";
|
|
5526
|
+
import { existsSync, statSync as statSync4 } from "node:fs";
|
|
5511
5527
|
var BASE62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
5512
5528
|
var ID_PREFIX_HEX_LENGTH = 12;
|
|
5513
5529
|
var ID_SUFFIX_LENGTH = 14;
|
|
@@ -5545,6 +5561,7 @@ function runMarkerRemovalTransaction(db, operation) {
|
|
|
5545
5561
|
function runMarkerWriteTransaction(db, site, operation) {
|
|
5546
5562
|
if (db.inTransaction)
|
|
5547
5563
|
return db.transaction(operation).immediate();
|
|
5564
|
+
const walBefore = markerWalPages(db);
|
|
5548
5565
|
const startedAt = performance.now();
|
|
5549
5566
|
let acquiredAt;
|
|
5550
5567
|
let workFinishedAt;
|
|
@@ -5568,9 +5585,22 @@ function runMarkerWriteTransaction(db, site, operation) {
|
|
|
5568
5585
|
const endMs = workFinishedAt === undefined ? 0 : finishedAt - workFinishedAt;
|
|
5569
5586
|
try {
|
|
5570
5587
|
log2(`[magic-context] sqlite writer site=${site} db=opencode acquire_ms=${Math.round(acquireMs)} hold_ms=${Math.round(holdMs)} work_ms=${Math.round(workMs)} end_ms=${Math.round(endMs)} outcome=${acquiredAt === undefined ? "not_acquired" : committed ? "committed" : "failed"}`);
|
|
5588
|
+
if (finishedAt - startedAt > 100) {
|
|
5589
|
+
const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").get();
|
|
5590
|
+
log2(`[magic-context] compaction-marker slow writer site=${site} acquire_ms=${acquireMs.toFixed(1)} statements_ms=${workMs.toFixed(1)} ${committed ? "commit" : "rollback"}_ms=${endMs.toFixed(1)} wal_autocheckpoint=${autoCheckpoint.wal_autocheckpoint} wal_pages_before=${walBefore ?? "unknown"} wal_pages_after=${markerWalPages(db) ?? "unknown"}`);
|
|
5591
|
+
}
|
|
5571
5592
|
} catch {}
|
|
5572
5593
|
}
|
|
5573
5594
|
}
|
|
5595
|
+
function markerWalPages(db) {
|
|
5596
|
+
try {
|
|
5597
|
+
const row = db.prepare("PRAGMA page_size").get();
|
|
5598
|
+
const bytes = statSync4(`${getOpenCodeDbPath()}-wal`).size;
|
|
5599
|
+
return Math.max(0, Math.floor((bytes - 32) / (row.page_size + 24)));
|
|
5600
|
+
} catch {
|
|
5601
|
+
return null;
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5574
5604
|
var REQUIRED_MESSAGE_COLUMNS = ["id", "session_id", "time_created", "time_updated", "data"];
|
|
5575
5605
|
var REQUIRED_PART_COLUMNS = [
|
|
5576
5606
|
"id",
|
|
@@ -5631,6 +5661,7 @@ function getWritableOpenCodeDb(purpose = "publication") {
|
|
|
5631
5661
|
const timeoutMs = purpose === "removal" ? MARKER_REMOVAL_BUSY_TIMEOUT_MS : MARKER_BUSY_TIMEOUT_MS;
|
|
5632
5662
|
db.exec(`PRAGMA busy_timeout=${timeoutMs}`);
|
|
5633
5663
|
db.exec("PRAGMA journal_mode=WAL");
|
|
5664
|
+
db.exec("PRAGMA wal_autocheckpoint=0");
|
|
5634
5665
|
if (purpose === "removal")
|
|
5635
5666
|
cachedRemovalDb = { path: dbPath, db };
|
|
5636
5667
|
else
|
|
@@ -7837,7 +7868,7 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
7837
7868
|
}
|
|
7838
7869
|
}
|
|
7839
7870
|
// src/shared/prompt-surface-runtime.ts
|
|
7840
|
-
import { existsSync as existsSync2, readFileSync as readFileSync3, statSync as
|
|
7871
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, statSync as statSync5 } from "node:fs";
|
|
7841
7872
|
import { dirname, isAbsolute, resolve as resolve2 } from "node:path";
|
|
7842
7873
|
|
|
7843
7874
|
// src/tools/light-descriptions.ts
|
|
@@ -7901,7 +7932,7 @@ function createPromptSurfaceRuntime(options) {
|
|
|
7901
7932
|
const path = isAbsolute(configuredPath) ? configuredPath : resolve2(userConfigDirectory, configuredPath);
|
|
7902
7933
|
let content;
|
|
7903
7934
|
try {
|
|
7904
|
-
if (!
|
|
7935
|
+
if (!statSync5(path).isFile()) {
|
|
7905
7936
|
warnOnce(`guidance-not-file:${path}`, `prompt_surface.guidance_override_path (${path}) is not a file; using built-in guidance.`);
|
|
7906
7937
|
return;
|
|
7907
7938
|
}
|
|
@@ -16071,7 +16102,7 @@ function observeNoteNudgeServe(args) {
|
|
|
16071
16102
|
sessions.set(args.sessionId, seen);
|
|
16072
16103
|
return {
|
|
16073
16104
|
isFirstServe: warm && args.isLiveTail && firstServe,
|
|
16074
|
-
|
|
16105
|
+
prefixRewriteCoversAnchor: args.anchorMessageId !== null && args.prefixRewriteCoversAnchor
|
|
16075
16106
|
};
|
|
16076
16107
|
}
|
|
16077
16108
|
var NOTE_NUDGE_COOLDOWN_MS = 15 * 60 * 1000;
|
|
@@ -16110,7 +16141,7 @@ function peekNoteNudgeText(db, sessionId, currentUserMessageId, projectIdentity,
|
|
|
16110
16141
|
const state = getPersistedNoteNudge(db, sessionId);
|
|
16111
16142
|
if (!state.triggerPending)
|
|
16112
16143
|
return null;
|
|
16113
|
-
if (eligibility && !eligibility.isFirstServe && !eligibility.
|
|
16144
|
+
if (eligibility && !eligibility.isFirstServe && !eligibility.prefixRewriteCoversAnchor) {
|
|
16114
16145
|
sessionLog2(sessionId, "note-nudge: deferring — user already served or first serve unproven");
|
|
16115
16146
|
return null;
|
|
16116
16147
|
}
|
|
@@ -18798,4 +18829,4 @@ ${failure}`;
|
|
|
18798
18829
|
}
|
|
18799
18830
|
}
|
|
18800
18831
|
|
|
18801
|
-
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, 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, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, 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 };
|
|
18832
|
+
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, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, 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 };
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
buildCanonicalChunkTextFromFts,
|
|
19
19
|
loadCompartmentChunkEmbeddingsForSearch
|
|
20
|
-
} from "./server-
|
|
20
|
+
} from "./server-fpqe39as.js";
|
|
21
21
|
import {
|
|
22
22
|
recordEmbeddingMeasurement,
|
|
23
23
|
saveCommitEmbedding,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
enqueueShadowEmbeddingItems2,
|
|
35
35
|
getProjectEmbeddingSnapshot2,
|
|
36
36
|
embedItemsForProject2
|
|
37
|
-
} from "./server-
|
|
37
|
+
} from "./server-fw31krgq.js";
|
|
38
38
|
import {
|
|
39
39
|
getProjectEmbeddings2
|
|
40
40
|
} from "./server-4dhv7mqz.js";
|
|
@@ -43,13 +43,13 @@ import {
|
|
|
43
43
|
isEmbeddingEnabled,
|
|
44
44
|
embedText,
|
|
45
45
|
ensureMemoryEmbeddings2
|
|
46
|
-
} from "./server-
|
|
46
|
+
} from "./server-sy4b1sra.js";
|
|
47
47
|
import {
|
|
48
48
|
ModuleMemoryAuthorityError2,
|
|
49
49
|
getMemoriesByProject2,
|
|
50
50
|
getMemoriesByProjects2,
|
|
51
51
|
updateMemoryRetrievalCount2
|
|
52
|
-
} from "./server-
|
|
52
|
+
} from "./server-9yyqq3mm.js";
|
|
53
53
|
import {
|
|
54
54
|
getNotes,
|
|
55
55
|
getActivePrimers,
|
|
@@ -58,20 +58,20 @@ import {
|
|
|
58
58
|
sanitizeFtsQuery,
|
|
59
59
|
searchMemoriesFTS,
|
|
60
60
|
searchMemoriesFTSUnion
|
|
61
|
-
} from "./server-
|
|
61
|
+
} from "./server-jdwd03ep.js";
|
|
62
62
|
import {
|
|
63
63
|
isRecord
|
|
64
|
-
} from "./server-
|
|
64
|
+
} from "./server-w3zeywp1.js";
|
|
65
65
|
import {
|
|
66
66
|
getIndexedMessageCorpusSize2
|
|
67
|
-
} from "./server-
|
|
67
|
+
} from "./server-7srtwsa4.js";
|
|
68
68
|
import {
|
|
69
69
|
resolveWorkspaceShareCategories,
|
|
70
70
|
resolveWorkspaceIdentitySet,
|
|
71
71
|
expandWorkspaceIdentitySetWithAliases,
|
|
72
72
|
resolveStoredPathWorkspaceIdentity,
|
|
73
73
|
sourceNameForMemory
|
|
74
|
-
} from "./server-
|
|
74
|
+
} from "./server-hcvcxzx7.js";
|
|
75
75
|
import {
|
|
76
76
|
isKnownAutocommit
|
|
77
77
|
} from "./server-8ajstryz.js";
|
|
@@ -1255,6 +1255,61 @@ function searchGitCommitsSync(db, projectPath, query, options) {
|
|
|
1255
1255
|
});
|
|
1256
1256
|
return results.slice(0, options.limit);
|
|
1257
1257
|
}
|
|
1258
|
+
// src/features/magic-context/message-fts-session-filter.ts
|
|
1259
|
+
var MESSAGE_FTS_SESSION_FILTER_SQL = `+message_history_fts.rowid IN (
|
|
1260
|
+
SELECT fts_rowid FROM message_fts_rowid_map WHERE session_id = ?1
|
|
1261
|
+
) AND `;
|
|
1262
|
+
var coverageCaches = new WeakMap;
|
|
1263
|
+
function getCoverageCache(db) {
|
|
1264
|
+
let cache = coverageCaches.get(db);
|
|
1265
|
+
if (!cache) {
|
|
1266
|
+
cache = {
|
|
1267
|
+
pin: db.prepare("SELECT fts_rowid FROM message_fts_rowid_map LIMIT 1"),
|
|
1268
|
+
stamp: db.prepare("SELECT total_changes() AS changes, data_version AS version FROM pragma_data_version"),
|
|
1269
|
+
missing: db.prepare(`SELECT DISTINCT session_id AS sessionId
|
|
1270
|
+
FROM message_history_fts WHERE rowid IN (
|
|
1271
|
+
SELECT id FROM message_history_fts_docsize
|
|
1272
|
+
EXCEPT SELECT fts_rowid FROM message_fts_rowid_map
|
|
1273
|
+
)`)
|
|
1274
|
+
};
|
|
1275
|
+
coverageCaches.set(db, cache);
|
|
1276
|
+
}
|
|
1277
|
+
return cache;
|
|
1278
|
+
}
|
|
1279
|
+
function withMessageFtsSessionFilter(db, sessionId, read) {
|
|
1280
|
+
let cacheable = false;
|
|
1281
|
+
try {
|
|
1282
|
+
const transaction = db;
|
|
1283
|
+
cacheable = transaction.inTransaction === false || transaction.isTransaction === false;
|
|
1284
|
+
if (!cacheable)
|
|
1285
|
+
coverageCaches.delete(db);
|
|
1286
|
+
} catch {
|
|
1287
|
+
coverageCaches.delete(db);
|
|
1288
|
+
}
|
|
1289
|
+
return db.transaction(() => {
|
|
1290
|
+
let sessionFirst = false;
|
|
1291
|
+
try {
|
|
1292
|
+
const cache = getCoverageCache(db);
|
|
1293
|
+
cache.pin.get();
|
|
1294
|
+
const stamp = cache.stamp.get();
|
|
1295
|
+
let incomplete = cache.incompleteSessions;
|
|
1296
|
+
if (!cacheable || !incomplete || cache.version !== stamp.version || cache.changes !== stamp.changes) {
|
|
1297
|
+
const rows = cache.missing.all();
|
|
1298
|
+
incomplete = new Set(rows.map((row) => row.sessionId));
|
|
1299
|
+
if (cacheable) {
|
|
1300
|
+
cache.version = stamp.version;
|
|
1301
|
+
cache.changes = stamp.changes;
|
|
1302
|
+
cache.incompleteSessions = incomplete;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
sessionFirst = !incomplete.has(sessionId);
|
|
1306
|
+
} catch {
|
|
1307
|
+
coverageCaches.delete(db);
|
|
1308
|
+
}
|
|
1309
|
+
return read(sessionFirst);
|
|
1310
|
+
}).deferred();
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1258
1313
|
// src/features/magic-context/literal-probes.ts
|
|
1259
1314
|
var MAX_PROBES = 5;
|
|
1260
1315
|
var MIN_PROBE_LENGTH = 3;
|
|
@@ -1311,61 +1366,6 @@ function containsProbeVerbatim(text, probes) {
|
|
|
1311
1366
|
return probes.some((probe) => haystack.includes(probe.toLowerCase()));
|
|
1312
1367
|
}
|
|
1313
1368
|
|
|
1314
|
-
// src/features/magic-context/message-fts-session-filter.ts
|
|
1315
|
-
var MESSAGE_FTS_SESSION_FILTER_SQL = `+message_history_fts.rowid IN (
|
|
1316
|
-
SELECT fts_rowid FROM message_fts_rowid_map WHERE session_id = ?1
|
|
1317
|
-
) AND `;
|
|
1318
|
-
var coverageCaches = new WeakMap;
|
|
1319
|
-
function getCoverageCache(db) {
|
|
1320
|
-
let cache = coverageCaches.get(db);
|
|
1321
|
-
if (!cache) {
|
|
1322
|
-
cache = {
|
|
1323
|
-
pin: db.prepare("SELECT fts_rowid FROM message_fts_rowid_map LIMIT 1"),
|
|
1324
|
-
stamp: db.prepare("SELECT total_changes() AS changes, data_version AS version FROM pragma_data_version"),
|
|
1325
|
-
missing: db.prepare(`SELECT DISTINCT session_id AS sessionId
|
|
1326
|
-
FROM message_history_fts WHERE rowid IN (
|
|
1327
|
-
SELECT id FROM message_history_fts_docsize
|
|
1328
|
-
EXCEPT SELECT fts_rowid FROM message_fts_rowid_map
|
|
1329
|
-
)`)
|
|
1330
|
-
};
|
|
1331
|
-
coverageCaches.set(db, cache);
|
|
1332
|
-
}
|
|
1333
|
-
return cache;
|
|
1334
|
-
}
|
|
1335
|
-
function withMessageFtsSessionFilter(db, sessionId, read) {
|
|
1336
|
-
let cacheable = false;
|
|
1337
|
-
try {
|
|
1338
|
-
const transaction = db;
|
|
1339
|
-
cacheable = transaction.inTransaction === false || transaction.isTransaction === false;
|
|
1340
|
-
if (!cacheable)
|
|
1341
|
-
coverageCaches.delete(db);
|
|
1342
|
-
} catch {
|
|
1343
|
-
coverageCaches.delete(db);
|
|
1344
|
-
}
|
|
1345
|
-
return db.transaction(() => {
|
|
1346
|
-
let sessionFirst = false;
|
|
1347
|
-
try {
|
|
1348
|
-
const cache = getCoverageCache(db);
|
|
1349
|
-
cache.pin.get();
|
|
1350
|
-
const stamp = cache.stamp.get();
|
|
1351
|
-
let incomplete = cache.incompleteSessions;
|
|
1352
|
-
if (!cacheable || !incomplete || cache.version !== stamp.version || cache.changes !== stamp.changes) {
|
|
1353
|
-
const rows = cache.missing.all();
|
|
1354
|
-
incomplete = new Set(rows.map((row) => row.sessionId));
|
|
1355
|
-
if (cacheable) {
|
|
1356
|
-
cache.version = stamp.version;
|
|
1357
|
-
cache.changes = stamp.changes;
|
|
1358
|
-
cache.incompleteSessions = incomplete;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
sessionFirst = !incomplete.has(sessionId);
|
|
1362
|
-
} catch {
|
|
1363
|
-
coverageCaches.delete(db);
|
|
1364
|
-
}
|
|
1365
|
-
return read(sessionFirst);
|
|
1366
|
-
}).deferred();
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
1369
|
// src/features/magic-context/search-measurement.ts
|
|
1370
1370
|
import { createHash as createHash2 } from "node:crypto";
|
|
1371
1371
|
function resultId(result) {
|
|
@@ -3240,7 +3240,7 @@ ${diagnosticLines.join(`
|
|
|
3240
3240
|
bodyParts.push(diagnosticLines.join(`
|
|
3241
3241
|
`));
|
|
3242
3242
|
if (results.some((result) => result.source === "message" || result.source === "compartment")) {
|
|
3243
|
-
bodyParts.push("Use ctx_expand(start, end) with the range from any message result above to read the
|
|
3243
|
+
bodyParts.push("Use ctx_expand(start, end) with the range from any message result above to read the conversation context. If the host no longer holds those messages, ctx_expand returns indexed text from the search archive only, with no surrounding messages or tool output.");
|
|
3244
3244
|
}
|
|
3245
3245
|
if (results.some((result) => result.source === "note" && result.anchorOrdinal !== null && result.sourceSessionId === currentSessionId)) {
|
|
3246
3246
|
bodyParts.push(SEARCH_NOTE_EXPAND_HINT);
|
|
@@ -3252,4 +3252,4 @@ ${bodyParts.join(`
|
|
|
3252
3252
|
`)}`;
|
|
3253
3253
|
}
|
|
3254
3254
|
|
|
3255
|
-
export { renderSingleStoreMigrationRequiredRefusal, SingleStoreMigrationRequiredError, singleStoreMigrationRequiredFailure, projectNeedsSingleStoreMigration, STORE_AHEAD_OF_BINARY_CODE, storeAheadOfBinaryFailure, TRANSFORM_PAGE_UPLOAD_TIMEOUT_MS, transformColdStartExecuteTimeoutMs, getDefaultSubcConnectionFile, isModuleTransportGenerationChangedResult, SubcModuleTransport, indexCommitsForProject, embedUnembeddedCommits, createUnifiedSearchDiagnostics2, searchMessageHistory2, parseIdShapedQuery2, resolveMemoriesByIdsForSearch2, unifiedSearch2, formatSearchResults2 };
|
|
3255
|
+
export { renderSingleStoreMigrationRequiredRefusal, SingleStoreMigrationRequiredError, singleStoreMigrationRequiredFailure, projectNeedsSingleStoreMigration, STORE_AHEAD_OF_BINARY_CODE, storeAheadOfBinaryFailure, TRANSFORM_PAGE_UPLOAD_TIMEOUT_MS, transformColdStartExecuteTimeoutMs, getDefaultSubcConnectionFile, isModuleTransportGenerationChangedResult, SubcModuleTransport, indexCommitsForProject, embedUnembeddedCommits, withMessageFtsSessionFilter, createUnifiedSearchDiagnostics2, searchMessageHistory2, parseIdShapedQuery2, resolveMemoriesByIdsForSearch2, unifiedSearch2, formatSearchResults2 };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getHarness2,
|
|
2
3
|
harnessOwnsOpenCodeStore2
|
|
3
4
|
} from "./server-pavzsdc6.js";
|
|
4
5
|
import {
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
parseRpcPortFile,
|
|
20
21
|
inspectProcessesAsync,
|
|
21
22
|
inspectWindowsProcessesSync
|
|
22
|
-
} from "./server-
|
|
23
|
+
} from "./server-1rfgbjfn.js";
|
|
23
24
|
import {
|
|
24
25
|
registerSlowWriteReporter2,
|
|
25
26
|
registerSqliteDiagnosticSink2,
|
|
@@ -29,13 +30,13 @@ import {
|
|
|
29
30
|
withoutSqliteTransformPass2,
|
|
30
31
|
isTransientSqliteError2,
|
|
31
32
|
withPrivilegedWriter2
|
|
32
|
-
} from "./server-
|
|
33
|
+
} from "./server-j8epsc0g.js";
|
|
33
34
|
import {
|
|
34
35
|
configureContextDatabasePragmas2
|
|
35
36
|
} from "./server-fb3zxn06.js";
|
|
36
37
|
import {
|
|
37
38
|
startMessageFtsRowidMapBackfill
|
|
38
|
-
} from "./server-
|
|
39
|
+
} from "./server-brhj8qtd.js";
|
|
39
40
|
import {
|
|
40
41
|
LKG_SLOT_CHUNKS_DDL,
|
|
41
42
|
SESSION_REPLAY_DECISIONS_DDL,
|
|
@@ -45,7 +46,7 @@ import {
|
|
|
45
46
|
hasPendingMigrations,
|
|
46
47
|
getMainThreadMigrationBodyCount,
|
|
47
48
|
runMigrations
|
|
48
|
-
} from "./server-
|
|
49
|
+
} from "./server-hcvcxzx7.js";
|
|
49
50
|
import {
|
|
50
51
|
ensureColumn,
|
|
51
52
|
installV95PerfSchema,
|
|
@@ -58,7 +59,7 @@ import {
|
|
|
58
59
|
import {
|
|
59
60
|
bootQuietRemainingMs,
|
|
60
61
|
scheduleAfterBootQuiet
|
|
61
|
-
} from "./server-
|
|
62
|
+
} from "./server-kdrezdy0.js";
|
|
62
63
|
import {
|
|
63
64
|
setDatabase,
|
|
64
65
|
loadToolDefinitionMeasurements
|
|
@@ -749,7 +750,7 @@ function backfillToolOwnersInChunks(db, result) {
|
|
|
749
750
|
|
|
750
751
|
// src/features/magic-context/storage-db.ts
|
|
751
752
|
registerSlowWriteReporter2(logSlowWriteTransaction);
|
|
752
|
-
registerSqliteDiagnosticSink2((message) => log2(message));
|
|
753
|
+
registerSqliteDiagnosticSink2((message) => log2(message), getHarness2);
|
|
753
754
|
var databases = new Map;
|
|
754
755
|
var pendingAsyncOpens = new Map;
|
|
755
756
|
var persistenceByDatabase = new WeakMap;
|
|
@@ -1198,8 +1199,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1198
1199
|
startMessageFtsRowidMapBackfill(db).then(async () => {
|
|
1199
1200
|
if (!readsOpenCodeStore)
|
|
1200
1201
|
return;
|
|
1201
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1202
|
-
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-
|
|
1202
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-4sat83cx.js"));
|
|
1203
|
+
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-2z365239.js"));
|
|
1203
1204
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
1204
1205
|
readPage: readRawSessionMessagePage
|
|
1205
1206
|
}));
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./server-t4k4qexw.js";
|
|
7
7
|
import {
|
|
8
8
|
getSqliteDatabasePath2
|
|
9
|
-
} from "./server-
|
|
9
|
+
} from "./server-j8epsc0g.js";
|
|
10
10
|
|
|
11
11
|
// src/features/magic-context/compaction-marker-candidates.ts
|
|
12
12
|
import { existsSync, realpathSync } from "node:fs";
|