@telora/daemon 0.19.47 → 0.19.74

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 (529) hide show
  1. package/build-info.json +6 -3
  2. package/dist/assembly-engine.d.ts +9 -0
  3. package/dist/assembly-engine.d.ts.map +1 -1
  4. package/dist/assembly-engine.js.map +1 -1
  5. package/dist/audit-hooks.js +1 -1
  6. package/dist/branch-status.js +2 -2
  7. package/dist/branch-status.js.map +1 -1
  8. package/dist/ci-sensor-loop.d.ts +47 -0
  9. package/dist/ci-sensor-loop.d.ts.map +1 -0
  10. package/dist/ci-sensor-loop.js +116 -0
  11. package/dist/ci-sensor-loop.js.map +1 -0
  12. package/dist/ci-status-git.d.ts +52 -0
  13. package/dist/ci-status-git.d.ts.map +1 -0
  14. package/dist/ci-status-git.js +86 -0
  15. package/dist/ci-status-git.js.map +1 -0
  16. package/dist/ci-status.d.ts +122 -0
  17. package/dist/ci-status.d.ts.map +1 -0
  18. package/dist/ci-status.js +114 -0
  19. package/dist/ci-status.js.map +1 -0
  20. package/dist/cli/connect/agents.d.ts +24 -0
  21. package/dist/cli/connect/agents.d.ts.map +1 -0
  22. package/dist/cli/connect/agents.js +65 -0
  23. package/dist/cli/connect/agents.js.map +1 -0
  24. package/dist/cli/connect/claude.d.ts +31 -0
  25. package/dist/cli/connect/claude.d.ts.map +1 -0
  26. package/dist/cli/connect/claude.js +104 -0
  27. package/dist/cli/connect/claude.js.map +1 -0
  28. package/dist/cli/connect/cline.d.ts +37 -0
  29. package/dist/cli/connect/cline.d.ts.map +1 -0
  30. package/dist/cli/connect/cline.js +115 -0
  31. package/dist/cli/connect/cline.js.map +1 -0
  32. package/dist/cli/connect/codex.d.ts +44 -0
  33. package/dist/cli/connect/codex.d.ts.map +1 -0
  34. package/dist/cli/connect/codex.js +111 -0
  35. package/dist/cli/connect/codex.js.map +1 -0
  36. package/dist/cli/connect/ide.d.ts +69 -0
  37. package/dist/cli/connect/ide.d.ts.map +1 -0
  38. package/dist/cli/connect/ide.js +134 -0
  39. package/dist/cli/connect/ide.js.map +1 -0
  40. package/dist/cli/connect/scaffolding.d.ts +31 -0
  41. package/dist/cli/connect/scaffolding.d.ts.map +1 -0
  42. package/dist/cli/connect/scaffolding.js +52 -0
  43. package/dist/cli/connect/scaffolding.js.map +1 -0
  44. package/dist/cli/connect/shared.d.ts +30 -0
  45. package/dist/cli/connect/shared.d.ts.map +1 -0
  46. package/dist/cli/connect/shared.js +11 -0
  47. package/dist/cli/connect/shared.js.map +1 -0
  48. package/dist/cli/connect.d.ts +9 -210
  49. package/dist/cli/connect.d.ts.map +1 -1
  50. package/dist/cli/connect.js +10 -526
  51. package/dist/cli/connect.js.map +1 -1
  52. package/dist/cli/open.js +2 -2
  53. package/dist/completion/event.d.ts +2 -0
  54. package/dist/completion/event.d.ts.map +1 -1
  55. package/dist/completion/event.js +19 -2
  56. package/dist/completion/event.js.map +1 -1
  57. package/dist/completion/merge-phase.d.ts +3 -0
  58. package/dist/completion/merge-phase.d.ts.map +1 -1
  59. package/dist/completion/merge-phase.js +35 -3
  60. package/dist/completion/merge-phase.js.map +1 -1
  61. package/dist/completion/read-only-pristine.d.ts +1 -1
  62. package/dist/completion/read-only-pristine.d.ts.map +1 -1
  63. package/dist/completion/read-only-pristine.js +1 -1
  64. package/dist/completion/read-only-pristine.js.map +1 -1
  65. package/dist/completion/review-exit-phase.d.ts +30 -3
  66. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  67. package/dist/completion/review-exit-phase.js +203 -15
  68. package/dist/completion/review-exit-phase.js.map +1 -1
  69. package/dist/completion/status-advance-phase.js +1 -1
  70. package/dist/completion/status-advance-phase.js.map +1 -1
  71. package/dist/completion/team-completion.d.ts.map +1 -1
  72. package/dist/completion/team-completion.js +22 -2
  73. package/dist/completion/team-completion.js.map +1 -1
  74. package/dist/completion/team-lifecycle.js +1 -1
  75. package/dist/completion/terminated-work-reconcile.js +1 -1
  76. package/dist/completion/terminated-work-reconcile.js.map +1 -1
  77. package/dist/condition-evaluators.d.ts +41 -2
  78. package/dist/condition-evaluators.d.ts.map +1 -1
  79. package/dist/condition-evaluators.js +37 -288
  80. package/dist/condition-evaluators.js.map +1 -1
  81. package/dist/context-audit.d.ts +1 -1
  82. package/dist/context-audit.d.ts.map +1 -1
  83. package/dist/context-lock.d.ts +1 -1
  84. package/dist/context-lock.d.ts.map +1 -1
  85. package/dist/control-state.d.ts +2 -2
  86. package/dist/control-state.d.ts.map +1 -1
  87. package/dist/control-state.js +4 -3
  88. package/dist/control-state.js.map +1 -1
  89. package/dist/daemon-process.d.ts +1 -1
  90. package/dist/daemon-process.d.ts.map +1 -1
  91. package/dist/delivery-advance-block.d.ts +1 -1
  92. package/dist/delivery-advance-block.d.ts.map +1 -1
  93. package/dist/delivery-advance-block.js +1 -1
  94. package/dist/delivery-advance-block.js.map +1 -1
  95. package/dist/delivery-lifecycle.js +1 -1
  96. package/dist/delivery-reconciler-shadow.d.ts +1 -1
  97. package/dist/delivery-reconciler-shadow.d.ts.map +1 -1
  98. package/dist/delivery-reconciler-shadow.js +1 -1
  99. package/dist/delivery-reconciler-shadow.js.map +1 -1
  100. package/dist/directive-executor.js +1 -1
  101. package/dist/directive-executor.js.map +1 -1
  102. package/dist/drift-eval-loop.d.ts.map +1 -1
  103. package/dist/drift-eval-loop.js +6 -14
  104. package/dist/drift-eval-loop.js.map +1 -1
  105. package/dist/escalations.d.ts +1 -1
  106. package/dist/escalations.d.ts.map +1 -1
  107. package/dist/escalations.js +1 -1
  108. package/dist/escalations.js.map +1 -1
  109. package/dist/evaluation-context.d.ts +2 -33
  110. package/dist/evaluation-context.d.ts.map +1 -1
  111. package/dist/evaluation-context.js +2 -56
  112. package/dist/evaluation-context.js.map +1 -1
  113. package/dist/focus-engine.d.ts +14 -5
  114. package/dist/focus-engine.d.ts.map +1 -1
  115. package/dist/focus-engine.js +35 -289
  116. package/dist/focus-engine.js.map +1 -1
  117. package/dist/focus-executor.d.ts +10 -791
  118. package/dist/focus-executor.d.ts.map +1 -1
  119. package/dist/focus-executor.js +42 -1568
  120. package/dist/focus-executor.js.map +1 -1
  121. package/dist/focus-lifecycle.js +2 -2
  122. package/dist/focus-lifecycle.js.map +1 -1
  123. package/dist/focus-loop-registry.d.ts +52 -0
  124. package/dist/focus-loop-registry.d.ts.map +1 -0
  125. package/dist/focus-loop-registry.js +328 -0
  126. package/dist/focus-loop-registry.js.map +1 -0
  127. package/dist/focus-merge.d.ts +1 -1
  128. package/dist/focus-merge.d.ts.map +1 -1
  129. package/dist/focus-merge.js +3 -3
  130. package/dist/focus-merge.js.map +1 -1
  131. package/dist/focus-phase.d.ts +4 -0
  132. package/dist/focus-phase.d.ts.map +1 -1
  133. package/dist/focus-phase.js +3 -3
  134. package/dist/focus-phase.js.map +1 -1
  135. package/dist/focus-stage-lifecycle/planning-release.d.ts +197 -0
  136. package/dist/focus-stage-lifecycle/planning-release.d.ts.map +1 -0
  137. package/dist/focus-stage-lifecycle/planning-release.js +312 -0
  138. package/dist/focus-stage-lifecycle/planning-release.js.map +1 -0
  139. package/dist/focus-stage-lifecycle/review-convergence.d.ts +133 -0
  140. package/dist/focus-stage-lifecycle/review-convergence.d.ts.map +1 -0
  141. package/dist/focus-stage-lifecycle/review-convergence.js +235 -0
  142. package/dist/focus-stage-lifecycle/review-convergence.js.map +1 -0
  143. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +133 -0
  144. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -0
  145. package/dist/focus-stage-lifecycle/wedge-watchdog.js +365 -0
  146. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -0
  147. package/dist/focus-stage-lifecycle.d.ts +22 -421
  148. package/dist/focus-stage-lifecycle.d.ts.map +1 -1
  149. package/dist/focus-stage-lifecycle.js +24 -832
  150. package/dist/focus-stage-lifecycle.js.map +1 -1
  151. package/dist/{git-activity.d.ts → git/activity.d.ts} +1 -1
  152. package/dist/git/activity.d.ts.map +1 -0
  153. package/dist/{git-activity.js → git/activity.js} +2 -2
  154. package/dist/git/activity.js.map +1 -0
  155. package/dist/{git-branch.d.ts → git/branch.d.ts} +2 -2
  156. package/dist/git/branch.d.ts.map +1 -0
  157. package/dist/{git-branch.js → git/branch.js} +2 -2
  158. package/dist/git/branch.js.map +1 -0
  159. package/dist/{git-fetch.d.ts → git/fetch.d.ts} +2 -2
  160. package/dist/git/fetch.d.ts.map +1 -0
  161. package/dist/{git-fetch.js → git/fetch.js} +1 -1
  162. package/dist/git/fetch.js.map +1 -0
  163. package/dist/{git-genesis.d.ts → git/genesis.d.ts} +3 -3
  164. package/dist/git/genesis.d.ts.map +1 -0
  165. package/dist/{git-genesis.js → git/genesis.js} +5 -5
  166. package/dist/git/genesis.js.map +1 -0
  167. package/dist/git/index.d.ts +36 -0
  168. package/dist/git/index.d.ts.map +1 -0
  169. package/dist/git/index.js +36 -0
  170. package/dist/git/index.js.map +1 -0
  171. package/dist/{git-integration.d.ts → git/integration.d.ts} +2 -2
  172. package/dist/git/integration.d.ts.map +1 -0
  173. package/dist/{git-integration.js → git/integration.js} +4 -4
  174. package/dist/git/integration.js.map +1 -0
  175. package/dist/{git-merge-helpers.d.ts → git/merge-helpers.d.ts} +3 -3
  176. package/dist/git/merge-helpers.d.ts.map +1 -0
  177. package/dist/{git-merge-helpers.js → git/merge-helpers.js} +3 -3
  178. package/dist/git/merge-helpers.js.map +1 -0
  179. package/dist/{git-merge-lock.d.ts → git/merge-lock.d.ts} +1 -1
  180. package/dist/git/merge-lock.d.ts.map +1 -0
  181. package/dist/{git-merge-lock.js → git/merge-lock.js} +1 -1
  182. package/dist/git/merge-lock.js.map +1 -0
  183. package/dist/{git-merge-strategies.d.ts → git/merge-strategies.d.ts} +2 -2
  184. package/dist/git/merge-strategies.d.ts.map +1 -0
  185. package/dist/{git-merge-strategies.js → git/merge-strategies.js} +3 -3
  186. package/dist/git/merge-strategies.js.map +1 -0
  187. package/dist/{git-merge.d.ts → git/merge.d.ts} +4 -4
  188. package/dist/git/merge.d.ts.map +1 -0
  189. package/dist/{git-merge.js → git/merge.js} +4 -4
  190. package/dist/git/merge.js.map +1 -0
  191. package/dist/{git-state-detector.d.ts → git/state-detector.d.ts} +2 -2
  192. package/dist/git/state-detector.d.ts.map +1 -0
  193. package/dist/{git-state-detector.js → git/state-detector.js} +7 -7
  194. package/dist/git/state-detector.js.map +1 -0
  195. package/dist/{git-types.d.ts → git/types.d.ts} +2 -2
  196. package/dist/git/types.d.ts.map +1 -0
  197. package/dist/{git-types.js → git/types.js} +1 -1
  198. package/dist/git/types.js.map +1 -0
  199. package/dist/{git-utils.d.ts → git/utils.d.ts} +1 -1
  200. package/dist/git/utils.d.ts.map +1 -0
  201. package/dist/{git-utils.js → git/utils.js} +2 -2
  202. package/dist/git/utils.js.map +1 -0
  203. package/dist/git.d.ts +5 -5
  204. package/dist/git.d.ts.map +1 -1
  205. package/dist/git.js +10 -10
  206. package/dist/git.js.map +1 -1
  207. package/dist/guard-engine.d.ts +3 -2
  208. package/dist/guard-engine.d.ts.map +1 -1
  209. package/dist/guard-engine.js +2 -2
  210. package/dist/guard-engine.js.map +1 -1
  211. package/dist/install-probe-tick.d.ts +63 -0
  212. package/dist/install-probe-tick.d.ts.map +1 -0
  213. package/dist/install-probe-tick.js +137 -0
  214. package/dist/install-probe-tick.js.map +1 -0
  215. package/dist/install-probe.d.ts +115 -0
  216. package/dist/install-probe.d.ts.map +1 -0
  217. package/dist/install-probe.js +197 -0
  218. package/dist/install-probe.js.map +1 -0
  219. package/dist/listener-auto-advance.d.ts.map +1 -1
  220. package/dist/listener-auto-advance.js +31 -0
  221. package/dist/listener-auto-advance.js.map +1 -1
  222. package/dist/listener.js +5 -5
  223. package/dist/listener.js.map +1 -1
  224. package/dist/{loop-context-audit-pass.d.ts → loops/context-audit-pass.d.ts} +4 -4
  225. package/dist/loops/context-audit-pass.d.ts.map +1 -0
  226. package/dist/{loop-context-audit-pass.js → loops/context-audit-pass.js} +7 -7
  227. package/dist/loops/context-audit-pass.js.map +1 -0
  228. package/dist/{loop-engine-types.d.ts → loops/engine-types.d.ts} +1 -1
  229. package/dist/loops/engine-types.d.ts.map +1 -0
  230. package/dist/{loop-engine-types.js → loops/engine-types.js} +1 -1
  231. package/dist/loops/engine-types.js.map +1 -0
  232. package/dist/{loop-engine.d.ts → loops/engine.d.ts} +6 -6
  233. package/dist/loops/engine.d.ts.map +1 -0
  234. package/dist/{loop-engine.js → loops/engine.js} +13 -13
  235. package/dist/loops/engine.js.map +1 -0
  236. package/dist/{loop-event-bus.d.ts → loops/event-bus.d.ts} +1 -1
  237. package/dist/loops/event-bus.d.ts.map +1 -0
  238. package/dist/{loop-event-bus.js → loops/event-bus.js} +1 -1
  239. package/dist/loops/event-bus.js.map +1 -0
  240. package/dist/loops/index.d.ts +33 -0
  241. package/dist/loops/index.d.ts.map +1 -0
  242. package/dist/loops/index.js +32 -0
  243. package/dist/loops/index.js.map +1 -0
  244. package/dist/{loop-llm-client.d.ts → loops/llm-client.d.ts} +3 -3
  245. package/dist/loops/llm-client.d.ts.map +1 -0
  246. package/dist/{loop-llm-client.js → loops/llm-client.js} +3 -3
  247. package/dist/loops/llm-client.js.map +1 -0
  248. package/dist/{loop-llm-flag.d.ts → loops/llm-flag.d.ts} +1 -1
  249. package/dist/loops/llm-flag.d.ts.map +1 -0
  250. package/dist/{loop-llm-flag.js → loops/llm-flag.js} +1 -1
  251. package/dist/loops/llm-flag.js.map +1 -0
  252. package/dist/{loop-operational-block.d.ts → loops/operational-block.d.ts} +1 -1
  253. package/dist/loops/operational-block.d.ts.map +1 -0
  254. package/dist/{loop-operational-block.js → loops/operational-block.js} +1 -1
  255. package/dist/loops/operational-block.js.map +1 -0
  256. package/dist/{loop-prompt-builder.d.ts → loops/prompt-builder.d.ts} +2 -2
  257. package/dist/loops/prompt-builder.d.ts.map +1 -0
  258. package/dist/{loop-prompt-builder.js → loops/prompt-builder.js} +1 -1
  259. package/dist/loops/prompt-builder.js.map +1 -0
  260. package/dist/{loop-variance.d.ts → loops/variance.d.ts} +1 -1
  261. package/dist/loops/variance.d.ts.map +1 -0
  262. package/dist/{loop-variance.js → loops/variance.js} +1 -1
  263. package/dist/loops/variance.js.map +1 -0
  264. package/dist/merge-back-loop.d.ts.map +1 -1
  265. package/dist/merge-back-loop.js +4 -3
  266. package/dist/merge-back-loop.js.map +1 -1
  267. package/dist/merge-detector.js +2 -2
  268. package/dist/merge-detector.js.map +1 -1
  269. package/dist/{nexus-endpoint-clearance.d.ts → nexus/endpoint-clearance.d.ts} +2 -2
  270. package/dist/nexus/endpoint-clearance.d.ts.map +1 -0
  271. package/dist/{nexus-endpoint-clearance.js → nexus/endpoint-clearance.js} +2 -2
  272. package/dist/nexus/endpoint-clearance.js.map +1 -0
  273. package/dist/{nexus-escalation-bridge.d.ts → nexus/escalation-bridge.d.ts} +1 -1
  274. package/dist/nexus/escalation-bridge.d.ts.map +1 -0
  275. package/dist/{nexus-escalation-bridge.js → nexus/escalation-bridge.js} +2 -2
  276. package/dist/nexus/escalation-bridge.js.map +1 -0
  277. package/dist/{nexus-incoming.d.ts → nexus/incoming.d.ts} +2 -2
  278. package/dist/nexus/incoming.d.ts.map +1 -0
  279. package/dist/{nexus-incoming.js → nexus/incoming.js} +2 -2
  280. package/dist/nexus/incoming.js.map +1 -0
  281. package/dist/nexus/index.d.ts +20 -0
  282. package/dist/nexus/index.d.ts.map +1 -0
  283. package/dist/nexus/index.js +20 -0
  284. package/dist/nexus/index.js.map +1 -0
  285. package/dist/{nexus-intake-spawn.d.ts → nexus/intake-spawn.d.ts} +3 -3
  286. package/dist/nexus/intake-spawn.d.ts.map +1 -0
  287. package/dist/{nexus-intake-spawn.js → nexus/intake-spawn.js} +1 -1
  288. package/dist/nexus/intake-spawn.js.map +1 -0
  289. package/dist/{nexus-intake.d.ts → nexus/intake.d.ts} +2 -2
  290. package/dist/nexus/intake.d.ts.map +1 -0
  291. package/dist/{nexus-intake.js → nexus/intake.js} +4 -4
  292. package/dist/nexus/intake.js.map +1 -0
  293. package/dist/{nexus-return.d.ts → nexus/return.d.ts} +3 -3
  294. package/dist/nexus/return.d.ts.map +1 -0
  295. package/dist/{nexus-return.js → nexus/return.js} +4 -4
  296. package/dist/nexus/return.js.map +1 -0
  297. package/dist/otlp/index.d.ts +19 -0
  298. package/dist/otlp/index.d.ts.map +1 -0
  299. package/dist/otlp/index.js +19 -0
  300. package/dist/otlp/index.js.map +1 -0
  301. package/dist/{otlp-log-parser.d.ts → otlp/log-parser.d.ts} +2 -2
  302. package/dist/otlp/log-parser.d.ts.map +1 -0
  303. package/dist/{otlp-log-parser.js → otlp/log-parser.js} +5 -6
  304. package/dist/otlp/log-parser.js.map +1 -0
  305. package/dist/{otlp-metric-parser.d.ts → otlp/metric-parser.d.ts} +2 -2
  306. package/dist/otlp/metric-parser.d.ts.map +1 -0
  307. package/dist/{otlp-metric-parser.js → otlp/metric-parser.js} +4 -5
  308. package/dist/otlp/metric-parser.js.map +1 -0
  309. package/dist/{otlp-port-manager.d.ts → otlp/port-manager.d.ts} +1 -1
  310. package/dist/otlp/port-manager.d.ts.map +1 -0
  311. package/dist/{otlp-port-manager.js → otlp/port-manager.js} +1 -1
  312. package/dist/otlp/port-manager.js.map +1 -0
  313. package/dist/{otlp-receiver.d.ts → otlp/receiver.d.ts} +2 -2
  314. package/dist/otlp/receiver.d.ts.map +1 -0
  315. package/dist/{otlp-receiver.js → otlp/receiver.js} +5 -33
  316. package/dist/otlp/receiver.js.map +1 -0
  317. package/dist/{otlp-types.d.ts → otlp/types.d.ts} +1 -9
  318. package/dist/otlp/types.d.ts.map +1 -0
  319. package/dist/{otlp-types.js → otlp/types.js} +1 -27
  320. package/dist/otlp/types.js.map +1 -0
  321. package/dist/pipeline-config.d.ts +1 -1
  322. package/dist/{prd-controller.d.ts → prd/controller.d.ts} +7 -7
  323. package/dist/prd/controller.d.ts.map +1 -0
  324. package/dist/{prd-controller.js → prd/controller.js} +11 -11
  325. package/dist/prd/controller.js.map +1 -0
  326. package/dist/{prd-divergence.d.ts → prd/divergence.d.ts} +2 -2
  327. package/dist/prd/divergence.d.ts.map +1 -0
  328. package/dist/{prd-divergence.js → prd/divergence.js} +1 -1
  329. package/dist/prd/divergence.js.map +1 -0
  330. package/dist/{prd-focus-pushdown.d.ts → prd/focus-pushdown.d.ts} +2 -2
  331. package/dist/prd/focus-pushdown.d.ts.map +1 -0
  332. package/dist/{prd-focus-pushdown.js → prd/focus-pushdown.js} +3 -3
  333. package/dist/prd/focus-pushdown.js.map +1 -0
  334. package/dist/{prd-frontier.d.ts → prd/frontier.d.ts} +2 -2
  335. package/dist/prd/frontier.d.ts.map +1 -0
  336. package/dist/{prd-frontier.js → prd/frontier.js} +1 -1
  337. package/dist/prd/frontier.js.map +1 -0
  338. package/dist/prd/index.d.ts +26 -0
  339. package/dist/prd/index.d.ts.map +1 -0
  340. package/dist/prd/index.js +25 -0
  341. package/dist/prd/index.js.map +1 -0
  342. package/dist/{prd-steward.d.ts → prd/steward.d.ts} +4 -4
  343. package/dist/prd/steward.d.ts.map +1 -0
  344. package/dist/{prd-steward.js → prd/steward.js} +4 -4
  345. package/dist/prd/steward.js.map +1 -0
  346. package/dist/{prd-viability.d.ts → prd/viability.d.ts} +2 -2
  347. package/dist/prd/viability.d.ts.map +1 -0
  348. package/dist/{prd-viability.js → prd/viability.js} +1 -1
  349. package/dist/prd/viability.js.map +1 -0
  350. package/dist/product-scaffold.js +2 -2
  351. package/dist/product-scaffold.js.map +1 -1
  352. package/dist/prompt-sections/persona-sections.d.ts +12 -0
  353. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  354. package/dist/prompt-sections/persona-sections.js +29 -2
  355. package/dist/prompt-sections/persona-sections.js.map +1 -1
  356. package/dist/queries/context-lock-queries.js +1 -1
  357. package/dist/queries/context-lock-queries.js.map +1 -1
  358. package/dist/queries/deliveries.d.ts +15 -0
  359. package/dist/queries/deliveries.d.ts.map +1 -1
  360. package/dist/queries/deliveries.js +2 -0
  361. package/dist/queries/deliveries.js.map +1 -1
  362. package/dist/queries/focuses.d.ts +17 -0
  363. package/dist/queries/focuses.d.ts.map +1 -1
  364. package/dist/queries/focuses.js +27 -0
  365. package/dist/queries/focuses.js.map +1 -1
  366. package/dist/queries/schemas.d.ts +4 -0
  367. package/dist/queries/schemas.d.ts.map +1 -1
  368. package/dist/queries/schemas.js +8 -0
  369. package/dist/queries/schemas.js.map +1 -1
  370. package/dist/reality-pole.js +1 -1
  371. package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
  372. package/dist/resolvers/git-diff-against-base.js +4 -1
  373. package/dist/resolvers/git-diff-against-base.js.map +1 -1
  374. package/dist/resolvers/prd-context.js +1 -1
  375. package/dist/sensor-sweep.js +1 -1
  376. package/dist/spawn/model-routing.d.ts +277 -0
  377. package/dist/spawn/model-routing.d.ts.map +1 -0
  378. package/dist/spawn/model-routing.js +464 -0
  379. package/dist/spawn/model-routing.js.map +1 -0
  380. package/dist/spawn/process-spawn.d.ts +128 -0
  381. package/dist/spawn/process-spawn.d.ts.map +1 -0
  382. package/dist/spawn/process-spawn.js +378 -0
  383. package/dist/spawn/process-spawn.js.map +1 -0
  384. package/dist/spawn/prompt-assembly.d.ts +143 -0
  385. package/dist/spawn/prompt-assembly.d.ts.map +1 -0
  386. package/dist/spawn/prompt-assembly.js +263 -0
  387. package/dist/spawn/prompt-assembly.js.map +1 -0
  388. package/dist/spawn/shared.d.ts +72 -0
  389. package/dist/spawn/shared.d.ts.map +1 -0
  390. package/dist/spawn/shared.js +14 -0
  391. package/dist/spawn/shared.js.map +1 -0
  392. package/dist/spawn/spawn-decision.d.ts +189 -0
  393. package/dist/spawn/spawn-decision.d.ts.map +1 -0
  394. package/dist/spawn/spawn-decision.js +361 -0
  395. package/dist/spawn/spawn-decision.js.map +1 -0
  396. package/dist/spawn/worktree-session.d.ts +105 -0
  397. package/dist/spawn/worktree-session.d.ts.map +1 -0
  398. package/dist/spawn/worktree-session.js +216 -0
  399. package/dist/spawn/worktree-session.js.map +1 -0
  400. package/dist/spawner/lifecycle.js +2 -2
  401. package/dist/spawner/lifecycle.js.map +1 -1
  402. package/dist/spawner/resolution.js +1 -1
  403. package/dist/stall-detector-config.d.ts +4 -0
  404. package/dist/stall-detector-config.d.ts.map +1 -1
  405. package/dist/stall-detector-config.js +6 -0
  406. package/dist/stall-detector-config.js.map +1 -1
  407. package/dist/state-cascade.js +1 -1
  408. package/dist/state-cascade.js.map +1 -1
  409. package/dist/trigger-executor.d.ts +5 -9
  410. package/dist/trigger-executor.d.ts.map +1 -1
  411. package/dist/trigger-executor.js +14 -36
  412. package/dist/trigger-executor.js.map +1 -1
  413. package/dist/types/focus.d.ts +13 -0
  414. package/dist/types/focus.d.ts.map +1 -1
  415. package/dist/types/workflow.d.ts +1 -3
  416. package/dist/types/workflow.d.ts.map +1 -1
  417. package/dist/unified-engine-lifecycle.js +1 -1
  418. package/dist/unified-init.d.ts +3 -3
  419. package/dist/unified-init.d.ts.map +1 -1
  420. package/dist/unified-init.js +9 -25
  421. package/dist/unified-init.js.map +1 -1
  422. package/dist/unified-shell.d.ts +3 -3
  423. package/dist/unified-shell.js +4 -4
  424. package/dist/unified-shell.js.map +1 -1
  425. package/dist/verification-engine.d.ts.map +1 -1
  426. package/dist/verification-engine.js +15 -0
  427. package/dist/verification-engine.js.map +1 -1
  428. package/dist/{worktree-focus.d.ts → worktree/focus.d.ts} +2 -2
  429. package/dist/worktree/focus.d.ts.map +1 -0
  430. package/dist/{worktree-focus.js → worktree/focus.js} +7 -7
  431. package/dist/worktree/focus.js.map +1 -0
  432. package/dist/worktree/index.d.ts +16 -0
  433. package/dist/worktree/index.d.ts.map +1 -0
  434. package/dist/worktree/index.js +16 -0
  435. package/dist/worktree/index.js.map +1 -0
  436. package/dist/{worktree-safety.d.ts → worktree/safety.d.ts} +1 -1
  437. package/dist/worktree/safety.d.ts.map +1 -0
  438. package/dist/{worktree-safety.js → worktree/safety.js} +2 -2
  439. package/dist/worktree/safety.js.map +1 -0
  440. package/dist/{worktree-state.d.ts → worktree/state.d.ts} +1 -1
  441. package/dist/worktree/state.d.ts.map +1 -0
  442. package/dist/{worktree-state.js → worktree/state.js} +6 -6
  443. package/dist/worktree/state.js.map +1 -0
  444. package/dist/worktree.d.ts +1 -1
  445. package/dist/worktree.js +5 -5
  446. package/dist/worktree.js.map +1 -1
  447. package/package.json +5 -4
  448. package/dist/git-activity.d.ts.map +0 -1
  449. package/dist/git-activity.js.map +0 -1
  450. package/dist/git-branch.d.ts.map +0 -1
  451. package/dist/git-branch.js.map +0 -1
  452. package/dist/git-fetch.d.ts.map +0 -1
  453. package/dist/git-fetch.js.map +0 -1
  454. package/dist/git-genesis.d.ts.map +0 -1
  455. package/dist/git-genesis.js.map +0 -1
  456. package/dist/git-integration.d.ts.map +0 -1
  457. package/dist/git-integration.js.map +0 -1
  458. package/dist/git-merge-helpers.d.ts.map +0 -1
  459. package/dist/git-merge-helpers.js.map +0 -1
  460. package/dist/git-merge-lock.d.ts.map +0 -1
  461. package/dist/git-merge-lock.js.map +0 -1
  462. package/dist/git-merge-strategies.d.ts.map +0 -1
  463. package/dist/git-merge-strategies.js.map +0 -1
  464. package/dist/git-merge.d.ts.map +0 -1
  465. package/dist/git-merge.js.map +0 -1
  466. package/dist/git-state-detector.d.ts.map +0 -1
  467. package/dist/git-state-detector.js.map +0 -1
  468. package/dist/git-types.d.ts.map +0 -1
  469. package/dist/git-types.js.map +0 -1
  470. package/dist/git-utils.d.ts.map +0 -1
  471. package/dist/git-utils.js.map +0 -1
  472. package/dist/loop-context-audit-pass.d.ts.map +0 -1
  473. package/dist/loop-context-audit-pass.js.map +0 -1
  474. package/dist/loop-engine-types.d.ts.map +0 -1
  475. package/dist/loop-engine-types.js.map +0 -1
  476. package/dist/loop-engine.d.ts.map +0 -1
  477. package/dist/loop-engine.js.map +0 -1
  478. package/dist/loop-event-bus.d.ts.map +0 -1
  479. package/dist/loop-event-bus.js.map +0 -1
  480. package/dist/loop-llm-client.d.ts.map +0 -1
  481. package/dist/loop-llm-client.js.map +0 -1
  482. package/dist/loop-llm-flag.d.ts.map +0 -1
  483. package/dist/loop-llm-flag.js.map +0 -1
  484. package/dist/loop-operational-block.d.ts.map +0 -1
  485. package/dist/loop-operational-block.js.map +0 -1
  486. package/dist/loop-prompt-builder.d.ts.map +0 -1
  487. package/dist/loop-prompt-builder.js.map +0 -1
  488. package/dist/loop-variance.d.ts.map +0 -1
  489. package/dist/loop-variance.js.map +0 -1
  490. package/dist/nexus-endpoint-clearance.d.ts.map +0 -1
  491. package/dist/nexus-endpoint-clearance.js.map +0 -1
  492. package/dist/nexus-escalation-bridge.d.ts.map +0 -1
  493. package/dist/nexus-escalation-bridge.js.map +0 -1
  494. package/dist/nexus-incoming.d.ts.map +0 -1
  495. package/dist/nexus-incoming.js.map +0 -1
  496. package/dist/nexus-intake-spawn.d.ts.map +0 -1
  497. package/dist/nexus-intake-spawn.js.map +0 -1
  498. package/dist/nexus-intake.d.ts.map +0 -1
  499. package/dist/nexus-intake.js.map +0 -1
  500. package/dist/nexus-return.d.ts.map +0 -1
  501. package/dist/nexus-return.js.map +0 -1
  502. package/dist/otlp-log-parser.d.ts.map +0 -1
  503. package/dist/otlp-log-parser.js.map +0 -1
  504. package/dist/otlp-metric-parser.d.ts.map +0 -1
  505. package/dist/otlp-metric-parser.js.map +0 -1
  506. package/dist/otlp-port-manager.d.ts.map +0 -1
  507. package/dist/otlp-port-manager.js.map +0 -1
  508. package/dist/otlp-receiver.d.ts.map +0 -1
  509. package/dist/otlp-receiver.js.map +0 -1
  510. package/dist/otlp-types.d.ts.map +0 -1
  511. package/dist/otlp-types.js.map +0 -1
  512. package/dist/prd-controller.d.ts.map +0 -1
  513. package/dist/prd-controller.js.map +0 -1
  514. package/dist/prd-divergence.d.ts.map +0 -1
  515. package/dist/prd-divergence.js.map +0 -1
  516. package/dist/prd-focus-pushdown.d.ts.map +0 -1
  517. package/dist/prd-focus-pushdown.js.map +0 -1
  518. package/dist/prd-frontier.d.ts.map +0 -1
  519. package/dist/prd-frontier.js.map +0 -1
  520. package/dist/prd-steward.d.ts.map +0 -1
  521. package/dist/prd-steward.js.map +0 -1
  522. package/dist/prd-viability.d.ts.map +0 -1
  523. package/dist/prd-viability.js.map +0 -1
  524. package/dist/worktree-focus.d.ts.map +0 -1
  525. package/dist/worktree-focus.js.map +0 -1
  526. package/dist/worktree-safety.d.ts.map +0 -1
  527. package/dist/worktree-safety.js.map +0 -1
  528. package/dist/worktree-state.d.ts.map +0 -1
  529. package/dist/worktree-state.js.map +0 -1
