@danielsimonjr/memory-mcp 11.0.1 → 11.1.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 (172) hide show
  1. package/LICENSE +22 -22
  2. package/dist/core/EntityManager.d.ts +10 -15
  3. package/dist/core/EntityManager.d.ts.map +1 -1
  4. package/dist/core/EntityManager.js +21 -54
  5. package/dist/core/GraphStorage.d.ts +0 -51
  6. package/dist/core/GraphStorage.d.ts.map +1 -1
  7. package/dist/core/GraphStorage.js +2 -79
  8. package/dist/core/GraphTraversal.d.ts +2 -7
  9. package/dist/core/GraphTraversal.d.ts.map +1 -1
  10. package/dist/core/GraphTraversal.js +2 -19
  11. package/dist/core/ManagerContext.d.ts +0 -4
  12. package/dist/core/ManagerContext.d.ts.map +1 -1
  13. package/dist/core/ManagerContext.js +2 -12
  14. package/dist/core/RelationManager.d.ts.map +1 -1
  15. package/dist/core/RelationManager.js +4 -5
  16. package/dist/core/SQLiteStorage.d.ts.map +1 -1
  17. package/dist/core/SQLiteStorage.js +2 -3
  18. package/dist/core/TransactionManager.d.ts +2 -207
  19. package/dist/core/TransactionManager.d.ts.map +1 -1
  20. package/dist/core/TransactionManager.js +6 -482
  21. package/dist/core/index.d.ts +1 -2
  22. package/dist/core/index.d.ts.map +1 -1
  23. package/dist/core/index.js +1 -3
  24. package/dist/features/ArchiveManager.d.ts +2 -14
  25. package/dist/features/ArchiveManager.d.ts.map +1 -1
  26. package/dist/features/ArchiveManager.js +3 -44
  27. package/dist/features/CompressionManager.d.ts +4 -14
  28. package/dist/features/CompressionManager.d.ts.map +1 -1
  29. package/dist/features/CompressionManager.js +9 -74
  30. package/dist/features/IOManager.d.ts +2 -6
  31. package/dist/features/IOManager.d.ts.map +1 -1
  32. package/dist/features/IOManager.js +10 -105
  33. package/dist/features/StreamingExporter.d.ts +4 -27
  34. package/dist/features/StreamingExporter.d.ts.map +1 -1
  35. package/dist/features/StreamingExporter.js +4 -65
  36. package/dist/features/index.d.ts +0 -2
  37. package/dist/features/index.d.ts.map +1 -1
  38. package/dist/features/index.js +0 -3
  39. package/dist/search/EmbeddingService.d.ts +9 -108
  40. package/dist/search/EmbeddingService.d.ts.map +1 -1
  41. package/dist/search/EmbeddingService.js +15 -187
  42. package/dist/search/FuzzySearch.js +1 -1
  43. package/dist/search/SavedSearchManager.d.ts.map +1 -1
  44. package/dist/search/SavedSearchManager.js +2 -3
  45. package/dist/search/SearchManager.d.ts +1 -42
  46. package/dist/search/SearchManager.d.ts.map +1 -1
  47. package/dist/search/SearchManager.js +0 -115
  48. package/dist/search/SemanticSearch.d.ts +1 -4
  49. package/dist/search/SemanticSearch.d.ts.map +1 -1
  50. package/dist/search/SemanticSearch.js +2 -12
  51. package/dist/search/TFIDFIndexManager.d.ts +0 -88
  52. package/dist/search/TFIDFIndexManager.d.ts.map +1 -1
  53. package/dist/search/TFIDFIndexManager.js +0 -217
  54. package/dist/search/index.d.ts +1 -18
  55. package/dist/search/index.d.ts.map +1 -1
  56. package/dist/search/index.js +1 -32
  57. package/dist/server/MCPServer.d.ts.map +1 -1
  58. package/dist/server/MCPServer.js +4 -1
  59. package/dist/server/responseCompressor.js +5 -5
  60. package/dist/server/toolDefinitions.d.ts.map +1 -1
  61. package/dist/server/toolDefinitions.js +5 -1
  62. package/dist/server/toolHandlers.d.ts +9 -5
  63. package/dist/server/toolHandlers.d.ts.map +1 -1
  64. package/dist/server/toolHandlers.js +23 -8
  65. package/dist/types/index.d.ts +1 -1
  66. package/dist/types/index.d.ts.map +1 -1
  67. package/dist/types/types.d.ts +2 -579
  68. package/dist/types/types.d.ts.map +1 -1
  69. package/dist/utils/compressedCache.d.ts +0 -29
  70. package/dist/utils/compressedCache.d.ts.map +1 -1
  71. package/dist/utils/compressedCache.js +0 -39
  72. package/dist/utils/entityUtils.d.ts +1 -59
  73. package/dist/utils/entityUtils.d.ts.map +1 -1
  74. package/dist/utils/entityUtils.js +3 -113
  75. package/dist/utils/errors.d.ts +0 -18
  76. package/dist/utils/errors.d.ts.map +1 -1
  77. package/dist/utils/errors.js +0 -24
  78. package/dist/utils/index.d.ts +2 -6
  79. package/dist/utils/index.d.ts.map +1 -1
  80. package/dist/utils/index.js +2 -14
  81. package/dist/utils/logger.d.ts +0 -7
  82. package/dist/utils/logger.d.ts.map +1 -1
  83. package/dist/utils/logger.js +2 -9
  84. package/dist/utils/parallelUtils.d.ts +1 -5
  85. package/dist/utils/parallelUtils.d.ts.map +1 -1
  86. package/dist/utils/parallelUtils.js +1 -23
  87. package/dist/utils/schemas.d.ts +16 -16
  88. package/dist/utils/schemas.d.ts.map +1 -1
  89. package/dist/utils/schemas.js +12 -12
  90. package/dist/utils/taskScheduler.d.ts +0 -4
  91. package/dist/utils/taskScheduler.d.ts.map +1 -1
  92. package/dist/utils/taskScheduler.js +1 -21
  93. package/dist/workers/WorkerPool.d.ts +81 -0
  94. package/dist/workers/WorkerPool.d.ts.map +1 -0
  95. package/dist/workers/WorkerPool.js +121 -0
  96. package/dist/workers/index.d.ts +1 -1
  97. package/dist/workers/index.d.ts.map +1 -1
  98. package/dist/workers/levenshteinWorker.js +1 -1
  99. package/package.json +1 -4
  100. package/dist/__tests__/file-path.test.js +0 -119
  101. package/dist/__tests__/knowledge-graph.test.js +0 -318
  102. package/dist/core/GraphEventEmitter.d.ts +0 -202
  103. package/dist/core/GraphEventEmitter.d.ts.map +0 -1
  104. package/dist/core/GraphEventEmitter.js +0 -346
  105. package/dist/features/KeywordExtractor.d.ts +0 -61
  106. package/dist/features/KeywordExtractor.d.ts.map +0 -1
  107. package/dist/features/KeywordExtractor.js +0 -126
  108. package/dist/features/ObservationNormalizer.d.ts +0 -90
  109. package/dist/features/ObservationNormalizer.d.ts.map +0 -1
  110. package/dist/features/ObservationNormalizer.js +0 -193
  111. package/dist/memory.jsonl +0 -1
  112. package/dist/search/BM25Search.d.ts +0 -148
  113. package/dist/search/BM25Search.d.ts.map +0 -1
  114. package/dist/search/BM25Search.js +0 -339
  115. package/dist/search/EarlyTerminationManager.d.ts +0 -140
  116. package/dist/search/EarlyTerminationManager.d.ts.map +0 -1
  117. package/dist/search/EarlyTerminationManager.js +0 -279
  118. package/dist/search/EmbeddingCache.d.ts +0 -175
  119. package/dist/search/EmbeddingCache.d.ts.map +0 -1
  120. package/dist/search/EmbeddingCache.js +0 -246
  121. package/dist/search/HybridScorer.d.ts +0 -181
  122. package/dist/search/HybridScorer.d.ts.map +0 -1
  123. package/dist/search/HybridScorer.js +0 -257
  124. package/dist/search/HybridSearchManager.d.ts +0 -80
  125. package/dist/search/HybridSearchManager.d.ts.map +0 -1
  126. package/dist/search/HybridSearchManager.js +0 -187
  127. package/dist/search/IncrementalIndexer.d.ts +0 -201
  128. package/dist/search/IncrementalIndexer.d.ts.map +0 -1
  129. package/dist/search/IncrementalIndexer.js +0 -342
  130. package/dist/search/OptimizedInvertedIndex.d.ts +0 -163
  131. package/dist/search/OptimizedInvertedIndex.d.ts.map +0 -1
  132. package/dist/search/OptimizedInvertedIndex.js +0 -358
  133. package/dist/search/ParallelSearchExecutor.d.ts +0 -172
  134. package/dist/search/ParallelSearchExecutor.d.ts.map +0 -1
  135. package/dist/search/ParallelSearchExecutor.js +0 -309
  136. package/dist/search/QuantizedVectorStore.d.ts +0 -171
  137. package/dist/search/QuantizedVectorStore.d.ts.map +0 -1
  138. package/dist/search/QuantizedVectorStore.js +0 -307
  139. package/dist/search/QueryAnalyzer.d.ts +0 -76
  140. package/dist/search/QueryAnalyzer.d.ts.map +0 -1
  141. package/dist/search/QueryAnalyzer.js +0 -227
  142. package/dist/search/QueryCostEstimator.d.ts +0 -244
  143. package/dist/search/QueryCostEstimator.d.ts.map +0 -1
  144. package/dist/search/QueryCostEstimator.js +0 -652
  145. package/dist/search/QueryPlanCache.d.ts +0 -220
  146. package/dist/search/QueryPlanCache.d.ts.map +0 -1
  147. package/dist/search/QueryPlanCache.js +0 -379
  148. package/dist/search/QueryPlanner.d.ts +0 -58
  149. package/dist/search/QueryPlanner.d.ts.map +0 -1
  150. package/dist/search/QueryPlanner.js +0 -137
  151. package/dist/search/ReflectionManager.d.ts +0 -120
  152. package/dist/search/ReflectionManager.d.ts.map +0 -1
  153. package/dist/search/ReflectionManager.js +0 -231
  154. package/dist/search/SymbolicSearch.d.ts +0 -61
  155. package/dist/search/SymbolicSearch.d.ts.map +0 -1
  156. package/dist/search/SymbolicSearch.js +0 -163
  157. package/dist/search/TFIDFEventSync.d.ts +0 -85
  158. package/dist/search/TFIDFEventSync.d.ts.map +0 -1
  159. package/dist/search/TFIDFEventSync.js +0 -133
  160. package/dist/utils/BatchProcessor.d.ts +0 -271
  161. package/dist/utils/BatchProcessor.d.ts.map +0 -1
  162. package/dist/utils/BatchProcessor.js +0 -376
  163. package/dist/utils/MemoryMonitor.d.ts +0 -176
  164. package/dist/utils/MemoryMonitor.d.ts.map +0 -1
  165. package/dist/utils/MemoryMonitor.js +0 -305
  166. package/dist/utils/WorkerPoolManager.d.ts +0 -233
  167. package/dist/utils/WorkerPoolManager.d.ts.map +0 -1
  168. package/dist/utils/WorkerPoolManager.js +0 -420
  169. package/dist/utils/operationUtils.d.ts +0 -124
  170. package/dist/utils/operationUtils.d.ts.map +0 -1
  171. package/dist/utils/operationUtils.js +0 -175
  172. package/dist/vitest.config.js +0 -13
