@cortexkit/opencode-magic-context 0.49.11 → 0.49.13

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 (253) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts +28 -0
  3. package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts.map +1 -0
  4. package/dist/{announcement-hdbkt8v5.js → announcement-g789dmt6.js} +2 -2
  5. package/dist/auto-search-worker.js +4 -4
  6. package/dist/chunk-embedding-write-worker.js +89 -0
  7. package/dist/{compaction-marker-candidates-xxz35vwp.js → compaction-marker-candidates-v5c6997n.js} +3 -3
  8. package/dist/compaction-marker-candidates-worker.js +1 -1
  9. package/dist/config/agent-disable.d.ts +14 -0
  10. package/dist/config/agent-disable.d.ts.map +1 -1
  11. package/dist/config/dependency-notes.d.ts +34 -0
  12. package/dist/config/dependency-notes.d.ts.map +1 -0
  13. package/dist/config/schema/agent-overrides.d.ts +12 -12
  14. package/dist/config/schema/magic-context.d.ts +88 -88
  15. package/dist/config/schema/magic-context.d.ts.map +1 -1
  16. package/dist/{conflict-warning-hook-xwkfncav.js → conflict-warning-hook-mgq17yr3.js} +8 -8
  17. package/dist/{context-twz3s0cg.js → context-azqk0vfd.js} +121 -145
  18. package/dist/{derive-budgets-3nbxsyss.js → derive-budgets-zn7yzd2d.js} +3 -3
  19. package/dist/embedding-backfill-5e1t5wha.js +22 -0
  20. package/dist/embedding-worker-process.js +2 -2
  21. package/dist/embedding-worker.js +6 -6
  22. package/dist/features/magic-context/chunk-embedding-write-worker.d.ts +2 -0
  23. package/dist/features/magic-context/chunk-embedding-write-worker.d.ts.map +1 -0
  24. package/dist/features/magic-context/chunk-embedding-writer.d.ts +48 -0
  25. package/dist/features/magic-context/chunk-embedding-writer.d.ts.map +1 -0
  26. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
  27. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  28. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +3 -2
  29. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
  30. package/dist/features/magic-context/dreamer/map-memories.d.ts +8 -1
  31. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
  32. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +2 -0
  33. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
  34. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +5 -0
  35. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
  36. package/dist/features/magic-context/dreamer/task-config.d.ts +22 -4
  37. package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
  38. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  39. package/dist/features/magic-context/dreamer/task-registry.d.ts +22 -0
  40. package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
  41. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +4 -1
  42. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  43. package/dist/features/magic-context/dreamer/verify-prompt.d.ts +6 -1
  44. package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -1
  45. package/dist/features/magic-context/dreamer/verify.d.ts +25 -11
  46. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  47. package/dist/features/magic-context/memory/embedding-openai.d.ts +32 -0
  48. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  49. package/dist/features/magic-context/memory/project-identity.d.ts +1 -0
  50. package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
  51. package/dist/features/magic-context/memory/unborn-head.d.ts +34 -0
  52. package/dist/features/magic-context/memory/unborn-head.d.ts.map +1 -0
  53. package/dist/features/magic-context/mural/compress-cues.d.ts +3 -0
  54. package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
  55. package/dist/features/magic-context/project-embedding-registry.d.ts +5 -0
  56. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  57. package/dist/features/magic-context/storage-tags.d.ts +2 -0
  58. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  59. package/dist/{history-owner-ty29fz0f.js → history-owner-xp3pngv7.js} +3 -3
  60. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  61. package/dist/hooks/magic-context/auto-embed-session.d.ts +10 -0
  62. package/dist/hooks/magic-context/auto-embed-session.d.ts.map +1 -0
  63. package/dist/hooks/magic-context/compartment-prompt.d.ts +6 -0
  64. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  65. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  66. package/dist/hooks/magic-context/compartment-runner-types.d.ts +3 -0
  67. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  68. package/dist/hooks/magic-context/compartment-trigger-error.d.ts +12 -0
  69. package/dist/hooks/magic-context/compartment-trigger-error.d.ts.map +1 -0
  70. package/dist/hooks/magic-context/embed-session-state.d.ts +8 -1
  71. package/dist/hooks/magic-context/embed-session-state.d.ts.map +1 -1
  72. package/dist/hooks/magic-context/historian-prompt-fit.d.ts +2 -0
  73. package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
  74. package/dist/hooks/magic-context/hook.d.ts +3 -1
  75. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  76. package/dist/hooks/magic-context/pending-materialization.d.ts +2 -0
  77. package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -1
  78. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +12 -0
  79. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  80. package/dist/hooks/magic-context/raw-exact-ordinal-read.d.ts +58 -0
  81. package/dist/hooks/magic-context/raw-exact-ordinal-read.d.ts.map +1 -0
  82. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +7 -0
  83. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  84. package/dist/hooks/magic-context/read-session-raw.d.ts +19 -0
  85. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  86. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +2 -0
  87. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
  88. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -0
  89. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  90. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  91. package/dist/hooks/magic-context/transform.d.ts +4 -0
  92. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  93. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  94. package/dist/{index-bzp9s8z2.js → index-1d289pq2.js} +2 -2
  95. package/dist/{index-w28y7d0z.js → index-1sarmj9z.js} +15 -15
  96. package/dist/{index-z7avx6rw.js → index-2jr1smmh.js} +280 -160
  97. package/dist/{index-4ccdr7yw.js → index-3kdm78zp.js} +5 -5
  98. package/dist/{index-9159kk15.js → index-3kx0kg0f.js} +64 -7
  99. package/dist/{index-0jz47061.js → index-a8bvhwqs.js} +190 -30
  100. package/dist/{index-84j7jq8a.js → index-aw1bh90w.js} +10 -10
  101. package/dist/{index-qr1mkc2y.js → index-b16gpywn.js} +9 -9
  102. package/dist/{index-g7jkrz0x.js → index-bp5083x2.js} +1 -1
  103. package/dist/{index-yhrrx7qa.js → index-bxdg2nbt.js} +3 -3
  104. package/dist/{index-0abg88h2.js → index-dgs16axy.js} +4 -4
  105. package/dist/{index-mp2kghkv.js → index-dyvbsvga.js} +1 -1
  106. package/dist/{index-bmwfzz28.js → index-e20m7284.js} +4 -4
  107. package/dist/{index-4jkhhpn1.js → index-e4dsjj1p.js} +3 -3
  108. package/dist/{index-s178h9z8.js → index-f71thw8j.js} +1 -1
  109. package/dist/{index-kvw6xew3.js → index-fkx2qnvw.js} +2 -2
  110. package/dist/{index-f8cn4xqa.js → index-fwefky9w.js} +18 -5
  111. package/dist/{index-0sahzkwr.js → index-g2q4htwp.js} +46 -2
  112. package/dist/{index-mw7c950g.js → index-gp3kcpc4.js} +1 -1
  113. package/dist/{index-g40wgxxt.js → index-hnm8raee.js} +4 -4
  114. package/dist/{index-gjvjh960.js → index-hqkczed7.js} +1 -1
  115. package/dist/{index-mvvephtj.js → index-j75v2476.js} +1 -1
  116. package/dist/{index-150zz6fh.js → index-k29z4aqh.js} +1 -1
  117. package/dist/{index-b64n4d0h.js → index-kee4kn5j.js} +1 -1
  118. package/dist/index-ksdyrrav.js +52 -0
  119. package/dist/{index-angx1s0k.js → index-mmfa86mt.js} +16 -6
  120. package/dist/{index-9jvab89d.js → index-n6m03s3n.js} +2 -2
  121. package/dist/{index-q28hsbpg.js → index-nj7yykkx.js} +1 -1
  122. package/dist/{index-ghc9f0n7.js → index-p5y3k4g7.js} +29 -1
  123. package/dist/{index-xztdf9t7.js → index-qkd9zz0p.js} +17 -17
  124. package/dist/index-saews2s3.js +229 -0
  125. package/dist/{index-kkvxnbt8.js → index-sj89f3b0.js} +62 -33
  126. package/dist/{index-jw4gbfkv.js → index-v10f1rjv.js} +5 -5
  127. package/dist/{index-0j6crjgh.js → index-v13skev1.js} +13 -13
  128. package/dist/{index-hqnggmxn.js → index-wj6ht7nm.js} +547 -179
  129. package/dist/{index-a865mj02.js → index-wk0n1cgt.js} +4 -4
  130. package/dist/{index-q3qck7j2.js → index-wz6mzzb1.js} +6 -5
  131. package/dist/{index-se1w3v2m.js → index-y1qysm3q.js} +332 -256
  132. package/dist/{index-a4b0gbyg.js → index-y9f76s3f.js} +1 -1
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +119 -129
  135. package/dist/{logger-wn328tfg.js → logger-jm3sqqzr.js} +2 -2
  136. package/dist/{message-index-bounded-0rbbg9rd.js → message-index-bounded-vm64mqpq.js} +16 -16
  137. package/dist/{message-index-ct5x2kwa.js → message-index-seaqpb7c.js} +16 -16
  138. package/dist/{message-time-backfill-nb5hhnrt.js → message-time-backfill-qjge9044.js} +3 -3
  139. package/dist/migration-worker.js +11 -11
  140. package/dist/plugin/dream-timer.d.ts.map +1 -1
  141. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  142. package/dist/plugin/tool-registry.d.ts.map +1 -1
  143. package/dist/{project-embedding-registry-ft9gh2e2.js → project-embedding-registry-x45bv3qr.js} +12 -11
  144. package/dist/raw-ordinal-warmup-worker.js +12 -7
  145. package/dist/{read-session-chunk-y3hhsbzw.js → read-session-chunk-ax05f7gr.js} +11 -11
  146. package/dist/{read-session-raw-gm6xj30v.js → read-session-raw-m56hc7v2.js} +7 -3
  147. package/dist/recomp-orchestrator-dmbeadwt.js +61 -0
  148. package/dist/{safe-notification-target-jdynm677.js → safe-notification-target-1szv1k5k.js} +3 -3
  149. package/dist/{search-jd8xh721.js → search-5yd5ytzs.js} +25 -24
  150. package/dist/{send-session-notification-vzhj8bsg.js → send-session-notification-24r4esbh.js} +6 -6
  151. package/dist/shared/data-path.d.ts +4 -0
  152. package/dist/shared/data-path.d.ts.map +1 -1
  153. package/dist/shared/model-suggestion-retry.d.ts +2 -0
  154. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  155. package/dist/shared/prompt-async-transport.d.ts.map +1 -1
  156. package/dist/{storage-tags-35m4gms2.js → storage-tags-yygfb9c8.js} +7 -5
  157. package/dist/{task-config-cgpg0nvh.js → task-config-x3qmayd2.js} +6 -2
  158. package/dist/tools/ctx-note/tools.d.ts.map +1 -1
  159. package/dist/{transform-postprocess-phase-pmqxfq4q.js → transform-postprocess-phase-72v86syx.js} +32 -31
  160. package/dist/v2/auto-search-worker.js +4 -4
  161. package/dist/v2/chunk-embedding-write-worker.js +88 -0
  162. package/dist/v2/{compaction-marker-candidates-a15w3mqh.js → compaction-marker-candidates-1vqwr3s5.js} +2 -2
  163. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  164. package/dist/v2/{context-p1zfcw41.js → context-w055w17c.js} +628 -255
  165. package/dist/v2/{derive-budgets-0rmpmxjw.js → derive-budgets-2zh4gm2c.js} +3 -3
  166. package/dist/v2/embedding-backfill-jmaf8zrr.js +21 -0
  167. package/dist/v2/embedding-worker-process.js +1 -1
  168. package/dist/v2/embedding-worker.js +5 -5
  169. package/dist/v2/{history-owner-2cr9py37.js → history-owner-42e16w0n.js} +2 -2
  170. package/dist/v2/hooks/context.d.ts.map +1 -1
  171. package/dist/v2/hooks/dream-manual.d.ts.map +1 -1
  172. package/dist/v2/hooks/dream-trigger.d.ts +1 -1
  173. package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
  174. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  175. package/dist/v2/hooks/transform-features.d.ts +3 -2
  176. package/dist/v2/hooks/transform-features.d.ts.map +1 -1
  177. package/dist/v2/{logger-te6e1j72.js → logger-7qt02bnb.js} +1 -1
  178. package/dist/v2/{message-index-bounded-7wcbp975.js → message-index-bounded-wepg5723.js} +15 -15
  179. package/dist/v2/{message-index-cjhv92m2.js → message-index-gcmd0ng0.js} +15 -15
  180. package/dist/v2/{message-time-backfill-rz1pnpaj.js → message-time-backfill-bsteyc4d.js} +2 -2
  181. package/dist/v2/migration-worker.js +10 -10
  182. package/dist/v2/{project-embedding-registry-g34gcf74.js → project-embedding-registry-0msp56p8.js} +11 -10
  183. package/dist/v2/raw-ordinal-warmup-worker.js +12 -7
  184. package/dist/v2/{read-session-chunk-8d3v87vr.js → read-session-chunk-hr3w5bjk.js} +10 -10
  185. package/dist/v2/{read-session-raw-h4azh85b.js → read-session-raw-b3tf6ra1.js} +6 -2
  186. package/dist/v2/recomp-orchestrator-ca7qt75a.js +60 -0
  187. package/dist/v2/retrospective-raw-provider.d.ts.map +1 -1
  188. package/dist/v2/{safe-notification-target-936374xx.js → safe-notification-target-qg7n2s77.js} +2 -2
  189. package/dist/v2/{search-a1acjwf8.js → search-c86dcv14.js} +24 -23
  190. package/dist/v2/{send-session-notification-z5mcjdea.js → send-session-notification-8ghn9tnv.js} +5 -5
  191. package/dist/v2/{server-npm52h2q.js → server-05xjtq6c.js} +1 -1
  192. package/dist/v2/{server-s6jqh8bj.js → server-0ppsweh6.js} +1 -1
  193. package/dist/v2/server-0s95v3en.js +49 -0
  194. package/dist/v2/{server-hn9fb3v0.js → server-34kwfsr4.js} +2 -2
  195. package/dist/v2/server-4gn3z5an.js +229 -0
  196. package/dist/v2/{server-kn7skz9r.js → server-6cdy4rc0.js} +3 -3
  197. package/dist/v2/{server-7dv9wt9r.js → server-6pmqg9m4.js} +1 -1
  198. package/dist/v2/{server-7fvmt15t.js → server-b81w6sw3.js} +273 -107
  199. package/dist/v2/{server-kmapq3v0.js → server-bxpwy6fy.js} +18 -5
  200. package/dist/v2/{server-d6t16r89.js → server-d8tj10db.js} +1 -1
  201. package/dist/v2/{server-cxsr0ng6.js → server-da07v4xp.js} +1 -1
  202. package/dist/v2/{server-rxcq4t50.js → server-ef89gdsx.js} +5 -5
  203. package/dist/v2/{server-9e5r8y60.js → server-f2xf5gcb.js} +46 -2
  204. package/dist/v2/{server-83d71zab.js → server-g10mdym6.js} +3 -3
  205. package/dist/v2/{server-njnx39q2.js → server-gvkm8xaj.js} +189 -29
  206. package/dist/v2/{server-ckrb5rm8.js → server-h0410h0v.js} +1 -1
  207. package/dist/v2/{server-sg68np13.js → server-hek6z3w6.js} +330 -254
  208. package/dist/v2/{server-f27he3j1.js → server-k2bzedxk.js} +4 -4
  209. package/dist/v2/{server-wkhfyzpg.js → server-m97brnat.js} +9 -9
  210. package/dist/v2/{server-erfp0xb6.js → server-n8ch9683.js} +16 -16
  211. package/dist/v2/{server-bx59ezg6.js → server-prg55b7k.js} +16 -6
  212. package/dist/v2/{server-89fcbe37.js → server-pwv4ezb0.js} +1 -1
  213. package/dist/v2/{server-r5p3b1wy.js → server-qd11g795.js} +29 -1
  214. package/dist/v2/{server-ewqshbs8.js → server-qhfvvfxj.js} +64 -7
  215. package/dist/v2/{server-988cqjme.js → server-rrqpvwqd.js} +2 -2
  216. package/dist/v2/{server-d3f4g62c.js → server-t4prcjc1.js} +13 -13
  217. package/dist/v2/{server-nveratm5.js → server-tbe1femw.js} +4 -4
  218. package/dist/v2/{server-jc8v585p.js → server-th4y11y7.js} +15 -15
  219. package/dist/v2/{server-h3wc20sv.js → server-vbe4se57.js} +4 -4
  220. package/dist/v2/{server-pbpp8r8h.js → server-xh7jar6k.js} +9 -9
  221. package/dist/v2/{server-63ha7f0f.js → server-yrvqaswb.js} +1 -1
  222. package/dist/v2/{server-5x7kmyz8.js → server-zc3e54vy.js} +10 -51
  223. package/dist/v2/{server-xqf2d2mg.js → server-zs8d0s3b.js} +2 -2
  224. package/dist/v2/server.d.ts.map +1 -1
  225. package/dist/v2/server.js +18 -10
  226. package/dist/v2/{storage-tags-c4zfcxv4.js → storage-tags-a2gq6dw7.js} +6 -4
  227. package/dist/v2/store-reader.d.ts +1 -0
  228. package/dist/v2/store-reader.d.ts.map +1 -1
  229. package/dist/v2/{task-config-x0hq3qfd.js → task-config-nvz8mapa.js} +6 -2
  230. package/dist/v2/{wrapup-orchestrator-87q9d5e2.js → wrapup-orchestrator-e1a2w6jh.js} +31 -29
  231. package/dist/wrapup-orchestrator-2051r6qm.js +48 -0
  232. package/package.json +6 -5
  233. package/src/agents/smart-notes-dreamer-gate.fixture.ts +171 -0
  234. package/src/agents/smart-notes-dreamer-gate.golden.json +245 -0
  235. package/src/agents/smart-notes-dreamer-gate.test.ts +161 -0
  236. package/src/config/agent-disable.ts +13 -0
  237. package/src/config/dependency-notes.test.ts +114 -0
  238. package/src/config/dependency-notes.ts +80 -0
  239. package/src/config/schema/magic-context.ts +23 -14
  240. package/src/features/magic-context/dreamer/task-registry.ts +40 -0
  241. package/src/shared/data-path.test.ts +35 -1
  242. package/src/shared/data-path.ts +57 -1
  243. package/src/shared/model-suggestion-retry.test.ts +34 -0
  244. package/src/shared/model-suggestion-retry.ts +23 -3
  245. package/src/shared/prompt-async-transport.test.ts +1 -1
  246. package/src/shared/prompt-async-transport.ts +16 -3
  247. package/dist/embedding-backfill-fjbfh1dt.js +0 -21
  248. package/dist/recomp-orchestrator-67k45s0b.js +0 -60
  249. package/dist/v2/embedding-backfill-xcw3t6hp.js +0 -20
  250. package/dist/v2/recomp-orchestrator-n0pq36f0.js +0 -59
  251. package/dist/wrapup-orchestrator-jqapepw0.js +0 -47
  252. /package/dist/{index-e6xnpach.js → index-b7p25tm0.js} +0 -0
  253. /package/dist/v2/{index-e6xnpach.js → index-b7p25tm0.js} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-pavzsdc6.js";
