@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.
Files changed (204) hide show
  1. package/dist/auto-search-worker.js +76 -63
  2. package/dist/chunk-embedding-write-worker.js +11 -11
  3. package/dist/{compaction-marker-candidates-v5c6997n.js → compaction-marker-candidates-n4krhat4.js} +2 -2
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/config/schema/magic-context.d.ts +394 -394
  6. package/dist/{conflict-warning-hook-znry4j76.js → conflict-warning-hook-4pmz879v.js} +5 -5
  7. package/dist/{context-3znk23va.js → context-yhetp0kn.js} +294 -144
  8. package/dist/{embedding-backfill-q4n8dend.js → embedding-backfill-fmz50tsy.js} +11 -11
  9. package/dist/embedding-worker-process.js +1 -1
  10. package/dist/embedding-worker.js +4 -4
  11. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
  12. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  13. package/dist/features/magic-context/git-commits/indexer.d.ts.map +1 -1
  14. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  15. package/dist/features/magic-context/memory/project-identity-cache.d.ts +2 -0
  16. package/dist/features/magic-context/memory/project-identity-cache.d.ts.map +1 -1
  17. package/dist/features/magic-context/message-index-async.d.ts +1 -1
  18. package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
  19. package/dist/features/magic-context/message-index.d.ts +5 -0
  20. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  21. package/dist/features/magic-context/search.d.ts +6 -1
  22. package/dist/features/magic-context/search.d.ts.map +1 -1
  23. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  24. package/dist/features/magic-context/storage-meta-shared.d.ts +2 -2
  25. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
  26. package/dist/features/magic-context/storage-session-tables.d.ts +9 -1
  27. package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/auto-search-deadline.d.ts +2 -1
  30. package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/auto-search-hint.d.ts +3 -0
  32. package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +10 -2
  35. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -0
  37. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/system-prompt-diagnostics.d.ts +8 -0
  43. package/dist/hooks/magic-context/system-prompt-diagnostics.d.ts.map +1 -0
  44. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/tag-messages.d.ts +6 -1
  46. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/todo-view.d.ts +2 -2
  48. package/dist/hooks/magic-context/tool-drop-target.d.ts +3 -2
  49. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/transform-stage-logger.d.ts +3 -0
  51. package/dist/hooks/magic-context/transform-stage-logger.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/transform.d.ts +1 -0
  53. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  54. package/dist/{index-9nkg2dzk.js → index-24fezq97.js} +3 -3
  55. package/dist/{index-a8bvhwqs.js → index-2vxtcb95.js} +32 -3
  56. package/dist/{index-f71thw8j.js → index-4s3t0nd0.js} +1 -1
  57. package/dist/{index-kn4t1haw.js → index-4yt7dtf4.js} +450 -227
  58. package/dist/{index-v9asb16b.js → index-5a1ex6x8.js} +5 -5
  59. package/dist/{index-fkx2qnvw.js → index-6x57ar45.js} +2 -2
  60. package/dist/{index-dqe8pq4x.js → index-a6mc0v4d.js} +6 -3
  61. package/dist/{index-ayym1x7f.js → index-a7c4r5re.js} +145 -736
  62. package/dist/{index-ek1yxvvz.js → index-aabzay3h.js} +165 -46
  63. package/dist/{index-hehkf6zm.js → index-b5vqckbw.js} +12 -6
  64. package/dist/{v2/server-wafzvyhg.js → index-beht37jy.js} +8 -0
  65. package/dist/{index-7b2cfmaz.js → index-bjcnntmz.js} +2 -2
  66. package/dist/{index-hqkczed7.js → index-c5pytzne.js} +22 -2
  67. package/dist/{index-p4vde22c.js → index-cwzfcbtq.js} +956 -77
  68. package/dist/{index-cj9g0j7a.js → index-fb2qxs2y.js} +7 -7
  69. package/dist/{index-nd7m2a5a.js → index-hqhm3wke.js} +25 -3
  70. package/dist/{index-5mwk1nek.js → index-jn12fvvh.js} +1 -1
  71. package/dist/{index-n6m03s3n.js → index-ke416mdc.js} +1 -1
  72. package/dist/{index-6a6dq53h.js → index-kmdj7dsq.js} +5 -5
  73. package/dist/{index-mtw9e71a.js → index-kq82mtg0.js} +2 -2
  74. package/dist/{index-n78avt2p.js → index-n37sebck.js} +1 -1
  75. package/dist/{index-v63beg1z.js → index-nkpmm9q8.js} +3 -3
  76. package/dist/{index-j6zw70pf.js → index-p7m7j0cp.js} +24 -16
  77. package/dist/{index-wk0n1cgt.js → index-qn7xstt2.js} +2 -2
  78. package/dist/{index-saews2s3.js → index-rr2bb45z.js} +1 -1
  79. package/dist/{index-7pa32z07.js → index-s734jcsr.js} +1 -1
  80. package/dist/{index-b17m64g9.js → index-s74zqahq.js} +1 -1
  81. package/dist/{index-wv9n2zcq.js → index-v8awdgvd.js} +4 -4
  82. package/dist/{index-4qfy7v57.js → index-vrzjhftj.js} +31 -20
  83. package/dist/{index-qrahzcqv.js → index-ze7mvk54.js} +10 -7
  84. package/dist/index.js +39 -39
  85. package/dist/{message-fts-rowid-map-yvx5a9jw.js → message-fts-rowid-map-17s0dfn4.js} +5 -3
  86. package/dist/{message-index-bounded-6th8djy9.js → message-index-bounded-1633vc7f.js} +17 -17
  87. package/dist/{message-index-t4pz7akd.js → message-index-dprebmtt.js} +13 -13
  88. package/dist/{message-time-backfill-8egzkd3z.js → message-time-backfill-73mmm76q.js} +1 -1
  89. package/dist/migration-worker.js +8 -8
  90. package/dist/plugin/dream-timer.d.ts +11 -0
  91. package/dist/plugin/dream-timer.d.ts.map +1 -1
  92. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  93. package/dist/{project-embedding-registry-2dea0a77.js → project-embedding-registry-z74mhqkf.js} +10 -10
  94. package/dist/raw-ordinal-warmup-worker.js +10 -10
  95. package/dist/{read-session-chunk-4pwqxm5a.js → read-session-chunk-4zp09ejb.js} +7 -7
  96. package/dist/{read-session-raw-5ar8se5v.js → read-session-raw-rsc8c7qy.js} +2 -2
  97. package/dist/{recomp-orchestrator-tjcaj5x7.js → recomp-orchestrator-z3ecszx6.js} +24 -24
  98. package/dist/{search-rb01n29x.js → search-6mee3vty.js} +20 -20
  99. package/dist/{search-archive-02jws7hw.js → search-archive-znyy44ve.js} +8 -8
  100. package/dist/{send-session-notification-2x9edkrp.js → send-session-notification-6ve0e8p4.js} +4 -4
  101. package/dist/shared/historian-cache.d.ts +8 -0
  102. package/dist/shared/historian-cache.d.ts.map +1 -0
  103. package/dist/shared/model-suggestion-retry.d.ts +2 -0
  104. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  105. package/dist/shared/rpc-discovery-cleanup.d.ts +3 -0
  106. package/dist/shared/rpc-discovery-cleanup.d.ts.map +1 -0
  107. package/dist/shared/rpc-server.d.ts +2 -0
  108. package/dist/shared/rpc-server.d.ts.map +1 -1
  109. package/dist/shared/search-text.d.ts +8 -0
  110. package/dist/shared/search-text.d.ts.map +1 -0
  111. package/dist/shared/sqlite.d.ts +4 -2
  112. package/dist/shared/sqlite.d.ts.map +1 -1
  113. package/dist/shared/storage-file-mutex.d.ts.map +1 -1
  114. package/dist/shared/subagent-runner.d.ts +2 -0
  115. package/dist/shared/subagent-runner.d.ts.map +1 -1
  116. package/dist/shared/system-directive.d.ts +2 -0
  117. package/dist/shared/system-directive.d.ts.map +1 -1
  118. package/dist/{sqlite-4pqyynrs.js → sqlite-zf72c52d.js} +1 -1
  119. package/dist/{storage-memory-j3v3hc83.js → storage-memory-y3qmy00r.js} +2 -2
  120. package/dist/{storage-tags-4z1w27xa.js → storage-tags-8qns3012.js} +8 -4
  121. package/dist/{transform-postprocess-phase-xaw5c3xp.js → transform-postprocess-phase-3ydzxa62.js} +24 -24
  122. package/dist/v2/auto-search-worker.js +76 -63
  123. package/dist/v2/chunk-embedding-write-worker.js +11 -11
  124. package/dist/v2/{compaction-marker-candidates-1vqwr3s5.js → compaction-marker-candidates-ebx3388k.js} +2 -2
  125. package/dist/v2/compaction-marker-candidates-worker.js +2 -2
  126. package/dist/v2/{context-acw1nhv8.js → context-jn3zpeqh.js} +882 -393
  127. package/dist/v2/embedding-backfill-7c7yr69y.js +23 -0
  128. package/dist/v2/embedding-worker-process.js +1 -1
  129. package/dist/v2/embedding-worker.js +4 -4
  130. package/dist/v2/fold/native-replay.d.ts +11 -2
  131. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  132. package/dist/v2/fold/policy.d.ts.map +1 -1
  133. package/dist/v2/fold/restore.d.ts.map +1 -1
  134. package/dist/v2/hooks/context.d.ts.map +1 -1
  135. package/dist/v2/hooks/hidden-child.d.ts +8 -0
  136. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  137. package/dist/v2/hooks/types.d.ts +17 -0
  138. package/dist/v2/hooks/types.d.ts.map +1 -1
  139. package/dist/v2/{message-fts-rowid-map-8vf0v7cr.js → message-fts-rowid-map-wfx67gfd.js} +5 -3
  140. package/dist/v2/{message-index-bounded-dsrf49y7.js → message-index-bounded-hpejqyd8.js} +17 -17
  141. package/dist/v2/{message-index-e6qzw477.js → message-index-pxehjpzx.js} +13 -13
  142. package/dist/v2/{message-time-backfill-q5pgxf0d.js → message-time-backfill-04t0km1z.js} +1 -1
  143. package/dist/v2/migration-worker.js +8 -8
  144. package/dist/v2/{project-embedding-registry-rek75aqw.js → project-embedding-registry-gnkj56xp.js} +10 -10
  145. package/dist/v2/raw-ordinal-warmup-worker.js +10 -10
  146. package/dist/v2/{read-session-chunk-7bpygfv2.js → read-session-chunk-zdppn4bj.js} +7 -7
  147. package/dist/v2/{read-session-raw-pw2n1qgc.js → read-session-raw-yaegtjzh.js} +2 -2
  148. package/dist/v2/{recomp-orchestrator-hzpgg06e.js → recomp-orchestrator-cmqnfpp3.js} +24 -24
  149. package/dist/v2/{search-sf2vg5pk.js → search-66842dya.js} +20 -20
  150. package/dist/v2/{search-archive-fn4wy8sx.js → search-archive-gfh11vs0.js} +8 -8
  151. package/dist/v2/{send-session-notification-hmr7q0nt.js → send-session-notification-3pxn658x.js} +4 -4
  152. package/dist/v2/{server-785mb90s.js → server-1wy7b9de.js} +6 -3
  153. package/dist/v2/{server-g59aatsz.js → server-3rhpvy84.js} +956 -77
  154. package/dist/v2/{server-kqpawe1a.js → server-46neh5fa.js} +12 -6
  155. package/dist/v2/{server-rrqpvwqd.js → server-6tmj0s7j.js} +2 -2
  156. package/dist/v2/{server-kr2kc9dz.js → server-8by8qfec.js} +10 -7
  157. package/dist/v2/{server-vbe4se57.js → server-a9xqj88f.js} +1 -1
  158. package/dist/{index-wafzvyhg.js → v2/server-beht37jy.js} +8 -0
  159. package/dist/v2/{server-05xjtq6c.js → server-d04vrx0j.js} +1 -1
  160. package/dist/v2/{server-zyw55ygv.js → server-ec4ca92p.js} +5 -5
  161. package/dist/v2/{server-6fyp0v67.js → server-fw7wrk01.js} +145 -737
  162. package/dist/v2/{server-zs8d0s3b.js → server-g3qma5c0.js} +1 -1
  163. package/dist/v2/{server-00hx04yn.js → server-gpvay0xz.js} +2 -2
  164. package/dist/v2/{server-r9gjxcte.js → server-gtfhttbr.js} +7 -7
  165. package/dist/v2/{server-gha9x4qq.js → server-h1v0pyxb.js} +2 -2
  166. package/dist/v2/{server-hgg55hde.js → server-hy3d3vsx.js} +1 -1
  167. package/dist/v2/{server-1hcbw661.js → server-kh7dpa1a.js} +24 -16
  168. package/dist/v2/{server-vgpab6rd.js → server-my7k4eds.js} +4 -4
  169. package/dist/v2/{server-d8tj10db.js → server-n1prf1g6.js} +1 -1
  170. package/dist/v2/{server-n78avt2p.js → server-n37sebck.js} +1 -1
  171. package/dist/v2/{server-y5pznjt9.js → server-nj659894.js} +5 -5
  172. package/dist/v2/{server-e3ftpk7v.js → server-rmygf5pn.js} +32 -3
  173. package/dist/v2/{server-0ppsweh6.js → server-tgnbmwah.js} +22 -2
  174. package/dist/v2/{server-n5q841qn.js → server-vsw8tmm6.js} +31 -20
  175. package/dist/v2/{server-6714jebr.js → server-xj136kt8.js} +1 -1
  176. package/dist/v2/{server-0mzjjw3s.js → server-zyzawhdw.js} +25 -3
  177. package/dist/v2/{server-aavz8pm6.js → server-zzkj2fch.js} +3 -3
  178. package/dist/v2/server.js +4 -4
  179. package/dist/v2/{sqlite-4pqyynrs.js → sqlite-zf72c52d.js} +1 -1
  180. package/dist/v2/{storage-memory-j3v3hc83.js → storage-memory-y3qmy00r.js} +2 -2
  181. package/dist/v2/{storage-tags-hkwtbp3g.js → storage-tags-1h8k6ra9.js} +8 -4
  182. package/dist/v2/store-reader.d.ts +2 -0
  183. package/dist/v2/store-reader.d.ts.map +1 -1
  184. package/dist/v2/{wrapup-orchestrator-x4xj1782.js → wrapup-orchestrator-xs8redz9.js} +24 -24
  185. package/dist/wrapup-orchestrator-j7d7ry5b.js +48 -0
  186. package/package.json +1 -1
  187. package/src/config/latch-permanence-guard.test.ts +4 -0
  188. package/src/shared/historian-cache.test.ts +69 -0
  189. package/src/shared/historian-cache.ts +55 -0
  190. package/src/shared/model-suggestion-retry.ts +2 -0
  191. package/src/shared/rpc-discovery-cleanup.test.ts +57 -0
  192. package/src/shared/rpc-discovery-cleanup.ts +57 -0
  193. package/src/shared/rpc-server.ts +36 -13
  194. package/src/shared/search-text.test.ts +47 -0
  195. package/src/shared/search-text.ts +63 -0
  196. package/src/shared/sqlite.test.ts +56 -0
  197. package/src/shared/sqlite.ts +51 -2
  198. package/src/shared/storage-file-mutex-review.test.ts +22 -2
  199. package/src/shared/storage-file-mutex.ts +11 -1
  200. package/src/shared/subagent-runner.ts +2 -0
  201. package/src/shared/system-directive.ts +19 -1
  202. package/src/shared/tag-transcript.ts +12 -4
  203. package/dist/v2/embedding-backfill-jyd6492b.js +0 -23
  204. 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-wafzvyhg.js";
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-a8bvhwqs.js";
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-saews2s3.js";
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-hqkczed7.js";
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-nd7m2a5a.js";
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-7pa32z07.js";
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-mtw9e71a.js";
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-j6zw70pf.js";
300
+ } from "./index-p7m7j0cp.js";
300
301
  import {
301
302
  getMeasuredToolDefinitionTokens
302
- } from "./index-n6m03s3n.js";
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-cj9g0j7a.js";
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-wk0n1cgt.js";
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-ayym1x7f.js";
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-qrahzcqv.js";
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-fkx2qnvw.js";
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
- sweepOrphanedOpenCodeMessageIndexes2
563
- } from "./index-p4vde22c.js";
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-wv9n2zcq.js";
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-7b2cfmaz.js";
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-9nkg2dzk.js";
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-n78avt2p.js";
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-4qfy7v57.js";
673
+ } from "./index-vrzjhftj.js";
672
674
  import {
673
675
  flushIgnoredMessages2,
674
676
  clearIgnoredMessages2,
675
677
  observeIgnoredNotificationEvent2,
676
678
  sendStatusNotification2
677
- } from "./index-b17m64g9.js";
679
+ } from "./index-s74zqahq.js";
678
680
  import {
679
681
  setRecompStarting2,
680
682
  setRecompTerminal2
681
- } from "./index-v63beg1z.js";
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-kn4t1haw.js";
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-6a6dq53h.js";
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 sweepOrphanedOpenCodeMessageIndexes2(db, openSource, options);
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 sweepOrphanedOpenCodeMessageIndexes2(db, () => source, options);
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(`[dreamer] timer tick (${origin}) — projects=${registeredProjects.size}`);
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
- const reason = lease.reason === "cooldown_active" ? `cooldown active until ${lease.nextAllowedAt}` : `lease held by ${lease.leaseHolder ?? "another holder"} until ${lease.leaseExpiresAt ?? "unknown"}`;
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-tjcaj5x7.js"));
16276
- const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-2x9edkrp.js"));
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-vj2tbp22.js"));
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
- return Object.assign(transform, {
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 createHash13 } from "node:crypto";
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" && createHash13("sha256").update(part.text).digest("hex") === derived[3]) : [];
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 createHash14 } from "node:crypto";
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-${createHash14("sha256").update(stableId).digest("hex")}`;
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-${createHash14("sha256").update(monotonicId).digest("hex")}`;
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 join7 } from "node:path";
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 join7(env.XDG_CACHE_HOME || join7(homedir2(), ".cache"), "opencode", "models.json");
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-hqkczed7.js";
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-fkx2qnvw.js";
13
+ } from "./index-6x57ar45.js";
14
14
  import {
15
15
  messageFtsOrdinalRangeIsMapped2
16
- } from "./index-dqe8pq4x.js";
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
- db.prepare(`DELETE FROM schema_migrations_meta WHERE key IN (
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-fkx2qnvw.js";
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-wafzvyhg.js";
19
+ } from "./index-beht37jy.js";
20
20
  import {
21
21
  computeNormalizedHash
22
22
  } from "./index-2bvekkfy.js";