mnemocyte 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -102
- package/dist/embedders/openai.d.mts +31 -0
- package/dist/embedders/openai.d.mts.map +1 -0
- package/dist/embedders/openai.mjs +78 -0
- package/dist/embedders/openai.mjs.map +1 -0
- package/dist/errors-BG3-mNur.mjs +53 -0
- package/dist/errors-BG3-mNur.mjs.map +1 -0
- package/dist/index.d.mts +2 -843
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +149 -109
- package/dist/index.mjs.map +1 -1
- package/dist/types-QK_43oKJ.d.mts +845 -0
- package/dist/types-QK_43oKJ.d.mts.map +1 -0
- package/migrations/0000_initial.sql +33 -44
- package/migrations/meta/0000_snapshot.json +284 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +25 -17
package/dist/index.d.mts
CHANGED
|
@@ -1,846 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Discriminator describing what kind of memory a {@link Memory} represents.
|
|
4
|
-
*
|
|
5
|
-
* - `"fact"` — a stable, objective statement.
|
|
6
|
-
* - `"preference"` — a user/entity preference that should bias future responses.
|
|
7
|
-
* - `"instruction"` — a directive the agent should follow.
|
|
8
|
-
* - `"backstory"` — long-lived background context about the entity.
|
|
9
|
-
* - `"episode"` — a discrete past event.
|
|
10
|
-
* - `"session"` — short-lived context tied to a single session.
|
|
11
|
-
*
|
|
12
|
-
* @defaultValue `"fact"` when omitted on {@link RememberInput}.
|
|
13
|
-
*/
|
|
14
|
-
type MemoryType = "fact" | "preference" | "instruction" | "backstory" | "episode" | "session";
|
|
15
|
-
/**
|
|
16
|
-
* Relative importance assigned to a memory. Influences retrieval ranking
|
|
17
|
-
* via the `importance` score component.
|
|
18
|
-
*
|
|
19
|
-
* @defaultValue `"normal"` when omitted on {@link RememberInput}.
|
|
20
|
-
*/
|
|
21
|
-
type ImportanceLevel = "low" | "normal" | "high" | "critical";
|
|
22
|
-
/**
|
|
23
|
-
* Output format produced by {@link MnemocyteClient.buildContext}.
|
|
24
|
-
*
|
|
25
|
-
* - `"markdown"` — headings + bullet list (default; LLM-friendly).
|
|
26
|
-
* - `"plain"` — newline-separated plain text.
|
|
27
|
-
* - `"xml"` — structured tags, useful for models that parse XML reliably.
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue `"markdown"`
|
|
30
|
-
*/
|
|
31
|
-
type ContextFormat = "markdown" | "plain" | "xml";
|
|
32
|
-
/**
|
|
33
|
-
* Identifies which backend a {@link MnemocyteClient} is using.
|
|
34
|
-
*
|
|
35
|
-
* Selected automatically by {@link createMnemocyte} based on whether
|
|
36
|
-
* {@link MnemocyteConfig.databaseUrl} was provided.
|
|
37
|
-
*/
|
|
38
|
-
type MnemocyteBackend = "in-memory" | "postgres";
|
|
39
|
-
/**
|
|
40
|
-
* The set of public {@link MnemocyteClient} methods that emit
|
|
41
|
-
* {@link MnemocyteObservation} events through {@link ObservabilityConfig.onEvent}.
|
|
42
|
-
*/
|
|
43
|
-
type MnemocyteOperation = "remember" | "rememberMany" | "recall" | "buildContext" | "forget" | "forgetAll" | "prune" | "findDuplicates" | "listAuditLog" | "consolidate" | "stats" | "close";
|
|
44
|
-
/**
|
|
45
|
-
* Lifecycle phase of a {@link MnemocyteObservation}.
|
|
46
|
-
*
|
|
47
|
-
* Every operation emits exactly one `"start"` event and exactly one of
|
|
48
|
-
* `"success"` or `"error"` once it settles.
|
|
49
|
-
*/
|
|
50
|
-
type MnemocyteObservationPhase = "start" | "success" | "error";
|
|
51
|
-
/**
|
|
52
|
-
* A single observability event emitted by a {@link MnemocyteClient}.
|
|
53
|
-
*
|
|
54
|
-
* Delivered to {@link ObservabilityConfig.onEvent} for tracing, metrics,
|
|
55
|
-
* and structured logging.
|
|
56
|
-
*/
|
|
57
|
-
interface MnemocyteObservation {
|
|
58
|
-
/** Operation that produced this event. */
|
|
59
|
-
operation: MnemocyteOperation;
|
|
60
|
-
/** Lifecycle phase: `"start"`, `"success"`, or `"error"`. */
|
|
61
|
-
phase: MnemocyteObservationPhase;
|
|
62
|
-
/** Backend handling the operation. */
|
|
63
|
-
backend: MnemocyteBackend;
|
|
64
|
-
/** Wall-clock timestamp of this event. */
|
|
65
|
-
timestamp: Date;
|
|
66
|
-
/** Elapsed milliseconds since the `"start"` event. Present on `"success"` / `"error"`. */
|
|
67
|
-
durationMs?: number;
|
|
68
|
-
/** Entity ID associated with the operation, when applicable. */
|
|
69
|
-
entityId?: string;
|
|
70
|
-
/** Memory ID associated with the operation, when applicable. */
|
|
71
|
-
memoryId?: string;
|
|
72
|
-
/** Number of items processed (e.g. memories returned, batch size). */
|
|
73
|
-
count?: number;
|
|
74
|
-
/** Thrown value. Present only on `"error"`. */
|
|
75
|
-
error?: unknown;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Hooks for observing client activity.
|
|
79
|
-
*
|
|
80
|
-
* Exceptions thrown by {@link ObservabilityConfig.onEvent} are swallowed so
|
|
81
|
-
* that telemetry never affects application logic.
|
|
82
|
-
*/
|
|
83
|
-
interface ObservabilityConfig {
|
|
84
|
-
/**
|
|
85
|
-
* Called for every lifecycle event of every operation. Receives a single
|
|
86
|
-
* {@link MnemocyteObservation}. May be sync or async; the operation will
|
|
87
|
-
* not be delayed waiting for slow async hooks beyond the awaited dispatch.
|
|
88
|
-
*/
|
|
89
|
-
onEvent?: (event: MnemocyteObservation) => void | Promise<void>;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Production-hardening knobs applied to outbound provider calls
|
|
93
|
-
* (currently the {@link Embedder}). Mnemocyte applies a timeout, retries
|
|
94
|
-
* on transient failures, and forwards `AbortSignal` cancellation to each
|
|
95
|
-
* attempt. Every field is optional with conservative defaults; the
|
|
96
|
-
* defaults disable retries and timeouts so existing setups are
|
|
97
|
-
* unaffected unless they opt in.
|
|
98
|
-
*/
|
|
99
|
-
interface ProviderResilienceConfig {
|
|
100
|
-
/**
|
|
101
|
-
* Maximum time, in milliseconds, that a single provider attempt may
|
|
102
|
-
* run before a {@link MnemocyteError} with code `"TIMEOUT"` is thrown.
|
|
103
|
-
* Defaults to `0` which disables the timeout.
|
|
104
|
-
*/
|
|
105
|
-
timeoutMs?: number;
|
|
106
|
-
/**
|
|
107
|
-
* Maximum number of retry attempts after the initial call. `0`
|
|
108
|
-
* disables retries (default).
|
|
109
|
-
*/
|
|
110
|
-
retries?: number;
|
|
111
|
-
/** Base backoff delay (ms) used before the first retry. Defaults to `100`. */
|
|
112
|
-
baseDelayMs?: number;
|
|
113
|
-
/** Maximum backoff delay (ms) used between retries. Defaults to `2000`. */
|
|
114
|
-
maxDelayMs?: number;
|
|
115
|
-
/**
|
|
116
|
-
* Optional predicate deciding whether `error` should trigger a retry.
|
|
117
|
-
* Receives the thrown value and the 1-indexed `attempt` number that
|
|
118
|
-
* just failed. When omitted, a conservative built-in heuristic is used
|
|
119
|
-
* that retries on common transient indicators (network errors, 5xx
|
|
120
|
-
* responses, rate-limit hints) and never retries `"VALIDATION"`,
|
|
121
|
-
* `"CONFIG"`, or `"ABORTED"` {@link MnemocyteError}s.
|
|
122
|
-
*/
|
|
123
|
-
shouldRetry?: (error: unknown, attempt: number) => boolean;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Configuration passed to {@link createMnemocyte}.
|
|
127
|
-
*/
|
|
128
|
-
interface MnemocyteConfig {
|
|
129
|
-
/**
|
|
130
|
-
* Postgres connection string. When set, the client uses the Postgres
|
|
131
|
-
* backend (requires the `pgvector` extension and the bundled migration).
|
|
132
|
-
* When omitted, an in-memory backend is used.
|
|
133
|
-
*/
|
|
134
|
-
databaseUrl?: string;
|
|
135
|
-
/** Required embedder used to vectorise content for storage and retrieval. */
|
|
136
|
-
embedder: Embedder;
|
|
137
|
-
/** Default values applied to {@link RecallInput} when properties are omitted. */
|
|
138
|
-
defaults?: {
|
|
139
|
-
/** Default `limit` for {@link MnemocyteClient.recall}. */limit?: number; /** Default `minScore` cutoff for {@link MnemocyteClient.recall}. */
|
|
140
|
-
minScore?: number;
|
|
141
|
-
};
|
|
142
|
-
/** Retrieval-ranking tuning. See {@link RetrievalConfig}. */
|
|
143
|
-
retrieval?: RetrievalConfig;
|
|
144
|
-
/** Observability hooks. See {@link ObservabilityConfig}. */
|
|
145
|
-
observability?: ObservabilityConfig;
|
|
146
|
-
/**
|
|
147
|
-
* Production-hardening knobs for outbound provider calls
|
|
148
|
-
* (timeouts, retries, abort propagation). See
|
|
149
|
-
* {@link ProviderResilienceConfig}.
|
|
150
|
-
*/
|
|
151
|
-
provider?: ProviderResilienceConfig;
|
|
152
|
-
/**
|
|
153
|
-
* Audit-log configuration. When enabled, Mnemocyte records an
|
|
154
|
-
* {@link AuditEvent} for every state-changing operation
|
|
155
|
-
* (`remember`, `forget`, `forgetAll`, `prune`). Read with
|
|
156
|
-
* {@link MnemocyteClient.listAuditLog}.
|
|
157
|
-
*
|
|
158
|
-
* @experimental Part of Phase 6 (consolidation tooling).
|
|
159
|
-
*/
|
|
160
|
-
audit?: AuditConfig;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Audit-log configuration. See {@link MnemocyteConfig.audit}.
|
|
164
|
-
*
|
|
165
|
-
* @experimental Part of Phase 6 (consolidation tooling).
|
|
166
|
-
*/
|
|
167
|
-
interface AuditConfig {
|
|
168
|
-
/**
|
|
169
|
-
* Master switch for audit logging. When `false` (default), Mnemocyte
|
|
170
|
-
* neither writes nor relies on the audit log; existing log entries
|
|
171
|
-
* remain readable via {@link MnemocyteClient.listAuditLog}.
|
|
172
|
-
*
|
|
173
|
-
* @defaultValue `false`
|
|
174
|
-
*/
|
|
175
|
-
enabled?: boolean;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Pluggable embedding provider. Wraps an external embedding API
|
|
179
|
-
* (e.g. OpenAI, Cohere, a local model) in a small interface.
|
|
180
|
-
*
|
|
181
|
-
* Mnemocyte records {@link Embedder.model} and {@link Embedder.dimensions}
|
|
182
|
-
* on every stored memory and uses them to detect incompatible vectors
|
|
183
|
-
* (e.g. when the model is swapped).
|
|
184
|
-
*/
|
|
185
|
-
interface Embedder {
|
|
186
|
-
/** Stable identifier for the underlying model (e.g. `"text-embedding-3-small"`). */
|
|
187
|
-
readonly model: string;
|
|
188
|
-
/** Dimensionality of vectors returned by {@link Embedder.embed}. */
|
|
189
|
-
readonly dimensions: number;
|
|
190
|
-
/**
|
|
191
|
-
* Embed one or more texts. Implementations MUST return one vector per
|
|
192
|
-
* input, in the same order, each of length {@link Embedder.dimensions}.
|
|
193
|
-
*
|
|
194
|
-
* The optional `options.signal` is forwarded by Mnemocyte when the
|
|
195
|
-
* caller passes a `signal` on a {@link RememberInput} / {@link RecallInput}
|
|
196
|
-
* / {@link BuildContextInput}, or when Mnemocyte's own provider timeout
|
|
197
|
-
* fires. Implementations that integrate with `fetch` should forward
|
|
198
|
-
* the signal to it so requests can be cancelled promptly.
|
|
199
|
-
*/
|
|
200
|
-
embed(texts: readonly string[], options?: {
|
|
201
|
-
signal?: AbortSignal;
|
|
202
|
-
}): Promise<number[][]>;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* A persisted memory record as returned by the client.
|
|
206
|
-
*
|
|
207
|
-
* Memories are immutable from the caller's perspective; updates produce a
|
|
208
|
-
* new memory and link the previous one via {@link Memory.supersededBy}.
|
|
209
|
-
*/
|
|
210
|
-
interface Memory {
|
|
211
|
-
/** Unique identifier (`mem_*` prefixed string). */
|
|
212
|
-
id: string;
|
|
213
|
-
/** Owning entity — typically a user, agent, or session ID. */
|
|
214
|
-
entityId: string;
|
|
215
|
-
/** Raw textual content of the memory. */
|
|
216
|
-
content: string;
|
|
217
|
-
/** Discriminator describing the kind of memory. */
|
|
218
|
-
type: MemoryType;
|
|
219
|
-
/** Relative importance assigned at write time. */
|
|
220
|
-
importance: ImportanceLevel;
|
|
221
|
-
/** Free-form tags used for filtering on {@link RecallInput.tags}. */
|
|
222
|
-
tags: string[];
|
|
223
|
-
/** Optional human-readable source attribution (e.g. `"chat:2024-04-12"`). */
|
|
224
|
-
source: string | null;
|
|
225
|
-
/** Arbitrary user-provided metadata persisted alongside the memory. */
|
|
226
|
-
metadata: Record<string, unknown>;
|
|
227
|
-
/** Confidence in `[0, 1]`. Used in retrieval ranking. */
|
|
228
|
-
confidence: number;
|
|
229
|
-
/** {@link Embedder.model} value at write time. */
|
|
230
|
-
embeddingModel: string;
|
|
231
|
-
/** {@link Embedder.dimensions} value at write time. */
|
|
232
|
-
embeddingDimensions: number;
|
|
233
|
-
/** ID of the memory that supersedes this one, or `null` if active. */
|
|
234
|
-
supersededBy: string | null;
|
|
235
|
-
/**
|
|
236
|
-
* Wall-clock time when this memory was superseded, or `null` if it
|
|
237
|
-
* has not been superseded. Set together with
|
|
238
|
-
* {@link Memory.supersededBy} by
|
|
239
|
-
* {@link ExperimentalMnemocyteClient.consolidate}.
|
|
240
|
-
*/
|
|
241
|
-
supersededAt: Date | null;
|
|
242
|
-
/** Optional expiry; expired memories are filtered out by default. */
|
|
243
|
-
expiresAt: Date | null;
|
|
244
|
-
/** Last time this memory was returned by {@link MnemocyteClient.recall}. */
|
|
245
|
-
lastAccessedAt: Date | null;
|
|
246
|
-
/** Cumulative number of times this memory has been recalled. */
|
|
247
|
-
accessCount: number;
|
|
248
|
-
/** Creation timestamp. */
|
|
249
|
-
createdAt: Date;
|
|
250
|
-
/** Most recent update timestamp. */
|
|
251
|
-
updatedAt: Date;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Per-component scores produced during retrieval ranking. Each value is
|
|
255
|
-
* normalised to `[0, 1]` before being combined via
|
|
256
|
-
* {@link RetrievalScoreWeights}.
|
|
257
|
-
*/
|
|
258
|
-
interface RetrievalScores {
|
|
259
|
-
/** Cosine similarity between the query embedding and the memory embedding. */
|
|
260
|
-
vector: number;
|
|
261
|
-
/** Token-overlap (lexical) score between query and memory content. */
|
|
262
|
-
lexical: number;
|
|
263
|
-
/** Time-decay score based on {@link RetrievalConfig.recencyHalfLifeDays}. */
|
|
264
|
-
recency: number;
|
|
265
|
-
/** Pass-through of the memory's stored `confidence`. */
|
|
266
|
-
confidence: number;
|
|
267
|
-
/** Saturating score derived from `accessCount`. */
|
|
268
|
-
access: number;
|
|
269
|
-
/** Score derived from {@link ImportanceLevel}. */
|
|
270
|
-
importance: number;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Optional overrides for the per-component retrieval weights. Missing keys
|
|
274
|
-
* fall back to library defaults. Weights need not sum to 1; the final
|
|
275
|
-
* score is computed as a weighted sum of {@link RetrievalScores}.
|
|
276
|
-
*/
|
|
277
|
-
interface RetrievalScoreWeights {
|
|
278
|
-
/** Weight applied to {@link RetrievalScores.vector}. */
|
|
279
|
-
vector?: number;
|
|
280
|
-
/** Weight applied to {@link RetrievalScores.lexical}. */
|
|
281
|
-
lexical?: number;
|
|
282
|
-
/** Weight applied to {@link RetrievalScores.recency}. */
|
|
283
|
-
recency?: number;
|
|
284
|
-
/** Weight applied to {@link RetrievalScores.confidence}. */
|
|
285
|
-
confidence?: number;
|
|
286
|
-
/** Weight applied to {@link RetrievalScores.access}. */
|
|
287
|
-
access?: number;
|
|
288
|
-
/** Weight applied to {@link RetrievalScores.importance}. */
|
|
289
|
-
importance?: number;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Retrieval-ranking tuning. All fields are optional; sensible defaults are
|
|
293
|
-
* used for any field that is omitted.
|
|
294
|
-
*/
|
|
295
|
-
interface RetrievalConfig {
|
|
296
|
-
/** Per-component score weights. See {@link RetrievalScoreWeights}. */
|
|
297
|
-
weights?: RetrievalScoreWeights;
|
|
298
|
-
/** Half-life (days) for the time-decay recency component. */
|
|
299
|
-
recencyHalfLifeDays?: number;
|
|
300
|
-
/** Access count at which the access score is considered saturated. */
|
|
301
|
-
accessSaturation?: number;
|
|
302
|
-
/**
|
|
303
|
-
* Multiplier applied to {@link RecallInput.limit} to determine how many
|
|
304
|
-
* candidates are fetched from the underlying store before re-ranking.
|
|
305
|
-
*/
|
|
306
|
-
candidateMultiplier?: number;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Detailed scoring breakdown attached to each {@link MemoryWithScore} when
|
|
310
|
-
* {@link RecallInput.explain} is `true`. Useful for debugging ranking and
|
|
311
|
-
* tuning {@link RetrievalConfig}.
|
|
312
|
-
*/
|
|
313
|
-
interface RetrievalExplanation {
|
|
314
|
-
/** Raw vector similarity in `[0, 1]`. */
|
|
315
|
-
vectorScore: number;
|
|
316
|
-
/** Raw lexical-overlap score in `[0, 1]`. */
|
|
317
|
-
lexicalScore: number;
|
|
318
|
-
/** Raw recency score in `[0, 1]`. */
|
|
319
|
-
recencyScore: number;
|
|
320
|
-
/** Raw confidence score in `[0, 1]`. */
|
|
321
|
-
confidenceScore: number;
|
|
322
|
-
/** Raw access score in `[0, 1]`. */
|
|
323
|
-
accessScore: number;
|
|
324
|
-
/** Raw importance score in `[0, 1]`. */
|
|
325
|
-
importanceScore: number;
|
|
326
|
-
/** Additive multiplier applied for high-importance memories. */
|
|
327
|
-
importanceBoost: number;
|
|
328
|
-
/** Effective weights used for this query (defaults filled in). */
|
|
329
|
-
weights: Required<RetrievalScoreWeights>;
|
|
330
|
-
/** Final combined score — same value as {@link MemoryWithScore.score}. */
|
|
331
|
-
finalScore: number;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* A {@link Memory} returned by {@link MnemocyteClient.recall}, annotated
|
|
335
|
-
* with retrieval scores.
|
|
336
|
-
*/
|
|
337
|
-
interface MemoryWithScore extends Memory {
|
|
338
|
-
/** Final combined relevance score. Higher is better. */
|
|
339
|
-
score: number;
|
|
340
|
-
/** Per-component scores that produced {@link MemoryWithScore.score}. */
|
|
341
|
-
scores: RetrievalScores;
|
|
342
|
-
/**
|
|
343
|
-
* Full scoring breakdown when {@link RecallInput.explain} is `true`,
|
|
344
|
-
* `null` otherwise.
|
|
345
|
-
*/
|
|
346
|
-
explanation: RetrievalExplanation | null;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Input for {@link MnemocyteClient.remember} and
|
|
350
|
-
* {@link MnemocyteClient.rememberMany}.
|
|
351
|
-
*/
|
|
352
|
-
interface RememberInput {
|
|
353
|
-
/** Owning entity ID (e.g. user, agent, or session). */
|
|
354
|
-
entityId: string;
|
|
355
|
-
/** Raw textual content to store. Must be non-empty. */
|
|
356
|
-
content: string;
|
|
357
|
-
/** Memory kind. @defaultValue `"fact"` */
|
|
358
|
-
type?: MemoryType;
|
|
359
|
-
/** Relative importance. @defaultValue `"normal"` */
|
|
360
|
-
importance?: ImportanceLevel;
|
|
361
|
-
/** Free-form tags used for later filtering. */
|
|
362
|
-
tags?: string[];
|
|
363
|
-
/** Optional human-readable source attribution. */
|
|
364
|
-
source?: string;
|
|
365
|
-
/** Arbitrary metadata persisted alongside the memory. */
|
|
366
|
-
metadata?: Record<string, unknown>;
|
|
367
|
-
/** Confidence in `[0, 1]`. @defaultValue `1` */
|
|
368
|
-
confidence?: number;
|
|
369
|
-
/** Optional expiry; expired memories are filtered out by default. */
|
|
370
|
-
expiresAt?: Date;
|
|
371
|
-
/**
|
|
372
|
-
* Optional cancellation signal. Forwarded to the embedder; when
|
|
373
|
-
* aborted, the operation throws a {@link MnemocyteError} with code
|
|
374
|
-
* `"ABORTED"`.
|
|
375
|
-
*/
|
|
376
|
-
signal?: AbortSignal;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Input for {@link MnemocyteClient.recall}.
|
|
380
|
-
*/
|
|
381
|
-
interface RecallInput {
|
|
382
|
-
/** Owning entity ID to search within. */
|
|
383
|
-
entityId: string;
|
|
384
|
-
/** Free-text query; embedded and matched against stored memories. */
|
|
385
|
-
query: string;
|
|
386
|
-
/** Maximum number of results. Falls back to {@link MnemocyteConfig.defaults}. */
|
|
387
|
-
limit?: number;
|
|
388
|
-
/** Minimum final score required for a memory to be returned. */
|
|
389
|
-
minScore?: number;
|
|
390
|
-
/** Restrict results to these memory types. */
|
|
391
|
-
types?: MemoryType[];
|
|
392
|
-
/** Require results to include all of these tags. */
|
|
393
|
-
tags?: string[];
|
|
394
|
-
/** Only include memories created strictly before this date. */
|
|
395
|
-
before?: Date;
|
|
396
|
-
/** Only include memories created strictly after this date. */
|
|
397
|
-
after?: Date;
|
|
398
|
-
/** Include memories that have been superseded. @defaultValue `false` */
|
|
399
|
-
includeSuperseded?: boolean;
|
|
400
|
-
/** Include memories whose `expiresAt` has passed. @defaultValue `false` */
|
|
401
|
-
includeExpired?: boolean;
|
|
402
|
-
/** Populate {@link MemoryWithScore.explanation} on each result. @defaultValue `false` */
|
|
403
|
-
explain?: boolean;
|
|
404
|
-
/**
|
|
405
|
-
* Optional cancellation signal. Forwarded to the embedder; when
|
|
406
|
-
* aborted, the operation throws a {@link MnemocyteError} with code
|
|
407
|
-
* `"ABORTED"`.
|
|
408
|
-
*/
|
|
409
|
-
signal?: AbortSignal;
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Pluggable token counter used by {@link MnemocyteClient.buildContext} to
|
|
413
|
-
* enforce {@link BuildContextInput.maxTokens}. Plug in your model's real
|
|
414
|
-
* tokenizer (e.g. `tiktoken`) for accurate budgeting; a simple word-based
|
|
415
|
-
* heuristic is used when omitted.
|
|
416
|
-
*/
|
|
417
|
-
interface TokenCounter {
|
|
418
|
-
/** Return the number of tokens in `text`. */
|
|
419
|
-
count(text: string): number;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Input for {@link MnemocyteClient.buildContext}, which renders relevant
|
|
423
|
-
* memories into a prompt-ready string.
|
|
424
|
-
*/
|
|
425
|
-
interface BuildContextInput {
|
|
426
|
-
/** Owning entity ID to search within. */
|
|
427
|
-
entityId: string;
|
|
428
|
-
/** Free-text query used to select relevant memories. */
|
|
429
|
-
query: string;
|
|
430
|
-
/** Output format. @defaultValue `"markdown"` */
|
|
431
|
-
format?: ContextFormat;
|
|
432
|
-
/** Optional token budget; memories are dropped from the tail until the budget fits. */
|
|
433
|
-
maxTokens?: number;
|
|
434
|
-
/** Maximum number of memories to consider. */
|
|
435
|
-
limit?: number;
|
|
436
|
-
/** Minimum retrieval score required. */
|
|
437
|
-
minScore?: number;
|
|
438
|
-
/** Restrict to these memory types. */
|
|
439
|
-
types?: MemoryType[];
|
|
440
|
-
/** Require results to include all of these tags. */
|
|
441
|
-
tags?: string[];
|
|
442
|
-
/** Include superseded memories. @defaultValue `false` */
|
|
443
|
-
includeSuperseded?: boolean;
|
|
444
|
-
/** Include expired memories. @defaultValue `false` */
|
|
445
|
-
includeExpired?: boolean;
|
|
446
|
-
/** Tokenizer used to enforce {@link BuildContextInput.maxTokens}. */
|
|
447
|
-
tokenCounter?: TokenCounter;
|
|
448
|
-
/**
|
|
449
|
-
* Optional cancellation signal. Forwarded to the underlying recall
|
|
450
|
-
* call and embedder; when aborted, the operation throws a
|
|
451
|
-
* {@link MnemocyteError} with code `"ABORTED"`.
|
|
452
|
-
*/
|
|
453
|
-
signal?: AbortSignal;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Input for {@link MnemocyteClient.prune}. All fields are optional, but
|
|
457
|
-
* at least one selector must be set; calling `prune({})` is rejected with
|
|
458
|
-
* a `"VALIDATION"` {@link MnemocyteError} so memories cannot be deleted
|
|
459
|
-
* accidentally. Specified filters are combined with AND semantics.
|
|
460
|
-
*/
|
|
461
|
-
interface PruneInput {
|
|
462
|
-
/** Restrict pruning to a single entity. */
|
|
463
|
-
entityId?: string;
|
|
464
|
-
/** Match memories whose `expiresAt` is in the past. */
|
|
465
|
-
expired?: boolean;
|
|
466
|
-
/** Match memories that have been superseded (`supersededBy !== null`). */
|
|
467
|
-
superseded?: boolean;
|
|
468
|
-
/** Match memories created strictly before this date. */
|
|
469
|
-
createdBefore?: Date;
|
|
470
|
-
/**
|
|
471
|
-
* Match memories whose `lastAccessedAt` is `null` or strictly before
|
|
472
|
-
* this date. Useful for evicting "cold" memories.
|
|
473
|
-
*/
|
|
474
|
-
notAccessedSince?: Date;
|
|
475
|
-
/** Restrict pruning to these memory types. */
|
|
476
|
-
types?: MemoryType[];
|
|
477
|
-
/**
|
|
478
|
-
* Require memories to include all of these tags. Empty array is
|
|
479
|
-
* treated as no tag filter.
|
|
480
|
-
*/
|
|
481
|
-
tags?: string[];
|
|
482
|
-
/**
|
|
483
|
-
* Match memories whose `importance` is at or below this level. For
|
|
484
|
-
* example, `"normal"` prunes `"low"` and `"normal"` but never `"high"`
|
|
485
|
-
* or `"critical"`. Useful for evicting low-value memories first.
|
|
486
|
-
*/
|
|
487
|
-
maxImportance?: ImportanceLevel;
|
|
488
|
-
/**
|
|
489
|
-
* If `true`, count what would be pruned without deleting anything.
|
|
490
|
-
* @defaultValue `false`
|
|
491
|
-
*/
|
|
492
|
-
dryRun?: boolean;
|
|
493
|
-
/** Optional cancellation signal. */
|
|
494
|
-
signal?: AbortSignal;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Result returned by {@link MnemocyteClient.prune}.
|
|
498
|
-
*/
|
|
499
|
-
interface PruneResult {
|
|
500
|
-
/** Number of memories that matched the prune filter. */
|
|
501
|
-
matchedCount: number;
|
|
502
|
-
/**
|
|
503
|
-
* Number of memories actually deleted. Equals `matchedCount` for
|
|
504
|
-
* normal runs and `0` for `dryRun` runs.
|
|
505
|
-
*/
|
|
506
|
-
deletedCount: number;
|
|
507
|
-
/** `true` when {@link PruneInput.dryRun} was set. */
|
|
508
|
-
dryRun: boolean;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Input for {@link MnemocyteClient.findDuplicates}.
|
|
512
|
-
*
|
|
513
|
-
* Performs a pairwise cosine-similarity scan of stored memories for a
|
|
514
|
-
* single entity and returns pairs whose similarity meets
|
|
515
|
-
* {@link FindDuplicatesInput.threshold}. The scan is read-only — no
|
|
516
|
-
* memories are modified or deleted.
|
|
517
|
-
*
|
|
518
|
-
* @experimental Part of Phase 6 (consolidation tooling). API may change.
|
|
519
|
-
*/
|
|
520
|
-
interface FindDuplicatesInput {
|
|
521
|
-
/** Entity whose memories should be scanned for duplicates. */
|
|
522
|
-
entityId: string;
|
|
523
|
-
/**
|
|
524
|
-
* Cosine-similarity cutoff in `[0, 1]`. Pairs whose similarity is at
|
|
525
|
-
* or above this value are returned. @defaultValue `0.95`
|
|
526
|
-
*/
|
|
527
|
-
threshold?: number;
|
|
528
|
-
/**
|
|
529
|
-
* Maximum number of duplicate pairs to return, ordered by descending
|
|
530
|
-
* similarity. @defaultValue `100`
|
|
531
|
-
*/
|
|
532
|
-
limit?: number;
|
|
533
|
-
/** Restrict the scan to these memory types. */
|
|
534
|
-
types?: readonly MemoryType[];
|
|
535
|
-
/** Require both memories in the pair to include all of these tags. */
|
|
536
|
-
tags?: readonly string[];
|
|
537
|
-
/** Include superseded memories in the scan. @defaultValue `false` */
|
|
538
|
-
includeSuperseded?: boolean;
|
|
539
|
-
/** Include expired memories in the scan. @defaultValue `false` */
|
|
540
|
-
includeExpired?: boolean;
|
|
541
|
-
/** Optional cancellation signal. */
|
|
542
|
-
signal?: AbortSignal;
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* A pair of memories that are likely duplicates.
|
|
546
|
-
*
|
|
547
|
-
* The pair is unordered (i.e. `{a, b}` is the same logical result as
|
|
548
|
-
* `{b, a}`); Mnemocyte returns each pair only once.
|
|
549
|
-
*
|
|
550
|
-
* @experimental Part of Phase 6 (consolidation tooling). Shape may change.
|
|
551
|
-
*/
|
|
552
|
-
interface DuplicatePair {
|
|
553
|
-
/** One of the two memories in the duplicate pair. */
|
|
554
|
-
a: Memory;
|
|
555
|
-
/** The other memory in the duplicate pair. */
|
|
556
|
-
b: Memory;
|
|
557
|
-
/** Cosine similarity between the two embeddings, in `[0, 1]`. */
|
|
558
|
-
similarity: number;
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* A single audit-log entry recording a state-changing operation.
|
|
562
|
-
*
|
|
563
|
-
* @experimental Part of Phase 6 (consolidation tooling).
|
|
564
|
-
*/
|
|
565
|
-
interface AuditEvent {
|
|
566
|
-
/** Unique identifier (`evt_*` prefixed string). */
|
|
567
|
-
id: string;
|
|
568
|
-
/** Entity whose state was changed. */
|
|
569
|
-
entityId: string;
|
|
570
|
-
/**
|
|
571
|
-
* Stable, dotted slug describing the change. Examples:
|
|
572
|
-
* `"memory.created"`, `"memory.deleted"`, `"memory.pruned"`,
|
|
573
|
-
* `"entity.cleared"`.
|
|
574
|
-
*/
|
|
575
|
-
description: string;
|
|
576
|
-
/** Free-form structured details about the change. */
|
|
577
|
-
metadata: Record<string, unknown>;
|
|
578
|
-
/** When the change was recorded. */
|
|
579
|
-
timestamp: Date;
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Input for {@link MnemocyteClient.listAuditLog}.
|
|
583
|
-
*
|
|
584
|
-
* @experimental Part of Phase 6 (consolidation tooling).
|
|
585
|
-
*/
|
|
586
|
-
interface ListAuditLogInput {
|
|
587
|
-
/** Entity whose audit log should be returned. */
|
|
588
|
-
entityId: string;
|
|
589
|
-
/**
|
|
590
|
-
* Maximum number of entries to return, ordered newest first.
|
|
591
|
-
* @defaultValue `50`
|
|
592
|
-
*/
|
|
593
|
-
limit?: number;
|
|
594
|
-
/** Only return entries strictly before this timestamp. */
|
|
595
|
-
before?: Date;
|
|
596
|
-
/** Only return entries strictly after this timestamp. */
|
|
597
|
-
after?: Date;
|
|
598
|
-
/** Optional cancellation signal. */
|
|
599
|
-
signal?: AbortSignal;
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Input for {@link ExperimentalMnemocyteClient.consolidate}.
|
|
603
|
-
*
|
|
604
|
-
* Marks each memory in {@link ConsolidateInput.supersededIds} as
|
|
605
|
-
* superseded by {@link ConsolidateInput.survivorId}. Optionally
|
|
606
|
-
* unions the losers' tags into the survivor.
|
|
607
|
-
*
|
|
608
|
-
* @experimental Part of Phase 6 (consolidation tooling).
|
|
609
|
-
*/
|
|
610
|
-
interface ConsolidateInput {
|
|
611
|
-
/** Entity that owns every memory referenced. */
|
|
612
|
-
entityId: string;
|
|
613
|
-
/** Memory that should win the merge. Must not itself be superseded. */
|
|
614
|
-
survivorId: string;
|
|
615
|
-
/**
|
|
616
|
-
* Memories to mark as superseded by the survivor. Already-superseded
|
|
617
|
-
* entries in this list are skipped silently for idempotency. Must
|
|
618
|
-
* not contain {@link ConsolidateInput.survivorId}.
|
|
619
|
-
*/
|
|
620
|
-
supersededIds: readonly string[];
|
|
621
|
-
/**
|
|
622
|
-
* When `true`, the survivor's `tags` becomes the union of its own
|
|
623
|
-
* tags and the tags of every memory that was actually superseded.
|
|
624
|
-
* @defaultValue `true`
|
|
625
|
-
*/
|
|
626
|
-
mergeTags?: boolean;
|
|
627
|
-
/** Optional cancellation signal. */
|
|
628
|
-
signal?: AbortSignal;
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* Result returned by {@link ExperimentalMnemocyteClient.consolidate}.
|
|
632
|
-
*
|
|
633
|
-
* @experimental Part of Phase 6 (consolidation tooling).
|
|
634
|
-
*/
|
|
635
|
-
interface ConsolidateResult {
|
|
636
|
-
/** Echoes {@link ConsolidateInput.survivorId}. */
|
|
637
|
-
survivorId: string;
|
|
638
|
-
/**
|
|
639
|
-
* Number of memories actually marked as superseded. Excludes entries
|
|
640
|
-
* that were already superseded (idempotent skip).
|
|
641
|
-
*/
|
|
642
|
-
supersededCount: number;
|
|
643
|
-
/** The IDs that were newly superseded during this call. */
|
|
644
|
-
supersededIds: readonly string[];
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Stats for a single entity, returned by
|
|
648
|
-
* {@link MnemocyteClient.stats} when an `entityId` is provided.
|
|
649
|
-
*/
|
|
650
|
-
interface EntityStats {
|
|
651
|
-
/** The entity these stats describe. */
|
|
652
|
-
entityId: string;
|
|
653
|
-
/** Total number of memories ever stored for this entity. */
|
|
654
|
-
memoryCount: number;
|
|
655
|
-
/** Memories that are neither expired nor superseded. */
|
|
656
|
-
activeMemoryCount: number;
|
|
657
|
-
/** Memories whose `expiresAt` has passed. */
|
|
658
|
-
expiredMemoryCount: number;
|
|
659
|
-
/** Memories that have been superseded by a newer one. */
|
|
660
|
-
supersededMemoryCount: number;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Stats aggregated across all entities, returned by
|
|
664
|
-
* {@link MnemocyteClient.stats} when no `entityId` is provided.
|
|
665
|
-
*/
|
|
666
|
-
interface GlobalStats {
|
|
667
|
-
/** Number of distinct entities with at least one memory. */
|
|
668
|
-
entityCount: number;
|
|
669
|
-
/** Total number of memories across all entities. */
|
|
670
|
-
memoryCount: number;
|
|
671
|
-
/** Memories that are neither expired nor superseded. */
|
|
672
|
-
activeMemoryCount: number;
|
|
673
|
-
/** Memories whose `expiresAt` has passed. */
|
|
674
|
-
expiredMemoryCount: number;
|
|
675
|
-
/** Memories that have been superseded by a newer one. */
|
|
676
|
-
supersededMemoryCount: number;
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* The Mnemocyte client. Returned by {@link createMnemocyte}.
|
|
680
|
-
*
|
|
681
|
-
* Every method may throw {@link MnemocyteError}; use {@link isMnemocyteError}
|
|
682
|
-
* to narrow caught values.
|
|
683
|
-
*/
|
|
684
|
-
interface MnemocyteClient {
|
|
685
|
-
/**
|
|
686
|
-
* Persist a single memory and return the stored record.
|
|
687
|
-
*
|
|
688
|
-
* @throws {MnemocyteError} `"VALIDATION"` for invalid input, `"EMBEDDING"`
|
|
689
|
-
* if the embedder fails, `"DB"` for storage failures.
|
|
690
|
-
*/
|
|
691
|
-
remember(input: RememberInput): Promise<Memory>;
|
|
692
|
-
/**
|
|
693
|
-
* Persist multiple memories in one round-trip. Returns the stored records
|
|
694
|
-
* in the same order as `inputs`.
|
|
695
|
-
*/
|
|
696
|
-
rememberMany(inputs: readonly RememberInput[]): Promise<Memory[]>;
|
|
697
|
-
/**
|
|
698
|
-
* Retrieve the most relevant memories for `input.query`, ranked by the
|
|
699
|
-
* configured {@link RetrievalConfig}.
|
|
700
|
-
*/
|
|
701
|
-
recall(input: RecallInput): Promise<MemoryWithScore[]>;
|
|
702
|
-
/**
|
|
703
|
-
* Build a prompt-ready context string from the most relevant memories.
|
|
704
|
-
* Respects {@link BuildContextInput.maxTokens} when supplied.
|
|
705
|
-
*/
|
|
706
|
-
buildContext(input: BuildContextInput): Promise<string>;
|
|
707
|
-
/**
|
|
708
|
-
* Delete a specific memory belonging to `entityId`.
|
|
709
|
-
*
|
|
710
|
-
* @throws {MnemocyteError} `"NOT_FOUND"` if the memory does not exist
|
|
711
|
-
* or does not belong to `entityId`.
|
|
712
|
-
*/
|
|
713
|
-
forget(input: {
|
|
714
|
-
entityId: string;
|
|
715
|
-
memoryId: string;
|
|
716
|
-
}): Promise<void>;
|
|
717
|
-
/** Delete every memory belonging to `entityId`. */
|
|
718
|
-
forgetAll(input: {
|
|
719
|
-
entityId: string;
|
|
720
|
-
}): Promise<void>;
|
|
721
|
-
/**
|
|
722
|
-
* Bulk-delete memories matching the filters on {@link PruneInput}.
|
|
723
|
-
*
|
|
724
|
-
* At least one filter must be specified; an empty input throws a
|
|
725
|
-
* `"VALIDATION"` {@link MnemocyteError} to avoid accidental full
|
|
726
|
-
* deletion. Pass `dryRun: true` to count without deleting.
|
|
727
|
-
*
|
|
728
|
-
* @example Evict expired or stale memories for an entity
|
|
729
|
-
* ```ts
|
|
730
|
-
* await client.prune({
|
|
731
|
-
* entityId: "user_123",
|
|
732
|
-
* expired: true,
|
|
733
|
-
* });
|
|
734
|
-
*
|
|
735
|
-
* await client.prune({
|
|
736
|
-
* notAccessedSince: new Date(Date.now() - 30 * 24 * 3600 * 1000),
|
|
737
|
-
* maxImportance: "normal",
|
|
738
|
-
* });
|
|
739
|
-
* ```
|
|
740
|
-
*/
|
|
741
|
-
prune(input: PruneInput): Promise<PruneResult>;
|
|
742
|
-
/**
|
|
743
|
-
* Scan an entity's memories for likely duplicates by pairwise cosine
|
|
744
|
-
* similarity and return matching pairs, ordered by descending
|
|
745
|
-
* similarity. Read-only — no memories are modified.
|
|
746
|
-
*
|
|
747
|
-
* @experimental Part of Phase 6 (consolidation tooling). API may change.
|
|
748
|
-
*
|
|
749
|
-
* @example
|
|
750
|
-
* ```ts
|
|
751
|
-
* const pairs = await client.findDuplicates({
|
|
752
|
-
* entityId: "user_123",
|
|
753
|
-
* threshold: 0.95,
|
|
754
|
-
* limit: 50,
|
|
755
|
-
* });
|
|
756
|
-
* for (const { a, b, similarity } of pairs) {
|
|
757
|
-
* console.log(similarity, a.content, "<>", b.content);
|
|
758
|
-
* }
|
|
759
|
-
* ```
|
|
760
|
-
*/
|
|
761
|
-
findDuplicates(input: FindDuplicatesInput): Promise<DuplicatePair[]>;
|
|
762
|
-
/**
|
|
763
|
-
* Return audit-log entries for `entityId`, newest first.
|
|
764
|
-
*
|
|
765
|
-
* Entries are recorded automatically when
|
|
766
|
-
* {@link MnemocyteConfig.audit}.`enabled` is `true`. Historic entries
|
|
767
|
-
* remain readable even after toggling `enabled` back to `false`.
|
|
768
|
-
*
|
|
769
|
-
* @experimental Part of Phase 6 (consolidation tooling). API may change.
|
|
770
|
-
*
|
|
771
|
-
* @example
|
|
772
|
-
* ```ts
|
|
773
|
-
* const log = await client.listAuditLog({
|
|
774
|
-
* entityId: "user_123",
|
|
775
|
-
* limit: 100,
|
|
776
|
-
* });
|
|
777
|
-
* for (const event of log) {
|
|
778
|
-
* console.log(event.timestamp, event.description, event.metadata);
|
|
779
|
-
* }
|
|
780
|
-
* ```
|
|
781
|
-
*/
|
|
782
|
-
listAuditLog(input: ListAuditLogInput): Promise<AuditEvent[]>;
|
|
783
|
-
/**
|
|
784
|
-
* Unstable, opt-in extension surface. Members may change or be
|
|
785
|
-
* removed without a semver bump until they graduate to the main
|
|
786
|
-
* client interface.
|
|
787
|
-
*
|
|
788
|
-
* @experimental Part of Phase 6 (consolidation tooling).
|
|
789
|
-
*/
|
|
790
|
-
experimental: ExperimentalMnemocyteClient;
|
|
791
|
-
/**
|
|
792
|
-
* Return statistics. With an `entityId`, returns {@link EntityStats};
|
|
793
|
-
* without one, returns {@link GlobalStats}.
|
|
794
|
-
*/
|
|
795
|
-
stats(input?: {
|
|
796
|
-
entityId?: string;
|
|
797
|
-
}): Promise<EntityStats | GlobalStats>;
|
|
798
|
-
/**
|
|
799
|
-
* Release any underlying resources (e.g. the Postgres connection pool).
|
|
800
|
-
* Safe to call multiple times. The client must not be used afterward.
|
|
801
|
-
*/
|
|
802
|
-
close(): Promise<void>;
|
|
803
|
-
}
|
|
804
|
-
/**
|
|
805
|
-
* Extension surface for unstable Phase 6 operations. Reached via
|
|
806
|
-
* {@link MnemocyteClient.experimental}.
|
|
807
|
-
*
|
|
808
|
-
* @experimental Members may change or be removed without a semver bump.
|
|
809
|
-
*/
|
|
810
|
-
interface ExperimentalMnemocyteClient {
|
|
811
|
-
/**
|
|
812
|
-
* Consolidate likely-duplicate memories into a single survivor by
|
|
813
|
-
* marking the others as superseded. Optionally unions their tags
|
|
814
|
-
* onto the survivor. Idempotent for memories that are already
|
|
815
|
-
* superseded.
|
|
816
|
-
*
|
|
817
|
-
* Emits one `"memory.superseded"` audit event per newly superseded
|
|
818
|
-
* memory when {@link MnemocyteConfig.audit}.`enabled` is `true`.
|
|
819
|
-
*
|
|
820
|
-
* @experimental Part of Phase 6 (consolidation tooling). API may change.
|
|
821
|
-
*
|
|
822
|
-
* @throws {MnemocyteError} `"VALIDATION"` for empty `supersededIds`,
|
|
823
|
-
* a `survivorId` that also appears in `supersededIds`, or a survivor
|
|
824
|
-
* that is itself already superseded.
|
|
825
|
-
* @throws {MnemocyteError} `"NOT_FOUND"` if the survivor or any
|
|
826
|
-
* non-already-superseded memory in `supersededIds` does not belong
|
|
827
|
-
* to `entityId`.
|
|
828
|
-
*
|
|
829
|
-
* @example
|
|
830
|
-
* ```ts
|
|
831
|
-
* const pairs = await client.findDuplicates({ entityId: "user_123" });
|
|
832
|
-
* for (const { a, b } of pairs) {
|
|
833
|
-
* await client.experimental.consolidate({
|
|
834
|
-
* entityId: "user_123",
|
|
835
|
-
* survivorId: a.id,
|
|
836
|
-
* supersededIds: [b.id],
|
|
837
|
-
* });
|
|
838
|
-
* }
|
|
839
|
-
* ```
|
|
840
|
-
*/
|
|
841
|
-
consolidate(input: ConsolidateInput): Promise<ConsolidateResult>;
|
|
842
|
-
}
|
|
843
|
-
//#endregion
|
|
1
|
+
import { A as RetrievalConfig, C as MnemocyteOperation, D as PruneResult, E as PruneInput, M as RetrievalScoreWeights, N as RetrievalScores, O as RecallInput, P as TokenCounter, S as MnemocyteObservationPhase, T as ProviderResilienceConfig, _ as MemoryWithScore, a as ConsolidateResult, b as MnemocyteConfig, c as Embedder, d as FindDuplicatesInput, f as GlobalStats, g as MemoryType, h as Memory, i as ConsolidateInput, j as RetrievalExplanation, k as RememberInput, l as EntityStats, m as ListAuditLogInput, n as AuditEvent, o as ContextFormat, p as ImportanceLevel, r as BuildContextInput, s as DuplicatePair, t as AuditConfig, u as ExperimentalMnemocyteClient, v as MnemocyteBackend, w as ObservabilityConfig, x as MnemocyteObservation, y as MnemocyteClient } from "./types-QK_43oKJ.mjs";
|
|
2
|
+
|
|
844
3
|
//#region src/client.d.ts
|
|
845
4
|
/**
|
|
846
5
|
* Create a Mnemocyte client.
|