computesdk 1.13.0 → 1.15.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 +114 -26
- package/dist/index.d.ts +114 -26
- package/dist/index.js +64 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1109,8 +1109,10 @@ declare class Terminal {
|
|
|
1109
1109
|
interface ServerStartOptions {
|
|
1110
1110
|
/** Unique server identifier (URL-safe) */
|
|
1111
1111
|
slug: string;
|
|
1112
|
-
/**
|
|
1113
|
-
|
|
1112
|
+
/** Install command to run before starting (optional, runs blocking, e.g., "npm install") */
|
|
1113
|
+
install?: string;
|
|
1114
|
+
/** Command to start the server (e.g., "npm run dev") */
|
|
1115
|
+
start: string;
|
|
1114
1116
|
/** Working directory (optional) */
|
|
1115
1117
|
path?: string;
|
|
1116
1118
|
/** Path to .env file relative to path (optional) */
|
|
@@ -1139,14 +1141,22 @@ interface ServerStartOptions {
|
|
|
1139
1141
|
* // Start a basic server
|
|
1140
1142
|
* const server = await sandbox.server.start({
|
|
1141
1143
|
* slug: 'api',
|
|
1142
|
-
*
|
|
1144
|
+
* start: 'npm start',
|
|
1145
|
+
* path: '/app',
|
|
1146
|
+
* });
|
|
1147
|
+
*
|
|
1148
|
+
* // Start with install command (runs before start)
|
|
1149
|
+
* const server = await sandbox.server.start({
|
|
1150
|
+
* slug: 'web',
|
|
1151
|
+
* install: 'npm install',
|
|
1152
|
+
* start: 'npm run dev',
|
|
1143
1153
|
* path: '/app',
|
|
1144
1154
|
* });
|
|
1145
1155
|
*
|
|
1146
1156
|
* // Start with supervisor settings (auto-restart on failure)
|
|
1147
1157
|
* const server = await sandbox.server.start({
|
|
1148
1158
|
* slug: 'web',
|
|
1149
|
-
*
|
|
1159
|
+
* start: 'node server.js',
|
|
1150
1160
|
* path: '/app',
|
|
1151
1161
|
* environment: { NODE_ENV: 'production', PORT: '3000' },
|
|
1152
1162
|
* restart_policy: 'on-failure',
|
|
@@ -1167,6 +1177,24 @@ interface ServerStartOptions {
|
|
|
1167
1177
|
* await sandbox.server.restart('api');
|
|
1168
1178
|
* ```
|
|
1169
1179
|
*/
|
|
1180
|
+
/**
|
|
1181
|
+
* Options for retrieving server logs
|
|
1182
|
+
*/
|
|
1183
|
+
interface ServerLogsOptions {
|
|
1184
|
+
/** Which output stream to return: 'stdout', 'stderr', or 'combined' (default) */
|
|
1185
|
+
stream?: ServerLogStream;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Server logs info returned from the logs method
|
|
1189
|
+
*/
|
|
1190
|
+
interface ServerLogsInfo {
|
|
1191
|
+
/** Server slug identifier */
|
|
1192
|
+
slug: string;
|
|
1193
|
+
/** Which stream was returned */
|
|
1194
|
+
stream: ServerLogStream;
|
|
1195
|
+
/** The captured logs */
|
|
1196
|
+
logs: string;
|
|
1197
|
+
}
|
|
1170
1198
|
declare class Server {
|
|
1171
1199
|
private startHandler;
|
|
1172
1200
|
private listHandler;
|
|
@@ -1174,6 +1202,7 @@ declare class Server {
|
|
|
1174
1202
|
private stopHandler;
|
|
1175
1203
|
private restartHandler;
|
|
1176
1204
|
private updateStatusHandler;
|
|
1205
|
+
private logsHandler;
|
|
1177
1206
|
constructor(handlers: {
|
|
1178
1207
|
start: (options: ServerStartOptions) => Promise<ServerResponse>;
|
|
1179
1208
|
list: () => Promise<ServersListResponse>;
|
|
@@ -1181,10 +1210,15 @@ declare class Server {
|
|
|
1181
1210
|
stop: (slug: string) => Promise<ServerStopResponse | void>;
|
|
1182
1211
|
restart: (slug: string) => Promise<ServerResponse>;
|
|
1183
1212
|
updateStatus: (slug: string, status: ServerStatus) => Promise<void>;
|
|
1213
|
+
logs: (slug: string, options?: ServerLogsOptions) => Promise<ServerLogsResponse>;
|
|
1184
1214
|
});
|
|
1185
1215
|
/**
|
|
1186
1216
|
* Start a new managed server with optional supervisor settings
|
|
1187
1217
|
*
|
|
1218
|
+
* **Install Phase:**
|
|
1219
|
+
* If `install` is provided, it runs blocking before `start` (e.g., "npm install").
|
|
1220
|
+
* The server status will be `installing` during this phase.
|
|
1221
|
+
*
|
|
1188
1222
|
* **Restart Policies:**
|
|
1189
1223
|
* - `never` (default): No automatic restart on exit
|
|
1190
1224
|
* - `on-failure`: Restart only on non-zero exit code
|
|
@@ -1202,14 +1236,15 @@ declare class Server {
|
|
|
1202
1236
|
* // Basic server
|
|
1203
1237
|
* const server = await sandbox.server.start({
|
|
1204
1238
|
* slug: 'web',
|
|
1205
|
-
*
|
|
1239
|
+
* start: 'npm run dev',
|
|
1206
1240
|
* path: '/app',
|
|
1207
1241
|
* });
|
|
1208
1242
|
*
|
|
1209
|
-
* // With
|
|
1243
|
+
* // With install command
|
|
1210
1244
|
* const server = await sandbox.server.start({
|
|
1211
1245
|
* slug: 'api',
|
|
1212
|
-
*
|
|
1246
|
+
* install: 'npm install',
|
|
1247
|
+
* start: 'node server.js',
|
|
1213
1248
|
* environment: { NODE_ENV: 'production' },
|
|
1214
1249
|
* restart_policy: 'always',
|
|
1215
1250
|
* max_restarts: 0, // unlimited
|
|
@@ -1245,6 +1280,26 @@ declare class Server {
|
|
|
1245
1280
|
* @param status - New status
|
|
1246
1281
|
*/
|
|
1247
1282
|
updateStatus(slug: string, status: ServerStatus): Promise<void>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Retrieve captured output (logs) for a managed server
|
|
1285
|
+
* @param slug - The server slug
|
|
1286
|
+
* @param options - Options for log retrieval
|
|
1287
|
+
* @returns Server logs info
|
|
1288
|
+
*
|
|
1289
|
+
* @example
|
|
1290
|
+
* ```typescript
|
|
1291
|
+
* // Get combined logs (default)
|
|
1292
|
+
* const logs = await sandbox.server.logs('api');
|
|
1293
|
+
* console.log(logs.logs);
|
|
1294
|
+
*
|
|
1295
|
+
* // Get only stdout
|
|
1296
|
+
* const stdout = await sandbox.server.logs('api', { stream: 'stdout' });
|
|
1297
|
+
*
|
|
1298
|
+
* // Get only stderr
|
|
1299
|
+
* const stderr = await sandbox.server.logs('api', { stream: 'stderr' });
|
|
1300
|
+
* ```
|
|
1301
|
+
*/
|
|
1302
|
+
logs(slug: string, options?: ServerLogsOptions): Promise<ServerLogsInfo>;
|
|
1248
1303
|
}
|
|
1249
1304
|
|
|
1250
1305
|
/**
|
|
@@ -1925,8 +1980,8 @@ declare class Child {
|
|
|
1925
1980
|
/**
|
|
1926
1981
|
* Overlay - Resource namespace for filesystem overlay operations
|
|
1927
1982
|
*
|
|
1928
|
-
* Overlays enable instant sandbox setup from template directories by
|
|
1929
|
-
* files
|
|
1983
|
+
* Overlays enable instant sandbox setup from template directories by copying
|
|
1984
|
+
* files directly for isolation, with heavy directories copied in the background.
|
|
1930
1985
|
*/
|
|
1931
1986
|
/**
|
|
1932
1987
|
* Options for creating an overlay
|
|
@@ -1936,6 +1991,8 @@ interface CreateOverlayOptions {
|
|
|
1936
1991
|
source: string;
|
|
1937
1992
|
/** Relative path in sandbox where overlay will be mounted */
|
|
1938
1993
|
target: string;
|
|
1994
|
+
/** Glob patterns to ignore (e.g., ["node_modules", "*.log"]) */
|
|
1995
|
+
ignore?: string[];
|
|
1939
1996
|
}
|
|
1940
1997
|
/**
|
|
1941
1998
|
* Copy status for overlay background operations
|
|
@@ -1945,11 +2002,11 @@ type OverlayCopyStatus = 'pending' | 'in_progress' | 'complete' | 'failed';
|
|
|
1945
2002
|
* Statistics about an overlay
|
|
1946
2003
|
*/
|
|
1947
2004
|
interface OverlayStats {
|
|
1948
|
-
/** Number of
|
|
1949
|
-
|
|
1950
|
-
/** Number of
|
|
1951
|
-
|
|
1952
|
-
/** Paths that were skipped (e.g., .git) */
|
|
2005
|
+
/** Number of copied files */
|
|
2006
|
+
copiedFiles: number;
|
|
2007
|
+
/** Number of copied directories (heavy dirs copied in background) */
|
|
2008
|
+
copiedDirs: number;
|
|
2009
|
+
/** Paths that were skipped (e.g., .git, ignored patterns) */
|
|
1953
2010
|
skipped: string[];
|
|
1954
2011
|
}
|
|
1955
2012
|
/**
|
|
@@ -1980,8 +2037,8 @@ interface OverlayResponse {
|
|
|
1980
2037
|
target: string;
|
|
1981
2038
|
created_at: string;
|
|
1982
2039
|
stats: {
|
|
1983
|
-
|
|
1984
|
-
|
|
2040
|
+
copied_files: number;
|
|
2041
|
+
copied_dirs: number;
|
|
1985
2042
|
skipped: string[];
|
|
1986
2043
|
};
|
|
1987
2044
|
copy_status: string;
|
|
@@ -2032,13 +2089,14 @@ declare class Overlay {
|
|
|
2032
2089
|
/**
|
|
2033
2090
|
* Create a new overlay from a template directory
|
|
2034
2091
|
*
|
|
2035
|
-
* The overlay
|
|
2036
|
-
*
|
|
2037
|
-
*
|
|
2092
|
+
* The overlay copies files from the source directory into the target path
|
|
2093
|
+
* for better isolation. Heavy directories (node_modules, .venv, etc.) are
|
|
2094
|
+
* copied in the background. Use the `ignore` option to exclude files/directories.
|
|
2038
2095
|
*
|
|
2039
2096
|
* @param options - Overlay creation options
|
|
2040
2097
|
* @param options.source - Absolute path to source directory
|
|
2041
2098
|
* @param options.target - Relative path in sandbox
|
|
2099
|
+
* @param options.ignore - Glob patterns to ignore (e.g., ["node_modules", "*.log"])
|
|
2042
2100
|
* @returns Overlay info with copy status
|
|
2043
2101
|
*/
|
|
2044
2102
|
create(options: CreateOverlayOptions): Promise<OverlayInfo>;
|
|
@@ -2513,6 +2571,7 @@ interface TerminalResponse {
|
|
|
2513
2571
|
/**
|
|
2514
2572
|
* Server status types
|
|
2515
2573
|
*
|
|
2574
|
+
* - `installing`: Running install command (e.g., npm install) before starting
|
|
2516
2575
|
* - `starting`: Initial startup of the server process
|
|
2517
2576
|
* - `running`: Server process is running
|
|
2518
2577
|
* - `ready`: Server is running and ready to accept traffic
|
|
@@ -2520,7 +2579,7 @@ interface TerminalResponse {
|
|
|
2520
2579
|
* - `stopped`: Server was intentionally stopped
|
|
2521
2580
|
* - `restarting`: Server is being automatically restarted by the supervisor
|
|
2522
2581
|
*/
|
|
2523
|
-
type ServerStatus = 'starting' | 'running' | 'ready' | 'failed' | 'stopped' | 'restarting';
|
|
2582
|
+
type ServerStatus = 'installing' | 'starting' | 'running' | 'ready' | 'failed' | 'stopped' | 'restarting';
|
|
2524
2583
|
/**
|
|
2525
2584
|
* Server restart policy
|
|
2526
2585
|
* - `never`: No automatic restart (default)
|
|
@@ -2534,8 +2593,10 @@ type RestartPolicy = 'never' | 'on-failure' | 'always';
|
|
|
2534
2593
|
interface ServerInfo {
|
|
2535
2594
|
/** Unique server identifier */
|
|
2536
2595
|
slug: string;
|
|
2596
|
+
/** Install command (optional, runs blocking before start) */
|
|
2597
|
+
install?: string;
|
|
2537
2598
|
/** Command used to start the server */
|
|
2538
|
-
|
|
2599
|
+
start: string;
|
|
2539
2600
|
/** Working directory path */
|
|
2540
2601
|
path: string;
|
|
2541
2602
|
/** Original path before resolution */
|
|
@@ -2599,6 +2660,22 @@ interface ServerStopResponse {
|
|
|
2599
2660
|
slug: string;
|
|
2600
2661
|
};
|
|
2601
2662
|
}
|
|
2663
|
+
/**
|
|
2664
|
+
* Server logs stream type
|
|
2665
|
+
*/
|
|
2666
|
+
type ServerLogStream = 'stdout' | 'stderr' | 'combined';
|
|
2667
|
+
/**
|
|
2668
|
+
* Server logs response
|
|
2669
|
+
*/
|
|
2670
|
+
interface ServerLogsResponse {
|
|
2671
|
+
status: string;
|
|
2672
|
+
message: string;
|
|
2673
|
+
data: {
|
|
2674
|
+
slug: string;
|
|
2675
|
+
stream: ServerLogStream;
|
|
2676
|
+
logs: string;
|
|
2677
|
+
};
|
|
2678
|
+
}
|
|
2602
2679
|
/**
|
|
2603
2680
|
* Server status update response
|
|
2604
2681
|
*/
|
|
@@ -3176,7 +3253,8 @@ declare class Sandbox {
|
|
|
3176
3253
|
*
|
|
3177
3254
|
* @param options - Server configuration
|
|
3178
3255
|
* @param options.slug - Unique server identifier
|
|
3179
|
-
* @param options.
|
|
3256
|
+
* @param options.install - Install command (optional, runs blocking before start, e.g., "npm install")
|
|
3257
|
+
* @param options.start - Command to start the server (e.g., "npm run dev")
|
|
3180
3258
|
* @param options.path - Working directory (optional)
|
|
3181
3259
|
* @param options.env_file - Path to .env file relative to path (optional)
|
|
3182
3260
|
* @param options.environment - Inline environment variables (merged with env_file if both provided)
|
|
@@ -3190,14 +3268,15 @@ declare class Sandbox {
|
|
|
3190
3268
|
* // Basic server
|
|
3191
3269
|
* await sandbox.startServer({
|
|
3192
3270
|
* slug: 'web',
|
|
3193
|
-
*
|
|
3271
|
+
* start: 'npm run dev',
|
|
3194
3272
|
* path: '/app',
|
|
3195
3273
|
* });
|
|
3196
3274
|
*
|
|
3197
|
-
* // With supervisor settings
|
|
3275
|
+
* // With install command and supervisor settings
|
|
3198
3276
|
* await sandbox.startServer({
|
|
3199
3277
|
* slug: 'api',
|
|
3200
|
-
*
|
|
3278
|
+
* install: 'npm install',
|
|
3279
|
+
* start: 'node server.js',
|
|
3201
3280
|
* path: '/app',
|
|
3202
3281
|
* environment: { NODE_ENV: 'production', PORT: '3000' },
|
|
3203
3282
|
* restart_policy: 'on-failure',
|
|
@@ -3209,7 +3288,8 @@ declare class Sandbox {
|
|
|
3209
3288
|
*/
|
|
3210
3289
|
startServer(options: {
|
|
3211
3290
|
slug: string;
|
|
3212
|
-
|
|
3291
|
+
install?: string;
|
|
3292
|
+
start: string;
|
|
3213
3293
|
path?: string;
|
|
3214
3294
|
env_file?: string;
|
|
3215
3295
|
environment?: Record<string, string>;
|
|
@@ -3233,6 +3313,14 @@ declare class Sandbox {
|
|
|
3233
3313
|
* @param slug - Server slug
|
|
3234
3314
|
*/
|
|
3235
3315
|
restartServer(slug: string): Promise<ServerResponse>;
|
|
3316
|
+
/**
|
|
3317
|
+
* Get logs for a managed server
|
|
3318
|
+
* @param slug - Server slug
|
|
3319
|
+
* @param options - Options for log retrieval
|
|
3320
|
+
*/
|
|
3321
|
+
getServerLogs(slug: string, options?: {
|
|
3322
|
+
stream?: ServerLogStream;
|
|
3323
|
+
}): Promise<ServerLogsResponse>;
|
|
3236
3324
|
/**
|
|
3237
3325
|
* Update server status (internal use)
|
|
3238
3326
|
* @param slug - Server slug
|
package/dist/index.d.ts
CHANGED
|
@@ -1109,8 +1109,10 @@ declare class Terminal {
|
|
|
1109
1109
|
interface ServerStartOptions {
|
|
1110
1110
|
/** Unique server identifier (URL-safe) */
|
|
1111
1111
|
slug: string;
|
|
1112
|
-
/**
|
|
1113
|
-
|
|
1112
|
+
/** Install command to run before starting (optional, runs blocking, e.g., "npm install") */
|
|
1113
|
+
install?: string;
|
|
1114
|
+
/** Command to start the server (e.g., "npm run dev") */
|
|
1115
|
+
start: string;
|
|
1114
1116
|
/** Working directory (optional) */
|
|
1115
1117
|
path?: string;
|
|
1116
1118
|
/** Path to .env file relative to path (optional) */
|
|
@@ -1139,14 +1141,22 @@ interface ServerStartOptions {
|
|
|
1139
1141
|
* // Start a basic server
|
|
1140
1142
|
* const server = await sandbox.server.start({
|
|
1141
1143
|
* slug: 'api',
|
|
1142
|
-
*
|
|
1144
|
+
* start: 'npm start',
|
|
1145
|
+
* path: '/app',
|
|
1146
|
+
* });
|
|
1147
|
+
*
|
|
1148
|
+
* // Start with install command (runs before start)
|
|
1149
|
+
* const server = await sandbox.server.start({
|
|
1150
|
+
* slug: 'web',
|
|
1151
|
+
* install: 'npm install',
|
|
1152
|
+
* start: 'npm run dev',
|
|
1143
1153
|
* path: '/app',
|
|
1144
1154
|
* });
|
|
1145
1155
|
*
|
|
1146
1156
|
* // Start with supervisor settings (auto-restart on failure)
|
|
1147
1157
|
* const server = await sandbox.server.start({
|
|
1148
1158
|
* slug: 'web',
|
|
1149
|
-
*
|
|
1159
|
+
* start: 'node server.js',
|
|
1150
1160
|
* path: '/app',
|
|
1151
1161
|
* environment: { NODE_ENV: 'production', PORT: '3000' },
|
|
1152
1162
|
* restart_policy: 'on-failure',
|
|
@@ -1167,6 +1177,24 @@ interface ServerStartOptions {
|
|
|
1167
1177
|
* await sandbox.server.restart('api');
|
|
1168
1178
|
* ```
|
|
1169
1179
|
*/
|
|
1180
|
+
/**
|
|
1181
|
+
* Options for retrieving server logs
|
|
1182
|
+
*/
|
|
1183
|
+
interface ServerLogsOptions {
|
|
1184
|
+
/** Which output stream to return: 'stdout', 'stderr', or 'combined' (default) */
|
|
1185
|
+
stream?: ServerLogStream;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Server logs info returned from the logs method
|
|
1189
|
+
*/
|
|
1190
|
+
interface ServerLogsInfo {
|
|
1191
|
+
/** Server slug identifier */
|
|
1192
|
+
slug: string;
|
|
1193
|
+
/** Which stream was returned */
|
|
1194
|
+
stream: ServerLogStream;
|
|
1195
|
+
/** The captured logs */
|
|
1196
|
+
logs: string;
|
|
1197
|
+
}
|
|
1170
1198
|
declare class Server {
|
|
1171
1199
|
private startHandler;
|
|
1172
1200
|
private listHandler;
|
|
@@ -1174,6 +1202,7 @@ declare class Server {
|
|
|
1174
1202
|
private stopHandler;
|
|
1175
1203
|
private restartHandler;
|
|
1176
1204
|
private updateStatusHandler;
|
|
1205
|
+
private logsHandler;
|
|
1177
1206
|
constructor(handlers: {
|
|
1178
1207
|
start: (options: ServerStartOptions) => Promise<ServerResponse>;
|
|
1179
1208
|
list: () => Promise<ServersListResponse>;
|
|
@@ -1181,10 +1210,15 @@ declare class Server {
|
|
|
1181
1210
|
stop: (slug: string) => Promise<ServerStopResponse | void>;
|
|
1182
1211
|
restart: (slug: string) => Promise<ServerResponse>;
|
|
1183
1212
|
updateStatus: (slug: string, status: ServerStatus) => Promise<void>;
|
|
1213
|
+
logs: (slug: string, options?: ServerLogsOptions) => Promise<ServerLogsResponse>;
|
|
1184
1214
|
});
|
|
1185
1215
|
/**
|
|
1186
1216
|
* Start a new managed server with optional supervisor settings
|
|
1187
1217
|
*
|
|
1218
|
+
* **Install Phase:**
|
|
1219
|
+
* If `install` is provided, it runs blocking before `start` (e.g., "npm install").
|
|
1220
|
+
* The server status will be `installing` during this phase.
|
|
1221
|
+
*
|
|
1188
1222
|
* **Restart Policies:**
|
|
1189
1223
|
* - `never` (default): No automatic restart on exit
|
|
1190
1224
|
* - `on-failure`: Restart only on non-zero exit code
|
|
@@ -1202,14 +1236,15 @@ declare class Server {
|
|
|
1202
1236
|
* // Basic server
|
|
1203
1237
|
* const server = await sandbox.server.start({
|
|
1204
1238
|
* slug: 'web',
|
|
1205
|
-
*
|
|
1239
|
+
* start: 'npm run dev',
|
|
1206
1240
|
* path: '/app',
|
|
1207
1241
|
* });
|
|
1208
1242
|
*
|
|
1209
|
-
* // With
|
|
1243
|
+
* // With install command
|
|
1210
1244
|
* const server = await sandbox.server.start({
|
|
1211
1245
|
* slug: 'api',
|
|
1212
|
-
*
|
|
1246
|
+
* install: 'npm install',
|
|
1247
|
+
* start: 'node server.js',
|
|
1213
1248
|
* environment: { NODE_ENV: 'production' },
|
|
1214
1249
|
* restart_policy: 'always',
|
|
1215
1250
|
* max_restarts: 0, // unlimited
|
|
@@ -1245,6 +1280,26 @@ declare class Server {
|
|
|
1245
1280
|
* @param status - New status
|
|
1246
1281
|
*/
|
|
1247
1282
|
updateStatus(slug: string, status: ServerStatus): Promise<void>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Retrieve captured output (logs) for a managed server
|
|
1285
|
+
* @param slug - The server slug
|
|
1286
|
+
* @param options - Options for log retrieval
|
|
1287
|
+
* @returns Server logs info
|
|
1288
|
+
*
|
|
1289
|
+
* @example
|
|
1290
|
+
* ```typescript
|
|
1291
|
+
* // Get combined logs (default)
|
|
1292
|
+
* const logs = await sandbox.server.logs('api');
|
|
1293
|
+
* console.log(logs.logs);
|
|
1294
|
+
*
|
|
1295
|
+
* // Get only stdout
|
|
1296
|
+
* const stdout = await sandbox.server.logs('api', { stream: 'stdout' });
|
|
1297
|
+
*
|
|
1298
|
+
* // Get only stderr
|
|
1299
|
+
* const stderr = await sandbox.server.logs('api', { stream: 'stderr' });
|
|
1300
|
+
* ```
|
|
1301
|
+
*/
|
|
1302
|
+
logs(slug: string, options?: ServerLogsOptions): Promise<ServerLogsInfo>;
|
|
1248
1303
|
}
|
|
1249
1304
|
|
|
1250
1305
|
/**
|
|
@@ -1925,8 +1980,8 @@ declare class Child {
|
|
|
1925
1980
|
/**
|
|
1926
1981
|
* Overlay - Resource namespace for filesystem overlay operations
|
|
1927
1982
|
*
|
|
1928
|
-
* Overlays enable instant sandbox setup from template directories by
|
|
1929
|
-
* files
|
|
1983
|
+
* Overlays enable instant sandbox setup from template directories by copying
|
|
1984
|
+
* files directly for isolation, with heavy directories copied in the background.
|
|
1930
1985
|
*/
|
|
1931
1986
|
/**
|
|
1932
1987
|
* Options for creating an overlay
|
|
@@ -1936,6 +1991,8 @@ interface CreateOverlayOptions {
|
|
|
1936
1991
|
source: string;
|
|
1937
1992
|
/** Relative path in sandbox where overlay will be mounted */
|
|
1938
1993
|
target: string;
|
|
1994
|
+
/** Glob patterns to ignore (e.g., ["node_modules", "*.log"]) */
|
|
1995
|
+
ignore?: string[];
|
|
1939
1996
|
}
|
|
1940
1997
|
/**
|
|
1941
1998
|
* Copy status for overlay background operations
|
|
@@ -1945,11 +2002,11 @@ type OverlayCopyStatus = 'pending' | 'in_progress' | 'complete' | 'failed';
|
|
|
1945
2002
|
* Statistics about an overlay
|
|
1946
2003
|
*/
|
|
1947
2004
|
interface OverlayStats {
|
|
1948
|
-
/** Number of
|
|
1949
|
-
|
|
1950
|
-
/** Number of
|
|
1951
|
-
|
|
1952
|
-
/** Paths that were skipped (e.g., .git) */
|
|
2005
|
+
/** Number of copied files */
|
|
2006
|
+
copiedFiles: number;
|
|
2007
|
+
/** Number of copied directories (heavy dirs copied in background) */
|
|
2008
|
+
copiedDirs: number;
|
|
2009
|
+
/** Paths that were skipped (e.g., .git, ignored patterns) */
|
|
1953
2010
|
skipped: string[];
|
|
1954
2011
|
}
|
|
1955
2012
|
/**
|
|
@@ -1980,8 +2037,8 @@ interface OverlayResponse {
|
|
|
1980
2037
|
target: string;
|
|
1981
2038
|
created_at: string;
|
|
1982
2039
|
stats: {
|
|
1983
|
-
|
|
1984
|
-
|
|
2040
|
+
copied_files: number;
|
|
2041
|
+
copied_dirs: number;
|
|
1985
2042
|
skipped: string[];
|
|
1986
2043
|
};
|
|
1987
2044
|
copy_status: string;
|
|
@@ -2032,13 +2089,14 @@ declare class Overlay {
|
|
|
2032
2089
|
/**
|
|
2033
2090
|
* Create a new overlay from a template directory
|
|
2034
2091
|
*
|
|
2035
|
-
* The overlay
|
|
2036
|
-
*
|
|
2037
|
-
*
|
|
2092
|
+
* The overlay copies files from the source directory into the target path
|
|
2093
|
+
* for better isolation. Heavy directories (node_modules, .venv, etc.) are
|
|
2094
|
+
* copied in the background. Use the `ignore` option to exclude files/directories.
|
|
2038
2095
|
*
|
|
2039
2096
|
* @param options - Overlay creation options
|
|
2040
2097
|
* @param options.source - Absolute path to source directory
|
|
2041
2098
|
* @param options.target - Relative path in sandbox
|
|
2099
|
+
* @param options.ignore - Glob patterns to ignore (e.g., ["node_modules", "*.log"])
|
|
2042
2100
|
* @returns Overlay info with copy status
|
|
2043
2101
|
*/
|
|
2044
2102
|
create(options: CreateOverlayOptions): Promise<OverlayInfo>;
|
|
@@ -2513,6 +2571,7 @@ interface TerminalResponse {
|
|
|
2513
2571
|
/**
|
|
2514
2572
|
* Server status types
|
|
2515
2573
|
*
|
|
2574
|
+
* - `installing`: Running install command (e.g., npm install) before starting
|
|
2516
2575
|
* - `starting`: Initial startup of the server process
|
|
2517
2576
|
* - `running`: Server process is running
|
|
2518
2577
|
* - `ready`: Server is running and ready to accept traffic
|
|
@@ -2520,7 +2579,7 @@ interface TerminalResponse {
|
|
|
2520
2579
|
* - `stopped`: Server was intentionally stopped
|
|
2521
2580
|
* - `restarting`: Server is being automatically restarted by the supervisor
|
|
2522
2581
|
*/
|
|
2523
|
-
type ServerStatus = 'starting' | 'running' | 'ready' | 'failed' | 'stopped' | 'restarting';
|
|
2582
|
+
type ServerStatus = 'installing' | 'starting' | 'running' | 'ready' | 'failed' | 'stopped' | 'restarting';
|
|
2524
2583
|
/**
|
|
2525
2584
|
* Server restart policy
|
|
2526
2585
|
* - `never`: No automatic restart (default)
|
|
@@ -2534,8 +2593,10 @@ type RestartPolicy = 'never' | 'on-failure' | 'always';
|
|
|
2534
2593
|
interface ServerInfo {
|
|
2535
2594
|
/** Unique server identifier */
|
|
2536
2595
|
slug: string;
|
|
2596
|
+
/** Install command (optional, runs blocking before start) */
|
|
2597
|
+
install?: string;
|
|
2537
2598
|
/** Command used to start the server */
|
|
2538
|
-
|
|
2599
|
+
start: string;
|
|
2539
2600
|
/** Working directory path */
|
|
2540
2601
|
path: string;
|
|
2541
2602
|
/** Original path before resolution */
|
|
@@ -2599,6 +2660,22 @@ interface ServerStopResponse {
|
|
|
2599
2660
|
slug: string;
|
|
2600
2661
|
};
|
|
2601
2662
|
}
|
|
2663
|
+
/**
|
|
2664
|
+
* Server logs stream type
|
|
2665
|
+
*/
|
|
2666
|
+
type ServerLogStream = 'stdout' | 'stderr' | 'combined';
|
|
2667
|
+
/**
|
|
2668
|
+
* Server logs response
|
|
2669
|
+
*/
|
|
2670
|
+
interface ServerLogsResponse {
|
|
2671
|
+
status: string;
|
|
2672
|
+
message: string;
|
|
2673
|
+
data: {
|
|
2674
|
+
slug: string;
|
|
2675
|
+
stream: ServerLogStream;
|
|
2676
|
+
logs: string;
|
|
2677
|
+
};
|
|
2678
|
+
}
|
|
2602
2679
|
/**
|
|
2603
2680
|
* Server status update response
|
|
2604
2681
|
*/
|
|
@@ -3176,7 +3253,8 @@ declare class Sandbox {
|
|
|
3176
3253
|
*
|
|
3177
3254
|
* @param options - Server configuration
|
|
3178
3255
|
* @param options.slug - Unique server identifier
|
|
3179
|
-
* @param options.
|
|
3256
|
+
* @param options.install - Install command (optional, runs blocking before start, e.g., "npm install")
|
|
3257
|
+
* @param options.start - Command to start the server (e.g., "npm run dev")
|
|
3180
3258
|
* @param options.path - Working directory (optional)
|
|
3181
3259
|
* @param options.env_file - Path to .env file relative to path (optional)
|
|
3182
3260
|
* @param options.environment - Inline environment variables (merged with env_file if both provided)
|
|
@@ -3190,14 +3268,15 @@ declare class Sandbox {
|
|
|
3190
3268
|
* // Basic server
|
|
3191
3269
|
* await sandbox.startServer({
|
|
3192
3270
|
* slug: 'web',
|
|
3193
|
-
*
|
|
3271
|
+
* start: 'npm run dev',
|
|
3194
3272
|
* path: '/app',
|
|
3195
3273
|
* });
|
|
3196
3274
|
*
|
|
3197
|
-
* // With supervisor settings
|
|
3275
|
+
* // With install command and supervisor settings
|
|
3198
3276
|
* await sandbox.startServer({
|
|
3199
3277
|
* slug: 'api',
|
|
3200
|
-
*
|
|
3278
|
+
* install: 'npm install',
|
|
3279
|
+
* start: 'node server.js',
|
|
3201
3280
|
* path: '/app',
|
|
3202
3281
|
* environment: { NODE_ENV: 'production', PORT: '3000' },
|
|
3203
3282
|
* restart_policy: 'on-failure',
|
|
@@ -3209,7 +3288,8 @@ declare class Sandbox {
|
|
|
3209
3288
|
*/
|
|
3210
3289
|
startServer(options: {
|
|
3211
3290
|
slug: string;
|
|
3212
|
-
|
|
3291
|
+
install?: string;
|
|
3292
|
+
start: string;
|
|
3213
3293
|
path?: string;
|
|
3214
3294
|
env_file?: string;
|
|
3215
3295
|
environment?: Record<string, string>;
|
|
@@ -3233,6 +3313,14 @@ declare class Sandbox {
|
|
|
3233
3313
|
* @param slug - Server slug
|
|
3234
3314
|
*/
|
|
3235
3315
|
restartServer(slug: string): Promise<ServerResponse>;
|
|
3316
|
+
/**
|
|
3317
|
+
* Get logs for a managed server
|
|
3318
|
+
* @param slug - Server slug
|
|
3319
|
+
* @param options - Options for log retrieval
|
|
3320
|
+
*/
|
|
3321
|
+
getServerLogs(slug: string, options?: {
|
|
3322
|
+
stream?: ServerLogStream;
|
|
3323
|
+
}): Promise<ServerLogsResponse>;
|
|
3236
3324
|
/**
|
|
3237
3325
|
* Update server status (internal use)
|
|
3238
3326
|
* @param slug - Server slug
|