moflo 4.0.1 → 4.0.3

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 (91) hide show
  1. package/.claude/guidance/agent-bootstrap.md +12 -6
  2. package/bin/setup-project.mjs +201 -0
  3. package/package.json +114 -109
  4. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +194 -81
  5. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +1892 -1841
  6. package/v3/@claude-flow/memory/README.md +587 -0
  7. package/v3/@claude-flow/memory/dist/agent-memory-scope.d.ts +131 -0
  8. package/v3/@claude-flow/memory/dist/agent-memory-scope.js +223 -0
  9. package/v3/@claude-flow/memory/dist/agent-memory-scope.test.d.ts +8 -0
  10. package/v3/@claude-flow/memory/dist/agent-memory-scope.test.js +463 -0
  11. package/v3/@claude-flow/memory/dist/agentdb-adapter.d.ts +165 -0
  12. package/v3/@claude-flow/memory/dist/agentdb-adapter.js +806 -0
  13. package/v3/@claude-flow/memory/dist/agentdb-backend.d.ts +214 -0
  14. package/v3/@claude-flow/memory/dist/agentdb-backend.js +844 -0
  15. package/v3/@claude-flow/memory/dist/agentdb-backend.test.d.ts +7 -0
  16. package/v3/@claude-flow/memory/dist/agentdb-backend.test.js +258 -0
  17. package/v3/@claude-flow/memory/dist/application/commands/delete-memory.command.d.ts +65 -0
  18. package/v3/@claude-flow/memory/dist/application/commands/delete-memory.command.js +129 -0
  19. package/v3/@claude-flow/memory/dist/application/commands/store-memory.command.d.ts +48 -0
  20. package/v3/@claude-flow/memory/dist/application/commands/store-memory.command.js +72 -0
  21. package/v3/@claude-flow/memory/dist/application/index.d.ts +12 -0
  22. package/v3/@claude-flow/memory/dist/application/index.js +15 -0
  23. package/v3/@claude-flow/memory/dist/application/queries/search-memory.query.d.ts +72 -0
  24. package/v3/@claude-flow/memory/dist/application/queries/search-memory.query.js +143 -0
  25. package/v3/@claude-flow/memory/dist/application/services/memory-application-service.d.ts +121 -0
  26. package/v3/@claude-flow/memory/dist/application/services/memory-application-service.js +190 -0
  27. package/v3/@claude-flow/memory/dist/auto-memory-bridge.d.ts +226 -0
  28. package/v3/@claude-flow/memory/dist/auto-memory-bridge.js +709 -0
  29. package/v3/@claude-flow/memory/dist/auto-memory-bridge.test.d.ts +8 -0
  30. package/v3/@claude-flow/memory/dist/auto-memory-bridge.test.js +754 -0
  31. package/v3/@claude-flow/memory/dist/benchmark.test.d.ts +2 -0
  32. package/v3/@claude-flow/memory/dist/benchmark.test.js +277 -0
  33. package/v3/@claude-flow/memory/dist/cache-manager.d.ts +134 -0
  34. package/v3/@claude-flow/memory/dist/cache-manager.js +407 -0
  35. package/v3/@claude-flow/memory/dist/controller-registry.d.ts +216 -0
  36. package/v3/@claude-flow/memory/dist/controller-registry.js +893 -0
  37. package/v3/@claude-flow/memory/dist/controller-registry.test.d.ts +14 -0
  38. package/v3/@claude-flow/memory/dist/controller-registry.test.js +636 -0
  39. package/v3/@claude-flow/memory/dist/database-provider.d.ts +87 -0
  40. package/v3/@claude-flow/memory/dist/database-provider.js +410 -0
  41. package/v3/@claude-flow/memory/dist/database-provider.test.d.ts +7 -0
  42. package/v3/@claude-flow/memory/dist/database-provider.test.js +285 -0
  43. package/v3/@claude-flow/memory/dist/domain/entities/memory-entry.d.ts +143 -0
  44. package/v3/@claude-flow/memory/dist/domain/entities/memory-entry.js +226 -0
  45. package/v3/@claude-flow/memory/dist/domain/index.d.ts +11 -0
  46. package/v3/@claude-flow/memory/dist/domain/index.js +12 -0
  47. package/v3/@claude-flow/memory/dist/domain/repositories/memory-repository.interface.d.ts +102 -0
  48. package/v3/@claude-flow/memory/dist/domain/repositories/memory-repository.interface.js +11 -0
  49. package/v3/@claude-flow/memory/dist/domain/services/memory-domain-service.d.ts +105 -0
  50. package/v3/@claude-flow/memory/dist/domain/services/memory-domain-service.js +297 -0
  51. package/v3/@claude-flow/memory/dist/hnsw-index.d.ts +111 -0
  52. package/v3/@claude-flow/memory/dist/hnsw-index.js +781 -0
  53. package/v3/@claude-flow/memory/dist/hnsw-lite.d.ts +23 -0
  54. package/v3/@claude-flow/memory/dist/hnsw-lite.js +168 -0
  55. package/v3/@claude-flow/memory/dist/hybrid-backend.d.ts +245 -0
  56. package/v3/@claude-flow/memory/dist/hybrid-backend.js +569 -0
  57. package/v3/@claude-flow/memory/dist/hybrid-backend.test.d.ts +8 -0
  58. package/v3/@claude-flow/memory/dist/hybrid-backend.test.js +320 -0
  59. package/v3/@claude-flow/memory/dist/index.d.ts +208 -0
  60. package/v3/@claude-flow/memory/dist/index.js +362 -0
  61. package/v3/@claude-flow/memory/dist/infrastructure/index.d.ts +17 -0
  62. package/v3/@claude-flow/memory/dist/infrastructure/index.js +16 -0
  63. package/v3/@claude-flow/memory/dist/infrastructure/repositories/hybrid-memory-repository.d.ts +66 -0
  64. package/v3/@claude-flow/memory/dist/infrastructure/repositories/hybrid-memory-repository.js +409 -0
  65. package/v3/@claude-flow/memory/dist/learning-bridge.d.ts +137 -0
  66. package/v3/@claude-flow/memory/dist/learning-bridge.js +335 -0
  67. package/v3/@claude-flow/memory/dist/learning-bridge.test.d.ts +8 -0
  68. package/v3/@claude-flow/memory/dist/learning-bridge.test.js +578 -0
  69. package/v3/@claude-flow/memory/dist/memory-graph.d.ts +100 -0
  70. package/v3/@claude-flow/memory/dist/memory-graph.js +333 -0
  71. package/v3/@claude-flow/memory/dist/memory-graph.test.d.ts +8 -0
  72. package/v3/@claude-flow/memory/dist/memory-graph.test.js +609 -0
  73. package/v3/@claude-flow/memory/dist/migration.d.ts +68 -0
  74. package/v3/@claude-flow/memory/dist/migration.js +513 -0
  75. package/v3/@claude-flow/memory/dist/persistent-sona.d.ts +144 -0
  76. package/v3/@claude-flow/memory/dist/persistent-sona.js +332 -0
  77. package/v3/@claude-flow/memory/dist/query-builder.d.ts +211 -0
  78. package/v3/@claude-flow/memory/dist/query-builder.js +438 -0
  79. package/v3/@claude-flow/memory/dist/rvf-backend.d.ts +51 -0
  80. package/v3/@claude-flow/memory/dist/rvf-backend.js +481 -0
  81. package/v3/@claude-flow/memory/dist/rvf-learning-store.d.ts +139 -0
  82. package/v3/@claude-flow/memory/dist/rvf-learning-store.js +295 -0
  83. package/v3/@claude-flow/memory/dist/rvf-migration.d.ts +45 -0
  84. package/v3/@claude-flow/memory/dist/rvf-migration.js +254 -0
  85. package/v3/@claude-flow/memory/dist/sqlite-backend.d.ts +121 -0
  86. package/v3/@claude-flow/memory/dist/sqlite-backend.js +564 -0
  87. package/v3/@claude-flow/memory/dist/sqljs-backend.d.ts +128 -0
  88. package/v3/@claude-flow/memory/dist/sqljs-backend.js +601 -0
  89. package/v3/@claude-flow/memory/dist/types.d.ts +484 -0
  90. package/v3/@claude-flow/memory/dist/types.js +58 -0
  91. package/v3/@claude-flow/memory/package.json +46 -0
