@deepagents/context 0.39.0 → 2.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.
Files changed (121) hide show
  1. package/README.md +44 -11
  2. package/dist/browser.js +171 -15
  3. package/dist/browser.js.map +3 -3
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +3037 -1573
  7. package/dist/index.js.map +4 -4
  8. package/dist/lib/agent.d.ts +6 -0
  9. package/dist/lib/agent.d.ts.map +1 -1
  10. package/dist/lib/chain-summary.d.ts +18 -0
  11. package/dist/lib/chain-summary.d.ts.map +1 -0
  12. package/dist/lib/engine.d.ts +25 -6
  13. package/dist/lib/engine.d.ts.map +1 -1
  14. package/dist/lib/fragments/message/user.d.ts +21 -2
  15. package/dist/lib/fragments/message/user.d.ts.map +1 -1
  16. package/dist/lib/fragments.d.ts +8 -3
  17. package/dist/lib/fragments.d.ts.map +1 -1
  18. package/dist/lib/resolvers/async-resolver.d.ts +8 -0
  19. package/dist/lib/resolvers/async-resolver.d.ts.map +1 -0
  20. package/dist/lib/resolvers/function-resolver.d.ts +8 -0
  21. package/dist/lib/resolvers/function-resolver.d.ts.map +1 -0
  22. package/dist/lib/resolvers/generator-resolver.d.ts +13 -0
  23. package/dist/lib/resolvers/generator-resolver.d.ts.map +1 -0
  24. package/dist/lib/resolvers/index.d.ts +10 -0
  25. package/dist/lib/resolvers/index.d.ts.map +1 -0
  26. package/dist/lib/resolvers/iterable-resolver.d.ts +12 -0
  27. package/dist/lib/resolvers/iterable-resolver.d.ts.map +1 -0
  28. package/dist/lib/resolvers/loader-resolver.d.ts +13 -0
  29. package/dist/lib/resolvers/loader-resolver.d.ts.map +1 -0
  30. package/dist/lib/resolvers/promise-resolver.d.ts +7 -0
  31. package/dist/lib/resolvers/promise-resolver.d.ts.map +1 -0
  32. package/dist/lib/resolvers/types.d.ts +45 -0
  33. package/dist/lib/resolvers/types.d.ts.map +1 -0
  34. package/dist/lib/sandbox/abort.d.ts +24 -0
  35. package/dist/lib/sandbox/abort.d.ts.map +1 -0
  36. package/dist/lib/sandbox/agent-os-sandbox.d.ts +3 -6
  37. package/dist/lib/sandbox/agent-os-sandbox.d.ts.map +1 -1
  38. package/dist/lib/sandbox/ast-utils.d.ts +5 -2
  39. package/dist/lib/sandbox/ast-utils.d.ts.map +1 -1
  40. package/dist/lib/sandbox/bash-tool.d.ts +29 -16
  41. package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
  42. package/dist/lib/sandbox/container-tool.d.ts +47 -21
  43. package/dist/lib/sandbox/container-tool.d.ts.map +1 -1
  44. package/dist/lib/sandbox/docker-sandbox-errors.d.ts +74 -0
  45. package/dist/lib/sandbox/docker-sandbox-errors.d.ts.map +1 -0
  46. package/dist/lib/sandbox/docker-sandbox.d.ts +148 -371
  47. package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
  48. package/dist/lib/sandbox/file-events.d.ts +24 -38
  49. package/dist/lib/sandbox/file-events.d.ts.map +1 -1
  50. package/dist/lib/sandbox/index.d.ts +3 -7
  51. package/dist/lib/sandbox/index.d.ts.map +1 -1
  52. package/dist/lib/sandbox/installers/github-release.d.ts +46 -0
  53. package/dist/lib/sandbox/installers/github-release.d.ts.map +1 -0
  54. package/dist/lib/sandbox/installers/index.d.ts +7 -0
  55. package/dist/lib/sandbox/installers/index.d.ts.map +1 -0
  56. package/dist/lib/sandbox/installers/installer.d.ts +44 -0
  57. package/dist/lib/sandbox/installers/installer.d.ts.map +1 -0
  58. package/dist/lib/sandbox/installers/npm.d.ts +32 -0
  59. package/dist/lib/sandbox/installers/npm.d.ts.map +1 -0
  60. package/dist/lib/sandbox/installers/package-manager.d.ts +19 -0
  61. package/dist/lib/sandbox/installers/package-manager.d.ts.map +1 -0
  62. package/dist/lib/sandbox/installers/pip.d.ts +37 -0
  63. package/dist/lib/sandbox/installers/pip.d.ts.map +1 -0
  64. package/dist/lib/sandbox/installers/url-binary.d.ts +41 -0
  65. package/dist/lib/sandbox/installers/url-binary.d.ts.map +1 -0
  66. package/dist/lib/sandbox/subcommand.d.ts +11 -11
  67. package/dist/lib/sandbox/subcommand.d.ts.map +1 -1
  68. package/dist/lib/sandbox/types.d.ts +51 -6
  69. package/dist/lib/sandbox/types.d.ts.map +1 -1
  70. package/dist/lib/sandbox/upload-skills.d.ts +6 -0
  71. package/dist/lib/sandbox/upload-skills.d.ts.map +1 -1
  72. package/dist/lib/sandbox/virtual-sandbox.d.ts +10 -0
  73. package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -0
  74. package/dist/lib/save/reminder-target-handler.d.ts +36 -0
  75. package/dist/lib/save/reminder-target-handler.d.ts.map +1 -0
  76. package/dist/lib/save/save-pipeline.d.ts +28 -0
  77. package/dist/lib/save/save-pipeline.d.ts.map +1 -0
  78. package/dist/lib/save/tool-output-target-handler.d.ts +7 -0
  79. package/dist/lib/save/tool-output-target-handler.d.ts.map +1 -0
  80. package/dist/lib/save/user-target-handler.d.ts +7 -0
  81. package/dist/lib/save/user-target-handler.d.ts.map +1 -0
  82. package/dist/lib/stream/change-source.d.ts +11 -0
  83. package/dist/lib/stream/change-source.d.ts.map +1 -0
  84. package/dist/lib/stream/ddl.stream.postgres-notify.d.ts +3 -0
  85. package/dist/lib/stream/ddl.stream.postgres-notify.d.ts.map +1 -0
  86. package/dist/lib/stream/ddl.stream.postgres.d.ts +2 -0
  87. package/dist/lib/stream/ddl.stream.postgres.d.ts.map +1 -0
  88. package/dist/lib/stream/polling-change-source.d.ts +27 -0
  89. package/dist/lib/stream/polling-change-source.d.ts.map +1 -0
  90. package/dist/lib/stream/polling-policy.d.ts +0 -1
  91. package/dist/lib/stream/polling-policy.d.ts.map +1 -1
  92. package/dist/lib/stream/postgres-notify-change-source.d.ts +15 -0
  93. package/dist/lib/stream/postgres-notify-change-source.d.ts.map +1 -0
  94. package/dist/lib/stream/postgres.stream-store.d.ts +29 -0
  95. package/dist/lib/stream/postgres.stream-store.d.ts.map +1 -0
  96. package/dist/lib/stream/stream-manager.d.ts +8 -27
  97. package/dist/lib/stream/stream-manager.d.ts.map +1 -1
  98. package/dist/lib/ui-message-guards.d.ts +10 -0
  99. package/dist/lib/ui-message-guards.d.ts.map +1 -0
  100. package/package.json +4 -17
  101. package/dist/lib/sandbox/extension.d.ts +0 -39
  102. package/dist/lib/sandbox/extension.d.ts.map +0 -1
  103. package/dist/lib/sandbox/openapi/demo.d.ts +0 -2
  104. package/dist/lib/sandbox/openapi/demo.d.ts.map +0 -1
  105. package/dist/lib/sandbox/openapi/extension.d.ts +0 -19
  106. package/dist/lib/sandbox/openapi/extension.d.ts.map +0 -1
  107. package/dist/lib/sandbox/openapi/format.d.ts +0 -11
  108. package/dist/lib/sandbox/openapi/format.d.ts.map +0 -1
  109. package/dist/lib/sandbox/openapi/schema.d.ts +0 -9
  110. package/dist/lib/sandbox/openapi/schema.d.ts.map +0 -1
  111. package/dist/lib/sandbox/openapi/skill/index.d.ts +0 -6
  112. package/dist/lib/sandbox/openapi/skill/index.d.ts.map +0 -1
  113. package/dist/lib/sandbox/openapi/skill/index.js +0 -14
  114. package/dist/lib/sandbox/openapi/skill/index.js.map +0 -7
  115. package/dist/lib/sandbox/openapi/skill/openapi-cli/SKILL.md +0 -109
  116. package/dist/lib/sandbox/openapi/validate.d.ts +0 -7
  117. package/dist/lib/sandbox/openapi/validate.d.ts.map +0 -1
  118. package/dist/lib/sandbox/routing-sandbox.d.ts +0 -28
  119. package/dist/lib/sandbox/routing-sandbox.d.ts.map +0 -1
  120. package/dist/lib/sandboxes/openai.d.ts +0 -6
  121. package/dist/lib/sandboxes/openai.d.ts.map +0 -1
