@wrongstack/core 0.284.1 → 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
@@ -0,0 +1,802 @@
1
+ import { type DirectorStateSnapshot } from '../storage/director-state.js';
2
+ import type { ModelMatrixEntry } from '../types/config.js';
3
+ import type { Logger } from '../types/logger.js';
4
+ import type { AwaitAnyResult, CoordinatorStatus, MultiAgentConfig, SubagentConfig, SubagentRunner, TaskResult, TaskSpec } from '../types/multi-agent.js';
5
+ import type { SessionWriter } from '../types/session.js';
6
+ import type { Tool } from '../types/tool.js';
7
+ import type { WorktreeManager } from '../worktree/worktree-manager.js';
8
+ import { InMemoryAgentBridge } from './agent-bridge.js';
9
+ import type { BrainArbiter } from './brain.js';
10
+ import { type CollabDebugReport, type CollabSessionOptions } from './collab-debug.js';
11
+ import { FleetBus, type FleetUsage, FleetUsageAggregator } from './fleet-bus.js';
12
+ import type { FleetManager } from './fleet-manager.js';
13
+ import type { ICoordinator } from './icoordinator.js';
14
+ import { LargeAnswerStore } from './large-answer-store.js';
15
+ import { type FleetWorktreePolicy } from './worktree-task-runner.js';
16
+ /**
17
+ * Director — high-level orchestrator that owns a `MultiAgentCoordinator`,
18
+ * a `FleetBus`, and a `FleetUsageAggregator`. Exposes a small imperative
19
+ * API (`spawn`, `assign`, `awaitTasks`, `terminate`, `status`, `usage`)
20
+ * that's easy to test, and a `tools()` factory that wraps the same API
21
+ * as agent-callable `Tool`s so an LLM can drive the orchestration.
22
+ *
23
+ * This class is intentionally *not* an `Agent`. It's a coordinator +
24
+ * observability surface. To make it LLM-driven, construct an Agent
25
+ * with `director.tools()` registered. That keeps the construction
26
+ * symmetric with how other agents are built and avoids smuggling a
27
+ * heavy LLM dependency into core just for the director path.
28
+ */
29
+ /**
30
+ * Payload handed to {@link DirectorOptions.taskResultNotifier} when a
31
+ * fire-and-forget task completes (no `awaitTasks` waiter was pending).
32
+ */
33
+ export interface TaskResultNotification {
34
+ taskId: string;
35
+ /** Task description (or task id when no description was recorded). */
36
+ title: string;
37
+ status: TaskResult['status'];
38
+ subagentId: string;
39
+ /** Human-readable subagent name from the fleet manifest, when known. */
40
+ subagentName?: string | undefined;
41
+ /** The subagent's textual result (stringified when structured). */
42
+ resultText?: string | undefined;
43
+ /** Flattened `kind: message` error string for non-success statuses. */
44
+ errorText?: string | undefined;
45
+ /** Bounded incomplete text recovered before a non-successful exit. */
46
+ partialText?: string | undefined;
47
+ /** Machine-readable result submitted through submit_result. */
48
+ report?: TaskResult['report'] | undefined;
49
+ iterations: number;
50
+ toolCalls: number;
51
+ durationMs: number;
52
+ }
53
+ export interface DirectorOptions {
54
+ config: MultiAgentConfig;
55
+ runner?: SubagentRunner | undefined;
56
+ /** Optional Brain arbiter above the director for policy/decision escalation. */
57
+ brain?: BrainArbiter | undefined;
58
+ /**
59
+ * Called when a task completes with NO pending `awaitTasks` waiter —
60
+ * i.e. a fire-and-forget `assign_task`. Wire this to the project
61
+ * mailbox so the result reaches the leader's conversation automatically
62
+ * instead of waiting for a poll. Synchronous `delegate` calls attach a
63
+ * waiter up front, so they never double-report through this hook.
64
+ * Internal tasks (shadow passes) are excluded. Errors are swallowed.
65
+ */
66
+ taskResultNotifier?: ((n: TaskResultNotification) => void | Promise<void>) | undefined;
67
+ /**
68
+ * Remove a spawned or between-task subagent after this much idle time.
69
+ * Undefined disables idle retirement. This is separate from the in-task
70
+ * activity watchdog enforced by SubagentBudget.
71
+ */
72
+ subagentIdleTimeoutMs?: number | undefined;
73
+ /**
74
+ * Retire a subagent immediately after its final task result when the
75
+ * coordinator did not reuse it for queued work in the same dispatch cycle.
76
+ * Default false for embedders; runtime hosts opt in.
77
+ */
78
+ retireSubagentOnTaskComplete?: boolean | undefined;
79
+ /** Optional logger for structured debug/error logging. Falls back to console if omitted. */
80
+ logger?: Logger | undefined;
81
+ /**
82
+ * When set, the director writes a `fleet.json` manifest to this path
83
+ * recording every spawned subagent (id, provider, model, role, task
84
+ * ids). Used by `wstack replay <runId>` to rehydrate a fleet. Pass an
85
+ * absolute file path — the directory must already exist (the
86
+ * director-session factory creates it when used together).
87
+ */
88
+ manifestPath?: string | undefined;
89
+ /**
90
+ * Optional roster used by `leaderSystemPrompt()` to render a roles
91
+ * summary into the leader's preamble. Same shape as the roster passed
92
+ * to `tools()` — typically the same value.
93
+ */
94
+ roster?: Record<string, SubagentConfig>;
95
+ /**
96
+ * Override the built-in fleet preamble (see `DEFAULT_DIRECTOR_PREAMBLE`).
97
+ * Pass an empty string to suppress the preamble entirely.
98
+ */
99
+ directorPreamble?: string | undefined;
100
+ /**
101
+ * Override the built-in subagent baseline (see
102
+ * `DEFAULT_SUBAGENT_BASELINE`). Pass an empty string to suppress.
103
+ */
104
+ subagentBaseline?: string | undefined;
105
+ /**
106
+ * Absolute path to a directory the fleet can use as a shared scratchpad
107
+ * (read + write by every subagent). When set, the director creates it on
108
+ * construction and `subagentSystemPrompt()` automatically injects a
109
+ * "Shared notes" block telling subagents where to drop their findings.
110
+ * This is the cheap fleet-coordination channel — agents don't need each
111
+ * other's transcripts, just each other's conclusions.
112
+ *
113
+ * Convention: under a fleet run rooted at `<sessionsRoot>/<runId>/`,
114
+ * pass `<sessionsRoot>/<runId>/shared/` here.
115
+ */
116
+ sharedScratchpadPath?: string | undefined;
117
+ /**
118
+ * Maximum number of spawns this director can perform across its
119
+ * lifetime. Default: unlimited. Acts as a hard fleet-wide cost cap —
120
+ * a runaway leader that keeps spawning workers gets cut off cleanly
121
+ * instead of burning provider tokens until the user kills the
122
+ * process. The N+1-th spawn call rejects with a `FleetSpawnBudgetError`.
123
+ */
124
+ maxSpawns?: number | undefined;
125
+ /**
126
+ * Maximum nesting depth for spawns. The director constructed by the
127
+ * user is at depth `spawnDepth` (default 0); any subagent that itself
128
+ * acts as a director would construct its own `Director` with
129
+ * `spawnDepth: parent.spawnDepth + 1`. When `spawnDepth >= maxSpawnDepth`,
130
+ * `spawn()` rejects. The process-wide hard ceiling is 2; configuration can
131
+ * narrow it but cannot widen it. Default: 2 (root director can spawn workers; a
132
+ * worker that becomes a sub-director cannot itself spawn further).
133
+ * This stops infinite recursive director chains from a hostile or
134
+ * confused prompt.
135
+ */
136
+ maxSpawnDepth?: number | undefined;
137
+ /**
138
+ * Current spawn-chain depth for this director instance. Defaults to 0.
139
+ * A nested director should pass `parent.spawnDepth + 1`. Together with
140
+ * `maxSpawnDepth` this bounds the chain.
141
+ */
142
+ spawnDepth?: number | undefined;
143
+ /**
144
+ * Absolute path to a director-state checkpoint file. When set, the
145
+ * director writes an incremental snapshot of pending/running/completed
146
+ * tasks + spawned subagents on every state mutation. Distinct from
147
+ * `manifestPath`: the manifest is a final record written on shutdown,
148
+ * the checkpoint is a live mirror useful for crash recovery and the
149
+ * `wstack resume` "you had N tasks in flight" banner.
150
+ */
151
+ stateCheckpointPath?: string | undefined;
152
+ /**
153
+ * Session writer the director should forward task lifecycle events to
154
+ * (`agent_spawned`, `task_created`, `task_completed`, `task_failed`).
155
+ * When omitted these events stay in-memory only — useful for tests but
156
+ * lossy in production. Production callers (the CLI) pass the same
157
+ * writer the host Agent uses so all events land in a single JSONL.
158
+ */
159
+ sessionWriter?: SessionWriter | undefined;
160
+ /**
161
+ * Session id for live fleet/coordinator events. Defaults to
162
+ * `sessionWriter.id` when a writer is available; accepts a getter so
163
+ * embedding surfaces can follow session swaps.
164
+ */
165
+ sessionId?: string | (() => string | undefined) | undefined;
166
+ /**
167
+ * Debounce window for periodic manifest writes triggered by spawn/
168
+ * assign/complete events. Default: 2000ms. Pass 0 to disable periodic
169
+ * writes (the manifest will then only be written on `shutdown()`).
170
+ */
171
+ manifestDebounceMs?: number | undefined;
172
+ /**
173
+ * Fleet-wide cost ceiling. When set, `spawn()` refuses any new subagent
174
+ * that would push the fleet's total cost above this limit. The cap
175
+ * is checked BEFORE the spawn is recorded — a refused spawn must not
176
+ * leak partial state into the manifest or fleet bus. Let in-flight
177
+ * tasks complete; refuse new spawns only. When omitted or Infinity,
178
+ * no cost cap applies.
179
+ *
180
+ * Distinct from SubagentBudget.maxCostUsd (per-subagent spend) — this
181
+ * field caps the *entire fleet* total.
182
+ */
183
+ directorBudget?: {
184
+ /**
185
+ * Maximum total USD the fleet may spend across all subagents.
186
+ * Default: Infinity (no cap).
187
+ */
188
+ maxCostUsd?: number | undefined;
189
+ /** Maximum cumulative input+output tokens across the fleet. */
190
+ maxTokens?: number | undefined;
191
+ } | undefined;
192
+ /**
193
+ * Maximum auto-extensions per subagent per budget kind before the
194
+ * director denies further extensions. A subagent hitting the same
195
+ * soft limit repeatedly (e.g. 3× budget.threshold_reached for
196
+ * tool_calls) is likely looping on a prompt/config issue, not
197
+ * making legitimate progress. Default: 5. Set to Infinity to
198
+ * disable the cap (use with caution — a misconfigured subagent
199
+ * could burn unlimited budget).
200
+ */
201
+ maxBudgetExtensions?: number | undefined;
202
+ /**
203
+ * Debounce window for state-checkpoint writes. Default: 250ms.
204
+ * Bursts of spawn/assign/complete events collapse into one disk
205
+ * hit. Higher values reduce write amplification on fast machines;
206
+ * lower values improve crash-recovery fidelity (less state lost
207
+ * on sudden process exit).
208
+ */
209
+ checkpointDebounceMs?: number | undefined;
210
+ /**
211
+ * Sessions root directory for per-subagent JSONL transcripts.
212
+ * When set, the director can read subagent transcripts directly for
213
+ * `fleet` tool (action: session) — no bridge round-trip needed. Path convention:
214
+ * `<sessionsRoot>/<directorRunId>/<subagentId>.jsonl`.
215
+ */
216
+ sessionsRoot?: string | undefined;
217
+ /**
218
+ * Director run id — namespaced under `sessionsRoot` to locate per-subagent
219
+ * JSONLs. Defaults to the director's own `id` when omitted.
220
+ */
221
+ directorRunId?: string | undefined;
222
+ /**
223
+ * Pre-built fleet manager. When provided the Director delegates all
224
+ * fleet-level policy (spawn budgets, manifest assembly, checkpointing)
225
+ * to this instance and takes ownership of the coordinator + bridge
226
+ * layer only. This enables unit-testing fleet policy in isolation
227
+ * and swapping implementations without changing the Director surface.
228
+ *
229
+ * When omitted the Director creates its own fleet infrastructure
230
+ * (same behavior as before this field was added).
231
+ */
232
+ fleetManager?: FleetManager | undefined;
233
+ /**
234
+ * Optional LLM classifier for the smart dispatcher. When set, the
235
+ * `spawn_subagent` tool can accept a free-form `description` field
236
+ * and the director will automatically route to the best-matching
237
+ * catalog agent using `dispatchAgent()`. When omitted, routing is
238
+ * pure heuristic (no provider call) — sufficient for most tasks.
239
+ *
240
+ * Build from a `complete(prompt) => string` function using
241
+ * `makeLLMClassifier(complete)` from the dispatcher module.
242
+ */
243
+ dispatchClassifier?: import('../coordination/dispatcher.js').DispatchClassifier | undefined;
244
+ /**
245
+ * Maximum context load (as a fraction of maxContext) the leader agent
246
+ * is allowed to reach before a new spawn is rejected. Default: 0.85.
247
+ * When the leader's context pressure exceeds this threshold, spawning
248
+ * a new subagent is refused — the leader must compact first.
249
+ * Only used when no `fleetManager` is provided (inline mode).
250
+ * Set to 1.0 to disable this check.
251
+ */
252
+ maxLeaderContextLoad?: number | undefined;
253
+ /**
254
+ * Provider's max context window in tokens. Used with `maxLeaderContextLoad`
255
+ * to compute the absolute token threshold. Default: 128_000.
256
+ * Only used when no `fleetManager` is provided (inline mode).
257
+ *
258
+ * A function may be supplied when the leader can switch models at runtime;
259
+ * spawn() reads it lazily so the threshold follows the active model.
260
+ */
261
+ maxContext?: number | (() => number | undefined) | undefined;
262
+ /**
263
+ * Per-task model matrix (Config.modelMatrix). When set, a spawn whose
264
+ * config has no explicit `model` is resolved against this matrix by role
265
+ * (→ phase → `*`) before the subagent is built — so the spawned event,
266
+ * manifest, and the agent itself all run the matched model. Explicit
267
+ * per-spawn `model` overrides always win.
268
+ *
269
+ * Pass a **function** (not a snapshot) when the matrix can change at
270
+ * runtime (the CLI passes `() => configStore.get().modelMatrix`) so a
271
+ * mid-session `/setmodel` takes effect on the next spawn. A static record
272
+ * is also accepted for tests and one-shot runs.
273
+ */
274
+ modelMatrix?: ModelMatrixSource | undefined;
275
+ /**
276
+ * Optional git-worktree manager for Director fleet isolation. When supplied,
277
+ * task runners can execute side-effectful subagents in per-task worktrees and
278
+ * squash-merge successful branches back into the base checkout.
279
+ */
280
+ worktrees?: WorktreeManager | undefined;
281
+ /** Worktree policy. Defaults to `auto` when `worktrees` is provided. */
282
+ worktreePolicy?: FleetWorktreePolicy | undefined;
283
+ /**
284
+ * Optional guarded merge-conflict resolver invoked by WorktreeManager when a
285
+ * successful task branch cannot squash-merge cleanly.
286
+ */
287
+ worktreeConflictResolver?: ((info: {
288
+ task: TaskSpec;
289
+ config: SubagentConfig;
290
+ conflictFiles: string[];
291
+ cwd: string;
292
+ }) => Promise<boolean>) | undefined;
293
+ }
294
+ /** Either a static matrix or a live getter (re-read on every spawn). */
295
+ export type ModelMatrixSource = Record<string, ModelMatrixEntry> | (() => Record<string, ModelMatrixEntry> | undefined);
296
+ export { FleetContextOverflowError, FleetCostCapError, FleetSpawnBudgetError, FleetTokenCapError, } from './director/director-errors.js';
297
+ export declare class Director implements ICoordinator {
298
+ /** Alias for the ICoordinator contract. `id` is retained for backward compatibility. */
299
+ get coordinatorId(): string;
300
+ readonly id: string;
301
+ /**
302
+ * The fleet event bus. Backed by `fleetManager?.fleet` when a FleetManager
303
+ * is injected; otherwise own FleetBus instance (preserves existing behavior).
304
+ */
305
+ readonly fleet: FleetBus;
306
+ /**
307
+ * Usage rollup. Backed by `fleetManager?.usage` when a FleetManager is
308
+ * injected; otherwise own FleetUsageAggregator.
309
+ */
310
+ readonly usage: FleetUsageAggregator;
311
+ /**
312
+ * Update the leader agent's current context pressure (full request tokens:
313
+ * messages + systemPrompt + toolDefs). The director checks this before every
314
+ * spawn — if the pressure exceeds `maxLeaderContextLoad * maxContext`,
315
+ * spawning is refused with a `FleetContextOverflowError`.
316
+ *
317
+ * Call this after each leader agent iteration to keep the pressure current.
318
+ * The compactor's `CompactReport.fullRequestTokensAfter` is a natural source.
319
+ */
320
+ setLeaderContextPressure(tokens: number): void;
321
+ /**
322
+ * Read the leader agent's current context pressure.
323
+ */
324
+ getLeaderContextPressure(): number;
325
+ /**
326
+ * Remaining USD budget for the entire fleet (when a cap is configured).
327
+ * Returns `undefined` when no cap was set (Infinity).
328
+ */
329
+ getRemainingBudgetUsd(): number | undefined;
330
+ private resolveMaxContext;
331
+ private currentSessionId;
332
+ /** Optional Brain arbiter for director-level policy decisions. */
333
+ private readonly brain?;
334
+ /**
335
+ * Optional fleet-level policy container. When provided the Director
336
+ * delegates spawn budgeting, manifest entries, and checkpointing to it
337
+ * instead of managing those internally. All other behavior is unchanged.
338
+ */
339
+ readonly fleetManager: FleetManager | undefined;
340
+ /**
341
+ * Director-side bridge endpoint. Subagents are wired to the same
342
+ * in-memory transport so the director can `ask()` them synchronously
343
+ * and they can `send()` progress back. Exposed so external code (e.g.
344
+ * the TUI) can subscribe to inbound messages.
345
+ */
346
+ readonly bridge: InMemoryAgentBridge;
347
+ private readonly transport;
348
+ private readonly coordinator;
349
+ /** Resolves with the matching `TaskResult` the first time the
350
+ * coordinator emits `task.completed` for a given task id. Each entry
351
+ * is created lazily on first poll/await and cleared once consumed. */
352
+ private readonly taskWaiters;
353
+ /** First-completion waiters registered by `awaitTasksAny`. Kept separate
354
+ * from `taskWaiters` on purpose: a `taskWaiters` entry marks a result as
355
+ * "will be delivered in-band" and suppresses the fire-and-forget
356
+ * report-back — but an any-await only consumes ONE of its ids, so the
357
+ * losers must stay eligible for the mailbox notifier. Entries carry an
358
+ * optional timeout timer so `shutdown()` can clear them. */
359
+ private readonly anyWaiters;
360
+ /** Cache of completed results in case the consumer asks AFTER the
361
+ * coordinator already fired the event — `awaitTasks(['t-1'])` after
362
+ * t-1 finished should resolve immediately, not hang. */
363
+ private readonly completed;
364
+ /** Prevents the completed Map from growing unbounded in long-running directors. */
365
+ private static readonly MAX_COMPLETED;
366
+ /** Per-subagent provider/model metadata, captured at spawn time so the
367
+ * FleetUsageAggregator's metaLookup can surface readable rows. */
368
+ private readonly subagentMeta;
369
+ private readonly priceLookups;
370
+ /** Bridge endpoints we created per subagent (so we can `stop()` them
371
+ * on shutdown and free transport subscriptions). */
372
+ private readonly subagentBridges;
373
+ /** Tracks per-spawn config + assigned task ids for manifest writing. */
374
+ private readonly manifestEntries;
375
+ /** Tracks assigned nicknames so the same name is never reused in one fleet. */
376
+ private readonly _usedNicknames;
377
+ private readonly manifestPath?;
378
+ private readonly roster?;
379
+ private readonly directorPreamble;
380
+ private readonly subagentBaseline;
381
+ /** See {@link DirectorOptions.taskResultNotifier}. */
382
+ private readonly taskResultNotifier?;
383
+ private readonly subagentIdleTimeoutMs;
384
+ private readonly retireSubagentOnTaskComplete;
385
+ private readonly subagentIdleTimers;
386
+ /** Absolute path to the fleet's shared scratchpad directory, or null
387
+ * when none was configured. Exposed as a readonly getter for callers
388
+ * that need to surface the path to the user (e.g. the CLI logging
389
+ * the location after `--director` boots). */
390
+ readonly sharedScratchpadPath: string | null;
391
+ /** Spawn cap (lifetime total). Infinity means unlimited. */
392
+ readonly maxSpawns: number;
393
+ /** Nesting cap. The N-th director in a chain has `spawnDepth = N-1`. */
394
+ readonly maxSpawnDepth: number;
395
+ /** This director's position in a director chain. Root director = 0. */
396
+ readonly spawnDepth: number;
397
+ /** Live spawn counter for `maxSpawns` enforcement. */
398
+ private spawnCount;
399
+ /** Optional checkpoint mirror — writes the live task graph + roster to disk. */
400
+ private readonly stateCheckpoint;
401
+ /** Optional session writer for emitting task_* / agent_* lifecycle events. */
402
+ private readonly sessionWriter;
403
+ private readonly sessionIdSource;
404
+ /** Debounce timer for periodic manifest writes. */
405
+ private manifestTimer;
406
+ private manifestWriteChain;
407
+ private readonly manifestDebounceMs;
408
+ /** Fleet-wide cost cap (entire fleet total, distinct from SubagentBudget limits). Infinity means no cap. */
409
+ private readonly maxFleetCostUsd;
410
+ /** Fleet-wide input+output token cap. Infinity means no cap. */
411
+ private readonly maxFleetTokens;
412
+ /** Max auto-extensions per subagent per budget kind before denying. */
413
+ private readonly maxBudgetExtensions;
414
+ /** Sessions root for direct subagent JSONL reads (fleet tool, action: session). */
415
+ private readonly sessionsRoot?;
416
+ /** Director run id for JSONL path resolution. */
417
+ private readonly directorRunId;
418
+ /** Optional logger for structured logging. Falls back to noop when omitted. */
419
+ private readonly logger;
420
+ /** Resolves task descriptions back from `assign()` so completion events
421
+ * can also carry a human-readable title. */
422
+ private readonly taskDescriptions;
423
+ /** Latest worktree state per task id (allocated/committed/merged/conflict/etc.). */
424
+ private readonly taskWorktrees;
425
+ /** Snapshot of which subagent owns each task — drives state-checkpoint
426
+ * status updates without re-walking the manifest. */
427
+ private readonly taskOwners;
428
+ /** Infrastructure-owned task ids that should not appear in user-visible
429
+ * manifest/session/checkpoint/rollup state. */
430
+ private readonly internalTaskIds;
431
+ /** Cumulative auto-extension grants per subagent (all budget kinds). Lets
432
+ * /fleet render "⚡ extended ×N" without replaying the event stream. */
433
+ private readonly extendTotals;
434
+ /**
435
+ * Handle to the coordinator-side `task.completed` listener so we can
436
+ * unsubscribe in `shutdown()`. Without this, repeated Director
437
+ * construction (e.g. tests, hot reloads) accumulates listeners on a
438
+ * cached coordinator and slowly drifts the EventEmitter past its
439
+ * default cap.
440
+ */
441
+ private taskCompletedListener;
442
+ /**
443
+ * Unsub handles for the two `FleetBus.filter()` calls installed in the
444
+ * constructor for timeout-heartbeat tracking. Without capturing these
445
+ * and calling them in `shutdown()`, repeated Director construction
446
+ * (tests, hot reloads, `--director` restarts) accumulates 2 dangling
447
+ * listeners per Director on the FleetBus, slowly drifting the
448
+ * EventEmitter past its default cap. Mirrors the rationale on
449
+ * `taskCompletedListener` above.
450
+ */
451
+ private toolExecFilter;
452
+ private budgetFilter;
453
+ /** Optional LLM classifier for smart dispatch. Passed from options. */
454
+ readonly dispatchClassifier?: import('../coordination/dispatcher.js').DispatchClassifier | undefined;
455
+ /** Leader agent's current context pressure (full request tokens). */
456
+ private leaderContextPressure;
457
+ /** Maximum context load fraction before spawn is refused. */
458
+ private readonly maxLeaderContextLoad;
459
+ /** Provider's max context window in tokens, or a live resolver for runtime model switches. */
460
+ private readonly maxContext;
461
+ /** Per-task model matrix (static record or live getter); resolved
462
+ * per-spawn when no explicit model is set. */
463
+ private readonly modelMatrix?;
464
+ /**
465
+ * When set by `workComplete()`, the director stops dispatching new tasks
466
+ * and terminates all running subagents. Used when the director's LLM decides
467
+ * the goal is satisfied and no further spawns are needed — prevents the
468
+ * coordinator from keeping workers alive for tasks that will never arrive.
469
+ */
470
+ private workCompleteFlag;
471
+ /** Pending /btw notes stashed by the leader agent (see setLeaderBtwNote). */
472
+ private _leaderBtwNotes;
473
+ /** Active collab sessions tracked by sessionId (see spawnCollab).
474
+ * The tuple holds the session and its Director-registered listener unsubs.
475
+ * Calling the unsubs on cancel/premature-cleanup prevents listener accumulation
476
+ * on CollabSession (EventEmitter) across many spawnCollab() calls. */
477
+ private readonly _activeCollabSessions;
478
+ /** Prevents large `ask_subagent` answers from bloating the leader's context window. */
479
+ readonly largeAnswerStore: LargeAnswerStore;
480
+ constructor(opts: DirectorOptions);
481
+ /**
482
+ * Record a granted budget extension and broadcast it on the FleetBus so
483
+ * the host can re-emit `subagent.budget_extended` for live UI badges.
484
+ * Called from both the timeout heartbeat path and the per-kind grant path.
485
+ */
486
+ private recordExtension;
487
+ /** Cumulative auto-extension count for one subagent (0 when never extended). */
488
+ extensionsFor(subagentId: string): number;
489
+ /**
490
+ * Signal that the director's work is done. Once called:
491
+ * - `spawn()` throws `FleetSpawnBudgetError('max_spawns', …)` — no new
492
+ * subagents can be created
493
+ * - Running subagents are NOT forcibly stopped — they finish naturally,
494
+ * but no new tasks are dispatched to them
495
+ *
496
+ * This lets the director LLM say "I'm satisfied with the results, stop
497
+ * spawning and wind down" — without killing in-flight work mid-execution.
498
+ * Call `terminateAll()` separately if you need immediate teardown.
499
+ *
500
+ * Idempotent — calling twice is a no-op.
501
+ */
502
+ workComplete(): void;
503
+ /** Returns true if `workComplete()` has been called on this director. */
504
+ isWorkComplete(): boolean;
505
+ /**
506
+ * Stashes a /btw note on the leader agent's context. The leader's agent loop
507
+ * calls `consumeBtwNotes()` at each iteration boundary and folds pending notes
508
+ * into the conversation as a visible block — no abort, no restart, just a
509
+ * "by the way" nudge the model picks up on its next turn.
510
+ *
511
+ * This is the entry point for the host (CLI, TUI) to inject /btw notes
512
+ * programmatically without going through the slash-command path.
513
+ */
514
+ setLeaderBtwNote(note: string): number;
515
+ /**
516
+ * Read and clear all pending /btw notes the leader has stashed.
517
+ * Returns them in FIFO order (empty array when none).
518
+ *
519
+ * Called by CollabSession when a budget threshold event fires so the
520
+ * Director can inspect accumulated /btw notes before deciding whether
521
+ * to cancel the collab session or let it continue.
522
+ */
523
+ getLeaderBtwNotes(): string[];
524
+ /**
525
+ * Peek at pending /btw notes without consuming them.
526
+ * Useful for UI to show "N pending notes" without clearing them.
527
+ */
528
+ peekLeaderBtwNotes(): string[];
529
+ /**
530
+ * Drain (read + clear) all /btw notes in one call.
531
+ * Alias for getLeaderBtwNotes() — kept for symmetry with consumeBtwNotes()
532
+ * in the agent's btw.ts. The Director calls this at the point where it
533
+ * makes a cancellation decision, not on every budget event.
534
+ */
535
+ drainLeaderBtwNotes(): string[];
536
+ /**
537
+ * Cancel an active collab session by its id.
538
+ * Emits `director.cancel_collab` on the FleetBus so the session's agents
539
+ * finish early with a 'cancelled' disposition.
540
+ *
541
+ * Returns silently if the session id is not tracked or already settled.
542
+ * The CollabDebugReport will reflect 'cancelled' disposition when awaited.
543
+ */
544
+ cancelCollabSession(sessionId: string, reason?: string): void;
545
+ /**
546
+ * Subscribe a callback to be notified whenever a collab session raises
547
+ * an alert (warning level). The callback receives the full DirectorAlert
548
+ * payload so the host (CLI, TUI) can display it to the user.
549
+ * Returns an unsubscribe function.
550
+ */
551
+ onCollabAlert(handler: (alert: import('./collab-debug.js').DirectorAlert) => void): () => void;
552
+ /**
553
+ * Returns all active (not yet settled) collab session ids.
554
+ * Useful for the TUI to render a "N active sessions" badge and for
555
+ * the host to know what can be cancelled.
556
+ */
557
+ activeCollabSessions(): string[];
558
+ /** Best-effort session-writer append. Swallows failures — the director
559
+ * must not break a fleet run because the session JSONL handle closed. */
560
+ private appendSessionEvent;
561
+ /** Debounced manifest writer. A burst of spawn/assign/complete events
562
+ * collapses into one write. Set `manifestDebounceMs` to 0 to write
563
+ * synchronously (no debounce); set to negative to disable entirely. */
564
+ private scheduleManifest;
565
+ private clearManifestTimer;
566
+ private recordWorktreeTaskUpdate;
567
+ /**
568
+ * Spawn a subagent. Identical to the coordinator's `spawn()` but
569
+ * captures provider/model metadata for the usage aggregator and
570
+ * lets the FleetBus attach to the runner's EventBus when the task
571
+ * actually runs (see `attachSubagentBus`).
572
+ *
573
+ * Caller-supplied `priceLookup` is optional but recommended — without
574
+ * it the `cost` column in `usage.snapshot()` stays at 0.
575
+ */
576
+ spawn(callerConfig: SubagentConfig, priceLookup?: {
577
+ input?: number | undefined;
578
+ output?: number | undefined;
579
+ cacheRead?: number | undefined;
580
+ cacheWrite?: number | undefined;
581
+ }): Promise<string>;
582
+ /**
583
+ * Synchronously ask a subagent something via the bridge. Sends a
584
+ * `task` message addressed to the subagent and awaits a matching
585
+ * reply (matched by message id). Subagent runners that handle these
586
+ * requests subscribe to `ctx.bridge` and reply with a message whose
587
+ * `id` equals the incoming request's id (see `InMemoryAgentBridge`'s
588
+ * `request<T>` implementation).
589
+ *
590
+ * Returns the response payload directly (the bridge wrapper is
591
+ * unwrapped for ergonomics). Times out after `timeoutMs` (default
592
+ * matches the bridge's own default of 30s) — surface those rejections
593
+ * to the caller as actionable errors instead of letting tools hang.
594
+ */
595
+ ask<T = unknown>(subagentId: string, payload: unknown, timeoutMs?: number): Promise<T>;
596
+ /**
597
+ * Read completed task results and format them as a structured text
598
+ * block the director's LLM can paste into its own context. The
599
+ * Director keeps every completed `TaskResult` in `completed` so this
600
+ * is a pure read — no bridge round-trip, cheap to call.
601
+ *
602
+ * The returned string is intentionally markdown-flavored: headers per
603
+ * subagent, a one-line meta row (iter / tools / ms), and the task's
604
+ * result text. Pass `style: 'json'` for a programmatic shape instead
605
+ * (useful when the director model is doing structured-output work).
606
+ */
607
+ rollUp(taskIds: string[], style?: 'markdown' | 'json'): string;
608
+ /**
609
+ * Write the fleet manifest to `manifestPath`. Returns the path written
610
+ * or null when no path was configured. Captures every spawn + its
611
+ * assigned tasks — paired with per-subagent JSONLs, this is enough to
612
+ * replay an entire director run.
613
+ */
614
+ writeManifest(): Promise<string | null>;
615
+ private writeManifestNow;
616
+ /**
617
+ * Tear down the director: stop every subagent, close every bridge
618
+ * endpoint, and (when configured) write the final manifest. Idempotent
619
+ * — calling shutdown twice is a no-op on the second invocation.
620
+ */
621
+ shutdown(): Promise<void>;
622
+ /**
623
+ * Funnel for shutdown-phase errors. We can't throw — `shutdown()` is
624
+ * called from process-exit paths where an uncaught throw would lose
625
+ * the manifest write that comes after. But we MUST NOT silently
626
+ * swallow either — a persistent bridge-close failure would otherwise
627
+ * mask a real bug. `process.emitWarning` is the right tier:
628
+ * surfaces on stderr by default, lets the host plug a warning
629
+ * listener for structured collection, and never affects exit code.
630
+ */
631
+ private logShutdownError;
632
+ /**
633
+ * Hand a task to the coordinator. Returns the assigned task id so
634
+ * callers can wait on it via `awaitTasks([id])`. The coordinator's
635
+ * concurrency limit applies — the task may queue before running.
636
+ */
637
+ assign(task: TaskSpec): Promise<string>;
638
+ /**
639
+ * Assign infrastructure-owned work directly to the coordinator without
640
+ * manifest/session/checkpoint bookkeeping. The task still uses the normal
641
+ * subagent runner, budget, and completion events, but it is excluded from
642
+ * rollups and persisted fleet task history.
643
+ */
644
+ assignInternal(task: TaskSpec): Promise<string>;
645
+ /**
646
+ * Block until every task id resolves. Returns results in the same
647
+ * order as the input. If any task hasn't completed by the time this
648
+ * is called, the promise hangs until it does — pair with a timeout
649
+ * at the caller if that's a concern. Resolves immediately for ids
650
+ * whose results were already cached.
651
+ */
652
+ awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
653
+ /**
654
+ * Wait until AT LEAST ONE of the named tasks completes, then return every
655
+ * requested result already cached plus the still-pending ids. This is the
656
+ * leader's "handle whichever finishes next" primitive — unlike
657
+ * `awaitTasks` it never blocks on the slowest sibling, and the siblings
658
+ * that complete later still reach the leader through the fire-and-forget
659
+ * report-back (see the consumed-in-band rule in `taskCompletedListener`).
660
+ *
661
+ * Deliberately does NOT register `taskWaiters` entries for the pending
662
+ * ids: a `taskWaiters` entry would mark those results as in-band-consumed
663
+ * and silence the mailbox notifier for results this caller never receives.
664
+ *
665
+ * With `timeoutMs`, resolves (never rejects) `{timedOut: true}` and zero
666
+ * completions when the window elapses first.
667
+ */
668
+ awaitTasksAny(taskIds: string[], opts?: {
669
+ timeoutMs?: number;
670
+ }): Promise<AwaitAnyResult>;
671
+ /** Defensive snapshot of tasks still queued (not yet dispatched). */
672
+ listPendingTasks(): readonly TaskSpec[];
673
+ /**
674
+ * Re-pin a still-pending task to a different subagent (`undefined` =
675
+ * unpin) — the rebalancing primitive used by the FleetSupervisor and
676
+ * available to hosts. Only queued tasks can move; a dispatched task
677
+ * returns `false` (steer or terminate its worker instead). Keeps
678
+ * ownership bookkeeping (taskOwners, checkpoint, fleet manifest) in
679
+ * sync with the coordinator's queue.
680
+ */
681
+ retargetPendingTask(taskId: string, subagentId: string | undefined): boolean;
682
+ terminate(subagentId: string): Promise<void>;
683
+ terminateAll(): Promise<void>;
684
+ remove(subagentId: string): Promise<void>;
685
+ private clearSubagentIdleRetirement;
686
+ /**
687
+ * Arm one lifecycle timer per worker. The callback re-checks coordinator
688
+ * state so a task assigned in the same turn always wins over retirement.
689
+ */
690
+ private armSubagentIdleRetirement;
691
+ status(): CoordinatorStatus;
692
+ /**
693
+ * Subscribe to coordinator events. Currently only `task.completed` is
694
+ * exposed (the others are internal lifecycle). Returns an unsubscribe
695
+ * function. External callers (e.g. the CLI's `MultiAgentHost`) use this
696
+ * to drive their own pending/results tracking without poking the
697
+ * coordinator directly.
698
+ */
699
+ on(event: 'task.completed', handler: (payload: {
700
+ task: TaskSpec;
701
+ result: TaskResult;
702
+ }) => void): () => void;
703
+ /**
704
+ * Snapshot of every task that has resolved (success, failed, timeout,
705
+ * stopped) since the director started. Returned in completion order
706
+ * via the internal map's iteration order. Used by `/fleet status` to
707
+ * paint the completed table without reaching into private state.
708
+ */
709
+ completedResults(): TaskResult[];
710
+ /**
711
+ * Inject a previously-saved checkpoint snapshot. Call this right after
712
+ * constructing a Director during a `--resume` run so the in-memory state
713
+ * (subagents, tasks, waiters) reflects the pre-crash reality instead of
714
+ * starting from a blank slate. The director then resumes from there —
715
+ * completing any in-flight tasks and ignoring tasks that already reached
716
+ * a terminal state in the prior run.
717
+ */
718
+ setCheckpointState(snapshot: DirectorStateSnapshot): void;
719
+ /**
720
+ * Read a subagent's JSONL transcript directly from disk (no bridge
721
+ * round-trip needed). Returns the last assistant text, stop reason,
722
+ * tool-use count, and line count — or null if the file is unavailable.
723
+ * Requires `sessionsRoot` to be set on construction.
724
+ */
725
+ readSession(subagentId: string, tail?: number | undefined): Promise<{
726
+ lastAssistantText?: string | undefined;
727
+ lastStopReason?: string | undefined;
728
+ toolUsesObserved: number;
729
+ events: number;
730
+ path?: string | undefined;
731
+ } | null>;
732
+ snapshot(): FleetUsage;
733
+ /**
734
+ * Look up provider/model metadata for a spawned subagent. Returns
735
+ * undefined when the subagent id is unknown (not yet spawned, or
736
+ * already torn down). Callers — notably the TUI fleet panel — use
737
+ * this to render human-readable provider/model tags next to each
738
+ * subagent row without reaching into private state.
739
+ */
740
+ getSubagentMeta(id: string): {
741
+ provider?: string | undefined;
742
+ model?: string | undefined;
743
+ name?: string | undefined;
744
+ } | undefined;
745
+ /**
746
+ * Compose the leader/director-agent system prompt: fleet preamble +
747
+ * (optional) roster summary + user base prompt. Pass the result to your
748
+ * leader Agent's `ctx.systemPrompt` when constructing it.
749
+ *
750
+ * `basePrompt` defaults to `config.leaderSystemPrompt` so callers can
751
+ * use the no-arg form when the multi-agent config already carries it.
752
+ */
753
+ leaderSystemPrompt(basePrompt?: string): string;
754
+ /**
755
+ * Compose a subagent's system prompt for a given `SubagentConfig`:
756
+ * baseline + role + task + per-spawn override. Returned by value — does
757
+ * not mutate the config. Factories (the user-supplied `AgentFactory`)
758
+ * should call this when building each subagent's Agent so the bridge
759
+ * contract, role context, and override are all surfaced.
760
+ *
761
+ * When `taskBrief` is omitted the Task section is dropped. Pass the
762
+ * actual task description here to reinforce it in the system prompt
763
+ * (the runner already passes it as user input — duplicating in the
764
+ * system prompt is optional but improves anchoring on small models).
765
+ */
766
+ subagentSystemPrompt(config: SubagentConfig, taskBrief?: string): string;
767
+ /**
768
+ * Build the tool set the LLM-driven director uses to orchestrate.
769
+ * Returns an array of `Tool` definitions; register these on the
770
+ * director's `Agent` to expose `spawn_subagent`, `assign_task`, etc.
771
+ * Each tool's `execute()` delegates straight to the matching method
772
+ * above.
773
+ *
774
+ * Tools all carry `permission: 'auto'` — the *user* has already
775
+ * approved running the director when they kicked off the run, so
776
+ * gating individual orchestration calls behind a confirm prompt
777
+ * would just be noise. The actual subagent tools they spawn are
778
+ * still permission-checked normally.
779
+ */
780
+ tools(roster?: Record<string, SubagentConfig>): Tool[];
781
+ /**
782
+ * Attempt to acquire the checkpoint lock. Must be called before
783
+ * resuming — if another director process is alive, this returns
784
+ * false and the caller should not proceed with the resume.
785
+ */
786
+ acquireCheckpointLock(): Promise<boolean>;
787
+ /**
788
+ * Start a collaborative debugging session: BugHunter, RefactorPlanner,
789
+ * and Critic run in parallel on the same target files, with findings
790
+ * flowing through the FleetBus (bug.found → refactor.plan →
791
+ * critic.evaluation). Returns a structured CollabDebugReport when all
792
+ * three agents complete or the session times out.
793
+ */
794
+ spawnCollab(options: CollabSessionOptions): Promise<CollabDebugReport>;
795
+ /**
796
+ * Resume from a prior checkpoint snapshot (loaded via
797
+ * `loadDirectorState()`). Re-attach to the fleet mid-flight so
798
+ * subsequent spawn/assign calls update the checkpoint normally.
799
+ */
800
+ resumeFromCheckpoint(snapshot: DirectorStateSnapshot): void;
801
+ }
802
+ //# sourceMappingURL=director.d.ts.map