computesdk 2.0.2 → 2.1.2
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/index.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +66 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3700,6 +3700,7 @@ declare class Sandbox {
|
|
|
3700
3700
|
* @param options.env - Environment variables (server uses cmd.Env)
|
|
3701
3701
|
* @param options.onStdout - Callback for streaming stdout data
|
|
3702
3702
|
* @param options.onStderr - Callback for streaming stderr data
|
|
3703
|
+
* @param options.timeout - Timeout in seconds (max 300 for long-running commands)
|
|
3703
3704
|
* @returns Command execution result
|
|
3704
3705
|
*
|
|
3705
3706
|
* @example
|
|
@@ -3721,6 +3722,9 @@ declare class Sandbox {
|
|
|
3721
3722
|
* onStdout: (data) => console.log(data),
|
|
3722
3723
|
* onStderr: (data) => console.error(data),
|
|
3723
3724
|
* })
|
|
3725
|
+
*
|
|
3726
|
+
* // With timeout for long-running commands
|
|
3727
|
+
* await sandbox.runCommand('npm install', { timeout: 120 })
|
|
3724
3728
|
* ```
|
|
3725
3729
|
*/
|
|
3726
3730
|
runCommand(command: string, options?: {
|
|
@@ -3729,6 +3733,8 @@ declare class Sandbox {
|
|
|
3729
3733
|
env?: Record<string, string>;
|
|
3730
3734
|
onStdout?: (data: string) => void;
|
|
3731
3735
|
onStderr?: (data: string) => void;
|
|
3736
|
+
/** Timeout in seconds (max 300 for long-running commands) */
|
|
3737
|
+
timeout?: number;
|
|
3732
3738
|
}): Promise<{
|
|
3733
3739
|
stdout: string;
|
|
3734
3740
|
stderr: string;
|
|
@@ -3836,6 +3842,7 @@ declare const PROVIDER_AUTH: {
|
|
|
3836
3842
|
readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
|
|
3837
3843
|
readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
|
|
3838
3844
|
readonly namespace: readonly [readonly ["NSC_TOKEN"]];
|
|
3845
|
+
readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
|
|
3839
3846
|
};
|
|
3840
3847
|
/**
|
|
3841
3848
|
* All supported provider names (excluding gateway which is special)
|
|
@@ -3948,14 +3955,22 @@ interface ExplicitComputeConfig {
|
|
|
3948
3955
|
};
|
|
3949
3956
|
codesandbox?: {
|
|
3950
3957
|
apiKey?: string;
|
|
3958
|
+
templateId?: string;
|
|
3959
|
+
timeout?: number;
|
|
3951
3960
|
};
|
|
3952
3961
|
blaxel?: {
|
|
3953
3962
|
apiKey?: string;
|
|
3954
3963
|
workspace?: string;
|
|
3964
|
+
image?: string;
|
|
3965
|
+
region?: string;
|
|
3966
|
+
memory?: number;
|
|
3955
3967
|
};
|
|
3956
3968
|
namespace?: {
|
|
3957
3969
|
token?: string;
|
|
3958
3970
|
};
|
|
3971
|
+
hopx?: {
|
|
3972
|
+
apiKey?: string;
|
|
3973
|
+
};
|
|
3959
3974
|
}
|
|
3960
3975
|
/**
|
|
3961
3976
|
* Options for creating a sandbox via the gateway
|
|
@@ -4174,7 +4189,7 @@ declare const GATEWAY_URL = "https://gateway.computesdk.com";
|
|
|
4174
4189
|
* Provider detection priority order
|
|
4175
4190
|
* When multiple provider credentials are detected, use the first one in this list
|
|
4176
4191
|
*/
|
|
4177
|
-
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace"];
|
|
4192
|
+
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx"];
|
|
4178
4193
|
/**
|
|
4179
4194
|
* Required environment variables for each provider
|
|
4180
4195
|
* @deprecated Use PROVIDER_AUTH from provider-config instead
|
|
@@ -4191,6 +4206,7 @@ declare const PROVIDER_ENV_VARS: {
|
|
|
4191
4206
|
readonly codesandbox: readonly ["CSB_API_KEY"];
|
|
4192
4207
|
readonly blaxel: readonly ["BL_API_KEY", "BL_WORKSPACE"];
|
|
4193
4208
|
readonly namespace: readonly ["NSC_TOKEN"];
|
|
4209
|
+
readonly hopx: readonly ["HOPX_API_KEY"];
|
|
4194
4210
|
};
|
|
4195
4211
|
|
|
4196
4212
|
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
|
@@ -3700,6 +3700,7 @@ declare class Sandbox {
|
|
|
3700
3700
|
* @param options.env - Environment variables (server uses cmd.Env)
|
|
3701
3701
|
* @param options.onStdout - Callback for streaming stdout data
|
|
3702
3702
|
* @param options.onStderr - Callback for streaming stderr data
|
|
3703
|
+
* @param options.timeout - Timeout in seconds (max 300 for long-running commands)
|
|
3703
3704
|
* @returns Command execution result
|
|
3704
3705
|
*
|
|
3705
3706
|
* @example
|
|
@@ -3721,6 +3722,9 @@ declare class Sandbox {
|
|
|
3721
3722
|
* onStdout: (data) => console.log(data),
|
|
3722
3723
|
* onStderr: (data) => console.error(data),
|
|
3723
3724
|
* })
|
|
3725
|
+
*
|
|
3726
|
+
* // With timeout for long-running commands
|
|
3727
|
+
* await sandbox.runCommand('npm install', { timeout: 120 })
|
|
3724
3728
|
* ```
|
|
3725
3729
|
*/
|
|
3726
3730
|
runCommand(command: string, options?: {
|
|
@@ -3729,6 +3733,8 @@ declare class Sandbox {
|
|
|
3729
3733
|
env?: Record<string, string>;
|
|
3730
3734
|
onStdout?: (data: string) => void;
|
|
3731
3735
|
onStderr?: (data: string) => void;
|
|
3736
|
+
/** Timeout in seconds (max 300 for long-running commands) */
|
|
3737
|
+
timeout?: number;
|
|
3732
3738
|
}): Promise<{
|
|
3733
3739
|
stdout: string;
|
|
3734
3740
|
stderr: string;
|
|
@@ -3836,6 +3842,7 @@ declare const PROVIDER_AUTH: {
|
|
|
3836
3842
|
readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
|
|
3837
3843
|
readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
|
|
3838
3844
|
readonly namespace: readonly [readonly ["NSC_TOKEN"]];
|
|
3845
|
+
readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
|
|
3839
3846
|
};
|
|
3840
3847
|
/**
|
|
3841
3848
|
* All supported provider names (excluding gateway which is special)
|
|
@@ -3948,14 +3955,22 @@ interface ExplicitComputeConfig {
|
|
|
3948
3955
|
};
|
|
3949
3956
|
codesandbox?: {
|
|
3950
3957
|
apiKey?: string;
|
|
3958
|
+
templateId?: string;
|
|
3959
|
+
timeout?: number;
|
|
3951
3960
|
};
|
|
3952
3961
|
blaxel?: {
|
|
3953
3962
|
apiKey?: string;
|
|
3954
3963
|
workspace?: string;
|
|
3964
|
+
image?: string;
|
|
3965
|
+
region?: string;
|
|
3966
|
+
memory?: number;
|
|
3955
3967
|
};
|
|
3956
3968
|
namespace?: {
|
|
3957
3969
|
token?: string;
|
|
3958
3970
|
};
|
|
3971
|
+
hopx?: {
|
|
3972
|
+
apiKey?: string;
|
|
3973
|
+
};
|
|
3959
3974
|
}
|
|
3960
3975
|
/**
|
|
3961
3976
|
* Options for creating a sandbox via the gateway
|
|
@@ -4174,7 +4189,7 @@ declare const GATEWAY_URL = "https://gateway.computesdk.com";
|
|
|
4174
4189
|
* Provider detection priority order
|
|
4175
4190
|
* When multiple provider credentials are detected, use the first one in this list
|
|
4176
4191
|
*/
|
|
4177
|
-
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace"];
|
|
4192
|
+
declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx"];
|
|
4178
4193
|
/**
|
|
4179
4194
|
* Required environment variables for each provider
|
|
4180
4195
|
* @deprecated Use PROVIDER_AUTH from provider-config instead
|
|
@@ -4191,6 +4206,7 @@ declare const PROVIDER_ENV_VARS: {
|
|
|
4191
4206
|
readonly codesandbox: readonly ["CSB_API_KEY"];
|
|
4192
4207
|
readonly blaxel: readonly ["BL_API_KEY", "BL_WORKSPACE"];
|
|
4193
4208
|
readonly namespace: readonly ["NSC_TOKEN"];
|
|
4209
|
+
readonly hopx: readonly ["HOPX_API_KEY"];
|
|
4194
4210
|
};
|
|
4195
4211
|
|
|
4196
4212
|
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
|
@@ -2364,7 +2364,9 @@ var Sandbox = class {
|
|
|
2364
2364
|
terminal.setWaitCommandHandler(async (cmdId, timeout) => {
|
|
2365
2365
|
const params = timeout ? new URLSearchParams({ timeout: timeout.toString() }) : "";
|
|
2366
2366
|
const endpoint = `/terminals/${terminalId}/commands/${cmdId}/wait${params ? `?${params}` : ""}`;
|
|
2367
|
-
return this.request(endpoint
|
|
2367
|
+
return this.request(endpoint, {
|
|
2368
|
+
headers: timeout ? { "X-Request-Timeout": timeout.toString() } : void 0
|
|
2369
|
+
});
|
|
2368
2370
|
});
|
|
2369
2371
|
terminal.setDestroyHandler(async () => {
|
|
2370
2372
|
await this.request(`/terminals/${terminalId}`, {
|
|
@@ -2380,6 +2382,11 @@ var Sandbox = class {
|
|
|
2380
2382
|
async request(endpoint, options = {}) {
|
|
2381
2383
|
const controller = new AbortController();
|
|
2382
2384
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
2385
|
+
if (process.env.COMPUTESDK_DEBUG) {
|
|
2386
|
+
console.log(`[ComputeSDK] Request: ${options.method || "GET"} ${this.config.sandboxUrl}${endpoint}`);
|
|
2387
|
+
console.log(`[ComputeSDK] Sandbox ID: ${this.config.sandboxId}`);
|
|
2388
|
+
console.log(`[ComputeSDK] Token: ${this._token || "(no token)"}`);
|
|
2389
|
+
}
|
|
2383
2390
|
try {
|
|
2384
2391
|
const headers = {
|
|
2385
2392
|
...this.config.headers
|
|
@@ -2422,6 +2429,15 @@ API request failed (${response.status}): ${error}`
|
|
|
2422
2429
|
);
|
|
2423
2430
|
}
|
|
2424
2431
|
}
|
|
2432
|
+
if (response.status === 403 && process.env.COMPUTESDK_DEBUG) {
|
|
2433
|
+
console.error(`[ComputeSDK] 403 Forbidden Debug Info:`);
|
|
2434
|
+
console.error(` Endpoint: ${endpoint}`);
|
|
2435
|
+
console.error(` Method: ${options.method || "GET"}`);
|
|
2436
|
+
console.error(` Sandbox URL: ${this.config.sandboxUrl}`);
|
|
2437
|
+
console.error(` Sandbox ID: ${this.config.sandboxId}`);
|
|
2438
|
+
console.error(` Token: ${this._token || "(no token)"}`);
|
|
2439
|
+
console.error(` Error: ${error}`);
|
|
2440
|
+
}
|
|
2425
2441
|
throw new Error(`API request failed (${response.status}): ${error}`);
|
|
2426
2442
|
}
|
|
2427
2443
|
return data;
|
|
@@ -2941,7 +2957,9 @@ API request failed (${response.status}): ${error}`
|
|
|
2941
2957
|
async waitForCommand(terminalId, cmdId, timeout) {
|
|
2942
2958
|
const params = timeout ? new URLSearchParams({ timeout: timeout.toString() }) : "";
|
|
2943
2959
|
const endpoint = `/terminals/${terminalId}/commands/${cmdId}/wait${params ? `?${params}` : ""}`;
|
|
2944
|
-
return this.request(endpoint
|
|
2960
|
+
return this.request(endpoint, {
|
|
2961
|
+
headers: timeout ? { "X-Request-Timeout": timeout.toString() } : void 0
|
|
2962
|
+
});
|
|
2945
2963
|
}
|
|
2946
2964
|
/**
|
|
2947
2965
|
* Wait for a background command to complete using long-polling
|
|
@@ -3308,6 +3326,7 @@ API request failed (${response.status}): ${error}`
|
|
|
3308
3326
|
const response = await this.request("/ready");
|
|
3309
3327
|
return {
|
|
3310
3328
|
ready: response.ready,
|
|
3329
|
+
healthy: response.healthy,
|
|
3311
3330
|
servers: response.servers ?? [],
|
|
3312
3331
|
overlays: response.overlays ?? []
|
|
3313
3332
|
};
|
|
@@ -3391,6 +3410,7 @@ API request failed (${response.status}): ${error}`
|
|
|
3391
3410
|
* @param options.env - Environment variables (server uses cmd.Env)
|
|
3392
3411
|
* @param options.onStdout - Callback for streaming stdout data
|
|
3393
3412
|
* @param options.onStderr - Callback for streaming stderr data
|
|
3413
|
+
* @param options.timeout - Timeout in seconds (max 300 for long-running commands)
|
|
3394
3414
|
* @returns Command execution result
|
|
3395
3415
|
*
|
|
3396
3416
|
* @example
|
|
@@ -3412,11 +3432,21 @@ API request failed (${response.status}): ${error}`
|
|
|
3412
3432
|
* onStdout: (data) => console.log(data),
|
|
3413
3433
|
* onStderr: (data) => console.error(data),
|
|
3414
3434
|
* })
|
|
3435
|
+
*
|
|
3436
|
+
* // With timeout for long-running commands
|
|
3437
|
+
* await sandbox.runCommand('npm install', { timeout: 120 })
|
|
3415
3438
|
* ```
|
|
3416
3439
|
*/
|
|
3417
3440
|
async runCommand(command, options) {
|
|
3418
3441
|
const hasStreamingCallbacks = options?.onStdout || options?.onStderr;
|
|
3419
3442
|
if (!hasStreamingCallbacks) {
|
|
3443
|
+
if (options?.timeout && !options?.background) {
|
|
3444
|
+
return this.run.command(command, {
|
|
3445
|
+
...options,
|
|
3446
|
+
background: true,
|
|
3447
|
+
waitForCompletion: { timeoutSeconds: options.timeout }
|
|
3448
|
+
});
|
|
3449
|
+
}
|
|
3420
3450
|
return this.run.command(command, options);
|
|
3421
3451
|
}
|
|
3422
3452
|
const ws = await this.ensureWebSocket();
|
|
@@ -3474,9 +3504,20 @@ API request failed (${response.status}): ${error}`
|
|
|
3474
3504
|
durationMs: 0
|
|
3475
3505
|
};
|
|
3476
3506
|
}
|
|
3477
|
-
|
|
3507
|
+
const commandPromise = new Promise((resolve) => {
|
|
3478
3508
|
resolvePromise = resolve;
|
|
3479
3509
|
});
|
|
3510
|
+
if (options?.timeout) {
|
|
3511
|
+
const timeoutMs = options.timeout * 1e3;
|
|
3512
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
3513
|
+
setTimeout(() => {
|
|
3514
|
+
cleanup();
|
|
3515
|
+
reject(new Error(`Command timed out after ${options.timeout} seconds`));
|
|
3516
|
+
}, timeoutMs);
|
|
3517
|
+
});
|
|
3518
|
+
return Promise.race([commandPromise, timeoutPromise]);
|
|
3519
|
+
}
|
|
3520
|
+
return commandPromise;
|
|
3480
3521
|
}
|
|
3481
3522
|
/**
|
|
3482
3523
|
* Get server information
|
|
@@ -3606,7 +3647,8 @@ var PROVIDER_AUTH = {
|
|
|
3606
3647
|
cloudflare: [["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]],
|
|
3607
3648
|
codesandbox: [["CSB_API_KEY"]],
|
|
3608
3649
|
blaxel: [["BL_API_KEY", "BL_WORKSPACE"]],
|
|
3609
|
-
namespace: [["NSC_TOKEN"]]
|
|
3650
|
+
namespace: [["NSC_TOKEN"]],
|
|
3651
|
+
hopx: [["HOPX_API_KEY"]]
|
|
3610
3652
|
};
|
|
3611
3653
|
var PROVIDER_NAMES = Object.keys(PROVIDER_AUTH);
|
|
3612
3654
|
var PROVIDER_HEADERS = {
|
|
@@ -3643,7 +3685,7 @@ var PROVIDER_HEADERS = {
|
|
|
3643
3685
|
accountId: "X-Cloudflare-Account-Id"
|
|
3644
3686
|
},
|
|
3645
3687
|
codesandbox: {
|
|
3646
|
-
apiKey: "X-
|
|
3688
|
+
apiKey: "X-CODESANDBOX-API-Key"
|
|
3647
3689
|
},
|
|
3648
3690
|
blaxel: {
|
|
3649
3691
|
apiKey: "X-Blaxel-API-Key",
|
|
@@ -3651,6 +3693,9 @@ var PROVIDER_HEADERS = {
|
|
|
3651
3693
|
},
|
|
3652
3694
|
namespace: {
|
|
3653
3695
|
token: "X-Namespace-Token"
|
|
3696
|
+
},
|
|
3697
|
+
hopx: {
|
|
3698
|
+
apiKey: "X-HOPX-API-Key"
|
|
3654
3699
|
}
|
|
3655
3700
|
};
|
|
3656
3701
|
var PROVIDER_ENV_MAP = {
|
|
@@ -3695,6 +3740,9 @@ var PROVIDER_ENV_MAP = {
|
|
|
3695
3740
|
},
|
|
3696
3741
|
namespace: {
|
|
3697
3742
|
NSC_TOKEN: "token"
|
|
3743
|
+
},
|
|
3744
|
+
hopx: {
|
|
3745
|
+
HOPX_API_KEY: "apiKey"
|
|
3698
3746
|
}
|
|
3699
3747
|
};
|
|
3700
3748
|
var PROVIDER_DASHBOARD_URLS = {
|
|
@@ -3708,7 +3756,8 @@ var PROVIDER_DASHBOARD_URLS = {
|
|
|
3708
3756
|
cloudflare: "https://dash.cloudflare.com/profile/api-tokens",
|
|
3709
3757
|
codesandbox: "https://codesandbox.io/dashboard/settings",
|
|
3710
3758
|
blaxel: "https://blaxel.ai/dashboard",
|
|
3711
|
-
namespace: "https://cloud.namespace.so"
|
|
3759
|
+
namespace: "https://cloud.namespace.so",
|
|
3760
|
+
hopx: "https://hopx.ai/dashboard"
|
|
3712
3761
|
};
|
|
3713
3762
|
function isValidProvider(name) {
|
|
3714
3763
|
return name in PROVIDER_AUTH;
|
|
@@ -3777,7 +3826,8 @@ var PROVIDER_PRIORITY = [
|
|
|
3777
3826
|
"cloudflare",
|
|
3778
3827
|
"codesandbox",
|
|
3779
3828
|
"blaxel",
|
|
3780
|
-
"namespace"
|
|
3829
|
+
"namespace",
|
|
3830
|
+
"hopx"
|
|
3781
3831
|
];
|
|
3782
3832
|
var PROVIDER_ENV_VARS = {
|
|
3783
3833
|
e2b: ["E2B_API_KEY"],
|
|
@@ -3790,7 +3840,8 @@ var PROVIDER_ENV_VARS = {
|
|
|
3790
3840
|
cloudflare: ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"],
|
|
3791
3841
|
codesandbox: ["CSB_API_KEY"],
|
|
3792
3842
|
blaxel: ["BL_API_KEY", "BL_WORKSPACE"],
|
|
3793
|
-
namespace: ["NSC_TOKEN"]
|
|
3843
|
+
namespace: ["NSC_TOKEN"],
|
|
3844
|
+
hopx: ["HOPX_API_KEY"]
|
|
3794
3845
|
};
|
|
3795
3846
|
|
|
3796
3847
|
// src/auto-detect.ts
|
|
@@ -3912,6 +3963,11 @@ function getProviderHeaders(provider) {
|
|
|
3912
3963
|
headers["X-Namespace-Token"] = process.env.NSC_TOKEN;
|
|
3913
3964
|
}
|
|
3914
3965
|
break;
|
|
3966
|
+
case "hopx":
|
|
3967
|
+
if (process.env.HOPX_API_KEY) {
|
|
3968
|
+
headers["X-HOPX-API-Key"] = process.env.HOPX_API_KEY;
|
|
3969
|
+
}
|
|
3970
|
+
break;
|
|
3915
3971
|
}
|
|
3916
3972
|
return headers;
|
|
3917
3973
|
}
|
|
@@ -3949,6 +4005,7 @@ To fix this, set one of the following:
|
|
|
3949
4005
|
CodeSandbox: export CSB_API_KEY=xxx
|
|
3950
4006
|
Blaxel: export BL_API_KEY=xxx BL_WORKSPACE=xxx
|
|
3951
4007
|
Namespace: export NSC_TOKEN=xxx
|
|
4008
|
+
HopX: export HOPX_API_KEY=xxx
|
|
3952
4009
|
|
|
3953
4010
|
Or set COMPUTESDK_PROVIDER to specify explicitly:
|
|
3954
4011
|
export COMPUTESDK_PROVIDER=e2b
|
|
@@ -4062,7 +4119,7 @@ Get your API key at: https://computesdk.com/dashboard`
|
|
|
4062
4119
|
const providerHeaders = buildProviderHeaders2(config);
|
|
4063
4120
|
return {
|
|
4064
4121
|
apiKey: computesdkApiKey,
|
|
4065
|
-
gatewayUrl: config.gatewayUrl || GATEWAY_URL,
|
|
4122
|
+
gatewayUrl: config.gatewayUrl || process.env.COMPUTESDK_GATEWAY_URL || GATEWAY_URL,
|
|
4066
4123
|
provider: config.provider,
|
|
4067
4124
|
providerHeaders,
|
|
4068
4125
|
requestTimeoutMs: config.requestTimeoutMs,
|