@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
|
@@ -6,7 +6,7 @@ import { getProcessStartTime } from '../../server/process-state.js';
|
|
|
6
6
|
import { assertGitWorktreeBinding } from '../../git/worktree-identity.js';
|
|
7
7
|
import { controlError, DEFAULT_SANDBOX_CONTROL_TIMING, SANDBOX_CONTROL_MAX_RESPONSE_BYTES, SANDBOX_CONTROL_MAX_TERMINAL_RECORD_BYTES } from './protocol.js';
|
|
8
8
|
import { prepareSandboxControlExecution } from './executor.js';
|
|
9
|
-
import { atomicWriteJsonNoReplace, createSandboxControlPayload, cleanupStaleSandboxControlLease, executionPath, readJsonFile, readActiveLease, readExecution, readSandboxControlPayload, readSandboxControlResultEvidence, readSandboxControlTerminalResult, createSandboxControlTerminalResult, sandboxControlEncodedJsonBytes, sandboxControlGenerationUsage, sanitizeSandboxControlOutput, sanitizeSandboxControlResult, payloadPath, writeSandboxControlPayload, writeSandboxControlReservation, writeSandboxControlResultEvidence, writeSandboxControlTerminalResult,
|
|
9
|
+
import { atomicWriteJsonNoReplace, createSandboxControlPayload, cleanupStaleSandboxControlLease, executionPath, readJsonFile, readActiveLease, readExecution, readSandboxControlPayload, readSandboxControlResultEvidence, readSandboxControlTerminalResult, createSandboxControlTerminalResult, sandboxControlEncodedJsonBytes, sandboxControlGenerationUsage, sanitizeSandboxControlOutput, sanitizeSandboxControlResult, payloadPath, writeSandboxControlPayload, writeSandboxControlReservation, writeSandboxControlResultEvidence, writeSandboxControlTerminalResult, terminateSandboxControlExecution, writeSandboxControlStatus, readSandboxControlStatus } from './state.js';
|
|
10
10
|
import { validateSandboxControlRequest } from './protocol.js';
|
|
11
11
|
import { requestAuditFields, resultAuditFields, appendCriticalAudit, appendDiagnosticAudit, createSandboxControlAuditContext, writeSandboxControlTransition, readSandboxControlTransition } from './audit.js';
|
|
12
12
|
import { parseTaskControlOperation } from '../../task/control-authority.js';
|
|
@@ -15,11 +15,11 @@ import { readLifecycleJournalEvidence } from '../../task/lifecycle.js';
|
|
|
15
15
|
import { resolveTaskRef } from '../../task/resolve-ref.js';
|
|
16
16
|
import { loadShortIdByTaskId } from '../../task/short-id.js';
|
|
17
17
|
import { inspectSandboxControlContainer } from './container-identity.js';
|
|
18
|
-
import { acquireSandboxControlBrokerStartup,
|
|
18
|
+
import { acquireSandboxControlBrokerStartup, isSandboxControlRootQuiescing, readSandboxControlManifest } from './lifecycle.js';
|
|
19
19
|
import { nextSandboxControlBackoff } from './timing.js';
|
|
20
20
|
import { readTaskFinalizationReceipt } from '../../task/finalization.js';
|
|
21
21
|
import { validateSandboxControlIdentity } from './identity-sentinel.js';
|
|
22
|
-
import { mergeSandboxTaskView, taskViewForManifest } from './task-view.js';
|
|
22
|
+
import { mergeSandboxTaskView, taskViewForManifest, } from './task-view.js';
|
|
23
23
|
import { taskCreateOutputUnavailableResult } from '../../task/create-service.js';
|
|
24
24
|
function appendBrokerAudit(manifest, event, fields = {}) {
|
|
25
25
|
appendDiagnosticAudit(manifest, event, { source: 'broker', ...fields });
|
|
@@ -183,7 +183,7 @@ function taskCreateDomainEvidence(manifest, output) {
|
|
|
183
183
|
return { consistent: false };
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
async function readRecoveryDomain(manifest,
|
|
186
|
+
async function readRecoveryDomain(manifest, request, operation, terminalResult, payloadOutput) {
|
|
187
187
|
if (!operation)
|
|
188
188
|
return { domain: null };
|
|
189
189
|
const taskRef = 'args' in request ? request.args[0] ?? null : manifest.taskId;
|
|
@@ -192,9 +192,6 @@ async function readRecoveryDomain(manifest, manifestPath, request, operation, te
|
|
|
192
192
|
return { domain: null };
|
|
193
193
|
}
|
|
194
194
|
if (operation.family === 'task-lifecycle') {
|
|
195
|
-
if (operation.intent === 'recover-started') {
|
|
196
|
-
return { domain: null };
|
|
197
|
-
}
|
|
198
195
|
if (!taskRef || !terminalResult.targetState)
|
|
199
196
|
return { domain: null };
|
|
200
197
|
const journal = readLifecycleJournalEvidence(manifest.repoRoot, taskRef);
|
|
@@ -229,7 +226,7 @@ function readCommittedCriticalPhases(manifest, requestId) {
|
|
|
229
226
|
}
|
|
230
227
|
});
|
|
231
228
|
}
|
|
232
|
-
export async function recoveryResponse(manifest,
|
|
229
|
+
export async function recoveryResponse(manifest, request, evidence, payload, terminalResult) {
|
|
233
230
|
const operationName = recoveryOperationKey(request);
|
|
234
231
|
const operation = operationName ? findSandboxControlRecoveryOperation(request.family, operationName) : null;
|
|
235
232
|
if (!operation)
|
|
@@ -241,7 +238,7 @@ export async function recoveryResponse(manifest, manifestPath, request, evidence
|
|
|
241
238
|
if (JSON.stringify(payloadTerminal) !== JSON.stringify(terminalResult))
|
|
242
239
|
return unknown(request.id);
|
|
243
240
|
}
|
|
244
|
-
const recovery = await readRecoveryDomain(manifest,
|
|
241
|
+
const recovery = await readRecoveryDomain(manifest, request, operation, terminalResult, payload?.stdout ?? null);
|
|
245
242
|
const binding = operationRecoveryBinding(request.id, manifest.generation, manifest.taskId, request.family, operationName);
|
|
246
243
|
const decision = classifySandboxControlRecovery({
|
|
247
244
|
operation,
|
|
@@ -260,7 +257,7 @@ export async function recoveryResponse(manifest, manifestPath, request, evidence
|
|
|
260
257
|
return null;
|
|
261
258
|
return genericRecoveryResponse(request, evidence.exitCode, payload);
|
|
262
259
|
}
|
|
263
|
-
async function terminalMatchesEvidence(
|
|
260
|
+
async function terminalMatchesEvidence(request, response, evidence, payload, payloadInvalid) {
|
|
264
261
|
if (response.version !== 2 || response.id !== request.id || response.phase !== 'completed'
|
|
265
262
|
|| response.exitCode !== evidence.exitCode || response.error !== null) {
|
|
266
263
|
return { valid: false, payloadReferenced: false };
|
|
@@ -296,7 +293,7 @@ async function terminalMatchesEvidence(manifest, request, response, evidence, pa
|
|
|
296
293
|
}
|
|
297
294
|
function publishExecutionResult(manifest, request, result, brokerOwns) {
|
|
298
295
|
const normalized = sanitizeSandboxControlResult(manifest, result);
|
|
299
|
-
|
|
296
|
+
writeSandboxControlTerminalResult(manifest, {
|
|
300
297
|
id: request.id,
|
|
301
298
|
family: request.family,
|
|
302
299
|
operation: operationKey(request)
|
|
@@ -406,7 +403,7 @@ function assertCurrentSandboxControlIdentity(manifest, manifestPath) {
|
|
|
406
403
|
throw new Error(`SANDBOX_CONTROL_IDENTITY_${result.state.replaceAll('-', '_').toUpperCase()}`);
|
|
407
404
|
}
|
|
408
405
|
}
|
|
409
|
-
async function recoverProcessing(manifest,
|
|
406
|
+
async function recoverProcessing(manifest, brokerOwns) {
|
|
410
407
|
for (const entry of fs.readdirSync(manifest.processingDir, { withFileTypes: true })) {
|
|
411
408
|
if (!entry.isDirectory() || !/^[a-f0-9-]{16,64}$/.test(entry.name))
|
|
412
409
|
continue;
|
|
@@ -526,7 +523,7 @@ async function recoverProcessing(manifest, manifestPath, broker, brokerOwns) {
|
|
|
526
523
|
if (terminal && request && resultEvidence) {
|
|
527
524
|
if (!terminalResult && request.family !== 'task-create')
|
|
528
525
|
continue;
|
|
529
|
-
const reconciliation = await terminalMatchesEvidence(
|
|
526
|
+
const reconciliation = await terminalMatchesEvidence(request, existingTerminalResponse, resultEvidence, payload, payloadInvalid);
|
|
530
527
|
if (!reconciliation.valid)
|
|
531
528
|
continue;
|
|
532
529
|
terminalReconciled = true;
|
|
@@ -554,7 +551,7 @@ async function recoverProcessing(manifest, manifestPath, broker, brokerOwns) {
|
|
|
554
551
|
return false;
|
|
555
552
|
if (!resultEvidence || !request || payloadInvalid)
|
|
556
553
|
continue;
|
|
557
|
-
const recovered = await recoveryResponse(manifest,
|
|
554
|
+
const recovered = await recoveryResponse(manifest, request, resultEvidence, payload, terminalResult);
|
|
558
555
|
if (!recovered)
|
|
559
556
|
continue;
|
|
560
557
|
writeSandboxControlResponse(manifest, recovered);
|
|
@@ -704,7 +701,7 @@ export async function serveSandboxControl(manifestPath, signal = new AbortContro
|
|
|
704
701
|
pid: broker.pid,
|
|
705
702
|
brokerId: broker.brokerId
|
|
706
703
|
});
|
|
707
|
-
if (!await recoverProcessing(manifest,
|
|
704
|
+
if (!await recoverProcessing(manifest, brokerOwns))
|
|
708
705
|
return;
|
|
709
706
|
try {
|
|
710
707
|
const published = readSandboxControlStatus(manifest.publicStatusDir);
|
|
@@ -756,33 +753,16 @@ export async function serveSandboxControl(manifestPath, signal = new AbortContro
|
|
|
756
753
|
containerBackoffMs = timing.parkedBindingInitialMs;
|
|
757
754
|
nextContainerHeartbeatAt = Date.now() + timing.containerHeartbeatMs;
|
|
758
755
|
}
|
|
759
|
-
else
|
|
760
|
-
|
|
761
|
-
|
|
756
|
+
else {
|
|
757
|
+
const missing = observation.state === 'absent';
|
|
758
|
+
containerReasonCode = missing ? 'SANDBOX_CONTROL_CONTAINER_ABSENT' : 'SANDBOX_CONTROL_CONTAINER_UNKNOWN';
|
|
759
|
+
appendDiagnosticAudit(manifest, missing ? 'container-heartbeat-absent' : 'container-heartbeat-unknown', {
|
|
760
|
+
reason: observation.state === 'unknown' ? observation.reason : 'recorded container was not found'
|
|
761
|
+
});
|
|
762
762
|
const backoff = nextSandboxControlBackoff(containerBackoffMs, timing.slowCheckMs);
|
|
763
763
|
nextContainerHeartbeatAt = Date.now() + backoff.delayMs;
|
|
764
764
|
containerBackoffMs = backoff.nextDelayMs;
|
|
765
765
|
}
|
|
766
|
-
else {
|
|
767
|
-
try {
|
|
768
|
-
await garbageCollectSandboxControlRoot(root, {
|
|
769
|
-
timeoutMs: timing.quiesceDeadlineMs,
|
|
770
|
-
inspectContainer: (timeoutMs) => inspectContainer(manifest),
|
|
771
|
-
selfOwner: broker
|
|
772
|
-
});
|
|
773
|
-
active = null;
|
|
774
|
-
return;
|
|
775
|
-
}
|
|
776
|
-
catch (error) {
|
|
777
|
-
if (!brokerOwns())
|
|
778
|
-
break;
|
|
779
|
-
containerReasonCode = 'SANDBOX_CONTROL_CONTAINER_ABSENT_GC_FAILED';
|
|
780
|
-
appendDiagnosticAudit(manifest, 'container-gc-failed', { reason: controlError(error).code });
|
|
781
|
-
const backoff = nextSandboxControlBackoff(containerBackoffMs, timing.slowCheckMs);
|
|
782
|
-
nextContainerHeartbeatAt = Date.now() + backoff.delayMs;
|
|
783
|
-
containerBackoffMs = backoff.nextDelayMs;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
766
|
}
|
|
787
767
|
if (active?.settled) {
|
|
788
768
|
if (!brokerOwns())
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isCompletionEvidence } from '../../task/orchestration.js';
|
|
2
1
|
import { parseControlOutput } from '../../task/control-recovery.js';
|
|
3
2
|
import { execFileSync } from 'node:child_process';
|
|
4
3
|
import fs from 'node:fs';
|
|
@@ -79,9 +78,6 @@ export function terminalResultPath(manifest, requestId) {
|
|
|
79
78
|
}
|
|
80
79
|
export function createSandboxControlTerminalResult(manifest, request, output) {
|
|
81
80
|
const nested = parseControlOutput(output) ?? {};
|
|
82
|
-
const run = nested.run && typeof nested.run === 'object' && !Array.isArray(nested.run)
|
|
83
|
-
? nested.run : null;
|
|
84
|
-
const rawCompletion = nested.completionEvidence ?? run?.completionEvidence;
|
|
85
81
|
const operation = request.operation ?? (typeof nested.intent === 'string' ? nested.intent : null) ?? '';
|
|
86
82
|
return {
|
|
87
83
|
version: 1,
|
|
@@ -91,8 +87,7 @@ export function createSandboxControlTerminalResult(manifest, request, output) {
|
|
|
91
87
|
intentDigest: createHash('sha256').update(`${request.family}\0${operation}`, 'utf8').digest('hex'),
|
|
92
88
|
targetState: typeof nested.targetState === 'string' ? nested.targetState : null,
|
|
93
89
|
status: typeof nested.status === 'string' ? nested.status : 'completed',
|
|
94
|
-
changed: typeof nested.changed === 'boolean' ? nested.changed : null
|
|
95
|
-
completionEvidence: isCompletionEvidence(rawCompletion) ? rawCompletion : null
|
|
90
|
+
changed: typeof nested.changed === 'boolean' ? nested.changed : null
|
|
96
91
|
};
|
|
97
92
|
}
|
|
98
93
|
export function writeSandboxControlTerminalResult(manifest, request, output) {
|
|
@@ -120,9 +115,6 @@ export function readSandboxControlTerminalResult(filePath) {
|
|
|
120
115
|
|| (value.changed !== null && typeof value.changed !== 'boolean')) {
|
|
121
116
|
throw new Error('SANDBOX_CONTROL_TERMINAL_RESULT_INVALID');
|
|
122
117
|
}
|
|
123
|
-
if (value.completionEvidence !== null && !isCompletionEvidence(value.completionEvidence)) {
|
|
124
|
-
throw new Error('SANDBOX_CONTROL_TERMINAL_RESULT_INVALID');
|
|
125
|
-
}
|
|
126
118
|
if (value.changed === undefined) {
|
|
127
119
|
throw new Error('SANDBOX_CONTROL_TERMINAL_RESULT_INVALID');
|
|
128
120
|
}
|
|
@@ -91,10 +91,4 @@ export function prepareDockerfile(config, image = EMPTY_IMAGE_CONTRIBUTION) {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
export function composeDockerfile(config, image = EMPTY_IMAGE_CONTRIBUTION) {
|
|
95
|
-
const content = dockerfileContent(config, image);
|
|
96
|
-
const tempPath = path.join(os.tmpdir(), `${config.project}-sandbox.Dockerfile`);
|
|
97
|
-
fs.writeFileSync(tempPath, content, 'utf8');
|
|
98
|
-
return tempPath;
|
|
99
|
-
}
|
|
100
94
|
//# sourceMappingURL=dockerfile.js.map
|
|
@@ -131,20 +131,6 @@ export async function ensureDocker(config, onMessage, dependencies = {}) {
|
|
|
131
131
|
ensureBuildKit(engine, dependencies.runOkEngineFn ?? runOkEngine);
|
|
132
132
|
adapter.syncResources(effectiveConfig, onMessage, fns, { vmJustStarted });
|
|
133
133
|
}
|
|
134
|
-
export function isVmManaged(config = {}, dependencies = {}) {
|
|
135
|
-
try {
|
|
136
|
-
const engine = detectEngine(config, dependencies);
|
|
137
|
-
return isManagedEngine(engine);
|
|
138
|
-
}
|
|
139
|
-
catch (error) {
|
|
140
|
-
const message = error instanceof Error ? error.message : '';
|
|
141
|
-
if (message.startsWith('sandbox: platform "')
|
|
142
|
-
|| / is not supported on [^.]+\. Supported engines on [^:]+: none\./.test(message)) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
throw error;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
134
|
export function isManagedEngine(engine) {
|
|
149
135
|
try {
|
|
150
136
|
return getAdapter(engine).managed;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { commandForEngine, runProbe } from '../shell.js';
|
|
2
|
-
import { commandForSandboxAuthority } from './authority.js';
|
|
3
2
|
const FULL_CONTAINER_ID = /^[a-f0-9]{64}$/u;
|
|
4
3
|
function outputText(value) {
|
|
5
4
|
return typeof value === 'string' ? value : value?.toString('utf8') ?? '';
|
|
@@ -16,9 +15,7 @@ function buildExactContainerInspectArgs(id) {
|
|
|
16
15
|
return ['container', 'inspect', '--format', '{{json .}}', id];
|
|
17
16
|
}
|
|
18
17
|
function runDockerProbe(engine, args, options) {
|
|
19
|
-
const command =
|
|
20
|
-
? commandForSandboxAuthority(options.authority, 'docker', args)
|
|
21
|
-
: commandForEngine(engine, 'docker', args);
|
|
18
|
+
const command = commandForEngine(engine, 'docker', args);
|
|
22
19
|
return (options.probe ?? runProbe)(command.cmd, command.args, options.timeoutMs === undefined ? {} : { timeout: options.timeoutMs });
|
|
23
20
|
}
|
|
24
21
|
function parseExactList(stdout, expectedId) {
|
|
@@ -5,9 +5,6 @@ const UNC_PATH_PATTERN = /^(?:\\\\|\/\/)[^\\/]+[\\/][^\\/]+/;
|
|
|
5
5
|
export function hostJoin(basePath, ...segments) {
|
|
6
6
|
return basePath.startsWith('/') ? path.posix.join(basePath, ...segments) : path.join(basePath, ...segments);
|
|
7
7
|
}
|
|
8
|
-
export function isWindowsDrivePath(value) {
|
|
9
|
-
return typeof value === 'string' && WINDOWS_DRIVE_PATH_PATTERN.test(value);
|
|
10
|
-
}
|
|
11
8
|
export function isUncPath(value) {
|
|
12
9
|
return typeof value === 'string' && UNC_PATH_PATTERN.test(value);
|
|
13
10
|
}
|
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { nodeEntryArgs } from './control/executor.js';
|
|
7
|
-
import { containerNameCandidates, sandboxBranchLabel, sandboxLabel, sandboxTaskIdLabel, sandboxWorkspaceModeLabel, worktreeDirCandidates } from './constants.js';
|
|
7
|
+
import { containerName, containerNameCandidates, sandboxBranchLabel, sandboxLabel, sandboxTaskIdLabel, sandboxWorkspaceModeLabel, worktreeDirCandidates } from './constants.js';
|
|
8
8
|
import { createSandboxCapabilityPlan } from './agent-client-reconciler.js';
|
|
9
9
|
import { toEnginePath } from './engines/wsl2-paths.js';
|
|
10
10
|
import { sandboxCoreBindMounts } from './mounts.js';
|
|
@@ -18,7 +18,7 @@ import { commandForEngine, runEngine, runOkEngine, runProbe, runVerboseEngine }
|
|
|
18
18
|
import { declaredTmpfsSeedEntries, resolveTools, toolConfigDirCandidates } from './tools.js';
|
|
19
19
|
import { fetchSandboxRows, selectSandboxContainer, startSandboxContainer } from './commands/list-running.js';
|
|
20
20
|
import { getProcessIdentityState, getProcessStartTime, removePidFileIfMatches } from '../server/process-state.js';
|
|
21
|
-
import { acquireSandboxControlBrokerStartup,
|
|
21
|
+
import { acquireSandboxControlBrokerStartup, isSandboxControlRootQuiescing, readSandboxControlManifest } from './control/lifecycle.js';
|
|
22
22
|
import { readSandboxControlStatus } from './control/state.js';
|
|
23
23
|
import { validateSandboxControlIdentity } from './control/identity-sentinel.js';
|
|
24
24
|
import { appendDiagnosticAudit as appendControlDiagnosticAudit } from './control/audit.js';
|
|
@@ -198,9 +198,6 @@ async function ensureSandboxControlBroker(params) {
|
|
|
198
198
|
throw new Error(`SANDBOX_CONTROL_CONTAINER_UNKNOWN: ${containerObservation.reason}`);
|
|
199
199
|
}
|
|
200
200
|
if (containerObservation.state === 'absent') {
|
|
201
|
-
await garbageCollectSandboxControlRoot(control.root, {
|
|
202
|
-
inspectContainer: (timeoutMs) => inspectSandboxControlContainer(validatedManifest, { timeoutMs })
|
|
203
|
-
});
|
|
204
201
|
throw new Error('SANDBOX_CONTROL_CONTAINER_ABSENT: recreate the sandbox container before broker recovery');
|
|
205
202
|
}
|
|
206
203
|
const brokerPath = path.join(control.root, 'broker.json');
|
|
@@ -916,6 +913,7 @@ export async function ensureSandboxReady(params) {
|
|
|
916
913
|
const deps = params.deps;
|
|
917
914
|
const startFn = deps?.start ?? startSandboxContainer;
|
|
918
915
|
const warnings = [];
|
|
916
|
+
const container = params.row?.name ?? containerName(params.config, params.branch);
|
|
919
917
|
let failure = null;
|
|
920
918
|
try {
|
|
921
919
|
if (deps?.ensureControlBroker) {
|
|
@@ -924,11 +922,11 @@ export async function ensureSandboxReady(params) {
|
|
|
924
922
|
else {
|
|
925
923
|
await ensureSandboxControlBroker({
|
|
926
924
|
config: params.config,
|
|
927
|
-
container:
|
|
925
|
+
container: container,
|
|
928
926
|
workspace: params.workspace ?? { mode: 'branch-only' }
|
|
929
927
|
});
|
|
930
928
|
}
|
|
931
|
-
if (params.forceRecreate || (params.reentry === 'completed' && params.allowRecreate)) {
|
|
929
|
+
if (!params.row || params.forceRecreate || (params.reentry === 'completed' && params.allowRecreate)) {
|
|
932
930
|
throw new Error('Explicit container recreation requested.');
|
|
933
931
|
}
|
|
934
932
|
if (!params.row.running) {
|
|
@@ -936,7 +934,7 @@ export async function ensureSandboxReady(params) {
|
|
|
936
934
|
if (params.reentry === 'completed' && params.workspace?.mode === 'task-bound') {
|
|
937
935
|
const control = sandboxControlPaths({
|
|
938
936
|
base: params.config.controlBase, project: params.config.project,
|
|
939
|
-
container:
|
|
937
|
+
container: container, identity: params.workspace
|
|
940
938
|
});
|
|
941
939
|
const manifest = readSandboxControlManifest(control.manifestPath);
|
|
942
940
|
if (manifest.taskId !== params.workspace.taskId || manifest.branch !== params.branch) {
|
|
@@ -946,20 +944,20 @@ export async function ensureSandboxReady(params) {
|
|
|
946
944
|
startCompletedSandboxContainer({
|
|
947
945
|
config: params.config,
|
|
948
946
|
engine: params.engine,
|
|
949
|
-
container:
|
|
947
|
+
container: container,
|
|
950
948
|
taskId: params.workspace.taskId,
|
|
951
949
|
start: startFn
|
|
952
950
|
});
|
|
953
951
|
}
|
|
954
952
|
else {
|
|
955
|
-
startFn(params.engine,
|
|
953
|
+
startFn(params.engine, container);
|
|
956
954
|
}
|
|
957
955
|
const initial = assess({
|
|
958
956
|
config: params.config,
|
|
959
957
|
engine: params.engine,
|
|
960
958
|
branch: params.branch,
|
|
961
959
|
workspace: params.workspace,
|
|
962
|
-
container:
|
|
960
|
+
container: container,
|
|
963
961
|
deps
|
|
964
962
|
});
|
|
965
963
|
if (initial.findings.some((finding) => finding.repairKind === 'hard-failure')) {
|
|
@@ -968,13 +966,13 @@ export async function ensureSandboxReady(params) {
|
|
|
968
966
|
const tools = resolveTools(params.config);
|
|
969
967
|
prepareTmpfsMounts({
|
|
970
968
|
engine: params.engine,
|
|
971
|
-
container:
|
|
969
|
+
container: container,
|
|
972
970
|
mountPaths: tools.filter((tool) => tool.tmpfs).map((tool) => tool.containerMount),
|
|
973
971
|
deps
|
|
974
972
|
});
|
|
975
973
|
hydrateTmpfsSeedEntries({
|
|
976
974
|
engine: params.engine,
|
|
977
|
-
container:
|
|
975
|
+
container: container,
|
|
978
976
|
entries: mountedSeeds(initial.snapshot),
|
|
979
977
|
replace: true,
|
|
980
978
|
deps
|
|
@@ -984,13 +982,13 @@ export async function ensureSandboxReady(params) {
|
|
|
984
982
|
engine: params.engine,
|
|
985
983
|
branch: params.branch,
|
|
986
984
|
workspace: params.workspace,
|
|
987
|
-
container:
|
|
985
|
+
container: container,
|
|
988
986
|
deps
|
|
989
987
|
});
|
|
990
988
|
if (!final.findings.some((finding) => finding.repairKind === 'hard-failure')) {
|
|
991
989
|
repairFindings({
|
|
992
990
|
engine: params.engine,
|
|
993
|
-
container:
|
|
991
|
+
container: container,
|
|
994
992
|
findings: final.findings,
|
|
995
993
|
deps
|
|
996
994
|
});
|
|
@@ -999,7 +997,7 @@ export async function ensureSandboxReady(params) {
|
|
|
999
997
|
engine: params.engine,
|
|
1000
998
|
branch: params.branch,
|
|
1001
999
|
workspace: params.workspace,
|
|
1002
|
-
container:
|
|
1000
|
+
container: container,
|
|
1003
1001
|
deps
|
|
1004
1002
|
});
|
|
1005
1003
|
}
|
|
@@ -1015,18 +1013,18 @@ export async function ensureSandboxReady(params) {
|
|
|
1015
1013
|
publishCompletedReentry(manifest, evidence);
|
|
1016
1014
|
await waitForCompletedReentry(manifest, evidence);
|
|
1017
1015
|
}
|
|
1018
|
-
return { container:
|
|
1016
|
+
return { container: container, path: 'recovered', warnings };
|
|
1019
1017
|
}
|
|
1020
1018
|
const initial = assess({
|
|
1021
1019
|
config: params.config,
|
|
1022
1020
|
engine: params.engine,
|
|
1023
1021
|
branch: params.branch,
|
|
1024
1022
|
workspace: params.workspace,
|
|
1025
|
-
container:
|
|
1023
|
+
container: container,
|
|
1026
1024
|
deps
|
|
1027
1025
|
});
|
|
1028
1026
|
if (initial.findings.length === 0) {
|
|
1029
|
-
return { container:
|
|
1027
|
+
return { container: container, path: 'healthy', warnings };
|
|
1030
1028
|
}
|
|
1031
1029
|
if (initial.findings.some((finding) => finding.repairKind === 'hard-failure')) {
|
|
1032
1030
|
throw new Error(describeFindings(initial.findings));
|
|
@@ -1036,7 +1034,7 @@ export async function ensureSandboxReady(params) {
|
|
|
1036
1034
|
if (permissionFindings.length > 0) {
|
|
1037
1035
|
repairFindings({
|
|
1038
1036
|
engine: params.engine,
|
|
1039
|
-
container:
|
|
1037
|
+
container: container,
|
|
1040
1038
|
findings: permissionFindings,
|
|
1041
1039
|
deps
|
|
1042
1040
|
});
|
|
@@ -1045,7 +1043,7 @@ export async function ensureSandboxReady(params) {
|
|
|
1045
1043
|
engine: params.engine,
|
|
1046
1044
|
branch: params.branch,
|
|
1047
1045
|
workspace: params.workspace,
|
|
1048
|
-
container:
|
|
1046
|
+
container: container,
|
|
1049
1047
|
deps
|
|
1050
1048
|
});
|
|
1051
1049
|
if (current.findings.some((finding) => finding.repairKind === 'hard-failure'
|
|
@@ -1055,7 +1053,7 @@ export async function ensureSandboxReady(params) {
|
|
|
1055
1053
|
}
|
|
1056
1054
|
repairFindings({
|
|
1057
1055
|
engine: params.engine,
|
|
1058
|
-
container:
|
|
1056
|
+
container: container,
|
|
1059
1057
|
findings: current.findings,
|
|
1060
1058
|
deps
|
|
1061
1059
|
});
|
|
@@ -1064,13 +1062,13 @@ export async function ensureSandboxReady(params) {
|
|
|
1064
1062
|
engine: params.engine,
|
|
1065
1063
|
branch: params.branch,
|
|
1066
1064
|
workspace: params.workspace,
|
|
1067
|
-
container:
|
|
1065
|
+
container: container,
|
|
1068
1066
|
deps
|
|
1069
1067
|
});
|
|
1070
1068
|
if (final.findings.length > 0) {
|
|
1071
1069
|
throw new Error(describeFindings(final.findings));
|
|
1072
1070
|
}
|
|
1073
|
-
return { container:
|
|
1071
|
+
return { container: container, path: 'recovered', warnings };
|
|
1074
1072
|
}
|
|
1075
1073
|
catch (error) {
|
|
1076
1074
|
failure = error instanceof Error ? error : new Error(String(error));
|
|
@@ -1081,7 +1079,7 @@ export async function ensureSandboxReady(params) {
|
|
|
1081
1079
|
}
|
|
1082
1080
|
const taskId = params.workspace.taskId;
|
|
1083
1081
|
const commandChain = [
|
|
1084
|
-
`docker exec -it ${
|
|
1082
|
+
`docker exec -it ${container} bash /usr/local/bin/sandbox-tmux-entry`,
|
|
1085
1083
|
`ai sandbox rm ${taskId}`,
|
|
1086
1084
|
`ai sandbox create ${params.branch}`
|
|
1087
1085
|
];
|
|
@@ -1093,7 +1091,7 @@ export async function ensureSandboxReady(params) {
|
|
|
1093
1091
|
: 'Completed sandbox recovery failed; the existing container was not replaced.';
|
|
1094
1092
|
throw new Error([
|
|
1095
1093
|
`${code}: ${lead}`,
|
|
1096
|
-
`Task: ${taskId}; container: ${
|
|
1094
|
+
`Task: ${taskId}; container: ${container}; branch: ${params.branch}.`,
|
|
1097
1095
|
'To preserve the current container state, enter it manually with:',
|
|
1098
1096
|
` ${commandChain[0]}`,
|
|
1099
1097
|
'If you intentionally want a replacement, the following is the full interactive sandbox cleanup, not a container-only delete.',
|