@telora/daemon 0.19.43 → 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 (542) hide show
  1. package/build-info.json +8 -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/audit-shape.d.ts +103 -0
  7. package/dist/audit-shape.d.ts.map +1 -0
  8. package/dist/audit-shape.js +81 -0
  9. package/dist/audit-shape.js.map +1 -0
  10. package/dist/branch-status.js +2 -2
  11. package/dist/branch-status.js.map +1 -1
  12. package/dist/ci-sensor-loop.d.ts +47 -0
  13. package/dist/ci-sensor-loop.d.ts.map +1 -0
  14. package/dist/ci-sensor-loop.js +116 -0
  15. package/dist/ci-sensor-loop.js.map +1 -0
  16. package/dist/ci-status-git.d.ts +52 -0
  17. package/dist/ci-status-git.d.ts.map +1 -0
  18. package/dist/ci-status-git.js +86 -0
  19. package/dist/ci-status-git.js.map +1 -0
  20. package/dist/ci-status.d.ts +122 -0
  21. package/dist/ci-status.d.ts.map +1 -0
  22. package/dist/ci-status.js +114 -0
  23. package/dist/ci-status.js.map +1 -0
  24. package/dist/cli/connect/agents.d.ts +24 -0
  25. package/dist/cli/connect/agents.d.ts.map +1 -0
  26. package/dist/cli/connect/agents.js +65 -0
  27. package/dist/cli/connect/agents.js.map +1 -0
  28. package/dist/cli/connect/claude.d.ts +31 -0
  29. package/dist/cli/connect/claude.d.ts.map +1 -0
  30. package/dist/cli/connect/claude.js +104 -0
  31. package/dist/cli/connect/claude.js.map +1 -0
  32. package/dist/cli/connect/cline.d.ts +37 -0
  33. package/dist/cli/connect/cline.d.ts.map +1 -0
  34. package/dist/cli/connect/cline.js +115 -0
  35. package/dist/cli/connect/cline.js.map +1 -0
  36. package/dist/cli/connect/codex.d.ts +44 -0
  37. package/dist/cli/connect/codex.d.ts.map +1 -0
  38. package/dist/cli/connect/codex.js +111 -0
  39. package/dist/cli/connect/codex.js.map +1 -0
  40. package/dist/cli/connect/ide.d.ts +69 -0
  41. package/dist/cli/connect/ide.d.ts.map +1 -0
  42. package/dist/cli/connect/ide.js +134 -0
  43. package/dist/cli/connect/ide.js.map +1 -0
  44. package/dist/cli/connect/scaffolding.d.ts +31 -0
  45. package/dist/cli/connect/scaffolding.d.ts.map +1 -0
  46. package/dist/cli/connect/scaffolding.js +52 -0
  47. package/dist/cli/connect/scaffolding.js.map +1 -0
  48. package/dist/cli/connect/shared.d.ts +30 -0
  49. package/dist/cli/connect/shared.d.ts.map +1 -0
  50. package/dist/cli/connect/shared.js +11 -0
  51. package/dist/cli/connect/shared.js.map +1 -0
  52. package/dist/cli/connect.d.ts +9 -210
  53. package/dist/cli/connect.d.ts.map +1 -1
  54. package/dist/cli/connect.js +10 -526
  55. package/dist/cli/connect.js.map +1 -1
  56. package/dist/cli/open.js +2 -2
  57. package/dist/completion/event.d.ts +3 -0
  58. package/dist/completion/event.d.ts.map +1 -1
  59. package/dist/completion/event.js +44 -9
  60. package/dist/completion/event.js.map +1 -1
  61. package/dist/completion/merge-phase.d.ts +3 -0
  62. package/dist/completion/merge-phase.d.ts.map +1 -1
  63. package/dist/completion/merge-phase.js +35 -3
  64. package/dist/completion/merge-phase.js.map +1 -1
  65. package/dist/completion/read-only-pristine.d.ts +1 -1
  66. package/dist/completion/read-only-pristine.d.ts.map +1 -1
  67. package/dist/completion/read-only-pristine.js +1 -1
  68. package/dist/completion/read-only-pristine.js.map +1 -1
  69. package/dist/completion/review-exit-phase.d.ts +30 -3
  70. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  71. package/dist/completion/review-exit-phase.js +203 -15
  72. package/dist/completion/review-exit-phase.js.map +1 -1
  73. package/dist/completion/status-advance-phase.js +1 -1
  74. package/dist/completion/status-advance-phase.js.map +1 -1
  75. package/dist/completion/team-completion.d.ts.map +1 -1
  76. package/dist/completion/team-completion.js +22 -2
  77. package/dist/completion/team-completion.js.map +1 -1
  78. package/dist/completion/team-lifecycle.js +1 -1
  79. package/dist/completion/terminated-work-reconcile.js +1 -1
  80. package/dist/completion/terminated-work-reconcile.js.map +1 -1
  81. package/dist/condition-evaluators.d.ts +41 -2
  82. package/dist/condition-evaluators.d.ts.map +1 -1
  83. package/dist/condition-evaluators.js +37 -288
  84. package/dist/condition-evaluators.js.map +1 -1
  85. package/dist/context-audit.d.ts +1 -1
  86. package/dist/context-audit.d.ts.map +1 -1
  87. package/dist/context-lock.d.ts +1 -1
  88. package/dist/context-lock.d.ts.map +1 -1
  89. package/dist/control-state.d.ts +2 -2
  90. package/dist/control-state.d.ts.map +1 -1
  91. package/dist/control-state.js +4 -3
  92. package/dist/control-state.js.map +1 -1
  93. package/dist/daemon-process.d.ts +1 -1
  94. package/dist/daemon-process.d.ts.map +1 -1
  95. package/dist/delivery-advance-block.d.ts +1 -1
  96. package/dist/delivery-advance-block.d.ts.map +1 -1
  97. package/dist/delivery-advance-block.js +1 -1
  98. package/dist/delivery-advance-block.js.map +1 -1
  99. package/dist/delivery-lifecycle.js +1 -1
  100. package/dist/delivery-reconciler-shadow.d.ts +1 -1
  101. package/dist/delivery-reconciler-shadow.d.ts.map +1 -1
  102. package/dist/delivery-reconciler-shadow.js +1 -1
  103. package/dist/delivery-reconciler-shadow.js.map +1 -1
  104. package/dist/delivery-reconciler.d.ts +1 -0
  105. package/dist/delivery-reconciler.d.ts.map +1 -1
  106. package/dist/delivery-reconciler.js +6 -0
  107. package/dist/delivery-reconciler.js.map +1 -1
  108. package/dist/directive-executor.js +1 -1
  109. package/dist/directive-executor.js.map +1 -1
  110. package/dist/drift-eval-loop.d.ts.map +1 -1
  111. package/dist/drift-eval-loop.js +6 -14
  112. package/dist/drift-eval-loop.js.map +1 -1
  113. package/dist/escalations.d.ts +1 -1
  114. package/dist/escalations.d.ts.map +1 -1
  115. package/dist/escalations.js +1 -1
  116. package/dist/escalations.js.map +1 -1
  117. package/dist/evaluation-context.d.ts +2 -33
  118. package/dist/evaluation-context.d.ts.map +1 -1
  119. package/dist/evaluation-context.js +2 -56
  120. package/dist/evaluation-context.js.map +1 -1
  121. package/dist/focus-engine.d.ts +14 -5
  122. package/dist/focus-engine.d.ts.map +1 -1
  123. package/dist/focus-engine.js +35 -289
  124. package/dist/focus-engine.js.map +1 -1
  125. package/dist/focus-executor.d.ts +10 -791
  126. package/dist/focus-executor.d.ts.map +1 -1
  127. package/dist/focus-executor.js +42 -1566
  128. package/dist/focus-executor.js.map +1 -1
  129. package/dist/focus-lifecycle.js +2 -2
  130. package/dist/focus-lifecycle.js.map +1 -1
  131. package/dist/focus-loop-registry.d.ts +52 -0
  132. package/dist/focus-loop-registry.d.ts.map +1 -0
  133. package/dist/focus-loop-registry.js +328 -0
  134. package/dist/focus-loop-registry.js.map +1 -0
  135. package/dist/focus-merge.d.ts +1 -1
  136. package/dist/focus-merge.d.ts.map +1 -1
  137. package/dist/focus-merge.js +3 -3
  138. package/dist/focus-merge.js.map +1 -1
  139. package/dist/focus-phase.d.ts +4 -0
  140. package/dist/focus-phase.d.ts.map +1 -1
  141. package/dist/focus-phase.js +3 -3
  142. package/dist/focus-phase.js.map +1 -1
  143. package/dist/focus-stage-lifecycle/planning-release.d.ts +197 -0
  144. package/dist/focus-stage-lifecycle/planning-release.d.ts.map +1 -0
  145. package/dist/focus-stage-lifecycle/planning-release.js +312 -0
  146. package/dist/focus-stage-lifecycle/planning-release.js.map +1 -0
  147. package/dist/focus-stage-lifecycle/review-convergence.d.ts +133 -0
  148. package/dist/focus-stage-lifecycle/review-convergence.d.ts.map +1 -0
  149. package/dist/focus-stage-lifecycle/review-convergence.js +235 -0
  150. package/dist/focus-stage-lifecycle/review-convergence.js.map +1 -0
  151. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +133 -0
  152. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -0
  153. package/dist/focus-stage-lifecycle/wedge-watchdog.js +365 -0
  154. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -0
  155. package/dist/focus-stage-lifecycle.d.ts +22 -403
  156. package/dist/focus-stage-lifecycle.d.ts.map +1 -1
  157. package/dist/focus-stage-lifecycle.js +26 -798
  158. package/dist/focus-stage-lifecycle.js.map +1 -1
  159. package/dist/{git-activity.d.ts → git/activity.d.ts} +1 -1
  160. package/dist/git/activity.d.ts.map +1 -0
  161. package/dist/{git-activity.js → git/activity.js} +2 -2
  162. package/dist/git/activity.js.map +1 -0
  163. package/dist/{git-branch.d.ts → git/branch.d.ts} +2 -2
  164. package/dist/git/branch.d.ts.map +1 -0
  165. package/dist/{git-branch.js → git/branch.js} +2 -2
  166. package/dist/git/branch.js.map +1 -0
  167. package/dist/{git-fetch.d.ts → git/fetch.d.ts} +2 -2
  168. package/dist/git/fetch.d.ts.map +1 -0
  169. package/dist/{git-fetch.js → git/fetch.js} +1 -1
  170. package/dist/git/fetch.js.map +1 -0
  171. package/dist/{git-genesis.d.ts → git/genesis.d.ts} +3 -3
  172. package/dist/git/genesis.d.ts.map +1 -0
  173. package/dist/{git-genesis.js → git/genesis.js} +5 -5
  174. package/dist/git/genesis.js.map +1 -0
  175. package/dist/git/index.d.ts +36 -0
  176. package/dist/git/index.d.ts.map +1 -0
  177. package/dist/git/index.js +36 -0
  178. package/dist/git/index.js.map +1 -0
  179. package/dist/{git-integration.d.ts → git/integration.d.ts} +2 -2
  180. package/dist/git/integration.d.ts.map +1 -0
  181. package/dist/{git-integration.js → git/integration.js} +4 -4
  182. package/dist/git/integration.js.map +1 -0
  183. package/dist/{git-merge-helpers.d.ts → git/merge-helpers.d.ts} +3 -3
  184. package/dist/git/merge-helpers.d.ts.map +1 -0
  185. package/dist/{git-merge-helpers.js → git/merge-helpers.js} +3 -3
  186. package/dist/git/merge-helpers.js.map +1 -0
  187. package/dist/{git-merge-lock.d.ts → git/merge-lock.d.ts} +1 -1
  188. package/dist/git/merge-lock.d.ts.map +1 -0
  189. package/dist/{git-merge-lock.js → git/merge-lock.js} +1 -1
  190. package/dist/git/merge-lock.js.map +1 -0
  191. package/dist/{git-merge-strategies.d.ts → git/merge-strategies.d.ts} +2 -2
  192. package/dist/git/merge-strategies.d.ts.map +1 -0
  193. package/dist/{git-merge-strategies.js → git/merge-strategies.js} +3 -3
  194. package/dist/git/merge-strategies.js.map +1 -0
  195. package/dist/{git-merge.d.ts → git/merge.d.ts} +4 -4
  196. package/dist/git/merge.d.ts.map +1 -0
  197. package/dist/{git-merge.js → git/merge.js} +4 -4
  198. package/dist/git/merge.js.map +1 -0
  199. package/dist/{git-state-detector.d.ts → git/state-detector.d.ts} +2 -2
  200. package/dist/git/state-detector.d.ts.map +1 -0
  201. package/dist/{git-state-detector.js → git/state-detector.js} +7 -7
  202. package/dist/git/state-detector.js.map +1 -0
  203. package/dist/{git-types.d.ts → git/types.d.ts} +2 -2
  204. package/dist/git/types.d.ts.map +1 -0
  205. package/dist/{git-types.js → git/types.js} +1 -1
  206. package/dist/git/types.js.map +1 -0
  207. package/dist/{git-utils.d.ts → git/utils.d.ts} +1 -1
  208. package/dist/git/utils.d.ts.map +1 -0
  209. package/dist/{git-utils.js → git/utils.js} +2 -2
  210. package/dist/git/utils.js.map +1 -0
  211. package/dist/git.d.ts +5 -5
  212. package/dist/git.d.ts.map +1 -1
  213. package/dist/git.js +10 -10
  214. package/dist/git.js.map +1 -1
  215. package/dist/guard-engine.d.ts +3 -2
  216. package/dist/guard-engine.d.ts.map +1 -1
  217. package/dist/guard-engine.js +2 -2
  218. package/dist/guard-engine.js.map +1 -1
  219. package/dist/install-probe-tick.d.ts +63 -0
  220. package/dist/install-probe-tick.d.ts.map +1 -0
  221. package/dist/install-probe-tick.js +137 -0
  222. package/dist/install-probe-tick.js.map +1 -0
  223. package/dist/install-probe.d.ts +115 -0
  224. package/dist/install-probe.d.ts.map +1 -0
  225. package/dist/install-probe.js +197 -0
  226. package/dist/install-probe.js.map +1 -0
  227. package/dist/listener-auto-advance.d.ts.map +1 -1
  228. package/dist/listener-auto-advance.js +51 -9
  229. package/dist/listener-auto-advance.js.map +1 -1
  230. package/dist/listener.d.ts.map +1 -1
  231. package/dist/listener.js +15 -7
  232. package/dist/listener.js.map +1 -1
  233. package/dist/{loop-context-audit-pass.d.ts → loops/context-audit-pass.d.ts} +4 -4
  234. package/dist/loops/context-audit-pass.d.ts.map +1 -0
  235. package/dist/{loop-context-audit-pass.js → loops/context-audit-pass.js} +7 -7
  236. package/dist/loops/context-audit-pass.js.map +1 -0
  237. package/dist/{loop-engine-types.d.ts → loops/engine-types.d.ts} +1 -1
  238. package/dist/loops/engine-types.d.ts.map +1 -0
  239. package/dist/{loop-engine-types.js → loops/engine-types.js} +1 -1
  240. package/dist/loops/engine-types.js.map +1 -0
  241. package/dist/{loop-engine.d.ts → loops/engine.d.ts} +6 -6
  242. package/dist/loops/engine.d.ts.map +1 -0
  243. package/dist/{loop-engine.js → loops/engine.js} +13 -13
  244. package/dist/loops/engine.js.map +1 -0
  245. package/dist/{loop-event-bus.d.ts → loops/event-bus.d.ts} +1 -1
  246. package/dist/loops/event-bus.d.ts.map +1 -0
  247. package/dist/{loop-event-bus.js → loops/event-bus.js} +1 -1
  248. package/dist/loops/event-bus.js.map +1 -0
  249. package/dist/loops/index.d.ts +33 -0
  250. package/dist/loops/index.d.ts.map +1 -0
  251. package/dist/loops/index.js +32 -0
  252. package/dist/loops/index.js.map +1 -0
  253. package/dist/{loop-llm-client.d.ts → loops/llm-client.d.ts} +3 -3
  254. package/dist/loops/llm-client.d.ts.map +1 -0
  255. package/dist/{loop-llm-client.js → loops/llm-client.js} +3 -3
  256. package/dist/loops/llm-client.js.map +1 -0
  257. package/dist/{loop-llm-flag.d.ts → loops/llm-flag.d.ts} +1 -1
  258. package/dist/loops/llm-flag.d.ts.map +1 -0
  259. package/dist/{loop-llm-flag.js → loops/llm-flag.js} +1 -1
  260. package/dist/loops/llm-flag.js.map +1 -0
  261. package/dist/{loop-operational-block.d.ts → loops/operational-block.d.ts} +1 -1
  262. package/dist/loops/operational-block.d.ts.map +1 -0
  263. package/dist/{loop-operational-block.js → loops/operational-block.js} +1 -1
  264. package/dist/loops/operational-block.js.map +1 -0
  265. package/dist/{loop-prompt-builder.d.ts → loops/prompt-builder.d.ts} +2 -2
  266. package/dist/loops/prompt-builder.d.ts.map +1 -0
  267. package/dist/{loop-prompt-builder.js → loops/prompt-builder.js} +1 -1
  268. package/dist/loops/prompt-builder.js.map +1 -0
  269. package/dist/{loop-variance.d.ts → loops/variance.d.ts} +1 -1
  270. package/dist/loops/variance.d.ts.map +1 -0
  271. package/dist/{loop-variance.js → loops/variance.js} +1 -1
  272. package/dist/loops/variance.js.map +1 -0
  273. package/dist/merge-back-loop.d.ts.map +1 -1
  274. package/dist/merge-back-loop.js +4 -3
  275. package/dist/merge-back-loop.js.map +1 -1
  276. package/dist/merge-detector.js +2 -2
  277. package/dist/merge-detector.js.map +1 -1
  278. package/dist/{nexus-endpoint-clearance.d.ts → nexus/endpoint-clearance.d.ts} +2 -2
  279. package/dist/nexus/endpoint-clearance.d.ts.map +1 -0
  280. package/dist/{nexus-endpoint-clearance.js → nexus/endpoint-clearance.js} +2 -2
  281. package/dist/nexus/endpoint-clearance.js.map +1 -0
  282. package/dist/{nexus-escalation-bridge.d.ts → nexus/escalation-bridge.d.ts} +1 -1
  283. package/dist/nexus/escalation-bridge.d.ts.map +1 -0
  284. package/dist/{nexus-escalation-bridge.js → nexus/escalation-bridge.js} +2 -2
  285. package/dist/nexus/escalation-bridge.js.map +1 -0
  286. package/dist/{nexus-incoming.d.ts → nexus/incoming.d.ts} +2 -2
  287. package/dist/nexus/incoming.d.ts.map +1 -0
  288. package/dist/{nexus-incoming.js → nexus/incoming.js} +2 -2
  289. package/dist/nexus/incoming.js.map +1 -0
  290. package/dist/nexus/index.d.ts +20 -0
  291. package/dist/nexus/index.d.ts.map +1 -0
  292. package/dist/nexus/index.js +20 -0
  293. package/dist/nexus/index.js.map +1 -0
  294. package/dist/{nexus-intake-spawn.d.ts → nexus/intake-spawn.d.ts} +3 -3
  295. package/dist/nexus/intake-spawn.d.ts.map +1 -0
  296. package/dist/{nexus-intake-spawn.js → nexus/intake-spawn.js} +1 -1
  297. package/dist/nexus/intake-spawn.js.map +1 -0
  298. package/dist/{nexus-intake.d.ts → nexus/intake.d.ts} +2 -2
  299. package/dist/nexus/intake.d.ts.map +1 -0
  300. package/dist/{nexus-intake.js → nexus/intake.js} +4 -4
  301. package/dist/nexus/intake.js.map +1 -0
  302. package/dist/{nexus-return.d.ts → nexus/return.d.ts} +3 -3
  303. package/dist/nexus/return.d.ts.map +1 -0
  304. package/dist/{nexus-return.js → nexus/return.js} +4 -4
  305. package/dist/nexus/return.js.map +1 -0
  306. package/dist/otlp/index.d.ts +19 -0
  307. package/dist/otlp/index.d.ts.map +1 -0
  308. package/dist/otlp/index.js +19 -0
  309. package/dist/otlp/index.js.map +1 -0
  310. package/dist/{otlp-log-parser.d.ts → otlp/log-parser.d.ts} +2 -2
  311. package/dist/otlp/log-parser.d.ts.map +1 -0
  312. package/dist/{otlp-log-parser.js → otlp/log-parser.js} +5 -6
  313. package/dist/otlp/log-parser.js.map +1 -0
  314. package/dist/{otlp-metric-parser.d.ts → otlp/metric-parser.d.ts} +2 -2
  315. package/dist/otlp/metric-parser.d.ts.map +1 -0
  316. package/dist/{otlp-metric-parser.js → otlp/metric-parser.js} +4 -5
  317. package/dist/otlp/metric-parser.js.map +1 -0
  318. package/dist/{otlp-port-manager.d.ts → otlp/port-manager.d.ts} +1 -1
  319. package/dist/otlp/port-manager.d.ts.map +1 -0
  320. package/dist/{otlp-port-manager.js → otlp/port-manager.js} +1 -1
  321. package/dist/otlp/port-manager.js.map +1 -0
  322. package/dist/{otlp-receiver.d.ts → otlp/receiver.d.ts} +2 -2
  323. package/dist/otlp/receiver.d.ts.map +1 -0
  324. package/dist/{otlp-receiver.js → otlp/receiver.js} +5 -33
  325. package/dist/otlp/receiver.js.map +1 -0
  326. package/dist/{otlp-types.d.ts → otlp/types.d.ts} +1 -9
  327. package/dist/otlp/types.d.ts.map +1 -0
  328. package/dist/{otlp-types.js → otlp/types.js} +1 -27
  329. package/dist/otlp/types.js.map +1 -0
  330. package/dist/pipeline-config.d.ts +1 -1
  331. package/dist/{prd-controller.d.ts → prd/controller.d.ts} +7 -7
  332. package/dist/prd/controller.d.ts.map +1 -0
  333. package/dist/{prd-controller.js → prd/controller.js} +11 -11
  334. package/dist/prd/controller.js.map +1 -0
  335. package/dist/{prd-divergence.d.ts → prd/divergence.d.ts} +2 -2
  336. package/dist/prd/divergence.d.ts.map +1 -0
  337. package/dist/{prd-divergence.js → prd/divergence.js} +1 -1
  338. package/dist/prd/divergence.js.map +1 -0
  339. package/dist/{prd-focus-pushdown.d.ts → prd/focus-pushdown.d.ts} +2 -2
  340. package/dist/prd/focus-pushdown.d.ts.map +1 -0
  341. package/dist/{prd-focus-pushdown.js → prd/focus-pushdown.js} +3 -3
  342. package/dist/prd/focus-pushdown.js.map +1 -0
  343. package/dist/{prd-frontier.d.ts → prd/frontier.d.ts} +2 -2
  344. package/dist/prd/frontier.d.ts.map +1 -0
  345. package/dist/{prd-frontier.js → prd/frontier.js} +1 -1
  346. package/dist/prd/frontier.js.map +1 -0
  347. package/dist/prd/index.d.ts +26 -0
  348. package/dist/prd/index.d.ts.map +1 -0
  349. package/dist/prd/index.js +25 -0
  350. package/dist/prd/index.js.map +1 -0
  351. package/dist/{prd-steward.d.ts → prd/steward.d.ts} +4 -4
  352. package/dist/prd/steward.d.ts.map +1 -0
  353. package/dist/{prd-steward.js → prd/steward.js} +4 -4
  354. package/dist/prd/steward.js.map +1 -0
  355. package/dist/{prd-viability.d.ts → prd/viability.d.ts} +2 -2
  356. package/dist/prd/viability.d.ts.map +1 -0
  357. package/dist/{prd-viability.js → prd/viability.js} +1 -1
  358. package/dist/prd/viability.js.map +1 -0
  359. package/dist/product-scaffold.js +2 -2
  360. package/dist/product-scaffold.js.map +1 -1
  361. package/dist/prompt-sections/persona-sections.d.ts +32 -0
  362. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  363. package/dist/prompt-sections/persona-sections.js +78 -2
  364. package/dist/prompt-sections/persona-sections.js.map +1 -1
  365. package/dist/queries/context-lock-queries.js +1 -1
  366. package/dist/queries/context-lock-queries.js.map +1 -1
  367. package/dist/queries/deliveries.d.ts +31 -0
  368. package/dist/queries/deliveries.d.ts.map +1 -1
  369. package/dist/queries/deliveries.js +5 -0
  370. package/dist/queries/deliveries.js.map +1 -1
  371. package/dist/queries/focuses.d.ts +17 -0
  372. package/dist/queries/focuses.d.ts.map +1 -1
  373. package/dist/queries/focuses.js +27 -0
  374. package/dist/queries/focuses.js.map +1 -1
  375. package/dist/queries/schemas.d.ts +8 -0
  376. package/dist/queries/schemas.d.ts.map +1 -1
  377. package/dist/queries/schemas.js +16 -0
  378. package/dist/queries/schemas.js.map +1 -1
  379. package/dist/reality-pole.js +1 -1
  380. package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
  381. package/dist/resolvers/git-diff-against-base.js +4 -1
  382. package/dist/resolvers/git-diff-against-base.js.map +1 -1
  383. package/dist/resolvers/prd-context.js +1 -1
  384. package/dist/sensor-sweep.js +1 -1
  385. package/dist/spawn/model-routing.d.ts +277 -0
  386. package/dist/spawn/model-routing.d.ts.map +1 -0
  387. package/dist/spawn/model-routing.js +464 -0
  388. package/dist/spawn/model-routing.js.map +1 -0
  389. package/dist/spawn/process-spawn.d.ts +128 -0
  390. package/dist/spawn/process-spawn.d.ts.map +1 -0
  391. package/dist/spawn/process-spawn.js +378 -0
  392. package/dist/spawn/process-spawn.js.map +1 -0
  393. package/dist/spawn/prompt-assembly.d.ts +143 -0
  394. package/dist/spawn/prompt-assembly.d.ts.map +1 -0
  395. package/dist/spawn/prompt-assembly.js +263 -0
  396. package/dist/spawn/prompt-assembly.js.map +1 -0
  397. package/dist/spawn/shared.d.ts +72 -0
  398. package/dist/spawn/shared.d.ts.map +1 -0
  399. package/dist/spawn/shared.js +14 -0
  400. package/dist/spawn/shared.js.map +1 -0
  401. package/dist/spawn/spawn-decision.d.ts +189 -0
  402. package/dist/spawn/spawn-decision.d.ts.map +1 -0
  403. package/dist/spawn/spawn-decision.js +361 -0
  404. package/dist/spawn/spawn-decision.js.map +1 -0
  405. package/dist/spawn/worktree-session.d.ts +105 -0
  406. package/dist/spawn/worktree-session.d.ts.map +1 -0
  407. package/dist/spawn/worktree-session.js +216 -0
  408. package/dist/spawn/worktree-session.js.map +1 -0
  409. package/dist/spawner/lifecycle.js +2 -2
  410. package/dist/spawner/lifecycle.js.map +1 -1
  411. package/dist/spawner/resolution.js +1 -1
  412. package/dist/stall-detector-config.d.ts +4 -0
  413. package/dist/stall-detector-config.d.ts.map +1 -1
  414. package/dist/stall-detector-config.js +6 -0
  415. package/dist/stall-detector-config.js.map +1 -1
  416. package/dist/state-cascade.js +1 -1
  417. package/dist/state-cascade.js.map +1 -1
  418. package/dist/team-prompt-base.d.ts +1 -1
  419. package/dist/team-prompt-base.d.ts.map +1 -1
  420. package/dist/team-prompt-base.js +1 -1
  421. package/dist/team-prompt-base.js.map +1 -1
  422. package/dist/trigger-executor.d.ts +5 -9
  423. package/dist/trigger-executor.d.ts.map +1 -1
  424. package/dist/trigger-executor.js +14 -36
  425. package/dist/trigger-executor.js.map +1 -1
  426. package/dist/types/focus.d.ts +13 -0
  427. package/dist/types/focus.d.ts.map +1 -1
  428. package/dist/types/workflow.d.ts +1 -3
  429. package/dist/types/workflow.d.ts.map +1 -1
  430. package/dist/unified-engine-lifecycle.js +1 -1
  431. package/dist/unified-init.d.ts +3 -3
  432. package/dist/unified-init.d.ts.map +1 -1
  433. package/dist/unified-init.js +9 -25
  434. package/dist/unified-init.js.map +1 -1
  435. package/dist/unified-shell.d.ts +3 -3
  436. package/dist/unified-shell.js +4 -4
  437. package/dist/unified-shell.js.map +1 -1
  438. package/dist/verification-engine.d.ts.map +1 -1
  439. package/dist/verification-engine.js +15 -0
  440. package/dist/verification-engine.js.map +1 -1
  441. package/dist/{worktree-focus.d.ts → worktree/focus.d.ts} +2 -2
  442. package/dist/worktree/focus.d.ts.map +1 -0
  443. package/dist/{worktree-focus.js → worktree/focus.js} +7 -7
  444. package/dist/worktree/focus.js.map +1 -0
  445. package/dist/worktree/index.d.ts +16 -0
  446. package/dist/worktree/index.d.ts.map +1 -0
  447. package/dist/worktree/index.js +16 -0
  448. package/dist/worktree/index.js.map +1 -0
  449. package/dist/{worktree-safety.d.ts → worktree/safety.d.ts} +1 -1
  450. package/dist/worktree/safety.d.ts.map +1 -0
  451. package/dist/{worktree-safety.js → worktree/safety.js} +2 -2
  452. package/dist/worktree/safety.js.map +1 -0
  453. package/dist/{worktree-state.d.ts → worktree/state.d.ts} +1 -1
  454. package/dist/worktree/state.d.ts.map +1 -0
  455. package/dist/{worktree-state.js → worktree/state.js} +6 -6
  456. package/dist/worktree/state.js.map +1 -0
  457. package/dist/worktree.d.ts +1 -1
  458. package/dist/worktree.js +5 -5
  459. package/dist/worktree.js.map +1 -1
  460. package/package.json +5 -4
  461. package/dist/git-activity.d.ts.map +0 -1
  462. package/dist/git-activity.js.map +0 -1
  463. package/dist/git-branch.d.ts.map +0 -1
  464. package/dist/git-branch.js.map +0 -1
  465. package/dist/git-fetch.d.ts.map +0 -1
  466. package/dist/git-fetch.js.map +0 -1
  467. package/dist/git-genesis.d.ts.map +0 -1
  468. package/dist/git-genesis.js.map +0 -1
  469. package/dist/git-integration.d.ts.map +0 -1
  470. package/dist/git-integration.js.map +0 -1
  471. package/dist/git-merge-helpers.d.ts.map +0 -1
  472. package/dist/git-merge-helpers.js.map +0 -1
  473. package/dist/git-merge-lock.d.ts.map +0 -1
  474. package/dist/git-merge-lock.js.map +0 -1
  475. package/dist/git-merge-strategies.d.ts.map +0 -1
  476. package/dist/git-merge-strategies.js.map +0 -1
  477. package/dist/git-merge.d.ts.map +0 -1
  478. package/dist/git-merge.js.map +0 -1
  479. package/dist/git-state-detector.d.ts.map +0 -1
  480. package/dist/git-state-detector.js.map +0 -1
  481. package/dist/git-types.d.ts.map +0 -1
  482. package/dist/git-types.js.map +0 -1
  483. package/dist/git-utils.d.ts.map +0 -1
  484. package/dist/git-utils.js.map +0 -1
  485. package/dist/loop-context-audit-pass.d.ts.map +0 -1
  486. package/dist/loop-context-audit-pass.js.map +0 -1
  487. package/dist/loop-engine-types.d.ts.map +0 -1
  488. package/dist/loop-engine-types.js.map +0 -1
  489. package/dist/loop-engine.d.ts.map +0 -1
  490. package/dist/loop-engine.js.map +0 -1
  491. package/dist/loop-event-bus.d.ts.map +0 -1
  492. package/dist/loop-event-bus.js.map +0 -1
  493. package/dist/loop-llm-client.d.ts.map +0 -1
  494. package/dist/loop-llm-client.js.map +0 -1
  495. package/dist/loop-llm-flag.d.ts.map +0 -1
  496. package/dist/loop-llm-flag.js.map +0 -1
  497. package/dist/loop-operational-block.d.ts.map +0 -1
  498. package/dist/loop-operational-block.js.map +0 -1
  499. package/dist/loop-prompt-builder.d.ts.map +0 -1
  500. package/dist/loop-prompt-builder.js.map +0 -1
  501. package/dist/loop-variance.d.ts.map +0 -1
  502. package/dist/loop-variance.js.map +0 -1
  503. package/dist/nexus-endpoint-clearance.d.ts.map +0 -1
  504. package/dist/nexus-endpoint-clearance.js.map +0 -1
  505. package/dist/nexus-escalation-bridge.d.ts.map +0 -1
  506. package/dist/nexus-escalation-bridge.js.map +0 -1
  507. package/dist/nexus-incoming.d.ts.map +0 -1
  508. package/dist/nexus-incoming.js.map +0 -1
  509. package/dist/nexus-intake-spawn.d.ts.map +0 -1
  510. package/dist/nexus-intake-spawn.js.map +0 -1
  511. package/dist/nexus-intake.d.ts.map +0 -1
  512. package/dist/nexus-intake.js.map +0 -1
  513. package/dist/nexus-return.d.ts.map +0 -1
  514. package/dist/nexus-return.js.map +0 -1
  515. package/dist/otlp-log-parser.d.ts.map +0 -1
  516. package/dist/otlp-log-parser.js.map +0 -1
  517. package/dist/otlp-metric-parser.d.ts.map +0 -1
  518. package/dist/otlp-metric-parser.js.map +0 -1
  519. package/dist/otlp-port-manager.d.ts.map +0 -1
  520. package/dist/otlp-port-manager.js.map +0 -1
  521. package/dist/otlp-receiver.d.ts.map +0 -1
  522. package/dist/otlp-receiver.js.map +0 -1
  523. package/dist/otlp-types.d.ts.map +0 -1
  524. package/dist/otlp-types.js.map +0 -1
  525. package/dist/prd-controller.d.ts.map +0 -1
  526. package/dist/prd-controller.js.map +0 -1
  527. package/dist/prd-divergence.d.ts.map +0 -1
  528. package/dist/prd-divergence.js.map +0 -1
  529. package/dist/prd-focus-pushdown.d.ts.map +0 -1
  530. package/dist/prd-focus-pushdown.js.map +0 -1
  531. package/dist/prd-frontier.d.ts.map +0 -1
  532. package/dist/prd-frontier.js.map +0 -1
  533. package/dist/prd-steward.d.ts.map +0 -1
  534. package/dist/prd-steward.js.map +0 -1
  535. package/dist/prd-viability.d.ts.map +0 -1
  536. package/dist/prd-viability.js.map +0 -1
  537. package/dist/worktree-focus.d.ts.map +0 -1
  538. package/dist/worktree-focus.js.map +0 -1
  539. package/dist/worktree-safety.d.ts.map +0 -1
  540. package/dist/worktree-safety.js.map +0 -1
  541. package/dist/worktree-state.d.ts.map +0 -1
  542. package/dist/worktree-state.js.map +0 -1
