@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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +450 -0
  3. package/dist/chunk-GACX3FPR.js +1402 -0
  4. package/dist/chunk-M44NB53O.js +1226 -0
  5. package/dist/chunk-MQDWBPZU.js +972 -0
  6. package/dist/chunk-TPC7MYWK.js +1495 -0
  7. package/dist/chunk-XD2CQGSD.js +1540 -0
  8. package/dist/chunk-YI7RPDEV.js +1215 -0
  9. package/dist/core.types-lkxKv-bW.d.cts +242 -0
  10. package/dist/core.types-lkxKv-bW.d.ts +242 -0
  11. package/dist/debug/index.cjs +1248 -0
  12. package/dist/debug/index.d.cts +3 -0
  13. package/dist/debug/index.d.ts +3 -0
  14. package/dist/debug/index.js +20 -0
  15. package/dist/index-7SsAJ4et.d.ts +525 -0
  16. package/dist/index-BGxYqpFb.d.cts +601 -0
  17. package/dist/index-BX62efZu.d.ts +565 -0
  18. package/dist/index-Bbc3COw0.d.cts +748 -0
  19. package/dist/index-Bczz1Eyk.d.ts +637 -0
  20. package/dist/index-C7pEiT8L.d.cts +637 -0
  21. package/dist/index-CHetLTb0.d.ts +389 -0
  22. package/dist/index-CloeiFyx.d.ts +748 -0
  23. package/dist/index-DNOhq-3y.d.cts +525 -0
  24. package/dist/index-Da-M8FOV.d.cts +389 -0
  25. package/dist/index-Dy8UjRFz.d.cts +565 -0
  26. package/dist/index-aVcITW0B.d.ts +601 -0
  27. package/dist/index.cjs +8554 -0
  28. package/dist/index.d.cts +293 -0
  29. package/dist/index.d.ts +293 -0
  30. package/dist/index.js +742 -0
  31. package/dist/processing/index.cjs +1575 -0
  32. package/dist/processing/index.d.cts +2 -0
  33. package/dist/processing/index.d.ts +2 -0
  34. package/dist/processing/index.js +24 -0
  35. package/dist/retrieval/index.cjs +1262 -0
  36. package/dist/retrieval/index.d.cts +2 -0
  37. package/dist/retrieval/index.d.ts +2 -0
  38. package/dist/retrieval/index.js +26 -0
  39. package/dist/sharing/index.cjs +1003 -0
  40. package/dist/sharing/index.d.cts +3 -0
  41. package/dist/sharing/index.d.ts +3 -0
  42. package/dist/sharing/index.js +16 -0
  43. package/dist/stores/index.cjs +1445 -0
  44. package/dist/stores/index.d.cts +2 -0
  45. package/dist/stores/index.d.ts +2 -0
  46. package/dist/stores/index.js +20 -0
  47. package/dist/structures/index.cjs +1530 -0
  48. package/dist/structures/index.d.cts +3 -0
  49. package/dist/structures/index.d.ts +3 -0
  50. package/dist/structures/index.js +24 -0
  51. package/package.json +141 -0
