@sapiom/tools 0.17.2 → 0.19.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/_generated/version.d.ts +1 -1
  4. package/dist/cjs/_generated/version.js +1 -1
  5. package/dist/cjs/client.d.ts +23 -8
  6. package/dist/cjs/client.d.ts.map +1 -1
  7. package/dist/cjs/client.js +9 -3
  8. package/dist/cjs/client.js.map +1 -1
  9. package/dist/cjs/index.d.ts +2 -0
  10. package/dist/cjs/index.d.ts.map +1 -1
  11. package/dist/cjs/index.js +4 -1
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/memory/errors.d.ts +11 -6
  14. package/dist/cjs/memory/errors.d.ts.map +1 -1
  15. package/dist/cjs/memory/errors.js +11 -6
  16. package/dist/cjs/memory/errors.js.map +1 -1
  17. package/dist/cjs/memory/index.d.ts +116 -217
  18. package/dist/cjs/memory/index.d.ts.map +1 -1
  19. package/dist/cjs/memory/index.js +50 -97
  20. package/dist/cjs/memory/index.js.map +1 -1
  21. package/dist/cjs/stub/index.d.ts +0 -4
  22. package/dist/cjs/stub/index.d.ts.map +1 -1
  23. package/dist/cjs/stub/index.js +144 -30
  24. package/dist/cjs/stub/index.js.map +1 -1
  25. package/dist/cjs/vault/errors.d.ts +19 -0
  26. package/dist/cjs/vault/errors.d.ts.map +1 -0
  27. package/dist/cjs/vault/errors.js +39 -0
  28. package/dist/cjs/vault/errors.js.map +1 -0
  29. package/dist/cjs/vault/index.d.ts +44 -0
  30. package/dist/cjs/vault/index.d.ts.map +1 -0
  31. package/dist/cjs/vault/index.js +91 -0
  32. package/dist/cjs/vault/index.js.map +1 -0
  33. package/dist/esm/_generated/version.d.ts +1 -1
  34. package/dist/esm/_generated/version.js +1 -1
  35. package/dist/esm/client.d.ts +23 -8
  36. package/dist/esm/client.d.ts.map +1 -1
  37. package/dist/esm/client.js +9 -3
  38. package/dist/esm/client.js.map +1 -1
  39. package/dist/esm/index.d.ts +2 -0
  40. package/dist/esm/index.d.ts.map +1 -1
  41. package/dist/esm/index.js +2 -0
  42. package/dist/esm/index.js.map +1 -1
  43. package/dist/esm/memory/errors.d.ts +11 -6
  44. package/dist/esm/memory/errors.d.ts.map +1 -1
  45. package/dist/esm/memory/errors.js +11 -6
  46. package/dist/esm/memory/errors.js.map +1 -1
  47. package/dist/esm/memory/index.d.ts +116 -217
  48. package/dist/esm/memory/index.d.ts.map +1 -1
  49. package/dist/esm/memory/index.js +48 -94
  50. package/dist/esm/memory/index.js.map +1 -1
  51. package/dist/esm/stub/index.d.ts +0 -4
  52. package/dist/esm/stub/index.d.ts.map +1 -1
  53. package/dist/esm/stub/index.js +144 -30
  54. package/dist/esm/stub/index.js.map +1 -1
  55. package/dist/esm/vault/errors.d.ts +19 -0
  56. package/dist/esm/vault/errors.d.ts.map +1 -0
  57. package/dist/esm/vault/errors.js +34 -0
  58. package/dist/esm/vault/errors.js.map +1 -0
  59. package/dist/esm/vault/index.d.ts +44 -0
  60. package/dist/esm/vault/index.d.ts.map +1 -0
  61. package/dist/esm/vault/index.js +84 -0
  62. package/dist/esm/vault/index.js.map +1 -0
  63. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  64. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  65. package/package.json +2 -2
  66. package/src/memory/README.md +82 -37
