@fitlab-ai/agent-infra 0.9.2 → 0.9.4
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/README.md +12 -9
- package/README.zh-CN.md +12 -9
- package/bin/cli.ts +12 -0
- package/dist/bin/cli.js +14 -0
- package/dist/bin/internal-cli.js +134 -108
- package/dist/lib/agent-clients/adapter.js +137 -4
- package/dist/lib/agent-clients/adapters/antigravity-cli.js +64 -0
- package/dist/lib/{sandbox/credentials.js → agent-clients/adapters/claude-code-credentials.js} +4 -14
- package/dist/lib/agent-clients/adapters/claude-code-refresh.js +85 -0
- package/dist/lib/agent-clients/adapters/claude-code-sandbox.js +247 -0
- package/dist/lib/agent-clients/adapters/claude-code.js +27 -4
- package/dist/lib/agent-clients/adapters/codex.js +9 -0
- package/dist/lib/agent-clients/adapters/index.js +2 -2
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +108 -0
- package/dist/lib/agent-clients/adapters/opencode.js +24 -3
- package/dist/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
- package/dist/lib/agent-clients/config.js +42 -4
- package/dist/lib/agent-clients/next-steps.js +11 -2
- package/dist/lib/agent-clients/reconcile.js +2 -1
- package/dist/lib/agent-clients/registry.js +16 -2
- package/dist/lib/agent-clients/schema.js +18 -0
- package/dist/lib/agent-clients/tokens.js +49 -0
- package/dist/lib/agent-clients/types.js +1 -1
- package/dist/lib/defaults.json +1 -1
- package/dist/lib/git/workflow.js +54 -1
- package/dist/lib/internal/agent-client.js +61 -4
- package/dist/lib/internal/git-workflow.js +6 -1
- package/dist/lib/internal/platform-checks.js +3 -3
- package/dist/lib/internal/platform-comment.js +29 -2
- package/dist/lib/internal/platform-issue.js +7 -0
- package/dist/lib/internal/platform-pr-review.js +132 -0
- package/dist/lib/internal/platform-pr.js +20 -2
- package/dist/lib/internal/platform-release-notes.js +52 -16
- package/dist/lib/internal/pr-review-grade.js +140 -0
- package/dist/lib/internal/release-workflow.js +13 -6
- package/dist/lib/internal/sandbox-control.js +24 -0
- package/dist/lib/internal/task-activity.js +105 -0
- package/dist/lib/internal/task-event.js +17 -1
- package/dist/lib/internal/task-ledger.js +12 -3
- package/dist/lib/internal/task-lifecycle.js +26 -1
- package/dist/lib/internal/task-orchestration.js +167 -18
- package/dist/lib/internal/task-review.js +8 -3
- package/dist/lib/platform/adapters.js +8 -1
- package/dist/lib/platform/completion-backfill.js +122 -0
- package/dist/lib/platform/github-client.js +19 -2
- package/dist/lib/platform/issue-comments.js +3 -2
- package/dist/lib/platform/merged-pr-equivalence.js +115 -5
- package/dist/lib/platform/pr-checks.js +65 -42
- package/dist/lib/platform/pr-review.js +166 -0
- package/dist/lib/platform/pull-requests.js +371 -4
- package/dist/lib/platform/release-notes.js +85 -3
- package/dist/lib/platform/releases.js +13 -5
- package/dist/lib/pr-review/evidence-grading.js +229 -0
- package/dist/lib/process-data/index.js +239 -0
- package/dist/lib/process-data/normalize.js +198 -0
- package/dist/lib/process-data/privacy.js +33 -0
- package/dist/lib/process-data/reconcile.js +95 -0
- package/dist/lib/process-data/repair.js +58 -0
- package/dist/lib/process-data/sources.js +345 -0
- package/dist/lib/process-data/store.js +282 -0
- package/dist/lib/process-data/types.js +2 -0
- package/dist/lib/run/index.js +4 -3
- package/dist/lib/run/tui.js +10 -13
- package/dist/lib/sandbox/agent-client-reconciler.js +26 -2
- package/dist/lib/sandbox/capture.js +7 -2
- package/dist/lib/sandbox/commands/create.js +109 -248
- package/dist/lib/sandbox/commands/enter.js +15 -47
- package/dist/lib/sandbox/commands/list-running.js +16 -6
- package/dist/lib/sandbox/commands/ls.js +10 -6
- package/dist/lib/sandbox/commands/rebuild.js +4 -3
- package/dist/lib/sandbox/commands/refresh.js +4 -84
- package/dist/lib/sandbox/commands/rm.js +24 -3
- package/dist/lib/sandbox/commands/show.js +13 -4
- package/dist/lib/sandbox/commands/start.js +7 -4
- package/dist/lib/sandbox/config.js +2 -0
- package/dist/lib/sandbox/constants.js +6 -0
- package/dist/lib/sandbox/control/client.js +44 -0
- package/dist/lib/sandbox/control/protocol.js +35 -0
- package/dist/lib/sandbox/control/server.js +109 -0
- package/dist/lib/sandbox/dockerfile.js +36 -13
- package/dist/lib/sandbox/mounts.js +17 -4
- package/dist/lib/sandbox/recovery.js +128 -5
- package/dist/lib/sandbox/redaction.js +12 -0
- package/dist/lib/sandbox/runtimes/base.dockerfile +24 -74
- package/dist/lib/sandbox/workspace-identity.js +95 -0
- package/dist/lib/sandbox/workspace-view.js +103 -0
- package/dist/lib/task/activity-intent.js +307 -0
- package/dist/lib/task/artifact-lifecycle.js +2 -1
- package/dist/lib/task/commands/log.js +15 -14
- package/dist/lib/task/commit-finalization.js +267 -0
- package/dist/lib/task/commit-intent.js +165 -0
- package/dist/lib/task/decision-intents.js +31 -17
- package/dist/lib/task/delegation-receipts.js +25 -4
- package/dist/lib/task/events.js +67 -28
- package/dist/lib/task/finalization-artifacts.js +35 -0
- package/dist/lib/task/implementation-inputs.js +54 -7
- package/dist/lib/task/ledger-intents.js +35 -1
- package/dist/lib/task/lifecycle-execution.js +46 -0
- package/dist/lib/task/orchestration.js +753 -54
- package/dist/lib/task/resolve-ref.js +41 -1
- package/dist/lib/task/review-finalization.js +29 -9
- package/dist/lib/task/task-execution-lock.js +231 -0
- package/dist/lib/task/verification-checks.js +1 -1
- package/dist/lib/task/verification-engine.js +218 -2
- package/dist/lib/task/verification.js +4 -3
- package/dist/lib/task/workspace-snapshot.js +17 -5
- package/lib/agent-clients/adapter.ts +201 -4
- package/lib/agent-clients/adapters/antigravity-cli.ts +65 -0
- package/lib/{sandbox/credentials.ts → agent-clients/adapters/claude-code-credentials.ts} +3 -18
- package/lib/agent-clients/adapters/claude-code-refresh.ts +128 -0
- package/lib/agent-clients/adapters/claude-code-sandbox.ts +295 -0
- package/lib/agent-clients/adapters/claude-code.ts +31 -4
- package/lib/agent-clients/adapters/codex.ts +9 -0
- package/lib/agent-clients/adapters/index.ts +2 -2
- package/lib/agent-clients/adapters/opencode-sandbox.ts +136 -0
- package/lib/agent-clients/adapters/opencode.ts +27 -3
- package/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
- package/lib/agent-clients/config.ts +49 -4
- package/lib/agent-clients/next-steps.ts +15 -2
- package/lib/agent-clients/reconcile.ts +2 -1
- package/lib/agent-clients/registry.ts +19 -1
- package/lib/agent-clients/schema.ts +18 -0
- package/lib/agent-clients/tokens.ts +53 -0
- package/lib/agent-clients/types.ts +15 -1
- package/lib/defaults.json +1 -1
- package/lib/git/workflow.ts +66 -2
- package/lib/internal/agent-client.ts +59 -4
- package/lib/internal/git-workflow.ts +5 -1
- package/lib/internal/platform-checks.ts +4 -4
- package/lib/internal/platform-comment.ts +17 -2
- package/lib/internal/platform-issue.ts +4 -0
- package/lib/internal/platform-pr-review.ts +104 -0
- package/lib/internal/platform-pr.ts +14 -1
- package/lib/internal/platform-release-notes.ts +59 -16
- package/lib/internal/pr-review-grade.ts +130 -0
- package/lib/internal/release-workflow.ts +13 -6
- package/lib/internal/sandbox-control.ts +24 -0
- package/lib/internal/task-activity.ts +91 -0
- package/lib/internal/task-event.ts +9 -1
- package/lib/internal/task-ledger.ts +12 -3
- package/lib/internal/task-lifecycle.ts +26 -1
- package/lib/internal/task-orchestration.ts +123 -14
- package/lib/internal/task-review.ts +8 -3
- package/lib/platform/adapters.ts +29 -2
- package/lib/platform/completion-backfill.ts +134 -0
- package/lib/platform/github-client.ts +20 -2
- package/lib/platform/issue-comments.ts +3 -2
- package/lib/platform/merged-pr-equivalence.ts +127 -5
- package/lib/platform/pr-checks.ts +73 -46
- package/lib/platform/pr-review.ts +201 -0
- package/lib/platform/pull-requests.ts +444 -3
- package/lib/platform/release-notes.ts +100 -4
- package/lib/platform/releases.ts +16 -4
- package/lib/pr-review/evidence-grading.ts +318 -0
- package/lib/process-data/index.ts +224 -0
- package/lib/process-data/normalize.ts +202 -0
- package/lib/process-data/privacy.ts +41 -0
- package/lib/process-data/reconcile.ts +110 -0
- package/lib/process-data/repair.ts +64 -0
- package/lib/process-data/sources.ts +354 -0
- package/lib/process-data/store.ts +315 -0
- package/lib/process-data/types.ts +135 -0
- package/lib/run/index.ts +5 -3
- package/lib/run/tui.ts +14 -12
- package/lib/sandbox/agent-client-reconciler.ts +44 -2
- package/lib/sandbox/capture.ts +9 -2
- package/lib/sandbox/commands/create.ts +126 -280
- package/lib/sandbox/commands/enter.ts +13 -59
- package/lib/sandbox/commands/list-running.ts +23 -6
- package/lib/sandbox/commands/ls.ts +22 -6
- package/lib/sandbox/commands/rebuild.ts +4 -3
- package/lib/sandbox/commands/refresh.ts +4 -126
- package/lib/sandbox/commands/rm.ts +24 -3
- package/lib/sandbox/commands/show.ts +30 -4
- package/lib/sandbox/commands/start.ts +6 -4
- package/lib/sandbox/config.ts +4 -0
- package/lib/sandbox/constants.ts +8 -0
- package/lib/sandbox/control/client.ts +55 -0
- package/lib/sandbox/control/protocol.ts +75 -0
- package/lib/sandbox/control/server.ts +117 -0
- package/lib/sandbox/dockerfile.ts +66 -13
- package/lib/sandbox/mounts.ts +24 -4
- package/lib/sandbox/recovery.ts +163 -6
- package/lib/sandbox/redaction.ts +14 -0
- package/lib/sandbox/runtimes/base.dockerfile +24 -74
- package/lib/sandbox/tool-types.ts +16 -0
- package/lib/sandbox/workspace-identity.ts +123 -0
- package/lib/sandbox/workspace-view.ts +143 -0
- package/lib/server/server.schema.json +2 -2
- package/lib/task/activity-intent.ts +417 -0
- package/lib/task/artifact-lifecycle.ts +2 -1
- package/lib/task/commands/log.ts +15 -14
- package/lib/task/commit-finalization.ts +356 -0
- package/lib/task/commit-intent.ts +230 -0
- package/lib/task/decision-intents.ts +32 -12
- package/lib/task/delegation-receipts.ts +34 -5
- package/lib/task/events.ts +75 -30
- package/lib/task/finalization-artifacts.ts +58 -0
- package/lib/task/implementation-inputs.ts +62 -8
- package/lib/task/ledger-intents.ts +43 -3
- package/lib/task/lifecycle-execution.ts +106 -0
- package/lib/task/orchestration.ts +1019 -72
- package/lib/task/resolve-ref.ts +46 -1
- package/lib/task/review-finalization.ts +40 -9
- package/lib/task/task-execution-lock.ts +296 -0
- package/lib/task/verification-checks.ts +1 -1
- package/lib/task/verification-engine.ts +249 -2
- package/lib/task/verification.ts +5 -3
- package/lib/task/workspace-snapshot.ts +26 -5
- package/package.json +3 -3
- package/templates/.agents/QUICKSTART.en.md +25 -8
- package/templates/.agents/QUICKSTART.zh-CN.md +25 -8
- package/templates/.agents/README.en.md +10 -7
- package/templates/.agents/README.zh-CN.md +10 -7
- package/templates/.agents/hooks/lifecycle-delegation.js +15 -4
- package/templates/.agents/rules/README.en.md +1 -1
- package/templates/.agents/rules/README.zh-CN.md +1 -1
- package/templates/.agents/rules/create-issue.github.en.md +4 -2
- package/templates/.agents/rules/create-issue.github.zh-CN.md +4 -2
- package/templates/.agents/rules/human-decision-context.en.md +11 -2
- package/templates/.agents/rules/human-decision-context.zh-CN.md +11 -2
- package/templates/.agents/rules/issue-fields.github.en.md +3 -1
- package/templates/.agents/rules/issue-fields.github.zh-CN.md +3 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.github.en.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +5 -3
- package/templates/.agents/rules/issue-sync.github.en.md +7 -3
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +8 -4
- package/templates/.agents/rules/lifecycle-orchestration.en.md +5 -2
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +5 -2
- package/templates/.agents/rules/milestone-inference.github.en.md +4 -2
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +4 -2
- package/templates/.agents/rules/next-step-output.en.md +3 -1
- package/templates/.agents/rules/next-step-output.zh-CN.md +3 -1
- package/templates/.agents/rules/no-mid-flow-questions.en.md +17 -0
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +17 -0
- package/templates/.agents/rules/pr-checks-commands.en.md +3 -3
- package/templates/.agents/rules/pr-checks-commands.github.en.md +2 -2
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +3 -3
- package/templates/.agents/rules/pr-checks-commands.zh-CN.md +3 -3
- package/templates/.agents/rules/pr-sync.en.md +3 -1
- package/templates/.agents/rules/pr-sync.github.en.md +11 -1
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +11 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +3 -1
- package/templates/.agents/rules/release-commands.en.md +1 -1
- package/templates/.agents/rules/release-commands.github.en.md +12 -2
- package/templates/.agents/rules/release-commands.github.zh-CN.md +12 -2
- package/templates/.agents/rules/release-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/task-management.en.md +13 -0
- package/templates/.agents/rules/task-management.zh-CN.md +13 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +10 -7
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +10 -7
- package/templates/.agents/skills/block-task/SKILL.en.md +7 -5
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +7 -5
- package/templates/.agents/skills/cancel-task/SKILL.en.md +6 -4
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +6 -4
- package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -1
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -1
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -1
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +10 -7
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +12 -9
- package/templates/.agents/skills/commit/SKILL.en.md +23 -11
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +29 -11
- package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -1
- package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +49 -0
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +55 -0
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +4 -4
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +4 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +6 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +6 -4
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +22 -7
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +22 -7
- package/templates/.agents/skills/complete-task/config/verify.en.json +1 -0
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +17 -0
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +17 -0
- package/templates/.agents/skills/create-pr/SKILL.en.md +7 -5
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +7 -5
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
- package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -16
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +17 -16
- package/templates/.agents/skills/create-task/SKILL.en.md +5 -3
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/create-task/reference/context-capture.en.md +34 -0
- package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +34 -0
- package/templates/.agents/skills/import-issue/SKILL.en.md +5 -3
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/plan-task/SKILL.en.md +8 -5
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/post-release/SKILL.en.md +2 -0
- package/templates/.agents/skills/post-release/SKILL.zh-CN.md +2 -0
- package/templates/.agents/skills/release/SKILL.en.md +16 -10
- package/templates/.agents/skills/release/SKILL.zh-CN.md +16 -10
- package/templates/.agents/skills/restore-task/SKILL.en.md +4 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +7 -4
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +7 -4
- package/templates/.agents/skills/review-code/SKILL.en.md +11 -8
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +11 -8
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
- package/templates/.agents/skills/review-plan/SKILL.en.md +7 -4
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +7 -4
- package/templates/.agents/skills/review-pr/SKILL.en.md +186 -0
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +186 -0
- package/templates/.agents/skills/review-pr/config/verify.en.json +37 -0
- package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +37 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +65 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +65 -0
- package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +18 -0
- package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +18 -0
- package/templates/.agents/skills/review-pr/reference/report-template.en.md +85 -0
- package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +85 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +8 -8
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +8 -8
- package/templates/.agents/skills/run-task/config/verify.en.json +2 -1
- package/templates/.agents/skills/run-task/config/verify.zh-CN.json +2 -1
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +20 -0
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +20 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +98 -107
- package/templates/.agents/skills/watch-pr/SKILL.en.md +13 -13
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +13 -13
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +27 -6
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +26 -5
- package/templates/.agents/templates/task.en.md +2 -2
- package/templates/.agents/templates/task.zh-CN.md +2 -2
- package/templates/.agents/workflows/bug-fix.en.yaml +3 -3
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +3 -3
- package/templates/.agents/workflows/code-review.en.yaml +1 -1
- package/templates/.agents/workflows/code-review.zh-CN.yaml +1 -1
- package/templates/.agents/workflows/feature-development.en.yaml +4 -4
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +4 -4
- package/templates/.agents/workflows/refactoring.en.yaml +3 -3
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +3 -3
- package/templates/.claude/commands/post-release.en.md +1 -0
- package/templates/.claude/commands/post-release.zh-CN.md +1 -0
- package/templates/.claude/commands/review-pr.en.md +8 -0
- package/templates/.claude/commands/review-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.claude/rules/tool-preferences.en.md +20 -0
- package/templates/.claude/rules/tool-preferences.zh-CN.md +20 -0
- package/templates/.opencode/commands/post-release.en.md +2 -0
- package/templates/.opencode/commands/post-release.zh-CN.md +2 -0
- package/templates/.opencode/commands/review-pr.en.md +11 -0
- package/templates/.opencode/commands/review-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/watch-pr.en.md +1 -1
- package/templates/.opencode/commands/watch-pr.zh-CN.md +1 -1
- package/dist/lib/agent-clients/adapters/gemini-cli.js +0 -64
- package/lib/agent-clients/adapters/gemini-cli.ts +0 -65
- package/templates/.gemini/commands/_project_/analyze-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/archive-tasks.en.toml +0 -10
- package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/block-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/cancel-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/check-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/close-codescan.en.toml +0 -8
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/close-dependabot.en.toml +0 -8
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/code-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/commit.en.toml +0 -10
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-manual-validation.en.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-manual-validation.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/create-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/create-release-note.en.toml +0 -8
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/create-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-codescan.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-dependabot.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-issue.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/init-labels.en.toml +0 -8
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/init-milestones.en.toml +0 -10
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/plan-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/post-release.en.toml +0 -6
- package/templates/.gemini/commands/_project_/post-release.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/refine-title.en.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/release.en.toml +0 -8
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/restore-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/review-analysis.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/review-code.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/review-plan.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/run-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/run-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/test-integration.en.toml +0 -6
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/test.en.toml +0 -6
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/update-agent-infra.en.toml +0 -6
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/upgrade-dependency.en.toml +0 -8
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/watch-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/watch-pr.zh-CN.toml +0 -10
- package/templates/.gemini/settings.json +0 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { applyPrReviewActivityIntent, inspectPrReviewActivity } from '../task/activity-intent.js';
|
|
2
|
+
const USAGE = `Usage: agent-infra-internal task-activity <task-ref> pr-review-inspect
|
|
3
|
+
agent-infra-internal task-activity <task-ref> pr-review-start --agent <agent> --artifact <canonical.md> --head <40hex> [--dry-run]
|
|
4
|
+
agent-infra-internal task-activity <task-ref> pr-review-complete --agent <agent> --artifact <canonical.md> --head <40hex> --verdict <approved|changes-requested|commented> --blockers <N> --major <N> --minor <N> [--dry-run]
|
|
5
|
+
agent-infra-internal task-activity <task-ref> pr-review-terminate --agent <agent> --artifact <canonical.md> --head <40hex> --outcome <aborted|superseded> --reason <single-line> [--dry-run]
|
|
6
|
+
`;
|
|
7
|
+
const OPERATIONS = new Set(['pr-review-inspect', 'pr-review-start', 'pr-review-complete', 'pr-review-terminate']);
|
|
8
|
+
const FLAGS = {
|
|
9
|
+
'--agent': 'agent',
|
|
10
|
+
'--artifact': 'artifact',
|
|
11
|
+
'--head': 'head',
|
|
12
|
+
'--verdict': 'verdict',
|
|
13
|
+
'--blockers': 'blockers',
|
|
14
|
+
'--major': 'major',
|
|
15
|
+
'--minor': 'minor',
|
|
16
|
+
'--outcome': 'outcome',
|
|
17
|
+
'--reason': 'reason'
|
|
18
|
+
};
|
|
19
|
+
const COMMON = ['agent', 'artifact', 'head'];
|
|
20
|
+
const ALLOWED = {
|
|
21
|
+
'pr-review-inspect': new Set(['kind', 'taskRef']),
|
|
22
|
+
'pr-review-start': new Set(['kind', 'taskRef', 'agent', 'artifact', 'head', 'dryRun']),
|
|
23
|
+
'pr-review-complete': new Set(['kind', 'taskRef', 'agent', 'artifact', 'head', 'verdict', 'blockers', 'major', 'minor', 'dryRun']),
|
|
24
|
+
'pr-review-terminate': new Set(['kind', 'taskRef', 'agent', 'artifact', 'head', 'outcome', 'reason', 'dryRun'])
|
|
25
|
+
};
|
|
26
|
+
function usageFailure(message) {
|
|
27
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'ACTIVITY_PAYLOAD_INVALID', message } })}\n`);
|
|
28
|
+
process.stderr.write(USAGE);
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
}
|
|
31
|
+
function taskActivity(args = []) {
|
|
32
|
+
if (args[0] === '--help' || args[0] === '-h') {
|
|
33
|
+
process.stdout.write(USAGE);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const [taskRef, kind] = args;
|
|
37
|
+
if (!taskRef || taskRef.startsWith('--') || !kind || !OPERATIONS.has(kind)) {
|
|
38
|
+
usageFailure('task ref and a supported PR review intent are required');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const values = { kind, taskRef };
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
for (let index = 2; index < args.length; index += 1) {
|
|
44
|
+
const flag = args[index];
|
|
45
|
+
if (flag === '--dry-run') {
|
|
46
|
+
if (seen.has(flag)) {
|
|
47
|
+
usageFailure(`duplicate option '${flag}'`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
seen.add(flag);
|
|
51
|
+
values.dryRun = true;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const key = FLAGS[flag];
|
|
55
|
+
if (!key) {
|
|
56
|
+
usageFailure(`unknown option '${flag}'`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (seen.has(flag)) {
|
|
60
|
+
usageFailure(`duplicate option '${flag}'`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const value = args[++index];
|
|
64
|
+
if (value === undefined || value.startsWith('--')) {
|
|
65
|
+
usageFailure(`option '${flag}' requires a value`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
seen.add(flag);
|
|
69
|
+
values[key] = ['blockers', 'major', 'minor'].includes(key) ? Number(value) : value;
|
|
70
|
+
}
|
|
71
|
+
const allowed = ALLOWED[kind];
|
|
72
|
+
const unexpected = Object.keys(values).find((key) => !allowed.has(key));
|
|
73
|
+
if (unexpected) {
|
|
74
|
+
usageFailure(`${kind} does not accept '${unexpected}'`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (kind === 'pr-review-inspect') {
|
|
78
|
+
const result = inspectPrReviewActivity(values);
|
|
79
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
80
|
+
if (result.status === 'failed')
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
for (const key of COMMON) {
|
|
85
|
+
if (values[key] === undefined) {
|
|
86
|
+
usageFailure(`${kind} requires '${key}'`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const operationRequired = kind === 'pr-review-complete'
|
|
91
|
+
? ['verdict', 'blockers', 'major', 'minor']
|
|
92
|
+
: kind === 'pr-review-terminate' ? ['outcome', 'reason'] : [];
|
|
93
|
+
for (const key of operationRequired) {
|
|
94
|
+
if (values[key] === undefined) {
|
|
95
|
+
usageFailure(`${kind} requires '${key}'`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const result = applyPrReviewActivityIntent(values);
|
|
100
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
101
|
+
if (result.status === 'failed')
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
}
|
|
104
|
+
export { taskActivity };
|
|
105
|
+
//# sourceMappingURL=task-activity.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
|
|
1
2
|
import { applyTaskEvent, eventCatalog } from '../task/events.js';
|
|
2
|
-
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--dry-run]
|
|
3
|
+
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--orchestrated] [--dry-run]
|
|
3
4
|
|
|
4
5
|
Apply one closed-set task lifecycle event and print a structured JSON result.
|
|
5
6
|
Events: ${eventCatalog.join(', ')}
|
|
@@ -30,6 +31,15 @@ function taskEvent(args = []) {
|
|
|
30
31
|
const seen = new Set();
|
|
31
32
|
for (let index = 2; index < args.length; index += 1) {
|
|
32
33
|
const flag = args[index];
|
|
34
|
+
if (flag === '--orchestrated') {
|
|
35
|
+
if (seen.has(flag)) {
|
|
36
|
+
usageFailure(`duplicate option '${flag}'`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
seen.add(flag);
|
|
40
|
+
request.orchestrated = true;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
33
43
|
if (flag === '--dry-run') {
|
|
34
44
|
if (seen.has(flag)) {
|
|
35
45
|
usageFailure(`duplicate option '${flag}'`);
|
|
@@ -61,6 +71,12 @@ function taskEvent(args = []) {
|
|
|
61
71
|
else
|
|
62
72
|
request[key] = value;
|
|
63
73
|
}
|
|
74
|
+
const agent = normalizeAgentToken(String(request.agent ?? ''));
|
|
75
|
+
if (!agent) {
|
|
76
|
+
usageFailure(`invalid --agent '${request.agent}': ${AGENT_USAGE_HINT}`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
request.agent = agent;
|
|
64
80
|
const result = applyTaskEvent(request);
|
|
65
81
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
66
82
|
if (result.status === 'failed')
|
|
@@ -6,9 +6,10 @@ const USAGE = `Usage: agent-infra-internal task-ledger <task-ref> <intent> [inte
|
|
|
6
6
|
const FLAGS = {
|
|
7
7
|
'--stage': 'stage', '--review-artifact': 'reviewArtifact', '--ordinal': 'ordinal',
|
|
8
8
|
'--severity': 'severity', '--evidence': 'evidence', '--id': 'id', '--round': 'round',
|
|
9
|
-
'--status': 'status', '--artifact': 'artifact'
|
|
9
|
+
'--status': 'status', '--artifact': 'artifact', '--needs-implementation': 'needsImplementation'
|
|
10
10
|
};
|
|
11
11
|
const NUMERIC = new Set(['ordinal', 'round']);
|
|
12
|
+
const BOOLEAN = new Set(['needsImplementation']);
|
|
12
13
|
function usageFailure(message) {
|
|
13
14
|
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'LEDGER_PAYLOAD_INVALID', message } })}\n`);
|
|
14
15
|
process.stderr.write(USAGE);
|
|
@@ -55,8 +56,12 @@ function taskLedger(args = []) {
|
|
|
55
56
|
usageFailure(`option '${flag}' requires a value`);
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
59
|
+
if (BOOLEAN.has(key) && value !== 'true' && value !== 'false') {
|
|
60
|
+
usageFailure(`option '${flag}' must be true or false`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
58
63
|
seen.add(flag);
|
|
59
|
-
values[key] = NUMERIC.has(key) ? Number(value) : value;
|
|
64
|
+
values[key] = NUMERIC.has(key) ? Number(value) : BOOLEAN.has(key) ? value === 'true' : value;
|
|
60
65
|
}
|
|
61
66
|
const required = {
|
|
62
67
|
'finding-upsert': ['stage', 'reviewArtifact', 'ordinal', 'severity', 'evidence'],
|
|
@@ -66,7 +71,11 @@ function taskLedger(args = []) {
|
|
|
66
71
|
'decision-upsert': ['id', 'stage', 'artifact'],
|
|
67
72
|
'stage-status': ['stage']
|
|
68
73
|
};
|
|
69
|
-
const
|
|
74
|
+
const optional = {
|
|
75
|
+
'finding-review': ['needsImplementation'],
|
|
76
|
+
'decision-upsert': ['needsImplementation']
|
|
77
|
+
};
|
|
78
|
+
const allowed = new Set(['kind', 'taskRef', 'dryRun', ...required[kind], ...(optional[kind] ?? [])]);
|
|
70
79
|
const unexpected = Object.keys(values).find((key) => !allowed.has(key));
|
|
71
80
|
const missing = required[kind].find((key) => values[key] === undefined);
|
|
72
81
|
if (unexpected) {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
|
|
1
2
|
import { applyTaskLifecycle, lifecycleIntentCatalog } from '../task/lifecycle.js';
|
|
3
|
+
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
4
|
+
import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
|
|
2
5
|
const USAGE = `Usage: agent-infra-internal task-lifecycle <N | TASK-id> <intent> --agent <agent> [intent flags] [--dry-run]\n\nIntents: ${lifecycleIntentCatalog.join(', ')}\n`;
|
|
3
6
|
const FLAGS = {
|
|
4
7
|
'--agent': 'agent', '--reason': 'reason', '--unblock-condition': 'unblockCondition',
|
|
@@ -49,7 +52,29 @@ function taskLifecycle(args = []) {
|
|
|
49
52
|
seen.add(flag);
|
|
50
53
|
values[key] = key === 'alertNumber' || key === 'issueNumber' ? Number(value) : value;
|
|
51
54
|
}
|
|
52
|
-
const
|
|
55
|
+
const agent = normalizeAgentToken(String(values.agent ?? ''));
|
|
56
|
+
if (!agent) {
|
|
57
|
+
usageFailure(`invalid --agent '${values.agent}': ${AGENT_USAGE_HINT}`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
values.agent = agent;
|
|
61
|
+
const resolved = resolveTaskRef(String(values.taskRef));
|
|
62
|
+
if (!resolved.ok) {
|
|
63
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: resolved.code, message: resolved.message } })}\n`);
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
let result;
|
|
68
|
+
try {
|
|
69
|
+
result = withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-lifecycle.${String(values.intent)}`, () => applyTaskLifecycle(values));
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (!(error instanceof TaskExecutionLockError))
|
|
73
|
+
throw error;
|
|
74
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: error.code, message: error.message } })}\n`);
|
|
75
|
+
process.exitCode = 1;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
53
78
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
54
79
|
if (result.status === 'failed')
|
|
55
80
|
process.exitCode = 1;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
|
|
2
|
+
import { abortCommitIntent, activateMatchingOrchestrationDelegation, activateOrchestrationDelegation, advanceOrchestration, beginCommitIntent, beginOrResumeOrchestration, checkpointCommitIntent, completeCommitIntent, pauseOrchestration, prepareOrchestrationDelegation, recoverCommitIntent, routeOrchestration, sealMatchingOrchestrationDelegation, sealOrchestrationDelegation, statusCommitIntent, statusOrchestration } from '../task/orchestration.js';
|
|
3
|
+
import { isAgentClientId } from '../agent-clients/types.js';
|
|
4
|
+
const USAGE = 'Usage: agent-infra-internal task-orchestration <task-ref|auto> <begin-or-resume|route|prepare|hook-start|hook-stop|advance|pause|status|commit-begin|commit-checkpoint|commit-complete|commit-recover|commit-abort|commit-status> [options]\n';
|
|
3
5
|
function usageFailure(message) {
|
|
4
6
|
process.stdout.write(`${JSON.stringify({
|
|
5
7
|
status: 'failed', changed: false,
|
|
@@ -18,18 +20,35 @@ function taskOrchestration(args = []) {
|
|
|
18
20
|
return;
|
|
19
21
|
}
|
|
20
22
|
const [taskRef, intent] = args;
|
|
21
|
-
if (![
|
|
23
|
+
if (![
|
|
24
|
+
'begin-or-resume', 'route', 'prepare', 'hook-start', 'hook-stop', 'advance', 'pause', 'status',
|
|
25
|
+
'commit-begin', 'commit-checkpoint', 'commit-complete', 'commit-recover', 'commit-abort', 'commit-status'
|
|
26
|
+
].includes(intent)) {
|
|
22
27
|
usageFailure(`unknown intent '${intent}'`);
|
|
23
28
|
return;
|
|
24
29
|
}
|
|
25
30
|
const values = {};
|
|
26
31
|
const seen = new Set();
|
|
32
|
+
let orchestrated = false;
|
|
27
33
|
for (let index = 2; index < args.length; index += 1) {
|
|
28
34
|
const flag = args[index];
|
|
35
|
+
if (flag === '--orchestrated') {
|
|
36
|
+
if (seen.has(flag)) {
|
|
37
|
+
usageFailure(`duplicate option '${flag}'`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
seen.add(flag);
|
|
41
|
+
orchestrated = true;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
29
44
|
if (![
|
|
30
|
-
'--max-steps', '--
|
|
31
|
-
'--
|
|
32
|
-
'--
|
|
45
|
+
'--max-steps', '--executor-model', '--executor-reasoning-effort',
|
|
46
|
+
'--reviewer-model', '--reviewer-reasoning-effort',
|
|
47
|
+
'--client', '--requested-model', '--requested-reasoning-effort', '--parent-id', '--before-fingerprint',
|
|
48
|
+
'--native-agent', '--child-id', '--spawn-mode', '--actual-model', '--actual-reasoning-effort',
|
|
49
|
+
'--model-fallback-reason', '--reasoning-effort-fallback-reason',
|
|
50
|
+
'--exit-code', '--after-fingerprint', '--changed-paths', '--code', '--message', '--recoverable', '--agent',
|
|
51
|
+
'--baseline-head', '--token', '--kind', '--head', '--remote', '--ref', '--expected-head'
|
|
33
52
|
].includes(flag)) {
|
|
34
53
|
usageFailure(`unknown option '${flag}'`);
|
|
35
54
|
return;
|
|
@@ -46,15 +65,149 @@ function taskOrchestration(args = []) {
|
|
|
46
65
|
}
|
|
47
66
|
values[flag] = value;
|
|
48
67
|
}
|
|
68
|
+
const commitIntentFlags = {
|
|
69
|
+
'commit-begin': ['--agent', '--baseline-head', '--orchestrated'],
|
|
70
|
+
'commit-checkpoint': ['--token', '--kind', '--head', '--remote', '--ref'],
|
|
71
|
+
'commit-complete': ['--token', '--agent'],
|
|
72
|
+
'commit-recover': ['--agent'],
|
|
73
|
+
'commit-abort': ['--token', '--expected-head'],
|
|
74
|
+
'commit-status': []
|
|
75
|
+
};
|
|
76
|
+
if (intent in commitIntentFlags) {
|
|
77
|
+
const allowed = commitIntentFlags[intent];
|
|
78
|
+
const invalid = [...seen].find((flag) => !allowed.includes(flag));
|
|
79
|
+
if (invalid) {
|
|
80
|
+
usageFailure(`intent '${intent}' does not accept '${invalid}'`);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const commitOnly = [...seen].find((flag) => [
|
|
86
|
+
'--orchestrated', '--baseline-head', '--token', '--kind', '--head', '--remote', '--ref', '--expected-head'
|
|
87
|
+
].includes(flag));
|
|
88
|
+
if (commitOnly) {
|
|
89
|
+
usageFailure(`intent '${intent}' does not accept '${commitOnly}'`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
49
93
|
const requireValues = (flags) => flags.find((flag) => values[flag] === undefined);
|
|
94
|
+
if (values['--client'] !== undefined && !isAgentClientId(values['--client'])) {
|
|
95
|
+
usageFailure(`unknown client '${values['--client']}'`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
50
98
|
let result;
|
|
51
|
-
if (intent === 'begin
|
|
99
|
+
if (intent === 'commit-begin') {
|
|
100
|
+
const missing = requireValues(['--agent', '--baseline-head']);
|
|
101
|
+
if (missing) {
|
|
102
|
+
usageFailure(`intent 'commit-begin' requires '${missing}'`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const agent = normalizeAgentToken(values['--agent']);
|
|
106
|
+
if (!agent) {
|
|
107
|
+
usageFailure(`invalid --agent '${values['--agent']}': ${AGENT_USAGE_HINT}`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
result = beginCommitIntent(taskRef, {
|
|
111
|
+
agent, orchestrated, baselineHead: values['--baseline-head']
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else if (intent === 'commit-checkpoint') {
|
|
115
|
+
const missing = requireValues(['--token', '--kind', '--head']);
|
|
116
|
+
if (missing) {
|
|
117
|
+
usageFailure(`intent 'commit-checkpoint' requires '${missing}'`);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!['committed', 'pushed'].includes(values['--kind'])) {
|
|
121
|
+
usageFailure('--kind must be committed or pushed');
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (values['--kind'] === 'pushed') {
|
|
125
|
+
const pushedMissing = requireValues(['--remote', '--ref']);
|
|
126
|
+
if (pushedMissing) {
|
|
127
|
+
usageFailure(`pushed checkpoint requires '${pushedMissing}'`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else if (values['--remote'] !== undefined || values['--ref'] !== undefined) {
|
|
132
|
+
usageFailure('committed checkpoint does not accept --remote or --ref');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
result = checkpointCommitIntent(taskRef, {
|
|
136
|
+
token: values['--token'], kind: values['--kind'],
|
|
137
|
+
head: values['--head'], remote: values['--remote'], ref: values['--ref']
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
else if (intent === 'commit-complete') {
|
|
141
|
+
const missing = requireValues(['--token', '--agent']);
|
|
142
|
+
if (missing) {
|
|
143
|
+
usageFailure(`intent 'commit-complete' requires '${missing}'`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const agent = normalizeAgentToken(values['--agent']);
|
|
147
|
+
if (!agent) {
|
|
148
|
+
usageFailure(`invalid --agent '${values['--agent']}': ${AGENT_USAGE_HINT}`);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
result = completeCommitIntent(taskRef, { token: values['--token'], agent });
|
|
152
|
+
}
|
|
153
|
+
else if (intent === 'commit-recover') {
|
|
154
|
+
const missing = requireValues(['--agent']);
|
|
155
|
+
if (missing) {
|
|
156
|
+
usageFailure(`intent 'commit-recover' requires '${missing}'`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const agent = normalizeAgentToken(values['--agent']);
|
|
160
|
+
if (!agent) {
|
|
161
|
+
usageFailure(`invalid --agent '${values['--agent']}': ${AGENT_USAGE_HINT}`);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
result = recoverCommitIntent(taskRef, { agent });
|
|
165
|
+
}
|
|
166
|
+
else if (intent === 'commit-abort') {
|
|
167
|
+
const missing = requireValues(['--token', '--expected-head']);
|
|
168
|
+
if (missing) {
|
|
169
|
+
usageFailure(`intent 'commit-abort' requires '${missing}'`);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
result = abortCommitIntent(taskRef, { token: values['--token'], expectedHead: values['--expected-head'] });
|
|
173
|
+
}
|
|
174
|
+
else if (intent === 'commit-status') {
|
|
175
|
+
result = statusCommitIntent(taskRef);
|
|
176
|
+
}
|
|
177
|
+
else if (intent === 'begin-or-resume') {
|
|
178
|
+
const missing = requireValues(['--client']);
|
|
179
|
+
if (missing) {
|
|
180
|
+
usageFailure(`intent 'begin-or-resume' requires '${missing}'`);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
52
183
|
const maxSteps = values['--max-steps'] === undefined ? undefined : Number(values['--max-steps']);
|
|
53
184
|
if (maxSteps !== undefined && (!Number.isInteger(maxSteps) || maxSteps < 1)) {
|
|
54
185
|
usageFailure('--max-steps must be a positive integer');
|
|
55
186
|
return;
|
|
56
187
|
}
|
|
57
|
-
|
|
188
|
+
const policyFlags = [
|
|
189
|
+
'--executor-model', '--executor-reasoning-effort',
|
|
190
|
+
'--reviewer-model', '--reviewer-reasoning-effort'
|
|
191
|
+
];
|
|
192
|
+
const hasAnyPolicy = policyFlags.some((flag) => values[flag] !== undefined);
|
|
193
|
+
if (hasAnyPolicy && policyFlags.some((flag) => values[flag] === undefined)) {
|
|
194
|
+
usageFailure('explicit model policy requires executor/reviewer model and reasoning effort');
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
result = beginOrResumeOrchestration(taskRef, {
|
|
198
|
+
maxSteps,
|
|
199
|
+
client: values['--client'],
|
|
200
|
+
modelPolicy: hasAnyPolicy ? {
|
|
201
|
+
executor: {
|
|
202
|
+
model: values['--executor-model'],
|
|
203
|
+
reasoningEffort: values['--executor-reasoning-effort']
|
|
204
|
+
},
|
|
205
|
+
reviewer: {
|
|
206
|
+
model: values['--reviewer-model'],
|
|
207
|
+
reasoningEffort: values['--reviewer-reasoning-effort']
|
|
208
|
+
}
|
|
209
|
+
} : undefined
|
|
210
|
+
});
|
|
58
211
|
}
|
|
59
212
|
else if (intent === 'route') {
|
|
60
213
|
result = routeOrchestration(taskRef);
|
|
@@ -70,7 +223,8 @@ function taskOrchestration(args = []) {
|
|
|
70
223
|
}
|
|
71
224
|
result = prepareOrchestrationDelegation(taskRef, {
|
|
72
225
|
client: values['--client'],
|
|
73
|
-
requestedModel: values['--requested-model']
|
|
226
|
+
requestedModel: values['--requested-model'],
|
|
227
|
+
requestedReasoningEffort: values['--requested-reasoning-effort']
|
|
74
228
|
});
|
|
75
229
|
}
|
|
76
230
|
else if (intent === 'hook-start') {
|
|
@@ -85,7 +239,10 @@ function taskOrchestration(args = []) {
|
|
|
85
239
|
const event = {
|
|
86
240
|
nativeAgent: values['--native-agent'], childId: values['--child-id'],
|
|
87
241
|
parentId: values['--parent-id'], spawnMode: values['--spawn-mode'],
|
|
88
|
-
actualModel: values['--actual-model'],
|
|
242
|
+
actualModel: values['--actual-model'],
|
|
243
|
+
actualReasoningEffort: values['--actual-reasoning-effort'],
|
|
244
|
+
modelFallbackReason: values['--model-fallback-reason'],
|
|
245
|
+
reasoningEffortFallbackReason: values['--reasoning-effort-fallback-reason']
|
|
89
246
|
};
|
|
90
247
|
result = taskRef === 'auto'
|
|
91
248
|
? activateMatchingOrchestrationDelegation(values['--client'], event)
|
|
@@ -120,14 +277,6 @@ function taskOrchestration(args = []) {
|
|
|
120
277
|
});
|
|
121
278
|
}
|
|
122
279
|
}
|
|
123
|
-
else if (intent === 'stage-completed') {
|
|
124
|
-
const missing = requireValues(['--agent']);
|
|
125
|
-
if (missing) {
|
|
126
|
-
usageFailure(`intent 'stage-completed' requires '${missing}'`);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
result = completeCommitOrchestrationStage(taskRef, values['--agent']);
|
|
130
|
-
}
|
|
131
280
|
else if (intent === 'advance') {
|
|
132
281
|
result = advanceOrchestration(taskRef);
|
|
133
282
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { finalizeReviewSummary } from '../task/review-finalization.js';
|
|
2
|
-
const USAGE = 'Usage: agent-infra-internal task-review <task-ref> finalize-summary --stage <analysis|plan|code> --artifact <review-*.md> [--dry-run]\n';
|
|
2
|
+
const USAGE = 'Usage: agent-infra-internal task-review <task-ref> finalize-summary --stage <analysis|plan|code> --artifact <review-*.md> [--orchestrated] [--dry-run]\n';
|
|
3
3
|
function failUsage(message) {
|
|
4
4
|
process.stdout.write(`${JSON.stringify({
|
|
5
5
|
status: 'failed',
|
|
@@ -26,10 +26,11 @@ function taskReview(args = []) {
|
|
|
26
26
|
let stage = '';
|
|
27
27
|
let artifact = '';
|
|
28
28
|
let dryRun = false;
|
|
29
|
+
let orchestrated = false;
|
|
29
30
|
const seen = new Set();
|
|
30
31
|
for (let index = 2; index < args.length; index += 1) {
|
|
31
32
|
const flag = args[index];
|
|
32
|
-
if (!['--stage', '--artifact', '--dry-run'].includes(flag)) {
|
|
33
|
+
if (!['--stage', '--artifact', '--orchestrated', '--dry-run'].includes(flag)) {
|
|
33
34
|
failUsage(`unknown option '${flag}'`);
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
@@ -42,6 +43,10 @@ function taskReview(args = []) {
|
|
|
42
43
|
dryRun = true;
|
|
43
44
|
continue;
|
|
44
45
|
}
|
|
46
|
+
if (flag === '--orchestrated') {
|
|
47
|
+
orchestrated = true;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
45
50
|
const value = args[++index];
|
|
46
51
|
if (!value || value.startsWith('--')) {
|
|
47
52
|
failUsage(`option '${flag}' requires a value`);
|
|
@@ -56,7 +61,7 @@ function taskReview(args = []) {
|
|
|
56
61
|
failUsage("options '--stage' and '--artifact' are required");
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
|
-
const result = finalizeReviewSummary({ taskRef: args[0], stage, artifact, dryRun });
|
|
64
|
+
const result = finalizeReviewSummary({ taskRef: args[0], stage, artifact, orchestrated, dryRun });
|
|
60
65
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
61
66
|
if (result.status === 'failed')
|
|
62
67
|
process.exitCode = 1;
|
|
@@ -17,10 +17,17 @@ function hasPlatformCapability(type, capability) {
|
|
|
17
17
|
const adapter = getPlatformAdapter(type);
|
|
18
18
|
if (capability === 'change-request')
|
|
19
19
|
return typeof adapter?.inspectChangeRequest === 'function';
|
|
20
|
+
if (capability === 'issue-closing-change-requests')
|
|
21
|
+
return typeof adapter?.inspectIssueClosingChangeRequests === 'function';
|
|
20
22
|
if (capability === 'required-checks')
|
|
21
23
|
return typeof adapter?.inspectRequiredChecks === 'function';
|
|
22
24
|
return typeof adapter?.resolveChangeRequestGitEvidence === 'function';
|
|
23
25
|
}
|
|
26
|
+
function inspectPlatformIssueClosingChangeRequests(type, context) {
|
|
27
|
+
const adapter = getPlatformAdapter(type);
|
|
28
|
+
return adapter?.inspectIssueClosingChangeRequests?.(context) ??
|
|
29
|
+
unsupported(type, 'issue closing change-request inspection');
|
|
30
|
+
}
|
|
24
31
|
function unsupported(type, capability) {
|
|
25
32
|
return {
|
|
26
33
|
ok: false,
|
|
@@ -47,5 +54,5 @@ function resolvePlatformChangeRequestGitEvidence(type, context) {
|
|
|
47
54
|
function listPlatformAdapters() {
|
|
48
55
|
return [...adapters.keys()].sort();
|
|
49
56
|
}
|
|
50
|
-
export { getPlatformAdapter, hasPlatformCapability, inspectPlatformChangeRequest, inspectPlatformRequiredChecks, listPlatformAdapters, registerPlatformAdapter, registerPlatformCapabilities, resolvePlatformChangeRequestGitEvidence };
|
|
57
|
+
export { getPlatformAdapter, hasPlatformCapability, inspectPlatformChangeRequest, inspectPlatformIssueClosingChangeRequests, inspectPlatformRequiredChecks, listPlatformAdapters, registerPlatformAdapter, registerPlatformCapabilities, resolvePlatformChangeRequestGitEvidence };
|
|
51
58
|
//# sourceMappingURL=adapters.js.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { COMPLETION_BACKFILL_FAMILIES, inspectCompletionArtifacts } from '../task/finalization-artifacts.js';
|
|
4
|
+
import { parseArtifactName } from '../task/artifact-lifecycle.js';
|
|
5
|
+
import { parseTaskFrontmatter } from '../task/frontmatter.js';
|
|
6
|
+
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
7
|
+
import { getOpenWorkflowWarnings } from '../task/workflow-warnings.js';
|
|
8
|
+
import { applyWorkflowWarningIntent } from '../task/workflow-warning-intents.js';
|
|
9
|
+
import { captureTaskWriteMetadata } from '../task/write.js';
|
|
10
|
+
import { syncPlatformComment } from './issue-comments.js';
|
|
11
|
+
import { platformResult } from './types.js';
|
|
12
|
+
function result(base, artifacts, warnings) {
|
|
13
|
+
return { ...base, artifacts, warnings };
|
|
14
|
+
}
|
|
15
|
+
function excludedPrReview(taskDir, message) {
|
|
16
|
+
const names = [...message.matchAll(/(?:^|[^A-Za-z0-9_-])(pr-review(?:-r[1-9]\d*)?\.md)(?=$|[^A-Za-z0-9_.-])/g)]
|
|
17
|
+
.map((match) => match[1]);
|
|
18
|
+
if (names.length !== 1)
|
|
19
|
+
return null;
|
|
20
|
+
const parsed = parseArtifactName(names[0]);
|
|
21
|
+
if (!parsed || parsed.family !== 'pr-review')
|
|
22
|
+
return null;
|
|
23
|
+
const artifactPath = path.join(taskDir, parsed.name);
|
|
24
|
+
try {
|
|
25
|
+
const stat = fs.lstatSync(artifactPath);
|
|
26
|
+
return stat.isFile() && !stat.isSymbolicLink() ? parsed.name : null;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function backfillCompletionComments(taskRef, options) {
|
|
33
|
+
const resolved = resolveTaskRef(taskRef, options.cwd ? { repoRoot: options.cwd } : {});
|
|
34
|
+
if (!resolved.ok)
|
|
35
|
+
return result(platformResult('failed', {
|
|
36
|
+
error: { code: resolved.code, message: resolved.message, retryable: false }
|
|
37
|
+
}), [], []);
|
|
38
|
+
const inventory = inspectCompletionArtifacts(resolved.taskId, { repoRoot: resolved.repoRoot });
|
|
39
|
+
if (inventory.status === 'failed')
|
|
40
|
+
return result(platformResult('failed', {
|
|
41
|
+
error: {
|
|
42
|
+
code: inventory.error?.code || 'ARTIFACT_TOPOLOGY_CONFLICT',
|
|
43
|
+
message: inventory.error?.message || 'Completion artifact inventory failed',
|
|
44
|
+
retryable: false
|
|
45
|
+
}
|
|
46
|
+
}), [], []);
|
|
47
|
+
const initialContent = fs.readFileSync(resolved.taskMdPath, 'utf8');
|
|
48
|
+
const issueNumber = Number(parseTaskFrontmatter(initialContent).issue_number);
|
|
49
|
+
if (!Number.isInteger(issueNumber) || issueNumber <= 0)
|
|
50
|
+
return result(platformResult('no-op', {
|
|
51
|
+
error: { code: 'ISSUE_NOT_LINKED', message: 'Task has no valid issue_number', retryable: false }
|
|
52
|
+
}), [], []);
|
|
53
|
+
const artifacts = [];
|
|
54
|
+
const operations = [];
|
|
55
|
+
let latest = platformResult('no-op', { error: null });
|
|
56
|
+
for (const artifact of inventory.artifacts) {
|
|
57
|
+
latest = syncPlatformComment(resolved.taskId, {
|
|
58
|
+
kind: 'artifact',
|
|
59
|
+
artifact: artifact.name,
|
|
60
|
+
agent: options.agent,
|
|
61
|
+
backfill: true,
|
|
62
|
+
cwd: resolved.repoRoot,
|
|
63
|
+
client: options.client
|
|
64
|
+
});
|
|
65
|
+
operations.push(...latest.operations.map((operation) => ({
|
|
66
|
+
...operation,
|
|
67
|
+
name: `${artifact.name}:${operation.name}`
|
|
68
|
+
})));
|
|
69
|
+
artifacts.push({ artifact: artifact.name, status: latest.status });
|
|
70
|
+
if (latest.status === 'failed' || latest.status === 'blocked')
|
|
71
|
+
return result({ ...latest, operations }, artifacts, []);
|
|
72
|
+
if (latest.error)
|
|
73
|
+
return result(platformResult(latest.error.retryable ? 'blocked' : 'failed', {
|
|
74
|
+
platform: latest.platform,
|
|
75
|
+
resource: latest.resource,
|
|
76
|
+
capabilities: latest.capabilities,
|
|
77
|
+
operations,
|
|
78
|
+
error: latest.error
|
|
79
|
+
}), artifacts, []);
|
|
80
|
+
}
|
|
81
|
+
const matching = getOpenWorkflowWarnings(initialContent).flatMap((warning) => {
|
|
82
|
+
if (warning.step !== 'complete-task' || warning.code !== 'COMMENT_SYNC_FAILED' || warning.target !== 'artifact')
|
|
83
|
+
return [];
|
|
84
|
+
const excluded = excludedPrReview(resolved.taskDir, warning.message);
|
|
85
|
+
return excluded ? [{ warning, excluded }] : [];
|
|
86
|
+
});
|
|
87
|
+
const warnings = [];
|
|
88
|
+
let metadata = null;
|
|
89
|
+
for (const { warning, excluded } of matching) {
|
|
90
|
+
metadata ??= captureTaskWriteMetadata();
|
|
91
|
+
const resolution = [
|
|
92
|
+
`excluded=${excluded}`,
|
|
93
|
+
`completionFamilies=${COMPLETION_BACKFILL_FAMILIES.join(',')}`,
|
|
94
|
+
`synchronized=${inventory.artifacts.map((artifact) => artifact.name).join(',') || 'none'}`,
|
|
95
|
+
`completedAt=${metadata.timestamp}`
|
|
96
|
+
].join('; ');
|
|
97
|
+
const updated = applyWorkflowWarningIntent({
|
|
98
|
+
kind: 'set-status', taskRef: resolved.taskId, id: warning.id, status: 'resolved', resolution
|
|
99
|
+
}, { repoRoot: resolved.repoRoot, metadataProvider: () => metadata });
|
|
100
|
+
if (updated.status === 'failed')
|
|
101
|
+
return result(platformResult('failed', {
|
|
102
|
+
platform: latest.platform,
|
|
103
|
+
resource: latest.resource,
|
|
104
|
+
capabilities: latest.capabilities,
|
|
105
|
+
operations,
|
|
106
|
+
changed: artifacts.some((item) => item.status === 'applied'),
|
|
107
|
+
error: { code: updated.error?.code || 'WARNING_UPDATE_FAILED', message: updated.error?.message || 'Unable to resolve workflow warning', retryable: false }
|
|
108
|
+
}), artifacts, warnings);
|
|
109
|
+
warnings.push({ id: warning.id, status: updated.status });
|
|
110
|
+
}
|
|
111
|
+
const changed = artifacts.some((item) => item.status === 'applied') || warnings.some((item) => item.status === 'applied');
|
|
112
|
+
return result(platformResult(changed ? 'applied' : 'no-op', {
|
|
113
|
+
platform: latest.platform,
|
|
114
|
+
resource: latest.resource,
|
|
115
|
+
capabilities: latest.capabilities,
|
|
116
|
+
changed,
|
|
117
|
+
operations,
|
|
118
|
+
error: null
|
|
119
|
+
}), artifacts, warnings);
|
|
120
|
+
}
|
|
121
|
+
export { backfillCompletionComments };
|
|
122
|
+
//# sourceMappingURL=completion-backfill.js.map
|