@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
@@ -11,7 +11,7 @@ import {
11
11
  sanitizeDiagnosticText,
12
12
  log2,
13
13
  sessionLog2
14
- } from "./index-nsjyysj0.js";
14
+ } from "./index-mvvephtj.js";
15
15
  import {
16
16
  createScanner,
17
17
  parseTree,
@@ -34,7 +34,7 @@ import {
34
34
  deriveTriggerBudget2,
35
35
  resolveHistorianProducerLimits2,
36
36
  producerSourceLocalBudget2
37
- } from "./index-w23dh319.js";
37
+ } from "./index-jw4gbfkv.js";
38
38
  import {
39
39
  withContentLanguageDirective,
40
40
  buildPrimaryLanguageDirective,
@@ -47,7 +47,7 @@ import {
47
47
  ConfigProfilesSchema,
48
48
  MagicContextConfigSchema,
49
49
  LIVE_RELOAD_CONFIG_PATHS
50
- } from "./index-k6xvbj2e.js";
50
+ } from "./index-w28y7d0z.js";
51
51
  import {
52
52
  providerMass,
53
53
  calibrationForModelKey,
@@ -57,26 +57,28 @@ import {
57
57
  hasMeaningfulUserText2,
58
58
  estimateTokens,
59
59
  estimateFixedPromptTokens
60
- } from "./index-qx53vezw.js";
60
+ } from "./index-gjvjh960.js";
61
61
  import {
62
62
  FAIL_CLOSED_DOCTOR_COMMAND,
63
63
  getSchemaFenceRejection,
64
64
  LATEST_SUPPORTED_VERSION,
65
65
  getPersistedSchemaVersion,
66
66
  openDatabase
67
- } from "./index-besxhcsh.js";
68
- import {
69
- isPidAlive
70
- } from "./index-9m7bn21d.js";
67
+ } from "./index-zf9nydbd.js";
71
68
  import {
69
+ inRootAsyncContext2,
72
70
  Database2,
73
71
  withSqliteBackgroundWriter2,
74
72
  withoutSqliteTransformPass2,
75
73
  beginSqliteWriterAsync2
76
- } from "./index-0nnd4bry.js";
74
+ } from "./index-wafzvyhg.js";
77
75
  import {
78
- sameProjectDirectory
79
- } from "./index-bg5qqene.js";
76
+ shouldSkipHomeProjectMemory,
77
+ resolveProjectIdentity
78
+ } from "./index-0jz47061.js";
79
+ import {
80
+ isPidAlive
81
+ } from "./index-q28hsbpg.js";
80
82
  import {
81
83
  layoutLkgPrefix,
82
84
  assembleLkgPrefix,
@@ -87,10 +89,10 @@ import {
87
89
  resolveStoredPathWorkspaceIdentity,
88
90
  sourceNameForMemory,
89
91
  computeWorkspaceEpochFingerprint
90
- } from "./index-xqyj5c85.js";
92
+ } from "./index-qgp5vnt4.js";
91
93
  import {
92
94
  getTableColumnNames
93
- } from "./index-1bt88epp.js";
95
+ } from "./index-bd9cjab3.js";
94
96
  import {
95
97
  V2_MEMORY_CATEGORIES,
96
98
  CATEGORY_PRIORITY,
@@ -102,13 +104,9 @@ import {
102
104
  openCodeDbPathExists,
103
105
  claimOpenCodeDbDiagnosticOnce
104
106
  } from "./index-58e3y90n.js";
105
- import {
106
- shouldSkipHomeProjectMemory,
107
- resolveProjectIdentity
108
- } from "./index-g9exahnx.js";
109
107
  import {
110
108
  getMeasuredToolDefinitionTokens
111
- } from "./index-h2wc01qk.js";
109
+ } from "./index-8kk7yh6m.js";
112
110
  import {
113
111
  buildCanonicalChunkTextFromFts,
114
112
  buildCompartmentSummaryFallbackText,
@@ -118,7 +116,7 @@ import {
118
116
  replaceCompartmentChunkEmbeddings,
119
117
  deleteChunkEmbedBackoffForSession,
120
118
  chunkWindowSourceKey
121
- } from "./index-j55vn694.js";
119
+ } from "./index-7bjgyaj1.js";
122
120
  import {
123
121
  BoundedSessionMap,
124
122
  clearCompressionDepth,
@@ -133,7 +131,7 @@ import {
133
131
  toMessageIndexSource2,
134
132
  clearIndexedMessagesInTransaction2,
135
133
  indexSourcesAfterOrdinal2
136
- } from "./index-1xaw2pq8.js";
134
+ } from "./index-b4gcb3rk.js";
137
135
  import {
138
136
  retreatPastHostUnservedRows,
139
137
  snapTerminalCompartmentToServedRow,
@@ -198,9 +196,13 @@ import {
198
196
  THINKING_BINDING_STRIP_ORDER_END_MARKER,
199
197
  getMergedReasoningStrippedIds,
200
198
  addMergedReasoningStrippedIds,
199
+ parseProcessedImageMarkers,
200
+ serializeProcessedImageMarkers,
201
201
  getPendingCompactionMarkerState,
202
202
  setPendingCompactionMarkerState,
203
203
  clearPendingCompactionMarkerStateIf,
204
+ getPendingPiCompactionMarkerState,
205
+ logPiCompactionMarkerClear,
204
206
  detectOverflow,
205
207
  resolveHostServedBoundaryId2,
206
208
  hasRawMessageProvider2,
@@ -218,7 +220,7 @@ import {
218
220
  getRawSessionTagKeysThrough2,
219
221
  getLegacyProtectedTailStartOrdinal2,
220
222
  readSessionChunk2
221
- } from "./index-vztbgcdk.js";
223
+ } from "./index-9g1c4bt9.js";
222
224
  import {
223
225
  stripWellFormedLeadingTagPrefix,
224
226
  stripTagPrefix,
@@ -231,15 +233,15 @@ import {
231
233
  foldShrunkPartTags2,
232
234
  getTagNumberByMessageId2,
233
235
  getActiveTagsBySession2
234
- } from "./index-1j8jcjpa.js";
236
+ } from "./index-xpn05jxq.js";
235
237
  import {
236
238
  isStrictGapHealingMessage2,
237
239
  noteRawSessionSummaryRowWritten2
238
- } from "./index-vnjhmkwk.js";
240
+ } from "./index-angx1s0k.js";
239
241
  import {
240
242
  withReadOnlySessionDb,
241
243
  getMessageTimesFromOpenCodeDb
242
- } from "./index-ab3bgm2m.js";
244
+ } from "./index-q76br5zn.js";
243
245
  import {
244
246
  drainBackgroundBatches,
245
247
  contentSha2562,
@@ -247,7 +249,7 @@ import {
247
249
  getProjectChunkEmbeddingModelId2,
248
250
  getProjectEmbeddingMaxInputTokens2,
249
251
  embedItemsForProject2
250
- } from "./index-9s58tq95.js";
252
+ } from "./index-rg1cezmj.js";
251
253
  import {
252
254
  renderUserFacingFailure,
253
255
  userFacingFailureCode,
@@ -256,7 +258,7 @@ import {
256
258
  insertPrimerCandidates,
257
259
  promoteSessionFactsDurable,
258
260
  embedPromotedFacts
259
- } from "./index-s0gsmthp.js";
261
+ } from "./index-ydjgz36f.js";
260
262
  import {
261
263
  pushNotification2
262
264
  } from "./index-x8a7jmkh.js";
