@fitlab-ai/agent-infra 0.12.0 → 0.12.2
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 +0 -2
- package/README.zh-CN.md +0 -2
- package/dist/bin/internal-cli.js +2 -17
- package/dist/lib/agent-clients/adapter.js +0 -13
- package/dist/lib/agent-clients/adapters/antigravity-cli.js +0 -5
- package/dist/lib/agent-clients/adapters/claude-code-credentials.js +0 -17
- package/dist/lib/agent-clients/adapters/claude-code.js +0 -9
- package/dist/lib/agent-clients/adapters/codex.js +0 -52
- package/dist/lib/agent-clients/adapters/opencode.js +0 -5
- package/dist/lib/agent-clients/adapters/traecli.js +0 -5
- package/dist/lib/agent-clients/config.js +19 -54
- package/dist/lib/agent-clients/registry.js +1 -12
- package/dist/lib/agent-clients/schema.js +0 -18
- package/dist/lib/agent-clients/tokens.js +1 -2
- package/dist/lib/agent-clients/types.js +0 -1
- package/dist/lib/decide.js +2 -0
- package/dist/lib/git/worktree-identity.js +1 -9
- package/dist/lib/internal/agent-client.js +2 -62
- package/dist/lib/internal/cli-route-inventory.js +1 -5
- package/dist/lib/internal/manual-validation.js +29 -27
- package/dist/lib/internal/platform-comment.js +56 -7
- package/dist/lib/internal/task-create.js +1 -1
- package/dist/lib/internal/task-event.js +1 -8
- package/dist/lib/internal/task-finalization.js +0 -1
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-operation-registry.js +4 -20
- package/dist/lib/internal/task-review.js +4 -4
- package/dist/lib/platform/comment-safety.js +1 -7
- package/dist/lib/platform/in-label-sync.js +1 -14
- package/dist/lib/platform/issue-comments.js +373 -282
- package/dist/lib/platform/issue-summary-content.js +112 -0
- package/dist/lib/platform/issues.js +1 -1
- package/dist/lib/platform/operation-coordinator.js +4 -2
- package/dist/lib/platform/pr-change-report.js +176 -30
- package/dist/lib/platform/pr-checks.js +2 -8
- package/dist/lib/platform/pr-summary-content.js +54 -0
- package/dist/lib/platform/pr-summary.js +318 -284
- package/dist/lib/platform/provider-validation.js +0 -20
- package/dist/lib/platform/pull-requests.js +73 -84
- package/dist/lib/platform/releases.js +1 -43
- package/dist/lib/platform/summary-content-pipeline.js +18 -0
- package/dist/lib/platform/verification-required.js +0 -2
- package/dist/lib/platform/verification-sync.js +1 -79
- package/dist/lib/process-data/normalize.js +1 -185
- package/dist/lib/process-data/privacy.js +1 -16
- package/dist/lib/process-data/sources.js +2 -279
- package/dist/lib/render.js +0 -12
- package/dist/lib/run/index.js +15 -10
- package/dist/lib/run/skills.js +0 -3
- package/dist/lib/sandbox/commands/create.js +40 -53
- package/dist/lib/sandbox/commands/list-running.js +0 -18
- package/dist/lib/sandbox/commands/start.js +7 -8
- package/dist/lib/sandbox/constants.js +0 -6
- package/dist/lib/sandbox/control/client.js +0 -1
- package/dist/lib/sandbox/control/container-identity.js +1 -16
- package/dist/lib/sandbox/control/executor.js +0 -4
- package/dist/lib/sandbox/control/identity-sentinel.js +0 -7
- package/dist/lib/sandbox/control/lifecycle.js +21 -37
- package/dist/lib/sandbox/control/native-file-lock.js +0 -3
- package/dist/lib/sandbox/control/server.js +18 -38
- package/dist/lib/sandbox/control/state.js +1 -9
- package/dist/lib/sandbox/dockerfile.js +0 -6
- package/dist/lib/sandbox/engine.js +0 -14
- package/dist/lib/sandbox/engines/docker-exact-discovery.js +1 -4
- package/dist/lib/sandbox/engines/wsl2-paths.js +0 -3
- package/dist/lib/sandbox/recovery.js +24 -26
- package/dist/lib/sandbox/removal.js +67 -518
- package/dist/lib/sandbox/task-resolver.js +0 -41
- package/dist/lib/sandbox/tools.js +1 -4
- package/dist/lib/sandbox/workspace-view.js +1 -2
- package/dist/lib/server/display.js +0 -6
- package/dist/lib/task/activity-intent.js +45 -40
- package/dist/lib/task/activity-log.js +9 -16
- package/dist/lib/task/artifact-command.js +1 -1
- package/dist/lib/task/artifact-lifecycle.js +61 -63
- package/dist/lib/task/artifact-name.js +0 -6
- package/dist/lib/task/artifact-operations.js +3 -3
- package/dist/lib/task/capabilities.js +4 -5
- package/dist/lib/task/commands/log.js +0 -6
- package/dist/lib/task/commands/status.js +17 -60
- package/dist/lib/task/commit-operation.js +28 -39
- package/dist/lib/task/completion-facts.js +56 -43
- package/dist/lib/task/control-authority.js +23 -256
- package/dist/lib/task/control-recovery.js +3 -5
- package/dist/lib/task/create.js +2 -4
- package/dist/lib/task/decision-intents.js +8 -9
- package/dist/lib/task/delivery-target.js +1 -40
- package/dist/lib/task/events.js +84 -107
- package/dist/lib/task/finalization.js +60 -15
- package/dist/lib/task/ledger-intents.js +1 -1
- package/dist/lib/task/lifecycle-execution.js +38 -33
- package/dist/lib/task/lifecycle.js +49 -41
- package/dist/lib/task/local-artifact-finalization.js +1 -4
- package/dist/lib/task/manual-validation-evidence.js +1 -37
- package/dist/lib/task/platform-operation-recovery.js +151 -108
- package/dist/lib/task/pr-delivery-fact.js +2 -5
- package/dist/lib/task/qualification-confirmation.js +5 -7
- package/dist/lib/task/resolve-ref.js +1 -25
- package/dist/lib/task/review-command.js +2 -2
- package/dist/lib/task/review-finalization.js +1 -21
- package/dist/lib/task/review-fingerprint.js +0 -4
- package/dist/lib/task/secure-fs.js +0 -56
- package/dist/lib/task/short-id.js +1 -39
- package/dist/lib/task/skill-scope.js +0 -1
- package/dist/lib/task/verification-engine.js +58 -282
- package/dist/lib/task/verification.js +6 -3
- package/dist/lib/task/write.js +11 -1
- package/lib/agent-clients/adapter.ts +0 -76
- package/lib/agent-clients/adapters/antigravity-cli.ts +0 -5
- package/lib/agent-clients/adapters/claude-code-credentials.ts +0 -19
- package/lib/agent-clients/adapters/claude-code.ts +0 -9
- package/lib/agent-clients/adapters/codex.ts +0 -56
- package/lib/agent-clients/adapters/opencode.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +0 -5
- package/lib/agent-clients/config.ts +20 -61
- package/lib/agent-clients/registry.ts +1 -34
- package/lib/agent-clients/schema.ts +0 -18
- package/lib/agent-clients/tokens.ts +1 -2
- package/lib/agent-clients/types.ts +0 -15
- package/lib/decide.ts +1 -0
- package/lib/git/worktree-identity.ts +0 -10
- package/lib/internal/agent-client.ts +2 -70
- package/lib/internal/cli-route-inventory.ts +1 -4
- package/lib/internal/manual-validation.ts +28 -27
- package/lib/internal/platform-comment.ts +46 -4
- package/lib/internal/task-create.ts +0 -1
- package/lib/internal/task-event.ts +1 -5
- package/lib/internal/task-finalization.ts +0 -1
- package/lib/internal/task-lifecycle.ts +3 -5
- package/lib/internal/task-operation-registry.ts +3 -19
- package/lib/internal/task-review.ts +4 -4
- package/lib/platform/comment-safety.ts +0 -10
- package/lib/platform/github-provider.ts +0 -2
- package/lib/platform/in-label-sync.ts +0 -16
- package/lib/platform/issue-comments.ts +478 -301
- package/lib/platform/issue-summary-content.ts +132 -0
- package/lib/platform/issues.ts +0 -2
- package/lib/platform/operation-coordinator.ts +4 -2
- package/lib/platform/pr-change-report.ts +165 -25
- package/lib/platform/pr-checks.ts +1 -10
- package/lib/platform/pr-review.ts +1 -1
- package/lib/platform/pr-summary-content.ts +60 -0
- package/lib/platform/pr-summary.ts +364 -257
- package/lib/platform/provider-bridge.ts +0 -1
- package/lib/platform/provider-loader.ts +1 -5
- package/lib/platform/provider-validation.ts +1 -49
- package/lib/platform/pull-requests.ts +64 -99
- package/lib/platform/releases.ts +1 -40
- package/lib/platform/summary-content-pipeline.ts +23 -0
- package/lib/platform/verification-required.ts +0 -2
- package/lib/platform/verification-sync.ts +0 -94
- package/lib/process-data/normalize.ts +1 -186
- package/lib/process-data/privacy.ts +2 -19
- package/lib/process-data/sources.ts +3 -283
- package/lib/render.ts +0 -15
- package/lib/run/index.ts +13 -7
- package/lib/run/skills.ts +0 -4
- package/lib/sandbox/commands/create.ts +37 -74
- package/lib/sandbox/commands/list-running.ts +0 -19
- package/lib/sandbox/commands/start.ts +7 -10
- package/lib/sandbox/constants.ts +0 -8
- package/lib/sandbox/control/client.ts +0 -1
- package/lib/sandbox/control/container-identity.ts +1 -16
- package/lib/sandbox/control/executor.ts +1 -5
- package/lib/sandbox/control/identity-sentinel.ts +0 -8
- package/lib/sandbox/control/lifecycle.ts +18 -51
- package/lib/sandbox/control/native-file-lock.ts +0 -8
- package/lib/sandbox/control/protocol.ts +0 -2
- package/lib/sandbox/control/server.ts +13 -39
- package/lib/sandbox/control/state.ts +1 -10
- package/lib/sandbox/dockerfile.ts +0 -11
- package/lib/sandbox/engine.ts +0 -17
- package/lib/sandbox/engines/docker-exact-discovery.ts +1 -5
- package/lib/sandbox/engines/wsl2-paths.ts +0 -4
- package/lib/sandbox/recovery.ts +24 -26
- package/lib/sandbox/removal.ts +58 -687
- package/lib/sandbox/shell.ts +1 -1
- package/lib/sandbox/task-resolver.ts +0 -48
- package/lib/sandbox/tools.ts +1 -5
- package/lib/sandbox/workspace-view.ts +2 -4
- package/lib/server/display.ts +0 -14
- package/lib/server/process-control.ts +1 -1
- package/lib/task/activity-intent.ts +36 -44
- package/lib/task/activity-log.ts +9 -22
- package/lib/task/artifact-command.ts +1 -1
- package/lib/task/artifact-lifecycle.ts +58 -67
- package/lib/task/artifact-name.ts +0 -7
- package/lib/task/artifact-operations.ts +3 -3
- package/lib/task/capabilities.ts +5 -6
- package/lib/task/commands/log.ts +0 -7
- package/lib/task/commands/status.ts +14 -79
- package/lib/task/commit-operation.ts +29 -51
- package/lib/task/completion-facts.ts +45 -42
- package/lib/task/control-authority.ts +27 -317
- package/lib/task/control-recovery.ts +2 -5
- package/lib/task/create.ts +2 -5
- package/lib/task/decision-intents.ts +5 -5
- package/lib/task/delivery-target.ts +0 -40
- package/lib/task/events.ts +89 -123
- package/lib/task/finalization.ts +52 -15
- package/lib/task/ledger-intents.ts +1 -1
- package/lib/task/lifecycle-execution.ts +37 -89
- package/lib/task/lifecycle.ts +48 -44
- package/lib/task/local-artifact-finalization.ts +0 -7
- package/lib/task/manual-validation-evidence.ts +1 -47
- package/lib/task/platform-operation-recovery.ts +117 -104
- package/lib/task/pr-delivery-fact.ts +2 -11
- package/lib/task/qualification-confirmation.ts +6 -6
- package/lib/task/resolve-ref.ts +0 -23
- package/lib/task/review-command.ts +2 -2
- package/lib/task/review-finalization.ts +1 -27
- package/lib/task/review-fingerprint.ts +0 -8
- package/lib/task/secure-fs.ts +0 -42
- package/lib/task/short-id.ts +0 -43
- package/lib/task/skill-scope.ts +0 -1
- package/lib/task/verification-engine.ts +56 -287
- package/lib/task/verification.ts +5 -5
- package/lib/task/write.ts +12 -1
- package/package.json +2 -2
- package/templates/.agents/README.en.md +1 -3
- package/templates/.agents/README.zh-CN.md +0 -2
- package/templates/.agents/rules/README.en.md +0 -1
- package/templates/.agents/rules/README.zh-CN.md +0 -1
- package/templates/.agents/rules/commit-and-pr.en.md +1 -1
- package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.en.md +0 -10
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +0 -10
- package/templates/.agents/rules/pr-sync.en.md +4 -2
- package/templates/.agents/rules/pr-sync.zh-CN.md +6 -9
- package/templates/.agents/rules/task-management.en.md +3 -3
- package/templates/.agents/rules/task-management.zh-CN.md +3 -3
- package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
- 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/code-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/commit/SKILL.en.md +2 -2
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +6 -6
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +6 -6
- 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/complete-manual-validation/reference/summary-update.en.md +2 -2
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +2 -2
- package/templates/.agents/skills/complete-task/SKILL.en.md +10 -25
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +11 -26
- package/templates/.agents/skills/create-pr/SKILL.en.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -2
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -2
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +2 -2
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +2 -2
- package/templates/.agents/skills/create-task/SKILL.en.md +0 -18
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +0 -18
- package/templates/.agents/skills/plan-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-code/SKILL.en.md +5 -5
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-pr/SKILL.en.md +4 -4
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +3 -75
- package/templates/.agents/skills/watch-pr/SKILL.en.md +1 -1
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +3 -3
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +3 -3
- package/templates/.agents/templates/task.en.md +1 -0
- package/templates/.agents/templates/task.zh-CN.md +1 -0
- package/templates/.claude/settings.json +0 -24
- package/templates/.codex/hooks.json +0 -50
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +0 -582
- package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +0 -114
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +0 -237
- package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +0 -443
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +0 -236
- package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +0 -292
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +0 -267
- package/dist/lib/agent-clients/adapters/codex-orchestration.js +0 -466
- package/dist/lib/internal/task-orchestration.js +0 -71
- package/dist/lib/platform/verification.js +0 -6
- package/dist/lib/run/prompt.js +0 -2
- package/dist/lib/sandbox/engines/authority.js +0 -289
- package/dist/lib/task/delegation-receipts.js +0 -410
- package/dist/lib/task/orchestration.js +0 -1233
- package/dist/lib/task/verification-checks.js +0 -9
- package/dist/lib/task/workspace-snapshot.js +0 -121
- package/dist/lifecycle-build-manifest.json +0 -6
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +0 -688
- package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +0 -147
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +0 -349
- package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +0 -506
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +0 -385
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +0 -41
- package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +0 -418
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +0 -354
- package/lib/agent-clients/adapters/codex-orchestration.ts +0 -630
- package/lib/internal/task-orchestration.ts +0 -74
- package/lib/platform/verification.ts +0 -11
- package/lib/run/prompt.ts +0 -1
- package/lib/sandbox/engines/authority.ts +0 -365
- package/lib/task/delegation-receipts.ts +0 -547
- package/lib/task/orchestration.ts +0 -1651
- package/lib/task/verification-checks.ts +0 -10
- package/lib/task/workspace-snapshot.ts +0 -144
- package/templates/.agents/hooks/lifecycle-delegation.js +0 -140
- package/templates/.agents/rules/lifecycle-orchestration.en.md +0 -44
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +0 -44
- package/templates/.agents/skills/run-task/SKILL.en.md +0 -29
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +0 -29
- package/templates/.agents/skills/run-task/config/verify.en.json +0 -10
- package/templates/.agents/skills/run-task/config/verify.zh-CN.json +0 -10
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +0 -24
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +0 -24
- package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +0 -6
- package/templates/.claude/commands/run-task.en.md +0 -8
- package/templates/.claude/commands/run-task.zh-CN.md +0 -8
- package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +0 -3
- package/templates/.opencode/commands/run-task.en.md +0 -11
- package/templates/.opencode/commands/run-task.zh-CN.md +0 -11
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from '../agent-clients/config.ts';
|
|
8
8
|
import { normalizeCustomToolInvocations } from '../agent-clients/custom-tool-invocations.ts';
|
|
9
9
|
import { renderNextStepCommands } from '../agent-clients/next-steps.ts';
|
|
10
|
-
import {
|
|
10
|
+
import { getAgentClientModelSelection } from '../agent-clients/registry.ts';
|
|
11
11
|
import { isAgentClientId } from '../agent-clients/types.ts';
|
|
12
12
|
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
|
|
13
13
|
|
|
14
|
-
const USAGE = 'Usage: agent-infra-internal agent-client <next-steps|model-selection
|
|
14
|
+
const USAGE = 'Usage: agent-infra-internal agent-client <next-steps|model-selection> [options]\n';
|
|
15
15
|
|
|
16
16
|
type ParsedArgs = Readonly<{
|
|
17
17
|
skillName: string;
|
|
@@ -20,14 +20,6 @@ type ParsedArgs = Readonly<{
|
|
|
20
20
|
format: 'text' | 'json';
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
|
-
type LaunchCarrierArgs = Readonly<{
|
|
24
|
-
client: string;
|
|
25
|
-
adapterContext: string;
|
|
26
|
-
stage: string;
|
|
27
|
-
round: number;
|
|
28
|
-
role: string;
|
|
29
|
-
}>;
|
|
30
|
-
|
|
31
23
|
function failure(code: string, message: string): void {
|
|
32
24
|
process.stdout.write(`${JSON.stringify({
|
|
33
25
|
status: 'failed',
|
|
@@ -92,63 +84,6 @@ function parseArgs(args: string[]): ParsedArgs | null {
|
|
|
92
84
|
};
|
|
93
85
|
}
|
|
94
86
|
|
|
95
|
-
function parseLaunchCarrierArgs(args: string[]): LaunchCarrierArgs | null {
|
|
96
|
-
const allowed = new Set(['--client', '--adapter-context', '--stage', '--round', '--role', '--format']);
|
|
97
|
-
const values: Record<string, string> = {};
|
|
98
|
-
const seen = new Set<string>();
|
|
99
|
-
for (let index = 1; index < args.length; index += 1) {
|
|
100
|
-
const flag = args[index]!;
|
|
101
|
-
if (!allowed.has(flag) || seen.has(flag)) {
|
|
102
|
-
failure('AGENT_CLIENT_PAYLOAD_INVALID', `invalid or duplicate option '${flag}'`);
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
const value = args[++index];
|
|
106
|
-
if (!value || value.startsWith('--')) {
|
|
107
|
-
failure('AGENT_CLIENT_PAYLOAD_INVALID', `option '${flag}' requires a value`);
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
seen.add(flag);
|
|
111
|
-
values[flag] = value;
|
|
112
|
-
}
|
|
113
|
-
const round = Number(values['--round']);
|
|
114
|
-
if (!isAgentClientId(values['--client']) || !values['--adapter-context'] || !values['--stage'] || !values['--role']
|
|
115
|
-
|| !Number.isSafeInteger(round) || round < 1 || (values['--format'] ?? 'json') !== 'json') {
|
|
116
|
-
failure('AGENT_CLIENT_PAYLOAD_INVALID', 'launch-carrier requires client, adapter context, stage, positive round, role, and json format');
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
client: values['--client']!,
|
|
121
|
-
adapterContext: values['--adapter-context']!,
|
|
122
|
-
stage: values['--stage']!,
|
|
123
|
-
round,
|
|
124
|
-
role: values['--role']!
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function launchCarrier(args: string[]): void {
|
|
129
|
-
const parsed = parseLaunchCarrierArgs(args);
|
|
130
|
-
if (!parsed) return;
|
|
131
|
-
const createCarrier = getAgentClientAdapter(parsed.client).orchestrationAdapter?.createLaunchCarrier;
|
|
132
|
-
if (!createCarrier) {
|
|
133
|
-
process.stdout.write(`${JSON.stringify({
|
|
134
|
-
status: 'failed', changed: false, client: parsed.client, carrier: null,
|
|
135
|
-
error: { code: 'AGENT_CLIENT_LAUNCH_CARRIER_UNSUPPORTED', message: `Agent Client '${parsed.client}' does not support lifecycle launch carriers` }
|
|
136
|
-
})}\n`);
|
|
137
|
-
process.exitCode = 1;
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
try {
|
|
141
|
-
const carrier = createCarrier(parsed.adapterContext, { stage: parsed.stage, round: parsed.round, role: parsed.role });
|
|
142
|
-
process.stdout.write(`${JSON.stringify({ status: 'ready', changed: false, client: parsed.client, carrier, error: null })}\n`);
|
|
143
|
-
} catch (error) {
|
|
144
|
-
process.stdout.write(`${JSON.stringify({
|
|
145
|
-
status: 'failed', changed: false, client: parsed.client, carrier: null,
|
|
146
|
-
error: { code: error instanceof Error && error.name ? error.name : 'AGENT_CLIENT_LAUNCH_CARRIER_INVALID', message: error instanceof Error ? error.message : String(error) }
|
|
147
|
-
})}\n`);
|
|
148
|
-
process.exitCode = 1;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
87
|
function modelSelection(args: string[]): void {
|
|
153
88
|
const values: Record<string, string> = {};
|
|
154
89
|
const seen = new Set<string>();
|
|
@@ -245,9 +180,6 @@ function writeNextStepOutput(
|
|
|
245
180
|
|
|
246
181
|
function agentClient(args: string[] = []): void {
|
|
247
182
|
if (!ensureInternalHandlerRoute('agent-client', args)) return;
|
|
248
|
-
if (internalHandlerRoute('agent-client', 'launch-carrier', args[0] ?? '')) {
|
|
249
|
-
return launchCarrier(args);
|
|
250
|
-
}
|
|
251
183
|
if (internalHandlerRoute('agent-client', 'model-selection', args[0] ?? '')) {
|
|
252
184
|
return modelSelection(args);
|
|
253
185
|
}
|
|
@@ -36,8 +36,7 @@ export const INTERNAL_HANDLER_ROUTE_SELECTORS = Object.freeze({
|
|
|
36
36
|
'task-create': ['input'],
|
|
37
37
|
'task-qualification': ['proposal', 'confirm', 'supersede', 'revoke'],
|
|
38
38
|
'sandbox-control': ['serve', 'execute', 'recover', 'client'],
|
|
39
|
-
'agent-client': ['next-steps', 'model-selection'
|
|
40
|
-
'codex-lifecycle': ['preflight', 'hook-event', 'resolve-start', 'resolve-stop', 'consume'],
|
|
39
|
+
'agent-client': ['next-steps', 'model-selection'],
|
|
41
40
|
'git-workflow': ['inspect', 'preview-tree', 'snapshot', 'compare-trees', 'commit', 'push-rebased'],
|
|
42
41
|
'task-delivery': ['deliver'],
|
|
43
42
|
'release-workflow': ['inspect', 'prepare', 'publish', 'post-prepare', 'post-publish'],
|
|
@@ -57,7 +56,6 @@ export const INTERNAL_HANDLER_ROUTE_SELECTORS = Object.freeze({
|
|
|
57
56
|
'task-warning': ['list', 'add', 'set-status'],
|
|
58
57
|
'task-activity': ['pr-review-inspect', 'pr-review-start', 'pr-review-complete', 'pr-review-terminate'],
|
|
59
58
|
'task-artifact': ['inspect', 'init', 'preflight', 'finalize-local'],
|
|
60
|
-
'task-orchestration': ['status', 'progress'],
|
|
61
59
|
'task-review': ['preflight', 'finalize-summary'],
|
|
62
60
|
'task-event': ['event'],
|
|
63
61
|
'task-lifecycle': ['intent'],
|
|
@@ -95,7 +93,6 @@ export function internalRouteSelector(command: string, args: readonly string[]):
|
|
|
95
93
|
if (command === 'task-snapshot') return 'snapshot';
|
|
96
94
|
if (command === 'task-validate') return optionValue(args, '--scope') ?? 'snapshot';
|
|
97
95
|
if (command === 'task-short-id') return first(args) === 'list' && args.includes('--verify') ? 'list-verify' : first(args);
|
|
98
|
-
if (command === 'task-orchestration') return args[1] === 'status' ? 'status' : args[1] ? 'progress' : '';
|
|
99
96
|
if (command === 'task-review') return args[1] ?? '';
|
|
100
97
|
if (command === 'task-artifact') return args[1] ?? '';
|
|
101
98
|
if (command === 'platform-pr-review' && first(args) === 'publish') {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { activityWarnings } from '../task/activity-log.ts';
|
|
5
|
+
import { lifecycleExecutions } from '../task/lifecycle-execution.ts';
|
|
5
6
|
import { resolveTaskRef } from '../task/resolve-ref.ts';
|
|
7
|
+
import { prepareAndRenderPrSummaryContent } from '../platform/pr-summary.ts';
|
|
6
8
|
import { applyTaskEvent } from '../task/events.ts';
|
|
7
9
|
import { normalizeAgentToken } from '../agent-clients/tokens.ts';
|
|
8
|
-
import {
|
|
10
|
+
import { createManualValidationReceipt, manualValidationFinalSummaryDigest, manualValidationFinalSummaryProjectionMatches, readManualValidationReceipt, writeManualValidationReceiptAtomic } from '../task/manual-validation-receipt.ts';
|
|
9
11
|
import { archiveManualValidationGeneration, createManualValidationTransaction, readManualValidationTransaction, retryManualValidationTransaction, summaryPreimageDigest, transitionManualValidationTransaction, validateManualValidationGenerationArchive, writeManualValidationTransactionAtomic } from '../task/manual-validation-transaction.ts';
|
|
10
12
|
import type { ManualValidationTransaction } from '../task/manual-validation-transaction.ts';
|
|
11
13
|
import type { ManualValidationReceipt } from '../task/manual-validation-receipt.ts';
|
|
@@ -42,38 +44,28 @@ function printFailure(format: OutputFormat, error: { code: string; message: stri
|
|
|
42
44
|
process.exitCode = 1;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
const MANUAL_VALIDATION_STATUS_HEADING = /^###\s+(?:⚠️\s+(?:需人工校验|Manual Validation Required)|✅\s+(?:人工验证已通过|无需人工校验|Manual Validation Passed|No Manual Validation Required)|⏳\s+(?:人工验证待收尾|Manual Validation Pending))\s*$/mu;
|
|
46
|
-
|
|
47
47
|
function manualSummaryBody(body: string, phase: 'pending' | 'final'): string {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return `${body.replace(MANUAL_VALIDATION_STATUS_HEADING, `${heading}${marker}`).replace(/\s+$/u, '')}\n`;
|
|
57
|
-
}
|
|
58
|
-
const fallback = phase === 'pending'
|
|
59
|
-
? chinese ? '人工验证正在等待最终完成。' : 'Manual validation is awaiting final promotion.'
|
|
60
|
-
: chinese ? '人工验证已通过。' : 'Manual validation passed.';
|
|
61
|
-
return `${body.replace(/\s+$/u, '')}\n\n${heading}${marker}\n\n${fallback}\n`;
|
|
48
|
+
const content = JSON.parse(body) as Record<string, unknown>;
|
|
49
|
+
const manual = content.manualValidation as Record<string, unknown>;
|
|
50
|
+
manual.state = phase === 'pending' ? 'pending' : 'passed';
|
|
51
|
+
return JSON.stringify(content);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function renderedManualSummaryBody(body: string, phase: 'pending' | 'final', taskContent: string): string {
|
|
55
|
+
return prepareAndRenderPrSummaryContent(JSON.parse(manualSummaryBody(body, phase)), taskContent).rendered;
|
|
62
56
|
}
|
|
63
57
|
|
|
64
58
|
function openManualValidationStarted(taskMdPath: string): { present: boolean; transactionId: string | null } {
|
|
65
59
|
let content: string;
|
|
66
60
|
try { content = fs.readFileSync(taskMdPath, 'utf8'); }
|
|
67
61
|
catch { return { present: false, transactionId: null }; }
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const row = pairEntries(section.entries)
|
|
71
|
-
.filter((item) => item.step === 'Complete Manual Validation' && item.started && !item.done)
|
|
62
|
+
const row = lifecycleExecutions(content)
|
|
63
|
+
.filter((item) => item.family === 'manual-validation')
|
|
72
64
|
.at(-1);
|
|
73
65
|
if (!row) return { present: false, transactionId: null };
|
|
74
66
|
return {
|
|
75
67
|
present: true,
|
|
76
|
-
transactionId:
|
|
68
|
+
transactionId: row.transactionId ?? null
|
|
77
69
|
};
|
|
78
70
|
}
|
|
79
71
|
|
|
@@ -112,6 +104,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
112
104
|
const preimage = { commentId: currentState.comment?.id ?? null, body: preimageBody, digest: summaryPreimageDigest(preimageBody) };
|
|
113
105
|
const summaryPath = path.resolve(cwd, values.summaryFile!);
|
|
114
106
|
const finalBodyWithoutReceipt = fs.readFileSync(summaryPath, 'utf8');
|
|
107
|
+
const taskContent = fs.readFileSync(resolved.taskMdPath, 'utf8');
|
|
115
108
|
const evidenceDigest = sha256File(summaryPath);
|
|
116
109
|
const archiveGeneration = options.archiveGeneration ?? archiveManualValidationGeneration;
|
|
117
110
|
let transactionResult = readManualValidationTransaction(resolved.taskDir, { taskId: resolved.taskId, prNumber: pullRequest.number, prHeadSha: pullRequest.head.sha, evidenceDigest, artifact: values.artifact! });
|
|
@@ -126,7 +119,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
126
119
|
transactionResult = { ok: false, error: { code: 'MANUAL_VALIDATION_TRANSACTION_MISSING', message: 'previous failed transaction was archived for a new pull-request head' } };
|
|
127
120
|
}
|
|
128
121
|
if (!transactionResult.ok && transactionResult.error.code !== 'MANUAL_VALIDATION_TRANSACTION_MISSING') return result('failed', transactionResult.error);
|
|
129
|
-
if (transactionResult.ok && transactionResult.value.phase === 'committed') return result('applied', null, { transaction: transactionResult.value, receipt: transactionResult.value.committedReceipt, idempotent: true });
|
|
122
|
+
if (transactionResult.ok && transactionResult.value.phase === 'committed') return result('applied', null, { transaction: transactionResult.value, receipt: transactionResult.value.committedReceipt, idempotent: true, warnings: activityWarnings(taskContent) });
|
|
130
123
|
const openStarted = transactionResult.ok ? { present: false, transactionId: null } : openManualValidationStarted(resolved.taskMdPath);
|
|
131
124
|
if (openStarted.present && !openStarted.transactionId) {
|
|
132
125
|
return result('failed', { code: 'MANUAL_VALIDATION_TRANSACTION_RECOVERY_REQUIRED', message: 'open manual-validation started event has no recoverable transactionId' });
|
|
@@ -146,7 +139,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
146
139
|
evidenceDigest,
|
|
147
140
|
summaryPreimage: preimage,
|
|
148
141
|
pendingSummaryDigest: summaryPreimageDigest(pendingBody),
|
|
149
|
-
finalSummaryDigest: manualValidationFinalSummaryDigest(
|
|
142
|
+
finalSummaryDigest: manualValidationFinalSummaryDigest(renderedManualSummaryBody(finalBodyWithoutReceipt, 'final', taskContent)),
|
|
150
143
|
artifact: values.artifact!,
|
|
151
144
|
attempt: 1,
|
|
152
145
|
createdAt: new Date().toISOString(),
|
|
@@ -154,11 +147,16 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
154
147
|
});
|
|
155
148
|
let transaction: ManualValidationTransaction;
|
|
156
149
|
const idempotent = transactionResult.ok;
|
|
150
|
+
const warnings: { code: string; message: string }[] = [];
|
|
151
|
+
const currentWarnings = () => warnings.length
|
|
152
|
+
? warnings.filter((warning, index) => warnings.findIndex((item) => item.code === warning.code && item.message === warning.message) === index)
|
|
153
|
+
: activityWarnings(taskContent);
|
|
157
154
|
let startedEventApplied = false;
|
|
158
155
|
if (!transactionResult.ok) {
|
|
159
156
|
transaction = createTransaction();
|
|
160
157
|
const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transactionId, reasonCode: 'user-request', transactionId }, { repoRoot: cwd });
|
|
161
158
|
if (started.status === 'failed') return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
|
|
159
|
+
warnings.push(...(started.warnings ?? []));
|
|
162
160
|
startedEventApplied = true;
|
|
163
161
|
if (previousTransaction) {
|
|
164
162
|
try { archiveGeneration(resolved.taskDir, previousTransaction, previousTransaction.phase === 'committed'); }
|
|
@@ -177,8 +175,9 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
177
175
|
if (transaction.phase === 'prepared' && !startedEventApplied) {
|
|
178
176
|
const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', transactionId: transaction.transactionId }, { repoRoot: cwd });
|
|
179
177
|
if (started.status === 'failed') return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
|
|
178
|
+
warnings.push(...(started.warnings ?? []));
|
|
180
179
|
}
|
|
181
|
-
if (prepareOnly) return result('applied', null, { transaction, prepared: true, idempotent });
|
|
180
|
+
if (prepareOnly) return result('applied', null, { transaction, prepared: true, idempotent, warnings: currentWarnings() });
|
|
182
181
|
const transactionFailure = (failure: { code: string; message: string }): never => {
|
|
183
182
|
throw new Error(`${failure.code}: ${failure.message}`);
|
|
184
183
|
};
|
|
@@ -233,6 +232,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
233
232
|
if (transaction.phase === 'receipt-committed' && !transaction.eventAppended) {
|
|
234
233
|
const completed = applyTaskEvent({ taskRef, event: 'manual-validation.completed', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', artifact: values.artifact, summaryResult: 'human-confirmed validation and committed receipt', transactionId: transaction.transactionId, receiptDigest: receipt.receiptDigest, prHeadSha: receipt.prHeadSha }, { repoRoot: cwd });
|
|
235
234
|
if (completed.status === 'failed') transactionFailure(completed.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation completion event failed' });
|
|
235
|
+
warnings.push(...(completed.warnings ?? []));
|
|
236
236
|
transitionAndPersist('receipt-committed', { eventAppended: true });
|
|
237
237
|
}
|
|
238
238
|
if (transaction.phase === 'receipt-committed') {
|
|
@@ -246,7 +246,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
246
246
|
const postWrite = await summaryCommentState(taskRef, { cwd, client: options.client });
|
|
247
247
|
if (!/^###\s+✅\s+(?:Manual Validation Passed|人工验证已通过)\s*$/mu.test(postWrite.comment?.body ?? '') || postWrite.pullRequest?.head.sha !== receipt.prHeadSha || !manualValidationFinalSummaryProjectionMatches(postWrite.comment?.body ?? '', receipt)) transactionFailure({ code: 'MANUAL_VALIDATION_TRANSACTION_RECOVERY_REQUIRED', message: 'final summary post-write verification failed' });
|
|
248
248
|
transitionAndPersist('committed', { postWriteVerified: true });
|
|
249
|
-
return result('applied', null, { transaction, receipt, idempotent: false });
|
|
249
|
+
return result('applied', null, { transaction, receipt, idempotent: false, warnings: currentWarnings() });
|
|
250
250
|
} catch (error) {
|
|
251
251
|
const message = error instanceof Error ? error.message : String(error);
|
|
252
252
|
if (transaction.phase === 'final-promotion-in-progress') {
|
|
@@ -298,6 +298,7 @@ async function manualValidation(args: string[] = []): Promise<void> {
|
|
|
298
298
|
const format = values.format === 'text' ? 'text' : 'json';
|
|
299
299
|
const output = await executeManualValidationTransaction(taskRef, values, path.resolve(values.cwd ?? process.cwd()));
|
|
300
300
|
process.stdout.write(format === 'json' ? `${JSON.stringify(output)}\n` : `${output.status === 'applied' ? 'Manual validation transaction committed.' : `${output.error?.code}: ${output.error?.message}`}\n`);
|
|
301
|
+
if (format === 'text' && Array.isArray(output.warnings)) for (const warning of output.warnings) process.stderr.write(`${warning.code}: ${warning.message}\n`);
|
|
301
302
|
if (output.status === 'failed') process.exitCode = 1;
|
|
302
303
|
}
|
|
303
304
|
|
|
@@ -17,6 +17,9 @@ import { recoverTaskFromComments } from '../platform/task-recovery.ts';
|
|
|
17
17
|
import { backfillCompletionComments } from '../platform/completion-backfill.ts';
|
|
18
18
|
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
|
|
19
19
|
import { resolveTaskRef } from '../task/resolve-ref.ts';
|
|
20
|
+
import { enumerateArtifacts } from '../task/artifacts.ts';
|
|
21
|
+
import { parseTaskFrontmatter } from '../task/frontmatter.ts';
|
|
22
|
+
import { prepareAndRenderCancelSummaryContent, prepareAndRenderDeliverySummaryContent } from '../platform/issue-summary-content.ts';
|
|
20
23
|
|
|
21
24
|
const USAGE = `Usage: agent-infra-internal platform-comment list --issue <token> [--cwd <path>]
|
|
22
25
|
agent-infra-internal platform-comment recover --issue <token> --task-id <TASK-id> --output <staging-task.md> [--cwd <path>]
|
|
@@ -158,13 +161,26 @@ async function platformComment(args: string[] = []): Promise<void> {
|
|
|
158
161
|
let body: string;
|
|
159
162
|
try { body = readBodyFile(parsed.values.bodyFile, cwd); }
|
|
160
163
|
catch (error) { fail(`unable to read body file: ${error instanceof Error ? error.message : String(error)}`); return; }
|
|
161
|
-
const canonical = canonicalizeSummaryBody(body);
|
|
162
|
-
if (!canonical.ok) { fail(`unable to stage summary: ${canonical.error.code}: ${canonical.error.message}`); return; }
|
|
163
|
-
body = canonical.value;
|
|
164
164
|
const resolved = resolveTaskRef(taskRef!, { repoRoot: cwd });
|
|
165
165
|
if (!resolved.ok || resolved.state !== 'active') { fail('stage-summary requires an active task'); return; }
|
|
166
166
|
const target = path.join(resolved.taskDir, '.delivery-summary.json');
|
|
167
|
-
|
|
167
|
+
let content;
|
|
168
|
+
try {
|
|
169
|
+
const supplied = JSON.parse(body) as Record<string, unknown>;
|
|
170
|
+
const taskContent = fs.readFileSync(resolved.taskMdPath, 'utf8');
|
|
171
|
+
const title = /^#\s+(.+)$/mu.exec(taskContent)?.[1]?.trim();
|
|
172
|
+
const prepared = prepareAndRenderDeliverySummaryContent(supplied, {
|
|
173
|
+
taskId: resolved.taskId,
|
|
174
|
+
title: title || resolved.taskId,
|
|
175
|
+
artifacts: enumerateArtifacts(resolved.taskDir).filter((artifact) => artifact.name !== 'task.md').map((artifact) => artifact.name),
|
|
176
|
+
verificationFallback: { state: 'not-run', detail: 'Final verification has not run at summary staging.' }
|
|
177
|
+
});
|
|
178
|
+
content = prepared.content;
|
|
179
|
+
const canonical = canonicalizeSummaryBody(prepared.rendered);
|
|
180
|
+
if (!canonical.ok) throw new Error(`${canonical.error.code}: ${canonical.error.message}`);
|
|
181
|
+
body = canonical.value;
|
|
182
|
+
} catch (error) { fail(`unable to stage summary: ${error instanceof Error ? error.message : String(error)}`); return; }
|
|
183
|
+
const value = { taskId: resolved.taskId, content, contentSha256: createHash('sha256').update(JSON.stringify(content)).digest('hex') };
|
|
168
184
|
const previous = fs.existsSync(target) ? fs.readFileSync(target, 'utf8') : null;
|
|
169
185
|
const next = `${JSON.stringify(value)}\n`;
|
|
170
186
|
if (previous === next) {
|
|
@@ -199,6 +215,32 @@ async function platformComment(args: string[] = []): Promise<void> {
|
|
|
199
215
|
fail(`unable to read body file: ${error instanceof Error ? error.message : String(error)}`);
|
|
200
216
|
return;
|
|
201
217
|
}
|
|
218
|
+
if (kind === 'summary' || kind === 'cancel') {
|
|
219
|
+
try {
|
|
220
|
+
const input = JSON.parse(body!) as Record<string, unknown>;
|
|
221
|
+
const resolved = resolveTaskRef(taskRef!, { repoRoot: cwd });
|
|
222
|
+
if (!resolved.ok) throw new Error(resolved.message);
|
|
223
|
+
const taskContent = fs.readFileSync(resolved.taskMdPath, 'utf8');
|
|
224
|
+
const taskFrontmatter = parseTaskFrontmatter(taskContent);
|
|
225
|
+
const title = /^#\s+(.+)$/mu.exec(taskContent)?.[1]?.trim();
|
|
226
|
+
const artifacts = enumerateArtifacts(resolved.taskDir).filter((artifact) => artifact.name !== 'task.md').map((artifact) => artifact.name);
|
|
227
|
+
const rendered = kind === 'summary'
|
|
228
|
+
? prepareAndRenderDeliverySummaryContent(input, {
|
|
229
|
+
taskId: resolved.taskId,
|
|
230
|
+
title: title || resolved.taskId,
|
|
231
|
+
artifacts,
|
|
232
|
+
...(resolved.state === 'active' ? { verificationFallback: { state: 'not-run', detail: 'Final verification has not run at summary staging.' } } : {})
|
|
233
|
+
}).rendered
|
|
234
|
+
: prepareAndRenderCancelSummaryContent(input, {
|
|
235
|
+
taskId: resolved.taskId,
|
|
236
|
+
title: title || resolved.taskId,
|
|
237
|
+
reason: typeof taskFrontmatter.cancel_reason === 'string' ? taskFrontmatter.cancel_reason : '',
|
|
238
|
+
cancelledAt: typeof taskFrontmatter.cancelled_at === 'string' ? taskFrontmatter.cancelled_at : '',
|
|
239
|
+
lastCompletedArtifact: artifacts.at(-1) ?? null
|
|
240
|
+
}).rendered;
|
|
241
|
+
body = rendered;
|
|
242
|
+
} catch (error) { fail(`invalid ${kind} summary structure: ${error instanceof Error ? error.message : String(error)}`); return; }
|
|
243
|
+
}
|
|
202
244
|
finish(await syncPlatformComment(taskRef!, {
|
|
203
245
|
kind: kind as CommentKind,
|
|
204
246
|
agent: normalizedAgent,
|
|
@@ -4,7 +4,7 @@ import type { TaskEventRequest, Verdict } from '../task/events.ts';
|
|
|
4
4
|
import { resolveTaskRef } from '../task/resolve-ref.ts';
|
|
5
5
|
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
|
|
6
6
|
|
|
7
|
-
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--
|
|
7
|
+
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--dry-run]
|
|
8
8
|
|
|
9
9
|
Apply one closed-set task lifecycle event and print a structured JSON result.
|
|
10
10
|
Events: ${eventCatalog.join(', ')}
|
|
@@ -35,10 +35,6 @@ export function parseTaskEventRequest(args: readonly string[]): TaskEventRequest
|
|
|
35
35
|
const seen = new Set<string>();
|
|
36
36
|
for (let index = 2; index < args.length; index += 1) {
|
|
37
37
|
const flag = args[index]!;
|
|
38
|
-
if (flag === '--orchestrated') {
|
|
39
|
-
if (seen.has(flag)) throw new Error(`duplicate option '${flag}'`);
|
|
40
|
-
seen.add(flag); request.orchestrated = true; continue;
|
|
41
|
-
}
|
|
42
38
|
if (flag === '--dry-run') {
|
|
43
39
|
if (seen.has(flag)) throw new Error(`duplicate option '${flag}'`);
|
|
44
40
|
seen.add(flag); request.dryRun = true; continue;
|
|
@@ -6,12 +6,10 @@ import {
|
|
|
6
6
|
} from '../task/control-authority.ts';
|
|
7
7
|
import { lifecycleIntentCatalog } from '../task/lifecycle.ts';
|
|
8
8
|
import { detectRepoRoot, resolveTaskRef } from '../task/resolve-ref.ts';
|
|
9
|
-
import type { TaskLifecycleResult } from '../task/lifecycle.ts';
|
|
10
|
-
import type { AgentClientLifecycleRecoveryResult as LifecycleRecoveryResult } from '../agent-clients/adapter.ts';
|
|
11
9
|
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
|
|
12
10
|
import { loadSandboxControlLocation } from '../sandbox/config.ts';
|
|
13
11
|
|
|
14
|
-
const USAGE = `Usage: agent-infra-internal task-lifecycle <N | TASK-id> <intent> --agent <agent> [intent flags] [--dry-run]\n\nIntents: ${lifecycleIntentCatalog.filter((intent) => intent !== 'complete').join(', ')}\
|
|
12
|
+
const USAGE = `Usage: agent-infra-internal task-lifecycle <N | TASK-id> <intent> --agent <agent> [intent flags] [--dry-run]\n\nIntents: ${lifecycleIntentCatalog.filter((intent) => intent !== 'complete').join(', ')}\n`;
|
|
15
13
|
|
|
16
14
|
function usageFailure(message: string): void {
|
|
17
15
|
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'LIFECYCLE_PAYLOAD_INVALID', message } })}\n`);
|
|
@@ -64,9 +62,9 @@ async function taskLifecycle(args: string[] = []): Promise<void> {
|
|
|
64
62
|
const result = await dispatchTaskControlOperation(
|
|
65
63
|
createDirectHostExecutionContext({ repoRoot, ...(controlLocation ?? {}) }),
|
|
66
64
|
operation
|
|
67
|
-
)
|
|
65
|
+
);
|
|
68
66
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
69
|
-
if (result.status === 'failed'
|
|
67
|
+
if (result.status === 'failed') process.exitCode = 1;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
export { taskLifecycle };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
accessSandboxTaskView,
|
|
6
|
-
parseSandboxTaskView,
|
|
7
5
|
taskViewFromStatus,
|
|
8
6
|
type SandboxTaskView,
|
|
9
7
|
type TaskViewAccessEffect
|
|
@@ -14,7 +12,7 @@ import {
|
|
|
14
12
|
PUBLIC_CLI_SELECTOR_ALIASES,
|
|
15
13
|
internalRouteSelector
|
|
16
14
|
} from './cli-route-inventory.ts';
|
|
17
|
-
import { hasSandboxControlMarker,
|
|
15
|
+
import { hasSandboxControlMarker, sandboxTaskMarkerState } from '../sandbox/environment.ts';
|
|
18
16
|
export { resolveSandboxControlTransport } from '../sandbox/environment.ts';
|
|
19
17
|
|
|
20
18
|
export type TaskOperationDispatcher = 'public' | 'internal';
|
|
@@ -54,12 +52,6 @@ function internalTaskRoutes(): TaskOperationDescriptor[] {
|
|
|
54
52
|
descriptor('internal', 'sandbox-control', 'client', 'conditional', 'progress', 'delegated'),
|
|
55
53
|
descriptor('internal', 'agent-client', 'next-steps', 'non-task', 'diagnostic', 'none'),
|
|
56
54
|
descriptor('internal', 'agent-client', 'model-selection', 'non-task', 'diagnostic', 'none'),
|
|
57
|
-
descriptor('internal', 'agent-client', 'launch-carrier', 'non-task', 'diagnostic', 'none'),
|
|
58
|
-
descriptor('internal', 'codex-lifecycle', 'preflight', 'non-task', 'diagnostic', 'none'),
|
|
59
|
-
descriptor('internal', 'codex-lifecycle', 'hook-event', 'conditional', 'progress'),
|
|
60
|
-
descriptor('internal', 'codex-lifecycle', 'resolve-start', 'conditional', 'progress'),
|
|
61
|
-
descriptor('internal', 'codex-lifecycle', 'resolve-stop', 'conditional', 'progress'),
|
|
62
|
-
descriptor('internal', 'codex-lifecycle', 'consume', 'conditional', 'progress'),
|
|
63
55
|
descriptor('internal', 'git-workflow', 'inspect', 'conditional', 'diagnostic'),
|
|
64
56
|
descriptor('internal', 'git-workflow', 'preview-tree', 'conditional', 'diagnostic'),
|
|
65
57
|
descriptor('internal', 'git-workflow', 'snapshot', 'conditional', 'diagnostic'),
|
|
@@ -132,8 +124,6 @@ function internalTaskRoutes(): TaskOperationDescriptor[] {
|
|
|
132
124
|
descriptor('internal', 'task-artifact', 'init', 'task-bound', 'artifact-write'),
|
|
133
125
|
descriptor('internal', 'task-artifact', 'preflight', 'task-bound', 'artifact-write'),
|
|
134
126
|
descriptor('internal', 'task-artifact', 'finalize-local', 'task-bound', 'artifact-write'),
|
|
135
|
-
descriptor('internal', 'task-orchestration', 'status', 'task-bound', 'diagnostic'),
|
|
136
|
-
descriptor('internal', 'task-orchestration', 'progress', 'task-bound', 'progress'),
|
|
137
127
|
descriptor('internal', 'task-review', 'preflight', 'task-bound', 'artifact-write'),
|
|
138
128
|
descriptor('internal', 'task-review', 'finalize-summary', 'task-bound', 'progress'),
|
|
139
129
|
descriptor('internal', 'task-event', 'event', 'task-bound', 'progress'),
|
|
@@ -212,11 +202,11 @@ export const TASK_OPERATION_DESCRIPTORS = Object.freeze([
|
|
|
212
202
|
]);
|
|
213
203
|
|
|
214
204
|
export const INTERNAL_DISPATCHER_ROUTES = Object.freeze([
|
|
215
|
-
'task-create', 'task-qualification', 'sandbox-control', 'agent-client',
|
|
205
|
+
'task-create', 'task-qualification', 'sandbox-control', 'agent-client',
|
|
216
206
|
'git-workflow', 'task-delivery', 'release-workflow', 'platform-release-notes', 'platform-security', 'platform-metadata', 'platform-context',
|
|
217
207
|
'platform-comment', 'platform-issue', 'platform-pr', 'platform-pr-review', 'pr-review-grade',
|
|
218
208
|
'platform-checks', 'task-context', 'task-workspace', 'task-ledger', 'task-warning', 'task-activity', 'task-artifact',
|
|
219
|
-
'task-
|
|
209
|
+
'task-review', 'task-event', 'task-lifecycle',
|
|
220
210
|
'task-finalization', 'task-platform-recovery', 'task-short-id', 'task-snapshot', 'task-verify', 'task-validate', 'manual-validation'
|
|
221
211
|
]);
|
|
222
212
|
export const PUBLIC_DISPATCHER_ROUTES = Object.freeze([
|
|
@@ -271,7 +261,6 @@ export function resolveTaskOperation(
|
|
|
271
261
|
export function resolveDelegatedTaskOperation(args: readonly string[]): TaskOperationDescriptor | null {
|
|
272
262
|
const [operation, ...rest] = args;
|
|
273
263
|
if (operation !== 'client' || !rest[0]) return null;
|
|
274
|
-
if (rest[0] === 'task-orchestration') return null;
|
|
275
264
|
return resolveTaskOperation('internal', rest[0], rest.slice(1));
|
|
276
265
|
}
|
|
277
266
|
|
|
@@ -298,7 +287,6 @@ function explicitTaskRefForOperation(
|
|
|
298
287
|
}
|
|
299
288
|
return command === 'merge' ? null : first(args) || null;
|
|
300
289
|
}
|
|
301
|
-
if (command === 'codex-lifecycle') return optionValue(args, '--task-id') ?? null;
|
|
302
290
|
if (command === 'platform-comment' || command === 'platform-issue') {
|
|
303
291
|
return first(args) === 'list' ? null : args[1] ?? null;
|
|
304
292
|
}
|
|
@@ -449,7 +437,3 @@ export function guardTaskOperation(
|
|
|
449
437
|
}
|
|
450
438
|
return { descriptor: selected, taskView };
|
|
451
439
|
}
|
|
452
|
-
|
|
453
|
-
export function assertTaskViewStatus(value: unknown): SandboxTaskView {
|
|
454
|
-
return parseSandboxTaskView(value);
|
|
455
|
-
}
|
|
@@ -3,7 +3,7 @@ import { finalizeReviewSummary, preflightReviewSummary } from '../task/review-fi
|
|
|
3
3
|
import { resolveTaskRef } from '../task/resolve-ref.ts';
|
|
4
4
|
import { ensureInternalHandlerRoute } from './cli-route-inventory.ts';
|
|
5
5
|
|
|
6
|
-
const USAGE = 'Usage: agent-infra-internal task-review <task-ref> <preflight|finalize-summary> --stage <analysis|plan|code> --artifact <review-*.md> [--
|
|
6
|
+
const USAGE = 'Usage: agent-infra-internal task-review <task-ref> <preflight|finalize-summary> --stage <analysis|plan|code> --artifact <review-*.md> [--dry-run]\n';
|
|
7
7
|
|
|
8
8
|
function failUsage(message: string): void {
|
|
9
9
|
process.stdout.write(`${JSON.stringify({
|
|
@@ -25,13 +25,13 @@ async function taskReview(args: string[] = []): Promise<void> {
|
|
|
25
25
|
let request;
|
|
26
26
|
try { request = parseReviewCommand(args); }
|
|
27
27
|
catch (error) { failUsage(error instanceof Error ? error.message : String(error)); return; }
|
|
28
|
-
const { stage, artifact, dryRun
|
|
28
|
+
const { stage, artifact, dryRun } = request;
|
|
29
29
|
const operation = args[1]!;
|
|
30
30
|
const resolved = resolveTaskRef(args[0]!);
|
|
31
31
|
if (!resolved.ok) { failUsage(resolved.message); return; }
|
|
32
32
|
const result = operation === 'preflight'
|
|
33
|
-
? preflightReviewSummary({ taskRef: args[0]!, stage, artifact,
|
|
34
|
-
: finalizeReviewSummary({ taskRef: args[0]!, stage, artifact,
|
|
33
|
+
? preflightReviewSummary({ taskRef: args[0]!, stage, artifact, dryRun })
|
|
34
|
+
: finalizeReviewSummary({ taskRef: args[0]!, stage, artifact, dryRun });
|
|
35
35
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
36
36
|
if (result.status === 'failed') process.exitCode = 1;
|
|
37
37
|
}
|
|
@@ -94,14 +94,6 @@ function escapeHtmlText(value: string): string {
|
|
|
94
94
|
return escapeHtml(value);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function escapeHtmlAttribute(value: string): string {
|
|
98
|
-
return escapeHtml(value);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function escapeMarkdownLiteral(value: string): string {
|
|
102
|
-
return value.replace(/[\\`*_{}\[\]()#+.!|<>-]/g, '\\$&');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
97
|
function markerSafe(value: string, markers: readonly RegExp[]): string {
|
|
106
98
|
let result = value;
|
|
107
99
|
for (const marker of markers) {
|
|
@@ -250,9 +242,7 @@ function splitDocumentPlaceholder(value: string, placeholder: string): Sanitizat
|
|
|
250
242
|
|
|
251
243
|
export {
|
|
252
244
|
CONTROL_MARKER_PATTERN,
|
|
253
|
-
escapeHtmlAttribute,
|
|
254
245
|
escapeHtmlText,
|
|
255
|
-
escapeMarkdownLiteral,
|
|
256
246
|
fenceRanges,
|
|
257
247
|
renderSafeCodeFence,
|
|
258
248
|
canonicalizeCommentBody,
|
|
@@ -15,7 +15,6 @@ import type {
|
|
|
15
15
|
ChangeRequestSnapshot,
|
|
16
16
|
CheckLogSnapshot,
|
|
17
17
|
CheckRunSnapshot,
|
|
18
|
-
GitEvidenceSnapshot,
|
|
19
18
|
IssueSnapshot,
|
|
20
19
|
LabelReconciliation,
|
|
21
20
|
MutationReceipt,
|
|
@@ -32,7 +31,6 @@ import type {
|
|
|
32
31
|
ReleaseSnapshot,
|
|
33
32
|
RemoteCommentSnapshot,
|
|
34
33
|
ReviewSnapshot,
|
|
35
|
-
SecurityAlertKind,
|
|
36
34
|
SecurityAlertSnapshot,
|
|
37
35
|
VerificationRemoteFacts
|
|
38
36
|
} from './provider-contract.ts';
|
|
@@ -182,16 +182,6 @@ function flattenPages(value: unknown): unknown[] {
|
|
|
182
182
|
return value.flatMap((page) => Array.isArray(page) ? page : [page]);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
function extractRepositoryLabelNames(value: unknown): string[] {
|
|
186
|
-
return flattenPages(value).flatMap((entry) => {
|
|
187
|
-
if (typeof entry === 'string') return [entry];
|
|
188
|
-
if (entry && typeof entry === 'object' && typeof (entry as { name?: unknown }).name === 'string') {
|
|
189
|
-
return [(entry as { name: string }).name];
|
|
190
|
-
}
|
|
191
|
-
return [];
|
|
192
|
-
}).filter(Boolean).sort();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
185
|
function extractPullRequestFileNames(value: unknown): string[] | null {
|
|
196
186
|
const entries = flattenPages(value);
|
|
197
187
|
if (!Array.isArray(value) || entries.some((entry) => !entry || typeof entry !== 'object')) return null;
|
|
@@ -200,20 +190,14 @@ function extractPullRequestFileNames(value: unknown): string[] | null {
|
|
|
200
190
|
return [...new Set(names as string[])].sort();
|
|
201
191
|
}
|
|
202
192
|
|
|
203
|
-
function resourceSnapshot(kind: InLabelResource['kind'], number: number, labels: readonly string[]): InLabelResource {
|
|
204
|
-
return { kind, number, labels: [...labels].sort() };
|
|
205
|
-
}
|
|
206
|
-
|
|
207
193
|
export {
|
|
208
194
|
extractPullRequestFileNames,
|
|
209
|
-
extractRepositoryLabelNames,
|
|
210
195
|
flattenPages,
|
|
211
196
|
inLabels,
|
|
212
197
|
inLabelMappingDigest,
|
|
213
198
|
labelDelta,
|
|
214
199
|
mergeInLabels,
|
|
215
200
|
planInLabelUpdate,
|
|
216
|
-
resourceSnapshot,
|
|
217
201
|
syncLabelDelta,
|
|
218
202
|
validateInLabelMapping,
|
|
219
203
|
validateRepositoryLabelPayload
|