@deepagents/context 0.10.2 → 0.12.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 +114 -119
- package/dist/example-error-recovery.d.ts +2 -0
- package/dist/example-error-recovery.d.ts.map +1 -0
- package/dist/index.d.ts +18 -388
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2765 -1091
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.d.ts +87 -12
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/engine.d.ts +325 -0
- package/dist/lib/engine.d.ts.map +1 -0
- package/dist/lib/estimate.d.ts +1 -1
- package/dist/lib/estimate.d.ts.map +1 -1
- package/dist/lib/fragments/domain.d.ts +537 -0
- package/dist/lib/fragments/domain.d.ts.map +1 -0
- package/dist/lib/fragments/user.d.ts +122 -0
- package/dist/lib/fragments/user.d.ts.map +1 -0
- package/dist/lib/fragments.d.ts +103 -0
- package/dist/lib/fragments.d.ts.map +1 -0
- package/dist/lib/guardrail.d.ts +138 -0
- package/dist/lib/guardrail.d.ts.map +1 -0
- package/dist/lib/guardrails/error-recovery.guardrail.d.ts +3 -0
- package/dist/lib/guardrails/error-recovery.guardrail.d.ts.map +1 -0
- package/dist/lib/render.d.ts +21 -0
- package/dist/lib/render.d.ts.map +1 -0
- package/dist/lib/renderers/abstract.renderer.d.ts +11 -3
- package/dist/lib/renderers/abstract.renderer.d.ts.map +1 -1
- package/dist/lib/sandbox/binary-bridges.d.ts +31 -0
- package/dist/lib/sandbox/binary-bridges.d.ts.map +1 -0
- package/dist/lib/sandbox/container-tool.d.ts +134 -0
- package/dist/lib/sandbox/container-tool.d.ts.map +1 -0
- package/dist/lib/sandbox/docker-sandbox.d.ts +471 -0
- package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -0
- package/dist/lib/sandbox/index.d.ts +4 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -0
- package/dist/lib/skills/fragments.d.ts +24 -0
- package/dist/lib/skills/fragments.d.ts.map +1 -0
- package/dist/lib/skills/index.d.ts +31 -0
- package/dist/lib/skills/index.d.ts.map +1 -0
- package/dist/lib/skills/loader.d.ts +28 -0
- package/dist/lib/skills/loader.d.ts.map +1 -0
- package/dist/lib/skills/types.d.ts +40 -0
- package/dist/lib/skills/types.d.ts.map +1 -0
- package/dist/lib/store/sqlite.store.d.ts +4 -2
- package/dist/lib/store/sqlite.store.d.ts.map +1 -1
- package/dist/lib/store/store.d.ts +36 -2
- package/dist/lib/store/store.d.ts.map +1 -1
- package/package.json +8 -4
- package/dist/lib/context.d.ts +0 -56
- package/dist/lib/context.d.ts.map +0 -1
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { type CommandResult, type Sandbox } from 'bash-tool';
|
|
2
|
+
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 */
|
|
71
|
+
hostPath: string;
|
|
72
|
+
/** Path inside the container */
|
|
73
|
+
containerPath: string;
|
|
74
|
+
/** Whether the mount is read-only (default: true) */
|
|
75
|
+
readOnly?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resource limits for the container.
|
|
79
|
+
*/
|
|
80
|
+
export interface DockerResources {
|
|
81
|
+
/** Memory limit (e.g., '1g', '512m') */
|
|
82
|
+
memory?: string;
|
|
83
|
+
/** CPU limit (number of CPUs) */
|
|
84
|
+
cpus?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
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.
|
|
100
|
+
*
|
|
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.
|
|
120
|
+
*/
|
|
121
|
+
export interface RuntimeSandboxOptions {
|
|
122
|
+
/** Docker image to use (default: 'alpine:latest') */
|
|
123
|
+
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 */
|
|
131
|
+
resources?: DockerResources;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Options for DockerfileStrategy - builds custom image from Dockerfile.
|
|
135
|
+
*/
|
|
136
|
+
export interface DockerfileSandboxOptions {
|
|
137
|
+
/** Dockerfile content (if contains newlines) or path to Dockerfile */
|
|
138
|
+
dockerfile: string;
|
|
139
|
+
/** Build context directory (default: '.') */
|
|
140
|
+
context?: string;
|
|
141
|
+
/** Directories to mount from host */
|
|
142
|
+
mounts?: DockerMount[];
|
|
143
|
+
/** Resource limits */
|
|
144
|
+
resources?: DockerResources;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Options for ComposeStrategy - manages multi-container environments.
|
|
148
|
+
*/
|
|
149
|
+
export interface ComposeSandboxOptions {
|
|
150
|
+
/** Path to docker-compose.yml file */
|
|
151
|
+
compose: string;
|
|
152
|
+
/** Service name to execute commands in (required) */
|
|
153
|
+
service: string;
|
|
154
|
+
/** Resource limits (applied to target service only) */
|
|
155
|
+
resources?: DockerResources;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Union type for Docker sandbox options.
|
|
159
|
+
* - RuntimeSandboxOptions: Runtime package/binary installation
|
|
160
|
+
* - DockerfileSandboxOptions: Pre-built images from Dockerfile
|
|
161
|
+
* - ComposeSandboxOptions: Multi-container environments via Docker Compose
|
|
162
|
+
*/
|
|
163
|
+
export type DockerSandboxOptions = RuntimeSandboxOptions | DockerfileSandboxOptions | ComposeSandboxOptions;
|
|
164
|
+
/**
|
|
165
|
+
* Extended sandbox interface with disposal method.
|
|
166
|
+
*/
|
|
167
|
+
export interface DockerSandbox extends Sandbox {
|
|
168
|
+
/** Stop and remove the container */
|
|
169
|
+
dispose(): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Type guard to determine if options are for DockerfileStrategy.
|
|
173
|
+
*/
|
|
174
|
+
export declare function isDockerfileOptions(opts: DockerSandboxOptions): opts is DockerfileSandboxOptions;
|
|
175
|
+
/**
|
|
176
|
+
* Type guard to determine if options are for ComposeStrategy.
|
|
177
|
+
*/
|
|
178
|
+
export declare function isComposeOptions(opts: DockerSandboxOptions): opts is ComposeSandboxOptions;
|
|
179
|
+
/**
|
|
180
|
+
* Internal context shared across strategy methods.
|
|
181
|
+
*/
|
|
182
|
+
interface StrategyContext {
|
|
183
|
+
containerId: string;
|
|
184
|
+
image: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Abstract base class for Docker sandbox creation strategies.
|
|
188
|
+
*
|
|
189
|
+
* Uses the Template Method pattern to define the skeleton of the sandbox
|
|
190
|
+
* creation algorithm, deferring specific steps to subclasses.
|
|
191
|
+
*
|
|
192
|
+
* @example Extending the strategy
|
|
193
|
+
* ```typescript
|
|
194
|
+
* class CustomStrategy extends DockerSandboxStrategy {
|
|
195
|
+
* protected async getImage(): Promise<string> {
|
|
196
|
+
* // Custom image resolution logic
|
|
197
|
+
* return 'my-custom-image:latest';
|
|
198
|
+
* }
|
|
199
|
+
*
|
|
200
|
+
* protected async configure(): Promise<void> {
|
|
201
|
+
* // Custom configuration after container starts
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export declare abstract class DockerSandboxStrategy {
|
|
207
|
+
protected context: StrategyContext;
|
|
208
|
+
protected mounts: DockerMount[];
|
|
209
|
+
protected resources: DockerResources;
|
|
210
|
+
constructor(mounts?: DockerMount[], resources?: DockerResources);
|
|
211
|
+
/**
|
|
212
|
+
* Template method - defines the algorithm skeleton for creating a sandbox.
|
|
213
|
+
*
|
|
214
|
+
* Steps:
|
|
215
|
+
* 1. Validate mount paths exist on host
|
|
216
|
+
* 2. Get/build the Docker image (strategy-specific)
|
|
217
|
+
* 3. Start the container
|
|
218
|
+
* 4. Configure the container (strategy-specific)
|
|
219
|
+
* 5. Create and return sandbox methods
|
|
220
|
+
*/
|
|
221
|
+
create(): Promise<DockerSandbox>;
|
|
222
|
+
/**
|
|
223
|
+
* Validates that all mount paths exist on the host filesystem.
|
|
224
|
+
*/
|
|
225
|
+
protected validateMounts(): void;
|
|
226
|
+
/**
|
|
227
|
+
* Builds the docker run command arguments.
|
|
228
|
+
*/
|
|
229
|
+
protected buildDockerArgs(image: string, containerId: string): string[];
|
|
230
|
+
/**
|
|
231
|
+
* Starts a Docker container with the given image.
|
|
232
|
+
*/
|
|
233
|
+
protected startContainer(image: string): Promise<string>;
|
|
234
|
+
/**
|
|
235
|
+
* Stops a Docker container.
|
|
236
|
+
*/
|
|
237
|
+
protected stopContainer(containerId: string): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Executes a command in the container.
|
|
240
|
+
*/
|
|
241
|
+
protected exec(command: string): Promise<CommandResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Creates the DockerSandbox interface with all methods.
|
|
244
|
+
*/
|
|
245
|
+
protected createSandboxMethods(): DockerSandbox;
|
|
246
|
+
/**
|
|
247
|
+
* Returns the Docker image to use for the container.
|
|
248
|
+
* For RuntimeStrategy: returns the image name directly.
|
|
249
|
+
* For DockerfileStrategy: builds the image and returns the tag.
|
|
250
|
+
*/
|
|
251
|
+
protected abstract getImage(): Promise<string>;
|
|
252
|
+
/**
|
|
253
|
+
* Configures the container after it starts.
|
|
254
|
+
* For RuntimeStrategy: installs packages and binaries.
|
|
255
|
+
* For DockerfileStrategy: no-op (Dockerfile already configured).
|
|
256
|
+
*/
|
|
257
|
+
protected abstract configure(): Promise<void>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Strategy that uses an existing Docker image and installs packages/binaries
|
|
261
|
+
* at container runtime.
|
|
262
|
+
*
|
|
263
|
+
* This is the "configure-on-demand" approach - starts a vanilla image and
|
|
264
|
+
* customizes it by executing installation commands.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* const strategy = new RuntimeStrategy(
|
|
269
|
+
* 'alpine:latest',
|
|
270
|
+
* ['curl', 'jq'],
|
|
271
|
+
* [{ name: 'presenterm', url: {...} }],
|
|
272
|
+
* );
|
|
273
|
+
* const sandbox = await strategy.create();
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
export declare class RuntimeStrategy extends DockerSandboxStrategy {
|
|
277
|
+
private image;
|
|
278
|
+
private packages;
|
|
279
|
+
private binaries;
|
|
280
|
+
constructor(image?: string, packages?: string[], binaries?: BinaryInstall[], mounts?: DockerMount[], resources?: DockerResources);
|
|
281
|
+
protected getImage(): Promise<string>;
|
|
282
|
+
protected configure(): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Installs packages using the appropriate package manager (apk/apt-get).
|
|
285
|
+
*/
|
|
286
|
+
private installPackages;
|
|
287
|
+
/**
|
|
288
|
+
* Installs binaries from URLs.
|
|
289
|
+
*/
|
|
290
|
+
private installBinaries;
|
|
291
|
+
/**
|
|
292
|
+
* Ensures curl is installed in the container.
|
|
293
|
+
*/
|
|
294
|
+
private ensureCurl;
|
|
295
|
+
/**
|
|
296
|
+
* Detects the container's CPU architecture.
|
|
297
|
+
*/
|
|
298
|
+
private detectArchitecture;
|
|
299
|
+
/**
|
|
300
|
+
* Installs a single binary from URL.
|
|
301
|
+
*/
|
|
302
|
+
private installBinary;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Strategy that builds a custom Docker image from a Dockerfile.
|
|
306
|
+
*
|
|
307
|
+
* This is the "build-once, run-many" approach - builds the image upfront
|
|
308
|
+
* (with caching) and runs containers from the pre-configured image.
|
|
309
|
+
*
|
|
310
|
+
* Image caching: Uses a deterministic tag based on Dockerfile content hash.
|
|
311
|
+
* If the same Dockerfile is used, the existing image is reused (cache hit).
|
|
312
|
+
*
|
|
313
|
+
* @example Inline Dockerfile
|
|
314
|
+
* ```typescript
|
|
315
|
+
* const strategy = new DockerfileStrategy(`
|
|
316
|
+
* FROM alpine:latest
|
|
317
|
+
* RUN apk add --no-cache curl jq
|
|
318
|
+
* `);
|
|
319
|
+
* const sandbox = await strategy.create();
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @example Dockerfile path
|
|
323
|
+
* ```typescript
|
|
324
|
+
* const strategy = new DockerfileStrategy(
|
|
325
|
+
* './Dockerfile.sandbox',
|
|
326
|
+
* './docker', // build context
|
|
327
|
+
* );
|
|
328
|
+
* const sandbox = await strategy.create();
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
export declare class DockerfileStrategy extends DockerSandboxStrategy {
|
|
332
|
+
private imageTag;
|
|
333
|
+
private dockerfile;
|
|
334
|
+
private dockerContext;
|
|
335
|
+
constructor(dockerfile: string, dockerContext?: string, mounts?: DockerMount[], resources?: DockerResources);
|
|
336
|
+
/**
|
|
337
|
+
* Computes a deterministic image tag based on Dockerfile content.
|
|
338
|
+
* Same Dockerfile → same tag → Docker skips rebuild if image exists.
|
|
339
|
+
*/
|
|
340
|
+
private computeImageTag;
|
|
341
|
+
/**
|
|
342
|
+
* Checks if the dockerfile property is inline content or a file path.
|
|
343
|
+
*/
|
|
344
|
+
private isInlineDockerfile;
|
|
345
|
+
protected getImage(): Promise<string>;
|
|
346
|
+
protected configure(): Promise<void>;
|
|
347
|
+
/**
|
|
348
|
+
* Checks if the image already exists locally.
|
|
349
|
+
*/
|
|
350
|
+
private imageExists;
|
|
351
|
+
/**
|
|
352
|
+
* Builds the Docker image from the Dockerfile.
|
|
353
|
+
*/
|
|
354
|
+
private buildImage;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Strategy that manages multi-container environments using Docker Compose.
|
|
358
|
+
*
|
|
359
|
+
* Unlike other strategies that manage a single container, ComposeStrategy
|
|
360
|
+
* orchestrates multiple services as a unit using docker compose commands.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* const strategy = new ComposeStrategy(
|
|
365
|
+
* './docker-compose.yml',
|
|
366
|
+
* 'app', // Service to execute commands in
|
|
367
|
+
* );
|
|
368
|
+
* const sandbox = await strategy.create();
|
|
369
|
+
*
|
|
370
|
+
* // Commands run in the 'app' service
|
|
371
|
+
* await sandbox.executeCommand('node --version');
|
|
372
|
+
*
|
|
373
|
+
* // Can communicate with other services via service names
|
|
374
|
+
* await sandbox.executeCommand('curl http://api:3000/health');
|
|
375
|
+
*
|
|
376
|
+
* // Stops ALL services
|
|
377
|
+
* await sandbox.dispose();
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
export declare class ComposeStrategy extends DockerSandboxStrategy {
|
|
381
|
+
private projectName;
|
|
382
|
+
private composeFile;
|
|
383
|
+
private service;
|
|
384
|
+
constructor(composeFile: string, service: string, resources?: DockerResources);
|
|
385
|
+
/**
|
|
386
|
+
* Deterministic project name based on compose file content for caching.
|
|
387
|
+
* Same compose file → same project name → faster subsequent startups.
|
|
388
|
+
*/
|
|
389
|
+
private computeProjectName;
|
|
390
|
+
/**
|
|
391
|
+
* Override: No image to get - compose manages its own images.
|
|
392
|
+
*/
|
|
393
|
+
protected getImage(): Promise<string>;
|
|
394
|
+
/**
|
|
395
|
+
* Override: Start all services with docker compose up.
|
|
396
|
+
*/
|
|
397
|
+
protected startContainer(_image: string): Promise<string>;
|
|
398
|
+
protected configure(): Promise<void>;
|
|
399
|
+
/**
|
|
400
|
+
* Override: Execute commands in the target service.
|
|
401
|
+
*/
|
|
402
|
+
protected exec(command: string): Promise<CommandResult>;
|
|
403
|
+
/**
|
|
404
|
+
* Override: Stop all services with docker compose down.
|
|
405
|
+
*/
|
|
406
|
+
protected stopContainer(_containerId: string): Promise<void>;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Creates a Docker-based sandbox for executing commands in an isolated container.
|
|
410
|
+
*
|
|
411
|
+
* Supports three strategies:
|
|
412
|
+
* - **RuntimeStrategy**: Uses existing image, installs packages/binaries at runtime
|
|
413
|
+
* - **DockerfileStrategy**: Builds custom image from Dockerfile (with caching)
|
|
414
|
+
* - **ComposeStrategy**: Multi-container environments via Docker Compose
|
|
415
|
+
*
|
|
416
|
+
* @example RuntimeStrategy (default)
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const sandbox = await createDockerSandbox({
|
|
419
|
+
* image: 'alpine:latest',
|
|
420
|
+
* packages: ['curl', 'jq'],
|
|
421
|
+
* binaries: [{ name: 'presenterm', url: {...} }],
|
|
422
|
+
* });
|
|
423
|
+
* await sandbox.executeCommand('curl --version');
|
|
424
|
+
* await sandbox.dispose();
|
|
425
|
+
* ```
|
|
426
|
+
*
|
|
427
|
+
* @example DockerfileStrategy
|
|
428
|
+
* ```typescript
|
|
429
|
+
* const sandbox = await createDockerSandbox({
|
|
430
|
+
* dockerfile: `
|
|
431
|
+
* FROM alpine:latest
|
|
432
|
+
* RUN apk add --no-cache curl jq
|
|
433
|
+
* `,
|
|
434
|
+
* context: '.',
|
|
435
|
+
* });
|
|
436
|
+
* await sandbox.executeCommand('curl --version');
|
|
437
|
+
* await sandbox.dispose();
|
|
438
|
+
* ```
|
|
439
|
+
*
|
|
440
|
+
* @example ComposeStrategy
|
|
441
|
+
* ```typescript
|
|
442
|
+
* const sandbox = await createDockerSandbox({
|
|
443
|
+
* compose: './docker-compose.yml',
|
|
444
|
+
* service: 'app',
|
|
445
|
+
* });
|
|
446
|
+
* // Commands run in the 'app' service
|
|
447
|
+
* await sandbox.executeCommand('node --version');
|
|
448
|
+
* // Can reach other services by name
|
|
449
|
+
* await sandbox.executeCommand('curl http://db:5432');
|
|
450
|
+
* await sandbox.dispose(); // Stops ALL services
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
export declare function createDockerSandbox(options?: DockerSandboxOptions): Promise<DockerSandbox>;
|
|
454
|
+
/**
|
|
455
|
+
* Execute a function with a Docker sandbox that auto-disposes on completion.
|
|
456
|
+
* Ensures cleanup even if the function throws.
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```typescript
|
|
460
|
+
* const output = await useSandbox(
|
|
461
|
+
* { packages: ['curl', 'jq'] },
|
|
462
|
+
* async (sandbox) => {
|
|
463
|
+
* const result = await sandbox.executeCommand('curl --version');
|
|
464
|
+
* return result.stdout;
|
|
465
|
+
* },
|
|
466
|
+
* );
|
|
467
|
+
* // Container is automatically disposed - no try/finally needed
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
export declare function useSandbox<T>(options: DockerSandboxOptions, fn: (sandbox: DockerSandbox) => Promise<T>): Promise<T>;
|
|
471
|
+
//# sourceMappingURL=docker-sandbox.d.ts.map
|
|
@@ -0,0 +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,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAM7D,YAAY,EAAE,aAAa,IAAI,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMtE;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;CAKlD;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;;CAK9D;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAM1D;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD,QAAQ,CAAC,QAAQ,EAA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],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ContextFragment } from '../fragments.ts';
|
|
2
|
+
import type { SkillsFragmentOptions } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Create a context fragment containing available skills metadata.
|
|
5
|
+
*
|
|
6
|
+
* Follows Anthropic's progressive disclosure pattern:
|
|
7
|
+
* - At startup: only skill metadata (name, description, path) is injected
|
|
8
|
+
* - At runtime: LLM reads full SKILL.md using file tools when relevant
|
|
9
|
+
*
|
|
10
|
+
* @param options - Configuration including paths to scan and optional filtering
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const context = new ContextEngine({ userId: 'demo-user', store, chatId: 'demo' })
|
|
15
|
+
* .set(
|
|
16
|
+
* role('You are a helpful assistant.'),
|
|
17
|
+
* skills({ paths: ['./skills'] }), // Injects skill metadata into system prompt
|
|
18
|
+
* );
|
|
19
|
+
*
|
|
20
|
+
* // LLM now sees skill metadata and can read full SKILL.md when needed
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function skills(options: SkillsFragmentOptions): ContextFragment;
|
|
24
|
+
//# sourceMappingURL=fragments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CA0CtE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills module for Anthropic-style progressive disclosure.
|
|
3
|
+
*
|
|
4
|
+
* Skills are modular packages that extend an agent's capabilities with
|
|
5
|
+
* specialized knowledge, workflows, and tools. They use progressive
|
|
6
|
+
* disclosure to minimize context window usage:
|
|
7
|
+
*
|
|
8
|
+
* 1. At startup: only skill metadata (name + description) is loaded
|
|
9
|
+
* 2. At runtime: LLM reads full SKILL.md using file tools when relevant
|
|
10
|
+
* 3. As needed: LLM navigates to references/, scripts/, assets/
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { skills } from '@deepagents/context';
|
|
15
|
+
*
|
|
16
|
+
* // Add skills metadata to context
|
|
17
|
+
* const context = new ContextEngine({ userId: 'demo-user', store, chatId: 'demo' })
|
|
18
|
+
* .set(
|
|
19
|
+
* role('You are a helpful assistant.'),
|
|
20
|
+
* skills({ paths: ['./skills', '~/.deepagents/skills'] }),
|
|
21
|
+
* );
|
|
22
|
+
*
|
|
23
|
+
* // LLM sees available skills and reads full content when needed
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
export * from './fragments.ts';
|
|
29
|
+
export * from './loader.ts';
|
|
30
|
+
export * from './types.ts';
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ParsedSkillMd, SkillMetadata } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parse YAML frontmatter from a SKILL.md file content.
|
|
4
|
+
*
|
|
5
|
+
* Frontmatter format:
|
|
6
|
+
* ```
|
|
7
|
+
* ---
|
|
8
|
+
* name: skill-name
|
|
9
|
+
* description: Skill description here
|
|
10
|
+
* ---
|
|
11
|
+
*
|
|
12
|
+
* # Markdown body
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseFrontmatter(content: string): ParsedSkillMd;
|
|
16
|
+
/**
|
|
17
|
+
* Load skill metadata from a SKILL.md file.
|
|
18
|
+
* Only parses frontmatter, does not load full body into memory.
|
|
19
|
+
* This is the core of progressive disclosure - metadata only at startup.
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadSkillMetadata(skillMdPath: string): SkillMetadata;
|
|
22
|
+
/**
|
|
23
|
+
* Discover all skills in a directory.
|
|
24
|
+
* Looks for subdirectories containing SKILL.md files.
|
|
25
|
+
* Only loads metadata - full content is read by LLM when needed.
|
|
26
|
+
*/
|
|
27
|
+
export declare function discoverSkillsInDirectory(directory: string): SkillMetadata[];
|
|
28
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAyB/D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAWpE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE,CA6B5E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill metadata parsed from SKILL.md frontmatter.
|
|
3
|
+
* This is what gets loaded into context at startup.
|
|
4
|
+
* Full skill content is read by LLM when needed (progressive disclosure).
|
|
5
|
+
*/
|
|
6
|
+
export interface SkillMetadata {
|
|
7
|
+
/** Skill name from frontmatter */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Skill description from frontmatter */
|
|
10
|
+
description: string;
|
|
11
|
+
/** Full path to the skill directory */
|
|
12
|
+
path: string;
|
|
13
|
+
/** Full path to the SKILL.md file */
|
|
14
|
+
skillMdPath: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Options for the skills() fragment helper.
|
|
18
|
+
*/
|
|
19
|
+
export interface SkillsFragmentOptions {
|
|
20
|
+
/** Directories to scan for skills (required) */
|
|
21
|
+
paths: string[];
|
|
22
|
+
/** Skill names to exclude from the fragment */
|
|
23
|
+
exclude?: string[];
|
|
24
|
+
/** Skill names to include (if set, only these are included) */
|
|
25
|
+
include?: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Result of parsing a SKILL.md file.
|
|
29
|
+
*/
|
|
30
|
+
export interface ParsedSkillMd {
|
|
31
|
+
/** Parsed frontmatter */
|
|
32
|
+
frontmatter: {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
/** Markdown body after frontmatter */
|
|
38
|
+
body: string;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BranchData, BranchInfo, ChatData, ChatInfo, CheckpointData, CheckpointInfo, GraphData, MessageData, SearchOptions, SearchResult, StoredChatData } from './store.ts';
|
|
1
|
+
import type { BranchData, BranchInfo, ChatData, ChatInfo, CheckpointData, CheckpointInfo, DeleteChatOptions, GraphData, ListChatsOptions, MessageData, SearchOptions, SearchResult, StoredChatData } from './store.ts';
|
|
2
2
|
import { ContextStore } from './store.ts';
|
|
3
3
|
/**
|
|
4
4
|
* SQLite-based context store using graph model.
|
|
@@ -13,11 +13,13 @@ export declare class SqliteContextStore extends ContextStore {
|
|
|
13
13
|
upsertChat(chat: ChatData): Promise<StoredChatData>;
|
|
14
14
|
getChat(chatId: string): Promise<StoredChatData | undefined>;
|
|
15
15
|
updateChat(chatId: string, updates: Partial<Pick<ChatData, 'title' | 'metadata'>>): Promise<StoredChatData>;
|
|
16
|
-
listChats(): Promise<ChatInfo[]>;
|
|
16
|
+
listChats(options?: ListChatsOptions): Promise<ChatInfo[]>;
|
|
17
|
+
deleteChat(chatId: string, options?: DeleteChatOptions): Promise<boolean>;
|
|
17
18
|
addMessage(message: MessageData): Promise<void>;
|
|
18
19
|
getMessage(messageId: string): Promise<MessageData | undefined>;
|
|
19
20
|
getMessageChain(headId: string): Promise<MessageData[]>;
|
|
20
21
|
hasChildren(messageId: string): Promise<boolean>;
|
|
22
|
+
getMessages(chatId: string): Promise<MessageData[]>;
|
|
21
23
|
createBranch(branch: BranchData): Promise<void>;
|
|
22
24
|
getBranch(chatId: string, name: string): Promise<BranchData | undefined>;
|
|
23
25
|
getActiveBranch(chatId: string): Promise<BranchData | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.store.d.ts","sourceRoot":"","sources":["../../../src/lib/store/sqlite.store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,
|
|
1
|
+
{"version":3,"file":"sqlite.store.d.ts","sourceRoot":"","sources":["../../../src/lib/store/sqlite.store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,EACd,iBAAiB,EAGjB,SAAS,EAET,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA0E1C;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;;gBAGtC,IAAI,EAAE,MAAM;IA2BlB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBzC,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;IA2CnD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IA4B5D,UAAU,CACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,GACrD,OAAO,CAAC,cAAc,CAAC;IAqCpB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IA2D1D,UAAU,CACd,MAAM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