@deepagents/context 7.5.2 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +12 -10
  2. package/dist/index.js +1409 -1807
  3. package/dist/index.js.map +4 -4
  4. package/dist/lib/agent.d.ts +21 -21
  5. package/dist/lib/agent.d.ts.map +1 -1
  6. package/dist/lib/fragments/plan-shared.d.ts.map +1 -1
  7. package/dist/lib/sandbox/apple-container-sandbox.d.ts +2 -2
  8. package/dist/lib/sandbox/apple-container-sandbox.d.ts.map +1 -1
  9. package/dist/lib/sandbox/bash-tool.d.ts +2 -4
  10. package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
  11. package/dist/lib/sandbox/container-engine.d.ts +53 -27
  12. package/dist/lib/sandbox/container-engine.d.ts.map +1 -1
  13. package/dist/lib/sandbox/container-sandbox.d.ts +6 -3
  14. package/dist/lib/sandbox/container-sandbox.d.ts.map +1 -1
  15. package/dist/lib/sandbox/container-session.d.ts +19 -0
  16. package/dist/lib/sandbox/container-session.d.ts.map +1 -0
  17. package/dist/lib/sandbox/daytona-sandbox.d.ts +39 -48
  18. package/dist/lib/sandbox/daytona-sandbox.d.ts.map +1 -1
  19. package/dist/lib/sandbox/docker-sandbox.d.ts +31 -131
  20. package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
  21. package/dist/lib/sandbox/index.d.ts +0 -1
  22. package/dist/lib/sandbox/index.d.ts.map +1 -1
  23. package/dist/lib/sandbox/microsandbox-sandbox.d.ts +6 -13
  24. package/dist/lib/sandbox/microsandbox-sandbox.d.ts.map +1 -1
  25. package/dist/lib/sandbox/read-file-tool/index.d.ts +2 -2
  26. package/dist/lib/sandbox/read-file-tool/index.d.ts.map +1 -1
  27. package/dist/lib/sandbox/read-file-tool/text.d.ts.map +1 -1
  28. package/dist/lib/sandbox/session.d.ts +40 -0
  29. package/dist/lib/sandbox/session.d.ts.map +1 -0
  30. package/dist/lib/sandbox/strace/file-changes.d.ts +20 -14
  31. package/dist/lib/sandbox/strace/file-changes.d.ts.map +1 -1
  32. package/dist/lib/sandbox/strace/index.d.ts +1 -1
  33. package/dist/lib/sandbox/strace/index.d.ts.map +1 -1
  34. package/dist/lib/sandbox/strace/index.js +7 -6
  35. package/dist/lib/sandbox/strace/index.js.map +2 -2
  36. package/dist/lib/sandbox/types.d.ts +38 -78
  37. package/dist/lib/sandbox/types.d.ts.map +1 -1
  38. package/dist/lib/sandbox/virtual-sandbox.d.ts +3 -3
  39. package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -1
  40. package/dist/lib/telemetry/console-telemetry.d.ts +7 -1
  41. package/dist/lib/telemetry/console-telemetry.d.ts.map +1 -1
  42. package/dist/lib/telemetry/file/file-telemetry.d.ts +6 -0
  43. package/dist/lib/telemetry/file/file-telemetry.d.ts.map +1 -1
  44. package/dist/lib/telemetry/file/index.js +18 -12
  45. package/dist/lib/telemetry/file/index.js.map +2 -2
  46. package/dist/lib/telemetry/index.js +10 -6
  47. package/dist/lib/telemetry/index.js.map +2 -2
  48. package/dist/lib/telemetry/safe-serialize.d.ts +1 -1
  49. package/dist/lib/telemetry/safe-serialize.d.ts.map +1 -1
  50. package/dist/lib/tracing/batch-processor.d.ts +7 -1
  51. package/dist/lib/tracing/batch-processor.d.ts.map +1 -1
  52. package/dist/lib/tracing/index.js +24 -16
  53. package/dist/lib/tracing/index.js.map +2 -2
  54. package/dist/lib/tracing/openai-traces-integration.d.ts +9 -3
  55. package/dist/lib/tracing/openai-traces-integration.d.ts.map +1 -1
  56. package/package.json +23 -19
  57. package/dist/lib/sandbox/cli-process.d.ts +0 -35
  58. package/dist/lib/sandbox/cli-process.d.ts.map +0 -1
  59. package/dist/lib/sandbox/read-file.d.ts +0 -9
  60. package/dist/lib/sandbox/read-file.d.ts.map +0 -1