4
4
  import {
5
5
  sessionLog2
6
- } from "./index-mvvephtj.js";
6
+ } from "./index-j75v2476.js";
7
7
  import {
8
8
  UNKNOWN_FIT_RATIO,
9
9
  resolveDecisionCalibration,
@@ -23,7 +23,7 @@ import {
23
23
  TAG_SELECT_COLUMNS2,
24
24
  getCandidateToolOwners2,
25
25
  pickNearestPriorOwner2
26
- } from "./index-f8cn4xqa.js";
26
+ } from "./index-fwefky9w.js";
27
27
  import {
28
28
  OMO_INTERNAL_INITIATOR_MARKER,
29
29
  isSystemDirective,
@@ -40,18 +40,18 @@ import {
40
40
  formatBlock,
41
41
  compactTextForSummary,
42
42
  mergeCommitHashes
43
- } from "./index-gjvjh960.js";
43
+ } from "./index-hqkczed7.js";
44
44
  import {
45
45
  prepareCachedStatement2
46
46
  } from "./index-wafzvyhg.js";
47
47
  import {
48
48
  stableStringify
49
- } from "./index-g7jkrz0x.js";
49
+ } from "./index-bp5083x2.js";
50
50
  import {
51
51
  renderToolTemplate,
52
52
  resolveModelConfigValue,
53
53
  deriveDefaultProtectedTokens
54
- } from "./index-w28y7d0z.js";
54
+ } from "./index-1sarmj9z.js";
55
55
  import {
56
56
  readRawSessionMessagesFromDb2,
57
57
  readRawSessionMessagePageFromDb2,
@@ -68,25 +68,25 @@ import {
68
68
  readRawSeedTailFromDb2,
69
69
  readRawSessionBoundaryEndpointsFromDb2,
70
70
  prewarmRawSessionOrdinalsForDb
71
- } from "./index-angx1s0k.js";
71
+ } from "./index-mmfa86mt.js";
72
72
  import {
73
73
  openCodeDbExists,
74
74
  withReadOnlySessionDb,
75
75
  getRawSessionMessageCountFromDb,
76
76
  getMessageTimesFromOpenCodeDb
77
- } from "./index-bzp9s8z2.js";
77
+ } from "./index-1d289pq2.js";
78
78
  import {
79
79
  getToolDefinitionMeasurementSignature,
80
80
  getLargestMeasuredToolDefinitionTokens,
81
81
  getMeasuredToolDefinitionTokens
82
- } from "./index-9jvab89d.js";
82
+ } from "./index-n6m03s3n.js";
83
83
  import {
84
84
  canonicalModelIdentity,
85
85
  piModelRefToCanonical
86
86
  } from "./index-avwt563y.js";
