@devflow-tools/mcp-server 0.16.34 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/command-registry.json +128 -24
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +90 -6
- package/dist/server.js.map +1 -1
- package/dist/tool-contracts.d.ts +3 -0
- package/dist/tool-contracts.d.ts.map +1 -1
- package/dist/tool-contracts.js +38 -6
- package/dist/tool-contracts.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +360 -36
- package/dist/tools.js.map +1 -1
- package/package.json +8 -8
|
@@ -19,10 +19,16 @@
|
|
|
19
19
|
"WebFetch"
|
|
20
20
|
],
|
|
21
21
|
"source": "core",
|
|
22
|
-
"sourceVersion": "0.
|
|
22
|
+
"sourceVersion": "0.17.1",
|
|
23
23
|
"requiresContext": true,
|
|
24
24
|
"evidenceMode": "mixed",
|
|
25
|
-
"skillPath": "skills/devflow:context/SKILL.md"
|
|
25
|
+
"skillPath": "skills/devflow:context/SKILL.md",
|
|
26
|
+
"hostTools": {
|
|
27
|
+
"claude-code": [
|
|
28
|
+
"mcp__devflow__get_project_context",
|
|
29
|
+
"mcp__devflow__search_symbol"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
26
32
|
},
|
|
27
33
|
"devflow:graph": {
|
|
28
34
|
"mcpTools": [
|
|
@@ -38,10 +44,15 @@
|
|
|
38
44
|
"Explore"
|
|
39
45
|
],
|
|
40
46
|
"source": "core",
|
|
41
|
-
"sourceVersion": "0.
|
|
47
|
+
"sourceVersion": "0.17.1",
|
|
42
48
|
"requiresContext": true,
|
|
43
49
|
"evidenceMode": "mixed",
|
|
44
|
-
"skillPath": "skills/devflow:graph/SKILL.md"
|
|
50
|
+
"skillPath": "skills/devflow:graph/SKILL.md",
|
|
51
|
+
"hostTools": {
|
|
52
|
+
"claude-code": [
|
|
53
|
+
"mcp__devflow__get_dependency_graph"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
45
56
|
},
|
|
46
57
|
"devflow:knowledge": {
|
|
47
58
|
"mcpTools": [
|
|
@@ -52,10 +63,15 @@
|
|
|
52
63
|
"WebFetch"
|
|
53
64
|
],
|
|
54
65
|
"source": "core",
|
|
55
|
-
"sourceVersion": "0.
|
|
66
|
+
"sourceVersion": "0.17.1",
|
|
56
67
|
"requiresContext": true,
|
|
57
68
|
"evidenceMode": "mixed",
|
|
58
|
-
"skillPath": "skills/devflow:knowledge/SKILL.md"
|
|
69
|
+
"skillPath": "skills/devflow:knowledge/SKILL.md",
|
|
70
|
+
"hostTools": {
|
|
71
|
+
"claude-code": [
|
|
72
|
+
"mcp__devflow__get_knowledge"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
59
75
|
},
|
|
60
76
|
"devflow:memory": {
|
|
61
77
|
"mcpTools": [
|
|
@@ -71,10 +87,15 @@
|
|
|
71
87
|
"Explore"
|
|
72
88
|
],
|
|
73
89
|
"source": "core",
|
|
74
|
-
"sourceVersion": "0.
|
|
90
|
+
"sourceVersion": "0.17.1",
|
|
75
91
|
"requiresContext": true,
|
|
76
92
|
"evidenceMode": "mixed",
|
|
77
|
-
"skillPath": "skills/devflow:memory/SKILL.md"
|
|
93
|
+
"skillPath": "skills/devflow:memory/SKILL.md",
|
|
94
|
+
"hostTools": {
|
|
95
|
+
"claude-code": [
|
|
96
|
+
"mcp__devflow__get_memory"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
78
99
|
},
|
|
79
100
|
"devflow:workflow": {
|
|
80
101
|
"mcpTools": [
|
|
@@ -82,10 +103,15 @@
|
|
|
82
103
|
],
|
|
83
104
|
"blockedNative": [],
|
|
84
105
|
"source": "core",
|
|
85
|
-
"sourceVersion": "0.
|
|
106
|
+
"sourceVersion": "0.17.1",
|
|
86
107
|
"requiresContext": true,
|
|
87
108
|
"evidenceMode": "mixed",
|
|
88
|
-
"skillPath": "skills/devflow:workflow/SKILL.md"
|
|
109
|
+
"skillPath": "skills/devflow:workflow/SKILL.md",
|
|
110
|
+
"hostTools": {
|
|
111
|
+
"claude-code": [
|
|
112
|
+
"mcp__devflow__run_workflow"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
89
115
|
},
|
|
90
116
|
"devflow:animation": {
|
|
91
117
|
"mcpTools": [
|
|
@@ -106,7 +132,12 @@
|
|
|
106
132
|
"sourceVersion": "0.1.0",
|
|
107
133
|
"requiresContext": true,
|
|
108
134
|
"evidenceMode": "mixed",
|
|
109
|
-
"skillPath": "skills/devflow:animation/SKILL.md"
|
|
135
|
+
"skillPath": "skills/devflow:animation/SKILL.md",
|
|
136
|
+
"hostTools": {
|
|
137
|
+
"claude-code": [
|
|
138
|
+
"mcp__devflow__animation_suggest"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
110
141
|
},
|
|
111
142
|
"devflow:css": {
|
|
112
143
|
"mcpTools": [
|
|
@@ -127,7 +158,12 @@
|
|
|
127
158
|
"sourceVersion": "0.1.0",
|
|
128
159
|
"requiresContext": true,
|
|
129
160
|
"evidenceMode": "mixed",
|
|
130
|
-
"skillPath": "skills/devflow:css/SKILL.md"
|
|
161
|
+
"skillPath": "skills/devflow:css/SKILL.md",
|
|
162
|
+
"hostTools": {
|
|
163
|
+
"claude-code": [
|
|
164
|
+
"mcp__devflow__css_audit_selectors"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
131
167
|
},
|
|
132
168
|
"devflow:docker": {
|
|
133
169
|
"mcpTools": [
|
|
@@ -148,7 +184,12 @@
|
|
|
148
184
|
"sourceVersion": "0.1.0",
|
|
149
185
|
"requiresContext": true,
|
|
150
186
|
"evidenceMode": "mixed",
|
|
151
|
-
"skillPath": "skills/devflow:docker/SKILL.md"
|
|
187
|
+
"skillPath": "skills/devflow:docker/SKILL.md",
|
|
188
|
+
"hostTools": {
|
|
189
|
+
"claude-code": [
|
|
190
|
+
"mcp__devflow__docker_dockerize_project"
|
|
191
|
+
]
|
|
192
|
+
}
|
|
152
193
|
},
|
|
153
194
|
"devflow:electron": {
|
|
154
195
|
"mcpTools": [
|
|
@@ -172,7 +213,12 @@
|
|
|
172
213
|
"skillPath": "skills/devflow:electron/SKILL.md",
|
|
173
214
|
"runtimePackages": [
|
|
174
215
|
"electron"
|
|
175
|
-
]
|
|
216
|
+
],
|
|
217
|
+
"hostTools": {
|
|
218
|
+
"claude-code": [
|
|
219
|
+
"mcp__devflow__electron_diagnose_bug"
|
|
220
|
+
]
|
|
221
|
+
}
|
|
176
222
|
},
|
|
177
223
|
"devflow:git": {
|
|
178
224
|
"mcpTools": [
|
|
@@ -193,7 +239,12 @@
|
|
|
193
239
|
"sourceVersion": "0.1.0",
|
|
194
240
|
"requiresContext": true,
|
|
195
241
|
"evidenceMode": "mixed",
|
|
196
|
-
"skillPath": "skills/devflow:git/SKILL.md"
|
|
242
|
+
"skillPath": "skills/devflow:git/SKILL.md",
|
|
243
|
+
"hostTools": {
|
|
244
|
+
"claude-code": [
|
|
245
|
+
"mcp__devflow__git_analyze_repo"
|
|
246
|
+
]
|
|
247
|
+
}
|
|
197
248
|
},
|
|
198
249
|
"devflow:graphql": {
|
|
199
250
|
"mcpTools": [
|
|
@@ -217,7 +268,12 @@
|
|
|
217
268
|
"skillPath": "skills/devflow:graphql/SKILL.md",
|
|
218
269
|
"runtimePackages": [
|
|
219
270
|
"graphql"
|
|
220
|
-
]
|
|
271
|
+
],
|
|
272
|
+
"hostTools": {
|
|
273
|
+
"claude-code": [
|
|
274
|
+
"mcp__devflow__graphql_diagnose_bug"
|
|
275
|
+
]
|
|
276
|
+
}
|
|
221
277
|
},
|
|
222
278
|
"devflow:nest": {
|
|
223
279
|
"mcpTools": [
|
|
@@ -242,7 +298,13 @@
|
|
|
242
298
|
"skillPath": "skills/devflow:nest/SKILL.md",
|
|
243
299
|
"runtimePackages": [
|
|
244
300
|
"@nestjs/core"
|
|
245
|
-
]
|
|
301
|
+
],
|
|
302
|
+
"hostTools": {
|
|
303
|
+
"claude-code": [
|
|
304
|
+
"mcp__devflow__nest_diagnose_bug",
|
|
305
|
+
"mcp__devflow__nest_new_module"
|
|
306
|
+
]
|
|
307
|
+
}
|
|
246
308
|
},
|
|
247
309
|
"devflow:nextjs": {
|
|
248
310
|
"mcpTools": [
|
|
@@ -268,7 +330,13 @@
|
|
|
268
330
|
"runtimePackages": [
|
|
269
331
|
"next",
|
|
270
332
|
"react"
|
|
271
|
-
]
|
|
333
|
+
],
|
|
334
|
+
"hostTools": {
|
|
335
|
+
"claude-code": [
|
|
336
|
+
"mcp__devflow__nextjs_diagnose_bug",
|
|
337
|
+
"mcp__devflow__nextjs_new_page"
|
|
338
|
+
]
|
|
339
|
+
}
|
|
272
340
|
},
|
|
273
341
|
"devflow:performance": {
|
|
274
342
|
"mcpTools": [
|
|
@@ -289,7 +357,12 @@
|
|
|
289
357
|
"sourceVersion": "0.1.0",
|
|
290
358
|
"requiresContext": true,
|
|
291
359
|
"evidenceMode": "mixed",
|
|
292
|
-
"skillPath": "skills/devflow:performance/SKILL.md"
|
|
360
|
+
"skillPath": "skills/devflow:performance/SKILL.md",
|
|
361
|
+
"hostTools": {
|
|
362
|
+
"claude-code": [
|
|
363
|
+
"mcp__devflow__performance_audit_performance"
|
|
364
|
+
]
|
|
365
|
+
}
|
|
293
366
|
},
|
|
294
367
|
"devflow:react": {
|
|
295
368
|
"mcpTools": [
|
|
@@ -318,7 +391,16 @@
|
|
|
318
391
|
"runtimePackages": [
|
|
319
392
|
"react",
|
|
320
393
|
"react-dom"
|
|
321
|
-
]
|
|
394
|
+
],
|
|
395
|
+
"hostTools": {
|
|
396
|
+
"claude-code": [
|
|
397
|
+
"mcp__devflow__react_review_hooks",
|
|
398
|
+
"mcp__devflow__react_audit_performance",
|
|
399
|
+
"mcp__devflow__react_refactor_component",
|
|
400
|
+
"mcp__devflow__react_diagnose_bug",
|
|
401
|
+
"mcp__devflow__react_new_component"
|
|
402
|
+
]
|
|
403
|
+
}
|
|
322
404
|
},
|
|
323
405
|
"devflow:tailwind": {
|
|
324
406
|
"mcpTools": [
|
|
@@ -343,7 +425,13 @@
|
|
|
343
425
|
"skillPath": "skills/devflow:tailwind/SKILL.md",
|
|
344
426
|
"runtimePackages": [
|
|
345
427
|
"tailwindcss"
|
|
346
|
-
]
|
|
428
|
+
],
|
|
429
|
+
"hostTools": {
|
|
430
|
+
"claude-code": [
|
|
431
|
+
"mcp__devflow__tailwind_new_component",
|
|
432
|
+
"mcp__devflow__tailwind_optimize_classes"
|
|
433
|
+
]
|
|
434
|
+
}
|
|
347
435
|
},
|
|
348
436
|
"devflow:taro": {
|
|
349
437
|
"mcpTools": [
|
|
@@ -367,7 +455,12 @@
|
|
|
367
455
|
"skillPath": "skills/devflow:taro/SKILL.md",
|
|
368
456
|
"runtimePackages": [
|
|
369
457
|
"@tarojs/taro"
|
|
370
|
-
]
|
|
458
|
+
],
|
|
459
|
+
"hostTools": {
|
|
460
|
+
"claude-code": [
|
|
461
|
+
"mcp__devflow__taro_new_page"
|
|
462
|
+
]
|
|
463
|
+
}
|
|
371
464
|
},
|
|
372
465
|
"devflow:ui-layout": {
|
|
373
466
|
"mcpTools": [
|
|
@@ -388,7 +481,12 @@
|
|
|
388
481
|
"sourceVersion": "0.1.0",
|
|
389
482
|
"requiresContext": true,
|
|
390
483
|
"evidenceMode": "mixed",
|
|
391
|
-
"skillPath": "skills/devflow:ui-layout/SKILL.md"
|
|
484
|
+
"skillPath": "skills/devflow:ui-layout/SKILL.md",
|
|
485
|
+
"hostTools": {
|
|
486
|
+
"claude-code": [
|
|
487
|
+
"mcp__devflow__ui_layout_generate"
|
|
488
|
+
]
|
|
489
|
+
}
|
|
392
490
|
},
|
|
393
491
|
"devflow:vue": {
|
|
394
492
|
"mcpTools": [
|
|
@@ -413,7 +511,13 @@
|
|
|
413
511
|
"skillPath": "skills/devflow:vue/SKILL.md",
|
|
414
512
|
"runtimePackages": [
|
|
415
513
|
"vue"
|
|
416
|
-
]
|
|
514
|
+
],
|
|
515
|
+
"hostTools": {
|
|
516
|
+
"claude-code": [
|
|
517
|
+
"mcp__devflow__vue_diagnose_bug",
|
|
518
|
+
"mcp__devflow__vue_debug_reactivity"
|
|
519
|
+
]
|
|
520
|
+
}
|
|
417
521
|
}
|
|
418
522
|
}
|
|
419
523
|
}
|
package/dist/server.d.ts
CHANGED
|
@@ -48,6 +48,9 @@ interface RuntimeIdentity {
|
|
|
48
48
|
executionId: string;
|
|
49
49
|
toolUseId?: string;
|
|
50
50
|
eventId: string;
|
|
51
|
+
turnId?: string;
|
|
52
|
+
requestId?: string;
|
|
53
|
+
intentArtifactHash?: string;
|
|
51
54
|
}
|
|
52
55
|
export declare const KNOWN_PREFIXES: Set<string>;
|
|
53
56
|
export declare function getCommandFromTool(toolName: string): string;
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASxD,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAInB,MAAM,YAAY,CAAC;AAmBpB,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASxD,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAInB,MAAM,YAAY,CAAC;AAmBpB,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGhF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAA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ionToolProfile } from "./tool-profile.js";
|
|
18
18
|
import { isProtocolResourceUri } from "./protocol-resource.js";
|
|
19
19
|
import { McpSamplingAdapter } from './sampling-grader.js';
|
|
20
|
+
import { emitSemanticControlLog } from '@devflow-tools/telemetry';
|
|
20
21
|
export class EngineWarmingError extends Error {
|
|
21
22
|
etaSeconds;
|
|
22
23
|
constructor(etaSeconds = 5) {
|
|
@@ -145,7 +146,10 @@ export async function startServer(options) {
|
|
|
145
146
|
});
|
|
146
147
|
for (const diagnostic of loaded.diagnostics) {
|
|
147
148
|
if (diagnostic.status !== "loaded") {
|
|
148
|
-
|
|
149
|
+
emitSemanticControlLog({
|
|
150
|
+
event: 'hook.runtime.degraded', identity: { projectRoot: boundProjectRoot }, level: 'warn', timestamp: Date.now(),
|
|
151
|
+
data: { stage: 'plugin_load', packageName: diagnostic.packageName, status: diagnostic.status, reason: diagnostic.reason ?? 'unknown_reason' },
|
|
152
|
+
});
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
const pluginMap = loaded.plugins;
|
|
@@ -203,7 +207,10 @@ export async function startServer(options) {
|
|
|
203
207
|
retries -= 1;
|
|
204
208
|
if (retries === 0)
|
|
205
209
|
throw error;
|
|
206
|
-
|
|
210
|
+
emitSemanticControlLog({
|
|
211
|
+
event: 'mcp.action.degraded', identity: { projectRoot }, level: 'warn', timestamp: Date.now(),
|
|
212
|
+
data: { stage: 'engine_init', reason: boundedError(error), retriesRemaining: retries, fallback: 'bounded_retry' },
|
|
213
|
+
});
|
|
207
214
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
208
215
|
}
|
|
209
216
|
}
|
|
@@ -323,8 +330,31 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
323
330
|
const argObj = (args ?? {});
|
|
324
331
|
const identity = resolveRuntimeIdentity(argObj, boundProjectRoot);
|
|
325
332
|
const handlerArgs = stripRuntimeIdentity(argObj);
|
|
333
|
+
const semanticIdentity = {
|
|
334
|
+
projectRoot: identity.projectRoot,
|
|
335
|
+
sessionId: identity.sessionId,
|
|
336
|
+
turnId: identity.turnId,
|
|
337
|
+
requestId: identity.requestId,
|
|
338
|
+
executionId: identity.executionId,
|
|
339
|
+
intentArtifactHash: identity.intentArtifactHash,
|
|
340
|
+
};
|
|
341
|
+
emitSemanticControlLog({
|
|
342
|
+
event: 'canonical.tool.resolved', identity: semanticIdentity, level: 'info', timestamp: Date.now(),
|
|
343
|
+
data: {
|
|
344
|
+
requestedName: name, canonicalName: name, projectedName: `mcp__devflow__${name}`,
|
|
345
|
+
status: 'canonical', attempt: 0, capabilityMechanism: 'native', toolUseId: identity.toolUseId,
|
|
346
|
+
},
|
|
347
|
+
});
|
|
348
|
+
emitSemanticControlLog({
|
|
349
|
+
event: 'mcp.action.started', identity: semanticIdentity, level: 'info', timestamp: Date.now(),
|
|
350
|
+
data: { tool: name, toolUseId: identity.toolUseId },
|
|
351
|
+
});
|
|
326
352
|
if (dependencies.acceptedToolNames && !dependencies.acceptedToolNames.has(name)) {
|
|
327
353
|
recordCanonicalActionBoundaryFailure(identity, name, 'unavailable', 'tool_profile_unavailable');
|
|
354
|
+
emitSemanticControlLog({
|
|
355
|
+
event: 'mcp.action.failed', identity: semanticIdentity, level: 'warn', timestamp: Date.now(),
|
|
356
|
+
data: { tool: name, category: 'tool_profile_unavailable', retryable: true },
|
|
357
|
+
});
|
|
328
358
|
return createErrorResponse(name, {
|
|
329
359
|
ok: false,
|
|
330
360
|
status: "unavailable",
|
|
@@ -345,7 +375,12 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
345
375
|
|| name === 'devflow_report_step') {
|
|
346
376
|
handlerArgs._devflow_session_id = identity.sessionId;
|
|
347
377
|
handlerArgs._devflow_execution_id = identity.executionId;
|
|
348
|
-
handlerArgs._devflow_request_id = identity.eventId;
|
|
378
|
+
handlerArgs._devflow_request_id = identity.requestId ?? identity.eventId;
|
|
379
|
+
if (identity.turnId)
|
|
380
|
+
handlerArgs._devflow_turn_id = identity.turnId;
|
|
381
|
+
if (identity.intentArtifactHash) {
|
|
382
|
+
handlerArgs._devflow_intent_artifact_hash = identity.intentArtifactHash;
|
|
383
|
+
}
|
|
349
384
|
if (identity.toolUseId)
|
|
350
385
|
handlerArgs._devflow_tool_use_id = identity.toolUseId;
|
|
351
386
|
}
|
|
@@ -354,6 +389,10 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
354
389
|
requireProjectRoot(handlerArgs, boundProjectRoot);
|
|
355
390
|
}
|
|
356
391
|
catch (error) {
|
|
392
|
+
emitSemanticControlLog({
|
|
393
|
+
event: 'mcp.action.failed', identity: semanticIdentity, level: 'warn', timestamp: Date.now(),
|
|
394
|
+
data: { tool: name, category: 'project_root_invalid', reason: boundedError(error) },
|
|
395
|
+
});
|
|
357
396
|
return createErrorResponse(name, { error: error.message });
|
|
358
397
|
}
|
|
359
398
|
argObj.projectRoot = handlerArgs.projectRoot;
|
|
@@ -375,6 +414,10 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
375
414
|
blockReason: enforcement.result.rule?.id,
|
|
376
415
|
});
|
|
377
416
|
if (enforcement.result.rule?.id === "S001") {
|
|
417
|
+
emitSemanticControlLog({
|
|
418
|
+
event: 'mcp.action.degraded', identity: semanticIdentity, level: 'warn', timestamp: Date.now(),
|
|
419
|
+
data: { tool: name, category: 'context_required', rule: 'S001', retryable: true },
|
|
420
|
+
});
|
|
378
421
|
return createErrorResponse(name, {
|
|
379
422
|
code: "DEVFLOW_CONTEXT_REQUIRED",
|
|
380
423
|
error: "Call get_project_context successfully before this domain tool.",
|
|
@@ -385,6 +428,10 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
385
428
|
rule: "S001",
|
|
386
429
|
});
|
|
387
430
|
}
|
|
431
|
+
emitSemanticControlLog({
|
|
432
|
+
event: 'mcp.action.failed', identity: semanticIdentity, level: 'warn', timestamp: Date.now(),
|
|
433
|
+
data: { tool: name, category: 'enforcement_denied', rule: enforcement.result.rule?.id },
|
|
434
|
+
});
|
|
388
435
|
return createErrorResponse(name, {
|
|
389
436
|
error: message,
|
|
390
437
|
rule: enforcement.result.rule?.id,
|
|
@@ -454,6 +501,18 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
454
501
|
finalResult = { ...finalResult, _warning: enforcement.result.warning };
|
|
455
502
|
}
|
|
456
503
|
const preparedResult = prepareResultForClient(boundProjectRoot, name, finalResult);
|
|
504
|
+
emitSemanticControlLog({
|
|
505
|
+
event: semanticOutcome.failed
|
|
506
|
+
? 'mcp.action.failed' : semanticOutcome.degraded ? 'mcp.action.degraded' : 'mcp.action.completed',
|
|
507
|
+
identity: semanticIdentity,
|
|
508
|
+
level: semanticOutcome.failed ? 'error' : semanticOutcome.degraded ? 'warn' : 'info',
|
|
509
|
+
timestamp: Date.now(),
|
|
510
|
+
data: {
|
|
511
|
+
tool: name, durationMs, status: semanticOutcome.status,
|
|
512
|
+
errorCode: semanticOutcome.errorCode, resultCount: countResults(result),
|
|
513
|
+
contextReceipt: enforcement.receipt,
|
|
514
|
+
},
|
|
515
|
+
});
|
|
457
516
|
return semanticOutcome.failed
|
|
458
517
|
? createErrorResponse(name, asErrorDetails(preparedResult, semanticOutcome))
|
|
459
518
|
: createSuccessResponse(name, preparedResult, durationMs);
|
|
@@ -462,6 +521,10 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
462
521
|
durationMs = Date.now() - startTime;
|
|
463
522
|
if (err instanceof EngineWarmingError) {
|
|
464
523
|
recordCanonicalActionBoundaryFailure(identity, name, 'timeout', 'engine_warming_timeout');
|
|
524
|
+
emitSemanticControlLog({
|
|
525
|
+
event: 'mcp.action.degraded', identity: semanticIdentity, level: 'warn', timestamp: Date.now(),
|
|
526
|
+
data: { tool: name, durationMs, category: 'engine_warming_timeout', retryable: true, etaSeconds: err.etaSeconds },
|
|
527
|
+
});
|
|
465
528
|
return createSuccessResponse(name, {
|
|
466
529
|
status: "warming",
|
|
467
530
|
etaSeconds: err.etaSeconds,
|
|
@@ -475,10 +538,17 @@ export function createCallToolRequestHandler(dependencies) {
|
|
|
475
538
|
durationMs,
|
|
476
539
|
error: err.message,
|
|
477
540
|
});
|
|
541
|
+
emitSemanticControlLog({
|
|
542
|
+
event: 'mcp.action.failed', identity: semanticIdentity, level: 'error', timestamp: Date.now(),
|
|
543
|
+
data: { tool: name, durationMs, category: 'handler_error', reason: boundedError(err) },
|
|
544
|
+
});
|
|
478
545
|
return createErrorResponse(name, { error: err.message });
|
|
479
546
|
}
|
|
480
547
|
};
|
|
481
548
|
}
|
|
549
|
+
function boundedError(error) {
|
|
550
|
+
return (error instanceof Error ? error.message : String(error)).trim().slice(0, 500) || 'unknown_error';
|
|
551
|
+
}
|
|
482
552
|
function recordCanonicalActionBoundaryFailure(identity, toolName, status, reason) {
|
|
483
553
|
let database;
|
|
484
554
|
try {
|
|
@@ -526,17 +596,28 @@ function resolveRuntimeIdentity(args, projectRoot) {
|
|
|
526
596
|
const toolUseId = typeof args._devflow_tool_use_id === "string" && args._devflow_tool_use_id.trim()
|
|
527
597
|
? args._devflow_tool_use_id.trim()
|
|
528
598
|
: undefined;
|
|
599
|
+
const turnId = optionalRuntimeString(args._devflow_turn_id);
|
|
600
|
+
const requestId = optionalRuntimeString(args._devflow_request_id);
|
|
601
|
+
const intentArtifactHash = optionalRuntimeString(args._devflow_intent_artifact_hash);
|
|
529
602
|
const eventKey = toolUseId ?? `${Date.now()}:${Math.random()}`;
|
|
530
603
|
const eventId = `evt_tool_${createHash("sha256")
|
|
531
604
|
.update(`${sessionId}\0${eventKey}`)
|
|
532
605
|
.digest("hex")
|
|
533
606
|
.slice(0, 24)}`;
|
|
534
|
-
return {
|
|
607
|
+
return {
|
|
608
|
+
projectRoot, sessionId, executionId, toolUseId, eventId,
|
|
609
|
+
...(turnId ? { turnId } : {}),
|
|
610
|
+
...(requestId ? { requestId } : {}),
|
|
611
|
+
...(intentArtifactHash ? { intentArtifactHash } : {}),
|
|
612
|
+
};
|
|
535
613
|
}
|
|
536
614
|
function stripRuntimeIdentity(args) {
|
|
537
|
-
const { _devflow_session_id: _sessionId, _devflow_execution_id: _executionId, _devflow_tool_use_id: _toolUseId, ...handlerArgs } = args;
|
|
615
|
+
const { _devflow_session_id: _sessionId, _devflow_execution_id: _executionId, _devflow_tool_use_id: _toolUseId, _devflow_turn_id: _turnId, _devflow_request_id: _requestId, _devflow_intent_artifact_hash: _intentArtifactHash, ...handlerArgs } = args;
|
|
538
616
|
return handlerArgs;
|
|
539
617
|
}
|
|
618
|
+
function optionalRuntimeString(value) {
|
|
619
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
620
|
+
}
|
|
540
621
|
function persistContextAccuracySample(identity, input, result) {
|
|
541
622
|
const query = getQueryFromArgs(input);
|
|
542
623
|
if (!query)
|
|
@@ -762,7 +843,10 @@ export function syncReceiptToHook(projectRoot, _toolName) {
|
|
|
762
843
|
unlinkSync(legacyReceipt);
|
|
763
844
|
}
|
|
764
845
|
catch (error) {
|
|
765
|
-
|
|
846
|
+
emitSemanticControlLog({
|
|
847
|
+
event: 'mcp.action.degraded', identity: { projectRoot }, level: 'warn', timestamp: Date.now(),
|
|
848
|
+
data: { tool: 'get_project_context', stage: 'hook_receipt_sync', reason: boundedError(error), fallback: 'database_receipt' },
|
|
849
|
+
});
|
|
766
850
|
}
|
|
767
851
|
finally {
|
|
768
852
|
try {
|