@@ -0,0 +1,748 @@
1
+ import { EventEmitter } from 'eventemitter3';
2
+ import { c as MemoryEntry, i as MemoryStoreInterface, S as ScoredMemory } from './core.types-lkxKv-bW.js';
3
+
4
+ /**
5
+ * Structure Types
6
+ *
7
+ * Types for memory structure implementations.
8
+ */
9
+
10
+ /**
11
+ * Memory level in hierarchy
12
+ */
13
+ type MemoryLevel = 'working' | 'episodic' | 'semantic' | 'longTerm';
14
+ /**
15
+ * Memory importance source
16
+ */
17
+ type ImportanceSource = 'recency' | 'frequency' | 'explicit' | 'inferred';
18
+ /**
19
+ * Working memory configuration
20
+ */
21
+ interface WorkingMemoryConfig {
22
+ maxItems?: number;
23
+ maxSize?: number;
24
+ ttl?: number;
25
+ importance?: ImportanceSource;
26
+ onEvict?: (entry: MemoryEntry) => void;
27
+ attentionWindow?: number;
28
+ decayRate?: number;
29
+ relevanceThreshold?: number;
30
+ autoEvict?: boolean;
31
+ }
32
+ /**
33
+ * Episodic memory configuration
34
+ */
35
+ interface EpisodicMemoryConfig {
36
+ store?: MemoryStoreInterface;
37
+ consolidateAfter?: number;
38
+ summarizeThreshold?: number;
39
+ retentionDays?: number;
40
+ episodeTimeout?: number;
41
+ maxEpisodeLength?: number;
42
+ autoSummarize?: boolean;
43
+ minEventsForEpisode?: number;
44
+ emotionTracking?: boolean;
45
+ }
46
+ /**
47
+ * Semantic memory configuration
48
+ */
49
+ interface SemanticMemoryConfig {
50
+ store?: MemoryStoreInterface;
51
+ extractEntities?: boolean;
52
+ extractRelations?: boolean;
53
+ deduplication?: boolean;
54
+ deduplicationThreshold?: number;
55
+ maxConcepts?: number;
56
+ enableInference?: boolean;
57
+ conflictResolution?: 'newest' | 'highest-confidence' | 'manual' | 'merge';
58
+ minConfidence?: number;
59
+ }
60
+ /**
61
+ * Long-term memory configuration
62
+ */
63
+ interface LongTermMemoryConfig {
64
+ store?: MemoryStoreInterface;
65
+ indexing?: 'vector' | 'keyword' | 'hybrid';
66
+ compression?: boolean;
67
+ compressionThreshold?: number;
68
+ consolidationThreshold?: number;
69
+ compressionRatio?: number;
70
+ minImportance?: number;
71
+ retentionPeriod?: number;
72
+ autoConsolidate?: boolean;
73
+ maxStorageSize?: number;
74
+ }
75
+ /**
76
+ * Hierarchical memory configuration
77
+ */
78
+ interface HierarchicalMemoryConfig {
79
+ working?: WorkingMemoryConfig;
80
+ episodic?: EpisodicMemoryConfig;
81
+ semantic?: SemanticMemoryConfig;
82
+ longTerm?: LongTermMemoryConfig;
83
+ routing?: MemoryRoutingConfig;
84
+ routingStrategy?: 'importance' | 'recency' | 'type' | 'hybrid' | 'auto' | 'manual';
85
+ consolidationInterval?: number;
86
+ workingMemorySize?: number;
87
+ promotionThreshold?: number;
88
+ }
89
+ /**
90
+ * Memory routing configuration
91
+ */
92
+ interface MemoryRoutingConfig {
93
+ rules?: MemoryRoutingRule[];
94
+ defaultLevel?: MemoryLevel;
95
+ }
96
+ /**
97
+ * Memory routing rule
98
+ */
99
+ interface MemoryRoutingRule {
100
+ condition: (entry: MemoryEntry) => boolean;
101
+ target: MemoryLevel;
102
+ priority?: number;
103
+ }
104
+
105
+ /**
106
+ * WorkingMemory
107
+ *
108
+ * Short-term, context-focused memory with limited capacity.
109
+ * Implements a sliding window for recent context.
110
+ */
111
+
112
+ /**
113
+ * Working memory events
114
+ */
115
+ interface WorkingMemoryEvents {
116
+ overflow: (evicted: MemoryEntry[]) => void;
117
+ contextUpdate: (context: MemoryEntry[]) => void;
118
+ attention: (entry: MemoryEntry, score: number) => void;
119
+ }
120
+ /**
121
+ * Attention score for a memory entry
122
+ */
123
+ interface AttentionScore {
124
+ entry: MemoryEntry;
125
+ relevance: number;
126
+ recency: number;
127
+ importance: number;
128
+ total: number;
129
+ }
130
+ /**
131
+ * Working memory for short-term context management
132
+ */
133
+ declare class WorkingMemory extends EventEmitter<WorkingMemoryEvents> {
134
+ private store;
135
+ private config;
136
+ private contextWindow;
137
+ private attentionBuffer;
138
+ private currentQuery;
139
+ constructor(store: MemoryStoreInterface, config?: WorkingMemoryConfig);
140
+ /**
141
+ * Add an entry to working memory
142
+ */
143
+ add(entry: MemoryEntry): Promise<void>;
144
+ /**
145
+ * Get all entries in working memory
146
+ */
147
+ getContext(): MemoryEntry[];
148
+ /**
149
+ * Get entries with attention scores
150
+ */
151
+ getContextWithAttention(): AttentionScore[];
152
+ /**
153
+ * Update attention for an entry (e.g., when referenced)
154
+ */
155
+ attend(id: string): void;
156
+ /**
157
+ * Set the current query/context for relevance calculation
158
+ */
159
+ setQuery(query: string): void;
160
+ /**
161
+ * Decay attention scores
162
+ */
163
+ decay(): void;
164
+ /**
165
+ * Get the most attended entries
166
+ */
167
+ getFocused(limit?: number): MemoryEntry[];
168
+ /**
169
+ * Clear working memory
170
+ */
171
+ clear(): void;
172
+ /**
173
+ * Remove a specific entry
174
+ */
175
+ remove(id: string): boolean;
176
+ /**
177
+ * Get current size
178
+ */
179
+ get size(): number;
180
+ /**
181
+ * Check if at capacity
182
+ */
183
+ get isFull(): boolean;
184
+ /**
185
+ * Consolidate important items to long-term storage
186
+ */
187
+ consolidate(targetStore: MemoryStoreInterface): Promise<number>;
188
+ /**
189
+ * Load context from store
190
+ */
191
+ loadFromStore(options?: {
192
+ namespace?: string;
193
+ userId?: string;
194
+ conversationId?: string;
195
+ limit?: number;
196
+ }): Promise<void>;
197
+ /**
198
+ * Calculate relevance to current query
199
+ */
200
+ private calculateRelevance;
201
+ /**
202
+ * Evict entry with lowest attention
203
+ */
204
+ private evictLowestAttention;
205
+ /**
206
+ * Get summary of working memory state
207
+ */
208
+ getSummary(): {
209
+ size: number;
210
+ maxSize: number;
211
+ avgAttention: number;
212
+ topTypes: Record<string, number>;
213
+ };
214
+ }
215
+ /**
216
+ * Create working memory instance
217
+ */
218
+ declare function createWorkingMemory(store: MemoryStoreInterface, config?: WorkingMemoryConfig): WorkingMemory;
219
+
220
+ /**
221
+ * EpisodicMemory
222
+ *
223
+ * Stores autobiographical events, experiences, and interactions.
224
+ * Supports temporal organization and context-based retrieval.
225
+ */
226
+
227
+ /**
228
+ * Episode - a coherent sequence of related events
229
+ */
230
+ interface Episode {
231
+ id: string;
232
+ title?: string;
233
+ startTime: number;
234
+ endTime?: number;
235
+ events: MemoryEntry[];
236
+ summary?: string;
237
+ participants?: string[];
238
+ location?: string;
239
+ emotionalContext?: string;
240
+ metadata: Record<string, unknown>;
241
+ }
242
+ /**
243
+ * Episodic memory events
244
+ */
245
+ interface EpisodicMemoryEvents {
246
+ episodeStart: (episode: Episode) => void;
247
+ episodeEnd: (episode: Episode) => void;
248
+ eventAdded: (event: MemoryEntry, episode: Episode) => void;
249
+ }
250
+ /**
251
+ * Episodic memory for experiences and events
252
+ */
253
+ declare class EpisodicMemory extends EventEmitter<EpisodicMemoryEvents> {
254
+ private store;
255
+ private config;
256
+ private episodes;
257
+ private currentEpisode;
258
+ private episodeTimeout;
259
+ constructor(store: MemoryStoreInterface, config?: EpisodicMemoryConfig);
260
+ /**
261
+ * Record an event
262
+ */
263
+ recordEvent(entry: MemoryEntry): Promise<Episode>;
264
+ /**
265
+ * Start a new episode
266
+ */
267
+ startEpisode(metadata?: Record<string, unknown>): Episode;
268
+ /**
269
+ * End the current episode
270
+ */
271
+ endCurrentEpisode(): Promise<Episode | null>;
272
+ /**
273
+ * Recall events from a time period
274
+ */
275
+ recall(options: {
276
+ startTime?: number;
277
+ endTime?: number;
278
+ limit?: number;
279
+ conversationId?: string;
280
+ userId?: string;
281
+ }): Promise<MemoryEntry[]>;
282
+ /**
283
+ * Search episodes by content
284
+ */
285
+ searchEpisodes(query: string, limit?: number): Promise<Episode[]>;
286
+ /**
287
+ * Get episode by ID
288
+ */
289
+ getEpisode(id: string): Episode | undefined;
290
+ /**
291
+ * Get current episode
292
+ */
293
+ getCurrentEpisode(): Episode | null;
294
+ /**
295
+ * Get all episodes in a time range
296
+ */
297
+ getEpisodesByTimeRange(startTime: number, endTime: number): Episode[];
298
+ /**
299
+ * Get recent episodes
300
+ */
301
+ getRecentEpisodes(limit?: number): Episode[];
302
+ /**
303
+ * Find similar episodes
304
+ */
305
+ findSimilarEpisodes(episode: Episode, embedFn: (text: string) => Promise<number[]>, limit?: number): Promise<Array<{
306
+ episode: Episode;
307
+ similarity: number;
308
+ }>>;
309
+ /**
310
+ * Merge related episodes
311
+ */
312
+ mergeEpisodes(episodeIds: string[], newTitle?: string): Episode | null;
313
+ /**
314
+ * Reset episode timeout
315
+ */
316
+ private resetEpisodeTimeout;
317
+ /**
318
+ * Generate episode summary
319
+ */
320
+ private generateEpisodeSummary;
321
+ /**
322
+ * Calculate episode importance
323
+ */
324
+ private calculateEpisodeImportance;
325
+ /**
326
+ * Generate unique ID
327
+ */
328
+ private generateId;
329
+ /**
330
+ * Get statistics
331
+ */
332
+ getStats(): {
333
+ totalEpisodes: number;
334
+ currentEpisodeSize: number;
335
+ totalEvents: number;
336
+ avgEventsPerEpisode: number;
337
+ };
338
+ }
339
+ /**
340
+ * Create episodic memory instance
341
+ */
342
+ declare function createEpisodicMemory(store: MemoryStoreInterface, config?: EpisodicMemoryConfig): EpisodicMemory;
343
+
344
+ /**
345
+ * SemanticMemory
346
+ *
347
+ * Stores factual knowledge, concepts, and relationships.
348
+ * Supports knowledge graphs and concept organization.
349
+ */
350
+
351
+ /**
352
+ * Concept node in the knowledge graph
353
+ */
354
+ interface Concept {
355
+ id: string;
356
+ name: string;
357
+ description?: string;
358
+ category?: string;
359
+ attributes: Record<string, unknown>;
360
+ embedding?: number[];
361
+ createdAt: number;
362
+ updatedAt: number;
363
+ }
364
+ /**
365
+ * Relationship between concepts
366
+ */
367
+ interface Relationship {
368
+ id: string;
369
+ sourceId: string;
370
+ targetId: string;
371
+ type: string;
372
+ weight: number;
373
+ metadata: Record<string, unknown>;
374
+ createdAt: number;
375
+ }
376
+ /**
377
+ * Semantic memory events
378
+ */
379
+ interface SemanticMemoryEvents {
380
+ conceptAdded: (concept: Concept) => void;
381
+ conceptUpdated: (concept: Concept) => void;
382
+ relationshipAdded: (relationship: Relationship) => void;
383
+ factLearned: (fact: MemoryEntry) => void;
384
+ }
385
+ /**
386
+ * Semantic memory for factual knowledge
387
+ */
388
+ declare class SemanticMemory extends EventEmitter<SemanticMemoryEvents> {
389
+ private store;
390
+ private config;
391
+ private concepts;
392
+ private relationships;
393
+ private conceptIndex;
394
+ constructor(store: MemoryStoreInterface, config?: SemanticMemoryConfig);
395
+ /**
396
+ * Learn a new fact
397
+ */
398
+ learnFact(content: string, metadata?: Record<string, unknown>): Promise<MemoryEntry>;
399
+ /**
400
+ * Add or update a concept
401
+ */
402
+ addConcept(concept: Omit<Concept, 'id' | 'createdAt' | 'updatedAt'>): Concept;
403
+ /**
404
+ * Create a relationship between concepts
405
+ */
406
+ addRelationship(sourceId: string, targetId: string, type: string, metadata?: Record<string, unknown>): Relationship | null;
407
+ /**
408
+ * Get a concept by ID or name
409
+ */
410
+ getConcept(idOrName: string): Concept | undefined;
411
+ /**
412
+ * Get concepts by category
413
+ */
414
+ getConceptsByCategory(category: string): Concept[];
415
+ /**
416
+ * Get relationships for a concept
417
+ */
418
+ getRelationships(conceptId: string, direction?: 'outgoing' | 'incoming' | 'both'): Relationship[];
419
+ /**
420
+ * Get related concepts
421
+ */
422
+ getRelatedConcepts(conceptId: string, relationshipType?: string, maxDepth?: number): Array<{
423
+ concept: Concept;
424
+ path: Relationship[];
425
+ distance: number;
426
+ }>;
427
+ /**
428
+ * Query facts
429
+ */
430
+ queryFacts(query: string, limit?: number): Promise<MemoryEntry[]>;
431
+ /**
432
+ * Search facts by embedding
433
+ */
434
+ searchFacts(embedding: number[], options?: {
435
+ topK?: number;
436
+ minScore?: number;
437
+ }): Promise<Array<{
438
+ entry: MemoryEntry;
439
+ score: number;
440
+ }>>;
441
+ /**
442
+ * Find path between two concepts
443
+ */
444
+ findPath(sourceId: string, targetId: string, maxDepth?: number): Relationship[] | null;
445
+ /**
446
+ * Infer new relationships based on existing ones
447
+ */
448
+ inferRelationships(): Relationship[];
449
+ /**
450
+ * Get conflicting facts
451
+ */
452
+ findConflicts(fact: MemoryEntry): Promise<MemoryEntry[]>;
453
+ /**
454
+ * Resolve conflict between facts
455
+ */
456
+ resolveConflict(fact1: MemoryEntry, fact2: MemoryEntry): MemoryEntry;
457
+ /**
458
+ * Export knowledge graph
459
+ */
460
+ exportGraph(): {
461
+ concepts: Concept[];
462
+ relationships: Relationship[];
463
+ };
464
+ /**
465
+ * Import knowledge graph
466
+ */
467
+ importGraph(data: {
468
+ concepts: Concept[];
469
+ relationships: Relationship[];
470
+ }): void;
471
+ /**
472
+ * Generate unique ID
473
+ */
474
+ private generateId;
475
+ /**
476
+ * Get statistics
477
+ */
478
+ getStats(): {
479
+ conceptCount: number;
480
+ relationshipCount: number;
481
+ categoryCount: number;
482
+ avgRelationshipsPerConcept: number;
483
+ };
484
+ }
485
+ /**
486
+ * Create semantic memory instance
487
+ */
488
+ declare function createSemanticMemory(store: MemoryStoreInterface, config?: SemanticMemoryConfig): SemanticMemory;
489
+
490
+ /**
491
+ * LongTermMemory
492
+ *
493
+ * Persistent, compressed storage for important memories.
494
+ * Supports consolidation from working/episodic memory.
495
+ */
496
+
497
+ /**
498
+ * Consolidated memory summary
499
+ */
500
+ interface ConsolidatedMemory {
501
+ id: string;
502
+ summary: string;
503
+ sourceIds: string[];
504
+ sourceCount: number;
505
+ avgImportance: number;
506
+ timeRange: {
507
+ start: number;
508
+ end: number;
509
+ };
510
+ metadata: Record<string, unknown>;
511
+ embedding?: number[];
512
+ createdAt: number;
513
+ }
514
+ /**
515
+ * Long-term memory events
516
+ */
517
+ interface LongTermMemoryEvents {
518
+ consolidated: (consolidated: ConsolidatedMemory, sources: MemoryEntry[]) => void;
519
+ pruned: (pruned: MemoryEntry[]) => void;
520
+ retrieved: (entries: MemoryEntry[]) => void;
521
+ }
522
+ /**
523
+ * Long-term memory for persistent storage
524
+ */
525
+ declare class LongTermMemory extends EventEmitter<LongTermMemoryEvents> {
526
+ private store;
527
+ private config;
528
+ private consolidatedMemories;
529
+ constructor(store: MemoryStoreInterface, config?: LongTermMemoryConfig);
530
+ /**
531
+ * Store a memory in long-term storage
532
+ */
533
+ store_memory(entry: MemoryEntry): Promise<string>;
534
+ /**
535
+ * Retrieve memories by similarity
536
+ */
537
+ retrieve(embedding: number[], options?: {
538
+ topK?: number;
539
+ minScore?: number;
540
+ includeConsolidated?: boolean;
541
+ }): Promise<ScoredMemory[]>;
542
+ /**
543
+ * Query long-term memories
544
+ */
545
+ query(options: {
546
+ query?: string;
547
+ types?: string[];
548
+ namespace?: string;
549
+ userId?: string;
550
+ minImportance?: number;
551
+ startTime?: number;
552
+ endTime?: number;
553
+ limit?: number;
554
+ }): Promise<MemoryEntry[]>;
555
+ /**
556
+ * Consolidate old memories into summaries
557
+ */
558
+ consolidateOldMemories(options?: {
559
+ olderThan?: number;
560
+ groupBy?: 'day' | 'week' | 'topic';
561
+ summarizeFn?: (entries: MemoryEntry[]) => Promise<string>;
562
+ }): Promise<ConsolidatedMemory[]>;
563
+ /**
564
+ * Prune low-importance memories
565
+ */
566
+ prune(options?: {
567
+ maxAge?: number;
568
+ maxImportance?: number;
569
+ maxCount?: number;
570
+ }): Promise<number>;
571
+ /**
572
+ * Reinforce a memory (increase importance)
573
+ */
574
+ reinforce(id: string, amount?: number): Promise<boolean>;
575
+ /**
576
+ * Get consolidated memory by ID
577
+ */
578
+ getConsolidated(id: string): ConsolidatedMemory | undefined;
579
+ /**
580
+ * Get all consolidated memories
581
+ */
582
+ getAllConsolidated(): ConsolidatedMemory[];
583
+ /**
584
+ * Expand a consolidated memory to show original summaries
585
+ */
586
+ expandConsolidated(id: string): MemoryEntry[] | null;
587
+ /**
588
+ * Group memories by time or topic
589
+ */
590
+ private groupMemories;
591
+ /**
592
+ * Generate simple summary from entries
593
+ */
594
+ private generateSimpleSummary;
595
+ /**
596
+ * Generate unique ID
597
+ */
598
+ private generateId;
599
+ /**
600
+ * Get statistics
601
+ */
602
+ getStats(): Promise<{
603
+ totalMemories: number;
604
+ consolidatedCount: number;
605
+ avgImportance: number;
606
+ oldestMemory: number | null;
607
+ newestMemory: number | null;
608
+ }>;
609
+ }
610
+ /**
611
+ * Create long-term memory instance
612
+ */
613
+ declare function createLongTermMemory(store: MemoryStoreInterface, config?: LongTermMemoryConfig): LongTermMemory;
614
+
615
+ /**
616
+ * HierarchicalMemory
617
+ *
618
+ * Routes between working, episodic, semantic, and long-term memory.
619
+ * Manages memory consolidation and retrieval across all layers.
620
+ */
621
+
622
+ /**
623
+ * Memory layer type
624
+ */
625
+ type MemoryLayer = 'working' | 'episodic' | 'semantic' | 'longterm';
626
+ /**
627
+ * Routing decision
628
+ */
629
+ interface RoutingDecision {
630
+ layer: MemoryLayer;
631
+ confidence: number;
632
+ reason: string;
633
+ }
634
+ /**
635
+ * Hierarchical memory events
636
+ */
637
+ interface HierarchicalMemoryEvents {
638
+ routed: (entry: MemoryEntry, layer: MemoryLayer) => void;
639
+ promoted: (entry: MemoryEntry, from: MemoryLayer, to: MemoryLayer) => void;
640
+ consolidated: (from: MemoryLayer, to: MemoryLayer, count: number) => void;
641
+ retrieved: (entries: MemoryEntry[], layers: MemoryLayer[]) => void;
642
+ }
643
+ /**
644
+ * Search result with layer information
645
+ */
646
+ interface HierarchicalSearchResult {
647
+ entry: MemoryEntry;
648
+ score: number;
649
+ layer: MemoryLayer;
650
+ }
651
+ /**
652
+ * Hierarchical memory system
653
+ */
654
+ declare class HierarchicalMemory extends EventEmitter<HierarchicalMemoryEvents> {
655
+ private workingMemory;
656
+ private episodicMemory;
657
+ private semanticMemory;
658
+ private longTermMemory;
659
+ private config;
660
+ private embedFn?;
661
+ constructor(stores: {
662
+ working: MemoryStoreInterface;
663
+ episodic: MemoryStoreInterface;
664
+ semantic: MemoryStoreInterface;
665
+ longterm: MemoryStoreInterface;
666
+ }, config?: HierarchicalMemoryConfig);
667
+ /**
668
+ * Set embedding function for semantic search
669
+ */
670
+ setEmbeddingFunction(fn: (text: string) => Promise<number[]>): void;
671
+ /**
672
+ * Add a memory entry with automatic routing
673
+ */
674
+ add(entry: MemoryEntry): Promise<MemoryLayer>;
675
+ /**
676
+ * Add to a specific layer
677
+ */
678
+ addToLayer(entry: MemoryEntry, layer: MemoryLayer): Promise<void>;
679
+ /**
680
+ * Search across all memory layers
681
+ */
682
+ search(query: string, options?: {
683
+ layers?: MemoryLayer[];
684
+ topK?: number;
685
+ minScore?: number;
686
+ }): Promise<HierarchicalSearchResult[]>;
687
+ /**
688
+ * Search a specific layer
689
+ */
690
+ private searchLayer;
691
+ /**
692
+ * Get context from working memory
693
+ */
694
+ getWorkingContext(): MemoryEntry[];
695
+ /**
696
+ * Promote a memory to a higher layer
697
+ */
698
+ promote(entryId: string, from: MemoryLayer, to: MemoryLayer): Promise<boolean>;
699
+ /**
700
+ * Consolidate memories from one layer to another
701
+ */
702
+ consolidate(from: MemoryLayer, to: MemoryLayer): Promise<number>;
703
+ /**
704
+ * Route a memory entry to the appropriate layer
705
+ */
706
+ route(entry: MemoryEntry): MemoryLayer;
707
+ /**
708
+ * Make routing decision
709
+ */
710
+ private makeRoutingDecision;
711
+ /**
712
+ * Calculate text similarity score
713
+ */
714
+ private calculateTextScore;
715
+ /**
716
+ * Set up event handlers between layers
717
+ */
718
+ private setupEventHandlers;
719
+ /**
720
+ * Get statistics for all layers
721
+ */
722
+ getStats(): Promise<{
723
+ working: ReturnType<WorkingMemory['getSummary']>;
724
+ episodic: ReturnType<EpisodicMemory['getStats']>;
725
+ semantic: ReturnType<SemanticMemory['getStats']>;
726
+ longterm: Awaited<ReturnType<LongTermMemory['getStats']>>;
727
+ }>;
728
+ /**
729
+ * Access individual memory layers
730
+ */
731
+ get layers(): {
732
+ working: WorkingMemory;
733
+ episodic: EpisodicMemory;
734
+ semantic: SemanticMemory;
735
+ longterm: LongTermMemory;
736
+ };
737
+ }
738
+ /**
739
+ * Create hierarchical memory system
740
+ */
741
+ declare function createHierarchicalMemory(stores: {
742
+ working: MemoryStoreInterface;
743
+ episodic: MemoryStoreInterface;
744
+ semantic: MemoryStoreInterface;
745
+ longterm: MemoryStoreInterface;
746
+ }, config?: HierarchicalMemoryConfig): HierarchicalMemory;
747
+
748
+ export { type AttentionScore as A, type Concept as C, EpisodicMemory as E, type HierarchicalMemoryConfig as H, type LongTermMemoryConfig as L, type MemoryLayer as M, type Relationship as R, SemanticMemory as S, WorkingMemory as W, type WorkingMemoryConfig as a, type EpisodicMemoryConfig as b, type SemanticMemoryConfig as c, createWorkingMemory as d, createEpisodicMemory as e, createSemanticMemory as f, LongTermMemory as g, createLongTermMemory as h, HierarchicalMemory as i, createHierarchicalMemory as j, type WorkingMemoryEvents as k, type Episode as l, type EpisodicMemoryEvents as m, type SemanticMemoryEvents as n, type ConsolidatedMemory as o, type LongTermMemoryEvents as p, type RoutingDecision as q, type HierarchicalMemoryEvents as r, type HierarchicalSearchResult as s };