87
87
  import {
88
88
  logSlowWriteTransaction
89
- } from "./index-150zz6fh.js";
89
+ } from "./index-k29z4aqh.js";
90
90
 
91
91
  // src/shared/hidden-zen-read.ts
92
92
  function isToolFreeHiddenAgent(agent) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sessionLog2
3
- } from "./index-mvvephtj.js";
3
+ } from "./index-j75v2476.js";
4
4
  import {
5
5
  isKnownAutocommit
6
6
  } from "./index-8ajstryz.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sanitizeDiagnosticText,
3
3
  sessionLog2
4
- } from "./index-mvvephtj.js";
4
+ } from "./index-j75v2476.js";
5
5
  import {
6
6
  getHarness2
7
7
  } from "./index-pavzsdc6.js";
@@ -14,10 +14,10 @@ import {
14
14
  } from "./index-fr0wbhdn.js";
15
15
  import {
16
16
  managedAuthorityNoteRow
17
- } from "./index-a865mj02.js";
17
+ } from "./index-wk0n1cgt.js";
18
18
  import {
19
19
  embedTextForProject2
20
- } from "./index-se1w3v2m.js";
20
+ } from "./index-y1qysm3q.js";
21
21
  import {
22
22
  saveEmbeddingIfHashMatches
23
23
  } from "./index-4dhv7mqz.js";
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  importPluginModule,
6
6
  sessionLog2
