@wrongstack/core 0.284.0 → 0.285.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 (810) hide show
  1. package/dist/agent-status-tracker.d.ts +74 -0
  2. package/dist/agent-status-tracker.d.ts.map +1 -0
  3. package/dist/autophase/auto-phase-planner.d.ts +79 -0
  4. package/dist/autophase/auto-phase-planner.d.ts.map +1 -0
  5. package/dist/autophase/auto-phase-runner.d.ts +79 -0
  6. package/dist/autophase/auto-phase-runner.d.ts.map +1 -0
  7. package/dist/autophase/checkpoint.d.ts +49 -0
  8. package/dist/autophase/checkpoint.d.ts.map +1 -0
  9. package/dist/autophase/index.d.ts +9 -0
  10. package/dist/autophase/index.d.ts.map +1 -0
  11. package/dist/autophase/phase-graph-builder.d.ts +46 -0
  12. package/dist/autophase/phase-graph-builder.d.ts.map +1 -0
  13. package/dist/autophase/phase-orchestrator.d.ts +150 -0
  14. package/dist/autophase/phase-orchestrator.d.ts.map +1 -0
  15. package/dist/autophase/phase-store.d.ts +29 -0
  16. package/dist/autophase/phase-store.d.ts.map +1 -0
  17. package/dist/autophase/types.d.ts +329 -0
  18. package/dist/autophase/types.d.ts.map +1 -0
  19. package/dist/boot.d.ts +73 -0
  20. package/dist/boot.d.ts.map +1 -0
  21. package/dist/coordination/adaptive-concurrency.d.ts +63 -0
  22. package/dist/coordination/adaptive-concurrency.d.ts.map +1 -0
  23. package/dist/coordination/agent-bridge.d.ts +24 -0
  24. package/dist/coordination/agent-bridge.d.ts.map +1 -0
  25. package/dist/coordination/agent-monitor.d.ts +100 -0
  26. package/dist/coordination/agent-monitor.d.ts.map +1 -0
  27. package/dist/coordination/agent-subagent-runner.d.ts +74 -0
  28. package/dist/coordination/agent-subagent-runner.d.ts.map +1 -0
  29. package/dist/coordination/agents/agent-prompts.d.ts +2 -0
  30. package/dist/coordination/agents/agent-prompts.d.ts.map +1 -0
  31. package/dist/coordination/agents/index.d.ts +35 -0
  32. package/dist/coordination/agents/index.d.ts.map +1 -0
  33. package/dist/coordination/agents/phase1-discovery.d.ts +4 -0
  34. package/dist/coordination/agents/phase1-discovery.d.ts.map +1 -0
  35. package/dist/coordination/agents/phase2-planning.d.ts +4 -0
  36. package/dist/coordination/agents/phase2-planning.d.ts.map +1 -0
  37. package/dist/coordination/agents/phase3-build.d.ts +4 -0
  38. package/dist/coordination/agents/phase3-build.d.ts.map +1 -0
  39. package/dist/coordination/agents/phase3-techstack.d.ts +13 -0
  40. package/dist/coordination/agents/phase3-techstack.d.ts.map +1 -0
  41. package/dist/coordination/agents/phase4-verify.d.ts +4 -0
  42. package/dist/coordination/agents/phase4-verify.d.ts.map +1 -0
  43. package/dist/coordination/agents/phase5-review.d.ts +4 -0
  44. package/dist/coordination/agents/phase5-review.d.ts.map +1 -0
  45. package/dist/coordination/agents/phase6-domain.d.ts +4 -0
  46. package/dist/coordination/agents/phase6-domain.d.ts.map +1 -0
  47. package/dist/coordination/agents/phase7-knowledge.d.ts +4 -0
  48. package/dist/coordination/agents/phase7-knowledge.d.ts.map +1 -0
  49. package/dist/coordination/agents/phase8-delivery.d.ts +4 -0
  50. package/dist/coordination/agents/phase8-delivery.d.ts.map +1 -0
  51. package/dist/coordination/agents/phase9-meta.d.ts +4 -0
  52. package/dist/coordination/agents/phase9-meta.d.ts.map +1 -0
  53. package/dist/coordination/agents/types.d.ts +79 -0
  54. package/dist/coordination/agents/types.d.ts.map +1 -0
  55. package/dist/coordination/agents.d.ts +8 -0
  56. package/dist/coordination/agents.d.ts.map +1 -0
  57. package/dist/coordination/auto-extend.d.ts +46 -0
  58. package/dist/coordination/auto-extend.d.ts.map +1 -0
  59. package/dist/coordination/autonomous-brain.d.ts +154 -0
  60. package/dist/coordination/autonomous-brain.d.ts.map +1 -0
  61. package/dist/coordination/autonomous-coordinator.d.ts +239 -0
  62. package/dist/coordination/autonomous-coordinator.d.ts.map +1 -0
  63. package/dist/coordination/brain-monitor.d.ts +74 -0
  64. package/dist/coordination/brain-monitor.d.ts.map +1 -0
  65. package/dist/coordination/brain.d.ts +104 -0
  66. package/dist/coordination/brain.d.ts.map +1 -0
  67. package/dist/coordination/change-manager.d.ts +151 -0
  68. package/dist/coordination/change-manager.d.ts.map +1 -0
  69. package/dist/coordination/checkpoint-wiring.d.ts +61 -0
  70. package/dist/coordination/checkpoint-wiring.d.ts.map +1 -0
  71. package/dist/coordination/collab-bus.d.ts +132 -0
  72. package/dist/coordination/collab-bus.d.ts.map +1 -0
  73. package/dist/coordination/collab-debug.d.ts +302 -0
  74. package/dist/coordination/collab-debug.d.ts.map +1 -0
  75. package/dist/coordination/commit-safety.d.ts +72 -0
  76. package/dist/coordination/commit-safety.d.ts.map +1 -0
  77. package/dist/coordination/consensus-protocol.d.ts +106 -0
  78. package/dist/coordination/consensus-protocol.d.ts.map +1 -0
  79. package/dist/coordination/coordinator/error-classifier.d.ts +15 -0
  80. package/dist/coordination/coordinator/error-classifier.d.ts.map +1 -0
  81. package/dist/coordination/delegate-tool.d.ts +101 -0
  82. package/dist/coordination/delegate-tool.d.ts.map +1 -0
  83. package/dist/coordination/dep-watcher-bridge.d.ts +47 -0
  84. package/dist/coordination/dep-watcher-bridge.d.ts.map +1 -0
  85. package/dist/coordination/dep-watcher.d.ts +74 -0
  86. package/dist/coordination/dep-watcher.d.ts.map +1 -0
  87. package/dist/coordination/director/director-errors.d.ts +29 -0
  88. package/dist/coordination/director/director-errors.d.ts.map +1 -0
  89. package/dist/coordination/director-construction.d.ts +90 -0
  90. package/dist/coordination/director-construction.d.ts.map +1 -0
  91. package/dist/coordination/director-prompts.d.ts +119 -0
  92. package/dist/coordination/director-prompts.d.ts.map +1 -0
  93. package/dist/coordination/director-session.d.ts +68 -0
  94. package/dist/coordination/director-session.d.ts.map +1 -0
  95. package/dist/coordination/director-tools.d.ts +65 -0
  96. package/dist/coordination/director-tools.d.ts.map +1 -0
  97. package/dist/coordination/director.d.ts +802 -0
  98. package/dist/coordination/director.d.ts.map +1 -0
  99. package/dist/coordination/dispatcher.d.ts +82 -0
  100. package/dist/coordination/dispatcher.d.ts.map +1 -0
  101. package/dist/coordination/file-author-tracker.d.ts +76 -0
  102. package/dist/coordination/file-author-tracker.d.ts.map +1 -0
  103. package/dist/coordination/fleet-bus.d.ts +122 -0
  104. package/dist/coordination/fleet-bus.d.ts.map +1 -0
  105. package/dist/coordination/fleet-event-validation.d.ts +10 -0
  106. package/dist/coordination/fleet-event-validation.d.ts.map +1 -0
  107. package/dist/coordination/fleet-manager.d.ts +234 -0
  108. package/dist/coordination/fleet-manager.d.ts.map +1 -0
  109. package/dist/coordination/fleet-spawn.d.ts +102 -0
  110. package/dist/coordination/fleet-spawn.d.ts.map +1 -0
  111. package/dist/coordination/fleet-status-tool.d.ts +36 -0
  112. package/dist/coordination/fleet-status-tool.d.ts.map +1 -0
  113. package/dist/coordination/fleet-supervisor.d.ts +157 -0
  114. package/dist/coordination/fleet-supervisor.d.ts.map +1 -0
  115. package/dist/coordination/fleet.d.ts +96 -0
  116. package/dist/coordination/fleet.d.ts.map +1 -0
  117. package/dist/coordination/global-mailbox.d.ts +234 -0
  118. package/dist/coordination/global-mailbox.d.ts.map +1 -0
  119. package/dist/coordination/icoordinator.d.ts +97 -0
  120. package/dist/coordination/icoordinator.d.ts.map +1 -0
  121. package/dist/coordination/ifleet-manager.d.ts +177 -0
  122. package/dist/coordination/ifleet-manager.d.ts.map +1 -0
  123. package/dist/coordination/in-memory-transport.d.ts +12 -0
  124. package/dist/coordination/in-memory-transport.d.ts.map +1 -0
  125. package/dist/coordination/index.d.ts +78 -2587
  126. package/dist/coordination/index.d.ts.map +1 -0
  127. package/dist/coordination/index.js +739 -254
  128. package/dist/coordination/index.js.map +7 -1
  129. package/dist/coordination/knowledge-graph.d.ts +217 -0
  130. package/dist/coordination/knowledge-graph.d.ts.map +1 -0
  131. package/dist/coordination/large-answer-store.d.ts +61 -0
  132. package/dist/coordination/large-answer-store.d.ts.map +1 -0
  133. package/dist/coordination/mail-tools.d.ts +34 -0
  134. package/dist/coordination/mail-tools.d.ts.map +1 -0
  135. package/dist/coordination/mailbox-actions.d.ts +68 -0
  136. package/dist/coordination/mailbox-actions.d.ts.map +1 -0
  137. package/dist/coordination/mailbox-health.d.ts +131 -0
  138. package/dist/coordination/mailbox-health.d.ts.map +1 -0
  139. package/dist/coordination/mailbox-hooks.d.ts +55 -0
  140. package/dist/coordination/mailbox-hooks.d.ts.map +1 -0
  141. package/dist/coordination/mailbox-tool.d.ts +75 -0
  142. package/dist/coordination/mailbox-tool.d.ts.map +1 -0
  143. package/dist/{mailbox-types-BGZWrYTJ.d.ts → coordination/mailbox-types.d.ts} +37 -22
  144. package/dist/coordination/mailbox-types.d.ts.map +1 -0
  145. package/dist/coordination/mailbox.d.ts +69 -0
  146. package/dist/coordination/mailbox.d.ts.map +1 -0
  147. package/dist/coordination/model-matrix.d.ts +98 -0
  148. package/dist/coordination/model-matrix.d.ts.map +1 -0
  149. package/dist/coordination/multi-agent-coordinator.d.ts +202 -0
  150. package/dist/coordination/multi-agent-coordinator.d.ts.map +1 -0
  151. package/dist/coordination/null-fleet-bus.d.ts +10 -0
  152. package/dist/coordination/null-fleet-bus.d.ts.map +1 -0
  153. package/dist/coordination/package-author-tracker.d.ts +87 -0
  154. package/dist/coordination/package-author-tracker.d.ts.map +1 -0
  155. package/dist/coordination/package-outdated-watcher.d.ts +83 -0
  156. package/dist/coordination/package-outdated-watcher.d.ts.map +1 -0
  157. package/dist/coordination/single-instance-mailbox.d.ts +154 -0
  158. package/dist/coordination/single-instance-mailbox.d.ts.map +1 -0
  159. package/dist/coordination/spawn-budget.d.ts +6 -0
  160. package/dist/coordination/spawn-budget.d.ts.map +1 -0
  161. package/dist/coordination/subagent-budget.d.ts +323 -0
  162. package/dist/coordination/subagent-budget.d.ts.map +1 -0
  163. package/dist/coordination/subagent-nicknames.d.ts +42 -0
  164. package/dist/coordination/subagent-nicknames.d.ts.map +1 -0
  165. package/dist/coordination/subagent-result-tool.d.ts +20 -0
  166. package/dist/coordination/subagent-result-tool.d.ts.map +1 -0
  167. package/dist/coordination/task-auctioneer.d.ts +143 -0
  168. package/dist/coordination/task-auctioneer.d.ts.map +1 -0
  169. package/dist/coordination/task-dag.d.ts +147 -0
  170. package/dist/coordination/task-dag.d.ts.map +1 -0
  171. package/dist/coordination/techstack-mailbox-consumer.d.ts +50 -0
  172. package/dist/coordination/techstack-mailbox-consumer.d.ts.map +1 -0
  173. package/dist/coordination/transport.d.ts +2 -0
  174. package/dist/coordination/transport.d.ts.map +1 -0
  175. package/dist/coordination/worktree-task-runner.d.ts +45 -0
  176. package/dist/coordination/worktree-task-runner.d.ts.map +1 -0
  177. package/dist/core/agent-internals.d.ts +41 -0
  178. package/dist/core/agent-internals.d.ts.map +1 -0
  179. package/dist/core/agent-loop.d.ts +18 -0
  180. package/dist/core/agent-loop.d.ts.map +1 -0
  181. package/dist/core/agent-response.d.ts +21 -0
  182. package/dist/core/agent-response.d.ts.map +1 -0
  183. package/dist/core/agent-tools.d.ts +21 -0
  184. package/dist/core/agent-tools.d.ts.map +1 -0
  185. package/dist/core/agent-types.d.ts +95 -0
  186. package/dist/core/agent-types.d.ts.map +1 -0
  187. package/dist/core/agent.d.ts +54 -0
  188. package/dist/core/agent.d.ts.map +1 -0
  189. package/dist/core/btw.d.ts +40 -0
  190. package/dist/core/btw.d.ts.map +1 -0
  191. package/dist/core/context.d.ts +269 -0
  192. package/dist/core/context.d.ts.map +1 -0
  193. package/dist/core/continue-intent.d.ts +92 -0
  194. package/dist/core/continue-intent.d.ts.map +1 -0
  195. package/dist/core/continue-to-next-iteration.d.ts +96 -0
  196. package/dist/core/continue-to-next-iteration.d.ts.map +1 -0
  197. package/dist/core/conversation-state.d.ts +96 -0
  198. package/dist/core/conversation-state.d.ts.map +1 -0
  199. package/dist/core/fallback-model.d.ts +94 -0
  200. package/dist/core/fallback-model.d.ts.map +1 -0
  201. package/dist/core/fleet-pulse.d.ts +42 -0
  202. package/dist/core/fleet-pulse.d.ts.map +1 -0
  203. package/dist/core/input-builder.d.ts +95 -0
  204. package/dist/core/input-builder.d.ts.map +1 -0
  205. package/dist/core/instruction-bundle.d.ts +22 -0
  206. package/dist/core/instruction-bundle.d.ts.map +1 -0
  207. package/dist/core/iteration-limit.d.ts +35 -0
  208. package/dist/core/iteration-limit.d.ts.map +1 -0
  209. package/dist/core/mailbox-loop.d.ts +63 -0
  210. package/dist/core/mailbox-loop.d.ts.map +1 -0
  211. package/dist/core/modes/brief.d.ts +2 -0
  212. package/dist/core/modes/brief.d.ts.map +1 -0
  213. package/dist/core/modes/default.d.ts +8 -0
  214. package/dist/core/modes/default.d.ts.map +1 -0
  215. package/dist/core/modes/teach.d.ts +2 -0
  216. package/dist/core/modes/teach.d.ts.map +1 -0
  217. package/dist/core/provider-runner.d.ts +24 -0
  218. package/dist/core/provider-runner.d.ts.map +1 -0
  219. package/dist/core/queued-messages.d.ts +55 -0
  220. package/dist/core/queued-messages.d.ts.map +1 -0
  221. package/dist/core/run-env.d.ts +49 -0
  222. package/dist/core/run-env.d.ts.map +1 -0
  223. package/dist/core/streaming-response-builder.d.ts +78 -0
  224. package/dist/core/streaming-response-builder.d.ts.map +1 -0
  225. package/dist/core/system-prompt-builder.d.ts +213 -0
  226. package/dist/core/system-prompt-builder.d.ts.map +1 -0
  227. package/dist/defaults/index.d.ts +68 -158
  228. package/dist/defaults/index.d.ts.map +1 -0
  229. package/dist/defaults/index.js +1257 -819
  230. package/dist/defaults/index.js.map +7 -1
  231. package/dist/execution/auto-compaction-middleware.d.ts +123 -0
  232. package/dist/execution/auto-compaction-middleware.d.ts.map +1 -0
  233. package/dist/execution/autonomous-runner.d.ts +55 -0
  234. package/dist/execution/autonomous-runner.d.ts.map +1 -0
  235. package/dist/execution/autonomy-brain.d.ts +90 -0
  236. package/dist/execution/autonomy-brain.d.ts.map +1 -0
  237. package/dist/execution/autonomy-prompt-contributor.d.ts +39 -0
  238. package/dist/execution/autonomy-prompt-contributor.d.ts.map +1 -0
  239. package/dist/execution/compaction-core.d.ts +103 -0
  240. package/dist/execution/compaction-core.d.ts.map +1 -0
  241. package/dist/execution/compactor.d.ts +56 -0
  242. package/dist/execution/compactor.d.ts.map +1 -0
  243. package/dist/execution/design-color.d.ts +31 -0
  244. package/dist/execution/design-color.d.ts.map +1 -0
  245. package/dist/execution/design-detect.d.ts +96 -0
  246. package/dist/execution/design-detect.d.ts.map +1 -0
  247. package/dist/execution/design-kit-loader.d.ts +53 -0
  248. package/dist/execution/design-kit-loader.d.ts.map +1 -0
  249. package/dist/execution/design-materialize.d.ts +32 -0
  250. package/dist/execution/design-materialize.d.ts.map +1 -0
  251. package/dist/execution/design-project-store.d.ts +57 -0
  252. package/dist/execution/design-project-store.d.ts.map +1 -0
  253. package/dist/execution/design-verify.d.ts +44 -0
  254. package/dist/execution/design-verify.d.ts.map +1 -0
  255. package/dist/execution/error-handler.d.ts +34 -0
  256. package/dist/execution/error-handler.d.ts.map +1 -0
  257. package/dist/{parallel-eternal-engine-HUrtePLd.d.ts → execution/eternal-autonomy.d.ts} +10 -225
  258. package/dist/execution/eternal-autonomy.d.ts.map +1 -0
  259. package/dist/execution/goal-preamble.d.ts +2 -0
  260. package/dist/execution/goal-preamble.d.ts.map +1 -0
  261. package/dist/execution/index.d.ts +21 -180
  262. package/dist/execution/index.d.ts.map +1 -0
  263. package/dist/execution/index.js +465 -180
  264. package/dist/execution/index.js.map +7 -1
  265. package/dist/execution/intelligent-compactor.d.ts +85 -0
  266. package/dist/execution/intelligent-compactor.d.ts.map +1 -0
  267. package/dist/execution/model-runtime.d.ts +75 -0
  268. package/dist/execution/model-runtime.d.ts.map +1 -0
  269. package/dist/execution/parallel-eternal-engine.d.ts +130 -0
  270. package/dist/execution/parallel-eternal-engine.d.ts.map +1 -0
  271. package/dist/execution/prompt-enhancer.d.ts +12 -13
  272. package/dist/execution/prompt-enhancer.d.ts.map +1 -0
  273. package/dist/execution/prompt-enhancer.js +13 -7
  274. package/dist/execution/prompt-enhancer.js.map +7 -1
  275. package/dist/execution/prompt-loader.d.ts +52 -0
  276. package/dist/execution/prompt-loader.d.ts.map +1 -0
  277. package/dist/execution/provider-runner-impl.d.ts +14 -0
  278. package/dist/execution/provider-runner-impl.d.ts.map +1 -0
  279. package/dist/execution/regex-patterns.d.ts +7 -0
  280. package/dist/execution/regex-patterns.d.ts.map +1 -0
  281. package/dist/execution/retry-policy.d.ts +35 -0
  282. package/dist/execution/retry-policy.d.ts.map +1 -0
  283. package/dist/execution/selective-compactor.d.ts +94 -0
  284. package/dist/execution/selective-compactor.d.ts.map +1 -0
  285. package/dist/execution/skill-loader.d.ts +43 -0
  286. package/dist/execution/skill-loader.d.ts.map +1 -0
  287. package/dist/execution/strategy-compactor.d.ts +43 -0
  288. package/dist/execution/strategy-compactor.d.ts.map +1 -0
  289. package/dist/execution/tool-executor.d.ts +112 -0
  290. package/dist/execution/tool-executor.d.ts.map +1 -0
  291. package/dist/extension/extension-points.d.ts +121 -0
  292. package/dist/extension/extension-points.d.ts.map +1 -0
  293. package/dist/extension/index.d.ts +3 -10
  294. package/dist/extension/index.d.ts.map +1 -0
  295. package/dist/extension/index.js +59 -5
  296. package/dist/extension/index.js.map +7 -1
  297. package/dist/extension/registry.d.ts +86 -0
  298. package/dist/extension/registry.d.ts.map +1 -0
  299. package/dist/fleet-notifier.d.ts +28 -0
  300. package/dist/fleet-notifier.d.ts.map +1 -0
  301. package/dist/hooks/http-executor.d.ts +11 -0
  302. package/dist/hooks/http-executor.d.ts.map +1 -0
  303. package/dist/hooks/index.d.ts +10 -0
  304. package/dist/hooks/index.d.ts.map +1 -0
  305. package/dist/hooks/registry.d.ts +71 -0
  306. package/dist/hooks/registry.d.ts.map +1 -0
  307. package/dist/hooks/runner.d.ts +65 -0
  308. package/dist/hooks/runner.d.ts.map +1 -0
  309. package/dist/hooks/shell-executor.d.ts +33 -0
  310. package/dist/hooks/shell-executor.d.ts.map +1 -0
  311. package/dist/hooks/shell-hooks-equal.d.ts +15 -0
  312. package/dist/hooks/shell-hooks-equal.d.ts.map +1 -0
  313. package/dist/hq/agent-bridge.d.ts +27 -0
  314. package/dist/hq/agent-bridge.d.ts.map +1 -0
  315. package/dist/hq/alerts.d.ts +67 -0
  316. package/dist/hq/alerts.d.ts.map +1 -0
  317. package/dist/hq/auth-store.d.ts +161 -0
  318. package/dist/hq/auth-store.d.ts.map +1 -0
  319. package/dist/hq/brain-bridge.d.ts +37 -0
  320. package/dist/hq/brain-bridge.d.ts.map +1 -0
  321. package/dist/hq/commands.d.ts +122 -0
  322. package/dist/hq/commands.d.ts.map +1 -0
  323. package/dist/hq/cost-bridge.d.ts +36 -0
  324. package/dist/hq/cost-bridge.d.ts.map +1 -0
  325. package/dist/hq/factory.d.ts +66 -0
  326. package/dist/hq/factory.d.ts.map +1 -0
  327. package/dist/hq/fleet-bridge.d.ts +39 -0
  328. package/dist/hq/fleet-bridge.d.ts.map +1 -0
  329. package/dist/hq/index.d.ts +18 -816
  330. package/dist/hq/index.d.ts.map +1 -0
  331. package/dist/hq/index.js +417 -122
  332. package/dist/hq/index.js.map +7 -1
  333. package/dist/hq/mailbox-mapper.d.ts +27 -0
  334. package/dist/hq/mailbox-mapper.d.ts.map +1 -0
  335. package/dist/hq/persistence.d.ts +121 -0
  336. package/dist/hq/persistence.d.ts.map +1 -0
  337. package/dist/hq/protocol.d.ts +560 -0
  338. package/dist/hq/protocol.d.ts.map +1 -0
  339. package/dist/hq/publisher.d.ts +177 -0
  340. package/dist/hq/publisher.d.ts.map +1 -0
  341. package/dist/hq/redaction.d.ts +30 -0
  342. package/dist/hq/redaction.d.ts.map +1 -0
  343. package/dist/hq/session-bridge.d.ts +29 -0
  344. package/dist/hq/session-bridge.d.ts.map +1 -0
  345. package/dist/hq/tool-bridge.d.ts +41 -0
  346. package/dist/hq/tool-bridge.d.ts.map +1 -0
  347. package/dist/hq/transcript-mapper.d.ts +36 -0
  348. package/dist/hq/transcript-mapper.d.ts.map +1 -0
  349. package/dist/hq/worktree-bridge.d.ts +34 -0
  350. package/dist/hq/worktree-bridge.d.ts.map +1 -0
  351. package/dist/index.d.ts +108 -2872
  352. package/dist/index.d.ts.map +1 -0
  353. package/dist/index.js +2724 -1344
  354. package/dist/index.js.map +7 -1
  355. package/dist/infrastructure/context-manager.d.ts +92 -0
  356. package/dist/infrastructure/context-manager.d.ts.map +1 -0
  357. package/dist/infrastructure/index.d.ts +6 -64
  358. package/dist/infrastructure/index.d.ts.map +1 -0
  359. package/dist/infrastructure/index.js +39 -12
  360. package/dist/infrastructure/index.js.map +7 -1
  361. package/dist/infrastructure/logger.d.ts +99 -0
  362. package/dist/infrastructure/logger.d.ts.map +1 -0
  363. package/dist/infrastructure/mcp-servers.d.ts +83 -0
  364. package/dist/infrastructure/mcp-servers.d.ts.map +1 -0
  365. package/dist/{path-resolver-CMS5307d.d.ts → infrastructure/path-resolver.d.ts} +3 -5
  366. package/dist/infrastructure/path-resolver.d.ts.map +1 -0
  367. package/dist/infrastructure/token-counter.d.ts +57 -0
  368. package/dist/infrastructure/token-counter.d.ts.map +1 -0
  369. package/dist/kernel/container.d.ts +84 -0
  370. package/dist/kernel/container.d.ts.map +1 -0
  371. package/dist/{events-Bgnh43r9.d.ts → kernel/events.d.ts} +112 -206
  372. package/dist/kernel/events.d.ts.map +1 -0
  373. package/dist/kernel/index.d.ts +6 -107
  374. package/dist/kernel/index.d.ts.map +1 -0
  375. package/dist/kernel/index.js +56 -4
  376. package/dist/kernel/index.js.map +7 -1
  377. package/dist/kernel/pipeline.d.ts +105 -0
  378. package/dist/kernel/pipeline.d.ts.map +1 -0
  379. package/dist/kernel/run-controller.d.ts +55 -0
  380. package/dist/kernel/run-controller.d.ts.map +1 -0
  381. package/dist/kernel/tokens.d.ts +53 -0
  382. package/dist/kernel/tokens.d.ts.map +1 -0
  383. package/dist/mailbox-attach.d.ts +27 -0
  384. package/dist/mailbox-attach.d.ts.map +1 -0
  385. package/dist/middleware/collab-pause.d.ts +73 -0
  386. package/dist/middleware/collab-pause.d.ts.map +1 -0
  387. package/dist/models/codex-catalog.d.ts +41 -0
  388. package/dist/models/codex-catalog.d.ts.map +1 -0
  389. package/dist/models/index.d.ts +8 -163
  390. package/dist/models/index.d.ts.map +1 -0
  391. package/dist/models/index.js +150 -51
  392. package/dist/models/index.js.map +7 -1
  393. package/dist/models/llm-selector.d.ts +47 -0
  394. package/dist/models/llm-selector.d.ts.map +1 -0
  395. package/dist/models/mode-store.d.ts +22 -0
  396. package/dist/models/mode-store.d.ts.map +1 -0
  397. package/dist/models/model-intelligence.d.ts +56 -0
  398. package/dist/models/model-intelligence.d.ts.map +1 -0
  399. package/dist/models/model-router.d.ts +100 -0
  400. package/dist/models/model-router.d.ts.map +1 -0
  401. package/dist/models/models-registry.d.ts +106 -0
  402. package/dist/models/models-registry.d.ts.map +1 -0
  403. package/dist/models/provider-model-resolve.d.ts +69 -0
  404. package/dist/models/provider-model-resolve.d.ts.map +1 -0
  405. package/dist/observability/event-bridge.d.ts +10 -0
  406. package/dist/observability/event-bridge.d.ts.map +1 -0
  407. package/dist/observability/health.d.ts +18 -0
  408. package/dist/observability/health.d.ts.map +1 -0
  409. package/dist/observability/index.d.ts +9 -354
  410. package/dist/observability/index.d.ts.map +1 -0
  411. package/dist/observability/index.js +21 -8
  412. package/dist/observability/index.js.map +7 -1
  413. package/dist/observability/metrics.d.ts +26 -0
  414. package/dist/observability/metrics.d.ts.map +1 -0
  415. package/dist/observability/otel-tracer.d.ts +41 -0
  416. package/dist/observability/otel-tracer.d.ts.map +1 -0
  417. package/dist/observability/otlp-metrics.d.ts +111 -0
  418. package/dist/observability/otlp-metrics.d.ts.map +1 -0
  419. package/dist/observability/otlp-traces.d.ts +95 -0
  420. package/dist/observability/otlp-traces.d.ts.map +1 -0
  421. package/dist/observability/prometheus.d.ts +49 -0
  422. package/dist/observability/prometheus.d.ts.map +1 -0
  423. package/dist/observability/tracer.d.ts +9 -0
  424. package/dist/observability/tracer.d.ts.map +1 -0
  425. package/dist/plugin/api.d.ts +226 -0
  426. package/dist/plugin/api.d.ts.map +1 -0
  427. package/dist/plugin/loader.d.ts +73 -0
  428. package/dist/plugin/loader.d.ts.map +1 -0
  429. package/dist/plugins/chimera-plugin.d.ts +37 -0
  430. package/dist/plugins/chimera-plugin.d.ts.map +1 -0
  431. package/dist/plugins/git-plugin.d.ts +15 -0
  432. package/dist/plugins/git-plugin.d.ts.map +1 -0
  433. package/dist/plugins/observability-plugin.d.ts +19 -0
  434. package/dist/plugins/observability-plugin.d.ts.map +1 -0
  435. package/dist/plugins/plan-plugin.d.ts +16 -0
  436. package/dist/plugins/plan-plugin.d.ts.map +1 -0
  437. package/dist/plugins/prompts-plugin.d.ts +26 -0
  438. package/dist/plugins/prompts-plugin.d.ts.map +1 -0
  439. package/dist/plugins/security-plugin.d.ts +19 -0
  440. package/dist/plugins/security-plugin.d.ts.map +1 -0
  441. package/dist/plugins/skills-plugin.d.ts +42 -0
  442. package/dist/plugins/skills-plugin.d.ts.map +1 -0
  443. package/dist/plugins/sync-plugin.d.ts +22 -0
  444. package/dist/plugins/sync-plugin.d.ts.map +1 -0
  445. package/dist/prompts/index.d.ts +3 -0
  446. package/dist/prompts/index.d.ts.map +1 -0
  447. package/dist/prompts/prompt-installer.d.ts +50 -0
  448. package/dist/prompts/prompt-installer.d.ts.map +1 -0
  449. package/dist/prompts/prompt-manifest-store.d.ts +18 -0
  450. package/dist/prompts/prompt-manifest-store.d.ts.map +1 -0
  451. package/dist/registry/provider-registry.d.ts +51 -0
  452. package/dist/registry/provider-registry.d.ts.map +1 -0
  453. package/dist/registry/slash-command-registry.d.ts +61 -0
  454. package/dist/registry/slash-command-registry.d.ts.map +1 -0
  455. package/dist/registry/tool-registry.d.ts +154 -0
  456. package/dist/registry/tool-registry.d.ts.map +1 -0
  457. package/dist/replay/hash.d.ts +31 -0
  458. package/dist/replay/hash.d.ts.map +1 -0
  459. package/dist/replay/replay-provider-runner.d.ts +53 -0
  460. package/dist/replay/replay-provider-runner.d.ts.map +1 -0
  461. package/dist/{index-CbyuOE5y.d.ts → security/capabilities.d.ts} +31 -34
  462. package/dist/security/capabilities.d.ts.map +1 -0
  463. package/dist/security/config-secrets.d.ts +25 -0
  464. package/dist/security/config-secrets.d.ts.map +1 -0
  465. package/dist/security/index.d.ts +6 -8
  466. package/dist/security/index.d.ts.map +1 -0
  467. package/dist/security/index.js +102 -381
  468. package/dist/security/index.js.map +7 -1
  469. package/dist/security/permission-policy.d.ts +153 -0
  470. package/dist/security/permission-policy.d.ts.map +1 -0
  471. package/dist/security/secret-scrubber.d.ts +14 -0
  472. package/dist/security/secret-scrubber.d.ts.map +1 -0
  473. package/dist/security/secret-vault.d.ts +87 -0
  474. package/dist/security/secret-vault.d.ts.map +1 -0
  475. package/dist/security/yolo-risk.d.ts +11 -0
  476. package/dist/security/yolo-risk.d.ts.map +1 -0
  477. package/dist/{session-registry-Dvg7i_IA.d.ts → session-registry.d.ts} +8 -9
  478. package/dist/session-registry.d.ts.map +1 -0
  479. package/dist/skills/foreign-sources.d.ts +59 -0
  480. package/dist/skills/foreign-sources.d.ts.map +1 -0
  481. package/dist/skills/frontmatter.d.ts +44 -0
  482. package/dist/skills/frontmatter.d.ts.map +1 -0
  483. package/dist/skills/github-fetcher.d.ts +38 -0
  484. package/dist/skills/github-fetcher.d.ts.map +1 -0
  485. package/dist/skills/index.d.ts +11 -582
  486. package/dist/skills/index.d.ts.map +1 -0
  487. package/dist/skills/index.js +81 -43
  488. package/dist/skills/index.js.map +7 -1
  489. package/dist/skills/limits.d.ts +92 -0
  490. package/dist/skills/limits.d.ts.map +1 -0
  491. package/dist/skills/manifest-store.d.ts +42 -0
  492. package/dist/skills/manifest-store.d.ts.map +1 -0
  493. package/dist/skills/registry/github-direct-adapter.d.ts +17 -0
  494. package/dist/skills/registry/github-direct-adapter.d.ts.map +1 -0
  495. package/dist/skills/registry/registry-adapter.d.ts +84 -0
  496. package/dist/skills/registry/registry-adapter.d.ts.map +1 -0
  497. package/dist/skills/registry/skills-sh-adapter.d.ts +13 -0
  498. package/dist/skills/registry/skills-sh-adapter.d.ts.map +1 -0
  499. package/dist/skills/skill-generator.d.ts +82 -0
  500. package/dist/skills/skill-generator.d.ts.map +1 -0
  501. package/dist/skills/skill-installer.d.ts +124 -0
  502. package/dist/skills/skill-installer.d.ts.map +1 -0
  503. package/dist/storage/annotations-store.d.ts +118 -0
  504. package/dist/storage/annotations-store.d.ts.map +1 -0
  505. package/dist/storage/attachment-store.d.ts +31 -0
  506. package/dist/storage/attachment-store.d.ts.map +1 -0
  507. package/dist/storage/cloud-sync.d.ts +44 -0
  508. package/dist/storage/cloud-sync.d.ts.map +1 -0
  509. package/dist/storage/completed-work-checkpoint.d.ts +11 -0
  510. package/dist/storage/completed-work-checkpoint.d.ts.map +1 -0
  511. package/dist/storage/config-loader.d.ts +104 -0
  512. package/dist/storage/config-loader.d.ts.map +1 -0
  513. package/dist/storage/config-migration.d.ts +87 -0
  514. package/dist/storage/config-migration.d.ts.map +1 -0
  515. package/dist/storage/config-store.d.ts +22 -0
  516. package/dist/storage/config-store.d.ts.map +1 -0
  517. package/dist/{director-state-CMS_bMs4.d.ts → storage/director-state.d.ts} +28 -8
  518. package/dist/storage/director-state.d.ts.map +1 -0
  519. package/dist/storage/file-session-writer.d.ts +169 -0
  520. package/dist/storage/file-session-writer.d.ts.map +1 -0
  521. package/dist/{goal-store-Datpp-ar.d.ts → storage/goal-store.d.ts} +26 -19
  522. package/dist/storage/goal-store.d.ts.map +1 -0
  523. package/dist/storage/index.d.ts +39 -1031
  524. package/dist/storage/index.d.ts.map +1 -0
  525. package/dist/storage/index.js +655 -300
  526. package/dist/storage/index.js.map +7 -1
  527. package/dist/storage/input-history-store.d.ts +56 -0
  528. package/dist/storage/input-history-store.d.ts.map +1 -0
  529. package/dist/storage/memory-backend.d.ts +66 -0
  530. package/dist/storage/memory-backend.d.ts.map +1 -0
  531. package/dist/storage/memory-consolidator.d.ts +50 -0
  532. package/dist/storage/memory-consolidator.d.ts.map +1 -0
  533. package/dist/storage/memory-graph-backend.d.ts +117 -0
  534. package/dist/storage/memory-graph-backend.d.ts.map +1 -0
  535. package/dist/storage/memory-store.d.ts +119 -0
  536. package/dist/storage/memory-store.d.ts.map +1 -0
  537. package/dist/storage/plan-store.d.ts +78 -0
  538. package/dist/storage/plan-store.d.ts.map +1 -0
  539. package/dist/storage/plan-templates.d.ts +21 -0
  540. package/dist/storage/plan-templates.d.ts.map +1 -0
  541. package/dist/storage/prompt-store.d.ts +37 -0
  542. package/dist/storage/prompt-store.d.ts.map +1 -0
  543. package/dist/storage/prompt-usage-store.d.ts +29 -0
  544. package/dist/storage/prompt-usage-store.d.ts.map +1 -0
  545. package/dist/storage/provider-config-watcher.d.ts +34 -0
  546. package/dist/storage/provider-config-watcher.d.ts.map +1 -0
  547. package/dist/storage/queue-store.d.ts +37 -0
  548. package/dist/storage/queue-store.d.ts.map +1 -0
  549. package/dist/storage/recovery-lock.d.ts +79 -0
  550. package/dist/storage/recovery-lock.d.ts.map +1 -0
  551. package/dist/storage/replay-log-store.d.ts +97 -0
  552. package/dist/storage/replay-log-store.d.ts.map +1 -0
  553. package/dist/storage/session-analyzer.d.ts +48 -0
  554. package/dist/storage/session-analyzer.d.ts.map +1 -0
  555. package/dist/storage/session-checkpoint-cas.d.ts +37 -0
  556. package/dist/storage/session-checkpoint-cas.d.ts.map +1 -0
  557. package/dist/{session-event-bridge-D_z_mBwk.d.ts → storage/session-event-bridge.d.ts} +14 -15
  558. package/dist/storage/session-event-bridge.d.ts.map +1 -0
  559. package/dist/storage/session-helpers.d.ts +9 -0
  560. package/dist/storage/session-helpers.d.ts.map +1 -0
  561. package/dist/storage/session-id.d.ts +18 -0
  562. package/dist/storage/session-id.d.ts.map +1 -0
  563. package/dist/storage/session-reader.d.ts +21 -0
  564. package/dist/storage/session-reader.d.ts.map +1 -0
  565. package/dist/storage/session-recovery.d.ts +93 -0
  566. package/dist/storage/session-recovery.d.ts.map +1 -0
  567. package/dist/storage/session-resume-validation.d.ts +6 -0
  568. package/dist/storage/session-resume-validation.d.ts.map +1 -0
  569. package/dist/storage/session-rewinder.d.ts +21 -0
  570. package/dist/storage/session-rewinder.d.ts.map +1 -0
  571. package/dist/storage/session-store.d.ts +210 -0
  572. package/dist/storage/session-store.d.ts.map +1 -0
  573. package/dist/storage/session-summary.d.ts +12 -0
  574. package/dist/storage/session-summary.d.ts.map +1 -0
  575. package/dist/storage/session-tool-call-ends.d.ts +5 -0
  576. package/dist/storage/session-tool-call-ends.d.ts.map +1 -0
  577. package/dist/storage/storage-concurrency.d.ts +2 -0
  578. package/dist/storage/storage-concurrency.d.ts.map +1 -0
  579. package/dist/storage/task-store.d.ts +33 -0
  580. package/dist/storage/task-store.d.ts.map +1 -0
  581. package/dist/storage/todos-checkpoint.d.ts +39 -0
  582. package/dist/storage/todos-checkpoint.d.ts.map +1 -0
  583. package/dist/storage/tool-audit-log.d.ts +141 -0
  584. package/dist/storage/tool-audit-log.d.ts.map +1 -0
  585. package/dist/tasking/index.d.ts +3 -124
  586. package/dist/tasking/index.d.ts.map +1 -0
  587. package/dist/tasking/index.js +57 -4
  588. package/dist/tasking/index.js.map +7 -1
  589. package/dist/tasking/task-store.d.ts +22 -0
  590. package/dist/tasking/task-store.d.ts.map +1 -0
  591. package/dist/tasking/task-tracker.d.ts +102 -0
  592. package/dist/tasking/task-tracker.d.ts.map +1 -0
  593. package/dist/tools/index.d.ts +2 -59
  594. package/dist/tools/index.d.ts.map +1 -0
  595. package/dist/tools/index.js +93 -14
  596. package/dist/tools/index.js.map +7 -1
  597. package/dist/tools/mcp-control.d.ts +53 -0
  598. package/dist/tools/mcp-control.d.ts.map +1 -0
  599. package/dist/tools/mcp-use.d.ts +24 -0
  600. package/dist/tools/mcp-use.d.ts.map +1 -0
  601. package/dist/types/agent-bridge.d.ts +42 -0
  602. package/dist/types/agent-bridge.d.ts.map +1 -0
  603. package/dist/types/attachment.d.ts +54 -0
  604. package/dist/types/attachment.d.ts.map +1 -0
  605. package/dist/types/autonomy.d.ts +5 -0
  606. package/dist/types/autonomy.d.ts.map +1 -0
  607. package/dist/types/blocks.d.ts +76 -0
  608. package/dist/types/blocks.d.ts.map +1 -0
  609. package/dist/{compactor-DQLL4HTo.d.ts → types/compactor.d.ts} +5 -7
  610. package/dist/types/compactor.d.ts.map +1 -0
  611. package/dist/{config-MRqn1V-u.d.ts → types/config.d.ts} +135 -354
  612. package/dist/types/config.d.ts.map +1 -0
  613. package/dist/types/context-evidence.d.ts +68 -0
  614. package/dist/types/context-evidence.d.ts.map +1 -0
  615. package/dist/types/context-window.d.ts +35 -0
  616. package/dist/types/context-window.d.ts.map +1 -0
  617. package/dist/{default-config-B79_gJYv.d.ts → types/default-config.d.ts} +10 -11
  618. package/dist/types/default-config.d.ts.map +1 -0
  619. package/dist/types/design-kit.d.ts +91 -0
  620. package/dist/types/design-kit.d.ts.map +1 -0
  621. package/dist/{retry-policy-CQ7KwXJa.d.ts → types/error-handler.d.ts} +5 -12
  622. package/dist/types/error-handler.d.ts.map +1 -0
  623. package/dist/types/errors.d.ts +277 -0
  624. package/dist/types/errors.d.ts.map +1 -0
  625. package/dist/types/hooks.d.ts +167 -0
  626. package/dist/types/hooks.d.ts.map +1 -0
  627. package/dist/types/index.d.ts +40 -244
  628. package/dist/types/index.d.ts.map +1 -0
  629. package/dist/types/index.js +90 -12
  630. package/dist/types/index.js.map +7 -1
  631. package/dist/{input-reader-E-ffP2ee.d.ts → types/input-reader.d.ts} +3 -4
  632. package/dist/types/input-reader.d.ts.map +1 -0
  633. package/dist/{logger-B63L5bTg.d.ts → types/logger.d.ts} +3 -4
  634. package/dist/types/logger.d.ts.map +1 -0
  635. package/dist/types/memory.d.ts +89 -0
  636. package/dist/types/memory.d.ts.map +1 -0
  637. package/dist/types/messages.d.ts +24 -0
  638. package/dist/types/messages.d.ts.map +1 -0
  639. package/dist/types/mode-prompts.d.ts +2 -0
  640. package/dist/types/mode-prompts.d.ts.map +1 -0
  641. package/dist/{mode-CZlO9iU1.d.ts → types/mode.d.ts} +6 -7
  642. package/dist/types/mode.d.ts.map +1 -0
  643. package/dist/types/models-registry.d.ts +105 -0
  644. package/dist/types/models-registry.d.ts.map +1 -0
  645. package/dist/types/multi-agent.d.ts +435 -0
  646. package/dist/types/multi-agent.d.ts.map +1 -0
  647. package/dist/{observability-D-HZN_mF.d.ts → types/observability.d.ts} +12 -13
  648. package/dist/types/observability.d.ts.map +1 -0
  649. package/dist/{path-resolver-CPRj4bFY.d.ts → types/path-resolver.d.ts} +2 -3
  650. package/dist/types/path-resolver.d.ts.map +1 -0
  651. package/dist/{permission-ByDKXEcG.d.ts → types/permission.d.ts} +8 -9
  652. package/dist/types/permission.d.ts.map +1 -0
  653. package/dist/types/plugin.d.ts +385 -0
  654. package/dist/types/plugin.d.ts.map +1 -0
  655. package/dist/types/prompt-registry.d.ts +81 -0
  656. package/dist/types/prompt-registry.d.ts.map +1 -0
  657. package/dist/{prompt-DLd35n4Q.d.ts → types/prompt.d.ts} +14 -15
  658. package/dist/types/prompt.d.ts.map +1 -0
  659. package/dist/{provider-runner-ChL-kVg6.d.ts → types/provider-runner.d.ts} +9 -10
  660. package/dist/types/provider-runner.d.ts.map +1 -0
  661. package/dist/types/provider.d.ts +387 -0
  662. package/dist/types/provider.d.ts.map +1 -0
  663. package/dist/types/renderer.d.ts +23 -0
  664. package/dist/types/renderer.d.ts.map +1 -0
  665. package/dist/types/retry-policy.d.ts +7 -0
  666. package/dist/types/retry-policy.d.ts.map +1 -0
  667. package/dist/types/secret-scrubber.d.ts +5 -0
  668. package/dist/types/secret-scrubber.d.ts.map +1 -0
  669. package/dist/{secret-vault-BAKpgFw_.d.ts → types/secret-vault.d.ts} +13 -7
  670. package/dist/types/secret-vault.d.ts.map +1 -0
  671. package/dist/{selector-D8O6B_Rm.d.ts → types/selector.d.ts} +4 -6
  672. package/dist/types/selector.d.ts.map +1 -0
  673. package/dist/types/session-reader.d.ts +81 -0
  674. package/dist/types/session-reader.d.ts.map +1 -0
  675. package/dist/{session-rewinder-C9HnMkhP.d.ts → types/session-rewinder.d.ts} +5 -6
  676. package/dist/types/session-rewinder.d.ts.map +1 -0
  677. package/dist/types/session.d.ts +650 -0
  678. package/dist/types/session.d.ts.map +1 -0
  679. package/dist/types/side-effect.d.ts +34 -0
  680. package/dist/types/side-effect.d.ts.map +1 -0
  681. package/dist/{skill-DHniprNl.d.ts → types/skill.d.ts} +4 -5
  682. package/dist/types/skill.d.ts.map +1 -0
  683. package/dist/types/slash-command.d.ts +59 -0
  684. package/dist/types/slash-command.d.ts.map +1 -0
  685. package/dist/types/spec.d.ts +77 -0
  686. package/dist/types/spec.d.ts.map +1 -0
  687. package/dist/types/system-prompt-contributor.d.ts +20 -0
  688. package/dist/types/system-prompt-contributor.d.ts.map +1 -0
  689. package/dist/types/system-prompt.d.ts +51 -0
  690. package/dist/types/system-prompt.d.ts.map +1 -0
  691. package/dist/{task-graph-CH3acNQ7.d.ts → types/task-graph.d.ts} +21 -22
  692. package/dist/types/task-graph.d.ts.map +1 -0
  693. package/dist/types/token-counter.d.ts +42 -0
  694. package/dist/types/token-counter.d.ts.map +1 -0
  695. package/dist/types/tool-executor.d.ts +133 -0
  696. package/dist/types/tool-executor.d.ts.map +1 -0
  697. package/dist/types/tool-markers.d.ts +23 -0
  698. package/dist/types/tool-markers.d.ts.map +1 -0
  699. package/dist/types/tool.d.ts +245 -0
  700. package/dist/types/tool.d.ts.map +1 -0
  701. package/dist/types/utility-types.d.ts +31 -0
  702. package/dist/types/utility-types.d.ts.map +1 -0
  703. package/dist/utils/assert-never.d.ts +14 -0
  704. package/dist/utils/assert-never.d.ts.map +1 -0
  705. package/dist/utils/atomic-write.d.ts +12 -0
  706. package/dist/utils/atomic-write.d.ts.map +1 -0
  707. package/dist/utils/child-env.d.ts +67 -0
  708. package/dist/utils/child-env.d.ts.map +1 -0
  709. package/dist/utils/color.d.ts +20 -0
  710. package/dist/utils/color.d.ts.map +1 -0
  711. package/dist/utils/config-json.d.ts +14 -0
  712. package/dist/utils/config-json.d.ts.map +1 -0
  713. package/dist/utils/context-evidence.d.ts +47 -0
  714. package/dist/utils/context-evidence.d.ts.map +1 -0
  715. package/dist/utils/deep-merge.d.ts +64 -0
  716. package/dist/utils/deep-merge.d.ts.map +1 -0
  717. package/dist/utils/diff.d.ts +11 -0
  718. package/dist/utils/diff.d.ts.map +1 -0
  719. package/dist/utils/error.d.ts +2 -3
  720. package/dist/utils/error.d.ts.map +1 -0
  721. package/dist/utils/error.js +3 -3
  722. package/dist/utils/error.js.map +7 -1
  723. package/dist/utils/expect-defined.d.ts +2 -3
  724. package/dist/utils/expect-defined.d.ts.map +1 -0
  725. package/dist/utils/expect-defined.js +3 -3
  726. package/dist/utils/expect-defined.js.map +7 -1
  727. package/dist/utils/glob-expand.d.ts +10 -0
  728. package/dist/utils/glob-expand.d.ts.map +1 -0
  729. package/dist/utils/glob-match.d.ts +4 -0
  730. package/dist/utils/glob-match.d.ts.map +1 -0
  731. package/dist/utils/index.d.ts +37 -920
  732. package/dist/utils/index.d.ts.map +1 -0
  733. package/dist/utils/index.js +242 -33
  734. package/dist/utils/index.js.map +7 -1
  735. package/dist/utils/instruction-file.d.ts +3 -0
  736. package/dist/utils/instruction-file.d.ts.map +1 -0
  737. package/dist/utils/ip-guard.d.ts +34 -0
  738. package/dist/utils/ip-guard.d.ts.map +1 -0
  739. package/dist/utils/json-repair.d.ts +23 -0
  740. package/dist/utils/json-repair.d.ts.map +1 -0
  741. package/dist/utils/json-schema-validate.d.ts +42 -0
  742. package/dist/utils/json-schema-validate.d.ts.map +1 -0
  743. package/dist/utils/lru-cache.d.ts +29 -0
  744. package/dist/utils/lru-cache.d.ts.map +1 -0
  745. package/dist/utils/merge-custom-models.d.ts +12 -0
  746. package/dist/utils/merge-custom-models.d.ts.map +1 -0
  747. package/dist/utils/merge-models-payload.d.ts +20 -0
  748. package/dist/utils/merge-models-payload.d.ts.map +1 -0
  749. package/dist/utils/message-invariants.d.ts +22 -0
  750. package/dist/utils/message-invariants.d.ts.map +1 -0
  751. package/dist/utils/newline-normalize.d.ts +5 -0
  752. package/dist/utils/newline-normalize.d.ts.map +1 -0
  753. package/dist/utils/regex-guard.d.ts +21 -0
  754. package/dist/utils/regex-guard.d.ts.map +1 -0
  755. package/dist/utils/safe-json.d.ts +31 -0
  756. package/dist/utils/safe-json.d.ts.map +1 -0
  757. package/dist/utils/session-scoped-path.d.ts +13 -0
  758. package/dist/utils/session-scoped-path.d.ts.map +1 -0
  759. package/dist/utils/sleep.d.ts +5 -0
  760. package/dist/utils/sleep.d.ts.map +1 -0
  761. package/dist/utils/slug.d.ts +13 -0
  762. package/dist/utils/slug.d.ts.map +1 -0
  763. package/dist/utils/string.d.ts +9 -0
  764. package/dist/utils/string.d.ts.map +1 -0
  765. package/dist/utils/task-format.d.ts +22 -0
  766. package/dist/utils/task-format.d.ts.map +1 -0
  767. package/dist/utils/term.d.ts +133 -0
  768. package/dist/utils/term.d.ts.map +1 -0
  769. package/dist/utils/todos-format.d.ts +30 -0
  770. package/dist/utils/todos-format.d.ts.map +1 -0
  771. package/dist/utils/token-estimate.d.ts +112 -0
  772. package/dist/utils/token-estimate.d.ts.map +1 -0
  773. package/dist/utils/tool-description-mode.d.ts +28 -0
  774. package/dist/utils/tool-description-mode.d.ts.map +1 -0
  775. package/dist/utils/tool-output-serializer.d.ts +40 -0
  776. package/dist/utils/tool-output-serializer.d.ts.map +1 -0
  777. package/dist/utils/tool-result-render-mode.d.ts +55 -0
  778. package/dist/utils/tool-result-render-mode.d.ts.map +1 -0
  779. package/dist/utils/tool-subject.d.ts +5 -0
  780. package/dist/utils/tool-subject.d.ts.map +1 -0
  781. package/dist/utils/tool-wire-compact.d.ts +28 -0
  782. package/dist/utils/tool-wire-compact.d.ts.map +1 -0
  783. package/dist/utils/ulid.d.ts +11 -0
  784. package/dist/utils/ulid.d.ts.map +1 -0
  785. package/dist/{wstack-paths-C3K40Qst.d.ts → utils/wstack-paths.d.ts} +7 -8
  786. package/dist/utils/wstack-paths.d.ts.map +1 -0
  787. package/dist/worktree/index.d.ts +2 -0
  788. package/dist/worktree/index.d.ts.map +1 -0
  789. package/dist/{worktree-manager-DzwxKE35.d.ts → worktree/worktree-manager.d.ts} +19 -13
  790. package/dist/worktree/worktree-manager.d.ts.map +1 -0
  791. package/instructions/autonomy/active-mission.md +2 -4
  792. package/instructions/sections/tool/delegation-full.md +1 -1
  793. package/package.json +4 -5
  794. package/skills/node-modern/SKILL.md +2 -2
  795. package/skills/plugin-author/SKILL.md +9 -16
  796. package/dist/dispatcher-types.d-BBeXBQgS.d.ts +0 -66
  797. package/dist/global-mailbox-sZwyI6CS.d.ts +0 -959
  798. package/dist/index--Gm41aBJ.d.ts +0 -671
  799. package/dist/mcp-servers-DEV4s6Ks.d.ts +0 -259
  800. package/dist/multi-agent-coordinator-4RCRZKjN.d.ts +0 -1770
  801. package/dist/null-fleet-bus-CFoNVQEK.d.ts +0 -2127
  802. package/dist/pipeline-DGDyIohT.d.ts +0 -331
  803. package/dist/provider-model-resolve-o2hHLs79.d.ts +0 -263
  804. package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
  805. package/dist/secret-vault-DxohkUBc.d.ts +0 -272
  806. package/dist/session-reader-7Esxrkpw.d.ts +0 -155
  807. package/dist/task-format-GX0B1mMC.d.ts +0 -23
  808. package/dist/todos-checkpoint-FY7PjmMx.d.ts +0 -850
  809. package/dist/tool-BNlnIJvo.d.ts +0 -2190
  810. package/dist/tool-executor-CckSCM5E.d.ts +0 -906
