@mcpilotx/intentorch 0.5.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/LICENSE +201 -0
- package/README.md +545 -0
- package/dist/ai/ai.d.ts +205 -0
- package/dist/ai/ai.js +1200 -0
- package/dist/ai/cloud-intent-engine.d.ts +270 -0
- package/dist/ai/cloud-intent-engine.js +956 -0
- package/dist/ai/command.d.ts +59 -0
- package/dist/ai/command.js +285 -0
- package/dist/ai/config.d.ts +66 -0
- package/dist/ai/config.js +211 -0
- package/dist/ai/enhanced-intent.d.ts +17 -0
- package/dist/ai/enhanced-intent.js +32 -0
- package/dist/ai/index.d.ts +29 -0
- package/dist/ai/index.js +44 -0
- package/dist/ai/intent.d.ts +16 -0
- package/dist/ai/intent.js +30 -0
- package/dist/core/ai-config.d.ts +25 -0
- package/dist/core/ai-config.js +326 -0
- package/dist/core/config-manager.d.ts +36 -0
- package/dist/core/config-manager.js +400 -0
- package/dist/core/config-validator.d.ts +9 -0
- package/dist/core/config-validator.js +184 -0
- package/dist/core/constants.d.ts +34 -0
- package/dist/core/constants.js +37 -0
- package/dist/core/error-ai.d.ts +23 -0
- package/dist/core/error-ai.js +217 -0
- package/dist/core/error-handler.d.ts +197 -0
- package/dist/core/error-handler.js +467 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +17 -0
- package/dist/core/logger.d.ts +27 -0
- package/dist/core/logger.js +108 -0
- package/dist/core/performance-monitor.d.ts +74 -0
- package/dist/core/performance-monitor.js +260 -0
- package/dist/core/providers.d.ts +36 -0
- package/dist/core/providers.js +304 -0
- package/dist/core/retry-manager.d.ts +41 -0
- package/dist/core/retry-manager.js +204 -0
- package/dist/core/types.d.ts +155 -0
- package/dist/core/types.js +2 -0
- package/dist/daemon/index.d.ts +10 -0
- package/dist/daemon/index.js +15 -0
- package/dist/daemon/intent-engine.d.ts +22 -0
- package/dist/daemon/intent-engine.js +50 -0
- package/dist/daemon/orchestrator.d.ts +24 -0
- package/dist/daemon/orchestrator.js +100 -0
- package/dist/daemon/pm.d.ts +33 -0
- package/dist/daemon/pm.js +127 -0
- package/dist/daemon/process.d.ts +11 -0
- package/dist/daemon/process.js +49 -0
- package/dist/daemon/server.d.ts +17 -0
- package/dist/daemon/server.js +435 -0
- package/dist/daemon/service.d.ts +36 -0
- package/dist/daemon/service.js +278 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +36 -0
- package/dist/mcp/client.d.ts +51 -0
- package/dist/mcp/client.js +276 -0
- package/dist/mcp/index.d.ts +162 -0
- package/dist/mcp/index.js +199 -0
- package/dist/mcp/tool-registry.d.ts +71 -0
- package/dist/mcp/tool-registry.js +308 -0
- package/dist/mcp/transport.d.ts +83 -0
- package/dist/mcp/transport.js +515 -0
- package/dist/mcp/types.d.ts +136 -0
- package/dist/mcp/types.js +31 -0
- package/dist/runtime/adapter-advanced.d.ts +184 -0
- package/dist/runtime/adapter-advanced.js +160 -0
- package/dist/runtime/adapter.d.ts +9 -0
- package/dist/runtime/adapter.js +2 -0
- package/dist/runtime/detector-advanced.d.ts +59 -0
- package/dist/runtime/detector-advanced.js +487 -0
- package/dist/runtime/detector.d.ts +5 -0
- package/dist/runtime/detector.js +56 -0
- package/dist/runtime/docker-adapter.d.ts +18 -0
- package/dist/runtime/docker-adapter.js +170 -0
- package/dist/runtime/docker.d.ts +17 -0
- package/dist/runtime/docker.js +71 -0
- package/dist/runtime/executable-analyzer.d.ts +56 -0
- package/dist/runtime/executable-analyzer.js +391 -0
- package/dist/runtime/go-adapter.d.ts +19 -0
- package/dist/runtime/go-adapter.js +190 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/index.js +10 -0
- package/dist/runtime/node-adapter.d.ts +10 -0
- package/dist/runtime/node-adapter.js +23 -0
- package/dist/runtime/node.d.ts +20 -0
- package/dist/runtime/node.js +86 -0
- package/dist/runtime/python-adapter.d.ts +11 -0
- package/dist/runtime/python-adapter.js +102 -0
- package/dist/runtime/python.d.ts +17 -0
- package/dist/runtime/python.js +72 -0
- package/dist/runtime/rust-adapter.d.ts +21 -0
- package/dist/runtime/rust-adapter.js +267 -0
- package/dist/sdk.d.ts +500 -0
- package/dist/sdk.js +904 -0
- package/docs/README.ZH_CN.md +545 -0
- package/docs/api.md +888 -0
- package/docs/architecture.md +731 -0
- package/docs/development.md +744 -0
- package/package.json +112 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Registration and Management
|
|
3
|
+
* Focuses on MCP tool management, providing tool registration, discovery, execution and other functions
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* MCP Tool Registry
|
|
7
|
+
* Focuses on managing tools discovered from MCP servers
|
|
8
|
+
*/
|
|
9
|
+
export class ToolRegistry {
|
|
10
|
+
tools = new Map();
|
|
11
|
+
serverTools = new Map(); // Server ID -> Tool name set
|
|
12
|
+
// ==================== Tool Registration ====================
|
|
13
|
+
/**
|
|
14
|
+
* Register tool
|
|
15
|
+
*/
|
|
16
|
+
registerTool(tool, executor, serverId, serverName) {
|
|
17
|
+
const registeredTool = {
|
|
18
|
+
tool,
|
|
19
|
+
executor,
|
|
20
|
+
metadata: {
|
|
21
|
+
serverId,
|
|
22
|
+
serverName,
|
|
23
|
+
discoveredAt: Date.now(),
|
|
24
|
+
lastUsed: Date.now(),
|
|
25
|
+
usageCount: 0,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
this.tools.set(tool.name, registeredTool);
|
|
29
|
+
// Maintain server to tool mapping
|
|
30
|
+
if (!this.serverTools.has(serverId)) {
|
|
31
|
+
this.serverTools.set(serverId, new Set());
|
|
32
|
+
}
|
|
33
|
+
this.serverTools.get(serverId).add(tool.name);
|
|
34
|
+
this.emitToolUpdate();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Batch register tools
|
|
38
|
+
*/
|
|
39
|
+
registerTools(tools, executorFactory, serverId, serverName) {
|
|
40
|
+
tools.forEach(tool => {
|
|
41
|
+
this.registerTool(tool, executorFactory(tool.name), serverId, serverName);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Unregister tool
|
|
46
|
+
*/
|
|
47
|
+
unregisterTool(toolName) {
|
|
48
|
+
const tool = this.tools.get(toolName);
|
|
49
|
+
if (!tool) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
// Remove from server mapping
|
|
53
|
+
const serverId = tool.metadata.serverId;
|
|
54
|
+
const serverToolSet = this.serverTools.get(serverId);
|
|
55
|
+
if (serverToolSet) {
|
|
56
|
+
serverToolSet.delete(toolName);
|
|
57
|
+
if (serverToolSet.size === 0) {
|
|
58
|
+
this.serverTools.delete(serverId);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Remove from tool mapping
|
|
62
|
+
const removed = this.tools.delete(toolName);
|
|
63
|
+
if (removed) {
|
|
64
|
+
this.emitToolUpdate();
|
|
65
|
+
}
|
|
66
|
+
return removed;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Unregister all tools for specified server
|
|
70
|
+
*/
|
|
71
|
+
unregisterServerTools(serverId) {
|
|
72
|
+
const toolNames = this.serverTools.get(serverId);
|
|
73
|
+
if (!toolNames || toolNames.size === 0) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
let removedCount = 0;
|
|
77
|
+
toolNames.forEach(toolName => {
|
|
78
|
+
if (this.tools.delete(toolName)) {
|
|
79
|
+
removedCount++;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
this.serverTools.delete(serverId);
|
|
83
|
+
if (removedCount > 0) {
|
|
84
|
+
this.emitToolUpdate();
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
// ==================== Tool Execution ====================
|
|
90
|
+
/**
|
|
91
|
+
* Execute tool
|
|
92
|
+
*/
|
|
93
|
+
async executeTool(toolCall) {
|
|
94
|
+
const registeredTool = this.tools.get(toolCall.name);
|
|
95
|
+
if (!registeredTool) {
|
|
96
|
+
// Get list of connected servers and available tools for better error messages
|
|
97
|
+
const connectedServers = this.getConnectedServers();
|
|
98
|
+
const availableTools = this.getAllTools();
|
|
99
|
+
let errorMessage = `Tool "${toolCall.name}" not found.`;
|
|
100
|
+
// Add helpful suggestions
|
|
101
|
+
if (connectedServers.length > 0) {
|
|
102
|
+
errorMessage += `\n\nConnected servers: ${connectedServers.join(', ')}`;
|
|
103
|
+
// Suggest similar tool names
|
|
104
|
+
const similarTools = availableTools
|
|
105
|
+
.filter(tool => tool.tool.name.toLowerCase().includes(toolCall.name.toLowerCase()) ||
|
|
106
|
+
toolCall.name.toLowerCase().includes(tool.tool.name.toLowerCase()))
|
|
107
|
+
.slice(0, 3);
|
|
108
|
+
if (similarTools.length > 0) {
|
|
109
|
+
errorMessage += '\n\nDid you mean one of these tools?';
|
|
110
|
+
similarTools.forEach(tool => {
|
|
111
|
+
errorMessage += `\n - ${tool.tool.name} (from server: ${tool.metadata.serverName})`;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// List all available tools if there aren't too many
|
|
115
|
+
if (availableTools.length <= 10) {
|
|
116
|
+
errorMessage += '\n\nAvailable tools:';
|
|
117
|
+
availableTools.forEach(tool => {
|
|
118
|
+
errorMessage += `\n - ${tool.tool.name} (${tool.metadata.serverName})`;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
errorMessage += `\n\nThere are ${availableTools.length} tools available from ${connectedServers.length} servers.`;
|
|
123
|
+
errorMessage += '\nUse listTools() or searchTools() to find the right tool.';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
errorMessage += '\n\nNo MCP servers are currently connected.';
|
|
128
|
+
errorMessage += '\nConnect a server first using connectMCPServer() or connectAllFromConfig().';
|
|
129
|
+
errorMessage += '\n\nPopular MCP servers you can connect:';
|
|
130
|
+
errorMessage += '\n - @modelcontextprotocol/server-filesystem (file operations)';
|
|
131
|
+
errorMessage += '\n - @modelcontextprotocol/server-weather (weather data)';
|
|
132
|
+
errorMessage += '\n - @modelcontextprotocol/server-github (GitHub operations)';
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
content: [{
|
|
136
|
+
type: 'text',
|
|
137
|
+
text: errorMessage,
|
|
138
|
+
}],
|
|
139
|
+
isError: true,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
// Validate parameters
|
|
144
|
+
this.validateToolArguments(registeredTool.tool, toolCall.arguments);
|
|
145
|
+
// Execute tool
|
|
146
|
+
const result = await registeredTool.executor(toolCall.arguments);
|
|
147
|
+
// Update usage statistics
|
|
148
|
+
registeredTool.metadata.lastUsed = Date.now();
|
|
149
|
+
registeredTool.metadata.usageCount = (registeredTool.metadata.usageCount || 0) + 1;
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
return {
|
|
154
|
+
content: [{
|
|
155
|
+
type: 'text',
|
|
156
|
+
text: `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
157
|
+
}],
|
|
158
|
+
isError: true,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// ==================== Tool Query ====================
|
|
163
|
+
getTool(name) {
|
|
164
|
+
return this.tools.get(name);
|
|
165
|
+
}
|
|
166
|
+
getAllTools() {
|
|
167
|
+
return Array.from(this.tools.values());
|
|
168
|
+
}
|
|
169
|
+
getToolsByServer(serverId) {
|
|
170
|
+
const toolNames = this.serverTools.get(serverId);
|
|
171
|
+
if (!toolNames) {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
return Array.from(toolNames)
|
|
175
|
+
.map(name => this.tools.get(name))
|
|
176
|
+
.filter((tool) => tool !== undefined);
|
|
177
|
+
}
|
|
178
|
+
getServerIds() {
|
|
179
|
+
return Array.from(this.serverTools.keys());
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get connected servers with their names
|
|
183
|
+
*/
|
|
184
|
+
getConnectedServers() {
|
|
185
|
+
const servers = [];
|
|
186
|
+
for (const registeredTool of this.tools.values()) {
|
|
187
|
+
const serverName = registeredTool.metadata.serverName || registeredTool.metadata.serverId;
|
|
188
|
+
if (!servers.includes(serverName)) {
|
|
189
|
+
servers.push(serverName);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return servers;
|
|
193
|
+
}
|
|
194
|
+
searchTools(query) {
|
|
195
|
+
const lowerQuery = query.toLowerCase();
|
|
196
|
+
return this.getAllTools().filter(registeredTool => {
|
|
197
|
+
const tool = registeredTool.tool;
|
|
198
|
+
return (tool.name.toLowerCase().includes(lowerQuery) ||
|
|
199
|
+
tool.description.toLowerCase().includes(lowerQuery));
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// ==================== Tool Validation ====================
|
|
203
|
+
validateToolArguments(tool, args) {
|
|
204
|
+
const schema = tool.inputSchema;
|
|
205
|
+
const toolName = tool.name;
|
|
206
|
+
const errors = [];
|
|
207
|
+
// Check required parameters
|
|
208
|
+
if (schema.required) {
|
|
209
|
+
for (const requiredParam of schema.required) {
|
|
210
|
+
if (!(requiredParam in args)) {
|
|
211
|
+
errors.push(`Missing required parameter: "${requiredParam}"`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Check parameter types and unknown parameters
|
|
216
|
+
for (const [paramName, paramValue] of Object.entries(args)) {
|
|
217
|
+
const paramSchema = schema.properties[paramName];
|
|
218
|
+
if (!paramSchema) {
|
|
219
|
+
if (schema.additionalProperties === false) {
|
|
220
|
+
errors.push(`Unknown parameter: "${paramName}". Tool "${toolName}" does not accept this parameter.`);
|
|
221
|
+
}
|
|
222
|
+
// If additionalProperties is true or not specified, allow unknown parameters
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
// Basic type validation
|
|
226
|
+
if (paramSchema.type) {
|
|
227
|
+
const expectedType = paramSchema.type;
|
|
228
|
+
const actualType = typeof paramValue;
|
|
229
|
+
// Handle array type specially
|
|
230
|
+
if (expectedType === 'array' && !Array.isArray(paramValue)) {
|
|
231
|
+
errors.push(`Parameter "${paramName}" should be an array, but got ${actualType}`);
|
|
232
|
+
}
|
|
233
|
+
// Handle other type mismatches (simplified)
|
|
234
|
+
else if (expectedType !== 'array' && expectedType !== actualType) {
|
|
235
|
+
// Allow some flexibility: number can accept string that can be parsed as number
|
|
236
|
+
if (expectedType === 'number' && typeof paramValue === 'string') {
|
|
237
|
+
if (isNaN(Number(paramValue))) {
|
|
238
|
+
errors.push(`Parameter "${paramName}" should be a number, but got string that cannot be parsed as number: "${paramValue}"`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else if (expectedType === 'string' && typeof paramValue !== 'string') {
|
|
242
|
+
errors.push(`Parameter "${paramName}" should be a string, but got ${actualType}`);
|
|
243
|
+
}
|
|
244
|
+
else if (expectedType === 'boolean' && typeof paramValue !== 'boolean') {
|
|
245
|
+
errors.push(`Parameter "${paramName}" should be a boolean, but got ${actualType}`);
|
|
246
|
+
}
|
|
247
|
+
else if (expectedType === 'object' && (typeof paramValue !== 'object' || paramValue === null || Array.isArray(paramValue))) {
|
|
248
|
+
errors.push(`Parameter "${paramName}" should be an object, but got ${actualType}`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// Check enum values if specified
|
|
253
|
+
if (paramSchema.enum && !paramSchema.enum.includes(paramValue)) {
|
|
254
|
+
errors.push(`Parameter "${paramName}" value "${paramValue}" is not valid. Allowed values: ${paramSchema.enum.join(', ')}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// If there are errors, throw a comprehensive error message
|
|
258
|
+
if (errors.length > 0) {
|
|
259
|
+
const errorMessage = [
|
|
260
|
+
`Tool "${toolName}" parameter validation failed:`,
|
|
261
|
+
...errors.map(error => ` - ${error}`),
|
|
262
|
+
'',
|
|
263
|
+
'Tool schema:',
|
|
264
|
+
` Required parameters: ${schema.required ? schema.required.join(', ') : 'none'}`,
|
|
265
|
+
` Available parameters: ${Object.keys(schema.properties).join(', ')}`,
|
|
266
|
+
'',
|
|
267
|
+
'Provided parameters:',
|
|
268
|
+
...Object.entries(args).map(([key, value]) => ` - ${key}: ${typeof value} = ${JSON.stringify(value)}`),
|
|
269
|
+
].join('\n');
|
|
270
|
+
throw new Error(errorMessage);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// ==================== Tool Statistics ====================
|
|
274
|
+
getToolStatistics() {
|
|
275
|
+
const tools = this.getAllTools();
|
|
276
|
+
return {
|
|
277
|
+
totalTools: tools.length,
|
|
278
|
+
byServer: Array.from(this.serverTools.entries()).reduce((acc, [serverId, toolNames]) => {
|
|
279
|
+
acc[serverId] = toolNames.size;
|
|
280
|
+
return acc;
|
|
281
|
+
}, {}),
|
|
282
|
+
mostUsed: tools
|
|
283
|
+
.filter(tool => tool.metadata.usageCount && tool.metadata.usageCount > 0)
|
|
284
|
+
.sort((a, b) => (b.metadata.usageCount || 0) - (a.metadata.usageCount || 0))
|
|
285
|
+
.slice(0, 10)
|
|
286
|
+
.map(tool => ({
|
|
287
|
+
name: tool.tool.name,
|
|
288
|
+
serverId: tool.metadata.serverId,
|
|
289
|
+
serverName: tool.metadata.serverName,
|
|
290
|
+
usageCount: tool.metadata.usageCount,
|
|
291
|
+
lastUsed: tool.metadata.lastUsed,
|
|
292
|
+
})),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
// ==================== Event Emission ====================
|
|
296
|
+
emitToolUpdate() {
|
|
297
|
+
// Tool update event can be triggered here
|
|
298
|
+
// Actual implementation can use EventEmitter
|
|
299
|
+
// console.log('Tool registry updated');
|
|
300
|
+
}
|
|
301
|
+
// ==================== Cleanup ====================
|
|
302
|
+
clear() {
|
|
303
|
+
this.tools.clear();
|
|
304
|
+
this.serverTools.clear();
|
|
305
|
+
this.emitToolUpdate();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Transport Layer Abstraction
|
|
3
|
+
* Supports stdio, HTTP, SSE and other transport methods
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
import { TransportConfig, JSONRPCRequest } from './types';
|
|
7
|
+
export interface Transport extends EventEmitter {
|
|
8
|
+
connect(): Promise<void>;
|
|
9
|
+
disconnect(): Promise<void>;
|
|
10
|
+
send(request: JSONRPCRequest): Promise<void>;
|
|
11
|
+
isConnected(): boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class BaseTransport extends EventEmitter implements Transport {
|
|
14
|
+
protected config: TransportConfig;
|
|
15
|
+
protected connected: boolean;
|
|
16
|
+
private jsonBuffer;
|
|
17
|
+
private bufferTimeout;
|
|
18
|
+
private lastBufferUpdate;
|
|
19
|
+
constructor(config: TransportConfig);
|
|
20
|
+
abstract connect(): Promise<void>;
|
|
21
|
+
abstract disconnect(): Promise<void>;
|
|
22
|
+
abstract send(request: JSONRPCRequest): Promise<void>;
|
|
23
|
+
isConnected(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Clear the JSON buffer and any associated timeout
|
|
26
|
+
*/
|
|
27
|
+
private clearBuffer;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a string looks like it could be part of a JSON object
|
|
30
|
+
*/
|
|
31
|
+
private looksLikeJsonChunk;
|
|
32
|
+
/**
|
|
33
|
+
* Try to parse buffer as JSON, returns parsed object or null
|
|
34
|
+
*/
|
|
35
|
+
private tryParseBuffer;
|
|
36
|
+
/**
|
|
37
|
+
* Process a line of text, handling JSON that may span multiple lines
|
|
38
|
+
*/
|
|
39
|
+
private processLine;
|
|
40
|
+
protected handleMessage(data: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Process stdio output, intelligently separate JSON messages and logs
|
|
43
|
+
*/
|
|
44
|
+
private processStdioOutput;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a message looks like JSON (more comprehensive check)
|
|
47
|
+
*/
|
|
48
|
+
private looksLikeJsonMessage;
|
|
49
|
+
/**
|
|
50
|
+
* Determine if a message is a log message using multiple detection strategies
|
|
51
|
+
*/
|
|
52
|
+
private isLogMessage;
|
|
53
|
+
protected handleError(error: Error): void;
|
|
54
|
+
}
|
|
55
|
+
export declare class StdioTransport extends BaseTransport {
|
|
56
|
+
private process?;
|
|
57
|
+
private reader?;
|
|
58
|
+
private writer?;
|
|
59
|
+
constructor(config: TransportConfig);
|
|
60
|
+
connect(): Promise<void>;
|
|
61
|
+
disconnect(): Promise<void>;
|
|
62
|
+
send(request: JSONRPCRequest): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
export declare class HTTPTransport extends BaseTransport {
|
|
65
|
+
private abortController?;
|
|
66
|
+
constructor(config: TransportConfig);
|
|
67
|
+
connect(): Promise<void>;
|
|
68
|
+
disconnect(): Promise<void>;
|
|
69
|
+
send(request: JSONRPCRequest): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
export declare class SSETransport extends BaseTransport {
|
|
72
|
+
private eventSource?;
|
|
73
|
+
private pendingRequests;
|
|
74
|
+
constructor(config: TransportConfig);
|
|
75
|
+
connect(): Promise<void>;
|
|
76
|
+
disconnect(): Promise<void>;
|
|
77
|
+
send(request: JSONRPCRequest): Promise<void>;
|
|
78
|
+
private httpTransport?;
|
|
79
|
+
}
|
|
80
|
+
export declare class TransportFactory {
|
|
81
|
+
static create(config: TransportConfig): Transport;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=transport.d.ts.map
|