@cortexkit/opencode-magic-context 0.49.16 → 0.49.17
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 +76 -63
- package/dist/chunk-embedding-write-worker.js +11 -11
- package/dist/{compaction-marker-candidates-v5c6997n.js → compaction-marker-candidates-n4krhat4.js} +2 -2
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/config/schema/magic-context.d.ts +394 -394
- package/dist/{conflict-warning-hook-znry4j76.js → conflict-warning-hook-4pmz879v.js} +5 -5
- package/dist/{context-3znk23va.js → context-yhetp0kn.js} +294 -144
- package/dist/{embedding-backfill-q4n8dend.js → embedding-backfill-fmz50tsy.js} +11 -11
- package/dist/embedding-worker-process.js +1 -1
- package/dist/embedding-worker.js +4 -4
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/indexer.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity-cache.d.ts +2 -0
- package/dist/features/magic-context/memory/project-identity-cache.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +1 -1
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +5 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +6 -1
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +2 -2
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts +9 -1
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-deadline.d.ts +2 -1
- package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-hint.d.ts +3 -0
- package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +10 -2
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-diagnostics.d.ts +8 -0
- package/dist/hooks/magic-context/system-prompt-diagnostics.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +6 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/todo-view.d.ts +2 -2
- package/dist/hooks/magic-context/tool-drop-target.d.ts +3 -2
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-stage-logger.d.ts +3 -0
- package/dist/hooks/magic-context/transform-stage-logger.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-9nkg2dzk.js → index-24fezq97.js} +3 -3
- package/dist/{index-a8bvhwqs.js → index-2vxtcb95.js} +32 -3
- package/dist/{index-f71thw8j.js → index-4s3t0nd0.js} +1 -1
- package/dist/{index-kn4t1haw.js → index-4yt7dtf4.js} +450 -227
- package/dist/{index-v9asb16b.js → index-5a1ex6x8.js} +5 -5
- package/dist/{index-fkx2qnvw.js → index-6x57ar45.js} +2 -2
- package/dist/{index-dqe8pq4x.js → index-a6mc0v4d.js} +6 -3
- package/dist/{index-ayym1x7f.js → index-a7c4r5re.js} +145 -736
- package/dist/{index-ek1yxvvz.js → index-aabzay3h.js} +165 -46
- package/dist/{index-hehkf6zm.js → index-b5vqckbw.js} +12 -6
- package/dist/{v2/server-wafzvyhg.js → index-beht37jy.js} +8 -0
- package/dist/{index-7b2cfmaz.js → index-bjcnntmz.js} +2 -2
- package/dist/{index-hqkczed7.js → index-c5pytzne.js} +22 -2
- package/dist/{index-p4vde22c.js → index-cwzfcbtq.js} +956 -77
- package/dist/{index-cj9g0j7a.js → index-fb2qxs2y.js} +7 -7
- package/dist/{index-nd7m2a5a.js → index-hqhm3wke.js} +25 -3
- package/dist/{index-5mwk1nek.js → index-jn12fvvh.js} +1 -1
- package/dist/{index-n6m03s3n.js → index-ke416mdc.js} +1 -1
- package/dist/{index-6a6dq53h.js → index-kmdj7dsq.js} +5 -5
- package/dist/{index-mtw9e71a.js → index-kq82mtg0.js} +2 -2
- package/dist/{index-n78avt2p.js → index-n37sebck.js} +1 -1
- package/dist/{index-v63beg1z.js → index-nkpmm9q8.js} +3 -3
- package/dist/{index-j6zw70pf.js → index-p7m7j0cp.js} +24 -16
- package/dist/{index-wk0n1cgt.js → index-qn7xstt2.js} +2 -2
- package/dist/{index-saews2s3.js → index-rr2bb45z.js} +1 -1
- package/dist/{index-7pa32z07.js → index-s734jcsr.js} +1 -1
- package/dist/{index-b17m64g9.js → index-s74zqahq.js} +1 -1
- package/dist/{index-wv9n2zcq.js → index-v8awdgvd.js} +4 -4
- package/dist/{index-4qfy7v57.js → index-vrzjhftj.js} +31 -20
- package/dist/{index-qrahzcqv.js → index-ze7mvk54.js} +10 -7
- package/dist/index.js +39 -39
- package/dist/{message-fts-rowid-map-yvx5a9jw.js → message-fts-rowid-map-17s0dfn4.js} +5 -3
- package/dist/{message-index-bounded-6th8djy9.js → message-index-bounded-1633vc7f.js} +17 -17
- package/dist/{message-index-t4pz7akd.js → message-index-dprebmtt.js} +13 -13
- package/dist/{message-time-backfill-8egzkd3z.js → message-time-backfill-73mmm76q.js} +1 -1
- package/dist/migration-worker.js +8 -8
- package/dist/plugin/dream-timer.d.ts +11 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-2dea0a77.js → project-embedding-registry-z74mhqkf.js} +10 -10
- package/dist/raw-ordinal-warmup-worker.js +10 -10
- package/dist/{read-session-chunk-4pwqxm5a.js → read-session-chunk-4zp09ejb.js} +7 -7
- package/dist/{read-session-raw-5ar8se5v.js → read-session-raw-rsc8c7qy.js} +2 -2
- package/dist/{recomp-orchestrator-tjcaj5x7.js → recomp-orchestrator-z3ecszx6.js} +24 -24
- package/dist/{search-rb01n29x.js → search-6mee3vty.js} +20 -20
- package/dist/{search-archive-02jws7hw.js → search-archive-znyy44ve.js} +8 -8
- package/dist/{send-session-notification-2x9edkrp.js → send-session-notification-6ve0e8p4.js} +4 -4
- package/dist/shared/historian-cache.d.ts +8 -0
- package/dist/shared/historian-cache.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +2 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/rpc-discovery-cleanup.d.ts +3 -0
- package/dist/shared/rpc-discovery-cleanup.d.ts.map +1 -0
- package/dist/shared/rpc-server.d.ts +2 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/search-text.d.ts +8 -0
- package/dist/shared/search-text.d.ts.map +1 -0
- package/dist/shared/sqlite.d.ts +4 -2
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/storage-file-mutex.d.ts.map +1 -1
- package/dist/shared/subagent-runner.d.ts +2 -0
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/shared/system-directive.d.ts +2 -0
- package/dist/shared/system-directive.d.ts.map +1 -1
- package/dist/{sqlite-4pqyynrs.js → sqlite-zf72c52d.js} +1 -1
- package/dist/{storage-memory-j3v3hc83.js → storage-memory-y3qmy00r.js} +2 -2
- package/dist/{storage-tags-4z1w27xa.js → storage-tags-8qns3012.js} +8 -4
- package/dist/{transform-postprocess-phase-xaw5c3xp.js → transform-postprocess-phase-3ydzxa62.js} +24 -24
- package/dist/v2/auto-search-worker.js +76 -63
- package/dist/v2/chunk-embedding-write-worker.js +11 -11
- package/dist/v2/{compaction-marker-candidates-1vqwr3s5.js → compaction-marker-candidates-ebx3388k.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/{context-acw1nhv8.js → context-jn3zpeqh.js} +882 -393
- package/dist/v2/embedding-backfill-7c7yr69y.js +23 -0
- package/dist/v2/embedding-worker-process.js +1 -1
- package/dist/v2/embedding-worker.js +4 -4
- package/dist/v2/fold/native-replay.d.ts +11 -2
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/policy.d.ts.map +1 -1
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +8 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/types.d.ts +17 -0
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/{message-fts-rowid-map-8vf0v7cr.js → message-fts-rowid-map-wfx67gfd.js} +5 -3
- package/dist/v2/{message-index-bounded-dsrf49y7.js → message-index-bounded-hpejqyd8.js} +17 -17
- package/dist/v2/{message-index-e6qzw477.js → message-index-pxehjpzx.js} +13 -13
- package/dist/v2/{message-time-backfill-q5pgxf0d.js → message-time-backfill-04t0km1z.js} +1 -1
- package/dist/v2/migration-worker.js +8 -8
- package/dist/v2/{project-embedding-registry-rek75aqw.js → project-embedding-registry-gnkj56xp.js} +10 -10
- package/dist/v2/raw-ordinal-warmup-worker.js +10 -10
- package/dist/v2/{read-session-chunk-7bpygfv2.js → read-session-chunk-zdppn4bj.js} +7 -7
- package/dist/v2/{read-session-raw-pw2n1qgc.js → read-session-raw-yaegtjzh.js} +2 -2
- package/dist/v2/{recomp-orchestrator-hzpgg06e.js → recomp-orchestrator-cmqnfpp3.js} +24 -24
- package/dist/v2/{search-sf2vg5pk.js → search-66842dya.js} +20 -20
- package/dist/v2/{search-archive-fn4wy8sx.js → search-archive-gfh11vs0.js} +8 -8
- package/dist/v2/{send-session-notification-hmr7q0nt.js → send-session-notification-3pxn658x.js} +4 -4
- package/dist/v2/{server-785mb90s.js → server-1wy7b9de.js} +6 -3
- package/dist/v2/{server-g59aatsz.js → server-3rhpvy84.js} +956 -77
- package/dist/v2/{server-kqpawe1a.js → server-46neh5fa.js} +12 -6
- package/dist/v2/{server-rrqpvwqd.js → server-6tmj0s7j.js} +2 -2
- package/dist/v2/{server-kr2kc9dz.js → server-8by8qfec.js} +10 -7
- package/dist/v2/{server-vbe4se57.js → server-a9xqj88f.js} +1 -1
- package/dist/{index-wafzvyhg.js → v2/server-beht37jy.js} +8 -0
- package/dist/v2/{server-05xjtq6c.js → server-d04vrx0j.js} +1 -1
- package/dist/v2/{server-zyw55ygv.js → server-ec4ca92p.js} +5 -5
- package/dist/v2/{server-6fyp0v67.js → server-fw7wrk01.js} +145 -737
- package/dist/v2/{server-zs8d0s3b.js → server-g3qma5c0.js} +1 -1
- package/dist/v2/{server-00hx04yn.js → server-gpvay0xz.js} +2 -2
- package/dist/v2/{server-r9gjxcte.js → server-gtfhttbr.js} +7 -7
- package/dist/v2/{server-gha9x4qq.js → server-h1v0pyxb.js} +2 -2
- package/dist/v2/{server-hgg55hde.js → server-hy3d3vsx.js} +1 -1
- package/dist/v2/{server-1hcbw661.js → server-kh7dpa1a.js} +24 -16
- package/dist/v2/{server-vgpab6rd.js → server-my7k4eds.js} +4 -4
- package/dist/v2/{server-d8tj10db.js → server-n1prf1g6.js} +1 -1
- package/dist/v2/{server-n78avt2p.js → server-n37sebck.js} +1 -1
- package/dist/v2/{server-y5pznjt9.js → server-nj659894.js} +5 -5
- package/dist/v2/{server-e3ftpk7v.js → server-rmygf5pn.js} +32 -3
- package/dist/v2/{server-0ppsweh6.js → server-tgnbmwah.js} +22 -2
- package/dist/v2/{server-n5q841qn.js → server-vsw8tmm6.js} +31 -20
- package/dist/v2/{server-6714jebr.js → server-xj136kt8.js} +1 -1
- package/dist/v2/{server-0mzjjw3s.js → server-zyzawhdw.js} +25 -3
- package/dist/v2/{server-aavz8pm6.js → server-zzkj2fch.js} +3 -3
- package/dist/v2/server.js +4 -4
- package/dist/v2/{sqlite-4pqyynrs.js → sqlite-zf72c52d.js} +1 -1
- package/dist/v2/{storage-memory-j3v3hc83.js → storage-memory-y3qmy00r.js} +2 -2
- package/dist/v2/{storage-tags-hkwtbp3g.js → storage-tags-1h8k6ra9.js} +8 -4
- package/dist/v2/store-reader.d.ts +2 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-x4xj1782.js → wrapup-orchestrator-xs8redz9.js} +24 -24
- package/dist/wrapup-orchestrator-j7d7ry5b.js +48 -0
- package/package.json +1 -1
- package/src/config/latch-permanence-guard.test.ts +4 -0
- package/src/shared/historian-cache.test.ts +69 -0
- package/src/shared/historian-cache.ts +55 -0
- package/src/shared/model-suggestion-retry.ts +2 -0
- package/src/shared/rpc-discovery-cleanup.test.ts +57 -0
- package/src/shared/rpc-discovery-cleanup.ts +57 -0
- package/src/shared/rpc-server.ts +36 -13
- package/src/shared/search-text.test.ts +47 -0
- package/src/shared/search-text.ts +63 -0
- package/src/shared/sqlite.test.ts +56 -0
- package/src/shared/sqlite.ts +51 -2
- package/src/shared/storage-file-mutex-review.test.ts +22 -2
- package/src/shared/storage-file-mutex.ts +11 -1
- package/src/shared/subagent-runner.ts +2 -0
- package/src/shared/system-directive.ts +19 -1
- package/src/shared/tag-transcript.ts +12 -4
- package/dist/v2/embedding-backfill-jyd6492b.js +0 -23
- package/dist/wrapup-orchestrator-vj2tbp22.js +0 -48
|
@@ -55,8 +55,9 @@ import {
|
|
|
55
55
|
SqliteAcquisitionBusyError2,
|
|
56
56
|
withAsyncPrivilegedWriter2,
|
|
57
57
|
indexCoordinationInput2
|
|
58
|
-
} from "./index-
|
|
58
|
+
} from "./index-beht37jy.js";
|
|
59
59
|
import {
|
|
60
|
+
pruneMissingProjectIdentities,
|
|
60
61
|
shouldSkipHomeProjectMemory,
|
|
61
62
|
ProjectIdentityError,
|
|
62
63
|
takeDubiousOwnershipProjectIdentityWarning,
|
|
@@ -70,7 +71,7 @@ import {
|
|
|
70
71
|
storedPathBelongsToIdentity,
|
|
71
72
|
beginBootQuietPeriod,
|
|
72
73
|
scheduleAfterBootQuiet
|
|
73
|
-
} from "./index-
|
|
74
|
+
} from "./index-2vxtcb95.js";
|
|
74
75
|
import {
|
|
75
76
|
recordSessionProjectIdentity,
|
|
76
77
|
hasRecordedSessionProjectIdentity,
|
|
@@ -80,7 +81,7 @@ import {
|
|
|
80
81
|
markGitSweepSuccessAndRelease,
|
|
81
82
|
parkGitSweepNonIndexable,
|
|
82
83
|
releaseGitSweepLease
|
|
83
|
-
} from "./index-
|
|
84
|
+
} from "./index-rr2bb45z.js";
|
|
84
85
|
import {
|
|
85
86
|
hasTrustedAbsoluteWall,
|
|
86
87
|
applyProvenInputFloor,
|
|
@@ -106,7 +107,7 @@ import {
|
|
|
106
107
|
estimateTokens,
|
|
107
108
|
estimateFixedPromptTokens,
|
|
108
109
|
normalizeText
|
|
109
|
-
} from "./index-
|
|
110
|
+
} from "./index-c5pytzne.js";
|
|
110
111
|
import {
|
|
111
112
|
protectedToolTokenCount,
|
|
112
113
|
peelLeadingMcTagNotation,
|
|
@@ -143,7 +144,7 @@ import {
|
|
|
143
144
|
getDroppedTagsByNumbers2,
|
|
144
145
|
getMaxDroppedTagNumber2,
|
|
145
146
|
getTagById2
|
|
146
|
-
} from "./index-
|
|
147
|
+
} from "./index-hqhm3wke.js";
|
|
147
148
|
import {
|
|
148
149
|
observeTemporalDecisions,
|
|
149
150
|
stableStringify
|
|
@@ -167,7 +168,7 @@ import {
|
|
|
167
168
|
buildInMemoryTailRawMessages2,
|
|
168
169
|
RawOrdinalsNotReady2,
|
|
169
170
|
runSessionWarmupWorker
|
|
170
|
-
} from "./index-
|
|
171
|
+
} from "./index-s734jcsr.js";
|
|
171
172
|
import {
|
|
172
173
|
openCodeDbExists,
|
|
173
174
|
withReadOnlySessionDb,
|
|
@@ -175,7 +176,7 @@ import {
|
|
|
175
176
|
latestPersistedMessageForRecovery,
|
|
176
177
|
latestRealUserTurnIdFromOpenCodeDb,
|
|
177
178
|
findLastAssistantModelFromOpenCodeDb
|
|
178
|
-
} from "./index-
|
|
179
|
+
} from "./index-kq82mtg0.js";
|
|
179
180
|
import {
|
|
180
181
|
expandToolPart,
|
|
181
182
|
estimateTrueRawMessageTokens,
|
|
@@ -296,10 +297,10 @@ import {
|
|
|
296
297
|
readRawSessionMessageById2,
|
|
297
298
|
readSessionChunk2,
|
|
298
299
|
readRawSessionSeedTail2
|
|
299
|
-
} from "./index-
|
|
300
|
+
} from "./index-p7m7j0cp.js";
|
|
300
301
|
import {
|
|
301
302
|
getMeasuredToolDefinitionTokens
|
|
302
|
-
} from "./index-
|
|
303
|
+
} from "./index-ke416mdc.js";
|
|
303
304
|
import {
|
|
304
305
|
isFailClosedBlockingError,
|
|
305
306
|
shouldBypassFailClosedBlock,
|
|
@@ -313,7 +314,7 @@ import {
|
|
|
313
314
|
runSqliteOptimize,
|
|
314
315
|
openDatabase,
|
|
315
316
|
openCurrentDatabase
|
|
316
|
-
} from "./index-
|
|
317
|
+
} from "./index-fb2qxs2y.js";
|
|
317
318
|
import {
|
|
318
319
|
registerOwnRpcServerInstance,
|
|
319
320
|
rpcPortDir,
|
|
@@ -332,7 +333,7 @@ import {
|
|
|
332
333
|
resolveStoredPathWorkspaceIdentity,
|
|
333
334
|
storedPathBelongsToWorkspace,
|
|
334
335
|
computeWorkspaceEpochFingerprint
|
|
335
|
-
} from "./index-
|
|
336
|
+
} from "./index-qn7xstt2.js";
|
|
336
337
|
import {
|
|
337
338
|
V2_MEMORY_CATEGORIES,
|
|
338
339
|
CATEGORY_PRIORITY
|
|
@@ -503,7 +504,7 @@ import {
|
|
|
503
504
|
snapRangeToCompartments,
|
|
504
505
|
getActiveCompartmentRun,
|
|
505
506
|
startCompartmentAgent
|
|
506
|
-
} from "./index-
|
|
507
|
+
} from "./index-a7c4r5re.js";
|
|
507
508
|
import {
|
|
508
509
|
embedPauseBySession,
|
|
509
510
|
embedRunStateBySession,
|
|
@@ -531,7 +532,7 @@ import {
|
|
|
531
532
|
embedSessionCompartmentChunks2,
|
|
532
533
|
getEmbeddingCoverageStatus2,
|
|
533
534
|
getAutoEmbeddingSessionCoverage2
|
|
534
|
-
} from "./index-
|
|
535
|
+
} from "./index-ze7mvk54.js";
|
|
535
536
|
import {
|
|
536
537
|
SubcClient,
|
|
537
538
|
connectionFileExists,
|
|
@@ -539,7 +540,7 @@ import {
|
|
|
539
540
|
toSynapseLaneDescriptor,
|
|
540
541
|
formatSynapseLaneDescriptor,
|
|
541
542
|
SynapseEmbeddingProvider
|
|
542
|
-
} from "./index-
|
|
543
|
+
} from "./index-6x57ar45.js";
|
|
543
544
|
import {
|
|
544
545
|
BoundedSessionMap,
|
|
545
546
|
LkgRecoveryFenceError,
|
|
@@ -551,6 +552,7 @@ import {
|
|
|
551
552
|
prepareLkgCaptureFence,
|
|
552
553
|
certifyCommittedLkgCapture,
|
|
553
554
|
markLkgRecoveryDirty,
|
|
555
|
+
gaDatabasePath,
|
|
554
556
|
getMessageIndexSourceIdentity2,
|
|
555
557
|
isMessageIndexSourceCurrent2,
|
|
556
558
|
getLastIndexedOrdinal2,
|
|
@@ -559,8 +561,8 @@ import {
|
|
|
559
561
|
clearIndexedMessages2,
|
|
560
562
|
indexSingleMessage2,
|
|
561
563
|
indexMessagesAfterOrdinal2,
|
|
562
|
-
|
|
563
|
-
} from "./index-
|
|
564
|
+
sweepOrphanedOpenCodeMessageIndexesCooperatively2
|
|
565
|
+
} from "./index-cwzfcbtq.js";
|
|
564
566
|
import {
|
|
565
567
|
renderUserFacingFailure,
|
|
566
568
|
userFacingFailureCode,
|
|
@@ -604,7 +606,7 @@ import {
|
|
|
604
606
|
readGitFileChangeTimesSince,
|
|
605
607
|
verificationFileExists,
|
|
606
608
|
normalizeVerificationFiles
|
|
607
|
-
} from "./index-
|
|
609
|
+
} from "./index-v8awdgvd.js";
|
|
608
610
|
import {
|
|
609
611
|
registerNotificationSink2,
|
|
610
612
|
pushNotification2,
|
|
@@ -614,7 +616,7 @@ import {
|
|
|
614
616
|
} from "./index-x8a7jmkh.js";
|
|
615
617
|
import {
|
|
616
618
|
getLocalEmbeddingNativeMemoryStats
|
|
617
|
-
} from "./index-
|
|
619
|
+
} from "./index-bjcnntmz.js";
|
|
618
620
|
import {
|
|
619
621
|
saveEmbeddingIfHashMatches,
|
|
620
622
|
invalidateProject2,
|
|
@@ -622,7 +624,7 @@ import {
|
|
|
622
624
|
} from "./index-4dhv7mqz.js";
|
|
623
625
|
import {
|
|
624
626
|
cosineSimilarity
|
|
625
|
-
} from "./index-
|
|
627
|
+
} from "./index-24fezq97.js";
|
|
626
628
|
import {
|
|
627
629
|
computeCueContentHash,
|
|
628
630
|
hasMuralCueColumns,
|
|
@@ -647,7 +649,7 @@ import {
|
|
|
647
649
|
mergeMemoryStats2,
|
|
648
650
|
archiveMemory2,
|
|
649
651
|
getMemoryCountsByStatus2
|
|
650
|
-
} from "./index-
|
|
652
|
+
} from "./index-n37sebck.js";
|
|
651
653
|
import {
|
|
652
654
|
renderSingleStoreMigrationRequiredRefusal,
|
|
653
655
|
SingleStoreMigrationRequiredError,
|
|
@@ -668,17 +670,17 @@ import {
|
|
|
668
670
|
resolveMemoriesByIdsForSearch2,
|
|
669
671
|
unifiedSearch2,
|
|
670
672
|
formatSearchResults2
|
|
671
|
-
} from "./index-
|
|
673
|
+
} from "./index-vrzjhftj.js";
|
|
672
674
|
import {
|
|
673
675
|
flushIgnoredMessages2,
|
|
674
676
|
clearIgnoredMessages2,
|
|
675
677
|
observeIgnoredNotificationEvent2,
|
|
676
678
|
sendStatusNotification2
|
|
677
|
-
} from "./index-
|
|
679
|
+
} from "./index-s74zqahq.js";
|
|
678
680
|
import {
|
|
679
681
|
setRecompStarting2,
|
|
680
682
|
setRecompTerminal2
|
|
681
|
-
} from "./index-
|
|
683
|
+
} from "./index-nkpmm9q8.js";
|
|
682
684
|
import {
|
|
683
685
|
makeToolCompositeKey,
|
|
684
686
|
searchMessageHistoryOffThread,
|
|
@@ -720,6 +722,7 @@ import {
|
|
|
720
722
|
prewarmTagOwners,
|
|
721
723
|
waitForTagOwners,
|
|
722
724
|
stripStructuralNoise,
|
|
725
|
+
withTransformTimingSummary,
|
|
723
726
|
logTransformTiming,
|
|
724
727
|
hasRecentAssistantCommit,
|
|
725
728
|
tagMessages,
|
|
@@ -731,7 +734,7 @@ import {
|
|
|
731
734
|
abortSessionFailClosed2,
|
|
732
735
|
evaluateEmergencyFailClosed2,
|
|
733
736
|
runPostTransformPhase2
|
|
734
|
-
} from "./index-
|
|
737
|
+
} from "./index-4yt7dtf4.js";
|
|
735
738
|
import {
|
|
736
739
|
ANNOUNCEMENT_VERSION2,
|
|
737
740
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -744,7 +747,7 @@ import {
|
|
|
744
747
|
} from "./index-fmsr7v69.js";
|
|
745
748
|
import {
|
|
746
749
|
renderSearchArchiveOffThread2
|
|
747
|
-
} from "./index-
|
|
750
|
+
} from "./index-kmdj7dsq.js";
|
|
748
751
|
import {
|
|
749
752
|
COMPACTION_ENABLED_PATH,
|
|
750
753
|
isDreamerRunnable,
|
|
@@ -11611,9 +11614,14 @@ async function indexSingleMessageOffThread(db, sessionId, message) {
|
|
|
11611
11614
|
return result.inserted;
|
|
11612
11615
|
}
|
|
11613
11616
|
async function sweepOrphanedOpenCodeMessageIndexesOffThread(db, openSource, options = {}) {
|
|
11617
|
+
if (getHarness2() === "opencode2")
|
|
11618
|
+
openSource = () => new Database2(gaDatabasePath(getDataDir(), process.env.OPENCODE_CHANNEL ?? "latest"), {
|
|
11619
|
+
readonly: true,
|
|
11620
|
+
fileMustExist: true
|
|
11621
|
+
});
|
|
11614
11622
|
const path = getSqliteDatabasePath2(db);
|
|
11615
|
-
if (!path || getHarness2() !== "opencode")
|
|
11616
|
-
return
|
|
11623
|
+
if (!path || getHarness2() !== "opencode" && getHarness2() !== "opencode2")
|
|
11624
|
+
return sweepOrphanedOpenCodeMessageIndexesCooperatively2(db, openSource, options);
|
|
11617
11625
|
let source = null;
|
|
11618
11626
|
let sourcePath = null;
|
|
11619
11627
|
try {
|
|
@@ -11625,7 +11633,7 @@ async function sweepOrphanedOpenCodeMessageIndexesOffThread(db, openSource, opti
|
|
|
11625
11633
|
source?.close();
|
|
11626
11634
|
}
|
|
11627
11635
|
if (!sourcePath)
|
|
11628
|
-
return
|
|
11636
|
+
return sweepOrphanedOpenCodeMessageIndexesCooperatively2(db, () => source, options);
|
|
11629
11637
|
const reply = await runSessionWarmupWorker({
|
|
11630
11638
|
path,
|
|
11631
11639
|
sessionId: "",
|
|
@@ -11824,7 +11832,7 @@ function runTick(origin) {
|
|
|
11824
11832
|
if (tickInFlight)
|
|
11825
11833
|
return;
|
|
11826
11834
|
tickInFlight = true;
|
|
11827
|
-
log2(`[
|
|
11835
|
+
log2(`[magic-context] maintenance tick (${origin}) — projects=${registeredProjects.size}`);
|
|
11828
11836
|
(async () => {
|
|
11829
11837
|
try {
|
|
11830
11838
|
const db = openTimerDatabaseOrNull("maintenance tick");
|
|
@@ -11874,6 +11882,9 @@ function persistTickOutcome(db, failure) {
|
|
|
11874
11882
|
}
|
|
11875
11883
|
}
|
|
11876
11884
|
async function runMessageHistoryMaintenance(db) {
|
|
11885
|
+
const prunedIdentities = await pruneMissingProjectIdentities();
|
|
11886
|
+
if (prunedIdentities > 0)
|
|
11887
|
+
log2(`[magic-context] pruned ${prunedIdentities} missing project identities`);
|
|
11877
11888
|
try {
|
|
11878
11889
|
await drainStaleLkgSlots(db);
|
|
11879
11890
|
} catch (error) {
|
|
@@ -12107,10 +12118,20 @@ async function sweepGitCommits(args) {
|
|
|
12107
12118
|
const holderId = crypto.randomUUID();
|
|
12108
12119
|
const lease = acquireGitSweepLease(db, projectIdentity, holderId);
|
|
12109
12120
|
if (!lease.acquired) {
|
|
12110
|
-
|
|
12121
|
+
if (lease.reason === "cooldown_active")
|
|
12122
|
+
return;
|
|
12123
|
+
const reason = `lease held by ${lease.leaseHolder ?? "another holder"} until ${lease.leaseExpiresAt ?? "unknown"}`;
|
|
12111
12124
|
log2(`[git-commits] sweep skipped for ${projectIdentity}: ${reason}`);
|
|
12112
12125
|
return;
|
|
12113
12126
|
}
|
|
12127
|
+
if (projectIdentity.startsWith("dir:")) {
|
|
12128
|
+
if (parkGitSweepNonIndexable(db, projectIdentity, holderId)) {
|
|
12129
|
+
log2(`[git-commits] sweep parked for ${projectIdentity}: directory identity has no commits`);
|
|
12130
|
+
} else {
|
|
12131
|
+
releaseGitSweepLease(db, projectIdentity, holderId);
|
|
12132
|
+
}
|
|
12133
|
+
return;
|
|
12134
|
+
}
|
|
12114
12135
|
const startedAt = Date.now();
|
|
12115
12136
|
const stopRenewal = startGitSweepLeaseRenewal(db, projectIdentity, holderId);
|
|
12116
12137
|
log2(`[git-commits] sweep starting for ${projectIdentity} (sinceDays=${gitCommitIndexing.since_days} maxCommits=${gitCommitIndexing.max_commits})`);
|
|
@@ -16272,8 +16293,8 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16272
16293
|
const db = readDatabase();
|
|
16273
16294
|
if (!db)
|
|
16274
16295
|
return { ok: false, error: "db unavailable" };
|
|
16275
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16276
|
-
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-
|
|
16296
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-z3ecszx6.js"));
|
|
16297
|
+
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-6ve0e8p4.js"));
|
|
16277
16298
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16278
16299
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
16279
16300
|
return {
|
|
@@ -16357,7 +16378,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16357
16378
|
const db = readDatabase();
|
|
16358
16379
|
if (!db)
|
|
16359
16380
|
return { ok: false, error: "db unavailable" };
|
|
16360
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16381
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-j7d7ry5b.js"));
|
|
16361
16382
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16362
16383
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16363
16384
|
const ctx = {
|
|
@@ -17850,6 +17871,7 @@ class HistorianHostRunner {
|
|
|
17850
17871
|
throw new Error("hidden completion carrier returned no session id");
|
|
17851
17872
|
const run = await promptSyncWithValidatedOutputRetry(undefined, {
|
|
17852
17873
|
path: { id: handle.id },
|
|
17874
|
+
cacheTail: "skip",
|
|
17853
17875
|
query: { directory: sessionDirectory },
|
|
17854
17876
|
body: {
|
|
17855
17877
|
agent: "historian",
|
|
@@ -24661,7 +24683,8 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24661
24683
|
const tagged = tagMessages(sessionId, tail, deps.tagger, db, {
|
|
24662
24684
|
skipPrefixInjection: !ctxReduceCallable,
|
|
24663
24685
|
servedMessages: messages,
|
|
24664
|
-
normalizeRestoredAssistantText: deps.normalizeRestoredAssistantText
|
|
24686
|
+
normalizeRestoredAssistantText: deps.normalizeRestoredAssistantText,
|
|
24687
|
+
refreshSourceContents: deps.refreshSourceContents?.(sessionId)
|
|
24665
24688
|
});
|
|
24666
24689
|
for (const [number, target] of tagged.targets)
|
|
24667
24690
|
targets.set(number, target);
|
|
@@ -24686,7 +24709,8 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24686
24709
|
skipPrefixInjection,
|
|
24687
24710
|
scopedToolSweep,
|
|
24688
24711
|
servedMessages: messages,
|
|
24689
|
-
normalizeRestoredAssistantText: deps.normalizeRestoredAssistantText
|
|
24712
|
+
normalizeRestoredAssistantText: deps.normalizeRestoredAssistantText,
|
|
24713
|
+
refreshSourceContents: deps.refreshSourceContents?.(sessionId)
|
|
24690
24714
|
});
|
|
24691
24715
|
targets = result.targets;
|
|
24692
24716
|
if (thinkingRecovery.restore)
|
|
@@ -25370,7 +25394,8 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25370
25394
|
systemPromptHash: sessionMeta.systemPromptHash
|
|
25371
25395
|
});
|
|
25372
25396
|
};
|
|
25373
|
-
|
|
25397
|
+
const timedTransform = (input, output) => withTransformTimingSummary(() => transform(input, output));
|
|
25398
|
+
return Object.assign(timedTransform, {
|
|
25374
25399
|
clearSessionLogState,
|
|
25375
25400
|
invalidateRustWireState(sessionId) {
|
|
25376
25401
|
rustModeTransform?.invalidateWireState(sessionId);
|
|
@@ -25591,6 +25616,26 @@ function systemPromptDates(prompt, sticky) {
|
|
|
25591
25616
|
return { live: values.length ? JSON.stringify(values) : undefined, stable };
|
|
25592
25617
|
}
|
|
25593
25618
|
|
|
25619
|
+
// src/hooks/magic-context/system-prompt-diagnostics.ts
|
|
25620
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
25621
|
+
function snapshotSystemPrompt(system, preset) {
|
|
25622
|
+
return { elements: system.map((element) => Buffer.from(element)), preset };
|
|
25623
|
+
}
|
|
25624
|
+
function describeSystemPromptChange(previous, current) {
|
|
25625
|
+
const metadata = (element) => element === undefined ? "absent" : `bytes=${element.length},md5=${createHash13("md5").update(element).digest("hex")}`;
|
|
25626
|
+
const elements = [];
|
|
25627
|
+
for (let index = 0;index < Math.max(previous?.elements.length ?? 0, current.elements.length); index++) {
|
|
25628
|
+
const before = previous?.elements[index];
|
|
25629
|
+
const after = current.elements[index];
|
|
25630
|
+
let offset = 0;
|
|
25631
|
+
while (before && after && offset < Math.min(before.length, after.length) && before[offset] === after[offset])
|
|
25632
|
+
offset++;
|
|
25633
|
+
const status = !previous ? "unknown" : !before ? "added" : !after ? "removed" : before.equals(after) ? "unchanged" : "changed";
|
|
25634
|
+
elements.push(`${index}:${status}(${metadata(before)} -> ${metadata(after)},firstDiffByte=${!previous ? "unknown" : status === "unchanged" ? "none" : offset})`);
|
|
25635
|
+
}
|
|
25636
|
+
return `presetChanged=${previous ? previous.preset !== current.preset : "unknown"} elements=[${elements.join("; ")}]`;
|
|
25637
|
+
}
|
|
25638
|
+
|
|
25594
25639
|
// src/hooks/magic-context/system-prompt-hash.ts
|
|
25595
25640
|
var MAGIC_CONTEXT_MARKER = "## Magic Context";
|
|
25596
25641
|
var SYSTEM_PROMPT_GUIDANCE_SEPARATOR = `
|
|
@@ -25613,6 +25658,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25613
25658
|
});
|
|
25614
25659
|
const guidanceEpochs = createPromptSurfaceGuidanceEpochCache(promptSurfaceRuntime);
|
|
25615
25660
|
const stickyDateBySession = new Map;
|
|
25661
|
+
const diagnosticPrompts = new Map;
|
|
25616
25662
|
const processSystemPrompt = async (input, output) => {
|
|
25617
25663
|
const sessionId = input.sessionID;
|
|
25618
25664
|
if (!sessionId)
|
|
@@ -25745,8 +25791,11 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25745
25791
|
return;
|
|
25746
25792
|
}
|
|
25747
25793
|
const sessionMeta = sessionMetaEarly;
|
|
25794
|
+
const previousPrompt = diagnosticPrompts.get(sessionId);
|
|
25795
|
+
const currentPrompt = previousPrompt && previousHash === currentHash ? previousPrompt : snapshotSystemPrompt(output.system, promptSurface.preset);
|
|
25796
|
+
diagnosticPrompts.set(sessionId, currentPrompt);
|
|
25748
25797
|
if (previousHash !== "" && previousHash !== "0" && previousHash !== currentHash) {
|
|
25749
|
-
sessionLog2(sessionId, `system prompt hash changed: ${previousHash} → ${currentHash} (len=${systemContent.length}), ${idleCacheExpired ? "adopting on idle-expired request" : requestMessagesFinal ? "adopting on the request whose messages are already final" : "triggering flush"}`);
|
|
25798
|
+
sessionLog2(sessionId, `system prompt hash changed: ${previousHash} → ${currentHash} (len=${systemContent.length}), ${idleCacheExpired ? "adopting on idle-expired request" : requestMessagesFinal ? "adopting on the request whose messages are already final" : "triggering flush"}; ${describeSystemPromptChange(previousPrompt, currentPrompt)}`);
|
|
25750
25799
|
noteSystemPromptHashChange(sessionId);
|
|
25751
25800
|
if (!adoptSystemChange) {
|
|
25752
25801
|
deps.historyRefreshSessions.add(sessionId);
|
|
@@ -25790,6 +25839,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25790
25839
|
return {
|
|
25791
25840
|
handler,
|
|
25792
25841
|
clearSession: (sessionId) => {
|
|
25842
|
+
diagnosticPrompts.delete(sessionId);
|
|
25793
25843
|
clearSystemDateRefresh(deps.historyRefreshSessions, sessionId);
|
|
25794
25844
|
guidanceEpochs.clear(sessionId);
|
|
25795
25845
|
clearSystemPromptHashSession(sessionId, {
|
|
@@ -26518,7 +26568,7 @@ function resolveCtxExpandMode(args, domain) {
|
|
|
26518
26568
|
}
|
|
26519
26569
|
|
|
26520
26570
|
// src/tools/ctx-expand/render.ts
|
|
26521
|
-
import { createHash as
|
|
26571
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
26522
26572
|
function isRecord4(value) {
|
|
26523
26573
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26524
26574
|
}
|
|
@@ -26742,7 +26792,7 @@ function renderItemByTag(db, sessionId, number, textIndexDomain = "part") {
|
|
|
26742
26792
|
const index = scoped ? Number(scoped[2]) : 0;
|
|
26743
26793
|
const piText = message.parts.filter((part) => isRecord4(part) && part.type === "text");
|
|
26744
26794
|
const part = message.parts[index];
|
|
26745
|
-
const matching = derived ? piText.filter((part) => isRecord4(part) && typeof part.text === "string" &&
|
|
26795
|
+
const matching = derived ? piText.filter((part) => isRecord4(part) && typeof part.text === "string" && createHash14("sha256").update(part.text).digest("hex") === derived[3]) : [];
|
|
26746
26796
|
const selected = derived ? matching[Number(derived[4])] : textIndexDomain === "text" ? piText[index] : part;
|
|
26747
26797
|
return selected ? renderPartFull(selected) ?? "" : `Tag ${number}'s original text part is no longer in stored history.`;
|
|
26748
26798
|
}
|
|
@@ -28298,7 +28348,7 @@ function formatCtxReduceReply(stampedCount, selfStampCount = 0) {
|
|
|
28298
28348
|
return parts.join(" ");
|
|
28299
28349
|
}
|
|
28300
28350
|
// src/tools/ctx-reduce/tools.ts
|
|
28301
|
-
import { createHash as
|
|
28351
|
+
import { createHash as createHash15 } from "node:crypto";
|
|
28302
28352
|
import { tool as tool4 } from "@opencode-ai/plugin";
|
|
28303
28353
|
|
|
28304
28354
|
// src/features/magic-context/range-parser.ts
|
|
@@ -28362,11 +28412,11 @@ function createCtxReduceTool(deps) {
|
|
|
28362
28412
|
const stableId = `oc-${sessionId}-${callId}`;
|
|
28363
28413
|
if (Buffer.byteLength(stableId) <= 128)
|
|
28364
28414
|
return stableId;
|
|
28365
|
-
return `oc-${
|
|
28415
|
+
return `oc-${createHash15("sha256").update(stableId).digest("hex")}`;
|
|
28366
28416
|
}
|
|
28367
28417
|
fallbackCommandSequence += 1;
|
|
28368
28418
|
const monotonicId = `oc-${sessionId}-${fallbackCommandSequence}`;
|
|
28369
|
-
return Buffer.byteLength(monotonicId) <= 128 ? monotonicId : `oc-${
|
|
28419
|
+
return Buffer.byteLength(monotonicId) <= 128 ? monotonicId : `oc-${createHash15("sha256").update(monotonicId).digest("hex")}`;
|
|
28370
28420
|
};
|
|
28371
28421
|
return tool4({
|
|
28372
28422
|
description: CTX_REDUCE_DESCRIPTION,
|
|
@@ -28773,7 +28823,58 @@ function applyJsonSchemaParameterDescriptions(toolId, input, preset, smartNotesE
|
|
|
28773
28823
|
|
|
28774
28824
|
// src/shared/rpc-server.ts
|
|
28775
28825
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
28776
|
-
import { readdirSync as readdirSync2, readFileSync as readFileSync6, unlinkSync } from "node:fs";
|
|
28826
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync6, rmdirSync, unlinkSync } from "node:fs";
|
|
28827
|
+
|
|
28828
|
+
// src/shared/rpc-discovery-cleanup.ts
|
|
28829
|
+
import { promises as fs } from "node:fs";
|
|
28830
|
+
import { join as join7 } from "node:path";
|
|
28831
|
+
async function reapDeadRpcDiscovery(storageDir) {
|
|
28832
|
+
const root = join7(storageDir, "rpc");
|
|
28833
|
+
let directories;
|
|
28834
|
+
try {
|
|
28835
|
+
directories = await fs.readdir(root, { withFileTypes: true });
|
|
28836
|
+
} catch {
|
|
28837
|
+
return;
|
|
28838
|
+
}
|
|
28839
|
+
const records = [];
|
|
28840
|
+
const projectDirs = [];
|
|
28841
|
+
for (const entry of directories) {
|
|
28842
|
+
if (!entry.isDirectory() || !/^[0-9a-f]{16}$/.test(entry.name))
|
|
28843
|
+
continue;
|
|
28844
|
+
const directory = join7(root, entry.name);
|
|
28845
|
+
projectDirs.push(directory);
|
|
28846
|
+
try {
|
|
28847
|
+
for (const name of await fs.readdir(directory)) {
|
|
28848
|
+
const match = /^port-(\d+)(?:-[0-9a-f]+)?\.json$/.exec(name);
|
|
28849
|
+
if (!match)
|
|
28850
|
+
continue;
|
|
28851
|
+
const path = join7(directory, name);
|
|
28852
|
+
try {
|
|
28853
|
+
const content = await fs.readFile(path, "utf8");
|
|
28854
|
+
const record = parseRpcPortFile(content, Number(match[1]));
|
|
28855
|
+
if (record && record.pid === Number(match[1]))
|
|
28856
|
+
records.push({ path, content, pid: record.pid });
|
|
28857
|
+
} catch {}
|
|
28858
|
+
}
|
|
28859
|
+
} catch {}
|
|
28860
|
+
}
|
|
28861
|
+
const processes = records.length ? await inspectProcessesAsync(true) : undefined;
|
|
28862
|
+
for (const record of records) {
|
|
28863
|
+
if (processes?.liveness(record.pid) !== "dead")
|
|
28864
|
+
continue;
|
|
28865
|
+
try {
|
|
28866
|
+
if (await fs.readFile(record.path, "utf8") === record.content)
|
|
28867
|
+
await fs.unlink(record.path);
|
|
28868
|
+
} catch {}
|
|
28869
|
+
}
|
|
28870
|
+
for (const directory of projectDirs) {
|
|
28871
|
+
try {
|
|
28872
|
+
await fs.rmdir(directory);
|
|
28873
|
+
} catch {}
|
|
28874
|
+
}
|
|
28875
|
+
}
|
|
28876
|
+
|
|
28877
|
+
// src/shared/rpc-server.ts
|
|
28777
28878
|
var MAX_BODY_BYTES = 1048576;
|
|
28778
28879
|
var WS_AUTH_TIMEOUT_MS = 5000;
|
|
28779
28880
|
var WS_CLOSE_UNAUTHORIZED = 4401;
|
|
@@ -28796,17 +28897,20 @@ function websocketToken(req) {
|
|
|
28796
28897
|
}
|
|
28797
28898
|
|
|
28798
28899
|
class MagicContextRpcServer {
|
|
28900
|
+
storageDir;
|
|
28799
28901
|
server = null;
|
|
28800
28902
|
port = 0;
|
|
28801
28903
|
handlers = new Map;
|
|
28802
28904
|
portFilePath;
|
|
28803
28905
|
portDir;
|
|
28804
28906
|
startedAt = Date.now();
|
|
28907
|
+
stopped = false;
|
|
28805
28908
|
instanceId = randomBytes(8).toString("hex");
|
|
28806
28909
|
unregisterOwnInstance = null;
|
|
28807
28910
|
sockets = new Set;
|
|
28808
28911
|
token = randomBytes(32).toString("hex");
|
|
28809
28912
|
constructor(storageDir, directory) {
|
|
28913
|
+
this.storageDir = storageDir;
|
|
28810
28914
|
this.portFilePath = rpcPortFilePath(storageDir, directory, process.pid, this.instanceId);
|
|
28811
28915
|
this.portDir = rpcPortDir(storageDir, directory);
|
|
28812
28916
|
}
|
|
@@ -28824,6 +28928,10 @@ class MagicContextRpcServer {
|
|
|
28824
28928
|
log2("rpc server skipped: Bun runtime not available (no TUI consumer)");
|
|
28825
28929
|
return 0;
|
|
28826
28930
|
}
|
|
28931
|
+
this.stopped = false;
|
|
28932
|
+
await reapDeadRpcDiscovery(this.storageDir);
|
|
28933
|
+
if (this.stopped)
|
|
28934
|
+
return 0;
|
|
28827
28935
|
this.startedAt = Date.now();
|
|
28828
28936
|
const self = this;
|
|
28829
28937
|
const server = inRootAsyncContext2(() => Bun.serve({
|
|
@@ -28855,7 +28963,7 @@ class MagicContextRpcServer {
|
|
|
28855
28963
|
try {
|
|
28856
28964
|
this.warnIfOtherLiveInstance();
|
|
28857
28965
|
this.unregisterOwnInstance ??= registerOwnRpcServerInstance(this.instanceId);
|
|
28858
|
-
writeStorageFileAtomicSync(this.portFilePath, JSON.stringify({
|
|
28966
|
+
const publish = () => writeStorageFileAtomicSync(this.portFilePath, JSON.stringify({
|
|
28859
28967
|
port: this.port,
|
|
28860
28968
|
pid: process.pid,
|
|
28861
28969
|
started_at: this.startedAt,
|
|
@@ -28863,6 +28971,13 @@ class MagicContextRpcServer {
|
|
|
28863
28971
|
token: this.token,
|
|
28864
28972
|
instance_id: this.instanceId
|
|
28865
28973
|
}));
|
|
28974
|
+
try {
|
|
28975
|
+
publish();
|
|
28976
|
+
} catch (error) {
|
|
28977
|
+
if (error.code !== "ENOENT")
|
|
28978
|
+
throw error;
|
|
28979
|
+
publish();
|
|
28980
|
+
}
|
|
28866
28981
|
log2(`[rpc] server listening on 127.0.0.1:${this.port}`);
|
|
28867
28982
|
} catch (err) {
|
|
28868
28983
|
log2(`[rpc] failed to write port file: ${err}`);
|
|
@@ -28870,6 +28985,7 @@ class MagicContextRpcServer {
|
|
|
28870
28985
|
return this.port;
|
|
28871
28986
|
}
|
|
28872
28987
|
stop() {
|
|
28988
|
+
this.stopped = true;
|
|
28873
28989
|
for (const ws of this.sockets) {
|
|
28874
28990
|
try {
|
|
28875
28991
|
if (ws.data.authTimer)
|
|
@@ -28886,6 +29002,9 @@ class MagicContextRpcServer {
|
|
|
28886
29002
|
try {
|
|
28887
29003
|
unlinkSync(this.portFilePath);
|
|
28888
29004
|
} catch {}
|
|
29005
|
+
try {
|
|
29006
|
+
rmdirSync(this.portDir);
|
|
29007
|
+
} catch {}
|
|
28889
29008
|
this.unregisterOwnInstance?.();
|
|
28890
29009
|
this.unregisterOwnInstance = null;
|
|
28891
29010
|
}
|
|
@@ -29033,7 +29152,7 @@ function json(body, status = 200) {
|
|
|
29033
29152
|
// src/shared/models-dev-temperature.ts
|
|
29034
29153
|
import { readFileSync as readFileSync7, statSync as statSync4 } from "node:fs";
|
|
29035
29154
|
import { homedir as homedir2 } from "node:os";
|
|
29036
|
-
import { join as
|
|
29155
|
+
import { join as join8 } from "node:path";
|
|
29037
29156
|
var CATALOG_PROVIDER_ALIASES = {
|
|
29038
29157
|
"google-antigravity": "google",
|
|
29039
29158
|
"opencode-zen": "opencode"
|
|
@@ -29043,7 +29162,7 @@ var cached;
|
|
|
29043
29162
|
function modelsDevCatalogPath(env = process.env) {
|
|
29044
29163
|
if (env.OPENCODE_MODELS_PATH)
|
|
29045
29164
|
return env.OPENCODE_MODELS_PATH;
|
|
29046
|
-
return
|
|
29165
|
+
return join8(env.XDG_CACHE_HOME || join8(homedir2(), ".cache"), "opencode", "models.json");
|
|
29047
29166
|
}
|
|
29048
29167
|
function buildIndex(raw) {
|
|
29049
29168
|
const index = new Map;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-c5pytzne.js";
|
|
5
5
|
import {
|
|
6
6
|
getHarness2
|
|
7
7
|
} from "./index-pavzsdc6.js";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
} from "./index-j75v2476.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-6x57ar45.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-a6mc0v4d.js";
|
|
17
17
|
|
|
18
18
|
// src/features/magic-context/compartment-chunk-embedding.ts
|
|
19
19
|
import { createHash } from "node:crypto";
|
|
@@ -900,12 +900,18 @@ var BACKOFF_PREFIX = "chunk_embed_backoff:";
|
|
|
900
900
|
function backoffKey(compartmentId) {
|
|
901
901
|
return `${BACKOFF_PREFIX}${compartmentId}`;
|
|
902
902
|
}
|
|
903
|
-
function deleteChunkEmbedBackoffForSession(db, sessionId) {
|
|
904
|
-
|
|
903
|
+
function deleteChunkEmbedBackoffForSession(db, sessionId, limit) {
|
|
904
|
+
if (limit !== undefined)
|
|
905
|
+
return db.prepare(`DELETE FROM schema_migrations_meta WHERE key IN (
|
|
906
|
+
SELECT key FROM schema_migrations_meta JOIN compartments
|
|
907
|
+
ON key = ? || compartments.id OR key = ? || compartments.id
|
|
908
|
+
WHERE compartments.session_id = ? LIMIT ?
|
|
909
|
+
)`).run(BACKOFF_PREFIX, WINDOW_SOURCE_PREFIX, sessionId, limit).changes;
|
|
910
|
+
return db.prepare(`DELETE FROM schema_migrations_meta WHERE key IN (
|
|
905
911
|
SELECT ? || id FROM compartments WHERE session_id = ?
|
|
906
912
|
UNION ALL
|
|
907
913
|
SELECT ? || id FROM compartments WHERE session_id = ?
|
|
908
|
-
)`).run(BACKOFF_PREFIX, sessionId, WINDOW_SOURCE_PREFIX, sessionId);
|
|
914
|
+
)`).run(BACKOFF_PREFIX, sessionId, WINDOW_SOURCE_PREFIX, sessionId).changes;
|
|
909
915
|
}
|
|
910
916
|
function recordChunkEmbedBackoff(db, candidate, projectPath, modelId) {
|
|
911
917
|
const mapped = buildCanonicalChunkTextFromFts(db, candidate.sessionId, candidate.startMessage, candidate.endMessage);
|
|
@@ -29,6 +29,14 @@ function detectSqliteRuntime2() {
|
|
|
29
29
|
var bunSpec = "bun:" + "sqlite";
|
|
30
30
|
var nodeSpec = "node:" + "sqlite";
|
|
31
31
|
async function importSqliteModule(specifier) {
|
|
32
|
+
if (specifier === nodeSpec && typeof process.getBuiltinModule === "function") {
|
|
33
|
+
const loaded = process.getBuiltinModule(specifier);
|
|
34
|
+
if (loaded)
|
|
35
|
+
return loaded;
|
|
36
|
+
throw Object.assign(new Error(`No such built-in module: ${specifier}`), {
|
|
37
|
+
code: "ERR_UNKNOWN_BUILTIN_MODULE"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
32
40
|
return await import(specifier);
|
|
33
41
|
}
|
|
34
42
|
function isModuleNotFoundError(error, specifier) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./index-wgypt3cs.js";
|
|
4
4
|
import {
|
|
5
5
|
getSynapseLaneIdentity
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-6x57ar45.js";
|
|
7
7
|
import {
|
|
8
8
|
getHarness2
|
|
9
9
|
} from "./index-pavzsdc6.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "./index-j75v2476.js";
|
|
17
17
|
import {
|
|
18
18
|
inRootAsyncContext2
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-beht37jy.js";
|
|
20
20
|
import {
|
|
21
21
|
computeNormalizedHash
|
|
22
22
|
} from "./index-2bvekkfy.js";
|