@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
package/dist/lib/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/lib/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,MAAM,EACN,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACT,KA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E,OAAO,CAAC,CAAC,CACpE,CAAC;CACH;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,cAAc,EAC7D,OAAO,EAAE,uBAAuB,CAAC,OAAO,CAAC,GACxC,sBAAsB,CAAC,OAAO,CAAC,CAoFjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-summary.d.ts","sourceRoot":"","sources":["../../src/lib/chain-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chain-summary.d.ts","sourceRoot":"","sources":["../../src/lib/chain-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC;IACpC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,qBAAa,mBAAmB;;IAS9B,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;IAyCpC,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAQ9C,KAAK,IAAI,YAAY;CAWtB"}
|
package/dist/lib/engine.d.ts
CHANGED
|
@@ -254,9 +254,9 @@ export declare class ContextEngine {
|
|
|
254
254
|
* Evaluate `target: 'tool-output'` reminders against a tool's raw result and
|
|
255
255
|
* return the (possibly wrapped) output.
|
|
256
256
|
*
|
|
257
|
-
* Called by the agent's tool wrapper right after each `execute()` resolves
|
|
258
|
-
*
|
|
259
|
-
*
|
|
257
|
+
* Called by the agent's tool wrapper right after each `execute()` resolves.
|
|
258
|
+
* The store keeps the wrapped value with a host-only marker; the model-facing
|
|
259
|
+
* projection strips that marker while preserving `result` + `systemReminder`.
|
|
260
260
|
*
|
|
261
261
|
* Returns the output unchanged when no tool-output reminder fires. Without a
|
|
262
262
|
* persisted user message there is no turn context to evaluate against
|
package/dist/lib/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/lib/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACT,KAAK,SAAS,EAIf,MAAM,IAAI,CAAC;AAGZ,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,eAAe,EAKrB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/lib/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACT,KAAK,SAAS,EAIf,MAAM,IAAI,CAAC;AAGZ,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,eAAe,EAKrB,MAAM,gBAAgB,CAAC;AAYxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,M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AU,CAAC;IAcvD;;;;;;;;;;;;;;OAcG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACU,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;IAUvC;;;;;;;;;;;;OAYG;IACU,UAAU,CACrB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,GAC3D,OAAO,CAAC,IAAI,CAAC;IAmBhB;;;;;;;;;;;;OAYG;IACU,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBjE;;;;;;;OAOG;IACI,WAAW,IAAI,IAAI;IAI1B;;;;;;;;OAQG;IACI,IAAI,IAAI,aAAa;IAU5B;;;;;;;;;;;;;;;OAeG;IACI,cAAc;;;IAcrB;;;;;;;;;;;;;;;;;;OAkBG;IACU,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA0CtE"}
|
|
@@ -59,18 +59,13 @@ export interface SyntheticSteerMetadata {
|
|
|
59
59
|
firedAt: number;
|
|
60
60
|
onceIds?: string[];
|
|
61
61
|
}
|
|
62
|
-
export interface
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
target: 'user';
|
|
70
|
-
metadata?: Record<string, unknown>;
|
|
71
|
-
}
|
|
72
|
-
export interface ConditionalReminderOptions {
|
|
73
|
-
when: WhenPredicate;
|
|
62
|
+
export interface ReminderOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Predicate gating when the reminder fires. Optional for `target: 'user'`
|
|
65
|
+
* (omit ⇒ always fires; pair with `once(id)` for one-time); required for
|
|
66
|
+
* `steer` / `tool-output`, where a trigger-less reminder is meaningless.
|
|
67
|
+
*/
|
|
68
|
+
when?: WhenPredicate;
|
|
74
69
|
asPart?: boolean;
|
|
75
70
|
target?: ReminderTarget;
|
|
76
71
|
}
|
|
@@ -100,6 +95,12 @@ export type ReminderRange = {
|
|
|
100
95
|
end: number;
|
|
101
96
|
};
|
|
102
97
|
export declare function getReminderRanges(metadata: Record<string, unknown> | undefined): ReminderRange[];
|
|
98
|
+
/**
|
|
99
|
+
* Once-ids latched by `once()`-gated reminders folded into this user message.
|
|
100
|
+
* Persisted so a fresh engine re-reads them (the durable suppression record for
|
|
101
|
+
* user-target `once()`, mirroring synthetic steer messages).
|
|
102
|
+
*/
|
|
103
|
+
export declare function getReminderOnceIds(message: UIMessage): string[];
|
|
103
104
|
export declare function stripTextByRanges(text: string, ranges: Array<{
|
|
104
105
|
start: number;
|
|
105
106
|
end: number;
|
|
@@ -115,9 +116,6 @@ export declare function stripReminders(message: UIMessage): UIMessage;
|
|
|
115
116
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
116
117
|
export declare function applyInlineReminder(message: UIMessage, value: string): UserReminderMetadata;
|
|
117
118
|
export declare function applyPartReminder(message: UIMessage, value: string): UserReminderMetadata;
|
|
118
|
-
export declare function resolveReminderText(item: {
|
|
119
|
-
text: SyncReminderText;
|
|
120
|
-
}, ctx: ReminderContext): string;
|
|
121
119
|
export declare function resolveReminder(item: {
|
|
122
120
|
text: SyncReminderText;
|
|
123
121
|
metadata?: Record<string, unknown>;
|
|
@@ -142,96 +140,57 @@ export declare function applyReminderToMessage(message: UIMessage, item: {
|
|
|
142
140
|
* metadata bookkeeping.
|
|
143
141
|
*/
|
|
144
142
|
export declare function applyRemindersToToolOutput(output: unknown, texts: string[]): unknown;
|
|
145
|
-
export declare function mergeReminderMetadata(message: UIMessage, addedReminders: UserReminderMetadata[]): void;
|
|
146
|
-
/**
|
|
147
|
-
* Create an immediate reminder for use inside `user()`.
|
|
148
|
-
*
|
|
149
|
-
* Injects reminder text inline as `<system-reminder>...</system-reminder>`.
|
|
150
|
-
*
|
|
151
|
-
* @param text - Reminder text (must not be empty)
|
|
152
|
-
* @param options - Reminder representation options
|
|
153
|
-
*/
|
|
154
|
-
export declare function reminder(text: SyncReminderText, options?: UserReminderOptions): UserReminder;
|
|
155
143
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* @param text - Reminder text (must not be empty). Can be async.
|
|
162
|
-
* @param options - Must include a `when` predicate
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```ts
|
|
166
|
-
* engine.set(
|
|
167
|
-
* reminder('Keep responses concise', { when: everyNTurns(3) }),
|
|
168
|
-
* user('Hello'),
|
|
169
|
-
* );
|
|
170
|
-
* ```
|
|
144
|
+
* Project a tool-output reminder envelope to its model-facing form: run the
|
|
145
|
+
* wrapped tool's own projection over the inner `result` (so a tool's host-only
|
|
146
|
+
* `meta` channel is still stripped), then re-attach the `systemReminder`. The
|
|
147
|
+
* envelope's own host-only `meta` marker is dropped. Returns null for anything
|
|
148
|
+
* that is not one of our envelopes, so the caller can project the raw output.
|
|
171
149
|
*/
|
|
172
|
-
export declare function
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
* Defaults to inline reminder text.
|
|
178
|
-
*
|
|
179
|
-
* @param fragment - A context fragment to render as reminder text
|
|
180
|
-
* @param options - Reminder representation options
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* context.set(
|
|
185
|
-
* user('hello', reminder(workflow({ task: 'Error recovery', steps: ['Check logs'] }))),
|
|
186
|
-
* );
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
export declare function reminder(fragment: ContextFragment, options?: UserReminderOptions): UserReminder;
|
|
150
|
+
export declare function toToolReminderModelOutput(output: unknown, projectResult: (result: unknown) => unknown): {
|
|
151
|
+
type: 'json';
|
|
152
|
+
value: unknown;
|
|
153
|
+
} | null;
|
|
154
|
+
export declare function mergeReminderMetadata(message: UIMessage, addedReminders: UserReminderMetadata[]): void;
|
|
190
155
|
/**
|
|
191
|
-
* Create a
|
|
156
|
+
* Create a reminder fragment, set on the engine via `engine.set()`. The engine
|
|
157
|
+
* folds it into the model's view when its `when` fires: `user` reminders bake a
|
|
158
|
+
* `<system-reminder>` into the last user message at save; `steer` injects mid-
|
|
159
|
+
* loop; `tool-output` wraps the tool result. Text may be a string, a `(ctx) =>
|
|
160
|
+
* string` factory (self-gates by returning `''`), or a context fragment.
|
|
192
161
|
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* @param fragment - A context fragment to render as reminder text
|
|
197
|
-
* @param options - Must include a `when` predicate
|
|
162
|
+
* For `target: 'user'`, `when` is optional — omit it for an always-on
|
|
163
|
+
* instruction, or pass `once(id)` for a one-time reminder. `steer` and
|
|
164
|
+
* `tool-output` require a `when` trigger.
|
|
198
165
|
*
|
|
199
166
|
* @example
|
|
200
167
|
* ```ts
|
|
201
|
-
* engine.set(
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* { when: contentIncludes(['error', 'fail']) },
|
|
205
|
-
* ),
|
|
206
|
-
* user('my query failed'),
|
|
207
|
-
* );
|
|
168
|
+
* engine.set(reminder('Keep responses concise')); // user, always
|
|
169
|
+
* engine.set(reminder('Welcome!', { when: once('welcome') })); // user, one-time
|
|
170
|
+
* engine.set(reminder('RECAP', { when: everyNTurns(3), target: 'steer' }));
|
|
208
171
|
* ```
|
|
209
172
|
*/
|
|
210
|
-
export declare function reminder(
|
|
173
|
+
export declare function reminder(textOrFragment: ReminderText | ContextFragment, options?: ReminderOptions): ContextFragment;
|
|
211
174
|
/**
|
|
212
|
-
* Create a user message fragment.
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* `<system-reminder>...</system-reminder>` tags.
|
|
217
|
-
*
|
|
218
|
-
* For conditional reminders that fire based on turn count, use
|
|
219
|
-
* `reminder(text, { when })` directly with `engine.set()` instead.
|
|
220
|
-
*
|
|
221
|
-
* @param content - The message content
|
|
222
|
-
* @param reminders - Optional hidden/system reminders
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
* ```ts
|
|
226
|
-
* context.set(user('Hello')); // Plain user message
|
|
227
|
-
* context.set(
|
|
228
|
-
* user('Deploy this', reminder('Ask for confirmation before destructive actions')),
|
|
229
|
-
* );
|
|
230
|
-
* ```
|
|
175
|
+
* Create a user message fragment. Message fragments are separated from regular
|
|
176
|
+
* fragments during resolve(). Reminders are NOT attached here — declare them
|
|
177
|
+
* with `reminder(..., { target: 'user' })` and `engine.set()`; the engine folds
|
|
178
|
+
* them into the last user message at save time.
|
|
231
179
|
*/
|
|
232
180
|
export declare function user(content: string | (UIMessage & {
|
|
233
181
|
role: 'user';
|
|
234
|
-
})
|
|
182
|
+
})): MessageFragment;
|
|
183
|
+
/**
|
|
184
|
+
* Bake resolved user reminders into a message in place: append each as a
|
|
185
|
+
* `<system-reminder>` (inline or as its own part) and record the ranges in
|
|
186
|
+
* `metadata.reminders` so `stripReminders` can reverse it. The save fold is the
|
|
187
|
+
* only caller — user reminders are declared on the engine, not on `user()`.
|
|
188
|
+
*/
|
|
189
|
+
export declare function applyUserRemindersToMessage(message: UIMessage, reminders: Array<{
|
|
190
|
+
text: SyncReminderText;
|
|
191
|
+
asPart: boolean;
|
|
192
|
+
metadata?: Record<string, unknown>;
|
|
193
|
+
}>): void;
|
|
235
194
|
/**
|
|
236
195
|
* Build the hidden synthetic user message injected mid-loop for steer reminders.
|
|
237
196
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/lib/fragments/message/user.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,SAAS,EAGf,MAAM,IAAI,CAAC;AAEZ,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EAErB,MAAM,oBAAoB,CAAC;AA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,CAAC,CAAC,CAAC,CAOZ"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ContainerSandboxError } from './container-sandbox-errors.ts';
|
|
2
|
+
export declare class AppleContainerSandboxError extends ContainerSandboxError {
|
|
3
|
+
constructor(message: string, containerId?: string);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Raised when the `container` apiserver is not running. Unlike Docker's
|
|
7
|
+
* always-on daemon, Apple's service is started on demand with
|
|
8
|
+
* `container system start` (and needs a guest kernel configured via
|
|
9
|
+
* `container system kernel set --recommended`).
|
|
10
|
+
*/
|
|
11
|
+
export declare class ContainerServiceNotRunningError extends AppleContainerSandboxError {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
export declare class AppleContainerCreationError extends AppleContainerSandboxError {
|
|
15
|
+
readonly image: string;
|
|
16
|
+
cause?: Error;
|
|
17
|
+
constructor(message: string, image: string, cause?: Error);
|
|
18
|
+
}
|
|
19
|
+
export declare class AppleContainerImageBuildError extends AppleContainerSandboxError {
|
|
20
|
+
readonly stderr: string;
|
|
21
|
+
constructor(stderr: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class AppleContainerVolumePathError extends AppleContainerSandboxError {
|
|
24
|
+
readonly source: string;
|
|
25
|
+
readonly containerPath: string;
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
constructor(source: string, containerPath: string, reason: string);
|
|
28
|
+
}
|
|
29
|
+
export declare class AppleContainerVolumeInspectError extends AppleContainerSandboxError {
|
|
30
|
+
readonly volume: string;
|
|
31
|
+
readonly reason: string;
|
|
32
|
+
constructor(volume: string, reason: string);
|
|
33
|
+
}
|
|
34
|
+
export declare class AppleContainerVolumeCreateError extends AppleContainerSandboxError {
|
|
35
|
+
readonly volume: string;
|
|
36
|
+
readonly reason: string;
|
|
37
|
+
constructor(volume: string, reason: string);
|
|
38
|
+
}
|
|
39
|
+
export declare class AppleContainerVolumeRemoveError extends AppleContainerSandboxError {
|
|
40
|
+
readonly volume: string;
|
|
41
|
+
readonly reason: string;
|
|
42
|
+
constructor(volume: string, reason: string);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=apple-container-sandbox-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-container-sandbox-errors.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/apple-container-sandbox-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,qBAAa,0BAA2B,SAAQ,qBAAqB;gBACvD,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;CAIlD;AAED;;;;;GAKG;AACH,qBAAa,+BAAgC,SAAQ,0BAA0B;;CAQ9E;AAED,qBAAa,2BAA4B,SAAQ,0BAA0B;IACzE,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,qBAAa,6BAA8B,SAAQ,0BAA0B;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;CAK3B;AAED,qBAAa,6BAA8B,SAAQ,0BAA0B;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CASlE;AAED,qBAAa,gCAAiC,SAAQ,0BAA0B;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAM3C;AAED,qBAAa,+BAAgC,SAAQ,0BAA0B;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAM3C;AAED,qBAAa,+BAAgC,SAAQ,0BAA0B;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAM3C"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type Installer } from './installers/installer.ts';
|
|
2
|
+
import type { DisposableSandbox } from './types.ts';
|
|
3
|
+
export { AppleContainerCreationError, AppleContainerImageBuildError, AppleContainerSandboxError, AppleContainerVolumeCreateError, AppleContainerVolumeInspectError, AppleContainerVolumePathError, AppleContainerVolumeRemoveError, ContainerServiceNotRunningError, } from './apple-container-sandbox-errors.ts';
|
|
4
|
+
export interface AppleContainerBindVolume {
|
|
5
|
+
type: 'bind';
|
|
6
|
+
hostPath: string;
|
|
7
|
+
containerPath: string;
|
|
8
|
+
/** Default: `true`. */
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface AppleContainerNamedVolume {
|
|
12
|
+
type: 'volume';
|
|
13
|
+
name: string;
|
|
14
|
+
containerPath: string;
|
|
15
|
+
/** Default: `true`. */
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
/** Default: `'external'`. */
|
|
18
|
+
lifecycle?: 'external' | 'managed';
|
|
19
|
+
/** Default: `true` for managed volumes created by this sandbox. */
|
|
20
|
+
removeOnDispose?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Apple `container` volumes are always local ext4 disk images — there is no
|
|
24
|
+
* pluggable driver model (unlike Docker's `--driver`). Back a volume with
|
|
25
|
+
* remote storage by bind-mounting a host directory instead.
|
|
26
|
+
*/
|
|
27
|
+
export type AppleContainerVolume = AppleContainerBindVolume | AppleContainerNamedVolume;
|
|
28
|
+
export interface AppleContainerResources {
|
|
29
|
+
/** `--memory` — e.g. `'1024M'`, `'2G'` (MB granularity). */
|
|
30
|
+
memory?: string;
|
|
31
|
+
/** `--cpus` — number of CPUs. */
|
|
32
|
+
cpus?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Stable identity suffix for the container. When provided, the container is
|
|
36
|
+
* named `sandbox-<name>` instead of a randomized `sandbox-<8hex>`. If a
|
|
37
|
+
* container with that name already exists, the sandbox attaches to it:
|
|
38
|
+
* installers, volume preparation, and env are skipped. If it exists but is
|
|
39
|
+
* stopped, it is started first. Otherwise it is created fresh.
|
|
40
|
+
*
|
|
41
|
+
* This is get-or-create for SEQUENTIAL callers. Creating the same name from
|
|
42
|
+
* two callers concurrently is not supported — the `container` runtime races on
|
|
43
|
+
* duplicate-name `run` (it can leave a container mid-transition and fail with
|
|
44
|
+
* an internal error); serialize creation of a given name.
|
|
45
|
+
*
|
|
46
|
+
* Must match `/^[A-Za-z0-9_.-]+$/`.
|
|
47
|
+
*/
|
|
48
|
+
type StableContainerName = string;
|
|
49
|
+
export interface AppleContainerCommonOptions {
|
|
50
|
+
volumes?: AppleContainerVolume[];
|
|
51
|
+
resources?: AppleContainerResources;
|
|
52
|
+
env?: Record<string, string>;
|
|
53
|
+
name?: StableContainerName;
|
|
54
|
+
/**
|
|
55
|
+
* Args appended after the image at `container run` time.
|
|
56
|
+
* - `undefined` (default): `['tail', '-f', '/dev/null']` keep-alive so a bare
|
|
57
|
+
* image stays up for installers and `executeCommand`.
|
|
58
|
+
* - `[]` or `null`: nothing appended; the image's own `CMD`/`ENTRYPOINT` runs.
|
|
59
|
+
* - A non-empty array: appended verbatim, overriding the image command.
|
|
60
|
+
*/
|
|
61
|
+
command?: readonly string[] | null;
|
|
62
|
+
/**
|
|
63
|
+
* `-a, --arch` — `'arm64'` (native on Apple silicon) or `'amd64'` (emulated
|
|
64
|
+
* via Rosetta). Replaces the Docker backend's `--platform`.
|
|
65
|
+
*/
|
|
66
|
+
arch?: 'arm64' | 'amd64';
|
|
67
|
+
}
|
|
68
|
+
export interface AppleContainerRuntimeOptions extends AppleContainerCommonOptions {
|
|
69
|
+
/** Image to run (default: `'docker.io/library/alpine:latest'`). */
|
|
70
|
+
image?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Ordered installers run after the container starts. Use `pkg([...])`,
|
|
73
|
+
* `urlBinary({...})`, `npm(...)`, `pip(...)`, `githubRelease({...})`, or any
|
|
74
|
+
* custom `Installer` — the same installers the Docker backend accepts.
|
|
75
|
+
*/
|
|
76
|
+
installers?: Installer[];
|
|
77
|
+
}
|
|
78
|
+
export interface AppleContainerfileOptions extends AppleContainerCommonOptions {
|
|
79
|
+
/** Inline Dockerfile content (contains `\n`) or a path to one. */
|
|
80
|
+
dockerfile: string;
|
|
81
|
+
/** Build context directory (default: `'.'`). */
|
|
82
|
+
context?: string;
|
|
83
|
+
/** Stream `container build` output instead of buffering it. Default `false`. */
|
|
84
|
+
showBuildLogs?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export type AppleContainerSandboxOptions = AppleContainerRuntimeOptions | AppleContainerfileOptions;
|
|
87
|
+
export declare function isAppleContainerfileOptions(opts: AppleContainerSandboxOptions): opts is AppleContainerfileOptions;
|
|
88
|
+
/**
|
|
89
|
+
* Create a sandbox backed by Apple's `container` CLI — Linux containers run as
|
|
90
|
+
* lightweight per-container virtual machines on Apple silicon (macOS 26+).
|
|
91
|
+
*
|
|
92
|
+
* Requires the `container` service to be running (`container system start`)
|
|
93
|
+
* with a guest kernel configured (`container system kernel set --recommended`).
|
|
94
|
+
*
|
|
95
|
+
* @example Runtime with installers
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { createAppleContainerSandbox, pkg } from '@deepagents/context';
|
|
98
|
+
*
|
|
99
|
+
* await using sandbox = await createAppleContainerSandbox({
|
|
100
|
+
* image: 'docker.io/library/alpine:latest',
|
|
101
|
+
* installers: [pkg(['curl', 'jq'])],
|
|
102
|
+
* });
|
|
103
|
+
* const { stdout } = await sandbox.executeCommand('echo hello');
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @example Dockerfile
|
|
107
|
+
* ```ts
|
|
108
|
+
* await using sandbox = await createAppleContainerSandbox({
|
|
109
|
+
* dockerfile: `
|
|
110
|
+
* FROM docker.io/library/alpine:latest
|
|
111
|
+
* RUN apk add --no-cache curl
|
|
112
|
+
* `,
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function createAppleContainerSandbox(options?: AppleContainerSandboxOptions): Promise<DisposableSandbox>;
|
|
117
|
+
/**
|
|
118
|
+
* Run a function with an Apple container sandbox; the container is disposed on
|
|
119
|
+
* completion (success or thrown).
|
|
120
|
+
*/
|
|
121
|
+
export declare function useAppleContainerSandbox<T>(options: AppleContainerSandboxOptions, fn: (sandbox: DisposableSandbox) => Promise<T>): Promise<T>;
|
|
122
|
+
//# sourceMappingURL=apple-container-sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-container-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/apple-container-sandbox.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,qCAAqC,CAAC;AAO7C,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,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C;IACjB,gFAAgF;IAChF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,MAAM,4BAA4B,GACpC,4BAA4B,GAC5B,yBAAyB,CAAC;AAE9B,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,4BAA4B,GACjC,IAAI,IAAI,yBAAyB,CAEnC;AA6WD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,iBAAiB,CAAC,CAa5B;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,OAAO,EAAE,4BAA4B,EACrC,EAAE,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,CAAC,CAAC,CAOZ"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type CreateBashToolOptions } from 'bash-tool';
|
|
2
|
-
import { type FileChange } from './file-changes.ts';
|
|
3
2
|
import type { AgentSandbox, DisposableSandbox, SkillUploadInput } from './types.ts';
|
|
4
3
|
export interface CreateBashToolWithSkillsOptions extends Omit<CreateBashToolOptions, 'sandbox'> {
|
|
5
4
|
/**
|
|
@@ -16,39 +15,21 @@ export interface CreateBashToolWithSkillsOptions extends Omit<CreateBashToolOpti
|
|
|
16
15
|
*/
|
|
17
16
|
skills?: SkillUploadInput[];
|
|
18
17
|
/**
|
|
19
|
-
* Working directory
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Working directory passed to upstream `bash-tool`. Defaults to `/workspace`.
|
|
19
|
+
* File-change tracking is no longer wired here — compose
|
|
20
|
+
* `withStraceFileChanges(backend, { destination, onFileChanges })` on the
|
|
21
|
+
* backend yourself and pass the result as `sandbox`.
|
|
22
22
|
*/
|
|
23
23
|
destination?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Called once per tool-call command (and per `spawn`) with that call's
|
|
26
|
-
* `FileChange[]` — the reactive post-tool effect.
|
|
27
|
-
*
|
|
28
|
-
* File-change tracking is **always on** via `strace`: a self-test runs at
|
|
29
|
-
* startup and throws `StraceUnavailableError` if `strace` is missing, ptrace
|
|
30
|
-
* is blocked, or the trace is unparseable (e.g. emulated arch). The backend
|
|
31
|
-
* must therefore be strace-capable — the in-process virtual sandbox is not.
|
|
32
|
-
*
|
|
33
|
-
* Throwing acts as a gate. On a tool-call command the throw fails the bash
|
|
34
|
-
* tool call: throw a `BashException` to control the exact failed `CommandResult`
|
|
35
|
-
* the model sees (rendered by `withBashExceptionCatch` via its `format()`); any
|
|
36
|
-
* other error fails the call generically. On `spawn` there is no tool result to
|
|
37
|
-
* fail, so the throw is isolated and surfaced via `onError`. The underlying
|
|
38
|
-
* command still ran in both cases.
|
|
39
|
-
*/
|
|
40
|
-
onFileChanges?: (changes: FileChange[]) => void | Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Called when `onFileChanges` throws on the `spawn` path — its only failure
|
|
43
|
-
* signal. Tool-call throws fail the command instead and never reach here.
|
|
44
|
-
* Defaults to `console.warn`.
|
|
45
|
-
*/
|
|
46
|
-
onError?: (error: unknown) => void;
|
|
47
24
|
}
|
|
48
25
|
/**
|
|
49
26
|
* Composes an `AgentSandbox` from a backend by layering decorators:
|
|
50
27
|
*
|
|
51
|
-
* backend →
|
|
28
|
+
* backend → withBashExceptionCatch → withAbortSignal
|
|
29
|
+
*
|
|
30
|
+
* File-change tracking is not composed here — a caller that wants it wraps the
|
|
31
|
+
* backend with `withStraceFileChanges` first, so the tracer sits innermost
|
|
32
|
+
* (backend → withStraceFileChanges → withBashExceptionCatch → withAbortSignal).
|
|
52
33
|
*
|
|
53
34
|
* The composed sandbox is handed to upstream `bash-tool`; upstream's
|
|
54
35
|
* internal `bash` / `readFile` / `writeFile` tools therefore close over
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-tool.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/bash-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,WAAW,CAAC;AAMnB,OAAO,
|
|
1
|
+
{"version":3,"file":"bash-tool.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/bash-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AA+BpB,MAAM,WAAW,+BAAgC,SAAQ,IAAI,CAC3D,qBAAqB,EACrB,SAAS,CACV;IACC;;;;;OAKG;IACH,OAAO,EAAE,iBAAiB,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,YAAY,CAAC,CAwHvB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ChildProcess } from 'node:child_process';
|
|
2
|
+
import type { SandboxProcess } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Bridge a Node `child_process` — a `docker exec` / `container exec` child —
|
|
5
|
+
* into the backend-neutral {@link SandboxProcess} shape: web `ReadableStream`
|
|
6
|
+
* stdio plus an `exit` promise that resolves with the child's exit code.
|
|
7
|
+
*
|
|
8
|
+
* Aborting `abortSignal` sends `SIGKILL`. Both the `docker` and Apple
|
|
9
|
+
* `container` CLIs trap `SIGTERM` in their client wrapper and exit cleanly with
|
|
10
|
+
* code 0, so `SIGTERM` would look like a successful run; only `SIGKILL`
|
|
11
|
+
* reliably tears the child down and surfaces as a non-success exit.
|
|
12
|
+
*/
|
|
13
|
+
export declare function toSandboxProcess(child: ChildProcess, abortSignal: AbortSignal | undefined): SandboxProcess;
|
|
14
|
+
/**
|
|
15
|
+
* Build the shell commands that decode `content` into `path`, for sandbox
|
|
16
|
+
* backends whose only channel is `executeCommand` (no native file copy). The
|
|
17
|
+
* payload is split into independently-decodable base64 chunks so large files
|
|
18
|
+
* don't blow ARG_MAX, and every argument is shell-quoted. Always returns at
|
|
19
|
+
* least one command (an empty file is created by the final fallback).
|
|
20
|
+
*/
|
|
21
|
+
export declare function base64WriteCommands(path: string, content: string | Buffer): string[];
|
|
22
|
+
/** Build the command that base64-encodes `path` for reading back to the host. */
|
|
23
|
+
export declare function base64ReadCommand(path: string): string;
|
|
24
|
+
//# sourceMappingURL=cli-process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-process.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/cli-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,WAAW,GAAG,SAAS,GACnC,cAAc,CAoChB;AASD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,MAAM,GACvB,MAAM,EAAE,CAeV;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|