7
- } from "./index-mvvephtj.js";
7
+ } from "./index-j75v2476.js";
8
8
  import {
9
9
  isDefaultSessionTitle2
10
- } from "./index-a4b0gbyg.js";
10
+ } from "./index-y9f76s3f.js";
11
11
  import {
12
12
  shouldHoldIgnoredNotification
13
- } from "./index-bzp9s8z2.js";
13
+ } from "./index-1d289pq2.js";
14
14
  import {
15
15
  getErrorMessage
16
16
  } from "./index-y8v6yerm.js";
@@ -142,7 +142,7 @@ async function sendIgnoredMessageNow(client, sessionId, text, params, forcePersi
142
142
  holdIgnoredNotification({ client, sessionId, text, params, forcePersist }, "during target checks");
143
143
  return "queued";
144
144
  }
145
- const { waitForSafeNotificationTarget } = await importPluginModule(() => import("./safe-notification-target-jdynm677.js"));
145
+ const { waitForSafeNotificationTarget } = await importPluginModule(() => import("./safe-notification-target-1szv1k5k.js"));
146
146
  if (await waitForSafeNotificationTarget(client, sessionId) === "skip") {
147
147
  sessionLog2(sessionId, "notification skipped (session not titled yet)");
148
148
  return "skipped";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-wafzvyhg.js";
5
5
  import {
6
6
  logSlowWriteTransaction
7
- } from "./index-150zz6fh.js";
7
+ } from "./index-k29z4aqh.js";
8
8
 