@@ -1,87 +1,23 @@
1
+ import type { Experimental_SandboxFileStat } from '@ai-sdk/provider-utils';
1
2
  import { type Container, Docker, type EngineApi, type Environment } from '@zukhruf/docker';
2
- import type { CommonSandboxOptions, ContainerEngine, ContainerErrorFactory, EngineContainer, ImageBuildSpec, RunResult, SandboxNamedVolume, SandboxResources, SandboxVolume } from './container-engine.ts';
3
+ import type { CommonSandboxOptions, ContainerEngine, ContainerErrorFactory, EngineContainer, EngineExecOptions, EngineProcess, EngineSpawnOptions, ImageBuildSpec, RunResult, SandboxNamedVolume, SandboxVolume } from './container-engine.ts';
3
4
  import { type AcquiredContainer, ContainerSandboxStrategy } from './container-sandbox.ts';
4
5
  import { type Installer, type InstallerContext } from './installers/installer.ts';
5
- import type { CommandResult, DisposableSandbox, ExecuteCommandOptions, SandboxProcess, SpawnOptions } from './types.ts';
6
- export type { CommandResult as ExecResult, Sandbox } from './types.ts';
6
+ import type { CommandResult, DisposableSandbox } from './types.ts';
7
7
  export type { SandboxBindVolume as DockerBindVolume, SandboxNamedVolume as DockerNamedVolume, SandboxVolume as DockerSandboxVolume, } from './container-engine.ts';
8
8
  export { ComposeStartError, ContainerCreationError, DockerNotAvailableError, DockerSandboxError, DockerfileBuildError, type InstallErrorOptions, type InstallKind, InstallError, MissingRuntimeError, PackageInstallError, VolumeCreateError, VolumeInspectError, VolumePathError, VolumeRemoveError, } from './docker-sandbox-errors.ts';
