@pcircle/memesh 2.11.0 → 3.0.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 +153 -52
- package/dist/cli/assets/d3.v7.min.js +2 -0
- package/dist/cli/view.d.ts +1 -0
- package/dist/cli/view.d.ts.map +1 -1
- package/dist/cli/view.js +2198 -10
- package/dist/cli/view.js.map +1 -1
- package/dist/core/config.d.ts +33 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +70 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/extractor.d.ts +26 -0
- package/dist/core/extractor.d.ts.map +1 -0
- package/dist/core/extractor.js +106 -0
- package/dist/core/extractor.js.map +1 -0
- package/dist/core/lifecycle.d.ts +9 -0
- package/dist/core/lifecycle.d.ts.map +1 -0
- package/dist/core/lifecycle.js +51 -0
- package/dist/core/lifecycle.js.map +1 -0
- package/dist/core/operations.d.ts +9 -0
- package/dist/core/operations.d.ts.map +1 -0
- package/dist/core/operations.js +342 -0
- package/dist/core/operations.js.map +1 -0
- package/dist/core/query-expander.d.ts +4 -0
- package/dist/core/query-expander.d.ts.map +1 -0
- package/dist/core/query-expander.js +114 -0
- package/dist/core/query-expander.js.map +1 -0
- package/dist/core/schema-export.d.ts +2 -0
- package/dist/core/schema-export.d.ts.map +1 -0
- package/dist/core/schema-export.js +67 -0
- package/dist/core/schema-export.js.map +1 -0
- package/dist/core/scoring.d.ts +25 -0
- package/dist/core/scoring.d.ts.map +1 -0
- package/dist/core/scoring.js +40 -0
- package/dist/core/scoring.js.map +1 -0
- package/dist/core/types.d.ts +124 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/version-check.d.ts +10 -0
- package/dist/core/version-check.d.ts.map +1 -0
- package/dist/core/version-check.js +44 -0
- package/dist/core/version-check.js.map +1 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +33 -0
- package/dist/db.js.map +1 -1
- package/dist/knowledge-graph.d.ts +16 -30
- package/dist/knowledge-graph.d.ts.map +1 -1
- package/dist/knowledge-graph.js +205 -24
- package/dist/knowledge-graph.js.map +1 -1
- package/dist/mcp/server.js +8 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +1 -92
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1 -182
- package/dist/mcp/tools.js.map +1 -1
- package/dist/transports/cli/cli.d.ts +3 -0
- package/dist/transports/cli/cli.d.ts.map +1 -0
- package/dist/transports/cli/cli.js +378 -0
- package/dist/transports/cli/cli.js.map +1 -0
- package/dist/transports/http/server.d.ts +5 -0
- package/dist/transports/http/server.d.ts.map +1 -0
- package/dist/transports/http/server.js +314 -0
- package/dist/transports/http/server.js.map +1 -0
- package/dist/transports/mcp/handlers.d.ts +184 -0
- package/dist/transports/mcp/handlers.d.ts.map +1 -0
- package/dist/transports/mcp/handlers.js +271 -0
- package/dist/transports/mcp/handlers.js.map +1 -0
- package/hooks/hooks.json +24 -0
- package/package.json +27 -9
- package/plugin.json +4 -4
- package/scripts/hooks/post-commit.js +35 -6
- package/scripts/hooks/pre-compact.js +198 -0
- package/scripts/hooks/session-start.js +73 -25
- package/scripts/hooks/session-summary.js +255 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { openDatabase, closeDatabase } from '../../db.js';
|
|
5
|
+
import { remember, recallEnhanced, forget, consolidate, exportMemories, importMemories } from '../../core/operations.js';
|
|
6
|
+
import { KnowledgeGraph } from '../../knowledge-graph.js';
|
|
7
|
+
import { getDatabase } from '../../db.js';
|
|
8
|
+
import { logCapabilities, readConfig, updateConfig, detectCapabilities } from '../../core/config.js';
|
|
9
|
+
const RememberBody = z.object({
|
|
10
|
+
name: z.string().min(1),
|
|
11
|
+
type: z.string().min(1),
|
|
12
|
+
observations: z.array(z.string()).optional(),
|
|
13
|
+
tags: z.array(z.string()).optional(),
|
|
14
|
+
relations: z.array(z.object({ to: z.string().min(1), type: z.string().min(1) })).optional(),
|
|
15
|
+
namespace: z.enum(['personal', 'team', 'global']).optional(),
|
|
16
|
+
});
|
|
17
|
+
const RecallBody = z.object({
|
|
18
|
+
query: z.string().optional(),
|
|
19
|
+
tag: z.string().optional(),
|
|
20
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
21
|
+
include_archived: z.boolean().optional(),
|
|
22
|
+
namespace: z.enum(['personal', 'team', 'global']).optional(),
|
|
23
|
+
cross_project: z.boolean().optional(),
|
|
24
|
+
});
|
|
25
|
+
const ForgetBody = z.object({
|
|
26
|
+
name: z.string().min(1),
|
|
27
|
+
observation: z.string().optional(),
|
|
28
|
+
});
|
|
29
|
+
const ConsolidateBody = z.object({
|
|
30
|
+
name: z.string().optional(),
|
|
31
|
+
tag: z.string().optional(),
|
|
32
|
+
min_observations: z.number().int().min(1).optional(),
|
|
33
|
+
});
|
|
34
|
+
const ExportBody = z.object({
|
|
35
|
+
tag: z.string().optional(),
|
|
36
|
+
namespace: z.string().optional(),
|
|
37
|
+
limit: z.number().int().min(1).max(10000).optional(),
|
|
38
|
+
});
|
|
39
|
+
const ExportResultBody = z.object({
|
|
40
|
+
version: z.string(),
|
|
41
|
+
exported_at: z.string(),
|
|
42
|
+
entity_count: z.number(),
|
|
43
|
+
entities: z.array(z.object({
|
|
44
|
+
name: z.string().min(1).max(255),
|
|
45
|
+
type: z.string().min(1).max(100),
|
|
46
|
+
namespace: z.string(),
|
|
47
|
+
observations: z.array(z.string().max(10000)),
|
|
48
|
+
tags: z.array(z.string().max(255)),
|
|
49
|
+
relations: z.array(z.object({ to: z.string().min(1).max(255), type: z.string().min(1).max(100) })),
|
|
50
|
+
})),
|
|
51
|
+
});
|
|
52
|
+
const ImportBody = z.object({
|
|
53
|
+
data: ExportResultBody,
|
|
54
|
+
namespace: z.string().optional(),
|
|
55
|
+
merge_strategy: z.enum(['skip', 'overwrite', 'append']),
|
|
56
|
+
});
|
|
57
|
+
import fs from 'fs';
|
|
58
|
+
import path from 'path';
|
|
59
|
+
import { fileURLToPath } from 'url';
|
|
60
|
+
const packageJsonPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../package.json');
|
|
61
|
+
const packageVersion = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).version ?? '0.0.0';
|
|
62
|
+
const app = express();
|
|
63
|
+
app.use(express.json());
|
|
64
|
+
app.get('/dashboard', (_req, res) => {
|
|
65
|
+
const dashboardPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../dashboard/dist/index.html');
|
|
66
|
+
if (fs.existsSync(dashboardPath)) {
|
|
67
|
+
res.type('html').sendFile(dashboardPath);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
import('../../cli/view.js').then(m => res.type('html').send(m.generateLiveDashboardHtml()));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
app.get('/v1/health', (_req, res) => {
|
|
74
|
+
try {
|
|
75
|
+
const db = getDatabase();
|
|
76
|
+
const count = db.prepare('SELECT COUNT(*) as c FROM entities').get();
|
|
77
|
+
res.json({ success: true, data: { status: 'ok', version: packageVersion, entity_count: count.c } });
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
res.status(500).json({ success: false, error: err.message });
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
app.post('/v1/remember', (req, res) => {
|
|
84
|
+
const parsed = RememberBody.safeParse(req.body);
|
|
85
|
+
if (!parsed.success) {
|
|
86
|
+
res.status(400).json({ success: false, error: parsed.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; ') });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const result = remember(parsed.data);
|
|
91
|
+
res.json({ success: true, data: result });
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
res.status(400).json({ success: false, error: err.message });
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
app.post('/v1/recall', async (req, res) => {
|
|
98
|
+
const parsed = RecallBody.safeParse(req.body);
|
|
99
|
+
if (!parsed.success) {
|
|
100
|
+
res.status(400).json({ success: false, error: parsed.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; ') });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const entities = await recallEnhanced(parsed.data);
|
|
105
|
+
const kg = new KnowledgeGraph(getDatabase());
|
|
106
|
+
const conflicts = kg.findConflicts(entities.map(e => e.name));
|
|
107
|
+
if (conflicts.length > 0) {
|
|
108
|
+
res.json({ success: true, data: { entities, conflicts } });
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
res.json({ success: true, data: entities });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
res.status(400).json({ success: false, error: err.message });
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
app.post('/v1/forget', (req, res) => {
|
|
119
|
+
const parsed = ForgetBody.safeParse(req.body);
|
|
120
|
+
if (!parsed.success) {
|
|
121
|
+
res.status(400).json({ success: false, error: parsed.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; ') });
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const result = forget(parsed.data);
|
|
126
|
+
res.json({ success: true, data: result });
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
res.status(400).json({ success: false, error: err.message });
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
app.post('/v1/consolidate', async (req, res) => {
|
|
133
|
+
const parsed = ConsolidateBody.safeParse(req.body);
|
|
134
|
+
if (!parsed.success) {
|
|
135
|
+
res.status(400).json({ success: false, error: parsed.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; ') });
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const result = await consolidate(parsed.data);
|
|
140
|
+
res.json({ success: true, data: result });
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
res.status(400).json({ success: false, error: err.message });
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
app.post('/v1/export', (req, res) => {
|
|
147
|
+
const parsed = ExportBody.safeParse(req.body);
|
|
148
|
+
if (!parsed.success) {
|
|
149
|
+
res.status(400).json({ success: false, error: parsed.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; ') });
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
const result = exportMemories(parsed.data);
|
|
154
|
+
res.json({ success: true, data: result });
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
res.status(400).json({ success: false, error: err.message });
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
app.post('/v1/import', (req, res) => {
|
|
161
|
+
const parsed = ImportBody.safeParse(req.body);
|
|
162
|
+
if (!parsed.success) {
|
|
163
|
+
res.status(400).json({ success: false, error: parsed.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; ') });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
const result = importMemories(parsed.data);
|
|
168
|
+
res.json({ success: true, data: result });
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
res.status(400).json({ success: false, error: err.message });
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
app.get('/v1/config', (_req, res) => {
|
|
175
|
+
try {
|
|
176
|
+
const config = readConfig();
|
|
177
|
+
const caps = detectCapabilities(config);
|
|
178
|
+
const safeConfig = { ...config };
|
|
179
|
+
if (safeConfig.llm?.apiKey) {
|
|
180
|
+
safeConfig.llm = { ...safeConfig.llm, apiKey: '***' };
|
|
181
|
+
}
|
|
182
|
+
res.json({ success: true, data: { config: safeConfig, capabilities: caps } });
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
res.status(500).json({ success: false, error: err.message });
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
const ConfigBody = z.object({
|
|
189
|
+
llm: z.object({
|
|
190
|
+
provider: z.enum(['anthropic', 'openai', 'ollama']),
|
|
191
|
+
model: z.string().optional(),
|
|
192
|
+
apiKey: z.string().optional(),
|
|
193
|
+
}).optional(),
|
|
194
|
+
autoCapture: z.boolean().optional(),
|
|
195
|
+
sessionLimit: z.number().int().min(1).max(100).optional(),
|
|
196
|
+
theme: z.enum(['light', 'dark']).optional(),
|
|
197
|
+
setupCompleted: z.boolean().optional(),
|
|
198
|
+
}).passthrough();
|
|
199
|
+
app.post('/v1/config', (req, res) => {
|
|
200
|
+
const parsed = ConfigBody.safeParse(req.body);
|
|
201
|
+
if (!parsed.success) {
|
|
202
|
+
res.status(400).json({ success: false, error: parsed.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join('; ') });
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
const updated = updateConfig(parsed.data);
|
|
207
|
+
const safeUpdated = { ...updated };
|
|
208
|
+
if (safeUpdated.llm?.apiKey) {
|
|
209
|
+
safeUpdated.llm = { ...safeUpdated.llm, apiKey: '***' };
|
|
210
|
+
}
|
|
211
|
+
res.json({ success: true, data: safeUpdated });
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
res.status(400).json({ success: false, error: err.message });
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
app.get('/v1/graph', (_req, res) => {
|
|
218
|
+
try {
|
|
219
|
+
const db = getDatabase();
|
|
220
|
+
const kg = new KnowledgeGraph(db);
|
|
221
|
+
const entities = kg.listRecent(500, true);
|
|
222
|
+
const relations = db.prepare(`
|
|
223
|
+
SELECT e_from.name AS "from", e_to.name AS "to", r.relation_type AS type
|
|
224
|
+
FROM relations r
|
|
225
|
+
JOIN entities e_from ON r.from_entity_id = e_from.id
|
|
226
|
+
JOIN entities e_to ON r.to_entity_id = e_to.id
|
|
227
|
+
`).all();
|
|
228
|
+
res.json({ success: true, data: { entities, relations } });
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
res.status(500).json({ success: false, error: err.message });
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
app.get('/v1/stats', (_req, res) => {
|
|
235
|
+
try {
|
|
236
|
+
const db = getDatabase();
|
|
237
|
+
const entities = db.prepare('SELECT COUNT(*) as c FROM entities').get();
|
|
238
|
+
const observations = db.prepare('SELECT COUNT(*) as c FROM observations').get();
|
|
239
|
+
const relations = db.prepare('SELECT COUNT(*) as c FROM relations').get();
|
|
240
|
+
const tags = db.prepare('SELECT COUNT(DISTINCT tag) as c FROM tags').get();
|
|
241
|
+
const typeDistribution = db.prepare('SELECT type, COUNT(*) as count FROM entities GROUP BY type ORDER BY count DESC').all();
|
|
242
|
+
const tagDistribution = db.prepare('SELECT tag, COUNT(*) as count FROM tags GROUP BY tag ORDER BY count DESC LIMIT 30').all();
|
|
243
|
+
const statusDistribution = db.prepare("SELECT status, COUNT(*) as count FROM entities GROUP BY status").all();
|
|
244
|
+
res.json({
|
|
245
|
+
success: true,
|
|
246
|
+
data: {
|
|
247
|
+
totalEntities: entities.c,
|
|
248
|
+
totalObservations: observations.c,
|
|
249
|
+
totalRelations: relations.c,
|
|
250
|
+
totalTags: tags.c,
|
|
251
|
+
typeDistribution,
|
|
252
|
+
tagDistribution,
|
|
253
|
+
statusDistribution,
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
catch (err) {
|
|
258
|
+
res.status(500).json({ success: false, error: err.message });
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
app.get('/v1/entities', (req, res) => {
|
|
262
|
+
try {
|
|
263
|
+
const db = getDatabase();
|
|
264
|
+
const kg = new KnowledgeGraph(db);
|
|
265
|
+
const limit = parseInt(req.query.limit) || 20;
|
|
266
|
+
const includeArchived = req.query.status === 'all';
|
|
267
|
+
const entities = kg.listRecent(limit, includeArchived);
|
|
268
|
+
res.json({ success: true, data: entities });
|
|
269
|
+
}
|
|
270
|
+
catch (err) {
|
|
271
|
+
res.status(500).json({ success: false, error: err.message });
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
app.get('/v1/entities/:name', (req, res) => {
|
|
275
|
+
try {
|
|
276
|
+
const db = getDatabase();
|
|
277
|
+
const kg = new KnowledgeGraph(db);
|
|
278
|
+
const entity = kg.getEntity(req.params.name);
|
|
279
|
+
if (!entity) {
|
|
280
|
+
res.status(404).json({ success: false, error: `Entity "${req.params.name}" not found` });
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
res.json({ success: true, data: entity });
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
res.status(500).json({ success: false, error: err.message });
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
const HOST = process.env.MEMESH_HTTP_HOST || '127.0.0.1';
|
|
290
|
+
const PORT = parseInt(process.env.MEMESH_HTTP_PORT || '3737');
|
|
291
|
+
export function startServer(host = HOST, port = PORT) {
|
|
292
|
+
openDatabase();
|
|
293
|
+
logCapabilities();
|
|
294
|
+
const server = app.listen(port, host, () => {
|
|
295
|
+
console.log(`MeMesh HTTP server running at http://${host}:${port}`);
|
|
296
|
+
});
|
|
297
|
+
return server;
|
|
298
|
+
}
|
|
299
|
+
const isMain = process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, '/'));
|
|
300
|
+
if (isMain || process.argv[1]?.endsWith('memesh-http')) {
|
|
301
|
+
const server = startServer();
|
|
302
|
+
function shutdown() {
|
|
303
|
+
server.close();
|
|
304
|
+
try {
|
|
305
|
+
closeDatabase();
|
|
306
|
+
}
|
|
307
|
+
catch { }
|
|
308
|
+
process.exit(0);
|
|
309
|
+
}
|
|
310
|
+
process.on('SIGINT', shutdown);
|
|
311
|
+
process.on('SIGTERM', shutdown);
|
|
312
|
+
}
|
|
313
|
+
export { app };
|
|
314
|
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AI,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAGD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAChG,IAAI,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;IACvD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAE7B,SAAS,QAAQ;QACf,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,IAAI,CAAC;YAAC,aAAa,EAAE,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export declare const TOOL_DEFINITIONS: readonly [{
|
|
2
|
+
readonly name: "remember";
|
|
3
|
+
readonly description: "Store knowledge as an entity with observations, tags, and relations. Use this to remember decisions, patterns, lessons learned, and important context.";
|
|
4
|
+
readonly inputSchema: {
|
|
5
|
+
readonly type: "object";
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly name: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly description: "Unique entity name (e.g., \"auth-decision\", \"jwt-pattern\"). Reusing a name appends observations and dedupes tags instead of replacing the entity.";
|
|
10
|
+
};
|
|
11
|
+
readonly type: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Entity type (e.g., \"decision\", \"pattern\", \"lesson\", \"commit\")";
|
|
14
|
+
};
|
|
15
|
+
readonly observations: {
|
|
16
|
+
readonly type: "array";
|
|
17
|
+
readonly items: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
};
|
|
20
|
+
readonly description: "Key facts or observations about this entity";
|
|
21
|
+
};
|
|
22
|
+
readonly tags: {
|
|
23
|
+
readonly type: "array";
|
|
24
|
+
readonly items: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
};
|
|
27
|
+
readonly description: "Tags for filtering (e.g., \"project:myapp\", \"type:decision\")";
|
|
28
|
+
};
|
|
29
|
+
readonly relations: {
|
|
30
|
+
readonly type: "array";
|
|
31
|
+
readonly items: {
|
|
32
|
+
readonly type: "object";
|
|
33
|
+
readonly properties: {
|
|
34
|
+
readonly to: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly description: "Target entity name";
|
|
37
|
+
};
|
|
38
|
+
readonly type: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly description: "Relation type (e.g., \"implements\", \"related-to\")";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly required: readonly ["to", "type"];
|
|
44
|
+
readonly additionalProperties: false;
|
|
45
|
+
};
|
|
46
|
+
readonly description: "Relations to other entities";
|
|
47
|
+
};
|
|
48
|
+
readonly namespace: {
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly enum: readonly ["personal", "team", "global"];
|
|
51
|
+
readonly description: "Namespace for organizing the entity (default: \"personal\")";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly required: readonly ["name", "type"];
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
};
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "recall";
|
|
59
|
+
readonly description: "Search and retrieve stored knowledge. Uses full-text search with optional project tag filtering. Call with no query to list recent memories.";
|
|
60
|
+
readonly inputSchema: {
|
|
61
|
+
readonly type: "object";
|
|
62
|
+
readonly properties: {
|
|
63
|
+
readonly query: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
readonly description: "Search query (uses FTS5 full-text search). Leave empty to list recent.";
|
|
66
|
+
};
|
|
67
|
+
readonly tag: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly description: "Filter by tag (e.g., \"project:myapp\")";
|
|
70
|
+
};
|
|
71
|
+
readonly limit: {
|
|
72
|
+
readonly type: "number";
|
|
73
|
+
readonly description: "Max results (default: 20, max: 100)";
|
|
74
|
+
};
|
|
75
|
+
readonly include_archived: {
|
|
76
|
+
readonly type: "boolean";
|
|
77
|
+
readonly description: "Include archived (forgotten) entities in results. Default: false.";
|
|
78
|
+
};
|
|
79
|
+
readonly namespace: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly enum: readonly ["personal", "team", "global"];
|
|
82
|
+
readonly description: "Filter results by namespace. Omit to search all namespaces.";
|
|
83
|
+
};
|
|
84
|
+
readonly cross_project: {
|
|
85
|
+
readonly type: "boolean";
|
|
86
|
+
readonly description: "Search across all project tags (ignores tag filter). Default: false.";
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
readonly additionalProperties: false;
|
|
90
|
+
};
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "forget";
|
|
93
|
+
readonly description: "Archive an entity (soft-delete) or remove a specific observation. Archived entities are hidden from recall but preserved in the database. To remove just one observation, pass the observation parameter.";
|
|
94
|
+
readonly inputSchema: {
|
|
95
|
+
readonly type: "object";
|
|
96
|
+
readonly properties: {
|
|
97
|
+
readonly name: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
readonly description: "Entity name to archive or modify";
|
|
100
|
+
};
|
|
101
|
+
readonly observation: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly description: "If provided, only this specific observation is removed (entity stays active). If omitted, the entire entity is archived.";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
readonly required: readonly ["name"];
|
|
107
|
+
readonly additionalProperties: false;
|
|
108
|
+
};
|
|
109
|
+
}, {
|
|
110
|
+
readonly name: "consolidate";
|
|
111
|
+
readonly description: "Compress verbose entity observations using an LLM into 2–3 dense sentences that preserve all key facts. Requires Smart Mode (run: memesh setup). Original observations are replaced by the LLM summary.";
|
|
112
|
+
readonly inputSchema: {
|
|
113
|
+
readonly type: "object";
|
|
114
|
+
readonly properties: {
|
|
115
|
+
readonly name: {
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
readonly description: "Specific entity name to consolidate";
|
|
118
|
+
};
|
|
119
|
+
readonly tag: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
readonly description: "Consolidate all entities with this tag";
|
|
122
|
+
};
|
|
123
|
+
readonly min_observations: {
|
|
124
|
+
readonly type: "number";
|
|
125
|
+
readonly description: "Minimum observations required to trigger consolidation (default: 5)";
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly additionalProperties: false;
|
|
129
|
+
};
|
|
130
|
+
}, {
|
|
131
|
+
readonly name: "export";
|
|
132
|
+
readonly description: "Export memories as JSON for sharing or backup. Returns a portable snapshot of entities and their observations, tags, and relations.";
|
|
133
|
+
readonly inputSchema: {
|
|
134
|
+
readonly type: "object";
|
|
135
|
+
readonly properties: {
|
|
136
|
+
readonly tag: {
|
|
137
|
+
readonly type: "string";
|
|
138
|
+
readonly description: "Export only entities with this tag";
|
|
139
|
+
};
|
|
140
|
+
readonly namespace: {
|
|
141
|
+
readonly type: "string";
|
|
142
|
+
readonly description: "Export only from this namespace (personal, team, global)";
|
|
143
|
+
};
|
|
144
|
+
readonly limit: {
|
|
145
|
+
readonly type: "number";
|
|
146
|
+
readonly description: "Max entities to export (default: 1000)";
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
readonly additionalProperties: false;
|
|
150
|
+
};
|
|
151
|
+
}, {
|
|
152
|
+
readonly name: "import";
|
|
153
|
+
readonly description: "Import memories from a JSON export snapshot. Supports skip, append, or overwrite strategies for handling existing entities.";
|
|
154
|
+
readonly inputSchema: {
|
|
155
|
+
readonly type: "object";
|
|
156
|
+
readonly properties: {
|
|
157
|
+
readonly data: {
|
|
158
|
+
readonly type: "object";
|
|
159
|
+
readonly description: "Export JSON data (from the export tool)";
|
|
160
|
+
};
|
|
161
|
+
readonly namespace: {
|
|
162
|
+
readonly type: "string";
|
|
163
|
+
readonly description: "Override namespace for all imported entities";
|
|
164
|
+
};
|
|
165
|
+
readonly merge_strategy: {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
readonly enum: readonly ["skip", "overwrite", "append"];
|
|
168
|
+
readonly description: "How to handle existing entities: skip (default) = leave untouched, append = add observations, overwrite = archive existing and recreate";
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
readonly required: readonly ["data", "merge_strategy"];
|
|
172
|
+
readonly additionalProperties: false;
|
|
173
|
+
};
|
|
174
|
+
}];
|
|
175
|
+
type ToolResult = {
|
|
176
|
+
content: Array<{
|
|
177
|
+
type: string;
|
|
178
|
+
text: string;
|
|
179
|
+
}>;
|
|
180
|
+
isError?: boolean;
|
|
181
|
+
};
|
|
182
|
+
export declare function handleTool(name: string, args: any): Promise<ToolResult>;
|
|
183
|
+
export {};
|
|
184
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/transports/mcp/handlers.ts"],"names":[],"mappings":"AA4EA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8JnB,CAAC;AAMX,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AA0BF,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CA2C7E"}
|