9
9
  // src/features/magic-context/message-fts-rowid-map.ts
10
10
  import { createHash } from "node:crypto";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./index-w28y7d0z.js";
3
+ } from "./index-1sarmj9z.js";
4
4
  import {
5
5
  getSynapseLaneIdentity
6
- } from "./index-kvw6xew3.js";
6
+ } from "./index-fkx2qnvw.js";
7
7
  import {
8
8
  getHarness2
9
9
  } from "./index-pavzsdc6.js";
10
10
  import {
11
11
  getMagicContextStorageDir
12
- } from "./index-0sahzkwr.js";
12
+ } from "./index-g2q4htwp.js";
13
13
  import {
14
14
  importPluginModule,
15
15
  log2
16
- } from "./index-mvvephtj.js";
16
+ } from "./index-j75v2476.js";
17
17
  import {
18
18
  inRootAsyncContext2
19
19
  } from "./index-wafzvyhg.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  importPluginModule,
3
3
  log2
4
- } from "./index-mvvephtj.js";
4
+ } from "./index-j75v2476.js";
5
5
  import {
6
6
  sendStatusNotification2
7
- } from "./index-0abg88h2.js";
7
+ } from "./index-dgs16axy.js";
8
8
  import {
9
9
  formatConflictShort
10
- } from "./index-b64n4d0h.js";
10
+ } from "./index-kee4kn5j.js";
11
11
 
12
12
  // src/plugin/conflict-warning-hook.ts
13
13
  import { existsSync, readFileSync } from "node:fs";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-v0p37hm2.js";
4
4
  import {
5
5
  log2
6
- } from "./index-mvvephtj.js";
6
+ } from "./index-j75v2476.js";
7
7
  import {
8
8
  inRootAsyncContext2,
9
9
  getSqliteDatabasePath2
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-gjvjh960.js";
3
+ } from "./index-hqkczed7.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./index-pavzsdc6.js";
7
7
  import {
8
8
  log2
9
- } from "./index-mvvephtj.js";
9
+ } from "./index-j75v2476.js";
10
10
  import {
11
11
  inRootAsyncContext2
12
12
  } from "./index-wafzvyhg.js";
@@ -4,13 +4,13 @@ import {
4
4
  } from "./index-1zx87sdm.js";
5
5
  import {
6
6
  estimateTokens
7
- } from "./index-gjvjh960.js";
7
+ } from "./index-hqkczed7.js";
8
8
  import {
9
9
  getHarness2
10
10
  } from "./index-pavzsdc6.js";
