computesdk 1.12.0 → 1.13.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 CHANGED
@@ -1922,6 +1922,155 @@ declare class Child {
1922
1922
  }): Promise<void>;
1923
1923
  }
1924
1924
 
1925
+ /**
1926
+ * Overlay - Resource namespace for filesystem overlay operations
1927
+ *
1928
+ * Overlays enable instant sandbox setup from template directories by symlinking
1929
+ * files first for instant access, then copying heavy directories in the background.
1930
+ */
1931
+ /**
1932
+ * Options for creating an overlay
1933
+ */
1934
+ interface CreateOverlayOptions {
1935
+ /** Absolute path to source directory (template) */
1936
+ source: string;
1937
+ /** Relative path in sandbox where overlay will be mounted */
1938
+ target: string;
1939
+ }
1940
+ /**
1941
+ * Copy status for overlay background operations
1942
+ */
1943
+ type OverlayCopyStatus = 'pending' | 'in_progress' | 'complete' | 'failed';
1944
+ /**
1945
+ * Statistics about an overlay
1946
+ */
1947
+ interface OverlayStats {
1948
+ /** Number of symlinked files */
1949
+ symlinkedFiles: number;
1950
+ /** Number of symlinked directories */
1951
+ symlinkedDirs: number;
1952
+ /** Paths that were skipped (e.g., .git) */
1953
+ skipped: string[];
1954
+ }
1955
+ /**
1956
+ * Overlay information (client-side normalized type)
1957
+ */
1958
+ interface OverlayInfo {
1959
+ /** Unique overlay identifier */
1960
+ id: string;
1961
+ /** Absolute path to source directory */
1962
+ source: string;
1963
+ /** Relative path in sandbox */
1964
+ target: string;
1965
+ /** When the overlay was created */
1966
+ createdAt: string;
1967
+ /** Statistics about the overlay */
1968
+ stats: OverlayStats;
1969
+ /** Copy status for background operations */
1970
+ copyStatus: OverlayCopyStatus;
1971
+ /** Error message if copy failed */
1972
+ copyError?: string;
1973
+ }
1974
+ /**
1975
+ * API response for overlay operations (snake_case from server)
1976
+ */
1977
+ interface OverlayResponse {
1978
+ id: string;
1979
+ source: string;
1980
+ target: string;
1981
+ created_at: string;
1982
+ stats: {
1983
+ symlinked_files: number;
1984
+ symlinked_dirs: number;
1985
+ skipped: string[];
1986
+ };
1987
+ copy_status: string;
1988
+ copy_error?: string;
1989
+ }
1990
+ /**
1991
+ * API response for listing overlays
1992
+ */
1993
+ interface OverlayListResponse {
1994
+ overlays: OverlayResponse[];
1995
+ }
1996
+ /**
1997
+ * Overlay resource namespace
1998
+ *
1999
+ * @example
2000
+ * ```typescript
2001
+ * // Create an overlay from a template directory
2002
+ * const overlay = await sandbox.filesystem.overlay.create({
2003
+ * source: '/templates/nextjs',
2004
+ * target: 'project',
2005
+ * });
2006
+ * console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
2007
+ *
2008
+ * // List all overlays
2009
+ * const overlays = await sandbox.filesystem.overlay.list();
2010
+ *
2011
+ * // Get a specific overlay (useful for polling copy status)
2012
+ * const overlay = await sandbox.filesystem.overlay.retrieve('overlay-id');
2013
+ * if (overlay.copyStatus === 'complete') {
2014
+ * console.log('Background copy finished!');
2015
+ * }
2016
+ *
2017
+ * // Delete an overlay
2018
+ * await sandbox.filesystem.overlay.destroy('overlay-id');
2019
+ * ```
2020
+ */
2021
+ declare class Overlay {
2022
+ private createHandler;
2023
+ private listHandler;
2024
+ private retrieveHandler;
2025
+ private destroyHandler;
2026
+ constructor(handlers: {
2027
+ create: (options: CreateOverlayOptions) => Promise<OverlayResponse>;
2028
+ list: () => Promise<OverlayListResponse>;
2029
+ retrieve: (id: string) => Promise<OverlayResponse>;
2030
+ destroy: (id: string) => Promise<void>;
2031
+ });
2032
+ /**
2033
+ * Create a new overlay from a template directory
2034
+ *
2035
+ * The overlay symlinks files from the source directory into the target path,
2036
+ * allowing instant access to template files. Heavy directories (node_modules,
2037
+ * .venv, etc.) are copied in the background.
2038
+ *
2039
+ * @param options - Overlay creation options
2040
+ * @param options.source - Absolute path to source directory
2041
+ * @param options.target - Relative path in sandbox
2042
+ * @returns Overlay info with copy status
2043
+ */
2044
+ create(options: CreateOverlayOptions): Promise<OverlayInfo>;
2045
+ /**
2046
+ * List all overlays for the current sandbox
2047
+ * @returns Array of overlay info
2048
+ */
2049
+ list(): Promise<OverlayInfo[]>;
2050
+ /**
2051
+ * Retrieve a specific overlay by ID
2052
+ *
2053
+ * Useful for polling the copy status of an overlay.
2054
+ *
2055
+ * @param id - Overlay ID
2056
+ * @returns Overlay info
2057
+ */
2058
+ retrieve(id: string): Promise<OverlayInfo>;
2059
+ /**
2060
+ * Destroy (delete) an overlay
2061
+ * @param id - Overlay ID
2062
+ */
2063
+ destroy(id: string): Promise<void>;
2064
+ /**
2065
+ * Convert API response to OverlayInfo
2066
+ */
2067
+ private toOverlayInfo;
2068
+ /**
2069
+ * Validate and return copy status, defaulting to 'pending' for unknown values
2070
+ */
2071
+ private validateCopyStatus;
2072
+ }
2073
+
1925
2074
  /**
1926
2075
  * Binary WebSocket Protocol Implementation
1927
2076
  *
@@ -2030,6 +2179,14 @@ declare function isCommandExitError(error: unknown): error is CommandExitError;
2030
2179
  * Node.js: Pass WebSocket implementation (e.g., 'ws' library)
2031
2180
  */
