sandboxedjs 0.1.81 → 0.1.85

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/agent.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Container } from './container-LwAV9JTH.cjs';
2
- import './contracts-C2_dTgk3.cjs';
1
+ import { C as Container } from './container-BGmhPbSD.cjs';
2
+ import './contracts-BkWBTH8E.cjs';
3
3
 
4
4
  /**
5
5
  * Structural copies of the LangChain Deep Agents backend contract.
package/dist/agent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Container } from './container-CUB12Moo.js';
2
- import './contracts-C2_dTgk3.js';
1
+ import { C as Container } from './container-DCwYX_Cx.js';
2
+ import './contracts-BkWBTH8E.js';
3
3
 
4
4
  /**
5
5
  * Structural copies of the LangChain Deep Agents backend contract.
@@ -1,4 +1,4 @@
1
- import { V as Vfs, C as Cred, f as RuntimePod, O as OutboundPolicy, D as DirEntry, p as Stats } from './contracts-C2_dTgk3.js';
1
+ import { V as Vfs, C as Cred, f as RuntimePod, O as OutboundPolicy, D as DirEntry, p as Stats } from './contracts-BkWBTH8E.cjs';
2
2
 
3
3
  /**
4
4
  * Byte streams for stdin/stdout/stderr, pipelines and redirections.
@@ -210,6 +210,8 @@ interface ProcessOptions {
210
210
  pgid?: number;
211
211
  sid?: number;
212
212
  stdio?: Partial<Stdio>;
213
+ /** Descriptors above 2, readable and writable from this process's side. */
214
+ fds?: Record<number, InputStream & OutputStream>;
213
215
  tty?: string | null;
214
216
  /** Marks the process as a shell builtin frame rather than a real command. */
215
217
  kind?: ProcessKind;