@@ -267,16 +269,19 @@ import {
267
269
  getMemoriesByProject2,
268
270
  getMemoriesByProjects2,
269
271
  getMaxMemoryIdForProjects2
270
- } from "./index-cm4hmxyk.js";
272
+ } from "./index-n78avt2p.js";
271
273
  import {
272
274
  isMarkerCandidateBasisCurrent2,
273
275
  invalidateMarkerCandidateBasis2,
274
276
  readMarkerCandidateBasis2,
275
277
  prepareMarkerCandidateBasis2
276
- } from "./index-f3dnvnw6.js";
278
+ } from "./index-s178h9z8.js";
277
279
  import {
278
280
  sendStatusNotification2
279
- } from "./index-hr64sth2.js";
281
+ } from "./index-pgy3h49n.js";
282
+ import {
283
+ sameProjectDirectory
284
+ } from "./index-knvkbfvh.js";
280
285
  import {
281
286
  getErrorMessage,
282
287
  describeError
@@ -294,7 +299,7 @@ import {
294
299
  import {
295
300
  logSlowWriteTransaction,
296
301
  WriteTransactionSteps
297
- } from "./index-4mjhqadz.js";
302
+ } from "./index-150zz6fh.js";
298
303
 
299
304
  // src/agents/permissions.ts
300
305
  function buildAllowOnlyPermission(allowedTools, agentLabel) {
@@ -5031,7 +5036,7 @@ var V2_MESSAGE_PAGE_SQL = `WITH bounds AS (
5031
5036
  SELECT seq FROM session_message
5032
5037
  WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
5033
5038
  ORDER BY seq ASC LIMIT 1 OFFSET ?
5034
- ), -1) END AS after_seq,
5039
+ ), (SELECT MAX(seq) FROM session_message WHERE session_id = ?), -1) END AS after_seq,
5035
5040
  COALESCE((
5036
5041
  SELECT seq FROM session_message
5037
5042
  WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
@@ -5292,7 +5297,7 @@ class V2StoreReader {
5292
5297
  }
5293
5298
  }
5294
5299
  const maximumSeq = Number.MAX_SAFE_INTEGER;
5295
- const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
5300
+ const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
5296
5301
  return rows.map(decode);
5297
5302
  });
5298
5303
  }
@@ -5806,13 +5811,17 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
5806
5811
  function clearSession(db, sessionId, rustModuleCleanupAcknowledged = false, permanentlyDeleted = false) {
5807
5812
  cancelAutoSearchWork(sessionId);
5808
5813
  let transactionStartedAt = 0;
5814
+ let clearedMarker = null;
5809
5815
  withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(() => db.transaction(() => {
5810
5816
  transactionStartedAt = performance.now();
5817
+ clearedMarker = getPendingPiCompactionMarkerState(db, sessionId);
5811
5818
  deleteSessionScopedRows(db, [sessionId], undefined, {
5812
5819
  rustModuleCleanupAcknowledged,
5813
5820
  preserveTagRevisionTombstones: !permanentlyDeleted
5814
5821
  });
5815
5822
  }).immediate()));
5823
+ if (clearedMarker)
5824
+ logPiCompactionMarkerClear(sessionId, clearedMarker, "session-reset");
5816
5825
  clearUnpublishedAutoSearchNoHints(sessionId);
5817
5826
  logSlowWriteTransaction("clear-session", transactionStartedAt);
5818
5827
  }
@@ -6202,6 +6211,9 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
6202
6211
  }
6203
6212
  const layout = layoutLkgPrefix(slot.jsonPrefix);
6204
6213
  try {
6214
+ const inputIdSeq = JSON.stringify(slot.piOutputEntryIds ? { version: 1, inputIds: slot.inputIdSeq, piOutputEntryIds: slot.piOutputEntryIds } : slot.inputIdSeq);
6215
+ const inputContentDigests = JSON.stringify(slot.inputContentDigests);
6216
+ const inputContentSignatures = slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null;
6205
6217
  db.transaction(() => {
6206
6218
  const storedHashes = new Map;
6207
6219
  for (const row of db.prepare("SELECT chunk, hash FROM lkg_slot_chunks WHERE session_id = ?").all(sessionId)) {
@@ -6233,11 +6245,7 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
6233
6245
  provider_key = excluded.provider_key,
6234
6246
  captured_at = excluded.captured_at,
6235
6247
  row_version = excluded.row_version,
6236
- capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, JSON.stringify(slot.piOutputEntryIds ? {
6237
- version: 1,
6238
- inputIds: slot.inputIdSeq,
6239
- piOutputEntryIds: slot.piOutputEntryIds
6240
- } : slot.inputIdSeq), JSON.stringify(slot.inputContentDigests), slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
6248
+ capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, inputIdSeq, inputContentDigests, inputContentSignatures, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
6241
6249
  publishMetadata?.();
6242
6250
  }).immediate();
6243
6251
  rememberFingerprint(db, sessionId, fingerprint);
@@ -8162,6 +8170,9 @@ function filterIdBlob(raw, filter) {
8162
8170
  return "";
8163
8171
  }
8164
8172
  }
8173
+ function filterProcessedImageBlob(raw, filter) {
8174
+ return serializeProcessedImageMarkers(new Map([...parseProcessedImageMarkers(raw)].filter(([id]) => filter.includeMessageId(id)).map(([id, marker]) => [mapMessageId(filter, id) ?? id, marker])));
8175
+ }
8165
8176
  function filterStrippedPlaceholderBlob(raw, filter) {
8166
8177
  const state = parseStrippedPlaceholderState(raw);
8167
8178
  const keep = (ids) => ids.filter((id) => filter.includeMessageId(id)).map((id) => mapMessageId(filter, id) ?? id);
@@ -8243,7 +8254,8 @@ function clampWatermark(value, maxCopiedTag) {
8243
8254
  return Math.min(Math.floor(value), maxCopiedTag);
8244
8255
  }
8245
8256
  function copySessionStateForClone(db, sourceSessionId, destinationSessionId, filter) {
8246
- return runImmediate(db, () => {
8257
+ let clearedMarker = null;
8258
+ const result = runImmediate(db, () => {
8247
8259
  const hasTemporalDecisions = tableExists(db, "temporal_decisions");
8248
8260
  if (filter.requireEmptyDestinationMeta === true && countRows(db, "session_meta", destinationSessionId) > 0 || countRows(db, "compartments", destinationSessionId) > 0 || countRows(db, "tags", destinationSessionId) > 0 || hasTemporalDecisions && countRows(db, "temporal_decisions", destinationSessionId) > 0 || filter.copySessionNotesAndFacts === true && (tableExists(db, "notes") && countRows(db, "notes", destinationSessionId) > 0 || tableExists(db, "session_facts") && countRows(db, "session_facts", destinationSessionId) > 0)) {
8249
8261
  return {
@@ -8355,6 +8367,8 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
8355
8367
  FROM session_meta WHERE session_id = ?`).get(sourceSessionId);
8356
8368
  const maxCopiedTag = copiedTagNumbers.reduce((max, value) => Math.max(max, value), 0);
8357
8369
  const pendingMarker = filter.selectPendingPiMarker(meta?.pending_pi_compaction_marker_state ?? null, copiedCompartments);
8370
+ if (pendingMarker === null)
8371
+ clearedMarker = getPendingPiCompactionMarkerState(db, destinationSessionId);
8358
8372
  const todoAnchor = meta?.todo_synthetic_anchor_message_id ?? "";
8359
8373
  const migrateTodo = todoAnchor.length > 0 && filter.includeMessageId(todoAnchor);
8360
8374
  db.prepare(`INSERT INTO session_meta
@@ -8381,7 +8395,7 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
8381
8395
  todo_synthetic_anchor_message_id = excluded.todo_synthetic_anchor_message_id,
8382
8396
  todo_synthetic_state_json = excluded.todo_synthetic_state_json,
8383
8397
  cached_m0_bytes = NULL,
8384
- cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter), filterIdBlob(meta?.processed_image_stripped_ids ?? null, filter), clonePiContentDecisions(meta?.merged_reasoning_stripped_ids ?? null, filter), pendingMarker, migrateTodo ? meta?.last_todo_state ?? "" : "", migrateTodo ? meta?.todo_synthetic_call_id ?? "" : "", migrateTodo ? mapMessageId(filter, todoAnchor) ?? "" : "", migrateTodo ? meta?.todo_synthetic_state_json ?? "" : "");
8398
+ cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter), filterProcessedImageBlob(meta?.processed_image_stripped_ids ?? null, filter), clonePiContentDecisions(meta?.merged_reasoning_stripped_ids ?? null, filter), pendingMarker, migrateTodo ? meta?.last_todo_state ?? "" : "", migrateTodo ? meta?.todo_synthetic_call_id ?? "" : "", migrateTodo ? mapMessageId(filter, todoAnchor) ?? "" : "", migrateTodo ? meta?.todo_synthetic_state_json ?? "" : "");
8385
8399
  const metaColumnRows = db.prepare("PRAGMA table_info(session_meta)").all();
8386
8400
  const metaColumns = new Set(metaColumnRows.map((column) => column.name));
8387
8401
  if (metaColumns.has("trailing_blank_decisions")) {
@@ -8399,6 +8413,9 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
8399
8413
  pendingMarkerMigrated: pendingMarker !== null
8400
8414
  };
8401
8415
  });
8416
+ if (clearedMarker)
8417
+ logPiCompactionMarkerClear(destinationSessionId, clearedMarker, "clone-replaced");
8418
+ return result;
8402
8419
  }
8403
8420
  // src/features/magic-context/historian-failure-reason.ts
8404
8421
  var MAX_HISTORIAN_FAILURE_REASON_LENGTH = 512;
@@ -11770,7 +11787,7 @@ function parseUserMemoryRow(row) {
11770
11787
 
11771
11788
  // src/features/magic-context/compaction-marker.ts
11772
11789
  import { createHash as createHash10 } from "node:crypto";
11773
- import { existsSync as existsSync6 } from "node:fs";
11790
+ import { existsSync as existsSync6, statSync as statSync7 } from "node:fs";
11774
11791
  var BASE62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
11775
11792
  var ID_PREFIX_HEX_LENGTH = 12;
11776
11793
  var ID_SUFFIX_LENGTH = 14;
@@ -11808,6 +11825,7 @@ function runMarkerRemovalTransaction(db, operation) {
11808
11825
  function runMarkerWriteTransaction(db, site, operation) {
11809
11826
  if (db.inTransaction)
11810
11827
  return db.transaction(operation).immediate();
11828
+ const walBefore = markerWalPages(db);
11811
11829
  const startedAt = performance.now();
11812
11830
  let acquiredAt;
11813
11831
  let workFinishedAt;
@@ -11831,9 +11849,22 @@ function runMarkerWriteTransaction(db, site, operation) {
11831
11849
  const endMs = workFinishedAt === undefined ? 0 : finishedAt - workFinishedAt;
11832
11850
  try {
11833
11851
  log2(`[magic-context] sqlite writer site=${site} db=opencode acquire_ms=${Math.round(acquireMs)} hold_ms=${Math.round(holdMs)} work_ms=${Math.round(workMs)} end_ms=${Math.round(endMs)} outcome=${acquiredAt === undefined ? "not_acquired" : committed ? "committed" : "failed"}`);
11852
+ if (finishedAt - startedAt > 100) {
11853
+ const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").get();
11854
+ log2(`[magic-context] compaction-marker slow writer site=${site} acquire_ms=${acquireMs.toFixed(1)} statements_ms=${workMs.toFixed(1)} ${committed ? "commit" : "rollback"}_ms=${endMs.toFixed(1)} wal_autocheckpoint=${autoCheckpoint.wal_autocheckpoint} wal_pages_before=${walBefore ?? "unknown"} wal_pages_after=${markerWalPages(db) ?? "unknown"}`);
11855
+ }
11834
11856
  } catch {}
11835
11857
  }
11836
11858
  }
11859
+ function markerWalPages(db) {
11860
+ try {
11861
+ const row = db.prepare("PRAGMA page_size").get();
11862
+ const bytes = statSync7(`${getOpenCodeDbPath()}-wal`).size;
11863
+ return Math.max(0, Math.floor((bytes - 32) / (row.page_size + 24)));
11864
+ } catch {
11865
+ return null;
11866
+ }
11867
+ }
11837
11868
  var REQUIRED_MESSAGE_COLUMNS = ["id", "session_id", "time_created", "time_updated", "data"];
11838
11869
  var REQUIRED_PART_COLUMNS = [
11839
11870
  "id",
@@ -11894,6 +11925,7 @@ function getWritableOpenCodeDb(purpose = "publication") {
11894
11925
  const timeoutMs = purpose === "removal" ? MARKER_REMOVAL_BUSY_TIMEOUT_MS : MARKER_BUSY_TIMEOUT_MS;
11895
11926
  db.exec(`PRAGMA busy_timeout=${timeoutMs}`);
11896
11927
  db.exec("PRAGMA journal_mode=WAL");
11928
+ db.exec("PRAGMA wal_autocheckpoint=0");
11897
11929
  if (purpose === "removal")
11898
11930
  cachedRemovalDb = { path: dbPath, db };
11899
11931
  else
@@ -15149,6 +15181,37 @@ function capturePrefixTrimSourceOrder(messages) {
15149
15181
  invalidReason
15150
15182
  });
15151
15183
  }
15184
+ function reanchorStoredBoundary(options, boundary) {
15185
+ if (!options.messages)
15186
+ return;
15187
+ const source = options.prefixTrimSourceOrder ?? capturePrefixTrimSourceOrder(options.messages);
15188
+ if (source.invalidReason)
15189
+ return;
15190
+ try {
15191
+ if (compareRawSessionMessageOrder2(options.sessionId, boundary, boundary) !== 0)
15192
+ return;
15193
+ const messageIds = [...source.messageIds];
15194
+ let previous;
15195
+ let insertion = messageIds.length;
15196
+ for (const [index, id] of messageIds.entries()) {
15197
+ if (previous) {
15198
+ const increasing = compareRawSessionMessageOrder2(options.sessionId, previous, id);
15199
+ if (increasing === null || !Number.isFinite(increasing) || increasing >= 0)
15200
+ return;
15201
+ }
15202
+ const order = compareRawSessionMessageOrder2(options.sessionId, boundary, id);
15203
+ if (order === null || !Number.isFinite(order) || order === 0)
15204
+ return;
15205
+ if (order < 0 && insertion === messageIds.length)
15206
+ insertion = index;
15207
+ previous = id;
15208
+ }
15209
+ messageIds.splice(insertion, 0, boundary);
15210
+ return { ...source, messageIds };
15211
+ } catch {
15212
+ return;
15213
+ }
15214
+ }
15152
15215
  function trimToPreparedPrefix(options, prepared) {
15153
15216
  if (options.compactionOff || !options.messages)
15154
15217
  return "not-attempted";
@@ -15173,7 +15236,8 @@ function trimToPreparedPrefix(options, prepared) {
15173
15236
  });
15174
15237
  const boundaryPosition = sourcePosition.get(boundary) ?? sourcePosition.get(resolveHostServedBoundaryId2(options.sessionId, boundary));
15175
15238
  if (boundaryPosition === undefined) {
15176
- status = refuse("boundary absent from immutable source order");
15239
+ const reanchored = reanchorStoredBoundary(options, boundary);
15240
+ status = reanchored ? trimToPreparedPrefix({ ...options, prefixTrimSourceOrder: reanchored }, prepared) : refuse("boundary absent from immutable source order");
15177
15241
  } else {
15178
15242
  let lastSourcePosition = -1;
15179
15243
  let sawPersistedRow = false;
@@ -15184,8 +15248,7 @@ function trimToPreparedPrefix(options, prepared) {
15184
15248
  for (const [index, message] of options.messages.entries()) {
15185
15249
  const id = message.info.id;
15186
15250
  if (isHostRenderedSystemMessage(message)) {
15187
- if (lastSourcePosition >= boundaryPosition)
15188
- retained.push(message);
15251
+ retained.push(message);
15189
15252
  continue;
15190
15253
  }
15191
15254
  if (typeof id !== "string" || id.length === 0) {
@@ -15228,12 +15291,19 @@ function trimToPreparedPrefix(options, prepared) {
15228
15291
  } else {
15229
15292
  const index = findBoundaryIndex(options.sessionId, options.messages, boundary);
15230
15293
  if (index >= 0) {
15231
- const removed = options.messages.splice(0, index + (isPartialCompartmentEnd(options.db, options.sessionId, boundary) ? 0 : 1));
15294
+ const cut = index + (isPartialCompartmentEnd(options.db, options.sessionId, boundary) ? 0 : 1);
15295
+ const unplaced = options.messages.slice(0, cut).filter(isHostRenderedSystemMessage);
15296
+ const removed = options.messages.splice(0, cut, ...unplaced);
15232
15297
  retireDecisions(removed.map((message) => message.info.id).filter((id) => typeof id === "string"));
15233
15298
  resetPrefixTrimFallbackState(options.sessionId);
15234
15299
  status = "applied";
15235
15300
  } else {
15236
- status = classifyAbsentBoundary(options, options.messages, boundary);
15301
+ const reanchored = reanchorStoredBoundary(options, boundary);
15302
+ if (reanchored && reanchored.messageIds[0] !== boundary) {
15303
+ status = trimToPreparedPrefix({ ...options, prefixTrimSourceOrder: reanchored }, prepared);
15304
+ } else {
15305
+ status = classifyAbsentBoundary(options, options.messages, boundary);
15306
+ }
15237
15307
  }
15238
15308
  }
15239
15309
  }
@@ -18958,7 +19028,7 @@ function observeNoteNudgeServe(args) {
18958
19028
  sessions.set(args.sessionId, seen);
18959
19029
  return {
18960
19030
  isFirstServe: warm && args.isLiveTail && firstServe,
18961
- isCacheBustingPass: args.anchorMessageId !== null && args.isCacheBustingPass
19031
+ prefixRewriteCoversAnchor: args.anchorMessageId !== null && args.prefixRewriteCoversAnchor
18962
19032
  };
18963
19033
  }
18964
19034
  var NOTE_NUDGE_COOLDOWN_MS = 15 * 60 * 1000;
@@ -18997,7 +19067,7 @@ function peekNoteNudgeText(db, sessionId, currentUserMessageId, projectIdentity,
18997
19067
  const state = getPersistedNoteNudge(db, sessionId);
18998
19068
  if (!state.triggerPending)
18999
19069
  return null;
19000
- if (eligibility && !eligibility.isFirstServe && !eligibility.isCacheBustingPass) {
19070
+ if (eligibility && !eligibility.isFirstServe && !eligibility.prefixRewriteCoversAnchor) {
19001
19071
  sessionLog2(sessionId, "note-nudge: deferring — user already served or first serve unproven");
19002
19072
  return null;
19003
19073
  }
@@ -20869,6 +20939,7 @@ Historian pass ${passCount + 1}, attempt ${passAttempt} started for messages ${c
20869
20939
  sequenceOffset: candidateCompartments.length,
20870
20940
  dumpLabelBase: `recomp-${sessionId}-${chunk.startIndex}-${chunk.endIndex}-pass-${passCount + 1}`,
20871
20941
  timeoutMs: historianTimeoutMs,
20942
+ maxOutputTokens: deps.historianMaxOutputTokens,
20872
20943
  model: deps.model,
20873
20944
  fallbackModelId: deps.fallbackModelId,
20874
20945
  fallbackModels: deps.fallbackModels,
@@ -21383,7 +21454,6 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
21383
21454
  }
21384
21455
  }
21385
21456
  }
21386
-
21387
21457
  // src/hooks/magic-context/compartment-runner.ts
21388
21458
  var activeRuns = new Map;
21389
21459
  function getActiveCompartmentRun(sessionId) {
@@ -21419,7 +21489,7 @@ function withPublishedCallback(deps) {
21419
21489
  };
21420
21490
  }
21421
21491
  function startLeaseRenewal(deps, holderId) {
21422
- return setInterval(() => {
21492
+ return inRootAsyncContext2(() => setInterval(() => {
21423
21493
  try {
21424
21494
  if (!renewCompartmentLease(deps.db, deps.sessionId, holderId)) {
21425
21495
  sessionLog2(deps.sessionId, "compartment lease renewal failed; publish will be skipped if holder is stale");
@@ -21427,7 +21497,7 @@ function startLeaseRenewal(deps, holderId) {
21427
21497
  } catch (err) {
21428
21498
  sessionLog2(deps.sessionId, `compartment lease renewal threw; publish will be skipped if holder is stale (${err instanceof Error ? err.message : String(err)})`);
21429
21499
  }
21430
- }, COMPARTMENT_LEASE_RENEWAL_MS);
21500
+ }, COMPARTMENT_LEASE_RENEWAL_MS));
21431
21501
  }
21432
21502
  function startCompartmentAgent(deps, runAgent = runCompartmentAgent, prepareBoundary) {
21433
21503
  withoutSqliteTransformPass2(() => startBackgroundCompartmentAgent(deps, runAgent, prepareBoundary));
@@ -21563,4 +21633,4 @@ async function executeContextRecomp(deps, options = {}) {
21563
21633
  return (await executeContextRecompWithResult(deps, options)).message;
21564
21634
  }
21565
21635
 
21566
- export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, COMPACTION_ENABLED_PATH, isDreamerRunnable, isHistorianRunnable, isCompactionEnabled, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, embedPauseBySession, embedRunStateBySession, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, clearEmbedSessionState, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, registerLkgPersistence, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
21636
+ export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, COMPACTION_ENABLED_PATH, isDreamerRunnable, isHistorianRunnable, isCompactionEnabled, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, embedPauseBySession, embedRunStateBySession, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, clearEmbedSessionState, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, registerLkgPersistence, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  log2,
9
9
  sessionLog2
10
- } from "./index-nsjyysj0.js";
10
+ } from "./index-mvvephtj.js";
11
11
  import {
12
12
  localBudget,
13
13
  calibrationForModelKey
@@ -0,0 +1,25 @@
1
+ // src/shared/project-directory-key.ts
2
+ import { realpathSync } from "node:fs";
3
+ import path from "node:path";
4
+ function projectDirectoryKey(directory) {
5
+ const slashed = directory.replaceAll("\\", "/").replace(/^\/\/\?\/UNC\//i, "//").replace(/^\/\/\?\//, "");
6
+ if (/^[a-z]:\//i.test(slashed) || slashed.startsWith("//")) {
7
+ return path.win32.normalize(slashed).replaceAll("\\", "/").replace(/\/$/, "").toLowerCase();
8
+ }
9
+ return path.resolve(directory);
10
+ }
11
+ function sameProjectDirectory(a, b) {
12
+ if (a.length === 0 || b.length === 0)
13
+ return false;
14
+ return projectDirectoryKey(a) === projectDirectoryKey(b);
15
+ }
16
+ var realpathForCanonicalDirectory = (directory) => realpathSync.native(directory);
17
+ function canonicalProjectDirectory(directory) {
18
+ let resolved = directory;
19
+ try {
20
+ resolved = realpathForCanonicalDirectory(directory);
21
+ } catch {}
22
+ return projectDirectoryKey(resolved);
23
+ }
24
+
25
+ export { projectDirectoryKey, sameProjectDirectory, canonicalProjectDirectory };
@@ -1,12 +1,15 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-qx53vezw.js";
3
+ } from "./index-gjvjh960.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./index-pavzsdc6.js";
7
7
  import {
8
8
  log2
9
- } from "./index-nsjyysj0.js";
9
+ } from "./index-mvvephtj.js";
10
+ import {
11
+ inRootAsyncContext2
12
+ } from "./index-wafzvyhg.js";
10
13
 
11
14
  // ../../node_modules/.bun/@cortexkit+subc-client@0.11.1/node_modules/@cortexkit/subc-client/dist/client.js
12
15
  import { promises as fs2 } from "node:fs";
@@ -1919,7 +1922,7 @@ async function getSharedClient(options) {
1919
1922
  if (sharedClientPromise && sharedClientFile === options.connectionFile)
1920
1923
  return sharedClientPromise;
1921
1924
  sharedClientFile = options.connectionFile;
1922
- sharedClientPromise = SubcClient.connect({ connectionFile: options.connectionFile }).then((client) => {
1925
+ sharedClientPromise = inRootAsyncContext2(() => SubcClient.connect({ connectionFile: options.connectionFile })).then((client) => {
1923
1926
  sharedClient = client;
1924
1927
  return client;
1925
1928
  });
@@ -1,34 +1,10 @@
1
1
  import {
2
2
  withSqliteBackgroundWriter2,
3
3
  withoutSqliteTransformPass2
4
- } from "./index-0nnd4bry.js";
4
+ } from "./index-wafzvyhg.js";
5
5
  import {
6
6
  logSlowWriteTransaction
7
- } from "./index-4mjhqadz.js";
8
-
9
- // src/shared/project-directory-key.ts
10
- import { realpathSync } from "node:fs";
11
- import path from "node:path";
12
- function projectDirectoryKey(directory) {
13
- const slashed = directory.replaceAll("\\", "/").replace(/^\/\/\?\/UNC\//i, "//").replace(/^\/\/\?\//, "");
14
- if (/^[a-z]:\//i.test(slashed) || slashed.startsWith("//")) {
15
- return path.win32.normalize(slashed).replaceAll("\\", "/").replace(/\/$/, "").toLowerCase();
16
- }
17
- return path.resolve(directory);
18
- }
19
- function sameProjectDirectory(a, b) {
20
- if (a.length === 0 || b.length === 0)
21
- return false;
22
- return projectDirectoryKey(a) === projectDirectoryKey(b);
23
- }
24
- var realpathForCanonicalDirectory = (directory) => realpathSync.native(directory);
25
- function canonicalProjectDirectory(directory) {
26
- let resolved = directory;
27
- try {
28
- resolved = realpathForCanonicalDirectory(directory);
29
- } catch {}
30
- return projectDirectoryKey(resolved);
31
- }
7
+ } from "./index-150zz6fh.js";
32
8
 
33
9
  // src/features/magic-context/message-fts-rowid-map.ts
34
10
  import { createHash } from "node:crypto";
@@ -192,4 +168,4 @@ function deleteUnmappedMessageFtsRows(db, sessionIds) {
192
168
  WHERE rowid > ? AND session_id IN (${placeholders})`).run(state.watermarkRowid, ...sessionIds);
193
169
  }
