@lov3kaizen/agentsea-memory 0.5.1
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/LICENSE +21 -0
- package/README.md +450 -0
- package/dist/chunk-GACX3FPR.js +1402 -0
- package/dist/chunk-M44NB53O.js +1226 -0
- package/dist/chunk-MQDWBPZU.js +972 -0
- package/dist/chunk-TPC7MYWK.js +1495 -0
- package/dist/chunk-XD2CQGSD.js +1540 -0
- package/dist/chunk-YI7RPDEV.js +1215 -0
- package/dist/core.types-lkxKv-bW.d.cts +242 -0
- package/dist/core.types-lkxKv-bW.d.ts +242 -0
- package/dist/debug/index.cjs +1248 -0
- package/dist/debug/index.d.cts +3 -0
- package/dist/debug/index.d.ts +3 -0
- package/dist/debug/index.js +20 -0
- package/dist/index-7SsAJ4et.d.ts +525 -0
- package/dist/index-BGxYqpFb.d.cts +601 -0
- package/dist/index-BX62efZu.d.ts +565 -0
- package/dist/index-Bbc3COw0.d.cts +748 -0
- package/dist/index-Bczz1Eyk.d.ts +637 -0
- package/dist/index-C7pEiT8L.d.cts +637 -0
- package/dist/index-CHetLTb0.d.ts +389 -0
- package/dist/index-CloeiFyx.d.ts +748 -0
- package/dist/index-DNOhq-3y.d.cts +525 -0
- package/dist/index-Da-M8FOV.d.cts +389 -0
- package/dist/index-Dy8UjRFz.d.cts +565 -0
- package/dist/index-aVcITW0B.d.ts +601 -0
- package/dist/index.cjs +8554 -0
- package/dist/index.d.cts +293 -0
- package/dist/index.d.ts +293 -0
- package/dist/index.js +742 -0
- package/dist/processing/index.cjs +1575 -0
- package/dist/processing/index.d.cts +2 -0
- package/dist/processing/index.d.ts +2 -0
- package/dist/processing/index.js +24 -0
- package/dist/retrieval/index.cjs +1262 -0
- package/dist/retrieval/index.d.cts +2 -0
- package/dist/retrieval/index.d.ts +2 -0
- package/dist/retrieval/index.js +26 -0
- package/dist/sharing/index.cjs +1003 -0
- package/dist/sharing/index.d.cts +3 -0
- package/dist/sharing/index.d.ts +3 -0
- package/dist/sharing/index.js +16 -0
- package/dist/stores/index.cjs +1445 -0
- package/dist/stores/index.d.cts +2 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/index.js +20 -0
- package/dist/structures/index.cjs +1530 -0
- package/dist/structures/index.d.cts +3 -0
- package/dist/structures/index.d.ts +3 -0
- package/dist/structures/index.js +24 -0
- package/package.json +141 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { i as MemoryStoreInterface, c as MemoryEntry, d as MemoryUpdateInput, e as MemoryQueryOptions, f as MemoryQueryResult, V as VectorSearchOptions, S as ScoredMemory } from './core.types-lkxKv-bW.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Store Types
|
|
5
|
+
*
|
|
6
|
+
* Types for memory store implementations.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* In-memory store configuration
|
|
10
|
+
*/
|
|
11
|
+
interface InMemoryStoreConfig {
|
|
12
|
+
maxSize?: number;
|
|
13
|
+
ttl?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* SQLite store configuration
|
|
17
|
+
*/
|
|
18
|
+
interface SQLiteStoreConfig {
|
|
19
|
+
path: string;
|
|
20
|
+
tableName?: string;
|
|
21
|
+
enableWAL?: boolean;
|
|
22
|
+
vectorDimensions?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* PostgreSQL store configuration
|
|
26
|
+
*/
|
|
27
|
+
interface PostgresStoreConfig {
|
|
28
|
+
connectionString?: string;
|
|
29
|
+
host?: string;
|
|
30
|
+
port?: number;
|
|
31
|
+
database?: string;
|
|
32
|
+
user?: string;
|
|
33
|
+
password?: string;
|
|
34
|
+
tableName?: string;
|
|
35
|
+
vectorDimensions?: number;
|
|
36
|
+
ssl?: boolean | Record<string, unknown>;
|
|
37
|
+
poolSize?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Redis store configuration
|
|
41
|
+
*/
|
|
42
|
+
interface RedisStoreConfig {
|
|
43
|
+
host?: string;
|
|
44
|
+
port?: number;
|
|
45
|
+
password?: string;
|
|
46
|
+
db?: number;
|
|
47
|
+
keyPrefix?: string;
|
|
48
|
+
url?: string;
|
|
49
|
+
vectorDimensions?: number;
|
|
50
|
+
ttl?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Pinecone store configuration
|
|
54
|
+
*/
|
|
55
|
+
interface PineconeStoreConfig {
|
|
56
|
+
apiKey: string;
|
|
57
|
+
environment?: string;
|
|
58
|
+
indexName: string;
|
|
59
|
+
namespace?: string;
|
|
60
|
+
dimension?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* InMemoryStore
|
|
65
|
+
*
|
|
66
|
+
* In-memory implementation for development and testing.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* In-memory store implementation
|
|
71
|
+
*/
|
|
72
|
+
declare class InMemoryStore implements MemoryStoreInterface {
|
|
73
|
+
private cache;
|
|
74
|
+
constructor(config?: InMemoryStoreConfig);
|
|
75
|
+
/**
|
|
76
|
+
* Add a memory entry
|
|
77
|
+
*/
|
|
78
|
+
add(entry: MemoryEntry): Promise<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Get a memory entry by ID
|
|
81
|
+
*/
|
|
82
|
+
get(id: string): Promise<MemoryEntry | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Update a memory entry
|
|
85
|
+
*/
|
|
86
|
+
update(id: string, updates: MemoryUpdateInput): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Delete a memory entry
|
|
89
|
+
*/
|
|
90
|
+
delete(id: string): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Query memory entries
|
|
93
|
+
*/
|
|
94
|
+
query(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Search by vector similarity
|
|
97
|
+
*/
|
|
98
|
+
search(embedding: number[], options: VectorSearchOptions): Promise<ScoredMemory[]>;
|
|
99
|
+
/**
|
|
100
|
+
* Clear entries
|
|
101
|
+
*/
|
|
102
|
+
clear(options?: {
|
|
103
|
+
namespace?: string;
|
|
104
|
+
userId?: string;
|
|
105
|
+
}): Promise<number>;
|
|
106
|
+
/**
|
|
107
|
+
* Count entries
|
|
108
|
+
*/
|
|
109
|
+
count(options?: MemoryQueryOptions): Promise<number>;
|
|
110
|
+
/**
|
|
111
|
+
* Close the store (no-op for in-memory)
|
|
112
|
+
*/
|
|
113
|
+
close(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Check if entry matches query
|
|
116
|
+
*/
|
|
117
|
+
private matchesQuery;
|
|
118
|
+
/**
|
|
119
|
+
* Check if entry matches filter
|
|
120
|
+
*/
|
|
121
|
+
private matchesFilter;
|
|
122
|
+
/**
|
|
123
|
+
* Calculate cosine similarity
|
|
124
|
+
*/
|
|
125
|
+
private cosineSimilarity;
|
|
126
|
+
/**
|
|
127
|
+
* Get all entries (for debugging)
|
|
128
|
+
*/
|
|
129
|
+
getAllEntries(): MemoryEntry[];
|
|
130
|
+
/**
|
|
131
|
+
* Get cache size
|
|
132
|
+
*/
|
|
133
|
+
get size(): number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create an in-memory store
|
|
137
|
+
*/
|
|
138
|
+
declare function createInMemoryStore(config?: InMemoryStoreConfig): InMemoryStore;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* SQLiteStore
|
|
142
|
+
*
|
|
143
|
+
* SQLite-based persistent memory store.
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* SQLite store implementation
|
|
148
|
+
*/
|
|
149
|
+
declare class SQLiteStore implements MemoryStoreInterface {
|
|
150
|
+
private db;
|
|
151
|
+
private config;
|
|
152
|
+
private tableName;
|
|
153
|
+
constructor(config: SQLiteStoreConfig);
|
|
154
|
+
/**
|
|
155
|
+
* Initialize the database
|
|
156
|
+
*/
|
|
157
|
+
initialize(): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Ensure database is initialized
|
|
160
|
+
*/
|
|
161
|
+
private ensureInitialized;
|
|
162
|
+
/**
|
|
163
|
+
* Add a memory entry
|
|
164
|
+
*/
|
|
165
|
+
add(entry: MemoryEntry): Promise<string>;
|
|
166
|
+
/**
|
|
167
|
+
* Get a memory entry by ID
|
|
168
|
+
*/
|
|
169
|
+
get(id: string): Promise<MemoryEntry | null>;
|
|
170
|
+
/**
|
|
171
|
+
* Update a memory entry
|
|
172
|
+
*/
|
|
173
|
+
update(id: string, updates: MemoryUpdateInput): Promise<boolean>;
|
|
174
|
+
/**
|
|
175
|
+
* Delete a memory entry
|
|
176
|
+
*/
|
|
177
|
+
delete(id: string): Promise<boolean>;
|
|
178
|
+
/**
|
|
179
|
+
* Query memory entries
|
|
180
|
+
*/
|
|
181
|
+
query(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
|
|
182
|
+
/**
|
|
183
|
+
* Search by vector similarity
|
|
184
|
+
*/
|
|
185
|
+
search(embedding: number[], options: VectorSearchOptions): Promise<ScoredMemory[]>;
|
|
186
|
+
/**
|
|
187
|
+
* Clear entries
|
|
188
|
+
*/
|
|
189
|
+
clear(options?: {
|
|
190
|
+
namespace?: string;
|
|
191
|
+
userId?: string;
|
|
192
|
+
}): Promise<number>;
|
|
193
|
+
/**
|
|
194
|
+
* Count entries
|
|
195
|
+
*/
|
|
196
|
+
count(options?: MemoryQueryOptions): Promise<number>;
|
|
197
|
+
/**
|
|
198
|
+
* Close the database
|
|
199
|
+
*/
|
|
200
|
+
close(): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Convert database row to MemoryEntry
|
|
203
|
+
*/
|
|
204
|
+
private rowToEntry;
|
|
205
|
+
/**
|
|
206
|
+
* Serialize vector to buffer
|
|
207
|
+
*/
|
|
208
|
+
private serializeVector;
|
|
209
|
+
/**
|
|
210
|
+
* Deserialize vector from buffer
|
|
211
|
+
*/
|
|
212
|
+
private deserializeVector;
|
|
213
|
+
/**
|
|
214
|
+
* Calculate cosine similarity
|
|
215
|
+
*/
|
|
216
|
+
private cosineSimilarity;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Create a SQLite store
|
|
220
|
+
*/
|
|
221
|
+
declare function createSQLiteStore(config: SQLiteStoreConfig): Promise<SQLiteStore>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* PostgresStore
|
|
225
|
+
*
|
|
226
|
+
* PostgreSQL-based memory store with pgvector support.
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* PostgreSQL store implementation
|
|
231
|
+
*/
|
|
232
|
+
declare class PostgresStore implements MemoryStoreInterface {
|
|
233
|
+
private pool;
|
|
234
|
+
private config;
|
|
235
|
+
private tableName;
|
|
236
|
+
private vectorDimensions;
|
|
237
|
+
private initialized;
|
|
238
|
+
constructor(config: PostgresStoreConfig);
|
|
239
|
+
/**
|
|
240
|
+
* Initialize the database
|
|
241
|
+
*/
|
|
242
|
+
initialize(): Promise<void>;
|
|
243
|
+
/**
|
|
244
|
+
* Ensure database is initialized
|
|
245
|
+
*/
|
|
246
|
+
private ensureInitialized;
|
|
247
|
+
/**
|
|
248
|
+
* Add a memory entry
|
|
249
|
+
*/
|
|
250
|
+
add(entry: MemoryEntry): Promise<string>;
|
|
251
|
+
/**
|
|
252
|
+
* Get a memory entry by ID
|
|
253
|
+
*/
|
|
254
|
+
get(id: string): Promise<MemoryEntry | null>;
|
|
255
|
+
/**
|
|
256
|
+
* Update a memory entry
|
|
257
|
+
*/
|
|
258
|
+
update(id: string, updates: MemoryUpdateInput): Promise<boolean>;
|
|
259
|
+
/**
|
|
260
|
+
* Delete a memory entry
|
|
261
|
+
*/
|
|
262
|
+
delete(id: string): Promise<boolean>;
|
|
263
|
+
/**
|
|
264
|
+
* Query memory entries
|
|
265
|
+
*/
|
|
266
|
+
query(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
|
|
267
|
+
/**
|
|
268
|
+
* Search by vector similarity using pgvector
|
|
269
|
+
*/
|
|
270
|
+
search(embedding: number[], options: VectorSearchOptions): Promise<ScoredMemory[]>;
|
|
271
|
+
/**
|
|
272
|
+
* Clear entries
|
|
273
|
+
*/
|
|
274
|
+
clear(options?: {
|
|
275
|
+
namespace?: string;
|
|
276
|
+
userId?: string;
|
|
277
|
+
}): Promise<number>;
|
|
278
|
+
/**
|
|
279
|
+
* Count entries
|
|
280
|
+
*/
|
|
281
|
+
count(options?: MemoryQueryOptions): Promise<number>;
|
|
282
|
+
/**
|
|
283
|
+
* Close the connection pool
|
|
284
|
+
*/
|
|
285
|
+
close(): Promise<void>;
|
|
286
|
+
/**
|
|
287
|
+
* Convert database row to MemoryEntry
|
|
288
|
+
*/
|
|
289
|
+
private rowToEntry;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Create a PostgreSQL store
|
|
293
|
+
*/
|
|
294
|
+
declare function createPostgresStore(config: PostgresStoreConfig): Promise<PostgresStore>;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* RedisStore
|
|
298
|
+
*
|
|
299
|
+
* Redis-based memory store with vector support.
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Redis store implementation
|
|
304
|
+
*/
|
|
305
|
+
declare class RedisStore implements MemoryStoreInterface {
|
|
306
|
+
private redis;
|
|
307
|
+
private config;
|
|
308
|
+
private keyPrefix;
|
|
309
|
+
private ttl?;
|
|
310
|
+
private initialized;
|
|
311
|
+
constructor(config: RedisStoreConfig);
|
|
312
|
+
/**
|
|
313
|
+
* Initialize Redis connection
|
|
314
|
+
*/
|
|
315
|
+
initialize(): Promise<void>;
|
|
316
|
+
/**
|
|
317
|
+
* Ensure Redis is initialized
|
|
318
|
+
*/
|
|
319
|
+
private ensureInitialized;
|
|
320
|
+
/**
|
|
321
|
+
* Get key for memory entry
|
|
322
|
+
*/
|
|
323
|
+
private getKey;
|
|
324
|
+
/**
|
|
325
|
+
* Get index key
|
|
326
|
+
*/
|
|
327
|
+
private getIndexKey;
|
|
328
|
+
/**
|
|
329
|
+
* Add a memory entry
|
|
330
|
+
*/
|
|
331
|
+
add(entry: MemoryEntry): Promise<string>;
|
|
332
|
+
/**
|
|
333
|
+
* Add entry to indexes
|
|
334
|
+
*/
|
|
335
|
+
private addToIndexes;
|
|
336
|
+
/**
|
|
337
|
+
* Remove entry from indexes
|
|
338
|
+
*/
|
|
339
|
+
private removeFromIndexes;
|
|
340
|
+
/**
|
|
341
|
+
* Get a memory entry by ID
|
|
342
|
+
*/
|
|
343
|
+
get(id: string): Promise<MemoryEntry | null>;
|
|
344
|
+
/**
|
|
345
|
+
* Update a memory entry
|
|
346
|
+
*/
|
|
347
|
+
update(id: string, updates: MemoryUpdateInput): Promise<boolean>;
|
|
348
|
+
/**
|
|
349
|
+
* Delete a memory entry
|
|
350
|
+
*/
|
|
351
|
+
delete(id: string): Promise<boolean>;
|
|
352
|
+
/**
|
|
353
|
+
* Query memory entries
|
|
354
|
+
*/
|
|
355
|
+
query(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
|
|
356
|
+
/**
|
|
357
|
+
* Check if entry matches query
|
|
358
|
+
*/
|
|
359
|
+
private matchesQuery;
|
|
360
|
+
/**
|
|
361
|
+
* Search by vector similarity
|
|
362
|
+
*/
|
|
363
|
+
search(embedding: number[], options: VectorSearchOptions): Promise<ScoredMemory[]>;
|
|
364
|
+
/**
|
|
365
|
+
* Calculate cosine similarity
|
|
366
|
+
*/
|
|
367
|
+
private cosineSimilarity;
|
|
368
|
+
/**
|
|
369
|
+
* Clear entries
|
|
370
|
+
*/
|
|
371
|
+
clear(options?: {
|
|
372
|
+
namespace?: string;
|
|
373
|
+
userId?: string;
|
|
374
|
+
}): Promise<number>;
|
|
375
|
+
/**
|
|
376
|
+
* Count entries
|
|
377
|
+
*/
|
|
378
|
+
count(options?: MemoryQueryOptions): Promise<number>;
|
|
379
|
+
/**
|
|
380
|
+
* Close Redis connection
|
|
381
|
+
*/
|
|
382
|
+
close(): Promise<void>;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Create a Redis store
|
|
386
|
+
*/
|
|
387
|
+
declare function createRedisStore(config: RedisStoreConfig): Promise<RedisStore>;
|
|
388
|
+
|
|
389
|
+
export { type InMemoryStoreConfig as I, type PostgresStoreConfig as P, type RedisStoreConfig as R, type SQLiteStoreConfig as S, type PineconeStoreConfig as a, InMemoryStore as b, createInMemoryStore as c, SQLiteStore as d, createSQLiteStore as e, PostgresStore as f, createPostgresStore as g, RedisStore as h, createRedisStore as i };
|