agentplane 0.3.7 → 0.3.9
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 +692 -337
- 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 +122 -12
- 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/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +8 -4
- 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.js +1 -1
- package/dist/commands/recipes/impl/commands/explain.js +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.js +1 -1
- 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.map +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.js +1 -1
- 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.map +1 -1
- 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 +34 -0
- package/dist/commands/release.test-helpers.d.ts.map +1 -0
- package/dist/commands/release.test-helpers.js +48 -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 +2 -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,222 @@
|
|
|
1
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { CliError } from "../shared/errors.js";
|
|
4
|
+
import { appendRunnerEvent, readRunnerRunState, writePreparedRunnerArtifacts, writeRunnerRunState, } from "./artifacts.js";
|
|
5
|
+
import { resolveTaskRunnerPaths } from "./task-run-paths.js";
|
|
6
|
+
import { readTraceArtifactText } from "./trace-artifacts.js";
|
|
7
|
+
function parseTimestamp(value) {
|
|
8
|
+
const parsed = typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
9
|
+
return Number.isNaN(parsed) ? Number.NEGATIVE_INFINITY : parsed;
|
|
10
|
+
}
|
|
11
|
+
export function parseRunnerEventsText(text) {
|
|
12
|
+
return text
|
|
13
|
+
.split(/\r?\n/u)
|
|
14
|
+
.map((line) => line.trim())
|
|
15
|
+
.filter((line) => line.length > 0)
|
|
16
|
+
.flatMap((line) => {
|
|
17
|
+
try {
|
|
18
|
+
return [JSON.parse(line)];
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function readOptionalJson(filePath) {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(await readFile(filePath, "utf8"));
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
const code = err?.code;
|
|
31
|
+
if (code === "ENOENT")
|
|
32
|
+
return null;
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function readRequiredText(opts) {
|
|
37
|
+
try {
|
|
38
|
+
return await readFile(opts.file_path, "utf8");
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
const code = err?.code;
|
|
42
|
+
if (code === "ENOENT") {
|
|
43
|
+
throw new CliError({
|
|
44
|
+
exitCode: 4,
|
|
45
|
+
code: "E_IO",
|
|
46
|
+
message: `Runner artifact not found for ${opts.task_id}:${opts.run_id} ` +
|
|
47
|
+
`(${opts.artifact_label} at ${opts.file_path})`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function assertRunnerBundleMatchesTask(bundle, taskId, runId) {
|
|
54
|
+
const bundleTaskId = bundle.task?.task_id ??
|
|
55
|
+
(bundle.target.kind === "task" ? bundle.target.task_id : (bundle.target.task_id ?? null));
|
|
56
|
+
if (bundle.execution.run_id !== runId) {
|
|
57
|
+
throw new CliError({
|
|
58
|
+
exitCode: 4,
|
|
59
|
+
code: "E_IO",
|
|
60
|
+
message: `Runner bundle/run mismatch for ${taskId}:${runId} (bundle.run_id=${bundle.execution.run_id})`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (!bundleTaskId || bundleTaskId !== taskId) {
|
|
64
|
+
throw new CliError({
|
|
65
|
+
exitCode: 4,
|
|
66
|
+
code: "E_IO",
|
|
67
|
+
message: `Runner bundle/task mismatch for ${taskId}:${runId}`,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export class RunnerRunRepository {
|
|
72
|
+
paths;
|
|
73
|
+
constructor(paths) {
|
|
74
|
+
this.paths = paths;
|
|
75
|
+
}
|
|
76
|
+
static forTaskRun(opts) {
|
|
77
|
+
return new RunnerRunRepository(resolveTaskRunnerPaths({
|
|
78
|
+
git_root: opts.git_root,
|
|
79
|
+
workflow_dir: opts.workflow_dir,
|
|
80
|
+
task_id: opts.task_id,
|
|
81
|
+
run_id: opts.run_id,
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
static fromBundle(bundle) {
|
|
85
|
+
return new RunnerRunRepository(bundle.execution.artifact_paths);
|
|
86
|
+
}
|
|
87
|
+
static fromInvocation(invocation) {
|
|
88
|
+
return new RunnerRunRepository({
|
|
89
|
+
run_dir: invocation.run_dir,
|
|
90
|
+
bundle_path: invocation.bundle_path,
|
|
91
|
+
bootstrap_path: invocation.bootstrap_path ?? "",
|
|
92
|
+
state_path: invocation.state_path,
|
|
93
|
+
events_path: invocation.events_path,
|
|
94
|
+
result_path: invocation.result_path,
|
|
95
|
+
trace_path: invocation.trace_path,
|
|
96
|
+
stderr_path: invocation.stderr_path,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async writePrepared(opts) {
|
|
100
|
+
return await writePreparedRunnerArtifacts(opts);
|
|
101
|
+
}
|
|
102
|
+
async readBundle() {
|
|
103
|
+
return await readOptionalJson(this.paths.bundle_path);
|
|
104
|
+
}
|
|
105
|
+
async readState() {
|
|
106
|
+
return await readRunnerRunState(this.paths.state_path);
|
|
107
|
+
}
|
|
108
|
+
async readRecord() {
|
|
109
|
+
const [bundle, state] = await Promise.all([this.readBundle(), this.readState()]);
|
|
110
|
+
if (!bundle || !state)
|
|
111
|
+
return null;
|
|
112
|
+
return {
|
|
113
|
+
bundle,
|
|
114
|
+
state,
|
|
115
|
+
result: state.result ?? null,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async readRequiredRecord(opts) {
|
|
119
|
+
const record = await this.readRecord();
|
|
120
|
+
if (!record) {
|
|
121
|
+
throw new CliError({
|
|
122
|
+
exitCode: 4,
|
|
123
|
+
code: "E_IO",
|
|
124
|
+
message: `Runner artifact not found for ${opts.task_id}:${opts.run_id}`,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
assertRunnerBundleMatchesTask(record.bundle, opts.task_id, opts.run_id);
|
|
128
|
+
return record;
|
|
129
|
+
}
|
|
130
|
+
async writeState(state) {
|
|
131
|
+
await writeRunnerRunState({
|
|
132
|
+
state_path: this.paths.state_path,
|
|
133
|
+
state,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async appendEvent(event) {
|
|
137
|
+
await appendRunnerEvent({
|
|
138
|
+
events_path: this.paths.events_path,
|
|
139
|
+
event,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async readEventsTextRequired(opts) {
|
|
143
|
+
return await readRequiredText({
|
|
144
|
+
file_path: this.paths.events_path,
|
|
145
|
+
task_id: opts.task_id,
|
|
146
|
+
run_id: opts.run_id,
|
|
147
|
+
artifact_label: "events",
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async readEventsRequired(opts) {
|
|
151
|
+
const events_text = await this.readEventsTextRequired(opts);
|
|
152
|
+
return {
|
|
153
|
+
events_text,
|
|
154
|
+
events: parseRunnerEventsText(events_text),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
async readTraceTextRequired(opts) {
|
|
158
|
+
try {
|
|
159
|
+
return await readTraceArtifactText(this.paths.trace_path);
|
|
160
|
+
}
|
|
161
|
+
catch (err) {
|
|
162
|
+
const code = err?.code;
|
|
163
|
+
if (code === "ENOENT") {
|
|
164
|
+
throw new CliError({
|
|
165
|
+
exitCode: 4,
|
|
166
|
+
code: "E_IO",
|
|
167
|
+
message: `Runner artifact not found for ${opts.task_id}:${opts.run_id} ` +
|
|
168
|
+
`(trace at ${this.paths.trace_path} or ${this.paths.trace_path}.gz)`,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export async function resolveLatestRunnerRunId(opts) {
|
|
176
|
+
const runsDir = path.join(opts.git_root, opts.workflow_dir, opts.task_id, "runs");
|
|
177
|
+
let entries = [];
|
|
178
|
+
try {
|
|
179
|
+
const runEntries = await readdir(runsDir, { withFileTypes: true });
|
|
180
|
+
entries = runEntries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
const code = err?.code;
|
|
184
|
+
if (code === "ENOENT") {
|
|
185
|
+
throw new CliError({
|
|
186
|
+
exitCode: 4,
|
|
187
|
+
code: "E_IO",
|
|
188
|
+
message: `No runner runs found for task ${opts.task_id}`,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
throw err;
|
|
192
|
+
}
|
|
193
|
+
const candidates = await Promise.all(entries.map(async (runId) => {
|
|
194
|
+
const repository = RunnerRunRepository.forTaskRun({
|
|
195
|
+
git_root: opts.git_root,
|
|
196
|
+
workflow_dir: opts.workflow_dir,
|
|
197
|
+
task_id: opts.task_id,
|
|
198
|
+
run_id: runId,
|
|
199
|
+
});
|
|
200
|
+
const state = await repository.readState();
|
|
201
|
+
if (!state)
|
|
202
|
+
return null;
|
|
203
|
+
return {
|
|
204
|
+
run_id: runId,
|
|
205
|
+
updated_at: parseTimestamp(state.updated_at),
|
|
206
|
+
created_at: parseTimestamp(state.created_at),
|
|
207
|
+
};
|
|
208
|
+
}));
|
|
209
|
+
const latest = candidates
|
|
210
|
+
.filter((entry) => entry !== null)
|
|
211
|
+
.toSorted((left, right) => right.updated_at - left.updated_at ||
|
|
212
|
+
right.created_at - left.created_at ||
|
|
213
|
+
right.run_id.localeCompare(left.run_id))[0];
|
|
214
|
+
if (!latest) {
|
|
215
|
+
throw new CliError({
|
|
216
|
+
exitCode: 4,
|
|
217
|
+
code: "E_IO",
|
|
218
|
+
message: `No runner runs found for task ${opts.task_id}`,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return latest.run_id;
|
|
222
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RunnerArtifactPaths } from "./types.js";
|
|
2
|
+
export declare const RUNNER_BUNDLE_FILENAME = "bundle.json";
|
|
3
|
+
export declare const RUNNER_BOOTSTRAP_FILENAME = "bootstrap.md";
|
|
4
|
+
export declare const RUNNER_STATE_FILENAME = "run-state.json";
|
|
5
|
+
export declare const RUNNER_EVENTS_FILENAME = "events.jsonl";
|
|
6
|
+
export declare const RUNNER_RESULT_FILENAME = "result.json";
|
|
7
|
+
export declare const RUNNER_TRACE_FILENAME = "agent-trace.jsonl";
|
|
8
|
+
export declare const RUNNER_STDERR_FILENAME = "stderr.log";
|
|
9
|
+
export type TaskRunnerPaths = RunnerArtifactPaths & {
|
|
10
|
+
task_dir: string;
|
|
11
|
+
runs_dir: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function resolveTaskRunnerPaths(opts: {
|
|
14
|
+
git_root: string;
|
|
15
|
+
workflow_dir: string;
|
|
16
|
+
task_id: string;
|
|
17
|
+
run_id: string;
|
|
18
|
+
}): TaskRunnerPaths;
|
|
19
|
+
//# sourceMappingURL=task-run-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run-paths.d.ts","sourceRoot":"","sources":["../../src/runner/task-run-paths.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AACxD,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AACrD,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,eAAe,CAgBlB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
export const RUNNER_BUNDLE_FILENAME = "bundle.json";
|
|
3
|
+
export const RUNNER_BOOTSTRAP_FILENAME = "bootstrap.md";
|
|
4
|
+
export const RUNNER_STATE_FILENAME = "run-state.json";
|
|
5
|
+
export const RUNNER_EVENTS_FILENAME = "events.jsonl";
|
|
6
|
+
export const RUNNER_RESULT_FILENAME = "result.json";
|
|
7
|
+
export const RUNNER_TRACE_FILENAME = "agent-trace.jsonl";
|
|
8
|
+
export const RUNNER_STDERR_FILENAME = "stderr.log";
|
|
9
|
+
export function resolveTaskRunnerPaths(opts) {
|
|
10
|
+
const task_dir = path.join(opts.git_root, opts.workflow_dir, opts.task_id);
|
|
11
|
+
const runs_dir = path.join(task_dir, "runs");
|
|
12
|
+
const run_dir = path.join(runs_dir, opts.run_id);
|
|
13
|
+
return {
|
|
14
|
+
task_dir,
|
|
15
|
+
runs_dir,
|
|
16
|
+
run_dir,
|
|
17
|
+
bundle_path: path.join(run_dir, RUNNER_BUNDLE_FILENAME),
|
|
18
|
+
bootstrap_path: path.join(run_dir, RUNNER_BOOTSTRAP_FILENAME),
|
|
19
|
+
state_path: path.join(run_dir, RUNNER_STATE_FILENAME),
|
|
20
|
+
events_path: path.join(run_dir, RUNNER_EVENTS_FILENAME),
|
|
21
|
+
result_path: path.join(run_dir, RUNNER_RESULT_FILENAME),
|
|
22
|
+
trace_path: path.join(run_dir, RUNNER_TRACE_FILENAME),
|
|
23
|
+
stderr_path: path.join(run_dir, RUNNER_STDERR_FILENAME),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CommandContext } from "../commands/shared/task-backend.js";
|
|
2
|
+
import type { RunnerContextBundle, RunnerRunState } from "./types.js";
|
|
3
|
+
export declare function persistRunnerOutcomeToTask(opts: {
|
|
4
|
+
ctx: CommandContext;
|
|
5
|
+
task_id: string;
|
|
6
|
+
state: RunnerRunState;
|
|
7
|
+
bundle?: RunnerContextBundle;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=task-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-state.d.ts","sourceRoot":"","sources":["../../src/runner/task-state.ts"],"names":[],"mappings":"AAQA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAgB9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAgTpF,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B,GAAG,OAAO,CAAC,IAAI,CAAC,CA8FhB"}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { ensureDocSections, setMarkdownSection } from "@agentplaneorg/core";
|
|
2
|
+
import { backendNotSupportedMessage } from "../cli/output.js";
|
|
3
|
+
import { loadTaskFromContext } from "../commands/shared/task-backend.js";
|
|
4
|
+
import { backendIsLocalFileBackend, getTaskStore, setTaskFieldsIntent, setTaskSectionIntent, touchTaskDocMetaIntent, } from "../commands/shared/task-store.js";
|
|
5
|
+
import { extractDocSection, normalizeTaskDocVersion, resolveWritableDocSections, taskObservationSectionName, } from "../commands/task/shared.js";
|
|
6
|
+
import { CliError } from "../shared/errors.js";
|
|
7
|
+
const RUNNER_OUTCOME_BEGIN = "<!-- BEGIN RUNNER OUTCOME -->";
|
|
8
|
+
const RUNNER_OUTCOME_END = "<!-- END RUNNER OUTCOME -->";
|
|
9
|
+
const MAX_TASK_RUNNER_HISTORY = 5;
|
|
10
|
+
function formatRunnerTarget(target) {
|
|
11
|
+
if (target.kind === "task")
|
|
12
|
+
return `task ${target.task_id}`;
|
|
13
|
+
const base = `recipe ${target.recipe_id}:${target.scenario_id}`;
|
|
14
|
+
return target.task_id ? `${base} -> task ${target.task_id}` : base;
|
|
15
|
+
}
|
|
16
|
+
function normalizeRunnerOutcomeSection(sectionText) {
|
|
17
|
+
const normalized = (sectionText ?? "").replaceAll("\r\n", "\n").trimEnd();
|
|
18
|
+
if (!normalized)
|
|
19
|
+
return [RUNNER_OUTCOME_BEGIN, RUNNER_OUTCOME_END].join("\n");
|
|
20
|
+
const hasBegin = normalized.includes(RUNNER_OUTCOME_BEGIN);
|
|
21
|
+
const hasEnd = normalized.includes(RUNNER_OUTCOME_END);
|
|
22
|
+
if (hasBegin && hasEnd)
|
|
23
|
+
return normalized;
|
|
24
|
+
return [normalized, "", RUNNER_OUTCOME_BEGIN, RUNNER_OUTCOME_END].join("\n");
|
|
25
|
+
}
|
|
26
|
+
function replaceRunnerOutcomeSection(sectionText, entryText) {
|
|
27
|
+
const normalized = normalizeRunnerOutcomeSection(sectionText);
|
|
28
|
+
const beginIdx = normalized.indexOf(RUNNER_OUTCOME_BEGIN);
|
|
29
|
+
const endIdx = normalized.indexOf(RUNNER_OUTCOME_END);
|
|
30
|
+
if (beginIdx === -1 || endIdx === -1 || endIdx <= beginIdx) {
|
|
31
|
+
throw new Error("Runner outcome markers are malformed");
|
|
32
|
+
}
|
|
33
|
+
const beforeBegin = normalized.slice(0, beginIdx).trimEnd();
|
|
34
|
+
const afterEnd = normalized.slice(endIdx + RUNNER_OUTCOME_END.length).trimStart();
|
|
35
|
+
const parts = [];
|
|
36
|
+
if (beforeBegin)
|
|
37
|
+
parts.push(beforeBegin, "");
|
|
38
|
+
parts.push(RUNNER_OUTCOME_BEGIN);
|
|
39
|
+
if (entryText.trim())
|
|
40
|
+
parts.push("", entryText.trimEnd());
|
|
41
|
+
parts.push("", RUNNER_OUTCOME_END);
|
|
42
|
+
if (afterEnd)
|
|
43
|
+
parts.push("", afterEnd);
|
|
44
|
+
return parts.join("\n").trimEnd();
|
|
45
|
+
}
|
|
46
|
+
function runArtifactsDirForTask(taskId, runId) {
|
|
47
|
+
return `.agentplane/tasks/${taskId}/runs/${runId}`;
|
|
48
|
+
}
|
|
49
|
+
function formatRunnerAdapterLabel(adapterId) {
|
|
50
|
+
const normalized = adapterId.trim();
|
|
51
|
+
if (!normalized)
|
|
52
|
+
return "Runner";
|
|
53
|
+
return normalized.slice(0, 1).toUpperCase() + normalized.slice(1);
|
|
54
|
+
}
|
|
55
|
+
function renderTaskRunnerSummary(opts) {
|
|
56
|
+
const adapter = formatRunnerAdapterLabel(opts.adapter_id);
|
|
57
|
+
if (opts.status === "prepared")
|
|
58
|
+
return `${adapter} runner is prepared.`;
|
|
59
|
+
if (opts.status === "running")
|
|
60
|
+
return `${adapter} runner is running.`;
|
|
61
|
+
if (opts.status === "success")
|
|
62
|
+
return `${adapter} runner completed successfully.`;
|
|
63
|
+
if (opts.status === "cancelled")
|
|
64
|
+
return `${adapter} runner was cancelled.`;
|
|
65
|
+
return `${adapter} runner failed; inspect run artifacts for details.`;
|
|
66
|
+
}
|
|
67
|
+
function stripRunnerHistory(outcome) {
|
|
68
|
+
return {
|
|
69
|
+
run_id: outcome.run_id,
|
|
70
|
+
status: outcome.status,
|
|
71
|
+
adapter_id: outcome.adapter_id,
|
|
72
|
+
mode: outcome.mode,
|
|
73
|
+
updated_at: outcome.updated_at,
|
|
74
|
+
...(outcome.started_at ? { started_at: outcome.started_at } : {}),
|
|
75
|
+
...(outcome.ended_at ? { ended_at: outcome.ended_at } : {}),
|
|
76
|
+
exit_code: outcome.exit_code,
|
|
77
|
+
target: { ...outcome.target },
|
|
78
|
+
...(outcome.summary ? { summary: outcome.summary } : {}),
|
|
79
|
+
...(outcome.output_paths?.length ? { output_paths: [...outcome.output_paths] } : {}),
|
|
80
|
+
...(outcome.metrics ? { metrics: { ...outcome.metrics } } : {}),
|
|
81
|
+
...(outcome.evidence ? { evidence: { ...outcome.evidence } } : {}),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function runnerHistoryFromTask(outcome) {
|
|
85
|
+
if (!outcome)
|
|
86
|
+
return [];
|
|
87
|
+
if (outcome.history?.length)
|
|
88
|
+
return outcome.history.map((entry) => stripRunnerHistory(entry));
|
|
89
|
+
return [stripRunnerHistory(outcome)];
|
|
90
|
+
}
|
|
91
|
+
function renderRunnerMetrics(metrics) {
|
|
92
|
+
if (!metrics)
|
|
93
|
+
return null;
|
|
94
|
+
const pairs = [];
|
|
95
|
+
if (typeof metrics.duration_ms === "number")
|
|
96
|
+
pairs.push(`duration_ms=${metrics.duration_ms}`);
|
|
97
|
+
if (typeof metrics.stdout_bytes === "number")
|
|
98
|
+
pairs.push(`stdout_bytes=${metrics.stdout_bytes}`);
|
|
99
|
+
if (typeof metrics.stderr_bytes === "number")
|
|
100
|
+
pairs.push(`stderr_bytes=${metrics.stderr_bytes}`);
|
|
101
|
+
if (metrics.output_last_message_bytes === null ||
|
|
102
|
+
typeof metrics.output_last_message_bytes === "number") {
|
|
103
|
+
pairs.push(`output_last_message_bytes=${metrics.output_last_message_bytes ?? "null"}`);
|
|
104
|
+
}
|
|
105
|
+
return pairs.length > 0 ? pairs.join(", ") : null;
|
|
106
|
+
}
|
|
107
|
+
function renderVerificationHint(status) {
|
|
108
|
+
if (status === "success") {
|
|
109
|
+
return "runner completed successfully; human verification and closure remain explicit lifecycle steps.";
|
|
110
|
+
}
|
|
111
|
+
if (status === "failed") {
|
|
112
|
+
return "runner failed; inspect artifacts before retrying or recording verification evidence.";
|
|
113
|
+
}
|
|
114
|
+
if (status === "cancelled") {
|
|
115
|
+
return "runner was cancelled; verification evidence is incomplete until a later run succeeds.";
|
|
116
|
+
}
|
|
117
|
+
if (status === "running") {
|
|
118
|
+
return "runner is still executing; verification evidence is not complete yet.";
|
|
119
|
+
}
|
|
120
|
+
return "runner is prepared but has not produced verification-relevant output yet.";
|
|
121
|
+
}
|
|
122
|
+
function renderRunnerEvidence(evidence) {
|
|
123
|
+
if (!evidence)
|
|
124
|
+
return [];
|
|
125
|
+
const lines = [];
|
|
126
|
+
if (evidence.evidence_paths?.length) {
|
|
127
|
+
lines.push(`EvidencePaths: ${evidence.evidence_paths.join(", ")}`);
|
|
128
|
+
}
|
|
129
|
+
if (evidence.changed_paths?.length) {
|
|
130
|
+
lines.push(`ChangedPaths: ${evidence.changed_paths.join(", ")}`);
|
|
131
|
+
}
|
|
132
|
+
if (typeof evidence.files_changed_count === "number") {
|
|
133
|
+
lines.push(`FilesChangedCount: ${evidence.files_changed_count}`);
|
|
134
|
+
}
|
|
135
|
+
if (evidence.tests_run?.length) {
|
|
136
|
+
lines.push(`TestsRun: ${evidence.tests_run.join(" | ")}`);
|
|
137
|
+
}
|
|
138
|
+
if (evidence.verification_candidates?.length) {
|
|
139
|
+
lines.push(`VerificationCandidates: ${evidence.verification_candidates.join(" | ")}`);
|
|
140
|
+
}
|
|
141
|
+
return lines;
|
|
142
|
+
}
|
|
143
|
+
function renderRunnerOutcomeEntry(opts) {
|
|
144
|
+
const summary = opts.entry.summary ??
|
|
145
|
+
renderTaskRunnerSummary({
|
|
146
|
+
adapter_id: opts.entry.adapter_id,
|
|
147
|
+
status: opts.entry.status,
|
|
148
|
+
});
|
|
149
|
+
const capabilitiesUsed = opts.projection?.result?.capabilities_used;
|
|
150
|
+
const entryOutputPaths = opts.entry.output_paths;
|
|
151
|
+
const entryMetrics = opts.entry.metrics;
|
|
152
|
+
const entryEvidence = opts.entry.evidence;
|
|
153
|
+
const lines = [
|
|
154
|
+
`#### ${opts.entry.updated_at} — RUNNER — ${opts.entry.status}`,
|
|
155
|
+
"",
|
|
156
|
+
`RunId: ${opts.entry.run_id}`,
|
|
157
|
+
"",
|
|
158
|
+
`Adapter: ${opts.entry.adapter_id}`,
|
|
159
|
+
"",
|
|
160
|
+
`Mode: ${opts.entry.mode}`,
|
|
161
|
+
"",
|
|
162
|
+
`Target: ${formatRunnerTarget(opts.entry.target)}`,
|
|
163
|
+
"",
|
|
164
|
+
`UpdatedAt: ${opts.entry.updated_at}`,
|
|
165
|
+
"",
|
|
166
|
+
`RunArtifacts: ${runArtifactsDirForTask(opts.task_id, opts.entry.run_id)}`,
|
|
167
|
+
"",
|
|
168
|
+
`ExitCode: ${opts.entry.exit_code ?? "null"}`,
|
|
169
|
+
];
|
|
170
|
+
if (opts.entry.started_at) {
|
|
171
|
+
lines.push("", `StartedAt: ${opts.entry.started_at}`);
|
|
172
|
+
}
|
|
173
|
+
if (opts.entry.ended_at) {
|
|
174
|
+
lines.push("", `EndedAt: ${opts.entry.ended_at}`);
|
|
175
|
+
}
|
|
176
|
+
if (summary) {
|
|
177
|
+
lines.push("", `Summary: ${summary}`);
|
|
178
|
+
}
|
|
179
|
+
if (opts.projection?.result?.artifacts?.length) {
|
|
180
|
+
lines.push("", `Artifacts: ${opts.projection.result.artifacts
|
|
181
|
+
.map((artifact) => (artifact.label ? `${artifact.label}=${artifact.path}` : artifact.path))
|
|
182
|
+
.join(", ")}`);
|
|
183
|
+
}
|
|
184
|
+
if (!opts.projection?.result?.artifacts?.length && entryOutputPaths?.length) {
|
|
185
|
+
lines.push("", `Outputs: ${entryOutputPaths.join(", ")}`);
|
|
186
|
+
}
|
|
187
|
+
if (capabilitiesUsed?.length) {
|
|
188
|
+
lines.push("", `Capabilities: ${capabilitiesUsed.join(", ")}`);
|
|
189
|
+
}
|
|
190
|
+
const metrics = renderRunnerMetrics(entryMetrics);
|
|
191
|
+
if (metrics) {
|
|
192
|
+
lines.push("", `Metrics: ${metrics}`);
|
|
193
|
+
}
|
|
194
|
+
const evidenceLines = renderRunnerEvidence(entryEvidence);
|
|
195
|
+
if (evidenceLines.length > 0) {
|
|
196
|
+
lines.push("", ...evidenceLines);
|
|
197
|
+
}
|
|
198
|
+
lines.push("", `VerificationHint: ${renderVerificationHint(opts.entry.status)}`);
|
|
199
|
+
return `${lines.join("\n").trimEnd()}\n`;
|
|
200
|
+
}
|
|
201
|
+
function buildTaskRunnerHistoryEntry(projection) {
|
|
202
|
+
const { state, result } = projection;
|
|
203
|
+
const outcome = {
|
|
204
|
+
run_id: state.run_id,
|
|
205
|
+
status: state.status,
|
|
206
|
+
adapter_id: state.adapter_id,
|
|
207
|
+
mode: state.mode,
|
|
208
|
+
updated_at: state.updated_at,
|
|
209
|
+
exit_code: state.result?.exit_code ?? null,
|
|
210
|
+
target: { ...state.target },
|
|
211
|
+
};
|
|
212
|
+
if (result?.started_at)
|
|
213
|
+
outcome.started_at = result.started_at;
|
|
214
|
+
if (result?.ended_at)
|
|
215
|
+
outcome.ended_at = result.ended_at;
|
|
216
|
+
outcome.summary = renderTaskRunnerSummary({
|
|
217
|
+
adapter_id: state.adapter_id,
|
|
218
|
+
status: state.status,
|
|
219
|
+
});
|
|
220
|
+
if (result?.output_paths?.length)
|
|
221
|
+
outcome.output_paths = [...result.output_paths];
|
|
222
|
+
if (result?.metrics)
|
|
223
|
+
outcome.metrics = { ...result.metrics };
|
|
224
|
+
if (result?.evidence)
|
|
225
|
+
outcome.evidence = { ...result.evidence };
|
|
226
|
+
return outcome;
|
|
227
|
+
}
|
|
228
|
+
function mergeTaskRunnerHistory(opts) {
|
|
229
|
+
const merged = [];
|
|
230
|
+
const seen = new Set();
|
|
231
|
+
for (const entry of [opts.latest, ...runnerHistoryFromTask(opts.previous)]) {
|
|
232
|
+
if (seen.has(entry.run_id))
|
|
233
|
+
continue;
|
|
234
|
+
seen.add(entry.run_id);
|
|
235
|
+
merged.push(stripRunnerHistory(entry));
|
|
236
|
+
if (merged.length >= MAX_TASK_RUNNER_HISTORY)
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
return merged;
|
|
240
|
+
}
|
|
241
|
+
function buildTaskRunnerOutcome(opts) {
|
|
242
|
+
const latest = buildTaskRunnerHistoryEntry(opts.projection);
|
|
243
|
+
const history = mergeTaskRunnerHistory({ latest, previous: opts.previous });
|
|
244
|
+
return history.length > 1 ? { ...latest, history } : latest;
|
|
245
|
+
}
|
|
246
|
+
function renderRunnerOutcomeHistory(opts) {
|
|
247
|
+
const history = opts.outcome.history?.length
|
|
248
|
+
? opts.outcome.history
|
|
249
|
+
: [stripRunnerHistory(opts.outcome)];
|
|
250
|
+
const [latest, ...previous] = history;
|
|
251
|
+
return [
|
|
252
|
+
renderRunnerOutcomeEntry({
|
|
253
|
+
task_id: opts.task_id,
|
|
254
|
+
entry: latest,
|
|
255
|
+
projection: opts.projection,
|
|
256
|
+
}),
|
|
257
|
+
...previous.map((entry) => renderRunnerOutcomeEntry({ task_id: opts.task_id, entry })),
|
|
258
|
+
]
|
|
259
|
+
.join("\n")
|
|
260
|
+
.trimEnd();
|
|
261
|
+
}
|
|
262
|
+
function resolveRunnerUpdatedBy(task) {
|
|
263
|
+
const owner = typeof task.owner === "string" ? task.owner.trim() : "";
|
|
264
|
+
if (owner)
|
|
265
|
+
return owner;
|
|
266
|
+
const docUpdatedBy = typeof task.doc_updated_by === "string" ? task.doc_updated_by.trim() : "";
|
|
267
|
+
if (docUpdatedBy)
|
|
268
|
+
return docUpdatedBy;
|
|
269
|
+
return "agentplane";
|
|
270
|
+
}
|
|
271
|
+
export async function persistRunnerOutcomeToTask(opts) {
|
|
272
|
+
if (opts.bundle?.execution.mode === "dry_run" || opts.state.mode === "dry_run")
|
|
273
|
+
return;
|
|
274
|
+
const backend = opts.ctx.taskBackend;
|
|
275
|
+
if (!backend.writeTask) {
|
|
276
|
+
throw new CliError({
|
|
277
|
+
exitCode: 2,
|
|
278
|
+
code: "E_USAGE",
|
|
279
|
+
message: backendNotSupportedMessage("task writes"),
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const useStore = backendIsLocalFileBackend(opts.ctx);
|
|
283
|
+
if (useStore) {
|
|
284
|
+
const store = getTaskStore(opts.ctx);
|
|
285
|
+
await store.mutate(opts.task_id, (current) => {
|
|
286
|
+
const projection = {
|
|
287
|
+
state: opts.state,
|
|
288
|
+
result: opts.state.result ?? null,
|
|
289
|
+
};
|
|
290
|
+
const outcome = buildTaskRunnerOutcome({
|
|
291
|
+
projection,
|
|
292
|
+
previous: current.runner ?? null,
|
|
293
|
+
});
|
|
294
|
+
const docVersion = normalizeTaskDocVersion(current.doc_version);
|
|
295
|
+
const observationSection = taskObservationSectionName(docVersion);
|
|
296
|
+
const writableSections = resolveWritableDocSections({
|
|
297
|
+
allowedSections: opts.ctx.config.tasks.doc.sections,
|
|
298
|
+
requiredSections: opts.ctx.config.tasks.doc.required_sections,
|
|
299
|
+
targetSection: observationSection,
|
|
300
|
+
});
|
|
301
|
+
const baseDoc = ensureDocSections(String(current.doc ?? ""), writableSections);
|
|
302
|
+
const currentObservation = extractDocSection(baseDoc, observationSection);
|
|
303
|
+
const nextObservation = replaceRunnerOutcomeSection(currentObservation, renderRunnerOutcomeHistory({
|
|
304
|
+
task_id: opts.task_id,
|
|
305
|
+
outcome,
|
|
306
|
+
projection,
|
|
307
|
+
}));
|
|
308
|
+
return [
|
|
309
|
+
setTaskFieldsIntent({ runner: outcome }),
|
|
310
|
+
setTaskSectionIntent({
|
|
311
|
+
section: observationSection,
|
|
312
|
+
text: nextObservation,
|
|
313
|
+
requiredSections: writableSections,
|
|
314
|
+
}),
|
|
315
|
+
touchTaskDocMetaIntent({
|
|
316
|
+
updatedBy: resolveRunnerUpdatedBy(current),
|
|
317
|
+
version: docVersion,
|
|
318
|
+
}),
|
|
319
|
+
];
|
|
320
|
+
});
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
const task = await loadTaskFromContext({ ctx: opts.ctx, taskId: opts.task_id });
|
|
324
|
+
const projection = {
|
|
325
|
+
state: opts.state,
|
|
326
|
+
result: opts.state.result ?? null,
|
|
327
|
+
};
|
|
328
|
+
const outcome = buildTaskRunnerOutcome({
|
|
329
|
+
projection,
|
|
330
|
+
previous: task.runner ?? null,
|
|
331
|
+
});
|
|
332
|
+
const writableSections = resolveWritableDocSections({
|
|
333
|
+
allowedSections: opts.ctx.config.tasks.doc.sections,
|
|
334
|
+
requiredSections: opts.ctx.config.tasks.doc.required_sections,
|
|
335
|
+
targetSection: taskObservationSectionName(normalizeTaskDocVersion(task.doc_version)),
|
|
336
|
+
});
|
|
337
|
+
const baseDoc = ensureDocSections(String(task.doc ?? ""), writableSections);
|
|
338
|
+
const docVersion = normalizeTaskDocVersion(task.doc_version);
|
|
339
|
+
const observationSection = taskObservationSectionName(docVersion);
|
|
340
|
+
const currentObservation = extractDocSection(baseDoc, observationSection);
|
|
341
|
+
const nextObservation = replaceRunnerOutcomeSection(currentObservation, renderRunnerOutcomeHistory({
|
|
342
|
+
task_id: opts.task_id,
|
|
343
|
+
outcome,
|
|
344
|
+
projection,
|
|
345
|
+
}));
|
|
346
|
+
const nextDoc = ensureDocSections(setMarkdownSection(baseDoc, observationSection, nextObservation), writableSections);
|
|
347
|
+
await backend.writeTask({
|
|
348
|
+
...task,
|
|
349
|
+
runner: outcome,
|
|
350
|
+
doc: nextDoc,
|
|
351
|
+
doc_updated_at: opts.state.updated_at,
|
|
352
|
+
doc_updated_by: resolveRunnerUpdatedBy(task),
|
|
353
|
+
});
|
|
354
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RunnerContextBundle } from "./types.js";
|
|
2
|
+
type MakeRunnerContextBundleOptions = {
|
|
3
|
+
adapterId?: string;
|
|
4
|
+
taskId?: string;
|
|
5
|
+
runId?: string;
|
|
6
|
+
gitRoot?: string;
|
|
7
|
+
workflowDir?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
owner?: string;
|
|
12
|
+
priority?: string;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
mode?: RunnerContextBundle["execution"]["mode"];
|
|
15
|
+
doc?: string;
|
|
16
|
+
sections?: Record<string, string>;
|
|
17
|
+
basePrompts?: RunnerContextBundle["base_prompts"];
|
|
18
|
+
target?: RunnerContextBundle["target"];
|
|
19
|
+
recipe?: RunnerContextBundle["recipe"];
|
|
20
|
+
repository?: Partial<RunnerContextBundle["repository"]>;
|
|
21
|
+
task?: Partial<RunnerContextBundle["task"]>;
|
|
22
|
+
execution?: Partial<Omit<RunnerContextBundle["execution"], "artifact_paths">> & {
|
|
23
|
+
artifact_paths?: Partial<RunnerContextBundle["execution"]["artifact_paths"]>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function setRunnerBundleRunDir(bundle: RunnerContextBundle, runDir: string): void;
|
|
27
|
+
export declare function makeRunnerContextBundle(opts?: MakeRunnerContextBundleOptions): RunnerContextBundle;
|
|
28
|
+
export declare function writeRunnerExecutable(root: string, commandName: string, content: string | readonly string[]): Promise<string>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/runner/test-helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAItD,KAAK,8BAA8B,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG;QAC9E,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;KAC9E,CAAC;CACH,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CASvF;AAED,wBAAgB,uBAAuB,CACrC,IAAI,GAAE,8BAAmC,GACxC,mBAAmB,CA8ErB;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAClC,OAAO,CAAC,MAAM,CAAC,CAEjB"}
|