11
11
  import {
12
12
  sessionLog2
13
- } from "./index-mvvephtj.js";
13
+ } from "./index-j75v2476.js";
14
14
  import {
15
15
  getTagIdentityWriteGeneration2,
16
16
  getSqliteDatabasePath2
@@ -20,7 +20,7 @@ import {
20
20
  tagOrderConstraintIndex,
21
21
  stableStringify,
22
22
  stableStringifyHash
23
- } from "./index-g7jkrz0x.js";
23
+ } from "./index-bp5083x2.js";
24
24
  import {
25
25
  DEFAULT_PROTECTED_TOOLS,
26
26
  normalizeProtectedToolName,
@@ -2938,6 +2938,19 @@ function insertTag2(db, sessionId, messageId, type, byteSize, tagNumber, reasoni
2938
2938
  function updateTagStatus2(db, sessionId, tagId, status) {
2939
2939
  getUpdateTagStatusStatement(db).run(status, sessionId, tagId);
2940
2940
  }
2941
+ var droppedTagStatements = new WeakMap;
2942
+ function markTagDropped2(db, sessionId, tagId, mode) {
2943
+ if (!mode) {
2944
+ updateTagStatus2(db, sessionId, tagId, "dropped");
2945
+ return;
2946
+ }
2947
+ let statement = droppedTagStatements.get(db);
2948
+ if (!statement) {
2949
+ statement = db.prepare("UPDATE tags SET status = ?, drop_mode = ? WHERE session_id = ? AND tag_number = ?");
2950
+ droppedTagStatements.set(db, statement);
2951
+ }
2952
+ statement.run("dropped", mode, sessionId, tagId);
2953
+ }
2941
2954
  function markWhitespaceAssistantTagInert2(db, sessionId, tagNumber, contentId) {
2942
2955
  db.prepare(`UPDATE tags
2943
2956
  SET status = 'compacted',
@@ -3663,7 +3676,7 @@ function getNewestToolTagNumbers2(db, sessionId, limit) {
3663
3676
  let statement = newestToolTagNumberStatements.get(db);
3664
3677
  if (!statement) {
3665
3678
  statement = db.prepare(`SELECT tag_number FROM tags
3666
- WHERE session_id = ? AND type = 'tool'
3679
+ WHERE session_id = ? AND +type = 'tool'
3667
3680
  AND typeof(message_id) = 'text'
3668
3681
  AND typeof(status) = 'text'
3669
3682
  AND typeof(byte_size) IN ('integer', 'real')
@@ -3833,4 +3846,4 @@ function deleteToolTagsByOwner(db, sessionId, ownerMsgId) {
3833
3846
  return getDeleteToolTagsByOwnerStatement(db).all(sessionId, ownerMsgId).length;
3834
3847
  }
3835
3848
 
3836
- export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, currentReclaimableToolOutputCount, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
3849
+ export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, currentReclaimableToolOutputCount, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markTagDropped2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
@@ -3,7 +3,15 @@ import {
3
3
  } from "./index-pavzsdc6.js";
4
4
 
5
5
  // src/shared/data-path.ts
6
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
+ import {
7
+ existsSync,
8
+ lstatSync,
9
+ mkdirSync,
10
+ readFileSync,
11
+ readlinkSync,
12
+ realpathSync,
13
+ writeFileSync
14
+ } from "node:fs";
7
15
  import * as os from "node:os";
8
16
  import * as path from "node:path";
9
17
 
@@ -95,8 +103,44 @@ function getMagicContextStorageResolution() {
95
103
  function getMagicContextStorageDir() {
96
104
  return getMagicContextStorageResolution().path;
97
105
  }
106
+ function canonicalizeStoragePath(value, seen = new Set) {
107
+ const absolute = path.resolve(value);
108
+ if (seen.has(absolute))
109
+ return absolute;
110
+ seen.add(absolute);
111
+ try {
112
+ return realpathSync.native(absolute);
113
+ } catch {
114
+ try {
115
+ if (lstatSync(absolute).isSymbolicLink()) {
116
+ const target = readlinkSync(absolute);
117
+ const resolvedTarget = path.isAbsolute(target) ? target : path.resolve(path.dirname(absolute), target);
118
+ return canonicalizeStoragePath(resolvedTarget, seen);
119
+ }
120
+ } catch {}
121
+ const parent = path.dirname(absolute);
122
+ if (parent === absolute)
123
+ return absolute;
124
+ const resolvedParent = canonicalizeStoragePath(parent, seen);
125
+ return path.resolve(resolvedParent, path.basename(absolute));
126
+ }
127
+ }
128
+ function isMagicContextStorageOutsideEngram(storageDir = getMagicContextStorageDir(), backupDir = path.join(os.homedir(), ".local", "share", "cortexkit", "magic-context")) {
129
+ const resolvedStorageDir = canonicalizeStoragePath(storageDir);
130
+ const resolvedBackupDir = canonicalizeStoragePath(backupDir);
131
+ const relative2 = path.relative(resolvedBackupDir, resolvedStorageDir);
132
+ return path.isAbsolute(relative2) || relative2 === ".." || relative2.startsWith(`..${path.sep}`);
133
+ }
134
+ var STORAGE_BACKUP_WARNING_CHECKED = Symbol.for("magic-context.storage-backup-warning-checked");
135
+ function claimStorageBackupWarningCheck() {
136
+ const processState = globalThis;
137
+ if (processState[STORAGE_BACKUP_WARNING_CHECKED])
138
+ return false;
139
+ processState[STORAGE_BACKUP_WARNING_CHECKED] = true;
140
+ return true;
141
+ }
98
142
  function getLegacyOpenCodeMagicContextStorageDir() {
99
143
  return path.join(getOpenCodeStorageDir(), "plugin", "magic-context");
100
144
  }
101
145
 
102
- export { getDataDir, getMagicContextLogPath, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getOpenCodeStorageDir, getMagicContextStorageResolution, getMagicContextStorageDir, getLegacyOpenCodeMagicContextStorageDir };
146
+ export { getDataDir, getMagicContextLogPath, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getOpenCodeStorageDir, getMagicContextStorageResolution, getMagicContextStorageDir, isMagicContextStorageOutsideEngram, claimStorageBackupWarningCheck, getLegacyOpenCodeMagicContextStorageDir };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMagicContextStorageDir
3
- } from "./index-0sahzkwr.js";
3
+ } from "./index-g2q4htwp.js";
4
4
  import {
5
5
  ensureStorageDirectorySync,
6
6
  writeStorageFileAtomicSync
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  sessionLog2
3
- } from "./index-mvvephtj.js";
3
+ } from "./index-j75v2476.js";
4
4
  import {
5
5
  clearEmergencyRecovery
6
- } from "./index-qr1mkc2y.js";
6
+ } from "./index-b16gpywn.js";
7
7
  import {
8
8
  requestPendingMaterialization,
9
9
  dropSlot,
10
10
  executeContextRecomp
11
- } from "./index-z7avx6rw.js";
11
+ } from "./index-2jr1smmh.js";
12
12
  import {
13
13
  renderUserFacingFailure,
14
14
  userFacingFailureCode
15
- } from "./index-yhrrx7qa.js";
15
+ } from "./index-bxdg2nbt.js";
16
16
 
17
17
  // src/hooks/magic-context/recomp-orchestrator.ts
18
18
  function resolveLiveModelKey(liveSessionState, sessionId) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./index-mvvephtj.js";
3
+ } from "./index-j75v2476.js";
4
4
 
5
5
  // src/hooks/magic-context/read-session-formatting.ts
6
6
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-pavzsdc6.js";
4
4
  import {
5
5
  getMagicContextLogPath
6
- } from "./index-0sahzkwr.js";
6
+ } from "./index-g2q4htwp.js";
7
7
 
8
8
  // src/shared/logger.ts
9
9
  import * as fs from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./index-mvvephtj.js";
3
+ } from "./index-j75v2476.js";
4
4
 
5
5
  // src/shared/write-transaction-timing.ts
6
6
  var SLOW_WRITE_TRANSACTION_THRESHOLD_MS = 1000;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-sd3egckz.js";
4
4
  import {
5
5
  log2
6
- } from "./index-mvvephtj.js";
6
+ } from "./index-j75v2476.js";
7
7
 