@@ -1,476 +1,253 @@
1
- import { type CommandResult, type Sandbox } from 'bash-tool';
1
+ import { type CommandResult } from 'bash-tool';
2
+ import { type Installer } from './installers/installer.ts';
3
+ import type { DisposableSandbox, ExecuteCommandOptions, SandboxProcess, SpawnOptions } from './types.ts';
2
4
  export type { CommandResult as ExecResult, Sandbox } from 'bash-tool';
3
- /**
4
- * Base error for all Docker sandbox operations.
5
- */
6
- export declare class DockerSandboxError extends Error {
7
- readonly containerId?: string;
8
- constructor(message: string, containerId?: string);
9
- }
10
- /**
11
- * Thrown when Docker daemon is not available.
12
- */
13
- export declare class DockerNotAvailableError extends DockerSandboxError {
14
- constructor();
15
- }
16
- /**
17
- * Thrown when container creation fails.
18
- */
19
- export declare class ContainerCreationError extends DockerSandboxError {
20
- readonly image: string;
21
- cause?: Error;
22
- constructor(message: string, image: string, cause?: Error);
23
- }
24
- /**
25
- * Thrown when package installation fails.
26
- */
27
- export declare class PackageInstallError extends DockerSandboxError {
28
- readonly packages: string[];
29
- readonly image: string;
30
- readonly packageManager: 'apk' | 'apt-get';
31
- readonly stderr: string;
32
- constructor(packages: string[], image: string, packageManager: 'apk' | 'apt-get', stderr: string, containerId?: string);
33
- }
34
- /**
35
- * Thrown when a binary installation from URL fails.
36
- */
37
- export declare class BinaryInstallError extends DockerSandboxError {
38
- readonly binaryName: string;
39
- readonly url: string;
40
- readonly reason: string;
41
- constructor(binaryName: string, url: string, reason: string, containerId?: string);
42
- }
43
- /**
44
- * Thrown when a mount path doesn't exist on the host.
45
- */
46
- export declare class MountPathError extends DockerSandboxError {
47
- readonly hostPath: string;
48
- readonly containerPath: string;
49
- constructor(hostPath: string, containerPath: string);
50
- }
51
- /**
52
- * Thrown when Dockerfile build fails.
53
- */
54
- export declare class DockerfileBuildError extends DockerSandboxError {
55
- readonly stderr: string;
56
- constructor(stderr: string);
57
- }
58
- /**
59
- * Thrown when docker compose up fails.
60
- */
61
- export declare class ComposeStartError extends DockerSandboxError {
62
- readonly composeFile: string;
63
- readonly stderr: string;
64
- constructor(composeFile: string, stderr: string);
65
- }
66
- /**
67
- * Configuration for mounting a host directory into the container.
68
- */
69
- export interface DockerMount {
70
- /** Absolute path on the host machine */
5
+ export { ComposeStartError, ContainerCreationError, DockerNotAvailableError, DockerSandboxError, DockerfileBuildError, type InstallErrorOptions, type InstallSource, InstallError, MissingRuntimeError, PackageInstallError, VolumeCreateError, VolumeInspectError, VolumePathError, VolumeRemoveError, } from './docker-sandbox-errors.ts';
6
+ export interface DockerBindVolume {
7
+ type: 'bind';
71
8
  hostPath: string;
72
- /** Path inside the container */
73
9
  containerPath: string;
74
- /** Whether the mount is read-only (default: true) */
10
+ /** Default: `true`. */
75
11
  readOnly?: boolean;
76
12
  }
77
- /**
78
- * Resource limits for the container.
79
- */
13
+ export interface DockerNamedVolume {
14
+ type: 'volume';
15
+ name: string;
16
+ containerPath: string;
17
+ /** Default: `true`. */
18
+ readOnly?: boolean;
19
+ /** Default: `'external'`. */
20
+ lifecycle?: 'external' | 'managed';
21
+ /** Docker volume driver used when `lifecycle` is `'managed'`. */
22
+ driver?: string;
23
+ /** Docker volume driver options used when `lifecycle` is `'managed'`. */
24
+ driverOptions?: Record<string, string>;
25
+ subPath?: string;
26
+ noCopy?: boolean;
27
+ /** Default: `true` for managed volumes created by this sandbox. */
28
+ removeOnDispose?: boolean;
29
+ }
30
+ export type DockerSandboxVolume = DockerBindVolume | DockerNamedVolume;
80
31
  export interface DockerResources {
81
- /** Memory limit (e.g., '1g', '512m') */
32
+ /** e.g. `'1g'`, `'512m'`. */
82
33
  memory?: string;
83
- /** CPU limit (number of CPUs) */
34
+ /** Number of CPUs. */
84
35
  cpus?: number;
85
36
  }
86
37
  /**
87
- * Architecture-specific URL mapping for binary downloads.
88
- * Maps container architecture (from `uname -m`) to download URLs.
89
- */
90
- export interface ArchitectureUrls {
91
- /** URL for x86_64 architecture (amd64) */
92
- x86_64?: string;
93
- /** URL for ARM64 architecture (aarch64) */
94
- aarch64?: string;
95
- /** URL for ARMv7 architecture */
96
- armv7l?: string;
97
- }
98
- /**
99
- * Configuration for installing a binary from a URL.
38
+ * Stable identity suffix for the container. When provided, the container
39
+ * is named `sandbox-<name>` instead of getting a randomized
40
+ * `sandbox-<8hex>`. If a container with that name already exists on the
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.
100
45
  *
101
- * Binaries are downloaded, extracted (if tar.gz), and installed to /usr/local/bin.
102
- */
103
- export interface BinaryInstall {
104
- /** Name of the binary (used for the final executable name) */
105
- name: string;
106
- /**
107
- * URL or architecture-specific URLs.
108
- * - If a string, used for all architectures
109
- * - If ArchitectureUrls, selects based on container architecture
110
- */
111
- url: string | ArchitectureUrls;
112
- /**
113
- * Optional: The binary filename inside the archive if different from `name`.
114
- * Useful when the archive contains versioned binaries like "presenterm-0.15.1".
115
- */
116
- binaryPath?: string;
117
- }
118
- /**
119
- * Options for RuntimeStrategy - installs packages/binaries at container runtime.
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.
120
54
  */
55
+ type StableContainerName = string;
121
56
  export interface RuntimeSandboxOptions {
122
- /** Docker image to use (default: 'alpine:latest') */
57
+ /** Docker image to use (default: `'alpine:latest'`). */
123
58
  image?: string;
124
- /** Packages to install in the container via package manager (apk/apt) */
125
- packages?: string[];
126
- /** Binaries to install from URLs (for tools not in package managers) */
127
- binaries?: BinaryInstall[];
128
- /** Directories to mount from host */
129
- mounts?: DockerMount[];
130
- /** Resource limits */
59
+ /**
60
+ * Ordered list of installers run after the container starts. Use
61
+ * `pkg([...])`, `urlBinary({...})`, `npm(...)`, `pip(...)`,
62
+ * `githubRelease({...})`, or any custom `Installer` subclass.
63
+ */
64
+ installers?: Installer[];
65
+ volumes?: DockerSandboxVolume[];
131
66
  resources?: DockerResources;
132
- /** Environment variables to set in the container */
133
67
  env?: Record<string, string>;
68
+ name?: StableContainerName;
134
69
  }
135
- /**
136
- * Options for DockerfileStrategy - builds custom image from Dockerfile.
137
- */
138
70
  export interface DockerfileSandboxOptions {
139
- /** Dockerfile content (if contains newlines) or path to Dockerfile */
71
+ /** Inline Dockerfile content (contains `\n`) or a path. */
140
72
  dockerfile: string;
141
- /** Build context directory (default: '.') */
73
+ /** Build context directory (default: `'.'`). */
142
74
  context?: string;
143
- /** Directories to mount from host */
144
- mounts?: DockerMount[];
145
- /** Resource limits */
75
+ volumes?: DockerSandboxVolume[];
146
76
  resources?: DockerResources;
147
- /** Environment variables to set in the container */
148
77
  env?: Record<string, string>;
78
+ name?: StableContainerName;
149
79
  }
150
- /**
151
- * Options for ComposeStrategy - manages multi-container environments.
152
- */
153
80
  export interface ComposeSandboxOptions {
154
- /** Path to docker-compose.yml file */
155
81
  compose: string;
156
- /** Service name to execute commands in (required) */
157
82
  service: string;
158
- /** Resource limits (applied to target service only) */
159
83
  resources?: DockerResources;
160
84
  }
161
- /**
162
- * Union type for Docker sandbox options.
163
- * - RuntimeSandboxOptions: Runtime package/binary installation
164
- * - DockerfileSandboxOptions: Pre-built images from Dockerfile
165
- * - ComposeSandboxOptions: Multi-container environments via Docker Compose
166
- */
167
85
  export type DockerSandboxOptions = RuntimeSandboxOptions | DockerfileSandboxOptions | ComposeSandboxOptions;
168
- /**
169
- * Extended sandbox interface with disposal method.
170
- */
171
- export interface DockerSandbox extends Sandbox {
172
- /** Stop and remove the container */
173
- dispose(): Promise<void>;
174
- }
175
- /**
176
- * Type guard to determine if options are for DockerfileStrategy.
177
- */
178
86
  export declare function isDockerfileOptions(opts: DockerSandboxOptions): opts is DockerfileSandboxOptions;
179
- /**
180
- * Type guard to determine if options are for ComposeStrategy.
181
- */
182
87
  export declare function isComposeOptions(opts: DockerSandboxOptions): opts is ComposeSandboxOptions;
183
- /**
184
- * Internal context shared across strategy methods.
185
- */
186
88
  interface StrategyContext {
187
89
  containerId: string;
188
90
  image: string;
189
91
  }
92
+ export interface DockerSandboxStrategyArgs {
93
+ volumes?: DockerSandboxVolume[];
94
+ resources?: DockerResources;
95
+ env?: Record<string, string>;
96
+ name?: StableContainerName;
97
+ }
190
98
  /**
191
- * Abstract base class for Docker sandbox creation strategies.
192
- *
193
- * Uses the Template Method pattern to define the skeleton of the sandbox
194
- * creation algorithm, deferring specific steps to subclasses.
195
- *
196
- * @example Extending the strategy
197
- * ```typescript
198
- * class CustomStrategy extends DockerSandboxStrategy {
199
- * protected async getImage(): Promise<string> {
200
- * // Custom image resolution logic
201
- * return 'my-custom-image:latest';
202
- * }
203
- *
204
- * protected async configure(): Promise<void> {
205
- * // Custom configuration after container starts
206
- * }
207
- * }
208
- * ```
99
+ * Template Method base for sandbox creation strategies. Subclasses choose
100
+ * the image and define post-start configuration; the base owns container
101
+ * lifecycle, exec, and file I/O.
209
102
  */
210
103
  export declare abstract class DockerSandboxStrategy {
211
104
  protected context: StrategyContext;
212
- protected mounts: DockerMount[];
105
+ protected volumes: DockerSandboxVolume[];
213
106
  protected resources: DockerResources;
214
107
  protected env: Record<string, string>;
215
- constructor(mounts?: DockerMount[], resources?: DockerResources, env?: Record<string, string>);
216
- /**
217
- * Template method - defines the algorithm skeleton for creating a sandbox.
218
- *
219
- * Steps:
220
- * 1. Validate mount paths exist on host
221
- * 2. Get/build the Docker image (strategy-specific)
222
- * 3. Start the container
223
- * 4. Configure the container (strategy-specific)
224
- * 5. Create and return sandbox methods
225
- */
226
- create(): Promise<DockerSandbox>;
227
- /**
228
- * Validates that all mount paths exist on the host filesystem.
229
- */
230
- protected validateMounts(): void;
231
- /**
232
- * Builds the docker run command arguments.
233
- */
108
+ protected name?: StableContainerName;
109
+ private createdVolumes;
110
+ constructor(args?: DockerSandboxStrategyArgs);
111
+ create(): Promise<DisposableSandbox>;
112
+ private namedContainerId;
113
+ protected defaultContainerId(): string;
114
+ protected acquireContainer(image: string): Promise<{
115
+ containerId: string;
116
+ attached: boolean;
117
+ }>;
118
+ private startStoppedContainer;
119
+ protected inspectContainer(containerId: string): Promise<'running' | 'stopped' | 'absent'>;
120
+ private isMissingContainerError;
121
+ private isNameConflictError;
122
+ protected prepareVolumes(): Promise<void>;
123
+ protected validateVolumes(): void;
124
+ private validateMountValue;
234
125
  protected buildDockerArgs(image: string, containerId: string): string[];
235
- /**
236
- * Starts a Docker container with the given image.
237
- */
238
- protected startContainer(image: string): Promise<string>;
239
- /**
240
- * Stops a Docker container.
241
- */
126
+ protected buildVolumeMountArg(volume: DockerSandboxVolume): string;
127
+ private inspectVolume;
128
+ private volumeExists;
129
+ private createVolume;
130
+ private cleanupCreatedVolumes;
131
+ private cleanupCreatedVolumesAfterFailure;
132
+ private getDockerErrorMessage;
133
+ private isDockerUnavailableError;
134
+ private isMissingVolumeInspectError;
135
+ protected startContainer(image: string, containerId: string): Promise<void>;
242
136
  protected stopContainer(containerId: string): Promise<void>;
243
- /**
244
- * Executes a command in the container.
245
- */
246
- protected exec(command: string): Promise<CommandResult>;
247
- /**
248
- * Creates the DockerSandbox interface with all methods.
249
- */
250
- protected createSandboxMethods(): DockerSandbox;
251
- /**
252
- * Returns the Docker image to use for the container.
253
- * For RuntimeStrategy: returns the image name directly.
254
- * For DockerfileStrategy: builds the image and returns the tag.
255
- */
137
+ protected exec(command: string, options?: ExecuteCommandOptions): Promise<CommandResult>;
138
+ protected spawnProcess(command: string, options?: SpawnOptions): SandboxProcess;
139
+ protected createSandboxMethods(): DisposableSandbox;
256
140
  protected abstract getImage(): Promise<string>;
257
- /**
258
- * Configures the container after it starts.
259
- * For RuntimeStrategy: installs packages and binaries.
260
- * For DockerfileStrategy: no-op (Dockerfile already configured).
261
- */
262
141
  protected abstract configure(): Promise<void>;
263
142
  }
143
+ export interface RuntimeStrategyArgs extends DockerSandboxStrategyArgs {
144
+ image?: string;
145
+ installers?: Installer[];
146
+ }
264
147
  /**
265
- * Strategy that uses an existing Docker image and installs packages/binaries
266
- * at container runtime.
267
- *
268
- * This is the "configure-on-demand" approach - starts a vanilla image and
269
- * customizes it by executing installation commands.
148
+ * Starts a vanilla image and runs the supplied installers in order.
270
149
  *
271
150
  * @example
272
- * ```typescript
273
- * const strategy = new RuntimeStrategy(
274
- * 'alpine:latest',
275
- * ['curl', 'jq'],
276
- * [{ name: 'presenterm', url: {...} }],
277
- * );
278
- * const sandbox = await strategy.create();
151
+ * ```ts
152
+ * new RuntimeStrategy({
153
+ * image: 'alpine:latest',
154
+ * installers: [
155
+ * pkg(['curl', 'jq']),
156
+ * urlBinary({ name: 'presenterm', url: {...} }),
157
+ * npm('prettier', { ensureRuntime: true }),
158
+ * ],
159
+ * });
279
160
  * ```
280
161
  */
281
162
  export declare class RuntimeStrategy extends DockerSandboxStrategy {
282
163
  private image;
283
- private packages;
284
- private binaries;
285
- constructor(image?: string, packages?: string[], binaries?: BinaryInstall[], mounts?: DockerMount[], resources?: DockerResources, env?: Record<string, string>);
164
+ private installers;
165
+ constructor(args?: RuntimeStrategyArgs);
286
166
  protected getImage(): Promise<string>;
287
167
  protected configure(): Promise<void>;
288
- /**
289
- * Installs packages using the appropriate package manager (apk/apt-get).
290
- */
291
- private installPackages;
292
- /**
293
- * Installs binaries from URLs.
294
- */
295
- private installBinaries;
296
- /**
297
- * Ensures curl is installed in the container.
298
- */
299
- private ensureCurl;
300
- /**
301
- * Detects the container's CPU architecture.
302
- */
303
- private detectArchitecture;
304
- /**
305
- * Installs a single binary from URL.
306
- */
307
- private installBinary;
168
+ }
169
+ export interface DockerfileStrategyArgs extends DockerSandboxStrategyArgs {
170
+ dockerfile: string;
171
+ context?: string;
308
172
  }
309
173
  /**
310
- * Strategy that builds a custom Docker image from a Dockerfile.
311
- *
312
- * This is the "build-once, run-many" approach - builds the image upfront
313
- * (with caching) and runs containers from the pre-configured image.
314
- *
315
- * Image caching: Uses a deterministic tag based on Dockerfile content hash.
316
- * If the same Dockerfile is used, the existing image is reused (cache hit).
317
- *
318
- * @example Inline Dockerfile
319
- * ```typescript
320
- * const strategy = new DockerfileStrategy(`
321
- * FROM alpine:latest
322
- * RUN apk add --no-cache curl jq
323
- * `);
324
- * const sandbox = await strategy.create();
325
- * ```
326
- *
327
- * @example Dockerfile path
328
- * ```typescript
329
- * const strategy = new DockerfileStrategy(
330
- * './Dockerfile.sandbox',
331
- * './docker', // build context
332
- * );
333
- * const sandbox = await strategy.create();
334
- * ```
174
+ * Builds a custom image from a Dockerfile (with content-hash caching).
175
+ * Runs no post-start configuration — the Dockerfile defines the image.
335
176
  */
336
177
  export declare class DockerfileStrategy extends DockerSandboxStrategy {
337
178
  private imageTag;
338
179
  private dockerfile;
339
180
  private dockerContext;
340
- constructor(dockerfile: string, dockerContext?: string, mounts?: DockerMount[], resources?: DockerResources, env?: Record<string, string>);
341
- /**
342
- * Computes a deterministic image tag based on Dockerfile content.
343
- * Same Dockerfile → same tag → Docker skips rebuild if image exists.
344
- */
181
+ constructor(args: DockerfileStrategyArgs);
345
182
  private computeImageTag;
346
- /**
347
- * Checks if the dockerfile property is inline content or a file path.
348
- */
349
183
  private isInlineDockerfile;
350
184
  protected getImage(): Promise<string>;
351
185
  protected configure(): Promise<void>;
352
- /**
353
- * Checks if the image already exists locally.
354
- */
355
186
  private imageExists;
356
- /**
357
- * Builds the Docker image from the Dockerfile.
358
- */
359
187
  private buildImage;
360
188
  }
189
+ export interface ComposeStrategyArgs {
190
+ compose: string;
191
+ service: string;
192
+ resources?: DockerResources;
193
+ }
361
194
  /**
362
- * Strategy that manages multi-container environments using Docker Compose.
363
- *
364
- * Unlike other strategies that manage a single container, ComposeStrategy
365
- * orchestrates multiple services as a unit using docker compose commands.
366
- *
367
- * @example
368
- * ```typescript
369
- * const strategy = new ComposeStrategy(
370
- * './docker-compose.yml',
371
- * 'app', // Service to execute commands in
372
- * );
373
- * const sandbox = await strategy.create();
374
- *
375
- * // Commands run in the 'app' service
376
- * await sandbox.executeCommand('node --version');
377
- *
378
- * // Can communicate with other services via service names
379
- * await sandbox.executeCommand('curl http://api:3000/health');
380
- *
381
- * // Stops ALL services
382
- * await sandbox.dispose();
383
- * ```
195
+ * Manages multi-container environments via `docker compose`.
196
+ * Commands run inside the named service; `dispose()` brings the whole stack down.
384
197
  */
385
198
  export declare class ComposeStrategy extends DockerSandboxStrategy {
386
199
  private projectName;
387
200
  private composeFile;
388
201
  private service;
389
- constructor(composeFile: string, service: string, resources?: DockerResources);
390
- /**
391
- * Deterministic project name based on compose file content for caching.
392
- * Same compose file → same project name → faster subsequent startups.
393
- */
202
+ constructor(args: ComposeStrategyArgs);
394
203
  private computeProjectName;
395
- /**
396
- * Override: No image to get - compose manages its own images.
397
- */
398
204
  protected getImage(): Promise<string>;
399
- /**
400
- * Override: Start all services with docker compose up.
401
- */
402
- protected startContainer(_image: string): Promise<string>;
205
+ protected startContainer(_image: string, _containerId: string): Promise<void>;
206
+ protected defaultContainerId(): string;
403
207
  protected configure(): Promise<void>;
404
- /**
405
- * Override: Execute commands in the target service.
406
- */
407
- protected exec(command: string): Promise<CommandResult>;
408
- /**
409
- * Override: Stop all services with docker compose down.
410
- */
208
+ protected exec(command: string, options?: ExecuteCommandOptions): Promise<CommandResult>;
209
+ protected spawnProcess(command: string, options?: SpawnOptions): SandboxProcess;
411
210
  protected stopContainer(_containerId: string): Promise<void>;
412
211
  }
413
212
  /**
414
- * Creates a Docker-based sandbox for executing commands in an isolated container.
213
+ * Create a Docker-backed sandbox.
415
214
  *
416
- * Supports three strategies:
417
- * - **RuntimeStrategy**: Uses existing image, installs packages/binaries at runtime
418
- * - **DockerfileStrategy**: Builds custom image from Dockerfile (with caching)
419
- * - **ComposeStrategy**: Multi-container environments via Docker Compose
215
+ * @example Runtime with installers
216
+ * ```ts
217
+ * import { createDockerSandbox, pkg, urlBinary, npm } from '@deepagents/context';
420
218
  *
421
- * @example RuntimeStrategy (default)
422
- * ```typescript
423
219
  * const sandbox = await createDockerSandbox({
424
220
  * image: 'alpine:latest',
425
- * packages: ['curl', 'jq'],
426
- * binaries: [{ name: 'presenterm', url: {...} }],
221
+ * installers: [
222
+ * pkg(['curl', 'jq']),
223
+ * urlBinary({ name: 'presenterm', url: {...} }),
224
+ * npm('prettier', { ensureRuntime: true }),
225
+ * ],
427
226
  * });
428
- * await sandbox.executeCommand('curl --version');
429
- * await sandbox.dispose();
430
227
  * ```
431
228
  *
432
- * @example DockerfileStrategy
433
- * ```typescript
229
+ * @example Dockerfile
230
+ * ```ts
434
231
  * const sandbox = await createDockerSandbox({
435
232
  * dockerfile: `
436
233
  * FROM alpine:latest
437
234
  * RUN apk add --no-cache curl jq
438
235
  * `,
439
- * context: '.',
440
236
  * });
441
- * await sandbox.executeCommand('curl --version');
442
- * await sandbox.dispose();
443
237
  * ```
444
238
  *
445
- * @example ComposeStrategy
446
- * ```typescript
239
+ * @example Compose
240
+ * ```ts
447
241
  * const sandbox = await createDockerSandbox({
448
242
  * compose: './docker-compose.yml',
449
243
  * service: 'app',
450
244
  * });
451
- * // Commands run in the 'app' service
452
- * await sandbox.executeCommand('node --version');
453
- * // Can reach other services by name
454
- * await sandbox.executeCommand('curl http://db:5432');
455
- * await sandbox.dispose(); // Stops ALL services
456
245
  * ```
457
246
  */
458
- export declare function createDockerSandbox(options?: DockerSandboxOptions): Promise<DockerSandbox>;
247
+ export declare function createDockerSandbox(options?: DockerSandboxOptions): Promise<DisposableSandbox>;
459
248
  /**
460
- * Execute a function with a Docker sandbox that auto-disposes on completion.
461
- * Ensures cleanup even if the function throws.
462
- *
463
- * @example
464
- * ```typescript
465
- * const output = await useSandbox(
466
- * { packages: ['curl', 'jq'] },
467
- * async (sandbox) => {
468
- * const result = await sandbox.executeCommand('curl --version');
469
- * return result.stdout;
470
- * },
471
- * );
472
- * // Container is automatically disposed - no try/finally needed
473
- * ```
249
+ * Run a function with a Docker sandbox; the container is disposed on
250
+ * completion (success or thrown).
474
251
  */
475
- export declare function useSandbox<T>(options: DockerSandboxOptions, fn: (sandbox: DockerSandbox) => Promise<T>): Promise<T>;
252
+ export declare function useSandbox<T>(options: DockerSandboxOptions, fn: (sandbox: DisposableSandbox) => Promise<T>): Promise<T>;
476
253
  //# sourceMappingURL=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