@@ -27,40 +27,25 @@
27
27
  * When tracing a symbol imported from this file, check those modules first;
28
28
  * only the spawn choreography itself is implemented here.
29
29
  */
30
- import { spawn, type ChildProcessWithoutNullStreams, type SpawnOptionsWithoutStdio } from 'node:child_process';
31
30
  import type { DaemonConfig, AgentRole, FocusTeamState, PipelineConfig } from './types.js';
32
- import { createSession, type SessionType } from './supabase.js';
33
31
  import { type ResourceGovernor } from '@telora/daemon-core';
34
- import { createEscalation } from './queries/issues.js';
35
- import { type FocusTeamPromptContext } from './team-prompt-base.js';
36
- import { getFocusDeliveries, getFocusIssues, getProductContextForFocus, getProductDeploymentProfileSnapshot } from './queries/focuses.js';
37
- import { resolveLineageSpec, type SessionContinuity } from './session-lineage.js';
38
- import { consumePendingSpawnDirective } from './directive-executor.js';
39
- import { type AssemblyManifestEntry } from './assembly-engine.js';
40
32
  import './assembly-resolvers.js';
41
- import { getLocalModel, getLocalModelSecret, type LocalModelCoordinates } from './queries/local-models.js';
42
- import { writeLocalModelCodexHome } from './cli/codex-provision.js';
43
- import { type CodexMcpProxyHandle } from './backends/codex/codex-mcp-proxy.js';
44
- import { type HostCapability } from './host-control/index.js';
45
- import { setupTeamLogStreams } from './spawner/helpers.js';
46
- import { resolveBackend, type AgentBackend, type EngineOverride, type EnginePass } from './backends/index.js';
33
+ import type { SpawnFocusTeamParams } from './spawn/spawn-decision.js';
34
+ export { selectLocalModelRef, codexHomeForSpawn, decideLocalModelRouting, shouldSwapForPass, resolveEffectiveModel, isClaudeModelId, selectPipelineModelForSpawn, selectDirectiveModelForSpawn, resolveLocalModelConfig, surfaceSingleHostModelConflict, resolveSpawnModel, buildAgentArgs, } from './spawn/model-routing.js';
35
+ export type { LocalModelRouting, LocalModelConfig, LocalModelConfigDeps, HostConflictSurfaceDeps, SpawnModelResolution, } from './spawn/model-routing.js';
36
+ export { buildFocusPromptContext, buildSpawnPrompt, buildSpawnMessage, resolveScopingSpawnResume, findQueuedDeliveriesWithoutTaskIssues, buildQueuedDeliveryScopingMessage, } from './spawn/prompt-assembly.js';
37
+ export type { SpawnContext, DirectiveResolution } from './spawn/shared.js';
38
+ export { createInitialTeamState, resolveSpawnWorktree, createTeamSession, resolveReviewContext, resolveEngineForPass, } from './spawn/worktree-session.js';
39
+ export { findActionableDeliveries, resolveActionableDeliveries, resolveDirectiveOrFallback, fetchSpawnContext, DEFAULT_LOOP_CONTEXT_RECIPE, } from './spawn/spawn-decision.js';
40
+ export type { SpawnDecision, ActionableResolution, SpawnFocusTeamParams } from './spawn/spawn-decision.js';
41
+ export { gateLocalModelBackendSpawn, backendUnavailableSessionUpdate, spawnCrashIsolated, persistSpawnFailureAfterRunning, closeTeamProxyQuietly, spawnTeamProcess, governorDeniedSessionUpdate, sandboxUnavailableSessionUpdate, } from './spawn/process-spawn.js';
42
+ export type { SpawnTeamProcessArgs, BackendSpawnGateResult } from './spawn/process-spawn.js';
47
43
  export { getActiveTeams, hasActiveTeam, getActiveTeamCount, } from './focus-team-state.js';