@@ -1,125 +1,97 @@
1
1
  /**
2
- * Tenant-scoped long-term memory on the Sapiom memory gateway.
2
+ * Tenant-scoped long-term memory backed by the Sapiom memory service.
3
3
  *
4
4
  * import { memory } from "@sapiom/tools"; // ambient auth
5
- * const { id } = await memory.append({ content: "User prefers dark mode.", scope: "user" });
6
- * const { results } = await memory.recall({ query: "ui preferences", topK: 5 });
7
- * const record = await memory.get(id);
8
- * await memory.forget(id);
5
+ * const { id } = await memory.append({ content: "User prefers dark mode.", namespace: "user-42" });
6
+ * const { results } = await memory.recall({ query: "ui preferences", namespace: "user-42", topK: 5 });
7
+ * await memory.forget({ ids: [id], namespace: "user-42" });
8
+ * await memory.drop("user-42");
9
9
  *
10
10
  * Or via an explicit client: `createClient({ apiKey }).memory.append(...)`.
11
11
  *
12
- * The gateway speaks camelCase JSON, so this client keeps request and response
13
- * objects 1:1 with the wire contract.
12
+ * Memory is durable knowledge, not chat history: `recall` ranks by relevance to
13
+ * the query, never by recency — keep last-N-turns context in your own store.
14
+ *
15
+ * The memory service speaks camelCase JSON, so this client keeps request and
16
+ * response objects 1:1 with the wire contract.
14
17
  */
15
18
  import { Transport } from "../_client/index.js";
16
19
  import { MemoryHttpError } from "./errors.js";
17
20
  export { MemoryHttpError };
18
- /** Storage backend selector. Omit for the v0 default `"neon-pgvector"`. */
19
- export declare const MEMORY_BACKENDS: readonly ["neon-pgvector", "upstash-vector"];
20
- export type MemoryBackend = (typeof MEMORY_BACKENDS)[number];
21
- /** Embedding model selector. Omit for the default OpenRouter text-embedding-3-small embedder. */
22
- export interface MemoryEmbedder {
23
- /**
24
- * Embedding provider. The gateway is authoritative for provider support and
25
- * returns 400 for unknown providers; v0 currently supports `"openrouter"`.
26
- */
27
- provider: string;
28
- /**
29
- * Embedding model. A model is part of the store identity, so a write and all
30
- * later reads must use the same model. The gateway is authoritative for model
31
- * support and returns 400 for unknown models.
32
- */
33
- model: string;
34
- }
21
+ /** A metadata leaf value. Strings, numbers, and booleans only no arrays, no nulls. */
22
+ export type MemoryMetadataValue = string | number | boolean;
35
23
  /**
36
- * Optional store selector. Omit for the default Neon store.
24
+ * Metadata stored alongside a memory: a FLAT map of identifier keys (letter
25
+ * first; `.` is reserved and rejected) to string/number/boolean values.
26
+ * No nesting, no arrays, no nulls — violations are a 400 `invalid_metadata`.
27
+ * Express hierarchy through key naming conventions (e.g. `env_prod`,
28
+ * `user_theme`). Bounds (enforced server-side): up to 20 keys per memory, each
29
+ * key at most 64 bytes, and string values at most 512 characters.
37
30
  *
38
- * A memory is only visible from the store it was written to. If you set any of
39
- * these fields on append, pass the same `store` to recall/get/forget/sweep.
31
+ * A key's value TYPE is pinned per namespace at its first write and is
32
+ * immutable after a later write with a conflicting type is a 400
33
+ * `invalid_metadata` naming the key, so keep each key's type consistent
34
+ * within a namespace. Numbers are stored as floats (integers and fractional
35
+ * values mix freely on one key).
36
+ *
37
+ * Metadata keys are usable as hard {@link RecallInput.filter} keys. For
38
+ * better performance, use `namespace` for a key you'd filter on every
39
+ * recall — metadata suits optionally-filtered dimensions.
40
40
  */
