@cloudflare/sandbox 0.7.7 → 0.7.10
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 +60 -1
- package/dist/{contexts-B0qA8qmx.d.ts → contexts-C5xSPEYL.d.ts} +32 -2
- package/dist/contexts-C5xSPEYL.d.ts.map +1 -0
- package/dist/{dist-D9B_6gn_.js → dist-CwUZf_TJ.js} +49 -2
- package/dist/dist-CwUZf_TJ.js.map +1 -0
- package/dist/{errors-CAZT-Gtg.js → errors-8W0q5Gll.js} +19 -1
- package/dist/errors-8W0q5Gll.js.map +1 -0
- package/dist/index.d.ts +21 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +788 -88
- package/dist/index.js.map +1 -1
- package/dist/openai/index.d.ts +1 -1
- package/dist/openai/index.js +1 -1
- package/dist/opencode/index.d.ts +2 -2
- package/dist/opencode/index.js +2 -2
- package/dist/{sandbox-DGAjk7r3.d.ts → sandbox-BYNjxjyr.d.ts} +367 -2
- package/dist/sandbox-BYNjxjyr.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/contexts-B0qA8qmx.d.ts.map +0 -1
- package/dist/dist-D9B_6gn_.js.map +0 -1
- package/dist/errors-CAZT-Gtg.js.map +0 -1
- package/dist/sandbox-DGAjk7r3.d.ts.map +0 -1
package/dist/openai/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Sandbox } from "../sandbox-
|
|
1
|
+
import { t as Sandbox } from "../sandbox-BYNjxjyr.js";
|
|
2
2
|
import { ApplyPatchOperation, ApplyPatchResult, Editor as Editor$1, Shell as Shell$1, ShellAction, ShellResult } from "@openai/agents";
|
|
3
3
|
|
|
4
4
|
//#region src/openai/index.d.ts
|
package/dist/openai/index.js
CHANGED
package/dist/opencode/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Sandbox } from "../sandbox-
|
|
2
|
-
import {
|
|
1
|
+
import { t as Sandbox } from "../sandbox-BYNjxjyr.js";
|
|
2
|
+
import { c as OpencodeStartupContext } from "../contexts-C5xSPEYL.js";
|
|
3
3
|
import { OpencodeClient } from "@opencode-ai/sdk/v2/client";
|
|
4
4
|
import { Config } from "@opencode-ai/sdk/v2";
|
|
5
5
|
|
package/dist/opencode/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ErrorCode } from "../errors-
|
|
1
|
+
import { u as createLogger } from "../dist-CwUZf_TJ.js";
|
|
2
|
+
import { t as ErrorCode } from "../errors-8W0q5Gll.js";
|
|
3
3
|
|
|
4
4
|
//#region src/opencode/types.ts
|
|
5
5
|
/**
|
|
@@ -941,6 +941,71 @@ interface FileMetadata {
|
|
|
941
941
|
* File stream chunk - either string (text) or Uint8Array (binary, auto-decoded)
|
|
942
942
|
*/
|
|
943
943
|
type FileChunk = string | Uint8Array;
|
|
944
|
+
/**
|
|
945
|
+
* Options for watching a directory.
|
|
946
|
+
*
|
|
947
|
+
* `watch()` resolves only after the watcher is established on the filesystem.
|
|
948
|
+
* The returned SSE stream can be consumed with `parseSSEStream()`.
|
|
949
|
+
*/
|
|
950
|
+
interface WatchOptions {
|
|
951
|
+
/**
|
|
952
|
+
* Watch subdirectories recursively
|
|
953
|
+
* @default true
|
|
954
|
+
*/
|
|
955
|
+
recursive?: boolean;
|
|
956
|
+
/**
|
|
957
|
+
* Glob patterns to include (e.g., '*.ts', '*.js').
|
|
958
|
+
* If not specified, all files are included.
|
|
959
|
+
* Cannot be used together with `exclude`.
|
|
960
|
+
*/
|
|
961
|
+
include?: string[];
|
|
962
|
+
/**
|
|
963
|
+
* Glob patterns to exclude (e.g., 'node_modules', '.git').
|
|
964
|
+
* Cannot be used together with `include`.
|
|
965
|
+
* @default ['.git', 'node_modules', '.DS_Store']
|
|
966
|
+
*/
|
|
967
|
+
exclude?: string[];
|
|
968
|
+
/**
|
|
969
|
+
* Session to run the watch in.
|
|
970
|
+
* If omitted, the default session is used.
|
|
971
|
+
*/
|
|
972
|
+
sessionId?: string;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* @internal SSE event types for container communication
|
|
976
|
+
*/
|
|
977
|
+
type FileWatchEventType = 'create' | 'modify' | 'delete' | 'move_from' | 'move_to' | 'attrib';
|
|
978
|
+
/**
|
|
979
|
+
* @internal Request body for starting a file watch
|
|
980
|
+
*/
|
|
981
|
+
interface WatchRequest {
|
|
982
|
+
path: string;
|
|
983
|
+
recursive?: boolean;
|
|
984
|
+
events?: FileWatchEventType[];
|
|
985
|
+
include?: string[];
|
|
986
|
+
exclude?: string[];
|
|
987
|
+
sessionId?: string;
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* SSE events emitted by `sandbox.watch()`.
|
|
991
|
+
*/
|
|
992
|
+
type FileWatchSSEEvent = {
|
|
993
|
+
type: 'watching';
|
|
994
|
+
path: string;
|
|
995
|
+
watchId: string;
|
|
996
|
+
} | {
|
|
997
|
+
type: 'event';
|
|
998
|
+
eventType: FileWatchEventType;
|
|
999
|
+
path: string;
|
|
1000
|
+
isDirectory: boolean;
|
|
1001
|
+
timestamp: string;
|
|
1002
|
+
} | {
|
|
1003
|
+
type: 'error';
|
|
1004
|
+
error: string;
|
|
1005
|
+
} | {
|
|
1006
|
+
type: 'stopped';
|
|
1007
|
+
reason: string;
|
|
1008
|
+
};
|
|
944
1009
|
interface ProcessStartResult {
|
|
945
1010
|
success: boolean;
|
|
946
1011
|
processId: string;
|
|
@@ -1043,6 +1108,7 @@ interface ExecutionSession {
|
|
|
1043
1108
|
encoding?: string;
|
|
1044
1109
|
}): Promise<ReadFileResult>;
|
|
1045
1110
|
readFileStream(path: string): Promise<ReadableStream<Uint8Array>>;
|
|
1111
|
+
watch(path: string, options?: Omit<WatchOptions, 'sessionId'>): Promise<ReadableStream<Uint8Array>>;
|
|
1046
1112
|
mkdir(path: string, options?: {
|
|
1047
1113
|
recursive?: boolean;
|
|
1048
1114
|
}): Promise<MkdirResult>;
|
|
@@ -1193,6 +1259,7 @@ interface ISandbox {
|
|
|
1193
1259
|
encoding?: string;
|
|
1194
1260
|
}): Promise<ReadFileResult>;
|
|
1195
1261
|
readFileStream(path: string): Promise<ReadableStream<Uint8Array>>;
|
|
1262
|
+
watch(path: string, options?: WatchOptions): Promise<ReadableStream<Uint8Array>>;
|
|
1196
1263
|
mkdir(path: string, options?: {
|
|
1197
1264
|
recursive?: boolean;
|
|
1198
1265
|
}): Promise<MkdirResult>;
|
|
@@ -1476,6 +1543,225 @@ declare class CommandClient extends BaseHttpClient {
|
|
|
1476
1543
|
}): Promise<ReadableStream<Uint8Array>>;
|
|
1477
1544
|
}
|
|
1478
1545
|
//#endregion
|
|
1546
|
+
//#region src/clients/desktop-client.d.ts
|
|
1547
|
+
interface DesktopStartOptions {
|
|
1548
|
+
resolution?: [number, number];
|
|
1549
|
+
dpi?: number;
|
|
1550
|
+
}
|
|
1551
|
+
interface ScreenshotOptions {
|
|
1552
|
+
format?: 'base64' | 'bytes';
|
|
1553
|
+
imageFormat?: 'png' | 'jpeg' | 'webp';
|
|
1554
|
+
quality?: number;
|
|
1555
|
+
showCursor?: boolean;
|
|
1556
|
+
}
|
|
1557
|
+
interface ScreenshotRegion {
|
|
1558
|
+
x: number;
|
|
1559
|
+
y: number;
|
|
1560
|
+
width: number;
|
|
1561
|
+
height: number;
|
|
1562
|
+
}
|
|
1563
|
+
interface ClickOptions {
|
|
1564
|
+
button?: 'left' | 'right' | 'middle';
|
|
1565
|
+
}
|
|
1566
|
+
type ScrollDirection = 'up' | 'down' | 'left' | 'right';
|
|
1567
|
+
type KeyInput = string;
|
|
1568
|
+
interface TypeOptions {
|
|
1569
|
+
delayMs?: number;
|
|
1570
|
+
}
|
|
1571
|
+
interface DesktopStartResponse extends BaseApiResponse {
|
|
1572
|
+
resolution: [number, number];
|
|
1573
|
+
dpi: number;
|
|
1574
|
+
}
|
|
1575
|
+
interface DesktopStopResponse extends BaseApiResponse {}
|
|
1576
|
+
interface DesktopStatusResponse extends BaseApiResponse {
|
|
1577
|
+
status: 'active' | 'partial' | 'inactive';
|
|
1578
|
+
processes: Record<string, {
|
|
1579
|
+
running: boolean;
|
|
1580
|
+
pid?: number;
|
|
1581
|
+
uptime?: number;
|
|
1582
|
+
}>;
|
|
1583
|
+
resolution: [number, number] | null;
|
|
1584
|
+
dpi: number | null;
|
|
1585
|
+
}
|
|
1586
|
+
interface ScreenshotResponse extends BaseApiResponse {
|
|
1587
|
+
data: string;
|
|
1588
|
+
imageFormat: 'png' | 'jpeg' | 'webp';
|
|
1589
|
+
width: number;
|
|
1590
|
+
height: number;
|
|
1591
|
+
}
|
|
1592
|
+
interface ScreenshotBytesResponse extends BaseApiResponse {
|
|
1593
|
+
data: Uint8Array;
|
|
1594
|
+
imageFormat: 'png' | 'jpeg' | 'webp';
|
|
1595
|
+
width: number;
|
|
1596
|
+
height: number;
|
|
1597
|
+
}
|
|
1598
|
+
interface CursorPositionResponse extends BaseApiResponse {
|
|
1599
|
+
x: number;
|
|
1600
|
+
y: number;
|
|
1601
|
+
}
|
|
1602
|
+
interface ScreenSizeResponse extends BaseApiResponse {
|
|
1603
|
+
width: number;
|
|
1604
|
+
height: number;
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Public interface for desktop operations.
|
|
1608
|
+
* Returned by `sandbox.desktop` via an RpcTarget wrapper so that pipelined
|
|
1609
|
+
* method calls work across the Durable Object RPC boundary.
|
|
1610
|
+
*/
|
|
1611
|
+
interface Desktop {
|
|
1612
|
+
start(options?: DesktopStartOptions): Promise<DesktopStartResponse>;
|
|
1613
|
+
stop(): Promise<DesktopStopResponse>;
|
|
1614
|
+
status(): Promise<DesktopStatusResponse>;
|
|
1615
|
+
screenshot(options?: ScreenshotOptions & {
|
|
1616
|
+
format?: 'base64';
|
|
1617
|
+
}): Promise<ScreenshotResponse>;
|
|
1618
|
+
screenshot(options: ScreenshotOptions & {
|
|
1619
|
+
format: 'bytes';
|
|
1620
|
+
}): Promise<ScreenshotBytesResponse>;
|
|
1621
|
+
screenshot(options?: ScreenshotOptions): Promise<ScreenshotResponse | ScreenshotBytesResponse>;
|
|
1622
|
+
screenshotRegion(region: ScreenshotRegion, options?: ScreenshotOptions & {
|
|
1623
|
+
format?: 'base64';
|
|
1624
|
+
}): Promise<ScreenshotResponse>;
|
|
1625
|
+
screenshotRegion(region: ScreenshotRegion, options: ScreenshotOptions & {
|
|
1626
|
+
format: 'bytes';
|
|
1627
|
+
}): Promise<ScreenshotBytesResponse>;
|
|
1628
|
+
screenshotRegion(region: ScreenshotRegion, options?: ScreenshotOptions): Promise<ScreenshotResponse | ScreenshotBytesResponse>;
|
|
1629
|
+
click(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
1630
|
+
doubleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
1631
|
+
tripleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
1632
|
+
rightClick(x: number, y: number): Promise<void>;
|
|
1633
|
+
middleClick(x: number, y: number): Promise<void>;
|
|
1634
|
+
mouseDown(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
1635
|
+
mouseUp(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
1636
|
+
moveMouse(x: number, y: number): Promise<void>;
|
|
1637
|
+
drag(startX: number, startY: number, endX: number, endY: number, options?: ClickOptions): Promise<void>;
|
|
1638
|
+
scroll(x: number, y: number, direction: ScrollDirection, amount?: number): Promise<void>;
|
|
1639
|
+
getCursorPosition(): Promise<CursorPositionResponse>;
|
|
1640
|
+
type(text: string, options?: TypeOptions): Promise<void>;
|
|
1641
|
+
press(key: KeyInput): Promise<void>;
|
|
1642
|
+
keyDown(key: KeyInput): Promise<void>;
|
|
1643
|
+
keyUp(key: KeyInput): Promise<void>;
|
|
1644
|
+
getScreenSize(): Promise<ScreenSizeResponse>;
|
|
1645
|
+
getProcessStatus(name: string): Promise<BaseApiResponse & {
|
|
1646
|
+
running: boolean;
|
|
1647
|
+
pid?: number;
|
|
1648
|
+
uptime?: number;
|
|
1649
|
+
}>;
|
|
1650
|
+
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Client for desktop environment lifecycle, input, and screen operations
|
|
1653
|
+
*/
|
|
1654
|
+
declare class DesktopClient extends BaseHttpClient {
|
|
1655
|
+
/**
|
|
1656
|
+
* Start the desktop environment with optional resolution and DPI.
|
|
1657
|
+
*/
|
|
1658
|
+
start(options?: DesktopStartOptions): Promise<DesktopStartResponse>;
|
|
1659
|
+
/**
|
|
1660
|
+
* Stop the desktop environment and all related processes.
|
|
1661
|
+
*/
|
|
1662
|
+
stop(): Promise<DesktopStopResponse>;
|
|
1663
|
+
/**
|
|
1664
|
+
* Get desktop lifecycle and process health status.
|
|
1665
|
+
*/
|
|
1666
|
+
status(): Promise<DesktopStatusResponse>;
|
|
1667
|
+
/**
|
|
1668
|
+
* Capture a full-screen screenshot as base64 (default).
|
|
1669
|
+
*/
|
|
1670
|
+
screenshot(options?: ScreenshotOptions & {
|
|
1671
|
+
format?: 'base64';
|
|
1672
|
+
}): Promise<ScreenshotResponse>;
|
|
1673
|
+
/**
|
|
1674
|
+
* Capture a full-screen screenshot as bytes.
|
|
1675
|
+
*/
|
|
1676
|
+
screenshot(options: ScreenshotOptions & {
|
|
1677
|
+
format: 'bytes';
|
|
1678
|
+
}): Promise<ScreenshotBytesResponse>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Capture a region screenshot as base64 (default).
|
|
1681
|
+
*/
|
|
1682
|
+
screenshotRegion(region: ScreenshotRegion, options?: ScreenshotOptions & {
|
|
1683
|
+
format?: 'base64';
|
|
1684
|
+
}): Promise<ScreenshotResponse>;
|
|
1685
|
+
/**
|
|
1686
|
+
* Capture a region screenshot as bytes.
|
|
1687
|
+
*/
|
|
1688
|
+
screenshotRegion(region: ScreenshotRegion, options: ScreenshotOptions & {
|
|
1689
|
+
format: 'bytes';
|
|
1690
|
+
}): Promise<ScreenshotBytesResponse>;
|
|
1691
|
+
/**
|
|
1692
|
+
* Single-click at the given coordinates.
|
|
1693
|
+
*/
|
|
1694
|
+
click(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
1695
|
+
/**
|
|
1696
|
+
* Double-click at the given coordinates.
|
|
1697
|
+
*/
|
|
1698
|
+
doubleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
1699
|
+
/**
|
|
1700
|
+
* Triple-click at the given coordinates.
|
|
1701
|
+
*/
|
|
1702
|
+
tripleClick(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
1703
|
+
/**
|
|
1704
|
+
* Right-click at the given coordinates.
|
|
1705
|
+
*/
|
|
1706
|
+
rightClick(x: number, y: number): Promise<void>;
|
|
1707
|
+
/**
|
|
1708
|
+
* Middle-click at the given coordinates.
|
|
1709
|
+
*/
|
|
1710
|
+
middleClick(x: number, y: number): Promise<void>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Press and hold a mouse button.
|
|
1713
|
+
*/
|
|
1714
|
+
mouseDown(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
1715
|
+
/**
|
|
1716
|
+
* Release a held mouse button.
|
|
1717
|
+
*/
|
|
1718
|
+
mouseUp(x?: number, y?: number, options?: ClickOptions): Promise<void>;
|
|
1719
|
+
/**
|
|
1720
|
+
* Move the mouse cursor to coordinates.
|
|
1721
|
+
*/
|
|
1722
|
+
moveMouse(x: number, y: number): Promise<void>;
|
|
1723
|
+
/**
|
|
1724
|
+
* Drag from start coordinates to end coordinates.
|
|
1725
|
+
*/
|
|
1726
|
+
drag(startX: number, startY: number, endX: number, endY: number, options?: ClickOptions): Promise<void>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Scroll at coordinates in the specified direction.
|
|
1729
|
+
*/
|
|
1730
|
+
scroll(x: number, y: number, direction: ScrollDirection, amount?: number): Promise<void>;
|
|
1731
|
+
/**
|
|
1732
|
+
* Get the current cursor coordinates.
|
|
1733
|
+
*/
|
|
1734
|
+
getCursorPosition(): Promise<CursorPositionResponse>;
|
|
1735
|
+
/**
|
|
1736
|
+
* Type text into the focused element.
|
|
1737
|
+
*/
|
|
1738
|
+
type(text: string, options?: TypeOptions): Promise<void>;
|
|
1739
|
+
/**
|
|
1740
|
+
* Press and release a key or key combination.
|
|
1741
|
+
*/
|
|
1742
|
+
press(key: KeyInput): Promise<void>;
|
|
1743
|
+
/**
|
|
1744
|
+
* Press and hold a key.
|
|
1745
|
+
*/
|
|
1746
|
+
keyDown(key: KeyInput): Promise<void>;
|
|
1747
|
+
/**
|
|
1748
|
+
* Release a held key.
|
|
1749
|
+
*/
|
|
1750
|
+
keyUp(key: KeyInput): Promise<void>;
|
|
1751
|
+
/**
|
|
1752
|
+
* Get the active desktop screen size.
|
|
1753
|
+
*/
|
|
1754
|
+
getScreenSize(): Promise<ScreenSizeResponse>;
|
|
1755
|
+
/**
|
|
1756
|
+
* Get health status for a specific desktop process.
|
|
1757
|
+
*/
|
|
1758
|
+
getProcessStatus(name: string): Promise<BaseApiResponse & {
|
|
1759
|
+
running: boolean;
|
|
1760
|
+
pid?: number;
|
|
1761
|
+
uptime?: number;
|
|
1762
|
+
}>;
|
|
1763
|
+
}
|
|
1764
|
+
//#endregion
|
|
1479
1765
|
//#region src/clients/file-client.d.ts
|
|
1480
1766
|
/**
|
|
1481
1767
|
* Request interface for creating directories
|
|
@@ -1796,6 +2082,33 @@ declare class UtilityClient extends BaseHttpClient {
|
|
|
1796
2082
|
getVersion(): Promise<string>;
|
|
1797
2083
|
}
|
|
1798
2084
|
//#endregion
|
|
2085
|
+
//#region src/clients/watch-client.d.ts
|
|
2086
|
+
/**
|
|
2087
|
+
* Client for file watch operations
|
|
2088
|
+
* Uses inotify under the hood for native filesystem event notifications
|
|
2089
|
+
*
|
|
2090
|
+
* @internal This client is used internally by the SDK.
|
|
2091
|
+
* Users should use `sandbox.watch()` instead.
|
|
2092
|
+
*/
|
|
2093
|
+
declare class WatchClient extends BaseHttpClient {
|
|
2094
|
+
/**
|
|
2095
|
+
* Start watching a directory for changes.
|
|
2096
|
+
* The returned promise resolves only after the watcher is established
|
|
2097
|
+
* on the filesystem (i.e. the `watching` SSE event has been received).
|
|
2098
|
+
* The returned stream still contains the `watching` event so consumers
|
|
2099
|
+
* using `parseSSEStream` will see the full event sequence.
|
|
2100
|
+
*
|
|
2101
|
+
* @param request - Watch request with path and options
|
|
2102
|
+
*/
|
|
2103
|
+
watch(request: WatchRequest): Promise<ReadableStream<Uint8Array>>;
|
|
2104
|
+
/**
|
|
2105
|
+
* Read SSE chunks until the `watching` event appears, then return a
|
|
2106
|
+
* wrapper stream that replays the buffered chunks followed by the
|
|
2107
|
+
* remaining original stream data.
|
|
2108
|
+
*/
|
|
2109
|
+
private waitForReadiness;
|
|
2110
|
+
}
|
|
2111
|
+
//#endregion
|
|
1799
2112
|
//#region src/clients/sandbox-client.d.ts
|
|
1800
2113
|
/**
|
|
1801
2114
|
* Main sandbox client that composes all domain-specific clients
|
|
@@ -1816,6 +2129,8 @@ declare class SandboxClient {
|
|
|
1816
2129
|
readonly git: GitClient;
|
|
1817
2130
|
readonly interpreter: InterpreterClient;
|
|
1818
2131
|
readonly utils: UtilityClient;
|
|
2132
|
+
readonly desktop: DesktopClient;
|
|
2133
|
+
readonly watch: WatchClient;
|
|
1819
2134
|
private transport;
|
|
1820
2135
|
constructor(options: HttpClientOptions);
|
|
1821
2136
|
/**
|
|
@@ -1883,6 +2198,25 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
1883
2198
|
* Can be set via options, env vars, or defaults
|
|
1884
2199
|
*/
|
|
1885
2200
|
private containerTimeouts;
|
|
2201
|
+
/**
|
|
2202
|
+
* Desktop environment operations.
|
|
2203
|
+
* Within the DO, this getter provides direct access to DesktopClient.
|
|
2204
|
+
* Over RPC, the getSandbox() proxy intercepts this property and routes
|
|
2205
|
+
* calls through callDesktop() instead.
|
|
2206
|
+
*/
|
|
2207
|
+
get desktop(): Desktop;
|
|
2208
|
+
/**
|
|
2209
|
+
* Allowed desktop methods — derived from the Desktop interface.
|
|
2210
|
+
* Restricts callDesktop() to a known set of operations.
|
|
2211
|
+
*/
|
|
2212
|
+
private static readonly DESKTOP_METHODS;
|
|
2213
|
+
/**
|
|
2214
|
+
* Dispatch method for desktop operations.
|
|
2215
|
+
* Called by the client-side proxy created in getSandbox() to provide
|
|
2216
|
+
* the `sandbox.desktop.status()` API without relying on RPC pipelining
|
|
2217
|
+
* through property getters.
|
|
2218
|
+
*/
|
|
2219
|
+
callDesktop(method: string, args: unknown[]): Promise<unknown>;
|
|
1886
2220
|
/**
|
|
1887
2221
|
* Create a SandboxClient with current transport settings
|
|
1888
2222
|
*/
|
|
@@ -2100,6 +2434,37 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2100
2434
|
includeHidden?: boolean;
|
|
2101
2435
|
}): Promise<ListFilesResult>;
|
|
2102
2436
|
exists(path: string, sessionId?: string): Promise<FileExistsResult>;
|
|
2437
|
+
/**
|
|
2438
|
+
* Get the noVNC preview URL for browser-based desktop viewing.
|
|
2439
|
+
* Confirms desktop is active, then uses exposePort() to generate
|
|
2440
|
+
* a token-authenticated preview URL for the noVNC port (6080).
|
|
2441
|
+
*
|
|
2442
|
+
* @param hostname - The custom domain hostname for preview URLs
|
|
2443
|
+
* (e.g., 'preview.example.com'). Required because preview URLs
|
|
2444
|
+
* use subdomain patterns that .workers.dev doesn't support.
|
|
2445
|
+
* @param options - Optional settings
|
|
2446
|
+
* @param options.token - Reuse an existing token instead of generating a new one
|
|
2447
|
+
* @returns The authenticated noVNC preview URL
|
|
2448
|
+
*/
|
|
2449
|
+
getDesktopStreamUrl(hostname: string, options?: {
|
|
2450
|
+
token?: string;
|
|
2451
|
+
}): Promise<{
|
|
2452
|
+
url: string;
|
|
2453
|
+
}>;
|
|
2454
|
+
/**
|
|
2455
|
+
* Watch a directory for file system changes using native inotify.
|
|
2456
|
+
*
|
|
2457
|
+
* The returned promise resolves only after the watcher is established on the
|
|
2458
|
+
* filesystem, so callers can immediately perform actions that depend on the
|
|
2459
|
+
* watch being active. The returned stream contains the full event sequence
|
|
2460
|
+
* starting with the `watching` event.
|
|
2461
|
+
*
|
|
2462
|
+
* Consume the stream with `parseSSEStream<FileWatchSSEEvent>(stream)`.
|
|
2463
|
+
*
|
|
2464
|
+
* @param path - Path to watch (absolute or relative to /workspace)
|
|
2465
|
+
* @param options - Watch options
|
|
2466
|
+
*/
|
|
2467
|
+
watch(path: string, options?: WatchOptions): Promise<ReadableStream<Uint8Array>>;
|
|
2103
2468
|
/**
|
|
2104
2469
|
* Expose a port and get a preview URL for accessing services running in the sandbox
|
|
2105
2470
|
*
|
|
@@ -2283,5 +2648,5 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
2283
2648
|
private doRestoreBackup;
|
|
2284
2649
|
}
|
|
2285
2650
|
//#endregion
|
|
2286
|
-
export {
|
|
2287
|
-
//# sourceMappingURL=sandbox-
|
|
2651
|
+
export { DirectoryBackup as $, DesktopStopResponse as A, WaitForPortOptions as At, ExecuteResponse as B, CreateContextOptions as Bt, ClickOptions as C, ProcessStartResult as Ct, DesktopStartOptions as D, SessionOptions as Dt, DesktopClient as E, SandboxOptions as Et, ScreenshotRegion as F, ExecuteRequest as Ft, HttpClientOptions as G, BaseApiResponse as H, ExecutionResult as Ht, ScreenshotResponse as I, ExposePortRequest as It, SessionRequest as J, RequestConfig as K, ScrollDirection as L, StartProcessRequest as Lt, ScreenSizeResponse as M, isExecResult as Mt, ScreenshotBytesResponse as N, isProcess as Nt, DesktopStartResponse as O, StreamOptions as Ot, ScreenshotOptions as P, isProcessStatus as Pt, BucketProvider as Q, TypeOptions as R, PtyOptions as Rt, WriteFileRequest as S, ProcessOptions as St, Desktop as T, RestoreBackupResult as Tt, ContainerStub as U, RunCodeOptions as Ut, BackupClient as V, Execution as Vt, ErrorResponse as W, BaseExecOptions as X, BackupOptions as Y, BucketCredentials as Z, GitClient as _, ProcessCleanupResult as _t, CreateSessionRequest as a, FileMetadata as at, MkdirRequest as b, ProcessListResult as bt, DeleteSessionResponse as c, GitCheckoutResult as ct, ProcessClient as d, LogEvent as dt, ExecEvent as et, PortClient as f, MountBucketOptions as ft, GitCheckoutRequest as g, Process as gt, InterpreterClient as h, PortListResult as ht, CommandsResponse as i, FileChunk as it, KeyInput as j, WatchOptions as jt, DesktopStatusResponse as k, WaitForLogResult as kt, PingResponse as l, ISandbox as lt, ExecutionCallbacks as m, PortExposeResult as mt, getSandbox as n, ExecResult as nt, CreateSessionResponse as o, FileStreamEvent as ot, UnexposePortRequest as p, PortCloseResult as pt, ResponseHandler as q, SandboxClient as r, ExecutionSession as rt, DeleteSessionRequest as s, FileWatchSSEEvent as st, Sandbox as t, ExecOptions as tt, UtilityClient as u, ListFilesOptions as ut, FileClient as v, ProcessInfoResult as vt, CursorPositionResponse as w, ProcessStatus as wt, ReadFileRequest as x, ProcessLogsResult as xt, FileOperationRequest as y, ProcessKillResult as yt, CommandClient as z, CodeContext as zt };
|
|
2652
|
+
//# sourceMappingURL=sandbox-BYNjxjyr.d.ts.map
|