2032
2181
 
2182
+ /**
2183
+ * Extended filesystem interface with overlay support
2184
+ */
2185
+ interface ExtendedFileSystem extends SandboxFileSystem {
2186
+ /** Overlay operations for template directories */
2187
+ readonly overlay: Overlay;
2188
+ }
2189
+
2033
2190
  /**
2034
2191
  * WebSocket constructor type
2035
2192
  */
@@ -2593,7 +2750,7 @@ interface BatchWriteResponse {
2593
2750
  declare class Sandbox {
2594
2751
  readonly sandboxId: string;
2595
2752
  readonly provider: string;
2596
- readonly filesystem: SandboxFileSystem;
2753
+ readonly filesystem: ExtendedFileSystem;
2597
2754
  readonly terminal: Terminal;
2598
2755
  readonly run: Run;
2599
2756
  readonly server: Server;
@@ -2827,6 +2984,47 @@ declare class Sandbox {
2827
2984
  operation: 'write' | 'delete';
2828
2985
  content?: string;
2829
2986
  }>): Promise<BatchWriteResponse>;
2987
+ /**
2988
+ * Create a new filesystem overlay from a template directory
2989
+ *
2990
+ * Overlays enable instant sandbox setup by symlinking template files first,
2991
+ * then copying heavy directories (node_modules, .venv, etc.) in the background.
2992
+ *
2993
+ * @param options - Overlay creation options
2994
+ * @param options.source - Absolute path to source directory (template)
2995
+ * @param options.target - Relative path in sandbox where overlay will be mounted
2996
+ * @returns Overlay response with copy status
2997
+ *
2998
+ * @example
2999
+ * ```typescript
3000
+ * // Prefer using sandbox.filesystem.overlay.create() for camelCase response
3001
+ * const overlay = await sandbox.filesystem.overlay.create({
3002
+ * source: '/templates/nextjs',
3003
+ * target: 'project',
3004
+ * });
3005
+ * console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
3006
+ * ```
3007
+ */
3008
+ createOverlay(options: CreateOverlayOptions): Promise<OverlayResponse>;
3009
+ /**
3010
+ * List all filesystem overlays for the current sandbox
3011
+ * @returns List of overlays with their copy status
3012
+ */
3013
+ listOverlays(): Promise<OverlayListResponse>;
3014
+ /**
3015
+ * Get a specific filesystem overlay by ID
3016
+ *
3017
+ * Useful for polling the copy status of an overlay.
3018
+ *
3019
+ * @param id - Overlay ID
3020
+ * @returns Overlay details with current copy status
3021
+ */
3022
+ getOverlay(id: string): Promise<OverlayResponse>;
3023
+ /**
3024
+ * Delete a filesystem overlay
3025
+ * @param id - Overlay ID
3026
+ */
3027
+ deleteOverlay(id: string): Promise<void>;
2830
3028
  /**
2831
3029
  * Create a new persistent terminal session
2832
3030
  *
@@ -3321,6 +3519,8 @@ interface CreateSandboxOptions {
3321
3519
  envs?: Record<string, string>;
3322
3520
  name?: string;
3323
3521
  namespace?: string;
3522
+ /** Docker image to use for the sandbox (for infrastructure providers like Railway) */
3523
+ image?: string;
3324
3524
  }
