agentplane 0.3.7 → 0.3.8
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/assets/AGENTS.md +11 -1
- package/assets/RUNNER.md +17 -0
- package/bin/agentplane.js +16 -7
- package/bin/framework-dev-contract.d.ts +6 -0
- package/bin/framework-dev-contract.js +13 -0
- package/bin/stale-dist-policy.js +6 -1
- package/dist/.build-manifest.json +694 -339
- package/dist/adapters/task-backend/task-backend-adapter.d.ts +3 -1
- package/dist/adapters/task-backend/task-backend-adapter.d.ts.map +1 -1
- package/dist/adapters/task-backend/task-backend-adapter.js +13 -0
- package/dist/backends/task-backend/local-backend-doc.d.ts +5 -0
- package/dist/backends/task-backend/local-backend-doc.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-doc.js +98 -0
- package/dist/backends/task-backend/local-backend-read.d.ts +7 -0
- package/dist/backends/task-backend/local-backend-read.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-read.js +186 -0
- package/dist/backends/task-backend/local-backend-state.d.ts +17 -0
- package/dist/backends/task-backend/local-backend-state.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-state.js +50 -0
- package/dist/backends/task-backend/local-backend-write.d.ts +15 -0
- package/dist/backends/task-backend/local-backend-write.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-write.js +254 -0
- package/dist/backends/task-backend/local-backend.d.ts +4 -2
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +26 -403
- package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts +40 -0
- package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-cache-doc.js +178 -0
- package/dist/backends/task-backend/redmine/backend-report.d.ts +10 -0
- package/dist/backends/task-backend/redmine/backend-report.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-report.js +43 -0
- package/dist/backends/task-backend/redmine/backend-sync.d.ts +67 -0
- package/dist/backends/task-backend/redmine/backend-sync.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync.js +367 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts +2 -1
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/mapping.js +12 -2
- package/dist/backends/task-backend/redmine/parse.d.ts +2 -1
- package/dist/backends/task-backend/redmine/parse.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/parse.js +5 -3
- package/dist/backends/task-backend/redmine/state.d.ts +2 -0
- package/dist/backends/task-backend/redmine/state.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/state.js +15 -1
- package/dist/backends/task-backend/redmine-backend.d.ts +5 -2
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +88 -536
- package/dist/backends/task-backend/shared/constants.d.ts +2 -1
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/doc.js +25 -39
- package/dist/backends/task-backend/shared/export.d.ts +2 -9
- package/dist/backends/task-backend/shared/export.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/export.js +73 -8
- package/dist/backends/task-backend/shared/normalize.d.ts +5 -1
- package/dist/backends/task-backend/shared/normalize.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/normalize.js +166 -0
- package/dist/backends/task-backend/shared/record.d.ts +1 -1
- package/dist/backends/task-backend/shared/record.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/record.js +7 -2
- package/dist/backends/task-backend/shared/types.d.ts +38 -36
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
- package/dist/backends/task-backend/shared.d.ts +2 -2
- package/dist/backends/task-backend/shared.d.ts.map +1 -1
- package/dist/backends/task-backend/shared.js +1 -1
- package/dist/backends/task-backend.d.ts +1 -1
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.js +1 -1
- package/dist/backends/task-index.d.ts +2 -2
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +9 -6
- package/dist/cli/bootstrap-guide.d.ts +2 -2
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +10 -10
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +11 -9
- package/dist/cli/command-invocations.d.ts +4 -0
- package/dist/cli/command-invocations.d.ts.map +1 -0
- package/dist/cli/command-invocations.js +35 -0
- package/dist/cli/command-snippets.d.ts +12 -8
- package/dist/cli/command-snippets.d.ts.map +1 -1
- package/dist/cli/command-snippets.js +14 -8
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +1 -0
- package/dist/cli/group-command.d.ts +18 -0
- package/dist/cli/group-command.d.ts.map +1 -0
- package/dist/cli/group-command.js +45 -0
- package/dist/cli/output.d.ts +29 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +76 -0
- package/dist/cli/prompts.d.ts.map +1 -1
- package/dist/cli/prompts.js +5 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +38 -29
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/lifecycle.js +9 -6
- package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +8 -6
- package/dist/cli/run-cli/command-catalog/shared.d.ts +12 -3
- package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/shared.js +6 -3
- package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +46 -11
- package/dist/cli/run-cli/command-catalog.d.ts +11 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog.js +29 -0
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +52 -6
- package/dist/cli/run-cli/commands/core/agent-profiles.d.ts +34 -0
- package/dist/cli/run-cli/commands/core/agent-profiles.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/agent-profiles.js +97 -0
- package/dist/cli/run-cli/commands/core/agents.d.ts +7 -0
- package/dist/cli/run-cli/commands/core/agents.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/agents.js +97 -0
- package/dist/cli/run-cli/commands/core/preflight.d.ts +10 -0
- package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/preflight.js +286 -0
- package/dist/cli/run-cli/commands/core/quickstart.d.ts +8 -0
- package/dist/cli/run-cli/commands/core/quickstart.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/quickstart.js +43 -0
- package/dist/cli/run-cli/commands/core/role.d.ts +9 -0
- package/dist/cli/run-cli/commands/core/role.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/role.js +128 -0
- package/dist/cli/run-cli/commands/core.d.ts +4 -24
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core.js +4 -630
- package/dist/cli/run-cli/error-guidance.js +10 -0
- package/dist/cli/run-cli/globals.d.ts +5 -2
- package/dist/cli/run-cli/globals.d.ts.map +1 -1
- package/dist/cli/run-cli/globals.js +82 -86
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +137 -100
- package/dist/cli/run-cli.test-helpers.d.ts +21 -0
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +88 -4
- package/dist/cli/spec/help.d.ts +10 -2
- package/dist/cli/spec/help.d.ts.map +1 -1
- package/dist/cli/spec/help.js +7 -5
- package/dist/cli/spec/registry.d.ts +27 -1
- package/dist/cli/spec/registry.d.ts.map +1 -1
- package/dist/cli/spec/registry.js +98 -25
- package/dist/commands/backend/sync.command.d.ts +3 -5
- package/dist/commands/backend/sync.command.d.ts.map +1 -1
- package/dist/commands/backend/sync.command.js +9 -12
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +8 -7
- package/dist/commands/branch/base.command.d.ts +2 -3
- package/dist/commands/branch/base.command.d.ts.map +1 -1
- package/dist/commands/branch/base.command.js +8 -12
- package/dist/commands/branch/base.d.ts.map +1 -1
- package/dist/commands/branch/base.js +11 -7
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +9 -8
- package/dist/commands/branch/remove.d.ts.map +1 -1
- package/dist/commands/branch/remove.js +4 -3
- package/dist/commands/branch/status.d.ts.map +1 -1
- package/dist/commands/branch/status.js +4 -3
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +48 -5
- package/dist/commands/cleanup/merged.command.d.ts +2 -3
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
- package/dist/commands/cleanup/merged.command.js +8 -12
- package/dist/commands/docs/cli.command.js +2 -2
- package/dist/commands/doctor/runtime.js +1 -1
- package/dist/commands/doctor/workflow.d.ts.map +1 -1
- package/dist/commands/doctor/workflow.js +10 -1
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +7 -0
- package/dist/commands/guard/guard.command.d.ts +3 -3
- package/dist/commands/guard/guard.command.d.ts.map +1 -1
- package/dist/commands/guard/guard.command.js +9 -14
- package/dist/commands/guard/impl/commands.d.ts +2 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +55 -7
- package/dist/commands/guard/impl/policy.d.ts +1 -0
- package/dist/commands/guard/impl/policy.d.ts.map +1 -1
- package/dist/commands/guard/impl/policy.js +9 -6
- package/dist/commands/hooks/hooks.command.d.ts +3 -3
- package/dist/commands/hooks/hooks.command.d.ts.map +1 -1
- package/dist/commands/hooks/hooks.command.js +9 -11
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +90 -18
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +31 -3
- package/dist/commands/pr/integrate/internal/cleanup.d.ts +12 -0
- package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/cleanup.js +46 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts +4 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +34 -40
- package/dist/commands/pr/integrate/internal/merge.d.ts +6 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +92 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +1 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +1 -0
- package/dist/commands/pr/integrate/verify.d.ts.map +1 -1
- package/dist/commands/pr/integrate/verify.js +4 -3
- package/dist/commands/pr/note.d.ts.map +1 -1
- package/dist/commands/pr/note.js +3 -2
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +9 -12
- package/dist/commands/pr/pr.command.d.ts +3 -4
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +6 -11
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +5 -10
- package/dist/commands/recipes/cache.command.d.ts +3 -4
- package/dist/commands/recipes/cache.command.d.ts.map +1 -1
- package/dist/commands/recipes/cache.command.js +8 -26
- package/dist/commands/recipes/impl/apply.d.ts +1 -1
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
- package/dist/commands/recipes/impl/apply.js +1 -1
- package/dist/commands/recipes/impl/commands/explain.js +1 -1
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +1 -2
- package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.js +1 -2
- package/dist/commands/recipes/impl/manifest.d.ts.map +1 -1
- package/dist/commands/recipes/impl/manifest.js +0 -10
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.js +1 -2
- package/dist/commands/recipes/impl/resolver.d.ts +1 -1
- package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
- package/dist/commands/recipes/impl/resolver.js +26 -16
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
- package/dist/commands/recipes/impl/scenario.js +80 -0
- package/dist/commands/recipes/impl/types.d.ts +27 -13
- package/dist/commands/recipes/impl/types.d.ts.map +1 -1
- package/dist/commands/recipes/recipes.command.d.ts +3 -4
- package/dist/commands/recipes/recipes.command.d.ts.map +1 -1
- package/dist/commands/recipes/recipes.command.js +8 -34
- package/dist/commands/recipes.d.ts +4 -4
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +3 -3
- package/dist/commands/recipes.test-helpers.d.ts +17 -0
- package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
- package/dist/commands/recipes.test-helpers.js +56 -2
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +77 -56
- package/dist/commands/release/plan.command.d.ts.map +1 -1
- package/dist/commands/release/plan.command.js +7 -3
- package/dist/commands/release/release.command.d.ts +3 -3
- package/dist/commands/release/release.command.d.ts.map +1 -1
- package/dist/commands/release/release.command.js +9 -11
- package/dist/commands/release.test-helpers.d.ts +20 -0
- package/dist/commands/release.test-helpers.d.ts.map +1 -0
- package/dist/commands/release.test-helpers.js +37 -0
- package/dist/commands/runtime.command.d.ts +7 -7
- package/dist/commands/runtime.command.d.ts.map +1 -1
- package/dist/commands/runtime.command.js +29 -33
- package/dist/commands/scenario/execute.command.d.ts +8 -0
- package/dist/commands/scenario/execute.command.d.ts.map +1 -0
- package/dist/commands/scenario/execute.command.js +117 -0
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.js +45 -32
- package/dist/commands/scenario/run.command.js +2 -2
- package/dist/commands/scenario/scenario.command.d.ts +3 -4
- package/dist/commands/scenario/scenario.command.d.ts.map +1 -1
- package/dist/commands/scenario/scenario.command.js +8 -26
- package/dist/commands/shared/git-context.d.ts +1 -0
- package/dist/commands/shared/git-context.d.ts.map +1 -1
- package/dist/commands/shared/git-context.js +4 -2
- package/dist/commands/shared/git-ops.d.ts +1 -0
- package/dist/commands/shared/git-ops.d.ts.map +1 -1
- package/dist/commands/shared/git-ops.js +13 -0
- package/dist/commands/shared/operator-pipeline.d.ts +10 -0
- package/dist/commands/shared/operator-pipeline.d.ts.map +1 -0
- package/dist/commands/shared/operator-pipeline.js +16 -0
- package/dist/commands/shared/pr-meta.d.ts +32 -12
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +49 -14
- package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
- package/dist/commands/shared/reconcile-check.js +28 -3
- package/dist/commands/shared/task-backend.d.ts +10 -6
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +99 -25
- package/dist/commands/shared/task-handoff.d.ts +64 -0
- package/dist/commands/shared/task-handoff.d.ts.map +1 -0
- package/dist/commands/shared/task-handoff.js +151 -0
- package/dist/commands/shared/task-mutation.d.ts +36 -0
- package/dist/commands/shared/task-mutation.d.ts.map +1 -0
- package/dist/commands/shared/task-mutation.js +67 -0
- package/dist/commands/shared/task-store.d.ts +5 -1
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +72 -92
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +41 -39
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +31 -110
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +0 -7
- package/dist/commands/task/close-noop.d.ts.map +1 -1
- package/dist/commands/task/close-noop.js +0 -21
- package/dist/commands/task/close-shared.d.ts +0 -2
- package/dist/commands/task/close-shared.d.ts.map +1 -1
- package/dist/commands/task/close-shared.js +25 -55
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +48 -37
- package/dist/commands/task/derive.d.ts.map +1 -1
- package/dist/commands/task/derive.js +14 -7
- package/dist/commands/task/doc.command.d.ts.map +1 -1
- package/dist/commands/task/doc.command.js +7 -6
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +58 -62
- package/dist/commands/task/finish-shared.d.ts +60 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -0
- package/dist/commands/task/finish-shared.js +181 -0
- package/dist/commands/task/finish.d.ts +1 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +79 -210
- package/dist/commands/task/handoff-record.command.d.ts +17 -0
- package/dist/commands/task/handoff-record.command.d.ts.map +1 -0
- package/dist/commands/task/handoff-record.command.js +140 -0
- package/dist/commands/task/handoff-show.command.d.ts +8 -0
- package/dist/commands/task/handoff-show.command.d.ts.map +1 -0
- package/dist/commands/task/handoff-show.command.js +77 -0
- package/dist/commands/task/handoff.command.d.ts +7 -0
- package/dist/commands/task/handoff.command.d.ts.map +1 -0
- package/dist/commands/task/handoff.command.js +21 -0
- package/dist/commands/task/handoff.shared.d.ts +39 -0
- package/dist/commands/task/handoff.shared.d.ts.map +1 -0
- package/dist/commands/task/handoff.shared.js +134 -0
- package/dist/commands/task/hosted-close.command.d.ts +9 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -0
- package/dist/commands/task/hosted-close.command.js +190 -0
- package/dist/commands/task/hosted-merge-sync.d.ts +40 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync.js +277 -0
- package/dist/commands/task/list.d.ts.map +1 -1
- package/dist/commands/task/list.js +7 -24
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +26 -6
- package/dist/commands/task/next.d.ts.map +1 -1
- package/dist/commands/task/next.js +10 -28
- package/dist/commands/task/normalize.command.d.ts +1 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -1
- package/dist/commands/task/normalize.command.js +12 -0
- package/dist/commands/task/normalize.d.ts +1 -0
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +21 -9
- package/dist/commands/task/plan.command.d.ts +3 -4
- package/dist/commands/task/plan.command.d.ts.map +1 -1
- package/dist/commands/task/plan.command.js +6 -12
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +96 -103
- package/dist/commands/task/reclaim.command.d.ts +11 -0
- package/dist/commands/task/reclaim.command.d.ts.map +1 -0
- package/dist/commands/task/reclaim.command.js +102 -0
- package/dist/commands/task/resume-context.command.d.ts +9 -0
- package/dist/commands/task/resume-context.command.d.ts.map +1 -0
- package/dist/commands/task/resume-context.command.js +60 -0
- package/dist/commands/task/run-cancel.command.d.ts +6 -0
- package/dist/commands/task/run-cancel.command.d.ts.map +1 -0
- package/dist/commands/task/run-cancel.command.js +45 -0
- package/dist/commands/task/run-cancel.spec.d.ts +7 -0
- package/dist/commands/task/run-cancel.spec.d.ts.map +1 -0
- package/dist/commands/task/run-cancel.spec.js +20 -0
- package/dist/commands/task/run-resume.command.d.ts +6 -0
- package/dist/commands/task/run-resume.command.d.ts.map +1 -0
- package/dist/commands/task/run-resume.command.js +55 -0
- package/dist/commands/task/run-resume.spec.d.ts +7 -0
- package/dist/commands/task/run-resume.spec.d.ts.map +1 -0
- package/dist/commands/task/run-resume.spec.js +20 -0
- package/dist/commands/task/run-retry.command.d.ts +6 -0
- package/dist/commands/task/run-retry.command.d.ts.map +1 -0
- package/dist/commands/task/run-retry.command.js +56 -0
- package/dist/commands/task/run-retry.spec.d.ts +7 -0
- package/dist/commands/task/run-retry.spec.d.ts.map +1 -0
- package/dist/commands/task/run-retry.spec.js +20 -0
- package/dist/commands/task/run-show.command.d.ts +6 -0
- package/dist/commands/task/run-show.command.d.ts.map +1 -0
- package/dist/commands/task/run-show.command.js +133 -0
- package/dist/commands/task/run-show.spec.d.ts +8 -0
- package/dist/commands/task/run-show.spec.d.ts.map +1 -0
- package/dist/commands/task/run-show.spec.js +44 -0
- package/dist/commands/task/run-tail.command.d.ts +6 -0
- package/dist/commands/task/run-tail.command.d.ts.map +1 -0
- package/dist/commands/task/run-tail.command.js +26 -0
- package/dist/commands/task/run-tail.spec.d.ts +8 -0
- package/dist/commands/task/run-tail.spec.d.ts.map +1 -0
- package/dist/commands/task/run-tail.spec.js +51 -0
- package/dist/commands/task/run-trace.command.d.ts +6 -0
- package/dist/commands/task/run-trace.command.d.ts.map +1 -0
- package/dist/commands/task/run-trace.command.js +25 -0
- package/dist/commands/task/run-trace.spec.d.ts +7 -0
- package/dist/commands/task/run-trace.spec.d.ts.map +1 -0
- package/dist/commands/task/run-trace.spec.js +31 -0
- package/dist/commands/task/run.command.d.ts +6 -0
- package/dist/commands/task/run.command.d.ts.map +1 -0
- package/dist/commands/task/run.command.js +74 -0
- package/dist/commands/task/run.spec.d.ts +7 -0
- package/dist/commands/task/run.spec.d.ts.map +1 -0
- package/dist/commands/task/run.spec.js +26 -0
- package/dist/commands/task/scaffold.d.ts.map +1 -1
- package/dist/commands/task/scaffold.js +4 -2
- package/dist/commands/task/scrub.d.ts.map +1 -1
- package/dist/commands/task/scrub.js +27 -24
- package/dist/commands/task/search.d.ts.map +1 -1
- package/dist/commands/task/search.js +21 -31
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +36 -152
- package/dist/commands/task/shared/dependencies.d.ts +4 -4
- package/dist/commands/task/shared/dependencies.d.ts.map +1 -1
- package/dist/commands/task/shared/dependencies.js +10 -2
- package/dist/commands/task/shared/docs.d.ts +6 -1
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +13 -0
- package/dist/commands/task/shared/listing.d.ts +16 -2
- package/dist/commands/task/shared/listing.d.ts.map +1 -1
- package/dist/commands/task/shared/listing.js +56 -0
- package/dist/commands/task/shared/transition-command.d.ts +15 -0
- package/dist/commands/task/shared/transition-command.d.ts.map +1 -0
- package/dist/commands/task/shared/transition-command.js +43 -0
- package/dist/commands/task/shared/transitions.d.ts +39 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +62 -1
- package/dist/commands/task/shared/workflow-transition-service.d.ts +75 -0
- package/dist/commands/task/shared/workflow-transition-service.d.ts.map +1 -0
- package/dist/commands/task/shared/workflow-transition-service.js +226 -0
- package/dist/commands/task/shared.d.ts +5 -3
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +5 -3
- package/dist/commands/task/show.d.ts.map +1 -1
- package/dist/commands/task/show.js +37 -3
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +33 -119
- package/dist/commands/task/task.command.d.ts +3 -4
- package/dist/commands/task/task.command.d.ts.map +1 -1
- package/dist/commands/task/task.command.js +22 -37
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +16 -141
- package/dist/commands/task/verify.command.d.ts.map +1 -1
- package/dist/commands/task/verify.command.js +7 -6
- package/dist/commands/task.test-helpers.d.ts +13 -0
- package/dist/commands/task.test-helpers.d.ts.map +1 -0
- package/dist/commands/task.test-helpers.js +65 -0
- package/dist/commands/upgrade/materialize.d.ts +28 -0
- package/dist/commands/upgrade/materialize.d.ts.map +1 -0
- package/dist/commands/upgrade/materialize.js +154 -0
- package/dist/commands/upgrade/plan.d.ts +18 -0
- package/dist/commands/upgrade/plan.d.ts.map +1 -0
- package/dist/commands/upgrade/plan.js +219 -0
- package/dist/commands/upgrade/policy.d.ts +24 -0
- package/dist/commands/upgrade/policy.d.ts.map +1 -0
- package/dist/commands/upgrade/policy.js +182 -0
- package/dist/commands/upgrade/report.d.ts.map +1 -1
- package/dist/commands/upgrade/report.js +7 -5
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +154 -642
- package/dist/commands/workflow.command.d.ts +3 -4
- package/dist/commands/workflow.command.d.ts.map +1 -1
- package/dist/commands/workflow.command.js +8 -25
- package/dist/ports/task-backend-port.d.ts +3 -1
- package/dist/ports/task-backend-port.d.ts.map +1 -1
- package/dist/runner/adapters/codex.d.ts +9 -0
- package/dist/runner/adapters/codex.d.ts.map +1 -0
- package/dist/runner/adapters/codex.js +414 -0
- package/dist/runner/adapters/custom.d.ts +12 -0
- package/dist/runner/adapters/custom.d.ts.map +1 -0
- package/dist/runner/adapters/custom.js +512 -0
- package/dist/runner/adapters/index.d.ts +8 -0
- package/dist/runner/adapters/index.d.ts.map +1 -0
- package/dist/runner/adapters/index.js +15 -0
- package/dist/runner/adapters/recipe-run-profile.d.ts +8 -0
- package/dist/runner/adapters/recipe-run-profile.d.ts.map +1 -0
- package/dist/runner/adapters/recipe-run-profile.js +53 -0
- package/dist/runner/adapters/shared.d.ts +45 -0
- package/dist/runner/adapters/shared.d.ts.map +1 -0
- package/dist/runner/adapters/shared.js +58 -0
- package/dist/runner/artifacts.d.ts +31 -0
- package/dist/runner/artifacts.d.ts.map +1 -0
- package/dist/runner/artifacts.js +153 -0
- package/dist/runner/codex-approval-probe.d.ts +23 -0
- package/dist/runner/codex-approval-probe.d.ts.map +1 -0
- package/dist/runner/codex-approval-probe.js +55 -0
- package/dist/runner/codex-smoke.d.ts +11 -0
- package/dist/runner/codex-smoke.d.ts.map +1 -0
- package/dist/runner/codex-smoke.js +45 -0
- package/dist/runner/config.d.ts +6 -0
- package/dist/runner/config.d.ts.map +1 -0
- package/dist/runner/config.js +15 -0
- package/dist/runner/context/base-prompts.d.ts +10 -0
- package/dist/runner/context/base-prompts.d.ts.map +1 -0
- package/dist/runner/context/base-prompts.js +255 -0
- package/dist/runner/context/recipe-context.d.ts +17 -0
- package/dist/runner/context/recipe-context.d.ts.map +1 -0
- package/dist/runner/context/recipe-context.js +48 -0
- package/dist/runner/context/task-context.d.ts +24 -0
- package/dist/runner/context/task-context.d.ts.map +1 -0
- package/dist/runner/context/task-context.js +266 -0
- package/dist/runner/index.d.ts +12 -0
- package/dist/runner/index.d.ts.map +1 -0
- package/dist/runner/index.js +11 -0
- package/dist/runner/policy-decision.d.ts +12 -0
- package/dist/runner/policy-decision.d.ts.map +1 -0
- package/dist/runner/policy-decision.js +89 -0
- package/dist/runner/policy-display.d.ts +4 -0
- package/dist/runner/policy-display.d.ts.map +1 -0
- package/dist/runner/policy-display.js +41 -0
- package/dist/runner/process-supervision.d.ts +48 -0
- package/dist/runner/process-supervision.d.ts.map +1 -0
- package/dist/runner/process-supervision.js +490 -0
- package/dist/runner/result-manifest-policy.d.ts +9 -0
- package/dist/runner/result-manifest-policy.d.ts.map +1 -0
- package/dist/runner/result-manifest-policy.js +96 -0
- package/dist/runner/result-manifest.d.ts +30 -0
- package/dist/runner/result-manifest.d.ts.map +1 -0
- package/dist/runner/result-manifest.js +322 -0
- package/dist/runner/run-id.d.ts +2 -0
- package/dist/runner/run-id.d.ts.map +1 -0
- package/dist/runner/run-id.js +3 -0
- package/dist/runner/run-repository.d.ts +51 -0
- package/dist/runner/run-repository.d.ts.map +1 -0
- package/dist/runner/run-repository.js +222 -0
- package/dist/runner/task-run-paths.d.ts +19 -0
- package/dist/runner/task-run-paths.d.ts.map +1 -0
- package/dist/runner/task-run-paths.js +25 -0
- package/dist/runner/task-state.d.ts +9 -0
- package/dist/runner/task-state.d.ts.map +1 -0
- package/dist/runner/task-state.js +354 -0
- package/dist/runner/test-helpers.d.ts +30 -0
- package/dist/runner/test-helpers.d.ts.map +1 -0
- package/dist/runner/test-helpers.js +97 -0
- package/dist/runner/trace-artifacts.d.ts +14 -0
- package/dist/runner/trace-artifacts.d.ts.map +1 -0
- package/dist/runner/trace-artifacts.js +80 -0
- package/dist/runner/trace.d.ts +10 -0
- package/dist/runner/trace.d.ts.map +1 -0
- package/dist/runner/trace.js +37 -0
- package/dist/runner/types.d.ts +317 -0
- package/dist/runner/types.d.ts.map +1 -0
- package/dist/runner/types.js +3 -0
- package/dist/runner/usecases/scenario-materialize-task.d.ts +29 -0
- package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -0
- package/dist/runner/usecases/scenario-materialize-task.js +151 -0
- package/dist/runner/usecases/task-run-inspect.d.ts +41 -0
- package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-inspect.js +74 -0
- package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts +10 -0
- package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle-cancel.js +172 -0
- package/dist/runner/usecases/task-run-lifecycle-replay.d.ts +18 -0
- package/dist/runner/usecases/task-run-lifecycle-replay.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle-replay.js +128 -0
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts +45 -0
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle-shared.js +172 -0
- package/dist/runner/usecases/task-run-lifecycle.d.ts +4 -0
- package/dist/runner/usecases/task-run-lifecycle.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle.js +2 -0
- package/dist/runner/usecases/task-run.d.ts +32 -0
- package/dist/runner/usecases/task-run.d.ts.map +1 -0
- package/dist/runner/usecases/task-run.js +278 -0
- package/dist/shared/agent-emoji.d.ts.map +1 -1
- package/dist/shared/agent-emoji.js +1 -0
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/guards.d.ts.map +1 -1
- package/dist/shared/guards.js +1 -0
- package/dist/shared/repo-cli-version.d.ts.map +1 -1
- package/dist/shared/repo-cli-version.js +7 -5
- package/dist/shared/task-doc-conflicts.d.ts +12 -0
- package/dist/shared/task-doc-conflicts.d.ts.map +1 -0
- package/dist/shared/task-doc-conflicts.js +40 -0
- package/dist/shared/task-doc-state.d.ts +10 -0
- package/dist/shared/task-doc-state.d.ts.map +1 -0
- package/dist/shared/task-doc-state.js +15 -0
- package/dist/test-helpers/fs.d.ts +2 -0
- package/dist/test-helpers/fs.d.ts.map +1 -0
- package/dist/test-helpers/fs.js +9 -0
- package/dist/usecases/context/resolve-context.d.ts +2 -0
- package/dist/usecases/context/resolve-context.d.ts.map +1 -1
- package/dist/usecases/context/resolve-context.js +4 -1
- package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
- package/dist/usecases/task/task-list-usecase.js +2 -8
- package/dist/workflow-runtime/fix.d.ts +9 -1
- package/dist/workflow-runtime/fix.d.ts.map +1 -1
- package/dist/workflow-runtime/fix.js +9 -1
- package/package.json +3 -2
- package/dist/backends/task-backend.test-helpers.d.ts +0 -4
- package/dist/backends/task-backend.test-helpers.d.ts.map +0 -1
- package/dist/backends/task-backend.test-helpers.js +0 -33
- package/dist/cli/run-cli/catalog.d.ts +0 -7
- package/dist/cli/run-cli/catalog.d.ts.map +0 -1
- package/dist/cli/run-cli/catalog.js +0 -22
- package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts +0 -3
- package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts.map +0 -1
- package/dist/cli/run-cli.core.pr-flow.test-helpers.js +0 -41
- package/dist/cli/run-cli.core.tasks.test-helpers.d.ts +0 -2
- package/dist/cli/run-cli.core.tasks.test-helpers.d.ts.map +0 -1
- package/dist/cli/run-cli.core.tasks.test-helpers.js +0 -6
- package/dist/commands/block.command.d.ts +0 -4
- package/dist/commands/block.command.d.ts.map +0 -1
- package/dist/commands/block.command.js +0 -2
- package/dist/commands/doctor.command.d.ts +0 -3
- package/dist/commands/doctor.command.d.ts.map +0 -1
- package/dist/commands/doctor.command.js +0 -2
- package/dist/commands/finish.command.d.ts +0 -4
- package/dist/commands/finish.command.d.ts.map +0 -1
- package/dist/commands/finish.command.js +0 -2
- package/dist/commands/recipes/install.command.d.ts +0 -3
- package/dist/commands/recipes/install.command.d.ts.map +0 -1
- package/dist/commands/recipes/install.command.js +0 -2
- package/dist/commands/start.command.d.ts +0 -4
- package/dist/commands/start.command.d.ts.map +0 -1
- package/dist/commands/start.command.js +0 -2
- package/dist/commands/task/list.command.d.ts +0 -4
- package/dist/commands/task/list.command.d.ts.map +0 -1
- package/dist/commands/task/list.command.js +0 -2
- package/dist/commands/task/next.command.d.ts +0 -4
- package/dist/commands/task/next.command.d.ts.map +0 -1
- package/dist/commands/task/next.command.js +0 -2
- package/dist/commands/task/search.command.d.ts +0 -4
- package/dist/commands/task/search.command.d.ts.map +0 -1
- package/dist/commands/task/search.command.js +0 -2
- package/dist/commands/task/show.command.d.ts +0 -4
- package/dist/commands/task/show.command.d.ts.map +0 -1
- package/dist/commands/task/show.command.js +0 -2
- package/dist/commands/verify.command.d.ts +0 -4
- package/dist/commands/verify.command.d.ts.map +0 -1
- package/dist/commands/verify.command.js +0 -2
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { setMarkdownSection } from "@agentplaneorg/core";
|
|
3
|
+
import { loadCommandContext } from "../../commands/shared/task-backend.js";
|
|
4
|
+
import { TASK_DOC_VERSION_V3, buildDefaultVerifyStepsSection, defaultTaskDocV3, } from "../../commands/task/doc-template.js";
|
|
5
|
+
import { buildTaskDocState } from "../../shared/task-doc-state.js";
|
|
6
|
+
import { dedupeStrings } from "../../shared/strings.js";
|
|
7
|
+
import { createRunnerRunId } from "../run-id.js";
|
|
8
|
+
import { assembleRunnerRecipeContext, } from "../context/recipe-context.js";
|
|
9
|
+
function nowIso() {
|
|
10
|
+
return new Date().toISOString();
|
|
11
|
+
}
|
|
12
|
+
function seedRecipeTaskSummary(opts) {
|
|
13
|
+
const seeded = opts.scenario.task_template.doc?.summary?.trim();
|
|
14
|
+
if (seeded)
|
|
15
|
+
return seeded;
|
|
16
|
+
return [
|
|
17
|
+
opts.scenario.task_template.title,
|
|
18
|
+
"",
|
|
19
|
+
opts.scenario.task_template.description,
|
|
20
|
+
"",
|
|
21
|
+
`Recipe: ${opts.selection.recipe_id}:${opts.selection.scenario_id}@${opts.selection.recipe_version}`,
|
|
22
|
+
`Goal: ${opts.scenario.goal}`,
|
|
23
|
+
].join("\n");
|
|
24
|
+
}
|
|
25
|
+
function seedRecipeTaskScope(opts) {
|
|
26
|
+
const seeded = opts.scenario.task_template.doc?.scope?.trim();
|
|
27
|
+
if (seeded)
|
|
28
|
+
return seeded;
|
|
29
|
+
const requiredInputs = opts.selection.required_inputs;
|
|
30
|
+
const outputs = opts.selection.outputs;
|
|
31
|
+
return [
|
|
32
|
+
`- In scope: execute recipe scenario "${opts.selection.recipe_id}:${opts.selection.scenario_id}" to achieve "${opts.scenario.goal}".`,
|
|
33
|
+
`- Required inputs: ${requiredInputs.length > 0 ? requiredInputs.join(", ") : "none declared"}.`,
|
|
34
|
+
`- Expected outputs: ${outputs.length > 0 ? outputs.join(", ") : "none declared"}.`,
|
|
35
|
+
"- Out of scope: work outside the scenario's declared goal, outputs, and artifacts.",
|
|
36
|
+
].join("\n");
|
|
37
|
+
}
|
|
38
|
+
function seedRecipeTaskPlan(opts) {
|
|
39
|
+
const seeded = opts.scenario.task_template.doc?.plan?.trim();
|
|
40
|
+
if (seeded)
|
|
41
|
+
return seeded;
|
|
42
|
+
return [
|
|
43
|
+
`1. Resolve the inputs and dependencies for "${opts.selection.recipe_id}:${opts.selection.scenario_id}".`,
|
|
44
|
+
`2. Execute the scenario goal: ${opts.scenario.goal}`,
|
|
45
|
+
"3. Capture the declared outputs/artifacts and verification evidence in the task record.",
|
|
46
|
+
].join("\n");
|
|
47
|
+
}
|
|
48
|
+
function seedRecipeTaskVerifySteps(opts) {
|
|
49
|
+
const seeded = opts.scenario.task_template.doc?.verify_steps?.trim();
|
|
50
|
+
if (seeded)
|
|
51
|
+
return seeded;
|
|
52
|
+
const primary = opts.scenario.task_template.tags?.[0] ?? "recipes";
|
|
53
|
+
return buildDefaultVerifyStepsSection({
|
|
54
|
+
primary,
|
|
55
|
+
verifyCommands: dedupeStrings(opts.scenario.task_template.verify ?? []),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function seedRecipeTaskRollbackPlan(opts) {
|
|
59
|
+
const seeded = opts.scenario.task_template.doc?.rollback_plan?.trim();
|
|
60
|
+
if (seeded)
|
|
61
|
+
return seeded;
|
|
62
|
+
return [
|
|
63
|
+
`- Revert the task created from recipe scenario "${opts.selection.recipe_id}:${opts.selection.scenario_id}".`,
|
|
64
|
+
"- Remove any runner artifacts produced by the scenario run if they are no longer needed.",
|
|
65
|
+
"- Re-run the relevant validation step to confirm the rollback restored the previous state.",
|
|
66
|
+
].join("\n");
|
|
67
|
+
}
|
|
68
|
+
function seedRecipeTaskDoc(opts) {
|
|
69
|
+
let body = defaultTaskDocV3({
|
|
70
|
+
title: opts.scenario.task_template.title,
|
|
71
|
+
description: opts.scenario.task_template.description,
|
|
72
|
+
});
|
|
73
|
+
body = setMarkdownSection(body, "Summary", seedRecipeTaskSummary(opts));
|
|
74
|
+
body = setMarkdownSection(body, "Scope", seedRecipeTaskScope(opts));
|
|
75
|
+
body = setMarkdownSection(body, "Plan", seedRecipeTaskPlan(opts));
|
|
76
|
+
body = setMarkdownSection(body, "Verify Steps", seedRecipeTaskVerifySteps(opts));
|
|
77
|
+
body = setMarkdownSection(body, "Rollback Plan", seedRecipeTaskRollbackPlan(opts));
|
|
78
|
+
body = setMarkdownSection(body, "Findings", opts.scenario.task_template.doc?.findings?.trim() ?? "");
|
|
79
|
+
return body;
|
|
80
|
+
}
|
|
81
|
+
export function buildMaterializedRecipeTask(opts) {
|
|
82
|
+
const created_at = opts.created_at ?? nowIso();
|
|
83
|
+
const taskTemplate = opts.envelope.scenario.task_template;
|
|
84
|
+
const docState = buildTaskDocState({
|
|
85
|
+
doc: seedRecipeTaskDoc(opts.envelope),
|
|
86
|
+
owner: taskTemplate.owner,
|
|
87
|
+
updatedBy: taskTemplate.owner,
|
|
88
|
+
version: TASK_DOC_VERSION_V3,
|
|
89
|
+
updatedAt: created_at,
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
id: opts.task_id,
|
|
93
|
+
title: taskTemplate.title,
|
|
94
|
+
description: taskTemplate.description,
|
|
95
|
+
status: "TODO",
|
|
96
|
+
priority: taskTemplate.priority ?? "med",
|
|
97
|
+
owner: taskTemplate.owner,
|
|
98
|
+
revision: 1,
|
|
99
|
+
origin: {
|
|
100
|
+
system: "recipe",
|
|
101
|
+
recipe_id: opts.envelope.selection.recipe_id,
|
|
102
|
+
scenario_id: opts.envelope.selection.scenario_id,
|
|
103
|
+
recipe_version: opts.envelope.selection.recipe_version,
|
|
104
|
+
run_id: opts.run_id,
|
|
105
|
+
},
|
|
106
|
+
depends_on: [],
|
|
107
|
+
tags: dedupeStrings(taskTemplate.tags ?? ["recipes"]),
|
|
108
|
+
verify: dedupeStrings(taskTemplate.verify ?? []),
|
|
109
|
+
comments: [],
|
|
110
|
+
events: [],
|
|
111
|
+
doc_version: docState.doc_version,
|
|
112
|
+
doc_updated_at: docState.doc_updated_at,
|
|
113
|
+
doc_updated_by: docState.doc_updated_by,
|
|
114
|
+
id_source: "generated",
|
|
115
|
+
doc: docState.doc,
|
|
116
|
+
sections: docState.sections,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export async function materializeRecipeScenarioTask(opts) {
|
|
120
|
+
const ctx = opts.ctx ??
|
|
121
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
122
|
+
if (!ctx.taskBackend.generateTaskId) {
|
|
123
|
+
throw new Error("Backend does not support task materialization: missing generateTaskId()");
|
|
124
|
+
}
|
|
125
|
+
const envelope = await assembleRunnerRecipeContext({
|
|
126
|
+
project: ctx.resolvedProject,
|
|
127
|
+
recipe_id: opts.recipe_id,
|
|
128
|
+
scenario_id: opts.scenario_id,
|
|
129
|
+
});
|
|
130
|
+
const task_id = await ctx.taskBackend.generateTaskId({
|
|
131
|
+
length: ctx.config.tasks.id_suffix_length_default,
|
|
132
|
+
attempts: 1000,
|
|
133
|
+
});
|
|
134
|
+
const run_id = opts.run_id ?? createRunnerRunId();
|
|
135
|
+
const task = buildMaterializedRecipeTask({
|
|
136
|
+
envelope,
|
|
137
|
+
task_id,
|
|
138
|
+
run_id,
|
|
139
|
+
});
|
|
140
|
+
await ctx.taskBackend.writeTask(task);
|
|
141
|
+
return {
|
|
142
|
+
task,
|
|
143
|
+
task_id,
|
|
144
|
+
run_id,
|
|
145
|
+
readme_path: path.join(ctx.resolvedProject.gitRoot, ctx.config.paths.workflow_dir, task_id, "README.md"),
|
|
146
|
+
recipe_context: envelope.recipe,
|
|
147
|
+
selection: envelope.selection,
|
|
148
|
+
scenario: envelope.scenario,
|
|
149
|
+
entry: envelope.entry,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CommandContext } from "../../commands/shared/task-backend.js";
|
|
2
|
+
import { type TaskRunnerPaths } from "../task-run-paths.js";
|
|
3
|
+
import type { RunnerContextBundle, RunnerEvent, RunnerRunState } from "../types.js";
|
|
4
|
+
export type LoadedTaskRunnerInspection = {
|
|
5
|
+
ctx: CommandContext;
|
|
6
|
+
task_id: string;
|
|
7
|
+
run_id: string;
|
|
8
|
+
selection: "explicit" | "latest";
|
|
9
|
+
paths: TaskRunnerPaths;
|
|
10
|
+
bundle: RunnerContextBundle;
|
|
11
|
+
state: RunnerRunState;
|
|
12
|
+
events: RunnerEvent[];
|
|
13
|
+
events_text: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function loadTaskRunnerInspection(opts: {
|
|
16
|
+
ctx?: CommandContext;
|
|
17
|
+
cwd: string;
|
|
18
|
+
rootOverride?: string | null;
|
|
19
|
+
task_id: string;
|
|
20
|
+
run_id?: string;
|
|
21
|
+
}): Promise<LoadedTaskRunnerInspection>;
|
|
22
|
+
export declare function readTaskRunnerTraceArtifact(opts: {
|
|
23
|
+
ctx?: CommandContext;
|
|
24
|
+
cwd: string;
|
|
25
|
+
rootOverride?: string | null;
|
|
26
|
+
task_id: string;
|
|
27
|
+
run_id?: string;
|
|
28
|
+
}): Promise<LoadedTaskRunnerInspection & {
|
|
29
|
+
trace_text: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function readTaskRunnerTraceTail(opts: {
|
|
32
|
+
ctx?: CommandContext;
|
|
33
|
+
cwd: string;
|
|
34
|
+
rootOverride?: string | null;
|
|
35
|
+
task_id: string;
|
|
36
|
+
run_id?: string;
|
|
37
|
+
lines: number;
|
|
38
|
+
}): Promise<LoadedTaskRunnerInspection & {
|
|
39
|
+
tail_text: string;
|
|
40
|
+
}>;
|
|
41
|
+
//# sourceMappingURL=task-run-inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run-inspect.d.ts","sourceRoot":"","sources":["../../../src/runner/usecases/task-run-inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGhG,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEpF,MAAM,MAAM,0BAA0B,GAAG;IACvC,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC;IACjC,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAkDtC;AAED,wBAAsB,2BAA2B,CAAC,IAAI,EAAE;IACtD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,0BAA0B,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAU/D;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,0BAA0B,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAW9D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { loadCommandContext } from "../../commands/shared/task-backend.js";
|
|
2
|
+
import { CliError } from "../../shared/errors.js";
|
|
3
|
+
import { resolveLatestRunnerRunId, RunnerRunRepository } from "../run-repository.js";
|
|
4
|
+
import { resolveTaskRunnerPaths } from "../task-run-paths.js";
|
|
5
|
+
export async function loadTaskRunnerInspection(opts) {
|
|
6
|
+
const ctx = opts.ctx ??
|
|
7
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
8
|
+
const task = await ctx.taskBackend.getTask(opts.task_id);
|
|
9
|
+
if (!task) {
|
|
10
|
+
throw new CliError({
|
|
11
|
+
exitCode: 4,
|
|
12
|
+
code: "E_IO",
|
|
13
|
+
message: `Task not found: ${opts.task_id}`,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const runId = typeof opts.run_id === "string" && opts.run_id.trim().length > 0
|
|
17
|
+
? opts.run_id
|
|
18
|
+
: await resolveLatestRunnerRunId({
|
|
19
|
+
git_root: ctx.resolvedProject.gitRoot,
|
|
20
|
+
workflow_dir: ctx.config.paths.workflow_dir,
|
|
21
|
+
task_id: opts.task_id,
|
|
22
|
+
});
|
|
23
|
+
const paths = resolveTaskRunnerPaths({
|
|
24
|
+
git_root: ctx.resolvedProject.gitRoot,
|
|
25
|
+
workflow_dir: ctx.config.paths.workflow_dir,
|
|
26
|
+
task_id: opts.task_id,
|
|
27
|
+
run_id: runId,
|
|
28
|
+
});
|
|
29
|
+
const repository = new RunnerRunRepository(paths);
|
|
30
|
+
const [record, eventsData] = await Promise.all([
|
|
31
|
+
repository.readRequiredRecord({
|
|
32
|
+
task_id: opts.task_id,
|
|
33
|
+
run_id: runId,
|
|
34
|
+
}),
|
|
35
|
+
repository.readEventsRequired({
|
|
36
|
+
task_id: opts.task_id,
|
|
37
|
+
run_id: runId,
|
|
38
|
+
}),
|
|
39
|
+
]);
|
|
40
|
+
return {
|
|
41
|
+
ctx,
|
|
42
|
+
task_id: opts.task_id,
|
|
43
|
+
run_id: runId,
|
|
44
|
+
selection: opts.run_id ? "explicit" : "latest",
|
|
45
|
+
paths,
|
|
46
|
+
bundle: record.bundle,
|
|
47
|
+
state: record.state,
|
|
48
|
+
events: eventsData.events,
|
|
49
|
+
events_text: eventsData.events_text,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export async function readTaskRunnerTraceArtifact(opts) {
|
|
53
|
+
const inspection = await loadTaskRunnerInspection(opts);
|
|
54
|
+
const trace_text = await new RunnerRunRepository(inspection.paths).readTraceTextRequired({
|
|
55
|
+
task_id: inspection.task_id,
|
|
56
|
+
run_id: inspection.run_id,
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
...inspection,
|
|
60
|
+
trace_text,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export async function readTaskRunnerTraceTail(opts) {
|
|
64
|
+
const traced = await readTaskRunnerTraceArtifact(opts);
|
|
65
|
+
const lines = traced.trace_text.split(/\r?\n/u);
|
|
66
|
+
if (lines.at(-1) === "") {
|
|
67
|
+
lines.pop();
|
|
68
|
+
}
|
|
69
|
+
const tail = lines.slice(-opts.lines);
|
|
70
|
+
return {
|
|
71
|
+
...traced,
|
|
72
|
+
tail_text: tail.length > 0 ? `${tail.join("\n")}\n` : "",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandContext } from "../../commands/shared/task-backend.js";
|
|
2
|
+
import { type CancelledTaskRunnerExecution } from "./task-run-lifecycle-shared.js";
|
|
3
|
+
export declare function cancelTaskRunnerExecution(opts: {
|
|
4
|
+
ctx?: CommandContext;
|
|
5
|
+
cwd: string;
|
|
6
|
+
rootOverride?: string | null;
|
|
7
|
+
task_id: string;
|
|
8
|
+
run_id: string;
|
|
9
|
+
}): Promise<CancelledTaskRunnerExecution>;
|
|
10
|
+
//# sourceMappingURL=task-run-lifecycle-cancel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run-lifecycle-cancel.d.ts","sourceRoot":"","sources":["../../../src/runner/usecases/task-run-lifecycle-cancel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAW5E,OAAO,EAML,KAAK,4BAA4B,EAClC,MAAM,gCAAgC,CAAC;AAExC,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAsKxC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { CliError } from "../../shared/errors.js";
|
|
2
|
+
import { evolveRunnerRunState } from "../artifacts.js";
|
|
3
|
+
import { isProcessAlive, waitForProcessExit, waitForRunnerStateStop, } from "../process-supervision.js";
|
|
4
|
+
import { persistRunnerOutcomeToTask } from "../task-state.js";
|
|
5
|
+
import { assertMatchingProcessIdentity, buildSyntheticCancelledState, loadExistingRunnerExecution, readRunningPid, signalProcess, } from "./task-run-lifecycle-shared.js";
|
|
6
|
+
export async function cancelTaskRunnerExecution(opts) {
|
|
7
|
+
const loaded = await loadExistingRunnerExecution({
|
|
8
|
+
ctx: opts.ctx,
|
|
9
|
+
cwd: opts.cwd,
|
|
10
|
+
rootOverride: opts.rootOverride ?? null,
|
|
11
|
+
task_id: opts.task_id,
|
|
12
|
+
run_id: opts.run_id,
|
|
13
|
+
require_task_doing: false,
|
|
14
|
+
});
|
|
15
|
+
if (loaded.state.status === "success") {
|
|
16
|
+
throw new CliError({
|
|
17
|
+
exitCode: 2,
|
|
18
|
+
code: "E_USAGE",
|
|
19
|
+
message: `runner cancel requires a non-success run (current=${JSON.stringify(loaded.state.status)})`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (loaded.state.status === "cancelled") {
|
|
23
|
+
return { ...loaded, previous_status: loaded.state.status, changed: false };
|
|
24
|
+
}
|
|
25
|
+
if (loaded.state.status === "running") {
|
|
26
|
+
const pid = readRunningPid(loaded.state);
|
|
27
|
+
if (!pid) {
|
|
28
|
+
throw new CliError({
|
|
29
|
+
exitCode: 4,
|
|
30
|
+
code: "E_IO",
|
|
31
|
+
message: `runner cancel requires supervision metadata for running run ${opts.task_id}:${opts.run_id}`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
await assertMatchingProcessIdentity({
|
|
36
|
+
task_id: opts.task_id,
|
|
37
|
+
run_id: opts.run_id,
|
|
38
|
+
state: loaded.state,
|
|
39
|
+
pid,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
if (err instanceof CliError) {
|
|
44
|
+
const refusedAt = new Date().toISOString();
|
|
45
|
+
await loaded.repository.appendEvent({
|
|
46
|
+
at: refusedAt,
|
|
47
|
+
type: "runner_cancel_refused",
|
|
48
|
+
message: err.message,
|
|
49
|
+
data: err.context ?? {
|
|
50
|
+
task_id: opts.task_id,
|
|
51
|
+
run_id: opts.run_id,
|
|
52
|
+
pid,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
const requested_at = new Date().toISOString();
|
|
59
|
+
const requestedState = evolveRunnerRunState({
|
|
60
|
+
state: loaded.state,
|
|
61
|
+
status: "running",
|
|
62
|
+
updated_at: requested_at,
|
|
63
|
+
supervision: {
|
|
64
|
+
...loaded.state.supervision,
|
|
65
|
+
cancel_requested_at: requested_at,
|
|
66
|
+
cancel_signal: "SIGTERM",
|
|
67
|
+
heartbeat_at: requested_at,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
await loaded.repository.writeState(requestedState);
|
|
71
|
+
await loaded.repository.appendEvent({
|
|
72
|
+
at: requested_at,
|
|
73
|
+
type: "runner_cancel_requested",
|
|
74
|
+
message: `runner cancel requested via SIGTERM for pid=${pid}`,
|
|
75
|
+
data: {
|
|
76
|
+
previous_status: loaded.state.status,
|
|
77
|
+
pid,
|
|
78
|
+
signal: "SIGTERM",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const exitedAfterTerm = signalProcess(pid, "SIGTERM")
|
|
82
|
+
? await waitForProcessExit({ pid, timeout_ms: 1500 })
|
|
83
|
+
: true;
|
|
84
|
+
let finalSignal = "SIGTERM";
|
|
85
|
+
if (!exitedAfterTerm && isProcessAlive(pid)) {
|
|
86
|
+
const killRequestedAt = new Date().toISOString();
|
|
87
|
+
const killRequestedState = evolveRunnerRunState({
|
|
88
|
+
state: requestedState,
|
|
89
|
+
status: "running",
|
|
90
|
+
updated_at: killRequestedAt,
|
|
91
|
+
supervision: {
|
|
92
|
+
...requestedState.supervision,
|
|
93
|
+
cancel_requested_at: requested_at,
|
|
94
|
+
cancel_signal: "SIGKILL",
|
|
95
|
+
force_killed: true,
|
|
96
|
+
heartbeat_at: killRequestedAt,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
await loaded.repository.writeState(killRequestedState);
|
|
100
|
+
await loaded.repository.appendEvent({
|
|
101
|
+
at: killRequestedAt,
|
|
102
|
+
type: "runner_force_kill_requested",
|
|
103
|
+
message: `runner cancel escalated to SIGKILL for pid=${pid}`,
|
|
104
|
+
data: {
|
|
105
|
+
previous_status: loaded.state.status,
|
|
106
|
+
pid,
|
|
107
|
+
signal: "SIGKILL",
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
signalProcess(pid, "SIGKILL");
|
|
111
|
+
await waitForProcessExit({ pid, timeout_ms: 1500 });
|
|
112
|
+
finalSignal = "SIGKILL";
|
|
113
|
+
}
|
|
114
|
+
const settledState = await waitForRunnerStateStop({
|
|
115
|
+
state_path: loaded.invocation.state_path,
|
|
116
|
+
timeout_ms: 3000,
|
|
117
|
+
});
|
|
118
|
+
const nextState = settledState ??
|
|
119
|
+
buildSyntheticCancelledState({
|
|
120
|
+
state: (await loaded.repository.readState()) ?? requestedState,
|
|
121
|
+
signal: finalSignal,
|
|
122
|
+
updated_at: new Date().toISOString(),
|
|
123
|
+
});
|
|
124
|
+
if (!settledState) {
|
|
125
|
+
await loaded.repository.writeState(nextState);
|
|
126
|
+
await loaded.repository.appendEvent({
|
|
127
|
+
at: nextState.updated_at,
|
|
128
|
+
type: "runner_cancelled",
|
|
129
|
+
message: `runner process exited after ${finalSignal}; state synthesized as cancelled`,
|
|
130
|
+
data: {
|
|
131
|
+
previous_status: loaded.state.status,
|
|
132
|
+
pid,
|
|
133
|
+
signal: finalSignal,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
await persistRunnerOutcomeToTask({
|
|
138
|
+
ctx: loaded.ctx,
|
|
139
|
+
task_id: opts.task_id,
|
|
140
|
+
bundle: loaded.bundle,
|
|
141
|
+
state: nextState,
|
|
142
|
+
});
|
|
143
|
+
return {
|
|
144
|
+
...loaded,
|
|
145
|
+
state: nextState,
|
|
146
|
+
previous_status: loaded.state.status,
|
|
147
|
+
changed: nextState.status === "cancelled",
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const updated_at = new Date().toISOString();
|
|
151
|
+
const nextState = evolveRunnerRunState({
|
|
152
|
+
state: loaded.state,
|
|
153
|
+
status: "cancelled",
|
|
154
|
+
updated_at,
|
|
155
|
+
});
|
|
156
|
+
await loaded.repository.writeState(nextState);
|
|
157
|
+
await loaded.repository.appendEvent({
|
|
158
|
+
at: updated_at,
|
|
159
|
+
type: "runner_cancelled",
|
|
160
|
+
message: `runner marked cancelled from status=${loaded.state.status}`,
|
|
161
|
+
data: {
|
|
162
|
+
previous_status: loaded.state.status,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
await persistRunnerOutcomeToTask({
|
|
166
|
+
ctx: loaded.ctx,
|
|
167
|
+
task_id: opts.task_id,
|
|
168
|
+
bundle: loaded.bundle,
|
|
169
|
+
state: nextState,
|
|
170
|
+
});
|
|
171
|
+
return { ...loaded, state: nextState, previous_status: loaded.state.status, changed: true };
|
|
172
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CommandContext } from "../../commands/shared/task-backend.js";
|
|
2
|
+
import { type ResumedTaskRunnerExecution, type RetriedTaskRunnerExecution } from "./task-run-lifecycle-shared.js";
|
|
3
|
+
export declare function resumeTaskRunnerExecution(opts: {
|
|
4
|
+
ctx?: CommandContext;
|
|
5
|
+
cwd: string;
|
|
6
|
+
rootOverride?: string | null;
|
|
7
|
+
task_id: string;
|
|
8
|
+
run_id: string;
|
|
9
|
+
}): Promise<ResumedTaskRunnerExecution>;
|
|
10
|
+
export declare function retryTaskRunnerExecution(opts: {
|
|
11
|
+
ctx?: CommandContext;
|
|
12
|
+
cwd: string;
|
|
13
|
+
rootOverride?: string | null;
|
|
14
|
+
task_id: string;
|
|
15
|
+
run_id: string;
|
|
16
|
+
new_run_id?: string;
|
|
17
|
+
}): Promise<RetriedTaskRunnerExecution>;
|
|
18
|
+
//# sourceMappingURL=task-run-lifecycle-replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run-lifecycle-replay.d.ts","sourceRoot":"","sources":["../../../src/runner/usecases/task-run-lifecycle-replay.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAG5E,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,gCAAgC,CAAC;AAGxC,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA4CtC;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA8EtC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createRunnerAdapter } from "../adapters/index.js";
|
|
2
|
+
import { evolveRunnerRunState } from "../artifacts.js";
|
|
3
|
+
import { createRunnerRunId } from "../run-id.js";
|
|
4
|
+
import { RunnerRunRepository } from "../run-repository.js";
|
|
5
|
+
import { persistRunnerOutcomeToTask } from "../task-state.js";
|
|
6
|
+
import { resolveTaskRunnerPaths } from "../task-run-paths.js";
|
|
7
|
+
import { renderTaskRunnerBootstrap } from "./task-run.js";
|
|
8
|
+
import { assertExecuteMode, loadExistingRunnerExecution, } from "./task-run-lifecycle-shared.js";
|
|
9
|
+
import { CliError } from "../../shared/errors.js";
|
|
10
|
+
export async function resumeTaskRunnerExecution(opts) {
|
|
11
|
+
const loaded = await loadExistingRunnerExecution({
|
|
12
|
+
ctx: opts.ctx,
|
|
13
|
+
cwd: opts.cwd,
|
|
14
|
+
rootOverride: opts.rootOverride ?? null,
|
|
15
|
+
task_id: opts.task_id,
|
|
16
|
+
run_id: opts.run_id,
|
|
17
|
+
});
|
|
18
|
+
assertExecuteMode(loaded.bundle, "resume");
|
|
19
|
+
if (loaded.state.status === "running" || loaded.state.status === "success") {
|
|
20
|
+
throw new CliError({
|
|
21
|
+
exitCode: 2,
|
|
22
|
+
code: "E_USAGE",
|
|
23
|
+
message: `runner resume requires a prepared, failed, or cancelled run ` +
|
|
24
|
+
`(current=${JSON.stringify(loaded.state.status)})`,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const requested_at = new Date().toISOString();
|
|
28
|
+
const resetState = evolveRunnerRunState({
|
|
29
|
+
state: loaded.state,
|
|
30
|
+
status: "prepared",
|
|
31
|
+
updated_at: requested_at,
|
|
32
|
+
});
|
|
33
|
+
await loaded.repository.writeState(resetState);
|
|
34
|
+
await loaded.repository.appendEvent({
|
|
35
|
+
at: requested_at,
|
|
36
|
+
type: "runner_resume_requested",
|
|
37
|
+
message: `runner resume requested from status=${loaded.state.status}`,
|
|
38
|
+
data: {
|
|
39
|
+
previous_status: loaded.state.status,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const result = await createRunnerAdapter(loaded.ctx.config).execute(loaded.invocation);
|
|
43
|
+
const nextState = (await loaded.repository.readState()) ?? resetState;
|
|
44
|
+
await persistRunnerOutcomeToTask({
|
|
45
|
+
ctx: loaded.ctx,
|
|
46
|
+
task_id: opts.task_id,
|
|
47
|
+
bundle: loaded.bundle,
|
|
48
|
+
state: nextState,
|
|
49
|
+
});
|
|
50
|
+
return { ...loaded, state: nextState, previous_status: loaded.state.status, result };
|
|
51
|
+
}
|
|
52
|
+
export async function retryTaskRunnerExecution(opts) {
|
|
53
|
+
const source = await loadExistingRunnerExecution({
|
|
54
|
+
ctx: opts.ctx,
|
|
55
|
+
cwd: opts.cwd,
|
|
56
|
+
rootOverride: opts.rootOverride ?? null,
|
|
57
|
+
task_id: opts.task_id,
|
|
58
|
+
run_id: opts.run_id,
|
|
59
|
+
});
|
|
60
|
+
assertExecuteMode(source.bundle, "retry");
|
|
61
|
+
if (source.state.status === "prepared" || source.state.status === "running") {
|
|
62
|
+
throw new CliError({
|
|
63
|
+
exitCode: 2,
|
|
64
|
+
code: "E_USAGE",
|
|
65
|
+
message: `runner retry requires a failed or cancelled run ` +
|
|
66
|
+
`(current=${JSON.stringify(source.state.status)}; use \`agentplane task run resume ${opts.task_id} ${opts.run_id}\` instead).`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const nextRunId = opts.new_run_id ?? createRunnerRunId();
|
|
70
|
+
const paths = resolveTaskRunnerPaths({
|
|
71
|
+
git_root: source.ctx.resolvedProject.gitRoot,
|
|
72
|
+
workflow_dir: source.ctx.config.paths.workflow_dir,
|
|
73
|
+
task_id: opts.task_id,
|
|
74
|
+
run_id: nextRunId,
|
|
75
|
+
});
|
|
76
|
+
const retriedBundle = {
|
|
77
|
+
...source.bundle,
|
|
78
|
+
execution: {
|
|
79
|
+
...source.bundle.execution,
|
|
80
|
+
mode: "execute",
|
|
81
|
+
run_id: nextRunId,
|
|
82
|
+
artifact_paths: paths,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const adapter = createRunnerAdapter(source.ctx.config);
|
|
86
|
+
const invocation = await adapter.prepare(retriedBundle);
|
|
87
|
+
const retryRepository = RunnerRunRepository.fromBundle(retriedBundle);
|
|
88
|
+
const state = await retryRepository.writePrepared({
|
|
89
|
+
bundle: retriedBundle,
|
|
90
|
+
bootstrap_markdown: renderTaskRunnerBootstrap(retriedBundle, invocation),
|
|
91
|
+
invocation,
|
|
92
|
+
});
|
|
93
|
+
const requested_at = new Date().toISOString();
|
|
94
|
+
await source.repository.appendEvent({
|
|
95
|
+
at: requested_at,
|
|
96
|
+
type: "runner_retry_requested",
|
|
97
|
+
message: `runner retry requested into run_id=${nextRunId}`,
|
|
98
|
+
data: {
|
|
99
|
+
next_run_id: nextRunId,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
await retryRepository.appendEvent({
|
|
103
|
+
at: requested_at,
|
|
104
|
+
type: "runner_retry_created",
|
|
105
|
+
message: `runner retry created from run_id=${source.state.run_id}`,
|
|
106
|
+
data: {
|
|
107
|
+
source_run_id: source.state.run_id,
|
|
108
|
+
source_status: source.state.status,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
const result = await adapter.execute(invocation);
|
|
112
|
+
const nextState = (await retryRepository.readState()) ?? state;
|
|
113
|
+
await persistRunnerOutcomeToTask({
|
|
114
|
+
ctx: source.ctx,
|
|
115
|
+
task_id: opts.task_id,
|
|
116
|
+
bundle: retriedBundle,
|
|
117
|
+
state: nextState,
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
ctx: source.ctx,
|
|
121
|
+
bundle: retriedBundle,
|
|
122
|
+
invocation,
|
|
123
|
+
state: nextState,
|
|
124
|
+
result,
|
|
125
|
+
source_run_id: source.state.run_id,
|
|
126
|
+
source_status: source.state.status,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type CommandContext } from "../../commands/shared/task-backend.js";
|
|
2
|
+
import { RunnerRunRepository } from "../run-repository.js";
|
|
3
|
+
import type { RunnerContextBundle, RunnerLifecycleStatus, RunnerProcessSignal, RunnerResult, RunnerRunState } from "../types.js";
|
|
4
|
+
import { type ExecutedTaskRunnerExecution, type PreparedTaskRunnerExecution } from "./task-run.js";
|
|
5
|
+
export type LoadedRunnerExecution = PreparedTaskRunnerExecution & {
|
|
6
|
+
ctx: CommandContext;
|
|
7
|
+
state: RunnerRunState;
|
|
8
|
+
repository: RunnerRunRepository;
|
|
9
|
+
};
|
|
10
|
+
export type CancelledTaskRunnerExecution = LoadedRunnerExecution & {
|
|
11
|
+
previous_status: RunnerLifecycleStatus;
|
|
12
|
+
changed: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type ResumedTaskRunnerExecution = LoadedRunnerExecution & {
|
|
15
|
+
previous_status: RunnerLifecycleStatus;
|
|
16
|
+
result: RunnerResult;
|
|
17
|
+
};
|
|
18
|
+
export type RetriedTaskRunnerExecution = ExecutedTaskRunnerExecution & {
|
|
19
|
+
ctx: CommandContext;
|
|
20
|
+
source_run_id: string;
|
|
21
|
+
source_status: RunnerLifecycleStatus;
|
|
22
|
+
};
|
|
23
|
+
export declare function assertExecuteMode(bundle: RunnerContextBundle, action: "resume" | "retry"): void;
|
|
24
|
+
export declare function readRunningPid(state: RunnerRunState): number | null;
|
|
25
|
+
export declare function assertMatchingProcessIdentity(opts: {
|
|
26
|
+
task_id: string;
|
|
27
|
+
run_id: string;
|
|
28
|
+
state: RunnerRunState;
|
|
29
|
+
pid: number;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
export declare function signalProcess(pid: number, signal: RunnerProcessSignal): boolean;
|
|
32
|
+
export declare function buildSyntheticCancelledState(opts: {
|
|
33
|
+
state: RunnerRunState;
|
|
34
|
+
signal: RunnerProcessSignal;
|
|
35
|
+
updated_at: string;
|
|
36
|
+
}): RunnerRunState;
|
|
37
|
+
export declare function loadExistingRunnerExecution(opts: {
|
|
38
|
+
ctx?: CommandContext;
|
|
39
|
+
cwd: string;
|
|
40
|
+
rootOverride?: string | null;
|
|
41
|
+
task_id: string;
|
|
42
|
+
run_id: string;
|
|
43
|
+
require_task_doing?: boolean;
|
|
44
|
+
}): Promise<LoadedRunnerExecution>;
|
|
45
|
+
//# sourceMappingURL=task-run-lifecycle-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run-lifecycle-shared.d.ts","sourceRoot":"","sources":["../../../src/runner/usecases/task-run-lifecycle-shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAMhG,OAAO,EAAiC,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACjC,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,GAAG;IAChE,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,qBAAqB,GAAG;IACjE,eAAe,EAAE,qBAAqB,CAAC;IACvC,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,GAAG;IAC/D,eAAe,EAAE,qBAAqB,CAAC;IACvC,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,2BAA2B,GAAG;IACrE,GAAG,EAAE,cAAc,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,qBAAqB,CAAC;CACtC,CAAC;AA2BF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAS/F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAEnE;AAuBD,wBAAsB,6BAA6B,CAAC,IAAI,EAAE;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAAC,IAAI,CAAC,CAyChB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAS/E;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IACjD,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CA8BjB;AAED,wBAAsB,2BAA2B,CAAC,IAAI,EAAE;IACtD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkCjC"}
|