@cortexkit/opencode-magic-context 0.49.93 → 0.49.96

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 (256) hide show
  1. package/dist/{announcement-4ynkaf0d.js → announcement-8nj2jd87.js} +5 -5
  2. package/dist/auto-search-worker.js +5 -5
  3. package/dist/chunk-embedding-write-worker.js +16 -16
  4. package/dist/{compaction-marker-candidates-1ndjqh9k.js → compaction-marker-candidates-a4b0anvv.js} +3 -3
  5. package/dist/compaction-marker-candidates-worker.js +1 -1
  6. package/dist/{compartment-chunk-embedding-rp4asvk0.js → compartment-chunk-embedding-re2cw7y3.js} +8 -8
  7. package/dist/config/removed-agent-config.d.ts +1 -1
  8. package/dist/config/removed-agent-config.d.ts.map +1 -1
  9. package/dist/config/schema/magic-context.d.ts +0 -75
  10. package/dist/config/schema/magic-context.d.ts.map +1 -1
  11. package/dist/{conflict-warning-hook-exf96bpt.js → conflict-warning-hook-wcq55y61.js} +8 -8
  12. package/dist/{context-jpxthqxg.js → context-gtjdrp8f.js} +237 -140
  13. package/dist/{derive-budgets-hzzq71rm.js → derive-budgets-g1sy72e8.js} +5 -5
  14. package/dist/embedding-backfill-pdymqbnh.js +29 -0
  15. package/dist/embedding-worker-process.js +2 -2
  16. package/dist/embedding-worker.js +8 -8
  17. package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
  18. package/dist/features/magic-context/dreamer/docs-proposals.d.ts +5 -2
  19. package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
  20. package/dist/features/magic-context/dreamer/token-budget.d.ts +2 -2
  21. package/dist/features/magic-context/dreamer/token-budget.d.ts.map +1 -1
  22. package/dist/features/magic-context/history-gap-recovery.d.ts +42 -0
  23. package/dist/features/magic-context/history-gap-recovery.d.ts.map +1 -0
  24. package/dist/features/magic-context/memory/embedding-synapse.d.ts +18 -5
  25. package/dist/features/magic-context/memory/embedding-synapse.d.ts.map +1 -1
  26. package/dist/features/magic-context/message-visibility.d.ts +10 -0
  27. package/dist/features/magic-context/message-visibility.d.ts.map +1 -0
  28. package/dist/features/magic-context/search-rerank.d.ts +2 -2
  29. package/dist/features/magic-context/search-rerank.d.ts.map +1 -1
  30. package/dist/features/magic-context/search.d.ts +4 -0
  31. package/dist/features/magic-context/search.d.ts.map +1 -1
  32. package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -1
  33. package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
  34. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
  35. package/dist/{history-owner-xqfsvf9k.js → history-owner-74826t4n.js} +3 -3
  36. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
  38. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/history-boundary-repair.d.ts +2 -2
  40. package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/inject-compartments.d.ts +6 -1
  43. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  44. package/dist/hooks/magic-context/lkg-persist.d.ts +3 -1
  45. package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +1 -0
  47. package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/lkg-replay.d.ts +3 -0
  49. package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
  51. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts +4 -0
  53. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +2 -0
  55. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -1
  57. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  58. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
  59. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  60. package/dist/hooks/magic-context/transform-stage-logger.d.ts +6 -0
  61. package/dist/hooks/magic-context/transform-stage-logger.d.ts.map +1 -1
  62. package/dist/hooks/magic-context/transform.d.ts +2 -0
  63. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  64. package/dist/{index-5zrzg8r1.js → index-0bjj9yf3.js} +2 -2
  65. package/dist/{index-g9qtxv87.js → index-0sqhg9nf.js} +132 -64
  66. package/dist/{index-nxxzeq4y.js → index-0ve29s6f.js} +1 -1
  67. package/dist/{index-g6y2wk32.js → index-2afrmgy3.js} +6 -6
  68. package/dist/{index-ywrz4wy2.js → index-3fhb0j32.js} +1 -1
  69. package/dist/{index-gqf8r04r.js → index-3n4j5rqc.js} +1 -1
  70. package/dist/{index-xsqw8kbd.js → index-45qgkg8j.js} +2 -2
  71. package/dist/{index-5df2fw5b.js → index-6mryx739.js} +1 -1
  72. package/dist/{index-n9kd68vc.js → index-7m2tnk8q.js} +10 -10
  73. package/dist/{index-r4y0dczp.js → index-7sdns2ww.js} +2 -2
  74. package/dist/{index-mjy2k9jr.js → index-880a24vd.js} +1 -1
  75. package/dist/{index-pnawfv4e.js → index-89bkkgcn.js} +4 -4
  76. package/dist/{index-s32f8y67.js → index-89xg64wb.js} +2 -2
  77. package/dist/{index-hee64h6k.js → index-8sgv96kq.js} +7 -7
  78. package/dist/{index-ttdk2w0z.js → index-910gahfb.js} +6 -6
  79. package/dist/{index-kty5k23y.js → index-9jvxq5rt.js} +4 -4
  80. package/dist/{index-832w615x.js → index-azkfw78y.js} +1 -1
  81. package/dist/{index-wh9fxds5.js → index-c205x7xd.js} +1 -1
  82. package/dist/{index-mg9s2rc3.js → index-cpbr0xvk.js} +2 -2
  83. package/dist/{index-g5c67kay.js → index-cq8znmyw.js} +17 -17
  84. package/dist/{index-cr483vx6.js → index-dj64gzg5.js} +2 -2
  85. package/dist/{index-jba6ny4m.js → index-dnpcv1rg.js} +4 -4
  86. package/dist/{index-z4p0ry94.js → index-dt7cyqfe.js} +2 -1
  87. package/dist/{index-j2w79s9r.js → index-e6ay1gez.js} +2 -2
  88. package/dist/{index-y2vshk67.js → index-f154w8m4.js} +229 -84
  89. package/dist/{index-6r99v53h.js → index-fgw241hh.js} +164 -62
  90. package/dist/{index-rz47hf2m.js → index-fvfnq8n6.js} +30 -14
  91. package/dist/{index-yqha238s.js → index-gnrwgvn7.js} +127 -17
  92. package/dist/{index-fpjnjxyx.js → index-h7kta6cn.js} +3 -3
  93. package/dist/{index-q7q6qp1f.js → index-hedgz8an.js} +1 -1
  94. package/dist/{index-5pgyqgmx.js → index-hj78hvhm.js} +2 -2
  95. package/dist/{index-dr6bd4c8.js → index-hp46xe93.js} +7 -7
  96. package/dist/{index-0twg41mh.js → index-j4dcjb8t.js} +4 -4
  97. package/dist/{index-e6ncz7a6.js → index-jzrvdqb8.js} +1 -1
  98. package/dist/{index-sp5pvs95.js → index-k34hc455.js} +2 -2
  99. package/dist/{index-9ffntwyr.js → index-kj4bprep.js} +4 -4
  100. package/dist/index-mgy7g740.js +119 -0
  101. package/dist/{index-za1yx1m4.js → index-nqdwpdje.js} +154 -32
  102. package/dist/{index-hes3k87g.js → index-r1d45dsr.js} +4 -4
  103. package/dist/{index-y915t3ey.js → index-r3f85n7y.js} +5 -1
  104. package/dist/{index-1kem0xxx.js → index-t2e10rag.js} +5 -5
  105. package/dist/{index-m0pwswv9.js → index-tqtpgnhr.js} +1 -1
  106. package/dist/{index-01h7tqe3.js → index-tr4ep2ej.js} +21 -6
  107. package/dist/{index-xr1t0fxb.js → index-w7n7qkpf.js} +49 -13
  108. package/dist/{index-s7460efs.js → index-zfx7mtqa.js} +1 -1
  109. package/dist/{index-gqfy38m9.js → index-zkjx8gq3.js} +11 -11
  110. package/dist/{index-et39x9k3.js → index-zmgp0tr6.js} +3 -3
  111. package/dist/index.js +59 -56
  112. package/dist/{logger-d7c8akh9.js → logger-nmb2508f.js} +2 -2
  113. package/dist/{message-fts-rowid-map-0xx8ge09.js → message-fts-rowid-map-vcatdan0.js} +5 -5
  114. package/dist/{message-index-bounded-vjrnptar.js → message-index-bounded-abhwe610.js} +12 -12
  115. package/dist/{message-time-backfill-pz5981mf.js → message-time-backfill-zc5rsvhv.js} +3 -3
  116. package/dist/migration-worker.js +13 -13
  117. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  118. package/dist/{project-embedding-registry-m8zcmrsg.js → project-embedding-registry-e566q4bg.js} +15 -15
  119. package/dist/raw-ordinal-warmup-worker.js +9 -9
  120. package/dist/{read-session-chunk-zkzdc0e5.js → read-session-chunk-sde0wym3.js} +10 -10
  121. package/dist/{read-session-raw-3sc9231y.js → read-session-raw-trhdgc9z.js} +3 -3
  122. package/dist/recomp-orchestrator-d3rbpa59.js +69 -0
  123. package/dist/render-6cf1dgc4.js +43 -0
  124. package/dist/{safe-notification-target-d21swr3n.js → safe-notification-target-54ns7dv9.js} +3 -3
  125. package/dist/{search-e9bb9hpx.js → search-11aw8wpq.js} +27 -27
  126. package/dist/search-archive-s9m5szf0.js +29 -0
  127. package/dist/{send-session-notification-0779tyd9.js → send-session-notification-gxrj4w1r.js} +6 -6
  128. package/dist/shared/host-sqlite-runtime.d.ts +3 -0
  129. package/dist/shared/host-sqlite-runtime.d.ts.map +1 -0
  130. package/dist/shared/redaction.d.ts.map +1 -1
  131. package/dist/shared/storage-file-mutex.d.ts.map +1 -1
  132. package/dist/{storage-tags-gk7gjkqt.js → storage-tags-jq0c0zsn.js} +7 -7
  133. package/dist/{store-yr443ye8.js → store-29ksp6vy.js} +4 -4
  134. package/dist/{store-reader-qbq6q4v0.js → store-reader-dgh3ssxx.js} +1 -1
  135. package/dist/tools/ctx-expand/search-archive.d.ts +3 -2
  136. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
  137. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  138. package/dist/tools/ctx-expand/v2-archive-reader.d.ts +2 -0
  139. package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -1
  140. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  141. package/dist/{transform-postprocess-phase-neds90e3.js → transform-postprocess-phase-376xn40x.js} +35 -35
  142. package/dist/v2/auto-search-worker.js +5 -5
  143. package/dist/v2/chunk-embedding-write-worker.js +16 -16
  144. package/dist/v2/{compaction-marker-candidates-bp1bn579.js → compaction-marker-candidates-6nypmsr3.js} +3 -3
  145. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  146. package/dist/v2/{compartment-chunk-embedding-w7ht0t9v.js → compartment-chunk-embedding-jthtfhcd.js} +8 -8
  147. package/dist/v2/{context-ctsd80vc.js → context-vm09agrs.js} +426 -185
  148. package/dist/v2/{derive-budgets-hr4qqrnv.js → derive-budgets-wj0q7s7d.js} +6 -6
  149. package/dist/v2/embedding-backfill-16b16m38.js +29 -0
  150. package/dist/v2/embedding-worker-process.js +2 -2
  151. package/dist/v2/embedding-worker.js +8 -8
  152. package/dist/v2/fold/memory-cache.d.ts +2 -0
  153. package/dist/v2/fold/memory-cache.d.ts.map +1 -1
  154. package/dist/v2/fold/native-replay.d.ts +23 -5
  155. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  156. package/dist/v2/hidden-child-native.d.ts.map +1 -1
  157. package/dist/v2/hidden-child-record.d.ts +8 -0
  158. package/dist/v2/hidden-child-record.d.ts.map +1 -1
  159. package/dist/v2/hidden-completion.d.ts.map +1 -1
  160. package/dist/v2/hidden-run-holder.d.ts +8 -2
  161. package/dist/v2/hidden-run-holder.d.ts.map +1 -1
  162. package/dist/v2/{history-owner-260djmv5.js → history-owner-8pd5ax3n.js} +3 -3
  163. package/dist/v2/hooks/context.d.ts.map +1 -1
  164. package/dist/v2/hooks/hidden-child.d.ts +3 -0
  165. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  166. package/dist/v2/hooks/revert-message-state.d.ts.map +1 -1
  167. package/dist/v2/hooks/session-project-backfill.d.ts +2 -1
  168. package/dist/v2/hooks/session-project-backfill.d.ts.map +1 -1
  169. package/dist/v2/{logger-zyf43np1.js → logger-58jfese9.js} +2 -2
  170. package/dist/v2/{message-fts-rowid-map-n8mcvcpz.js → message-fts-rowid-map-ax4vk78j.js} +5 -5
  171. package/dist/v2/{message-index-bounded-1vew9c37.js → message-index-bounded-qh794qxx.js} +12 -12
  172. package/dist/v2/{message-time-backfill-ynb3vg6r.js → message-time-backfill-yj773saf.js} +3 -3
  173. package/dist/v2/migration-worker.js +13 -13
  174. package/dist/v2/{project-embedding-registry-je5jam7y.js → project-embedding-registry-z05xvckg.js} +15 -15
  175. package/dist/v2/raw-ordinal-warmup-worker.js +9 -9
  176. package/dist/v2/{read-session-chunk-09sre4xv.js → read-session-chunk-8tn2dbn1.js} +10 -10
  177. package/dist/v2/{read-session-raw-wg5zc29f.js → read-session-raw-ywebck9q.js} +3 -3
  178. package/dist/v2/recomp-orchestrator-pfjpzdrb.js +69 -0
  179. package/dist/v2/render-7t5d7hkv.js +43 -0
  180. package/dist/v2/{safe-notification-target-y55z2zat.js → safe-notification-target-zrwbh6k7.js} +3 -3
  181. package/dist/v2/{search-gmye6n25.js → search-35cz80x0.js} +26 -26
  182. package/dist/v2/search-archive-5dpxv0ck.js +29 -0
  183. package/dist/v2/{send-session-notification-v69y04f5.js → send-session-notification-8x146x5y.js} +6 -6
  184. package/dist/v2/{server-z9czv2vb.js → server-11ra1pmx.js} +49 -13
  185. package/dist/v2/{server-gs2251jr.js → server-2cq3e1c1.js} +4 -4
  186. package/dist/v2/{server-39bcszk4.js → server-2qvnr3t7.js} +1 -1
  187. package/dist/v2/{server-jkj1dq6j.js → server-2sare4qg.js} +4 -4
  188. package/dist/v2/{server-jdfe07mp.js → server-2wz6y46g.js} +1 -1
  189. package/dist/v2/{server-at0v0z4t.js → server-379fd3n7.js} +1 -1
  190. package/dist/v2/{server-ds8vpfkr.js → server-40vdz8sf.js} +2 -2
  191. package/dist/v2/{server-qntmqaca.js → server-4yrvbnnm.js} +2 -2
  192. package/dist/v2/{server-x69fqsvz.js → server-5t4nzfpt.js} +1 -1
  193. package/dist/v2/{server-npdey91q.js → server-63ree5ns.js} +1 -1
  194. package/dist/v2/{server-gqkdfdvw.js → server-6qax5pds.js} +2 -2
  195. package/dist/v2/{server-qb3s0mnc.js → server-73bqw5c0.js} +1 -1
  196. package/dist/v2/{server-6chcnnhq.js → server-7h4gwphm.js} +4 -4
  197. package/dist/v2/{server-rkj44mez.js → server-7tj8yzrv.js} +2 -2
  198. package/dist/v2/{server-e6xneh68.js → server-arfzfxe8.js} +5 -1
  199. package/dist/v2/{server-6ash6z8z.js → server-av3p9c8k.js} +1 -1
  200. package/dist/v2/{server-5hwf5c7r.js → server-bx5k66qc.js} +1 -1
  201. package/dist/v2/{server-dgsjamm4.js → server-db91dxwc.js} +7 -7
  202. package/dist/v2/{server-z4p0ry94.js → server-dt7cyqfe.js} +2 -1
  203. package/dist/v2/{server-k1xc2bw1.js → server-ganavh75.js} +2 -2
  204. package/dist/v2/{server-6x40bnb7.js → server-gh2w75fn.js} +3 -3
  205. package/dist/v2/server-j1gxs1gj.js +119 -0
  206. package/dist/v2/{server-ps6zrzwj.js → server-k3ntgf6n.js} +164 -62
  207. package/dist/v2/{server-j8376q08.js → server-kzrrdjp5.js} +1 -1
  208. package/dist/v2/{server-1rrmxhd1.js → server-n33hyq9t.js} +2 -2
  209. package/dist/v2/{server-0tv6kytx.js → server-n34vzyfm.js} +1 -1
  210. package/dist/v2/{server-vc5fta6s.js → server-nnh81jqy.js} +6 -6
  211. package/dist/v2/{server-g53asaqt.js → server-pcq2d1wh.js} +30 -14
  212. package/dist/v2/{server-bnkc9kph.js → server-ppy2dj7g.js} +6 -6
  213. package/dist/v2/{server-96nm9vk4.js → server-rr5c0xcg.js} +2 -2
  214. package/dist/v2/{server-j4jjtdc5.js → server-rt8t6s2a.js} +2 -2
  215. package/dist/v2/{server-2xm0gxke.js → server-svccj9rd.js} +4 -4
  216. package/dist/v2/{server-5sbsnpkn.js → server-tq523gj6.js} +1 -1
  217. package/dist/v2/{server-00adcfjd.js → server-vj0xbbrc.js} +17 -3
  218. package/dist/v2/{server-4ecpanyn.js → server-vntc961c.js} +127 -17
  219. package/dist/v2/{server-btgnkr9z.js → server-vsx9tsks.js} +11 -11
  220. package/dist/v2/{server-vtgeyhq6.js → server-vtkbxzw1.js} +21 -6
  221. package/dist/v2/{server-cvp9w5gs.js → server-w35ep6wn.js} +192 -84
  222. package/dist/v2/{server-myp4pc6x.js → server-z2nv8jdv.js} +132 -64
  223. package/dist/v2/{server-pcarsvj2.js → server-z5cv5wm5.js} +10 -10
  224. package/dist/v2/{server-barj0mjz.js → server-zemnpv92.js} +4 -4
  225. package/dist/v2/server.js +9 -9
  226. package/dist/v2/{storage-tags-nccqr0kr.js → storage-tags-pcenytad.js} +7 -7
  227. package/dist/v2/{store-enef5jcn.js → store-gx19qc3a.js} +4 -4
  228. package/dist/v2/{store-reader-jbaqv1yp.js → store-reader-qt2msa8z.js} +1 -1
  229. package/dist/v2/store-reader.d.ts +1 -1
  230. package/dist/v2/store-reader.d.ts.map +1 -1
  231. package/dist/v2/{v2-archive-reader-7vmng8q7.js → v2-archive-reader-jqrwz7b8.js} +1 -1
  232. package/dist/v2/{wrapup-orchestrator-7r4y0bf6.js → wrapup-orchestrator-kcq3cv7y.js} +35 -35
  233. package/dist/{v2-archive-reader-7s90gfax.js → v2-archive-reader-64h2gtam.js} +1 -1
  234. package/dist/wrapup-orchestrator-knyac7jp.js +56 -0
  235. package/package.json +1 -1
  236. package/src/config/index.test.ts +23 -5
  237. package/src/config/live-run-config.test.ts +7 -7
  238. package/src/config/removed-agent-config.ts +14 -1
  239. package/src/config/schema/magic-context.ts +5 -1
  240. package/src/shared/host-sqlite-runtime.test.ts +21 -0
  241. package/src/shared/host-sqlite-runtime.ts +32 -0
  242. package/src/shared/redaction.test.ts +11 -8
  243. package/src/shared/redaction.ts +5 -1
  244. package/src/shared/storage-file-mutex-review.test.ts +110 -0
  245. package/src/shared/storage-file-mutex.ts +12 -0
  246. package/dist/embedding-backfill-6wzc4p2n.js +0 -29
  247. package/dist/index-52x68mj4.js +0 -58
  248. package/dist/recomp-orchestrator-qb2hymj5.js +0 -69
  249. package/dist/render-34p0kek8.js +0 -43
  250. package/dist/search-archive-08ppk0q5.js +0 -27
  251. package/dist/v2/embedding-backfill-40g0anxh.js +0 -29
  252. package/dist/v2/recomp-orchestrator-mgcty3we.js +0 -69
  253. package/dist/v2/render-ygcmyn9x.js +0 -43
  254. package/dist/v2/search-archive-nrsqqmk5.js +0 -27
  255. package/dist/v2/server-52x68mj4.js +0 -58
  256. package/dist/wrapup-orchestrator-m2p89973.js +0 -56
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./server-qb3s0mnc.js";
3
+ } from "./server-73bqw5c0.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./server-pavzsdc6.js";
7
7
  import {
8
8
  log2
9
- } from "./server-j8376q08.js";
9
+ } from "./server-kzrrdjp5.js";
10
10
  import {
11
11
  inRootAsyncContext2
12
12
  } from "./server-gzy5w8ya.js";
