@defai.digital/ax-cli 0.2.2 → 1.0.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/README.md +260 -116
- package/dist/agent/grok-agent.js +12 -1
- package/dist/agent/grok-agent.js.map +1 -1
- package/dist/commands/mcp.js +3 -2
- package/dist/commands/mcp.js.map +1 -1
- package/dist/hooks/use-input-handler.js +4 -4
- package/dist/hooks/use-input-handler.js.map +1 -1
- package/dist/mcp/client.js +5 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/schemas/api-schemas.d.ts +58 -26
- package/dist/schemas/api-schemas.js +6 -4
- package/dist/schemas/api-schemas.js.map +1 -1
- package/dist/schemas/index.d.ts +26 -14
- package/dist/schemas/index.js +9 -7
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/settings-schemas.d.ts +25 -19
- package/dist/schemas/settings-schemas.js +10 -7
- package/dist/schemas/settings-schemas.js.map +1 -1
- package/dist/utils/confirmation-service.js +24 -0
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/custom-instructions.js +12 -2
- package/dist/utils/custom-instructions.js.map +1 -1
- package/dist/utils/model-config.js +2 -1
- package/dist/utils/model-config.js.map +1 -1
- package/dist/utils/settings-manager.d.ts +12 -0
- package/dist/utils/settings-manager.js +122 -17
- package/dist/utils/settings-manager.js.map +1 -1
- package/dist/utils/token-counter.js +1 -1
- package/dist/utils/token-counter.js.map +1 -1
- package/eslint.config.js +3 -0
- package/package.json +2 -2
- package/automatosx.config.json +0 -333
- package/dist/schemas/mcp-schemas.d.ts +0 -171
- package/dist/schemas/mcp-schemas.js +0 -77
- package/dist/schemas/mcp-schemas.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defai.digital/ax-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Enterprise-Class AI Command Line Interface - Primary support for GLM (General Language Model) with multi-provider AI orchestration powered by AutomatosX.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@vitest/ui": "^4.0.10",
|
|
72
72
|
"eslint": "^9.31.0",
|
|
73
73
|
"tsx": "^4.0.0",
|
|
74
|
-
"typescript": "^5.
|
|
74
|
+
"typescript": "^5.9.3",
|
|
75
75
|
"vitest": "^4.0.10"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
package/automatosx.config.json
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"providers": {
|
|
3
|
-
"claude-code": {
|
|
4
|
-
"enabled": true,
|
|
5
|
-
"priority": 3,
|
|
6
|
-
"timeout": 2700000,
|
|
7
|
-
"command": "claude",
|
|
8
|
-
"healthCheck": {
|
|
9
|
-
"enabled": true,
|
|
10
|
-
"interval": 300000,
|
|
11
|
-
"timeout": 5000
|
|
12
|
-
},
|
|
13
|
-
"circuitBreaker": {
|
|
14
|
-
"enabled": true,
|
|
15
|
-
"failureThreshold": 3,
|
|
16
|
-
"recoveryTimeout": 60000
|
|
17
|
-
},
|
|
18
|
-
"processManagement": {
|
|
19
|
-
"gracefulShutdownTimeout": 5000,
|
|
20
|
-
"forceKillDelay": 1000
|
|
21
|
-
},
|
|
22
|
-
"versionDetection": {
|
|
23
|
-
"timeout": 5000,
|
|
24
|
-
"forceKillDelay": 1000,
|
|
25
|
-
"cacheEnabled": true
|
|
26
|
-
},
|
|
27
|
-
"limitTracking": {
|
|
28
|
-
"enabled": true,
|
|
29
|
-
"window": "weekly",
|
|
30
|
-
"resetHourUtc": 0
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"gemini-cli": {
|
|
34
|
-
"enabled": true,
|
|
35
|
-
"priority": 2,
|
|
36
|
-
"timeout": 2700000,
|
|
37
|
-
"command": "gemini",
|
|
38
|
-
"healthCheck": {
|
|
39
|
-
"enabled": true,
|
|
40
|
-
"interval": 300000,
|
|
41
|
-
"timeout": 5000
|
|
42
|
-
},
|
|
43
|
-
"circuitBreaker": {
|
|
44
|
-
"enabled": true,
|
|
45
|
-
"failureThreshold": 3,
|
|
46
|
-
"recoveryTimeout": 60000
|
|
47
|
-
},
|
|
48
|
-
"processManagement": {
|
|
49
|
-
"gracefulShutdownTimeout": 5000,
|
|
50
|
-
"forceKillDelay": 1000
|
|
51
|
-
},
|
|
52
|
-
"versionDetection": {
|
|
53
|
-
"timeout": 5000,
|
|
54
|
-
"forceKillDelay": 1000,
|
|
55
|
-
"cacheEnabled": true
|
|
56
|
-
},
|
|
57
|
-
"limitTracking": {
|
|
58
|
-
"enabled": true,
|
|
59
|
-
"window": "daily",
|
|
60
|
-
"resetHourUtc": 0
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"openai": {
|
|
64
|
-
"enabled": true,
|
|
65
|
-
"priority": 1,
|
|
66
|
-
"timeout": 2700000,
|
|
67
|
-
"command": "codex",
|
|
68
|
-
"healthCheck": {
|
|
69
|
-
"enabled": true,
|
|
70
|
-
"interval": 300000,
|
|
71
|
-
"timeout": 5000
|
|
72
|
-
},
|
|
73
|
-
"circuitBreaker": {
|
|
74
|
-
"enabled": true,
|
|
75
|
-
"failureThreshold": 3,
|
|
76
|
-
"recoveryTimeout": 60000
|
|
77
|
-
},
|
|
78
|
-
"processManagement": {
|
|
79
|
-
"gracefulShutdownTimeout": 5000,
|
|
80
|
-
"forceKillDelay": 1000
|
|
81
|
-
},
|
|
82
|
-
"versionDetection": {
|
|
83
|
-
"timeout": 5000,
|
|
84
|
-
"forceKillDelay": 1000,
|
|
85
|
-
"cacheEnabled": true
|
|
86
|
-
},
|
|
87
|
-
"limitTracking": {
|
|
88
|
-
"enabled": true,
|
|
89
|
-
"window": "daily",
|
|
90
|
-
"resetHourUtc": 0
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
"grok": {
|
|
94
|
-
"enabled": true,
|
|
95
|
-
"priority": 4,
|
|
96
|
-
"timeout": 2700000,
|
|
97
|
-
"command": "grok",
|
|
98
|
-
"healthCheck": {
|
|
99
|
-
"enabled": true,
|
|
100
|
-
"interval": 300000,
|
|
101
|
-
"timeout": 5000
|
|
102
|
-
},
|
|
103
|
-
"circuitBreaker": {
|
|
104
|
-
"enabled": true,
|
|
105
|
-
"failureThreshold": 3,
|
|
106
|
-
"recoveryTimeout": 60000
|
|
107
|
-
},
|
|
108
|
-
"processManagement": {
|
|
109
|
-
"gracefulShutdownTimeout": 5000,
|
|
110
|
-
"forceKillDelay": 1000
|
|
111
|
-
},
|
|
112
|
-
"versionDetection": {
|
|
113
|
-
"timeout": 5000,
|
|
114
|
-
"forceKillDelay": 1000,
|
|
115
|
-
"cacheEnabled": true
|
|
116
|
-
},
|
|
117
|
-
"limitTracking": {
|
|
118
|
-
"enabled": true,
|
|
119
|
-
"window": "daily",
|
|
120
|
-
"resetHourUtc": 0
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
"execution": {
|
|
125
|
-
"defaultTimeout": 2700000,
|
|
126
|
-
"concurrency": {
|
|
127
|
-
"maxConcurrentAgents": 4,
|
|
128
|
-
"autoDetect": false,
|
|
129
|
-
"cpuMultiplier": 1,
|
|
130
|
-
"minConcurrency": 2,
|
|
131
|
-
"maxConcurrency": 16
|
|
132
|
-
},
|
|
133
|
-
"retry": {
|
|
134
|
-
"maxAttempts": 3,
|
|
135
|
-
"initialDelay": 1000,
|
|
136
|
-
"maxDelay": 10000,
|
|
137
|
-
"backoffFactor": 2,
|
|
138
|
-
"retryableErrors": [
|
|
139
|
-
"ECONNREFUSED",
|
|
140
|
-
"ETIMEDOUT",
|
|
141
|
-
"ENOTFOUND",
|
|
142
|
-
"rate_limit",
|
|
143
|
-
"overloaded",
|
|
144
|
-
"timeout"
|
|
145
|
-
]
|
|
146
|
-
},
|
|
147
|
-
"provider": {
|
|
148
|
-
"maxWaitMs": 60000,
|
|
149
|
-
"fallbackDelay": 5000
|
|
150
|
-
},
|
|
151
|
-
"stages": {
|
|
152
|
-
"enabled": true,
|
|
153
|
-
"defaultTimeout": 1800000,
|
|
154
|
-
"checkpointPath": ".automatosx/checkpoints",
|
|
155
|
-
"autoSaveCheckpoint": true,
|
|
156
|
-
"cleanupAfterDays": 7,
|
|
157
|
-
"retry": {
|
|
158
|
-
"defaultMaxRetries": 1,
|
|
159
|
-
"defaultRetryDelay": 2000
|
|
160
|
-
},
|
|
161
|
-
"prompts": {
|
|
162
|
-
"timeout": 600000,
|
|
163
|
-
"autoConfirm": false,
|
|
164
|
-
"locale": "en"
|
|
165
|
-
},
|
|
166
|
-
"progress": {
|
|
167
|
-
"updateInterval": 2000,
|
|
168
|
-
"syntheticProgress": true
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
"orchestration": {
|
|
173
|
-
"session": {
|
|
174
|
-
"maxSessions": 100,
|
|
175
|
-
"maxMetadataSize": 10240,
|
|
176
|
-
"saveDebounce": 1000,
|
|
177
|
-
"cleanupAfterDays": 7,
|
|
178
|
-
"maxUuidAttempts": 100,
|
|
179
|
-
"persistPath": ".automatosx/sessions"
|
|
180
|
-
},
|
|
181
|
-
"delegation": {
|
|
182
|
-
"maxDepth": 2,
|
|
183
|
-
"timeout": 2700000,
|
|
184
|
-
"enableCycleDetection": true
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"memory": {
|
|
188
|
-
"maxEntries": 10000,
|
|
189
|
-
"persistPath": ".automatosx/memory",
|
|
190
|
-
"autoCleanup": true,
|
|
191
|
-
"cleanupDays": 30,
|
|
192
|
-
"busyTimeout": 5000,
|
|
193
|
-
"search": {
|
|
194
|
-
"defaultLimit": 10,
|
|
195
|
-
"maxLimit": 100,
|
|
196
|
-
"timeout": 5000
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
"abilities": {
|
|
200
|
-
"basePath": ".automatosx/abilities",
|
|
201
|
-
"fallbackPath": "examples/abilities",
|
|
202
|
-
"cache": {
|
|
203
|
-
"enabled": true,
|
|
204
|
-
"maxEntries": 50,
|
|
205
|
-
"ttl": 600000,
|
|
206
|
-
"maxSize": 5242880,
|
|
207
|
-
"cleanupInterval": 120000
|
|
208
|
-
},
|
|
209
|
-
"limits": {
|
|
210
|
-
"maxFileSize": 524288
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
"workspace": {
|
|
214
|
-
"prdPath": "automatosx/PRD",
|
|
215
|
-
"tmpPath": "automatosx/tmp",
|
|
216
|
-
"autoCleanupTmp": true,
|
|
217
|
-
"tmpCleanupDays": 7
|
|
218
|
-
},
|
|
219
|
-
"logging": {
|
|
220
|
-
"level": "info",
|
|
221
|
-
"path": ".automatosx/logs",
|
|
222
|
-
"console": true,
|
|
223
|
-
"retention": {
|
|
224
|
-
"maxSizeBytes": 104857600,
|
|
225
|
-
"maxAgeDays": 30,
|
|
226
|
-
"compress": true
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
"performance": {
|
|
230
|
-
"profileCache": {
|
|
231
|
-
"enabled": true,
|
|
232
|
-
"maxEntries": 20,
|
|
233
|
-
"ttl": 600000,
|
|
234
|
-
"cleanupInterval": 120000
|
|
235
|
-
},
|
|
236
|
-
"teamCache": {
|
|
237
|
-
"enabled": true,
|
|
238
|
-
"maxEntries": 10,
|
|
239
|
-
"ttl": 600000,
|
|
240
|
-
"cleanupInterval": 120000
|
|
241
|
-
},
|
|
242
|
-
"providerCache": {
|
|
243
|
-
"enabled": true,
|
|
244
|
-
"maxEntries": 100,
|
|
245
|
-
"ttl": 600000,
|
|
246
|
-
"cleanupInterval": 120000
|
|
247
|
-
},
|
|
248
|
-
"adaptiveCache": {
|
|
249
|
-
"maxEntries": 1000,
|
|
250
|
-
"baseTTL": 300000,
|
|
251
|
-
"minTTL": 60000,
|
|
252
|
-
"maxTTL": 3600000,
|
|
253
|
-
"adaptiveMultiplier": 2,
|
|
254
|
-
"lowFreqDivisor": 2,
|
|
255
|
-
"frequencyThreshold": 5,
|
|
256
|
-
"cleanupInterval": 60000
|
|
257
|
-
},
|
|
258
|
-
"responseCache": {
|
|
259
|
-
"enabled": false,
|
|
260
|
-
"ttl": 86400,
|
|
261
|
-
"maxSize": 1000,
|
|
262
|
-
"maxMemorySize": 100,
|
|
263
|
-
"dbPath": ".automatosx/cache/responses.db"
|
|
264
|
-
},
|
|
265
|
-
"rateLimit": {
|
|
266
|
-
"enabled": false,
|
|
267
|
-
"requestsPerMinute": 60,
|
|
268
|
-
"burstSize": 10
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
"advanced": {
|
|
272
|
-
"embedding": {
|
|
273
|
-
"timeout": 30000,
|
|
274
|
-
"retryDelay": 1000,
|
|
275
|
-
"dimensions": 1536,
|
|
276
|
-
"maxRetries": 3
|
|
277
|
-
},
|
|
278
|
-
"security": {
|
|
279
|
-
"enablePathValidation": true,
|
|
280
|
-
"allowedExtensions": [
|
|
281
|
-
".ts",
|
|
282
|
-
".js",
|
|
283
|
-
".tsx",
|
|
284
|
-
".jsx",
|
|
285
|
-
".py",
|
|
286
|
-
".go",
|
|
287
|
-
".rs",
|
|
288
|
-
".java",
|
|
289
|
-
".yaml",
|
|
290
|
-
".yml",
|
|
291
|
-
".json",
|
|
292
|
-
".toml",
|
|
293
|
-
".md",
|
|
294
|
-
".txt",
|
|
295
|
-
".csv"
|
|
296
|
-
]
|
|
297
|
-
},
|
|
298
|
-
"development": {
|
|
299
|
-
"mockProviders": false,
|
|
300
|
-
"profileMode": false
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
"integration": {
|
|
304
|
-
"vscode": {
|
|
305
|
-
"enabled": false,
|
|
306
|
-
"apiPort": 3000,
|
|
307
|
-
"autoStart": true,
|
|
308
|
-
"outputPanel": true,
|
|
309
|
-
"notifications": true
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
"cli": {
|
|
313
|
-
"run": {
|
|
314
|
-
"defaultMemory": true,
|
|
315
|
-
"defaultSaveMemory": true,
|
|
316
|
-
"defaultFormat": "text",
|
|
317
|
-
"defaultVerbose": false
|
|
318
|
-
},
|
|
319
|
-
"session": {
|
|
320
|
-
"defaultShowAgents": true
|
|
321
|
-
},
|
|
322
|
-
"memory": {
|
|
323
|
-
"defaultLimit": 10
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
"router": {
|
|
327
|
-
"healthCheckInterval": 60000,
|
|
328
|
-
"providerCooldownMs": 30000,
|
|
329
|
-
"enableFreeTierPrioritization": true,
|
|
330
|
-
"enableWorkloadAwareRouting": true
|
|
331
|
-
},
|
|
332
|
-
"version": "9.0.0"
|
|
333
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schemas for MCP (Model Context Protocol) validation
|
|
3
|
-
* Ensures type safety for MCP server configurations and tool definitions
|
|
4
|
-
*/
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
export declare const MCPTransportSchema: z.ZodEnum<["stdio", "http", "sse"]>;
|
|
7
|
-
export type MCPTransport = z.infer<typeof MCPTransportSchema>;
|
|
8
|
-
export declare const MCPServerConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
9
|
-
name: z.ZodString;
|
|
10
|
-
transport: z.ZodEnum<["stdio", "http", "sse"]>;
|
|
11
|
-
command: z.ZodOptional<z.ZodString>;
|
|
12
|
-
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
-
url: z.ZodOptional<z.ZodString>;
|
|
14
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
15
|
-
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
name: string;
|
|
17
|
-
transport: "stdio" | "http" | "sse";
|
|
18
|
-
url?: string | undefined;
|
|
19
|
-
env?: Record<string, string> | undefined;
|
|
20
|
-
command?: string | undefined;
|
|
21
|
-
args?: string[] | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
name: string;
|
|
24
|
-
transport: "stdio" | "http" | "sse";
|
|
25
|
-
url?: string | undefined;
|
|
26
|
-
env?: Record<string, string> | undefined;
|
|
27
|
-
command?: string | undefined;
|
|
28
|
-
args?: string[] | undefined;
|
|
29
|
-
}>, {
|
|
30
|
-
name: string;
|
|
31
|
-
transport: "stdio" | "http" | "sse";
|
|
32
|
-
url?: string | undefined;
|
|
33
|
-
env?: Record<string, string> | undefined;
|
|
34
|
-
command?: string | undefined;
|
|
35
|
-
args?: string[] | undefined;
|
|
36
|
-
}, {
|
|
37
|
-
name: string;
|
|
38
|
-
transport: "stdio" | "http" | "sse";
|
|
39
|
-
url?: string | undefined;
|
|
40
|
-
env?: Record<string, string> | undefined;
|
|
41
|
-
command?: string | undefined;
|
|
42
|
-
args?: string[] | undefined;
|
|
43
|
-
}>;
|
|
44
|
-
export type MCPServerConfig = z.infer<typeof MCPServerConfigSchema>;
|
|
45
|
-
export declare const MCPToolSchema: z.ZodObject<{
|
|
46
|
-
name: z.ZodString;
|
|
47
|
-
description: z.ZodString;
|
|
48
|
-
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
49
|
-
serverName: z.ZodString;
|
|
50
|
-
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
name: string;
|
|
52
|
-
description: string;
|
|
53
|
-
inputSchema: Record<string, unknown>;
|
|
54
|
-
serverName: string;
|
|
55
|
-
}, {
|
|
56
|
-
name: string;
|
|
57
|
-
description: string;
|
|
58
|
-
inputSchema: Record<string, unknown>;
|
|
59
|
-
serverName: string;
|
|
60
|
-
}>;
|
|
61
|
-
export type MCPTool = z.infer<typeof MCPToolSchema>;
|
|
62
|
-
export declare const MCPConfigSchema: z.ZodObject<{
|
|
63
|
-
servers: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
64
|
-
name: z.ZodString;
|
|
65
|
-
transport: z.ZodEnum<["stdio", "http", "sse"]>;
|
|
66
|
-
command: z.ZodOptional<z.ZodString>;
|
|
67
|
-
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
68
|
-
url: z.ZodOptional<z.ZodString>;
|
|
69
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
70
|
-
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
name: string;
|
|
72
|
-
transport: "stdio" | "http" | "sse";
|
|
73
|
-
url?: string | undefined;
|
|
74
|
-
env?: Record<string, string> | undefined;
|
|
75
|
-
command?: string | undefined;
|
|
76
|
-
args?: string[] | undefined;
|
|
77
|
-
}, {
|
|
78
|
-
name: string;
|
|
79
|
-
transport: "stdio" | "http" | "sse";
|
|
80
|
-
url?: string | undefined;
|
|
81
|
-
env?: Record<string, string> | undefined;
|
|
82
|
-
command?: string | undefined;
|
|
83
|
-
args?: string[] | undefined;
|
|
84
|
-
}>, {
|
|
85
|
-
name: string;
|
|
86
|
-
transport: "stdio" | "http" | "sse";
|
|
87
|
-
url?: string | undefined;
|
|
88
|
-
env?: Record<string, string> | undefined;
|
|
89
|
-
command?: string | undefined;
|
|
90
|
-
args?: string[] | undefined;
|
|
91
|
-
}, {
|
|
92
|
-
name: string;
|
|
93
|
-
transport: "stdio" | "http" | "sse";
|
|
94
|
-
url?: string | undefined;
|
|
95
|
-
env?: Record<string, string> | undefined;
|
|
96
|
-
command?: string | undefined;
|
|
97
|
-
args?: string[] | undefined;
|
|
98
|
-
}>, "many">;
|
|
99
|
-
}, "strip", z.ZodTypeAny, {
|
|
100
|
-
servers: {
|
|
101
|
-
name: string;
|
|
102
|
-
transport: "stdio" | "http" | "sse";
|
|
103
|
-
url?: string | undefined;
|
|
104
|
-
env?: Record<string, string> | undefined;
|
|
105
|
-
command?: string | undefined;
|
|
106
|
-
args?: string[] | undefined;
|
|
107
|
-
}[];
|
|
108
|
-
}, {
|
|
109
|
-
servers: {
|
|
110
|
-
name: string;
|
|
111
|
-
transport: "stdio" | "http" | "sse";
|
|
112
|
-
url?: string | undefined;
|
|
113
|
-
env?: Record<string, string> | undefined;
|
|
114
|
-
command?: string | undefined;
|
|
115
|
-
args?: string[] | undefined;
|
|
116
|
-
}[];
|
|
117
|
-
}>;
|
|
118
|
-
export type MCPConfig = z.infer<typeof MCPConfigSchema>;
|
|
119
|
-
export declare const MCPToolCallResultSchema: z.ZodObject<{
|
|
120
|
-
success: z.ZodBoolean;
|
|
121
|
-
output: z.ZodOptional<z.ZodString>;
|
|
122
|
-
error: z.ZodOptional<z.ZodString>;
|
|
123
|
-
content: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
-
type: z.ZodString;
|
|
125
|
-
text: z.ZodOptional<z.ZodString>;
|
|
126
|
-
data: z.ZodOptional<z.ZodUnknown>;
|
|
127
|
-
}, "strip", z.ZodTypeAny, {
|
|
128
|
-
type: string;
|
|
129
|
-
data?: unknown;
|
|
130
|
-
text?: string | undefined;
|
|
131
|
-
}, {
|
|
132
|
-
type: string;
|
|
133
|
-
data?: unknown;
|
|
134
|
-
text?: string | undefined;
|
|
135
|
-
}>, "many">>;
|
|
136
|
-
}, "strip", z.ZodTypeAny, {
|
|
137
|
-
success: boolean;
|
|
138
|
-
content?: {
|
|
139
|
-
type: string;
|
|
140
|
-
data?: unknown;
|
|
141
|
-
text?: string | undefined;
|
|
142
|
-
}[] | undefined;
|
|
143
|
-
output?: string | undefined;
|
|
144
|
-
error?: string | undefined;
|
|
145
|
-
}, {
|
|
146
|
-
success: boolean;
|
|
147
|
-
content?: {
|
|
148
|
-
type: string;
|
|
149
|
-
data?: unknown;
|
|
150
|
-
text?: string | undefined;
|
|
151
|
-
}[] | undefined;
|
|
152
|
-
output?: string | undefined;
|
|
153
|
-
error?: string | undefined;
|
|
154
|
-
}>;
|
|
155
|
-
export type MCPToolCallResult = z.infer<typeof MCPToolCallResultSchema>;
|
|
156
|
-
/**
|
|
157
|
-
* Validation helper functions
|
|
158
|
-
*/
|
|
159
|
-
export declare function validateMCPServerConfig(data: unknown): MCPServerConfig;
|
|
160
|
-
export declare function safeValidateMCPServerConfig(data: unknown): {
|
|
161
|
-
success: boolean;
|
|
162
|
-
data?: MCPServerConfig;
|
|
163
|
-
error?: z.ZodError;
|
|
164
|
-
};
|
|
165
|
-
export declare function validateMCPConfig(data: unknown): MCPConfig;
|
|
166
|
-
export declare function safeValidateMCPConfig(data: unknown): {
|
|
167
|
-
success: boolean;
|
|
168
|
-
data?: MCPConfig;
|
|
169
|
-
error?: z.ZodError;
|
|
170
|
-
};
|
|
171
|
-
export declare function validateMCPTool(data: unknown): MCPTool;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schemas for MCP (Model Context Protocol) validation
|
|
3
|
-
* Ensures type safety for MCP server configurations and tool definitions
|
|
4
|
-
*/
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
// MCP Transport Types
|
|
7
|
-
export const MCPTransportSchema = z.enum(['stdio', 'http', 'sse']);
|
|
8
|
-
// MCP Server Configuration Schema
|
|
9
|
-
export const MCPServerConfigSchema = z
|
|
10
|
-
.object({
|
|
11
|
-
name: z.string().min(1, 'Server name is required'),
|
|
12
|
-
transport: MCPTransportSchema,
|
|
13
|
-
command: z.string().optional(),
|
|
14
|
-
args: z.array(z.string()).optional(),
|
|
15
|
-
url: z.string().optional(),
|
|
16
|
-
env: z.record(z.string(), z.string()).optional(),
|
|
17
|
-
})
|
|
18
|
-
.refine((data) => {
|
|
19
|
-
if (data.transport === 'stdio') {
|
|
20
|
-
return !!data.command;
|
|
21
|
-
}
|
|
22
|
-
if (data.transport === 'http' || data.transport === 'sse') {
|
|
23
|
-
return !!data.url;
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
}, {
|
|
27
|
-
message: 'stdio transport requires command, http/sse transport requires url',
|
|
28
|
-
});
|
|
29
|
-
// MCP Tool Schema
|
|
30
|
-
export const MCPToolSchema = z.object({
|
|
31
|
-
name: z.string().min(1),
|
|
32
|
-
description: z.string(),
|
|
33
|
-
inputSchema: z.record(z.unknown()),
|
|
34
|
-
serverName: z.string(),
|
|
35
|
-
});
|
|
36
|
-
// MCP Config Schema
|
|
37
|
-
export const MCPConfigSchema = z.object({
|
|
38
|
-
servers: z.array(MCPServerConfigSchema),
|
|
39
|
-
});
|
|
40
|
-
// MCP Tool Call Result Schema
|
|
41
|
-
export const MCPToolCallResultSchema = z.object({
|
|
42
|
-
success: z.boolean(),
|
|
43
|
-
output: z.string().optional(),
|
|
44
|
-
error: z.string().optional(),
|
|
45
|
-
content: z.array(z.object({
|
|
46
|
-
type: z.string(),
|
|
47
|
-
text: z.string().optional(),
|
|
48
|
-
data: z.unknown().optional(),
|
|
49
|
-
})).optional(),
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* Validation helper functions
|
|
53
|
-
*/
|
|
54
|
-
export function validateMCPServerConfig(data) {
|
|
55
|
-
return MCPServerConfigSchema.parse(data);
|
|
56
|
-
}
|
|
57
|
-
export function safeValidateMCPServerConfig(data) {
|
|
58
|
-
const result = MCPServerConfigSchema.safeParse(data);
|
|
59
|
-
if (result.success) {
|
|
60
|
-
return { success: true, data: result.data };
|
|
61
|
-
}
|
|
62
|
-
return { success: false, error: result.error };
|
|
63
|
-
}
|
|
64
|
-
export function validateMCPConfig(data) {
|
|
65
|
-
return MCPConfigSchema.parse(data);
|
|
66
|
-
}
|
|
67
|
-
export function safeValidateMCPConfig(data) {
|
|
68
|
-
const result = MCPConfigSchema.safeParse(data);
|
|
69
|
-
if (result.success) {
|
|
70
|
-
return { success: true, data: result.data };
|
|
71
|
-
}
|
|
72
|
-
return { success: false, error: result.error };
|
|
73
|
-
}
|
|
74
|
-
export function validateMCPTool(data) {
|
|
75
|
-
return MCPToolSchema.parse(data);
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=mcp-schemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-schemas.js","sourceRoot":"","sources":["../../src/schemas/mcp-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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