package/dist/index.d.ts CHANGED
@@ -1,2873 +1,109 @@
1
- import { d as TaskGraph, T as TaskType, a as TaskPriority, e as TaskNode } from './task-graph-CH3acNQ7.js';
2
- export { C as CriticalPathResult, S as SerializableTaskGraph, f as SerializableTaskGraphNodes, g as SerializedTaskGraph, h as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, c as TaskProgress, l as TaskSort, b as TaskStatus, m as computeTaskProgress, n as deserializeTaskGraph, o as findCriticalPath, s as serializeTaskGraph, t as topologicalSort } from './task-graph-CH3acNQ7.js';
3
- import { W as WorktreeManager } from './worktree-manager-DzwxKE35.js';
4
- export { A as AllocateOpts, M as MergeOpts, a as MergeResult, b as WorktreeHandle, c as WorktreeManagerOptions, R as WorktreeRunResult, d as WorktreeStatus, e as assertSafePath } from './worktree-manager-DzwxKE35.js';
5
- import { E as EventBus, B as BrainArbiter, c as MemoryStore, a as EventName, L as Listener } from './events-Bgnh43r9.js';
6
- export { e as BrainDecision, f as BrainDecisionOption, g as BrainDecisionQueue, h as BrainDecisionRequest, i as BrainDecisionSource, j as BrainFallback, k as BrainRisk, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, m as EventLogger, n as EventMap, H as HumanEscalatingBrainArbiter, o as MEMORY_TYPE_LABELS, p as MemoryClearedPayload, q as MemoryConsolidatedPayload, b as MemoryEntry, r as MemoryForgottenPayload, s as MemoryPriority, d as MemoryRelevanceContext, t as MemoryRememberedPayload, M as MemoryScope, u as MemoryType, O as ObservableBrainArbiter, v as ScopedEventBus, S as ScoredEntry, w as formatHumanPrompt } from './events-Bgnh43r9.js';
7
- import { TaskStore } from './tasking/index.js';
8
- export { DefaultTaskStore, TaskTracker, TaskTrackerChange, TaskTrackerListener, TaskTrackerOptions, TaskTransition } from './tasking/index.js';
9
- import { D as DefaultLogger } from './mcp-servers-DEV4s6Ks.js';
10
- export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as DefaultLoggerOptions, L as LogFormat, e as allServers, f as awsServer, g as blockServer, h as braveSearchServer, i as context7Server, j as contextManagerTool, k as createContextManagerTool, l as everArtServer, m as filesystemServer, n as githubServer, o as googleMapsServer, p as miniMaxVisionServer, q as playwrightServer, s as sentinelServer, r as slackServer, t as sshManagerServer, z as zaiVisionServer } from './mcp-servers-DEV4s6Ks.js';
11
- import { D as DefaultPathResolver } from './path-resolver-CMS5307d.js';
12
- import { D as DefaultSecretVault } from './secret-vault-DxohkUBc.js';
13
- export { A as AutoApprovePermissionPolicy, a as DefaultPermissionPolicy, b as DefaultSecretScrubber, P as PermissionPolicyOptions, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from './secret-vault-DxohkUBc.js';
14
- import { j as Config, q as TokenSavingTier, r as HookInput, s as HookOutcome, H as HookEvent, C as ConfiguredHook, M as ModelsRegistry, f as HookMatcher, I as InProcessHook, g as HookRegistrationOptions, n as ConfigStore } from './config-MRqn1V-u.js';
15
- export { A as AdaptiveConcurrencyConfig, t as AnyHookOutcome, u as AutonomyConfig, v as CONTEXT_WINDOW_MODES, w as CircuitBreakerRuntimeConfig, l as ConfigLoader, x as ContextConfig, o as ContextWindowAggressiveOn, y as ContextWindowConfigLike, z as ContextWindowMode, B as ContextWindowModeId, p as ContextWindowPolicy, D as ContextWindowThresholds, E as CustomModelDefinition, G as DEFAULT_CONTEXT_WINDOW_MODE_ID, J as DEFAULT_TUI_THINKING_WORD, K as ExecDangerConfig, L as ExecToolConfig, N as FeaturesConfig, F as FleetConfig, O as FleetSupervisorConfig, i as HookEntry, Q as HookFailurePolicy, U as HookInvocationContext, V as HqClientConfig, h as HttpHook, X as IndexingConfig, Y as InputHistoryConfig, Z as LaunchConfig, _ as LogConfig, $ as LoopDetectionConfig, a0 as MAX_TUI_THINKING_WORD_LENGTH, b as MCPServerConfig, a as ModelMatrixEntry, a1 as ModelRuntimeCacheConfig, k as ModelRuntimeConfig, a2 as ModelRuntimeParametersConfig, a3 as ModelRuntimeReasoningConfig, e as ModelsDevModel, c as ModelsDevPayload, a4 as ModelsDevProvider, a5 as PluginConfig, a6 as PreToolUseOutcome, a7 as PreToolUseStage, a8 as ProviderApiKey, P as ProviderConfig, R as ResolvedModel, d as ResolvedProvider, a9 as SessionLoggingConfig, S as ShellHook, aa as SkillsConfig, ab as SyncCategory, m as SyncConfig, ac as ToolDescriptionMode, ad as ToolDescriptionModeConfig, T as ToolResultRenderMode, ae as ToolResultRenderModeConfig, af as ToolsConfig, W as WireFamily, ag as formatContextWindowModeList, ah as getContextWindowMode, ai as isContextWindowModeId, aj as listContextWindowModes, ak as normalizeTokenSavingTier, al as normalizeTuiThinkingWord, am as resolveContextWindowPolicy } from './config-MRqn1V-u.js';
16
- import { W as WstackPaths } from './wstack-paths-C3K40Qst.js';
17
- export { a as WstackPathOptions, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from './wstack-paths-C3K40Qst.js';
18
- import { n as SlashCommand, P as PluginAPI, o as PluginPipelines, p as ToolRegistryView, q as ProviderRegistryView, r as MCPRegistryView, s as SlashCommandRegistryView, t as SessionWriterView, u as MetricsSinkView, v as PluginLLM, w as PluginCapabilities, x as PluginDependency, y as Plugin } from './multi-agent-coordinator-4RCRZKjN.js';
19
- export { z as AGENT_TOOL_PRESETS, A as Agent, E as AgentBudgetTier, G as AgentCapability, h as AgentDefinition, a as AgentFactory, H as AgentFactoryResult, g as AgentPhase, I as AgentRunnerOptions, m as AwaitAnyResult, J as BudgetExceededError, K as BudgetKind, L as BudgetLimits, N as BudgetNegotiationMode, O as BudgetThresholdDecision, Q as BudgetThresholdHandler, R as BudgetThresholdSignal, U as BudgetUsage, V as CoordinatorEvents, C as CoordinatorStatus, W as DECISION_TIMEOUT_MS, X as DEFAULT_DISPATCH_ROLE, b as DefaultMultiAgentCoordinator, Y as DispatchCandidate, D as DispatchClassifier, Z as DispatchMethod, _ as DispatchOptions, $ as DispatchResult, c as DoneCondition, F as FleetBus, a0 as FleetEvent, a1 as FleetHandler, j as FleetUsage, k as FleetUsageAggregator, a2 as HEAVY_BUDGET, a3 as LIGHT_BUDGET, a4 as MEDIUM_BUDGET, M as MultiAgentConfig, a5 as MultiAgentCoordinator, a6 as MultiAgentCoordinatorOptions, a7 as PluginLLMOptions, a8 as PluginLLMResult, a9 as SpawnResult, aa as SubagentBudget, i as SubagentConfig, ab as SubagentContext, ac as SubagentError, ad as SubagentErrorKind, ae as SubagentPartialResult, af as SubagentRunContext, ag as SubagentRunOutcome, S as SubagentRunner, ah as SubagentSpawnLineage, ai as SubagentStructuredReport, aj as SubagentUsageSnapshot, ak as TIMEOUT_PREEMPT_FRACTION, al as TaskDelegation, l as TaskResult, T as TaskSpec, am as dispatchAgent, an as makeAgentSubagentRunner, ao as makeLLMClassifier, ap as scoreAgents, aq as withDisabledToolFiltering } from './multi-agent-coordinator-4RCRZKjN.js';
20
- export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as FleetTokenCapError, M as FleetWorktreePolicy, N as ICoordinator, O as IFleetManager, P as InMemoryAgentBridge, Q as InMemoryBridgeTransport, R as LargeAnswerStore, S as NULL_FLEET_BUS, T as REFACTOR_PLANNER_AGENT, U as RefactorPhase, V as RefactorPlan, W as SECURITY_SCANNER_AGENT, X as SharedFileEntry, Y as SharedFileSnapshot, Z as SubagentPromptParts, _ as TaskResultNotification, $ as WorktreeIntegrationError, a0 as WorktreeIsolationDecision, a1 as WorktreeTaskRunnerOptions, a2 as WorktreeTaskStateUpdate, a3 as applyRosterBudget, a4 as attachAutoExtend, a5 as composeDirectorPrompt, a6 as composeSubagentPrompt, a7 as createDelegateTool, a8 as createMessage, a9 as getAgentDefinition, aa as makeAskResultTool, ab as makeAskTool, ac as makeAssignTool, ad as makeAwaitTasksTool, ae as makeCollabDebugTool, af as makeDirectorSessionFactory, ag as makeFleetEmitTool, ah as makeFleetHealthTool, ah as makeFleetSessionTool, ah as makeFleetTool, ah as makeFleetUsageTool, ai as makeKanbanQueueTool, aj as makeQualityGateTool, ak as makeRollUpTool, al as makeSpawnTool, am as makeTerminateAllTool, an as makeTerminateTool, ao as makeWorkCompleteTool, ap as resolveSubagentWorktreeDecision, aq as rosterSummaryFromConfigs, ar as subagentNeedsWorktree, as as wrapSubagentRunnerWithWorktrees } from './null-fleet-bus-CFoNVQEK.js';
21
- export { AcquireOptions, AcquireResult, AdaptiveConcurrencyController, AdaptiveConcurrencyState, AgentMonitorOptions, AgentMonitorService, AgentTimelineEntry, AgentVirtualSession, ApplyResult, ApprovalDecision, AutonomousBrain, AutonomousBrainOptions, AutonomousCoordinator, AutonomousCoordinatorOptions, AutonomousDecisionRequest, AutonomousDecisionType, BUILD_AGENTS, BrainInterventionInput, BrainMonitor, BrainMonitorOptions, ChangeFile, ChangeManager, ChangeManagerOptions, ChangeNode, ChangeProposal, ChangeStatus, ConsensusOptions, ConsensusProtocol, ConsensusResult, CoordinatorEvent, CoordinatorStats, DAGEdgeEvent, DAGEdgeHandler, DAGNode, DAGNodeStatus, DEFAULT_MAX_FLEET_SPAWNS, DEFAULT_QUALITY_CHECKS, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, DecisionNode, DecisionPrompt, DefaultMailbox, DepWatchEntry, DepWatcherBridgeOptions, DependencyWatcherConfig, DownAlertInput, EscalationDecision, FactCategory, FactNode, FleetStatusToolOptions, FleetSupervisor, FleetSupervisorActions, FleetSupervisorOptions, FleetSupervisorSource, GoalNode, GoalPriority, GoalStatus, GraphSubscription, HARD_MAX_SPAWN_DEPTH, KNOWLEDGE_AGENTS, KnowledgeGraph, LLMProvider, LiveLockResult, MAILBOX_BRIDGE_LOCK_FILENAME, MAILBOX_BRIDGE_TOKEN_FILENAME, MAILBOX_HEALTH_DEFAULT_FAILURE_THRESHOLD, MAILBOX_HEALTH_DEFAULT_FROM, MAILBOX_HEALTH_DEFAULT_INTERVAL_MS, MAILBOX_HEALTH_DEFAULT_TIMEOUT_MS, MATRIX_PHASE_KEYS, MAX_SUBAGENT_STRUCTURED_REPORT_CHARS, META_AGENTS, MailToolsOptions, MailboxActionInput, MailboxActionResult, MailboxBridgeLock, MailboxHealthEvent, MailboxHealthWatchdog, MailboxHealthWatchdogOptions, MailboxHooksOptions, MailboxMessageAction, MailboxResolver, MailboxToolOptions, MatrixKeyKind, ModelMatrixResolution, ModelMatrixResolutionSource, ModelReference, NodeFilter, NodeType, OutdatedNotifyMessage, PLANNING_AGENTS, PackageAuthorEntry, PackageAuthorLog, PackageAuthorTrackerOptions, PackageOutdatedEntry, PackageOutdatedResult, PackageOutdatedWatcherOptions, PrioritizationDecision, QualityCheck, QualityGateChecks, QualityGateResult, QuorumRule, REVIEW_AGENTS, RecoveryAlertInput, ResolvedModelTarget, ResolvedSubagentModelTarget, RollbackResult, RunnablesHandler, SUBAGENT_STRUCTURED_REPORT_META_KEY, SpawnDecision, SupervisedSubagent, SupervisorLogEntry, TaskAuctionOptions, TaskAuctioneer, TaskBid, TaskDAG, VERIFY_AGENTS, VoteNode, VoteRecord, VoteValue, VoterConfig, WatchdogConfig, acquireOrJoin, actionToAckInput, attachDepWatcherBridge, buildDownAlert, buildRecoveryAlert, createAgentMonitorService, createMailboxHooks, detectEcosystem, detectEcosystem as detectPackageEcosystem, finalize, formatSubagentStructuredReport, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, isValidMatrixKey, mailboxSessionTag, makeDependencyWatcherConfig, makeFleetStatusTool, makeMailInboxTool, makeMailSendTool, makeMailboxTool, makeSubagentResultTool, matrixKeyKind, normalizeSubagentStructuredReport, phaseForRole, readLiveLock, readSubagentStructuredReport, recordPackageAction, release, resolveImplementationModelTarget, resolveMailboxIdentity, resolveMaxSpawnDepth, resolveModelMatrix, resolveModelMatrixResolution, resolveModelTargetFromEntry, resolveSubagentModelTarget, roleNeedsIndependentReviewModel, sameModelReference, startPackageOutdatedWatcher, updatePackageOutdatedStatus, validateWatchdogOptions } from './coordination/index.js';
22
- export { D as DEFAULT_HQ_REDACTION_POLICY, G as GlobalMailbox, H as HQ_PROTOCOL_VERSION, a as HqAgentMessagePayload, b as HqAgentStatusPayload, c as HqAlertMessage, d as HqBrainEventKind, e as HqBrainEventPayload, f as HqBrowserEventMessage, g as HqBrowserMessage, h as HqBrowserSnapshotMessage, i as HqClientCapability, j as HqClientCommandAckMessage, k as HqClientCommandPollMessage, l as HqClientEventMessage, m as HqClientHeartbeatPayload, n as HqClientHelloMessage, o as HqClientHelloPayload, p as HqClientIdentity, q as HqClientKind, r as HqClientMessage, s as HqClientRecord, t as HqEventEnvelope, u as HqEventPayloadResult, v as HqEventType, w as HqFleetEventPayload, x as HqFleetSnapshotPayload, y as HqFleetSummary, z as HqGitSnapshotPayload, A as HqMachineRecord, B as HqMailboxAgentStatus, C as HqMailboxAgentSummary, E as HqMailboxEventAction, F as HqMailboxEventPayload, I as HqMailboxMappingOptions, J as HqMailboxMessageSummary, K as HqMailboxMessageType, L as HqMailboxPriority, M as HqMailboxSnapshotOptions, N as HqMailboxSnapshotPayload, O as HqMailboxSummary, P as HqParseResult, Q as HqPathPolicy, R as HqProjectIdentity, S as HqProjectRecord, T as HqProjectStatus, U as HqProtocolVersion, V as HqPublishEventOptions, W as HqPublisher, X as HqPublisherCommandHandler, Y as HqPublisherCommandResult, Z as HqPublisherOptions, _ as HqQueuedCommand, $ as HqRedactionPolicy, a0 as HqServerCommandBatchMessage, a1 as HqServerMessage, a2 as HqSessionAgentLiveStatus, a3 as HqSessionAgentSummary, a4 as HqSessionEndedPayload, a5 as HqSessionLiveStatus, a6 as HqSessionSnapshotPayload, a7 as HqSessionStartedPayload, a8 as HqSessionStatus, a9 as HqSessionStatusPayload, aa as HqSessionSummary, ab as HqSnapshot, ac as HqSocketFactory, ad as HqSocketLike, ae as HqSubagentSummary, af as HqToolArgsPolicy, ag as HqToolCompletedPayload, ah as HqToolStartedPayload, ai as HqTranscriptAppendPayload, aj as HqTranscriptEntry, ak as HqTranscriptRole, al as HqUsagePayload, am as HqWelcomePayload, an as HqWorklistCounts, ao as HqWorklistSnapshotPayload, ap as HqWorkspaceKind, aq as HqWorktreeEventKind, ar as HqWorktreeEventPayload, as as createHqEventEnvelope, at as createMailboxEventPayload, au as createMailboxSnapshotPayload, av as createMailboxSnapshotPayloadFromMailbox, aw as mapMailboxAgentToHqSummary, ax as mapMailboxMessageToHqSummary, ay as parseHqEventPayload, az as parseHqFrame, aA as resolveProjectDir } from './global-mailbox-sZwyI6CS.js';
23
- export { A as AgentEntry, a as AgentLiveStatus, S as SessionLiveStatus, b as SessionRegistry, c as SessionRegistryEntry, g as getSessionRegistry, h as hasSessionRegistry } from './session-registry-Dvg7i_IA.js';
24
- import { b as Mailbox, M as MailboxMessage } from './mailbox-types-BGZWrYTJ.js';
25
- export { g as AgentHeartbeatInput, A as AgentRegistrationInput, h as ClientHeartbeatInput, C as ClientRegistrationInput, k as ClientSource, i as ClientStatus, f as MailboxAckBatchInput, e as MailboxAckInput, a as MailboxAgentStatus, l as MailboxMessageType, d as MailboxQuery, c as MailboxSendInput, m as MailboxTaskContext, P as PurgeOptions, j as PurgeResult, R as ReadReceipts, n as RegisteredAgent, o as normalizeRecipient } from './mailbox-types-BGZWrYTJ.js';
26
- import { d as Context, A as TodoItem, g as Tool, P as Provider, i as ContentBlock, c as Request, e as Response, s as TextBlock, M as Message, J as JSONSchema } from './tool-BNlnIJvo.js';
27
- export { E as AgentError, C as CacheStats, q as CacheTtl, r as Capabilities, G as CompletedWorkEvidence, H as CompletedWorkSource, I as ConfigError, K as ContextEvidenceState, L as ContextFileEvidence, N as ContextInit, O as ContextIntentEvidence, Q as ContextRepeatedReadEvidence, u as ConversationState, V as ERROR_CODES, X as ErrorCode, Y as ErrorSeverity, Z as ErrorSubsystem, _ as FetchError, $ as FileSnapshot, F as ForkedSession, a0 as FsError, a1 as ImageBlock, a2 as JsonSchemaSpec, a3 as MessageRole, a4 as ParseError, f as Permission, a5 as PluginError, h as ProviderError, a6 as ProviderErrorBody, a7 as ProviderErrorKind, a8 as ReadonlyConversationState, a as ReasoningConfig, p as ReasoningEffort, R as ReasoningRequest, a9 as RequestCacheControl, aa as ResponseFormat, ab as ResumeFileStatus, ac as ResumeFileValidationEntry, ad as ResumeValidation, x as ResumedSession, n as RiskTier, ae as RunEnv, t as RunOptions, af as SafetySetting, ag as SddError, y as SessionData, ah as SessionError, S as SessionEvent, v as SessionForkOptions, j as SessionMetadata, k as SessionStore, z as SessionSummary, b as SessionWriter, ai as SideEffect, aj as SideEffectRisk, ak as StateChange, al as StateChangeHandler, am as StopReason, an as StreamEvent, ao as StreamHangError, ap as ThinkingBlock, T as TokenCounter, aq as ToolCallContext, ar as ToolError, l as ToolErrorCategory, as as ToolErrorInfo, at as ToolEvidenceStatus, au as ToolFinalEvent, av as ToolIconId, o as ToolOutputMetadata, m as ToolProgressEvent, D as ToolResultBlock, aw as ToolStreamEvent, B as ToolUseBlock, ax as ToolValidationError, U as Usage, W as WorkspaceCheckpointRef, w as WorkspaceMaterializationResult, ay as WrongStackError, az as classifyProviderError, aA as effectiveInputTokens, aB as extractRunEnv, aC as isAgentError, aD as isConfigError, aE as isFetchError, aF as isFsError, aG as isImageBlock, aH as isParseError, aI as isPluginError, aJ as isRetryableKind, aK as isSddError, aL as isSessionError, aM as isTextBlock, aN as isToolError, aO as isToolResultBlock, aP as isToolUseBlock, aQ as isToolValidationError, aR as isWrongStackError, aS as toWrongStackError, aT as wrapAsState } from './tool-BNlnIJvo.js';
28
- import { j as AgentExtension, S as SystemPromptContributor, b as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, R as ResolvedLoopDetectionConfig, c as ToolExecutorLike, E as ExtensionRegistry, T as ToolCallPipelinePayload } from './index--Gm41aBJ.js';
29
- export { k as AfterIterationHook, l as AfterRunHook, m as AfterToolExecutionHook, d as AgentInit, e as AgentInput, B as BeforeIterationHook, n as BeforeRunHook, o as BeforeToolExecutionHook, D as DEFAULT_MAX_ITERATIONS, H as HookRunEnv, p as HookRunner, q as HookRunnerOptions, O as OnErrorHook, r as PreToolUseResult, s as PromptResult, t as ProviderFactory, u as ProviderRunnerWrapper, f as RunResult, a as ToolWrapper, U as UserInputPayload, v as createDefaultPipelines } from './index--Gm41aBJ.js';
30
- import { L as Logger } from './logger-B63L5bTg.js';
31
- export { a as LogLevel } from './logger-B63L5bTg.js';
32
- import { A as AttachmentStore, b as AttachmentRef, a as AddAttachmentInput } from './session-reader-7Esxrkpw.js';
33
- export { c as Attachment, d as AttachmentKind, e as AttachmentMeta, D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from './session-reader-7Esxrkpw.js';
34
- import { T as Tracer, M as MetricsSink, H as HealthRegistry } from './observability-D-HZN_mF.js';
35
- export { A as AggregateHealth, a as HealthCheck, b as HealthCheckResult, c as HealthStatus, d as MetricLabels, e as MetricSeries, f as MetricsSnapshot, S as Span } from './observability-D-HZN_mF.js';
36
- import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-CQ7KwXJa.js';
37
- import { M as ModeStore } from './mode-CZlO9iU1.js';
38
- export { D as DEFAULT_MODES, b as Mode, a as ModeConfig, c as ModeManifest } from './mode-CZlO9iU1.js';
39
- import { S as SkillLoader } from './skill-DHniprNl.js';
40
- export { b as SkillEntry, a as SkillManifest } from './skill-DHniprNl.js';
41
- import { S as SystemPromptBuilder, c as ModelCapabilities, B as BuildContext, d as SystemPromptRegions, C as Container, a as Renderer, b as Middleware, H as HookRegistry } from './pipeline-DGDyIohT.js';
42
- export { e as BindOptions, D as Decorator, F as Factory, M as MiddlewareHandler, N as NextFn, P as Pipeline, f as PipelineOptions, T as Token, g as flattenSystemPromptRegions, h as hookMatcherMatches } from './pipeline-DGDyIohT.js';
43
- export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorOptions, d as CompactorStrategy, D as DefaultDesignKitLoader, e as DefaultErrorHandler, f as DefaultPromptLoader, g as DefaultRetryPolicy, h as DefaultSkillLoader, i as DesignKitLoaderOptions, j as DesignOverrides, k as DoneCheckResult, l as DoneConditionChecker, H as HybridCompactor, I as IntelligentCompactor, m as IntelligentCompactorOptions, P as PersistedActiveKit, n as PromptLoaderOptions, S as SelectiveCompactor, o as SelectiveCompactorOptions, p as SkillLoaderOptions, q as StrategyCompactorOptions, T as ToolExecutor, _ as _resetDesignKitLoaderMemo, r as _resetDesignRulesCache, s as activateDesign, t as applyTokenOverrides, u as buildGoalPreamble, v as clearActiveKit, w as clearPersistedActiveKit, x as createStrategyCompactor, y as designProjectDir, z as detectFrontendFile, B as detectFrontendIntent, E as getDesignKitLoader, F as getDesignState, G as installDesignStudioMiddleware, J as loadActiveKit, K as loadProjectDesignRules, L as makeAutonomyPromptContributor, M as makeDesignDetectToolCallMiddleware, N as makeDesignDetectUserInputMiddleware, O as makeDesignStudioRequestMiddleware, Q as makeDesignVerifyToolCallMiddleware, R as recordKitChoice, U as recordOverrides, V as renderPrompt, W as resolveBundledDesignKitsDir, X as setActiveKit, Y as setDesignOverrides } from './tool-executor-CckSCM5E.js';
44
- export { DefaultProviderRunner, DesignVerifyReport, DesignViolation, MaterializeResult, colorToHex, isColorToken, materializeTokens, oklchToHex, parseOklch, runDesignVerify, verifyFiles } from './defaults/index.js';
45
- export { f as DESIGN_STACKS, d as DesignKitEntry, b as DesignKitLoader, c as DesignKitManifest, e as DesignKitTokens, D as DesignStack, a as DesignStudioState, g as DesignTokenSet, E as EternalAutonomyEngine, h as EternalAutonomyOptions, i as EternalEngineState, I as IterationStage, P as ParallelEngineState, j as ParallelEternalEngine, k as ParallelEternalOptions, l as ParallelIterationStage, m as isDesignStack } from './parallel-eternal-engine-HUrtePLd.js';
46
- export { C as CODEX_MODELS, a as CodexModelMeta, D as DefaultModeStore, b as DefaultModelsRegistry, c as DefaultModelsRegistryOptions, L as LLMSelector, d as LLMSelectorOptions, M as ModeLoaderOptions, P as ProviderModelDescriptor, e as classifyFamily, f as codexModelMeta, g as describeCatalogModel, l as loadProjectModes, h as loadUserModes, r as resolveProviderModelList } from './provider-model-resolve-o2hHLs79.js';
47
- export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from './observability/index.js';
48
- export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, F as FileMemoryBackend, j as FileMemoryBackendOptions, M as MemoryBackend, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, I as mutatePlan, J as parseEntries, K as removePlanItem, L as runConfigMigrations, N as savePlan, O as saveTodosCheckpoint, U as setPlanItemStatus } from './todos-checkpoint-FY7PjmMx.js';
49
- export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from './director-state-CMS_bMs4.js';
50
- export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, a as STANDARD_AUDIT_EVENTS, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from './session-event-bridge-D_z_mBwk.js';
51
- export { AutonomyBrainOptions, BrainAutoRisk, ModelRuntimeMiddlewareOptions, ResolvedModelRuntime, TieredBrainArbiterOptions, applyModelRuntime, createAutonomyBrain, createTieredBrainArbiter, formatDecisionSummary, mergeModelRuntime, resolveCacheForRequest, resolveModelRuntime, resolveReasoningForRequest } from './execution/index.js';
52
- import { estimateMessageTokens } from './utils/index.js';
53
- export { AtomicWriteOptions, BuildChildEnvOptions, COMPLETED_WORK_LEDGER_MARKER, CoercionResult, CompactToolDefinitionForWireOptions, CompactWireToolDefinition, CompileFail, CompileResult, DEFAULT_TOOL_DESCRIPTION_MODE, DEFAULT_TOOL_RESULT_RENDER_MODE, DeepMergeOptions, FORBIDDEN_PROTO_KEYS, FileLockOptions, JsonObject, JsonPath, JsonPathSegment, MessageRepairReport, MessageRepairResult, NewlineStyle, OutputLineGuard, RecordCompletedWorkInput, RecordToolOutputEvidenceInput, RequestTokenBreakdown, SafeParseResult, ToolDescriptionRegistryLike, ToolOutputSerializerOptions, ToolResultRenderModeRegistryLike, ToolWireDefinitionLike, UnifiedDiffOptions, ValidationError, ValidationResult, applyToolDescriptionModeToTool, applyToolDescriptionModes, applyToolResultRenderModes, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildCompletedWorkLedgerBlock, buildContextEvidenceDigest, coerceAgainstSchema, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, escapeGlobSubject, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, formatCompletedWorkLedger, formatTodosList, getCalibrationState, getJsonPath, getTermSize, getToolDescriptionMode, getToolResultRenderMode, hasOpenTodos, isInteractive, isJsonObject, isPathSubjectKey, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, isUlid, jsonObjectFileExists, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizePathSubject, normalizeToLf, normalizeToolDescriptionMode, normalizeToolResultRenderMode, onResize, readJsonObjectFile, recordActualUsage, recordCompletedWorkEvidence, recordToolOutputEvidence, recordUserIntentEvidence, removeJsonPath, removeJsonPathInFile, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, resolveToolDescriptionMode, resolveToolResultRenderMode, safeParse, safeStringify, sanitizeJsonString, sanitizeNodeOptions, sessionScopedPath, setJsonPath, setJsonPathInFile, setOutputLineGuard, setRawMode, setToolDescriptionMode, setToolResultRenderMode, simplifyToolDescription, sleep, slugify, stripAnsi, stripCodeFences, subjectForToolInput, syncCompletedWorkLedgerBlock, toStyle, truncate, ulid, unifiedDiff, updateJsonObjectFile, validateAgainstSchema, withFileLock, writeErr, writeJsonObjectFile, writeOut } from './utils/index.js';
54
- export { ConversationTurn, ENHANCER_SYSTEM_PROMPT, EnhanceResult, EnhanceUserPromptOptions, enhanceUserPrompt, gatedEnhancerReasoning, normalizedEqual, recentTextTurns, shouldEnhance } from './execution/prompt-enhancer.js';
55
- export { AgentMonitorEventBridgeOptions, BrainTelemetryBridgeOptions, CostTelemetryBridgeOptions, CreateGlobalMailboxOptions, CreateHqPublisherOptions, EnsureHqFirstRunAuthResult, FleetTelemetryBridgeOptions, HQ_AUTH_FILE_VERSION, HQ_COMMAND_TYPES, HqAbortCommand, HqAgentEventPublisher, HqAlert, HqAlertEngine, HqAlertRuleConfig, HqAlertSeverity, HqAuthFile, HqBroadcastCommand, HqBrowserToken, HqBtwCommand, HqCommand, HqCommandAuditEntry, HqCommandAuditLog, HqCommandType, HqEventLog, HqEventLogOptions, HqPersistence, HqPublisherEnvConfig, HqQueueCommand, HqRedactOptions, HqRedactionResult, HqRunCommandCommand, HqRuntimeFile, HqSnapshotStore, HqSnapshotStoreOptions, HqSpawnCommand, HqSteerCommand, HqTimeseriesSample, HqTimeseriesStore, HqTimeseriesStoreOptions, HqToken, SessionTelemetryBridgeOptions, ToolTelemetryBridgeOptions, WorktreeTelemetryBridgeOptions, buildTranscriptFromEvents, createGlobalMailbox, createHqPersistence, createHqPublisherFromEnv, defaultHqDataDir, discoverLocalHqEndpoint, emptyHqAuthFile, ensureHqFirstRunAuthFile, hqAuthFilePath, hqRuntimeFilePath, mapSessionEventToEntries, mergeToolResults, mintHqBrowserToken, mintHqToken, mutateHqAuthFile, readHqAuthFile, readHqRuntimeFileSync, redactHqEvent, redactHqValue, resolveHqConfig, resolveHqConfigFromEnv, resolveHqDataDir, scrubAndTruncateHqPreview, startAgentMonitorEventBridge, startBrainTelemetryBridge, startCostTelemetryBridge, startFleetTelemetryBridge, startSessionTelemetryBridge, startToolTelemetryBridge, startWorktreeTelemetryBridge, summarizeHqToolArgs, toAlertMessage, tokenHasCapability, validateHqCommand, watchHqAuthFile, writeHqAuthFile, writeHqRuntimeFile } from './hq/index.js';
56
- export { RunController, RunControllerOptions, TOKENS } from './kernel/index.js';
57
- import { P as PermissionPolicy } from './permission-ByDKXEcG.js';
58
- export { a as PermissionDecision, T as TrustPolicy } from './permission-ByDKXEcG.js';
59
- export { H as HttpDispatcher, a as HttpsAgentAsDispatcher } from './dispatcher-types.d-BBeXBQgS.js';
60
- import { DefaultPromptStore, PromptUsageStore, ReplayLogStore } from './storage/index.js';
61
- export { ALL_SYNC_CATEGORIES, AgentStatusTracker, AgentStatusTrackerOptions, Annotation, AnnotationsStore, AnnotationsStoreOptions, AuditEntry, CheckpointGitResult, CloudSync, CompletedWorkCheckpointFile, ConsolidationOp, DefaultSessionRewinder, FleetNotifier, FleetNotifierOptions, GraphMemoryBackend, GraphMemoryBackendOptions, INPUT_HISTORY_DEFAULT_MAX, InputHistoryStore, MemoryConsolidatorOptions, PromptStore, PromptUsage, ProviderConfigSnapshot, RecoveryPlan, ReplayEntry, ReplayLogStoreOptions, SessionCheckpointCas, SessionCheckpointCasOptions, SessionMemoryConsolidator, SessionRecovery, SessionRewinderOptions, StaleSession, SyncResult, TaskFile, ToolAuditLog, ToolAuditLogOptions, VerifyResult, WatchProviderConfigOptions, emptyTaskFile, generateSessionId, loadCompletedWorkCheckpoint, loadTasks, migratePromptEntry, mutateTasks, promptChecksum, sanitizeModel, saveCompletedWorkCheckpoint, saveTasks, watchProviderConfig } from './storage/index.js';
62
- import { P as PromptLoader } from './prompt-DLd35n4Q.js';
63
- export { B as BUILTIN_PROMPT_CATEGORIES, d as BuiltinPromptCategory, e as PROMPT_CATEGORY_LABELS, f as PromptCategory, c as PromptCategoryCount, a as PromptEntry, g as PromptManifest, h as PromptManifestRef, b as PromptSearchOptions, i as PromptSource, j as PromptVariable, k as isBuiltinCategory } from './prompt-DLd35n4Q.js';
64
- import { SkillRegistryAdapter } from './skills/index.js';
65
- export { DEFAULT_SKILLS_SH_URL, DownloadResult, ExtractedSkillDraft, FOREIGN_SKILL_TOOLS, ForeignSkillTool, InstallResult, InstalledSkillEntry, ManifestData, ParsedRef, ParsedSkillFrontmatter, RegistrySearchOptions, RegistrySearchResult, RegistrySkillSummary, ResolvedForeignTools, SKILL_LIMITS, SkillInstaller, SkillInstallerOptions, SkillManifestStore, SkillNameValidation, SkillSecurityTier, SkillSkeletonOptions, UpdateResult, bodyLineAdvisory, createSkillsShAdapter, downloadGitHubTarball, extractSkillFromPrompt, generateSkillSkeleton, githubDirectAdapter, isValidSkillNameFormat, openInEditor, parseSkillFrontmatter, parseSkillRef, resolveForeignToolIds, resolveForeignToolIdsWithWarnings, securityScoreToTier, stripFrontmatter, validateSkillName, validateSkillNameAvailable, writeSkeletonSkill } from './skills/index.js';
66
- import { PromptRegistryManifest, RegistryDiff, PromptManifestData, InstalledPromptEntry } from './types/index.js';
67
- export { AutonomyStage, DEFAULT_SPEC_TEMPLATE, DistributiveOmit, MALFORMED_ARG_MARKERS, ManifestValidation, PromptRegistryRef, SpecAnalysis, SpecApiEndpoint, SpecRequirement, SpecSection, SpecSectionType, SpecStatus, SpecTemplate, SpecValidationResult, Specification, diffRegistry, validateRegistryManifest } from './types/index.js';
68
- import { P as ProviderRunner, R as RunProviderOptions$1 } from './provider-runner-ChL-kVg6.js';
69
- export { D as DANGEROUS_FOR_SUBAGENTS, T as ToolCapabilities, a as ToolCapability, W as WIDE_SUBAGENT_CAPABILITIES, g as getDangerousCapabilities, h as hasCapability, b as hasDangerousCapabilityForSubagents } from './index-CbyuOE5y.js';
70
- export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as MAX_PROGRESS_HISTORY, P as ProgressSnapshot, b as appendJournal, e as emptyGoal, f as formatGoal, g as goalFilePath, l as loadGoal, p as parseProgressFromText, r as recordProgress, s as saveGoal, c as setProgress, d as summarizeUsage } from './goal-store-Datpp-ar.js';
71
- import { MCPRegistryHandle } from './tools/index.js';
72
- export { createMcpControlTool } from './tools/index.js';
73
- export { a as CompactReport, C as Compactor } from './compactor-DQLL4HTo.js';
74
- export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CIRCUIT_BREAKER_CONFIG, b as DEFAULT_CONTEXT_CONFIG, c as DEFAULT_SESSION_LOGGING_CONFIG, d as DEFAULT_SESSION_PRUNE_DAYS, e as DEFAULT_TOOLS_CONFIG } from './default-config-B79_gJYv.js';
75
- export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from './session-rewinder-C9HnMkhP.js';
76
- export { I as InputReader, P as PromptOption } from './input-reader-E-ffP2ee.js';
77
- export { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
78
- export { R as RotatableSecretVault, S as SecretVault, e as encryptedPrefixForVersion, n as noOpVault, p as parseEncryptedVersion } from './secret-vault-BAKpgFw_.js';
1
+ export { type AutoPhaseOptions, AutoPhasePlanner, type AutoPhasePlannerOptions, type AutoPhasePlanResult, AutoPhaseRunner, type AutoPhaseRunnerOptions, type Checkpoint, CheckpointManager, type CheckpointManagerOptions, createAutoPhaseFromTaskGraph, PHASE_EVENT_NAMES, type PhaseEventMap, type PhaseEventName, type PhaseExecutionContext, type PhaseFilter, type PhaseGraph, PhaseGraphBuilder, type PhaseGraphBuilderOptions, type PhaseNode, PhaseOrchestrator, type PhaseOrchestratorOptions, type PhaseProgress, type PhaseSort, type PhaseStatus, PhaseStore, type PhaseStoreOptions, type PhaseTemplate, } from './autophase/index.js';
2
+ export { type BootConfigOptions, type BootConfigResult, bootConfig, flagsToConfigPatch, } from './boot.js';
3
+ export { allServers } from './infrastructure/mcp-servers.js';
4
+ export { type AgentFactory, type AgentFactoryResult, type AgentRunnerOptions, makeAgentSubagentRunner, } from './coordination/agent-subagent-runner.js';
5
+ export { AGENT_CATALOG, AGENTS_BY_PHASE, type AgentDefinition, type AgentPhase, ALL_AGENT_DEFINITIONS, getAgentDefinition, } from './coordination/agents/index.js';
6
+ export { type BrainArbiter, type BrainDecision, type BrainDecisionOption, BrainDecisionQueue, type BrainDecisionRequest, type BrainDecisionSource, type BrainFallback, type BrainRisk, DefaultBrainArbiter, type DefaultBrainArbiterOptions, formatHumanPrompt, HumanEscalatingBrainArbiter, ObservableBrainArbiter, } from './coordination/brain.js';
7
+ export { type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, } from './coordination/brain-monitor.js';
8
+ export { type CollabBusState, CollaborationBus, type ConsumedInjectionInfo, } from './coordination/collab-bus.js';
9
+ export { assessCommitSafety, type CommitSafetyOptions, type CommitSafetyReport, type ForeignFile, } from './coordination/commit-safety.js';
10
+ export { DEPENDENCY_FILE_PATTERNS, type DependencyWatcherConfig, type DepWatchEntry, makeDependencyWatcherConfig, } from './coordination/dep-watcher.js';
11
+ export { attachDepWatcherBridge, type DepWatcherBridgeOptions, } from './coordination/dep-watcher-bridge.js';
12
+ export { Director, FleetCostCapError, FleetSpawnBudgetError, FleetTokenCapError, type TaskResultNotification, } from './coordination/director.js';
13
+ export { DEFAULT_MAX_FLEET_SPAWNS, HARD_MAX_SPAWN_DEPTH, resolveMaxSpawnDepth, } from './coordination/spawn-budget.js';
14
+ export { type DirectorSessionFactory, type DirectorSessionFactoryOptions, makeDirectorSessionFactory, } from './coordination/director-session.js';
15
+ export { makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeFleetEmitTool, makeFleetTool, makeKanbanQueueTool, makeQualityGateTool, makeRollUpTool, makeSpawnTool, makeTerminateTool, } from './coordination/director-tools.js';
16
+ export { formatSubagentStructuredReport, MAX_SUBAGENT_STRUCTURED_REPORT_CHARS, makeSubagentResultTool, normalizeSubagentStructuredReport, readSubagentStructuredReport, SUBAGENT_STRUCTURED_REPORT_META_KEY, } from './coordination/subagent-result-tool.js';
17
+ export { DEFAULT_DISPATCH_ROLE, type DispatchCandidate, type DispatchClassifier, type DispatchMethod, type DispatchOptions, type DispatchResult, dispatchAgent, makeLLMClassifier, scoreAgents, } from './coordination/dispatcher.js';
18
+ export { compactLog, type FileAuthorEntry, type FileAuthorLog, type FileAuthorTrackerOptions, getFileHistory, getFilesByAgent, getFullLog, getLastAuthor, recordFileAction, } from './coordination/file-author-tracker.js';
19
+ export { ACP_AGENTS, ALL_FLEET_AGENTS, applyRosterBudget, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, type FleetRosterBudget, } from './coordination/fleet.js';
20
+ export { FleetBus, type FleetEvent, type FleetHandler, type FleetUsage, FleetUsageAggregator, type SubagentUsageSnapshot, } from './coordination/fleet-bus.js';
21
+ export { FleetManager, type FleetManagerOptions, } from './coordination/fleet-manager.js';
22
+ export { type FleetStatusToolOptions, makeFleetStatusTool, } from './coordination/fleet-status-tool.js';
23
+ export { FleetSupervisor, type FleetSupervisorActions, type FleetSupervisorOptions, type FleetSupervisorSource, type SupervisedSubagent, type SupervisorLogEntry, } from './coordination/fleet-supervisor.js';
24
+ export { GlobalMailbox, resolveProjectDir } from './coordination/global-mailbox.js';
25
+ export { SessionRegistry, getSessionRegistry, hasSessionRegistry, type SessionRegistryEntry, type SessionLiveStatus, } from './session-registry.js';
26
+ export * from './coordination/index.js';
27
+ export { type MailToolsOptions, makeMailInboxTool, makeMailSendTool, } from './coordination/mail-tools.js';
28
+ export { DefaultMailbox } from './coordination/mailbox.js';
29
+ export { type MailboxResolver, type MailboxToolOptions, mailboxSessionTag, makeMailboxTool, resolveMailboxIdentity, } from './coordination/mailbox-tool.js';
30
+ export type { AgentHeartbeatInput, AgentRegistrationInput, Mailbox, MailboxAckInput, MailboxAgentStatus, MailboxMessage, MailboxMessageType, MailboxQuery, MailboxSendInput, MailboxTaskContext, ReadReceipts, RegisteredAgent, } from './coordination/mailbox-types.js';
31
+ export { normalizeRecipient } from './coordination/mailbox-types.js';
32
+ export { isValidMatrixKey, MATRIX_PHASE_KEYS, type MatrixKeyKind, type ModelMatrixResolution, type ModelMatrixResolutionSource, type ModelReference, matrixKeyKind, phaseForRole, type ResolvedModelTarget, type ResolvedSubagentModelTarget, resolveImplementationModelTarget, resolveModelMatrix, resolveModelMatrixResolution, resolveModelTargetFromEntry, resolveSubagentModelTarget, roleNeedsIndependentReviewModel, sameModelReference, } from './coordination/model-matrix.js';
33
+ export { NULL_FLEET_BUS } from './coordination/null-fleet-bus.js';
34
+ export { detectEcosystem as detectPackageEcosystem, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, type PackageAuthorEntry, type PackageAuthorLog, type PackageAuthorTrackerOptions, recordPackageAction, updatePackageOutdatedStatus, } from './coordination/package-author-tracker.js';
35
+ export { type OutdatedNotifyMessage, type PackageOutdatedEntry, type PackageOutdatedResult, type PackageOutdatedWatcherOptions, startPackageOutdatedWatcher, } from './coordination/package-outdated-watcher.js';
36
+ export { assignNickname, type NicknameAssignment, nicknameKeyFromDisplay, } from './coordination/subagent-nicknames.js';
37
+ export { startTechStackConsumer, type TechStackConsumerOptions, } from './coordination/techstack-mailbox-consumer.js';
38
+ export { type FleetWorktreePolicy, resolveSubagentWorktreeDecision, subagentNeedsWorktree, WorktreeIntegrationError, type WorktreeIsolationDecision, type WorktreeTaskRunnerOptions, type WorktreeTaskStateUpdate, wrapSubagentRunnerWithWorktrees, } from './coordination/worktree-task-runner.js';
39
+ export { Agent, type AgentInit, type AgentInput, type AgentPipelines, createDefaultPipelines, DEFAULT_MAX_ITERATIONS, type RunResult, type ToolCallPipelinePayload, type UserInputPayload, } from './core/agent.js';
40
+ export { buildBtwBlock, consumeBtwNotes, pendingBtwCount, setBtwNote, } from './core/btw.js';
41
+ export { Context, type ContextInit, type RunOptions, type TodoItem } from './core/context.js';
42
+ export { type ContinuationInput, type ContinuationSource, detectContinueIntent, type ResolvedContinuation, resolveContinuation, } from './core/continue-intent.js';
43
+ export { type ContinueDirective, makeContinueToNextIterationTool, parseContinueDirective, } from './core/continue-to-next-iteration.js';
44
+ export { ConversationState, type ReadonlyConversationState, type StateChange, type StateChangeHandler, wrapAsState, } from './core/conversation-state.js';
45
+ export { createFallbackModelExtension, effectiveFallbackChain, type FallbackModelDeps, fallbackProfileChain, formatModelRef, normalizeModelRef, parseModelRef, smartDefaultFallbackChain, } from './core/fallback-model.js';
46
+ export { InputBuilder, type InputBuilderEvent, type InputBuilderOptions, } from './core/input-builder.js';
47
+ export { type InstructionBundle, type InstructionBundlePaths, loadInstructionBundle, mergeInstructionBundle, type SystemInstructionBundle, } from './core/instruction-bundle.js';
48
+ export { buildMailboxBlock, buildMailboxBtwAwarenessBlock, createMailboxChecker, injectPendingMailboxMessages, type MailboxLoopOptions, } from './core/mailbox-loop.js';
49
+ export { runProviderWithRetry } from './core/provider-runner.js';
50
+ export { buildQueuedMessagesBlock, consumeQueuedMessagesUpdate, peekQueuedMessages, setQueuedMessagesSnapshot, } from './core/queued-messages.js';
51
+ export { extractRunEnv, type RunEnv } from './core/run-env.js';
52
+ export { DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, LAYER_1_IDENTITY, } from './core/system-prompt-builder.js';
53
+ export * from './defaults/index.js';
54
+ export { AutoCompactionMiddleware, type CompactorOptions, type CompactorStrategy, createStrategyCompactor, HybridCompactor, IntelligentCompactor, type IntelligentCompactorOptions, SelectiveCompactor, type SelectiveCompactorOptions, type StrategyCompactorOptions, } from './defaults/index.js';
55
+ export { type AutonomyBrainOptions, type BrainAutoRisk, createAutonomyBrain, createTieredBrainArbiter, formatDecisionSummary, type TieredBrainArbiterOptions, } from './execution/autonomy-brain.js';
56
+ export { buildLosslessDigest, buildSmartDigest, type ContentScore, type EliseResult, eliseOldToolResults, estimateMessages, extractText, findPreserveStart, hasTextContent, scoreMessage, } from './execution/compaction-core.js';
57
+ export { applyModelRuntime, type ModelRuntimeMiddlewareOptions, mergeModelRuntime, type ResolvedModelRuntime, resolveCacheForRequest, resolveModelRuntime, resolveReasoningForRequest, } from './execution/model-runtime.js';
58
+ export { type ConversationTurn, ENHANCER_SYSTEM_PROMPT, type EnhanceResult, type EnhanceUserPromptOptions, enhanceUserPrompt, gatedEnhancerReasoning, normalizedEqual, recentTextTurns, shouldEnhance, } from './execution/prompt-enhancer.js';
59
+ export { type AfterIterationHook, type AfterRunHook, type AfterToolExecutionHook, type AgentExtension, type BeforeIterationHook, type BeforeRunHook, type BeforeToolExecutionHook, ExtensionRegistry, type OnErrorHook, type ProviderRunnerWrapper, } from './extension/index.js';
60
+ export { countShellHooks, HookRegistry, type HookRunEnv, HookRunner, type HookRunnerOptions, hookMatcherMatches, type PreToolUseResult, type PromptResult, runShellHook, type ShellHookSpec, shellHooksEqual, } from './hooks/index.js';
61
+ export * from './hq/index.js';
62
+ export * from './kernel/index.js';
63
+ export { attachMailboxChecker } from './mailbox-attach.js';
64
+ export { type CollabPauseMiddlewareOptions, collabInjectMiddleware, collabPauseMiddleware, type InjectedToolResult as CollabInjectedToolResult, } from './middleware/collab-pause.js';
65
+ export { DefaultPluginAPI, definePlugin, type PluginAPIInit } from './plugin/api.js';
66
+ export { KERNEL_API_VERSION, type LoadPluginsOptions, loadPlugins, unloadPlugins, } from './plugin/loader.js';
67
+ export type { ChimeraReviewNeededPayload, ResolvedChimeraConfig, } from './plugins/chimera-plugin.js';
68
+ export { CHIMERA_REVIEW_PROMPT, createChimeraPlugin, resolveChimeraConfig, } from './plugins/chimera-plugin.js';
69
+ export { createGitPlugin } from './plugins/git-plugin.js';
70
+ export { createObservabilityPlugin } from './plugins/observability-plugin.js';
71
+ export { createPlanPlugin } from './plugins/plan-plugin.js';
72
+ export { createPromptsPlugin } from './plugins/prompts-plugin.js';
73
+ export { createSecurityPlugin } from './plugins/security-plugin.js';
74
+ export { createSkillsPlugin } from './plugins/skills-plugin.js';
75
+ export { createSyncPlugin } from './plugins/sync-plugin.js';
76
+ export * from './prompts/index.js';
77
+ export { type ProviderFactory, ProviderRegistry } from './registry/provider-registry.js';
78
+ export { type SlashCommand, SlashCommandRegistry, } from './registry/slash-command-registry.js';
79
+ export type { ToolWrapper } from './registry/tool-registry.js';
80
+ export { ToolRegistry } from './registry/tool-registry.js';
81
+ export { hashRequest, stableStringify, } from './replay/hash.js';
82
+ export { type ReplayMode, ReplayProviderRunner, type ReplayProviderRunnerOptions, } from './replay/replay-provider-runner.js';
83
+ export { DANGEROUS_FOR_SUBAGENTS, getDangerousCapabilities, hasCapability, hasDangerousCapabilityForSubagents, ToolCapabilities, type ToolCapability, WIDE_SUBAGENT_CAPABILITIES, } from './security/capabilities.js';
84
+ export { DefaultSecretScrubber } from './security/secret-scrubber.js';
85
+ export * from './skills/index.js';
86
+ export * from './storage/index.js';
87
+ export { type AuditLevel, createSessionEventBridge, resolveAuditLevel, resolveSessionLoggingConfig, type SessionEventBridge, type SessionEventBridgeOptions, type SessionSamplingOptions, type ToolProgressSamplingOptions, } from './storage/session-event-bridge.js';
88
+ export { createMcpControlTool, type MCPRegistryHandle } from './tools/mcp-control.js';
89
+ export { createMcpUseTool } from './tools/mcp-use.js';
90
+ export type { Compactor, CompactReport } from './types/compactor.js';
91
+ export { CONTEXT_WINDOW_MODES, type ContextWindowAggressiveOn, type ContextWindowConfigLike, type ContextWindowMode, type ContextWindowModeId, type ContextWindowPolicy, type ContextWindowThresholds, DEFAULT_CONTEXT_WINDOW_MODE_ID, formatContextWindowModeList, getContextWindowMode, isContextWindowModeId, listContextWindowModes, resolveContextWindowPolicy, } from './types/context-window.js';
92
+ export { DEFAULT_SESSION_PRUNE_DAYS } from './types/default-config.js';
93
+ export * from './types/index.js';
94
+ export type { Logger, LogLevel } from './types/logger.js';
95
+ export type { ModelsDevModel, ModelsDevPayload, ModelsDevProvider, ModelsRegistry, ResolvedModel, ResolvedProvider, WireFamily, } from './types/models-registry.js';
96
+ export type { ProviderRunner, RunProviderOptions } from './types/provider-runner.js';
97
+ export type { SecretScrubber } from './types/secret-scrubber.js';
98
+ export type { RotatableSecretVault, SecretVault } from './types/secret-vault.js';
99
+ export { encryptedPrefixForVersion, noOpVault, parseEncryptedVersion, } from './types/secret-vault.js';
100
+ export type { CacheStats, TokenCounter } from './types/token-counter.js';
79
101
  export { expectDefined } from './utils/expect-defined.js';
80
- export { toErrorMessage } from './utils/error.js';
81
- export { T as TaskItem, c as computeTaskItemProgress, f as formatTaskList, a as formatTaskProgress } from './task-format-GX0B1mMC.js';
82
- import './path-resolver-CPRj4bFY.js';
83
- import 'node:events';
84
- import './selector-D8O6B_Rm.js';
85
- import 'node:https';
86
- import 'undici';
87
-
88
- type PhaseStatus = 'pending' | 'ready' | 'running' | 'paused' | 'completed' | 'failed' | 'skipped';
89
- interface PhaseNode {
90
- id: string;
91
- /** Phase name, e.g. "Discovery", "Design", "Implementation", "Testing". */
92
- name: string;
93
- description: string;
94
- status: PhaseStatus;
95
- /** Task graph for this phase. */
96
- taskGraph: TaskGraph;
97
- /** Previous phase IDs; this phase cannot start until they complete. */
98
- dependsOn: string[];
99
- /** Next phase IDs. */
100
- nextPhases: string[];
101
- /** Whether this phase can run in parallel before the previous phase finishes. */
102
- parallelizable: boolean;
103
- /** Phase priority. */
104
- priority: 'critical' | 'high' | 'medium' | 'low';
105
- /** Estimated duration in hours. */
106
- estimateHours: number;
107
- /** Actual duration in milliseconds. */
108
- actualDurationMs?: number | undefined;
109
- /** Start time. */
110
- startedAt?: number | undefined;
111
- /** Completion time. */
112
- completedAt?: number | undefined;
113
- /** Agents assigned to this phase. */
114
- assignedAgents: string[];
115
- /** Phase metadata. */
116
- metadata?: Record<string, unknown> | undefined;
117
- createdAt: number;
118
- updatedAt: number;
119
- }
120
- interface PhaseGraph {
121
- id: string;
122
- /** Project title. */
123
- title: string;
124
- description: string;
125
- phases: Map<string, PhaseNode>;
126
- /** Starting phase IDs. */
127
- rootPhaseIds: string[];
128
- /** Active phase IDs with running status. */
129
- activePhaseIds: string[];
130
- /** Completed phase IDs. */
131
- completedPhaseIds: string[];
132
- /** Failed phase IDs. */
133
- failedPhaseIds: string[];
134
- /** Whether autonomous mode is active. */
135
- autonomous: boolean;
136
- /** Stop when all phases complete. */
137
- stopOnComplete: boolean;
138
- createdAt: number;
139
- updatedAt: number;
140
- startedAt?: number | undefined;
141
- completedAt?: number | undefined;
142
- }
143
- interface PhaseProgress {
144
- totalPhases: number;
145
- pending: number;
146
- ready: number;
147
- running: number;
148
- paused: number;
149
- completed: number;
150
- failed: number;
151
- skipped: number;
152
- percentComplete: number;
153
- totalTasks: number;
154
- completedTasks: number;
155
- failedTasks: number;
156
- estimatedHours: number;
157
- actualHours: number;
158
- }
159
- interface PhaseEventMap {
160
- 'phase.statusChange': {
161
- phaseId: string;
162
- from: PhaseStatus;
163
- to: PhaseStatus;
164
- };
165
- 'phase.started': {
166
- phaseId: string;
167
- name: string;
168
- };
169
- 'phase.completed': {
170
- phaseId: string;
171
- name: string;
172
- durationMs: number;
173
- };
174
- 'phase.failed': {
175
- phaseId: string;
176
- name: string;
177
- error?: string | undefined;
178
- };
179
- /** A task began executing — carries the worker agent so boards can show who is on it. */
180
- 'phase.taskStarted': {
181
- phaseId: string;
182
- taskId: string;
183
- taskTitle: string;
184
- agentId?: string | undefined;
185
- agentName?: string | undefined;
186
- };
187
- 'phase.taskCompleted': {
188
- phaseId: string;
189
- taskId: string;
190
- taskTitle: string;
191
- };
192
- 'phase.taskFailed': {
193
- phaseId: string;
194
- taskId: string;
195
- taskTitle: string;
196
- error: string;
197
- };
198
- 'phase.taskRetrying': {
199
- phaseId: string;
200
- taskId: string;
201
- taskTitle: string;
202
- attempt: number;
203
- maxRetries: number;
204
- };
205
- /** A task timed out — exceeded `taskTimeoutMs`. */
206
- 'phase.taskTimedOut': {
207
- phaseId: string;
208
- taskId: string;
209
- taskTitle: string;
210
- timeoutMs: number;
211
- };
212
- 'phase.allTasksDone': {
213
- phaseId: string;
214
- completed: number;
215
- failed: number;
216
- };
217
- 'phase.verifying': {
218
- phaseId: string;
219
- name: string;
220
- attempt: number;
221
- };
222
- 'phase.verifyFailed': {
223
- phaseId: string;
224
- name: string;
225
- attempt: number;
226
- error?: string | undefined;
227
- };
228
- 'phase.repairing': {
229
- phaseId: string;
230
- name: string;
231
- attempt: number;
232
- };
233
- 'phase.conflictResolving': {
234
- phaseId: string;
235
- name: string;
236
- files: string[];
237
- };
238
- 'phase.conflictResolved': {
239
- phaseId: string;
240
- name: string;
241
- };
242
- 'graph.completed': {
243
- graphId: string;
244
- durationMs: number;
245
- };
246
- 'graph.failed': {
247
- graphId: string;
248
- failedPhaseId: string;
249
- error: string;
250
- };
251
- 'autonomous.tick': {
252
- activePhases: string[];
253
- queuedPhases: string[];
254
- };
255
- 'agent.assigned': {
256
- phaseId: string;
257
- agentId: string;
258
- };
259
- 'agent.released': {
260
- phaseId: string;
261
- agentId: string;
262
- };
263
- /** A task was moved between phases from an interactive board. */
264
- 'phase.taskMoved': {
265
- taskId: string;
266
- fromPhaseId: string;
267
- toPhaseId: string;
268
- };
269
- /** A task was (re)assigned to a specific agent from an interactive board. */
270
- 'phase.taskAssigned': {
271
- phaseId: string;
272
- taskId: string;
273
- agentId?: string | undefined;
274
- agentName?: string | undefined;
275
- };
276
- /** A task was added to a phase from an interactive board. */
277
- 'phase.taskAdded': {
278
- phaseId: string;
279
- taskId: string;
280
- taskTitle: string;
281
- };
282
- }
283
- type PhaseEventName = keyof PhaseEventMap;
284
- /**
285
- * All phase event names as a const array. Consumers (TUI, WebUI) should
286
- * import this rather than hardcoding string literals, so the compiler
287
- * catches drift when events are added or renamed.
288
- */
289
- declare const PHASE_EVENT_NAMES: readonly PhaseEventName[];
290
- interface PhaseExecutionContext {
291
- /**
292
- * Execute a task through an AI agent. `env` points to the phase git
293
- * worktree when available, so the agent runs in an isolated working directory.
294
- */
295
- executeTask: (task: TaskNode, phaseId: string, env?: {
296
- cwd?: string | undefined;
297
- branch?: string | undefined;
298
- }) => Promise<unknown>;
299
- /**
300
- * Optional verification gate. Called after all tasks in a phase finish,
301
- * but before the phase is marked "completed" and its worktree is merged
302
- * back to the base branch. `env` points to the phase worktree when available;
303
- * verification should run in that isolated directory, such as typecheck/test.
304
- * If `ok:false` is returned, merge is blocked and `repairPhase` is attempted when available.
305
- *
306
- * If undefined, the gate is skipped for backward compatibility.
307
- */
308
- verifyPhase?: ((phase: PhaseNode, env?: {
309
- cwd?: string | undefined;
310
- branch?: string | undefined;
311
- }) => Promise<{
312
- ok: boolean;
313
- output?: string | undefined;
314
- }>) | undefined;
315
- /**
316
- * Optional repair pass. When `verifyPhase` fails, it is called with the
317
- * captured error output. It should try to fix the code in the worktree
318
- * for example, through a repair subagent. Its return value is ignored;
319
- * the orchestrator reruns `verifyPhase` afterward. It is never called when `verifyPhase` is undefined.
320
- */
321
- repairPhase?: ((phase: PhaseNode, failure: string, attempt: number, env?: {
322
- cwd?: string | undefined;
323
- branch?: string | undefined;
324
- }) => Promise<void>) | undefined;
325
- /**
326
- * Optional merge-conflict resolver. Called when a phase worktree conflicts
327
- * during squash-merge into the base branch. `info.cwd` points to the base
328
- * working tree where conflict markers exist; the resolver should clean those
329
- * markers and return `true`. On success the merge is committed; otherwise
330
- * the merge is aborted and the worktree is kept in `needs-review`.
331
- * If undefined, conflicts keep the old parked-for-review behavior.
332
- */
333
- resolveConflict?: ((phase: PhaseNode, info: {
334
- conflictFiles: string[];
335
- cwd: string;
336
- }) => Promise<boolean>) | undefined;
337
- /** Optional global Brain arbiter for the policy, decision, and escalation layer. */
338
- brain?: BrainArbiter | undefined;
339
- /** Called when a phase completes. */
340
- onPhaseComplete?: ((phase: PhaseNode) => void) | undefined;
341
- /** Called when a phase fails. */
342
- onPhaseFail?: ((phase: PhaseNode, error: Error) => void) | undefined;
343
- /** Called on every tick in autonomous mode. */
344
- onTick?: ((ctx: {
345
- activePhases: PhaseNode[];
346
- readyPhases: PhaseNode[];
347
- }) => void) | undefined;
348
- }
349
- interface AutoPhaseOptions {
350
- /** Maximum number of parallel phases. */
351
- maxConcurrentPhases?: number | undefined;
352
- /** Maximum number of parallel tasks within a phase. */
353
- maxConcurrentTasks?: number | undefined;
354
- /** Retry count for failed tasks. */
355
- maxRetries?: number | undefined;
356
- /**
357
- * Maximum number of repair attempts after the verification gate fails.
358
- * Total verification runs = maxVerifyAttempts + 1: the first run plus one
359
- * rerun after each repair. Defaults to 2. Has no effect without `verifyPhase`.
360
- */
361
- maxVerifyAttempts?: number | undefined;
362
- /** Autonomous mode: automatically advance as phases complete. */
363
- autonomous?: boolean | undefined;
364
- /** Delay between phases in milliseconds. */
365
- phaseDelayMs?: number | undefined;
366
- /** Stop when a phase fails. */
367
- stopOnFailure?: boolean | undefined;
368
- /**
369
- * Per-task timeout in milliseconds. A single task exceeding this
370
- * is marked failed and `phase.taskTimedOut` is emitted.
371
- * Defaults to 600_000 (10 min). Set to 0 to disable.
372
- */
373
- taskTimeoutMs?: number | undefined;
374
- /** Event bus */
375
- events?: EventBus | undefined;
376
- /**
377
- * Optional git-worktree manager. When provided, each phase runs in its own
378
- * isolated worktree and branch, then is squash-merged back into the base
379
- * branch in order. Without it, behavior is unchanged and uses the shared working tree.
380
- */
381
- worktrees?: WorktreeManager | undefined;
382
- }
383
- interface PhaseFilter {
384
- status?: PhaseStatus[] | undefined;
385
- priority?: PhaseNode['priority'][] | undefined;
386
- }
387
- interface PhaseSort {
388
- field: 'priority' | 'createdAt' | 'startedAt' | 'completedAt';
389
- direction: 'asc' | 'desc';
390
- }
391
- interface PhaseTemplate {
392
- name: string;
393
- description: string;
394
- priority: PhaseNode['priority'];
395
- estimateHours: number;
396
- parallelizable: boolean;
397
- /** Task templates to create automatically. */
398
- taskTemplates?: Array<{
399
- title: string;
400
- description: string;
401
- type: TaskType;
402
- priority: TaskPriority;
403
- estimateHours: number;
404
- tags?: string[] | undefined;
405
- }>;
406
- }
407
-
408
- interface AutoPhaseRunnerOptions extends AutoPhaseOptions {
409
- /** Project title. */
410
- title: string;
411
- description?: string | undefined;
412
- /** Phase templates. */
413
- phases: PhaseTemplate[];
414
- /** Function that executes a task. */
415
- executeTask: PhaseExecutionContext['executeTask'];
416
- /** Optional verification gate. */
417
- verifyPhase?: PhaseExecutionContext['verifyPhase'] | undefined;
418
- /** Optional repair pass after verification failure. */
419
- repairPhase?: PhaseExecutionContext['repairPhase'] | undefined;
420
- /** Optional resolver for worktree merge conflicts. */
421
- resolveConflict?: PhaseExecutionContext['resolveConflict'] | undefined;
422
- /** Optional Brain arbiter. */
423
- brain?: PhaseExecutionContext['brain'] | undefined;
424
- /** Called when a phase completes. */
425
- onPhaseComplete?: ((phase: PhaseNode) => void) | undefined;
426
- /** Called when a phase fails. */
427
- onPhaseFail?: (phase: PhaseNode, error: Error) => void;
428
- /** Called on every orchestrator tick. */
429
- onTick?: (ctx: {
430
- activePhases: PhaseNode[];
431
- readyPhases: PhaseNode[];
432
- }) => void;
433
- /** Called when progress changes. */
434
- onProgress?: ((progress: PhaseProgress) => void) | undefined;
435
- /** Safety net that stops a phase graph if cleanup is bypassed. Default: 24h. */
436
- maxRunDurationMs?: number | undefined;
437
- /** Called when the graph completes. */
438
- onComplete?: ((graph: PhaseGraph) => void) | undefined;
439
- /** Called when the graph fails. */
440
- onFail?: (graph: PhaseGraph, failedPhase: PhaseNode, error: Error) => void;
441
- }
442
- /**
443
- * AutoPhaseRunner - high-level API for managing the whole autonomous phase flow from one entry point.
444
- *
445
- * Usage:
446
- * const runner = new AutoPhaseRunner({
447
- * title: 'Auth Refactor',
448
- * phases: [...],
449
- * executeTask: async (task, phaseId) => { ... },
450
- * onProgress: (p) => console.log(`${p.percentComplete}% done`),
451
- * });
452
- * await runner.start();
453
- */
454
- declare class AutoPhaseRunner {
455
- private graph;
456
- private orchestrator;
457
- private opts;
458
- private progressInterval;
459
- private maxRunTimer;
460
- private readonly graphCompletedHandler;
461
- private readonly graphFailedHandler;
462
- /** Stores the unsubscribe function returned by EventBus.on() */
463
- private unsubscribeCompleted;
464
- private unsubscribeFailed;
465
- constructor(opts: AutoPhaseRunnerOptions);
466
- start(): Promise<PhaseGraph>;
467
- pause(): void;
468
- resume(): void;
469
- stop(): void;
470
- getProgress(): PhaseProgress | null;
471
- getGraph(): PhaseGraph | null;
472
- isRunning(): boolean;
473
- isPaused(): boolean;
474
- assignAgent(phaseId: string, agentId: string): void;
475
- releaseAgent(phaseId: string, agentId: string): void;
476
- private cleanup;
477
- }
478
- /**
479
- * Quick-start helper: create an AutoPhaseRunner from an existing TaskGraph.
480
- */
481
- declare function createAutoPhaseFromTaskGraph(taskGraph: TaskGraph, options: Omit<AutoPhaseRunnerOptions, 'phases' | 'title'> & {
482
- title?: string | undefined;
483
- tasksPerPhase?: number | undefined;
484
- }): Promise<AutoPhaseRunner>;
485
-
486
- interface PhaseOrchestratorOptions extends AutoPhaseOptions {
487
- graph: PhaseGraph;
488
- ctx: PhaseExecutionContext;
489
- }
490
- /**
491
- * PhaseOrchestrator - dependency-aware engine for running phases autonomously.
492
- *
493
- * Features:
494
- * - Automatically starts the next phase as each phase completes in autonomous mode
495
- * - Supports parallel phases with parallelizable=true
496
- * - Assigns and releases agents
497
- * - Integrates with the event bus
498
- * - Supports pause and resume
499
- */
500
- declare class PhaseOrchestrator {
501
- private graph;
502
- private ctx;
503
- private opts;
504
- private events;
505
- private stopped;
506
- private paused;
507
- private runningPhases;
508
- private tickInterval;
509
- private trackerCache;
510
- private taskRetryCounts;
511
- private readonly worktrees?;
512
- /** Per-phase worktree handles, keyed by phase id. */
513
- private readonly phaseWorktrees;
514
- /** Serializes all merges back to the base branch (one at a time). */
515
- private mergeQueue;
516
- /** Per-phase merge promise, so a phase merges only after its deps do. */
517
- private readonly phaseMergePromise;
518
- constructor(opts: PhaseOrchestratorOptions);
519
- /**
520
- * Start the full phase flow.
521
- * In autonomous mode, starts root phases and automatically starts the next phase when they finish.
522
- */
523
- start(): Promise<void>;
524
- /**
525
- * Make a (possibly resumed) graph runnable. A graph loaded from disk after an
526
- * interrupted run can carry transient state from the dead process: phases left
527
- * `running` and tasks left `in_progress`. The scheduler only starts `pending`
528
- * phases (getReadyPhases) and only runs `pending` tasks (getExecutableTasks),
529
- * so without this a resumed phase/task would stall forever. Reset that
530
- * transient state to `pending`; terminal phases (completed/failed/skipped) and
531
- * already-completed tasks are untouched, so completed work is never re-run.
532
- * For a freshly built graph this is a no-op.
533
- */
534
- private normalizeForResume;
535
- /** Wait for all pending phase merges, dependency-ordered and globally serialized. */
536
- private drainMerges;
537
- /** Pause: active phases continue, but no new phase starts. */
538
- pause(): void;
539
- /** Resume: new phases may start again. */
540
- resume(): void;
541
- /** Stop completely, including active phases. */
542
- stop(): void;
543
- private tick;
544
- private startPhase;
545
- /**
546
- * Run the verification gate for a phase whose tasks all succeeded. Verifies in
547
- * the phase's worktree; on failure, runs the repair pass and re-verifies, up to
548
- * `maxVerifyAttempts` repairs. Returns the final verdict. When no `verifyPhase`
549
- * callback is wired the gate is a no-op and always passes.
550
- */
551
- private runVerifyGate;
552
- /** Worktree env (cwd/branch) for a phase, or undefined if it runs on the shared tree. */
553
- private worktreeEnv;
554
- /** Shared failure bookkeeping for a phase whose tasks ran but the phase failed. */
555
- private failPhaseAfterTasks;
556
- /**
557
- * A phase whose tasks all succeeded was marked `completed` and queued for
558
- * merge, but the merge back into the base branch failed. Its work is NOT
559
- * integrated, so correct the graph: move the phase out of `completedPhaseIds`
560
- * into `failedPhaseIds` and flip its status to `failed`. Without this the
561
- * persisted graph (and the board) would claim the phase succeeded while a
562
- * `phase.failed` event fired — an inconsistency that hides un-merged work.
563
- * Idempotent: safe to call more than once for the same phase.
564
- */
565
- private markPhaseMergeFailed;
566
- /** Trim long verifier output so it fits cleanly in an event/error message. */
567
- private truncate;
568
- /**
569
- * Commit the phase's worktree changes, then enqueue the merge back into the
570
- * base branch. Merges run dependency-ordered (a phase merges only after its
571
- * `dependsOn` phases) and globally serialized (one at a time) to avoid
572
- * concurrent writes to the base tree.
573
- */
574
- private commitAndEnqueueMerge;
575
- /**
576
- * Squash-merge one phase. When a `resolveConflict` callback is wired, a merge
577
- * conflict is handed to it (a resolver subagent) before giving up; only if
578
- * that fails does the worktree fall to needs-review and the run continues.
579
- */
580
- private mergeOne;
581
- private shouldAttemptConflictResolution;
582
- private setIntegrationMetadata;
583
- /** A failed phase keeps its worktree on disk for inspection (no merge). */
584
- private keepWorktreeForReview;
585
- private executePhaseTasks;
586
- private executeSingleTask;
587
- private markTaskCompleted;
588
- private markTaskFailed;
589
- private getReadyPhases;
590
- private getActivePhases;
591
- private getExecutableTasks;
592
- private getTrackerForPhase;
593
- private getFailedTaskCount;
594
- private getCompletedTaskCount;
595
- private updatePhaseStatus;
596
- private isComplete;
597
- private onGraphComplete;
598
- private onGraphFailed;
599
- getProgress(): PhaseProgress;
600
- getGraph(): PhaseGraph;
601
- isRunning(): boolean;
602
- isPaused(): boolean;
603
- assignAgent(phaseId: string, agentId: string): void;
604
- releaseAgent(phaseId: string, agentId: string): void;
605
- /** Find the phase whose task graph currently holds `taskId`. */
606
- findPhaseOfTask(taskId: string): PhaseNode | undefined;
607
- /**
608
- * Move a task to another phase's task graph. Edges that referenced the task
609
- * are dropped (cross-phase dependencies are not modeled). No-op when the task
610
- * or target phase is missing, or it is already in the target phase.
611
- */
612
- moveTask(taskId: string, toPhaseId: string): boolean;
613
- /** (Re)assign a task to a specific agent (or clear with agentName/agentId omitted). */
614
- setTaskAssignee(taskId: string, agentId?: string, agentName?: string): boolean;
615
- /** Add a new task to a phase. Returns the created task id, or null if the phase is missing. */
616
- addTask(phaseId: string, spec: {
617
- title: string;
618
- description?: string | undefined;
619
- type?: TaskNode['type'] | undefined;
620
- priority?: TaskNode['priority'] | undefined;
621
- }): string | null;
622
- /**
623
- * Requeue a task to `pending` (clearing its retry counter) and nudge a
624
- * terminal/paused phase back to `ready` so the loop re-runs it. Backs both the
625
- * board's "retry" and "start" affordances.
626
- */
627
- requeueTask(taskId: string): boolean;
628
- private emit;
629
- private createNoopEventBus;
630
- private waitWhilePaused;
631
- private delay;
632
- }
633
-
634
- interface PhaseGraphBuilderOptions {
635
- title: string;
636
- description?: string | undefined;
637
- /** Ordered phase templates. */
638
- phases: PhaseTemplate[];
639
- /** Autonomous mode. */
640
- autonomous?: boolean | undefined;
641
- /** Stop on failure. */
642
- stopOnFailure?: boolean | undefined;
643
- /** Optional external TaskStore. */
644
- externalTaskStore?: TaskStore | undefined;
645
- }
646
- /**
647
- * PhaseGraphBuilder - builds project phases and a task graph for each phase.
648
- *
649
- * Usage:
650
- * const builder = new PhaseGraphBuilder({
651
- * title: 'Auth System Refactor',
652
- * phases: [
653
- * { name: 'Discovery', description: '...', priority: 'high', estimateHours: 2, parallelizable: false },
654
- * { name: 'Design', description: '...', priority: 'critical', estimateHours: 4, parallelizable: false },
655
- * { name: 'Implementation', description: '...', priority: 'critical', estimateHours: 12, parallelizable: false },
656
- * { name: 'Testing', description: '...', priority: 'high', estimateHours: 6, parallelizable: true },
657
- * { name: 'Deployment', description: '...', priority: 'medium', estimateHours: 2, parallelizable: false },
658
- * ]
659
- * });
660
- * const graph = await builder.build();
661
- */
662
- declare class PhaseGraphBuilder {
663
- private readonly opts;
664
- constructor(opts: PhaseGraphBuilderOptions);
665
- build(): Promise<PhaseGraph>;
666
- /**
667
- * Create phases from an existing TaskGraph.
668
- * Groups tasks into phases using topological sort so dependencies
669
- * stay in the same phase wherever possible.
670
- */
671
- static fromTaskGraph(taskGraph: TaskGraph, options: Omit<PhaseGraphBuilderOptions, 'phases'> & {
672
- /** Number of tasks per phase. Defaults to 5. */
673
- tasksPerPhase?: number | undefined;
674
- }): Promise<PhaseGraph>;
675
- }
676
-
677
- /**
678
- * AutoPhasePlanner - converts a goal into phases using a real LLM call,
679
- * producing a large task list with todos under each phase.
680
- *
681
- * Similar to SDD's spec-to-task flow, but different: the output is directly
682
- * `PhaseTemplate[]`; each phase carries `taskTemplates`, so
683
- * `PhaseGraphBuilder` produces a populated `PhaseGraph` and `PhaseOrchestrator`
684
- * runs each task through a real agent execution.
685
- *
686
- * The planner is not tied to a specific LLM: callers provide a `runOnce(prompt)` function
687
- * (a subagent run in the CLI, or a deterministic stub in tests).
688
- */
689
-
690
- interface AutoPhasePlannerOptions {
691
- /**
692
- * One-shot LLM call: receives a prompt and returns the model text output.
693
- * In the CLI this wraps subagent.run; in tests it can be a deterministic stub.
694
- */
695
- runOnce: (prompt: string) => Promise<string>;
696
- /** Goal or project title. */
697
- goal: string;
698
- /** Optional project context such as package.json or directory structure. */
699
- projectContext?: string | undefined;
700
- /** Requested minimum phase count. Defaults to 3. */
701
- minPhases?: number | undefined;
702
- /** Requested maximum phase count. Defaults to 8. */
703
- maxPhases?: number | undefined;
704
- /** Target todo count per phase. Defaults to 6. */
705
- todosPerPhase?: number | undefined;
706
- /**
707
- * Maximum total tasks across all phases. When set, plans exceeding
708
- * this limit will have `budgetExceeded: true` and `warnings` will
709
- * describe the overage. Defaults to 0 (no limit).
710
- */
711
- maxTotalTasks?: number | undefined;
712
- }
713
- interface AutoPhasePlanResult {
714
- /** Phase templates passed to PhaseGraphBuilder. */
715
- phases: PhaseTemplate[];
716
- /** Raw model output for debugging and logs. */
717
- raw: string;
718
- /** True when JSON could not be parsed; `phases` is empty in that case. */
719
- parseFailed: boolean;
720
- /** Validation warnings collected during coercion (e.g. invalid priority defaults). */
721
- warnings: string[];
722
- /**
723
- * Rough cost estimate (in tokens) for executing this plan.
724
- * Based on estimated task count × average per-task LLM round-trip.
725
- */
726
- estimatedCostTokens?: number | undefined;
727
- /** True when the plan exceeds `maxTotalTasks` budget. */
728
- budgetExceeded?: boolean | undefined;
729
- }
730
- /**
731
- * AutoPhasePlanner drives the model through `plan()` and produces `PhaseTemplate[]`.
732
- */
733
- declare class AutoPhasePlanner {
734
- private readonly opts;
735
- constructor(opts: AutoPhasePlannerOptions);
736
- /** Convert the goal into a phase-and-todo plan. */
737
- plan(): Promise<AutoPhasePlanResult>;
738
- /** Instruction prompt for the plan the model should produce. */
739
- buildPrompt(): string;
740
- /** Extract JSON from raw output, validate it, and convert it to PhaseTemplate[].
741
- * Returns `{ phases, warnings }` where warnings describe coerced defaults. */
742
- parse(raw: string): {
743
- phases: PhaseTemplate[];
744
- warnings: string[];
745
- };
746
- private coercePhase;
747
- private coerceTask;
748
- }
749
-
750
- interface PhaseStoreOptions {
751
- baseDir: string;
752
- }
753
- /**
754
- * PhaseStore - persistence layer for saving and loading PhaseGraph objects on disk.
755
- */
756
- declare class PhaseStore {
757
- readonly baseDir: string;
758
- constructor(opts: PhaseStoreOptions);
759
- save(graph: PhaseGraph): Promise<void>;
760
- load(graphId: string): Promise<PhaseGraph | null>;
761
- delete(graphId: string): Promise<void>;
762
- list(): Promise<Array<{
763
- id: string;
764
- title: string;
765
- updatedAt: number;
766
- status: string;
767
- }>>;
768
- private getFilePath;
769
- private serializeGraph;
770
- private serializePhase;
771
- private serializeTaskGraph;
772
- private serializeTaskNode;
773
- private deserializeGraph;
774
- private deserializePhase;
775
- private deserializeTaskGraph;
776
- }
777
-
778
- interface Checkpoint {
779
- id: string;
780
- graphId: string;
781
- phaseId: string;
782
- phaseStatus: PhaseNode['status'];
783
- taskStatuses: Array<{
784
- taskId: string;
785
- status: string;
786
- title: string;
787
- }>;
788
- timestamp: number;
789
- label?: string | undefined;
790
- }
791
- interface CheckpointManagerOptions {
792
- store: PhaseStore;
793
- maxCheckpoints?: number | undefined;
794
- /** Max age in ms before a checkpoint is eligible for TTL-based pruning. Default: 7 days. */
795
- maxCheckpointAgeMs?: number | undefined;
796
- baseDir?: string | undefined;
797
- }
798
- /**
799
- * CheckpointManager - saves and restores snapshots of the phase graph.
800
- *
801
- * Usage:
802
- * const cm = new CheckpointManager({ store });
803
- * await cm.saveCheckpoint(graph, 'Before risky refactor');
804
- * // ... if something goes wrong ...
805
- * const restored = await cm.restoreCheckpoint(checkpointId);
806
- */
807
- declare class CheckpointManager {
808
- private store;
809
- private maxCheckpoints;
810
- private maxCheckpointAgeMs;
811
- private checkpoints;
812
- private baseDir;
813
- constructor(opts: CheckpointManagerOptions);
814
- initialize(): Promise<void>;
815
- saveCheckpoint(graph: PhaseGraph, label?: string): Promise<Checkpoint>;
816
- restoreCheckpoint(checkpointId: string): Promise<PhaseGraph | null>;
817
- listCheckpoints(graphId?: string): Checkpoint[];
818
- deleteCheckpoint(checkpointId: string): Promise<boolean>;
819
- private saveToDisk;
820
- private deleteFromDisk;
821
- private loadFromDisk;
822
- private pruneCheckpoints;
823
- }
824
-
825
- /**
826
- * Options for {@link bootConfig}. Both the CLI and the WebUI server boot the
827
- * same way; the only intentional differences are the label used in the
828
- * plaintext-secret migration notice and whether CLI flags are supplied.
829
- */
830
- interface BootConfigOptions {
831
- /**
832
- * Parsed CLI flags. `cwd` relocates path resolution; `provider`/`model`/
833
- * `log-level`/`verbose`/`trace`/`yolo`/`no-features` are patched into the
834
- * loaded config (see {@link flagsToConfigPatch}). Defaults to `{}` (the
835
- * WebUI server passes no flags).
836
- */
837
- flags?: Record<string, string | boolean>;
838
- /**
839
- * Label shown in the `[<label>] Encrypted N plaintext secret(s) in FILE`
840
- * stderr notice emitted when legacy plaintext secrets get auto-encrypted.
841
- * The CLI passes `wstack`; the WebUI server passes `WebUI`. Default
842
- * `wstack`.
843
- */
844
- appLabel?: string | undefined;
845
- /**
846
- * Load `~/.wrongstack/sync.json` and merge it into `config.sync` so the
847
- * ConfigStore starts with the correct CloudSync state. Default `true`.
848
- */
849
- loadSyncConfig?: boolean | undefined;
850
- /**
851
- * Skip the provider/model identity validation during config load. When
852
- * `true`, a missing provider or model in config does NOT throw — the
853
- * boot caller is responsible for handling the missing-provider case
854
- * (e.g. showing a setup screen). Used by `--webui` mode so the WebUI
855
- * can boot without a configured provider and show the setup screen.
856
- */
857
- skipIdentityValidation?: boolean | undefined;
858
- }
859
- /**
860
- * Everything the boot phase resolves before DI-container wiring. Superset of
861
- * what the CLI and WebUI server each consumed previously, so both can pick the
862
- * fields they need from a single canonical result.
863
- */
864
- interface BootConfigResult {
865
- cwd: string;
866
- projectRoot: string;
867
- userHome: string;
868
- wpaths: WstackPaths;
869
- pathResolver: DefaultPathResolver;
870
- config: Config;
871
- vault: DefaultSecretVault;
872
- logger: DefaultLogger;
873
- /** Convenience alias for `wpaths.globalConfig`. */
874
- globalConfigPath: string;
875
- }
876
- /**
877
- * Canonical boot routine shared by `@wrongstack/cli` and `@wrongstack/webui`.
878
- * Resolves paths, creates the real AES-GCM secret vault, migrates any
879
- * plaintext secrets, loads + merges config (with CLI-flag overrides and an
880
- * optional sync overlay), and builds a logger.
881
- *
882
- * The per-package `bootConfig()` wrappers re-shape this result into their own
883
- * legacy return types for backward compatibility — keep this the single source
884
- * of boot behavior so the two consumers can't drift.
885
- */
886
- declare function bootConfig(options?: BootConfigOptions): Promise<BootConfigResult>;
887
- /**
888
- * Translate parsed CLI flags into a partial Config patch applied on top of the
889
- * file-loaded config. Explicit `--log-level` wins over `--verbose`/`--trace`.
890
- */
891
- declare function flagsToConfigPatch(flags: Record<string, string | boolean>): Partial<Config>;
892
-
893
- /**
894
- * CollaborationBus — kernel-level pause/resume signal for the
895
- * collaboration `controller` role (Phase 3 of idea #13 from IDEAS.md).
896
- *
897
- * The bus is a single-process singleton. The webui server (which hosts
898
- * the agent loop) creates one at boot, passes it to both the agent's
899
- * `toolCall` pipeline (as a middleware) and the `CollaborationWsHandler`
900
- * (which toggles it on client requests).
901
- *
902
- * Semantics:
903
- * - `requestPause(by)` flips the bus into the "paused" state. The
904
- * state has no timeout of its own — the *middleware* decides how
905
- * long to wait before auto-resuming (default 60s).
906
- * - `resume()` returns the bus to the running state. Idempotent:
907
- * calling resume() when not paused is a no-op returning `false`.
908
- * - `waitForResume(timeoutMs)` is what the middleware calls. It
909
- * returns `true` if the bus was resumed in time, `false` if the
910
- * timeout fired (in which case it also auto-resumes, so the agent
911
- * loop is never permanently stuck).
912
- * - `getState()` returns a snapshot for observability surfaces
913
- * (UI badges, CLI `/collab status`).
914
- *
915
- * Why a separate bus object rather than putting state on RunController?
916
- *
917
- * - The RunController is per-run; the bus is per-process. A single
918
- * pause signal across the whole webui process is the right
919
- * granularity (the webui hosts exactly one Agent.run at a time).
920
- * - The bus can be unit-tested without spinning up an Agent. The
921
- * middleware can be tested by injecting a fake bus.
922
- * - Future multi-session webui (when the bus is upgraded to filter
923
- * by sessionId) does not require touching the agent loop — the
924
- * middleware already receives the sessionId in its payload.
925
- */
926
- type CollabBusState = {
927
- paused: boolean;
928
- pausedAt: string | null;
929
- pausedBy: string | null;
930
- };
931
- declare class CollaborationBus {
932
- private pausePromise;
933
- private pauseResolve;
934
- private pausedAtMs;
935
- private pausedBy;
936
- isPaused(): boolean;
937
- getState(): CollabBusState;
938
- /**
939
- * Pause the agent loop. Idempotent: a second `requestPause` while
940
- * already paused is a no-op (the original pause wins; we do not
941
- * overwrite `pausedBy`). Returns true when the state actually
942
- * transitioned, false when it was already paused.
943
- */
944
- requestPause(byParticipant: string): boolean;
945
- /**
946
- * Resume the agent loop. Returns true when the state actually
947
- * transitioned from paused → running, false when it was already
948
- * running (no-op).
949
- */
950
- resume(): boolean;
951
- /**
952
- * Block until the bus is resumed or the timeout fires. Returns:
953
- * - `true` → bus was resumed in time
954
- * - `false` → timeout fired; bus was auto-resumed as a side effect
955
- *
956
- * When `timeoutMs` is `0` the wait is unbounded (the middleware must
957
- * be paired with an external AbortSignal in that case — we don't
958
- * expose one here to keep the API simple).
959
- */
960
- waitForResume(timeoutMs: number): Promise<boolean>;
961
- private readonly injectionQueue;
962
- private onConsumed?;
963
- /**
964
- * Register a listener fired when `collabInjectMiddleware` actually splices a
965
- * queued injection into a tool call (Phase 4 feedback loop). The webui's
966
- * CollaborationWebSocketHandler uses it to broadcast a
967
- * `collab.injection.granted` with phase `'consumed'` so observers learn the
968
- * injection was applied (and to which real tool). Last registration wins.
969
- */
970
- onInjectionConsumed(fn: (info: ConsumedInjectionInfo) => void): void;
971
- /**
972
- * Invoked by `collabInjectMiddleware` immediately after it replaces a tool
973
- * call's result with a queued injection. No-op when no listener is set.
974
- */
975
- notifyInjectionConsumed(info: ConsumedInjectionInfo): void;
976
- /**
977
- * Queue a manual tool result. The next time the agent's toolCall
978
- * pipeline sees a matching `toolUse.id`, the
979
- * `collabInjectMiddleware` consumes this entry and replaces the
980
- * real tool execution. Returns `false` if an injection for the
981
- * same id is already queued (idempotent — first write wins).
982
- */
983
- injectToolResult(input: InjectedToolResult): boolean;
984
- /**
985
- * Pop an injection from the queue. Returns the payload (and
986
- * removes it) if one is pending, or `null` when nothing matches.
987
- * Called by the middleware on every tool call.
988
- */
989
- takeInjection(toolUseId: string): InjectedToolResult | null;
990
- /** Inspect the queue size (for observability / tests). */
991
- pendingInjectionCount(): number;
992
- }
993
- /**
994
- * Payload for a queued manual tool-call injection. The middleware
995
- * splices this into the toolCall pipeline as a synthetic result.
996
- */
997
- interface InjectedToolResult {
998
- toolUseId: string;
999
- /** Serialized content the model will see (string, JSON, etc.). */
1000
- content: unknown;
1001
- /** When true, the result is rendered as a tool error. */
1002
- isError: boolean;
1003
- /**
1004
- * Free-form context surfaced in the broadcast and the audit log,
1005
- * e.g. "controller: read returned the right file but with these
1006
- * contents" or "controller: skipped the destructive bash call".
1007
- */
1008
- reason: string;
1009
- /** Participant id of the controller who issued the injection. */
1010
- authorId: string;
1011
- }
1012
- /**
1013
- * Emitted to `onInjectionConsumed` listeners when the middleware splices a
1014
- * queued injection into a real tool call. Carries the resolved tool NAME
1015
- * (unknown at queue time — the injection is keyed only by tool_use_id).
1016
- */
1017
- interface ConsumedInjectionInfo {
1018
- toolUseId: string;
1019
- toolName: string;
1020
- authorId: string;
1021
- reason: string;
1022
- isError: boolean;
1023
- }
1024
-
1025
- /**
1026
- * commit-safety — detect when a commit would sweep up work that this session
1027
- * did NOT author.
1028
- *
1029
- * When several coding agents (or a separate wrongstack process, or a human)
1030
- * edit the same worktree at once, a blanket `git add .` / commit-all captures
1031
- * everyone's uncommitted changes — including half-finished work from another
1032
- * agent. There is no way to un-bake that once it lands in a shared commit.
1033
- *
1034
- * This module reads the working tree and cross-references it against the
1035
- * per-project {@link file-author-tracker} log (which records the sessionId that
1036
- * created/edited each file). Dirty files whose latest author is a DIFFERENT
1037
- * session are flagged as "foreign"; dirty files with no recorded author are
1038
- * "unverified" (a concurrent non-wrongstack agent, a build/format step, or a
1039
- * human). The result is a plain-text warning callers render before committing.
1040
- *
1041
- * Warn-only by design: this never blocks or rewrites what gets committed — it
1042
- * surfaces the risk so the agent (or user) can scope the commit to its own
1043
- * files or coordinate first.
1044
- *
1045
- * @module commit-safety
1046
- */
1047
- interface CommitSafetyOptions {
1048
- /** Directory to run git in (the agent's cwd is fine). */
1049
- cwd: string;
1050
- /** Project root, used to locate the file-author log. */
1051
- projectRoot: string;
1052
- /**
1053
- * The current session's id — the "self" key. Dirty files authored by a
1054
- * different sessionId are flagged as foreign. When omitted, every authored
1055
- * file counts as foreign (we cannot prove ownership).
1056
- */
1057
- sessionId?: string | undefined;
1058
- /**
1059
- * Directory holding the file-author log. Defaults to the resolved per-project
1060
- * dir (`~/.wrongstack/projects/<slug>`). Mainly an injection seam for tests.
1061
- */
1062
- storageDir?: string | undefined;
1063
- /** Abort signal for the git subprocesses. */
1064
- signal?: AbortSignal | undefined;
1065
- }
1066
- interface ForeignFile {
1067
- /** Repo-relative path. */
1068
- path: string;
1069
- /** Human-readable name of the agent that last authored it, if known. */
1070
- agentName?: string | undefined;
1071
- /** Session that last authored it, if known. */
1072
- sessionId?: string | undefined;
1073
- }
1074
- interface CommitSafetyReport {
1075
- /** Total uncommitted (staged + unstaged + untracked) paths. */
1076
- dirtyCount: number;
1077
- /** Dirty files whose latest recorded author is a DIFFERENT session. */
1078
- foreignFiles: ForeignFile[];
1079
- /** Dirty files with no recorded author for any session. */
1080
- unverifiedFiles: string[];
1081
- /** Branch names of OTHER active worktrees of this repo (excludes ours). */
1082
- otherWorktrees: string[];
1083
- /**
1084
- * Pre-formatted, plain-text (no ANSI) multi-line warning, or '' when there
1085
- * is nothing notable to surface. Callers may colorize/wrap as they see fit.
1086
- */
1087
- warning: string;
1088
- }
1089
- /**
1090
- * Assess whether committing now risks capturing another agent's work.
1091
- *
1092
- * Best-effort: any git failure (not a repo, git missing, timeout) yields an
1093
- * empty report rather than throwing — commit-safety must never break a commit.
1094
- */
1095
- declare function assessCommitSafety(opts: CommitSafetyOptions): Promise<CommitSafetyReport>;
1096
-
1097
- /**
1098
- * file-author-tracker — JSON-based tracking of which agent created/edited files.
1099
- *
1100
- * Stores a per-project JSON log in the global project directory:
1101
- * ~/.wrongstack/projects/<slug-hash>/file-authors.json
1102
- *
1103
- * Each entry records: file path, action (create|edit), agent id/name,
1104
- * timestamp, and optional session id.
1105
- *
1106
- * Used by the tech-stack agent and other coordination tools to know
1107
- * who touched what, so warnings can be routed to the right agent.
1108
- *
1109
- * @module file-author-tracker
1110
- */
1111
- interface FileAuthorEntry {
1112
- /** Absolute or relative file path. */
1113
- filePath: string;
1114
- /** What happened to the file. */
1115
- action: 'create' | 'edit' | 'delete';
1116
- /** Agent id (e.g. 'leader', 'tech-stack', 'executor'). */
1117
- agentId: string;
1118
- /** Human-readable agent name. */
1119
- agentName?: string | undefined;
1120
- /** Session that performed the action. */
1121
- sessionId?: string | undefined;
1122
- /** ISO8601 timestamp. */
1123
- timestamp: string;
1124
- /** Optional commit hash if known. */
1125
- commitHash?: string | undefined;
1126
- }
1127
- interface FileAuthorLog {
1128
- /** Project root this log belongs to. */
1129
- projectRoot: string;
1130
- /** All entries, newest last. */
1131
- entries: FileAuthorEntry[];
1132
- /** Last time the log was compacted (old entries archived). */
1133
- lastCompactedAt?: string | undefined;
1134
- }
1135
- interface FileAuthorTrackerOptions {
1136
- /** Directory where the JSON log is stored. Usually the global project dir. */
1137
- storageDir: string;
1138
- /** Project root for reference. */
1139
- projectRoot: string;
1140
- /** Max entries before auto-compaction. Default: 5000. */
1141
- maxEntries?: number | undefined;
1142
- }
1143
- /**
1144
- * Record that an agent created, edited, or deleted a file.
1145
- */
1146
- declare function recordFileAction(opts: FileAuthorTrackerOptions, entry: Omit<FileAuthorEntry, 'timestamp'>): Promise<void>;
1147
- /**
1148
- * Get the most recent author entry for a given file path.
1149
- * Returns undefined if no entry exists.
1150
- */
1151
- declare function getLastAuthor(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, filePath: string): Promise<FileAuthorEntry | undefined>;
1152
- /**
1153
- * Get all entries for a file, newest last.
1154
- */
1155
- declare function getFileHistory(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, filePath: string): Promise<FileAuthorEntry[]>;
1156
- /**
1157
- * Get all files last touched by a specific agent.
1158
- */
1159
- declare function getFilesByAgent(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, agentId: string): Promise<Map<string, FileAuthorEntry>>;
1160
- /**
1161
- * Return the full log (for debugging/auditing).
1162
- */
1163
- declare function getFullLog(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>): Promise<FileAuthorLog>;
1164
- /**
1165
- * Compact the log by archiving old entries to a separate file.
1166
- * Keeps the most recent `keepCount` entries in the active log.
1167
- */
1168
- declare function compactLog(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, keepCount?: number): Promise<{
1169
- archived: number;
1170
- kept: number;
1171
- }>;
1172
-
1173
- /**
1174
- * Subagent nickname pool — famous scientists, mathematicians, and computing pioneers.
1175
- * Names are grouped by domain affinity so the nickname hints at the agent's role.
1176
- */
1177
- /** Result of a nickname assignment. */
1178
- interface NicknameAssignment {
1179
- /**
1180
- * Canonical pool key (e.g. `von-neumann`). This — NOT the display string — is
1181
- * what callers must add to their `used` set and later remove on release.
1182
- * Deriving the key by parsing the display string is unsafe: multi-word names
1183
- * like "Von Neumann" would be truncated to "von" and never dedupe correctly.
1184
- */
1185
- key: string;
1186
- /** Human display string, e.g. `Von Neumann (Backend)`. */
1187
- display: string;
1188
- }
1189
- /**
1190
- * Assign a unique nickname to a subagent based on its role.
1191
- *
1192
- * Returns both the canonical pool `key` (for the `used` set) and the formatted
1193
- * `display` string (`Name (Role)`, e.g. `Einstein (Bug Hunter)`).
1194
- *
1195
- * @param role - The subagent's role id (e.g. 'bug-hunter', 'security-scanner')
1196
- * @param used - Set of nickname KEYS already assigned in this fleet
1197
- * (so no two subagents share the same base name)
1198
- */
1199
- declare function assignNickname(role: string, used: ReadonlySet<string>): NicknameAssignment;
1200
- /**
1201
- * Resolve a previously-assigned display string back to its canonical pool key,
1202
- * for release paths that only retained the formatted name (e.g. a manifest
1203
- * entry). Strips the trailing ` (Role)` suffix, then matches the base name
1204
- * against the pool. Returns `undefined` when the name is not a known nickname.
1205
- *
1206
- * Use this instead of `name.split(' ')[0]` — the latter mangles multi-word
1207
- * names like "Von Neumann" and "Berners-Lee".
1208
- */
1209
- declare function nicknameKeyFromDisplay(display: string): string | undefined;
1210
-
1211
- /**
1212
- * techstack-mailbox-consumer — Auto-spawns the tech-stack agent when
1213
- * dep-watcher messages land in the mailbox.
1214
- *
1215
- * This module runs a lightweight polling loop that checks the mailbox
1216
- * for unread `assign` messages directed at the `tech-stack` agent.
1217
- * When found, it invokes the provided `onSpawn` callback to spawn a
1218
- * tech-stack subagent, passing the manifest path as the task.
1219
- *
1220
- * The consumer also records file-author entries when it detects that
1221
- * a manifest was edited, so the tech-stack agent knows who to warn.
1222
- *
1223
- * @module techstack-mailbox-consumer
1224
- */
1225
-
1226
- interface TechStackConsumerOptions {
1227
- /** The mailbox to poll. */
1228
- mailbox: Mailbox;
1229
- /** Called when a tech-stack agent should be spawned. Receives the task description. */
1230
- onSpawn: (task: string, name: string) => Promise<{
1231
- subagentId: string;
1232
- taskId: string;
1233
- }>;
1234
- /** Agent id that the consumer watches for. Default: 'tech-stack'. */
1235
- targetAgent?: string | undefined;
1236
- /** Agent id that sends the completion ack. Default: 'tech-stack-consumer'. */
1237
- consumerAgentId?: string | undefined;
1238
- /** Polling interval in ms. Default: 5000. */
1239
- pollIntervalMs?: number | undefined;
1240
- /** File-author tracker config (for recording manifest edits). */
1241
- fileAuthorOpts?: FileAuthorTrackerOptions | undefined;
1242
- /** Current session id (for file-author entries). */
1243
- sessionId?: string | undefined;
1244
- /** Current agent id (for file-author entries). */
1245
- currentAgentId?: string | undefined;
1246
- /** Current agent name (for file-author entries). */
1247
- currentAgentName?: string | undefined;
1248
- /** Called on each poll cycle for logging. */
1249
- onLog?: ((msg: string) => void) | undefined;
1250
- /** Called when an error occurs. */
1251
- onError?: ((err: unknown) => void) | undefined;
1252
- }
1253
- /**
1254
- * Start the mailbox consumer loop.
1255
- *
1256
- * Returns a dispose function that stops polling and cleans up.
1257
- */
1258
- declare function startTechStackConsumer(opts: TechStackConsumerOptions): () => void;
1259
-
1260
- /**
1261
- * `/btw` — non-aborting mid-run steering ("by the way").
1262
- *
1263
- * Unlike `/steer` (which aborts the current iteration and prepends a heavy
1264
- * STEERING preamble), `/btw` stashes a short note on the live `Context` and
1265
- * lets the agent pick it up at the NEXT iteration boundary — between tool
1266
- * batches — without tearing down in-flight work.
1267
- *
1268
- * Flow:
1269
- * 1. The `/btw <text>` slash command calls `setBtwNote(ctx, text)` on the
1270
- * live run context. Multiple notes accumulate in order.
1271
- * 2. At the top of each agent iteration (before the request is built),
1272
- * `Agent` drains the queue via `consumeBtwNotes(ctx)` and folds the
1273
- * notes into the conversation as a user-visible block.
1274
- *
1275
- * The notes live in `ctx.meta` so the slash command and the agent loop share
1276
- * one source of truth, the same way `_autonomousContinue` is plumbed in
1277
- * {@link ./continue-to-next-iteration.ts}.
1278
- */
1279
-
1280
- /**
1281
- * Stash a "by the way" note on the context. The agent surfaces it at the
1282
- * start of its next iteration. Blank notes are ignored. Returns the number
1283
- * of notes now pending.
1284
- */
1285
- declare function setBtwNote(ctx: Context, text: string): number;
1286
- /** Number of notes currently waiting to be delivered. */
1287
- declare function pendingBtwCount(ctx: Context): number;
1288
- /**
1289
- * Read and clear all pending notes in one call. Returns them in the order
1290
- * they were added (empty array when none).
1291
- */
1292
- declare function consumeBtwNotes(ctx: Context): string[];
1293
- /**
1294
- * Format pending notes as the text the agent reads. Kept deliberately light
1295
- * (no "I interrupted you" framing) so the model folds the note into its
1296
- * current work rather than restarting.
1297
- */
1298
- declare function buildBtwBlock(notes: string[]): string;
1299
-
1300
- /**
1301
- * Continue-intent detection + continuation resolution.
1302
- *
1303
- * ## Problem
1304
- *
1305
- * Users frequently type a bare "continue" (or "devam", "go on", "keep going")
1306
- * to nudge the agent forward without supplying any new instruction. On its own
1307
- * that word carries no information about *what* to continue — the model has to
1308
- * re-derive "what was next" from history, which drifts as the context window is
1309
- * compacted. Left unanchored, a run of "continue … continue … continue" turns
1310
- * into an ever-vaguer manual loop: the model repeats work, declares completion
1311
- * prematurely, or wanders.
1312
- *
1313
- * ## Approach
1314
- *
1315
- * A bare "continue" is not new information — it points at an *existing* goal.
1316
- * So instead of asking the model to remember a hidden per-message marker, we
1317
- * resolve the continuation against the state we already keep:
1318
- *
1319
- * 1. **Open todos** — the strongest, most durable anchor. Survives context
1320
- * compaction (todos are re-injected each turn) and goal.json persistence.
1321
- * "continue" = resume the next open todo.
1322
- * 2. **Parsed `<nextsteps>` suggestions** — the menu surfaced after the last
1323
- * completed turn (already extracted and stored by the surface's
1324
- * suggestion store). "continue" = do suggestion #1.
1325
- * 3. **Open continuation** — no explicit task is queued, but the user still
1326
- * wants work to proceed. We inject an instruction that tells the model to
1327
- * pick the single most valuable next step itself and carry it out — while
1328
- * explicitly forbidding fabricated busywork. This is what keeps "continue"
1329
- * from ever dead-ending.
1330
- *
1331
- * This module is pure and surface-agnostic: detection takes the raw string,
1332
- * resolution takes already-collected data (todos + parsed suggestion strings).
1333
- * The REPL and TUI wire it in at the point where a user message becomes an
1334
- * agent run, *before* prompt refinement — a bare "continue" has nothing
1335
- * meaningful to refine, and refining it would only add latency and drift.
1336
- *
1337
- * The three triggers of the same continuation machinery — the user typing
1338
- * "continue", the model emitting the `[continue]` marker (see
1339
- * {@link parseContinueDirective}), and an autonomy tick — all ultimately want
1340
- * the same thing: advance the plan. This module is the manual-trigger path.
1341
- */
1342
-
1343
- /**
1344
- * True when `raw` is a bare "continue"-style nudge and nothing else.
1345
- *
1346
- * Strict by construction: the message must normalize to exactly one of
1347
- * {@link CONTINUE_PHRASES}. Anything with additional substance ("continue but
1348
- * skip tests", "go on to the next file and commit") normalizes to a string
1349
- * outside the set and returns false, so it is handled as an ordinary message.
1350
- */
1351
- declare function detectContinueIntent(raw: string): boolean;
1352
- /**
1353
- * Where the resolved continuation came from:
1354
- * - `todo` — resumed the next open todo (strongest anchor)
1355
- * - `suggestion` — took the top parsed `<nextsteps>` suggestion
1356
- * - `open` — no explicit task queued; model self-determines the step
1357
- */
1358
- type ContinuationSource = 'todo' | 'suggestion' | 'open';
1359
- interface ContinuationInput {
1360
- /** Live todo list (`ctx.todos`). */
1361
- todos?: readonly TodoItem[] | undefined;
1362
- /** Already-parsed `<nextsteps>` suggestion strings from the surface store. */
1363
- suggestions?: readonly string[] | undefined;
1364
- }
1365
- interface ResolvedContinuation {
1366
- source: ContinuationSource;
1367
- /**
1368
- * The concrete instruction injected as the next user turn in place of the
1369
- * bare "continue". Written for the model, not the human.
1370
- */
1371
- text: string;
1372
- /**
1373
- * Short one-line label for the surface to echo (dim) so the human sees what
1374
- * "continue" resolved to without the full injected paragraph.
1375
- */
1376
- label: string;
1377
- }
1378
- /**
1379
- * Resolve what a bare "continue" should do, given the current run state.
1380
- *
1381
- * The ladder — first match wins:
1382
- * 1. an open todo (in-progress preferred, else the first pending),
1383
- * 2. the top stored suggestion,
1384
- * 3. an open continuation that never dead-ends.
1385
- *
1386
- * Always returns a usable {@link ResolvedContinuation}; the `open` branch is
1387
- * the guaranteed fallback so "continue" keeps work moving even with no todos
1388
- * and no suggestions.
1389
- */
1390
- declare function resolveContinuation(input: ContinuationInput): ResolvedContinuation;
1391
-
1392
- /**
1393
- * L1-E: Autonomous continue — model-driven self-iteration continuation.
1394
- *
1395
- * In autonomous mode the model can signal "keep going without waiting for
1396
- * user input" by either:
1397
- *
1398
- * 1. **Tool call** — call `continue_to_next_iteration()` with no args.
1399
- * The tool returns `{ continue: true }` and sets
1400
- * `ctx.meta._autonomousContinue = true`. The agent loop detects this
1401
- * flag and re-runs the iteration instead of returning.
1402
- *
1403
- * 2. **Text marker** — include one of the below markers on its own line
1404
- * in the final text output (no tool call required):
1405
- *
1406
- * - `[continue]` — same as calling the tool; next iteration
1407
- * - `[next step]` — synonym for `[continue]`
1408
- * - `[proceed]` — synonym for `[continue]`
1409
- * - `[done]` — stop iterating; return to caller
1410
- *
1411
- * The parser matches `^\s*(?:\[continue\]|\[next step\]|\[proceed\]|\[done\])\s*$`
1412
- * so the marker must occupy its own line (possibly indented).
1413
- *
1414
- * Text markers are checked in `processResponse()` BEFORE the loop exit
1415
- * condition, so the model can emit `[continue]` as part of its final text
1416
- * block and the loop re-runs seamlessly.
1417
- *
1418
- * The `_autonomousContinue` flag lives in `ctx.meta` — it is cleared at
1419
- * the start of each iteration so a stale flag from a prior run cannot
1420
- * cause spurious continuation.
1421
- *
1422
- * @example
1423
- * ```typescript
1424
- * // Enable autonomous continuation on the Agent
1425
- * const agent = new Agent({
1426
- * // ... other options
1427
- * autonomousContinue: true, // enable text-marker parsing
1428
- * });
1429
- *
1430
- * // The model can now end a response with:
1431
- * // [continue]
1432
- * // and the agent will immediately start the next iteration without
1433
- * // returning to the caller.
1434
- * ```
1435
- */
1436
-
1437
- /**
1438
- * Directive emitted by the model to control the autonomous loop.
1439
- *
1440
- * `continue` — halt the current agent.run() and signal to the outer
1441
- * runner (e.g. AutonomousRunner) that it should re-invoke
1442
- * agent.run() immediately with a fresh continuation prompt.
1443
- *
1444
- * `stop` — halt and signal the outer runner to NOT continue.
1445
- * The agent.run() returns `{ status: 'done' }` as normal.
1446
- *
1447
- * `none` — no directive present; outer runner uses its own
1448
- * `doneCondition` to decide.
1449
- */
1450
- type ContinueDirective = 'continue' | 'stop' | 'none';
1451
- /**
1452
- * Parse a `ContinueDirective` from raw assistant text.
1453
- *
1454
- * Matches markers on their own line (with optional leading/trailing
1455
- * whitespace). Case-insensitive. Returns `'none'` when no marker found.
1456
- *
1457
- * The marker must be on its own line to avoid false positives — e.g.
1458
- * "remember to use [continue] in your next email" does NOT trigger it.
1459
- */
1460
- declare function parseContinueDirective(text: string): ContinueDirective;
1461
- /**
1462
- * Built-in tool that lets the model explicitly request the next iteration.
1463
- *
1464
- * When called, the agent loop detects the flag and re-runs instead of
1465
- * returning to the caller. This is the explicit counterpart to the
1466
- * `[continue]` text marker.
1467
- *
1468
- * The tool has no side effects and returns `{ continue: true }`.
1469
- */
1470
- declare function makeContinueToNextIterationTool(): Tool;
1471
-
1472
- /**
1473
- * Cross-provider fallback model extension.
1474
- *
1475
- * Lives in core so EVERY agent surface can reuse it: the CLI leader, the CLI
1476
- * director/host subagent factory, and the runtime light subagent factory (used
1477
- * by standalone SDD runs). It wraps the provider runner and, when the active
1478
- * model 429s / overloads / stream-hangs, rotates through a fallback chain. The
1479
- * chain is recomputed from live config every turn, so changes take effect
1480
- * without a restart; an empty chain makes the wrapper a no-op.
1481
- *
1482
- * Moved here from `@wrongstack/cli` (it only ever depended on core types) so the
1483
- * runtime light factory can wire fallbacks for SDD worker subagents.
1484
- */
1485
-
1486
- interface FallbackModelDeps {
1487
- /** Returns the live config (re-read each turn so `/model` switches are honored). */
1488
- getConfig: () => Config;
1489
- /**
1490
- * Builds a credential-resolved Provider for a provider id (alias-resolved),
1491
- * WITHOUT persisting anything to config/configStore. Supplied by the boot
1492
- * path, which shares this with the `/model` switch logic. May be async — the
1493
- * subagent host resolves a provider's real context window asynchronously.
1494
- */
1495
- buildProvider: (providerId: string, modelId?: string | undefined) => Provider | Promise<Provider>;
1496
- /**
1497
- * Called after the active model changes (a fallback hop or the primary
1498
- * restore) so the host can refresh the auto-compaction / context-window
1499
- * denominator — important when a fallback crosses to a smaller-window model.
1500
- */
1501
- onModelSwitch?: (providerId: string, modelId: string) => void | Promise<void>;
1502
- events: EventBus;
1503
- /** Optional — warnings about un-buildable fallback providers. */
1504
- logger?: Logger | undefined;
1505
- /**
1506
- * Base cooldown after the configured primary fails with a fallback-worthy
1507
- * error. While active, `beforeRun` leaves the context on the working fallback
1508
- * instead of retrying the primary at the start of every turn. Default: 60s.
1509
- * Set 0 to preserve the legacy "probe primary every turn" behavior.
1510
- */
1511
- primaryCooldownMs?: number | undefined;
1512
- /**
1513
- * Maximum exponential cooldown for repeated failed primary probes. Default:
1514
- * 10 minutes. Ignored when `primaryCooldownMs` is 0.
1515
- */
1516
- primaryCooldownMaxMs?: number | undefined;
1517
- /** Test hook for deterministic cooldown assertions. */
1518
- now?: (() => number) | undefined;
1519
- }
1520
- interface ModelRef {
1521
- provider?: string | undefined;
1522
- model: string;
1523
- }
1524
- /** Parse a fallback entry: `model`, `provider/model`, or `provider model`. */
1525
- declare function parseModelRef(ref: string): ModelRef;
1526
- declare function formatModelRef(ref: ModelRef, defaultProvider?: string | undefined): string;
1527
- declare function normalizeModelRef(ref: string, defaultProvider?: string | undefined): string;
1528
- declare function fallbackProfileChain(config: Config, profileName: string | undefined): string[];
1529
- /**
1530
- * Derive a fallback chain from the configured providers when the user has not
1531
- * set an explicit `fallbackModels` list. Picks declared models from every
1532
- * keyed provider — same-provider alternatives first (same key, cheapest
1533
- * failover), then cross-provider — excluding the active leader model. Returns
1534
- * `[]` when nothing usable is configured (e.g. providers with no `models`
1535
- * list), in which case the extension is a no-op.
1536
- */
1537
- declare function smartDefaultFallbackChain(config: Config): string[];
1538
- /**
1539
- * The effective fallback chain for a turn: the explicit `fallbackModels` list
1540
- * when non-empty, otherwise the smart default (unless `fallbackAuto` is off).
1541
- */
1542
- declare function effectiveFallbackChain(config: Config): string[];
1543
- /**
1544
- * Build the cross-provider fallback extension. Always returns an extension —
1545
- * the effective chain (`effectiveFallbackChain`) is recomputed every turn from
1546
- * the live config, so a chain that is empty at boot but populated later (via
1547
- * `/fallback add` or the smart default kicking in once a key is added) takes
1548
- * effect WITHOUT a restart. An empty chain makes the wrapper a no-op (it just
1549
- * rethrows the original error).
1550
- *
1551
- * Mechanism (see plan): wraps the provider runner. The inner runner already
1552
- * applies the per-model retry policy (backoff, up to 5 tries for 429), so the
1553
- * fallback only engages AFTER the active model's own retries are exhausted.
1554
- * Because the wrapper resolves within a single provider call, it does not
1555
- * consume the agent loop's `recoveryRetries` budget — chains longer than two
1556
- * entries work. `beforeRun` keeps the last working fallback while the primary
1557
- * is cooling down, then restores the configured primary for a half-open probe.
1558
- */
1559
- declare function createFallbackModelExtension(deps: FallbackModelDeps): AgentExtension;
1560
-
1561
- interface InputBuilderOptions {
1562
- store: AttachmentStore;
1563
- /**
1564
- * Pastes ≥ this many lines collapse to a `[pasted #N]` placeholder.
1565
- * Default: 8 lines.
1566
- */
1567
- pasteLineThreshold?: number | undefined;
1568
- /**
1569
- * Pastes ≥ this many characters collapse to a placeholder regardless of
1570
- * line count. Default: 2000 chars.
1571
- */
1572
- pasteCharThreshold?: number | undefined;
1573
- }
1574
- interface InputBuilderEvent {
1575
- /** Current display string (with placeholders, before submit). */
1576
- display: string;
1577
- refs: AttachmentRef[];
1578
- }
1579
- /**
1580
- * UI-agnostic accumulator for user input. The frontend (CLI/TUI) feeds in:
1581
- * - typed text via `appendText()`
1582
- * - large pastes via `appendPaste()` → returns placeholder string
1583
- * - image paste via `appendImage()` → returns placeholder string
1584
- * - file refs (`@path`) via `appendFile()` → returns placeholder string
1585
- *
1586
- * On `submit()` the builder runs the display string through AttachmentStore.expand()
1587
- * and returns the final ContentBlock[] ready for `agent.run()`.
1588
- *
1589
- * The builder does not know what a "line" or "key" is — that is the
1590
- * frontend's job. It only operates on strings and byte payloads.
1591
- */
1592
- declare class InputBuilder {
1593
- private readonly store;
1594
- private readonly pasteLineThreshold;
1595
- private readonly pasteCharThreshold;
1596
- private display;
1597
- private readonly refs;
1598
- constructor(opts: InputBuilderOptions);
1599
- get text(): string;
1600
- get attachments(): AttachmentRef[];
1601
- get isEmpty(): boolean;
1602
- appendText(text: string): void;
1603
- /**
1604
- * Decide whether a chunk of pasted text is "big" enough to collapse.
1605
- * If yes, store it and append a placeholder. If no, inline it.
1606
- * Returns the placeholder string actually appended (or `null` if inlined).
1607
- */
1608
- appendPaste(text: string): Promise<string | null>;
1609
- /**
1610
- * Always collapses to `[image #N]` — images are never inlined.
1611
- * `dataBase64` is the raw base64 payload (no data: prefix).
1612
- */
1613
- appendImage(dataBase64: string, mediaType: string): Promise<string>;
1614
- appendFile(input: AddAttachmentInput): Promise<string>;
1615
- /**
1616
- * Register-only variant of `appendPaste`. Always stores the paste and
1617
- * returns the inline `[pasted #N, L lines]` token WITHOUT mutating
1618
- * `display` — the caller (TUI) owns its own editable buffer as the single
1619
- * source of truth, inserts the token there, and expands the buffer at
1620
- * submit. The collapse decision is the caller's (it gates this call); use
1621
- * `wouldCollapse()` for that.
1622
- */
1623
- registerPaste(text: string): Promise<string>;
1624
- /**
1625
- * Register-only variant of `appendImage` — see `registerPaste`. Returns a
1626
- * seq-keyed `[image #N, LABEL]` token; does not touch `display`.
1627
- */
1628
- registerImage(dataBase64: string, mediaType: string): Promise<string>;
1629
- /**
1630
- * Register-only variant of `appendFile` — see `registerPaste`. Returns a
1631
- * path-keyed `[file:<path>]` token (resolved by path at expand time); does
1632
- * not touch `display`. The path is read from `meta.filename` (falling back
1633
- * to `meta.label`).
1634
- */
1635
- registerFile(input: AddAttachmentInput): Promise<string>;
1636
- /**
1637
- * Whether `appendPaste(text)` would collapse the text to a placeholder
1638
- * (rather than inlining it). Lets a frontend decide where to route a paste
1639
- * — e.g. collapsed pastes become a pill, while inlined ones can be shown
1640
- * in the editable input row — without calling `appendPaste` first (which
1641
- * mutates the display buffer).
1642
- */
1643
- wouldCollapse(text: string): boolean;
1644
- /** Reset display and ref list. Does NOT clear the store itself. */
1645
- reset(): void;
1646
- /**
1647
- * Resolve the current display string into ContentBlock[]. Empty
1648
- * input returns an empty array — caller decides what to do.
1649
- */
1650
- submit(): Promise<ContentBlock[]>;
1651
- private shouldCollapse;
1652
- }
1653
-
1654
- interface SystemInstructionBundle {
1655
- identity?: string | undefined;
1656
- leaderAfterTask?: string | undefined;
1657
- }
1658
- interface InstructionBundle {
1659
- version?: number | undefined;
1660
- system?: SystemInstructionBundle | undefined;
1661
- sections?: Record<string, string> | undefined;
1662
- }
1663
- interface InstructionBundlePaths {
1664
- /** Bundled instruction directory. Defaults to `<@wrongstack/core>/instructions`. */
1665
- bundledDir?: string | undefined;
1666
- /** User-global override directory, e.g. `~/.wrongstack/instructions`. */
1667
- globalDir?: string | undefined;
1668
- /** Project override directory, e.g. `<project>/.wrongstack/instructions`. */
1669
- projectDir?: string | undefined;
1670
- /** Extra override JSON files applied after projectDir, in order. */
1671
- files?: readonly string[] | undefined;
1672
- }
1673
- declare function loadInstructionBundle(paths: InstructionBundlePaths | undefined): Promise<InstructionBundle>;
1674
- declare function mergeInstructionBundle(base: InstructionBundle, override: InstructionBundle): InstructionBundle;
1675
-
1676
- /**
1677
- * mailbox-loop — Agent-loop integration for mailbox checking.
1678
- *
1679
- * Integrates the inter-agent mailbox into the agent's iteration cycle.
1680
- * Before each LLM call, checks for unread messages from subagents and other
1681
- * agents. ALL message types are injected inline so the leader sees and acts
1682
- * on them even when mid-task — subagent results, asks, assigns, and
1683
- * steer/btw are all folded into the conversation with a call to action.
1684
- *
1685
- * Uses the project-level GlobalMailbox for cross-session communication.
1686
- *
1687
- * @module mailbox-loop
1688
- */
1689
-
1690
- interface MailboxLoopOptions {
1691
- mailbox: Mailbox;
1692
- /**
1693
- * The agent's globally unique mailbox identity (e.g. `leader@a1b2c3d4`,
1694
- * session-bound). Read receipts are recorded under this id, so two
1695
- * sessions whose leaders share a base name never consume each other's
1696
- * receipts. Pass a GETTER when the identity can change at runtime (an
1697
- * in-process session swap moves the leader onto a new session tag).
1698
- */
1699
- agentId: string | (() => string);
1700
- /**
1701
- * Additional addresses this agent also answers to — typically the bare
1702
- * base id (`leader`). Lets other agents (and humans) address "leader"
1703
- * without knowing the session tag; every live leader session receives it.
1704
- */
1705
- aliases?: string[] | undefined;
1706
- /** Optional delivery predicate applied before dedup/read receipts. */
1707
- include?: ((message: MailboxMessage) => boolean) | undefined;
1708
- /** Mark returned messages as read. Defaults to true for normal delivery. */
1709
- ack?: boolean | undefined;
1710
- }
1711
- declare function createMailboxChecker(opts: MailboxLoopOptions): () => Promise<MailboxMessage[]>;
1712
- declare function buildMailboxBtwAwarenessBlock(messages: MailboxMessage[]): {
1713
- type: 'text';
1714
- text: string;
1715
- };
1716
- declare function buildMailboxBlock(messages: MailboxMessage[]): {
1717
- type: 'text';
1718
- text: string;
1719
- };
1720
- /** Result of an inject pass — signals an out-of-band control request. */
1721
- interface MailboxInjectResult {
1722
- /** A fresh `control:interrupt` message asked this agent to stop. */
1723
- interrupt: boolean;
1724
- /** Operator-supplied reason for the interrupt, if any. */
1725
- interruptReason?: string | undefined;
1726
- }
1727
- declare function injectPendingMailboxMessages(checkMailbox: () => Promise<MailboxMessage[]>, foldFn: (block: {
1728
- type: 'text';
1729
- text: string;
1730
- }) => void, a: {
1731
- events: {
1732
- emit: (type: string, payload: unknown) => void;
1733
- };
1734
- logger: {
1735
- debug?: (...args: unknown[]) => void;
1736
- };
1737
- }): Promise<MailboxInjectResult>;
1738
-
1739
- interface RunProviderOptions {
1740
- provider: Provider;
1741
- request: Request;
1742
- signal: AbortSignal;
1743
- ctx: Context;
1744
- events: EventBus;
1745
- retry: RetryPolicy;
1746
- logger: Logger;
1747
- tracer?: Tracer | undefined;
1748
- }
1749
- /**
1750
- * Call a provider with the retry policy applied. Emits `provider.retry`
1751
- * before each retry and `provider.error` once when the retries are
1752
- * exhausted. Streaming providers route through the streaming-response
1753
- * builder so deltas reach the renderer.
1754
- */
1755
- declare function runProviderWithRetry(opts: RunProviderOptions): Promise<Response>;
1756
-
1757
- /**
1758
- * Queue awareness — let the running agent *see* messages the user typed
1759
- * while it was busy, without delivering them early.
1760
- *
1761
- * The TUI queues plain messages typed mid-run and replays them as real user
1762
- * turns after the run finishes (the queue drainer in app.tsx). That keeps
1763
- * turn-taking clean, but the model is blind to the backlog: a queued message
1764
- * may invalidate the current approach, add a constraint, or just be a
1765
- * "by the way" note the user expected the agent to notice.
1766
- *
1767
- * Unlike `/btw` (a consume-once note channel, {@link ./btw.ts}), this is a
1768
- * SNAPSHOT channel: the host mirrors the queue's current contents onto the
1769
- * live `Context` on every queue mutation (enqueue, /queue delete, /queue
1770
- * clear, dequeue-for-delivery). At each iteration boundary the agent loop
1771
- * asks "did the snapshot change since the model last saw it?" and, if so,
1772
- * injects an informational block listing the pending messages. The queue
1773
- * itself is untouched — every queued message still arrives later as its own
1774
- * user turn.
1775
- *
1776
- * Deliberate quietness: when the queue transitions to empty (cleared by the
1777
- * user, drained between runs, or dropped by steering/abort) the snapshot is
1778
- * marked seen WITHOUT injecting a "queue is now empty" block. The empty
1779
- * transition usually happens at run boundaries where such a notice is stale
1780
- * noise; the cost is that a mid-run `/queue clear` isn't announced, which is
1781
- * safe because the block's framing already tells the model the queue may
1782
- * change and the authoritative messages arrive as future turns.
1783
- */
1784
-
1785
- /**
1786
- * Mirror the host's pending-message queue onto the context. Call on every
1787
- * queue mutation with the FULL current queue (head first) — not a delta.
1788
- * Blank entries are dropped; the head-most {@link MAX_ITEMS} are kept since
1789
- * the head is what arrives first.
1790
- */
1791
- declare function setQueuedMessagesSnapshot(ctx: Context, texts: string[]): void;
1792
- /** Current snapshot (previews), without affecting seen-state. */
1793
- declare function peekQueuedMessages(ctx: Context): string[];
1794
- /**
1795
- * Called by the agent loop at each iteration boundary. Returns the queued
1796
- * messages to surface when the snapshot changed since the model last saw it,
1797
- * or `null` when there is nothing new to say. Marks the snapshot seen either
1798
- * way, so the same state is never injected twice. An empty snapshot is
1799
- * acknowledged silently (see module comment).
1800
- */
1801
- declare function consumeQueuedMessagesUpdate(ctx: Context): string[] | null;
1802
- /**
1803
- * Format the awareness block. Framing goals: (1) the model must NOT treat
1804
- * the listed messages as instructions to execute now — they each arrive as
1805
- * their own turn later; (2) it SHOULD let them influence in-flight decisions
1806
- * (a queued message may invalidate the current approach or be a /btw-style
1807
- * note); (3) the list is a full replacement of any earlier notice, so a
1808
- * shrunken list implicitly communicates deletions.
1809
- */
1810
- declare function buildQueuedMessagesBlock(items: string[]): string;
1811
-
1812
- declare const LAYER_1_IDENTITY: string;
1813
- interface DefaultSystemPromptBuilderOptions {
1814
- memoryStore?: MemoryStore | undefined;
1815
- skillLoader?: SkillLoader | undefined;
1816
- /**
1817
- * How skill bodies reach the prompt. `'eager'` (default) injects every
1818
- * discovered skill body; `'progressive'` injects only a name+trigger manifest
1819
- * and relies on the agent calling the `skill` tool to load a body on demand
1820
- * (the agentskills.io progressive-disclosure model).
1821
- */
1822
- skillMode?: 'eager' | 'progressive' | undefined;
1823
- /**
1824
- * In eager mode, cap the total chars of injected skill bodies (highest-priority
1825
- * skills first); the rest become a load-on-demand manifest. Bounds prompt
1826
- * cost when many skills are discovered. Default ~24k chars.
1827
- */
1828
- skillEagerMaxChars?: number | undefined;
1829
- modeStore?: ModeStore | undefined;
1830
- /** Pre-resolved active mode id — shown in environment block. */
1831
- modeId?: string | undefined;
1832
- /** Pre-resolved mode prompt — avoids redundant modeStore.getActiveMode() call. */
1833
- modePrompt?: string | undefined;
1834
- /** Model capabilities — object snapshot or lazy getter for live model switches. */
1835
- modelCapabilities?: ModelCapabilities | (() => ModelCapabilities | undefined) | undefined;
1836
- todayIso?: string | undefined;
1837
- /**
1838
- * Path to the session's plan JSON, or a getter that returns it. When
1839
- * set, the builder reads the file on every `build()` call and injects
1840
- * an "Active plan" block listing open items, so the LLM is anchored to
1841
- * the strategic roadmap every turn — not just at resume. The block is
1842
- * tagged `ephemeral` so a plan edit on turn N doesn't invalidate the
1843
- * provider's prefix cache for earlier turns.
1844
- *
1845
- * The function form lets callers bind the builder before the session
1846
- * id is known (e.g. DI containers that resolve the builder lazily) —
1847
- * the getter is called at build-time, after the session has been
1848
- * created.
1849
- */
1850
- planPath?: string | (() => string | undefined);
1851
- /**
1852
- * System prompt contributors — called on every `build()` to inject
1853
- * additional TextBlocks. Use `ExtensionRegistry.listSystemPromptContributors()`
1854
- * or pass a plain array. Contributors are called in order; a throwing
1855
- * contributor is caught and logged without aborting the build.
1856
- */
1857
- contributors?: readonly SystemPromptContributor[] | undefined;
1858
- /**
1859
- * Token-saving mode tier. Controls how aggressively the system prompt is
1860
- * compacted: skill bodies are omitted/trimmed, tool hints are shortened,
1861
- * and optional guidance sections (delegation, mailbox, context management)
1862
- * use minimal versions to reduce per-request tokens.
1863
- *
1864
- * - 'off' — Full guidance (no reduction)
1865
- * - 'minimal' — TIER1 tools, stripped guidance
1866
- * - 'light' — TIER1 + memory tools, minimal patterns
1867
- * - 'medium' — TIER1 + TIER2 tools, some guidance
1868
- * - 'aggressive' — Maximum reduction before tools become unusable
1869
- *
1870
- * Boolean values are accepted for backward compatibility:
1871
- * - `true` → 'medium'
1872
- * - `false` → 'off'
1873
- */
1874
- tokenSavingMode?: TokenSavingTier | boolean | undefined;
1875
- /**
1876
- * File-backed instruction layers. Builtins are loaded first, then global
1877
- * overrides, then project overrides, then explicit files. This lets durable
1878
- * system instructions live outside TypeScript while keeping the builder API
1879
- * stable for embedded runtimes.
1880
- */
1881
- instructionPaths?: InstructionBundlePaths | undefined;
1882
- /**
1883
- * Last-mile in-memory overrides, applied after instructionPaths. Useful for
1884
- * tests, embedders, and plugin-provided prompt experiments.
1885
- */
1886
- instructionBundle?: InstructionBundle | undefined;
1887
- }
1888
- declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
1889
- private readonly opts;
1890
- /**
1891
- * Cached environment block, keyed by projectRoot. A single builder
1892
- * instance is normally reused across turns of the same agent run, but
1893
- * tests and library consumers may reuse it across runs with different
1894
- * roots; keying the cache prevents leaking the first call's project
1895
- * state into a later call against an unrelated project.
1896
- */
1897
- private envCacheByRoot;
1898
- private skillCache?;
1899
- /** Cached full skill bodies (after frontmatter), built once per session. */
1900
- private skillBodyCache?;
1901
- /** Tools from last build — used for memory relevance scoring. */
1902
- private _lastBuildTools?;
1903
- /** Cached rendered online agents string, keyed by content fingerprint. */
1904
- private _lastOnlineAgents?;
1905
- /** Cached full buildToolUsage output — keyed by tools array ref + agents fingerprint + tier. */
1906
- private _toolsUsageCache?;
1907
- private _instructionBundle?;
1908
- constructor(opts?: DefaultSystemPromptBuilderOptions);
1909
- /**
1910
- * Normalizes `tokenSavingMode` to a boolean for backward-compatible boolean checks.
1911
- * - `undefined` / `false` / `'off'` → false
1912
- * - `true` / any tier string other than `'off'` → true
1913
- *
1914
- * Note: invalid tier strings (e.g. "MINIMAL") are coerced to 'off'
1915
- * by `normalizeTokenSavingTier` via the `tier` getter, so isCompact
1916
- * correctly returns false for them — preventing isCompact/tier
1917
- * disagreement on bad input.
1918
- */
1919
- private get isCompact();
1920
- /** Exposes the normalized `TokenSavingTier` for tier-aware guidance decisions. */
1921
- private get tier();
1922
- /**
1923
- * Returns the max tool description length for the current tier.
1924
- * Per the design doc: off=80, minimal=40, light=50, medium=60, aggressive=70.
1925
- */
1926
- private toolDescLimit;
1927
- build(ctx: BuildContext): Promise<TextBlock[]>;
1928
- buildRegions(ctx: BuildContext): Promise<SystemPromptRegions>;
1929
- private instructions;
1930
- private instructionSection;
1931
- /**
1932
- * Cached plan content keyed by (planPath, mtimeMs). The plan is read
1933
- * once per system-prompt build; most turns don't change the plan, so
1934
- * this avoids a blocking fs.readFile + JSON.parse on every iteration.
1935
- * Cleared when the file's mtime changes (the `/plan` tool mutated it).
1936
- */
1937
- private _planCache?;
1938
- /**
1939
- * Reads the session-scoped plan sidecar (when configured) and produces
1940
- * a short "Active plan" block listing open items so the model is
1941
- * anchored to the strategic roadmap every turn. Reads on every `build()`
1942
- * so a plan edit (via `/plan` or the `plan` tool) reflects on the next
1943
- * turn without restarting the session.
1944
- */
1945
- private buildActivePlan;
1946
- private _formatPlan;
1947
- private buildToolUsage;
1948
- private renderToolSelectionBoundary;
1949
- /**
1950
- * Cheap content fingerprint of the online agents array. The mailbox
1951
- * rebuilds the array as a fresh object on every status check, so caching
1952
- * by reference always misses — this lets the renderOnlineAgents and
1953
- * buildToolUsage caches detect membership changes instead.
1954
- *
1955
- * O(n) over agent names with no per-element string concatenation. Uses
1956
- * FNV-1a over character codes so two different agent sets collide only
1957
- * if they produce the identical sequence of name characters — astronomically
1958
- * unlikely. A collision would produce a stale agent list in the prompt,
1959
- * a cosmetic issue, not a correctness bug.
1960
- */
1961
- private agentsFingerprint;
1962
- /**
1963
- * Render the online agents list, cached by content fingerprint. The agents
1964
- * list changes at join/leave pace (seconds to minutes), not every prompt
1965
- * build turn (hundreds of ms). The fingerprint detects membership changes
1966
- * without holding the array reference — the mailbox rebuilds the array as
1967
- * a fresh object on every status check, so reference equality always misses.
1968
- *
1969
- * Tier behaviour:
1970
- * - 'off' / 'medium' / 'aggressive' → full list with names, sessions, sources
1971
- * - 'minimal' / 'light' → count only (no list)
1972
- */
1973
- private renderOnlineAgents;
1974
- private buildEnvironment;
1975
- private modelCapabilities;
1976
- private buildMemoryAndSkills;
1977
- /**
1978
- * Build the progressive-disclosure manifest: list each skill's name + trigger
1979
- * only and instruct the agent to call the `skill` tool to load a body. No
1980
- * bodies are injected — the agent pulls them on demand (agentskills.io tier 2).
1981
- */
1982
- private buildProgressiveSkillManifest;
1983
- /** Build full skill bodies (token-saving OFF), bounded by an overall budget. */
1984
- private buildFullSkillBodies;
1985
- /**
1986
- * Build compact skill bodies for token-saving mode.
1987
- * Uses `readSaveBody` from the skill loader which tries `SKILL.save.md`
1988
- * first, then falls back to auto-compaction.
1989
- */
1990
- private buildCompactSkillBodies;
1991
- private buildMode;
1992
- private dirExists;
1993
- private gitStatus;
1994
- private detectLanguages;
1995
- }
1996
-
1997
- /**
1998
- * Token estimate for a message array (text + tool I/O). Re-exported from the
1999
- * canonical `token-estimate` helper so compactors and the context-pressure
2000
- * monitor share one number.
2001
- */
2002
- declare const estimateMessages: typeof estimateMessageTokens;
2003
- /**
2004
- * Shared, pure compaction primitives.
2005
- *
2006
- * Before this module the three compactors (`HybridCompactor`,
2007
- * `IntelligentCompactor`, `SelectiveCompactor`) each carried their own copies
2008
- * of message-token estimation, tool-result elision, text detection and digest
2009
- * rendering — with subtle divergences (notably Selective lacked the
2010
- * tool_use/tool_result pair preservation, so it could elide the result of a
2011
- * tool call it was supposed to keep). These helpers are the single source of
2012
- * truth. They operate on plain `Message[]` and never touch `Context`/state, so
2013
- * each compactor keeps its own `ctx.state.replaceMessages(...)` plumbing.
2014
- */
2015
- /** Does this message carry any non-empty text? */
2016
- declare function hasTextContent(m: Message): boolean;
2017
- /**
2018
- * Index where the preserved (recent) window starts. Walks back counting
2019
- * user/assistant messages until `preserveK` are covered, then walks forward to
2020
- * keep any tool_use/tool_result protocol pair intact — so a tool_result whose
2021
- * tool_use is preserved is never elided.
2022
- *
2023
- * Instrumentation: emits `compaction.find_preserve_start.ended` with the
2024
- * repair-loop block count so we can track whether protocol-pair repair is
2025
- * scanning too much content.
2026
- */
2027
- declare function findPreserveStart(messages: readonly Message[], preserveK: number): number;
2028
- interface EliseResult {
2029
- /** New message array, or the same reference when nothing changed. */
2030
- messages: Message[];
2031
- /** Estimated tokens reclaimed. */
2032
- saved: number;
2033
- changed: boolean;
2034
- }
2035
- /**
2036
- * Elide oversized tool I/O that falls before the preserve window. Pure:
2037
- * returns a fresh array (or the same reference when unchanged). Replaces the
2038
- * duplicate copies that lived in all three compactors.
2039
- */
2040
- declare function eliseOldToolResults(messages: readonly Message[], opts: {
2041
- preserveK: number;
2042
- eliseThreshold: number;
2043
- }): EliseResult;
2044
- /**
2045
- * Lossless textual digest of a message range. Every text block is kept verbatim
2046
- * (across all roles, so prior `system` digests fold forward and nothing
2047
- * accumulates as loss). `tool_use` / `tool_result` blocks are counted and
2048
- * replaced with a marker rather than serialized — their payload is already
2049
- * persisted in the session log. Empty/tool-only messages are skipped.
2050
- */
2051
- declare function buildLosslessDigest(messages: readonly Message[]): string;
2052
- /** Importance score for a message — drives retention vs. summarization. */
2053
- type ContentScore = 0 | 1 | 2 | 3 | 4 | 5;
2054
- /**
2055
- * Extract the plain text from a message (ignoring tool blocks).
2056
- * Returns empty string if no text content exists.
2057
- */
2058
- declare function extractText(m: Message): string;
2059
- /**
2060
- * Score a message by content importance.
2061
- *
2062
- * CRITICAL (5): user corrections, explicit "no/wrong/stop", error messages,
2063
- * architecture decisions, security findings.
2064
- * MEDIUM (3): normal exchanges, successful tool calls, file reads, edits.
2065
- * LOW (1): large tool results (>3K chars), grep/file-list outputs, boilerplate.
2066
- * NOISE (0): repeated identical failures (same tool, same error, 5th+ occurrence
2067
- * within the range), pure tool I/O with no text.
2068
- */
2069
- declare function scoreMessage(m: Message, context?: {
2070
- failureCounts?: Map<string, number>;
2071
- }): ContentScore;
2072
- /**
2073
- * Build a content-aware digest of messages.
2074
- *
2075
- * Unlike `buildLosslessDigest` which preserves all text equally, this uses
2076
- * `scoreMessage` to apply tiered treatment:
2077
- * - Score 5 (critical): verbatim text
2078
- * - Score 3 (medium): first sentence only
2079
- * - Score 1 (low): one-line summary
2080
- * - Score 0 (noise): collapsed to count marker
2081
- */
2082
- declare function buildSmartDigest(messages: readonly Message[]): string;
2083
-
2084
- interface ShellHookSpec {
2085
- command: string;
2086
- timeoutMs?: number | undefined;
2087
- }
2088
- /**
2089
- * Run a shell hook (Claude-compatible). The `HookInput` JSON is written to the
2090
- * command's stdin. Resolution rules, in order:
2091
- * - exit code 2 → `{ decision: 'block', reason: <stderr or stdout> }`
2092
- * - stdout parses as a JSON object → returned verbatim as a `HookOutcome`
2093
- * - otherwise → no-op (`null`)
2094
- *
2095
- * The hook never throws into the agent loop: spawn errors and timeouts resolve
2096
- * to `null` and are logged. Output is capped at 64 KiB.
2097
- */
2098
- declare function runShellHook(spec: ShellHookSpec, input: HookInput, logger?: Logger | undefined): Promise<HookOutcome | null>;
2099
-
2100
- /**
2101
- * Helpers for comparing and counting shell-hook configurations.
2102
- * Used by the hot-reload path: the `ConfigStore` watcher fires on every
2103
- * `configStore.update` call (model, log level, anything), so we need a
2104
- * cheap predicate to decide whether `config.hooks` actually changed before
2105
- * re-running `replaceShellHooks`.
2106
- *
2107
- * Pure functions — no I/O, no logger, no side effects. Safe to import
2108
- * from anywhere.
2109
- */
2110
-
2111
- declare function shellHooksEqual(a: Partial<Record<HookEvent, ConfiguredHook[]>> | undefined, b: Partial<Record<HookEvent, ConfiguredHook[]>> | undefined): boolean;
2112
- /** Count the total number of shell-hook entries across all events. */
2113
- declare function countShellHooks(hooks: Partial<Record<HookEvent, ConfiguredHook[]>> | undefined): number;
2114
-
2115
- /**
2116
- * Minimal interface exposing the Agent fields that the extracted
2117
- * loop / tool-execution / response modules need. Each extracted
2118
- * function takes this interface instead of the full Agent class,
2119
- * keeping coupling explicit and testable.
2120
- */
2121
- interface AgentInternals {
2122
- readonly container: Container;
2123
- readonly tools: ToolRegistry;
2124
- readonly providers: ProviderRegistry;
2125
- readonly events: EventBus;
2126
- readonly pipelines: AgentPipelines;
2127
- readonly ctx: Context;
2128
- readonly maxIterations: number;
2129
- readonly executionStrategy: 'parallel' | 'sequential' | 'smart';
2130
- readonly perIterationOutputCapBytes: number;
2131
- readonly autoExtendLimit: boolean;
2132
- readonly loopDetection: ResolvedLoopDetectionConfig;
2133
- readonly toolExecutor: ToolExecutorLike;
2134
- readonly extensions: ExtensionRegistry;
2135
- readonly logger: Logger;
2136
- readonly retry: RetryPolicy;
2137
- readonly errorHandler: ErrorHandler;
2138
- readonly permission: PermissionPolicy;
2139
- readonly renderer: Renderer | undefined;
2140
- readonly tracer: Tracer | undefined;
2141
- }
2142
-
2143
- /**
2144
- * mailbox-attach — composition glue for the agent-loop mailbox checker.
2145
- *
2146
- * Lives at the src root (composition layer) because it constructs the
2147
- * concrete GlobalMailbox from coordination/ and hands the resulting
2148
- * checker to core/ — core/ itself may only depend on the Mailbox
2149
- * interface (architecture Rule 3, see tests/architecture/
2150
- * package-boundaries.test.ts).
2151
- *
2152
- * @module mailbox-attach
2153
- */
2154
-
2155
- declare function attachMailboxChecker(a: AgentInternals, source?: 'cli' | 'webui'): () => Promise<MailboxMessage[]>;
2156
-
2157
- /**
2158
- * collabPauseMiddleware — gates the agent's `toolCall` pipeline on
2159
- * the collaboration pause signal.
2160
- *
2161
- * Position: must be installed as the *first* middleware in the
2162
- * `toolCall` pipeline so it runs before permission checks, retries,
2163
- * and the tool itself. That way the controller can halt an agent
2164
- * regardless of what the model is about to do.
2165
- *
2166
- * Semantics:
2167
- * - When the bus is not paused: pass through (`next()`).
2168
- * - When the bus is paused: await `bus.waitForResume(timeoutMs)`.
2169
- * The default timeout is 60s — long enough for a human to think,
2170
- * short enough that a forgotten controller doesn't pin the agent
2171
- * forever. The auto-resume on timeout is logged below.
2172
- *
2173
- * Phase 3 of idea #13. Manual tool-call injection (a controller
2174
- * "writing" a tool result) is *not* in scope for this middleware —
2175
- * that requires splicing the injected result into the agent's
2176
- * message stream and is a follow-up.
2177
- */
2178
- interface CollabPauseMiddlewareOptions {
2179
- /**
2180
- * How long to wait for a resume before auto-resuming the bus.
2181
- * Defaults to 60_000 ms. Set to 0 for an unbounded wait (the
2182
- * caller is then responsible for cancellation via the bus itself).
2183
- */
2184
- defaultTimeoutMs?: number | undefined;
2185
- /**
2186
- * Optional logger — receives a debug line on pause entry and on
2187
- * timeout-driven auto-resume. Matches the `Logger` token surface
2188
- * so the runtime can pass its existing logger.
2189
- */
2190
- logger?: {
2191
- debug?: ((msg: string) => void) | undefined;
2192
- warn?: ((msg: string) => void) | undefined;
2193
- };
2194
- }
2195
- declare function collabPauseMiddleware(bus: CollaborationBus, opts?: CollabPauseMiddlewareOptions): Middleware<ToolCallPipelinePayload>;
2196
- /**
2197
- * collabInjectMiddleware — Phase 4 of idea #13. Splices
2198
- * controller-injected tool results into the toolCall pipeline.
2199
- *
2200
- * Position: should run AFTER `collabPauseMiddleware` so the
2201
- * controller has a chance to pause + inject before the next tool
2202
- * executes. Install order:
2203
- * - `pipeline.toolCall.prepend(collabInject)`
2204
- * - `pipeline.toolCall.prepend(collabPause)` // runs first
2205
- *
2206
- * Semantics:
2207
- * - On every tool call, the middleware asks the bus for an
2208
- * injection matching `payload.toolUse.id`.
2209
- * - If one is queued, the payload's `result` is overwritten with
2210
- * a synthetic ToolResultBlock carrying the injected content +
2211
- * `is_error` flag. The real `next()` is NOT called; downstream
2212
- * middleware sees the controller's synthetic result.
2213
- * - The injection is consumed once and removed from the bus.
2214
- *
2215
- * Why this shape: the agent loop's existing `tool.executed` event still
2216
- * fires (carrying the injected content), so the session log + observers see
2217
- * a normal-looking call — just with the controller's intent in the result.
2218
- */
2219
- declare function collabInjectMiddleware(bus: CollaborationBus, opts?: {
2220
- logger?: {
2221
- debug?: ((msg: string) => void) | undefined;
2222
- warn?: ((msg: string) => void) | undefined;
2223
- };
2224
- }): Middleware<ToolCallPipelinePayload>;
2225
-
2226
- declare class SlashCommandRegistry {
2227
- private readonly cmds;
2228
- /**
2229
- * Register a command.
2230
- *
2231
- * Trust tiers, by `owner` and `opts.official`:
2232
- *
2233
- * - **Built-ins** (`owner === 'core'`) and **official plugins**
2234
- * (`opts.official === true`, set by the host only for first-party plugins
2235
- * loaded from the built-in factory list) claim the **bare** command name
2236
- * (`/prompts`). They may override one another — last write wins — so an
2237
- * official plugin can replace a built-in. Official plugins are *also*
2238
- * reachable under their `owner:name` namespace.
2239
- * - **External plugins** (any other `owner`) are isolated under the
2240
- * `owner:name` namespace: invocable only as `/owner:cmd`, never by bare
2241
- * name, and unable to shadow or override a built-in or official command.
2242
- *
2243
- * Officiality is supplied by the host based on the plugin's load source, not
2244
- * self-declared by the plugin — an external plugin cannot name itself into
2245
- * the official tier.
2246
- */
2247
- register(cmd: SlashCommand, owner?: string, opts?: {
2248
- official?: boolean | undefined;
2249
- }): void;
2250
- unregister(name: string): boolean;
2251
- /**
2252
- * Bulk-register multiple slash commands at once.
2253
- */
2254
- registerAll(cmds: SlashCommand[], owner?: string): void;
2255
- get(name: string): SlashCommand | undefined;
2256
- ownerOf(name: string): string | undefined;
2257
- list(): SlashCommand[];
2258
- listWithOwner(): Array<{
2259
- cmd: SlashCommand;
2260
- owner: string;
2261
- fullName: string;
2262
- }>;
2263
- /**
2264
- * Parse a slash command line. Accepts both:
2265
- * `/cmd args` → builtin command (owner=core)
2266
- * `/pluginName:cmd args` → plugin command
2267
- * The command name is split at the first `:` if the prefix matches a known owner.
2268
- */
2269
- dispatch(line: string, ctx: Context): Promise<{
2270
- exit?: boolean | undefined;
2271
- message?: string | undefined;
2272
- runText?: string | undefined;
2273
- metadata?: Record<string, unknown>;
2274
- } | null>;
2275
- }
2276
-
2277
- interface PluginAPIInit {
2278
- ownerName: string;
2279
- container: Container;
2280
- events: EventBus;
2281
- /**
2282
- * The agent's concrete pipelines. `DefaultPluginAPI` converts each to a
2283
- * `ReadonlyPipeline` before exposing them to the plugin — plugins can
2284
- * inspect and invoke pipelines but cannot mutate them.
2285
- */
2286
- pipelines: PluginPipelines;
2287
- toolRegistry: ToolRegistry;
2288
- providerRegistry: ProviderRegistry;
2289
- slashCommandRegistry?: SlashCommandRegistry | undefined;
2290
- mcpRegistry?: MCPRegistryView | undefined;
2291
- /**
2292
- * The agent's extension registry. Plugins register AgentExtension
2293
- * instances here to hook into agent lifecycle events.
2294
- */
2295
- extensions?: ExtensionRegistry | undefined;
2296
- /**
2297
- * The host's lifecycle hook registry. When provided, `api.registerHook`
2298
- * adds in-process hooks here. When absent, `registerHook` is a noop.
2299
- */
2300
- hookRegistry?: HookRegistry | undefined;
2301
- /**
2302
- * The active session writer. Plugins append custom events here.
2303
- * When not provided, a noop writer is used.
2304
- */
2305
- sessionWriter?: SessionWriterView | undefined;
2306
- /**
2307
- * The host's metrics sink. When set, the plugin gets a scoped view
2308
- * that auto-prefixes metric names with `plugin.<pluginName>.`.
2309
- * When not provided, a noop sink is used.
2310
- */
2311
- metricsSink?: MetricsSinkView | undefined;
2312
- /**
2313
- * The host's models registry (models.dev-backed catalog of providers,
2314
- * models, and per-token pricing). When provided, plugins that need
2315
- * model metadata (cost-tracker, billing reports) can query it instead
2316
- * of relying on bundled tables. Optional — minimal hosts/tests may
2317
- * omit it.
2318
- */
2319
- modelsRegistry?: ModelsRegistry | undefined;
2320
- /**
2321
- * The host's project-level mailbox. When provided, plugins that publish
2322
- * to other agents (todo-listener, session-recap) can call `api.mailbox.send`.
2323
- * When not provided, those plugins should gracefully no-op.
2324
- */
2325
- mailbox?: Mailbox | undefined;
2326
- /**
2327
- * LLM wiring for `api.llm`. When provided, `DefaultPluginAPI` exposes a
2328
- * `PluginLLM` that routes completions through the host's provider layer:
2329
- *
2330
- * - `provider` — the host session's live default Provider instance
2331
- * - `model` — the host session's default model id
2332
- * - `createProvider` — optional factory used when a plugin requests a
2333
- * DIFFERENT provider by name (per-call `opts.provider` or the plugin's
2334
- * `config.extensions[<name>].llm.provider`). The CLI host passes an
2335
- * implementation backed by the provider registry + saved provider
2336
- * configs; when absent, `DefaultPluginAPI` falls back to
2337
- * `providerRegistry.create({ ...config.providers[name], type: name })`.
2338
- *
2339
- * Omit entirely on minimal hosts — `api.llm` stays undefined and plugins
2340
- * must guard.
2341
- */
2342
- llm?: {
2343
- provider: Provider;
2344
- model: string;
2345
- createProvider?: ((name: string, model?: string) => Provider) | undefined;
2346
- } | undefined;
2347
- config: Config;
2348
- /**
2349
- * The host's ConfigStore. Used to wire `api.onConfigChange()`.
2350
- * When not provided, `onConfigChange` is a noop.
2351
- */
2352
- configStore?: {
2353
- watch(cb: (next: unknown, prev: unknown) => void): () => void;
2354
- };
2355
- log: Logger;
2356
- /**
2357
- * Whether this plugin is first-party ("official"). Set by the host based on
2358
- * the plugin's load source (e.g. shipped in the built-in factory list), NOT
2359
- * self-declared by the plugin. Official plugins may register bare slash
2360
- * command names and override built-ins; external plugins are namespaced.
2361
- * Defaults to false.
2362
- */
2363
- official?: boolean | undefined;
2364
- /**
2365
- * Declared capabilities of the plugin. Used for capability-based
2366
- * authorization checks (e.g. tool mutation permissions).
2367
- */
2368
- capabilities?: PluginCapabilities | undefined;
2369
- }
2370
- declare class DefaultPluginAPI implements PluginAPI {
2371
- readonly container: Container;
2372
- readonly events: EventBus;
2373
- readonly pipelines: PluginPipelines;
2374
- readonly tools: ToolRegistryView;
2375
- readonly providers: ProviderRegistryView;
2376
- readonly mcp: MCPRegistryView;
2377
- readonly slashCommands: SlashCommandRegistryView;
2378
- readonly extensions: ExtensionRegistry;
2379
- readonly session: SessionWriterView;
2380
- readonly metrics: MetricsSinkView;
2381
- readonly config: Config;
2382
- readonly log: Logger;
2383
- readonly modelsRegistry: ModelsRegistry | undefined;
2384
- readonly mailbox: Mailbox | undefined;
2385
- readonly llm: PluginLLM | undefined;
2386
- private readonly configStore;
2387
- private readonly hookRegistry;
2388
- private readonly ownerName;
2389
- private readonly pluginCleanupFns;
2390
- constructor(init: PluginAPIInit);
2391
- onEvent<K extends EventName>(event: K, handler: Listener<K>): () => void;
2392
- onPattern(pattern: string, handler: (event: string, payload: unknown) => void): () => void;
2393
- emitCustom(event: string, payload: unknown): void;
2394
- onConfigChange(handler: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
2395
- /** Called by the plugin loader when uninstalling the plugin. */
2396
- drainCleanup(): void;
2397
- registerSystemPromptContributor(c: SystemPromptContributor): () => void;
2398
- registerHook(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, options?: HookRegistrationOptions | undefined): () => void;
2399
- }
2400
- /**
2401
- * Define a plugin with automatic `apiVersion` injection and optional
2402
- * TypeScript type inference for the plugin options schema.
2403
- *
2404
- * The `options` generic is inferred from the `factory` function's second
2405
- * parameter, so annotating it gives you fully-typed options throughout:
2406
- *
2407
- * @example
2408
- * ```ts
2409
- * import { definePlugin } from '@wrongstack/core';
2410
- *
2411
- * interface MyOptions {
2412
- * threshold: number;
2413
- * enabled: boolean;
2414
- * }
2415
- *
2416
- * const myPlugin = definePlugin(
2417
- * {
2418
- * name: 'my-plugin',
2419
- * version: '0.1.0',
2420
- * description: 'My example plugin',
2421
- * capabilities: { tools: true },
2422
- * configSchema: {
2423
- * type: 'object',
2424
- * properties: {
2425
- * threshold: { type: 'number', default: 100 },
2426
- * enabled: { type: 'boolean', default: true },
2427
- * },
2428
- * },
2429
- * defaultConfig: { threshold: 100, enabled: true },
2430
- * },
2431
- * (api, options) => {
2432
- * // options.threshold is `number` here, not `unknown`
2433
- * api.tools.register({
2434
- * name: 'my-tool',
2435
- * description: `Threshold is ${options.threshold}`,
2436
- * // ...
2437
- * });
2438
- * },
2439
- * );
2440
- *
2441
- * export default myPlugin;
2442
- * ```
2443
- *
2444
- * Plugins that don't need typed options can omit the interface and let
2445
- * TypeScript infer from `defaultConfig`, or omit `defaultConfig` entirely
2446
- * (options will be `undefined` at runtime, accessible via `api.config`):
2447
- *
2448
- * @example
2449
- * ```ts
2450
- * const simplePlugin = definePlugin(
2451
- * { name: 'simple' },
2452
- * (api) => {
2453
- * api.tools.register({ name: 'ping', description: 'Ping the service' });
2454
- * },
2455
- * );
2456
- * ```
2457
- *
2458
- * The `apiVersion` is automatically set to the current `KERNEL_API_VERSION`
2459
- * so plugins are always compatible with the kernel that loaded them.
2460
- * Plugins that need to pin to a specific kernel version can override it
2461
- * in the returned object before exporting.
2462
- */
2463
- declare function definePlugin<const TOptions extends Record<string, unknown> | undefined>(metadata: {
2464
- name: string;
2465
- version?: string | undefined;
2466
- description?: string | undefined;
2467
- capabilities?: PluginCapabilities | undefined;
2468
- configSchema?: JSONSchema | undefined;
2469
- defaultConfig?: TOptions | undefined;
2470
- dependsOn?: (string | PluginDependency)[] | undefined;
2471
- optionalDeps?: (string | PluginDependency)[] | undefined;
2472
- conflictsWith?: string[] | undefined;
2473
- }, factory: (api: PluginAPI, options: TOptions) => void | Promise<void>): {
2474
- name: string;
2475
- version?: string | undefined;
2476
- description?: string | undefined;
2477
- apiVersion: string;
2478
- capabilities?: PluginCapabilities | undefined;
2479
- configSchema?: JSONSchema | undefined;
2480
- defaultConfig?: TOptions | undefined;
2481
- dependsOn?: (string | PluginDependency)[] | undefined;
2482
- optionalDeps?: (string | PluginDependency)[] | undefined;
2483
- conflictsWith?: string[] | undefined;
2484
- setup: (api: PluginAPI) => void | Promise<void>;
2485
- };
2486
-
2487
- /**
2488
- * Stable plugin API contract version. This is intentionally independent of
2489
- * the package version: bump only when the surface visible to plugins
2490
- * (PluginAPI, types/plugin) changes in a way that breaks existing setup
2491
- * functions. Plugins declare `apiVersion: "^1.0"` to opt into this contract.
2492
- *
2493
- * 0.1.9: additive — `FleetSpawnBudgetError|FleetCostCapError` plus `FLEET_ROSTER` and the
2494
- * pre-built fleet agent configs (Audit Log, Bug Hunter, Refactor Planner,
2495
- * Security Scanner) now exported from `@wrongstack/core`.
2496
- * 0.1.10: additive — extended-thinking stream events, core subpath
2497
- * exports, tool output size chips on `tool.executed`. Plugin contract
2498
- * unchanged otherwise; 0.1.x range still loads cleanly.
2499
- *
2500
- * Note: the package shipped as 0.2.0, but the *plugin contract* didn't
2501
- * change in a breaking way — `SubagentError`, `subagent.tool_executed`,
2502
- * `transcriptPath`, `planTool`, `delegate`, `runText`, and Director
2503
- * sessionWriter are all additive to the surface. We deliberately keep
2504
- * the kernel API at 0.1.10 so plugins pinning `apiVersion: "^0.1"`
2505
- * keep loading. Bump to 1.0 when we stabilize and want the freedom to
2506
- * remove deprecated surfaces.
2507
- */
2508
- declare const KERNEL_API_VERSION = "0.1.10";
2509
- interface LoadPluginsOptions {
2510
- apiFactory: (plugin: Plugin) => PluginAPI;
2511
- log: Logger;
2512
- kernelApiVersion?: string | undefined;
2513
- /**
2514
- * Per-plugin options keyed by plugin name. When a plugin declares
2515
- * `configSchema`, the loader validates `pluginOptions[plugin.name]`
2516
- * against it before calling `setup`. Pass `Config.plugins` shaped
2517
- * `{ [name]: { options } }` or any flat record.
2518
- */
2519
- pluginOptions?: Record<string, unknown>;
2520
- /**
2521
- * When true, the loader throws a PluginError if a plugin calls an API
2522
- * method that contradicts its declared `capabilities` — instead of
2523
- * just logging a warning. Use in CI/strict deployments to enforce
2524
- * manifest honesty. Default: false (log-only, backward-compatible).
2525
- */
2526
- enforceCapabilities?: boolean | undefined;
2527
- /**
2528
- * Timeout in milliseconds for each plugin's `setup()` call. If the
2529
- * plugin's setup exceeds this deadline it is treated as a failure
2530
- * and the plugin is not loaded. Default: 30 000 ms.
2531
- */
2532
- setupTimeoutMs?: number | undefined;
2533
- /**
2534
- * Timeout in milliseconds for each plugin's `teardown()` call. If the
2535
- * plugin's teardown exceeds this deadline it is treated as a best-effort
2536
- * failure (logged but not propagated). Default: 10 000 ms.
2537
- */
2538
- teardownTimeoutMs?: number | undefined;
2539
- }
2540
- declare function loadPlugins(plugins: Plugin[], opts: LoadPluginsOptions): Promise<{
2541
- loaded: Plugin[];
2542
- failed: {
2543
- plugin: Plugin;
2544
- err: unknown;
2545
- }[];
2546
- }>;
2547
- /**
2548
- * Tear down loaded plugins in reverse-dependency order. `teardown()` is
2549
- * best-effort: errors are caught and logged so a single misbehaving plugin
2550
- * can't abort the host shutdown sequence.
2551
- *
2552
- * Pass the result of a prior `loadPlugins(...)` call's `loaded` array, plus
2553
- * the original `LoadPluginsOptions` so the same `apiFactory` (and the same
2554
- * PluginAPI surface the plugin saw during `setup`) is used for `teardown`.
2555
- */
2556
- declare function unloadPlugins(loadedPlugins: Plugin[], opts: LoadPluginsOptions): Promise<void>;
2557
-
2558
- interface ChimeraConfig {
2559
- enabled?: boolean | undefined;
2560
- provider?: string | undefined;
2561
- model?: string | undefined;
2562
- maxFiles?: number | undefined;
2563
- /**
2564
- * @deprecated Removed. The subagent's `Request.maxTokens` now defaults to
2565
- * the provider's `capabilities.maxOutput`, so Chimera reports can run up
2566
- * to the selected model's native ceiling. Kept on the config interface as an `unknown` sink
2567
- * so old config files don't crash — but it's no longer read.
2568
- */
2569
- maxTokens?: unknown;
2570
- }
2571
- interface ResolvedChimeraConfig {
2572
- enabled: boolean;
2573
- provider: string;
2574
- model: string;
2575
- maxFiles: number;
2576
- }
2577
- declare function resolveChimeraConfig(cfg: ChimeraConfig, sessionProvider: string, sessionModel: string): ResolvedChimeraConfig;
2578
- interface ChimeraReviewNeededPayload {
2579
- /** Resolved chimera config */
2580
- config: ResolvedChimeraConfig;
2581
- /** Project root for git operations */
2582
- cwd: string;
2583
- /** Changed files with their contents */
2584
- files: Array<{
2585
- path: string;
2586
- status: 'added' | 'modified';
2587
- content: string;
2588
- }>;
2589
- }
2590
- declare const CHIMERA_REVIEW_PROMPT: string;
2591
- declare function createChimeraPlugin(): Plugin;
2592
-
2593
- /**
2594
- * GitPlugin — built-in git helpers.
2595
- *
2596
- * Registers `/commit`, `/gitcheck` and `/push`. First-party ("official")
2597
- * plugin, so the commands keep their bare names and `gc` / `gcstatus` aliases.
2598
- * `/commit` generates an LLM commit message from the session provider when one
2599
- * is available, falling back to diff heuristics. No configuration required.
2600
- */
2601
- declare function createGitPlugin(): Plugin;
2602
-
2603
- interface ObservabilityPluginOptions {
2604
- metricsSink?: MetricsSink | undefined;
2605
- healthRegistry?: HealthRegistry | undefined;
2606
- }
2607
- /**
2608
- * ObservabilityPlugin — runtime metrics + health checks.
2609
- *
2610
- * Registers `/metrics` and `/health`. First-party ("official") plugin, so the
2611
- * commands keep their bare names. Both require the host to have started the
2612
- * metrics subsystem (`--metrics`); without it they report that and no-op.
2613
- */
2614
- declare function createObservabilityPlugin(opts?: ObservabilityPluginOptions): Plugin;
2615
-
2616
- interface PlanPluginOptions {
2617
- paths?: WstackPaths | undefined;
2618
- }
2619
- /**
2620
- * PlanPlugin — strategic plan board (`/plan`), the higher-level counterpart to
2621
- * `/todos`. First-party ("official") plugin, so the command keeps its bare
2622
- * name. Plans persist to `<projectDir>/plan.json` (from the injected
2623
- * `WstackPaths`); the live context is read off `ctx` at dispatch.
2624
- */
2625
- declare function createPlanPlugin(opts?: PlanPluginOptions): Plugin;
2626
-
2627
- interface PromptsPluginOptions {
2628
- store?: DefaultPromptStore | undefined;
2629
- loader?: PromptLoader | undefined;
2630
- usage?: PromptUsageStore | undefined;
2631
- paths?: WstackPaths | undefined;
2632
- }
2633
- /**
2634
- * PromptsPlugin — built-in prompt library.
2635
- *
2636
- * Registers three slash commands:
2637
- * - `/prompts` manage your library (list/view/add/edit/delete/favorite/extend)
2638
- * - `/prompt` search the merged library (builtin + user + project) and insert
2639
- * - `/prompt-gen` AI-guided authoring of a new high-quality prompt
2640
- *
2641
- * Active by default for all WrongStack sessions. The host injects a
2642
- * `PromptLoader` (cross-layer read + copy-on-write) via `config.promptLoader`;
2643
- * without one the commands degrade to the writable user store only.
2644
- */
2645
- declare function createPromptsPlugin(opts?: PromptsPluginOptions): Plugin;
2646
-
2647
- /**
2648
- * SecurityPlugin — automated security scanning back-end.
2649
- *
2650
- * Exposes the LLM-powered `defaultOrchestrator` programmatically. The
2651
- * synchronous TUI surface is owned by the CLI built-in
2652
- * `packages/cli/src/slash-commands/security.ts` (`/security audit-deps |
2653
- * scan | redact-test | help`), which intentionally does NOT invoke the
2654
- * orchestrator — slash commands run on a sync surface and a full scan
2655
- * takes minutes. To run a real scan, dispatch a subagent from the TUI
2656
- * (`/security scan` prints the dispatch instructions).
2657
- *
2658
- * Do NOT register a `/security` slash command here — it would shadow the
2659
- * CLI built-in and leave users staring at a silent prompt while an
2660
- * LLM scan hangs in the background. The `createSecuritySlashCommand`
2661
- * factory remains exported for programmatic/test use only.
2662
- */
2663
- declare function createSecurityPlugin(): Plugin;
2664
-
2665
- interface SkillsPluginOptions {
2666
- skillLoader?: SkillLoader | undefined;
2667
- /**
2668
- * Registry adapters. When unset the plugin wires the github-direct adapter
2669
- * (for `user/repo` installs) plus a skills.sh adapter pointed at
2670
- * `config.skills.registryUrl` (default {@link DEFAULT_SKILLS_SH_URL}).
2671
- */
2672
- registryAdapters?: SkillRegistryAdapter[] | undefined;
2673
- }
2674
- /**
2675
- * SkillsPlugin — skill library + installer + authoring toolkit.
2676
- *
2677
- * Registers `/skill`, `/skill-gen`, `/skill-search`, `/skill-install`,
2678
- * `/skill-import`, `/skill-update`, `/skill-uninstall`. First-party ("official")
2679
- * plugin, so the commands keep their bare names. Needs a `SkillLoader` (injected
2680
- * by the host via `config.skillLoader`); without one the commands report that
2681
- * and no-op.
2682
- */
2683
- declare function createSkillsPlugin(opts?: SkillsPluginOptions): Plugin;
2684
-
2685
- interface SyncPluginOptions {
2686
- paths?: WstackPaths | undefined;
2687
- configStore?: ConfigStore | undefined;
2688
- /** Secret vault for encrypting the GitHub token before persisting to disk. */
2689
- vault?: {
2690
- encrypt(plaintext: string): string;
2691
- decrypt?(value: string): string;
2692
- };
2693
- }
2694
- /**
2695
- * SyncPlugin — GitHub-backed cloud sync for WrongStack user data.
2696
- *
2697
- * Registers `/sync` slash command. Users can push/pull their prompts,
2698
- * skills, settings, memory, and history to a private GitHub repo.
2699
- * Active by default; configure once with `/sync enable owner/repo TOKEN`.
2700
- */
2701
- declare function createSyncPlugin(opts?: SyncPluginOptions): Plugin;
2702
-
2703
- /**
2704
- * Fetch a JSON document. Injectable so the installer is testable without
2705
- * network access. Defaults to the global `fetch`.
2706
- */
2707
- type JsonFetcher = (url: string) => Promise<unknown>;
2708
- interface PromptPullResult {
2709
- manifest: PromptRegistryManifest;
2710
- diff: RegistryDiff;
2711
- /** Always true for the stub — pull never writes anything yet. */
2712
- dryRun: true;
2713
- }
2714
- interface PromptInstallerOptions {
2715
- fetcher?: JsonFetcher | undefined;
2716
- }
2717
- /**
2718
- * PromptInstaller — registry sync GROUNDWORK (stub).
2719
- *
2720
- * `pull()` fetches and validates a remote manifest and computes the checksum
2721
- * diff against the prompts the caller already has — but writes NOTHING. The
2722
- * actual download/write is the documented extension point (`install`), left
2723
- * unimplemented so the sync surface can land incrementally and be reviewed
2724
- * before it can touch the user's prompt store.
2725
- *
2726
- * Mirrors `SkillInstaller`. For a GitHub-backed hub, the contract is a repo
2727
- * with a top-level `registry.json` (a `PromptRegistryManifest`) plus
2728
- * `prompts/<slug>.json` bodies — the same shape the bundled dataset emits.
2729
- */
2730
- declare class PromptInstaller {
2731
- private readonly fetcher;
2732
- constructor(opts?: PromptInstallerOptions);
2733
- /**
2734
- * Fetch + validate a manifest and report what a sync WOULD change. Read-only.
2735
- * @param manifestUrl URL to the registry's `registry.json`.
2736
- * @param local The prompts the caller already has (slug + checksum).
2737
- */
2738
- pull(manifestUrl: string, local: {
2739
- slug: string;
2740
- checksum?: string | undefined;
2741
- }[]): Promise<PromptPullResult>;
2742
- /**
2743
- * EXTENSION POINT (not yet wired): download the prompt bodies for the given
2744
- * registry refs and write them into the user layer as `source:'synced'`,
2745
- * recording each in the installed-prompts manifest. Intentionally unimplemented
2746
- * — pulling real content over the network is gated behind a future change so
2747
- * the format/diff path can ship and be reviewed first.
2748
- */
2749
- install(): Promise<never>;
2750
- }
2751
-
2752
- /**
2753
- * Tracks prompts pulled from a remote registry, persisted to
2754
- * `~/.wrongstack/installed-prompts.json`. Mirrors `SkillManifestStore`. The
2755
- * manifest is the source of truth for "what have I synced and at what version",
2756
- * enabling a future `pull --favorites` / update flow.
2757
- */
2758
- declare class PromptManifestStore {
2759
- private readonly manifestPath;
2760
- constructor(manifestPath: string);
2761
- load(): Promise<PromptManifestData>;
2762
- save(data: PromptManifestData): Promise<void>;
2763
- /** Upsert one entry keyed by slug. */
2764
- record(entry: InstalledPromptEntry): Promise<void>;
2765
- remove(slug: string): Promise<boolean>;
2766
- list(): Promise<InstalledPromptEntry[]>;
2767
- }
2768
-
2769
- /**
2770
- * Idea #2 from IDEAS.md — Deterministic Replay.
2771
- *
2772
- * The hash function is the foundation of replay: given a `Request`,
2773
- * produce a stable identifier so a recorded `Response` can be looked
2774
- * up later when we want to "re-run" the same agent loop without
2775
- * burning API credits.
2776
- *
2777
- * Stability rules:
2778
- *
2779
- * - All object keys are sorted recursively before stringification.
2780
- * Without this, two semantically identical requests that differ
2781
- * only in key insertion order would produce different hashes.
2782
- * - We hash ONLY the fields that affect the response: `model`,
2783
- * `system`, `messages`, `tools`, `maxTokens`, and the four
2784
- * sampling knobs (`temperature`, `topP`, `stopSequences`,
2785
- * `toolChoice`). Anything else on the `Request` (metadata,
2786
- * future extensions) is ignored so replay stays forward-compat.
2787
- * - We serialize to JSON. The `ContentBlock` and `Message` shapes
2788
- * are pure data; this works as long as no `undefined` values
2789
- * sneak in (those get dropped by `JSON.stringify`, which is
2790
- * fine — the structural diff is what matters).
2791
- *
2792
- * The SHA-256 output is hex-encoded and prefixed with the algorithm
2793
- * tag so a future migration to a different hash (e.g. blake3) is
2794
- * trivial to detect.
2795
- */
2796
- declare function stableStringify(value: unknown): string;
2797
- declare function hashRequest(request: Request): string;
2798
-
2799
- /**
2800
- * ReplayProviderRunner — idea #2 from IDEAS.md.
2801
- *
2802
- * A drop-in `ProviderRunner` that wraps an inner runner and either
2803
- * - records every (request, response) pair it observes (mode: 'record'),
2804
- * - serves a recorded response when the request hash matches (mode: 'replay'),
2805
- * - or does both: serve when present, record when not (mode: 'auto').
2806
- *
2807
- * Bind to `TOKENS.ProviderRunner` to completely replace the default
2808
- * runner. Or use `AgentExtension.wrapProviderRunner` to chain in
2809
- * alongside other extensions.
2810
- *
2811
- * Mode semantics:
2812
- * - 'record' is the production mode. Every real API call is
2813
- * persisted; the user can later `wstack replay <sessionId>` to
2814
- * re-run with frozen responses.
2815
- * - 'replay' is the debugging mode. The agent loop runs normally
2816
- * (same permissions, same tool dispatch) but every LLM call
2817
- * comes from the recorded log. If a request hash is not in the
2818
- * log, we throw — the user is expected to either rebuild the
2819
- * session or fall back to record mode.
2820
- * - 'auto' is the warm-start mode for development. The first time
2821
- * a particular request is seen, it's recorded; the next time
2822
- * the same request is made, the recorded response is served.
2823
- * This is the cheapest path to a deterministic test harness.
2824
- */
2825
- type ReplayMode = 'record' | 'replay' | 'auto';
2826
- interface ReplayProviderRunnerOptions {
2827
- log: ReplayLogStore;
2828
- sessionId: string;
2829
- mode: ReplayMode;
2830
- /**
2831
- * Optional logger — receives a debug line on every replay hit
2832
- * ("served cached response for hash sha256:…") and a warn on
2833
- * every miss in 'replay' mode (the throw that follows is the
2834
- * real signal, but the warn helps when the throw is caught
2835
- * upstream).
2836
- */
2837
- logger?: {
2838
- debug?: ((msg: string) => void) | undefined;
2839
- warn?: ((msg: string) => void) | undefined;
2840
- } | undefined;
2841
- }
2842
- declare class ReplayProviderRunner implements ProviderRunner {
2843
- private readonly inner;
2844
- private readonly opts;
2845
- constructor(inner: ProviderRunner, opts: ReplayProviderRunnerOptions);
2846
- run(runOpts: RunProviderOptions$1): Promise<Response>;
2847
- }
2848
-
2849
- /**
2850
- * `mcp_use` — meta-tool for ephemeral MCP tool calls in token-saving mode.
2851
- *
2852
- * Instead of the 4-step manual cycle (list → activate → use → deactivate),
2853
- * the model calls this single tool. It:
2854
- * 1. Activates the server's tools in the registry
2855
- * 2. Calls the requested tool with the provided input
2856
- * 3. Returns the result
2857
- * 4. Deactivates the server's tools
2858
- *
2859
- * The tool is registered only when features.lazyMcp is active so the model
2860
- * always has a way to reach MCP tools without them being in the prompt.
2861
- */
2862
- interface CreateMcpUseToolOptions {
2863
- /** Live MCP registry handle (activate/deactivate/describe). */
2864
- registry: MCPRegistryHandle;
2865
- /** Tool registry — needed to resolve and call MCP tools by name. */
2866
- toolRegistry: ToolRegistry;
2867
- }
2868
- declare function createMcpUseTool(opts: CreateMcpUseToolOptions): Tool;
2869
-
2870
- declare function readBundledInstructionText(relativePath: string): string;
2871
- declare function renderInstructionTemplate(template: string, values: Record<string, string>): string;
2872
-
2873
- export { AddAttachmentInput, AgentExtension, AgentPipelines, AttachmentRef, AttachmentStore, type AutoPhaseOptions, type AutoPhasePlanResult, AutoPhasePlanner, type AutoPhasePlannerOptions, AutoPhaseRunner, type AutoPhaseRunnerOptions, type BootConfigOptions, type BootConfigResult, BrainArbiter, BuildContext, CHIMERA_REVIEW_PROMPT, type Checkpoint, CheckpointManager, type CheckpointManagerOptions, type ChimeraReviewNeededPayload, type CollabBusState, type InjectedToolResult as CollabInjectedToolResult, type CollabPauseMiddlewareOptions, CollaborationBus, type CommitSafetyOptions, type CommitSafetyReport, Config, ConfigStore, ConfiguredHook, type ConsumedInjectionInfo, Container, ContentBlock, type ContentScore, Context, type ContinuationInput, type ContinuationSource, type ContinueDirective, DefaultLogger, DefaultPluginAPI, DefaultPromptStore, DefaultSecretVault, DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, type EliseResult, EventBus, EventName, ExtensionRegistry, type FallbackModelDeps, type FileAuthorEntry, type FileAuthorLog, type FileAuthorTrackerOptions, type ForeignFile, HealthRegistry, HookEvent, HookInput, HookMatcher, HookOutcome, HookRegistrationOptions, HookRegistry, InProcessHook, InputBuilder, type InputBuilderEvent, type InputBuilderOptions, InstalledPromptEntry, type InstructionBundle, type InstructionBundlePaths, JSONSchema, type JsonFetcher, KERNEL_API_VERSION, LAYER_1_IDENTITY, Listener, type LoadPluginsOptions, Logger, MCPRegistryHandle, MCPRegistryView, Mailbox, type MailboxLoopOptions, MailboxMessage, MemoryStore, Message, MetricsSink, MetricsSinkView, Middleware, ModeStore, ModelCapabilities, ModelsRegistry, type NicknameAssignment, PHASE_EVENT_NAMES, PermissionPolicy, type PhaseEventMap, type PhaseEventName, type PhaseExecutionContext, type PhaseFilter, type PhaseGraph, PhaseGraphBuilder, type PhaseGraphBuilderOptions, type PhaseNode, PhaseOrchestrator, type PhaseOrchestratorOptions, type PhaseProgress, type PhaseSort, type PhaseStatus, PhaseStore, type PhaseStoreOptions, type PhaseTemplate, Plugin, PluginAPI, type PluginAPIInit, PluginCapabilities, PluginDependency, PluginLLM, PluginPipelines, PromptInstaller, type PromptInstallerOptions, PromptLoader, PromptManifestData, PromptManifestStore, type PromptPullResult, PromptRegistryManifest, PromptUsageStore, Provider, ProviderRegistry, ProviderRegistryView, ProviderRunner, RegistryDiff, Renderer, ReplayLogStore, type ReplayMode, ReplayProviderRunner, type ReplayProviderRunnerOptions, Request, type ResolvedChimeraConfig, type ResolvedContinuation, Response, RunProviderOptions$1 as RunProviderOptions, SessionWriterView, type ShellHookSpec, SkillLoader, SkillRegistryAdapter, SlashCommand, SlashCommandRegistry, SlashCommandRegistryView, type SystemInstructionBundle, SystemPromptBuilder, SystemPromptContributor, SystemPromptRegions, TaskGraph, TaskNode, TaskPriority, TaskStore, TaskType, type TechStackConsumerOptions, TextBlock, TodoItem, TokenSavingTier, Tool, ToolCallPipelinePayload, ToolRegistry, ToolRegistryView, Tracer, WorktreeManager, WstackPaths, assessCommitSafety, assignNickname, attachMailboxChecker, bootConfig, buildBtwBlock, buildLosslessDigest, buildMailboxBlock, buildMailboxBtwAwarenessBlock, buildQueuedMessagesBlock, buildSmartDigest, collabInjectMiddleware, collabPauseMiddleware, compactLog, consumeBtwNotes, consumeQueuedMessagesUpdate, countShellHooks, createAutoPhaseFromTaskGraph, createChimeraPlugin, createFallbackModelExtension, createGitPlugin, createMailboxChecker, createMcpUseTool, createObservabilityPlugin, createPlanPlugin, createPromptsPlugin, createSecurityPlugin, createSkillsPlugin, createSyncPlugin, definePlugin, detectContinueIntent, effectiveFallbackChain, eliseOldToolResults, estimateMessageTokens, estimateMessages, extractText, fallbackProfileChain, findPreserveStart, flagsToConfigPatch, formatModelRef, getFileHistory, getFilesByAgent, getFullLog, getLastAuthor, hasTextContent, hashRequest, injectPendingMailboxMessages, loadInstructionBundle, loadPlugins, makeContinueToNextIterationTool, mergeInstructionBundle, nicknameKeyFromDisplay, normalizeModelRef, parseContinueDirective, parseModelRef, peekQueuedMessages, pendingBtwCount, readBundledInstructionText, recordFileAction, renderInstructionTemplate, resolveChimeraConfig, resolveContinuation, runProviderWithRetry, runShellHook, scoreMessage, setBtwNote, setQueuedMessagesSnapshot, shellHooksEqual, smartDefaultFallbackChain, stableStringify, startTechStackConsumer, unloadPlugins };
102
+ export * from './utils/index.js';
103
+ export { readBundledInstructionText, renderInstructionTemplate, } from './utils/instruction-file.js';
104
+ export { safeParse, safeStringify, sanitizeJsonString, stripCodeFences } from './utils/safe-json.js';
105
+ export { getTermSize, isInteractive, isStdinTTY, isStdoutTTY, type OutputLineGuard, onResize, setOutputLineGuard, setRawMode, writeErr, writeOut, } from './utils/term.js';
106
+ export { type AllocateOpts, assertSafePath, type MergeOpts, type MergeResult, type WorktreeHandle, WorktreeManager, type WorktreeManagerOptions, type WorktreeRunResult, type WorktreeStatus, } from './worktree/index.js';
107
+ export { type TaskStore, type TaskTrackerOptions, type TaskTransition, type TaskTrackerChange, type TaskTrackerListener, TaskTracker, } from './tasking/task-tracker.js';
108
+ export { DefaultTaskStore } from './tasking/task-store.js';
109
+ //# sourceMappingURL=index.d.ts.map