@deepagents/context 6.1.0 → 7.0.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 +29 -3
- package/dist/browser.js +9 -2
- package/dist/browser.js.map +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1411 -514
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.d.ts +78 -37
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/chat.d.ts +17 -18
- package/dist/lib/chat.d.ts.map +1 -1
- package/dist/lib/engine.d.ts.map +1 -1
- package/dist/lib/fragments/plan-shared.d.ts +46 -0
- package/dist/lib/fragments/plan-shared.d.ts.map +1 -0
- package/dist/lib/fragments/plan.d.ts.map +1 -1
- package/dist/lib/fragments/socratic-inquiry.d.ts +4 -0
- package/dist/lib/fragments/socratic-inquiry.d.ts.map +1 -0
- package/dist/lib/fragments/socratic-plan.d.ts +13 -0
- package/dist/lib/fragments/socratic-plan.d.ts.map +1 -0
- package/dist/lib/fragments/socratic.d.ts +2 -5
- package/dist/lib/fragments/socratic.d.ts.map +1 -1
- package/dist/lib/sandbox/agent-os-sandbox.d.ts +1 -1
- package/dist/lib/sandbox/agent-os-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/apple-container-sandbox.d.ts +3 -3
- package/dist/lib/sandbox/apple-container-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/bash-tool.d.ts +1 -1
- package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
- package/dist/lib/sandbox/cli-process.d.ts +6 -0
- package/dist/lib/sandbox/cli-process.d.ts.map +1 -1
- package/dist/lib/sandbox/container-engine.d.ts +1 -0
- package/dist/lib/sandbox/container-engine.d.ts.map +1 -1
- package/dist/lib/sandbox/container-sandbox.d.ts +1 -0
- package/dist/lib/sandbox/container-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/daytona-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/docker-sandbox.d.ts +10 -3
- package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/index.d.ts +1 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -1
- package/dist/lib/sandbox/microsandbox-sandbox.d.ts +13 -17
- package/dist/lib/sandbox/microsandbox-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/read-file-tool/binary.d.ts +13 -0
- package/dist/lib/sandbox/read-file-tool/binary.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/format.d.ts +17 -0
- package/dist/lib/sandbox/read-file-tool/format.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/image.d.ts +4 -0
- package/dist/lib/sandbox/read-file-tool/image.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/index.d.ts +6 -0
- package/dist/lib/sandbox/read-file-tool/index.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/ooxml.d.ts +4 -0
- package/dist/lib/sandbox/read-file-tool/ooxml.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/pdf.d.ts +4 -0
- package/dist/lib/sandbox/read-file-tool/pdf.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/text.d.ts +10 -0
- package/dist/lib/sandbox/read-file-tool/text.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file.d.ts +8 -0
- package/dist/lib/sandbox/read-file.d.ts.map +1 -0
- package/dist/lib/sandbox/shell-quote.d.ts +1 -1
- package/dist/lib/sandbox/strace/index.d.ts +3 -3
- package/dist/lib/sandbox/strace/index.d.ts.map +1 -1
- package/dist/lib/sandbox/strace/index.js +2 -2
- package/dist/lib/sandbox/strace/index.js.map +2 -2
- package/dist/lib/sandbox/types.d.ts +24 -5
- package/dist/lib/sandbox/types.d.ts.map +1 -1
- package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -1
- package/dist/lib/stream-buffer.d.ts +1 -1
- package/dist/lib/stream-buffer.d.ts.map +1 -1
- package/dist/lib/telemetry/console-telemetry.d.ts +0 -1
- package/dist/lib/telemetry/console-telemetry.d.ts.map +1 -1
- package/dist/lib/telemetry/file/file-telemetry.d.ts +5 -3
- package/dist/lib/telemetry/file/file-telemetry.d.ts.map +1 -1
- package/dist/lib/telemetry/file/index.js +16 -11
- package/dist/lib/telemetry/file/index.js.map +2 -2
- package/dist/lib/telemetry/index.js +3 -4
- package/dist/lib/telemetry/index.js.map +2 -2
- package/dist/lib/telemetry/safe-serialize.d.ts +2 -2
- package/dist/lib/telemetry/safe-serialize.d.ts.map +1 -1
- package/dist/lib/tracing/index.js +4 -4
- package/dist/lib/tracing/index.js.map +2 -2
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -177,14 +177,20 @@ parent thread.
|
|
|
177
177
|
|
|
178
178
|
```typescript
|
|
179
179
|
import { openai } from '@ai-sdk/openai';
|
|
180
|
+
import { InMemoryFs } from 'just-bash';
|
|
180
181
|
|
|
181
182
|
import {
|
|
182
183
|
ContextEngine,
|
|
183
184
|
InMemoryContextStore,
|
|
184
185
|
agent,
|
|
186
|
+
createBashTool,
|
|
187
|
+
createVirtualSandbox,
|
|
185
188
|
role,
|
|
186
189
|
} from '@deepagents/context';
|
|
187
190
|
|
|
191
|
+
await using backend = await createVirtualSandbox({ fs: new InMemoryFs() });
|
|
192
|
+
const sandbox = await createBashTool({ sandbox: backend });
|
|
193
|
+
|
|
188
194
|
const context = new ContextEngine({
|
|
189
195
|
store: new InMemoryContextStore(),
|
|
190
196
|
chatId: 'chat-001',
|
|
@@ -194,14 +200,16 @@ const context = new ContextEngine({
|
|
|
194
200
|
const analyst = agent({
|
|
195
201
|
name: 'analyst',
|
|
196
202
|
context,
|
|
203
|
+
sandbox,
|
|
197
204
|
model: openai('gpt-5.4-mini'),
|
|
198
205
|
});
|
|
199
206
|
|
|
200
|
-
const { tool: advisor } = analyst.asAdvisor(
|
|
207
|
+
const { tool: advisor } = analyst.asAdvisor();
|
|
201
208
|
|
|
202
209
|
const coordinator = agent({
|
|
203
210
|
name: 'coordinator',
|
|
204
211
|
context,
|
|
212
|
+
sandbox,
|
|
205
213
|
model: openai('gpt-5.4'),
|
|
206
214
|
tools: {
|
|
207
215
|
analyze: analyst.asTool({
|
|
@@ -317,8 +325,9 @@ points.
|
|
|
317
325
|
For `target: 'tool-output'`, use `toolOutput(...)` or inspect
|
|
318
326
|
`ctx.toolOutcome`. The outcome is available after a tool reaches
|
|
319
327
|
`output-available`, `output-error`, or `output-denied`, but before the next model
|
|
320
|
-
generation. Assistant-history predicates such as `toolCalled(...)`
|
|
321
|
-
|
|
328
|
+
generation. Assistant-history predicates such as `toolCalled(...)` describe
|
|
329
|
+
tool parts visible in the current assistant segment; use `toolOutput(...)` when
|
|
330
|
+
you need the raw outcome currently being evaluated.
|
|
322
331
|
|
|
323
332
|
```ts
|
|
324
333
|
import {
|
|
@@ -380,6 +389,23 @@ engine.set(
|
|
|
380
389
|
);
|
|
381
390
|
```
|
|
382
391
|
|
|
392
|
+
Use `socraticPlan.instructions()` when the work needs inquiry instead of a
|
|
393
|
+
fixed checklist. It stores evidence-backed questions and answers in the same
|
|
394
|
+
plan file, moves adaptively through domain, case, and bridge phases, and lets
|
|
395
|
+
each review choose the highest-value unanswered question.
|
|
396
|
+
|
|
397
|
+
```ts
|
|
398
|
+
engine.set(
|
|
399
|
+
socraticPlan.instructions(),
|
|
400
|
+
socraticPlan.review({ when: everyNToolCalls(5) }),
|
|
401
|
+
);
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
The agent answers from source and runtime evidence, and asks the user only when
|
|
405
|
+
the answer requires missing information or authority. The standalone
|
|
406
|
+
`socraticPrompting()` fragment shares the inquiry workflow but does not persist
|
|
407
|
+
plan state.
|
|
408
|
+
|
|
383
409
|
- `stripTextByRanges(text, ranges)` removes offset spans from text and returns the remaining visible content.
|
|
384
410
|
- `stripReminders(message)` strips inline/part reminders and model-only synthetic reminder payloads from a `UIMessage`.
|
|
385
411
|
- `isSyntheticReminderMessage(message)` identifies stored model-only reminder carriers so a UI can omit them entirely.
|
package/dist/browser.js
CHANGED
|
@@ -2244,6 +2244,7 @@ async function persistedWriter(options) {
|
|
|
2244
2244
|
let seq = 0;
|
|
2245
2245
|
let buffer = [];
|
|
2246
2246
|
let failedByErrorChunk = false;
|
|
2247
|
+
let abortedByChunk = false;
|
|
2247
2248
|
async function flush() {
|
|
2248
2249
|
if (buffer.length === 0) return;
|
|
2249
2250
|
const batch = buffer;
|
|
@@ -2269,11 +2270,14 @@ async function persistedWriter(options) {
|
|
|
2269
2270
|
}
|
|
2270
2271
|
}
|
|
2271
2272
|
async function persistChunk(chunk) {
|
|
2273
|
+
if (chunk.data.type === "abort") {
|
|
2274
|
+
abortedByChunk = true;
|
|
2275
|
+
}
|
|
2272
2276
|
if (strategy === "immediate") {
|
|
2273
2277
|
await appendBatch([chunk]);
|
|
2274
2278
|
} else {
|
|
2275
2279
|
buffer.push(chunk);
|
|
2276
|
-
if (buffer.length >= flushSize) {
|
|
2280
|
+
if (buffer.length >= flushSize || chunk.data.type.startsWith("data-")) {
|
|
2277
2281
|
await flush();
|
|
2278
2282
|
}
|
|
2279
2283
|
}
|
|
@@ -2301,7 +2305,10 @@ async function persistedWriter(options) {
|
|
|
2301
2305
|
async complete() {
|
|
2302
2306
|
await flush();
|
|
2303
2307
|
if (failedByErrorChunk) return;
|
|
2304
|
-
await store.updateStreamStatus(
|
|
2308
|
+
await store.updateStreamStatus(
|
|
2309
|
+
streamId,
|
|
2310
|
+
abortedByChunk ? "cancelled" : "completed"
|
|
2311
|
+
);
|
|
2305
2312
|
},
|
|
2306
2313
|
async fail(error) {
|
|
2307
2314
|
await flush();
|