@cortexkit/opencode-magic-context 0.49.7 → 0.49.9

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 (252) hide show
  1. package/dist/agents/hidden-agent-registrations.d.ts +5 -3
  2. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
  3. package/dist/auto-search-worker.js +6 -6
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/{compaction-marker-candidates-a0edbqrr.js → compaction-marker-candidates-xxz35vwp.js} +3 -3
  6. package/dist/config/schema/agent-overrides.d.ts +13 -13
  7. package/dist/config/schema/magic-context.d.ts +500 -500
  8. package/dist/{conflict-warning-hook-myk5hbt9.js → conflict-warning-hook-w3crzrar.js} +8 -8
  9. package/dist/{context-ffr7e0g7.js → context-ey3ap3cc.js} +81 -53
  10. package/dist/{derive-budgets-j4ry8j8n.js → derive-budgets-3nbxsyss.js} +2 -2
  11. package/dist/embedding-backfill-3h2m5n0q.js +21 -0
  12. package/dist/embedding-worker-process.js +6 -2
  13. package/dist/embedding-worker.js +6 -5
  14. package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
  15. package/dist/features/magic-context/dreamer/cron.d.ts +2 -0
  16. package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +1 -0
  18. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
  19. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  20. package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
  21. package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
  22. package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
  23. package/dist/features/magic-context/primer-clustering.d.ts.map +1 -1
  24. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  25. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts +1 -1
  26. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts.map +1 -1
  27. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
  28. package/dist/features/magic-context/smart-notes/wake-plane.d.ts.map +1 -1
  29. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  30. package/dist/history-owner-ty29fz0f.js +244 -0
  31. package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts +34 -0
  33. package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts.map +1 -0
  34. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +1 -0
  39. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/edit-marker.d.ts +2 -0
  42. package/dist/hooks/magic-context/edit-marker.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +2 -0
  44. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/module-transport.d.ts +1 -0
  48. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/provider-visible-parts.d.ts +10 -4
  50. package/dist/hooks/magic-context/provider-visible-parts.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/read-session-chunk.d.ts +8 -4
  53. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/rust-mode-transform.d.ts +1 -0
  55. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/rust-refusal-recovery.d.ts.map +1 -1
  57. package/dist/hooks/magic-context/supersession-reclaim.d.ts +5 -3
  58. package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
  59. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts +18 -0
  60. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts.map +1 -0
  61. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +5 -1
  62. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  63. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  64. package/dist/hooks/magic-context/tool-reclaim.d.ts +5 -2
  65. package/dist/hooks/magic-context/tool-reclaim.d.ts.map +1 -1
  66. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
  67. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  68. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  69. package/dist/hooks/magic-context/unresolved-history-boundary.d.ts +5 -1
  70. package/dist/hooks/magic-context/unresolved-history-boundary.d.ts.map +1 -1
  71. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  72. package/dist/{index-g8qbdb03.js → index-0jz47061.js} +6 -3
  73. package/dist/{index-wq16ahsn.js → index-0x9cn9w1.js} +8 -8
  74. package/dist/{index-4mjhqadz.js → index-150zz6fh.js} +1 -1
  75. package/dist/{index-n7kwfw2r.js → index-16vwdyy5.js} +7 -7
  76. package/dist/{index-rwmpkss5.js → index-21919gcq.js} +4 -4
  77. package/dist/{index-5tbvdff4.js → index-3403gbzj.js} +200 -135
  78. package/dist/{index-0gyq3djm.js → index-4hb8nt93.js} +3 -3
  79. package/dist/{index-ebnngykq.js → index-6k86es2p.js} +142 -27
  80. package/dist/{index-ax2jhztn.js → index-7bjgyaj1.js} +4 -4
  81. package/dist/{index-h2wc01qk.js → index-9jvab89d.js} +2 -2
  82. package/dist/{index-w6bd03dc.js → index-a43xq1pg.js} +5 -5
  83. package/dist/{index-tqf7yg27.js → index-a4b0gbyg.js} +1 -1
  84. package/dist/{index-j5hce1ab.js → index-a865mj02.js} +5 -5
  85. package/dist/{index-37q80veb.js → index-angx1s0k.js} +4 -3
  86. package/dist/{index-z1tjp257.js → index-b64n4d0h.js} +1 -1
  87. package/dist/{index-gbmqa9x9.js → index-bmwfzz28.js} +9 -6
  88. package/dist/{index-tmtty2x5.js → index-f8cn4xqa.js} +290 -61
  89. package/dist/{index-j58gqrn2.js → index-ffa8x2as.js} +31 -24
  90. package/dist/{index-1bt88epp.js → index-g7jkrz0x.js} +36 -16
  91. package/dist/{index-qx53vezw.js → index-gjvjh960.js} +1 -1
  92. package/dist/{index-w23dh319.js → index-jw4gbfkv.js} +1 -1
  93. package/dist/index-knvkbfvh.js +25 -0
  94. package/dist/{index-vkbqdnkj.js → index-kvw6xew3.js} +6 -3
  95. package/dist/{index-rzmjkdd6.js → index-mp2kghkv.js} +3 -27
  96. package/dist/{index-nsjyysj0.js → index-mvvephtj.js} +5 -1
  97. package/dist/{index-9yyqq3mm.js → index-n78avt2p.js} +1 -1
  98. package/dist/{index-w6vr754t.js → index-nenz4gpb.js} +13 -9
  99. package/dist/{index-vt4sf4ep.js → index-pgy3h49n.js} +4 -4
  100. package/dist/{v2/server-1rfgbjfn.js → index-q28hsbpg.js} +15 -3
  101. package/dist/{index-a8acx4gc.js → index-q76br5zn.js} +3 -3
  102. package/dist/{index-sf94at64.js → index-rg1cezmj.js} +22 -22
  103. package/dist/{index-sh91t19a.js → index-s178h9z8.js} +4 -3
  104. package/dist/{index-4btknbqh.js → index-swgpe402.js} +48 -38
  105. package/dist/{index-k6xvbj2e.js → index-w28y7d0z.js} +2 -0
  106. package/dist/{index-j8epsc0g.js → index-wafzvyhg.js} +33 -10
  107. package/dist/{index-n5a170gs.js → index-wpwpn7nj.js} +166 -63
  108. package/dist/{index-tagss15p.js → index-x57ep4fp.js} +124 -63
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +84 -79
  111. package/dist/{logger-ewak5q1s.js → logger-wn328tfg.js} +1 -1
  112. package/dist/{message-index-rqtse28y.js → message-index-6r1x9cqh.js} +16 -16
  113. package/dist/{message-index-bounded-04rycpx4.js → message-index-bounded-fskdyc81.js} +16 -16
  114. package/dist/{message-time-backfill-a5ytnp53.js → message-time-backfill-nb5hhnrt.js} +3 -3
  115. package/dist/migration-worker.js +11 -11
  116. package/dist/plugin/boot-quiet.d.ts.map +1 -1
  117. package/dist/plugin/dream-timer.d.ts.map +1 -1
  118. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  119. package/dist/plugin/rpc-handlers.d.ts +2 -0
  120. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  121. package/dist/{project-embedding-registry-k0sd9k7v.js → project-embedding-registry-vy7sv9jt.js} +11 -11
  122. package/dist/raw-ordinal-warmup-worker.js +6 -6
  123. package/dist/{read-session-chunk-h1btx938.js → read-session-chunk-zgpvs423.js} +11 -11
  124. package/dist/{read-session-raw-vdf4wh78.js → read-session-raw-gm6xj30v.js} +3 -3
  125. package/dist/recomp-orchestrator-77xc8wpe.js +60 -0
  126. package/dist/{safe-notification-target-q0cyrx3x.js → safe-notification-target-jdynm677.js} +2 -2
  127. package/dist/{search-3rbdx6hw.js → search-72fkjwk2.js} +24 -24
  128. package/dist/{send-session-notification-2tp44tfa.js → send-session-notification-q8ngbap3.js} +6 -6
  129. package/dist/shared/hidden-zen-read.d.ts +24 -0
  130. package/dist/shared/hidden-zen-read.d.ts.map +1 -0
  131. package/dist/shared/history-owner.d.ts +12 -0
  132. package/dist/shared/history-owner.d.ts.map +1 -0
  133. package/dist/shared/off-thread-migration-clock.d.ts +8 -1
  134. package/dist/shared/off-thread-migration-clock.d.ts.map +1 -1
  135. package/dist/shared/reclaim-distance.d.ts +33 -0
  136. package/dist/shared/reclaim-distance.d.ts.map +1 -0
  137. package/dist/shared/redaction.d.ts.map +1 -1
  138. package/dist/shared/rpc-server.d.ts.map +1 -1
  139. package/dist/shared/sqlite.d.ts +2 -0
  140. package/dist/shared/sqlite.d.ts.map +1 -1
  141. package/dist/shared/stable-json.d.ts +7 -0
  142. package/dist/shared/stable-json.d.ts.map +1 -1
  143. package/dist/shared/tail-hygiene-json.d.ts +22 -0
  144. package/dist/shared/tail-hygiene-json.d.ts.map +1 -0
  145. package/dist/shared/transcript.d.ts +5 -0
  146. package/dist/shared/transcript.d.ts.map +1 -1
  147. package/dist/shared/user-facing-codes.d.ts +2 -2
  148. package/dist/{sqlite-j3tvg8r0.js → sqlite-4pqyynrs.js} +3 -1
  149. package/dist/{storage-memory-8168bgef.js → storage-memory-j3v3hc83.js} +2 -2
  150. package/dist/{storage-tags-61z5j2f9.js → storage-tags-35m4gms2.js} +5 -5
  151. package/dist/{transform-postprocess-phase-7qts7h54.js → transform-postprocess-phase-r8d406j0.js} +30 -30
  152. package/dist/v2/auto-search-worker.js +6 -6
  153. package/dist/v2/{compaction-marker-candidates-6nypjkpf.js → compaction-marker-candidates-a15w3mqh.js} +3 -3
  154. package/dist/v2/compaction-marker-candidates-worker.js +2 -2
  155. package/dist/v2/{context-xq4rtywr.js → context-z2yagwy4.js} +293 -91
  156. package/dist/v2/{derive-budgets-enckmg7y.js → derive-budgets-0rmpmxjw.js} +3 -3
  157. package/dist/v2/embedding-backfill-vr7wdtrf.js +20 -0
  158. package/dist/v2/embedding-worker-process.js +6 -2
  159. package/dist/v2/embedding-worker.js +6 -5
  160. package/dist/v2/hidden-completion.d.ts.map +1 -1
  161. package/dist/v2/history-owner-2cr9py37.js +243 -0
  162. package/dist/v2/hooks/context.d.ts.map +1 -1
  163. package/dist/v2/hooks/hidden-child.d.ts +2 -2
  164. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  165. package/dist/v2/hooks/store.d.ts +1 -0
  166. package/dist/v2/hooks/store.d.ts.map +1 -1
  167. package/dist/v2/{logger-pj02s7sr.js → logger-te6e1j72.js} +1 -1
  168. package/dist/v2/{message-index-8e5z2xx8.js → message-index-9ezq6wze.js} +16 -16
  169. package/dist/v2/{message-index-bounded-5vh1h2g7.js → message-index-bounded-rqc603f2.js} +16 -16
  170. package/dist/v2/{message-time-backfill-2z365239.js → message-time-backfill-rz1pnpaj.js} +3 -3
  171. package/dist/v2/migration-worker.js +11 -11
  172. package/dist/v2/{project-embedding-registry-b77awytr.js → project-embedding-registry-ja23aygk.js} +11 -11
  173. package/dist/v2/raw-ordinal-warmup-worker.js +6 -6
  174. package/dist/v2/{read-session-chunk-4sat83cx.js → read-session-chunk-7f87tg2q.js} +11 -11
  175. package/dist/v2/{read-session-raw-a3hw9jsp.js → read-session-raw-h4azh85b.js} +3 -3
  176. package/dist/v2/recomp-orchestrator-s5tdpsbs.js +59 -0
  177. package/dist/v2/{safe-notification-target-y3p1hce9.js → safe-notification-target-936374xx.js} +2 -2
  178. package/dist/v2/search-2td1b1wy.js +46 -0
  179. package/dist/v2/{send-session-notification-ppgc8qdz.js → send-session-notification-6n7chhyp.js} +6 -6
  180. package/dist/v2/{server-v4fwha43.js → server-23znwjqk.js} +48 -38
  181. package/dist/v2/{server-nfan6zb6.js → server-2hxypdx5.js} +31 -24
  182. package/dist/v2/{server-ras2sxnc.js → server-44ryn9rb.js} +9 -6
  183. package/dist/v2/{server-fw31krgq.js → server-4easnf78.js} +19 -19
  184. package/dist/v2/{server-d6g4whc2.js → server-4qr18rfg.js} +3 -3
  185. package/dist/v2/{server-sy4b1sra.js → server-4rs8sm06.js} +5 -5
  186. package/dist/v2/{server-jdwd03ep.js → server-4zwx20yg.js} +7 -7
  187. package/dist/v2/{server-brhj8qtd.js → server-63ha7f0f.js} +3 -27
  188. package/dist/v2/{server-3t0q2cqx.js → server-7dv9wt9r.js} +1 -1
  189. package/dist/v2/{server-cw6521wn.js → server-7e087rvk.js} +2 -0
  190. package/dist/v2/{server-6byqfbqf.js → server-89fcbe37.js} +36 -16
  191. package/dist/v2/{server-hb6xhh9q.js → server-988cqjme.js} +6 -3
  192. package/dist/v2/{server-fpqe39as.js → server-9a6bwc12.js} +4 -4
  193. package/dist/v2/{server-t4k4qexw.js → server-9e5r8y60.js} +5 -1
  194. package/dist/v2/{server-qcw43339.js → server-ak7w74j9.js} +4 -4
  195. package/dist/v2/{server-dd0nja67.js → server-bx59ezg6.js} +4 -3
  196. package/dist/v2/{server-mv1w7t6z.js → server-c9w52qss.js} +99 -43
  197. package/dist/v2/{server-676xw7at.js → server-ckrb5rm8.js} +1 -1
  198. package/dist/{index-w4mw92w3.js → v2/server-cxsr0ng6.js} +15 -3
  199. package/dist/v2/{server-hcvcxzx7.js → server-f27he3j1.js} +5 -5
  200. package/dist/v2/{server-gtv9wbhq.js → server-gc8x2xdb.js} +144 -63
  201. package/dist/v2/{server-t528t8qm.js → server-hn9fb3v0.js} +2 -2
  202. package/dist/v2/{server-w3zeywp1.js → server-kmapq3v0.js} +289 -60
  203. package/dist/v2/server-knvkbfvh.js +25 -0
  204. package/dist/v2/{server-9yyqq3mm.js → server-n78avt2p.js} +1 -1
  205. package/dist/v2/{server-kdrezdy0.js → server-njnx39q2.js} +6 -3
  206. package/dist/v2/{server-x08d1xf3.js → server-npm52h2q.js} +4 -3
  207. package/dist/v2/{server-vb7pbd9p.js → server-nveratm5.js} +1 -1
  208. package/dist/v2/{server-kzns2hbz.js → server-s6jqh8bj.js} +1 -1
  209. package/dist/v2/{server-j8epsc0g.js → server-wafzvyhg.js} +33 -10
  210. package/dist/v2/{server-7ekna9zs.js → server-xqf2d2mg.js} +2 -2
  211. package/dist/v2/{server-7srtwsa4.js → server-z0rjemg1.js} +9 -9
  212. package/dist/v2/{server-wkdgjjch.js → server-zrwaj29a.js} +2 -2
  213. package/dist/v2/server.js +7 -6
  214. package/dist/v2/{sqlite-j3tvg8r0.js → sqlite-4pqyynrs.js} +3 -1
  215. package/dist/v2/{storage-memory-8168bgef.js → storage-memory-j3v3hc83.js} +2 -2
  216. package/dist/v2/{storage-tags-j2fzq3sw.js → storage-tags-c4zfcxv4.js} +5 -5
  217. package/dist/v2/store-reader.d.ts.map +1 -1
  218. package/dist/v2/{wrapup-orchestrator-s92ebfzv.js → wrapup-orchestrator-wg8dmmm9.js} +38 -35
  219. package/dist/wrapup-orchestrator-b1z99yg5.js +47 -0
  220. package/package.json +1 -1
  221. package/src/agents/hidden-agent-registrations.ts +22 -4
  222. package/src/config/compaction-accessor-guard.test.ts +3 -0
  223. package/src/features/magic-context/dreamer/cron.ts +8 -0
  224. package/src/shared/hidden-zen-read.test.ts +99 -0
  225. package/src/shared/hidden-zen-read.ts +88 -0
  226. package/src/shared/history-owner.test.ts +60 -0
  227. package/src/shared/history-owner.ts +43 -0
  228. package/src/shared/host-stall-profiler-node.ts +3 -1
  229. package/src/shared/host-stall-profiler.ts +3 -1
  230. package/src/shared/off-thread-migration-clock.test.ts +80 -10
  231. package/src/shared/off-thread-migration-clock.ts +37 -13
  232. package/src/shared/reclaim-distance.test.ts +111 -0
  233. package/src/shared/reclaim-distance.ts +91 -0
  234. package/src/shared/redaction.test.ts +16 -0
  235. package/src/shared/redaction.ts +8 -1
  236. package/src/shared/root-async-context.probe.mjs +36 -0
  237. package/src/shared/root-async-context.test.ts +49 -0
  238. package/src/shared/rpc-server.ts +27 -23
  239. package/src/shared/sqlite-busy-budget-review.test.ts +291 -0
  240. package/src/shared/sqlite-foreground-wait.test.ts +253 -1
  241. package/src/shared/sqlite.ts +55 -14
  242. package/src/shared/stable-json.ts +56 -14
  243. package/src/shared/tail-hygiene-json.test.ts +117 -0
  244. package/src/shared/tail-hygiene-json.ts +217 -0
  245. package/src/shared/transcript.ts +7 -0
  246. package/src/shared/user-facing-codes.ts +2 -2
  247. package/dist/embedding-backfill-re16xncd.js +0 -21
  248. package/dist/recomp-orchestrator-trcgmm23.js +0 -60
  249. package/dist/v2/embedding-backfill-xd9ygzgd.js +0 -20
  250. package/dist/v2/recomp-orchestrator-n11zv1f1.js +0 -59
  251. package/dist/v2/search-mvgqtkkz.js +0 -46
  252. package/dist/wrapup-orchestrator-df61jmz9.js +0 -47
@@ -6,7 +6,7 @@ import {
6
6
  getTemporalDecisions,
7
7
  freezeTemporalDecisions,
8
8
  stableStringify
9
- } from "./index-1bt88epp.js";
9
+ } from "./index-g7jkrz0x.js";
10
10
  import {
11
11
  protectedToolTagNumbers,
12
12
  byteSize,
@@ -69,30 +69,31 @@ import {
69
69
  adoptNullOwnerToolTag2,
70
70
  getCandidateToolOwners2,
71
71
  pickNearestPriorOwner2
72
- } from "./index-tmtty2x5.js";
72
+ } from "./index-f8cn4xqa.js";
73
73
  import {
74
74
  textMentionsRecentCommit,
75
75
  hasMeaningfulUserText2,
76
76
  estimateTokens
77
- } from "./index-qx53vezw.js";
77
+ } from "./index-gjvjh960.js";
78
78
  import {
79
79
  log2,
80
80
  sessionLog2
81
- } from "./index-nsjyysj0.js";
81
+ } from "./index-mvvephtj.js";
82
82
  import {
83
+ inRootAsyncContext2,
83
84
  getTagIdentityWriteGeneration2,
84
85
  getSqliteDatabasePath2,
85
86
  assertTransformWrite2,
86
87
  isTransientSqliteError2
87
- } from "./index-j8epsc0g.js";
88
+ } from "./index-wafzvyhg.js";
88
89
  import {
89
90
  isValidLanguageCode
90
- } from "./index-k6xvbj2e.js";
91
+ } from "./index-w28y7d0z.js";
91
92
  import {
92
93
  getProjectEmbeddingSnapshot2,
93
94
  embedTextForProject2,
94
95
  embedBatchForProject2
95
- } from "./index-sf94at64.js";
96
+ } from "./index-rg1cezmj.js";
96
97
  import {
97
98
  isEmbeddingHostBusy2
98
99
  } from "./index-qt1qqasc.js";