@@ -1,175 +0,0 @@
1
- /**
2
- * Operation Utilities
3
- *
4
- * Phase 9B: Utilities for long-running operations with progress tracking
5
- * and cancellation support.
6
- *
7
- * @module utils/operationUtils
8
- */
9
- import { OperationCancelledError } from './errors.js';
10
- /**
11
- * Check if an operation has been cancelled via AbortSignal.
12
- * Throws OperationCancelledError if the signal is aborted.
13
- *
14
- * @param signal - Optional AbortSignal to check
15
- * @param operation - Optional operation name for error message
16
- * @throws OperationCancelledError if signal is aborted
17
- *
18
- * @example
19
- * ```typescript
20
- * for (const item of items) {
21
- * checkCancellation(options?.signal, 'batch processing');
22
- * await processItem(item);
23
- * }
24
- * ```
25
- */
26
- export function checkCancellation(signal, operation) {
27
- if (signal?.aborted) {
28
- throw new OperationCancelledError(operation);
29
- }
30
- }
31
- /**
32
- * Create a throttled progress reporter to avoid excessive callback invocations.
33
- * Returns undefined if no callback is provided.
34
- *
35
- * @param callback - Optional progress callback to throttle
36
- * @param throttleMs - Minimum time between callbacks (default: 100ms)
37
- * @returns Throttled callback or undefined
38
- *
39
- * @example
40
- * ```typescript
41
- * const reportProgress = createProgressReporter(options?.onProgress, 50);
42
- * for (let i = 0; i < total; i++) {
43
- * reportProgress?.({ completed: i, total, percentage: (i / total) * 100 });
44
- * }
45
- * ```
46
- */
47
- export function createProgressReporter(callback, throttleMs = 100) {
48
- if (!callback)
49
- return undefined;
50
- let lastCallTime = 0;
51
- return (progress) => {
52
- const now = Date.now();
53
- // Always report 0% and 100%
54
- if (progress.percentage === 0 || progress.percentage >= 100 || now - lastCallTime >= throttleMs) {
55
- lastCallTime = now;
56
- callback(progress);
57
- }
58
- };
59
- }
60
- /**
61
- * Create a progress object for reporting.
62
- *
63
- * @param completed - Number of completed items
64
- * @param total - Total number of items
65
- * @param currentTaskId - Optional current task identifier
66
- * @returns Progress object suitable for ProgressCallback
67
- *
68
- * @example
69
- * ```typescript
70
- * reportProgress?.(createProgress(50, 100, 'processing entities'));
71
- * // { completed: 50, total: 100, percentage: 50, currentTaskId: 'processing entities' }
72
- * ```
73
- */
74
- export function createProgress(completed, total, currentTaskId) {
75
- return {
76
- completed,
77
- total,
78
- percentage: total > 0 ? Math.round((completed / total) * 100) : 0,
79
- currentTaskId,
80
- };
81
- }
82
- /**
83
- * Execute an operation with multiple distinct phases.
84
- * Useful when an operation has multiple distinct phases with different weights.
85
- *
86
- * @param phases - Array of phase definitions with weight and executor
87
- * @param onProgress - Optional progress callback
88
- * @param signal - Optional abort signal
89
- * @returns Array of results from each phase
90
- * @throws OperationCancelledError if cancelled during any phase
91
- *
92
- * @example
93
- * ```typescript
94
- * const [parseResult, processResult, saveResult] = await executeWithPhases([
95
- * { name: 'parsing', weight: 20, execute: () => parseData() },
96
- * { name: 'processing', weight: 60, execute: () => processEntities() },
97
- * { name: 'saving', weight: 20, execute: () => saveResults() },
98
- * ], options?.onProgress, options?.signal);
99
- * ```
100
- */
101
- export async function executeWithPhases(phases, onProgress, signal) {
102
- const totalWeight = phases.reduce((sum, p) => sum + p.weight, 0);
103
- let completedWeight = 0;
104
- const results = [];
105
- for (const phase of phases) {
106
- checkCancellation(signal, phase.name);
107
- const phaseStartWeight = completedWeight;
108
- const phaseProgress = (phasePct) => {
109
- if (onProgress) {
110
- const overallPct = ((phaseStartWeight + (phase.weight * phasePct / 100)) / totalWeight) * 100;
111
- onProgress({
112
- completed: Math.round(overallPct),
113
- total: 100,
114
- percentage: Math.round(overallPct),
115
- currentTaskId: phase.name,
116
- });
117
- }
118
- };
119
- const result = await phase.execute(phaseProgress);
120
- results.push(result);
121
- completedWeight += phase.weight;
122
- }
123
- // Report 100% completion
124
- onProgress?.({
125
- completed: 100,
126
- total: 100,
127
- percentage: 100,
128
- });
129
- return results;
130
- }
131
- /**
132
- * Execute an operation in batches with progress tracking and cancellation support.
133
- *
134
- * @param items - Array of items to process
135
- * @param batchSize - Size of each batch
136
- * @param processBatch - Function to process each batch
137
- * @param onProgress - Optional progress callback
138
- * @param signal - Optional abort signal
139
- * @param operationName - Optional operation name for cancellation error
140
- * @returns Array of results from all batches
141
- *
142
- * @example
143
- * ```typescript
144
- * const results = await processBatchesWithProgress(
145
- * entities,
146
- * 100,
147
- * async (batch) => {
148
- * for (const entity of batch) {
149
- * await saveEntity(entity);
150
- * }
151
- * return batch.length;
152
- * },
153
- * options?.onProgress,
154
- * options?.signal,
155
- * 'createEntities'
156
- * );
157
- * ```
158
- */
159
- export async function processBatchesWithProgress(items, batchSize, processBatch, onProgress, signal, operationName) {
160
- const results = [];
161
- const total = items.length;
162
- let processed = 0;
163
- const reportProgress = createProgressReporter(onProgress);
164
- reportProgress?.(createProgress(0, total, operationName));
165
- for (let i = 0; i < items.length; i += batchSize) {
166
- checkCancellation(signal, operationName);
167
- const batch = items.slice(i, i + batchSize);
168
- const result = await processBatch(batch, Math.floor(i / batchSize));
169
- results.push(result);
170
- processed += batch.length;
171
- reportProgress?.(createProgress(processed, total, operationName));
172
- }
173
- reportProgress?.(createProgress(total, total, operationName));
174
- return results;
175
- }
@@ -1,13 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
- export default defineConfig({
3
- test: {
4
- globals: true,
5
- environment: 'node',
6
- include: ['**/__tests__/**/*.test.ts'],
7
- coverage: {
8
- provider: 'v8',
9
- include: ['**/*.ts'],
10
- exclude: ['**/__tests__/**', '**/dist/**'],
11
- },
12
- },
13
- });