41
- export interface MemoryStore {
42
- /**
43
- * Storage backend. Default: `"neon-pgvector"`. `"upstash-vector"` is experimental
44
- * and does not support keyword recall or sweep.
45
- */
46
- backend?: MemoryBackend;
47
- /**
48
- * Embedding model. Default: OpenRouter `"openai/text-embedding-3-small"`.
49
- */
50
- embedder?: MemoryEmbedder;
51
- /**
52
- * Physical isolation namespace. Use to separate projects/tenants under one
53
- * owner. 1-100 chars, `[a-zA-Z0-9_-]`.
54
- */
55
- namespace?: string;
56
- }
41
+ export type MemoryMetadata = Record<string, MemoryMetadataValue>;
42
+ /** Metadata as it comes back on reads — the same flat shape as {@link MemoryMetadata}. */
43
+ export type StoredMemoryMetadata = MemoryMetadata;
57
44
  export interface AppendInput {
58
45
  /**
59
- * Text to store as a memory (1–32,000 chars). Must not contain secrets — the
60
- * gateway runs an admission gate and rejects API keys / tokens / passwords with
61
- * a 400 (`error: "SecretDetected"`, `decision: "REJECTED"`) before anything is
62
- * embedded or stored.
46
+ * Text to store as a memory. Must not contain secrets — API keys / tokens /
47
+ * passwords are rejected server-side with a 400 (`secret_detected`) before
48
+ * anything is embedded or stored. At most 32,000 characters; oversized
49
+ * content is rejected with a 400.
63
50
  */
64
51
  content: string;
65
52
  /**
66
- * Scope label grouping related memories (e.g. "session", "user", "project").
67
- * Alphanumeric plus hyphens/underscores, 1–100 chars. Defaults to "default".
53
+ * Isolation namespace this memory lives in. Reads only ever see one namespace,
54
+ * and {@link drop} deletes one namespace wholesale.
55
+ *
56
+ * Default to a namespace per agent, per user, or per project. A namespace has
57
+ * bounded capacity, so prefer many small namespaces over one large one; put
58
+ * subsets in a single namespace (distinguished by `metadata` + recall `filter`)
59
+ * only when one recall must span them. Omit for your owner's default namespace.
60
+ * 1–100 characters, limited to letters, digits, `-`, and `_`.
68
61
  */
69
- scope?: string;
62
+ namespace?: string;
70
63
  /**
71
- * Arbitrary JSON stored alongside the memory and returned on read. Opaque to
72
- * ranking (not embedded), but usable as a hard `filter` on recall. Max 10 KB when
73
- * JSON-serialized.
64
+ * Flat metadata stored with the memory and returned on recall see
65
+ * {@link MemoryMetadata}. Opaque to ranking (not embedded); keys are usable
66
+ * as a hard `filter` on recall.
74
67
  */
75
- metadata?: Record<string, unknown>;
68
+ metadata?: MemoryMetadata;
76
69
  /**
77
70
  * Event-time this memory is *about* (ISO-8601), distinct from `createdAt` (the
78
71
  * server ingestion time). Drives temporal recall weighting. When omitted, the
79
- * gateway stores `null` and temporal recall falls back to `createdAt`.
72
+ * service stores `null` and temporal recall falls back to `createdAt`.
80
73
  */
81
74
  occurredAt?: string;
82
- /** Optional store selector. Omit for the default store. See {@link MemoryStore}. */
83
- store?: MemoryStore;
84
75
  }
