@openweave/weave-link 0.2.0 → 0.4.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/dist/auth.d.ts +59 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +130 -0
- package/dist/auth.js.map +1 -0
- package/dist/cli.d.ts +22 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +247 -0
- package/dist/cli.js.map +1 -0
- package/dist/http-transport.d.ts +65 -0
- package/dist/http-transport.d.ts.map +1 -0
- package/dist/http-transport.js +265 -0
- package/dist/http-transport.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/installer/claude-desktop.d.ts +49 -0
- package/dist/installer/claude-desktop.d.ts.map +1 -0
- package/dist/installer/claude-desktop.js +169 -0
- package/dist/installer/claude-desktop.js.map +1 -0
- package/dist/installer/config-generator.d.ts +47 -0
- package/dist/installer/config-generator.d.ts.map +1 -0
- package/dist/installer/config-generator.js +90 -0
- package/dist/installer/config-generator.js.map +1 -0
- package/dist/installer/cursor.d.ts +52 -0
- package/dist/installer/cursor.d.ts.map +1 -0
- package/dist/installer/cursor.js +165 -0
- package/dist/installer/cursor.js.map +1 -0
- package/dist/installer/index.d.ts +11 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +14 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/mcp-server.d.ts +75 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +364 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/tools.d.ts +42 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +230 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +86 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WeaveLinkServer = void 0;
|
|
4
|
+
const tools_1 = require("./tools");
|
|
5
|
+
/**
|
|
6
|
+
* WeaveLink MCP Server
|
|
7
|
+
* Implements Model Context Protocol for OpenWeave
|
|
8
|
+
*/
|
|
9
|
+
// ── Security helpers (VULN-002, VULN-004) ────────────────────────────────────
|
|
10
|
+
const SAFE_ID_RE = /^[\w\-]{1,128}$/;
|
|
11
|
+
const ALLOWED_NODE_TYPES = new Set([
|
|
12
|
+
'CONCEPT', 'DECISION', 'MILESTONE', 'ERROR', 'CORRECTION', 'CODE_ENTITY',
|
|
13
|
+
]);
|
|
14
|
+
function validateIdentifier(value, fieldName) {
|
|
15
|
+
if (typeof value !== 'string' || !SAFE_ID_RE.test(value)) {
|
|
16
|
+
return `${fieldName} must be 1–128 alphanumeric/hyphen/underscore characters`;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function validateSaveNodeArgs(args) {
|
|
21
|
+
const idErr = validateIdentifier(args.chat_id, 'chat_id') ??
|
|
22
|
+
validateIdentifier(args.node_id, 'node_id');
|
|
23
|
+
if (idErr)
|
|
24
|
+
return idErr;
|
|
25
|
+
if (typeof args.node_label !== 'string' || args.node_label.trim().length === 0) {
|
|
26
|
+
return 'node_label must be a non-empty string';
|
|
27
|
+
}
|
|
28
|
+
if (args.node_label.length > 1024) {
|
|
29
|
+
return 'node_label must not exceed 1024 characters';
|
|
30
|
+
}
|
|
31
|
+
if (!ALLOWED_NODE_TYPES.has(String(args.node_type))) {
|
|
32
|
+
return `node_type must be one of: ${[...ALLOWED_NODE_TYPES].join(', ')}`;
|
|
33
|
+
}
|
|
34
|
+
if (args.frequency !== undefined) {
|
|
35
|
+
const f = Number(args.frequency);
|
|
36
|
+
if (!Number.isFinite(f) || f < 1 || f > 10_000) {
|
|
37
|
+
return 'frequency must be a number between 1 and 10000';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (args.metadata !== null && args.metadata !== undefined) {
|
|
41
|
+
if (typeof args.metadata !== 'object' || Array.isArray(args.metadata)) {
|
|
42
|
+
return 'metadata must be a plain object';
|
|
43
|
+
}
|
|
44
|
+
const meta = args.metadata;
|
|
45
|
+
const keys = Object.keys(meta);
|
|
46
|
+
if (keys.length > 20)
|
|
47
|
+
return 'metadata must not have more than 20 keys';
|
|
48
|
+
for (const key of keys) {
|
|
49
|
+
if (key.startsWith('__'))
|
|
50
|
+
return `metadata key '${key}' is not allowed`;
|
|
51
|
+
if (typeof meta[key] !== 'string' && typeof meta[key] !== 'number' && typeof meta[key] !== 'boolean') {
|
|
52
|
+
return `metadata['${key}'] must be a string, number or boolean`;
|
|
53
|
+
}
|
|
54
|
+
if (typeof meta[key] === 'string' && meta[key].length > 512) {
|
|
55
|
+
return `metadata['${key}'] must not exceed 512 characters`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
class WeaveLinkServer {
|
|
62
|
+
config;
|
|
63
|
+
sessions = new Map();
|
|
64
|
+
constructor(config = {}) {
|
|
65
|
+
this.config = {
|
|
66
|
+
name: config.name || "WeaveLink",
|
|
67
|
+
version: config.version || "0.1.0",
|
|
68
|
+
description: config.description || "MCP server for OpenWeave knowledge graph and planning",
|
|
69
|
+
capabilities: config.capabilities || {
|
|
70
|
+
tools: {
|
|
71
|
+
listChanged: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Initialize server (setup, load state, etc.)
|
|
78
|
+
*/
|
|
79
|
+
async initialize() {
|
|
80
|
+
// Server initialization logic
|
|
81
|
+
console.log(`[${this.config.name}] Initializing MCP server v${this.config.version}`);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* List available tools
|
|
85
|
+
*/
|
|
86
|
+
listTools() {
|
|
87
|
+
return tools_1.ALL_TOOLS;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get tool by name
|
|
91
|
+
*/
|
|
92
|
+
getTool(name) {
|
|
93
|
+
return (0, tools_1.getTool)(name);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Handle tool call
|
|
97
|
+
*/
|
|
98
|
+
async callTool(toolName, args) {
|
|
99
|
+
// VULN-001: log only a safe summary — never raw args (may contain PII or secrets)
|
|
100
|
+
console.log(`[${this.config.name}] Executing tool: ${toolName} | chat_id: ${String(args.chat_id ?? '—')}`);
|
|
101
|
+
// Route to appropriate handler
|
|
102
|
+
switch (toolName) {
|
|
103
|
+
case "save_node":
|
|
104
|
+
return this.handleSaveNode(args);
|
|
105
|
+
case "query_graph":
|
|
106
|
+
return this.handleQueryGraph(args);
|
|
107
|
+
case "suppress_error":
|
|
108
|
+
return this.handleSuppressError(args);
|
|
109
|
+
case "update_roadmap":
|
|
110
|
+
return this.handleUpdateRoadmap(args);
|
|
111
|
+
case "get_session_context":
|
|
112
|
+
return this.handleGetSessionContext(args);
|
|
113
|
+
case "get_next_action":
|
|
114
|
+
return this.handleGetNextAction(args);
|
|
115
|
+
case "list_orphans":
|
|
116
|
+
return this.handleListOrphans(args);
|
|
117
|
+
default:
|
|
118
|
+
return this.error(`Unknown tool: ${toolName}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Handler: save_node
|
|
123
|
+
*/
|
|
124
|
+
async handleSaveNode(args) {
|
|
125
|
+
try {
|
|
126
|
+
// VULN-002: runtime validation before any type cast or storage
|
|
127
|
+
const validationError = validateSaveNodeArgs(args);
|
|
128
|
+
if (validationError) {
|
|
129
|
+
return this.error(`Validation error: ${validationError}`);
|
|
130
|
+
}
|
|
131
|
+
const { chat_id, node_id, node_label, node_type, metadata, frequency } = args;
|
|
132
|
+
// In a real implementation, this would save to the graph
|
|
133
|
+
// For now, store in session cache
|
|
134
|
+
const session = this.getOrCreateSession(chat_id);
|
|
135
|
+
session.lastNode = {
|
|
136
|
+
id: node_id,
|
|
137
|
+
label: node_label,
|
|
138
|
+
type: node_type,
|
|
139
|
+
metadata,
|
|
140
|
+
frequency: frequency || 1,
|
|
141
|
+
};
|
|
142
|
+
return this.success({
|
|
143
|
+
message: "Node saved successfully",
|
|
144
|
+
node_id,
|
|
145
|
+
chat_id,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
return this.error(`Failed to save node: ${error.message}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Handler: query_graph
|
|
154
|
+
*/
|
|
155
|
+
async handleQueryGraph(args) {
|
|
156
|
+
try {
|
|
157
|
+
const { chat_id, query, limit = 10 } = args;
|
|
158
|
+
if (!chat_id || !query) {
|
|
159
|
+
return this.error("Missing required fields: chat_id, query");
|
|
160
|
+
}
|
|
161
|
+
// Mock results for demonstration
|
|
162
|
+
const results = [
|
|
163
|
+
{
|
|
164
|
+
node_id: "concept-1",
|
|
165
|
+
label: query,
|
|
166
|
+
type: "CONCEPT",
|
|
167
|
+
frequency: 10,
|
|
168
|
+
score: 0.95,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
node_id: "decision-1",
|
|
172
|
+
label: `Decide on ${query}`,
|
|
173
|
+
type: "DECISION",
|
|
174
|
+
frequency: 5,
|
|
175
|
+
score: 0.78,
|
|
176
|
+
},
|
|
177
|
+
].slice(0, limit);
|
|
178
|
+
return this.success({
|
|
179
|
+
query,
|
|
180
|
+
results,
|
|
181
|
+
total: results.length,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
return this.error(`Query failed: ${error.message}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Handler: suppress_error
|
|
190
|
+
*/
|
|
191
|
+
async handleSuppressError(args) {
|
|
192
|
+
try {
|
|
193
|
+
const { chat_id, node_id, error_label, description } = args;
|
|
194
|
+
if (!chat_id || !node_id || !error_label || !description) {
|
|
195
|
+
return this.error("Missing required fields: chat_id, node_id, error_label, description");
|
|
196
|
+
}
|
|
197
|
+
return this.success({
|
|
198
|
+
message: "Error suppressed and correction created",
|
|
199
|
+
error_node_id: node_id,
|
|
200
|
+
correction_node_id: `correction-${Date.now()}`,
|
|
201
|
+
error_label,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
return this.error(`Error suppression failed: ${error.message}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Handler: update_roadmap
|
|
210
|
+
*/
|
|
211
|
+
async handleUpdateRoadmap(args) {
|
|
212
|
+
try {
|
|
213
|
+
const { chat_id, milestone_id, status, actual_hours } = args;
|
|
214
|
+
if (!chat_id || !milestone_id || !status) {
|
|
215
|
+
return this.error("Missing required fields: chat_id, milestone_id, status");
|
|
216
|
+
}
|
|
217
|
+
return this.success({
|
|
218
|
+
message: "Milestone updated",
|
|
219
|
+
milestone_id,
|
|
220
|
+
status,
|
|
221
|
+
actual_hours: actual_hours || 0,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
return this.error(`Roadmap update failed: ${error.message}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Handler: get_session_context
|
|
230
|
+
*/
|
|
231
|
+
async handleGetSessionContext(args) {
|
|
232
|
+
try {
|
|
233
|
+
const { chat_id } = args;
|
|
234
|
+
if (!chat_id) {
|
|
235
|
+
return this.error("Missing required field: chat_id");
|
|
236
|
+
}
|
|
237
|
+
// Mock context for demonstration
|
|
238
|
+
const context = {
|
|
239
|
+
total_nodes: 5,
|
|
240
|
+
total_edges: 8,
|
|
241
|
+
context_size_bytes: 2048,
|
|
242
|
+
context_usage_percent: 42,
|
|
243
|
+
nodes: [
|
|
244
|
+
{
|
|
245
|
+
node_id: "concept-1",
|
|
246
|
+
label: "Project Goal",
|
|
247
|
+
type: "CONCEPT",
|
|
248
|
+
frequency: 15,
|
|
249
|
+
score: 1.0,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
};
|
|
253
|
+
return this.success(context);
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
return this.error(`Context retrieval failed: ${error.message}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Handler: get_next_action
|
|
261
|
+
*/
|
|
262
|
+
async handleGetNextAction(args) {
|
|
263
|
+
try {
|
|
264
|
+
const { chat_id } = args;
|
|
265
|
+
if (!chat_id) {
|
|
266
|
+
return this.error("Missing required field: chat_id");
|
|
267
|
+
}
|
|
268
|
+
return this.success({
|
|
269
|
+
sub_task_id: "M1-1",
|
|
270
|
+
milestone_id: "M1",
|
|
271
|
+
title: "Implement core data model",
|
|
272
|
+
description: "Design and implement basic node/edge structures",
|
|
273
|
+
estimated_hours: 5,
|
|
274
|
+
priority: "CRITICAL",
|
|
275
|
+
reason: "First task in the sequence",
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
return this.error(`Failed to get next action: ${error.message}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Handler: list_orphans
|
|
284
|
+
*/
|
|
285
|
+
async handleListOrphans(args) {
|
|
286
|
+
try {
|
|
287
|
+
const { project_path, min_severity = "MEDIUM" } = args;
|
|
288
|
+
if (!project_path) {
|
|
289
|
+
return this.error("Missing required field: project_path");
|
|
290
|
+
}
|
|
291
|
+
// Mock orphan detection results
|
|
292
|
+
return this.success({
|
|
293
|
+
project_path,
|
|
294
|
+
min_severity,
|
|
295
|
+
orphans_found: 3,
|
|
296
|
+
orphans: [
|
|
297
|
+
{
|
|
298
|
+
id: "unused-function-1",
|
|
299
|
+
name: "oldHelper",
|
|
300
|
+
type: "FUNCTION",
|
|
301
|
+
severity: "HIGH",
|
|
302
|
+
file: "src/utils.ts",
|
|
303
|
+
line: 42,
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
return this.error(`Orphan detection failed: ${error.message}`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Helper: get or create session
|
|
314
|
+
*/
|
|
315
|
+
getOrCreateSession(chatId) {
|
|
316
|
+
if (!this.sessions.has(chatId)) {
|
|
317
|
+
this.sessions.set(chatId, {
|
|
318
|
+
created_at: new Date(),
|
|
319
|
+
nodes: [],
|
|
320
|
+
edges: [],
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
return this.sessions.get(chatId);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Helper: success response
|
|
327
|
+
*/
|
|
328
|
+
success(data) {
|
|
329
|
+
return {
|
|
330
|
+
content: [
|
|
331
|
+
{
|
|
332
|
+
type: "text",
|
|
333
|
+
data,
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Helper: error response
|
|
340
|
+
*/
|
|
341
|
+
error(message) {
|
|
342
|
+
return {
|
|
343
|
+
content: [
|
|
344
|
+
{
|
|
345
|
+
type: "text",
|
|
346
|
+
text: `Error: ${message}`,
|
|
347
|
+
},
|
|
348
|
+
],
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Get server info
|
|
353
|
+
*/
|
|
354
|
+
getServerInfo() {
|
|
355
|
+
return {
|
|
356
|
+
name: this.config.name,
|
|
357
|
+
version: this.config.version,
|
|
358
|
+
description: this.config.description,
|
|
359
|
+
tools: tools_1.ALL_TOOLS.map((t) => ({ name: t.name, description: t.description })),
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
exports.WeaveLinkServer = W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AC,OAAe;QAC3B,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,UAAU,OAAO,EAAE;iBAC1B;aACF;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACtB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;YACpC,KAAK,EAAE,iBAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;SAC5E,CAAC;IACJ,CAAC;CACF;AA/UD,0CA+UC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MCPTool } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Tool Definitions for WeaveLink MCP Server
|
|
4
|
+
* Defines the interface for all available tools
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* save_node: Add or update a node in the knowledge graph
|
|
8
|
+
*/
|
|
9
|
+
export declare const TOOL_SAVE_NODE: MCPTool;
|
|
10
|
+
/**
|
|
11
|
+
* query_graph: Search the knowledge graph by keyword
|
|
12
|
+
*/
|
|
13
|
+
export declare const TOOL_QUERY_GRAPH: MCPTool;
|
|
14
|
+
/**
|
|
15
|
+
* suppress_error: Mark an error node and create a correction
|
|
16
|
+
*/
|
|
17
|
+
export declare const TOOL_SUPPRESS_ERROR: MCPTool;
|
|
18
|
+
/**
|
|
19
|
+
* update_roadmap: Update milestone status and hours
|
|
20
|
+
*/
|
|
21
|
+
export declare const TOOL_UPDATE_ROADMAP: MCPTool;
|
|
22
|
+
/**
|
|
23
|
+
* get_session_context: Retrieve full session context
|
|
24
|
+
*/
|
|
25
|
+
export declare const TOOL_GET_SESSION_CONTEXT: MCPTool;
|
|
26
|
+
/**
|
|
27
|
+
* get_next_action: Get the next recommended sub-task
|
|
28
|
+
*/
|
|
29
|
+
export declare const TOOL_GET_NEXT_ACTION: MCPTool;
|
|
30
|
+
/**
|
|
31
|
+
* list_orphans: Find unused code entities in a project
|
|
32
|
+
*/
|
|
33
|
+
export declare const TOOL_LIST_ORPHANS: MCPTool;
|
|
34
|
+
/**
|
|
35
|
+
* All available tools
|
|
36
|
+
*/
|
|
37
|
+
export declare const ALL_TOOLS: MCPTool[];
|
|
38
|
+
/**
|
|
39
|
+
* Get tool by name
|
|
40
|
+
*/
|
|
41
|
+
export declare function getTool(name: string): MCPTool | undefined;
|
|
42
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OA0C5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAwB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,OA8BjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,OA2BjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,OAsBtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAclC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAuB/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,EAQ9B,CAAC;AAEF;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAEzD"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ALL_TOOLS = exports.TOOL_LIST_ORPHANS = exports.TOOL_GET_NEXT_ACTION = exports.TOOL_GET_SESSION_CONTEXT = exports.TOOL_UPDATE_ROADMAP = exports.TOOL_SUPPRESS_ERROR = exports.TOOL_QUERY_GRAPH = exports.TOOL_SAVE_NODE = void 0;
|
|
4
|
+
exports.getTool = getTool;
|
|
5
|
+
/**
|
|
6
|
+
* Tool Definitions for WeaveLink MCP Server
|
|
7
|
+
* Defines the interface for all available tools
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* save_node: Add or update a node in the knowledge graph
|
|
11
|
+
*/
|
|
12
|
+
exports.TOOL_SAVE_NODE = {
|
|
13
|
+
name: "save_node",
|
|
14
|
+
description: "Add or update a node in the WeaveGraph knowledge base. Nodes represent concepts, decisions, milestones, or errors.",
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
chat_id: {
|
|
19
|
+
type: "string",
|
|
20
|
+
pattern: "^[\\w\\-]{1,128}$",
|
|
21
|
+
description: "Session identifier (alphanumeric + hyphens/underscores, max 128 chars)",
|
|
22
|
+
},
|
|
23
|
+
node_id: {
|
|
24
|
+
type: "string",
|
|
25
|
+
pattern: "^[\\w\\-]{1,128}$",
|
|
26
|
+
description: "Unique identifier for the node within this session (alphanumeric + hyphens/underscores, max 128 chars)",
|
|
27
|
+
},
|
|
28
|
+
node_label: {
|
|
29
|
+
type: "string",
|
|
30
|
+
maxLength: 1024,
|
|
31
|
+
description: "Human-readable label for the node",
|
|
32
|
+
},
|
|
33
|
+
node_type: {
|
|
34
|
+
type: "string",
|
|
35
|
+
enum: ["CONCEPT", "DECISION", "MILESTONE", "ERROR", "CORRECTION", "CODE_ENTITY"],
|
|
36
|
+
description: "Type of knowledge stored in this node",
|
|
37
|
+
},
|
|
38
|
+
metadata: {
|
|
39
|
+
type: "object",
|
|
40
|
+
additionalProperties: { type: "string", maxLength: 512 },
|
|
41
|
+
maxProperties: 20,
|
|
42
|
+
description: "Optional key/value string pairs (max 20 keys, 512 chars per value)",
|
|
43
|
+
},
|
|
44
|
+
frequency: {
|
|
45
|
+
type: "number",
|
|
46
|
+
minimum: 1,
|
|
47
|
+
maximum: 10000,
|
|
48
|
+
description: "Access frequency hint (1-10000) for context compression prioritization",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
required: ["chat_id", "node_id", "node_label", "node_type"],
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* query_graph: Search the knowledge graph by keyword
|
|
56
|
+
*/
|
|
57
|
+
exports.TOOL_QUERY_GRAPH = {
|
|
58
|
+
name: "query_graph",
|
|
59
|
+
description: "Search the WeaveGraph for nodes matching a keyword or topic. Returns ranked results by relevance.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
chat_id: {
|
|
64
|
+
type: "string",
|
|
65
|
+
pattern: "^[\\w\\-]{1,128}$",
|
|
66
|
+
description: "Session identifier",
|
|
67
|
+
},
|
|
68
|
+
query: {
|
|
69
|
+
type: "string",
|
|
70
|
+
maxLength: 512,
|
|
71
|
+
description: "Search query (supports keywords, labels, or partial matches)",
|
|
72
|
+
},
|
|
73
|
+
limit: {
|
|
74
|
+
type: "number",
|
|
75
|
+
description: "Maximum number of results to return (default: 10)",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: ["chat_id", "query"],
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* suppress_error: Mark an error node and create a correction
|
|
83
|
+
*/
|
|
84
|
+
exports.TOOL_SUPPRESS_ERROR = {
|
|
85
|
+
name: "suppress_error",
|
|
86
|
+
description: "Flag an ERROR node as suppressed and link it to a CORRECTION node. Helps the agent learn from mistakes.",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
chat_id: {
|
|
91
|
+
type: "string",
|
|
92
|
+
pattern: "^[\\w\\-]{1,128}$",
|
|
93
|
+
description: "Session identifier",
|
|
94
|
+
},
|
|
95
|
+
node_id: {
|
|
96
|
+
type: "string",
|
|
97
|
+
pattern: "^[\\w\\-]{1,128}$",
|
|
98
|
+
description: "ID of the ERROR node to suppress",
|
|
99
|
+
},
|
|
100
|
+
error_label: {
|
|
101
|
+
type: "string",
|
|
102
|
+
maxLength: 512,
|
|
103
|
+
description: "Short label for the error",
|
|
104
|
+
},
|
|
105
|
+
description: {
|
|
106
|
+
type: "string",
|
|
107
|
+
maxLength: 2048,
|
|
108
|
+
description: "Description of the correction applied",
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
required: ["chat_id", "node_id", "error_label", "description"],
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* update_roadmap: Update milestone status and hours
|
|
116
|
+
*/
|
|
117
|
+
exports.TOOL_UPDATE_ROADMAP = {
|
|
118
|
+
name: "update_roadmap",
|
|
119
|
+
description: "Update the status of a milestone in the current roadmap. Tracks progress and actual hours spent.",
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: "object",
|
|
122
|
+
properties: {
|
|
123
|
+
chat_id: {
|
|
124
|
+
type: "string",
|
|
125
|
+
description: "Session identifier",
|
|
126
|
+
},
|
|
127
|
+
milestone_id: {
|
|
128
|
+
type: "string",
|
|
129
|
+
description: "Milestone identifier (e.g., 'M1', 'M2')",
|
|
130
|
+
},
|
|
131
|
+
status: {
|
|
132
|
+
type: "string",
|
|
133
|
+
enum: ["NOT_STARTED", "IN_PROGRESS", "COMPLETED", "BLOCKED", "DEFERRED"],
|
|
134
|
+
description: "New status for the milestone",
|
|
135
|
+
},
|
|
136
|
+
actual_hours: {
|
|
137
|
+
type: "number",
|
|
138
|
+
description: "Optional: hours actually spent on this milestone",
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: ["chat_id", "milestone_id", "status"],
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* get_session_context: Retrieve full session context
|
|
146
|
+
*/
|
|
147
|
+
exports.TOOL_GET_SESSION_CONTEXT = {
|
|
148
|
+
name: "get_session_context",
|
|
149
|
+
description: "Retrieve the full knowledge graph context for a session, including all nodes, edges, and current milestones.",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
chat_id: {
|
|
154
|
+
type: "string",
|
|
155
|
+
description: "Session identifier",
|
|
156
|
+
},
|
|
157
|
+
max_depth: {
|
|
158
|
+
type: "number",
|
|
159
|
+
description: "Maximum graph traversal depth (default: 2)",
|
|
160
|
+
},
|
|
161
|
+
include_archived: {
|
|
162
|
+
type: "boolean",
|
|
163
|
+
description: "Include archived/compressed nodes (default: false)",
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
required: ["chat_id"],
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* get_next_action: Get the next recommended sub-task
|
|
171
|
+
*/
|
|
172
|
+
exports.TOOL_GET_NEXT_ACTION = {
|
|
173
|
+
name: "get_next_action",
|
|
174
|
+
description: "Get the next recommended actionable sub-task based on the current roadmap and dependencies.",
|
|
175
|
+
inputSchema: {
|
|
176
|
+
type: "object",
|
|
177
|
+
properties: {
|
|
178
|
+
chat_id: {
|
|
179
|
+
type: "string",
|
|
180
|
+
description: "Session identifier",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
required: ["chat_id"],
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* list_orphans: Find unused code entities in a project
|
|
188
|
+
*/
|
|
189
|
+
exports.TOOL_LIST_ORPHANS = {
|
|
190
|
+
name: "list_orphans",
|
|
191
|
+
description: "Run orphan detection on a codebase and return list of unused functions, classes, and modules.",
|
|
192
|
+
inputSchema: {
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {
|
|
195
|
+
project_path: {
|
|
196
|
+
type: "string",
|
|
197
|
+
description: "Path to project root to analyze",
|
|
198
|
+
},
|
|
199
|
+
min_severity: {
|
|
200
|
+
type: "string",
|
|
201
|
+
enum: ["CRITICAL", "HIGH", "MEDIUM", "LOW"],
|
|
202
|
+
description: "Minimum severity level to report (default: MEDIUM)",
|
|
203
|
+
},
|
|
204
|
+
include_tests: {
|
|
205
|
+
type: "boolean",
|
|
206
|
+
description: "Include test files in analysis (default: false)",
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
required: ["project_path"],
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* All available tools
|
|
214
|
+
*/
|
|
215
|
+
exports.ALL_TOOLS = [
|
|
216
|
+
exports.TOOL_SAVE_NODE,
|
|
217
|
+
exports.TOOL_QUERY_GRAPH,
|
|
218
|
+
exports.TOOL_SUPPRESS_ERROR,
|
|
219
|
+
exports.TOOL_UPDATE_ROADMAP,
|
|
220
|
+
exports.TOOL_GET_SESSION_CONTEXT,
|
|
221
|
+
exports.TOOL_GET_NEXT_ACTION,
|
|
222
|
+
exports.TOOL_LIST_ORPHANS,
|
|
223
|
+
];
|
|
224
|
+
/**
|
|
225
|
+
* Get tool by name
|
|
226
|
+
*/
|
|
227
|
+
function getTool(name) {
|
|
228
|
+
return exports.ALL_TOOLS.find((tool) => tool.name === name);
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":";;;AAgPA,0BAEC;AAhPD;;;GAGG;AAEH;;GAEG;AACU,QAAA,cAAc,GAAY;IACrC,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,oHAAoH;IACtH,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UA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