@cortexkit/opencode-magic-context 0.49.19 → 0.49.20

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 (271) hide show
  1. package/dist/auto-search-worker.js +48 -9
  2. package/dist/chunk-embedding-write-worker.js +30 -23
  3. package/dist/{compaction-marker-candidates-n4krhat4.js → compaction-marker-candidates-b2q30cft.js} +3 -3
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/compartment-chunk-embedding-va090as0.js +65 -0
  6. package/dist/config/schema/magic-context.d.ts +6 -6
  7. package/dist/{conflict-warning-hook-4pmz879v.js → conflict-warning-hook-frp3z2wk.js} +9 -8
  8. package/dist/{context-j31m2dv7.js → context-mkece1db.js} +455 -134
  9. package/dist/{derive-budgets-zn7yzd2d.js → derive-budgets-pqybnx09.js} +2 -2
  10. package/dist/embedding-backfill-gy3p78py.js +25 -0
  11. package/dist/embedding-worker-process.js +2 -2
  12. package/dist/embedding-worker.js +5 -5
  13. package/dist/features/magic-context/chunk-embedding-writer.d.ts.map +1 -1
  14. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +44 -1
  15. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  16. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
  18. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +2 -0
  19. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  20. package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
  21. package/dist/features/magic-context/memory/embedding-local.d.ts +1 -0
  22. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  23. package/dist/features/magic-context/memory/local-embedding-pooling.d.ts +22 -0
  24. package/dist/features/magic-context/memory/local-embedding-pooling.d.ts.map +1 -0
  25. package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
  26. package/dist/features/magic-context/message-index.d.ts +2 -0
  27. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  28. package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
  29. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  30. package/dist/features/magic-context/search.d.ts +27 -0
  31. package/dist/features/magic-context/search.d.ts.map +1 -1
  32. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
  33. package/dist/features/magic-context/storage-meta-persisted.d.ts +1 -0
  34. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  35. package/dist/features/magic-context/subagent-token-capture.d.ts +20 -0
  36. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
  37. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  38. package/dist/{history-owner-xp3pngv7.js → history-owner-36wp3mkb.js} +2 -2
  39. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/auto-embed-session.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/auto-search-hint.d.ts +7 -1
  42. package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  44. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +33 -6
  45. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/cache-busting-signals.d.ts +5 -2
  47. package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/compartment-runner-types.d.ts +5 -0
  51. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
  53. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/diagnostic-log-state.d.ts +4 -0
  55. package/dist/hooks/magic-context/diagnostic-log-state.d.ts.map +1 -0
  56. package/dist/hooks/magic-context/execute-reclaim.d.ts +35 -0
  57. package/dist/hooks/magic-context/execute-reclaim.d.ts.map +1 -0
  58. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  59. package/dist/hooks/magic-context/hook.d.ts +1 -3
  60. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  61. package/dist/hooks/magic-context/latest-assistant-turn.d.ts +8 -0
  62. package/dist/hooks/magic-context/latest-assistant-turn.d.ts.map +1 -1
  63. package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +5 -0
  64. package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
  65. package/dist/hooks/magic-context/nudge-evaluation-log.d.ts +3 -0
  66. package/dist/hooks/magic-context/nudge-evaluation-log.d.ts.map +1 -0
  67. package/dist/hooks/magic-context/pending-drop-eligibility.d.ts.map +1 -1
  68. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +4 -0
  69. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  70. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  71. package/dist/hooks/magic-context/system-date-refresh.d.ts +5 -5
  72. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  73. package/dist/hooks/magic-context/system-prompt-sticky-date.d.ts +10 -0
  74. package/dist/hooks/magic-context/system-prompt-sticky-date.d.ts.map +1 -0
  75. package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
  76. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  77. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  78. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +21 -6
  79. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  80. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  81. package/dist/{index-bjcnntmz.js → index-0wthn7fp.js} +468 -18
  82. package/dist/{index-kq82mtg0.js → index-11zf2wwc.js} +3 -3
  83. package/dist/{index-b5vqckbw.js → index-153r2q6z.js} +314 -127
  84. package/dist/{index-3h4dp9wb.js → index-1pefp8ar.js} +5 -5
  85. package/dist/{index-beht37jy.js → index-1zx2pa5d.js} +1 -1
  86. package/dist/{index-ze7mvk54.js → index-2yhtnfcf.js} +75 -57
  87. package/dist/{index-cf74k5ak.js → index-305y133n.js} +4 -4
  88. package/dist/{index-s734jcsr.js → index-35qc6606.js} +9 -3
  89. package/dist/{index-se4m2g6w.js → index-48stjd56.js} +105 -19
  90. package/dist/{index-4911rn0b.js → index-4n7w9rad.js} +6 -6
  91. package/dist/{index-kee4kn5j.js → index-4pnsgvfk.js} +1 -1
  92. package/dist/{v2/server-8cd2j99z.js → index-5kym00ag.js} +32 -13
  93. package/dist/{index-4s3t0nd0.js → index-616rsjrv.js} +2 -2
  94. package/dist/{index-jhghdnsm.js → index-67nyj0gy.js} +485 -202
  95. package/dist/{index-6x57ar45.js → index-adk2z5d8.js} +3 -3
  96. package/dist/{index-c5pytzne.js → index-b88dwwrh.js} +1 -1
  97. package/dist/{index-rr2bb45z.js → index-c4b76d4t.js} +2 -2
  98. package/dist/{index-nj7yykkx.js → index-c7phnbvk.js} +1 -1
  99. package/dist/index-cpjk5jd2.js +82 -0
  100. package/dist/{index-edmpdxcw.js → index-d6rp4dxh.js} +5 -5
  101. package/dist/{index-dxmq29t1.js → index-dc8hy95c.js} +69 -17
  102. package/dist/{index-j75v2476.js → index-h7tgn49j.js} +12 -15
  103. package/dist/{index-ke416mdc.js → index-j76ah6d7.js} +2 -2
  104. package/dist/{index-c1p88z1y.js → index-jfh3cktr.js} +4 -4
  105. package/dist/{index-a6mc0v4d.js → index-jmycsey7.js} +3 -3
  106. package/dist/{index-24fezq97.js → index-jr5na10t.js} +4 -4
  107. package/dist/{index-s74zqahq.js → index-kc9pn495.js} +4 -4
  108. package/dist/{index-p5y3k4g7.js → index-nda0zgna.js} +2 -1
  109. package/dist/{index-jn12fvvh.js → index-neb2jaed.js} +3 -3
  110. package/dist/{index-63k48rv9.js → index-pnjwa6qa.js} +5 -5
  111. package/dist/{index-jrr131e0.js → index-rmd0069m.js} +11 -11
  112. package/dist/{index-y9f76s3f.js → index-rrv26qjz.js} +1 -1
  113. package/dist/{index-v10f1rjv.js → index-spwjbkc7.js} +1 -1
  114. package/dist/{index-k29z4aqh.js → index-t5pck3ss.js} +1 -1
  115. package/dist/{index-3esx8tkf.js → index-t7hx3qcb.js} +318 -104
  116. package/dist/{index-rpxdjkm0.js → index-v7r4td4c.js} +306 -59
  117. package/dist/{index-2vxtcb95.js → index-vkc1ca9p.js} +2 -2
  118. package/dist/{index-9zcsy3hh.js → index-x4k3f4mf.js} +17 -9
  119. package/dist/{index-bp5083x2.js → index-x9k3mqrf.js} +1 -1
  120. package/dist/{index-n37sebck.js → index-y4a3nhtk.js} +1 -1
  121. package/dist/index.js +52 -49
  122. package/dist/{logger-jm3sqqzr.js → logger-94kew5wm.js} +1 -1
  123. package/dist/{message-fts-rowid-map-17s0dfn4.js → message-fts-rowid-map-22tevnnj.js} +6 -5
  124. package/dist/{message-index-gtpqnj8w.js → message-index-5qxcz6h7.js} +16 -15
  125. package/dist/{message-index-bounded-zyc8h32y.js → message-index-bounded-n0m0t7tv.js} +16 -15
  126. package/dist/{message-time-backfill-73mmm76q.js → message-time-backfill-0myx7fz3.js} +3 -3
  127. package/dist/migration-worker.js +13 -12
  128. package/dist/{model-resolution-nx97z3x7.js → model-resolution-280gmqvd.js} +1 -1
  129. package/dist/plugin/embedding-bootstrap.d.ts +3 -1
  130. package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
  131. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  132. package/dist/plugin/rpc-handlers.d.ts +8 -0
  133. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  134. package/dist/plugin/subagent-tool-policy.d.ts +9 -0
  135. package/dist/plugin/subagent-tool-policy.d.ts.map +1 -1
  136. package/dist/{project-embedding-registry-z74mhqkf.js → project-embedding-registry-s2pqgec9.js} +13 -12
  137. package/dist/raw-ordinal-warmup-worker.js +136 -101
  138. package/dist/{read-session-chunk-jjb48bt9.js → read-session-chunk-0a8vdyqp.js} +11 -10
  139. package/dist/{read-session-raw-rsc8c7qy.js → read-session-raw-y5cszf0b.js} +4 -3
  140. package/dist/recomp-orchestrator-61vyha9j.js +62 -0
  141. package/dist/{safe-notification-target-1szv1k5k.js → safe-notification-target-mkr9yzvr.js} +2 -2
  142. package/dist/{search-archive-6vm0e2f5.js → search-archive-8q9s49p5.js} +12 -11
  143. package/dist/{search-xsqk1bj4.js → search-v1y9ejws.js} +25 -24
  144. package/dist/{send-session-notification-6ve0e8p4.js → send-session-notification-0k6qzydk.js} +7 -6
  145. package/dist/shared/logger.d.ts.map +1 -1
  146. package/dist/shared/model-resolution.d.ts +2 -0
  147. package/dist/shared/model-resolution.d.ts.map +1 -1
  148. package/dist/shared/prompt-async-transport.d.ts +3 -0
  149. package/dist/shared/prompt-async-transport.d.ts.map +1 -1
  150. package/dist/shared/rpc-types.d.ts +7 -0
  151. package/dist/shared/rpc-types.d.ts.map +1 -1
  152. package/dist/shared/sqlite.d.ts +1 -1
  153. package/dist/shared/sqlite.d.ts.map +1 -1
  154. package/dist/shared/subagent-runner.d.ts +2 -0
  155. package/dist/shared/subagent-runner.d.ts.map +1 -1
  156. package/dist/shared/worker-shutdown.d.ts +68 -0
  157. package/dist/shared/worker-shutdown.d.ts.map +1 -0
  158. package/dist/shared/worker-shutdown.fixture.d.ts +2 -0
  159. package/dist/shared/worker-shutdown.fixture.d.ts.map +1 -0
  160. package/dist/{sqlite-zf72c52d.js → sqlite-1rpvw2rj.js} +1 -1
  161. package/dist/{storage-memory-y3qmy00r.js → storage-memory-nm7v82mj.js} +2 -2
  162. package/dist/{storage-tags-r7k9tjcv.js → storage-tags-r6nk29n4.js} +5 -5
  163. package/dist/{task-config-x3qmayd2.js → task-config-t6bpyka7.js} +2 -2
  164. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  165. package/dist/{transform-postprocess-phase-jj99r7z2.js → transform-postprocess-phase-vtrgb7m6.js} +34 -31
  166. package/dist/v2/auto-search-worker.js +48 -9
  167. package/dist/v2/chunk-embedding-write-worker.js +30 -23
  168. package/dist/v2/{compaction-marker-candidates-ebx3388k.js → compaction-marker-candidates-cfab70cs.js} +3 -3
  169. package/dist/v2/compaction-marker-candidates-worker.js +2 -2
  170. package/dist/v2/compartment-chunk-embedding-nbdqx1td.js +64 -0
  171. package/dist/v2/{context-y5yamxak.js → context-cc33tv2z.js} +1189 -386
  172. package/dist/v2/{derive-budgets-2zh4gm2c.js → derive-budgets-knf763tt.js} +3 -3
  173. package/dist/v2/embedding-backfill-yxv2h5mc.js +24 -0
  174. package/dist/v2/embedding-worker-process.js +2 -2
  175. package/dist/v2/embedding-worker.js +5 -5
  176. package/dist/v2/hidden-child-record.d.ts +2 -0
  177. package/dist/v2/hidden-child-record.d.ts.map +1 -1
  178. package/dist/v2/hidden-completion.d.ts +2 -0
  179. package/dist/v2/hidden-completion.d.ts.map +1 -1
  180. package/dist/v2/hidden-model-activity.d.ts +7 -0
  181. package/dist/v2/hidden-model-activity.d.ts.map +1 -0
  182. package/dist/v2/{history-owner-42e16w0n.js → history-owner-ad0crnrn.js} +2 -2
  183. package/dist/v2/hooks/context.d.ts.map +1 -1
  184. package/dist/v2/hooks/generate.d.ts +36 -1
  185. package/dist/v2/hooks/generate.d.ts.map +1 -1
  186. package/dist/v2/hooks/lkg-system.d.ts +35 -4
  187. package/dist/v2/hooks/lkg-system.d.ts.map +1 -1
  188. package/dist/v2/hooks/payload.d.ts +16 -1
  189. package/dist/v2/hooks/payload.d.ts.map +1 -1
  190. package/dist/v2/{logger-7qt02bnb.js → logger-p34mjtja.js} +1 -1
  191. package/dist/v2/{message-fts-rowid-map-wfx67gfd.js → message-fts-rowid-map-dg12wymk.js} +6 -5
  192. package/dist/v2/{message-index-bounded-spd8r7pj.js → message-index-bounded-f4e01xk0.js} +16 -15
  193. package/dist/v2/{message-index-8vz2pq76.js → message-index-ydzrp6y6.js} +16 -15
  194. package/dist/v2/{message-time-backfill-04t0km1z.js → message-time-backfill-ddh8n9gy.js} +3 -3
  195. package/dist/v2/migration-worker.js +13 -12
  196. package/dist/v2/{model-resolution-nx97z3x7.js → model-resolution-280gmqvd.js} +1 -1
  197. package/dist/v2/{project-embedding-registry-gnkj56xp.js → project-embedding-registry-deza9ksw.js} +13 -12
  198. package/dist/v2/raw-ordinal-warmup-worker.js +136 -101
  199. package/dist/v2/{read-session-chunk-cwkxrmns.js → read-session-chunk-8cxfagky.js} +11 -10
  200. package/dist/v2/{read-session-raw-yaegtjzh.js → read-session-raw-1nrrecvx.js} +4 -3
  201. package/dist/v2/recomp-orchestrator-47m4hv5g.js +61 -0
  202. package/dist/v2/{safe-notification-target-qg7n2s77.js → safe-notification-target-khnzg57c.js} +2 -2
  203. package/dist/v2/{search-archive-wve3tq1k.js → search-archive-e80cvc09.js} +12 -11
  204. package/dist/v2/{search-hwg7jfbj.js → search-fjz746zr.js} +25 -24
  205. package/dist/v2/{send-session-notification-3pxn658x.js → send-session-notification-nwvrv34d.js} +7 -6
  206. package/dist/v2/{server-8by8qfec.js → server-0epqaxhd.js} +75 -57
  207. package/dist/v2/{server-pwv4ezb0.js → server-168pb207.js} +1 -1
  208. package/dist/v2/{server-h0410h0v.js → server-1bw1wcbp.js} +1 -1
  209. package/dist/v2/{server-beht37jy.js → server-1zx2pa5d.js} +1 -1
  210. package/dist/v2/{server-a9xqj88f.js → server-230fnbws.js} +4 -4
  211. package/dist/v2/{server-tbe1femw.js → server-29qp8nz4.js} +1 -1
  212. package/dist/v2/{server-tgnbmwah.js → server-3mz2qh5a.js} +1 -1
  213. package/dist/v2/{server-hy3d3vsx.js → server-4nw4fqhr.js} +2 -2
  214. package/dist/v2/{server-45q69hkq.js → server-4sxjs6hn.js} +5 -5
  215. package/dist/v2/{server-34kwfsr4.js → server-53eh1r8r.js} +2 -2
  216. package/dist/v2/{server-xj136kt8.js → server-55rgxfrw.js} +9 -3
  217. package/dist/v2/{server-nj659894.js → server-5arr9ecn.js} +2 -2
  218. package/dist/{index-8cd2j99z.js → v2/server-5kym00ag.js} +32 -13
  219. package/dist/v2/{server-2ar62dyx.js → server-63fqdghs.js} +106 -20
  220. package/dist/v2/{server-f2xf5gcb.js → server-6495nmn9.js} +12 -15
  221. package/dist/v2/{server-qd11g795.js → server-92g7d776.js} +2 -1
  222. package/dist/v2/{server-xq7dfjke.js → server-9x0kmta4.js} +5 -5
  223. package/dist/v2/{server-27gq4mfz.js → server-a3dwxfgd.js} +4 -4
  224. package/dist/v2/{server-6tmj0s7j.js → server-af2pght7.js} +3 -3
  225. package/dist/v2/{server-1wy7b9de.js → server-br1x0tev.js} +3 -3
  226. package/dist/v2/{server-n1prf1g6.js → server-brj8j2gk.js} +2 -2
  227. package/dist/v2/{server-6vdzn1td.js → server-c7dxxsj7.js} +308 -61
  228. package/dist/v2/server-cpjk5jd2.js +82 -0
  229. package/dist/v2/{server-g3qma5c0.js → server-dj7tz4ph.js} +2 -2
  230. package/dist/v2/{server-9hx7g5jp.js → server-ej96a39v.js} +17 -9
  231. package/dist/v2/{server-6pmqg9m4.js → server-gyy4k6mf.js} +1 -1
  232. package/dist/v2/{server-bmymkx73.js → server-hqzyq8n4.js} +11 -11
  233. package/dist/v2/{server-h1v0pyxb.js → server-j4jnp9b5.js} +468 -18
  234. package/dist/v2/{server-da07v4xp.js → server-k3t06fxr.js} +1 -1
  235. package/dist/v2/{server-gsxjv2q2.js → server-m91f9m5s.js} +69 -17
  236. package/dist/v2/{server-rmygf5pn.js → server-ne8arh8t.js} +2 -2
  237. package/dist/v2/{server-hm38q7r0.js → server-vn2nwcv6.js} +5 -5
  238. package/dist/v2/{server-46neh5fa.js → server-wyawsa88.js} +314 -127
  239. package/dist/v2/{server-zzkj2fch.js → server-xsryvyf6.js} +4 -4
  240. package/dist/v2/{server-n37sebck.js → server-y4a3nhtk.js} +1 -1
  241. package/dist/v2/{server-d04vrx0j.js → server-ygtykank.js} +2 -2
  242. package/dist/v2/server.js +6 -6
  243. package/dist/v2/{sqlite-zf72c52d.js → sqlite-1rpvw2rj.js} +1 -1
  244. package/dist/v2/{storage-memory-y3qmy00r.js → storage-memory-nm7v82mj.js} +2 -2
  245. package/dist/v2/{storage-tags-3wdb8zph.js → storage-tags-ss08kj5r.js} +5 -5
  246. package/dist/v2/store-reader.d.ts +8 -0
  247. package/dist/v2/store-reader.d.ts.map +1 -1
  248. package/dist/v2/{task-config-nvz8mapa.js → task-config-7md27rx8.js} +2 -2
  249. package/dist/v2/{wrapup-orchestrator-embdz8gj.js → wrapup-orchestrator-639whfhq.js} +32 -31
  250. package/dist/wrapup-orchestrator-mnvt2g8m.js +49 -0
  251. package/package.json +1 -1
  252. package/src/config/index.test.ts +28 -6
  253. package/src/shared/logger.test.ts +42 -1
  254. package/src/shared/logger.ts +11 -13
  255. package/src/shared/model-resolution.test.ts +67 -12
  256. package/src/shared/model-resolution.ts +43 -16
  257. package/src/shared/model-suggestion-retry.ts +1 -1
  258. package/src/shared/prompt-async-transport.ts +47 -3
  259. package/src/shared/rpc-types.ts +7 -0
  260. package/src/shared/sqlite-busy-budget-review.test.ts +6 -1
  261. package/src/shared/sqlite.ts +4 -2
  262. package/src/shared/subagent-runner.ts +2 -0
  263. package/src/shared/worker-shutdown-fence.test.ts +87 -0
  264. package/src/shared/worker-shutdown.fixture.ts +25 -0
  265. package/src/shared/worker-shutdown.test.ts +127 -0
  266. package/src/shared/worker-shutdown.ts +160 -0
  267. package/dist/embedding-backfill-fmz50tsy.js +0 -24
  268. package/dist/recomp-orchestrator-999jj4bc.js +0 -61
  269. package/dist/v2/embedding-backfill-7c7yr69y.js +0 -23
  270. package/dist/v2/recomp-orchestrator-f6m9jr7p.js +0 -60
  271. package/dist/wrapup-orchestrator-whhbjmaz.js +0 -48