85
76
  export interface AppendResult {
86
- /**
87
- * UUID of the memory. For `decision: "ADDED"` this is the newly created record;
88
- * for `decision: "NOOP"` it is the existing memory that was echoed (nothing was
89
- * written).
90
- */
77
+ /** Id of the stored memory. Keep it to `forget` the memory later. */
91
78
  id: string;
92
79
  /** The stored content, echoed back. */
93
80
  content: string;
94
- /** The resolved scope label ("default" when you omitted it). */
95
- scope: string;
96
- /**
97
- * What the gateway did, made legible (never a silent write):
98
- * - `"ADDED"` — a new memory was written to the append-log.
99
- * - `"NOOP"` — byte-identical content or a near-exact semantic duplicate in the
100
- * same owner + scope; the existing memory is echoed and nothing is written.
101
- *
102
- * A secret caught by the admission gate is *not* a decision here — it surfaces as
103
- * a 400 {@link MemoryHttpError} whose body carries `decision: "REJECTED"`.
104
- */
105
- decision: "ADDED" | "NOOP";
106
- /** ISO-8601 timestamp when the memory was created (server ingestion time). */
81
+ /** ISO-8601 acknowledgement timestamp (the authoritative record timestamps return on recall). */
107
82
  createdAt: string;
108
- /**
109
- * ISO-8601 event-time this memory is *about*, or `null` when none was supplied on
110
- * append (the gateway does not backfill it with `createdAt`).
111
- */
112
- occurredAt: string | null;
113
- /** The stored metadata (`{}` when none was provided). */
114
- metadata: Record<string, unknown>;
83
+ /** The stored metadata. Omitted when none was provided (never `{}`). */
84
+ metadata?: StoredMemoryMetadata;
85
+ /** ISO-8601 event-time this memory is *about*. Omitted when none was supplied. */
86
+ occurredAt?: string;
115
87
  }
116
88
  /**
117
89
  * Retrieval strategy for {@link recall}:
118
- * - `"cosine"` dense vector similarity (default; supported on every backend).
119
- * - `"keyword"` full-text / BM25 ranking. Neon-only; requesting it on a backend
120
- * that doesn't support it is a 400 {@link MemoryHttpError} (never degraded).
90
+ * - `"semantic"` ranks by meaning; the default.
91
+ * - `"keyword"` matches exact terms and identifiers.
92
+ * - `"hybrid"` — fuses semantic and keyword ranking (opt-in).
121
93
  */
122
- export type RetrievalStrategy = "cosine" | "keyword";
94
+ export type RetrievalStrategy = "semantic" | "keyword" | "hybrid";
123
95
  /** Time-decay weighting for {@link RecallInput.weight}. Optional; omit for pure relevance. */
124
96
  export interface TemporalWeight {
125
97
  /**
@@ -128,8 +100,9 @@ export interface TemporalWeight {
128
100
  */
129
101
  center?: string;
130
102
  /**
131
- * Half-life in days (1–365, default 30): a memory whose `occurredAt` is this far
132
- * from `center` keeps half its relevance. Smaller = sharper recency preference.
103
+ * Half-life in days: a memory whose `occurredAt` is this far from `center`
104
+ * keeps half its relevance. Smaller = sharper recency preference. Defaults to
105
+ * 30 when omitted (bounds: 1–365).
133
106
  */
134
107
  halfLifeDays?: number;
135
108
  }
@@ -138,17 +111,32 @@ export interface RecallWeight {
138
111
  /** Multiplicative time-decay applied to each match's base similarity. */
139
112
  temporal?: TemporalWeight;
140
113
  }
