@deepagents/context 3.1.0 → 4.1.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.
- package/README.md +57 -19
- package/dist/browser.js +48 -64
- package/dist/browser.js.map +3 -3
- package/dist/index.js +2004 -1479
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/chain-summary.d.ts.map +1 -1
- package/dist/lib/engine.d.ts +3 -3
- package/dist/lib/engine.d.ts.map +1 -1
- package/dist/lib/fragments/message/user.d.ts +51 -92
- package/dist/lib/fragments/message/user.d.ts.map +1 -1
- package/dist/lib/sandbox/agent-os-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/apple-container-sandbox-errors.d.ts +44 -0
- package/dist/lib/sandbox/apple-container-sandbox-errors.d.ts.map +1 -0
- package/dist/lib/sandbox/apple-container-sandbox.d.ts +122 -0
- package/dist/lib/sandbox/apple-container-sandbox.d.ts.map +1 -0
- package/dist/lib/sandbox/bash-tool.d.ts +9 -28
- package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
- package/dist/lib/sandbox/cli-process.d.ts +24 -0
- package/dist/lib/sandbox/cli-process.d.ts.map +1 -0
- package/dist/lib/sandbox/container-engine.d.ts +149 -0
- package/dist/lib/sandbox/container-engine.d.ts.map +1 -0
- package/dist/lib/sandbox/container-sandbox-errors.d.ts +10 -0
- package/dist/lib/sandbox/container-sandbox-errors.d.ts.map +1 -0
- package/dist/lib/sandbox/container-sandbox.d.ts +90 -0
- package/dist/lib/sandbox/container-sandbox.d.ts.map +1 -0
- package/dist/lib/sandbox/daytona-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/docker-sandbox-errors.d.ts +2 -2
- package/dist/lib/sandbox/docker-sandbox-errors.d.ts.map +1 -1
- package/dist/lib/sandbox/docker-sandbox.d.ts +122 -189
- package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/index.d.ts +6 -1
- package/dist/lib/sandbox/index.d.ts.map +1 -1
- package/dist/lib/sandbox/installers/bin.d.ts.map +1 -1
- package/dist/lib/sandbox/installers/index.d.ts +7 -7
- package/dist/lib/sandbox/installers/index.d.ts.map +1 -1
- package/dist/lib/sandbox/installers/installer.d.ts +0 -5
- package/dist/lib/sandbox/installers/installer.d.ts.map +1 -1
- package/dist/lib/sandbox/installers/url-binary.d.ts.map +1 -1
- package/dist/lib/sandbox/shell-quote.d.ts +10 -0
- package/dist/lib/sandbox/shell-quote.d.ts.map +1 -0
- package/dist/lib/sandbox/strace/file-change.d.ts +21 -0
- package/dist/lib/sandbox/strace/file-change.d.ts.map +1 -0
- package/dist/lib/sandbox/strace/file-changes.d.ts +66 -0
- package/dist/lib/sandbox/strace/file-changes.d.ts.map +1 -0
- package/dist/lib/sandbox/strace/index.d.ts +74 -0
- package/dist/lib/sandbox/strace/index.d.ts.map +1 -0
- package/dist/lib/sandbox/strace/index.js +296 -0
- package/dist/lib/sandbox/strace/index.js.map +7 -0
- package/dist/lib/sandbox/types.d.ts +9 -4
- package/dist/lib/sandbox/types.d.ts.map +1 -1
- package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -1
- package/dist/lib/save/save-pipeline.d.ts +1 -13
- package/dist/lib/save/save-pipeline.d.ts.map +1 -1
- package/dist/lib/skills/skill-reminder.d.ts +2 -2
- package/dist/lib/skills/skill-reminder.d.ts.map +1 -1
- package/package.json +9 -3
- package/dist/lib/sandbox/file-changes.d.ts +0 -83
- package/dist/lib/sandbox/file-changes.d.ts.map +0 -1
|
@@ -1,59 +1,130 @@
|
|
|
1
1
|
import { type CommandResult } from 'bash-tool';
|
|
2
|
+
import type { CommonSandboxOptions, ContainerEngine, SandboxResources, SandboxVolume } from './container-engine.ts';
|
|
3
|
+
import { ContainerSandboxStrategy } from './container-sandbox.ts';
|
|
2
4
|
import { type Installer } from './installers/installer.ts';
|
|
3
5
|
import type { DisposableSandbox, ExecuteCommandOptions, SandboxProcess, SpawnOptions } from './types.ts';
|
|
4
6
|
export type { CommandResult as ExecResult, Sandbox } from 'bash-tool';
|
|
7
|
+
export type { SandboxBindVolume as DockerBindVolume, SandboxNamedVolume as DockerNamedVolume, SandboxVolume as DockerSandboxVolume, } from './container-engine.ts';
|
|
5
8
|
export { ComposeStartError, ContainerCreationError, DockerNotAvailableError, DockerSandboxError, DockerfileBuildError, type InstallErrorOptions, type InstallKind, InstallError, MissingRuntimeError, PackageInstallError, VolumeCreateError, VolumeInspectError, VolumePathError, VolumeRemoveError, } from './docker-sandbox-errors.ts';
|
|
6
|
-
export interface
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
12
26
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
*/
|
|
18
45
|
readOnly?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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[];
|
|
29
62
|
}
|
|
30
|
-
|
|
31
|
-
export interface
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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;
|
|
36
79
|
}
|
|
37
80
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* host, the sandbox attaches to it: installers, volume preparation, and
|
|
42
|
-
* env are skipped (the pre-existing container is assumed already
|
|
43
|
-
* configured). If it exists but is stopped, it is started first.
|
|
44
|
-
* Otherwise the container is created fresh and installers run as usual.
|
|
45
|
-
*
|
|
46
|
-
* Must match `/^[A-Za-z0-9_.-]+$/`. The full Docker container name
|
|
47
|
-
* (`sandbox-<name>`) is always legal because the prefix begins with an
|
|
48
|
-
* alphanumeric character.
|
|
49
|
-
*
|
|
50
|
-
* Warning: `dispose()` stops (and `--rm` removes) the container regardless
|
|
51
|
-
* of whether it was created or attached to. If two callers in the same
|
|
52
|
-
* process share a name, the first `dispose()` destroys the container the
|
|
53
|
-
* other one is still using.
|
|
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.
|
|
54
84
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
85
|
+
export interface DockerCommonOptions extends CommonSandboxOptions {
|
|
86
|
+
volumes?: SandboxVolume[];
|
|
87
|
+
resources?: DockerResources;
|
|
88
|
+
/**
|
|
89
|
+
* `--platform` (e.g. `'linux/amd64'`) — emulated when it differs from the host
|
|
90
|
+
* arch. For the Dockerfile strategy it also applies to `docker build` and is
|
|
91
|
+
* folded into the image-build cache key.
|
|
92
|
+
*/
|
|
93
|
+
platform?: string;
|
|
94
|
+
/**
|
|
95
|
+
* `--runtime` for `docker run` — selects the OCI runtime that backs the
|
|
96
|
+
* container (default: the daemon's default, usually `runc`). Set to a
|
|
97
|
+
* registered runtime such as `'kata-runtime'` (or `'io.containerd.kata.v2'`)
|
|
98
|
+
* to run the container inside a lightweight VM with its own guest kernel
|
|
99
|
+
* instead of sharing the host kernel. The runtime must already be installed on
|
|
100
|
+
* the host and registered in the Docker daemon — and the host must have
|
|
101
|
+
* hardware virtualization (`/dev/kvm`); it is not provisioned here.
|
|
102
|
+
*/
|
|
103
|
+
runtime?: string;
|
|
104
|
+
/** Container hardening: capabilities, read-only rootfs, user, tmpfs, security-opt. */
|
|
105
|
+
security?: DockerSecurity;
|
|
106
|
+
/** Networking: network mode, published ports, DNS, host mappings, hostname. */
|
|
107
|
+
network?: DockerNetwork;
|
|
108
|
+
/**
|
|
109
|
+
* `--gpus` — e.g. `'all'`. Requires the nvidia container runtime on the host
|
|
110
|
+
* and is incompatible with a `runtime` such as `'kata-runtime'`.
|
|
111
|
+
*/
|
|
112
|
+
gpus?: string;
|
|
113
|
+
/**
|
|
114
|
+
* `--device` per entry — expose a host device, e.g. `['/dev/fuse']`. Passed
|
|
115
|
+
* through verbatim; the library never injects a device implicitly.
|
|
116
|
+
*/
|
|
117
|
+
devices?: string[];
|
|
118
|
+
/** `--init` — run an init process as PID 1 that reaps zombie subprocesses. */
|
|
119
|
+
init?: boolean;
|
|
120
|
+
/** `--label` — container metadata, emitted as `key=value` per entry. */
|
|
121
|
+
labels?: Record<string, string>;
|
|
122
|
+
/** `--sysctl` — kernel parameters, emitted as `key=value` per entry. */
|
|
123
|
+
sysctls?: Record<string, string>;
|
|
124
|
+
/** `--entrypoint` — override the image `ENTRYPOINT`. */
|
|
125
|
+
entrypoint?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface RuntimeSandboxOptions extends DockerCommonOptions {
|
|
57
128
|
/** Docker image to use (default: `'alpine:latest'`). */
|
|
58
129
|
image?: string;
|
|
59
130
|
/**
|
|
@@ -62,23 +133,8 @@ export interface RuntimeSandboxOptions {
|
|
|
62
133
|
* `githubRelease({...})`, or any custom `Installer` subclass.
|
|
63
134
|
*/
|
|
64
135
|
installers?: Installer[];
|
|
65
|
-
volumes?: DockerSandboxVolume[];
|
|
66
|
-
resources?: DockerResources;
|
|
67
|
-
env?: Record<string, string>;
|
|
68
|
-
name?: StableContainerName;
|
|
69
|
-
/**
|
|
70
|
-
* Args appended after the image at `docker run` time.
|
|
71
|
-
* - `undefined` (default): `['tail', '-f', '/dev/null']` — keeps a bare
|
|
72
|
-
* image (e.g. `alpine:latest`) alive so installers and `executeCommand`
|
|
73
|
-
* have something to attach to.
|
|
74
|
-
* - `[]` or `null`: nothing is appended; the image's own `CMD`/`ENTRYPOINT`
|
|
75
|
-
* runs as declared (use this when your image already has a long-running
|
|
76
|
-
* process, e.g. a daemon).
|
|
77
|
-
* - A non-empty array: appended verbatim, overriding the image `CMD`.
|
|
78
|
-
*/
|
|
79
|
-
command?: readonly string[] | null;
|
|
80
136
|
}
|
|
81
|
-
export interface DockerfileSandboxOptions {
|
|
137
|
+
export interface DockerfileSandboxOptions extends DockerCommonOptions {
|
|
82
138
|
/** Inline Dockerfile content (contains `\n`) or a path. */
|
|
83
139
|
dockerfile: string;
|
|
84
140
|
/** Build context directory (default: `'.'`). */
|
|
@@ -89,19 +145,6 @@ export interface DockerfileSandboxOptions {
|
|
|
89
145
|
* otherwise runs silently. Default `false`.
|
|
90
146
|
*/
|
|
91
147
|
showBuildLogs?: boolean;
|
|
92
|
-
volumes?: DockerSandboxVolume[];
|
|
93
|
-
resources?: DockerResources;
|
|
94
|
-
env?: Record<string, string>;
|
|
95
|
-
name?: StableContainerName;
|
|
96
|
-
/**
|
|
97
|
-
* Args appended after the image at `docker run` time.
|
|
98
|
-
* - `undefined` (default): `['tail', '-f', '/dev/null']` — keep-alive.
|
|
99
|
-
* - `[]` or `null`: nothing is appended; the Dockerfile's `CMD`/`ENTRYPOINT`
|
|
100
|
-
* runs as declared. Use this when your Dockerfile already declares a
|
|
101
|
-
* long-running process (e.g. `CMD ["node", "server.js"]`).
|
|
102
|
-
* - A non-empty array: appended verbatim, overriding the image `CMD`.
|
|
103
|
-
*/
|
|
104
|
-
command?: readonly string[] | null;
|
|
105
148
|
}
|
|
106
149
|
export interface ComposeSandboxOptions {
|
|
107
150
|
compose: string;
|
|
@@ -111,128 +154,18 @@ export interface ComposeSandboxOptions {
|
|
|
111
154
|
export type DockerSandboxOptions = RuntimeSandboxOptions | DockerfileSandboxOptions | ComposeSandboxOptions;
|
|
112
155
|
export declare function isDockerfileOptions(opts: DockerSandboxOptions): opts is DockerfileSandboxOptions;
|
|
113
156
|
export declare function isComposeOptions(opts: DockerSandboxOptions): opts is ComposeSandboxOptions;
|
|
114
|
-
|
|
115
|
-
containerId: string;
|
|
116
|
-
image: string;
|
|
117
|
-
}
|
|
118
|
-
export interface DockerSandboxStrategyArgs {
|
|
119
|
-
volumes?: DockerSandboxVolume[];
|
|
120
|
-
resources?: DockerResources;
|
|
121
|
-
env?: Record<string, string>;
|
|
122
|
-
name?: StableContainerName;
|
|
123
|
-
/** See {@link RuntimeSandboxOptions.command}. */
|
|
124
|
-
command?: readonly string[] | null;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Template Method base for sandbox creation strategies. Subclasses choose
|
|
128
|
-
* the image and define post-start configuration; the base owns container
|
|
129
|
-
* lifecycle, exec, and file I/O.
|
|
130
|
-
*/
|
|
131
|
-
export declare abstract class DockerSandboxStrategy {
|
|
132
|
-
protected context: StrategyContext;
|
|
133
|
-
protected volumes: DockerSandboxVolume[];
|
|
134
|
-
protected resources: DockerResources;
|
|
135
|
-
protected env: Record<string, string>;
|
|
136
|
-
protected name?: StableContainerName;
|
|
137
|
-
protected command?: readonly string[] | null;
|
|
138
|
-
private createdVolumes;
|
|
139
|
-
constructor(args?: DockerSandboxStrategyArgs);
|
|
140
|
-
create(): Promise<DisposableSandbox>;
|
|
141
|
-
private namedContainerId;
|
|
142
|
-
protected defaultContainerId(): string;
|
|
143
|
-
protected acquireContainer(image: string): Promise<{
|
|
144
|
-
containerId: string;
|
|
145
|
-
attached: boolean;
|
|
146
|
-
}>;
|
|
147
|
-
private startStoppedContainer;
|
|
148
|
-
protected inspectContainer(containerId: string): Promise<'running' | 'stopped' | 'absent'>;
|
|
149
|
-
private isMissingContainerError;
|
|
150
|
-
private isNameConflictError;
|
|
151
|
-
protected prepareVolumes(): Promise<void>;
|
|
152
|
-
protected validateVolumes(): void;
|
|
153
|
-
private validateMountValue;
|
|
154
|
-
protected buildDockerArgs(image: string, containerId: string): string[];
|
|
155
|
-
protected buildVolumeMountArg(volume: DockerSandboxVolume): string;
|
|
156
|
-
private inspectVolume;
|
|
157
|
-
private volumeExists;
|
|
158
|
-
private createVolume;
|
|
159
|
-
private cleanupCreatedVolumes;
|
|
160
|
-
private cleanupCreatedVolumesAfterFailure;
|
|
161
|
-
private getDockerErrorMessage;
|
|
162
|
-
private isDockerUnavailableError;
|
|
163
|
-
private isMissingVolumeInspectError;
|
|
164
|
-
protected startContainer(image: string, containerId: string): Promise<void>;
|
|
165
|
-
protected stopContainer(containerId: string): Promise<void>;
|
|
166
|
-
protected exec(command: string, options?: ExecuteCommandOptions): Promise<CommandResult>;
|
|
167
|
-
protected spawnProcess(command: string, options?: SpawnOptions): SandboxProcess;
|
|
168
|
-
protected createSandboxMethods(): DisposableSandbox;
|
|
169
|
-
protected abstract getImage(): Promise<string>;
|
|
170
|
-
protected abstract configure(): Promise<void>;
|
|
171
|
-
}
|
|
172
|
-
export interface RuntimeStrategyArgs extends DockerSandboxStrategyArgs {
|
|
173
|
-
image?: string;
|
|
174
|
-
installers?: Installer[];
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Starts a vanilla image and runs the supplied installers in order.
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* ```ts
|
|
181
|
-
* new RuntimeStrategy({
|
|
182
|
-
* image: 'alpine:latest',
|
|
183
|
-
* installers: [
|
|
184
|
-
* pkg(['curl', 'jq']),
|
|
185
|
-
* urlBinary({ name: 'presenterm', url: {...} }),
|
|
186
|
-
* npm('prettier', { ensureRuntime: true }),
|
|
187
|
-
* ],
|
|
188
|
-
* });
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
export declare class RuntimeStrategy extends DockerSandboxStrategy {
|
|
192
|
-
private image;
|
|
193
|
-
private installers;
|
|
194
|
-
constructor(args?: RuntimeStrategyArgs);
|
|
195
|
-
protected getImage(): Promise<string>;
|
|
196
|
-
protected configure(): Promise<void>;
|
|
197
|
-
}
|
|
198
|
-
export interface DockerfileStrategyArgs extends DockerSandboxStrategyArgs {
|
|
199
|
-
dockerfile: string;
|
|
200
|
-
context?: string;
|
|
201
|
-
showBuildLogs?: boolean;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Builds a custom image from a Dockerfile (with content-hash caching).
|
|
205
|
-
* Runs no post-start configuration — the Dockerfile defines the image.
|
|
206
|
-
*/
|
|
207
|
-
export declare class DockerfileStrategy extends DockerSandboxStrategy {
|
|
208
|
-
private imageTag;
|
|
209
|
-
private dockerfile;
|
|
210
|
-
private dockerContext;
|
|
211
|
-
private showBuildLogs;
|
|
212
|
-
constructor(args: DockerfileStrategyArgs);
|
|
213
|
-
private computeImageTag;
|
|
214
|
-
private isInlineDockerfile;
|
|
215
|
-
protected getImage(): Promise<string>;
|
|
216
|
-
protected configure(): Promise<void>;
|
|
217
|
-
private imageExists;
|
|
218
|
-
private buildImage;
|
|
219
|
-
/**
|
|
220
|
-
* Run a build command with stdio inherited so its output streams live to the
|
|
221
|
-
* parent terminal. On failure the build error is already on screen; the
|
|
222
|
-
* rejection just carries the exit code.
|
|
223
|
-
*/
|
|
224
|
-
private runStreamed;
|
|
225
|
-
}
|
|
157
|
+
export declare const dockerEngine: ContainerEngine<DockerCommonOptions>;
|
|
226
158
|
export interface ComposeStrategyArgs {
|
|
227
159
|
compose: string;
|
|
228
160
|
service: string;
|
|
229
161
|
resources?: DockerResources;
|
|
230
162
|
}
|
|
231
163
|
/**
|
|
232
|
-
* Manages multi-container environments via `docker compose`.
|
|
233
|
-
* Commands run inside the named service; `dispose()`
|
|
164
|
+
* Manages multi-container environments via `docker compose`. Docker-only — not
|
|
165
|
+
* part of the engine bridge. Commands run inside the named service; `dispose()`
|
|
166
|
+
* brings the whole stack down.
|
|
234
167
|
*/
|
|
235
|
-
export declare class ComposeStrategy extends
|
|
168
|
+
export declare class ComposeStrategy extends ContainerSandboxStrategy {
|
|
236
169
|
private projectName;
|
|
237
170
|
private composeFile;
|
|
238
171
|
private service;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/docker-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"docker-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/docker-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAO/C,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAGf,gBAAgB,EAChB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,wBAAwB,EAGzB,MAAM,wBAAwB,CAAC;AAYhC,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACb,MAAM,YAAY,C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AY,GACrB,cAAc;cAkBQ,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAc5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAoB5B;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,CAOZ"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
export * from './abort.ts';
|
|
2
2
|
export * from './agent-os-sandbox.ts';
|
|
3
|
+
export * from './apple-container-sandbox.ts';
|
|
3
4
|
export * from './bash-exception.ts';
|
|
4
5
|
export * from './bash-meta.ts';
|
|
5
6
|
export * from './bash-tool.ts';
|
|
6
|
-
export * from './file-changes.ts';
|
|
7
7
|
export * from './binary-bridges.ts';
|
|
8
|
+
export * from './container-engine.ts';
|
|
9
|
+
export * from './container-sandbox.ts';
|
|
10
|
+
export * from './container-sandbox-errors.ts';
|
|
8
11
|
export * from './daytona-sandbox.ts';
|
|
9
12
|
export * from './docker-sandbox.ts';
|
|
13
|
+
export * from './strace/file-changes.ts';
|
|
10
14
|
export * from './gcs.ts';
|
|
11
15
|
export * from './installers/index.ts';
|
|
16
|
+
export * from './shell-quote.ts';
|
|
12
17
|
export * from './subcommand.ts';
|
|
13
18
|
export * from './types.ts';
|
|
14
19
|
export * from './upload-skills.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,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,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/bin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/bin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAKD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,SAAQ,SAAS;;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBAI1B,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;IASvD,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBpD;AAED,wBAAgB,GAAG,CACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,CAEd"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
1
|
+
export * from './installer.ts';
|
|
2
|
+
export * from './bin.ts';
|
|
3
|
+
export * from './github-release.ts';
|
|
4
|
+
export * from './npm.ts';
|
|
5
|
+
export * from './package-manager.ts';
|
|
6
|
+
export * from './pip.ts';
|
|
7
|
+
export * from './url-binary.ts';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
|
@@ -35,10 +35,5 @@ export declare abstract class Installer {
|
|
|
35
35
|
abstract install(ctx: InstallerContext): Promise<void>;
|
|
36
36
|
}
|
|
37
37
|
export declare function isDebianBased(image: string): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* POSIX shell single-quote escape: wrap in `'...'`, replace any embedded
|
|
40
|
-
* `'` with `'\''`. Safe for arbitrary content inside `sh -c`.
|
|
41
|
-
*/
|
|
42
|
-
export declare function shellQuote(s: string): string;
|
|
43
38
|
export declare function createInstallerContext(containerId: string, image: string): InstallerContext;
|
|
44
39
|
//# sourceMappingURL=installer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAS/C,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,SAAS,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9C;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;;;OAMG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAED,8BAAsB,SAAS;IAC7B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CACvD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAKpD;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAyGlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-binary.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/url-binary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"url-binary.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/url-binary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC/B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;gBAEvB,OAAO,EAAE,gBAAgB;IAM/B,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CASpD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAEvE;AAqBD,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,GAAE,KAAK,GAAG,gBAAwB,GACvC,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POSIX shell single-quote escape: wrap in `'...'`, replace any embedded
|
|
3
|
+
* `'` with `'\''`. Safe for arbitrary content inside `sh -c`.
|
|
4
|
+
*
|
|
5
|
+
* Lives in its own zero-import module so lean consumers such as the
|
|
6
|
+
* `./sandbox/strace` leaf entry can use it without dragging in the
|
|
7
|
+
* installer/runtime surface.
|
|
8
|
+
*/
|
|
9
|
+
export declare function shellQuote(s: string): string;
|
|
10
|
+
//# sourceMappingURL=shell-quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-quote.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/shell-quote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single observed filesystem mutation — the shared output type of file-change
|
|
3
|
+
* tracking. It is producer-agnostic: the strace trace parser and the direct
|
|
4
|
+
* `writeFiles` observer both emit it. It lives in its own zero-import module so
|
|
5
|
+
* the lean `./sandbox/strace` leaf and the framework decorator can each depend
|
|
6
|
+
* on it without either owning the other.
|
|
7
|
+
*
|
|
8
|
+
* Ops are deliberately coarse — content-touching changes collapse to `write`
|
|
9
|
+
* (the strace producer cannot distinguish a brand-new file from an overwrite;
|
|
10
|
+
* both are `O_CREAT|O_TRUNC`), while `delete` and `rename` are unambiguous.
|
|
11
|
+
* Reads are not tracked.
|
|
12
|
+
*/
|
|
13
|
+
export type FileChangeOp = 'write' | 'delete' | 'rename';
|
|
14
|
+
export interface FileChange {
|
|
15
|
+
op: FileChangeOp;
|
|
16
|
+
path: string;
|
|
17
|
+
/** Source path for a `rename`. */
|
|
18
|
+
from?: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=file-change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-change.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/strace/file-change.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { DisposableSandbox } from '../types.ts';
|
|
2
|
+
import type { FileChange } from './file-change.ts';
|
|
3
|
+
export type { FileChange, FileChangeOp } from './file-change.ts';
|
|
4
|
+
export interface WithStraceFileChangesOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Glob patterns (matched against absolute paths via Node's
|
|
7
|
+
* `path.matchesGlob`) selecting which file changes to report. Scope to a
|
|
8
|
+
* workspace with `[root, `${root}/**`]`. A path must match at least one
|
|
9
|
+
* pattern to be reported.
|
|
10
|
+
*/
|
|
11
|
+
include: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Glob patterns subtracted from `include` — a path matching any of these is
|
|
14
|
+
* dropped even if it also matches `include`. Use to keep framework-written
|
|
15
|
+
* files (e.g. an uploaded skills directory) out of the change stream.
|
|
16
|
+
*/
|
|
17
|
+
exclude?: string[];
|
|
18
|
+
onFileChanges?: (changes: FileChange[]) => void | Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Called when `onFileChanges` throws on the `spawn` path — its only failure
|
|
21
|
+
* signal, since spawn has no tool result and no exception catcher upstream. A
|
|
22
|
+
* throw on the tool-call path fails the command instead, so it never reaches
|
|
23
|
+
* here. Defaults to `console.warn`.
|
|
24
|
+
*/
|
|
25
|
+
onError?: (error: unknown) => void;
|
|
26
|
+
traceDir?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
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: attached to
|
|
33
|
+
* the tool result via the bash-meta channel (`meta.fileChanges`, hidden from the
|
|
34
|
+
* model) and passed to `onFileChanges`. No buffer is retained.
|
|
35
|
+
*
|
|
36
|
+
* This decorator lives on the main barrel (not the lean `./sandbox/strace`
|
|
37
|
+
* leaf) on purpose: the `meta.fileChanges` channel works by sharing one
|
|
38
|
+
* `bash-meta` AsyncLocalStorage with `createBashTool`, and AsyncLocalStorage
|
|
39
|
+
* context does not cross bundle boundaries — so the decorator must be bundled
|
|
40
|
+
* with `createBashTool`. The leaf carries only the self-contained probe.
|
|
41
|
+
*
|
|
42
|
+
* This decorator TRUSTS that strace tracing works in the sandbox; it does not
|
|
43
|
+
* self-test. "strace works here" is an invariant of the (image + host kernel +
|
|
44
|
+
* seccomp/caps) that is constant for the container's lifetime, so verifying it
|
|
45
|
+
* is the consumer's once-per-container responsibility — run `selfTestStrace`
|
|
46
|
+
* (from `@deepagents/context/sandbox/strace`) once at startup (e.g. a daemon
|
|
47
|
+
* boot gate), which throws `StraceUnavailableError` if strace is unusable.
|
|
48
|
+
* Re-proving it per composition would re-pay several host→container round-trips
|
|
49
|
+
* on every tool call for no new information.
|
|
50
|
+
*
|
|
51
|
+
* `readFile` passes through unchanged; `writeFiles` is observed directly (it
|
|
52
|
+
* mutates outside strace's view) — each written file matching the
|
|
53
|
+
* `include`/`exclude` globs becomes a `write` change fed to onFileChanges.
|
|
54
|
+
* `dispose` also sweeps the trace
|
|
55
|
+
* dir. `spawn` is traced the same way — its trace is read when the process exits
|
|
56
|
+
* (strace is the top process, so the trace is fully flushed by then). `spawn`
|
|
57
|
+
* carries no bash-meta scope, so its changes go to `onFileChanges` only.
|
|
58
|
+
*
|
|
59
|
+
* The trace file is always swept once parsed. A throwing `onFileChanges` on the
|
|
60
|
+
* tool-call path propagates to `withBashExceptionCatch` one level up: a caller's
|
|
61
|
+
* `BashException` becomes the tool result (via its `format()`), any other error
|
|
62
|
+
* fails the tool call. The `spawn` path has no exception catcher, so its throw is
|
|
63
|
+
* isolated and surfaced only via `onError`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function withStraceFileChanges(sandbox: DisposableSandbox, options: WithStraceFileChangesOptions): Promise<DisposableSandbox>;
|
|
66
|
+
//# sourceMappingURL=file-changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-changes.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/strace/file-changes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAuI5B"}
|