@@ -0,0 +1,82 @@
1
+ // src/shared/worker-shutdown.ts
2
+ var WORKER_CLOSE_MESSAGE = { kind: "close" };
3
+ function isWorkerCloseMessage(message) {
4
+ return typeof message === "object" && message !== null && message.kind === WORKER_CLOSE_MESSAGE.kind;
5
+ }
6
+ function exitOnWorkerClose(port, closeConnections) {
7
+ const listener = (message) => {
8
+ if (!isWorkerCloseMessage(message))
9
+ return;
10
+ try {
11
+ closeConnections();
12
+ } finally {
13
+ process.exit(0);
14
+ }
15
+ };
16
+ if (!port)
17
+ return { closePort() {} };
18
+ port.on("message", listener);
19
+ let closed = false;
20
+ return {
21
+ closePort() {
22
+ if (closed)
23
+ return;
24
+ closed = true;
25
+ setTimeout(() => {
26
+ port.off("message", listener);
27
+ port.close();
28
+ });
29
+ }
30
+ };
31
+ }
32
+ var outcomes = new Map;
33
+ function createWorkerShutdown(worker, site, deadlineMs) {
34
+ let exited = false;
35
+ let forced = false;
36
+ let closing;
37
+ const exit = new Promise((resolve) => {
38
+ worker.once("exit", () => {
39
+ exited = true;
40
+ resolve();
41
+ });
42
+ });
43
+ const record = () => {
44
+ const counts = outcomes.get(site) ?? { graceful: 0, forced: 0 };
45
+ if (forced)
46
+ counts.forced += 1;
47
+ else
48
+ counts.graceful += 1;
49
+ outcomes.set(site, counts);
50
+ };
51
+ const terminate = () => {
52
+ forced = true;
53
+ worker.terminate().catch(() => {});
54
+ };
55
+ return {
56
+ close() {
57
+ if (closing)
58
+ return closing;
59
+ if (exited) {
60
+ closing = Promise.resolve();
61
+ return closing;
62
+ }
63
+ try {
64
+ worker.postMessage(WORKER_CLOSE_MESSAGE);
65
+ } catch {
66
+ terminate();
67
+ }
68
+ const fallback = setTimeout(() => {
69
+ if (!exited)
70
+ terminate();
71
+ }, deadlineMs);
72
+ fallback.unref?.();
73
+ closing = exit.then(() => {
74
+ clearTimeout(fallback);
75
+ record();
76
+ });
77
+ return closing;
78
+ }
79
+ };
80
+ }
81
+
82
+ export { isWorkerCloseMessage, exitOnWorkerClose, createWorkerShutdown };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./server-tgnbmwah.js";
3
+ } from "./server-3mz2qh5a.js";
4
4
  import {
5
5
  stableStringify
6
- } from "./server-pwv4ezb0.js";
6
+ } from "./server-168pb207.js";
7
7
 
