@cortexkit/opencode-magic-context 0.49.34 → 0.49.36

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 (312) hide show
  1. package/README.md +1 -1
  2. package/dist/auto-search-worker.js +163 -155
  3. package/dist/chunk-embedding-write-worker.js +70 -66
  4. package/dist/{compaction-marker-candidates-31h86ph0.js → compaction-marker-candidates-5p1qkve9.js} +5 -2
  5. package/dist/compaction-marker-candidates-worker.js +24 -23
  6. package/dist/{compartment-chunk-embedding-5q5gj67r.js → compartment-chunk-embedding-ypktm0tk.js} +10 -8
  7. package/dist/{conflict-warning-hook-xgskea1v.js → conflict-warning-hook-b75jn458.js} +11 -9
  8. package/dist/{context-p3xrarzt.js → context-969z683s.js} +1839 -746
  9. package/dist/{derive-budgets-pqybnx09.js → derive-budgets-htj16n4x.js} +3 -2
  10. package/dist/embedding-backfill-rma0v2ct.js +28 -0
  11. package/dist/embedding-worker-process.js +2 -1
  12. package/dist/embedding-worker.js +6 -5
  13. package/dist/expand-attachments-h33jbgyz.js +21 -0
  14. package/dist/features/magic-context/auto-search-diagnostics.d.ts +21 -0
  15. package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
  16. package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
  17. package/dist/features/magic-context/compaction-marker.d.ts +5 -3
  18. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  19. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
  20. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  21. package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
  22. package/dist/features/magic-context/dreamer/verify-gate.d.ts +2 -0
  23. package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -1
  24. package/dist/features/magic-context/dreamer/verify-state.d.ts +9 -0
  25. package/dist/features/magic-context/dreamer/verify-state.d.ts.map +1 -0
  26. package/dist/features/magic-context/dreamer/verify.d.ts +2 -1
  27. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  28. package/dist/features/magic-context/migration-worker-client.d.ts +3 -0
  29. package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
  30. package/dist/features/magic-context/migration-worker.d.ts +15 -0
  31. package/dist/features/magic-context/migration-worker.d.ts.map +1 -1
  32. package/dist/features/magic-context/overflow-detection.d.ts +2 -2
  33. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  34. package/dist/features/magic-context/search-rerank.d.ts.map +1 -1
  35. package/dist/features/magic-context/search.d.ts +4 -0
  36. package/dist/features/magic-context/search.d.ts.map +1 -1
  37. package/dist/features/magic-context/storage-meta-persisted.d.ts +1 -0
  38. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  39. package/dist/features/magic-context/storage-tags.d.ts +4 -0
  40. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  41. package/dist/features/magic-context/store-generation-rebase-labels.d.ts +6 -0
  42. package/dist/features/magic-context/store-generation-rebase-labels.d.ts.map +1 -0
  43. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
  44. package/dist/features/magic-context/work-metrics-carry-storage.d.ts +10 -0
  45. package/dist/features/magic-context/work-metrics-carry-storage.d.ts.map +1 -0
  46. package/dist/{history-owner-36wp3mkb.js → history-owner-0z620wgz.js} +3 -2
  47. package/dist/hooks/magic-context/apply-operations.d.ts +20 -3
  48. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
  50. package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
  51. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +10 -2
  53. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -1
  55. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts +4 -0
  56. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts.map +1 -0
  57. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  58. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +1 -0
  59. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  60. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  61. package/dist/hooks/magic-context/final-wire-completeness.d.ts +15 -0
  62. package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -0
  63. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  64. package/dist/hooks/magic-context/issue-423-fixture.d.ts +1 -1
  65. package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -1
  66. package/dist/hooks/magic-context/issue-424-fixture.d.ts +1 -1
  67. package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -1
  68. package/dist/hooks/magic-context/project-structural-sentinels.d.ts +25 -0
  69. package/dist/hooks/magic-context/project-structural-sentinels.d.ts.map +1 -0
  70. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +8 -1
  71. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  72. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
  73. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  74. package/dist/hooks/magic-context/read-session-chunk.d.ts +11 -0
  75. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  76. package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
  77. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  78. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +2 -0
  79. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
  80. package/dist/hooks/magic-context/release-recovery-prefix.d.ts +9 -0
  81. package/dist/hooks/magic-context/release-recovery-prefix.d.ts.map +1 -0
  82. package/dist/hooks/magic-context/strip-structural-noise.d.ts +6 -3
  83. package/dist/hooks/magic-context/strip-structural-noise.d.ts.map +1 -1
  84. package/dist/hooks/magic-context/transform-context-state.d.ts +3 -0
  85. package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
  86. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +3 -0
  87. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  88. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  89. package/dist/{index-cpjk5jd2.js → index-1d042x6w.js} +16 -14
  90. package/dist/{index-2743x98y.js → index-21fgrfrf.js} +35 -142
  91. package/dist/index-2amn2s73.js +123 -0
  92. package/dist/{index-c7phnbvk.js → index-2p37txes.js} +1 -1
  93. package/dist/index-2qbtqg1w.js +529 -0
  94. package/dist/{index-9gpw8hrm.js → index-2rs7912w.js} +4 -4
  95. package/dist/{index-m1x9ghk5.js → index-4ks89h5a.js} +37 -7
  96. package/dist/{index-b88dwwrh.js → index-4xyjr62e.js} +1 -1
  97. package/dist/index-4y35msh5.js +531 -0
  98. package/dist/index-66a50f3e.js +777 -0
  99. package/dist/index-72czy45z.js +4557 -0
  100. package/dist/index-7v05d9b7.js +58 -0
  101. package/dist/{index-qgh1qwjj.js → index-850vthn3.js} +9 -3
  102. package/dist/{index-np3rgfw4.js → index-8jjjmhab.js} +15 -4
  103. package/dist/index-96ztjvkn.js +204 -0
  104. package/dist/{index-fm36bjv4.js → index-9fgmkfaf.js} +22 -277
  105. package/dist/{index-atekmqef.js → index-9tdvbdv1.js} +508 -5547
  106. package/dist/{index-xrnsygfq.js → index-9wnbnx8f.js} +1 -1
  107. package/dist/{index-waktfbjy.js → index-ae1ar4v1.js} +4 -4
  108. package/dist/{index-v15ne3a3.js → index-b1ydbp95.js} +2 -2
  109. package/dist/{index-nxrsns5x.js → index-c5dzns43.js} +75 -75
  110. package/dist/{index-v7287tzq.js → index-dcjkw41m.js} +19 -8
  111. package/dist/{index-hbx7m8he.js → index-dfdg2cgg.js} +338 -86
  112. package/dist/{index-spwjbkc7.js → index-dnqqqc5f.js} +1 -1
  113. package/dist/{index-04z754rd.js → index-dz48h1wx.js} +33 -5
  114. package/dist/{index-rrv26qjz.js → index-fw42ms3m.js} +1 -1
  115. package/dist/{index-t5pck3ss.js → index-fxbk7gk3.js} +1 -1
  116. package/dist/{index-wfybj1dw.js → index-g4t7850m.js} +2 -2
  117. package/dist/{index-97spytxq.js → index-gnmhbyyc.js} +583 -474
  118. package/dist/{index-4pnsgvfk.js → index-hacf2tyx.js} +1 -1
  119. package/dist/index-j105mf16.js +270 -0
  120. package/dist/{index-gkee6p4g.js → index-jggt5gf2.js} +3 -3
  121. package/dist/{index-s1n8dd2n.js → index-jkanybgq.js} +2 -2
  122. package/dist/{index-h7tgn49j.js → index-jrfre9ah.js} +5 -222
  123. package/dist/{index-kfyb3k6n.js → index-jz5bk7xd.js} +2 -2
  124. package/dist/{index-7kkphb6c.js → index-nj360hcs.js} +4 -4
  125. package/dist/{index-07vskjn8.js → index-pp8vdn01.js} +15 -13
  126. package/dist/index-prw8apnc.js +194 -0
  127. package/dist/{index-rverk2vz.js → index-r2epb000.js} +34 -4
  128. package/dist/{index-7g9dr8gy.js → index-tn9drm1a.js} +125 -143
  129. package/dist/{index-kq5w68dp.js → index-txs8tce6.js} +1 -1
  130. package/dist/{index-rfxzazzy.js → index-ty4vhe4n.js} +5 -5
  131. package/dist/{index-y1qwzvxn.js → index-vd2ywmfe.js} +2 -2
  132. package/dist/{index-0677w9sd.js → index-wcwhhtdh.js} +58 -23
  133. package/dist/index-wh9fxds5.js +265 -0
  134. package/dist/{index-51rdvtkz.js → index-xd2p95m7.js} +3 -3
  135. package/dist/{index-as2amvn3.js → index-xnm0wq1r.js} +6 -531
  136. package/dist/{index-ftr84kkv.js → index-ys7j6679.js} +7 -5
  137. package/dist/index-z4p0ry94.js +222 -0
  138. package/dist/index-z9zygwse.js +89 -0
  139. package/dist/index.js +86 -74
  140. package/dist/{logger-94kew5wm.js → logger-qwnbcfj9.js} +2 -1
  141. package/dist/{message-fts-rowid-map-va36knh4.js → message-fts-rowid-map-t6qsyg9s.js} +7 -5
  142. package/dist/{message-index-bounded-qh91fdr3.js → message-index-bounded-wfk6aqxk.js} +15 -13
  143. package/dist/{message-time-backfill-4qva0b4f.js → message-time-backfill-39bm498k.js} +3 -2
  144. package/dist/migration-worker.js +55 -48
  145. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  146. package/dist/{project-embedding-registry-6yex0r9f.js → project-embedding-registry-3yyegjma.js} +16 -13
  147. package/dist/raw-ordinal-warmup-worker.js +114 -113
  148. package/dist/{read-session-chunk-kaghtr75.js → read-session-chunk-26yrrhyz.js} +18 -12
  149. package/dist/{read-session-raw-b2sd67v4.js → read-session-raw-j7c9w57v.js} +5 -3
  150. package/dist/recomp-orchestrator-wk509qkp.js +69 -0
  151. package/dist/render-h1qarr8a.js +44 -0
  152. package/dist/{safe-notification-target-mkr9yzvr.js → safe-notification-target-wztd7bgk.js} +3 -2
  153. package/dist/search-5h9fydyq.js +54 -0
  154. package/dist/search-archive-q79hyqxs.js +29 -0
  155. package/dist/{send-session-notification-vz86nt79.js → send-session-notification-14p3yje4.js} +9 -7
  156. package/dist/shared/model-suggestion-retry.d.ts +7 -0
  157. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  158. package/dist/shared/prompt-async-transport.d.ts.map +1 -1
  159. package/dist/shared/reusable-worker-entry.d.ts +4 -0
  160. package/dist/shared/reusable-worker-entry.d.ts.map +1 -0
  161. package/dist/shared/reusable-worker.d.ts +6 -0
  162. package/dist/shared/reusable-worker.d.ts.map +1 -0
  163. package/dist/shared/reusable-worker.fixture.d.ts +2 -0
  164. package/dist/shared/reusable-worker.fixture.d.ts.map +1 -0
  165. package/dist/shared/worker-shutdown.d.ts +1 -1
  166. package/dist/shared/worker-shutdown.d.ts.map +1 -1
  167. package/dist/{storage-tags-6hvkk01c.js → storage-tags-vj0yj7ed.js} +5 -4
  168. package/dist/store-reader-yh19h38c.js +14 -0
  169. package/dist/store-s3eykdjt.js +21 -0
  170. package/dist/tools/ctx-expand/render.d.ts +5 -3
  171. package/dist/tools/ctx-expand/render.d.ts.map +1 -1
  172. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
  173. package/dist/tools/ctx-expand/tools.d.ts +2 -0
  174. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  175. package/dist/tools/ctx-expand/v2-archive-reader.d.ts +33 -0
  176. package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -0
  177. package/dist/{transform-postprocess-phase-ph38mhrs.js → transform-postprocess-phase-4gj0mtcg.js} +39 -32
  178. package/dist/v2/auto-search-worker.js +163 -155
  179. package/dist/v2/chunk-embedding-write-worker.js +71 -67
  180. package/dist/v2/compaction-marker-candidates-worker.js +24 -23
  181. package/dist/v2/{compaction-marker-candidates-m4vmye3w.js → compaction-marker-candidates-yeb2ky46.js} +6 -3
  182. package/dist/v2/{compartment-chunk-embedding-rc31e6md.js → compartment-chunk-embedding-qfk791bd.js} +11 -9
  183. package/dist/v2/{context-s60hcatx.js → context-bxr039be.js} +2678 -1246
  184. package/dist/v2/{derive-budgets-knf763tt.js → derive-budgets-sa0v7bz0.js} +4 -3
  185. package/dist/v2/embedding-backfill-00tw59rx.js +27 -0
  186. package/dist/v2/embedding-worker-process.js +2 -1
  187. package/dist/v2/embedding-worker.js +6 -5
  188. package/dist/v2/expand-attachments-h33jbgyz.js +21 -0
  189. package/dist/v2/fold/code-mode-catalog.d.ts +3 -0
  190. package/dist/v2/fold/code-mode-catalog.d.ts.map +1 -0
  191. package/dist/v2/fold/idle.d.ts +16 -0
  192. package/dist/v2/fold/idle.d.ts.map +1 -0
  193. package/dist/v2/fold/manual-baseline.d.ts +8 -0
  194. package/dist/v2/fold/manual-baseline.d.ts.map +1 -0
  195. package/dist/v2/fold/native-replay-v3.d.ts +75 -0
  196. package/dist/v2/fold/native-replay-v3.d.ts.map +1 -0
  197. package/dist/v2/fold/native-replay.d.ts +81 -8
  198. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  199. package/dist/v2/fold/policy.d.ts +2 -1
  200. package/dist/v2/fold/policy.d.ts.map +1 -1
  201. package/dist/v2/fold/restore.d.ts.map +1 -1
  202. package/dist/v2/fold/summary.d.ts +4 -0
  203. package/dist/v2/fold/summary.d.ts.map +1 -0
  204. package/dist/v2/hidden-completion.d.ts.map +1 -1
  205. package/dist/v2/{history-owner-ad0crnrn.js → history-owner-fpka43cn.js} +3 -2
  206. package/dist/v2/hooks/channel2.d.ts +6 -0
  207. package/dist/v2/hooks/channel2.d.ts.map +1 -1
  208. package/dist/v2/hooks/context.d.ts.map +1 -1
  209. package/dist/v2/hooks/expand-attachments.d.ts +8 -0
  210. package/dist/v2/hooks/expand-attachments.d.ts.map +1 -0
  211. package/dist/v2/hooks/overflow-recovery.d.ts +45 -0
  212. package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -0
  213. package/dist/v2/hooks/restore-rows.d.ts +12 -2
  214. package/dist/v2/hooks/restore-rows.d.ts.map +1 -1
  215. package/dist/v2/hooks/store.d.ts +7 -2
  216. package/dist/v2/hooks/store.d.ts.map +1 -1
  217. package/dist/v2/hooks/synthetic-admission.d.ts +7 -0
  218. package/dist/v2/hooks/synthetic-admission.d.ts.map +1 -0
  219. package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
  220. package/dist/v2/{logger-p34mjtja.js → logger-4cj6d03m.js} +2 -1
  221. package/dist/v2/{message-fts-rowid-map-78awh03v.js → message-fts-rowid-map-z86avy0n.js} +8 -6
  222. package/dist/v2/{message-index-bounded-4htdr1j6.js → message-index-bounded-w14496s9.js} +16 -14
  223. package/dist/v2/{message-time-backfill-zvthw6xb.js → message-time-backfill-0c4h7sg6.js} +3 -2
  224. package/dist/v2/migration-worker.js +56 -49
  225. package/dist/v2/ordinal-range.fixture.d.ts +7 -0
  226. package/dist/v2/ordinal-range.fixture.d.ts.map +1 -0
  227. package/dist/v2/{project-embedding-registry-1x5qe2fy.js → project-embedding-registry-jqq2qeqb.js} +17 -14
  228. package/dist/v2/raw-ordinal-warmup-worker.js +114 -113
  229. package/dist/v2/{read-session-chunk-1fa9qzwb.js → read-session-chunk-tqnh1ret.js} +18 -12
  230. package/dist/v2/{read-session-raw-5x088amc.js → read-session-raw-qpp6x9kg.js} +6 -4
  231. package/dist/v2/recomp-orchestrator-9cjk6aej.js +68 -0
  232. package/dist/v2/render-5dz1knf2.js +43 -0
  233. package/dist/v2/{safe-notification-target-khnzg57c.js → safe-notification-target-gphhast7.js} +3 -2
  234. package/dist/v2/search-8yfet25y.js +52 -0
  235. package/dist/v2/search-archive-z6z9jqwf.js +28 -0
  236. package/dist/v2/{send-session-notification-x5nzy34v.js → send-session-notification-kxp47tsw.js} +9 -7
  237. package/dist/v2/{server-cpjk5jd2.js → server-1d042x6w.js} +16 -14
  238. package/dist/v2/server-2amn2s73.js +123 -0
  239. package/dist/v2/{server-6g98c227.js → server-3schkz95.js} +4 -4
  240. package/dist/v2/server-468mya5v.js +209 -0
  241. package/dist/v2/{server-z2wft9zv.js → server-5by3vdzs.js} +562 -5560
  242. package/dist/v2/{server-qjvk4a9t.js → server-69m30b21.js} +1 -1
  243. package/dist/v2/server-6emy0v9a.js +531 -0
  244. package/dist/v2/{server-vr4szghm.js → server-6vzh6wej.js} +3 -3
  245. package/dist/v2/{server-ajxhrgjv.js → server-7094pk3w.js} +80 -19
  246. package/dist/v2/{server-ab8017gw.js → server-7acq7815.js} +34 -141
  247. package/dist/v2/server-7v05d9b7.js +58 -0
  248. package/dist/v2/{server-24g8r2d0.js → server-7zacmty5.js} +75 -75
  249. package/dist/v2/{server-3mz2qh5a.js → server-969cdpmg.js} +1 -1
  250. package/dist/v2/server-96ztjvkn.js +204 -0
  251. package/dist/v2/{server-grakwy1v.js → server-a9w5f0yw.js} +37 -7
  252. package/dist/v2/{server-835q39kd.js → server-avdveykk.js} +3 -3
  253. package/dist/v2/{server-qc915kw2.js → server-bez34e60.js} +4 -4
  254. package/dist/v2/{server-h1byrhwx.js → server-cp1a03vc.js} +19 -8
  255. package/dist/v2/{server-bsgd4dk1.js → server-dcws5831.js} +2 -2
  256. package/dist/v2/{server-m1pfg2d4.js → server-dfq5vb8j.js} +4 -4
  257. package/dist/v2/server-e51xmr4d.js +194 -0
  258. package/dist/v2/server-ef1mskas.js +777 -0
  259. package/dist/v2/{server-1bw1wcbp.js → server-f0j864ma.js} +1 -1
  260. package/dist/v2/{server-jw5qe9y8.js → server-g3gqq4ac.js} +18 -217
  261. package/dist/v2/{server-2aasmpsp.js → server-gkse1wyz.js} +5 -5
  262. package/dist/v2/{server-6495nmn9.js → server-jb6tjyeb.js} +5 -222
  263. package/dist/v2/{server-qvy4qavp.js → server-jd7vzwn4.js} +125 -143
  264. package/dist/v2/{server-a7x00tw8.js → server-mfn1yf9d.js} +1 -1
  265. package/dist/v2/{server-awr8qa4c.js → server-nmyganc8.js} +2 -2
  266. package/dist/v2/{server-tkdabx8q.js → server-nq3cb7be.js} +5 -530
  267. package/dist/v2/server-qjyp27vf.js +270 -0
  268. package/dist/v2/{server-gyy4k6mf.js → server-qmmkhz2z.js} +1 -1
  269. package/dist/v2/{server-29qp8nz4.js → server-qxzbmtqt.js} +1 -1
  270. package/dist/v2/{server-806rzhs6.js → server-r4430x9m.js} +10 -4
  271. package/dist/v2/{server-53eh1r8r.js → server-sd8hvzte.js} +2 -2
  272. package/dist/v2/{server-k3t06fxr.js → server-sefxj8k1.js} +1 -1
  273. package/dist/v2/server-t8y64xj7.js +4513 -0
  274. package/dist/v2/{server-6vd2n183.js → server-tnzbk64q.js} +35 -5
  275. package/dist/v2/{server-v77xa5wj.js → server-tpt7bwq8.js} +1 -1
  276. package/dist/v2/{server-51779zs2.js → server-v0p37hm2.js} +4 -1
  277. package/dist/v2/{server-nxas8v1d.js → server-xfjjbrkt.js} +15 -4
  278. package/dist/v2/{server-cqjvxyrp.js → server-xy7w7hrd.js} +2 -2
  279. package/dist/v2/server-ypf1ap0v.js +529 -0
  280. package/dist/v2/server-z4p0ry94.js +222 -0
  281. package/dist/v2/server-z9zygwse.js +89 -0
  282. package/dist/v2/{server-ab1g0wn9.js → server-zzgtgqmd.js} +2 -2
  283. package/dist/v2/server.js +7 -6
  284. package/dist/v2/{storage-tags-18nbaanf.js → storage-tags-cw07ky67.js} +5 -4
  285. package/dist/v2/store-reader-cgx47zkp.js +14 -0
  286. package/dist/v2/store-reader.d.ts +9 -2
  287. package/dist/v2/store-reader.d.ts.map +1 -1
  288. package/dist/v2/store-z3qe67cg.js +21 -0
  289. package/dist/v2/v2-archive-reader-z7wr42ry.js +11 -0
  290. package/dist/v2/{wrapup-orchestrator-wxf7n5k6.js → wrapup-orchestrator-j1v62bkj.js} +50 -42
  291. package/dist/v2-archive-reader-028z6kck.js +11 -0
  292. package/dist/wrapup-orchestrator-xg9avt2p.js +56 -0
  293. package/package.json +1 -1
  294. package/src/shared/model-suggestion-retry.ts +1 -1
  295. package/src/shared/prompt-async-transport.test.ts +64 -3
  296. package/src/shared/prompt-async-transport.ts +61 -16
  297. package/src/shared/reusable-worker-entry.ts +58 -0
  298. package/src/shared/reusable-worker-reset.test.ts +108 -0
  299. package/src/shared/reusable-worker.fixture.ts +35 -0
  300. package/src/shared/reusable-worker.test.ts +253 -0
  301. package/src/shared/reusable-worker.ts +240 -0
  302. package/src/shared/sqlite-transaction-mode-guard.test.ts +2 -0
  303. package/src/shared/worker-shutdown.ts +21 -17
  304. package/dist/embedding-backfill-0jgtqxen.js +0 -25
  305. package/dist/recomp-orchestrator-0y983w7h.js +0 -62
  306. package/dist/search-archive-1kw2rp19.js +0 -26
  307. package/dist/search-p684j8ww.js +0 -50
  308. package/dist/v2/embedding-backfill-f43hd8y6.js +0 -24
  309. package/dist/v2/recomp-orchestrator-7q9nvxte.js +0 -61
  310. package/dist/v2/search-archive-xfp51s0g.js +0 -25
  311. package/dist/v2/search-wf8rqxhm.js +0 -48
  312. package/dist/wrapup-orchestrator-ys2nrkkb.js +0 -49
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- **English** · [简体中文](docs/i18n/README.zh-CN.md) · [繁體中文](docs/i18n/README.zh-TW.md) · [한국어](docs/i18n/README.ko.md) · [Deutsch](docs/i18n/README.de.md) · [Español](docs/i18n/README.es.md) · [Français](docs/i18n/README.fr.md) · [Italiano](docs/i18n/README.it.md) · [Dansk](docs/i18n/README.da.md) · [日本語](docs/i18n/README.ja.md) · [Polski](docs/i18n/README.pl.md) · [Русский](docs/i18n/README.ru.md) · [Bosanski](docs/i18n/README.bs.md) · [العربية](docs/i18n/README.ar.md) · [Norsk](docs/i18n/README.nb.md) · [Português (Brasil)](docs/i18n/README.pt-BR.md) · [ไทย](docs/i18n/README.th.md) · [Türkçe](docs/i18n/README.tr.md) · [Українська](docs/i18n/README.uk.md) · [বাংলা](docs/i18n/README.bn.md) · [Ελληνικά](docs/i18n/README.el.md) · [Tiếng Việt](docs/i18n/README.vi.md)
1
+ **English** · [简体中文](docs/i18n/README.zh-CN.md) · [繁體中文](docs/i18n/README.zh-TW.md) · [한국어](docs/i18n/README.ko.md) · [Deutsch](docs/i18n/README.de.md) · [Español](docs/i18n/README.es.md) · [Français](docs/i18n/README.fr.md) · [Italiano](docs/i18n/README.it.md) · [Dansk](docs/i18n/README.da.md) · [日本語](docs/i18n/README.ja.md) · [Polski](docs/i18n/README.pl.md) · [Русский](docs/i18n/README.ru.md) · [Bosanski](docs/i18n/README.bs.md) · [العربية](docs/i18n/README.ar.md) · [فارسی](docs/i18n/README.fa.md) · [Norsk](docs/i18n/README.nb.md) · [Português (Brasil)](docs/i18n/README.pt-BR.md) · [ไทย](docs/i18n/README.th.md) · [Türkçe](docs/i18n/README.tr.md) · [Українська](docs/i18n/README.uk.md) · [বাংলা](docs/i18n/README.bn.md) · [Ελληνικά](docs/i18n/README.el.md) · [Tiếng Việt](docs/i18n/README.vi.md)
2
2
 
