agentplane 0.3.9 → 0.3.11
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 +4 -2
- package/assets/agents/CODER.json +1 -1
- package/assets/policy/dod.core.md +1 -1
- package/assets/policy/governance.md +5 -3
- package/assets/policy/incidents.md +19 -77
- package/assets/policy/workflow.branch_pr.md +2 -0
- package/assets/policy/workflow.direct.md +3 -1
- package/bin/agentplane.js +56 -1
- package/bin/runtime-watch.js +1 -0
- package/bin/stale-dist-policy.d.ts +1 -1
- package/bin/stale-dist-policy.js +13 -0
- package/dist/.build-manifest.json +462 -202
- package/dist/cli/bootstrap-guide.d.ts +1 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +20 -1
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +2 -1
- package/dist/cli/command-invocations.d.ts.map +1 -1
- package/dist/cli/command-invocations.js +6 -1
- package/dist/cli/command-snippets.d.ts +2 -0
- package/dist/cli/command-snippets.d.ts.map +1 -1
- package/dist/cli/command-snippets.js +2 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +10 -0
- 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 +3 -1
- 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 +10 -0
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +13 -0
- package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core/preflight.js +44 -1
- package/dist/cli/run-cli.js +2 -2
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +12 -0
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +4 -0
- package/dist/commands/branch/cleanup-merged.d.ts +2 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +132 -28
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +60 -1
- package/dist/commands/cleanup/merged.command.d.ts +2 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
- package/dist/commands/cleanup/merged.command.js +24 -0
- package/dist/commands/doctor/branch-pr.d.ts +4 -0
- package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
- package/dist/commands/doctor/branch-pr.js +96 -0
- package/dist/commands/doctor/fixes.d.ts +5 -0
- package/dist/commands/doctor/fixes.d.ts.map +1 -1
- package/dist/commands/doctor/fixes.js +70 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +6 -1
- package/dist/commands/finish.run.d.ts.map +1 -1
- package/dist/commands/finish.run.js +11 -0
- package/dist/commands/finish.spec.d.ts +11 -0
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +51 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
- package/dist/commands/guard/impl/close-message.js +23 -6
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +24 -2
- package/dist/commands/guard/impl/env.d.ts +1 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -1
- package/dist/commands/guard/impl/env.js +1 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +98 -1
- package/dist/commands/incidents/advise.command.d.ts +15 -0
- package/dist/commands/incidents/advise.command.d.ts.map +1 -0
- package/dist/commands/incidents/advise.command.js +139 -0
- package/dist/commands/incidents/collect.command.d.ts +11 -0
- package/dist/commands/incidents/collect.command.d.ts.map +1 -0
- package/dist/commands/incidents/collect.command.js +72 -0
- package/dist/commands/incidents/incidents.command.d.ts +5 -0
- package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
- package/dist/commands/incidents/incidents.command.js +21 -0
- package/dist/commands/incidents/shared.d.ts +76 -0
- package/dist/commands/incidents/shared.d.ts.map +1 -0
- package/dist/commands/incidents/shared.js +261 -0
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +249 -75
- package/dist/commands/pr/close-superseded.d.ts +9 -0
- package/dist/commands/pr/close-superseded.d.ts.map +1 -0
- package/dist/commands/pr/close-superseded.js +129 -0
- package/dist/commands/pr/close.d.ts +11 -0
- package/dist/commands/pr/close.d.ts.map +1 -0
- package/dist/commands/pr/close.js +116 -0
- package/dist/commands/pr/index.d.ts +2 -0
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +2 -0
- package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
- package/dist/commands/pr/integrate/artifacts.js +66 -1
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +20 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +40 -12
- package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +59 -15
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +107 -19
- package/dist/commands/pr/internal/freshness.d.ts +20 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
- package/dist/commands/pr/internal/freshness.js +50 -0
- package/dist/commands/pr/internal/gh-api.d.ts +6 -0
- package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
- package/dist/commands/pr/internal/gh-api.js +80 -0
- package/dist/commands/pr/internal/note-store.d.ts +18 -0
- package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
- package/dist/commands/pr/internal/note-store.js +66 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +13 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
- package/dist/commands/pr/internal/pr-paths.js +13 -0
- package/dist/commands/pr/internal/review-template.d.ts +24 -4
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
- package/dist/commands/pr/internal/review-template.js +221 -33
- package/dist/commands/pr/internal/sync.d.ts +41 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync.js +598 -0
- package/dist/commands/pr/note.d.ts.map +1 -1
- package/dist/commands/pr/note.js +37 -4
- package/dist/commands/pr/open.d.ts +1 -0
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +18 -54
- package/dist/commands/pr/pr.command.d.ts +15 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +124 -5
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +58 -74
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
- package/dist/commands/recipes/impl/commands/install.js +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +9 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +12 -17
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +1 -1
- package/dist/commands/shared/approval-requirements.d.ts +5 -7
- package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
- package/dist/commands/shared/approval-requirements.js +3 -73
- package/dist/commands/shared/gh-transport.d.ts +16 -0
- package/dist/commands/shared/gh-transport.d.ts.map +1 -0
- package/dist/commands/shared/gh-transport.js +71 -0
- package/dist/commands/shared/git-diff.d.ts +3 -1
- package/dist/commands/shared/git-diff.d.ts.map +1 -1
- package/dist/commands/shared/git-diff.js +10 -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 +15 -0
- package/dist/commands/shared/git-worktree.d.ts +2 -0
- package/dist/commands/shared/git-worktree.d.ts.map +1 -1
- package/dist/commands/shared/git-worktree.js +22 -2
- package/dist/commands/shared/network-approval.d.ts +2 -0
- package/dist/commands/shared/network-approval.d.ts.map +1 -1
- package/dist/commands/shared/network-approval.js +1 -1
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
- package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
- package/dist/commands/shared/pr-meta.d.ts +29 -0
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +152 -3
- package/dist/commands/shared/task-backend.d.ts +9 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -22
- package/dist/commands/shared/task-local-freshness.d.ts +13 -0
- package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
- package/dist/commands/shared/task-local-freshness.js +20 -0
- package/dist/commands/shared/task-mutation.d.ts +2 -0
- package/dist/commands/shared/task-mutation.d.ts.map +1 -1
- package/dist/commands/shared/task-mutation.js +7 -0
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +1 -0
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +34 -1
- package/dist/commands/task/close-shared.d.ts.map +1 -1
- package/dist/commands/task/close-shared.js +1 -0
- package/dist/commands/task/derive.js +1 -1
- package/dist/commands/task/doc-template.d.ts.map +1 -1
- package/dist/commands/task/doc-template.js +7 -11
- package/dist/commands/task/findings-add.command.d.ts +20 -0
- package/dist/commands/task/findings-add.command.d.ts.map +1 -0
- package/dist/commands/task/findings-add.command.js +165 -0
- package/dist/commands/task/findings.command.d.ts +7 -0
- package/dist/commands/task/findings.command.d.ts.map +1 -0
- package/dist/commands/task/findings.command.js +20 -0
- package/dist/commands/task/findings.d.ts +63 -0
- package/dist/commands/task/findings.d.ts.map +1 -0
- package/dist/commands/task/findings.js +188 -0
- package/dist/commands/task/finish-shared.d.ts +1 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +60 -3
- package/dist/commands/task/finish.d.ts +10 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +143 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.command.js +414 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +49 -1
- package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +249 -17
- package/dist/commands/task/index.d.ts +1 -0
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +1 -0
- package/dist/commands/task/new.d.ts +1 -0
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +140 -30
- package/dist/commands/task/new.spec.d.ts.map +1 -1
- package/dist/commands/task/new.spec.js +7 -0
- package/dist/commands/task/normalize.command.d.ts +2 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -1
- package/dist/commands/task/normalize.command.js +45 -0
- package/dist/commands/task/normalize.d.ts +2 -0
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +85 -8
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +7 -10
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +1 -0
- package/dist/commands/task/shared/docs.d.ts +6 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +14 -0
- package/dist/commands/task/shared/transition-command.d.ts +2 -0
- package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
- package/dist/commands/task/shared/transition-command.js +1 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +11 -1
- package/dist/commands/task/shared.d.ts +1 -1
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +1 -1
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +98 -1
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +18 -10
- package/dist/commands/task/task.command.d.ts.map +1 -1
- package/dist/commands/task/task.command.js +4 -0
- package/dist/commands/task/verify-command-shared.d.ts +19 -0
- package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
- package/dist/commands/task/verify-command-shared.js +152 -1
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
- package/dist/commands/task/verify-ok.command.js +15 -2
- package/dist/commands/task/verify-record.d.ts +36 -0
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +193 -11
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
- package/dist/commands/task/verify-rework.command.js +15 -2
- package/dist/commands/task/verify-show.command.d.ts +1 -1
- package/dist/commands/task/verify-show.command.d.ts.map +1 -1
- package/dist/commands/task/verify-show.command.js +28 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +6 -1
- package/dist/commands/verify.run.d.ts.map +1 -1
- package/dist/commands/verify.run.js +12 -0
- package/dist/commands/verify.spec.d.ts +2 -6
- package/dist/commands/verify.spec.d.ts.map +1 -1
- package/dist/commands/verify.spec.js +30 -3
- package/dist/policy/engine.d.ts +3 -1
- package/dist/policy/engine.d.ts.map +1 -1
- package/dist/policy/engine.js +5 -6
- package/dist/policy/taxonomy.d.ts +17 -0
- package/dist/policy/taxonomy.d.ts.map +1 -0
- package/dist/policy/taxonomy.js +302 -0
- package/dist/policy/types.d.ts +2 -1
- package/dist/policy/types.d.ts.map +1 -1
- package/dist/runner/artifacts.d.ts.map +1 -1
- package/dist/runner/artifacts.js +2 -0
- package/dist/runner/context/base-prompts.d.ts +25 -0
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +182 -54
- package/dist/runner/context/recipe-context.d.ts.map +1 -1
- package/dist/runner/context/recipe-context.js +5 -0
- package/dist/runner/types.d.ts +12 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.js +81 -11
- package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-inspect.js +9 -7
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
- package/dist/runner/usecases/task-run.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.js +59 -12
- package/dist/runtime/approvals/index.d.ts +3 -0
- package/dist/runtime/approvals/index.d.ts.map +1 -0
- package/dist/runtime/approvals/index.js +1 -0
- package/dist/runtime/approvals/runtime.d.ts +12 -0
- package/dist/runtime/approvals/runtime.d.ts.map +1 -0
- package/dist/runtime/approvals/runtime.js +154 -0
- package/dist/runtime/approvals/types.d.ts +31 -0
- package/dist/runtime/approvals/types.d.ts.map +1 -0
- package/dist/runtime/approvals/types.js +1 -0
- package/dist/runtime/behavior/index.d.ts +3 -0
- package/dist/runtime/behavior/index.d.ts.map +1 -0
- package/dist/runtime/behavior/index.js +1 -0
- package/dist/runtime/behavior/resolve.d.ts +7 -0
- package/dist/runtime/behavior/resolve.d.ts.map +1 -0
- package/dist/runtime/behavior/resolve.js +66 -0
- package/dist/runtime/behavior/types.d.ts +25 -0
- package/dist/runtime/behavior/types.d.ts.map +1 -0
- package/dist/runtime/behavior/types.js +1 -0
- package/dist/runtime/capabilities/backend.d.ts +7 -0
- package/dist/runtime/capabilities/backend.d.ts.map +1 -0
- package/dist/runtime/capabilities/backend.js +104 -0
- package/dist/runtime/capabilities/index.d.ts +6 -0
- package/dist/runtime/capabilities/index.d.ts.map +1 -0
- package/dist/runtime/capabilities/index.js +4 -0
- package/dist/runtime/capabilities/recipe.d.ts +10 -0
- package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
- package/dist/runtime/capabilities/recipe.js +123 -0
- package/dist/runtime/capabilities/registry.d.ts +6 -0
- package/dist/runtime/capabilities/registry.d.ts.map +1 -0
- package/dist/runtime/capabilities/registry.js +69 -0
- package/dist/runtime/capabilities/runner.d.ts +8 -0
- package/dist/runtime/capabilities/runner.d.ts.map +1 -0
- package/dist/runtime/capabilities/runner.js +73 -0
- package/dist/runtime/capabilities/types.d.ts +28 -0
- package/dist/runtime/capabilities/types.d.ts.map +1 -0
- package/dist/runtime/capabilities/types.js +1 -0
- package/dist/runtime/execution-profile/index.d.ts +3 -0
- package/dist/runtime/execution-profile/index.d.ts.map +1 -0
- package/dist/runtime/execution-profile/index.js +1 -0
- package/dist/runtime/execution-profile/resolve.d.ts +9 -0
- package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
- package/dist/runtime/execution-profile/resolve.js +80 -0
- package/dist/runtime/execution-profile/types.d.ts +27 -0
- package/dist/runtime/execution-profile/types.d.ts.map +1 -0
- package/dist/runtime/execution-profile/types.js +1 -0
- package/dist/runtime/explain/index.d.ts +3 -0
- package/dist/runtime/explain/index.d.ts.map +1 -0
- package/dist/runtime/explain/index.js +1 -0
- package/dist/runtime/explain/resolve.d.ts +14 -0
- package/dist/runtime/explain/resolve.d.ts.map +1 -0
- package/dist/runtime/explain/resolve.js +50 -0
- package/dist/runtime/explain/types.d.ts +28 -0
- package/dist/runtime/explain/types.d.ts.map +1 -0
- package/dist/runtime/explain/types.js +1 -0
- package/dist/runtime/harness/index.d.ts +4 -0
- package/dist/runtime/harness/index.d.ts.map +1 -0
- package/dist/runtime/harness/index.js +2 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
- package/dist/runtime/harness/resolve-from-command-context.js +11 -0
- package/dist/runtime/harness/resolve.d.ts +13 -0
- package/dist/runtime/harness/resolve.d.ts.map +1 -0
- package/dist/runtime/harness/resolve.js +146 -0
- package/dist/runtime/harness/types.d.ts +65 -0
- package/dist/runtime/harness/types.d.ts.map +1 -0
- package/dist/runtime/harness/types.js +1 -0
- package/dist/runtime/incidents/index.d.ts +3 -0
- package/dist/runtime/incidents/index.d.ts.map +1 -0
- package/dist/runtime/incidents/index.js +1 -0
- package/dist/runtime/incidents/resolve.d.ts +26 -0
- package/dist/runtime/incidents/resolve.d.ts.map +1 -0
- package/dist/runtime/incidents/resolve.js +683 -0
- package/dist/runtime/incidents/types.d.ts +84 -0
- package/dist/runtime/incidents/types.d.ts.map +1 -0
- package/dist/runtime/incidents/types.js +1 -0
- package/dist/runtime/protocol/index.d.ts +3 -0
- package/dist/runtime/protocol/index.d.ts.map +1 -0
- package/dist/runtime/protocol/index.js +2 -0
- package/dist/runtime/protocol/resolve.d.ts +16 -0
- package/dist/runtime/protocol/resolve.d.ts.map +1 -0
- package/dist/runtime/protocol/resolve.js +36 -0
- package/dist/runtime/protocol/types.d.ts +36 -0
- package/dist/runtime/protocol/types.d.ts.map +1 -0
- package/dist/runtime/protocol/types.js +1 -0
- package/dist/runtime/task-intake/index.d.ts +3 -0
- package/dist/runtime/task-intake/index.d.ts.map +1 -0
- package/dist/runtime/task-intake/index.js +1 -0
- package/dist/runtime/task-intake/resolve.d.ts +48 -0
- package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
- package/dist/runtime/task-intake/resolve.js +316 -0
- package/dist/runtime/task-intake/types.d.ts +117 -0
- package/dist/runtime/task-intake/types.d.ts.map +1 -0
- package/dist/runtime/task-intake/types.js +1 -0
- package/dist/shared/env.d.ts +1 -0
- package/dist/shared/env.d.ts.map +1 -1
- package/dist/shared/env.js +22 -1
- package/dist/shared/protected-paths.d.ts +4 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +8 -4
- package/dist/usecases/context/resolve-context.d.ts +55 -6
- package/dist/usecases/context/resolve-context.d.ts.map +1 -1
- package/dist/usecases/context/resolve-context.js +96 -6
- package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
- package/dist/usecases/task/task-list-usecase.js +8 -2
- package/dist/usecases/task/task-new-usecase.js +4 -4
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { loadCommandContext } from "../../commands/shared/task-backend.js";
|
|
3
3
|
import { CliError } from "../../shared/errors.js";
|
|
4
|
+
import { makeReadOnlyUsecaseContext } from "../../usecases/context/resolve-context.js";
|
|
4
5
|
import { createRunnerAdapter } from "../adapters/index.js";
|
|
5
6
|
import { runnerAdapterCancelledResult } from "../adapters/shared.js";
|
|
6
7
|
import { evolveRunnerRunState } from "../artifacts.js";
|
|
@@ -139,14 +140,15 @@ export function buildSyntheticCancelledState(opts) {
|
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
142
|
export async function loadExistingRunnerExecution(opts) {
|
|
142
|
-
const
|
|
143
|
+
const command = opts.ctx ??
|
|
143
144
|
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
145
|
+
const executionContext = await makeReadOnlyUsecaseContext(command);
|
|
144
146
|
if (opts.require_task_doing !== false) {
|
|
145
|
-
assertCurrentTaskDoing(opts.task_id, await
|
|
147
|
+
assertCurrentTaskDoing(opts.task_id, await executionContext.backend.task_backend.getTask(opts.task_id));
|
|
146
148
|
}
|
|
147
149
|
const repository = RunnerRunRepository.forTaskRun({
|
|
148
|
-
git_root:
|
|
149
|
-
workflow_dir:
|
|
150
|
+
git_root: executionContext.repo.git_root,
|
|
151
|
+
workflow_dir: executionContext.repo.workflow_dir,
|
|
150
152
|
task_id: opts.task_id,
|
|
151
153
|
run_id: opts.run_id,
|
|
152
154
|
});
|
|
@@ -160,10 +162,10 @@ export async function loadExistingRunnerExecution(opts) {
|
|
|
160
162
|
}
|
|
161
163
|
assertRunnerBundleMatchesTask(record.bundle, opts.task_id, opts.run_id);
|
|
162
164
|
assertRunnerTaskExecutable(record.bundle);
|
|
163
|
-
const adapter = createRunnerAdapter(
|
|
165
|
+
const adapter = createRunnerAdapter(executionContext.config);
|
|
164
166
|
const invocation = await adapter.prepare(record.bundle);
|
|
165
167
|
return {
|
|
166
|
-
ctx,
|
|
168
|
+
ctx: executionContext.command,
|
|
167
169
|
bundle: record.bundle,
|
|
168
170
|
invocation,
|
|
169
171
|
state: record.state,
|
|
@@ -1 +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;
|
|
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;AAuBhG,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;AAkHF,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,CAoHvC;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"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
2
2
|
import { loadCommandContext } from "../../commands/shared/task-backend.js";
|
|
3
3
|
import { CliError } from "../../shared/errors.js";
|
|
4
|
+
import { resolveRunnerAdapterCapabilityRegistry } from "../../runtime/capabilities/index.js";
|
|
5
|
+
import { consumeExecutionProfileBudget } from "../../runtime/execution-profile/index.js";
|
|
6
|
+
import { appendFrameworkExplainBehaviorInputs, } from "../../runtime/explain/index.js";
|
|
7
|
+
import { buildFrameworkProtocolSurface } from "../../runtime/protocol/index.js";
|
|
8
|
+
import { makeReadOnlyUsecaseContext } from "../../usecases/context/resolve-context.js";
|
|
4
9
|
import { evolveRunnerRunState } from "../artifacts.js";
|
|
5
10
|
import { createRunnerAdapter } from "../adapters/index.js";
|
|
6
11
|
import { readRecipeRunProfile } from "../adapters/recipe-run-profile.js";
|
|
@@ -11,7 +16,6 @@ import { createRunnerRunId } from "../run-id.js";
|
|
|
11
16
|
import { persistRunnerOutcomeToTask } from "../task-state.js";
|
|
12
17
|
import { RunnerRunRepository } from "../run-repository.js";
|
|
13
18
|
import { resolveTaskRunnerPaths } from "../task-run-paths.js";
|
|
14
|
-
import { resolveRunnerTimeoutPolicy, resolveRunnerTracePolicy } from "../config.js";
|
|
15
19
|
import { normalizeRecipeArtifactPrefixes } from "../result-manifest-policy.js";
|
|
16
20
|
import { RUNNER_API_VERSION, RUNNER_BUNDLE_SCHEMA_VERSION, } from "../types.js";
|
|
17
21
|
class RunnerPreparationCliError extends CliError {
|
|
@@ -28,6 +32,18 @@ class RunnerPreparationCliError extends CliError {
|
|
|
28
32
|
this.state = opts.state;
|
|
29
33
|
}
|
|
30
34
|
}
|
|
35
|
+
function collectFrameworkExplainBehaviorInputs(prompts) {
|
|
36
|
+
return prompts.flatMap((prompt) => prompt.resolution
|
|
37
|
+
? [
|
|
38
|
+
{
|
|
39
|
+
id: prompt.id,
|
|
40
|
+
category: "prompt",
|
|
41
|
+
...(prompt.source ? { source: prompt.source } : {}),
|
|
42
|
+
resolution: prompt.resolution,
|
|
43
|
+
},
|
|
44
|
+
]
|
|
45
|
+
: []);
|
|
46
|
+
}
|
|
31
47
|
function isEnforcedCapabilityLevel(level) {
|
|
32
48
|
return level === "native" || level === "wrapper";
|
|
33
49
|
}
|
|
@@ -148,21 +164,39 @@ export function renderTaskRunnerBootstrap(bundle, invocation) {
|
|
|
148
164
|
].join("\n");
|
|
149
165
|
}
|
|
150
166
|
export async function prepareTaskRunnerExecution(opts) {
|
|
151
|
-
const
|
|
167
|
+
const command = opts.ctx ??
|
|
152
168
|
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
169
|
+
const executionContext = await makeReadOnlyUsecaseContext(command);
|
|
170
|
+
const target = opts.target ?? { kind: "task", task_id: opts.task_id };
|
|
171
|
+
void executionContext.policy.evaluate({
|
|
172
|
+
action: target.kind === "recipe_scenario" ? "scenario_execute" : "task_run",
|
|
173
|
+
config: executionContext.config,
|
|
174
|
+
taskId: opts.task_id,
|
|
175
|
+
git: { stagedPaths: [] },
|
|
176
|
+
});
|
|
177
|
+
let executionProfile = consumeExecutionProfileBudget({
|
|
178
|
+
runtime: executionContext.executionProfile,
|
|
179
|
+
phase: "discovery",
|
|
180
|
+
});
|
|
153
181
|
const taskEnvelope = await assembleRunnerTaskContext({
|
|
154
|
-
ctx,
|
|
182
|
+
ctx: executionContext.command,
|
|
155
183
|
cwd: opts.cwd,
|
|
156
184
|
rootOverride: opts.rootOverride ?? null,
|
|
157
185
|
task_id: opts.task_id,
|
|
158
186
|
});
|
|
159
187
|
const base_prompts = await collectRunnerBasePrompts({
|
|
160
|
-
git_root:
|
|
188
|
+
git_root: executionContext.repo.git_root,
|
|
161
189
|
owner_id: taskEnvelope.task.data.owner,
|
|
162
|
-
agents_dir:
|
|
190
|
+
agents_dir: executionContext.harness.workflow.paths.agents_dir,
|
|
163
191
|
recipe: opts.recipe,
|
|
192
|
+
harness: executionContext.harness,
|
|
193
|
+
execution_profile: executionProfile,
|
|
164
194
|
});
|
|
165
|
-
const
|
|
195
|
+
const framework_explain = appendFrameworkExplainBehaviorInputs(executionContext.frameworkExplain, collectFrameworkExplainBehaviorInputs(base_prompts));
|
|
196
|
+
const framework_protocol = buildFrameworkProtocolSurface({
|
|
197
|
+
explain: framework_explain,
|
|
198
|
+
});
|
|
199
|
+
const adapter = createRunnerAdapter(executionContext.config);
|
|
166
200
|
const configured_adapter_id = adapter.id === "custom" ? "custom" : "codex";
|
|
167
201
|
const run_id = opts.run_id ?? createRunnerRunId();
|
|
168
202
|
const artifact_paths = resolveTaskRunnerPaths({
|
|
@@ -174,8 +208,10 @@ export async function prepareTaskRunnerExecution(opts) {
|
|
|
174
208
|
const bundle = {
|
|
175
209
|
schema_version: RUNNER_BUNDLE_SCHEMA_VERSION,
|
|
176
210
|
runner_api_version: RUNNER_API_VERSION,
|
|
177
|
-
target
|
|
211
|
+
target,
|
|
178
212
|
base_prompts,
|
|
213
|
+
framework_explain,
|
|
214
|
+
framework_protocol,
|
|
179
215
|
repository: taskEnvelope.repository,
|
|
180
216
|
task: taskEnvelope.task,
|
|
181
217
|
recipe: opts.recipe,
|
|
@@ -184,21 +220,32 @@ export async function prepareTaskRunnerExecution(opts) {
|
|
|
184
220
|
mode: opts.mode,
|
|
185
221
|
run_id,
|
|
186
222
|
artifact_paths,
|
|
187
|
-
|
|
188
|
-
|
|
223
|
+
profile_runtime: executionProfile,
|
|
224
|
+
trace_policy: executionProfile.runner.trace_policy,
|
|
225
|
+
timeout_policy: executionProfile.runner.timeout_policy,
|
|
189
226
|
approvals: {
|
|
190
|
-
require_plan:
|
|
191
|
-
require_verify:
|
|
192
|
-
require_network:
|
|
227
|
+
require_plan: executionContext.approvals.require_plan,
|
|
228
|
+
require_verify: executionContext.approvals.require_verify,
|
|
229
|
+
require_network: executionContext.approvals.require_network,
|
|
193
230
|
},
|
|
194
231
|
},
|
|
195
232
|
};
|
|
233
|
+
executionProfile = consumeExecutionProfileBudget({
|
|
234
|
+
runtime: bundle.execution.profile_runtime ?? executionProfile,
|
|
235
|
+
phase: "implementation",
|
|
236
|
+
});
|
|
237
|
+
bundle.execution.profile_runtime = executionProfile;
|
|
196
238
|
bundle.execution.adapter_capabilities = adapter.describeCapabilities(bundle);
|
|
197
239
|
bundle.execution.policy_decision = buildRunnerPolicyDecision({
|
|
198
240
|
adapter_id: bundle.execution.adapter_id,
|
|
199
241
|
capabilities: bundle.execution.adapter_capabilities,
|
|
200
242
|
recipe: bundle.recipe,
|
|
201
243
|
});
|
|
244
|
+
bundle.execution.adapter_capability_registry = resolveRunnerAdapterCapabilityRegistry({
|
|
245
|
+
adapter_id: bundle.execution.adapter_id,
|
|
246
|
+
capabilities: bundle.execution.adapter_capabilities,
|
|
247
|
+
requested: bundle.execution.policy_decision.requested,
|
|
248
|
+
});
|
|
202
249
|
assertRunnerTaskExecutable(bundle);
|
|
203
250
|
try {
|
|
204
251
|
assertRunnerPolicyCompatibility(bundle);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { ApprovalDecisionSource, ApprovalRequest, ApprovalRequirement, ApprovalResolveOptions, ApprovalRuntimeOptions, EffectiveApprovalSettings, } from "./types.js";
|
|
2
|
+
export { ApprovalRuntime, createApprovalRuntime, resolveEffectiveApprovalSettings, } from "./runtime.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/approvals/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,gCAAgC,GACjC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ApprovalRuntime, createApprovalRuntime, resolveEffectiveApprovalSettings, } from "./runtime.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentplaneConfig } from "@agentplaneorg/core";
|
|
2
|
+
import type { ApprovalRequest, ApprovalRequirement, ApprovalRuntimeOptions, ApprovalResolveOptions, EffectiveApprovalSettings } from "./types.js";
|
|
3
|
+
export declare function resolveEffectiveApprovalSettings(config: AgentplaneConfig): EffectiveApprovalSettings;
|
|
4
|
+
export declare class ApprovalRuntime {
|
|
5
|
+
private readonly config;
|
|
6
|
+
private readonly policy;
|
|
7
|
+
constructor(opts: ApprovalRuntimeOptions);
|
|
8
|
+
resolve(opts: ApprovalResolveOptions): ApprovalRequirement;
|
|
9
|
+
ensure(opts: ApprovalRequest): Promise<ApprovalRequirement>;
|
|
10
|
+
}
|
|
11
|
+
export declare function createApprovalRuntime(opts: ApprovalRuntimeOptions): ApprovalRuntime;
|
|
12
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/runtime/approvals/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5D,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,gBAAgB,GACvB,yBAAyB,CAuB3B;AAmGD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,sBAAsB;IAKxC,OAAO,CAAC,IAAI,EAAE,sBAAsB,GAAG,mBAAmB;IASpD,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA0BlE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,GAAG,eAAe,CAEnF"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { promptYesNo } from "../../cli/prompts.js";
|
|
2
|
+
import { PolicyEngine } from "../../policy/engine.js";
|
|
3
|
+
import { CliError } from "../../shared/errors.js";
|
|
4
|
+
export function resolveEffectiveApprovalSettings(config) {
|
|
5
|
+
const approvals = config.agents?.approvals;
|
|
6
|
+
const base = {
|
|
7
|
+
require_plan: approvals?.require_plan === true,
|
|
8
|
+
require_network: approvals?.require_network === true,
|
|
9
|
+
require_verify: approvals?.require_verify === true,
|
|
10
|
+
require_force: approvals?.require_force === true,
|
|
11
|
+
};
|
|
12
|
+
if (config.execution.profile === "conservative") {
|
|
13
|
+
return {
|
|
14
|
+
...base,
|
|
15
|
+
require_network: true,
|
|
16
|
+
require_force: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return base;
|
|
20
|
+
}
|
|
21
|
+
function resolveRequirement(opts) {
|
|
22
|
+
const approvals = resolveEffectiveApprovalSettings(opts.config);
|
|
23
|
+
const decision = opts.policy.evaluate({
|
|
24
|
+
action: opts.action,
|
|
25
|
+
config: opts.config,
|
|
26
|
+
taskId: opts.taskId ?? "",
|
|
27
|
+
git: { stagedPaths: [] },
|
|
28
|
+
});
|
|
29
|
+
const classification = decision.action;
|
|
30
|
+
const configuredNetwork = opts.config.agents?.approvals?.require_network === true;
|
|
31
|
+
const configuredForce = opts.config.agents?.approvals?.require_force === true;
|
|
32
|
+
const conservativeProfile = opts.config.execution.profile === "conservative";
|
|
33
|
+
switch (classification.approval) {
|
|
34
|
+
case "network_access": {
|
|
35
|
+
return {
|
|
36
|
+
action: classification,
|
|
37
|
+
approvals,
|
|
38
|
+
required: approvals.require_network === true,
|
|
39
|
+
source: approvals.require_network
|
|
40
|
+
? configuredNetwork
|
|
41
|
+
? "config"
|
|
42
|
+
: conservativeProfile
|
|
43
|
+
? "execution_profile"
|
|
44
|
+
: "none"
|
|
45
|
+
: "none",
|
|
46
|
+
reason: "Network access requires explicit approval",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
case "force_action": {
|
|
50
|
+
return {
|
|
51
|
+
action: classification,
|
|
52
|
+
approvals,
|
|
53
|
+
required: approvals.require_force === true,
|
|
54
|
+
source: approvals.require_force
|
|
55
|
+
? configuredForce
|
|
56
|
+
? "config"
|
|
57
|
+
: conservativeProfile
|
|
58
|
+
? "execution_profile"
|
|
59
|
+
: "none"
|
|
60
|
+
: "none",
|
|
61
|
+
reason: "Force action requires explicit approval",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
case "policy_write": {
|
|
65
|
+
return {
|
|
66
|
+
action: classification,
|
|
67
|
+
approvals,
|
|
68
|
+
required: false,
|
|
69
|
+
source: "builtin",
|
|
70
|
+
reason: "Policy writes require explicit approval",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
case "config_write": {
|
|
74
|
+
return {
|
|
75
|
+
action: classification,
|
|
76
|
+
approvals,
|
|
77
|
+
required: false,
|
|
78
|
+
source: "builtin",
|
|
79
|
+
reason: "Config writes require explicit approval",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
case "dangerous_fs": {
|
|
83
|
+
return {
|
|
84
|
+
action: classification,
|
|
85
|
+
approvals,
|
|
86
|
+
required: false,
|
|
87
|
+
source: "builtin",
|
|
88
|
+
reason: "Potentially dangerous file operations require approval",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
case "git_push": {
|
|
92
|
+
return {
|
|
93
|
+
action: classification,
|
|
94
|
+
approvals,
|
|
95
|
+
required: false,
|
|
96
|
+
source: "builtin",
|
|
97
|
+
reason: "Git push requires explicit approval",
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
default: {
|
|
101
|
+
return {
|
|
102
|
+
action: classification,
|
|
103
|
+
approvals,
|
|
104
|
+
required: false,
|
|
105
|
+
source: "none",
|
|
106
|
+
reason: `${classification.summary} does not require an approval gate`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export class ApprovalRuntime {
|
|
112
|
+
config;
|
|
113
|
+
policy;
|
|
114
|
+
constructor(opts) {
|
|
115
|
+
this.config = opts.config;
|
|
116
|
+
this.policy = opts.policy ?? new PolicyEngine();
|
|
117
|
+
}
|
|
118
|
+
resolve(opts) {
|
|
119
|
+
return resolveRequirement({
|
|
120
|
+
config: this.config,
|
|
121
|
+
action: opts.action,
|
|
122
|
+
taskId: opts.taskId,
|
|
123
|
+
policy: this.policy,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
async ensure(opts) {
|
|
127
|
+
const requirement = this.resolve({
|
|
128
|
+
action: opts.action,
|
|
129
|
+
taskId: opts.taskId,
|
|
130
|
+
});
|
|
131
|
+
if (!requirement.required || opts.yes)
|
|
132
|
+
return requirement;
|
|
133
|
+
const interactive = opts.interactive ?? Boolean(process.stdin.isTTY);
|
|
134
|
+
if (!interactive) {
|
|
135
|
+
throw new CliError({
|
|
136
|
+
exitCode: 3,
|
|
137
|
+
code: "E_VALIDATION",
|
|
138
|
+
message: `${requirement.reason} (pass --yes): ${opts.reason}`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const approved = await promptYesNo(`Allow ${opts.action}? ${opts.reason}`, false);
|
|
142
|
+
if (!approved) {
|
|
143
|
+
throw new CliError({
|
|
144
|
+
exitCode: 3,
|
|
145
|
+
code: "E_VALIDATION",
|
|
146
|
+
message: `${requirement.reason} denied: ${opts.reason}`,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return requirement;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
export function createApprovalRuntime(opts) {
|
|
153
|
+
return new ApprovalRuntime(opts);
|
|
154
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AgentplaneConfig } from "@agentplaneorg/core";
|
|
2
|
+
import type { PolicyEngine } from "../../policy/engine.js";
|
|
3
|
+
import type { PolicyActionDescriptor, PolicyActionId } from "../../policy/taxonomy.js";
|
|
4
|
+
export type EffectiveApprovalSettings = {
|
|
5
|
+
require_plan: boolean;
|
|
6
|
+
require_network: boolean;
|
|
7
|
+
require_verify: boolean;
|
|
8
|
+
require_force: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ApprovalDecisionSource = "none" | "config" | "execution_profile" | "builtin";
|
|
11
|
+
export type ApprovalRequirement = {
|
|
12
|
+
action: PolicyActionDescriptor;
|
|
13
|
+
required: boolean;
|
|
14
|
+
reason: string;
|
|
15
|
+
source: ApprovalDecisionSource;
|
|
16
|
+
approvals: EffectiveApprovalSettings;
|
|
17
|
+
};
|
|
18
|
+
export type ApprovalResolveOptions = {
|
|
19
|
+
action: PolicyActionId;
|
|
20
|
+
taskId?: string;
|
|
21
|
+
};
|
|
22
|
+
export type ApprovalRequest = ApprovalResolveOptions & {
|
|
23
|
+
yes: boolean;
|
|
24
|
+
reason: string;
|
|
25
|
+
interactive?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type ApprovalRuntimeOptions = {
|
|
28
|
+
config: AgentplaneConfig;
|
|
29
|
+
policy?: PolicyEngine;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/approvals/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEvF,MAAM,MAAM,yBAAyB,GAAG;IACtC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,mBAAmB,GAAG,SAAS,CAAC;AAEzF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,sBAAsB,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,sBAAsB,CAAC;IAC/B,SAAS,EAAE,yBAAyB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,sBAAsB,GAAG;IACrD,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/behavior/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACnE,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveBehavior, stripBehaviorValue } from "./resolve.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BehaviorCandidate, BehaviorResolutionTrace, ResolvedBehavior } from "./types.js";
|
|
2
|
+
export declare function resolveBehavior<TValue, TMetadata = Record<string, unknown>>(opts: {
|
|
3
|
+
key: string;
|
|
4
|
+
candidates: readonly BehaviorCandidate<TValue, TMetadata>[];
|
|
5
|
+
}): ResolvedBehavior<TValue, TMetadata>;
|
|
6
|
+
export declare function stripBehaviorValue<TValue, TMetadata>(resolved: ResolvedBehavior<TValue, TMetadata>): BehaviorResolutionTrace<TMetadata>;
|
|
7
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/runtime/behavior/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGjB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAyDpB,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE;IACjF,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,SAAS,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;CAC7D,GAAG,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAyBtC;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAClD,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,GAC5C,uBAAuB,CAAC,SAAS,CAAC,CAOpC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const BEHAVIOR_LAYER_RANK = {
|
|
2
|
+
harness: 0,
|
|
3
|
+
extension: 1,
|
|
4
|
+
user: 2,
|
|
5
|
+
builtin: 3,
|
|
6
|
+
};
|
|
7
|
+
function normalizeKey(key) {
|
|
8
|
+
const normalized = key.trim();
|
|
9
|
+
if (!normalized) {
|
|
10
|
+
throw new Error("Behavior resolution requires a non-empty key.");
|
|
11
|
+
}
|
|
12
|
+
return normalized;
|
|
13
|
+
}
|
|
14
|
+
function rankCandidates(candidates) {
|
|
15
|
+
return candidates.map((candidate, index) => ({
|
|
16
|
+
...candidate,
|
|
17
|
+
order: candidate.order ?? 0,
|
|
18
|
+
index,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function compareCandidates(left, right) {
|
|
22
|
+
return (BEHAVIOR_LAYER_RANK[left.layer] - BEHAVIOR_LAYER_RANK[right.layer] ||
|
|
23
|
+
left.order - right.order ||
|
|
24
|
+
left.source.localeCompare(right.source) ||
|
|
25
|
+
left.index - right.index);
|
|
26
|
+
}
|
|
27
|
+
function toTraceEntry(candidate, selected) {
|
|
28
|
+
return {
|
|
29
|
+
layer: candidate.layer,
|
|
30
|
+
source: candidate.source,
|
|
31
|
+
order: candidate.order,
|
|
32
|
+
selected,
|
|
33
|
+
...(candidate.metadata ? { metadata: structuredClone(candidate.metadata) } : {}),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function resolveBehavior(opts) {
|
|
37
|
+
const key = normalizeKey(opts.key);
|
|
38
|
+
if (opts.candidates.length === 0) {
|
|
39
|
+
throw new Error(`Behavior resolution requires at least one candidate: ${key}`);
|
|
40
|
+
}
|
|
41
|
+
const ranked = rankCandidates(opts.candidates).toSorted(compareCandidates);
|
|
42
|
+
const winner = ranked[0];
|
|
43
|
+
if (!winner) {
|
|
44
|
+
throw new Error(`Behavior resolution lost its winner unexpectedly: ${key}`);
|
|
45
|
+
}
|
|
46
|
+
const trace = ranked.map((candidate, index) => toTraceEntry(candidate, index === 0));
|
|
47
|
+
const [winnerTrace, ...conflicts] = trace;
|
|
48
|
+
if (!winnerTrace) {
|
|
49
|
+
throw new Error(`Behavior resolution trace is unexpectedly empty: ${key}`);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
key,
|
|
53
|
+
value: winner.value,
|
|
54
|
+
winner: winnerTrace,
|
|
55
|
+
conflicts,
|
|
56
|
+
trace,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function stripBehaviorValue(resolved) {
|
|
60
|
+
return {
|
|
61
|
+
key: resolved.key,
|
|
62
|
+
winner: resolved.winner,
|
|
63
|
+
conflicts: resolved.conflicts,
|
|
64
|
+
trace: resolved.trace,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type BehaviorLayer = "harness" | "extension" | "user" | "builtin";
|
|
2
|
+
export type BehaviorCandidate<TValue, TMetadata = Record<string, unknown>> = {
|
|
3
|
+
layer: BehaviorLayer;
|
|
4
|
+
source: string;
|
|
5
|
+
value: TValue;
|
|
6
|
+
order?: number;
|
|
7
|
+
metadata?: TMetadata;
|
|
8
|
+
};
|
|
9
|
+
export type BehaviorResolutionEntry<TMetadata = Record<string, unknown>> = {
|
|
10
|
+
layer: BehaviorLayer;
|
|
11
|
+
source: string;
|
|
12
|
+
order: number;
|
|
13
|
+
selected: boolean;
|
|
14
|
+
metadata?: TMetadata;
|
|
15
|
+
};
|
|
16
|
+
export type BehaviorResolutionTrace<TMetadata = Record<string, unknown>> = {
|
|
17
|
+
key: string;
|
|
18
|
+
winner: BehaviorResolutionEntry<TMetadata>;
|
|
19
|
+
conflicts: BehaviorResolutionEntry<TMetadata>[];
|
|
20
|
+
trace: BehaviorResolutionEntry<TMetadata>[];
|
|
21
|
+
};
|
|
22
|
+
export type ResolvedBehavior<TValue, TMetadata = Record<string, unknown>> = BehaviorResolutionTrace<TMetadata> & {
|
|
23
|
+
value: TValue;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/behavior/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzE,MAAM,MAAM,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC3E,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzE,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC3C,SAAS,EAAE,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;IAChD,KAAK,EAAE,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC1B,MAAM,EACN,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACjC,uBAAuB,CAAC,SAAS,CAAC,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TaskBackendCapabilities } from "../../backends/task-backend.js";
|
|
2
|
+
import type { AgentplaneCapabilityRegistry } from "./types.js";
|
|
3
|
+
export declare function resolveTaskBackendCapabilityRegistry(opts: {
|
|
4
|
+
backend_id: string;
|
|
5
|
+
capabilities: TaskBackendCapabilities | null | undefined;
|
|
6
|
+
}): AgentplaneCapabilityRegistry;
|
|
7
|
+
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/runtime/capabilities/backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAG9E,OAAO,KAAK,EAA6B,4BAA4B,EAAE,MAAM,YAAY,CAAC;AA8E1F,wBAAgB,oCAAoC,CAAC,IAAI,EAAE;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,uBAAuB,GAAG,IAAI,GAAG,SAAS,CAAC;CAC1D,GAAG,4BAA4B,CAsD/B"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createCapabilityRegistry } from "./registry.js";
|
|
2
|
+
const BOOLEAN_CAPABILITY_FIELDS = [
|
|
3
|
+
{
|
|
4
|
+
field: "reads_from_projection_by_default",
|
|
5
|
+
summary: "Reads task data from the projection by default",
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
field: "writes_task_readmes",
|
|
9
|
+
summary: "Writes task README documents through the backend",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
field: "supports_task_revisions",
|
|
13
|
+
summary: "Supports backend task revisions",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
field: "supports_revision_guarded_writes",
|
|
17
|
+
summary: "Supports revision-guarded writes",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
field: "may_access_network_on_read",
|
|
21
|
+
summary: "May access the network while reading tasks",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
field: "may_access_network_on_write",
|
|
25
|
+
summary: "May access the network while writing tasks",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
field: "supports_projection_refresh",
|
|
29
|
+
summary: "Supports projection refresh",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
field: "supports_push_sync",
|
|
33
|
+
summary: "Supports push synchronization",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
field: "supports_snapshot_export",
|
|
37
|
+
summary: "Supports projection or task snapshot export",
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
const VALUE_CAPABILITY_FIELDS = [
|
|
41
|
+
{ field: "canonical_source", summary: "Canonical task source mode" },
|
|
42
|
+
{ field: "projection", summary: "Projection storage mode" },
|
|
43
|
+
{ field: "projection_read_mode", summary: "Projection read mode" },
|
|
44
|
+
];
|
|
45
|
+
function source(backendId) {
|
|
46
|
+
return {
|
|
47
|
+
id: "backend",
|
|
48
|
+
detail: backendId,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function fieldId(backendId, field) {
|
|
52
|
+
return `backend.${backendId}.${field}`;
|
|
53
|
+
}
|
|
54
|
+
export function resolveTaskBackendCapabilityRegistry(opts) {
|
|
55
|
+
if (!opts.capabilities) {
|
|
56
|
+
return createCapabilityRegistry([
|
|
57
|
+
{
|
|
58
|
+
id: fieldId(opts.backend_id, "capabilities"),
|
|
59
|
+
kind: "backend_field",
|
|
60
|
+
availability: "unavailable",
|
|
61
|
+
source: source(opts.backend_id),
|
|
62
|
+
summary: "Declared task backend capabilities",
|
|
63
|
+
reason: "The task backend did not expose a capability descriptor.",
|
|
64
|
+
metadata: { backend_id: opts.backend_id },
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
const entries = [];
|
|
69
|
+
for (const field of VALUE_CAPABILITY_FIELDS) {
|
|
70
|
+
const value = opts.capabilities[field.field];
|
|
71
|
+
entries.push({
|
|
72
|
+
id: fieldId(opts.backend_id, field.field),
|
|
73
|
+
kind: "backend_field",
|
|
74
|
+
availability: value === undefined ? "unavailable" : "available",
|
|
75
|
+
source: source(opts.backend_id),
|
|
76
|
+
summary: field.summary,
|
|
77
|
+
value,
|
|
78
|
+
...(value === undefined
|
|
79
|
+
? {
|
|
80
|
+
reason: "The task backend omitted this capability field.",
|
|
81
|
+
}
|
|
82
|
+
: {}),
|
|
83
|
+
metadata: { backend_id: opts.backend_id, field: field.field },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
for (const field of BOOLEAN_CAPABILITY_FIELDS) {
|
|
87
|
+
const value = opts.capabilities[field.field];
|
|
88
|
+
entries.push({
|
|
89
|
+
id: fieldId(opts.backend_id, field.field),
|
|
90
|
+
kind: "backend_field",
|
|
91
|
+
availability: value ? "available" : "unavailable",
|
|
92
|
+
source: source(opts.backend_id),
|
|
93
|
+
summary: field.summary,
|
|
94
|
+
value,
|
|
95
|
+
...(value
|
|
96
|
+
? {}
|
|
97
|
+
: {
|
|
98
|
+
reason: "The task backend declares this feature unavailable.",
|
|
99
|
+
}),
|
|
100
|
+
metadata: { backend_id: opts.backend_id, field: field.field },
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return createCapabilityRegistry(entries);
|
|
104
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createCapabilityRegistry, getCapabilityEntries, listCapabilities, mergeCapabilityRegistries, } from "./registry.js";
|
|
2
|
+
export { resolveTaskBackendCapabilityRegistry } from "./backend.js";
|
|
3
|
+
export { resolveRecipeCapabilityRegistry } from "./recipe.js";
|
|
4
|
+
export { resolveRunnerAdapterCapabilityRegistry } from "./runner.js";
|
|
5
|
+
export type { AgentplaneCapabilityAvailability, AgentplaneCapabilityEntry, AgentplaneCapabilityFilter, AgentplaneCapabilityKind, AgentplaneCapabilityRegistry, AgentplaneCapabilitySourceId, AgentplaneCapabilitySourceRef, } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|