8
8
  // src/features/magic-context/tool-definition-tokens.ts
9
9
  import { createHash } from "node:crypto";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./server-pavzsdc6.js";
4
4
  import {
5
5
  prepareCachedStatement2
6
- } from "./server-beht37jy.js";
6
+ } from "./server-1zx2pa5d.js";
7
7
  import {
8
8
  UNKNOWN_FIT_RATIO,
9
9
  resolveDecisionCalibration,
@@ -23,7 +23,7 @@ import {
23
23
  TAG_SELECT_COLUMNS2,
24
24
  getCandidateToolOwners2,
25
25
  pickNearestPriorOwner2
26
- } from "./server-27gq4mfz.js";
26
+ } from "./server-a3dwxfgd.js";
27
27
  import {
28
28
  OMO_INTERNAL_INITIATOR_MARKER,
29
29
  isSystemDirective,
@@ -41,13 +41,13 @@ import {
41
41
  formatBlock,
42
42
  compactTextForSummary,
43
43
  mergeCommitHashes
44
- } from "./server-tgnbmwah.js";
44
+ } from "./server-3mz2qh5a.js";
45
45
  import {
46
46
  sessionLog2
47
- } from "./server-f2xf5gcb.js";
47
+ } from "./server-6495nmn9.js";
48
48
  import {
49
49
  stableStringify
50
- } from "./server-pwv4ezb0.js";
50
+ } from "./server-168pb207.js";
51
51
  import {
52
52
  renderToolTemplate,
53
53
  resolveModelConfigValue,
@@ -69,25 +69,25 @@ import {
69
69
  readRawSeedTailFromDb2,
70
70
  readRawSessionBoundaryEndpointsFromDb2,
71
71
  prewarmRawSessionOrdinalsForDb
72
- } from "./server-xj136kt8.js";
72
+ } from "./server-55rgxfrw.js";
73
73
  import {
74
74
  openCodeDbExists,
75
75
  withReadOnlySessionDb,
76
76
  getRawSessionMessageCountFromDb,
77
77
  getMessageTimesFromOpenCodeDb
78
- } from "./server-n1prf1g6.js";
78
+ } from "./server-brj8j2gk.js";
79
79
  import {
80
80
  getToolDefinitionMeasurementSignature,
81
81
  getLargestMeasuredToolDefinitionTokens,
82
82
  getMeasuredToolDefinitionTokens
83
- } from "./server-g3qma5c0.js";
83
+ } from "./server-dj7tz4ph.js";
84
84
  import {
85
85
  canonicalModelIdentity,
86
86
  piModelRefToCanonical
87
87
  } from "./server-avwt563y.js";