9
- export interface DockerResources extends SandboxResources {
10
- /**
11
- * `--memory-swap` — total memory + swap (e.g. `'1g'`). Without it Docker
12
- * allows swap up to 2× `memory`; set it equal to `memory` to forbid swap
13
- * entirely. Must be ≥ `memory`.
14
- */
15
- memorySwap?: string;
16
- /** `--shm-size` — size of `/dev/shm` (e.g. `'64m'`). Raise for Chromium/ML workloads. */
17
- shmSize?: string;
18
- /** `--pids-limit` — cap the container's process count (fork-bomb protection). */
19
- pidsLimit?: number;
20
- /** `--ulimit` per entry — e.g. `['nofile=1024:2048']`. */
21
- ulimits?: string[];
22
- /** `--cpuset-cpus` — CPUs the container may run on, e.g. `'0-1'`. */
23
- cpusetCpus?: string;
24
- /** `--cpu-shares` — relative CPU weight under contention. */
25
- cpuShares?: number;
26
- }
27
- /**
28
- * Container hardening for `docker run`. All optional — omit for the daemon's
29
- * defaults (shared kernel, root user, writable root filesystem).
30
- */
31
- export interface DockerSecurity {
32
- /**
33
- * `--cap-drop` per entry. `['ALL']` drops every Linux capability — the
34
- * baseline for running untrusted code; re-grant via {@link capAdd}.
35
- */
36
- capDrop?: string[];
37
- /** `--cap-add` per entry. Re-grant only what's needed after dropping `ALL`. */
38
- capAdd?: string[];
39
- /**
40
- * `--read-only` — mount the container root filesystem read-only. Writes then
41
- * only land in `tmpfs`/volume mounts; pair with a writable `/workspace`
42
- * (a {@link tmpfs} entry or volume) or the sandbox's `writeFiles` and the
43
- * installer phase will fail.
44
- */
45
- readOnly?: boolean;
46
- /**
47
- * `--user` (`uid[:gid]`) — run as a non-root user. The installer phase
48
- * (`apk`/`apt`/`npm -g`/`pip`) needs root, so non-root suits a pre-baked
49
- * Dockerfile image rather than the runtime-image + installers path.
50
- */
51
- user?: string;
52
- /**
53
- * `--tmpfs` per entry (e.g. `'/tmp'`, `'/workspace:size=64m'`) — ephemeral,
54
- * in-memory writable directories. The companion to {@link readOnly}.
55
- */
56
- tmpfs?: string[];
57
- /**
58
- * `--security-opt` per entry — e.g. `['seccomp=/path/profile.json']` to apply
59
- * a custom seccomp profile, or `['no-new-privileges']`.
60
- */
61
- securityOpt?: string[];
62
- }
63
- /** Networking for `docker run`. */
64
- export interface DockerNetwork {
65
- /**
66
- * `--network` — e.g. `'none'` (no network at all; strong isolation for
67
- * untrusted code, but breaks network installers), a custom network name, or
68
- * `'host'` (shares the host network stack — defeats isolation).
69
- */
70
- mode?: string;
71
- /** `--publish` per entry — e.g. `['8080:80']` to expose a container port. */
72
- publish?: string[];
73
- /** `--dns` per entry — custom DNS servers. */
74
- dns?: string[];
75
- /** `--add-host` per entry — e.g. `['db:10.0.0.5']` host-to-IP mappings. */
76
- addHost?: string[];
77
- /** `--hostname` — the container hostname. */
78
- hostname?: string;
79
- }
80
9
  /**
81
- * Run-configuration for the Docker engine. Extends the common options the shared
82
- * skeleton reads with Docker-only `docker run` knobs that only `DockerEngine`
83
- * sees.
10
+ * The part of the Engine API create body that a Docker sandbox passes through:
11
+ * every field the sandbox does not own. The sandbox sets `Image` from `image`
12
+ * or `dockerfile`, `WorkingDir` from `workdir`, `Env` from `env` and `Cmd`
13
+ * from `command`. `HostConfig.AutoRemove` follows who created the container,
14
+ * and `HostConfig.Mounts` comes from `volumes`. `Labels` also go on the managed
15
+ * volumes that the sandbox creates.
84
16
  */
