@elie-laloum/outpost 2.0.0 → 3.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 +24 -0
- 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/protocol-fixtures.constants.d.ts +2 -0
- package/dist/adapters/agents/protocol-fixtures.constants.js +68 -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/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/doctor-agent.constants.d.ts +9 -0
- package/dist/application/doctor-agent.constants.js +8 -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 +29 -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 +2 -0
- package/dist/application/outpost.types.js.map +1 -1
- 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 +27 -0
- package/dist/application/recovery-inspection.js.map +1 -0
- package/dist/application/recovery-inspection.types.d.ts +15 -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-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 +202 -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 +2 -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 +24 -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 +36 -4
- package/dist/application/remote-download.js.map +1 -1
- package/dist/application/remote-validation.js +19 -0
- 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 +6 -0
- 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.js +11 -0
- package/dist/application/sandbox.js.map +1 -1
- 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/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 +28 -1
- package/dist/cli/main.constants.js +15 -0
- package/dist/cli/main.constants.js.map +1 -1
- package/dist/cli/recovery-command.d.ts +2 -0
- package/dist/cli/recovery-command.js +69 -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-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/domain/ports.d.ts +1 -1
- package/dist/domain/ports.js.map +1 -1
- package/dist/domain/sandbox.types.d.ts +12 -0
- package/dist/domain/sandbox.types.js.map +1 -1
- 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 +67 -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/task-runner.js +8 -1
- package/dist/domain/workflow/task-runner.js.map +1 -1
- package/dist/domain/workflow/workflow-scheduler.js +4 -2
- package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
- package/dist/domain/workflow/workflow-state.js +29 -0
- 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 +10 -1
- package/dist/domain/workflow.types.js.map +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/file-manifest.d.ts +6 -0
- package/dist/infrastructure/file-manifest.js +91 -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 +36 -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/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/transfer.js +12 -0
- package/dist/infrastructure/transfer.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-plan.js +3 -1
- package/dist/providers/container-plan.js.map +1 -1
- package/dist/providers/container.js +31 -1
- package/dist/providers/container.js.map +1 -1
- package/dist/providers/container.types.d.ts +2 -0
- package/dist/providers/container.types.js.map +1 -1
- package/dist/providers/daytona-command.js +7 -4
- package/dist/providers/daytona-command.js.map +1 -1
- package/dist/providers/daytona.js +13 -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 +1 -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 +151 -0
- package/dist/providers/file-batches.js.map +1 -0
- package/dist/providers/podman.d.ts +1 -0
- package/dist/providers/podman.js.map +1 -1
- package/dist/providers/vercel.js +3 -1
- package/dist/providers/vercel.js.map +1 -1
- package/package.json +12 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daytona-command.js","sourceRoot":"","sources":["../../src/providers/daytona-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,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AC;AACJ,CAAC","sourcesContent":["import { setTimeout } from \"node:timers/promises\";\nimport { randomUUID } from \"node:crypto\";\nimport { OutpostError } from \"../domain/errors.ts\";\nimport type { SandboxLease } from \"../domain/sandbox.types.ts\";\nimport { interruptible } from \"../infrastructure/abort.ts\";\nimport { quote } from \"../infrastructure/process.ts\";\nimport { cloudDefaults } from \"./cloud.constants.ts\";\nimport type { DaytonaRuntime } from \"./daytona.types.ts\";\n\nexport function daytonaCommand(\n runtime: DaytonaRuntime,\n): SandboxLease[\"invoke\"] {\n const { sandbox, root, options, context, isClosed } = runtime;\n return async (command) => {\n if (isClosed())\n throw new OutpostError(\"provider\", \"Cloud sandbox is closed\");\n if (command.interactive)\n throw new OutpostError(\n \"provider\",\n \"Interactive terminals require a mounted or local provider\",\n );\n const signal = command.signal\n ? AbortSignal.any([\n command.signal,\n AbortSignal.timeout(command.deadlineMs ?? cloudDefaults.deadlineMs),\n ])\n : AbortSignal.timeout(command.deadlineMs ?? cloudDefaults.deadlineMs);\n signal.throwIfAborted();\n const id = `outpost-${randomUUID()}`;\n const input = `/tmp/${id}.stdin`;\n const pid = `/tmp/${id}.pid`;\n if (command.stdin !== undefined)\n await sandbox.fs.uploadFile(Buffer.from(command.stdin), input);\n const variables = { ...context.variables, ...command.variables };\n const program = [\n ...(command.elevated ? [\"sudo\", \"-n\", \"--\"] : []),\n command.executable,\n ...(command.arguments ?? []),\n ]\n .map(quote)\n .join(\" \");\n const script = `cd ${quote(command.directory ?? root)} && exec env ${Object.entries(\n variables,\n )\n .map(([key, value]) => quote(`${key}=${value}`))\n .join(\n \" \",\n )} setsid sh -c ${quote(`echo $$ > ${quote(pid)}; test ! -f ${quote(pid + \".cancel\")} || exit 130; exec ${program}${command.stdin === undefined ? \"\" : ` < ${quote(input)}`}`)}`;\n const output = { stdout: \"\", stderr: \"\" };\n let cancellation: Promise<unknown> | undefined;\n const cancel = () => {\n cancellation ??= sandbox.process.executeCommand(\n `touch ${quote(pid + \".cancel\")}; if [ -f ${quote(pid)} ]; then kill -KILL -$(cat ${quote(pid)}) 2>/dev/null || true; fi`,\n );\n void cancellation.catch(() => undefined);\n };\n await sandbox.process.createSession(id);\n try {\n signal.addEventListener(\"abort\", cancel, { once: true });\n if (signal.aborted) cancel();\n signal.throwIfAborted();\n const response = await interruptible(\n sandbox.process.executeSessionCommand(id, {\n command: script,\n async: true,\n }),\n signal,\n );\n if (!response.cmdId)\n throw new OutpostError(\n \"provider\",\n \"Cloud provider returned no command identifier\",\n );\n const consume = (channel: \"stdout\" | \"stderr\") => (chunk: string) => {\n output[channel] = (output[channel] + chunk).slice(\n -(command.retain ?? options.retain ?? cloudDefaults.retainBytes),\n );\n command.observe?.(channel, chunk);\n };\n await interruptible(\n sandbox.process.getSessionCommandLogs(\n id,\n response.cmdId,\n consume(\"stdout\"),\n consume(\"stderr\"),\n ),\n signal,\n );\n if (cancellation) await cancellation;\n signal.throwIfAborted();\n while (true) {\n const result = await interruptible(\n sandbox.process.getSessionCommand(id, response.cmdId),\n signal,\n );\n if (result.exitCode !== undefined)\n return { status: result.exitCode, ...output };\n await setTimeout(cloudDefaults.pollMs, undefined, { signal });\n }\n } catch (cause) {\n cancel();\n try {\n await interruptible(\n cancellation!,\n AbortSignal.timeout(cloudDefaults.cancellationMs),\n );\n } catch (cleanup) {\n throw new AggregateError(\n [cause, cleanup],\n \"Cloud cancellation could not be confirmed\",\n );\n }\n throw cause;\n } finally {\n signal.removeEventListener(\"abort\", cancel);\n await sandbox.process.deleteSession(id);\n await sandbox.process\n .executeCommand(`rm -f ${quote(input)} ${quote(pid)}`)\n .catch(() => undefined);\n }\n };\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
+
import { fileBatches } from "./file-batches.js";
|
|
2
3
|
import { registerCleanup } from "../infrastructure/shutdown.js";
|
|
3
4
|
import { cloudRoots } from "./cloud.constants.js";
|
|
4
5
|
import { daytonaCommand } from "./daytona-command.js";
|
|
@@ -12,8 +13,6 @@ export function daytona(options = {}, connect = async (config) => new (await imp
|
|
|
12
13
|
context.signal?.throwIfAborted();
|
|
13
14
|
const client = await connect(options.connection);
|
|
14
15
|
const sandbox = await client.create(options.create ?? {});
|
|
15
|
-
const home = (await sandbox.getUserHomeDir()) ?? cloudRoots.daytonaHome;
|
|
16
|
-
const root = options.root ?? posix.join(home, "outpost");
|
|
17
16
|
let closed = false, releasing;
|
|
18
17
|
let unregister = () => { };
|
|
19
18
|
const release = () => (releasing ??= client
|
|
@@ -27,14 +26,23 @@ export function daytona(options = {}, connect = async (config) => new (await imp
|
|
|
27
26
|
throw error;
|
|
28
27
|
}));
|
|
29
28
|
unregister = registerCleanup(release);
|
|
29
|
+
let home;
|
|
30
|
+
let root;
|
|
30
31
|
try {
|
|
32
|
+
home = (await sandbox.getUserHomeDir()) ?? cloudRoots.daytonaHome;
|
|
33
|
+
root = options.root ?? posix.join(home, "outpost");
|
|
31
34
|
await sandbox.fs.createFolder(root, "755");
|
|
32
35
|
}
|
|
33
36
|
catch (cause) {
|
|
34
|
-
|
|
37
|
+
try {
|
|
38
|
+
await release();
|
|
39
|
+
}
|
|
40
|
+
catch (cleanup) {
|
|
41
|
+
throw new AggregateError([cause, cleanup], "Cloud setup and cleanup failed");
|
|
42
|
+
}
|
|
35
43
|
throw cause;
|
|
36
44
|
}
|
|
37
|
-
|
|
45
|
+
const lease = {
|
|
38
46
|
root,
|
|
39
47
|
home,
|
|
40
48
|
invoke: daytonaCommand({
|
|
@@ -47,6 +55,7 @@ export function daytona(options = {}, connect = async (config) => new (await imp
|
|
|
47
55
|
...daytonaFiles(sandbox),
|
|
48
56
|
release,
|
|
49
57
|
};
|
|
58
|
+
return { ...lease, fileTransfers: fileBatches(lease) };
|
|
50
59
|
},
|
|
51
60
|
};
|
|
52
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daytona.js","sourceRoot":"","sources":["../../src/providers/daytona.ts"],"names":[],"mappings":"AACA,O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C,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC7C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC;oBACH,MAAM,OAAO,EAAE,CAAC;gBAClB,CAAC;gBAAC,OAAO,OAAO,EAAE,CAAC;oBACjB,MAAM,IAAI,cAAc,CACtB,CAAC,KAAK,EAAE,OAAO,CAAC,EAChB,gCAAgC,CACjC,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,KAAK,GAAG;gBACZ,IAAI;gBACJ,IAAI;gBACJ,MAAM,EAAE,cAAc,CAAC;oBACrB,OAAO;oBACP,IAAI;oBACJ,OAAO;oBACP,OAAO;oBACP,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM;iBACvB,CAAC;gBACF,GAAG,YAAY,CAAC,OAAO,CAAC;gBACxB,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 { Daytona, DaytonaConfig } from \"@daytona/sdk\";\nimport { posix } from \"node:path\";\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 { daytonaCommand } from \"./daytona-command.ts\";\nimport { daytonaFiles } from \"./daytona-files.ts\";\nimport type { DaytonaOptions } from \"./daytona.types.ts\";\n\nexport type { DaytonaOptions } from \"./daytona.types.ts\";\n\nexport function daytona(\n options: DaytonaOptions = {},\n connect: (\n config?: DaytonaConfig,\n ) => Promise<Pick<Daytona, \"create\" | \"delete\">> = async (config) =>\n new (await import(\"@daytona/sdk\")).Daytona(config),\n): SandboxProvider {\n return {\n name: \"daytona\",\n placement: \"remote\",\n variables: { ...options.variables },\n async acquire(context) {\n context.signal?.throwIfAborted();\n const client = await connect(options.connection);\n const sandbox = await client.create(options.create ?? {});\n let closed = false,\n releasing: Promise<void> | undefined;\n let unregister = () => {};\n const release = () =>\n (releasing ??= client\n .delete(sandbox)\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 let root: string;\n try {\n home = (await sandbox.getUserHomeDir()) ?? cloudRoots.daytonaHome;\n root = options.root ?? posix.join(home, \"outpost\");\n await sandbox.fs.createFolder(root, \"755\");\n } catch (cause) {\n try {\n await release();\n } catch (cleanup) {\n throw new AggregateError(\n [cause, cleanup],\n \"Cloud setup and cleanup failed\",\n );\n }\n throw cause;\n }\n const lease = {\n root,\n home,\n invoke: daytonaCommand({\n sandbox,\n root,\n options,\n context,\n isClosed: () => closed,\n }),\n ...daytonaFiles(sandbox),\n release,\n };\n return { ...lease, fileTransfers: fileBatches(lease) };\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SandboxProvider } from "../domain/sandbox.types.ts";
|
|
2
|
+
import type { Executor } from "../infrastructure/process.types.ts";
|
|
3
|
+
import type { ContainerEngine } from "./container.types.ts";
|
|
4
|
+
export declare function diagnosticContainer(engine: ContainerEngine, image: string, deadlineMs: number, execute?: Executor): SandboxProvider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { executeProcess } from "../infrastructure/process.js";
|
|
2
|
+
import { containerProvider } from "./container.js";
|
|
3
|
+
export function diagnosticContainer(engine, image, deadlineMs, execute = executeProcess) {
|
|
4
|
+
return containerProvider(engine, { image, networks: "none" }, (command) => {
|
|
5
|
+
const args = command.arguments ?? [];
|
|
6
|
+
return execute({
|
|
7
|
+
...command,
|
|
8
|
+
deadlineMs: Math.min(command.deadlineMs ?? deadlineMs, deadlineMs),
|
|
9
|
+
arguments: args[0] === "create"
|
|
10
|
+
? ["create", "--pull=never", ...args.slice(1)]
|
|
11
|
+
: args,
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=diagnostic-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostic-container.js","sourceRoot":"","sources":["../../src/providers/diagnostic-container.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD,MAAM,UAAU,mBAAmB,CACjC,MAAuB,EACvB,KAAa,EACb,UAAkB,EAClB,UAAoB,cAAc;IAElC,OAAO,iBAAiB,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;QACxE,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC;YACb,GAAG,OAAO;YACV,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,UAAU,EAAE,UAAU,CAAC;YAClE,SAAS,EACP,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;gBAClB,CAAC,CAAC,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC9C,CAAC,CAAC,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { SandboxProvider } from \"../domain/sandbox.types.ts\";\nimport { executeProcess } from \"../infrastructure/process.ts\";\nimport type { Executor } from \"../infrastructure/process.types.ts\";\nimport { containerProvider } from \"./container.ts\";\nimport type { ContainerEngine } from \"./container.types.ts\";\n\nexport function diagnosticContainer(\n engine: ContainerEngine,\n image: string,\n deadlineMs: number,\n execute: Executor = executeProcess,\n): SandboxProvider {\n return containerProvider(engine, { image, networks: \"none\" }, (command) => {\n const args = command.arguments ?? [];\n return execute({\n ...command,\n deadlineMs: Math.min(command.deadlineMs ?? deadlineMs, deadlineMs),\n arguments:\n args[0] === \"create\"\n ? [\"create\", \"--pull=never\", ...args.slice(1)]\n : args,\n });\n });\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ContainerOptions } from "./container.types.ts";
|
|
2
2
|
export type { ContainerOptions } from "./container.ts";
|
|
3
3
|
export declare const docker: (options?: ContainerOptions) => import("../index.ts").SandboxProvider;
|
|
4
|
+
export type { DependencyCache } from "./container-cache.types.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../src/providers/docker.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 docker = (options: ContainerOptions = {}) =>\n containerProvider(\"docker\", options);\n"]}
|
|
1
|
+
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../src/providers/docker.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 docker = (options: ContainerOptions = {}) =>\n containerProvider(\"docker\", options);\n\nexport type { DependencyCache } from \"./container-cache.types.ts\";\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const fileBatchLimits: {
|
|
2
|
+
readonly bytes: number;
|
|
3
|
+
readonly entries: 128;
|
|
4
|
+
readonly argumentBytes: number;
|
|
5
|
+
readonly cleanupMs: 10000;
|
|
6
|
+
readonly manifestBytes: number;
|
|
7
|
+
readonly decodedBytes: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const fileBatchScript: string;
|
|
10
|
+
export declare const fileBatchCleanupScript = "require(\"node:fs\").rmSync(process.argv[1], { force: true })";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const fileBatchLimits = {
|
|
2
|
+
bytes: 8 * 1024 * 1024,
|
|
3
|
+
entries: 128,
|
|
4
|
+
argumentBytes: 48 * 1024,
|
|
5
|
+
cleanupMs: 10_000,
|
|
6
|
+
manifestBytes: 2 * 1024 * 1024,
|
|
7
|
+
decodedBytes: 16 * 1024 * 1024,
|
|
8
|
+
};
|
|
9
|
+
export const fileBatchScript = String.raw `
|
|
10
|
+
const fs = require('node:fs'), p = require('node:path'), c = require('node:crypto'), z = require('node:zlib');
|
|
11
|
+
const [operation, root, input, output] = process.argv.slice(1), entries = JSON.parse(input);
|
|
12
|
+
function safe(path) {
|
|
13
|
+
if (!path || p.isAbsolute(path) || path.includes('\\') || path.includes('\0') || path.split('/').some(x => x === '..' || x.toLowerCase() === '.git')) throw Error('Unsafe transfer path');
|
|
14
|
+
const target = p.resolve(root, path);
|
|
15
|
+
let parent = p.dirname(target);
|
|
16
|
+
while (true) {
|
|
17
|
+
if (fs.lstatSync(parent).isSymbolicLink()) throw Error('Transfer path traverses symlink');
|
|
18
|
+
if (parent === p.resolve(root)) break;
|
|
19
|
+
parent = p.dirname(parent);
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
}
|
|
23
|
+
async function inspect(path, expected) {
|
|
24
|
+
const dataRequired = expected !== undefined;
|
|
25
|
+
const target = safe(path), stat = fs.lstatSync(target), hash = c.createHash('sha256');
|
|
26
|
+
if (!stat.isFile() && !stat.isSymbolicLink()) throw Error('Unsupported transfer file');
|
|
27
|
+
if (expected && stat.isFile() && stat.size !== expected.size) throw Error('Remote file changed during transfer');
|
|
28
|
+
let data, size = stat.size;
|
|
29
|
+
if (stat.isSymbolicLink()) { data = Buffer.from(fs.readlinkSync(target)); size = data.length; hash.update(data); }
|
|
30
|
+
else {
|
|
31
|
+
const chunks = []; let bytes = 0;
|
|
32
|
+
for await (const chunk of fs.createReadStream(target)) {
|
|
33
|
+
hash.update(chunk);
|
|
34
|
+
if (dataRequired) {
|
|
35
|
+
bytes += chunk.length;
|
|
36
|
+
if (bytes > expected.size) throw Error('Remote file changed during transfer');
|
|
37
|
+
chunks.push(chunk);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (dataRequired) data = Buffer.concat(chunks);
|
|
41
|
+
}
|
|
42
|
+
const entry = { path, kind: stat.isSymbolicLink() ? 'link' : 'file', mode: stat.mode & 511, size, sha256: hash.digest('hex') };
|
|
43
|
+
return dataRequired ? { ...entry, data: data.toString('base64') } : entry;
|
|
44
|
+
}
|
|
45
|
+
(async () => {
|
|
46
|
+
const result = [];
|
|
47
|
+
for (const entry of entries) {
|
|
48
|
+
const item = await inspect(operation === 'manifest' ? entry : entry.path, operation === 'batch' ? entry : undefined);
|
|
49
|
+
if (operation === 'batch' && ['path', 'kind', 'mode', 'size', 'sha256'].some(key => item[key] !== entry[key])) throw Error('Remote file changed during transfer');
|
|
50
|
+
result.push(item);
|
|
51
|
+
}
|
|
52
|
+
if (operation === 'manifest') { process.stdout.write(JSON.stringify(result)); return; }
|
|
53
|
+
fs.writeFileSync(output, z.gzipSync(Buffer.from(JSON.stringify(result))), { mode: 384, flag: 'wx' });
|
|
54
|
+
})().catch(error => { console.error(error.message); process.exitCode = 1; });
|
|
55
|
+
`;
|
|
56
|
+
export const fileBatchCleanupScript = `require("node:fs").rmSync(process.argv[1], { force: true })`;
|
|
57
|
+
//# sourceMappingURL=file-batches.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-batches.constants.js","sourceRoot":"","sources":["../../src/providers/file-batches.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IACtB,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,EAAE,GAAG,IAAI;IACxB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IAC9B,YAAY,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;CACtB,CAAC;AAEX,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CxC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,6DAA6D,CAAC","sourcesContent":["export const fileBatchLimits = {\n bytes: 8 * 1024 * 1024,\n entries: 128,\n argumentBytes: 48 * 1024,\n cleanupMs: 10_000,\n manifestBytes: 2 * 1024 * 1024,\n decodedBytes: 16 * 1024 * 1024,\n} as const;\n\nexport const fileBatchScript = String.raw`\nconst fs = require('node:fs'), p = require('node:path'), c = require('node:crypto'), z = require('node:zlib');\nconst [operation, root, input, output] = process.argv.slice(1), entries = JSON.parse(input);\nfunction safe(path) {\n if (!path || p.isAbsolute(path) || path.includes('\\\\') || path.includes('\\0') || path.split('/').some(x => x === '..' || x.toLowerCase() === '.git')) throw Error('Unsafe transfer path');\n const target = p.resolve(root, path);\n let parent = p.dirname(target);\n while (true) {\n if (fs.lstatSync(parent).isSymbolicLink()) throw Error('Transfer path traverses symlink');\n if (parent === p.resolve(root)) break;\n parent = p.dirname(parent);\n }\n return target;\n}\nasync function inspect(path, expected) {\n const dataRequired = expected !== undefined;\n const target = safe(path), stat = fs.lstatSync(target), hash = c.createHash('sha256');\n if (!stat.isFile() && !stat.isSymbolicLink()) throw Error('Unsupported transfer file');\n if (expected && stat.isFile() && stat.size !== expected.size) throw Error('Remote file changed during transfer');\n let data, size = stat.size;\n if (stat.isSymbolicLink()) { data = Buffer.from(fs.readlinkSync(target)); size = data.length; hash.update(data); }\n else {\n const chunks = []; let bytes = 0;\n for await (const chunk of fs.createReadStream(target)) {\n hash.update(chunk);\n if (dataRequired) {\n bytes += chunk.length;\n if (bytes > expected.size) throw Error('Remote file changed during transfer');\n chunks.push(chunk);\n }\n }\n if (dataRequired) data = Buffer.concat(chunks);\n }\n const entry = { path, kind: stat.isSymbolicLink() ? 'link' : 'file', mode: stat.mode & 511, size, sha256: hash.digest('hex') };\n return dataRequired ? { ...entry, data: data.toString('base64') } : entry;\n}\n(async () => {\n const result = [];\n for (const entry of entries) {\n const item = await inspect(operation === 'manifest' ? entry : entry.path, operation === 'batch' ? entry : undefined);\n if (operation === 'batch' && ['path', 'kind', 'mode', 'size', 'sha256'].some(key => item[key] !== entry[key])) throw Error('Remote file changed during transfer');\n result.push(item);\n }\n if (operation === 'manifest') { process.stdout.write(JSON.stringify(result)); return; }\n fs.writeFileSync(output, z.gzipSync(Buffer.from(JSON.stringify(result))), { mode: 384, flag: 'wx' });\n})().catch(error => { console.error(error.message); process.exitCode = 1; });\n`;\n\nexport const fileBatchCleanupScript = `require(\"node:fs\").rmSync(process.argv[1], { force: true })`;\n"]}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { randomUUID, createHash } from "node:crypto";
|
|
2
|
+
import { chmod, lstat, mkdir, mkdtemp, readFile, rm, symlink, writeFile, } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { gunzipSync } from "node:zlib";
|
|
6
|
+
import { OutpostError } from "../domain/errors.js";
|
|
7
|
+
import { fileManifest, parseManifest, sameFile, sameLocalFile, validateFilePaths, } from "../infrastructure/file-manifest.js";
|
|
8
|
+
import { safeDestination } from "../infrastructure/files.js";
|
|
9
|
+
import { transfer } from "../infrastructure/transfer.js";
|
|
10
|
+
import { fileBatchCleanupScript, fileBatchLimits, fileBatchScript, } from "./file-batches.constants.js";
|
|
11
|
+
export function fileBatches(lease) {
|
|
12
|
+
const run = async (args, options) => {
|
|
13
|
+
const result = await lease.invoke({
|
|
14
|
+
executable: "node",
|
|
15
|
+
arguments: ["-e", fileBatchScript, ...args],
|
|
16
|
+
retain: fileBatchLimits.manifestBytes,
|
|
17
|
+
...options,
|
|
18
|
+
});
|
|
19
|
+
if (result.status !== 0)
|
|
20
|
+
throw new OutpostError("provider", "Remote file manifest or batch failed", { stderr: result.stderr });
|
|
21
|
+
return result.stdout;
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
manifest(source, paths, options = {}) {
|
|
25
|
+
return transfer(options, async (signal) => {
|
|
26
|
+
validateFilePaths(paths);
|
|
27
|
+
const result = [];
|
|
28
|
+
for (let offset = 0; offset < paths.length;) {
|
|
29
|
+
signal.throwIfAborted();
|
|
30
|
+
const selected = paths.slice(offset, offset + fileBatchLimits.entries);
|
|
31
|
+
while (Buffer.byteLength(JSON.stringify(selected)) >
|
|
32
|
+
fileBatchLimits.argumentBytes)
|
|
33
|
+
selected.pop();
|
|
34
|
+
if (!selected.length)
|
|
35
|
+
throw new OutpostError("provider", "Manifest path exceeds command size limit");
|
|
36
|
+
offset += selected.length;
|
|
37
|
+
result.push(...parseManifest(JSON.parse(await run(["manifest", source, JSON.stringify(selected)], {
|
|
38
|
+
...options,
|
|
39
|
+
signal,
|
|
40
|
+
})), selected));
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
downloadBatch(source, entries, destination, options = {}) {
|
|
46
|
+
return transfer(options, async (signal) => {
|
|
47
|
+
parseManifest(entries, entries.map((entry) => entry.path));
|
|
48
|
+
if (!entries.length)
|
|
49
|
+
return;
|
|
50
|
+
const staging = await mkdtemp(join(tmpdir(), "outpost-batch-"));
|
|
51
|
+
try {
|
|
52
|
+
let pending = [], bytes = 0;
|
|
53
|
+
const flush = async () => {
|
|
54
|
+
if (!pending.length)
|
|
55
|
+
return;
|
|
56
|
+
const remote = `${source.replaceAll("\\", "/")}/../.outpost-${randomUUID()}.json.gz`;
|
|
57
|
+
try {
|
|
58
|
+
await run(["batch", source, JSON.stringify(pending), remote], {
|
|
59
|
+
...options,
|
|
60
|
+
signal,
|
|
61
|
+
});
|
|
62
|
+
signal.throwIfAborted();
|
|
63
|
+
const archive = join(staging, "batch.json.gz");
|
|
64
|
+
await lease.download(remote, archive, { ...options, signal });
|
|
65
|
+
signal.throwIfAborted();
|
|
66
|
+
await unpackBatch(archive, pending, destination, signal);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
await lease
|
|
70
|
+
.invoke({
|
|
71
|
+
executable: "node",
|
|
72
|
+
arguments: ["-e", fileBatchCleanupScript, remote],
|
|
73
|
+
deadlineMs: fileBatchLimits.cleanupMs,
|
|
74
|
+
})
|
|
75
|
+
.catch(() => undefined);
|
|
76
|
+
}
|
|
77
|
+
pending = [];
|
|
78
|
+
bytes = 0;
|
|
79
|
+
};
|
|
80
|
+
for (const entry of entries) {
|
|
81
|
+
signal.throwIfAborted();
|
|
82
|
+
await safeDestination(destination, entry.path);
|
|
83
|
+
if (entry.size > fileBatchLimits.bytes) {
|
|
84
|
+
await flush();
|
|
85
|
+
const target = await safeDestination(destination, entry.path);
|
|
86
|
+
await lease.download(`${source}/${entry.path}`, target, {
|
|
87
|
+
...options,
|
|
88
|
+
signal,
|
|
89
|
+
});
|
|
90
|
+
if (!sameLocalFile(entry, await fileManifest(destination, entry.path)))
|
|
91
|
+
throw new OutpostError("provider", "Remote file changed during transfer", { path: entry.path });
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (pending.length >= fileBatchLimits.entries ||
|
|
95
|
+
bytes + entry.size > fileBatchLimits.bytes ||
|
|
96
|
+
Buffer.byteLength(JSON.stringify([...pending, entry])) >
|
|
97
|
+
fileBatchLimits.argumentBytes)
|
|
98
|
+
await flush();
|
|
99
|
+
pending.push(entry);
|
|
100
|
+
bytes += entry.size;
|
|
101
|
+
}
|
|
102
|
+
await flush();
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
await rm(staging, { recursive: true, force: true });
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async function unpackBatch(archive, entries, destination, signal) {
|
|
112
|
+
const payload = JSON.parse(gunzipSync(await readFile(archive), {
|
|
113
|
+
maxOutputLength: fileBatchLimits.decodedBytes,
|
|
114
|
+
}).toString("utf8"));
|
|
115
|
+
const manifest = parseManifest(payload, entries.map((entry) => entry.path));
|
|
116
|
+
if (!Array.isArray(payload))
|
|
117
|
+
throw new OutpostError("provider", "Invalid file batch");
|
|
118
|
+
for (const [index, entry] of manifest.entries()) {
|
|
119
|
+
signal.throwIfAborted();
|
|
120
|
+
const record = payload[index];
|
|
121
|
+
if (!record ||
|
|
122
|
+
typeof record !== "object" ||
|
|
123
|
+
!("data" in record) ||
|
|
124
|
+
typeof record.data !== "string")
|
|
125
|
+
throw new OutpostError("provider", "Invalid batch payload");
|
|
126
|
+
const data = Buffer.from(record.data, "base64");
|
|
127
|
+
if (!sameFile(entry, entries[index]) ||
|
|
128
|
+
data.length !== entry.size ||
|
|
129
|
+
createHash("sha256").update(data).digest("hex") !== entry.sha256)
|
|
130
|
+
throw new OutpostError("provider", "File batch checksum mismatch", {
|
|
131
|
+
path: entry.path,
|
|
132
|
+
});
|
|
133
|
+
const target = await safeDestination(destination, entry.path);
|
|
134
|
+
await mkdir(dirname(target), { recursive: true });
|
|
135
|
+
if (await lstat(target).catch((error) => {
|
|
136
|
+
if (error.code === "ENOENT")
|
|
137
|
+
return undefined;
|
|
138
|
+
throw error;
|
|
139
|
+
}))
|
|
140
|
+
throw new OutpostError("provider", "Batch destination already exists", {
|
|
141
|
+
path: entry.path,
|
|
142
|
+
});
|
|
143
|
+
if (entry.kind === "link") {
|
|
144
|
+
await symlink(data.toString("utf8"), target);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
await writeFile(target, data, { mode: entry.mode, flag: "wx" });
|
|
148
|
+
await chmod(target, entry.mode);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=file-batches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-batches.js","sourceRoot":"","sources":["../../src/providers/file-batches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,EAAE,EACF,OAAO,EACP,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOnD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,aAAa,EACb,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,MAAM,UAAU,WAAW,CACzB,KAAgD;IAEhD,MAAM,GAAG,GAAG,KAAK,EAAE,IAAuB,EAAE,OAAwB,EAAE,EAAE;QACtE,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;YAChC,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,IAA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QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7C,SAAS;QACX,CAAC;QACD,MAAM,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,MAAM,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import { randomUUID, createHash } from \"node:crypto\";\nimport {\n chmod,\n lstat,\n mkdir,\n mkdtemp,\n readFile,\n rm,\n symlink,\n writeFile,\n} from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { gunzipSync } from \"node:zlib\";\nimport { OutpostError } from \"../domain/errors.ts\";\nimport type {\n FileManifestEntry,\n FileTransfers,\n SandboxLease,\n TransferOptions,\n} from \"../domain/sandbox.types.ts\";\nimport {\n fileManifest,\n parseManifest,\n sameFile,\n sameLocalFile,\n validateFilePaths,\n} from \"../infrastructure/file-manifest.ts\";\nimport { safeDestination } from \"../infrastructure/files.ts\";\nimport { transfer } from \"../infrastructure/transfer.ts\";\nimport {\n fileBatchCleanupScript,\n fileBatchLimits,\n fileBatchScript,\n} from \"./file-batches.constants.ts\";\n\nexport function fileBatches(\n lease: Pick<SandboxLease, \"invoke\" | \"download\">,\n): FileTransfers {\n const run = async (args: readonly string[], options: TransferOptions) => {\n const result = await lease.invoke({\n executable: \"node\",\n arguments: [\"-e\", fileBatchScript, ...args],\n retain: fileBatchLimits.manifestBytes,\n ...options,\n });\n if (result.status !== 0)\n throw new OutpostError(\n \"provider\",\n \"Remote file manifest or batch failed\",\n { stderr: result.stderr },\n );\n return result.stdout;\n };\n return {\n manifest(source, paths, options = {}) {\n return transfer(options, async (signal) => {\n validateFilePaths(paths);\n const result: FileManifestEntry[] = [];\n for (let offset = 0; offset < paths.length;) {\n signal.throwIfAborted();\n const selected = paths.slice(\n offset,\n offset + fileBatchLimits.entries,\n );\n while (\n Buffer.byteLength(JSON.stringify(selected)) >\n fileBatchLimits.argumentBytes\n )\n selected.pop();\n if (!selected.length)\n throw new OutpostError(\n \"provider\",\n \"Manifest path exceeds command size limit\",\n );\n offset += selected.length;\n result.push(\n ...parseManifest(\n JSON.parse(\n await run([\"manifest\", source, JSON.stringify(selected)], {\n ...options,\n signal,\n }),\n ),\n selected,\n ),\n );\n }\n return result;\n });\n },\n downloadBatch(source, entries, destination, options = {}) {\n return transfer(options, async (signal) => {\n parseManifest(\n entries,\n entries.map((entry) => entry.path),\n );\n if (!entries.length) return;\n const staging = await mkdtemp(join(tmpdir(), \"outpost-batch-\"));\n try {\n let pending: FileManifestEntry[] = [],\n bytes = 0;\n const flush = async () => {\n if (!pending.length) return;\n const remote = `${source.replaceAll(\"\\\\\", \"/\")}/../.outpost-${randomUUID()}.json.gz`;\n try {\n await run([\"batch\", source, JSON.stringify(pending), remote], {\n ...options,\n signal,\n });\n signal.throwIfAborted();\n const archive = join(staging, \"batch.json.gz\");\n await lease.download(remote, archive, { ...options, signal });\n signal.throwIfAborted();\n await unpackBatch(archive, pending, destination, signal);\n } finally {\n await lease\n .invoke({\n executable: \"node\",\n arguments: [\"-e\", fileBatchCleanupScript, remote],\n deadlineMs: fileBatchLimits.cleanupMs,\n })\n .catch(() => undefined);\n }\n pending = [];\n bytes = 0;\n };\n for (const entry of entries) {\n signal.throwIfAborted();\n await safeDestination(destination, entry.path);\n if (entry.size > fileBatchLimits.bytes) {\n await flush();\n const target = await safeDestination(destination, entry.path);\n await lease.download(`${source}/${entry.path}`, target, {\n ...options,\n signal,\n });\n if (\n !sameLocalFile(\n entry,\n await fileManifest(destination, entry.path),\n )\n )\n throw new OutpostError(\n \"provider\",\n \"Remote file changed during transfer\",\n { path: entry.path },\n );\n continue;\n }\n if (\n pending.length >= fileBatchLimits.entries ||\n bytes + entry.size > fileBatchLimits.bytes ||\n Buffer.byteLength(JSON.stringify([...pending, entry])) >\n fileBatchLimits.argumentBytes\n )\n await flush();\n pending.push(entry);\n bytes += entry.size;\n }\n await flush();\n } finally {\n await rm(staging, { recursive: true, force: true });\n }\n });\n },\n };\n}\n\nasync function unpackBatch(\n archive: string,\n entries: readonly FileManifestEntry[],\n destination: string,\n signal: AbortSignal,\n): Promise<void> {\n const payload: unknown = JSON.parse(\n gunzipSync(await readFile(archive), {\n maxOutputLength: fileBatchLimits.decodedBytes,\n }).toString(\"utf8\"),\n );\n const manifest = parseManifest(\n payload,\n entries.map((entry) => entry.path),\n );\n if (!Array.isArray(payload))\n throw new OutpostError(\"provider\", \"Invalid file batch\");\n for (const [index, entry] of manifest.entries()) {\n signal.throwIfAborted();\n const record: unknown = payload[index];\n if (\n !record ||\n typeof record !== \"object\" ||\n !(\"data\" in record) ||\n typeof record.data !== \"string\"\n )\n throw new OutpostError(\"provider\", \"Invalid batch payload\");\n const data = Buffer.from(record.data, \"base64\");\n if (\n !sameFile(entry, entries[index]!) ||\n data.length !== entry.size ||\n createHash(\"sha256\").update(data).digest(\"hex\") !== entry.sha256\n )\n throw new OutpostError(\"provider\", \"File batch checksum mismatch\", {\n path: entry.path,\n });\n const target = await safeDestination(destination, entry.path);\n await mkdir(dirname(target), { recursive: true });\n if (\n await lstat(target).catch((error) => {\n if (error.code === \"ENOENT\") return undefined;\n throw error;\n })\n )\n throw new OutpostError(\"provider\", \"Batch destination already exists\", {\n path: entry.path,\n });\n if (entry.kind === \"link\") {\n await symlink(data.toString(\"utf8\"), target);\n continue;\n }\n await writeFile(target, data, { mode: entry.mode, flag: \"wx\" });\n await chmod(target, entry.mode);\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
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
|
+
export type { DependencyCache } from "./container-cache.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"]}
|
|
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"]}
|
package/dist/providers/vercel.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OutpostError } from "../domain/errors.js";
|
|
2
|
+
import { fileBatches } from "./file-batches.js";
|
|
2
3
|
import { registerCleanup } from "../infrastructure/shutdown.js";
|
|
3
4
|
import { cloudRoots } from "./cloud.constants.js";
|
|
4
5
|
import { vercelCommand } from "./vercel-command.js";
|
|
@@ -40,7 +41,7 @@ export function vercel(options = {}, connect = async (config) => (await import("
|
|
|
40
41
|
await release();
|
|
41
42
|
throw cause;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
const lease = {
|
|
44
45
|
root,
|
|
45
46
|
home,
|
|
46
47
|
invoke: vercelCommand({
|
|
@@ -53,6 +54,7 @@ export function vercel(options = {}, connect = async (config) => (await import("
|
|
|
53
54
|
...vercelFiles(sandbox),
|
|
54
55
|
release,
|
|
55
56
|
};
|
|
57
|
+
return { ...lease, fileTransfers: fileBatches(lease) };
|
|
56
58
|
},
|
|
57
59
|
};
|
|
58
60
|
}
|
|
@@ -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,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,MAAM,CAAC;IAE7D,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE;QACnC,KAAK,CAAC,OAAO,CAAC,OAAO;YACnB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC;gBAC5B,GAAG,OAAO,CAAC,MAAM;gBACjB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE;aACtD,CAAC,CAAC;YACH,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,CAAC,MAAM,CA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;YACtC,IAAI,IAAY,CAAC;YACjB,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC1B,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 { 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 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 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 sandbox.mkDir(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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elie-laloum/outpost",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Programmable sandboxes, coding agents and typed workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"./providers/daytona": {
|
|
36
36
|
"types": "./dist/providers/daytona.d.ts",
|
|
37
37
|
"import": "./dist/providers/daytona.js"
|
|
38
|
+
},
|
|
39
|
+
"./opentelemetry": {
|
|
40
|
+
"types": "./dist/infrastructure/opentelemetry.d.ts",
|
|
41
|
+
"import": "./dist/infrastructure/opentelemetry.js"
|
|
38
42
|
}
|
|
39
43
|
},
|
|
40
44
|
"files": [
|
|
@@ -77,6 +81,7 @@
|
|
|
77
81
|
},
|
|
78
82
|
"peerDependencies": {
|
|
79
83
|
"@daytona/sdk": "^0.216.0",
|
|
84
|
+
"@opentelemetry/api": "^1.9.0",
|
|
80
85
|
"@vercel/sandbox": "^3.3.0"
|
|
81
86
|
},
|
|
82
87
|
"peerDependenciesMeta": {
|
|
@@ -85,10 +90,16 @@
|
|
|
85
90
|
},
|
|
86
91
|
"@vercel/sandbox": {
|
|
87
92
|
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@opentelemetry/api": {
|
|
95
|
+
"optional": true
|
|
88
96
|
}
|
|
89
97
|
},
|
|
90
98
|
"devDependencies": {
|
|
91
99
|
"@daytona/sdk": "^0.216.0",
|
|
100
|
+
"@opentelemetry/api": "^1.9.0",
|
|
101
|
+
"@opentelemetry/sdk-metrics": "^2.0.0",
|
|
102
|
+
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
92
103
|
"@types/node": "^24.0.0",
|
|
93
104
|
"@vercel/sandbox": "^3.3.0",
|
|
94
105
|
"c8": "^10.1.3",
|