@elie-laloum/outpost 2.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +3 -1
- package/SECURITY.md +3 -1
- package/dist/adapters/agents/claude-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/claude-diagnostics.js +7 -0
- package/dist/adapters/agents/claude-diagnostics.js.map +1 -0
- package/dist/adapters/agents/cli-diagnostics.constants.d.ts +12 -0
- package/dist/adapters/agents/cli-diagnostics.constants.js +24 -0
- package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -0
- package/dist/adapters/agents/cli-diagnostics.d.ts +4 -0
- package/dist/adapters/agents/cli-diagnostics.js +14 -0
- package/dist/adapters/agents/cli-diagnostics.js.map +1 -0
- package/dist/adapters/agents/cli-diagnostics.types.d.ts +13 -0
- package/dist/adapters/agents/cli-diagnostics.types.js +2 -0
- package/dist/adapters/agents/cli-diagnostics.types.js.map +1 -0
- package/dist/adapters/agents/codex-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/codex-diagnostics.js +7 -0
- package/dist/adapters/agents/codex-diagnostics.js.map +1 -0
- package/dist/adapters/agents/gemini-adapter.d.ts +3 -0
- package/dist/adapters/agents/gemini-adapter.js +15 -0
- package/dist/adapters/agents/gemini-adapter.js.map +1 -0
- package/dist/adapters/agents/gemini-diagnostics.d.ts +2 -0
- package/dist/adapters/agents/gemini-diagnostics.js +15 -0
- package/dist/adapters/agents/gemini-diagnostics.js.map +1 -0
- package/dist/adapters/agents/gemini-events.d.ts +2 -0
- package/dist/adapters/agents/gemini-events.js +50 -0
- package/dist/adapters/agents/gemini-events.js.map +1 -0
- package/dist/adapters/agents/gemini-request.d.ts +4 -0
- package/dist/adapters/agents/gemini-request.js +21 -0
- package/dist/adapters/agents/gemini-request.js.map +1 -0
- package/dist/adapters/agents/gemini.types.d.ts +6 -0
- package/dist/adapters/agents/gemini.types.js +2 -0
- package/dist/adapters/agents/gemini.types.js.map +1 -0
- package/dist/adapters/agents/protocol-fixtures.constants.d.ts +2 -0
- package/dist/adapters/agents/protocol-fixtures.constants.js +105 -0
- package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -0
- package/dist/adapters/agents/protocol-fixtures.types.d.ts +6 -0
- package/dist/adapters/agents/protocol-fixtures.types.js +2 -0
- package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -0
- package/dist/application/agent-bootstrap.constants.d.ts +1 -0
- package/dist/application/agent-bootstrap.constants.js +1 -0
- package/dist/application/agent-bootstrap.constants.js.map +1 -1
- package/dist/application/agent-bootstrap.js +6 -2
- package/dist/application/agent-bootstrap.js.map +1 -1
- package/dist/application/agent-output.js +9 -2
- package/dist/application/agent-output.js.map +1 -1
- package/dist/application/artifact-tasks.d.ts +5 -0
- package/dist/application/artifact-tasks.js +31 -0
- package/dist/application/artifact-tasks.js.map +1 -0
- package/dist/application/artifact-tasks.types.d.ts +8 -0
- package/dist/application/artifact-tasks.types.js +2 -0
- package/dist/application/artifact-tasks.types.js.map +1 -0
- package/dist/application/diagnostic-probe.d.ts +3 -0
- package/dist/application/diagnostic-probe.js +55 -0
- package/dist/application/diagnostic-probe.js.map +1 -0
- package/dist/application/dispatch-validation.js +2 -0
- package/dist/application/dispatch-validation.js.map +1 -1
- package/dist/application/doctor-agent.constants.d.ts +11 -0
- package/dist/application/doctor-agent.constants.js +10 -0
- package/dist/application/doctor-agent.constants.js.map +1 -0
- package/dist/application/doctor-agent.d.ts +3 -0
- package/dist/application/doctor-agent.js +53 -0
- package/dist/application/doctor-agent.js.map +1 -0
- package/dist/application/doctor-image.d.ts +3 -0
- package/dist/application/doctor-image.js +133 -0
- package/dist/application/doctor-image.js.map +1 -0
- package/dist/application/doctor-protocol.d.ts +3 -0
- package/dist/application/doctor-protocol.js +30 -0
- package/dist/application/doctor-protocol.js.map +1 -0
- package/dist/application/doctor-protocol.types.d.ts +10 -0
- package/dist/application/doctor-protocol.types.js +2 -0
- package/dist/application/doctor-protocol.types.js.map +1 -0
- package/dist/application/doctor-sandbox.constants.d.ts +5 -0
- package/dist/application/doctor-sandbox.constants.js +6 -0
- package/dist/application/doctor-sandbox.constants.js.map +1 -0
- package/dist/application/doctor-sandbox.d.ts +4 -0
- package/dist/application/doctor-sandbox.js +133 -0
- package/dist/application/doctor-sandbox.js.map +1 -0
- package/dist/application/doctor-sandbox.types.d.ts +23 -0
- package/dist/application/doctor-sandbox.types.js +2 -0
- package/dist/application/doctor-sandbox.types.js.map +1 -0
- package/dist/application/doctor-transfers.constants.d.ts +6 -0
- package/dist/application/doctor-transfers.constants.js +7 -0
- package/dist/application/doctor-transfers.constants.js.map +1 -0
- package/dist/application/doctor-transfers.d.ts +4 -0
- package/dist/application/doctor-transfers.js +88 -0
- package/dist/application/doctor-transfers.js.map +1 -0
- package/dist/application/doctor.constants.d.ts +9 -0
- package/dist/application/doctor.constants.js +15 -0
- package/dist/application/doctor.constants.js.map +1 -0
- package/dist/application/doctor.d.ts +3 -0
- package/dist/application/doctor.js +106 -0
- package/dist/application/doctor.js.map +1 -0
- package/dist/application/doctor.types.d.ts +39 -0
- package/dist/application/doctor.types.js +2 -0
- package/dist/application/doctor.types.js.map +1 -0
- package/dist/application/execution.js +1 -0
- package/dist/application/execution.js.map +1 -1
- package/dist/application/outpost.types.d.ts +4 -0
- package/dist/application/outpost.types.js.map +1 -1
- package/dist/application/queue-worker.d.ts +2 -0
- package/dist/application/queue-worker.js +75 -0
- package/dist/application/queue-worker.js.map +1 -0
- package/dist/application/queue-worker.types.d.ts +15 -0
- package/dist/application/queue-worker.types.js +2 -0
- package/dist/application/queue-worker.types.js.map +1 -0
- package/dist/application/queued-task.d.ts +3 -0
- package/dist/application/queued-task.js +56 -0
- package/dist/application/queued-task.js.map +1 -0
- package/dist/application/queued-task.types.d.ts +11 -0
- package/dist/application/queued-task.types.js +2 -0
- package/dist/application/queued-task.types.js.map +1 -0
- package/dist/application/recovery-checksum-capture.d.ts +2 -0
- package/dist/application/recovery-checksum-capture.js +32 -0
- package/dist/application/recovery-checksum-capture.js.map +1 -0
- package/dist/application/recovery-checksum-paths.d.ts +2 -0
- package/dist/application/recovery-checksum-paths.js +11 -0
- package/dist/application/recovery-checksum-paths.js.map +1 -0
- package/dist/application/recovery-checksums.constants.d.ts +5 -0
- package/dist/application/recovery-checksums.constants.js +6 -0
- package/dist/application/recovery-checksums.constants.js.map +1 -0
- package/dist/application/recovery-checksums.d.ts +3 -0
- package/dist/application/recovery-checksums.js +94 -0
- package/dist/application/recovery-checksums.js.map +1 -0
- package/dist/application/recovery-checksums.types.d.ts +17 -0
- package/dist/application/recovery-checksums.types.js +2 -0
- package/dist/application/recovery-checksums.types.js.map +1 -0
- package/dist/application/recovery-inspection.d.ts +2 -0
- package/dist/application/recovery-inspection.js +32 -0
- package/dist/application/recovery-inspection.js.map +1 -0
- package/dist/application/recovery-inspection.types.d.ts +18 -0
- package/dist/application/recovery-inspection.types.js +2 -0
- package/dist/application/recovery-inspection.types.js.map +1 -0
- package/dist/application/recovery-restorability.d.ts +2 -0
- package/dist/application/recovery-restorability.js +137 -0
- package/dist/application/recovery-restorability.js.map +1 -0
- package/dist/application/recovery-restore-snapshot.d.ts +2 -0
- package/dist/application/recovery-restore-snapshot.js +57 -0
- package/dist/application/recovery-restore-snapshot.js.map +1 -0
- package/dist/application/recovery-restore.d.ts +3 -0
- package/dist/application/recovery-restore.js +161 -0
- package/dist/application/recovery-restore.js.map +1 -0
- package/dist/application/recovery-restore.types.d.ts +28 -0
- package/dist/application/recovery-restore.types.js +2 -0
- package/dist/application/recovery-restore.types.js.map +1 -0
- package/dist/application/recovery-retention-policy.d.ts +2 -0
- package/dist/application/recovery-retention-policy.js +21 -0
- package/dist/application/recovery-retention-policy.js.map +1 -0
- package/dist/application/recovery-retention.constants.d.ts +3 -0
- package/dist/application/recovery-retention.constants.js +2 -0
- package/dist/application/recovery-retention.constants.js.map +1 -0
- package/dist/application/recovery-retention.d.ts +4 -0
- package/dist/application/recovery-retention.js +207 -0
- package/dist/application/recovery-retention.js.map +1 -0
- package/dist/application/recovery-retention.types.d.ts +52 -0
- package/dist/application/recovery-retention.types.js +2 -0
- package/dist/application/recovery-retention.types.js.map +1 -0
- package/dist/application/recovery-verification.constants.d.ts +5 -0
- package/dist/application/recovery-verification.constants.js +10 -0
- package/dist/application/recovery-verification.constants.js.map +1 -0
- package/dist/application/recovery-verification.d.ts +3 -0
- package/dist/application/recovery-verification.js +107 -0
- package/dist/application/recovery-verification.js.map +1 -0
- package/dist/application/recovery-verification.types.d.ts +26 -0
- package/dist/application/recovery-verification.types.js +2 -0
- package/dist/application/recovery-verification.types.js.map +1 -0
- package/dist/application/remote-apply.js +30 -6
- package/dist/application/remote-apply.js.map +1 -1
- package/dist/application/remote-backup.js +6 -2
- package/dist/application/remote-backup.js.map +1 -1
- package/dist/application/remote-download.js +38 -6
- package/dist/application/remote-download.js.map +1 -1
- package/dist/application/remote-history.d.ts +6 -0
- package/dist/application/remote-history.js +114 -0
- package/dist/application/remote-history.js.map +1 -0
- package/dist/application/remote-upload.d.ts +2 -0
- package/dist/application/remote-upload.js +17 -0
- package/dist/application/remote-upload.js.map +1 -0
- package/dist/application/remote-validation.js +39 -28
- package/dist/application/remote-validation.js.map +1 -1
- package/dist/application/remote-workspace.constants.d.ts +3 -0
- package/dist/application/remote-workspace.constants.js +2 -0
- package/dist/application/remote-workspace.constants.js.map +1 -0
- package/dist/application/remote-workspace.js +10 -10
- package/dist/application/remote-workspace.js.map +1 -1
- package/dist/application/remote-workspace.types.d.ts +3 -1
- package/dist/application/remote-workspace.types.js.map +1 -1
- package/dist/application/sandbox-activity.d.ts +3 -0
- package/dist/application/sandbox-activity.js +25 -0
- package/dist/application/sandbox-activity.js.map +1 -0
- package/dist/application/sandbox-provision.js +55 -10
- package/dist/application/sandbox-provision.js.map +1 -1
- package/dist/application/sandbox-session.types.d.ts +2 -0
- package/dist/application/sandbox-session.types.js.map +1 -1
- package/dist/application/sandbox.js +33 -10
- package/dist/application/sandbox.js.map +1 -1
- package/dist/application/speculation-host.d.ts +2 -0
- package/dist/application/speculation-host.js +30 -0
- package/dist/application/speculation-host.js.map +1 -0
- package/dist/application/speculation.constants.d.ts +4 -0
- package/dist/application/speculation.constants.js +2 -0
- package/dist/application/speculation.constants.js.map +1 -0
- package/dist/application/speculation.d.ts +2 -0
- package/dist/application/speculation.js +166 -0
- package/dist/application/speculation.js.map +1 -0
- package/dist/application/speculation.types.d.ts +56 -0
- package/dist/application/speculation.types.js +2 -0
- package/dist/application/speculation.types.js.map +1 -0
- package/dist/application/storage-reservation.d.ts +3 -0
- package/dist/application/storage-reservation.js +10 -0
- package/dist/application/storage-reservation.js.map +1 -0
- package/dist/application/storage-reservation.types.d.ts +4 -0
- package/dist/application/storage-reservation.types.js +2 -0
- package/dist/application/storage-reservation.types.js.map +1 -0
- package/dist/application/task-usage.d.ts +4 -0
- package/dist/application/task-usage.js +41 -0
- package/dist/application/task-usage.js.map +1 -0
- package/dist/application/task-usage.types.d.ts +5 -0
- package/dist/application/task-usage.types.js +2 -0
- package/dist/application/task-usage.types.js.map +1 -0
- package/dist/application/tasks.js +23 -2
- package/dist/application/tasks.js.map +1 -1
- package/dist/application/tasks.types.d.ts +4 -3
- package/dist/application/tasks.types.js.map +1 -1
- package/dist/application/workspace-allocation.d.ts +3 -0
- package/dist/application/workspace-allocation.js +34 -0
- package/dist/application/workspace-allocation.js.map +1 -0
- package/dist/application/workspace.js +2 -2
- package/dist/application/workspace.js.map +1 -1
- package/dist/cli/commands.js +4 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/doctor-command.d.ts +3 -0
- package/dist/cli/doctor-command.js +38 -0
- package/dist/cli/doctor-command.js.map +1 -0
- package/dist/cli/main.constants.d.ts +38 -2
- package/dist/cli/main.constants.js +21 -2
- package/dist/cli/main.constants.js.map +1 -1
- package/dist/cli/recovery-command.d.ts +2 -0
- package/dist/cli/recovery-command.js +93 -0
- package/dist/cli/recovery-command.js.map +1 -0
- package/dist/cli/recovery-prune-command.d.ts +2 -0
- package/dist/cli/recovery-prune-command.js +34 -0
- package/dist/cli/recovery-prune-command.js.map +1 -0
- package/dist/cli/recovery-restore-command.d.ts +2 -0
- package/dist/cli/recovery-restore-command.js +34 -0
- package/dist/cli/recovery-restore-command.js.map +1 -0
- package/dist/cli/recovery-verify-command.d.ts +2 -0
- package/dist/cli/recovery-verify-command.js +43 -0
- package/dist/cli/recovery-verify-command.js.map +1 -0
- package/dist/cli/scaffold-files.js +2 -2
- package/dist/cli/scaffold-files.js.map +1 -1
- package/dist/cli/scaffold-validation.js +1 -1
- package/dist/cli/scaffold-validation.js.map +1 -1
- package/dist/cli/scaffold.constants.d.ts +5 -0
- package/dist/cli/scaffold.constants.js +7 -2
- package/dist/cli/scaffold.constants.js.map +1 -1
- package/dist/cli/scaffold.types.d.ts +1 -1
- package/dist/cli/scaffold.types.js.map +1 -1
- package/dist/domain/agent.types.d.ts +2 -0
- package/dist/domain/agent.types.js.map +1 -1
- package/dist/domain/artifact-reference.d.ts +4 -0
- package/dist/domain/artifact-reference.js +90 -0
- package/dist/domain/artifact-reference.js.map +1 -0
- package/dist/domain/artifact.constants.d.ts +2 -0
- package/dist/domain/artifact.constants.js +3 -0
- package/dist/domain/artifact.constants.js.map +1 -0
- package/dist/domain/artifact.d.ts +7 -0
- package/dist/domain/artifact.js +104 -0
- package/dist/domain/artifact.js.map +1 -0
- package/dist/domain/artifact.types.d.ts +44 -0
- package/dist/domain/artifact.types.js +2 -0
- package/dist/domain/artifact.types.js.map +1 -0
- package/dist/domain/egress.constants.d.ts +1 -0
- package/dist/domain/egress.constants.js +7 -0
- package/dist/domain/egress.constants.js.map +1 -0
- package/dist/domain/egress.d.ts +2 -0
- package/dist/domain/egress.js +48 -0
- package/dist/domain/egress.js.map +1 -0
- package/dist/domain/egress.types.d.ts +8 -0
- package/dist/domain/egress.types.js +2 -0
- package/dist/domain/egress.types.js.map +1 -0
- package/dist/domain/ports.d.ts +1 -1
- package/dist/domain/ports.js.map +1 -1
- package/dist/domain/sandbox.types.d.ts +13 -0
- package/dist/domain/sandbox.types.js.map +1 -1
- package/dist/domain/task-queue.constants.d.ts +8 -0
- package/dist/domain/task-queue.constants.js +9 -0
- package/dist/domain/task-queue.constants.js.map +1 -0
- package/dist/domain/task-queue.d.ts +11 -0
- package/dist/domain/task-queue.js +105 -0
- package/dist/domain/task-queue.js.map +1 -0
- package/dist/domain/task-queue.types.d.ts +41 -0
- package/dist/domain/task-queue.types.js +2 -0
- package/dist/domain/task-queue.types.js.map +1 -0
- package/dist/domain/workflow/budget.constants.d.ts +1 -0
- package/dist/domain/workflow/budget.constants.js +7 -0
- package/dist/domain/workflow/budget.constants.js.map +1 -0
- package/dist/domain/workflow/budget.d.ts +9 -0
- package/dist/domain/workflow/budget.js +69 -0
- package/dist/domain/workflow/budget.js.map +1 -0
- package/dist/domain/workflow/budget.types.d.ts +15 -0
- package/dist/domain/workflow/budget.types.js +2 -0
- package/dist/domain/workflow/budget.types.js.map +1 -0
- package/dist/domain/workflow/checkpoint-validation.d.ts +3 -0
- package/dist/domain/workflow/checkpoint-validation.js +81 -0
- package/dist/domain/workflow/checkpoint-validation.js.map +1 -0
- package/dist/domain/workflow/checkpoint-value.d.ts +2 -0
- package/dist/domain/workflow/checkpoint-value.js +49 -0
- package/dist/domain/workflow/checkpoint-value.js.map +1 -0
- package/dist/domain/workflow/checkpoint.d.ts +3 -0
- package/dist/domain/workflow/checkpoint.js +70 -0
- package/dist/domain/workflow/checkpoint.js.map +1 -0
- package/dist/domain/workflow/checkpoint.types.d.ts +40 -0
- package/dist/domain/workflow/checkpoint.types.js +2 -0
- package/dist/domain/workflow/checkpoint.types.js.map +1 -0
- package/dist/domain/workflow/gate-validation.d.ts +4 -0
- package/dist/domain/workflow/gate-validation.js +71 -0
- package/dist/domain/workflow/gate-validation.js.map +1 -0
- package/dist/domain/workflow/gates.constants.d.ts +4 -0
- package/dist/domain/workflow/gates.constants.js +5 -0
- package/dist/domain/workflow/gates.constants.js.map +1 -0
- package/dist/domain/workflow/gates.d.ts +7 -0
- package/dist/domain/workflow/gates.js +85 -0
- package/dist/domain/workflow/gates.js.map +1 -0
- package/dist/domain/workflow/gates.types.d.ts +27 -0
- package/dist/domain/workflow/gates.types.js +2 -0
- package/dist/domain/workflow/gates.types.js.map +1 -0
- package/dist/domain/workflow/task-runner.js +22 -3
- package/dist/domain/workflow/task-runner.js.map +1 -1
- package/dist/domain/workflow/usage-receipt.constants.d.ts +2 -0
- package/dist/domain/workflow/usage-receipt.constants.js +3 -0
- package/dist/domain/workflow/usage-receipt.constants.js.map +1 -0
- package/dist/domain/workflow/usage-receipt.d.ts +2 -0
- package/dist/domain/workflow/usage-receipt.js +18 -0
- package/dist/domain/workflow/usage-receipt.js.map +1 -0
- package/dist/domain/workflow/validation.js +6 -0
- package/dist/domain/workflow/validation.js.map +1 -1
- package/dist/domain/workflow/workflow-scheduler.js +68 -33
- package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
- package/dist/domain/workflow/workflow-state.d.ts +2 -1
- package/dist/domain/workflow/workflow-state.js +107 -3
- package/dist/domain/workflow/workflow-state.js.map +1 -1
- package/dist/domain/workflow.d.ts +2 -0
- package/dist/domain/workflow.js +1 -0
- package/dist/domain/workflow.js.map +1 -1
- package/dist/domain/workflow.types.d.ts +23 -3
- package/dist/domain/workflow.types.js.map +1 -1
- package/dist/index.d.ts +44 -5
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/artifact-store.constants.d.ts +1 -0
- package/dist/infrastructure/artifact-store.constants.js +2 -0
- package/dist/infrastructure/artifact-store.constants.js.map +1 -0
- package/dist/infrastructure/artifact-store.d.ts +3 -0
- package/dist/infrastructure/artifact-store.js +100 -0
- package/dist/infrastructure/artifact-store.js.map +1 -0
- package/dist/infrastructure/artifact-store.types.d.ts +4 -0
- package/dist/infrastructure/artifact-store.types.js +2 -0
- package/dist/infrastructure/artifact-store.types.js.map +1 -0
- package/dist/infrastructure/file-manifest.d.ts +6 -0
- package/dist/infrastructure/file-manifest.js +92 -0
- package/dist/infrastructure/file-manifest.js.map +1 -0
- package/dist/infrastructure/git/lock-inspection.constants.d.ts +4 -0
- package/dist/infrastructure/git/lock-inspection.constants.js +5 -0
- package/dist/infrastructure/git/lock-inspection.constants.js.map +1 -0
- package/dist/infrastructure/git/lock-inspection.d.ts +3 -0
- package/dist/infrastructure/git/lock-inspection.js +64 -0
- package/dist/infrastructure/git/lock-inspection.js.map +1 -0
- package/dist/infrastructure/git/lock-inspection.types.d.ts +27 -0
- package/dist/infrastructure/git/lock-inspection.types.js +2 -0
- package/dist/infrastructure/git/lock-inspection.types.js.map +1 -0
- package/dist/infrastructure/git/lock.d.ts +1 -0
- package/dist/infrastructure/git/lock.js +70 -29
- package/dist/infrastructure/git/lock.js.map +1 -1
- package/dist/infrastructure/git/process-identity.d.ts +3 -0
- package/dist/infrastructure/git/process-identity.js +73 -0
- package/dist/infrastructure/git/process-identity.js.map +1 -0
- package/dist/infrastructure/git/process-identity.types.d.ts +10 -0
- package/dist/infrastructure/git/process-identity.types.js +2 -0
- package/dist/infrastructure/git/process-identity.types.js.map +1 -0
- package/dist/infrastructure/git/verification-command.d.ts +1 -0
- package/dist/infrastructure/git/verification-command.js +37 -0
- package/dist/infrastructure/git/verification-command.js.map +1 -0
- package/dist/infrastructure/git/workspace-lease.js +1 -0
- package/dist/infrastructure/git/workspace-lease.js.map +1 -1
- package/dist/infrastructure/git/workspace.js +5 -1
- package/dist/infrastructure/git/workspace.js.map +1 -1
- package/dist/infrastructure/git/worktree-inspection.constants.d.ts +5 -0
- package/dist/infrastructure/git/worktree-inspection.constants.js +16 -0
- package/dist/infrastructure/git/worktree-inspection.constants.js.map +1 -0
- package/dist/infrastructure/git/worktree-inspection.d.ts +3 -0
- package/dist/infrastructure/git/worktree-inspection.js +120 -0
- package/dist/infrastructure/git/worktree-inspection.js.map +1 -0
- package/dist/infrastructure/git/worktree-inspection.types.d.ts +19 -0
- package/dist/infrastructure/git/worktree-inspection.types.js +2 -0
- package/dist/infrastructure/git/worktree-inspection.types.js.map +1 -0
- package/dist/infrastructure/inspection-file.constants.d.ts +1 -0
- package/dist/infrastructure/inspection-file.constants.js +5 -0
- package/dist/infrastructure/inspection-file.constants.js.map +1 -0
- package/dist/infrastructure/inspection-file.d.ts +1 -0
- package/dist/infrastructure/inspection-file.js +43 -0
- package/dist/infrastructure/inspection-file.js.map +1 -0
- package/dist/infrastructure/inspection-hash.constants.d.ts +1 -0
- package/dist/infrastructure/inspection-hash.constants.js +2 -0
- package/dist/infrastructure/inspection-hash.constants.js.map +1 -0
- package/dist/infrastructure/inspection-hash.d.ts +2 -0
- package/dist/infrastructure/inspection-hash.js +62 -0
- package/dist/infrastructure/inspection-hash.js.map +1 -0
- package/dist/infrastructure/inspection-hash.types.d.ts +5 -0
- package/dist/infrastructure/inspection-hash.types.js +2 -0
- package/dist/infrastructure/inspection-hash.types.js.map +1 -0
- package/dist/infrastructure/journal-retention.constants.d.ts +4 -0
- package/dist/infrastructure/journal-retention.constants.js +5 -0
- package/dist/infrastructure/journal-retention.constants.js.map +1 -0
- package/dist/infrastructure/journal-retention.d.ts +2 -0
- package/dist/infrastructure/journal-retention.js +51 -0
- package/dist/infrastructure/journal-retention.js.map +1 -0
- package/dist/infrastructure/journal.js +37 -13
- package/dist/infrastructure/journal.js.map +1 -1
- package/dist/infrastructure/opentelemetry.constants.d.ts +10 -0
- package/dist/infrastructure/opentelemetry.constants.js +11 -0
- package/dist/infrastructure/opentelemetry.constants.js.map +1 -0
- package/dist/infrastructure/opentelemetry.d.ts +3 -0
- package/dist/infrastructure/opentelemetry.js +131 -0
- package/dist/infrastructure/opentelemetry.js.map +1 -0
- package/dist/infrastructure/opentelemetry.types.d.ts +21 -0
- package/dist/infrastructure/opentelemetry.types.js +2 -0
- package/dist/infrastructure/opentelemetry.types.js.map +1 -0
- package/dist/infrastructure/resource-activity-inspection.d.ts +2 -0
- package/dist/infrastructure/resource-activity-inspection.js +152 -0
- package/dist/infrastructure/resource-activity-inspection.js.map +1 -0
- package/dist/infrastructure/resource-activity.constants.d.ts +8 -0
- package/dist/infrastructure/resource-activity.constants.js +26 -0
- package/dist/infrastructure/resource-activity.constants.js.map +1 -0
- package/dist/infrastructure/resource-activity.d.ts +2 -0
- package/dist/infrastructure/resource-activity.js +166 -0
- package/dist/infrastructure/resource-activity.js.map +1 -0
- package/dist/infrastructure/resource-activity.types.d.ts +53 -0
- package/dist/infrastructure/resource-activity.types.js +2 -0
- package/dist/infrastructure/resource-activity.types.js.map +1 -0
- package/dist/infrastructure/storage-inventory.constants.d.ts +6 -0
- package/dist/infrastructure/storage-inventory.constants.js +11 -0
- package/dist/infrastructure/storage-inventory.constants.js.map +1 -0
- package/dist/infrastructure/storage-inventory.d.ts +2 -0
- package/dist/infrastructure/storage-inventory.js +123 -0
- package/dist/infrastructure/storage-inventory.js.map +1 -0
- package/dist/infrastructure/storage-inventory.types.d.ts +38 -0
- package/dist/infrastructure/storage-inventory.types.js +2 -0
- package/dist/infrastructure/storage-inventory.types.js.map +1 -0
- package/dist/infrastructure/storage-mutation-lock.constants.d.ts +5 -0
- package/dist/infrastructure/storage-mutation-lock.constants.js +6 -0
- package/dist/infrastructure/storage-mutation-lock.constants.js.map +1 -0
- package/dist/infrastructure/storage-mutation-lock.d.ts +1 -0
- package/dist/infrastructure/storage-mutation-lock.js +21 -0
- package/dist/infrastructure/storage-mutation-lock.js.map +1 -0
- package/dist/infrastructure/storage-reservations.constants.d.ts +4 -0
- package/dist/infrastructure/storage-reservations.constants.js +5 -0
- package/dist/infrastructure/storage-reservations.constants.js.map +1 -0
- package/dist/infrastructure/storage-reservations.d.ts +2 -0
- package/dist/infrastructure/storage-reservations.js +150 -0
- package/dist/infrastructure/storage-reservations.js.map +1 -0
- package/dist/infrastructure/storage-reservations.types.d.ts +21 -0
- package/dist/infrastructure/storage-reservations.types.js +2 -0
- package/dist/infrastructure/storage-reservations.types.js.map +1 -0
- package/dist/infrastructure/task-queue-http.constants.d.ts +2 -0
- package/dist/infrastructure/task-queue-http.constants.js +3 -0
- package/dist/infrastructure/task-queue-http.constants.js.map +1 -0
- package/dist/infrastructure/task-queue-http.d.ts +4 -0
- package/dist/infrastructure/task-queue-http.js +158 -0
- package/dist/infrastructure/task-queue-http.js.map +1 -0
- package/dist/infrastructure/task-queue-http.types.d.ts +16 -0
- package/dist/infrastructure/task-queue-http.types.js +2 -0
- package/dist/infrastructure/task-queue-http.types.js.map +1 -0
- package/dist/infrastructure/task-queue.d.ts +2 -0
- package/dist/infrastructure/task-queue.js +134 -0
- package/dist/infrastructure/task-queue.js.map +1 -0
- package/dist/infrastructure/transfer.js +17 -0
- package/dist/infrastructure/transfer.js.map +1 -1
- package/dist/infrastructure/workflow-checkpoint.constants.d.ts +1 -0
- package/dist/infrastructure/workflow-checkpoint.constants.js +2 -0
- package/dist/infrastructure/workflow-checkpoint.constants.js.map +1 -0
- package/dist/infrastructure/workflow-checkpoint.d.ts +3 -0
- package/dist/infrastructure/workflow-checkpoint.js +77 -0
- package/dist/infrastructure/workflow-checkpoint.js.map +1 -0
- package/dist/infrastructure/workflow-checkpoint.types.d.ts +4 -0
- package/dist/infrastructure/workflow-checkpoint.types.js +2 -0
- package/dist/infrastructure/workflow-checkpoint.types.js.map +1 -0
- package/dist/providers/agents.d.ts +2 -0
- package/dist/providers/agents.js +1 -0
- package/dist/providers/agents.js.map +1 -1
- package/dist/providers/cloud.constants.d.ts +1 -0
- package/dist/providers/cloud.constants.js +1 -0
- package/dist/providers/cloud.constants.js.map +1 -1
- package/dist/providers/container-cache.constants.d.ts +11 -0
- package/dist/providers/container-cache.constants.js +9 -0
- package/dist/providers/container-cache.constants.js.map +1 -0
- package/dist/providers/container-cache.d.ts +4 -0
- package/dist/providers/container-cache.js +48 -0
- package/dist/providers/container-cache.js.map +1 -0
- package/dist/providers/container-cache.types.d.ts +8 -0
- package/dist/providers/container-cache.types.js +2 -0
- package/dist/providers/container-cache.types.js.map +1 -0
- package/dist/providers/container-isolation.d.ts +2 -0
- package/dist/providers/container-isolation.js +29 -0
- package/dist/providers/container-isolation.js.map +1 -0
- package/dist/providers/container-mounts.js +7 -2
- package/dist/providers/container-mounts.js.map +1 -1
- package/dist/providers/container-network.d.ts +2 -0
- package/dist/providers/container-network.js +14 -0
- package/dist/providers/container-network.js.map +1 -0
- package/dist/providers/container-plan.js +6 -2
- package/dist/providers/container-plan.js.map +1 -1
- package/dist/providers/container.constants.d.ts +1 -0
- package/dist/providers/container.constants.js +1 -0
- package/dist/providers/container.constants.js.map +1 -1
- package/dist/providers/container.js +50 -3
- package/dist/providers/container.js.map +1 -1
- package/dist/providers/container.types.d.ts +5 -0
- package/dist/providers/container.types.js.map +1 -1
- package/dist/providers/daytona-command.js +10 -6
- package/dist/providers/daytona-command.js.map +1 -1
- package/dist/providers/daytona-terminal.d.ts +3 -0
- package/dist/providers/daytona-terminal.js +128 -0
- package/dist/providers/daytona-terminal.js.map +1 -0
- package/dist/providers/daytona.js +15 -4
- package/dist/providers/daytona.js.map +1 -1
- package/dist/providers/diagnostic-container.d.ts +4 -0
- package/dist/providers/diagnostic-container.js +15 -0
- package/dist/providers/diagnostic-container.js.map +1 -0
- package/dist/providers/docker.d.ts +2 -0
- package/dist/providers/docker.js.map +1 -1
- package/dist/providers/file-batches.constants.d.ts +10 -0
- package/dist/providers/file-batches.constants.js +57 -0
- package/dist/providers/file-batches.constants.js.map +1 -0
- package/dist/providers/file-batches.d.ts +2 -0
- package/dist/providers/file-batches.js +160 -0
- package/dist/providers/file-batches.js.map +1 -0
- package/dist/providers/file-upload.constants.d.ts +1 -0
- package/dist/providers/file-upload.constants.js +68 -0
- package/dist/providers/file-upload.constants.js.map +1 -0
- package/dist/providers/file-upload.d.ts +2 -0
- package/dist/providers/file-upload.js +146 -0
- package/dist/providers/file-upload.js.map +1 -0
- package/dist/providers/firecracker-command.d.ts +5 -0
- package/dist/providers/firecracker-command.js +114 -0
- package/dist/providers/firecracker-command.js.map +1 -0
- package/dist/providers/firecracker-files.constants.d.ts +1 -0
- package/dist/providers/firecracker-files.constants.js +21 -0
- package/dist/providers/firecracker-files.constants.js.map +1 -0
- package/dist/providers/firecracker-files.d.ts +3 -0
- package/dist/providers/firecracker-files.js +110 -0
- package/dist/providers/firecracker-files.js.map +1 -0
- package/dist/providers/firecracker-machine.d.ts +3 -0
- package/dist/providers/firecracker-machine.js +155 -0
- package/dist/providers/firecracker-machine.js.map +1 -0
- package/dist/providers/firecracker.constants.d.ts +10 -0
- package/dist/providers/firecracker.constants.js +11 -0
- package/dist/providers/firecracker.constants.js.map +1 -0
- package/dist/providers/firecracker.d.ts +4 -0
- package/dist/providers/firecracker.js +103 -0
- package/dist/providers/firecracker.js.map +1 -0
- package/dist/providers/firecracker.types.d.ts +36 -0
- package/dist/providers/firecracker.types.js +2 -0
- package/dist/providers/firecracker.types.js.map +1 -0
- package/dist/providers/local.js +2 -1
- package/dist/providers/local.js.map +1 -1
- package/dist/providers/podman.d.ts +2 -0
- package/dist/providers/podman.js.map +1 -1
- package/dist/providers/terminal-bridge.d.ts +14 -0
- package/dist/providers/terminal-bridge.js +100 -0
- package/dist/providers/terminal-bridge.js.map +1 -0
- package/dist/providers/vercel-directory.d.ts +2 -0
- package/dist/providers/vercel-directory.js +7 -0
- package/dist/providers/vercel-directory.js.map +1 -0
- package/dist/providers/vercel-files.js +3 -2
- package/dist/providers/vercel-files.js.map +1 -1
- package/dist/providers/vercel-network.d.ts +2 -0
- package/dist/providers/vercel-network.js +18 -0
- package/dist/providers/vercel-network.js.map +1 -0
- package/dist/providers/vercel.d.ts +1 -0
- package/dist/providers/vercel.js +8 -2
- package/dist/providers/vercel.js.map +1 -1
- package/dist/providers/vercel.types.d.ts +2 -0
- package/dist/providers/vercel.types.js.map +1 -1
- package/dist/providers/versions.constants.d.ts +1 -0
- package/dist/providers/versions.constants.js +1 -0
- package/dist/providers/versions.constants.js.map +1 -1
- package/package.json +16 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { invariant } from "../domain/errors.js";
|
|
2
|
+
import { agentVersions } from "../providers/versions.constants.js";
|
|
3
|
+
import { diagnoseAgentCli } from "./doctor-agent.js";
|
|
4
|
+
import { diagnosticProbe } from "./diagnostic-probe.js";
|
|
5
|
+
import { doctorDefaults } from "./doctor.constants.js";
|
|
6
|
+
import { diagnoseTransfers } from "./doctor-transfers.js";
|
|
7
|
+
import { sandboxDiagnosticDefaults } from "./doctor-sandbox.constants.js";
|
|
8
|
+
export async function diagnoseSandbox(target, options = {}) {
|
|
9
|
+
if ("diagnose" in target)
|
|
10
|
+
return target.diagnose(options);
|
|
11
|
+
const deadlineMs = options.deadlineMs ?? doctorDefaults.deadlineMs;
|
|
12
|
+
invariant(Number.isInteger(deadlineMs) &&
|
|
13
|
+
deadlineMs > 0 &&
|
|
14
|
+
deadlineMs <= sandboxDiagnosticDefaults.maximumDeadlineMs, "Diagnostic deadlineMs must be an integer from 1 to 60000");
|
|
15
|
+
options.signal?.throwIfAborted();
|
|
16
|
+
const invoke = (command) => {
|
|
17
|
+
options.signal?.throwIfAborted();
|
|
18
|
+
return target.invoke({
|
|
19
|
+
...command,
|
|
20
|
+
deadlineMs,
|
|
21
|
+
retain: command.retain ?? doctorDefaults.retain,
|
|
22
|
+
signal: options.signal
|
|
23
|
+
? AbortSignal.any([options.signal, AbortSignal.timeout(deadlineMs)])
|
|
24
|
+
: AbortSignal.timeout(deadlineMs),
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const checks = [];
|
|
28
|
+
for (const executable of ["node", "git"]) {
|
|
29
|
+
checks.push(await diagnosticProbe({
|
|
30
|
+
id: `sandbox.${executable}`,
|
|
31
|
+
command: { executable, arguments: ["--version"] },
|
|
32
|
+
readVersion: true,
|
|
33
|
+
failureStatus: "fail",
|
|
34
|
+
remedy: `Install ${executable} in this sandbox.`,
|
|
35
|
+
}, invoke));
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const result = await invoke({
|
|
39
|
+
executable: "node",
|
|
40
|
+
arguments: ["-e", sandboxDiagnosticDefaults.command],
|
|
41
|
+
});
|
|
42
|
+
const passed = result.status === 7 &&
|
|
43
|
+
result.stdout === "outpost-stdout" &&
|
|
44
|
+
result.stderr === "outpost-stderr";
|
|
45
|
+
checks.push({
|
|
46
|
+
id: "sandbox.command",
|
|
47
|
+
status: passed ? "pass" : "fail",
|
|
48
|
+
message: passed
|
|
49
|
+
? "Observed separate output streams and nonzero process exit status."
|
|
50
|
+
: "Command output or exit status did not match the diagnostic sentinel.",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
checks.push({
|
|
55
|
+
id: "sandbox.command",
|
|
56
|
+
status: "fail",
|
|
57
|
+
message: "Bounded command probe failed or was interrupted.",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
checks.push(await diagnosticProbe({
|
|
61
|
+
id: "sandbox.home",
|
|
62
|
+
command: {
|
|
63
|
+
executable: "node",
|
|
64
|
+
arguments: ["-e", sandboxDiagnosticDefaults.home, target.home],
|
|
65
|
+
},
|
|
66
|
+
failureStatus: "fail",
|
|
67
|
+
remedy: "Check the lease home directory and its permissions.",
|
|
68
|
+
}, invoke));
|
|
69
|
+
if (options.agent) {
|
|
70
|
+
const version = await diagnosticProbe({
|
|
71
|
+
id: "agent.sandbox",
|
|
72
|
+
command: { executable: options.agent, arguments: ["--version"] },
|
|
73
|
+
readVersion: true,
|
|
74
|
+
referenceVersion: agentVersions[options.agent],
|
|
75
|
+
failureStatus: "fail",
|
|
76
|
+
remedy: "Install the agent explicitly; diagnostics never bootstrap it.",
|
|
77
|
+
}, invoke);
|
|
78
|
+
checks.push(version);
|
|
79
|
+
if (version.status !== "fail")
|
|
80
|
+
checks.push(...(await diagnoseAgentCli(options.agent, invoke)));
|
|
81
|
+
}
|
|
82
|
+
if (options.transfers === true)
|
|
83
|
+
checks.push(...(await diagnoseTransfers(target, { deadlineMs, ...(options.signal ? { signal: options.signal } : {}) }, invoke)));
|
|
84
|
+
checks.push({
|
|
85
|
+
id: "model",
|
|
86
|
+
status: "skipped",
|
|
87
|
+
message: "Authentication, model access and installed agent protocol compatibility are unverified. No model request was made.",
|
|
88
|
+
});
|
|
89
|
+
const observed = (id) => {
|
|
90
|
+
const check = checks.find((check) => check.id === id);
|
|
91
|
+
if (!check)
|
|
92
|
+
return "unverified";
|
|
93
|
+
return check.status === "pass" ? "pass" : "fail";
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
scope: "owned-sandbox",
|
|
97
|
+
ownership: "caller",
|
|
98
|
+
...(options.provider
|
|
99
|
+
? {
|
|
100
|
+
provider: {
|
|
101
|
+
name: options.provider.name,
|
|
102
|
+
placement: options.provider.placement,
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
: {}),
|
|
106
|
+
capabilities: [
|
|
107
|
+
{
|
|
108
|
+
id: "command",
|
|
109
|
+
advertised: true,
|
|
110
|
+
observed: observed("sandbox.command"),
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: "transfers",
|
|
114
|
+
advertised: true,
|
|
115
|
+
observed: observed("sandbox.transfers"),
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "batchTransfers",
|
|
119
|
+
advertised: target.fileTransfers !== undefined,
|
|
120
|
+
observed: "unverified",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "interactiveTerminal",
|
|
124
|
+
advertised: "unknown",
|
|
125
|
+
observed: "unverified",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
checks,
|
|
129
|
+
modelCompatibility: "unverified",
|
|
130
|
+
hasFailures: checks.some((check) => check.status === "fail"),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=doctor-sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-sandbox.js","sourceRoot":"","sources":["../../src/application/doctor-sandbox.ts"],"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,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,KAAK;YAAE,OAAO,YAAqB,CAAC;QACzC,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAE,MAAgB,CAAC,CAAC,CAAE,MAAgB,CAAC;IACzE,CAAC,CAAC;IACF,OAAO;QACL,KAAK,EAAE,eAAe;QACtB,SAAS,EAAE,QAAQ;QACnB,GAAG,CAAC,OAAO,CAAC,QAAQ;YAClB,CAAC,CAAC;gBACE,QAAQ,EAAE;oBACR,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;oBAC3B,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,SAAS;iBACtC;aACF;YACH,CAAC,CAAC,EAAE,CAAC;QACP,YAAY,EAAE;YACZ;gBACE,EAAE,EAAE,SAAS;gBACb,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,CAAC;aACtC;YACD;gBACE,EAAE,EAAE,WAAW;gBACf,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,QAAQ,CAAC,mBAAmB,CAAC;aACxC;YACD;gBACE,EAAE,EAAE,gBAAgB;gBACpB,UAAU,EAAE,MAAM,CAAC,aAAa,KAAK,SAAS;gBAC9C,QAAQ,EAAE,YAAY;aACvB;YACD;gBACE,EAAE,EAAE,qBAAqB;gBACzB,UAAU,EAAE,SAAS;gBACrB,QAAQ,EAAE,YAAY;aACvB;SACF;QACD,MAAM;QACN,kBAAkB,EAAE,YAAY;QAChC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;KAC7D,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../domain/errors.ts\";\nimport type { SandboxLease } from \"../domain/sandbox.types.ts\";\nimport type { Executor } from \"../infrastructure/process.types.ts\";\nimport { agentVersions } from \"../providers/versions.constants.ts\";\nimport { diagnoseAgentCli } from \"./doctor-agent.ts\";\nimport { diagnosticProbe } from \"./diagnostic-probe.ts\";\nimport { doctorDefaults } from \"./doctor.constants.ts\";\nimport type { DiagnosticCheck } from \"./doctor.types.ts\";\nimport { diagnoseTransfers } from \"./doctor-transfers.ts\";\nimport { sandboxDiagnosticDefaults } from \"./doctor-sandbox.constants.ts\";\nimport type {\n SandboxDiagnosticOptions,\n SandboxDiagnosticReport,\n} from \"./doctor-sandbox.types.ts\";\nimport type { Sandbox } from \"./outpost.types.ts\";\n\nexport async function diagnoseSandbox(\n target: Sandbox | SandboxLease,\n options: SandboxDiagnosticOptions = {},\n): Promise<SandboxDiagnosticReport> {\n if (\"diagnose\" in target) return target.diagnose(options);\n const deadlineMs = options.deadlineMs ?? doctorDefaults.deadlineMs;\n invariant(\n Number.isInteger(deadlineMs) &&\n deadlineMs > 0 &&\n deadlineMs <= sandboxDiagnosticDefaults.maximumDeadlineMs,\n \"Diagnostic deadlineMs must be an integer from 1 to 60000\",\n );\n options.signal?.throwIfAborted();\n const invoke: Executor = (command) => {\n options.signal?.throwIfAborted();\n return target.invoke({\n ...command,\n deadlineMs,\n retain: command.retain ?? doctorDefaults.retain,\n signal: options.signal\n ? AbortSignal.any([options.signal, AbortSignal.timeout(deadlineMs)])\n : AbortSignal.timeout(deadlineMs),\n });\n };\n const checks: DiagnosticCheck[] = [];\n for (const executable of [\"node\", \"git\"]) {\n checks.push(\n await diagnosticProbe(\n {\n id: `sandbox.${executable}`,\n command: { executable, arguments: [\"--version\"] },\n readVersion: true,\n failureStatus: \"fail\",\n remedy: `Install ${executable} in this sandbox.`,\n },\n invoke,\n ),\n );\n }\n try {\n const result = await invoke({\n executable: \"node\",\n arguments: [\"-e\", sandboxDiagnosticDefaults.command],\n });\n const passed =\n result.status === 7 &&\n result.stdout === \"outpost-stdout\" &&\n result.stderr === \"outpost-stderr\";\n checks.push({\n id: \"sandbox.command\",\n status: passed ? \"pass\" : \"fail\",\n message: passed\n ? \"Observed separate output streams and nonzero process exit status.\"\n : \"Command output or exit status did not match the diagnostic sentinel.\",\n });\n } catch {\n checks.push({\n id: \"sandbox.command\",\n status: \"fail\",\n message: \"Bounded command probe failed or was interrupted.\",\n });\n }\n checks.push(\n await diagnosticProbe(\n {\n id: \"sandbox.home\",\n command: {\n executable: \"node\",\n arguments: [\"-e\", sandboxDiagnosticDefaults.home, target.home],\n },\n failureStatus: \"fail\",\n remedy: \"Check the lease home directory and its permissions.\",\n },\n invoke,\n ),\n );\n if (options.agent) {\n const version = await diagnosticProbe(\n {\n id: \"agent.sandbox\",\n command: { executable: options.agent, arguments: [\"--version\"] },\n readVersion: true,\n referenceVersion: agentVersions[options.agent],\n failureStatus: \"fail\",\n remedy: \"Install the agent explicitly; diagnostics never bootstrap it.\",\n },\n invoke,\n );\n checks.push(version);\n if (version.status !== \"fail\")\n checks.push(...(await diagnoseAgentCli(options.agent, invoke)));\n }\n if (options.transfers === true)\n checks.push(\n ...(await diagnoseTransfers(\n target,\n { deadlineMs, ...(options.signal ? { signal: options.signal } : {}) },\n invoke,\n )),\n );\n checks.push({\n id: \"model\",\n status: \"skipped\",\n message:\n \"Authentication, model access and installed agent protocol compatibility are unverified. No model request was made.\",\n });\n const observed = (id: string) => {\n const check = checks.find((check) => check.id === id);\n if (!check) return \"unverified\" as const;\n return check.status === \"pass\" ? (\"pass\" as const) : (\"fail\" as const);\n };\n return {\n scope: \"owned-sandbox\",\n ownership: \"caller\",\n ...(options.provider\n ? {\n provider: {\n name: options.provider.name,\n placement: options.provider.placement,\n },\n }\n : {}),\n capabilities: [\n {\n id: \"command\",\n advertised: true,\n observed: observed(\"sandbox.command\"),\n },\n {\n id: \"transfers\",\n advertised: true,\n observed: observed(\"sandbox.transfers\"),\n },\n {\n id: \"batchTransfers\",\n advertised: target.fileTransfers !== undefined,\n observed: \"unverified\",\n },\n {\n id: \"interactiveTerminal\",\n advertised: \"unknown\",\n observed: \"unverified\",\n },\n ],\n checks,\n modelCompatibility: \"unverified\",\n hasFailures: checks.some((check) => check.status === \"fail\"),\n };\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SandboxProvider } from "../domain/sandbox.types.ts";
|
|
2
|
+
import type { DiagnosticCheck, DoctorAgent } from "./doctor.types.ts";
|
|
3
|
+
export interface SandboxDiagnosticOptions {
|
|
4
|
+
readonly agent?: DoctorAgent;
|
|
5
|
+
readonly deadlineMs?: number;
|
|
6
|
+
readonly signal?: AbortSignal;
|
|
7
|
+
readonly transfers?: boolean;
|
|
8
|
+
readonly provider?: Pick<SandboxProvider, "name" | "placement">;
|
|
9
|
+
}
|
|
10
|
+
export interface DiagnosticCapability {
|
|
11
|
+
readonly id: "command" | "transfers" | "batchTransfers" | "interactiveTerminal";
|
|
12
|
+
readonly advertised: boolean | "unknown";
|
|
13
|
+
readonly observed: "pass" | "fail" | "unverified";
|
|
14
|
+
}
|
|
15
|
+
export interface SandboxDiagnosticReport {
|
|
16
|
+
readonly scope: "owned-sandbox";
|
|
17
|
+
readonly ownership: "caller";
|
|
18
|
+
readonly provider?: Pick<SandboxProvider, "name" | "placement">;
|
|
19
|
+
readonly capabilities: readonly DiagnosticCapability[];
|
|
20
|
+
readonly checks: readonly DiagnosticCheck[];
|
|
21
|
+
readonly modelCompatibility: "unverified";
|
|
22
|
+
readonly hasFailures: boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-sandbox.types.js","sourceRoot":"","sources":["../../src/application/doctor-sandbox.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SandboxProvider } from \"../domain/sandbox.types.ts\";\nimport type { DiagnosticCheck, DoctorAgent } from \"./doctor.types.ts\";\n\nexport interface SandboxDiagnosticOptions {\n readonly agent?: DoctorAgent;\n readonly deadlineMs?: number;\n readonly signal?: AbortSignal;\n readonly transfers?: boolean;\n readonly provider?: Pick<SandboxProvider, \"name\" | \"placement\">;\n}\n\nexport interface DiagnosticCapability {\n readonly id:\n \"command\" | \"transfers\" | \"batchTransfers\" | \"interactiveTerminal\";\n readonly advertised: boolean | \"unknown\";\n readonly observed: \"pass\" | \"fail\" | \"unverified\";\n}\n\nexport interface SandboxDiagnosticReport {\n readonly scope: \"owned-sandbox\";\n readonly ownership: \"caller\";\n readonly provider?: Pick<SandboxProvider, \"name\" | \"placement\">;\n readonly capabilities: readonly DiagnosticCapability[];\n readonly checks: readonly DiagnosticCheck[];\n readonly modelCompatibility: \"unverified\";\n readonly hasFailures: boolean;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const transferDiagnosticRecipe: Readonly<{
|
|
2
|
+
base64: "AAECA/7/AG91dHBvc3QK";
|
|
3
|
+
create: "require('node:fs').mkdirSync(process.argv[1])";
|
|
4
|
+
verify: "const fs = require('node:fs'); if (fs.readFileSync(process.argv[1]).toString('base64') !== process.argv[2]) process.exit(1)";
|
|
5
|
+
cleanup: "require('node:fs').rmSync(process.argv[1], { recursive: true, force: true })";
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const transferDiagnosticRecipe = Object.freeze({
|
|
2
|
+
base64: "AAECA/7/AG91dHBvc3QK",
|
|
3
|
+
create: "require('node:fs').mkdirSync(process.argv[1])",
|
|
4
|
+
verify: "const fs = require('node:fs'); if (fs.readFileSync(process.argv[1]).toString('base64') !== process.argv[2]) process.exit(1)",
|
|
5
|
+
cleanup: "require('node:fs').rmSync(process.argv[1], { recursive: true, force: true })",
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=doctor-transfers.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-transfers.constants.js","sourceRoot":"","sources":["../../src/application/doctor-transfers.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,sBAAsB;IAC9B,MAAM,EAAE,+CAA+C;IACvD,MAAM,EACJ,6HAA6H;IAC/H,OAAO,EACL,8EAA8E;CACjF,CAAC,CAAC","sourcesContent":["export const transferDiagnosticRecipe = Object.freeze({\n base64: \"AAECA/7/AG91dHBvc3QK\",\n create: \"require('node:fs').mkdirSync(process.argv[1])\",\n verify:\n \"const fs = require('node:fs'); if (fs.readFileSync(process.argv[1]).toString('base64') !== process.argv[2]) process.exit(1)\",\n cleanup:\n \"require('node:fs').rmSync(process.argv[1], { recursive: true, force: true })\",\n});\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SandboxLease, TransferOptions } from "../domain/sandbox.types.ts";
|
|
2
|
+
import type { Executor } from "../infrastructure/process.types.ts";
|
|
3
|
+
import type { DiagnosticCheck } from "./doctor.types.ts";
|
|
4
|
+
export declare function diagnoseTransfers(lease: SandboxLease, options: TransferOptions, invoke: Executor): Promise<DiagnosticCheck[]>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { doctorDefaults } from "./doctor.constants.js";
|
|
6
|
+
import { transferDiagnosticRecipe as recipe } from "./doctor-transfers.constants.js";
|
|
7
|
+
export async function diagnoseTransfers(lease, options, invoke) {
|
|
8
|
+
const checks = [];
|
|
9
|
+
const directory = await mkdtemp(join(tmpdir(), "outpost-probe-"));
|
|
10
|
+
const remote = `${lease.root.replace(/[\\/]$/, "")}/.outpost-probe-${randomUUID()}`;
|
|
11
|
+
const source = join(directory, "source");
|
|
12
|
+
let cleanupNeeded = false;
|
|
13
|
+
try {
|
|
14
|
+
cleanupNeeded = true;
|
|
15
|
+
const result = await invoke({
|
|
16
|
+
executable: "node",
|
|
17
|
+
arguments: ["-e", recipe.create, remote],
|
|
18
|
+
});
|
|
19
|
+
if (result.status !== 0) {
|
|
20
|
+
cleanupNeeded = false;
|
|
21
|
+
throw new Error("create");
|
|
22
|
+
}
|
|
23
|
+
const payload = Buffer.from(recipe.base64, "base64");
|
|
24
|
+
await writeFile(source, payload, { mode: 0o600 });
|
|
25
|
+
const bounded = () => ({
|
|
26
|
+
...options,
|
|
27
|
+
signal: options.signal
|
|
28
|
+
? AbortSignal.any([
|
|
29
|
+
options.signal,
|
|
30
|
+
AbortSignal.timeout(options.deadlineMs ?? doctorDefaults.deadlineMs),
|
|
31
|
+
])
|
|
32
|
+
: AbortSignal.timeout(options.deadlineMs ?? doctorDefaults.deadlineMs),
|
|
33
|
+
});
|
|
34
|
+
await lease.upload(source, `${remote}/payload`, bounded());
|
|
35
|
+
const verified = await invoke({
|
|
36
|
+
executable: "node",
|
|
37
|
+
arguments: ["-e", recipe.verify, `${remote}/payload`, recipe.base64],
|
|
38
|
+
});
|
|
39
|
+
if (verified.status !== 0)
|
|
40
|
+
throw new Error("verify");
|
|
41
|
+
const destination = join(directory, "download");
|
|
42
|
+
await lease.download(`${remote}/payload`, destination, bounded());
|
|
43
|
+
if (!(await readFile(destination)).equals(payload))
|
|
44
|
+
throw new Error("download");
|
|
45
|
+
checks.push({
|
|
46
|
+
id: "sandbox.transfers",
|
|
47
|
+
status: "pass",
|
|
48
|
+
message: "Binary upload verified by a sandbox process; downloaded bytes match. Symlinks, permissions, directories and batch transfers remain unverified.",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
checks.push({
|
|
53
|
+
id: "sandbox.transfers",
|
|
54
|
+
status: "fail",
|
|
55
|
+
message: "Bounded binary transfer probe failed or was interrupted.",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
if (cleanupNeeded) {
|
|
60
|
+
try {
|
|
61
|
+
const result = await lease.invoke({
|
|
62
|
+
executable: "node",
|
|
63
|
+
arguments: ["-e", recipe.cleanup, remote],
|
|
64
|
+
deadlineMs: options.deadlineMs ?? doctorDefaults.deadlineMs,
|
|
65
|
+
signal: AbortSignal.timeout(options.deadlineMs ?? doctorDefaults.deadlineMs),
|
|
66
|
+
retain: doctorDefaults.retain,
|
|
67
|
+
});
|
|
68
|
+
if (result.status !== 0)
|
|
69
|
+
throw new Error("cleanup");
|
|
70
|
+
checks.push({
|
|
71
|
+
id: "sandbox.transfers.cleanup",
|
|
72
|
+
status: "pass",
|
|
73
|
+
message: "Temporary sandbox probe directory removed.",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
checks.push({
|
|
78
|
+
id: "sandbox.transfers.cleanup",
|
|
79
|
+
status: "fail",
|
|
80
|
+
message: `Temporary probe cleanup could not be confirmed; inspect ${remote}. The caller still owns the sandbox.`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
await rm(directory, { recursive: true, force: true });
|
|
85
|
+
}
|
|
86
|
+
return checks;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=doctor-transfers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-transfers.js","sourceRoot":"","sources":["../../src/application/doctor-transfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,wBAAwB,IAAI,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAErF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAmB,EACnB,OAAwB,EACxB,MAAgB;IAEhB,MAAM,MAAM,GA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IAAI,cAAc,CAAC,UAAU;oBAC3D,MAAM,EAAE,WAAW,CAAC,OAAO,CACzB,OAAO,CAAC,UAAU,IAAI,cAAc,CAAC,UAAU,CAChD;oBACD,MAAM,EAAE,cAAc,CAAC,MAAM;iBAC9B,CAAC,CAAC;gBACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;gBACpD,MAAM,CAAC,IAAI,CAAC;oBACV,EAAE,EAAE,2BAA2B;oBAC/B,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,4CAA4C;iBACtD,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,CAAC,IAAI,CAAC;oBACV,EAAE,EAAE,2BAA2B;oBAC/B,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,2DAA2D,MAAM,sCAAsC;iBACjH,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { mkdtemp, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { SandboxLease, TransferOptions } from \"../domain/sandbox.types.ts\";\nimport type { Executor } from \"../infrastructure/process.types.ts\";\nimport { doctorDefaults } from \"./doctor.constants.ts\";\nimport type { DiagnosticCheck } from \"./doctor.types.ts\";\nimport { transferDiagnosticRecipe as recipe } from \"./doctor-transfers.constants.ts\";\n\nexport async function diagnoseTransfers(\n lease: SandboxLease,\n options: TransferOptions,\n invoke: Executor,\n): Promise<DiagnosticCheck[]> {\n const checks: DiagnosticCheck[] = [];\n const directory = await mkdtemp(join(tmpdir(), \"outpost-probe-\"));\n const remote = `${lease.root.replace(/[\\\\/]$/, \"\")}/.outpost-probe-${randomUUID()}`;\n const source = join(directory, \"source\");\n let cleanupNeeded = false;\n try {\n cleanupNeeded = true;\n const result = await invoke({\n executable: \"node\",\n arguments: [\"-e\", recipe.create, remote],\n });\n if (result.status !== 0) {\n cleanupNeeded = false;\n throw new Error(\"create\");\n }\n const payload = Buffer.from(recipe.base64, \"base64\");\n await writeFile(source, payload, { mode: 0o600 });\n const bounded = () => ({\n ...options,\n signal: options.signal\n ? AbortSignal.any([\n options.signal,\n AbortSignal.timeout(\n options.deadlineMs ?? doctorDefaults.deadlineMs,\n ),\n ])\n : AbortSignal.timeout(options.deadlineMs ?? doctorDefaults.deadlineMs),\n });\n await lease.upload(source, `${remote}/payload`, bounded());\n const verified = await invoke({\n executable: \"node\",\n arguments: [\"-e\", recipe.verify, `${remote}/payload`, recipe.base64],\n });\n if (verified.status !== 0) throw new Error(\"verify\");\n const destination = join(directory, \"download\");\n await lease.download(`${remote}/payload`, destination, bounded());\n if (!(await readFile(destination)).equals(payload))\n throw new Error(\"download\");\n checks.push({\n id: \"sandbox.transfers\",\n status: \"pass\",\n message:\n \"Binary upload verified by a sandbox process; downloaded bytes match. Symlinks, permissions, directories and batch transfers remain unverified.\",\n });\n } catch {\n checks.push({\n id: \"sandbox.transfers\",\n status: \"fail\",\n message: \"Bounded binary transfer probe failed or was interrupted.\",\n });\n } finally {\n if (cleanupNeeded) {\n try {\n const result = await lease.invoke({\n executable: \"node\",\n arguments: [\"-e\", recipe.cleanup, remote],\n deadlineMs: options.deadlineMs ?? doctorDefaults.deadlineMs,\n signal: AbortSignal.timeout(\n options.deadlineMs ?? doctorDefaults.deadlineMs,\n ),\n retain: doctorDefaults.retain,\n });\n if (result.status !== 0) throw new Error(\"cleanup\");\n checks.push({\n id: \"sandbox.transfers.cleanup\",\n status: \"pass\",\n message: \"Temporary sandbox probe directory removed.\",\n });\n } catch {\n checks.push({\n id: \"sandbox.transfers.cleanup\",\n status: \"fail\",\n message: `Temporary probe cleanup could not be confirmed; inspect ${remote}. The caller still owns the sandbox.`,\n });\n }\n }\n await rm(directory, { recursive: true, force: true });\n }\n return checks;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DoctorProvider, DoctorReport } from "./doctor.types.ts";
|
|
2
|
+
export declare const doctorDefaults: Readonly<{
|
|
3
|
+
readonly provider: "docker";
|
|
4
|
+
readonly agent: "codex";
|
|
5
|
+
readonly deadlineMs: 5000;
|
|
6
|
+
readonly retain: 4096;
|
|
7
|
+
readonly minimumNodeMajor: 24;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const providerDiagnostics: Readonly<Record<DoctorProvider, Pick<DoctorReport, "placement" | "interactiveTerminal">>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const doctorDefaults = Object.freeze({
|
|
2
|
+
provider: "docker",
|
|
3
|
+
agent: "codex",
|
|
4
|
+
deadlineMs: 5_000,
|
|
5
|
+
retain: 4_096,
|
|
6
|
+
minimumNodeMajor: 24,
|
|
7
|
+
});
|
|
8
|
+
export const providerDiagnostics = {
|
|
9
|
+
docker: { placement: "mounted", interactiveTerminal: true },
|
|
10
|
+
podman: { placement: "mounted", interactiveTerminal: true },
|
|
11
|
+
local: { placement: "host", interactiveTerminal: true },
|
|
12
|
+
vercel: { placement: "remote", interactiveTerminal: false },
|
|
13
|
+
daytona: { placement: "remote", interactiveTerminal: true },
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=doctor.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.constants.js","sourceRoot":"","sources":["../../src/application/doctor.constants.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,KAAK;IACjB,MAAM,EAAE,KAAK;IACb,gBAAgB,EAAE,EAAE;CACZ,CAAC,CAAC;AACZ,MAAM,CAAC,MAAM,mBAAmB,GAK5B;IACF,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE;IAC3D,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE;IAC3D,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,EAAE;IACvD,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,KAAK,EAAE;IAC3D,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE;CAC5D,CAAC","sourcesContent":["import type { DoctorProvider, DoctorReport } from \"./doctor.types.ts\";\nexport const doctorDefaults = Object.freeze({\n provider: \"docker\",\n agent: \"codex\",\n deadlineMs: 5_000,\n retain: 4_096,\n minimumNodeMajor: 24,\n} as const);\nexport const providerDiagnostics: Readonly<\n Record<\n DoctorProvider,\n Pick<DoctorReport, \"placement\" | \"interactiveTerminal\">\n >\n> = {\n docker: { placement: \"mounted\", interactiveTerminal: true },\n podman: { placement: \"mounted\", interactiveTerminal: true },\n local: { placement: \"host\", interactiveTerminal: true },\n vercel: { placement: \"remote\", interactiveTerminal: false },\n daytona: { placement: \"remote\", interactiveTerminal: true },\n};\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { invariant } from "../domain/errors.js";
|
|
2
|
+
import { executeProcess } from "../infrastructure/process.js";
|
|
3
|
+
import { agentVersions } from "../providers/versions.constants.js";
|
|
4
|
+
import { diagnoseImage } from "./doctor-image.js";
|
|
5
|
+
import { diagnosticProbe } from "./diagnostic-probe.js";
|
|
6
|
+
import { doctorDefaults, providerDiagnostics } from "./doctor.constants.js";
|
|
7
|
+
export async function diagnose(options, execute = executeProcess) {
|
|
8
|
+
const { provider, agent, image } = options;
|
|
9
|
+
if (image !== undefined) {
|
|
10
|
+
invariant(provider === "docker" || provider === "podman", "--image requires docker or podman.");
|
|
11
|
+
invariant(image.length > 0 &&
|
|
12
|
+
!image.startsWith("-") &&
|
|
13
|
+
!/[\x00-\x20\x7f]/.test(image), "Invalid diagnostic image name.");
|
|
14
|
+
}
|
|
15
|
+
const capabilities = providerDiagnostics[provider];
|
|
16
|
+
const checks = [
|
|
17
|
+
{
|
|
18
|
+
id: "host.node",
|
|
19
|
+
status: Number(process.versions.node.split(".")[0]) >=
|
|
20
|
+
doctorDefaults.minimumNodeMajor
|
|
21
|
+
? "pass"
|
|
22
|
+
: "fail",
|
|
23
|
+
version: process.versions.node,
|
|
24
|
+
message: `Outpost requires Node.js ${doctorDefaults.minimumNodeMajor}+.`,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
checks.push(await diagnosticProbe({
|
|
28
|
+
id: "host.git",
|
|
29
|
+
command: { executable: "git", arguments: ["--version"] },
|
|
30
|
+
failureStatus: "fail",
|
|
31
|
+
remedy: "Install Git and make it available on PATH.",
|
|
32
|
+
readVersion: true,
|
|
33
|
+
}, execute));
|
|
34
|
+
if (capabilities.placement === "mounted") {
|
|
35
|
+
const engine = await diagnosticProbe({
|
|
36
|
+
id: "provider.cli",
|
|
37
|
+
command: { executable: provider, arguments: ["--version"] },
|
|
38
|
+
failureStatus: "fail",
|
|
39
|
+
remedy: `Install ${provider} and make it available on PATH.`,
|
|
40
|
+
readVersion: true,
|
|
41
|
+
}, execute);
|
|
42
|
+
checks.push(engine);
|
|
43
|
+
if (engine.status === "pass")
|
|
44
|
+
checks.push(await diagnosticProbe({
|
|
45
|
+
id: "provider.connection",
|
|
46
|
+
command: {
|
|
47
|
+
executable: provider,
|
|
48
|
+
arguments: ["info"],
|
|
49
|
+
},
|
|
50
|
+
failureStatus: "fail",
|
|
51
|
+
remedy: `Check ${provider} is running and accessible to this user; on macOS, start its virtual machine.`,
|
|
52
|
+
}, execute));
|
|
53
|
+
checks.push(await diagnosticProbe({
|
|
54
|
+
id: "host.tar",
|
|
55
|
+
command: { executable: "tar", arguments: ["--version"] },
|
|
56
|
+
failureStatus: "fail",
|
|
57
|
+
remedy: "Install GNU tar or bsdtar for container transfers.",
|
|
58
|
+
}, execute));
|
|
59
|
+
}
|
|
60
|
+
if (capabilities.placement === "remote")
|
|
61
|
+
checks.push({
|
|
62
|
+
id: "provider.cloud",
|
|
63
|
+
status: "skipped",
|
|
64
|
+
message: "Cloud SDK, credentials, account access and allocation are not checked.",
|
|
65
|
+
});
|
|
66
|
+
checks.push(await diagnosticProbe({
|
|
67
|
+
id: "agent.host",
|
|
68
|
+
command: { executable: agent, arguments: ["--version"] },
|
|
69
|
+
failureStatus: "warn",
|
|
70
|
+
remedy: "Host CLI is unavailable or unverified. A sandbox may have its own CLI; dispatch can bootstrap a missing agent.",
|
|
71
|
+
readVersion: true,
|
|
72
|
+
referenceVersion: agentVersions[agent],
|
|
73
|
+
}, execute));
|
|
74
|
+
if (image !== undefined && (provider === "docker" || provider === "podman")) {
|
|
75
|
+
const connected = checks.some((check) => check.id === "provider.connection" && check.status === "pass");
|
|
76
|
+
if (connected)
|
|
77
|
+
checks.push(...(await diagnoseImage({ provider, agent, image }, execute)));
|
|
78
|
+
else
|
|
79
|
+
checks.push({
|
|
80
|
+
id: "image.runtime",
|
|
81
|
+
status: "skipped",
|
|
82
|
+
message: "Image checks require a reachable container engine.",
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (capabilities.placement !== "host" && image === undefined)
|
|
86
|
+
checks.push({
|
|
87
|
+
id: "agent.sandbox",
|
|
88
|
+
status: "skipped",
|
|
89
|
+
message: "Agent version inside the sandbox is not checked; the host version does not describe the sandbox.",
|
|
90
|
+
});
|
|
91
|
+
checks.push({
|
|
92
|
+
id: "execution",
|
|
93
|
+
status: "skipped",
|
|
94
|
+
message: image === undefined
|
|
95
|
+
? "Images, mounts, repository state, authentication and model access are not tested. No sandbox is allocated."
|
|
96
|
+
: "Workflow mounts, repository state, authentication and model access are not tested. Image checks use a separate temporary sandbox.",
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
...options,
|
|
100
|
+
scope: image === undefined ? "host" : "host-and-image",
|
|
101
|
+
...capabilities,
|
|
102
|
+
checks,
|
|
103
|
+
hasFailures: checks.some((check) => check.status === "fail"),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/application/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAO5E,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAsB,EACtB,UAAoB,cAAc;IAElC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC3C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,SAAS,CACP,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,QAAQ,EAC9C,oCAAoC,CACrC,CAAC;QACF,SAAS,CACP,KAAK,CAAC,MAAM,GAAG,CAAC;YACd,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;YACtB,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,EAChC,gCAAgC,CACjC,CAAC;IACJ,CAAC;IACD,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,MAAM,GAAsB;QAChC;YACE,EAAE,EAAE,WAAW;YACf,MAAM,EACJ,M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AE,oDAAoD;aAC9D,CAAC,CAAC;IACP,CAAC;IACD,IAAI,YAAY,CAAC,SAAS,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS;QAC1D,MAAM,CAAC,IAAI,CAAC;YACV,EAAE,EAAE,eAAe;YACnB,MAAM,EAAE,SAAS;YACjB,OAAO,EACL,kGAAkG;SACrG,CAAC,CAAC;IACL,MAAM,CAAC,IAAI,CAAC;QACV,EAAE,EAAE,WAAW;QACf,MAAM,EAAE,SAAS;QACjB,OAAO,EACL,KAAK,KAAK,SAAS;YACjB,CAAC,CAAC,4GAA4G;YAC9G,CAAC,CAAC,mIAAmI;KAC1I,CAAC,CAAC;IACH,OAAO;QACL,GAAG,OAAO;QACV,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB;QACtD,GAAG,YAAY;QACf,MAAM;QACN,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;KAC7D,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../domain/errors.ts\";\nimport { executeProcess } from \"../infrastructure/process.ts\";\nimport type { Executor } from \"../infrastructure/process.types.ts\";\nimport { agentVersions } from \"../providers/versions.constants.ts\";\nimport { diagnoseImage } from \"./doctor-image.ts\";\nimport { diagnosticProbe } from \"./diagnostic-probe.ts\";\nimport { doctorDefaults, providerDiagnostics } from \"./doctor.constants.ts\";\nimport type {\n DiagnosticCheck,\n DoctorOptions,\n DoctorReport,\n} from \"./doctor.types.ts\";\n\nexport async function diagnose(\n options: DoctorOptions,\n execute: Executor = executeProcess,\n): Promise<DoctorReport> {\n const { provider, agent, image } = options;\n if (image !== undefined) {\n invariant(\n provider === \"docker\" || provider === \"podman\",\n \"--image requires docker or podman.\",\n );\n invariant(\n image.length > 0 &&\n !image.startsWith(\"-\") &&\n !/[\\x00-\\x20\\x7f]/.test(image),\n \"Invalid diagnostic image name.\",\n );\n }\n const capabilities = providerDiagnostics[provider];\n const checks: DiagnosticCheck[] = [\n {\n id: \"host.node\",\n status:\n Number(process.versions.node.split(\".\")[0]) >=\n doctorDefaults.minimumNodeMajor\n ? \"pass\"\n : \"fail\",\n version: process.versions.node,\n message: `Outpost requires Node.js ${doctorDefaults.minimumNodeMajor}+.`,\n },\n ];\n checks.push(\n await diagnosticProbe(\n {\n id: \"host.git\",\n command: { executable: \"git\", arguments: [\"--version\"] },\n failureStatus: \"fail\",\n remedy: \"Install Git and make it available on PATH.\",\n readVersion: true,\n },\n execute,\n ),\n );\n if (capabilities.placement === \"mounted\") {\n const engine = await diagnosticProbe(\n {\n id: \"provider.cli\",\n command: { executable: provider, arguments: [\"--version\"] },\n failureStatus: \"fail\",\n remedy: `Install ${provider} and make it available on PATH.`,\n readVersion: true,\n },\n execute,\n );\n checks.push(engine);\n if (engine.status === \"pass\")\n checks.push(\n await diagnosticProbe(\n {\n id: \"provider.connection\",\n command: {\n executable: provider,\n arguments: [\"info\"],\n },\n failureStatus: \"fail\",\n remedy: `Check ${provider} is running and accessible to this user; on macOS, start its virtual machine.`,\n },\n execute,\n ),\n );\n checks.push(\n await diagnosticProbe(\n {\n id: \"host.tar\",\n command: { executable: \"tar\", arguments: [\"--version\"] },\n failureStatus: \"fail\",\n remedy: \"Install GNU tar or bsdtar for container transfers.\",\n },\n execute,\n ),\n );\n }\n if (capabilities.placement === \"remote\")\n checks.push({\n id: \"provider.cloud\",\n status: \"skipped\",\n message:\n \"Cloud SDK, credentials, account access and allocation are not checked.\",\n });\n checks.push(\n await diagnosticProbe(\n {\n id: \"agent.host\",\n command: { executable: agent, arguments: [\"--version\"] },\n failureStatus: \"warn\",\n remedy:\n \"Host CLI is unavailable or unverified. A sandbox may have its own CLI; dispatch can bootstrap a missing agent.\",\n readVersion: true,\n referenceVersion: agentVersions[agent],\n },\n execute,\n ),\n );\n if (image !== undefined && (provider === \"docker\" || provider === \"podman\")) {\n const connected = checks.some(\n (check) => check.id === \"provider.connection\" && check.status === \"pass\",\n );\n if (connected)\n checks.push(\n ...(await diagnoseImage({ provider, agent, image }, execute)),\n );\n else\n checks.push({\n id: \"image.runtime\",\n status: \"skipped\",\n message: \"Image checks require a reachable container engine.\",\n });\n }\n if (capabilities.placement !== \"host\" && image === undefined)\n checks.push({\n id: \"agent.sandbox\",\n status: \"skipped\",\n message:\n \"Agent version inside the sandbox is not checked; the host version does not describe the sandbox.\",\n });\n checks.push({\n id: \"execution\",\n status: \"skipped\",\n message:\n image === undefined\n ? \"Images, mounts, repository state, authentication and model access are not tested. No sandbox is allocated.\"\n : \"Workflow mounts, repository state, authentication and model access are not tested. Image checks use a separate temporary sandbox.\",\n });\n return {\n ...options,\n scope: image === undefined ? \"host\" : \"host-and-image\",\n ...capabilities,\n checks,\n hasFailures: checks.some((check) => check.status === \"fail\"),\n };\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Command } from "../domain/command.types.ts";
|
|
2
|
+
export type DoctorProvider = "docker" | "podman" | "local" | "vercel" | "daytona";
|
|
3
|
+
export type DoctorAgent = "codex" | "claude" | "gemini";
|
|
4
|
+
export type DiagnosticStatus = "pass" | "warn" | "fail" | "skipped";
|
|
5
|
+
export interface DiagnosticCheck {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly status: DiagnosticStatus;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly version?: string;
|
|
10
|
+
readonly referenceVersion?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DoctorOptions {
|
|
13
|
+
readonly image?: string;
|
|
14
|
+
readonly provider: DoctorProvider;
|
|
15
|
+
readonly agent: DoctorAgent;
|
|
16
|
+
}
|
|
17
|
+
export interface DoctorImageOptions {
|
|
18
|
+
readonly provider: "docker" | "podman";
|
|
19
|
+
readonly agent: DoctorAgent;
|
|
20
|
+
readonly image: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DoctorReport {
|
|
23
|
+
readonly provider: DoctorProvider;
|
|
24
|
+
readonly agent: DoctorAgent;
|
|
25
|
+
readonly scope: "host" | "host-and-image";
|
|
26
|
+
readonly image?: string;
|
|
27
|
+
readonly placement: "mounted" | "host" | "remote";
|
|
28
|
+
readonly interactiveTerminal: boolean;
|
|
29
|
+
readonly checks: readonly DiagnosticCheck[];
|
|
30
|
+
readonly hasFailures: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface DiagnosticProbe {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly command: Command;
|
|
35
|
+
readonly failureStatus: "fail" | "warn";
|
|
36
|
+
readonly remedy: string;
|
|
37
|
+
readonly readVersion?: boolean;
|
|
38
|
+
readonly referenceVersion?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.types.js","sourceRoot":"","sources":["../../src/application/doctor.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Command } from \"../domain/command.types.ts\";\nexport type DoctorProvider =\n \"docker\" | \"podman\" | \"local\" | \"vercel\" | \"daytona\";\nexport type DoctorAgent = \"codex\" | \"claude\" | \"gemini\";\nexport type DiagnosticStatus = \"pass\" | \"warn\" | \"fail\" | \"skipped\";\nexport interface DiagnosticCheck {\n readonly id: string;\n readonly status: DiagnosticStatus;\n readonly message: string;\n readonly version?: string;\n readonly referenceVersion?: string;\n}\nexport interface DoctorOptions {\n readonly image?: string;\n readonly provider: DoctorProvider;\n readonly agent: DoctorAgent;\n}\nexport interface DoctorImageOptions {\n readonly provider: \"docker\" | \"podman\";\n readonly agent: DoctorAgent;\n readonly image: string;\n}\nexport interface DoctorReport {\n readonly provider: DoctorProvider;\n readonly agent: DoctorAgent;\n readonly scope: \"host\" | \"host-and-image\";\n readonly image?: string;\n readonly placement: \"mounted\" | \"host\" | \"remote\";\n readonly interactiveTerminal: boolean;\n readonly checks: readonly DiagnosticCheck[];\n readonly hasFailures: boolean;\n}\nexport interface DiagnosticProbe {\n readonly id: string;\n readonly command: Command;\n readonly failureStatus: \"fail\" | \"warn\";\n readonly remedy: string;\n readonly readVersion?: boolean;\n readonly referenceVersion?: string;\n}\n"]}
|
|
@@ -23,6 +23,7 @@ export async function execute(workspace, lease, agent, host, options, afterTurn)
|
|
|
23
23
|
? 1 + options.response.repairs
|
|
24
24
|
: (options.passes ?? executionDefaults.passes);
|
|
25
25
|
for (let index = 0; index < attempts; index++) {
|
|
26
|
+
options.signal?.throwIfAborted();
|
|
26
27
|
notify(options.observe, {
|
|
27
28
|
kind: "phase",
|
|
28
29
|
name: "preparing prompt",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/application/execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,SAA0B,EAC1B,KAAmB,EACnB,KAAmB,EACnB,IAAa,EACb,OAA2B,EAC3B,SAAyC;IAEzC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC1B,MAAM,OAAO,GACX,OAAO,CAAC,KAAK,KAAK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AAS;YAAE,MAAM;IAC5C,CAAC;IACD,MAAM,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC;IAChD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CACzC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CACpC,CAAC;IACF,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC/C,KAAK;QACL,KAAK;QACL,SAAS;QACT,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;YAC5D,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACD,CAAC;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentAdapter, Usage } from \"../domain/agent.types.ts\";\nimport { invariant } from \"../domain/errors.ts\";\nimport { ResponseError } from \"../domain/response.ts\";\nimport type { SandboxLease } from \"../domain/sandbox.types.ts\";\nimport { addUsage } from \"../domain/usage.ts\";\nimport type { WorkspaceRecord } from \"../domain/workspace.types.ts\";\nimport { turn } from \"./agent-turn.ts\";\nimport { renderBrief } from \"./brief-renderer.ts\";\nimport { validateDispatch } from \"./dispatch-validation.ts\";\nimport { executionDefaults } from \"./execution.constants.ts\";\nimport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nimport { notify } from \"./observation.ts\";\n\nexport { renderBrief } from \"./brief-renderer.ts\";\nexport { preflightDispatch, validateDispatch } from \"./dispatch-validation.ts\";\nexport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nexport { notify } from \"./observation.ts\";\n\nexport async function execute<T>(\n workspace: WorkspaceRecord,\n lease: SandboxLease,\n agent: AgentAdapter,\n host: boolean,\n options: DispatchOptions<T>,\n afterTurn?: (turn: Turn) => Promise<Turn>,\n): Promise<Execution<T>> {\n validateDispatch(options);\n const markers =\n options.until === undefined\n ? [executionDefaults.completion]\n : typeof options.until === \"string\"\n ? [options.until]\n : options.until;\n const turns: Turn[] = [];\n let value: T = undefined as T,\n completed = false,\n continuation = options.continuation;\n let repair: string | undefined;\n const attempts = options.response\n ? 1 + options.response.repairs\n : (options.passes ?? executionDefaults.passes);\n for (let index = 0; index < attempts; index++) {\n notify(options.observe, {\n kind: \"phase\",\n name: \"preparing prompt\",\n agent: agent.name,\n branch: workspace.branch,\n directory: workspace.directory,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const prompt =\n repair ??\n (await renderBrief(options.brief, workspace, lease, host, options));\n if (options.response && !repair)\n invariant(\n prompt.includes(`<${options.response.tag}>`),\n `Brief must request an opening <${options.response.tag}> tag`,\n );\n notify(options.observe, {\n kind: \"prompt\",\n text: prompt,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n notify(options.observe, {\n kind: \"phase\",\n name: \"running\",\n agent: agent.name,\n branch: workspace.branch,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const finished = await turn(\n lease,\n agent,\n prompt,\n options,\n continuation,\n markers,\n index + 1,\n );\n const current = afterTurn ? await afterTurn(finished) : finished;\n turns.push(current);\n notify(options.observe, {\n kind: \"summary\",\n durationMs: current.durationMs,\n status: current.status,\n tokens: current.usage,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n completed = markers.some((marker) => current.text.includes(marker));\n if (options.response) {\n try {\n value = await options.response.read(current.text);\n completed = true;\n break;\n } catch (error) {\n if (!(error instanceof ResponseError)) throw error;\n error.recovery = {\n conversation: current.conversation,\n branch: workspace.branch,\n directory: workspace.directory,\n turns,\n };\n if (index + 1 >= attempts || !current.conversation) throw error;\n continuation = { id: current.conversation };\n repair = [\n `Correct the response inside <${options.response.tag}> and </${options.response.tag}>.`,\n `Validation failure: ${error.message}`,\n `Previous content: ${error.raw ?? \"No complete tagged response was returned.\"}`,\n `Cause: ${error.cause instanceof Error ? error.cause.message : (JSON.stringify(error.cause) ?? \"unspecified\")}`,\n `Further repair attempts after this one: ${attempts - index - 2}.`,\n \"Do not edit files, run commands or continue implementation. Only return the corrected response.\",\n ].join(\"\\n\");\n }\n }\n if (!options.response && completed) break;\n }\n const conversation = turns.at(-1)?.conversation;\n const completion = markers.find((marker) =>\n turns.at(-1)?.text.includes(marker),\n );\n return {\n text: turns.map((item) => item.text).join(\"\\n\"),\n turns,\n value,\n completed,\n ...(completion ? { completion } : {}),\n ...(conversation ? { conversation } : {}),\n usage: turns.reduce((sum, item) => addUsage(sum, item.usage), {\n input: 0,\n cached: 0,\n output: 0,\n } as Usage),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/application/execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,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AAC;YACT,MAAM,EAAE,CAAC;SACD,CAAC;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentAdapter, Usage } from \"../domain/agent.types.ts\";\nimport { invariant } from \"../domain/errors.ts\";\nimport { ResponseError } from \"../domain/response.ts\";\nimport type { SandboxLease } from \"../domain/sandbox.types.ts\";\nimport { addUsage } from \"../domain/usage.ts\";\nimport type { WorkspaceRecord } from \"../domain/workspace.types.ts\";\nimport { turn } from \"./agent-turn.ts\";\nimport { renderBrief } from \"./brief-renderer.ts\";\nimport { validateDispatch } from \"./dispatch-validation.ts\";\nimport { executionDefaults } from \"./execution.constants.ts\";\nimport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nimport { notify } from \"./observation.ts\";\n\nexport { renderBrief } from \"./brief-renderer.ts\";\nexport { preflightDispatch, validateDispatch } from \"./dispatch-validation.ts\";\nexport type { DispatchOptions, Execution, Turn } from \"./execution.types.ts\";\nexport { notify } from \"./observation.ts\";\n\nexport async function execute<T>(\n workspace: WorkspaceRecord,\n lease: SandboxLease,\n agent: AgentAdapter,\n host: boolean,\n options: DispatchOptions<T>,\n afterTurn?: (turn: Turn) => Promise<Turn>,\n): Promise<Execution<T>> {\n validateDispatch(options);\n const markers =\n options.until === undefined\n ? [executionDefaults.completion]\n : typeof options.until === \"string\"\n ? [options.until]\n : options.until;\n const turns: Turn[] = [];\n let value: T = undefined as T,\n completed = false,\n continuation = options.continuation;\n let repair: string | undefined;\n const attempts = options.response\n ? 1 + options.response.repairs\n : (options.passes ?? executionDefaults.passes);\n for (let index = 0; index < attempts; index++) {\n options.signal?.throwIfAborted();\n notify(options.observe, {\n kind: \"phase\",\n name: \"preparing prompt\",\n agent: agent.name,\n branch: workspace.branch,\n directory: workspace.directory,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const prompt =\n repair ??\n (await renderBrief(options.brief, workspace, lease, host, options));\n if (options.response && !repair)\n invariant(\n prompt.includes(`<${options.response.tag}>`),\n `Brief must request an opening <${options.response.tag}> tag`,\n );\n notify(options.observe, {\n kind: \"prompt\",\n text: prompt,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n notify(options.observe, {\n kind: \"phase\",\n name: \"running\",\n agent: agent.name,\n branch: workspace.branch,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n const finished = await turn(\n lease,\n agent,\n prompt,\n options,\n continuation,\n markers,\n index + 1,\n );\n const current = afterTurn ? await afterTurn(finished) : finished;\n turns.push(current);\n notify(options.observe, {\n kind: \"summary\",\n durationMs: current.durationMs,\n status: current.status,\n tokens: current.usage,\n pass: index + 1,\n at: new Date().toISOString(),\n });\n completed = markers.some((marker) => current.text.includes(marker));\n if (options.response) {\n try {\n value = await options.response.read(current.text);\n completed = true;\n break;\n } catch (error) {\n if (!(error instanceof ResponseError)) throw error;\n error.recovery = {\n conversation: current.conversation,\n branch: workspace.branch,\n directory: workspace.directory,\n turns,\n };\n if (index + 1 >= attempts || !current.conversation) throw error;\n continuation = { id: current.conversation };\n repair = [\n `Correct the response inside <${options.response.tag}> and </${options.response.tag}>.`,\n `Validation failure: ${error.message}`,\n `Previous content: ${error.raw ?? \"No complete tagged response was returned.\"}`,\n `Cause: ${error.cause instanceof Error ? error.cause.message : (JSON.stringify(error.cause) ?? \"unspecified\")}`,\n `Further repair attempts after this one: ${attempts - index - 2}.`,\n \"Do not edit files, run commands or continue implementation. Only return the corrected response.\",\n ].join(\"\\n\");\n }\n }\n if (!options.response && completed) break;\n }\n const conversation = turns.at(-1)?.conversation;\n const completion = markers.find((marker) =>\n turns.at(-1)?.text.includes(marker),\n );\n return {\n text: turns.map((item) => item.text).join(\"\\n\"),\n turns,\n value,\n completed,\n ...(completion ? { completion } : {}),\n ...(conversation ? { conversation } : {}),\n usage: turns.reduce((sum, item) => addUsage(sum, item.usage), {\n input: 0,\n cached: 0,\n output: 0,\n } as Usage),\n };\n}\n"]}
|
|
@@ -3,10 +3,13 @@ import type { Command, CommandResult } from "../domain/command.types.ts";
|
|
|
3
3
|
import type { Brief } from "../domain/prompts.types.ts";
|
|
4
4
|
import type { SandboxProvider } from "../domain/sandbox.types.ts";
|
|
5
5
|
import type { BranchPolicy, Commit, Disposal, LifecycleHooks, StageLimits, WorkspaceRecord } from "../domain/workspace.types.ts";
|
|
6
|
+
import type { StorageReservationOptions } from "../infrastructure/storage-reservations.types.ts";
|
|
6
7
|
import type { Logging } from "../infrastructure/journal.types.ts";
|
|
8
|
+
import type { SandboxDiagnosticOptions, SandboxDiagnosticReport } from "./doctor-sandbox.types.ts";
|
|
7
9
|
import type { DispatchOptions, Execution } from "./execution.types.ts";
|
|
8
10
|
import type { VariableQuestion } from "./interactive-brief.types.ts";
|
|
9
11
|
export interface WorkspaceOptions {
|
|
12
|
+
readonly storageQuota?: Omit<StorageReservationOptions, "signal">;
|
|
10
13
|
readonly signal?: AbortSignal;
|
|
11
14
|
readonly repository?: string;
|
|
12
15
|
readonly branch?: BranchPolicy;
|
|
@@ -72,6 +75,7 @@ export interface WarmDispatchResult<T> extends Omit<DispatchResult<T>, "resume"
|
|
|
72
75
|
fork<U = undefined>(options: DispatchOptions<U>): Promise<WarmDispatchResult<U>>;
|
|
73
76
|
}
|
|
74
77
|
export interface Sandbox {
|
|
78
|
+
diagnose(options?: SandboxDiagnosticOptions): Promise<SandboxDiagnosticReport>;
|
|
75
79
|
readonly workspace: Workspace;
|
|
76
80
|
readonly root: string;
|
|
77
81
|
dispatch<T = undefined>(options: DispatchOptions<T>): Promise<WarmDispatchResult<T>>;
|