@cortexkit/opencode-magic-context 0.49.7 → 0.49.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/dist/agents/hidden-agent-registrations.d.ts +5 -3
  2. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
  3. package/dist/auto-search-worker.js +6 -6
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/{compaction-marker-candidates-a0edbqrr.js → compaction-marker-candidates-xxz35vwp.js} +3 -3
  6. package/dist/config/schema/agent-overrides.d.ts +13 -13
  7. package/dist/config/schema/magic-context.d.ts +500 -500
  8. package/dist/{conflict-warning-hook-myk5hbt9.js → conflict-warning-hook-w3crzrar.js} +8 -8
  9. package/dist/{context-ffr7e0g7.js → context-ey3ap3cc.js} +81 -53
  10. package/dist/{derive-budgets-j4ry8j8n.js → derive-budgets-3nbxsyss.js} +2 -2
  11. package/dist/embedding-backfill-3h2m5n0q.js +21 -0
  12. package/dist/embedding-worker-process.js +6 -2
  13. package/dist/embedding-worker.js +6 -5
  14. package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
  15. package/dist/features/magic-context/dreamer/cron.d.ts +2 -0
  16. package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +1 -0
  18. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
  19. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  20. package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
  21. package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
  22. package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
  23. package/dist/features/magic-context/primer-clustering.d.ts.map +1 -1
  24. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  25. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts +1 -1
  26. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts.map +1 -1
  27. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
  28. package/dist/features/magic-context/smart-notes/wake-plane.d.ts.map +1 -1
  29. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  30. package/dist/history-owner-ty29fz0f.js +244 -0
  31. package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts +34 -0
  33. package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts.map +1 -0
  34. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +1 -0
  39. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/edit-marker.d.ts +2 -0
  42. package/dist/hooks/magic-context/edit-marker.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +2 -0
  44. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/module-transport.d.ts +1 -0
  48. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/provider-visible-parts.d.ts +10 -4
  50. package/dist/hooks/magic-context/provider-visible-parts.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/read-session-chunk.d.ts +8 -4
  53. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/rust-mode-transform.d.ts +1 -0
  55. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/rust-refusal-recovery.d.ts.map +1 -1
  57. package/dist/hooks/magic-context/supersession-reclaim.d.ts +5 -3
  58. package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
  59. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts +18 -0
  60. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts.map +1 -0
  61. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +5 -1
  62. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  63. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  64. package/dist/hooks/magic-context/tool-reclaim.d.ts +5 -2
  65. package/dist/hooks/magic-context/tool-reclaim.d.ts.map +1 -1
  66. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
  67. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  68. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  69. package/dist/hooks/magic-context/unresolved-history-boundary.d.ts +5 -1
  70. package/dist/hooks/magic-context/unresolved-history-boundary.d.ts.map +1 -1
  71. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  72. package/dist/{index-g8qbdb03.js → index-0jz47061.js} +6 -3
  73. package/dist/{index-wq16ahsn.js → index-0x9cn9w1.js} +8 -8
  74. package/dist/{index-4mjhqadz.js → index-150zz6fh.js} +1 -1
  75. package/dist/{index-n7kwfw2r.js → index-16vwdyy5.js} +7 -7
  76. package/dist/{index-rwmpkss5.js → index-21919gcq.js} +4 -4
  77. package/dist/{index-5tbvdff4.js → index-3403gbzj.js} +200 -135
  78. package/dist/{index-0gyq3djm.js → index-4hb8nt93.js} +3 -3
  79. package/dist/{index-ebnngykq.js → index-6k86es2p.js} +142 -27
  80. package/dist/{index-ax2jhztn.js → index-7bjgyaj1.js} +4 -4
  81. package/dist/{index-h2wc01qk.js → index-9jvab89d.js} +2 -2
  82. package/dist/{index-w6bd03dc.js → index-a43xq1pg.js} +5 -5
  83. package/dist/{index-tqf7yg27.js → index-a4b0gbyg.js} +1 -1
  84. package/dist/{index-j5hce1ab.js → index-a865mj02.js} +5 -5
  85. package/dist/{index-37q80veb.js → index-angx1s0k.js} +4 -3
  86. package/dist/{index-z1tjp257.js → index-b64n4d0h.js} +1 -1
  87. package/dist/{index-gbmqa9x9.js → index-bmwfzz28.js} +9 -6
  88. package/dist/{index-tmtty2x5.js → index-f8cn4xqa.js} +290 -61
  89. package/dist/{index-j58gqrn2.js → index-ffa8x2as.js} +31 -24
  90. package/dist/{index-1bt88epp.js → index-g7jkrz0x.js} +36 -16
  91. package/dist/{index-qx53vezw.js → index-gjvjh960.js} +1 -1
  92. package/dist/{index-w23dh319.js → index-jw4gbfkv.js} +1 -1
  93. package/dist/index-knvkbfvh.js +25 -0
  94. package/dist/{index-vkbqdnkj.js → index-kvw6xew3.js} +6 -3
  95. package/dist/{index-rzmjkdd6.js → index-mp2kghkv.js} +3 -27
  96. package/dist/{index-nsjyysj0.js → index-mvvephtj.js} +5 -1
  97. package/dist/{index-9yyqq3mm.js → index-n78avt2p.js} +1 -1
  98. package/dist/{index-w6vr754t.js → index-nenz4gpb.js} +13 -9
  99. package/dist/{index-vt4sf4ep.js → index-pgy3h49n.js} +4 -4
  100. package/dist/{v2/server-1rfgbjfn.js → index-q28hsbpg.js} +15 -3
  101. package/dist/{index-a8acx4gc.js → index-q76br5zn.js} +3 -3
  102. package/dist/{index-sf94at64.js → index-rg1cezmj.js} +22 -22
  103. package/dist/{index-sh91t19a.js → index-s178h9z8.js} +4 -3
  104. package/dist/{index-4btknbqh.js → index-swgpe402.js} +48 -38
  105. package/dist/{index-k6xvbj2e.js → index-w28y7d0z.js} +2 -0
  106. package/dist/{index-j8epsc0g.js → index-wafzvyhg.js} +33 -10
  107. package/dist/{index-n5a170gs.js → index-wpwpn7nj.js} +166 -63
  108. package/dist/{index-tagss15p.js → index-x57ep4fp.js} +124 -63
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +84 -79
  111. package/dist/{logger-ewak5q1s.js → logger-wn328tfg.js} +1 -1
  112. package/dist/{message-index-rqtse28y.js → message-index-6r1x9cqh.js} +16 -16
  113. package/dist/{message-index-bounded-04rycpx4.js → message-index-bounded-fskdyc81.js} +16 -16
  114. package/dist/{message-time-backfill-a5ytnp53.js → message-time-backfill-nb5hhnrt.js} +3 -3
  115. package/dist/migration-worker.js +11 -11
  116. package/dist/plugin/boot-quiet.d.ts.map +1 -1
  117. package/dist/plugin/dream-timer.d.ts.map +1 -1
  118. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  119. package/dist/plugin/rpc-handlers.d.ts +2 -0
  120. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  121. package/dist/{project-embedding-registry-k0sd9k7v.js → project-embedding-registry-vy7sv9jt.js} +11 -11
  122. package/dist/raw-ordinal-warmup-worker.js +6 -6
  123. package/dist/{read-session-chunk-h1btx938.js → read-session-chunk-zgpvs423.js} +11 -11
  124. package/dist/{read-session-raw-vdf4wh78.js → read-session-raw-gm6xj30v.js} +3 -3
  125. package/dist/recomp-orchestrator-77xc8wpe.js +60 -0
  126. package/dist/{safe-notification-target-q0cyrx3x.js → safe-notification-target-jdynm677.js} +2 -2
  127. package/dist/{search-3rbdx6hw.js → search-72fkjwk2.js} +24 -24
  128. package/dist/{send-session-notification-2tp44tfa.js → send-session-notification-q8ngbap3.js} +6 -6
  129. package/dist/shared/hidden-zen-read.d.ts +24 -0
  130. package/dist/shared/hidden-zen-read.d.ts.map +1 -0
  131. package/dist/shared/history-owner.d.ts +12 -0
  132. package/dist/shared/history-owner.d.ts.map +1 -0
  133. package/dist/shared/off-thread-migration-clock.d.ts +8 -1
  134. package/dist/shared/off-thread-migration-clock.d.ts.map +1 -1
  135. package/dist/shared/reclaim-distance.d.ts +33 -0
  136. package/dist/shared/reclaim-distance.d.ts.map +1 -0
  137. package/dist/shared/redaction.d.ts.map +1 -1
  138. package/dist/shared/rpc-server.d.ts.map +1 -1
  139. package/dist/shared/sqlite.d.ts +2 -0
  140. package/dist/shared/sqlite.d.ts.map +1 -1
  141. package/dist/shared/stable-json.d.ts +7 -0
  142. package/dist/shared/stable-json.d.ts.map +1 -1
  143. package/dist/shared/tail-hygiene-json.d.ts +22 -0
  144. package/dist/shared/tail-hygiene-json.d.ts.map +1 -0
  145. package/dist/shared/transcript.d.ts +5 -0
  146. package/dist/shared/transcript.d.ts.map +1 -1
  147. package/dist/shared/user-facing-codes.d.ts +2 -2
  148. package/dist/{sqlite-j3tvg8r0.js → sqlite-4pqyynrs.js} +3 -1
  149. package/dist/{storage-memory-8168bgef.js → storage-memory-j3v3hc83.js} +2 -2
  150. package/dist/{storage-tags-61z5j2f9.js → storage-tags-35m4gms2.js} +5 -5
  151. package/dist/{transform-postprocess-phase-7qts7h54.js → transform-postprocess-phase-r8d406j0.js} +30 -30
  152. package/dist/v2/auto-search-worker.js +6 -6
  153. package/dist/v2/{compaction-marker-candidates-6nypjkpf.js → compaction-marker-candidates-a15w3mqh.js} +3 -3
  154. package/dist/v2/compaction-marker-candidates-worker.js +2 -2
  155. package/dist/v2/{context-xq4rtywr.js → context-z2yagwy4.js} +293 -91
  156. package/dist/v2/{derive-budgets-enckmg7y.js → derive-budgets-0rmpmxjw.js} +3 -3
  157. package/dist/v2/embedding-backfill-vr7wdtrf.js +20 -0
  158. package/dist/v2/embedding-worker-process.js +6 -2
  159. package/dist/v2/embedding-worker.js +6 -5
  160. package/dist/v2/hidden-completion.d.ts.map +1 -1
  161. package/dist/v2/history-owner-2cr9py37.js +243 -0
  162. package/dist/v2/hooks/context.d.ts.map +1 -1
  163. package/dist/v2/hooks/hidden-child.d.ts +2 -2
  164. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  165. package/dist/v2/hooks/store.d.ts +1 -0
  166. package/dist/v2/hooks/store.d.ts.map +1 -1
  167. package/dist/v2/{logger-pj02s7sr.js → logger-te6e1j72.js} +1 -1
  168. package/dist/v2/{message-index-8e5z2xx8.js → message-index-9ezq6wze.js} +16 -16
  169. package/dist/v2/{message-index-bounded-5vh1h2g7.js → message-index-bounded-rqc603f2.js} +16 -16
  170. package/dist/v2/{message-time-backfill-2z365239.js → message-time-backfill-rz1pnpaj.js} +3 -3
  171. package/dist/v2/migration-worker.js +11 -11
  172. package/dist/v2/{project-embedding-registry-b77awytr.js → project-embedding-registry-ja23aygk.js} +11 -11
  173. package/dist/v2/raw-ordinal-warmup-worker.js +6 -6
  174. package/dist/v2/{read-session-chunk-4sat83cx.js → read-session-chunk-7f87tg2q.js} +11 -11
  175. package/dist/v2/{read-session-raw-a3hw9jsp.js → read-session-raw-h4azh85b.js} +3 -3
  176. package/dist/v2/recomp-orchestrator-s5tdpsbs.js +59 -0
  177. package/dist/v2/{safe-notification-target-y3p1hce9.js → safe-notification-target-936374xx.js} +2 -2
  178. package/dist/v2/search-2td1b1wy.js +46 -0
  179. package/dist/v2/{send-session-notification-ppgc8qdz.js → send-session-notification-6n7chhyp.js} +6 -6
  180. package/dist/v2/{server-v4fwha43.js → server-23znwjqk.js} +48 -38
  181. package/dist/v2/{server-nfan6zb6.js → server-2hxypdx5.js} +31 -24
  182. package/dist/v2/{server-ras2sxnc.js → server-44ryn9rb.js} +9 -6
  183. package/dist/v2/{server-fw31krgq.js → server-4easnf78.js} +19 -19
  184. package/dist/v2/{server-d6g4whc2.js → server-4qr18rfg.js} +3 -3
  185. package/dist/v2/{server-sy4b1sra.js → server-4rs8sm06.js} +5 -5
  186. package/dist/v2/{server-jdwd03ep.js → server-4zwx20yg.js} +7 -7
  187. package/dist/v2/{server-brhj8qtd.js → server-63ha7f0f.js} +3 -27
  188. package/dist/v2/{server-3t0q2cqx.js → server-7dv9wt9r.js} +1 -1
  189. package/dist/v2/{server-cw6521wn.js → server-7e087rvk.js} +2 -0
  190. package/dist/v2/{server-6byqfbqf.js → server-89fcbe37.js} +36 -16
  191. package/dist/v2/{server-hb6xhh9q.js → server-988cqjme.js} +6 -3
  192. package/dist/v2/{server-fpqe39as.js → server-9a6bwc12.js} +4 -4
  193. package/dist/v2/{server-t4k4qexw.js → server-9e5r8y60.js} +5 -1
  194. package/dist/v2/{server-qcw43339.js → server-ak7w74j9.js} +4 -4
  195. package/dist/v2/{server-dd0nja67.js → server-bx59ezg6.js} +4 -3
  196. package/dist/v2/{server-mv1w7t6z.js → server-c9w52qss.js} +99 -43
  197. package/dist/v2/{server-676xw7at.js → server-ckrb5rm8.js} +1 -1
  198. package/dist/{index-w4mw92w3.js → v2/server-cxsr0ng6.js} +15 -3
  199. package/dist/v2/{server-hcvcxzx7.js → server-f27he3j1.js} +5 -5
  200. package/dist/v2/{server-gtv9wbhq.js → server-gc8x2xdb.js} +144 -63
  201. package/dist/v2/{server-t528t8qm.js → server-hn9fb3v0.js} +2 -2
  202. package/dist/v2/{server-w3zeywp1.js → server-kmapq3v0.js} +289 -60
  203. package/dist/v2/server-knvkbfvh.js +25 -0
  204. package/dist/v2/{server-9yyqq3mm.js → server-n78avt2p.js} +1 -1
  205. package/dist/v2/{server-kdrezdy0.js → server-njnx39q2.js} +6 -3
  206. package/dist/v2/{server-x08d1xf3.js → server-npm52h2q.js} +4 -3
  207. package/dist/v2/{server-vb7pbd9p.js → server-nveratm5.js} +1 -1
  208. package/dist/v2/{server-kzns2hbz.js → server-s6jqh8bj.js} +1 -1
  209. package/dist/v2/{server-j8epsc0g.js → server-wafzvyhg.js} +33 -10
  210. package/dist/v2/{server-7ekna9zs.js → server-xqf2d2mg.js} +2 -2
  211. package/dist/v2/{server-7srtwsa4.js → server-z0rjemg1.js} +9 -9
  212. package/dist/v2/{server-wkdgjjch.js → server-zrwaj29a.js} +2 -2
  213. package/dist/v2/server.js +7 -6
  214. package/dist/v2/{sqlite-j3tvg8r0.js → sqlite-4pqyynrs.js} +3 -1
  215. package/dist/v2/{storage-memory-8168bgef.js → storage-memory-j3v3hc83.js} +2 -2
  216. package/dist/v2/{storage-tags-j2fzq3sw.js → storage-tags-c4zfcxv4.js} +5 -5
  217. package/dist/v2/store-reader.d.ts.map +1 -1
  218. package/dist/v2/{wrapup-orchestrator-s92ebfzv.js → wrapup-orchestrator-wg8dmmm9.js} +38 -35
  219. package/dist/wrapup-orchestrator-b1z99yg5.js +47 -0
  220. package/package.json +1 -1
  221. package/src/agents/hidden-agent-registrations.ts +22 -4
  222. package/src/config/compaction-accessor-guard.test.ts +3 -0
  223. package/src/features/magic-context/dreamer/cron.ts +8 -0
  224. package/src/shared/hidden-zen-read.test.ts +99 -0
  225. package/src/shared/hidden-zen-read.ts +88 -0
  226. package/src/shared/history-owner.test.ts +60 -0
  227. package/src/shared/history-owner.ts +43 -0
  228. package/src/shared/host-stall-profiler-node.ts +3 -1
  229. package/src/shared/host-stall-profiler.ts +3 -1
  230. package/src/shared/off-thread-migration-clock.test.ts +80 -10
  231. package/src/shared/off-thread-migration-clock.ts +37 -13
  232. package/src/shared/reclaim-distance.test.ts +111 -0
  233. package/src/shared/reclaim-distance.ts +91 -0
  234. package/src/shared/redaction.test.ts +16 -0
  235. package/src/shared/redaction.ts +8 -1
  236. package/src/shared/root-async-context.probe.mjs +36 -0
  237. package/src/shared/root-async-context.test.ts +49 -0
  238. package/src/shared/rpc-server.ts +27 -23
  239. package/src/shared/sqlite-busy-budget-review.test.ts +291 -0
  240. package/src/shared/sqlite-foreground-wait.test.ts +253 -1
  241. package/src/shared/sqlite.ts +55 -14
  242. package/src/shared/stable-json.ts +56 -14
  243. package/src/shared/tail-hygiene-json.test.ts +117 -0
  244. package/src/shared/tail-hygiene-json.ts +217 -0
  245. package/src/shared/transcript.ts +7 -0
  246. package/src/shared/user-facing-codes.ts +2 -2
  247. package/dist/embedding-backfill-re16xncd.js +0 -21
  248. package/dist/recomp-orchestrator-trcgmm23.js +0 -60
  249. package/dist/v2/embedding-backfill-xd9ygzgd.js +0 -20
  250. package/dist/v2/recomp-orchestrator-n11zv1f1.js +0 -59
  251. package/dist/v2/search-mvgqtkkz.js +0 -46
  252. package/dist/wrapup-orchestrator-df61jmz9.js +0 -47
