@fitlab-ai/agent-infra 0.9.12 → 0.9.14
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 +11 -11
- package/README.zh-CN.md +11 -11
- package/bin/cli.ts +26 -9
- package/dist/bin/cli.js +173 -157
- package/dist/bin/internal-cli.js +66 -40
- package/dist/lib/agent-client.js +5 -0
- package/dist/lib/agent-clients/next-steps.js +6 -1
- package/dist/lib/decide.js +3 -3
- package/dist/lib/internal/agent-client.js +5 -2
- package/dist/lib/internal/cli-route-inventory.js +152 -0
- package/dist/lib/internal/codex-lifecycle.js +9 -6
- package/dist/lib/internal/codex-sandbox-controller.js +8 -2
- package/dist/lib/internal/git-workflow.js +10 -6
- package/dist/lib/internal/platform-checks.js +19 -7
- package/dist/lib/internal/platform-comment.js +25 -13
- package/dist/lib/internal/platform-context.js +6 -3
- package/dist/lib/internal/platform-issue.js +20 -13
- package/dist/lib/internal/platform-metadata.js +88 -0
- package/dist/lib/internal/platform-pr-review.js +26 -13
- package/dist/lib/internal/platform-pr.js +84 -31
- package/dist/lib/internal/platform-release-notes.js +9 -6
- package/dist/lib/internal/platform-security.js +93 -0
- package/dist/lib/internal/pr-review-grade.js +25 -12
- package/dist/lib/internal/release-workflow.js +23 -9
- package/dist/lib/internal/sandbox-control.js +50 -7
- package/dist/lib/internal/task-activity.js +16 -7
- package/dist/lib/internal/task-artifact.js +235 -24
- package/dist/lib/internal/task-context.js +4 -1
- package/dist/lib/internal/task-create.js +50 -17
- package/dist/lib/internal/task-delivery.js +4 -1
- package/dist/lib/internal/task-event.js +10 -4
- package/dist/lib/internal/task-finalization.js +6 -3
- package/dist/lib/internal/task-invalidation.js +63 -0
- package/dist/lib/internal/task-ledger.js +20 -6
- package/dist/lib/internal/task-lifecycle.js +6 -3
- package/dist/lib/internal/task-operation-registry.js +421 -0
- package/dist/lib/internal/task-orchestration.js +12 -0
- package/dist/lib/internal/task-override.js +14 -7
- package/dist/lib/internal/task-qualification.js +90 -0
- package/dist/lib/internal/task-review.js +7 -4
- package/dist/lib/internal/task-short-id.js +11 -1
- package/dist/lib/internal/task-snapshot.js +4 -1
- package/dist/lib/internal/task-validate.js +7 -2
- package/dist/lib/internal/task-verify.js +11 -7
- package/dist/lib/internal/task-warning.js +11 -4
- package/dist/lib/platform/adapters.js +1 -3
- package/dist/lib/platform/change-request-git-evidence.js +27 -7
- package/dist/lib/platform/comment-safety.js +226 -0
- package/dist/lib/platform/completion-backfill.js +6 -5
- package/dist/lib/platform/context.js +70 -130
- package/dist/lib/platform/github-client.js +1 -1
- package/dist/lib/platform/github-provider.js +1130 -0
- package/dist/lib/platform/in-label-sync.js +143 -0
- package/dist/lib/platform/issue-comments.js +237 -72
- package/dist/lib/platform/issues.js +335 -189
- package/dist/lib/platform/metadata-labels.js +6 -2
- package/dist/lib/platform/none-provider.js +28 -0
- package/dist/lib/platform/pr-change-report.js +545 -0
- package/dist/lib/platform/pr-checks.js +119 -104
- package/dist/lib/platform/pr-review.js +88 -72
- package/dist/lib/platform/pr-summary.js +541 -50
- package/dist/lib/platform/provider-bridge.js +45 -0
- package/dist/lib/platform/provider-contract.d.ts +553 -0
- package/dist/lib/platform/provider-contract.js +99 -0
- package/dist/lib/platform/provider-loader.js +251 -0
- package/dist/lib/platform/provider-validation.js +577 -0
- package/dist/lib/platform/pull-request-metadata.js +8 -6
- package/dist/lib/platform/pull-requests.js +734 -543
- package/dist/lib/platform/release-notes.js +78 -55
- package/dist/lib/platform/releases.js +79 -50
- package/dist/lib/platform/repository-metadata.js +377 -0
- package/dist/lib/platform/resource-identity.d.ts +26 -0
- package/dist/lib/platform/resource-identity.js +92 -0
- package/dist/lib/platform/security-alerts.js +155 -0
- package/dist/lib/platform/task-identities.js +31 -0
- package/dist/lib/platform/verification-required.js +11 -12
- package/dist/lib/platform/verification-sync.js +129 -248
- package/dist/lib/pr-review/evidence-grading.js +19 -6
- package/dist/lib/process-data/index.js +7 -0
- package/dist/lib/run/index.js +68 -23
- package/dist/lib/sandbox/commands/control-status.js +22 -0
- package/dist/lib/sandbox/commands/create.js +32 -6
- package/dist/lib/sandbox/commands/ls.js +5 -0
- package/dist/lib/sandbox/commands/rm.js +827 -120
- package/dist/lib/sandbox/commands/show.js +16 -0
- package/dist/lib/sandbox/control/client.js +174 -19
- package/dist/lib/sandbox/control/completed-reentry.js +85 -0
- package/dist/lib/sandbox/control/container-identity.js +28 -31
- package/dist/lib/sandbox/control/executor.js +151 -16
- package/dist/lib/sandbox/control/lifecycle.js +621 -127
- package/dist/lib/sandbox/control/native-file-lock.js +177 -0
- package/dist/lib/sandbox/control/protocol.js +77 -0
- package/dist/lib/sandbox/control/server.js +677 -34
- package/dist/lib/sandbox/control/state.js +209 -4
- package/dist/lib/sandbox/control/task-view.js +183 -0
- package/dist/lib/sandbox/engines/authority.js +289 -0
- package/dist/lib/sandbox/engines/docker-exact-discovery.js +97 -0
- package/dist/lib/sandbox/index.js +5 -0
- package/dist/lib/sandbox/recovery.js +21 -1
- package/dist/lib/sandbox/workspace-view.js +2 -1
- package/dist/lib/sandbox/worktree-safety.js +4 -1
- package/dist/lib/server/index.js +8 -0
- package/dist/lib/server/protocol.js +38 -1
- package/dist/lib/task/activity-log.js +8 -1
- package/dist/lib/task/artifact-lifecycle.js +75 -18
- package/dist/lib/task/artifact-operations.js +520 -0
- package/dist/lib/task/artifact-repair-intent.js +59 -0
- package/dist/lib/task/artifact-schema.js +135 -0
- package/dist/lib/task/capabilities.js +310 -0
- package/dist/lib/task/commands/status.js +32 -0
- package/dist/lib/task/commit-operation.js +12 -1
- package/dist/lib/task/control-authority.js +12 -5
- package/dist/lib/task/create-service.js +111 -12
- package/dist/lib/task/create.js +25 -0
- package/dist/lib/task/current-contract.js +5 -1
- package/dist/lib/task/decision-details.js +1 -1
- package/dist/lib/task/events.js +416 -17
- package/dist/lib/task/finalization.js +37 -13
- package/dist/lib/task/human-override.js +58 -36
- package/dist/lib/task/index.js +11 -3
- package/dist/lib/task/invalidation-command.js +86 -0
- package/dist/lib/task/invalidation.js +260 -0
- package/dist/lib/task/ledger-intents.js +37 -0
- package/dist/lib/task/local-artifact-finalization.js +299 -0
- package/dist/lib/task/orchestration.js +240 -144
- package/dist/lib/task/pr-delivery-fact.js +102 -101
- package/dist/lib/task/qualification-audit.js +490 -0
- package/dist/lib/task/qualification-confirmation.js +109 -0
- package/dist/lib/task/qualification-intents.js +148 -0
- package/dist/lib/task/review-artifacts.js +22 -23
- package/dist/lib/task/review-finalization.js +121 -4
- package/dist/lib/task/review-fingerprint.js +24 -2
- package/dist/lib/task/rework-intent.js +138 -0
- package/dist/lib/task/sections.js +6 -4
- package/dist/lib/task/skill-scope.js +23 -0
- package/dist/lib/task/task-execution-lock.js +27 -17
- package/dist/lib/task/verification-config.js +11 -0
- package/dist/lib/task/verification-engine.js +93 -16
- package/dist/lib/task/verification.js +3 -3
- package/dist/lib/task/workflow-warning-intents.js +1 -1
- package/dist/lib/task/write.js +11 -0
- package/dist/lib/version.js +11 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-client.ts +9 -0
- package/lib/agent-clients/next-steps.ts +6 -1
- package/lib/decide.ts +3 -3
- package/lib/init.ts +1 -1
- package/lib/internal/agent-client.ts +4 -2
- package/lib/internal/cli-route-inventory.ts +140 -0
- package/lib/internal/codex-lifecycle.ts +8 -6
- package/lib/internal/codex-sandbox-controller.ts +7 -2
- package/lib/internal/git-workflow.ts +9 -6
- package/lib/internal/platform-checks.ts +14 -6
- package/lib/internal/platform-comment.ts +20 -12
- package/lib/internal/platform-context.ts +5 -3
- package/lib/internal/platform-issue.ts +17 -11
- package/lib/internal/platform-metadata.ts +70 -0
- package/lib/internal/platform-pr-review.ts +23 -12
- package/lib/internal/platform-pr.ts +65 -27
- package/lib/internal/platform-release-notes.ts +8 -6
- package/lib/internal/platform-security.ts +83 -0
- package/lib/internal/pr-review-grade.ts +20 -11
- package/lib/internal/release-workflow.ts +21 -9
- package/lib/internal/sandbox-control.ts +44 -6
- package/lib/internal/task-activity.ts +15 -7
- package/lib/internal/task-artifact.ts +204 -22
- package/lib/internal/task-context.ts +3 -1
- package/lib/internal/task-create.ts +78 -17
- package/lib/internal/task-delivery.ts +3 -1
- package/lib/internal/task-event.ts +9 -4
- package/lib/internal/task-finalization.ts +6 -4
- package/lib/internal/task-invalidation.ts +41 -0
- package/lib/internal/task-ledger.ts +21 -8
- package/lib/internal/task-lifecycle.ts +5 -3
- package/lib/internal/task-operation-registry.ts +482 -0
- package/lib/internal/task-orchestration.ts +12 -0
- package/lib/internal/task-override.ts +15 -9
- package/lib/internal/task-qualification.ts +61 -0
- package/lib/internal/task-review.ts +6 -4
- package/lib/internal/task-short-id.ts +10 -1
- package/lib/internal/task-snapshot.ts +3 -1
- package/lib/internal/task-validate.ts +6 -2
- package/lib/internal/task-verify.ts +10 -7
- package/lib/internal/task-warning.ts +10 -4
- package/lib/platform/adapters.ts +3 -2
- package/lib/platform/change-request-git-evidence.ts +36 -9
- package/lib/platform/comment-safety.ts +250 -0
- package/lib/platform/completion-backfill.ts +9 -8
- package/lib/platform/context.ts +97 -134
- package/lib/platform/github-client.ts +2 -2
- package/lib/platform/github-provider.ts +1132 -0
- package/lib/platform/in-label-sync.ts +208 -0
- package/lib/platform/issue-comments.ts +255 -80
- package/lib/platform/issues.ts +344 -174
- package/lib/platform/metadata-labels.ts +5 -2
- package/lib/platform/none-provider.ts +35 -0
- package/lib/platform/pr-change-report.ts +639 -0
- package/lib/platform/pr-checks.ts +126 -106
- package/lib/platform/pr-review.ts +88 -85
- package/lib/platform/pr-summary.ts +581 -53
- package/lib/platform/provider-bridge.ts +82 -0
- package/lib/platform/provider-contract.ts +611 -0
- package/lib/platform/provider-loader.ts +307 -0
- package/lib/platform/provider-validation.ts +611 -0
- package/lib/platform/pull-request-metadata.ts +10 -7
- package/lib/platform/pull-requests.ts +781 -550
- package/lib/platform/release-notes.ts +76 -59
- package/lib/platform/releases.ts +77 -43
- package/lib/platform/repository-metadata.ts +453 -0
- package/lib/platform/resource-identity.ts +121 -0
- package/lib/platform/security-alerts.ts +191 -0
- package/lib/platform/task-identities.ts +40 -0
- package/lib/platform/types.ts +4 -2
- package/lib/platform/verification-required.ts +11 -13
- package/lib/platform/verification-sync.ts +128 -304
- package/lib/pr-review/evidence-grading.ts +25 -8
- package/lib/process-data/index.ts +7 -0
- package/lib/run/index.ts +62 -22
- package/lib/sandbox/commands/control-status.ts +26 -0
- package/lib/sandbox/commands/create.ts +46 -6
- package/lib/sandbox/commands/ls.ts +7 -0
- package/lib/sandbox/commands/rm.ts +1000 -87
- package/lib/sandbox/commands/show.ts +16 -0
- package/lib/sandbox/control/client.ts +203 -19
- package/lib/sandbox/control/completed-reentry.ts +98 -0
- package/lib/sandbox/control/container-identity.ts +27 -43
- package/lib/sandbox/control/executor.ts +180 -15
- package/lib/sandbox/control/lifecycle.ts +629 -17
- package/lib/sandbox/control/native-file-lock.ts +209 -0
- package/lib/sandbox/control/protocol.ts +118 -2
- package/lib/sandbox/control/server.ts +724 -34
- package/lib/sandbox/control/state.ts +257 -4
- package/lib/sandbox/control/task-view.ts +240 -0
- package/lib/sandbox/engines/authority.ts +365 -0
- package/lib/sandbox/engines/docker-exact-discovery.ts +132 -0
- package/lib/sandbox/index.ts +7 -0
- package/lib/sandbox/recovery.ts +21 -1
- package/lib/sandbox/workspace-view.ts +9 -3
- package/lib/sandbox/worktree-safety.ts +4 -1
- package/lib/server/index.ts +10 -0
- package/lib/server/protocol.ts +36 -1
- package/lib/task/activity-log.ts +8 -0
- package/lib/task/artifact-lifecycle.ts +70 -22
- package/lib/task/artifact-operations.ts +626 -0
- package/lib/task/artifact-repair-intent.ts +71 -0
- package/lib/task/artifact-schema.ts +192 -0
- package/lib/task/capabilities.ts +331 -0
- package/lib/task/commands/status.ts +38 -0
- package/lib/task/commit-operation.ts +12 -1
- package/lib/task/control-authority.ts +22 -9
- package/lib/task/create-service.ts +139 -14
- package/lib/task/create.ts +27 -0
- package/lib/task/current-contract.ts +6 -1
- package/lib/task/decision-details.ts +6 -2
- package/lib/task/events.ts +392 -16
- package/lib/task/finalization.ts +50 -14
- package/lib/task/human-override.ts +70 -46
- package/lib/task/index.ts +16 -3
- package/lib/task/invalidation-command.ts +86 -0
- package/lib/task/invalidation.ts +332 -0
- package/lib/task/ledger-intents.ts +35 -1
- package/lib/task/local-artifact-finalization.ts +432 -0
- package/lib/task/orchestration.ts +223 -133
- package/lib/task/pr-delivery-fact.ts +131 -148
- package/lib/task/qualification-audit.ts +599 -0
- package/lib/task/qualification-confirmation.ts +117 -0
- package/lib/task/qualification-intents.ts +150 -0
- package/lib/task/review-artifacts.ts +21 -22
- package/lib/task/review-finalization.ts +133 -4
- package/lib/task/review-fingerprint.ts +23 -2
- package/lib/task/rework-intent.ts +165 -0
- package/lib/task/sections.ts +6 -4
- package/lib/task/skill-scope.ts +24 -0
- package/lib/task/task-execution-lock.ts +23 -14
- package/lib/task/verification-config.ts +12 -0
- package/lib/task/verification-engine.ts +103 -17
- package/lib/task/verification.ts +4 -4
- package/lib/task/workflow-warning-intents.ts +1 -1
- package/lib/task/write.ts +19 -0
- package/lib/update.ts +1 -1
- package/lib/version.ts +15 -1
- package/package.json +12 -1
- package/templates/.agents/rules/README.en.md +3 -1
- package/templates/.agents/rules/README.zh-CN.md +3 -1
- package/templates/.agents/rules/decision-qualification.en.md +22 -0
- package/templates/.agents/rules/decision-qualification.zh-CN.md +22 -0
- package/templates/.agents/rules/evidence-reporting.en.md +28 -0
- package/templates/.agents/rules/evidence-reporting.zh-CN.md +28 -0
- package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +2 -0
- package/templates/.agents/rules/issue-sync.zh-CN.md +2 -0
- package/templates/.agents/rules/label-milestone-setup.en.md +7 -7
- package/templates/.agents/rules/label-milestone-setup.zh-CN.md +7 -7
- package/templates/.agents/rules/local-artifact-repair.en.md +13 -2
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +13 -2
- package/templates/.agents/rules/pr-sync.en.md +10 -4
- package/templates/.agents/rules/pr-sync.zh-CN.md +17 -4
- package/templates/.agents/rules/security-alerts.en.md +8 -8
- package/templates/.agents/rules/security-alerts.zh-CN.md +8 -8
- package/templates/.agents/rules/task-short-id.en.md +1 -4
- package/templates/.agents/rules/task-short-id.zh-CN.md +1 -3
- package/templates/.agents/skills/analyze-task/SKILL.en.md +28 -5
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +29 -5
- package/templates/.agents/skills/analyze-task/config/verify.en.json +1 -12
- package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -12
- package/templates/.agents/skills/check-task/SKILL.en.md +16 -37
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -37
- package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +2 -2
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/code-task/SKILL.en.md +41 -9
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +43 -11
- package/templates/.agents/skills/code-task/config/verify.en.json +6 -14
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +6 -14
- package/templates/.agents/skills/code-task/reference/code-rules.en.md +5 -4
- package/templates/.agents/skills/code-task/reference/code-rules.zh-CN.md +5 -4
- package/templates/.agents/skills/code-task/reference/dual-mode.en.md +1 -1
- package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/reference/fix-mode.en.md +3 -1
- package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +3 -1
- package/templates/.agents/skills/code-task/reference/report-template.en.md +42 -15
- package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +39 -12
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +2 -0
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +2 -0
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +3 -3
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +3 -3
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +10 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +10 -4
- package/templates/.agents/skills/complete-manual-validation/reference/report-template.en.md +2 -0
- package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md +2 -0
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +4 -3
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +4 -3
- package/templates/.agents/skills/complete-task/SKILL.en.md +26 -21
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +25 -21
- package/templates/.agents/skills/create-pr/SKILL.en.md +7 -6
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +7 -7
- package/templates/.agents/skills/create-pr/config/verify.json +1 -0
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +16 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +16 -4
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +5 -3
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +5 -3
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +3 -0
- package/templates/.agents/skills/create-task/SKILL.en.md +8 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +7 -0
- package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/init-labels/SKILL.en.md +8 -8
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +8 -8
- package/templates/.agents/skills/init-milestones/SKILL.en.md +9 -11
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +9 -11
- package/templates/.agents/skills/plan-task/SKILL.en.md +27 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +26 -4
- package/templates/.agents/skills/plan-task/config/verify.en.json +4 -14
- package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +4 -14
- package/templates/.agents/skills/review-analysis/SKILL.en.md +17 -4
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +17 -4
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -18
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -18
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +50 -23
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +45 -18
- package/templates/.agents/skills/review-code/SKILL.en.md +18 -5
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +18 -5
- package/templates/.agents/skills/review-code/config/verify.en.json +1 -23
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -23
- package/templates/.agents/skills/review-code/reference/report-template.en.md +49 -22
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +45 -18
- package/templates/.agents/skills/review-plan/SKILL.en.md +17 -4
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +17 -4
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -18
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -18
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +49 -22
- package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +45 -18
- package/templates/.agents/skills/review-pr/SKILL.en.md +5 -1
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +5 -1
- package/templates/.agents/skills/review-pr/reference/report-template.en.md +4 -3
- package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +4 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +9 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +9 -3
- package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +3 -1
- package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +3 -1
- package/templates/.agents/skills/test/SKILL.en.md +13 -2
- package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +14 -0
- package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +6 -0
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +6 -0
- package/templates/.agents/templates/task.en.md +24 -1
- package/templates/.agents/templates/task.zh-CN.md +24 -1
- package/templates/.github/workflows/pr-label.yml +7 -26
- package/templates/.agents/scripts/security-alerts.github.sh +0 -151
- package/templates/.agents/scripts/security-alerts.sh +0 -31
- package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +0 -146
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +0 -32
- package/templates/.agents/skills/init-milestones/scripts/init-milestones.github.sh +0 -294
- package/templates/.agents/skills/init-milestones/scripts/init-milestones.sh +0 -6
package/dist/bin/internal-cli.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { classifySandboxControlEnvironment } from '../lib/sandbox/control/client.js';
|
|
3
|
+
import { formatTaskViewDiagnostic, guardTaskOperation, TaskViewOperationError } from '../lib/internal/task-operation-registry.js';
|
|
4
|
+
import { INTERNAL_HANDLER_ROUTE_SELECTORS } from '../lib/internal/cli-route-inventory.js';
|
|
2
5
|
const [major = 0, minor = 0] = process.versions.node.split('.').map((part) => parseInt(part, 10));
|
|
3
6
|
if (major < 22 || (major === 22 && minor < 9)) {
|
|
4
7
|
process.stderr.write(`agent-infra-internal requires Node.js >= 22.9.0 (current: ${process.version})\n`);
|
|
5
8
|
process.exit(1);
|
|
6
9
|
}
|
|
7
10
|
const command = process.argv[2] || '';
|
|
11
|
+
const internalRouteRegistered = Object.hasOwn(INTERNAL_HANDLER_ROUTE_SELECTORS, command);
|
|
8
12
|
const taskControlCommand = command === 'task-lifecycle' || command === 'task-orchestration' || command === 'task-finalization';
|
|
13
|
+
let taskViewGuardFailed = false;
|
|
14
|
+
try {
|
|
15
|
+
const guard = guardTaskOperation('internal', command, process.argv.slice(3));
|
|
16
|
+
if (guard.taskView && guard.descriptor.effect === 'diagnostic') {
|
|
17
|
+
process.stderr.write(formatTaskViewDiagnostic(guard.taskView));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
taskViewGuardFailed = true;
|
|
22
|
+
if (error instanceof TaskViewOperationError) {
|
|
23
|
+
process.stderr.write(`${error.message}\n`);
|
|
24
|
+
process.exitCode = error.exitCode;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
9
30
|
function taskControlTransportFailure(message) {
|
|
10
31
|
process.stdout.write(`${JSON.stringify({
|
|
11
32
|
status: 'failed', changed: false,
|
|
@@ -13,26 +34,12 @@ function taskControlTransportFailure(message) {
|
|
|
13
34
|
})}\n`);
|
|
14
35
|
process.exit(1);
|
|
15
36
|
}
|
|
16
|
-
if (taskControlCommand) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'AGENT_INFRA_CONTROL_TOKEN', 'AGENT_INFRA_CONTROL_GENERATION',
|
|
21
|
-
'AGENT_INFRA_CONTROL_DIR', 'AGENT_INFRA_CONTROL_STATUS_DIR'
|
|
22
|
-
];
|
|
23
|
-
const hasControlMarker = controlKeys.some((key) => Boolean(env[key]))
|
|
24
|
-
|| Boolean(env.AGENT_INFRA_CONTROL_CONTROLLER_BINDING);
|
|
25
|
-
const taskBindingMarker = hasControlMarker && Boolean(env.AGENT_INFRA_TASK_ID);
|
|
26
|
-
const hasCompleteClientConfig = controlKeys.every((key) => Boolean(env[key]))
|
|
27
|
-
&& !env.AGENT_INFRA_CONTROL_CONTROLLER_BINDING
|
|
28
|
-
&& (!taskBindingMarker || Boolean(env.AGENT_INFRA_RUNTIME_DIR));
|
|
29
|
-
if (executorMarked) {
|
|
30
|
-
taskControlTransportFailure('executor context is only valid for sandbox-control execute');
|
|
37
|
+
if (!taskViewGuardFailed && taskControlCommand) {
|
|
38
|
+
const environment = classifySandboxControlEnvironment();
|
|
39
|
+
if (environment.kind === 'invalid') {
|
|
40
|
+
taskControlTransportFailure(environment.message ?? 'sandbox client control configuration is invalid');
|
|
31
41
|
}
|
|
32
|
-
if (
|
|
33
|
-
taskControlTransportFailure('sandbox client control configuration is incomplete or conflicting');
|
|
34
|
-
}
|
|
35
|
-
if (hasCompleteClientConfig) {
|
|
42
|
+
if (environment.kind === 'controlled') {
|
|
36
43
|
const { sandboxControl } = await import('../lib/internal/sandbox-control.js');
|
|
37
44
|
await sandboxControl(['client', command, ...process.argv.slice(3)]);
|
|
38
45
|
}
|
|
@@ -45,22 +52,22 @@ if (taskControlCommand) {
|
|
|
45
52
|
}
|
|
46
53
|
case 'task-lifecycle': {
|
|
47
54
|
const { taskLifecycle } = await import('../lib/internal/task-lifecycle.js');
|
|
48
|
-
taskLifecycle(process.argv.slice(3));
|
|
55
|
+
await taskLifecycle(process.argv.slice(3));
|
|
49
56
|
break;
|
|
50
57
|
}
|
|
51
58
|
case 'task-finalization': {
|
|
52
59
|
const { taskFinalization } = await import('../lib/internal/task-finalization.js');
|
|
53
|
-
taskFinalization(process.argv.slice(3));
|
|
60
|
+
await taskFinalization(process.argv.slice(3));
|
|
54
61
|
break;
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
|
-
else
|
|
66
|
+
else if (!taskViewGuardFailed && internalRouteRegistered)
|
|
60
67
|
switch (command) {
|
|
61
68
|
case 'task-create': {
|
|
62
69
|
const { taskCreate } = await import('../lib/internal/task-create.js');
|
|
63
|
-
taskCreate(process.argv.slice(3));
|
|
70
|
+
await taskCreate(process.argv.slice(3));
|
|
64
71
|
break;
|
|
65
72
|
}
|
|
66
73
|
case 'sandbox-control': {
|
|
@@ -100,37 +107,37 @@ else
|
|
|
100
107
|
}
|
|
101
108
|
case 'platform-release-notes': {
|
|
102
109
|
const { platformReleaseNotes } = await import('../lib/internal/platform-release-notes.js');
|
|
103
|
-
platformReleaseNotes(process.argv.slice(3));
|
|
110
|
+
await platformReleaseNotes(process.argv.slice(3));
|
|
104
111
|
break;
|
|
105
112
|
}
|
|
106
113
|
case 'platform-context': {
|
|
107
114
|
const { platformContext } = await import('../lib/internal/platform-context.js');
|
|
108
|
-
platformContext(process.argv.slice(3));
|
|
115
|
+
await platformContext(process.argv.slice(3));
|
|
109
116
|
break;
|
|
110
117
|
}
|
|
111
118
|
case 'platform-comment': {
|
|
112
119
|
const { platformComment } = await import('../lib/internal/platform-comment.js');
|
|
113
|
-
platformComment(process.argv.slice(3));
|
|
120
|
+
await platformComment(process.argv.slice(3));
|
|
114
121
|
break;
|
|
115
122
|
}
|
|
116
123
|
case 'platform-issue': {
|
|
117
124
|
const { platformIssue } = await import('../lib/internal/platform-issue.js');
|
|
118
|
-
platformIssue(process.argv.slice(3));
|
|
125
|
+
await platformIssue(process.argv.slice(3));
|
|
119
126
|
break;
|
|
120
127
|
}
|
|
121
128
|
case 'platform-pr': {
|
|
122
129
|
const { platformPr } = await import('../lib/internal/platform-pr.js');
|
|
123
|
-
platformPr(process.argv.slice(3));
|
|
130
|
+
await platformPr(process.argv.slice(3));
|
|
124
131
|
break;
|
|
125
132
|
}
|
|
126
133
|
case 'platform-pr-review': {
|
|
127
134
|
const { platformPrReview } = await import('../lib/internal/platform-pr-review.js');
|
|
128
|
-
platformPrReview(process.argv.slice(3));
|
|
135
|
+
await platformPrReview(process.argv.slice(3));
|
|
129
136
|
break;
|
|
130
137
|
}
|
|
131
138
|
case 'pr-review-grade': {
|
|
132
139
|
const { prReviewGrade } = await import('../lib/internal/pr-review-grade.js');
|
|
133
|
-
prReviewGrade(process.argv.slice(3));
|
|
140
|
+
await prReviewGrade(process.argv.slice(3));
|
|
134
141
|
break;
|
|
135
142
|
}
|
|
136
143
|
case 'platform-checks': {
|
|
@@ -138,6 +145,16 @@ else
|
|
|
138
145
|
await platformChecks(process.argv.slice(3));
|
|
139
146
|
break;
|
|
140
147
|
}
|
|
148
|
+
case 'platform-security': {
|
|
149
|
+
const { platformSecurity } = await import('../lib/internal/platform-security.js');
|
|
150
|
+
await platformSecurity(process.argv.slice(3));
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case 'platform-metadata': {
|
|
154
|
+
const { platformMetadata } = await import('../lib/internal/platform-metadata.js');
|
|
155
|
+
await platformMetadata(process.argv.slice(3));
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
141
158
|
case 'task-context': {
|
|
142
159
|
const { taskContext } = await import('../lib/internal/task-context.js');
|
|
143
160
|
taskContext(process.argv.slice(3));
|
|
@@ -145,17 +162,22 @@ else
|
|
|
145
162
|
}
|
|
146
163
|
case 'task-ledger': {
|
|
147
164
|
const { taskLedger } = await import('../lib/internal/task-ledger.js');
|
|
148
|
-
taskLedger(process.argv.slice(3));
|
|
165
|
+
await taskLedger(process.argv.slice(3));
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
case 'task-qualification': {
|
|
169
|
+
const { taskQualification } = await import('../lib/internal/task-qualification.js');
|
|
170
|
+
await taskQualification(process.argv.slice(3));
|
|
149
171
|
break;
|
|
150
172
|
}
|
|
151
173
|
case 'task-warning': {
|
|
152
174
|
const { taskWarning } = await import('../lib/internal/task-warning.js');
|
|
153
|
-
taskWarning(process.argv.slice(3));
|
|
175
|
+
await taskWarning(process.argv.slice(3));
|
|
154
176
|
break;
|
|
155
177
|
}
|
|
156
178
|
case 'task-activity': {
|
|
157
179
|
const { taskActivity } = await import('../lib/internal/task-activity.js');
|
|
158
|
-
taskActivity(process.argv.slice(3));
|
|
180
|
+
await taskActivity(process.argv.slice(3));
|
|
159
181
|
break;
|
|
160
182
|
}
|
|
161
183
|
case 'task-artifact': {
|
|
@@ -170,27 +192,32 @@ else
|
|
|
170
192
|
}
|
|
171
193
|
case 'task-review': {
|
|
172
194
|
const { taskReview } = await import('../lib/internal/task-review.js');
|
|
173
|
-
taskReview(process.argv.slice(3));
|
|
195
|
+
await taskReview(process.argv.slice(3));
|
|
174
196
|
break;
|
|
175
197
|
}
|
|
176
198
|
case 'task-event': {
|
|
177
199
|
const { taskEvent } = await import('../lib/internal/task-event.js');
|
|
178
|
-
taskEvent(process.argv.slice(3));
|
|
200
|
+
await taskEvent(process.argv.slice(3));
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case 'task-invalidation': {
|
|
204
|
+
const { taskInvalidation } = await import('../lib/internal/task-invalidation.js');
|
|
205
|
+
taskInvalidation(process.argv.slice(3));
|
|
179
206
|
break;
|
|
180
207
|
}
|
|
181
208
|
case 'task-lifecycle': {
|
|
182
209
|
const { taskLifecycle } = await import('../lib/internal/task-lifecycle.js');
|
|
183
|
-
taskLifecycle(process.argv.slice(3));
|
|
210
|
+
await taskLifecycle(process.argv.slice(3));
|
|
184
211
|
break;
|
|
185
212
|
}
|
|
186
213
|
case 'task-finalization': {
|
|
187
214
|
const { taskFinalization } = await import('../lib/internal/task-finalization.js');
|
|
188
|
-
taskFinalization(process.argv.slice(3));
|
|
215
|
+
await taskFinalization(process.argv.slice(3));
|
|
189
216
|
break;
|
|
190
217
|
}
|
|
191
218
|
case 'task-override': {
|
|
192
219
|
const { taskOverride } = await import('../lib/internal/task-override.js');
|
|
193
|
-
taskOverride(process.argv.slice(3));
|
|
220
|
+
await taskOverride(process.argv.slice(3));
|
|
194
221
|
break;
|
|
195
222
|
}
|
|
196
223
|
case 'task-short-id': {
|
|
@@ -205,7 +232,7 @@ else
|
|
|
205
232
|
}
|
|
206
233
|
case 'task-verify': {
|
|
207
234
|
const { taskVerify } = await import('../lib/internal/task-verify.js');
|
|
208
|
-
taskVerify(process.argv.slice(3));
|
|
235
|
+
await taskVerify(process.argv.slice(3));
|
|
209
236
|
break;
|
|
210
237
|
}
|
|
211
238
|
case 'task-validate': {
|
|
@@ -221,5 +248,4 @@ else
|
|
|
221
248
|
})}\n`);
|
|
222
249
|
process.exitCode = 1;
|
|
223
250
|
}
|
|
224
|
-
export {};
|
|
225
251
|
//# sourceMappingURL=internal-cli.js.map
|
package/dist/lib/agent-client.js
CHANGED
|
@@ -6,6 +6,8 @@ import { listAgentClientAdapters } from './agent-clients/registry.js';
|
|
|
6
6
|
import { AGENT_CLIENT_IDS, isAgentClientId } from './agent-clients/types.js';
|
|
7
7
|
import { closePrompt, multiSelect } from './prompt.js';
|
|
8
8
|
import { resolveTemplateDir } from './paths.js';
|
|
9
|
+
import { PUBLIC_CLI_ROUTE_SELECTORS } from './internal/cli-route-inventory.js';
|
|
10
|
+
const AGENT_CLIENT_OPERATIONS = PUBLIC_CLI_ROUTE_SELECTORS['agent-client'];
|
|
9
11
|
const USAGE = `Usage: ai agent-client <operation>
|
|
10
12
|
|
|
11
13
|
Operations:
|
|
@@ -79,6 +81,9 @@ async function cmdAgentClient(args) {
|
|
|
79
81
|
process.stdout.write(USAGE);
|
|
80
82
|
return 0;
|
|
81
83
|
}
|
|
84
|
+
if (!AGENT_CLIENT_OPERATIONS.includes(operation)) {
|
|
85
|
+
throw new AgentClientCommandError('AGENT_CLIENT_OPERATION_INVALID', `Unknown operation '${operation}'`);
|
|
86
|
+
}
|
|
82
87
|
if (operation === 'list') {
|
|
83
88
|
if (args.length !== 1) {
|
|
84
89
|
throw new AgentClientCommandError('AGENT_CLIENT_ARGUMENT_INVALID', 'list accepts no arguments');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { listEnabledAgentClientAdapters } from './registry.js';
|
|
2
2
|
import { renderAgentClientInvocation } from './invocation.js';
|
|
3
3
|
import semver from 'semver';
|
|
4
|
+
import { isTaskScopeSkill } from '../task/skill-scope.js';
|
|
4
5
|
const SAFE_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
5
6
|
const SAFE_TASK_REF = /^(?:\d+|TASK-\d{8}-\d{6})$/;
|
|
6
7
|
function requireSafeName(value, field) {
|
|
@@ -19,7 +20,11 @@ function renderNextStepCommands(input) {
|
|
|
19
20
|
throw new Error('Invalid version');
|
|
20
21
|
}
|
|
21
22
|
const args = [
|
|
22
|
-
...(input.taskRef === undefined
|
|
23
|
+
...(input.taskRef === undefined
|
|
24
|
+
? []
|
|
25
|
+
: isTaskScopeSkill(input.skillName)
|
|
26
|
+
? ['--task', input.taskRef]
|
|
27
|
+
: [input.taskRef]),
|
|
23
28
|
...(input.version === undefined ? [] : [input.version])
|
|
24
29
|
];
|
|
25
30
|
const builtins = listEnabledAgentClientAdapters(input.state).map((adapter) => Object.freeze({
|
package/dist/lib/decide.js
CHANGED
|
@@ -94,13 +94,13 @@ export async function decide(args, options = {}) {
|
|
|
94
94
|
metadataProvider: () => ({ timestamp: now, agentInfraVersion: options.version ?? VERSION })
|
|
95
95
|
};
|
|
96
96
|
let result;
|
|
97
|
-
const execute = () => {
|
|
97
|
+
const execute = async () => {
|
|
98
98
|
let current = applyHumanDecision(request, writeOptions);
|
|
99
99
|
if (current.status !== 'failed' || !parsedDecision.overrideTicket)
|
|
100
100
|
return current;
|
|
101
101
|
if (!parsedDecision.overrideTarget || !parsedDecision.overrideScope)
|
|
102
102
|
throw new Error('override ticket requires --override-target and --override-scope');
|
|
103
|
-
const consumed = consumeHumanOverride({
|
|
103
|
+
const consumed = await consumeHumanOverride({
|
|
104
104
|
taskRef: resolved.taskId,
|
|
105
105
|
ticketId: parsedDecision.overrideTicket,
|
|
106
106
|
failureId: failureId('decision-intent', current.error?.code ?? 'TASK_STATE_MISMATCH'),
|
|
@@ -120,7 +120,7 @@ export async function decide(args, options = {}) {
|
|
|
120
120
|
throw new Error(consumed.error.message);
|
|
121
121
|
return current;
|
|
122
122
|
};
|
|
123
|
-
result = withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
|
|
123
|
+
result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
|
|
124
124
|
if (result.error)
|
|
125
125
|
throw new Error(result.error.message);
|
|
126
126
|
return 0;
|
|
@@ -5,6 +5,7 @@ import { normalizeCustomTUIs } from '../agent-clients/custom-tuis.js';
|
|
|
5
5
|
import { renderNextStepCommands } from '../agent-clients/next-steps.js';
|
|
6
6
|
import { getAgentClientModelSelection } from '../agent-clients/registry.js';
|
|
7
7
|
import { isAgentClientId } from '../agent-clients/types.js';
|
|
8
|
+
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
|
|
8
9
|
const USAGE = 'Usage: agent-infra-internal agent-client <next-steps|model-selection> [options]\n';
|
|
9
10
|
function failure(code, message) {
|
|
10
11
|
process.stdout.write(`${JSON.stringify({
|
|
@@ -21,7 +22,7 @@ function parseArgs(args) {
|
|
|
21
22
|
process.stdout.write(USAGE);
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
24
|
-
if (args[0]
|
|
25
|
+
if (!internalHandlerRoute('agent-client', 'next-steps', args[0] ?? '')) {
|
|
25
26
|
failure('AGENT_CLIENT_PAYLOAD_INVALID', "operation must be 'next-steps'");
|
|
26
27
|
return null;
|
|
27
28
|
}
|
|
@@ -72,7 +73,9 @@ function parseArgs(args) {
|
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
function agentClient(args = []) {
|
|
75
|
-
if (
|
|
76
|
+
if (!ensureInternalHandlerRoute('agent-client', args))
|
|
77
|
+
return;
|
|
78
|
+
if (internalHandlerRoute('agent-client', 'model-selection', args[0] ?? '')) {
|
|
76
79
|
const values = {};
|
|
77
80
|
const seen = new Set();
|
|
78
81
|
for (let index = 1; index < args.length; index += 1) {
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export const PUBLIC_CLI_COMMAND_ALIASES = Object.freeze({
|
|
2
|
+
'': 'help',
|
|
3
|
+
s: 'sandbox',
|
|
4
|
+
t: 'task',
|
|
5
|
+
'--version': 'version',
|
|
6
|
+
'-v': 'version'
|
|
7
|
+
});
|
|
8
|
+
export const PUBLIC_CLI_SELECTOR_ALIASES = Object.freeze({
|
|
9
|
+
task: Object.freeze({ d: 'decisions' })
|
|
10
|
+
});
|
|
11
|
+
export const PUBLIC_CLI_ROUTE_SELECTORS = Object.freeze({
|
|
12
|
+
'agent-client': ['list', 'status', 'enable', 'disable', 'configure'],
|
|
13
|
+
cp: ['cp'],
|
|
14
|
+
data: ['capture', 'verify', 'audit', 'repair', 'export'],
|
|
15
|
+
decide: ['decide'],
|
|
16
|
+
help: ['help'],
|
|
17
|
+
init: ['init'],
|
|
18
|
+
merge: ['merge'],
|
|
19
|
+
run: ['create-task', 'task-skill', 'recreate'],
|
|
20
|
+
sandbox: ['create', 'exec', 'ls', 'show', 'prune', 'rebuild', 'refresh', 'rm', 'start', 'vm'],
|
|
21
|
+
server: ['start', 'stop', 'status', 'logs', '__daemon'],
|
|
22
|
+
task: ['cat', 'decisions', 'files', 'grep', 'issue-body', 'log', 'ls', 'show', 'status'],
|
|
23
|
+
sync: ['sync'],
|
|
24
|
+
update: ['update'],
|
|
25
|
+
version: ['version']
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* The selector definitions consumed by every internal handler. Keep this
|
|
29
|
+
* module free of handler imports so the pre-import task-view guard remains
|
|
30
|
+
* effective.
|
|
31
|
+
*/
|
|
32
|
+
export const INTERNAL_HANDLER_ROUTE_SELECTORS = Object.freeze({
|
|
33
|
+
'task-create': ['input'],
|
|
34
|
+
'task-qualification': ['proposal', 'confirm', 'supersede', 'revoke'],
|
|
35
|
+
'sandbox-control': ['serve', 'execute', 'recover', 'client'],
|
|
36
|
+
'agent-client': ['next-steps', 'model-selection'],
|
|
37
|
+
'codex-lifecycle': ['preflight', 'capability-arm', 'hook-event', 'resolve-start', 'resolve-stop', 'consume'],
|
|
38
|
+
'codex-sandbox-controller': ['verify-context', 'run'],
|
|
39
|
+
'git-workflow': ['inspect', 'preview-tree', 'snapshot', 'compare-trees', 'commit', 'push-rebased'],
|
|
40
|
+
'task-delivery': ['deliver'],
|
|
41
|
+
'release-workflow': ['inspect', 'prepare', 'publish', 'post-prepare', 'post-publish'],
|
|
42
|
+
'platform-release-notes': ['context', 'stage', 'publish'],
|
|
43
|
+
'platform-security': ['read', 'dismiss'],
|
|
44
|
+
'platform-metadata': ['init-labels', 'init-milestones'],
|
|
45
|
+
'platform-context': ['resolve'],
|
|
46
|
+
'platform-comment': ['list', 'owner', 'backfill', 'sync'],
|
|
47
|
+
'platform-issue': ['inspect', 'create', 'bind', 'sync'],
|
|
48
|
+
'platform-pr': ['inspect', 'summary-context', 'resolve-external', 'create', 'bind', 'skip', 'sync', 'change-report', 'summary-sync', 'sync-in-labels'],
|
|
49
|
+
'platform-pr-review': ['inspect', 'list', 'publish-pr', 'publish-task'],
|
|
50
|
+
'pr-review-grade': ['decide', 'resolve-host', 'verify-artifact'],
|
|
51
|
+
'platform-checks': ['inspect', 'watch', 'resolve-run', 'logs'],
|
|
52
|
+
'task-context': ['resolve'],
|
|
53
|
+
'task-ledger': ['decision-next-id', 'stage-status', 'finding-upsert', 'finding-respond', 'finding-review', 'decision-upsert', 'rework-intent-upsert'],
|
|
54
|
+
'task-warning': ['list', 'add', 'set-status'],
|
|
55
|
+
'task-activity': ['pr-review-inspect', 'pr-review-start', 'pr-review-complete', 'pr-review-terminate'],
|
|
56
|
+
'task-artifact': ['inspect', 'init', 'repair', 'finalize-local'],
|
|
57
|
+
'task-orchestration': ['status', 'progress'],
|
|
58
|
+
'task-review': ['finalize-summary'],
|
|
59
|
+
'task-event': ['event'],
|
|
60
|
+
'task-invalidation': ['reconcile'],
|
|
61
|
+
'task-override': ['diagnose', 'issue', 'consume'],
|
|
62
|
+
'task-lifecycle': ['intent'],
|
|
63
|
+
'task-finalization': ['complete'],
|
|
64
|
+
'task-short-id': ['list', 'list-verify', 'alloc', 'release', 'resolve'],
|
|
65
|
+
'task-snapshot': ['snapshot'],
|
|
66
|
+
'task-verify': ['event'],
|
|
67
|
+
'task-validate': ['snapshot', 'inplace']
|
|
68
|
+
});
|
|
69
|
+
export const INTERNAL_CLI_ROUTE_SELECTORS = INTERNAL_HANDLER_ROUTE_SELECTORS;
|
|
70
|
+
function first(args) {
|
|
71
|
+
return args[0] ?? '';
|
|
72
|
+
}
|
|
73
|
+
function optionValue(args, name) {
|
|
74
|
+
const index = args.indexOf(name);
|
|
75
|
+
if (index >= 0)
|
|
76
|
+
return args[index + 1];
|
|
77
|
+
const prefix = `${name}=`;
|
|
78
|
+
return args.find((arg) => arg.startsWith(prefix))?.slice(prefix.length);
|
|
79
|
+
}
|
|
80
|
+
export function internalRouteSelector(command, args) {
|
|
81
|
+
if (command === 'sandbox-control')
|
|
82
|
+
return first(args);
|
|
83
|
+
if (command === 'task-create')
|
|
84
|
+
return 'input';
|
|
85
|
+
if (command === 'task-qualification')
|
|
86
|
+
return args[1] ?? '';
|
|
87
|
+
if (command === 'task-lifecycle')
|
|
88
|
+
return args[1] ? 'intent' : '';
|
|
89
|
+
if (command === 'task-finalization')
|
|
90
|
+
return args[1] === 'complete' ? 'complete' : '';
|
|
91
|
+
if (command === 'task-event')
|
|
92
|
+
return args[1] ? 'event' : '';
|
|
93
|
+
if (command === 'task-verify')
|
|
94
|
+
return args[0] && args[1] ? 'event' : '';
|
|
95
|
+
if (command === 'task-snapshot')
|
|
96
|
+
return 'snapshot';
|
|
97
|
+
if (command === 'task-validate')
|
|
98
|
+
return optionValue(args, '--scope') ?? 'snapshot';
|
|
99
|
+
if (command === 'task-short-id')
|
|
100
|
+
return first(args) === 'list' && args.includes('--verify') ? 'list-verify' : first(args);
|
|
101
|
+
if (command === 'task-orchestration')
|
|
102
|
+
return args[1] === 'status' ? 'status' : args[1] ? 'progress' : '';
|
|
103
|
+
if (command === 'task-review')
|
|
104
|
+
return args[1] ?? '';
|
|
105
|
+
if (command === 'task-invalidation')
|
|
106
|
+
return args[1] ?? '';
|
|
107
|
+
if (command === 'task-override')
|
|
108
|
+
return args[1] ?? '';
|
|
109
|
+
if (command === 'task-artifact')
|
|
110
|
+
return args[1] ?? '';
|
|
111
|
+
if (command === 'platform-pr-review' && first(args) === 'publish') {
|
|
112
|
+
const scope = optionValue(args, '--scope') ?? '';
|
|
113
|
+
return /^TASK-\d{8}-\d{6}$/u.test(scope) ? 'publish-task' : /^pr\d+$/u.test(scope) ? 'publish-pr' : '';
|
|
114
|
+
}
|
|
115
|
+
if (['task-ledger', 'task-warning', 'task-activity'].includes(command))
|
|
116
|
+
return args[1] ?? '';
|
|
117
|
+
if (command === 'task-delivery')
|
|
118
|
+
return args[1] ?? '';
|
|
119
|
+
if (command === 'task-context')
|
|
120
|
+
return first(args);
|
|
121
|
+
return first(args);
|
|
122
|
+
}
|
|
123
|
+
export function isInternalHandlerRoute(command, args) {
|
|
124
|
+
if (args[0] === '--help' || args[0] === '-h')
|
|
125
|
+
return true;
|
|
126
|
+
const selector = internalRouteSelector(command, args);
|
|
127
|
+
const selectors = INTERNAL_HANDLER_ROUTE_SELECTORS[command];
|
|
128
|
+
return Boolean(selector && selectors?.some((candidate) => candidate === selector));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Marks a selector at the handler's actual dispatch branch.
|
|
132
|
+
*
|
|
133
|
+
* The call is intentionally side-effect free so the top-level task-view guard
|
|
134
|
+
* can still run before a handler module is imported. Route coverage tests read
|
|
135
|
+
* these branch markers independently from the pre-import inventory.
|
|
136
|
+
*/
|
|
137
|
+
export function internalHandlerRoute(command, selector, actualSelector) {
|
|
138
|
+
return command.length > 0 && selector === actualSelector;
|
|
139
|
+
}
|
|
140
|
+
export function ensureInternalHandlerRoute(command, args) {
|
|
141
|
+
if (isInternalHandlerRoute(command, args))
|
|
142
|
+
return true;
|
|
143
|
+
const selector = internalRouteSelector(command, args);
|
|
144
|
+
process.stdout.write(`${JSON.stringify({
|
|
145
|
+
status: 'failed',
|
|
146
|
+
changed: false,
|
|
147
|
+
error: { code: 'INTERNAL_ROUTE_UNREGISTERED', message: `operation '${command} ${selector || first(args)}' is not registered` }
|
|
148
|
+
})}\n`);
|
|
149
|
+
process.exitCode = 1;
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=cli-route-inventory.js.map
|
|
@@ -10,6 +10,7 @@ import { verifyCodexSandboxControllerContextWithWarnings } from '../agent-client
|
|
|
10
10
|
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
11
11
|
import { hasSealableOrchestrationDelegation } from '../task/orchestration.js';
|
|
12
12
|
import { activateCodexOrchestrationDelegation, activateCodexSpawnDelegation, reconcileCodexOrchestrationDelegation, sealCodexOrchestrationDelegation, sealCodexParentDelegation } from '../task/codex-orchestration.js';
|
|
13
|
+
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
|
|
13
14
|
const USAGE = 'Usage: agent-infra-internal codex-lifecycle <capability-arm|hook-event|resolve-start|resolve-stop|preflight|consume> [options]\n';
|
|
14
15
|
const MANAGED_AGENT = /^agent-infra-lifecycle-(executor|reviewer)$/;
|
|
15
16
|
function output(value) {
|
|
@@ -144,11 +145,13 @@ function payloadText(payload, key) {
|
|
|
144
145
|
: '';
|
|
145
146
|
}
|
|
146
147
|
async function codexLifecycle(args = []) {
|
|
148
|
+
if (!ensureInternalHandlerRoute('codex-lifecycle', args))
|
|
149
|
+
return;
|
|
147
150
|
const parsed = parse(args);
|
|
148
151
|
if (!parsed || process.exitCode)
|
|
149
152
|
return;
|
|
150
153
|
try {
|
|
151
|
-
if (
|
|
154
|
+
if (internalHandlerRoute('codex-lifecycle', 'preflight', parsed.operation)) {
|
|
152
155
|
const format = parsed.values['--format'] ?? 'json';
|
|
153
156
|
if (!['text', 'json'].includes(format))
|
|
154
157
|
throw new Error("format must be 'text' or 'json'");
|
|
@@ -173,7 +176,7 @@ async function codexLifecycle(args = []) {
|
|
|
173
176
|
output({ status: 'ready', changed: false, evidence: result, diagnostics: result.diagnostics, error: null });
|
|
174
177
|
return;
|
|
175
178
|
}
|
|
176
|
-
if (
|
|
179
|
+
if (internalHandlerRoute('codex-lifecycle', 'capability-arm', parsed.operation)) {
|
|
177
180
|
const taskId = parsed.values['--task-id'];
|
|
178
181
|
if (!taskId)
|
|
179
182
|
throw new Error('capability-arm requires --task-id');
|
|
@@ -197,7 +200,7 @@ async function codexLifecycle(args = []) {
|
|
|
197
200
|
return;
|
|
198
201
|
}
|
|
199
202
|
const store = createCodexLifecycleStore({ cliVersion: cliVersion() });
|
|
200
|
-
if (
|
|
203
|
+
if (internalHandlerRoute('codex-lifecycle', 'hook-event', parsed.operation)) {
|
|
201
204
|
const phase = parsed.values['--event'];
|
|
202
205
|
if (!phase || !['pre-tool', 'subagent-start', 'post-tool', 'subagent-stop'].includes(phase)) {
|
|
203
206
|
throw new Error('hook-event requires a known --event');
|
|
@@ -337,7 +340,7 @@ async function codexLifecycle(args = []) {
|
|
|
337
340
|
const childThreadId = parsed.values['--child-id'];
|
|
338
341
|
if (!childThreadId)
|
|
339
342
|
throw new Error(`operation '${parsed.operation}' requires --child-id`);
|
|
340
|
-
if (
|
|
343
|
+
if (internalHandlerRoute('codex-lifecycle', 'resolve-start', parsed.operation)) {
|
|
341
344
|
if (store.read(childThreadId).state.spawn?.hookDefinitionHash !== hookDefinitionHash()) {
|
|
342
345
|
throw new Error('Codex lifecycle hook definition hash is stale');
|
|
343
346
|
}
|
|
@@ -351,7 +354,7 @@ async function codexLifecycle(args = []) {
|
|
|
351
354
|
process.exitCode = 1;
|
|
352
355
|
return;
|
|
353
356
|
}
|
|
354
|
-
if (
|
|
357
|
+
if (internalHandlerRoute('codex-lifecycle', 'resolve-stop', parsed.operation)) {
|
|
355
358
|
const stopTurnId = store.read(childThreadId).state.stop?.turnId;
|
|
356
359
|
if (!stopTurnId)
|
|
357
360
|
throw new Error('Codex lifecycle stop hook is not available');
|
|
@@ -363,7 +366,7 @@ async function codexLifecycle(args = []) {
|
|
|
363
366
|
output({ status: latest.state.status, changed: true, evidence: latest.state.stopEvidence, diagnostics: [], error: latest.state.error });
|
|
364
367
|
return;
|
|
365
368
|
}
|
|
366
|
-
if (
|
|
369
|
+
if (internalHandlerRoute('codex-lifecycle', 'consume', parsed.operation)) {
|
|
367
370
|
const consumer = parsed.values['--consumer'];
|
|
368
371
|
if (!consumer)
|
|
369
372
|
throw new Error('consume requires --consumer');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { runCodexSandboxController, verifyCodexSandboxControllerContextWithWarnings } from '../agent-clients/adapters/codex-lifecycle/sandbox-controller.js';
|
|
2
|
+
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
|
|
2
3
|
const USAGE = 'Usage: agent-infra-internal codex-sandbox-controller <run|verify-context> [options]\n';
|
|
3
4
|
function fail(code, message, exitCode = 1) {
|
|
4
5
|
process.stdout.write(`${JSON.stringify({
|
|
@@ -14,7 +15,10 @@ function parse(args) {
|
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
17
|
const operation = args[0];
|
|
17
|
-
if (!operation || ![
|
|
18
|
+
if (!operation || ![
|
|
19
|
+
internalHandlerRoute('codex-sandbox-controller', 'run', operation),
|
|
20
|
+
internalHandlerRoute('codex-sandbox-controller', 'verify-context', operation)
|
|
21
|
+
].some(Boolean)) {
|
|
18
22
|
process.stderr.write(USAGE);
|
|
19
23
|
fail('CODEX_SANDBOX_CONTROLLER_PAYLOAD_INVALID', 'operation must be run or verify-context', 2);
|
|
20
24
|
return null;
|
|
@@ -44,11 +48,13 @@ function parse(args) {
|
|
|
44
48
|
return { operation, values };
|
|
45
49
|
}
|
|
46
50
|
async function codexSandboxController(args = []) {
|
|
51
|
+
if (!ensureInternalHandlerRoute('codex-sandbox-controller', args))
|
|
52
|
+
return;
|
|
47
53
|
const parsed = parse(args);
|
|
48
54
|
if (!parsed || process.exitCode)
|
|
49
55
|
return;
|
|
50
56
|
try {
|
|
51
|
-
if (
|
|
57
|
+
if (internalHandlerRoute('codex-sandbox-controller', 'verify-context', parsed.operation)) {
|
|
52
58
|
const contextPath = parsed.values['--context']
|
|
53
59
|
?? process.env.AGENT_INFRA_CODEX_CONTROLLER_CONTEXT;
|
|
54
60
|
if (!contextPath)
|
|
@@ -3,42 +3,46 @@ import { inspectGitWorkflow, previewCommitTree, pushRebasedBranch } from '../git
|
|
|
3
3
|
import { compareReviewTrees, snapshotReview } from '../git/review-snapshot.js';
|
|
4
4
|
import { resolvePostReviewGlobs } from '../task/review-fingerprint.js';
|
|
5
5
|
import { executeCommitOperation } from '../task/commit-operation.js';
|
|
6
|
+
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
|
|
6
7
|
function output(value) { process.stdout.write(`${JSON.stringify(value)}\n`); }
|
|
7
8
|
function gitWorkflow(args = []) {
|
|
9
|
+
if (!ensureInternalHandlerRoute('git-workflow', args))
|
|
10
|
+
return;
|
|
8
11
|
const [action, ...rest] = args;
|
|
9
12
|
const cwdIndex = rest.indexOf('--cwd');
|
|
10
13
|
const cwd = cwdIndex >= 0 ? rest[cwdIndex + 1] : process.cwd();
|
|
11
14
|
let result;
|
|
12
|
-
if (action
|
|
15
|
+
if (internalHandlerRoute('git-workflow', 'inspect', action ?? '')) {
|
|
13
16
|
const inputIndex = rest.indexOf('--input');
|
|
14
17
|
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
15
18
|
result = inspectGitWorkflow(cwd ?? process.cwd(), undefined, input?.remote && input.refs ? { remote: input.remote, refs: input.refs } : undefined);
|
|
16
19
|
}
|
|
17
|
-
else if (action
|
|
20
|
+
else if (internalHandlerRoute('git-workflow', 'commit', action ?? '')) {
|
|
18
21
|
const inputIndex = rest.indexOf('--input');
|
|
19
22
|
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
20
23
|
result = input
|
|
21
24
|
? executeCommitOperation({ cwd: cwd ?? process.cwd(), ...input })
|
|
22
25
|
: { status: 'failed', changed: false, error: { code: 'GIT_INPUT_REQUIRED', message: '--input JSON file is required' } };
|
|
23
26
|
}
|
|
24
|
-
else if (
|
|
27
|
+
else if (internalHandlerRoute('git-workflow', 'push-rebased', action ?? '')) {
|
|
25
28
|
const inputIndex = rest.indexOf('--input');
|
|
26
29
|
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
27
30
|
result = input ? pushRebasedBranch({ cwd: cwd ?? process.cwd(), ...input }) : { status: 'failed', changed: false, error: { code: 'GIT_INPUT_REQUIRED', message: '--input JSON file is required' } };
|
|
28
31
|
}
|
|
29
|
-
else if (
|
|
32
|
+
else if (internalHandlerRoute('git-workflow', 'preview-tree', action ?? '')) {
|
|
30
33
|
const inputIndex = rest.indexOf('--input');
|
|
31
34
|
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
32
35
|
result = input
|
|
33
36
|
? previewCommitTree({ cwd: cwd ?? process.cwd(), paths: input.paths, expectedHead: input.expectedHead })
|
|
34
37
|
: { status: 'failed', changed: false, error: { code: 'GIT_INPUT_REQUIRED', message: '--input JSON file is required' } };
|
|
35
38
|
}
|
|
36
|
-
else if (
|
|
39
|
+
else if (internalHandlerRoute('git-workflow', 'snapshot', action ?? '')
|
|
40
|
+
|| internalHandlerRoute('git-workflow', 'compare-trees', action ?? '')) {
|
|
37
41
|
const inputIndex = rest.indexOf('--input');
|
|
38
42
|
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
39
43
|
if (!input)
|
|
40
44
|
result = { status: 'failed', changed: false, error: { code: 'GIT_INPUT_REQUIRED', message: '--input JSON file is required' } };
|
|
41
|
-
else if (action
|
|
45
|
+
else if (internalHandlerRoute('git-workflow', 'snapshot', action ?? ''))
|
|
42
46
|
result = { status: 'no-op', changed: false, snapshot: snapshotReview({ cwd: cwd ?? process.cwd(), mode: input.mode, baseline: input.baseline, diffBase: input.diffBase, globs: input.globs ?? resolvePostReviewGlobs({}, {}) }), error: null };
|
|
43
47
|
else
|
|
44
48
|
result = { status: 'no-op', changed: false, comparison: compareReviewTrees({ cwd: cwd ?? process.cwd(), expected: input.expected, actual: input.actual }), error: null };
|