88
88
  import {
89
89
  logSlowWriteTransaction
90
- } from "./server-6pmqg9m4.js";
90
+ } from "./server-gyy4k6mf.js";
91
91
 
92
92
  // src/features/magic-context/overflow-detection.ts
93
93
  var OVERFLOW_PATTERNS = [
@@ -4027,6 +4027,13 @@ function getCompactionMarkerHealth(db, sessionId, now = Date.now()) {
4027
4027
  pendingSinceMs: firstFailedAt
4028
4028
  };
4029
4029
  }
4030
+ function executeReclaimFromReplay(raw) {
4031
+ try {
4032
+ return parseReplayDocument(raw).executeReclaim;
4033
+ } catch {
4034
+ return;
4035
+ }
4036
+ }
4030
4037
  function loadPostprocessReplaySnapshot(db, sessionId) {
4031
4038
  const row = db.prepare(`SELECT stale_reduce_stripped_ids, processed_image_stripped_ids,
4032
4039
  stripped_placeholder_ids, note_nudge_anchors,
@@ -4041,6 +4048,7 @@ function loadPostprocessReplaySnapshot(db, sessionId) {
4041
4048
  const todoPermissionDenied = row?.todo_permission_denied === 1 ? true : row?.todo_permission_denied === 0 ? false : null;
4042
4049
  const thinkingBindingRecoveryTarget = row?.thinking_binding_recovery_target;
4043
4050
  return {
4051
+ executeReclaim: executeReclaimFromReplay(row?.trailing_blank_decisions),
4044
4052
  staleReduceStrippedIds: new Set(parseStrippedBlob(row?.stale_reduce_stripped_ids)),
4045
4053
  processedImageStrippedIds: new Set(parseProcessedImageMarkers(row?.processed_image_stripped_ids).keys()),
4046
4054
  processedImageMarkers: parseProcessedImageMarkers(row?.processed_image_stripped_ids),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./server-f2xf5gcb.js";
3
+ } from "./server-6495nmn9.js";
4
4
 
5
5
  // src/shared/write-transaction-timing.ts
6
6
  var SLOW_WRITE_TRANSACTION_THRESHOLD_MS = 1000;
@@ -8,10 +8,10 @@ import {
8
8
  withoutSqliteTransformPass2,
9
9
  isTransientSqliteError2,
10
10
  withPrivilegedWriter2
11
- } from "./server-beht37jy.js";
11
+ } from "./server-1zx2pa5d.js";
12
12
  import {
13
13
  scheduleAfterBootQuiet
14
- } from "./server-rmygf5pn.js";
14
+ } from "./server-ne8arh8t.js";
15
15
  import {
16
16
  getHarness2,
17
17
  harnessOwnsOpenCodeStore2
@@ -23,7 +23,7 @@ import {
23
23
  importPluginModule,
24
24
  writeForwardedLogLine2,
25
25
  log2
26
- } from "./server-f2xf5gcb.js";
26
+ } from "./server-6495nmn9.js";
27
27
  import {
28
28
  isOwnRpcServerRecord,
29
29
  isPidAlive,
@@ -34,13 +34,13 @@ import {
34
34
  parseRpcPortFile,
35
35
  inspectProcessesAsync,
36
36
  inspectWindowsProcessesSync
37
- } from "./server-da07v4xp.js";
37
+ } from "./server-k3t06fxr.js";
38
38
  import {
39
39
  configureContextDatabasePragmas2
40
40
  } from "./server-fb3zxn06.js";
41
41
  import {
42
42
  startMessageFtsRowidMapBackfill2
43
- } from "./server-1wy7b9de.js";
43
+ } from "./server-br1x0tev.js";
44
44
  import {
45
45
  LKG_SLOT_CHUNKS_DDL,
46
46
  SESSION_REPLAY_DECISIONS_DDL,
@@ -50,12 +50,12 @@ import {
50
50
  hasPendingMigrations,
51
51
  getMainThreadMigrationBodyCount,
52
52
  runMigrations
53
- } from "./server-xq7dfjke.js";
53
+ } from "./server-9x0kmta4.js";
54
54
  import {
55
55
  ensureColumn,
56
56
  installV95PerfSchema,
57
57
  installTagIdentityRevisionTrigger
58
- } from "./server-pwv4ezb0.js";
58
+ } from "./server-168pb207.js";
59
59
  import {
60
60
  resolveOpenCodeDbPath,
61
61
  hasV1MessageTables
@@ -63,7 +63,7 @@ import {
63
63
  import {
64
64
  setDatabase,
65
65
  loadToolDefinitionMeasurements
66
- } from "./server-g3qma5c0.js";
66
+ } from "./server-dj7tz4ph.js";
67
67
  import {
68
68
  getErrorMessage
69
69
  } from "./server-y8v6yerm.js";
@@ -72,7 +72,7 @@ import {
72
72
  } from "./server-8ajstryz.js";
73
73
  import {
74
74
  logSlowWriteTransaction
75
- } from "./server-6pmqg9m4.js";
75
+ } from "./server-gyy4k6mf.js";
76
76
  import {
77
77
  shouldEnforcePrivateStoragePermissions,
78
78
  ensureStorageDirectorySync,
@@ -1219,8 +1219,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1219
1219
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1220
1220
  if (signal.aborted || !readsOpenCodeStore)
1221
1221
  return;
1222
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-cwkxrmns.js"));
1223
- const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-04t0km1z.js"));
1222
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-8cxfagky.js"));
1223
+ const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-ddh8n9gy.js"));
1224
1224
  if (signal.aborted)
1225
1225
  return;
1226
1226
  await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {