@cortexkit/opencode-magic-context 0.49.6 → 0.49.8

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 (255) hide show
  1. package/dist/auto-search-worker.js +10 -7
  2. package/dist/compaction-marker-candidates-worker.js +2 -2
  3. package/dist/{compaction-marker-candidates-cz72pm1t.js → compaction-marker-candidates-xxz35vwp.js} +3 -3
  4. package/dist/{conflict-warning-hook-1jq1rxx7.js → conflict-warning-hook-w3crzrar.js} +8 -8
  5. package/dist/{context-ae3gxdye.js → context-x0ccfv0f.js} +88 -53
  6. package/dist/{derive-budgets-j4ry8j8n.js → derive-budgets-3nbxsyss.js} +2 -2
  7. package/dist/embedding-backfill-3h2m5n0q.js +21 -0
  8. package/dist/embedding-worker-process.js +6 -2
  9. package/dist/embedding-worker.js +6 -5
  10. package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
  11. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  12. package/dist/features/magic-context/dreamer/cron.d.ts +2 -0
  13. package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -1
  14. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +6 -3
  15. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
  16. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +7 -1
  17. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
  18. package/dist/features/magic-context/dreamer/map-memories.d.ts +2 -2
  19. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
  20. package/dist/features/magic-context/dreamer/primer-seed.d.ts +2 -0
  21. package/dist/features/magic-context/dreamer/primer-seed.d.ts.map +1 -1
  22. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +1 -0
  23. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
  24. package/dist/features/magic-context/dreamer/refresh-primers.d.ts +2 -2
  25. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  26. package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
  27. package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
  28. package/dist/features/magic-context/migration-worker-client.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/smart-notes/wake-plane.d.ts.map +1 -1
  31. package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
  32. package/dist/features/magic-context/storage-meta-persisted.d.ts +10 -3
  33. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  34. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  35. package/dist/features/magic-context/storage-replay-document.d.ts +4 -0
  36. package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -1
  37. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  38. package/dist/history-owner-ty29fz0f.js +244 -0
  39. package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/apply-operations.d.ts +7 -0
  41. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  44. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/edit-marker.d.ts +2 -0
  46. package/dist/hooks/magic-context/edit-marker.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/module-transport.d.ts +1 -0
  52. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  53. package/dist/hooks/magic-context/note-nudger.d.ts +5 -3
  54. package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
  55. package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  57. package/dist/hooks/magic-context/read-session-chunk.d.ts +15 -4
  58. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  59. package/dist/hooks/magic-context/replay-committed-drops.d.ts +9 -0
  60. package/dist/hooks/magic-context/replay-committed-drops.d.ts.map +1 -0
  61. package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts +2 -2
  62. package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts.map +1 -1
  63. package/dist/hooks/magic-context/rust-mode-transform.d.ts +4 -0
  64. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  65. package/dist/hooks/magic-context/rust-refusal-recovery.d.ts.map +1 -1
  66. package/dist/hooks/magic-context/rust-served-raw.d.ts +29 -0
  67. package/dist/hooks/magic-context/rust-served-raw.d.ts.map +1 -0
  68. package/dist/hooks/magic-context/strip-content.d.ts +23 -24
  69. package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
  70. package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
  71. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  72. package/dist/hooks/magic-context/tool-drop-target.d.ts +2 -0
  73. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  74. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  75. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  76. package/dist/hooks/magic-context/unresolved-history-boundary.d.ts +5 -1
  77. package/dist/hooks/magic-context/unresolved-history-boundary.d.ts.map +1 -1
  78. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  79. package/dist/{index-g9exahnx.js → index-0jz47061.js} +6 -3
  80. package/dist/{index-4mjhqadz.js → index-150zz6fh.js} +1 -1
  81. package/dist/{index-ch08qwgd.js → index-2rw244rh.js} +88 -81
  82. package/dist/{index-6q5h70h2.js → index-4hb8nt93.js} +3 -3
  83. package/dist/{index-j55vn694.js → index-7bjgyaj1.js} +4 -4
  84. package/dist/{index-h2wc01qk.js → index-8kk7yh6m.js} +2 -2
  85. package/dist/{index-vztbgcdk.js → index-9g1c4bt9.js} +304 -92
  86. package/dist/{index-7q1m1qjk.js → index-a43xq1pg.js} +5 -5
  87. package/dist/{index-tqf7yg27.js → index-a4b0gbyg.js} +1 -1
  88. package/dist/{index-vnjhmkwk.js → index-angx1s0k.js} +4 -3
  89. package/dist/{index-1xaw2pq8.js → index-b4gcb3rk.js} +8 -8
  90. package/dist/{index-z1tjp257.js → index-b64n4d0h.js} +1 -1
  91. package/dist/{index-1bt88epp.js → index-bd9cjab3.js} +1 -1
  92. package/dist/{index-gbmqa9x9.js → index-bmwfzz28.js} +9 -6
  93. package/dist/{index-qx53vezw.js → index-gjvjh960.js} +1 -1
  94. package/dist/{index-zgzdm6dg.js → index-gzg9ekc1.js} +155 -103
  95. package/dist/{index-vh3e2mvr.js → index-hxrvx6cy.js} +121 -51
  96. package/dist/{index-w23dh319.js → index-jw4gbfkv.js} +1 -1
  97. package/dist/index-knvkbfvh.js +25 -0
  98. package/dist/{index-vkbqdnkj.js → index-kvw6xew3.js} +6 -3
  99. package/dist/{index-bg5qqene.js → index-mp2kghkv.js} +3 -27
  100. package/dist/{index-nsjyysj0.js → index-mvvephtj.js} +5 -1
  101. package/dist/{index-cm4hmxyk.js → index-n78avt2p.js} +1 -1
  102. package/dist/{index-hr64sth2.js → index-pgy3h49n.js} +4 -4
  103. package/dist/{index-a796ct3s.js → index-pjgzdezw.js} +13 -9
  104. package/dist/{index-9m7bn21d.js → index-q28hsbpg.js} +15 -3
  105. package/dist/{index-ab3bgm2m.js → index-q76br5zn.js} +3 -3
  106. package/dist/{index-xqyj5c85.js → index-qgp5vnt4.js} +5 -5
  107. package/dist/{index-9s58tq95.js → index-rg1cezmj.js} +22 -22
  108. package/dist/{index-f3dnvnw6.js → index-s178h9z8.js} +4 -3
  109. package/dist/{index-mj1fgfrk.js → index-w1ejb9qr.js} +939 -160
  110. package/dist/{index-k6xvbj2e.js → index-w28y7d0z.js} +2 -0
  111. package/dist/{index-0nnd4bry.js → index-wafzvyhg.js} +63 -19
  112. package/dist/{index-ck6y3td2.js → index-xf6k8szp.js} +4 -4
  113. package/dist/{index-1j8jcjpa.js → index-xpn05jxq.js} +4 -4
  114. package/dist/{index-s0gsmthp.js → index-ydjgz36f.js} +7 -7
  115. package/dist/{index-besxhcsh.js → index-zf9nydbd.js} +50 -39
  116. package/dist/index.js +53 -52
  117. package/dist/{logger-ewak5q1s.js → logger-wn328tfg.js} +1 -1
  118. package/dist/{message-index-bounded-630j53ps.js → message-index-bounded-hxjp56qk.js} +16 -16
  119. package/dist/{message-index-c84wm2g0.js → message-index-zs882h8e.js} +16 -16
  120. package/dist/{message-time-backfill-8kj57qe3.js → message-time-backfill-nb5hhnrt.js} +3 -3
  121. package/dist/migration-worker.js +11 -11
  122. package/dist/plugin/boot-quiet.d.ts.map +1 -1
  123. package/dist/plugin/dream-timer.d.ts.map +1 -1
  124. package/dist/plugin/messages-transform.d.ts.map +1 -1
  125. package/dist/plugin/rpc-handlers.d.ts +2 -0
  126. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  127. package/dist/{project-embedding-registry-vv59t7ah.js → project-embedding-registry-vy7sv9jt.js} +11 -11
  128. package/dist/raw-ordinal-warmup-worker.js +17 -15
  129. package/dist/{read-session-chunk-t3vjd0h0.js → read-session-chunk-t9r7r0sg.js} +13 -11
  130. package/dist/{read-session-raw-gf7eytnm.js → read-session-raw-gm6xj30v.js} +3 -3
  131. package/dist/recomp-orchestrator-gr36zvd2.js +60 -0
  132. package/dist/{safe-notification-target-q0cyrx3x.js → safe-notification-target-jdynm677.js} +2 -2
  133. package/dist/{search-kth2p6cc.js → search-qjen1pmz.js} +24 -24
  134. package/dist/{send-session-notification-3j6krd4w.js → send-session-notification-q8ngbap3.js} +6 -6
  135. package/dist/shared/history-owner.d.ts +12 -0
  136. package/dist/shared/history-owner.d.ts.map +1 -0
  137. package/dist/shared/off-thread-migration-clock.d.ts +8 -1
  138. package/dist/shared/off-thread-migration-clock.d.ts.map +1 -1
  139. package/dist/shared/processed-image-eligibility.d.ts +22 -0
  140. package/dist/shared/processed-image-eligibility.d.ts.map +1 -0
  141. package/dist/shared/recovery-reasoning-prefix.d.ts +9 -0
  142. package/dist/shared/recovery-reasoning-prefix.d.ts.map +1 -0
  143. package/dist/shared/redaction.d.ts.map +1 -1
  144. package/dist/shared/rpc-server.d.ts.map +1 -1
  145. package/dist/shared/sqlite.d.ts +3 -1
  146. package/dist/shared/sqlite.d.ts.map +1 -1
  147. package/dist/shared/tag-transcript.d.ts +9 -0
  148. package/dist/shared/tag-transcript.d.ts.map +1 -1
  149. package/dist/shared/user-facing-codes.d.ts +2 -2
  150. package/dist/{sqlite-d7edbk1s.js → sqlite-4pqyynrs.js} +3 -1
  151. package/dist/{storage-memory-af5zdz98.js → storage-memory-j3v3hc83.js} +2 -2
  152. package/dist/{storage-tags-dyj7mmbq.js → storage-tags-a513rkj3.js} +5 -5
  153. package/dist/tools/ctx-expand/search-archive.d.ts +4 -0
  154. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -0
  155. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  156. package/dist/{transform-postprocess-phase-bv3kb5s1.js → transform-postprocess-phase-yv463b7y.js} +30 -30
  157. package/dist/v2/auto-search-worker.js +10 -7
  158. package/dist/v2/{compaction-marker-candidates-6gqp5wrc.js → compaction-marker-candidates-a15w3mqh.js} +3 -3
  159. package/dist/v2/compaction-marker-candidates-worker.js +2 -2
  160. package/dist/v2/{context-p8f2shp1.js → context-wd82v9z6.js} +1133 -278
  161. package/dist/v2/{derive-budgets-enckmg7y.js → derive-budgets-0rmpmxjw.js} +3 -3
  162. package/dist/v2/embedding-backfill-vr7wdtrf.js +20 -0
  163. package/dist/v2/embedding-worker-process.js +6 -2
  164. package/dist/v2/embedding-worker.js +6 -5
  165. package/dist/v2/hidden-completion.d.ts.map +1 -1
  166. package/dist/v2/history-owner-2cr9py37.js +243 -0
  167. package/dist/v2/hooks/context.d.ts.map +1 -1
  168. package/dist/v2/hooks/payload.d.ts.map +1 -1
  169. package/dist/v2/hooks/store.d.ts +1 -0
  170. package/dist/v2/hooks/store.d.ts.map +1 -1
  171. package/dist/v2/{logger-pj02s7sr.js → logger-te6e1j72.js} +1 -1
  172. package/dist/v2/{message-index-bounded-yzxmf6vp.js → message-index-bounded-madg2kfr.js} +16 -16
  173. package/dist/v2/{message-index-3ws17x1g.js → message-index-yd94vt9n.js} +16 -16
  174. package/dist/v2/{message-time-backfill-5nf10c65.js → message-time-backfill-rz1pnpaj.js} +3 -3
  175. package/dist/v2/migration-worker.js +11 -11
  176. package/dist/v2/{project-embedding-registry-rsnf2263.js → project-embedding-registry-ja23aygk.js} +11 -11
  177. package/dist/v2/raw-ordinal-warmup-worker.js +17 -15
  178. package/dist/v2/{read-session-chunk-vtb0w2kd.js → read-session-chunk-7qs791f3.js} +13 -11
  179. package/dist/v2/{read-session-raw-gpcddemt.js → read-session-raw-h4azh85b.js} +3 -3
  180. package/dist/v2/recomp-orchestrator-ee91r9s6.js +59 -0
  181. package/dist/v2/{safe-notification-target-y3p1hce9.js → safe-notification-target-936374xx.js} +2 -2
  182. package/dist/v2/search-pn15rr52.js +46 -0
  183. package/dist/v2/{send-session-notification-5aj2j7vf.js → send-session-notification-6n7chhyp.js} +6 -6
  184. package/dist/v2/{server-09g9pkvx.js → server-08k4zkfk.js} +50 -39
  185. package/dist/v2/{server-ras2sxnc.js → server-44ryn9rb.js} +9 -6
  186. package/dist/v2/{server-158ehmk2.js → server-4easnf78.js} +19 -19
  187. package/dist/v2/{server-ww9nr8pe.js → server-4gz0xkrc.js} +5 -5
  188. package/dist/v2/{server-d6g4whc2.js → server-4qr18rfg.js} +3 -3
  189. package/dist/v2/{server-f9py7s7a.js → server-4rs8sm06.js} +5 -5
  190. package/dist/v2/{server-yezz0cp2.js → server-63ha7f0f.js} +3 -27
  191. package/dist/v2/{server-3t0q2cqx.js → server-7dv9wt9r.js} +1 -1
  192. package/dist/v2/{server-cw6521wn.js → server-7e087rvk.js} +2 -0
  193. package/dist/v2/{server-hb6xhh9q.js → server-988cqjme.js} +6 -3
  194. package/dist/v2/{server-keswwkvv.js → server-9a6bwc12.js} +4 -4
  195. package/dist/v2/{server-t4k4qexw.js → server-9e5r8y60.js} +5 -1
  196. package/dist/v2/{server-7ekna9zs.js → server-adfte03x.js} +2 -2
  197. package/dist/v2/{server-9zqewm6g.js → server-ak7w74j9.js} +4 -4
  198. package/dist/v2/{server-387vkhjq.js → server-bx59ezg6.js} +4 -3
  199. package/dist/v2/{server-676xw7at.js → server-ckrb5rm8.js} +1 -1
  200. package/dist/v2/{server-wrem2nmz.js → server-cxsr0ng6.js} +15 -3
  201. package/dist/v2/{server-t528t8qm.js → server-hn9fb3v0.js} +2 -2
  202. package/dist/v2/{server-qn23p4h7.js → server-j3dm74ey.js} +9 -9
  203. package/dist/v2/{server-yd01snxq.js → server-jjsf29aq.js} +4 -4
  204. package/dist/v2/server-knvkbfvh.js +25 -0
  205. package/dist/v2/{server-cm4hmxyk.js → server-n78avt2p.js} +1 -1
  206. package/dist/v2/{server-btgnsv7w.js → server-njnx39q2.js} +6 -3
  207. package/dist/v2/{server-6a9mxnb2.js → server-npm52h2q.js} +4 -3
  208. package/dist/v2/{server-vb7pbd9p.js → server-nveratm5.js} +1 -1
  209. package/dist/v2/{server-7skbfb81.js → server-q360kdb8.js} +121 -51
  210. package/dist/v2/{server-kzns2hbz.js → server-s6jqh8bj.js} +1 -1
  211. package/dist/v2/{server-6byqfbqf.js → server-shme41gj.js} +1 -1
  212. package/dist/v2/{server-0nnd4bry.js → server-wafzvyhg.js} +63 -19
  213. package/dist/v2/{server-fby0cxbq.js → server-xj4mewze.js} +304 -92
  214. package/dist/v2/{server-aa9w15cs.js → server-y5g32dhq.js} +88 -81
  215. package/dist/v2/{server-x2r63c0x.js → server-yak3sxya.js} +7 -7
  216. package/dist/v2/{server-4tn95znb.js → server-zrwaj29a.js} +2 -2
  217. package/dist/v2/server.js +9 -8
  218. package/dist/v2/{sqlite-d7edbk1s.js → sqlite-4pqyynrs.js} +3 -1
  219. package/dist/v2/{storage-memory-af5zdz98.js → storage-memory-j3v3hc83.js} +2 -2
  220. package/dist/v2/{storage-tags-d47bpaqa.js → storage-tags-spa92sgj.js} +5 -5
  221. package/dist/v2/store-reader.d.ts.map +1 -1
  222. package/dist/v2/{wrapup-orchestrator-cahk37n7.js → wrapup-orchestrator-5wxy1ggv.js} +38 -35
  223. package/dist/wrapup-orchestrator-gv08c6f9.js +47 -0
  224. package/package.json +3 -3
  225. package/src/config/compaction-accessor-guard.test.ts +3 -0
  226. package/src/features/magic-context/dreamer/cron.ts +8 -0
  227. package/src/shared/history-owner.test.ts +60 -0
  228. package/src/shared/history-owner.ts +43 -0
  229. package/src/shared/host-stall-profiler-node.ts +3 -1
  230. package/src/shared/host-stall-profiler.ts +3 -1
  231. package/src/shared/off-thread-migration-clock.test.ts +80 -10
  232. package/src/shared/off-thread-migration-clock.ts +37 -13
  233. package/src/shared/processed-image-eligibility.test.ts +68 -0
  234. package/src/shared/processed-image-eligibility.ts +41 -0
  235. package/src/shared/processed-image-position-review.json +20 -0
  236. package/src/shared/processed-image-position-review.test.ts +19 -0
  237. package/src/shared/recovery-reasoning-prefix.test.ts +34 -0
  238. package/src/shared/recovery-reasoning-prefix.ts +35 -0
  239. package/src/shared/redaction.test.ts +16 -0
  240. package/src/shared/redaction.ts +8 -1
  241. package/src/shared/root-async-context.probe.mjs +36 -0
  242. package/src/shared/root-async-context.test.ts +49 -0
  243. package/src/shared/rpc-server.ts +27 -23
  244. package/src/shared/sqlite-busy-budget-review.test.ts +291 -0
  245. package/src/shared/sqlite-foreground-wait.test.ts +253 -1
  246. package/src/shared/sqlite-writer-diagnostics.test.ts +31 -0
  247. package/src/shared/sqlite.ts +112 -30
  248. package/src/shared/tag-transcript.ts +118 -0
  249. package/src/shared/user-facing-codes.ts +2 -2
  250. package/dist/embedding-backfill-dtjmyktb.js +0 -21
  251. package/dist/recomp-orchestrator-1d08g57a.js +0 -60
  252. package/dist/v2/embedding-backfill-cg4rv90f.js +0 -20
  253. package/dist/v2/recomp-orchestrator-v64r4s4r.js +0 -59
  254. package/dist/v2/search-bpa4fxq1.js +0 -46
  255. package/dist/wrapup-orchestrator-mqp0v195.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-bd9cjab3.js";
