@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
@@ -6,27 +6,26 @@ import {
6
6
  StaleRouteHandleError,
7
7
  SubcClient,
8
8
  isConsumerReconnectTransient
9
- } from "./index-wfybj1dw.js";
9
+ } from "./index-g4t7850m.js";
10
10
  import {
11
11
  getHarness2
12
12
  } from "./index-pavzsdc6.js";
13
13
  import {
14
14
  getDataDir
15
15
  } from "./index-g2q4htwp.js";
16
- import {
17
- log2
18
- } from "./index-h7tgn49j.js";
19
16
  import {
20
17
  inRootAsyncContext2
21
18
  } from "./index-gzy5w8ya.js";
19
+ import {
20
+ log2
21
+ } from "./index-jrfre9ah.js";
22
22
  import {
23
23
  buildCanonicalChunkTextFromFts2,
24
24
  loadCompartmentChunkEmbeddingsForSearch2,
25
25
  peekCompartmentChunkSearchPool2,
26
26
  warmCompartmentChunkSearchPool2
27
- } from "./index-v7287tzq.js";
27
+ } from "./index-dcjkw41m.js";
28
28
  import {
29
- recordEmbeddingMeasurement,
30
29
  saveCommitEmbedding,
31
30
  loadProjectCommitEmbeddings,
32
31
  loadUnembeddedCommits,
@@ -41,7 +40,10 @@ import {
41
40
  enqueueShadowEmbeddingItems2,
42
41
  getProjectEmbeddingSnapshot2,
43
42
  embedItemsForProject2
44
- } from "./index-2743x98y.js";
43
+ } from "./index-21fgrfrf.js";
44
+ import {
45
+ recordEmbeddingMeasurement
46
+ } from "./index-2amn2s73.js";
45
47
  import {
46
48
  getProjectEmbeddings2
47
49
  } from "./index-4dhv7mqz.js";
@@ -50,7 +52,7 @@ import {
50
52
  isEmbeddingEnabled,
51
53
  embedText,
52
54
  ensureMemoryEmbeddings2
53
- } from "./index-rfxzazzy.js";
55
+ } from "./index-ty4vhe4n.js";
54
56
  import {
55
57
  ModuleMemoryAuthorityError2,
56
58
  getMemoriesByProject2,
@@ -59,37 +61,39 @@ import {
59
61
  } from "./index-jjvbk92s.js";
60
62
  import {
61
63
  USER_FACING_FAILURES,
62
- getNotes,
63
- getActivePrimers,
64
64
  relaxedFtsQuery,
65
65
  sanitizeFtsQuery,
66
66
  searchMemoriesFTS,
67
67
  searchMemoriesFTSUnion
68
- } from "./index-as2amvn3.js";
68
+ } from "./index-xnm0wq1r.js";
69
69
  import {
70
- cleanSearchText,
71
- keywordRelevance,
72
70
  matchedSearchSnippet,
73
71
  getIndexedMessageCorpusSize
74
- } from "./index-9gpw8hrm.js";
72
+ } from "./index-2rs7912w.js";
75
73
  import {
76
74
  MESSAGE_FTS_SESSION_FILTER_SQL,
77
75
  withMessageFtsSessionFilter
78
76
  } from "./index-kaqs6h31.js";
79
77
  import {
80
78
  isRecord
81
- } from "./index-np3rgfw4.js";
79
+ } from "./index-8jjjmhab.js";
82
80
  import {
83
81
  getMessageIndexEpoch,
84
- isMessageIndexSearchable
85
- } from "./index-04z754rd.js";
82
+ isMessageIndexSearchable,
83
+ autoSearchRelevance,
84
+ recordAutoSearchLane
85
+ } from "./index-dz48h1wx.js";
86
86
  import {
87
87
  resolveWorkspaceShareCategories,
88
88
  resolveWorkspaceIdentitySet,
89
89
  expandWorkspaceIdentitySetWithAliases,
90
90
  resolveStoredPathWorkspaceIdentity,
91
91
  sourceNameForMemory
92
- } from "./index-7kkphb6c.js";
92
+ } from "./index-nj360hcs.js";
93
+ import {
94
+ getNotes,
95
+ getActivePrimers
96
+ } from "./index-2qbtqg1w.js";
93
97
  import {
94
98
  isKnownAutocommit
95
99
  } from "./index-8ajstryz.js";
@@ -1438,6 +1442,7 @@ var RERANK_MODEL = "gte-reranker-modernbert-base-f32";
1438
1442
  var RERANK_LANE_LIMIT = 25;
1439
1443
  var DEADLINE_MS = 1500;
1440
1444
  var DOCUMENT_BYTES = 1024;
1445
+ var proseWordSegmenter = new Intl.Segmenter(undefined, { granularity: "word" });
1441
1446
  function isProseQuery(query) {
1442
1447
  const text = query.trim();
1443
1448
  if (!text || /[\n;]|^["'`]|["'`]$/.test(text))
@@ -1446,10 +1451,10 @@ function isProseQuery(query) {
1446
1451
  return false;
1447
1452
  if (/\b(?:[A-Z][A-Z_]+:|\w*(?:Error|Exception):)|\bat\s+\S+\s*\(/.test(text))
1448
1453
  return false;
1449
- const words = text.replace(/[?!.]$/, "").split(/\s+/);
1454
+ const words = /(?![a-zA-Z])\p{L}/u.test(text) ? [...proseWordSegmenter.segment(text)].filter((word) => word.isWordLike).map((word) => word.segment) : text.replace(/[?!.]$/, "").split(/\s+/);
1450
1455
  if (words.length < 3)
1451
1456
  return false;
1452
- const plain = words.filter((word) => /^[a-zA-Z]+(?:['’-][a-zA-Z]+)*$/.test(word));
1457
+ const plain = words.filter((word) => /^[\p{L}\p{M}]+(?:['’-][\p{L}\p{M}]+)*$/u.test(word));
1453
1458
  if (/^(?:how|why|what|where|when|which|who)\b/i.test(text))
1454
1459
  return plain.length >= 3;
1455
1460
  return words.length >= 4 && plain.length >= 3 && !/[\\/]|::|=/.test(text);
@@ -2711,11 +2716,17 @@ async function searchCompartmentChunks(args) {
2711
2716
  if (args.limit <= 0 || !args.modelId || args.modelId === "off") {
2712
2717
  if (args.timings)
2713
2718
  args.timings.chunkPool = "off";
2719
+ if (args.diagnostics)
2720
+ args.diagnostics.pool = "off";
2721
+ args.reportDiagnostics?.();
2714
2722
  return [];
2715
2723
  }
2716
2724
  if (!args.queryEmbedding) {
2717
2725
  if (args.timings)
2718
2726
  args.timings.chunkPool = "no-vector";
2727
+ if (args.diagnostics)
2728
+ args.diagnostics.pool = "no-vector";
2729
+ args.reportDiagnostics?.();
2719
2730
  if (args.warmOnly)
2720
2731
  warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
2721
2732
  return [];
@@ -2723,15 +2734,25 @@ async function searchCompartmentChunks(args) {
2723
2734
  const cutoff = args.maxOrdinal != null && args.maxOrdinal >= 0 ? args.maxOrdinal : null;
2724
2735
  let rows;
2725
2736
  if (args.warmOnly) {
2726
- const warm = peekCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange);
2737
+ const warm = peekCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange, args.diagnostics);
2727
2738
  if (warm === null) {
2728
2739
  if (args.timings)
2729
2740
  args.timings.chunkPool = "cold";
2741
+ if (args.diagnostics) {
2742
+ args.diagnostics.pool = "cold";
2743
+ args.diagnostics.poolRows = 0;
2744
+ }
2745
+ args.reportDiagnostics?.();
2730
2746
  warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
2731
2747
  return [];
2732
2748
  }
2733
2749
  if (args.timings)
2734
2750
  args.timings.chunkPool = "warm";
2751
+ if (args.diagnostics) {
2752
+ args.diagnostics.pool = "warm";
2753
+ args.diagnostics.poolRows = warm.length;
2754
+ }
2755
+ args.reportDiagnostics?.();
2735
2756
  rows = warm;
2736
2757
  } else {
2737
2758
  try {
@@ -3101,6 +3122,8 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
3101
3122
  lanes.message_fts = (outcome.laneResults ?? outcome.results).slice(0, 25);
3102
3123
  if (timings)
3103
3124
  timings.messageMs = performance.now() - stepStartedAt;
3125
+ recordAutoSearchLane(options.autoSearchDiagnostics, "messages", trimmedQuery, messageResults);
3126
+ options.onAutoSearchDiagnostics?.();
3104
3127
  }
3105
3128
  stepStartedAt = performance.now();
3106
3129
  const capturedQuery = await queryEmbeddingPromise;
@@ -3118,6 +3141,8 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
3118
3141
  stepStartedAt = performance.now();
3119
3142
  if (timings)
3120
3143
  timings.chunkPool = "off";
3144
+ if (options.autoSearchDiagnostics && !runCompartmentChunks)
3145
+ options.autoSearchDiagnostics.pool = "off";
3121
3146
  const compartmentResults = runCompartmentChunks ? await searchCompartmentChunks({
3122
3147
  db,
3123
3148
  sessionId,
@@ -3129,8 +3154,13 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
3129
3154
  dateRange,
3130
3155
  warmOnly: options.chunkPoolWarmOnly,
3131
3156
  signal: options.signal,
3132
- timings
3157
+ timings,
3158
+ diagnostics: options.autoSearchDiagnostics,
3159
+ reportDiagnostics: options.onAutoSearchDiagnostics
3133
3160
  }) : [];
3161
+ if (runCompartmentChunks)
3162
+ recordAutoSearchLane(options.autoSearchDiagnostics, "summaries", trimmedQuery, compartmentResults);
3163
+ options.onAutoSearchDiagnostics?.();
3134
3164
  if (timings && runCompartmentChunks)
3135
3165
  timings.chunkMs = performance.now() - stepStartedAt;
3136
3166
  stepStartedAt = performance.now();
@@ -3191,6 +3221,11 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
3191
3221
  ]);
3192
3222
  if (timings)
3193
3223
  timings.otherLanesMs = performance.now() - stepStartedAt;
3224
+ if (runMemory)
3225
+ recordAutoSearchLane(options.autoSearchDiagnostics, "memory", trimmedQuery, memoryOutcome.results);
3226
+ if (runGitCommits)
3227
+ recordAutoSearchLane(options.autoSearchDiagnostics, "git", trimmedQuery, gitCommitResults);
3228
+ options.onAutoSearchDiagnostics?.();
3194
3229
  if (options.diagnostics) {
3195
3230
  options.diagnostics.suppressedVisibleMemoryIds = memoryOutcome.suppressedVisibleIds;
3196
3231
  }
@@ -3253,7 +3288,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
3253
3288
  if (options.autoHint) {
3254
3289
  return results.map((result) => ({
3255
3290
  ...result,
3256
- relevanceScore: cleanSearchText(result.source === "compartment" ? result.title : result.content).length === 0 ? 0 : result.source === "message" || ("matchType" in result) && result.source !== "compartment" && result.matchType !== "semantic" ? keywordRelevance(trimmedQuery, result.content) : result.score
3291
+ relevanceScore: autoSearchRelevance(trimmedQuery, result)
3257
3292
  }));
3258
3293
  }
3259
3294
  return results;
@@ -0,0 +1,265 @@
1
+ import {
2
+ sanitizeDiagnosticText
3
+ } from "./index-z4p0ry94.js";
4
+
5
+ // src/features/magic-context/fail-closed-block.ts
6
+ var FAIL_CLOSED_DOCTOR_COMMAND = "npx @cortexkit/magic-context@latest doctor";
7
+ var FAIL_CLOSED_REPROBE_EVERY_N = 5;
8
+ function attachFailClosedBlockingProcessEvidence(process, evidence) {
9
+ Object.defineProperties(process, {
10
+ startTime: { configurable: true, value: evidence.startTime },
11
+ commandLine: { configurable: true, value: evidence.commandLine }
12
+ });
13
+ return process;
14
+ }
15
+
16
+ class FailClosedBlockingError extends Error {
17
+ code = "FAIL_CLOSED_BLOCKING";
18
+ reason;
19
+ constructor(message, reason, options) {
20
+ super(message, options);
21
+ this.name = "FailClosedBlockingError";
22
+ this.reason = reason;
23
+ }
24
+ }
25
+ var OPENCODE_INTERNAL_AGENT_NAMES = new Set(["title", "summary", "compaction"]);
26
+ function isMagicContextHiddenAgentName(agent) {
27
+ if (agent === "smart-note-compiler" || agent.startsWith("smart-note-")) {
28
+ return true;
29
+ }
30
+ if (agent === "historian" || agent.startsWith("historian-"))
31
+ return true;
32
+ if (agent === "dreamer" || agent.startsWith("dreamer-"))
33
+ return true;
34
+ return false;
35
+ }
36
+ var MAX_FORMATTED_BLOCKING_PROCESSES = 8;
37
+ var MAX_FORMATTED_COMMAND_LINE_LENGTH = 80;
38
+ function normalizeFailClosedProcessKind(process) {
39
+ switch (process.kind) {
40
+ case "OpenCode server":
41
+ case "OpenCode instance (TUI/CLI)":
42
+ case "Pi":
43
+ case "process":
44
+ return process.kind;
45
+ }
46
+ switch (process.harness?.trim().toLowerCase()) {
47
+ case "opencode server":
48
+ return "OpenCode server";
49
+ case "opencode instance (tui/cli)":
50
+ case "opencode instance":
51
+ return "OpenCode instance (TUI/CLI)";
52
+ case "pi":
53
+ case "pi harness":
54
+ case "omp":
55
+ return "Pi";
56
+ default:
57
+ return "process";
58
+ }
59
+ }
60
+ function formatFailClosedProcessStartTime(startTime) {
61
+ if (!Number.isFinite(startTime) || startTime <= 0)
62
+ return "unverified";
63
+ try {
64
+ const parts = new Intl.DateTimeFormat("en-US", {
65
+ day: "numeric",
66
+ hour: "2-digit",
67
+ minute: "2-digit",
68
+ month: "short",
69
+ hour12: false
70
+ }).formatToParts(new Date(startTime));
71
+ const values = Object.fromEntries(parts.map(({ type, value }) => [type, value]));
72
+ if (!values.month || !values.day || !values.hour || !values.minute)
73
+ return "unverified";
74
+ return `${values.month} ${values.day} ${values.hour}:${values.minute}`;
75
+ } catch {
76
+ return "unverified";
77
+ }
78
+ }
79
+ function formatFailClosedCommandLine(commandLine) {
80
+ if (typeof commandLine !== "string" || commandLine.trim().length === 0)
81
+ return "unverified";
82
+ try {
83
+ const normalized = commandLine.replaceAll("\x00", " ").replace(/\s+/g, " ").trim();
84
+ if (normalized.length === 0)
85
+ return "unverified";
86
+ const sanitized = sanitizeDiagnosticText(normalized).trim();
87
+ if (sanitized.length === 0)
88
+ return "unverified";
89
+ return sanitized.length > MAX_FORMATTED_COMMAND_LINE_LENGTH ? `${sanitized.slice(0, MAX_FORMATTED_COMMAND_LINE_LENGTH - 3)}...` : sanitized;
90
+ } catch {
91
+ return "unverified";
92
+ }
93
+ }
94
+ function formatFailClosedBlockingProcesses(processes) {
95
+ const uniqueProcesses = new Map;
96
+ for (const process of processes) {
97
+ if (!Number.isInteger(process.pid) || process.pid <= 0)
98
+ continue;
99
+ const candidate = {
100
+ kind: normalizeFailClosedProcessKind(process),
101
+ pid: process.pid,
102
+ startTime: process.startTime,
103
+ commandLine: process.commandLine
104
+ };
105
+ const previous = uniqueProcesses.get(process.pid);
106
+ if (!previous || previous.kind === "process" && candidate.kind !== "process") {
107
+ uniqueProcesses.set(process.pid, candidate);
108
+ } else {
109
+ uniqueProcesses.set(process.pid, {
110
+ ...previous,
111
+ startTime: previous.startTime ?? candidate.startTime,
112
+ commandLine: previous.commandLine ?? candidate.commandLine
113
+ });
114
+ }
115
+ }
116
+ const entries = [...uniqueProcesses.values()];
117
+ const visible = entries.slice(0, MAX_FORMATTED_BLOCKING_PROCESSES);
118
+ const rendered = visible.map(({ kind, pid }) => `${kind} (PID ${pid})`);
119
+ const omitted = entries.length - visible.length;
120
+ if (omitted > 0)
121
+ rendered.push(`${omitted} more blocking process(es)`);
122
+ if (rendered.length === 0)
123
+ return "a live process";
124
+ const summary = rendered.length === 1 ? rendered[0] : `${rendered.slice(0, -1).join(", ")}, and ${rendered.at(-1)}`;
125
+ const evidence = entries.map(({ kind, pid, startTime, commandLine }) => `- PID ${pid}: ${kind}, started ${formatFailClosedProcessStartTime(startTime)}, cmd: ${formatFailClosedCommandLine(commandLine)}`).join(`
126
+ `);
127
+ return `${summary}
128
+ Blocking process evidence:
129
+ ${evidence}`;
130
+ }
131
+ function formatFailClosedBlockingMessage(reason) {
132
+ if (reason.kind === "migration_guard") {
133
+ if (reason.unreadableFile) {
134
+ const arm = reason.unreadableArm ?? "io";
135
+ const recovery = arm === "io" ? `If none of these processes are running, it is safe to delete ${reason.unreadableFile} and retry.` : `The file may be a recent incomplete write; retry after the file is older than the ten-minute grace window, or stop the relevant process before deleting it.`;
136
+ return [
137
+ `Magic Context cannot migrate the shared database because RPC discovery file ${reason.unreadableFile} is uncertain (${arm} arm), so the absence of a live process cannot be proven.`,
138
+ recovery,
139
+ `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
140
+ ].join(" ");
141
+ }
142
+ return [
143
+ `Magic Context cannot migrate the shared database (one database serves every project on this machine) because ${formatFailClosedBlockingProcesses(reason.blockingProcesses)} may be running an older Magic Context build that would fail against the migrated database.`,
144
+ `The database is at upstream migration v${reason.persistedVersion}; this build needs v${reason.supportedVersion}.`,
145
+ "Restart the blocking process — even one from a different project — and it will pick up the new build and migrate on start; or shut it down and retry.",
146
+ "If that host loads a pinned or cached older Magic Context build, a restart alone is not enough: stop it or update its Magic Context build, then start this host once so it migrates the database with nothing older attached.",
147
+ `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
148
+ ].join(" ");
149
+ }
150
+ if (reason.kind === "schema_fence") {
151
+ return [
152
+ `Magic Context cannot operate: this Magic Context build is older than the database; upgrade/restart this harness (upstream migration lane v${reason.persistedVersion}, build supports through v${reason.supportedVersion}).`,
153
+ `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
154
+ ].join(" ");
155
+ }
156
+ const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
157
+ return [
158
+ `Magic Context cannot operate: persistent storage failed (${cause}).`,
159
+ "The plugin will not silently degrade to native compaction while enabled.",
160
+ `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
161
+ ].join(" ");
162
+ }
163
+ function formatFailClosedBlockingSummary(reason) {
164
+ if (reason.kind === "migration_guard") {
165
+ if (reason.unreadableFile) {
166
+ return `Magic Context cannot migrate the shared database from v${reason.persistedVersion} to v${reason.supportedVersion}: RPC discovery file ${reason.unreadableFile} could not be read, so an older host may still be attached.`;
167
+ }
168
+ const blockers = reason.blockingProcesses.filter((process) => Number.isInteger(process.pid) && process.pid > 0).map((process) => `${normalizeFailClosedProcessKind(process)} (PID ${process.pid})`);
169
+ const named = blockers.length > 0 ? blockers.join(", ") : "a live process";
170
+ return `Magic Context cannot migrate the shared database from v${reason.persistedVersion} to v${reason.supportedVersion} while ${named} may still run an older Magic Context build. Stop or update that host, then start this one once.`;
171
+ }
172
+ if (reason.kind === "schema_fence") {
173
+ return `Magic Context cannot operate: the shared database is at v${reason.persistedVersion}, newer than this build supports (v${reason.supportedVersion}). Update and restart this host.`;
174
+ }
175
+ const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
176
+ return `Magic Context cannot operate: persistent storage failed (${cause}).`;
177
+ }
178
+ function createFailClosedBlockingError(reason, options) {
179
+ return new FailClosedBlockingError(formatFailClosedBlockingMessage(reason), reason, options);
180
+ }
181
+ function isFailClosedBlockingError(error) {
182
+ return error instanceof FailClosedBlockingError || typeof error === "object" && error !== null && error.name === "FailClosedBlockingError" && error.code === "FAIL_CLOSED_BLOCKING";
183
+ }
184
+ function shouldBypassFailClosedBlock(input) {
185
+ if (input.isPiSubagentEnv === true)
186
+ return true;
187
+ if (input.isInternalChildSession === true)
188
+ return true;
189
+ const agent = typeof input.agent === "string" ? input.agent.trim() : "";
190
+ if (agent.length === 0)
191
+ return false;
192
+ if (OPENCODE_INTERNAL_AGENT_NAMES.has(agent))
193
+ return true;
194
+ if (isMagicContextHiddenAgentName(agent))
195
+ return true;
196
+ return false;
197
+ }
198
+ function resolveAgentNameFromMessages(messages) {
199
+ for (let i = messages.length - 1;i >= 0; i -= 1) {
200
+ const info = messages[i]?.info;
201
+ if (!info || typeof info !== "object")
202
+ continue;
203
+ const agent = info.agent;
204
+ if (typeof agent === "string" && agent.length > 0)
205
+ return agent;
206
+ }
207
+ return;
208
+ }
209
+ function createFailClosedController(options) {
210
+ const reprobeEveryN = Math.max(1, options?.reprobeEveryN ?? FAIL_CLOSED_REPROBE_EVERY_N);
211
+ let reason = null;
212
+ let blockedPassCount = 0;
213
+ return {
214
+ arm(next) {
215
+ reason = next;
216
+ blockedPassCount = 0;
217
+ },
218
+ clear() {
219
+ reason = null;
220
+ blockedPassCount = 0;
221
+ },
222
+ isArmed() {
223
+ return reason !== null;
224
+ },
225
+ getReason() {
226
+ return reason;
227
+ },
228
+ async enforce(input) {
229
+ if (!reason)
230
+ return;
231
+ if (!input.blockingEnabled)
232
+ return;
233
+ if (input.exempt)
234
+ return;
235
+ blockedPassCount += 1;
236
+ const shouldReprobe = typeof input.tryReopen === "function" && (blockedPassCount === 1 || blockedPassCount % reprobeEveryN === 0);
237
+ if (shouldReprobe) {
238
+ try {
239
+ const healed = await input.tryReopen?.();
240
+ if (healed) {
241
+ reason = null;
242
+ blockedPassCount = 0;
243
+ return;
244
+ }
245
+ } catch {}
246
+ }
247
+ const blockedReason = reason;
248
+ if (!blockedReason)
249
+ return;
250
+ throw createFailClosedBlockingError(blockedReason);
251
+ }
252
+ };
253
+ }
254
+ var lastHookInitFailure = null;
255
+ function recordHookInitFailure(failure) {
256
+ lastHookInitFailure = failure;
257
+ }
258
+ function clearHookInitFailure() {
259
+ lastHookInitFailure = null;
260
+ }
261
+ function getLastHookInitFailure() {
262
+ return lastHookInitFailure;
263
+ }
264
+
265
+ export { FAIL_CLOSED_DOCTOR_COMMAND, attachFailClosedBlockingProcessEvidence, formatFailClosedBlockingMessage, formatFailClosedBlockingSummary, createFailClosedBlockingError, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, createFailClosedController, recordHookInitFailure, clearHookInitFailure, getLastHookInitFailure };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./index-nxrsns5x.js";
3
+ } from "./index-c5dzns43.js";
4
4
  import {
5
5
  getSynapseLaneIdentity
6
- } from "./index-wfybj1dw.js";
6
+ } from "./index-g4t7850m.js";
7
7
  import {
8
8
  getHarness2
9
9
  } from "./index-pavzsdc6.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  importPluginModule,
15
15
  log2
16
- } from "./index-h7tgn49j.js";
16
+ } from "./index-jrfre9ah.js";
17
17
  import {
18
18
  inRootAsyncContext2
19
19
  } from "./index-gzy5w8ya.js";