@@ -0,0 +1,263 @@
1
+ /**
2
+ * Prompt-assembly seam for the focus-team spawn path.
3
+ *
4
+ * Extracted verbatim from focus-executor.ts (behavior-preserving): the pure
5
+ * prompt-context factory, the composed team-lead prompt builder, the stdin
6
+ * message selector (fresh prompt vs resume-delta vs scoping directive), and the
7
+ * scoping helpers they depend on. focus-executor.ts re-exports this surface for
8
+ * backward compatibility, so external importers keep resolving these symbols
9
+ * from '../focus-executor.js'.
10
+ *
11
+ * Cycle rule: this module must NOT import from '../focus-executor.js'.
12
+ */
13
+ import { getActiveFocuses } from '../queries/deliveries.js';
14
+ import { consumeForceFullPassReview } from '../completion/review-exit-phase.js';
15
+ import { buildRoleFrameworkPrompt, buildRemediationFramingSection, buildReviewOutcomeStampingSection, buildReviewSensorAuditSection, buildResumeDeltaMessage, } from '../team-prompt-base.js';
16
+ import { buildFocusTeamPrompt } from '../focus-prompt-builder.js';
17
+ import { resolveAssemblyRecipeWithManifest } from '../assembly-engine.js';
18
+ /**
19
+ * Phase C input: assemble the FocusTeamPromptContext threaded into both the
20
+ * directive and legacy prompt builders. Pure factory -- byte-identical to the
21
+ * original inline object literal; extracted so the orchestrator reads as ordered
22
+ * phase calls rather than inlining the context shape.
23
+ */
24
+ export function buildFocusPromptContext(args) {
25
+ const { config, focusId, focusName, focusDescription, deliveries, issues, executionConfig, pipelineConfig, productContextDocs, deploymentProfileSnapshot, readOnly, loopContext, reviewFiledOpenCount, engineId, } = args;
26
+ return {
27
+ focusId,
28
+ focusName,
29
+ focusDescription,
30
+ organizationId: config.organizationId,
31
+ productId: config.productId,
32
+ deliveries,
33
+ issues,
34
+ executionConfig,
35
+ pipelineConfig,
36
+ productContextDocs,
37
+ deploymentProfileSnapshot,
38
+ readOnly,
39
+ loopContext,
40
+ reviewFiledOpenCount,
41
+ engineId,
42
+ };
43
+ }
44
+ /**
45
+ * Phase C: compose the final team-lead message -- role framework + remediation
46
+ * framing + directive body (or the legacy full focus prompt), then the PRD
47
+ * milestone push-down appended last so it reaches BOTH prompt paths. Pure +
48
+ * testable. Byte-identical to the original inline composition.
49
+ */
50
+ export function buildSpawnPrompt(args) {
51
+ const { role, promptContext, useLegacyFullPrompt, directiveBody, prdMilestoneContext, isReviewPass, agentSessionId } = args;
52
+ let prompt;
53
+ if (!useLegacyFullPrompt && directiveBody !== null) {
54
+ const framing = buildRemediationFramingSection(directiveBody).join('\n');
55
+ prompt = buildRoleFrameworkPrompt(role, promptContext)
56
+ + '\n\n'
57
+ + (framing ? framing + '\n' : '')
58
+ + directiveBody;
59
+ }
60
+ else {
61
+ prompt = buildFocusTeamPrompt(role, promptContext);
62
+ }
63
+ // Review passes carry two review-only obligations. The sensor-audit charge
64
+ // (weak-sensor audit injection #8) makes the independent review frame
65
+ // interrogate the tests, not just the code; the outcome-stamping obligation
66
+ // is the terminal step, so it is appended LAST. Both reach the directive and
67
+ // legacy prompt paths and are emitted for review spawns only.
68
+ if (isReviewPass) {
69
+ prompt += '\n\n' + buildReviewSensorAuditSection().join('\n');
70
+ prompt += '\n\n' + buildReviewOutcomeStampingSection(agentSessionId).join('\n');
71
+ }
72
+ // Append PRD milestone context (push-down) so a PRD-armed focus team inherits
73
+ // the milestone's goal/expansion/vision + frontier position. Appended to the
74
+ // final prompt so it reaches BOTH the directive and legacy prompt paths; empty
75
+ // for any focus not armed by a PRD (no change to ordinary focus spawns).
76
+ if (prdMilestoneContext.trim()) {
77
+ prompt += '\n\n' + prdMilestoneContext;
78
+ }
79
+ return prompt;
80
+ }
81
+ /**
82
+ * Phase: choose the stdin message. A fresh spawn sends the full composed prompt;
83
+ * a resume sends an incremental delta (git diff + prior findings to verify) since
84
+ * the resumed session already holds its role + accumulated context (INJ-D).
85
+ *
86
+ * The scoping case is the one exception that overrides the fresh-vs-resume split:
87
+ * when a NON-read_only (executable) focus has queued deliveries carrying only
88
+ * Context Group issues and zero Task/Bug issues, this returns the role framework
89
+ * PLUS `buildQueuedDeliveryScopingMessage` REGARDLESS of resumeId. The caller pairs
90
+ * this with `resolveScopingSpawnResume`, which forces the spawn fresh (resumeId
91
+ * null) so the directive lands on a new session instead of no-opping a concluded
92
+ * one. Because the fresh session holds no accumulated context, the role framework
93
+ * (identity + Scoping Mandate + status-update rules) is prepended here; only the
94
+ * audit/kickoff DIRECTIVE body carried in `prompt` is dropped, per AC. `readOnlyFocus`
95
+ * focuses are discovery-only (audit-playbook origin): their CG-only deliveries are
96
+ * INTENTIONALLY unscoped, so they are never driven into scoping here --
97
+ * delivery-lifecycle terminalizes them instead.
98
+ */
99
+ export async function buildSpawnMessage(args) {
100
+ const { prompt, resumeId, readOnlyFocus, role, promptContext, spawnSpec, config, focusId, focusName, deliveries, issues, worktreePath, priorFindings } = args;
101
+ // Scoping directive takes priority over the fresh/resume split, but ONLY for
102
+ // executable (non-discovery) focuses. It is returned even when resumeId is
103
+ // null because the caller forces this spawn fresh for exactly this case.
104
+ if (!readOnlyFocus) {
105
+ const unscopedDeliveries = findQueuedDeliveriesWithoutTaskIssues(deliveries, issues);
106
+ if (unscopedDeliveries.length > 0) {
107
+ // Prepend the role framework (identity, Scoping Mandate, MANDATORY
108
+ // status-update rules, worker-management, escalation) so the FORCED-FRESH
109
+ // scoping session receives its operating contract -- the audit/kickoff
110
+ // DIRECTIVE body in `prompt` is the only part intentionally dropped, not the
111
+ // role framework. On a fresh session stdin is the sole first-turn message,
112
+ // so omitting the framework would leave the team lead with no identity.
113
+ const roleFramework = buildRoleFrameworkPrompt(role, promptContext);
114
+ const scopingDirective = buildQueuedDeliveryScopingMessage({
115
+ lineage: spawnSpec.lineage,
116
+ focusName,
117
+ deliveries: unscopedDeliveries,
118
+ });
119
+ const messageToSend = `${roleFramework}\n\n${scopingDirective}`;
120
+ console.log(`[focus-executor] Spawning fresh scoping session for "${focusName}" ` +
121
+ `-- role framework + explicit scoping directive for ${unscopedDeliveries.length} queued ` +
122
+ `zero-issue deliver${unscopedDeliveries.length === 1 ? 'y' : 'ies'} ` +
123
+ `(lineage ${spawnSpec.lineage}, ${messageToSend.length} chars)`);
124
+ return messageToSend;
125
+ }
126
+ }
127
+ if (!resumeId)
128
+ return prompt;
129
+ // Review resume delta is computed from the coverage watermark, not "since
130
+ // last spawn": a resumed reviewer sees reviewed_through_sha..tip when a
131
+ // completed cycle set the watermark, and the FULL branch diff (with an
132
+ // explicit full-pass demand) when none exists (first review, or the prior
133
+ // cycle aborted). Non-review resumes keep the integration-base diff.
134
+ let reviewCoverage;
135
+ let diffBaseOverride;
136
+ if (spawnSpec.lineage === 'review') {
137
+ try {
138
+ // A prior review under-covered (the branch drifted mid-review), so the
139
+ // review-exit handler armed a full pass: the incremental watermark cannot
140
+ // be trusted this cycle. consumeForceFullPassReview clears the one-shot arm.
141
+ if (consumeForceFullPassReview(focusId)) {
142
+ reviewCoverage = { mode: 'full-pass' };
143
+ }
144
+ else {
145
+ const focuses = await getActiveFocuses(config.organizationId, config.productId);
146
+ const watermark = focuses.find(f => f.focus_id === focusId)?.reviewed_through_sha ?? null;
147
+ if (watermark) {
148
+ diffBaseOverride = watermark;
149
+ reviewCoverage = { mode: 'incremental', baseSha: watermark };
150
+ }
151
+ else {
152
+ reviewCoverage = { mode: 'full-pass' };
153
+ }
154
+ }
155
+ }
156
+ catch (err) {
157
+ // On a resolve failure, default to a full pass -- the safe direction
158
+ // (re-cover everything rather than silently skip an unreviewed range).
159
+ console.debug(`[focus-executor] Review coverage watermark resolve failed (non-fatal):`, err.message);
160
+ reviewCoverage = { mode: 'full-pass' };
161
+ }
162
+ }
163
+ let gitDiff = '';
164
+ try {
165
+ const diffCtx = {
166
+ focusId,
167
+ deliveryIds: deliveries.map(d => d.id),
168
+ worktreePath,
169
+ config,
170
+ organizationId: config.organizationId,
171
+ productId: config.productId,
172
+ ...(diffBaseOverride ? { diffBaseOverride } : {}),
173
+ };
174
+ const { content } = await resolveAssemblyRecipeWithManifest(['git.diff_against_base'], diffCtx);
175
+ gitDiff = content;
176
+ }
177
+ catch (err) {
178
+ console.debug(`[focus-executor] Resume-delta diff assembly failed (non-fatal):`, err.message);
179
+ }
180
+ const messageToSend = buildResumeDeltaMessage({
181
+ lineage: spawnSpec.lineage,
182
+ focusName,
183
+ gitDiff,
184
+ priorFindings,
185
+ ...(reviewCoverage ? { reviewCoverage } : {}),
186
+ });
187
+ console.log(`[focus-executor] Resuming Claude session ${resumeId} for "${focusName}" ` +
188
+ `-- sending incremental delta (lineage ${spawnSpec.lineage}, ${messageToSend.length} chars, ` +
189
+ `${priorFindings.length} prior finding(s))`);
190
+ return messageToSend;
191
+ }
192
+ /**
193
+ * Decide whether this spawn must be forced fresh to deliver a scoping directive,
194
+ * and return the resume id the spawn should actually use.
195
+ *
196
+ * The wedge this closes: a queued delivery carrying only Context Group issues and
197
+ * zero Task/Bug issues can never cross the queued->coding gate. The daemon
198
+ * re-spawns the focus every poll, but the resume lands on a session that already
199
+ * considers the audit "done" and no-ops in one turn. The fix is to force the
200
+ * scoping spawn FRESH (resumeId null) so `buildQueuedDeliveryScopingMessage`
201
+ * primes a new session as its first instruction rather than a resume-delta a
202
+ * concluded session ignores.
203
+ *
204
+ * Only executable focuses are driven into scoping. A `readOnly` (discovery-only,
205
+ * audit-playbook) focus's CG-only deliveries are intentionally unscoped, so this
206
+ * never forces them fresh -- their resume id passes through unchanged and the
207
+ * delivery reaches a terminal state via the reconciler's discovery-only path.
208
+ *
209
+ * Pure and exported so the fresh-spawn contract is unit-testable without a live
210
+ * spawn.
211
+ */
212
+ export function resolveScopingSpawnResume(args) {
213
+ const { readOnly, deliveries, issues, resumeId } = args;
214
+ if (readOnly)
215
+ return { resumeId, isScopingSpawn: false };
216
+ const isScopingSpawn = findQueuedDeliveriesWithoutTaskIssues(deliveries, issues).length > 0;
217
+ return {
218
+ resumeId: isScopingSpawn ? null : resumeId,
219
+ isScopingSpawn,
220
+ };
221
+ }
222
+ export function findQueuedDeliveriesWithoutTaskIssues(deliveries, issues) {
223
+ const taskIssueCounts = new Map();
224
+ for (const issue of issues) {
225
+ if (issue.issueType !== 'Task' && issue.issueType !== 'Bug')
226
+ continue;
227
+ taskIssueCounts.set(issue.deliveryId, (taskIssueCounts.get(issue.deliveryId) ?? 0) + 1);
228
+ }
229
+ return deliveries.filter(delivery => (delivery.executionStatus ?? '') === 'queued' &&
230
+ (taskIssueCounts.get(delivery.id) ?? 0) === 0);
231
+ }
232
+ export function buildQueuedDeliveryScopingMessage(args) {
233
+ const deliverySections = args.deliveries
234
+ .slice()
235
+ .sort((a, b) => a.priorityRank - b.priorityRank)
236
+ .map((delivery, index) => [
237
+ `### ${index + 1}. ${delivery.name}`,
238
+ `- Delivery ID: ${delivery.id}`,
239
+ `- Priority rank: ${delivery.priorityRank}`,
240
+ '',
241
+ '**Description**',
242
+ delivery.description?.trim() || '(none)',
243
+ '',
244
+ '**Acceptance Criteria**',
245
+ delivery.acceptanceCriteria?.trim() || '(none)',
246
+ '',
247
+ '**Technical Context**',
248
+ delivery.techContext?.trim() || '(none)',
249
+ ].join('\n'))
250
+ .join('\n\n');
251
+ return [
252
+ `# Scoping Required for Newly Queued Deliveries`,
253
+ '',
254
+ `You are the team lead for lineage "${args.lineage}" on focus "${args.focusName}". This is a FRESH scoping turn (not an incremental coding-resume): the role framework above is your operating contract for it.`,
255
+ '',
256
+ `The focus has queued deliveries with zero Task/Bug issues. Decompose each delivery below into Task/Bug issues before doing code work. For each delivery, create agent-satisfiable issues from its acceptance criteria, then move at least one Task/Bug issue to In Progress. The daemon advances the delivery queued -> coding (single-writer reconciler) the moment a work issue is In Progress.`,
257
+ '',
258
+ `Do not acknowledge and stop after reading this message. The required output of this turn is scoped issues on every listed delivery, with issue statuses kept current via Telora.`,
259
+ '',
260
+ deliverySections,
261
+ ].join('\n');
262
+ }
263
+ //# sourceMappingURL=prompt-assembly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-assembly.js","sourceRoot":"","sources":["../../src/spawn/prompt-assembly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,iCAAiC,EACjC,6BAA6B,EAC7B,uBAAuB,GAExB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,iCAAiC,EAAwB,MAAM,uBAAuB,CAAC;AAGhG;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAevC;IACC,MAAM,EACJ,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EACjF,cAAc,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,QAA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,EAAE,EAAE,CAAC;QACxB,OAAO,KAAK,GAAG,CAAC,KAAK,QAAQ,CAAC,IAAI,EAAE;QACpC,kBAAkB,QAAQ,CAAC,EAAE,EAAE;QAC/B,oBAAoB,QAAQ,CAAC,YAAY,EAAE;QAC3C,EAAE;QACF,iBAAiB;QACjB,QAAQ,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,QAAQ;QACxC,EAAE;QACF,yBAAyB;QACzB,QAAQ,CAAC,kBAAkB,EAAE,IAAI,EAAE,IAAI,QAAQ;QAC/C,EAAE;QACF,uBAAuB;QACvB,QAAQ,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,QAAQ;KACzC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACZ,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,OAAO;QACL,gDAAgD;QAChD,EAAE;QACF,sCAAsC,IAAI,CAAC,OAAO,eAAe,IAAI,CAAC,SAAS,iIAAiI;QAChN,EAAE;QACF,mYAAmY;QACnY,EAAE;QACF,kLAAkL;QAClL,EAAE;QACF,gBAAgB;KACjB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Shared spawn-path types used by BOTH focus-executor.ts and the extracted
3
+ * spawn/ seams (prompt-assembly.ts).
4
+ *
5
+ * Lives here to break the import cycle: a type referenced by an extracted seam
6
+ * AND by code that remains in focus-executor.ts cannot be defined in
7
+ * focus-executor.ts (that would force a back-edge import from the seam to
8
+ * '../focus-executor.js'), so it is hoisted here where both sides import it
9
+ * without a cycle.
10
+ *
11
+ * Cycle rule: this module must NOT import from '../focus-executor.js'.
12
+ */
13
+ import type { getFocusDeliveries, getFocusIssues, getProductContextForFocus, getProductDeploymentProfileSnapshot } from '../queries/focuses.js';
14
+ import type { AssemblyManifestEntry } from '../assembly-engine.js';
15
+ import type { SessionContinuity } from '../session-lineage.js';
16
+ /**
17
+ * Phase 1 contract: everything the spawn needs that comes from the DB / assembly
18
+ * layer, fetched up front. `assemblyManifest` is the live accumulator the later
19
+ * phases keep appending to (directive assembly, etc.) before it is persisted.
20
+ */
21
+ export interface SpawnContext {
22
+ deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
23
+ issues: Awaited<ReturnType<typeof getFocusIssues>>;
24
+ productContextDocs: Awaited<ReturnType<typeof getProductContextForFocus>>;
25
+ deploymentProfileSnapshot: Awaited<ReturnType<typeof getProductDeploymentProfileSnapshot>> | null;
26
+ loopContext: string;
27
+ prdMilestoneContext: string;
28
+ assemblyManifest: AssemblyManifestEntry[];
29
+ }
30
+ /**
31
+ * Phase A contract: the resolved directive body + the spawn metadata derived
32
+ * with it, BEFORE the prompt is built. Covers all three paths -- pending
33
+ * directive, current-stage directive, legacy fallback -- in one typed result.
34
+ *
35
+ * Hoisted here to break the import cycle: referenced by both the worktree-session
36
+ * seam (resolveEngineForPass consumes spawnDirectiveDeclared) AND by code that
37
+ * remains in focus-executor.ts (resolveDirectiveOrFallback returns it), so it
38
+ * cannot live in either without a back-edge.
39
+ */
40
+ export interface DirectiveResolution {
41
+ /** Directive content appended after the role framework; null => legacy prompt. */
42
+ directiveBody: string | null;
43
+ /** Directive-declared model (legacy fallback only; filtered downstream). */
44
+ directiveModel: string | null;
45
+ /**
46
+ * Workflow stage directive engine + local-model for this spawn (the Workflow
47
+ * layer of Focus > Workflow > Default on those two axes), or null. Threaded
48
+ * into resolveEngineForPass (engine) and resolveSpawnModel (local model) so all
49
+ * three axes inherit the stage directive when the focus does not override.
50
+ */
51
+ directiveEngine: string | null;
52
+ directiveLocalModel: string | null;
53
+ /**
54
+ * Focus model override captured when a pending spawn directive (respawn) was
55
+ * stored, or null. Threaded into resolveSpawnModel so respawn resolves the
56
+ * team model under the SAME precedence as initial spawn (focus override ->
57
+ * stage -> CLI). Null when this spawn did not come from a pending directive
58
+ * (initial spawn / stage-directive path), where the live pipeline_config.model
59
+ * already carries the override.
60
+ */
61
+ pendingFocusOverrideModel: string | null;
62
+ /** Workflow stage active at spawn -- stamped as the .stage telemetry lever. */
63
+ spawnStageName: string | null;
64
+ /** Lineage + continuity declared by whatever fired this spawn (resolved later). */
65
+ spawnDirectiveDeclared: {
66
+ lineage?: string | null;
67
+ continuity?: SessionContinuity | null;
68
+ } | null;
69
+ /** True => no usable directive; build the legacy full focus prompt. */
70
+ useLegacyFullPrompt: boolean;
71
+ }
72
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/spawn/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mCAAmC,EACpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC3D,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;IACnD,kBAAkB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC;IAC1E,yBAAyB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,mCAAmC,CAAC,CAAC,GAAG,IAAI,CAAC;IAClG,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;CAC3C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;OAKG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC;;;;;;;OAOG;IACH,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,+EAA+E;IAC/E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mFAAmF;IACnF,sBAAsB,EAClB;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;KAAE,GAClE,IAAI,CAAC;IACT,uEAAuE;IACvE,mBAAmB,EAAE,OAAO,CAAC;CAC9B"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared spawn-path types used by BOTH focus-executor.ts and the extracted
3
+ * spawn/ seams (prompt-assembly.ts).
4
+ *
5
+ * Lives here to break the import cycle: a type referenced by an extracted seam
6
+ * AND by code that remains in focus-executor.ts cannot be defined in
7
+ * focus-executor.ts (that would force a back-edge import from the seam to
8
+ * '../focus-executor.js'), so it is hoisted here where both sides import it
9
+ * without a cycle.
10
+ *
11
+ * Cycle rule: this module must NOT import from '../focus-executor.js'.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/spawn/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Spawn-decision seam for the focus-team spawn path.
3
+ *
4
+ * Extracted verbatim from focus-executor.ts (behavior-preserving): the
5
+ * rank-ordered pre-spawn guard (findActionableDeliveries), the Phase 1 context
6
+ * fetch (fetchSpawnContext), the Phase 2 actionable-delivery resolution
7
+ * (resolveActionableDeliveries), and the Phase A directive-or-fallback resolver
8
+ * (resolveDirectiveOrFallback) -- plus the SpawnFocusTeamParams input contract
9
+ * and the DEFAULT_LOOP_CONTEXT_RECIPE these consume. focus-executor.ts
10
+ * re-exports this surface for backward compatibility, so external importers keep
11
+ * resolving these symbols from '../focus-executor.js'.
12
+ *
13
+ * Cycle rule: this module must NOT import from '../focus-executor.js'.
14
+ */
15
+ import type { DaemonConfig, AgentRole, FocusTeamState, PipelineConfig } from '../types.js';
16
+ import { getFocusDeliveries, getFocusIssues } from '../queries/focuses.js';
17
+ import { consumePendingSpawnDirective } from '../directive-executor.js';
18
+ import { type AssemblyManifestEntry } from '../assembly-engine.js';
19
+ import { type EngineOverride } from '../backends/index.js';
20
+ import type { SpawnContext, DirectiveResolution } from './shared.js';
21
+ /**
22
+ * Default loop-context assembly recipe for a focus-team spawn.
23
+ *
24
+ * Composed once per spawn into the team prompt. `focus.endpoint_catalog`
25
+ * is placed right after `focus.injections` so the exposed/consumed endpoint
26
+ * catalog reads alongside the tree context -- surfacing cross-product
27
+ * interrelations at scoping time (shift-left) so a dependency on another
28
+ * product can be mapped into the reality tree as an externally-owned obstacle
29
+ * rather than surfacing reactively as a blocked_by_external escalation.
30
+ */
31
+ export declare const DEFAULT_LOOP_CONTEXT_RECIPE: string[];
32
+ /**
33
+ * Result of the pre-spawn guard. Discriminated union so the caller can
34
+ * distinguish between "no work yet, spawn a planning team" and "actionable
35
+ * deliveries are queued, run them" without conflating null with empty.
36
+ */
37
+ export type SpawnDecision = {
38
+ kind: 'planning';
39
+ } | {
40
+ kind: 'execute';
41
+ deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
42
+ } | {
43
+ kind: 'skip';
44
+ };
45
+ /**
46
+ * Pre-spawn guard: rank-ordered walk that collects every agent-actionable
47
+ * delivery into the spawn set.
48
+ *
49
+ * "Actionable" and "blocking" are independent properties of a status:
50
+ *
51
+ * - actionable = `isStatusAgentActionable(status)` -- queued | coding |
52
+ * verify_failed. Work the team can pick up.
53
+ * - blocking = `isStatusBlocking(status)` -- statuses that gate
54
+ * subsequent ranks (queued, coding, planning, paused).
55
+ *
56
+ * A delivery may be actionable and blocking (queued, coding -- the common
57
+ * case), actionable and non-blocking (`verify_failed` -- has remediation
58
+ * work from a review pass, but the next-ranked queued delivery should not
59
+ * wait on it), or non-actionable and blocking (planning, paused -- gates
60
+ * the queue and the team has nothing to do here).
61
+ *
62
+ * Walk semantics:
63
+ * - Collect every actionable delivery into the spawn set.
64
+ * - Stop the walk when we hit the first blocking-and-not-actionable status
65
+ * (planning, paused). Lower-ranked deliveries past this point are gated.
66
+ * - Skip past non-blocking non-actionable statuses (done, cancelled, verify)
67
+ * without breaking the walk.
68
+ *
69
+ * Returns:
70
+ * - 'planning' when the focus has zero deliveries (agent will scope them).
71
+ * - 'execute' with the collected actionable deliveries.
72
+ * - 'skip' when the walk found zero actionable deliveries.
73
+ *
74
+ * Why verify_failed must be in the spawn set: the auto-review loop
75
+ * routes a delivery from `verify` -> `verify_failed` when the review
76
+ * agent finds remediation work, clears `review_requested_at`, and emits a
77
+ * `review_completed` loop trigger. The next poll re-derives phase from
78
+ * `ACTIVE_STATUSES` (which includes verify_failed), so the focus is
79
+ * eligible to spawn. If this guard then skips past `verify_failed`, no
80
+ * team ever picks up the remediation issues and the loop dies after the
81
+ * first pass. See delivery ac5c69f7.
82
+ */
83
+ export declare function findActionableDeliveries(deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>, focusName: string): SpawnDecision;
84
+ export interface SpawnFocusTeamParams {
85
+ config: DaemonConfig;
86
+ focusId: string;
87
+ focusName: string;
88
+ role: AgentRole;
89
+ pipelineConfig: PipelineConfig | null;
90
+ readOnly?: boolean;
91
+ /** Previous Claude Code session ID for --resume support (legacy single slot). */
92
+ lastClaudeSessionId?: string | null;
93
+ /**
94
+ * Per-lineage session-id map from the focus (INJ-A). The spawn resolves its
95
+ * resume id from the slot matching the lineage being spawned, so a coding
96
+ * spawn never reads a slot a review spawn wrote.
97
+ */
98
+ claudeSessionIds?: Record<string, string> | null;
99
+ /**
100
+ * Per-focus engine override (per-pass map {coding, review}); null/absent =
101
+ * inherit the org default. Fed into resolveBackend() (D3).
102
+ */
103
+ engineOverride?: EngineOverride | null;
104
+ /**
105
+ * Per-focus selected local model (per-pass map {coding?, review?} of
106
+ * local_models ids); null/absent = no specific local model selected. When the
107
+ * resolved engine for a pass is codex and this carries a ref for that pass,
108
+ * the daemon resolves the ref to coordinates and routes the spawn to that
109
+ * model's endpoint (D3).
110
+ */
111
+ localModelOverride?: Record<string, string | null> | null;
112
+ /** Org-level default engine id; null/absent = the global default ('claude'). */
113
+ orgDefaultEngine?: string | null;
114
+ /**
115
+ * Force a spawn even when findActionableDeliveries would return 'skip' (all
116
+ * deliveries verify/done). Set for the escalation answer re-arm path: the
117
+ * spawn's purpose is to consume a pending answer (delivered by the
118
+ * escalation.answers resolver in the standard recipe), not to advance a
119
+ * delivery -- so an idle/exited focus must still spawn. Mirrors the
120
+ * pending-spawn-directive bypass, which likewise spawns past a 'skip'.
121
+ */
122
+ forceSpawn?: boolean;
123
+ }
124
+ /**
125
+ * Phase 1: fetch all spawn context (deliveries / issues / product-context /
126
+ * deployment-profile / loop-context) in one Promise.all, then resolve the PRD
127
+ * milestone push-down. Returns null when the context fetch rejects -- the
128
+ * caller treats null as "tear down the freshly-inserted team and return"
129
+ * (activeTeams.delete). The PRD push-down deliberately propagates on throw,
130
+ * matching the pre-extraction behavior (it sits after the try/catch).
131
+ *
132
+ * Behavior-preserving extraction of the original inline block; the log lines,
133
+ * the deployment-profile .catch fallback, the loop-context try/catch fallback,
134
+ * and the manifest accumulation order are byte-identical.
135
+ */
136
+ export declare function fetchSpawnContext(config: DaemonConfig, focusId: string, focusName: string): Promise<SpawnContext | null>;
137
+ /**
138
+ * Phase 2 contract: the actionable-delivery decision. 'skip' tells the caller to
139
+ * tear down (activeTeams.delete + return); 'proceed' carries the consumed
140
+ * pending directive (used downstream in Phase A + spawn-phase tagging), the
141
+ * collected actionable deliveries, and the planning-spawn flag.
142
+ */
143
+ export type ActionableResolution = {
144
+ kind: 'skip';
145
+ } | {
146
+ kind: 'proceed';
147
+ pendingDirective: ReturnType<typeof consumePendingSpawnDirective>;
148
+ actionableDeliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
149
+ isPlanningSpawn: boolean;
150
+ };
151
+ /**
152
+ * Phase 2: consume any pending spawn directive, enforce the rank-ordered
153
+ * pre-spawn guard, and record known-delivery bookkeeping on the team state.
154
+ *
155
+ * Mutates `teamState` exactly as the original inline block did
156
+ * (lastConsumedDirectiveHash, sessionType, planningPhase, knownDeliveryIds,
157
+ * deliveryStageIds, mergedDeliveryIds) and emits the same log lines. Returns
158
+ * 'skip' for the findActionableDeliveries skip case (the caller owns the
159
+ * activeTeams.delete + return so the team-state map stays the orchestrator's
160
+ * responsibility). Behavior byte-identical.
161
+ */
162
+ export declare function resolveActionableDeliveries(args: {
163
+ focusId: string;
164
+ focusName: string;
165
+ deliveries: Awaited<ReturnType<typeof getFocusDeliveries>>;
166
+ issues: Awaited<ReturnType<typeof getFocusIssues>>;
167
+ forceSpawn: boolean;
168
+ teamState: FocusTeamState;
169
+ }): ActionableResolution;
170
+ /**
171
+ * Phase A: resolve the team-lead directive body + spawn metadata (no prompt
172
+ * yet). Priority: pending spawn directive > current-stage directive > legacy
173
+ * full prompt. Pushes any assembled directive manifest entries onto the shared
174
+ * `assemblyManifest` accumulator.
175
+ *
176
+ * Behavior-preserving extraction of the original inline Phase A block -- the
177
+ * "Using pending spawn directive" / "Using stage directive" log lines, the
178
+ * "LEGACY PROMPT FALLBACK" warning and every fallbackReason string, and the
179
+ * directive-manifest accumulation are byte-identical.
180
+ */
181
+ export declare function resolveDirectiveOrFallback(args: {
182
+ config: DaemonConfig;
183
+ focusId: string;
184
+ focusName: string;
185
+ worktreePath: string;
186
+ pendingDirective: ReturnType<typeof consumePendingSpawnDirective>;
187
+ assemblyManifest: AssemblyManifestEntry[];
188
+ }): Promise<DirectiveResolution>;
189
+ //# sourceMappingURL=spawn-decision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-decision.d.ts","sourceRoot":"","sources":["../../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