smol-symphony 0.2.0 → 0.3.1

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 (540) hide show
  1. package/AGENTS.md +41 -22
  2. package/DESIGN.md +494 -273
  3. package/README.md +109 -57
  4. package/SPEC.md +33 -24
  5. package/WORKFLOW.minimal.yaml +34 -0
  6. package/{WORKFLOW.template.md → WORKFLOW.template.yaml} +409 -256
  7. package/WORKFLOW.yaml +487 -0
  8. package/assets/skills/symphony-issues/SKILL.md +136 -0
  9. package/assets/symphony-mise.system.toml +68 -0
  10. package/dist/bin/symphony.js +22 -786
  11. package/dist/bin/symphony.js.map +1 -1
  12. package/dist/core/actions/context.js +109 -0
  13. package/dist/core/actions/context.js.map +1 -0
  14. package/dist/{actions/parsing.js → core/actions/parse.js} +33 -114
  15. package/dist/core/actions/parse.js.map +1 -0
  16. package/dist/core/actions/plan.js +197 -0
  17. package/dist/core/actions/plan.js.map +1 -0
  18. package/dist/core/actions/predicates.js +111 -0
  19. package/dist/core/actions/predicates.js.map +1 -0
  20. package/dist/core/actions/run-fold.js +248 -0
  21. package/dist/core/actions/run-fold.js.map +1 -0
  22. package/dist/core/actions/template.js +118 -0
  23. package/dist/core/actions/template.js.map +1 -0
  24. package/dist/core/cli/args.js +116 -0
  25. package/dist/core/cli/args.js.map +1 -0
  26. package/dist/core/coerce.js +75 -0
  27. package/dist/core/coerce.js.map +1 -0
  28. package/dist/core/credential/account-id.js +20 -0
  29. package/dist/core/credential/account-id.js.map +1 -0
  30. package/dist/core/credential/adapter-config.js +136 -0
  31. package/dist/core/credential/adapter-config.js.map +1 -0
  32. package/dist/core/credential/availability.js +98 -0
  33. package/dist/core/credential/availability.js.map +1 -0
  34. package/dist/core/credential/extract.js +228 -0
  35. package/dist/core/credential/extract.js.map +1 -0
  36. package/dist/core/credential/fake-creds.js +171 -0
  37. package/dist/core/credential/fake-creds.js.map +1 -0
  38. package/dist/core/credential/identity.js +125 -0
  39. package/dist/core/credential/identity.js.map +1 -0
  40. package/dist/core/credential/shape.js +230 -0
  41. package/dist/core/credential/shape.js.map +1 -0
  42. package/dist/core/credential/strings.js +15 -0
  43. package/dist/core/credential/strings.js.map +1 -0
  44. package/dist/core/doctor/checks.js +303 -0
  45. package/dist/core/doctor/checks.js.map +1 -0
  46. package/dist/core/git/result.js +107 -0
  47. package/dist/core/git/result.js.map +1 -0
  48. package/dist/core/http/decisions.js +225 -0
  49. package/dist/core/http/decisions.js.map +1 -0
  50. package/dist/{http.js → core/http/render.js} +472 -738
  51. package/dist/core/http/render.js.map +1 -0
  52. package/dist/{http-handlers.js → core/http/routes.js} +52 -87
  53. package/dist/core/http/routes.js.map +1 -0
  54. package/dist/core/http/views.js +181 -0
  55. package/dist/core/http/views.js.map +1 -0
  56. package/dist/core/image/managed-image.js +95 -0
  57. package/dist/core/image/managed-image.js.map +1 -0
  58. package/dist/core/issue/file.js +149 -0
  59. package/dist/core/issue/file.js.map +1 -0
  60. package/dist/core/issue/parse.js +210 -0
  61. package/dist/core/issue/parse.js.map +1 -0
  62. package/dist/core/mcp/dispatch.js +239 -0
  63. package/dist/core/mcp/dispatch.js.map +1 -0
  64. package/dist/core/mcp/post-move.js +92 -0
  65. package/dist/core/mcp/post-move.js.map +1 -0
  66. package/dist/core/mcp/protocol.js +293 -0
  67. package/dist/core/mcp/protocol.js.map +1 -0
  68. package/dist/core/mcp/url.js +162 -0
  69. package/dist/core/mcp/url.js.map +1 -0
  70. package/dist/core/path.js +63 -0
  71. package/dist/core/path.js.map +1 -0
  72. package/dist/core/reconcile/image-decide.js +48 -0
  73. package/dist/core/reconcile/image-decide.js.map +1 -0
  74. package/dist/core/reconcile/ledger.js +142 -0
  75. package/dist/core/reconcile/ledger.js.map +1 -0
  76. package/dist/core/reconcile/pr-classify.js +62 -0
  77. package/dist/core/reconcile/pr-classify.js.map +1 -0
  78. package/dist/{reconciler → core/reconcile}/pr-decide.js +25 -12
  79. package/dist/core/reconcile/pr-decide.js.map +1 -0
  80. package/dist/core/reconcile/pr-loop.js +161 -0
  81. package/dist/core/reconcile/pr-loop.js.map +1 -0
  82. package/dist/core/reconcile/pr-notes.js +35 -0
  83. package/dist/core/reconcile/pr-notes.js.map +1 -0
  84. package/dist/core/reconcile/vm-decide.js +70 -0
  85. package/dist/core/reconcile/vm-decide.js.map +1 -0
  86. package/dist/core/reconcile/vm-reap.js +207 -0
  87. package/dist/core/reconcile/vm-reap.js.map +1 -0
  88. package/dist/core/reconcile/workspace-decide.js +162 -0
  89. package/dist/core/reconcile/workspace-decide.js.map +1 -0
  90. package/dist/core/runlog/summary.js +231 -0
  91. package/dist/core/runlog/summary.js.map +1 -0
  92. package/dist/core/runner/dispatch-config.js +95 -0
  93. package/dist/core/runner/dispatch-config.js.map +1 -0
  94. package/dist/core/runner/injection.js +61 -0
  95. package/dist/core/runner/injection.js.map +1 -0
  96. package/dist/core/runner/mise.js +210 -0
  97. package/dist/core/runner/mise.js.map +1 -0
  98. package/dist/core/runner/prompt.js +720 -0
  99. package/dist/core/runner/prompt.js.map +1 -0
  100. package/dist/core/runner/turn.js +242 -0
  101. package/dist/core/runner/turn.js.map +1 -0
  102. package/dist/core/runner/vm-plan.js +390 -0
  103. package/dist/core/runner/vm-plan.js.map +1 -0
  104. package/dist/core/schedule/admission.js +123 -0
  105. package/dist/core/schedule/admission.js.map +1 -0
  106. package/dist/core/schedule/circuit-breaker.js +111 -0
  107. package/dist/core/schedule/circuit-breaker.js.map +1 -0
  108. package/dist/core/schedule/eligibility.js +83 -0
  109. package/dist/core/schedule/eligibility.js.map +1 -0
  110. package/dist/core/schedule/reconcile-issue.js +82 -0
  111. package/dist/core/schedule/reconcile-issue.js.map +1 -0
  112. package/dist/core/schedule/retry.js +96 -0
  113. package/dist/core/schedule/retry.js.map +1 -0
  114. package/dist/core/schedule/sleep-cycle.js +133 -0
  115. package/dist/core/schedule/sleep-cycle.js.map +1 -0
  116. package/dist/core/schedule/slots.js +124 -0
  117. package/dist/core/schedule/slots.js.map +1 -0
  118. package/dist/core/schedule/tick.js +553 -0
  119. package/dist/core/schedule/tick.js.map +1 -0
  120. package/dist/core/schedule/token-fold.js +181 -0
  121. package/dist/core/schedule/token-fold.js.map +1 -0
  122. package/dist/core/state-resolve.js +86 -0
  123. package/dist/core/state-resolve.js.map +1 -0
  124. package/dist/core/vm-guards.js +278 -0
  125. package/dist/core/vm-guards.js.map +1 -0
  126. package/dist/core/workflow/derive.js +107 -0
  127. package/dist/core/workflow/derive.js.map +1 -0
  128. package/dist/core/workflow/parse.js +687 -0
  129. package/dist/core/workflow/parse.js.map +1 -0
  130. package/dist/core/workflow/prompt-probe.js +78 -0
  131. package/dist/core/workflow/prompt-probe.js.map +1 -0
  132. package/dist/core/workflow/validate.js +189 -0
  133. package/dist/core/workflow/validate.js.map +1 -0
  134. package/dist/core/workspace-key.js +19 -0
  135. package/dist/core/workspace-key.js.map +1 -0
  136. package/dist/shell/actions-runner.js +356 -0
  137. package/dist/shell/actions-runner.js.map +1 -0
  138. package/dist/shell/adapter/adapter-registry.js +45 -0
  139. package/dist/shell/adapter/adapter-registry.js.map +1 -0
  140. package/dist/shell/adapter/clock-random.js +96 -0
  141. package/dist/shell/adapter/clock-random.js.map +1 -0
  142. package/dist/shell/adapter/gondolin-dispatch-helpers.js +158 -0
  143. package/dist/shell/adapter/gondolin-dispatch-helpers.js.map +1 -0
  144. package/dist/shell/adapter/gondolin-dispatch.js +385 -0
  145. package/dist/shell/adapter/gondolin-dispatch.js.map +1 -0
  146. package/dist/shell/adapter/gondolin-image-converter.js +233 -0
  147. package/dist/shell/adapter/gondolin-image-converter.js.map +1 -0
  148. package/dist/shell/adapter/gondolin-image-fetch.js +180 -0
  149. package/dist/shell/adapter/gondolin-image-fetch.js.map +1 -0
  150. package/dist/shell/adapter/launcher-asset.js +57 -0
  151. package/dist/shell/adapter/launcher-asset.js.map +1 -0
  152. package/dist/shell/adapter/mise-config-asset.js +65 -0
  153. package/dist/shell/adapter/mise-config-asset.js.map +1 -0
  154. package/dist/shell/adapter/workflow-loader.js +304 -0
  155. package/dist/shell/adapter/workflow-loader.js.map +1 -0
  156. package/dist/shell/cli/doctor.js +268 -0
  157. package/dist/shell/cli/doctor.js.map +1 -0
  158. package/dist/shell/effect-interpreter-families.js +314 -0
  159. package/dist/shell/effect-interpreter-families.js.map +1 -0
  160. package/dist/shell/effect-interpreter.js +29 -0
  161. package/dist/shell/effect-interpreter.js.map +1 -0
  162. package/dist/shell/interp/acp-frame.js +137 -0
  163. package/dist/shell/interp/acp-frame.js.map +1 -0
  164. package/dist/shell/interp/acp-ws-conn.js +320 -0
  165. package/dist/shell/interp/acp-ws-conn.js.map +1 -0
  166. package/dist/shell/interp/acp-ws-frames.js +159 -0
  167. package/dist/shell/interp/acp-ws-frames.js.map +1 -0
  168. package/dist/shell/interp/acp-ws.js +197 -0
  169. package/dist/shell/interp/acp-ws.js.map +1 -0
  170. package/dist/shell/interp/acp.js +319 -0
  171. package/dist/shell/interp/acp.js.map +1 -0
  172. package/dist/shell/interp/credential-defaults.js +128 -0
  173. package/dist/shell/interp/credential-defaults.js.map +1 -0
  174. package/dist/shell/interp/credential-hooks.js +149 -0
  175. package/dist/shell/interp/credential-hooks.js.map +1 -0
  176. package/dist/shell/interp/credential-registry.js +226 -0
  177. package/dist/shell/interp/credential-registry.js.map +1 -0
  178. package/dist/shell/interp/credential.js +103 -0
  179. package/dist/shell/interp/credential.js.map +1 -0
  180. package/dist/shell/interp/gh.js +163 -0
  181. package/dist/shell/interp/gh.js.map +1 -0
  182. package/dist/shell/interp/git.js +28 -0
  183. package/dist/shell/interp/git.js.map +1 -0
  184. package/dist/shell/interp/log.js +213 -0
  185. package/dist/shell/interp/log.js.map +1 -0
  186. package/dist/shell/interp/process.js +178 -0
  187. package/dist/shell/interp/process.js.map +1 -0
  188. package/dist/shell/interp/runlog.js +193 -0
  189. package/dist/shell/interp/runlog.js.map +1 -0
  190. package/dist/shell/interp/timer.js +64 -0
  191. package/dist/shell/interp/timer.js.map +1 -0
  192. package/dist/shell/interp/tracker-disk.js +99 -0
  193. package/dist/shell/interp/tracker-disk.js.map +1 -0
  194. package/dist/shell/interp/tracker-parse.js +71 -0
  195. package/dist/shell/interp/tracker-parse.js.map +1 -0
  196. package/dist/shell/interp/tracker-scan.js +238 -0
  197. package/dist/shell/interp/tracker-scan.js.map +1 -0
  198. package/dist/shell/interp/tracker-write.js +91 -0
  199. package/dist/shell/interp/tracker-write.js.map +1 -0
  200. package/dist/shell/interp/tracker.js +41 -0
  201. package/dist/shell/interp/tracker.js.map +1 -0
  202. package/dist/shell/interp/tty.js +48 -0
  203. package/dist/shell/interp/tty.js.map +1 -0
  204. package/dist/shell/interp/vm.js +199 -0
  205. package/dist/shell/interp/vm.js.map +1 -0
  206. package/dist/shell/interp/workspace.js +310 -0
  207. package/dist/shell/interp/workspace.js.map +1 -0
  208. package/dist/shell/main-acp.js +78 -0
  209. package/dist/shell/main-acp.js.map +1 -0
  210. package/dist/shell/main-adapters.js +222 -0
  211. package/dist/shell/main-adapters.js.map +1 -0
  212. package/dist/shell/main-credential.js +122 -0
  213. package/dist/shell/main-credential.js.map +1 -0
  214. package/dist/shell/main-doctor.js +22 -0
  215. package/dist/shell/main-doctor.js.map +1 -0
  216. package/dist/shell/main-entry.js +46 -0
  217. package/dist/shell/main-entry.js.map +1 -0
  218. package/dist/shell/main-http-csrf.js +45 -0
  219. package/dist/shell/main-http-csrf.js.map +1 -0
  220. package/dist/shell/main-http-handler.js +389 -0
  221. package/dist/shell/main-http-handler.js.map +1 -0
  222. package/dist/shell/main-http-mcp.js +122 -0
  223. package/dist/shell/main-http-mcp.js.map +1 -0
  224. package/dist/shell/main-http-views.js +253 -0
  225. package/dist/shell/main-http-views.js.map +1 -0
  226. package/dist/shell/main-http.js +76 -0
  227. package/dist/shell/main-http.js.map +1 -0
  228. package/dist/shell/main-loops.js +130 -0
  229. package/dist/shell/main-loops.js.map +1 -0
  230. package/dist/shell/main-mcp.js +129 -0
  231. package/dist/shell/main-mcp.js.map +1 -0
  232. package/dist/shell/main-orchestrator.js +120 -0
  233. package/dist/shell/main-orchestrator.js.map +1 -0
  234. package/dist/shell/main-preflight.js +43 -0
  235. package/dist/shell/main-preflight.js.map +1 -0
  236. package/dist/shell/main-reconcilers-helpers.js +244 -0
  237. package/dist/shell/main-reconcilers-helpers.js.map +1 -0
  238. package/dist/shell/main-reconcilers-pr.js +148 -0
  239. package/dist/shell/main-reconcilers-pr.js.map +1 -0
  240. package/dist/shell/main-reconcilers.js +225 -0
  241. package/dist/shell/main-reconcilers.js.map +1 -0
  242. package/dist/shell/main-runner.js +355 -0
  243. package/dist/shell/main-runner.js.map +1 -0
  244. package/dist/shell/main-scaffold.js +116 -0
  245. package/dist/shell/main-scaffold.js.map +1 -0
  246. package/dist/shell/main-shutdown.js +115 -0
  247. package/dist/shell/main-shutdown.js.map +1 -0
  248. package/dist/shell/main-startup.js +48 -0
  249. package/dist/shell/main-startup.js.map +1 -0
  250. package/dist/shell/main-substrates.js +43 -0
  251. package/dist/shell/main-substrates.js.map +1 -0
  252. package/dist/shell/main.js +385 -0
  253. package/dist/shell/main.js.map +1 -0
  254. package/dist/shell/orchestrator-feedback.js +69 -0
  255. package/dist/shell/orchestrator-feedback.js.map +1 -0
  256. package/dist/shell/orchestrator-image.js +167 -0
  257. package/dist/shell/orchestrator-image.js.map +1 -0
  258. package/dist/shell/orchestrator-loop.js +468 -0
  259. package/dist/shell/orchestrator-loop.js.map +1 -0
  260. package/dist/shell/orchestrator-reconcile.js +36 -0
  261. package/dist/shell/orchestrator-reconcile.js.map +1 -0
  262. package/dist/shell/reconciler-loop.js +228 -0
  263. package/dist/shell/reconciler-loop.js.map +1 -0
  264. package/dist/shell/runner-loop-turn.js +301 -0
  265. package/dist/shell/runner-loop-turn.js.map +1 -0
  266. package/dist/shell/runner-loop.js +338 -0
  267. package/dist/shell/runner-loop.js.map +1 -0
  268. package/dist/shell/server/http.js +208 -0
  269. package/dist/shell/server/http.js.map +1 -0
  270. package/dist/shell/server/mcp-runtime-effects.js +237 -0
  271. package/dist/shell/server/mcp-runtime-effects.js.map +1 -0
  272. package/dist/shell/server/mcp-runtime.js +99 -0
  273. package/dist/shell/server/mcp-runtime.js.map +1 -0
  274. package/dist/shell/workspace-key.js +14 -0
  275. package/dist/shell/workspace-key.js.map +1 -0
  276. package/dist/types/acp.js +8 -0
  277. package/dist/types/acp.js.map +1 -0
  278. package/dist/types/actions/plan.js +6 -0
  279. package/dist/types/actions/plan.js.map +1 -0
  280. package/dist/types/actions/predicates.js +6 -0
  281. package/dist/types/actions/predicates.js.map +1 -0
  282. package/dist/types/actions/run-fold.js +8 -0
  283. package/dist/types/actions/run-fold.js.map +1 -0
  284. package/dist/types/actions.js +7 -0
  285. package/dist/types/actions.js.map +1 -0
  286. package/dist/types/adapter/clock-random.js +4 -0
  287. package/dist/types/adapter/clock-random.js.map +1 -0
  288. package/dist/types/adapter/gondolin-image-converter.js +5 -0
  289. package/dist/types/adapter/gondolin-image-converter.js.map +1 -0
  290. package/dist/types/adapter/gondolin-image-fetch.js +5 -0
  291. package/dist/types/adapter/gondolin-image-fetch.js.map +1 -0
  292. package/dist/types/adapter/workflow-loader.js +4 -0
  293. package/dist/types/adapter/workflow-loader.js.map +1 -0
  294. package/dist/types/cli/args.js +8 -0
  295. package/dist/types/cli/args.js.map +1 -0
  296. package/dist/types/config.js +8 -0
  297. package/dist/types/config.js.map +1 -0
  298. package/dist/types/credential-interp.js +6 -0
  299. package/dist/types/credential-interp.js.map +1 -0
  300. package/dist/types/credentials.js +10 -0
  301. package/dist/types/credentials.js.map +1 -0
  302. package/dist/types/doctor.js +7 -0
  303. package/dist/types/doctor.js.map +1 -0
  304. package/dist/types/domain.js +7 -0
  305. package/dist/types/domain.js.map +1 -0
  306. package/dist/types/effect.js +15 -0
  307. package/dist/types/effect.js.map +1 -0
  308. package/dist/types/errors.js +39 -0
  309. package/dist/types/errors.js.map +1 -0
  310. package/dist/types/http/decisions.js +6 -0
  311. package/dist/types/http/decisions.js.map +1 -0
  312. package/dist/types/http/render.js +10 -0
  313. package/dist/types/http/render.js.map +1 -0
  314. package/dist/types/http/views.js +6 -0
  315. package/dist/types/http/views.js.map +1 -0
  316. package/dist/types/http.js +9 -0
  317. package/dist/types/http.js.map +1 -0
  318. package/dist/types/image/managed-image.js +7 -0
  319. package/dist/types/image/managed-image.js.map +1 -0
  320. package/dist/types/interp/effect-interpreter.js +8 -0
  321. package/dist/types/interp/effect-interpreter.js.map +1 -0
  322. package/dist/types/interp/tracker.js +7 -0
  323. package/dist/types/interp/tracker.js.map +1 -0
  324. package/dist/types/issue/file.js +6 -0
  325. package/dist/types/issue/file.js.map +1 -0
  326. package/dist/types/issue/parse.js +8 -0
  327. package/dist/types/issue/parse.js.map +1 -0
  328. package/dist/types/main-acp.js +13 -0
  329. package/dist/types/main-acp.js.map +1 -0
  330. package/dist/types/main-adapters.js +5 -0
  331. package/dist/types/main-adapters.js.map +1 -0
  332. package/dist/types/main-credential.js +21 -0
  333. package/dist/types/main-credential.js.map +1 -0
  334. package/dist/types/main-doctor.js +6 -0
  335. package/dist/types/main-doctor.js.map +1 -0
  336. package/dist/types/main-http-handler.js +12 -0
  337. package/dist/types/main-http-handler.js.map +1 -0
  338. package/dist/types/main-http.js +5 -0
  339. package/dist/types/main-http.js.map +1 -0
  340. package/dist/types/main-loops.js +5 -0
  341. package/dist/types/main-loops.js.map +1 -0
  342. package/dist/types/main-mcp.js +12 -0
  343. package/dist/types/main-mcp.js.map +1 -0
  344. package/dist/types/main-orchestrator.js +5 -0
  345. package/dist/types/main-orchestrator.js.map +1 -0
  346. package/dist/types/main-reconcilers.js +11 -0
  347. package/dist/types/main-reconcilers.js.map +1 -0
  348. package/dist/types/main-runner.js +13 -0
  349. package/dist/types/main-runner.js.map +1 -0
  350. package/dist/types/main-startup.js +5 -0
  351. package/dist/types/main-startup.js.map +1 -0
  352. package/dist/types/main-substrates.js +5 -0
  353. package/dist/types/main-substrates.js.map +1 -0
  354. package/dist/types/mcp/dispatch.js +4 -0
  355. package/dist/types/mcp/dispatch.js.map +1 -0
  356. package/dist/types/mcp/post-move.js +7 -0
  357. package/dist/types/mcp/post-move.js.map +1 -0
  358. package/dist/types/mcp.js +9 -0
  359. package/dist/types/mcp.js.map +1 -0
  360. package/dist/types/ports.js +12 -0
  361. package/dist/types/ports.js.map +1 -0
  362. package/dist/types/reconcile/image-decide.js +5 -0
  363. package/dist/types/reconcile/image-decide.js.map +1 -0
  364. package/dist/types/reconcile/ledger.js +7 -0
  365. package/dist/types/reconcile/ledger.js.map +1 -0
  366. package/dist/types/reconcile/pr-loop.js +8 -0
  367. package/dist/types/reconcile/pr-loop.js.map +1 -0
  368. package/dist/types/reconcile/vm-reap.js +8 -0
  369. package/dist/types/reconcile/vm-reap.js.map +1 -0
  370. package/dist/types/reconcile/workspace-decide.js +7 -0
  371. package/dist/types/reconcile/workspace-decide.js.map +1 -0
  372. package/dist/types/reconcile.js +9 -0
  373. package/dist/types/reconcile.js.map +1 -0
  374. package/dist/types/runlog.js +7 -0
  375. package/dist/types/runlog.js.map +1 -0
  376. package/dist/types/runner/actions-runner.js +12 -0
  377. package/dist/types/runner/actions-runner.js.map +1 -0
  378. package/dist/types/runner/gondolin-dispatch.js +5 -0
  379. package/dist/types/runner/gondolin-dispatch.js.map +1 -0
  380. package/dist/types/runner/injection.js +6 -0
  381. package/dist/types/runner/injection.js.map +1 -0
  382. package/dist/types/runner/runner-loop.js +5 -0
  383. package/dist/types/runner/runner-loop.js.map +1 -0
  384. package/dist/types/runner/turn.js +4 -0
  385. package/dist/types/runner/turn.js.map +1 -0
  386. package/dist/types/runner/vm-plan.js +4 -0
  387. package/dist/types/runner/vm-plan.js.map +1 -0
  388. package/dist/types/runtime.js +9 -0
  389. package/dist/types/runtime.js.map +1 -0
  390. package/dist/types/schedule/admission.js +7 -0
  391. package/dist/types/schedule/admission.js.map +1 -0
  392. package/dist/types/schedule/circuit-breaker.js +2 -0
  393. package/dist/types/schedule/circuit-breaker.js.map +1 -0
  394. package/dist/types/schedule/eligibility.js +9 -0
  395. package/dist/types/schedule/eligibility.js.map +1 -0
  396. package/dist/types/schedule/orchestrator-loop.js +10 -0
  397. package/dist/types/schedule/orchestrator-loop.js.map +1 -0
  398. package/dist/types/schedule/sleep-cycle.js +4 -0
  399. package/dist/types/schedule/sleep-cycle.js.map +1 -0
  400. package/dist/types/schedule/slots.js +8 -0
  401. package/dist/types/schedule/slots.js.map +1 -0
  402. package/dist/types/schedule/tick.js +9 -0
  403. package/dist/types/schedule/tick.js.map +1 -0
  404. package/dist/types/server/mcp-runtime.js +8 -0
  405. package/dist/types/server/mcp-runtime.js.map +1 -0
  406. package/dist/types/workflow/parse.js +4 -0
  407. package/dist/types/workflow/parse.js.map +1 -0
  408. package/package.json +22 -10
  409. package/patches/@earendil-works+gondolin+0.12.0.patch +173 -0
  410. package/prompts/Reflect.md +91 -0
  411. package/prompts/Review.md +97 -0
  412. package/prompts/Todo.md +96 -0
  413. package/prompts/_footer.md +41 -0
  414. package/prompts/_preamble.md +42 -0
  415. package/prompts-minimal/Todo.md +26 -0
  416. package/scripts/postinstall.mjs +63 -0
  417. package/scripts/vm-agent.mjs +312 -90
  418. package/WORKFLOW.md +0 -744
  419. package/dist/acp-bridge.js +0 -324
  420. package/dist/acp-bridge.js.map +0 -1
  421. package/dist/actions/cache.js +0 -191
  422. package/dist/actions/cache.js.map +0 -1
  423. package/dist/actions/effects.js +0 -41
  424. package/dist/actions/effects.js.map +0 -1
  425. package/dist/actions/executor.js +0 -570
  426. package/dist/actions/executor.js.map +0 -1
  427. package/dist/actions/index.js +0 -13
  428. package/dist/actions/index.js.map +0 -1
  429. package/dist/actions/parsing.js.map +0 -1
  430. package/dist/actions/predicate-env.js +0 -27
  431. package/dist/actions/predicate-env.js.map +0 -1
  432. package/dist/actions/predicates.js +0 -49
  433. package/dist/actions/predicates.js.map +0 -1
  434. package/dist/actions/templating.js +0 -66
  435. package/dist/actions/templating.js.map +0 -1
  436. package/dist/actions/types.js +0 -15
  437. package/dist/actions/types.js.map +0 -1
  438. package/dist/agent/acp.js +0 -473
  439. package/dist/agent/acp.js.map +0 -1
  440. package/dist/agent/adapter-names.js +0 -159
  441. package/dist/agent/adapter-names.js.map +0 -1
  442. package/dist/agent/adapters.js +0 -511
  443. package/dist/agent/adapters.js.map +0 -1
  444. package/dist/agent/credential-extractors.js +0 -342
  445. package/dist/agent/credential-extractors.js.map +0 -1
  446. package/dist/agent/credential-secrets.js +0 -628
  447. package/dist/agent/credential-secrets.js.map +0 -1
  448. package/dist/agent/credential-ticker.js +0 -57
  449. package/dist/agent/credential-ticker.js.map +0 -1
  450. package/dist/agent/gondolin-creds-staging.js +0 -356
  451. package/dist/agent/gondolin-creds-staging.js.map +0 -1
  452. package/dist/agent/gondolin-dispatch.js +0 -375
  453. package/dist/agent/gondolin-dispatch.js.map +0 -1
  454. package/dist/agent/gondolin.js +0 -124
  455. package/dist/agent/gondolin.js.map +0 -1
  456. package/dist/agent/runner-decisions.js +0 -134
  457. package/dist/agent/runner-decisions.js.map +0 -1
  458. package/dist/agent/runner.js +0 -1456
  459. package/dist/agent/runner.js.map +0 -1
  460. package/dist/agent/tool-call-summary.js +0 -102
  461. package/dist/agent/tool-call-summary.js.map +0 -1
  462. package/dist/agent/vm-acp-mapping.js +0 -73
  463. package/dist/agent/vm-acp-mapping.js.map +0 -1
  464. package/dist/agent/vm-guards.js +0 -262
  465. package/dist/agent/vm-guards.js.map +0 -1
  466. package/dist/agent/vm-port.js +0 -22
  467. package/dist/agent/vm-port.js.map +0 -1
  468. package/dist/agent/vm-process-registry.js +0 -79
  469. package/dist/agent/vm-process-registry.js.map +0 -1
  470. package/dist/bin/cli-args.js +0 -105
  471. package/dist/bin/cli-args.js.map +0 -1
  472. package/dist/errors.js +0 -15
  473. package/dist/errors.js.map +0 -1
  474. package/dist/http-disk.js +0 -135
  475. package/dist/http-disk.js.map +0 -1
  476. package/dist/http-handlers.js.map +0 -1
  477. package/dist/http.js.map +0 -1
  478. package/dist/issues.js +0 -178
  479. package/dist/issues.js.map +0 -1
  480. package/dist/logging.js +0 -203
  481. package/dist/logging.js.map +0 -1
  482. package/dist/mcp.js +0 -706
  483. package/dist/mcp.js.map +0 -1
  484. package/dist/memory.js +0 -85
  485. package/dist/memory.js.map +0 -1
  486. package/dist/orchestrator-decisions.js +0 -331
  487. package/dist/orchestrator-decisions.js.map +0 -1
  488. package/dist/orchestrator.js +0 -1569
  489. package/dist/orchestrator.js.map +0 -1
  490. package/dist/prompt.js +0 -65
  491. package/dist/prompt.js.map +0 -1
  492. package/dist/reconciler/cache.js +0 -65
  493. package/dist/reconciler/cache.js.map +0 -1
  494. package/dist/reconciler/index.js +0 -448
  495. package/dist/reconciler/index.js.map +0 -1
  496. package/dist/reconciler/ledger.js +0 -131
  497. package/dist/reconciler/ledger.js.map +0 -1
  498. package/dist/reconciler/pr-adapters.js +0 -174
  499. package/dist/reconciler/pr-adapters.js.map +0 -1
  500. package/dist/reconciler/pr-decide.js.map +0 -1
  501. package/dist/reconciler/pr.js +0 -422
  502. package/dist/reconciler/pr.js.map +0 -1
  503. package/dist/reconciler/types.js +0 -12
  504. package/dist/reconciler/types.js.map +0 -1
  505. package/dist/reconciler/vm.js +0 -243
  506. package/dist/reconciler/vm.js.map +0 -1
  507. package/dist/reconciler/workspace-defaults.js +0 -83
  508. package/dist/reconciler/workspace-defaults.js.map +0 -1
  509. package/dist/reconciler/workspace.js +0 -272
  510. package/dist/reconciler/workspace.js.map +0 -1
  511. package/dist/runlog.js +0 -403
  512. package/dist/runlog.js.map +0 -1
  513. package/dist/scaffold.js +0 -165
  514. package/dist/scaffold.js.map +0 -1
  515. package/dist/trackers/local.js +0 -445
  516. package/dist/trackers/local.js.map +0 -1
  517. package/dist/trackers/types.js +0 -10
  518. package/dist/trackers/types.js.map +0 -1
  519. package/dist/types.js +0 -3
  520. package/dist/types.js.map +0 -1
  521. package/dist/util/clock.js +0 -12
  522. package/dist/util/clock.js.map +0 -1
  523. package/dist/util/crypto.js +0 -25
  524. package/dist/util/crypto.js.map +0 -1
  525. package/dist/util/frontmatter.js +0 -70
  526. package/dist/util/frontmatter.js.map +0 -1
  527. package/dist/util/fs-issues.js +0 -22
  528. package/dist/util/fs-issues.js.map +0 -1
  529. package/dist/util/process.js +0 -152
  530. package/dist/util/process.js.map +0 -1
  531. package/dist/util/workspace-key.js +0 -10
  532. package/dist/util/workspace-key.js.map +0 -1
  533. package/dist/workflow-loader.js +0 -147
  534. package/dist/workflow-loader.js.map +0 -1
  535. package/dist/workflow.js +0 -822
  536. package/dist/workflow.js.map +0 -1
  537. package/dist/workspace-types.js +0 -8
  538. package/dist/workspace-types.js.map +0 -1
  539. package/dist/workspace.js +0 -443
  540. package/dist/workspace.js.map +0 -1