13
13
 
14
14
  // src/features/magic-context/memory/embedding-synapse.ts
15
15
  import { createHash } from "node:crypto";
16
+ import { setTimeout as sleep } from "node:timers/promises";
16
17
 
17
18
  // ../../node_modules/.bun/@cortexkit+subc-client@0.11.1/node_modules/@cortexkit/subc-client/dist/client.js
18
19
  import { promises as fs2 } from "node:fs";
@@ -1605,6 +1606,9 @@ function pendingKey(handle, corr) {
1605
1606
  var SYNAPSE_DEFAULT_MODEL = "gte-modernbert-base-f16";
1606
1607
  var SYNAPSE_DEFAULT_QUERY_TIMEOUT_MS = 3000;
1607
1608
  var SYNAPSE_DEFAULT_BATCH_TIMEOUT_MS = 120000;
1609
+ var SYNAPSE_DEFAULT_POLL_TIMEOUT_MS = 5 * 60000;
1610
+ var SYNAPSE_INITIAL_POLL_DELAY_MS = 250;
1611
+ var SYNAPSE_MAX_POLL_DELAY_MS = 2000;
1608
1612
  var SYNAPSE_CERTIFICATION_REFUSAL_REASONS = new Set([
1609
1613
  "not_certified",
1610
1614
  "probe_required",
@@ -1639,6 +1643,9 @@ function formatSynapseLaneDescriptor(descriptor) {
1639
1643
  const certified = descriptor.certified === undefined ? "unknown" : String(descriptor.certified);
1640
1644
  return `lane=${descriptor.lane}; device_class=${descriptor.device_class ?? "unknown"}; ` + `max_tokens=${descriptor.max_tokens} (${descriptor.max_tokens_source}); ` + `certified=${certified}; warm=${descriptor.warm ? "yes" : "no"}; ` + `warm_load_cost_hint_ms=${descriptor.warm_load_cost_hint_ms ?? "unknown"}`;
1641
1645
  }
1646
+ function isPollState(state) {
1647
+ return state === "queued" || state === "running" || state === "done" || state === "failed_transient" || state === "failed_permanent";
1648
+ }
1642
1649
 
1643
1650
  class SynapseEmbeddingError extends Error {
1644
1651
  code;
@@ -1767,6 +1774,21 @@ function embeddingFailureFor(error) {
1767
1774
  function wait(ms) {
1768
1775
  return new Promise((resolve) => setTimeout(resolve, ms));
1769
1776
  }
1777
+ async function untilAborted(request, signal) {
1778
+ let onAbort = () => {};
1779
+ const aborted = new Promise((_, reject) => {
1780
+ onAbort = () => reject(signal.reason);
1781
+ if (signal.aborted)
1782
+ onAbort();
1783
+ else
1784
+ signal.addEventListener("abort", onAbort, { once: true });
1785
+ });
1786
+ try {
1787
+ return await Promise.race([request, aborted]);
1788
+ } finally {
1789
+ signal.removeEventListener("abort", onAbort);
1790
+ }
1791
+ }
1770
1792
  function sha256(value) {
1771
1793
  return createHash("sha256").update(value).digest("hex");
1772
1794
  }
@@ -2104,43 +2126,42 @@ class SynapseEmbeddingProvider {
2104
2126
  break;
2105
2127
  const page = this.nextPage(eligibleItems, start);
2106
2128
  start += page.length;
2129
+ let job;
2107
2130
  try {
2108
2131
  const requestKey = this.requestKey(page, purpose);
2109
- let body = {};
2110
2132
  let restarted = false;
2111
- for (;; ) {
2112
- try {
2113
- body = await this.callWithRetry("embed.batch", this.batchRequest(page, requestKey, purpose), this.options.batchTimeoutMs ?? SYNAPSE_DEFAULT_BATCH_TIMEOUT_MS, true, signal);
2114
- const first = responseBody(body);
2115
- const jobId = typeof first.job_id === "string" ? first.job_id : null;
2116
- if (jobId)
2117
- body = await this.pollBatch(jobId, requestKey, signal);
2118
- break;
2119
- } catch (error) {
2120
- const classified = classifyError(error);
2121
- if (classified.code !== "module_restarted" || restarted)
2122
- throw classified;
2123
- restarted = true;
2124
- }
2125
- }
2126
- const batchEnvelope = responseBody(body);
2127
- const disclosures = extractTruncationDisclosures(body);
2128
- for (const [index, item] of extractBatchItems(body).entries()) {
2129
- const id = typeof item.id === "string" ? item.id : "";
2130
- const vector = item.vector ?? item.embedding;
2131
- if (!id || !Array.isArray(vector) || vector.some((component) => typeof component !== "number" || !Number.isFinite(component))) {
2132
- throw new SynapseEmbeddingError("schema_violation", "Synapse batch item is malformed");
2133
+ try {
2134
+ for (;; ) {
2135
+ try {
2136
+ const body = await this.callWithRetry("embed.batch", this.batchRequest(page, requestKey, purpose), this.options.batchTimeoutMs ?? SYNAPSE_DEFAULT_BATCH_TIMEOUT_MS, true, signal, job);
2137
+ const first = responseBody(body);
2138
+ if (typeof first.job_id === "string" && first.job_id) {
2139
+ job ??= this.startPoll(first.job_id, first.state, signal);
2140
+ job.id = first.job_id;
2141
+ await this.pollBatch(job, page);
2142
+ } else {
2143
+ this.acceptBatchRows(body, page, output);
2144
+ }
2145
+ break;
2146
+ } catch (error) {
2147
+ if (job && (signal?.aborted || this.pollRemainingMs(job) <= 0)) {
2148
+ if (!signal?.aborted) {
2149
+ log2(`[magic-context] Synapse embed.result polling limit reached: job_id=${job.id} state=${job.state} pages_read=${job.pagesRead.size}`);
2150
+ }
2151
+ break;
2152
+ }
2153
+ const classified = classifyError(error);
2154
+ if (classified.code !== "module_restarted" || restarted)
2155
+ throw classified;
2156
+ restarted = true;
2157
+ }
2133
2158
  }
2134
- const expected = page.find((candidate) => candidate.id === id);
2135
- if (!expected) {
2136
- throw new SynapseEmbeddingError("schema_violation", `Synapse returned unknown item ${id}`);
2159
+ } finally {
2160
+ if (!signal?.aborted && job?.rows.size) {
2161
+ for (const [id, vector] of job.rows)
2162
+ output.set(id, vector);
2163
+ this.recordSuccess();
2137
2164
  }
2138
- const rowMetadata = validateWireRow(item, disclosures[index] ?? null, expected);
2139
- const vectorArray = Float32Array.from(vector);
2140
- this.validateResponse({ ...batchEnvelope, ...item }, vectorArray.length);
2141
- embeddingRowMetadata.set(vectorArray, rowMetadata);
2142
- output.set(id, vectorArray);
2143
- this.recordSuccess();
2144
2165
  }
2145
2166
  } catch (error) {
2146
2167
  const classified = classifyError(error);
@@ -2157,6 +2178,30 @@ class SynapseEmbeddingProvider {
2157
2178
  }
2158
2179
  return output;
2159
2180
  }
2181
+ acceptBatchRows(body, requested, output, polling = false) {
2182
+ const batchEnvelope = responseBody(body);
2183
+ const disclosures = extractTruncationDisclosures(body);
2184
+ for (const [index, item] of extractBatchItems(body).entries()) {
2185
+ const id = typeof item.id === "string" ? item.id : "";
2186
+ const vector = item.vector ?? item.embedding;
2187
+ if (!id || !Array.isArray(vector) || vector.some((component) => typeof component !== "number" || !Number.isFinite(component))) {
2188
+ throw new SynapseEmbeddingError("schema_violation", "Synapse batch item is malformed");
2189
+ }
2190
+ const expected = requested.find((candidate) => candidate.id === id);
2191
+ if (!expected) {
2192
+ throw new SynapseEmbeddingError("schema_violation", `Synapse returned unknown item ${id}`);
2193
+ }
2194
+ const rowMetadata = validateWireRow(item, disclosures[index] ?? null, expected);
2195
+ this.validateResponse(polling ? batchEnvelope : { ...batchEnvelope, ...item }, vector.length);
2196
+ if (polling && output.has(id))
2197
+ continue;
2198
+ const vectorArray = Float32Array.from(vector);
2199
+ embeddingRowMetadata.set(vectorArray, rowMetadata);
2200
+ output.set(id, vectorArray);
2201
+ if (!polling)
2202
+ this.recordSuccess();
2203
+ }
2204
+ }
2160
2205
  async dispose() {
2161
2206
  this.initialized = false;
2162
2207
  this.client = null;
@@ -2201,45 +2246,91 @@ class SynapseEmbeddingProvider {
2201
2246
  purpose
2202
2247
  });
2203
2248
  }
2204
- async pollBatch(jobId, requestKey, signal) {
2205
- let cursor = null;
2206
- const allItems = [];
2207
- const allDisclosures = [];
2249
+ startPoll(id, state, signal) {
2250
+ const timeoutMs = this.options.pollTimeoutMs ?? SYNAPSE_DEFAULT_POLL_TIMEOUT_MS;
2251
+ const timeout = this.options.pollClock?.timeoutSignal(timeoutMs) ?? AbortSignal.timeout(timeoutMs);
2252
+ return {
2253
+ id,
2254
+ state: isPollState(state) ? state : "unknown",
2255
+ deadline: this.pollNow() + timeoutMs,
2256
+ signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
2257
+ delayMs: SYNAPSE_INITIAL_POLL_DELAY_MS,
2258
+ pagesRead: new Set,
2259
+ rows: new Map
2260
+ };
2261
+ }
2262
+ pollNow() {
2263
+ return this.options.pollClock?.now() ?? performance.now();
2264
+ }
2265
+ pollRemainingMs(job) {
2266
+ return job.signal.aborted ? 0 : Math.ceil(job.deadline - this.pollNow());
2267
+ }
2268
+ async pollWait(ms, signal) {
2269
+ const clock = this.options.pollClock;
2270
+ if (clock)
2271
+ await clock.sleep(ms, signal);
2272
+ else
2273
+ await sleep(ms, undefined, { signal });
2274
+ }
2275
+ async pollBatch(job, requested) {
2276
+ let page = 0;
2208
2277
  for (;; ) {
2209
- if (signal?.aborted)
2210
- return {};
2211
- const body = await this.callWithRetry("embed.result", this.requestConstraints({
2212
- job_id: jobId,
2213
- cursor,
2214
- request_key: requestKey
2215
- }), this.options.batchTimeoutMs ?? SYNAPSE_DEFAULT_BATCH_TIMEOUT_MS, true, signal);
2278
+ let body;
2279
+ try {
2280
+ body = await this.callWithRetry("embed.result", { job_id: job.id, page }, this.options.batchTimeoutMs ?? SYNAPSE_DEFAULT_BATCH_TIMEOUT_MS, true, job.signal, job);
2281
+ } catch (error) {
2282
+ if (readErrorCode(error) !== "invalid_request")
2283
+ throw error;
2284
+ log2(`[magic-context] Synapse embed.result stopped: job_id=${job.id} page=${page} code=invalid_request`);
2285
+ return;
2286
+ }
2216
2287
  const parsed = responseBody(body);
2217
- const items = extractBatchItems(body);
2218
- const disclosures = extractTruncationDisclosures(body);
2219
- allItems.push(...items);
2220
- allDisclosures.push(...items.map((_, index) => disclosures[index] ?? null));
2221
- const nextCursor = parsed.next_cursor ?? parsed.cursor;
2222
- const done = parsed.done === true || parsed.complete === true || nextCursor === undefined || nextCursor === null;
2223
- if (done) {
2224
- return {
2225
- ...parsed,
2226
- vectors: allItems,
2227
- truncation_disclosures: allDisclosures
2228
- };
2288
+ const state = parsed.state;
2289
+ const malformed = () => new SynapseEmbeddingError("schema_violation", "Synapse embed.result returned a malformed page or status");
2290
+ if (!isPollState(state) || parsed.job_id !== job.id || typeof parsed.pages_available !== "number" || !Number.isInteger(parsed.pages_available) || parsed.pages_available < 0)
2291
+ throw malformed();
2292
+ job.state = state;
2293
+ if (Array.isArray(parsed.vectors)) {
2294
+ const pageCount = parsed.page_count;
2295
+ if (parsed.page !== page || typeof pageCount !== "number" || !Number.isInteger(pageCount) || pageCount <= page || parsed.pages_available <= page || parsed.vectors.length === 0 || parsed.vectors.some((row) => !asRecord(row)))
2296
+ throw malformed();
2297
+ this.acceptBatchRows(body, requested, job.rows, true);
2298
+ job.pagesRead.add(page);
2299
+ page += 1;
2300
+ if (state === "done" && page === pageCount)
2301
+ return;
2302
+ continue;
2303
+ }
2304
+ if (parsed.vectors !== undefined || parsed.page !== undefined || parsed.page_count !== undefined || typeof parsed.request_key !== "string")
2305
+ throw malformed();
2306
+ if (state === "failed_transient" || state === "failed_permanent") {
2307
+ const error = asRecord(parsed.error);
2308
+ if (typeof error?.code !== "string" || typeof error.message !== "string") {
2309
+ throw malformed();
2310
+ }
2311
+ throw Object.assign(new Error(error.message), { code: error.code });
2229
2312
  }
2230
- cursor = nextCursor;
2313
+ if (state !== "queued" && state !== "running")
2314
+ throw malformed();
2315
+ const delay = Math.min(job.delayMs, this.pollRemainingMs(job));
2316
+ if (delay > 0)
2317
+ await this.pollWait(delay, job.signal);
2318
+ job.delayMs = Math.min(job.delayMs * 2, SYNAPSE_MAX_POLL_DELAY_MS);
2231
2319
  }
2232
2320
  }
2233
- async callWithRetry(method, params, timeoutMs, retryEmbeddings, signal) {
2321
+ async callWithRetry(method, params, timeoutMs, retryEmbeddings, signal, job) {
2234
2322
  let attempt = 0;
2235
2323
  for (;; ) {
2236
2324
  if (signal?.aborted)
2237
2325
  throw new SynapseEmbeddingError("transport", "Synapse request aborted");
2326
+ const remainingMs = job ? this.pollRemainingMs(job) : timeoutMs;
2327
+ if (job && remainingMs <= 0)
2328
+ throw new SynapseEmbeddingError("timeout", "Synapse polling limit reached");
2238
2329
  try {
2239
2330
  if (!this.client)
2240
2331
  throw new SynapseEmbeddingError("transport", "Synapse client is unavailable");
2241
- return await this.client.call(this.options.moduleId ?? "synapse", method, params, {
2242
- timeoutMs,
2332
+ const request = this.client.call(this.options.moduleId ?? "synapse", method, params, {
2333
+ timeoutMs: Math.min(timeoutMs, remainingMs),
2243
2334
  targetKind: "management_surface",
2244
2335
  identity: {
2245
2336
  project_root: this.options.projectRoot,
@@ -2247,8 +2338,16 @@ class SynapseEmbeddingProvider {
2247
2338
  session: this.options.session
2248
2339
  }
2249
2340
  });
2341
+ if (!job)
2342
+ return await request;
2343
+ const reply = await untilAborted(request, job.signal);
2344
+ if (this.pollRemainingMs(job) <= 0)
2345
+ throw new SynapseEmbeddingError("timeout", "Synapse polling limit reached");
2346
+ return reply;
2250
2347
  } catch (error) {
2251
2348
  const classified = classifyError(error);
2349
+ if (job && (this.pollRemainingMs(job) <= 0 || classified.code === "module_restarted" || method === "embed.result" && readErrorCode(error) === "invalid_request"))
2350
+ throw error;
2252
2351
  if (classified.code === "idempotency_conflict")
2253
2352
  throw classified;
2254
2353
  const outcomeUnknown = error instanceof SubcCallError && error.kind === "outcome_unknown";
@@ -2257,7 +2356,10 @@ class SynapseEmbeddingProvider {
2257
2356
  throw classified;
2258
2357
  const delay = classified.retryAfterMs ?? Math.min(2000, 100 * 2 ** attempt);
2259
2358
  attempt += 1;
2260
- await wait(delay);
2359
+ if (job)
2360
+ await this.pollWait(Math.min(delay, this.pollRemainingMs(job)), job.signal);
2361
+ else
2362
+ await wait(delay);
2261
2363
  }
2262
2364
  }
2263
2365
  }
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  sanitizeDiagnosticText,
6
6
  sanitizeConfigValue
7
- } from "./server-z4p0ry94.js";
7
+ } from "./server-dt7cyqfe.js";
8
8
 
9
9
  // src/shared/logger.ts
10
10
  import * as fs from "node:fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getMagicContextStorageDir,
3
3
  log2
4
- } from "./server-j8376q08.js";
4
+ } from "./server-kzrrdjp5.js";
5
5
  import {
6
6
  writeStorageFileAtomicSync
7
- } from "./server-0tv6kytx.js";
7
+ } from "./server-n34vzyfm.js";
8
8
  import {
9
9
  inRootAsyncContext2
10
10
  } from "./server-gzy5w8ya.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isPidAlive
3
- } from "./server-jdfe07mp.js";
3
+ } from "./server-2wz6y46g.js";
4
4
 
5
5
  // src/shared/storage-permissions.ts
6
6
  import { randomBytes } from "node:crypto";
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  sanitizeDiagnosticText
3
- } from "./server-z4p0ry94.js";
3
+ } from "./server-dt7cyqfe.js";
4
4
  import {
5
5
  PROMOTABLE_CATEGORIES,
6
6
  CATEGORY_DEFAULT_TTL
7
7
  } from "./server-fr0wbhdn.js";
8
8
  import {
9
9
  DEFAULT_LOCAL_EMBEDDING_MODEL
10
- } from "./server-e6xneh68.js";
10
+ } from "./server-arfzfxe8.js";
11
11
  import {
12
12
  sessionLog2
13
- } from "./server-j8376q08.js";
13
+ } from "./server-kzrrdjp5.js";
14
14
  import {
15
15
  isSynapseEmbeddingTruncated,
16
16
  SynapseEmbeddingProvider
17
- } from "./server-ps6zrzwj.js";
17
+ } from "./server-k3ntgf6n.js";
18
18
  import {
19
19
  LocalEmbeddingProvider
20
- } from "./server-6chcnnhq.js";
20
+ } from "./server-7h4gwphm.js";
21
21
  import {
22
22
  OpenAICompatibleEmbeddingProvider,
23
23
  embedTextForProject2
24
- } from "./server-pcarsvj2.js";
24
+ } from "./server-z5cv5wm5.js";
25
25
  import {
26
26
  saveEmbeddingIfHashMatches
27
27
  } from "./server-qjwpqvnf.js";
@@ -1,35 +1,49 @@
1
1
  import {
2
- withMessageFtsSessionFilter
3
- } from "./server-52x68mj4.js";
2
+ withMessageFtsSessionFilter,
3
+ liveTailRangeTouchesUnresolvedCoverage,
4
+ rangeHasHiddenMessages
5
+ } from "./server-j1gxs1gj.js";
4
6
  import {
5
7
  getSqliteDatabasePath2
6
8
  } from "./server-gzy5w8ya.js";