10
10
  import {
11
11
  protectedToolTagNumbers,
12
12
  byteSize,
@@ -62,36 +62,38 @@ import {
62
62
  getTagsByNumbers2,
63
63
  getNewestToolTagNumbers2,
64
64
  getDroppedTagsByNumbers2,
65
+ getMaxDroppedTagNumber2,
65
66
  getTagById2,
66
67
  getToolTagNumberByOwner2,
67
68
  getNullOwnerToolTag2,
68
69
  adoptNullOwnerToolTag2,
69
70
  getCandidateToolOwners2,
70
71
  pickNearestPriorOwner2
71
- } from "./index-1j8jcjpa.js";
72
+ } from "./index-xpn05jxq.js";
72
73
  import {
73
74
  textMentionsRecentCommit,
74
75
  hasMeaningfulUserText2,
75
76
  estimateTokens
76
- } from "./index-qx53vezw.js";
77
+ } from "./index-gjvjh960.js";
77
78
  import {
78
79
  log2,
79
80
  sessionLog2
80
- } from "./index-nsjyysj0.js";
81
+ } from "./index-mvvephtj.js";
81
82
  import {
83
+ inRootAsyncContext2,
82
84
  getTagIdentityWriteGeneration2,
83
85
  getSqliteDatabasePath2,
84
86
  assertTransformWrite2,
85
87
  isTransientSqliteError2
86
- } from "./index-0nnd4bry.js";
88
+ } from "./index-wafzvyhg.js";
87
89
  import {
88
90
  isValidLanguageCode
89
- } from "./index-k6xvbj2e.js";
91
+ } from "./index-w28y7d0z.js";
90
92
  import {
91
93
  getProjectEmbeddingSnapshot2,
92
94
  embedTextForProject2,
93
95
  embedBatchForProject2
94
- } from "./index-9s58tq95.js";
96
+ } from "./index-rg1cezmj.js";
95
97
  import {
96
98
  isEmbeddingHostBusy2
97
99
  } from "./index-qt1qqasc.js";
@@ -140,6 +142,7 @@ import {
140
142
  addTrailingBlankDecisions,
141
143
  demoteTrailingBlankKeepDecisions,
142
144
  addStaleReduceStrippedIds,
145
+ getProcessedImageMarkers,
143
146
  addProcessedImageStrippedIds,
144
147
  getPendingCompactionMarkerState,
145
148
  loadPostprocessReplaySnapshot,
@@ -185,7 +188,7 @@ import {
185
188
  extractToolCallObservation,
186
189
  ToolMutationBatch,
187
190
  createToolDropTarget
188
- } from "./index-vztbgcdk.js";
191
+ } from "./index-9g1c4bt9.js";
189
192
  import {
190
193
  getMaxM0MutationId,
191
194
  rememberUnpublishedAutoSearchNoHint,
@@ -219,21 +222,21 @@ import {
219
222
  peekNoteNudgeText,
220
223
  markNoteNudgeDelivered,
221
224
  getActiveCompartmentRun
222
- } from "./index-vh3e2mvr.js";
225
+ } from "./index-hxrvx6cy.js";
223
226
  import {
224
227
  runSessionWarmupWorker
225
- } from "./index-vnjhmkwk.js";
228
+ } from "./index-angx1s0k.js";
226
229
  import {
227
230
  openCodeDbExists,
228
231
  withReadOnlySessionDb,
229
232
  getMessageTimesFromOpenCodeDb
230
- } from "./index-ab3bgm2m.js";
233
+ } from "./index-q76br5zn.js";
231
234
  import {
232
235
  BoundedSessionMap
233
- } from "./index-1xaw2pq8.js";
236
+ } from "./index-b4gcb3rk.js";
234
237
  import {
235
238
  renderUserFacingFailure
236
- } from "./index-s0gsmthp.js";
239
+ } from "./index-ydjgz36f.js";
237
240
  import {
238
241
  getErrorMessage
239
242
  } from "./index-y8v6yerm.js";
@@ -243,7 +246,7 @@ import {
243
246
  } from "./index-d9vfe7xq.js";
244
247
  import {
245
248
  logSlowWriteTransaction
246
- } from "./index-4mjhqadz.js";
249
+ } from "./index-150zz6fh.js";
247
250
 
248
251
  // src/features/magic-context/tagger.ts
249
252
  var TOOL_COMPOSITE_KEY_SEP = "\x00";
@@ -1337,7 +1340,7 @@ function queueAutoSearchBackfill(db, sessionId, projectPath, query) {
1337
1340
  pending.delete(key);
1338
1341
  resolve();
1339
1342
  };
1340
- const queued = setTimeout(() => {
1343
+ const queued = inRootAsyncContext2(() => setTimeout(() => {
1341
1344
  lifecycle.signal.removeEventListener("abort", cancel);
1342
1345
  if (lifecycle.signal.aborted)
1343
1346
  return done();
@@ -1348,7 +1351,7 @@ function queueAutoSearchBackfill(db, sessionId, projectPath, query) {
1348
1351
  clearTimeout(timeout);
1349
1352
  done();
1350
1353
  });
1351
- }, 0);
1354
+ }, 0));
1352
1355
  const cancel = () => {
1353
1356
  clearTimeout(queued);
1354
1357
  done();
@@ -1395,7 +1398,7 @@ async function executeAutoSearchWorker(db, sessionId, projectPath, query, option
1395
1398
  deadlineUnixMs: autoSearchDeadlineUnixMs(deadlineSignal)
1396
1399
  };
1397
1400
  return new Promise((resolve, reject) => {
1398
- const worker = new Worker(entry, { workerData: input });
1401
+ const worker = inRootAsyncContext2(() => new Worker(entry, { workerData: input }));
1399
1402
  let settled = false;
1400
1403
  const finish = (results, error) => {
1401
1404
  if (settled)
@@ -1507,7 +1510,7 @@ function searchMessageHistoryOffThread(db, request, entry = defaultAutoSearchWor
1507
1510
  deadline.unref?.();
1508
1511
  };
1509
1512
  try {
1510
- worker = new Worker(entry, { workerData: input });
1513
+ worker = inRootAsyncContext2(() => new Worker(entry, { workerData: input }));
1511
1514
  } catch (error) {
1512
1515
  finish(null, "start-failed", error);
1513
1516
  return;
@@ -2765,21 +2768,40 @@ function buildReplacementContent(tagId) {
2765
2768
  return `[dropped §${tagId}§]`;
2766
2769
  }
2767
2770
  function applyNewToolDrop(target, options) {
2768
- if (!target)
2771
+ if (options.persist && (target?.prepareDrop?.() ?? target?.canDrop?.()) === false) {
2772
+ return { result: "incomplete", mode: "full" };
2773
+ }
2774
+ if (!target) {
2775
+ options.persist?.("full");
2769
2776
  return { result: "absent", mode: "full" };
2770
- if (options.inWindow && hasSmallToolInput(target) || options.keepSkeleton === true || target.cannotRemove?.() === true) {
2777
+ }
2778
+ if (options.inWindow && hasSmallToolInput(target) || options.keepSkeleton === true || target.cannotRemove?.() === true || target.wouldStrandConversationEnd?.() === true) {
2771
2779
  const strip = target.hasAttachments?.() === true;
2780
+ options.persist?.(strip ? "skeleton_stripped" : "skeleton_real");
2772
2781
  return {
2773
2782
  result: (strip ? target.skeletonStripped?.() : target.skeletonReal?.()) ?? "absent",
2774
2783
  mode: strip ? "skeleton_stripped" : "skeleton_real"
2775
2784
  };
2776
2785
  }
2786
+ options.persist?.("full");
2777
2787
  const result = target.drop?.() ?? "absent";
2778
2788
  if (result === "truncated" && target.hasAttachments?.() === true) {
2779
2789
  return { result: target.skeletonStripped?.() ?? "absent", mode: "skeleton_stripped" };
2780
2790
  }
2781
2791
  return { result, mode: result === "truncated" ? "skeleton_real" : "full" };
2782
2792
  }
2793
+ function applyPersistedToolDrop(db, sessionId, tagNumber, target, options, afterWrite) {
2794
+ return applyNewToolDrop(target, {
2795
+ ...options,
2796
+ persist: (mode) => {
2797
+ db.transaction(() => {
2798
+ updateTagDropMode2(db, sessionId, tagNumber, mode);
2799
+ updateTagStatus2(db, sessionId, tagNumber, "dropped");
2800
+ afterWrite?.();
2801
+ }).immediate();
2802
+ }
2803
+ });
2804
+ }
2783
2805
  function hasSmallToolInput(target) {
2784
2806
  const bytes = target?.inputStringBytes?.() ?? null;
2785
2807
  return bytes !== null && bytes <= SKELETON_REAL_INPUT_MAX_BYTES;
@@ -2859,11 +2881,11 @@ function applyPendingOperations(sessionId, db, targets, protectedTagIds, preload
2859
2881
  diagnostics.reasons[reason] = (diagnostics.reasons[reason] ?? 0) + 1;
2860
2882
  };
2861
2883
  let admitted = false;
2862
- let startedAt = 0;
2863
2884
  try {
2864
2885
  db.transaction(() => {
2865
2886
  admitted = true;
2866
- startedAt = performance.now();
2887
+ }).immediate();
2888
+ {
2867
2889
  const pendingOps = preloadedPendingOps ?? getPendingOps(db, sessionId);
2868
2890
  const tags = preloadedTags ?? getTagsByNumbers2(db, sessionId, [
2869
2891
  ...new Set([
@@ -2915,10 +2937,31 @@ function applyPendingOperations(sessionId, db, targets, protectedTagIds, preload
2915
2937
  continue;
2916
2938
  }
2917
2939
  }
2940
+ const persistDrop = (mode) => {
2941
+ let startedAt = 0;
2942
+ try {
2943
+ db.transaction(() => {
2944
+ startedAt = performance.now();
2945
+ if (mode)
2946
+ updateTagDropMode2(db, sessionId, pendingOp.tagId, mode);
2947
+ updateTagStatus2(db, sessionId, pendingOp.tagId, "dropped");
2948
+ if (!synthetic)
2949
+ removePendingOp(db, sessionId, pendingOp.tagId);
2950
+ }).immediate();
2951
+ } finally {
2952
+ if (startedAt)
2953
+ logSlowWriteTransaction("apply_pending_operation", startedAt);
2954
+ }
2955
+ };
2918
2956
  let shouldPersistDrop = false;
2919
2957
  if (isToolTag) {
2920
2958
  if (editMarkerTagIds.has(pendingOp.tagId)) {
2921
2959
  const strip = target?.hasAttachments?.() === true;
2960
+ if (target?.canDrop?.() === false || target?.prepareDrop?.() === false || !target) {
2961
+ reject("edit_marker_incomplete");
2962
+ continue;
2963
+ }
2964
+ persistDrop(strip ? "edit_marker_stripped" : "edit_marker");
2922
2965
  const markResult = (strip ? target?.editMarkerStripped?.() : target?.editMarker?.()) ?? "absent";
2923
2966
  if (markResult === "incomplete" || markResult === "absent") {
2924
2967
  reject(`edit_marker_${markResult}`);
@@ -2927,11 +2970,11 @@ function applyPendingOperations(sessionId, db, targets, protectedTagIds, preload
2927
2970
  didMutateMessage = true;
2928
2971
  operationMutated = true;
2929
2972
  onTagReduced?.({ tagNumber: pendingOp.tagId, mode: "edit_marker" });
2930
- updateTagDropMode2(db, sessionId, pendingOp.tagId, strip ? "edit_marker_stripped" : "edit_marker");
2931
2973
  shouldPersistDrop = true;
2932
2974
  } else {
2933
2975
  const { result: dropResult, mode: appliedMode } = applyNewToolDrop(target, {
2934
- inWindow: skeletonWindow.has(pendingOp.tagId)
2976
+ inWindow: skeletonWindow.has(pendingOp.tagId),
2977
+ persist: persistDrop
2935
2978
  });
2936
2979
  if (dropResult === "incomplete" || synthetic && dropResult !== "removed" && dropResult !== "truncated") {
2937
2980
  reject(`drop_${dropResult}`);
@@ -2947,12 +2990,12 @@ function applyPendingOperations(sessionId, db, targets, protectedTagIds, preload
2947
2990
  } else {
2948
2991
  reject(`drop_${dropResult}`);
2949
2992
  }
2950
- updateTagDropMode2(db, sessionId, pendingOp.tagId, appliedMode);
2951
2993
  shouldPersistDrop = true;
2952
2994
  }
2953
2995
  } else if (target) {
2954
2996
  const replacement = buildReplacementContent(pendingOp.tagId);
2955
2997
  const priorContent = target.getContent?.();
2998
+ persistDrop();
2956
2999
  const changed = target.setContent(replacement);
2957
3000
  if (changed) {
2958
3001
  didMutateMessage = true;
@@ -2969,30 +3012,25 @@ function applyPendingOperations(sessionId, db, targets, protectedTagIds, preload
2969
3012
  shouldPersistDrop = true;
2970
3013
  } else if (!synthetic) {
2971
3014
  reject("target_absent");
3015
+ persistDrop();
2972
3016
  shouldPersistDrop = true;
2973
3017
  }
2974
3018
  if (!shouldPersistDrop) {
2975
3019
  reject("not_persisted");
2976
3020
  continue;
2977
3021
  }
2978
- updateTagStatus2(db, sessionId, pendingOp.tagId, "dropped");
2979
- if (!synthetic)
2980
- removePendingOp(db, sessionId, pendingOp.tagId);
2981
3022
  if (operationMutated)
2982
3023
  diagnostics.mutated += 1;
2983
3024
  else
2984
3025
  diagnostics.persistedWithoutMutation += 1;
2985
3026
  }
2986
- }).immediate();
3027
+ }
2987
3028
  } catch (error) {
2988
3029
  if (!admitted && /database (?:table )?is locked|sqlite_(busy|locked)/i.test(String(error))) {
2989
3030
  sessionLog2(sessionId, "pending operations write admission busy; retaining prior bytes for retry");
2990
3031
  return false;
2991
3032
  }
2992
3033
  throw error;
2993
- } finally {
2994
- if (admitted)
2995
- logSlowWriteTransaction("apply_pending_operations", startedAt);
2996
3034
  }
2997
3035
  if (diagnostics) {
2998
3036
  onBatchComplete?.(diagnostics);
@@ -3281,31 +3319,27 @@ function applyHeuristicCleanup(sessionId, db, targets, messageTagNumbers, config
3281
3319
  if (plan.shouldDrop) {
3282
3320
  const toDrop = new Set(plan.tagNumbers);
3283
3321
  const newestEmergencyTags = recentTags;
3284
- db.transaction(() => {
3285
- for (const tag of tags) {
3286
- if (!toDrop.has(tag.tagNumber))
3287
- continue;
3288
- if (tag.status !== "active" || tag.type !== "tool")
3289
- continue;
3290
- const target = targets.get(tag.tagNumber);
3291
- const recent = (emergency.usagePercentage ?? 0) < 95 && newestEmergencyTags.has(tag.tagNumber);
3292
- const { result, mode } = applyNewToolDrop(target, {
3293
- inWindow: recent,
3294
- keepSkeleton: target?.requiresToolArcSkeleton === true
3322
+ for (const tag of tags) {
3323
+ if (!toDrop.has(tag.tagNumber))
3324
+ continue;
3325
+ if (tag.status !== "active" || tag.type !== "tool")
3326
+ continue;
3327
+ const target = targets.get(tag.tagNumber);
3328
+ const recent = (emergency.usagePercentage ?? 0) < 95 && newestEmergencyTags.has(tag.tagNumber);
3329
+ const { result } = applyPersistedToolDrop(db, sessionId, tag.tagNumber, target, {
3330
+ inWindow: recent,
3331
+ keepSkeleton: target?.requiresToolArcSkeleton === true
3332
+ });
3333
+ if (result === "removed" || result === "truncated") {
3334
+ droppedTools++;
3335
+ emergencyDroppedTools++;
3336
+ droppedTokenReductions.push({
3337
+ tagNumber: tag.tagNumber,
3338
+ mode: result === "removed" ? "full" : "truncated"
3295
3339
  });
3296
- if (result === "removed" || result === "truncated") {
3297
- updateTagStatus2(db, sessionId, tag.tagNumber, "dropped");
3298
- updateTagDropMode2(db, sessionId, tag.tagNumber, mode);
3299
- droppedTools++;
3300
- emergencyDroppedTools++;
3301
- droppedTokenReductions.push({
3302
- tagNumber: tag.tagNumber,
3303
- mode: result === "removed" ? "full" : "truncated"
3304
- });
3305
- emergencyReclaimedTokens += estimateEmergencyDropReclaimTokens(measuredByTag.get(tag.tagNumber) ?? tag);
3306
- }
3340
+ emergencyReclaimedTokens += estimateEmergencyDropReclaimTokens(measuredByTag.get(tag.tagNumber) ?? tag);
3307
3341
  }
3308
- }).immediate();
3342
+ }
3309
3343
  sessionLog2(sessionId, `emergency tiered drop: ${plan.reason}`);
3310
3344
  } else {
3311
3345
  sessionLog2(sessionId, `emergency tiered drop skipped: ${plan.reason}`);
@@ -3386,35 +3420,33 @@ function applyHeuristicCleanup(sessionId, db, targets, messageTagNumbers, config
3386
3420
  group.push(tag);
3387
3421
  fingerprintGroups.set(fingerprint, group);
3388
3422
  }
3389
- db.transaction(() => {
3390
- for (const [, group] of fingerprintGroups) {
3391
- if (group.length <= 1)
3423
+ for (const [, group] of fingerprintGroups) {
3424
+ if (group.length <= 1)
3425
+ continue;
3426
+ group.sort((a, b) => a.tagNumber - b.tagNumber);
3427
+ for (let i = 0;i < group.length - 1; i++) {
3428
+ const tag = group[i];
3429
+ if (config.protectedTagNumbers.has(tag.tagNumber))
3392
3430
  continue;
3393
- group.sort((a, b) => a.tagNumber - b.tagNumber);
3394
- for (let i = 0;i < group.length - 1; i++) {
3395
- const tag = group[i];
3396
- if (config.protectedTagNumbers.has(tag.tagNumber))
3397
- continue;
3398
- const target = targets.get(tag.tagNumber);
3399
- if (protectedTools.has(tag.tagNumber))
3400
- continue;
3401
- if (target?.canDrop?.() === false)
3402
- continue;
3403
- const { result, mode } = applyNewToolDrop(target, { inWindow: false });
3404
- if (result === "incomplete")
3405
- continue;
3406
- updateTagDropMode2(db, sessionId, tag.tagNumber, mode);
3407
- updateTagStatus2(db, sessionId, tag.tagNumber, "dropped");
3408
- if (result === "removed" || result === "truncated") {
3409
- deduplicatedTools++;
3410
- droppedTokenReductions.push({
3411
- tagNumber: tag.tagNumber,
3412
- mode: result === "removed" ? "full" : "truncated"
3413
- });
3414
- }
3431
+ const target = targets.get(tag.tagNumber);
3432
+ if (protectedTools.has(tag.tagNumber))
3433
+ continue;
3434
+ if (target?.canDrop?.() === false)
3435
+ continue;
3436
+ const { result } = applyPersistedToolDrop(db, sessionId, tag.tagNumber, target, {
3437
+ inWindow: false
3438
+ });
3439
+ if (result === "incomplete")
3440
+ continue;
3441
+ if (result === "removed" || result === "truncated") {
3442
+ deduplicatedTools++;
3443
+ droppedTokenReductions.push({
3444
+ tagNumber: tag.tagNumber,
3445
+ mode: result === "removed" ? "full" : "truncated"
3446
+ });
3415
3447
  }
3416
3448
  }
3417
- }).immediate();
3449
+ }
3418
3450
  }
3419
3451
  if (droppedTools > 0 || deduplicatedTools > 0 || droppedInjections > 0) {
3420
3452
  sessionLog2(sessionId, `heuristic cleanup: dropped ${droppedTools} tool tags, deduplicated ${deduplicatedTools} tool calls, dropped ${droppedInjections} system injections`);
@@ -3588,6 +3620,7 @@ function postprocessReplaySnapshot(db, sessionId) {
3588
3620
  ...replay,
3589
3621
  staleReduceStrippedIds: new Set(replay.staleReduceStrippedIds),
3590
3622
  processedImageStrippedIds: new Set(replay.processedImageStrippedIds),
3623
+ processedImageMarkers: new Map(replay.processedImageMarkers),
3591
3624
  strippedPlaceholderIds: new Set(replay.strippedPlaceholderIds),
3592
3625
  hiddenSeamPlaceholderIds: new Set(replay.hiddenSeamPlaceholderIds),
3593
3626
  mergedReasoningStrippedIds: new Set(replay.mergedReasoningStrippedIds),
@@ -4897,11 +4930,6 @@ function runRustModePostprocess2(args) {
4897
4930
  for (const anchor of getNoteNudgeAnchors(args.db, args.sessionId)) {
4898
4931
  appendReminderToUserMessageById(args.messages, anchor.messageId, anchor.text);
4899
4932
  }
4900
- for (const decision of getAutoSearchHintDecisions(args.db, args.sessionId)) {
4901
- if (decision.decision === "hint" && getUnpublishedAutoSearchNoHint(args.sessionId, decision.messageId) === undefined) {
4902
- appendReminderToUserMessageById(args.messages, decision.messageId, decision.text);
4903
- }
4904
- }
4905
4933
  const trailingBlankDecisions = new Map;
4906
4934
  const visibleAssistantIds = args.messages.filter((message) => message.info.role === "assistant").map((message) => message.info.id).filter((id) => typeof id === "string");
4907
4935
  if (modelAcceptsEmptyContent(args.resolvedProviderID)) {
@@ -4939,7 +4967,7 @@ function runRustModePostprocess2(args) {
4939
4967
  userMessageIds: args.messages.filter((m) => m.info.role === "user" && typeof m.info.id === "string").map((m) => m.info.id),
4940
4968
  anchorMessageId: currentUserMessageId,
4941
4969
  isLiveTail: args.messages.at(-1)?.info.id === currentUserMessageId,
4942
- isCacheBustingPass: args.cacheBustingPass === true
4970
+ prefixRewriteCoversAnchor: false
4943
4971
  });
4944
4972
  const noteReadStillVisible = hasVisibleNoteReadCall(args.messages);
4945
4973
  const deferredNoteText = peekNoteNudgeText(args.db, args.sessionId, currentUserMessageId, args.projectPath, noteReadStillVisible, eligibility);
@@ -4956,6 +4984,11 @@ function runRustModePostprocess2(args) {
4956
4984
  sessionLog2(args.sessionId, `rust note-nudge delivery skipped wire append: ${outcome.kind}`);
4957
4985
  }
4958
4986
  }
4987
+ for (const decision of getAutoSearchHintDecisions(args.db, args.sessionId)) {
4988
+ if (decision.decision === "hint" && getUnpublishedAutoSearchNoHint(args.sessionId, decision.messageId) === undefined) {
4989
+ appendReminderToUserMessageById(args.messages, decision.messageId, decision.text);
4990
+ }
4991
+ }
4959
4992
  const { thinkingBindingRecovery, proactiveThinkingStrip } = applyRustModeThinkingStrips(args, noteNudgeAppended || servedMarkerRecord() !== servedMarkerBefore);
4960
4993
  const marker = getPersistedCompactionMarkerState(args.db, args.sessionId);
4961
4994
  return {
@@ -5814,15 +5847,32 @@ async function runPostTransformPhase2(args) {
5814
5847
  sessionLog2(args.sessionId, "transform failed dropping stale ctx_reduce calls:", error);
5815
5848
  }
5816
5849
  }
5817
- if (canUseEmptySentinels && !compactionOff && replaySnapshot) {
5850
+ if (!compactionOff && replaySnapshot) {
5818
5851
  try {
5819
5852
  const tImg = performance.now();
5853
+ const imageWatermark = canEditWholePrefix ? Math.max(args.watermark, getMaxDroppedTagNumber2(args.db, args.sessionId)) : args.watermark;
5820
5854
  const frozenImageIds = replaySnapshot.processedImageStrippedIds;
5855
+ const frozenMarkers = replaySnapshot.processedImageMarkers;
5856
+ const replacementText = canUseEmptySentinels ? "" : "[image stripped]";
5821
5857
  stripProcessedImages(args.messages, frozenImageIds, {
5822
- detect: canEditWholePrefix && args.watermark > 0,
5823
- watermark: args.watermark,
5858
+ detect: canEditWholePrefix && imageWatermark > 0,
5859
+ watermark: imageWatermark,
5824
5860
  messageTagNumbers: args.messageTagNumbers,
5825
- persistNewIds: (ids) => addProcessedImageStrippedIds(args.db, args.sessionId, ids),
5861
+ protectedCutoff: args.protectedCutoff,
5862
+ contextPercentage: args.contextUsage.percentage,
5863
+ replacementText,
5864
+ frozenMarkers,
5865
+ protectedMessageIds: new Set([
5866
+ ...args.tags.filter((tag) => protectedToolTags.has(tag.tagNumber)).map((tag) => tag.toolOwnerMessageId ?? tag.messageId)
5867
+ ]),
5868
+ persistNewIds: (ids, markers) => {
5869
+ if (!addProcessedImageStrippedIds(args.db, args.sessionId, ids, markers))
5870
+ return false;
5871
+ const committed = getProcessedImageMarkers(args.db, args.sessionId);
5872
+ for (const id of ids)
5873
+ frozenMarkers.set(id, committed.get(id) ?? replacementText);
5874
+ return true;
5875
+ },
5826
5876
  onFirstApplication: recordFirstApplicationAt
5827
5877
  });
5828
5878
  logTransformTiming(args.sessionId, "stripProcessedImages", tImg);
@@ -5950,16 +6000,6 @@ async function runPostTransformPhase2(args) {
5950
6000
  logTransformTiming(args.sessionId, "pp.placeholderNeutralize", tPlaceholder);
5951
6001
  }
5952
6002
  const tNudgeBlock = performance.now();
5953
- if (args.fullFeatureMode && !compactionOff && replaySnapshot) {
5954
- for (const anchor of replaySnapshot.noteNudgeAnchors) {
5955
- appendReminderToUserMessageById(args.messages, anchor.messageId, anchor.text);
5956
- }
5957
- for (const decision of replaySnapshot.autoSearchHintDecisions) {
5958
- if (decision.decision === "hint") {
5959
- appendReminderToUserMessageById(args.messages, decision.messageId, decision.text);
5960
- }
5961
- }
5962
- }
5963
6003
  logTransformTiming(args.sessionId, "pp.nudgeAndSticky", tNudgeBlock);
5964
6004
  const tMarker = performance.now();
5965
6005
  const explicitRebuildHappened = args.historyRefreshExplicitBeforePrepare && args.rebuiltHistoryFromInitialPrepare;
@@ -6035,13 +6075,15 @@ async function runPostTransformPhase2(args) {
6035
6075
  const noteReadStillVisible = args.fullFeatureMode ? hasVisibleNoteReadCall(args.messages) : false;
6036
6076
  let noteNudgeAppendedThisPass = false;
6037
6077
  const noteNudgeUserMessageId = findNoteNudgeUserMessageId(args.messages);
6078
+ const lastServedForNote = canEditWholePrefix && (m0RematerializedThisPass || historyWasConsumedThisPass) ? args.readLastServedMessages?.() : null;
6079
+ const rewrittenHeadCoversNote = !!lastServedForNote && args.messages.slice(0, prependedMessageCount).some((message, index) => isSyntheticHeadMessage2(message) && index < lastServedForNote.length && servedMessageKey(message, args.resolvedProviderID) !== servedMessageKey(lastServedForNote[index], args.resolvedProviderID));
6038
6080
  const noteNudgeEligibility = args.fullFeatureMode ? observeNoteNudgeServe({
6039
6081
  db: args.db,
6040
6082
  sessionId: args.sessionId,
6041
6083
  userMessageIds: args.messages.filter((m) => m.info.role === "user" && typeof m.info.id === "string").map((m) => m.info.id),
6042
6084
  anchorMessageId: noteNudgeUserMessageId,
6043
6085
  isLiveTail: args.messages.at(-1)?.info.id === noteNudgeUserMessageId,
6044
- isCacheBustingPass
6086
+ prefixRewriteCoversAnchor: canEditWholePrefix && rewrittenHeadCoversNote
6045
6087
  }) : undefined;
6046
6088
  const deferredNoteText = args.fullFeatureMode ? peekNoteNudgeText(args.db, args.sessionId, noteNudgeUserMessageId, args.projectPath, noteReadStillVisible, noteNudgeEligibility) : null;
6047
6089
  if (deferredNoteText) {
@@ -6058,6 +6100,16 @@ async function runPostTransformPhase2(args) {
6058
6100
  sessionLog2(args.sessionId, `note-nudge delivery skipped wire append: ${outcome.kind}`);
6059
6101
  }
6060
6102
  }
6103
+ if (args.fullFeatureMode && !compactionOff && replaySnapshot) {
6104
+ for (const anchor of replaySnapshot.noteNudgeAnchors) {
6105
+ appendReminderToUserMessageById(args.messages, anchor.messageId, anchor.text);
6106
+ }
6107
+ for (const decision of replaySnapshot.autoSearchHintDecisions) {
6108
+ if (decision.decision === "hint") {
6109
+ appendReminderToUserMessageById(args.messages, decision.messageId, decision.text);
6110
+ }
6111
+ }
6112
+ }
6061
6113
  let todoAnchorMovedThisPass = false;
6062
6114
  if (args.fullFeatureMode && !compactionOff) {
6063
6115
  const todoAnchorBefore = replaySnapshot ? replaySnapshot.todoSyntheticAnchor : getPersistedTodoSyntheticAnchor(args.db, args.sessionId);
@@ -6541,4 +6593,4 @@ function checkM0MutationDriftAndSignal2(args) {
6541
6593
  return false;
6542
6594
  }
6543
6595
 
6544
- export { createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRideLabel, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, stripStructuralNoise, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
6596
+ export { makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRideLabel, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, stripStructuralNoise, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };