computesdk 1.19.0 → 1.21.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/index.d.mts +12 -41
- package/dist/index.d.ts +12 -41
- package/dist/index.js +7 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2358,39 +2358,6 @@ declare class Child {
|
|
|
2358
2358
|
}): Promise<void>;
|
|
2359
2359
|
}
|
|
2360
2360
|
|
|
2361
|
-
/**
|
|
2362
|
-
* Ready - Resource namespace for gateway readiness
|
|
2363
|
-
*/
|
|
2364
|
-
|
|
2365
|
-
/**
|
|
2366
|
-
* Ready info returned by readiness endpoint
|
|
2367
|
-
*/
|
|
2368
|
-
interface ReadyInfo {
|
|
2369
|
-
ready: boolean;
|
|
2370
|
-
servers: ReadyResponse['servers'];
|
|
2371
|
-
overlays: ReadyResponse['overlays'];
|
|
2372
|
-
}
|
|
2373
|
-
/**
|
|
2374
|
-
* Ready resource namespace
|
|
2375
|
-
*
|
|
2376
|
-
* @example
|
|
2377
|
-
* ```typescript
|
|
2378
|
-
* const status = await sandbox.ready.get();
|
|
2379
|
-
* console.log(status.ready);
|
|
2380
|
-
* console.log(status.servers);
|
|
2381
|
-
* ```
|
|
2382
|
-
*/
|
|
2383
|
-
declare class Ready {
|
|
2384
|
-
private getHandler;
|
|
2385
|
-
constructor(handlers: {
|
|
2386
|
-
get: () => Promise<ReadyResponse>;
|
|
2387
|
-
});
|
|
2388
|
-
/**
|
|
2389
|
-
* Get readiness status for autostarted servers and overlays
|
|
2390
|
-
*/
|
|
2391
|
-
get(): Promise<ReadyInfo>;
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
2361
|
/**
|
|
2395
2362
|
* Binary WebSocket Protocol Implementation
|
|
2396
2363
|
*
|
|
@@ -2742,6 +2709,8 @@ interface SandboxInfo {
|
|
|
2742
2709
|
is_main: boolean;
|
|
2743
2710
|
created_at: string;
|
|
2744
2711
|
url: string;
|
|
2712
|
+
overlays?: SandboxOverlayInfo[];
|
|
2713
|
+
servers?: SandboxServerInfo[];
|
|
2745
2714
|
}
|
|
2746
2715
|
/**
|
|
2747
2716
|
* Sandboxes list response
|
|
@@ -2846,18 +2815,18 @@ interface ServerInfo {
|
|
|
2846
2815
|
updated_at: string;
|
|
2847
2816
|
}
|
|
2848
2817
|
/**
|
|
2849
|
-
*
|
|
2818
|
+
* Sandbox server info returned by setup flows
|
|
2850
2819
|
*/
|
|
2851
|
-
interface
|
|
2820
|
+
interface SandboxServerInfo {
|
|
2852
2821
|
slug: string;
|
|
2853
2822
|
port?: number;
|
|
2854
2823
|
url?: string;
|
|
2855
2824
|
status: ServerStatus;
|
|
2856
2825
|
}
|
|
2857
2826
|
/**
|
|
2858
|
-
*
|
|
2827
|
+
* Sandbox overlay info returned by setup flows
|
|
2859
2828
|
*/
|
|
2860
|
-
interface
|
|
2829
|
+
interface SandboxOverlayInfo {
|
|
2861
2830
|
id: string;
|
|
2862
2831
|
source: string;
|
|
2863
2832
|
target: string;
|
|
@@ -2868,8 +2837,8 @@ interface ReadyOverlayInfo {
|
|
|
2868
2837
|
*/
|
|
2869
2838
|
interface ReadyResponse {
|
|
2870
2839
|
ready: boolean;
|
|
2871
|
-
servers:
|
|
2872
|
-
overlays:
|
|
2840
|
+
servers: SandboxServerInfo[];
|
|
2841
|
+
overlays: SandboxOverlayInfo[];
|
|
2873
2842
|
}
|
|
2874
2843
|
/**
|
|
2875
2844
|
* Servers list response
|
|
@@ -3076,7 +3045,6 @@ declare class Sandbox {
|
|
|
3076
3045
|
readonly sessionToken: SessionToken;
|
|
3077
3046
|
readonly magicLink: MagicLink;
|
|
3078
3047
|
readonly signal: Signal;
|
|
3079
|
-
readonly ready: Ready;
|
|
3080
3048
|
readonly file: File;
|
|
3081
3049
|
readonly env: Env;
|
|
3082
3050
|
readonly auth: Auth;
|
|
@@ -3626,7 +3594,7 @@ declare class Sandbox {
|
|
|
3626
3594
|
/**
|
|
3627
3595
|
* Get readiness status for autostarted servers and overlays
|
|
3628
3596
|
*/
|
|
3629
|
-
|
|
3597
|
+
ready(): Promise<ReadyResponse>;
|
|
3630
3598
|
/**
|
|
3631
3599
|
* Create a new sandbox environment
|
|
3632
3600
|
*/
|
|
@@ -3879,6 +3847,8 @@ interface ExplicitComputeConfig {
|
|
|
3879
3847
|
computesdkApiKey?: string;
|
|
3880
3848
|
/** Optional gateway URL override */
|
|
3881
3849
|
gatewayUrl?: string;
|
|
3850
|
+
/** HTTP request timeout for gateway calls in milliseconds */
|
|
3851
|
+
requestTimeoutMs?: number;
|
|
3882
3852
|
/**
|
|
3883
3853
|
* WebSocket implementation for environments without native WebSocket support.
|
|
3884
3854
|
* In Node.js < 22, pass the 'ws' package: `import WebSocket from 'ws'`
|
|
@@ -4122,6 +4092,7 @@ interface GatewayConfig {
|
|
|
4122
4092
|
gatewayUrl: string;
|
|
4123
4093
|
provider: string;
|
|
4124
4094
|
providerHeaders: Record<string, string>;
|
|
4095
|
+
requestTimeoutMs?: number;
|
|
4125
4096
|
WebSocket?: WebSocketConstructor;
|
|
4126
4097
|
}
|
|
4127
4098
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2358,39 +2358,6 @@ declare class Child {
|
|
|
2358
2358
|
}): Promise<void>;
|
|
2359
2359
|
}
|
|
2360
2360
|
|
|
2361
|
-
/**
|
|
2362
|
-
* Ready - Resource namespace for gateway readiness
|
|
2363
|
-
*/
|
|
2364
|
-
|
|
2365
|
-
/**
|
|
2366
|
-
* Ready info returned by readiness endpoint
|
|
2367
|
-
*/
|
|
2368
|
-
interface ReadyInfo {
|
|
2369
|
-
ready: boolean;
|
|
2370
|
-
servers: ReadyResponse['servers'];
|
|
2371
|
-
overlays: ReadyResponse['overlays'];
|
|
2372
|
-
}
|
|
2373
|
-
/**
|
|
2374
|
-
* Ready resource namespace
|
|
2375
|
-
*
|
|
2376
|
-
* @example
|
|
2377
|
-
* ```typescript
|
|
2378
|
-
* const status = await sandbox.ready.get();
|
|
2379
|
-
* console.log(status.ready);
|
|
2380
|
-
* console.log(status.servers);
|
|
2381
|
-
* ```
|
|
2382
|
-
*/
|
|
2383
|
-
declare class Ready {
|
|
2384
|
-
private getHandler;
|
|
2385
|
-
constructor(handlers: {
|
|
2386
|
-
get: () => Promise<ReadyResponse>;
|
|
2387
|
-
});
|
|
2388
|
-
/**
|
|
2389
|
-
* Get readiness status for autostarted servers and overlays
|
|
2390
|
-
*/
|
|
2391
|
-
get(): Promise<ReadyInfo>;
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
2361
|
/**
|
|
2395
2362
|
* Binary WebSocket Protocol Implementation
|
|
2396
2363
|
*
|
|
@@ -2742,6 +2709,8 @@ interface SandboxInfo {
|
|
|
2742
2709
|
is_main: boolean;
|
|
2743
2710
|
created_at: string;
|
|
2744
2711
|
url: string;
|
|
2712
|
+
overlays?: SandboxOverlayInfo[];
|
|
2713
|
+
servers?: SandboxServerInfo[];
|
|
2745
2714
|
}
|
|
2746
2715
|
/**
|
|
2747
2716
|
* Sandboxes list response
|
|
@@ -2846,18 +2815,18 @@ interface ServerInfo {
|
|
|
2846
2815
|
updated_at: string;
|
|
2847
2816
|
}
|
|
2848
2817
|
/**
|
|
2849
|
-
*
|
|
2818
|
+
* Sandbox server info returned by setup flows
|
|
2850
2819
|
*/
|
|
2851
|
-
interface
|
|
2820
|
+
interface SandboxServerInfo {
|
|
2852
2821
|
slug: string;
|
|
2853
2822
|
port?: number;
|
|
2854
2823
|
url?: string;
|
|
2855
2824
|
status: ServerStatus;
|
|
2856
2825
|
}
|
|
2857
2826
|
/**
|
|
2858
|
-
*
|
|
2827
|
+
* Sandbox overlay info returned by setup flows
|
|
2859
2828
|
*/
|
|
2860
|
-
interface
|
|
2829
|
+
interface SandboxOverlayInfo {
|
|
2861
2830
|
id: string;
|
|
2862
2831
|
source: string;
|
|
2863
2832
|
target: string;
|
|
@@ -2868,8 +2837,8 @@ interface ReadyOverlayInfo {
|
|
|
2868
2837
|
*/
|
|
2869
2838
|
interface ReadyResponse {
|
|
2870
2839
|
ready: boolean;
|
|
2871
|
-
servers:
|
|
2872
|
-
overlays:
|
|
2840
|
+
servers: SandboxServerInfo[];
|
|
2841
|
+
overlays: SandboxOverlayInfo[];
|
|
2873
2842
|
}
|
|
2874
2843
|
/**
|
|
2875
2844
|
* Servers list response
|
|
@@ -3076,7 +3045,6 @@ declare class Sandbox {
|
|
|
3076
3045
|
readonly sessionToken: SessionToken;
|
|
3077
3046
|
readonly magicLink: MagicLink;
|
|
3078
3047
|
readonly signal: Signal;
|
|
3079
|
-
readonly ready: Ready;
|
|
3080
3048
|
readonly file: File;
|
|
3081
3049
|
readonly env: Env;
|
|
3082
3050
|
readonly auth: Auth;
|
|
@@ -3626,7 +3594,7 @@ declare class Sandbox {
|
|
|
3626
3594
|
/**
|
|
3627
3595
|
* Get readiness status for autostarted servers and overlays
|
|
3628
3596
|
*/
|
|
3629
|
-
|
|
3597
|
+
ready(): Promise<ReadyResponse>;
|
|
3630
3598
|
/**
|
|
3631
3599
|
* Create a new sandbox environment
|
|
3632
3600
|
*/
|
|
@@ -3879,6 +3847,8 @@ interface ExplicitComputeConfig {
|
|
|
3879
3847
|
computesdkApiKey?: string;
|
|
3880
3848
|
/** Optional gateway URL override */
|
|
3881
3849
|
gatewayUrl?: string;
|
|
3850
|
+
/** HTTP request timeout for gateway calls in milliseconds */
|
|
3851
|
+
requestTimeoutMs?: number;
|
|
3882
3852
|
/**
|
|
3883
3853
|
* WebSocket implementation for environments without native WebSocket support.
|
|
3884
3854
|
* In Node.js < 22, pass the 'ws' package: `import WebSocket from 'ws'`
|
|
@@ -4122,6 +4092,7 @@ interface GatewayConfig {
|
|
|
4122
4092
|
gatewayUrl: string;
|
|
4123
4093
|
provider: string;
|
|
4124
4094
|
providerHeaders: Record<string, string>;
|
|
4095
|
+
requestTimeoutMs?: number;
|
|
4125
4096
|
WebSocket?: WebSocketConstructor;
|
|
4126
4097
|
}
|
|
4127
4098
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2108,24 +2108,6 @@ Try increasing maxRetries or check if the source directory is very large.`
|
|
|
2108
2108
|
}
|
|
2109
2109
|
};
|
|
2110
2110
|
|
|
2111
|
-
// src/client/resources/ready.ts
|
|
2112
|
-
var Ready = class {
|
|
2113
|
-
constructor(handlers) {
|
|
2114
|
-
this.getHandler = handlers.get;
|
|
2115
|
-
}
|
|
2116
|
-
/**
|
|
2117
|
-
* Get readiness status for autostarted servers and overlays
|
|
2118
|
-
*/
|
|
2119
|
-
async get() {
|
|
2120
|
-
const response = await this.getHandler();
|
|
2121
|
-
return {
|
|
2122
|
-
ready: response.ready,
|
|
2123
|
-
servers: response.servers ?? [],
|
|
2124
|
-
overlays: response.overlays ?? []
|
|
2125
|
-
};
|
|
2126
|
-
}
|
|
2127
|
-
};
|
|
2128
|
-
|
|
2129
2111
|
// src/client/types.ts
|
|
2130
2112
|
var CommandExitError = class extends Error {
|
|
2131
2113
|
constructor(result) {
|
|
@@ -2286,9 +2268,6 @@ var Sandbox = class {
|
|
|
2286
2268
|
},
|
|
2287
2269
|
logs: async (slug, options) => this.getServerLogs(slug, options)
|
|
2288
2270
|
});
|
|
2289
|
-
this.ready = new Ready({
|
|
2290
|
-
get: async () => this.getReady()
|
|
2291
|
-
});
|
|
2292
2271
|
this.watcher = new Watcher({
|
|
2293
2272
|
create: async (path, options) => this.createWatcher(path, options),
|
|
2294
2273
|
list: async () => this.listWatchers(),
|
|
@@ -3325,7 +3304,7 @@ API request failed (${response.status}): ${error}`
|
|
|
3325
3304
|
/**
|
|
3326
3305
|
* Get readiness status for autostarted servers and overlays
|
|
3327
3306
|
*/
|
|
3328
|
-
async
|
|
3307
|
+
async ready() {
|
|
3329
3308
|
const response = await this.request("/ready");
|
|
3330
3309
|
return {
|
|
3331
3310
|
ready: response.ready,
|
|
@@ -4086,6 +4065,7 @@ Get your API key at: https://computesdk.com/dashboard`
|
|
|
4086
4065
|
gatewayUrl: config.gatewayUrl || GATEWAY_URL,
|
|
4087
4066
|
provider: config.provider,
|
|
4088
4067
|
providerHeaders,
|
|
4068
|
+
requestTimeoutMs: config.requestTimeoutMs,
|
|
4089
4069
|
WebSocket: config.WebSocket
|
|
4090
4070
|
};
|
|
4091
4071
|
}
|
|
@@ -4133,7 +4113,7 @@ Troubleshooting:
|
|
|
4133
4113
|
|
|
4134
4114
|
// src/compute.ts
|
|
4135
4115
|
async function gatewayFetch(url, config, options = {}) {
|
|
4136
|
-
const timeout = 3e4;
|
|
4116
|
+
const timeout = config.requestTimeoutMs ?? 3e4;
|
|
4137
4117
|
const controller = new AbortController();
|
|
4138
4118
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
4139
4119
|
try {
|
|
@@ -4237,7 +4217,7 @@ var ComputeManager = class {
|
|
|
4237
4217
|
if (!result.success || !result.data) {
|
|
4238
4218
|
throw new Error(`Gateway returned invalid response`);
|
|
4239
4219
|
}
|
|
4240
|
-
const { sandboxId, url, token, provider, metadata, name, namespace } = result.data;
|
|
4220
|
+
const { sandboxId, url, token, provider, metadata, name, namespace, overlays, servers } = result.data;
|
|
4241
4221
|
const sandbox = new Sandbox({
|
|
4242
4222
|
sandboxUrl: url,
|
|
4243
4223
|
sandboxId,
|
|
@@ -4246,7 +4226,9 @@ var ComputeManager = class {
|
|
|
4246
4226
|
metadata: {
|
|
4247
4227
|
...metadata,
|
|
4248
4228
|
...name && { name },
|
|
4249
|
-
...namespace && { namespace }
|
|
4229
|
+
...namespace && { namespace },
|
|
4230
|
+
...overlays && { overlays },
|
|
4231
|
+
...servers && { servers }
|
|
4250
4232
|
},
|
|
4251
4233
|
WebSocket: config.WebSocket || globalThis.WebSocket,
|
|
4252
4234
|
destroyHandler: async () => {
|