7
9
  import {
8
10
  runSessionWarmupWorker
9
- } from "./server-6ash6z8z.js";
11
+ } from "./server-av3p9c8k.js";
10
12
  import {
11
13
  estimateTokens
12
- } from "./server-qb3s0mnc.js";
14
+ } from "./server-73bqw5c0.js";
13
15
  import {
14
16
  openCodeDbExists,
15
17
  withReadOnlySessionDb
16
- } from "./server-5hwf5c7r.js";
18
+ } from "./server-bx5k66qc.js";
17
19
  import {
18
20
  hasRawMessageProvider2,
19
21
  rawMessageWorkerSource2,
20
22
  rawMessageOffThreadRangeReader2,
21
23
  readRawSessionMessageIdOrdinalsForRange2
22
- } from "./server-dgsjamm4.js";
24
+ } from "./server-db91dxwc.js";
23
25
  import {
24
26
  readV2ArchiveOffThread2
25
- } from "./server-bnkc9kph.js";
27
+ } from "./server-ppy2dj7g.js";
26
28
 
27
29
  // src/tools/ctx-expand/search-archive.ts
28
30
  var archiveReadsOnThisThread = 0;
29
- function renderSearchArchive2(db, sessionId, start, end, tokenBudget, archiveOnly = false, readRawIds = () => readRawSessionMessageIdOrdinalsForRange2(sessionId, start, end)) {
31
+ function liveTailRefusal(start, end, lastCompartmentEnd) {
32
+ return `Range ${start}-${end} is entirely within the live tail (after the last compacted message ${lastCompartmentEnd}); those messages are already visible in context.`;
33
+ }
34
+ function unresolvedLiveTailRefusal2(db, sessionId, start, end, lastCompartmentEnd) {
35
+ return liveTailRangeTouchesUnresolvedCoverage(db, sessionId, start, end, lastCompartmentEnd) ? liveTailRefusal(start, end, lastCompartmentEnd) : null;
36
+ }
37
+ function renderSearchArchive2(db, sessionId, start, end, tokenBudget, archiveOnly = false, readRawIds = () => readRawSessionMessageIdOrdinalsForRange2(sessionId, start, end), liveTailAfter) {
30
38
  archiveReadsOnThisThread += 1;
39
+ let rawIds;
40
+ if (liveTailAfter !== undefined) {
41
+ rawIds = readRawIds();
42
+ if (!rangeHasHiddenMessages(db, sessionId, rawIds, liveTailAfter, start, end)) {
43
+ return liveTailRefusal(start, end, liveTailAfter);
44
+ }
45
+ }
31
46
  return withMessageFtsSessionFilter(db, sessionId, (sessionFirst) => {
32
- let rawIds;
33
47
  const rows = db.prepare(sessionFirst ? `SELECT f.message_ordinal AS ordinal, f.message_id AS id, f.role, f.content
34
48
  FROM message_fts_rowid_map AS m
35
49
  JOIN message_history_fts AS f ON f.rowid = m.fts_rowid
@@ -76,7 +90,7 @@ function renderSearchArchive2(db, sessionId, start, end, tokenBudget, archiveOnl
76
90
  `);
77
91
  });
78
92
  }
79
- async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBudget, archiveOnly = false) {
93
+ async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBudget, archiveOnly = false, liveTailAfter) {
80
94
  const path = getSqliteDatabasePath2(db);
81
95
  const provider = hasRawMessageProvider2(sessionId);
82
96
  const source = rawMessageWorkerSource2(sessionId);
@@ -92,7 +106,7 @@ async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBud
92
106
  if (!path) {
93
107
  return renderSearchArchive2(db, sessionId, start, end, tokenBudget, archiveOnly, rawIds ? () => rawIds : provider ? () => {
94
108
  throw new Error("Search archive worker unavailable: private archive has no off-thread source");
95
- } : undefined);
109
+ } : undefined, liveTailAfter);
96
110
  }