3325
3525
  /**
3326
3526
  * Options for finding or creating a named sandbox
@@ -3511,4 +3711,4 @@ declare const PROVIDER_ENV_VARS: {
3511
3711
  readonly blaxel: readonly ["BL_API_KEY", "BL_WORKSPACE"];
3512
3712
  };
3513
3713
 
3514
- export { type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, 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, autoConfigureCompute, buildProviderHeaders, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
3714
+ 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, autoConfigureCompute, buildProviderHeaders, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
package/dist/index.d.ts CHANGED
@@ -1922,6 +1922,155 @@ declare class Child {
1922
1922
  }): Promise<void>;
1923
1923
  }
1924
1924
 
1925
+ /**
1926
+ * Overlay - Resource namespace for filesystem overlay operations
1927
+ *
1928
+ * Overlays enable instant sandbox setup from template directories by symlinking
1929
+ * files first for instant access, then copying heavy directories in the background.
1930
+ */
1931
+ /**
1932
+ * Options for creating an overlay
1933
+ */
1934
+ interface CreateOverlayOptions {
1935
+ /** Absolute path to source directory (template) */
1936
+ source: string;
1937
+ /** Relative path in sandbox where overlay will be mounted */
1938
+ target: string;
1939
+ }
1940
+ /**
1941
+ * Copy status for overlay background operations
1942
+ */
1943
+ type OverlayCopyStatus = 'pending' | 'in_progress' | 'complete' | 'failed';
1944
+ /**
1945
+ * Statistics about an overlay
1946
+ */
1947
+ interface OverlayStats {
1948
+ /** Number of symlinked files */
1949
+ symlinkedFiles: number;
1950
+ /** Number of symlinked directories */
1951
+ symlinkedDirs: number;
1952
+ /** Paths that were skipped (e.g., .git) */
1953
+ skipped: string[];
1954
+ }
1955
+ /**
1956
+ * Overlay information (client-side normalized type)
1957
+ */
1958
+ interface OverlayInfo {
1959
+ /** Unique overlay identifier */
1960
+ id: string;
1961
+ /** Absolute path to source directory */
1962
+ source: string;
1963
+ /** Relative path in sandbox */
1964
+ target: string;
1965
+ /** When the overlay was created */
1966
+ createdAt: string;
1967
+ /** Statistics about the overlay */
1968
+ stats: OverlayStats;
1969
+ /** Copy status for background operations */
1970
+ copyStatus: OverlayCopyStatus;
1971
+ /** Error message if copy failed */
1972
+ copyError?: string;
1973
+ }
1974
+ /**
1975
+ * API response for overlay operations (snake_case from server)
1976
+ */
1977
+ interface OverlayResponse {
1978
+ id: string;
1979
+ source: string;
1980
+ target: string;
1981
+ created_at: string;
1982
+ stats: {
1983
+ symlinked_files: number;
1984
+ symlinked_dirs: number;
1985
+ skipped: string[];
1986
+ };
1987
+ copy_status: string;
1988
+ copy_error?: string;
1989
+ }
1990
+ /**
1991
+ * API response for listing overlays
1992
+ */
1993
+ interface OverlayListResponse {
1994
+ overlays: OverlayResponse[];
1995
+ }
1996
+ /**
1997
+ * Overlay resource namespace
1998
+ *
1999
+ * @example
2000
+ * ```typescript
2001
+ * // Create an overlay from a template directory
2002
+ * const overlay = await sandbox.filesystem.overlay.create({
2003
+ * source: '/templates/nextjs',
2004
+ * target: 'project',
2005
+ * });
2006
+ * console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
2007
+ *
2008
+ * // List all overlays
2009
+ * const overlays = await sandbox.filesystem.overlay.list();
2010
+ *
2011
+ * // Get a specific overlay (useful for polling copy status)
2012
+ * const overlay = await sandbox.filesystem.overlay.retrieve('overlay-id');
2013
+ * if (overlay.copyStatus === 'complete') {
2014
+ * console.log('Background copy finished!');
2015
+ * }
2016
+ *
2017
+ * // Delete an overlay
2018
+ * await sandbox.filesystem.overlay.destroy('overlay-id');
2019
+ * ```
2020
+ */
2021
+ declare class Overlay {
2022
+ private createHandler;
2023
+ private listHandler;
2024
+ private retrieveHandler;
2025
+ private destroyHandler;
2026
+ constructor(handlers: {
2027
+ create: (options: CreateOverlayOptions) => Promise<OverlayResponse>;
2028
+ list: () => Promise<OverlayListResponse>;
2029
+ retrieve: (id: string) => Promise<OverlayResponse>;
2030
+ destroy: (id: string) => Promise<void>;
2031
+ });
2032
+ /**
2033
+ * Create a new overlay from a template directory
2034
+ *
2035
+ * The overlay symlinks files from the source directory into the target path,
2036
+ * allowing instant access to template files. Heavy directories (node_modules,
2037
+ * .venv, etc.) are copied in the background.
2038
+ *
2039
+ * @param options - Overlay creation options
2040
+ * @param options.source - Absolute path to source directory
2041
+ * @param options.target - Relative path in sandbox
2042
+ * @returns Overlay info with copy status
2043
+ */
2044
+ create(options: CreateOverlayOptions): Promise<OverlayInfo>;
2045
+ /**
2046
+ * List all overlays for the current sandbox
2047
+ * @returns Array of overlay info
2048
+ */
2049
+ list(): Promise<OverlayInfo[]>;
2050
+ /**
2051
+ * Retrieve a specific overlay by ID
2052
+ *
2053
+ * Useful for polling the copy status of an overlay.
2054
+ *
2055
+ * @param id - Overlay ID
2056
+ * @returns Overlay info
2057
+ */
2058
+ retrieve(id: string): Promise<OverlayInfo>;
2059
+ /**
2060
+ * Destroy (delete) an overlay
2061
+ * @param id - Overlay ID
2062
+ */
2063
+ destroy(id: string): Promise<void>;
2064
+ /**
2065
+ * Convert API response to OverlayInfo
2066
+ */
2067
+ private toOverlayInfo;
2068
+ /**
2069
+ * Validate and return copy status, defaulting to 'pending' for unknown values
2070
+ */
2071
+ private validateCopyStatus;
2072
+ }
2073
+
1925
2074
  /**
1926
2075
  * Binary WebSocket Protocol Implementation
1927
2076
  *
@@ -2030,6 +2179,14 @@ declare function isCommandExitError(error: unknown): error is CommandExitError;
2030
2179
  * Node.js: Pass WebSocket implementation (e.g., 'ws' library)
2031
2180
  */
