withruntime 0.50.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 -585
- 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
package/dist/ssh.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { Runtime } from "./client.js";
|
|
2
|
-
import type { Sandbox } from "./sandbox.js";
|
|
3
|
-
type Out = {
|
|
4
|
-
json: boolean;
|
|
5
|
-
write: (text: string) => void;
|
|
6
|
-
error: (text: string) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const SSH_HELP: (me: string) => string;
|
|
9
|
-
/** This machine's key for Runtime SSH logins, made on first use. Only its
|
|
10
|
-
* public half ever leaves the machine, and only into the one login it opens. */
|
|
11
|
-
export declare function sshKey(env: NodeJS.ProcessEnv): Promise<{
|
|
12
|
-
path: string;
|
|
13
|
-
publicKey: string;
|
|
14
|
-
}>;
|
|
15
|
-
/** A sandbox by id or by its name, as `ssh` hands it over (`<id>.runtime`). */
|
|
16
|
-
export declare function resolveSandbox(runtime: Runtime, target: string): Promise<Sandbox>;
|
|
17
|
-
export declare function sshConfig(env: NodeJS.ProcessEnv): Promise<string>;
|
|
18
|
-
export declare function sshCommand(argv: string[], env: NodeJS.ProcessEnv, out: Out, connect: () => Promise<Runtime>, me: string): Promise<number>;
|
|
19
|
-
/** The editors `runtime sandboxes code` opens: each one's command line program
|
|
20
|
-
* and the URL scheme its app registers. All three are VS Code underneath and
|
|
21
|
-
* name an SSH remote the same way, `ssh-remote+<host>`. */
|
|
22
|
-
export declare const EDITORS: {
|
|
23
|
-
readonly vscode: {
|
|
24
|
-
readonly name: "VS Code";
|
|
25
|
-
readonly bin: "code";
|
|
26
|
-
readonly scheme: "vscode";
|
|
27
|
-
};
|
|
28
|
-
readonly cursor: {
|
|
29
|
-
readonly name: "Cursor";
|
|
30
|
-
readonly bin: "cursor";
|
|
31
|
-
readonly scheme: "cursor";
|
|
32
|
-
};
|
|
33
|
-
readonly windsurf: {
|
|
34
|
-
readonly name: "Windsurf";
|
|
35
|
-
readonly bin: "windsurf";
|
|
36
|
-
readonly scheme: "windsurf";
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export type EditorName = keyof typeof EDITORS;
|
|
40
|
-
/** What opens a sandbox's folder in an editor over the `*.runtime` ssh host:
|
|
41
|
-
* the editor's own program and its arguments, or, without the program on the
|
|
42
|
-
* PATH, the link its app answers. */
|
|
43
|
-
export declare function editorLaunch(editor: EditorName, sandboxId: string, path: string): {
|
|
44
|
-
host: string;
|
|
45
|
-
bin: "code" | "cursor" | "windsurf";
|
|
46
|
-
args: string[];
|
|
47
|
-
link: string;
|
|
48
|
-
};
|
|
49
|
-
/** `runtime sandboxes code <id|name> [--editor cursor] [--path /workspace] [--print]`:
|
|
50
|
-
* a sandbox opened in VS Code, Cursor or Windsurf in one step. It makes sure
|
|
51
|
-
* the sandbox has an SSH server and this machine has the `*.runtime` ssh
|
|
52
|
-
* entry, then hands the editor the SSH remote. */
|
|
53
|
-
export declare function editorCommand(argv: string[], env: NodeJS.ProcessEnv, out: Out, connect: () => Promise<Runtime>, me: string): Promise<number>;
|
|
54
|
-
/** `runtime sandboxes port-forward <id> 5432 8080:3000 ...` */
|
|
55
|
-
export declare function portForwardCommand(argv: string[], out: Out, connect: () => Promise<Runtime>, me: string): Promise<number>;
|
|
56
|
-
export {};
|
package/dist/ssh.js
DELETED
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
-
import { realpathSync } from "node:fs";
|
|
3
|
-
import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
|
-
import { isAbsolute, join } from "node:path";
|
|
6
|
-
import { RuntimeError } from "./errors.js";
|
|
7
|
-
import { VERSION } from "./transport.js";
|
|
8
|
-
const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
9
|
-
export const SSH_HELP = (me) => `${me} sandboxes ssh <id|name> [-- <command...>] Log in over SSH (an interactive shell, or run the command)
|
|
10
|
-
${me} sandboxes ssh config [--install] The ssh config for \`ssh <id|name>.runtime\`, also from
|
|
11
|
-
VS Code Remote-SSH and JetBrains Gateway; --install adds
|
|
12
|
-
it to ~/.ssh/config
|
|
13
|
-
${me} sandboxes ssh proxy <id|name>[.runtime] ProxyCommand mode: SSH on stdin and stdout
|
|
14
|
-
${me} sandboxes code <id|name> [--editor vscode|cursor|windsurf] [--path /workspace] [--print]
|
|
15
|
-
Open it in your editor over SSH; installs the ssh config
|
|
16
|
-
above once. --print gives the link instead
|
|
17
|
-
${me} sandboxes port-forward <id|name> <port|local:remote>... [--address 127.0.0.1]
|
|
18
|
-
Forward local ports to ports in the sandbox, until Ctrl-C
|
|
19
|
-
|
|
20
|
-
SSH and port forwarding go through Runtime's API with your key: the sandbox opens
|
|
21
|
-
no port to the internet. The login is the sandbox's user, runtime, with sudo.
|
|
22
|
-
A paused sandbox wakes when you connect, like any command.
|
|
23
|
-
`;
|
|
24
|
-
function configDirectory(env) {
|
|
25
|
-
const root = env.XDG_CONFIG_HOME ?? join(homedir(), ".config");
|
|
26
|
-
if (!isAbsolute(root))
|
|
27
|
-
throw new Error("XDG_CONFIG_HOME must be an absolute path.");
|
|
28
|
-
return join(root, "runtime-cloud");
|
|
29
|
-
}
|
|
30
|
-
/** This machine's key for Runtime SSH logins, made on first use. Only its
|
|
31
|
-
* public half ever leaves the machine, and only into the one login it opens. */
|
|
32
|
-
export async function sshKey(env) {
|
|
33
|
-
const dir = join(configDirectory(env), "ssh");
|
|
34
|
-
const path = join(dir, "id_ed25519");
|
|
35
|
-
try {
|
|
36
|
-
return { path, publicKey: (await readFile(`${path}.pub`, "utf8")).trim() };
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
// Made below.
|
|
40
|
-
}
|
|
41
|
-
await mkdir(dir, { recursive: true, mode: 0o700 });
|
|
42
|
-
await chmod(dir, 0o700);
|
|
43
|
-
const made = spawnSync("ssh-keygen", ["-q", "-t", "ed25519", "-N", "", "-C", "runtime-cloud", "-f", path], {
|
|
44
|
-
stdio: ["ignore", "ignore", "pipe"],
|
|
45
|
-
});
|
|
46
|
-
if (made.error || made.status !== 0)
|
|
47
|
-
throw new RuntimeError({
|
|
48
|
-
message: `Could not make an SSH key with ssh-keygen${made.error ? `: ${made.error.message}` : `: ${made.stderr.toString().trim()}`}.`,
|
|
49
|
-
code: "ssh_keygen_failed",
|
|
50
|
-
status: 0,
|
|
51
|
-
hint: "Install OpenSSH (it has ssh and ssh-keygen), or pass --key with a public key file.",
|
|
52
|
-
});
|
|
53
|
-
return { path, publicKey: (await readFile(`${path}.pub`, "utf8")).trim() };
|
|
54
|
-
}
|
|
55
|
-
/** A sandbox by id or by its name, as `ssh` hands it over (`<id>.runtime`). */
|
|
56
|
-
export async function resolveSandbox(runtime, target) {
|
|
57
|
-
const name = target.replace(/\.runtime$/, "");
|
|
58
|
-
if (UUID.test(name))
|
|
59
|
-
return runtime.sandboxes.get(name);
|
|
60
|
-
const page = await runtime.sandboxes.list({ name, limit: 2 });
|
|
61
|
-
if (page.data.length === 1)
|
|
62
|
-
return page.data[0];
|
|
63
|
-
throw new RuntimeError({
|
|
64
|
-
message: page.data.length
|
|
65
|
-
? `More than one live sandbox is named ${name}.`
|
|
66
|
-
: `No live sandbox is named ${name}.`,
|
|
67
|
-
code: page.data.length ? "ambiguous_name" : "sandbox_not_found",
|
|
68
|
-
status: 0,
|
|
69
|
-
hint: "Use its id: runtime sandboxes ls",
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const quote = (text) => /^[A-Za-z0-9_./:@=-]+$/.test(text) ? text : `'${text.replace(/'/g, "'\\''")}'`;
|
|
73
|
-
/** How ssh should start this CLI again: the same program and script, or npx
|
|
74
|
-
* at this version when it ran from npx's temporary cache. */
|
|
75
|
-
function selfCommand(env) {
|
|
76
|
-
const script = process.argv[1];
|
|
77
|
-
const program = script && !/[\\/]_npx[\\/]/.test(script)
|
|
78
|
-
? [process.execPath, realpathSync(script)]
|
|
79
|
-
: ["npx", "--yes", `withruntime@${VERSION}`];
|
|
80
|
-
const origin = env.RUNTIME_API_URL ? [`RUNTIME_API_URL=${env.RUNTIME_API_URL}`] : [];
|
|
81
|
-
return [...(origin.length ? ["env", ...origin] : []), ...program].map(quote).join(" ");
|
|
82
|
-
}
|
|
83
|
-
export async function sshConfig(env) {
|
|
84
|
-
const { path } = await sshKey(env);
|
|
85
|
-
return `# Runtime Cloud: \`ssh <sandbox id or name>.runtime\`, and the same host in
|
|
86
|
-
# VS Code Remote-SSH or JetBrains Gateway. The connection is Runtime's
|
|
87
|
-
# authenticated tunnel, which already proves which sandbox answers; each login
|
|
88
|
-
# gets a fresh host key, so there is nothing to pin in known_hosts.
|
|
89
|
-
Host *.runtime
|
|
90
|
-
User runtime
|
|
91
|
-
ProxyCommand ${selfCommand(env)} sandbox ssh proxy %h
|
|
92
|
-
IdentityFile "${path}"
|
|
93
|
-
IdentitiesOnly yes
|
|
94
|
-
StrictHostKeyChecking no
|
|
95
|
-
UserKnownHostsFile /dev/null
|
|
96
|
-
LogLevel ERROR
|
|
97
|
-
ServerAliveInterval 30
|
|
98
|
-
`;
|
|
99
|
-
}
|
|
100
|
-
/** Writes the block to its own file and includes it from ~/.ssh/config once. */
|
|
101
|
-
async function installConfig(env) {
|
|
102
|
-
const file = join(configDirectory(env), "ssh", "config");
|
|
103
|
-
await writeFile(file, await sshConfig(env), { mode: 0o600 });
|
|
104
|
-
const sshDir = join(env.HOME || homedir(), ".ssh");
|
|
105
|
-
await mkdir(sshDir, { recursive: true, mode: 0o700 });
|
|
106
|
-
const main = join(sshDir, "config");
|
|
107
|
-
const current = await readFile(main, "utf8").catch(() => "");
|
|
108
|
-
const include = `Include "${file}"`;
|
|
109
|
-
if (!current.split("\n").some((line) => line.trim() === include))
|
|
110
|
-
// First, because ssh reads an Include inside a Host block as part of it.
|
|
111
|
-
await writeFile(main, `${include}\n${current ? `\n${current}` : ""}`, { mode: 0o600 });
|
|
112
|
-
return file;
|
|
113
|
-
}
|
|
114
|
-
/** ProxyCommand mode: ssh speaks on this process's stdin and stdout. */
|
|
115
|
-
async function proxy(runtime, target, publicKey) {
|
|
116
|
-
const sbx = await resolveSandbox(runtime, target);
|
|
117
|
-
const tunnel = await sbx.tunnel();
|
|
118
|
-
const stream = await tunnel.ssh(publicKey).catch((error) => {
|
|
119
|
-
tunnel.close();
|
|
120
|
-
throw error;
|
|
121
|
-
});
|
|
122
|
-
return new Promise(() => {
|
|
123
|
-
// When the sandbox side ends, the session is over: flush what ssh has not
|
|
124
|
-
// read yet, then exit, which is what closes the pipe ssh is reading (an
|
|
125
|
-
// ended process.stdout does not close it on every runtime).
|
|
126
|
-
let leaving = false;
|
|
127
|
-
const leave = (code) => {
|
|
128
|
-
if (leaving)
|
|
129
|
-
return;
|
|
130
|
-
leaving = true;
|
|
131
|
-
tunnel.close();
|
|
132
|
-
process.stdout.write("", () => process.exit(code));
|
|
133
|
-
};
|
|
134
|
-
stream.onData = (data) => void process.stdout.write(data);
|
|
135
|
-
stream.onEnd = () => leave(0);
|
|
136
|
-
stream.onLog = (text) => process.stderr.write(`sandbox sshd: ${text}`);
|
|
137
|
-
stream.onClose = (reason) => {
|
|
138
|
-
if (reason !== "done")
|
|
139
|
-
process.stderr.write(`Runtime: the SSH connection ended (${reason}).\n`);
|
|
140
|
-
leave(reason === "done" ? 0 : 1);
|
|
141
|
-
};
|
|
142
|
-
// Async iteration reads the next chunk only after this one is inside the
|
|
143
|
-
// window: backpressure that behaves the same on Node and Bun.
|
|
144
|
-
void (async () => {
|
|
145
|
-
for await (const data of process.stdin)
|
|
146
|
-
await stream.write(new Uint8Array(data));
|
|
147
|
-
stream.end();
|
|
148
|
-
})().catch(() => stream.close());
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
/** Installs the OpenSSH server in a sandbox that lacks it (an image made
|
|
152
|
-
* before it was in the base image, or a custom one), saying so first. */
|
|
153
|
-
async function ensureSshd(sbx, out) {
|
|
154
|
-
const probe = await sbx.exec(["sh", "-c", "command -v sshd || test -x /usr/sbin/sshd"], {
|
|
155
|
-
timeoutMs: 30_000,
|
|
156
|
-
});
|
|
157
|
-
if (probe.exitCode === 0)
|
|
158
|
-
return;
|
|
159
|
-
out.error("This sandbox has no OpenSSH server yet; installing it once...");
|
|
160
|
-
const installed = await sbx.exec([
|
|
161
|
-
"sh",
|
|
162
|
-
"-c",
|
|
163
|
-
"sudo -n apt-get update -qq && sudo -n env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends openssh-server",
|
|
164
|
-
], { timeoutMs: 300_000 });
|
|
165
|
-
if (installed.exitCode !== 0)
|
|
166
|
-
throw new RuntimeError({
|
|
167
|
-
message: `Installing openssh-server in the sandbox failed: ${(installed.stderr || installed.stdout).trim().slice(-400)}`,
|
|
168
|
-
code: "sshd_missing",
|
|
169
|
-
status: 0,
|
|
170
|
-
hint: "Install an SSH server in the sandbox yourself, or build an image that has one.",
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
export async function sshCommand(argv, env, out, connect, me) {
|
|
174
|
-
const dash = argv.indexOf("--");
|
|
175
|
-
const words = dash === -1 ? argv : argv.slice(0, dash);
|
|
176
|
-
const remote = dash === -1 ? [] : argv.slice(dash + 1);
|
|
177
|
-
const keyAt = words.indexOf("--key");
|
|
178
|
-
const keyFile = keyAt === -1 ? undefined : words[keyAt + 1];
|
|
179
|
-
const positional = words.filter((word, i) => !word.startsWith("--") && (keyAt === -1 || i !== keyAt + 1));
|
|
180
|
-
const [first, second] = positional;
|
|
181
|
-
if (!first || first === "help") {
|
|
182
|
-
out.write(SSH_HELP(me));
|
|
183
|
-
return first ? 0 : 64;
|
|
184
|
-
}
|
|
185
|
-
const publicKey = async () => keyFile ? (await readFile(keyFile, "utf8")).trim() : (await sshKey(env)).publicKey;
|
|
186
|
-
if (first === "config") {
|
|
187
|
-
if (words.includes("--install")) {
|
|
188
|
-
const file = await installConfig(env);
|
|
189
|
-
out.write(out.json
|
|
190
|
-
? JSON.stringify({ installed: file })
|
|
191
|
-
: `Added Include "${file}" to ~/.ssh/config. Connect with: ssh <sandbox id or name>.runtime`);
|
|
192
|
-
}
|
|
193
|
-
else
|
|
194
|
-
out.write(out.json ? JSON.stringify({ config: await sshConfig(env) }) : await sshConfig(env));
|
|
195
|
-
return 0;
|
|
196
|
-
}
|
|
197
|
-
if (first === "proxy") {
|
|
198
|
-
if (!second)
|
|
199
|
-
throw usageError(`Give the host: ${me} sandboxes ssh proxy <id>.runtime`, me);
|
|
200
|
-
return proxy(await connect(), second, await publicKey());
|
|
201
|
-
}
|
|
202
|
-
const runtime = await connect();
|
|
203
|
-
const sbx = await resolveSandbox(runtime, first);
|
|
204
|
-
await ensureSshd(sbx, out);
|
|
205
|
-
const key = keyFile ? undefined : await sshKey(env);
|
|
206
|
-
const args = [
|
|
207
|
-
"-o",
|
|
208
|
-
`ProxyCommand=${selfCommand(env)} sandbox ssh proxy${keyFile ? ` --key ${quote(keyFile)}` : ""} %h`,
|
|
209
|
-
...(key ? ["-i", key.path, "-o", "IdentitiesOnly=yes"] : []),
|
|
210
|
-
"-o",
|
|
211
|
-
"StrictHostKeyChecking=no",
|
|
212
|
-
"-o",
|
|
213
|
-
"UserKnownHostsFile=/dev/null",
|
|
214
|
-
"-o",
|
|
215
|
-
"LogLevel=ERROR",
|
|
216
|
-
"-o",
|
|
217
|
-
"ServerAliveInterval=30",
|
|
218
|
-
...(remote.length ? [] : ["-t"]),
|
|
219
|
-
`runtime@${sbx.id}.runtime`,
|
|
220
|
-
// ssh joins what follows the host into one remote command line.
|
|
221
|
-
...remote,
|
|
222
|
-
];
|
|
223
|
-
return new Promise((resolve, reject) => {
|
|
224
|
-
const child = spawn("ssh", args, { stdio: "inherit" });
|
|
225
|
-
child.on("error", (error) => reject(new RuntimeError({
|
|
226
|
-
message: `Could not run ssh: ${error.message}`,
|
|
227
|
-
code: "ssh_missing",
|
|
228
|
-
status: 0,
|
|
229
|
-
hint: "Install OpenSSH, or use `runtime sandboxes shell <id>`, which needs nothing.",
|
|
230
|
-
})));
|
|
231
|
-
child.on("exit", (code) => resolve(code ?? 255));
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
function usageError(message, me) {
|
|
235
|
-
return new RuntimeError({
|
|
236
|
-
message,
|
|
237
|
-
code: "usage",
|
|
238
|
-
status: 0,
|
|
239
|
-
hint: `Run \`${me} sandboxes ssh help\`.`,
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
/** The editors `runtime sandboxes code` opens: each one's command line program
|
|
243
|
-
* and the URL scheme its app registers. All three are VS Code underneath and
|
|
244
|
-
* name an SSH remote the same way, `ssh-remote+<host>`. */
|
|
245
|
-
export const EDITORS = {
|
|
246
|
-
vscode: { name: "VS Code", bin: "code", scheme: "vscode" },
|
|
247
|
-
cursor: { name: "Cursor", bin: "cursor", scheme: "cursor" },
|
|
248
|
-
windsurf: { name: "Windsurf", bin: "windsurf", scheme: "windsurf" },
|
|
249
|
-
};
|
|
250
|
-
/** What opens a sandbox's folder in an editor over the `*.runtime` ssh host:
|
|
251
|
-
* the editor's own program and its arguments, or, without the program on the
|
|
252
|
-
* PATH, the link its app answers. */
|
|
253
|
-
export function editorLaunch(editor, sandboxId, path) {
|
|
254
|
-
const { bin, scheme } = EDITORS[editor];
|
|
255
|
-
const remote = `ssh-remote+${sandboxId}.runtime`;
|
|
256
|
-
return {
|
|
257
|
-
host: `${sandboxId}.runtime`,
|
|
258
|
-
bin,
|
|
259
|
-
args: ["--remote", remote, path],
|
|
260
|
-
link: `${scheme}://vscode-remote/${remote}${path}`,
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
/** Runs a program, answering whether it started and exited 0; a program
|
|
264
|
-
* missing from the PATH is false, not an error. */
|
|
265
|
-
function launched(bin, args, env) {
|
|
266
|
-
return new Promise((resolve) => {
|
|
267
|
-
const child = spawn(bin, args, {
|
|
268
|
-
env,
|
|
269
|
-
stdio: "ignore",
|
|
270
|
-
// `code` and `cursor` are .cmd scripts on Windows.
|
|
271
|
-
shell: process.platform === "win32",
|
|
272
|
-
});
|
|
273
|
-
child.on("error", () => resolve(false));
|
|
274
|
-
child.on("exit", (code) => resolve(code === 0));
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
/** `runtime sandboxes code <id|name> [--editor cursor] [--path /workspace] [--print]`:
|
|
278
|
-
* a sandbox opened in VS Code, Cursor or Windsurf in one step. It makes sure
|
|
279
|
-
* the sandbox has an SSH server and this machine has the `*.runtime` ssh
|
|
280
|
-
* entry, then hands the editor the SSH remote. */
|
|
281
|
-
export async function editorCommand(argv, env, out, connect, me) {
|
|
282
|
-
const valueOf = (flag) => {
|
|
283
|
-
const at = argv.indexOf(flag);
|
|
284
|
-
return at === -1 ? undefined : argv[at + 1];
|
|
285
|
-
};
|
|
286
|
-
const editor = (valueOf("--editor") ?? "vscode").toLowerCase().replace(/^code$/, "vscode");
|
|
287
|
-
const path = valueOf("--path") ?? "/workspace";
|
|
288
|
-
const valued = new Set(["--editor", "--path"]);
|
|
289
|
-
const [target] = argv.filter((word, i) => !word.startsWith("--") && !valued.has(argv[i - 1] ?? ""));
|
|
290
|
-
if (!target || target === "help") {
|
|
291
|
-
out.write(SSH_HELP(me));
|
|
292
|
-
return target ? 0 : 64;
|
|
293
|
-
}
|
|
294
|
-
if (!(editor in EDITORS))
|
|
295
|
-
throw new RuntimeError({
|
|
296
|
-
message: `${editor} is not an editor this opens.`,
|
|
297
|
-
code: "usage",
|
|
298
|
-
status: 0,
|
|
299
|
-
hint: `Use --editor ${Object.keys(EDITORS).join(", --editor ")}; JetBrains Gateway connects to <id>.runtime after \`${me} sandboxes ssh config --install\`.`,
|
|
300
|
-
});
|
|
301
|
-
if (!path.startsWith("/"))
|
|
302
|
-
throw usageError(`--path is a folder in the sandbox, from /: ${path}`, me);
|
|
303
|
-
const sbx = await resolveSandbox(await connect(), target);
|
|
304
|
-
await ensureSshd(sbx, out);
|
|
305
|
-
await installConfig(env);
|
|
306
|
-
const how = editorLaunch(editor, sbx.id, path);
|
|
307
|
-
const { name } = EDITORS[editor];
|
|
308
|
-
const print = argv.includes("--print");
|
|
309
|
-
// Without the editor's program on the PATH (VS Code's `code` is opt-in on a
|
|
310
|
-
// Mac), the desktop opens the editor's link.
|
|
311
|
-
const [opener, ...openerArgs] = process.platform === "darwin"
|
|
312
|
-
? ["open", how.link]
|
|
313
|
-
: process.platform === "win32"
|
|
314
|
-
? ["cmd", "/c", "start", '""', how.link]
|
|
315
|
-
: ["xdg-open", how.link];
|
|
316
|
-
const opened = print
|
|
317
|
-
? false
|
|
318
|
-
: (await launched(how.bin, how.args, env))
|
|
319
|
-
? "program"
|
|
320
|
-
: (await launched(opener, openerArgs, env))
|
|
321
|
-
? "link"
|
|
322
|
-
: false;
|
|
323
|
-
if (out.json)
|
|
324
|
-
out.write(JSON.stringify({ sandboxId: sbx.id, editor, host: how.host, path, link: how.link, opened }));
|
|
325
|
-
else if (opened)
|
|
326
|
-
out.write(`Opening ${path} of ${sbx.id} in ${name} over SSH (host ${how.host}). It needs ${name === "VS Code" ? "the Remote - SSH extension" : "its Remote - SSH extension"}; the first connection installs the editor's server in the sandbox.`);
|
|
327
|
-
else
|
|
328
|
-
out.write(`${print ? "" : `Could not start ${how.bin} or open a link here. `}Open this link on this machine:\n${how.link}\nor run: ${how.bin} ${how.args.join(" ")}`);
|
|
329
|
-
return opened || print ? 0 : 1;
|
|
330
|
-
}
|
|
331
|
-
/** `runtime sandboxes port-forward <id> 5432 8080:3000 ...` */
|
|
332
|
-
export async function portForwardCommand(argv, out, connect, me) {
|
|
333
|
-
const at = argv.indexOf("--address");
|
|
334
|
-
const address = at === -1 ? "127.0.0.1" : argv[at + 1];
|
|
335
|
-
const positional = argv.filter((word, i) => !word.startsWith("--") && (at === -1 || i !== at + 1));
|
|
336
|
-
const [target, ...specs] = positional;
|
|
337
|
-
if (!target || !specs.length || !address)
|
|
338
|
-
throw new RuntimeError({
|
|
339
|
-
message: `Give a sandbox and at least one port: ${me} sandboxes port-forward <id> 5432 8080:3000`,
|
|
340
|
-
code: "usage",
|
|
341
|
-
status: 0,
|
|
342
|
-
hint: `Run \`${me} sandboxes ssh help\`.`,
|
|
343
|
-
});
|
|
344
|
-
const ports = specs.map((spec) => {
|
|
345
|
-
const match = /^(?:(\d{1,5}):)?(\d{1,5})$/.exec(spec);
|
|
346
|
-
const remote = Number(match?.[2]);
|
|
347
|
-
const local = match?.[1] === undefined ? remote : Number(match[1]);
|
|
348
|
-
if (!match || remote < 1 || remote > 65_535 || local > 65_535)
|
|
349
|
-
throw new RuntimeError({
|
|
350
|
-
message: `${spec} is not a port or local:remote pair.`,
|
|
351
|
-
code: "usage",
|
|
352
|
-
status: 0,
|
|
353
|
-
hint: "For example 5432, or 15432:5432 to listen on 15432 here.",
|
|
354
|
-
});
|
|
355
|
-
return { local, remote };
|
|
356
|
-
});
|
|
357
|
-
const sbx = await resolveSandbox(await connect(), target);
|
|
358
|
-
const tunnel = await sbx.tunnel();
|
|
359
|
-
const forwards = [];
|
|
360
|
-
/* A connection the sandbox refused is closed at once, which a browser or
|
|
361
|
-
curl reports only as an empty reply, so say why here, once per reason. */
|
|
362
|
-
const said = new Set();
|
|
363
|
-
const refused = (remote) => (error) => {
|
|
364
|
-
const line = `Port ${remote}: ${error.message}${error.hint ? ` ${error.hint}` : ""}`;
|
|
365
|
-
if (said.has(line))
|
|
366
|
-
return;
|
|
367
|
-
said.add(line);
|
|
368
|
-
out.error(out.json
|
|
369
|
-
? JSON.stringify({ port: remote, error: { code: error.code, message: error.message } })
|
|
370
|
-
: line);
|
|
371
|
-
};
|
|
372
|
-
try {
|
|
373
|
-
for (const { local, remote } of ports)
|
|
374
|
-
forwards.push(await tunnel.forward(remote, { localPort: local, host: address, onError: refused(remote) }));
|
|
375
|
-
}
|
|
376
|
-
catch (error) {
|
|
377
|
-
tunnel.close();
|
|
378
|
-
throw new RuntimeError({
|
|
379
|
-
message: `Could not listen here: ${error instanceof Error ? error.message : String(error)}`,
|
|
380
|
-
code: "listen_failed",
|
|
381
|
-
status: 0,
|
|
382
|
-
hint: "Pick another local port with local:remote, for example 15432:5432.",
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
out.write(out.json
|
|
386
|
-
? JSON.stringify({
|
|
387
|
-
sandboxId: sbx.id,
|
|
388
|
-
forwarding: forwards.map((f) => ({
|
|
389
|
-
address: f.host,
|
|
390
|
-
localPort: f.localPort,
|
|
391
|
-
port: f.port,
|
|
392
|
-
})),
|
|
393
|
-
})
|
|
394
|
-
: forwards
|
|
395
|
-
.map((f) => `Forwarding ${f.host}:${f.localPort} -> sandbox ${sbx.id} port ${f.port}`)
|
|
396
|
-
.join("\n") + "\nPress Ctrl-C to stop.");
|
|
397
|
-
return new Promise((resolve) => {
|
|
398
|
-
let stopping = false;
|
|
399
|
-
const stop = () => {
|
|
400
|
-
stopping = true;
|
|
401
|
-
process.off("SIGINT", stop);
|
|
402
|
-
void Promise.all(forwards.map((f) => f.close())).then(() => {
|
|
403
|
-
tunnel.close();
|
|
404
|
-
resolve(0);
|
|
405
|
-
});
|
|
406
|
-
};
|
|
407
|
-
process.once("SIGINT", stop);
|
|
408
|
-
void tunnel.closed.then((reason) => {
|
|
409
|
-
if (stopping)
|
|
410
|
-
return;
|
|
411
|
-
process.off("SIGINT", stop);
|
|
412
|
-
out.error(`The tunnel closed: ${reason}`);
|
|
413
|
-
void Promise.all(forwards.map((f) => f.close())).then(() => resolve(1));
|
|
414
|
-
});
|
|
415
|
-
});
|
|
416
|
-
}
|
package/dist/switched-off.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type RuntimeError } from "./errors.js";
|
|
2
|
-
/** A product switched off on this deployment, by its `<product>_unavailable`
|
|
3
|
-
* code: a 501, or a 503 with a deliberate code from an older server (whose
|
|
4
|
-
* host_unavailable and api_unavailable are 503s too, and pass). */
|
|
5
|
-
export declare function productSwitchedOff(error: RuntimeError): boolean;
|
package/dist/switched-off.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DELIBERATE } from "./errors.js";
|
|
2
|
-
/** A product switched off on this deployment, by its `<product>_unavailable`
|
|
3
|
-
* code: a 501, or a 503 with a deliberate code from an older server (whose
|
|
4
|
-
* host_unavailable and api_unavailable are 503s too, and pass). */
|
|
5
|
-
export function productSwitchedOff(error) {
|
|
6
|
-
return (error.code.endsWith("_unavailable") &&
|
|
7
|
-
(error.status === 501 || (error.status === 503 && DELIBERATE.has(error.code))));
|
|
8
|
-
}
|
package/dist/tar.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** One entry's header: the ustar block, after the long-name and long-link
|
|
2
|
-
* entries it needs. A whole number of 512-byte blocks. */
|
|
3
|
-
export declare function tarHeader(name: string, size: number, mode: number, type: "0" | "5" | "2", link?: string, mtime?: number): Uint8Array;
|
|
4
|
-
export declare function packDirectory(root: string): Promise<Uint8Array>;
|
|
5
|
-
/** Unpacks a gzipped tar that arrives as a stream into `target`, refusing any
|
|
6
|
-
* entry that would land outside it, holding no more than a chunk at a time.
|
|
7
|
-
* It unpacks into a folder beside the target and moves it into place only
|
|
8
|
-
* once the whole archive arrived, so an archive cut short leaves nothing
|
|
9
|
-
* behind that could pass for the folder. A target that exists is merged
|
|
10
|
-
* into, files of the same name replaced. */
|
|
11
|
-
export declare function unpackStream(from: AsyncIterable<Uint8Array> | Iterable<Uint8Array> | ReadableStream<Uint8Array>, target: string, options?: {
|
|
12
|
-
signal?: AbortSignal;
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
/** Unpacks a whole gzipped tar held in memory, by the same rules. */
|
|
15
|
-
export declare function unpackArchive(archive: Uint8Array, target: string): Promise<void>;
|