@@ -9,7 +9,7 @@ import {
9
9
  sanitizeDiagnosticText,
10
10
  log2,
11
11
  sessionLog2
12
- } from "./server-t4k4qexw.js";
12
+ } from "./server-9e5r8y60.js";
13
13
  import {
14
14
  parseJsoncRecovering,
15
15
  detectConfigFile,
@@ -17,34 +17,32 @@ import {
17
17
  cortexKitProjectConfigBasePath,
18
18
  resolveLegacyConfigSourcesForHarness,
19
19
  loadPluginConfigDetailed
20
- } from "./server-d6g4whc2.js";
20
+ } from "./server-4qr18rfg.js";
21
21
  import {
22
22
  catalogOutputReserve,
23
23
  getSdkContextLimit,
24
24
  modelSupportsVision,
25
25
  getSdkOutputLimit
26
- } from "./server-vb7pbd9p.js";
26
+ } from "./server-nveratm5.js";
27
27
  import {
28
28
  withContentLanguageDirective,
29
29
  buildPrimaryLanguageDirective,
30
30
  resolvePromptSurface,
31
31
  DEFAULT_HISTORIAN_TIMEOUT_MS,
32
32
  LIVE_RELOAD_CONFIG_PATHS
33
- } from "./server-cw6521wn.js";
33
+ } from "./server-7e087rvk.js";
34
34
  import {
35
35
  hasMeaningfulUserText2,
36
36
  estimateTokens,
37
37
  estimateFixedPromptTokens
38
- } from "./server-kzns2hbz.js";
38
+ } from "./server-s6jqh8bj.js";
39
39
  import {
40
+ inRootAsyncContext2,
40
41
  Database2,
41
42
  withSqliteBackgroundWriter2,
42
43
  withoutSqliteTransformPass2,
43
44
  beginSqliteWriterAsync2
44
- } from "./server-j8epsc0g.js";
45
- import {
46
- sameProjectDirectory
47
- } from "./server-brhj8qtd.js";
45
+ } from "./server-wafzvyhg.js";
48
46
  import {
49
47
  buildCanonicalChunkTextFromFts,
50
48
  buildCompartmentSummaryFallbackText,
@@ -54,10 +52,10 @@ import {
54
52
  replaceCompartmentChunkEmbeddings,
55
53
  deleteChunkEmbedBackoffForSession,
56
54
  chunkWindowSourceKey
57
- } from "./server-fpqe39as.js";
55
+ } from "./server-9a6bwc12.js";
58
56
  import {
59
57
  isPidAlive
60
- } from "./server-1rfgbjfn.js";
58
+ } from "./server-cxsr0ng6.js";
61
59
  import {
62
60
  BoundedSessionMap,
63
61
  clearCompressionDepth,
@@ -72,7 +70,7 @@ import {
72
70
  toMessageIndexSource2,
73
71
  clearIndexedMessagesInTransaction2,
74
72
  indexSourcesAfterOrdinal2
75
- } from "./server-7srtwsa4.js";
73
+ } from "./server-z0rjemg1.js";
76
74
  import {
77
75
  detectOverflow,
78
76
  SESSION_META_SELECT_COLUMNS,
@@ -99,6 +97,10 @@ import {
99
97
  registerBudgetFinalizeChild,
100
98
  releaseBudgetFinalizeChild,
101
99
  createDreamTokenBudget,
100
+ TOOL_USE_DISABLED,
101
+ needsBlockedRead,
102
+ withBlockedReadInstruction,
103
+ rememberV1HiddenRun,
102
104
  MERGED_REASONING_PARTS_PREFIX,
103
105
  decodeMergedReasoningParts,
104
106
  escalationBands,
@@ -161,17 +163,17 @@ import {
161
163
  getRawSessionTagKeysThrough2,
162
164
  getLegacyProtectedTailStartOrdinal2,
163
165
  readSessionChunk2
164
- } from "./server-gtv9wbhq.js";
166
+ } from "./server-gc8x2xdb.js";
165
167
  import {
166
168
  getTableColumnNames
167
- } from "./server-6byqfbqf.js";
169
+ } from "./server-89fcbe37.js";
168
170
  import {
169
171
  FAIL_CLOSED_DOCTOR_COMMAND,
170
172
  getSchemaFenceRejection,
171
173
  LATEST_SUPPORTED_VERSION,
172
174
  getPersistedSchemaVersion,
173
175
  openDatabase
174
- } from "./server-v4fwha43.js";
176
+ } from "./server-23znwjqk.js";
175
177
  import {
176
178
  providerMass,
177
179
  calibrationForModelKey,
@@ -189,11 +191,11 @@ import {
189
191
  foldShrunkPartTags2,
190
192
  getTagNumberByMessageId2,
191
193
  getActiveTagsBySession2
192
- } from "./server-w3zeywp1.js";
194
+ } from "./server-kmapq3v0.js";
193
195
  import {
194
196
  isStrictGapHealingMessage2,
195
197
  noteRawSessionSummaryRowWritten2
196
- } from "./server-dd0nja67.js";
198
+ } from "./server-bx59ezg6.js";
197
199
  import {
198
200
  resolveOpenCodeDbPath,
199
201
  assertOpenCodeStoreGeneration,
@@ -203,10 +205,10 @@ import {
203
205
  import {
204
206
  withReadOnlySessionDb,
205
207
  getMessageTimesFromOpenCodeDb
206
- } from "./server-wkdgjjch.js";
208
+ } from "./server-zrwaj29a.js";
207
209
  import {
208
210
  getMeasuredToolDefinitionTokens
209
- } from "./server-7ekna9zs.js";
211
+ } from "./server-xqf2d2mg.js";
210
212
  import {
211
213
  V2_MEMORY_CATEGORIES,
212
214
  CATEGORY_PRIORITY,
@@ -222,11 +224,11 @@ import {
222
224
  resolveStoredPathWorkspaceIdentity,
223
225
  sourceNameForMemory,
224
226
  computeWorkspaceEpochFingerprint
225
- } from "./server-hcvcxzx7.js";
227
+ } from "./server-f27he3j1.js";
226
228
  import {
227
229
  shouldSkipHomeProjectMemory,
228
230
  resolveProjectIdentity
229
- } from "./server-kdrezdy0.js";
231
+ } from "./server-njnx39q2.js";
230
232
  import {
231
233
  drainBackgroundBatches,
232
234
  contentSha2562,
@@ -234,7 +236,7 @@ import {
234
236
  getProjectChunkEmbeddingModelId2,
235
237
  getProjectEmbeddingMaxInputTokens2,
236
238
  embedItemsForProject2
237
- } from "./server-fw31krgq.js";
239
+ } from "./server-4easnf78.js";
238
240
  import {
239
241
  getSessionNotes,
240
242
  getReadySmartNotes,
@@ -243,13 +245,13 @@ import {
243
245
  userFacingFailureCode,
244
246
  promoteSessionFactsDurable,
245
247
  embedPromotedFacts
246
- } from "./server-jdwd03ep.js";
248
+ } from "./server-4zwx20yg.js";
247
249
  import {
248
250
  isMarkerCandidateBasisCurrent2,
249
251
  invalidateMarkerCandidateBasis2,
250
252
  readMarkerCandidateBasis2,
251
253
  prepareMarkerCandidateBasis2
252
- } from "./server-x08d1xf3.js";
254
+ } from "./server-npm52h2q.js";
253
255
  import {
254
256
  computeCueContentHash,
255
257
  getMuralCueState,
@@ -257,7 +259,7 @@ import {
257
259
  getMemoriesByProject2,
258
260
  getMemoriesByProjects2,
259
261
  getMaxMemoryIdForProjects2
260
- } from "./server-9yyqq3mm.js";
262
+ } from "./server-n78avt2p.js";
261
263
  import {
262
264
  pushNotification2
263
265
  } from "./server-x8a7jmkh.js";