2032
2181
 
2182
+ /**
2183
+ * Extended filesystem interface with overlay support
2184
+ */
2185
+ interface ExtendedFileSystem extends SandboxFileSystem {
2186
+ /** Overlay operations for template directories */
2187
+ readonly overlay: Overlay;
2188
+ }
2189
+
2033
2190
  /**
2034
2191
  * WebSocket constructor type
2035
2192
  */
@@ -2593,7 +2750,7 @@ interface BatchWriteResponse {
2593
2750
  declare class Sandbox {
2594
2751
  readonly sandboxId: string;
2595
2752
  readonly provider: string;
2596
- readonly filesystem: SandboxFileSystem;
2753
+ readonly filesystem: ExtendedFileSystem;
2597
2754
  readonly terminal: Terminal;
2598
2755
  readonly run: Run;
2599
2756
  readonly server: Server;
@@ -2827,6 +2984,47 @@ declare class Sandbox {
2827
2984
  operation: 'write' | 'delete';
2828
2985
  content?: string;
2829
2986
  }>): Promise<BatchWriteResponse>;
2987
+ /**
2988
+ * Create a new filesystem overlay from a template directory
2989
+ *
2990
+ * Overlays enable instant sandbox setup by symlinking template files first,
2991
+ * then copying heavy directories (node_modules, .venv, etc.) in the background.
2992
+ *
2993
+ * @param options - Overlay creation options
2994
+ * @param options.source - Absolute path to source directory (template)
2995
+ * @param options.target - Relative path in sandbox where overlay will be mounted
2996
+ * @returns Overlay response with copy status
2997
+ *
2998
+ * @example
2999
+ * ```typescript
3000
+ * // Prefer using sandbox.filesystem.overlay.create() for camelCase response
3001
+ * const overlay = await sandbox.filesystem.overlay.create({
3002
+ * source: '/templates/nextjs',
3003
+ * target: 'project',
3004
+ * });
3005
+ * console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
3006
+ * ```
3007
+ */
3008
+ createOverlay(options: CreateOverlayOptions): Promise<OverlayResponse>;
3009
+ /**
3010
+ * List all filesystem overlays for the current sandbox
3011
+ * @returns List of overlays with their copy status
3012
+ */
3013
+ listOverlays(): Promise<OverlayListResponse>;
3014
+ /**
3015
+ * Get a specific filesystem overlay by ID
3016
+ *
3017
+ * Useful for polling the copy status of an overlay.
3018
+ *
3019
+ * @param id - Overlay ID
3020
+ * @returns Overlay details with current copy status
3021
+ */
3022
+ getOverlay(id: string): Promise<OverlayResponse>;
3023
+ /**
3024
+ * Delete a filesystem overlay
3025
+ * @param id - Overlay ID
3026
+ */
3027
+ deleteOverlay(id: string): Promise<void>;
2830
3028
  /**
2831
3029
  * Create a new persistent terminal session
2832
3030
  *
@@ -3321,6 +3519,8 @@ interface CreateSandboxOptions {
3321
3519
  envs?: Record<string, string>;
3322
3520
  name?: string;
3323
3521
  namespace?: string;
3522
+ /** Docker image to use for the sandbox (for infrastructure providers like Railway) */
3523
+ image?: string;
3324
3524
  }