97
111
  if (!archiveOnly && source) {
98
112
  return readV2ArchiveOffThread2(path, source.path, sessionId, {
@@ -100,7 +114,8 @@ async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBud
100
114
  start,
101
115
  end,
102
116
  tokenBudget,
103
- archiveOnly
117
+ archiveOnly,
118
+ liveTailAfter
104
119
  });
105
120
  }
106
121
  if (!archiveOnly && provider && !rawIds) {
@@ -116,7 +131,8 @@ async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBud
116
131
  tokenBudget,
117
132
  archiveOnly,
118
133
  rawPath,
119
- rawIds: rawIds ? [...rawIds] : undefined
134
+ rawIds: rawIds ? [...rawIds] : undefined,
135
+ liveTailAfter
120
136
  }
121
137
  }, {});
122
138
  if ("searchArchive" in result)
@@ -124,4 +140,4 @@ async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBud
124
140
  throw new Error(`Search archive worker unavailable: ${"failure" in result ? `${result.failure}: ${result.detail}` : "unexpected reply"}`);
125
141
  }
126
142
 
127
- export { renderSearchArchive2, renderSearchArchiveOffThread2 };
143
+ export { unresolvedLiveTailRefusal2, renderSearchArchive2, renderSearchArchiveOffThread2 };
@@ -137,11 +137,11 @@ async function serveV2ArchiveReads2(port, openConnections) {
137
137
  { createV2RecoveryAttachments }
138
138
  ] = await Promise.all([
139
139
  import("./sqlite-zdgm52sv.js"),
140
- import("./store-reader-jbaqv1yp.js"),
141
- import("./store-enef5jcn.js"),
142
- import("./read-session-chunk-09sre4xv.js"),
143
- import("./render-ygcmyn9x.js"),
144
- import("./search-archive-nrsqqmk5.js"),
140
+ import("./store-reader-qt2msa8z.js"),
141
+ import("./store-gx19qc3a.js"),
142
+ import("./read-session-chunk-8tn2dbn1.js"),
143
+ import("./render-7t5d7hkv.js"),
144
+ import("./search-archive-5dpxv0ck.js"),
145
145
  import("./expand-attachments-h33jbgyz.js")
146
146
  ]);