17
+ export type DockerContainerConfig = Omit<EngineApi.ContainerCreateRequest, 'Image' | 'WorkingDir' | 'Env' | 'Cmd' | 'HostConfig'> & {
18
+ HostConfig?: Omit<EngineApi.HostConfig, 'AutoRemove' | 'Mounts'>;
19
+ };
20
+ /** What the Docker engine reads, beside what the shared skeleton reads. */
85
21
  export interface DockerCommonOptions extends CommonSandboxOptions {
86
22
  /**
87
23
  * The environment whose `DOCKER_HOST`, `DOCKER_CONTEXT` and `DOCKER_CONFIG`
@@ -89,47 +25,20 @@ export interface DockerCommonOptions extends CommonSandboxOptions {
89
25
  */
90
26
  environment?: Environment;
91
27
  volumes?: SandboxVolume[];
92
- resources?: DockerResources;
93
28
  /** Container execution timeout in milliseconds; excludes Docker/SSH connection setup. */
94
29
  commandTimeout?: number;
95
30
  /**
96
- * `--platform` (e.g. `'linux/amd64'`) — emulated when it differs from the host
97
- * arch. For the Dockerfile strategy it also applies to `docker build` and is
98
- * folded into the image-build cache key.
31
+ * The platform of the container (e.g. `'linux/amd64'`), emulated when it
32
+ * differs from the engine's. The Dockerfile strategy also builds for it and
33
+ * folds it into the image-build cache key.
99
34
  */
100
35
  platform?: string;
101
36
  /**
102
- * `--runtime` for `docker run` — selects the OCI runtime that backs the
103
- * container (default: the daemon's default, usually `runc`). Set to a
104
- * registered runtime such as `'kata-runtime'` (or `'io.containerd.kata.v2'`)
105
- * to run the container inside a lightweight VM with its own guest kernel
106
- * instead of sharing the host kernel. The runtime must already be installed on
107
- * the host and registered in the Docker daemon — and the host must have
108
- * hardware virtualization (`/dev/kvm`); it is not provisioned here.
109
- */
110
- runtime?: string;
111
- /** Container hardening: capabilities, read-only rootfs, user, tmpfs, security-opt. */
112
- security?: DockerSecurity;
113
- /** Networking: network mode, published ports, DNS, host mappings, hostname. */
114
- network?: DockerNetwork;
115
- /**
116
- * `--gpus` — e.g. `'all'`. Requires the nvidia container runtime on the host
117
- * and is incompatible with a `runtime` such as `'kata-runtime'`.
37
+ * The create body of the container, as `@zukhruf/docker` takes it: limits,
38
+ * capabilities, user, network, devices, OCI runtime. The sandbox adds no
39
+ * limit of its own, so the engine's defaults apply to what this leaves out.
118
40
  */
119
- gpus?: string;
120
- /**
121
- * `--device` per entry — expose a host device, e.g. `['/dev/fuse']`. Passed
122
- * through verbatim; the library never injects a device implicitly.
123
- */
124
- devices?: string[];
125
- /** `--init` — run an init process as PID 1 that reaps zombie subprocesses. */
126
- init?: boolean;
127
- /** `--label` metadata on the container and any managed volumes it creates. */
128
- labels?: Record<string, string>;
129
- /** `--sysctl` — kernel parameters, emitted as `key=value` per entry. */
130
- sysctls?: Record<string, string>;
131
- /** `--entrypoint` — override the image `ENTRYPOINT`. */
132
- entrypoint?: string;
41
+ container?: DockerContainerConfig;
133
42
  }
134
43
  export interface RuntimeSandboxOptions extends DockerCommonOptions {
135
44
  /** Docker image to use (default: `'bash:5.3-alpine3.24'`). */
@@ -161,7 +70,6 @@ export interface ComposeSandboxOptions {
161
70
  environment?: Environment;
162
71
  compose: string;
163
72
  service: string;
164
- resources?: DockerResources;
165
73
  /** Container execution timeout in milliseconds; excludes Docker/SSH connection setup. */
166
74
  commandTimeout?: number;
167
75
  }
@@ -170,31 +78,23 @@ export declare function isDockerfileOptions(opts: DockerSandboxOptions): opts is
170
78
  export declare function isComposeOptions(opts: DockerSandboxOptions): opts is ComposeSandboxOptions;
171
79
  /** Where the files of a container are, for the archive requests. */
172
80
  interface FileLayout {
173
- /** Relative sandbox paths resolve here, as they did in an exec's shell. */
81
+ /** Relative sandbox paths resolve here, as they do in an exec's shell. */
174
82
  workdir: string;
175
83
  /** Paths only an exec reaches: tmpfs mounts and the kernel filesystems. */
176
84
  execOnly: string[];
177
- /** The container user (`Config.User`): `''` for root, or `user[:group]` by name or ID. */
178
- user: string;
179
- }
180
- /** The IDs that own a file the sandbox writes. */
181
- interface Owner {
182
- uid: number;
183
- gid: number;
184
85
  }
185
86
  /** A sandbox container on the Docker engine. */
186
87
  declare class DockerContainer implements EngineContainer {
187
88
  #private;
188
89
  readonly name: string;
189
- constructor(name: string, container: Container, layout: FileLayout, owner: Owner | undefined, commandTimeout: number | undefined);
190
- executeCommand(command: string, options?: ExecuteCommandOptions): Promise<CommandResult>;
191
- spawn(command: string, options?: SpawnOptions): Promise<SandboxProcess>;
192
- readFile(path: string): Promise<Uint8Array>;
193
- writeFiles(files: Array<{
194
- path: string;
195
- content: string | Buffer;
196
- }>): Promise<void>;
197
- exists(path: string): Promise<boolean>;
90
+ readonly workdir: string;
91
+ readonly commandTimeout: number | undefined;
92
+ constructor(name: string, container: Container, layout: FileLayout, commandTimeout: number | undefined, autoRemove: boolean);
93
+ exec(argv: string[], options?: EngineExecOptions): Promise<CommandResult>;
94
+ spawn(argv: string[], options: EngineSpawnOptions): Promise<EngineProcess>;
95
+ readFile(path: string, signal: AbortSignal | undefined): Promise<Uint8Array | null>;
96
+ stat(path: string, signal: AbortSignal | undefined): Promise<Experimental_SandboxFileStat | null>;
97
+ writeFile(path: string, content: Uint8Array, signal: AbortSignal | undefined): Promise<void>;
198
98
  installerContext(image: string): InstallerContext;
199
99
  stop(): Promise<void>;
200
100
  }
@@ -220,7 +120,7 @@ export declare class DockerEngine implements ContainerEngine<DockerCommonOptions
220
120
  */
221
121
  static connect(environment: Environment, commandTimeout: number | undefined): Promise<DockerEngine>;
222
122
  /** A sandbox container handle for a container of this engine. */
223
- container(name: string, container: Container, info: EngineApi.ContainerInspectResponse): Promise<DockerContainer>;
123
+ container(name: string, container: Container, info: EngineApi.ContainerInspectResponse): DockerContainer;
224
124
  attach(name: string, image: string): Promise<DockerContainer | undefined>;
225
125
  run(image: string, name: string, opts: DockerCommonOptions, workdir: string): Promise<RunResult>;
226
126
  volumeExists(name: string): Promise<boolean>;
@@ -228,13 +128,13 @@ export declare class DockerEngine implements ContainerEngine<DockerCommonOptions
228
128
  removeVolume(name: string): Promise<void>;
229
129
  ensureWorkdir(): Promise<void>;
230
130
  imageExists(tag: string): Promise<boolean>;
131
+ /** An inline Dockerfile goes to `docker build -f -` on stdin. */
231
132
  buildImage(spec: ImageBuildSpec): Promise<void>;
232
133
  dispose(): Promise<void>;
233
134
  }
