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,120 @@
1
+ // FCIS rewrite — OrchestratorLoop deps construction (shell). Sliced out of
2
+ // src/shell/main.ts so the composition root stays under the max-lines budget.
3
+ //
4
+ // Builds the OrchestratorLoopDeps bundle: the pure scheduler reducer (tick) is
5
+ // injected as the loop's reducer; the loop owns the live running/claimed/retry
6
+ // maps and drives the returned effects through the interpreter. `runWorker` (the
7
+ // per-attempt runner pipeline) is owned by the runner slice and wired through the
8
+ // root once it's stood up; until then a dispatch claims its slot then frees it,
9
+ // exercising the reducer + slot accounting end-to-end without a live worker.
10
+ //
11
+ // It imports NO core (only the root may) — the pure reducer + the candidate
12
+ // selector + the token-fold trio arrive injected as `OrchestratorCore`.
13
+ //
14
+ // Shell rule: imports from src/types/** ONLY (+ shell sibling type surfaces).
15
+ import { NoHoldingStateError } from '../types/errors.js';
16
+ /**
17
+ * Project the live config into the pure TickConfig the scheduler reducer folds
18
+ * over. The shell pre-resolves derived routing (spawn) + lowercased role sets so
19
+ * core never walks the config tree for derived data (REF buildReloadHandler).
20
+ *
21
+ * The role sets + the holding-state pick are derived by the CANONICAL core fns
22
+ * (`activeStateNames` / `terminalStateNames` / `pickHoldingState`), injected on
23
+ * `core`, rather than re-scanned by hand here (§4a). `pickHoldingState` THROWS
24
+ * `NoHoldingStateError` when none is declared; we catch that and project
25
+ * `holdingState: null` — the circuit-breaker then retains the claim instead of
26
+ * moving the issue (REF: pickHoldingState throwing → retain).
27
+ */
28
+ export function buildTickConfig(cfg, core,
29
+ // The managed prebuilt-image store ref for this host (issue 224), or null when the
30
+ // host arch has no published asset. Gated on `gondolin.managed_image` below so it
31
+ // only rides the readiness path when the managed source is the active one.
32
+ managedImageRef = null) {
33
+ const lc = (names) => new Set(names.map((n) => n.toLowerCase()));
34
+ let holdingState;
35
+ try {
36
+ holdingState = core.pickHoldingState(cfg.states);
37
+ }
38
+ catch (err) {
39
+ if (!(err instanceof NoHoldingStateError))
40
+ throw err;
41
+ holdingState = null;
42
+ }
43
+ return {
44
+ pollIntervalMs: cfg.polling.interval_ms,
45
+ staticCap: cfg.agent.max_concurrent_agents,
46
+ memoryAdmissionEnabled: cfg.agent.memory_admission_enabled,
47
+ hostMemoryReserveMib: cfg.agent.host_memory_reserve_mib,
48
+ perVmMib: cfg.gondolin.mem_mib,
49
+ maxRetryBackoffMs: cfg.agent.max_retry_backoff_ms,
50
+ circuitBreakerThreshold: cfg.agent.circuit_breaker_threshold,
51
+ activeStates: lc(core.activeStateNames(cfg.states)),
52
+ terminalStates: lc(core.terminalStateNames(cfg.states)),
53
+ states: cfg.states,
54
+ spawn: core.deriveSpawnRouting(cfg.states),
55
+ holdingState,
56
+ // The auto-convert-on-reconcile OCI ref (issue 206); the loop reads it to
57
+ // compute the image-readiness projection it folds onto the snapshot. The
58
+ // escape-hatch `image` rides alongside so core's gate mirrors runtime precedence.
59
+ ociImage: cfg.gondolin.oci_image,
60
+ image: cfg.gondolin.image,
61
+ // The managed source (issue 224) rides the same readiness path as oci_image, but
62
+ // only when it's the active source — an explicit `image`/`oci_image` keeps
63
+ // `managed_image` false in parse, so this is null whenever one of those wins.
64
+ managedImageRef: cfg.gondolin.managed_image ? managedImageRef : null,
65
+ };
66
+ }
67
+ /** Build the OrchestratorLoopDeps from the injected core fns + the live ports. */
68
+ export function buildOrchestratorDeps(opts) {
69
+ const { core, ports, readConfig } = opts;
70
+ return {
71
+ tick: core.tick,
72
+ interpreter: ports.interpreter,
73
+ timers: ports.timer,
74
+ memProbe: ports.mem,
75
+ clock: ports.clock,
76
+ readConfig,
77
+ // ONE tracker read → the pure core picks the active-but-not-terminal
78
+ // candidates (core/issue/parse.ts:selectCandidateIssues). null on any IO miss.
79
+ fetchCandidates: async () => {
80
+ try {
81
+ const { raw, root } = await ports.tracker.loadAllIssues();
82
+ return { issues: core.selectCandidateIssues(raw, readConfig().states), root };
83
+ }
84
+ catch {
85
+ return null;
86
+ }
87
+ },
88
+ // The pure cancel-on-move decider shared with the operator-move reducer (issue 211).
89
+ reconcileIssue: core.decideReconcileForIssue,
90
+ // FRESH per-running tracker view across ALL states — the candidate scan above
91
+ // excludes an issue moved to a holding/terminal state, so the move-reconcile net
92
+ // needs its own by-id read. Keyed by canonical id; null on an IO miss so the loop
93
+ // skips the reconcile rather than spuriously terminating a live attempt.
94
+ fetchRunningViews: async (ids) => {
95
+ if (ids.length === 0)
96
+ return new Map();
97
+ try {
98
+ const { raw } = await ports.tracker.loadAllIssues();
99
+ return new Map(core.selectIssuesByIds(raw, [...ids]).map((i) => [i.id, i]));
100
+ }
101
+ catch {
102
+ return null;
103
+ }
104
+ },
105
+ runWorker: opts.runWorker ?? (async () => undefined),
106
+ buildEntry: opts.buildEntry,
107
+ tokenFold: core.tokenFold,
108
+ stall: { detectStall: core.detectStall, stallTimeoutMs: opts.stallTimeoutMs },
109
+ // Pure failure backoff pinned at the core base, so the loop's re-poll-failed
110
+ // path cannot fork the policy core uses for the same attempt (§4a).
111
+ backoff: (attempt, maxBackoffMs) => core.backoffDelayMs(attempt, core.failureBaseMs, maxBackoffMs),
112
+ // The poll-timer id + sleep-cycle spawn actor are the core constants, injected so
113
+ // the loop matches the ids/actors core stamps on its Effects (§4b — no hardcoded twin).
114
+ pollTimerId: core.pollTimerId,
115
+ spawnActor: core.spawnActor,
116
+ ensureImage: opts.ensureImage,
117
+ probeImage: opts.probeImage,
118
+ };
119
+ }
120
+ //# sourceMappingURL=main-orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-orchestrator.js","sourceRoot":"","sources":["../../src/shell/main-orchestrator.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,iFAAiF;AACjF,kFAAkF;AAClF,gFAAgF;AAChF,6EAA6E;AAC7E,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAM9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAkB,EAClB,IAAmH;AACnH,mFAAmF;AACnF,kFAAkF;AAClF,2EAA2E;AAC3E,kBAAiC,IAAI;IAErC,MAAM,EAAE,GAAG,CAAC,KAAe,EAAuB,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAChG,IAAI,YAA2B,CAAC;IAChC,IAAI,CAAC;QACH,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,CAAC,GAAG,YAAY,mBAAmB,CAAC;YAAE,MAAM,GAAG,CAAC;QACrD,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IACD,OAAO;QACL,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,WAAW;QACvC,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,qBAAqB;QAC1C,sBAAsB,EAAE,GAAG,CAAC,KAAK,CAAC,wBAAwB;QAC1D,oBAA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,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC;QAClG,kFAAkF;QAClF,wFAAwF;QACxF,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ // FCIS rewrite — early-exit preflight subcommands (kind: shell helper).
2
+ //
3
+ // Sliced out of the composition root so the root keeps only its core-wiring under
4
+ // the max-lines budget. Owns the subcommands that DON'T enter the orchestrator
5
+ // graph: doctor (delegated to the injected runner) and a missing workflow file
6
+ // (scaffold-on-interactive-serve, else fail). Ported 1:1 from REF handlePreflight.
7
+ //
8
+ // Shell rule: imports from src/types/** ONLY. The doctor runner is INJECTED by the
9
+ // root (the one file allowed to import core).
10
+ import path from 'node:path';
11
+ import process from 'node:process';
12
+ import { existsSync } from 'node:fs';
13
+ import { promptYesNo, isInteractive } from './interp/tty.js';
14
+ import { scaffoldWorkflow, scaffoldSkill } from './main-scaffold.js';
15
+ /**
16
+ * Handle the early-exit subcommands that don't enter the orchestrator graph.
17
+ * Returns only on the happy path of serve/reconcile against an existing workflow;
18
+ * every other branch exits the process. Ported from REF handlePreflight.
19
+ */
20
+ export async function handlePreflight(cli, workflowPath, deps) {
21
+ if (cli.subcommand === 'doctor') {
22
+ process.exit(await deps.runDoctor(workflowPath, cli.port));
23
+ }
24
+ if (!existsSync(workflowPath)) {
25
+ // Prompt only on the bare `serve` path (reconcile needs an existing workflow).
26
+ // A confirmed yes writes the bundled minimal scaffold then exits 0 so the
27
+ // operator can fill in gondolin.* before relaunching.
28
+ if (cli.subcommand === 'serve' && isInteractive()) {
29
+ const accept = await promptYesNo(`WORKFLOW.yaml not found at ${workflowPath}.\nScaffold a starter workflow file here? [Y/n] `);
30
+ if (accept && (await scaffoldWorkflow(workflowPath))) {
31
+ // Best-effort onboarding sugar: also install the issue-filing skill next
32
+ // to the new WORKFLOW.yaml. A failure / already-present skill must NOT
33
+ // block the workflow scaffold or the relaunch (scaffoldSkill never
34
+ // throws), so exit 0 regardless.
35
+ await scaffoldSkill(path.dirname(workflowPath));
36
+ process.exit(0);
37
+ }
38
+ }
39
+ process.stderr.write(`error: workflow file not found: ${workflowPath}\n`);
40
+ process.exit(2);
41
+ }
42
+ }
43
+ //# sourceMappingURL=main-preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-preflight.js","sourceRoot":"","sources":["../../src/shell/main-preflight.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,kFAAkF;AAClF,+EAA+E;AAC/E,+EAA+E;AAC/E,mFAAmF;AACnF,EAAE;AACF,mFAAmF;AACnF,8CAA8C;AAE9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASrE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAQ,EAAE,YAAoB,EAAE,IAAmB;IACvF,IAAI,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,+EAA+E;QAC/E,0EAA0E;QAC1E,sDAAsD;QACtD,IAAI,GAAG,CAAC,UAAU,KAAK,OAAO,IAAI,aAAa,EAAE,EAAE,CAAC;YAClD,MAAM,MAAM,GAAG,MAAM,WAAW,CAC9B,8BAA8B,YAAY,kDAAkD,CAC7F,CAAC;YACF,IAAI,MAAM,IAAI,CAAC,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;gBACrD,yEAAyE;gBACzE,uEAAuE;gBACvE,mEAAmE;gBACnE,iCAAiC;gBACjC,MAAM,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;gBAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,YAAY,IAAI,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,244 @@
1
+ // FCIS rewrite — reconciler-pass IO helpers (shell). Sliced out of
2
+ // main-reconcilers.ts to keep each file under the shell line/complexity budgets.
3
+ //
4
+ // These are the OBSERVE / APPLY-one-step / project-ledger primitives the three
5
+ // passes compose. Each reads a live port or the injected clock; ZERO pure
6
+ // decisions live here (those are the injected core deciders the passes call).
7
+ //
8
+ // Shell rule: imports from src/types/** ONLY. Ports are injected.
9
+ import { sanitizeWorkspaceKey } from './workspace-key.js';
10
+ /** Every `symphony-*` VM the orchestrator labels its dispatches with (matches the
11
+ * runner's `sessionLabel`); the VM reaper compares the live session set to it. */
12
+ const SYMPHONY_VM_PREFIX = 'symphony-';
13
+ /**
14
+ * Project the orchestrator's live running + claimed dispatches into the
15
+ * reconciler's intended set. Running entries carry full pinned dispatch data
16
+ * (issue/state/branch/base/repo); a bare claim (claimed-but-not-yet-running) is
17
+ * carried with the live config's base/repo + a null issue so the VM reaper and
18
+ * workspace janitor still treat its `symphony-<id>` label + workspace as intended
19
+ * (covers the window between claim and the tracker reflecting it). The PR pass
20
+ * skips null-issue entries (it needs the issue's state to classify an intent).
21
+ */
22
+ export function inFlightEntries(orchestrator, cfg) {
23
+ const out = [];
24
+ const seen = new Set();
25
+ for (const e of orchestrator.runningEntries()) {
26
+ seen.add(e.issue_id);
27
+ out.push({
28
+ identifier: e.identifier,
29
+ state: e.issue.state,
30
+ sessionLabel: `${SYMPHONY_VM_PREFIX}${e.identifier}`,
31
+ issue: { identifier: e.identifier, state: e.issue.state, branch_name: e.issue.branch_name },
32
+ baseBranch: e.base_branch_at_dispatch || cfg.workspace.base_branch,
33
+ githubRepo: e.github_repo_at_dispatch ?? cfg.workspace.github_repo,
34
+ });
35
+ }
36
+ for (const id of orchestrator.claimedIds()) {
37
+ if (seen.has(id))
38
+ continue;
39
+ out.push({ identifier: id, state: null, sessionLabel: `${SYMPHONY_VM_PREFIX}${id}`, issue: null, baseBranch: cfg.workspace.base_branch, githubRepo: cfg.workspace.github_repo });
40
+ }
41
+ return out;
42
+ }
43
+ // The workspace-key sanitizer lives in the single shell home (mirror of the
44
+ // core util); re-exported so this module's importers keep their specifier
45
+ // (imported above for this module's own internal use).
46
+ export { sanitizeWorkspaceKey };
47
+ /**
48
+ * Build the `applyKillStep` applier: ONE step's host IO → the observed
49
+ * `KillStepResult` the pure `foldKillStep` consumes.
50
+ * • signal → ProcessSignalPort.kill → signalled / gone(ESRCH) / no_perm(EPERM)
51
+ * • wait_grace → TimerPort.sleep(ms) → signalled (the fold advances to probe)
52
+ * • probe → ProcessSignalPort.probe (signal 0) → alive / gone / no_perm
53
+ * • done → terminal no-op
54
+ */
55
+ export function buildApplyKillStep(deps) {
56
+ return async (step) => {
57
+ switch (step.kind) {
58
+ case 'signal': {
59
+ const r = deps.signal.kill(step.pid, step.signal);
60
+ if (r.ok)
61
+ return { kind: 'signalled' };
62
+ if (r.noPerm)
63
+ return { kind: 'no_perm' };
64
+ return { kind: 'gone' };
65
+ }
66
+ case 'wait_grace':
67
+ await deps.timer.sleep(step.ms);
68
+ return { kind: 'signalled' };
69
+ case 'probe': {
70
+ const r = deps.signal.probe(step.pid);
71
+ if (!r.alive)
72
+ return { kind: 'gone' };
73
+ if (r.noPerm)
74
+ return { kind: 'no_perm' };
75
+ return { kind: 'alive' };
76
+ }
77
+ case 'done':
78
+ return { kind: 'signalled' };
79
+ }
80
+ };
81
+ }
82
+ /** Fold one kill-step ledger op into the vm ledger (the clock is injected). */
83
+ export function applyKillLedger(ledger, decision, core, clock) {
84
+ const op = decision.ledger;
85
+ const at = clock.iso();
86
+ if (op.op === 'start')
87
+ return core.ledgerStart(ledger, op.key, at);
88
+ if (op.op === 'done')
89
+ return core.ledgerDone(ledger, op.key, at);
90
+ if (op.op === 'error')
91
+ return core.ledgerError(ledger, op.key, op.message, at);
92
+ return ledger;
93
+ }
94
+ /**
95
+ * Enumerate PR-autopilot candidates by scanning the TRACKER for issues in the
96
+ * merge/close states — NOT the live-dispatch (`intended.inFlight()`) set.
97
+ *
98
+ * The merge state (e.g. `Done`) is terminal: its issues are never in-flight, so
99
+ * an in-flight scan surfaces zero merge intents and the autopilot never arms a
100
+ * single auto-merge (the issue-173 FCIS rewrite regressed exactly here — open
101
+ * PRs sat un-armed forever). This restores the pre-rewrite `prIntended()`
102
+ * tracker-state scan.
103
+ *
104
+ * The per-issue workspace is no longer consulted: the autopilot stopped
105
+ * rebasing from it (that is the dispatched agent's job now), and terminal-state
106
+ * workspaces are reaped by the janitor — so `gh`/`git` PR ops run from the
107
+ * stable source repo (`deps.sourceRepo()`), which always exists and carries the
108
+ * `origin` remote the verbs resolve the repository from. We hand that path in
109
+ * as `mergeWorkspacePath` so the intent's `workspace_path` (and thus `cwdFor`)
110
+ * points there.
111
+ */
112
+ export async function collectPrIntents(deps, cfg, routing) {
113
+ const states = [routing.mergeState, routing.closeState].filter((s) => s !== null);
114
+ if (states.length === 0)
115
+ return [];
116
+ const repo = deps.sourceRepo();
117
+ const { raw } = await deps.tracker.loadAllIssues();
118
+ // selectIssuesByStates filters by state (case-insensitive) AND normalizes each
119
+ // raw file into an Issue — so `issue.identifier`/`issue.branch_name` are the
120
+ // canonical front-matter values dispatch/actions used to push the branch, not
121
+ // the bare filename stem. Mirrors the pre-rewrite `fetchIssuesByStates` feed.
122
+ const out = [];
123
+ const seen = new Set();
124
+ for (const issue of deps.core.selectIssuesByStates(raw, states)) {
125
+ if (seen.has(issue.identifier))
126
+ continue;
127
+ const intent = deps.core.classifyPrIntent({
128
+ issue,
129
+ // A null mergeState (close-only routing) must never match — pass a sentinel
130
+ // the tracker state can't equal (classify lower-cases both sides).
131
+ mergeState: routing.mergeState ?? ' no-merge-state ',
132
+ closeState: routing.closeState,
133
+ baseBranch: cfg.workspace.base_branch,
134
+ mergeWorkspacePath: repo,
135
+ });
136
+ if (!intent)
137
+ continue;
138
+ out.push(intent);
139
+ seen.add(issue.identifier);
140
+ }
141
+ return out;
142
+ }
143
+ /** First declared active state (the conflict-route fallback when none is configured). */
144
+ export function firstActiveState(cfg) {
145
+ for (const [name, sc] of Object.entries(cfg.states))
146
+ if (sc.role === 'active')
147
+ return name;
148
+ return 'Todo';
149
+ }
150
+ /**
151
+ * Observe the desired workspace set: in-flight (orchestrator) first, then active
152
+ * (tracker) — active wins on overlap (decideWorkspace last-write-wins reproduces
153
+ * the precedence). Throws on the tracker read (the pass fails closed: it must NOT
154
+ * treat the empty set as desired — reaping every workspace on a transient hiccup
155
+ * is the regression this contract closes).
156
+ */
157
+ export async function observeDesiredWorkspaces(deps, cfg) {
158
+ const out = [];
159
+ for (const e of deps.intended.inFlight())
160
+ out.push({ identifier: e.identifier, state: e.state });
161
+ const { raw } = await deps.tracker.loadAllIssues();
162
+ const activeStates = new Set(Object.entries(cfg.states).filter(([, c]) => c.role === 'active').map(([n]) => n.toLowerCase()));
163
+ for (const f of raw) {
164
+ if (activeStates.has(f.state.toLowerCase()))
165
+ out.push({ identifier: f.identifier, state: f.state });
166
+ }
167
+ return out;
168
+ }
169
+ /**
170
+ * Sanitized dir names whose terminal issue left a handoff-pending marker (issue
171
+ * 234). Only the reap CANDIDATES (dirs NOT in the desired set) can carry one — a
172
+ * wanted dir is never reaped, so its marker is irrelevant — so we stat only those.
173
+ * A stat error reads as "no marker" (the dir reaps as today).
174
+ */
175
+ export async function observeHandoffMarkers(deps, desired, observed) {
176
+ const out = new Set();
177
+ const wanted = new Set(desired.map((d) => sanitizeWorkspaceKey(d.identifier)));
178
+ for (const { name, path } of observed) {
179
+ if (wanted.has(name))
180
+ continue;
181
+ try {
182
+ if (await deps.workspace.hasHandoffPendingMarker(path))
183
+ out.add(name);
184
+ }
185
+ catch {
186
+ // stat failed → treat as no marker (decider reaps as today).
187
+ }
188
+ }
189
+ return out;
190
+ }
191
+ /** Per-dir git inspection for the wanted dirs on disk (drift detection). */
192
+ export async function observeInspections(deps, cfg, desired, observed) {
193
+ const inspections = {};
194
+ const wanted = new Set(desired.map((d) => sanitizeWorkspaceKey(d.identifier)));
195
+ for (const { name, path } of observed) {
196
+ if (!wanted.has(name))
197
+ continue;
198
+ try {
199
+ inspections[name] = await deps.workspace.inspect(path, cfg.workspace.base_branch);
200
+ }
201
+ catch {
202
+ // inspect failed → omit (decider skips drift for a missing inspection).
203
+ }
204
+ }
205
+ return inspections;
206
+ }
207
+ /** Source repo's current base-branch SHA (drift anchor); null skips drift detection. */
208
+ export async function resolveBaseRefSha(deps, cfg) {
209
+ try {
210
+ const r = await deps.git.run(['rev-parse', cfg.workspace.base_branch], deps.sourceRepo());
211
+ if (r.exit_code === 0 && r.stdout.trim().length > 0)
212
+ return r.stdout.trim();
213
+ }
214
+ catch {
215
+ // fall through → null (drift detection skipped; orphan removal still fires)
216
+ }
217
+ return null;
218
+ }
219
+ /** Ledger the mutating PR verbs (mirror the reference's per-action keys). */
220
+ export function recordPrLedger(ledger, effect, phase, clock, core) {
221
+ const key = prActionKey(effect);
222
+ if (key === null)
223
+ return ledger;
224
+ return phase === 'start' ? core.ledgerStart(ledger, key, clock.iso()) : core.ledgerDone(ledger, key, clock.iso());
225
+ }
226
+ function prActionKey(effect) {
227
+ switch (effect.kind) {
228
+ case 'arm_auto_merge':
229
+ return `arm_auto_merge:${effect.prNumber}`;
230
+ case 'update_branch':
231
+ return `update_branch:${effect.prNumber}`;
232
+ case 'close_pr':
233
+ return `close_pr:${effect.prNumber}`;
234
+ case 'delete_remote_branch':
235
+ return `delete_remote_branch:${effect.branch}`;
236
+ case 'cleanup_workspace':
237
+ return `cleanup_workspace:${effect.identifier}`;
238
+ case 'route_conflict':
239
+ return `route_to_conflict:${effect.identifier}:${effect.toState.toLowerCase()}`;
240
+ default:
241
+ return null;
242
+ }
243
+ }
244
+ //# sourceMappingURL=main-reconcilers-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-reconcilers-helpers.js","sourceRoot":"","sources":["../../src/shell/main-reconcilers-helpers.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,iFAAiF;AACjF,EAAE;AACF,+EAA+E;AAC/E,0EAA0E;AAC1E,8EAA8E;AAC9E,EAAE;AACF,kEAAkE;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAoB1D;mFACmF;AACnF,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAQvC;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,YAA4B,EAAE,GAAkB;IAC9E,MAAM,GAAG,GAA8B,EAAE,CAAC;IAC1C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,YAAY,CAAC,cAAc,EAAE,EAAE,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrB,GAAG,CAAC,IAAI,CAAC;YACP,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK;YACpB,YAAY,EAAE,GAAG,kBAAkB,GAAG,CAAC,CAAC,UAAU,EAAE;YACpD,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,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C;AACpH,CAAC;AAED,SAAS,WAAW,CAAC,MAAgB;IACnC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,gBAAgB;YACnB,OAAO,kBAAkB,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7C,KAAK,eAAe;YAClB,OAAO,iBAAiB,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC5C,KAAK,UAAU;YACb,OAAO,YAAY,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvC,KAAK,sBAAsB;YACzB,OAAO,wBAAwB,MAAM,CAAC,MAAM,EAAE,CAAC;QACjD,KAAK,mBAAmB;YACtB,OAAO,qBAAqB,MAAM,CAAC,UAAU,EAAE,CAAC;QAClD,KAAK,gBAAgB;YACnB,OAAO,qBAAqB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QAClF;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,148 @@
1
+ // FCIS rewrite — PR-autopilot effect applier (shell side of the reconciler PR
2
+ // pass). Sliced out of main-reconcilers.ts to keep each file under the shell
3
+ // line/complexity budgets.
4
+ //
5
+ // Runs the gh/git/tracker IO for one `PrEffect` against the live per-issue sticky
6
+ // cache (issue 70: a FOUND PR is sticky forever; the `gh pr view` TTL is
7
+ // independent of the cache-miss re-poll) and returns the `PrEffectOutcome` the
8
+ // pure `foldPrEffectOutcome` consumes. The PR pass drives the
9
+ // decide→apply→re-decide loop directly with `apply` so the cache stays
10
+ // single-owner; `applyFamily` is the interpreter's `pr`-family fallback (it
11
+ // reconstructs the last-seen intent for a core-emitted bare `pr` Effect).
12
+ //
13
+ // Shell rule: imports from src/types/** ONLY. Ports are injected.
14
+ function initPrState() {
15
+ return { prSummary: undefined, lastLookupAt: 0, prView: null, lastViewAt: 0, lastObservedHeadSha: null, armed: false, completed: false };
16
+ }
17
+ function cacheViewOf(st) {
18
+ return { completed: st.completed, armed: st.armed, lastObservedHeadSha: st.lastObservedHeadSha };
19
+ }
20
+ export const EMPTY_PR_CACHE = { completed: false, armed: false, lastObservedHeadSha: null };
21
+ const pollMs = (ctx) => ctx.deps.getCfg().pr.poll_interval_ms;
22
+ // gh/git PR ops run from the stable source repo (it always exists and carries
23
+ // the `origin` remote the verbs resolve the repository from). The per-issue
24
+ // workspace is NOT used: the autopilot no longer rebases from it and terminal
25
+ // workspaces are reaped, so a workspace cwd would ENOENT on `gh` spawn.
26
+ const cwdFor = (ctx) => ctx.deps.sourceRepo();
27
+ function getOrInit(ctx, id) {
28
+ let st = ctx.states.get(id);
29
+ if (!st) {
30
+ st = initPrState();
31
+ ctx.states.set(id, st);
32
+ }
33
+ return st;
34
+ }
35
+ async function observeSummary(ctx, intent, st) {
36
+ const fresh = ctx.deps.core.decidePrSummaryFreshness({ summary: st.prSummary, now: ctx.deps.clock.now(), lastLookupAt: st.lastLookupAt, pollIntervalMs: pollMs(ctx) });
37
+ if (fresh.kind === 'reuse')
38
+ return fresh.summary;
39
+ if (fresh.kind === 'defer')
40
+ return null;
41
+ const summary = await ctx.deps.gh.prListForBranch(cwdFor(ctx), intent.branch);
42
+ st.prSummary = summary;
43
+ st.lastLookupAt = ctx.deps.clock.now();
44
+ return summary;
45
+ }
46
+ async function fetchView(ctx, intent, prNumber, st) {
47
+ const fresh = ctx.deps.core.decidePrViewFreshness({ view: st.prView, now: ctx.deps.clock.now(), lastViewAt: st.lastViewAt, pollIntervalMs: pollMs(ctx) });
48
+ if (fresh.kind === 'reuse')
49
+ return fresh.view;
50
+ const view = await ctx.deps.gh.prView(cwdFor(ctx), prNumber);
51
+ if (view !== null) {
52
+ st.prView = view;
53
+ st.lastViewAt = ctx.deps.clock.now();
54
+ st.lastObservedHeadSha = view.head_ref_oid;
55
+ st.armed = view.auto_merge_armed;
56
+ }
57
+ return view;
58
+ }
59
+ async function routeConflict(ctx, e) {
60
+ if (!ctx.deps.tracker.moveIssueToState)
61
+ return;
62
+ await ctx.deps.tracker.moveIssueToState(e.identifier, e.toState, { fromState: e.fromState, notes: e.notes, actor: ctx.actor });
63
+ }
64
+ /** gh/git mutating verbs (arm/update/close/delete/cleanup/route). */
65
+ async function applyGhVerb(ctx, effect, st, cwd) {
66
+ const gh = ctx.deps.gh;
67
+ switch (effect.kind) {
68
+ case 'arm_auto_merge':
69
+ await gh.run(['pr', 'merge', String(effect.prNumber), '--auto', `--${effect.strategy}`, '--delete-branch'], cwd);
70
+ st.armed = true;
71
+ return { kind: 'cache', cache: cacheViewOf(st) };
72
+ case 'update_branch':
73
+ await gh.run(['pr', 'update-branch', String(effect.prNumber)], cwd);
74
+ return { kind: 'halted' };
75
+ case 'close_pr':
76
+ return { kind: 'close', ok: (await gh.run(['pr', 'close', String(effect.prNumber)], cwd)).exit_code === 0 };
77
+ case 'delete_remote_branch': {
78
+ // Scope deletion to the configured PR repo so it matches the gh `--repo`
79
+ // targeting (the out-of-repo / origin-less layout): `gh api DELETE` uses
80
+ // host auth, not cwd `origin`, so it can't push to the wrong remote. A
81
+ // 404 from an already-deleted branch (e.g. `--delete-branch` on merge) is
82
+ // ignored — the result is not folded. Local-only (no slug) → `git push`.
83
+ const slug = ctx.deps.getCfg().workspace.github_repo;
84
+ if (slug)
85
+ await gh.run(['api', '--method', 'DELETE', `repos/${slug}/git/refs/heads/${effect.branch}`], cwd);
86
+ else
87
+ await ctx.deps.git.run(['push', 'origin', '--delete', effect.branch], cwd);
88
+ return { kind: 'none' };
89
+ }
90
+ case 'cleanup_workspace':
91
+ await ctx.deps.workspace.remove(effect.identifier, 'stale_issue');
92
+ return { kind: 'none' };
93
+ case 'route_conflict':
94
+ await routeConflict(ctx, effect);
95
+ return { kind: 'halted' };
96
+ default:
97
+ return { kind: 'none' };
98
+ }
99
+ }
100
+ /** Cache-mutating latches that touch no port (update_observed_head/mark/reset). */
101
+ function applyCacheLatch(ctx, effect, st) {
102
+ switch (effect.kind) {
103
+ case 'update_observed_head':
104
+ st.lastObservedHeadSha = effect.sha;
105
+ return { kind: 'cache', cache: cacheViewOf(st) };
106
+ case 'mark_completed':
107
+ st.completed = true;
108
+ return { kind: 'cache', cache: cacheViewOf(st) };
109
+ case 'reset_transient': {
110
+ // Wipe everything (reference resetTransient) so the next return re-resolves.
111
+ if (ctx.states.has(effect.identifier))
112
+ ctx.states.set(effect.identifier, initPrState());
113
+ const next = ctx.states.get(effect.identifier);
114
+ return { kind: 'cache', cache: next ? cacheViewOf(next) : EMPTY_PR_CACHE };
115
+ }
116
+ default:
117
+ return null;
118
+ }
119
+ }
120
+ async function apply(ctx, intent, effect) {
121
+ ctx.intents.set(intent.identifier, intent);
122
+ const st = getOrInit(ctx, intent.identifier);
123
+ if (effect.kind === 'observe_summary')
124
+ return { kind: 'summary', summary: await observeSummary(ctx, intent, st), cache: cacheViewOf(st) };
125
+ if (effect.kind === 'observe_view')
126
+ return { kind: 'view', view: await fetchView(ctx, intent, effect.prNumber, st), cache: cacheViewOf(st) };
127
+ return applyCacheLatch(ctx, effect, st) ?? applyGhVerb(ctx, effect, st, cwdFor(ctx));
128
+ }
129
+ export function buildPrApplier(deps) {
130
+ const ctx = { deps, states: new Map(), intents: new Map(), actor: deps.actor ?? 'pr-autopilot' };
131
+ const applyFamily = async (effect) => {
132
+ const intent = ctx.intents.get(effect.identifier);
133
+ if (!intent)
134
+ return { ok: false, error: 'pr effect for unknown intent (no live PR pass observation)' };
135
+ await apply(ctx, intent, effect);
136
+ return { ok: true };
137
+ };
138
+ const dropExcept = (wanted) => {
139
+ for (const id of [...ctx.states.keys()])
140
+ if (!wanted.has(id))
141
+ ctx.states.delete(id);
142
+ for (const id of [...ctx.intents.keys()])
143
+ if (!wanted.has(id))
144
+ ctx.intents.delete(id);
145
+ };
146
+ return { apply: (intent, effect) => apply(ctx, intent, effect), applyFamily, dropExcept };
147
+ }
148
+ //# sourceMappingURL=main-reconcilers-pr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-reconcilers-pr.js","sourceRoot":"","sources":["../../src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