147
147
  const pool = new V2StoreReaderPool;
@@ -169,7 +169,7 @@ async function serveV2ArchiveReads2(port, openConnections) {
169
169
  } else {
170
170
  const start = read.kind === "message" ? read.message : read.start;
171
171
  const end = read.kind === "message" ? read.message : read.end;
172
- text = renderSearchArchive(db, request.sessionId, start, end, read.tokenBudget, read.kind === "archive" && read.archiveOnly, () => reader.ordinalMapForRange(request.sessionId, start, end));
172
+ text = renderSearchArchive(db, request.sessionId, start, end, read.tokenBudget, read.kind === "archive" && read.archiveOnly, () => reader.ordinalMapForRange(request.sessionId, start, end), read.kind === "message" ? undefined : read.liveTailAfter);
173
173
  if (text === null && read.kind === "message") {
174
174
  text = renderMessageByOrdinal(request.sessionId, read.message, attachments);
175
175
  } else if (text === null && read.kind === "verbose") {
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  getMagicContextStorageDir,
6
6
  sessionLog2
7
- } from "./server-j8376q08.js";
7
+ } from "./server-kzrrdjp5.js";
8
8
  import {
9
9
  writeStorageFileAtomicSync
10
- } from "./server-0tv6kytx.js";
10
+ } from "./server-n34vzyfm.js";
11
11
  import {
12
12
  modelRefLookupOrder
13
13
  } from "./server-avwt563y.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  log2
