computesdk 2.2.1 → 2.4.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/README.md +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +54 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# computesdk
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The universal SDK for running code in remote sandboxes. Zero-config auto-detection with support for E2B, Modal, Railway, Daytona, Vercel, and more.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -3836,8 +3836,11 @@ declare const PROVIDER_AUTH: {
|
|
|
3836
3836
|
readonly cloudflare: readonly [readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
|
|
3837
3837
|
readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
|
|
3838
3838
|
readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
|
|
3839
|
-
readonly namespace: readonly [readonly ["NSC_TOKEN"]];
|
|
3839
|
+
readonly namespace: readonly [readonly ["NSC_TOKEN"], readonly ["NSC_TOKEN_FILE"]];
|
|
3840
3840
|
readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
|
|
3841
|
+
readonly beam: readonly [readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"]];
|
|
3842
|
+
readonly sprites: readonly [readonly ["SPRITES_TOKEN"]];
|
|
3843
|
+
readonly 'just-bash': readonly [readonly []];
|
|
3841
3844
|
};
|
|
3842
3845
|
/**
|
|
3843
3846
|
* All supported provider names (excluding gateway which is special)
|
|
@@ -3966,6 +3969,14 @@ interface ExplicitComputeConfig {
|
|
|
3966
3969
|
hopx?: {
|
|
3967
3970
|
apiKey?: string;
|
|
3968
3971
|
};
|
|
3972
|
+
beam?: {
|
|
3973
|
+
token?: string;
|
|
3974
|
+
workspaceId?: string;
|
|
3975
|
+
};
|
|
3976
|
+
sprites?: {
|
|
3977
|
+
apiKey?: string;
|
|
3978
|
+
};
|
|
3979
|
+
'just-bash'?: {};
|
|
3969
3980
|
}
|
|
3970
3981
|
/**
|
|
3971
3982
|
* Options for creating a sandbox via the gateway
|
|
@@ -4184,7 +4195,7 @@ declare const GATEWAY_URL = "https://gateway.computesdk.com";
|
|
|
4184
4195
|
* Provider detection priority order
|
|
4185
4196
|
* When multiple provider credentials are detected, use the first one in this list
|
|
4186
4197
|
*/
|
|
4187
|
-
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx"];
|
|
4198
|
+
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx", "beam", "sprites"];
|
|
4188
4199
|
/**
|
|
4189
4200
|
* Required environment variables for each provider
|
|
4190
4201
|
* @deprecated Use PROVIDER_AUTH from provider-config instead
|
|
@@ -4202,6 +4213,9 @@ declare const PROVIDER_ENV_VARS: {
|
|
|
4202
4213
|
readonly blaxel: readonly ["BL_API_KEY", "BL_WORKSPACE"];
|
|
4203
4214
|
readonly namespace: readonly ["NSC_TOKEN"];
|
|
4204
4215
|
readonly hopx: readonly ["HOPX_API_KEY"];
|
|
4216
|
+
readonly beam: readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"];
|
|
4217
|
+
readonly sprites: readonly ["SPRITES_TOKEN"];
|
|
4218
|
+
readonly 'just-bash': readonly [];
|
|
4205
4219
|
};
|
|
4206
4220
|
|
|
4207
4221
|
export { type CallableCompute, type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, type ExplicitComputeConfig, type FileEntry, FileWatcher, GATEWAY_URL, Sandbox as GatewaySandbox, MessageType, PROVIDER_AUTH, PROVIDER_DASHBOARD_URLS, PROVIDER_ENV_MAP, PROVIDER_ENV_VARS, PROVIDER_HEADERS, PROVIDER_NAMES, PROVIDER_PRIORITY, type ProviderName, type ProviderSandboxInfo, type RunCommandOptions, type Runtime, Sandbox, type SandboxFileSystem, type SandboxInfo$1 as SandboxInfo, type Sandbox$1 as SandboxInterface, type SandboxStatus, type SetupOverlayConfig, type SetupPayload, SignalService, TerminalInstance, type WebSocketConstructor, autoConfigureCompute, buildProviderHeaders, buildSetupPayload, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, encodeSetupPayload, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -3836,8 +3836,11 @@ declare const PROVIDER_AUTH: {
|
|
|
3836
3836
|
readonly cloudflare: readonly [readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
|
|
3837
3837
|
readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
|
|
3838
3838
|
readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
|
|
3839
|
-
readonly namespace: readonly [readonly ["NSC_TOKEN"]];
|
|
3839
|
+
readonly namespace: readonly [readonly ["NSC_TOKEN"], readonly ["NSC_TOKEN_FILE"]];
|
|
3840
3840
|
readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
|
|
3841
|
+
readonly beam: readonly [readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"]];
|
|
3842
|
+
readonly sprites: readonly [readonly ["SPRITES_TOKEN"]];
|
|
3843
|
+
readonly 'just-bash': readonly [readonly []];
|
|
3841
3844
|
};
|
|
3842
3845
|
/**
|
|
3843
3846
|
* All supported provider names (excluding gateway which is special)
|
|
@@ -3966,6 +3969,14 @@ interface ExplicitComputeConfig {
|
|
|
3966
3969
|
hopx?: {
|
|
3967
3970
|
apiKey?: string;
|
|
3968
3971
|
};
|
|
3972
|
+
beam?: {
|
|
3973
|
+
token?: string;
|
|
3974
|
+
workspaceId?: string;
|
|
3975
|
+
};
|
|
3976
|
+
sprites?: {
|
|
3977
|
+
apiKey?: string;
|
|
3978
|
+
};
|
|
3979
|
+
'just-bash'?: {};
|
|
3969
3980
|
}
|
|
3970
3981
|
/**
|
|
3971
3982
|
* Options for creating a sandbox via the gateway
|
|
@@ -4184,7 +4195,7 @@ declare const GATEWAY_URL = "https://gateway.computesdk.com";
|
|
|
4184
4195
|
* Provider detection priority order
|
|
4185
4196
|
* When multiple provider credentials are detected, use the first one in this list
|
|
4186
4197
|
*/
|
|
4187
|
-
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx"];
|
|
4198
|
+
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx", "beam", "sprites"];
|
|
4188
4199
|
/**
|
|
4189
4200
|
* Required environment variables for each provider
|
|
4190
4201
|
* @deprecated Use PROVIDER_AUTH from provider-config instead
|
|
@@ -4202,6 +4213,9 @@ declare const PROVIDER_ENV_VARS: {
|
|
|
4202
4213
|
readonly blaxel: readonly ["BL_API_KEY", "BL_WORKSPACE"];
|
|
4203
4214
|
readonly namespace: readonly ["NSC_TOKEN"];
|
|
4204
4215
|
readonly hopx: readonly ["HOPX_API_KEY"];
|
|
4216
|
+
readonly beam: readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"];
|
|
4217
|
+
readonly sprites: readonly ["SPRITES_TOKEN"];
|
|
4218
|
+
readonly 'just-bash': readonly [];
|
|
4205
4219
|
};
|
|
4206
4220
|
|
|
4207
4221
|
export { type CallableCompute, type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, type ExplicitComputeConfig, type FileEntry, FileWatcher, GATEWAY_URL, Sandbox as GatewaySandbox, MessageType, PROVIDER_AUTH, PROVIDER_DASHBOARD_URLS, PROVIDER_ENV_MAP, PROVIDER_ENV_VARS, PROVIDER_HEADERS, PROVIDER_NAMES, PROVIDER_PRIORITY, type ProviderName, type ProviderSandboxInfo, type RunCommandOptions, type Runtime, Sandbox, type SandboxFileSystem, type SandboxInfo$1 as SandboxInfo, type Sandbox$1 as SandboxInterface, type SandboxStatus, type SetupOverlayConfig, type SetupPayload, SignalService, TerminalInstance, type WebSocketConstructor, autoConfigureCompute, buildProviderHeaders, buildSetupPayload, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, encodeSetupPayload, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
|
package/dist/index.js
CHANGED
|
@@ -3644,8 +3644,11 @@ var PROVIDER_AUTH = {
|
|
|
3644
3644
|
cloudflare: [["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]],
|
|
3645
3645
|
codesandbox: [["CSB_API_KEY"]],
|
|
3646
3646
|
blaxel: [["BL_API_KEY", "BL_WORKSPACE"]],
|
|
3647
|
-
namespace: [["NSC_TOKEN"]],
|
|
3648
|
-
hopx: [["HOPX_API_KEY"]]
|
|
3647
|
+
namespace: [["NSC_TOKEN"], ["NSC_TOKEN_FILE"]],
|
|
3648
|
+
hopx: [["HOPX_API_KEY"]],
|
|
3649
|
+
beam: [["BEAM_TOKEN", "BEAM_WORKSPACE_ID"]],
|
|
3650
|
+
sprites: [["SPRITES_TOKEN"]],
|
|
3651
|
+
"just-bash": [[]]
|
|
3649
3652
|
};
|
|
3650
3653
|
var PROVIDER_NAMES = Object.keys(PROVIDER_AUTH);
|
|
3651
3654
|
var PROVIDER_HEADERS = {
|
|
@@ -3693,7 +3696,15 @@ var PROVIDER_HEADERS = {
|
|
|
3693
3696
|
},
|
|
3694
3697
|
hopx: {
|
|
3695
3698
|
apiKey: "X-HOPX-API-Key"
|
|
3696
|
-
}
|
|
3699
|
+
},
|
|
3700
|
+
beam: {
|
|
3701
|
+
token: "X-Beam-Token",
|
|
3702
|
+
workspaceId: "X-Beam-Workspace-Id"
|
|
3703
|
+
},
|
|
3704
|
+
sprites: {
|
|
3705
|
+
apiKey: "X-Sprites-Token"
|
|
3706
|
+
},
|
|
3707
|
+
"just-bash": {}
|
|
3697
3708
|
};
|
|
3698
3709
|
var PROVIDER_ENV_MAP = {
|
|
3699
3710
|
e2b: {
|
|
@@ -3736,11 +3747,20 @@ var PROVIDER_ENV_MAP = {
|
|
|
3736
3747
|
BL_WORKSPACE: "workspace"
|
|
3737
3748
|
},
|
|
3738
3749
|
namespace: {
|
|
3739
|
-
NSC_TOKEN: "token"
|
|
3750
|
+
NSC_TOKEN: "token",
|
|
3751
|
+
NSC_TOKEN_FILE: "tokenFile"
|
|
3740
3752
|
},
|
|
3741
3753
|
hopx: {
|
|
3742
3754
|
HOPX_API_KEY: "apiKey"
|
|
3743
|
-
}
|
|
3755
|
+
},
|
|
3756
|
+
beam: {
|
|
3757
|
+
BEAM_TOKEN: "token",
|
|
3758
|
+
BEAM_WORKSPACE_ID: "workspaceId"
|
|
3759
|
+
},
|
|
3760
|
+
sprites: {
|
|
3761
|
+
SPRITES_TOKEN: "apiKey"
|
|
3762
|
+
},
|
|
3763
|
+
"just-bash": {}
|
|
3744
3764
|
};
|
|
3745
3765
|
var PROVIDER_DASHBOARD_URLS = {
|
|
3746
3766
|
e2b: "https://e2b.dev/dashboard",
|
|
@@ -3754,7 +3774,10 @@ var PROVIDER_DASHBOARD_URLS = {
|
|
|
3754
3774
|
codesandbox: "https://codesandbox.io/dashboard/settings",
|
|
3755
3775
|
blaxel: "https://blaxel.ai/dashboard",
|
|
3756
3776
|
namespace: "https://cloud.namespace.so",
|
|
3757
|
-
hopx: "https://hopx.ai/dashboard"
|
|
3777
|
+
hopx: "https://hopx.ai/dashboard",
|
|
3778
|
+
beam: "https://app.beam.cloud",
|
|
3779
|
+
sprites: "https://sprites.dev",
|
|
3780
|
+
"just-bash": "https://github.com/vercel-labs/just-bash"
|
|
3758
3781
|
};
|
|
3759
3782
|
function isValidProvider(name) {
|
|
3760
3783
|
return name in PROVIDER_AUTH;
|
|
@@ -3824,7 +3847,9 @@ var PROVIDER_PRIORITY = [
|
|
|
3824
3847
|
"codesandbox",
|
|
3825
3848
|
"blaxel",
|
|
3826
3849
|
"namespace",
|
|
3827
|
-
"hopx"
|
|
3850
|
+
"hopx",
|
|
3851
|
+
"beam",
|
|
3852
|
+
"sprites"
|
|
3828
3853
|
];
|
|
3829
3854
|
var PROVIDER_ENV_VARS = {
|
|
3830
3855
|
e2b: ["E2B_API_KEY"],
|
|
@@ -3838,7 +3863,10 @@ var PROVIDER_ENV_VARS = {
|
|
|
3838
3863
|
codesandbox: ["CSB_API_KEY"],
|
|
3839
3864
|
blaxel: ["BL_API_KEY", "BL_WORKSPACE"],
|
|
3840
3865
|
namespace: ["NSC_TOKEN"],
|
|
3841
|
-
hopx: ["HOPX_API_KEY"]
|
|
3866
|
+
hopx: ["HOPX_API_KEY"],
|
|
3867
|
+
beam: ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"],
|
|
3868
|
+
sprites: ["SPRITES_TOKEN"],
|
|
3869
|
+
"just-bash": []
|
|
3842
3870
|
};
|
|
3843
3871
|
|
|
3844
3872
|
// src/auto-detect.ts
|
|
@@ -3973,6 +4001,21 @@ function getProviderHeaders(provider) {
|
|
|
3973
4001
|
headers["X-Render-Owner-ID"] = process.env.RENDER_OWNER_ID;
|
|
3974
4002
|
}
|
|
3975
4003
|
break;
|
|
4004
|
+
case "beam":
|
|
4005
|
+
if (process.env.BEAM_TOKEN) {
|
|
4006
|
+
headers["X-Beam-Token"] = process.env.BEAM_TOKEN;
|
|
4007
|
+
}
|
|
4008
|
+
if (process.env.BEAM_WORKSPACE_ID) {
|
|
4009
|
+
headers["X-Beam-Workspace-Id"] = process.env.BEAM_WORKSPACE_ID;
|
|
4010
|
+
}
|
|
4011
|
+
break;
|
|
4012
|
+
case "sprites":
|
|
4013
|
+
if (process.env.SPRITES_TOKEN) {
|
|
4014
|
+
headers["X-Sprites-Token"] = process.env.SPRITES_TOKEN;
|
|
4015
|
+
}
|
|
4016
|
+
break;
|
|
4017
|
+
case "just-bash":
|
|
4018
|
+
break;
|
|
3976
4019
|
}
|
|
3977
4020
|
return headers;
|
|
3978
4021
|
}
|
|
@@ -4012,6 +4055,9 @@ To fix this, set one of the following:
|
|
|
4012
4055
|
Namespace: export NSC_TOKEN=xxx
|
|
4013
4056
|
HopX: export HOPX_API_KEY=xxx
|
|
4014
4057
|
Render: export RENDER_API_KEY=xxx RENDER_OWNER_ID=xxx
|
|
4058
|
+
Beam: export BEAM_TOKEN=xxx BEAM_WORKSPACE_ID=xxx
|
|
4059
|
+
Sprites: export SPRITES_TOKEN=xxx
|
|
4060
|
+
just-bash: (no credentials needed - local sandbox)
|
|
4015
4061
|
|
|
4016
4062
|
Or set COMPUTESDK_PROVIDER to specify explicitly:
|
|
4017
4063
|
export COMPUTESDK_PROVIDER=<provider>
|