48
44
  export { mergeFocusBranch, } from './focus-merge.js';
49
45
  export { handleTeamCompletion, advanceDeliveryStatuses, isStatusTerminal, isStatusAgentActionable, } from './completion/index.js';
50
46
  export type { TeamCompletionParams } from './completion/index.js';
51
47
  export { terminateTeam, waitForTeamExit, terminateAllTeams, detectDeactivatedFocuses, checkAndMergeCompletedDeliveries, } from './completion/index.js';
52
48
  export type { CompletionEventContext } from './completion/index.js';
53
- /**
54
- * Default loop-context assembly recipe for a focus-team spawn.
55
- *
56
- * Composed once per spawn into the team prompt. `focus.endpoint_catalog`
57
- * is placed right after `focus.injections` so the exposed/consumed endpoint
58
- * catalog reads alongside the tree context -- surfacing cross-product
59
- * interrelations at scoping time (shift-left) so a dependency on another
60
- * product can be mapped into the reality tree as an externally-owned obstacle
61
- * rather than surfacing reactively as a blocked_by_external escalation.
62
- */
63
- export declare const DEFAULT_LOOP_CONTEXT_RECIPE: string[];
64
49
  /** Inject the resource governor for global concurrency limiting. */
65
50
  export declare function initGovernor(gov: ResourceGovernor): void;
