@deepagents/context 4.0.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 +19 -14
- package/dist/browser.js +18 -8
- package/dist/browser.js.map +2 -2
- package/dist/index.js +2115 -1565
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.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 +16 -14
- package/dist/lib/fragments/message/user.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/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/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 -218
- package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/index.d.ts +4 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -1
- package/dist/lib/sandbox/shell-quote.d.ts +2 -2
- package/dist/lib/sandbox/strace/index.d.ts +6 -21
- package/dist/lib/sandbox/strace/index.d.ts.map +1 -1
- package/dist/lib/sandbox/strace/index.js +18 -7
- package/dist/lib/sandbox/strace/index.js.map +2 -2
- package/dist/lib/sandbox/types.d.ts +3 -3
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -27,14 +27,15 @@ like store implementations, sandbox tooling, and filesystem-based skill loading.
|
|
|
27
27
|
|
|
28
28
|
The server-side package also ships the sandbox primitives used by
|
|
29
29
|
`@deepagents/text2sql` and other tool-driven agents. Use `createBashTool()`
|
|
30
|
-
with `createVirtualSandbox()`, `createDockerSandbox()`,
|
|
31
|
-
`createDaytonaSandbox(client, options)`, or
|
|
32
|
-
on whether commands should run in memory,
|
|
33
|
-
Agent OS.
|
|
30
|
+
with `createVirtualSandbox()`, `createDockerSandbox()`,
|
|
31
|
+
`createAppleContainerSandbox()`, `createDaytonaSandbox(client, options)`, or
|
|
32
|
+
`createAgentOsSandbox()` depending on whether commands should run in memory,
|
|
33
|
+
Docker, Apple Container lightweight VMs, managed Daytona sandboxes, or Agent OS.
|
|
34
34
|
|
|
35
35
|
See the docs for the full API surface:
|
|
36
36
|
|
|
37
37
|
- [Sandbox](https://januarylabs.github.io/deepagents/docs/context/sandbox)
|
|
38
|
+
- [Apple Container Sandbox](https://januarylabs.github.io/deepagents/docs/context/apple-container-sandbox)
|
|
38
39
|
- [Subcommand Builders](https://januarylabs.github.io/deepagents/docs/context/subcommand)
|
|
39
40
|
- [GCS Cloud Storage Volumes](https://januarylabs.github.io/deepagents/docs/context/recipes/gcs-cloud-storage)
|
|
40
41
|
|
|
@@ -82,32 +83,36 @@ constant for the container's lifetime. Re-proving it per composition would re-pa
|
|
|
82
83
|
several host→container round-trips on every tool call for no new information.
|
|
83
84
|
|
|
84
85
|
Verifying the invariant is the consumer's **once-per-container** responsibility.
|
|
85
|
-
Run the probe once at startup (e.g. a daemon boot gate) via
|
|
86
|
+
Run the probe once inside the sandbox at startup (e.g. a daemon boot gate) via
|
|
87
|
+
the lean leaf entry:
|
|
86
88
|
|
|
87
89
|
```ts
|
|
88
90
|
import { selfTestStrace } from '@deepagents/context/sandbox/strace';
|
|
89
91
|
|
|
90
92
|
// Throws StraceUnavailableError (reason: 'strace-missing' | 'ptrace-blocked' |
|
|
91
|
-
// 'trace-unparseable') with no silent fallback.
|
|
92
|
-
|
|
93
|
-
// in-process caller implements just { executeCommand, readFile }.
|
|
94
|
-
await selfTestStrace(backend);
|
|
93
|
+
// 'trace-unparseable') with no silent fallback.
|
|
94
|
+
await selfTestStrace();
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
The `@deepagents/context/sandbox/strace` subpath is a
|
|
97
|
+
The `@deepagents/context/sandbox/strace` subpath is a small Node-runtime leaf
|
|
98
98
|
(probe + parser + `StraceUnavailableError`) with no agent/context-framework
|
|
99
|
-
imports, so a minimal daemon can import it without pulling the
|
|
99
|
+
imports, so a minimal daemon or bundled probe can import it without pulling the
|
|
100
|
+
whole framework. If the host process owns only a remote `DisposableSandbox`,
|
|
101
|
+
bundle this leaf entry with a tiny driver, write it into the sandbox, and run it
|
|
102
|
+
there with `node`.
|
|
100
103
|
Import `StraceUnavailableError` from this same subpath when catching the probe's
|
|
101
104
|
error (each entry point is bundled independently, so `instanceof` requires the
|
|
102
105
|
class from the same entry).
|
|
103
106
|
|
|
104
|
-
The backend must satisfy, on any non-virtual backend (Docker,
|
|
107
|
+
The backend must satisfy, on any non-virtual backend (Docker, Apple Container,
|
|
108
|
+
Daytona, e2b, ...):
|
|
105
109
|
|
|
106
110
|
1. `strace` installed in the image — `apk add strace` (Alpine) /
|
|
107
111
|
`apt-get install -y strace` (Debian), or `installers: [pkg(['strace'])]` for
|
|
108
112
|
`createDockerSandbox`;
|
|
109
|
-
2. `ptrace` permitted by the runtime — the default on Docker
|
|
110
|
-
|
|
113
|
+
2. `ptrace` permitted by the runtime — the default on Docker, Apple Container,
|
|
114
|
+
and Daytona;
|
|
115
|
+
3. a **native-architecture** sandbox — amd64-under-Rosetta on Apple silicon
|
|
111
116
|
garbles the trace, so build the image for the host arch.
|
|
112
117
|
|
|
113
118
|
The **in-process virtual sandbox cannot host strace** (no real processes/ptrace),
|
package/dist/browser.js
CHANGED
|
@@ -1840,7 +1840,7 @@ function isOutputAvailableToolPart(part) {
|
|
|
1840
1840
|
return isStaticToolUIPart(part) && part.state === "output-available";
|
|
1841
1841
|
}
|
|
1842
1842
|
function isToolOutputReminderEnvelope(value) {
|
|
1843
|
-
return isRecord(value) && "result" in value && typeof value.systemReminder === "string"
|
|
1843
|
+
return isRecord(value) && isRecord(value.meta) && value.meta.reminder === true && "result" in value && typeof value.systemReminder === "string";
|
|
1844
1844
|
}
|
|
1845
1845
|
function stripTextByRanges(text, ranges) {
|
|
1846
1846
|
if (ranges.length === 0) {
|
|
@@ -1963,7 +1963,8 @@ function applyInlineReminder(message2, value) {
|
|
|
1963
1963
|
};
|
|
1964
1964
|
}
|
|
1965
1965
|
function applyPartReminder(message2, value) {
|
|
1966
|
-
const
|
|
1966
|
+
const reminderText = formatTaggedReminder(value);
|
|
1967
|
+
const part = { type: "text", text: reminderText };
|
|
1967
1968
|
message2.parts.push(part);
|
|
1968
1969
|
const partIndex = message2.parts.length - 1;
|
|
1969
1970
|
return {
|
|
@@ -1972,13 +1973,10 @@ function applyPartReminder(message2, value) {
|
|
|
1972
1973
|
target: "user",
|
|
1973
1974
|
partIndex,
|
|
1974
1975
|
start: 0,
|
|
1975
|
-
end:
|
|
1976
|
+
end: reminderText.length,
|
|
1976
1977
|
mode: "part"
|
|
1977
1978
|
};
|
|
1978
1979
|
}
|
|
1979
|
-
function resolveReminderText(item, ctx) {
|
|
1980
|
-
return resolveReminder(item, ctx)?.text ?? "";
|
|
1981
|
-
}
|
|
1982
1980
|
function normalizeReminderResolution(value) {
|
|
1983
1981
|
if (typeof value === "string") {
|
|
1984
1982
|
return value.trim().length === 0 ? null : { text: value };
|
|
@@ -2028,7 +2026,19 @@ function applyRemindersToToolOutput(output, texts) {
|
|
|
2028
2026
|
if (texts.length === 0) return output;
|
|
2029
2027
|
return {
|
|
2030
2028
|
result: output === void 0 ? null : output,
|
|
2031
|
-
systemReminder: formatTaggedReminder(texts.join("\n"))
|
|
2029
|
+
systemReminder: formatTaggedReminder(texts.join("\n")),
|
|
2030
|
+
meta: { reminder: true }
|
|
2031
|
+
};
|
|
2032
|
+
}
|
|
2033
|
+
function toToolReminderModelOutput(output, projectResult) {
|
|
2034
|
+
if (!isToolOutputReminderEnvelope(output)) return null;
|
|
2035
|
+
const projected = projectResult(output.result);
|
|
2036
|
+
return {
|
|
2037
|
+
type: "json",
|
|
2038
|
+
value: {
|
|
2039
|
+
result: isRecord(projected) ? projected.value : projected,
|
|
2040
|
+
systemReminder: output.systemReminder
|
|
2041
|
+
}
|
|
2032
2042
|
};
|
|
2033
2043
|
}
|
|
2034
2044
|
function mergeReminderMetadata(message2, addedReminders) {
|
|
@@ -2401,7 +2411,6 @@ export {
|
|
|
2401
2411
|
render,
|
|
2402
2412
|
resolveReminder,
|
|
2403
2413
|
resolveReminderAsync,
|
|
2404
|
-
resolveReminderText,
|
|
2405
2414
|
role,
|
|
2406
2415
|
runGuardrailChain,
|
|
2407
2416
|
soul,
|
|
@@ -2413,6 +2422,7 @@ export {
|
|
|
2413
2422
|
term,
|
|
2414
2423
|
toFragment,
|
|
2415
2424
|
toMessageFragment,
|
|
2425
|
+
toToolReminderModelOutput,
|
|
2416
2426
|
user,
|
|
2417
2427
|
visualizeGraph,
|
|
2418
2428
|
workflow
|