@@ -182,12 +183,13 @@ import {
182
183
  reasoningStepCost,
183
184
  reasoningTextAndOpaque,
184
185
  opencodeReasoningBudgetCutoff,
186
+ estimatePartImageTokens,
185
187
  SKELETON_REAL_INPUT_MAX_BYTES,
186
188
  partHasCompletedResult,
187
189
  extractToolCallObservation,
188
190
  ToolMutationBatch,
189
191
  createToolDropTarget
190
- } from "./index-n5a170gs.js";
192
+ } from "./index-wpwpn7nj.js";
191
193
  import {
192
194
  getMaxM0MutationId,
193
195
  rememberUnpublishedAutoSearchNoHint,
@@ -221,21 +223,21 @@ import {
221
223
  peekNoteNudgeText,
222
224
  markNoteNudgeDelivered,
223
225
  getActiveCompartmentRun
224
- } from "./index-5tbvdff4.js";
226
+ } from "./index-3403gbzj.js";
225
227
  import {
226
228
  runSessionWarmupWorker
227
- } from "./index-37q80veb.js";
229
+ } from "./index-angx1s0k.js";
228
230
  import {
229
231
  openCodeDbExists,
230
232
  withReadOnlySessionDb,
231
233
  getMessageTimesFromOpenCodeDb
232
- } from "./index-a8acx4gc.js";
234
+ } from "./index-q76br5zn.js";
233
235
  import {
234
236
  BoundedSessionMap
235
- } from "./index-wq16ahsn.js";
237
+ } from "./index-0x9cn9w1.js";
236
238
  import {
237
239
  renderUserFacingFailure
238
- } from "./index-n7kwfw2r.js";
240
+ } from "./index-16vwdyy5.js";
239
241
  import {
240
242
  getErrorMessage
241
243
  } from "./index-y8v6yerm.js";