3325
3525
  /**
3326
3526
  * Options for finding or creating a named sandbox
@@ -3511,4 +3711,4 @@ declare const PROVIDER_ENV_VARS: {
3511
3711
  readonly blaxel: readonly ["BL_API_KEY", "BL_WORKSPACE"];
3512
3712
  };
3513
3713
 
3514
- export { type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, 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, autoConfigureCompute, buildProviderHeaders, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
3714
+ 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, autoConfigureCompute, buildProviderHeaders, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
package/dist/index.js CHANGED
@@ -1898,6 +1898,87 @@ var Child = class {
1898
1898
  }
1899
1899
  };
1900
1900
 
1901
+ // src/client/resources/overlay.ts
1902
+ var Overlay = class {
1903
+ constructor(handlers) {
1904
+ this.createHandler = handlers.create;
1905
+ this.listHandler = handlers.list;
1906
+ this.retrieveHandler = handlers.retrieve;
1907
+ this.destroyHandler = handlers.destroy;
1908
+ }
1909
+ /**
1910
+ * Create a new overlay from a template directory
1911
+ *
1912
+ * The overlay symlinks files from the source directory into the target path,
1913
+ * allowing instant access to template files. Heavy directories (node_modules,
1914
+ * .venv, etc.) are copied in the background.
1915
+ *
1916
+ * @param options - Overlay creation options
1917
+ * @param options.source - Absolute path to source directory
1918
+ * @param options.target - Relative path in sandbox
1919
+ * @returns Overlay info with copy status
1920
+ */
1921
+ async create(options) {
1922
+ const response = await this.createHandler(options);
1923
+ return this.toOverlayInfo(response);
1924
+ }
1925
+ /**
1926
+ * List all overlays for the current sandbox
1927
+ * @returns Array of overlay info
1928
+ */
1929
+ async list() {
1930
+ const response = await this.listHandler();
1931
+ return response.overlays.map((o) => this.toOverlayInfo(o));
1932
+ }
1933
+ /**
1934
+ * Retrieve a specific overlay by ID
1935
+ *
1936
+ * Useful for polling the copy status of an overlay.
1937
+ *
1938
+ * @param id - Overlay ID
1939
+ * @returns Overlay info
1940
+ */
1941
+ async retrieve(id) {
1942
+ const response = await this.retrieveHandler(id);
1943
+ return this.toOverlayInfo(response);
1944
+ }
1945
+ /**
1946
+ * Destroy (delete) an overlay
1947
+ * @param id - Overlay ID
1948
+ */
1949
+ async destroy(id) {
1950
+ return this.destroyHandler(id);
1951
+ }
1952
+ /**
1953
+ * Convert API response to OverlayInfo
1954
+ */
1955
+ toOverlayInfo(response) {
1956
+ return {
1957
+ id: response.id,
1958
+ source: response.source,
1959
+ target: response.target,
1960
+ createdAt: response.created_at,
1961
+ stats: {
1962
+ symlinkedFiles: response.stats.symlinked_files,
1963
+ symlinkedDirs: response.stats.symlinked_dirs,
1964
+ skipped: response.stats.skipped
1965
+ },
1966
+ copyStatus: this.validateCopyStatus(response.copy_status),
1967
+ copyError: response.copy_error
1968
+ };
1969
+ }
1970
+ /**
1971
+ * Validate and return copy status, defaulting to 'pending' for unknown values
1972
+ */
1973
+ validateCopyStatus(status) {
1974
+ const validStatuses = ["pending", "in_progress", "complete", "failed"];
1975
+ if (validStatuses.includes(status)) {
1976
+ return status;
1977
+ }
1978
+ return "pending";
1979
+ }
1980
+ };
1981
+
1901
1982
  // src/client/types.ts