@@ -0,0 +1,385 @@
1
+ // FCIS rewrite — THE COMPOSITION ROOT (the single file allowed to import core).
2
+ //
3
+ // Usage (ported 1:1 from REF src/bin/symphony.ts):
4
+ // symphony [path-to-WORKFLOW.yaml] [--port <port>] [--reconcile-force] [--verbose]
5
+ // symphony doctor [path-to-WORKFLOW.yaml] [--port <port>]
6
+ // symphony reconcile [path-to-WORKFLOW.yaml] [--force] [--port <port>]
7
+ //
8
+ // Responsibility: parse argv (pure core/cli/args), load+watch WORKFLOW.yaml, build
9
+ // every adapter/port (in the main-adapters sibling) + the deterministic seams,
10
+ // construct the EffectInterpreter, run doctor/preflight, branch to serve/
11
+ // reconcile, bind the unified HTTP server (dashboard + MCP + the /acp
12
+ // WebSocket), drive the orchestrator over the pure scheduler reducer
13
+ // (core/schedule/tick), and install the SIGTERM/SIGINT graceful-shutdown
14
+ // choreography (in the main-shutdown sibling). ALL decisions live in core; this
15
+ // file only wires the pure deciders into the adapters the shell siblings build.
16
+ //
17
+ // FCIS discipline: imperative shell — async/await/Promise/real IO are expected.
18
+ // This is the ONE shell file permitted to import src/core; everything that does
19
+ // NOT need core lives in a sibling (main-adapters / main-preflight / main-shutdown
20
+ // / main-scaffold) that imports src/types + the other shell slices only. The root
21
+ // builds the core-backed closures and injects them into those siblings.
22
+ import path from 'node:path';
23
+ import process from 'node:process';
24
+ // ─── CORE (decisions only — the ONLY file allowed these imports) ──────────────
25
+ import { parseCli } from '../core/cli/args.js';
26
+ import { parseWorkflow } from '../core/workflow/parse.js';
27
+ import { parseActionsBlock } from '../core/actions/parse.js';
28
+ import { parseMemAvailableMib } from '../core/schedule/admission.js';
29
+ import { deriveSpawnRouting, derivePrRouting, requiredAdapterIds, resolveActionsForState } from '../core/workflow/derive.js';
30
+ import { validateDispatch } from '../core/workflow/validate.js';
31
+ import { probePromptTemplates } from '../core/workflow/prompt-probe.js';
32
+ import { tick, FAILURE_BASE_MS, POLL_TIMER_ID, SPAWN_CYCLE_ACTOR } from '../core/schedule/tick.js';
33
+ import { decideReconcileForIssue } from '../core/schedule/reconcile-issue.js';
34
+ import { backoffDelayMs } from '../core/schedule/retry.js';
35
+ import { classifyPushResult, parsePrNumberFromUrl, describeHandoffFailure } from '../core/git/result.js';
36
+ import { foldRuntimeEvent, applyToolDelta, clearToolCallsAtTurnBoundary, toolCallLifecycle, foldTokenUsage, detectStall } from '../core/schedule/token-fold.js';
37
+ // RUNNER-slice core deciders (runner-loop + actions-runner + dispatch-wrapper
38
+ // extras). Bundled into RUNNER_CORE below + handed to main-loops; only this
39
+ // composition root may import them.
40
+ import { isTransportError, classifyTurnOutcome, decideTurnContinuation, decideAttemptOutcome, decideRecovery, selectPermissionOption } from '../core/runner/turn.js';
41
+ import { resolveDispatchConfig } from '../core/runner/dispatch-config.js';
42
+ import { applyRuntimeInjections } from '../core/runner/injection.js';
43
+ import { buildVmPlan, byoProbeFailureMessage } from '../core/runner/vm-plan.js';
44
+ import { buildManagedImageWiring } from '../core/image/managed-image.js';
45
+ import { buildByoProbeScript, miseInstallFailureMessage, hasProjectMiseConfig } from '../core/runner/mise.js';
46
+ import { selectPromptKind, renderPrompt, buildSteeringReplyPrompt, continuationPrompt } from '../core/runner/prompt.js';
47
+ import { activeStateNames, terminalStateNames, pickHoldingState, selectIssuesByIds, selectIssuesByStates, selectCandidateIssues, matchingCandidates, resolveMatch, pickNextNumericIdentifier } from '../core/issue/parse.js';
48
+ import { resolveActorString } from '../core/schedule/eligibility.js';
49
+ import { assertNoCredentialMounts, assertContained } from '../core/vm-guards.js';
50
+ import { guestMcpUrl } from '../core/mcp/url.js';
51
+ import { deriveActionContext } from '../core/actions/context.js';
52
+ import { planActions } from '../core/actions/plan.js';
53
+ import { foldPredicateProbe } from '../core/actions/predicates.js';
54
+ import { beginAction, foldActionOutcome, foldRenderFailed, foldSkipped, foldPredicateError, summarizeRun } from '../core/actions/run-fold.js';
55
+ // Credential-egress slice deciders (the PURE half the host-only adapter + per-VM
56
+ // egress substrate consume; only this composition root may import them).
57
+ import { extractClaudeToken, extractCodexToken, codexEnvFallback } from '../core/credential/extract.js';
58
+ import { extractClaudeIdentity, extractCodexMetadata } from '../core/credential/identity.js';
59
+ import { buildAdapterCredentialSpecWithPlaceholder, buildAdapterHooksConfig, codexUpstreamRoute } from '../core/credential/shape.js';
60
+ import { buildGondolinFakeCreds } from '../core/credential/fake-creds.js';
61
+ import { buildStagedConfigs } from '../core/credential/adapter-config.js';
62
+ import { buildUrl as buildMcpUrl } from '../core/mcp/url.js';
63
+ // MCP control-plane deciders (the McpCore bundle the per-issue runtime closes over).
64
+ import { validateEnvelope, extractId, routeFraming, makeError as makeMcpError, JsonRpcErrorCode } from '../core/mcp/protocol.js';
65
+ import { decideToolCall } from '../core/mcp/dispatch.js';
66
+ import { foldPostMove } from '../core/mcp/post-move.js';
67
+ import { composeIssueFile } from '../core/issue/file.js';
68
+ // Reconciler-slice deciders (VM reaper / workspace janitor / PR autopilot).
69
+ import { decideVm } from '../core/reconcile/vm-decide.js';
70
+ import { beginKill, foldKillStep } from '../core/reconcile/vm-reap.js';
71
+ import { decideWorkspace } from '../core/reconcile/workspace-decide.js';
72
+ import { classifyPrIntent } from '../core/reconcile/pr-classify.js';
73
+ import { decidePr } from '../core/reconcile/pr-decide.js';
74
+ import { foldPrEffectOutcome, MAX_PR_DECIDE_ITERATIONS } from '../core/reconcile/pr-loop.js';
75
+ import { decidePrSummaryFreshness, decidePrViewFreshness } from '../core/reconcile/pr-notes.js';
76
+ import { createLedger, start as ledgerStart, done as ledgerDone, error as ledgerError, record as ledgerRecord, resourceSnapshot as ledgerResourceSnapshot, } from '../core/reconcile/ledger.js';
77
+ import { resolveHttpPort, formatStartupBanner, checkNodeVersion, checkWorkflow, checkGondolinImage, checkTrackerRoot, checkDashboardPort, doctorReportPassed, formatDoctorReport, } from '../core/doctor/checks.js';
78
+ // HTTP/dashboard slice (core/http): the pure router/deciders/views/renderers the
79
+ // composed `handle` drives. Only this composition root may import them.
80
+ import { matchRoute, resolvePartialName, extractBearerToken, classifyContentType, checkSteeringCsrf, checkTriageCsrf, extractFormText, extractJsonText, } from '../core/http/routes.js';
81
+ import { decideCreateIssue, decideMoveTransition, buildIssueDetailDto } from '../core/http/decisions.js';
82
+ import { buildSnapshot, buildHealthRollup, buildSessionTotalsView } from '../core/http/views.js';
83
+ import { renderDashboardHtml, renderHeaderPartial, renderHealthPartial, renderAttentionPartial, renderBoardPartial, renderTotalsPartial, renderIssueDetailPage, renderIssueNotFoundPage, } from '../core/http/render.js';
84
+ import { hostClaudeCredentialPath, hostCodexCredentialPath, codexCredentialAvailable, codexMissingCredentialMessage, isKnownAdapter, } from '../core/credential/availability.js';
85
+ // ─── SHELL ADAPTERS (each a THIN sibling shell module) ────────────────────────
86
+ import { watchWorkflowSource, loadWorkflowSource, loadWorkflowProbed, validateDispatchIo } from './adapter/workflow-loader.js';
87
+ import { buildLogSink, setLogVerbose, closeLogFile } from './interp/log.js';
88
+ import { createEffectInterpreter } from './effect-interpreter.js';
89
+ import { bindHttp, checkMcpPrecondition, bailStartup } from './main-http.js';
90
+ import { wireHttpHandler, probeTrackerWritable } from './main-http-handler.js';
91
+ import { buildMcpRuntime } from './main-mcp.js';
92
+ import { OrchestratorLoop } from './orchestrator-loop.js';
93
+ import { ReconcilerLoop } from './reconciler-loop.js';
94
+ import { resolveLogFile, wireLogSink, buildConcreteAdapters, buildEffectAdapters } from './main-adapters.js';
95
+ import { buildTransportSubstrates } from './main-substrates.js';
96
+ import { buildReconcilerPasses } from './main-reconcilers.js';
97
+ import { inFlightEntries } from './main-reconcilers-helpers.js';
98
+ import { installShutdownHandlers } from './main-shutdown.js';
99
+ import { handlePreflight } from './main-preflight.js';
100
+ import { readSymphonyVersion, isMainEntry } from './main-entry.js';
101
+ import { buildOrchestratorWithRunner, loadLauncherAsset, loadMiseConfigAsset } from './main-loops.js';
102
+ import { buildRunDoctor } from './main-doctor.js';
103
+ import { startServices } from './main-startup.js';
104
+ // Re-exported for the public module surface (tests import the root's helpers).
105
+ export { isMainEntry } from './main-entry.js';
106
+ // Real YAML decoder (the shell side of the injected ParseDeps).
107
+ import { parse as parseYaml } from 'yaml';
108
+ // ─── Workflow parse closure + injected pure deps (core curried with decoders) ──
109
+ /** The injected workflow ParseDeps: SHELL yaml decoder + CORE actions sub-parser. */
110
+ const WORKFLOW_PARSE_DEPS = { parseYaml, parseActions: parseActionsBlock };
111
+ /** Pure parse closure injected into the WorkflowSource adapter (and the doctor). */
112
+ const parseWorkflowText = (text, workflowPath) => {
113
+ const { config, definition } = parseWorkflow(text, workflowPath, WORKFLOW_PARSE_DEPS, process.env);
114
+ return { config, definition };
115
+ };
116
+ /** The pure CORE fns/constants the shell adapters consume but may not import
117
+ * themselves (only this composition root imports core). */
118
+ const ADAPTER_CORE_DEPS = {
119
+ parseMemAvailableMib,
120
+ assertContained, composeIssueFile, pickNextNumericIdentifier,
121
+ };
122
+ /** The pure CORE credential deciders the credential-egress substrate consumes
123
+ * (host-only token/identity extractors + placeholder/spec/allowlist/route
124
+ * assemblers). The substrate stays core-free; the root injects these. */
125
+ const CREDENTIAL_CORE_DEPS = {
126
+ pure: {
127
+ extractClaudeToken, extractCodexToken, codexEnvFallback, extractClaudeIdentity,
128
+ extractCodexMetadata,
129
+ },
130
+ buildAdapterCredentialSpecWithPlaceholder, buildAdapterHooksConfig,
131
+ buildGondolinFakeCreds, buildStagedConfigs, codexUpstreamRoute,
132
+ };
133
+ /** The pure CORE reconciler deciders + ledger reducer the reconciler passes
134
+ * drive (the shell sibling may not import core; the root injects them here). */
135
+ const RECONCILER_CORE_DEPS = {
136
+ decideVm, beginKill, foldKillStep, decideWorkspace, selectIssuesByStates, classifyPrIntent, decidePr,
137
+ foldPrEffectOutcome, maxPrDecideIterations: MAX_PR_DECIDE_ITERATIONS,
138
+ decidePrSummaryFreshness, decidePrViewFreshness,
139
+ createLedger, ledgerStart, ledgerDone, ledgerError, ledgerRecord, ledgerResourceSnapshot,
140
+ };
141
+ /** The pure credential-availability classifiers the WorkflowSource probes with. */
142
+ const CREDENTIAL_AVAILABILITY_DEPS = {
143
+ hostClaudeCredentialPath, hostCodexCredentialPath,
144
+ codexCredentialAvailable, codexMissingCredentialMessage,
145
+ };
146
+ /** symphony version (read off package.json; works from src/ and dist/). */
147
+ const SYMPHONY_VERSION = readSymphonyVersion(import.meta.url);
148
+ /**
149
+ * Managed prebuilt-image wiring for THIS host (issue 224), built once at the root (the
150
+ * only core importer): the published-asset ref/URLs for the running version + host arch
151
+ * + `SYMPHONY_RELEASE_REPO` override. Null on an arch with no published asset (the
152
+ * managed source is then inert). Shared by the orchestrator loops (fetch routing +
153
+ * readiness) and the doctor (managed-source preflight).
154
+ */
155
+ const MANAGED_IMAGE_WIRING = buildManagedImageWiring({ version: SYMPHONY_VERSION, nodeArch: process.arch, repo: process.env.SYMPHONY_RELEASE_REPO ?? null });
156
+ /** The in-VM vm-agent launcher source (read off host disk ONCE at boot; fail-fast
157
+ * if absent). Staged per-dispatch into the guest so it's byte-identical to the
158
+ * host transport (eliminates the image⇄host launcher version lock). */
159
+ const LAUNCHER_SOURCE = loadLauncherAsset().source;
160
+ /** The symphony-bundled mise SYSTEM config source (issue 209; read off host disk ONCE
161
+ * at boot, fail-fast if absent). Always staged per-dispatch into the guest at
162
+ * /etc/mise/config.toml (mise provisioning is unconditional, issue 233), so node + the
163
+ * agent CLIs are decoupled from the image digest (bump a pin → no image rebuild + repin). */
164
+ const MISE_SYSTEM_CONFIG_SOURCE = loadMiseConfigAsset().source;
165
+ // ─── Preflight: doctor / scaffold — the early-exit subcommands ─────────────────
166
+ /** The doctor preflight closure (built in a sibling; the root injects core checks). */
167
+ const runDoctor = buildRunDoctor({ checkNodeVersion, checkWorkflow, checkGondolinImage, checkTrackerRoot, checkDashboardPort, formatDoctorReport, doctorReportPassed },
168
+ // SAME core bundle the startup probe uses (host-credential paths + classifiers +
169
+ // messages) so doctor can't disagree with the live probe, plus the adapter union.
170
+ { ...CREDENTIAL_AVAILABILITY_DEPS, requiredAdapterIds, isKnownAdapter },
171
+ // Load + render-probe the SAME way live serve validates: loadWorkflowProbed
172
+ // assembles the per-state prompt templates (a missing/renamed prompt_file throws
173
+ // `missing_prompt_file`) AND runs the pure probePromptTemplates render-probe (an
174
+ // unparseable prompt_file throws `invalid_prompt_template`) — so BOTH surface as a
175
+ // doctor `workflow` FAIL, matching the boot validateBootConfig probe, not at dispatch.
176
+ // last arg: managed-image wiring (issue 224) for the doctor's managed-source preflight.
177
+ async (p) => (await loadWorkflowProbed(p, parseWorkflowText, probePromptTemplates)).config, MANAGED_IMAGE_WIRING);
178
+ /**
179
+ * Build the in-process graph: open the workflow watcher, wire the deterministic
180
+ * seams, construct every adapter, assemble the EffectInterpreter over them, and
181
+ * stand up the orchestrator + reconciler loops. The reload callback re-projects
182
+ * the freshly-parsed config so a WORKFLOW.yaml edit retargets the loop without a
183
+ * restart (REF buildReloadHandler).
184
+ */
185
+ async function buildGraph(cli, workflowPath) {
186
+ const src = await watchWorkflowSource(workflowPath, parseWorkflowText, { watch: true });
187
+ let liveCfg = src.current().config;
188
+ validateBootConfig(src.current());
189
+ // Persistent log sink: SYMPHONY_LOG_FILE env override wins ("" disables);
190
+ // otherwise <logs.root>/symphony.log. wireLogSink points the sink + returns a
191
+ // reload retargeter that moves (and announces) it only when the path changes.
192
+ const retargetLogSink = wireLogSink(process.env.SYMPHONY_LOG_FILE, liveCfg);
193
+ setLogVerbose(cli.verbose);
194
+ const log = buildLogSink();
195
+ // Inject the pure core match-resolver into the tracker adapter's move path
196
+ // (the adapter is built in a shell sibling that may not import core).
197
+ const resolveIssueMatch = (all, issueId, fromState) => resolveMatch(matchingCandidates(all, issueId), issueId, fromState);
198
+ const a = buildConcreteAdapters(() => liveCfg, log, resolveIssueMatch, ADAPTER_CORE_DEPS);
199
+ // The transport substrates: host-only CredentialPort + per-VM egress substrate
200
+ // (placeholder-only-guest staging, REQUEST-side hooks incl. the PR#119 codex
201
+ // route — see main-credential) + the real ACP port over the `/acp` WebSocket,
202
+ // bound to the SAME AcpWsRegistry the HTTP server exposes (a.acpWs). The runner
203
+ // slice later populates `acp.context` + consumes `credential.registry`.
204
+ const { credential, acp } = buildTransportSubstrates({
205
+ credentialCore: CREDENTIAL_CORE_DEPS, acpCore: { toolCallLifecycle, isTransportError, selectPermissionOption },
206
+ random: a.random, acpWs: a.acpWs, runlog: a.runlog, clock: a.clock, log, getCfg: () => liveCfg,
207
+ requiredAdapters: () => requiredAdapterIds(liveCfg, isKnownAdapter),
208
+ });
209
+ // The per-issue MCP control plane (in-VM agent transition/steering/propose_issue
210
+ // tools/call). `applyMcpEffect` is the SAME tracker-move applier the central
211
+ // interpreter's `mcp_tool` family routes through; propose_issue writes WITHOUT
212
+ // an identifier → the tracker collision-picks the next free id (§2i fix).
213
+ const mcp = buildMcpRuntime({
214
+ core: MCP_CORE_PARTS, tracker: a.tracker, random: a.random, crypto: a.crypto,
215
+ clock: a.clock, log, getLiveCfg: () => liveCfg,
216
+ derivePrMerge: (cfg) => ({ enabled: cfg.pr.enabled, mergeState: derivePrRouting(cfg.states).mergeState }),
217
+ });
218
+ // The orchestrator owns the live running/claimed maps the reconciler reads as
219
+ // its intended set; it is built just below (after the interpreter it drives),
220
+ // so the reconciler reads it through a forward-referencing closure. The passes'
221
+ // `intended.inFlight()` only fires at pass-run time (well after construction).
222
+ let orchestrator;
223
+ const built = buildReconcilerPasses({
224
+ core: RECONCILER_CORE_DEPS, getCfg: () => liveCfg, log,
225
+ intended: { inFlight: () => inFlightEntries(orchestrator, liveCfg) },
226
+ clock: a.clock, vm: a.vm, signal: a.signal, timer: a.timer, gh: a.gh, git: a.git, workspace: a.workspace, tracker: a.tracker,
227
+ derivePrRouting: (cfg) => derivePrRouting(cfg.states),
228
+ sourceRepo: () => process.env.SYMPHONY_SOURCE_REPO ?? liveCfg.workflow_dir,
229
+ });
230
+ // The reaper / pr effect families route through the same appliers the passes
231
+ // drive, so a core-emitted `reaper`/`pr` Effect and a pass apply share state.
232
+ const interpreter = createEffectInterpreter(buildEffectAdapters({
233
+ ...a, log, logsRoot: () => liveCfg.logs.root,
234
+ acp: acp.port,
235
+ credential: credential.port,
236
+ applyKillStep: built.applyKillStep,
237
+ applyPrEffect: built.applyPrEffect,
238
+ // The `steering` family resolves/cancels McpRuntime's awaiter (the ONE live
239
+ // Promise); the steering-reply route + worker teardown emit, never poke it. The
240
+ // `mcp` family activates/deactivates the per-dispatch entry on the SAME runtime —
241
+ // the runner brackets via an Effect rather than poking activate/deactivate.
242
+ applyMcpEffect: mcp.applyMcpEffect, classifyPushResult, parsePrNumberFromUrl, steering: mcp.runtime.steering, mcpLifecycle: mcp.runtime,
243
+ }));
244
+ // The RUNNER slice + the OrchestratorLoop it drives (built together so the
245
+ // runner's onWorkerExit forward-references the loop). The runner brackets MCP
246
+ // activate/deactivate + the ACP dispatch context, runs the §2a mount guard before
247
+ // createVm, and folds per-issue ACP events/token-usage onto the live entry.
248
+ orchestrator = buildOrchestratorWithRunner({
249
+ core: LOOPS_CORE,
250
+ adapters: {
251
+ interpreter, workspace: a.workspace, tracker: a.tracker, vm: a.vm, acpPort: acp.port, credentialPort: credential.port, runlog: a.runlog, clock: a.clock, random: a.random, timer: a.timer, mem: a.mem,
252
+ },
253
+ substrates: { credential, acpContext: acp.context, acpRegistry: acp.registry, mcp: mcp.runtime },
254
+ // managedImageWiring (issue 224): built once at module level (root is the only core importer), shared with the doctor.
255
+ log, getLiveCfg: () => liveCfg, getWorkflow: () => src.current().definition, boundMcpPort: () => graph.boundPort, launcherSource: LAUNCHER_SOURCE, miseSystemConfigSource: MISE_SYSTEM_CONFIG_SOURCE, readEnv: (key) => process.env[key], managedImageWiring: MANAGED_IMAGE_WIRING,
256
+ });
257
+ const reconciler = new ReconcilerLoop({ passes: built.passes, timer: a.timer, log });
258
+ // Compose the dashboard/REST `handle`. The agent-facing MCP routes ride an
259
+ // McpHttpSurface assembled here: runtime.handleJsonRpc + a performSteering bound to
260
+ // the central interpreter (steering-reply emits a steering Effect — no awaiter poke).
261
+ const httpHandle = wireHttpHandler({
262
+ core: HTTP_HANDLER_CORE, orchestrator, tracker: a.tracker, clock: a.clock, log,
263
+ getLiveCfg: () => liveCfg, workflowPath: liveCfg.workflow_path, trackerWritable: () => probeTrackerWritable(liveCfg.tracker.root),
264
+ mcp: { handleJsonRpc: (id, t, b) => mcp.runtime.handleJsonRpc(id, t, b), performSteering: (e) => interpreter.execute(e) }
265
+ });
266
+ const graph = {
267
+ src, interpreter, orchestrator, reconciler, acpWs: a.acpWs,
268
+ http: null, boundPort: null, httpHandle, vm: a.vm, log, clock: a.clock,
269
+ getLiveCfg: () => liveCfg,
270
+ mcp: mcp.runtime,
271
+ credential, acp,
272
+ };
273
+ // Reload: re-point the live cfg + retarget the log sink + fan to the reconciler.
274
+ // The orchestrator reads the fresh cfg through its readConfig closure next tick.
275
+ src.onChange((cfg) => {
276
+ liveCfg = cfg;
277
+ retargetLogSink(cfg);
278
+ // The passes close over `getCfg: () => liveCfg` (already retargeted above), so
279
+ // re-hand the SAME pass set — they observe the reloaded config next pass.
280
+ reconciler.updateConfig(cfg, built.passes);
281
+ });
282
+ return graph;
283
+ }
284
+ /**
285
+ * The fatal boot gates (REF loadAndValidateConfig): this build serves
286
+ * tracker.kind=local only; the pure validateDispatch catches a misconfigured
287
+ * workflow; validateDispatchIo runs the IO-touching half (tracker.root exists,
288
+ * per-state host credential readable) against the injected pure availability
289
+ * classifiers so a missing credential fails at boot, not mid-dispatch.
290
+ */
291
+ function validateBootConfig({ config: cfg, definition }) {
292
+ const fail = (reason) => {
293
+ process.stderr.write(`error: ${reason}\n`);
294
+ process.exit(2);
295
+ };
296
+ if (cfg.tracker.kind !== 'local') {
297
+ fail(`this build supports tracker.kind=local only (got: ${cfg.tracker.kind || '<unset>'})`);
298
+ }
299
+ // probePromptTemplates returns the same `string | null` shape as the validators,
300
+ // so an unparseable per-state prompt_file folds into the same chain and fails the
301
+ // boot here, not at first dispatch (a missing file already threw in loadWorkflowSource).
302
+ const invalid = validateDispatch(cfg) ?? validateDispatchIo(cfg, CREDENTIAL_AVAILABILITY_DEPS, process.env) ?? probePromptTemplates(definition);
303
+ if (invalid)
304
+ fail(invalid);
305
+ }
306
+ /** Loose pure-CORE fns the loops builder nests into the OrchestratorCore +
307
+ * RunnerCoreParts bundles (main-loops nests). renderInitialPrompt = renderPrompt. */
308
+ const LOOPS_CORE = {
309
+ orchestrator: {
310
+ tick: tick, selectCandidateIssues, selectIssuesByIds, decideReconcileForIssue, detectStall, deriveSpawnRouting, activeStateNames, terminalStateNames, pickHoldingState, backoffDelayMs, failureBaseMs: FAILURE_BASE_MS, pollTimerId: POLL_TIMER_ID, spawnActor: SPAWN_CYCLE_ACTOR,
311
+ tokenFold: { foldRuntimeEvent, applyToolDelta, clearToolCallsAtTurnBoundary, foldTokenUsage },
312
+ },
313
+ loop: {
314
+ resolveDispatchConfig, applyRuntimeInjections, buildVmPlan, selectPromptKind,
315
+ // decideRecovery defaults the per-turn budget + base backoff internally (issue 213),
316
+ // so the shell turn loop passes only the attempts already spent.
317
+ classifyTurnOutcome, decideTurnContinuation, decideAttemptOutcome, decideRecovery,
318
+ renderInitialPrompt: renderPrompt,
319
+ renderSteeringPrompt: ({ question, context, reply }) => buildSteeringReplyPrompt(question, context, reply),
320
+ continuationPrompt, activeStateNames, selectIssuesByIds,
321
+ },
322
+ actions: {
323
+ resolveActionsForState, deriveActionContext, planActions, foldPredicateProbe, beginAction, foldActionOutcome,
324
+ foldRenderFailed, foldSkipped, foldPredicateError, summarizeRun, describeHandoffFailure,
325
+ },
326
+ // mise toolchain-provisioning deciders (issue 209): byoProbeScript, miseInstallFailureMessage, hasProjectMiseConfig.
327
+ resolveActorString, assertNoCredentialMounts, resolveDispatchConfig, guestMcpUrl, byoProbeFailureMessage, byoProbeScript: buildByoProbeScript, miseInstallFailureMessage, hasProjectMiseConfig,
328
+ };
329
+ /** The pure CORE decisions + log-flush the HTTP boot cluster (main-http) needs. */
330
+ const HTTP_BIND_CORE = { resolveHttpPort, buildMcpUrl, closeLog: closeLogFile };
331
+ /** The pure CORE http router/deciders/views/renderers the composed dashboard
332
+ * `handle` drives (the shell handler may not import core; the root binds them). */
333
+ const HTTP_HANDLER_CORE = {
334
+ matchRoute, resolvePartialName, extractBearerToken, classifyContentType, checkSteeringCsrf, checkTriageCsrf, extractFormText, extractJsonText,
335
+ decideCreateIssue, decideMoveTransition, buildIssueDetailDto, buildSnapshot, buildHealthRollup, buildSessionTotalsView,
336
+ renderDashboardHtml, renderHeaderPartial, renderHealthPartial, renderAttentionPartial, renderBoardPartial, renderTotalsPartial, renderIssueDetailPage, renderIssueNotFoundPage,
337
+ };
338
+ /** The raw pure-CORE MCP deciders the per-issue runtime closes over (protocol /
339
+ * dispatch / post-move family); main-mcp folds them into the McpCore bundle. */
340
+ const MCP_CORE_PARTS = {
341
+ validateEnvelope, extractId, routeFraming, makeError: makeMcpError, decideToolCall, foldPostMove,
342
+ errorCodes: JsonRpcErrorCode,
343
+ };
344
+ // ─── main — argv → preflight → graph → transports → loop → shutdown handlers ───
345
+ export async function main(argv = process.argv.slice(2)) {
346
+ const cli = resolveCli(argv);
347
+ const workflowPath = path.resolve(cli.workflow);
348
+ await handlePreflight(cli, workflowPath, { runDoctor });
349
+ const graph = await buildGraph(cli, workflowPath);
350
+ graph.http = await bindHttp(graph, cli, HTTP_BIND_CORE, graph.httpHandle);
351
+ await checkMcpPrecondition(graph, HTTP_BIND_CORE);
352
+ await startServices(graph, cli, workflowPath, {
353
+ formatStartupBanner, resolveHttpPort, version: SYMPHONY_VERSION,
354
+ logFile: resolveLogFile(process.env.SYMPHONY_LOG_FILE, graph.getLiveCfg()),
355
+ bailStartup: (msg) => bailStartup(msg, graph, HTTP_BIND_CORE),
356
+ });
357
+ // Graph already carries orchestrator/reconciler/src/http/vm/log under the names
358
+ // the handlers want; just add the log-sink flush closure.
359
+ installShutdownHandlers({ ...graph, stopCredentialTicker: () => graph.credential.ticker.stop(), closeLog: closeLogFile });
360
+ }
361
+ /**
362
+ * Parse argv (pure core/cli/args) and apply the help/error directives the way the
363
+ * original wrote to the stream + exited — the core only RETURNS the directive.
364
+ * Returns the typed Cli on the happy path (the help/error branches never return).
365
+ */
366
+ function resolveCli(argv) {
367
+ const parsed = parseCli(argv, process.cwd());
368
+ if (parsed.kind === 'help') {
369
+ process.stdout.write(parsed.message);
370
+ process.exit(parsed.exitCode);
371
+ }
372
+ if (parsed.kind === 'error') {
373
+ process.stderr.write(parsed.message);
374
+ process.exit(parsed.exitCode);
375
+ }
376
+ return parsed.cli;
377
+ }
378
+ if (isMainEntry(import.meta.url)) {
379
+ main().catch(async (err) => {
380
+ process.stderr.write(`fatal: ${err.message}\n${err.stack ?? ''}\n`);
381
+ await closeLogFile().catch(() => undefined);
382
+ process.exit(1);
383
+ });
384
+ }
385
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/shell/main.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,mDAAmD;AACnD,qFAAqF;AACrF,+DAA+D;AAC/D,yEAAyE;AACzE,EAAE;AACF,mFAAmF;AACnF,+EAA+E;AAC/E,0EAA0E;AAC1E,sEA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AAQ,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC;AACpB,CAAC;AAED,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACjC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAW,GAAa,CAAC,OAAO,KAAM,GAAa,CAAC,KAAK,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1F,MAAM,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,69 @@
1
+ // FCIS rewrite — the runner-feedback folds the OrchestratorLoop applies to its live
2
+ // running entries (kind: shell helper). Sliced out of orchestrator-loop.ts to keep
3
+ // the loop class under the file-line budget. Each fold takes the LIVE RunningEntry
4
+ // (the `active_tool_calls` Set is a live shell handle core never holds) plus the
5
+ // injected PURE core folds (core/schedule/token-fold) and writes the result back.
6
+ //
7
+ // Shell rule: imports from src/types ONLY (the core folds arrive injected).
8
+ /** REF: reportRuntimeEvent — fold the event + track in-flight tool calls onto `e`. */
9
+ export function applyRuntimeEvent(e, ev, fold) {
10
+ const next = fold.foldRuntimeEvent({ last_event: e.last_event, last_event_at: e.last_event_at, last_message: e.last_message, recent_events: e.recent_events }, ev);
11
+ e.last_event = next.last_event;
12
+ e.last_event_at = next.last_event_at;
13
+ e.last_message = next.last_message;
14
+ e.recent_events = next.recent_events;
15
+ if (ev.tool && ev.tool.id) {
16
+ e.active_tool_calls = new Set(fold.applyToolDelta([...e.active_tool_calls], { id: ev.tool.id, ended: ev.tool.ended }));
17
+ }
18
+ }
19
+ /** REF: reportTurnStarted — turn boundary clears the in-flight tool set. */
20
+ export function applyTurnStarted(e, turnNumber, fold) {
21
+ e.turn_count = turnNumber;
22
+ e.active_tool_calls = new Set(fold.clearToolCallsAtTurnBoundary());
23
+ }
24
+ /**
25
+ * REF: reportTokenUsage — fold the adapter's ABSOLUTE token totals onto the live
26
+ * entry (core `foldTokenUsage` de-dupes via the per-report delta + new baselines).
27
+ * The dashboard's totals footer sums these per-entry counters live, so without this
28
+ * the totals stay stuck at 0 (§2c).
29
+ */
30
+ export function applyTokenUsage(e, usage, fold) {
31
+ const delta = fold.foldTokenUsage({
32
+ last_reported_input: e.last_reported_input_tokens,
33
+ last_reported_output: e.last_reported_output_tokens,
34
+ last_reported_total: e.last_reported_total_tokens,
35
+ }, usage);
36
+ e.input_tokens = usage.input_tokens;
37
+ e.output_tokens = usage.output_tokens;
38
+ e.total_tokens = usage.total_tokens;
39
+ e.last_reported_input_tokens = delta.last_reported_input;
40
+ e.last_reported_output_tokens = delta.last_reported_output;
41
+ e.last_reported_total_tokens = delta.last_reported_total;
42
+ }
43
+ /**
44
+ * REF: detectStalls — the no-activity stall reaper. Folds every running entry's
45
+ * last-activity reference through core `detectStall` (clock injected as nowMs) and
46
+ * returns the issue ids to terminate. core honors the suppression: steering-paused
47
+ * entries AND entries with a tool call IN FLIGHT are skipped (a long silent tool
48
+ * emits no ACP frames; the prompt-timeout hard cap backstops a genuine hang — the
49
+ * "suppress the stall reaper while a tool call is in flight" behavior, §2c).
50
+ */
51
+ export function detectStalledIssues(running, stall, nowMs) {
52
+ const stallTimeoutMs = stall.stallTimeoutMs();
53
+ if (stallTimeoutMs <= 0)
54
+ return [];
55
+ const stalled = [];
56
+ for (const [issueId, e] of running) {
57
+ const verdict = stall.detectStall({
58
+ stallTimeoutMs,
59
+ steeringRequested: e.steering_requested,
60
+ activeToolCallCount: e.active_tool_calls.size,
61
+ lastReferenceMs: Date.parse(e.last_event_at ?? e.started_at),
62
+ nowMs,
63
+ });
64
+ if (verdict.stalled)
65
+ stalled.push(issueId);
66
+ }
67
+ return stalled;
68
+ }
69
+ //# sourceMappingURL=orchestrator-feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-feedback.js","sourceRoot":"","sources":["../../src/shell/orchestrator-feedback.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,mFAAmF;AACnF,mFAAmF;AACnF,iFAAiF;AACjF,kFAAkF;AAClF,EAAE;AACF,4EAA4E;AAO5E,sFAAsF;AACtF,MAAM,UAAU,iBAAiB,CAAC,CAAe,EAAE,EAAgB,EAAE,IAAmB;IACtF,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAChC,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC,aAAa,EAAE,EAC1H,EAAE,CACH,CAAC;IACF,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IAC/B,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IACrC,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;IACnC,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IACrC,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QAC1B,CAAC,CAAC,iBAAiB,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CA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