114
+ /** A filter value: a scalar to match exactly, or `{ in: [...] }` to match any of a set. */
115
+ export type MemoryFilterValue = MemoryMetadataValue | {
116
+ in: MemoryMetadataValue[];
117
+ };
118
+ /**
119
+ * Hard metadata filter for {@link recall}: keys are your metadata keys, values
120
+ * match exactly (scalar) or against a set (`{ in: [...] }`). Applied before
121
+ * ranking. A malformed key or value shape is a 400 (`invalid_filter`).
122
+ */
123
+ export type MemoryFilter = Record<string, MemoryFilterValue>;
141
124
  export interface RecallInput {
142
- /** Natural-language search text (1–4,096 chars). Embedded and compared against stored memories. */
125
+ /**
126
+ * Natural-language search text. Embedded and compared against stored memories.
127
+ * At most 4,096 characters.
128
+ */
143
129
  query: string;
144
- /** Restrict the search to this scope label. Omit to search every scope for your owner. */
145
- scope?: string;
146
- /** Maximum number of results to return (1–50). Defaults to 5. */
130
+ /**
131
+ * Namespace to search. A recall never spans namespaces — see
132
+ * {@link AppendInput.namespace} for how to partition. Omit for your owner's
133
+ * default namespace.
134
+ */
135
+ namespace?: string;
136
+ /** Maximum number of results to return. Defaults to 5; at most 50. */
147
137
  topK?: number;
148
- /** Minimum score [0–1]; matches below it are dropped. Defaults to 0. */
149
- minSimilarity?: number;
150
138
  /**
151
- * Retrieval strategy — `"cosine"` (default) or `"keyword"` (Neon-only). See
139
+ * Retrieval strategy — `"semantic"` (default), `"keyword"`, or `"hybrid"`. See
152
140
  * {@link RetrievalStrategy}.
153
141
  */
154
142
  strategy?: RetrievalStrategy;
@@ -158,161 +146,72 @@ export interface RecallInput {
158
146
  */
159
147
  weight?: RecallWeight;
160
148
  /**
161
- * Hard metadata filter. Neon uses JSONB containment; Upstash supports scalar
162
- * equality filters. Applied before ranking; max 4 KB serialized.
149
+ * Hard metadata filter see {@link MemoryFilter}. For better performance,
150
+ * use `namespace` for a dimension you'd filter on every recall — `filter`
151
+ * suits optionally-filtered subsets. Up to 20 keys; an `{ in: [...] }` set
152
+ * holds at most 64 values.
163
153
  */
164
- filter?: Record<string, unknown>;
165
- /** Optional store selector. Pass the same store used at write time. See {@link MemoryStore}. */
166
- store?: MemoryStore;
154
+ filter?: MemoryFilter;
167
155
  }
168
156
  export interface RecallMatch {
169
- /** UUID of the memory. */
157
+ /** Id of the memory. */
170
158
  id: string;
171
159
  /** The stored content. */
172
160
  content: string;
173
- /** The scope label. */
174
- scope: string;
175
161
  /**
176
- * Canonical [0–1] relevance the matches are ranked and thresholded on (highest
177
- * first). Provider-neutral: an opaque backend reports only this single score.
162
+ * Relevance the matches are ranked on (highest first). Strategy-relative: scores
163
+ * are comparable within one response, not across strategies or queries.
178
164
  */
179
165
  score: number;
180
- /**
181
- * Optional backend-specific score legs. A backend may fill this with its own
182
- * components; most dense-only paths omit it entirely. This is an open map —
183
- * don't assume a fixed set of keys.
184
- */
185
- scoreBreakdown?: Record<string, number>;
186
166
  /** ISO-8601 timestamp when the memory was created. */
187
167
  createdAt: string;
188
168
  /** ISO-8601 event-time this memory is *about*, or `null` when none was supplied. */
189
169
  occurredAt: string | null;
190
- /** ISO-8601 timestamp this memory was last read, or `null` if never recalled since creation. */
191
- lastAccessedAt: string | null;
192
- /** The stored metadata. */
193
- metadata: Record<string, unknown>;
170
+ /** The stored metadata, or `null` when the record carries none. */
171
+ metadata: StoredMemoryMetadata | null;
194
172
  }
195
173
  export interface RecallResponse {
196
- /** Matches ranked by `score` (highest first). Empty when nothing matched or no store exists yet. */
174
+ /** Matches ranked by `score` (highest first). Empty when nothing matched. */
197
175
  results: RecallMatch[];
198
176
  /** The query, echoed back. */
199
177
  query: string;
200
- /** The effective top-K used by the gateway. */
178
+ /** The effective top-K applied server-side. */
201
179
  topK: number;
202
180
  /** Number of results returned (≤ `topK`). */
203
181
  count: number;
204
182
  }
205
- export interface Memory {
206
- /** UUID of the memory. */
207
- id: string;
208
- /** The stored content. */
209
- content: string;
210
- /** The scope label. */
211
- scope: string;
212
- /** ISO-8601 timestamp when the memory was created (server ingestion time). */
213
- createdAt: string;
214
- /** ISO-8601 event-time this memory is *about*, or `null` when none was supplied. */
215
- occurredAt: string | null;
216
- /** ISO-8601 timestamp this memory was last read, or `null` if never recalled since creation. */
217
- lastAccessedAt: string | null;
218
- /** The stored metadata. */
219
- metadata: Record<string, unknown>;
220
- }
221
- /**
222
- * Eviction order for {@link sweep}:
223
- * - `"lru"` — least-recently-accessed first (`lastAccessedAt` ascending). Default.
224
- * - `"oldest"` — oldest-inserted first (`createdAt` ascending).
225
- */
226
- export type SweepStrategy = "lru" | "oldest";
227
- export interface SweepInput {
228
- /**
229
- * Maximum number of memories to preview/delete (1–10,000). Omit to use the
230
- * gateway's default sweep batch (100 rows).
231
- */
232
- count?: number;
233
- /** Eviction order — `"lru"` (default) or `"oldest"`. See {@link SweepStrategy}. */
234
- strategy?: SweepStrategy;
235
- /**
236
- * Preview vs delete. **Defaults to `true`** (a safe preview): the gateway returns
237
- * the `candidates` it would evict without deleting anything (`evicted: 0`). Pass
238
- * `false` to actually evict.
239
- */
240
- dryRun?: boolean;
241
- /** Optional store selector. Sweep is Neon-only. See {@link MemoryStore}. */
242
- store?: MemoryStore;
243
- }
244
- /** A memory that a `sweep` would evict. */
245
- export interface MemorySweepCandidate {
246
- /** UUID of the memory. */
247
- id: string;
248
- /** The stored content. */
249
- content: string;
250
- /** The scope label. */
251
- scope: string;
252
- /** ISO-8601 timestamp when the memory was created. */
253
- createdAt: string;
254
- /** ISO-8601 timestamp this memory was last read, or `null` if never recalled since creation. */
255
- lastAccessedAt: string | null;
256
- }
257
- export interface MemorySweepResponse {
258
- /** Number of memories evicted (`0` on a `dryRun`). */
259
- evicted: number;
260
- /**
261
- * The memories that *would* be evicted — present on a `dryRun` (the default).
262
- * Review them, then {@link forget} specific ids or re-run `sweep` with
263
- * `dryRun: false`.
264
- */
265
- candidates?: MemorySweepCandidate[];
266
- }
267
- /** Per-call options for {@link get} and {@link forget}. */
268
- export interface MemoryCallOptions {
269
- /** Optional store selector. Pass the same store used at write time. See {@link MemoryStore}. */
270
- store?: MemoryStore;
183
+ export interface ForgetInput {
184
+ /** Ids of the memories to forget. Up to 100 per call. */
185
+ ids: string[];
186
+ /** Namespace the memories live in. Omit for your owner's default namespace. */
187
+ namespace?: string;
271
188
  }
272
189
  /**
273
- * Append a memory to the store (an append-log — no prior memory is mutated). The
274
- * gateway runs a secret-detection gate first (a detected secret is rejected with a
275
- * 400 {@link MemoryHttpError}, body `decision: "REJECTED"`), then embeds the
276
- * content and writes it, returning `decision: "ADDED"`.
277
- *
278
- * Byte-identical content, or a near-exact semantic duplicate, in the same owner +
279
- * scope is a no-op that echoes the existing memory unchanged (`decision: "NOOP"`);
280
- * nothing new is written.
281
- *
282
- * On a full Neon store the gateway returns `507` ({@link MemoryHttpError}); call
283
- * {@link sweep} (or {@link forget}) to free space, then retry. On Upstash, first
284
- * provisioning can return `422` when the account/index limit is reached.
190
+ * Append one memory (an append-log — no prior memory is mutated). A
191
+ * secret-detection gate runs first server-side (a detected secret is a 400
192
+ * {@link MemoryHttpError}, `secret_detected`), then the content is embedded and
193
+ * written.
285
194
  */
286
195
  export declare function append(input: AppendInput, transport?: Transport, baseUrl?: string): Promise<AppendResult>;
287
196
  /**
288
197
  * Recall memories by natural-language query. Returns the top-K matches ranked by
289
- * score; an empty list when nothing matches or no memory store has been provisioned
290
- * yet (not an error).
198
+ * score; an empty list when nothing matches (not an error).
291
199
  *
292
- * After the route gate succeeds, infra, child billing, rate-limit, and timeout
293
- * failures degrade to an empty result set. Bad requests, missing identity, and
294
- * ownership failures (`400`/`401`/`403`) surface as {@link MemoryHttpError}.
200
+ * Recall is relevance search over one namespace, not a recency view — it is not
201
+ * a way to page through chat history. Bad requests (`invalid_filter`), missing
202
+ * identity, and ownership failures surface as {@link MemoryHttpError};
203
+ * infrastructure failures surface as 502/504.
295
204
  */
296
205
  export declare function recall(input: RecallInput, transport?: Transport, baseUrl?: string): Promise<RecallResponse>;
297
206
  /**
298
- * Sweep (evict) memories to reclaim space consumer-triggered, never automatic.
299
- * Call it after a `507` on {@link append}, or proactively to compact the store.
300
- * Eviction is Neon-only today; a store with nothing to sweep returns `{ evicted: 0 }`.
301
- *
302
- * `dryRun` **defaults to `true`**: the gateway returns the `candidates` it would
303
- * evict without deleting anything — review them, then {@link forget} specific ids
304
- * or re-run with `dryRun: false` to actually evict.
305
- */
306
- export declare function sweep(input?: SweepInput, transport?: Transport, baseUrl?: string): Promise<MemorySweepResponse>;
307
- /**
308
- * Fetch a single memory by id. Throws {@link MemoryHttpError} with `status: 404`
309
- * when the memory doesn't exist or belongs to another owner (existence is not
310
- * leaked across owners).
207
+ * Forget (hard-delete) memories by id. Idempotent and blind: missing or
208
+ * already-deleted ids are treated as success.
311
209
  */
312
- export declare function get(id: string, transport?: Transport, baseUrl?: string, options?: MemoryCallOptions): Promise<Memory>;
210
+ export declare function forget(input: ForgetInput, transport?: Transport, baseUrl?: string): Promise<void>;
313
211
  /**
314
- * Forget (hard-delete) a memory by id. Idempotent: a missing or already-deleted
315
- * id is treated as success by the gateway.
212
+ * Drop an entire namespace: every memory in it is deleted and a later append to
213
+ * the same name starts a fresh namespace. Idempotent: dropping a namespace that
214
+ * doesn't exist is success.
316
215
  */
317
- export declare function forget(id: string, transport?: Transport, baseUrl?: string, options?: MemoryCallOptions): Promise<void>;
216
+ export declare function drop(namespace: string, transport?: Transport, baseUrl?: string): Promise<void>;
318
217
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,CAAC;AAiB3B,2EAA2E;AAC3E,eAAO,MAAM,eAAe,8CAA+C,CAAC;AAC5E,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,iGAAiG;AACjG,MAAM,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