234
135
  export interface ComposeStrategyArgs {
235
136
  compose: string;
236
137
  service: string;
237
- resources?: DockerResources;
238
138
  }
239
139
  /**
240
140
  * Manages multi-container environments via `docker compose`. Docker-only — the
@@ -1 +1 @@
1
- {"version":3,"file":"docker-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/docker-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAGd,MAAM,EAEN,KAAK,SAAS,EACd,KAAK,WAAW,EAMjB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,iBAAiB,EACtB,wBAAwB,EAIzB,MAAM,wBAAwB,CAAC;AAYhC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,gBAAgB,EAEtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EAErB,cAAc,EACd,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,aAAa,IAAI,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CA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AO,CAAC,IAAI,CAAC;CAGzB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,wBAAwB,CAAC,mBAAmB,CAAC;IAChF,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAe;gBAEvB,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,YAAY;IAQ3D,OAAO,CAAC,OAAO;cAQC,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;cAIlB,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,CAAC;cAsCvD,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;cAIjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAiC5B;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,OAAO,EAAE,oBAAoB,EAC7B,EAAE,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,CAAC,CAAC,CAIZ"}
@@ -11,7 +11,6 @@ export * from './strace/file-changes.ts';
11
11
  export * from './gcs.ts';
12
12
  export * from './installers/index.ts';
13
13
  export * from './microsandbox-sandbox.ts';
14
- export * from './read-file.ts';
15
14
  export * from './shell-quote.ts';
16
15
  export * from './subcommand.ts';
17
16
  export * from './types.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
@@ -14,10 +14,9 @@ export interface MicrosandboxSandboxOptions extends SandboxReadinessOptions {
14
14
  */
15
15
  name?: string;
16
16
  /**
17
- * Default working directory, created at boot (default `'/workspace'`).
18
- * Microsandbox images default to `/`, and common images ship no
19
- * `/workspace`, so the factory creates it — pass this same path as
20
- * `createBashTool`'s `destination`.
17
+ * The directory commands start in and relative paths resolve against,
18
+ * created at boot (default `'/workspace'`). Microsandbox images default to
19
+ * `/`, and common images ship no `/workspace`, so the factory creates it.
21
20
  */