66
51
  /**
@@ -69,480 +54,10 @@ export declare function initGovernor(gov: ResourceGovernor): void;
69
54
  * sets, so callers see the governor FocusEngine actually injected.
70
55
  */
71
56
  export declare function getGovernor(): ResourceGovernor | null;
72
- /**
73
- * Result of the pre-spawn guard. Discriminated union so the caller can
74
- * distinguish between "no work yet, spawn a planning team" and "actionable
75
- * deliveries are queued, run them" without conflating null with empty.
76
- */
77
- export type SpawnDecision = {
78
- kind: 'planning';
79
- } | {
80
- kind: 'execute';
81
- deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
82
- } | {
83
- kind: 'skip';
84
- };
85
- /**
86
- * Pre-spawn guard: rank-ordered walk that collects every agent-actionable
87
- * delivery into the spawn set.
88
- *
89
- * "Actionable" and "blocking" are independent properties of a status:
90
- *
91
- * - actionable = `isStatusAgentActionable(status)` -- queued | coding |
92
- * verify_failed. Work the team can pick up.
93
- * - blocking = `isStatusBlocking(status)` -- statuses that gate
94
- * subsequent ranks (queued, coding, planning, paused).
95
- *
96
- * A delivery may be actionable and blocking (queued, coding -- the common
97
- * case), actionable and non-blocking (`verify_failed` -- has remediation
98
- * work from a review pass, but the next-ranked queued delivery should not
99
- * wait on it), or non-actionable and blocking (planning, paused -- gates
100
- * the queue and the team has nothing to do here).
101
- *
102
- * Walk semantics:
103
- * - Collect every actionable delivery into the spawn set.
104
- * - Stop the walk when we hit the first blocking-and-not-actionable status
105
- * (planning, paused). Lower-ranked deliveries past this point are gated.
106
- * - Skip past non-blocking non-actionable statuses (done, cancelled, verify)
107
- * without breaking the walk.
108
- *
109
- * Returns:
110
- * - 'planning' when the focus has zero deliveries (agent will scope them).
111
- * - 'execute' with the collected actionable deliveries.
112
- * - 'skip' when the walk found zero actionable deliveries.
113
- *
114
- * Why verify_failed must be in the spawn set: the auto-review loop
115
- * routes a delivery from `verify` -> `verify_failed` when the review
116
- * agent finds remediation work, clears `review_requested_at`, and emits a
117
- * `review_completed` loop trigger. The next poll re-derives phase from
118
- * `ACTIVE_STATUSES` (which includes verify_failed), so the focus is
119
- * eligible to spawn. If this guard then skips past `verify_failed`, no
120
- * team ever picks up the remediation issues and the loop dies after the
121
- * first pass. See delivery ac5c69f7.
122
- */
123
- export declare function findActionableDeliveries(deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>, focusName: string): SpawnDecision;
124
57
  /**
125
58
  * Generate branch name for focus-level work.
126
59
  */