3
3
  <h1 align="center">Magic Context</h1>
4
4
 
@@ -1,171 +1,179 @@
1
1
  import {
2
2
  exitOnWorkerClose
3
- } from "./index-cpjk5jd2.js";
3
+ } from "./index-1d042x6w.js";
4
+ import {
5
+ serveWorkerJobs
6
+ } from "./index-7v05d9b7.js";
4
7
 
5
8
  // src/hooks/magic-context/auto-search-worker.ts
6
- import { parentPort, workerData } from "node:worker_threads";
7
- if (!parentPort)
8
- throw new Error("auto-search worker requires a parent port");
9
- var port = parentPort;
10
- var input = workerData;
11
- var persistent = input.persistent === true;
12
- if (input.job === "messages") {
13
- port.postMessage({ kind: "accepted" });
14
- }
15
- var [
16
- { ensureMemoryEmbeddings },
17
- { getProjectEmbeddings },
18
- { getMemoriesByProject },
19
- { installProjectEmbeddingSearchBridge },
20
- { searchMessageHistory, unifiedSearch },
21
- { getLastCompartmentChunkPoolWarm, maintainCompartmentChunkSearchPools },
22
- { setEmbeddingSessionBusy },
23
- { getHarness, setHarness },
24
- { Database, registerSqliteDiagnosticSink },
25
- { log }
26
- ] = await Promise.all([
27
- import("./embedding-backfill-0jgtqxen.js"),
28
- import("./embedding-cache-mgyr73ef.js"),
29
- import("./storage-memory-e6a7mb0k.js"),
30
- import("./project-embedding-registry-6yex0r9f.js"),
31
- import("./search-p684j8ww.js"),
32
- import("./compartment-chunk-embedding-5q5gj67r.js"),
33
- import("./embedding-activity-g1dhes6g.js"),
34
- import("./harness-e4avh192.js"),
35
- import("./sqlite-zdgm52sv.js"),
36
- import("./logger-94kew5wm.js")
37
- ]);
38
- setHarness(input.harness);
39
- registerSqliteDiagnosticSink(log, getHarness);
40
- var nextId = 0;
41
- var pending = new Map;
42
- var queryDimensions = null;
43
- var db;
44
- port.on("message", (reply) => {
45
- if (reply.embeddingHostBusy !== undefined)
46
- setEmbeddingSessionBusy(input.sessionId, reply.embeddingHostBusy);
47
- const vector = reply.result instanceof Float32Array ? reply.result : reply.result?.vector;
48
- if (vector)
49
- queryDimensions = vector.length;
50
- pending.get(reply.id)?.(reply);
51
- pending.delete(reply.id);
52
- });
53
- function request(message) {
54
- return new Promise((resolve, reject) => {
55
- const id = ++nextId;
56
- pending.set(id, (reply) => reply.error ? reject(new Error(reply.error)) : resolve(reply));
57
- port?.postMessage({ ...message, id });
58
- });
59
- }
60
- db = new Database(input.path, input.job === "backfill" ? undefined : { readonly: true });
61
- db.exec("PRAGMA busy_timeout = 250");
62
- var { closePort } = exitOnWorkerClose(port, () => db.close());
63
- var CHUNK_POOL_MAINTENANCE_INTERVAL_MS = 5000;
64
- var maintenanceTimer;
65
- var maintaining = false;
66
- function maintainChunkPools() {
67
- if (maintaining)
68
- return;
69
- maintaining = true;
70
- maintainCompartmentChunkSearchPools(db).catch(() => {}).finally(() => {
71
- maintaining = false;
9
+ serveWorkerJobs(async (initial, port) => {
10
+ let input = initial;
11
+ function post(reply) {
12
+ port.postMessage({ ...reply, jobId: input.jobId });
13
+ }
14
+ const persistent = input.persistent === true;
15
+ if (input.job === "messages") {
16
+ post({ kind: "accepted" });
17
+ }
18
+ const [
19
+ { ensureMemoryEmbeddings },
20
+ { getProjectEmbeddings },
21
+ { getMemoriesByProject },
22
+ { installProjectEmbeddingSearchBridge },
23
+ { searchMessageHistory, unifiedSearch },
24
+ { getLastCompartmentChunkPoolWarm, maintainCompartmentChunkSearchPools },
25
+ { setEmbeddingSessionBusy },
26
+ { getHarness, setHarness },
27
+ { Database, registerSqliteDiagnosticSink },
28
+ { log }
29
+ ] = await Promise.all([
30
+ import("./embedding-backfill-rma0v2ct.js"),
31
+ import("./embedding-cache-mgyr73ef.js"),
32
+ import("./storage-memory-e6a7mb0k.js"),
33
+ import("./project-embedding-registry-3yyegjma.js"),
34
+ import("./search-5h9fydyq.js"),
35
+ import("./compartment-chunk-embedding-ypktm0tk.js"),
36
+ import("./embedding-activity-g1dhes6g.js"),
37
+ import("./harness-e4avh192.js"),
38
+ import("./sqlite-zdgm52sv.js"),
39
+ import("./logger-qwnbcfj9.js")
40
+ ]);
41
+ setHarness(input.harness);
42
+ registerSqliteDiagnosticSink(log, getHarness);
43
+ let nextId = 0;
44
+ const pending = new Map;
45
+ let queryDimensions = null;
46
+ let db;
47
+ port.on("message", (reply) => {
48
+ if (reply.jobId !== input.jobId)
49
+ return;
50
+ if (reply.embeddingHostBusy !== undefined)
51
+ setEmbeddingSessionBusy(input.sessionId, reply.embeddingHostBusy);
52
+ const vector = reply.result instanceof Float32Array ? reply.result : reply.result?.vector;
53
+ if (vector)
54
+ queryDimensions = vector.length;
55
+ pending.get(reply.id)?.(reply);
56
+ pending.delete(reply.id);
72
57
  });
73
- }
74
- function scheduleChunkPoolMaintenance() {
75
- if (!persistent)
76
- return;
77
- if (!maintenanceTimer) {
78
- maintenanceTimer = setInterval(maintainChunkPools, CHUNK_POOL_MAINTENANCE_INTERVAL_MS);
79
- maintenanceTimer.unref?.();
58
+ function request(message) {
59
+ return new Promise((resolve, reject) => {
60
+ const id = ++nextId;
61
+ pending.set(id, (reply) => reply.error ? reject(new Error(reply.error)) : resolve(reply));
62
+ post({ ...message, id });
63
+ });
80
64
  }
81
- setTimeout(maintainChunkPools, 0);
82
- }
83
- async function run(jobInput) {
84
- input = jobInput;
85
- queryDimensions = null;
86
- setEmbeddingSessionBusy(input.sessionId, input.embeddingHostBusy === true);
87
- if (input.snapshot) {
88
- installProjectEmbeddingSearchBridge(input.snapshot, {
89
- modelId: input.snapshot.modelId,
90
- initialize: async () => true,
91
- isLoaded: () => true,
92
- dispose: async () => {},
93
- embed: async (text) => {
94
- const result = (await request({ kind: "query", text })).result;
95
- return result instanceof Float32Array ? result : result?.vector ?? null;
96
- },
97
- embedBatch: async (texts, _signal, purpose = "passage") => {
98
- const passage = (await request({ kind: "batch", texts, purpose })).passage;
99
- const captured = input.snapshot;
100
- if (!passage || !captured || passage.generation !== captured.generation || passage.modelId !== captured.modelId || passage.providerIdentity !== captured.providerIdentity || passage.runtimeFingerprint !== captured.runtimeFingerprint || !queryDimensions || passage.dimensions !== queryDimensions || passage.vectors.length !== texts.length)
101
- return texts.map(() => null);
102
- return passage.vectors.map((vector) => vector && vector.length === queryDimensions && vector.every(Number.isFinite) ? vector : null);
103
- }
65
+ db = new Database(input.path, input.job === "backfill" ? undefined : { readonly: true });
66
+ db.exec("PRAGMA busy_timeout = 250");
67
+ const { closePort } = exitOnWorkerClose(port, () => db.close());
68
+ const CHUNK_POOL_MAINTENANCE_INTERVAL_MS = 5000;
69
+ let maintenanceTimer;
70
+ let maintaining = false;
71
+ function maintainChunkPools() {
72
+ if (maintaining)
73
+ return;
74
+ maintaining = true;
75
+ maintainCompartmentChunkSearchPools(db).catch(() => {}).finally(() => {
76
+ maintaining = false;
104
77
  });
105
78
  }
106
- try {
107
- if (input.job === "backfill") {
108
- if (input.snapshot?.enabled && input.snapshot.features.memoryEnabled) {
109
- await request({ kind: "query", text: input.query });
110
- if (queryDimensions) {
111
- const existingEmbeddings = getProjectEmbeddings(db, input.projectPath, input.snapshot.modelId);
112
- const memories = getMemoriesByProject(db, input.projectPath).filter((memory) => !existingEmbeddings.has(memory.id)).slice(0, 50);
113
- await ensureMemoryEmbeddings({
114
- db,
115
- projectIdentity: input.projectPath,
116
- memories,
117
- existingEmbeddings
118
- });
79
+ function scheduleChunkPoolMaintenance() {
80
+ if (!persistent)
81
+ return;
82
+ if (!maintenanceTimer) {
83
+ maintenanceTimer = setInterval(maintainChunkPools, CHUNK_POOL_MAINTENANCE_INTERVAL_MS);
84
+ maintenanceTimer.unref?.();
85
+ }
86
+ setTimeout(maintainChunkPools, 0);
87
+ }
88
+ async function run(jobInput) {
89
+ input = jobInput;
90
+ queryDimensions = null;
91
+ setEmbeddingSessionBusy(input.sessionId, input.embeddingHostBusy === true);
92
+ if (input.snapshot) {
93
+ installProjectEmbeddingSearchBridge(input.snapshot, {
94
+ modelId: input.snapshot.modelId,
95
+ initialize: async () => true,
96
+ isLoaded: () => true,
97
+ dispose: async () => {},
98
+ embed: async (text) => {
99
+ const result = (await request({ kind: "query", text })).result;
100
+ return result instanceof Float32Array ? result : result?.vector ?? null;
101
+ },
102
+ embedBatch: async (texts, _signal, purpose = "passage") => {
103
+ const passage = (await request({ kind: "batch", texts, purpose })).passage;
104
+ const captured = input.snapshot;
105
+ if (!passage || !captured || passage.generation !== captured.generation || passage.modelId !== captured.modelId || passage.providerIdentity !== captured.providerIdentity || passage.runtimeFingerprint !== captured.runtimeFingerprint || !queryDimensions || passage.dimensions !== queryDimensions || passage.vectors.length !== texts.length)
106
+ return texts.map(() => null);
107
+ return passage.vectors.map((vector) => vector && vector.length === queryDimensions && vector.every(Number.isFinite) ? vector : null);
119
108
  }
120
- }
121
- port.postMessage({ kind: "result", results: [] });
122
- } else if (input.job === "messages") {
123
- if (!input.messageRequest)
124
- throw new Error("message search job carries no request");
125
- const outcome = searchMessageHistory(db, input.messageRequest);
126
- port.postMessage({ kind: "messages", outcome });
127
- } else {
128
- const jobStarted = performance.now();
129
- const steps = {};
130
- const results = await unifiedSearch(db, input.sessionId, input.projectPath, input.query, {
131
- ...input.options,
132
- backfillMemoryEmbeddings: false,
133
- countRetrievals: false,
134
- measurementDisabled: true,
135
- embedQuery: async (text) => (await request({ kind: "query", text })).result ?? null,
136
- isEmbeddingRuntimeEnabled: () => input.embeddingRuntimeEnabled,
137
- stepTimings: steps
138
109
  });
139
- port.postMessage({
140
- kind: "result",
141
- results,
142
- timings: {
143
- steps,
144
- jobMs: performance.now() - jobStarted,
145
- lastPoolWarm: getLastCompartmentChunkPoolWarm()
110
+ }
111
+ try {
112
+ if (input.job === "backfill") {
113
+ if (input.snapshot?.enabled && input.snapshot.features.memoryEnabled) {
114
+ await request({ kind: "query", text: input.query });
115
+ if (queryDimensions) {
116
+ const existingEmbeddings = getProjectEmbeddings(db, input.projectPath, input.snapshot.modelId);
117
+ const memories = getMemoriesByProject(db, input.projectPath).filter((memory) => !existingEmbeddings.has(memory.id)).slice(0, 50);
118
+ await ensureMemoryEmbeddings({
119
+ db,
120
+ projectIdentity: input.projectPath,
121
+ memories,
122
+ existingEmbeddings
123
+ });
124
+ }
146
125
  }
126
+ post({ kind: "result", results: [] });
127
+ } else if (input.job === "messages") {
128
+ if (!input.messageRequest)
129
+ throw new Error("message search job carries no request");
130
+ const outcome = searchMessageHistory(db, input.messageRequest);
131
+ post({ kind: "messages", outcome });
132
+ } else {
133
+ const jobStarted = performance.now();
134
+ const steps = {};
135
+ const diagnostics = input.options.autoSearchDiagnostics;
136
+ const results = await unifiedSearch(db, input.sessionId, input.projectPath, input.query, {
137
+ ...input.options,
138
+ backfillMemoryEmbeddings: false,
139
+ countRetrievals: false,
140
+ measurementDisabled: true,
141
+ embedQuery: async (text) => (await request({ kind: "query", text })).result ?? null,
142
+ isEmbeddingRuntimeEnabled: () => input.embeddingRuntimeEnabled,
143
+ stepTimings: steps,
144
+ onAutoSearchDiagnostics: diagnostics ? () => port.postMessage({
145
+ kind: "diagnostics",
146
+ diagnostics,
147
+ jobId: jobInput.jobId
148
+ }) : undefined
149
+ });
150
+ post({
151
+ kind: "result",
152
+ results,
153
+ timings: {
154
+ steps,
155
+ jobMs: performance.now() - jobStarted,
156
+ lastPoolWarm: getLastCompartmentChunkPoolWarm()
157
+ }
158
+ });
159
+ scheduleChunkPoolMaintenance();
160
+ }
161
+ } catch (error) {
162
+ post({
163
+ kind: "error",
164
+ error: error instanceof Error ? error.message : String(error)
147
165
  });
148
- scheduleChunkPoolMaintenance();
149
- }
150
- } catch (error) {
151
- port.postMessage({
152
- kind: "error",
153
- error: error instanceof Error ? error.message : String(error)
154
- });
155
- } finally {
156
- setEmbeddingSessionBusy(input.sessionId, false);
157
- if (!persistent) {
158
- db.close();
159
- closePort();
166
+ } finally {
167
+ setEmbeddingSessionBusy(input.sessionId, false);
168
+ if (!persistent) {
169
+ db.close();
170
+ closePort();
171
+ }
160
172
  }
161
173
  }
162
- }
163
- port.on("message", (message) => {
164
- if (message.kind === "run" && message.input)
165
- run(message.input);
166
- });
167
- run(input).catch((error) => {
168
- setTimeout(() => {
169
- throw error;
174
+ port.on("message", (message) => {
175
+ if (message.kind === "run" && message.input)
176
+ run(message.input);
170
177
  });
178
+ await run(input);
171
179
  });
@@ -10,89 +10,93 @@ import {
10
10
  import {
11
11
  isWorkerCloseMessage,
12
12
  exitOnWorkerClose
13
- } from "./index-cpjk5jd2.js";
14
- import"./index-b88dwwrh.js";
13
+ } from "./index-1d042x6w.js";
14
+ import"./index-4xyjr62e.js";
15
15
  import"./index-g2q4htwp.js";
16
- import"./index-h7tgn49j.js";
17
- import"./index-wfybj1dw.js";
16
+ import"./index-z4p0ry94.js";
17
+ import"./index-jrfre9ah.js";
18
+ import"./index-g4t7850m.js";
18
19
  import"./index-v0p37hm2.js";
19
- import"./index-rverk2vz.js";
20
- import"./index-v15ne3a3.js";
20
+ import"./index-96ztjvkn.js";
21
+ import"./index-r2epb000.js";
22
+ import"./index-b1ydbp95.js";
21
23
  import {
22
24
  replaceCompartmentChunkEmbeddings2,
23
25
  recordChunkEmbedBackoff2,
24
26
  loadUnembeddedSessionChunkCandidates2,
25
27
  countUnembeddedSessionCompartments2
26
- } from "./index-v7287tzq.js";
28
+ } from "./index-dcjkw41m.js";
27
29
  import {
28
30
  recordSessionProjectIdentity,
29
31
  acquireGitSweepLease,
30
32
  renewGitSweepLease,
31
33
  releaseGitSweepLease
32
- } from "./index-kfyb3k6n.js";
33
- import"./index-kq5w68dp.js";
34
- import"./index-c7phnbvk.js";
34
+ } from "./index-jz5bk7xd.js";
35
+ import"./index-txs8tce6.js";
36
+ import"./index-2p37txes.js";
35
37
  import {
36
38
  LATEST_SUPPORTED_VERSION,
37
39
  enforceSchemaFence
38
- } from "./index-fm36bjv4.js";
39
- import"./index-7kkphb6c.js";
40
- import"./index-xrnsygfq.js";
40
+ } from "./index-9fgmkfaf.js";
41
+ import"./index-wh9fxds5.js";
42
+ import"./index-nj360hcs.js";
43
+ import"./index-9wnbnx8f.js";
41
44
  import"./index-fr0wbhdn.js";
42
45
  import"./index-58e3y90n.js";
43
- import"./index-s1n8dd2n.js";
44
- import"./index-t5pck3ss.js";
46
+ import"./index-jkanybgq.js";
47
+ import"./index-fxbk7gk3.js";
48
+ import {
49
+ serveWorkerJobs
50
+ } from "./index-7v05d9b7.js";
45
51
 
46
52
  // src/features/magic-context/chunk-embedding-write-worker.ts
47
- import { parentPort, workerData } from "node:worker_threads";
48
- var port = parentPort;
49
- if (!port)
50
- throw new Error("chunk embedding writer requires a parent port");
51
- setHarness2(workerData.harness);
52
- var db = new Database2(workerData.path);
53
- if (!enforceSchemaFence(db, workerData.path, LATEST_SUPPORTED_VERSION)) {
54
- db.close();
55
- throw new Error("chunk embedding writer rejected an unsupported store schema");
56
- }
57
- var timeout = Math.max(0, Math.floor(workerData.timeout));
58
- db.exec(`PRAGMA busy_timeout=${timeout}; PRAGMA foreign_keys=ON`);
59
- configureContextDatabasePragmas2(db);
60
- exitOnWorkerClose(port, () => db.close());
61
- port.on("message", (input) => {
62
- if (isWorkerCloseMessage(input))
63
- return;
64
- try {
65
- let value;
66
- switch (input.kind) {
67
- case "replace":
68
- replaceCompartmentChunkEmbeddings2(db, input.rows, input.sourceKey);
69
- break;
70
- case "project":
71
- recordSessionProjectIdentity(db, input.session, input.project);
72
- break;
73
- case "count":
74
- value = countUnembeddedSessionCompartments2(db, input.project, input.session, input.model, input.tokens);
75
- break;
76
- case "candidates":
77
- value = loadUnembeddedSessionChunkCandidates2(db, input.project, input.session, input.model, input.limit, input.excluded, input.tokens, true);
78
- break;
79
- case "backoff":
80
- recordChunkEmbedBackoff2(db, input.candidate, input.project, input.model);
81
- break;
82
- case "acquire":
83
- value = acquireGitSweepLease(db, input.project, input.holder, {
84
- ignoreCooldown: true
85
- });
86
- break;
87
- case "renew":
88
- value = renewGitSweepLease(db, input.project, input.holder);
89
- break;
90
- case "release":
91
- releaseGitSweepLease(db, input.project, input.holder);
92
- break;
93
- }
94
- port.postMessage({ value });
95
- } catch (error) {
96
- port.postMessage({ error: error instanceof Error ? error.message : String(error) });
53
+ serveWorkerJobs((workerData, port) => {
54
+ setHarness2(workerData.harness);
55
+ const db = new Database2(workerData.path);
56
+ if (!enforceSchemaFence(db, workerData.path, LATEST_SUPPORTED_VERSION)) {
57
+ db.close();
58
+ throw new Error("chunk embedding writer rejected an unsupported store schema");
97
59
  }
98
- });
60
+ const timeout = Math.max(0, Math.floor(workerData.timeout));
61
+ db.exec(`PRAGMA busy_timeout=${timeout}; PRAGMA foreign_keys=ON`);
62
+ configureContextDatabasePragmas2(db);
63
+ exitOnWorkerClose(port, () => db.close(), false);
64
+ port.on("message", (input) => {
65
+ if (isWorkerCloseMessage(input))
66
+ return;
67
+ try {
68
+ let value;
69
+ switch (input.kind) {
70
+ case "replace":
71
+ replaceCompartmentChunkEmbeddings2(db, input.rows, input.sourceKey);
72
+ break;
73
+ case "project":
74
+ recordSessionProjectIdentity(db, input.session, input.project);
75
+ break;
76
+ case "count":
77
+ value = countUnembeddedSessionCompartments2(db, input.project, input.session, input.model, input.tokens);
78
+ break;
79
+ case "candidates":
80
+ value = loadUnembeddedSessionChunkCandidates2(db, input.project, input.session, input.model, input.limit, input.excluded, input.tokens, true);
81
+ break;
82
+ case "backoff":
83
+ recordChunkEmbedBackoff2(db, input.candidate, input.project, input.model);
84
+ break;
85
+ case "acquire":
86
+ value = acquireGitSweepLease(db, input.project, input.holder, {
87
+ ignoreCooldown: true
88
+ });
89
+ break;
90
+ case "renew":
91
+ value = renewGitSweepLease(db, input.project, input.holder);
92
+ break;
93
+ case "release":
94
+ releaseGitSweepLease(db, input.project, input.holder);
95
+ break;
96
+ }
97
+ port.postMessage({ value });
98
+ } catch (error) {
99
+ port.postMessage({ error: error instanceof Error ? error.message : String(error) });
100
+ }
101
+ });
102
+ }, false);
@@ -4,12 +4,15 @@ import {
4
4
  readMarkerCandidateBasis2,
5
5
  prepareMarkerCandidateBasis2,
6
6
  scanMarkerCandidateSnapshot2
7
- } from "./index-qgh1qwjj.js";
7
+ } from "./index-850vthn3.js";
8
+ import"./index-96ztjvkn.js";
8
9
  import"./index-v0p37hm2.js";
9
10
  import"./index-gzy5w8ya.js";
10
- import"./index-h7tgn49j.js";
11
+ import"./index-jrfre9ah.js";
11
12
  import"./index-g2q4htwp.js";
12
13
  import"./index-pavzsdc6.js";
14
+ import"./index-z4p0ry94.js";
15
+ import"./index-1d042x6w.js";
13
16
  export {
14
17
  invalidateMarkerCandidateBasis2 as invalidateMarkerCandidateBasis,
15
18
  isMarkerCandidateBasisCurrent2 as isMarkerCandidateBasisCurrent,
@@ -1,24 +1,25 @@
1
+ import {
2
+ serveWorkerJobs
3
+ } from "./index-7v05d9b7.js";
4
+
1
5
  // src/features/magic-context/compaction-marker-candidates-worker.ts
2
- import { parentPort, workerData } from "node:worker_threads";
3
- var port = parentPort;
4
- if (!port)
5
- throw new Error("marker candidate worker requires a parent port");
6
- port.postMessage({ kind: "accepted" });
7
- var [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
8
- import("./sqlite-zdgm52sv.js"),
9
- import("./compaction-marker-candidates-31h86ph0.js")
10
- ]);
11
- var input = workerData;
12
- var db;
13
- var reply;
14
- try {
15
- db = new Database(input.path, { readonly: true });
16
- db.exec("PRAGMA busy_timeout=250");
17
- reply = { kind: "candidates", snapshot: scanMarkerCandidateSnapshot(db, input.sessionId) };
18
- } catch (error) {
19
- reply = { kind: "error", error: error instanceof Error ? error.message : String(error) };
20
- } finally {
21
- db?.close();
22
- }
23
- port.postMessage(reply);
24
- port.close();
6
+ serveWorkerJobs(async (input, port) => {
7
+ port.postMessage({ kind: "accepted" });
8
+ const [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
9
+ import("./sqlite-zdgm52sv.js"),
10
+ import("./compaction-marker-candidates-5p1qkve9.js")
11
+ ]);
12
+ let db;
13
+ let reply;
14
+ try {
15
+ db = new Database(input.path, { readonly: true });
16
+ db.exec("PRAGMA busy_timeout=250");
17
+ reply = { kind: "candidates", snapshot: scanMarkerCandidateSnapshot(db, input.sessionId) };
18
+ } catch (error) {
19
+ reply = { kind: "error", error: error instanceof Error ? error.message : String(error) };
20
+ } finally {
21
+ db?.close();
22
+ }
23
+ port.postMessage(reply);
24
+ port.close();
25
+ });
@@ -24,18 +24,20 @@ import {
24
24
  countSessionCompartmentEmbedCoverage2,
25
25
  countSessionCompartmentEmbedCoveragePolite2,
26
26
  countUnembeddedSessionCompartmentsPolite2
27
- } from "./index-v7287tzq.js";
28
- import"./index-wfybj1dw.js";
29
- import"./index-v15ne3a3.js";
30
- import"./index-rverk2vz.js";
27
+ } from "./index-dcjkw41m.js";
28
+ import"./index-g4t7850m.js";
29
+ import"./index-b1ydbp95.js";
30
+ import"./index-r2epb000.js";
31
+ import"./index-96ztjvkn.js";
31
32
  import"./index-v0p37hm2.js";
32
- import"./index-t5pck3ss.js";
33
- import"./index-b88dwwrh.js";
33
+ import"./index-fxbk7gk3.js";
34
+ import"./index-4xyjr62e.js";
34
35
  import"./index-gzy5w8ya.js";
35
- import"./index-h7tgn49j.js";
36
+ import"./index-jrfre9ah.js";
36
37
  import"./index-g2q4htwp.js";
37
38
  import"./index-pavzsdc6.js";
38
- import"./index-cpjk5jd2.js";
39
+ import"./index-z4p0ry94.js";
40
+ import"./index-1d042x6w.js";
39
41
  export {
40
42
  CHUNK_WINDOW_SAFETY_RATIO2 as CHUNK_WINDOW_SAFETY_RATIO,
41
43
  DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2 as DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS,
@@ -4,21 +4,23 @@ import {
4
4
  cleanupConflictWarnings2,
5
5
  sendSchemaFenceWarning2,
6
6
  sendStartupAnnouncement2
7
- } from "./index-gkee6p4g.js";
8
- import"./index-4pnsgvfk.js";
7
+ } from "./index-jggt5gf2.js";
8
+ import"./index-hacf2tyx.js";
9
9
  import"./index-sd3egckz.js";
10
- import"./index-waktfbjy.js";
10
+ import"./index-ae1ar4v1.js";
11
11
  import"./index-qt1qqasc.js";
12
- import"./index-y1qwzvxn.js";
13
- import"./index-rrv26qjz.js";
14
- import"./index-58e3y90n.js";
15
- import"./index-rverk2vz.js";
12
+ import"./index-vd2ywmfe.js";
13
+ import"./index-fw42ms3m.js";
14
+ import"./index-r2epb000.js";
15
+ import"./index-96ztjvkn.js";
16
16
  import"./index-v0p37hm2.js";
17
+ import"./index-58e3y90n.js";
17
18
  import"./index-gzy5w8ya.js";
18
- import"./index-h7tgn49j.js";
19
+ import"./index-jrfre9ah.js";
19
20
  import"./index-g2q4htwp.js";
20
21
  import"./index-pavzsdc6.js";
21
- import"./index-cpjk5jd2.js";
22
+ import"./index-z4p0ry94.js";
23
+ import"./index-1d042x6w.js";
22
24
  export {
23
25
  __conflictWarningTest2 as __conflictWarningTest,
24
26
  cleanupConflictWarnings2 as cleanupConflictWarnings,