@@ -235,6 +237,8 @@ declare class Process {
235
237
  stdin: InputStream;
236
238
  stdout: OutputStream;
237
239
  stderr: OutputStream;
240
+ /** Descriptors above 2 the parent handed over, such as Chromium's fds 3 and 4. */
241
+ readonly fds: Map<number, InputStream & OutputStream>;
238
242
  readonly children: Set<Process>;
239
243
  private readonly aborter;
240
244
  private readonly exitWaiters;
@@ -610,6 +614,11 @@ interface RunOptions {
610
614
  tty?: string | null;
611
615
  /** Wall-clock budget; the process is sent SIGKILL when it expires. */
612
616
  timeoutMs?: number;
617
+ /**
618
+ * Descriptors above 2, keyed by number. Each is readable and writable from
619
+ * the child's side, the way an inherited socketpair end is.
620
+ */
621
+ fds?: Record<number, InputStream & OutputStream>;
613
622
  }
614
623
  interface RunResult {
615
624
  exitCode: number;
@@ -1,4 +1,4 @@
1
- import { V as Vfs, C as Cred, f as RuntimePod, O as OutboundPolicy, D as DirEntry, p as Stats } from './contracts-C2_dTgk3.cjs';
1
+ import { V as Vfs, C as Cred, f as RuntimePod, O as OutboundPolicy, D as DirEntry, p as Stats } from './contracts-BkWBTH8E.js';
2
2
 
3
3
  /**
4
4
  * Byte streams for stdin/stdout/stderr, pipelines and redirections.
@@ -210,6 +210,8 @@ interface ProcessOptions {
210
210
  pgid?: number;
211
211
  sid?: number;
212
212
  stdio?: Partial<Stdio>;
213
+ /** Descriptors above 2, readable and writable from this process's side. */
214
+ fds?: Record<number, InputStream & OutputStream>;
213
215
  tty?: string | null;
214
216
  /** Marks the process as a shell builtin frame rather than a real command. */
215
217
  kind?: ProcessKind;
@@ -235,6 +237,8 @@ declare class Process {
235
237
  stdin: InputStream;
236
238
  stdout: OutputStream;
237
239
  stderr: OutputStream;
240
+ /** Descriptors above 2 the parent handed over, such as Chromium's fds 3 and 4. */
241
+ readonly fds: Map<number, InputStream & OutputStream>;
238
242
  readonly children: Set<Process>;
239
243
  private readonly aborter;
240
244
  private readonly exitWaiters;
@@ -610,6 +614,11 @@ interface RunOptions {
610
614
  tty?: string | null;
611
615
  /** Wall-clock budget; the process is sent SIGKILL when it expires. */
612
616
  timeoutMs?: number;
617
+ /**
618
+ * Descriptors above 2, keyed by number. Each is readable and writable from
619
+ * the child's side, the way an inherited socketpair end is.
620
+ */
621
+ fds?: Record<number, InputStream & OutputStream>;
613
622
  }
614
623
  interface RunResult {
615
624
  exitCode: number;
@@ -1,9 +1,20 @@
1
+ type IpcSide = "parent" | "child";
2
+ /** One end of a channel, as a process sees it. */
3
+ interface IpcEndpoint {
4
+ send(message: unknown): void;
5
+ disconnect(): void;
6
+ }
7
+ /** How a process reaches the host's channels, wherever the process runs. */
8
+ interface IpcTransport {
9
+ attach(id: string, side: IpcSide, onMessage: (message: unknown) => void, onDisconnect: () => void): IpcEndpoint;
10
+ }
11
+
1
12
  /** The handle a pod's process manager returns. */
2
13
  interface ChildHandle {
3
14
  pid: number;
4
15
  state: "starting" | "running" | "exited";
5
16
  exitCode: number | undefined;
6
- on(event: "stdout" | "stderr" | "exit" | "rawmode", listener: (...args: any[]) => void): unknown;
17
+ on(event: "stdout" | "stderr" | "exit" | "rawmode" | "fd", listener: (...args: any[]) => void): unknown;
7
18
  exec(): void;
8
19
  sendStdin(data: string): void;
9
20
  /**
@@ -14,6 +25,17 @@ interface ChildHandle {
14
25
  * an end that never comes, and the parent waits on its exit.
15
26
  */
16
27
  endStdin?(): void;
28
+ /**
29
+ * Write to, or close, a descriptor above 2 that the parent asked for with
30
+ * `stdio[n] = "pipe"`. Output on those descriptors arrives as `fd` events
31
+ * carrying `(fd, text)`.
32
+ *
33
+ * Chromium's `--remote-debugging-pipe` is the reason: Playwright speaks the
34
+ * DevTools protocol over fds 3 and 4, and a child without them cannot be
35
+ * driven at all.
36
+ */
37
+ writeFd?(fd: number, data: string): void;
38
+ endFd?(fd: number): void;
17
39
  kill(signal?: string): void;
18
40
  }
19
41
  interface ChildSpawnConfig {
@@ -37,6 +59,8 @@ interface ChildSpawnConfig {
37
59
  * left open on a parent that will never write to it.
38
60
  */
39
61
  stdinIgnored?: boolean;
62
+ /** Descriptors above 2 the parent opened as pipes, e.g. `[3, 4]`. */
63
+ extraPipes?: number[];
40
64
  }
41
65
  type SpawnChild = (config: ChildSpawnConfig) => ChildHandle;
42
66
  /**
@@ -63,7 +87,13 @@ type SyncSpawn = (request: {
63
87
  message: string;
64
88
  };
65
89
  };
66
- declare function createChildProcessModule(spawnChild: SpawnChild, defaultCwd: () => string, syncSpawn?: SyncSpawn, defaultEnv?: () => Record<string, string>): Record<string, unknown>;
90
+ declare function createChildProcessModule(spawnChild: SpawnChild, defaultCwd: () => string, syncSpawn?: SyncSpawn, defaultEnv?: () => Record<string, string>, lifecycle?: {
91
+ referenceChanged?: (delta: number) => void;
92
+ stdout?: (text: string) => void;
93
+ stderr?: (text: string) => void;
94
+ /** Where `fork` channels live; without one a child simply has none. */
95
+ ipc?: IpcTransport;
96
+ }): Record<string, unknown>;
67
97
 
68
98
  type FileKind = "file" | "directory" | "symlink" | "chardev" | "blockdev" | "fifo" | "socket";
69
99
  /** Render as `drwxr-xr-x`, honouring setuid/setgid/sticky. */
@@ -433,8 +463,14 @@ interface RuntimeProcess {
433
463
  * reports the program turning terminal raw mode on or off, which a terminal
434
464
  * needs so that it stops echoing input the program is drawing itself.
435
465
  */
436
- on(event: "output" | "error" | "exit" | "rawmode", listener: (...args: any[]) => void): this;
437
- write(data: string): void;
466
+ /**
467
+ * `raw-output` is optional: a process that sets `rawOutput` emits stdout
468
+ * there as written, bytes included, alongside the decoded `output`.
469
+ */
470
+ on(event: "output" | "raw-output" | "error" | "exit" | "rawmode", listener: (...args: any[]) => void): this;
471
+ readonly rawOutput?: boolean;
472
+ /** Input for the program. Bytes are delivered as bytes: a pipe may carry binary framing. */
473
+ write(data: string | Uint8Array): void;
438
474
  kill(signal?: string): void;
439
475
  }
440
476
  interface RuntimeHttpResponse {
@@ -513,4 +549,4 @@ interface RuntimePod {
513
549
  teardown(): void;
514
550
  }
515
551
 
516
- export { type Cred as C, type DirEntry as D, type OutboundPolicy as O, type RuntimeVolume as R, type SpawnChild as S, Vfs as V, type WriteOptions as W, VirtualTcpNetwork as a, type RuntimeHttpResponse as b, type SyncSpawn as c, type VolumeStat as d, type VolumeStats as e, type RuntimePod as f, type RuntimePackageInstaller as g, type ChildSpawnConfig as h, type ChildHandle as i, type RuntimeProcess as j, type RuntimeSocketPeer as k, type RuntimeConnection as l, ROOT_CRED as m, type RuntimeProcessManager as n, type RuntimeProcessResult as o, Stats as p, type VirtualNode as q, type VirtualProvider as r, applyChmod as s, createChildProcessModule as t, formatMode as u, makeCred as v, octalMode as w, parseUmask as x };
552
+ export { type Cred as C, type DirEntry as D, type IpcTransport as I, type OutboundPolicy as O, type RuntimeVolume as R, type SpawnChild as S, Vfs as V, type WriteOptions as W, VirtualTcpNetwork as a, type RuntimeHttpResponse as b, type SyncSpawn as c, type VolumeStat as d, type VolumeStats as e, type RuntimePod as f, type RuntimePackageInstaller as g, type ChildSpawnConfig as h, type ChildHandle as i, type RuntimeProcess as j, type RuntimeSocketPeer as k, type RuntimeConnection as l, ROOT_CRED as m, type RuntimeProcessManager as n, type RuntimeProcessResult as o, Stats as p, type VirtualNode as q, type VirtualProvider as r, applyChmod as s, createChildProcessModule as t, formatMode as u, makeCred as v, octalMode as w, parseUmask as x };
@@ -1,9 +1,20 @@
1
+ type IpcSide = "parent" | "child";
2
+ /** One end of a channel, as a process sees it. */
3
+ interface IpcEndpoint {
4
+ send(message: unknown): void;
5
+ disconnect(): void;
6
+ }
7
+ /** How a process reaches the host's channels, wherever the process runs. */
8
+ interface IpcTransport {
9
+ attach(id: string, side: IpcSide, onMessage: (message: unknown) => void, onDisconnect: () => void): IpcEndpoint;
10
+ }
11
+
1
12
  /** The handle a pod's process manager returns. */
2
13
  interface ChildHandle {
3
14
  pid: number;
4
15
  state: "starting" | "running" | "exited";
5
16
  exitCode: number | undefined;
6
- on(event: "stdout" | "stderr" | "exit" | "rawmode", listener: (...args: any[]) => void): unknown;
17
+ on(event: "stdout" | "stderr" | "exit" | "rawmode" | "fd", listener: (...args: any[]) => void): unknown;
7
18
  exec(): void;
8
19
  sendStdin(data: string): void;
9
20
  /**
@@ -14,6 +25,17 @@ interface ChildHandle {
14
25
  * an end that never comes, and the parent waits on its exit.
15
26
  */
16
27
  endStdin?(): void;
28
+ /**
29
+ * Write to, or close, a descriptor above 2 that the parent asked for with
30
+ * `stdio[n] = "pipe"`. Output on those descriptors arrives as `fd` events
31
+ * carrying `(fd, text)`.
32
+ *
33
+ * Chromium's `--remote-debugging-pipe` is the reason: Playwright speaks the
34
+ * DevTools protocol over fds 3 and 4, and a child without them cannot be
35
+ * driven at all.
36
+ */
37
+ writeFd?(fd: number, data: string): void;
38
+ endFd?(fd: number): void;
17
39
  kill(signal?: string): void;
18
40
  }
19
41
  interface ChildSpawnConfig {
@@ -37,6 +59,8 @@ interface ChildSpawnConfig {
37
59
  * left open on a parent that will never write to it.
38
60
  */
39
61
  stdinIgnored?: boolean;
62
+ /** Descriptors above 2 the parent opened as pipes, e.g. `[3, 4]`. */
63
+ extraPipes?: number[];
40
64
  }
41
65
  type SpawnChild = (config: ChildSpawnConfig) => ChildHandle;
42
66
  /**
@@ -63,7 +87,13 @@ type SyncSpawn = (request: {
63
87
  message: string;
64
88
  };
65
89
  };
66
- declare function createChildProcessModule(spawnChild: SpawnChild, defaultCwd: () => string, syncSpawn?: SyncSpawn, defaultEnv?: () => Record<string, string>): Record<string, unknown>;
90
+ declare function createChildProcessModule(spawnChild: SpawnChild, defaultCwd: () => string, syncSpawn?: SyncSpawn, defaultEnv?: () => Record<string, string>, lifecycle?: {
91
+ referenceChanged?: (delta: number) => void;
92
+ stdout?: (text: string) => void;
93
+ stderr?: (text: string) => void;
94
+ /** Where `fork` channels live; without one a child simply has none. */
95
+ ipc?: IpcTransport;
96
+ }): Record<string, unknown>;
67
97
 
68
98
  type FileKind = "file" | "directory" | "symlink" | "chardev" | "blockdev" | "fifo" | "socket";
69
99
  /** Render as `drwxr-xr-x`, honouring setuid/setgid/sticky. */
@@ -433,8 +463,14 @@ interface RuntimeProcess {
433
463
  * reports the program turning terminal raw mode on or off, which a terminal
434
464
  * needs so that it stops echoing input the program is drawing itself.
435
465
  */
436
- on(event: "output" | "error" | "exit" | "rawmode", listener: (...args: any[]) => void): this;
437
- write(data: string): void;
466
+ /**
467
+ * `raw-output` is optional: a process that sets `rawOutput` emits stdout
468
+ * there as written, bytes included, alongside the decoded `output`.
469
+ */
470
+ on(event: "output" | "raw-output" | "error" | "exit" | "rawmode", listener: (...args: any[]) => void): this;
471
+ readonly rawOutput?: boolean;
472
+ /** Input for the program. Bytes are delivered as bytes: a pipe may carry binary framing. */
473
+ write(data: string | Uint8Array): void;
438
474
  kill(signal?: string): void;
439
475
  }
440
476
  interface RuntimeHttpResponse {
@@ -513,4 +549,4 @@ interface RuntimePod {
513
549
  teardown(): void;
514
550
  }
515
551
 
516
- export { type Cred as C, type DirEntry as D, type OutboundPolicy as O, type RuntimeVolume as R, type SpawnChild as S, Vfs as V, type WriteOptions as W, VirtualTcpNetwork as a, type RuntimeHttpResponse as b, type SyncSpawn as c, type VolumeStat as d, type VolumeStats as e, type RuntimePod as f, type RuntimePackageInstaller as g, type ChildSpawnConfig as h, type ChildHandle as i, type RuntimeProcess as j, type RuntimeSocketPeer as k, type RuntimeConnection as l, ROOT_CRED as m, type RuntimeProcessManager as n, type RuntimeProcessResult as o, Stats as p, type VirtualNode as q, type VirtualProvider as r, applyChmod as s, createChildProcessModule as t, formatMode as u, makeCred as v, octalMode as w, parseUmask as x };
552
+ export { type Cred as C, type DirEntry as D, type IpcTransport as I, type OutboundPolicy as O, type RuntimeVolume as R, type SpawnChild as S, Vfs as V, type WriteOptions as W, VirtualTcpNetwork as a, type RuntimeHttpResponse as b, type SyncSpawn as c, type VolumeStat as d, type VolumeStats as e, type RuntimePod as f, type RuntimePackageInstaller as g, type ChildSpawnConfig as h, type ChildHandle as i, type RuntimeProcess as j, type RuntimeSocketPeer as k, type RuntimeConnection as l, ROOT_CRED as m, type RuntimeProcessManager as n, type RuntimeProcessResult as o, Stats as p, type VirtualNode as q, type VirtualProvider as r, applyChmod as s, createChildProcessModule as t, formatMode as u, makeCred as v, octalMode as w, parseUmask as x };