@deepagents/context 0.26.0 → 0.28.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 CHANGED
@@ -4,7 +4,7 @@ A domain-agnostic context management system for formatting context fragments int
4
4
 
5
5
  ## Overview
6
6
 
7
- This package provides a flexible way to compose and render context data in multiple formats (XML, Markdown, TOML, TOON). Context fragments are simple data structures that can be transformed into different representations suitable for various LLM prompt styles.
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.
8
8
 
9
9
  ## Installation
10
10
 
@@ -35,7 +35,7 @@ const fragments = [
35
35
  guardrail({
36
36
  rule: 'Never expose PII',
37
37
  reason: 'Privacy compliance',
38
- action: 'Aggregate data instead',
38
+ action: 'Return aggregates instead',
39
39
  }),
40
40
  ];
41
41
 
@@ -60,7 +60,7 @@ console.log(renderer.render(fragments));
60
60
  <guardrail>
61
61
  <rule>Never expose PII</rule>
62
62
  <reason>Privacy compliance</reason>
63
- <action>Aggregate data instead</action>
63
+ <action>Return aggregates instead</action>
64
64
  </guardrail>
65
65
  </guardrails>
66
66
  ```
@@ -95,7 +95,6 @@ Builder functions for user-specific context:
95
95
  | `persona({name, role, tone?})` | AI persona definition | `persona({ name: 'Freya', role: '...' })` |
96
96
  | `alias(term, meaning)` | User-specific vocabulary | `alias('revenue', 'gross revenue')` |
97
97
  | `preference(aspect, value)` | Output preferences | `preference('date format', 'YYYY-MM-DD')` |
98
- | `userContext(description)` | Current working focus | `userContext('Q4 analysis')` |
99
98
  | `correction(subject, clarification)` | Corrections to understanding | `correction('status', '1=active, 0=inactive')` |
100
99
 
101
100
  ### Core Utilities
@@ -244,19 +243,14 @@ const fragment = workflow({
244
243
  </workflow>
245
244
  ```
246
245
 
247
- ### Nested Objects
246
+ ### Nested Structures
248
247
 
249
248
  ```typescript
250
- const fragment = {
251
- name: 'database',
252
- data: {
253
- host: 'localhost',
254
- settings: {
255
- timeout: 30,
256
- retry: true,
257
- },
258
- },
259
- };
249
+ const fragment = fragment(
250
+ 'database',
251
+ fragment('host', 'localhost'),
252
+ fragment('settings', fragment('timeout', 30), fragment('retry', true)),
253
+ );
260
254
  ```
261
255
 
262
256
  **XML Output:**
@@ -284,7 +278,6 @@ All renderers automatically skip `null` and `undefined` values.
284
278
  ```typescript
285
279
  interface ContextFragment {
286
280
  name: string;
287
- data: FragmentData;
288
281
  type?: 'fragment' | 'message';
289
282
  persist?: boolean;
290
283
  codec?: FragmentCodec;
package/dist/browser.d.ts CHANGED
@@ -4,7 +4,8 @@
4
4
  * This surface excludes server-only modules (stores, sandbox, skills loader)
5
5
  * and only exports APIs that are safe to consume in browser bundles.
6
6
  */
7
- export * from './lib/codec.ts';
7
+ export * from './lib/codec/codec.ts';
8
+ export * from './lib/codec/serialized-fragments.ts';
8
9
  export * from './lib/estimate.ts';
9
10
  export * from './lib/fragments.ts';
10
11
  export * from './lib/fragments/domain.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sCAAsC,CAAC;AACrD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sCAAsC,CAAC;AACrD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}