@cloudflare/sandbox 0.11.0 → 0.12.1
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 +0 -55
- package/README.md +1 -0
- package/dist/bridge/index.js +9 -2
- package/dist/bridge/index.js.map +1 -1
- package/dist/{contexts-XHAo64dB.d.ts → contexts-B0_bcx9f.d.ts} +2 -29
- package/dist/contexts-B0_bcx9f.d.ts.map +1 -0
- package/dist/{errors-COsTRno_.js → errors-aRUdk9K8.js} +1 -19
- package/dist/errors-aRUdk9K8.js.map +1 -0
- package/dist/index.d.ts +3 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/openai/index.d.ts +1 -1
- package/dist/opencode/index.d.ts +2 -2
- package/dist/opencode/index.d.ts.map +1 -1
- package/dist/opencode/index.js +1 -1
- package/dist/{sandbox-B9LOT0cg.d.ts → sandbox-C8l-pMlL.d.ts} +51 -384
- package/dist/sandbox-C8l-pMlL.d.ts.map +1 -0
- package/dist/{sandbox-DQxTkLyY.js → sandbox-DKG3H156.js} +801 -517
- package/dist/sandbox-DKG3H156.js.map +1 -0
- package/package.json +1 -1
- package/dist/contexts-XHAo64dB.d.ts.map +0 -1
- package/dist/errors-COsTRno_.js.map +0 -1
- package/dist/sandbox-B9LOT0cg.d.ts.map +0 -1
- package/dist/sandbox-DQxTkLyY.js.map +0 -1
|
@@ -1,81 +1,8 @@
|
|
|
1
|
-
import { Container } from "@cloudflare/containers";
|
|
1
|
+
import { Container, ContainerProxy } from "@cloudflare/containers";
|
|
2
2
|
import "capnweb";
|
|
3
3
|
|
|
4
|
-
//#region ../shared/dist/desktop-types.d.ts
|
|
5
|
-
|
|
6
|
-
interface DesktopStartResult {
|
|
7
|
-
success: boolean;
|
|
8
|
-
resolution: [number, number];
|
|
9
|
-
dpi: number;
|
|
10
|
-
}
|
|
11
|
-
interface DesktopStopResult {
|
|
12
|
-
success: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface DesktopStatusResult {
|
|
15
|
-
success: boolean;
|
|
16
|
-
status: 'active' | 'partial' | 'inactive';
|
|
17
|
-
processes: Record<string, DesktopProcessHealth>;
|
|
18
|
-
resolution: [number, number] | null;
|
|
19
|
-
dpi: number | null;
|
|
20
|
-
}
|
|
21
|
-
interface DesktopProcessHealth {
|
|
22
|
-
running: boolean;
|
|
23
|
-
pid?: number;
|
|
24
|
-
uptime?: number;
|
|
25
|
-
}
|
|
26
|
-
type DesktopImageFormat = 'png' | 'jpeg' | 'webp';
|
|
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';
|
|
36
|
-
imageFormat?: DesktopImageFormat;
|
|
37
|
-
quality?: number;
|
|
38
|
-
showCursor?: boolean;
|
|
39
|
-
}
|
|
40
|
-
interface DesktopScreenshotRegion {
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
width: number;
|
|
44
|
-
height: number;
|
|
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
|
-
*/
|
|
50
|
-
interface DesktopScreenshotResult {
|
|
51
|
-
success: boolean;
|
|
52
|
-
data: string;
|
|
53
|
-
imageFormat: DesktopImageFormat;
|
|
54
|
-
width: number;
|
|
55
|
-
height: number;
|
|
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
|
-
}
|
|
65
|
-
type DesktopMouseButton = 'left' | 'right' | 'middle';
|
|
66
|
-
type DesktopScrollDirection = 'up' | 'down' | 'left' | 'right';
|
|
67
|
-
interface DesktopCursorPosition {
|
|
68
|
-
success: boolean;
|
|
69
|
-
x: number;
|
|
70
|
-
y: number;
|
|
71
|
-
}
|
|
72
|
-
interface DesktopScreenSize {
|
|
73
|
-
success: boolean;
|
|
74
|
-
width: number;
|
|
75
|
-
height: number;
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
4
|
//#region ../shared/dist/logger/types.d.ts
|
|
5
|
+
|
|
79
6
|
type LogComponent = 'container' | 'sandbox-do' | 'executor';
|
|
80
7
|
/**
|
|
81
8
|
* Context metadata included in every log entry
|
|
@@ -1391,6 +1318,15 @@ interface RemoteMountBucketOptions {
|
|
|
1391
1318
|
* Must start with '/' (e.g., '/workspaces/project123' or '/data/uploads/')
|
|
1392
1319
|
*/
|
|
1393
1320
|
prefix?: string;
|
|
1321
|
+
/**
|
|
1322
|
+
* Keep real credentials in the Durable Object; write dummy credentials into
|
|
1323
|
+
* the container-side s3fs password file. Outbound s3fs requests are
|
|
1324
|
+
* intercepted by the DO, signed with real credentials, and forwarded to the
|
|
1325
|
+
* configured endpoint.
|
|
1326
|
+
*
|
|
1327
|
+
* Default: false (real credentials are written into the container)
|
|
1328
|
+
*/
|
|
1329
|
+
credentialProxy?: boolean;
|
|
1394
1330
|
}
|
|
1395
1331
|
/**
|
|
1396
1332
|
* Options for mounting a local R2 binding via bidirectional sync (local dev)
|
|
@@ -1752,56 +1688,6 @@ interface SandboxBackupAPI {
|
|
|
1752
1688
|
sessionId?: string;
|
|
1753
1689
|
}): Promise<UploadPartsResponse>;
|
|
1754
1690
|
}
|
|
1755
|
-
interface SandboxDesktopAPI {
|
|
1756
|
-
start(options?: {
|
|
1757
|
-
resolution?: [number, number];
|
|
1758
|
-
dpi?: number;
|
|
1759
|
-
}): Promise<DesktopStartResult>;
|
|
1760
|
-
stop(): Promise<DesktopStopResult>;
|
|
1761
|
-
status(): Promise<DesktopStatusResult>;
|
|
1762
|
-
screenshot(options?: DesktopScreenshotOptions & {
|
|
1763
|
-
format?: 'base64';
|
|
1764
|
-
}): Promise<DesktopScreenshotResult>;
|
|
1765
|
-
screenshot(options: DesktopScreenshotOptions & {
|
|
1766
|
-
format: 'bytes';
|
|
1767
|
-
}): Promise<DesktopScreenshotBytesResult>;
|
|
1768
|
-
screenshot(options?: DesktopScreenshotOptions): Promise<DesktopScreenshotResult | DesktopScreenshotBytesResult>;
|
|
1769
|
-
screenshotRegion(region: DesktopScreenshotRegion, options?: DesktopScreenshotOptions & {
|
|
1770
|
-
format?: 'base64';
|
|
1771
|
-
}): Promise<DesktopScreenshotResult>;
|
|
1772
|
-
screenshotRegion(region: DesktopScreenshotRegion, options: DesktopScreenshotOptions & {
|
|
1773
|
-
format: 'bytes';
|
|
1774
|
-
}): Promise<DesktopScreenshotBytesResult>;
|
|
1775
|
-
screenshotRegion(region: DesktopScreenshotRegion, options?: DesktopScreenshotOptions): Promise<DesktopScreenshotResult | DesktopScreenshotBytesResult>;
|
|
1776
|
-
click(x: number, y: number, options?: {
|
|
1777
|
-
button?: DesktopMouseButton;
|
|
1778
|
-
clickCount?: number;
|
|
1779
|
-
}): Promise<void>;
|
|
1780
|
-
doubleClick(x: number, y: number): Promise<void>;
|
|
1781
|
-
tripleClick(x: number, y: number): Promise<void>;
|
|
1782
|
-
rightClick(x: number, y: number): Promise<void>;
|
|
1783
|
-
middleClick(x: number, y: number): Promise<void>;
|
|
1784
|
-
mouseDown(x?: number, y?: number, options?: {
|
|
1785
|
-
button?: DesktopMouseButton;
|
|
1786
|
-
}): Promise<void>;
|
|
1787
|
-
mouseUp(x?: number, y?: number, options?: {
|
|
1788
|
-
button?: DesktopMouseButton;
|
|
1789
|
-
}): Promise<void>;
|
|
1790
|
-
moveMouse(x: number, y: number): Promise<void>;
|
|
1791
|
-
drag(startX: number, startY: number, endX: number, endY: number, options?: {
|
|
1792
|
-
button?: DesktopMouseButton;
|
|
1793
|
-
}): Promise<void>;
|
|
1794
|
-
scroll(x: number, y: number, direction: DesktopScrollDirection, amount?: number): Promise<void>;
|
|
1795
|
-
getCursorPosition(): Promise<DesktopCursorPosition>;
|
|
1796
|
-
type(text: string, options?: {
|
|
1797
|
-
delayMs?: number;
|
|
1798
|
-
}): Promise<void>;
|
|
1799
|
-
press(key: string): Promise<void>;
|
|
1800
|
-
keyDown(key: string): Promise<void>;
|
|
1801
|
-
keyUp(key: string): Promise<void>;
|
|
1802
|
-
getScreenSize(): Promise<DesktopScreenSize>;
|
|
1803
|
-
getProcessStatus(name: string): Promise<DesktopProcessHealth>;
|
|
1804
|
-
}
|
|
1805
1691
|
interface SandboxWatchAPI {
|
|
1806
1692
|
watch(request: WatchRequest): Promise<ReadableStream<Uint8Array>>;
|
|
1807
1693
|
checkChanges(request: CheckChangesRequest): Promise<CheckChangesResult>;
|
|
@@ -1909,7 +1795,8 @@ interface HttpClientOptions {
|
|
|
1909
1795
|
*/
|
|
1910
1796
|
transport?: ITransport;
|
|
1911
1797
|
/**
|
|
1912
|
-
* Total retry budget in milliseconds for
|
|
1798
|
+
* Total retry budget in milliseconds for retryable transport responses.
|
|
1799
|
+
* Used for WebSocket upgrade retries and HTTP 503 startup retries.
|
|
1913
1800
|
* Passed through to the transport layer. Defaults to 120_000 (2 minutes).
|
|
1914
1801
|
*/
|
|
1915
1802
|
retryTimeoutMs?: number;
|
|
@@ -1997,7 +1884,7 @@ interface ITransport {
|
|
|
1997
1884
|
*/
|
|
1998
1885
|
isConnected(): boolean;
|
|
1999
1886
|
/**
|
|
2000
|
-
* Update the
|
|
1887
|
+
* Update the upgrade retry budget without recreating the transport
|
|
2001
1888
|
*/
|
|
2002
1889
|
setRetryTimeoutMs(ms: number): void;
|
|
2003
1890
|
}
|
|
@@ -2140,217 +2027,6 @@ declare class CommandClient extends BaseHttpClient implements SandboxCommandsAPI
|
|
|
2140
2027
|
}): Promise<ReadableStream<Uint8Array>>;
|
|
2141
2028
|
}
|
|
2142
2029
|
//#endregion
|
|
2143
|
-
//#region src/clients/desktop-client.d.ts
|
|
2144
|
-
interface DesktopStartOptions {
|
|
2145
|
-
resolution?: [number, number];
|
|
2146
|
-
dpi?: number;
|
|
2147
|
-
}
|
|
2148
|
-
interface ScreenshotOptions {
|
|
2149
|
-
format?: 'base64' | 'bytes';
|
|
2150
|
-
imageFormat?: 'png' | 'jpeg' | 'webp';
|
|
2151
|
-
quality?: number;
|
|
2152
|
-
showCursor?: boolean;
|
|
2153
|
-
}
|
|
2154
|
-
interface ScreenshotRegion {
|
|
2155
|
-
x: number;
|
|
2156
|
-
y: number;
|
|
2157
|
-
width: number;
|
|
2158
|
-
height: number;
|
|
2159
|
-
}
|
|
2160
|
-
interface ClickOptions {
|
|
2161
|
-
button?: 'left' | 'right' | 'middle';
|
|
2162
|
-
}
|
|
2163
|
-
type ScrollDirection = 'up' | 'down' | 'left' | 'right';
|
|
2164
|
-
type KeyInput = string;
|
|
2165
|
-
interface TypeOptions {
|
|
2166
|
-
delayMs?: number;
|
|
2167
|
-
}
|
|
2168
|
-
interface DesktopStartResponse extends BaseApiResponse {
|
|
2169
|
-
resolution: [number, number];
|
|
2170
|
-
dpi: number;
|
|
2171
|
-
}
|
|
2172
|
-
interface DesktopStopResponse extends BaseApiResponse {}
|
|
2173
|
-
interface DesktopStatusResponse extends BaseApiResponse {
|
|
2174
|
-
status: 'active' | 'partial' | 'inactive';
|
|
2175
|
-
processes: Record<string, {
|
|
2176
|
-
running: boolean;
|
|
2177
|
-
pid?: number;
|
|
2178
|
-
uptime?: number;
|
|
2179
|
-
}>;
|
|
2180
|
-
resolution: [number, number] | null;
|
|
2181
|
-
dpi: number | null;
|
|
2182
|
-
}
|
|
2183
|
-
interface ScreenshotResponse extends BaseApiResponse {
|
|
2184
|
-
data: string;
|
|
2185
|
-
imageFormat: 'png' | 'jpeg' | 'webp';
|
|
2186
|
-
width: number;
|
|
2187
|
-
height: number;
|
|
2188
|
-
}
|
|
2189
|
-
interface ScreenshotBytesResponse extends BaseApiResponse {
|
|
2190
|
-
data: Uint8Array;
|
|
2191
|
-
imageFormat: 'png' | 'jpeg' | 'webp';
|
|
2192
|
-
width: number;
|
|
2193
|
-
height: number;
|
|
2194
|
-
}
|
|
2195
|
-
interface CursorPositionResponse extends BaseApiResponse {
|
|
2196
|
-
x: number;
|
|
2197
|
-
y: number;
|
|
2198
|
-
}
|
|
2199
|
-
interface ScreenSizeResponse extends BaseApiResponse {
|
|
2200
|
-
width: number;
|
|
2201
|
-
height: number;
|
|
2202
|
-
}
|
|
2203
|
-
/**
|
|
2204
|
-
* Public interface for desktop operations.
|
|
2205
|
-
* Returned by `sandbox.desktop` via an RpcTarget wrapper so that pipelined
|
|
2206
|
-
* method calls work across the Durable Object RPC boundary.
|
|
2207
|
-
*/
|
|
2208
|
-
interface Desktop {
|
|
2209
|
-
start(options?: DesktopStartOptions): Promise<DesktopStartResponse>;
|
|
2210
|
-
stop(): Promise<DesktopStopResponse>;
|
|
2211
|
-
status(): Promise<DesktopStatusResponse>;
|
|
2212
|
-
screenshot(options?: ScreenshotOptions & {
|
|
2213
|
-
format?: 'base64';
|
|
2214
|
-
}): Promise<ScreenshotResponse>;
|
|
2215
|
-
screenshot(options: ScreenshotOptions & {
|
|
2216
|
-
format: 'bytes';
|
|
2217
|
-
}): Promise<ScreenshotBytesResponse>;
|
|
2218
|
-
screenshot(options?: ScreenshotOptions): Promise<ScreenshotResponse | ScreenshotBytesResponse>;
|
|
2219
|
-
screenshotRegion(region: ScreenshotRegion, options?: ScreenshotOptions & {
|
|
2220
|
-
format?: 'base64';
|
|
2221
|
-
}): Promise<ScreenshotResponse>;
|
|
2222
|
-
screenshotRegion(region: ScreenshotRegion, options: ScreenshotOptions & {
|
|
2223
|
-
format: 'bytes';
|
|
2224
|
-
}): Promise<ScreenshotBytesResponse>;
|
|
2225
|
-
screenshotRegion(region: ScreenshotRegion, options?: ScreenshotOptions): Promise<ScreenshotResponse | ScreenshotBytesResponse>;
|
|
2226
|
-
click(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
2227
|
-
doubleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
2228
|
-
tripleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
2229
|
-
rightClick(x: number, y: number): Promise<void>;
|
|
2230
|
-
middleClick(x: number, y: number): Promise<void>;
|
|
2231
|
-
mouseDown(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
2232
|
-
mouseUp(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
2233
|
-
moveMouse(x: number, y: number): Promise<void>;
|
|
2234
|
-
drag(startX: number, startY: number, endX: number, endY: number, options?: ClickOptions): Promise<void>;
|
|
2235
|
-
scroll(x: number, y: number, direction: ScrollDirection, amount?: number): Promise<void>;
|
|
2236
|
-
getCursorPosition(): Promise<CursorPositionResponse>;
|
|
2237
|
-
type(text: string, options?: TypeOptions): Promise<void>;
|
|
2238
|
-
press(key: KeyInput): Promise<void>;
|
|
2239
|
-
keyDown(key: KeyInput): Promise<void>;
|
|
2240
|
-
keyUp(key: KeyInput): Promise<void>;
|
|
2241
|
-
getScreenSize(): Promise<ScreenSizeResponse>;
|
|
2242
|
-
getProcessStatus(name: string): Promise<DesktopProcessHealth>;
|
|
2243
|
-
}
|
|
2244
|
-
/**
|
|
2245
|
-
* Client for desktop environment lifecycle, input, and screen operations
|
|
2246
|
-
*/
|
|
2247
|
-
declare class DesktopClient extends BaseHttpClient implements SandboxDesktopAPI {
|
|
2248
|
-
/**
|
|
2249
|
-
* Start the desktop environment with optional resolution and DPI.
|
|
2250
|
-
*/
|
|
2251
|
-
start(options?: DesktopStartOptions): Promise<DesktopStartResponse>;
|
|
2252
|
-
/**
|
|
2253
|
-
* Stop the desktop environment and all related processes.
|
|
2254
|
-
*/
|
|
2255
|
-
stop(): Promise<DesktopStopResponse>;
|
|
2256
|
-
/**
|
|
2257
|
-
* Get desktop lifecycle and process health status.
|
|
2258
|
-
*/
|
|
2259
|
-
status(): Promise<DesktopStatusResponse>;
|
|
2260
|
-
/**
|
|
2261
|
-
* Capture a full-screen screenshot as base64 (default).
|
|
2262
|
-
*/
|
|
2263
|
-
screenshot(options?: ScreenshotOptions & {
|
|
2264
|
-
format?: 'base64';
|
|
2265
|
-
}): Promise<ScreenshotResponse>;
|
|
2266
|
-
/**
|
|
2267
|
-
* Capture a full-screen screenshot as bytes.
|
|
2268
|
-
*/
|
|
2269
|
-
screenshot(options: ScreenshotOptions & {
|
|
2270
|
-
format: 'bytes';
|
|
2271
|
-
}): Promise<ScreenshotBytesResponse>;
|
|
2272
|
-
/**
|
|
2273
|
-
* Capture a region screenshot as base64 (default).
|
|
2274
|
-
*/
|
|
2275
|
-
screenshotRegion(region: ScreenshotRegion, options?: ScreenshotOptions & {
|
|
2276
|
-
format?: 'base64';
|
|
2277
|
-
}): Promise<ScreenshotResponse>;
|
|
2278
|
-
/**
|
|
2279
|
-
* Capture a region screenshot as bytes.
|
|
2280
|
-
*/
|
|
2281
|
-
screenshotRegion(region: ScreenshotRegion, options: ScreenshotOptions & {
|
|
2282
|
-
format: 'bytes';
|
|
2283
|
-
}): Promise<ScreenshotBytesResponse>;
|
|
2284
|
-
/**
|
|
2285
|
-
* Single-click at the given coordinates.
|
|
2286
|
-
*/
|
|
2287
|
-
click(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
2288
|
-
/**
|
|
2289
|
-
* Double-click at the given coordinates.
|
|
2290
|
-
*/
|
|
2291
|
-
doubleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
2292
|
-
/**
|
|
2293
|
-
* Triple-click at the given coordinates.
|
|
2294
|
-
*/
|
|
2295
|
-
tripleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
2296
|
-
/**
|
|
2297
|
-
* Right-click at the given coordinates.
|
|
2298
|
-
*/
|
|
2299
|
-
rightClick(x: number, y: number): Promise<void>;
|
|
2300
|
-
/**
|
|
2301
|
-
* Middle-click at the given coordinates.
|
|
2302
|
-
*/
|
|
2303
|
-
middleClick(x: number, y: number): Promise<void>;
|
|
2304
|
-
/**
|
|
2305
|
-
* Press and hold a mouse button.
|
|
2306
|
-
*/
|
|
2307
|
-
mouseDown(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
2308
|
-
/**
|
|
2309
|
-
* Release a held mouse button.
|
|
2310
|
-
*/
|
|
2311
|
-
mouseUp(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
2312
|
-
/**
|
|
2313
|
-
* Move the mouse cursor to coordinates.
|
|
2314
|
-
*/
|
|
2315
|
-
moveMouse(x: number, y: number): Promise<void>;
|
|
2316
|
-
/**
|
|
2317
|
-
* Drag from start coordinates to end coordinates.
|
|
2318
|
-
*/
|
|
2319
|
-
drag(startX: number, startY: number, endX: number, endY: number, options?: ClickOptions): Promise<void>;
|
|
2320
|
-
/**
|
|
2321
|
-
* Scroll at coordinates in the specified direction.
|
|
2322
|
-
*/
|
|
2323
|
-
scroll(x: number, y: number, direction: ScrollDirection, amount?: number): Promise<void>;
|
|
2324
|
-
/**
|
|
2325
|
-
* Get the current cursor coordinates.
|
|
2326
|
-
*/
|
|
2327
|
-
getCursorPosition(): Promise<CursorPositionResponse>;
|
|
2328
|
-
/**
|
|
2329
|
-
* Type text into the focused element.
|
|
2330
|
-
*/
|
|
2331
|
-
type(text: string, options?: TypeOptions): Promise<void>;
|
|
2332
|
-
/**
|
|
2333
|
-
* Press and release a key or key combination.
|
|
2334
|
-
*/
|
|
2335
|
-
press(key: KeyInput): Promise<void>;
|
|
2336
|
-
/**
|
|
2337
|
-
* Press and hold a key.
|
|
2338
|
-
*/
|
|
2339
|
-
keyDown(key: KeyInput): Promise<void>;
|
|
2340
|
-
/**
|
|
2341
|
-
* Release a held key.
|
|
2342
|
-
*/
|
|
2343
|
-
keyUp(key: KeyInput): Promise<void>;
|
|
2344
|
-
/**
|
|
2345
|
-
* Get the active desktop screen size.
|
|
2346
|
-
*/
|
|
2347
|
-
getScreenSize(): Promise<ScreenSizeResponse>;
|
|
2348
|
-
/**
|
|
2349
|
-
* Get health status for a specific desktop process.
|
|
2350
|
-
*/
|
|
2351
|
-
getProcessStatus(name: string): Promise<DesktopProcessHealth>;
|
|
2352
|
-
}
|
|
2353
|
-
//#endregion
|
|
2354
2030
|
//#region src/clients/file-client.d.ts
|
|
2355
2031
|
/**
|
|
2356
2032
|
* Request interface for creating directories
|
|
@@ -2730,7 +2406,6 @@ declare class SandboxClient {
|
|
|
2730
2406
|
readonly git: GitClient;
|
|
2731
2407
|
readonly interpreter: InterpreterClient;
|
|
2732
2408
|
readonly utils: UtilityClient;
|
|
2733
|
-
readonly desktop: DesktopClient;
|
|
2734
2409
|
readonly watch: WatchClient;
|
|
2735
2410
|
/**
|
|
2736
2411
|
* Tunnels are RPC-only — the route-based transport does not implement them.
|
|
@@ -2742,7 +2417,7 @@ declare class SandboxClient {
|
|
|
2742
2417
|
private transport;
|
|
2743
2418
|
constructor(options: HttpClientOptions);
|
|
2744
2419
|
/**
|
|
2745
|
-
* Update the
|
|
2420
|
+
* Update the transport retry budget without recreating the client.
|
|
2746
2421
|
*
|
|
2747
2422
|
* In WebSocket mode a single shared transport is used, so one update covers
|
|
2748
2423
|
* every sub-client. In HTTP mode each sub-client owns its own transport, so
|
|
@@ -2780,9 +2455,9 @@ interface ContainerControlConnectionOptions {
|
|
|
2780
2455
|
port?: number;
|
|
2781
2456
|
logger?: Logger;
|
|
2782
2457
|
/**
|
|
2783
|
-
* Total retry budget (ms) for
|
|
2784
|
-
* is
|
|
2785
|
-
* `WebSocketTransport`. Set to 0 to disable retries.
|
|
2458
|
+
* Total retry budget (ms) for retryable upgrade responses while the
|
|
2459
|
+
* container is unavailable. Defaults to 120 000 (2 minutes), matching the
|
|
2460
|
+
* route-based `WebSocketTransport`. Set to 0 to disable retries.
|
|
2786
2461
|
*/
|
|
2787
2462
|
retryTimeoutMs?: number;
|
|
2788
2463
|
/**
|
|
@@ -2896,12 +2571,11 @@ declare class ContainerControlClient {
|
|
|
2896
2571
|
get git(): SandboxGitAPI;
|
|
2897
2572
|
get utils(): SandboxUtilsAPI;
|
|
2898
2573
|
get backup(): SandboxBackupAPI;
|
|
2899
|
-
get desktop(): SandboxDesktopAPI;
|
|
2900
2574
|
get watch(): SandboxWatchAPI;
|
|
2901
2575
|
get tunnels(): SandboxTunnelsAPI;
|
|
2902
2576
|
get interpreter(): SandboxInterpreterAPI;
|
|
2903
2577
|
/**
|
|
2904
|
-
* Update the
|
|
2578
|
+
* Update the upgrade retry budget. Applies to the current connection
|
|
2905
2579
|
* (if any) and is remembered for any future connections created after the
|
|
2906
2580
|
* client is torn down and reconnected.
|
|
2907
2581
|
*/
|
|
@@ -2930,6 +2604,18 @@ type SandboxConfiguration = {
|
|
|
2930
2604
|
containerTimeouts?: NonNullable<SandboxOptions['containerTimeouts']>;
|
|
2931
2605
|
transport?: SandboxTransport;
|
|
2932
2606
|
};
|
|
2607
|
+
/**
|
|
2608
|
+
* SDK-level ContainerProxy that directly dispatches SDK-internal mount hosts
|
|
2609
|
+
* (r2.internal, s3-credential-proxy.internal) without relying on
|
|
2610
|
+
* outboundHandlersRegistry lookups, which are NOT shared between the Durable
|
|
2611
|
+
* Object's execution context and the ContainerProxy WorkerEntrypoint context.
|
|
2612
|
+
*
|
|
2613
|
+
* Users must export this class from their Worker entrypoint so the Sandbox DO
|
|
2614
|
+
* can create outbound-interception fetchers that reference it.
|
|
2615
|
+
*/
|
|
2616
|
+
declare class ContainerProxy$1 extends ContainerProxy {
|
|
2617
|
+
fetch(request: Request): Promise<Response>;
|
|
2618
|
+
}
|
|
2933
2619
|
declare function getSandbox<T extends Sandbox<any>>(ns: DurableObjectNamespace<T>, id: string, options?: SandboxOptions): T;
|
|
2934
2620
|
declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
|
|
2935
2621
|
defaultPort: number;
|
|
@@ -2949,6 +2635,7 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2949
2635
|
private logger;
|
|
2950
2636
|
private keepAliveEnabled;
|
|
2951
2637
|
private activeMounts;
|
|
2638
|
+
private mountOperationQueue;
|
|
2952
2639
|
private currentRuntime;
|
|
2953
2640
|
private transport;
|
|
2954
2641
|
/**
|
|
@@ -3010,25 +2697,6 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3010
2697
|
* env/SDK defaults".
|
|
3011
2698
|
*/
|
|
3012
2699
|
private hasStoredContainerTimeouts;
|
|
3013
|
-
/**
|
|
3014
|
-
* Desktop environment operations.
|
|
3015
|
-
* Within the DO, this getter provides direct access to DesktopClient.
|
|
3016
|
-
* Over RPC, the getSandbox() proxy intercepts this property and routes
|
|
3017
|
-
* calls through callDesktop() instead.
|
|
3018
|
-
*/
|
|
3019
|
-
get desktop(): Desktop;
|
|
3020
|
-
/**
|
|
3021
|
-
* Allowed desktop methods — derived from the Desktop interface.
|
|
3022
|
-
* Restricts callDesktop() to a known set of operations.
|
|
3023
|
-
*/
|
|
3024
|
-
private static readonly DESKTOP_METHODS;
|
|
3025
|
-
/**
|
|
3026
|
-
* Dispatch method for desktop operations.
|
|
3027
|
-
* Called by the client-side proxy created in getSandbox() to provide
|
|
3028
|
-
* the `sandbox.desktop.status()` API without relying on RPC pipelining
|
|
3029
|
-
* through property getters which is broken when using vite-plugin.
|
|
3030
|
-
*/
|
|
3031
|
-
callDesktop(method: string, args: unknown[]): Promise<unknown>;
|
|
3032
2700
|
/**
|
|
3033
2701
|
* Dispatch method for tunnel operations.
|
|
3034
2702
|
* Called by the client-side proxy created in getSandbox() to provide
|
|
@@ -3081,12 +2749,16 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3081
2749
|
* @throws InvalidMountConfigError if bucket name, mount path, or endpoint is invalid
|
|
3082
2750
|
*/
|
|
3083
2751
|
mountBucket(bucket: string, mountPath: string, options: MountBucketOptions): Promise<void>;
|
|
2752
|
+
private runMountOperation;
|
|
2753
|
+
private mountBucketUnlocked;
|
|
3084
2754
|
/**
|
|
3085
2755
|
* Local dev mount: bidirectional sync via R2 binding + file/watch APIs
|
|
3086
2756
|
*/
|
|
3087
2757
|
private mountBucketLocal;
|
|
3088
2758
|
private getR2EgressParams;
|
|
3089
|
-
private
|
|
2759
|
+
private validateProtectedS3fsOptions;
|
|
2760
|
+
private getS3CredentialProxyParams;
|
|
2761
|
+
private resolveCredentialProxyAuthStrategy;
|
|
3090
2762
|
/**
|
|
3091
2763
|
* Credential-less R2 mount: egress interception routes s3fs requests to the
|
|
3092
2764
|
* R2 binding. No S3 credentials are needed in the container or Worker env.
|
|
@@ -3103,6 +2775,7 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3103
2775
|
* @throws InvalidMountConfigError if mount path doesn't exist or isn't mounted
|
|
3104
2776
|
*/
|
|
3105
2777
|
unmountBucket(mountPath: string): Promise<void>;
|
|
2778
|
+
private unmountBucketUnlocked;
|
|
3106
2779
|
/**
|
|
3107
2780
|
* Shared validation for mount path (absolute, not already in use).
|
|
3108
2781
|
*/
|
|
@@ -3115,6 +2788,15 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3115
2788
|
* Generate unique password file path for s3fs credentials
|
|
3116
2789
|
*/
|
|
3117
2790
|
private generatePasswordFilePath;
|
|
2791
|
+
/**
|
|
2792
|
+
* Generate unique ahbe_conf file path for s3fs additional header config
|
|
2793
|
+
*/
|
|
2794
|
+
private generateS3FSAdditionalHeaderFilePath;
|
|
2795
|
+
/**
|
|
2796
|
+
* Create s3fs ahbe_conf file that suppresses the Expect: 100-continue header.
|
|
2797
|
+
* Restricted to 0600 so s3fs will accept it (same requirement as passwd files).
|
|
2798
|
+
*/
|
|
2799
|
+
private createDisableExpectHeaderFile;
|
|
3118
2800
|
/**
|
|
3119
2801
|
* Create password file with s3fs credentials
|
|
3120
2802
|
* Format: bucket:accessKeyId:secretAccessKey
|
|
@@ -3124,6 +2806,7 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3124
2806
|
* Delete password file
|
|
3125
2807
|
*/
|
|
3126
2808
|
private deletePasswordFile;
|
|
2809
|
+
private deleteAdditionalHeaderFile;
|
|
3127
2810
|
/**
|
|
3128
2811
|
* Execute S3FS mount command
|
|
3129
2812
|
*/
|
|
@@ -3402,23 +3085,6 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3402
3085
|
}): Promise<ReadableStream<Uint8Array>>;
|
|
3403
3086
|
listFiles(path: string, options?: ListFilesOptions): Promise<ListFilesResult>;
|
|
3404
3087
|
exists(path: string, sessionId?: string): Promise<FileExistsResult>;
|
|
3405
|
-
/**
|
|
3406
|
-
* Get the noVNC preview URL for browser-based desktop viewing.
|
|
3407
|
-
* Confirms desktop is active, then uses exposePort() to generate
|
|
3408
|
-
* a token-authenticated preview URL for the noVNC port (6080).
|
|
3409
|
-
*
|
|
3410
|
-
* @param hostname - The custom domain hostname for preview URLs
|
|
3411
|
-
* (e.g., 'preview.example.com'). Required because preview URLs
|
|
3412
|
-
* use subdomain patterns that .workers.dev doesn't support.
|
|
3413
|
-
* @param options - Optional settings
|
|
3414
|
-
* @param options.token - Reuse an existing token instead of generating a new one
|
|
3415
|
-
* @returns The authenticated noVNC preview URL
|
|
3416
|
-
*/
|
|
3417
|
-
getDesktopStreamUrl(hostname: string, options?: {
|
|
3418
|
-
token?: string;
|
|
3419
|
-
}): Promise<{
|
|
3420
|
-
url: string;
|
|
3421
|
-
}>;
|
|
3422
3088
|
/**
|
|
3423
3089
|
* Watch a directory for file system changes using native inotify.
|
|
3424
3090
|
*
|
|
@@ -3758,7 +3424,8 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
3758
3424
|
*/
|
|
3759
3425
|
private doRestoreBackupLocal;
|
|
3760
3426
|
private configureR2EgressOutbound;
|
|
3427
|
+
private configureS3CredentialProxyOutbound;
|
|
3761
3428
|
}
|
|
3762
3429
|
//#endregion
|
|
3763
|
-
export {
|
|
3764
|
-
//# sourceMappingURL=sandbox-
|
|
3430
|
+
export { FileStreamEvent as $, RequestConfig as A, CreateContextOptions as At, BackupOptions as B, CommandClient as C, WaitForPortOptions as Ct, ContainerStub as D, isProcessStatus as Dt, BaseApiResponse as E, isProcess as Et, SandboxInterpreterAPI as F, CheckChangesResult as G, BucketCredentials as H, TunnelInfo as I, ExecOptions as J, DirectoryBackup as K, TunnelOptions as L, SessionRequest as M, ExecutionResult as Mt, NamedTunnelInfo as N, RunCodeOptions as Nt, ErrorResponse as O, PtyOptions as Ot, QuickTunnelInfo as P, FileMetadata as Q, ExecuteRequest as R, WriteFileRequest as S, WaitForLogResult as St, BackupClient as T, isExecResult as Tt, BucketProvider as U, BaseExecOptions as V, CheckChangesOptions as W, ExecutionSession as X, ExecResult as Y, FileChunk as Z, GitClient as _, RestoreBackupResult as _t, CommandsResponse as a, LogEvent as at, MkdirRequest as b, SessionOptions as bt, DeleteSessionRequest as c, ProcessCleanupResult as ct, UtilityClient as d, ProcessListResult as dt, FileWatchSSEEvent as et, ProcessClient as f, ProcessLogsResult as ft, GitCheckoutRequest as g, RemoteMountBucketOptions as gt, InterpreterClient as h, ProcessStatus as ht, SandboxClient as i, LocalMountBucketOptions as it, ResponseHandler as j, Execution as jt, HttpClientOptions as k, CodeContext as kt, DeleteSessionResponse as l, ProcessInfoResult as lt, ExecutionCallbacks as m, ProcessStartResult as mt, Sandbox as n, ISandbox as nt, CreateSessionRequest as o, MountBucketOptions as ot, PortClient as p, ProcessOptions as pt, ExecEvent as q, getSandbox as r, ListFilesOptions as rt, CreateSessionResponse as s, Process as st, ContainerProxy$1 as t, GitCheckoutResult as tt, PingResponse as u, ProcessKillResult as ut, FileClient as v, SandboxOptions as vt, ExecuteResponse as w, WatchOptions as wt, ReadFileRequest as x, StreamOptions as xt, FileOperationRequest as y, SandboxTransport as yt, StartProcessRequest as z };
|
|
3431
|
+
//# sourceMappingURL=sandbox-C8l-pMlL.d.ts.map
|