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
package/dist/billing-cli.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Runtime } from "./client.js";
|
|
2
|
-
import type { claimWalletAccount, openWalletAccount, rekeyWalletAccount } from "./wallet.js";
|
|
3
|
-
type Out = {
|
|
4
|
-
json: boolean;
|
|
5
|
-
write: (text: string) => void;
|
|
6
|
-
error: (text: string) => void;
|
|
7
|
-
};
|
|
8
|
-
type Args = {
|
|
9
|
-
positional: string[];
|
|
10
|
-
flags: Map<string, string[]>;
|
|
11
|
-
};
|
|
12
|
-
export declare const BILLING_HELP = "runtime billing <command>\n\n topup <usd> [--wait] Buy credit with stablecoins (USDC on Base, Solana or Tempo).\n Prints an address per network and the exact amount to send.\n Send exactly that, from any wallet, before the time shown.\n --wait keeps checking until the credit lands.\n status <id> [--wait] Whether a top-up's payment has arrived\n\n auto-top-up Show auto top-up: the card is charged when credit runs low\n auto-top-up on [--below <usd>] [--amount <usd>] [--monthly <usd>]\n Charge <amount> plus tax when credit falls below <below>,\n at most <monthly> a month: $10, $20 and $500 unless given,\n or as last set. At least $10, $20 and $100. 5% more as\n credit each time, and 200 sandboxes at once while on.\n A person saves the card at\n https://withruntime.com/account/billing\n auto-top-up off Turn it off. Running sandboxes are never stopped.\n\n No account yet? An agent can open one with a wallet alone:\n topup <usd> --new-account --accept-terms [--wait]\n Opens an account and its first top-up. Prints a claim code,\n shown once. --wait saves the key here once the money lands.\n claim <code> [--wait] Exchange a paid account's claim code for its key, saved here\n claim <code> --new-key Lost the key? Replace it with the claim code. The new key is\n saved here; every other key stops working.\n\n $10 to $10,000 a top-up; $500 in an account's first week. By card:\n https://withruntime.com/account/billing\n";
|
|
13
|
-
/** Wallet-account commands need no key, and the claim saves the one they get. */
|
|
14
|
-
export type WalletDeps = {
|
|
15
|
-
open: typeof openWalletAccount;
|
|
16
|
-
claim: typeof claimWalletAccount;
|
|
17
|
-
/** Replaces a lost key with the claim code. */
|
|
18
|
-
rekey: typeof rekeyWalletAccount;
|
|
19
|
-
/** Saves a claimed key as this machine's connection, as `login --with-key` does. */
|
|
20
|
-
save: (key: string, orgId: string) => Promise<void>;
|
|
21
|
-
};
|
|
22
|
-
export declare function billingCommand(argv: string[], args: Args, out: Out, client: () => Promise<Runtime>, sleep?: (ms: number) => Promise<void>, wallet?: WalletDeps): Promise<number>;
|
|
23
|
-
export {};
|
package/dist/billing-cli.js
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { RuntimeError } from "./errors.js";
|
|
2
|
-
import { named } from "./cli-name.js";
|
|
3
|
-
export const BILLING_HELP = `runtime billing <command>
|
|
4
|
-
|
|
5
|
-
topup <usd> [--wait] Buy credit with stablecoins (USDC on Base, Solana or Tempo).
|
|
6
|
-
Prints an address per network and the exact amount to send.
|
|
7
|
-
Send exactly that, from any wallet, before the time shown.
|
|
8
|
-
--wait keeps checking until the credit lands.
|
|
9
|
-
status <id> [--wait] Whether a top-up's payment has arrived
|
|
10
|
-
|
|
11
|
-
auto-top-up Show auto top-up: the card is charged when credit runs low
|
|
12
|
-
auto-top-up on [--below <usd>] [--amount <usd>] [--monthly <usd>]
|
|
13
|
-
Charge <amount> plus tax when credit falls below <below>,
|
|
14
|
-
at most <monthly> a month: $10, $20 and $500 unless given,
|
|
15
|
-
or as last set. At least $10, $20 and $100. 5% more as
|
|
16
|
-
credit each time, and 200 sandboxes at once while on.
|
|
17
|
-
A person saves the card at
|
|
18
|
-
https://withruntime.com/account/billing
|
|
19
|
-
auto-top-up off Turn it off. Running sandboxes are never stopped.
|
|
20
|
-
|
|
21
|
-
No account yet? An agent can open one with a wallet alone:
|
|
22
|
-
topup <usd> --new-account --accept-terms [--wait]
|
|
23
|
-
Opens an account and its first top-up. Prints a claim code,
|
|
24
|
-
shown once. --wait saves the key here once the money lands.
|
|
25
|
-
claim <code> [--wait] Exchange a paid account's claim code for its key, saved here
|
|
26
|
-
claim <code> --new-key Lost the key? Replace it with the claim code. The new key is
|
|
27
|
-
saved here; every other key stops working.
|
|
28
|
-
|
|
29
|
-
$10 to $10,000 a top-up; $500 in an account's first week. By card:
|
|
30
|
-
https://withruntime.com/account/billing
|
|
31
|
-
`;
|
|
32
|
-
function usage(message) {
|
|
33
|
-
return new RuntimeError({
|
|
34
|
-
message,
|
|
35
|
-
code: "usage",
|
|
36
|
-
status: 0,
|
|
37
|
-
hint: `Run \`${named("runtime")} billing help\`.`,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
const DONE = new Set(["paid", "failed", "expired"]);
|
|
41
|
-
function describe(topup) {
|
|
42
|
-
const me = named("runtime");
|
|
43
|
-
if (topup.status === "paid")
|
|
44
|
-
return `Paid: $${topup.amountUsd} of credit is on the account.`;
|
|
45
|
-
if (topup.status === "expired")
|
|
46
|
-
return `Expired: no payment arrived in time. Open a new one with \`${me} billing topup ${topup.amountUsd}\`.`;
|
|
47
|
-
if (topup.status === "failed")
|
|
48
|
-
return "Failed. Nothing was credited.";
|
|
49
|
-
if (topup.status === "pending")
|
|
50
|
-
return `Stripe has seen the payment and is confirming it. Check again with \`${me} billing status ${topup.purchaseId}\`.`;
|
|
51
|
-
const lines = [`Send exactly ${topup.amount} of one of these tokens, on one network:`, ""];
|
|
52
|
-
for (const network of topup.networks)
|
|
53
|
-
for (const token of network.tokens)
|
|
54
|
-
lines.push(` ${network.network.padEnd(7)} ${token.currency.toUpperCase().padEnd(6)} to ${network.address}`, ` ${"".padEnd(7)} ${"".padEnd(6)} token ${token.contract}`);
|
|
55
|
-
lines.push("", ...(topup.payBy ? [`Send before ${topup.payBy}.`] : []), "A different amount, token or network cannot be matched or returned automatically.", `The credit lands a few minutes after the transfer: \`${me} billing status ${topup.purchaseId}\`.`);
|
|
56
|
-
return lines.join("\n");
|
|
57
|
-
}
|
|
58
|
-
const FLAGS = new Set([
|
|
59
|
-
"wait",
|
|
60
|
-
"new-account",
|
|
61
|
-
"accept-terms",
|
|
62
|
-
"below",
|
|
63
|
-
"amount",
|
|
64
|
-
"monthly",
|
|
65
|
-
"new-key",
|
|
66
|
-
]);
|
|
67
|
-
export async function billingCommand(argv, args, out, client, sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), wallet) {
|
|
68
|
-
const [verb, value] = args.positional;
|
|
69
|
-
const has = (name) => args.flags.get(name)?.at(-1) === "true";
|
|
70
|
-
const wait = has("wait");
|
|
71
|
-
for (const name of args.flags.keys())
|
|
72
|
-
if (!FLAGS.has(name))
|
|
73
|
-
throw usage(`Unknown option --${name}.`);
|
|
74
|
-
if (!verb || verb === "help") {
|
|
75
|
-
out.write(BILLING_HELP);
|
|
76
|
-
return 0;
|
|
77
|
-
}
|
|
78
|
-
if ((verb === "topup" && has("new-account")) || verb === "claim") {
|
|
79
|
-
if (!wallet)
|
|
80
|
-
throw usage("Wallet accounts are not available here.");
|
|
81
|
-
if (has("new-key")) {
|
|
82
|
-
if (verb !== "claim")
|
|
83
|
-
throw usage("--new-key is for `billing claim <code> --new-key`.");
|
|
84
|
-
return rekeyCommand(value, out, wallet);
|
|
85
|
-
}
|
|
86
|
-
return walletCommand(verb, value, has("accept-terms"), wait, out, sleep, wallet);
|
|
87
|
-
}
|
|
88
|
-
if (verb === "auto-top-up")
|
|
89
|
-
return autoTopUpCommand(value, args, out, client);
|
|
90
|
-
for (const name of ["below", "amount", "monthly"])
|
|
91
|
-
if (args.flags.has(name))
|
|
92
|
-
throw usage(`--${name} is for \`billing auto-top-up on\`.`);
|
|
93
|
-
const api = (await client()).billing;
|
|
94
|
-
let topup;
|
|
95
|
-
if (verb === "topup") {
|
|
96
|
-
topup = await api.topup({ usd: dollarsOf(value) }, { idempotencyKey: crypto.randomUUID() });
|
|
97
|
-
}
|
|
98
|
-
else if (verb === "status") {
|
|
99
|
-
if (!value)
|
|
100
|
-
throw usage("Give the top-up's id.");
|
|
101
|
-
topup = await api.topupStatus(value);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
throw usage(`Unknown billing command ${verb}.`);
|
|
105
|
-
}
|
|
106
|
-
const shown = new Set();
|
|
107
|
-
const show = (current) => {
|
|
108
|
-
if (out.json)
|
|
109
|
-
out.write(JSON.stringify(current));
|
|
110
|
-
else if (!shown.has(current.status))
|
|
111
|
-
out.write(describe(current));
|
|
112
|
-
shown.add(current.status);
|
|
113
|
-
};
|
|
114
|
-
show(topup);
|
|
115
|
-
if (!wait)
|
|
116
|
-
return 0;
|
|
117
|
-
/* Stripe takes a few minutes to see a transfer; checking every ten seconds
|
|
118
|
-
is quick enough and costs nothing. Stops once the top-up has an end, or
|
|
119
|
-
an hour after its deadline. */
|
|
120
|
-
const until = (topup.payBy ? Date.parse(topup.payBy) : Date.now()) + 60 * 60_000;
|
|
121
|
-
while (!DONE.has(topup.status) && Date.now() < until) {
|
|
122
|
-
await sleep(10_000);
|
|
123
|
-
topup = await api.topupStatus(topup.purchaseId);
|
|
124
|
-
show(topup);
|
|
125
|
-
}
|
|
126
|
-
return topup.status === "paid" ? 0 : 1;
|
|
127
|
-
}
|
|
128
|
-
const OFF_REASONS = {
|
|
129
|
-
declined: "the bank declined the last charge",
|
|
130
|
-
authentication_required: "the bank asked its holder to confirm the last charge",
|
|
131
|
-
card_removed: "the card was removed",
|
|
132
|
-
no_address: "Stripe had no billing address to work out tax",
|
|
133
|
-
blocked: "a payment on this account is under review",
|
|
134
|
-
failed: "the last charge did not go through",
|
|
135
|
-
};
|
|
136
|
-
function describeAuto(auto) {
|
|
137
|
-
const figures = auto.below !== null && auto.amount !== null && auto.monthlyLimit !== null
|
|
138
|
-
? `adds $${auto.amount} when credit falls below $${auto.below}, up to $${auto.monthlyLimit} a month`
|
|
139
|
-
: null;
|
|
140
|
-
const lines = [
|
|
141
|
-
auto.enabled
|
|
142
|
-
? `Auto top-up is on: it ${figures}. $${auto.thisMonth} added this month.`
|
|
143
|
-
: auto.waitingForCard
|
|
144
|
-
? `Auto top-up turns on once a card is saved: it will ${figures}.`
|
|
145
|
-
: auto.offReason
|
|
146
|
-
? `Auto top-up is off: ${OFF_REASONS[auto.offReason]}.`
|
|
147
|
-
: "Auto top-up is off.",
|
|
148
|
-
];
|
|
149
|
-
if (auto.saveCardAt)
|
|
150
|
-
lines.push(`A person saves the card at ${auto.saveCardAt}`);
|
|
151
|
-
return lines.join("\n");
|
|
152
|
-
}
|
|
153
|
-
/** `billing auto-top-up [on|off]`. */
|
|
154
|
-
async function autoTopUpCommand(verb, args, out, client) {
|
|
155
|
-
const flag = (name) => args.flags.get(name)?.at(-1);
|
|
156
|
-
const api = (await client()).billing.autoTopUp;
|
|
157
|
-
const options = { idempotencyKey: crypto.randomUUID() };
|
|
158
|
-
let auto;
|
|
159
|
-
if (!verb || verb === "show")
|
|
160
|
-
auto = await api.get();
|
|
161
|
-
else if (verb === "off")
|
|
162
|
-
auto = await api.off(options);
|
|
163
|
-
else if (verb === "on") {
|
|
164
|
-
// A figure not given keeps the one saved, or takes its default.
|
|
165
|
-
const figure = (name) => {
|
|
166
|
-
const value = flag(name);
|
|
167
|
-
if (value === undefined)
|
|
168
|
-
return undefined;
|
|
169
|
-
const usd = Number(value.replace(/^\$/, ""));
|
|
170
|
-
if (!value || !Number.isFinite(usd) || usd <= 0)
|
|
171
|
-
throw usage(`Give --${name} in dollars, such as --${name} 20.`);
|
|
172
|
-
return usd;
|
|
173
|
-
};
|
|
174
|
-
const below = figure("below");
|
|
175
|
-
const amount = figure("amount");
|
|
176
|
-
const monthlyLimit = figure("monthly");
|
|
177
|
-
auto = await api.set({
|
|
178
|
-
enabled: true,
|
|
179
|
-
...(below === undefined ? {} : { below }),
|
|
180
|
-
...(amount === undefined ? {} : { amount }),
|
|
181
|
-
...(monthlyLimit === undefined ? {} : { monthlyLimit }),
|
|
182
|
-
}, options);
|
|
183
|
-
}
|
|
184
|
-
else
|
|
185
|
-
throw usage(`Unknown auto-top-up command ${verb}: show, on or off.`);
|
|
186
|
-
out.write(out.json ? JSON.stringify(auto) : describeAuto(auto));
|
|
187
|
-
return 0;
|
|
188
|
-
}
|
|
189
|
-
function dollarsOf(value) {
|
|
190
|
-
const usd = Number(value?.replace(/^\$/, ""));
|
|
191
|
-
if (!value || !Number.isFinite(usd) || usd <= 0)
|
|
192
|
-
throw usage("Say how many dollars of credit to buy, such as `billing topup 20`.");
|
|
193
|
-
return usd;
|
|
194
|
-
}
|
|
195
|
-
/** `claim <code> --new-key`: the key was lost; the claim code makes a new one. */
|
|
196
|
-
async function rekeyCommand(code, out, wallet) {
|
|
197
|
-
if (!code)
|
|
198
|
-
throw usage("Give the claim code.");
|
|
199
|
-
const replaced = await wallet.rekey(code);
|
|
200
|
-
await wallet.save(replaced.apiKey, replaced.orgId);
|
|
201
|
-
out.write(out.json
|
|
202
|
-
? JSON.stringify({ status: "replaced", orgId: replaced.orgId, connected: true })
|
|
203
|
-
: "Replaced. This machine is connected with the new key, saved and not shown. Every other key of this account no longer works.");
|
|
204
|
-
return 0;
|
|
205
|
-
}
|
|
206
|
-
/** `topup <usd> --new-account` and `claim <code>`: an account with no key. */
|
|
207
|
-
async function walletCommand(verb, value, acceptTerms, wait, out, sleep, wallet) {
|
|
208
|
-
const me = named("runtime");
|
|
209
|
-
let code;
|
|
210
|
-
let payBy = null;
|
|
211
|
-
if (verb === "topup") {
|
|
212
|
-
if (!acceptTerms)
|
|
213
|
-
throw usage("Opening an account means agreeing to https://withruntime.com/legal/terms. Add --accept-terms to agree to them for whoever you act for.");
|
|
214
|
-
const opened = await wallet.open({ usd: dollarsOf(value), acceptTerms: true });
|
|
215
|
-
code = opened.claimCode;
|
|
216
|
-
payBy = opened.payBy;
|
|
217
|
-
if (out.json)
|
|
218
|
-
out.write(JSON.stringify(opened));
|
|
219
|
-
else
|
|
220
|
-
out.write([
|
|
221
|
-
describe(opened),
|
|
222
|
-
"",
|
|
223
|
-
`Claim code (shown once, keep it secret): ${code}`,
|
|
224
|
-
`Once paid: \`${me} billing claim ${code}\` gives this machine the account's key.`,
|
|
225
|
-
"A person can take the account over at https://withruntime.com/account/claim with the same code.",
|
|
226
|
-
].join("\n"));
|
|
227
|
-
if (!wait)
|
|
228
|
-
return 0;
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
if (!value)
|
|
232
|
-
throw usage("Give the claim code.");
|
|
233
|
-
code = value;
|
|
234
|
-
}
|
|
235
|
-
const until = (payBy ? Date.parse(payBy) : Date.now()) + 60 * 60_000;
|
|
236
|
-
for (let first = verb === "claim";; first = false) {
|
|
237
|
-
if (!first)
|
|
238
|
-
await sleep(10_000);
|
|
239
|
-
const claim = await wallet.claim(code);
|
|
240
|
-
if (claim.status === "paid") {
|
|
241
|
-
await wallet.save(claim.apiKey, claim.orgId);
|
|
242
|
-
out.write(out.json
|
|
243
|
-
? JSON.stringify({ status: "paid", orgId: claim.orgId, connected: true })
|
|
244
|
-
: "Paid. This machine is connected to the new account; its key is saved, not shown.");
|
|
245
|
-
return 0;
|
|
246
|
-
}
|
|
247
|
-
if (claim.status === "expired" || claim.status === "failed") {
|
|
248
|
-
out.write(out.json
|
|
249
|
-
? JSON.stringify(claim)
|
|
250
|
-
: `The top-up ${claim.status}: nothing was credited. Open a new one with \`${me} billing topup <usd> --new-account --accept-terms\`.`);
|
|
251
|
-
return 1;
|
|
252
|
-
}
|
|
253
|
-
// A top-up that never reached Stripe has no address: waiting cannot help.
|
|
254
|
-
const noAddress = claim.topup?.status === "open" && !claim.topup.networks.length;
|
|
255
|
-
if (noAddress || !wait || Date.now() >= until) {
|
|
256
|
-
out.write(out.json
|
|
257
|
-
? JSON.stringify(claim)
|
|
258
|
-
: noAddress
|
|
259
|
-
? (claim.next ?? "This top-up has no address to pay to yet.")
|
|
260
|
-
: `Not paid yet (${claim.status}). Run \`${me} billing claim ${code}\` again once the transfer has gone through.`);
|
|
261
|
-
return noAddress || wait ? 1 : 0;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
package/dist/blaxel/client.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Runtime } from "../client.js";
|
|
2
|
-
/** The Runtime sandbox the adapter drives. */
|
|
3
|
-
export type RuntimeSandbox = Awaited<ReturnType<Runtime["sandboxes"]["create"]>>;
|
|
4
|
-
/** What `SandboxInstance.create` sends to Runtime. */
|
|
5
|
-
export type RuntimeCreate = NonNullable<Parameters<Runtime["sandboxes"]["create"]>[0]>;
|
|
6
|
-
/** Runtime-only options, for code that has been through the switch. */
|
|
7
|
-
export interface WithRuntime {
|
|
8
|
-
/** A Runtime client to use instead of one made from the key. */
|
|
9
|
-
client?: Runtime;
|
|
10
|
-
/** Fields sent as they are with the create, over the adapter's own: for
|
|
11
|
-
* example `{ funding: "trial" }` or `{ vcpu: 4 }`. */
|
|
12
|
-
create?: Partial<RuntimeCreate>;
|
|
13
|
-
}
|
|
14
|
-
/** Options every static call takes, for code that has been through the
|
|
15
|
-
* switch: `SandboxInstance.get(name, { withruntime: { client } })`. */
|
|
16
|
-
export interface RuntimeOptions {
|
|
17
|
-
withruntime?: WithRuntime;
|
|
18
|
-
}
|
|
19
|
-
/** Blaxel's `initialize` / `settings.setConfig` fields, as far as they mean
|
|
20
|
-
* anything on Runtime. */
|
|
21
|
-
export interface Config {
|
|
22
|
-
/** A Runtime key (`rtcloud_...`) is used; a Blaxel key is refused, never sent. */
|
|
23
|
-
apikey?: string;
|
|
24
|
-
apiKey?: string;
|
|
25
|
-
workspace?: string;
|
|
26
|
-
proxy?: string;
|
|
27
|
-
clientCredentials?: string | {
|
|
28
|
-
clientId: string;
|
|
29
|
-
clientSecret: string;
|
|
30
|
-
};
|
|
31
|
-
/** Blaxel's product token for an integration built on the SDK
|
|
32
|
-
* (`<name>/<semver>`), which Blaxel appends to its User-Agent. Kept and
|
|
33
|
-
* checked as Blaxel does; never sent, as Runtime does not attribute traffic
|
|
34
|
-
* by it. */
|
|
35
|
-
integration?: string;
|
|
36
|
-
[key: string]: unknown;
|
|
37
|
-
}
|
|
38
|
-
/** Blaxel's `settings.integration`: the token given to `initialize` or set,
|
|
39
|
-
* then BL_INTEGRATION; `""` when none, or when it is not `<name>/<semver>`
|
|
40
|
-
* (warned once per value, as Blaxel does). */
|
|
41
|
-
export declare function integrationToken(): string;
|
|
42
|
-
/** Sets Blaxel's `settings.integration`; undefined goes back to BL_INTEGRATION. */
|
|
43
|
-
export declare function setIntegrationToken(value: string | undefined): void;
|
|
44
|
-
/** Blaxel's `initialize(config)`: a Runtime key given as `apikey` is used from
|
|
45
|
-
* then on. A Blaxel key is refused while RUNTIME_API_KEY is not set, and never
|
|
46
|
-
* sent. `workspace` means nothing on Runtime and is ignored. */
|
|
47
|
-
export declare function initialize(config?: Config): void;
|
|
48
|
-
/** The key to use: one given to `initialize`, then RUNTIME_API_KEY, then
|
|
49
|
-
* BL_API_KEY when it holds a Runtime key; undefined lets the Runtime SDK find
|
|
50
|
-
* the key `npx withruntime login` saved. A Blaxel key in BL_API_KEY is never
|
|
51
|
-
* sent anywhere. */
|
|
52
|
-
export declare function pickKey(): string | undefined;
|
|
53
|
-
/** The Runtime client for these options: an explicit client, else one per
|
|
54
|
-
* key, made once and reused so its connections stay open. */
|
|
55
|
-
export declare function clientFor(options?: RuntimeOptions): Runtime;
|
|
56
|
-
/** Test hook: forget the cached clients and any key from `initialize`. */
|
|
57
|
-
export declare function resetClients(): void;
|
|
58
|
-
/** Blaxel's default region, from BL_REGION. */
|
|
59
|
-
export declare function defaultRegion(): string | undefined;
|
package/dist/blaxel/client.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Runtime } from "../client.js";
|
|
2
|
-
import { CredentialsError, NotSupportedError } from "./errors.js";
|
|
3
|
-
const env = (name) => typeof process === "undefined" ? undefined : process.env[name];
|
|
4
|
-
const isRuntimeKey = (key) => key.startsWith("rtcloud_");
|
|
5
|
-
let configured;
|
|
6
|
-
let integration;
|
|
7
|
-
let warnedIntegration;
|
|
8
|
-
/** Blaxel's check of an integration token: `<name>/<semver>`, lowercase name. */
|
|
9
|
-
const INTEGRATION_TOKEN = /^[a-z0-9][a-z0-9._-]*\/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
10
|
-
/** Blaxel's `settings.integration`: the token given to `initialize` or set,
|
|
11
|
-
* then BL_INTEGRATION; `""` when none, or when it is not `<name>/<semver>`
|
|
12
|
-
* (warned once per value, as Blaxel does). */
|
|
13
|
-
export function integrationToken() {
|
|
14
|
-
const value = integration ?? env("BL_INTEGRATION") ?? "";
|
|
15
|
-
if (!value)
|
|
16
|
-
return "";
|
|
17
|
-
if (!INTEGRATION_TOKEN.test(value)) {
|
|
18
|
-
if (warnedIntegration !== value) {
|
|
19
|
-
warnedIntegration = value;
|
|
20
|
-
console.warn(`Ignoring invalid Blaxel integration token ${JSON.stringify(value)}: expected <name>/<semver> with a lowercase name`);
|
|
21
|
-
}
|
|
22
|
-
return "";
|
|
23
|
-
}
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
/** Sets Blaxel's `settings.integration`; undefined goes back to BL_INTEGRATION. */
|
|
27
|
-
export function setIntegrationToken(value) {
|
|
28
|
-
integration = value;
|
|
29
|
-
}
|
|
30
|
-
/** Blaxel's `initialize(config)`: a Runtime key given as `apikey` is used from
|
|
31
|
-
* then on. A Blaxel key is refused while RUNTIME_API_KEY is not set, and never
|
|
32
|
-
* sent. `workspace` means nothing on Runtime and is ignored. */
|
|
33
|
-
export function initialize(config = {}) {
|
|
34
|
-
if (config.clientCredentials !== undefined)
|
|
35
|
-
throw new NotSupportedError("Blaxel client credentials (clientCredentials)", "Use a Runtime key: set RUNTIME_API_KEY, or run `npx withruntime login` once.");
|
|
36
|
-
if ("integration" in config)
|
|
37
|
-
integration = config.integration;
|
|
38
|
-
const key = config.apikey ?? config.apiKey;
|
|
39
|
-
if (key === undefined || key === "")
|
|
40
|
-
return;
|
|
41
|
-
if (isRuntimeKey(key)) {
|
|
42
|
-
configured = key;
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (!env("RUNTIME_API_KEY"))
|
|
46
|
-
throw new CredentialsError("The apikey passed is a Blaxel API key, and it was not sent. Set RUNTIME_API_KEY to a Runtime key " +
|
|
47
|
-
"(https://withruntime.com/account/keys, or run `npx withruntime login`), or pass the Runtime key as apikey.");
|
|
48
|
-
}
|
|
49
|
-
/** The key to use: one given to `initialize`, then RUNTIME_API_KEY, then
|
|
50
|
-
* BL_API_KEY when it holds a Runtime key; undefined lets the Runtime SDK find
|
|
51
|
-
* the key `npx withruntime login` saved. A Blaxel key in BL_API_KEY is never
|
|
52
|
-
* sent anywhere. */
|
|
53
|
-
export function pickKey() {
|
|
54
|
-
if (configured)
|
|
55
|
-
return configured;
|
|
56
|
-
const runtimeKey = env("RUNTIME_API_KEY");
|
|
57
|
-
if (runtimeKey)
|
|
58
|
-
return runtimeKey;
|
|
59
|
-
const blaxel = env("BL_API_KEY");
|
|
60
|
-
return blaxel && isRuntimeKey(blaxel) ? blaxel : undefined;
|
|
61
|
-
}
|
|
62
|
-
const clients = new Map();
|
|
63
|
-
/** The Runtime client for these options: an explicit client, else one per
|
|
64
|
-
* key, made once and reused so its connections stay open. */
|
|
65
|
-
export function clientFor(options = {}) {
|
|
66
|
-
if (options.withruntime?.client)
|
|
67
|
-
return options.withruntime.client;
|
|
68
|
-
const key = pickKey();
|
|
69
|
-
let client = clients.get(key ?? "");
|
|
70
|
-
if (!client) {
|
|
71
|
-
client = new Runtime(key ? { apiKey: key } : {});
|
|
72
|
-
clients.set(key ?? "", client);
|
|
73
|
-
}
|
|
74
|
-
return client;
|
|
75
|
-
}
|
|
76
|
-
/** Test hook: forget the cached clients and any key from `initialize`. */
|
|
77
|
-
export function resetClients() {
|
|
78
|
-
clients.clear();
|
|
79
|
-
configured = undefined;
|
|
80
|
-
integration = undefined;
|
|
81
|
-
warnedIntegration = undefined;
|
|
82
|
-
}
|
|
83
|
-
/** Blaxel's default region, from BL_REGION. */
|
|
84
|
-
export function defaultRegion() {
|
|
85
|
-
return env("BL_REGION") || undefined;
|
|
86
|
-
}
|
package/dist/blaxel/context.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/** Blaxel's stock images work in /blaxel (WORKDIR and HOME); Runtime's in
|
|
2
|
-
* /workspace. */
|
|
3
|
-
export declare const HOME = "/blaxel";
|
|
4
|
-
export declare const RUNTIME_HOME = "/workspace";
|
|
5
|
-
/** The sandbox's envs, kept on the sandbox itself so every process sees them,
|
|
6
|
-
* from any client. Readable by the sandbox user, writable only with sudo. */
|
|
7
|
-
export declare const ENV_FILE = "/etc/runtime-blaxel/env";
|
|
8
|
-
/** A Blaxel path as the Runtime path it stands for: relative paths, `~` and
|
|
9
|
-
* `/blaxel` resolve against /workspace, as they resolve against /blaxel on
|
|
10
|
-
* Blaxel; any other absolute path is itself. */
|
|
11
|
-
export declare function toRuntimePath(path: string): string;
|
|
12
|
-
/** A Runtime path as Blaxel code expects to see it: /workspace is /blaxel. */
|
|
13
|
-
export declare function toBlaxelPath(path: string): string;
|
|
14
|
-
/** Single-quoted for bash: any text, taken literally. */
|
|
15
|
-
export declare function quote(text: string): string;
|
|
16
|
-
/** Refuses an env name no process could receive. */
|
|
17
|
-
export declare function checkEnvNames(names: Iterable<string>): void;
|
|
18
|
-
/** The env file's lines: each exports its variable unless the process was
|
|
19
|
-
* given its own value (named in RUNTIME_BLAXEL_KEEP), so a process's `env`
|
|
20
|
-
* wins over the sandbox's, as in Blaxel. Lines stand alone, so a fork's
|
|
21
|
-
* envs are appended after the source's and win. */
|
|
22
|
-
export declare function envFileLines(envs: Record<string, string>): string;
|
|
23
|
-
/** The envs an env file holds; later lines win, as when it is sourced. */
|
|
24
|
-
export declare function parseEnvFile(text: string): Record<string, string>;
|
|
25
|
-
/** Writes the env file (replacing it, or appending to it): one command, with
|
|
26
|
-
* the content on standard input so no value appears in a command line. */
|
|
27
|
-
export declare function envFileCommand(append: boolean): string[];
|
|
28
|
-
/** Marks a keepAlive process's command line, so any client can tell whether
|
|
29
|
-
* one still runs before it gives the sandbox its idle pause back. */
|
|
30
|
-
export declare const KEEP_MARK = ": rt-blaxel-keep";
|
|
31
|
-
/** The shell line a Blaxel process runs as. The Python adapter writes the
|
|
32
|
-
* same line, byte for byte, so either reads what the other started:
|
|
33
|
-
*
|
|
34
|
-
* : rt-blaxel '<name>'; [: rt-blaxel-keep; ]export HOST="${HOST:-0.0.0.0}";
|
|
35
|
-
* [ -r /etc/runtime-blaxel/env ] && . /etc/runtime-blaxel/env;
|
|
36
|
-
* unset RUNTIME_BLAXEL_KEEP; [{ [ -e /blaxel ] || sudo ln -s /workspace
|
|
37
|
-
* /blaxel; } 2>/dev/null; ]__rt_cmd='<command>'; export __rt_cmd; exec sudo
|
|
38
|
-
* -E env "PATH=$PATH" "HOME=$HOME" bash -c '<run>'
|
|
39
|
-
*
|
|
40
|
-
* joined with "; " on one line, where <run> is `eval "$__rt_cmd"`, or the
|
|
41
|
-
* restart loop below. Quotes are single, with ' written '\''. */
|
|
42
|
-
export declare function processLine(command: string, options: {
|
|
43
|
-
name: string;
|
|
44
|
-
maxRestarts?: number;
|
|
45
|
-
linkHome?: boolean;
|
|
46
|
-
keepAlive?: boolean;
|
|
47
|
-
}): string;
|
|
48
|
-
/** The Blaxel name and command of a process this adapter started, from the
|
|
49
|
-
* command Runtime recorded (cut at 256 characters: a long command is cut
|
|
50
|
-
* too, its name kept); undefined for any other process. */
|
|
51
|
-
export declare function parseProcessLine(line: string): {
|
|
52
|
-
name: string;
|
|
53
|
-
command: string;
|
|
54
|
-
keepAlive: boolean;
|
|
55
|
-
} | undefined;
|
|
56
|
-
/** A time as Blaxel's sandbox API writes it: "Mon, 02 Jan 2006 15:04:05 GMT". */
|
|
57
|
-
export declare function httpDate(time: string | number | Date | null | undefined): string;
|
|
58
|
-
/** A random name, as Blaxel gives an unnamed process. */
|
|
59
|
-
export declare function randomName(): string;
|
package/dist/blaxel/context.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { NotSupportedError } from "./errors.js";
|
|
2
|
-
/* What every part of the adapter shares: where Blaxel's paths land on
|
|
3
|
-
Runtime, the sandbox's environment file, and the shell line each Blaxel
|
|
4
|
-
process runs in. */
|
|
5
|
-
/** Blaxel's stock images work in /blaxel (WORKDIR and HOME); Runtime's in
|
|
6
|
-
* /workspace. */
|
|
7
|
-
export const HOME = "/blaxel";
|
|
8
|
-
export const RUNTIME_HOME = "/workspace";
|
|
9
|
-
/** The sandbox's envs, kept on the sandbox itself so every process sees them,
|
|
10
|
-
* from any client. Readable by the sandbox user, writable only with sudo. */
|
|
11
|
-
export const ENV_FILE = "/etc/runtime-blaxel/env";
|
|
12
|
-
/** A Blaxel path as the Runtime path it stands for: relative paths, `~` and
|
|
13
|
-
* `/blaxel` resolve against /workspace, as they resolve against /blaxel on
|
|
14
|
-
* Blaxel; any other absolute path is itself. */
|
|
15
|
-
export function toRuntimePath(path) {
|
|
16
|
-
let absolute = path.replace(/\/{2,}/g, "/");
|
|
17
|
-
if (absolute === "~" || absolute.startsWith("~/"))
|
|
18
|
-
absolute = HOME + absolute.slice(1);
|
|
19
|
-
if (!absolute.startsWith("/")) {
|
|
20
|
-
const relative = absolute.replace(/^(\.\/)+/, "").replace(/^\.$/, "");
|
|
21
|
-
absolute = relative ? `${HOME}/${relative}` : HOME;
|
|
22
|
-
}
|
|
23
|
-
const normal = normalize(absolute);
|
|
24
|
-
if (normal === HOME || normal.startsWith(`${HOME}/`))
|
|
25
|
-
return RUNTIME_HOME + normal.slice(HOME.length);
|
|
26
|
-
return normal;
|
|
27
|
-
}
|
|
28
|
-
/** A Runtime path as Blaxel code expects to see it: /workspace is /blaxel. */
|
|
29
|
-
export function toBlaxelPath(path) {
|
|
30
|
-
if (path === RUNTIME_HOME || path.startsWith(`${RUNTIME_HOME}/`))
|
|
31
|
-
return HOME + path.slice(RUNTIME_HOME.length);
|
|
32
|
-
return path;
|
|
33
|
-
}
|
|
34
|
-
function normalize(path) {
|
|
35
|
-
const parts = [];
|
|
36
|
-
for (const part of path.split("/")) {
|
|
37
|
-
if (part === "" || part === ".")
|
|
38
|
-
continue;
|
|
39
|
-
if (part === "..")
|
|
40
|
-
parts.pop();
|
|
41
|
-
else
|
|
42
|
-
parts.push(part);
|
|
43
|
-
}
|
|
44
|
-
return `/${parts.join("/")}`;
|
|
45
|
-
}
|
|
46
|
-
/** Single-quoted for bash: any text, taken literally. */
|
|
47
|
-
export function quote(text) {
|
|
48
|
-
return `'${text.replace(/'/g, `'\\''`)}'`;
|
|
49
|
-
}
|
|
50
|
-
function unquote(text) {
|
|
51
|
-
return text.replace(/'\\''/g, "'");
|
|
52
|
-
}
|
|
53
|
-
const IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
54
|
-
/** Refuses an env name no process could receive. */
|
|
55
|
-
export function checkEnvNames(names) {
|
|
56
|
-
for (const name of names)
|
|
57
|
-
if (!IDENTIFIER.test(name))
|
|
58
|
-
throw new NotSupportedError(`The environment variable name "${name}"`, "Use a name of letters, digits and underscores that does not start with a digit.");
|
|
59
|
-
}
|
|
60
|
-
/** The env file's lines: each exports its variable unless the process was
|
|
61
|
-
* given its own value (named in RUNTIME_BLAXEL_KEEP), so a process's `env`
|
|
62
|
-
* wins over the sandbox's, as in Blaxel. Lines stand alone, so a fork's
|
|
63
|
-
* envs are appended after the source's and win. */
|
|
64
|
-
export function envFileLines(envs) {
|
|
65
|
-
checkEnvNames(Object.keys(envs));
|
|
66
|
-
return Object.entries(envs)
|
|
67
|
-
.map(([name, value]) => `case ":\${RUNTIME_BLAXEL_KEEP-}:" in *:${name}:*) ;; *) export ${name}=${quote(value)} ;; esac\n`)
|
|
68
|
-
.join("");
|
|
69
|
-
}
|
|
70
|
-
/** The envs an env file holds; later lines win, as when it is sourced. */
|
|
71
|
-
export function parseEnvFile(text) {
|
|
72
|
-
const envs = {};
|
|
73
|
-
for (const [, name, value] of text.matchAll(/\*\) export ([A-Za-z_][A-Za-z0-9_]*)='((?:[^']|'\\'')*)' ;; esac/g))
|
|
74
|
-
envs[name] = unquote(value);
|
|
75
|
-
return envs;
|
|
76
|
-
}
|
|
77
|
-
/** Writes the env file (replacing it, or appending to it): one command, with
|
|
78
|
-
* the content on standard input so no value appears in a command line. */
|
|
79
|
-
export function envFileCommand(append) {
|
|
80
|
-
const script = append
|
|
81
|
-
? `sudo mkdir -p /etc/runtime-blaxel && sudo sh -c 'cat >> ${ENV_FILE}' && sudo chgrp "$(id -g)" ${ENV_FILE} && sudo chmod 0640 ${ENV_FILE}`
|
|
82
|
-
: `sudo install -D -m 0640 -g "$(id -g)" /dev/stdin ${ENV_FILE}`;
|
|
83
|
-
return ["bash", "-c", script];
|
|
84
|
-
}
|
|
85
|
-
const MARK = ": rt-blaxel";
|
|
86
|
-
/** Marks a keepAlive process's command line, so any client can tell whether
|
|
87
|
-
* one still runs before it gives the sandbox its idle pause back. */
|
|
88
|
-
export const KEEP_MARK = ": rt-blaxel-keep";
|
|
89
|
-
/** How a Blaxel process becomes root, as on Blaxel: the sandbox user's shell
|
|
90
|
-
* hands over to sudo (passwordless in Runtime's image), keeping every
|
|
91
|
-
* variable, the sandbox user's PATH (sudo's secure_path would drop
|
|
92
|
-
* /workspace/.local/bin) and HOME. `exec` leaves no extra shell: a signal to
|
|
93
|
-
* the process reaches sudo, which Runtime ends with the whole process tree
|
|
94
|
-
* (checked 27 September 2026: SIGTERM exits -15, SIGKILL is killed -9, and
|
|
95
|
-
* no process of the command is left). */
|
|
96
|
-
const AS_ROOT = 'export __rt_cmd; exec sudo -E env "PATH=$PATH" "HOME=$HOME" bash -c';
|
|
97
|
-
/** The shell line a Blaxel process runs as. The Python adapter writes the
|
|
98
|
-
* same line, byte for byte, so either reads what the other started:
|
|
99
|
-
*
|
|
100
|
-
* : rt-blaxel '<name>'; [: rt-blaxel-keep; ]export HOST="${HOST:-0.0.0.0}";
|
|
101
|
-
* [ -r /etc/runtime-blaxel/env ] && . /etc/runtime-blaxel/env;
|
|
102
|
-
* unset RUNTIME_BLAXEL_KEEP; [{ [ -e /blaxel ] || sudo ln -s /workspace
|
|
103
|
-
* /blaxel; } 2>/dev/null; ]__rt_cmd='<command>'; export __rt_cmd; exec sudo
|
|
104
|
-
* -E env "PATH=$PATH" "HOME=$HOME" bash -c '<run>'
|
|
105
|
-
*
|
|
106
|
-
* joined with "; " on one line, where <run> is `eval "$__rt_cmd"`, or the
|
|
107
|
-
* restart loop below. Quotes are single, with ' written '\''. */
|
|
108
|
-
export function processLine(command, options) {
|
|
109
|
-
// Runtime keeps the first 256 characters of a command line: the name and
|
|
110
|
-
// the keepAlive mark come first, so a long command costs only its own tail.
|
|
111
|
-
const prelude = [
|
|
112
|
-
`${MARK} ${quote(options.name)}`,
|
|
113
|
-
...(options.keepAlive ? [KEEP_MARK] : []),
|
|
114
|
-
'export HOST="${HOST:-0.0.0.0}"',
|
|
115
|
-
`[ -r ${ENV_FILE} ] && . ${ENV_FILE}`,
|
|
116
|
-
"unset RUNTIME_BLAXEL_KEEP",
|
|
117
|
-
...(options.linkHome
|
|
118
|
-
? [`{ [ -e ${HOME} ] || sudo ln -s ${RUNTIME_HOME} ${HOME}; } 2>/dev/null`]
|
|
119
|
-
: []),
|
|
120
|
-
`__rt_cmd=${quote(command)}`,
|
|
121
|
-
];
|
|
122
|
-
if (options.maxRestarts === undefined)
|
|
123
|
-
return [...prelude, `${AS_ROOT} ${quote('eval "$__rt_cmd"')}`].join("; ");
|
|
124
|
-
const limit = options.maxRestarts < 0 ? "unlimited" : String(options.maxRestarts);
|
|
125
|
-
// Blaxel's restart loop: a failed run starts again, up to maxRestarts times
|
|
126
|
-
// (negative is unlimited), with the same note in the output.
|
|
127
|
-
const loop = `__rt_n=0; while :; do ( eval "$__rt_cmd" ); __rt_c=$?; [ $__rt_c -eq 0 ] && exit 0; ` +
|
|
128
|
-
`${options.maxRestarts < 0 ? "" : `[ $__rt_n -ge ${options.maxRestarts} ] && exit $__rt_c; `}` +
|
|
129
|
-
`__rt_n=$((__rt_n+1)); printf '\\n[Process failed with exit code %d. Attempting restart %d/%s...]\\n' $__rt_c $__rt_n '${limit}'; done`;
|
|
130
|
-
return [...prelude, `${AS_ROOT} ${quote(loop)}`].join("; ");
|
|
131
|
-
}
|
|
132
|
-
/** The Blaxel name and command of a process this adapter started, from the
|
|
133
|
-
* command Runtime recorded (cut at 256 characters: a long command is cut
|
|
134
|
-
* too, its name kept); undefined for any other process. */
|
|
135
|
-
export function parseProcessLine(line) {
|
|
136
|
-
const name = /: rt-blaxel '((?:[^']|'\\'')*)'/.exec(line);
|
|
137
|
-
if (!name)
|
|
138
|
-
return undefined;
|
|
139
|
-
const whole = /__rt_cmd='((?:[^']|'\\'')*)'/.exec(line);
|
|
140
|
-
const partial = /__rt_cmd='(.*)$/.exec(line);
|
|
141
|
-
const command = whole ? whole[1] : partial ? partial[1].replace(/'\\?'?$/, "") : "";
|
|
142
|
-
return {
|
|
143
|
-
name: unquote(name[1]),
|
|
144
|
-
command: unquote(command),
|
|
145
|
-
keepAlive: line.includes(`${KEEP_MARK};`),
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
/** A time as Blaxel's sandbox API writes it: "Mon, 02 Jan 2006 15:04:05 GMT". */
|
|
149
|
-
export function httpDate(time) {
|
|
150
|
-
if (time === null || time === undefined || time === "")
|
|
151
|
-
return "";
|
|
152
|
-
const date = new Date(time);
|
|
153
|
-
return Number.isNaN(date.getTime()) ? "" : date.toUTCString();
|
|
154
|
-
}
|
|
155
|
-
/** A random name, as Blaxel gives an unnamed process. */
|
|
156
|
-
export function randomName() {
|
|
157
|
-
const letters = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
158
|
-
let name = "";
|
|
159
|
-
for (let i = 0; i < 8; i++)
|
|
160
|
-
name += letters[Math.floor(Math.random() * letters.length)];
|
|
161
|
-
return name;
|
|
162
|
-
}
|