@@ -265,10 +267,13 @@ import {
265
267
  deriveTriggerBudget2,
266
268
  resolveHistorianProducerLimits2,
267
269
  producerSourceLocalBudget2
268
- } from "./server-t528t8qm.js";
270
+ } from "./server-hn9fb3v0.js";
269
271
  import {
270
272
  sendStatusNotification2
271
- } from "./server-qcw43339.js";
273
+ } from "./server-ak7w74j9.js";
274
+ import {
275
+ sameProjectDirectory
276
+ } from "./server-knvkbfvh.js";
272
277
  import {
273
278
  getErrorMessage,
274
279
  describeError
@@ -282,7 +287,7 @@ import {
282
287
  import {
283
288
  logSlowWriteTransaction,
284
289
  WriteTransactionSteps
285
- } from "./server-3t0q2cqx.js";
290
+ } from "./server-7dv9wt9r.js";
286
291
 
287
292
  // src/config/live-snapshot.ts
288
293
  import { createHash } from "node:crypto";
@@ -1111,7 +1116,7 @@ var V2_MESSAGE_PAGE_SQL = `WITH bounds AS (
1111
1116
  SELECT seq FROM session_message
1112
1117
  WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
1113
1118
  ORDER BY seq ASC LIMIT 1 OFFSET ?
1114
- ), -1) END AS after_seq,
1119
+ ), (SELECT MAX(seq) FROM session_message WHERE session_id = ?), -1) END AS after_seq,
1115
1120
  COALESCE((
1116
1121
  SELECT seq FROM session_message
1117
1122
  WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
@@ -1372,7 +1377,7 @@ class V2StoreReader {
1372
1377
  }
1373
1378
  }
1374
1379
  const maximumSeq = Number.MAX_SAFE_INTEGER;
1375
- 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);
1380
+ 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);
1376
1381
  return rows.map(decode);
1377
1382
  });
1378
1383
  }
@@ -6523,10 +6528,12 @@ function hiddenToolLoop(identity) {
6523
6528
  function hiddenAgentAllowedTools(agent) {
6524
6529
  return agent !== undefined && Object.hasOwn(AGENT_TOOLS, agent) ? AGENT_TOOLS[agent] : undefined;
6525
6530
  }
6526
- function hiddenChildPermissions(agent) {
6531
+ function hiddenChildPermissions(agent, providerID) {
6532
+ const tools = AGENT_TOOLS[agent] ?? [];
6533
+ const visible = tools.length === 0 && needsBlockedRead(agent, providerID) ? ["read"] : tools;
6527
6534
  return [
6528
6535
  { action: "*", resource: "*", effect: "deny" },
6529
- ...(AGENT_TOOLS[agent] ?? []).map((tool) => ({
6536
+ ...visible.map((tool) => ({
6530
6537
  action: tool,
6531
6538
  resource: "*",
6532
6539
  effect: "allow"
@@ -6545,7 +6552,7 @@ async function registerHiddenChildAgents(agent) {
6545
6552
  config.request.headers = {};
6546
6553
  config.request.body = {};
6547
6554
  config.steps = AGENT_STEPS[id];
6548
- config.permissions = hiddenChildPermissions(id);
6555
+ config.permissions = hiddenChildPermissions(id, "opencode");
6549
6556
  });
6550
6557
  }
6551
6558
  });
@@ -6559,6 +6566,8 @@ function hiddenToolCallRefusal(call, hook) {
6559
6566
  }
6560
6567
  if (allowed.includes(call.tool))
6561
6568
  return;
6569
+ if (owned && allowed.length === 0)
6570
+ return `${TOOL_USE_DISABLED}; ${call.tool} refused`;
6562
6571
  return `Magic Context hidden agent ${agent} may only use ${allowed.length > 0 ? allowed.join(", ") : "no tools"}; ${call.tool} refused`;
6563
6572
  }
6564
6573
 
@@ -6762,7 +6771,13 @@ class HiddenChildHook {
6762
6771
  }
6763
6772
  selected.steps = steps;
6764
6773
  const system = typeof selected.request.body.system === "string" ? selected.request.body.system : selected.identity.system;
6765
- draft.system = [{ type: "text", text: system }];
6774
+ const blockedRead = needsBlockedRead(selected.identity.agent, draft.model.providerID) && draft.tools.read !== undefined;
6775
+ draft.system = [
6776
+ {
6777
+ type: "text",
6778
+ text: blockedRead ? withBlockedReadInstruction(system, selected.identity) : system
6779
+ }
6780
+ ];
6766
6781
  if (!selected.shaped) {
6767
6782
  draft.messages = [
6768
6783
  { role: "user", content: this.calibratedParts(selected, draft, raw) }
@@ -6784,7 +6799,7 @@ class HiddenChildHook {
6784
6799
  ];
6785
6800
  }
6786
6801
  draft.options = authoredOptions(selected);
6787
- const allowed = AGENT_TOOLS[hiddenAgentFor(selected.identity)] ?? [];
6802
+ const allowed = blockedRead ? ["read"] : AGENT_TOOLS[hiddenAgentFor(selected.identity)] ?? [];
6788
6803
  draft.tools = Object.fromEntries(allowed.flatMap((id) => draft.tools[id] ? [[id, draft.tools[id]]] : []));
6789
6804
  if (selected.identity.agent === DREAMER_MEMORY_MAPPER_AGENT && steps >= cap - 2) {
6790
6805
  selected.budget ??= createDreamTokenBudget(typeof selected.identity.metadata?.tokenBudget === "number" ? selected.identity.metadata.tokenBudget : Number.MAX_SAFE_INTEGER);
@@ -12991,6 +13006,37 @@ function capturePrefixTrimSourceOrder(messages) {
12991
13006
  invalidReason
12992
13007
  });
12993
13008
  }
13009
+ function reanchorStoredBoundary(options, boundary) {
13010
+ if (!options.messages)
13011
+ return;
13012
+ const source = options.prefixTrimSourceOrder ?? capturePrefixTrimSourceOrder(options.messages);
13013
+ if (source.invalidReason)
13014
+ return;
13015
+ try {
13016
+ if (compareRawSessionMessageOrder2(options.sessionId, boundary, boundary) !== 0)
13017
+ return;
13018
+ const messageIds = [...source.messageIds];
13019
+ let previous;
13020
+ let insertion = messageIds.length;
13021
+ for (const [index, id] of messageIds.entries()) {
13022
+ if (previous) {
13023
+ const increasing = compareRawSessionMessageOrder2(options.sessionId, previous, id);
13024
+ if (increasing === null || !Number.isFinite(increasing) || increasing >= 0)
13025
+ return;
13026
+ }
13027
+ const order = compareRawSessionMessageOrder2(options.sessionId, boundary, id);
13028
+ if (order === null || !Number.isFinite(order) || order === 0)
13029
+ return;
13030
+ if (order < 0 && insertion === messageIds.length)
13031
+ insertion = index;
13032
+ previous = id;
13033
+ }
13034
+ messageIds.splice(insertion, 0, boundary);
13035
+ return { ...source, messageIds };
13036
+ } catch {
13037
+ return;
13038
+ }
13039
+ }
12994
13040
  function trimToPreparedPrefix(options, prepared) {
12995
13041
  if (options.compactionOff || !options.messages)
12996
13042
  return "not-attempted";
@@ -13015,7 +13061,8 @@ function trimToPreparedPrefix(options, prepared) {
13015
13061
  });
13016
13062
  const boundaryPosition = sourcePosition.get(boundary) ?? sourcePosition.get(resolveHostServedBoundaryId2(options.sessionId, boundary));
13017
13063
  if (boundaryPosition === undefined) {
13018
- status = refuse("boundary absent from immutable source order");
13064
+ const reanchored = reanchorStoredBoundary(options, boundary);
13065
+ status = reanchored ? trimToPreparedPrefix({ ...options, prefixTrimSourceOrder: reanchored }, prepared) : refuse("boundary absent from immutable source order");
13019
13066
  } else {
13020
13067
  let lastSourcePosition = -1;
13021
13068
  let sawPersistedRow = false;
@@ -13026,8 +13073,7 @@ function trimToPreparedPrefix(options, prepared) {
13026
13073
  for (const [index, message] of options.messages.entries()) {
13027
13074
  const id = message.info.id;
13028
13075
  if (isHostRenderedSystemMessage(message)) {
13029
- if (lastSourcePosition >= boundaryPosition)
13030
- retained.push(message);
13076
+ retained.push(message);
13031
13077
  continue;
13032
13078
  }
13033
13079
  if (typeof id !== "string" || id.length === 0) {
@@ -13070,12 +13116,19 @@ function trimToPreparedPrefix(options, prepared) {
13070
13116
  } else {
13071
13117
  const index = findBoundaryIndex(options.sessionId, options.messages, boundary);
13072
13118
  if (index >= 0) {
13073
- const removed = options.messages.splice(0, index + (isPartialCompartmentEnd(options.db, options.sessionId, boundary) ? 0 : 1));
13119
+ const cut = index + (isPartialCompartmentEnd(options.db, options.sessionId, boundary) ? 0 : 1);
13120
+ const unplaced = options.messages.slice(0, cut).filter(isHostRenderedSystemMessage);
13121
+ const removed = options.messages.splice(0, cut, ...unplaced);
13074
13122
  retireDecisions(removed.map((message) => message.info.id).filter((id) => typeof id === "string"));
13075
13123
  resetPrefixTrimFallbackState(options.sessionId);
13076
13124
  status = "applied";
13077
13125
  } else {
13078
- status = classifyAbsentBoundary(options, options.messages, boundary);
13126
+ const reanchored = reanchorStoredBoundary(options, boundary);
13127
+ if (reanchored && reanchored.messageIds[0] !== boundary) {
13128
+ status = trimToPreparedPrefix({ ...options, prefixTrimSourceOrder: reanchored }, prepared);
13129
+ } else {
13130
+ status = classifyAbsentBoundary(options, options.messages, boundary);
13131
+ }
13079
13132
  }
13080
13133
  }
13081
13134
  }
@@ -15439,6 +15492,8 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
15439
15492
  preferResponseOnMissingData: true
15440
15493
  });
15441
15494
  const id = typeof created?.id === "string" ? created.id : "";
15495
+ if (id)
15496
+ rememberV1HiddenRun(id, run);
15442
15497
  if (id && run.kind !== "dreamer-task") {
15443
15498
  historianChildren.add(id);
15444
15499
  rememberHistorianOutputCap(id, run.maxOutputTokens);
@@ -15489,6 +15544,7 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
15489
15544
  },
15490
15545
  async close(handle, settlement) {
15491
15546
  if (handle?.id) {
15547
+ rememberV1HiddenRun(handle.id, undefined);
15492
15548
  historianChildren.delete(handle.id);
15493
15549
  forgetHistorianOutputCap(handle.id);
15494
15550
  }
@@ -18010,6 +18066,7 @@ Historian pass ${passCount + 1}, attempt ${passAttempt} started for messages ${c
18010
18066
  sequenceOffset: candidateCompartments.length,
18011
18067
  dumpLabelBase: `recomp-${sessionId}-${chunk.startIndex}-${chunk.endIndex}-pass-${passCount + 1}`,
18012
18068
  timeoutMs: historianTimeoutMs,
18069
+ maxOutputTokens: deps.historianMaxOutputTokens,
18013
18070
  model: deps.model,
18014
18071
  fallbackModelId: deps.fallbackModelId,
18015
18072
  fallbackModels: deps.fallbackModels,
@@ -18524,7 +18581,6 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
18524
18581
  }
18525
18582
  }
18526
18583
  }
18527
-
18528
18584
  // src/hooks/magic-context/compartment-runner.ts
18529
18585
  var activeRuns = new Map;
18530
18586
  function getActiveCompartmentRun(sessionId) {
@@ -18560,7 +18616,7 @@ function withPublishedCallback(deps) {
18560
18616
  };
18561
18617
  }
18562
18618
  function startLeaseRenewal(deps, holderId) {
18563
- return setInterval(() => {
18619
+ return inRootAsyncContext2(() => setInterval(() => {
18564
18620
  try {
18565
18621
  if (!renewCompartmentLease(deps.db, deps.sessionId, holderId)) {
18566
18622
  sessionLog2(deps.sessionId, "compartment lease renewal failed; publish will be skipped if holder is stale");
@@ -18568,7 +18624,7 @@ function startLeaseRenewal(deps, holderId) {
18568
18624
  } catch (err) {
18569
18625
  sessionLog2(deps.sessionId, `compartment lease renewal threw; publish will be skipped if holder is stale (${err instanceof Error ? err.message : String(err)})`);
18570
18626
  }
18571
- }, COMPARTMENT_LEASE_RENEWAL_MS);
18627
+ }, COMPARTMENT_LEASE_RENEWAL_MS));
18572
18628
  }
18573
18629
  function startCompartmentAgent(deps, runAgent = runCompartmentAgent, prepareBoundary) {
18574
18630
  withoutSqliteTransformPass2(() => startBackgroundCompartmentAgent(deps, runAgent, prepareBoundary));
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./server-t4k4qexw.js";
3
+ } from "./server-9e5r8y60.js";
4
4
 
5
5
  // src/shared/safe-notification-target.ts
6
6
  var DEFAULT_TITLE_RE = /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log2
3
- } from "./index-nsjyysj0.js";
3
+ } from "./server-9e5r8y60.js";
4
4
  import {
5
5
  canonicalProjectDirectory
6
- } from "./index-rzmjkdd6.js";
6
+ } from "./server-knvkbfvh.js";
7
7
 
8
8
  // src/shared/rpc-utils.ts
9
9
  import { execFile, execFileSync } from "node:child_process";
@@ -34,13 +34,25 @@ function isOwnRpcServerRecord(record) {
34
34
  function projectHash(directory) {
35
35
  return createHash("sha256").update(canonicalProjectDirectory(directory)).digest("hex").slice(0, 16);
36
36
  }
37
+ function legacyProjectHash(directory) {
38
+ const normalized = directory.replace(/\/+$/, "");
39
+ return createHash("sha256").update(normalized).digest("hex").slice(0, 16);
40
+ }
37
41
  function rpcPortDir(storageDir, directory) {
38
42
  return join(storageDir, "rpc", projectHash(directory));
39
43
  }
44
+ function rpcPortDirsForLookup(storageDir, directory) {
45
+ const canonical = rpcPortDir(storageDir, directory);
46
+ const legacy = join(storageDir, "rpc", legacyProjectHash(directory));
47
+ return legacy === canonical ? [canonical] : [canonical, legacy];
48
+ }
40
49
  function rpcPortFilePath(storageDir, directory, pid = process.pid, instanceId) {
41
50
  const suffix = instanceId ? `-${instanceId}` : "";
42
51
  return join(rpcPortDir(storageDir, directory), `port-${pid}${suffix}.json`);
43
52
  }
53
+ function legacyRpcPortFilePath(storageDir, directory) {
54
+ return join(storageDir, "rpc", legacyProjectHash(directory), "port");
55
+ }
44
56
  function isPidAlive(pid) {
45
57
  if (!Number.isInteger(pid) || pid <= 0)
46
58
  return "dead";
@@ -730,4 +742,4 @@ function inspectWindowsProcessesSync() {
730
742
  };
731
743
  }
732
744
 
733
- export { registerOwnRpcServerInstance, isOwnRpcServerRecord, rpcPortDir, rpcPortFilePath, isPidAlive, readProcessStartTime, readProcessProbeEvidence, classifyProcessKind, isPidIdentityPlausible, inspectLivePiProcesses, parseRpcPortFile, inspectProcessesAsync, inspectWindowsProcessesSync };
745
+ export { registerOwnRpcServerInstance, isOwnRpcServerRecord, rpcPortDir, rpcPortDirsForLookup, rpcPortFilePath, legacyRpcPortFilePath, isPidAlive, readProcessStartTime, readProcessProbeEvidence, classifyProcessKind, isPidIdentityPlausible, inspectLivePiProcesses, parseRpcPortFile, inspectProcessesAsync, inspectWindowsProcessesSync };
@@ -3,12 +3,12 @@ import {
3
3
  } from "./server-fr0wbhdn.js";
4
4
  import {
5
5
  log2
6
- } from "./server-t4k4qexw.js";
6
+ } from "./server-9e5r8y60.js";
7
7
  import {
8
8
  ensureColumn,
9
9
  healAllNullColumns,
10
10
  installV95PerfSchema
11
- } from "./server-6byqfbqf.js";
11
+ } from "./server-89fcbe37.js";
12
12
  import {
13
13
  resolveOpenCodeDbPath,
14
14
  openCodeDbPathExists,
@@ -16,14 +16,14 @@ import {
16
16
  } from "./server-2ra6pwf3.js";
17
17
  import {
18
18
  Database2
19
- } from "./server-j8epsc0g.js";
19
+ } from "./server-wafzvyhg.js";
20
20
  import {
21
21
  normalizeStoredProjectPath,
22
22
  storedPathBelongsToIdentity
23
- } from "./server-kdrezdy0.js";
23
+ } from "./server-njnx39q2.js";
24
24
  import {
25
25
  logSlowWriteTransaction
26
- } from "./server-3t0q2cqx.js";
26
+ } from "./server-7dv9wt9r.js";
27
27
 
28
28
  // src/features/magic-context/migrations.ts
29
29
  import { isMainThread } from "node:worker_threads";