agentplane 0.3.6 → 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 +724 -359
- package/dist/adapters/task-backend/task-backend-adapter.d.ts +4 -2
- package/dist/adapters/task-backend/task-backend-adapter.d.ts.map +1 -1
- package/dist/adapters/task-backend/task-backend-adapter.js +15 -2
- 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 +10 -6
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +32 -337
- 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/env.d.ts +1 -1
- package/dist/backends/task-backend/redmine/env.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/env.js +3 -0
- package/dist/backends/task-backend/redmine/inspect.d.ts +11 -0
- package/dist/backends/task-backend/redmine/inspect.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/inspect.js +75 -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 +32 -3
- 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 +19 -0
- package/dist/backends/task-backend/redmine/state.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/state.js +109 -0
- package/dist/backends/task-backend/redmine-backend.d.ts +14 -17
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +121 -379
- 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/constants.js +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 +27 -3
- package/dist/backends/task-backend/shared/types.d.ts +76 -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 -5
- 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 +11 -7
- 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/commands/init/write-env.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-env.js +12 -0
- 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 +90 -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 +8 -6
- package/dist/commands/backend/sync.command.d.ts.map +1 -1
- package/dist/commands/backend/sync.command.js +75 -14
- package/dist/commands/backend.d.ts +22 -0
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +111 -1
- 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/commit.spec.d.ts.map +1 -1
- package/dist/commands/commit.spec.js +30 -6
- 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/doctor/workspace.d.ts +8 -0
- package/dist/commands/doctor/workspace.d.ts.map +1 -1
- package/dist/commands/doctor/workspace.js +127 -3
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +7 -0
- package/dist/commands/guard/commit.command.d.ts.map +1 -1
- package/dist/commands/guard/commit.command.js +30 -6
- 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/allow.d.ts +4 -0
- package/dist/commands/guard/impl/allow.d.ts.map +1 -1
- package/dist/commands/guard/impl/allow.js +14 -3
- 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 +66 -9
- 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 +11 -7
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +107 -24
- 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 +65 -2
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +309 -91
- 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 -89
- 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 +24 -57
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +48 -42
- package/dist/commands/task/derive.command.d.ts +1 -0
- package/dist/commands/task/derive.command.d.ts.map +1 -1
- package/dist/commands/task/derive.command.js +15 -2
- package/dist/commands/task/derive.d.ts +1 -0
- package/dist/commands/task/derive.d.ts.map +1 -1
- package/dist/commands/task/derive.js +37 -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 +68 -61
- 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 +73 -204
- 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/migrate-doc.d.ts +15 -0
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +126 -35
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +26 -4
- 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 +118 -125
- 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 +38 -111
- package/dist/commands/task/shared/dependencies.d.ts +5 -4
- package/dist/commands/task/shared/dependencies.d.ts.map +1 -1
- package/dist/commands/task/shared/dependencies.js +20 -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 +14 -1
- 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 +56 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +82 -8
- 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 +6 -4
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +6 -4
- 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 +32 -113
- 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 +21 -146
- 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/apply.d.ts +2 -0
- package/dist/commands/upgrade/apply.d.ts.map +1 -1
- package/dist/commands/upgrade/apply.js +33 -1
- 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.command.d.ts.map +1 -1
- package/dist/commands/upgrade.command.js +25 -0
- package/dist/commands/upgrade.d.ts +1 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +164 -618
- 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/policy/rules/allowlist.d.ts.map +1 -1
- package/dist/policy/rules/allowlist.js +12 -9
- package/dist/ports/task-backend-port.d.ts +4 -2
- 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/protected-paths.d.ts +10 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +33 -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,172 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { loadCommandContext } from "../../commands/shared/task-backend.js";
|
|
3
|
+
import { CliError } from "../../shared/errors.js";
|
|
4
|
+
import { createRunnerAdapter } from "../adapters/index.js";
|
|
5
|
+
import { runnerAdapterCancelledResult } from "../adapters/shared.js";
|
|
6
|
+
import { evolveRunnerRunState } from "../artifacts.js";
|
|
7
|
+
import { isProcessAlive, readObservedProcessIdentity } from "../process-supervision.js";
|
|
8
|
+
import { assertRunnerBundleMatchesTask, RunnerRunRepository } from "../run-repository.js";
|
|
9
|
+
import { assertRunnerTaskExecutable, } from "./task-run.js";
|
|
10
|
+
function normalizeTaskStatus(task) {
|
|
11
|
+
return String(task.status || "TODO")
|
|
12
|
+
.trim()
|
|
13
|
+
.toUpperCase();
|
|
14
|
+
}
|
|
15
|
+
function assertCurrentTaskDoing(taskId, task) {
|
|
16
|
+
if (!task) {
|
|
17
|
+
throw new CliError({
|
|
18
|
+
exitCode: 4,
|
|
19
|
+
code: "E_IO",
|
|
20
|
+
message: `Task not found: ${taskId}`,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const status = normalizeTaskStatus(task);
|
|
24
|
+
if (status === "DOING")
|
|
25
|
+
return;
|
|
26
|
+
throw new CliError({
|
|
27
|
+
exitCode: 2,
|
|
28
|
+
code: "E_USAGE",
|
|
29
|
+
message: `${taskId}: runner lifecycle commands require task status DOING ` +
|
|
30
|
+
`(current=${JSON.stringify(status)}; use \`agentplane task start-ready ${taskId} --author <ROLE> --body "Start: ..."\` first).`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function assertExecuteMode(bundle, action) {
|
|
34
|
+
if (bundle.execution.mode === "execute")
|
|
35
|
+
return;
|
|
36
|
+
throw new CliError({
|
|
37
|
+
exitCode: 2,
|
|
38
|
+
code: "E_USAGE",
|
|
39
|
+
message: `runner ${action} requires an execute-mode run ` +
|
|
40
|
+
`(current=${JSON.stringify(bundle.execution.mode)}; dry-run artifacts cannot be ${action}d).`,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export function readRunningPid(state) {
|
|
44
|
+
return typeof state.supervision?.pid === "number" ? state.supervision.pid : null;
|
|
45
|
+
}
|
|
46
|
+
function normalizeCommandFingerprint(command) {
|
|
47
|
+
const firstToken = command?.trim().split(/\s+/u)[0] ?? "";
|
|
48
|
+
return firstToken ? path.basename(firstToken) : null;
|
|
49
|
+
}
|
|
50
|
+
function commandMatchesFingerprint(expected, observedCommand) {
|
|
51
|
+
const expectedFingerprint = normalizeCommandFingerprint(expected);
|
|
52
|
+
if (!expectedFingerprint || !observedCommand)
|
|
53
|
+
return false;
|
|
54
|
+
return observedCommand.includes(expectedFingerprint);
|
|
55
|
+
}
|
|
56
|
+
function startedAtMatches(expected, observed) {
|
|
57
|
+
const expectedMs = expected ? Date.parse(expected) : Number.NaN;
|
|
58
|
+
const observedMs = observed ? Date.parse(observed) : Number.NaN;
|
|
59
|
+
if (Number.isNaN(expectedMs) || Number.isNaN(observedMs))
|
|
60
|
+
return false;
|
|
61
|
+
return Math.abs(expectedMs - observedMs) <= 5000;
|
|
62
|
+
}
|
|
63
|
+
export async function assertMatchingProcessIdentity(opts) {
|
|
64
|
+
const observed = await readObservedProcessIdentity(opts.pid);
|
|
65
|
+
if (!observed) {
|
|
66
|
+
if (!isProcessAlive(opts.pid))
|
|
67
|
+
return;
|
|
68
|
+
throw new CliError({
|
|
69
|
+
exitCode: 8,
|
|
70
|
+
code: "E_RUNTIME",
|
|
71
|
+
message: `runner cancel refused because process identity could not be confirmed for ` +
|
|
72
|
+
`${opts.task_id}:${opts.run_id} pid=${opts.pid}.`,
|
|
73
|
+
context: {
|
|
74
|
+
task_id: opts.task_id,
|
|
75
|
+
run_id: opts.run_id,
|
|
76
|
+
pid: opts.pid,
|
|
77
|
+
expected_command: opts.state.supervision?.command ?? null,
|
|
78
|
+
expected_started_at: opts.state.supervision?.started_at ?? null,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const commandMatches = commandMatchesFingerprint(opts.state.supervision?.command, observed.command);
|
|
83
|
+
const startMatches = startedAtMatches(opts.state.supervision?.started_at, observed.started_at);
|
|
84
|
+
if (commandMatches && startMatches)
|
|
85
|
+
return;
|
|
86
|
+
throw new CliError({
|
|
87
|
+
exitCode: 8,
|
|
88
|
+
code: "E_RUNTIME",
|
|
89
|
+
message: `runner cancel refused because the live process no longer matches persisted supervision ` +
|
|
90
|
+
`metadata for ${opts.task_id}:${opts.run_id} pid=${opts.pid}.`,
|
|
91
|
+
context: {
|
|
92
|
+
task_id: opts.task_id,
|
|
93
|
+
run_id: opts.run_id,
|
|
94
|
+
pid: opts.pid,
|
|
95
|
+
expected_command: opts.state.supervision?.command ?? null,
|
|
96
|
+
observed_command: observed.command,
|
|
97
|
+
expected_started_at: opts.state.supervision?.started_at ?? null,
|
|
98
|
+
observed_started_at: observed.started_at,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export function signalProcess(pid, signal) {
|
|
103
|
+
try {
|
|
104
|
+
process.kill(pid, signal);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
const code = err?.code;
|
|
109
|
+
if (code === "ESRCH")
|
|
110
|
+
return false;
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export function buildSyntheticCancelledState(opts) {
|
|
115
|
+
const priorSupervision = opts.state.supervision;
|
|
116
|
+
const started_at = opts.state.result?.started_at ??
|
|
117
|
+
priorSupervision?.started_at ??
|
|
118
|
+
opts.state.updated_at ??
|
|
119
|
+
opts.updated_at;
|
|
120
|
+
const result = runnerAdapterCancelledResult({
|
|
121
|
+
reason: `Runner cancellation state synthesized after requested ${opts.signal}; ` +
|
|
122
|
+
"observed process exit metadata was unavailable.",
|
|
123
|
+
started_at,
|
|
124
|
+
ended_at: opts.updated_at,
|
|
125
|
+
output_paths: [opts.state.bundle_path, opts.state.bootstrap_path].filter((value) => typeof value === "string" && value.trim().length > 0),
|
|
126
|
+
});
|
|
127
|
+
return evolveRunnerRunState({
|
|
128
|
+
state: opts.state,
|
|
129
|
+
status: "cancelled",
|
|
130
|
+
result,
|
|
131
|
+
updated_at: opts.updated_at,
|
|
132
|
+
supervision: {
|
|
133
|
+
...priorSupervision,
|
|
134
|
+
heartbeat_at: opts.updated_at,
|
|
135
|
+
cancel_requested_at: priorSupervision?.cancel_requested_at ?? opts.updated_at,
|
|
136
|
+
cancel_signal: priorSupervision?.cancel_signal ?? opts.signal,
|
|
137
|
+
exit_signal: priorSupervision?.exit_signal ?? null,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
export async function loadExistingRunnerExecution(opts) {
|
|
142
|
+
const ctx = opts.ctx ??
|
|
143
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
144
|
+
if (opts.require_task_doing !== false) {
|
|
145
|
+
assertCurrentTaskDoing(opts.task_id, await ctx.taskBackend.getTask(opts.task_id));
|
|
146
|
+
}
|
|
147
|
+
const repository = RunnerRunRepository.forTaskRun({
|
|
148
|
+
git_root: ctx.resolvedProject.gitRoot,
|
|
149
|
+
workflow_dir: ctx.config.paths.workflow_dir,
|
|
150
|
+
task_id: opts.task_id,
|
|
151
|
+
run_id: opts.run_id,
|
|
152
|
+
});
|
|
153
|
+
const record = await repository.readRecord();
|
|
154
|
+
if (!record) {
|
|
155
|
+
throw new CliError({
|
|
156
|
+
exitCode: 4,
|
|
157
|
+
code: "E_IO",
|
|
158
|
+
message: `Runner artifacts not found for ${opts.task_id}:${opts.run_id}`,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
assertRunnerBundleMatchesTask(record.bundle, opts.task_id, opts.run_id);
|
|
162
|
+
assertRunnerTaskExecutable(record.bundle);
|
|
163
|
+
const adapter = createRunnerAdapter(ctx.config);
|
|
164
|
+
const invocation = await adapter.prepare(record.bundle);
|
|
165
|
+
return {
|
|
166
|
+
ctx,
|
|
167
|
+
bundle: record.bundle,
|
|
168
|
+
invocation,
|
|
169
|
+
state: record.state,
|
|
170
|
+
repository,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { cancelTaskRunnerExecution } from "./task-run-lifecycle-cancel.js";
|
|
2
|
+
export { resumeTaskRunnerExecution, retryTaskRunnerExecution, } from "./task-run-lifecycle-replay.js";
|
|
3
|
+
export type { CancelledTaskRunnerExecution, ResumedTaskRunnerExecution, RetriedTaskRunnerExecution, } from "./task-run-lifecycle-shared.js";
|
|
4
|
+
//# sourceMappingURL=task-run-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run-lifecycle.d.ts","sourceRoot":"","sources":["../../../src/runner/usecases/task-run-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type CommandContext } from "../../commands/shared/task-backend.js";
|
|
2
|
+
import { type RunnerContextBundle, type RunnerExecutionContract, type RunnerInvocation, type RunnerRecipeContext, type RunnerResult, type RunnerRunState, type RunnerTarget } from "../types.js";
|
|
3
|
+
export type PreparedTaskRunnerExecution = {
|
|
4
|
+
bundle: RunnerContextBundle;
|
|
5
|
+
invocation: RunnerInvocation;
|
|
6
|
+
state: RunnerRunState;
|
|
7
|
+
};
|
|
8
|
+
export type ExecutedTaskRunnerExecution = PreparedTaskRunnerExecution & {
|
|
9
|
+
result: RunnerResult;
|
|
10
|
+
};
|
|
11
|
+
export declare function assertRunnerTaskExecutable(bundle: RunnerContextBundle): void;
|
|
12
|
+
export declare function renderTaskRunnerBootstrap(bundle: RunnerContextBundle, invocation?: RunnerInvocation): string;
|
|
13
|
+
export declare function prepareTaskRunnerExecution(opts: {
|
|
14
|
+
ctx?: CommandContext;
|
|
15
|
+
cwd: string;
|
|
16
|
+
rootOverride?: string | null;
|
|
17
|
+
task_id: string;
|
|
18
|
+
mode: RunnerExecutionContract["mode"];
|
|
19
|
+
run_id?: string;
|
|
20
|
+
recipe?: RunnerRecipeContext;
|
|
21
|
+
target?: RunnerTarget;
|
|
22
|
+
}): Promise<PreparedTaskRunnerExecution>;
|
|
23
|
+
export declare function executeTaskRunnerExecution(opts: {
|
|
24
|
+
ctx?: CommandContext;
|
|
25
|
+
cwd: string;
|
|
26
|
+
rootOverride?: string | null;
|
|
27
|
+
task_id: string;
|
|
28
|
+
run_id?: string;
|
|
29
|
+
recipe?: RunnerRecipeContext;
|
|
30
|
+
target?: RunnerTarget;
|
|
31
|
+
}): Promise<ExecutedTaskRunnerExecution>;
|
|
32
|
+
//# sourceMappingURL=task-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run.d.ts","sourceRoot":"","sources":["../../../src/runner/usecases/task-run.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAgBhG,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,2BAA2B,GAAG;IACtE,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAiGF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAc5E;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,mBAAmB,EAC3B,UAAU,CAAC,EAAE,gBAAgB,GAC5B,MAAM,CAiCR;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAmFvC;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,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,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAgDvC"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
2
|
+
import { loadCommandContext } from "../../commands/shared/task-backend.js";
|
|
3
|
+
import { CliError } from "../../shared/errors.js";
|
|
4
|
+
import { evolveRunnerRunState } from "../artifacts.js";
|
|
5
|
+
import { createRunnerAdapter } from "../adapters/index.js";
|
|
6
|
+
import { readRecipeRunProfile } from "../adapters/recipe-run-profile.js";
|
|
7
|
+
import { collectRunnerBasePrompts } from "../context/base-prompts.js";
|
|
8
|
+
import { assembleRunnerTaskContext } from "../context/task-context.js";
|
|
9
|
+
import { applyRunnerPolicyRefusal, buildRunnerPolicyDecision } from "../policy-decision.js";
|
|
10
|
+
import { createRunnerRunId } from "../run-id.js";
|
|
11
|
+
import { persistRunnerOutcomeToTask } from "../task-state.js";
|
|
12
|
+
import { RunnerRunRepository } from "../run-repository.js";
|
|
13
|
+
import { resolveTaskRunnerPaths } from "../task-run-paths.js";
|
|
14
|
+
import { resolveRunnerTimeoutPolicy, resolveRunnerTracePolicy } from "../config.js";
|
|
15
|
+
import { normalizeRecipeArtifactPrefixes } from "../result-manifest-policy.js";
|
|
16
|
+
import { RUNNER_API_VERSION, RUNNER_BUNDLE_SCHEMA_VERSION, } from "../types.js";
|
|
17
|
+
class RunnerPreparationCliError extends CliError {
|
|
18
|
+
bundle;
|
|
19
|
+
state;
|
|
20
|
+
constructor(opts) {
|
|
21
|
+
super({
|
|
22
|
+
exitCode: opts.cause.exitCode,
|
|
23
|
+
code: opts.cause.code,
|
|
24
|
+
message: opts.cause.message,
|
|
25
|
+
context: opts.cause.context,
|
|
26
|
+
});
|
|
27
|
+
this.bundle = opts.bundle;
|
|
28
|
+
this.state = opts.state;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function isEnforcedCapabilityLevel(level) {
|
|
32
|
+
return level === "native" || level === "wrapper";
|
|
33
|
+
}
|
|
34
|
+
function assertRunnerPolicyCompatibility(bundle) {
|
|
35
|
+
const profile = readRecipeRunProfile(bundle.recipe);
|
|
36
|
+
if (!profile)
|
|
37
|
+
return;
|
|
38
|
+
const adapterId = bundle.execution.adapter_id;
|
|
39
|
+
const capabilities = bundle.execution.adapter_capabilities;
|
|
40
|
+
if (profile.sandbox) {
|
|
41
|
+
const sandboxCapability = capabilities?.fields.sandbox;
|
|
42
|
+
if (isEnforcedCapabilityLevel(sandboxCapability?.level) &&
|
|
43
|
+
sandboxCapability?.supported_values &&
|
|
44
|
+
!sandboxCapability.supported_values.includes(profile.sandbox)) {
|
|
45
|
+
throw new CliError({
|
|
46
|
+
exitCode: exitCodeForError("E_RUNTIME"),
|
|
47
|
+
code: "E_RUNTIME",
|
|
48
|
+
message: `Runner adapter ${JSON.stringify(adapterId)} does not support recipe sandbox ` +
|
|
49
|
+
`${JSON.stringify(profile.sandbox)}; supported values: ${sandboxCapability.supported_values.join(", ")}.`,
|
|
50
|
+
context: {
|
|
51
|
+
adapter_id: adapterId,
|
|
52
|
+
policy_field: "sandbox",
|
|
53
|
+
declared_value: profile.sandbox,
|
|
54
|
+
capability: sandboxCapability,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (profile.writes_artifacts_to && profile.writes_artifacts_to.length > 0) {
|
|
60
|
+
normalizeRecipeArtifactPrefixes(profile.writes_artifacts_to);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function writeRunnerRefusalArtifacts(opts) {
|
|
64
|
+
const repository = RunnerRunRepository.fromBundle(opts.bundle);
|
|
65
|
+
const prepared = await repository.writePrepared({
|
|
66
|
+
bundle: opts.bundle,
|
|
67
|
+
bootstrap_markdown: renderTaskRunnerBootstrap(opts.bundle),
|
|
68
|
+
});
|
|
69
|
+
const result = {
|
|
70
|
+
status: "failed",
|
|
71
|
+
exit_code: opts.error.exitCode ?? exitCodeForError("E_RUNTIME"),
|
|
72
|
+
started_at: prepared.created_at,
|
|
73
|
+
ended_at: prepared.created_at,
|
|
74
|
+
summary: opts.error.message,
|
|
75
|
+
stderr_summary: opts.error.message,
|
|
76
|
+
};
|
|
77
|
+
const refused = evolveRunnerRunState({
|
|
78
|
+
state: prepared,
|
|
79
|
+
status: "failed",
|
|
80
|
+
result,
|
|
81
|
+
updated_at: prepared.created_at,
|
|
82
|
+
});
|
|
83
|
+
await repository.writeState(refused);
|
|
84
|
+
await repository.appendEvent({
|
|
85
|
+
at: prepared.created_at,
|
|
86
|
+
type: "runner_refused",
|
|
87
|
+
message: `runner refused before adapter prepare: ${opts.error.message}`,
|
|
88
|
+
data: opts.error.context
|
|
89
|
+
? {
|
|
90
|
+
code: opts.error.code,
|
|
91
|
+
exit_code: opts.error.exitCode,
|
|
92
|
+
...opts.error.context,
|
|
93
|
+
}
|
|
94
|
+
: {
|
|
95
|
+
code: opts.error.code,
|
|
96
|
+
exit_code: opts.error.exitCode,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
return refused;
|
|
100
|
+
}
|
|
101
|
+
export function assertRunnerTaskExecutable(bundle) {
|
|
102
|
+
const task = bundle.task;
|
|
103
|
+
if (!task)
|
|
104
|
+
return;
|
|
105
|
+
const status = String(task.data.status || "TODO")
|
|
106
|
+
.trim()
|
|
107
|
+
.toUpperCase();
|
|
108
|
+
if (status === "DOING")
|
|
109
|
+
return;
|
|
110
|
+
throw new CliError({
|
|
111
|
+
exitCode: 2,
|
|
112
|
+
code: "E_USAGE",
|
|
113
|
+
message: `${task.task_id}: runner execution requires task status DOING ` +
|
|
114
|
+
`(current=${JSON.stringify(status)}; use \`agentplane task start-ready ${task.task_id} --author <ROLE> --body "Start: ..."\` first).`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export function renderTaskRunnerBootstrap(bundle, invocation) {
|
|
118
|
+
const targetLabel = bundle.target.kind === "task"
|
|
119
|
+
? `task ${bundle.target.task_id}`
|
|
120
|
+
: `recipe scenario ${bundle.target.recipe_id}:${bundle.target.scenario_id}`;
|
|
121
|
+
return [
|
|
122
|
+
"# agentplane runner bootstrap",
|
|
123
|
+
"",
|
|
124
|
+
"This invocation is already inside an approved runner execution.",
|
|
125
|
+
"- Do not run repository startup commands such as `agentplane config show`, `agentplane quickstart`, `agentplane task list`, `git status`, or `git rev-parse` unless the bundle explicitly requires them as task work.",
|
|
126
|
+
"- Do not create, approve, start, verify, finish, block, or rerun tasks unless the bundle explicitly requires task metadata edits.",
|
|
127
|
+
"- Do not recursively invoke runner entrypoints such as `agentplane task run` or `agentplane scenario execute` from inside this run.",
|
|
128
|
+
"- Open bundle.json immediately, execute the requested work directly, and stop when the requested outcome is satisfied.",
|
|
129
|
+
"",
|
|
130
|
+
`- target: ${targetLabel}`,
|
|
131
|
+
`- adapter: ${bundle.execution.adapter_id}`,
|
|
132
|
+
`- mode: ${bundle.execution.mode}`,
|
|
133
|
+
`- run_id: ${bundle.execution.run_id}`,
|
|
134
|
+
`- bundle_path: ${bundle.execution.artifact_paths.bundle_path}`,
|
|
135
|
+
`- result_path: ${bundle.execution.artifact_paths.result_path}`,
|
|
136
|
+
`- bootstrap_path: ${bundle.execution.artifact_paths.bootstrap_path}`,
|
|
137
|
+
"",
|
|
138
|
+
"Use bundle.json as the complete runner input. Do not reconstruct prompts from CLI argv.",
|
|
139
|
+
"Execute-mode runs must write a valid JSON result manifest to result_path before exiting.",
|
|
140
|
+
"Minimal manifest example:",
|
|
141
|
+
'{"schema_version":1,"status":"success","summary":"Completed.","capabilities_used":["runner.exec"]}',
|
|
142
|
+
"",
|
|
143
|
+
"Prepared invocation:",
|
|
144
|
+
"",
|
|
145
|
+
invocation
|
|
146
|
+
? `- argv: ${invocation.argv.join(" ")}`
|
|
147
|
+
: "- argv: <not prepared; preflight refused>",
|
|
148
|
+
].join("\n");
|
|
149
|
+
}
|
|
150
|
+
export async function prepareTaskRunnerExecution(opts) {
|
|
151
|
+
const ctx = opts.ctx ??
|
|
152
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
153
|
+
const taskEnvelope = await assembleRunnerTaskContext({
|
|
154
|
+
ctx,
|
|
155
|
+
cwd: opts.cwd,
|
|
156
|
+
rootOverride: opts.rootOverride ?? null,
|
|
157
|
+
task_id: opts.task_id,
|
|
158
|
+
});
|
|
159
|
+
const base_prompts = await collectRunnerBasePrompts({
|
|
160
|
+
git_root: taskEnvelope.repository.git_root,
|
|
161
|
+
owner_id: taskEnvelope.task.data.owner,
|
|
162
|
+
agents_dir: ctx.config.paths.agents_dir,
|
|
163
|
+
recipe: opts.recipe,
|
|
164
|
+
});
|
|
165
|
+
const adapter = createRunnerAdapter(ctx.config);
|
|
166
|
+
const configured_adapter_id = adapter.id === "custom" ? "custom" : "codex";
|
|
167
|
+
const run_id = opts.run_id ?? createRunnerRunId();
|
|
168
|
+
const artifact_paths = resolveTaskRunnerPaths({
|
|
169
|
+
git_root: taskEnvelope.repository.git_root,
|
|
170
|
+
workflow_dir: taskEnvelope.repository.workflow_dir,
|
|
171
|
+
task_id: opts.task_id,
|
|
172
|
+
run_id,
|
|
173
|
+
});
|
|
174
|
+
const bundle = {
|
|
175
|
+
schema_version: RUNNER_BUNDLE_SCHEMA_VERSION,
|
|
176
|
+
runner_api_version: RUNNER_API_VERSION,
|
|
177
|
+
target: opts.target ?? { kind: "task", task_id: opts.task_id },
|
|
178
|
+
base_prompts,
|
|
179
|
+
repository: taskEnvelope.repository,
|
|
180
|
+
task: taskEnvelope.task,
|
|
181
|
+
recipe: opts.recipe,
|
|
182
|
+
execution: {
|
|
183
|
+
adapter_id: configured_adapter_id,
|
|
184
|
+
mode: opts.mode,
|
|
185
|
+
run_id,
|
|
186
|
+
artifact_paths,
|
|
187
|
+
trace_policy: resolveRunnerTracePolicy(ctx.config),
|
|
188
|
+
timeout_policy: resolveRunnerTimeoutPolicy(ctx.config),
|
|
189
|
+
approvals: {
|
|
190
|
+
require_plan: ctx.config.agents?.approvals.require_plan,
|
|
191
|
+
require_verify: ctx.config.agents?.approvals.require_verify,
|
|
192
|
+
require_network: ctx.config.agents?.approvals.require_network,
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
bundle.execution.adapter_capabilities = adapter.describeCapabilities(bundle);
|
|
197
|
+
bundle.execution.policy_decision = buildRunnerPolicyDecision({
|
|
198
|
+
adapter_id: bundle.execution.adapter_id,
|
|
199
|
+
capabilities: bundle.execution.adapter_capabilities,
|
|
200
|
+
recipe: bundle.recipe,
|
|
201
|
+
});
|
|
202
|
+
assertRunnerTaskExecutable(bundle);
|
|
203
|
+
try {
|
|
204
|
+
assertRunnerPolicyCompatibility(bundle);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
if (err instanceof CliError) {
|
|
208
|
+
bundle.execution.policy_decision = applyRunnerPolicyRefusal({
|
|
209
|
+
decision: bundle.execution.policy_decision ??
|
|
210
|
+
buildRunnerPolicyDecision({
|
|
211
|
+
adapter_id: bundle.execution.adapter_id,
|
|
212
|
+
capabilities: bundle.execution.adapter_capabilities,
|
|
213
|
+
recipe: bundle.recipe,
|
|
214
|
+
}),
|
|
215
|
+
error: err,
|
|
216
|
+
});
|
|
217
|
+
const state = await writeRunnerRefusalArtifacts({ bundle, error: err });
|
|
218
|
+
throw new RunnerPreparationCliError({ cause: err, bundle, state });
|
|
219
|
+
}
|
|
220
|
+
throw err;
|
|
221
|
+
}
|
|
222
|
+
const invocation = await adapter.prepare(bundle);
|
|
223
|
+
const repository = RunnerRunRepository.fromBundle(bundle);
|
|
224
|
+
const state = await repository.writePrepared({
|
|
225
|
+
bundle,
|
|
226
|
+
bootstrap_markdown: renderTaskRunnerBootstrap(bundle, invocation),
|
|
227
|
+
invocation,
|
|
228
|
+
});
|
|
229
|
+
return { bundle, invocation, state };
|
|
230
|
+
}
|
|
231
|
+
export async function executeTaskRunnerExecution(opts) {
|
|
232
|
+
const ctx = opts.ctx ??
|
|
233
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
234
|
+
let prepared;
|
|
235
|
+
try {
|
|
236
|
+
prepared = await prepareTaskRunnerExecution({
|
|
237
|
+
ctx,
|
|
238
|
+
cwd: opts.cwd,
|
|
239
|
+
rootOverride: opts.rootOverride ?? null,
|
|
240
|
+
task_id: opts.task_id,
|
|
241
|
+
mode: "execute",
|
|
242
|
+
run_id: opts.run_id,
|
|
243
|
+
recipe: opts.recipe,
|
|
244
|
+
target: opts.target,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
if (err instanceof RunnerPreparationCliError) {
|
|
249
|
+
await persistRunnerOutcomeToTask({
|
|
250
|
+
ctx,
|
|
251
|
+
task_id: opts.task_id,
|
|
252
|
+
bundle: err.bundle,
|
|
253
|
+
state: err.state,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
throw err;
|
|
257
|
+
}
|
|
258
|
+
const adapter = createRunnerAdapter(ctx.config);
|
|
259
|
+
const result = await adapter.execute(prepared.invocation);
|
|
260
|
+
const repository = RunnerRunRepository.fromInvocation(prepared.invocation);
|
|
261
|
+
const state = (await repository.readState()) ??
|
|
262
|
+
evolveRunnerRunState({
|
|
263
|
+
state: prepared.state,
|
|
264
|
+
status: result.status,
|
|
265
|
+
result,
|
|
266
|
+
updated_at: result.ended_at,
|
|
267
|
+
});
|
|
268
|
+
await persistRunnerOutcomeToTask({
|
|
269
|
+
ctx,
|
|
270
|
+
task_id: opts.task_id,
|
|
271
|
+
bundle: prepared.bundle,
|
|
272
|
+
state,
|
|
273
|
+
});
|
|
274
|
+
return {
|
|
275
|
+
...prepared,
|
|
276
|
+
result,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-emoji.d.ts","sourceRoot":"","sources":["../../src/shared/agent-emoji.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-emoji.d.ts","sourceRoot":"","sources":["../../src/shared/agent-emoji.ts"],"names":[],"mappings":"AAmCA,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB"}
|
|
@@ -28,6 +28,7 @@ function fallbackEmojiForAgentId(agentId) {
|
|
|
28
28
|
const idx = stableHash32(agentId) % FALLBACK_EMOJIS.length;
|
|
29
29
|
return FALLBACK_EMOJIS[idx] ?? "🧩";
|
|
30
30
|
}
|
|
31
|
+
// Prefer an explicit agent-level commit_emoji before falling back to deterministic defaults.
|
|
31
32
|
export async function resolveCommitEmojiForAgent(opts) {
|
|
32
33
|
const agentId = opts.agentId.trim();
|
|
33
34
|
if (!agentId)
|
package/dist/shared/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ErrorCode = "E_USAGE" | "E_VALIDATION" | "E_IO" | "E_GIT" | "E_BACKEND" | "E_NETWORK" | "E_INTERNAL";
|
|
1
|
+
export type ErrorCode = "E_USAGE" | "E_VALIDATION" | "E_IO" | "E_GIT" | "E_BACKEND" | "E_NETWORK" | "E_RUNTIME" | "E_INTERNAL";
|
|
2
2
|
export declare class CliError extends Error {
|
|
3
3
|
readonly exitCode: number;
|
|
4
4
|
readonly code: ErrorCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,cAAc,GACd,MAAM,GACN,OAAO,GACP,WAAW,GACX,WAAW,GACX,YAAY,CAAC;AAEjB,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,IAAI,EAAE,SAAS,CAAC;IAChC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEtC,IAAI,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,SAAS,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC;CAMF;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAiBnF"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,cAAc,GACd,MAAM,GACN,OAAO,GACP,WAAW,GACX,WAAW,GACX,WAAW,GACX,YAAY,CAAC;AAEjB,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,IAAI,EAAE,SAAS,CAAC;IAChC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEtC,IAAI,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,SAAS,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC;CAMF;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAiBnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/shared/guards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/shared/guards.ts"],"names":[],"mappings":"AACA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
package/dist/shared/guards.js
CHANGED
|
@@ -9,6 +9,16 @@ export declare function taskArtifactPrefixes(opts: {
|
|
|
9
9
|
workflowDir?: string;
|
|
10
10
|
taskId?: string;
|
|
11
11
|
}): string[];
|
|
12
|
+
export declare function protectedPathAllowPrefixes(opts: {
|
|
13
|
+
tasksPath: string;
|
|
14
|
+
workflowDir?: string;
|
|
15
|
+
taskId?: string;
|
|
16
|
+
allowTasks?: boolean;
|
|
17
|
+
allowPolicy?: boolean;
|
|
18
|
+
allowConfig?: boolean;
|
|
19
|
+
allowHooks?: boolean;
|
|
20
|
+
allowCI?: boolean;
|
|
21
|
+
}): string[];
|
|
12
22
|
export declare function getProtectedPathOverride(kind: ProtectedPathKind): ProtectedPathOverride;
|
|
13
23
|
export declare function protectedPathKindForFile(opts: {
|
|
14
24
|
filePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protected-paths.d.ts","sourceRoot":"","sources":["../../src/shared/protected-paths.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAYF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,EAAE,CAOX;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,CAkBvF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,iBAAiB,GAAG,IAAI,CAsC3B"}
|
|
1
|
+
{"version":3,"file":"protected-paths.d.ts","sourceRoot":"","sources":["../../src/shared/protected-paths.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAYF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,EAAE,CAOX;AAYD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,MAAM,EAAE,CAkBX;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,CAkBvF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,iBAAiB,GAAG,IAAI,CAsC3B"}
|
|
@@ -16,6 +16,39 @@ export function taskArtifactPrefixes(opts) {
|
|
|
16
16
|
out.add(workflowPrefix);
|
|
17
17
|
return [...out].toSorted((a, b) => a.localeCompare(b));
|
|
18
18
|
}
|
|
19
|
+
const POLICY_PATH_PREFIXES = [
|
|
20
|
+
"AGENTS.md",
|
|
21
|
+
"CLAUDE.md",
|
|
22
|
+
"packages/agentplane/assets/AGENTS.md",
|
|
23
|
+
".agentplane/agents",
|
|
24
|
+
];
|
|
25
|
+
const CONFIG_PATH_PREFIXES = [".agentplane/config.json", ".agentplane/backends"];
|
|
26
|
+
const HOOK_PATH_PREFIXES = ["lefthook.yml"];
|
|
27
|
+
const CI_PATH_PREFIXES = [".github/workflows", ".github/actions"];
|
|
28
|
+
export function protectedPathAllowPrefixes(opts) {
|
|
29
|
+
const out = new Set();
|
|
30
|
+
if (opts.allowTasks) {
|
|
31
|
+
for (const prefix of taskArtifactPrefixes(opts))
|
|
32
|
+
out.add(prefix);
|
|
33
|
+
}
|
|
34
|
+
if (opts.allowPolicy) {
|
|
35
|
+
for (const prefix of POLICY_PATH_PREFIXES)
|
|
36
|
+
out.add(prefix);
|
|
37
|
+
}
|
|
38
|
+
if (opts.allowConfig) {
|
|
39
|
+
for (const prefix of CONFIG_PATH_PREFIXES)
|
|
40
|
+
out.add(prefix);
|
|
41
|
+
}
|
|
42
|
+
if (opts.allowHooks) {
|
|
43
|
+
for (const prefix of HOOK_PATH_PREFIXES)
|
|
44
|
+
out.add(prefix);
|
|
45
|
+
}
|
|
46
|
+
if (opts.allowCI) {
|
|
47
|
+
for (const prefix of CI_PATH_PREFIXES)
|
|
48
|
+
out.add(prefix);
|
|
49
|
+
}
|
|
50
|
+
return [...out].toSorted((a, b) => a.localeCompare(b));
|
|
51
|
+
}
|
|
19
52
|
export function getProtectedPathOverride(kind) {
|
|
20
53
|
switch (kind) {
|
|
21
54
|
case "tasks": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-cli-version.d.ts","sourceRoot":"","sources":["../../src/shared/repo-cli-version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"repo-cli-version.d.ts","sourceRoot":"","sources":["../../src/shared/repo-cli-version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQ5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,WAAW,GACX,qBAAqB,GACrB,2BAA2B,CAAC;AAEhC,MAAM,MAAM,yBAAyB,GAAG;IACtC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,mBAAmB,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAKjF;AA+BD,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,GACzB,yBAAyB,CAuC3B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FRAMEWORK_DEV_BOOTSTRAP_COMMAND, FRAMEWORK_DEV_GLOBAL_VERIFY_COMMAND, FRAMEWORK_DEV_REINSTALL_SCRIPT, FRAMEWORK_DEV_REPO_LOCAL_VERIFY_COMMAND, } from "../../bin/framework-dev-contract.js";
|
|
1
2
|
import { compareVersions } from "./version-compare.js";
|
|
2
3
|
export function getRepoExpectedCliVersion(config) {
|
|
3
4
|
const raw = config.framework.cli.expected_version;
|
|
@@ -9,22 +10,23 @@ export function getRepoExpectedCliVersion(config) {
|
|
|
9
10
|
function buildRecovery(runtime, expectedVersion) {
|
|
10
11
|
switch (runtime.mode) {
|
|
11
12
|
case "global-installed": {
|
|
12
|
-
return `Run: npm i -g agentplane@${expectedVersion}. Then verify:
|
|
13
|
+
return `Run: npm i -g agentplane@${expectedVersion}. Then verify: ${FRAMEWORK_DEV_GLOBAL_VERIFY_COMMAND}`;
|
|
13
14
|
}
|
|
14
15
|
case "global-in-framework":
|
|
15
16
|
case "global-forced-in-framework": {
|
|
16
17
|
const prefix = runtime.mode === "global-forced-in-framework"
|
|
17
18
|
? "Unset AGENTPLANE_USE_GLOBAL_IN_FRAMEWORK=1 if forced global mode is not intentional. "
|
|
18
19
|
: "";
|
|
19
|
-
return (`${prefix}Run:
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
return (`${prefix}Run: ${FRAMEWORK_DEV_BOOTSTRAP_COMMAND}. ` +
|
|
21
|
+
`If the global PATH command should resolve this checkout, then run: ${FRAMEWORK_DEV_REINSTALL_SCRIPT}. ` +
|
|
22
|
+
`Repo-local verify: ${FRAMEWORK_DEV_REPO_LOCAL_VERIFY_COMMAND}. ` +
|
|
23
|
+
`Then verify: ${FRAMEWORK_DEV_GLOBAL_VERIFY_COMMAND}`);
|
|
22
24
|
}
|
|
23
25
|
case "repo-local":
|
|
24
26
|
case "repo-local-handoff": {
|
|
25
27
|
return (`Sync this framework checkout to agentplane ${expectedVersion} or lower ` +
|
|
26
28
|
"framework.cli.expected_version if the repository intentionally targets an older CLI. " +
|
|
27
|
-
|
|
29
|
+
`Then verify: ${FRAMEWORK_DEV_REPO_LOCAL_VERIFY_COMMAND}`);
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function assertExpectedTaskDoc(opts: {
|
|
2
|
+
taskId: string;
|
|
3
|
+
currentDoc: string;
|
|
4
|
+
expectedDoc: string | null | undefined;
|
|
5
|
+
}): void;
|
|
6
|
+
export declare function assertExpectedTaskSection(opts: {
|
|
7
|
+
taskId: string;
|
|
8
|
+
currentDoc: string;
|
|
9
|
+
section: string;
|
|
10
|
+
expectedText: string | null | undefined;
|
|
11
|
+
}): void;
|
|
12
|
+
//# sourceMappingURL=task-doc-conflicts.d.ts.map
|