22
21
  workdir?: string;
23
22
  /**
@@ -25,7 +24,7 @@ export interface MicrosandboxSandboxOptions extends SandboxReadinessOptions {
25
24
  * it. Requires `name`.
26
25
  */
27
26
  replace?: boolean;
28
- /** Per-command timeout in milliseconds for `executeCommand`. */
27
+ /** Per-command timeout in milliseconds for `run` and `spawn`. */
29
28
  commandTimeout?: number;
30
29
  /**
31
30
  * Fluent access to the SDK builder for everything the factory does not
@@ -53,9 +52,6 @@ export declare class MicrosandboxNotAvailableError extends MicrosandboxSandboxEr
53
52
  export declare class MicrosandboxCreationError extends MicrosandboxSandboxError {
54
53
  constructor(message: string, cause?: Error);
55
54
  }
56
- export declare class MicrosandboxCommandError extends MicrosandboxSandboxError {
57
- constructor(message: string, cause?: Error);
58
- }
59
55
  /**
60
56
  * Creates a sandbox backed by a microsandbox microVM.
61
57
  *
@@ -73,16 +69,13 @@ export declare class MicrosandboxCommandError extends MicrosandboxSandboxError {
73
69
  * @example Ephemeral sandbox (removed on dispose)
74
70
  * ```typescript
75
71
  * await using sandbox = await createMicrosandboxSandbox();
76
- * const result = await sandbox.executeCommand('echo hello');
72
+ * const result = await sandbox.run({ command: 'echo hello' });
77
73
  * ```
78
74
  *
79
75
  * @example Named sandbox (stopped on dispose, resumed on next create)
80
76
  * ```typescript
81
77
  * const sandbox = await createMicrosandboxSandbox({ name: chatId });
82
- * const { tools } = await createBashTool({
83
- * sandbox,
84
- * destination: MICROSANDBOX_DEFAULT_DESTINATION,
85
- * });
78
+ * const { tools } = await createBashTool({ sandbox });
86
79
  * ```
87
80
  */
88
81
  export declare function createMicrosandboxSandbox(options?: MicrosandboxSandboxOptions): Promise<DisposableSandbox>;
@@ -1 +1 @@
1
- {"version":3,"file":"microsandbox-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/microsandbox-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,c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AgC,eAAe,CAAC;AAY7D,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,cAAc,CAAC;CACzD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAK3C;AAED,qBAAa,6BAA8B,SAAQ,wBAAwB;gBAC7D,KAAK,CAAC,EAAE,KAAK;CAO1B;AAED,qBAAa,yBAA0B,SAAQ,wBAAwB;gBACzD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,iBAAiB,CAAC,CA+D5B"}
@@ -1,6 +1,6 @@
1
1
  import type { DisposableSandbox, ReadFileTool } from '../types.ts';