3
- } from "./server-j8376q08.js";
3
+ } from "./server-kzrrdjp5.js";
4
4
  import {
5
5
  getSdkWindowGeometry,
6
6
  getSdkContextLimit,
7
7
  getSdkInputLimit
8
- } from "./server-96nm9vk4.js";
8
+ } from "./server-rr5c0xcg.js";
9
9
  import {
10
10
  localBudget,
11
11
  calibrationForModelKey
@@ -6,19 +6,19 @@ import {
6
6
  removeNestedBlocks,
7
7
  hasMeaningfulUserText2,
8
8
  extractTexts2
9
- } from "./server-qb3s0mnc.js";
9
+ } from "./server-73bqw5c0.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./server-dgsjamm4.js";
12
+ } from "./server-db91dxwc.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,
16
16
  messageFtsOrdinalRangeIsMapped2,
17
17
  deleteUnmappedMessageFtsRows2
18
- } from "./server-ds8vpfkr.js";
18
+ } from "./server-40vdz8sf.js";
19
19
  import {
20
20
  logSlowWriteTransaction
21
- } from "./server-5sbsnpkn.js";
21
+ } from "./server-tq523gj6.js";
22
22
 
23
23
  // src/features/magic-context/compression-depth-storage.ts
24
24
  var incrementDepthStatements = new WeakMap;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./server-j8376q08.js";
