@sapiom/tools 0.18.0 → 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.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/cjs/_generated/version.d.ts +1 -1
- package/dist/cjs/_generated/version.js +1 -1
- package/dist/cjs/client.d.ts +11 -8
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +2 -3
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/memory/errors.d.ts +11 -6
- package/dist/cjs/memory/errors.d.ts.map +1 -1
- package/dist/cjs/memory/errors.js +11 -6
- package/dist/cjs/memory/errors.js.map +1 -1
- package/dist/cjs/memory/index.d.ts +116 -217
- package/dist/cjs/memory/index.d.ts.map +1 -1
- package/dist/cjs/memory/index.js +50 -97
- package/dist/cjs/memory/index.js.map +1 -1
- package/dist/cjs/stub/index.d.ts +0 -4
- package/dist/cjs/stub/index.d.ts.map +1 -1
- package/dist/cjs/stub/index.js +136 -30
- package/dist/cjs/stub/index.js.map +1 -1
- package/dist/esm/_generated/version.d.ts +1 -1
- package/dist/esm/_generated/version.js +1 -1
- package/dist/esm/client.d.ts +11 -8
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +2 -3
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/memory/errors.d.ts +11 -6
- package/dist/esm/memory/errors.d.ts.map +1 -1
- package/dist/esm/memory/errors.js +11 -6
- package/dist/esm/memory/errors.js.map +1 -1
- package/dist/esm/memory/index.d.ts +116 -217
- package/dist/esm/memory/index.d.ts.map +1 -1
- package/dist/esm/memory/index.js +48 -94
- package/dist/esm/memory/index.js.map +1 -1
- package/dist/esm/stub/index.d.ts +0 -4
- package/dist/esm/stub/index.d.ts.map +1 -1
- package/dist/esm/stub/index.js +136 -30
- package/dist/esm/stub/index.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/memory/README.md +82 -37
|
@@ -1,125 +1,97 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tenant-scoped long-term memory
|
|
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.",
|
|
6
|
-
* const { results } = await memory.recall({ query: "ui preferences", topK: 5 });
|
|
7
|
-
*
|
|
8
|
-
* await memory.
|
|
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
|
-
*
|
|
13
|
-
*
|
|
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
|
-
/**
|
|
19
|
-
export
|
|
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
|
-
*
|
|
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
|
|
39
|
-
*
|
|
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
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
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
|
-
*
|
|
67
|
-
*
|
|
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
|
-
|
|
62
|
+
namespace?: string;
|
|
70
63
|
/**
|
|
71
|
-
*
|
|
72
|
-
* ranking (not embedded)
|
|
73
|
-
*
|
|
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?:
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
|
|
110
|
-
|
|
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
|
-
* - `"
|
|
119
|
-
* - `"keyword"`
|
|
120
|
-
*
|
|
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 = "
|
|
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
|
|
132
|
-
*
|
|
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
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Natural-language search text. Embedded and compared against stored memories.
|
|
127
|
+
* At most 4,096 characters.
|
|
128
|
+
*/
|
|
143
129
|
query: string;
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
|
|
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 — `"
|
|
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
|
|
162
|
-
*
|
|
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?:
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
177
|
-
*
|
|
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
|
-
/**
|
|
191
|
-
|
|
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
|
|
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
|
|
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
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
|
|
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
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
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
|
|
290
|
-
* yet (not an error).
|
|
198
|
+
* score; an empty list when nothing matches (not an error).
|
|
291
199
|
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* ownership failures
|
|
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
|
-
*
|
|
299
|
-
*
|
|
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
|
|
210
|
+
export declare function forget(input: ForgetInput, transport?: Transport, baseUrl?: string): Promise<void>;
|
|
313
211
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
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
|
|
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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,CAAC;AAiB3B,wFAAwF;AACxF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEjE,0FAA0F;AAC1F,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,E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