2
- export declare function createReadFileTool({ sandbox, destination, }: {
2
+ export declare function createReadFileTool({ sandbox, workingDirectory, }: {
3
3
  sandbox: DisposableSandbox;
4
- destination: string;
4
+ workingDirectory: string | undefined;
5
5
  }): ReadFileTool;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgCnE,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,WAAW,GACZ,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,YAAY,CA6Bf"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgCnE,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,GAAG,YAAY,CAiCf"}
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/text.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;CA6BL,CAAC"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/text.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;;CA6BL,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type Experimental_SandboxProcess } from '@ai-sdk/provider-utils';
2
+ import type { CommandResult, DisposableSandbox } from './types.ts';
3
+ /**
4
+ * `path` against `directory` when it is relative. Joined, not normalized, so
5
+ * that `link/..` follows the link, as it does in a command.
6
+ */
7
+ export declare function resolveIn(directory: string, path: string): string;
8
+ /** The text calls of a session, over its binary calls. */
9
+ export declare function textCalls({ readBinaryFile, writeBinaryFile, }: Pick<DisposableSandbox, 'readBinaryFile' | 'writeBinaryFile'>): Pick<DisposableSandbox, 'readTextFile' | 'writeTextFile'>;
10
+ /**
11
+ * The control of a spawned process: a kill that runs once however often it is
12
+ * called, a kill when `abortSignal` aborts (at once when it already has), and
13
+ * a `wait` that rejects with the abort reason once the process is gone.
14
+ */
15
+ export declare function controlProcess({ exitCode, kill: stop, abortSignal, }: {
16
+ exitCode: Promise<number>;
17
+ kill: () => Promise<void>;
18
+ abortSignal: AbortSignal | undefined;
19
+ }): {
20
+ wait: Experimental_SandboxProcess['wait'];
21
+ kill: () => Promise<void>;
22
+ };
23
+ /** Reads a spawned process to its end, as `run` returns it. */
24
+ export declare function collect(process: Experimental_SandboxProcess): Promise<CommandResult>;
25
+ interface ByteReadable {
26
+ stream: ReadableStream<Uint8Array>;
27
+ enqueue(chunk: Uint8Array): void;
28
+ close(): void;
29
+ error(reason: unknown): void;
30
+ }
31
+ /**
32
+ * A byte stream fed from one interleaved process output. One source feeds two
33
+ * of these, so honoring each stream's backpressure would deadlock (waiting on
34
+ * stdout's `pull` while the next chunk is stderr stalls both): chunks queue
35
+ * until read. After its reader cancels, chunks for it are dropped and the
36
+ * process keeps running, as the AI SDK's own sandbox adapter does.
37
+ */
38
+ export declare function createByteReadable(): ByteReadable;
39
+ export {};
40
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAcnE;;;GAGG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,0DAA0D;AAC1D,wBAAgB,SAAS,CAAC,EACxB,cAAc,EACd,eAAe,GAChB,EAAE,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,IAAI,CACrE,iBAAiB,EACjB,cAAc,GAAG,eAAe,CACjC,CAiBA;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,IAAI,EAAE,IAAI,EACV,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;CACtC,GAAG;IACF,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAmBA;AAED,+DAA+D;AAC/D,wBAAsB,OAAO,CAC3B,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAkCjD"}
@@ -13,6 +13,10 @@ export interface WithStraceFileChangesOptions {
13
13
  * Glob patterns subtracted from `include` — a path matching any of these is
14
14
  * dropped even if it also matches `include`. Use to keep framework-written
15
15
  * files (e.g. an uploaded skills directory) out of the change stream.
16
+ *
17
+ * `createBashTool` creates its working directory and uploads its files through
18
+ * this decorator, so `onFileChanges` sees that setup and a throw fails it. A
19
+ * callback that must not see the setup excludes those paths.
16
20
  */
17
21
  exclude?: string[];
18
22
  onFileChanges?: (changes: FileChange[]) => void | Promise<void>;
@@ -26,12 +30,12 @@ export interface WithStraceFileChangesOptions {
26
30
  traceDir?: string;
27
31
  }
28
32
  /**
29
- * A `with*` decorator that wraps the sandbox so each `executeCommand` is traced
30
- * and its filesystem mutations parsed into a per-call `FileChange[]`. Per-call
31
- * attribution is structural — one UUID-keyed trace file per call — so it is safe under
32
- * concurrent tool calls. Each call's manifest is surfaced two stateless ways:
33
- * attached directly to the command result as `meta.fileChanges` and passed to
34
- * `onFileChanges`. No buffer is retained.
33
+ * A `with*` decorator that wraps the sandbox so each `run` is traced and its
34
+ * filesystem mutations parsed into a per-call `FileChange[]`. Per-call
35
+ * attribution is structural — one UUID-keyed trace file per call — so it is safe
36
+ * under concurrent tool calls. Each call's manifest is surfaced two stateless
37
+ * ways: attached directly to the command result as `meta.fileChanges` and passed
38
+ * to `onFileChanges`. No buffer is retained.
35
39
  *
36
40
  * This decorator TRUSTS that strace tracing works in the sandbox; it does not
37
41
  * self-test. "strace works here" is an invariant of the (image + host kernel +
@@ -42,16 +46,18 @@ export interface WithStraceFileChangesOptions {
42
46
  * Re-proving it per composition would re-pay several host→container round-trips
43
47
  * on every tool call for no new information.
44
48
  *
45
- * `readFile` passes through unchanged; `writeFiles` is observed directly (it
46
- * mutates outside strace's view) — each written file matching the
47
- * `include`/`exclude` globs becomes a `write` change fed to onFileChanges.
48
- * `dispose` also sweeps the trace
49
- * dir. `spawn` is traced the same way — its trace is read when the process exits
50
- * (strace is the top process, so the trace is fully flushed by then). `spawn`
51
- * has no command result, so its changes go to `onFileChanges` only.
49
+ * Reads, `stat` and `listDirectory` pass through unchanged. `writeFile`,
50
+ * `writeBinaryFile` and `writeTextFile` are observed directly (they mutate
51
+ * outside strace's view) — a written file matching the `include`/`exclude` globs
52
+ * becomes a `write` change fed to onFileChanges. `deleteFile` is observed the same
53
+ * way: a `delete` change when it returns true, and nothing when it returns false
54
+ * or rejects. `dispose` also sweeps the trace dir. `spawn` is traced the same way
55
+ * as `run` — its trace is read when the process exits (strace is the top process,
56
+ * so the trace is fully flushed by then). `spawn` has no command result, so its
57
+ * changes go to `onFileChanges` only.
52
58
  *
53
59
  * The trace file is always swept once parsed. A throwing `onFileChanges` on the
54
- * tool-call path propagates to `withBashExceptionCatch` one level up: a caller's
60
+ * tool-call path propagates to the bash tool one level up: a caller's
55
61
  * `BashException` becomes the tool result (via its `format()`), any other error
56
62
  * fails the tool call. The `spawn` path has no exception catcher, so its throw is
57
63
  * isolated and surfaced only via `onError`.
@@ -1 +1 @@
1
- {"version":3,"file":"file-changes.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/strace/file-changes.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAajE,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAmJ5B"}
1
+ {"version":3,"file":"file-changes.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/strace/file-changes.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAajE,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CA2L5B"}
@@ -52,7 +52,7 @@ export interface ParseStraceOptions {
52
52
  export declare function matchesGlobs(path: string, include: string[], exclude?: string[]): boolean;
53
53
  /**
54
54
  * Parse one command's strace output into a coarse `FileChange[]`. Failed
55
- * syscalls are skipped; paths are filtered to `destination`; the trace file and
55
+ * syscalls are skipped; paths are filtered to `workingDirectory`; the trace file and
56
56
  * `/proc`,`/sys`,`/dev` are excluded. Per-path final state collapses repeated
57
57
  * writes to one `write`; a path written then deleted within the command is
58
58
  * treated as transient and dropped.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/strace/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GACjC,gBAAgB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAW5D;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAEjB,MAAM,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM;CAQjE;AAID;;;;;;;;GAQG;AACH,wBAA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166
166
  const dir = dirfdPath(args);
167
167
  if (RENAME_SYSCALLS.has(syscall)) {
168
- const strings = quotedStrings(args);
169
- if (strings.length < 2) continue;
170
- const from = resolve(dir, strings[0]);
171
- const to = resolve(dir, strings[strings.length - 1]);
168
+ const [first, ...rest] = quotedStrings(args);
169
+ const last = rest.at(-1);
170
+ if (last === void 0) continue;
171
+ const from = resolve(dir, first);
172
+ const to = resolve(dir, last);
172
173
  state.delete(from);
173
174
  renames.push({ from, to });
174
175
  continue;
@@ -184,8 +185,8 @@ function parseStraceTrace(raw, options) {
184
185
  continue;
185
186
  }
186
187
  if (LINK_SYSCALLS.has(syscall)) {
187
- const strings = quotedStrings(args);
188
- if (strings.length) write(resolve(dir, strings[strings.length - 1]));
188
+ const last = quotedStrings(args).at(-1);
189
+ if (last !== void 0) write(resolve(dir, last));
189
190
  continue;
190
191
  }
191
192
  if (OPEN_SYSCALLS.has(syscall)) {