@danielsimonjr/memory-mcp 12.5.2 → 12.7.0
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/README.md +158 -14
- package/dist/core/EntityManager.d.ts +263 -0
- package/dist/core/EntityManager.d.ts.map +1 -0
- package/dist/core/EntityManager.js +478 -0
- package/dist/core/GraphStorage.d.ts +344 -0
- package/dist/core/GraphStorage.d.ts.map +1 -0
- package/dist/core/GraphStorage.js +708 -0
- package/dist/core/GraphTraversal.d.ts +136 -0
- package/dist/core/GraphTraversal.d.ts.map +1 -0
- package/dist/core/GraphTraversal.js +556 -0
- package/dist/core/HierarchyManager.d.ts +111 -0
- package/dist/core/HierarchyManager.d.ts.map +1 -0
- package/dist/core/HierarchyManager.js +224 -0
- package/dist/core/ManagerContext.d.ts +72 -0
- package/dist/core/ManagerContext.d.ts.map +1 -0
- package/dist/core/ManagerContext.js +118 -0
- package/dist/core/ObservationManager.d.ts +85 -0
- package/dist/core/ObservationManager.d.ts.map +1 -0
- package/dist/core/ObservationManager.js +123 -0
- package/dist/core/RelationManager.d.ts +131 -0
- package/dist/core/RelationManager.d.ts.map +1 -0
- package/dist/core/RelationManager.js +210 -0
- package/dist/core/SQLiteStorage.d.ts +354 -0
- package/dist/core/SQLiteStorage.d.ts.map +1 -0
- package/dist/core/SQLiteStorage.js +917 -0
- package/dist/core/StorageFactory.d.ts +45 -0
- package/dist/core/StorageFactory.d.ts.map +1 -0
- package/dist/core/StorageFactory.js +64 -0
- package/dist/core/TransactionManager.d.ts +259 -0
- package/dist/core/TransactionManager.d.ts.map +1 -0
- package/dist/core/TransactionManager.js +392 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +17 -0
- package/dist/features/AnalyticsManager.d.ts +44 -0
- package/dist/features/AnalyticsManager.d.ts.map +1 -0
- package/dist/features/AnalyticsManager.js +223 -0
- package/dist/features/ArchiveManager.d.ts +121 -0
- package/dist/features/ArchiveManager.d.ts.map +1 -0
- package/dist/features/ArchiveManager.js +240 -0
- package/dist/features/CompressionManager.d.ts +109 -0
- package/dist/features/CompressionManager.d.ts.map +1 -0
- package/dist/features/CompressionManager.js +404 -0
- package/dist/features/IOManager.d.ts +221 -0
- package/dist/features/IOManager.d.ts.map +1 -0
- package/dist/features/IOManager.js +997 -0
- package/dist/features/StreamingExporter.d.ts +105 -0
- package/dist/features/StreamingExporter.d.ts.map +1 -0
- package/dist/features/StreamingExporter.js +150 -0
- package/dist/features/TagManager.d.ts +147 -0
- package/dist/features/TagManager.d.ts.map +1 -0
- package/dist/features/TagManager.js +210 -0
- package/dist/features/index.d.ts +12 -0
- package/dist/features/index.d.ts.map +1 -0
- package/dist/features/index.js +11 -0
- package/dist/index.js +8 -2
- package/dist/search/BasicSearch.d.ts +51 -0
- package/dist/search/BasicSearch.d.ts.map +1 -0
- package/dist/search/BasicSearch.js +137 -0
- package/dist/search/BooleanSearch.d.ts +98 -0
- package/dist/search/BooleanSearch.d.ts.map +1 -0
- package/dist/search/BooleanSearch.js +430 -0
- package/dist/search/EmbeddingService.d.ts +178 -0
- package/dist/search/EmbeddingService.d.ts.map +1 -0
- package/dist/search/EmbeddingService.js +358 -0
- package/dist/search/FuzzySearch.d.ts +118 -0
- package/dist/search/FuzzySearch.d.ts.map +1 -0
- package/dist/search/FuzzySearch.js +312 -0
- package/dist/search/RankedSearch.d.ts +71 -0
- package/dist/search/RankedSearch.d.ts.map +1 -0
- package/dist/search/RankedSearch.js +238 -0
- package/dist/search/SavedSearchManager.d.ts +79 -0
- package/dist/search/SavedSearchManager.d.ts.map +1 -0
- package/dist/search/SavedSearchManager.js +145 -0
- package/dist/search/SearchFilterChain.d.ts +120 -0
- package/dist/search/SearchFilterChain.d.ts.map +1 -0
- package/dist/search/SearchFilterChain.js +185 -0
- package/dist/search/SearchManager.d.ts +285 -0
- package/dist/search/SearchManager.d.ts.map +1 -0
- package/dist/search/SearchManager.js +338 -0
- package/dist/search/SearchSuggestions.d.ts +27 -0
- package/dist/search/SearchSuggestions.d.ts.map +1 -0
- package/dist/search/SearchSuggestions.js +57 -0
- package/dist/search/SemanticSearch.d.ts +146 -0
- package/dist/search/SemanticSearch.d.ts.map +1 -0
- package/dist/search/SemanticSearch.js +313 -0
- package/dist/search/TFIDFIndexManager.d.ts +63 -0
- package/dist/search/TFIDFIndexManager.d.ts.map +1 -0
- package/dist/search/TFIDFIndexManager.js +215 -0
- package/dist/search/VectorStore.d.ts +235 -0
- package/dist/search/VectorStore.d.ts.map +1 -0
- package/dist/search/VectorStore.js +311 -0
- package/dist/search/index.d.ts +18 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +21 -0
- package/dist/server/MCPServer.d.ts.map +1 -1
- package/dist/server/toolDefinitions.d.ts +1 -1
- package/dist/server/toolDefinitions.d.ts.map +1 -1
- package/dist/server/toolDefinitions.js +254 -2
- package/dist/server/toolHandlers.d.ts.map +1 -1
- package/dist/server/toolHandlers.js +241 -25
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/types.d.ts +1234 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +9 -0
- package/dist/utils/compressedCache.d.ts +192 -0
- package/dist/utils/compressedCache.d.ts.map +1 -0
- package/dist/utils/compressedCache.js +309 -0
- package/dist/utils/compressionUtil.d.ts +214 -0
- package/dist/utils/compressionUtil.d.ts.map +1 -0
- package/dist/utils/compressionUtil.js +247 -0
- package/dist/utils/constants.d.ts +245 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +252 -0
- package/dist/utils/entityUtils.d.ts +321 -0
- package/dist/utils/entityUtils.d.ts.map +1 -0
- package/dist/utils/entityUtils.js +538 -0
- package/dist/utils/errors.d.ts +77 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +121 -0
- package/dist/utils/formatters.d.ts +145 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +132 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +75 -0
- package/dist/utils/indexes.d.ts +270 -0
- package/dist/utils/indexes.d.ts.map +1 -0
- package/dist/utils/indexes.js +526 -0
- package/dist/utils/logger.d.ts +24 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +33 -0
- package/dist/utils/parallelUtils.d.ts +72 -0
- package/dist/utils/parallelUtils.d.ts.map +1 -0
- package/dist/utils/parallelUtils.js +169 -0
- package/dist/utils/schemas.d.ts +374 -0
- package/dist/utils/schemas.d.ts.map +1 -0
- package/dist/utils/schemas.js +484 -0
- package/dist/utils/searchAlgorithms.d.ts +99 -0
- package/dist/utils/searchAlgorithms.d.ts.map +1 -0
- package/dist/utils/searchAlgorithms.js +167 -0
- package/dist/utils/searchCache.d.ts +108 -0
- package/dist/utils/searchCache.d.ts.map +1 -0
- package/dist/utils/searchCache.js +209 -0
- package/dist/utils/taskScheduler.d.ts +290 -0
- package/dist/utils/taskScheduler.d.ts.map +1 -0
- package/dist/utils/taskScheduler.js +466 -0
- package/dist/workers/WorkerPool.d.ts +81 -0
- package/dist/workers/WorkerPool.d.ts.map +1 -0
- package/dist/workers/WorkerPool.js +121 -0
- package/dist/workers/index.d.ts +12 -0
- package/dist/workers/index.d.ts.map +1 -0
- package/dist/workers/index.js +9 -0
- package/dist/workers/levenshteinWorker.d.ts +60 -0
- package/dist/workers/levenshteinWorker.d.ts.map +1 -0
- package/dist/workers/levenshteinWorker.js +98 -0
- package/package.json +7 -7
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector Store
|
|
3
|
+
*
|
|
4
|
+
* Phase 4 Sprint 11: Vector storage and retrieval for semantic search.
|
|
5
|
+
* Provides in-memory and SQLite-backed implementations.
|
|
6
|
+
*
|
|
7
|
+
* @module search/VectorStore
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Calculate cosine similarity between two vectors.
|
|
11
|
+
*
|
|
12
|
+
* Uses an optimized inner loop without array methods for maximum performance.
|
|
13
|
+
*
|
|
14
|
+
* @param a - First vector
|
|
15
|
+
* @param b - Second vector
|
|
16
|
+
* @returns Cosine similarity score (0.0 to 1.0)
|
|
17
|
+
*/
|
|
18
|
+
export function cosineSimilarity(a, b) {
|
|
19
|
+
if (a.length !== b.length) {
|
|
20
|
+
throw new Error(`Vector dimensions mismatch: ${a.length} vs ${b.length}`);
|
|
21
|
+
}
|
|
22
|
+
let dotProduct = 0;
|
|
23
|
+
let magnitudeA = 0;
|
|
24
|
+
let magnitudeB = 0;
|
|
25
|
+
// Optimized single-pass loop
|
|
26
|
+
for (let i = 0; i < a.length; i++) {
|
|
27
|
+
const ai = a[i];
|
|
28
|
+
const bi = b[i];
|
|
29
|
+
dotProduct += ai * bi;
|
|
30
|
+
magnitudeA += ai * ai;
|
|
31
|
+
magnitudeB += bi * bi;
|
|
32
|
+
}
|
|
33
|
+
const magnitude = Math.sqrt(magnitudeA) * Math.sqrt(magnitudeB);
|
|
34
|
+
if (magnitude === 0) {
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
// Clamp to [-1, 1] to handle floating point errors
|
|
38
|
+
const similarity = dotProduct / magnitude;
|
|
39
|
+
return Math.max(-1, Math.min(1, similarity));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* In-Memory Vector Store
|
|
43
|
+
*
|
|
44
|
+
* Stores vectors in memory using a Map for O(1) add/remove operations.
|
|
45
|
+
* Search uses brute-force cosine similarity which is O(n) but fast for
|
|
46
|
+
* small to medium graphs (<10K entities).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const store = new InMemoryVectorStore();
|
|
51
|
+
* store.add("entity1", [0.1, 0.2, 0.3]);
|
|
52
|
+
* store.add("entity2", [0.4, 0.5, 0.6]);
|
|
53
|
+
* const results = store.search([0.1, 0.2, 0.3], 5);
|
|
54
|
+
* console.log(results); // [{ name: "entity1", score: 1.0 }, ...]
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export class InMemoryVectorStore {
|
|
58
|
+
/** Map of entity name to embedding vector */
|
|
59
|
+
vectors = new Map();
|
|
60
|
+
/**
|
|
61
|
+
* Add a vector for an entity.
|
|
62
|
+
*
|
|
63
|
+
* @param entityName - Name of the entity
|
|
64
|
+
* @param vector - Embedding vector
|
|
65
|
+
*/
|
|
66
|
+
add(entityName, vector) {
|
|
67
|
+
this.vectors.set(entityName, vector);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Search for similar vectors using cosine similarity.
|
|
71
|
+
*
|
|
72
|
+
* @param queryVector - Query embedding vector
|
|
73
|
+
* @param k - Number of results to return
|
|
74
|
+
* @returns Array of results with entity name and similarity score
|
|
75
|
+
*/
|
|
76
|
+
search(queryVector, k) {
|
|
77
|
+
if (this.vectors.size === 0) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
// Calculate similarity for all vectors
|
|
81
|
+
const results = [];
|
|
82
|
+
for (const [name, vector] of this.vectors) {
|
|
83
|
+
try {
|
|
84
|
+
const score = cosineSimilarity(queryVector, vector);
|
|
85
|
+
results.push({ name, score });
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Skip vectors with dimension mismatch
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Sort by score descending and take top k
|
|
93
|
+
results.sort((a, b) => b.score - a.score);
|
|
94
|
+
return results.slice(0, k);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Remove a vector by entity name.
|
|
98
|
+
*
|
|
99
|
+
* @param entityName - Name of the entity to remove
|
|
100
|
+
* @returns True if found and removed
|
|
101
|
+
*/
|
|
102
|
+
remove(entityName) {
|
|
103
|
+
return this.vectors.delete(entityName);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get the number of vectors stored.
|
|
107
|
+
*
|
|
108
|
+
* @returns Number of vectors
|
|
109
|
+
*/
|
|
110
|
+
size() {
|
|
111
|
+
return this.vectors.size;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Clear all vectors from the store.
|
|
115
|
+
*/
|
|
116
|
+
clear() {
|
|
117
|
+
this.vectors.clear();
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Check if a vector exists for an entity.
|
|
121
|
+
*
|
|
122
|
+
* @param entityName - Name of the entity
|
|
123
|
+
* @returns True if vector exists
|
|
124
|
+
*/
|
|
125
|
+
has(entityName) {
|
|
126
|
+
return this.vectors.has(entityName);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get the vector for an entity.
|
|
130
|
+
*
|
|
131
|
+
* @param entityName - Name of the entity
|
|
132
|
+
* @returns Vector if found, undefined otherwise
|
|
133
|
+
*/
|
|
134
|
+
get(entityName) {
|
|
135
|
+
return this.vectors.get(entityName);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get all entity names with stored vectors.
|
|
139
|
+
*
|
|
140
|
+
* @returns Array of entity names
|
|
141
|
+
*/
|
|
142
|
+
getEntityNames() {
|
|
143
|
+
return Array.from(this.vectors.keys());
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Load vectors from an iterable source.
|
|
147
|
+
*
|
|
148
|
+
* @param entries - Iterable of [entityName, vector] pairs
|
|
149
|
+
*/
|
|
150
|
+
loadFrom(entries) {
|
|
151
|
+
for (const [name, vector] of entries) {
|
|
152
|
+
this.vectors.set(name, vector);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* SQLite Vector Store
|
|
158
|
+
*
|
|
159
|
+
* Persists vectors to SQLite storage while maintaining an in-memory cache
|
|
160
|
+
* for fast search operations. Combines persistence with performance.
|
|
161
|
+
*
|
|
162
|
+
* Uses SQLiteStorage's embedding storage methods for persistence.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const store = new SQLiteVectorStore(sqliteStorage);
|
|
167
|
+
* await store.initialize();
|
|
168
|
+
* store.add("entity1", [0.1, 0.2, 0.3]);
|
|
169
|
+
* const results = store.search([0.1, 0.2, 0.3], 5);
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export class SQLiteVectorStore {
|
|
173
|
+
/** In-memory cache for fast search */
|
|
174
|
+
memoryStore = new InMemoryVectorStore();
|
|
175
|
+
/** SQLite storage reference for persistence */
|
|
176
|
+
storage = null;
|
|
177
|
+
/** Whether the store has been initialized */
|
|
178
|
+
initialized = false;
|
|
179
|
+
/** Model name used for embeddings */
|
|
180
|
+
embeddingModel = '';
|
|
181
|
+
/**
|
|
182
|
+
* Create a SQLite vector store.
|
|
183
|
+
*
|
|
184
|
+
* @param storage - SQLite storage instance with embedding support
|
|
185
|
+
* @param embeddingModel - Model name used for embeddings
|
|
186
|
+
*/
|
|
187
|
+
constructor(storage, embeddingModel = 'unknown') {
|
|
188
|
+
this.storage = storage || null;
|
|
189
|
+
this.embeddingModel = embeddingModel;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Initialize the store by loading vectors from SQLite.
|
|
193
|
+
*/
|
|
194
|
+
async initialize() {
|
|
195
|
+
if (this.initialized)
|
|
196
|
+
return;
|
|
197
|
+
if (this.storage) {
|
|
198
|
+
// Load all embeddings from SQLite
|
|
199
|
+
const embeddings = await this.storage.loadAllEmbeddings();
|
|
200
|
+
this.memoryStore.loadFrom(embeddings);
|
|
201
|
+
}
|
|
202
|
+
this.initialized = true;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Add a vector for an entity.
|
|
206
|
+
* Stores in both memory and SQLite for persistence.
|
|
207
|
+
*
|
|
208
|
+
* @param entityName - Name of the entity
|
|
209
|
+
* @param vector - Embedding vector
|
|
210
|
+
*/
|
|
211
|
+
add(entityName, vector) {
|
|
212
|
+
// Add to in-memory cache
|
|
213
|
+
this.memoryStore.add(entityName, vector);
|
|
214
|
+
// Persist to SQLite if available
|
|
215
|
+
if (this.storage) {
|
|
216
|
+
this.storage.storeEmbedding(entityName, vector, this.embeddingModel);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Search for similar vectors using cosine similarity.
|
|
221
|
+
*
|
|
222
|
+
* @param queryVector - Query embedding vector
|
|
223
|
+
* @param k - Number of results to return
|
|
224
|
+
* @returns Array of results with entity name and similarity score
|
|
225
|
+
*/
|
|
226
|
+
search(queryVector, k) {
|
|
227
|
+
return this.memoryStore.search(queryVector, k);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Remove a vector by entity name.
|
|
231
|
+
*
|
|
232
|
+
* @param entityName - Name of the entity to remove
|
|
233
|
+
* @returns True if found and removed
|
|
234
|
+
*/
|
|
235
|
+
remove(entityName) {
|
|
236
|
+
const removed = this.memoryStore.remove(entityName);
|
|
237
|
+
// Remove from SQLite if available
|
|
238
|
+
if (this.storage && removed) {
|
|
239
|
+
this.storage.removeEmbedding(entityName);
|
|
240
|
+
}
|
|
241
|
+
return removed;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get the number of vectors stored.
|
|
245
|
+
*
|
|
246
|
+
* @returns Number of vectors
|
|
247
|
+
*/
|
|
248
|
+
size() {
|
|
249
|
+
return this.memoryStore.size();
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Clear all vectors from the store.
|
|
253
|
+
*/
|
|
254
|
+
clear() {
|
|
255
|
+
this.memoryStore.clear();
|
|
256
|
+
if (this.storage) {
|
|
257
|
+
this.storage.clearAllEmbeddings();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Check if a vector exists for an entity.
|
|
262
|
+
*
|
|
263
|
+
* @param entityName - Name of the entity
|
|
264
|
+
* @returns True if vector exists
|
|
265
|
+
*/
|
|
266
|
+
has(entityName) {
|
|
267
|
+
return this.memoryStore.has(entityName);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Get the vector for an entity.
|
|
271
|
+
*
|
|
272
|
+
* @param entityName - Name of the entity
|
|
273
|
+
* @returns Vector if found, undefined otherwise
|
|
274
|
+
*/
|
|
275
|
+
get(entityName) {
|
|
276
|
+
return this.memoryStore.get(entityName);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Set the SQLite storage reference.
|
|
280
|
+
*
|
|
281
|
+
* @param storage - SQLite storage instance
|
|
282
|
+
*/
|
|
283
|
+
setStorage(storage) {
|
|
284
|
+
this.storage = storage;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Set the embedding model name.
|
|
288
|
+
*
|
|
289
|
+
* @param model - Model name
|
|
290
|
+
*/
|
|
291
|
+
setEmbeddingModel(model) {
|
|
292
|
+
this.embeddingModel = model;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Create a vector store based on storage type.
|
|
297
|
+
*
|
|
298
|
+
* @param storageType - Storage type: 'jsonl' or 'sqlite'
|
|
299
|
+
* @param storage - Optional SQLite storage reference for 'sqlite' type
|
|
300
|
+
* @param embeddingModel - Optional model name for embedding tracking
|
|
301
|
+
* @returns Vector store instance
|
|
302
|
+
*/
|
|
303
|
+
export function createVectorStore(storageType = 'jsonl', storage, embeddingModel) {
|
|
304
|
+
switch (storageType) {
|
|
305
|
+
case 'sqlite':
|
|
306
|
+
return new SQLiteVectorStore(storage, embeddingModel);
|
|
307
|
+
case 'jsonl':
|
|
308
|
+
default:
|
|
309
|
+
return new InMemoryVectorStore();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search Module Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Sprint 2: Added SearchFilterChain for centralized filter logic
|
|
5
|
+
* Phase 4 Sprint 10: Added EmbeddingService for semantic search
|
|
6
|
+
*/
|
|
7
|
+
export { BasicSearch } from './BasicSearch.js';
|
|
8
|
+
export { RankedSearch } from './RankedSearch.js';
|
|
9
|
+
export { BooleanSearch } from './BooleanSearch.js';
|
|
10
|
+
export { FuzzySearch, type FuzzySearchOptions } from './FuzzySearch.js';
|
|
11
|
+
export { SearchSuggestions } from './SearchSuggestions.js';
|
|
12
|
+
export { SavedSearchManager } from './SavedSearchManager.js';
|
|
13
|
+
export { SearchManager } from './SearchManager.js';
|
|
14
|
+
export { SearchFilterChain, type SearchFilters, type ValidatedPagination } from './SearchFilterChain.js';
|
|
15
|
+
export { OpenAIEmbeddingService, LocalEmbeddingService, MockEmbeddingService, createEmbeddingService, } from './EmbeddingService.js';
|
|
16
|
+
export { InMemoryVectorStore, SQLiteVectorStore, createVectorStore, cosineSimilarity, type SQLiteStorageWithEmbeddings, } from './VectorStore.js';
|
|
17
|
+
export { SemanticSearch, entityToText, } from './SemanticSearch.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/search/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGzG,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,2BAA2B,GACjC,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search Module Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Sprint 2: Added SearchFilterChain for centralized filter logic
|
|
5
|
+
* Phase 4 Sprint 10: Added EmbeddingService for semantic search
|
|
6
|
+
*/
|
|
7
|
+
export { BasicSearch } from './BasicSearch.js';
|
|
8
|
+
export { RankedSearch } from './RankedSearch.js';
|
|
9
|
+
export { BooleanSearch } from './BooleanSearch.js';
|
|
10
|
+
export { FuzzySearch } from './FuzzySearch.js';
|
|
11
|
+
export { SearchSuggestions } from './SearchSuggestions.js';
|
|
12
|
+
export { SavedSearchManager } from './SavedSearchManager.js';
|
|
13
|
+
export { SearchManager } from './SearchManager.js';
|
|
14
|
+
// Sprint 2: Search Filter Chain utilities
|
|
15
|
+
export { SearchFilterChain } from './SearchFilterChain.js';
|
|
16
|
+
// Phase 4 Sprint 10: Embedding Service for semantic search
|
|
17
|
+
export { OpenAIEmbeddingService, LocalEmbeddingService, MockEmbeddingService, createEmbeddingService, } from './EmbeddingService.js';
|
|
18
|
+
// Phase 4 Sprint 11: Vector Store for semantic search
|
|
19
|
+
export { InMemoryVectorStore, SQLiteVectorStore, createVectorStore, cosineSimilarity, } from './VectorStore.js';
|
|
20
|
+
// Phase 4 Sprint 12: Semantic Search Manager
|
|
21
|
+
export { SemanticSearch, entityToText, } from './SemanticSearch.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MCPServer.d.ts","sourceRoot":"","sources":["../../src/server/MCPServer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAOtE;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAAiB;
|
|
1
|
+
{"version":3,"file":"MCPServer.d.ts","sourceRoot":"","sources":["../../src/server/MCPServer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAOtE;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAAiB;IAE5B,YAAY,GAAG,EAAE,cAAc,EAe9B;IAED,OAAO,CAAC,oBAAoB;IAetB,KAAK,kBAIV;CACF"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* MCP Tool Definitions
|
|
3
3
|
*
|
|
4
4
|
* Extracted from MCPServer.ts to reduce file size and improve maintainability.
|
|
5
|
-
* Contains all
|
|
5
|
+
* Contains all 241 tool schemas for the Knowledge Graph MCP Server.
|
|
6
6
|
*
|
|
7
7
|
* @module server/toolDefinitions
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolDefinitions.d.ts","sourceRoot":"","sources":["../../src/server/toolDefinitions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"toolDefinitions.d.ts","sourceRoot":"","sources":["../../src/server/toolDefinitions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,EAokH3C,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* MCP Tool Definitions
|
|
3
3
|
*
|
|
4
4
|
* Extracted from MCPServer.ts to reduce file size and improve maintainability.
|
|
5
|
-
* Contains all
|
|
5
|
+
* Contains all 241 tool schemas for the Knowledge Graph MCP Server.
|
|
6
6
|
*
|
|
7
7
|
* @module server/toolDefinitions
|
|
8
8
|
*/
|
|
@@ -476,7 +476,7 @@ export const toolDefinitions = [
|
|
|
476
476
|
// Phase 11 Sprint 2: Hybrid Search
|
|
477
477
|
{
|
|
478
478
|
name: 'hybrid_search',
|
|
479
|
-
description: 'Search using combined semantic, lexical, and metadata signals. Provides better recall than single-signal search by fusing multiple relevance signals.',
|
|
479
|
+
description: 'Search using combined semantic, lexical, and metadata signals. Provides better recall than single-signal search by fusing multiple relevance signals. v3 additive options: graphWeight adds a graph-connectivity (PageRank) channel, expandNeighbors appends one-hop neighbors of top results, explain annotates results with evidence paths from query anchors, lookFor ranks expansion neighbors by a free-text connection description.',
|
|
480
480
|
inputSchema: {
|
|
481
481
|
type: 'object',
|
|
482
482
|
properties: {
|
|
@@ -531,6 +531,27 @@ export const toolDefinitions = [
|
|
|
531
531
|
additionalProperties: false,
|
|
532
532
|
},
|
|
533
533
|
limit: { type: 'number', description: 'Maximum results to return (default: 10)' },
|
|
534
|
+
graphWeight: {
|
|
535
|
+
type: 'number',
|
|
536
|
+
description: 'Weight for the graph-connectivity channel (normalized PageRank). 0/omitted = channel disabled (default)',
|
|
537
|
+
},
|
|
538
|
+
expandNeighbors: {
|
|
539
|
+
type: 'object',
|
|
540
|
+
description: 'One-hop neighbor expansion: neighbors of the top-K results are appended with a damped score and re-sorted',
|
|
541
|
+
properties: {
|
|
542
|
+
topK: { type: 'number', description: 'Number of top-ranked results to expand from (default: 10)' },
|
|
543
|
+
damping: { type: 'number', description: "Damping factor applied to the parent's combined score (default: 0.3)" },
|
|
544
|
+
},
|
|
545
|
+
additionalProperties: false,
|
|
546
|
+
},
|
|
547
|
+
explain: {
|
|
548
|
+
type: 'boolean',
|
|
549
|
+
description: 'Annotate each result with evidencePaths — graph paths connecting query anchor matches to the result (default: false)',
|
|
550
|
+
},
|
|
551
|
+
lookFor: {
|
|
552
|
+
type: 'string',
|
|
553
|
+
description: 'Free-text description of the desired connection; expansion neighbors are ranked by similarity to it (lookForScore)',
|
|
554
|
+
},
|
|
534
555
|
},
|
|
535
556
|
required: ['query'],
|
|
536
557
|
additionalProperties: false,
|
|
@@ -3347,6 +3368,237 @@ export const toolDefinitions = [
|
|
|
3347
3368
|
additionalProperties: false,
|
|
3348
3369
|
},
|
|
3349
3370
|
},
|
|
3371
|
+
// ==================== EVENT MEMORY TOOLS (memoryjs v3.0.0) ====================
|
|
3372
|
+
{
|
|
3373
|
+
name: 'record_event',
|
|
3374
|
+
description: 'Record an n-ary event: the action becomes a first-class event hub entity with role-typed relations (actor_of/targeted/occurred_in/participant_in). Missing endpoints auto-create as concept stubs. Optional flowKey groups events into a named flow.',
|
|
3375
|
+
inputSchema: {
|
|
3376
|
+
type: 'object',
|
|
3377
|
+
properties: {
|
|
3378
|
+
action: { type: 'string', description: 'The verb — what happened (e.g. "deployed", "approved")' },
|
|
3379
|
+
actor: { type: 'string', description: 'Entity name of who performed the action' },
|
|
3380
|
+
target: { type: 'string', description: 'Entity name the action was performed on' },
|
|
3381
|
+
context: { type: 'string', description: 'Entity name of where/within-what the event occurred' },
|
|
3382
|
+
participants: { type: 'array', items: { type: 'string' }, description: 'Additional participant entity names' },
|
|
3383
|
+
occurredAt: { type: 'string', description: 'ISO 8601 timestamp of when the event occurred' },
|
|
3384
|
+
flowKey: { type: 'string', description: 'Flow key grouping related events (case-insensitive)' },
|
|
3385
|
+
detail: { type: 'array', items: { type: 'string' }, description: 'Free-text detail observations attached to the event' },
|
|
3386
|
+
importance: { type: 'number', description: 'Importance score for the event entity' },
|
|
3387
|
+
},
|
|
3388
|
+
required: ['action', 'actor'],
|
|
3389
|
+
additionalProperties: false,
|
|
3390
|
+
},
|
|
3391
|
+
},
|
|
3392
|
+
{
|
|
3393
|
+
name: 'get_event',
|
|
3394
|
+
description: 'Load one recorded event by its entity name, joining the event hub with its role-typed relation endpoints (actor, target, context, participants).',
|
|
3395
|
+
inputSchema: {
|
|
3396
|
+
type: 'object',
|
|
3397
|
+
properties: {
|
|
3398
|
+
name: { type: 'string', description: 'Event entity name (as returned by record_event / query_events)' },
|
|
3399
|
+
},
|
|
3400
|
+
required: ['name'],
|
|
3401
|
+
additionalProperties: false,
|
|
3402
|
+
},
|
|
3403
|
+
},
|
|
3404
|
+
{
|
|
3405
|
+
name: 'query_events',
|
|
3406
|
+
description: 'Query recorded events by any combination of actor, target, action, flowKey, and inclusive time range. Results are chronologically ordered (occurredAt, falling back to createdAt). Uses relation/type indexes — never a full-graph scan.',
|
|
3407
|
+
inputSchema: {
|
|
3408
|
+
type: 'object',
|
|
3409
|
+
properties: {
|
|
3410
|
+
actor: { type: 'string', description: 'Filter by actor entity name' },
|
|
3411
|
+
target: { type: 'string', description: 'Filter by target entity name' },
|
|
3412
|
+
action: { type: 'string', description: 'Filter by action verb' },
|
|
3413
|
+
flowKey: { type: 'string', description: 'Filter by flow key' },
|
|
3414
|
+
timeRange: {
|
|
3415
|
+
type: 'object',
|
|
3416
|
+
properties: {
|
|
3417
|
+
start: { type: 'string', description: 'Inclusive lower bound (ISO 8601)' },
|
|
3418
|
+
end: { type: 'string', description: 'Inclusive upper bound (ISO 8601)' },
|
|
3419
|
+
},
|
|
3420
|
+
additionalProperties: false,
|
|
3421
|
+
description: 'Inclusive time range; either bound may be omitted',
|
|
3422
|
+
},
|
|
3423
|
+
limit: { type: 'number', description: 'Max events to return' },
|
|
3424
|
+
},
|
|
3425
|
+
additionalProperties: false,
|
|
3426
|
+
},
|
|
3427
|
+
},
|
|
3428
|
+
{
|
|
3429
|
+
name: 'get_event_flow',
|
|
3430
|
+
description: 'All events sharing a flow key (flow:<key> tag), chronologically ordered — the full timeline of a named flow (e.g. a release, an incident).',
|
|
3431
|
+
inputSchema: {
|
|
3432
|
+
type: 'object',
|
|
3433
|
+
properties: {
|
|
3434
|
+
flowKey: { type: 'string', description: 'Flow key (case-insensitive)' },
|
|
3435
|
+
},
|
|
3436
|
+
required: ['flowKey'],
|
|
3437
|
+
additionalProperties: false,
|
|
3438
|
+
},
|
|
3439
|
+
},
|
|
3440
|
+
{
|
|
3441
|
+
name: 'who_did_what',
|
|
3442
|
+
description: 'Convenience join answering "who did what (to target / in context / within time range)?" over recorded events. Returns actor + action + event tuples; events without a resolvable actor are omitted.',
|
|
3443
|
+
inputSchema: {
|
|
3444
|
+
type: 'object',
|
|
3445
|
+
properties: {
|
|
3446
|
+
target: { type: 'string', description: 'Filter by target entity name' },
|
|
3447
|
+
context: { type: 'string', description: 'Filter by context entity name' },
|
|
3448
|
+
timeRange: {
|
|
3449
|
+
type: 'object',
|
|
3450
|
+
properties: {
|
|
3451
|
+
start: { type: 'string', description: 'Inclusive lower bound (ISO 8601)' },
|
|
3452
|
+
end: { type: 'string', description: 'Inclusive upper bound (ISO 8601)' },
|
|
3453
|
+
},
|
|
3454
|
+
additionalProperties: false,
|
|
3455
|
+
description: 'Inclusive time range; either bound may be omitted',
|
|
3456
|
+
},
|
|
3457
|
+
limit: { type: 'number', description: 'Max entries to return' },
|
|
3458
|
+
},
|
|
3459
|
+
additionalProperties: false,
|
|
3460
|
+
},
|
|
3461
|
+
},
|
|
3462
|
+
// ==================== RECONSTRUCTIVE MEMORY TOOLS (memoryjs v3.0.0) ====================
|
|
3463
|
+
{
|
|
3464
|
+
name: 'ingest_dialogue',
|
|
3465
|
+
description: 'Distill raw dialogue turns into the Cue–Tag–Content associative memory graph (MRAgent-style "memory is reconstructed, not retrieved"). Episodic/semantic/topic layers are also persisted into the live knowledge graph. Multiple calls accumulate.',
|
|
3466
|
+
inputSchema: {
|
|
3467
|
+
type: 'object',
|
|
3468
|
+
properties: {
|
|
3469
|
+
turns: {
|
|
3470
|
+
type: 'array',
|
|
3471
|
+
items: {
|
|
3472
|
+
type: 'object',
|
|
3473
|
+
properties: {
|
|
3474
|
+
id: { type: 'string', description: 'Unique turn id' },
|
|
3475
|
+
speaker: { type: 'string', description: 'Speaker name' },
|
|
3476
|
+
text: { type: 'string', description: 'Turn text' },
|
|
3477
|
+
timestamp: { type: 'string', description: 'ISO 8601 timestamp' },
|
|
3478
|
+
},
|
|
3479
|
+
required: ['id', 'text'],
|
|
3480
|
+
additionalProperties: false,
|
|
3481
|
+
},
|
|
3482
|
+
description: 'Dialogue turns to distill and ingest',
|
|
3483
|
+
},
|
|
3484
|
+
},
|
|
3485
|
+
required: ['turns'],
|
|
3486
|
+
additionalProperties: false,
|
|
3487
|
+
},
|
|
3488
|
+
},
|
|
3489
|
+
{
|
|
3490
|
+
name: 'reconstruct_memory',
|
|
3491
|
+
description: 'Answer a query via active multi-step traversal of the reconstructive (Cue–Tag–Content) memory graph. Returns accumulated evidence, the step-by-step trajectory, and whether the loop stopped early on a satisfied condition vs. budget.',
|
|
3492
|
+
inputSchema: {
|
|
3493
|
+
type: 'object',
|
|
3494
|
+
properties: {
|
|
3495
|
+
query: { type: 'string', description: 'Query to reconstruct an answer for' },
|
|
3496
|
+
maxSteps: { type: 'number', description: 'Max reasoning turns (default 8)' },
|
|
3497
|
+
perStepBudget: { type: 'number', description: 'Max content nodes routed per step (default 10)' },
|
|
3498
|
+
evidenceTarget: { type: 'number', description: 'Stop once this many distinct evidence items accumulate (default 12)' },
|
|
3499
|
+
},
|
|
3500
|
+
required: ['query'],
|
|
3501
|
+
additionalProperties: false,
|
|
3502
|
+
},
|
|
3503
|
+
},
|
|
3504
|
+
{
|
|
3505
|
+
name: 'reconstructive_memory_stats',
|
|
3506
|
+
description: 'Size statistics of the reconstructive (Cue–Tag–Content) memory graph: cue / tag / content node counts and edge counts.',
|
|
3507
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
3508
|
+
},
|
|
3509
|
+
// ==================== RELATION CONSOLIDATION TOOLS (memoryjs v3.0.0) ====================
|
|
3510
|
+
{
|
|
3511
|
+
name: 'analyze_relation_duplicates',
|
|
3512
|
+
description: 'Dry-run the three-tier relation janitor: tier 1 finds trivial relationType spelling variants (WorksAt/works-at/works_at) and redundant bidirectional mirrors; tier 2 (when an embedding provider is configured) finds semantically equivalent same-pair relations. Report-only — never mutates the graph.',
|
|
3513
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
3514
|
+
},
|
|
3515
|
+
{
|
|
3516
|
+
name: 'consolidate_relations',
|
|
3517
|
+
description: 'Run relation-duplicate analysis and — when apply=true — merge tier 1+2 duplicate groups (delete variants, create the canonical survivor with summed confirmationCount). apply=false (default) is identical to analyze_relation_duplicates.',
|
|
3518
|
+
inputSchema: {
|
|
3519
|
+
type: 'object',
|
|
3520
|
+
properties: {
|
|
3521
|
+
apply: { type: 'boolean', description: 'Apply tier 1+2 merges (default false = dry-run)' },
|
|
3522
|
+
},
|
|
3523
|
+
additionalProperties: false,
|
|
3524
|
+
},
|
|
3525
|
+
},
|
|
3526
|
+
// ==================== AGENT REFLECTION TOOLS (memoryjs v3.0.0) ====================
|
|
3527
|
+
{
|
|
3528
|
+
name: 'create_reflection',
|
|
3529
|
+
description: 'Persist an agent reflection — a generalized lesson distilled from experience, backed by evidence entities. Deduplicated by evidence hash; scoped to session, project, or global.',
|
|
3530
|
+
inputSchema: {
|
|
3531
|
+
type: 'object',
|
|
3532
|
+
properties: {
|
|
3533
|
+
scope: { type: 'string', enum: ['session', 'project', 'global'], description: 'Generalization scope of the reflection' },
|
|
3534
|
+
summary: { type: 'string', description: 'The reflection text (non-empty)' },
|
|
3535
|
+
evidence: { type: 'array', items: { type: 'string' }, description: 'Entity names backing this reflection (non-empty)' },
|
|
3536
|
+
generalizationConfidence: { type: 'number', description: 'Confidence in [0.0, 1.0] that the lesson generalizes' },
|
|
3537
|
+
keyInsights: { type: 'array', items: { type: 'string' }, description: 'Top pattern strings (max 5)' },
|
|
3538
|
+
experienceType: { type: 'string', description: 'Experience type label (e.g. "success", "failure")' },
|
|
3539
|
+
sourceSessionId: { type: 'string', description: 'Session the reflection was distilled from' },
|
|
3540
|
+
sourceProjectId: { type: 'string', description: 'Project the reflection was distilled from' },
|
|
3541
|
+
importance: { type: 'number', description: 'Importance score for the reflection entity' },
|
|
3542
|
+
agentId: { type: 'string', description: 'Agent that authored the reflection' },
|
|
3543
|
+
},
|
|
3544
|
+
required: ['scope', 'summary', 'evidence', 'generalizationConfidence'],
|
|
3545
|
+
additionalProperties: false,
|
|
3546
|
+
},
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
name: 'list_reflections',
|
|
3550
|
+
description: 'List stored agent reflections, filterable by scope, source session/project, and minimum generalization confidence. Archived reflections are excluded unless includeArchived is set.',
|
|
3551
|
+
inputSchema: {
|
|
3552
|
+
type: 'object',
|
|
3553
|
+
properties: {
|
|
3554
|
+
scope: { type: 'string', enum: ['session', 'project', 'global'], description: 'Filter by scope' },
|
|
3555
|
+
sourceSessionId: { type: 'string', description: 'Filter by source session' },
|
|
3556
|
+
sourceProjectId: { type: 'string', description: 'Filter by source project' },
|
|
3557
|
+
minConfidence: { type: 'number', description: 'Minimum generalization_confidence (inclusive)' },
|
|
3558
|
+
includeArchived: { type: 'boolean', description: 'Include archived reflections (default false)' },
|
|
3559
|
+
limit: { type: 'number', description: 'Max reflections to return' },
|
|
3560
|
+
},
|
|
3561
|
+
additionalProperties: false,
|
|
3562
|
+
},
|
|
3563
|
+
},
|
|
3564
|
+
{
|
|
3565
|
+
name: 'get_relevant_reflections',
|
|
3566
|
+
description: 'Reflections relevant to a session: matches by sourceSessionId, plus evidence overlap with the supplied session entity names. Use at session start to surface applicable past lessons.',
|
|
3567
|
+
inputSchema: {
|
|
3568
|
+
type: 'object',
|
|
3569
|
+
properties: {
|
|
3570
|
+
sessionId: { type: 'string', description: 'Session to find relevant reflections for' },
|
|
3571
|
+
sessionEntityNames: { type: 'array', items: { type: 'string' }, description: 'Entity names from the session for evidence-overlap matching' },
|
|
3572
|
+
minConfidence: { type: 'number', description: 'Minimum generalization_confidence (inclusive)' },
|
|
3573
|
+
limit: { type: 'number', description: 'Max reflections to return (default 10)' },
|
|
3574
|
+
},
|
|
3575
|
+
required: ['sessionId'],
|
|
3576
|
+
additionalProperties: false,
|
|
3577
|
+
},
|
|
3578
|
+
},
|
|
3579
|
+
{
|
|
3580
|
+
name: 'archive_reflection',
|
|
3581
|
+
description: 'Archive a reflection by id so it no longer appears in default listings or relevance matches (soft delete — the record is retained).',
|
|
3582
|
+
inputSchema: {
|
|
3583
|
+
type: 'object',
|
|
3584
|
+
properties: {
|
|
3585
|
+
id: { type: 'string', description: 'Reflection id to archive' },
|
|
3586
|
+
},
|
|
3587
|
+
required: ['id'],
|
|
3588
|
+
additionalProperties: false,
|
|
3589
|
+
},
|
|
3590
|
+
},
|
|
3591
|
+
// ==================== RECONSTRUCTIVE MEMORY PERSISTENCE TOOLS (memoryjs v3.0.0) ====================
|
|
3592
|
+
{
|
|
3593
|
+
name: 'save_reconstructive_memory',
|
|
3594
|
+
description: 'Serialize the in-memory Cue–Tag–Content reconstructive graph to a JSON sidecar next to the storage file (<basename>-reconstructive.json). The CTC graph is process-local; save before shutdown to survive restarts.',
|
|
3595
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
name: 'load_reconstructive_memory',
|
|
3599
|
+
description: 'Restore the Cue–Tag–Content reconstructive graph from the <basename>-reconstructive.json sidecar written by save_reconstructive_memory, replacing the current in-memory graph. Errors if no sidecar exists.',
|
|
3600
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
3601
|
+
},
|
|
3350
3602
|
];
|
|
3351
3603
|
// Tool categories are documented in CLAUDE.md for reference:
|
|
3352
3604
|
// - Entity Operations: create_entities, delete_entities, read_graph, open_nodes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolHandlers.d.ts","sourceRoot":"","sources":["../../src/server/toolHandlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,kBAAkB,
|
|
1
|
+
{"version":3,"file":"toolHandlers.d.ts","sourceRoot":"","sources":["../../src/server/toolHandlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,kBAAkB,EA2ClB,KAAK,cAAc,EAyBpB,MAAM,yBAAyB,CAAC;AAyBjC,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAE7E;AAkED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CACxB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,OAAO,CAAC,YAAY,CAAC,CAAC;AAiF3B,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAouGpD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,YAAY,CAAC,CAiBvB"}
|