@elie-laloum/outpost 3.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 +18 -0
- package/README.md +3 -1
- package/SECURITY.md +3 -1
- 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 +1 -1
- package/dist/adapters/agents/protocol-fixtures.constants.js +37 -0
- package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -1
- 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/dispatch-validation.js +2 -0
- package/dist/application/dispatch-validation.js.map +1 -1
- package/dist/application/doctor-agent.constants.d.ts +2 -0
- package/dist/application/doctor-agent.constants.js +2 -0
- package/dist/application/doctor-agent.constants.js.map +1 -1
- package/dist/application/doctor-agent.js +1 -1
- package/dist/application/doctor-agent.js.map +1 -1
- package/dist/application/doctor-protocol.js +2 -1
- package/dist/application/doctor-protocol.js.map +1 -1
- package/dist/application/doctor.constants.js +1 -1
- package/dist/application/doctor.constants.js.map +1 -1
- package/dist/application/doctor.types.d.ts +1 -1
- package/dist/application/doctor.types.js.map +1 -1
- package/dist/application/outpost.types.d.ts +2 -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-inspection.js +5 -0
- package/dist/application/recovery-inspection.js.map +1 -1
- package/dist/application/recovery-inspection.types.d.ts +3 -0
- package/dist/application/recovery-inspection.types.js.map +1 -1
- 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.js +5 -0
- package/dist/application/recovery-retention.js.map +1 -1
- package/dist/application/recovery-verification.d.ts +2 -1
- package/dist/application/recovery-verification.js +1 -1
- package/dist/application/recovery-verification.js.map +1 -1
- package/dist/application/remote-apply.js +6 -0
- package/dist/application/remote-apply.js.map +1 -1
- package/dist/application/remote-download.js +2 -2
- 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 +20 -28
- package/dist/application/remote-validation.js.map +1 -1
- package/dist/application/remote-workspace.js +4 -10
- package/dist/application/remote-workspace.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 +23 -11
- 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 +1 -1
- package/dist/application/task-usage.js.map +1 -1
- package/dist/application/tasks.js +1 -1
- 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/doctor-command.js +1 -1
- package/dist/cli/doctor-command.js.map +1 -1
- package/dist/cli/main.constants.d.ts +11 -2
- package/dist/cli/main.constants.js +8 -4
- package/dist/cli/main.constants.js.map +1 -1
- package/dist/cli/recovery-command.js +28 -4
- package/dist/cli/recovery-command.js.map +1 -1
- 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/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/sandbox.types.d.ts +1 -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.d.ts +2 -2
- package/dist/domain/workflow/budget.js +5 -3
- package/dist/domain/workflow/budget.js.map +1 -1
- 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 +14 -2
- 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 +65 -32
- 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 +91 -16
- package/dist/domain/workflow/workflow-state.js.map +1 -1
- package/dist/domain/workflow.types.d.ts +13 -2
- package/dist/domain/workflow.types.js.map +1 -1
- package/dist/index.d.ts +32 -2
- package/dist/index.js +14 -1
- 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 +1 -1
- package/dist/infrastructure/file-manifest.js +3 -2
- package/dist/infrastructure/file-manifest.js.map +1 -1
- package/dist/infrastructure/git/verification-command.d.ts +1 -1
- package/dist/infrastructure/git/verification-command.js +3 -2
- package/dist/infrastructure/git/verification-command.js.map +1 -1
- package/dist/infrastructure/opentelemetry.js +1 -1
- package/dist/infrastructure/opentelemetry.js.map +1 -1
- 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-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 +5 -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/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 +4 -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 +19 -2
- package/dist/providers/container.js.map +1 -1
- package/dist/providers/container.types.d.ts +3 -0
- package/dist/providers/container.types.js.map +1 -1
- package/dist/providers/daytona-command.js +3 -2
- 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 +2 -0
- package/dist/providers/daytona.js.map +1 -1
- package/dist/providers/docker.d.ts +1 -0
- package/dist/providers/docker.js.map +1 -1
- package/dist/providers/file-batches.d.ts +1 -1
- package/dist/providers/file-batches.js +9 -0
- package/dist/providers/file-batches.js.map +1 -1
- 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 +1 -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 +5 -1
- 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 +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firecracker.js","sourceRoot":"","sources":["../../src/providers/firecracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7B,IAAI,SAAS,GAAG,KAAK,C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AC,IAAI,CACf,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAC5B,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAC7B,CAAC;gBACF,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC;YACF,OAAO;gBACL,IAAI;gBACJ,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAClB,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;gBACnE,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,CAC5C,KAAK,CACH,CAAC,MAAM,EAAE,EAAE,CACT,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,EAC3D,OAAO,CAAC,MAAM,CACf;gBACH,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,CAC9C,KAAK,CACH,CAAC,MAAM,EAAE,EAAE,CACT,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,EAC7D,OAAO,CAAC,MAAM,CACf;gBACH,OAAO;aACR,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { setTimeout as delay } from \"node:timers/promises\";\nimport { OutpostError } from \"../domain/errors.ts\";\nimport type { SandboxProvider } from \"../domain/sandbox.types.ts\";\nimport { executeProcess, quote } from \"../infrastructure/process.ts\";\nimport { firecrackerCommand, firecrackerSsh } from \"./firecracker-command.ts\";\nimport { firecrackerDefaults } from \"./firecracker.constants.ts\";\nimport { firecrackerFiles } from \"./firecracker-files.ts\";\nimport {\n firecrackerMachine,\n validateFirecracker,\n} from \"./firecracker-machine.ts\";\nimport type { FirecrackerOptions } from \"./firecracker.types.ts\";\n\nexport type { FirecrackerOptions } from \"./firecracker.types.ts\";\n\nexport function firecracker(options: FirecrackerOptions): SandboxProvider {\n validateFirecracker(options);\n let allocated = false;\n return {\n name: \"firecracker\",\n placement: \"remote\",\n variables: { ...options.variables },\n async acquire(context) {\n if (allocated)\n throw new OutpostError(\n \"provider\",\n \"This Firecracker provider already owns its TAP; create separate configurations for concurrent VMs\",\n );\n allocated = true;\n let machine;\n try {\n machine = await firecrackerMachine(options, context.signal);\n } catch (cause) {\n allocated = false;\n throw cause;\n }\n const root = options.root ?? firecrackerDefaults.root;\n let closed = false;\n const active = new Set<Promise<unknown>>();\n const stop = new AbortController();\n const runtime = {\n options,\n root,\n variables: context.variables,\n executor: executeProcess,\n isClosed: () => closed || machine.isClosed(),\n };\n let releasing: Promise<void> | undefined;\n const release = () =>\n (releasing ??= (async () => {\n closed = true;\n stop.abort(\n new OutpostError(\"aborted\", \"Firecracker sandbox disposed\"),\n );\n await Promise.allSettled([...active]);\n await machine.release();\n allocated = false;\n })().catch((cause) => {\n releasing = undefined;\n throw cause;\n }));\n try {\n const deadline =\n Date.now() +\n (options.bootDeadlineMs ?? firecrackerDefaults.bootDeadlineMs);\n while (true) {\n context.signal?.throwIfAborted();\n if (machine.isClosed())\n throw new OutpostError(\n \"provider\",\n \"Firecracker exited before guest readiness\",\n );\n const result = await executeProcess({\n ...firecrackerSsh(\n options,\n `test \"$HOME\" = ${quote(options.home)} && node -e 'if(Number(process.versions.node.split(\".\")[0])<24)process.exit(1)' && command -v git setsid tar >/dev/null && mkdir -p ${quote(root)}`,\n ),\n deadlineMs: Math.max(\n 1,\n Math.min(firecrackerDefaults.probeMs, deadline - Date.now()),\n ),\n ...(context.signal ? { signal: context.signal } : {}),\n }).catch((cause) => {\n context.signal?.throwIfAborted();\n return { status: 1, stdout: \"\", stderr: String(cause) };\n });\n if (machine.isClosed())\n throw new OutpostError(\n \"provider\",\n \"Firecracker exited during guest readiness\",\n );\n if (result.status === 0) break;\n if (Date.now() >= deadline)\n throw new OutpostError(\n \"timeout\",\n \"Firecracker guest SSH/prerequisites did not become ready\",\n { stderr: result.stderr },\n );\n await delay(100, undefined, { signal: context.signal });\n }\n } catch (cause) {\n try {\n await release();\n } catch (cleanup) {\n throw new AggregateError(\n [cause, cleanup],\n \"Firecracker acquisition and cleanup failed\",\n );\n }\n throw cause;\n }\n const invoke = firecrackerCommand(runtime);\n const files = firecrackerFiles(runtime);\n const track = <T>(\n operation: (signal: AbortSignal) => Promise<T>,\n signal?: AbortSignal,\n ): Promise<T> => {\n if (closed)\n return Promise.reject(\n new OutpostError(\"provider\", \"Firecracker sandbox is closed\"),\n );\n const pending = operation(\n signal ? AbortSignal.any([signal, stop.signal]) : stop.signal,\n );\n active.add(pending);\n void pending.then(\n () => active.delete(pending),\n () => active.delete(pending),\n );\n return pending;\n };\n return {\n root,\n home: options.home,\n invoke: (command) =>\n track((signal) => invoke({ ...command, signal }), command.signal),\n upload: (source, destination, options = {}) =>\n track(\n (signal) =>\n files.upload(source, destination, { ...options, signal }),\n options.signal,\n ),\n download: (source, destination, options = {}) =>\n track(\n (signal) =>\n files.download(source, destination, { ...options, signal }),\n options.signal,\n ),\n release,\n };\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Variables } from "../domain/command.types.ts";
|
|
2
|
+
import type { Executor } from "../infrastructure/process.types.ts";
|
|
3
|
+
export interface FirecrackerOptions {
|
|
4
|
+
readonly binary: string;
|
|
5
|
+
readonly kernel: string;
|
|
6
|
+
readonly rootfs: string;
|
|
7
|
+
readonly tap: string;
|
|
8
|
+
readonly guestMac: string;
|
|
9
|
+
readonly bootArgs: string;
|
|
10
|
+
readonly ssh: {
|
|
11
|
+
readonly host: string;
|
|
12
|
+
readonly user: string;
|
|
13
|
+
readonly identity: string;
|
|
14
|
+
readonly knownHosts: string;
|
|
15
|
+
readonly port?: number;
|
|
16
|
+
readonly binary?: string;
|
|
17
|
+
};
|
|
18
|
+
readonly root?: string;
|
|
19
|
+
readonly home: string;
|
|
20
|
+
readonly cpus?: number;
|
|
21
|
+
readonly memoryMb?: number;
|
|
22
|
+
readonly bootDeadlineMs?: number;
|
|
23
|
+
readonly variables?: Variables;
|
|
24
|
+
}
|
|
25
|
+
export interface FirecrackerRuntime {
|
|
26
|
+
readonly options: FirecrackerOptions;
|
|
27
|
+
readonly root: string;
|
|
28
|
+
readonly variables: Variables;
|
|
29
|
+
readonly isClosed: () => boolean;
|
|
30
|
+
readonly executor: Executor;
|
|
31
|
+
}
|
|
32
|
+
export interface FirecrackerMachine {
|
|
33
|
+
readonly directory: string;
|
|
34
|
+
readonly isClosed: () => boolean;
|
|
35
|
+
release(): Promise<void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firecracker.types.js","sourceRoot":"","sources":["../../src/providers/firecracker.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Variables } from \"../domain/command.types.ts\";\nimport type { Executor } from \"../infrastructure/process.types.ts\";\n\nexport interface FirecrackerOptions {\n readonly binary: string;\n readonly kernel: string;\n readonly rootfs: string;\n readonly tap: string;\n readonly guestMac: string;\n readonly bootArgs: string;\n readonly ssh: {\n readonly host: string;\n readonly user: string;\n readonly identity: string;\n readonly knownHosts: string;\n readonly port?: number;\n readonly binary?: string;\n };\n readonly root?: string;\n readonly home: string;\n readonly cpus?: number;\n readonly memoryMb?: number;\n readonly bootDeadlineMs?: number;\n readonly variables?: Variables;\n}\n\nexport interface FirecrackerRuntime {\n readonly options: FirecrackerOptions;\n readonly root: string;\n readonly variables: Variables;\n readonly isClosed: () => boolean;\n readonly executor: Executor;\n}\n\nexport interface FirecrackerMachine {\n readonly directory: string;\n readonly isClosed: () => boolean;\n release(): Promise<void>;\n}\n"]}
|
package/dist/providers/local.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { cp, mkdir } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { OutpostError } from "../domain/errors.js";
|
|
4
|
+
import { invariant, OutpostError } from "../domain/errors.js";
|
|
5
5
|
import { executeProcess } from "../infrastructure/process.js";
|
|
6
6
|
export function local(options = {}) {
|
|
7
|
+
invariant(!("egress" in options) || options.egress === undefined, "Local execution cannot enforce egress policies");
|
|
7
8
|
return {
|
|
8
9
|
name: "local",
|
|
9
10
|
placement: "host",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/providers/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/providers/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAK9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,MAAM,UAAU,KAAK,CAAC,UAAwB,EAAE;IAC9C,SAAS,CACP,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EACtD,gDAAgD,CACjD,CAAC;IACF,OAAO;QACL,IAAI,EAAE,OA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,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;wBAChD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;oBAChB,MAAM,OAAO,GAAG,cAAc,CAAC;wBAC7B,GAAG,OAAO;wBACV,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS;wBACjD,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE;wBACzD,MAAM;qBACP,CAAC,CAAC;oBACH,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACpB,KAAK,OAAO,CAAC,IAAI,CACf,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAC5B,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAC7B,CAAC;oBACF,OAAO,OAAO,CAAC;gBACjB,CAAC;gBACD,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,IAAI;gBACd,KAAK,CAAC,OAAO;oBACX,IAAI,QAAQ;wBAAE,OAAO;oBACrB,QAAQ,GAAG,IAAI,CAAC;oBAChB,IAAI,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;oBAC5D,MAAM,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { cp, mkdir } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { dirname, resolve } from \"node:path\";\nimport type { Command } from \"../domain/command.types.ts\";\nimport { invariant, OutpostError } from \"../domain/errors.ts\";\nimport type {\n SandboxProvider,\n TransferOptions,\n} from \"../domain/sandbox.types.ts\";\nimport { executeProcess } from \"../infrastructure/process.ts\";\nimport type { LocalOptions } from \"./local.types.ts\";\n\nexport function local(options: LocalOptions = {}): SandboxProvider {\n invariant(\n !(\"egress\" in options) || options.egress === undefined,\n \"Local execution cannot enforce egress policies\",\n );\n return {\n name: \"local\",\n placement: \"host\",\n variables: { ...options.variables },\n async acquire(context) {\n context.signal?.throwIfAborted();\n const stop = new AbortController();\n const active = new Set<Promise<unknown>>();\n let disposed = false;\n const copy = async (\n source: string,\n destination: string,\n options: TransferOptions = {},\n ) => {\n options.signal?.throwIfAborted();\n if (disposed)\n throw new OutpostError(\"provider\", \"Local sandbox is closed\");\n if (resolve(source) === resolve(destination)) return;\n await mkdir(dirname(destination), { recursive: true });\n await cp(source, destination, {\n recursive: true,\n force: true,\n filter: () => {\n options.signal?.throwIfAborted();\n return true;\n },\n });\n };\n return {\n root: context.directory,\n home: homedir(),\n invoke(command: Command) {\n if (disposed)\n return Promise.reject(\n new OutpostError(\"provider\", \"Local sandbox is closed\"),\n );\n const signal = command.signal\n ? AbortSignal.any([command.signal, stop.signal])\n : stop.signal;\n const pending = executeProcess({\n ...command,\n directory: command.directory ?? context.directory,\n variables: { ...context.variables, ...command.variables },\n signal,\n });\n active.add(pending);\n void pending.then(\n () => active.delete(pending),\n () => active.delete(pending),\n );\n return pending;\n },\n upload: copy,\n download: copy,\n async release() {\n if (disposed) return;\n disposed = true;\n stop.abort(new OutpostError(\"aborted\", \"Sandbox disposed\"));\n await Promise.allSettled(active);\n },\n };\n },\n };\n}\n"]}
|
|
@@ -2,3 +2,4 @@ import type { ContainerOptions } from "./container.types.ts";
|
|
|
2
2
|
export type { ContainerOptions } from "./container.ts";
|
|
3
3
|
export declare const podman: (options?: ContainerOptions) => import("../index.ts").SandboxProvider;
|
|
4
4
|
export type { DependencyCache } from "./container-cache.types.ts";
|
|
5
|
+
export type { EgressPolicy } from "../domain/egress.types.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"podman.js","sourceRoot":"","sources":["../../src/providers/podman.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKnD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,UAA4B,EAAE,EAAE,EAAE,CACvD,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC","sourcesContent":["import { containerProvider } from \"./container.ts\";\nimport type { ContainerOptions } from \"./container.types.ts\";\n\nexport type { ContainerOptions } from \"./container.ts\";\n\nexport const podman = (options: ContainerOptions = {}) =>\n containerProvider(\"podman\", options);\n\nexport type { DependencyCache } from \"./container-cache.types.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"podman.js","sourceRoot":"","sources":["../../src/providers/podman.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKnD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,UAA4B,EAAE,EAAE,EAAE,CACvD,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC","sourcesContent":["import { containerProvider } from \"./container.ts\";\nimport type { ContainerOptions } from \"./container.types.ts\";\n\nexport type { ContainerOptions } from \"./container.ts\";\n\nexport const podman = (options: ContainerOptions = {}) =>\n containerProvider(\"podman\", options);\n\nexport type { DependencyCache } from \"./container-cache.types.ts\";\n\nexport type { EgressPolicy } from \"../domain/egress.types.ts\";\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PtyHandle } from "@daytona/sdk";
|
|
2
|
+
import type { Command } from "../domain/command.types.ts";
|
|
3
|
+
export declare function terminalBridge(command: Command, retain: number): {
|
|
4
|
+
failure: Promise<never>;
|
|
5
|
+
size: () => {
|
|
6
|
+
cols: number;
|
|
7
|
+
rows: number;
|
|
8
|
+
};
|
|
9
|
+
output(data: Uint8Array): void;
|
|
10
|
+
connect(pty: PtyHandle): void;
|
|
11
|
+
flush(): Promise<void>;
|
|
12
|
+
text: () => string;
|
|
13
|
+
close(): void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { StringDecoder } from "node:string_decoder";
|
|
2
|
+
import { ReadStream } from "node:tty";
|
|
3
|
+
export function terminalBridge(command, retain) {
|
|
4
|
+
const input = command.terminal?.input ?? process.stdin;
|
|
5
|
+
const output = command.terminal?.output ?? process.stdout;
|
|
6
|
+
const decoder = new StringDecoder("utf8");
|
|
7
|
+
const wasPaused = input.isPaused();
|
|
8
|
+
const raw = input instanceof ReadStream ? input.isRaw : false;
|
|
9
|
+
let captured = "";
|
|
10
|
+
let active = true;
|
|
11
|
+
let pending = Promise.resolve();
|
|
12
|
+
let sending = Promise.resolve();
|
|
13
|
+
let handle;
|
|
14
|
+
let reject = () => { };
|
|
15
|
+
const failure = new Promise((_resolve, fail) => {
|
|
16
|
+
reject = fail;
|
|
17
|
+
});
|
|
18
|
+
void failure.catch(() => undefined);
|
|
19
|
+
const size = () => ({
|
|
20
|
+
cols: "columns" in output && typeof output.columns === "number"
|
|
21
|
+
? output.columns
|
|
22
|
+
: 80,
|
|
23
|
+
rows: "rows" in output && typeof output.rows === "number" ? output.rows : 24,
|
|
24
|
+
});
|
|
25
|
+
const capture = (text) => {
|
|
26
|
+
captured = retain > 0 ? (captured + text).slice(-retain) : "";
|
|
27
|
+
try {
|
|
28
|
+
command.observe?.("stdout", text);
|
|
29
|
+
}
|
|
30
|
+
catch { }
|
|
31
|
+
};
|
|
32
|
+
const send = (data) => {
|
|
33
|
+
input.pause();
|
|
34
|
+
sending = sending.then(async () => {
|
|
35
|
+
if (active)
|
|
36
|
+
await handle?.sendInput(data);
|
|
37
|
+
});
|
|
38
|
+
void sending.then(() => {
|
|
39
|
+
if (active)
|
|
40
|
+
input.resume();
|
|
41
|
+
}, reject);
|
|
42
|
+
};
|
|
43
|
+
const end = () => send(new Uint8Array([4]));
|
|
44
|
+
const resize = () => {
|
|
45
|
+
const { cols, rows } = size();
|
|
46
|
+
void handle?.resize(cols, rows).catch(reject);
|
|
47
|
+
};
|
|
48
|
+
const error = (cause) => reject(cause);
|
|
49
|
+
output.on("error", error);
|
|
50
|
+
return {
|
|
51
|
+
failure,
|
|
52
|
+
size,
|
|
53
|
+
output(data) {
|
|
54
|
+
if (!active)
|
|
55
|
+
return;
|
|
56
|
+
const bytes = Buffer.from(data);
|
|
57
|
+
capture(decoder.write(bytes));
|
|
58
|
+
pending = pending.then(() => new Promise((resolve, rejectWrite) => {
|
|
59
|
+
if (!active) {
|
|
60
|
+
resolve();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
output.write(bytes, (cause) => cause ? rejectWrite(cause) : resolve());
|
|
64
|
+
}));
|
|
65
|
+
void pending.catch(reject);
|
|
66
|
+
},
|
|
67
|
+
connect(pty) {
|
|
68
|
+
handle = pty;
|
|
69
|
+
if (input instanceof ReadStream)
|
|
70
|
+
input.setRawMode(true);
|
|
71
|
+
input.on("data", send);
|
|
72
|
+
input.on("end", end);
|
|
73
|
+
input.on("error", error);
|
|
74
|
+
output.on("resize", resize);
|
|
75
|
+
if (input.readableEnded)
|
|
76
|
+
end();
|
|
77
|
+
input.resume();
|
|
78
|
+
},
|
|
79
|
+
async flush() {
|
|
80
|
+
await Promise.race([pending, failure]);
|
|
81
|
+
capture(decoder.end());
|
|
82
|
+
},
|
|
83
|
+
text: () => captured,
|
|
84
|
+
close() {
|
|
85
|
+
active = false;
|
|
86
|
+
input.removeListener("data", send);
|
|
87
|
+
input.removeListener("end", end);
|
|
88
|
+
input.removeListener("error", error);
|
|
89
|
+
output.removeListener("resize", resize);
|
|
90
|
+
output.removeListener("error", error);
|
|
91
|
+
if (wasPaused || input.listenerCount("data") === 0)
|
|
92
|
+
input.pause();
|
|
93
|
+
if (!wasPaused && input.listenerCount("data") > 0)
|
|
94
|
+
input.resume();
|
|
95
|
+
if (input instanceof ReadStream)
|
|
96
|
+
input.setRawMode(raw);
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=terminal-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-b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5B,IAAI,KAAK,CAAC,aAAa;gBAAE,GAAG,EAAE,CAAC;YAC/B,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,CAAC;QACD,KAAK,CAAC,KAAK;YACT,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YACvC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ;QACpB,KAAK;YACH,MAAM,GAAG,KAAK,CAAC;YACf,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACnC,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YACjC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACrC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACtC,IAAI,SAAS,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,KAAK,CAAC,KAAK,EAAE,CAAC;YAClE,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC;gBAAE,KAAK,CAAC,MAAM,EAAE,CAAC;YAClE,IAAI,KAAK,YAAY,UAAU;gBAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACzD,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { StringDecoder } from \"node:string_decoder\";\nimport { ReadStream } from \"node:tty\";\nimport type { PtyHandle } from \"@daytona/sdk\";\nimport type { Command } from \"../domain/command.types.ts\";\n\nexport function terminalBridge(command: Command, retain: number) {\n const input = command.terminal?.input ?? process.stdin;\n const output = command.terminal?.output ?? process.stdout;\n const decoder = new StringDecoder(\"utf8\");\n const wasPaused = input.isPaused();\n const raw = input instanceof ReadStream ? input.isRaw : false;\n let captured = \"\";\n let active = true;\n let pending = Promise.resolve();\n let sending = Promise.resolve();\n let handle: PtyHandle | undefined;\n let reject: (cause: unknown) => void = () => {};\n const failure = new Promise<never>((_resolve, fail) => {\n reject = fail;\n });\n void failure.catch(() => undefined);\n const size = () => ({\n cols:\n \"columns\" in output && typeof output.columns === \"number\"\n ? output.columns\n : 80,\n rows:\n \"rows\" in output && typeof output.rows === \"number\" ? output.rows : 24,\n });\n const capture = (text: string) => {\n captured = retain > 0 ? (captured + text).slice(-retain) : \"\";\n try {\n command.observe?.(\"stdout\", text);\n } catch {}\n };\n const send = (data: string | Uint8Array) => {\n input.pause();\n sending = sending.then(async () => {\n if (active) await handle?.sendInput(data);\n });\n void sending.then(() => {\n if (active) input.resume();\n }, reject);\n };\n const end = () => send(new Uint8Array([4]));\n const resize = () => {\n const { cols, rows } = size();\n void handle?.resize(cols, rows).catch(reject);\n };\n const error = (cause: Error) => reject(cause);\n output.on(\"error\", error);\n return {\n failure,\n size,\n output(data: Uint8Array) {\n if (!active) return;\n const bytes = Buffer.from(data);\n capture(decoder.write(bytes));\n pending = pending.then(\n () =>\n new Promise<void>((resolve, rejectWrite) => {\n if (!active) {\n resolve();\n return;\n }\n output.write(bytes, (cause) =>\n cause ? rejectWrite(cause) : resolve(),\n );\n }),\n );\n void pending.catch(reject);\n },\n connect(pty: PtyHandle) {\n handle = pty;\n if (input instanceof ReadStream) input.setRawMode(true);\n input.on(\"data\", send);\n input.on(\"end\", end);\n input.on(\"error\", error);\n output.on(\"resize\", resize);\n if (input.readableEnded) end();\n input.resume();\n },\n async flush() {\n await Promise.race([pending, failure]);\n capture(decoder.end());\n },\n text: () => captured,\n close() {\n active = false;\n input.removeListener(\"data\", send);\n input.removeListener(\"end\", end);\n input.removeListener(\"error\", error);\n output.removeListener(\"resize\", resize);\n output.removeListener(\"error\", error);\n if (wasPaused || input.listenerCount(\"data\") === 0) input.pause();\n if (!wasPaused && input.listenerCount(\"data\") > 0) input.resume();\n if (input instanceof ReadStream) input.setRawMode(raw);\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OutpostError } from "../domain/errors.js";
|
|
2
|
+
export async function vercelDirectory(sandbox, path) {
|
|
3
|
+
const result = await sandbox.runCommand("mkdir", ["-p", "--", path]);
|
|
4
|
+
if (result.exitCode !== 0)
|
|
5
|
+
throw new OutpostError("provider", `Could not create remote directory ${path}: ${await result.stderr()}`);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=vercel-directory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-directory.js","sourceRoot":"","sources":["../../src/providers/vercel-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAiC,EACjC,IAAY;IAEZ,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACrE,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC;QACvB,MAAM,IAAI,YAAY,CACpB,UAAU,EACV,qCAAqC,IAAI,KAAK,MAAM,MAAM,CAAC,MAAM,EAAE,EAAE,CACtE,CAAC;AACN,CAAC","sourcesContent":["import { OutpostError } from \"../domain/errors.ts\";\nimport type { VercelRuntime } from \"./vercel.types.ts\";\n\nexport async function vercelDirectory(\n sandbox: VercelRuntime[\"sandbox\"],\n path: string,\n): Promise<void> {\n const result = await sandbox.runCommand(\"mkdir\", [\"-p\", \"--\", path]);\n if (result.exitCode !== 0)\n throw new OutpostError(\n \"provider\",\n `Could not create remote directory ${path}: ${await result.stderr()}`,\n );\n}\n"]}
|
|
@@ -3,12 +3,13 @@ import { OutpostError } from "../domain/errors.js";
|
|
|
3
3
|
import { transfer } from "../infrastructure/transfer.js";
|
|
4
4
|
import { manifestScript } from "./cloud-files.constants.js";
|
|
5
5
|
import { downloadTree, uploadTree } from "./cloud-files.js";
|
|
6
|
+
import { vercelDirectory } from "./vercel-directory.js";
|
|
6
7
|
export function vercelFiles(sandbox) {
|
|
7
8
|
return {
|
|
8
9
|
async upload(source, destination, options = {}) {
|
|
9
10
|
return transfer(options, async (signal) => {
|
|
10
11
|
await uploadTree(source, destination, (path, content) => sandbox.writeFiles([{ path, content }]), async (target, path) => {
|
|
11
|
-
await sandbox
|
|
12
|
+
await vercelDirectory(sandbox, posix.dirname(path));
|
|
12
13
|
const result = await sandbox.runCommand("ln", [
|
|
13
14
|
"-s",
|
|
14
15
|
"--",
|
|
@@ -19,7 +20,7 @@ export function vercelFiles(sandbox) {
|
|
|
19
20
|
throw new OutpostError("provider", "Symlink upload failed");
|
|
20
21
|
}, async (path, directory, mode) => {
|
|
21
22
|
if (directory)
|
|
22
|
-
await sandbox
|
|
23
|
+
await vercelDirectory(sandbox, path);
|
|
23
24
|
const result = await sandbox.runCommand("chmod", [
|
|
24
25
|
mode.toString(8),
|
|
25
26
|
path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-files.js","sourceRoot":"","sources":["../../src/providers/vercel-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"vercel-files.js","sourceRoot":"","sources":["../../src/providers/vercel-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM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;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { posix } from \"node:path\";\nimport { OutpostError } from \"../domain/errors.ts\";\nimport type { SandboxLease } from \"../domain/sandbox.types.ts\";\nimport { transfer } from \"../infrastructure/transfer.ts\";\nimport { manifestScript } from \"./cloud-files.constants.ts\";\nimport { downloadTree, uploadTree } from \"./cloud-files.ts\";\nimport { vercelDirectory } from \"./vercel-directory.ts\";\nimport type { VercelRuntime } from \"./vercel.types.ts\";\n\nexport function vercelFiles(\n sandbox: VercelRuntime[\"sandbox\"],\n): Pick<SandboxLease, \"upload\" | \"download\"> {\n return {\n async upload(source, destination, options = {}) {\n return transfer(options, async (signal) => {\n await uploadTree(\n source,\n destination,\n (path, content) => sandbox.writeFiles([{ path, content }]),\n async (target, path) => {\n await vercelDirectory(sandbox, posix.dirname(path));\n const result = await sandbox.runCommand(\"ln\", [\n \"-s\",\n \"--\",\n target,\n path,\n ]);\n if (result.exitCode !== 0)\n throw new OutpostError(\"provider\", \"Symlink upload failed\");\n },\n async (path, directory, mode) => {\n if (directory) await vercelDirectory(sandbox, path);\n const result = await sandbox.runCommand(\"chmod\", [\n mode.toString(8),\n path,\n ]);\n if (result.exitCode !== 0)\n throw new OutpostError(\n \"provider\",\n \"Transfer permissions could not be set\",\n );\n },\n signal,\n );\n });\n },\n async download(source, destination, options = {}) {\n return transfer(options, async (signal) => {\n const listing = await sandbox.runCommand(\"node\", [\n \"-e\",\n manifestScript,\n source,\n ]);\n if (listing.exitCode !== 0)\n throw new OutpostError(\n \"provider\",\n \"Remote transfer source is unavailable\",\n );\n await downloadTree(\n source,\n destination,\n await listing.stdout(),\n async (path) => {\n const stream = await sandbox.readFile({ path });\n if (!stream)\n throw new OutpostError(\n \"provider\",\n `Remote file is missing: ${path}`,\n );\n const chunks: Buffer[] = [];\n for await (const chunk of stream)\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n return Buffer.concat(chunks);\n },\n signal,\n );\n });\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { validateEgress } from "../domain/egress.js";
|
|
2
|
+
import { invariant } from "../domain/errors.js";
|
|
3
|
+
export function vercelNetworkPolicy(options) {
|
|
4
|
+
const policy = validateEgress(options.egress);
|
|
5
|
+
if (!policy)
|
|
6
|
+
return options.create?.networkPolicy;
|
|
7
|
+
invariant(options.create?.networkPolicy === undefined, "Use egress or create.networkPolicy, not both");
|
|
8
|
+
if (policy.mode === "deny-all")
|
|
9
|
+
return "deny-all";
|
|
10
|
+
return {
|
|
11
|
+
allow: [...(policy.domains ?? [])],
|
|
12
|
+
subnets: {
|
|
13
|
+
allow: [...(policy.allowCidrs ?? [])],
|
|
14
|
+
deny: [...(policy.denyCidrs ?? [])],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=vercel-network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-network.js","sourceRoot":"","sources":["../../src/providers/vercel-network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,UAAU,mBAAmB,CACjC,OAAsB;IAEtB,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC;IAClD,SAAS,CACP,OAAO,CAAC,MAAM,EAAE,aAAa,KAAK,SAAS,EAC3C,8CAA8C,CAC/C,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IAClD,OAAO;QACL,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAClC,OAAO,EAAE;YACP,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;YACrC,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;SACpC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { validateEgress } from \"../domain/egress.ts\";\nimport { invariant } from \"../domain/errors.ts\";\nimport type { VercelOptions } from \"./vercel.types.ts\";\n\nexport function vercelNetworkPolicy(\n options: VercelOptions,\n): NonNullable<VercelOptions[\"create\"]>[\"networkPolicy\"] {\n const policy = validateEgress(options.egress);\n if (!policy) return options.create?.networkPolicy;\n invariant(\n options.create?.networkPolicy === undefined,\n \"Use egress or create.networkPolicy, not both\",\n );\n if (policy.mode === \"deny-all\") return \"deny-all\";\n return {\n allow: [...(policy.domains ?? [])],\n subnets: {\n allow: [...(policy.allowCidrs ?? [])],\n deny: [...(policy.denyCidrs ?? [])],\n },\n };\n}\n"]}
|
|
@@ -3,3 +3,4 @@ import type { SandboxProvider } from "../domain/sandbox.types.ts";
|
|
|
3
3
|
import type { VercelOptions } from "./vercel.types.ts";
|
|
4
4
|
export type { VercelOptions } from "./vercel.types.ts";
|
|
5
5
|
export declare function vercel(options?: VercelOptions, connect?: (config: VercelOptions["create"]) => Promise<Sandbox>): SandboxProvider;
|
|
6
|
+
export type { EgressPolicy } from "../domain/egress.types.ts";
|
package/dist/providers/vercel.js
CHANGED
|
@@ -3,8 +3,11 @@ import { fileBatches } from "./file-batches.js";
|
|
|
3
3
|
import { registerCleanup } from "../infrastructure/shutdown.js";
|
|
4
4
|
import { cloudRoots } from "./cloud.constants.js";
|
|
5
5
|
import { vercelCommand } from "./vercel-command.js";
|
|
6
|
+
import { vercelNetworkPolicy } from "./vercel-network.js";
|
|
7
|
+
import { vercelDirectory } from "./vercel-directory.js";
|
|
6
8
|
import { vercelFiles } from "./vercel-files.js";
|
|
7
9
|
export function vercel(options = {}, connect = async (config) => (await import("@vercel/sandbox")).Sandbox.create(config)) {
|
|
10
|
+
const networkPolicy = vercelNetworkPolicy(options);
|
|
8
11
|
return {
|
|
9
12
|
name: "vercel",
|
|
10
13
|
placement: "remote",
|
|
@@ -13,6 +16,7 @@ export function vercel(options = {}, connect = async (config) => (await import("
|
|
|
13
16
|
context.signal?.throwIfAborted();
|
|
14
17
|
const sandbox = await connect({
|
|
15
18
|
...options.create,
|
|
19
|
+
...(networkPolicy === undefined ? {} : { networkPolicy }),
|
|
16
20
|
env: { ...options.create?.env, ...context.variables },
|
|
17
21
|
});
|
|
18
22
|
const root = options.root ?? cloudRoots.vercel;
|
|
@@ -32,7 +36,7 @@ export function vercel(options = {}, connect = async (config) => (await import("
|
|
|
32
36
|
unregister = registerCleanup(release);
|
|
33
37
|
let home;
|
|
34
38
|
try {
|
|
35
|
-
await sandbox
|
|
39
|
+
await vercelDirectory(sandbox, root);
|
|
36
40
|
home = (await (await sandbox.runCommand("printenv", ["HOME"])).stdout()).trim();
|
|
37
41
|
if (!home.startsWith("/"))
|
|
38
42
|
throw new OutpostError("provider", "Cloud sandbox returned an invalid home directory");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.js","sourceRoot":"","sources":["../../src/providers/vercel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,MAAM,UAAU,MAAM,CACpB,UAAyB,EAAE,EAC3B,UAAiE,KAAK,EACpE,MAAM,EACN,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,M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KAAK,OAAO;iBACnB,IAAI,EAAE;iBACN,IAAI,CAAC,GAAG,EAAE;gBACT,MAAM,GAAG,IAAI,CAAC;gBACd,UAAU,EAAE,CAAC;YACf,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,SAAS,GAAG,SAAS,CAAC;gBACtB,MAAM,KAAK,CAAC;YACd,CAAC,CAAC,CAAC,CAAC;YACR,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,IAAY,CAAC;YACjB,IAAI,CAAC;gBACH,MAAM,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBACrC,IAAI,GAAG,CACL,MAAM,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAChE,CAAC,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;oBACvB,MAAM,IAAI,YAAY,CACpB,UAAU,EACV,kDAAkD,CACnD,CAAC;YACN,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,EAAE,CAAC;gBAChB,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,KAAK,GAAG;gBACZ,IAAI;gBACJ,IAAI;gBACJ,MAAM,EAAE,aAAa,CAAC;oBACpB,OAAO;oBACP,IAAI;oBACJ,OAAO;oBACP,OAAO;oBACP,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM;iBACvB,CAAC;gBACF,GAAG,WAAW,CAAC,OAAO,CAAC;gBACvB,OAAO;aACR,CAAC;YACF,OAAO,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Sandbox } from \"@vercel/sandbox\";\nimport { OutpostError } from \"../domain/errors.ts\";\nimport type { SandboxProvider } from \"../domain/sandbox.types.ts\";\nimport { fileBatches } from \"./file-batches.ts\";\nimport { registerCleanup } from \"../infrastructure/shutdown.ts\";\nimport { cloudRoots } from \"./cloud.constants.ts\";\nimport { vercelCommand } from \"./vercel-command.ts\";\nimport { vercelNetworkPolicy } from \"./vercel-network.ts\";\nimport { vercelDirectory } from \"./vercel-directory.ts\";\nimport { vercelFiles } from \"./vercel-files.ts\";\nimport type { VercelOptions } from \"./vercel.types.ts\";\n\nexport type { VercelOptions } from \"./vercel.types.ts\";\n\nexport function vercel(\n options: VercelOptions = {},\n connect: (config: VercelOptions[\"create\"]) => Promise<Sandbox> = async (\n config,\n ) => (await import(\"@vercel/sandbox\")).Sandbox.create(config),\n): SandboxProvider {\n const networkPolicy = vercelNetworkPolicy(options);\n return {\n name: \"vercel\",\n placement: \"remote\",\n variables: { ...options.variables },\n async acquire(context) {\n context.signal?.throwIfAborted();\n const sandbox = await connect({\n ...options.create,\n ...(networkPolicy === undefined ? {} : { networkPolicy }),\n env: { ...options.create?.env, ...context.variables },\n });\n const root = options.root ?? cloudRoots.vercel;\n let closed = false;\n let releasing: Promise<void> | undefined;\n let unregister = () => {};\n const release = () =>\n (releasing ??= sandbox\n .stop()\n .then(() => {\n closed = true;\n unregister();\n })\n .catch((error) => {\n releasing = undefined;\n throw error;\n }));\n unregister = registerCleanup(release);\n let home: string;\n try {\n await vercelDirectory(sandbox, root);\n home = (\n await (await sandbox.runCommand(\"printenv\", [\"HOME\"])).stdout()\n ).trim();\n if (!home.startsWith(\"/\"))\n throw new OutpostError(\n \"provider\",\n \"Cloud sandbox returned an invalid home directory\",\n );\n } catch (cause) {\n await release();\n throw cause;\n }\n const lease = {\n root,\n home,\n invoke: vercelCommand({\n sandbox,\n root,\n options,\n context,\n isClosed: () => closed,\n }),\n ...vercelFiles(sandbox),\n release,\n };\n return { ...lease, fileTransfers: fileBatches(lease) };\n },\n };\n}\n\nexport type { EgressPolicy } from \"../domain/egress.types.ts\";\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { EgressPolicy } from "../domain/egress.types.ts";
|
|
1
2
|
import type { Sandbox, Sandbox as VercelSandbox } from "@vercel/sandbox";
|
|
2
3
|
import type { Variables } from "../domain/command.types.ts";
|
|
3
4
|
import type { SandboxContext } from "../domain/sandbox.types.ts";
|
|
4
5
|
export interface VercelOptions {
|
|
6
|
+
readonly egress?: EgressPolicy;
|
|
5
7
|
readonly create?: NonNullable<Parameters<typeof Sandbox.create>[0]>;
|
|
6
8
|
readonly variables?: Variables;
|
|
7
9
|
readonly root?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.types.js","sourceRoot":"","sources":["../../src/providers/vercel.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Sandbox, Sandbox as VercelSandbox } from \"@vercel/sandbox\";\nimport type { Variables } from \"../domain/command.types.ts\";\nimport type { SandboxContext } from \"../domain/sandbox.types.ts\";\n\nexport interface VercelOptions {\n readonly create?: NonNullable<Parameters<typeof Sandbox.create>[0]>;\n readonly variables?: Variables;\n readonly root?: string;\n readonly retain?: number;\n}\n\nexport interface VercelRuntime {\n readonly sandbox: VercelSandbox;\n readonly root: string;\n readonly options: VercelOptions;\n readonly context: SandboxContext;\n readonly isClosed: () => boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vercel.types.js","sourceRoot":"","sources":["../../src/providers/vercel.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { EgressPolicy } from \"../domain/egress.types.ts\";\nimport type { Sandbox, Sandbox as VercelSandbox } from \"@vercel/sandbox\";\nimport type { Variables } from \"../domain/command.types.ts\";\nimport type { SandboxContext } from \"../domain/sandbox.types.ts\";\n\nexport interface VercelOptions {\n readonly egress?: EgressPolicy;\n readonly create?: NonNullable<Parameters<typeof Sandbox.create>[0]>;\n readonly variables?: Variables;\n readonly root?: string;\n readonly retain?: number;\n}\n\nexport interface VercelRuntime {\n readonly sandbox: VercelSandbox;\n readonly root: string;\n readonly options: VercelOptions;\n readonly context: SandboxContext;\n readonly isClosed: () => boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.constants.js","sourceRoot":"","sources":["../../src/providers/versions.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;CAClB,CAAC,CAAC","sourcesContent":["export const agentVersions = Object.freeze({\n codex: \"0.156.1\",\n claude: \"2.1.280\",\n});\n"]}
|
|
1
|
+
{"version":3,"file":"versions.constants.js","sourceRoot":"","sources":["../../src/providers/versions.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;CAClB,CAAC,CAAC","sourcesContent":["export const agentVersions = Object.freeze({\n gemini: \"0.61.0\",\n codex: \"0.156.1\",\n claude: \"2.1.280\",\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elie-laloum/outpost",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Programmable sandboxes, coding agents and typed workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
"./opentelemetry": {
|
|
40
40
|
"types": "./dist/infrastructure/opentelemetry.d.ts",
|
|
41
41
|
"import": "./dist/infrastructure/opentelemetry.js"
|
|
42
|
+
},
|
|
43
|
+
"./providers/firecracker": {
|
|
44
|
+
"types": "./dist/providers/firecracker.d.ts",
|
|
45
|
+
"import": "./dist/providers/firecracker.js"
|
|
42
46
|
}
|
|
43
47
|
},
|
|
44
48
|
"files": [
|