@fitlab-ai/agent-infra 0.9.9 → 0.9.11
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 +13 -3
- package/README.zh-CN.md +13 -3
- package/bin/cli.ts +17 -4
- package/dist/bin/cli.js +19 -4
- package/dist/bin/internal-cli.js +55 -4
- package/dist/lib/agent-client.js +0 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +17 -10
- package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-context.js +11 -31
- package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +15 -33
- package/dist/lib/agent-clients/adapters/codex-sandbox.js +72 -11
- package/dist/lib/agent-clients/adapters/index.js +3 -1
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
- package/dist/lib/agent-clients/adapters/traecli.js +65 -0
- package/dist/lib/agent-clients/config.js +14 -99
- package/dist/lib/agent-clients/reconcile.js +1 -11
- package/dist/lib/agent-clients/schema.js +5 -4
- package/dist/lib/agent-clients/tokens.js +7 -17
- package/dist/lib/agent-clients/types.js +2 -1
- package/dist/lib/decide.js +14 -30
- package/dist/lib/defaults.json +9 -0
- package/dist/lib/init.js +2 -2
- package/dist/lib/internal/codex-lifecycle.js +2 -2
- package/dist/lib/internal/codex-sandbox-controller.js +4 -3
- package/dist/lib/internal/release-workflow.js +0 -1
- package/dist/lib/internal/sandbox-control.js +2 -2
- package/dist/lib/internal/task-finalization.js +19 -9
- package/dist/lib/internal/task-ledger.js +8 -2
- package/dist/lib/internal/task-lifecycle.js +17 -93
- package/dist/lib/internal/task-orchestration.js +30 -216
- package/dist/lib/{task/commands/validate.js → internal/task-validate.js} +77 -43
- package/dist/lib/merge.js +205 -103
- package/dist/lib/process-data/normalize.js +2 -9
- package/dist/lib/run/host.js +46 -16
- package/dist/lib/run/tui.js +5 -2
- package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
- package/dist/lib/sandbox/commands/create.js +3 -3
- package/dist/lib/sandbox/commands/enter.js +18 -4
- package/dist/lib/sandbox/config.js +3 -12
- package/dist/lib/sandbox/control/controller-registration.js +4 -2
- package/dist/lib/sandbox/control/executor.js +135 -40
- package/dist/lib/sandbox/control/lifecycle.js +29 -20
- package/dist/lib/sandbox/control/server.js +18 -16
- package/dist/lib/sandbox/mounts.js +3 -2
- package/dist/lib/sandbox/recovery.js +123 -22
- package/dist/lib/sandbox/workspace-identity.js +14 -0
- package/dist/lib/sandbox/workspace-view.js +8 -9
- package/dist/lib/self-update.js +278 -0
- package/dist/lib/server/protocol.js +5 -5
- package/dist/lib/task/activity-log.js +4 -1
- package/dist/lib/task/artifact-lifecycle.js +4 -2
- package/dist/lib/task/codex-orchestration.js +32 -35
- package/dist/lib/task/command-options.js +1 -3
- package/dist/lib/task/commands/cat.js +0 -5
- package/dist/lib/task/commands/decisions.js +76 -92
- package/dist/lib/task/commands/files.js +6 -6
- package/dist/lib/task/commands/grep.js +25 -61
- package/dist/lib/task/commands/issue-body.js +6 -6
- package/dist/lib/task/commands/log.js +25 -10
- package/dist/lib/task/commands/show.js +5 -6
- package/dist/lib/task/commands/status.js +8 -8
- package/dist/lib/task/commit-operation.js +21 -25
- package/dist/lib/task/commit-policy.js +1 -1
- package/dist/lib/task/control-authority.js +431 -0
- package/dist/lib/task/create.js +6 -1
- package/dist/lib/task/current-contract.js +35 -0
- package/dist/lib/task/decision-details.js +263 -0
- package/dist/lib/task/decision-intents.js +5 -2
- package/dist/lib/task/delegation-receipts.js +8 -7
- package/dist/lib/task/events.js +11 -5
- package/dist/lib/task/finalization.js +72 -46
- package/dist/lib/task/index.js +19 -29
- package/dist/lib/task/ledger-intents.js +8 -9
- package/dist/lib/task/ledger.js +13 -6
- package/dist/lib/task/lifecycle.js +16 -0
- package/dist/lib/task/orchestration.js +51 -14
- package/dist/lib/task/review-artifacts.js +31 -12
- package/dist/lib/task/review-finalization.js +19 -6
- package/dist/lib/task/verification-engine.js +38 -18
- package/dist/lib/task/verification-review.js +1 -1
- package/dist/lib/task/workspace-snapshot.js +5 -11
- package/dist/lib/task/write.js +11 -1
- package/dist/lib/update.js +6 -37
- package/dist/lib/version.js +5 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-client.ts +0 -1
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +25 -10
- package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +16 -33
- package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +16 -35
- package/lib/agent-clients/adapters/codex-sandbox.ts +89 -14
- package/lib/agent-clients/adapters/index.ts +3 -1
- package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +66 -0
- package/lib/agent-clients/config.ts +14 -144
- package/lib/agent-clients/reconcile.ts +1 -12
- package/lib/agent-clients/schema.ts +5 -4
- package/lib/agent-clients/tokens.ts +7 -20
- package/lib/agent-clients/types.ts +2 -1
- package/lib/decide.ts +12 -22
- package/lib/defaults.json +9 -0
- package/lib/init.ts +2 -2
- package/lib/internal/codex-lifecycle.ts +2 -2
- package/lib/internal/codex-sandbox-controller.ts +4 -3
- package/lib/internal/release-workflow.ts +0 -1
- package/lib/internal/sandbox-control.ts +2 -2
- package/lib/internal/task-finalization.ts +27 -13
- package/lib/internal/task-ledger.ts +8 -2
- package/lib/internal/task-lifecycle.ts +33 -76
- package/lib/internal/task-orchestration.ts +33 -190
- package/lib/{task/commands/validate.ts → internal/task-validate.ts} +77 -41
- package/lib/merge.ts +236 -120
- package/lib/process-data/normalize.ts +2 -8
- package/lib/run/host.ts +63 -14
- package/lib/run/tui.ts +5 -3
- package/lib/sandbox/agent-client-reconciler.ts +5 -15
- package/lib/sandbox/commands/create.ts +4 -4
- package/lib/sandbox/commands/enter.ts +24 -4
- package/lib/sandbox/config.ts +2 -14
- package/lib/sandbox/control/container-identity.ts +2 -2
- package/lib/sandbox/control/controller-registration.ts +8 -3
- package/lib/sandbox/control/executor.ts +156 -53
- package/lib/sandbox/control/lifecycle.ts +34 -28
- package/lib/sandbox/control/protocol.ts +1 -3
- package/lib/sandbox/control/server.ts +15 -12
- package/lib/sandbox/control/state.ts +7 -7
- package/lib/sandbox/mounts.ts +4 -3
- package/lib/sandbox/recovery.ts +162 -34
- package/lib/sandbox/tools.ts +1 -1
- package/lib/sandbox/workspace-identity.ts +28 -0
- package/lib/sandbox/workspace-view.ts +14 -10
- package/lib/self-update.ts +341 -0
- package/lib/server/protocol.ts +5 -5
- package/lib/task/activity-log.ts +6 -1
- package/lib/task/artifact-lifecycle.ts +5 -3
- package/lib/task/codex-orchestration.ts +40 -45
- package/lib/task/command-options.ts +1 -2
- package/lib/task/commands/cat.ts +0 -4
- package/lib/task/commands/decisions.ts +80 -75
- package/lib/task/commands/files.ts +6 -6
- package/lib/task/commands/grep.ts +23 -51
- package/lib/task/commands/issue-body.ts +6 -6
- package/lib/task/commands/log.ts +22 -10
- package/lib/task/commands/show.ts +5 -6
- package/lib/task/commands/status.ts +8 -8
- package/lib/task/commit-operation.ts +25 -30
- package/lib/task/commit-policy.ts +1 -2
- package/lib/task/control-authority.ts +563 -0
- package/lib/task/create.ts +6 -1
- package/lib/task/current-contract.ts +49 -0
- package/lib/task/decision-details.ts +340 -0
- package/lib/task/decision-intents.ts +7 -2
- package/lib/task/delegation-receipts.ts +8 -6
- package/lib/task/events.ts +10 -5
- package/lib/task/finalization.ts +84 -42
- package/lib/task/index.ts +19 -28
- package/lib/task/ledger-intents.ts +6 -8
- package/lib/task/ledger.ts +17 -7
- package/lib/task/lifecycle.ts +20 -0
- package/lib/task/orchestration.ts +42 -16
- package/lib/task/review-artifacts.ts +53 -15
- package/lib/task/review-finalization.ts +33 -7
- package/lib/task/verification-engine.ts +33 -21
- package/lib/task/verification-review.ts +1 -1
- package/lib/task/workspace-snapshot.ts +4 -13
- package/lib/task/write.ts +20 -1
- package/lib/update.ts +6 -40
- package/lib/version.ts +6 -1
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.en.md +2 -3
- package/templates/.agents/QUICKSTART.zh-CN.md +2 -3
- package/templates/.agents/README.en.md +5 -3
- package/templates/.agents/README.zh-CN.md +5 -3
- package/templates/.agents/rules/README.en.md +1 -0
- package/templates/.agents/rules/README.zh-CN.md +1 -0
- package/templates/.agents/rules/compatibility-policy.en.md +40 -0
- package/templates/.agents/rules/compatibility-policy.zh-CN.md +40 -0
- package/templates/.agents/rules/create-issue.github.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
- package/templates/.agents/rules/human-decision-context.en.md +9 -7
- package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
- package/templates/.agents/rules/issue-fields.github.en.md +1 -1
- package/templates/.agents/rules/issue-fields.github.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.github.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.github.en.md +1 -1
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +2 -2
- package/templates/.agents/rules/lifecycle-orchestration.en.md +4 -4
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +4 -4
- package/templates/.agents/rules/milestone-inference.github.en.md +1 -1
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +1 -1
- package/templates/.agents/rules/next-step-output.en.md +3 -3
- package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
- package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
- package/templates/.agents/rules/pr-sync.en.md +2 -2
- package/templates/.agents/rules/pr-sync.github.en.md +3 -2
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +3 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +2 -1
- package/templates/.agents/rules/release-commands.github.en.md +6 -0
- package/templates/.agents/rules/release-commands.github.zh-CN.md +6 -0
- package/templates/.agents/rules/review-handshake.en.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/review-method.en.md +1 -0
- package/templates/.agents/rules/review-method.zh-CN.md +1 -0
- package/templates/.agents/rules/task-management.en.md +1 -2
- package/templates/.agents/rules/task-management.zh-CN.md +1 -2
- package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.en.md +1 -1
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +1 -1
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/commit/SKILL.en.md +27 -7
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -5
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -5
- 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/create-pr/SKILL.en.md +15 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +15 -11
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +46 -0
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +46 -0
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
- package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
- package/templates/.agents/skills/create-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/plan-task/SKILL.en.md +5 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -4
- package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +9 -6
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +9 -6
- package/templates/.agents/skills/review-plan/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +7 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +7 -3
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +1 -1
- package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
- package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
- package/templates/.agents/skills/run-task/SKILL.en.md +6 -2
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +6 -2
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +2 -2
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +159 -104
- package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.claude/commands/analyze-task.en.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.en.md +1 -1
- package/templates/.claude/commands/block-task.zh-CN.md +1 -1
- package/templates/.claude/commands/cancel-task.en.md +1 -1
- package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
- package/templates/.claude/commands/check-task.en.md +1 -1
- package/templates/.claude/commands/check-task.zh-CN.md +1 -1
- package/templates/.claude/commands/code-task.en.md +1 -1
- package/templates/.claude/commands/code-task.zh-CN.md +1 -1
- package/templates/.claude/commands/commit.en.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.en.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.en.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/plan-task.en.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/review-analysis.en.md +1 -1
- package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
- package/templates/.claude/commands/review-code.en.md +1 -1
- package/templates/.claude/commands/review-code.zh-CN.md +1 -1
- package/templates/.claude/commands/review-plan.en.md +1 -1
- package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
- package/templates/.claude/commands/run-manual-validation.en.md +1 -1
- package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/run-task.en.md +1 -1
- package/templates/.claude/commands/run-task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.traecli/commands/update-agent-infra.en.md +7 -0
- package/templates/.traecli/commands/update-agent-infra.zh-CN.md +7 -0
- package/dist/lib/builtin-tuis.js +0 -40
- package/lib/builtin-tuis.ts +0 -56
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineAgentClientAdapter } from '../adapter.js';
|
|
2
|
+
import { hostJoin } from '../../sandbox/engines/wsl2-paths.js';
|
|
3
|
+
const traecliAdapter = defineAgentClientAdapter({
|
|
4
|
+
id: 'traecli',
|
|
5
|
+
displayName: 'TraeCode CLI',
|
|
6
|
+
invocation: '/${skillName}',
|
|
7
|
+
capabilities: {
|
|
8
|
+
instructions: { level: 'compatible' },
|
|
9
|
+
skills: { level: 'compatible' },
|
|
10
|
+
commands: { level: 'integrated' },
|
|
11
|
+
hooks: { level: 'compatible' },
|
|
12
|
+
subagents: { level: 'experimental' },
|
|
13
|
+
orchestration: { level: 'experimental' },
|
|
14
|
+
sandbox: { level: 'integrated' },
|
|
15
|
+
verification: { level: 'compatible' }
|
|
16
|
+
},
|
|
17
|
+
modelSelection: {
|
|
18
|
+
kind: 'interactive-only',
|
|
19
|
+
command: '/model',
|
|
20
|
+
guidance: 'Use the host model picker for the complete model and reasoning-effort catalog.'
|
|
21
|
+
},
|
|
22
|
+
delegationEvidence: {
|
|
23
|
+
actualModel: 'unavailable',
|
|
24
|
+
actualReasoningEffort: 'unavailable'
|
|
25
|
+
},
|
|
26
|
+
project: {
|
|
27
|
+
ownedPathPrefixes: ['.traecli/'],
|
|
28
|
+
managed: ['.traecli/commands/'],
|
|
29
|
+
merged: [],
|
|
30
|
+
ejected: [],
|
|
31
|
+
seedCommands: [{
|
|
32
|
+
templates: {
|
|
33
|
+
en: '.traecli/commands/update-agent-infra.en.md',
|
|
34
|
+
'zh-CN': '.traecli/commands/update-agent-infra.zh-CN.md'
|
|
35
|
+
},
|
|
36
|
+
target: '.traecli/commands/update-agent-infra.md'
|
|
37
|
+
}],
|
|
38
|
+
customCommand: {
|
|
39
|
+
target: '.traecli/commands/${skillName}.md',
|
|
40
|
+
frontmatter: {},
|
|
41
|
+
argumentsToken: '$ARGUMENTS'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
sandbox: {
|
|
45
|
+
createTool: ({ home }) => ({
|
|
46
|
+
id: 'traecli',
|
|
47
|
+
name: 'TraeCode CLI',
|
|
48
|
+
install: {
|
|
49
|
+
type: 'shell',
|
|
50
|
+
cmd: 'curl -fsSL https://trae.cn/trae-cli/install_v2.sh | bash'
|
|
51
|
+
},
|
|
52
|
+
sandboxBase: hostJoin(home, '.agent-infra', 'sandboxes', 'traecli'),
|
|
53
|
+
containerMount: '/home/devuser/.trae',
|
|
54
|
+
versionCmd: 'traecli --version',
|
|
55
|
+
setupHint: 'Run traecli login inside the container to authenticate.'
|
|
56
|
+
}),
|
|
57
|
+
aliases: [
|
|
58
|
+
{ name: 'traecli-yolo', command: 'traecli --dangerously-bypass-approvals-and-sandbox; tput ed' },
|
|
59
|
+
{ name: 'ty', command: 'traecli --dangerously-bypass-approvals-and-sandbox; tput ed' }
|
|
60
|
+
],
|
|
61
|
+
hooks: []
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
export { traecliAdapter };
|
|
65
|
+
//# sourceMappingURL=traecli.js.map
|
|
@@ -101,114 +101,29 @@ function serializeAgentClients(state) {
|
|
|
101
101
|
: {})
|
|
102
102
|
}));
|
|
103
103
|
}
|
|
104
|
-
function projectLegacyTuis(value, diagnostics) {
|
|
105
|
-
if (!Array.isArray(value)) {
|
|
106
|
-
return Object.fromEntries(AGENT_CLIENT_IDS.map((id) => [id, true]));
|
|
107
|
-
}
|
|
108
|
-
const enabled = new Set();
|
|
109
|
-
for (const [index, candidate] of value.entries()) {
|
|
110
|
-
if (isAgentClientId(candidate)) {
|
|
111
|
-
enabled.add(candidate);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
diagnostics.push({
|
|
115
|
-
code: 'LEGACY_VALUE_IGNORED',
|
|
116
|
-
path: `tuis[${index}]`
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return Object.fromEntries(AGENT_CLIENT_IDS.map((id) => [id, enabled.has(id)]));
|
|
121
|
-
}
|
|
122
|
-
function projectLegacySandbox(value, diagnostics) {
|
|
123
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
124
|
-
return {
|
|
125
|
-
installed: Object.fromEntries(AGENT_CLIENT_IDS.map((id) => [id, true])),
|
|
126
|
-
clientSignals: new Set(),
|
|
127
|
-
remainingTools: Array.isArray(value) ? [] : undefined
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const installed = new Set();
|
|
131
|
-
const remainingTools = [];
|
|
132
|
-
for (const [index, candidate] of value.entries()) {
|
|
133
|
-
if (isAgentClientId(candidate)) {
|
|
134
|
-
installed.add(candidate);
|
|
135
|
-
}
|
|
136
|
-
else if (typeof candidate === 'string') {
|
|
137
|
-
remainingTools.push(candidate);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
diagnostics.push({
|
|
141
|
-
code: 'LEGACY_VALUE_IGNORED',
|
|
142
|
-
path: `sandbox.tools[${index}]`
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
installed: Object.fromEntries(AGENT_CLIENT_IDS.map((id) => [id, installed.has(id)])),
|
|
148
|
-
clientSignals: installed,
|
|
149
|
-
remainingTools
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function stateFromLegacy(enabled, installed) {
|
|
153
|
-
return Object.fromEntries(AGENT_CLIENT_IDS.map((id) => [
|
|
154
|
-
id,
|
|
155
|
-
{
|
|
156
|
-
enabled: enabled[id],
|
|
157
|
-
installInSandbox: installed[id]
|
|
158
|
-
}
|
|
159
|
-
]));
|
|
160
|
-
}
|
|
161
|
-
function sameCanonicalOrder(value) {
|
|
162
|
-
return Array.isArray(value)
|
|
163
|
-
&& value.every((entry, index) => isRecord(entry) && entry.id === AGENT_CLIENT_IDS[index]);
|
|
164
|
-
}
|
|
165
104
|
function normalizeAgentClients(input) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const hasLegacyTuis = hasOwn(input, 'tuis');
|
|
169
|
-
const sandbox = isRecord(input.sandbox) ? input.sandbox : undefined;
|
|
170
|
-
const hasLegacySandboxTools = sandbox !== undefined && hasOwn(sandbox, 'tools');
|
|
171
|
-
const tuiProjection = projectLegacyTuis(input.tuis, diagnostics);
|
|
172
|
-
const sandboxProjection = projectLegacySandbox(sandbox?.tools, diagnostics);
|
|
173
|
-
if (!hasCanonical) {
|
|
174
|
-
const state = stateFromLegacy(tuiProjection, sandboxProjection.installed);
|
|
175
|
-
return {
|
|
176
|
-
source: 'legacy',
|
|
177
|
-
state,
|
|
178
|
-
canonical: serializeAgentClients(state),
|
|
179
|
-
remainingSandboxTools: sandboxProjection.remainingTools,
|
|
180
|
-
removeLegacyTuis: hasLegacyTuis,
|
|
181
|
-
changed: true,
|
|
182
|
-
diagnostics
|
|
183
|
-
};
|
|
184
|
-
}
|
|
105
|
+
if (!hasOwn(input, 'agentClients'))
|
|
106
|
+
fail('MISSING_AGENT_CLIENT', 'agentClients');
|
|
185
107
|
const state = parseCanonical(input.agentClients);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
108
|
+
for (const [index, id] of AGENT_CLIENT_IDS.entries()) {
|
|
109
|
+
const entry = Array.isArray(input.agentClients) ? input.agentClients[index] : undefined;
|
|
110
|
+
if (!isRecord(entry) || entry.id !== id) {
|
|
111
|
+
fail('INVALID_AGENT_CLIENTS', `agentClients[${index}].id`);
|
|
191
112
|
}
|
|
192
113
|
}
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
114
|
+
if (hasOwn(input, 'tuis'))
|
|
115
|
+
fail('INVALID_AGENT_CLIENTS', 'tuis');
|
|
116
|
+
const sandbox = isRecord(input.sandbox) ? input.sandbox : undefined;
|
|
117
|
+
if (Array.isArray(sandbox?.tools)) {
|
|
118
|
+
for (const [index, tool] of sandbox.tools.entries()) {
|
|
119
|
+
if (isAgentClientId(tool)) {
|
|
120
|
+
fail('INVALID_AGENT_CLIENTS', `sandbox.tools[${index}]`);
|
|
197
121
|
}
|
|
198
122
|
}
|
|
199
123
|
}
|
|
200
124
|
return {
|
|
201
|
-
source: 'canonical',
|
|
202
125
|
state,
|
|
203
|
-
canonical: serializeAgentClients(state)
|
|
204
|
-
remainingSandboxTools: hasLegacySandboxTools
|
|
205
|
-
? sandboxProjection.remainingTools
|
|
206
|
-
: undefined,
|
|
207
|
-
removeLegacyTuis: hasLegacyTuis,
|
|
208
|
-
changed: hasLegacyTuis
|
|
209
|
-
|| sandboxProjection.clientSignals.size > 0
|
|
210
|
-
|| !sameCanonicalOrder(input.agentClients),
|
|
211
|
-
diagnostics
|
|
126
|
+
canonical: serializeAgentClients(state)
|
|
212
127
|
};
|
|
213
128
|
}
|
|
214
129
|
export { AgentClientConfigError, normalizeAgentClients, serializeAgentClients };
|
|
@@ -71,15 +71,6 @@ function planAgentClientReconciliation(input) {
|
|
|
71
71
|
});
|
|
72
72
|
const nextConfig = structuredClone(input.config);
|
|
73
73
|
nextConfig.agentClients = serializeAgentClients(desired);
|
|
74
|
-
delete nextConfig.tuis;
|
|
75
|
-
if (normalized.remainingSandboxTools !== undefined) {
|
|
76
|
-
const sandbox = isRecord(nextConfig.sandbox) ? { ...nextConfig.sandbox } : {};
|
|
77
|
-
sandbox.tools = [
|
|
78
|
-
'agent-infra',
|
|
79
|
-
...normalized.remainingSandboxTools.filter((tool) => tool !== 'agent-infra')
|
|
80
|
-
];
|
|
81
|
-
nextConfig.sandbox = sandbox;
|
|
82
|
-
}
|
|
83
74
|
const existingFiles = isRecord(nextConfig.files) ? nextConfig.files : {};
|
|
84
75
|
const existingBaselines = isRecord(existingFiles.managedBaselines)
|
|
85
76
|
? existingFiles.managedBaselines
|
|
@@ -161,14 +152,13 @@ function planAgentClientReconciliation(input) {
|
|
|
161
152
|
const changed = JSON.stringify(nextConfig) !== JSON.stringify(input.config)
|
|
162
153
|
|| actionableSeed;
|
|
163
154
|
return Object.freeze({
|
|
164
|
-
source: normalized.source,
|
|
165
155
|
before: normalized.state,
|
|
166
156
|
desired,
|
|
167
157
|
nextConfig,
|
|
168
158
|
projectAssets,
|
|
169
159
|
seedOperations: Object.freeze(seedOperations),
|
|
170
160
|
nextSteps,
|
|
171
|
-
diagnostics: Object.freeze([...
|
|
161
|
+
diagnostics: Object.freeze([...custom.diagnostics]),
|
|
172
162
|
changed,
|
|
173
163
|
projectRoot: input.projectRoot,
|
|
174
164
|
configPath: path.join(input.projectRoot, '.agents', '.airc.json')
|
|
@@ -10,14 +10,15 @@ const AGENT_CLIENTS_SCHEMA = {
|
|
|
10
10
|
maxItems: AGENT_CLIENT_IDS.length,
|
|
11
11
|
uniqueItems: true,
|
|
12
12
|
description: 'Canonical Agent Client configuration. Object ID completeness and uniqueness are enforced by the runtime normalizer.',
|
|
13
|
-
|
|
13
|
+
additionalItems: false,
|
|
14
|
+
items: AGENT_CLIENT_IDS.map((id) => ({
|
|
14
15
|
type: 'object',
|
|
15
16
|
additionalProperties: false,
|
|
16
17
|
required: ['id', 'enabled', 'installInSandbox'],
|
|
17
18
|
properties: {
|
|
18
19
|
id: {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const: id,
|
|
21
|
+
type: 'string'
|
|
21
22
|
},
|
|
22
23
|
enabled: {
|
|
23
24
|
type: 'boolean'
|
|
@@ -35,7 +36,7 @@ const AGENT_CLIENTS_SCHEMA = {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
}
|
|
39
|
+
}))
|
|
39
40
|
},
|
|
40
41
|
customTUIs: {
|
|
41
42
|
type: 'array',
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
// Active AI collaborator short tokens — the write-side whitelist for the
|
|
2
2
|
// activity log. Migrated from lib/task/commands/log.ts so that the write-side
|
|
3
|
-
// internal commands and the rendering side share one definition.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
// existing orchestration precedent, and `antigravity-cli` is the active
|
|
8
|
-
// client. `gemini-cli` is intentionally not writable.
|
|
3
|
+
// internal commands and the rendering side share one definition.
|
|
4
|
+
export const KNOWN_AI_AGENTS = new Set(['claude', 'codex', 'antigravity', 'opencode', 'cursor', 'traecli']);
|
|
5
|
+
// Long name -> short name mapping: `claude-code` reuses the existing
|
|
6
|
+
// orchestration precedent, and `antigravity-cli` is the active client.
|
|
9
7
|
export const AGENT_LONG_NAMES = {
|
|
10
8
|
'claude-code': 'claude',
|
|
11
9
|
'antigravity-cli': 'antigravity'
|
|
12
10
|
};
|
|
13
|
-
export const AGENT_USAGE_HINT = "agent must be a short token (claude/codex/antigravity/opencode/cursor), " +
|
|
11
|
+
export const AGENT_USAGE_HINT = "agent must be a short token (claude/codex/antigravity/opencode/cursor/traecli), " +
|
|
14
12
|
"a long name (claude-code -> claude, antigravity-cli -> antigravity), or 'human'";
|
|
15
|
-
// Read-side historical compatibility for activity-log rendering: `gemini` and
|
|
16
|
-
// `gemini-cli` stay recognizable when displaying old logs, but are never
|
|
17
|
-
// accepted by normalizeAgentToken (write side).
|
|
18
|
-
const READ_KNOWN_AI_AGENTS = new Set([...KNOWN_AI_AGENTS, 'gemini']);
|
|
19
|
-
const READ_AGENT_LONG_NAMES = {
|
|
20
|
-
...AGENT_LONG_NAMES,
|
|
21
|
-
'gemini-cli': 'gemini'
|
|
22
|
-
};
|
|
23
13
|
// Strict write-side validation: the value must be exactly a short token, a
|
|
24
14
|
// long name, or 'human'; returns the normalized short token, or null when
|
|
25
15
|
// the value is not a recognized agent.
|
|
@@ -41,9 +31,9 @@ export function classifyAgent(raw) {
|
|
|
41
31
|
return { status: 'unknown', display: 'human' };
|
|
42
32
|
if (token === 'human')
|
|
43
33
|
return { status: 'human', display: 'human' };
|
|
44
|
-
if (
|
|
34
|
+
if (KNOWN_AI_AGENTS.has(token))
|
|
45
35
|
return { status: 'ai', display: token };
|
|
46
|
-
const short =
|
|
36
|
+
const short = AGENT_LONG_NAMES[token];
|
|
47
37
|
return short ? { status: 'ai', display: short } : { status: 'unknown', display: 'human' };
|
|
48
38
|
}
|
|
49
39
|
//# sourceMappingURL=tokens.js.map
|
package/dist/lib/decide.js
CHANGED
|
@@ -3,7 +3,7 @@ import { parseTaskScope } from './task/command-options.js';
|
|
|
3
3
|
import { applyHumanDecision } from './task/decision-intents.js';
|
|
4
4
|
import { canonicalTimestamp } from './task/write.js';
|
|
5
5
|
import { consumeHumanOverride, failureId } from './task/human-override.js';
|
|
6
|
-
import {
|
|
6
|
+
import { resolveTaskContext } from './task/resolve-ref.js';
|
|
7
7
|
import { TaskExecutionLockError, withTaskExecutionLock } from './task/task-execution-lock.js';
|
|
8
8
|
function parseDecisionParts(parts) {
|
|
9
9
|
const decision = [];
|
|
@@ -66,47 +66,33 @@ export async function decide(args, options = {}) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
else if (arg.startsWith('--item=')) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return 1;
|
|
72
|
-
}
|
|
73
|
-
item = arg.slice('--item='.length);
|
|
74
|
-
if (item === '') {
|
|
75
|
-
process.stderr.write('Error: --item requires a value\n');
|
|
76
|
-
return 1;
|
|
77
|
-
}
|
|
69
|
+
process.stderr.write('Error: --item=... is not supported; use --item <selector> or -i <selector>\n');
|
|
70
|
+
return 1;
|
|
78
71
|
}
|
|
79
72
|
else
|
|
80
73
|
operands.push(arg);
|
|
81
74
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (item !== undefined) {
|
|
86
|
-
decisionParts = operands;
|
|
87
|
-
}
|
|
88
|
-
else if (!scope.explicit) {
|
|
89
|
-
[taskRef, selector, ...decisionParts] = operands;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
decisionParts = [];
|
|
93
|
-
}
|
|
75
|
+
const taskRef = scope.taskRef;
|
|
76
|
+
const selector = item;
|
|
77
|
+
const decisionParts = operands;
|
|
94
78
|
if (!selector || decisionParts.length === 0) {
|
|
95
|
-
process.stderr.write('Usage: ai decide [--task <ref>] --item <ordinal|ledger-id>
|
|
79
|
+
process.stderr.write('Usage: ai decide [--task <ref> | -t <ref>] (--item <ordinal|ledger-id> | -i <ordinal|ledger-id>) [--needs-implementation true|false] <decision>\n');
|
|
96
80
|
return 1;
|
|
97
81
|
}
|
|
98
82
|
try {
|
|
99
83
|
const parsedDecision = parseDecisionParts(decisionParts);
|
|
100
84
|
const now = (options.now ?? canonicalTimestamp)();
|
|
85
|
+
const resolved = resolveTaskContext(taskRef, { repoRoot: options.repoRoot });
|
|
86
|
+
if (!resolved.ok)
|
|
87
|
+
throw new Error(resolved.message);
|
|
101
88
|
const request = {
|
|
102
|
-
taskRef, selector, decision: parsedDecision.decision,
|
|
89
|
+
taskRef: resolved.taskId, selector, decision: parsedDecision.decision,
|
|
103
90
|
needsImplementation: parsedDecision.needsImplementation
|
|
104
91
|
};
|
|
105
92
|
const writeOptions = {
|
|
106
|
-
repoRoot:
|
|
93
|
+
repoRoot: resolved.repoRoot,
|
|
107
94
|
metadataProvider: () => ({ timestamp: now, agentInfraVersion: options.version ?? VERSION })
|
|
108
95
|
};
|
|
109
|
-
const resolved = taskRef ? resolveTaskRef(taskRef, { repoRoot: options.repoRoot }) : null;
|
|
110
96
|
let result;
|
|
111
97
|
const execute = () => {
|
|
112
98
|
let current = applyHumanDecision(request, writeOptions);
|
|
@@ -115,7 +101,7 @@ export async function decide(args, options = {}) {
|
|
|
115
101
|
if (!parsedDecision.overrideTarget || !parsedDecision.overrideScope)
|
|
116
102
|
throw new Error('override ticket requires --override-target and --override-scope');
|
|
117
103
|
const consumed = consumeHumanOverride({
|
|
118
|
-
taskRef: resolved
|
|
104
|
+
taskRef: resolved.taskId,
|
|
119
105
|
ticketId: parsedDecision.overrideTicket,
|
|
120
106
|
failureId: failureId('decision-intent', current.error?.code ?? 'TASK_STATE_MISMATCH'),
|
|
121
107
|
target: parsedDecision.overrideTarget,
|
|
@@ -134,9 +120,7 @@ export async function decide(args, options = {}) {
|
|
|
134
120
|
throw new Error(consumed.error.message);
|
|
135
121
|
return current;
|
|
136
122
|
};
|
|
137
|
-
result = resolved
|
|
138
|
-
? withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute)
|
|
139
|
-
: execute();
|
|
123
|
+
result = withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
|
|
140
124
|
if (result.error)
|
|
141
125
|
throw new Error(result.error.message);
|
|
142
126
|
return 0;
|
package/dist/lib/defaults.json
CHANGED
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
"id": "opencode",
|
|
23
23
|
"enabled": true,
|
|
24
24
|
"installInSandbox": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "traecli",
|
|
28
|
+
"enabled": true,
|
|
29
|
+
"installInSandbox": true
|
|
25
30
|
}
|
|
26
31
|
],
|
|
27
32
|
"sandbox": {
|
|
@@ -85,6 +90,10 @@
|
|
|
85
90
|
],
|
|
86
91
|
"ejected": [],
|
|
87
92
|
"retiredManaged": [
|
|
93
|
+
{
|
|
94
|
+
"path": ".trae/skills/",
|
|
95
|
+
"templateHashes": []
|
|
96
|
+
},
|
|
88
97
|
{
|
|
89
98
|
"path": ".agents/workspace/README.md",
|
|
90
99
|
"templateHashes": [
|
package/dist/lib/init.js
CHANGED
|
@@ -71,7 +71,7 @@ async function cmdInit() {
|
|
|
71
71
|
// check existing config
|
|
72
72
|
if (fs.existsSync(configPath)) {
|
|
73
73
|
err('This project already has agent-infra configuration.');
|
|
74
|
-
err('Use /update-agent-infra in your AI TUI to
|
|
74
|
+
err('Use /update-agent-infra in your AI TUI to sync project files.');
|
|
75
75
|
process.exitCode = 1;
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -214,7 +214,7 @@ async function cmdInit() {
|
|
|
214
214
|
console.log('');
|
|
215
215
|
ok('Project initialized successfully!');
|
|
216
216
|
console.log('');
|
|
217
|
-
console.log(' If this init used npx, install agent-infra persistently before update or validation:');
|
|
217
|
+
console.log(' If this init used npx, install agent-infra persistently before ai update or validation:');
|
|
218
218
|
console.log(' npm install -g @fitlab-ai/agent-infra');
|
|
219
219
|
console.log('');
|
|
220
220
|
if (workflowPlan.nextSteps.length === 0) {
|
|
@@ -6,7 +6,7 @@ import { preflightCodexLifecycleEvidence, resolveCodexTerminal, resolveCodexThre
|
|
|
6
6
|
import { createCodexLifecycleStore } from '../agent-clients/adapters/codex-lifecycle/store.js';
|
|
7
7
|
import { createCodexCapabilityStore } from '../agent-clients/adapters/codex-lifecycle/capability-store.js';
|
|
8
8
|
import { computeLifecycleBuildIdentity } from '../agent-clients/adapters/codex-lifecycle/build-identity.js';
|
|
9
|
-
import {
|
|
9
|
+
import { verifyCodexSandboxControllerContextWithWarnings } from '../agent-clients/adapters/codex-lifecycle/sandbox-controller.js';
|
|
10
10
|
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
11
11
|
import { hasSealableOrchestrationDelegation } from '../task/orchestration.js';
|
|
12
12
|
import { activateCodexOrchestrationDelegation, activateCodexSpawnDelegation, reconcileCodexOrchestrationDelegation, sealCodexOrchestrationDelegation, sealCodexParentDelegation } from '../task/codex-orchestration.js';
|
|
@@ -81,7 +81,7 @@ function controllerBinding(taskId) {
|
|
|
81
81
|
const contextPath = process.env.AGENT_INFRA_CODEX_CONTROLLER_CONTEXT;
|
|
82
82
|
if (!contextPath)
|
|
83
83
|
return undefined;
|
|
84
|
-
const context =
|
|
84
|
+
const context = verifyCodexSandboxControllerContextWithWarnings(contextPath, { repoRoot: process.cwd() }).context;
|
|
85
85
|
return {
|
|
86
86
|
instanceDigest: context.controllerInstanceDigest,
|
|
87
87
|
controlGeneration: context.controlGeneration
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runCodexSandboxController,
|
|
1
|
+
import { runCodexSandboxController, verifyCodexSandboxControllerContextWithWarnings } from '../agent-clients/adapters/codex-lifecycle/sandbox-controller.js';
|
|
2
2
|
const USAGE = 'Usage: agent-infra-internal codex-sandbox-controller <run|verify-context> [options]\n';
|
|
3
3
|
function fail(code, message, exitCode = 1) {
|
|
4
4
|
process.stdout.write(`${JSON.stringify({
|
|
@@ -53,7 +53,8 @@ async function codexSandboxController(args = []) {
|
|
|
53
53
|
?? process.env.AGENT_INFRA_CODEX_CONTROLLER_CONTEXT;
|
|
54
54
|
if (!contextPath)
|
|
55
55
|
throw new Error('CODEX_SANDBOX_CONTROLLER_CONTEXT_MISSING');
|
|
56
|
-
const
|
|
56
|
+
const verified = verifyCodexSandboxControllerContextWithWarnings(contextPath);
|
|
57
|
+
const context = verified.context;
|
|
57
58
|
process.stdout.write(`${JSON.stringify({
|
|
58
59
|
status: 'ready',
|
|
59
60
|
changed: false,
|
|
@@ -64,8 +65,8 @@ async function codexSandboxController(args = []) {
|
|
|
64
65
|
expiresAt: context.expiresAt,
|
|
65
66
|
buildIdentity: context.buildIdentity,
|
|
66
67
|
hookDefinitionHash: context.hookDefinitionHash,
|
|
67
|
-
lifecycleProfilesHash: context.lifecycleProfilesHash
|
|
68
68
|
},
|
|
69
|
+
...(verified.warnings.length > 0 ? { warnings: verified.warnings } : {}),
|
|
69
70
|
error: null
|
|
70
71
|
})}\n`);
|
|
71
72
|
return;
|
|
@@ -2,7 +2,7 @@ import { requestSandboxControl, requestSandboxTaskFinalization, requestSandboxTa
|
|
|
2
2
|
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
|
|
3
3
|
import { serveSandboxControl } from '../sandbox/control/server.js';
|
|
4
4
|
import { runSandboxControlExecutor } from '../sandbox/control/executor.js';
|
|
5
|
-
import { controllerProofFromContext,
|
|
5
|
+
import { controllerProofFromContext, verifyCodexSandboxControllerContextWithWarnings } from '../agent-clients/adapters/codex-lifecycle/sandbox-controller.js';
|
|
6
6
|
function isCanonicalCodexPrepare(args) {
|
|
7
7
|
if (args[1] !== 'prepare')
|
|
8
8
|
return false;
|
|
@@ -106,7 +106,7 @@ async function sandboxControl(args) {
|
|
|
106
106
|
if (family === 'task-orchestration' && isCanonicalCodexPrepare(commandArgs)) {
|
|
107
107
|
const contextPath = process.env.AGENT_INFRA_CODEX_CONTROLLER_CONTEXT;
|
|
108
108
|
const proof = contextPath
|
|
109
|
-
? controllerProofFromContext(
|
|
109
|
+
? controllerProofFromContext(verifyCodexSandboxControllerContextWithWarnings(contextPath).context)
|
|
110
110
|
: null;
|
|
111
111
|
response = requestSandboxTaskControl({ family, args: commandArgs, controllerProof: proof });
|
|
112
112
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createDirectHostExecutionContext, dispatchTaskControlOperation, parseTaskControlOperation } from '../task/control-authority.js';
|
|
2
2
|
import { applyTaskFinalization } from '../task/finalization.js';
|
|
3
3
|
import { detectRepoRoot, resolveTaskRef } from '../task/resolve-ref.js';
|
|
4
|
-
import { verifyTaskEvent } from '../task/verification.js';
|
|
5
4
|
const USAGE = 'Usage: agent-infra-internal task-finalization <N | TASK-id> complete --agent <agent>\n';
|
|
6
5
|
function envelope(status, changed, accepted, result, error) {
|
|
7
6
|
return `${JSON.stringify({ version: 1, status, changed, accepted, result, error })}\n`;
|
|
@@ -15,18 +14,25 @@ function fail(message) {
|
|
|
15
14
|
process.stderr.write(USAGE);
|
|
16
15
|
process.exitCode = 1;
|
|
17
16
|
}
|
|
17
|
+
function parseFailure(error) {
|
|
18
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19
|
+
return message.replace(/^TASK_CONTROL_OPERATION_INVALID: /u, '');
|
|
20
|
+
}
|
|
18
21
|
function taskFinalization(args = []) {
|
|
19
22
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
20
23
|
process.stdout.write(USAGE);
|
|
21
24
|
return;
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
let operation;
|
|
27
|
+
try {
|
|
28
|
+
operation = parseTaskControlOperation('task-finalization', args);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
fail(parseFailure(error));
|
|
25
32
|
return;
|
|
26
33
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
fail(`invalid --agent: ${AGENT_USAGE_HINT}`);
|
|
34
|
+
if (operation.family !== 'task-finalization') {
|
|
35
|
+
fail('finalization operation is invalid');
|
|
30
36
|
return;
|
|
31
37
|
}
|
|
32
38
|
let repoRoot;
|
|
@@ -39,14 +45,18 @@ function taskFinalization(args = []) {
|
|
|
39
45
|
process.exitCode = 1;
|
|
40
46
|
return;
|
|
41
47
|
}
|
|
42
|
-
const resolved = resolveTaskRef(
|
|
48
|
+
const resolved = resolveTaskRef(operation.request.taskRef, { repoRoot });
|
|
43
49
|
if (!resolved.ok) {
|
|
44
50
|
const detail = { code: resolved.code, message: resolved.message, retryable: false };
|
|
45
51
|
process.stdout.write(envelope('failed', false, true, null, detail));
|
|
46
52
|
process.exitCode = 1;
|
|
47
53
|
return;
|
|
48
54
|
}
|
|
49
|
-
const
|
|
55
|
+
const boundOperation = {
|
|
56
|
+
...operation,
|
|
57
|
+
request: { ...operation.request, taskRef: resolved.taskId }
|
|
58
|
+
};
|
|
59
|
+
const result = dispatchTaskControlOperation(createDirectHostExecutionContext({ repoRoot }), boundOperation);
|
|
50
60
|
process.stdout.write(envelope(result.status, result.changed, true, result, result.error));
|
|
51
61
|
process.exitCode = exitCode(result.status);
|
|
52
62
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { applyLedgerIntent } from '../task/ledger-intents.js';
|
|
3
3
|
import { consumeHumanOverride, failureId, overrideDryRunConflict } from '../task/human-override.js';
|
|
4
|
-
import { isReviewStage,
|
|
4
|
+
import { LEDGER_SECTION_MISSING_CODE, LEDGER_SECTION_MISSING_MESSAGE, isReviewStage, parseLedgerDocument, summarizeLedgerStage, validateLedgerRows } from '../task/ledger.js';
|
|
5
5
|
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
6
6
|
import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
|
|
7
7
|
const USAGE = `Usage: agent-infra-internal task-ledger <task-ref> <intent> [intent flags] [--dry-run]\n\nIntents: finding-upsert, finding-respond, finding-review, decision-next-id, decision-upsert, stage-status\n`;
|
|
@@ -110,7 +110,13 @@ function taskLedger(args = []) {
|
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
try {
|
|
113
|
-
const
|
|
113
|
+
const ledger = parseLedgerDocument(fs.readFileSync(resolved.taskMdPath, 'utf8'));
|
|
114
|
+
if (!ledger.present) {
|
|
115
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, taskId: resolved.taskId, error: { code: LEDGER_SECTION_MISSING_CODE, message: LEDGER_SECTION_MISSING_MESSAGE } })}\n`);
|
|
116
|
+
process.exitCode = 1;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const rows = ledger.rows;
|
|
114
120
|
const invalid = validateLedgerRows(rows);
|
|
115
121
|
if (invalid) {
|
|
116
122
|
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, taskId: resolved.taskId, error: invalid })}\n`);
|