@cortexkit/opencode-magic-context 0.43.1 → 0.44.0

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 (271) hide show
  1. package/README.md +18 -2
  2. package/dist/config/index.d.ts +13 -0
  3. package/dist/config/index.d.ts.map +1 -1
  4. package/dist/config/project-security.d.ts +6 -3
  5. package/dist/config/project-security.d.ts.map +1 -1
  6. package/dist/config/schema/magic-context.d.ts +27 -0
  7. package/dist/config/schema/magic-context.d.ts.map +1 -1
  8. package/dist/{conflict-warning-hook-956fkedc.js → conflict-warning-hook-48f7np9d.js} +5 -5
  9. package/dist/{derive-budgets-b8ybssh9.js → derive-budgets-8kgevxmx.js} +2 -2
  10. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  11. package/dist/features/magic-context/compartment-embedding.d.ts +3 -2
  12. package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -1
  13. package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
  14. package/dist/features/magic-context/dreamer/classify.d.ts +12 -0
  15. package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
  16. package/dist/features/magic-context/dreamer/curate-category-rotation.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/curate-memory-safety.d.ts.map +1 -1
  18. package/dist/features/magic-context/dreamer/failed-invocation-evidence.d.ts +13 -0
  19. package/dist/features/magic-context/dreamer/failed-invocation-evidence.d.ts.map +1 -0
  20. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
  21. package/dist/features/magic-context/dreamer/lease.d.ts +5 -2
  22. package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
  23. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
  24. package/dist/features/magic-context/dreamer/memory-claim-safety.d.ts.map +1 -1
  25. package/dist/features/magic-context/dreamer/module-apply.d.ts +1 -0
  26. package/dist/features/magic-context/dreamer/module-apply.d.ts.map +1 -1
  27. package/dist/features/magic-context/dreamer/retrospective-learnings.d.ts.map +1 -1
  28. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +1 -1
  29. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
  30. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  31. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +2 -0
  32. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  33. package/dist/features/magic-context/dreamer/verify.d.ts +19 -0
  34. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  35. package/dist/features/magic-context/fail-closed-block.d.ts +7 -0
  36. package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -1
  37. package/dist/features/magic-context/index.d.ts +1 -0
  38. package/dist/features/magic-context/index.d.ts.map +1 -1
  39. package/dist/features/magic-context/install-instance-id.d.ts +33 -0
  40. package/dist/features/magic-context/install-instance-id.d.ts.map +1 -0
  41. package/dist/features/magic-context/memory/constants.d.ts.map +1 -1
  42. package/dist/features/magic-context/memory/embedding-backfill.d.ts.map +1 -1
  43. package/dist/features/magic-context/memory/single-store-embedding-drain.d.ts +35 -0
  44. package/dist/features/magic-context/memory/single-store-embedding-drain.d.ts.map +1 -0
  45. package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -1
  46. package/dist/features/magic-context/message-index.d.ts +23 -0
  47. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  48. package/dist/features/magic-context/migrations.d.ts +7 -0
  49. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  50. package/dist/features/magic-context/overflow-detection.d.ts +31 -8
  51. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  52. package/dist/features/magic-context/project-embedding-registry.d.ts +40 -1
  53. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  54. package/dist/features/magic-context/search.d.ts.map +1 -1
  55. package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -1
  56. package/dist/features/magic-context/storage-db.d.ts +1 -1
  57. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  58. package/dist/features/magic-context/storage-meta-persisted.d.ts +20 -5
  59. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  60. package/dist/features/magic-context/storage-meta.d.ts +1 -1
  61. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  62. package/dist/features/magic-context/storage-notes.d.ts +1 -0
  63. package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
  64. package/dist/features/magic-context/storage-primers.d.ts.map +1 -1
  65. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  66. package/dist/features/magic-context/storage-unavailable-reason.d.ts +17 -0
  67. package/dist/features/magic-context/storage-unavailable-reason.d.ts.map +1 -0
  68. package/dist/features/magic-context/storage.d.ts +1 -1
  69. package/dist/features/magic-context/storage.d.ts.map +1 -1
  70. package/dist/features/magic-context/store-generation-rebase.d.ts +95 -2
  71. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
  72. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
  73. package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
  74. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  75. package/dist/features/magic-context/types.d.ts +8 -3
  76. package/dist/features/magic-context/types.d.ts.map +1 -1
  77. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
  78. package/dist/hooks/magic-context/apply-operations.d.ts +105 -9
  79. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  80. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  81. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  82. package/dist/hooks/magic-context/compartment-parser.d.ts +2 -0
  83. package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
  84. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +1 -0
  85. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  86. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +6 -0
  87. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  88. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
  89. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  90. package/dist/hooks/magic-context/compartment-runner-types.d.ts +2 -0
  91. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  92. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +7 -0
  93. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  94. package/dist/hooks/magic-context/context-limit-resolution.d.ts +31 -0
  95. package/dist/hooks/magic-context/context-limit-resolution.d.ts.map +1 -0
  96. package/dist/hooks/magic-context/ctx-reduce-availability.d.ts +60 -8
  97. package/dist/hooks/magic-context/ctx-reduce-availability.d.ts.map +1 -1
  98. package/dist/hooks/magic-context/embed-history-runner.d.ts +0 -1
  99. package/dist/hooks/magic-context/embed-history-runner.d.ts.map +1 -1
  100. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  101. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  102. package/dist/hooks/magic-context/format-embed-status.d.ts.map +1 -1
  103. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  104. package/dist/hooks/magic-context/historian-host-runner.d.ts +233 -0
  105. package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -0
  106. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  107. package/dist/hooks/magic-context/image-token-estimate.d.ts +9 -0
  108. package/dist/hooks/magic-context/image-token-estimate.d.ts.map +1 -1
  109. package/dist/hooks/magic-context/inject-compartments.d.ts +60 -1
  110. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  111. package/dist/hooks/magic-context/lkg-slot.d.ts +6 -0
  112. package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
  113. package/dist/hooks/magic-context/module-client.d.ts +21 -0
  114. package/dist/hooks/magic-context/module-client.d.ts.map +1 -0
  115. package/dist/hooks/magic-context/module-state-sync.d.ts +6 -2
  116. package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
  117. package/dist/hooks/magic-context/module-tool-backends.d.ts +47 -0
  118. package/dist/hooks/magic-context/module-tool-backends.d.ts.map +1 -0
  119. package/dist/hooks/magic-context/module-transport.d.ts +1 -1
  120. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  121. package/dist/hooks/magic-context/persist-filtered-noise.d.ts.map +1 -1
  122. package/dist/hooks/magic-context/read-session-chunk.d.ts +12 -0
  123. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  124. package/dist/hooks/magic-context/rust-mode-transform.d.ts +35 -0
  125. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  126. package/dist/hooks/magic-context/rust-refusal-recovery.d.ts +18 -0
  127. package/dist/hooks/magic-context/rust-refusal-recovery.d.ts.map +1 -1
  128. package/dist/hooks/magic-context/rust-served-m0.d.ts +20 -0
  129. package/dist/hooks/magic-context/rust-served-m0.d.ts.map +1 -0
  130. package/dist/hooks/magic-context/store-ahead-refusal.d.ts +40 -0
  131. package/dist/hooks/magic-context/store-ahead-refusal.d.ts.map +1 -0
  132. package/dist/hooks/magic-context/strip-content.d.ts +5 -5
  133. package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
  134. package/dist/hooks/magic-context/system-prompt-hash.d.ts +9 -0
  135. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  136. package/dist/hooks/magic-context/tag-messages.d.ts +19 -0
  137. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  138. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  139. package/dist/hooks/magic-context/tool-drop-target.d.ts +14 -0
  140. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  141. package/dist/hooks/magic-context/tool-input-size.d.ts +21 -0
  142. package/dist/hooks/magic-context/tool-input-size.d.ts.map +1 -0
  143. package/dist/hooks/magic-context/tool-sweep-policy.d.ts.map +1 -1
  144. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +124 -11
  145. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  146. package/dist/hooks/magic-context/transform.d.ts +13 -0
  147. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  148. package/dist/{index-0ccmyzbj.js → index-01ft0h3p.js} +1 -1
  149. package/dist/{index-j7cnyvq1.js → index-2zf5fv89.js} +254 -61
  150. package/dist/{index-kpmmr8s0.js → index-5f4qsnaq.js} +2 -2
  151. package/dist/{index-yc81txp4.js → index-c906f3ff.js} +4 -4
  152. package/dist/{index-1gtwrdc4.js → index-cj5qe2nw.js} +3 -3
  153. package/dist/{index-febg06dy.js → index-dx0xnd4q.js} +1 -1
  154. package/dist/{index-v8qr6tt2.js → index-pye48m79.js} +3 -3
  155. package/dist/{index-7wpwr2e2.js → index-rdey8znw.js} +1175 -290
  156. package/dist/{index-wgzyeyf5.js → index-tjq5jztd.js} +22 -6
  157. package/dist/{index-9r1cbh9e.js → index-v6wsttqt.js} +1 -1
  158. package/dist/index.d.ts.map +1 -1
  159. package/dist/index.js +3546 -1642
  160. package/dist/{message-time-backfill-0ccvyk9n.js → message-time-backfill-rm9wmcem.js} +3 -3
  161. package/dist/plugin/dream-timer.d.ts +2 -0
  162. package/dist/plugin/dream-timer.d.ts.map +1 -1
  163. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  164. package/dist/plugin/messages-transform.d.ts.map +1 -1
  165. package/dist/plugin/native-compaction-guard.d.ts +22 -0
  166. package/dist/plugin/native-compaction-guard.d.ts.map +1 -0
  167. package/dist/plugin/rpc-handlers.d.ts +11 -0
  168. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  169. package/dist/{read-session-chunk-z7fv0qjv.js → read-session-chunk-ktz5zt70.js} +5 -3
  170. package/dist/{recomp-orchestrator-r00aa5t3.js → recomp-orchestrator-ahekzt0s.js} +8 -8
  171. package/dist/{safe-notification-target-vrkjrbgb.js → safe-notification-target-6w0esgd6.js} +2 -2
  172. package/dist/{send-session-notification-3warjyjp.js → send-session-notification-w7xbnrsm.js} +4 -4
  173. package/dist/shared/index.d.ts +1 -0
  174. package/dist/shared/index.d.ts.map +1 -1
  175. package/dist/shared/logger.d.ts.map +1 -1
  176. package/dist/shared/model-suggestion-retry.d.ts +13 -1
  177. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  178. package/dist/shared/opencode-db-path.d.ts.map +1 -1
  179. package/dist/shared/prompt-async-transport.d.ts +25 -0
  180. package/dist/shared/prompt-async-transport.d.ts.map +1 -0
  181. package/dist/shared/rpc-server.d.ts +1 -0
  182. package/dist/shared/rpc-server.d.ts.map +1 -1
  183. package/dist/shared/rpc-types.d.ts +16 -0
  184. package/dist/shared/rpc-types.d.ts.map +1 -1
  185. package/dist/shared/rpc-utils.d.ts +3 -0
  186. package/dist/shared/rpc-utils.d.ts.map +1 -1
  187. package/dist/shared/sqlite-write-locker-test-support.d.ts +7 -0
  188. package/dist/shared/sqlite-write-locker-test-support.d.ts.map +1 -0
  189. package/dist/shared/status-summary.d.ts +9 -1
  190. package/dist/shared/status-summary.d.ts.map +1 -1
  191. package/dist/shared/tag-transcript.d.ts.map +1 -1
  192. package/dist/shared/test-fake-executable.d.ts +38 -0
  193. package/dist/shared/test-fake-executable.d.ts.map +1 -0
  194. package/dist/shared/user-facing-codes.d.ts +20 -5
  195. package/dist/shared/user-facing-codes.d.ts.map +1 -1
  196. package/dist/shared/window-geometry.d.ts +6 -3
  197. package/dist/shared/window-geometry.d.ts.map +1 -1
  198. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  199. package/dist/tools/ctx-note/tools.d.ts.map +1 -1
  200. package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
  201. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  202. package/dist/v2/fold/boundary.d.ts +61 -0
  203. package/dist/v2/fold/boundary.d.ts.map +1 -0
  204. package/dist/v2/fold/restore.d.ts.map +1 -1
  205. package/dist/v2/hidden-completion.d.ts +16 -3
  206. package/dist/v2/hidden-completion.d.ts.map +1 -1
  207. package/dist/v2/hooks/context.d.ts +45 -14
  208. package/dist/v2/hooks/context.d.ts.map +1 -1
  209. package/dist/v2/hooks/hidden-child.d.ts +6 -0
  210. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  211. package/dist/v2/hooks/payload.d.ts.map +1 -1
  212. package/dist/v2/hooks/refusal.d.ts +9 -1
  213. package/dist/v2/hooks/refusal.d.ts.map +1 -1
  214. package/dist/v2/hooks/restore-rows.d.ts +29 -0
  215. package/dist/v2/hooks/restore-rows.d.ts.map +1 -0
  216. package/dist/v2/hooks/rpc-live-state.d.ts +1 -1
  217. package/dist/v2/hooks/rpc-live-state.d.ts.map +1 -1
  218. package/dist/v2/hooks/rust-mode.d.ts +47 -0
  219. package/dist/v2/hooks/rust-mode.d.ts.map +1 -0
  220. package/dist/v2/hooks/session-project-backfill.d.ts +15 -0
  221. package/dist/v2/hooks/session-project-backfill.d.ts.map +1 -0
  222. package/dist/v2/hooks/storage-gate.d.ts +42 -0
  223. package/dist/v2/hooks/storage-gate.d.ts.map +1 -0
  224. package/dist/v2/hooks/storage-notice.d.ts +29 -0
  225. package/dist/v2/hooks/storage-notice.d.ts.map +1 -0
  226. package/dist/v2/hooks/store.d.ts +16 -0
  227. package/dist/v2/hooks/store.d.ts.map +1 -1
  228. package/dist/v2/hooks/tools.d.ts +11 -2
  229. package/dist/v2/hooks/tools.d.ts.map +1 -1
  230. package/dist/v2/hooks/types.d.ts +4 -0
  231. package/dist/v2/hooks/types.d.ts.map +1 -1
  232. package/dist/v2/hooks/update-check.d.ts +8 -0
  233. package/dist/v2/hooks/update-check.d.ts.map +1 -1
  234. package/dist/v2/hooks/usage-persist.d.ts +31 -0
  235. package/dist/v2/hooks/usage-persist.d.ts.map +1 -0
  236. package/dist/v2/server.js +12692 -8030
  237. package/dist/v2/store-reader.d.ts +17 -0
  238. package/dist/v2/store-reader.d.ts.map +1 -1
  239. package/dist/wrapup-orchestrator-9srk0kjf.js +18 -0
  240. package/package.json +1 -1
  241. package/src/agents/magic-context-prompt.ts +3 -3
  242. package/src/config/index.ts +40 -0
  243. package/src/config/misplaced-agent-model.test.ts +61 -0
  244. package/src/config/project-security.test.ts +17 -0
  245. package/src/config/project-security.ts +28 -4
  246. package/src/config/schema/magic-context.ts +29 -2
  247. package/src/shared/index.ts +1 -0
  248. package/src/shared/logger.test.ts +63 -2
  249. package/src/shared/logger.ts +23 -5
  250. package/src/shared/model-suggestion-retry.test.ts +115 -4
  251. package/src/shared/model-suggestion-retry.ts +57 -12
  252. package/src/shared/opencode-db-path.test.ts +18 -0
  253. package/src/shared/opencode-db-path.ts +5 -2
  254. package/src/shared/prompt-async-transport.test.ts +217 -0
  255. package/src/shared/prompt-async-transport.ts +242 -0
  256. package/src/shared/prompt-surface-a1-golden.md +8 -8
  257. package/src/shared/rpc-server.ts +13 -1
  258. package/src/shared/rpc-types.ts +17 -0
  259. package/src/shared/rpc-utils.ts +28 -0
  260. package/src/shared/sqlite-transaction-mode-guard.test.ts +198 -0
  261. package/src/shared/sqlite-write-locker-test-support.ts +62 -0
  262. package/src/shared/status-detail-text.test.ts +23 -0
  263. package/src/shared/status-summary.ts +25 -1
  264. package/src/shared/tag-transcript.ts +82 -19
  265. package/src/shared/test-fake-executable.test.ts +54 -0
  266. package/src/shared/test-fake-executable.ts +110 -0
  267. package/src/shared/user-facing-codes.ts +23 -5
  268. package/src/shared/window-geometry.ts +6 -3
  269. package/dist/v2/hooks/provider-admission.d.ts +0 -22
  270. package/dist/v2/hooks/provider-admission.d.ts.map +0 -1
  271. package/dist/wrapup-orchestrator-y0bs7t5a.js +0 -18