194
170
 
195
- export { projectDirectoryKey, sameProjectDirectory, canonicalProjectDirectory, recordMessageFtsRowid, recordIndexedMessageTime, startMessageFtsRowidMapBackfill, messageFtsOrdinalRangeIsMapped, deleteUnmappedMessageFtsRows };
171
+ export { recordMessageFtsRowid, recordIndexedMessageTime, startMessageFtsRowidMapBackfill, messageFtsOrdinalRangeIsMapped, deleteUnmappedMessageFtsRows };
@@ -125,7 +125,7 @@ var SECRET_TEXT_PATTERNS = [
125
125
  replacement: "<GITHUB_PAT_REDACTED>"
126
126
  },
127
127
  {
128
- pattern: /\b(?:gh[opsu]|ghr)_[A-Za-z0-9]{30,}/g,
128
+ pattern: /\b(?:gh[opsu]|ghr)_[A-Za-z0-9_-]{30,}/g,
129
129
  replacement: "<GITHUB_TOKEN_REDACTED>"
130
130
  },
131
131
  {
@@ -156,6 +156,10 @@ var SECRET_TEXT_PATTERNS = [
156
156
  pattern: /\b((?:x-)?(?:api-?key|api-?token|auth-?token|access-?token)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
157
157
  replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:api_key>`
158
158
  },
159
+ {
160
+ pattern: /\b((?:api[_-]?key|client[_-]?secret|access[_-]?token|token|secret|password|passwd|pwd)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
161
+ replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:credential>`
162
+ },
159
163
  {
160
164
  pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:)([^\s/@]+)(@)/gi,
161
165
  replacement: (_full, prefix, _password, at) => `${prefix}<REDACTED:password>${at}`
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withPrivilegedWriter2
3
- } from "./index-0nnd4bry.js";
3
+ } from "./index-wafzvyhg.js";
4
4
  import {
5
5
  MEMORY_CATEGORY_ORDER_SQL
6
6
  } from "./index-fr0wbhdn.js";