computesdk 1.18.2 → 1.20.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 +477 -286
- package/dist/index.d.ts +477 -286
- package/dist/index.js +126 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -113,8 +113,36 @@ interface CreateSandboxOptions$1 {
|
|
|
113
113
|
envs?: Record<string, string>;
|
|
114
114
|
name?: string;
|
|
115
115
|
namespace?: string;
|
|
116
|
+
directory?: string;
|
|
117
|
+
overlays?: SandboxOverlayConfig[];
|
|
118
|
+
servers?: SandboxServerConfig[];
|
|
116
119
|
[key: string]: any;
|
|
117
120
|
}
|
|
121
|
+
interface SandboxOverlayConfig {
|
|
122
|
+
source: string;
|
|
123
|
+
target: string;
|
|
124
|
+
ignore?: string[];
|
|
125
|
+
strategy?: 'copy' | 'smart';
|
|
126
|
+
}
|
|
127
|
+
type SandboxRestartPolicy = 'never' | 'on-failure' | 'always';
|
|
128
|
+
interface SandboxServerConfig {
|
|
129
|
+
slug: string;
|
|
130
|
+
start: string;
|
|
131
|
+
install?: string;
|
|
132
|
+
path?: string;
|
|
133
|
+
port?: number;
|
|
134
|
+
strict_port?: boolean;
|
|
135
|
+
autostart?: boolean;
|
|
136
|
+
env_file?: string;
|
|
137
|
+
environment?: Record<string, string>;
|
|
138
|
+
restart_policy?: SandboxRestartPolicy;
|
|
139
|
+
max_restarts?: number;
|
|
140
|
+
restart_delay_ms?: number;
|
|
141
|
+
stop_timeout_ms?: number;
|
|
142
|
+
depends_on?: string[];
|
|
143
|
+
overlay?: SandboxOverlayConfig;
|
|
144
|
+
overlays?: SandboxOverlayConfig[];
|
|
145
|
+
}
|
|
118
146
|
/**
|
|
119
147
|
* Universal Sandbox Interface
|
|
120
148
|
*
|
|
@@ -1099,6 +1127,212 @@ declare class Terminal {
|
|
|
1099
1127
|
destroy(id: string): Promise<void>;
|
|
1100
1128
|
}
|
|
1101
1129
|
|
|
1130
|
+
/**
|
|
1131
|
+
* Overlay - Resource namespace for filesystem overlay operations
|
|
1132
|
+
*
|
|
1133
|
+
* Overlays enable instant sandbox setup from template directories by copying
|
|
1134
|
+
* files directly for isolation, with heavy directories copied in the background.
|
|
1135
|
+
*/
|
|
1136
|
+
/**
|
|
1137
|
+
* Options for waiting for overlay copy completion
|
|
1138
|
+
*/
|
|
1139
|
+
interface WaitForCompletionOptions {
|
|
1140
|
+
/** Maximum number of retry attempts (default: 60) */
|
|
1141
|
+
maxRetries?: number;
|
|
1142
|
+
/** Initial delay between retries in milliseconds (default: 500) */
|
|
1143
|
+
initialDelayMs?: number;
|
|
1144
|
+
/** Maximum delay between retries in milliseconds (default: 5000) */
|
|
1145
|
+
maxDelayMs?: number;
|
|
1146
|
+
/** Backoff multiplier for exponential backoff (default: 1.5) */
|
|
1147
|
+
backoffFactor?: number;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Strategy for creating an overlay
|
|
1151
|
+
* - 'copy': Full copy of all files (standard behavior)
|
|
1152
|
+
* - 'smart': Use symlinks for immutable packages (e.g. node_modules) for instant creation
|
|
1153
|
+
*/
|
|
1154
|
+
type OverlayStrategy = 'copy' | 'smart';
|
|
1155
|
+
/**
|
|
1156
|
+
* Options for creating an overlay
|
|
1157
|
+
*/
|
|
1158
|
+
interface CreateOverlayOptions {
|
|
1159
|
+
/** Absolute path to source directory (template) */
|
|
1160
|
+
source: string;
|
|
1161
|
+
/** Relative path in sandbox where overlay will be mounted */
|
|
1162
|
+
target: string;
|
|
1163
|
+
/** Glob patterns to ignore (e.g., ["node_modules", "*.log"]) */
|
|
1164
|
+
ignore?: string[];
|
|
1165
|
+
/** Strategy to use (default: 'smart') */
|
|
1166
|
+
strategy?: OverlayStrategy;
|
|
1167
|
+
/** If true, wait for background copy to complete before returning (default: false) */
|
|
1168
|
+
waitForCompletion?: boolean | WaitForCompletionOptions;
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Copy status for overlay background operations
|
|
1172
|
+
*/
|
|
1173
|
+
type OverlayCopyStatus = 'pending' | 'in_progress' | 'complete' | 'failed';
|
|
1174
|
+
/**
|
|
1175
|
+
* Statistics about an overlay
|
|
1176
|
+
*/
|
|
1177
|
+
interface OverlayStats {
|
|
1178
|
+
/** Number of copied files */
|
|
1179
|
+
copiedFiles: number;
|
|
1180
|
+
/** Number of copied directories (heavy dirs copied in background) */
|
|
1181
|
+
copiedDirs: number;
|
|
1182
|
+
/** Paths that were skipped (e.g., .git, ignored patterns) */
|
|
1183
|
+
skipped: string[];
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Overlay information (client-side normalized type)
|
|
1187
|
+
*/
|
|
1188
|
+
interface OverlayInfo {
|
|
1189
|
+
/** Unique overlay identifier */
|
|
1190
|
+
id: string;
|
|
1191
|
+
/** Absolute path to source directory */
|
|
1192
|
+
source: string;
|
|
1193
|
+
/** Relative path in sandbox */
|
|
1194
|
+
target: string;
|
|
1195
|
+
/** Strategy used for the overlay */
|
|
1196
|
+
strategy: OverlayStrategy;
|
|
1197
|
+
/** When the overlay was created */
|
|
1198
|
+
createdAt: string;
|
|
1199
|
+
/** Statistics about the overlay */
|
|
1200
|
+
stats: OverlayStats;
|
|
1201
|
+
/** Copy status for background operations */
|
|
1202
|
+
copyStatus: OverlayCopyStatus;
|
|
1203
|
+
/** Error message if copy failed */
|
|
1204
|
+
copyError?: string;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* API response for overlay operations (snake_case from server)
|
|
1208
|
+
*/
|
|
1209
|
+
interface OverlayResponse {
|
|
1210
|
+
id: string;
|
|
1211
|
+
source: string;
|
|
1212
|
+
target: string;
|
|
1213
|
+
strategy?: string;
|
|
1214
|
+
created_at: string;
|
|
1215
|
+
stats: {
|
|
1216
|
+
copied_files: number;
|
|
1217
|
+
copied_dirs: number;
|
|
1218
|
+
skipped: string[];
|
|
1219
|
+
};
|
|
1220
|
+
copy_status: string;
|
|
1221
|
+
copy_error?: string;
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* API response for listing overlays
|
|
1225
|
+
*/
|
|
1226
|
+
interface OverlayListResponse {
|
|
1227
|
+
overlays: OverlayResponse[];
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Overlay resource namespace
|
|
1231
|
+
*
|
|
1232
|
+
* @example
|
|
1233
|
+
* ```typescript
|
|
1234
|
+
* // Create an overlay from a template directory
|
|
1235
|
+
* const overlay = await sandbox.filesystem.overlay.create({
|
|
1236
|
+
* source: '/templates/nextjs',
|
|
1237
|
+
* target: 'project',
|
|
1238
|
+
* });
|
|
1239
|
+
* console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
|
|
1240
|
+
*
|
|
1241
|
+
* // Create an overlay and wait for background copy to complete
|
|
1242
|
+
* const overlay = await sandbox.filesystem.overlay.create({
|
|
1243
|
+
* source: '/templates/nextjs',
|
|
1244
|
+
* target: 'project',
|
|
1245
|
+
* waitForCompletion: true, // blocks until copy is complete
|
|
1246
|
+
* });
|
|
1247
|
+
*
|
|
1248
|
+
* // Wait for an existing overlay's copy to complete
|
|
1249
|
+
* const overlay = await sandbox.filesystem.overlay.waitForCompletion('overlay-id');
|
|
1250
|
+
*
|
|
1251
|
+
* // List all overlays
|
|
1252
|
+
* const overlays = await sandbox.filesystem.overlay.list();
|
|
1253
|
+
*
|
|
1254
|
+
* // Get a specific overlay (useful for polling copy status)
|
|
1255
|
+
* const overlay = await sandbox.filesystem.overlay.retrieve('overlay-id');
|
|
1256
|
+
* if (overlay.copyStatus === 'complete') {
|
|
1257
|
+
* console.log('Background copy finished!');
|
|
1258
|
+
* }
|
|
1259
|
+
*
|
|
1260
|
+
* // Delete an overlay
|
|
1261
|
+
* await sandbox.filesystem.overlay.destroy('overlay-id');
|
|
1262
|
+
* ```
|
|
1263
|
+
*/
|
|
1264
|
+
declare class Overlay {
|
|
1265
|
+
private createHandler;
|
|
1266
|
+
private listHandler;
|
|
1267
|
+
private retrieveHandler;
|
|
1268
|
+
private destroyHandler;
|
|
1269
|
+
constructor(handlers: {
|
|
1270
|
+
create: (options: CreateOverlayOptions) => Promise<OverlayResponse>;
|
|
1271
|
+
list: () => Promise<OverlayListResponse>;
|
|
1272
|
+
retrieve: (id: string) => Promise<OverlayResponse>;
|
|
1273
|
+
destroy: (id: string) => Promise<void>;
|
|
1274
|
+
});
|
|
1275
|
+
/**
|
|
1276
|
+
* Create a new overlay from a template directory
|
|
1277
|
+
*
|
|
1278
|
+
* The overlay copies files from the source directory into the target path
|
|
1279
|
+
* for better isolation. Heavy directories (node_modules, .venv, etc.) are
|
|
1280
|
+
* copied in the background. Use the `ignore` option to exclude files/directories.
|
|
1281
|
+
*
|
|
1282
|
+
* @param options - Overlay creation options
|
|
1283
|
+
* @param options.source - Absolute path to source directory
|
|
1284
|
+
* @param options.target - Relative path in sandbox
|
|
1285
|
+
* @param options.ignore - Glob patterns to ignore (e.g., ["node_modules", "*.log"])
|
|
1286
|
+
* @param options.strategy - Strategy to use ('copy' or 'smart')
|
|
1287
|
+
* @param options.waitForCompletion - If true or options object, wait for background copy to complete
|
|
1288
|
+
* @returns Overlay info with copy status
|
|
1289
|
+
*/
|
|
1290
|
+
create(options: CreateOverlayOptions): Promise<OverlayInfo>;
|
|
1291
|
+
/**
|
|
1292
|
+
* List all overlays for the current sandbox
|
|
1293
|
+
* @returns Array of overlay info
|
|
1294
|
+
*/
|
|
1295
|
+
list(): Promise<OverlayInfo[]>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Retrieve a specific overlay by ID
|
|
1298
|
+
*
|
|
1299
|
+
* Useful for polling the copy status of an overlay.
|
|
1300
|
+
*
|
|
1301
|
+
* @param id - Overlay ID
|
|
1302
|
+
* @returns Overlay info
|
|
1303
|
+
*/
|
|
1304
|
+
retrieve(id: string): Promise<OverlayInfo>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Destroy (delete) an overlay
|
|
1307
|
+
* @param id - Overlay ID
|
|
1308
|
+
*/
|
|
1309
|
+
destroy(id: string): Promise<void>;
|
|
1310
|
+
/**
|
|
1311
|
+
* Wait for an overlay's background copy to complete
|
|
1312
|
+
*
|
|
1313
|
+
* Polls the overlay status with exponential backoff until the copy
|
|
1314
|
+
* is complete or fails. Throws an error if the copy fails or times out.
|
|
1315
|
+
*
|
|
1316
|
+
* @param id - Overlay ID
|
|
1317
|
+
* @param options - Polling options
|
|
1318
|
+
* @returns Overlay info with final copy status
|
|
1319
|
+
* @throws Error if copy fails or times out
|
|
1320
|
+
*/
|
|
1321
|
+
waitForCompletion(id: string, options?: WaitForCompletionOptions): Promise<OverlayInfo>;
|
|
1322
|
+
/**
|
|
1323
|
+
* Convert API response to OverlayInfo
|
|
1324
|
+
*/
|
|
1325
|
+
private toOverlayInfo;
|
|
1326
|
+
/**
|
|
1327
|
+
* Validate and return strategy, defaulting to 'copy' for unknown/missing values (legacy support)
|
|
1328
|
+
*/
|
|
1329
|
+
private validateStrategy;
|
|
1330
|
+
/**
|
|
1331
|
+
* Validate and return copy status, defaulting to 'pending' for unknown values
|
|
1332
|
+
*/
|
|
1333
|
+
private validateCopyStatus;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1102
1336
|
/**
|
|
1103
1337
|
* Server - Resource namespace for managed server operations
|
|
1104
1338
|
*/
|
|
@@ -1119,6 +1353,18 @@ interface ServerStartOptions {
|
|
|
1119
1353
|
env_file?: string;
|
|
1120
1354
|
/** Inline environment variables (merged with env_file if both provided) */
|
|
1121
1355
|
environment?: Record<string, string>;
|
|
1356
|
+
/** Requested port number (preallocated before start) */
|
|
1357
|
+
port?: number;
|
|
1358
|
+
/** If true, fail instead of auto-incrementing when port is taken */
|
|
1359
|
+
strict_port?: boolean;
|
|
1360
|
+
/** Whether to auto-start the server on daemon boot (default: true) */
|
|
1361
|
+
autostart?: boolean;
|
|
1362
|
+
/** Inline overlay to create before starting the server */
|
|
1363
|
+
overlay?: Omit<CreateOverlayOptions, 'waitForCompletion'>;
|
|
1364
|
+
/** Additional overlays to create before starting the server */
|
|
1365
|
+
overlays?: Array<Omit<CreateOverlayOptions, 'waitForCompletion'>>;
|
|
1366
|
+
/** Overlay IDs this server depends on (waits for copy completion) */
|
|
1367
|
+
depends_on?: string[];
|
|
1122
1368
|
/**
|
|
1123
1369
|
* When to automatically restart the server:
|
|
1124
1370
|
* - `never`: No automatic restart (default)
|
|
@@ -1164,6 +1410,18 @@ interface ServerStartOptions {
|
|
|
1164
1410
|
* restart_delay_ms: 2000,
|
|
1165
1411
|
* });
|
|
1166
1412
|
*
|
|
1413
|
+
* // Start with inline overlay dependencies
|
|
1414
|
+
* const server = await sandbox.server.start({
|
|
1415
|
+
* slug: 'web',
|
|
1416
|
+
* start: 'npm run dev',
|
|
1417
|
+
* path: '/app',
|
|
1418
|
+
* overlay: {
|
|
1419
|
+
* source: '/templates/nextjs',
|
|
1420
|
+
* target: 'app',
|
|
1421
|
+
* strategy: 'smart',
|
|
1422
|
+
* },
|
|
1423
|
+
* });
|
|
1424
|
+
*
|
|
1167
1425
|
* // List all servers
|
|
1168
1426
|
* const servers = await sandbox.server.list();
|
|
1169
1427
|
*
|
|
@@ -1173,6 +1431,9 @@ interface ServerStartOptions {
|
|
|
1173
1431
|
* // Stop a server (graceful shutdown with SIGTERM → SIGKILL)
|
|
1174
1432
|
* await sandbox.server.stop('api');
|
|
1175
1433
|
*
|
|
1434
|
+
* // Delete a server config
|
|
1435
|
+
* await sandbox.server.delete('api');
|
|
1436
|
+
*
|
|
1176
1437
|
* // Restart a server
|
|
1177
1438
|
* await sandbox.server.restart('api');
|
|
1178
1439
|
* ```
|
|
@@ -1200,6 +1461,7 @@ declare class Server {
|
|
|
1200
1461
|
private listHandler;
|
|
1201
1462
|
private retrieveHandler;
|
|
1202
1463
|
private stopHandler;
|
|
1464
|
+
private deleteHandler;
|
|
1203
1465
|
private restartHandler;
|
|
1204
1466
|
private updateStatusHandler;
|
|
1205
1467
|
private logsHandler;
|
|
@@ -1208,6 +1470,7 @@ declare class Server {
|
|
|
1208
1470
|
list: () => Promise<ServersListResponse>;
|
|
1209
1471
|
retrieve: (slug: string) => Promise<ServerResponse>;
|
|
1210
1472
|
stop: (slug: string) => Promise<ServerStopResponse | void>;
|
|
1473
|
+
delete: (slug: string) => Promise<void>;
|
|
1211
1474
|
restart: (slug: string) => Promise<ServerResponse>;
|
|
1212
1475
|
updateStatus: (slug: string, status: ServerStatus) => Promise<void>;
|
|
1213
1476
|
logs: (slug: string, options?: ServerLogsOptions) => Promise<ServerLogsResponse>;
|
|
@@ -1264,10 +1527,15 @@ declare class Server {
|
|
|
1264
1527
|
*/
|
|
1265
1528
|
retrieve(slug: string): Promise<ServerInfo>;
|
|
1266
1529
|
/**
|
|
1267
|
-
* Stop a server by slug
|
|
1530
|
+
* Stop a server by slug (non-destructive)
|
|
1268
1531
|
* @param slug - The server slug
|
|
1269
1532
|
*/
|
|
1270
1533
|
stop(slug: string): Promise<void>;
|
|
1534
|
+
/**
|
|
1535
|
+
* Delete a server config by slug (stops + removes persistence)
|
|
1536
|
+
* @param slug - The server slug
|
|
1537
|
+
*/
|
|
1538
|
+
delete(slug: string): Promise<void>;
|
|
1271
1539
|
/**
|
|
1272
1540
|
* Restart a server by slug
|
|
1273
1541
|
* @param slug - The server slug
|
|
@@ -1955,30 +2223,99 @@ declare class Run {
|
|
|
1955
2223
|
}
|
|
1956
2224
|
|
|
1957
2225
|
/**
|
|
1958
|
-
*
|
|
2226
|
+
* Client Types
|
|
2227
|
+
*
|
|
2228
|
+
* Types specific to the gateway Sandbox client implementation.
|
|
2229
|
+
* Core universal types are imported from ../types/universal-sandbox
|
|
1959
2230
|
*/
|
|
1960
2231
|
|
|
1961
2232
|
/**
|
|
1962
|
-
*
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
*
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2233
|
+
* Sandbox status types (client-specific, more limited than universal)
|
|
2234
|
+
*/
|
|
2235
|
+
type SandboxStatus = 'running' | 'stopped' | 'error';
|
|
2236
|
+
/**
|
|
2237
|
+
* Provider-agnostic sandbox info (alias for SandboxInfo for backward compatibility)
|
|
2238
|
+
*/
|
|
2239
|
+
interface ProviderSandboxInfo {
|
|
2240
|
+
/** Unique identifier for the sandbox */
|
|
2241
|
+
id: string;
|
|
2242
|
+
/** Provider hosting the sandbox */
|
|
2243
|
+
provider: string;
|
|
2244
|
+
/** Runtime environment in the sandbox */
|
|
2245
|
+
runtime: Runtime;
|
|
2246
|
+
/** Current status of the sandbox */
|
|
2247
|
+
status: SandboxStatus;
|
|
2248
|
+
/** When the sandbox was created */
|
|
2249
|
+
createdAt: Date;
|
|
2250
|
+
/** Execution timeout in milliseconds */
|
|
2251
|
+
timeout: number;
|
|
2252
|
+
/** Additional provider-specific metadata */
|
|
2253
|
+
metadata?: Record<string, any>;
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Error thrown when a command exits with a non-zero status
|
|
2257
|
+
*/
|
|
2258
|
+
declare class CommandExitError extends Error {
|
|
2259
|
+
result: {
|
|
2260
|
+
exitCode: number;
|
|
2261
|
+
stdout: string;
|
|
2262
|
+
stderr: string;
|
|
2263
|
+
error: boolean;
|
|
2264
|
+
};
|
|
2265
|
+
name: string;
|
|
2266
|
+
constructor(result: {
|
|
2267
|
+
exitCode: number;
|
|
2268
|
+
stdout: string;
|
|
2269
|
+
stderr: string;
|
|
2270
|
+
error: boolean;
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Type guard to check if an error is a CommandExitError
|
|
2275
|
+
*/
|
|
2276
|
+
declare function isCommandExitError(error: unknown): error is CommandExitError;
|
|
2277
|
+
|
|
2278
|
+
/**
|
|
2279
|
+
* Child - Resource namespace for child sandbox operations
|
|
2280
|
+
*/
|
|
2281
|
+
|
|
2282
|
+
/**
|
|
2283
|
+
* Child resource namespace for managing child sandboxes
|
|
2284
|
+
*
|
|
2285
|
+
* Child sandboxes are isolated environments within the parent sandbox,
|
|
2286
|
+
* each with their own filesystem. Available only in multi-tenant mode.
|
|
2287
|
+
*
|
|
2288
|
+
* @example
|
|
2289
|
+
* ```typescript
|
|
2290
|
+
* // Create a new child sandbox
|
|
2291
|
+
* const child = await sandbox.child.create({
|
|
2292
|
+
* directory: '/custom/path',
|
|
2293
|
+
* overlays: [
|
|
2294
|
+
* {
|
|
2295
|
+
* source: '/templates/nextjs',
|
|
2296
|
+
* target: 'app',
|
|
2297
|
+
* strategy: 'smart',
|
|
2298
|
+
* },
|
|
2299
|
+
* ],
|
|
2300
|
+
* servers: [
|
|
2301
|
+
* {
|
|
2302
|
+
* slug: 'web',
|
|
2303
|
+
* start: 'npm run dev',
|
|
2304
|
+
* path: '/app',
|
|
2305
|
+
* },
|
|
2306
|
+
* ],
|
|
2307
|
+
* });
|
|
2308
|
+
* console.log(child.url); // https://sandbox-12345.sandbox.computesdk.com
|
|
2309
|
+
*
|
|
2310
|
+
* // List all children
|
|
2311
|
+
* const all = await sandbox.child.list();
|
|
2312
|
+
*
|
|
2313
|
+
* // Get a specific child
|
|
2314
|
+
* const info = await sandbox.child.retrieve('sandbox-12345');
|
|
2315
|
+
*
|
|
2316
|
+
* // Delete a child sandbox
|
|
2317
|
+
* await sandbox.child.destroy('sandbox-12345');
|
|
2318
|
+
*
|
|
1982
2319
|
* // Delete child and its files
|
|
1983
2320
|
* await sandbox.child.destroy('sandbox-12345', { deleteFiles: true });
|
|
1984
2321
|
* ```
|
|
@@ -1989,7 +2326,7 @@ declare class Child {
|
|
|
1989
2326
|
private retrieveHandler;
|
|
1990
2327
|
private destroyHandler;
|
|
1991
2328
|
constructor(handlers: {
|
|
1992
|
-
create: () => Promise<SandboxInfo>;
|
|
2329
|
+
create: (options?: CreateSandboxOptions$1) => Promise<SandboxInfo>;
|
|
1993
2330
|
list: () => Promise<SandboxesListResponse>;
|
|
1994
2331
|
retrieve: (subdomain: string) => Promise<SandboxInfo>;
|
|
1995
2332
|
destroy: (subdomain: string, deleteFiles: boolean) => Promise<void>;
|
|
@@ -1998,7 +2335,7 @@ declare class Child {
|
|
|
1998
2335
|
* Create a new child sandbox
|
|
1999
2336
|
* @returns Child sandbox info including URL and subdomain
|
|
2000
2337
|
*/
|
|
2001
|
-
create(): Promise<SandboxInfo>;
|
|
2338
|
+
create(options?: CreateSandboxOptions$1): Promise<SandboxInfo>;
|
|
2002
2339
|
/**
|
|
2003
2340
|
* List all child sandboxes
|
|
2004
2341
|
* @returns Array of child sandbox info
|
|
@@ -2021,212 +2358,6 @@ declare class Child {
|
|
|
2021
2358
|
}): Promise<void>;
|
|
2022
2359
|
}
|
|
2023
2360
|
|
|
2024
|
-
/**
|
|
2025
|
-
* Overlay - Resource namespace for filesystem overlay operations
|
|
2026
|
-
*
|
|
2027
|
-
* Overlays enable instant sandbox setup from template directories by copying
|
|
2028
|
-
* files directly for isolation, with heavy directories copied in the background.
|
|
2029
|
-
*/
|
|
2030
|
-
/**
|
|
2031
|
-
* Options for waiting for overlay copy completion
|
|
2032
|
-
*/
|
|
2033
|
-
interface WaitForCompletionOptions {
|
|
2034
|
-
/** Maximum number of retry attempts (default: 60) */
|
|
2035
|
-
maxRetries?: number;
|
|
2036
|
-
/** Initial delay between retries in milliseconds (default: 500) */
|
|
2037
|
-
initialDelayMs?: number;
|
|
2038
|
-
/** Maximum delay between retries in milliseconds (default: 5000) */
|
|
2039
|
-
maxDelayMs?: number;
|
|
2040
|
-
/** Backoff multiplier for exponential backoff (default: 1.5) */
|
|
2041
|
-
backoffFactor?: number;
|
|
2042
|
-
}
|
|
2043
|
-
/**
|
|
2044
|
-
* Strategy for creating an overlay
|
|
2045
|
-
* - 'copy': Full copy of all files (standard behavior)
|
|
2046
|
-
* - 'smart': Use symlinks for immutable packages (e.g. node_modules) for instant creation
|
|
2047
|
-
*/
|
|
2048
|
-
type OverlayStrategy = 'copy' | 'smart';
|
|
2049
|
-
/**
|
|
2050
|
-
* Options for creating an overlay
|
|
2051
|
-
*/
|
|
2052
|
-
interface CreateOverlayOptions {
|
|
2053
|
-
/** Absolute path to source directory (template) */
|
|
2054
|
-
source: string;
|
|
2055
|
-
/** Relative path in sandbox where overlay will be mounted */
|
|
2056
|
-
target: string;
|
|
2057
|
-
/** Glob patterns to ignore (e.g., ["node_modules", "*.log"]) */
|
|
2058
|
-
ignore?: string[];
|
|
2059
|
-
/** Strategy to use (default: 'smart') */
|
|
2060
|
-
strategy?: OverlayStrategy;
|
|
2061
|
-
/** If true, wait for background copy to complete before returning (default: false) */
|
|
2062
|
-
waitForCompletion?: boolean | WaitForCompletionOptions;
|
|
2063
|
-
}
|
|
2064
|
-
/**
|
|
2065
|
-
* Copy status for overlay background operations
|
|
2066
|
-
*/
|
|
2067
|
-
type OverlayCopyStatus = 'pending' | 'in_progress' | 'complete' | 'failed';
|
|
2068
|
-
/**
|
|
2069
|
-
* Statistics about an overlay
|
|
2070
|
-
*/
|
|
2071
|
-
interface OverlayStats {
|
|
2072
|
-
/** Number of copied files */
|
|
2073
|
-
copiedFiles: number;
|
|
2074
|
-
/** Number of copied directories (heavy dirs copied in background) */
|
|
2075
|
-
copiedDirs: number;
|
|
2076
|
-
/** Paths that were skipped (e.g., .git, ignored patterns) */
|
|
2077
|
-
skipped: string[];
|
|
2078
|
-
}
|
|
2079
|
-
/**
|
|
2080
|
-
* Overlay information (client-side normalized type)
|
|
2081
|
-
*/
|
|
2082
|
-
interface OverlayInfo {
|
|
2083
|
-
/** Unique overlay identifier */
|
|
2084
|
-
id: string;
|
|
2085
|
-
/** Absolute path to source directory */
|
|
2086
|
-
source: string;
|
|
2087
|
-
/** Relative path in sandbox */
|
|
2088
|
-
target: string;
|
|
2089
|
-
/** Strategy used for the overlay */
|
|
2090
|
-
strategy: OverlayStrategy;
|
|
2091
|
-
/** When the overlay was created */
|
|
2092
|
-
createdAt: string;
|
|
2093
|
-
/** Statistics about the overlay */
|
|
2094
|
-
stats: OverlayStats;
|
|
2095
|
-
/** Copy status for background operations */
|
|
2096
|
-
copyStatus: OverlayCopyStatus;
|
|
2097
|
-
/** Error message if copy failed */
|
|
2098
|
-
copyError?: string;
|
|
2099
|
-
}
|
|
2100
|
-
/**
|
|
2101
|
-
* API response for overlay operations (snake_case from server)
|
|
2102
|
-
*/
|
|
2103
|
-
interface OverlayResponse {
|
|
2104
|
-
id: string;
|
|
2105
|
-
source: string;
|
|
2106
|
-
target: string;
|
|
2107
|
-
strategy?: string;
|
|
2108
|
-
created_at: string;
|
|
2109
|
-
stats: {
|
|
2110
|
-
copied_files: number;
|
|
2111
|
-
copied_dirs: number;
|
|
2112
|
-
skipped: string[];
|
|
2113
|
-
};
|
|
2114
|
-
copy_status: string;
|
|
2115
|
-
copy_error?: string;
|
|
2116
|
-
}
|
|
2117
|
-
/**
|
|
2118
|
-
* API response for listing overlays
|
|
2119
|
-
*/
|
|
2120
|
-
interface OverlayListResponse {
|
|
2121
|
-
overlays: OverlayResponse[];
|
|
2122
|
-
}
|
|
2123
|
-
/**
|
|
2124
|
-
* Overlay resource namespace
|
|
2125
|
-
*
|
|
2126
|
-
* @example
|
|
2127
|
-
* ```typescript
|
|
2128
|
-
* // Create an overlay from a template directory
|
|
2129
|
-
* const overlay = await sandbox.filesystem.overlay.create({
|
|
2130
|
-
* source: '/templates/nextjs',
|
|
2131
|
-
* target: 'project',
|
|
2132
|
-
* });
|
|
2133
|
-
* console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
|
|
2134
|
-
*
|
|
2135
|
-
* // Create an overlay and wait for background copy to complete
|
|
2136
|
-
* const overlay = await sandbox.filesystem.overlay.create({
|
|
2137
|
-
* source: '/templates/nextjs',
|
|
2138
|
-
* target: 'project',
|
|
2139
|
-
* waitForCompletion: true, // blocks until copy is complete
|
|
2140
|
-
* });
|
|
2141
|
-
*
|
|
2142
|
-
* // Wait for an existing overlay's copy to complete
|
|
2143
|
-
* const overlay = await sandbox.filesystem.overlay.waitForCompletion('overlay-id');
|
|
2144
|
-
*
|
|
2145
|
-
* // List all overlays
|
|
2146
|
-
* const overlays = await sandbox.filesystem.overlay.list();
|
|
2147
|
-
*
|
|
2148
|
-
* // Get a specific overlay (useful for polling copy status)
|
|
2149
|
-
* const overlay = await sandbox.filesystem.overlay.retrieve('overlay-id');
|
|
2150
|
-
* if (overlay.copyStatus === 'complete') {
|
|
2151
|
-
* console.log('Background copy finished!');
|
|
2152
|
-
* }
|
|
2153
|
-
*
|
|
2154
|
-
* // Delete an overlay
|
|
2155
|
-
* await sandbox.filesystem.overlay.destroy('overlay-id');
|
|
2156
|
-
* ```
|
|
2157
|
-
*/
|
|
2158
|
-
declare class Overlay {
|
|
2159
|
-
private createHandler;
|
|
2160
|
-
private listHandler;
|
|
2161
|
-
private retrieveHandler;
|
|
2162
|
-
private destroyHandler;
|
|
2163
|
-
constructor(handlers: {
|
|
2164
|
-
create: (options: CreateOverlayOptions) => Promise<OverlayResponse>;
|
|
2165
|
-
list: () => Promise<OverlayListResponse>;
|
|
2166
|
-
retrieve: (id: string) => Promise<OverlayResponse>;
|
|
2167
|
-
destroy: (id: string) => Promise<void>;
|
|
2168
|
-
});
|
|
2169
|
-
/**
|
|
2170
|
-
* Create a new overlay from a template directory
|
|
2171
|
-
*
|
|
2172
|
-
* The overlay copies files from the source directory into the target path
|
|
2173
|
-
* for better isolation. Heavy directories (node_modules, .venv, etc.) are
|
|
2174
|
-
* copied in the background. Use the `ignore` option to exclude files/directories.
|
|
2175
|
-
*
|
|
2176
|
-
* @param options - Overlay creation options
|
|
2177
|
-
* @param options.source - Absolute path to source directory
|
|
2178
|
-
* @param options.target - Relative path in sandbox
|
|
2179
|
-
* @param options.ignore - Glob patterns to ignore (e.g., ["node_modules", "*.log"])
|
|
2180
|
-
* @param options.strategy - Strategy to use ('copy' or 'smart')
|
|
2181
|
-
* @param options.waitForCompletion - If true or options object, wait for background copy to complete
|
|
2182
|
-
* @returns Overlay info with copy status
|
|
2183
|
-
*/
|
|
2184
|
-
create(options: CreateOverlayOptions): Promise<OverlayInfo>;
|
|
2185
|
-
/**
|
|
2186
|
-
* List all overlays for the current sandbox
|
|
2187
|
-
* @returns Array of overlay info
|
|
2188
|
-
*/
|
|
2189
|
-
list(): Promise<OverlayInfo[]>;
|
|
2190
|
-
/**
|
|
2191
|
-
* Retrieve a specific overlay by ID
|
|
2192
|
-
*
|
|
2193
|
-
* Useful for polling the copy status of an overlay.
|
|
2194
|
-
*
|
|
2195
|
-
* @param id - Overlay ID
|
|
2196
|
-
* @returns Overlay info
|
|
2197
|
-
*/
|
|
2198
|
-
retrieve(id: string): Promise<OverlayInfo>;
|
|
2199
|
-
/**
|
|
2200
|
-
* Destroy (delete) an overlay
|
|
2201
|
-
* @param id - Overlay ID
|
|
2202
|
-
*/
|
|
2203
|
-
destroy(id: string): Promise<void>;
|
|
2204
|
-
/**
|
|
2205
|
-
* Wait for an overlay's background copy to complete
|
|
2206
|
-
*
|
|
2207
|
-
* Polls the overlay status with exponential backoff until the copy
|
|
2208
|
-
* is complete or fails. Throws an error if the copy fails or times out.
|
|
2209
|
-
*
|
|
2210
|
-
* @param id - Overlay ID
|
|
2211
|
-
* @param options - Polling options
|
|
2212
|
-
* @returns Overlay info with final copy status
|
|
2213
|
-
* @throws Error if copy fails or times out
|
|
2214
|
-
*/
|
|
2215
|
-
waitForCompletion(id: string, options?: WaitForCompletionOptions): Promise<OverlayInfo>;
|
|
2216
|
-
/**
|
|
2217
|
-
* Convert API response to OverlayInfo
|
|
2218
|
-
*/
|
|
2219
|
-
private toOverlayInfo;
|
|
2220
|
-
/**
|
|
2221
|
-
* Validate and return strategy, defaulting to 'copy' for unknown/missing values (legacy support)
|
|
2222
|
-
*/
|
|
2223
|
-
private validateStrategy;
|
|
2224
|
-
/**
|
|
2225
|
-
* Validate and return copy status, defaulting to 'pending' for unknown values
|
|
2226
|
-
*/
|
|
2227
|
-
private validateCopyStatus;
|
|
2228
|
-
}
|
|
2229
|
-
|
|
2230
2361
|
/**
|
|
2231
2362
|
* Binary WebSocket Protocol Implementation
|
|
2232
2363
|
*
|
|
@@ -2271,59 +2402,6 @@ declare function encodeBinaryMessage(message: any): ArrayBuffer;
|
|
|
2271
2402
|
*/
|
|
2272
2403
|
declare function decodeBinaryMessage(buffer: ArrayBuffer | Uint8Array): any;
|
|
2273
2404
|
|
|
2274
|
-
/**
|
|
2275
|
-
* Client Types
|
|
2276
|
-
*
|
|
2277
|
-
* Types specific to the gateway Sandbox client implementation.
|
|
2278
|
-
* Core universal types are imported from ../types/universal-sandbox
|
|
2279
|
-
*/
|
|
2280
|
-
|
|
2281
|
-
/**
|
|
2282
|
-
* Sandbox status types (client-specific, more limited than universal)
|
|
2283
|
-
*/
|
|
2284
|
-
type SandboxStatus = 'running' | 'stopped' | 'error';
|
|
2285
|
-
/**
|
|
2286
|
-
* Provider-agnostic sandbox info (alias for SandboxInfo for backward compatibility)
|
|
2287
|
-
*/
|
|
2288
|
-
interface ProviderSandboxInfo {
|
|
2289
|
-
/** Unique identifier for the sandbox */
|
|
2290
|
-
id: string;
|
|
2291
|
-
/** Provider hosting the sandbox */
|
|
2292
|
-
provider: string;
|
|
2293
|
-
/** Runtime environment in the sandbox */
|
|
2294
|
-
runtime: Runtime;
|
|
2295
|
-
/** Current status of the sandbox */
|
|
2296
|
-
status: SandboxStatus;
|
|
2297
|
-
/** When the sandbox was created */
|
|
2298
|
-
createdAt: Date;
|
|
2299
|
-
/** Execution timeout in milliseconds */
|
|
2300
|
-
timeout: number;
|
|
2301
|
-
/** Additional provider-specific metadata */
|
|
2302
|
-
metadata?: Record<string, any>;
|
|
2303
|
-
}
|
|
2304
|
-
/**
|
|
2305
|
-
* Error thrown when a command exits with a non-zero status
|
|
2306
|
-
*/
|
|
2307
|
-
declare class CommandExitError extends Error {
|
|
2308
|
-
result: {
|
|
2309
|
-
exitCode: number;
|
|
2310
|
-
stdout: string;
|
|
2311
|
-
stderr: string;
|
|
2312
|
-
error: boolean;
|
|
2313
|
-
};
|
|
2314
|
-
name: string;
|
|
2315
|
-
constructor(result: {
|
|
2316
|
-
exitCode: number;
|
|
2317
|
-
stdout: string;
|
|
2318
|
-
stderr: string;
|
|
2319
|
-
error: boolean;
|
|
2320
|
-
});
|
|
2321
|
-
}
|
|
2322
|
-
/**
|
|
2323
|
-
* Type guard to check if an error is a CommandExitError
|
|
2324
|
-
*/
|
|
2325
|
-
declare function isCommandExitError(error: unknown): error is CommandExitError;
|
|
2326
|
-
|
|
2327
2405
|
/**
|
|
2328
2406
|
* ComputeSDK Client - Universal Sandbox Implementation
|
|
2329
2407
|
*
|
|
@@ -2631,6 +2709,8 @@ interface SandboxInfo {
|
|
|
2631
2709
|
is_main: boolean;
|
|
2632
2710
|
created_at: string;
|
|
2633
2711
|
url: string;
|
|
2712
|
+
overlays?: SandboxOverlayInfo[];
|
|
2713
|
+
servers?: SandboxServerInfo[];
|
|
2634
2714
|
}
|
|
2635
2715
|
/**
|
|
2636
2716
|
* Sandboxes list response
|
|
@@ -2703,6 +2783,12 @@ interface ServerInfo {
|
|
|
2703
2783
|
env_file?: string;
|
|
2704
2784
|
/** Inline environment variables */
|
|
2705
2785
|
environment?: Record<string, string>;
|
|
2786
|
+
/** Whether to auto-start the server on daemon boot */
|
|
2787
|
+
autostart?: boolean;
|
|
2788
|
+
/** If true, port allocation is strict (no auto-increment) */
|
|
2789
|
+
strict_port?: boolean;
|
|
2790
|
+
/** Overlay IDs this server depends on */
|
|
2791
|
+
depends_on?: string[];
|
|
2706
2792
|
/** Auto-detected port number (populated when port monitor detects listening port) */
|
|
2707
2793
|
port?: number;
|
|
2708
2794
|
/** Generated URL from subdomain + port (populated when port is detected) */
|
|
@@ -2728,6 +2814,32 @@ interface ServerInfo {
|
|
|
2728
2814
|
/** When the server was last updated */
|
|
2729
2815
|
updated_at: string;
|
|
2730
2816
|
}
|
|
2817
|
+
/**
|
|
2818
|
+
* Sandbox server info returned by setup flows
|
|
2819
|
+
*/
|
|
2820
|
+
interface SandboxServerInfo {
|
|
2821
|
+
slug: string;
|
|
2822
|
+
port?: number;
|
|
2823
|
+
url?: string;
|
|
2824
|
+
status: ServerStatus;
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* Sandbox overlay info returned by setup flows
|
|
2828
|
+
*/
|
|
2829
|
+
interface SandboxOverlayInfo {
|
|
2830
|
+
id: string;
|
|
2831
|
+
source: string;
|
|
2832
|
+
target: string;
|
|
2833
|
+
copy_status: string;
|
|
2834
|
+
}
|
|
2835
|
+
/**
|
|
2836
|
+
* Ready response (public endpoint)
|
|
2837
|
+
*/
|
|
2838
|
+
interface ReadyResponse {
|
|
2839
|
+
ready: boolean;
|
|
2840
|
+
servers: SandboxServerInfo[];
|
|
2841
|
+
overlays: SandboxOverlayInfo[];
|
|
2842
|
+
}
|
|
2731
2843
|
/**
|
|
2732
2844
|
* Servers list response
|
|
2733
2845
|
*/
|
|
@@ -3381,6 +3493,12 @@ declare class Sandbox {
|
|
|
3381
3493
|
* @param options.path - Working directory (optional)
|
|
3382
3494
|
* @param options.env_file - Path to .env file relative to path (optional)
|
|
3383
3495
|
* @param options.environment - Inline environment variables (merged with env_file if both provided)
|
|
3496
|
+
* @param options.port - Requested port (preallocated before start)
|
|
3497
|
+
* @param options.strict_port - If true, fail instead of auto-incrementing when port is taken
|
|
3498
|
+
* @param options.autostart - Auto-start on daemon boot (default: true)
|
|
3499
|
+
* @param options.overlay - Inline overlay to create before starting
|
|
3500
|
+
* @param options.overlays - Additional overlays to create before starting
|
|
3501
|
+
* @param options.depends_on - Overlay IDs this server depends on
|
|
3384
3502
|
* @param options.restart_policy - When to automatically restart: 'never' (default), 'on-failure', 'always'
|
|
3385
3503
|
* @param options.max_restarts - Maximum restart attempts, 0 = unlimited (default: 0)
|
|
3386
3504
|
* @param options.restart_delay_ms - Delay between restart attempts in milliseconds (default: 1000)
|
|
@@ -3407,6 +3525,18 @@ declare class Sandbox {
|
|
|
3407
3525
|
* restart_delay_ms: 2000,
|
|
3408
3526
|
* stop_timeout_ms: 5000,
|
|
3409
3527
|
* });
|
|
3528
|
+
*
|
|
3529
|
+
* // With inline overlay dependencies
|
|
3530
|
+
* await sandbox.startServer({
|
|
3531
|
+
* slug: 'web',
|
|
3532
|
+
* start: 'npm run dev',
|
|
3533
|
+
* path: '/app',
|
|
3534
|
+
* overlay: {
|
|
3535
|
+
* source: '/templates/nextjs',
|
|
3536
|
+
* target: 'app',
|
|
3537
|
+
* strategy: 'smart',
|
|
3538
|
+
* },
|
|
3539
|
+
* });
|
|
3410
3540
|
* ```
|
|
3411
3541
|
*/
|
|
3412
3542
|
startServer(options: {
|
|
@@ -3416,6 +3546,12 @@ declare class Sandbox {
|
|
|
3416
3546
|
path?: string;
|
|
3417
3547
|
env_file?: string;
|
|
3418
3548
|
environment?: Record<string, string>;
|
|
3549
|
+
port?: number;
|
|
3550
|
+
strict_port?: boolean;
|
|
3551
|
+
autostart?: boolean;
|
|
3552
|
+
overlay?: Omit<CreateOverlayOptions, 'waitForCompletion'>;
|
|
3553
|
+
overlays?: Array<Omit<CreateOverlayOptions, 'waitForCompletion'>>;
|
|
3554
|
+
depends_on?: string[];
|
|
3419
3555
|
restart_policy?: RestartPolicy;
|
|
3420
3556
|
max_restarts?: number;
|
|
3421
3557
|
restart_delay_ms?: number;
|
|
@@ -3427,10 +3563,15 @@ declare class Sandbox {
|
|
|
3427
3563
|
*/
|
|
3428
3564
|
getServer(slug: string): Promise<ServerResponse>;
|
|
3429
3565
|
/**
|
|
3430
|
-
* Stop a managed server
|
|
3566
|
+
* Stop a managed server (non-destructive)
|
|
3431
3567
|
* @param slug - Server slug
|
|
3432
3568
|
*/
|
|
3433
3569
|
stopServer(slug: string): Promise<ServerStopResponse>;
|
|
3570
|
+
/**
|
|
3571
|
+
* Delete a managed server configuration
|
|
3572
|
+
* @param slug - Server slug
|
|
3573
|
+
*/
|
|
3574
|
+
deleteServer(slug: string): Promise<void>;
|
|
3434
3575
|
/**
|
|
3435
3576
|
* Restart a managed server
|
|
3436
3577
|
* @param slug - Server slug
|
|
@@ -3450,10 +3591,14 @@ declare class Sandbox {
|
|
|
3450
3591
|
* @param status - New server status
|
|
3451
3592
|
*/
|
|
3452
3593
|
updateServerStatus(slug: string, status: ServerStatus): Promise<ServerStatusUpdateResponse>;
|
|
3594
|
+
/**
|
|
3595
|
+
* Get readiness status for autostarted servers and overlays
|
|
3596
|
+
*/
|
|
3597
|
+
ready(): Promise<ReadyResponse>;
|
|
3453
3598
|
/**
|
|
3454
3599
|
* Create a new sandbox environment
|
|
3455
3600
|
*/
|
|
3456
|
-
createSandbox(): Promise<SandboxInfo>;
|
|
3601
|
+
createSandbox(options?: CreateSandboxOptions$1): Promise<SandboxInfo>;
|
|
3457
3602
|
/**
|
|
3458
3603
|
* List all sandboxes
|
|
3459
3604
|
*/
|
|
@@ -3584,6 +3729,28 @@ declare class Sandbox {
|
|
|
3584
3729
|
disconnect(): Promise<void>;
|
|
3585
3730
|
}
|
|
3586
3731
|
|
|
3732
|
+
/**
|
|
3733
|
+
* Helpers for building setup payloads used by COMPUTESDK_SETUP_B64 or POST /sandboxes
|
|
3734
|
+
*/
|
|
3735
|
+
|
|
3736
|
+
type SetupOverlayConfig = Omit<CreateOverlayOptions, 'waitForCompletion'>;
|
|
3737
|
+
interface SetupPayload {
|
|
3738
|
+
overlays?: SetupOverlayConfig[];
|
|
3739
|
+
servers?: ServerStartOptions[];
|
|
3740
|
+
}
|
|
3741
|
+
interface BuildSetupPayloadOptions {
|
|
3742
|
+
overlays?: CreateOverlayOptions[];
|
|
3743
|
+
servers?: ServerStartOptions[];
|
|
3744
|
+
}
|
|
3745
|
+
/**
|
|
3746
|
+
* Build a setup payload for COMPUTESDK_SETUP_B64 or POST /sandboxes
|
|
3747
|
+
*/
|
|
3748
|
+
declare const buildSetupPayload: (options: BuildSetupPayloadOptions) => SetupPayload;
|
|
3749
|
+
/**
|
|
3750
|
+
* Build and base64-encode a setup payload for COMPUTESDK_SETUP_B64
|
|
3751
|
+
*/
|
|
3752
|
+
declare const encodeSetupPayload: (options: BuildSetupPayloadOptions) => string;
|
|
3753
|
+
|
|
3587
3754
|
/**
|
|
3588
3755
|
* Unified Provider Configuration
|
|
3589
3756
|
*
|
|
@@ -3744,6 +3911,9 @@ interface CreateSandboxOptions {
|
|
|
3744
3911
|
envs?: Record<string, string>;
|
|
3745
3912
|
name?: string;
|
|
3746
3913
|
namespace?: string;
|
|
3914
|
+
directory?: string;
|
|
3915
|
+
overlays?: SetupOverlayConfig[];
|
|
3916
|
+
servers?: ServerStartOptions[];
|
|
3747
3917
|
/** Docker image to use for the sandbox (for infrastructure providers like Railway) */
|
|
3748
3918
|
image?: string;
|
|
3749
3919
|
/** Provider-specific snapshot to create from (e.g., Vercel snapshots) */
|
|
@@ -3803,6 +3973,27 @@ declare class ComputeManager {
|
|
|
3803
3973
|
sandbox: {
|
|
3804
3974
|
/**
|
|
3805
3975
|
* Create a new sandbox
|
|
3976
|
+
*
|
|
3977
|
+
* @example
|
|
3978
|
+
* ```typescript
|
|
3979
|
+
* const sandbox = await compute.sandbox.create({
|
|
3980
|
+
* directory: '/custom/path',
|
|
3981
|
+
* overlays: [
|
|
3982
|
+
* {
|
|
3983
|
+
* source: '/templates/nextjs',
|
|
3984
|
+
* target: 'app',
|
|
3985
|
+
* strategy: 'smart',
|
|
3986
|
+
* },
|
|
3987
|
+
* ],
|
|
3988
|
+
* servers: [
|
|
3989
|
+
* {
|
|
3990
|
+
* slug: 'web',
|
|
3991
|
+
* start: 'npm run dev',
|
|
3992
|
+
* path: '/app',
|
|
3993
|
+
* },
|
|
3994
|
+
* ],
|
|
3995
|
+
* });
|
|
3996
|
+
* ```
|
|
3806
3997
|
*/
|
|
3807
3998
|
create: (options?: CreateSandboxOptions) => Promise<Sandbox>;
|
|
3808
3999
|
/**
|
|
@@ -3942,4 +4133,4 @@ declare const PROVIDER_ENV_VARS: {
|
|
|
3942
4133
|
readonly namespace: readonly ["NSC_TOKEN"];
|
|
3943
4134
|
};
|
|
3944
4135
|
|
|
3945
|
-
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, SignalService, TerminalInstance, type WebSocketConstructor, autoConfigureCompute, buildProviderHeaders, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
|
|
4136
|
+
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 };
|