8
8
  // src/shared/conflict-detector.ts
9
9
  import { homedir as homedir2 } from "node:os";
@@ -0,0 +1,52 @@
1
+ // src/config/agent-disable.ts
2
+ var COMPACTION_ENABLED_PATH = `compaction${"."}enabled`;
3
+ function isDreamerRunnable(config) {
4
+ return !!config.dreamer && config.dreamer.disable !== true;
5
+ }
6
+ function isSmartNoteSurfaceAvailable(config) {
7
+ return config.smart_notes?.enabled !== false && isDreamerRunnable(config);
8
+ }
9
+ function isHistorianRunnable(config) {
10
+ return config.historian?.disable !== true;
11
+ }
12
+ function isCompactionEnabled(config) {
13
+ return config.compaction?.enabled !== false;
14
+ }
15
+ function clonePlainObject(value) {
16
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
17
+ return;
18
+ }
19
+ return { ...value };
20
+ }
21
+ function migrateLegacyEnabledForAgent(args) {
22
+ const agent = clonePlainObject(args.patched[args.agentName]);
23
+ if (!agent || !("enabled" in agent))
24
+ return;
25
+ const enabled = agent.enabled;
26
+ const disable = agent.disable;
27
+ delete agent.enabled;
28
+ if (args.agentName === "historian") {
29
+ args.warnings.push('Removed invalid "historian.enabled" in-memory (run doctor to persist).');
30
+ args.patched.historian = agent;
31
+ return;
32
+ }
33
+ if (disable !== true && enabled === false) {
34
+ agent.disable = true;
35
+ args.warnings.push('Migrated "dreamer.enabled=false" → "dreamer.disable=true" in-memory (run doctor to persist). This now also disables manual /ctx-dream; for manual-only remove disable and set schedule="".');
36
+ }
37
+ args.patched.dreamer = agent;
38
+ }
39
+ function migrateLegacyAgentEnabledInMemory(rawConfig, warnings) {
40
+ const shouldPatch = ["dreamer", "historian"].some((key) => {
41
+ const agent = rawConfig[key];
42
+ return typeof agent === "object" && agent !== null && !Array.isArray(agent) && "enabled" in agent;
43
+ });
44
+ if (!shouldPatch)
45
+ return rawConfig;
46
+ const patched = { ...rawConfig };
47
+ migrateLegacyEnabledForAgent({ patched, agentName: "dreamer", warnings });
48
+ migrateLegacyEnabledForAgent({ patched, agentName: "historian", warnings });
49
+ return patched;
50
+ }
51
+
52
+ export { COMPACTION_ENABLED_PATH, isDreamerRunnable, isSmartNoteSurfaceAvailable, isHistorianRunnable, isCompactionEnabled, migrateLegacyAgentEnabledInMemory };
@@ -8,7 +8,7 @@ import {
8
8
  } from "./index-v0p37hm2.js";
9
9
  import {
10
10
  log2
11
- } from "./index-mvvephtj.js";
11
+ } from "./index-j75v2476.js";
12
12
 
13
13
  // src/hooks/magic-context/read-session-raw.ts
14
14
  import { isMainThread } from "node:worker_threads";
@@ -91,6 +91,8 @@ function runSessionWarmupWorker(input, options) {
91
91
  finish({ inserted: reply.inserted, measurements: reply.measurements });
92
92
  else if (reply.kind === "orphan-sweep")
93
93
  finish({ orphanSweep: reply.result });
94
+ else if (reply.kind === "exact-ordinal-ids")
95
+ finish({ exactOrdinalIds: reply.ids });
94
96
  else
95
97
  finish({ failure: "worker-error", detail: reply.error });
96
98
  });
@@ -316,7 +318,7 @@ function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWaterma
316
318
  const skip = anchor === after && after ? 0 : ordinal - (floor?.ordinal ?? 0);
317
319
  if (skip > ORDINAL_LOOKUP_LIMIT) {
318
320
  prewarmRawSessionOrdinalsForDb(db, sessionId);
319
- throw new RawOrdinalsNotReady;
321
+ throw new RawOrdinalsNotReady2;
320
322
  }
321
323
  const rawLimit = skip + pageSize + ORDINAL_LOOKUP_LIMIT;
322
324
  const rows = db.prepare(`SELECT id, data, time_created, time_updated, ${EXCLUDED_ROW_SQL} AS excluded
@@ -329,7 +331,7 @@ function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWaterma
329
331
  const eligible = rows.filter((row) => row.excluded !== 1);
330
332
  if (eligible.length <= skip && rows.length === rawLimit) {
331
333
  prewarmRawSessionOrdinalsForDb(db, sessionId);
332
- throw new RawOrdinalsNotReady;
334
+ throw new RawOrdinalsNotReady2;
333
335
  }
334
336
  return eligible.slice(skip, skip + pageSize).filter(isRawMessageRow).map((row, index) => ({
335
337
  ...row,
@@ -417,11 +419,13 @@ function countRawSessionMessageOrdinalsFromDb2(db, sessionId) {
417
419
  )`).get(sessionId);
418
420
  return typeof row?.count === "number" ? row.count : 0;
419
421
  }