@@ -245,7 +247,7 @@ import {
245
247
  } from "./index-d9vfe7xq.js";
246
248
  import {
247
249
  logSlowWriteTransaction
248
- } from "./index-4mjhqadz.js";
250
+ } from "./index-150zz6fh.js";
249
251
 
250
252
  // src/features/magic-context/tagger.ts
251
253
  var TOOL_COMPOSITE_KEY_SEP = "\x00";
@@ -1339,7 +1341,7 @@ function queueAutoSearchBackfill(db, sessionId, projectPath, query) {
1339
1341
  pending.delete(key);
1340
1342
  resolve();
1341
1343
  };
1342
- const queued = setTimeout(() => {
1344
+ const queued = inRootAsyncContext2(() => setTimeout(() => {
1343
1345
  lifecycle.signal.removeEventListener("abort", cancel);
1344
1346
  if (lifecycle.signal.aborted)
1345
1347
  return done();
@@ -1350,7 +1352,7 @@ function queueAutoSearchBackfill(db, sessionId, projectPath, query) {
1350
1352
  clearTimeout(timeout);
1351
1353
  done();
1352
1354
  });
1353
- }, 0);
1355
+ }, 0));
1354
1356
  const cancel = () => {
1355
1357
  clearTimeout(queued);
1356
1358
  done();
@@ -1397,7 +1399,7 @@ async function executeAutoSearchWorker(db, sessionId, projectPath, query, option
1397
1399
  deadlineUnixMs: autoSearchDeadlineUnixMs(deadlineSignal)
1398
1400
  };
1399
1401
  return new Promise((resolve, reject) => {
1400
- const worker = new Worker(entry, { workerData: input });
1402
+ const worker = inRootAsyncContext2(() => new Worker(entry, { workerData: input }));
1401
1403
  let settled = false;
1402
1404
  const finish = (results, error) => {
1403
1405
  if (settled)
@@ -1509,7 +1511,7 @@ function searchMessageHistoryOffThread(db, request, entry = defaultAutoSearchWor
1509
1511
  deadline.unref?.();
1510
1512
  };
1511
1513
  try {
1512
- worker = new Worker(entry, { workerData: input });
1514
+ worker = inRootAsyncContext2(() => new Worker(entry, { workerData: input }));
1513
1515
  } catch (error) {
1514
1516
  finish(null, "start-failed", error);
1515
1517
  return;
@@ -3735,7 +3737,7 @@ function buildEditSupersessionReclaim(input) {
3735
3737
  seenFile.add(filePath);
3736
3738
  continue;
3737
3739
  }
3738
- if (input.recentMessageIds && (tag.toolOwnerMessageId === null || input.recentMessageIds.has(tag.toolOwnerMessageId))) {
3740
+ if (tag.tagNumber > input.watermark || input.recentMessageIds && (tag.toolOwnerMessageId === null || input.recentMessageIds.has(tag.toolOwnerMessageId))) {
3739
3741
  continue;
3740
3742
  }
3741
3743
  if (realPendingTagIds.has(tag.tagNumber))
@@ -3833,6 +3835,51 @@ async function waitForTagOwners(db, sessionId, ratio, waitMs = 250) {
3833
3835
  }
3834
3836
  }
3835
3837
 
3838
+ // src/shared/reclaim-distance.ts
3839
+ var RECLAIM_DISTANCE_USER_TURNS = 3;
3840
+ var RECLAIM_DISTANCE_WINDOW_FRACTION = 0.25;
3841
+ function isReclaimUserTurn(args) {
3842
+ return args.role === "user" && !args.syntheticHead && !args.synthetic && !args.ignored && args.parts.some((part) => {
3843
+ if (part.synthetic || part.ignored)
3844
+ return false;
3845
+ if (part.kind !== "text" && part.kind !== "image" && part.kind !== "file")
3846
+ return false;
3847
+ if (part.kind !== "text")
3848
+ return true;
3849
+ return stripReclaimMcText(part.text ?? "").trim().length > 0;
3850
+ });
3851
+ }
3852
+ function stripReclaimMcText(text) {
3853
+ return text.replace(/^§\d+§\s*/, "").replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, (reminder) => /^(?:Your next step: call ctx_reduce on the outputs you've already used|Still unstamped:|Housekeeping: .* are reclaimable\. Stamp each output with ctx_reduce|.* are reclaimable\. Make a ctx_reduce pass now|.* are still unstamped\. Call ctx_reduce now)/.test(reminder.slice("<system-reminder>".length).trimStart()) ? "" : reminder).replace(/<instruction name="deferred_notes">[\s\S]*?<\/instruction>/g, "");
3854
+ }
3855
+ function farBehindToolBookmark(entries, usableWindow) {
3856
+ let newerTurns = 0;
3857
+ let newerTokens = 0;
3858
+ const farTags = [];
3859
+ let firstYoungTag = Infinity;
3860
+ const seenOutputs = new Set;
3861
+ const tokenDistance = usableWindow > 0 && Number.isFinite(usableWindow) ? usableWindow * RECLAIM_DISTANCE_WINDOW_FRACTION : Infinity;
3862
+ for (let index = entries.length - 1;index >= 0; index--) {
3863
+ const entry = entries[index];
3864
+ if (!entry)
3865
+ continue;
3866
+ const tag = entry.toolOutputTag;
3867
+ if (tag !== undefined && !seenOutputs.has(tag)) {
3868
+ seenOutputs.add(tag);
3869
+ if (newerTurns >= RECLAIM_DISTANCE_USER_TURNS || newerTokens >= tokenDistance) {
3870
+ farTags.push(tag);
3871
+ } else {
3872
+ firstYoungTag = Math.min(firstYoungTag, tag);
3873
+ }
3874
+ }
3875
+ if (entry.userTurn)
3876
+ newerTurns++;
3877
+ if (Number.isFinite(entry.tokens) && entry.tokens > 0)
3878
+ newerTokens += entry.tokens;
3879
+ }
3880
+ return farTags.reduce((bookmark, tag) => tag < firstYoungTag ? Math.max(bookmark, tag) : bookmark, 0);
3881
+ }
3882
+
3836
3883
  // src/hooks/magic-context/tool-reclaim.ts
3837
3884
  function buildSyntheticToolReclaimOps(input) {
3838
3885
  const watermark = Math.max(0, input.watermark);
@@ -3864,10 +3911,74 @@ function buildSyntheticToolReclaimOps(input) {
3864
3911
  }
3865
3912
  return synthetic;
3866
3913
  }
3867
- function advanceToolReclaimWatermarkToCurrentMax(db, sessionId) {
3868
- const maxTagNumber = getMaxTagNumberBySession2(db, sessionId);
3869
- advanceToolReclaimWatermark(db, sessionId, maxTagNumber);
3870
- return maxTagNumber;
3914
+ function advanceToolReclaimWatermarkByDistance(db, sessionId, entries, usableWindow) {
3915
+ const bookmark = farBehindToolBookmark(entries, usableWindow);
3916
+ advanceToolReclaimWatermark(db, sessionId, bookmark);
3917
+ return bookmark;
3918
+ }
3919
+ function toolReclaimDistanceEntries(messages, targets) {
3920
+ const outputTags = new Map;
3921
+ for (const [tag, target] of targets) {
3922
+ for (const location of target.mutationParts ?? []) {
3923
+ const part = distancePart(location.part);
3924
+ if (part.kind === "tool_result" || part.kind === "tool")
3925
+ outputTags.set(location.part, tag);
3926
+ }
3927
+ }
3928
+ const entries = [];
3929
+ for (const message of messages) {
3930
+ const parts = message.parts.map(distancePart);
3931
+ let userTurn = isReclaimUserTurn({ ...message.info, parts });
3932
+ for (const [index, part] of parts.entries()) {
3933
+ const authored = isReclaimUserTurn({ role: "user", parts: [part] });
3934
+ entries.push({
3935
+ tokens: message.info.syntheticHead ? 0 : estimateTokens(stripReclaimMcText(part.text ?? "")) + part.imageTokens,
3936
+ userTurn: userTurn && authored,
3937
+ toolOutputTag: outputTags.get(message.parts[index])
3938
+ });
3939
+ if (authored)
3940
+ userTurn = false;
3941
+ }
3942
+ }
3943
+ return entries;
3944
+ }
3945
+ function distancePart(raw) {
3946
+ if (!raw || typeof raw !== "object")
3947
+ return { kind: "structural", imageTokens: 0 };
3948
+ const part = raw;
3949
+ const provenance = { synthetic: part.synthetic === true, ignored: part.ignored === true };
3950
+ if (typeof part.getText === "function") {
3951
+ const text = part.getText();
3952
+ return {
3953
+ ...provenance,
3954
+ kind: String(part.kind),
3955
+ text: typeof text === "string" ? text : undefined,
3956
+ imageTokens: typeof part.imageTokens === "function" ? Number(part.imageTokens()) : 0
3957
+ };
3958
+ }
3959
+ const metadata = { ...provenance, imageTokens: estimatePartImageTokens(raw) };
3960
+ if (part.type === "tool") {
3961
+ const state = part.state;
3962
+ return {
3963
+ ...metadata,
3964
+ kind: "tool",
3965
+ text: `${JSON.stringify(state?.input ?? {})}
3966
+ ${typeof state?.output === "string" ? state.output : JSON.stringify(state?.output ?? "")}`
3967
+ };
3968
+ }
3969
+ if (part.type === "tool_use")
3970
+ return { ...metadata, kind: "tool_use", text: JSON.stringify(part.input ?? {}) };
3971
+ if (part.type === "tool_result")
3972
+ return {
3973
+ ...metadata,
3974
+ kind: "tool_result",
3975
+ text: typeof part.content === "string" ? part.content : JSON.stringify(part.content ?? "")
3976
+ };
3977
+ return {
3978
+ ...metadata,
3979
+ kind: String(part.type),
3980
+ text: typeof part.text === "string" ? part.text : typeof part.thinking === "string" ? part.thinking : undefined
3981
+ };
3871
3982
  }
3872
3983
  // src/hooks/magic-context/strip-structural-noise.ts
3873
3984
  var STRUCTURAL_PART_TYPES = new Set(["meta", "step-start", "step-finish", "reasoning"]);
@@ -5416,6 +5527,7 @@ async function runPostTransformPhase2(args) {
5416
5527
  const shouldApplyPendingOps = publishedWorkDrainAllowed;
5417
5528
  const shouldRunHeuristics = publishedWorkDrainAllowed && (rideSignals.publishedHistory || materializationRequested || forceMaterialization || foldBustsServedPrefixThisPass || firstRenderBust || heldIdleExpiryRebuild || emergencyDropEligible || args.schedulerDecision === "execute" && (!alreadyRanThisTurn || !args.fullFeatureMode));
5418
5529
  const isCacheBustingPass = publishedWorkDrainAllowed;
5530
+ const reclaimDistance = isCacheBustingPass ? toolReclaimDistanceEntries(args.messages, args.targets) : [];
5419
5531
  const canEditWholePrefix = isCacheBustingPass && !activeThinkingPrefixHold;
5420
5532
  const previousTemporalDecisions = args.temporalCandidates && !compactionOff ? new Map([
5421
5533
  ...args.temporalObservedDecisions ?? [],
@@ -5759,6 +5871,7 @@ async function runPostTransformPhase2(args) {
5759
5871
  }
5760
5872
  }
5761
5873
  const editReclaim = buildEditSupersessionReclaim({
5874
+ watermark: args.sessionMeta.toolReclaimWatermark ?? 0,
5762
5875
  db: args.db,
5763
5876
  sessionId: args.sessionId,
5764
5877
  targets: newTargets,
@@ -5797,7 +5910,7 @@ async function runPostTransformPhase2(args) {
5797
5910
  const tBatchFinalize = performance.now();
5798
5911
  args.batch?.finalize();
5799
5912
  if (toolReclaimApplicationOpportunity) {
5800
- const maxTagNumber = advanceToolReclaimWatermarkToCurrentMax(args.db, args.sessionId);
5913
+ const maxTagNumber = advanceToolReclaimWatermarkByDistance(args.db, args.sessionId, reclaimDistance, args.usableWindow);
5801
5914
  args.sessionMeta.toolReclaimWatermark = Math.max(args.sessionMeta.toolReclaimWatermark ?? 0, maxTagNumber);
5802
5915
  }
5803
5916
  if (autoReclaimTargetCount > 0) {
@@ -6476,6 +6589,7 @@ async function runPostTransformPhase2(args) {
6476
6589
  const hygieneCalibration = sessionDecisionCalibration(args.db, args.sessionId);
6477
6590
  const hygieneUnitsVersion = transitionSessionHygieneUnits(args.db, args.sessionId, bustedThisPass, hygieneCalibration);
6478
6591
  const baseline = refreshTailHygieneBaseline({
6592
+ opencode2: args.opencode2,
6479
6593
  messages: args.messages,
6480
6594
  tags,
6481
6595
  protectedTagNumbers: args.protectedTagNumbers,
@@ -6492,7 +6606,7 @@ async function runPostTransformPhase2(args) {
6492
6606
  sessionLog2(args.sessionId, formatTailHygienePrefixMismatch(baseline.lastPrefixMismatch, baseline.baselineGeneration));
6493
6607
  }
6494
6608
  const tTailState = performance.now();
6495
- const structuralSignature = tailHygieneStructuralSignature(args.messages);
6609
+ const structuralSignature = tailHygieneStructuralSignature(args.messages, args.opencode2);
6496
6610
  const effective = effectiveTailHygiene(baseline);
6497
6611
  const durableGrace = baseline.evaluable && !baseline.generationInvalidated ? captureChannel1PostReduceGraceBaseline(args.db, args.sessionId, effective.u) : getChannel1NudgeState(args.db, args.sessionId);
6498
6612
  baseline.channel1PostReduceGrace = durableGrace.postReduceGracePending || durableGrace.postReduceGraceBaselineU !== undefined ? {
@@ -6504,7 +6618,7 @@ async function runPostTransformPhase2(args) {
6504
6618
  ...baseline,
6505
6619
  usableWindow: args.usableWindow,
6506
6620
  realUserTurnCount: countRealUserMessages(args.messages),
6507
- reducedSinceRefresh: baseline.baselineGeneration !== previous?.baselineGeneration ? false : previous?.reducedSinceRefresh ?? false,
6621
+ reducedSinceRefresh: baseline.baselineGeneration !== previous?.baselineGeneration || (previous?.generationInvalidated === true || previous?.evaluable === false) && baseline.evaluable && !baseline.generationInvalidated ? false : previous?.reducedSinceRefresh ?? false,
6508
6622
  agentDropsAppliedThisPass: pendingOpsDidMutate,
6509
6623
  oldestReclaimableToolTags: postprocessOldestTags(args.db, args.sessionId, args.protectedTagNumbers)
6510
6624
  });
@@ -6542,7 +6656,7 @@ async function runPostTransformPhase2(args) {
6542
6656
  const tTailGuard = performance.now();
6543
6657
  if (assertedBaseline) {
6544
6658
  try {
6545
- const servedSignature = tailHygieneStructuralSignature(args.messages);
6659
+ const servedSignature = tailHygieneStructuralSignature(args.messages, args.opencode2);
6546
6660
  if (!sameTailHygieneStructuralSignature(assertedBaseline.structuralSignature, servedSignature)) {
6547
6661
  sessionLog2(args.sessionId, `ERROR [tail-hygiene-last-writer-mismatch]: served messages changed after tail-hygiene baseline refresh (expected messages=${assertedBaseline.structuralSignature.messageCount}, parts=[${assertedBaseline.structuralSignature.partCounts.join(",")}], bytes=${assertedBaseline.structuralSignature.totalBytes}; actual messages=${servedSignature.messageCount}, parts=[${servedSignature.partCounts.join(",")}], bytes=${servedSignature.totalBytes})`);
6548
6662
  }
@@ -6550,6 +6664,7 @@ async function runPostTransformPhase2(args) {
6550
6664
  sessionLog2(args.sessionId, "ERROR [tail-hygiene-last-writer-check-failed]: structural production guard failed open:", error);
6551
6665
  }
6552
6666
  assertTailHygieneContentUnchangedIfEnabled({
6667
+ opencode2: args.opencode2,
6553
6668
  messages: args.messages,
6554
6669
  tags: assertedBaseline.tags,
6555
6670
  protectedTagNumbers: assertedBaseline.protectedTagNumbers,
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  getTokenEstimatorFingerprint,
3
3
  estimateTokens
4
- } from "./index-qx53vezw.js";
4
+ } from "./index-gjvjh960.js";
5
5
  import {
6
6
  getHarness2
7
7
  } from "./index-pavzsdc6.js";
8
8
  import {
9
9
  log2
10
- } from "./index-nsjyysj0.js";
10
+ } from "./index-mvvephtj.js";
11
11
  import {
12
12
  isSynapseEmbeddingTruncated
13
- } from "./index-vkbqdnkj.js";
13
+ } from "./index-kvw6xew3.js";
14
14
  import {
15
15
  messageFtsOrdinalRangeIsMapped
16
- } from "./index-rzmjkdd6.js";
16
+ } from "./index-mp2kghkv.js";
17
17
 
18
18
  // src/features/magic-context/compartment-chunk-embedding.ts
19
19
  import { createHash } from "node:crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-qx53vezw.js";
3
+ } from "./index-gjvjh960.js";
4
4
  import {
5
5
  stableStringify
6
- } from "./index-1bt88epp.js";
6
+ } from "./index-g7jkrz0x.js";
7
7
 
8
8
  // src/features/magic-context/tool-definition-tokens.ts
9
9
  import { createHash } from "node:crypto";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./index-k6xvbj2e.js";
3
+ } from "./index-w28y7d0z.js";
4
4
  import {
5
5
  log2
6
- } from "./index-nsjyysj0.js";
6
+ } from "./index-mvvephtj.js";
7
7
  import {
8
8
  isSynapseEmbeddingTruncated,
9
9
  SynapseEmbeddingProvider
10
- } from "./index-vkbqdnkj.js";
10
+ } from "./index-kvw6xew3.js";
11
11
  import {
12
12
  LocalEmbeddingProvider
13
- } from "./index-gbmqa9x9.js";
13
+ } from "./index-bmwfzz28.js";
14
14
  import {
15
15
  OpenAICompatibleEmbeddingProvider,
16
16
  getProjectEmbeddingSnapshot2,
17
17
  embedBatchForProject2
18
- } from "./index-sf94at64.js";
18
+ } from "./index-rg1cezmj.js";
19
19
  import {
20
20
  isEmbeddingHostBusy2
21
21
  } from "./index-qt1qqasc.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./index-nsjyysj0.js";
3
+ } from "./index-mvvephtj.js";
4
4
 
5
5
  // src/shared/safe-notification-target.ts
6
6
  var DEFAULT_TITLE_RE = /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
@@ -3,12 +3,12 @@ import {
3
3
  } from "./index-fr0wbhdn.js";
4
4
  import {
5
5
  log2
6
- } from "./index-nsjyysj0.js";
6
+ } from "./index-mvvephtj.js";
7
7
  import {
8
8
  ensureColumn,
9
9
  healAllNullColumns,
10
10
  installV95PerfSchema
11
- } from "./index-1bt88epp.js";
11
+ } from "./index-g7jkrz0x.js";
12
12
  import {
13
13
  resolveOpenCodeDbPath,
14
14
  openCodeDbPathExists,
@@ -16,14 +16,14 @@ import {
16
16
  } from "./index-58e3y90n.js";
17
17
  import {
18
18
  Database2
19
- } from "./index-j8epsc0g.js";
19
+ } from "./index-wafzvyhg.js";
20
20
  import {
21
21
  normalizeStoredProjectPath,
22
22
  storedPathBelongsToIdentity
23
- } from "./index-g8qbdb03.js";
23
+ } from "./index-0jz47061.js";
24
24
  import {
25
25
  logSlowWriteTransaction
26
- } from "./index-4mjhqadz.js";
26
+ } from "./index-150zz6fh.js";
27
27
 
28
28
  // src/features/magic-context/lkg-prefix-chunks.ts
29
29
  import { createHash } from "node:crypto";
@@ -1,13 +1,14 @@
1
1
  import {
2
+ inRootAsyncContext2,
2
3
  getSqliteDatabasePath2,
3
4
  releaseIndexOwner2
4
- } from "./index-j8epsc0g.js";
5
+ } from "./index-wafzvyhg.js";
5
6
  import {
6
7
  registerExitAbort
7
8
  } from "./index-v0p37hm2.js";
8
9
  import {
9
10
  log2
10
- } from "./index-nsjyysj0.js";
11
+ } from "./index-mvvephtj.js";
11
12
 
12
13
  // src/hooks/magic-context/read-session-raw.ts
13
14
  import { isMainThread } from "node:worker_threads";
@@ -69,7 +70,7 @@ function runSessionWarmupWorker(input, options) {
69
70
  deadline.unref?.();
70
71
  };
71
72
  try {
72
- worker = new Worker(options.entry ?? defaultEntry(), { workerData: input });
73
+ worker = inRootAsyncContext2(() => new Worker(options.entry ?? defaultEntry(), { workerData: input }));
73
74
  } catch (error) {
74
75
  finish({ failure: "start-failed", detail: String(error) });
75
76
  return;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-sd3egckz.js";
4
4
  import {
5
5
  log2
6
- } from "./index-nsjyysj0.js";
6
+ } from "./index-mvvephtj.js";
7
7
 
8
8
  // src/shared/conflict-detector.ts
9
9
  import { homedir as homedir2 } from "node:os";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./index-k6xvbj2e.js";
3
+ } from "./index-w28y7d0z.js";
4
4
  import {
5
5
  getSynapseLaneIdentity
6
- } from "./index-vkbqdnkj.js";
6
+ } from "./index-kvw6xew3.js";
7
7
  import {
8
8
  getHarness2
9
9
  } from "./index-pavzsdc6.js";
