@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
package/dist/lib/task/write.js
CHANGED
|
@@ -5,6 +5,7 @@ import { isValidAgentInfraVersion, VERSION } from '../version.js';
|
|
|
5
5
|
import { parseTypedTaskFrontmatter, updateTaskFrontmatter } from './frontmatter.js';
|
|
6
6
|
import { resolveTaskRef } from './resolve-ref.js';
|
|
7
7
|
import { mutateTableRow, upsertSection } from './sections.js';
|
|
8
|
+
import { lifecycleExecutions, prReviewExecution, serializeLifecycleExecution } from './lifecycle-execution.js';
|
|
8
9
|
import { validateCurrentTaskContract } from './current-contract.js';
|
|
9
10
|
const DEFAULT_FILE_SYSTEM = {
|
|
10
11
|
readFileSync: (file) => fs.readFileSync(file, 'utf8'),
|
|
@@ -104,7 +105,16 @@ function writeTaskCore(request, options = {}) {
|
|
|
104
105
|
}
|
|
105
106
|
const before = candidate;
|
|
106
107
|
if (mutation.kind === 'frontmatter') {
|
|
107
|
-
|
|
108
|
+
let set = mutation.set;
|
|
109
|
+
if (mutation.lifecycleExecutionDomain) {
|
|
110
|
+
const proposed = updateTaskFrontmatter(candidate, mutation.set);
|
|
111
|
+
const open = mutation.lifecycleExecutionDomain === 'ordinary'
|
|
112
|
+
? lifecycleExecutions(proposed)
|
|
113
|
+
: lifecycleExecutions(candidate);
|
|
114
|
+
const pr = prReviewExecution(mutation.lifecycleExecutionDomain === 'pr-review' ? proposed : candidate);
|
|
115
|
+
set = { ...mutation.set, lifecycle_execution: serializeLifecycleExecution(open, undefined, pr) };
|
|
116
|
+
}
|
|
117
|
+
candidate = updateTaskFrontmatter(candidate, set, mutation.remove);
|
|
108
118
|
operations.push({
|
|
109
119
|
index,
|
|
110
120
|
kind: 'frontmatter',
|
|
@@ -8,10 +8,6 @@ import type {
|
|
|
8
8
|
AgentClientCapabilityMap,
|
|
9
9
|
AgentClientId
|
|
10
10
|
} from './types.ts';
|
|
11
|
-
import type {
|
|
12
|
-
OrchestrationOptions,
|
|
13
|
-
OrchestrationResult
|
|
14
|
-
} from '../task/orchestration.ts';
|
|
15
11
|
import {
|
|
16
12
|
SANDBOX_HOOK_PHASES
|
|
17
13
|
} from '../sandbox/tool-types.ts';
|
|
@@ -42,56 +38,6 @@ type AgentClientModelSelectionContext =
|
|
|
42
38
|
guidance: string;
|
|
43
39
|
}>;
|
|
44
40
|
|
|
45
|
-
type AgentClientDelegationEvidence = Readonly<{
|
|
46
|
-
actualModel: 'host-event' | 'app-server' | 'unavailable';
|
|
47
|
-
actualReasoningEffort: 'host-event' | 'app-server' | 'spawn-ack' | 'unavailable';
|
|
48
|
-
spawnModeRequired?: boolean;
|
|
49
|
-
actualModelRequired?: boolean;
|
|
50
|
-
actualReasoningEffortRequired?: boolean;
|
|
51
|
-
fallbackReasonRequired?: boolean;
|
|
52
|
-
}>;
|
|
53
|
-
|
|
54
|
-
type AgentClientLifecycleRecoveryRequest = Readonly<{
|
|
55
|
-
taskRef: string;
|
|
56
|
-
intent: 'recover-started';
|
|
57
|
-
agent: string;
|
|
58
|
-
auto: true;
|
|
59
|
-
}>;
|
|
60
|
-
|
|
61
|
-
type AgentClientLifecycleRecoveryResult = Readonly<{
|
|
62
|
-
status: 'applied' | 'no-op' | 'owner-unknown' | 'conflict';
|
|
63
|
-
changed: boolean;
|
|
64
|
-
targetState: 'active';
|
|
65
|
-
requestRef: string;
|
|
66
|
-
intent: 'recover-started';
|
|
67
|
-
taskId: string | null;
|
|
68
|
-
receiptId: string | null;
|
|
69
|
-
childId: string | null;
|
|
70
|
-
error: Readonly<{ code: string; message: string }> | null;
|
|
71
|
-
}>;
|
|
72
|
-
|
|
73
|
-
type AgentClientOrchestrationAdapter = Readonly<{
|
|
74
|
-
validateActivationEvidence?: (evidence: unknown, parentId: string) => boolean;
|
|
75
|
-
validateReceiptEvidence?: (receipt: unknown) => boolean;
|
|
76
|
-
createLaunchCarrier?: (
|
|
77
|
-
adapterContext: string,
|
|
78
|
-
identity: Readonly<{ stage: string; round: number; role: string }>
|
|
79
|
-
) => Readonly<Record<string, string>>;
|
|
80
|
-
prepareDelegation?: (
|
|
81
|
-
taskRef: string,
|
|
82
|
-
input: Readonly<{
|
|
83
|
-
client: AgentClientId;
|
|
84
|
-
requestedModel?: string;
|
|
85
|
-
requestedReasoningEffort?: string;
|
|
86
|
-
}>,
|
|
87
|
-
options?: Readonly<{ repoRoot?: string; orchestrationOptions?: OrchestrationOptions }>
|
|
88
|
-
) => Promise<OrchestrationResult>;
|
|
89
|
-
recoverStarted?: (
|
|
90
|
-
request: AgentClientLifecycleRecoveryRequest,
|
|
91
|
-
options: Readonly<{ repoRoot: string }>
|
|
92
|
-
) => AgentClientLifecycleRecoveryResult | Promise<AgentClientLifecycleRecoveryResult>;
|
|
93
|
-
}>;
|
|
94
|
-
|
|
95
41
|
type AgentClientSeedCommand = Readonly<{
|
|
96
42
|
templates: Readonly<{
|
|
97
43
|
en: string;
|
|
@@ -123,8 +69,6 @@ type AgentClientAdapter = Readonly<{
|
|
|
123
69
|
invocation: string;
|
|
124
70
|
capabilities: AgentClientCapabilities;
|
|
125
71
|
modelSelection: AgentClientModelSelectionContext;
|
|
126
|
-
delegationEvidence: AgentClientDelegationEvidence;
|
|
127
|
-
orchestrationAdapter?: AgentClientOrchestrationAdapter;
|
|
128
72
|
project: AgentClientProjectDescriptor;
|
|
129
73
|
sandbox: AgentClientSandboxDescriptor;
|
|
130
74
|
}>;
|
|
@@ -399,18 +343,6 @@ function defineAgentClientAdapter(
|
|
|
399
343
|
throw new Error(`Agent Client '${candidate.id}' has an invalid model-selection context`);
|
|
400
344
|
}
|
|
401
345
|
|
|
402
|
-
const evidence = candidate.delegationEvidence;
|
|
403
|
-
if (
|
|
404
|
-
!evidence
|
|
405
|
-
|| !['host-event', 'app-server', 'unavailable'].includes(evidence.actualModel)
|
|
406
|
-
|| !['host-event', 'app-server', 'spawn-ack', 'unavailable'].includes(evidence.actualReasoningEffort)
|
|
407
|
-
|| ['spawnModeRequired', 'actualModelRequired', 'actualReasoningEffortRequired', 'fallbackReasonRequired']
|
|
408
|
-
.some((key) => evidence[key as keyof AgentClientDelegationEvidence] !== undefined
|
|
409
|
-
&& typeof evidence[key as keyof AgentClientDelegationEvidence] !== 'boolean')
|
|
410
|
-
) {
|
|
411
|
-
throw new Error(`Agent Client '${candidate.id}' has invalid delegation evidence`);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
346
|
if (
|
|
415
347
|
typeof candidate.project !== 'object'
|
|
416
348
|
|| candidate.project === null
|
|
@@ -701,10 +633,6 @@ function defineAgentClientAdapter(
|
|
|
701
633
|
invocation: candidate.invocation,
|
|
702
634
|
capabilities: Object.freeze(capabilities),
|
|
703
635
|
modelSelection: frozenModelSelection,
|
|
704
|
-
delegationEvidence: Object.freeze({ ...evidence }),
|
|
705
|
-
...(candidate.orchestrationAdapter === undefined
|
|
706
|
-
? {}
|
|
707
|
-
: { orchestrationAdapter: Object.freeze({ ...candidate.orchestrationAdapter }) }),
|
|
708
636
|
project: Object.freeze({
|
|
709
637
|
ownedPathPrefixes: Object.freeze(paths),
|
|
710
638
|
...projectAssets,
|
|
@@ -726,10 +654,6 @@ export type {
|
|
|
726
654
|
AgentClientAdapter,
|
|
727
655
|
AgentClientCapabilities,
|
|
728
656
|
AgentClientCustomCommandDescriptor,
|
|
729
|
-
AgentClientDelegationEvidence,
|
|
730
|
-
AgentClientLifecycleRecoveryRequest,
|
|
731
|
-
AgentClientLifecycleRecoveryResult,
|
|
732
|
-
AgentClientOrchestrationAdapter,
|
|
733
657
|
AgentClientManifestEntry,
|
|
734
658
|
AgentClientModelSelectionContext,
|
|
735
659
|
AgentClientProjectDescriptor,
|
|
@@ -11,7 +11,6 @@ const antigravityCliAdapter = defineAgentClientAdapter({
|
|
|
11
11
|
commands: { level: 'integrated' },
|
|
12
12
|
hooks: { level: 'compatible' },
|
|
13
13
|
subagents: { level: 'unsupported' },
|
|
14
|
-
orchestration: { level: 'unsupported' },
|
|
15
14
|
sandbox: { level: 'integrated' },
|
|
16
15
|
verification: { level: 'compatible' }
|
|
17
16
|
},
|
|
@@ -20,10 +19,6 @@ const antigravityCliAdapter = defineAgentClientAdapter({
|
|
|
20
19
|
command: '/model',
|
|
21
20
|
guidance: 'Use the host model picker for the complete model and reasoning-effort catalog.'
|
|
22
21
|
},
|
|
23
|
-
delegationEvidence: {
|
|
24
|
-
actualModel: 'unavailable',
|
|
25
|
-
actualReasoningEffort: 'unavailable'
|
|
26
|
-
},
|
|
27
22
|
project: {
|
|
28
23
|
ownedPathPrefixes: [],
|
|
29
24
|
managed: [],
|
|
@@ -581,25 +581,6 @@ export function reconcileClaudeCredentials(home: string, options: ReconcileOptio
|
|
|
581
581
|
};
|
|
582
582
|
}
|
|
583
583
|
|
|
584
|
-
export function syncClaudeCredentialsFromKeychain(home: string, project: string, options: ReconcileOptions = {}) {
|
|
585
|
-
const result = reconcileClaudeCredentials(home, {
|
|
586
|
-
...options,
|
|
587
|
-
singleProject: project
|
|
588
|
-
});
|
|
589
|
-
if (result.status !== 'OK' && result.status !== 'KEYCHAIN_WRITE_FAILED') {
|
|
590
|
-
return {
|
|
591
|
-
status: result.status,
|
|
592
|
-
written: false
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
return {
|
|
597
|
-
status: result.status === 'KEYCHAIN_WRITE_FAILED' ? 'OK' : result.status,
|
|
598
|
-
written: result.filesWritten.includes(project),
|
|
599
|
-
expiresAt: result.expiresAt
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
|
|
603
584
|
export function formatRemaining(expiresAt: unknown): string {
|
|
604
585
|
if (typeof expiresAt !== 'number') {
|
|
605
586
|
return 'unknown';
|
|
@@ -16,7 +16,6 @@ const claudeCodeAdapter = defineAgentClientAdapter({
|
|
|
16
16
|
commands: { level: 'integrated' },
|
|
17
17
|
hooks: { level: 'integrated' },
|
|
18
18
|
subagents: { level: 'experimental' },
|
|
19
|
-
orchestration: { level: 'experimental' },
|
|
20
19
|
sandbox: { level: 'integrated' },
|
|
21
20
|
verification: { level: 'compatible' }
|
|
22
21
|
},
|
|
@@ -25,14 +24,6 @@ const claudeCodeAdapter = defineAgentClientAdapter({
|
|
|
25
24
|
command: '/model',
|
|
26
25
|
guidance: 'Use the host model picker for the complete model and reasoning-effort catalog.'
|
|
27
26
|
},
|
|
28
|
-
delegationEvidence: {
|
|
29
|
-
actualModel: 'host-event',
|
|
30
|
-
actualReasoningEffort: 'spawn-ack',
|
|
31
|
-
spawnModeRequired: false,
|
|
32
|
-
actualModelRequired: false,
|
|
33
|
-
actualReasoningEffortRequired: false,
|
|
34
|
-
fallbackReasonRequired: false
|
|
35
|
-
},
|
|
36
27
|
project: {
|
|
37
28
|
ownedPathPrefixes: ['.claude/'],
|
|
38
29
|
managed: ['.claude/commands/', '.claude/agents/', '.claude/rules/'],
|
|
@@ -4,44 +4,6 @@ import {
|
|
|
4
4
|
codexBeforeContainerCreateHook,
|
|
5
5
|
codexRecoveryChecks
|
|
6
6
|
} from './codex-sandbox.ts';
|
|
7
|
-
import { parseCodexLifecycleBinding } from './codex-lifecycle/binding.ts';
|
|
8
|
-
import { isCodexDelegationReceiptEvidence, isCodexLifecycleActivationEvidence } from './codex-lifecycle/evidence.ts';
|
|
9
|
-
|
|
10
|
-
function codexCarrierError(code: string): Error {
|
|
11
|
-
const error = new Error(code);
|
|
12
|
-
error.name = code;
|
|
13
|
-
return error;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function codexStageToken(stage: string): string {
|
|
17
|
-
const tokens: Readonly<Record<string, string>> = {
|
|
18
|
-
analysis: 'a',
|
|
19
|
-
plan: 'p',
|
|
20
|
-
code: 'c',
|
|
21
|
-
'review-analysis': 'ra',
|
|
22
|
-
'review-plan': 'rp',
|
|
23
|
-
'review-code': 'rc',
|
|
24
|
-
commit: 'm'
|
|
25
|
-
};
|
|
26
|
-
const token = tokens[stage];
|
|
27
|
-
if (!token) throw codexCarrierError('CODEX_LIFECYCLE_SPAWN_IDENTITY_INVALID');
|
|
28
|
-
return token;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function codexLaunchCarrier(
|
|
32
|
-
adapterContext: string,
|
|
33
|
-
identity: Readonly<{ stage: string; round: number; role: string }>
|
|
34
|
-
): Readonly<Record<string, string>> {
|
|
35
|
-
if (!Number.isSafeInteger(identity.round) || identity.round < 1
|
|
36
|
-
|| !['executor', 'reviewer'].includes(identity.role)) {
|
|
37
|
-
throw codexCarrierError('CODEX_LIFECYCLE_SPAWN_IDENTITY_INVALID');
|
|
38
|
-
}
|
|
39
|
-
const label = `${codexStageToken(identity.stage)}_${identity.role === 'reviewer' ? 'r' : 'e'}_r${identity.round}`;
|
|
40
|
-
const taskName = `${label}${adapterContext}`;
|
|
41
|
-
const parsed = parseCodexLifecycleBinding(taskName);
|
|
42
|
-
if (!parsed) throw codexCarrierError('CODEX_LIFECYCLE_LAUNCH_CONTEXT_INVALID');
|
|
43
|
-
return Object.freeze({ task_name: parsed.taskName });
|
|
44
|
-
}
|
|
45
7
|
|
|
46
8
|
const codexAdapter = defineAgentClientAdapter({
|
|
47
9
|
id: 'codex',
|
|
@@ -53,7 +15,6 @@ const codexAdapter = defineAgentClientAdapter({
|
|
|
53
15
|
commands: { level: 'integrated' },
|
|
54
16
|
hooks: { level: 'integrated' },
|
|
55
17
|
subagents: { level: 'experimental' },
|
|
56
|
-
orchestration: { level: 'experimental' },
|
|
57
18
|
sandbox: { level: 'integrated' },
|
|
58
19
|
verification: { level: 'compatible' }
|
|
59
20
|
},
|
|
@@ -62,23 +23,6 @@ const codexAdapter = defineAgentClientAdapter({
|
|
|
62
23
|
command: '/model',
|
|
63
24
|
guidance: 'Use the host model picker for the complete model and reasoning-effort catalog.'
|
|
64
25
|
},
|
|
65
|
-
delegationEvidence: {
|
|
66
|
-
actualModel: 'app-server',
|
|
67
|
-
actualReasoningEffort: 'app-server'
|
|
68
|
-
},
|
|
69
|
-
orchestrationAdapter: {
|
|
70
|
-
validateActivationEvidence: isCodexLifecycleActivationEvidence,
|
|
71
|
-
validateReceiptEvidence: isCodexDelegationReceiptEvidence,
|
|
72
|
-
createLaunchCarrier: codexLaunchCarrier,
|
|
73
|
-
prepareDelegation: async (...args) => {
|
|
74
|
-
const { prepareCodexOrchestrationDelegation } = await import('./codex-orchestration.ts');
|
|
75
|
-
return prepareCodexOrchestrationDelegation(...args);
|
|
76
|
-
},
|
|
77
|
-
recoverStarted: async (...args) => {
|
|
78
|
-
const { recoverStartedLifecycleFromAdapter } = await import('./codex-lifecycle/recovery.ts');
|
|
79
|
-
return recoverStartedLifecycleFromAdapter(...args);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
26
|
project: {
|
|
83
27
|
ownedPathPrefixes: ['.codex/'],
|
|
84
28
|
managed: ['.codex/hooks.json', '.codex/agents/'],
|
|
@@ -17,7 +17,6 @@ const opencodeAdapter = defineAgentClientAdapter({
|
|
|
17
17
|
commands: { level: 'integrated' },
|
|
18
18
|
hooks: { level: 'compatible' },
|
|
19
19
|
subagents: { level: 'unsupported' },
|
|
20
|
-
orchestration: { level: 'unsupported' },
|
|
21
20
|
sandbox: { level: 'integrated' },
|
|
22
21
|
verification: { level: 'compatible' }
|
|
23
22
|
},
|
|
@@ -26,10 +25,6 @@ const opencodeAdapter = defineAgentClientAdapter({
|
|
|
26
25
|
command: '/models',
|
|
27
26
|
guidance: 'Use the host model picker for the complete model and reasoning-effort catalog.'
|
|
28
27
|
},
|
|
29
|
-
delegationEvidence: {
|
|
30
|
-
actualModel: 'unavailable',
|
|
31
|
-
actualReasoningEffort: 'unavailable'
|
|
32
|
-
},
|
|
33
28
|
project: {
|
|
34
29
|
ownedPathPrefixes: ['.opencode/'],
|
|
35
30
|
managed: ['.opencode/commands/'],
|
|
@@ -11,7 +11,6 @@ const traecliAdapter = defineAgentClientAdapter({
|
|
|
11
11
|
commands: { level: 'integrated' },
|
|
12
12
|
hooks: { level: 'compatible' },
|
|
13
13
|
subagents: { level: 'experimental' },
|
|
14
|
-
orchestration: { level: 'experimental' },
|
|
15
14
|
sandbox: { level: 'integrated' },
|
|
16
15
|
verification: { level: 'compatible' }
|
|
17
16
|
},
|
|
@@ -20,10 +19,6 @@ const traecliAdapter = defineAgentClientAdapter({
|
|
|
20
19
|
command: '/model',
|
|
21
20
|
guidance: 'Use the host model picker for the complete model and reasoning-effort catalog.'
|
|
22
21
|
},
|
|
23
|
-
delegationEvidence: {
|
|
24
|
-
actualModel: 'unavailable',
|
|
25
|
-
actualReasoningEffort: 'unavailable'
|
|
26
|
-
},
|
|
27
22
|
project: {
|
|
28
23
|
ownedPathPrefixes: ['.traecli/'],
|
|
29
24
|
managed: ['.traecli/commands/'],
|
|
@@ -6,8 +6,7 @@ import type {
|
|
|
6
6
|
AgentClientConfig,
|
|
7
7
|
AgentClientId,
|
|
8
8
|
AgentClientsConfig,
|
|
9
|
-
AgentClientState
|
|
10
|
-
OrchestrationModelPolicy
|
|
9
|
+
AgentClientState
|
|
11
10
|
} from './types.ts';
|
|
12
11
|
|
|
13
12
|
type AgentClientConfigInput = Readonly<Record<string, unknown>>;
|
|
@@ -54,49 +53,12 @@ function fail(code: AgentClientDiagnosticCode, path: string): never {
|
|
|
54
53
|
throw new AgentClientConfigError({ code, path });
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
function parseExactText(value: unknown, path: string): string {
|
|
58
|
-
if (typeof value !== 'string' || value.length === 0 || value.trim() !== value) {
|
|
59
|
-
fail('INVALID_AGENT_CLIENTS', path);
|
|
60
|
-
}
|
|
61
|
-
return value;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function parseOrchestrationPolicy(value: unknown, path: string): OrchestrationModelPolicy {
|
|
65
|
-
if (!isRecord(value)) fail('INVALID_AGENT_CLIENTS', path);
|
|
66
|
-
const keys = Object.keys(value);
|
|
67
|
-
if (
|
|
68
|
-
keys.length !== 2
|
|
69
|
-
|| !hasOwn(value, 'executor')
|
|
70
|
-
|| !hasOwn(value, 'reviewer')
|
|
71
|
-
) {
|
|
72
|
-
fail('INVALID_AGENT_CLIENTS', path);
|
|
73
|
-
}
|
|
74
|
-
const parseRole = (candidate: unknown, rolePath: string) => {
|
|
75
|
-
if (
|
|
76
|
-
!isRecord(candidate)
|
|
77
|
-
|| Object.keys(candidate).length !== 2
|
|
78
|
-
|| !hasOwn(candidate, 'model')
|
|
79
|
-
|| !hasOwn(candidate, 'reasoningEffort')
|
|
80
|
-
) {
|
|
81
|
-
fail('INVALID_AGENT_CLIENTS', rolePath);
|
|
82
|
-
}
|
|
83
|
-
return Object.freeze({
|
|
84
|
-
model: parseExactText(candidate.model, `${rolePath}.model`),
|
|
85
|
-
reasoningEffort: parseExactText(candidate.reasoningEffort, `${rolePath}.reasoningEffort`)
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
const executor = parseRole(value.executor, `${path}.executor`);
|
|
89
|
-
const reviewer = parseRole(value.reviewer, `${path}.reviewer`);
|
|
90
|
-
return Object.freeze({ executor, reviewer });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
56
|
function parseCanonical(value: unknown): AgentClientState {
|
|
94
57
|
if (!Array.isArray(value)) fail('INVALID_AGENT_CLIENTS', 'agentClients');
|
|
95
58
|
|
|
96
59
|
const entries = new Map<AgentClientId, Readonly<{
|
|
97
60
|
enabled: boolean;
|
|
98
61
|
installInSandbox: boolean;
|
|
99
|
-
orchestration?: OrchestrationModelPolicy;
|
|
100
62
|
}>>();
|
|
101
63
|
|
|
102
64
|
for (const [index, candidate] of value.entries()) {
|
|
@@ -105,11 +67,10 @@ function parseCanonical(value: unknown): AgentClientState {
|
|
|
105
67
|
|
|
106
68
|
const keys = Object.keys(candidate);
|
|
107
69
|
if (
|
|
108
|
-
|
|
70
|
+
keys.length !== 3
|
|
109
71
|
|| !hasOwn(candidate, 'id')
|
|
110
72
|
|| !hasOwn(candidate, 'enabled')
|
|
111
73
|
|| !hasOwn(candidate, 'installInSandbox')
|
|
112
|
-
|| (keys.length === 4 && !hasOwn(candidate, 'orchestration'))
|
|
113
74
|
) {
|
|
114
75
|
fail('INVALID_AGENT_CLIENTS', path);
|
|
115
76
|
}
|
|
@@ -127,10 +88,7 @@ function parseCanonical(value: unknown): AgentClientState {
|
|
|
127
88
|
}
|
|
128
89
|
entries.set(candidate.id, {
|
|
129
90
|
enabled: candidate.enabled,
|
|
130
|
-
installInSandbox: candidate.installInSandbox
|
|
131
|
-
...(hasOwn(candidate, 'orchestration')
|
|
132
|
-
? { orchestration: parseOrchestrationPolicy(candidate.orchestration, `${path}.orchestration`) }
|
|
133
|
-
: {})
|
|
91
|
+
installInSandbox: candidate.installInSandbox
|
|
134
92
|
});
|
|
135
93
|
}
|
|
136
94
|
|
|
@@ -147,25 +105,11 @@ function serializeAgentClients(state: AgentClientState): AgentClientsConfig {
|
|
|
147
105
|
return AGENT_CLIENT_IDS.map((id): AgentClientConfig => ({
|
|
148
106
|
id,
|
|
149
107
|
enabled: state[id].enabled,
|
|
150
|
-
installInSandbox: state[id].installInSandbox
|
|
151
|
-
...(state[id].orchestration
|
|
152
|
-
? { orchestration: structuredClone(state[id].orchestration) }
|
|
153
|
-
: {})
|
|
108
|
+
installInSandbox: state[id].installInSandbox
|
|
154
109
|
}));
|
|
155
110
|
}
|
|
156
111
|
|
|
157
|
-
function
|
|
158
|
-
input: AgentClientConfigInput
|
|
159
|
-
): NormalizeAgentClientsResult {
|
|
160
|
-
if (!hasOwn(input, 'agentClients')) fail('MISSING_AGENT_CLIENT', 'agentClients');
|
|
161
|
-
const state = parseCanonical(input.agentClients);
|
|
162
|
-
for (const [index, id] of AGENT_CLIENT_IDS.entries()) {
|
|
163
|
-
const entry = Array.isArray(input.agentClients) ? input.agentClients[index] : undefined;
|
|
164
|
-
if (!isRecord(entry) || entry.id !== id) {
|
|
165
|
-
fail('INVALID_AGENT_CLIENTS', `agentClients[${index}].id`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (hasOwn(input, 'tuis')) fail('INVALID_AGENT_CLIENTS', 'tuis');
|
|
112
|
+
function validateSandboxTools(input: AgentClientConfigInput): void {
|
|
169
113
|
const sandbox = isRecord(input.sandbox) ? input.sandbox : undefined;
|
|
170
114
|
if (sandbox && hasOwn(sandbox, 'customTools')) {
|
|
171
115
|
fail('INVALID_AGENT_CLIENTS', 'sandbox.customTools');
|
|
@@ -180,6 +124,21 @@ function normalizeAgentClients(
|
|
|
180
124
|
}
|
|
181
125
|
}
|
|
182
126
|
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function normalizeAgentClients(
|
|
130
|
+
input: AgentClientConfigInput
|
|
131
|
+
): NormalizeAgentClientsResult {
|
|
132
|
+
if (!hasOwn(input, 'agentClients')) fail('MISSING_AGENT_CLIENT', 'agentClients');
|
|
133
|
+
const state = parseCanonical(input.agentClients);
|
|
134
|
+
for (const [index, id] of AGENT_CLIENT_IDS.entries()) {
|
|
135
|
+
const entry = Array.isArray(input.agentClients) ? input.agentClients[index] : undefined;
|
|
136
|
+
if (!isRecord(entry) || entry.id !== id) {
|
|
137
|
+
fail('INVALID_AGENT_CLIENTS', `agentClients[${index}].id`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (hasOwn(input, 'tuis')) fail('INVALID_AGENT_CLIENTS', 'tuis');
|
|
141
|
+
validateSandboxTools(input);
|
|
183
142
|
return {
|
|
184
143
|
state,
|
|
185
144
|
canonical: serializeAgentClients(state)
|
|
@@ -5,12 +5,7 @@ import type {
|
|
|
5
5
|
AgentClientManifestEntry,
|
|
6
6
|
AgentClientRegistry
|
|
7
7
|
} from './adapter.ts';
|
|
8
|
-
import type {
|
|
9
|
-
AgentClientCapabilityId,
|
|
10
|
-
AgentClientCapabilitySupport,
|
|
11
|
-
AgentClientState,
|
|
12
|
-
AgentClientSupportLevel
|
|
13
|
-
} from './types.ts';
|
|
8
|
+
import type { AgentClientState } from './types.ts';
|
|
14
9
|
|
|
15
10
|
function buildRegistry(): Readonly<{
|
|
16
11
|
registry: AgentClientRegistry;
|
|
@@ -97,35 +92,10 @@ function listInstalledAgentClientAdapters(
|
|
|
97
92
|
);
|
|
98
93
|
}
|
|
99
94
|
|
|
100
|
-
function getAgentClientCapability(
|
|
101
|
-
id: unknown,
|
|
102
|
-
capability: AgentClientCapabilityId
|
|
103
|
-
): AgentClientCapabilitySupport {
|
|
104
|
-
return getAgentClientAdapter(id).capabilities[capability];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
95
|
function getAgentClientModelSelection(id: unknown) {
|
|
108
96
|
return getAgentClientAdapter(id).modelSelection;
|
|
109
97
|
}
|
|
110
98
|
|
|
111
|
-
function getAgentClientDelegationEvidence(id: unknown) {
|
|
112
|
-
return getAgentClientAdapter(id).delegationEvidence;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function listEnabledAgentClientAdaptersByCapability(
|
|
116
|
-
state: AgentClientState,
|
|
117
|
-
capability: AgentClientCapabilityId,
|
|
118
|
-
acceptedLevels: readonly AgentClientSupportLevel[]
|
|
119
|
-
): readonly AgentClientAdapter[] {
|
|
120
|
-
const accepted = new Set(acceptedLevels);
|
|
121
|
-
return Object.freeze(
|
|
122
|
-
AGENT_CLIENT_ADAPTERS.filter((adapter) =>
|
|
123
|
-
state[adapter.id].enabled
|
|
124
|
-
&& accepted.has(adapter.capabilities[capability].level)
|
|
125
|
-
)
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
99
|
function createAgentClientManifest(): readonly AgentClientManifestEntry[] {
|
|
130
100
|
return Object.freeze(
|
|
131
101
|
AGENT_CLIENT_ADAPTERS.map((adapter) => Object.freeze({
|
|
@@ -152,11 +122,8 @@ export {
|
|
|
152
122
|
AGENT_CLIENT_REGISTRY,
|
|
153
123
|
createAgentClientManifest,
|
|
154
124
|
getAgentClientAdapter,
|
|
155
|
-
getAgentClientCapability,
|
|
156
|
-
getAgentClientDelegationEvidence,
|
|
157
125
|
getAgentClientModelSelection,
|
|
158
126
|
listAgentClientAdapters,
|
|
159
127
|
listEnabledAgentClientAdapters,
|
|
160
|
-
listEnabledAgentClientAdaptersByCapability,
|
|
161
128
|
listInstalledAgentClientAdapters
|
|
162
129
|
};
|
|
@@ -31,15 +31,6 @@ const AGENT_CLIENTS_SCHEMA = {
|
|
|
31
31
|
installInSandbox: {
|
|
32
32
|
type: 'boolean'
|
|
33
33
|
},
|
|
34
|
-
orchestration: {
|
|
35
|
-
type: 'object',
|
|
36
|
-
additionalProperties: false,
|
|
37
|
-
required: ['executor', 'reviewer'],
|
|
38
|
-
properties: {
|
|
39
|
-
executor: { $ref: '#/definitions/orchestrationRolePolicy' },
|
|
40
|
-
reviewer: { $ref: '#/definitions/orchestrationRolePolicy' }
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
34
|
}
|
|
44
35
|
}))
|
|
45
36
|
},
|
|
@@ -66,15 +57,6 @@ const AGENT_CLIENTS_SCHEMA = {
|
|
|
66
57
|
}
|
|
67
58
|
},
|
|
68
59
|
definitions: {
|
|
69
|
-
orchestrationRolePolicy: {
|
|
70
|
-
type: 'object',
|
|
71
|
-
additionalProperties: false,
|
|
72
|
-
required: ['model', 'reasoningEffort'],
|
|
73
|
-
properties: {
|
|
74
|
-
model: { type: 'string', minLength: 1 },
|
|
75
|
-
reasoningEffort: { type: 'string', minLength: 1 }
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
60
|
agentClientCapabilityId: {
|
|
79
61
|
type: 'string',
|
|
80
62
|
enum: [...AGENT_CLIENT_CAPABILITY_IDS]
|
|
@@ -5,8 +5,7 @@ export const AGENT_TOKEN_VALUES = ['claude', 'codex', 'antigravity', 'opencode',
|
|
|
5
5
|
export type AgentToken = (typeof AGENT_TOKEN_VALUES)[number];
|
|
6
6
|
export const KNOWN_AI_AGENTS: ReadonlySet<string> = new Set(AGENT_TOKEN_VALUES);
|
|
7
7
|
|
|
8
|
-
// Long name -> short name mapping
|
|
9
|
-
// orchestration precedent, and `antigravity-cli` is the active client.
|
|
8
|
+
// Long name -> short name mapping for the activity-log agent field.
|
|
10
9
|
export const AGENT_LONG_NAMES: Readonly<Record<string, string>> = {
|
|
11
10
|
'claude-code': 'claude',
|
|
12
11
|
'antigravity-cli': 'antigravity'
|
|
@@ -8,21 +8,10 @@ const AGENT_CLIENT_IDS = [
|
|
|
8
8
|
|
|
9
9
|
type AgentClientId = (typeof AGENT_CLIENT_IDS)[number];
|
|
10
10
|
|
|
11
|
-
type OrchestrationRolePolicy = Readonly<{
|
|
12
|
-
model: string;
|
|
13
|
-
reasoningEffort: string;
|
|
14
|
-
}>;
|
|
15
|
-
|
|
16
|
-
type OrchestrationModelPolicy = Readonly<{
|
|
17
|
-
executor: OrchestrationRolePolicy;
|
|
18
|
-
reviewer: OrchestrationRolePolicy;
|
|
19
|
-
}>;
|
|
20
|
-
|
|
21
11
|
type AgentClientConfig = Readonly<{
|
|
22
12
|
id: AgentClientId;
|
|
23
13
|
enabled: boolean;
|
|
24
14
|
installInSandbox: boolean;
|
|
25
|
-
orchestration?: OrchestrationModelPolicy;
|
|
26
15
|
}>;
|
|
27
16
|
|
|
28
17
|
type AgentClientsConfig = readonly AgentClientConfig[];
|
|
@@ -33,7 +22,6 @@ type AgentClientState = Readonly<
|
|
|
33
22
|
Readonly<{
|
|
34
23
|
enabled: boolean;
|
|
35
24
|
installInSandbox: boolean;
|
|
36
|
-
orchestration?: OrchestrationModelPolicy;
|
|
37
25
|
}>
|
|
38
26
|
>
|
|
39
27
|
>;
|
|
@@ -44,7 +32,6 @@ const AGENT_CLIENT_CAPABILITY_IDS = [
|
|
|
44
32
|
'commands',
|
|
45
33
|
'hooks',
|
|
46
34
|
'subagents',
|
|
47
|
-
'orchestration',
|
|
48
35
|
'sandbox',
|
|
49
36
|
'verification'
|
|
50
37
|
] as const;
|
|
@@ -81,8 +68,6 @@ export {
|
|
|
81
68
|
};
|
|
82
69
|
export type {
|
|
83
70
|
AgentClientId,
|
|
84
|
-
OrchestrationRolePolicy,
|
|
85
|
-
OrchestrationModelPolicy,
|
|
86
71
|
AgentClientConfig,
|
|
87
72
|
AgentClientsConfig,
|
|
88
73
|
AgentClientState,
|
package/lib/decide.ts
CHANGED
|
@@ -71,6 +71,7 @@ export async function decide(args: string[], options: DecideOptions = {}): Promi
|
|
|
71
71
|
};
|
|
72
72
|
const result = await applyHumanDecision(request, writeOptions);
|
|
73
73
|
if (result.error) throw new Error(result.error.message);
|
|
74
|
+
for (const warning of result.warnings ?? []) process.stderr.write(`Warning: ${warning.code}: ${warning.message}\n`);
|
|
74
75
|
return 0;
|
|
75
76
|
} catch (error) {
|
|
76
77
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -67,18 +67,8 @@ function assertGitWorktreeBinding(
|
|
|
67
67
|
return worktree;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
function assertGitRepositoryBinding(stateRoot: string, worktreeRoot: string): GitWorktreeIdentity {
|
|
71
|
-
const state = resolveGitWorktreeIdentity(stateRoot);
|
|
72
|
-
const worktree = resolveGitWorktreeIdentity(worktreeRoot);
|
|
73
|
-
if (!sameFilesystemEntry(state.commonDir, worktree.commonDir)) {
|
|
74
|
-
throw new Error('SANDBOX_CONTROL_WORKTREE_INVALID: state and worktree roots have different Git common directories');
|
|
75
|
-
}
|
|
76
|
-
return worktree;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
70
|
export {
|
|
80
71
|
assertGitWorktreeBinding,
|
|
81
|
-
assertGitRepositoryBinding,
|
|
82
72
|
normalizeCanonicalPath,
|
|
83
73
|
resolveGitWorktreeIdentity,
|
|
84
74
|
sameFilesystemEntry
|