smol-symphony 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +41 -22
- package/DESIGN.md +494 -273
- package/README.md +109 -57
- package/SPEC.md +33 -24
- package/WORKFLOW.minimal.yaml +34 -0
- package/{WORKFLOW.template.md → WORKFLOW.template.yaml} +409 -256
- package/WORKFLOW.yaml +487 -0
- package/assets/skills/symphony-issues/SKILL.md +136 -0
- package/assets/symphony-mise.system.toml +68 -0
- package/dist/src/bin/symphony.js +30 -0
- package/dist/src/bin/symphony.js.map +1 -0
- package/dist/src/core/actions/context.js +109 -0
- package/dist/src/core/actions/context.js.map +1 -0
- package/dist/{actions/parsing.js → src/core/actions/parse.js} +33 -114
- package/dist/src/core/actions/parse.js.map +1 -0
- package/dist/src/core/actions/plan.js +197 -0
- package/dist/src/core/actions/plan.js.map +1 -0
- package/dist/src/core/actions/predicates.js +111 -0
- package/dist/src/core/actions/predicates.js.map +1 -0
- package/dist/src/core/actions/run-fold.js +248 -0
- package/dist/src/core/actions/run-fold.js.map +1 -0
- package/dist/src/core/actions/template.js +118 -0
- package/dist/src/core/actions/template.js.map +1 -0
- package/dist/src/core/cli/args.js +116 -0
- package/dist/src/core/cli/args.js.map +1 -0
- package/dist/src/core/coerce.js +75 -0
- package/dist/src/core/coerce.js.map +1 -0
- package/dist/src/core/credential/account-id.js +20 -0
- package/dist/src/core/credential/account-id.js.map +1 -0
- package/dist/src/core/credential/adapter-config.js +136 -0
- package/dist/src/core/credential/adapter-config.js.map +1 -0
- package/dist/src/core/credential/availability.js +98 -0
- package/dist/src/core/credential/availability.js.map +1 -0
- package/dist/src/core/credential/extract.js +228 -0
- package/dist/src/core/credential/extract.js.map +1 -0
- package/dist/src/core/credential/fake-creds.js +171 -0
- package/dist/src/core/credential/fake-creds.js.map +1 -0
- package/dist/src/core/credential/identity.js +125 -0
- package/dist/src/core/credential/identity.js.map +1 -0
- package/dist/src/core/credential/shape.js +230 -0
- package/dist/src/core/credential/shape.js.map +1 -0
- package/dist/src/core/credential/strings.js +15 -0
- package/dist/src/core/credential/strings.js.map +1 -0
- package/dist/src/core/doctor/checks.js +303 -0
- package/dist/src/core/doctor/checks.js.map +1 -0
- package/dist/src/core/git/result.js +107 -0
- package/dist/src/core/git/result.js.map +1 -0
- package/dist/src/core/http/decisions.js +225 -0
- package/dist/src/core/http/decisions.js.map +1 -0
- package/dist/{http.js → src/core/http/render.js} +472 -738
- package/dist/src/core/http/render.js.map +1 -0
- package/dist/{http-handlers.js → src/core/http/routes.js} +52 -87
- package/dist/src/core/http/routes.js.map +1 -0
- package/dist/src/core/http/views.js +181 -0
- package/dist/src/core/http/views.js.map +1 -0
- package/dist/src/core/image/managed-image.js +95 -0
- package/dist/src/core/image/managed-image.js.map +1 -0
- package/dist/src/core/issue/file.js +149 -0
- package/dist/src/core/issue/file.js.map +1 -0
- package/dist/src/core/issue/parse.js +210 -0
- package/dist/src/core/issue/parse.js.map +1 -0
- package/dist/src/core/mcp/dispatch.js +239 -0
- package/dist/src/core/mcp/dispatch.js.map +1 -0
- package/dist/src/core/mcp/post-move.js +92 -0
- package/dist/src/core/mcp/post-move.js.map +1 -0
- package/dist/src/core/mcp/protocol.js +293 -0
- package/dist/src/core/mcp/protocol.js.map +1 -0
- package/dist/src/core/mcp/url.js +162 -0
- package/dist/src/core/mcp/url.js.map +1 -0
- package/dist/src/core/path.js +63 -0
- package/dist/src/core/path.js.map +1 -0
- package/dist/src/core/reconcile/image-decide.js +48 -0
- package/dist/src/core/reconcile/image-decide.js.map +1 -0
- package/dist/src/core/reconcile/ledger.js +142 -0
- package/dist/src/core/reconcile/ledger.js.map +1 -0
- package/dist/src/core/reconcile/pr-classify.js +62 -0
- package/dist/src/core/reconcile/pr-classify.js.map +1 -0
- package/dist/{reconciler → src/core/reconcile}/pr-decide.js +25 -12
- package/dist/src/core/reconcile/pr-decide.js.map +1 -0
- package/dist/src/core/reconcile/pr-loop.js +161 -0
- package/dist/src/core/reconcile/pr-loop.js.map +1 -0
- package/dist/src/core/reconcile/pr-notes.js +35 -0
- package/dist/src/core/reconcile/pr-notes.js.map +1 -0
- package/dist/src/core/reconcile/vm-decide.js +70 -0
- package/dist/src/core/reconcile/vm-decide.js.map +1 -0
- package/dist/src/core/reconcile/vm-reap.js +207 -0
- package/dist/src/core/reconcile/vm-reap.js.map +1 -0
- package/dist/src/core/reconcile/workspace-decide.js +162 -0
- package/dist/src/core/reconcile/workspace-decide.js.map +1 -0
- package/dist/src/core/runlog/summary.js +231 -0
- package/dist/src/core/runlog/summary.js.map +1 -0
- package/dist/src/core/runner/dispatch-config.js +95 -0
- package/dist/src/core/runner/dispatch-config.js.map +1 -0
- package/dist/src/core/runner/injection.js +61 -0
- package/dist/src/core/runner/injection.js.map +1 -0
- package/dist/src/core/runner/mise.js +210 -0
- package/dist/src/core/runner/mise.js.map +1 -0
- package/dist/src/core/runner/prompt.js +720 -0
- package/dist/src/core/runner/prompt.js.map +1 -0
- package/dist/src/core/runner/turn.js +242 -0
- package/dist/src/core/runner/turn.js.map +1 -0
- package/dist/src/core/runner/vm-plan.js +390 -0
- package/dist/src/core/runner/vm-plan.js.map +1 -0
- package/dist/src/core/schedule/admission.js +123 -0
- package/dist/src/core/schedule/admission.js.map +1 -0
- package/dist/src/core/schedule/circuit-breaker.js +111 -0
- package/dist/src/core/schedule/circuit-breaker.js.map +1 -0
- package/dist/src/core/schedule/eligibility.js +83 -0
- package/dist/src/core/schedule/eligibility.js.map +1 -0
- package/dist/src/core/schedule/reconcile-issue.js +82 -0
- package/dist/src/core/schedule/reconcile-issue.js.map +1 -0
- package/dist/src/core/schedule/retry.js +96 -0
- package/dist/src/core/schedule/retry.js.map +1 -0
- package/dist/src/core/schedule/sleep-cycle.js +133 -0
- package/dist/src/core/schedule/sleep-cycle.js.map +1 -0
- package/dist/src/core/schedule/slots.js +124 -0
- package/dist/src/core/schedule/slots.js.map +1 -0
- package/dist/src/core/schedule/tick.js +553 -0
- package/dist/src/core/schedule/tick.js.map +1 -0
- package/dist/src/core/schedule/token-fold.js +181 -0
- package/dist/src/core/schedule/token-fold.js.map +1 -0
- package/dist/src/core/state-resolve.js +86 -0
- package/dist/src/core/state-resolve.js.map +1 -0
- package/dist/src/core/vm-guards.js +278 -0
- package/dist/src/core/vm-guards.js.map +1 -0
- package/dist/src/core/workflow/derive.js +107 -0
- package/dist/src/core/workflow/derive.js.map +1 -0
- package/dist/src/core/workflow/parse.js +687 -0
- package/dist/src/core/workflow/parse.js.map +1 -0
- package/dist/src/core/workflow/prompt-probe.js +78 -0
- package/dist/src/core/workflow/prompt-probe.js.map +1 -0
- package/dist/src/core/workflow/validate.js +189 -0
- package/dist/src/core/workflow/validate.js.map +1 -0
- package/dist/src/core/workspace-key.js +19 -0
- package/dist/src/core/workspace-key.js.map +1 -0
- package/dist/src/shell/actions-runner.js +356 -0
- package/dist/src/shell/actions-runner.js.map +1 -0
- package/dist/src/shell/adapter/adapter-registry.js +45 -0
- package/dist/src/shell/adapter/adapter-registry.js.map +1 -0
- package/dist/src/shell/adapter/clock-random.js +96 -0
- package/dist/src/shell/adapter/clock-random.js.map +1 -0
- package/dist/src/shell/adapter/gondolin-dispatch-helpers.js +158 -0
- package/dist/src/shell/adapter/gondolin-dispatch-helpers.js.map +1 -0
- package/dist/src/shell/adapter/gondolin-dispatch.js +385 -0
- package/dist/src/shell/adapter/gondolin-dispatch.js.map +1 -0
- package/dist/src/shell/adapter/gondolin-image-converter.js +233 -0
- package/dist/src/shell/adapter/gondolin-image-converter.js.map +1 -0
- package/dist/src/shell/adapter/gondolin-image-fetch.js +180 -0
- package/dist/src/shell/adapter/gondolin-image-fetch.js.map +1 -0
- package/dist/src/shell/adapter/launcher-asset.js +57 -0
- package/dist/src/shell/adapter/launcher-asset.js.map +1 -0
- package/dist/src/shell/adapter/mise-config-asset.js +65 -0
- package/dist/src/shell/adapter/mise-config-asset.js.map +1 -0
- package/dist/src/shell/adapter/workflow-loader.js +304 -0
- package/dist/src/shell/adapter/workflow-loader.js.map +1 -0
- package/dist/src/shell/cli/doctor.js +268 -0
- package/dist/src/shell/cli/doctor.js.map +1 -0
- package/dist/src/shell/effect-interpreter-families.js +314 -0
- package/dist/src/shell/effect-interpreter-families.js.map +1 -0
- package/dist/src/shell/effect-interpreter.js +29 -0
- package/dist/src/shell/effect-interpreter.js.map +1 -0
- package/dist/src/shell/interp/acp-frame.js +137 -0
- package/dist/src/shell/interp/acp-frame.js.map +1 -0
- package/dist/src/shell/interp/acp-ws-conn.js +320 -0
- package/dist/src/shell/interp/acp-ws-conn.js.map +1 -0
- package/dist/src/shell/interp/acp-ws-frames.js +159 -0
- package/dist/src/shell/interp/acp-ws-frames.js.map +1 -0
- package/dist/src/shell/interp/acp-ws.js +197 -0
- package/dist/src/shell/interp/acp-ws.js.map +1 -0
- package/dist/src/shell/interp/acp.js +319 -0
- package/dist/src/shell/interp/acp.js.map +1 -0
- package/dist/src/shell/interp/credential-defaults.js +128 -0
- package/dist/src/shell/interp/credential-defaults.js.map +1 -0
- package/dist/src/shell/interp/credential-hooks.js +149 -0
- package/dist/src/shell/interp/credential-hooks.js.map +1 -0
- package/dist/src/shell/interp/credential-registry.js +226 -0
- package/dist/src/shell/interp/credential-registry.js.map +1 -0
- package/dist/src/shell/interp/credential.js +103 -0
- package/dist/src/shell/interp/credential.js.map +1 -0
- package/dist/src/shell/interp/gh.js +163 -0
- package/dist/src/shell/interp/gh.js.map +1 -0
- package/dist/src/shell/interp/git.js +28 -0
- package/dist/src/shell/interp/git.js.map +1 -0
- package/dist/src/shell/interp/log.js +213 -0
- package/dist/src/shell/interp/log.js.map +1 -0
- package/dist/src/shell/interp/process.js +178 -0
- package/dist/src/shell/interp/process.js.map +1 -0
- package/dist/src/shell/interp/runlog.js +193 -0
- package/dist/src/shell/interp/runlog.js.map +1 -0
- package/dist/src/shell/interp/timer.js +64 -0
- package/dist/src/shell/interp/timer.js.map +1 -0
- package/dist/src/shell/interp/tracker-disk.js +99 -0
- package/dist/src/shell/interp/tracker-disk.js.map +1 -0
- package/dist/src/shell/interp/tracker-parse.js +71 -0
- package/dist/src/shell/interp/tracker-parse.js.map +1 -0
- package/dist/src/shell/interp/tracker-scan.js +238 -0
- package/dist/src/shell/interp/tracker-scan.js.map +1 -0
- package/dist/src/shell/interp/tracker-write.js +91 -0
- package/dist/src/shell/interp/tracker-write.js.map +1 -0
- package/dist/src/shell/interp/tracker.js +41 -0
- package/dist/src/shell/interp/tracker.js.map +1 -0
- package/dist/src/shell/interp/tty.js +48 -0
- package/dist/src/shell/interp/tty.js.map +1 -0
- package/dist/src/shell/interp/vm.js +199 -0
- package/dist/src/shell/interp/vm.js.map +1 -0
- package/dist/src/shell/interp/workspace.js +310 -0
- package/dist/src/shell/interp/workspace.js.map +1 -0
- package/dist/src/shell/main-acp.js +78 -0
- package/dist/src/shell/main-acp.js.map +1 -0
- package/dist/src/shell/main-adapters.js +222 -0
- package/dist/src/shell/main-adapters.js.map +1 -0
- package/dist/src/shell/main-credential.js +122 -0
- package/dist/src/shell/main-credential.js.map +1 -0
- package/dist/src/shell/main-doctor.js +22 -0
- package/dist/src/shell/main-doctor.js.map +1 -0
- package/dist/src/shell/main-entry.js +46 -0
- package/dist/src/shell/main-entry.js.map +1 -0
- package/dist/src/shell/main-http-csrf.js +45 -0
- package/dist/src/shell/main-http-csrf.js.map +1 -0
- package/dist/src/shell/main-http-handler.js +389 -0
- package/dist/src/shell/main-http-handler.js.map +1 -0
- package/dist/src/shell/main-http-mcp.js +122 -0
- package/dist/src/shell/main-http-mcp.js.map +1 -0
- package/dist/src/shell/main-http-views.js +253 -0
- package/dist/src/shell/main-http-views.js.map +1 -0
- package/dist/src/shell/main-http.js +76 -0
- package/dist/src/shell/main-http.js.map +1 -0
- package/dist/src/shell/main-loops.js +130 -0
- package/dist/src/shell/main-loops.js.map +1 -0
- package/dist/src/shell/main-mcp.js +129 -0
- package/dist/src/shell/main-mcp.js.map +1 -0
- package/dist/src/shell/main-orchestrator.js +120 -0
- package/dist/src/shell/main-orchestrator.js.map +1 -0
- package/dist/src/shell/main-preflight.js +43 -0
- package/dist/src/shell/main-preflight.js.map +1 -0
- package/dist/src/shell/main-reconcilers-helpers.js +244 -0
- package/dist/src/shell/main-reconcilers-helpers.js.map +1 -0
- package/dist/src/shell/main-reconcilers-pr.js +148 -0
- package/dist/src/shell/main-reconcilers-pr.js.map +1 -0
- package/dist/src/shell/main-reconcilers.js +225 -0
- package/dist/src/shell/main-reconcilers.js.map +1 -0
- package/dist/src/shell/main-runner.js +355 -0
- package/dist/src/shell/main-runner.js.map +1 -0
- package/dist/src/shell/main-scaffold.js +116 -0
- package/dist/src/shell/main-scaffold.js.map +1 -0
- package/dist/src/shell/main-shutdown.js +115 -0
- package/dist/src/shell/main-shutdown.js.map +1 -0
- package/dist/src/shell/main-startup.js +48 -0
- package/dist/src/shell/main-startup.js.map +1 -0
- package/dist/src/shell/main-substrates.js +43 -0
- package/dist/src/shell/main-substrates.js.map +1 -0
- package/dist/src/shell/main.js +385 -0
- package/dist/src/shell/main.js.map +1 -0
- package/dist/src/shell/orchestrator-feedback.js +69 -0
- package/dist/src/shell/orchestrator-feedback.js.map +1 -0
- package/dist/src/shell/orchestrator-image.js +167 -0
- package/dist/src/shell/orchestrator-image.js.map +1 -0
- package/dist/src/shell/orchestrator-loop.js +468 -0
- package/dist/src/shell/orchestrator-loop.js.map +1 -0
- package/dist/src/shell/orchestrator-reconcile.js +36 -0
- package/dist/src/shell/orchestrator-reconcile.js.map +1 -0
- package/dist/src/shell/reconciler-loop.js +228 -0
- package/dist/src/shell/reconciler-loop.js.map +1 -0
- package/dist/src/shell/runner-loop-turn.js +301 -0
- package/dist/src/shell/runner-loop-turn.js.map +1 -0
- package/dist/src/shell/runner-loop.js +338 -0
- package/dist/src/shell/runner-loop.js.map +1 -0
- package/dist/src/shell/server/http.js +208 -0
- package/dist/src/shell/server/http.js.map +1 -0
- package/dist/src/shell/server/mcp-runtime-effects.js +237 -0
- package/dist/src/shell/server/mcp-runtime-effects.js.map +1 -0
- package/dist/src/shell/server/mcp-runtime.js +99 -0
- package/dist/src/shell/server/mcp-runtime.js.map +1 -0
- package/dist/src/shell/workspace-key.js +14 -0
- package/dist/src/shell/workspace-key.js.map +1 -0
- package/dist/src/types/acp.js +8 -0
- package/dist/src/types/acp.js.map +1 -0
- package/dist/src/types/actions/plan.js +6 -0
- package/dist/src/types/actions/plan.js.map +1 -0
- package/dist/src/types/actions/predicates.js +6 -0
- package/dist/src/types/actions/predicates.js.map +1 -0
- package/dist/src/types/actions/run-fold.js +8 -0
- package/dist/src/types/actions/run-fold.js.map +1 -0
- package/dist/src/types/actions.js +7 -0
- package/dist/src/types/actions.js.map +1 -0
- package/dist/src/types/adapter/clock-random.js +4 -0
- package/dist/src/types/adapter/clock-random.js.map +1 -0
- package/dist/src/types/adapter/gondolin-image-converter.js +5 -0
- package/dist/src/types/adapter/gondolin-image-converter.js.map +1 -0
- package/dist/src/types/adapter/gondolin-image-fetch.js +5 -0
- package/dist/src/types/adapter/gondolin-image-fetch.js.map +1 -0
- package/dist/src/types/adapter/workflow-loader.js +4 -0
- package/dist/src/types/adapter/workflow-loader.js.map +1 -0
- package/dist/src/types/cli/args.js +8 -0
- package/dist/src/types/cli/args.js.map +1 -0
- package/dist/src/types/config.js +8 -0
- package/dist/src/types/config.js.map +1 -0
- package/dist/src/types/credential-interp.js +6 -0
- package/dist/src/types/credential-interp.js.map +1 -0
- package/dist/src/types/credentials.js +10 -0
- package/dist/src/types/credentials.js.map +1 -0
- package/dist/src/types/doctor.js +7 -0
- package/dist/src/types/doctor.js.map +1 -0
- package/dist/src/types/domain.js +7 -0
- package/dist/src/types/domain.js.map +1 -0
- package/dist/src/types/effect.js +15 -0
- package/dist/src/types/effect.js.map +1 -0
- package/dist/src/types/errors.js +39 -0
- package/dist/src/types/errors.js.map +1 -0
- package/dist/src/types/http/decisions.js +6 -0
- package/dist/src/types/http/decisions.js.map +1 -0
- package/dist/src/types/http/render.js +10 -0
- package/dist/src/types/http/render.js.map +1 -0
- package/dist/src/types/http/views.js +6 -0
- package/dist/src/types/http/views.js.map +1 -0
- package/dist/src/types/http.js +9 -0
- package/dist/src/types/http.js.map +1 -0
- package/dist/src/types/image/managed-image.js +7 -0
- package/dist/src/types/image/managed-image.js.map +1 -0
- package/dist/src/types/interp/effect-interpreter.js +8 -0
- package/dist/src/types/interp/effect-interpreter.js.map +1 -0
- package/dist/src/types/interp/tracker.js +7 -0
- package/dist/src/types/interp/tracker.js.map +1 -0
- package/dist/src/types/issue/file.js +6 -0
- package/dist/src/types/issue/file.js.map +1 -0
- package/dist/src/types/issue/parse.js +8 -0
- package/dist/src/types/issue/parse.js.map +1 -0
- package/dist/src/types/main-acp.js +13 -0
- package/dist/src/types/main-acp.js.map +1 -0
- package/dist/src/types/main-adapters.js +5 -0
- package/dist/src/types/main-adapters.js.map +1 -0
- package/dist/src/types/main-credential.js +21 -0
- package/dist/src/types/main-credential.js.map +1 -0
- package/dist/src/types/main-doctor.js +6 -0
- package/dist/src/types/main-doctor.js.map +1 -0
- package/dist/src/types/main-http-handler.js +12 -0
- package/dist/src/types/main-http-handler.js.map +1 -0
- package/dist/src/types/main-http.js +5 -0
- package/dist/src/types/main-http.js.map +1 -0
- package/dist/src/types/main-loops.js +5 -0
- package/dist/src/types/main-loops.js.map +1 -0
- package/dist/src/types/main-mcp.js +12 -0
- package/dist/src/types/main-mcp.js.map +1 -0
- package/dist/src/types/main-orchestrator.js +5 -0
- package/dist/src/types/main-orchestrator.js.map +1 -0
- package/dist/src/types/main-reconcilers.js +11 -0
- package/dist/src/types/main-reconcilers.js.map +1 -0
- package/dist/src/types/main-runner.js +13 -0
- package/dist/src/types/main-runner.js.map +1 -0
- package/dist/src/types/main-startup.js +5 -0
- package/dist/src/types/main-startup.js.map +1 -0
- package/dist/src/types/main-substrates.js +5 -0
- package/dist/src/types/main-substrates.js.map +1 -0
- package/dist/src/types/mcp/dispatch.js +4 -0
- package/dist/src/types/mcp/dispatch.js.map +1 -0
- package/dist/src/types/mcp/post-move.js +7 -0
- package/dist/src/types/mcp/post-move.js.map +1 -0
- package/dist/src/types/mcp.js +9 -0
- package/dist/src/types/mcp.js.map +1 -0
- package/dist/src/types/ports.js +12 -0
- package/dist/src/types/ports.js.map +1 -0
- package/dist/src/types/reconcile/image-decide.js +5 -0
- package/dist/src/types/reconcile/image-decide.js.map +1 -0
- package/dist/src/types/reconcile/ledger.js +7 -0
- package/dist/src/types/reconcile/ledger.js.map +1 -0
- package/dist/src/types/reconcile/pr-loop.js +8 -0
- package/dist/src/types/reconcile/pr-loop.js.map +1 -0
- package/dist/src/types/reconcile/vm-reap.js +8 -0
- package/dist/src/types/reconcile/vm-reap.js.map +1 -0
- package/dist/src/types/reconcile/workspace-decide.js +7 -0
- package/dist/src/types/reconcile/workspace-decide.js.map +1 -0
- package/dist/src/types/reconcile.js +9 -0
- package/dist/src/types/reconcile.js.map +1 -0
- package/dist/src/types/runlog.js +7 -0
- package/dist/src/types/runlog.js.map +1 -0
- package/dist/src/types/runner/actions-runner.js +12 -0
- package/dist/src/types/runner/actions-runner.js.map +1 -0
- package/dist/src/types/runner/gondolin-dispatch.js +5 -0
- package/dist/src/types/runner/gondolin-dispatch.js.map +1 -0
- package/dist/src/types/runner/injection.js +6 -0
- package/dist/src/types/runner/injection.js.map +1 -0
- package/dist/src/types/runner/runner-loop.js +5 -0
- package/dist/src/types/runner/runner-loop.js.map +1 -0
- package/dist/src/types/runner/turn.js +4 -0
- package/dist/src/types/runner/turn.js.map +1 -0
- package/dist/src/types/runner/vm-plan.js +4 -0
- package/dist/src/types/runner/vm-plan.js.map +1 -0
- package/dist/src/types/runtime.js +9 -0
- package/dist/src/types/runtime.js.map +1 -0
- package/dist/src/types/schedule/admission.js +7 -0
- package/dist/src/types/schedule/admission.js.map +1 -0
- package/dist/src/types/schedule/circuit-breaker.js +2 -0
- package/dist/src/types/schedule/circuit-breaker.js.map +1 -0
- package/dist/src/types/schedule/eligibility.js +9 -0
- package/dist/src/types/schedule/eligibility.js.map +1 -0
- package/dist/src/types/schedule/orchestrator-loop.js +10 -0
- package/dist/src/types/schedule/orchestrator-loop.js.map +1 -0
- package/dist/src/types/schedule/sleep-cycle.js +4 -0
- package/dist/src/types/schedule/sleep-cycle.js.map +1 -0
- package/dist/src/types/schedule/slots.js +8 -0
- package/dist/src/types/schedule/slots.js.map +1 -0
- package/dist/src/types/schedule/tick.js +9 -0
- package/dist/src/types/schedule/tick.js.map +1 -0
- package/dist/src/types/server/mcp-runtime.js +8 -0
- package/dist/src/types/server/mcp-runtime.js.map +1 -0
- package/dist/src/types/workflow/parse.js +4 -0
- package/dist/src/types/workflow/parse.js.map +1 -0
- package/dist/tests/core/account-id.test.js +35 -0
- package/dist/tests/core/account-id.test.js.map +1 -0
- package/dist/tests/core/actions-parse.test.js +176 -0
- package/dist/tests/core/actions-parse.test.js.map +1 -0
- package/dist/tests/core/adapter-config.test.js +133 -0
- package/dist/tests/core/adapter-config.test.js.map +1 -0
- package/dist/tests/core/admission.test.js +215 -0
- package/dist/tests/core/admission.test.js.map +1 -0
- package/dist/tests/core/args.test.js +132 -0
- package/dist/tests/core/args.test.js.map +1 -0
- package/dist/tests/core/availability.test.js +62 -0
- package/dist/tests/core/availability.test.js.map +1 -0
- package/dist/tests/core/checks.test.js +395 -0
- package/dist/tests/core/checks.test.js.map +1 -0
- package/dist/tests/core/circuit-breaker.test.js +172 -0
- package/dist/tests/core/circuit-breaker.test.js.map +1 -0
- package/dist/tests/core/coerce.test.js +87 -0
- package/dist/tests/core/coerce.test.js.map +1 -0
- package/dist/tests/core/context.test.js +228 -0
- package/dist/tests/core/context.test.js.map +1 -0
- package/dist/tests/core/decisions.test.js +310 -0
- package/dist/tests/core/decisions.test.js.map +1 -0
- package/dist/tests/core/derive.test.js +205 -0
- package/dist/tests/core/derive.test.js.map +1 -0
- package/dist/tests/core/dispatch-config.test.js +164 -0
- package/dist/tests/core/dispatch-config.test.js.map +1 -0
- package/dist/tests/core/dispatch.test.js +302 -0
- package/dist/tests/core/dispatch.test.js.map +1 -0
- package/dist/tests/core/eligibility.test.js +163 -0
- package/dist/tests/core/eligibility.test.js.map +1 -0
- package/dist/tests/core/extract.test.js +139 -0
- package/dist/tests/core/extract.test.js.map +1 -0
- package/dist/tests/core/fake-creds.test.js +134 -0
- package/dist/tests/core/fake-creds.test.js.map +1 -0
- package/dist/tests/core/file.test.js +197 -0
- package/dist/tests/core/file.test.js.map +1 -0
- package/dist/tests/core/git-result.test.js +113 -0
- package/dist/tests/core/git-result.test.js.map +1 -0
- package/dist/tests/core/identity.test.js +180 -0
- package/dist/tests/core/identity.test.js.map +1 -0
- package/dist/tests/core/image-decide.test.js +59 -0
- package/dist/tests/core/image-decide.test.js.map +1 -0
- package/dist/tests/core/injection.test.js +163 -0
- package/dist/tests/core/injection.test.js.map +1 -0
- package/dist/tests/core/ledger.test.js +218 -0
- package/dist/tests/core/ledger.test.js.map +1 -0
- package/dist/tests/core/managed-image.test.js +68 -0
- package/dist/tests/core/managed-image.test.js.map +1 -0
- package/dist/tests/core/mise.test.js +138 -0
- package/dist/tests/core/mise.test.js.map +1 -0
- package/dist/tests/core/parse.test.js +174 -0
- package/dist/tests/core/parse.test.js.map +1 -0
- package/dist/tests/core/path.test.js +50 -0
- package/dist/tests/core/path.test.js.map +1 -0
- package/dist/tests/core/plan.test.js +218 -0
- package/dist/tests/core/plan.test.js.map +1 -0
- package/dist/tests/core/post-move.test.js +162 -0
- package/dist/tests/core/post-move.test.js.map +1 -0
- package/dist/tests/core/pr-classify.test.js +117 -0
- package/dist/tests/core/pr-classify.test.js.map +1 -0
- package/dist/tests/core/pr-decide.test.js +298 -0
- package/dist/tests/core/pr-decide.test.js.map +1 -0
- package/dist/tests/core/pr-loop.test.js +301 -0
- package/dist/tests/core/pr-loop.test.js.map +1 -0
- package/dist/tests/core/pr-notes.test.js +165 -0
- package/dist/tests/core/pr-notes.test.js.map +1 -0
- package/dist/tests/core/predicates.test.js +154 -0
- package/dist/tests/core/predicates.test.js.map +1 -0
- package/dist/tests/core/prompt.test.js +189 -0
- package/dist/tests/core/prompt.test.js.map +1 -0
- package/dist/tests/core/protocol.test.js +195 -0
- package/dist/tests/core/protocol.test.js.map +1 -0
- package/dist/tests/core/reconcile-issue.test.js +116 -0
- package/dist/tests/core/reconcile-issue.test.js.map +1 -0
- package/dist/tests/core/render.test.js +549 -0
- package/dist/tests/core/render.test.js.map +1 -0
- package/dist/tests/core/retry.test.js +186 -0
- package/dist/tests/core/retry.test.js.map +1 -0
- package/dist/tests/core/routes.test.js +247 -0
- package/dist/tests/core/routes.test.js.map +1 -0
- package/dist/tests/core/run-fold.test.js +299 -0
- package/dist/tests/core/run-fold.test.js.map +1 -0
- package/dist/tests/core/shape.test.js +185 -0
- package/dist/tests/core/shape.test.js.map +1 -0
- package/dist/tests/core/sleep-cycle.test.js +150 -0
- package/dist/tests/core/sleep-cycle.test.js.map +1 -0
- package/dist/tests/core/slots.test.js +201 -0
- package/dist/tests/core/slots.test.js.map +1 -0
- package/dist/tests/core/state-resolve.test.js +80 -0
- package/dist/tests/core/state-resolve.test.js.map +1 -0
- package/dist/tests/core/summary.test.js +200 -0
- package/dist/tests/core/summary.test.js.map +1 -0
- package/dist/tests/core/template.test.js +116 -0
- package/dist/tests/core/template.test.js.map +1 -0
- package/dist/tests/core/tick.test.js +558 -0
- package/dist/tests/core/tick.test.js.map +1 -0
- package/dist/tests/core/token-fold.test.js +176 -0
- package/dist/tests/core/token-fold.test.js.map +1 -0
- package/dist/tests/core/turn.test.js +388 -0
- package/dist/tests/core/turn.test.js.map +1 -0
- package/dist/tests/core/url.test.js +118 -0
- package/dist/tests/core/url.test.js.map +1 -0
- package/dist/tests/core/validate.test.js +247 -0
- package/dist/tests/core/validate.test.js.map +1 -0
- package/dist/tests/core/views.test.js +252 -0
- package/dist/tests/core/views.test.js.map +1 -0
- package/dist/tests/core/vm-decide.test.js +110 -0
- package/dist/tests/core/vm-decide.test.js.map +1 -0
- package/dist/tests/core/vm-guards.test.js +153 -0
- package/dist/tests/core/vm-guards.test.js.map +1 -0
- package/dist/tests/core/vm-plan.test.js +332 -0
- package/dist/tests/core/vm-plan.test.js.map +1 -0
- package/dist/tests/core/vm-reap.test.js +196 -0
- package/dist/tests/core/vm-reap.test.js.map +1 -0
- package/dist/tests/core/workflow-parse.test.js +493 -0
- package/dist/tests/core/workflow-parse.test.js.map +1 -0
- package/dist/tests/core/workspace-decide.test.js +236 -0
- package/dist/tests/core/workspace-decide.test.js.map +1 -0
- package/dist/tests/helpers/fixtures.js +167 -0
- package/dist/tests/helpers/fixtures.js.map +1 -0
- package/dist/tests/shell/acp-substrate.test.js +101 -0
- package/dist/tests/shell/acp-substrate.test.js.map +1 -0
- package/dist/tests/shell/actions-runner-push.test.js +203 -0
- package/dist/tests/shell/actions-runner-push.test.js.map +1 -0
- package/dist/tests/shell/credential-hooks.test.js +36 -0
- package/dist/tests/shell/credential-hooks.test.js.map +1 -0
- package/dist/tests/shell/credential-registry.test.js +165 -0
- package/dist/tests/shell/credential-registry.test.js.map +1 -0
- package/dist/tests/shell/credential-substrate.test.js +179 -0
- package/dist/tests/shell/credential-substrate.test.js.map +1 -0
- package/dist/tests/shell/dockerfile-mise-pin.test.js +51 -0
- package/dist/tests/shell/dockerfile-mise-pin.test.js.map +1 -0
- package/dist/tests/shell/doctor.test.js +101 -0
- package/dist/tests/shell/doctor.test.js.map +1 -0
- package/dist/tests/shell/effect-vm-create.test.js +52 -0
- package/dist/tests/shell/effect-vm-create.test.js.map +1 -0
- package/dist/tests/shell/gh-port.test.js +63 -0
- package/dist/tests/shell/gh-port.test.js.map +1 -0
- package/dist/tests/shell/gondolin-dispatch-guard.test.js +144 -0
- package/dist/tests/shell/gondolin-dispatch-guard.test.js.map +1 -0
- package/dist/tests/shell/gondolin-dispatch-shquote.test.js +168 -0
- package/dist/tests/shell/gondolin-dispatch-shquote.test.js.map +1 -0
- package/dist/tests/shell/gondolin-image-converter.test.js +208 -0
- package/dist/tests/shell/gondolin-image-converter.test.js.map +1 -0
- package/dist/tests/shell/gondolin-image-fetch.test.js +93 -0
- package/dist/tests/shell/gondolin-image-fetch.test.js.map +1 -0
- package/dist/tests/shell/http-handler.test.js +608 -0
- package/dist/tests/shell/http-handler.test.js.map +1 -0
- package/dist/tests/shell/http-server.test.js +53 -0
- package/dist/tests/shell/http-server.test.js.map +1 -0
- package/dist/tests/shell/mcp-runtime.test.js +366 -0
- package/dist/tests/shell/mcp-runtime.test.js.map +1 -0
- package/dist/tests/shell/mise-config-asset.test.js +87 -0
- package/dist/tests/shell/mise-config-asset.test.js.map +1 -0
- package/dist/tests/shell/orchestrator-loop.test.js +583 -0
- package/dist/tests/shell/orchestrator-loop.test.js.map +1 -0
- package/dist/tests/shell/reconciler-passes.test.js +314 -0
- package/dist/tests/shell/reconciler-passes.test.js.map +1 -0
- package/dist/tests/shell/runner-loop-turn.test.js +97 -0
- package/dist/tests/shell/runner-loop-turn.test.js.map +1 -0
- package/dist/tests/shell/runner-slice.test.js +536 -0
- package/dist/tests/shell/runner-slice.test.js.map +1 -0
- package/dist/tests/shell/scaffold.test.js +65 -0
- package/dist/tests/shell/scaffold.test.js.map +1 -0
- package/dist/tests/shell/tick-config.test.js +83 -0
- package/dist/tests/shell/tick-config.test.js.map +1 -0
- package/dist/tests/shell/tracker-parse-dates.test.js +44 -0
- package/dist/tests/shell/tracker-parse-dates.test.js.map +1 -0
- package/dist/tests/shell/tracker-write-issue.test.js +154 -0
- package/dist/tests/shell/tracker-write-issue.test.js.map +1 -0
- package/dist/tests/shell/workflow-prompt-split.test.js +208 -0
- package/dist/tests/shell/workflow-prompt-split.test.js.map +1 -0
- package/dist/tests/shell/workspace-live-config.test.js +140 -0
- package/dist/tests/shell/workspace-live-config.test.js.map +1 -0
- package/package.json +21 -9
- package/patches/@earendil-works+gondolin+0.12.0.patch +173 -0
- package/prompts/Reflect.md +91 -0
- package/prompts/Review.md +97 -0
- package/prompts/Todo.md +96 -0
- package/prompts/_footer.md +41 -0
- package/prompts/_preamble.md +42 -0
- package/prompts-minimal/Todo.md +26 -0
- package/scripts/postinstall.mjs +63 -0
- package/scripts/vm-agent.mjs +312 -90
- package/WORKFLOW.md +0 -744
- package/dist/acp-bridge.js +0 -324
- package/dist/acp-bridge.js.map +0 -1
- package/dist/actions/cache.js +0 -191
- package/dist/actions/cache.js.map +0 -1
- package/dist/actions/effects.js +0 -41
- package/dist/actions/effects.js.map +0 -1
- package/dist/actions/executor.js +0 -570
- package/dist/actions/executor.js.map +0 -1
- package/dist/actions/index.js +0 -13
- package/dist/actions/index.js.map +0 -1
- package/dist/actions/parsing.js.map +0 -1
- package/dist/actions/predicate-env.js +0 -27
- package/dist/actions/predicate-env.js.map +0 -1
- package/dist/actions/predicates.js +0 -49
- package/dist/actions/predicates.js.map +0 -1
- package/dist/actions/templating.js +0 -66
- package/dist/actions/templating.js.map +0 -1
- package/dist/actions/types.js +0 -15
- package/dist/actions/types.js.map +0 -1
- package/dist/agent/acp.js +0 -473
- package/dist/agent/acp.js.map +0 -1
- package/dist/agent/adapter-names.js +0 -159
- package/dist/agent/adapter-names.js.map +0 -1
- package/dist/agent/adapters.js +0 -511
- package/dist/agent/adapters.js.map +0 -1
- package/dist/agent/credential-extractors.js +0 -342
- package/dist/agent/credential-extractors.js.map +0 -1
- package/dist/agent/credential-secrets.js +0 -628
- package/dist/agent/credential-secrets.js.map +0 -1
- package/dist/agent/credential-ticker.js +0 -57
- package/dist/agent/credential-ticker.js.map +0 -1
- package/dist/agent/gondolin-creds-staging.js +0 -356
- package/dist/agent/gondolin-creds-staging.js.map +0 -1
- package/dist/agent/gondolin-dispatch.js +0 -375
- package/dist/agent/gondolin-dispatch.js.map +0 -1
- package/dist/agent/gondolin.js +0 -124
- package/dist/agent/gondolin.js.map +0 -1
- package/dist/agent/runner-decisions.js +0 -134
- package/dist/agent/runner-decisions.js.map +0 -1
- package/dist/agent/runner.js +0 -1456
- package/dist/agent/runner.js.map +0 -1
- package/dist/agent/tool-call-summary.js +0 -102
- package/dist/agent/tool-call-summary.js.map +0 -1
- package/dist/agent/vm-acp-mapping.js +0 -73
- package/dist/agent/vm-acp-mapping.js.map +0 -1
- package/dist/agent/vm-guards.js +0 -262
- package/dist/agent/vm-guards.js.map +0 -1
- package/dist/agent/vm-port.js +0 -22
- package/dist/agent/vm-port.js.map +0 -1
- package/dist/agent/vm-process-registry.js +0 -79
- package/dist/agent/vm-process-registry.js.map +0 -1
- package/dist/bin/cli-args.js +0 -105
- package/dist/bin/cli-args.js.map +0 -1
- package/dist/bin/symphony.js +0 -794
- package/dist/bin/symphony.js.map +0 -1
- package/dist/errors.js +0 -15
- package/dist/errors.js.map +0 -1
- package/dist/http-disk.js +0 -135
- package/dist/http-disk.js.map +0 -1
- package/dist/http-handlers.js.map +0 -1
- package/dist/http.js.map +0 -1
- package/dist/issues.js +0 -178
- package/dist/issues.js.map +0 -1
- package/dist/logging.js +0 -203
- package/dist/logging.js.map +0 -1
- package/dist/mcp.js +0 -706
- package/dist/mcp.js.map +0 -1
- package/dist/memory.js +0 -85
- package/dist/memory.js.map +0 -1
- package/dist/orchestrator-decisions.js +0 -331
- package/dist/orchestrator-decisions.js.map +0 -1
- package/dist/orchestrator.js +0 -1569
- package/dist/orchestrator.js.map +0 -1
- package/dist/prompt.js +0 -65
- package/dist/prompt.js.map +0 -1
- package/dist/reconciler/cache.js +0 -65
- package/dist/reconciler/cache.js.map +0 -1
- package/dist/reconciler/index.js +0 -448
- package/dist/reconciler/index.js.map +0 -1
- package/dist/reconciler/ledger.js +0 -131
- package/dist/reconciler/ledger.js.map +0 -1
- package/dist/reconciler/pr-adapters.js +0 -174
- package/dist/reconciler/pr-adapters.js.map +0 -1
- package/dist/reconciler/pr-decide.js.map +0 -1
- package/dist/reconciler/pr.js +0 -422
- package/dist/reconciler/pr.js.map +0 -1
- package/dist/reconciler/types.js +0 -12
- package/dist/reconciler/types.js.map +0 -1
- package/dist/reconciler/vm.js +0 -243
- package/dist/reconciler/vm.js.map +0 -1
- package/dist/reconciler/workspace-defaults.js +0 -83
- package/dist/reconciler/workspace-defaults.js.map +0 -1
- package/dist/reconciler/workspace.js +0 -272
- package/dist/reconciler/workspace.js.map +0 -1
- package/dist/runlog.js +0 -403
- package/dist/runlog.js.map +0 -1
- package/dist/scaffold.js +0 -165
- package/dist/scaffold.js.map +0 -1
- package/dist/trackers/local.js +0 -445
- package/dist/trackers/local.js.map +0 -1
- package/dist/trackers/types.js +0 -10
- package/dist/trackers/types.js.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/util/clock.js +0 -12
- package/dist/util/clock.js.map +0 -1
- package/dist/util/crypto.js +0 -25
- package/dist/util/crypto.js.map +0 -1
- package/dist/util/frontmatter.js +0 -70
- package/dist/util/frontmatter.js.map +0 -1
- package/dist/util/fs-issues.js +0 -22
- package/dist/util/fs-issues.js.map +0 -1
- package/dist/util/process.js +0 -152
- package/dist/util/process.js.map +0 -1
- package/dist/util/workspace-key.js +0 -10
- package/dist/util/workspace-key.js.map +0 -1
- package/dist/workflow-loader.js +0 -147
- package/dist/workflow-loader.js.map +0 -1
- package/dist/workflow.js +0 -822
- package/dist/workflow.js.map +0 -1
- package/dist/workspace-types.js +0 -8
- package/dist/workspace-types.js.map +0 -1
- package/dist/workspace.js +0 -443
- package/dist/workspace.js.map +0 -1
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
// FCIS rewrite — imperative shell: the terminal-state `actions:` runner.
|
|
2
|
+
//
|
|
3
|
+
// The IMPERATIVE driver behind the runner loop's phase 8 (the per-state cleanup
|
|
4
|
+
// block; the VM is still alive so a `run_in_vm` action can exec into it). Every
|
|
5
|
+
// routing / precedence / retry DECISION lives in the functional core
|
|
6
|
+
// (core/actions/{plan,context,predicates,run-fold}.ts + core/workflow/derive.ts);
|
|
7
|
+
// this shell only EXECUTES: it resolves the state's actions, plans the per-action
|
|
8
|
+
// Effect sequences, runs them through the SAME central effect interpreter the rest
|
|
9
|
+
// of the runner uses, and folds each outcome back through the pure run-fold ledger.
|
|
10
|
+
//
|
|
11
|
+
// A `run_in_vm` action is the one kind the shell execs directly: the planner emits
|
|
12
|
+
// a `vm.exec` whose vmId is a placeholder (core holds no VM handle), so this runner
|
|
13
|
+
// execs the rendered command on the live per-issue VM (phase 8 keeps it alive) and
|
|
14
|
+
// maps the exit code to the ActionOutcome. The run is uncached.
|
|
15
|
+
//
|
|
16
|
+
// Per the FCIS layout rule a shell module imports from src/types ONLY; the pure
|
|
17
|
+
// core deciders arrive INJECTED via `ActionsRunnerCore` (the composition root binds
|
|
18
|
+
// the real core fns). The interpreter / clock / runlog are ports.
|
|
19
|
+
const STDIO_CAPTURE_LIMIT = 65_536;
|
|
20
|
+
const DEFAULT_COMMAND_TIMEOUT_MS = 300_000;
|
|
21
|
+
/**
|
|
22
|
+
* Build the terminal-state actions runner the runner-loop's phase 8 calls. The
|
|
23
|
+
* returned `runStateActions` resolves the state's `actions:` block, derives the
|
|
24
|
+
* context, plans the per-action effects, and drives the run-fold loop — returning
|
|
25
|
+
* a {@link StateActionsRun} (the non-routed abort reason for the attempt outcome
|
|
26
|
+
* plus the retain-workspace reason for a failed handoff). On a route it ALSO moves
|
|
27
|
+
* the issue OUT of the (terminal) action state into the `on_error.then.route_to`
|
|
28
|
+
* holding state so a failed Done handoff is operator-visible (issue 235); if that
|
|
29
|
+
* reroute move ITSELF fails the issue is still stranded in the terminal state, so the
|
|
30
|
+
* failure is surfaced as a non-routed attempt failure (worker exits abnormal) rather
|
|
31
|
+
* than dead-ending silently — the workspace is retained on both paths.
|
|
32
|
+
*/
|
|
33
|
+
export function createActionsRunner(deps) {
|
|
34
|
+
async function runStateActions(args) {
|
|
35
|
+
const cfg = deps.cfg();
|
|
36
|
+
const actions = deps.core.resolveActionsForState(cfg, args.state);
|
|
37
|
+
if (!actions || actions.length === 0)
|
|
38
|
+
return { nonRouted: null, markHandoffReason: null };
|
|
39
|
+
const ctx = deps.core.deriveActionContext({
|
|
40
|
+
view: toView(args.entry, args.workspacePath),
|
|
41
|
+
extraEnv: undefined,
|
|
42
|
+
repoEnv: deps.readEnv('SYMPHONY_REPO'),
|
|
43
|
+
repoDefault: cfg.workspace.github_repo,
|
|
44
|
+
baseBranchDefault: cfg.workspace.base_branch,
|
|
45
|
+
});
|
|
46
|
+
const planned = deps.core.planActions(actions, ctx, {
|
|
47
|
+
workspacePath: args.workspacePath,
|
|
48
|
+
defaultCommandTimeoutMs: deps.defaultCommandTimeoutMs ?? DEFAULT_COMMAND_TIMEOUT_MS,
|
|
49
|
+
});
|
|
50
|
+
const result = await runPlanned(deps, planned, args, args.workspacePath);
|
|
51
|
+
// Rewrite the failure reason once into operator-actionable text (a
|
|
52
|
+
// workflow-scope push decline → "manual SSH push required"; issue 235).
|
|
53
|
+
const reason = result.reason !== null ? deps.core.describeHandoffFailure(result.reason) : null;
|
|
54
|
+
// The route is a clean handoff to a holding state: MOVE the issue out of the
|
|
55
|
+
// terminal action state (so the stranded handoff is operator-visible, not a
|
|
56
|
+
// silent terminal-Done) and RETAIN its workspace so the unpushed commit
|
|
57
|
+
// survives. A bare abort surfaces a non-routed failure to the caller instead.
|
|
58
|
+
if (result.route_to !== null) {
|
|
59
|
+
const routed = await routeOutOfState(deps, args, result.route_to, reason ?? '');
|
|
60
|
+
// The reroute MOVE itself failed (tracker broken): the issue is still stranded
|
|
61
|
+
// in the terminal state, so a clean exit would recreate the silent terminal-Done
|
|
62
|
+
// this issue closes. Surface the failed reroute as a non-routed attempt failure
|
|
63
|
+
// (worker exits ABNORMAL) while still retaining the workspace (issue 235).
|
|
64
|
+
if (routed.error !== null) {
|
|
65
|
+
const detail = reason ? ` (handoff: ${reason})` : '';
|
|
66
|
+
return { nonRouted: `reroute to ${result.route_to} failed: ${routed.error}${detail}`, markHandoffReason: reason };
|
|
67
|
+
}
|
|
68
|
+
return { nonRouted: null, markHandoffReason: reason };
|
|
69
|
+
}
|
|
70
|
+
if (result.ok)
|
|
71
|
+
return { nonRouted: null, markHandoffReason: null };
|
|
72
|
+
return { nonRouted: reason, markHandoffReason: reason };
|
|
73
|
+
}
|
|
74
|
+
return { runStateActions };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Move the issue out of its terminal action state into the routed holding state and
|
|
78
|
+
* record the rerouted transition on the live entry (issue 235). The agent already
|
|
79
|
+
* moved the file INTO the terminal state via `symphony.transition`; this re-moves it
|
|
80
|
+
* to the holding state with the failure reason appended as notes, so a failed Done
|
|
81
|
+
* handoff parks somewhere the operator sees it. Returns the move error when the
|
|
82
|
+
* tracker move itself FAILED (the issue is still stranded in the terminal state) so
|
|
83
|
+
* the caller can surface it as a non-routed attempt failure instead of exiting clean
|
|
84
|
+
* into a silent terminal-Done; `last_transition` is recorded as rerouted ONLY when
|
|
85
|
+
* the move actually landed (otherwise it would lie about where the issue lives).
|
|
86
|
+
*/
|
|
87
|
+
async function routeOutOfState(deps, args, toState, reason) {
|
|
88
|
+
const actor = args.entry.resolved_actor || null;
|
|
89
|
+
const move = {
|
|
90
|
+
family: 'tracker',
|
|
91
|
+
kind: 'move_state',
|
|
92
|
+
issueId: args.entry.issue_id,
|
|
93
|
+
toState,
|
|
94
|
+
fromRoot: args.entry.tracker_root_at_dispatch ?? null,
|
|
95
|
+
fromState: args.state,
|
|
96
|
+
notes: reason,
|
|
97
|
+
actor,
|
|
98
|
+
};
|
|
99
|
+
const r = await deps.interpreter.execute(move).catch((err) => ({ ok: false, error: err.message }));
|
|
100
|
+
const moved = 'kind' in r && r.kind === 'move_state';
|
|
101
|
+
deps.runlog.system(args.entry.issue_id, 'state_actions_routed', {
|
|
102
|
+
state: args.state,
|
|
103
|
+
route_to: toState,
|
|
104
|
+
reason,
|
|
105
|
+
moved,
|
|
106
|
+
});
|
|
107
|
+
if (!moved) {
|
|
108
|
+
const error = 'ok' in r && r.ok === false ? r.error : 'unexpected move result';
|
|
109
|
+
deps.log.withIssue(args.entry.issue_id).emit('error', 'handoff reroute move failed', { route_to: toState, error });
|
|
110
|
+
return { error };
|
|
111
|
+
}
|
|
112
|
+
args.entry.last_transition = {
|
|
113
|
+
from_state: args.state,
|
|
114
|
+
to_state: toState,
|
|
115
|
+
notes: reason,
|
|
116
|
+
actor,
|
|
117
|
+
terminal: false,
|
|
118
|
+
rerouted: true,
|
|
119
|
+
};
|
|
120
|
+
return { error: null };
|
|
121
|
+
}
|
|
122
|
+
/** Drive the run-fold loop over the planned actions; returns the aggregated run. */
|
|
123
|
+
async function runPlanned(deps, planned, args, workspacePath) {
|
|
124
|
+
let ledger = [];
|
|
125
|
+
let routeTo = null;
|
|
126
|
+
let routeReason = null;
|
|
127
|
+
let abortReason = null;
|
|
128
|
+
for (const action of planned) {
|
|
129
|
+
const step = await runOneAction(deps, action, args, workspacePath, ledger);
|
|
130
|
+
ledger = step.ledger;
|
|
131
|
+
await drainEffects(deps, step.effects);
|
|
132
|
+
if (step.decision.kind === 'route') {
|
|
133
|
+
routeTo = step.decision.routeTo;
|
|
134
|
+
// Capture the route's own reason; summarizeRun only carries the abort reason,
|
|
135
|
+
// so without this the routed-handoff notes (and the holding-state move) would
|
|
136
|
+
// be empty (issue 235).
|
|
137
|
+
routeReason = step.decision.reason;
|
|
138
|
+
abortReason = null;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
if (step.decision.kind === 'abort') {
|
|
142
|
+
abortReason = step.decision.reason;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
// 'done' / 'retry-exhausted-into-done' — advance to the next action.
|
|
146
|
+
}
|
|
147
|
+
const run = deps.core.summarizeRun({ ledger, routeTo, abortReason });
|
|
148
|
+
return { ok: run.ok, reason: run.reason ?? routeReason, route_to: run.route_to };
|
|
149
|
+
}
|
|
150
|
+
/** Run one planned action: predicate → effects (with retry) → fold. */
|
|
151
|
+
async function runOneAction(deps, action, args, workspacePath, ledger) {
|
|
152
|
+
const nowIso = deps.clock.iso();
|
|
153
|
+
if (action.kind === 'render_failed') {
|
|
154
|
+
return deps.core.foldRenderFailed({ action: action.snapshotKey, error: action.error.message, ledger, nowIso });
|
|
155
|
+
}
|
|
156
|
+
let next = deps.core.beginAction(ledger, { resource: 'actions', action: action.snapshotKey, nowIso });
|
|
157
|
+
// ── predicate (`if:`) ───────────────────────────────────────────────────────
|
|
158
|
+
const pred = await resolvePredicate(deps, action);
|
|
159
|
+
if (pred.kind === 'error') {
|
|
160
|
+
return deps.core.foldPredicateError({ action: action.snapshotKey, error: pred.error, ledger: next, nowIso });
|
|
161
|
+
}
|
|
162
|
+
if (!pred.value) {
|
|
163
|
+
return deps.core.foldSkipped({ action: action.snapshotKey, ledger: next, nowIso });
|
|
164
|
+
}
|
|
165
|
+
// ── run the effect sequence, with retry per the action's policy ─────────────
|
|
166
|
+
let attempt = 0;
|
|
167
|
+
for (;;) {
|
|
168
|
+
const outcome = await applyAction(deps, action, args, workspacePath);
|
|
169
|
+
const fold = deps.core.foldActionOutcome({
|
|
170
|
+
action: action.snapshotKey,
|
|
171
|
+
outcome,
|
|
172
|
+
policy: action.policy,
|
|
173
|
+
attempt,
|
|
174
|
+
ledger: next,
|
|
175
|
+
nowIso: deps.clock.iso(),
|
|
176
|
+
});
|
|
177
|
+
next = fold.ledger;
|
|
178
|
+
if (fold.decision.kind !== 'retry')
|
|
179
|
+
return { ...fold, ledger: next };
|
|
180
|
+
// retry: the fold already emitted the warn + timer.sleep; drain them (the
|
|
181
|
+
// sleep is honoured through the interpreter's timer port), then re-apply.
|
|
182
|
+
await drainEffects(deps, fold.effects);
|
|
183
|
+
attempt = fold.decision.attempt;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/** Resolve the planned `if:` predicate (pure value, or run the probe effect). */
|
|
187
|
+
async function resolvePredicate(deps, action) {
|
|
188
|
+
const p = action.predicate;
|
|
189
|
+
if (p.kind === 'resolved')
|
|
190
|
+
return { kind: 'value', value: p.value };
|
|
191
|
+
if (p.kind === 'error')
|
|
192
|
+
return { kind: 'error', error: p.error.message };
|
|
193
|
+
const r = await deps.interpreter.execute(p.effect);
|
|
194
|
+
return { kind: 'value', value: deps.core.foldPredicateProbe(r) };
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Apply one action's effect sequence and reduce it to an ActionOutcome. run_in_vm
|
|
198
|
+
* is the special case (exec on the live VM); every other kind runs its git/gh/
|
|
199
|
+
* tracker effects through the central interpreter and a non-OK result is the
|
|
200
|
+
* failure reason. push_branch additionally runs its NFF force-with-lease fallback
|
|
201
|
+
* when the primary push rejects non-fast-forward.
|
|
202
|
+
*/
|
|
203
|
+
async function applyAction(deps, action, args, workspacePath) {
|
|
204
|
+
if (action.actionKind === 'run_in_vm')
|
|
205
|
+
return applyRunInVm(deps, action, args, workspacePath);
|
|
206
|
+
const isPush = action.actionKind === 'push_branch';
|
|
207
|
+
const primary = await runEffectSequence(deps, action.effects, isPush);
|
|
208
|
+
if (primary.kind === 'fail')
|
|
209
|
+
return { ok: false, reason: primary.reason, route_to: null };
|
|
210
|
+
// push_branch NFF recovery: re-run the fetch → rev-parse → force-with-lease
|
|
211
|
+
// sub-sequence the planner emitted, binding the resolved remote SHA into the
|
|
212
|
+
// force-push's expectedRemoteSha placeholder. The original NFF push reason rides
|
|
213
|
+
// along so a failed recovery surfaces it instead of its own masking error (227).
|
|
214
|
+
if (primary.nonFastForward && isPush && action.nffFallback) {
|
|
215
|
+
return runNffFallback(deps, action.nffFallback, primary.pushReason);
|
|
216
|
+
}
|
|
217
|
+
return { ok: true, reason: null, route_to: null };
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Run a git/gh/tracker effect sequence through the interpreter, stopping on the
|
|
221
|
+
* first failure — except a non-fast-forward push under `pushTolerant`, which is
|
|
222
|
+
* recovered by the caller's NFF fallback rather than failing here.
|
|
223
|
+
*/
|
|
224
|
+
async function runEffectSequence(deps, effects, pushTolerant) {
|
|
225
|
+
let nonFastForward = false;
|
|
226
|
+
let pushReason = null;
|
|
227
|
+
for (const effect of effects) {
|
|
228
|
+
const r = await deps.interpreter.execute(effect);
|
|
229
|
+
if ('kind' in r && r.kind === 'git_status' && r.nonFastForward) {
|
|
230
|
+
nonFastForward = true;
|
|
231
|
+
// Capture the real push stderr so the NFF fallback can surface it if its own
|
|
232
|
+
// fetch→force recovery later fails — rather than masking it (227).
|
|
233
|
+
pushReason = runResultReason(r.result, 'non-fast-forward push rejected');
|
|
234
|
+
}
|
|
235
|
+
const reason = failureReason(r);
|
|
236
|
+
if (reason !== null && !(nonFastForward && pushTolerant))
|
|
237
|
+
return { kind: 'fail', reason };
|
|
238
|
+
}
|
|
239
|
+
return { kind: 'ok', nonFastForward, pushReason };
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* push_branch non-fast-forward recovery: fetch → rev-parse → force-with-lease.
|
|
243
|
+
* If the recovery itself fails (e.g. the fetch can't find the remote ref because
|
|
244
|
+
* the push never landed), surface the ORIGINAL push reason — the message the
|
|
245
|
+
* operator must act on — instead of masking it with the recovery's own error (227).
|
|
246
|
+
*/
|
|
247
|
+
async function runNffFallback(deps, fallback, originalPushReason) {
|
|
248
|
+
let expectedSha = '';
|
|
249
|
+
for (const effect of fallback) {
|
|
250
|
+
const bound = bindExpectedSha(effect, expectedSha);
|
|
251
|
+
const r = await deps.interpreter.execute(bound);
|
|
252
|
+
if ('kind' in r && r.kind === 'rev_parse')
|
|
253
|
+
expectedSha = r.sha ?? '';
|
|
254
|
+
const reason = failureReason(r);
|
|
255
|
+
if (reason !== null)
|
|
256
|
+
return { ok: false, reason: originalPushReason ?? reason, route_to: null };
|
|
257
|
+
}
|
|
258
|
+
return { ok: true, reason: null, route_to: null };
|
|
259
|
+
}
|
|
260
|
+
/** Substitute the rev-parse SHA into a push_force_with_lease effect placeholder. */
|
|
261
|
+
function bindExpectedSha(effect, sha) {
|
|
262
|
+
if (effect.family === 'git' && effect.kind === 'push_force_with_lease') {
|
|
263
|
+
return { ...effect, expectedRemoteSha: sha };
|
|
264
|
+
}
|
|
265
|
+
return effect;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Run a `run_in_vm` action: exec the rendered command on the live per-issue VM
|
|
269
|
+
* (phase 8 keeps it alive) and map the exit code to the ActionOutcome. Uncached —
|
|
270
|
+
* every dispatch re-execs.
|
|
271
|
+
*/
|
|
272
|
+
async function applyRunInVm(deps, action, args, workspacePath) {
|
|
273
|
+
const a = action.rendered;
|
|
274
|
+
const env = a.env ?? {};
|
|
275
|
+
if (!args.vm)
|
|
276
|
+
return { ok: false, reason: `run_in_vm "${a.name}" has no live VM`, route_to: null };
|
|
277
|
+
const timeoutMs = a.timeout !== undefined ? a.timeout * 1000 : deps.defaultCommandTimeoutMs ?? DEFAULT_COMMAND_TIMEOUT_MS;
|
|
278
|
+
const exec = await execOnVm(args.vm, { name: a.name, cmd: a.cmd, env, workdir: workspacePath, timeoutMs }, deps, args.entry);
|
|
279
|
+
if (exec.exit_code === 0)
|
|
280
|
+
return { ok: true, reason: null, route_to: null };
|
|
281
|
+
return { ok: false, reason: `run_in_vm "${a.name}" exited ${exec.exit_code ?? 'signal'}`, route_to: null };
|
|
282
|
+
}
|
|
283
|
+
/** Exec one run_in_vm command on the live VM, capturing bounded stdout/stderr. */
|
|
284
|
+
function execOnVm(vm, cmd, deps, entry) {
|
|
285
|
+
return new Promise((resolve) => {
|
|
286
|
+
let stream;
|
|
287
|
+
try {
|
|
288
|
+
stream = vm.exec({ command: cmd.cmd, workdir: cmd.workdir, env: cmd.env, timeoutMs: cmd.timeoutMs });
|
|
289
|
+
}
|
|
290
|
+
catch (err) {
|
|
291
|
+
resolve({ exit_code: null, stdout: '', stderr: err.message });
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
stream.stdin.end();
|
|
296
|
+
}
|
|
297
|
+
catch { /* idempotent */ }
|
|
298
|
+
// Accumulate stdout/stderr uniformly (capped) + mirror each chunk to the run log.
|
|
299
|
+
const acc = { stdout: '', stderr: '' };
|
|
300
|
+
for (const ch of ['stdout', 'stderr']) {
|
|
301
|
+
stream[ch].setEncoding('utf8');
|
|
302
|
+
stream[ch].on('data', (chunk) => {
|
|
303
|
+
acc[ch] = capture(acc[ch], chunk);
|
|
304
|
+
deps.runlog.record(entry.issue_id, { channel: 'hook', hook: `run_in_vm:${cmd.name}`, stream: ch, text: chunk });
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
const timer = setTimeout(() => { try {
|
|
308
|
+
stream.kill();
|
|
309
|
+
}
|
|
310
|
+
catch { /* idempotent */ } }, cmd.timeoutMs);
|
|
311
|
+
stream.exit.then(({ code }) => { clearTimeout(timer); resolve({ exit_code: code, ...acc }); }, (err) => { clearTimeout(timer); resolve({ exit_code: null, stdout: acc.stdout, stderr: acc.stderr || err.message }); });
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function capture(acc, chunk) {
|
|
315
|
+
const next = acc + chunk;
|
|
316
|
+
return next.length > STDIO_CAPTURE_LIMIT ? next.slice(0, STDIO_CAPTURE_LIMIT) : next;
|
|
317
|
+
}
|
|
318
|
+
/** Drain a fold step's emitted effects (warn logs + timer.sleep) through the interpreter. */
|
|
319
|
+
async function drainEffects(deps, effects) {
|
|
320
|
+
for (const effect of effects)
|
|
321
|
+
await deps.interpreter.execute(effect).catch(() => undefined);
|
|
322
|
+
}
|
|
323
|
+
/** A non-OK EffectResult → its failure reason; null when the effect succeeded. */
|
|
324
|
+
function failureReason(r) {
|
|
325
|
+
if ('ok' in r && r.ok === false)
|
|
326
|
+
return r.error;
|
|
327
|
+
if (!('kind' in r))
|
|
328
|
+
return null;
|
|
329
|
+
if (r.kind === 'run_result' && r.result.exit_code !== 0)
|
|
330
|
+
return runResultReason(r.result, `exit ${r.result.exit_code}`);
|
|
331
|
+
if (r.kind === 'git_status' && !r.clean && !r.nonFastForward)
|
|
332
|
+
return runResultReason(r.result, 'git command failed');
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
/** Pick the best human-facing reason off a captured RunResultData. */
|
|
336
|
+
function runResultReason(result, fallback) {
|
|
337
|
+
return result.stderr.trim() || result.stdout.trim() || fallback;
|
|
338
|
+
}
|
|
339
|
+
/** Project a live RunningEntry into the read-only view the core context wants.
|
|
340
|
+
* workspace_path is overridden with the live path; active_tool_call_count is
|
|
341
|
+
* derived from the live Set; every other field is a verbatim copy. */
|
|
342
|
+
function toView(entry, workspacePath) {
|
|
343
|
+
return {
|
|
344
|
+
issue_id: entry.issue_id, identifier: entry.identifier, issue: entry.issue, session_id: entry.session_id,
|
|
345
|
+
workspace_path: workspacePath, started_at: entry.started_at, turn_count: entry.turn_count,
|
|
346
|
+
retry_attempt: entry.retry_attempt, input_tokens: entry.input_tokens, output_tokens: entry.output_tokens,
|
|
347
|
+
total_tokens: entry.total_tokens, last_event: entry.last_event, last_event_at: entry.last_event_at,
|
|
348
|
+
last_message: entry.last_message, recent_events: entry.recent_events, last_error: entry.last_error,
|
|
349
|
+
transitioned: entry.transitioned, steering_requested: entry.steering_requested,
|
|
350
|
+
steering_question: entry.steering_question, steering_context: entry.steering_context,
|
|
351
|
+
active_tool_call_count: entry.active_tool_calls.size, resolved_actor: entry.resolved_actor,
|
|
352
|
+
base_branch_at_dispatch: entry.base_branch_at_dispatch, github_repo_at_dispatch: entry.github_repo_at_dispatch,
|
|
353
|
+
tracker_root_at_dispatch: entry.tracker_root_at_dispatch, cleanup_workspace_on_exit: entry.cleanup_workspace_on_exit,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=actions-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions-runner.js","sourceRoot":"","sources":["../../../src/shell/actions-runner.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,qEAAqE;AACrE,kFAAkF;AAClF,kFAAkF;AAClF,mFAAmF;AACnF,oFAAoF;AACpF,EAAE;AACF,mFAAmF;AACnF,oFAAoF;A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AAE,aAAqB;IACxD,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU;QACxG,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU;QACzF,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa;QACxG,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa;QAClG,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU;QAClG,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC9E,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACpF,sBAAsB,EAAE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc;QAC1F,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,KAAK,CAAC,uBAAuB;QAC9G,wBAAwB,EAAE,KAAK,CAAC,wBAAwB,EAAE,yBAAyB,EAAE,KAAK,CAAC,yBAAyB;KACrH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// FCIS rewrite — the AdapterRegistry port (shell adapter).
|
|
2
|
+
//
|
|
3
|
+
// Ports the per-adapter launch PROFILES from the reference `src/agent/adapters.ts`
|
|
4
|
+
// (`ADAPTERS` / `profileFor`). A profile is data + small pure injection closures
|
|
5
|
+
// (no IO): the ACP launch argv plus the model/effort injection channels the pure
|
|
6
|
+
// core `applyRuntimeInjections` fold consumes. Credentials are NOT here (the guest
|
|
7
|
+
// holds only placeholders Gondolin substitutes at egress).
|
|
8
|
+
//
|
|
9
|
+
// Shell rule: imports from src/types/** ONLY (these are pure data profiles, but the
|
|
10
|
+
// registry is a shell value so it can live here without importing core).
|
|
11
|
+
const CLAUDE_SETTINGS_GUEST_PATH = '/root/.claude/settings.json';
|
|
12
|
+
/** The two known adapter profiles (faithful to the reference ADAPTERS record). */
|
|
13
|
+
const ADAPTERS = {
|
|
14
|
+
claude: {
|
|
15
|
+
id: 'claude',
|
|
16
|
+
binary: ['claude-agent-acp'],
|
|
17
|
+
// claude-agent-acp reads ANTHROPIC_MODEL on startup.
|
|
18
|
+
modelInjection: (model) => ({ env: { ANTHROPIC_MODEL: model } }),
|
|
19
|
+
// effortLevel rides a staged settings.json copied to /root/.claude/settings.json.
|
|
20
|
+
effortInjection: (effort) => ({
|
|
21
|
+
stagedFiles: [
|
|
22
|
+
{
|
|
23
|
+
stagedName: 'claude-settings.json',
|
|
24
|
+
content: JSON.stringify({ effortLevel: effort }),
|
|
25
|
+
guestPath: CLAUDE_SETTINGS_GUEST_PATH,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
codex: {
|
|
31
|
+
id: 'codex',
|
|
32
|
+
binary: ['codex-acp'],
|
|
33
|
+
// codex-acp config override: `-c model="<model>"` (TOML-quoted).
|
|
34
|
+
modelInjection: (model) => ({ extraArgs: ['-c', `model=${JSON.stringify(model)}`] }),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const KNOWN = new Set(Object.keys(ADAPTERS));
|
|
38
|
+
/** Build the AdapterRegistry port the runner-loop's injection phase consumes. */
|
|
39
|
+
export function createAdapterRegistry() {
|
|
40
|
+
return {
|
|
41
|
+
isKnown: (id) => KNOWN.has(id),
|
|
42
|
+
profile: (id) => ADAPTERS[id],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=adapter-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-registry.js","sourceRoot":"","sources":["../../../../src/shell/adapter/adapter-registry.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,mFAAmF;AACnF,iFAAiF;AACjF,iFAAiF;AACjF,mFAAmF;AACnF,2DAA2D;AAC3D,EAAE;AACF,oFAAoF;AACpF,yEAAyE;AAKzE,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AAEjE,kFAAkF;AAClF,MAAM,QAAQ,GAAyC;IACrD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,MAAM,EAAE,CAAC,kBAAkB,CAAC;QAC5B,qDAAqD;QACrD,cAAc,EAAE,CAAC,KAAK,EAAkB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,CAAC;QAChF,kFAAkF;QAClF,eAAe,EAAE,CAAC,MAAM,EAAmB,EAAE,CAAC,CAAC;YAC7C,WAAW,EAAE;gBACX;oBACE,UAAU,EAAE,sBAAsB;oBAClC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;oBAChD,SAAS,EAAE,0BAA0B;iBACtC;aACF;SACF,CAAC;KACH;IACD,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,WAAW,CAAC;QACrB,iEAAiE;QACjE,cAAc,EAAE,CAAC,KAAK,EAAkB,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;KACrG;CACF,CAAC;AAEF,MAAM,KAAK,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAElE,iFAAiF;AACjF,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,OAAO,EAAE,CAAC,EAAU,EAAsB,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,EAAE,CAAC,EAAgB,EAAkB,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// FCIS rewrite — deterministic-seam adapters (kind: adapter).
|
|
2
|
+
//
|
|
3
|
+
// The four SYNCHRONOUS seams the functional core consumes as injected VALUES
|
|
4
|
+
// (see src/types/ports.ts §"Deterministic seams"): Clock, RandomSource,
|
|
5
|
+
// CryptoEnv, MemProbe. Cores stay pure + synchronous by reading these through
|
|
6
|
+
// the port instead of touching `Date.now()` / `node:crypto` / `/proc/meminfo`
|
|
7
|
+
// directly; tests pin a deterministic stub in the same shape.
|
|
8
|
+
//
|
|
9
|
+
// Ported faithfully from the original src/util/clock.ts, src/util/crypto.ts,
|
|
10
|
+
// and src/memory.ts. Behaviour preserved exactly:
|
|
11
|
+
// - Clock.now = Date.now(); Clock.iso = new Date(now).toISOString()
|
|
12
|
+
// - RandomSource.newToken = randomBytes(24).toString('base64url')
|
|
13
|
+
// - CryptoEnv.constantTimeEqual = UTF-8 byte-length guard then timingSafeEqual
|
|
14
|
+
// - MemProbe.read = MemAvailable (MiB) parsed from /proc/meminfo, else null
|
|
15
|
+
import { randomBytes, timingSafeEqual } from 'node:crypto';
|
|
16
|
+
import { Buffer } from 'node:buffer';
|
|
17
|
+
import { readFileSync } from 'node:fs';
|
|
18
|
+
// ─── Clock ────────────────────────────────────────────────────────────────
|
|
19
|
+
/**
|
|
20
|
+
* Production clock: real wall clock. `iso()` formats the SAME reading via
|
|
21
|
+
* `new Date(now).toISOString()` (mirrors the original `isoFromClock`).
|
|
22
|
+
*/
|
|
23
|
+
export function systemClock() {
|
|
24
|
+
return {
|
|
25
|
+
now: () => Date.now(),
|
|
26
|
+
iso: () => new Date(Date.now()).toISOString(),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
// ─── RandomSource ───────────────────────────────────────────────────────────
|
|
30
|
+
/**
|
|
31
|
+
* Per-dispatch bearer-token mint: 24 random bytes, base64url-encoded — the
|
|
32
|
+
* exact token shape the MCP registry / per-dispatch auth depends on.
|
|
33
|
+
*/
|
|
34
|
+
export function tokenRandomSource() {
|
|
35
|
+
return {
|
|
36
|
+
newToken: () => randomBytes(24).toString('base64url'),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// ─── CryptoEnv ────────────────────────────────────────────────────────────
|
|
40
|
+
/**
|
|
41
|
+
* Production crypto seam.
|
|
42
|
+
*
|
|
43
|
+
* `constantTimeEqual` compares BYTE lengths after UTF-8 encoding, NOT JS
|
|
44
|
+
* string `.length` (UTF-16 code units). An attacker-supplied non-ASCII token
|
|
45
|
+
* can match the real token's code-unit count while encoding to a different
|
|
46
|
+
* byte length; handing those buffers to `timingSafeEqual` would throw
|
|
47
|
+
* ("Input buffers must have the same byte length") and surface as an HTTP 500
|
|
48
|
+
* instead of a clean wrong-token rejection. So we reject mismatched byte
|
|
49
|
+
* lengths up front and only equal-length pairs reach `timingSafeEqual`, whose
|
|
50
|
+
* per-byte timing therefore can't leak the matching prefix.
|
|
51
|
+
*/
|
|
52
|
+
export function nodeCryptoEnv() {
|
|
53
|
+
return {
|
|
54
|
+
constantTimeEqual: (a, b) => {
|
|
55
|
+
const aBuf = Buffer.from(a, 'utf8');
|
|
56
|
+
const bBuf = Buffer.from(b, 'utf8');
|
|
57
|
+
if (aBuf.length !== bBuf.length)
|
|
58
|
+
return false;
|
|
59
|
+
return timingSafeEqual(aBuf, bBuf);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// ─── MemProbe ─────────────────────────────────────────────────────────────
|
|
64
|
+
const PROC_MEMINFO = '/proc/meminfo';
|
|
65
|
+
/**
|
|
66
|
+
* Production memory probe — synchronously reads `/proc/meminfo` (a kernel
|
|
67
|
+
* virtual file: no disk I/O, microsecond-cheap, run once per tick). On any
|
|
68
|
+
* read or parse failure `read()` returns null so the orchestrator falls back
|
|
69
|
+
* to the static admission cap rather than dropping to zero on a transient
|
|
70
|
+
* error or on a non-Linux host (e.g. `npm test` on macOS).
|
|
71
|
+
*
|
|
72
|
+
* The `MemAvailable` parse is the PURE core decision
|
|
73
|
+
* (`core/schedule/admission.ts:parseMemAvailableMib`), injected by the
|
|
74
|
+
* composition root so this adapter only performs the `/proc` read; the shell
|
|
75
|
+
* never re-implements the parse.
|
|
76
|
+
*
|
|
77
|
+
* The original `MemorySnapshot.supported` flag is intentionally dropped: the
|
|
78
|
+
* rewrite's `MemProbe.read(): number | null` collapses
|
|
79
|
+
* "unsupported"/"unparseable" into the same null the admission decider
|
|
80
|
+
* already handles uniformly.
|
|
81
|
+
*/
|
|
82
|
+
export function nodeMemProbe(parseMemAvailableMib) {
|
|
83
|
+
return {
|
|
84
|
+
read: () => {
|
|
85
|
+
let body;
|
|
86
|
+
try {
|
|
87
|
+
body = readFileSync(PROC_MEMINFO, 'utf8');
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return parseMemAvailableMib(body);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=clock-random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock-random.js","sourceRoot":"","sources":["../../../../src/shell/adapter/clock-random.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,8EAA8E;AAC9E,8EAA8E;AAC9E,8DAA8D;AAC9D,EAAE;AACF,6EAA6E;AAC7E,kDAAkD;AAClD,uEAAuE;AACvE,oEAAoE;AACpE,iFAAiF;AACjF,8EAA8E;AAE9E,OAAO,EAAE,WAA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