@deepagents/context 0.19.0 → 0.20.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 +31 -0
- package/dist/browser.d.ts +22 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +1663 -0
- package/dist/browser.js.map +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +141 -107
- package/dist/index.js.map +4 -4
- package/dist/lib/fragments/message/user.d.ts +54 -0
- package/dist/lib/fragments/message/user.d.ts.map +1 -0
- package/dist/lib/fragments.d.ts +0 -41
- package/dist/lib/fragments.d.ts.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -12,6 +12,17 @@ This package provides a flexible way to compose and render context data in multi
|
|
|
12
12
|
npm install @deepagents/context
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Browser Entry Point
|
|
16
|
+
|
|
17
|
+
For browser bundles, prefer the browser-specific export path:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { identity, reminder, term, user } from '@deepagents/context/browser';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`@deepagents/context/browser` intentionally excludes server-only modules
|
|
24
|
+
like store implementations, sandbox tooling, and filesystem-based skill loading.
|
|
25
|
+
|
|
15
26
|
## Basic Usage
|
|
16
27
|
|
|
17
28
|
```typescript
|
|
@@ -125,6 +136,26 @@ type UserReminderMetadata = {
|
|
|
125
136
|
};
|
|
126
137
|
```
|
|
127
138
|
|
|
139
|
+
Helper utilities for reminder metadata:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
type ReminderRange = {
|
|
143
|
+
partIndex: number;
|
|
144
|
+
start: number;
|
|
145
|
+
end: number;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const partIndex = 0;
|
|
149
|
+
const ranges = getReminderRanges(message.metadata).filter(
|
|
150
|
+
(range) => range.partIndex === partIndex,
|
|
151
|
+
);
|
|
152
|
+
const visibleText = stripTextByRanges(message.parts[partIndex].text, ranges);
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- `getReminderRanges(metadata)` returns `metadata.reminders` as offset ranges (or `[]` when missing).
|
|
156
|
+
- `stripTextByRanges(text, ranges)` removes offset spans from text and returns the remaining visible content.
|
|
157
|
+
- Reminder ranges are local to a message part, so filter by `partIndex` before stripping a specific part's text.
|
|
158
|
+
|
|
128
159
|
## Renderers
|
|
129
160
|
|
|
130
161
|
All renderers support the `groupFragments` option which groups same-named fragments under a pluralized parent tag.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-focused entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* This surface excludes server-only modules (stores, sandbox, skills loader)
|
|
5
|
+
* and only exports APIs that are safe to consume in browser bundles.
|
|
6
|
+
*/
|
|
7
|
+
export * from './lib/codec.ts';
|
|
8
|
+
export * from './lib/estimate.ts';
|
|
9
|
+
export * from './lib/fragments.ts';
|
|
10
|
+
export * from './lib/fragments/domain.ts';
|
|
11
|
+
export * from './lib/fragments/message/user.ts';
|
|
12
|
+
export * from './lib/fragments/user.ts';
|
|
13
|
+
export * from './lib/guardrail.ts';
|
|
14
|
+
export * from './lib/models.generated.ts';
|
|
15
|
+
export * from './lib/render.ts';
|
|
16
|
+
export * from './lib/renderers/abstract.renderer.ts';
|
|
17
|
+
export * from './lib/soul/fragments.ts';
|
|
18
|
+
export * from './lib/store/store.ts';
|
|
19
|
+
export * from './lib/stream-buffer.ts';
|
|
20
|
+
export * from './lib/stream/stream-store.ts';
|
|
21
|
+
export * from './lib/visualize.ts';
|
|
22
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +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"}
|