@redis/vercel-ai-sdk 0.2.0 → 0.3.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/CHANGELOG.md +31 -0
- package/README.md +8 -2
- package/TOOLS.md +256 -22
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +5 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +159 -29
- package/dist/index.js.map +1 -1
- package/dist/ingestion.d.ts +6 -0
- package/dist/ingestion.d.ts.map +1 -0
- package/dist/ingestion.js +148 -0
- package/dist/ingestion.js.map +1 -0
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +6 -2
- package/dist/instructions.js.map +1 -1
- package/dist/namespaces.d.ts +2 -0
- package/dist/namespaces.d.ts.map +1 -1
- package/dist/namespaces.js +64 -9
- package/dist/namespaces.js.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/provider.js.map +1 -1
- package/dist/schemas.d.ts +20 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +18 -4
- package/dist/schemas.js.map +1 -1
- package/dist/scoped-memory.d.ts +9 -2
- package/dist/scoped-memory.d.ts.map +1 -1
- package/dist/scoped-memory.js +41 -3
- package/dist/scoped-memory.js.map +1 -1
- package/dist/session-event-hook.js +1 -1
- package/dist/session-event-hook.js.map +1 -1
- package/dist/summary-views.d.ts +9 -0
- package/dist/summary-views.d.ts.map +1 -0
- package/dist/summary-views.js +276 -0
- package/dist/summary-views.js.map +1 -0
- package/package.json +1 -1
- package/src/errors.ts +6 -1
- package/src/index.ts +151 -28
- package/src/ingestion.ts +160 -0
- package/src/instructions.ts +6 -2
- package/src/namespaces.ts +74 -7
- package/src/provider.ts +1 -1
- package/src/schemas.ts +22 -4
- package/src/scoped-memory.ts +50 -4
- package/src/session-event-hook.ts +1 -1
- package/src/summary-views.ts +300 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
* **Breaking:** `actorId` follows the `ownerId` rule, as the store enforces. This applies to `start_session`, `add_session_event`, `createSessionEventHook`, and the model wrapper's `assistantId`. Longer or differently punctuated IDs now fail validation before any request.
|
|
6
|
+
* Adds `upsert_memory`, `update_memory_fields`, `list_memory_sources`, `list_memory_source_evidence`, and `list_source_memories` to every toolset.
|
|
7
|
+
* Adds the opt-in `ingestionTools` option for `create_document_ingestion`, `get_document_ingestion`, `list_document_ingestion_outputs`, `get_ingestion_hook_status`, and `list_ingestion_hook_statuses`. Defaults to `false`.
|
|
8
|
+
* Adds the opt-in `summaryViewTools` option for the Summary View tools. Defaults to `false`. `delete_summary_view` also requires `allowDeletes`.
|
|
9
|
+
* Adds `get_namespace_routing` to `namespaceTools`, and `put_namespace_routing` behind the separate opt-in `routingPolicyWrites` option, since it replaces the store-wide policy.
|
|
10
|
+
* `move_memories` routes memories by the store's routing policy when `namespaceId` is omitted.
|
|
11
|
+
* `search_memories`, `list_sessions`, and `list_namespaces` accept `sortBy` and `sortOrder`. `search_memories` sorts only without `query`.
|
|
12
|
+
* `search_memories` accepts `excludeDocumentManaged`. `list_sessions` accepts a `namespaceId` filter.
|
|
13
|
+
* `ownerId` accepts 1 to 64 letters, digits, and `_+=.@-` except `.` and `..`, and `sessionId` accepts underscores, matching the SDK.
|
|
14
|
+
* `update_memory`, `upsert_memory`, and `update_memory_fields` accept `expectedRevision`.
|
|
15
|
+
* `start_session`, `add_session_event`, `create_memories`, `update_memory`, `upsert_memory`, and `update_memory_fields` accept `idempotencyKey`. `start_session` also accepts `createdAt`.
|
|
16
|
+
* `create_memories` with `idempotencyKey` derives deterministic memory IDs, so an identical retry replays the saved result.
|
|
17
|
+
* `create_memories` with an `idempotencyKey` derives memory IDs from the key and returns `memoryIds` in input order with `null` for each record the service rejected.
|
|
18
|
+
* The store shares an idempotency key across all callers, so the tools send a hash of the key, the fixed scope, and the request target. Two users who pick the same key no longer collide with HTTP 409, and an identical retry still replays.
|
|
19
|
+
* A keyed `start_session` requires `sessionId` and `createdAt`. A retry on an existing session returns the session's first event when `actorId`, role, text, and `createdAt` match, because the store refuses a repeated `createSession` with HTTP 409. The first event is the earliest by the store's `systemTimestamp`, so a backdated append cannot displace it. Events tied for the earliest `systemTimestamp` are all candidates, and the retry returns the one that matches. It also refuses when a requested `namespaceId` differs from the session's.
|
|
20
|
+
* Session event `idempotencyKey` descriptions no longer promise replay, because the store does not deduplicate session events by key. After an uncertain `add_session_event`, read `get_session_memory` before retrying.
|
|
21
|
+
* A stale `expectedRevision` (HTTP 412) and an HTTP 409 conflict now return recovery guidance instead of the generic configuration message.
|
|
22
|
+
* A toolset scoped only by `sessionId` refuses every Summary View tool and the ingestion hook status tools, since they are store-wide and the session binds no user or namespace.
|
|
23
|
+
* Under a fixed `userId` or `namespaceId`, routing tools and automatic routing are refused. Summary Views are hidden, readable, or manageable by how their filter pins the scope. A `SHARED` view is readable, with the partition forced to the scope, but cannot be updated, refreshed, or deleted. `create_summary_view` creates only `PRIVATE` views.
|
|
24
|
+
* A Summary View whose filter names other values for a fixed `userId` or `namespaceId` (`eq` differs, or `in` omits it) is hidden from a scoped toolset even when it groups by that field, so its definition no longer leaks.
|
|
25
|
+
* With a fixed user or namespace, `get_summary_view` and `list_summary_views` no longer return the other users and namespaces a view's filter names.
|
|
26
|
+
* The 1.0.0 ingestion record has no `ownerId`, so a toolset with a fixed `userId` or `namespaceId` reads an ingestion only after it has produced a memory in scope.
|
|
27
|
+
* A scoped toolset can read document ingestions it submitted itself before they produce memories.
|
|
28
|
+
* `create_document_ingestion` is refused under a fixed `namespaceId`.
|
|
29
|
+
* Ingestion hook status tools are refused under a fixed `namespaceId`.
|
|
30
|
+
* `update_memory_fields` checks that a fixed user owns the target namespace, as `update_memory` does.
|
|
31
|
+
* `list_sessions` with a fixed `sessionId` validates `namespaceId` against a fixed namespace and returns no items when the filter names a different namespace than the session's.
|
|
32
|
+
* A scope with only `sessionId` sets no owner or namespace boundary. Set `userId` or `namespaceId` when `sessionId` must act as a write boundary.
|
|
33
|
+
|
|
3
34
|
## 0.2.0
|
|
4
35
|
|
|
5
36
|
* Bumps `@redis-iris/agent-memory` to v1.0.0.
|
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ Provenance is off by default.
|
|
|
103
103
|
Existing underlying metadata is preserved; if it already owns `redisAgentMemory`, wrapper provenance is omitted.
|
|
104
104
|
|
|
105
105
|
The wrapper is best effort, not exactly once.
|
|
106
|
-
|
|
106
|
+
The wrapper sends no append idempotency key, so a timed-out POST may have committed. Use collision-resistant session IDs bound to authenticated state and serialize requests by exact session ID.
|
|
107
107
|
Never combine automatic recording with session hooks or model-callable session-write tools for the same interaction.
|
|
108
108
|
|
|
109
109
|
For streaming, nonterminal parts pass through as produced.
|
|
@@ -130,6 +130,9 @@ const memory = createRedisAgentMemory({
|
|
|
130
130
|
model,
|
|
131
131
|
allowDeletes,
|
|
132
132
|
namespaceTools,
|
|
133
|
+
routingPolicyWrites,
|
|
134
|
+
ingestionTools,
|
|
135
|
+
summaryViewTools,
|
|
133
136
|
timeoutMs,
|
|
134
137
|
});
|
|
135
138
|
```
|
|
@@ -142,7 +145,10 @@ const memory = createRedisAgentMemory({
|
|
|
142
145
|
| `scope` | Optional default `{ userId?, sessionId?, namespaceId? }` |
|
|
143
146
|
| `model` | Optional configured AI SDK model default; never a model-name string |
|
|
144
147
|
| `allowDeletes` | `false`; exposes deletion tools when true |
|
|
145
|
-
| `namespaceTools` | `false`; exposes namespace administration tools when true |
|
|
148
|
+
| `namespaceTools` | `false`; exposes namespace administration and store-wide routing tools when true |
|
|
149
|
+
| `routingPolicyWrites` | `false`; with `namespaceTools`, also exposes `put_namespace_routing`, which replaces the store-wide routing policy |
|
|
150
|
+
| `ingestionTools` | `false`; exposes document ingestion and ingestion hook status tools when true |
|
|
151
|
+
| `summaryViewTools` | `false`; exposes Summary View tools when true |
|
|
146
152
|
| `timeoutMs` | `30000` per HTTP request; must be positive and finite |
|
|
147
153
|
|
|
148
154
|
Scope accepts `userId`, `sessionId`, and `namespaceId`. Any other field, including the removed `namespace` label, throws instead of being ignored, so an unmigrated scope cannot silently lose its boundary.
|
package/TOOLS.md
CHANGED
|
@@ -196,7 +196,7 @@ Hook options are:
|
|
|
196
196
|
| Option | Behavior |
|
|
197
197
|
| --- | --- |
|
|
198
198
|
| `role` | Required: `'USER'` for `onStart`, or `'ASSISTANT'` for `onEnd` |
|
|
199
|
-
| `actorId` | Required author ID
|
|
199
|
+
| `actorId` | Required author ID of 1 to 64 letters, digits, or `_+=.@-`; must match scoped `userId` for USER events |
|
|
200
200
|
| `onError(error, context)` | Required handler for validation or write failures; receives a sanitized `RedisAgentMemoryToolError` |
|
|
201
201
|
| `onEventStart(info)` | Optional observer called before each append attempt |
|
|
202
202
|
| `onEventSaved(info)` | Optional observer called after each confirmed append |
|
|
@@ -211,6 +211,7 @@ The two hooks run independently.
|
|
|
211
211
|
A USER save failure does not stop generation or prevent the ASSISTANT hook from running.
|
|
212
212
|
A failed write may have committed without confirmation, so the assistant event may still be appended afterward.
|
|
213
213
|
Ownership checks still prevent an ASSISTANT event from starting a new user-owned session.
|
|
214
|
+
Hooks send no `idempotencyKey`.
|
|
214
215
|
Writes are not atomic, retried, or deduplicated; verify uncertain outcomes before retrying and register each hook only once per generation.
|
|
215
216
|
AI SDK ignores lifecycle callback exceptions, so report failures through `onError`.
|
|
216
217
|
To require persistence before proceeding with generation or returning a reply, use the official SDK in the application workflow.
|
|
@@ -228,22 +229,33 @@ The three deletion tools below are exposed only when `options.allowDeletes` is `
|
|
|
228
229
|
| Tool | Parameters and result |
|
|
229
230
|
| --- | --- |
|
|
230
231
|
| `get_memory_context` | `{}` → configured IDs and identity rules, no secrets |
|
|
231
|
-
| `start_session` | `{actorId, text, sessionId?, namespaceId?}` → `{event}`; omit sessionId to have it generated |
|
|
232
|
-
| `add_session_event` | `{actorId, role, content: [{text}], sessionId?, createdAt?, metadata?, namespaceId?}` → `{event}` |
|
|
232
|
+
| `start_session` | `{actorId, text, sessionId?, createdAt?, idempotencyKey?, namespaceId?}` → `{event}`; omit sessionId to have it generated |
|
|
233
|
+
| `add_session_event` | `{actorId, role, content: [{text}], sessionId?, createdAt?, metadata?, idempotencyKey?, namespaceId?}` → `{event}` |
|
|
233
234
|
| `get_session_event` | `{sessionId?, eventId}` → `{event}` |
|
|
234
235
|
| `get_session_memory` | `{sessionId?, includeSummarisedEvents?}` → session, events, optional summary |
|
|
235
|
-
| `list_sessions` | `{ownerId?, includeAll?, limit?, cursor?}` → `{items: [{sessionId, ownerId?, ...}], nextCursor?}` |
|
|
236
|
-
| `create_memories` | `{memories: [...]}` without IDs → `{memoryIds, created, errors?}`;
|
|
237
|
-
| `get_memory` | `{memoryId}` → memory record |
|
|
238
|
-
| `search_memories` | `{query?, filter?, minScore?, limit?, cursor?}` → `{items, nextCursor?}` |
|
|
239
|
-
| `update_memory` | `{memoryId, changes: {...}}` → updated memory record |
|
|
236
|
+
| `list_sessions` | `{ownerId?, namespaceId?, includeAll?, limit?, cursor?, sortBy?, sortOrder?}` → `{items: [{sessionId, ownerId?, ...}], nextCursor?}` |
|
|
237
|
+
| `create_memories` | `{memories: [...], idempotencyKey?}` without IDs → `{memoryIds, created, errors?}`; IDs are generated automatically |
|
|
238
|
+
| `get_memory` | `{memoryId}` → memory record with `revision`, first source links, and `documentManaged` |
|
|
239
|
+
| `search_memories` | `{query?, filter?, minScore?, limit?, cursor?, sortBy?, sortOrder?, excludeDocumentManaged?}` → `{items, nextCursor?}` |
|
|
240
|
+
| `update_memory` | `{memoryId, changes: {...}, expectedRevision?, idempotencyKey?}` → updated memory record |
|
|
241
|
+
| `upsert_memory` | `{memoryId, text, ownerId?, sessionId?, memoryType?, topics?, attributes?, namespaceId?, expectedRevision?, idempotencyKey?}` → memory record |
|
|
242
|
+
| `update_memory_fields` | `{memoryId, memoryType, text?, attributes?, namespaceId?, expectedRevision?, idempotencyKey?}` → `{updated: true, memoryId}` |
|
|
243
|
+
| `list_memory_sources` | `{memoryId, limit?, cursor?}` → source links with `nextCursor?` |
|
|
244
|
+
| `list_memory_source_evidence` | `{memoryId, sourceId, limit?, cursor?}` → evidence with `nextCursor?` |
|
|
245
|
+
| `list_source_memories` | `{sourceId, ownerId?, limit?, cursor?}` → memories with `nextCursor?` |
|
|
240
246
|
| `delete_memories` | `{memoryIds: [...]}` → `{deleted, errors?}` |
|
|
241
247
|
| `delete_session_event` | `{sessionId?, eventId}` → deletion confirmation |
|
|
242
248
|
| `delete_session_memory` | `{sessionId?}` → deletion confirmation |
|
|
243
249
|
|
|
244
250
|
`sessionId` is required for retrieval/deletion unless fixed in the scope.
|
|
245
251
|
`role` is `USER`, `ASSISTANT`, or `SYSTEM`. `createdAt` accepts an ISO 8601 string with timezone and defaults to the current time.
|
|
246
|
-
Session
|
|
252
|
+
Session IDs accept 1 to 64 letters, digits, underscores, or hyphens.
|
|
253
|
+
Owner IDs and actor IDs accept 1 to 64 letters, digits, and `_+=.@-`, except `.` and `..`, so `user_42` and `alice@example.com` are valid.
|
|
254
|
+
The store enforces the same rule on every event's actor, so `createSessionEventHook`'s `actorId` and the model wrapper's `assistantId` follow it too.
|
|
255
|
+
An `upsert_memory` ID accepts 1 to 64 letters, digits, underscores, or hyphens.
|
|
256
|
+
`limit` accepts 1 to 100, except `list_sessions`, which accepts 1 to 1000.
|
|
257
|
+
`start_session` fails when the named session already exists, except for a keyed retry that matches its first event.
|
|
258
|
+
A keyed `start_session` requires both `sessionId` and `createdAt`. Without a `sessionId` the store would generate a second session on retry, and without `createdAt` the retry would not be the identical request.
|
|
247
259
|
|
|
248
260
|
A create record contains:
|
|
249
261
|
|
|
@@ -259,19 +271,81 @@ A create record contains:
|
|
|
259
271
|
}
|
|
260
272
|
```
|
|
261
273
|
|
|
262
|
-
The wrapper generates
|
|
274
|
+
The wrapper generates an ID for each create record.
|
|
263
275
|
The agent does not supply an `id`.
|
|
264
|
-
|
|
276
|
+
Without an `idempotencyKey`, the returned `memoryIds` array lists all generated IDs in input order, including any failed records.
|
|
277
|
+
With an `idempotencyKey`, the IDs are derived from the key, so a retry replays the same request, and `memoryIds` keeps the input order and holds `null` for each record the service rejected, so a position always maps to its input record. The rejected record also appears in `errors`.
|
|
278
|
+
In both cases `created` contains successful IDs and `errors` contains per-ID failures.
|
|
265
279
|
Keep successful IDs for later retrieval, updates, and deletion.
|
|
266
280
|
|
|
267
|
-
|
|
281
|
+
Bulk create/delete accepts 1–100 records/IDs and preserves the server's per-record errors.
|
|
282
|
+
Text accepts 1–50,000 characters; topics accept up to 50 tags.
|
|
283
|
+
|
|
284
|
+
### Retries and idempotency keys
|
|
285
|
+
|
|
286
|
+
`start_session`, `add_session_event`, `create_memories`, `update_memory`, `upsert_memory`, and `update_memory_fields` accept an optional `idempotencyKey` of 1 to 255 characters.
|
|
287
|
+
The store treats a key as store-wide: on a live store, a second user reusing another user's key got HTTP 409.
|
|
288
|
+
So the tools do not pass the key unchanged. They send a SHA-256 of the key, the fixed `userId`, `sessionId` and `namespaceId`, and the request target (the memory ID, the session ID, the memory owners of a batch, or the document ID and revision).
|
|
289
|
+
Two users, or two targets, can use the same key without colliding, and an identical retry still sends the identical key.
|
|
290
|
+
`create_document_ingestion` takes the same treatment.
|
|
291
|
+
For memory writes, a retry that reuses the key with the identical request replays the saved result, and the same key with a different request fails with HTTP 409.
|
|
292
|
+
A store that selects an input hook requires the key, and a write without it fails.
|
|
293
|
+
|
|
294
|
+
To retry an uncertain memory write, send the identical request with the same key.
|
|
295
|
+
Session events are different.
|
|
296
|
+
The store may not deduplicate `add_session_event` by the key, so an identical keyed retry can append a second event.
|
|
297
|
+
After an uncertain append, read the session with `get_session_memory` before retrying.
|
|
298
|
+
|
|
299
|
+
Without a key, each `create_memories` call generates fresh UUID v4 IDs.
|
|
268
300
|
If a request times out or its outcome is uncertain, search for the memories before retrying to avoid duplicates.
|
|
269
301
|
Retry only records confirmed to have failed.
|
|
270
302
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
303
|
+
With a key, `create_memories` derives each ID from the key, the record's owner, and the record's position in the batch.
|
|
304
|
+
The ID is 32 lowercase hex characters.
|
|
305
|
+
A retry with the same key, the same records, and the same order produces the same IDs, so the server can replay the saved result.
|
|
306
|
+
Reordering the records or changing an owner changes the IDs.
|
|
307
|
+
|
|
308
|
+
The tools do not retry or deduplicate writes without a key.
|
|
309
|
+
`start_session` with a named `sessionId` checks first that the session does not exist.
|
|
310
|
+
The store refuses to create an existing session even with the same key, so the tool handles a keyed retry itself.
|
|
311
|
+
When the session exists, passes the scope checks, and its first event matches the request's `actorId`, role, text, and any `createdAt`, the tool returns that event without writing.
|
|
312
|
+
Otherwise, and always without a key, the retry fails with that check.
|
|
313
|
+
For a matching retry, send the same `createdAt` as the first attempt.
|
|
314
|
+
|
|
315
|
+
### Updates and revisions
|
|
316
|
+
|
|
317
|
+
`update_memory` changes only the fields in `changes`: `text`, `memoryType`, `topics`, `ownerId`, `sessionId`, and namespace placement.
|
|
318
|
+
Omitted fields stay unchanged.
|
|
319
|
+
An empty `sessionId` clears it when not fixed by scope.
|
|
320
|
+
Per the tool description, a document-managed memory accepts only namespace changes.
|
|
321
|
+
|
|
322
|
+
`upsert_memory` creates a memory under the given ID, or fully replaces the memory with that ID.
|
|
323
|
+
Omitted optional fields are cleared, and `memoryType` defaults to `semantic`.
|
|
324
|
+
Read the memory with `get_memory` first and send every field to keep.
|
|
325
|
+
Per the tool description, document-managed memories cannot be replaced.
|
|
326
|
+
|
|
327
|
+
`update_memory_fields` changes the `text`, the `attributes`, or both of a custom-typed memory.
|
|
328
|
+
It requires at least one of them.
|
|
329
|
+
`memoryType` must match the stored type.
|
|
330
|
+
Pass the memory's current `namespaceId`; omitting it asserts that the memory has no namespace.
|
|
331
|
+
|
|
332
|
+
`update_memory`, `upsert_memory`, and `update_memory_fields` accept `expectedRevision`.
|
|
333
|
+
Read the current `revision` from `get_memory`.
|
|
334
|
+
A stale revision fails with HTTP 412, and the error tells the agent that nothing was written and to call `get_memory` for the current revision before retrying.
|
|
335
|
+
HTTP 409 errors say that the request conflicts with the current state, which covers an existing target, a concurrent change, an archived namespace or one with children, and an `idempotencyKey` used for a different request. They tell the agent to read the current state before retrying.
|
|
336
|
+
|
|
337
|
+
### Memory provenance
|
|
338
|
+
|
|
339
|
+
`list_memory_sources` lists where a memory came from: document revisions or sessions, with their first evidence.
|
|
340
|
+
`list_memory_source_evidence` pages the extraction evidence for one source of that memory, such as document chunks or session event IDs.
|
|
341
|
+
Evidence shows the input given to extraction, not a citation for the fact.
|
|
342
|
+
`list_source_memories` lists one owner's memories derived from a source.
|
|
343
|
+
Get `sourceId` from `list_memory_sources`.
|
|
344
|
+
|
|
345
|
+
`list_source_memories` requires `ownerId` unless the scope fixes `userId`.
|
|
346
|
+
It refuses a result that contains another owner's memory.
|
|
347
|
+
With a fixed namespace, it omits memories outside that namespace, so a page can hold fewer items than `limit`.
|
|
348
|
+
With a fixed user or namespace, `list_memory_sources` and `list_memory_source_evidence` check the memory's owner and placement first.
|
|
275
349
|
|
|
276
350
|
Search filters support `ownerId`, `sessionId`, `topics`, and `memoryType` with exactly one of `{eq}`, `{ne}`, `{in: [...]}`, or `{all: [...]}`.
|
|
277
351
|
`namespaceId` supports `{eq}` or `{in}`. Use `unnamespaced` without namespace selectors. Date comparisons accept ISO strings:
|
|
@@ -294,6 +368,12 @@ Attribute filters accept exactly one of `{string}`, `{number}`, `{boolean}`, or
|
|
|
294
368
|
Omit `query` to list/filter without a semantic query.
|
|
295
369
|
Pagination uses the returned opaque `nextCursor` with the same search parameters.
|
|
296
370
|
|
|
371
|
+
`sortBy` (`createdAt` or `updatedAt`) and `sortOrder` (`ASC` or `DESC`) order a filter-only listing.
|
|
372
|
+
The tool rejects either one combined with `query`.
|
|
373
|
+
`excludeDocumentManaged: true` omits memories produced by document ingestion.
|
|
374
|
+
|
|
375
|
+
`list_sessions` sorts by `sessionId`, `createdAt`, or `updatedAt`, with the same `sortOrder` values.
|
|
376
|
+
|
|
297
377
|
## Identity and scope behavior
|
|
298
378
|
|
|
299
379
|
`scope.userId` identifies the application user.
|
|
@@ -317,9 +397,19 @@ User/namespace-scoped searches require `filter.op: 'ALL'`; an OR filter could by
|
|
|
317
397
|
Direct-ID reads, updates, and deletes check existing ownership/placement before returning or mutating a resource.
|
|
318
398
|
User-scoped resource placements require a PERSONAL namespace owned by that user.
|
|
319
399
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
400
|
+
A scope with only `sessionId` fixes the session for session tools but sets no owner or namespace boundary.
|
|
401
|
+
Without a fixed `userId` or `namespaceId`, `upsert_memory` replaces a memory by ID without an ownership check.
|
|
402
|
+
Document ingestion, namespace routing, and automatic-routing tools are likewise unrestricted.
|
|
403
|
+
Summary View tools and the ingestion hook status tools are store-wide, so a `sessionId`-only toolset refuses them.
|
|
404
|
+
This matches the existing long-term memory tools, which check ownership only under a `userId` or `namespaceId`.
|
|
405
|
+
Set `userId` or `namespaceId` whenever `sessionId` must act as a write boundary.
|
|
406
|
+
|
|
407
|
+
With a fixed session, `list_sessions` returns only that session, or nothing when a `namespaceId` filter names a different namespace than the session's.
|
|
408
|
+
Without a fixed session, `list_sessions` needs an `ownerId`, a `namespaceId`, or explicit `includeAll: true`.
|
|
409
|
+
A fixed `userId` supplies the owner, and a fixed `namespaceId` supplies the namespace.
|
|
410
|
+
A `namespaceId` argument that differs from a fixed namespace is rejected.
|
|
411
|
+
`includeAll` is rejected alongside an owner or a namespace, because the service does not allow it alongside a filter.
|
|
412
|
+
With a namespace scope, `list_sessions` rejects any returned session outside that namespace.
|
|
323
413
|
|
|
324
414
|
Resolved scopes provide application guardrails and use preflight reads.
|
|
325
415
|
Factory scope is only a replaceable default, not an authorization ceiling.
|
|
@@ -331,11 +421,13 @@ Set `namespaceTools: true` on `createRedisAgentMemory(...)` to add:
|
|
|
331
421
|
|
|
332
422
|
| Tool | Parameters |
|
|
333
423
|
| --- | --- |
|
|
334
|
-
| `list_namespaces` | `{parentId?, scope?, ownerId?, limit?, cursor?}` |
|
|
424
|
+
| `list_namespaces` | `{parentId?, scope?, ownerId?, limit?, cursor?, sortBy?, sortOrder?}` |
|
|
335
425
|
| `get_namespace` | `{namespaceId}` |
|
|
336
426
|
| `create_namespace` | `{name?, path?, scope?, parentId?, ownerId?}` |
|
|
337
427
|
| `update_namespace` | `{namespaceId, name?, state?: 'ARCHIVED'}` |
|
|
338
|
-
| `move_memories` | `{memoryIds, namespaceId}` |
|
|
428
|
+
| `move_memories` | `{memoryIds, namespaceId?}` |
|
|
429
|
+
| `get_namespace_routing` | `{}` |
|
|
430
|
+
| `put_namespace_routing` | `{policy}`; only with `routingPolicyWrites: true` |
|
|
339
431
|
| `delete_namespace` | `{namespaceId}`; omitted when deletes are disabled |
|
|
340
432
|
|
|
341
433
|
Create roots with name/scope, children with name/parentId, or a hierarchy with path/scope.
|
|
@@ -345,13 +437,155 @@ A fixed namespace scope prevents creation or moving memories outside that namesp
|
|
|
345
437
|
Legacy namespace scopes cannot enable resource administration tools.
|
|
346
438
|
Archive and delete operations follow the server's rules; deletion is for empty leaf namespaces.
|
|
347
439
|
|
|
440
|
+
`list_namespaces` sorts by `id`, `name`, `createdAt`, or `updatedAt`, and defaults to `id`.
|
|
441
|
+
`sortOrder` is `ASC` or `DESC`, and defaults to `ASC`.
|
|
442
|
+
`limit` accepts 1 to 1000.
|
|
443
|
+
|
|
444
|
+
`move_memories` with a `namespaceId` moves the memories to that active namespace.
|
|
445
|
+
Without a `namespaceId`, it asks the store to route the memories by its routing policy.
|
|
446
|
+
Per the tool description, automatic routing applies only to memories already in a shared namespace; personal and unnamespaced memories keep their placement and get a per-item error.
|
|
447
|
+
A toolset with a fixed `userId` or `namespaceId` refuses automatic routing, because routing can move memories outside the scope.
|
|
448
|
+
|
|
449
|
+
`get_namespace_routing` reads the store-wide routing policy.
|
|
450
|
+
`put_namespace_routing` replaces the whole policy, so read it first and send every rule to keep.
|
|
451
|
+
A toolset with a fixed `userId` or `namespaceId` refuses both tools.
|
|
452
|
+
A policy has this shape:
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
{
|
|
456
|
+
enabled: true,
|
|
457
|
+
rules: [{
|
|
458
|
+
id: 'support-tickets', // 1 to 64 characters
|
|
459
|
+
destinationNamespaceId: 'shared-ns', // a SHARED namespace
|
|
460
|
+
enabled: true,
|
|
461
|
+
action: 'ACCEPT', // or 'REJECT'
|
|
462
|
+
strategies: [
|
|
463
|
+
{ kind: 'LLM_PROMPT', llmPrompt: { prompt: 'Support ticket details' } },
|
|
464
|
+
{ kind: 'MATCHER_SPEC', matcher: { kind: 'REGEX', regex: { pattern: '^TICKET-' } } },
|
|
465
|
+
],
|
|
466
|
+
}],
|
|
467
|
+
}
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Each strategy carries exactly the block that matches its `kind`.
|
|
471
|
+
Regex patterns use RE2 syntax, without lookaround or backreferences.
|
|
472
|
+
|
|
473
|
+
## Optional ingestion tools
|
|
474
|
+
|
|
475
|
+
Set `ingestionTools: true` on `createRedisAgentMemory(...)` to add:
|
|
476
|
+
|
|
477
|
+
| Tool | Parameters |
|
|
478
|
+
| --- | --- |
|
|
479
|
+
| `create_document_ingestion` | `{documentId, revision, content, mediaType, extractorId, ownerId?, idempotencyKey}` |
|
|
480
|
+
| `get_document_ingestion` | `{ingestionId}` |
|
|
481
|
+
| `list_document_ingestion_outputs` | `{ingestionId, limit?, cursor?}` |
|
|
482
|
+
| `get_ingestion_hook_status` | `{eventId}` |
|
|
483
|
+
| `list_ingestion_hook_statuses` | `{limit?, cursor?}` |
|
|
484
|
+
|
|
485
|
+
`create_document_ingestion` submits one revision of a document for asynchronous extraction into long-term memories.
|
|
486
|
+
`content` is plain UTF-8 text, and the tool base64-encodes it.
|
|
487
|
+
`mediaType` is `text/plain` or `text/markdown`.
|
|
488
|
+
`extractorId` is `ex_` followed by 32 hex characters, and must name an extractor configured for documents.
|
|
489
|
+
`idempotencyKey` is required.
|
|
490
|
+
`ownerId` is required unless the scope fixes `userId`.
|
|
491
|
+
A toolset with a fixed `namespaceId` refuses this tool, because the extracted memories cannot be placed in that namespace.
|
|
492
|
+
|
|
493
|
+
Poll `get_document_ingestion` until the processing state is terminal.
|
|
494
|
+
The states are `QUEUED`, `RUNNING`, `SUCCEEDED`, `FAILED`, and `PARTIAL`.
|
|
495
|
+
Then page the created memory IDs with `list_document_ingestion_outputs`.
|
|
496
|
+
A page can be empty while `nextCursor` is present.
|
|
497
|
+
`ingestionId` is `ing_` followed by 32 hex characters.
|
|
498
|
+
|
|
499
|
+
The 1.0.0 ingestion record has no `ownerId`.
|
|
500
|
+
A toolset with a fixed `userId` or `namespaceId` reads an ingestion it submitted itself with `create_document_ingestion`, even before it has produced memories.
|
|
501
|
+
That record lives in the toolset instance, so a new instance, or an ingestion submitted elsewhere, falls back to proving scope through the memories the ingestion produced.
|
|
502
|
+
Both tools then return nothing until at least one output memory passes the scope check.
|
|
503
|
+
They follow `nextCursor` for up to 5 pages of 100 outputs to find one.
|
|
504
|
+
They refuse the read with `INVALID_SCOPE` when none does, and when any returned memory is outside the scope.
|
|
505
|
+
Output IDs whose memory no longer exists are skipped.
|
|
506
|
+
|
|
507
|
+
A scoped toolset therefore cannot poll such an ingestion until it has produced memories.
|
|
508
|
+
Keep one toolset instance for the whole submit-and-poll flow, or use an unscoped toolset to watch it.
|
|
509
|
+
|
|
510
|
+
`get_ingestion_hook_status` reads one ingestion hook decision by the event ID of the write it judged.
|
|
511
|
+
`list_ingestion_hook_statuses` lists recent decisions, newest first.
|
|
512
|
+
Per the tool descriptions, statuses are kept for seven days.
|
|
513
|
+
Use them after a write fails with HTTP 422 (stopped hook) or HTTP 503 (retryable hook).
|
|
514
|
+
With a fixed `userId`, `get_ingestion_hook_status` refuses another owner's status, and `list_ingestion_hook_statuses` omits them, so a page can hold fewer items than `limit`.
|
|
515
|
+
Hook statuses are store-wide.
|
|
516
|
+
A toolset with a fixed `namespaceId` refuses both tools, because statuses carry no namespace.
|
|
517
|
+
|
|
518
|
+
## Optional Summary View tools
|
|
519
|
+
|
|
520
|
+
Set `summaryViewTools: true` on `createRedisAgentMemory(...)` to add:
|
|
521
|
+
|
|
522
|
+
| Tool | Parameters |
|
|
523
|
+
| --- | --- |
|
|
524
|
+
| `list_summary_views` | `{limit?, cursor?}` |
|
|
525
|
+
| `get_summary_view` | `{viewId}` |
|
|
526
|
+
| `create_summary_view` | `{name, description?, visibility?, filter?, groupBy, evictionPolicy?, timeWindowSeconds?, output, refreshPolicy}` |
|
|
527
|
+
| `update_summary_view` | `{viewId, name?, description?, filter?, clearFilter?, groupBy?, evictionPolicy?, timeWindowSeconds?, clearTimeWindow?, output?, refreshPolicy?, state?}` |
|
|
528
|
+
| `refresh_summary_view` | `{viewId, target, partition?}` |
|
|
529
|
+
| `get_summary_view_result` | `{viewId, partition?, includeSourceMemoryIds?}` |
|
|
530
|
+
| `delete_summary_view` | `{viewId}`; omitted when deletes are disabled |
|
|
531
|
+
|
|
532
|
+
A Summary View keeps a generated summary of the long-term memories its `filter` selects.
|
|
533
|
+
`filter` uses the `search_memories` filter shape.
|
|
534
|
+
`groupBy` lists up to four of `ownerId`, `sessionId`, `namespaceId`, and `memoryType`, and splits the view into one partition per distinct value.
|
|
535
|
+
An empty `groupBy` keeps a single summary.
|
|
536
|
+
`output.format` is `TEXT` or `STRUCTURED`; `STRUCTURED` requires `output.schema`, a flat list of fields.
|
|
537
|
+
`refreshPolicy.mode` is `MANUAL` or `CONTINUOUS`; `CONTINUOUS` requires `reconcileIntervalSeconds`.
|
|
538
|
+
`visibility` is `PRIVATE` (the default) or `SHARED`, and cannot change after creation.
|
|
539
|
+
Per the tool description, `PRIVATE` keeps the view to the API caller, not to an application user.
|
|
540
|
+
|
|
541
|
+
`refresh_summary_view` queues an asynchronous refresh.
|
|
542
|
+
`target: 'PARTITION'` refreshes one exact partition, and `target: 'FULL'` reconciles every partition and takes no partition.
|
|
543
|
+
`get_summary_view_result` reads one partition.
|
|
544
|
+
Check its `status` before using `value`.
|
|
545
|
+
`partition` holds one value for each `groupBy` field of the view.
|
|
546
|
+
|
|
547
|
+
### Summary Views under a fixed scope
|
|
548
|
+
|
|
549
|
+
These rules apply when the scope fixes `userId`, `namespaceId`, or both.
|
|
550
|
+
A fixed `sessionId` alone sets no boundary, so a toolset scoped only by `sessionId` refuses every Summary View tool.
|
|
551
|
+
A toolset without a fixed user or namespace has full access to every view.
|
|
552
|
+
|
|
553
|
+
A view's `ownerId` is the API caller, so the tools prove access from the view's `filter` and `groupBy`.
|
|
554
|
+
A fixed field is pinned when the view's filter contains exactly `{eq: <fixed value>}` for it, and the filter is conjunctive.
|
|
555
|
+
`get_summary_view` and `list_summary_views` leave other users and namespaces out of the filter they return. An `in` list shrinks to the fixed value, and `ne` or `all` conditions on a fixed field are dropped.
|
|
556
|
+
The filter on other fields, such as `sessionId`, is returned as saved.
|
|
557
|
+
A filter is conjunctive when `op` is `ALL`, or when `op` is omitted and the field is the filter's only condition.
|
|
558
|
+
`userId` maps to the `ownerId` field, and `namespaceId` maps to the `namespaceId` field.
|
|
559
|
+
|
|
560
|
+
Each view gets one of four access levels:
|
|
561
|
+
|
|
562
|
+
| Level | Condition | Allowed tools |
|
|
563
|
+
| --- | --- | --- |
|
|
564
|
+
| Hidden | A fixed field is neither pinned nor in `groupBy`, or the filter names other values for it (`eq` differs, or `in` omits the fixed value) | None; `list_summary_views` omits it, and the other tools refuse it |
|
|
565
|
+
| Read-only | The view is `SHARED`, and every fixed field that is not pinned is in `groupBy` | `get_summary_view` and `get_summary_view_result` |
|
|
566
|
+
| Read | The view is `PRIVATE`, and every fixed field that is not pinned is in `groupBy` | The read-only tools, plus `refresh_summary_view` with `target: 'PARTITION'` |
|
|
567
|
+
| Manage | The view is `PRIVATE`, and every fixed field is pinned | All read tools, plus `update_summary_view`, `refresh_summary_view` with `target: 'FULL'`, and `delete_summary_view` |
|
|
568
|
+
|
|
569
|
+
A page of `list_summary_views` can hold fewer items than `limit`, because hidden views are omitted.
|
|
570
|
+
|
|
571
|
+
For partition reads and refreshes, the tools fill in each fixed value whose field is in the view's `groupBy`.
|
|
572
|
+
A partition value that conflicts with a fixed value is refused.
|
|
573
|
+
|
|
574
|
+
`create_summary_view` always creates a `PRIVATE` view and refuses `visibility: 'SHARED'`.
|
|
575
|
+
It pins the filter to the fixed user and namespace and sets `op: 'ALL'`, so the new view is at the manage level.
|
|
576
|
+
It refuses a filter with `op: 'ANY'` or a filter that names a different owner or namespace.
|
|
577
|
+
`update_summary_view` requires the manage level, pins a new filter the same way, and refuses `clearFilter`.
|
|
578
|
+
|
|
348
579
|
## Failures and cancellation
|
|
349
580
|
|
|
350
581
|
Tool execution throws `RedisAgentMemoryToolError` with a safe `code`, message, and optional HTTP `statusCode`.
|
|
351
582
|
Upstream headers, bodies, and API keys are not passed into model context.
|
|
352
583
|
Cancellation is surfaced as `AbortError`.
|
|
353
584
|
Bulk results retain partial errors so the agent can identify individual failures.
|
|
354
|
-
An uncertain memory creation or session append can already have committed
|
|
585
|
+
An uncertain memory creation or session append can already have committed.
|
|
586
|
+
Retry a memory write with the same `idempotencyKey` and identical input, or reconcile its outcome before retrying without a key.
|
|
587
|
+
The store may not deduplicate session appends by key, so read the session with `get_session_memory` before retrying an uncertain `add_session_event`.
|
|
588
|
+
Scope refusals use the code `INVALID_SCOPE`.
|
|
355
589
|
|
|
356
590
|
Automatic summary/promotion behavior belongs to the Redis Agent Memory store configuration.
|
|
357
591
|
Deleting session history does not cascade to promoted long-term memories.
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,qBAAa,yBAA0B,SAAQ,KAAK;aACtB,IAAI,EAAE,MAAM;aAAmC,UAAU,CAAC,EAAE,MAAM;gBAAlE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAkB,UAAU,CAAC,EAAE,MAAM,YAAA;CAG/F;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,qBAAa,yBAA0B,SAAQ,KAAK;aACtB,IAAI,EAAE,MAAM;aAAmC,UAAU,CAAC,EAAE,MAAM;gBAAlE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAkB,UAAU,CAAC,EAAE,MAAM,YAAA;CAG/F;AAOD,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAO7E"}
|
package/dist/errors.js
CHANGED
|
@@ -9,13 +9,17 @@ export class RedisAgentMemoryToolError extends Error {
|
|
|
9
9
|
this.name = 'IrisToolError';
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
const statusGuidance = {
|
|
13
|
+
409: 'The request conflicts with the current state: the target already exists, changed concurrently, is archived or still has children, or the idempotencyKey was already used for a different request. Read the current state before retrying. Reuse an idempotencyKey only for the identical request.',
|
|
14
|
+
412: 'The memory changed after expectedRevision was read, so nothing was written. Call get_memory for the current revision, reapply the change to it, and send that revision as expectedRevision.',
|
|
15
|
+
};
|
|
12
16
|
/** Share safe SDK error handling between model tools and application hooks. */
|
|
13
17
|
export function sanitizeMemoryError(error) {
|
|
14
18
|
if (error instanceof RedisAgentMemoryToolError)
|
|
15
19
|
return error;
|
|
16
20
|
const code = typeof error === 'object' && error !== null && 'statusCode' in error && typeof error.statusCode === 'number'
|
|
17
21
|
? error.statusCode : undefined;
|
|
18
|
-
return new RedisAgentMemoryToolError(code ? `IRIS_HTTP_${code}` : 'IRIS_REQUEST_FAILED', code ? `Iris request failed (HTTP ${code}). Check service configuration and request scope. Writes may have partially succeeded; verify before retrying
|
|
22
|
+
return new RedisAgentMemoryToolError(code ? `IRIS_HTTP_${code}` : 'IRIS_REQUEST_FAILED', code ? `Iris request failed (HTTP ${code}). ${statusGuidance[code] ?? 'Check service configuration and request scope. Writes may have partially succeeded; verify before retrying.'}`
|
|
19
23
|
: 'Iris request failed. Check connectivity and service configuration. Verify writes before retrying.', code);
|
|
20
24
|
}
|
|
21
25
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACtB;IAA+C;IAA3E,YAA4B,IAAY,EAAE,OAAe,EAAkB,UAAmB;QAC5F,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAQ;QAAmC,eAAU,GAAV,UAAU,CAAS;QAC5E,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9C,CAAC;CACF;AAED,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,YAAY,yBAAyB;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,YAAY,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;QACvH,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IACjC,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC,qBAAqB,EACrF,IAAI,CAAC,CAAC,CAAC,6BAA6B,IAAI,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACtB;IAA+C;IAA3E,YAA4B,IAAY,EAAE,OAAe,EAAkB,UAAmB;QAC5F,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAQ;QAAmC,eAAU,GAAV,UAAU,CAAS;QAC5E,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9C,CAAC;CACF;AAED,MAAM,cAAc,GAA2B;IAC7C,GAAG,EAAE,mSAAmS;IACxS,GAAG,EAAE,6LAA6L;CACnM,CAAC;AAEF,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,YAAY,yBAAyB;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,YAAY,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;QACvH,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IACjC,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC,qBAAqB,EACrF,IAAI,CAAC,CAAC,CAAC,6BAA6B,IAAI,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,6GAA6G,EAAE;QACnL,CAAC,CAAC,mGAAmG,EAAE,IAAI,CAAC,CAAC;AACnH,CAAC","sourcesContent":["/** Safe error details suitable for an AI SDK tool result. Never attach upstream bodies or headers. */\nexport class RedisAgentMemoryToolError extends Error {\n constructor(public readonly code: string, message: string, public readonly statusCode?: number) {\n super(message); this.name = 'IrisToolError';\n }\n}\n\nconst statusGuidance: Record<number, string> = {\n 409: 'The request conflicts with the current state: the target already exists, changed concurrently, is archived or still has children, or the idempotencyKey was already used for a different request. Read the current state before retrying. Reuse an idempotencyKey only for the identical request.',\n 412: 'The memory changed after expectedRevision was read, so nothing was written. Call get_memory for the current revision, reapply the change to it, and send that revision as expectedRevision.',\n};\n\n/** Share safe SDK error handling between model tools and application hooks. */\nexport function sanitizeMemoryError(error: unknown): RedisAgentMemoryToolError {\n if (error instanceof RedisAgentMemoryToolError) return error;\n const code = typeof error === 'object' && error !== null && 'statusCode' in error && typeof error.statusCode === 'number'\n ? error.statusCode : undefined;\n return new RedisAgentMemoryToolError(code ? `IRIS_HTTP_${code}` : 'IRIS_REQUEST_FAILED',\n code ? `Iris request failed (HTTP ${code}). ${statusGuidance[code] ?? 'Check service configuration and request scope. Writes may have partially succeeded; verify before retrying.'}`\n : 'Iris request failed. Check connectivity and service configuration. Verify writes before retrying.', code);\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,14 @@ export type { RedisAgentMemoryScope } from './scoped-memory.js';
|
|
|
10
10
|
interface RedisAgentMemoryToolOptions {
|
|
11
11
|
/** Expose deletion tools. Defaults to false. */
|
|
12
12
|
allowDeletes?: boolean;
|
|
13
|
-
/** Expose namespace administration tools. Defaults to false. */
|
|
13
|
+
/** Expose namespace administration and store-wide routing tools. Defaults to false. */
|
|
14
14
|
namespaceTools?: boolean;
|
|
15
|
+
/** With namespaceTools, also expose put_namespace_routing, which replaces the store-wide routing policy. Defaults to false. */
|
|
16
|
+
routingPolicyWrites?: boolean;
|
|
17
|
+
/** Expose document ingestion and ingestion hook status tools. Defaults to false. */
|
|
18
|
+
ingestionTools?: boolean;
|
|
19
|
+
/** Expose Summary View tools. Defaults to false. */
|
|
20
|
+
summaryViewTools?: boolean;
|
|
15
21
|
/** HTTP request timeout in milliseconds. Defaults to 30,000. Must be positive and finite. */
|
|
16
22
|
timeoutMs?: number;
|
|
17
23
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|