@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,293 @@
1
+ import { M as MemoryEvent, a as MemoryManagerConfig, b as MemoryInput, c as MemoryEntry, d as MemoryUpdateInput, R as RetrievalOptions, S as ScoredMemory, e as MemoryQueryOptions, f as MemoryQueryResult, g as MemoryStats, E as EmbeddingProviderInterface, h as RetrievalStrategyInterface, I as ImportanceCalculator, i as MemoryStoreInterface } from './core.types-lkxKv-bW.cjs';
2
+ export { k as MemoryMetadata, j as MemoryType, V as VectorSearchOptions } from './core.types-lkxKv-bW.cjs';
3
+ export { b as InMemoryStore, I as InMemoryStoreConfig, a as PineconeStoreConfig, f as PostgresStore, P as PostgresStoreConfig, h as RedisStore, R as RedisStoreConfig, d as SQLiteStore, S as SQLiteStoreConfig, c as createInMemoryStore, g as createPostgresStore, i as createRedisStore, e as createSQLiteStore } from './index-Da-M8FOV.cjs';
4
+ export { B as BuiltInStage, E as EmbeddingFunction, d as HybridRetrieval, H as HybridRetrievalConfig, m as HybridRetrievalOptions, P as PipelineBuilder, t as PipelineConfig, s as PipelineContext, q as PipelineStage, i as RetrievalPipeline, R as RetrievalPipelineConfig, a as RetrievalResultWithDebug, b as SemanticRetrieval, S as SemanticRetrievalConfig, l as SemanticRetrievalOptions, r as StageConfig, p as TemporalPattern, f as TemporalRetrieval, T as TemporalRetrievalConfig, n as TemporalRetrievalOptions, o as TimeWindow, h as TimeWindows, e as createHybridRetrieval, k as createPipelineBuilder, j as createRetrievalPipeline, c as createSemanticRetrieval, g as createTemporalRetrieval } from './index-Dy8UjRFz.cjs';
5
+ import { C as Concept, R as Relationship, W as WorkingMemory, E as EpisodicMemory, S as SemanticMemory } from './index-Bbc3COw0.cjs';
6
+ export { A as AttentionScore, o as ConsolidatedMemory, l as Episode, b as EpisodicMemoryConfig, m as EpisodicMemoryEvents, i as HierarchicalMemory, H as HierarchicalMemoryConfig, r as HierarchicalMemoryEvents, s as HierarchicalSearchResult, g as LongTermMemory, L as LongTermMemoryConfig, p as LongTermMemoryEvents, M as MemoryLayer, q as RoutingDecision, c as SemanticMemoryConfig, n as SemanticMemoryEvents, a as WorkingMemoryConfig, k as WorkingMemoryEvents, e as createEpisodicMemory, j as createHierarchicalMemory, h as createLongTermMemory, f as createSemanticMemory, d as createWorkingMemory } from './index-Bbc3COw0.cjs';
7
+ export { B as BatchCompressionResult, n as CompressionResult, d as Compressor, C as CompressorConfig, o as ConsolidationGroup, p as ConsolidationResult, f as Consolidator, a as ConsolidatorConfig, s as ExtractedEntity, t as ExtractedRelation, v as ExtractionFunction, u as ExtractionResult, j as Extractor, E as ExtractorConfig, h as Forgetter, F as ForgetterConfig, q as ForgettingCurve, r as ForgettingResult, R as RetentionScore, b as Summarizer, S as SummarizerConfig, m as SummaryFunction, l as SummaryResult, e as createCompressor, g as createConsolidator, k as createExtractor, i as createForgetter, c as createSummarizer } from './index-BGxYqpFb.cjs';
8
+ export { f as AccessControl, A as AccessControlConfig, s as AccessControlEvents, r as AccessLogEntry, p as AccessRequest, q as AccessResult, N as NamespaceConfig, m as NamespaceEvents, d as NamespaceManager, k as NamespaceMetadata, l as NamespaceSettings, P as Permission, o as PermissionCondition, n as PermissionRule, b as SharedMemory, S as SharedMemoryConfig, h as SharedMemoryEvents, i as SharedValue, a as SyncManagerConfig, j as SyncResult, g as createAccessControl, e as createNamespaceManager, c as createSharedMemory } from './index-DNOhq-3y.cjs';
9
+ export { B as Breakpoint, m as DebugTrace, D as Debugger, o as DebuggerEvents, p as ExportFormat, E as ExportOptions, q as ExportResult, f as Exporter, h as HealthIssue, H as HealthReport, r as ImportResult, i as InspectionResult, a as Inspector, I as InspectorConfig, M as MemoryStats, n as RetrievalDebugInfo, R as RetrievalDebugOptions, b as Timeline, T as TimelineConfig, j as TimelineEvent, l as TimelineMarker, k as TimelineSegment, e as createDebugger, g as createExporter, c as createInspector, d as createTimeline } from './index-C7pEiT8L.cjs';
10
+ import { EventEmitter } from 'eventemitter3';
11
+
12
+ /**
13
+ * MemoryManager
14
+ *
15
+ * Main orchestrator for memory operations.
16
+ */
17
+
18
+ interface MemoryManagerEvents {
19
+ 'memory:added': (event: MemoryEvent) => void;
20
+ 'memory:updated': (event: MemoryEvent) => void;
21
+ 'memory:deleted': (event: MemoryEvent) => void;
22
+ 'memory:retrieved': (event: MemoryEvent) => void;
23
+ }
24
+ /**
25
+ * Memory manager - main orchestrator
26
+ */
27
+ declare class MemoryManager extends EventEmitter<MemoryManagerEvents> {
28
+ private store;
29
+ private embedding?;
30
+ private retrieval?;
31
+ private defaultNamespace;
32
+ private autoEmbed;
33
+ private importanceCalculator;
34
+ constructor(config: MemoryManagerConfig);
35
+ /**
36
+ * Add a memory
37
+ */
38
+ add(input: MemoryInput): Promise<string>;
39
+ /**
40
+ * Add multiple memories
41
+ */
42
+ addBatch(inputs: MemoryInput[]): Promise<string[]>;
43
+ /**
44
+ * Add memory with pre-computed embedding
45
+ */
46
+ private addWithEmbedding;
47
+ /**
48
+ * Get a memory by ID
49
+ */
50
+ get(id: string): Promise<MemoryEntry | null>;
51
+ /**
52
+ * Update a memory
53
+ */
54
+ update(id: string, updates: MemoryUpdateInput): Promise<boolean>;
55
+ /**
56
+ * Delete a memory
57
+ */
58
+ delete(id: string): Promise<boolean>;
59
+ /**
60
+ * Retrieve relevant memories using semantic search
61
+ */
62
+ retrieve(query: string, options?: RetrievalOptions): Promise<ScoredMemory[]>;
63
+ /**
64
+ * Search memories with filters (non-semantic)
65
+ */
66
+ search(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
67
+ /**
68
+ * Query memories (alias for search)
69
+ */
70
+ query(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
71
+ /**
72
+ * Clear memories
73
+ */
74
+ clear(options?: {
75
+ namespace?: string;
76
+ userId?: string;
77
+ }): Promise<number>;
78
+ /**
79
+ * Get memory count
80
+ */
81
+ count(options?: MemoryQueryOptions): Promise<number>;
82
+ /**
83
+ * Get memory statistics
84
+ */
85
+ getStats(): Promise<MemoryStats>;
86
+ /**
87
+ * Set embedding provider
88
+ */
89
+ setEmbedding(embedding: EmbeddingProviderInterface): void;
90
+ /**
91
+ * Set retrieval strategy
92
+ */
93
+ setRetrieval(retrieval: RetrievalStrategyInterface): void;
94
+ /**
95
+ * Set importance calculator
96
+ */
97
+ setImportanceCalculator(calculator: ImportanceCalculator): void;
98
+ /**
99
+ * Get the underlying store
100
+ */
101
+ getStore(): MemoryStoreInterface;
102
+ /**
103
+ * Close the memory manager
104
+ */
105
+ close(): Promise<void>;
106
+ /**
107
+ * Default importance calculator
108
+ */
109
+ private defaultImportanceCalculator;
110
+ }
111
+ /**
112
+ * Create a memory manager
113
+ */
114
+ declare function createMemoryManager(config: MemoryManagerConfig): MemoryManager;
115
+
116
+ /**
117
+ * Agent memory configuration
118
+ */
119
+ interface AgentMemoryConfig {
120
+ agentId: string;
121
+ namespace?: string;
122
+ store: MemoryStoreInterface;
123
+ embedFn?: (text: string) => Promise<number[]>;
124
+ workingMemorySize?: number;
125
+ autoConsolidate?: boolean;
126
+ }
127
+ /**
128
+ * Conversation turn
129
+ */
130
+ interface ConversationTurn {
131
+ role: 'user' | 'assistant' | 'system';
132
+ content: string;
133
+ timestamp?: number;
134
+ metadata?: Record<string, unknown>;
135
+ }
136
+ /**
137
+ * Agent memory events
138
+ */
139
+ interface AgentMemoryEvents {
140
+ memoryAdded: (entry: MemoryEntry) => void;
141
+ memoryRetrieved: (entries: MemoryEntry[], query: string) => void;
142
+ conversationUpdated: (turn: ConversationTurn) => void;
143
+ contextUpdated: (context: MemoryEntry[]) => void;
144
+ }
145
+ /**
146
+ * Agent memory integration for AgentSea
147
+ */
148
+ declare class AgentMemory extends EventEmitter<AgentMemoryEvents> {
149
+ private agentId;
150
+ private namespace;
151
+ private workingMemorySize;
152
+ private store;
153
+ private manager;
154
+ private working;
155
+ private episodic;
156
+ private semantic;
157
+ private conversationHistory;
158
+ constructor(config: AgentMemoryConfig);
159
+ /**
160
+ * Remember information
161
+ */
162
+ remember(content: string, options?: {
163
+ type?: MemoryEntry['type'];
164
+ importance?: number;
165
+ tags?: string[];
166
+ metadata?: Record<string, unknown>;
167
+ }): Promise<string>;
168
+ /**
169
+ * Recall information
170
+ */
171
+ recall(query: string, options?: {
172
+ limit?: number;
173
+ minScore?: number;
174
+ types?: string[];
175
+ includeContext?: boolean;
176
+ }): Promise<MemoryEntry[]>;
177
+ /**
178
+ * Learn a fact
179
+ */
180
+ learnFact(content: string, options?: {
181
+ confidence?: number;
182
+ source?: string;
183
+ }): Promise<string>;
184
+ /**
185
+ * Record an event/experience
186
+ */
187
+ recordEvent(content: string, options?: {
188
+ importance?: number;
189
+ participants?: string[];
190
+ location?: string;
191
+ }): Promise<string>;
192
+ /**
193
+ * Add a conversation turn
194
+ */
195
+ addConversationTurn(turn: ConversationTurn): Promise<void>;
196
+ /**
197
+ * Get recent conversation
198
+ */
199
+ getRecentConversation(turns?: number): ConversationTurn[];
200
+ /**
201
+ * Format conversation for LLM context
202
+ */
203
+ formatConversationForContext(turns?: number): string;
204
+ /**
205
+ * Get working memory context
206
+ */
207
+ getWorkingContext(): MemoryEntry[];
208
+ /**
209
+ * Clear working memory
210
+ */
211
+ clearWorkingMemory(): void;
212
+ /**
213
+ * Clear conversation history
214
+ */
215
+ clearConversation(): void;
216
+ /**
217
+ * Forget a specific memory
218
+ */
219
+ forget(id: string): Promise<boolean>;
220
+ /**
221
+ * Update a memory
222
+ */
223
+ update(id: string, updates: {
224
+ content?: string;
225
+ importance?: number;
226
+ metadata?: Record<string, unknown>;
227
+ }): Promise<boolean>;
228
+ /**
229
+ * Search by semantic similarity
230
+ */
231
+ searchSimilar(text: string, options?: {
232
+ topK?: number;
233
+ minScore?: number;
234
+ }): Promise<ScoredMemory[]>;
235
+ /**
236
+ * Get memory by ID
237
+ */
238
+ get(id: string): Promise<MemoryEntry | null>;
239
+ /**
240
+ * Get agent statistics
241
+ */
242
+ getStats(): Promise<{
243
+ totalMemories: number;
244
+ workingMemorySize: number;
245
+ conversationLength: number;
246
+ currentEpisode: {
247
+ eventCount: number;
248
+ } | null;
249
+ factCount: number;
250
+ }>;
251
+ /**
252
+ * Consolidate memories
253
+ */
254
+ consolidate(): Promise<number>;
255
+ /**
256
+ * Get related concepts
257
+ */
258
+ getRelatedConcepts(conceptId: string, depth?: number): Promise<{
259
+ concept: Concept;
260
+ path: Relationship[];
261
+ distance: number;
262
+ }[]>;
263
+ /**
264
+ * Export agent memory
265
+ */
266
+ export(): Promise<{
267
+ agentId: string;
268
+ namespace: string;
269
+ conversationHistory: ConversationTurn[];
270
+ workingContext: MemoryEntry[];
271
+ stats: Awaited<ReturnType<AgentMemory['getStats']>>;
272
+ exportedAt: number;
273
+ }>;
274
+ /**
275
+ * Set up event forwarding
276
+ */
277
+ private setupEventForwarding;
278
+ /**
279
+ * Access underlying components
280
+ */
281
+ get components(): {
282
+ manager: MemoryManager;
283
+ working: WorkingMemory;
284
+ episodic: EpisodicMemory;
285
+ semantic: SemanticMemory;
286
+ };
287
+ }
288
+ /**
289
+ * Create agent memory
290
+ */
291
+ declare function createAgentMemory(config: AgentMemoryConfig): AgentMemory;
292
+
293
+ export { AgentMemory, type AgentMemoryConfig, type AgentMemoryEvents, Concept, type ConversationTurn, EmbeddingProviderInterface, EpisodicMemory, MemoryEntry, MemoryInput, MemoryManager, MemoryManagerConfig, MemoryQueryOptions, MemoryQueryResult, MemoryStoreInterface, MemoryUpdateInput, Relationship, RetrievalOptions, RetrievalStrategyInterface, ScoredMemory, SemanticMemory, WorkingMemory, createAgentMemory, createMemoryManager };
@@ -0,0 +1,293 @@
1
+ import { M as MemoryEvent, a as MemoryManagerConfig, b as MemoryInput, c as MemoryEntry, d as MemoryUpdateInput, R as RetrievalOptions, S as ScoredMemory, e as MemoryQueryOptions, f as MemoryQueryResult, g as MemoryStats, E as EmbeddingProviderInterface, h as RetrievalStrategyInterface, I as ImportanceCalculator, i as MemoryStoreInterface } from './core.types-lkxKv-bW.js';
2
+ export { k as MemoryMetadata, j as MemoryType, V as VectorSearchOptions } from './core.types-lkxKv-bW.js';
3
+ export { b as InMemoryStore, I as InMemoryStoreConfig, a as PineconeStoreConfig, f as PostgresStore, P as PostgresStoreConfig, h as RedisStore, R as RedisStoreConfig, d as SQLiteStore, S as SQLiteStoreConfig, c as createInMemoryStore, g as createPostgresStore, i as createRedisStore, e as createSQLiteStore } from './index-CHetLTb0.js';
4
+ export { B as BuiltInStage, E as EmbeddingFunction, d as HybridRetrieval, H as HybridRetrievalConfig, m as HybridRetrievalOptions, P as PipelineBuilder, t as PipelineConfig, s as PipelineContext, q as PipelineStage, i as RetrievalPipeline, R as RetrievalPipelineConfig, a as RetrievalResultWithDebug, b as SemanticRetrieval, S as SemanticRetrievalConfig, l as SemanticRetrievalOptions, r as StageConfig, p as TemporalPattern, f as TemporalRetrieval, T as TemporalRetrievalConfig, n as TemporalRetrievalOptions, o as TimeWindow, h as TimeWindows, e as createHybridRetrieval, k as createPipelineBuilder, j as createRetrievalPipeline, c as createSemanticRetrieval, g as createTemporalRetrieval } from './index-BX62efZu.js';
5
+ import { C as Concept, R as Relationship, W as WorkingMemory, E as EpisodicMemory, S as SemanticMemory } from './index-CloeiFyx.js';
6
+ export { A as AttentionScore, o as ConsolidatedMemory, l as Episode, b as EpisodicMemoryConfig, m as EpisodicMemoryEvents, i as HierarchicalMemory, H as HierarchicalMemoryConfig, r as HierarchicalMemoryEvents, s as HierarchicalSearchResult, g as LongTermMemory, L as LongTermMemoryConfig, p as LongTermMemoryEvents, M as MemoryLayer, q as RoutingDecision, c as SemanticMemoryConfig, n as SemanticMemoryEvents, a as WorkingMemoryConfig, k as WorkingMemoryEvents, e as createEpisodicMemory, j as createHierarchicalMemory, h as createLongTermMemory, f as createSemanticMemory, d as createWorkingMemory } from './index-CloeiFyx.js';
7
+ export { B as BatchCompressionResult, n as CompressionResult, d as Compressor, C as CompressorConfig, o as ConsolidationGroup, p as ConsolidationResult, f as Consolidator, a as ConsolidatorConfig, s as ExtractedEntity, t as ExtractedRelation, v as ExtractionFunction, u as ExtractionResult, j as Extractor, E as ExtractorConfig, h as Forgetter, F as ForgetterConfig, q as ForgettingCurve, r as ForgettingResult, R as RetentionScore, b as Summarizer, S as SummarizerConfig, m as SummaryFunction, l as SummaryResult, e as createCompressor, g as createConsolidator, k as createExtractor, i as createForgetter, c as createSummarizer } from './index-aVcITW0B.js';
8
+ export { f as AccessControl, A as AccessControlConfig, s as AccessControlEvents, r as AccessLogEntry, p as AccessRequest, q as AccessResult, N as NamespaceConfig, m as NamespaceEvents, d as NamespaceManager, k as NamespaceMetadata, l as NamespaceSettings, P as Permission, o as PermissionCondition, n as PermissionRule, b as SharedMemory, S as SharedMemoryConfig, h as SharedMemoryEvents, i as SharedValue, a as SyncManagerConfig, j as SyncResult, g as createAccessControl, e as createNamespaceManager, c as createSharedMemory } from './index-7SsAJ4et.js';
9
+ export { B as Breakpoint, m as DebugTrace, D as Debugger, o as DebuggerEvents, p as ExportFormat, E as ExportOptions, q as ExportResult, f as Exporter, h as HealthIssue, H as HealthReport, r as ImportResult, i as InspectionResult, a as Inspector, I as InspectorConfig, M as MemoryStats, n as RetrievalDebugInfo, R as RetrievalDebugOptions, b as Timeline, T as TimelineConfig, j as TimelineEvent, l as TimelineMarker, k as TimelineSegment, e as createDebugger, g as createExporter, c as createInspector, d as createTimeline } from './index-Bczz1Eyk.js';
10
+ import { EventEmitter } from 'eventemitter3';
11
+
12
+ /**
13
+ * MemoryManager
14
+ *
15
+ * Main orchestrator for memory operations.
16
+ */
17
+
18
+ interface MemoryManagerEvents {
19
+ 'memory:added': (event: MemoryEvent) => void;
20
+ 'memory:updated': (event: MemoryEvent) => void;
21
+ 'memory:deleted': (event: MemoryEvent) => void;
22
+ 'memory:retrieved': (event: MemoryEvent) => void;
23
+ }
24
+ /**
25
+ * Memory manager - main orchestrator
26
+ */
27
+ declare class MemoryManager extends EventEmitter<MemoryManagerEvents> {
28
+ private store;
29
+ private embedding?;
30
+ private retrieval?;
31
+ private defaultNamespace;
32
+ private autoEmbed;
33
+ private importanceCalculator;
34
+ constructor(config: MemoryManagerConfig);
35
+ /**
36
+ * Add a memory
37
+ */
38
+ add(input: MemoryInput): Promise<string>;
39
+ /**
40
+ * Add multiple memories
41
+ */
42
+ addBatch(inputs: MemoryInput[]): Promise<string[]>;
43
+ /**
44
+ * Add memory with pre-computed embedding
45
+ */
46
+ private addWithEmbedding;
47
+ /**
48
+ * Get a memory by ID
49
+ */
50
+ get(id: string): Promise<MemoryEntry | null>;
51
+ /**
52
+ * Update a memory
53
+ */
54
+ update(id: string, updates: MemoryUpdateInput): Promise<boolean>;
55
+ /**
56
+ * Delete a memory
57
+ */
58
+ delete(id: string): Promise<boolean>;
59
+ /**
60
+ * Retrieve relevant memories using semantic search
61
+ */
62
+ retrieve(query: string, options?: RetrievalOptions): Promise<ScoredMemory[]>;
63
+ /**
64
+ * Search memories with filters (non-semantic)
65
+ */
66
+ search(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
67
+ /**
68
+ * Query memories (alias for search)
69
+ */
70
+ query(options: MemoryQueryOptions): Promise<MemoryQueryResult>;
71
+ /**
72
+ * Clear memories
73
+ */
74
+ clear(options?: {
75
+ namespace?: string;
76
+ userId?: string;
77
+ }): Promise<number>;
78
+ /**
79
+ * Get memory count
80
+ */
81
+ count(options?: MemoryQueryOptions): Promise<number>;
82
+ /**
83
+ * Get memory statistics
84
+ */
85
+ getStats(): Promise<MemoryStats>;
86
+ /**
87
+ * Set embedding provider
88
+ */
89
+ setEmbedding(embedding: EmbeddingProviderInterface): void;
90
+ /**
91
+ * Set retrieval strategy
92
+ */
93
+ setRetrieval(retrieval: RetrievalStrategyInterface): void;
94
+ /**
95
+ * Set importance calculator
96
+ */
97
+ setImportanceCalculator(calculator: ImportanceCalculator): void;
98
+ /**
99
+ * Get the underlying store
100
+ */
101
+ getStore(): MemoryStoreInterface;
102
+ /**
103
+ * Close the memory manager
104
+ */
105
+ close(): Promise<void>;
106
+ /**
107
+ * Default importance calculator
108
+ */
109
+ private defaultImportanceCalculator;
110
+ }
111
+ /**
112
+ * Create a memory manager
113
+ */
114
+ declare function createMemoryManager(config: MemoryManagerConfig): MemoryManager;
115
+
116
+ /**
117
+ * Agent memory configuration
118
+ */
119
+ interface AgentMemoryConfig {
120
+ agentId: string;
121
+ namespace?: string;
122
+ store: MemoryStoreInterface;
123
+ embedFn?: (text: string) => Promise<number[]>;
124
+ workingMemorySize?: number;
125
+ autoConsolidate?: boolean;
126
+ }
127
+ /**
128
+ * Conversation turn
129
+ */
130
+ interface ConversationTurn {
131
+ role: 'user' | 'assistant' | 'system';
132
+ content: string;
133
+ timestamp?: number;
134
+ metadata?: Record<string, unknown>;
135
+ }
136
+ /**
137
+ * Agent memory events
138
+ */
139
+ interface AgentMemoryEvents {
140
+ memoryAdded: (entry: MemoryEntry) => void;
141
+ memoryRetrieved: (entries: MemoryEntry[], query: string) => void;
142
+ conversationUpdated: (turn: ConversationTurn) => void;
143
+ contextUpdated: (context: MemoryEntry[]) => void;
144
+ }
145
+ /**
146
+ * Agent memory integration for AgentSea
147
+ */
148
+ declare class AgentMemory extends EventEmitter<AgentMemoryEvents> {
149
+ private agentId;
150
+ private namespace;
151
+ private workingMemorySize;
152
+ private store;
153
+ private manager;
154
+ private working;
155
+ private episodic;
156
+ private semantic;
157
+ private conversationHistory;
158
+ constructor(config: AgentMemoryConfig);
159
+ /**
160
+ * Remember information
161
+ */
162
+ remember(content: string, options?: {
163
+ type?: MemoryEntry['type'];
164
+ importance?: number;
165
+ tags?: string[];
166
+ metadata?: Record<string, unknown>;
167
+ }): Promise<string>;
168
+ /**
169
+ * Recall information
170
+ */
171
+ recall(query: string, options?: {
172
+ limit?: number;
173
+ minScore?: number;
174
+ types?: string[];
175
+ includeContext?: boolean;
176
+ }): Promise<MemoryEntry[]>;
177
+ /**
178
+ * Learn a fact
179
+ */
180
+ learnFact(content: string, options?: {
181
+ confidence?: number;
182
+ source?: string;
183
+ }): Promise<string>;
184
+ /**
185
+ * Record an event/experience
186
+ */
187
+ recordEvent(content: string, options?: {
188
+ importance?: number;
189
+ participants?: string[];
190
+ location?: string;
191
+ }): Promise<string>;
192
+ /**
193
+ * Add a conversation turn
194
+ */
195
+ addConversationTurn(turn: ConversationTurn): Promise<void>;
196
+ /**
197
+ * Get recent conversation
198
+ */
199
+ getRecentConversation(turns?: number): ConversationTurn[];
200
+ /**
201
+ * Format conversation for LLM context
202
+ */
203
+ formatConversationForContext(turns?: number): string;
204
+ /**
205
+ * Get working memory context
206
+ */
207
+ getWorkingContext(): MemoryEntry[];
208
+ /**
209
+ * Clear working memory
210
+ */
211
+ clearWorkingMemory(): void;
212
+ /**
213
+ * Clear conversation history
214
+ */
215
+ clearConversation(): void;
216
+ /**
217
+ * Forget a specific memory
218
+ */
219
+ forget(id: string): Promise<boolean>;
220
+ /**
221
+ * Update a memory
222
+ */
223
+ update(id: string, updates: {
224
+ content?: string;
225
+ importance?: number;
226
+ metadata?: Record<string, unknown>;
227
+ }): Promise<boolean>;
228
+ /**
229
+ * Search by semantic similarity
230
+ */
231
+ searchSimilar(text: string, options?: {
232
+ topK?: number;
233
+ minScore?: number;
234
+ }): Promise<ScoredMemory[]>;
235
+ /**
236
+ * Get memory by ID
237
+ */
238
+ get(id: string): Promise<MemoryEntry | null>;
239
+ /**
240
+ * Get agent statistics
241
+ */
242
+ getStats(): Promise<{
243
+ totalMemories: number;
244
+ workingMemorySize: number;
245
+ conversationLength: number;
246
+ currentEpisode: {
247
+ eventCount: number;
248
+ } | null;
249
+ factCount: number;
250
+ }>;
251
+ /**
252
+ * Consolidate memories
253
+ */
254
+ consolidate(): Promise<number>;
255
+ /**
256
+ * Get related concepts
257
+ */
258
+ getRelatedConcepts(conceptId: string, depth?: number): Promise<{
259
+ concept: Concept;
260
+ path: Relationship[];
261
+ distance: number;
262
+ }[]>;
263
+ /**
264
+ * Export agent memory
265
+ */
266
+ export(): Promise<{
267
+ agentId: string;
268
+ namespace: string;
269
+ conversationHistory: ConversationTurn[];
270
+ workingContext: MemoryEntry[];
271
+ stats: Awaited<ReturnType<AgentMemory['getStats']>>;
272
+ exportedAt: number;
273
+ }>;
274
+ /**
275
+ * Set up event forwarding
276
+ */
277
+ private setupEventForwarding;
278
+ /**
279
+ * Access underlying components
280
+ */
281
+ get components(): {
282
+ manager: MemoryManager;
283
+ working: WorkingMemory;
284
+ episodic: EpisodicMemory;
285
+ semantic: SemanticMemory;
286
+ };
287
+ }
288
+ /**
289
+ * Create agent memory
290
+ */
291
+ declare function createAgentMemory(config: AgentMemoryConfig): AgentMemory;
292
+
293
+ export { AgentMemory, type AgentMemoryConfig, type AgentMemoryEvents, Concept, type ConversationTurn, EmbeddingProviderInterface, EpisodicMemory, MemoryEntry, MemoryInput, MemoryManager, MemoryManagerConfig, MemoryQueryOptions, MemoryQueryResult, MemoryStoreInterface, MemoryUpdateInput, Relationship, RetrievalOptions, RetrievalStrategyInterface, ScoredMemory, SemanticMemory, WorkingMemory, createAgentMemory, createMemoryManager };