@cloudflare/sandbox 0.10.1 → 0.10.2
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/Dockerfile +32 -0
- package/README.md +46 -0
- package/dist/bridge/index.d.ts +0 -6
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/index.js +75 -23
- package/dist/bridge/index.js.map +1 -1
- package/dist/{errors-CBi-O-pF.js → errors-8Hvune8K.js} +2 -2
- package/dist/{errors-CBi-O-pF.js.map → errors-8Hvune8K.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/openai/index.d.ts +1 -1
- package/dist/opencode/index.d.ts +1 -1
- package/dist/opencode/index.js +1 -1
- package/dist/{sandbox-uC1vzWtG.js → sandbox-BcEq4aUF.js} +890 -78
- package/dist/sandbox-BcEq4aUF.js.map +1 -0
- package/dist/{sandbox-BVgScWy9.d.ts → sandbox-KdzTTnWq.d.ts} +198 -42
- package/dist/sandbox-KdzTTnWq.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/sandbox-BVgScWy9.d.ts.map +0 -1
- package/dist/sandbox-uC1vzWtG.js.map +0 -1
|
@@ -24,21 +24,29 @@ interface DesktopProcessHealth {
|
|
|
24
24
|
uptime?: number;
|
|
25
25
|
}
|
|
26
26
|
type DesktopImageFormat = 'png' | 'jpeg' | 'webp';
|
|
27
|
-
interface
|
|
28
|
-
|
|
27
|
+
interface DesktopScreenshotOptions {
|
|
28
|
+
/**
|
|
29
|
+
* How the SDK returns the screenshot payload to the caller.
|
|
30
|
+
* - `'base64'` (default): `data` is a base64-encoded string (also the wire format).
|
|
31
|
+
* - `'bytes'`: client-side convenience that base64-decodes the wire payload
|
|
32
|
+
* into a `Uint8Array` before returning. The wire/server contract is
|
|
33
|
+
* always base64.
|
|
34
|
+
*/
|
|
35
|
+
format?: 'base64' | 'bytes';
|
|
29
36
|
imageFormat?: DesktopImageFormat;
|
|
30
37
|
quality?: number;
|
|
31
38
|
showCursor?: boolean;
|
|
32
39
|
}
|
|
33
|
-
interface DesktopScreenshotRegionRequest extends DesktopScreenshotRequest {
|
|
34
|
-
region: DesktopScreenshotRegion;
|
|
35
|
-
}
|
|
36
40
|
interface DesktopScreenshotRegion {
|
|
37
41
|
x: number;
|
|
38
42
|
y: number;
|
|
39
43
|
width: number;
|
|
40
44
|
height: number;
|
|
41
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Screenshot payload returned to the SDK caller when `format` is `'base64'`
|
|
48
|
+
* (the default). Matches the wire shape sent by the container.
|
|
49
|
+
*/
|
|
42
50
|
interface DesktopScreenshotResult {
|
|
43
51
|
success: boolean;
|
|
44
52
|
data: string;
|
|
@@ -46,6 +54,14 @@ interface DesktopScreenshotResult {
|
|
|
46
54
|
width: number;
|
|
47
55
|
height: number;
|
|
48
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Screenshot payload returned to the SDK caller when `format: 'bytes'` is
|
|
59
|
+
* requested. The SDK client decodes the base64 wire payload into a
|
|
60
|
+
* `Uint8Array`; the server/wire contract is unchanged.
|
|
61
|
+
*/
|
|
62
|
+
interface DesktopScreenshotBytesResult extends Omit<DesktopScreenshotResult, 'data'> {
|
|
63
|
+
data: Uint8Array;
|
|
64
|
+
}
|
|
49
65
|
type DesktopMouseButton = 'left' | 'right' | 'middle';
|
|
50
66
|
type DesktopScrollDirection = 'up' | 'down' | 'left' | 'right';
|
|
51
67
|
interface DesktopCursorPosition {
|
|
@@ -1392,9 +1408,36 @@ interface LocalMountBucketOptions {
|
|
|
1392
1408
|
readOnly?: boolean;
|
|
1393
1409
|
}
|
|
1394
1410
|
/**
|
|
1395
|
-
* Options for mounting
|
|
1411
|
+
* Options for mounting an R2 binding via credential-less egress interception.
|
|
1412
|
+
*/
|
|
1413
|
+
interface R2BindingMountBucketOptions {
|
|
1414
|
+
/**
|
|
1415
|
+
* Must not be set — distinguishes this variant from RemoteMountBucketOptions.
|
|
1416
|
+
*/
|
|
1417
|
+
endpoint?: never;
|
|
1418
|
+
/**
|
|
1419
|
+
* Optional prefix/subdirectory within the bucket to mount.
|
|
1420
|
+
*
|
|
1421
|
+
* When specified, only the contents under this prefix will be visible
|
|
1422
|
+
* at the mount point.
|
|
1423
|
+
*/
|
|
1424
|
+
prefix?: string;
|
|
1425
|
+
/**
|
|
1426
|
+
* Mount filesystem as read-only
|
|
1427
|
+
* Default: false
|
|
1428
|
+
*/
|
|
1429
|
+
readOnly?: boolean;
|
|
1430
|
+
/**
|
|
1431
|
+
* Advanced: Override or extend s3fs options.
|
|
1432
|
+
* Provider defaults for R2 are still applied automatically.
|
|
1433
|
+
*/
|
|
1434
|
+
s3fsOptions?: string[];
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Options for mounting a bucket — remote (s3fs-FUSE), local (R2 binding sync),
|
|
1438
|
+
* or R2 egress (credential-less s3fs via egress interception).
|
|
1396
1439
|
*/
|
|
1397
|
-
type MountBucketOptions = RemoteMountBucketOptions | LocalMountBucketOptions;
|
|
1440
|
+
type MountBucketOptions = RemoteMountBucketOptions | LocalMountBucketOptions | R2BindingMountBucketOptions;
|
|
1398
1441
|
interface ISandbox {
|
|
1399
1442
|
exec(command: string, options?: ExecOptions): Promise<ExecResult>;
|
|
1400
1443
|
startProcess(command: string, options?: ProcessOptions): Promise<Process>;
|
|
@@ -1714,8 +1757,20 @@ interface SandboxDesktopAPI {
|
|
|
1714
1757
|
}): Promise<DesktopStartResult>;
|
|
1715
1758
|
stop(): Promise<DesktopStopResult>;
|
|
1716
1759
|
status(): Promise<DesktopStatusResult>;
|
|
1717
|
-
screenshot(options?:
|
|
1718
|
-
|
|
1760
|
+
screenshot(options?: DesktopScreenshotOptions & {
|
|
1761
|
+
format?: 'base64';
|
|
1762
|
+
}): Promise<DesktopScreenshotResult>;
|
|
1763
|
+
screenshot(options: DesktopScreenshotOptions & {
|
|
1764
|
+
format: 'bytes';
|
|
1765
|
+
}): Promise<DesktopScreenshotBytesResult>;
|
|
1766
|
+
screenshot(options?: DesktopScreenshotOptions): Promise<DesktopScreenshotResult | DesktopScreenshotBytesResult>;
|
|
1767
|
+
screenshotRegion(region: DesktopScreenshotRegion, options?: DesktopScreenshotOptions & {
|
|
1768
|
+
format?: 'base64';
|
|
1769
|
+
}): Promise<DesktopScreenshotResult>;
|
|
1770
|
+
screenshotRegion(region: DesktopScreenshotRegion, options: DesktopScreenshotOptions & {
|
|
1771
|
+
format: 'bytes';
|
|
1772
|
+
}): Promise<DesktopScreenshotBytesResult>;
|
|
1773
|
+
screenshotRegion(region: DesktopScreenshotRegion, options?: DesktopScreenshotOptions): Promise<DesktopScreenshotResult | DesktopScreenshotBytesResult>;
|
|
1719
1774
|
click(x: number, y: number, options?: {
|
|
1720
1775
|
button?: DesktopMouseButton;
|
|
1721
1776
|
clickCount?: number;
|
|
@@ -1737,18 +1792,47 @@ interface SandboxDesktopAPI {
|
|
|
1737
1792
|
scroll(x: number, y: number, direction: DesktopScrollDirection, amount?: number): Promise<void>;
|
|
1738
1793
|
getCursorPosition(): Promise<DesktopCursorPosition>;
|
|
1739
1794
|
type(text: string, options?: {
|
|
1740
|
-
|
|
1795
|
+
delayMs?: number;
|
|
1741
1796
|
}): Promise<void>;
|
|
1742
1797
|
press(key: string): Promise<void>;
|
|
1743
1798
|
keyDown(key: string): Promise<void>;
|
|
1744
1799
|
keyUp(key: string): Promise<void>;
|
|
1745
1800
|
getScreenSize(): Promise<DesktopScreenSize>;
|
|
1746
|
-
getProcessStatus(name: string): Promise<
|
|
1801
|
+
getProcessStatus(name: string): Promise<DesktopProcessHealth>;
|
|
1747
1802
|
}
|
|
1748
1803
|
interface SandboxWatchAPI {
|
|
1749
1804
|
watch(request: WatchRequest): Promise<ReadableStream<Uint8Array>>;
|
|
1750
1805
|
checkChanges(request: CheckChangesRequest): Promise<CheckChangesResult>;
|
|
1751
1806
|
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Public-facing tunnel record.
|
|
1809
|
+
*
|
|
1810
|
+
* Today only quick tunnels (`*.trycloudflare.com`) are supported. Future
|
|
1811
|
+
* PRs will add named tunnels, which will carry a `name: string` field;
|
|
1812
|
+
* `TunnelInfo` will then become a discriminated union keyed on the
|
|
1813
|
+
* presence of `name`. The quick variant declares `name?: never` so the
|
|
1814
|
+
* narrowing works without a breaking change here.
|
|
1815
|
+
*/
|
|
1816
|
+
interface TunnelInfo {
|
|
1817
|
+
id: string;
|
|
1818
|
+
port: number;
|
|
1819
|
+
url: string;
|
|
1820
|
+
hostname: string;
|
|
1821
|
+
createdAt: string;
|
|
1822
|
+
/** Reserved for the named-tunnel variant in a future PR. */
|
|
1823
|
+
name?: never;
|
|
1824
|
+
}
|
|
1825
|
+
interface SandboxTunnelsAPI {
|
|
1826
|
+
/** Spawn `cloudflared tunnel --url`. No credentials required. */
|
|
1827
|
+
runQuickTunnel(id: string, port: number): Promise<TunnelInfo>;
|
|
1828
|
+
/** Stop the cloudflared process for the given tunnel id. */
|
|
1829
|
+
destroyTunnel(id: string): Promise<{
|
|
1830
|
+
success: true;
|
|
1831
|
+
id: string;
|
|
1832
|
+
}>;
|
|
1833
|
+
/** List tunnels currently running inside the container. */
|
|
1834
|
+
listTunnels(): Promise<TunnelInfo[]>;
|
|
1835
|
+
}
|
|
1752
1836
|
//#endregion
|
|
1753
1837
|
//#region src/clients/types.d.ts
|
|
1754
1838
|
/**
|
|
@@ -1955,7 +2039,7 @@ declare abstract class BaseHttpClient {
|
|
|
1955
2039
|
* The container creates/extracts squashfs archives locally.
|
|
1956
2040
|
* R2 upload/download is handled by the Sandbox DO, not by this client.
|
|
1957
2041
|
*/
|
|
1958
|
-
declare class BackupClient extends BaseHttpClient {
|
|
2042
|
+
declare class BackupClient extends BaseHttpClient implements SandboxBackupAPI {
|
|
1959
2043
|
/**
|
|
1960
2044
|
* Tell the container to create a squashfs archive from a directory.
|
|
1961
2045
|
* @param dir - Directory to back up
|
|
@@ -1990,7 +2074,7 @@ interface ExecuteResponse extends BaseApiResponse {
|
|
|
1990
2074
|
/**
|
|
1991
2075
|
* Client for command execution operations
|
|
1992
2076
|
*/
|
|
1993
|
-
declare class CommandClient extends BaseHttpClient {
|
|
2077
|
+
declare class CommandClient extends BaseHttpClient implements SandboxCommandsAPI {
|
|
1994
2078
|
/**
|
|
1995
2079
|
* Execute a command and return the complete result
|
|
1996
2080
|
* @param command - The command to execute
|
|
@@ -2118,16 +2202,12 @@ interface Desktop {
|
|
|
2118
2202
|
keyDown(key: KeyInput): Promise<void>;
|
|
2119
2203
|
keyUp(key: KeyInput): Promise<void>;
|
|
2120
2204
|
getScreenSize(): Promise<ScreenSizeResponse>;
|
|
2121
|
-
getProcessStatus(name: string): Promise<
|
|
2122
|
-
running: boolean;
|
|
2123
|
-
pid?: number;
|
|
2124
|
-
uptime?: number;
|
|
2125
|
-
}>;
|
|
2205
|
+
getProcessStatus(name: string): Promise<DesktopProcessHealth>;
|
|
2126
2206
|
}
|
|
2127
2207
|
/**
|
|
2128
2208
|
* Client for desktop environment lifecycle, input, and screen operations
|
|
2129
2209
|
*/
|
|
2130
|
-
declare class DesktopClient extends BaseHttpClient {
|
|
2210
|
+
declare class DesktopClient extends BaseHttpClient implements SandboxDesktopAPI {
|
|
2131
2211
|
/**
|
|
2132
2212
|
* Start the desktop environment with optional resolution and DPI.
|
|
2133
2213
|
*/
|
|
@@ -2231,11 +2311,7 @@ declare class DesktopClient extends BaseHttpClient {
|
|
|
2231
2311
|
/**
|
|
2232
2312
|
* Get health status for a specific desktop process.
|
|
2233
2313
|
*/
|
|
2234
|
-
getProcessStatus(name: string): Promise<
|
|
2235
|
-
running: boolean;
|
|
2236
|
-
pid?: number;
|
|
2237
|
-
uptime?: number;
|
|
2238
|
-
}>;
|
|
2314
|
+
getProcessStatus(name: string): Promise<DesktopProcessHealth>;
|
|
2239
2315
|
}
|
|
2240
2316
|
//#endregion
|
|
2241
2317
|
//#region src/clients/file-client.d.ts
|
|
@@ -2271,7 +2347,7 @@ interface FileOperationRequest extends SessionRequest {
|
|
|
2271
2347
|
/**
|
|
2272
2348
|
* Client for file system operations
|
|
2273
2349
|
*/
|
|
2274
|
-
declare class FileClient extends BaseHttpClient {
|
|
2350
|
+
declare class FileClient extends BaseHttpClient implements SandboxFilesAPI {
|
|
2275
2351
|
/**
|
|
2276
2352
|
* Create a directory
|
|
2277
2353
|
* @param path - Directory path to create
|
|
@@ -2376,7 +2452,7 @@ interface GitCheckoutRequest extends SessionRequest {
|
|
|
2376
2452
|
/**
|
|
2377
2453
|
* Client for Git repository operations
|
|
2378
2454
|
*/
|
|
2379
|
-
declare class GitClient extends BaseHttpClient {
|
|
2455
|
+
declare class GitClient extends BaseHttpClient implements SandboxGitAPI {
|
|
2380
2456
|
private static readonly REQUEST_TIMEOUT_BUFFER_MS;
|
|
2381
2457
|
constructor(options?: HttpClientOptions);
|
|
2382
2458
|
/**
|
|
@@ -2402,7 +2478,7 @@ interface ExecutionCallbacks {
|
|
|
2402
2478
|
onResult?: (result: Result) => void | Promise<void>;
|
|
2403
2479
|
onError?: (error: ExecutionError) => void | Promise<void>;
|
|
2404
2480
|
}
|
|
2405
|
-
declare class InterpreterClient extends BaseHttpClient {
|
|
2481
|
+
declare class InterpreterClient extends BaseHttpClient implements SandboxInterpreterAPI {
|
|
2406
2482
|
private readonly maxRetries;
|
|
2407
2483
|
private readonly retryDelayMs;
|
|
2408
2484
|
createCodeContext(options?: CreateContextOptions): Promise<CodeContext>;
|
|
@@ -2434,7 +2510,7 @@ interface UnexposePortRequest {
|
|
|
2434
2510
|
/**
|
|
2435
2511
|
* Client for port management and preview URL operations
|
|
2436
2512
|
*/
|
|
2437
|
-
declare class PortClient extends BaseHttpClient {
|
|
2513
|
+
declare class PortClient extends BaseHttpClient implements SandboxPortsAPI {
|
|
2438
2514
|
/**
|
|
2439
2515
|
* Expose a port and get a preview URL
|
|
2440
2516
|
* @param port - Port number to expose
|
|
@@ -2465,7 +2541,7 @@ declare class PortClient extends BaseHttpClient {
|
|
|
2465
2541
|
/**
|
|
2466
2542
|
* Client for background process management
|
|
2467
2543
|
*/
|
|
2468
|
-
declare class ProcessClient extends BaseHttpClient {
|
|
2544
|
+
declare class ProcessClient extends BaseHttpClient implements SandboxProcessesAPI {
|
|
2469
2545
|
/**
|
|
2470
2546
|
* Start a background process
|
|
2471
2547
|
* @param command - Command to execute as a background process
|
|
@@ -2562,7 +2638,7 @@ interface DeleteSessionResponse extends BaseApiResponse {
|
|
|
2562
2638
|
/**
|
|
2563
2639
|
* Client for health checks and utility operations
|
|
2564
2640
|
*/
|
|
2565
|
-
declare class UtilityClient extends BaseHttpClient {
|
|
2641
|
+
declare class UtilityClient extends BaseHttpClient implements SandboxUtilsAPI {
|
|
2566
2642
|
/**
|
|
2567
2643
|
* Ping the sandbox to check if it's responsive
|
|
2568
2644
|
*/
|
|
@@ -2586,6 +2662,9 @@ declare class UtilityClient extends BaseHttpClient {
|
|
|
2586
2662
|
* Returns the version embedded in the Docker image during build
|
|
2587
2663
|
*/
|
|
2588
2664
|
getVersion(): Promise<string>;
|
|
2665
|
+
listSessions(): Promise<{
|
|
2666
|
+
sessions: string[];
|
|
2667
|
+
}>;
|
|
2589
2668
|
}
|
|
2590
2669
|
//#endregion
|
|
2591
2670
|
//#region src/clients/watch-client.d.ts
|
|
@@ -2596,7 +2675,7 @@ declare class UtilityClient extends BaseHttpClient {
|
|
|
2596
2675
|
* @internal This client is used internally by the SDK.
|
|
2597
2676
|
* Users should use `sandbox.watch()` or `sandbox.checkChanges()` instead.
|
|
2598
2677
|
*/
|
|
2599
|
-
declare class WatchClient extends BaseHttpClient {
|
|
2678
|
+
declare class WatchClient extends BaseHttpClient implements SandboxWatchAPI {
|
|
2600
2679
|
/**
|
|
2601
2680
|
* Check whether a path changed since a previously returned version.
|
|
2602
2681
|
*/
|
|
@@ -2640,6 +2719,13 @@ declare class SandboxClient {
|
|
|
2640
2719
|
readonly utils: UtilityClient;
|
|
2641
2720
|
readonly desktop: DesktopClient;
|
|
2642
2721
|
readonly watch: WatchClient;
|
|
2722
|
+
/**
|
|
2723
|
+
* Tunnels are RPC-only — the route-based transport does not implement them.
|
|
2724
|
+
* This getter exists so the `PublicKeys<SandboxClient> satisfies
|
|
2725
|
+
* PublicKeys<SandboxAPI>` compile-time check holds. Calling any method on
|
|
2726
|
+
* the returned proxy throws a clear `RPC transport required` error.
|
|
2727
|
+
*/
|
|
2728
|
+
readonly tunnels: never;
|
|
2643
2729
|
private transport;
|
|
2644
2730
|
constructor(options: HttpClientOptions);
|
|
2645
2731
|
/**
|
|
@@ -2686,6 +2772,25 @@ interface ContainerControlConnectionOptions {
|
|
|
2686
2772
|
* `WebSocketTransport`. Set to 0 to disable retries.
|
|
2687
2773
|
*/
|
|
2688
2774
|
retryTimeoutMs?: number;
|
|
2775
|
+
/**
|
|
2776
|
+
* Optional `localMain` exposed to the container side of the capnweb
|
|
2777
|
+
* session. The container reaches it via
|
|
2778
|
+
* `session.getRemoteMain()` and uses it for control-plane callbacks
|
|
2779
|
+
* (e.g. notifying the DO when a tunnel's cloudflared process has
|
|
2780
|
+
* exited). When omitted, the container sees an empty remote main.
|
|
2781
|
+
*/
|
|
2782
|
+
localMain?: any;
|
|
2783
|
+
/**
|
|
2784
|
+
* Invoked when an active WebSocket transitions to closed/errored.
|
|
2785
|
+
* Fired at most once per successful connection from the WS event
|
|
2786
|
+
* handlers in `doConnect`. Gives owners a synchronous teardown
|
|
2787
|
+
* signal so recovery doesn't depend on a periodic poller running
|
|
2788
|
+
* inside what may be an idle isolate.
|
|
2789
|
+
*
|
|
2790
|
+
* Not fired for `doConnect` failures (the rejected `connect()`
|
|
2791
|
+
* promise is the signal in that case) nor for `disconnect()`.
|
|
2792
|
+
*/
|
|
2793
|
+
onClose?: () => void;
|
|
2689
2794
|
}
|
|
2690
2795
|
//#endregion
|
|
2691
2796
|
//#region src/container-control/client.d.ts
|
|
@@ -2742,13 +2847,6 @@ declare class ContainerControlClient {
|
|
|
2742
2847
|
private busyPollTimer;
|
|
2743
2848
|
/** Tracks whether we currently believe the session is busy. */
|
|
2744
2849
|
private busy;
|
|
2745
|
-
/**
|
|
2746
|
-
* Set the first time the poller observes `conn.isConnected() === true`,
|
|
2747
|
-
* cleared in `destroyConnection()`. Lets us distinguish "the WebSocket
|
|
2748
|
-
* upgrade is still in progress" (don't tear down) from "we were
|
|
2749
|
-
* connected and the peer went away" (do tear down).
|
|
2750
|
-
*/
|
|
2751
|
-
private wasEverConnected;
|
|
2752
2850
|
constructor(options: ContainerControlClientOptions);
|
|
2753
2851
|
/**
|
|
2754
2852
|
* Return the current connection, creating one when the client is disconnected.
|
|
@@ -2787,6 +2885,7 @@ declare class ContainerControlClient {
|
|
|
2787
2885
|
get backup(): SandboxBackupAPI;
|
|
2788
2886
|
get desktop(): SandboxDesktopAPI;
|
|
2789
2887
|
get watch(): SandboxWatchAPI;
|
|
2888
|
+
get tunnels(): SandboxTunnelsAPI;
|
|
2790
2889
|
get interpreter(): SandboxInterpreterAPI;
|
|
2791
2890
|
/**
|
|
2792
2891
|
* Update the 503 upgrade-retry budget. Applies to the current connection
|
|
@@ -2800,6 +2899,13 @@ declare class ContainerControlClient {
|
|
|
2800
2899
|
disconnect(): void;
|
|
2801
2900
|
}
|
|
2802
2901
|
//#endregion
|
|
2902
|
+
//#region src/tunnels/tunnels-handler.d.ts
|
|
2903
|
+
interface TunnelsHandler {
|
|
2904
|
+
get(port: number): Promise<TunnelInfo>;
|
|
2905
|
+
list(): Promise<TunnelInfo[]>;
|
|
2906
|
+
destroy(portOrInfo: number | TunnelInfo): Promise<void>;
|
|
2907
|
+
}
|
|
2908
|
+
//#endregion
|
|
2803
2909
|
//#region src/sandbox.d.ts
|
|
2804
2910
|
type SandboxConfiguration = {
|
|
2805
2911
|
sandboxName?: {
|
|
@@ -2818,6 +2924,9 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2818
2924
|
client: SandboxClient | ContainerControlClient;
|
|
2819
2925
|
private codeInterpreter;
|
|
2820
2926
|
private sandboxName;
|
|
2927
|
+
private tunnelsHandler;
|
|
2928
|
+
private tunnelExitHandler;
|
|
2929
|
+
private readonly controlCallback;
|
|
2821
2930
|
private normalizeId;
|
|
2822
2931
|
private defaultSession;
|
|
2823
2932
|
private containerGeneration;
|
|
@@ -2887,9 +2996,16 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2887
2996
|
* Dispatch method for desktop operations.
|
|
2888
2997
|
* Called by the client-side proxy created in getSandbox() to provide
|
|
2889
2998
|
* the `sandbox.desktop.status()` API without relying on RPC pipelining
|
|
2890
|
-
* through property getters.
|
|
2999
|
+
* through property getters which is broken when using vite-plugin.
|
|
2891
3000
|
*/
|
|
2892
3001
|
callDesktop(method: string, args: unknown[]): Promise<unknown>;
|
|
3002
|
+
/**
|
|
3003
|
+
* Dispatch method for tunnel operations.
|
|
3004
|
+
* Called by the client-side proxy created in getSandbox() to provide
|
|
3005
|
+
* the `sandbox.tunnels` API without relying on RPC pipelining
|
|
3006
|
+
* through property getters which is broken when using vite-plugin.
|
|
3007
|
+
*/
|
|
3008
|
+
callTunnels(method: string, args: unknown[]): Promise<unknown>;
|
|
2893
3009
|
/**
|
|
2894
3010
|
* Compute the transport retry budget from current container timeouts.
|
|
2895
3011
|
*
|
|
@@ -2959,6 +3075,13 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2959
3075
|
* Local dev mount: bidirectional sync via R2 binding + file/watch APIs
|
|
2960
3076
|
*/
|
|
2961
3077
|
private mountBucketLocal;
|
|
3078
|
+
private getR2EgressParams;
|
|
3079
|
+
private validateR2EgressS3fsOptions;
|
|
3080
|
+
/**
|
|
3081
|
+
* Credential-less R2 mount: egress interception routes s3fs requests to the
|
|
3082
|
+
* R2 binding. No S3 credentials are needed in the container or Worker env.
|
|
3083
|
+
*/
|
|
3084
|
+
private mountBucketR2Egress;
|
|
2962
3085
|
/**
|
|
2963
3086
|
* Production mount: S3FS-FUSE inside the container
|
|
2964
3087
|
*/
|
|
@@ -2971,7 +3094,11 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2971
3094
|
*/
|
|
2972
3095
|
unmountBucket(mountPath: string): Promise<void>;
|
|
2973
3096
|
/**
|
|
2974
|
-
*
|
|
3097
|
+
* Shared validation for mount path (absolute, not already in use).
|
|
3098
|
+
*/
|
|
3099
|
+
private validateMountPath;
|
|
3100
|
+
/**
|
|
3101
|
+
* Validate mount options for remote (FUSE) mounts
|
|
2975
3102
|
*/
|
|
2976
3103
|
private validateMountOptions;
|
|
2977
3104
|
/**
|
|
@@ -2991,6 +3118,7 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2991
3118
|
* Execute S3FS mount command
|
|
2992
3119
|
*/
|
|
2993
3120
|
private executeS3FSMount;
|
|
3121
|
+
private unmountTrackedFuseMount;
|
|
2994
3122
|
/**
|
|
2995
3123
|
* In-flight `destroy()` promise. While set, concurrent callers coalesce
|
|
2996
3124
|
* onto the same teardown instead of triggering a second one. Cleared when
|
|
@@ -3335,6 +3463,33 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3335
3463
|
port: number;
|
|
3336
3464
|
status: "active" | "inactive";
|
|
3337
3465
|
}[]>;
|
|
3466
|
+
/**
|
|
3467
|
+
* Namespaced tunnel API. Quick tunnels are zero-config preview URLs
|
|
3468
|
+
* backed by Cloudflare's trycloudflare service.
|
|
3469
|
+
*
|
|
3470
|
+
* - `tunnels.get(port)` — idempotent. Returns the cached tunnel for
|
|
3471
|
+
* `port` if one exists in DO storage, otherwise spawns a fresh
|
|
3472
|
+
* cloudflared process and persists the record.
|
|
3473
|
+
* - `tunnels.list()` — records currently known to this sandbox, from
|
|
3474
|
+
* DO storage.
|
|
3475
|
+
* - `tunnels.destroy(portOrInfo)` — tear down by port number or by
|
|
3476
|
+
* the record returned from `get()`.
|
|
3477
|
+
*
|
|
3478
|
+
* Storage is cleared on container restart (`onStart`), so URLs do
|
|
3479
|
+
* not survive a container restart — the next `get(port)` call will
|
|
3480
|
+
* spawn a fresh tunnel with a new URL.
|
|
3481
|
+
*
|
|
3482
|
+
* Requires the RPC transport. Calling this on a route-based transport
|
|
3483
|
+
* throws "RPC transport required".
|
|
3484
|
+
*/
|
|
3485
|
+
get tunnels(): TunnelsHandler;
|
|
3486
|
+
/**
|
|
3487
|
+
* Lazily construct both the public tunnels handler and its sibling
|
|
3488
|
+
* exit-handler callback. Called from the `tunnels` getter on first
|
|
3489
|
+
* access and on every access after a transport swap clears both
|
|
3490
|
+
* fields.
|
|
3491
|
+
*/
|
|
3492
|
+
private ensureTunnelsBuilt;
|
|
3338
3493
|
isPortExposed(port: number): Promise<boolean>;
|
|
3339
3494
|
validatePortToken(port: number, token: string): Promise<boolean>;
|
|
3340
3495
|
private validateCustomToken;
|
|
@@ -3527,7 +3682,8 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3527
3682
|
* unsquashfs for extraction instead of squashfuse + fuse-overlayfs.
|
|
3528
3683
|
*/
|
|
3529
3684
|
private doRestoreBackupLocal;
|
|
3685
|
+
private configureR2EgressOutbound;
|
|
3530
3686
|
}
|
|
3531
3687
|
//#endregion
|
|
3532
|
-
export {
|
|
3533
|
-
//# sourceMappingURL=sandbox-
|
|
3688
|
+
export { StartProcessRequest as $, DesktopStopResponse as A, ProcessOptions as At, ExecuteResponse as B, WaitForPortOptions as Bt, ClickOptions as C, PortListResult as Ct, DesktopStartOptions as D, ProcessKillResult as Dt, DesktopClient as E, ProcessInfoResult as Et, ScreenshotRegion as F, SandboxOptions as Ft, HttpClientOptions as G, PtyOptions as Gt, BaseApiResponse as H, isExecResult as Ht, ScreenshotResponse as I, SandboxTransport as It, SessionRequest as J, Execution as Jt, RequestConfig as K, CodeContext as Kt, ScrollDirection as L, SessionOptions as Lt, ScreenSizeResponse as M, ProcessStatus as Mt, ScreenshotBytesResponse as N, RemoteMountBucketOptions as Nt, DesktopStartResponse as O, ProcessListResult as Ot, ScreenshotOptions as P, RestoreBackupResult as Pt, ExposePortRequest as Q, TypeOptions as R, StreamOptions as Rt, WriteFileRequest as S, PortExposeResult as St, Desktop as T, ProcessCleanupResult as Tt, ContainerStub as U, isProcess as Ut, BackupClient as V, WatchOptions as Vt, ErrorResponse as W, isProcessStatus as Wt, TunnelInfo as X, RunCodeOptions as Xt, SandboxInterpreterAPI as Y, ExecutionResult as Yt, ExecuteRequest as Z, GitClient as _, ListFilesOptions as _t, CreateSessionRequest as a, CheckChangesResult as at, MkdirRequest as b, MountBucketOptions as bt, DeleteSessionResponse as c, ExecOptions as ct, ProcessClient as d, FileChunk as dt, BackupOptions as et, PortClient as f, FileMetadata as ft, GitCheckoutRequest as g, ISandbox as gt, InterpreterClient as h, GitCheckoutResult as ht, CommandsResponse as i, CheckChangesOptions as it, KeyInput as j, ProcessStartResult as jt, DesktopStatusResponse as k, ProcessLogsResult as kt, PingResponse as l, ExecResult as lt, ExecutionCallbacks as m, FileWatchSSEEvent as mt, getSandbox as n, BucketCredentials as nt, CreateSessionResponse as o, DirectoryBackup as ot, UnexposePortRequest as p, FileStreamEvent as pt, ResponseHandler as q, CreateContextOptions as qt, SandboxClient as r, BucketProvider as rt, DeleteSessionRequest as s, ExecEvent as st, Sandbox as t, BaseExecOptions as tt, UtilityClient as u, ExecutionSession as ut, FileClient as v, LocalMountBucketOptions as vt, CursorPositionResponse as w, Process as wt, ReadFileRequest as x, PortCloseResult as xt, FileOperationRequest as y, LogEvent as yt, CommandClient as z, WaitForLogResult as zt };
|
|
3689
|
+
//# sourceMappingURL=sandbox-KdzTTnWq.d.ts.map
|