@fitlab-ai/agent-infra 0.9.10 → 0.9.12
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 +19 -9
- package/README.zh-CN.md +19 -9
- package/bin/cli.ts +17 -4
- package/dist/bin/cli.js +19 -4
- package/dist/bin/internal-cli.js +55 -4
- package/dist/lib/agent-client.js +0 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
- package/dist/lib/agent-clients/adapters/traecli.js +7 -8
- package/dist/lib/agent-clients/config.js +14 -99
- package/dist/lib/agent-clients/reconcile.js +1 -11
- package/dist/lib/agent-clients/schema.js +5 -4
- package/dist/lib/agent-clients/tokens.js +5 -15
- package/dist/lib/decide.js +14 -30
- package/dist/lib/defaults.json +8 -0
- package/dist/lib/git/workflow.js +43 -1
- package/dist/lib/init.js +3 -2
- package/dist/lib/internal/git-workflow.js +8 -1
- package/dist/lib/internal/platform-pr.js +8 -2
- package/dist/lib/internal/release-workflow.js +0 -1
- package/dist/lib/internal/task-delivery.js +59 -0
- package/dist/lib/internal/task-finalization.js +19 -9
- package/dist/lib/internal/task-ledger.js +8 -2
- package/dist/lib/internal/task-lifecycle.js +17 -93
- package/dist/lib/internal/task-orchestration.js +30 -216
- package/dist/lib/internal/task-validate.js +2 -1
- package/dist/lib/merge.js +205 -103
- package/dist/lib/platform/github-client.js +7 -1
- package/dist/lib/platform/pr-checks.js +8 -5
- package/dist/lib/platform/pr-summary.js +12 -8
- package/dist/lib/platform/pull-requests.js +393 -91
- package/dist/lib/platform/verification-required.js +13 -2
- package/dist/lib/platform/verification-sync.js +9 -4
- package/dist/lib/pr-review/evidence-grading.js +12 -4
- package/dist/lib/process-data/normalize.js +2 -9
- package/dist/lib/run/host.js +46 -16
- package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
- package/dist/lib/sandbox/commands/create.js +3 -3
- package/dist/lib/sandbox/commands/enter.js +18 -4
- package/dist/lib/sandbox/config.js +8 -12
- package/dist/lib/sandbox/control/executor.js +131 -39
- package/dist/lib/sandbox/control/lifecycle.js +55 -24
- package/dist/lib/sandbox/control/server.js +18 -16
- package/dist/lib/sandbox/mounts.js +3 -2
- package/dist/lib/sandbox/recovery.js +123 -22
- package/dist/lib/sandbox/workspace-identity.js +14 -0
- package/dist/lib/sandbox/workspace-view.js +8 -9
- package/dist/lib/self-update.js +278 -0
- package/dist/lib/server/process-state.js +2 -2
- package/dist/lib/server/protocol.js +5 -5
- package/dist/lib/task/activity-log.js +4 -1
- package/dist/lib/task/artifact-lifecycle.js +6 -4
- package/dist/lib/task/codex-orchestration.js +1 -1
- package/dist/lib/task/command-options.js +1 -3
- package/dist/lib/task/commands/cat.js +0 -5
- package/dist/lib/task/commands/decisions.js +76 -92
- package/dist/lib/task/commands/files.js +6 -6
- package/dist/lib/task/commands/grep.js +25 -61
- package/dist/lib/task/commands/issue-body.js +6 -6
- package/dist/lib/task/commands/log.js +25 -10
- package/dist/lib/task/commands/show.js +5 -6
- package/dist/lib/task/commands/status.js +8 -8
- package/dist/lib/task/commit-intent.js +100 -0
- package/dist/lib/task/commit-operation.js +181 -91
- package/dist/lib/task/commit-policy.js +1 -1
- package/dist/lib/task/control-authority.js +431 -0
- package/dist/lib/task/create.js +39 -8
- package/dist/lib/task/current-contract.js +35 -0
- package/dist/lib/task/decision-details.js +218 -0
- package/dist/lib/task/decision-intents.js +5 -2
- package/dist/lib/task/delivery-target.js +97 -0
- package/dist/lib/task/delivery.js +153 -0
- package/dist/lib/task/events.js +11 -5
- package/dist/lib/task/human-override.js +5 -2
- package/dist/lib/task/index.js +19 -20
- package/dist/lib/task/ledger-intents.js +8 -9
- package/dist/lib/task/ledger.js +13 -6
- package/dist/lib/task/lifecycle.js +122 -9
- package/dist/lib/task/orchestration.js +105 -75
- package/dist/lib/task/pr-delivery-fact.js +182 -0
- package/dist/lib/task/review-artifacts.js +31 -12
- package/dist/lib/task/review-finalization.js +13 -4
- package/dist/lib/task/review-fingerprint.js +8 -0
- package/dist/lib/task/verification-engine.js +86 -39
- package/dist/lib/task/verification-review.js +2 -2
- package/dist/lib/task/workspace-snapshot.js +5 -11
- package/dist/lib/task/write.js +11 -1
- package/dist/lib/update.js +13 -35
- package/dist/lib/version.js +5 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-client.ts +0 -1
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
- package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +7 -8
- package/lib/agent-clients/config.ts +14 -144
- package/lib/agent-clients/reconcile.ts +1 -12
- package/lib/agent-clients/schema.ts +5 -4
- package/lib/agent-clients/tokens.ts +5 -18
- package/lib/decide.ts +12 -22
- package/lib/defaults.json +8 -0
- package/lib/git/workflow.ts +38 -1
- package/lib/init.ts +5 -2
- package/lib/internal/git-workflow.ts +7 -1
- package/lib/internal/platform-pr.ts +8 -1
- package/lib/internal/release-workflow.ts +0 -1
- package/lib/internal/task-delivery.ts +53 -0
- package/lib/internal/task-finalization.ts +27 -13
- package/lib/internal/task-ledger.ts +8 -2
- package/lib/internal/task-lifecycle.ts +33 -76
- package/lib/internal/task-orchestration.ts +33 -190
- package/lib/internal/task-validate.ts +3 -2
- package/lib/merge.ts +236 -120
- package/lib/platform/github-client.ts +8 -1
- package/lib/platform/pr-checks.ts +7 -5
- package/lib/platform/pr-summary.ts +10 -7
- package/lib/platform/pull-requests.ts +425 -87
- package/lib/platform/verification-required.ts +12 -2
- package/lib/platform/verification-sync.ts +9 -4
- package/lib/pr-review/evidence-grading.ts +7 -4
- package/lib/process-data/normalize.ts +2 -8
- package/lib/run/host.ts +63 -14
- package/lib/sandbox/agent-client-reconciler.ts +5 -15
- package/lib/sandbox/commands/create.ts +4 -4
- package/lib/sandbox/commands/enter.ts +24 -4
- package/lib/sandbox/config.ts +9 -14
- package/lib/sandbox/control/container-identity.ts +2 -2
- package/lib/sandbox/control/executor.ts +148 -51
- package/lib/sandbox/control/lifecycle.ts +59 -31
- package/lib/sandbox/control/protocol.ts +1 -3
- package/lib/sandbox/control/server.ts +15 -12
- package/lib/sandbox/control/state.ts +7 -7
- package/lib/sandbox/mounts.ts +4 -3
- package/lib/sandbox/recovery.ts +162 -34
- package/lib/sandbox/tools.ts +1 -1
- package/lib/sandbox/workspace-identity.ts +28 -0
- package/lib/sandbox/workspace-view.ts +14 -10
- package/lib/self-update.ts +341 -0
- package/lib/server/process-state.ts +2 -2
- package/lib/server/protocol.ts +5 -5
- package/lib/task/activity-log.ts +6 -1
- package/lib/task/artifact-lifecycle.ts +7 -5
- package/lib/task/codex-orchestration.ts +2 -1
- package/lib/task/command-options.ts +1 -2
- package/lib/task/commands/cat.ts +0 -4
- package/lib/task/commands/decisions.ts +80 -75
- package/lib/task/commands/files.ts +6 -6
- package/lib/task/commands/grep.ts +23 -51
- package/lib/task/commands/issue-body.ts +6 -6
- package/lib/task/commands/log.ts +22 -10
- package/lib/task/commands/show.ts +5 -6
- package/lib/task/commands/status.ts +8 -8
- package/lib/task/commit-intent.ts +137 -0
- package/lib/task/commit-operation.ts +161 -79
- package/lib/task/commit-policy.ts +1 -2
- package/lib/task/control-authority.ts +563 -0
- package/lib/task/create.ts +40 -10
- package/lib/task/current-contract.ts +49 -0
- package/lib/task/decision-details.ts +280 -0
- package/lib/task/decision-intents.ts +7 -2
- package/lib/task/delivery-target.ts +130 -0
- package/lib/task/delivery.ts +160 -0
- package/lib/task/events.ts +10 -5
- package/lib/task/human-override.ts +5 -2
- package/lib/task/index.ts +19 -20
- package/lib/task/ledger-intents.ts +6 -8
- package/lib/task/ledger.ts +17 -7
- package/lib/task/lifecycle.ts +113 -4
- package/lib/task/orchestration.ts +102 -80
- package/lib/task/pr-delivery-fact.ts +254 -0
- package/lib/task/review-artifacts.ts +53 -15
- package/lib/task/review-finalization.ts +21 -5
- package/lib/task/review-fingerprint.ts +10 -0
- package/lib/task/verification-engine.ts +78 -46
- package/lib/task/verification-review.ts +3 -1
- package/lib/task/workspace-snapshot.ts +4 -13
- package/lib/task/write.ts +20 -1
- package/lib/update.ts +14 -38
- package/lib/version.ts +6 -1
- package/package.json +1 -1
- package/templates/.agents/README.en.md +5 -3
- package/templates/.agents/README.zh-CN.md +5 -3
- package/templates/.agents/rules/README.en.md +4 -2
- package/templates/.agents/rules/README.zh-CN.md +4 -2
- package/templates/.agents/rules/compatibility-policy.en.md +5 -4
- package/templates/.agents/rules/compatibility-policy.zh-CN.md +5 -4
- package/templates/.agents/rules/create-issue.en.md +11 -2
- package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
- package/templates/.agents/rules/human-decision-context.en.md +9 -7
- package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
- package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +1 -1
- package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +5 -18
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +26 -5
- package/templates/.agents/rules/issue-sync.zh-CN.md +62 -5
- package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
- package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
- package/templates/.agents/rules/local-artifact-repair.en.md +46 -0
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +46 -0
- package/templates/.agents/rules/milestone-inference.en.md +12 -2
- package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
- package/templates/.agents/rules/next-step-output.en.md +3 -3
- package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
- package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
- package/templates/.agents/rules/pr-sync.en.md +23 -14
- package/templates/.agents/rules/pr-sync.zh-CN.md +23 -2
- package/templates/.agents/rules/release-commands.en.md +42 -3
- package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
- package/templates/.agents/rules/review-handshake.en.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/security-alerts.en.md +17 -2
- package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
- package/templates/.agents/rules/sync-content-generation.en.md +8 -0
- package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
- package/templates/.agents/rules/task-management.en.md +2 -3
- package/templates/.agents/rules/task-management.zh-CN.md +2 -3
- package/templates/.agents/scripts/security-alerts.github.sh +151 -0
- package/templates/.agents/scripts/security-alerts.sh +31 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -3
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -3
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/code-task/SKILL.en.md +8 -5
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +9 -6
- package/templates/.agents/skills/commit/SKILL.en.md +30 -10
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -7
- package/templates/.agents/skills/commit/config/verify.json +1 -1
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
- 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 +2 -2
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +7 -6
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -6
- package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
- package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
- 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 +13 -13
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +13 -13
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
- package/templates/.agents/skills/create-pr/SKILL.en.md +9 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +9 -11
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -4
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
- package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
- package/templates/.agents/skills/create-task/SKILL.en.md +2 -1
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +2 -1
- 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/import-issue/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
- package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
- package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
- package/templates/.agents/skills/plan-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +8 -5
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
- 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/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +2 -1
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +2 -1
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
- package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
- package/templates/.agents/skills/review-plan/SKILL.en.md +8 -5
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
- package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -0
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +5 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +5 -1
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +144 -109
- package/templates/.agents/skills/watch-pr/SKILL.en.md +5 -5
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +5 -5
- package/templates/.agents/templates/task.en.md +6 -2
- package/templates/.agents/templates/task.zh-CN.md +6 -2
- package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
- package/templates/.agents/workflows/feature-development.en.yaml +9 -8
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
- package/templates/.agents/workflows/refactoring.en.yaml +9 -8
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
- package/templates/.claude/commands/analyze-task.en.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.en.md +1 -1
- package/templates/.claude/commands/block-task.zh-CN.md +1 -1
- package/templates/.claude/commands/cancel-task.en.md +1 -1
- package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
- package/templates/.claude/commands/check-task.en.md +1 -1
- package/templates/.claude/commands/check-task.zh-CN.md +1 -1
- package/templates/.claude/commands/code-task.en.md +1 -1
- package/templates/.claude/commands/code-task.zh-CN.md +1 -1
- package/templates/.claude/commands/commit.en.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.en.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.en.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/plan-task.en.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/review-analysis.en.md +1 -1
- package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
- package/templates/.claude/commands/review-code.en.md +1 -1
- package/templates/.claude/commands/review-code.zh-CN.md +1 -1
- package/templates/.claude/commands/review-plan.en.md +1 -1
- package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
- package/templates/.claude/commands/run-manual-validation.en.md +1 -1
- package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/run-task.en.md +1 -1
- package/templates/.claude/commands/run-task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.en.md +0 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.zh-CN.md +0 -1
- package/dist/lib/builtin-tuis.js +0 -40
- package/lib/builtin-tuis.ts +0 -56
- package/templates/.agents/rules/create-issue.github.en.md +0 -14
- package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
- package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
- package/templates/.agents/rules/issue-sync.github.en.md +0 -40
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
- package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
- package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
- package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
- package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
- package/templates/.agents/rules/pr-sync.github.en.md +0 -43
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
- package/templates/.agents/rules/release-commands.github.en.md +0 -38
- package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -38
- package/templates/.agents/rules/security-alerts.github.en.md +0 -43
- package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
import { err, info, ok } from './log.ts';
|
|
6
|
+
import { needsShell, resolveCommandFromAbsolutePath } from './run/host.ts';
|
|
7
|
+
|
|
8
|
+
type CommandResult = {
|
|
9
|
+
status: number | null;
|
|
10
|
+
signal?: NodeJS.Signals | null;
|
|
11
|
+
stdout?: string;
|
|
12
|
+
stderr?: string;
|
|
13
|
+
error?: Error;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type SelfUpdateOptions = Readonly<{
|
|
17
|
+
platform?: NodeJS.Platform;
|
|
18
|
+
env?: NodeJS.ProcessEnv;
|
|
19
|
+
argv?: readonly string[];
|
|
20
|
+
run?: (command: readonly string[]) => CommandResult;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
export type UpdateSource = Readonly<{
|
|
24
|
+
kind: 'npm' | 'brew';
|
|
25
|
+
managerPath: string;
|
|
26
|
+
packageRoot: string;
|
|
27
|
+
updateArgs: readonly string[];
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
export type UpdateSourceResult = Readonly<{
|
|
31
|
+
source: UpdateSource | null;
|
|
32
|
+
error?: string;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
type PackageInfo = Readonly<{
|
|
36
|
+
root: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}>;
|
|
39
|
+
|
|
40
|
+
function canonicalPath(target: string): string | null {
|
|
41
|
+
try {
|
|
42
|
+
return fs.realpathSync.native(target);
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function comparable(target: string, platform: NodeJS.Platform): string {
|
|
49
|
+
const resolved = path.resolve(target).replaceAll('\\', '/');
|
|
50
|
+
return platform === 'win32' ? resolved.toLowerCase() : resolved;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function samePath(left: string, right: string, platform: NodeJS.Platform): boolean {
|
|
54
|
+
return comparable(left, platform) === comparable(right, platform);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isWithin(root: string, target: string, platform: NodeJS.Platform): boolean {
|
|
58
|
+
const normalizedRoot = comparable(root, platform).replace(/\/$/, '');
|
|
59
|
+
const normalizedTarget = comparable(target, platform).replace(/\/$/, '');
|
|
60
|
+
return normalizedTarget === normalizedRoot
|
|
61
|
+
|| normalizedTarget.startsWith(`${normalizedRoot}/`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function packageInfoFromRoot(root: string): PackageInfo | null {
|
|
65
|
+
try {
|
|
66
|
+
const packageJson = JSON.parse(
|
|
67
|
+
fs.readFileSync(path.join(root, 'package.json'), 'utf8')
|
|
68
|
+
) as { name?: unknown };
|
|
69
|
+
return typeof packageJson.name === 'string'
|
|
70
|
+
? { root, name: packageJson.name }
|
|
71
|
+
: null;
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function findPackageInfo(entry: string, platform: NodeJS.Platform): PackageInfo | null {
|
|
78
|
+
const canonicalEntry = canonicalPath(entry);
|
|
79
|
+
if (!canonicalEntry) return null;
|
|
80
|
+
|
|
81
|
+
let current = path.dirname(canonicalEntry);
|
|
82
|
+
while (true) {
|
|
83
|
+
const canonicalRoot = canonicalPath(current);
|
|
84
|
+
const info = canonicalRoot ? packageInfoFromRoot(canonicalRoot) : null;
|
|
85
|
+
if (info && isWithin(info.root, canonicalEntry, platform)) return info;
|
|
86
|
+
const parent = path.dirname(current);
|
|
87
|
+
if (parent === current) return null;
|
|
88
|
+
current = parent;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function packageInfoFromCommand(commandPath: string, platform: NodeJS.Platform): PackageInfo | null {
|
|
93
|
+
const direct = findPackageInfo(commandPath, platform);
|
|
94
|
+
if (direct) return direct;
|
|
95
|
+
if (!/\.(?:cmd|bat)$/i.test(commandPath)) return null;
|
|
96
|
+
|
|
97
|
+
const globalPackageRoot = canonicalPath(path.join(
|
|
98
|
+
path.dirname(commandPath),
|
|
99
|
+
'node_modules',
|
|
100
|
+
'@fitlab-ai',
|
|
101
|
+
'agent-infra'
|
|
102
|
+
));
|
|
103
|
+
return globalPackageRoot ? packageInfoFromRoot(globalPackageRoot) : null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function visibleAliasError(
|
|
107
|
+
packageRoot: string,
|
|
108
|
+
platform: NodeJS.Platform,
|
|
109
|
+
env: NodeJS.ProcessEnv
|
|
110
|
+
): string | null {
|
|
111
|
+
for (const alias of ['ai', 'agent-infra']) {
|
|
112
|
+
const absolute = resolveCommandFromAbsolutePath(alias, platform, env);
|
|
113
|
+
if (!absolute) continue;
|
|
114
|
+
if (!canonicalPath(absolute)) continue;
|
|
115
|
+
const info = packageInfoFromCommand(absolute, platform);
|
|
116
|
+
if (info && !samePath(info.root, packageRoot, platform)) {
|
|
117
|
+
return `PATH shadowing detected: ${alias} resolves to ${info.root}, not ${packageRoot}.`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function resolveManager(
|
|
124
|
+
name: string,
|
|
125
|
+
expectedBasenames: readonly string[],
|
|
126
|
+
platform: NodeJS.Platform,
|
|
127
|
+
env: NodeJS.ProcessEnv
|
|
128
|
+
): { path: string } | { error: string } | null {
|
|
129
|
+
const absolute = resolveCommandFromAbsolutePath(name, platform, env);
|
|
130
|
+
if (!absolute) {
|
|
131
|
+
return { error: `${name} manager was not found on PATH.` };
|
|
132
|
+
}
|
|
133
|
+
let stat: fs.Stats;
|
|
134
|
+
try {
|
|
135
|
+
stat = fs.statSync(absolute);
|
|
136
|
+
} catch {
|
|
137
|
+
return { error: `Cannot inspect manager executable: ${absolute}.` };
|
|
138
|
+
}
|
|
139
|
+
if (!stat.isFile()) return { error: `Manager executable is not a regular file: ${absolute}.` };
|
|
140
|
+
if (!expectedBasenames.includes(path.basename(absolute).toLowerCase())) {
|
|
141
|
+
return { error: `Unexpected manager executable: ${absolute}.` };
|
|
142
|
+
}
|
|
143
|
+
const canonical = canonicalPath(absolute);
|
|
144
|
+
return canonical ? { path: canonical } : null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function defaultRun(command: readonly string[], platform: NodeJS.Platform): CommandResult {
|
|
148
|
+
const [file, ...args] = command;
|
|
149
|
+
if (!file) return { status: null, error: new Error('run: missing command') };
|
|
150
|
+
const result = spawnSync(file, args, {
|
|
151
|
+
encoding: 'utf8',
|
|
152
|
+
shell: needsShell(file, platform),
|
|
153
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
154
|
+
});
|
|
155
|
+
return {
|
|
156
|
+
status: result.status,
|
|
157
|
+
signal: result.signal,
|
|
158
|
+
stdout: result.stdout || '',
|
|
159
|
+
stderr: result.stderr || '',
|
|
160
|
+
error: result.error
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function runCommand(
|
|
165
|
+
command: readonly string[],
|
|
166
|
+
options: SelfUpdateOptions,
|
|
167
|
+
platform: NodeJS.Platform
|
|
168
|
+
): CommandResult {
|
|
169
|
+
return options.run ? options.run(command) : defaultRun(command, platform);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function probe(
|
|
173
|
+
command: readonly string[],
|
|
174
|
+
options: SelfUpdateOptions,
|
|
175
|
+
platform: NodeJS.Platform,
|
|
176
|
+
label: string
|
|
177
|
+
): string | { error: string } {
|
|
178
|
+
const result = runCommand(command, options, platform);
|
|
179
|
+
if (result.error) return { error: `${label} failed: ${result.error.message}` };
|
|
180
|
+
if (result.signal) return { error: `${label} terminated by ${result.signal}.` };
|
|
181
|
+
if (result.status !== 0) {
|
|
182
|
+
const detail = result.stderr?.trim();
|
|
183
|
+
return { error: `${label} exited with ${result.status ?? 1}${detail ? `: ${detail}` : '.'}` };
|
|
184
|
+
}
|
|
185
|
+
const output = result.stdout?.trim() || '';
|
|
186
|
+
return output ? output : { error: `${label} returned no path.` };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function npmSource(
|
|
190
|
+
packageInfo: PackageInfo,
|
|
191
|
+
options: SelfUpdateOptions,
|
|
192
|
+
platform: NodeJS.Platform,
|
|
193
|
+
env: NodeJS.ProcessEnv
|
|
194
|
+
): UpdateSource | { error: string } | null {
|
|
195
|
+
const manager = resolveManager(
|
|
196
|
+
'npm',
|
|
197
|
+
platform === 'win32' ? ['npm.cmd', 'npm.bat'] : ['npm'],
|
|
198
|
+
platform,
|
|
199
|
+
env
|
|
200
|
+
);
|
|
201
|
+
if (!manager) return null;
|
|
202
|
+
if ('error' in manager) return manager;
|
|
203
|
+
|
|
204
|
+
const prefixOutput = probe([manager.path, 'prefix', '--global'], options, platform, 'npm prefix --global');
|
|
205
|
+
if (typeof prefixOutput !== 'string') return prefixOutput;
|
|
206
|
+
const rootOutput = probe([manager.path, 'root', '--global'], options, platform, 'npm root --global');
|
|
207
|
+
if (typeof rootOutput !== 'string') return rootOutput;
|
|
208
|
+
const prefix = canonicalPath(prefixOutput);
|
|
209
|
+
const globalRoot = canonicalPath(rootOutput);
|
|
210
|
+
if (!prefix || !globalRoot) return { error: 'npm global prefix or root is not an existing directory.' };
|
|
211
|
+
if (!isWithin(prefix, globalRoot, platform)) {
|
|
212
|
+
return { error: `npm global root ${globalRoot} is outside prefix ${prefix}.` };
|
|
213
|
+
}
|
|
214
|
+
const expectedPackageRoot = canonicalPath(path.join(globalRoot, '@fitlab-ai', 'agent-infra'));
|
|
215
|
+
if (!expectedPackageRoot || !samePath(expectedPackageRoot, packageInfo.root, platform)) {
|
|
216
|
+
return { error: `Current CLI package is not owned by npm global root ${globalRoot}.` };
|
|
217
|
+
}
|
|
218
|
+
if (packageInfo.name !== '@fitlab-ai/agent-infra') {
|
|
219
|
+
return { error: `Unexpected package name at ${packageInfo.root}: ${packageInfo.name}.` };
|
|
220
|
+
}
|
|
221
|
+
if (platform !== 'win32' && !isWithin(prefix, manager.path, platform)) {
|
|
222
|
+
return { error: `npm manager ${manager.path} is outside global prefix ${prefix}.` };
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
kind: 'npm',
|
|
226
|
+
managerPath: manager.path,
|
|
227
|
+
packageRoot: packageInfo.root,
|
|
228
|
+
updateArgs: ['update', '--global', '@fitlab-ai/agent-infra']
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function brewSource(
|
|
233
|
+
packageInfo: PackageInfo,
|
|
234
|
+
options: SelfUpdateOptions,
|
|
235
|
+
platform: NodeJS.Platform,
|
|
236
|
+
env: NodeJS.ProcessEnv
|
|
237
|
+
): UpdateSource | { error: string } | null {
|
|
238
|
+
const manager = resolveManager('brew', ['brew', 'brew.exe', 'brew.cmd'], platform, env);
|
|
239
|
+
if (!manager) return null;
|
|
240
|
+
if ('error' in manager) return manager;
|
|
241
|
+
|
|
242
|
+
const homebrewOutput = probe([manager.path, '--prefix'], options, platform, 'brew --prefix');
|
|
243
|
+
if (typeof homebrewOutput !== 'string') return homebrewOutput;
|
|
244
|
+
const formulaOutput = probe([manager.path, '--prefix', 'agent-infra'], options, platform, 'brew --prefix agent-infra');
|
|
245
|
+
if (typeof formulaOutput !== 'string') return formulaOutput;
|
|
246
|
+
const homebrewRoot = canonicalPath(homebrewOutput);
|
|
247
|
+
const formulaRoot = canonicalPath(formulaOutput);
|
|
248
|
+
if (!homebrewRoot || !formulaRoot) return { error: 'Homebrew prefix is not an existing directory.' };
|
|
249
|
+
if (!isWithin(homebrewRoot, manager.path, platform)) {
|
|
250
|
+
return { error: `brew manager ${manager.path} is outside Homebrew prefix ${homebrewRoot}.` };
|
|
251
|
+
}
|
|
252
|
+
if (!isWithin(homebrewRoot, formulaRoot, platform)) {
|
|
253
|
+
return { error: `agent-infra formula prefix ${formulaRoot} is outside Homebrew prefix ${homebrewRoot}.` };
|
|
254
|
+
}
|
|
255
|
+
if (!isWithin(formulaRoot, packageInfo.root, platform)) {
|
|
256
|
+
return { error: `Current CLI package is outside agent-infra formula prefix ${formulaRoot}.` };
|
|
257
|
+
}
|
|
258
|
+
if (packageInfo.name !== '@fitlab-ai/agent-infra') {
|
|
259
|
+
return { error: `Unexpected package name at ${packageInfo.root}: ${packageInfo.name}.` };
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
kind: 'brew',
|
|
263
|
+
managerPath: manager.path,
|
|
264
|
+
packageRoot: packageInfo.root,
|
|
265
|
+
updateArgs: ['upgrade', 'agent-infra']
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function detectUpdateSource(options: SelfUpdateOptions = {}): UpdateSourceResult {
|
|
270
|
+
const platform = options.platform ?? process.platform;
|
|
271
|
+
const env = options.env ?? process.env;
|
|
272
|
+
const entry = options.argv?.[1] ?? process.argv[1];
|
|
273
|
+
if (!entry) return { source: null, error: 'Cannot determine the running CLI entry.' };
|
|
274
|
+
const packageInfo = findPackageInfo(entry, platform);
|
|
275
|
+
if (!packageInfo || packageInfo.name !== '@fitlab-ai/agent-infra') {
|
|
276
|
+
return { source: null, error: 'Running CLI is not a persistent @fitlab-ai/agent-infra package installation.' };
|
|
277
|
+
}
|
|
278
|
+
const aliasError = visibleAliasError(packageInfo.root, platform, env);
|
|
279
|
+
if (aliasError) return { source: null, error: aliasError };
|
|
280
|
+
|
|
281
|
+
const candidates: UpdateSource[] = [];
|
|
282
|
+
const errors: string[] = [];
|
|
283
|
+
for (const candidate of [
|
|
284
|
+
npmSource(packageInfo, options, platform, env),
|
|
285
|
+
brewSource(packageInfo, options, platform, env)
|
|
286
|
+
]) {
|
|
287
|
+
if (!candidate) continue;
|
|
288
|
+
if ('error' in candidate) errors.push(candidate.error);
|
|
289
|
+
else candidates.push(candidate);
|
|
290
|
+
}
|
|
291
|
+
if (candidates.length === 1) {
|
|
292
|
+
const [source] = candidates;
|
|
293
|
+
if (source) return { source };
|
|
294
|
+
}
|
|
295
|
+
if (candidates.length > 1) return { source: null, error: 'Multiple package managers claim the running CLI; refusing to choose.' };
|
|
296
|
+
return {
|
|
297
|
+
source: null,
|
|
298
|
+
error: errors.length > 0
|
|
299
|
+
? errors.join(' ')
|
|
300
|
+
: 'No supported persistent npm or Homebrew installation owns the running CLI.'
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function managerStable(source: UpdateSource, platform: NodeJS.Platform): boolean {
|
|
305
|
+
const current = canonicalPath(source.managerPath);
|
|
306
|
+
return current !== null && samePath(current, source.managerPath, platform);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export async function cmdUpdate(options: SelfUpdateOptions = {}): Promise<number> {
|
|
310
|
+
const platform = options.platform ?? process.platform;
|
|
311
|
+
const detected = detectUpdateSource(options);
|
|
312
|
+
if (!detected.source) {
|
|
313
|
+
err(`Cannot update agent-infra CLI: ${detected.error ?? 'unknown source'}`);
|
|
314
|
+
err('Install persistently with "npm install -g @fitlab-ai/agent-infra" or "brew install fitlab-ai/tap/agent-infra".');
|
|
315
|
+
return 1;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const source = detected.source;
|
|
319
|
+
if (!managerStable(source, platform)) {
|
|
320
|
+
err(`Cannot update agent-infra CLI: manager path changed: ${source.managerPath}.`);
|
|
321
|
+
return 1;
|
|
322
|
+
}
|
|
323
|
+
info(`Updating agent-infra CLI via ${source.kind}.`);
|
|
324
|
+
const result = runCommand([source.managerPath, ...source.updateArgs], options, platform);
|
|
325
|
+
if (result.error) {
|
|
326
|
+
err(`agent-infra CLI update failed: ${result.error.message}`);
|
|
327
|
+
return 1;
|
|
328
|
+
}
|
|
329
|
+
if (result.signal) {
|
|
330
|
+
err(`agent-infra CLI update terminated by ${result.signal}.`);
|
|
331
|
+
return 1;
|
|
332
|
+
}
|
|
333
|
+
if (result.status !== 0) {
|
|
334
|
+
err(`agent-infra CLI update failed with exit code ${result.status ?? 1}.`);
|
|
335
|
+
const detail = result.stderr?.trim();
|
|
336
|
+
if (detail) err(detail);
|
|
337
|
+
return result.status && result.status > 0 ? result.status : 1;
|
|
338
|
+
}
|
|
339
|
+
ok('agent-infra CLI updated successfully!');
|
|
340
|
+
return 0;
|
|
341
|
+
}
|
|
@@ -85,8 +85,8 @@ export function isProcessAlive(pid: number, platform: NodeJS.Platform = process.
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
function parseDarwinStartTime(output: string): number | null {
|
|
89
|
-
const match = output.trim().match(/^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat) ([A-Z][a-z]{2})
|
|
88
|
+
export function parseDarwinStartTime(output: string): number | null {
|
|
89
|
+
const match = output.trim().match(/^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat) ([A-Z][a-z]{2})\s+(\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/);
|
|
90
90
|
if (!match) return null;
|
|
91
91
|
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
92
92
|
const month = months.indexOf(match[1]!);
|
package/lib/server/protocol.ts
CHANGED
|
@@ -31,16 +31,16 @@ export function commandHelp(): string {
|
|
|
31
31
|
'/sandbox ls',
|
|
32
32
|
'/sandbox show {ref}',
|
|
33
33
|
'/sandbox vm status',
|
|
34
|
-
'/task decisions [--task {ref}] [--item {selector}]',
|
|
35
|
-
'/task log [--task {ref}]',
|
|
34
|
+
'/task decisions [--task {ref} | -t {ref}] [--item {selector} | -i {selector}]',
|
|
35
|
+
'/task log [--task {ref} | -t {ref}]',
|
|
36
36
|
'/task ls',
|
|
37
|
-
'/task show [--task {ref}]',
|
|
38
|
-
'/task status [--task {ref}]',
|
|
37
|
+
'/task show [--task {ref} | -t {ref}]',
|
|
38
|
+
'/task status [--task {ref} | -t {ref}]',
|
|
39
39
|
'Write:',
|
|
40
40
|
'/sandbox create {ref}',
|
|
41
41
|
'/sandbox start {ref}',
|
|
42
42
|
'Exec:',
|
|
43
|
-
'/decide [--task {ref}] --item {ordinal|ledger-id} [--needs-implementation true|false] {decision}',
|
|
43
|
+
'/decide [--task {ref} | -t {ref}] (--item {ordinal|ledger-id} | -i {ordinal|ledger-id}) [--needs-implementation true|false] {decision}',
|
|
44
44
|
'/run create-task {description}',
|
|
45
45
|
'/run {skill} {task-ref}'
|
|
46
46
|
].join('\n');
|
package/lib/task/activity-log.ts
CHANGED
|
@@ -89,6 +89,10 @@ function pairEntries(entries: LogEntry[]): StepRow[] {
|
|
|
89
89
|
return rows;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
function startedBackedRows(rows: StepRow[]): StepRow[] {
|
|
93
|
+
return rows.filter((row) => row.started !== '');
|
|
94
|
+
}
|
|
95
|
+
|
|
92
96
|
export {
|
|
93
97
|
activityAttempt,
|
|
94
98
|
appendActivityEntry,
|
|
@@ -96,6 +100,7 @@ export {
|
|
|
96
100
|
locateActivityLog,
|
|
97
101
|
pairEntries,
|
|
98
102
|
parseActivityLog,
|
|
99
|
-
parseCommitAttemptStarted
|
|
103
|
+
parseCommitAttemptStarted,
|
|
104
|
+
startedBackedRows
|
|
100
105
|
};
|
|
101
106
|
export type { ActivityLogSection, CommitAttempt, LogEntry, StepRow };
|
|
@@ -46,7 +46,8 @@ type ArtifactErrorCode =
|
|
|
46
46
|
| 'ARTIFACT_TOPOLOGY_CONFLICT' | 'ARTIFACT_INPUT_MISSING'
|
|
47
47
|
| 'ARTIFACT_REFERENCE_INVALID' | 'ARTIFACT_PATH_INVALID'
|
|
48
48
|
| 'ARTIFACT_IDENTITY_INVALID' | 'ARTIFACT_NOT_FOUND'
|
|
49
|
-
| 'ARTIFACT_NOT_REGULAR' | 'ARTIFACT_NOT_READABLE' | '
|
|
49
|
+
| 'ARTIFACT_NOT_REGULAR' | 'ARTIFACT_NOT_READABLE' | 'ARTIFACT_VERDICT_INVALID'
|
|
50
|
+
| 'ARTIFACT_MODE_REFUSED';
|
|
50
51
|
type ArtifactError = { code: ArtifactErrorCode; message: string };
|
|
51
52
|
type ArtifactInventoryResult = {
|
|
52
53
|
status: 'ready' | 'failed';
|
|
@@ -357,7 +358,7 @@ function resolveCodeContext(inventory: ArtifactInventoryResult, options: Inspect
|
|
|
357
358
|
return contextFailure(inventory, 'ARTIFACT_INPUT_MISSING', `latest plan '${plan.latest.name}' requires a matching approved review-plan`);
|
|
358
359
|
}
|
|
359
360
|
const verdict = parseVerdict(reviewPlan.latest.path);
|
|
360
|
-
if (!verdict.ok) return contextFailure(inventory, '
|
|
361
|
+
if (!verdict.ok) return contextFailure(inventory, 'ARTIFACT_VERDICT_INVALID', `${verdict.code}: ${verdict.message}`, reviewPlan.latest.name);
|
|
361
362
|
if (verdict.verdict !== 'Approved') {
|
|
362
363
|
return contextFailure(inventory, 'ARTIFACT_REFERENCE_INVALID', `latest ${reviewPlan.latest.name} is not approved`, reviewPlan.latest.name);
|
|
363
364
|
}
|
|
@@ -373,6 +374,7 @@ function resolveCodeContext(inventory: ArtifactInventoryResult, options: Inspect
|
|
|
373
374
|
}
|
|
374
375
|
if (reviewPlan.latest && reviewPlan.reviewedInput?.name === plan.latest.name) {
|
|
375
376
|
const verdict = parseVerdict(reviewPlan.latest.path);
|
|
377
|
+
if (!verdict.ok) return contextFailure(inventory, 'ARTIFACT_VERDICT_INVALID', `${verdict.code}: ${verdict.message}`, reviewPlan.latest.name);
|
|
376
378
|
const reviewedPlanSha256 = sha256File(reviewPlan.reviewedInput.path);
|
|
377
379
|
if (verdict.ok && verdict.verdict === 'Approved' && (
|
|
378
380
|
codePlanInput.input.name !== plan.latest.name || codePlanInput.inputSha256 !== reviewedPlanSha256
|
|
@@ -388,7 +390,7 @@ function resolveCodeContext(inventory: ArtifactInventoryResult, options: Inspect
|
|
|
388
390
|
const review = reviewCode.latest;
|
|
389
391
|
if (!review) return contextFailure(inventory, 'ARTIFACT_INPUT_MISSING', 'latest review-code artifact is required');
|
|
390
392
|
const verdict = parseVerdict(review.path);
|
|
391
|
-
if (!verdict.ok) return contextFailure(inventory, '
|
|
393
|
+
if (!verdict.ok) return contextFailure(inventory, 'ARTIFACT_VERDICT_INVALID', `${verdict.code}: ${verdict.message}`, review.name);
|
|
392
394
|
if (verdict.verdict === 'Approved') {
|
|
393
395
|
const decision = resolveDecisionImplementationInput(inventory, review);
|
|
394
396
|
if ('error' in decision) return contextFailure(inventory, 'ARTIFACT_REFERENCE_INVALID', decision.error, review.name);
|
|
@@ -480,9 +482,9 @@ function buildArtifactLinkSection(content: string, artifact: ArtifactIdentity):
|
|
|
480
482
|
const label = english
|
|
481
483
|
? `${spec.labels[1]} (Round ${artifact.round})`
|
|
482
484
|
: `${spec.labels[0]}(Round ${artifact.round})`;
|
|
483
|
-
const link =
|
|
485
|
+
const link = `${label}:\`${artifact.name}\``;
|
|
484
486
|
let body = extractSection(content, aliases);
|
|
485
|
-
if (body.includes(
|
|
487
|
+
if (body.includes(link)) return { aliases, heading, body };
|
|
486
488
|
const placeholders = new Set([
|
|
487
489
|
'[分析阶段的发现。哪些文件受影响?范围是什么?]',
|
|
488
490
|
'[Findings from the analysis phase. Which files are affected? What is the scope?]',
|
|
@@ -45,6 +45,7 @@ type CodexBridgeOptions = Readonly<{
|
|
|
45
45
|
capabilityStore?: CapabilityStore;
|
|
46
46
|
buildIdentity?: LifecycleBuildIdentity;
|
|
47
47
|
orchestrationOptions?: OrchestrationOptions;
|
|
48
|
+
controllerBinding?: Readonly<{ instanceDigest: string; controlGeneration: string }>;
|
|
48
49
|
}>;
|
|
49
50
|
|
|
50
51
|
type CodexSpawnIdentity = Readonly<{
|
|
@@ -142,7 +143,7 @@ async function prepareCodexOrchestrationDelegation(
|
|
|
142
143
|
);
|
|
143
144
|
}
|
|
144
145
|
const buildIdentity = options.buildIdentity ?? computeLifecycleBuildIdentity(repoRoot);
|
|
145
|
-
const brokerController = brokerControllerBinding();
|
|
146
|
+
const brokerController = options.controllerBinding ?? brokerControllerBinding();
|
|
146
147
|
const contextPath = process.env.AGENT_INFRA_CODEX_CONTROLLER_CONTEXT;
|
|
147
148
|
const contextVerification = contextPath
|
|
148
149
|
? (brokerController
|
|
@@ -15,8 +15,7 @@ function parseTaskScope(args: string[]): TaskScope {
|
|
|
15
15
|
value = args[++index];
|
|
16
16
|
if (value === undefined || value === '' || value.startsWith('-')) throw new Error(`${arg} requires a value`);
|
|
17
17
|
} else if (arg.startsWith('--task=')) {
|
|
18
|
-
|
|
19
|
-
if (value === '') throw new Error('--task requires a value');
|
|
18
|
+
throw new Error("--task=... is not supported; use --task <ref> or -t <ref>");
|
|
20
19
|
} else {
|
|
21
20
|
positionals.push(arg);
|
|
22
21
|
continue;
|
package/lib/task/commands/cat.ts
CHANGED
|
@@ -5,11 +5,9 @@ import { resolveArtifact } from '../artifacts.ts';
|
|
|
5
5
|
|
|
6
6
|
const USAGE = `Usage: ai task cat <artifact | N>
|
|
7
7
|
ai task cat (--task <ref> | -t <ref>) <artifact | N>
|
|
8
|
-
ai task cat <ref> <artifact | N>
|
|
9
8
|
|
|
10
9
|
Prints a task artifact's raw content to stdout.
|
|
11
10
|
One positional Uses current task context and treats the operand as the artifact.
|
|
12
|
-
<ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
13
11
|
<artifact | N> Artifact filename (with or without '.md'), or the number from 'ai task files'.
|
|
14
12
|
`;
|
|
15
13
|
|
|
@@ -29,8 +27,6 @@ function cat(args: string[] = []): void {
|
|
|
29
27
|
taskRef = scope.taskRef; artifact = scope.positionals[0];
|
|
30
28
|
} else if (scope.positionals.length === 1) {
|
|
31
29
|
artifact = scope.positionals[0];
|
|
32
|
-
} else if (scope.positionals.length === 2) {
|
|
33
|
-
[taskRef, artifact] = scope.positionals;
|
|
34
30
|
} else { process.stdout.write(USAGE); process.exitCode = 1; return; }
|
|
35
31
|
const resolved = resolveTaskContext(taskRef);
|
|
36
32
|
if (!resolved.ok) {
|