422
+ var exactOrdinalScansOnThisThread = 0;
420
423
  function readRawSessionMessageIdOrdinalsForRangeFromDb2(db, sessionId, fromOrdinal, toOrdinal) {
421
424
  const from = Math.max(1, Math.floor(fromOrdinal));
422
425
  const to = Math.floor(toOrdinal);
423
426
  if (to < from)
424
427
  return new Map;
428
+ exactOrdinalScansOnThisThread += 1;
425
429
  const rows = db.prepare(`
426
430
  SELECT id, data FROM message WHERE session_id = ?
427
431
  AND CASE WHEN json_valid(data) THEN NOT (
@@ -437,6 +441,12 @@ function readRawSessionMessageIdOrdinalsForRangeFromDb2(db, sessionId, fromOrdin
437
441
  }
438
442
  return result;
439
443
  }
444
+ function readRawSessionMessageIdsAtOrdinalsFromDb2(db, sessionId, ordinals) {
445
+ return withReadSnapshot(db, () => ordinals.map((ordinal) => [
446
+ ordinal,
447
+ readRawSessionMessageIdOrdinalsForRangeFromDb2(db, sessionId, ordinal, ordinal).keys().next().value ?? null
448
+ ]));
449
+ }
440
450
  function readRawSessionMessageOrdinalPageFromDb2(db, sessionId, after, limit) {
441
451
  const pageSize = Math.max(1, Math.floor(limit));
442
452
  const rows = (after ? db.prepare(`SELECT id, data, time_created
@@ -745,7 +755,7 @@ function extendOrdinalCheckpoints(db, sessionId, scan, limit) {
745
755
  return true;
746
756
  }
747
757
 
748
- class RawOrdinalsNotReady extends Error {
758
+ class RawOrdinalsNotReady2 extends Error {
749
759
  constructor() {
750
760
  super("canonical ordinals are warming off-thread; retry after preparation");
751
761
  }
@@ -794,7 +804,7 @@ function boundedOrdinalPrefix(db, sessionId, through) {
794
804
  ordinalJsonRowsRead += rows.length;
795
805
  if (rows.length > ORDINAL_LOOKUP_LIMIT) {
796
806
  prewarmRawSessionOrdinalsForDb(db, sessionId);
797
- throw new RawOrdinalsNotReady;
807
+ throw new RawOrdinalsNotReady2;
798
808
  }
799
809
  return (floor?.ordinal ?? 0) + rows.reduce((sum, row) => sum + (row.excluded === 1 ? 0 : 1), 0);
800
810
  }
@@ -1257,4 +1267,4 @@ function readRawSessionBoundaryEndpointsFromDb2(db, sessionId, ids, blockIds = [
1257
1267
  }
1258
1268
  }
1259
1269
 
1260
- export { isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
1270
+ export { isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-gjvjh960.js";
3
+ } from "./index-hqkczed7.js";
4
4
  import {
5
5
  stableStringify
6
- } from "./index-g7jkrz0x.js";
6
+ } from "./index-bp5083x2.js";
7
7
 
8
8
  // src/features/magic-context/tool-definition-tokens.ts
9
9
  import { createHash } from "node:crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./index-mvvephtj.js";
3
+ } from "./index-j75v2476.js";
4
4
  import {
5
5
  canonicalProjectDirectory
6
6
  } from "./index-knvkbfvh.js";
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  resolveDreamerTaskModel2
3
3
  } from "./index-8cd2j99z.js";
4
+ import {
5
+ isDreamerRunnable
6
+ } from "./index-ksdyrrav.js";
4
7
 
5
8
  // src/features/magic-context/dreamer/task-registry.ts
6
9
  var CANONICAL_DREAM_TASKS = [
@@ -124,6 +127,25 @@ var MEMORY_DOMAIN_TASKS = [
124
127
  "refresh-primers"
125
128
  ];
126
129
  var MEMORY_DOMAIN_SET = new Set(MEMORY_DOMAIN_TASKS);
130
+ var PROJECT_MEMORY_DREAM_TASKS = [
131
+ "map-memories",
132
+ "verify",
133
+ "verify-broad",
134
+ "curate",
135
+ "compress-cues",
136
+ "classify-memories",
137
+ "retrospective",
138
+ "promote-primers",
139
+ "refresh-primers"
140
+ ];
141
+ var PROJECT_MEMORY_DREAM_TASK_SET = new Set(PROJECT_MEMORY_DREAM_TASKS);
142
+ function dreamTaskAllowedBySettings(task, settings) {
143
+ if (PROJECT_MEMORY_DREAM_TASK_SET.has(task))
144
+ return settings.projectMemoryEnabled !== false;
145
+ if (task === "evaluate-smart-notes")
146
+ return settings.smartNotesEnabled !== false;
147
+ return true;
148
+ }
127
149
  function leaseKindFor(task) {
128
150
  if (MEMORY_DOMAIN_SET.has(task))
129
151
  return "memory";
@@ -179,6 +201,12 @@ function userMemoryCollectionEnabled2(dreamer) {
179
201
  const schedule = dreamer?.tasks?.["review-user-memories"]?.schedule;
180
202
  return typeof schedule === "string" && schedule.trim() !== "";
181
203
  }
204
+ function userObservationCollectionEnabled2(dreamer) {
205
+ return userObservationsRequested2(dreamer) && userMemoryCollectionEnabled2(dreamer);
206
+ }
207
+ function userObservationsRequested2(dreamer) {
208
+ return isDreamerRunnable({ dreamer });
209
+ }
182
210
  function userMemoryPromotionThreshold2(dreamer) {
183
211
  return dreamer?.tasks?.["review-user-memories"]?.promotion_threshold ?? 3;
184
212
  }
@@ -198,4 +226,4 @@ function summarizeDreamSchedule2(dreamer, smartNotesEnabled = true) {
198
226
  return enabled.map((t) => `${t} ${dreamer?.tasks[t]?.schedule}`).join(", ");
199
227
  }
200
228
 
201
- export { CANONICAL_DREAM_TASKS, DREAM_TASK_CAPABILITIES, toolLoopDreamTasks, formatUnsupportedDreamTasks, formatDreamTaskBacklogs, formatDreamTaskFailures, processedDreamTaskItems, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2, userMemoryPromotionThreshold2, dreamTaskScheduled2, enabledDreamTasks2, summarizeDreamSchedule2 };
229
+ export { CANONICAL_DREAM_TASKS, DREAM_TASK_CAPABILITIES, toolLoopDreamTasks, formatUnsupportedDreamTasks, formatDreamTaskBacklogs, formatDreamTaskFailures, processedDreamTaskItems, PROJECT_MEMORY_DREAM_TASKS, dreamTaskAllowedBySettings, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2, userObservationCollectionEnabled2, userObservationsRequested2, userMemoryPromotionThreshold2, dreamTaskScheduled2, enabledDreamTasks2, summarizeDreamSchedule2 };