3
+ } from "./server-kzrrdjp5.js";
4
4
 
5
5
  // src/shared/write-transaction-timing.ts
6
6
  var SLOW_WRITE_TRANSACTION_THRESHOLD_MS = 1000;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log2
3
- } from "./server-j8376q08.js";
3
+ } from "./server-kzrrdjp5.js";
4
4
  import {
5
5
  setOutputReserveConfig
6
- } from "./server-96nm9vk4.js";
6
+ } from "./server-rr5c0xcg.js";
7
7
  import {
8
8
  isCompactionEnabled,
9
9
  migrateLegacyAgentEnabledInMemory,
@@ -17,7 +17,7 @@ import {
17
17
  PER_HARNESS_MODEL_KEYS,
18
18
  ConfigProfilesSchema,
19
19
  MagicContextConfigSchema
20
- } from "./server-e6xneh68.js";
20
+ } from "./server-arfzfxe8.js";
21
21
 
22
22
  // src/config/index.ts
23
23
  import { existsSync as existsSync4 } from "node:fs";
@@ -3255,6 +3255,7 @@ function loadRawConfigFile(options) {
3255
3255
 
3256
3256
  // src/config/removed-agent-config.ts
3257
3257
  var REMOVED_AGENT_CONFIG_KEY = "sidekick";
3258
+ var REMOVED_DREAMER_KEYS = ["prompt", "tools", "permission"];
3258
3259
  var REMOVED_AGENT_CONFIG_WARNING = `The "${REMOVED_AGENT_CONFIG_KEY}" configuration was removed and is ignored.`;
3259
3260
  function isPlainObject3(value) {
3260
3261
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -3284,6 +3285,19 @@ function stripRemovedAgentConfig(rawConfig, warnings) {
3284
3285
  if (removed && !warnings.includes(REMOVED_AGENT_CONFIG_WARNING)) {
3285
3286
  warnings.push(REMOVED_AGENT_CONFIG_WARNING);
3286
3287
  }
3288
+ if (isPlainObject3(patched.dreamer)) {
3289
+ const dreamer = { ...patched.dreamer };
3290
+ for (const key of REMOVED_DREAMER_KEYS) {
3291
+ if (!Object.hasOwn(dreamer, key))
3292
+ continue;
3293
+ delete dreamer[key];
3294
+ removed = true;
3295
+ const warning = `dreamer.${key} has no effect; remove it from your settings.`;
3296
+ if (!warnings.includes(warning))
3297
+ warnings.push(warning);
3298
+ }
3299
+ patched.dreamer = dreamer;
3300
+ }
3287
3301
  return removed ? patched : rawConfig;
3288
3302
  }
3289
3303