withruntime 0.49.0 → 1.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/dist/generated/apps.d.ts +309 -0
- package/dist/generated/apps.js +333 -0
- package/dist/generated/audit.d.ts +47 -0
- package/dist/generated/audit.js +14 -0
- package/dist/generated/browsers.d.ts +309 -0
- package/dist/generated/browsers.js +333 -0
- package/dist/generated/builds.d.ts +309 -0
- package/dist/generated/builds.js +333 -0
- package/dist/generated/ci.d.ts +309 -0
- package/dist/generated/ci.js +333 -0
- package/dist/generated/containers.d.ts +309 -0
- package/dist/generated/containers.js +333 -0
- package/dist/generated/desktops.d.ts +309 -0
- package/dist/generated/desktops.js +333 -0
- package/dist/generated/domains.d.ts +80 -0
- package/dist/generated/domains.js +58 -0
- package/dist/generated/egressIps.d.ts +36 -0
- package/dist/generated/egressIps.js +14 -0
- package/dist/generated/events.d.ts +37 -0
- package/dist/generated/events.js +14 -0
- package/dist/generated/feedback.d.ts +44 -0
- package/dist/generated/feedback.js +13 -0
- package/dist/generated/functions.d.ts +309 -0
- package/dist/generated/functions.js +333 -0
- package/dist/generated/identities.d.ts +36 -0
- package/dist/generated/identities.js +22 -0
- package/dist/generated/images.d.ts +200 -0
- package/dist/generated/images.js +65 -0
- package/dist/generated/index.d.ts +143 -0
- package/dist/generated/index.js +184 -0
- package/dist/generated/jobRuns.d.ts +68 -0
- package/dist/generated/jobRuns.js +22 -0
- package/dist/generated/jobs.d.ts +144 -0
- package/dist/generated/jobs.js +85 -0
- package/dist/generated/keys.d.ts +105 -0
- package/dist/generated/keys.js +26 -0
- package/dist/generated/me.d.ts +33 -0
- package/dist/generated/me.js +13 -0
- package/dist/generated/networks.d.ts +32 -0
- package/dist/generated/networks.js +14 -0
- package/dist/generated/notebooks.d.ts +309 -0
- package/dist/generated/notebooks.js +333 -0
- package/dist/generated/otel.d.ts +46 -0
- package/dist/generated/otel.js +22 -0
- package/dist/generated/ports.d.ts +55 -0
- package/dist/generated/ports.js +22 -0
- package/dist/generated/previews.d.ts +86 -0
- package/dist/generated/previews.js +67 -0
- package/dist/generated/projects.d.ts +47 -0
- package/dist/generated/projects.js +26 -0
- package/dist/generated/roles.d.ts +36 -0
- package/dist/generated/roles.js +22 -0
- package/dist/generated/routes.d.ts +3 -0
- package/dist/generated/routes.js +4 -0
- package/dist/generated/runtime.d.ts +176 -0
- package/dist/generated/runtime.js +416 -0
- package/dist/generated/sandboxes.d.ts +952 -0
- package/dist/generated/sandboxes.js +342 -0
- package/dist/generated/secrets.d.ts +116 -0
- package/dist/generated/secrets.js +54 -0
- package/dist/generated/sessions.d.ts +47 -0
- package/dist/generated/sessions.js +17 -0
- package/dist/generated/signing.d.ts +68 -0
- package/dist/generated/signing.js +187 -0
- package/dist/generated/sites.d.ts +309 -0
- package/dist/generated/sites.js +333 -0
- package/dist/generated/snapshots.d.ts +27 -0
- package/dist/generated/snapshots.js +22 -0
- package/dist/generated/tunnels.d.ts +68 -0
- package/dist/generated/tunnels.js +14 -0
- package/dist/generated/usage.d.ts +155 -0
- package/dist/generated/usage.js +17 -0
- package/dist/generated/volumes.d.ts +36 -0
- package/dist/generated/volumes.js +26 -0
- package/dist/generated/webhooks.d.ts +44 -0
- package/dist/generated/webhooks.js +22 -0
- package/dist/generated/workspaces.d.ts +309 -0
- package/dist/generated/workspaces.js +333 -0
- package/dist/v2/cli.d.ts +7 -0
- package/dist/v2/cli.js +283 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +4 -0
- package/dist/v2/login.d.ts +35 -0
- package/dist/v2/login.js +225 -0
- package/dist/v2/mcp.d.ts +1 -0
- package/dist/v2/mcp.js +49 -0
- package/dist/v2/openapi.json +75750 -0
- package/dist/v2/shims/base.d.ts +33 -0
- package/dist/v2/shims/base.js +54 -0
- package/dist/v2/shims/blaxel.d.ts +60 -0
- package/dist/v2/shims/blaxel.js +71 -0
- package/dist/v2/shims/cloudflare.d.ts +52 -0
- package/dist/v2/shims/cloudflare.js +55 -0
- package/dist/v2/shims/daytona.d.ts +58 -0
- package/dist/v2/shims/daytona.js +74 -0
- package/dist/v2/shims/e2b.d.ts +142 -0
- package/dist/v2/shims/e2b.js +238 -0
- package/dist/v2/shims/fly.d.ts +6 -0
- package/dist/v2/shims/fly.js +91 -0
- package/dist/v2/shims/modal.d.ts +54 -0
- package/dist/v2/shims/modal.js +79 -0
- package/dist/v2/shims/morph.d.ts +60 -0
- package/dist/v2/shims/morph.js +87 -0
- package/dist/v2/shims/vercel.d.ts +53 -0
- package/dist/v2/shims/vercel.js +90 -0
- package/dist/v2/table.d.ts +53 -0
- package/dist/v2/table.js +122 -0
- package/package.json +20 -310
- package/BLAXEL.md +0 -290
- package/COMPATIBILITY.md +0 -447
- package/DAYTONA.md +0 -237
- package/E2B.md +0 -314
- package/README.md +0 -331
- package/README.src.md +0 -333
- package/VERCEL.md +0 -230
- package/agent-platforms-inventory.json +0 -387
- package/compatibility-lock.json +0 -305
- package/dist/agents/browser.d.ts +0 -12
- package/dist/agents/browser.js +0 -12
- package/dist/agents/index.d.ts +0 -11
- package/dist/agents/index.js +0 -11
- package/dist/agents-cli.d.ts +0 -16
- package/dist/agents-cli.js +0 -1237
- package/dist/agents-deploy.d.ts +0 -196
- package/dist/agents-deploy.js +0 -872
- package/dist/agents-file.d.ts +0 -19
- package/dist/agents-file.js +0 -135
- package/dist/ai/index.d.ts +0 -49
- package/dist/ai/index.js +0 -31
- package/dist/ai-harness/index.d.ts +0 -194
- package/dist/ai-harness/index.js +0 -522
- package/dist/api-defaults.d.ts +0 -17
- package/dist/api-defaults.js +0 -22
- package/dist/apps/index.d.ts +0 -10
- package/dist/apps/index.js +0 -11
- package/dist/apps-cli.d.ts +0 -16
- package/dist/apps-cli.js +0 -1021
- package/dist/billing-cli.d.ts +0 -23
- package/dist/billing-cli.js +0 -264
- package/dist/blaxel/client.d.ts +0 -59
- package/dist/blaxel/client.js +0 -86
- package/dist/blaxel/context.d.ts +0 -59
- package/dist/blaxel/context.js +0 -162
- package/dist/blaxel/errors.d.ts +0 -130
- package/dist/blaxel/errors.js +0 -315
- package/dist/blaxel/filesystem.d.ts +0 -147
- package/dist/blaxel/filesystem.js +0 -585
- package/dist/blaxel/index.d.ts +0 -287
- package/dist/blaxel/index.js +0 -351
- package/dist/blaxel/interpreter.d.ts +0 -71
- package/dist/blaxel/interpreter.js +0 -256
- package/dist/blaxel/lookup.d.ts +0 -39
- package/dist/blaxel/lookup.js +0 -84
- package/dist/blaxel/pagination.d.ts +0 -39
- package/dist/blaxel/pagination.js +0 -88
- package/dist/blaxel/preview.d.ts +0 -136
- package/dist/blaxel/preview.js +0 -304
- package/dist/blaxel/process.d.ts +0 -126
- package/dist/blaxel/process.js +0 -581
- package/dist/blaxel/sandbox.d.ts +0 -198
- package/dist/blaxel/sandbox.js +0 -856
- package/dist/blaxel/session.d.ts +0 -31
- package/dist/blaxel/session.js +0 -136
- package/dist/blaxel/snapshot.d.ts +0 -123
- package/dist/blaxel/snapshot.js +0 -199
- package/dist/blaxel/types.d.ts +0 -145
- package/dist/blaxel/types.js +0 -60
- package/dist/blaxel/unsupported.d.ts +0 -20
- package/dist/blaxel/unsupported.js +0 -32
- package/dist/browser-stub.d.ts +0 -1
- package/dist/browser-stub.js +0 -1
- package/dist/browsers/index.d.ts +0 -9
- package/dist/browsers/index.js +0 -10
- package/dist/browsers-cli.d.ts +0 -13
- package/dist/browsers-cli.js +0 -279
- package/dist/builds/index.d.ts +0 -10
- package/dist/builds/index.js +0 -11
- package/dist/ci/index.d.ts +0 -13
- package/dist/ci/index.js +0 -14
- package/dist/ci-cli.d.ts +0 -20
- package/dist/ci-cli.js +0 -537
- package/dist/ci-import.d.ts +0 -23
- package/dist/ci-import.js +0 -565
- package/dist/claude-agent-sdk/index.d.ts +0 -7
- package/dist/claude-agent-sdk/index.js +0 -65
- package/dist/cli/logs.d.ts +0 -21
- package/dist/cli/logs.js +0 -188
- package/dist/cli-extras.d.ts +0 -39
- package/dist/cli-extras.js +0 -267
- package/dist/cli-name.d.ts +0 -6
- package/dist/cli-name.js +0 -8
- package/dist/cli-update.d.ts +0 -11
- package/dist/cli-update.js +0 -46
- package/dist/cli-words.d.ts +0 -36
- package/dist/cli-words.js +0 -167
- package/dist/cli.d.ts +0 -92
- package/dist/cli.js +0 -5463
- package/dist/client.d.ts +0 -189
- package/dist/client.js +0 -205
- package/dist/cloudflare/errors.d.ts +0 -166
- package/dist/cloudflare/errors.js +0 -183
- package/dist/cloudflare/identity.d.ts +0 -7
- package/dist/cloudflare/identity.js +0 -13
- package/dist/cloudflare/index.d.ts +0 -545
- package/dist/cloudflare/index.js +0 -1106
- package/dist/cloudflare/interpreter.d.ts +0 -119
- package/dist/cloudflare/interpreter.js +0 -232
- package/dist/cloudflare/mime.d.ts +0 -1
- package/dist/cloudflare/mime.js +0 -66
- package/dist/cloudflare/streams.d.ts +0 -46
- package/dist/cloudflare/streams.js +0 -175
- package/dist/cloudflare/types.d.ts +0 -338
- package/dist/cloudflare/types.js +0 -80
- package/dist/cloudflare/watch.d.ts +0 -9
- package/dist/cloudflare/watch.js +0 -24
- package/dist/cloudflare/worker.d.ts +0 -706
- package/dist/cloudflare/worker.js +0 -633
- package/dist/codesandbox/guest-service.d.ts +0 -31
- package/dist/codesandbox/guest-service.js +0 -490
- package/dist/codesandbox/index.d.ts +0 -574
- package/dist/codesandbox/index.js +0 -1747
- package/dist/compat/core.d.ts +0 -58
- package/dist/compat/core.js +0 -267
- package/dist/compat/files.d.ts +0 -27
- package/dist/compat/files.js +0 -157
- package/dist/compat/lease.d.ts +0 -37
- package/dist/compat/lease.js +0 -93
- package/dist/compat/shell.d.ts +0 -4
- package/dist/compat/shell.js +0 -165
- package/dist/containers/index.d.ts +0 -10
- package/dist/containers/index.js +0 -11
- package/dist/credentials.d.ts +0 -71
- package/dist/credentials.js +0 -340
- package/dist/daytona/client.d.ts +0 -48
- package/dist/daytona/client.js +0 -45
- package/dist/daytona/computer-use.d.ts +0 -171
- package/dist/daytona/computer-use.js +0 -382
- package/dist/daytona/context.d.ts +0 -41
- package/dist/daytona/context.js +0 -50
- package/dist/daytona/daytona.d.ts +0 -213
- package/dist/daytona/daytona.js +0 -578
- package/dist/daytona/errors.d.ts +0 -117
- package/dist/daytona/errors.js +0 -201
- package/dist/daytona/filesystem.d.ts +0 -99
- package/dist/daytona/filesystem.js +0 -300
- package/dist/daytona/git.d.ts +0 -33
- package/dist/daytona/git.js +0 -128
- package/dist/daytona/image.d.ts +0 -49
- package/dist/daytona/image.js +0 -146
- package/dist/daytona/index.d.ts +0 -87
- package/dist/daytona/index.js +0 -102
- package/dist/daytona/process.d.ts +0 -143
- package/dist/daytona/process.js +0 -565
- package/dist/daytona/sandbox.d.ts +0 -222
- package/dist/daytona/sandbox.js +0 -505
- package/dist/desktops/index.d.ts +0 -9
- package/dist/desktops/index.js +0 -10
- package/dist/domains/index.d.ts +0 -9
- package/dist/domains/index.js +0 -10
- package/dist/e2b/client.d.ts +0 -76
- package/dist/e2b/client.js +0 -124
- package/dist/e2b/code-interpreter.d.ts +0 -134
- package/dist/e2b/code-interpreter.js +0 -239
- package/dist/e2b/commands.d.ts +0 -135
- package/dist/e2b/commands.js +0 -452
- package/dist/e2b/errors.d.ts +0 -125
- package/dist/e2b/errors.js +0 -247
- package/dist/e2b/filesystem.d.ts +0 -111
- package/dist/e2b/filesystem.js +0 -374
- package/dist/e2b/index.d.ts +0 -35
- package/dist/e2b/index.js +0 -69
- package/dist/e2b/pty.d.ts +0 -24
- package/dist/e2b/pty.js +0 -83
- package/dist/e2b/sandbox.d.ts +0 -248
- package/dist/e2b/sandbox.js +0 -781
- package/dist/e2b/unsupported.d.ts +0 -38
- package/dist/e2b/unsupported.js +0 -48
- package/dist/e2b/users.d.ts +0 -39
- package/dist/e2b/users.js +0 -207
- package/dist/errors.d.ts +0 -100
- package/dist/errors.js +0 -198
- package/dist/file-source.d.ts +0 -16
- package/dist/file-source.js +0 -162
- package/dist/fly/index.d.ts +0 -102
- package/dist/fly/index.js +0 -930
- package/dist/freestyle/index.d.ts +0 -629
- package/dist/freestyle/index.js +0 -1187
- package/dist/functions/index.d.ts +0 -10
- package/dist/functions/index.js +0 -11
- package/dist/identity.d.ts +0 -30
- package/dist/identity.js +0 -141
- package/dist/image-context.d.ts +0 -39
- package/dist/image-context.js +0 -176
- package/dist/images/index.d.ts +0 -9
- package/dist/images/index.js +0 -10
- package/dist/index.d.ts +0 -87
- package/dist/index.js +0 -51
- package/dist/inngest/index.d.ts +0 -96
- package/dist/inngest/index.js +0 -183
- package/dist/ips/index.d.ts +0 -9
- package/dist/ips/index.js +0 -10
- package/dist/jobs/index.d.ts +0 -9
- package/dist/jobs/index.js +0 -10
- package/dist/jobs-code/cron.d.ts +0 -12
- package/dist/jobs-code/cron.js +0 -93
- package/dist/jobs-code/registry.d.ts +0 -31
- package/dist/jobs-code/registry.js +0 -30
- package/dist/jobs-code/runner.d.ts +0 -1
- package/dist/jobs-code/runner.js +0 -74
- package/dist/jobs-deploy.d.ts +0 -22
- package/dist/jobs-deploy.js +0 -247
- package/dist/jobs-import.d.ts +0 -15
- package/dist/jobs-import.js +0 -231
- package/dist/keys.d.ts +0 -55
- package/dist/keys.js +0 -211
- package/dist/login.d.ts +0 -88
- package/dist/login.js +0 -369
- package/dist/machine.d.ts +0 -222
- package/dist/machine.js +0 -578
- package/dist/mcp.d.ts +0 -16
- package/dist/mcp.js +0 -377
- package/dist/modal/index.d.ts +0 -532
- package/dist/modal/index.js +0 -1284
- package/dist/morph/index.d.ts +0 -255
- package/dist/morph/index.js +0 -641
- package/dist/network-cli.d.ts +0 -17
- package/dist/network-cli.js +0 -523
- package/dist/networks/index.d.ts +0 -11
- package/dist/networks/index.js +0 -10
- package/dist/openai-agents/index.d.ts +0 -132
- package/dist/openai-agents/index.js +0 -738
- package/dist/page.d.ts +0 -13
- package/dist/page.js +0 -39
- package/dist/ports/index.d.ts +0 -9
- package/dist/ports/index.js +0 -10
- package/dist/product-names.d.ts +0 -52
- package/dist/product-names.js +0 -174
- package/dist/product-renames.d.ts +0 -103
- package/dist/product-renames.js +0 -189
- package/dist/products/agents.d.ts +0 -935
- package/dist/products/agents.js +0 -581
- package/dist/products/api-keys.d.ts +0 -113
- package/dist/products/api-keys.js +0 -32
- package/dist/products/apps.d.ts +0 -409
- package/dist/products/apps.js +0 -231
- package/dist/products/audit.d.ts +0 -51
- package/dist/products/audit.js +0 -10
- package/dist/products/balancers.d.ts +0 -87
- package/dist/products/balancers.js +0 -8
- package/dist/products/billing.d.ts +0 -76
- package/dist/products/billing.js +0 -26
- package/dist/products/browser.d.ts +0 -73
- package/dist/products/browser.js +0 -29
- package/dist/products/browsers.d.ts +0 -184
- package/dist/products/browsers.js +0 -180
- package/dist/products/builds.d.ts +0 -175
- package/dist/products/builds.js +0 -234
- package/dist/products/ci.d.ts +0 -406
- package/dist/products/ci.js +0 -133
- package/dist/products/containers.d.ts +0 -71
- package/dist/products/containers.js +0 -6
- package/dist/products/desktop.d.ts +0 -141
- package/dist/products/desktop.js +0 -83
- package/dist/products/desktops.d.ts +0 -71
- package/dist/products/desktops.js +0 -27
- package/dist/products/functions.d.ts +0 -2
- package/dist/products/functions.js +0 -5
- package/dist/products/images.d.ts +0 -229
- package/dist/products/images.js +0 -235
- package/dist/products/index.d.ts +0 -84
- package/dist/products/index.js +0 -105
- package/dist/products/interpreter.d.ts +0 -97
- package/dist/products/interpreter.js +0 -106
- package/dist/products/jobs.d.ts +0 -408
- package/dist/products/jobs.js +0 -256
- package/dist/products/limits.d.ts +0 -61
- package/dist/products/limits.js +0 -10
- package/dist/products/logs.d.ts +0 -245
- package/dist/products/logs.js +0 -274
- package/dist/products/mcp.d.ts +0 -88
- package/dist/products/mcp.js +0 -58
- package/dist/products/mounts.d.ts +0 -49
- package/dist/products/mounts.js +0 -21
- package/dist/products/network-products.d.ts +0 -268
- package/dist/products/network-products.js +0 -127
- package/dist/products/network.d.ts +0 -62
- package/dist/products/network.js +0 -19
- package/dist/products/observability.d.ts +0 -264
- package/dist/products/observability.js +0 -123
- package/dist/products/plans.d.ts +0 -133
- package/dist/products/plans.js +0 -24
- package/dist/products/previews.d.ts +0 -70
- package/dist/products/previews.js +0 -39
- package/dist/products/private-network.d.ts +0 -22
- package/dist/products/private-network.js +0 -10
- package/dist/products/queues.d.ts +0 -149
- package/dist/products/queues.js +0 -213
- package/dist/products/referrals.d.ts +0 -50
- package/dist/products/referrals.js +0 -8
- package/dist/products/reservations.d.ts +0 -108
- package/dist/products/reservations.js +0 -41
- package/dist/products/resources.d.ts +0 -55
- package/dist/products/resources.js +0 -122
- package/dist/products/secrets.d.ts +0 -316
- package/dist/products/secrets.js +0 -333
- package/dist/products/signed-requests.d.ts +0 -21
- package/dist/products/signed-requests.js +0 -11
- package/dist/products/sso.d.ts +0 -44
- package/dist/products/sso.js +0 -8
- package/dist/products/streams.d.ts +0 -73
- package/dist/products/streams.js +0 -17
- package/dist/products/switching.d.ts +0 -123
- package/dist/products/switching.js +0 -26
- package/dist/products/tailscale.d.ts +0 -57
- package/dist/products/tailscale.js +0 -17
- package/dist/products/uptime.d.ts +0 -97
- package/dist/products/uptime.js +0 -42
- package/dist/products/volumes.d.ts +0 -190
- package/dist/products/volumes.js +0 -114
- package/dist/products/watch.d.ts +0 -112
- package/dist/products/watch.js +0 -249
- package/dist/proxy.d.ts +0 -30
- package/dist/proxy.js +0 -200
- package/dist/record-cli.d.ts +0 -23
- package/dist/record-cli.js +0 -308
- package/dist/renamed-products.d.ts +0 -38
- package/dist/renamed-products.js +0 -34
- package/dist/resumable.d.ts +0 -32
- package/dist/resumable.js +0 -201
- package/dist/runloop/index.d.ts +0 -333
- package/dist/runloop/index.js +0 -560
- package/dist/runloop/pagination.d.ts +0 -46
- package/dist/runloop/pagination.js +0 -82
- package/dist/runloop/sdk.d.ts +0 -131
- package/dist/runloop/sdk.js +0 -167
- package/dist/runloop/snapshots.d.ts +0 -52
- package/dist/runloop/snapshots.js +0 -244
- package/dist/sandbox.d.ts +0 -371
- package/dist/sandbox.js +0 -1500
- package/dist/sandboxes/index.d.ts +0 -11
- package/dist/sandboxes/index.js +0 -12
- package/dist/sealing.d.ts +0 -6
- package/dist/sealing.js +0 -14
- package/dist/snapshots/index.d.ts +0 -9
- package/dist/snapshots/index.js +0 -11
- package/dist/snapshots.d.ts +0 -82
- package/dist/snapshots.js +0 -65
- package/dist/sprites/index.d.ts +0 -563
- package/dist/sprites/index.js +0 -1370
- package/dist/ssh.d.ts +0 -56
- package/dist/ssh.js +0 -416
- package/dist/switched-off.d.ts +0 -5
- package/dist/switched-off.js +0 -8
- package/dist/tar.d.ts +0 -15
- package/dist/tar.js +0 -526
- package/dist/terminal.d.ts +0 -24
- package/dist/terminal.js +0 -32
- package/dist/tools/index.d.ts +0 -62
- package/dist/tools/index.js +0 -181
- package/dist/transport.d.ts +0 -165
- package/dist/transport.js +0 -883
- package/dist/trigger/index.d.ts +0 -202
- package/dist/trigger/index.js +0 -244
- package/dist/tunnel.d.ts +0 -70
- package/dist/tunnel.js +0 -316
- package/dist/types.d.ts +0 -574
- package/dist/types.js +0 -1
- package/dist/vercel/client.d.ts +0 -40
- package/dist/vercel/client.js +0 -39
- package/dist/vercel/command.d.ts +0 -117
- package/dist/vercel/command.js +0 -391
- package/dist/vercel/errors.d.ts +0 -53
- package/dist/vercel/errors.js +0 -131
- package/dist/vercel/filesystem.d.ts +0 -153
- package/dist/vercel/filesystem.js +0 -297
- package/dist/vercel/index.d.ts +0 -24
- package/dist/vercel/index.js +0 -36
- package/dist/vercel/sandbox-user.d.ts +0 -70
- package/dist/vercel/sandbox-user.js +0 -207
- package/dist/vercel/sandbox.d.ts +0 -372
- package/dist/vercel/sandbox.js +0 -1037
- package/dist/vercel/snapshot.d.ts +0 -94
- package/dist/vercel/snapshot.js +0 -137
- package/dist/volumes/index.d.ts +0 -9
- package/dist/volumes/index.js +0 -10
- package/dist/wait.d.ts +0 -12
- package/dist/wait.js +0 -47
- package/dist/wallet.d.ts +0 -45
- package/dist/wallet.js +0 -56
- package/dist/wireguard.d.ts +0 -7
- package/dist/wireguard.js +0 -13
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Runtime, type Process } from "../../generated/index.js";
|
|
2
|
+
export interface RuntimeOptions {
|
|
3
|
+
/** Defaults to RUNTIME_API_KEY. */
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
/** Defaults to RUNTIME_API_URL, then https://api.withruntime.com. */
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function client(o?: RuntimeOptions): Runtime;
|
|
9
|
+
/** A shell command run as the rivals run theirs: text in bash, a login shell (the API's own `cmd`), a list as argv. */
|
|
10
|
+
export declare function shell(cmd: string | string[]): string | string[];
|
|
11
|
+
export declare function bytes(data: string | Uint8Array | ArrayBuffer | ArrayBufferView): Uint8Array;
|
|
12
|
+
export declare const text: (b: Uint8Array) => string;
|
|
13
|
+
export declare function base64(data: string | Uint8Array): string;
|
|
14
|
+
/** A command run to its end: its process, with the output it wrote (empty when none). */
|
|
15
|
+
export type Ran = Process & {
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
};
|
|
19
|
+
/** A command's run: its cmd, directory, environment, input and time limit. */
|
|
20
|
+
export declare function run(k: Runtime, id: string, cmd: string | string[], o?: {
|
|
21
|
+
cwd?: string;
|
|
22
|
+
env?: Record<string, string>;
|
|
23
|
+
stdin?: string | Uint8Array;
|
|
24
|
+
timeoutMs?: number;
|
|
25
|
+
}): Promise<Ran>;
|
|
26
|
+
/** The entries of a folder, by one `ls`-free listing every Linux has: name, type, size, time. */
|
|
27
|
+
export declare function list(k: Runtime, id: string, path: string): Promise<{
|
|
28
|
+
name: string;
|
|
29
|
+
path: string;
|
|
30
|
+
type: "file" | "dir";
|
|
31
|
+
size: number;
|
|
32
|
+
modifiedTime: Date;
|
|
33
|
+
}[]>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* What every drop-in shares: a Runtime from the rival's options or the environment,
|
|
2
|
+
a shell command as an exec's cmd, and bytes and text both ways. Each shim maps
|
|
3
|
+
its rival's API onto the generated core's verbs and nothing more. */
|
|
4
|
+
import { Runtime } from "../../generated/index.js";
|
|
5
|
+
export function client(o = {}) {
|
|
6
|
+
return new Runtime({ ...(o.apiKey ? { apiKey: o.apiKey } : {}), ...(o.baseUrl ? { baseUrl: o.baseUrl } : {}) });
|
|
7
|
+
}
|
|
8
|
+
/** A shell command run as the rivals run theirs: text in bash, a login shell (the API's own `cmd`), a list as argv. */
|
|
9
|
+
export function shell(cmd) {
|
|
10
|
+
return cmd;
|
|
11
|
+
}
|
|
12
|
+
const enc = new TextEncoder();
|
|
13
|
+
const dec = new TextDecoder();
|
|
14
|
+
export function bytes(data) {
|
|
15
|
+
if (typeof data === "string")
|
|
16
|
+
return enc.encode(data);
|
|
17
|
+
if (data instanceof Uint8Array)
|
|
18
|
+
return data;
|
|
19
|
+
if (ArrayBuffer.isView(data))
|
|
20
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
21
|
+
return new Uint8Array(data);
|
|
22
|
+
}
|
|
23
|
+
export const text = (b) => dec.decode(b);
|
|
24
|
+
export function base64(data) {
|
|
25
|
+
const b = bytes(data);
|
|
26
|
+
let s = "";
|
|
27
|
+
for (const c of b)
|
|
28
|
+
s += String.fromCharCode(c);
|
|
29
|
+
return btoa(s);
|
|
30
|
+
}
|
|
31
|
+
/** A command's run: its cmd, directory, environment, input and time limit. */
|
|
32
|
+
export async function run(k, id, cmd, o = {}) {
|
|
33
|
+
const p = await k.sandboxes.exec(id, {
|
|
34
|
+
cmd,
|
|
35
|
+
...(o.cwd ? { cwd: o.cwd } : {}),
|
|
36
|
+
...(o.env ? { env: o.env } : {}),
|
|
37
|
+
...(o.stdin !== undefined ? { stdin: base64(o.stdin) } : {}),
|
|
38
|
+
...(o.timeoutMs ? { timeoutSeconds: o.timeoutMs / 1000 } : {}),
|
|
39
|
+
});
|
|
40
|
+
return { ...p, stdout: p.stdout ?? "", stderr: p.stderr ?? "" };
|
|
41
|
+
}
|
|
42
|
+
/** The entries of a folder, by one `ls`-free listing every Linux has: name, type, size, time. */
|
|
43
|
+
export async function list(k, id, path) {
|
|
44
|
+
const r = await run(k, id, ["find", path, "-mindepth", "1", "-maxdepth", "1", "-printf", "%f\\t%y\\t%s\\t%T@\\n"]);
|
|
45
|
+
if (r.exitCode !== 0)
|
|
46
|
+
throw new Error(r.stderr.trim() || `cannot list ${path}`);
|
|
47
|
+
return r.stdout
|
|
48
|
+
.split("\n")
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.map((l) => {
|
|
51
|
+
const [name = "", y, size, t] = l.split("\t");
|
|
52
|
+
return { name, path: `${path.replace(/\/$/, "")}/${name}`, type: y === "d" ? "dir" : "file", size: Number(size), modifiedTime: new Date(Number(t) * 1000) };
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type RuntimeOptions } from "./base.js";
|
|
2
|
+
export interface ProcessResult {
|
|
3
|
+
name: string;
|
|
4
|
+
exitCode: number;
|
|
5
|
+
status: "completed" | "failed";
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
logs: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class SandboxInstance {
|
|
11
|
+
private readonly k;
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly metadata: {
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
readonly process: {
|
|
17
|
+
exec(p: {
|
|
18
|
+
command: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
workingDir?: string;
|
|
21
|
+
env?: Record<string, string>;
|
|
22
|
+
waitForCompletion?: boolean;
|
|
23
|
+
timeout?: number;
|
|
24
|
+
}): Promise<ProcessResult>;
|
|
25
|
+
};
|
|
26
|
+
readonly fs: {
|
|
27
|
+
write(path: string, content: string | Uint8Array): Promise<void>;
|
|
28
|
+
read(path: string): Promise<string>;
|
|
29
|
+
ls(path: string): Promise<{
|
|
30
|
+
files: {
|
|
31
|
+
name: string;
|
|
32
|
+
path: string;
|
|
33
|
+
size: number;
|
|
34
|
+
}[];
|
|
35
|
+
subdirectories: {
|
|
36
|
+
name: string;
|
|
37
|
+
path: string;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
rm(path: string, recursive?: boolean): Promise<void>;
|
|
41
|
+
mkdir(path: string): Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
private constructor();
|
|
44
|
+
/** Blaxel names a sandbox; the name finds it again. */
|
|
45
|
+
static create(p?: RuntimeOptions & {
|
|
46
|
+
name?: string;
|
|
47
|
+
image?: string;
|
|
48
|
+
memory?: number;
|
|
49
|
+
labels?: Record<string, string>;
|
|
50
|
+
}): Promise<SandboxInstance>;
|
|
51
|
+
static createIfNotExists(p: RuntimeOptions & {
|
|
52
|
+
name: string;
|
|
53
|
+
image?: string;
|
|
54
|
+
memory?: number;
|
|
55
|
+
}): Promise<SandboxInstance>;
|
|
56
|
+
static get(nameOrId: string, o?: RuntimeOptions): Promise<SandboxInstance>;
|
|
57
|
+
previewUrl(port: number): Promise<string>;
|
|
58
|
+
delete(): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
export default SandboxInstance;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* withruntime/blaxel: Blaxel's SandboxInstance on Runtime. Change the import from
|
|
2
|
+
"@blaxel/core" to "withruntime/blaxel"; RUNTIME_API_KEY replaces BL_API_KEY. */
|
|
3
|
+
import { bytes, client, list, run, text } from "./base.js";
|
|
4
|
+
export class SandboxInstance {
|
|
5
|
+
k;
|
|
6
|
+
id;
|
|
7
|
+
metadata;
|
|
8
|
+
process;
|
|
9
|
+
fs;
|
|
10
|
+
constructor(k, id, metadata) {
|
|
11
|
+
this.k = k;
|
|
12
|
+
this.id = id;
|
|
13
|
+
this.metadata = metadata;
|
|
14
|
+
this.process = {
|
|
15
|
+
async exec(p) {
|
|
16
|
+
const r = await run(k, id, p.command, { cwd: p.workingDir, env: p.env, timeoutMs: p.timeout ? p.timeout * 1000 : undefined });
|
|
17
|
+
const exitCode = r.exitCode ?? -1;
|
|
18
|
+
return { name: p.name ?? "", exitCode, status: exitCode === 0 ? "completed" : "failed", stdout: r.stdout, stderr: r.stderr, logs: r.stdout + r.stderr };
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
this.fs = {
|
|
22
|
+
async write(path, content) {
|
|
23
|
+
await k.sandboxes.write(id, bytes(content), { path });
|
|
24
|
+
},
|
|
25
|
+
async read(path) {
|
|
26
|
+
return text(await k.sandboxes.read(id, { path }));
|
|
27
|
+
},
|
|
28
|
+
async ls(path) {
|
|
29
|
+
const all = await list(k, id, path);
|
|
30
|
+
return {
|
|
31
|
+
files: all.filter((e) => e.type === "file").map((e) => ({ name: e.name, path: e.path, size: e.size })),
|
|
32
|
+
subdirectories: all.filter((e) => e.type === "dir").map((e) => ({ name: e.name, path: e.path })),
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
async rm(path, recursive = false) {
|
|
36
|
+
await k.sandboxes.remove(id, { path, recursive });
|
|
37
|
+
},
|
|
38
|
+
async mkdir(path) {
|
|
39
|
+
await run(k, id, ["mkdir", "-p", path]);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Blaxel names a sandbox; the name finds it again. */
|
|
44
|
+
static async create(p = {}) {
|
|
45
|
+
const k = client(p);
|
|
46
|
+
const s = await k.sandboxes.create({
|
|
47
|
+
...(p.name ? { name: p.name } : {}),
|
|
48
|
+
...(p.image ? { image: p.image } : {}),
|
|
49
|
+
...(p.memory ? { memoryGB: p.memory / 1024 } : {}),
|
|
50
|
+
...(p.labels ? { labels: p.labels } : {}),
|
|
51
|
+
});
|
|
52
|
+
return new SandboxInstance(k, s.id, { name: s.info.name ?? s.id });
|
|
53
|
+
}
|
|
54
|
+
static async createIfNotExists(p) {
|
|
55
|
+
const k = client(p);
|
|
56
|
+
const s = await k.sandboxes.create({ name: p.name, getOrCreate: true, ...(p.image ? { image: p.image } : {}), ...(p.memory ? { memoryGB: p.memory / 1024 } : {}) });
|
|
57
|
+
return new SandboxInstance(k, s.id, { name: s.info.name ?? s.id });
|
|
58
|
+
}
|
|
59
|
+
static async get(nameOrId, o = {}) {
|
|
60
|
+
const k = client(o);
|
|
61
|
+
const s = await k.sandboxes.create({ name: nameOrId, getOrCreate: true }).catch(() => k.sandboxes.get(nameOrId));
|
|
62
|
+
return new SandboxInstance(k, s.id, { name: s.info.name ?? s.id });
|
|
63
|
+
}
|
|
64
|
+
async previewUrl(port) {
|
|
65
|
+
return (await this.k.previews.create(this.id, { port, visibility: "public" })).info.url;
|
|
66
|
+
}
|
|
67
|
+
async delete() {
|
|
68
|
+
await this.k.sandboxes.delete(this.id);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export default SandboxInstance;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Runtime } from "../../generated/index.js";
|
|
2
|
+
import { type RuntimeOptions } from "./base.js";
|
|
3
|
+
export interface ExecResult {
|
|
4
|
+
success: boolean;
|
|
5
|
+
exitCode: number;
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class RuntimeSandbox {
|
|
10
|
+
#private;
|
|
11
|
+
private readonly k;
|
|
12
|
+
private readonly name;
|
|
13
|
+
constructor(k: Runtime, name: string);
|
|
14
|
+
private id;
|
|
15
|
+
exec(command: string, o?: {
|
|
16
|
+
cwd?: string;
|
|
17
|
+
env?: Record<string, string>;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
}): Promise<ExecResult>;
|
|
20
|
+
writeFile(path: string, content: string, o?: {
|
|
21
|
+
encoding?: "base64" | "utf-8";
|
|
22
|
+
}): Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
path: string;
|
|
25
|
+
}>;
|
|
26
|
+
readFile(path: string): Promise<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
path: string;
|
|
29
|
+
content: string;
|
|
30
|
+
}>;
|
|
31
|
+
mkdir(path: string): Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
deleteFile(path: string): Promise<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
exposePort(port: number): Promise<{
|
|
38
|
+
url: string;
|
|
39
|
+
port: number;
|
|
40
|
+
}>;
|
|
41
|
+
destroy(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/** The binding argument is the Worker's old Sandbox namespace and is not used: the
|
|
44
|
+
* key is `options.apiKey`, else the RUNTIME_API_KEY secret. */
|
|
45
|
+
export declare function getSandbox(binding: unknown, id: string, options?: RuntimeOptions & {
|
|
46
|
+
env?: {
|
|
47
|
+
RUNTIME_API_KEY?: string;
|
|
48
|
+
};
|
|
49
|
+
}): RuntimeSandbox;
|
|
50
|
+
/** Kept so `export { Sandbox } from "@cloudflare/sandbox"` in a Worker still resolves. */
|
|
51
|
+
export declare class Sandbox {
|
|
52
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* withruntime/cloudflare: Cloudflare's Sandbox SDK on Runtime, in a Worker. Change
|
|
2
|
+
the import from "@cloudflare/sandbox" to "withruntime/cloudflare", delete the
|
|
3
|
+
wrangler `containers` block and add a RUNTIME_API_KEY secret. getSandbox's id
|
|
4
|
+
names the sandbox: the same id is the same sandbox. */
|
|
5
|
+
import { bytes, client, run, text } from "./base.js";
|
|
6
|
+
export class RuntimeSandbox {
|
|
7
|
+
k;
|
|
8
|
+
name;
|
|
9
|
+
#id;
|
|
10
|
+
constructor(k, name) {
|
|
11
|
+
this.k = k;
|
|
12
|
+
this.name = name;
|
|
13
|
+
}
|
|
14
|
+
id() {
|
|
15
|
+
this.#id ??= this.k.sandboxes.create({ name: this.name, getOrCreate: true }).then((s) => s.id);
|
|
16
|
+
return this.#id;
|
|
17
|
+
}
|
|
18
|
+
async exec(command, o = {}) {
|
|
19
|
+
const r = await run(this.k, await this.id(), command, { cwd: o.cwd, env: o.env, timeoutMs: o.timeout });
|
|
20
|
+
const exitCode = r.exitCode ?? -1;
|
|
21
|
+
return { success: exitCode === 0, exitCode, stdout: r.stdout, stderr: r.stderr };
|
|
22
|
+
}
|
|
23
|
+
async writeFile(path, content, o = {}) {
|
|
24
|
+
const data = o.encoding === "base64" ? Uint8Array.from(atob(content), (c) => c.charCodeAt(0)) : bytes(content);
|
|
25
|
+
await this.k.sandboxes.write(await this.id(), data, { path });
|
|
26
|
+
return { success: true, path };
|
|
27
|
+
}
|
|
28
|
+
async readFile(path) {
|
|
29
|
+
return { success: true, path, content: text(await this.k.sandboxes.read(await this.id(), { path })) };
|
|
30
|
+
}
|
|
31
|
+
async mkdir(path) {
|
|
32
|
+
return { success: (await run(this.k, await this.id(), ["mkdir", "-p", path])).exitCode === 0 };
|
|
33
|
+
}
|
|
34
|
+
async deleteFile(path) {
|
|
35
|
+
await this.k.sandboxes.remove(await this.id(), { path });
|
|
36
|
+
return { success: true };
|
|
37
|
+
}
|
|
38
|
+
async exposePort(port) {
|
|
39
|
+
const p = await this.k.previews.create(await this.id(), { port, visibility: "public" });
|
|
40
|
+
return { url: p.info.url, port };
|
|
41
|
+
}
|
|
42
|
+
async destroy() {
|
|
43
|
+
await this.k.sandboxes.delete(await this.id());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** The binding argument is the Worker's old Sandbox namespace and is not used: the
|
|
47
|
+
* key is `options.apiKey`, else the RUNTIME_API_KEY secret. */
|
|
48
|
+
export function getSandbox(binding, id, options = {}) {
|
|
49
|
+
const fromBinding = binding?.RUNTIME_API_KEY;
|
|
50
|
+
const apiKey = options.apiKey ?? options.env?.RUNTIME_API_KEY ?? fromBinding;
|
|
51
|
+
return new RuntimeSandbox(client({ ...options, ...(apiKey ? { apiKey } : {}) }), id);
|
|
52
|
+
}
|
|
53
|
+
/** Kept so `export { Sandbox } from "@cloudflare/sandbox"` in a Worker still resolves. */
|
|
54
|
+
export class Sandbox {
|
|
55
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Runtime } from "../../generated/index.js";
|
|
2
|
+
import { type RuntimeOptions } from "./base.js";
|
|
3
|
+
export interface ExecuteResponse {
|
|
4
|
+
exitCode: number;
|
|
5
|
+
result: string;
|
|
6
|
+
artifacts: {
|
|
7
|
+
stdout: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface CreateSandboxParams {
|
|
11
|
+
image?: string;
|
|
12
|
+
envVars?: Record<string, string>;
|
|
13
|
+
labels?: Record<string, string>;
|
|
14
|
+
resources?: {
|
|
15
|
+
cpu?: number;
|
|
16
|
+
memory?: number;
|
|
17
|
+
disk?: number;
|
|
18
|
+
};
|
|
19
|
+
autoStopInterval?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class Sandbox {
|
|
22
|
+
private readonly k;
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly process: {
|
|
25
|
+
executeCommand(command: string, cwd?: string, env?: Record<string, string>, timeout?: number): Promise<ExecuteResponse>;
|
|
26
|
+
};
|
|
27
|
+
readonly fs: {
|
|
28
|
+
uploadFile(file: Uint8Array | string, remotePath: string): Promise<void>;
|
|
29
|
+
downloadFile(remotePath: string): Promise<Uint8Array>;
|
|
30
|
+
listFiles(path: string): Promise<{
|
|
31
|
+
name: string;
|
|
32
|
+
isDir: boolean;
|
|
33
|
+
size: number;
|
|
34
|
+
modTime: string;
|
|
35
|
+
}[]>;
|
|
36
|
+
deleteFile(path: string): Promise<void>;
|
|
37
|
+
createFolder(path: string, mode?: string): Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
constructor(k: Runtime, id: string, envVars?: Record<string, string>);
|
|
40
|
+
getPreviewLink(port: number): Promise<{
|
|
41
|
+
url: string;
|
|
42
|
+
token: string;
|
|
43
|
+
}>;
|
|
44
|
+
start(): Promise<void>;
|
|
45
|
+
stop(): Promise<void>;
|
|
46
|
+
delete(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export declare class Daytona {
|
|
49
|
+
#private;
|
|
50
|
+
constructor(config?: RuntimeOptions & {
|
|
51
|
+
apiUrl?: string;
|
|
52
|
+
});
|
|
53
|
+
create(params?: CreateSandboxParams): Promise<Sandbox>;
|
|
54
|
+
get(id: string): Promise<Sandbox>;
|
|
55
|
+
list(): Promise<Sandbox[]>;
|
|
56
|
+
delete(sandbox: Sandbox): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
export default Daytona;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* withruntime/daytona: Daytona's client on Runtime. Change the import from
|
|
2
|
+
"@daytonaio/sdk" to "withruntime/daytona"; RUNTIME_API_KEY replaces DAYTONA_API_KEY. */
|
|
3
|
+
import { bytes, client, list, run } from "./base.js";
|
|
4
|
+
export class Sandbox {
|
|
5
|
+
k;
|
|
6
|
+
id;
|
|
7
|
+
process;
|
|
8
|
+
fs;
|
|
9
|
+
constructor(k, id, envVars = {}) {
|
|
10
|
+
this.k = k;
|
|
11
|
+
this.id = id;
|
|
12
|
+
this.process = {
|
|
13
|
+
async executeCommand(command, cwd, env, timeout) {
|
|
14
|
+
const r = await run(k, id, command, { cwd, env: { ...envVars, ...env }, timeoutMs: timeout ? timeout * 1000 : undefined });
|
|
15
|
+
const result = r.stdout + r.stderr;
|
|
16
|
+
return { exitCode: r.exitCode ?? -1, result, artifacts: { stdout: result } };
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
this.fs = {
|
|
20
|
+
async uploadFile(file, remotePath) {
|
|
21
|
+
await k.sandboxes.write(id, bytes(file), { path: remotePath });
|
|
22
|
+
},
|
|
23
|
+
downloadFile: (remotePath) => k.sandboxes.read(id, { path: remotePath }),
|
|
24
|
+
async listFiles(path) {
|
|
25
|
+
return (await list(k, id, path)).map((e) => ({ name: e.name, isDir: e.type === "dir", size: e.size, modTime: e.modifiedTime.toISOString() }));
|
|
26
|
+
},
|
|
27
|
+
async deleteFile(path) {
|
|
28
|
+
await k.sandboxes.remove(id, { path, recursive: true });
|
|
29
|
+
},
|
|
30
|
+
async createFolder(path, mode) {
|
|
31
|
+
await run(k, id, ["mkdir", "-p", ...(mode ? ["-m", mode] : []), path]);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async getPreviewLink(port) {
|
|
36
|
+
const p = await this.k.previews.create(this.id, { port });
|
|
37
|
+
return { url: p.info.url, token: p.info.token ?? "" };
|
|
38
|
+
}
|
|
39
|
+
async start() {
|
|
40
|
+
await this.k.sandboxes.resume(this.id);
|
|
41
|
+
}
|
|
42
|
+
async stop() {
|
|
43
|
+
await this.k.sandboxes.pause(this.id);
|
|
44
|
+
}
|
|
45
|
+
async delete() {
|
|
46
|
+
await this.k.sandboxes.delete(this.id);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export class Daytona {
|
|
50
|
+
#k;
|
|
51
|
+
constructor(config = {}) {
|
|
52
|
+
this.#k = client(config);
|
|
53
|
+
}
|
|
54
|
+
async create(params = {}) {
|
|
55
|
+
const s = await this.#k.sandboxes.create({
|
|
56
|
+
...(params.image ? { image: params.image } : {}),
|
|
57
|
+
...(params.labels ? { labels: params.labels } : {}),
|
|
58
|
+
...(params.resources?.cpu ? { vcpu: params.resources.cpu } : {}),
|
|
59
|
+
...(params.resources?.memory ? { memoryMiB: params.resources.memory * 1024 } : {}),
|
|
60
|
+
...(params.resources?.disk ? { diskMiB: params.resources.disk * 1024 } : {}),
|
|
61
|
+
});
|
|
62
|
+
return new Sandbox(this.#k, s.id, params.envVars);
|
|
63
|
+
}
|
|
64
|
+
async get(id) {
|
|
65
|
+
return new Sandbox(this.#k, (await this.#k.sandboxes.get(id)).id);
|
|
66
|
+
}
|
|
67
|
+
async list() {
|
|
68
|
+
return (await this.#k.sandboxes.list()).items.map((s) => new Sandbox(this.#k, s.id));
|
|
69
|
+
}
|
|
70
|
+
async delete(sandbox) {
|
|
71
|
+
await sandbox.delete();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export default Daytona;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { type RuntimeOptions } from "./base.js";
|
|
2
|
+
export interface SandboxOpts extends RuntimeOptions {
|
|
3
|
+
/** Milliseconds it lives; E2B's default is 300000. */
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
metadata?: Record<string, string>;
|
|
6
|
+
envs?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export interface CommandResult {
|
|
9
|
+
stdout: string;
|
|
10
|
+
stderr: string;
|
|
11
|
+
exitCode: number;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CommandOpts {
|
|
15
|
+
cwd?: string;
|
|
16
|
+
envs?: Record<string, string>;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
/** Called with each piece of standard output as it is written. */
|
|
19
|
+
onStdout?: (data: string) => void;
|
|
20
|
+
/** Called with each piece of standard error as it is written. */
|
|
21
|
+
onStderr?: (data: string) => void;
|
|
22
|
+
/** Returns at once with a handle to the running command. */
|
|
23
|
+
background?: boolean;
|
|
24
|
+
stdin?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** E2B throws this for a command that exits non-zero. */
|
|
27
|
+
export declare class CommandExitError extends Error implements CommandResult {
|
|
28
|
+
readonly stdout: string;
|
|
29
|
+
readonly stderr: string;
|
|
30
|
+
readonly exitCode: number;
|
|
31
|
+
constructor(stdout: string, stderr: string, exitCode: number);
|
|
32
|
+
}
|
|
33
|
+
export interface EntryInfo {
|
|
34
|
+
name: string;
|
|
35
|
+
path: string;
|
|
36
|
+
type: "file" | "dir";
|
|
37
|
+
size: number;
|
|
38
|
+
modifiedTime: Date;
|
|
39
|
+
}
|
|
40
|
+
/** A command running in the background: E2B's CommandHandle. */
|
|
41
|
+
export declare class CommandHandle {
|
|
42
|
+
#private;
|
|
43
|
+
readonly pid: string;
|
|
44
|
+
private readonly kill_;
|
|
45
|
+
private readonly input;
|
|
46
|
+
constructor(pid: string, done: Promise<CommandResult>, kill_: () => Promise<boolean>, input: (data: string) => Promise<void>);
|
|
47
|
+
/** Waits for it to end; throws CommandExitError for a non-zero exit, as E2B does. */
|
|
48
|
+
wait(): Promise<CommandResult>;
|
|
49
|
+
kill(): Promise<boolean>;
|
|
50
|
+
sendStdin(data: string): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
/** One run of runCode: E2B's Execution, its output as text and lines. */
|
|
53
|
+
export interface Execution {
|
|
54
|
+
text: string | undefined;
|
|
55
|
+
results: {
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
logs: {
|
|
59
|
+
stdout: string[];
|
|
60
|
+
stderr: string[];
|
|
61
|
+
};
|
|
62
|
+
error: {
|
|
63
|
+
name: string;
|
|
64
|
+
value: string;
|
|
65
|
+
traceback: string;
|
|
66
|
+
} | undefined;
|
|
67
|
+
}
|
|
68
|
+
export interface SandboxInfoE2B {
|
|
69
|
+
sandboxId: string;
|
|
70
|
+
templateId: string;
|
|
71
|
+
name?: string;
|
|
72
|
+
metadata: Record<string, string>;
|
|
73
|
+
startedAt: Date;
|
|
74
|
+
state: "running" | "paused";
|
|
75
|
+
}
|
|
76
|
+
/** Sandbox.list's pages: E2B's SandboxPaginator. */
|
|
77
|
+
export declare class SandboxPaginator {
|
|
78
|
+
#private;
|
|
79
|
+
private readonly o;
|
|
80
|
+
constructor(o: SandboxOpts & {
|
|
81
|
+
limit?: number;
|
|
82
|
+
});
|
|
83
|
+
get hasNext(): boolean;
|
|
84
|
+
nextItems(): Promise<SandboxInfoE2B[]>;
|
|
85
|
+
}
|
|
86
|
+
export declare class Sandbox {
|
|
87
|
+
private readonly rt;
|
|
88
|
+
private readonly sbx;
|
|
89
|
+
readonly commands: {
|
|
90
|
+
run(cmd: string, opts: CommandOpts & {
|
|
91
|
+
background: true;
|
|
92
|
+
}): Promise<CommandHandle>;
|
|
93
|
+
run(cmd: string, opts?: CommandOpts): Promise<CommandResult>;
|
|
94
|
+
kill(pid: string): Promise<boolean>;
|
|
95
|
+
};
|
|
96
|
+
readonly files: {
|
|
97
|
+
write(path: string, data: string | ArrayBuffer | Uint8Array): Promise<{
|
|
98
|
+
path: string;
|
|
99
|
+
name: string;
|
|
100
|
+
}>;
|
|
101
|
+
read(path: string, opts?: {
|
|
102
|
+
format?: "text" | "bytes";
|
|
103
|
+
}): Promise<string>;
|
|
104
|
+
list(path: string): Promise<EntryInfo[]>;
|
|
105
|
+
remove(path: string): Promise<void>;
|
|
106
|
+
exists(path: string): Promise<boolean>;
|
|
107
|
+
makeDir(path: string): Promise<boolean>;
|
|
108
|
+
};
|
|
109
|
+
private constructor();
|
|
110
|
+
get sandboxId(): string;
|
|
111
|
+
static create(templateOrOpts?: string | SandboxOpts, maybe?: SandboxOpts): Promise<Sandbox>;
|
|
112
|
+
static connect(sandboxId: string, o?: RuntimeOptions): Promise<Sandbox>;
|
|
113
|
+
static kill(sandboxId: string, o?: RuntimeOptions): Promise<boolean>;
|
|
114
|
+
/** The org's sandboxes, a page at a time: E2B's paginator. */
|
|
115
|
+
static list(o?: SandboxOpts & {
|
|
116
|
+
limit?: number;
|
|
117
|
+
}): SandboxPaginator;
|
|
118
|
+
/** Taken and does nothing: a Runtime sandbox has no time limit; it pauses when idle and lives until deleted. */
|
|
119
|
+
static setTimeout(_sandboxId: string, _timeoutMs: number, _o?: RuntimeOptions): Promise<void>;
|
|
120
|
+
/** Taken and does nothing: a Runtime sandbox has no time limit; it pauses when idle and lives until deleted. */
|
|
121
|
+
setTimeout(_timeoutMs: number): Promise<void>;
|
|
122
|
+
getInfo(): Promise<SandboxInfoE2B>;
|
|
123
|
+
/** Runs code (Python by default; js, ts, bash) and returns its output. Each
|
|
124
|
+
* run is a fresh interpreter: variables do not carry between runs. */
|
|
125
|
+
runCode(code: string, o?: {
|
|
126
|
+
language?: string;
|
|
127
|
+
envs?: Record<string, string>;
|
|
128
|
+
timeoutMs?: number;
|
|
129
|
+
onStdout?: (d: {
|
|
130
|
+
line: string;
|
|
131
|
+
}) => void;
|
|
132
|
+
onStderr?: (d: {
|
|
133
|
+
line: string;
|
|
134
|
+
}) => void;
|
|
135
|
+
}): Promise<Execution>;
|
|
136
|
+
/** The host a port is served at: a preview of it. */
|
|
137
|
+
getHost(port: number): Promise<string>;
|
|
138
|
+
isRunning(): Promise<boolean>;
|
|
139
|
+
pause(): Promise<boolean>;
|
|
140
|
+
kill(): Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
export default Sandbox;
|