127
60
  export declare function generateFocusBranchName(role: AgentRole, focusName: string, focusId: string): string;
128
- /**
129
- * Resolve the isolated CODEX_HOME to set on a spawn, or undefined when none
130
- * applies. Pure + testable: only a codex-engine spawn against a product that
131
- * carries a provisioned codexHome gets the override; every other case (claude
132
- * engine, or a cloud product with no codexHome) returns undefined so the spawn
133
- * environment is byte-for-byte unchanged.
134
- */
135
- export declare function codexHomeForSpawn(engineId: string, config: {
136
- codexHome?: string;
137
- }): string | undefined;
138
- /**
139
- * Select the per-pass local model ref to resolve for this spawn, or null.
140
- *
141
- * Pure + testable. A ref applies ONLY to a codex-engine spawn. The ref resolves
142
- * under the unified Focus > Workflow > Default precedence (single-sourced in
143
- * model-resolution.resolveLocalModelRefPrecedence): the focus's per-pass
144
- * localModelOverride entry wins; absent that, the stage directive's localModel
145
- * is inherited; absent both, null (the pass runs on the engine's default model).
146
- * A claude engine or a blank ref returns null so the spawn keeps its
147
- * per-product / engine-default behavior unchanged.
148
- */
149
- export declare function selectLocalModelRef(engineId: string, pass: EnginePass, localModelOverride: Record<string, string | null> | null | undefined, stageDirectiveLocalModel?: string | null): string | null;
150
- /**
151
- * Decide what a codex spawn should do with a selected local-model ref, given the
152
- * resolved coordinates and the Telora-resolved bearer key VALUE. Pure + testable:
153
- * it holds NO I/O (the DB calls that produce `coords` and `apiKey`, and the
154
- * CODEX_HOME write / session update, happen in the caller). It only renders the
155
- * routing DECISION:
156
- *
157
- * - ref null -> { kind: 'none' } (no local model selected)
158
- * - ref set but coords null -> { kind: 'fallback' } (ref not in registry)
159
- * - coords present -> { kind: 'route' } (key optional)
160
- *
161
- * Reached only when a ref exists upstream (codex-only is already enforced by
162
- * `selectLocalModelRef`); `coords` is `getLocalModel(ref)`'s result and `apiKey`
163
- * is `getLocalModelSecret(ref)`'s result (D8: the key lives in Telora, not host env).
164
- */
165
- export type LocalModelRouting = {
166
- kind: 'none';
167
- } | {
168
- kind: 'fallback';
169
- } | {
170
- kind: 'route';
171
- coords: LocalModelCoordinates;
172
- apiKey: string | null;
173
- };
174
- export declare function decideLocalModelRouting(ref: string | null, coords: LocalModelCoordinates | null, apiKey: string | null): LocalModelRouting;
175
- /**
176
- * Pure gate: should the daemon perform a host-control model swap before this
177
- * spawn? (Local model host control, D2.) True ONLY when routing resolved a local
178
- * model for this pass AND the host advertises the optional control capability.
179
- * A non-controllable host (today's behavior: the operator pre-loads the model in
180
- * the studio) yields false -> NO swap, spawn proceeds unchanged. A pass with no
181
- * routed local model (claude, no override) also yields false. Exported so the
182
- * load-or-skip decision is unit-testable with NO HTTP.
183
- */
184
- export declare function shouldSwapForPass(input: {
185
- routing: LocalModelRouting;
186
- capability: HostCapability;
187
- }): boolean;
188
- /**
189
- * Resolve the effective model id for a spawn, applying the single team-model
190
- * precedence (focus override -> stage directive -> CLI default) via
191
- * resolveTeamModel. This is the SAME helper used at stage respawn, so the two
192
- * paths can never diverge on ordering.
193
- *
194
- * The focus-override slot folds in the selected local-Codex model: when this
195
- * pass routes to a controllable Codex home, `codexModel` IS the focus's
196
- * explicit pick and must win exactly like a focus pipeline_config.model would.
197
- * `directiveModel` has already been filtered through
198
- * selectDirectiveModelForSpawn() (nulled when the backend cannot run it, or
199
- * when a focus override is present), so it only ever reaches here as a
200
- * legitimate stage fallback.
201
- *
202
- * Pure + testable. Used by spawnFocusTeam to produce effectivePipelineConfig.model.
203
- */
204
- export declare function resolveEffectiveModel(directiveModel: string | null | undefined, spawnCodexHome: string | undefined, codexModel: string | undefined, pipelineModel: string | null | undefined): string | null;
205
- export declare function isClaudeModelId(model: string | null | undefined): boolean;
206
- /**
207
- * Select the pipeline model fallback to feed into resolveEffectiveModel().
208
- *
209
- * Hosted Codex runs through the user's Codex account. Some registry labels
210
- * exposed in the UI (for example gpt-5-codex) are not valid `codex exec
211
- * --model` values for every account, and passing them fails the run before the
212
- * agent starts. Local-model Codex still needs an explicit model, and Claude
213
- * keeps the existing pipeline model behavior.
214
- *
215
- * Engine-compat (the per-pass bleed guard): product_focuses.pipeline_config.model
216
- * is a SINGLE focus-wide value shared across passes, but each pass resolves its
217
- * own engine. A pass whose engine resolved to claude can only run a claude-family
218
- * model -- so a coding-pass codex model (e.g. gpt-5-codex) selected on the focus
219
- * must NOT bleed into a claude review pass. When it would, null it so the claude
220
- * backend picks its own default rather than receiving `--model gpt-5-codex` and
221
- * erroring out. (The symmetric codex case is handled above + by spawnCodexModel
222
- * routing; local-codex models reach the spawn via spawnCodexModel, not here.)
223
- */
224
- export declare function selectPipelineModelForSpawn(engineId: string, spawnCodexHome: string | undefined, pipelineModel: string | null | undefined): string | null;
225
- /**
226
- * Select whether a workflow directive's model may reach the backend.
227
- *
228
- * The focus pass selection is the source of truth for team launches. Stage
229
- * directives contribute prompt/context; their model field is only a legacy
230
- * fallback when the focus/pass has no selected model and the backend can run
231
- * that model. In particular, never pass a Claude directive model to Codex.
232
- */
233
- export declare function selectDirectiveModelForSpawn(engineId: string, directiveModel: string | null | undefined, focusSelectedModel: string | null | undefined): string | null;
234
- /**
235
- * Build CLI args for the team lead via the selected backend.
236
- *
237
- * Engine-specific flag construction lives in the backend; resume uses the
238
- * backend's dedicated resume-arg builder. Exported for the spawner barrel
239
- * surface (legacy ./team-spawner.js consumers).
240
- */
241
- export declare function buildAgentArgs(backend: AgentBackend, config: DaemonConfig, worktreePath: string, pipelineConfig: PipelineConfig | null, resumeSessionId?: string | null, allowedTools?: readonly string[], readOnly?: boolean): string[];
242
- export interface SpawnFocusTeamParams {
243
- config: DaemonConfig;
244
- focusId: string;
245
- focusName: string;
246
- role: AgentRole;
247
- pipelineConfig: PipelineConfig | null;
248
- readOnly?: boolean;
249
- /** Previous Claude Code session ID for --resume support (legacy single slot). */
250
- lastClaudeSessionId?: string | null;
251
- /**
252
- * Per-lineage session-id map from the focus (INJ-A). The spawn resolves its
253
- * resume id from the slot matching the lineage being spawned, so a coding
254
- * spawn never reads a slot a review spawn wrote.
255
- */
256
- claudeSessionIds?: Record<string, string> | null;
257
- /**
258
- * Per-focus engine override (per-pass map {coding, review}); null/absent =
259
- * inherit the org default. Fed into resolveBackend() (D3).
260
- */
261
- engineOverride?: EngineOverride | null;
262
- /**
263
- * Per-focus selected local model (per-pass map {coding?, review?} of
264
- * local_models ids); null/absent = no specific local model selected. When the
265
- * resolved engine for a pass is codex and this carries a ref for that pass,
266
- * the daemon resolves the ref to coordinates and routes the spawn to that
267
- * model's endpoint (D3).
268
- */
269
- localModelOverride?: Record<string, string | null> | null;
270
- /** Org-level default engine id; null/absent = the global default ('claude'). */
271
- orgDefaultEngine?: string | null;
272
- /**
273
- * Force a spawn even when findActionableDeliveries would return 'skip' (all
274
- * deliveries verify/done). Set for the escalation answer re-arm path: the
275
- * spawn's purpose is to consume a pending answer (delivered by the
276
- * escalation.answers resolver in the standard recipe), not to advance a
277
- * delivery -- so an idle/exited focus must still spawn. Mirrors the
278
- * pending-spawn-directive bypass, which likewise spawns past a 'skip'.
279
- */
280
- forceSpawn?: boolean;
281
- }
282
- /**
283
- * Phase 1 contract: everything the spawn needs that comes from the DB / assembly
284
- * layer, fetched up front. `assemblyManifest` is the live accumulator the later
285
- * phases keep appending to (directive assembly, etc.) before it is persisted.
286
- */
287
- export interface SpawnContext {
288
- deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
289
- issues: Awaited<ReturnType<typeof getFocusIssues>>;
290
- productContextDocs: Awaited<ReturnType<typeof getProductContextForFocus>>;
291
- deploymentProfileSnapshot: Awaited<ReturnType<typeof getProductDeploymentProfileSnapshot>> | null;
292
- loopContext: string;
293
- prdMilestoneContext: string;
294
- assemblyManifest: AssemblyManifestEntry[];
295
- }
296
- /**
297
- * Phase 1: fetch all spawn context (deliveries / issues / product-context /
298
- * deployment-profile / loop-context) in one Promise.all, then resolve the PRD
299
- * milestone push-down. Returns null when the context fetch rejects -- the
300
- * caller treats null as "tear down the freshly-inserted team and return"
301
- * (activeTeams.delete). The PRD push-down deliberately propagates on throw,
302
- * matching the pre-extraction behavior (it sits after the try/catch).
303
- *
304
- * Behavior-preserving extraction of the original inline block; the log lines,
305
- * the deployment-profile .catch fallback, the loop-context try/catch fallback,
306
- * and the manifest accumulation order are byte-identical.
307
- */
308
- export declare function fetchSpawnContext(config: DaemonConfig, focusId: string, focusName: string): Promise<SpawnContext | null>;
309
- /**
310
- * Phase 2 contract: the actionable-delivery decision. 'skip' tells the caller to
311
- * tear down (activeTeams.delete + return); 'proceed' carries the consumed
312
- * pending directive (used downstream in Phase A + spawn-phase tagging), the
313
- * collected actionable deliveries, and the planning-spawn flag.
314
- */
315
- export type ActionableResolution = {
316
- kind: 'skip';
317
- } | {
318
- kind: 'proceed';
319
- pendingDirective: ReturnType<typeof consumePendingSpawnDirective>;
320
- actionableDeliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
321
- isPlanningSpawn: boolean;
322
- };
323
- /**
324
- * Phase 2: consume any pending spawn directive, enforce the rank-ordered
325
- * pre-spawn guard, and record known-delivery bookkeeping on the team state.
326
- *
327
- * Mutates `teamState` exactly as the original inline block did
328
- * (lastConsumedDirectiveHash, sessionType, planningPhase, knownDeliveryIds,
329
- * deliveryStageIds, mergedDeliveryIds) and emits the same log lines. Returns
330
- * 'skip' for the findActionableDeliveries skip case (the caller owns the
331
- * activeTeams.delete + return so the team-state map stays the orchestrator's
332
- * responsibility). Behavior byte-identical.
333
- */
334
- export declare function resolveActionableDeliveries(args: {
335
- focusId: string;
336
- focusName: string;
337
- deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
338
- issues: Awaited<ReturnType<typeof getFocusIssues>>;
339
- forceSpawn: boolean;
340
- teamState: FocusTeamState;
341
- }): ActionableResolution;
342
- /**
343
- * Phase A contract: the resolved directive body + the spawn metadata derived
344
- * with it, BEFORE the prompt is built. Covers all three paths -- pending
345
- * directive, current-stage directive, legacy fallback -- in one typed result.
346
- */
347
- export interface DirectiveResolution {
348
- /** Directive content appended after the role framework; null => legacy prompt. */
349
- directiveBody: string | null;
350
- /** Directive-declared model (legacy fallback only; filtered downstream). */
351
- directiveModel: string | null;
352
- /**
353
- * Workflow stage directive engine + local-model for this spawn (the Workflow
354
- * layer of Focus > Workflow > Default on those two axes), or null. Threaded
355
- * into resolveEngineForPass (engine) and resolveSpawnModel (local model) so all
356
- * three axes inherit the stage directive when the focus does not override.
357
- */
358
- directiveEngine: string | null;
359
- directiveLocalModel: string | null;
360
- /**
361
- * Focus model override captured when a pending spawn directive (respawn) was
362
- * stored, or null. Threaded into resolveSpawnModel so respawn resolves the
363
- * team model under the SAME precedence as initial spawn (focus override ->
364
- * stage -> CLI). Null when this spawn did not come from a pending directive
365
- * (initial spawn / stage-directive path), where the live pipeline_config.model
366
- * already carries the override.
367
- */
368
- pendingFocusOverrideModel: string | null;
369
- /** Workflow stage active at spawn -- stamped as the .stage telemetry lever. */
370
- spawnStageName: string | null;
371
- /** Lineage + continuity declared by whatever fired this spawn (resolved later). */
372
- spawnDirectiveDeclared: {
373
- lineage?: string | null;
374
- continuity?: SessionContinuity | null;
375
- } | null;
376
- /** True => no usable directive; build the legacy full focus prompt. */
377
- useLegacyFullPrompt: boolean;
378
- }
379
- /**
380
- * Phase A: resolve the team-lead directive body + spawn metadata (no prompt
381
- * yet). Priority: pending spawn directive > current-stage directive > legacy
382
- * full prompt. Pushes any assembled directive manifest entries onto the shared
383
- * `assemblyManifest` accumulator.
384
- *
385
- * Behavior-preserving extraction of the original inline Phase A block -- the
386
- * "Using pending spawn directive" / "Using stage directive" log lines, the
387
- * "LEGACY PROMPT FALLBACK" warning and every fallbackReason string, and the
388
- * directive-manifest accumulation are byte-identical.
389
- */
390
- export declare function resolveDirectiveOrFallback(args: {
391
- config: DaemonConfig;
392
- focusId: string;
393
- focusName: string;
394
- worktreePath: string;
395
- pendingDirective: ReturnType<typeof consumePendingSpawnDirective>;
396
- assemblyManifest: AssemblyManifestEntry[];
397
- }): Promise<DirectiveResolution>;
398
- /**
399
- * Phase C input: assemble the FocusTeamPromptContext threaded into both the
400
- * directive and legacy prompt builders. Pure factory -- byte-identical to the
401
- * original inline object literal; extracted so the orchestrator reads as ordered
402
- * phase calls rather than inlining the context shape.
403
- */
404
- export declare function buildFocusPromptContext(args: {
405
- config: DaemonConfig;
406
- focusId: string;
407
- focusName: string;
408
- focusDescription: string | null;
409
- deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
410
- issues: Awaited<ReturnType<typeof getFocusIssues>>;
411
- executionConfig: FocusTeamState['executionConfig'];
412
- pipelineConfig: PipelineConfig | null;
413
- productContextDocs: SpawnContext['productContextDocs'];
414
- deploymentProfileSnapshot: SpawnContext['deploymentProfileSnapshot'];
415
- readOnly: boolean;
416
- loopContext: string;
417
- reviewFiledOpenCount: number;
418
- engineId: string;
419
- }): FocusTeamPromptContext;
420
- /**
421
- * Phase C: compose the final team-lead message -- role framework + remediation
422
- * framing + directive body (or the legacy full focus prompt), then the PRD
423
- * milestone push-down appended last so it reaches BOTH prompt paths. Pure +
424
- * testable. Byte-identical to the original inline composition.
425
- */
426
- export declare function buildSpawnPrompt(args: {
427
- role: AgentRole;
428
- promptContext: FocusTeamPromptContext;
429
- useLegacyFullPrompt: boolean;
430
- directiveBody: string | null;
431
- prdMilestoneContext: string;
432
- /**
433
- * True when this spawn is a review-lineage pass (reviewing stage). The
434
- * outcome-stamping obligation is appended ONLY for review passes -- a coding
435
- * team has nothing to stamp.
436
- */
437
- isReviewPass?: boolean;
438
- /**
439
- * The review session's Telora agent_sessions.id (from createTeamSession).
440
- * Threaded into the outcome-stamping section so the review agent receives the
441
- * exact id product-api validates against -- no reverse-engineering it from the
442
- * Claude --resume session id. Only emitted on review passes; ignored otherwise.
443
- */
444
- agentSessionId?: string;
445
- }): string;
446
- /**
447
- * Outcome of per-pass local-model resolution. The caller applies it:
448
- * - none -> keep the per-product codexHome/codexModel defaults.
449
- * - fallback -> ref not in the registry; warn and keep the defaults.
450
- * - route -> provision the per-model CODEX_HOME and route the spawn there,
451
- * optionally injecting the Telora-resolved key.
452
- */
453
- export type LocalModelConfig = {
454
- kind: 'none';
455
- } | {
456
- kind: 'fallback';
457
- ref: string | null;
458
- } | {
459
- kind: 'route';
460
- codexHome: string;
461
- codexModel: string;
462
- apiKey: string | null;
463
- coords: LocalModelCoordinates;
464
- };
465
- /**
466
- * The I/O seams resolveLocalModelConfig depends on. Injectable so the route/
467
- * fallback/none outcomes are unit-testable without the daemon-core
468
- * module-mock constraint (default to the real implementations in production).
469
- */
470
- export interface LocalModelConfigDeps {
471
- getLocalModel: typeof getLocalModel;
472
- getLocalModelSecret: typeof getLocalModelSecret;
473
- writeLocalModelCodexHome: typeof writeLocalModelCodexHome;
474
- }
475
- /**
476
- * Phase: resolve the per-pass local-model routing for a codex spawn.
477
- *
478
- * Wraps the fetch (getLocalModel / getLocalModelSecret) + the pure decision
479
- * (selectLocalModelRef -> decideLocalModelRouting) and, on 'route', provisions
480
- * the per-model CODEX_HOME (writeLocalModelCodexHome) -- returning the codexHome
481
- * the caller points the spawn at. The key VALUE comes from Telora (D8), never a
482
- * host env var. Behavior byte-identical to the original inline block; only the
483
- * apply-side (session-terminal write on skip, env injection on route) stays in
484
- * the caller.
485
- */
486
- export declare function resolveLocalModelConfig(args: {
487
- engineId: string;
488
- enginePass: EnginePass;
489
- localModelOverride: Record<string, string | null> | null | undefined;
490
- /** Stage directive local-model: the Workflow layer inherited when the focus
491
- * does not override this pass. Optional/absent = the stage pins none. */
492
- stageDirectiveLocalModel?: string | null;
493
- }, deps?: Partial<LocalModelConfigDeps>): Promise<LocalModelConfig>;
494
- /** Injectable I/O seams for surfaceSingleHostModelConflict (test without DB). */
495
- export interface HostConflictSurfaceDeps {
496
- getLocalModel: typeof getLocalModel;
497
- createEscalation: typeof createEscalation;
498
- }
499
- /**
500
- * Surface (do NOT silently swap) two DIFFERENT local models bound to the coding
501
- * vs review pass of one focus that share a single GPU host (#9). On a single
502
- * card the two bindings force an evict+load swap on every pass alternation and
503
- * fight over the GPU (the live incident: 0/56 routing attempts succeeded). The
504
- * daemon must make the conflict VISIBLE rather than thrash silently.
505
- *
506
- * Cheap early-out: only when the focus pins a local model for BOTH passes and
507
- * the two refs differ do we resolve coordinates (two getLocalModel reads) and run
508
- * the pure detector. A conflict (same host root, different served models) is
509
- * raised ONCE per focus per daemon run (shouldSurfaceHostConflictOnce) as a log
510
- * line + a single escalation -- never re-raised every poll. Returns whether a new
511
- * surfacing was raised this call. Best-effort: an escalation-create failure is
512
- * logged, never fatal to the spawn.
513
- */
514
- export declare function surfaceSingleHostModelConflict(args: {
515
- focusId: string;
516
- focusName: string;
517
- organizationId: string;
518
- productId: string | undefined;
519
- localModelOverride: Record<string, string | null> | null | undefined;
520
- }, deps?: Partial<HostConflictSurfaceDeps>): Promise<{
521
- surfaced: boolean;
522
- }>;
523
- /**
524
- * The terminal session-update payload written when the resource governor denies a
525
- * slot for this spawn. Pure -- the caller adds `ended_at` and calls updateSession.
526
- * Exported so the governor-denied exit_category contract is unit-pinned (the
527
- * apply-side -- updateSession + governor.releaseSlot + activeTeams.delete -- stays
528
- * in spawnTeamProcess, exercised by spawn-path-unified.test.ts).
529
- */
530
- export declare function governorDeniedSessionUpdate(): {
531
- status: string;
532
- exit_reason: string;
533
- exit_category: string;
534
- };
535
- /**
536
- * The terminal session-update payload written when a required OS sandbox cannot
537
- * initialize and the spawn is refused (fail-closed). Pure -- the caller adds
538
- * `ended_at` and calls updateSession. Exported so the sandbox-unavailable
539
- * exit_category contract is unit-pinned.
540
- */
541
- export declare function sandboxUnavailableSessionUpdate(message: string): {
542
- status: string;
543
- exit_reason: string;
544
- exit_category: string;
545
- };
546
61
  /**
547
62
  * Log the spawn header (focus / role / model / workers / branch, plus the
548
63
  * product line in multi-product mode). Side-effect-only; byte-identical to the
@@ -557,302 +72,6 @@ export declare function logSpawnHeader(args: {
557
72
  branchName: string;
558
73
  readOnly: boolean;
559
74
  }): void;
560
- /**
561
- * Build the initial FocusTeamState for a spawn. Pure factory -- no side effects;
562
- * the caller inserts it into the activeTeams map.
563
- */
564
- export declare function createInitialTeamState(args: {
565
- focusId: string;
566
- focusName: string;
567
- role: AgentRole;
568
- config: DaemonConfig;
569
- executionConfig: FocusTeamState['executionConfig'];
570
- pipelineConfig: PipelineConfig | null;
571
- branchName: string;
572
- readOnly: boolean;
573
- }): FocusTeamState;
574
- /**
575
- * Phase: resolve the focus worktree to spawn into. Reuses the persistent
576
- * worktree (rebasing onto integration + re-asserting read-only guards) when one
577
- * exists, else creates one inline. Returns null when the spawn cannot proceed
578
- * (repo has no commits, or inline creation failed) -- owning its own teardown
579
- * (activeTeams.delete + recordFocusTeardown) so the caller just returns.
580
- * Behavior byte-identical to the original inline block.
581
- */
582
- export declare function resolveSpawnWorktree(args: {
583
- config: DaemonConfig;
584
- focusId: string;
585
- focusName: string;
586
- branchName: string;
587
- readOnly: boolean;
588
- }): Promise<string | null>;
589
- /**
590
- * Phase: create the team-lead session row + register it with the telemetry
591
- * persistence gate, stamping its id onto the team state. Returns null when
592
- * createSession fails (owning its own activeTeams.delete teardown). The worktree
593
- * is focus-owned and persists even when session creation fails.
594
- *
595
- * `sessionType` is the AUTHORITATIVE lineage (resolved by resolveEngineForPass,
596
- * matching teamState.sessionType), so the (focus, lineage) pass this segment is
597
- * opened against is on the SAME lineage the segment carries -- never a stale
598
- * 'coding' default while the lineage actually resolved to 'review'.
599
- */
600
- export declare function createTeamSession(args: {
601
- config: DaemonConfig;
602
- role: AgentRole;
603
- focusId: string;
604
- focusName: string;
605
- branchName: string;
606
- sessionType: SessionType;
607
- teamState: FocusTeamState;
608
- }): Promise<Awaited<ReturnType<typeof createSession>> | null>;
609
- /**
610
- * Phase: best-effort review context. When the focus has a recorded
611
- * review_requested_at, count the open review-filed issues (the remediation
612
- * directive's working set) and carry the prior findings; also resolve the focus
613
- * description. A fetch failure leaves the count at zero (normal execution team).
614
- */
615
- export declare function resolveReviewContext(args: {
616
- config: DaemonConfig;
617
- focusId: string;
618
- focusName: string;
619
- issues: Awaited<ReturnType<typeof getFocusIssues>>;
620
- }): Promise<{
621
- reviewFiledOpenCount: number;
622
- priorFindings: Awaited<ReturnType<typeof getFocusIssues>>;
623
- focusDescription: string | null;
624
- }>;
625
- /**
626
- * Phase B: resolve the session lineage (pass) and the engine backend for it,
627
- * stamping lineage + sessionType onto the team state. Returns the lineage spec,
628
- * the derived engine pass, the resolved engine, and the backend object.
629
- */
630
- export declare function resolveEngineForPass(args: {
631
- spawnDirectiveDeclared: DirectiveResolution['spawnDirectiveDeclared'];
632
- spawnStageName: string | null;
633
- engineOverride: EngineOverride | null | undefined;
634
- /** Stage directive engine (Workflow layer of the unified engine precedence). */
635
- stageDirectiveEngine?: string | null;
636
- config: DaemonConfig;
637
- orgDefaultEngine: string | null | undefined;
638
- focusName: string;
639
- teamState: FocusTeamState;
640
- }): {
641
- spawnSpec: ReturnType<typeof resolveLineageSpec>;
642
- enginePass: EnginePass;
643
- resolvedEngine: ReturnType<typeof resolveBackend>;
644
- backend: AgentBackend;
645
- };
646
- /**
647
- * Outcome of resolveSpawnModel:
648
- * - 'skip_load' -- a controllable-host model swap (load/unload) FAILED this
649
- * tick; do NOT spawn against a not-yet-loaded model. The caller
650
- * logs an actionable message + skips the spawn so the 30s poll
651
- * re-attempts. Conservative: no terminal session, no escalation.
652
- * - 'still_loading' -- the per-host swap is in flight OFF the poll loop (#3),
653
- * or the host is held by another focus's running pass (#4).
654
- * Defer THIS focus's spawn only; retry next poll. The detached
655
- * load is NOT awaited, so the serial poll loop is not stalled.
656
- * - 'ready' -- a ready spawn carrying the CLI args + the env-affecting model bits.
657
- */
658
- export type SpawnModelResolution = {
659
- kind: 'skip_load';
660
- coords: LocalModelCoordinates;
661
- dbMessage: string;
662
- } | {
663
- kind: 'still_loading';
664
- coords: LocalModelCoordinates;
665
- reason: string;
666
- } | {
667
- kind: 'ready';
668
- args: string[];
669
- effectiveModel: string | null;
670
- spawnCodexHome: string | undefined;
671
- spawnLocalModelKey: string | null;
672
- isLocalModelPass: boolean;
673
- /** Translating proxy started for an opt-in local-model pass (else null).
674
- * Carried out so the caller can attach it to the team state for
675
- * close-time teardown + reception read. */
676
- mcpProxy?: CodexMcpProxyHandle | null;
677
- };
678
- /**
679
- * Phase: resolve the per-product CODEX_HOME default, apply per-pass local-model
680
- * routing (fallback / route), select the effective model, and build the CLI
681
- * args. Returns 'ready' with the args + the model/env bits the spawn needs.
682
- */
683
- export declare function resolveSpawnModel(args: {
684
- resolvedEngine: ReturnType<typeof resolveBackend>;
685
- enginePass: EnginePass;
686
- localModelOverride: Record<string, string | null> | null | undefined;
687
- /**
688
- * Stage directive local-model (Workflow layer of the unified local-model
689
- * precedence); inherited when the focus does not override this pass. Null when
690
- * the stage pins no local model.
691
- */
692
- stageDirectiveLocalModel?: string | null;
693
- config: DaemonConfig;
694
- directiveModel: string | null;
695
- /**
696
- * Focus override snapshotted on a pending spawn directive (respawn path), or
697
- * null. When present it takes precedence over the live pipeline_config.model
698
- * for the focus-override slot, so respawn honors the override even if the
699
- * focus row's pipeline_config was refetched differently between store and
700
- * consume. Null on the initial-spawn / stage-directive path.
701
- */
702
- pendingFocusOverrideModel: string | null;
703
- pipelineConfig: PipelineConfig | null;
704
- backend: AgentBackend;
705
- worktreePath: string;
706
- resumeId: string | null;
707
- role: AgentRole;
708
- readOnly: boolean;
709
- focusName: string;
710
- focusId: string;
711
- }): Promise<SpawnModelResolution>;
712
- /**
713
- * Phase: choose the stdin message. A fresh spawn sends the full composed prompt;
714
- * a resume sends an incremental delta (git diff + prior findings to verify) since
715
- * the resumed session already holds its role + accumulated context (INJ-D).
716
- *
717
- * The scoping case is the one exception that overrides the fresh-vs-resume split:
718
- * when a NON-read_only (executable) focus has queued deliveries carrying only
719
- * Context Group issues and zero Task/Bug issues, this returns the role framework
720
- * PLUS `buildQueuedDeliveryScopingMessage` REGARDLESS of resumeId. The caller pairs
721
- * this with `resolveScopingSpawnResume`, which forces the spawn fresh (resumeId
722
- * null) so the directive lands on a new session instead of no-opping a concluded
723
- * one. Because the fresh session holds no accumulated context, the role framework
724
- * (identity + Scoping Mandate + status-update rules) is prepended here; only the
725
- * audit/kickoff DIRECTIVE body carried in `prompt` is dropped, per AC. `readOnlyFocus`
726
- * focuses are discovery-only (audit-playbook origin): their CG-only deliveries are
727
- * INTENTIONALLY unscoped, so they are never driven into scoping here --
728
- * delivery-lifecycle terminalizes them instead.
729
- */
730
- export declare function buildSpawnMessage(args: {
731
- prompt: string;
732
- resumeId: string | null;
733
- readOnlyFocus: boolean;
734
- /**
735
- * The team-lead role + context, used to rebuild JUST the role-framework prefix
736
- * (`buildRoleFrameworkPrompt`, WITHOUT the audit/kickoff directive body) for the
737
- * forced-fresh scoping message. The scoping spawn lands on a NEW session with no
738
- * accumulated context, and stdin is that session's only first-turn instruction
739
- * (there is no --system-prompt channel and the worktree CLAUDE.md carries no role
740
- * framework), so the scoping directive must carry the role framework itself or
741
- * the fresh team lead has no identity / status-update contract / scoping mandate.
742
- */
743
- role: AgentRole;
744
- promptContext: FocusTeamPromptContext;
745
- spawnSpec: ReturnType<typeof resolveLineageSpec>;
746
- config: DaemonConfig;
747
- focusId: string;
748
- focusName: string;
749
- deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
750
- issues: Awaited<ReturnType<typeof getFocusIssues>>;
751
- worktreePath: string;
752
- priorFindings: Awaited<ReturnType<typeof getFocusIssues>>;
753
- }): Promise<string>;
754
- /**
755
- * Decide whether this spawn must be forced fresh to deliver a scoping directive,
756
- * and return the resume id the spawn should actually use.
757
- *
758
- * The wedge this closes: a queued delivery carrying only Context Group issues and
759
- * zero Task/Bug issues can never cross the queued->coding gate. The daemon
760
- * re-spawns the focus every poll, but the resume lands on a session that already
761
- * considers the audit "done" and no-ops in one turn. The fix is to force the
762
- * scoping spawn FRESH (resumeId null) so `buildQueuedDeliveryScopingMessage`
763
- * primes a new session as its first instruction rather than a resume-delta a
764
- * concluded session ignores.
765
- *
766
- * Only executable focuses are driven into scoping. A `readOnly` (discovery-only,
767
- * audit-playbook) focus's CG-only deliveries are intentionally unscoped, so this
768
- * never forces them fresh -- their resume id passes through unchanged and the
769
- * delivery reaches a terminal state via the reconciler's discovery-only path.
770
- *
771
- * Pure and exported so the fresh-spawn contract is unit-testable without a live
772
- * spawn.
773
- */
774
- export declare function resolveScopingSpawnResume(args: {
775
- readOnly: boolean;
776
- deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
777
- issues: Awaited<ReturnType<typeof getFocusIssues>>;
778
- resumeId: string | null;
779
- }): {
780
- resumeId: string | null;
781
- isScopingSpawn: boolean;
782
- };
783
- export declare function findQueuedDeliveriesWithoutTaskIssues(deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>, issues: Awaited<ReturnType<typeof getFocusIssues>>): Awaited<ReturnType<typeof getFocusDeliveries>>;
784
- export declare function buildQueuedDeliveryScopingMessage(args: {
785
- lineage: string;
786
- focusName: string;
787
- deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
788
- }): string;
789
- /**
790
- * Inputs to spawnTeamProcess -- the final phase that takes a fully-resolved
791
- * spawn (env constituents, args, message, session, backend) and actually
792
- * launches the team-lead child process.
793
- */
794
- export interface SpawnTeamProcessArgs {
795
- config: DaemonConfig;
796
- focusId: string;
797
- focusName: string;
798
- session: Awaited<ReturnType<typeof createSession>>;
799
- teamState: FocusTeamState;
800
- backend: AgentBackend;
801
- args: string[];
802
- /** Composed prompt on a fresh spawn, or the resume-delta when resuming. */
803
- messageToSend: string;
804
- logs: ReturnType<typeof setupTeamLogStreams>;
805
- worktreePath: string;
806
- resumeId: string | null;
807
- assemblyManifest: AssemblyManifestEntry[];
808
- spawnCodexHome: string | undefined;
809
- spawnLocalModelKey: string | null;
810
- isLocalModelPass: boolean;
811
- effectiveModel: string | null;
812
- pendingDirective: ReturnType<typeof consumePendingSpawnDirective>;
813
- spawnStageName: string | null;
814
- params: SpawnFocusTeamParams;
815
- }
816
- export interface BackendSpawnGateResult {
817
- allowed: boolean;
818
- reason?: string;
819
- }
820
- /**
821
- * Local-model passes depend on a host CLI, so refuse the process launch when
822
- * the backend's existing availability probe says it cannot run. Cloud passes
823
- * retain their existing behavior because their authentication can be supplied
824
- * by the per-spawn environment after the host-level probe runs.
825
- */
826
- export declare function gateLocalModelBackendSpawn(backend: AgentBackend, config: DaemonConfig, isLocalModelPass: boolean, host?: string): Promise<BackendSpawnGateResult>;
827
- export declare function backendUnavailableSessionUpdate(reason: string, category?: string): {
828
- status: string;
829
- exit_reason: string;
830
- exit_category: string;
831
- };
832
- /** Attach the error listener in the same synchronous stack frame as spawn(). */
833
- export declare function spawnCrashIsolated(command: string, args: readonly string[], options: SpawnOptionsWithoutStdio, onError: (error: Error) => void, spawnFn?: typeof spawn): ChildProcessWithoutNullStreams;
834
- /** Ensure a terminal spawn failure is persisted after any in-flight running transition. */
835
- export declare function persistSpawnFailureAfterRunning(runningTransition: Promise<unknown> | null, persistFailure: () => Promise<unknown>): Promise<void>;
836
- /**
837
- * Final phase: build the levered spawn environment, persist the assembly
838
- * manifest, write the session lifecycle (starting -> running), acquire the
839
- * governor slot, wrap the command in the sandbox (fail-closed), spawn the
840
- * child, write its stdin, and attach the completion/close/error handlers.
841
- *
842
- * Owns ALL of its early-return cleanups so the team-state map and governor slot
843
- * never leak: governor-denied (exit_category 'governor_denied') and
844
- * sandbox-unavailable (exit_category 'sandbox_unavailable') both mark the
845
- * session terminal, release the governor slot where one was held, remove the
846
- * team from activeTeams, and return without spawning. Behavior byte-identical
847
- * to the original inline tail of spawnFocusTeam.
848
- */
849
- /**
850
- * Close a team's local-model translating proxy if one is engaged, and null it so
851
- * the call is idempotent across the multiple teardown paths. No-op for every
852
- * hosted/Claude/flag-off team (mcpProxy undefined/null).
853
- */
854
- export declare function closeTeamProxyQuietly(teamState: FocusTeamState): void;
855
- export declare function spawnTeamProcess(spec: SpawnTeamProcessArgs): Promise<void>;
856
75
  /**
857
76
  * Spawn a focus team to execute all deliveries in a focus.
858
77
  *