@@ -11,6 +11,11 @@ export declare const USER_FACING_FAILURES: {
11
11
  readonly sentence: "Some finished background sessions could not be removed from this host.";
12
12
  readonly action: "They are removed automatically the next time Magic Context runs inside a registered OpenCode service.";
13
13
  };
14
+ readonly historian_saved_history_misaligned: {
15
+ readonly code: "MC-H03";
16
+ readonly sentence: "History compression is paused because this session's saved summaries no longer line up with its messages.";
17
+ readonly action: "Run /ctx-recomp to rebuild them.";
18
+ };
14
19
  readonly recomp_unavailable: {
15
20
  readonly code: "MC-R01";
16
21
  readonly sentence: "History compression could not be rebuilt.";
@@ -26,6 +31,11 @@ export declare const USER_FACING_FAILURES: {
26
31
  readonly sentence: "Memory maintenance could not reach its model.";
27
32
  readonly action: "Check the model connection, then run /ctx-dream again.";
28
33
  };
34
+ readonly dream_step_limit: {
35
+ readonly code: "MC-D10";
36
+ readonly sentence: "Memory maintenance stopped at its hidden agent step limit.";
37
+ readonly action: "This task needs less work per run; changing the model connection will not help.";
38
+ };
29
39
  readonly dream_empty_completion: {
30
40
  readonly code: "MC-D03";
31
41
  readonly sentence: "Memory maintenance received no usable response.";
@@ -181,11 +191,21 @@ export declare const USER_FACING_FAILURES: {
181
191
  readonly sentence: "History compression is paused while the engine syncs.";
182
192
  readonly action: "Retry in a moment.";
183
193
  };
194
+ readonly history_compression_needs_message: {
195
+ readonly code: "MC-C12";
196
+ readonly sentence: "History compression has not seen this session since Magic Context reconnected.";
197
+ readonly action: "Send a message in this session first, then run /ctx-wrapup again.";
198
+ };
184
199
  readonly context_service_unavailable: {
185
200
  readonly code: "MC-C10";
186
201
  readonly sentence: "Magic Context is temporarily unavailable.";
187
202
  readonly action: "Retry in a moment.";
188
203
  };
204
+ readonly store_ahead_of_binary: {
205
+ readonly code: "MC-C13";
206
+ readonly sentence: "Magic Context refused to start: its store (store.db) was migrated by a newer ck-mc build than the one running.";
207
+ readonly action: "Update ck-mc, or roll back by restoring ck-mc together with context.db and store.db from the same backup.";
208
+ };
189
209
  readonly compaction_marker_missing: {
190
210
  readonly code: "MC-C11";
191
211
  readonly sentence: "The history boundary marker is missing from the OpenCode store, so requests carry the full session.";
@@ -201,11 +221,6 @@ export declare const USER_FACING_FAILURES: {
201
221
  readonly sentence: "Memory authority is inconsistent between the host and module.";
202
222
  readonly action: "Run `ck doctor drain-authority` before changing Rust mode.";
203
223
  };
204
- readonly rust_mode_unsupported: {
205
- readonly code: "MC-S06";
206
- readonly sentence: "Experimental Rust transform mode is not available on this OpenCode host.";
207
- readonly action: "Magic Context is running its TypeScript mode instead; set `transform_mode` to \"ts\" to stop requesting Rust.";
208
- };
209
224
  readonly dreamer_task_failing: {
210
225
  readonly code: "MC-S05";
211
226
  readonly sentence: "A background maintenance task keeps failing on its schedule.";
@@ -1 +1 @@
1
- {"version":3,"file":"user-facing-codes.d.ts","sourceRoot":"","sources":["../../src/shared/user-facing-codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqNvB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,OAAO,CAAC;AAEvD,wBAAgB,uBAAuB,CACnC,GAAG,EAAE,oBAAoB,EACzB,KAAK,GAAE,mBAAgC,GACxC,MAAM,CAIR;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,oBAAoB,GAAG,MAAM,CAEvE;AAED,MAAM,MAAM,iBAAiB,GACvB,cAAc,GACd,eAAe,GACf,aAAa,GACb,aAAa,GACb,iBAAiB,GACjB,iBAAiB,GACjB,sBAAsB,GACtB,qBAAqB,GACrB,iBAAiB,CAAC;AAcxB,wBAAgB,uBAA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;AAED,MAAM,MAAM,iBAAiB,GACvB,cAAc,GACd,eAAe,GACf,aAAa,GACb,aAAa,GACb,iBAAiB,GACjB,iBAAiB,GACjB,sBAAsB,GACtB,qBAAqB,GACrB,iBAAiB,CAAC;AAcxB,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAE7E;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAE3E;AA2BD,wBAAgB,kBAAkB,CAC9B,YAAY,EAAE,kBAAkB,EAChC,KAAK,GAAE,mBAAgC,GACxC,MAAM,CAER;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,kBAAkB,GAAG,MAAM,CAEzE;AAED,wBAAgB,sBAAsB,CAClC,YAAY,EAAE,qBAAqB,EACnC,KAAK,GAAE,mBAAgC,GACxC,MAAM,CAER;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,qBAAqB,GAAG,MAAM,CAEhF"}
@@ -108,9 +108,12 @@ export interface ProvenInputFloorResult {
108
108
  }
109
109
  export declare function hasTrustedAbsoluteWall(geometry: WindowGeometryResult): boolean;
110
110
  /**
111
- * Successful requests can disprove static catalog metadata, but cannot
112
- * disprove a provider, overlay, or observed-overflow wall. A reading beyond
113
- * that wall is malformed usage accounting and must not enlarge the geometry.
111
+ * Successful requests can disprove static catalog metadata, but do not widen a
112
+ * provider, overlay, or observed-overflow wall here. A provider or overlay wall
113
+ * is the configured limit: a reading beyond it is real pressure against that
114
+ * limit (the usage handlers count it in full), not proof that the geometry
115
+ * should grow. An observed-overflow wall that a larger accepted request
116
+ * disproves is cleared by the usage handlers instead.
114
117
  */
115
118
  export declare function applyProvenInputFloor(geometry: WindowGeometryResult, provenInputTokens: number | undefined): ProvenInputFloorResult;
116
119
  export declare function formatWindowDerivationLine(inputTokens: number, result: WindowGeometryResult): string;
@@ -1 +1 @@
1
- {"version":3,"file":"window-geometry.d.ts","sourceRoot":"","sources":["../../src/shared/window-geometry.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CACvD;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAE9E;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,QAAQ,EAAE,oBAAoB,EAC9B,iBAAiB,EAAE,MAAM,GAAG,SAAS,GACtC,sBAAsB,CAuCxB;AAED,wBAAgB,0BAA0B,CACtC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,oBAAoB,GAC7B,MAAM,CAcR;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AA6DhE,OAAO,EAKH,KAAK,iBAAiB,EACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AA8kCrE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIhG"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AA8DhE,OAAO,EAKH,KAAK,iBAAiB,EACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AA4lCrE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIhG"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AA0BhE,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAM7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAapD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AA0eD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIxF"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AA8BhE,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAM7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAapD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AA4fD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,gDAAgD,CAAC;AAUxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,QAAQ,CAAC;IACb;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAiPD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,gDAAgD,CAAC;AAUxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,QAAQ,CAAC;IACb;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAmPD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAyBhE,OAAO,KAAK,EAAkC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAwMrE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAyBhE,OAAO,KAAK,EAAkC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AA0MrE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
@@ -0,0 +1,61 @@
1
+ import type { ContextDatabase } from "../../features/magic-context/storage";
2
+ import type { RawMessage } from "../../hooks/magic-context/read-session-raw";
3
+ import type { CompactionMarkerStrategy } from "../../hooks/magic-context/transform-postprocess-phase";
4
+ /**
5
+ * Resolve the boundary the served array starts at, given the module's baseline end.
6
+ *
7
+ * OpenCode 1 answers this question by writing a compaction row: it picks the
8
+ * nearest user message at or before the module's baseline end and serves the
9
+ * conversation from there. OpenCode 2 has no such row, so the same rule is
10
+ * applied here against the same raw projection. Keeping the rule identical is
11
+ * what makes the two hosts hand the module the same array for the same baseline.
12
+ *
13
+ * Returns null when the baseline end is unknown or no user message precedes it,
14
+ * which is the case a caller must treat as "do not move the boundary".
15
+ */
16
+ export declare function resolveBoundaryUserMessage(messages: readonly RawMessage[], endMessageId: string): RawMessage | null;
17
+ /**
18
+ * Marker lifecycle for Rust mode on OpenCode 2.
19
+ *
20
+ * On OpenCode 1 the module's materialized boundary becomes a real compaction row
21
+ * in the host's store. OpenCode 2 exposes no way to write such a row, so the
22
+ * boundary is recorded here instead, in the same `session_meta` columns the
23
+ * OpenCode 1 marker state already uses.
24
+ *
25
+ * Only the carrier differs. The advance-only rule and the compare-and-swap on the
26
+ * pending blob are the shared caller's, unchanged: this records a boundary that
27
+ * moved forward and declines one that did not.
28
+ */
29
+ export declare function createV2RustCompactionMarkerStrategy(
30
+ /**
31
+ * The nearest user turn at or before `endMessageId`, by the rule
32
+ * `resolveBoundaryUserMessage` states; null when there is none. The caller
33
+ * answers it from the store with a bounded backward read.
34
+ */
35
+ findBoundaryUserMessage: (sessionId: string, endMessageId: string) => RawMessage | null): CompactionMarkerStrategy;
36
+ /**
37
+ * Drop everything before the recorded boundary from the array about to be sent.
38
+ *
39
+ * This is the trim OpenCode 1 gets for free from its compaction row. OpenCode 2
40
+ * writes such a row only when it decides to compact, and a healthy Rust-mode
41
+ * session folds before the host's own trigger is ever reached — so on the normal
42
+ * path there is no host cut and this is the ONLY thing that keeps a folded
43
+ * session from handing the module its whole history again on every later turn.
44
+ * Measured with it removed: the array handed to the module grew from 15 to 53
45
+ * messages over twenty post-fold turns while the boundary stood still.
46
+ *
47
+ * It is silent when the host HAS cut, because the boundary message is then
48
+ * already gone from the array. An earlier pass mutated it under a fixture whose
49
+ * mock reported a constant usage — which kept the host compacting on every turn,
50
+ * and therefore always cutting — and concluded from the silence that it never
51
+ * fires at all.
52
+ *
53
+ * Returns the number of messages removed. A boundary that is not in the array is
54
+ * left alone: it either has not been reached yet or belongs to history the host
55
+ * has already dropped, and guessing in either direction would change what the
56
+ * model sees.
57
+ */
58
+ export declare function trimToRecordedBoundary(db: ContextDatabase, sessionId: string, messages: Array<{
59
+ id?: string;
60
+ }>): number;
61
+ //# sourceMappingURL=boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../src/v2/fold/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAO5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AAItG;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACtC,QAAQ,EAAE,SAAS,UAAU,EAAE,EAC/B,YAAY,EAAE,MAAM,GACrB,UAAU,GAAG,IAAI,CAQnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oCAAoC;AAChD;;;;GAIG;AACH,uBAAuB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,GACxF,wBAAwB,CAwD1B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,KAAK,CAAC;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACjC,MAAM,CAQR"}
@@ -1 +1 @@
1
- {"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../../src/v2/fold/restore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAWhD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IACzB,yEAAyE;IACzE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACxD,uDAAuD;IACvD,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAClG;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7F;AA6ED;;;GAGG;AACH,wBAAgB,UAAU,CACtB,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EACzC,KAAK,CAAC,EAAE,YAAY,GACrB,SAAS,EAAE,CA+Hb"}
1
+ {"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../../src/v2/fold/restore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAWhD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IACzB,yEAAyE;IACzE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACxD,uDAAuD;IACvD,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAClG;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7F;AA6ED;;;GAGG;AACH,wBAAgB,UAAU,CACtB,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EACzC,KAAK,CAAC,EAAE,YAAY,GACrB,SAAS,EAAE,CAmIb"}
@@ -109,12 +109,25 @@ export interface V2HiddenCompletionOptions {
109
109
  export declare function hiddenChildrenMetaKey(projectIdentity: string): string;
110
110
  /**
111
111
  * A terminal provider or model-resolution failure persisted by the host, as opposed to an unsettled
112
- * dispatch error, timeout, or abort. Only this class keeps the now-idle child alive, so reuse does
113
- * not depend on wording that a later editor could accidentally change.
112
+ * dispatch error, timeout, or abort. The type keeps lifecycle handling independent of provider
113
+ * wording; terminal provider failures are quarantined by retiring the child before its attempt
114
+ * marker is released.
114
115
  */
115
116
  export declare class HiddenProviderError extends Error {
116
- constructor(detail: string);
117
+ readonly settled: boolean;
118
+ constructor(detail: string, options?: {
119
+ settled?: boolean;
120
+ });
117
121
  }
122
+ /** What the OpenCode 2 hidden executor can do; fixed for this host. */
123
+ export declare const V2_HIDDEN_EXECUTOR_CAPABILITIES: HiddenCompletionExecutor["capabilities"];
124
+ /**
125
+ * An executor that forwards to whichever executor `current` returns and refuses
126
+ * while there is none. Holders registered once at setup (RPC handlers and
127
+ * commands) get this after a refused storage open, so the executor wired on the
128
+ * first successful open later reaches them without a restart.
129
+ */
130
+ export declare function createLateHiddenExecutor(current: () => HiddenCompletionExecutor | undefined): HiddenCompletionExecutor;
118
131
  export declare function createV2HiddenCompletionExecutor(host: HiddenChildHost, options: V2HiddenCompletionOptions): Promise<HiddenCompletionExecutor>;
119
132
  export {};
120
133
  //# sourceMappingURL=hidden-completion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-completion.d.ts","sourceRoot":"","sources":["../../src/v2/hidden-completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,wBAAwB,EAG3B,MAAM,iDAAiD,CAAC;AAQzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAKH,KAAK,eAAe,EAGvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,gBAAgB,EAA4C,MAAM,gBAAgB,CAAC;AACjG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAU/C,KAAK,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,gBAAgB,CAAC;AA0ClE,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,KAAK,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5D,QAAQ,EAAE;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;QAChC,QAAQ,EAAE;YAAE,aAAa,EAAE,YAAY,CAAC;YAAC,IAAI,EAAE,eAAe,CAAA;SAAE,CAAC;KAC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,CA6fnC"}
@@ -1,9 +1,30 @@
1
+ import { loadPluginConfigDetailed } from "../../config";
2
+ import { createSystemPromptHashHandler } from "../../hooks/magic-context/system-prompt-hash";
1
3
  import { type TransformDeps } from "../../hooks/magic-context/transform";
2
4
  import type { PromptSurfaceConfig } from "../../shared/prompt-surface";
3
5
  import { type PromptSurfaceRuntime } from "../../shared/prompt-surface-runtime";
4
6
  import type { SessionContext, V2Context } from "./types";
5
7
  export declare function isBlockingV2TransformError(error: unknown): boolean;
8
+ /**
9
+ * Cache the directory the host bound a session to, looked up once per session.
10
+ *
11
+ * On OpenCode 1 the shared transform asks the SDK client for this and records
12
+ * the session-to-project binding (`session_projects`) only when the host
13
+ * answered. OpenCode 2 gives plugins no SDK client, so without this lookup the
14
+ * transform always fell back to the launch directory, never recorded a binding,
15
+ * and the Dashboard found no project for any OpenCode 2 session. The session's
16
+ * directory is fixed at creation, so one successful answer is kept for the
17
+ * session's lifetime; a failed lookup is retried on the next pass.
18
+ */
19
+ export declare function cacheV2SessionDirectory(session: Pick<V2Context["session"], "get">, sessionID: string, directories: Map<string, string>): Promise<void>;
6
20
  export declare function createHostSeams(context: V2Context, readAllForConversion: TransformDeps["hostRawMessages"] & {}, reconciliationSource: NonNullable<TransformDeps["hostMessageReconciliationSource"]>, liveModels: NonNullable<TransformDeps["liveModelBySession"]>): Required<Pick<TransformDeps, "hostRawMessages" | "hostMessageReconciliationSource" | "hostProtectedTailBoundary" | "hostModelFallback" | "hostRefusalNotice" | "hostRefuse">>;
21
+ type V2ThresholdConfig = Pick<ReturnType<typeof loadPluginConfigDetailed>["config"], "execute_threshold_percentage" | "execute_threshold_tokens">;
22
+ /**
23
+ * The execute thresholds the shared transform and its scheduler read, built the way the
24
+ * OpenCode 1 hook builds them: the percentage and the absolute token threshold, which
25
+ * overrides the percentage when set. Like OpenCode 1, both are read once at startup.
26
+ */
27
+ export declare function createV2ThresholdDeps(config: V2ThresholdConfig): Pick<TransformDeps, "scheduler" | "executeThresholdPercentage" | "executeThresholdTokens">;
7
28
  /**
8
29
  * Record why a turn is about to be refused before the model is called.
9
30
  *
@@ -30,20 +51,6 @@ export declare function catalogModels(listed: unknown, draftModel?: SessionConte
30
51
  export declare function removeDreamerOnlyTools(draft: SessionContext): void;
31
52
  /** Rewrite Magic Context ctx_* tool descriptions for this draft's model. */
32
53
  export declare function applyV2PromptSurfaceTools(draft: SessionContext, runtime: PromptSurfaceRuntime, config: PromptSurfaceConfig | undefined): void;
33
- /**
34
- * Experimental Rust mode is a v1-only route: the Rust transform reaches the module over a subc
35
- * transport that only the v1 server lane constructs, and nothing on this lane builds or owns one.
36
- * Rather than accepting the setting and quietly running something else, downgrade it here, once,
37
- * where every later reader of the config sees the mode that is actually running — including the
38
- * RPC status and sidebar handlers, which otherwise ask a Rust module that does not exist for the
39
- * session state and answer every status request with an error.
40
- *
41
- * The downgrade is announced twice on purpose: once in the log for whoever is reading it, and as a
42
- * named limitation that /ctx-status and the sidebar keep showing for as long as the process runs.
43
- */
44
- export declare function resolveV2TransformMode<T extends {
45
- transform_mode?: "ts" | "rust";
46
- }>(config: T): T;
47
54
  /**
48
55
  * Measure the tool definitions this request is actually going to send.
49
56
  *
@@ -57,7 +64,31 @@ export declare function resolveV2TransformMode<T extends {
57
64
  * m[0] materialization decision records but never folds on.
58
65
  */
59
66
  export declare function recordV2ToolDefinitions(draft: SessionContext): void;
67
+ /**
68
+ * Run the system-prompt handler over one context draft and write its result back.
69
+ *
70
+ * The handler only compares and records the system-prompt hash once the session's
71
+ * ctx_reduce verdict is frozen, because that verdict chooses the guidance text.
72
+ * When nothing has frozen the verdict yet in this process, the handler falls
73
+ * back to reading the first user message from OpenCode 1's `message` table. On
74
+ * OpenCode 2 that read never succeeds (its store has a different schema), so
75
+ * without freezing the verdict here first, the first pass after every restart
76
+ * left the verdict provisional and skipped the hash comparison. A restart that changed the system
77
+ * prompt then sent the new prompt on that first pass (so the provider cache was
78
+ * lost there anyway) and only detected the change on the second pass, whose
79
+ * separate HARD fold rebuilt the cache a second time.
80
+ *
81
+ * The verdict is therefore frozen first, from this draft's messages, with the
82
+ * same resolver and the same message shape the message transform later in this
83
+ * pass freezes it from (the adapted messages carry no per-message tools map, see
84
+ * payload.ts), so it can only freeze to the value the transform would have
85
+ * frozen. A draft with no user message leaves the verdict provisional, as before.
86
+ * Any future read of OpenCode 2's ctx_reduce permissions has to run before this
87
+ * call: once frozen, the verdict never changes for the session.
88
+ */
89
+ export declare function applyV2SystemPrompt(systemPrompt: Pick<ReturnType<typeof createSystemPromptHashHandler>, "handler">, draft: Pick<SessionContext, "sessionID" | "model" | "messages" | "system">): Promise<void>;
60
90
  export declare function registerContext(context: V2Context): Promise<{
61
91
  dispose(): Promise<void>;
62
92
  } | undefined>;
93
+ export {};
63
94
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/context.ts"],"names":[],"mappings":"AAsDA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAc1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAGH,KAAK,oBAAoB,EAC5B,MAAM,qCAAqC,CAAC;AA8B7C,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAElE;AA4BD,wBAAgB,eAAe,CAC3B,OAAO,EAAE,SAAS,EAClB,oBAAoB,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,EAAE,EAC3D,oBAAoB,EAAE,WAAW,CAAC,aAAa,CAAC,iCAAiC,CAAC,CAAC,EACnF,UAAU,EAAE,WAAW,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC,GAC7D,QAAQ,CACP,IAAI,CACA,aAAa,EACX,iBAAiB,GACjB,iCAAiC,GACjC,2BAA2B,GAC3B,mBAAm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AAK,EAAE,OAAO,GAAG,IAAI,CAMhF;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CACzB,MAAM,EAAE,OAAO,EACf,UAAU,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,GACrC,KAAK,CAAC;IACL,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D,CAAC,CAyCD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAElE;AAED,4EAA4E;AAC5E,wBAAgB,yBAAyB,CACrC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,mBAAmB,GAAG,SAAS,GACxC,IAAI,CAUN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAgBnE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,mBAAmB,CACrC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,6BAA6B,CAAC,EAAE,SAAS,CAAC,EAC/E,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC,GAC3E,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,SAAS;;eAwnCvD"}
@@ -7,12 +7,18 @@ export declare const HIDDEN_CURATE_AGENT = "dreamer";
7
7
  export declare function hiddenAgentFor(identity: HiddenRunIdentity): string;
8
8
  export declare function hiddenToolLoop(identity: HiddenRunIdentity): boolean;
9
9
  export declare function registerHiddenChildAgents(agent: Pick<V2AgentDomain, "transform">): Promise<void>;
10
+ export declare class HiddenAgentStepLimit extends Error {
11
+ readonly agent: string;
12
+ readonly cap: number;
13
+ constructor(agent: string, cap: number);
14
+ }
10
15
  export interface HiddenChildAttempt {
11
16
  childSessionId: string;
12
17
  identity: HiddenRunIdentity;
13
18
  request: PromptArgs;
14
19
  shaped: boolean;
15
20
  steps?: number;
21
+ stepLimit?: HiddenAgentStepLimit;
16
22
  observedMessages?: SessionContext["messages"];
17
23
  marker?: string;
18
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-child.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/hidden-child.ts"],"names":[],"mappings":"AAOA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAClD,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,eAAO,MAAM,mBAAmB,YAAgB,CAAC;AAmBjD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAQlE;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAEnE;AAED,wBAAsB,yBAAyB,CAC3C,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,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AC;AAiGxF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,WAAW,GAAE,WAAW,CAAC,MAAM,CAAa;;;EA+R/F"}
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,QAAQ,iEAAkE,CAAC;AAgKxF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,WAAW,GAAE,WAAW,CAAC,MAAM,CAAa;;;EAmT/F"}
@@ -2,6 +2,14 @@ import type { V2Context } from "./types";
2
2
  export declare class V2ContextRefusal extends Error {
3
3
  constructor(message?: string, options?: ErrorOptions);
4
4
  }
5
+ /** How long the host gets to confirm an interrupt before the turn is refused anyway. */
6
+ export declare const INTERRUPT_CONFIRMATION_TIMEOUT_MS = 2000;
7
+ /** Timer functions the interrupt deadline uses. Tests pass a manual clock so the
8
+ * deadline fires when the test says so, not when a busy event loop gets to it. */
9
+ export interface InterruptTimers {
10
+ setTimeout(callback: () => void, ms: number): unknown;
11
+ clearTimeout(handle: unknown): void;
12
+ }
5
13
  /** An idle no-op is not confirmation that the pending provider request was cancelled. */
6
- export declare function interruptBeforeProvider(session: Pick<V2Context["session"], "interrupt">, sessionID: Parameters<V2Context["session"]["interrupt"]>[0]["sessionID"]): Promise<void>;
14
+ export declare function interruptBeforeProvider(session: Pick<V2Context["session"], "interrupt">, sessionID: Parameters<V2Context["session"]["interrupt"]>[0]["sessionID"], timers?: InterruptTimers): Promise<void>;
7
15
  //# sourceMappingURL=refusal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,qBAAa,gBAAiB,SAAQ,KAAK;gBAEnC,OAAO,SAAqD,EAC5D,OAAO,CAAC,EAAE,YAAY;CAK7B;AAED,yFAAyF;AACzF,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,EAChD,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GACzE,OAAO,CAAC,IAAI,CAAC,CAgBf"}
1
+ {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,qBAAa,gBAAiB,SAAQ,KAAK;gBAEnC,OAAO,SAAqD,EAC5D,OAAO,CAAC,EAAE,YAAY;CAK7B;AAED,wFAAwF;AACxF,eAAO,MAAM,iCAAiC,OAAO,CAAC;AAEtD;kFACkF;AAClF,MAAM,WAAW,eAAe;IAC5B,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACvC;AAOD,yFAAyF;AACzF,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,EAChD,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EACxE,MAAM,GAAE,eAA8B,GACvC,OAAO,CAAC,IAAI,CAAC,CAsBf"}
@@ -0,0 +1,29 @@
1
+ import type { StoreRow, V2StoreReader } from "../store-reader";
2
+ /** The reader surface the restore needs: 100-row pages plus undecoded per-row stamps. */
3
+ export type RestoreRowReader = Pick<V2StoreReader, "page" | "spanRowStamps">;
4
+ /**
5
+ * Keeps the rows an OpenCode 2 host checkpoint hid from the context draft, so each
6
+ * pass decodes only the rows it has not seen yet.
7
+ *
8
+ * After a host checkpoint the draft starts at the checkpoint, and every pass has to put
9
+ * back the rows between the last Magic Context boundary and the checkpoint. With no
10
+ * boundary yet (a long session before its first compartment) that span is the whole
11
+ * history before the checkpoint, and reading it again on every pass decoded the whole
12
+ * session every turn. Instead each pass reads one stamp per row of the span, without
13
+ * decoding anything (id, update time and data size, see `spanRowStamps`), reuses every
14
+ * kept row whose stamp is unchanged, and decodes only the rows that are new or whose
15
+ * stamp changed, in 100-row pages. A row the host deleted is simply absent from the
16
+ * stamps, and a row it rewrote in place to a different size or with a new update time
17
+ * is read again, so the rows handed back are the rows a full read would return and what
18
+ * the transform serves does not change.
19
+ */
20
+ export declare class RestoredRowCache {
21
+ private readonly capacity;
22
+ private readonly sessions;
23
+ constructor(capacity?: number);
24
+ /** Rows with `after < seq <= through`, ascending by seq. */
25
+ rows(reader: RestoreRowReader, sessionID: string, after: number, through: number): StoreRow[];
26
+ forget(sessionID: string): void;
27
+ clear(): void;
28
+ }
29
+ //# sourceMappingURL=restore-rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restore-rows.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/restore-rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE/D,yFAAyF;AACzF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC;AAO7E;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAgB;IAGb,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2C;gBAEvC,QAAQ,SAAK;IAE1C,4DAA4D;IAC5D,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,EAAE;IA6C7F,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI/B,KAAK,IAAI,IAAI;CAGhB"}
@@ -5,5 +5,5 @@ import { type LiveSessionState } from "../../hooks/magic-context/live-session-st
5
5
  * RPC signals it, and only the shared instance is the one the next
6
6
  * system-prompt transform drains.
7
7
  */
8
- export declare function createV2RpcLiveSessionState(overrides: Pick<LiveSessionState, "liveModelBySession" | "variantBySession" | "agentBySession" | "channel1StateBySession" | "historyRefreshSessions" | "pendingMaterializationSessions" | "systemPromptRefreshSessions">): LiveSessionState;
8
+ export declare function createV2RpcLiveSessionState(overrides: Pick<LiveSessionState, "liveModelBySession" | "variantBySession" | "agentBySession" | "channel1StateBySession" | "historyRefreshSessions" | "pendingMaterializationSessions" | "systemPromptRefreshSessions" | "sessionDirectoryBySession">): LiveSessionState;
9
9
  //# sourceMappingURL=rpc-live-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-live-state.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/rpc-live-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,8CAA8C,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,IAAI,CACX,gBAAgB,EACd,oBAAoB,GACpB,kBAAkB,GAClB,gBAAgB,GAChB,wBAAwB,GACxB,wBAAwB,GACxB,gCAAgC,GAChC,6BAA6B,CAClC,GACF,gBAAgB,CAElB"}
1
+ {"version":3,"file":"rpc-live-state.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/rpc-live-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,8CAA8C,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,IAAI,CACX,gBAAgB,EACd,oBAAoB,GACpB,kBAAkB,GAClB,gBAAgB,GAChB,wBAAwB,GACxB,wBAAwB,GACxB,gCAAgC,GAChC,6BAA6B,GAC7B,2BAA2B,CAChC,GACF,gBAAgB,CAElB"}
@@ -0,0 +1,47 @@
1
+ import type { RustModeModuleClient } from "../../hooks/magic-context/rust-mode-transform";
2
+ import { type RustRefusalRecovery, type RustRefusalRecoveryOptions } from "../../hooks/magic-context/rust-refusal-recovery";
3
+ import type { StoreRow } from "../store-reader";
4
+ import type { V2Context } from "./types";
5
+ /**
6
+ * Build the module client for this lane when Rust mode is the configured mode.
7
+ *
8
+ * Returns undefined for TypeScript mode so every later reader — the transform,
9
+ * the RPC status handlers, the sidebar — sees the same "no module here" answer
10
+ * rather than each deciding for itself.
11
+ */
12
+ export declare function resolveV2RustModeModuleClient(config: {
13
+ transform_mode?: "ts" | "rust";
14
+ subc?: {
15
+ connection_file?: string;
16
+ };
17
+ }, directory: string): RustModeModuleClient | undefined;
18
+ /**
19
+ * Whether the refused turn is still the step the conversation is waiting on.
20
+ *
21
+ * The answer comes from the v2 store's own rows. A user turn recorded after the
22
+ * refused one means the user already retried or moved on, and delivering the
23
+ * synthetic continue then would inject an instruction about a turn nobody is
24
+ * waiting for any more.
25
+ */
26
+ export declare function refusedStepStillCurrent(rows: readonly StoreRow[], refusedUserMessageId: string): boolean;
27
+ /**
28
+ * Refusal recovery for Rust mode on OpenCode 2.
29
+ *
30
+ * The behavior is the OpenCode 1 behavior; only the two host-owned edges move.
31
+ * The synthetic continue goes out through this host's own synthetic carrier, the
32
+ * same one Channel 2 nudges use, so the message is admitted and recognized like
33
+ * every other Magic Context synthetic. The "has the conversation moved on?" check
34
+ * reads the v2 store rather than OpenCode 1's message table, which on this host
35
+ * holds a different session's history or no history at all.
36
+ */
37
+ export declare function createV2RustRefusalRecovery(args: {
38
+ context: Pick<V2Context, "session" | "storage">;
39
+ moduleClient: RustModeModuleClient;
40
+ /**
41
+ * The session's rows from `messageID` onward, oldest first; empty when the
42
+ * message is not in the store. Bounded to the tail so a long session is
43
+ * never read whole on a refusal poll.
44
+ */
45
+ readRowsFrom: (sessionID: string, messageID: string) => readonly StoreRow[];
46
+ } & Pick<RustRefusalRecoveryOptions, "pollIntervalMs" | "maxDurationMs" | "probeTimeoutMs">): RustRefusalRecovery;
47
+ //# sourceMappingURL=rust-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rust-mode.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/rust-mode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAEH,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAClC,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzC;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CACzC,MAAM,EAAE;IAAE,cAAc,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,EAC/E,SAAS,EAAE,MAAM,GAClB,oBAAoB,GAAG,SAAS,CAQlC;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,oBAAoB,EAAE,MAAM,GAC7B,OAAO,CAIT;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE;IACF,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;IAChD,YAAY,EAAE,oBAAoB,CAAC;IACnC;;;;OAIG;IACH,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,SAAS,QAAQ,EAAE,CAAC;CAC/E,GAAG,IAAI,CAAC,0BAA0B,EAAE,gBAAgB,GAAG,eAAe,GAAG,gBAAgB,CAAC,GAC5F,mBAAmB,CAkBrB"}
@@ -0,0 +1,15 @@
1
+ import { type BackfillResult } from "../../features/magic-context/session-project-backfill";
2
+ import type { Database } from "../../shared/sqlite";
3
+ import type { V2StoreReader } from "../store-reader";
4
+ /**
5
+ * Bind every existing OpenCode 2 session to its project.
6
+ *
7
+ * The OpenCode 1 lane runs the same backfill at boot over the host's `session`
8
+ * table. OpenCode 2 never runs that lane, and its sessions live in
9
+ * `session_v2`, so sessions created before the plugin started recording the
10
+ * binding (or while it could not) stayed projectless: the Dashboard groups
11
+ * sessions into projects only through `session_projects`. The backfill records
12
+ * completion per harness, so this pass runs to completion once per store.
13
+ */
14
+ export declare function runV2SessionProjectBackfill(db: Database, openStoreReader: () => Pick<V2StoreReader, "sessionDirectoryPage" | "close">): Promise<BackfillResult>;
15
+ //# sourceMappingURL=session-project-backfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-project-backfill.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/session-project-backfill.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,cAAc,EAEtB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACvC,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,OAAO,CAAC,GAC7E,OAAO,CAAC,cAAc,CAAC,CASzB"}
@@ -0,0 +1,42 @@
1
+ import { type FailClosedReason } from "../../features/magic-context/fail-closed-block";
2
+ import { type ContextDatabase } from "../../features/magic-context/storage";
3
+ /**
4
+ * The shortest time between two storage open attempts while the context database
5
+ * is unavailable. A refused open is not free: the migration guard lists processes
6
+ * and reads every RPC discovery file, so a session that sends turns quickly must
7
+ * not repeat it on every pass. Five seconds still lets the first turn a user sends
8
+ * after stopping the blocking host go through.
9
+ */
10
+ export declare const V2_STORAGE_REOPEN_INTERVAL_MS = 5000;
11
+ export interface V2StorageGate {
12
+ /** The durable database once an open has succeeded; never attempts an open. */
13
+ current(): ContextDatabase | undefined;
14
+ /** Why the last attempt left no durable database, or null when none has failed. */
15
+ reason(): FailClosedReason | null;
16
+ /** Attempt an open now, whatever the interval, without throwing. */
17
+ probe(): ContextDatabase | undefined;
18
+ /**
19
+ * The durable database. While storage is unavailable this re-attempts the open
20
+ * at most once per interval and otherwise throws a `FailClosedBlockingError`
21
+ * whose message names the recorded reason.
22
+ */
23
+ require(): ContextDatabase;
24
+ }
25
+ export interface V2StorageGateOptions {
26
+ open?: () => ContextDatabase | null;
27
+ now?: () => number;
28
+ reopenIntervalMs?: number;
29
+ /** Called when an attempt fails for a reason different from the previous one. */
30
+ onUnavailable?: (reason: FailClosedReason) => void;
31
+ /** Called when an attempt succeeds after an earlier one failed. */
32
+ onRecovered?: (db: ContextDatabase) => void;
33
+ }
34
+ /**
35
+ * Own the OpenCode 2 lane's context database handle across the life of the host
36
+ * process. A refused open (a migration blocked by an older host, a database
37
+ * newer than this build, an open error) is remembered with its reason and
38
+ * retried on later turns, so the lane recovers without a host restart once the
39
+ * cause is gone.
40
+ */
41
+ export declare function createV2StorageGate(options?: V2StorageGateOptions): V2StorageGate;
42
+ //# sourceMappingURL=storage-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-gate.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/storage-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACH,KAAK,eAAe,EAIvB,MAAM,sCAAsC,CAAC;AAI9C;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC1B,+EAA+E;IAC/E,OAAO,IAAI,eAAe,GAAG,SAAS,CAAC;IACvC,mFAAmF;IACnF,MAAM,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAClC,oEAAoE;IACpE,KAAK,IAAI,eAAe,GAAG,SAAS,CAAC;IACrC;;;;OAIG;IACH,OAAO,IAAI,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACjC,IAAI,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IACpC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACnD,mEAAmE;IACnE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,eAAe,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAoDrF"}