1902
1983
  var CommandExitError = class extends Error {
1903
1984
  constructor(result) {
@@ -1992,7 +2073,13 @@ var Sandbox = class {
1992
2073
  },
1993
2074
  remove: async (path) => {
1994
2075
  await this.deleteFile(path);
1995
- }
2076
+ },
2077
+ overlay: new Overlay({
2078
+ create: async (options) => this.createOverlay(options),
2079
+ list: async () => this.listOverlays(),
2080
+ retrieve: async (id) => this.getOverlay(id),
2081
+ destroy: async (id) => this.deleteOverlay(id)
2082
+ })
1996
2083
  };
1997
2084
  this.terminal = new Terminal({
1998
2085
  create: async (options) => this.createTerminal(options),
@@ -2477,6 +2564,63 @@ API request failed (${response.status}): ${error}`
2477
2564
  });
2478
2565
  }
2479
2566
  // ============================================================================
2567
+ // Filesystem Overlays
2568
+ // ============================================================================
2569
+ /**
2570
+ * Create a new filesystem overlay from a template directory
2571
+ *
2572
+ * Overlays enable instant sandbox setup by symlinking template files first,
2573
+ * then copying heavy directories (node_modules, .venv, etc.) in the background.
2574
+ *
2575
+ * @param options - Overlay creation options
2576
+ * @param options.source - Absolute path to source directory (template)
2577
+ * @param options.target - Relative path in sandbox where overlay will be mounted
2578
+ * @returns Overlay response with copy status
2579
+ *
2580
+ * @example
2581
+ * ```typescript
2582
+ * // Prefer using sandbox.filesystem.overlay.create() for camelCase response
2583
+ * const overlay = await sandbox.filesystem.overlay.create({
2584
+ * source: '/templates/nextjs',
2585
+ * target: 'project',
2586
+ * });
2587
+ * console.log(overlay.copyStatus); // 'pending' | 'in_progress' | 'complete' | 'failed'
2588
+ * ```
2589
+ */
2590
+ async createOverlay(options) {
2591
+ return this.request("/filesystem/overlays", {
2592
+ method: "POST",
2593
+ body: JSON.stringify(options)
2594
+ });
2595
+ }
2596
+ /**
2597
+ * List all filesystem overlays for the current sandbox
2598
+ * @returns List of overlays with their copy status
2599
+ */
2600
+ async listOverlays() {
2601
+ return this.request("/filesystem/overlays");
2602
+ }
2603
+ /**
2604
+ * Get a specific filesystem overlay by ID
2605
+ *
2606
+ * Useful for polling the copy status of an overlay.
2607
+ *
2608
+ * @param id - Overlay ID
2609
+ * @returns Overlay details with current copy status
2610
+ */
2611
+ async getOverlay(id) {
2612
+ return this.request(`/filesystem/overlays/${id}`);
2613
+ }
2614
+ /**
2615
+ * Delete a filesystem overlay
2616
+ * @param id - Overlay ID
2617
+ */
2618
+ async deleteOverlay(id) {
2619
+ return this.request(`/filesystem/overlays/${id}`, {
2620
+ method: "DELETE"
2621
+ });
2622
+ }
2623
+ // ============================================================================
2480
2624
  // Terminal Management
2481
2625
  // ============================================================================
2482
2626
  /**