@vibecheckai/cli 3.5.0 → 3.5.2
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/bin/registry.js +214 -237
- package/bin/runners/cli-utils.js +33 -2
- package/bin/runners/context/analyzer.js +52 -1
- package/bin/runners/context/generators/cursor.js +2 -49
- package/bin/runners/context/git-context.js +3 -1
- package/bin/runners/context/team-conventions.js +33 -7
- package/bin/runners/lib/analysis-core.js +25 -5
- package/bin/runners/lib/analyzers.js +431 -481
- package/bin/runners/lib/default-config.js +127 -0
- package/bin/runners/lib/doctor/modules/security.js +3 -1
- package/bin/runners/lib/engine/ast-cache.js +210 -0
- package/bin/runners/lib/engine/auth-extractor.js +211 -0
- package/bin/runners/lib/engine/billing-extractor.js +112 -0
- package/bin/runners/lib/engine/enforcement-extractor.js +100 -0
- package/bin/runners/lib/engine/env-extractor.js +207 -0
- package/bin/runners/lib/engine/express-extractor.js +208 -0
- package/bin/runners/lib/engine/extractors.js +849 -0
- package/bin/runners/lib/engine/index.js +207 -0
- package/bin/runners/lib/engine/repo-index.js +514 -0
- package/bin/runners/lib/engine/types.js +124 -0
- package/bin/runners/lib/engines/accessibility-engine.js +18 -218
- package/bin/runners/lib/engines/api-consistency-engine.js +30 -335
- package/bin/runners/lib/engines/cross-file-analysis-engine.js +27 -292
- package/bin/runners/lib/engines/empty-catch-engine.js +17 -127
- package/bin/runners/lib/engines/mock-data-engine.js +10 -53
- package/bin/runners/lib/engines/performance-issues-engine.js +36 -176
- package/bin/runners/lib/engines/security-vulnerabilities-engine.js +54 -382
- package/bin/runners/lib/engines/type-aware-engine.js +39 -263
- package/bin/runners/lib/engines/vibecheck-engines/index.js +13 -122
- package/bin/runners/lib/engines/vibecheck-engines/lib/ast-cache.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/code-quality-engine.js +291 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/console-logs-engine.js +83 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/dead-code-engine.js +198 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/deprecated-api-engine.js +275 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/empty-catch-engine.js +167 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/file-filter.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +73 -373
- package/bin/runners/lib/engines/vibecheck-engines/lib/mock-data-engine.js +140 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/parallel-processor.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/performance-issues-engine.js +234 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/type-aware-engine.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/unsafe-regex-engine.js +78 -0
- package/bin/runners/lib/entitlements-v2.js +73 -97
- package/bin/runners/lib/error-handler.js +44 -3
- package/bin/runners/lib/error-messages.js +289 -0
- package/bin/runners/lib/evidence-pack.js +7 -1
- package/bin/runners/lib/finding-id.js +69 -0
- package/bin/runners/lib/finding-sorter.js +89 -0
- package/bin/runners/lib/html-proof-report.js +700 -350
- package/bin/runners/lib/missions/plan.js +6 -46
- package/bin/runners/lib/missions/templates.js +0 -232
- package/bin/runners/lib/next-action.js +560 -0
- package/bin/runners/lib/prerequisites.js +149 -0
- package/bin/runners/lib/route-detection.js +137 -68
- package/bin/runners/lib/scan-output.js +91 -76
- package/bin/runners/lib/scan-runner.js +135 -0
- package/bin/runners/lib/schemas/ajv-validator.js +464 -0
- package/bin/runners/lib/schemas/error-envelope.schema.json +105 -0
- package/bin/runners/lib/schemas/finding-v3.schema.json +151 -0
- package/bin/runners/lib/schemas/report-artifact.schema.json +120 -0
- package/bin/runners/lib/schemas/run-request.schema.json +108 -0
- package/bin/runners/lib/schemas/validator.js +27 -0
- package/bin/runners/lib/schemas/verdict.schema.json +140 -0
- package/bin/runners/lib/ship-output-enterprise.js +23 -23
- package/bin/runners/lib/ship-output.js +75 -31
- package/bin/runners/lib/terminal-ui.js +6 -113
- package/bin/runners/lib/truth.js +351 -10
- package/bin/runners/lib/unified-cli-output.js +430 -603
- package/bin/runners/lib/unified-output.js +13 -9
- package/bin/runners/runAIAgent.js +10 -5
- package/bin/runners/runAgent.js +0 -3
- package/bin/runners/runAllowlist.js +389 -0
- package/bin/runners/runApprove.js +0 -33
- package/bin/runners/runAuth.js +73 -45
- package/bin/runners/runCheckpoint.js +51 -11
- package/bin/runners/runClassify.js +85 -21
- package/bin/runners/runContext.js +0 -3
- package/bin/runners/runDoctor.js +41 -28
- package/bin/runners/runEvidencePack.js +362 -0
- package/bin/runners/runFirewall.js +0 -3
- package/bin/runners/runFirewallHook.js +0 -3
- package/bin/runners/runFix.js +66 -76
- package/bin/runners/runGuard.js +18 -411
- package/bin/runners/runInit.js +113 -30
- package/bin/runners/runLabs.js +424 -0
- package/bin/runners/runMcp.js +19 -25
- package/bin/runners/runPolish.js +64 -240
- package/bin/runners/runPromptFirewall.js +12 -5
- package/bin/runners/runProve.js +57 -22
- package/bin/runners/runQuickstart.js +531 -0
- package/bin/runners/runReality.js +59 -68
- package/bin/runners/runReport.js +38 -33
- package/bin/runners/runRuntime.js +8 -5
- package/bin/runners/runScan.js +1413 -190
- package/bin/runners/runShip.js +113 -719
- package/bin/runners/runTruth.js +0 -3
- package/bin/runners/runValidate.js +13 -9
- package/bin/runners/runWatch.js +23 -14
- package/bin/scan.js +6 -1
- package/bin/vibecheck.js +204 -185
- package/mcp-server/deprecation-middleware.js +282 -0
- package/mcp-server/handlers/index.ts +15 -0
- package/mcp-server/handlers/tool-handler.ts +554 -0
- package/mcp-server/index-v1.js +698 -0
- package/mcp-server/index.js +210 -238
- package/mcp-server/lib/cache-wrapper.cjs +383 -0
- package/mcp-server/lib/error-envelope.js +138 -0
- package/mcp-server/lib/executor.ts +499 -0
- package/mcp-server/lib/index.ts +19 -0
- package/mcp-server/lib/rate-limiter.js +166 -0
- package/mcp-server/lib/sandbox.test.ts +519 -0
- package/mcp-server/lib/sandbox.ts +395 -0
- package/mcp-server/lib/types.ts +267 -0
- package/mcp-server/package.json +12 -3
- package/mcp-server/registry/tool-registry.js +794 -0
- package/mcp-server/registry/tools.json +605 -0
- package/mcp-server/registry.test.ts +334 -0
- package/mcp-server/tests/tier-gating.test.js +297 -0
- package/mcp-server/tier-auth.js +378 -45
- package/mcp-server/tools-v3.js +353 -442
- package/mcp-server/tsconfig.json +37 -0
- package/mcp-server/vibecheck-2.0-tools.js +14 -1
- package/package.json +1 -1
- package/bin/runners/lib/agent-firewall/learning/learning-engine.js +0 -849
- package/bin/runners/lib/audit-logger.js +0 -532
- package/bin/runners/lib/authority/authorities/architecture.js +0 -364
- package/bin/runners/lib/authority/authorities/compliance.js +0 -341
- package/bin/runners/lib/authority/authorities/human.js +0 -343
- package/bin/runners/lib/authority/authorities/quality.js +0 -420
- package/bin/runners/lib/authority/authorities/security.js +0 -228
- package/bin/runners/lib/authority/index.js +0 -293
- package/bin/runners/lib/bundle/bundle-intelligence.js +0 -846
- package/bin/runners/lib/cli-charts.js +0 -368
- package/bin/runners/lib/cli-config-display.js +0 -405
- package/bin/runners/lib/cli-demo.js +0 -275
- package/bin/runners/lib/cli-errors.js +0 -438
- package/bin/runners/lib/cli-help-formatter.js +0 -439
- package/bin/runners/lib/cli-interactive-menu.js +0 -509
- package/bin/runners/lib/cli-prompts.js +0 -441
- package/bin/runners/lib/cli-scan-cards.js +0 -362
- package/bin/runners/lib/compliance-reporter.js +0 -710
- package/bin/runners/lib/conductor/index.js +0 -671
- package/bin/runners/lib/easy/README.md +0 -123
- package/bin/runners/lib/easy/index.js +0 -140
- package/bin/runners/lib/easy/interactive-wizard.js +0 -788
- package/bin/runners/lib/easy/one-click-firewall.js +0 -564
- package/bin/runners/lib/easy/zero-config-reality.js +0 -714
- package/bin/runners/lib/engines/async-patterns-engine.js +0 -444
- package/bin/runners/lib/engines/bundle-size-engine.js +0 -433
- package/bin/runners/lib/engines/confidence-scoring.js +0 -276
- package/bin/runners/lib/engines/context-detection.js +0 -264
- package/bin/runners/lib/engines/database-patterns-engine.js +0 -429
- package/bin/runners/lib/engines/duplicate-code-engine.js +0 -354
- package/bin/runners/lib/engines/env-variables-engine.js +0 -458
- package/bin/runners/lib/engines/error-handling-engine.js +0 -437
- package/bin/runners/lib/engines/false-positive-prevention.js +0 -630
- package/bin/runners/lib/engines/framework-adapters/index.js +0 -607
- package/bin/runners/lib/engines/framework-detection.js +0 -508
- package/bin/runners/lib/engines/import-order-engine.js +0 -429
- package/bin/runners/lib/engines/naming-conventions-engine.js +0 -544
- package/bin/runners/lib/engines/noise-reduction-engine.js +0 -452
- package/bin/runners/lib/engines/orchestrator.js +0 -334
- package/bin/runners/lib/engines/react-patterns-engine.js +0 -457
- package/bin/runners/lib/engines/vibecheck-engines/lib/ai-hallucination-engine.js +0 -806
- package/bin/runners/lib/engines/vibecheck-engines/lib/smart-fix-engine.js +0 -577
- package/bin/runners/lib/engines/vibecheck-engines/lib/vibe-score-engine.js +0 -543
- package/bin/runners/lib/engines/vibecheck-engines.js +0 -514
- package/bin/runners/lib/enhanced-features/index.js +0 -305
- package/bin/runners/lib/enhanced-output.js +0 -631
- package/bin/runners/lib/enterprise.js +0 -300
- package/bin/runners/lib/firewall/command-validator.js +0 -351
- package/bin/runners/lib/firewall/config.js +0 -341
- package/bin/runners/lib/firewall/content-validator.js +0 -519
- package/bin/runners/lib/firewall/index.js +0 -101
- package/bin/runners/lib/firewall/path-validator.js +0 -256
- package/bin/runners/lib/intelligence/cross-repo-intelligence.js +0 -817
- package/bin/runners/lib/mcp-utils.js +0 -425
- package/bin/runners/lib/output/index.js +0 -1022
- package/bin/runners/lib/policy-engine.js +0 -652
- package/bin/runners/lib/polish/autofix/accessibility-fixes.js +0 -333
- package/bin/runners/lib/polish/autofix/async-handlers.js +0 -273
- package/bin/runners/lib/polish/autofix/dead-code.js +0 -280
- package/bin/runners/lib/polish/autofix/imports-optimizer.js +0 -344
- package/bin/runners/lib/polish/autofix/index.js +0 -200
- package/bin/runners/lib/polish/autofix/remove-consoles.js +0 -209
- package/bin/runners/lib/polish/autofix/strengthen-types.js +0 -245
- package/bin/runners/lib/polish/backend-checks.js +0 -148
- package/bin/runners/lib/polish/documentation-checks.js +0 -111
- package/bin/runners/lib/polish/frontend-checks.js +0 -168
- package/bin/runners/lib/polish/index.js +0 -71
- package/bin/runners/lib/polish/infrastructure-checks.js +0 -131
- package/bin/runners/lib/polish/library-detection.js +0 -175
- package/bin/runners/lib/polish/performance-checks.js +0 -100
- package/bin/runners/lib/polish/security-checks.js +0 -148
- package/bin/runners/lib/polish/utils.js +0 -203
- package/bin/runners/lib/prompt-builder.js +0 -540
- package/bin/runners/lib/proof-certificate.js +0 -634
- package/bin/runners/lib/reality/accessibility-audit.js +0 -946
- package/bin/runners/lib/reality/api-contract-validator.js +0 -1012
- package/bin/runners/lib/reality/chaos-engineering.js +0 -1084
- package/bin/runners/lib/reality/performance-tracker.js +0 -1077
- package/bin/runners/lib/reality/scenario-generator.js +0 -1404
- package/bin/runners/lib/reality/visual-regression.js +0 -852
- package/bin/runners/lib/reality-profiler.js +0 -717
- package/bin/runners/lib/replay/flight-recorder-viewer.js +0 -1160
- package/bin/runners/lib/review/ai-code-review.js +0 -832
- package/bin/runners/lib/rules/custom-rule-engine.js +0 -985
- package/bin/runners/lib/sbom-generator.js +0 -641
- package/bin/runners/lib/scan-output-enhanced.js +0 -512
- package/bin/runners/lib/security/owasp-scanner.js +0 -939
- package/bin/runners/lib/validators/contract-validator.js +0 -283
- package/bin/runners/lib/validators/dead-export-detector.js +0 -279
- package/bin/runners/lib/validators/dep-audit.js +0 -245
- package/bin/runners/lib/validators/env-validator.js +0 -319
- package/bin/runners/lib/validators/index.js +0 -120
- package/bin/runners/lib/validators/license-checker.js +0 -252
- package/bin/runners/lib/validators/route-validator.js +0 -290
- package/bin/runners/runAuthority.js +0 -528
- package/bin/runners/runConductor.js +0 -772
- package/bin/runners/runContainer.js +0 -366
- package/bin/runners/runEasy.js +0 -410
- package/bin/runners/runIaC.js +0 -372
- package/bin/runners/runVibe.js +0 -791
- package/mcp-server/tools.js +0 -495
|
@@ -0,0 +1,794 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single Source of Truth for MCP Tool Registry
|
|
3
|
+
*
|
|
4
|
+
* Defines all MCP tools with:
|
|
5
|
+
* - Input/output schemas (JSON Schema)
|
|
6
|
+
* - Tier requirements (free/pro)
|
|
7
|
+
* - Timeouts
|
|
8
|
+
* - Rate limits
|
|
9
|
+
* - Option-level gates
|
|
10
|
+
*
|
|
11
|
+
* This registry is used for:
|
|
12
|
+
* - Input validation
|
|
13
|
+
* - Output validation (warnings)
|
|
14
|
+
* - Tier enforcement
|
|
15
|
+
* - Timeout configuration
|
|
16
|
+
* - Rate limit configuration
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const Ajv = require('ajv');
|
|
20
|
+
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
21
|
+
|
|
22
|
+
// Note: Tool tier definitions are defined here in TOOL_REGISTRY
|
|
23
|
+
// This is the single source of truth - tier-auth.js references this for consistency
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Tool Definition Schema
|
|
27
|
+
* @typedef {Object} ToolDefinition
|
|
28
|
+
* @property {string} name - Tool name
|
|
29
|
+
* @property {string} description - Tool description
|
|
30
|
+
* @property {'free'|'pro'} tier - Required tier
|
|
31
|
+
* @property {string} category - Tool category
|
|
32
|
+
* @property {object} inputSchema - JSON Schema for input validation
|
|
33
|
+
* @property {object} outputSchema - JSON Schema for output validation (optional)
|
|
34
|
+
* @property {Array<{name: string, tier?: 'pro', description: string}>} options - Option-level gates
|
|
35
|
+
* @property {{perMinute: number, perHour?: number}} rateLimit - Rate limit override (optional)
|
|
36
|
+
* @property {number} timeout - Timeout in milliseconds
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Tool Registry - Single Source of Truth
|
|
41
|
+
*/
|
|
42
|
+
const TOOL_REGISTRY = {
|
|
43
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
44
|
+
// FREE TOOLS
|
|
45
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
46
|
+
|
|
47
|
+
'vibecheck.scan': {
|
|
48
|
+
name: 'vibecheck.scan',
|
|
49
|
+
description: 'Scan codebase for issues (routes, env, auth, security)',
|
|
50
|
+
tier: 'free',
|
|
51
|
+
category: 'analysis',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
projectPath: { type: 'string', description: 'Project path' },
|
|
56
|
+
categories: {
|
|
57
|
+
type: 'array',
|
|
58
|
+
items: { type: 'string' },
|
|
59
|
+
description: 'Categories: routes, env, auth, billing, security',
|
|
60
|
+
},
|
|
61
|
+
since: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'ISO timestamp for incremental scan',
|
|
64
|
+
},
|
|
65
|
+
noCache: { type: 'boolean', default: false },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
outputSchema: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
properties: {
|
|
71
|
+
success: { type: 'boolean' },
|
|
72
|
+
findings: { type: 'array' },
|
|
73
|
+
summary: { type: 'object' },
|
|
74
|
+
cacheStats: { type: 'object' },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
options: [
|
|
78
|
+
{ name: 'autofix', tier: 'pro', description: 'Auto-fix issues' },
|
|
79
|
+
{ name: 'fix', tier: 'pro', description: 'Fix mode' },
|
|
80
|
+
],
|
|
81
|
+
rateLimit: { perMinute: 10 },
|
|
82
|
+
timeout: 300000, // 5 min
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
'vibecheck.ctx': {
|
|
86
|
+
name: 'vibecheck.ctx',
|
|
87
|
+
description: 'Generate truth context for AI agents',
|
|
88
|
+
tier: 'free',
|
|
89
|
+
category: 'context',
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
properties: {
|
|
93
|
+
projectPath: { type: 'string' },
|
|
94
|
+
scope: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
enum: ['all', 'routes', 'env', 'auth', 'billing'],
|
|
97
|
+
default: 'all',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
outputSchema: {
|
|
102
|
+
type: 'object',
|
|
103
|
+
properties: {
|
|
104
|
+
success: { type: 'boolean' },
|
|
105
|
+
context: { type: 'object' },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
timeout: 120000, // 2 min
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
'vibecheck.verify': {
|
|
112
|
+
name: 'vibecheck.verify',
|
|
113
|
+
description: 'Verify AI-generated code before applying',
|
|
114
|
+
tier: 'free',
|
|
115
|
+
category: 'validation',
|
|
116
|
+
inputSchema: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
code: { type: 'string', description: 'Code to verify' },
|
|
120
|
+
file: { type: 'string' },
|
|
121
|
+
projectPath: { type: 'string' },
|
|
122
|
+
},
|
|
123
|
+
required: ['code'],
|
|
124
|
+
},
|
|
125
|
+
outputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
verified: { type: 'boolean' },
|
|
129
|
+
issues: { type: 'array' },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
timeout: 60000, // 1 min
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
'vibecheck.report': {
|
|
136
|
+
name: 'vibecheck.report',
|
|
137
|
+
description: 'Generate reports',
|
|
138
|
+
tier: 'free',
|
|
139
|
+
category: 'reporting',
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
projectPath: { type: 'string' },
|
|
144
|
+
format: { type: 'string', enum: ['html', 'md', 'sarif', 'json'], default: 'html' },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
outputSchema: {
|
|
148
|
+
type: 'object',
|
|
149
|
+
properties: {
|
|
150
|
+
success: { type: 'boolean' },
|
|
151
|
+
report: { type: 'string' },
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
timeout: 120000, // 2 min
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
'vibecheck.status': {
|
|
158
|
+
name: 'vibecheck.status',
|
|
159
|
+
description: 'Check vibecheck status and health',
|
|
160
|
+
tier: 'free',
|
|
161
|
+
category: 'diagnostics',
|
|
162
|
+
inputSchema: {
|
|
163
|
+
type: 'object',
|
|
164
|
+
properties: {
|
|
165
|
+
projectPath: { type: 'string' },
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
outputSchema: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
success: { type: 'boolean' },
|
|
172
|
+
status: { type: 'object' },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
timeout: 30000, // 30s
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
'vibecheck.doctor': {
|
|
179
|
+
name: 'vibecheck.doctor',
|
|
180
|
+
description: 'Diagnose and fix environment issues',
|
|
181
|
+
tier: 'free',
|
|
182
|
+
category: 'diagnostics',
|
|
183
|
+
inputSchema: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: {
|
|
186
|
+
projectPath: { type: 'string' },
|
|
187
|
+
fix: { type: 'boolean', default: false },
|
|
188
|
+
noCache: { type: 'boolean', default: false },
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
outputSchema: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {
|
|
194
|
+
success: { type: 'boolean' },
|
|
195
|
+
checks: { type: 'array' },
|
|
196
|
+
cacheStats: { type: 'object' },
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
timeout: 60000, // 1 min
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
'vibecheck.firewall': {
|
|
203
|
+
name: 'vibecheck.firewall',
|
|
204
|
+
description: 'Agent Firewall - observe mode (FREE) or enforce mode (PRO)',
|
|
205
|
+
tier: 'free',
|
|
206
|
+
category: 'security',
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {
|
|
210
|
+
action: { type: 'string', enum: ['check', 'status', 'log'] },
|
|
211
|
+
code: { type: 'string' },
|
|
212
|
+
file: { type: 'string' },
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
outputSchema: {
|
|
216
|
+
type: 'object',
|
|
217
|
+
properties: {
|
|
218
|
+
mode: { type: 'string', enum: ['observe', 'enforce'] },
|
|
219
|
+
checked: { type: 'boolean' },
|
|
220
|
+
violations: { type: 'array' },
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
options: [
|
|
224
|
+
{ name: 'enforce', tier: 'pro', description: 'Enable enforce mode' },
|
|
225
|
+
{ name: 'mode', tier: 'pro', description: 'Set mode to enforce' },
|
|
226
|
+
],
|
|
227
|
+
timeout: 60000, // 1 min
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
'authority.list': {
|
|
231
|
+
name: 'authority.list',
|
|
232
|
+
description: 'List available authorities',
|
|
233
|
+
tier: 'free',
|
|
234
|
+
category: 'authority',
|
|
235
|
+
inputSchema: {
|
|
236
|
+
type: 'object',
|
|
237
|
+
properties: {
|
|
238
|
+
tier: { type: 'string', enum: ['free', 'pro'] },
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
outputSchema: {
|
|
242
|
+
type: 'object',
|
|
243
|
+
properties: {
|
|
244
|
+
success: { type: 'boolean' },
|
|
245
|
+
authorities: { type: 'array' },
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
timeout: 30000, // 30s
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
'authority.classify': {
|
|
252
|
+
name: 'authority.classify',
|
|
253
|
+
description: 'Inventory Authority - analyze duplication and legacy code',
|
|
254
|
+
tier: 'free',
|
|
255
|
+
category: 'authority',
|
|
256
|
+
inputSchema: {
|
|
257
|
+
type: 'object',
|
|
258
|
+
properties: {
|
|
259
|
+
projectPath: { type: 'string', default: '.' },
|
|
260
|
+
includeNear: { type: 'boolean', default: true },
|
|
261
|
+
format: { type: 'string', enum: ['json', 'table', 'markdown'], default: 'json' },
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
outputSchema: {
|
|
265
|
+
type: 'object',
|
|
266
|
+
properties: {
|
|
267
|
+
success: { type: 'boolean' },
|
|
268
|
+
classification: { type: 'object' },
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
timeout: 120000, // 2 min
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
'vibecheck_conductor_status': {
|
|
275
|
+
name: 'vibecheck_conductor_status',
|
|
276
|
+
description: 'Get multi-agent coordination status',
|
|
277
|
+
tier: 'free',
|
|
278
|
+
category: 'conductor',
|
|
279
|
+
inputSchema: {
|
|
280
|
+
type: 'object',
|
|
281
|
+
properties: {
|
|
282
|
+
projectRoot: { type: 'string' },
|
|
283
|
+
includeDetails: { type: 'boolean', default: false },
|
|
284
|
+
},
|
|
285
|
+
required: ['projectRoot'],
|
|
286
|
+
},
|
|
287
|
+
outputSchema: {
|
|
288
|
+
type: 'object',
|
|
289
|
+
properties: {
|
|
290
|
+
success: { type: 'boolean' },
|
|
291
|
+
status: { type: 'object' },
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
timeout: 30000, // 30s
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
298
|
+
// PRO TOOLS
|
|
299
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
300
|
+
|
|
301
|
+
'vibecheck.ship': {
|
|
302
|
+
name: 'vibecheck.ship',
|
|
303
|
+
description: 'Get ship verdict: SHIP | WARN | BLOCK',
|
|
304
|
+
tier: 'pro',
|
|
305
|
+
category: 'verdicts',
|
|
306
|
+
inputSchema: {
|
|
307
|
+
type: 'object',
|
|
308
|
+
properties: {
|
|
309
|
+
projectPath: { type: 'string' },
|
|
310
|
+
strict: { type: 'boolean' },
|
|
311
|
+
since: { type: 'string' },
|
|
312
|
+
noCache: { type: 'boolean', default: false },
|
|
313
|
+
},
|
|
314
|
+
required: ['projectPath'],
|
|
315
|
+
},
|
|
316
|
+
outputSchema: {
|
|
317
|
+
type: 'object',
|
|
318
|
+
properties: {
|
|
319
|
+
success: { type: 'boolean' },
|
|
320
|
+
verdict: { type: 'string', enum: ['SHIP', 'WARN', 'BLOCK'] },
|
|
321
|
+
reasons: { type: 'array' },
|
|
322
|
+
cacheStats: { type: 'object' },
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
rateLimit: { perMinute: 10 },
|
|
326
|
+
timeout: 300000, // 5 min
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
'vibecheck.fix': {
|
|
330
|
+
name: 'vibecheck.fix',
|
|
331
|
+
description: 'AI-powered fixes with proof',
|
|
332
|
+
tier: 'pro',
|
|
333
|
+
category: 'fixes',
|
|
334
|
+
inputSchema: {
|
|
335
|
+
type: 'object',
|
|
336
|
+
properties: {
|
|
337
|
+
projectPath: { type: 'string' },
|
|
338
|
+
mode: { type: 'string', enum: ['plan', 'apply', 'loop'], default: 'plan' },
|
|
339
|
+
findingIds: { type: 'array', items: { type: 'string' } },
|
|
340
|
+
},
|
|
341
|
+
required: ['projectPath'],
|
|
342
|
+
},
|
|
343
|
+
outputSchema: {
|
|
344
|
+
type: 'object',
|
|
345
|
+
properties: {
|
|
346
|
+
success: { type: 'boolean' },
|
|
347
|
+
plan: { type: 'array' },
|
|
348
|
+
applied: { type: 'boolean' },
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
options: [
|
|
352
|
+
{ name: 'apply', tier: 'pro', description: 'Apply fixes' },
|
|
353
|
+
{ name: 'loop', tier: 'pro', description: 'Loop mode' },
|
|
354
|
+
],
|
|
355
|
+
timeout: 600000, // 10 min
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
'vibecheck.prove': {
|
|
359
|
+
name: 'vibecheck.prove',
|
|
360
|
+
description: 'Full proof loop with runtime verification',
|
|
361
|
+
tier: 'pro',
|
|
362
|
+
category: 'proof',
|
|
363
|
+
inputSchema: {
|
|
364
|
+
type: 'object',
|
|
365
|
+
properties: {
|
|
366
|
+
projectPath: { type: 'string' },
|
|
367
|
+
url: { type: 'string' },
|
|
368
|
+
maxIterations: { type: 'number', default: 5 },
|
|
369
|
+
recordVideo: { type: 'boolean', default: true },
|
|
370
|
+
},
|
|
371
|
+
required: ['projectPath'],
|
|
372
|
+
},
|
|
373
|
+
outputSchema: {
|
|
374
|
+
type: 'object',
|
|
375
|
+
properties: {
|
|
376
|
+
success: { type: 'boolean' },
|
|
377
|
+
proof: { type: 'object' },
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
timeout: 600000, // 10 min
|
|
381
|
+
},
|
|
382
|
+
|
|
383
|
+
'vibecheck.gate': {
|
|
384
|
+
name: 'vibecheck.gate',
|
|
385
|
+
description: 'CI/CD enforcement - fail builds on issues',
|
|
386
|
+
tier: 'pro',
|
|
387
|
+
category: 'enforcement',
|
|
388
|
+
inputSchema: {
|
|
389
|
+
type: 'object',
|
|
390
|
+
properties: {
|
|
391
|
+
projectPath: { type: 'string' },
|
|
392
|
+
strict: { type: 'boolean' },
|
|
393
|
+
},
|
|
394
|
+
required: ['projectPath'],
|
|
395
|
+
},
|
|
396
|
+
outputSchema: {
|
|
397
|
+
type: 'object',
|
|
398
|
+
properties: {
|
|
399
|
+
success: { type: 'boolean' },
|
|
400
|
+
passed: { type: 'boolean' },
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
timeout: 300000, // 5 min
|
|
404
|
+
},
|
|
405
|
+
|
|
406
|
+
'vibecheck.badge': {
|
|
407
|
+
name: 'vibecheck.badge',
|
|
408
|
+
description: 'Generate ship badge',
|
|
409
|
+
tier: 'pro',
|
|
410
|
+
category: 'reporting',
|
|
411
|
+
inputSchema: {
|
|
412
|
+
type: 'object',
|
|
413
|
+
properties: {
|
|
414
|
+
projectPath: { type: 'string' },
|
|
415
|
+
outputPath: { type: 'string' },
|
|
416
|
+
},
|
|
417
|
+
required: ['projectPath'],
|
|
418
|
+
},
|
|
419
|
+
outputSchema: {
|
|
420
|
+
type: 'object',
|
|
421
|
+
properties: {
|
|
422
|
+
success: { type: 'boolean' },
|
|
423
|
+
badge: { type: 'string' },
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
timeout: 120000, // 2 min
|
|
427
|
+
},
|
|
428
|
+
|
|
429
|
+
'vibecheck.reality': {
|
|
430
|
+
name: 'vibecheck.reality',
|
|
431
|
+
description: 'Full runtime verification with auth boundary testing',
|
|
432
|
+
tier: 'pro',
|
|
433
|
+
category: 'proof',
|
|
434
|
+
inputSchema: {
|
|
435
|
+
type: 'object',
|
|
436
|
+
properties: {
|
|
437
|
+
url: { type: 'string' },
|
|
438
|
+
auth: { type: 'string' },
|
|
439
|
+
headed: { type: 'boolean' },
|
|
440
|
+
maxPages: { type: 'number', default: 20 },
|
|
441
|
+
},
|
|
442
|
+
required: ['url'],
|
|
443
|
+
},
|
|
444
|
+
outputSchema: {
|
|
445
|
+
type: 'object',
|
|
446
|
+
properties: {
|
|
447
|
+
success: { type: 'boolean' },
|
|
448
|
+
results: { type: 'array' },
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
options: [
|
|
452
|
+
{ name: 'full', tier: 'pro', description: 'Full mode' },
|
|
453
|
+
{ name: 'auth', tier: 'pro', description: 'Auth boundary testing' },
|
|
454
|
+
],
|
|
455
|
+
timeout: 300000, // 5 min
|
|
456
|
+
},
|
|
457
|
+
|
|
458
|
+
'vibecheck.ai_test': {
|
|
459
|
+
name: 'vibecheck.ai_test',
|
|
460
|
+
description: 'AI agent testing - autonomous exploration',
|
|
461
|
+
tier: 'pro',
|
|
462
|
+
category: 'testing',
|
|
463
|
+
inputSchema: {
|
|
464
|
+
type: 'object',
|
|
465
|
+
properties: {
|
|
466
|
+
url: { type: 'string' },
|
|
467
|
+
goal: { type: 'string' },
|
|
468
|
+
maxActions: { type: 'number', default: 50 },
|
|
469
|
+
},
|
|
470
|
+
required: ['url'],
|
|
471
|
+
},
|
|
472
|
+
outputSchema: {
|
|
473
|
+
type: 'object',
|
|
474
|
+
properties: {
|
|
475
|
+
success: { type: 'boolean' },
|
|
476
|
+
testResults: { type: 'array' },
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
timeout: 300000, // 5 min
|
|
480
|
+
},
|
|
481
|
+
|
|
482
|
+
'vibecheck.share': {
|
|
483
|
+
name: 'vibecheck.share',
|
|
484
|
+
description: 'Generate PR/review bundle',
|
|
485
|
+
tier: 'pro',
|
|
486
|
+
category: 'reporting',
|
|
487
|
+
inputSchema: {
|
|
488
|
+
type: 'object',
|
|
489
|
+
properties: {
|
|
490
|
+
projectPath: { type: 'string' },
|
|
491
|
+
format: { type: 'string', enum: ['github', 'gitlab', 'slack', 'json'], default: 'github' },
|
|
492
|
+
},
|
|
493
|
+
required: ['projectPath'],
|
|
494
|
+
},
|
|
495
|
+
outputSchema: {
|
|
496
|
+
type: 'object',
|
|
497
|
+
properties: {
|
|
498
|
+
success: { type: 'boolean' },
|
|
499
|
+
bundle: { type: 'object' },
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
timeout: 120000, // 2 min
|
|
503
|
+
},
|
|
504
|
+
|
|
505
|
+
'authority.approve': {
|
|
506
|
+
name: 'authority.approve',
|
|
507
|
+
description: 'Execute authority & get verdict (PROCEED/STOP/DEFER)',
|
|
508
|
+
tier: 'pro',
|
|
509
|
+
category: 'authority',
|
|
510
|
+
inputSchema: {
|
|
511
|
+
type: 'object',
|
|
512
|
+
properties: {
|
|
513
|
+
authority: { type: 'string' },
|
|
514
|
+
projectPath: { type: 'string', default: '.' },
|
|
515
|
+
dryRun: { type: 'boolean', default: false },
|
|
516
|
+
},
|
|
517
|
+
required: ['authority'],
|
|
518
|
+
},
|
|
519
|
+
outputSchema: {
|
|
520
|
+
type: 'object',
|
|
521
|
+
properties: {
|
|
522
|
+
success: { type: 'boolean' },
|
|
523
|
+
verdict: { type: 'string', enum: ['PROCEED', 'STOP', 'DEFER'] },
|
|
524
|
+
proof: { type: 'object' },
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
timeout: 300000, // 5 min
|
|
528
|
+
},
|
|
529
|
+
|
|
530
|
+
'vibecheck_conductor_register': {
|
|
531
|
+
name: 'vibecheck_conductor_register',
|
|
532
|
+
description: 'Register AI agent for multi-agent coordination',
|
|
533
|
+
tier: 'pro',
|
|
534
|
+
category: 'conductor',
|
|
535
|
+
inputSchema: {
|
|
536
|
+
type: 'object',
|
|
537
|
+
properties: {
|
|
538
|
+
agentId: { type: 'string' },
|
|
539
|
+
projectRoot: { type: 'string' },
|
|
540
|
+
workingFiles: { type: 'array', items: { type: 'string' } },
|
|
541
|
+
},
|
|
542
|
+
required: ['agentId', 'projectRoot'],
|
|
543
|
+
},
|
|
544
|
+
outputSchema: {
|
|
545
|
+
type: 'object',
|
|
546
|
+
properties: {
|
|
547
|
+
success: { type: 'boolean' },
|
|
548
|
+
sessionId: { type: 'string' },
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
timeout: 30000, // 30s
|
|
552
|
+
},
|
|
553
|
+
|
|
554
|
+
'vibecheck_conductor_acquire_lock': {
|
|
555
|
+
name: 'vibecheck_conductor_acquire_lock',
|
|
556
|
+
description: 'Acquire lock on file/folder for exclusive access',
|
|
557
|
+
tier: 'pro',
|
|
558
|
+
category: 'conductor',
|
|
559
|
+
inputSchema: {
|
|
560
|
+
type: 'object',
|
|
561
|
+
properties: {
|
|
562
|
+
sessionId: { type: 'string' },
|
|
563
|
+
path: { type: 'string' },
|
|
564
|
+
type: { type: 'string', enum: ['exclusive', 'shared'], default: 'exclusive' },
|
|
565
|
+
reason: { type: 'string' },
|
|
566
|
+
},
|
|
567
|
+
required: ['sessionId', 'path'],
|
|
568
|
+
},
|
|
569
|
+
outputSchema: {
|
|
570
|
+
type: 'object',
|
|
571
|
+
properties: {
|
|
572
|
+
success: { type: 'boolean' },
|
|
573
|
+
lockId: { type: 'string' },
|
|
574
|
+
},
|
|
575
|
+
},
|
|
576
|
+
timeout: 30000, // 30s
|
|
577
|
+
},
|
|
578
|
+
|
|
579
|
+
'vibecheck_conductor_release_lock': {
|
|
580
|
+
name: 'vibecheck_conductor_release_lock',
|
|
581
|
+
description: 'Release a previously acquired lock',
|
|
582
|
+
tier: 'pro',
|
|
583
|
+
category: 'conductor',
|
|
584
|
+
inputSchema: {
|
|
585
|
+
type: 'object',
|
|
586
|
+
properties: {
|
|
587
|
+
lockId: { type: 'string' },
|
|
588
|
+
sessionId: { type: 'string' },
|
|
589
|
+
},
|
|
590
|
+
required: ['lockId', 'sessionId'],
|
|
591
|
+
},
|
|
592
|
+
outputSchema: {
|
|
593
|
+
type: 'object',
|
|
594
|
+
properties: {
|
|
595
|
+
success: { type: 'boolean' },
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
timeout: 30000, // 30s
|
|
599
|
+
},
|
|
600
|
+
|
|
601
|
+
'vibecheck_conductor_propose': {
|
|
602
|
+
name: 'vibecheck_conductor_propose',
|
|
603
|
+
description: 'Submit change proposal for multi-agent coordination',
|
|
604
|
+
tier: 'pro',
|
|
605
|
+
category: 'conductor',
|
|
606
|
+
inputSchema: {
|
|
607
|
+
type: 'object',
|
|
608
|
+
properties: {
|
|
609
|
+
sessionId: { type: 'string' },
|
|
610
|
+
proposalId: { type: 'string' },
|
|
611
|
+
intent: { type: 'string' },
|
|
612
|
+
operations: {
|
|
613
|
+
type: 'array',
|
|
614
|
+
items: {
|
|
615
|
+
type: 'object',
|
|
616
|
+
properties: {
|
|
617
|
+
type: { type: 'string', enum: ['create', 'modify', 'delete', 'move'] },
|
|
618
|
+
path: { type: 'string' },
|
|
619
|
+
content: { type: 'string' },
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
projectRoot: { type: 'string' },
|
|
624
|
+
},
|
|
625
|
+
required: ['sessionId', 'proposalId', 'intent', 'operations', 'projectRoot'],
|
|
626
|
+
},
|
|
627
|
+
outputSchema: {
|
|
628
|
+
type: 'object',
|
|
629
|
+
properties: {
|
|
630
|
+
success: { type: 'boolean' },
|
|
631
|
+
approved: { type: 'boolean' },
|
|
632
|
+
},
|
|
633
|
+
},
|
|
634
|
+
timeout: 60000, // 1 min
|
|
635
|
+
},
|
|
636
|
+
|
|
637
|
+
'vibecheck_conductor_terminate': {
|
|
638
|
+
name: 'vibecheck_conductor_terminate',
|
|
639
|
+
description: 'Terminate agent session and release all locks',
|
|
640
|
+
tier: 'pro',
|
|
641
|
+
category: 'conductor',
|
|
642
|
+
inputSchema: {
|
|
643
|
+
type: 'object',
|
|
644
|
+
properties: {
|
|
645
|
+
sessionId: { type: 'string' },
|
|
646
|
+
},
|
|
647
|
+
required: ['sessionId'],
|
|
648
|
+
},
|
|
649
|
+
outputSchema: {
|
|
650
|
+
type: 'object',
|
|
651
|
+
properties: {
|
|
652
|
+
success: { type: 'boolean' },
|
|
653
|
+
},
|
|
654
|
+
},
|
|
655
|
+
timeout: 30000, // 30s
|
|
656
|
+
},
|
|
657
|
+
|
|
658
|
+
'vibecheck_agent_firewall_intercept': {
|
|
659
|
+
name: 'vibecheck_agent_firewall_intercept',
|
|
660
|
+
description: 'Agent Firewall (Sentinel) - ENFORCE MODE',
|
|
661
|
+
tier: 'pro',
|
|
662
|
+
category: 'security',
|
|
663
|
+
inputSchema: {
|
|
664
|
+
type: 'object',
|
|
665
|
+
properties: {
|
|
666
|
+
agentId: { type: 'string' },
|
|
667
|
+
filePath: { type: 'string' },
|
|
668
|
+
content: { type: 'string' },
|
|
669
|
+
operation: { type: 'string', enum: ['create', 'modify', 'delete'], default: 'modify' },
|
|
670
|
+
intent: { type: 'string' },
|
|
671
|
+
projectRoot: { type: 'string' },
|
|
672
|
+
},
|
|
673
|
+
required: ['agentId', 'filePath', 'content'],
|
|
674
|
+
},
|
|
675
|
+
outputSchema: {
|
|
676
|
+
type: 'object',
|
|
677
|
+
properties: {
|
|
678
|
+
allowed: { type: 'boolean' },
|
|
679
|
+
violations: { type: 'array' },
|
|
680
|
+
proof: { type: 'object' },
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
timeout: 120000, // 2 min
|
|
684
|
+
},
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
// ============================================================================
|
|
688
|
+
// VALIDATION FUNCTIONS
|
|
689
|
+
// ============================================================================
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Validate tool input against JSON Schema
|
|
693
|
+
* @param {string} toolName - Tool name
|
|
694
|
+
* @param {unknown} input - Input to validate
|
|
695
|
+
* @returns {{ valid: boolean, errors?: string[] }}
|
|
696
|
+
*/
|
|
697
|
+
function validateToolInput(toolName, input) {
|
|
698
|
+
const tool = TOOL_REGISTRY[toolName];
|
|
699
|
+
if (!tool) {
|
|
700
|
+
return { valid: false, errors: [`Unknown tool: ${toolName}`] };
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
const validate = ajv.compile(tool.inputSchema);
|
|
704
|
+
|
|
705
|
+
if (!validate(input)) {
|
|
706
|
+
return {
|
|
707
|
+
valid: false,
|
|
708
|
+
errors: validate.errors?.map((e) => `${e.instancePath || '/'} ${e.message}`) || ['Validation failed'],
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return { valid: true };
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Validate tool output against JSON Schema (warns on mismatch, doesn't fail)
|
|
717
|
+
* @param {string} toolName - Tool name
|
|
718
|
+
* @param {unknown} output - Output to validate
|
|
719
|
+
* @returns {{ valid: boolean, errors?: string[] }}
|
|
720
|
+
*/
|
|
721
|
+
function validateToolOutput(toolName, output) {
|
|
722
|
+
const tool = TOOL_REGISTRY[toolName];
|
|
723
|
+
if (!tool || !tool.outputSchema) {
|
|
724
|
+
return { valid: true }; // Unknown tool or no schema, skip validation
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
const validate = ajv.compile(tool.outputSchema);
|
|
728
|
+
|
|
729
|
+
if (!validate(output)) {
|
|
730
|
+
// Log warning but don't fail - output validation is advisory
|
|
731
|
+
console.warn(`[MCP] Tool ${toolName} output validation failed:`, validate.errors);
|
|
732
|
+
return {
|
|
733
|
+
valid: false,
|
|
734
|
+
errors: validate.errors?.map((e) => `${e.instancePath || '/'} ${e.message}`) || ['Validation failed'],
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
return { valid: true };
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Get tool tier requirement
|
|
743
|
+
* @param {string} toolName - Tool name
|
|
744
|
+
* @returns {'free'|'pro'} Tier requirement (defaults to 'pro' for unknown tools)
|
|
745
|
+
*/
|
|
746
|
+
function getToolTier(toolName) {
|
|
747
|
+
return TOOL_REGISTRY[toolName]?.tier || 'pro'; // Default to PRO for unknown tools
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Get tool timeout
|
|
752
|
+
* @param {string} toolName - Tool name
|
|
753
|
+
* @returns {number} Timeout in milliseconds (defaults to 30000)
|
|
754
|
+
*/
|
|
755
|
+
function getToolTimeout(toolName) {
|
|
756
|
+
return TOOL_REGISTRY[toolName]?.timeout || 30000; // Default 30s
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Get tool rate limit override (if any)
|
|
761
|
+
* @param {string} toolName - Tool name
|
|
762
|
+
* @returns {{perMinute: number, perHour?: number}|null} Rate limit override or null
|
|
763
|
+
*/
|
|
764
|
+
function getToolRateLimit(toolName) {
|
|
765
|
+
return TOOL_REGISTRY[toolName]?.rateLimit || null;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Get all registered tool names
|
|
770
|
+
* @returns {string[]} Array of tool names
|
|
771
|
+
*/
|
|
772
|
+
function getAllToolNames() {
|
|
773
|
+
return Object.keys(TOOL_REGISTRY);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Get tool definition
|
|
778
|
+
* @param {string} toolName - Tool name
|
|
779
|
+
* @returns {ToolDefinition|undefined} Tool definition
|
|
780
|
+
*/
|
|
781
|
+
function getToolDefinition(toolName) {
|
|
782
|
+
return TOOL_REGISTRY[toolName];
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
module.exports = {
|
|
786
|
+
TOOL_REGISTRY,
|
|
787
|
+
validateToolInput,
|
|
788
|
+
validateToolOutput,
|
|
789
|
+
getToolTier,
|
|
790
|
+
getToolTimeout,
|
|
791
|
+
getToolRateLimit,
|
|
792
|
+
getAllToolNames,
|
|
793
|
+
getToolDefinition,
|
|
794
|
+
};
|