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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type IncidentRegistryEntryState = "open" | "stabilized" | "promoted";
|
|
2
|
+
export type IncidentRegistryEntry = {
|
|
3
|
+
id: string;
|
|
4
|
+
date: string;
|
|
5
|
+
scope: string;
|
|
6
|
+
failure: string;
|
|
7
|
+
rule: string;
|
|
8
|
+
evidence: string;
|
|
9
|
+
enforcement: string;
|
|
10
|
+
state: IncidentRegistryEntryState;
|
|
11
|
+
tags: string[];
|
|
12
|
+
match: string[];
|
|
13
|
+
advice: string | null;
|
|
14
|
+
sourceTask: string | null;
|
|
15
|
+
fixability: "external" | "repo-fixable" | null;
|
|
16
|
+
rawFields: Record<string, string>;
|
|
17
|
+
line: number;
|
|
18
|
+
};
|
|
19
|
+
export type IncidentRegistry = {
|
|
20
|
+
entries: IncidentRegistryEntry[];
|
|
21
|
+
};
|
|
22
|
+
export type IncidentFindingCandidate = {
|
|
23
|
+
observation: string;
|
|
24
|
+
impact: string | null;
|
|
25
|
+
resolution: string | null;
|
|
26
|
+
promotion: string | null;
|
|
27
|
+
incidentScope: string | null;
|
|
28
|
+
incidentRule: string | null;
|
|
29
|
+
incidentAdvice: string | null;
|
|
30
|
+
incidentTags: string[];
|
|
31
|
+
incidentMatch: string[];
|
|
32
|
+
incidentExternal: boolean;
|
|
33
|
+
incidentInternal: boolean;
|
|
34
|
+
fixability: "external" | "repo-fixable" | null;
|
|
35
|
+
line: number;
|
|
36
|
+
rawFields: Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
export type IncidentSkippedFinding = {
|
|
39
|
+
observation: string;
|
|
40
|
+
line: number;
|
|
41
|
+
reason: "not_marked_external_or_promotable";
|
|
42
|
+
rawFields: Record<string, string>;
|
|
43
|
+
};
|
|
44
|
+
export type IncidentPromotionTaskContext = {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
description: string;
|
|
48
|
+
scope?: string | null;
|
|
49
|
+
tags: string[];
|
|
50
|
+
commitHash?: string | null;
|
|
51
|
+
};
|
|
52
|
+
export type IncidentPromotionDraft = {
|
|
53
|
+
candidate: IncidentFindingCandidate;
|
|
54
|
+
entry: IncidentRegistryEntry;
|
|
55
|
+
fingerprint: string;
|
|
56
|
+
};
|
|
57
|
+
export type IncidentPromotionIssue = {
|
|
58
|
+
candidate: IncidentFindingCandidate;
|
|
59
|
+
missingFields: string[];
|
|
60
|
+
};
|
|
61
|
+
export type IncidentCollectionPlan = {
|
|
62
|
+
candidates: IncidentFindingCandidate[];
|
|
63
|
+
skipped: IncidentSkippedFinding[];
|
|
64
|
+
promotable: IncidentPromotionDraft[];
|
|
65
|
+
duplicates: IncidentPromotionDraft[];
|
|
66
|
+
issues: IncidentPromotionIssue[];
|
|
67
|
+
findingsTextPresent: boolean;
|
|
68
|
+
structuredFindingCount: number;
|
|
69
|
+
};
|
|
70
|
+
export type IncidentAdviceQuery = {
|
|
71
|
+
taskId?: string;
|
|
72
|
+
title: string;
|
|
73
|
+
description: string;
|
|
74
|
+
scope?: string | null;
|
|
75
|
+
tags: string[];
|
|
76
|
+
};
|
|
77
|
+
export type IncidentAdviceMatch = {
|
|
78
|
+
entry: IncidentRegistryEntry;
|
|
79
|
+
score: number;
|
|
80
|
+
matchedTags: string[];
|
|
81
|
+
matchedTerms: string[];
|
|
82
|
+
scopeMatched: boolean;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/incidents/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AGENTPLANE_PROTOCOL_COMPATIBILITY, buildFrameworkExplainProtocolResult, buildFrameworkProtocolSurface, buildProtocolErrorResult, buildProtocolSuccessResult, } from "./resolve.js";
|
|
2
|
+
export { AGENTPLANE_PROTOCOL_SCHEMA_VERSION, type AgentplaneProtocolBase, type AgentplaneProtocolCompatibility, type AgentplaneProtocolError, type AgentplaneProtocolErrorResult, type AgentplaneProtocolKind, type AgentplaneProtocolResult, type AgentplaneProtocolSchemaVersion, type AgentplaneProtocolStatus, type AgentplaneProtocolSuccessResult, type FrameworkExplainProtocolResult, type FrameworkProtocolSurface, } from "./types.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/protocol/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,mCAAmC,EACnC,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kCAAkC,EAClC,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FrameworkExplainPayload } from "../explain/index.js";
|
|
2
|
+
import { type AgentplaneProtocolCompatibility, type AgentplaneProtocolError, type AgentplaneProtocolErrorResult, type AgentplaneProtocolKind, type AgentplaneProtocolSuccessResult, type FrameworkExplainProtocolResult, type FrameworkProtocolSurface } from "./types.js";
|
|
3
|
+
export declare const AGENTPLANE_PROTOCOL_COMPATIBILITY: AgentplaneProtocolCompatibility;
|
|
4
|
+
export declare function buildProtocolSuccessResult<TKind extends AgentplaneProtocolKind, TData>(opts: {
|
|
5
|
+
kind: TKind;
|
|
6
|
+
data: TData;
|
|
7
|
+
}): AgentplaneProtocolSuccessResult<TKind, TData>;
|
|
8
|
+
export declare function buildProtocolErrorResult<TKind extends AgentplaneProtocolKind>(opts: {
|
|
9
|
+
kind: TKind;
|
|
10
|
+
error: AgentplaneProtocolError;
|
|
11
|
+
}): AgentplaneProtocolErrorResult<TKind>;
|
|
12
|
+
export declare function buildFrameworkExplainProtocolResult(explain: FrameworkExplainPayload): FrameworkExplainProtocolResult;
|
|
13
|
+
export declare function buildFrameworkProtocolSurface(opts: {
|
|
14
|
+
explain: FrameworkExplainPayload;
|
|
15
|
+
}): FrameworkProtocolSurface;
|
|
16
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/runtime/protocol/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iCAAiC,EAAE,+BAK/C,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,KAAK,SAAS,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE;IAC5F,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,KAAK,CAAC;CACb,GAAG,+BAA+B,CAAC,KAAK,EAAE,KAAK,CAAC,CAQhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,sBAAsB,EAAE,IAAI,EAAE;IACnF,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,uBAAuB,CAAC;CAChC,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAQvC;AAED,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,uBAAuB,GAC/B,8BAA8B,CAKhC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,uBAAuB,CAAC;CAClC,GAAG,wBAAwB,CAI3B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AGENTPLANE_PROTOCOL_SCHEMA_VERSION, } from "./types.js";
|
|
2
|
+
export const AGENTPLANE_PROTOCOL_COMPATIBILITY = {
|
|
3
|
+
strategy: "additive",
|
|
4
|
+
breaking_changes_require_schema_version: true,
|
|
5
|
+
additive_fields_allowed: true,
|
|
6
|
+
new_result_kinds_allowed: true,
|
|
7
|
+
};
|
|
8
|
+
export function buildProtocolSuccessResult(opts) {
|
|
9
|
+
return {
|
|
10
|
+
schema_version: AGENTPLANE_PROTOCOL_SCHEMA_VERSION,
|
|
11
|
+
kind: opts.kind,
|
|
12
|
+
status: "ok",
|
|
13
|
+
compatibility: structuredClone(AGENTPLANE_PROTOCOL_COMPATIBILITY),
|
|
14
|
+
data: structuredClone(opts.data),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function buildProtocolErrorResult(opts) {
|
|
18
|
+
return {
|
|
19
|
+
schema_version: AGENTPLANE_PROTOCOL_SCHEMA_VERSION,
|
|
20
|
+
kind: opts.kind,
|
|
21
|
+
status: "error",
|
|
22
|
+
compatibility: structuredClone(AGENTPLANE_PROTOCOL_COMPATIBILITY),
|
|
23
|
+
error: structuredClone(opts.error),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function buildFrameworkExplainProtocolResult(explain) {
|
|
27
|
+
return buildProtocolSuccessResult({
|
|
28
|
+
kind: "framework.explain",
|
|
29
|
+
data: explain,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function buildFrameworkProtocolSurface(opts) {
|
|
33
|
+
return {
|
|
34
|
+
explain: buildFrameworkExplainProtocolResult(opts.explain),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FrameworkExplainPayload } from "../explain/index.js";
|
|
2
|
+
export declare const AGENTPLANE_PROTOCOL_SCHEMA_VERSION: 1;
|
|
3
|
+
export type AgentplaneProtocolSchemaVersion = typeof AGENTPLANE_PROTOCOL_SCHEMA_VERSION;
|
|
4
|
+
export type AgentplaneProtocolStatus = "ok" | "error";
|
|
5
|
+
export type AgentplaneProtocolKind = string;
|
|
6
|
+
export type AgentplaneProtocolCompatibility = {
|
|
7
|
+
strategy: "additive";
|
|
8
|
+
breaking_changes_require_schema_version: true;
|
|
9
|
+
additive_fields_allowed: true;
|
|
10
|
+
new_result_kinds_allowed: true;
|
|
11
|
+
};
|
|
12
|
+
export type AgentplaneProtocolBase<TKind extends AgentplaneProtocolKind> = {
|
|
13
|
+
schema_version: AgentplaneProtocolSchemaVersion;
|
|
14
|
+
kind: TKind;
|
|
15
|
+
compatibility: AgentplaneProtocolCompatibility;
|
|
16
|
+
};
|
|
17
|
+
export type AgentplaneProtocolSuccessResult<TKind extends AgentplaneProtocolKind, TData> = AgentplaneProtocolBase<TKind> & {
|
|
18
|
+
status: "ok";
|
|
19
|
+
data: TData;
|
|
20
|
+
};
|
|
21
|
+
export type AgentplaneProtocolError = {
|
|
22
|
+
code: string;
|
|
23
|
+
message: string;
|
|
24
|
+
retryable?: boolean;
|
|
25
|
+
details?: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
export type AgentplaneProtocolErrorResult<TKind extends AgentplaneProtocolKind> = AgentplaneProtocolBase<TKind> & {
|
|
28
|
+
status: "error";
|
|
29
|
+
error: AgentplaneProtocolError;
|
|
30
|
+
};
|
|
31
|
+
export type AgentplaneProtocolResult<TKind extends AgentplaneProtocolKind, TData> = AgentplaneProtocolSuccessResult<TKind, TData> | AgentplaneProtocolErrorResult<TKind>;
|
|
32
|
+
export type FrameworkExplainProtocolResult = AgentplaneProtocolSuccessResult<"framework.explain", FrameworkExplainPayload>;
|
|
33
|
+
export type FrameworkProtocolSurface = {
|
|
34
|
+
explain: FrameworkExplainProtocolResult;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/protocol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,eAAO,MAAM,kCAAkC,EAAG,CAAU,CAAC;AAE7D,MAAM,MAAM,+BAA+B,GAAG,OAAO,kCAAkC,CAAC;AAExF,MAAM,MAAM,wBAAwB,GAAG,IAAI,GAAG,OAAO,CAAC;AAEtD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,EAAE,UAAU,CAAC;IACrB,uCAAuC,EAAE,IAAI,CAAC;IAC9C,uBAAuB,EAAE,IAAI,CAAC;IAC9B,wBAAwB,EAAE,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,KAAK,SAAS,sBAAsB,IAAI;IACzE,cAAc,EAAE,+BAA+B,CAAC;IAChD,IAAI,EAAE,KAAK,CAAC;IACZ,aAAa,EAAE,+BAA+B,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,+BAA+B,CACzC,KAAK,SAAS,sBAAsB,EACpC,KAAK,IACH,sBAAsB,CAAC,KAAK,CAAC,GAAG;IAClC,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,6BAA6B,CAAC,KAAK,SAAS,sBAAsB,IAC5E,sBAAsB,CAAC,KAAK,CAAC,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC;AAEJ,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,sBAAsB,EAAE,KAAK,IAC5E,+BAA+B,CAAC,KAAK,EAAE,KAAK,CAAC,GAC7C,6BAA6B,CAAC,KAAK,CAAC,CAAC;AAEzC,MAAM,MAAM,8BAA8B,GAAG,+BAA+B,CAC1E,mBAAmB,EACnB,uBAAuB,CACxB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,8BAA8B,CAAC;CACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const AGENTPLANE_PROTOCOL_SCHEMA_VERSION = 1;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createClarificationContract, createTaskGraphDraft, createTaskIntakeContext, createTaskIntakeRuntime, materializeTaskGraphDraft, } from "./resolve.js";
|
|
2
|
+
export type { ClarificationContract, ClarificationQuestion, TaskGraphDependency, TaskGraphDraft, TaskGraphDraftTask, TaskIntakeContext, TaskIntakeInput, TaskIntakeInputKind, TaskIntakePrecedence, TaskIntakeRuntime, TaskIntakeSourceId, TaskIntakeSourceRef, TaskMaterializationEntry, TaskMaterializationPlan, } from "./types.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/task-intake/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createClarificationContract, createTaskGraphDraft, createTaskIntakeContext, createTaskIntakeRuntime, materializeTaskGraphDraft, } from "./resolve.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AgentplaneCapabilityRegistry } from "../capabilities/index.js";
|
|
2
|
+
import type { ResolvedExecutionProfileRuntime } from "../execution-profile/index.js";
|
|
3
|
+
import type { ResolvedHarnessContract } from "../harness/index.js";
|
|
4
|
+
import type { ClarificationContract, ClarificationQuestion, TaskGraphDependency, TaskGraphDraft, TaskGraphDraftTask, TaskIntakeContext, TaskIntakeInput, TaskIntakeRuntime, TaskMaterializationPlan } from "./types.js";
|
|
5
|
+
export declare function createTaskIntakeRuntime(opts: {
|
|
6
|
+
repo: TaskIntakeRuntime["repo"];
|
|
7
|
+
backend: {
|
|
8
|
+
id: string;
|
|
9
|
+
config_path: string;
|
|
10
|
+
capabilities: TaskIntakeRuntime["backend"]["capabilities"];
|
|
11
|
+
supports_generate_task_id: boolean;
|
|
12
|
+
supports_bulk_write: boolean;
|
|
13
|
+
};
|
|
14
|
+
harness: Pick<ResolvedHarnessContract, "workflow" | "task" | "policy">;
|
|
15
|
+
execution_profile: ResolvedExecutionProfileRuntime;
|
|
16
|
+
capabilities: AgentplaneCapabilityRegistry;
|
|
17
|
+
}): TaskIntakeRuntime;
|
|
18
|
+
export declare function createTaskIntakeContext(opts: {
|
|
19
|
+
runtime: TaskIntakeRuntime;
|
|
20
|
+
source: TaskIntakeContext["source"];
|
|
21
|
+
requested_outcome: string;
|
|
22
|
+
requested_owner?: string;
|
|
23
|
+
requested_tags?: string[];
|
|
24
|
+
requested_verify?: string[];
|
|
25
|
+
requested_dependencies?: string[];
|
|
26
|
+
parent_task_id?: string;
|
|
27
|
+
inputs?: TaskIntakeInput[];
|
|
28
|
+
}): TaskIntakeContext;
|
|
29
|
+
export declare function createClarificationContract(opts: {
|
|
30
|
+
context: TaskIntakeContext;
|
|
31
|
+
assumptions?: string[];
|
|
32
|
+
questions?: ClarificationQuestion[];
|
|
33
|
+
}): ClarificationContract;
|
|
34
|
+
export declare function createTaskGraphDraft(opts: {
|
|
35
|
+
context: TaskIntakeContext;
|
|
36
|
+
clarification: ClarificationContract;
|
|
37
|
+
summary: string;
|
|
38
|
+
tasks: TaskGraphDraftTask[];
|
|
39
|
+
dependencies?: TaskGraphDependency[];
|
|
40
|
+
warnings?: string[];
|
|
41
|
+
}): TaskGraphDraft;
|
|
42
|
+
export declare function materializeTaskGraphDraft(opts: {
|
|
43
|
+
draft: TaskGraphDraft;
|
|
44
|
+
task_ids?: Record<string, string>;
|
|
45
|
+
allocateTaskId?: (task: TaskGraphDraftTask, index: number) => Promise<string>;
|
|
46
|
+
created_at?: string;
|
|
47
|
+
}): Promise<TaskMaterializationPlan>;
|
|
48
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/runtime/task-intake/resolve.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EAEjB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAgOpB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC;QAC3D,yBAAyB,EAAE,OAAO,CAAC;QACnC,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;IACvE,iBAAiB,EAAE,+BAA+B,CAAC;IACnD,YAAY,EAAE,4BAA4B,CAAC;CAC5C,GAAG,iBAAiB,CAoCpB;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B,GAAG,iBAAiB,CAepB;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACrC,GAAG,qBAAqB,CAQxB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,aAAa,EAAE,qBAAqB,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,cAAc,CAUjB;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAyCnC"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { buildTaskDocState } from "../../shared/task-doc-state.js";
|
|
3
|
+
const TASK_INTAKE_BEHAVIOR_ORDER = [
|
|
4
|
+
"harness",
|
|
5
|
+
"extension",
|
|
6
|
+
"user",
|
|
7
|
+
"builtin",
|
|
8
|
+
];
|
|
9
|
+
function dedupeTrimmed(values) {
|
|
10
|
+
const seen = new Set();
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const raw of values) {
|
|
13
|
+
const value = String(raw ?? "").trim();
|
|
14
|
+
if (!value || seen.has(value))
|
|
15
|
+
continue;
|
|
16
|
+
seen.add(value);
|
|
17
|
+
out.push(value);
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
function normalizeOutcome(value) {
|
|
22
|
+
const normalized = value.trim();
|
|
23
|
+
if (!normalized)
|
|
24
|
+
throw new Error("Task intake context requires a non-empty requested outcome.");
|
|
25
|
+
return normalized;
|
|
26
|
+
}
|
|
27
|
+
function normalizeSourceDetail(value) {
|
|
28
|
+
const normalized = value.trim();
|
|
29
|
+
if (!normalized)
|
|
30
|
+
throw new Error("Task intake source detail must be non-empty.");
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
33
|
+
function normalizeInputs(inputs) {
|
|
34
|
+
return inputs
|
|
35
|
+
.map((input) => ({
|
|
36
|
+
kind: input.kind,
|
|
37
|
+
...(input.label?.trim() ? { label: input.label.trim() } : {}),
|
|
38
|
+
value: normalizeOutcome(input.value),
|
|
39
|
+
...(input.required === true ? { required: true } : {}),
|
|
40
|
+
}))
|
|
41
|
+
.toSorted((left, right) => left.kind.localeCompare(right.kind) ||
|
|
42
|
+
(left.label ?? "").localeCompare(right.label ?? "") ||
|
|
43
|
+
left.value.localeCompare(right.value));
|
|
44
|
+
}
|
|
45
|
+
function normalizeQuestions(questions) {
|
|
46
|
+
const seen = new Set();
|
|
47
|
+
const out = [];
|
|
48
|
+
for (const raw of questions) {
|
|
49
|
+
const id = raw.id.trim();
|
|
50
|
+
const question = raw.question.trim();
|
|
51
|
+
const reason = raw.reason.trim();
|
|
52
|
+
if (!id)
|
|
53
|
+
throw new Error("Clarification questions require a non-empty id.");
|
|
54
|
+
if (!question)
|
|
55
|
+
throw new Error(`Clarification question ${id} requires question text.`);
|
|
56
|
+
if (!reason)
|
|
57
|
+
throw new Error(`Clarification question ${id} requires a reason.`);
|
|
58
|
+
if (seen.has(id))
|
|
59
|
+
throw new Error(`Clarification question ids must be unique: ${id}`);
|
|
60
|
+
seen.add(id);
|
|
61
|
+
out.push({
|
|
62
|
+
id,
|
|
63
|
+
question,
|
|
64
|
+
reason,
|
|
65
|
+
required: raw.required === true,
|
|
66
|
+
...(raw.target_field?.trim() ? { target_field: raw.target_field.trim() } : {}),
|
|
67
|
+
...(raw.accepted_values
|
|
68
|
+
? { accepted_values: dedupeTrimmed(raw.accepted_values).toSorted() }
|
|
69
|
+
: {}),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return out.toSorted((left, right) => left.id.localeCompare(right.id));
|
|
73
|
+
}
|
|
74
|
+
function normalizeDraftTasks(tasks) {
|
|
75
|
+
if (tasks.length === 0)
|
|
76
|
+
throw new Error("Task graph draft requires at least one task.");
|
|
77
|
+
const seen = new Set();
|
|
78
|
+
return tasks.map((task) => {
|
|
79
|
+
const draft_id = task.draft_id.trim();
|
|
80
|
+
if (!draft_id)
|
|
81
|
+
throw new Error("Task graph draft tasks require a non-empty draft_id.");
|
|
82
|
+
if (seen.has(draft_id))
|
|
83
|
+
throw new Error(`Duplicate task graph draft id: ${draft_id}`);
|
|
84
|
+
seen.add(draft_id);
|
|
85
|
+
const title = task.title.trim();
|
|
86
|
+
if (!title)
|
|
87
|
+
throw new Error(`Task graph draft task ${draft_id} requires a title.`);
|
|
88
|
+
const description = task.description.trim();
|
|
89
|
+
if (!description) {
|
|
90
|
+
throw new Error(`Task graph draft task ${draft_id} requires a description.`);
|
|
91
|
+
}
|
|
92
|
+
const owner = task.owner.trim();
|
|
93
|
+
if (!owner)
|
|
94
|
+
throw new Error(`Task graph draft task ${draft_id} requires an owner.`);
|
|
95
|
+
const doc = task.doc.trim();
|
|
96
|
+
if (!doc)
|
|
97
|
+
throw new Error(`Task graph draft task ${draft_id} requires a task document.`);
|
|
98
|
+
return {
|
|
99
|
+
draft_id,
|
|
100
|
+
title,
|
|
101
|
+
description,
|
|
102
|
+
owner,
|
|
103
|
+
priority: task.priority,
|
|
104
|
+
...(task.origin ? { origin: structuredClone(task.origin) } : {}),
|
|
105
|
+
tags: dedupeTrimmed(task.tags).toSorted(),
|
|
106
|
+
verify: dedupeTrimmed(task.verify).toSorted(),
|
|
107
|
+
depends_on: dedupeTrimmed(task.depends_on).toSorted(),
|
|
108
|
+
doc,
|
|
109
|
+
...(task.doc_version ? { doc_version: task.doc_version } : {}),
|
|
110
|
+
...(task.id_source?.trim() ? { id_source: task.id_source.trim() } : {}),
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function normalizeDependencies(tasks, dependencies) {
|
|
115
|
+
const taskIds = new Set(tasks.map((task) => task.draft_id));
|
|
116
|
+
const seen = new Set();
|
|
117
|
+
const out = [];
|
|
118
|
+
for (const dependency of dependencies) {
|
|
119
|
+
if (!taskIds.has(dependency.from)) {
|
|
120
|
+
throw new Error(`Task graph dependency source is unknown: ${dependency.from}`);
|
|
121
|
+
}
|
|
122
|
+
if (!taskIds.has(dependency.to)) {
|
|
123
|
+
throw new Error(`Task graph dependency target is unknown: ${dependency.to}`);
|
|
124
|
+
}
|
|
125
|
+
const signature = `${dependency.from}:${dependency.kind}:${dependency.to}`;
|
|
126
|
+
if (seen.has(signature))
|
|
127
|
+
continue;
|
|
128
|
+
seen.add(signature);
|
|
129
|
+
out.push({
|
|
130
|
+
from: dependency.from,
|
|
131
|
+
to: dependency.to,
|
|
132
|
+
kind: "depends_on",
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return out.toSorted((left, right) => left.from.localeCompare(right.from) ||
|
|
136
|
+
left.kind.localeCompare(right.kind) ||
|
|
137
|
+
left.to.localeCompare(right.to));
|
|
138
|
+
}
|
|
139
|
+
function resolveTaskIds(opts) {
|
|
140
|
+
const provided = new Map();
|
|
141
|
+
const taskIds = opts.task_ids ?? {};
|
|
142
|
+
for (const task of opts.tasks) {
|
|
143
|
+
const taskId = taskIds[task.draft_id]?.trim();
|
|
144
|
+
if (taskId)
|
|
145
|
+
provided.set(task.draft_id, taskId);
|
|
146
|
+
}
|
|
147
|
+
return (async () => {
|
|
148
|
+
if (provided.size === opts.tasks.length)
|
|
149
|
+
return provided;
|
|
150
|
+
if (!opts.allocateTaskId) {
|
|
151
|
+
throw new Error("Task graph materialization requires task_ids for every draft task or an allocateTaskId callback.");
|
|
152
|
+
}
|
|
153
|
+
for (const [index, task] of opts.tasks.entries()) {
|
|
154
|
+
if (provided.has(task.draft_id))
|
|
155
|
+
continue;
|
|
156
|
+
const allocatedTaskId = await opts.allocateTaskId(task, index);
|
|
157
|
+
const taskId = allocatedTaskId.trim();
|
|
158
|
+
if (!taskId) {
|
|
159
|
+
throw new Error(`Task id allocator returned an empty id for draft ${task.draft_id}.`);
|
|
160
|
+
}
|
|
161
|
+
provided.set(task.draft_id, taskId);
|
|
162
|
+
}
|
|
163
|
+
return provided;
|
|
164
|
+
})();
|
|
165
|
+
}
|
|
166
|
+
function buildMaterializedTask(opts) {
|
|
167
|
+
const normalizedDoc = buildTaskDocState({
|
|
168
|
+
doc: opts.draftTask.doc,
|
|
169
|
+
owner: opts.draftTask.owner,
|
|
170
|
+
updatedBy: opts.draftTask.owner,
|
|
171
|
+
version: opts.draftTask.doc_version ?? 3,
|
|
172
|
+
updatedAt: opts.created_at,
|
|
173
|
+
});
|
|
174
|
+
const task = {
|
|
175
|
+
id: opts.task_id,
|
|
176
|
+
title: opts.draftTask.title,
|
|
177
|
+
description: opts.draftTask.description,
|
|
178
|
+
status: "TODO",
|
|
179
|
+
priority: opts.draftTask.priority,
|
|
180
|
+
owner: opts.draftTask.owner,
|
|
181
|
+
revision: 1,
|
|
182
|
+
...(opts.draftTask.origin ? { origin: structuredClone(opts.draftTask.origin) } : {}),
|
|
183
|
+
depends_on: dedupeTrimmed([
|
|
184
|
+
...opts.draftTask.depends_on,
|
|
185
|
+
...opts.internal_dependencies,
|
|
186
|
+
]).toSorted(),
|
|
187
|
+
tags: [...opts.draftTask.tags],
|
|
188
|
+
verify: [...opts.draftTask.verify],
|
|
189
|
+
comments: [],
|
|
190
|
+
events: [],
|
|
191
|
+
doc_version: normalizedDoc.doc_version,
|
|
192
|
+
doc_updated_at: normalizedDoc.doc_updated_at,
|
|
193
|
+
doc_updated_by: normalizedDoc.doc_updated_by,
|
|
194
|
+
id_source: opts.draftTask.id_source ?? "generated",
|
|
195
|
+
doc: normalizedDoc.doc,
|
|
196
|
+
sections: normalizedDoc.sections,
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
draft_id: opts.draftTask.draft_id,
|
|
200
|
+
task_id: opts.task_id,
|
|
201
|
+
task,
|
|
202
|
+
readme_path: path.join(opts.context.runtime.repo.git_root, opts.context.runtime.repo.workflow_dir, opts.task_id, "README.md"),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export function createTaskIntakeRuntime(opts) {
|
|
206
|
+
return {
|
|
207
|
+
repo: {
|
|
208
|
+
git_root: opts.repo.git_root,
|
|
209
|
+
agentplane_dir: opts.repo.agentplane_dir,
|
|
210
|
+
workflow_dir: opts.repo.workflow_dir,
|
|
211
|
+
},
|
|
212
|
+
workflow: {
|
|
213
|
+
mode: opts.harness.workflow.mode,
|
|
214
|
+
},
|
|
215
|
+
backend: {
|
|
216
|
+
id: opts.backend.id,
|
|
217
|
+
config_path: opts.backend.config_path,
|
|
218
|
+
capabilities: opts.backend.capabilities ? structuredClone(opts.backend.capabilities) : null,
|
|
219
|
+
supports_generate_task_id: opts.backend.supports_generate_task_id,
|
|
220
|
+
supports_bulk_write: opts.backend.supports_bulk_write,
|
|
221
|
+
},
|
|
222
|
+
task_contract: {
|
|
223
|
+
doc_sections: [...opts.harness.task.doc_sections],
|
|
224
|
+
required_doc_sections: [...opts.harness.task.required_doc_sections],
|
|
225
|
+
verify_required_tags: [...opts.harness.task.verify_required_tags],
|
|
226
|
+
},
|
|
227
|
+
policy: {
|
|
228
|
+
approvals: structuredClone(opts.harness.policy.approvals),
|
|
229
|
+
protected_paths: structuredClone(opts.harness.policy.protected_paths),
|
|
230
|
+
unsafe_actions_requiring_explicit_user_ok: [
|
|
231
|
+
...opts.harness.policy.unsafe_actions_requiring_explicit_user_ok,
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
execution_profile: structuredClone(opts.execution_profile),
|
|
235
|
+
capabilities: structuredClone(opts.capabilities),
|
|
236
|
+
precedence: {
|
|
237
|
+
behavior_order: [...TASK_INTAKE_BEHAVIOR_ORDER],
|
|
238
|
+
extension_layer: "recipes",
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
export function createTaskIntakeContext(opts) {
|
|
243
|
+
return {
|
|
244
|
+
runtime: structuredClone(opts.runtime),
|
|
245
|
+
source: {
|
|
246
|
+
id: opts.source.id,
|
|
247
|
+
detail: normalizeSourceDetail(opts.source.detail),
|
|
248
|
+
},
|
|
249
|
+
requested_outcome: normalizeOutcome(opts.requested_outcome),
|
|
250
|
+
...(opts.requested_owner?.trim() ? { requested_owner: opts.requested_owner.trim() } : {}),
|
|
251
|
+
requested_tags: dedupeTrimmed(opts.requested_tags ?? []).toSorted(),
|
|
252
|
+
requested_verify: dedupeTrimmed(opts.requested_verify ?? []).toSorted(),
|
|
253
|
+
requested_dependencies: dedupeTrimmed(opts.requested_dependencies ?? []).toSorted(),
|
|
254
|
+
...(opts.parent_task_id?.trim() ? { parent_task_id: opts.parent_task_id.trim() } : {}),
|
|
255
|
+
inputs: normalizeInputs(opts.inputs ?? []),
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
export function createClarificationContract(opts) {
|
|
259
|
+
const questions = normalizeQuestions(opts.questions ?? []);
|
|
260
|
+
return {
|
|
261
|
+
context: structuredClone(opts.context),
|
|
262
|
+
status: questions.some((question) => question.required) ? "needs_input" : "ready",
|
|
263
|
+
assumptions: dedupeTrimmed(opts.assumptions ?? []),
|
|
264
|
+
questions,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
export function createTaskGraphDraft(opts) {
|
|
268
|
+
const tasks = normalizeDraftTasks(opts.tasks);
|
|
269
|
+
return {
|
|
270
|
+
context: structuredClone(opts.context),
|
|
271
|
+
clarification: structuredClone(opts.clarification),
|
|
272
|
+
summary: normalizeOutcome(opts.summary),
|
|
273
|
+
tasks,
|
|
274
|
+
dependencies: normalizeDependencies(tasks, opts.dependencies ?? []),
|
|
275
|
+
warnings: dedupeTrimmed(opts.warnings ?? []),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
export async function materializeTaskGraphDraft(opts) {
|
|
279
|
+
if (opts.draft.clarification.status === "needs_input") {
|
|
280
|
+
throw new Error("Task graph materialization requires clarification.status=ready.");
|
|
281
|
+
}
|
|
282
|
+
const created_at = opts.created_at ?? new Date().toISOString();
|
|
283
|
+
const taskIds = await resolveTaskIds({
|
|
284
|
+
tasks: opts.draft.tasks,
|
|
285
|
+
task_ids: opts.task_ids,
|
|
286
|
+
allocateTaskId: opts.allocateTaskId,
|
|
287
|
+
});
|
|
288
|
+
const tasks = opts.draft.tasks.map((draftTask) => {
|
|
289
|
+
const task_id = taskIds.get(draftTask.draft_id);
|
|
290
|
+
if (!task_id) {
|
|
291
|
+
throw new Error(`Task id resolution lost draft task ${draftTask.draft_id}.`);
|
|
292
|
+
}
|
|
293
|
+
const internal_dependencies = opts.draft.dependencies
|
|
294
|
+
.filter((dependency) => dependency.from === draftTask.draft_id)
|
|
295
|
+
.map((dependency) => {
|
|
296
|
+
const resolved = taskIds.get(dependency.to);
|
|
297
|
+
if (!resolved) {
|
|
298
|
+
throw new Error(`Task id resolution lost dependency target ${dependency.to}.`);
|
|
299
|
+
}
|
|
300
|
+
return resolved;
|
|
301
|
+
});
|
|
302
|
+
return buildMaterializedTask({
|
|
303
|
+
context: opts.draft.context,
|
|
304
|
+
draftTask,
|
|
305
|
+
task_id,
|
|
306
|
+
internal_dependencies,
|
|
307
|
+
created_at,
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
return {
|
|
311
|
+
context: structuredClone(opts.draft.context),
|
|
312
|
+
summary: opts.draft.summary,
|
|
313
|
+
backend: structuredClone(opts.draft.context.runtime.backend),
|
|
314
|
+
tasks,
|
|
315
|
+
};
|
|
316
|
+
}
|