@@ -13,7 +13,10 @@ import {
13
13
  import {
14
14
  importPluginModule,
15
15
  log2
16
- } from "./index-nsjyysj0.js";
16
+ } from "./index-mvvephtj.js";
17
+ import {
18
+ inRootAsyncContext2
19
+ } from "./index-wafzvyhg.js";
17
20
  import {
18
21
  computeNormalizedHash
19
22
  } from "./index-2bvekkfy.js";
@@ -309,7 +312,7 @@ class EmbeddingWorkerClient {
309
312
  start() {
310
313
  if (this.startPromise)
311
314
  return this.startPromise;
312
- this.startPromise = this.startOwner().finally(() => {
315
+ this.startPromise = inRootAsyncContext2(() => this.startOwner()).finally(() => {
313
316
  this.startPromise = null;
314
317
  });
315
318
  return this.startPromise;
@@ -558,10 +561,10 @@ async function acquireModelLoadLock(lockPath) {
558
561
  }
559
562
  function startLockHeartbeat(lockPath) {
560
563
  const HEARTBEAT_MS = Math.floor(STALE_LOCK_MS / 3);
561
- const timer = setInterval(() => {
564
+ const timer = inRootAsyncContext2(() => setInterval(() => {
562
565
  writeStorageFileAsync(lockPath, `pid=${process.pid} alive=${Date.now()}
563
566
  `).catch(() => {});
564
- }, HEARTBEAT_MS);
567
+ }, HEARTBEAT_MS));
565
568
  timer.unref?.();
566
569
  return () => clearInterval(timer);
567
570
  }