@deepagents/context 0.36.0 → 0.37.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 +67 -2
- package/dist/browser.js.map +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3755 -2511
- package/dist/index.js.map +4 -4
- package/dist/lib/advisor.d.ts +26 -0
- package/dist/lib/advisor.d.ts.map +1 -0
- package/dist/lib/agent.d.ts +14 -2
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/chat.d.ts +6 -2
- package/dist/lib/chat.d.ts.map +1 -1
- package/dist/lib/engine.d.ts +10 -0
- package/dist/lib/engine.d.ts.map +1 -1
- package/dist/lib/guardrail.d.ts +1 -0
- package/dist/lib/guardrail.d.ts.map +1 -1
- package/dist/lib/guardrails/error-recovery.guardrail.d.ts.map +1 -1
- package/dist/lib/repair.d.ts +4 -0
- package/dist/lib/repair.d.ts.map +1 -0
- package/dist/lib/sandbox/ast-utils.d.ts +4 -0
- package/dist/lib/sandbox/ast-utils.d.ts.map +1 -0
- package/dist/lib/sandbox/bash-exception.d.ts +5 -0
- package/dist/lib/sandbox/bash-exception.d.ts.map +1 -0
- package/dist/lib/sandbox/bash-meta.d.ts +13 -0
- package/dist/lib/sandbox/bash-meta.d.ts.map +1 -0
- package/dist/lib/sandbox/bash-tool.d.ts +27 -0
- package/dist/lib/sandbox/bash-tool.d.ts.map +1 -0
- package/dist/lib/sandbox/container-tool.d.ts +39 -11
- package/dist/lib/sandbox/container-tool.d.ts.map +1 -1
- package/dist/lib/sandbox/extension.d.ts +39 -0
- package/dist/lib/sandbox/extension.d.ts.map +1 -0
- package/dist/lib/sandbox/file-events.d.ts +47 -0
- package/dist/lib/sandbox/file-events.d.ts.map +1 -0
- package/dist/lib/sandbox/index.d.ts +14 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -1
- package/dist/lib/sandbox/openapi/demo.d.ts +2 -0
- package/dist/lib/sandbox/openapi/demo.d.ts.map +1 -0
- package/dist/lib/sandbox/openapi/extension.d.ts +19 -0
- package/dist/lib/sandbox/openapi/extension.d.ts.map +1 -0
- package/dist/lib/sandbox/openapi/format.d.ts +11 -0
- package/dist/lib/sandbox/openapi/format.d.ts.map +1 -0
- package/dist/lib/sandbox/openapi/schema.d.ts +9 -0
- package/dist/lib/sandbox/openapi/schema.d.ts.map +1 -0
- package/dist/lib/sandbox/openapi/skill/index.d.ts +6 -0
- package/dist/lib/sandbox/openapi/skill/index.d.ts.map +1 -0
- package/dist/lib/sandbox/openapi/skill/index.js +14 -0
- package/dist/lib/sandbox/openapi/skill/index.js.map +7 -0
- package/dist/lib/sandbox/openapi/skill/openapi-cli/SKILL.md +109 -0
- package/dist/lib/sandbox/openapi/validate.d.ts +7 -0
- package/dist/lib/sandbox/openapi/validate.d.ts.map +1 -0
- package/dist/lib/sandbox/routing-sandbox.d.ts +28 -0
- package/dist/lib/sandbox/routing-sandbox.d.ts.map +1 -0
- package/dist/lib/sandbox/subcommand.d.ts +49 -0
- package/dist/lib/sandbox/subcommand.d.ts.map +1 -0
- package/dist/lib/sandbox/types.d.ts +46 -0
- package/dist/lib/sandbox/types.d.ts.map +1 -0
- package/dist/lib/sandbox/upload-skills.d.ts +14 -0
- package/dist/lib/sandbox/upload-skills.d.ts.map +1 -0
- package/dist/lib/sandbox/walk.d.ts +17 -0
- package/dist/lib/sandbox/walk.d.ts.map +1 -0
- package/dist/lib/skills/fragments.d.ts +10 -15
- package/dist/lib/skills/fragments.d.ts.map +1 -1
- package/dist/lib/skills/types.d.ts +2 -27
- package/dist/lib/skills/types.d.ts.map +1 -1
- package/dist/lib/title.d.ts +1 -1
- package/dist/lib/title.d.ts.map +1 -1
- package/dist/lib/tracing/exporter.d.ts.map +1 -1
- package/dist/lib/tracing/index.js +59 -12
- package/dist/lib/tracing/index.js.map +2 -2
- package/dist/lib/tracing/openai-traces-integration.d.ts.map +1 -1
- package/dist/lib/tracing/serialization.d.ts.map +1 -1
- package/dist/lib/tracing/types.d.ts +0 -1
- package/dist/lib/tracing/types.d.ts.map +1 -1
- package/package.json +21 -9
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @deepagents/context
|
|
2
2
|
|
|
3
|
-
A domain-agnostic context
|
|
3
|
+
A domain-agnostic context system for LLM applications, including fragment rendering, persistence, chat orchestration, and portable sandbox tooling.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
This package provides a flexible way to compose and render context in multiple formats (XML, Markdown, TOML, TOON). Context fragments are structured units that can be transformed into different prompt representations for different LLM styles.
|
|
7
|
+
This package provides a flexible way to compose and render context in multiple formats (XML, Markdown, TOML, TOON), persist conversations, orchestrate chat flows, and expose portable host-side command surfaces. Context fragments are structured units that can be transformed into different prompt representations for different LLM styles.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -23,6 +23,23 @@ import { identity, reminder, term, user } from '@deepagents/context/browser';
|
|
|
23
23
|
`@deepagents/context/browser` intentionally excludes server-only modules
|
|
24
24
|
like store implementations, sandbox tooling, and filesystem-based skill loading.
|
|
25
25
|
|
|
26
|
+
## Sandbox Tooling
|
|
27
|
+
|
|
28
|
+
The server-side package also ships the sandbox primitives used by
|
|
29
|
+
`@deepagents/text2sql` and other tool-driven agents. Use
|
|
30
|
+
`createRoutingSandbox({ backend, hostExtensions })` to run the same host
|
|
31
|
+
commands across virtual, Docker, or Agent OS backends.
|
|
32
|
+
|
|
33
|
+
If an upstream service already has an OpenAPI description,
|
|
34
|
+
`createOpenAPIExtension({ name, openapi, ... })` turns it into a portable
|
|
35
|
+
`SandboxExtension` with validated subcommands and a built-in `schema`
|
|
36
|
+
introspection command.
|
|
37
|
+
|
|
38
|
+
See the docs for the full API surface:
|
|
39
|
+
|
|
40
|
+
- [Routing Sandbox](https://januarylabs.github.io/deepagents/docs/context/routing-sandbox)
|
|
41
|
+
- [Sandbox](https://januarylabs.github.io/deepagents/docs/context/sandbox)
|
|
42
|
+
|
|
26
43
|
## Basic Usage
|
|
27
44
|
|
|
28
45
|
```typescript
|
|
@@ -65,6 +82,54 @@ console.log(renderer.render(fragments));
|
|
|
65
82
|
</guardrails>
|
|
66
83
|
```
|
|
67
84
|
|
|
85
|
+
## Agent Helpers
|
|
86
|
+
|
|
87
|
+
If you use the built-in agent wrapper from `@deepagents/context`, the same
|
|
88
|
+
`ContextEngine` can power sub-agents and advisor tools without mutating the
|
|
89
|
+
parent thread.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { openai } from '@ai-sdk/openai';
|
|
93
|
+
|
|
94
|
+
import {
|
|
95
|
+
ContextEngine,
|
|
96
|
+
InMemoryContextStore,
|
|
97
|
+
agent,
|
|
98
|
+
role,
|
|
99
|
+
} from '@deepagents/context';
|
|
100
|
+
|
|
101
|
+
const context = new ContextEngine({
|
|
102
|
+
store: new InMemoryContextStore(),
|
|
103
|
+
chatId: 'chat-001',
|
|
104
|
+
userId: 'user-001',
|
|
105
|
+
}).set(role('You are a product analyst.'));
|
|
106
|
+
|
|
107
|
+
const analyst = agent({
|
|
108
|
+
name: 'analyst',
|
|
109
|
+
context,
|
|
110
|
+
model: openai('gpt-5.4-mini'),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const { tool: advisor } = analyst.asAdvisor({ concise: true });
|
|
114
|
+
|
|
115
|
+
const coordinator = agent({
|
|
116
|
+
name: 'coordinator',
|
|
117
|
+
context,
|
|
118
|
+
model: openai('gpt-5.4'),
|
|
119
|
+
tools: {
|
|
120
|
+
analyze: analyst.asTool({
|
|
121
|
+
toolDescription: 'Return a short analysis brief',
|
|
122
|
+
}),
|
|
123
|
+
advisor,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`asTool()` forks the context so the child run sees the parent's system fragments
|
|
129
|
+
without persisting new messages into the parent chat. `asAdvisor()` exposes a
|
|
130
|
+
no-input reviewer tool and `usage()` reports successful calls plus token usage
|
|
131
|
+
for that advisor instance.
|
|
132
|
+
|
|
68
133
|
## Fragment Builders
|
|
69
134
|
|
|
70
135
|
### Domain Fragments
|