computesdk 1.13.0 → 1.16.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 +216 -26
- package/dist/index.d.ts +216 -26
- package/dist/index.js +193 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +193 -17
- 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
|
/**
|
|
@@ -1779,6 +1834,12 @@ interface CommandResult {
|
|
|
1779
1834
|
stderr: string;
|
|
1780
1835
|
exitCode: number;
|
|
1781
1836
|
durationMs: number;
|
|
1837
|
+
/** Command ID (present for background commands) */
|
|
1838
|
+
cmdId?: string;
|
|
1839
|
+
/** Terminal ID (present for background commands) */
|
|
1840
|
+
terminalId?: string;
|
|
1841
|
+
/** Command status (present for background commands) */
|
|
1842
|
+
status?: 'running' | 'completed' | 'failed';
|
|
1782
1843
|
}
|
|
1783
1844
|
/**
|
|
1784
1845
|
* Supported languages for code execution
|
|
@@ -1791,6 +1852,13 @@ interface CodeRunOptions {
|
|
|
1791
1852
|
/** Programming language (optional - will auto-detect if not specified) */
|
|
1792
1853
|
language?: CodeLanguage;
|
|
1793
1854
|
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Options for waiting for command completion
|
|
1857
|
+
*/
|
|
1858
|
+
interface CommandWaitOptions {
|
|
1859
|
+
/** Timeout in seconds to wait for command completion (default: 300, max: 300) */
|
|
1860
|
+
timeoutSeconds?: number;
|
|
1861
|
+
}
|
|
1794
1862
|
/**
|
|
1795
1863
|
* Command execution options
|
|
1796
1864
|
*/
|
|
@@ -1803,6 +1871,8 @@ interface CommandRunOptions {
|
|
|
1803
1871
|
cwd?: string;
|
|
1804
1872
|
/** Environment variables (optional) */
|
|
1805
1873
|
env?: Record<string, string>;
|
|
1874
|
+
/** If true, wait for background command to complete before returning (default: false) */
|
|
1875
|
+
waitForCompletion?: boolean | CommandWaitOptions;
|
|
1806
1876
|
}
|
|
1807
1877
|
/**
|
|
1808
1878
|
* Run - Resource namespace for executing code and commands
|
|
@@ -1821,14 +1891,28 @@ interface CommandRunOptions {
|
|
|
1821
1891
|
* const result = await sandbox.run.command('ls -la');
|
|
1822
1892
|
* console.log(result.stdout);
|
|
1823
1893
|
* console.log(result.exitCode);
|
|
1894
|
+
*
|
|
1895
|
+
* // Run a command in background and wait for completion
|
|
1896
|
+
* const result = await sandbox.run.command('npm install', {
|
|
1897
|
+
* background: true,
|
|
1898
|
+
* waitForCompletion: true, // blocks until command completes
|
|
1899
|
+
* });
|
|
1900
|
+
* console.log(result.exitCode);
|
|
1901
|
+
*
|
|
1902
|
+
* // Run in background without waiting (fire-and-forget)
|
|
1903
|
+
* const result = await sandbox.run.command('npm install', { background: true });
|
|
1904
|
+
* console.log(result.cmdId); // command ID for manual tracking
|
|
1905
|
+
* console.log(result.terminalId); // terminal ID for manual tracking
|
|
1824
1906
|
* ```
|
|
1825
1907
|
*/
|
|
1826
1908
|
declare class Run {
|
|
1827
1909
|
private codeHandler;
|
|
1828
1910
|
private commandHandler;
|
|
1911
|
+
private waitHandler?;
|
|
1829
1912
|
constructor(handlers: {
|
|
1830
1913
|
code: (code: string, options?: CodeRunOptions) => Promise<CodeResult>;
|
|
1831
1914
|
command: (command: string, options?: CommandRunOptions) => Promise<CommandResult>;
|
|
1915
|
+
wait?: (terminalId: string, cmdId: string, options?: CommandWaitOptions) => Promise<CommandResult>;
|
|
1832
1916
|
});
|
|
1833
1917
|
/**
|
|
1834
1918
|
* Execute code with automatic language detection
|
|
@@ -1850,9 +1934,24 @@ declare class Run {
|
|
|
1850
1934
|
* @param options.background - Run in background (optional)
|
|
1851
1935
|
* @param options.cwd - Working directory for the command (optional)
|
|
1852
1936
|
* @param options.env - Environment variables (optional)
|
|
1937
|
+
* @param options.waitForCompletion - If true (with background), wait for command to complete
|
|
1853
1938
|
* @returns Command execution result with stdout, stderr, exit code, and duration
|
|
1854
1939
|
*/
|
|
1855
1940
|
command(command: string, options?: CommandRunOptions): Promise<CommandResult>;
|
|
1941
|
+
/**
|
|
1942
|
+
* Wait for a background command to complete
|
|
1943
|
+
*
|
|
1944
|
+
* Uses the configured wait handler to block until the command
|
|
1945
|
+
* is complete or fails (typically via server-side long-polling).
|
|
1946
|
+
* Throws an error if the command fails or times out.
|
|
1947
|
+
*
|
|
1948
|
+
* @param terminalId - Terminal ID from background command result
|
|
1949
|
+
* @param cmdId - Command ID from background command result
|
|
1950
|
+
* @param options - Wait options passed to the handler
|
|
1951
|
+
* @returns Command result with final status
|
|
1952
|
+
* @throws Error if command fails or times out
|
|
1953
|
+
*/
|
|
1954
|
+
waitForCompletion(terminalId: string, cmdId: string, options?: CommandWaitOptions): Promise<CommandResult>;
|
|
1856
1955
|
}
|
|
1857
1956
|
|
|
1858
1957
|
/**
|
|
@@ -1925,9 +2024,22 @@ declare class Child {
|
|
|
1925
2024
|
/**
|
|
1926
2025
|
* Overlay - Resource namespace for filesystem overlay operations
|
|
1927
2026
|
*
|
|
1928
|
-
* Overlays enable instant sandbox setup from template directories by
|
|
1929
|
-
* files
|
|
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
|
|
1930
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
|
+
}
|
|
1931
2043
|
/**
|
|
1932
2044
|
* Options for creating an overlay
|
|
1933
2045
|
*/
|
|
@@ -1936,6 +2048,10 @@ interface CreateOverlayOptions {
|
|
|
1936
2048
|
source: string;
|
|
1937
2049
|
/** Relative path in sandbox where overlay will be mounted */
|
|
1938
2050
|
target: string;
|
|
2051
|
+
/** Glob patterns to ignore (e.g., ["node_modules", "*.log"]) */
|
|
2052
|
+
ignore?: string[];
|
|
2053
|
+
/** If true, wait for background copy to complete before returning (default: false) */
|
|
2054
|
+
waitForCompletion?: boolean | WaitForCompletionOptions;
|
|
1939
2055
|
}
|
|
1940
2056
|
/**
|
|
1941
2057
|
* Copy status for overlay background operations
|
|
@@ -1945,11 +2061,11 @@ type OverlayCopyStatus = 'pending' | 'in_progress' | 'complete' | 'failed';
|
|
|
1945
2061
|
* Statistics about an overlay
|
|
1946
2062
|
*/
|
|
1947
2063
|
interface OverlayStats {
|
|
1948
|
-
/** Number of
|
|
1949
|
-
|
|
1950
|
-
/** Number of
|
|
1951
|
-
|
|
1952
|
-
/** Paths that were skipped (e.g., .git) */
|
|
2064
|
+
/** Number of copied files */
|
|
2065
|
+
copiedFiles: number;
|
|
2066
|
+
/** Number of copied directories (heavy dirs copied in background) */
|
|
2067
|
+
copiedDirs: number;
|
|
2068
|
+
/** Paths that were skipped (e.g., .git, ignored patterns) */
|
|
1953
2069
|
skipped: string[];
|
|
1954
2070
|
}
|
|
1955
2071
|
/**
|
|
@@ -1980,8 +2096,8 @@ interface OverlayResponse {
|
|
|
1980
2096
|
target: string;
|
|
1981
2097
|
created_at: string;
|
|
1982
2098
|
stats: {
|
|
1983
|
-
|
|
1984
|
-
|
|
2099
|
+
copied_files: number;
|
|
2100
|
+
copied_dirs: number;
|
|
1985
2101
|
skipped: string[];
|
|
1986
2102
|
};
|
|
1987
2103
|
copy_status: string;
|
|
@@ -2005,6 +2121,16 @@ interface OverlayListResponse {
|
|
|
2005
2121
|
* });
|
|
2006
2122
|
* console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
|
|
2007
2123
|
*
|
|
2124
|
+
* // Create an overlay and wait for background copy to complete
|
|
2125
|
+
* const overlay = await sandbox.filesystem.overlay.create({
|
|
2126
|
+
* source: '/templates/nextjs',
|
|
2127
|
+
* target: 'project',
|
|
2128
|
+
* waitForCompletion: true, // blocks until copy is complete
|
|
2129
|
+
* });
|
|
2130
|
+
*
|
|
2131
|
+
* // Wait for an existing overlay's copy to complete
|
|
2132
|
+
* const overlay = await sandbox.filesystem.overlay.waitForCompletion('overlay-id');
|
|
2133
|
+
*
|
|
2008
2134
|
* // List all overlays
|
|
2009
2135
|
* const overlays = await sandbox.filesystem.overlay.list();
|
|
2010
2136
|
*
|
|
@@ -2032,13 +2158,15 @@ declare class Overlay {
|
|
|
2032
2158
|
/**
|
|
2033
2159
|
* Create a new overlay from a template directory
|
|
2034
2160
|
*
|
|
2035
|
-
* The overlay
|
|
2036
|
-
*
|
|
2037
|
-
*
|
|
2161
|
+
* The overlay copies files from the source directory into the target path
|
|
2162
|
+
* for better isolation. Heavy directories (node_modules, .venv, etc.) are
|
|
2163
|
+
* copied in the background. Use the `ignore` option to exclude files/directories.
|
|
2038
2164
|
*
|
|
2039
2165
|
* @param options - Overlay creation options
|
|
2040
2166
|
* @param options.source - Absolute path to source directory
|
|
2041
2167
|
* @param options.target - Relative path in sandbox
|
|
2168
|
+
* @param options.ignore - Glob patterns to ignore (e.g., ["node_modules", "*.log"])
|
|
2169
|
+
* @param options.waitForCompletion - If true or options object, wait for background copy to complete
|
|
2042
2170
|
* @returns Overlay info with copy status
|
|
2043
2171
|
*/
|
|
2044
2172
|
create(options: CreateOverlayOptions): Promise<OverlayInfo>;
|
|
@@ -2061,6 +2189,18 @@ declare class Overlay {
|
|
|
2061
2189
|
* @param id - Overlay ID
|
|
2062
2190
|
*/
|
|
2063
2191
|
destroy(id: string): Promise<void>;
|
|
2192
|
+
/**
|
|
2193
|
+
* Wait for an overlay's background copy to complete
|
|
2194
|
+
*
|
|
2195
|
+
* Polls the overlay status with exponential backoff until the copy
|
|
2196
|
+
* is complete or fails. Throws an error if the copy fails or times out.
|
|
2197
|
+
*
|
|
2198
|
+
* @param id - Overlay ID
|
|
2199
|
+
* @param options - Polling options
|
|
2200
|
+
* @returns Overlay info with final copy status
|
|
2201
|
+
* @throws Error if copy fails or times out
|
|
2202
|
+
*/
|
|
2203
|
+
waitForCompletion(id: string, options?: WaitForCompletionOptions): Promise<OverlayInfo>;
|
|
2064
2204
|
/**
|
|
2065
2205
|
* Convert API response to OverlayInfo
|
|
2066
2206
|
*/
|
|
@@ -2513,6 +2653,7 @@ interface TerminalResponse {
|
|
|
2513
2653
|
/**
|
|
2514
2654
|
* Server status types
|
|
2515
2655
|
*
|
|
2656
|
+
* - `installing`: Running install command (e.g., npm install) before starting
|
|
2516
2657
|
* - `starting`: Initial startup of the server process
|
|
2517
2658
|
* - `running`: Server process is running
|
|
2518
2659
|
* - `ready`: Server is running and ready to accept traffic
|
|
@@ -2520,7 +2661,7 @@ interface TerminalResponse {
|
|
|
2520
2661
|
* - `stopped`: Server was intentionally stopped
|
|
2521
2662
|
* - `restarting`: Server is being automatically restarted by the supervisor
|
|
2522
2663
|
*/
|
|
2523
|
-
type ServerStatus = 'starting' | 'running' | 'ready' | 'failed' | 'stopped' | 'restarting';
|
|
2664
|
+
type ServerStatus = 'installing' | 'starting' | 'running' | 'ready' | 'failed' | 'stopped' | 'restarting';
|
|
2524
2665
|
/**
|
|
2525
2666
|
* Server restart policy
|
|
2526
2667
|
* - `never`: No automatic restart (default)
|
|
@@ -2534,8 +2675,10 @@ type RestartPolicy = 'never' | 'on-failure' | 'always';
|
|
|
2534
2675
|
interface ServerInfo {
|
|
2535
2676
|
/** Unique server identifier */
|
|
2536
2677
|
slug: string;
|
|
2678
|
+
/** Install command (optional, runs blocking before start) */
|
|
2679
|
+
install?: string;
|
|
2537
2680
|
/** Command used to start the server */
|
|
2538
|
-
|
|
2681
|
+
start: string;
|
|
2539
2682
|
/** Working directory path */
|
|
2540
2683
|
path: string;
|
|
2541
2684
|
/** Original path before resolution */
|
|
@@ -2599,6 +2742,22 @@ interface ServerStopResponse {
|
|
|
2599
2742
|
slug: string;
|
|
2600
2743
|
};
|
|
2601
2744
|
}
|
|
2745
|
+
/**
|
|
2746
|
+
* Server logs stream type
|
|
2747
|
+
*/
|
|
2748
|
+
type ServerLogStream = 'stdout' | 'stderr' | 'combined';
|
|
2749
|
+
/**
|
|
2750
|
+
* Server logs response
|
|
2751
|
+
*/
|
|
2752
|
+
interface ServerLogsResponse {
|
|
2753
|
+
status: string;
|
|
2754
|
+
message: string;
|
|
2755
|
+
data: {
|
|
2756
|
+
slug: string;
|
|
2757
|
+
stream: ServerLogStream;
|
|
2758
|
+
logs: string;
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
2602
2761
|
/**
|
|
2603
2762
|
* Server status update response
|
|
2604
2763
|
*/
|
|
@@ -3097,6 +3256,26 @@ declare class Sandbox {
|
|
|
3097
3256
|
* @throws {Error} If terminal is in PTY mode, command not found, or timeout occurs
|
|
3098
3257
|
*/
|
|
3099
3258
|
waitForCommand(terminalId: string, cmdId: string, timeout?: number): Promise<CommandDetailsResponse>;
|
|
3259
|
+
/**
|
|
3260
|
+
* Wait for a background command to complete using long-polling
|
|
3261
|
+
*
|
|
3262
|
+
* Uses the server's long-polling endpoint with configurable timeout.
|
|
3263
|
+
* The tunnel supports up to 5 minutes (300 seconds) via X-Request-Timeout header.
|
|
3264
|
+
*
|
|
3265
|
+
* @param terminalId - The terminal ID
|
|
3266
|
+
* @param cmdId - The command ID
|
|
3267
|
+
* @param options - Wait options (timeoutSeconds, default 300)
|
|
3268
|
+
* @returns Command result with final status
|
|
3269
|
+
* @throws Error if command fails or times out
|
|
3270
|
+
* @internal
|
|
3271
|
+
*/
|
|
3272
|
+
private waitForCommandCompletion;
|
|
3273
|
+
/**
|
|
3274
|
+
* Wait for a command with extended timeout support
|
|
3275
|
+
* Uses X-Request-Timeout header for tunnel timeout configuration
|
|
3276
|
+
* @internal
|
|
3277
|
+
*/
|
|
3278
|
+
private waitForCommandWithTimeout;
|
|
3100
3279
|
/**
|
|
3101
3280
|
* Create a new file watcher with WebSocket integration
|
|
3102
3281
|
* @param path - Path to watch
|
|
@@ -3176,7 +3355,8 @@ declare class Sandbox {
|
|
|
3176
3355
|
*
|
|
3177
3356
|
* @param options - Server configuration
|
|
3178
3357
|
* @param options.slug - Unique server identifier
|
|
3179
|
-
* @param options.
|
|
3358
|
+
* @param options.install - Install command (optional, runs blocking before start, e.g., "npm install")
|
|
3359
|
+
* @param options.start - Command to start the server (e.g., "npm run dev")
|
|
3180
3360
|
* @param options.path - Working directory (optional)
|
|
3181
3361
|
* @param options.env_file - Path to .env file relative to path (optional)
|
|
3182
3362
|
* @param options.environment - Inline environment variables (merged with env_file if both provided)
|
|
@@ -3190,14 +3370,15 @@ declare class Sandbox {
|
|
|
3190
3370
|
* // Basic server
|
|
3191
3371
|
* await sandbox.startServer({
|
|
3192
3372
|
* slug: 'web',
|
|
3193
|
-
*
|
|
3373
|
+
* start: 'npm run dev',
|
|
3194
3374
|
* path: '/app',
|
|
3195
3375
|
* });
|
|
3196
3376
|
*
|
|
3197
|
-
* // With supervisor settings
|
|
3377
|
+
* // With install command and supervisor settings
|
|
3198
3378
|
* await sandbox.startServer({
|
|
3199
3379
|
* slug: 'api',
|
|
3200
|
-
*
|
|
3380
|
+
* install: 'npm install',
|
|
3381
|
+
* start: 'node server.js',
|
|
3201
3382
|
* path: '/app',
|
|
3202
3383
|
* environment: { NODE_ENV: 'production', PORT: '3000' },
|
|
3203
3384
|
* restart_policy: 'on-failure',
|
|
@@ -3209,7 +3390,8 @@ declare class Sandbox {
|
|
|
3209
3390
|
*/
|
|
3210
3391
|
startServer(options: {
|
|
3211
3392
|
slug: string;
|
|
3212
|
-
|
|
3393
|
+
install?: string;
|
|
3394
|
+
start: string;
|
|
3213
3395
|
path?: string;
|
|
3214
3396
|
env_file?: string;
|
|
3215
3397
|
environment?: Record<string, string>;
|
|
@@ -3233,6 +3415,14 @@ declare class Sandbox {
|
|
|
3233
3415
|
* @param slug - Server slug
|
|
3234
3416
|
*/
|
|
3235
3417
|
restartServer(slug: string): Promise<ServerResponse>;
|
|
3418
|
+
/**
|
|
3419
|
+
* Get logs for a managed server
|
|
3420
|
+
* @param slug - Server slug
|
|
3421
|
+
* @param options - Options for log retrieval
|
|
3422
|
+
*/
|
|
3423
|
+
getServerLogs(slug: string, options?: {
|
|
3424
|
+
stream?: ServerLogStream;
|
|
3425
|
+
}): Promise<ServerLogsResponse>;
|
|
3236
3426
|
/**
|
|
3237
3427
|
* Update server status (internal use)
|
|
3238
3428
|
* @param slug - Server slug
|