@@ -0,0 +1,362 @@
1
+ /**
2
+ * @claude-flow/memory - V3 Unified Memory System
3
+ *
4
+ * Provides a unified memory interface backed by AgentDB with HNSW indexing
5
+ * for 150x-12,500x faster vector search compared to brute-force approaches.
6
+ *
7
+ * @module @claude-flow/memory
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { UnifiedMemoryService, query, QueryTemplates } from '@claude-flow/memory';
12
+ *
13
+ * // Initialize the memory service
14
+ * const memory = new UnifiedMemoryService({
15
+ * dimensions: 1536,
16
+ * cacheEnabled: true,
17
+ * embeddingGenerator: async (text) => embeddings.embed(text),
18
+ * });
19
+ *
20
+ * await memory.initialize();
21
+ *
22
+ * // Store entries
23
+ * await memory.store({
24
+ * key: 'auth-patterns',
25
+ * content: 'OAuth 2.0 implementation patterns for secure authentication',
26
+ * tags: ['auth', 'security', 'patterns'],
27
+ * });
28
+ *
29
+ * // Semantic search
30
+ * const results = await memory.semanticSearch('user authentication best practices', 5);
31
+ *
32
+ * // Query with fluent builder
33
+ * const entries = await memory.query(
34
+ * query()
35
+ * .semantic('security vulnerabilities')
36
+ * .inNamespace('security')
37
+ * .withTags(['critical'])
38
+ * .threshold(0.8)
39
+ * .limit(10)
40
+ * .build()
41
+ * );
42
+ * ```
43
+ */
44
+ // Utility Functions and Constants (runtime values)
45
+ export { generateMemoryId, createDefaultEntry, PERFORMANCE_TARGETS, } from './types.js';
46
+ // ===== Auto Memory Bridge (ADR-048) =====
47
+ export { AutoMemoryBridge, resolveAutoMemoryDir, findGitRoot } from './auto-memory-bridge.js';
48
+ // ===== Learning Bridge =====
49
+ export { LearningBridge } from './learning-bridge.js';
50
+ // ===== RVF Learning Persistence (ADR-057 Phase 6) =====
51
+ export { RvfLearningStore } from './rvf-learning-store.js';
52
+ export { PersistentSonaCoordinator } from './persistent-sona.js';
53
+ // ===== RVF Migration (Bidirectional) =====
54
+ export { RvfMigrator } from './rvf-migration.js';
55
+ // ===== Knowledge Graph =====
56
+ export { MemoryGraph } from './memory-graph.js';
57
+ // ===== Agent-Scoped Memory =====
58
+ export { resolveAgentMemoryDir, createAgentBridge, transferKnowledge, listAgentScopes, } from './agent-memory-scope.js';
59
+ // ===== Controller Registry (ADR-053) =====
60
+ export { ControllerRegistry, INIT_LEVELS } from './controller-registry.js';
61
+ // ===== Core Components =====
62
+ export { AgentDBAdapter } from './agentdb-adapter.js';
63
+ export { AgentDBBackend } from './agentdb-backend.js';
64
+ export { SQLiteBackend } from './sqlite-backend.js';
65
+ export { SqlJsBackend } from './sqljs-backend.js';
66
+ export { HybridBackend } from './hybrid-backend.js';
67
+ export { RvfBackend } from './rvf-backend.js';
68
+ export { HnswLite, cosineSimilarity } from './hnsw-lite.js';
69
+ export { HNSWIndex } from './hnsw-index.js';
70
+ export { CacheManager, TieredCacheManager } from './cache-manager.js';
71
+ export { QueryBuilder, query, QueryTemplates } from './query-builder.js';
72
+ export { MemoryMigrator, createMigrator, migrateMultipleSources } from './migration.js';
73
+ export { createDatabase, getPlatformInfo, getAvailableProviders } from './database-provider.js';
74
+ // ===== Unified Memory Service =====
75
+ import { EventEmitter } from 'node:events';
76
+ import { AgentDBAdapter } from './agentdb-adapter.js';
77
+ import { MemoryMigrator } from './migration.js';
78
+ /**
79
+ * Unified Memory Service
80
+ *
81
+ * High-level interface for the V3 memory system that provides:
82
+ * - Simple API for common operations
83
+ * - Automatic embedding generation
84
+ * - Cross-agent memory sharing
85
+ * - SONA integration for learning
86
+ * - Event-driven notifications
87
+ * - Performance monitoring
88
+ */
89
+ export class UnifiedMemoryService extends EventEmitter {
90
+ adapter;
91
+ config;
92
+ initialized = false;
93
+ constructor(config = {}) {
94
+ super();
95
+ this.config = {
96
+ dimensions: 1536,
97
+ cacheEnabled: true,
98
+ autoEmbed: true,
99
+ ...config,
100
+ };
101
+ this.adapter = new AgentDBAdapter({
102
+ dimensions: this.config.dimensions,
103
+ cacheEnabled: this.config.cacheEnabled,
104
+ cacheSize: this.config.cacheSize,
105
+ cacheTtl: this.config.cacheTtl,
106
+ hnswM: this.config.hnswM,
107
+ hnswEfConstruction: this.config.hnswEfConstruction,
108
+ defaultNamespace: this.config.defaultNamespace,
109
+ embeddingGenerator: this.config.embeddingGenerator,
110
+ persistenceEnabled: this.config.persistenceEnabled,
111
+ persistencePath: this.config.persistencePath,
112
+ maxEntries: this.config.maxEntries,
113
+ });
114
+ // Forward adapter events
115
+ this.adapter.on('entry:stored', (data) => this.emit('entry:stored', data));
116
+ this.adapter.on('entry:updated', (data) => this.emit('entry:updated', data));
117
+ this.adapter.on('entry:deleted', (data) => this.emit('entry:deleted', data));
118
+ this.adapter.on('cache:hit', (data) => this.emit('cache:hit', data));
119
+ this.adapter.on('cache:miss', (data) => this.emit('cache:miss', data));
120
+ this.adapter.on('index:added', (data) => this.emit('index:added', data));
121
+ }
122
+ // ===== Lifecycle =====
123
+ async initialize() {
124
+ if (this.initialized)
125
+ return;
126
+ await this.adapter.initialize();
127
+ this.initialized = true;
128
+ this.emit('initialized');
129
+ }
130
+ async shutdown() {
131
+ if (!this.initialized)
132
+ return;
133
+ await this.adapter.shutdown();
134
+ this.initialized = false;
135
+ this.emit('shutdown');
136
+ }
137
+ // ===== IMemoryBackend Implementation =====
138
+ async store(entry) {
139
+ return this.adapter.store(entry);
140
+ }
141
+ async get(id) {
142
+ return this.adapter.get(id);
143
+ }
144
+ async getByKey(namespace, key) {
145
+ return this.adapter.getByKey(namespace, key);
146
+ }
147
+ async update(id, update) {
148
+ return this.adapter.update(id, update);
149
+ }
150
+ async delete(id) {
151
+ return this.adapter.delete(id);
152
+ }
153
+ async query(query) {
154
+ return this.adapter.query(query);
155
+ }
156
+ async search(embedding, options) {
157
+ return this.adapter.search(embedding, options);
158
+ }
159
+ async bulkInsert(entries) {
160
+ return this.adapter.bulkInsert(entries);
161
+ }
162
+ async bulkDelete(ids) {
163
+ return this.adapter.bulkDelete(ids);
164
+ }
165
+ async count(namespace) {
166
+ return this.adapter.count(namespace);
167
+ }
168
+ async listNamespaces() {
169
+ return this.adapter.listNamespaces();
170
+ }
171
+ async clearNamespace(namespace) {
172
+ return this.adapter.clearNamespace(namespace);
173
+ }
174
+ async getStats() {
175
+ return this.adapter.getStats();
176
+ }
177
+ async healthCheck() {
178
+ return this.adapter.healthCheck();
179
+ }
180
+ // ===== Convenience Methods =====
181
+ /**
182
+ * Store an entry from simple input
183
+ */
184
+ async storeEntry(input) {
185
+ return this.adapter.storeEntry(input);
186
+ }
187
+ /**
188
+ * Semantic search by content string
189
+ */
190
+ async semanticSearch(content, k = 10, threshold) {
191
+ return this.adapter.semanticSearch(content, k, threshold);
192
+ }
193
+ /**
194
+ * Find similar entries to a given entry
195
+ */
196
+ async findSimilar(id, k = 5) {
197
+ const entry = await this.get(id);
198
+ if (!entry || !entry.embedding) {
199
+ return [];
200
+ }
201
+ const results = await this.search(entry.embedding, { k: k + 1 });
202
+ // Filter out the source entry
203
+ return results.filter((r) => r.entry.id !== id).slice(0, k);
204
+ }
205
+ /**
206
+ * Get or create an entry
207
+ */
208
+ async getOrCreate(namespace, key, creator) {
209
+ const existing = await this.getByKey(namespace, key);
210
+ if (existing)
211
+ return existing;
212
+ const input = await creator();
213
+ return this.storeEntry({ ...input, namespace, key });
214
+ }
215
+ /**
216
+ * Append content to an existing entry
217
+ */
218
+ async appendContent(id, content) {
219
+ const entry = await this.get(id);
220
+ if (!entry)
221
+ return null;
222
+ return this.update(id, {
223
+ content: entry.content + '\n' + content,
224
+ });
225
+ }
226
+ /**
227
+ * Add tags to an existing entry
228
+ */
229
+ async addTags(id, tags) {
230
+ const entry = await this.get(id);
231
+ if (!entry)
232
+ return null;
233
+ const newTags = [...new Set([...entry.tags, ...tags])];
234
+ return this.update(id, { tags: newTags });
235
+ }
236
+ /**
237
+ * Remove tags from an existing entry
238
+ */
239
+ async removeTags(id, tags) {
240
+ const entry = await this.get(id);
241
+ if (!entry)
242
+ return null;
243
+ const newTags = entry.tags.filter((t) => !tags.includes(t));
244
+ return this.update(id, { tags: newTags });
245
+ }
246
+ // ===== Migration =====
247
+ /**
248
+ * Migrate from a legacy memory source
249
+ */
250
+ async migrateFrom(source, sourcePath, options = {}) {
251
+ const migrator = new MemoryMigrator(this.adapter, { source, sourcePath, ...options }, this.config.embeddingGenerator);
252
+ // Forward migration events
253
+ migrator.on('migration:started', (data) => this.emit('migration:started', data));
254
+ migrator.on('migration:progress', (data) => this.emit('migration:progress', data));
255
+ migrator.on('migration:completed', (data) => this.emit('migration:completed', data));
256
+ migrator.on('migration:failed', (data) => this.emit('migration:failed', data));
257
+ migrator.on('migration:error', (data) => this.emit('migration:error', data));
258
+ migrator.on('migration:warning', (data) => this.emit('migration:warning', data));
259
+ return migrator.migrate();
260
+ }
261
+ // ===== Cross-Agent Memory Sharing =====
262
+ /**
263
+ * Share an entry with another agent
264
+ */
265
+ async shareWith(id, agentId) {
266
+ const entry = await this.get(id);
267
+ if (!entry)
268
+ return null;
269
+ const sharedWith = entry.metadata.sharedWith || [];
270
+ if (!sharedWith.includes(agentId)) {
271
+ sharedWith.push(agentId);
272
+ }
273
+ return this.update(id, {
274
+ metadata: { ...entry.metadata, sharedWith },
275
+ });
276
+ }
277
+ /**
278
+ * Get entries shared with a specific agent
279
+ */
280
+ async getSharedWith(agentId) {
281
+ const all = await this.query({ type: 'hybrid', limit: 10000 });
282
+ return all.filter((entry) => {
283
+ const sharedWith = entry.metadata.sharedWith || [];
284
+ return sharedWith.includes(agentId);
285
+ });
286
+ }
287
+ // ===== Utility =====
288
+ /**
289
+ * Get the underlying adapter for advanced operations
290
+ */
291
+ getAdapter() {
292
+ return this.adapter;
293
+ }
294
+ /**
295
+ * Check if the service is initialized
296
+ */
297
+ isInitialized() {
298
+ return this.initialized;
299
+ }
300
+ }
301
+ // ===== Factory Functions =====
302
+ /**
303
+ * Create a simple in-memory service (for testing)
304
+ */
305
+ export function createInMemoryService() {
306
+ return new UnifiedMemoryService({
307
+ persistenceEnabled: false,
308
+ cacheEnabled: true,
309
+ });
310
+ }
311
+ /**
312
+ * Create a persistent memory service
313
+ */
314
+ export function createPersistentService(path) {
315
+ return new UnifiedMemoryService({
316
+ persistenceEnabled: true,
317
+ persistencePath: path,
318
+ cacheEnabled: true,
319
+ });
320
+ }
321
+ /**
322
+ * Create a memory service with embedding support
323
+ */
324
+ export function createEmbeddingService(embeddingGenerator, dimensions = 1536) {
325
+ return new UnifiedMemoryService({
326
+ embeddingGenerator,
327
+ dimensions,
328
+ autoEmbed: true,
329
+ cacheEnabled: true,
330
+ });
331
+ }
332
+ /**
333
+ * Create a hybrid memory service (SQLite + AgentDB)
334
+ * This is the DEFAULT recommended configuration per ADR-009
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * const memory = createHybridService('./data/memory.db', embeddingFn);
339
+ * await memory.initialize();
340
+ *
341
+ * // Structured queries go to SQLite
342
+ * const user = await memory.getByKey('users', 'john@example.com');
343
+ *
344
+ * // Semantic queries go to AgentDB
345
+ * const similar = await memory.semanticSearch('authentication patterns', 10);
346
+ * ```
347
+ */
348
+ export function createHybridService(databasePath, embeddingGenerator, dimensions = 1536) {
349
+ return new UnifiedMemoryService({
350
+ embeddingGenerator,
351
+ dimensions,
352
+ autoEmbed: true,
353
+ cacheEnabled: true,
354
+ // Note: This would require extending UnifiedMemoryService to support HybridBackend
355
+ // For now, this creates an AgentDB service with persistence
356
+ persistenceEnabled: true,
357
+ persistencePath: databasePath,
358
+ });
359
+ }
360
+ // Default export
361
+ export default UnifiedMemoryService;
362
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Memory Infrastructure Layer - Public Exports
3
+ *
4
+ * Exports all infrastructure implementations including repositories,
5
+ * adapters, and external service integrations.
6
+ *
7
+ * @module v3/memory/infrastructure
8
+ */
9
+ export { HybridMemoryRepository, type HybridRepositoryConfig, } from './repositories/hybrid-memory-repository.js';
10
+ export { AgentDBAdapter } from '../agentdb-adapter.js';
11
+ export type { AgentDBAdapterConfig } from '../agentdb-adapter.js';
12
+ export { HNSWIndex } from '../hnsw-index.js';
13
+ export type { HNSWConfig } from '../types.js';
14
+ export { CacheManager } from '../cache-manager.js';
15
+ export type { CacheConfig } from '../types.js';
16
+ export { MemoryMigrator } from '../migration.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Memory Infrastructure Layer - Public Exports
3
+ *
4
+ * Exports all infrastructure implementations including repositories,
5
+ * adapters, and external service integrations.
6
+ *
7
+ * @module v3/memory/infrastructure
8
+ */
9
+ // Repositories
10
+ export { HybridMemoryRepository, } from './repositories/hybrid-memory-repository.js';
11
+ // Re-export existing adapters
12
+ export { AgentDBAdapter } from '../agentdb-adapter.js';
13
+ export { HNSWIndex } from '../hnsw-index.js';
14
+ export { CacheManager } from '../cache-manager.js';
15
+ export { MemoryMigrator } from '../migration.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Hybrid Memory Repository - Infrastructure Layer
3
+ *
4
+ * Implements IMemoryRepository using SQLite + AgentDB hybrid backend.
5
+ * Per ADR-009, this is the default memory backend.
6
+ *
7
+ * @module v3/memory/infrastructure/repositories
8
+ */
9
+ import { MemoryEntry, MemoryType, MemoryStatus } from '../../domain/entities/memory-entry.js';
10
+ import { IMemoryRepository, MemoryQueryOptions, VectorSearchOptions, VectorSearchResult, BulkOperationResult, MemoryStatistics } from '../../domain/repositories/memory-repository.interface.js';
11
+ /**
12
+ * Repository configuration
13
+ */
14
+ export interface HybridRepositoryConfig {
15
+ sqlitePath: string;
16
+ agentDbPath?: string;
17
+ enableVectorSearch?: boolean;
18
+ cacheSize?: number;
19
+ verbose?: boolean;
20
+ }
21
+ /**
22
+ * Hybrid Memory Repository
23
+ *
24
+ * Uses SQLite for metadata and AgentDB for vectors.
25
+ * Implements hot caching for frequently accessed entries.
26
+ */
27
+ export declare class HybridMemoryRepository implements IMemoryRepository {
28
+ private readonly config;
29
+ private entries;
30
+ private namespaceIndex;
31
+ private vectorIndex;
32
+ private cache;
33
+ private initialized;
34
+ constructor(config: HybridRepositoryConfig);
35
+ initialize(): Promise<void>;
36
+ shutdown(): Promise<void>;
37
+ clear(): Promise<void>;
38
+ save(entry: MemoryEntry): Promise<void>;
39
+ findById(id: string): Promise<MemoryEntry | null>;
40
+ findByKey(namespace: string, key: string): Promise<MemoryEntry | null>;
41
+ findByCompositeKey(compositeKey: string): Promise<MemoryEntry | null>;
42
+ delete(id: string): Promise<boolean>;
43
+ exists(id: string): Promise<boolean>;
44
+ saveMany(entries: MemoryEntry[]): Promise<BulkOperationResult>;
45
+ findByIds(ids: string[]): Promise<MemoryEntry[]>;
46
+ deleteMany(ids: string[]): Promise<BulkOperationResult>;
47
+ findAll(options?: MemoryQueryOptions): Promise<MemoryEntry[]>;
48
+ findByNamespace(namespace: string, options?: Omit<MemoryQueryOptions, 'namespace'>): Promise<MemoryEntry[]>;
49
+ findByType(type: MemoryType, options?: Omit<MemoryQueryOptions, 'type'>): Promise<MemoryEntry[]>;
50
+ findByStatus(status: MemoryStatus, options?: Omit<MemoryQueryOptions, 'status'>): Promise<MemoryEntry[]>;
51
+ searchByVector(options: VectorSearchOptions): Promise<VectorSearchResult[]>;
52
+ findSimilar(entryId: string, limit?: number): Promise<VectorSearchResult[]>;
53
+ findExpired(): Promise<MemoryEntry[]>;
54
+ deleteExpired(): Promise<number>;
55
+ findCold(milliseconds: number): Promise<MemoryEntry[]>;
56
+ archiveCold(milliseconds: number): Promise<number>;
57
+ getStatistics(): Promise<MemoryStatistics>;
58
+ count(options?: MemoryQueryOptions): Promise<number>;
59
+ listNamespaces(): Promise<string[]>;
60
+ deleteNamespace(namespace: string): Promise<number>;
61
+ getNamespaceSize(namespace: string): Promise<number>;
62
+ private ensureInitialized;
63
+ private updateCache;
64
+ private cosineSimilarity;
65
+ }
66
+ //# sourceMappingURL=hybrid-memory-repository.d.ts.map