@fitlab-ai/agent-infra 0.9.14 → 0.10.0
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 +10 -0
- package/README.zh-CN.md +10 -0
- package/bin/internal-cli.sh +45 -0
- package/dist/bin/internal-cli.js +93 -30
- package/dist/lib/agent-clients/adapters/codex-lifecycle/capability-store.js +165 -27
- package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +9 -4
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +43 -3
- package/dist/lib/defaults.json +103 -103
- package/dist/lib/fs/durable-write.js +39 -0
- package/dist/lib/fs/file-lock.js +111 -0
- package/dist/lib/host-control/audit.js +19 -0
- package/dist/lib/host-control/client.js +142 -0
- package/dist/lib/host-control/command.js +49 -0
- package/dist/lib/host-control/path.js +160 -0
- package/dist/lib/host-control/secure-fs.js +140 -0
- package/dist/lib/host-control/server.js +159 -0
- package/dist/lib/host-control/service.js +112 -0
- package/dist/lib/init.js +11 -2
- package/dist/lib/internal/cli-route-inventory.js +4 -2
- package/dist/lib/internal/codex-lifecycle.js +6 -6
- package/dist/lib/internal/demo-promotion.js +322 -0
- package/dist/lib/internal/demo-transcript.js +454 -0
- package/dist/lib/internal/host-control.js +28 -0
- package/dist/lib/internal/manual-validation.js +331 -0
- package/dist/lib/internal/platform-pr.js +18 -4
- package/dist/lib/internal/release-workflow.js +63 -84
- package/dist/lib/internal/sandbox-control.js +149 -2
- package/dist/lib/internal/task-artifact.js +16 -263
- package/dist/lib/internal/task-create.js +6 -5
- package/dist/lib/internal/task-event.js +37 -37
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-operation-registry.js +101 -4
- package/dist/lib/internal/task-review.js +11 -56
- package/dist/lib/internal/task-validate.js +30 -10
- package/dist/lib/owned-path.js +33 -0
- package/dist/lib/platform/check-status.js +11 -0
- package/dist/lib/platform/comment-safety.js +4 -1
- package/dist/lib/platform/completion-backfill.js +1 -1
- package/dist/lib/platform/github-data.js +241 -0
- package/dist/lib/platform/github-provider.js +15 -20
- package/dist/lib/platform/issue-comments.js +18 -12
- package/dist/lib/platform/issues.js +2 -180
- package/dist/lib/platform/pr-change-report.js +5 -4
- package/dist/lib/platform/pr-checks.js +12 -65
- package/dist/lib/platform/pr-summary.js +117 -33
- package/dist/lib/platform/pull-requests.js +5 -108
- package/dist/lib/platform/snapshots.js +2 -0
- package/dist/lib/platform/task-identities.js +2 -9
- package/dist/lib/platform/verification-sync.js +132 -143
- package/dist/lib/pr-review/evidence-grading.js +4 -8
- package/dist/lib/release/workflow.js +1 -1
- package/dist/lib/sandbox/commands/create.js +7 -2
- package/dist/lib/sandbox/commands/rm.js +19 -1511
- package/dist/lib/sandbox/control/audit.js +203 -0
- package/dist/lib/sandbox/control/client.js +93 -54
- package/dist/lib/sandbox/control/executor.js +129 -65
- package/dist/lib/sandbox/control/finalization-response.js +27 -0
- package/dist/lib/sandbox/control/identity-sentinel.js +107 -0
- package/dist/lib/sandbox/control/lifecycle.js +36 -2
- package/dist/lib/sandbox/control/native-file-lock.js +6 -98
- package/dist/lib/sandbox/control/protocol.js +55 -4
- package/dist/lib/sandbox/control/server.js +518 -127
- package/dist/lib/sandbox/control/state.js +64 -0
- package/dist/lib/sandbox/control/task-workflow.js +74 -0
- package/dist/lib/sandbox/control/workflow-executor.js +89 -0
- package/dist/lib/sandbox/index.js +1 -2
- package/dist/lib/sandbox/recovery.js +28 -4
- package/dist/lib/sandbox/removal.js +822 -0
- package/dist/lib/sandbox/task-cleanup.js +217 -0
- package/dist/lib/sandbox/workspace-identity.js +17 -1
- package/dist/lib/sandbox/workspace-view.js +13 -14
- package/dist/lib/task/activity-intent.js +2 -1
- package/dist/lib/task/activity-log.js +30 -24
- package/dist/lib/task/artifact-command.js +79 -0
- package/dist/lib/task/artifact-lifecycle.js +30 -28
- package/dist/lib/task/artifact-name.js +36 -0
- package/dist/lib/task/artifact-operations.js +29 -289
- package/dist/lib/task/artifact-receipts.js +3 -15
- package/dist/lib/task/artifact-recovery.js +430 -0
- package/dist/lib/task/artifact-repair-intent.js +134 -29
- package/dist/lib/task/artifact-schema.js +6 -14
- package/dist/lib/task/capabilities.js +12 -19
- package/dist/lib/task/codex-orchestration.js +71 -25
- package/dist/lib/task/commit-identity.js +28 -0
- package/dist/lib/task/commit-operation.js +33 -20
- package/dist/lib/task/control-authority.js +403 -6
- package/dist/lib/task/control-recovery.js +140 -0
- package/dist/lib/task/create-service.js +1 -8
- package/dist/lib/task/create.js +62 -9
- package/dist/lib/task/decision-details.js +2 -46
- package/dist/lib/task/delegation-receipts.js +64 -3
- package/dist/lib/task/events.js +275 -22
- package/dist/lib/task/finalization-state.js +9 -0
- package/dist/lib/task/human-override.js +8 -14
- package/dist/lib/task/implementation-inputs.js +3 -3
- package/dist/lib/task/intermediate-cleanup.js +441 -0
- package/dist/lib/task/invalidation.js +18 -65
- package/dist/lib/task/ledger-intents.js +7 -22
- package/dist/lib/task/ledger.js +1 -3
- package/dist/lib/task/lifecycle-recovery.js +549 -0
- package/dist/lib/task/lifecycle.js +31 -4
- package/dist/lib/task/local-artifact-finalization.js +197 -197
- package/dist/lib/task/manual-validation-completion.js +26 -0
- package/dist/lib/task/manual-validation-evidence.js +130 -0
- package/dist/lib/task/manual-validation-receipt.js +105 -0
- package/dist/lib/task/manual-validation-shared.js +40 -0
- package/dist/lib/task/manual-validation-transaction.js +243 -0
- package/dist/lib/task/markdown.js +47 -0
- package/dist/lib/task/orchestration.js +66 -19
- package/dist/lib/task/pr-delivery-fact.js +12 -56
- package/dist/lib/task/qualification-audit.js +20 -34
- package/dist/lib/task/recovery-warning.js +19 -0
- package/dist/lib/task/review-artifacts.js +2 -18
- package/dist/lib/task/review-command.js +26 -0
- package/dist/lib/task/review-finalization.js +175 -216
- package/dist/lib/task/review-fingerprint.js +2 -2
- package/dist/lib/task/sections.js +34 -56
- package/dist/lib/task/short-id.js +15 -7
- package/dist/lib/task/task-execution-lock.js +1 -1
- package/dist/lib/task/verification-engine.js +119 -337
- package/dist/lib/task/verification.js +1 -1
- package/dist/lib/task/workflow-command.js +16 -0
- package/dist/lib/task/workflow-warning-intents.js +0 -16
- package/dist/lib/task/workflow-warnings.js +28 -2
- package/dist/lib/update.js +2 -0
- package/dist/lib/version.js +1 -11
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/adapters/codex-lifecycle/capability-store.ts +223 -33
- package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +10 -4
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +55 -3
- package/lib/fs/durable-write.ts +30 -0
- package/lib/fs/file-lock.ts +113 -0
- package/lib/host-control/audit.ts +22 -0
- package/lib/host-control/client.ts +172 -0
- package/lib/host-control/command.ts +60 -0
- package/lib/host-control/path.ts +167 -0
- package/lib/host-control/secure-fs.ts +135 -0
- package/lib/host-control/server.ts +180 -0
- package/lib/host-control/service.ts +133 -0
- package/lib/init.ts +15 -2
- package/lib/internal/cli-route-inventory.ts +4 -2
- package/lib/internal/codex-lifecycle.ts +6 -6
- package/lib/internal/demo-promotion.ts +354 -0
- package/lib/internal/demo-transcript.ts +419 -0
- package/lib/internal/host-control.ts +28 -0
- package/lib/internal/manual-validation.ts +315 -0
- package/lib/internal/platform-pr.ts +15 -4
- package/lib/internal/release-workflow.ts +74 -82
- package/lib/internal/sandbox-control.ts +162 -1
- package/lib/internal/task-artifact.ts +14 -217
- package/lib/internal/task-create.ts +5 -5
- package/lib/internal/task-event.ts +20 -11
- package/lib/internal/task-lifecycle.ts +4 -3
- package/lib/internal/task-operation-registry.ts +111 -4
- package/lib/internal/task-review.ts +9 -54
- package/lib/internal/task-validate.ts +26 -10
- package/lib/owned-path.ts +26 -0
- package/lib/platform/check-status.ts +9 -0
- package/lib/platform/comment-safety.ts +5 -0
- package/lib/platform/completion-backfill.ts +1 -1
- package/lib/platform/github-data.ts +322 -0
- package/lib/platform/github-provider.ts +15 -20
- package/lib/platform/issue-comments.ts +21 -14
- package/lib/platform/issues.ts +5 -246
- package/lib/platform/pr-change-report.ts +7 -5
- package/lib/platform/pr-checks.ts +13 -77
- package/lib/platform/pr-summary.ts +123 -35
- package/lib/platform/pull-requests.ts +6 -173
- package/lib/platform/snapshots.ts +53 -0
- package/lib/platform/task-identities.ts +3 -14
- package/lib/platform/verification-sync.ts +150 -156
- package/lib/pr-review/evidence-grading.ts +4 -9
- package/lib/release/workflow.ts +3 -3
- package/lib/sandbox/commands/create.ts +7 -6
- package/lib/sandbox/commands/rm.ts +21 -1895
- package/lib/sandbox/control/audit.ts +253 -0
- package/lib/sandbox/control/client.ts +109 -66
- package/lib/sandbox/control/executor.ts +134 -74
- package/lib/sandbox/control/finalization-response.ts +29 -0
- package/lib/sandbox/control/identity-sentinel.ts +137 -0
- package/lib/sandbox/control/lifecycle.ts +45 -3
- package/lib/sandbox/control/native-file-lock.ts +6 -107
- package/lib/sandbox/control/protocol.ts +80 -6
- package/lib/sandbox/control/server.ts +567 -132
- package/lib/sandbox/control/state.ts +86 -0
- package/lib/sandbox/control/task-workflow.ts +95 -0
- package/lib/sandbox/control/workflow-executor.ts +92 -0
- package/lib/sandbox/index.ts +1 -2
- package/lib/sandbox/recovery.ts +28 -5
- package/lib/sandbox/removal.ts +1142 -0
- package/lib/sandbox/task-cleanup.ts +209 -0
- package/lib/sandbox/workspace-identity.ts +19 -3
- package/lib/sandbox/workspace-view.ts +17 -15
- package/lib/task/activity-intent.ts +2 -2
- package/lib/task/activity-log.ts +27 -19
- package/lib/task/artifact-command.ts +85 -0
- package/lib/task/artifact-lifecycle.ts +31 -26
- package/lib/task/artifact-name.ts +55 -0
- package/lib/task/artifact-operations.ts +34 -310
- package/lib/task/artifact-receipts.ts +3 -14
- package/lib/task/artifact-recovery.ts +519 -0
- package/lib/task/artifact-repair-intent.ts +162 -33
- package/lib/task/artifact-schema.ts +5 -34
- package/lib/task/capabilities.ts +13 -22
- package/lib/task/codex-orchestration.ts +85 -24
- package/lib/task/commit-identity.ts +31 -0
- package/lib/task/commit-operation.ts +37 -20
- package/lib/task/control-authority.ts +540 -10
- package/lib/task/control-recovery.ts +186 -0
- package/lib/task/create-service.ts +1 -10
- package/lib/task/create.ts +63 -8
- package/lib/task/decision-details.ts +3 -71
- package/lib/task/delegation-receipts.ts +73 -2
- package/lib/task/events.ts +309 -24
- package/lib/task/finalization-state.ts +11 -0
- package/lib/task/human-override.ts +8 -16
- package/lib/task/implementation-inputs.ts +3 -3
- package/lib/task/intermediate-cleanup.ts +493 -0
- package/lib/task/invalidation.ts +18 -62
- package/lib/task/ledger-intents.ts +7 -24
- package/lib/task/ledger.ts +1 -3
- package/lib/task/lifecycle-recovery.ts +691 -0
- package/lib/task/lifecycle.ts +30 -5
- package/lib/task/local-artifact-finalization.ts +244 -234
- package/lib/task/manual-validation-completion.ts +40 -0
- package/lib/task/manual-validation-evidence.ts +209 -0
- package/lib/task/manual-validation-receipt.ts +156 -0
- package/lib/task/manual-validation-shared.ts +50 -0
- package/lib/task/manual-validation-transaction.ts +304 -0
- package/lib/task/markdown.ts +70 -0
- package/lib/task/orchestration.ts +84 -19
- package/lib/task/pr-delivery-fact.ts +15 -62
- package/lib/task/qualification-audit.ts +22 -33
- package/lib/task/recovery-warning.ts +21 -0
- package/lib/task/review-artifacts.ts +1 -20
- package/lib/task/review-command.ts +24 -0
- package/lib/task/review-finalization.ts +183 -292
- package/lib/task/review-fingerprint.ts +2 -2
- package/lib/task/sections.ts +33 -54
- package/lib/task/short-id.ts +27 -5
- package/lib/task/task-execution-lock.ts +1 -1
- package/lib/task/verification-engine.ts +113 -383
- package/lib/task/verification-types.ts +15 -0
- package/lib/task/verification.ts +1 -1
- package/lib/task/workflow-command.ts +17 -0
- package/lib/task/workflow-warning-intents.ts +0 -13
- package/lib/task/workflow-warnings.ts +21 -2
- package/lib/update.ts +6 -0
- package/lib/version.ts +1 -15
- package/package.json +6 -6
- package/templates/.agents/hooks/lifecycle-delegation.js +6 -6
- package/templates/.agents/rules/create-issue.en.md +1 -1
- package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +4 -2
- package/templates/.agents/rules/issue-sync.zh-CN.md +4 -3
- package/templates/.agents/rules/local-artifact-repair.en.md +46 -39
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +43 -36
- package/templates/.agents/rules/testing-discipline.en.md +2 -0
- package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -0
- package/templates/.agents/scripts/package.json +3 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +6 -6
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/analyze-task/config/verify.en.json +1 -1
- package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -1
- 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/block-task/config/verify.json +1 -1
- package/templates/.agents/skills/cancel-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/cancel-task/config/verify.json +1 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +7 -7
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +7 -7
- package/templates/.agents/skills/code-task/config/verify.en.json +1 -1
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +33 -21
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +33 -21
- 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/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 +16 -7
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +16 -7
- package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/complete-task/config/verify.en.json +2 -2
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +2 -2
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +1 -1
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/create-pr/config/verify.json +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +2 -2
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +2 -2
- package/templates/.agents/skills/create-task/SKILL.en.md +5 -5
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/create-task/config/verify.json +1 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +8 -8
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +8 -8
- package/templates/.agents/skills/import-issue/config/verify.json +2 -2
- package/templates/.agents/skills/plan-task/SKILL.en.md +4 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/plan-task/config/verify.en.json +1 -1
- package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/release/SKILL.en.md +7 -3
- package/templates/.agents/skills/release/SKILL.zh-CN.md +7 -3
- package/templates/.agents/skills/restore-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/restore-task/config/verify.json +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +7 -7
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +6 -6
- package/templates/.agents/skills/review-code/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-code/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-code/reference/report-template.en.md +12 -12
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +12 -12
- package/templates/.agents/skills/review-plan/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +7 -7
- package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +7 -7
- package/templates/.agents/skills/review-pr/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +3 -3
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +3 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +20 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +20 -3
- package/templates/.agents/skills/run-manual-validation/config/verify.en.json +1 -1
- package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +4 -1
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +4 -1
- package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -0
- package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/test/SKILL.en.md +17 -6
- package/templates/.agents/skills/test/SKILL.zh-CN.md +17 -6
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.claude/commands/import-issue.en.md +1 -1
- package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/restore-task.en.md +1 -1
- package/templates/.claude/commands/restore-task.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/dist/lib/platform/adapters.js +0 -56
- package/lib/platform/adapters.ts +0 -197
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import type fs from 'node:fs';
|
|
2
|
+
|
|
3
|
+
export type VerificationShared = {
|
|
4
|
+
repoRoot: string;
|
|
5
|
+
loadTask: (taskDir: string) => { ok: true; content: string; metadata: Record<string, string> } | { ok: false; message: string };
|
|
6
|
+
getCheckedRequirements: (content: string) => string[];
|
|
7
|
+
normalizeContent: (text: unknown) => string;
|
|
8
|
+
isBlank: (value: unknown) => boolean;
|
|
9
|
+
escapeRegExp: (value: string) => string;
|
|
10
|
+
passResult: (type: string, message: string, warnings?: string[]) => VerificationCheckResult;
|
|
11
|
+
failResult: (type: string, message: string, failType?: string) => VerificationCheckResult;
|
|
12
|
+
blockedResult: (type: string, message: string, failType?: string) => VerificationCheckResult;
|
|
13
|
+
safeStat: (filePath: string) => fs.Stats | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
1
16
|
type VerificationStatus = 'pass' | 'fail' | 'blocked';
|
|
2
17
|
type VerificationCheckResult = {
|
|
3
18
|
type: string;
|
package/lib/task/verification.ts
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
// checks are provided by typed domain modules without a stdout protocol.
|
|
4
4
|
import { verifyInProcess } from './verification-engine.ts';
|
|
5
5
|
|
|
6
|
-
import { parseArtifactName } from './artifact-
|
|
6
|
+
import { parseArtifactName } from './artifact-name.ts';
|
|
7
7
|
import type { ArtifactFamily } from './artifact-lifecycle.ts';
|
|
8
8
|
import { resolveTaskRef } from './resolve-ref.ts';
|
|
9
9
|
import type { TaskWorkspaceState } from './resolve-ref.ts';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const TASK_WORKFLOW_COMMANDS = Object.freeze({
|
|
2
|
+
'artifact-inspect': ['task-artifact', 'inspect'],
|
|
3
|
+
'artifact-init': ['task-artifact', 'init'],
|
|
4
|
+
'artifact-finalize-local': ['task-artifact', 'finalize-local'],
|
|
5
|
+
'review-finalize-summary': ['task-review', 'finalize-summary'],
|
|
6
|
+
event: ['task-event', null],
|
|
7
|
+
'ledger-finding-response': ['task-ledger', 'finding-respond'],
|
|
8
|
+
'ledger-finding-review': ['task-ledger', 'finding-review'],
|
|
9
|
+
'ledger-finding-upsert': ['task-ledger', 'finding-upsert'],
|
|
10
|
+
'decision-next-id': ['task-ledger', 'decision-next-id'],
|
|
11
|
+
'decision-upsert': ['task-ledger', 'decision-upsert'],
|
|
12
|
+
'invalidation-reconcile': ['task-invalidation', 'reconcile'],
|
|
13
|
+
'warning-add': ['task-warning', 'add']
|
|
14
|
+
} as const);
|
|
15
|
+
export type TaskWorkflowOperation = keyof typeof TASK_WORKFLOW_COMMANDS;
|
|
16
|
+
export const TASK_WORKFLOW_OPERATIONS = Object.freeze(Object.keys(TASK_WORKFLOW_COMMANDS) as TaskWorkflowOperation[]);
|
|
17
|
+
export type WorkflowCommand = typeof TASK_WORKFLOW_COMMANDS[TaskWorkflowOperation][0];
|
|
@@ -52,17 +52,6 @@ function nextWarningId(rows: readonly WorkflowWarning[]): string {
|
|
|
52
52
|
return `WW-${max + 1}`;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
function validateRows(rows: readonly WorkflowWarning[]): { code: string; message: string } | null {
|
|
56
|
-
const ids = new Set<string>();
|
|
57
|
-
for (const row of rows) {
|
|
58
|
-
if (!/^WW-[1-9]\d*$/.test(row.id)) return { code: 'WARNING_ID_INVALID', message: `warning id '${row.id}' is invalid` };
|
|
59
|
-
if (ids.has(row.id)) return { code: 'WARNING_DUPLICATE_ID', message: `duplicate warning id '${row.id}'` };
|
|
60
|
-
ids.add(row.id);
|
|
61
|
-
if (!WORKFLOW_WARNING_SEVERITIES.has(row.severity) || !WORKFLOW_WARNING_STATUSES.has(row.status)) return { code: 'WARNING_DOCUMENT_INVALID', message: `warning '${row.id}' has invalid severity or status` };
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
55
|
function sectionMutation(content: string): TaskMutation[] {
|
|
67
56
|
if (/^##\s+(工作流告警|Workflow Warnings)\s*$/m.test(content)) return [];
|
|
68
57
|
const english = /^##\s+Activity Log\s*$/m.test(content);
|
|
@@ -98,8 +87,6 @@ function applyWorkflowWarningIntent(intent: WorkflowWarningIntent, options: Task
|
|
|
98
87
|
const code = error && typeof error === 'object' && 'code' in error ? String(error.code) : 'WARNING_DOCUMENT_INVALID';
|
|
99
88
|
return failed(intent, code, error instanceof Error ? error.message : String(error), resolved.taskId);
|
|
100
89
|
}
|
|
101
|
-
const invalid = validateRows(rows);
|
|
102
|
-
if (invalid) return failed(intent, invalid.code, invalid.message, resolved.taskId);
|
|
103
90
|
if (intent.kind === 'list') {
|
|
104
91
|
if (intent.status && !WORKFLOW_WARNING_STATUSES.has(intent.status)) return failed(intent, 'WARNING_PAYLOAD_INVALID', 'warning status is invalid', resolved.taskId);
|
|
105
92
|
const warnings = rows.filter((row) => !intent.status || row.status === intent.status);
|
|
@@ -4,6 +4,7 @@ const WORKFLOW_WARNING_HEADINGS = ['工作流告警', 'Workflow Warnings'];
|
|
|
4
4
|
const WORKFLOW_WARNING_STATUSES = new Set(['open', 'resolved', 'ignored']);
|
|
5
5
|
const WORKFLOW_WARNING_SEVERITIES = new Set(['IMPORTANT', 'ACTION_REQUIRED']);
|
|
6
6
|
const WORKFLOW_WARNING_COLUMNS = ['id', 'time', 'step', 'severity', 'code', 'status', 'target', 'message', 'action', 'resolved_at', 'resolution'] as const;
|
|
7
|
+
const WARNING_TIME_PATTERN = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[+-]\d{2}:\d{2})?$/;
|
|
7
8
|
|
|
8
9
|
type WorkflowWarning = {
|
|
9
10
|
id: string;
|
|
@@ -19,14 +20,32 @@ type WorkflowWarning = {
|
|
|
19
20
|
resolution: string;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
/** Parses
|
|
23
|
+
/** Parses warning structure and lifecycle fields using one contract for all readers. */
|
|
23
24
|
function parseWorkflowWarnings(content: string): WorkflowWarning[] {
|
|
24
25
|
const table = parseTable(content, { sectionAliases: WORKFLOW_WARNING_HEADINGS, columns: WORKFLOW_WARNING_COLUMNS });
|
|
25
|
-
|
|
26
|
+
const warnings = table?.rows.map(({ values }) => ({
|
|
26
27
|
id: values.id!, time: values.time!, step: values.step!, severity: values.severity!,
|
|
27
28
|
code: values.code!, status: values.status!, target: values.target!, message: values.message!,
|
|
28
29
|
action: values.action!, resolvedAt: values.resolved_at!, resolution: values.resolution!
|
|
29
30
|
})) ?? [];
|
|
31
|
+
const errors: { code: string; message: string }[] = [];
|
|
32
|
+
const invalid = (message: string, code = 'WARNING_DOCUMENT_INVALID') => errors.push({ code, message });
|
|
33
|
+
for (const warning of warnings) {
|
|
34
|
+
const { id, time, severity, status, action, resolvedAt, resolution } = warning;
|
|
35
|
+
if (!/^WW-[1-9]\d*$/.test(id)) invalid(`${id || '(empty id)'}: invalid id`, 'WARNING_ID_INVALID');
|
|
36
|
+
if (!WARNING_TIME_PATTERN.test(time)) invalid(`${id}: invalid time '${time}'`);
|
|
37
|
+
for (const field of ['step', 'code', 'target', 'message'] as const) {
|
|
38
|
+
if (!warning[field].trim()) invalid(`${id}: ${field} is required`);
|
|
39
|
+
}
|
|
40
|
+
if (!WORKFLOW_WARNING_SEVERITIES.has(severity)) invalid(`${id}: illegal severity '${severity}'`);
|
|
41
|
+
if (!WORKFLOW_WARNING_STATUSES.has(status)) invalid(`${id}: illegal status '${status}'`);
|
|
42
|
+
if (status === 'open' && !action.trim()) invalid(`${id}: open warning requires action`);
|
|
43
|
+
if ((status === 'resolved' || status === 'ignored') && (!resolvedAt.trim() || !resolution.trim())) {
|
|
44
|
+
invalid(`${id}: ${status} warning requires resolved_at and resolution`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (errors.length) throw Object.assign(new Error(errors.map((error) => error.message).join('; ')), { code: errors[0]!.code });
|
|
48
|
+
return warnings;
|
|
30
49
|
}
|
|
31
50
|
|
|
32
51
|
function getOpenWorkflowWarnings(content: string): WorkflowWarning[] {
|
package/lib/update.ts
CHANGED
|
@@ -119,6 +119,12 @@ async function cmdSync(): Promise<void> {
|
|
|
119
119
|
replacements
|
|
120
120
|
);
|
|
121
121
|
ok('Updated .agents/scripts/lib/agent-infra-package.js');
|
|
122
|
+
renderFile(
|
|
123
|
+
path.join(templateDir, '.agents', 'scripts', 'package.json'),
|
|
124
|
+
path.join('.agents', 'scripts', 'package.json'),
|
|
125
|
+
replacements
|
|
126
|
+
);
|
|
127
|
+
ok('Updated .agents/scripts/package.json');
|
|
122
128
|
const added = {
|
|
123
129
|
managed: workflowPlan.projectAssets.registry.managed.filter(
|
|
124
130
|
(entry) => !currentRegistry.managed.includes(entry)
|
package/lib/version.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import semver from 'semver';
|
|
3
2
|
|
|
4
3
|
const packageJsonUrl = [
|
|
5
4
|
new URL('../package.json', import.meta.url),
|
|
@@ -13,22 +12,9 @@ if (!packageJsonUrl) {
|
|
|
13
12
|
const { version } = JSON.parse(readFileSync(packageJsonUrl, 'utf8'));
|
|
14
13
|
const VERSION = `v${version}`;
|
|
15
14
|
const AGENT_INFRA_VERSION_PATTERN = /^v\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
16
|
-
const LEGACY_COMPATIBILITY_CUTOFF_VERSION = '1.0.0';
|
|
17
15
|
|
|
18
16
|
function isValidAgentInfraVersion(value: unknown): value is string {
|
|
19
17
|
return typeof value === 'string' && AGENT_INFRA_VERSION_PATTERN.test(value);
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
const normalized = runtimeVersion.startsWith('v') ? runtimeVersion.slice(1) : runtimeVersion;
|
|
24
|
-
const parsed = semver.valid(normalized);
|
|
25
|
-
return parsed !== null && semver.lt(parsed, LEGACY_COMPATIBILITY_CUTOFF_VERSION);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function legacyCompatibilityError(resource: string, runtimeVersion = VERSION): Error & { code: string } {
|
|
29
|
-
return Object.assign(new Error(
|
|
30
|
-
`PLATFORM_IDENTITY_LEGACY_UNSUPPORTED: ${resource} requires migration to the current schema before v${LEGACY_COMPATIBILITY_CUTOFF_VERSION} runtime ${runtimeVersion}`
|
|
31
|
-
), { code: 'PLATFORM_IDENTITY_LEGACY_UNSUPPORTED' });
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { LEGACY_COMPATIBILITY_CUTOFF_VERSION, VERSION, isLegacyCompatibilityEnabled, isValidAgentInfraVersion, legacyCompatibilityError };
|
|
20
|
+
export { VERSION, isValidAgentInfraVersion };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fitlab-ai/agent-infra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Antigravity CLI, and OpenCode",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,12 +26,13 @@
|
|
|
26
26
|
"bin": {
|
|
27
27
|
"agent-infra": "./dist/bin/cli.js",
|
|
28
28
|
"ai": "./dist/bin/cli.js",
|
|
29
|
-
"agent-infra-internal": "./
|
|
29
|
+
"agent-infra-internal": "./bin/internal-cli.sh"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist/",
|
|
33
33
|
"!dist/**/*.map",
|
|
34
34
|
"bin/cli.ts",
|
|
35
|
+
"bin/internal-cli.sh",
|
|
35
36
|
"lib/",
|
|
36
37
|
"runtime/",
|
|
37
38
|
"templates/"
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"@clack/prompts": "1.7.0",
|
|
55
56
|
"@larksuiteoapi/node-sdk": "^1.68.0",
|
|
56
57
|
"cross-spawn": "^7.0.6",
|
|
57
|
-
"fs-
|
|
58
|
+
"fs-native-extensions": "1.5.1",
|
|
58
59
|
"picocolors": "1.1.1",
|
|
59
60
|
"semver": "^7.8.1",
|
|
60
61
|
"smol-toml": "^1.6.1",
|
|
@@ -67,6 +68,8 @@
|
|
|
67
68
|
"typecheck": "tsc -p tsconfig.test.json --noEmit && tsc -p tsconfig.jschecks.json --noEmit",
|
|
68
69
|
"test:smoke": "node scripts/run-tests.js \"tests/unit/**/*.test.ts\"",
|
|
69
70
|
"test:smoke:fast": "node scripts/run-tests.js --skip-build \"tests/unit/**/*.test.ts\"",
|
|
71
|
+
"test:platform-smoke": "node scripts/run-tests.js \"tests/integration/platform-smoke/**/*.test.ts\"",
|
|
72
|
+
"test:platform-smoke:fast": "node scripts/run-tests.js --skip-build \"tests/integration/platform-smoke/**/*.test.ts\"",
|
|
70
73
|
"test:core": "node scripts/run-tests.js \"tests/unit/**/*.test.ts\" \"tests/integration/**/*.test.ts\"",
|
|
71
74
|
"test:integration": "node scripts/run-tests.js \"tests/integration/**/*.test.ts\" \"tests/e2e/**/*.test.ts\"",
|
|
72
75
|
"check": "npm run typecheck && npm test",
|
|
@@ -85,8 +88,5 @@
|
|
|
85
88
|
},
|
|
86
89
|
"overrides": {
|
|
87
90
|
"axios": "1.18.1"
|
|
88
|
-
},
|
|
89
|
-
"allowScripts": {
|
|
90
|
-
"fs-ext-extra-prebuilt@2.2.13": true
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -16,7 +16,7 @@ function internalCliInvocation(args) {
|
|
|
16
16
|
return { command: 'agent-infra-internal', commandArgs: args, shell: process.platform === 'win32' };
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function
|
|
19
|
+
function findCapabilityRef(value, depth = 0) {
|
|
20
20
|
if (depth > 5 || value == null) return '';
|
|
21
21
|
if (typeof value === 'string') {
|
|
22
22
|
const match = /agent-infra-codex-capability:([A-Za-z0-9_-]{20,})/.exec(value);
|
|
@@ -24,14 +24,14 @@ function findCapabilityToken(value, depth = 0) {
|
|
|
24
24
|
}
|
|
25
25
|
if (Array.isArray(value)) {
|
|
26
26
|
for (const entry of value) {
|
|
27
|
-
const found =
|
|
27
|
+
const found = findCapabilityRef(entry, depth + 1);
|
|
28
28
|
if (found) return found;
|
|
29
29
|
}
|
|
30
30
|
return '';
|
|
31
31
|
}
|
|
32
32
|
if (typeof value === 'object') {
|
|
33
33
|
for (const entry of Object.values(value)) {
|
|
34
|
-
const found =
|
|
34
|
+
const found = findCapabilityRef(entry, depth + 1);
|
|
35
35
|
if (found) return found;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -77,11 +77,11 @@ process.stdin.on('end', () => {
|
|
|
77
77
|
process.exit(1);
|
|
78
78
|
}
|
|
79
79
|
const managedAgent = /^agent-infra-lifecycle-(executor|reviewer)$/.test(String(nativeAgent || ''));
|
|
80
|
-
const
|
|
80
|
+
const capabilityRef = hook === 'post-tool' ? findCapabilityRef(toolResponse) : '';
|
|
81
81
|
const parentReconcile = hook === 'post-tool'
|
|
82
82
|
&& toolName === 'collaborationwait_agent'
|
|
83
83
|
&& toolResponse.timed_out !== true;
|
|
84
|
-
if (!managedAgent && !parentReconcile && !
|
|
84
|
+
if (!managedAgent && !parentReconcile && !capabilityRef) process.exit(0);
|
|
85
85
|
const hookDefinitionHash = createHash('sha256').update(readFileSync(codexHooks)).digest('hex');
|
|
86
86
|
const normalized = {
|
|
87
87
|
sessionId: String(event.session_id || ''),
|
|
@@ -96,7 +96,7 @@ process.stdin.on('end', () => {
|
|
|
96
96
|
taskName: String(toolInput.task_name || ''),
|
|
97
97
|
transcriptPath: String(event.transcript_path || '')
|
|
98
98
|
};
|
|
99
|
-
if (
|
|
99
|
+
if (capabilityRef) normalized.capabilityRef = capabilityRef;
|
|
100
100
|
const args = ['codex-lifecycle', 'hook-event', '--event', hook, '--bridge', 'true'];
|
|
101
101
|
try {
|
|
102
102
|
const { command, commandArgs, shell } = internalCliInvocation(args);
|
|
@@ -9,6 +9,6 @@ agent-infra-internal platform-issue create {task-id} --agent {standard-agent-tok
|
|
|
9
9
|
agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status waiting-for-triage --assignees current --milestone initial --issue-type --fields
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
The core reads only persisted task identity, title, type, description, and requirements, and reuses deterministic `ai task issue-body` rendering. It owns template selection, upstream/capabilities, duplicate prevention, POST outcome boundaries, response validation, and atomic `
|
|
12
|
+
The core reads only persisted task identity, title, type, description, and requirements, and reuses deterministic `ai task issue-body` rendering. It owns template selection, upstream/capabilities, duplicate prevention, POST outcome boundaries, response validation, and atomic `platform_issue_identity` binding.
|
|
13
13
|
|
|
14
14
|
`planned|applied|no-op|degraded` exit 0, `failed` exits 1, and `blocked` exits 2. Callers must not fall back to direct platform CLI or GraphQL orchestration.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
命令只从已落盘 task.md 读取身份、标题、类型、描述与需求,并复用 `ai task issue-body` 的确定性正文渲染。它负责模板选择、upstream/capability、已有绑定检查、非幂等 POST 边界、响应身份校验及通过任务写入内核回写 `
|
|
11
|
+
命令只从已落盘 task.md 读取身份、标题、类型、描述与需求,并复用 `ai task issue-body` 的确定性正文渲染。它负责模板选择、upstream/capability、已有绑定检查、非幂等 POST 边界、响应身份校验及通过任务写入内核回写 `platform_issue_identity`。
|
|
12
12
|
|
|
13
13
|
创建后的初始元数据使用同一适配层同步:
|
|
14
14
|
|
|
@@ -12,19 +12,21 @@
|
|
|
12
12
|
| `summary` | `<!-- sync-issue:{task-id}:summary -->` |
|
|
13
13
|
| `cancel` | `<!-- sync-issue:{task-id}:cancel -->` |
|
|
14
14
|
|
|
15
|
-
`pr-review` content is synced only as an Issue artifact comment (via the `artifact` / `artifactChunk` markers) and is never a `restore-task` recovery source; restore still accepts only an Issue
|
|
15
|
+
`pr-review` content is synced only as an Issue artifact comment (via the `artifact` / `artifactChunk` markers) and is never a `restore-task` recovery source; restore still accepts only an Issue token and reads only registered Issue markers, with no PR source.
|
|
16
16
|
|
|
17
17
|
Comments use `platform-comment`; Issue resources use `platform-issue`:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
agent-infra-internal platform-issue inspect {task-id}
|
|
21
21
|
agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
|
|
22
|
-
agent-infra-internal platform-issue bind {task-id} --issue {
|
|
22
|
+
agent-infra-internal platform-issue bind {task-id} --issue {issue-token} --agent {standard-agent-token}
|
|
23
23
|
agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} {desired-state-flags}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
The core owns status/in labels, assignees, milestones, Issue Type, pinned fields, requirements, state, capabilities, dry-run, retries, errors, and idempotency. Omitted flags preserve values; `none` explicitly clears them. Status labels converge to at most one, and ambiguous requirement identity fails closed.
|
|
27
27
|
|
|
28
|
+
Task content over the platform comment byte limit is not uploaded; the core returns a skipped operation with `COMMENT_PAYLOAD_TOO_LARGE`. The local task file is unchanged, and platform verification skips the task marker/content check for the same oversized input.
|
|
29
|
+
|
|
28
30
|
PR event `in:` synchronization uses `agent-infra-internal platform-pr sync-in-labels --pr <N> [--cwd <path>]`. PR files are the event evidence; a unique closing Issue is written and re-read before the PR. Zero or multiple closing Issues update only the PR and return `degraded`; unknown side effects or failed convergence return `blocked` with `IN_LABEL_SYNC_PARTIAL`.
|
|
29
31
|
|
|
30
32
|
`planned|applied|no-op|degraded` exit 0; `failed` exits 1; `blocked` exits 2.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
`prSummary` 属于 `.agents/rules/pr-sync.md`,本规则不实现 PR 聚合。
|
|
18
18
|
|
|
19
|
-
`pr-review` 原文只通过 `artifact` / `artifactChunk` marker 同步为 Issue artifact 评论,不作为 `restore-task` 恢复来源;恢复仍只接受 Issue
|
|
19
|
+
`pr-review` 原文只通过 `artifact` / `artifactChunk` marker 同步为 Issue artifact 评论,不作为 `restore-task` 恢复来源;恢复仍只接受 Issue 原始 token 并只读注册的 Issue marker,不新增 PR 来源。
|
|
20
20
|
|
|
21
21
|
## 平台 intent
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
agent-infra-internal platform-context resolve [--cwd <path>]
|
|
27
|
-
agent-infra-internal platform-comment list --issue <
|
|
27
|
+
agent-infra-internal platform-comment list --issue <issue-token> [--cwd <path>]
|
|
28
28
|
agent-infra-internal platform-comment owner <task-ref>
|
|
29
29
|
agent-infra-internal platform-comment sync <task-ref> \
|
|
30
30
|
--kind task|artifact|summary|cancel --agent {standard-agent-token} \
|
|
@@ -33,6 +33,7 @@ agent-infra-internal platform-comment sync <task-ref> \
|
|
|
33
33
|
|
|
34
34
|
- `applied|no-op|degraded` → exit 0;`failed` → exit 1;`blocked` → exit 2。
|
|
35
35
|
- task 评论保持 `<details>` frontmatter 可逆格式;artifact 原文内联并在超过 profile 上限时使用 `artifactChunk`。
|
|
36
|
+
- task 内容超过平台评论字节上限时不上传,返回 `COMMENT_PAYLOAD_TOO_LARGE` 的 skipped 操作;本地 task 文件保持不变,platform verification 同样跳过 task marker/content 检查。
|
|
36
37
|
- 相同 intent 重放必须收敛为 `no-op`;重复 marker 返回 `COMMENT_MARKER_CONFLICT` 且不写入。
|
|
37
38
|
- 外部贡献者锁定统一使用 `platform-comment owner`;不同作者且无 triage 时返回 `COMMENT_OWNER_CONFLICT`。
|
|
38
39
|
|
|
@@ -59,7 +60,7 @@ agent-infra-internal task-warning {task-id} add \
|
|
|
59
60
|
```bash
|
|
60
61
|
agent-infra-internal platform-issue inspect {task-id}
|
|
61
62
|
agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
|
|
62
|
-
agent-infra-internal platform-issue bind {task-id} --issue {
|
|
63
|
+
agent-infra-internal platform-issue bind {task-id} --issue {issue-token} --agent {standard-agent-token}
|
|
63
64
|
agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} {desired-state-flags}
|
|
64
65
|
```
|
|
65
66
|
|
|
@@ -1,57 +1,64 @@
|
|
|
1
|
-
# General Rule - Model-Driven Local Artifact
|
|
1
|
+
# General Rule - Model-Driven Local Artifact Recovery
|
|
2
2
|
|
|
3
|
-
This rule
|
|
3
|
+
This rule covers the pre-completion gate for `analyze-task`, `plan-task`, and `code-task`, plus the summary finalizers for the three review skills. It handles one canonical artifact in the current task directory only. It does not authorize changes to `task.md`, ledgers, receipts, source code, Git, platform resources, or lifecycle state.
|
|
4
4
|
|
|
5
|
-
## Pre-completion gate
|
|
5
|
+
## Pre-completion gate
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
- Run the applicable finalizer before a completed event; pass only that invocation's `artifactSha256` and `semanticDigest` to the event.
|
|
8
|
+
- When artifact content is invalid, the finalizer returns a controlled `recovery` with a `recoveryId`, `candidatePath`, and baseline digests. The formal artifact remains unchanged until recovery commit.
|
|
9
|
+
- After the mechanical safety gates pass, the model may edit only the returned `candidatePath`. After each byte-changing edit, rerun the complete finalizer with the same task, stage/family, artifact, and `--recovery-id`. Never edit the formal artifact directly and call it a candidate.
|
|
10
|
+
- A successful finalizer commits through `finalize-ready → commit-started → passed`; completed events accept only matching `passed` final digests and consume the intent under the task lock.
|
|
11
|
+
- Before `finalize-ready`, the recovery core seals the validated final bytes in the controlled `final.md`; later commit ignores the editable `candidate.md` and validates/publishes only that sealed snapshot, so a post-prepare candidate replacement cannot be published.
|
|
12
|
+
- Candidate-only is a protocol authorization boundary, not OS isolation: a same-UID process with arbitrary host filesystem write access may tamper with recovery internals. Identity, fingerprint, and state checks detect such anomalies and fail closed, but the protocol does not claim an independent security principal or cross-platform isolation.
|
|
11
13
|
|
|
12
|
-
## Authorization
|
|
14
|
+
## Authorization boundary
|
|
13
15
|
|
|
14
|
-
- The finalizer
|
|
15
|
-
- The
|
|
16
|
-
-
|
|
17
|
-
- `changed=false`, an error code, or a format shape is diagnostic evidence, not automatic authorization. The model must judge each case using the complete diagnostic, artifact content, and context.
|
|
16
|
+
- The finalizer and recovery core validate identity, state, permissions, stable reads, complete artifact semantics, and fingerprints. They do not infer repairability or expose a text-operation allow-list.
|
|
17
|
+
- The model may edit only the one ordinary artifact declared by the current skill. It must not edit `task.md`, ledgers, receipts, source code, other reports, or remote resources.
|
|
18
|
+
- `changed=false`, an error code, or a format shape is diagnostic evidence, not edit authorization. Stop on unproven human-decision semantics, concurrency, permission, I/O, identity, provenance, or unknown state.
|
|
18
19
|
|
|
19
|
-
## Non-bypassable
|
|
20
|
+
## Non-bypassable mechanical gates
|
|
20
21
|
|
|
21
|
-
Before every
|
|
22
|
+
Before every candidate edit, confirm that:
|
|
22
23
|
|
|
23
|
-
1. the finalizer
|
|
24
|
-
2.
|
|
25
|
-
3.
|
|
26
|
-
4. the
|
|
24
|
+
1. the finalizer failed with the same controlled recovery context and nothing formal was committed;
|
|
25
|
+
2. task, family/stage, round, artifact, request/authority, and baseline fingerprints still match;
|
|
26
|
+
3. `candidatePath` is the ordinary file generated by the recovery core and the formal target has not changed externally;
|
|
27
|
+
4. the edit does not change human-decision semantics, detail or ledger identity, and introduces no other side effect.
|
|
27
28
|
|
|
28
|
-
If any condition fails, stop
|
|
29
|
+
If any condition fails, stop without editing or publishing a completed event.
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
+
## Durable recovery states
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
| State | Formal artifact | Allowed action |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| `awaiting-recovery` | baseline `B` | Edit only controlled candidate `S`; rerun the same finalizer |
|
|
36
|
+
| `finalize-ready` | `B` | Recovery core starts the commit under the task lock |
|
|
37
|
+
| `commit-started` | `B` or final `F` | Reconcile only; retry, confirm, or restore from verified `B/F` fingerprints |
|
|
38
|
+
| `passed` | `F` | Completed event validates the final digest and consumes the intent |
|
|
39
|
+
| `consumed` | `F` | Cleanup may reclaim the controlled staging and backup |
|
|
40
|
+
| `aborted` | verified restored `B` | Preserve diagnostics; never fabricate success |
|
|
40
41
|
|
|
41
|
-
The
|
|
42
|
+
The intent is current-only schema version 3. Legacy schemas fail closed; do not add migration, adapters, or dual writes. Candidate, baseline, and intent files live in controlled repo-local directories and use canonical recovery IDs, regular-file checks, stable reads, the task lock, and expected-value CAS. No cross-file atomicity is claimed; unknown combinations remain indeterminate and retain their evidence.
|
|
42
43
|
|
|
43
|
-
##
|
|
44
|
+
## Dynamic convergence loop
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
1. Run the finalizer with the fixed invocation.
|
|
47
|
+
2. If it fails and the gates pass, read the structured diagnostic and `candidatePath`, then make one minimal, explainable candidate edit.
|
|
48
|
+
3. Confirm byte-level progress and rerun every finalizer check with the same `--recovery-id`.
|
|
49
|
+
4. Stop on repeated diagnostics or fingerprints, no byte progress, unknown recovery state, or the eight-edit limit for the current invocation. Do not publish a completed event or generate a cross-stage next step.
|
|
46
50
|
|
|
47
|
-
##
|
|
51
|
+
## Shared entry points
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
- On failure, model stop, lack of progress, repeated diagnostics, or the emergency cap, do not publish a completed event, advance the lifecycle, generate cross-stage commands, or fabricate an approval.
|
|
51
|
-
- Stopping advancement does not discard review results. User output must show the artifact path, the last safely readable summary/findings, actual `repairAttempts`, the last structured diagnostic, and the stop reason.
|
|
52
|
-
- If the summary cannot be safely parsed, show only the artifact path and the raw structured diagnostic; do not infer counts or add a conclusion, and state that lifecycle advancement stopped while the artifact remains available.
|
|
53
|
-
- A stop path may only suggest rerunning the current review skill or handling the issue manually. It must not invoke cross-stage helpers such as `code-task` or `complete-task`.
|
|
53
|
+
The current entry points are `task-artifact ... inspect|init|finalize-local` and `task-review ... finalize-summary`. Recovery retries use the `recoveryId` returned by the finalizer, for example:
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
```text
|
|
56
|
+
agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact} --recovery-id {recovery-id}
|
|
57
|
+
agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact} --recovery-id {recovery-id}
|
|
58
|
+
```
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
There is no `task-artifact repair`, `replace-line`, `insert-section`, or `repairable` authorization. The structural engine returns diagnostics and digests only; the current skill's gates and the model decide whether and how to edit the candidate.
|
|
61
|
+
|
|
62
|
+
## Lifecycle isolation
|
|
63
|
+
|
|
64
|
+
A completed event may legitimately modify `task.md`, but only after finalizer recovery is `passed` and digest, round, request, and authority all match. If authority consumption fails after the event write, retain the formal artifact and use the existing lifecycle recovery compensation; do not replay the completed write or roll back a passed artifact.
|
|
@@ -1,57 +1,64 @@
|
|
|
1
|
-
# 通用规则 -
|
|
1
|
+
# 通用规则 - 模型驱动的本地产物恢复
|
|
2
2
|
|
|
3
|
-
本规则适用于 `analyze-task`、`plan-task`、`code-task`
|
|
3
|
+
本规则适用于 `analyze-task`、`plan-task`、`code-task` 的本地产物完成前门禁,以及三个 review skill 的 summary finalizer。它只处理当前 task 目录内的一个 canonical artifact;不适用于 `task.md`、账本、receipt、源码、Git、平台资源或生命周期状态。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 完成前门禁
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
- 完成事件前必须运行对应 finalizer;只有同一次返回的 `artifactSha256` 和 `semanticDigest` 才能传给 completed event。
|
|
8
|
+
- finalizer 发现 artifact 内容错误时,返回受控 `recovery`(`recoveryId`、`candidatePath`、baseline 指纹)。正式 artifact 在 recovery commit 前必须保持不变。
|
|
9
|
+
- 只有在机械安全门通过后,模型才可编辑返回的 `candidatePath`;每次实际字节变化后,用同一 task、stage/family、artifact 和 `--recovery-id` 完整重跑 finalizer。不得直接编辑正式 artifact 后假设它属于候选。
|
|
10
|
+
- finalizer 通过后,recovery core 按 `finalize-ready → commit-started → passed` 提交候选;completed event 只接受匹配的 `passed`/final digest,并在任务锁内消费 intent。
|
|
11
|
+
- `finalize-ready` 前 recovery core 会把已校验的最终字节封存为受控 `final.md`;后续 commit 忽略可编辑的 `candidate.md`,只校验并发布该封存快照,避免候选在准备后被替换。
|
|
12
|
+
- candidate-only 是协议授权边界,不是操作系统隔离:拥有同一 UID 且可任意写入宿主文件系统的进程可能篡改 recovery 内部文件;协议会通过身份、指纹和状态校验发现异常并失败关闭,但不承诺独立权限主体或跨平台隔离。
|
|
11
13
|
|
|
12
14
|
## 授权边界
|
|
13
15
|
|
|
14
|
-
- finalizer
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- `changed=false`、错误码或某个格式形状只是诊断事实,不是自动批准。模型必须结合完整诊断、artifact 内容和上下文逐例判断。
|
|
16
|
+
- finalizer 和 recovery core 只校验身份、状态、权限、稳定读取、完整 artifact 语义和指纹;不根据错误码猜测“可修复”,也不提供文本操作白名单。
|
|
17
|
+
- 模型只能修改当前 skill 声明的一个普通 artifact。不得修改 task.md、账本、receipt、源码、其他报告或远端资源。
|
|
18
|
+
- `changed=false`、错误码和格式形状只是诊断事实,不是编辑授权。人工裁决、并发、权限、I/O、身份、provenance 或未知状态无法证明安全时,立即停止。
|
|
18
19
|
|
|
19
20
|
## 不可绕过的机械安全门
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
每次编辑候选前确认:
|
|
22
23
|
|
|
23
|
-
1. finalizer
|
|
24
|
-
2.
|
|
25
|
-
3.
|
|
26
|
-
4.
|
|
24
|
+
1. finalizer 返回失败并提供同一 recovery context,且没有正式提交;
|
|
25
|
+
2. task、family/stage、round、artifact、request/authority 和 baseline 指纹仍匹配;
|
|
26
|
+
3. `candidatePath` 是 recovery core 生成的受控普通文件,formal target 没有外部变化;
|
|
27
|
+
4. 修改不改变人工裁决语义、详情或账本身份,也不引入其他副作用。
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
任一条件不满足,停止,不编辑、不发布 completed。
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
+
## Durable recovery 状态
|
|
32
|
+
|
|
33
|
+
| 状态 | formal artifact | 允许动作 |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| `awaiting-recovery` | baseline `B` | 只编辑受控 candidate `S`,重跑同一 finalizer |
|
|
36
|
+
| `finalize-ready` | `B` | recovery core 在锁内开始提交 |
|
|
37
|
+
| `commit-started` | `B` 或 final `F` | 只允许 reconcile;按 `B/F` 指纹重试、确认或回滚 |
|
|
38
|
+
| `passed` | `F` | completed event 校验 final digest 后消费 |
|
|
39
|
+
| `consumed` | `F` | 可由中间产物清理流程回收受控 staging/backup |
|
|
40
|
+
| `aborted` | 已确认恢复的 `B` | 只保留诊断,不得伪造成功 |
|
|
31
41
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
4. 模型选择继续时,只做一次最小 artifact 编辑。只有文件字节实际发生变化,才增加一次 `repairAttempts`,然后完整重跑同一个 finalizer intent。
|
|
36
|
-
5. 每次重跑都重新执行全部安全校验。修复后出现新的、独立且仍局限于该 artifact 的问题,可以再次交给模型判断;不能沿用上一次“可修复”的结论。
|
|
37
|
-
6. 模型无法证明下一步安全,或判断问题属于环境、权限、并发、身份、provenance、状态未知、人工裁决语义/详情不确定或其他非本地问题时,立即停止。已知人工裁决本身不是停止条件。
|
|
38
|
-
7. 诊断重复、artifact 指纹重复、没有实际字节进展或模型没有提出可验证的最小修改时,立即停止。
|
|
39
|
-
8. 每次 skill invocation 最多允许 8 次实际 artifact 修改作为紧急熔断。该上限只防止死循环和资源失控,不是正常业务停止条件,也不表示最多只能修复 8 个问题。达到上限时保留最后结构化诊断并停止。
|
|
42
|
+
intent 使用 current-only schema version 3。旧 schema 直接失败关闭;不添加迁移、adapter 或双写。candidate、baseline 和 intent 位于 repo-local 受控目录,使用 canonical recovery ID、普通文件检查、stable read、task lock 和 expected-value CAS。跨文件不宣称原子性;未知组合返回 indeterminate 并保留现场。
|
|
43
|
+
|
|
44
|
+
## 动态收敛循环
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
1. 用固定 invocation 运行 finalizer。
|
|
47
|
+
2. 失败且安全门通过时,读取结构化诊断和 `candidatePath`,只作一次最小、可解释的候选编辑。
|
|
48
|
+
3. 确认字节变化后,使用同一 `--recovery-id` 完整重跑全部 finalizer 校验。
|
|
49
|
+
4. 诊断或指纹重复、无字节进展、恢复状态未知或达到当前 invocation 的 8 次编辑上限时停止;不发布 completed,不生成跨阶段 next-step。
|
|
42
50
|
|
|
43
|
-
##
|
|
51
|
+
## 共享入口
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
`task-artifact ... inspect|init|finalize-local` 和 `task-review ... finalize-summary` 是当前入口。恢复重试使用 finalizer 返回的 `recoveryId`,例如:
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
```text
|
|
56
|
+
agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact} --recovery-id {recovery-id}
|
|
57
|
+
agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact} --recovery-id {recovery-id}
|
|
58
|
+
```
|
|
48
59
|
|
|
49
|
-
-
|
|
50
|
-
- 失败、模型停止、无进展、诊断重复或紧急熔断时,不发布 completed 事件,不推进生命周期,不生成跨阶段命令,也不伪造通过结论。
|
|
51
|
-
- 停止推进不等于丢弃审查结果。用户输出必须展示 artifact 路径、已安全读取的最后有效 summary/findings、实际 `repairAttempts`、最后结构化诊断和停止原因。
|
|
52
|
-
- summary 无法安全解析时,只展示 artifact 路径和原始结构化诊断,不推算计数、不补写结论,并明确生命周期推进已停止但产物仍可查看。
|
|
53
|
-
- 停止路径只提示重新运行当前 review skill 或进行人工处理;不能调用 `code-task`、`complete-task` 等跨阶段 helper。
|
|
60
|
+
不再存在 `task-artifact repair`、`replace-line`、`insert-section` 或 `repairable` 授权。结构引擎只返回诊断和 digest;候选是否安全、如何修改以及何时停止由当前 skill 的机械门和模型逐例判断。
|
|
54
61
|
|
|
55
62
|
## 生命周期隔离
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
completed event 合法地修改 task.md,但必须发生在 finalizer recovery 已 `passed` 且 digest、round、request/authority 全部匹配之后。若 event 写入后 authority 消费失败,保留正式 artifact,使用既有 lifecycle recovery compensation;不得重放 completed 写入或回滚已通过的 artifact。
|
|
@@ -43,6 +43,8 @@ This mirrors "Goal-Driven Execution" in AGENTS.md: define a verifiable success c
|
|
|
43
43
|
|
|
44
44
|
Complete each item below for this repository. Record the chosen behavior and its boundaries so contributors can select and validate tests consistently.
|
|
45
45
|
|
|
46
|
+
When a project uses a cross-platform smoke boundary, keep real CLI, git, shell, environment-forwarding, and process-lifecycle tests outside the unit tier. Document which operating systems execute that boundary and keep structural tier checks separate from line coverage.
|
|
47
|
+
|
|
46
48
|
### 1. Test commands
|
|
47
49
|
|
|
48
50
|
> TODO: Document the complete test command and any faster commands used during development.
|
|
@@ -43,6 +43,8 @@ assert.match(content, /^name: code-task$/m); // 正向断言已足够
|
|
|
43
43
|
|
|
44
44
|
请为本仓库填写以下各项,记录选定行为及其边界,以便贡献者一致地选择并验证测试。
|
|
45
45
|
|
|
46
|
+
如果项目使用跨平台 smoke 边界,应将真实 CLI、git、shell、环境透传和进程生命周期测试放在 unit 层之外;记录该边界运行的操作系统,并将测试层级结构检查与代码行覆盖率分开。
|
|
47
|
+
|
|
46
48
|
### 1. 测试命令
|
|
47
49
|
|
|
48
50
|
> TODO: 记录完整测试命令,以及开发期间使用的可选快速命令。
|