@mcpmesh/sdk 0.8.0-beta.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/__tests__/claude-handler.test.d.ts +7 -0
- package/dist/__tests__/claude-handler.test.d.ts.map +1 -0
- package/dist/__tests__/claude-handler.test.js +455 -0
- package/dist/__tests__/claude-handler.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +7 -0
- package/dist/__tests__/config.test.d.ts.map +1 -0
- package/dist/__tests__/config.test.js +156 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/__tests__/errors.test.d.ts +7 -0
- package/dist/__tests__/errors.test.d.ts.map +1 -0
- package/dist/__tests__/errors.test.js +170 -0
- package/dist/__tests__/errors.test.js.map +1 -0
- package/dist/__tests__/generic-handler.test.d.ts +7 -0
- package/dist/__tests__/generic-handler.test.d.ts.map +1 -0
- package/dist/__tests__/generic-handler.test.js +243 -0
- package/dist/__tests__/generic-handler.test.js.map +1 -0
- package/dist/__tests__/llm-provider.test.d.ts +7 -0
- package/dist/__tests__/llm-provider.test.d.ts.map +1 -0
- package/dist/__tests__/llm-provider.test.js +217 -0
- package/dist/__tests__/llm-provider.test.js.map +1 -0
- package/dist/__tests__/openai-handler.test.d.ts +7 -0
- package/dist/__tests__/openai-handler.test.d.ts.map +1 -0
- package/dist/__tests__/openai-handler.test.js +359 -0
- package/dist/__tests__/openai-handler.test.js.map +1 -0
- package/dist/__tests__/provider-handler-registry.test.d.ts +9 -0
- package/dist/__tests__/provider-handler-registry.test.d.ts.map +1 -0
- package/dist/__tests__/provider-handler-registry.test.js +187 -0
- package/dist/__tests__/provider-handler-registry.test.js.map +1 -0
- package/dist/__tests__/response-parser.test.d.ts +7 -0
- package/dist/__tests__/response-parser.test.d.ts.map +1 -0
- package/dist/__tests__/response-parser.test.js +360 -0
- package/dist/__tests__/response-parser.test.js.map +1 -0
- package/dist/__tests__/route.test.d.ts +7 -0
- package/dist/__tests__/route.test.d.ts.map +1 -0
- package/dist/__tests__/route.test.js +281 -0
- package/dist/__tests__/route.test.js.map +1 -0
- package/dist/__tests__/sse.test.d.ts +7 -0
- package/dist/__tests__/sse.test.d.ts.map +1 -0
- package/dist/__tests__/sse.test.js +172 -0
- package/dist/__tests__/sse.test.js.map +1 -0
- package/dist/__tests__/template.test.d.ts +7 -0
- package/dist/__tests__/template.test.d.ts.map +1 -0
- package/dist/__tests__/template.test.js +176 -0
- package/dist/__tests__/template.test.js.map +1 -0
- package/dist/__tests__/tracing.test.d.ts +7 -0
- package/dist/__tests__/tracing.test.d.ts.map +1 -0
- package/dist/__tests__/tracing.test.js +264 -0
- package/dist/__tests__/tracing.test.js.map +1 -0
- package/dist/agent.d.ts +165 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +626 -0
- package/dist/agent.js.map +1 -0
- package/dist/api-runtime.d.ts +166 -0
- package/dist/api-runtime.d.ts.map +1 -0
- package/dist/api-runtime.js +459 -0
- package/dist/api-runtime.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +60 -0
- package/dist/config.js.map +1 -0
- package/dist/debug.d.ts +47 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +86 -0
- package/dist/debug.js.map +1 -0
- package/dist/errors.d.ts +99 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +110 -0
- package/dist/errors.js.map +1 -0
- package/dist/express.d.ts +146 -0
- package/dist/express.d.ts.map +1 -0
- package/dist/express.js +371 -0
- package/dist/express.js.map +1 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/llm-agent.d.ts +193 -0
- package/dist/llm-agent.d.ts.map +1 -0
- package/dist/llm-agent.js +634 -0
- package/dist/llm-agent.js.map +1 -0
- package/dist/llm-provider.d.ts +323 -0
- package/dist/llm-provider.d.ts.map +1 -0
- package/dist/llm-provider.js +446 -0
- package/dist/llm-provider.js.map +1 -0
- package/dist/llm.d.ts +194 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/llm.js +304 -0
- package/dist/llm.js.map +1 -0
- package/dist/provider-handlers/claude-handler.d.ts +98 -0
- package/dist/provider-handlers/claude-handler.d.ts.map +1 -0
- package/dist/provider-handlers/claude-handler.js +268 -0
- package/dist/provider-handlers/claude-handler.js.map +1 -0
- package/dist/provider-handlers/gemini-handler.d.ts +82 -0
- package/dist/provider-handlers/gemini-handler.d.ts.map +1 -0
- package/dist/provider-handlers/gemini-handler.js +152 -0
- package/dist/provider-handlers/gemini-handler.js.map +1 -0
- package/dist/provider-handlers/generic-handler.d.ts +78 -0
- package/dist/provider-handlers/generic-handler.d.ts.map +1 -0
- package/dist/provider-handlers/generic-handler.js +152 -0
- package/dist/provider-handlers/generic-handler.js.map +1 -0
- package/dist/provider-handlers/index.d.ts +29 -0
- package/dist/provider-handlers/index.d.ts.map +1 -0
- package/dist/provider-handlers/index.js +32 -0
- package/dist/provider-handlers/index.js.map +1 -0
- package/dist/provider-handlers/openai-handler.d.ts +86 -0
- package/dist/provider-handlers/openai-handler.d.ts.map +1 -0
- package/dist/provider-handlers/openai-handler.js +160 -0
- package/dist/provider-handlers/openai-handler.js.map +1 -0
- package/dist/provider-handlers/provider-handler-registry.d.ts +124 -0
- package/dist/provider-handlers/provider-handler-registry.d.ts.map +1 -0
- package/dist/provider-handlers/provider-handler-registry.js +180 -0
- package/dist/provider-handlers/provider-handler-registry.js.map +1 -0
- package/dist/provider-handlers/provider-handler.d.ts +245 -0
- package/dist/provider-handlers/provider-handler.d.ts.map +1 -0
- package/dist/provider-handlers/provider-handler.js +238 -0
- package/dist/provider-handlers/provider-handler.js.map +1 -0
- package/dist/proxy.d.ts +44 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +324 -0
- package/dist/proxy.js.map +1 -0
- package/dist/response-parser.d.ts +103 -0
- package/dist/response-parser.d.ts.map +1 -0
- package/dist/response-parser.js +232 -0
- package/dist/response-parser.js.map +1 -0
- package/dist/route.d.ts +185 -0
- package/dist/route.d.ts.map +1 -0
- package/dist/route.js +310 -0
- package/dist/route.js.map +1 -0
- package/dist/sse.d.ts +45 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +77 -0
- package/dist/sse.js.map +1 -0
- package/dist/template.d.ts +86 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +206 -0
- package/dist/template.js.map +1 -0
- package/dist/tracing.d.ts +88 -0
- package/dist/tracing.d.ts.map +1 -0
- package/dist/tracing.js +193 -0
- package/dist/tracing.js.map +1 -0
- package/dist/types.d.ts +618 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +68 -0
package/dist/agent.js
ADDED
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeshAgent implementation for MCP Mesh.
|
|
3
|
+
*
|
|
4
|
+
* Provides the core agent functionality including:
|
|
5
|
+
* - Registration with mesh registry via Rust core
|
|
6
|
+
* - Heartbeat management
|
|
7
|
+
* - Tool/capability discovery
|
|
8
|
+
* - Dependency injection for tool functions
|
|
9
|
+
* - Graceful shutdown
|
|
10
|
+
*/
|
|
11
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
12
|
+
import { startAgent, } from "@mcpmesh/core";
|
|
13
|
+
import { resolveConfig, generateAgentIdSuffix } from "./config.js";
|
|
14
|
+
import { createProxy, normalizeDependency, runWithTraceContext } from "./proxy.js";
|
|
15
|
+
import { initTracing, generateTraceId, generateSpanId, publishTraceSpan, } from "./tracing.js";
|
|
16
|
+
import { buildLlmAgentSpecs, handleLlmToolsUpdated, handleLlmProviderAvailable, handleLlmProviderUnavailable, LlmToolRegistry, } from "./llm.js";
|
|
17
|
+
import { llmProvider, getLlmProviderMeta } from "./llm-provider.js";
|
|
18
|
+
// Internal: pending agent for auto-start
|
|
19
|
+
let pendingAgent = null;
|
|
20
|
+
let autoStartScheduled = false;
|
|
21
|
+
// Schedule auto-start after module loading completes
|
|
22
|
+
function scheduleAutoStart() {
|
|
23
|
+
if (autoStartScheduled)
|
|
24
|
+
return;
|
|
25
|
+
autoStartScheduled = true;
|
|
26
|
+
process.nextTick(() => {
|
|
27
|
+
if (pendingAgent) {
|
|
28
|
+
pendingAgent._autoStart().catch((err) => {
|
|
29
|
+
console.error("MCP Mesh auto-start failed:", err);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* MeshAgent wraps a FastMCP server with MCP Mesh capabilities.
|
|
37
|
+
*
|
|
38
|
+
* It provides:
|
|
39
|
+
* - Automatic registration with the mesh registry
|
|
40
|
+
* - Heartbeat management via Rust core
|
|
41
|
+
* - Tool/capability discovery
|
|
42
|
+
* - Dependency injection for tool functions
|
|
43
|
+
*/
|
|
44
|
+
export class MeshAgent {
|
|
45
|
+
server;
|
|
46
|
+
config;
|
|
47
|
+
agentId;
|
|
48
|
+
tools = new Map();
|
|
49
|
+
/**
|
|
50
|
+
* Maps LLM provider tool names to their vendor (e.g., "process_chat" -> "anthropic").
|
|
51
|
+
* TODO: Use for provider metrics, health checks, or exposing via getLlmProviderVendor() getter.
|
|
52
|
+
* Currently populated by addLlmProvider() for future introspection needs.
|
|
53
|
+
*/
|
|
54
|
+
llmProviderVendors = new Map();
|
|
55
|
+
handle = null;
|
|
56
|
+
started = false;
|
|
57
|
+
tracingEnabled = false;
|
|
58
|
+
/**
|
|
59
|
+
* Resolved dependencies: composite key -> proxy
|
|
60
|
+
* Key format: "${toolName}:dep_${depIndex}" (e.g., "myTool:dep_0")
|
|
61
|
+
* Updated when dependency_available/unavailable events arrive.
|
|
62
|
+
*
|
|
63
|
+
* This allows multiple tools to depend on the same capability with
|
|
64
|
+
* different tags/settings without overwriting each other.
|
|
65
|
+
*/
|
|
66
|
+
resolvedDeps = new Map();
|
|
67
|
+
constructor(server, config) {
|
|
68
|
+
this.server = server;
|
|
69
|
+
// Resolve config with env var precedence: ENV > config > defaults
|
|
70
|
+
this.config = resolveConfig(config);
|
|
71
|
+
// Generate unique agent ID with suffix (e.g., "calculator-a1b2c3d4")
|
|
72
|
+
this.agentId = `${this.config.name}-${generateAgentIdSuffix()}`;
|
|
73
|
+
// Register as pending agent for auto-start
|
|
74
|
+
pendingAgent = this;
|
|
75
|
+
scheduleAutoStart();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Add a tool to the agent.
|
|
79
|
+
*
|
|
80
|
+
* This registers the tool with both fastmcp (for MCP protocol) and
|
|
81
|
+
* the mesh (for capability discovery). If the tool has dependencies,
|
|
82
|
+
* they will be injected positionally at runtime.
|
|
83
|
+
*/
|
|
84
|
+
addTool(def) {
|
|
85
|
+
const toolName = def.name;
|
|
86
|
+
const execute = def.execute;
|
|
87
|
+
// Normalize dependencies
|
|
88
|
+
const normalizedDeps = (def.dependencies ?? []).map(normalizeDependency);
|
|
89
|
+
const depEndpoints = normalizedDeps.map((d) => d.capability);
|
|
90
|
+
// Create wrapper that injects dependencies positionally and handles tracing
|
|
91
|
+
const wrappedExecute = async (args) => {
|
|
92
|
+
// Build positional deps array using composite keys (toolName:dep_index)
|
|
93
|
+
const depsArray = normalizedDeps.map((_, depIndex) => this.resolvedDeps.get(`${toolName}:dep_${depIndex}`) ?? null);
|
|
94
|
+
const injectedCount = depsArray.filter((d) => d !== null).length;
|
|
95
|
+
// Extract trace context from arguments (injected by upstream proxy)
|
|
96
|
+
// This is the fallback mechanism since fastmcp doesn't expose HTTP headers
|
|
97
|
+
let incomingTraceId = null;
|
|
98
|
+
let incomingParentSpan = null;
|
|
99
|
+
let cleanArgs = args;
|
|
100
|
+
if (args && typeof args === "object") {
|
|
101
|
+
const argsObj = args;
|
|
102
|
+
if (typeof argsObj._trace_id === "string") {
|
|
103
|
+
incomingTraceId = argsObj._trace_id;
|
|
104
|
+
}
|
|
105
|
+
if (typeof argsObj._parent_span === "string") {
|
|
106
|
+
incomingParentSpan = argsObj._parent_span;
|
|
107
|
+
}
|
|
108
|
+
// Remove trace context from args before passing to tool
|
|
109
|
+
if (incomingTraceId || incomingParentSpan) {
|
|
110
|
+
const { _trace_id, _parent_span, ...rest } = argsObj;
|
|
111
|
+
cleanArgs = rest;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Use incoming trace context or generate new one
|
|
115
|
+
const traceId = incomingTraceId ?? generateTraceId();
|
|
116
|
+
const spanId = generateSpanId();
|
|
117
|
+
const parentSpanId = incomingParentSpan ?? null;
|
|
118
|
+
const traceContext = { traceId, parentSpanId: spanId };
|
|
119
|
+
const startTime = Date.now() / 1000;
|
|
120
|
+
let success = true;
|
|
121
|
+
let error = null;
|
|
122
|
+
let resultType = "string";
|
|
123
|
+
try {
|
|
124
|
+
// Run tool execution within trace context using AsyncLocalStorage
|
|
125
|
+
// This ensures trace context is properly propagated to all async operations
|
|
126
|
+
// and isolated between concurrent requests
|
|
127
|
+
const result = await runWithTraceContext(traceContext, async () => {
|
|
128
|
+
return await execute(cleanArgs, ...depsArray);
|
|
129
|
+
});
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
success = false;
|
|
134
|
+
error = err instanceof Error ? err.message : String(err);
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
// Publish span (fire and forget)
|
|
139
|
+
if (this.tracingEnabled) {
|
|
140
|
+
const endTime = Date.now() / 1000;
|
|
141
|
+
const durationMs = (endTime - startTime) * 1000;
|
|
142
|
+
publishTraceSpan({
|
|
143
|
+
traceId,
|
|
144
|
+
spanId,
|
|
145
|
+
parentSpan: parentSpanId,
|
|
146
|
+
functionName: toolName,
|
|
147
|
+
startTime,
|
|
148
|
+
endTime,
|
|
149
|
+
durationMs,
|
|
150
|
+
success,
|
|
151
|
+
error,
|
|
152
|
+
resultType,
|
|
153
|
+
argsCount: 0,
|
|
154
|
+
kwargsCount: typeof cleanArgs === "object" ? Object.keys(cleanArgs).length : 0,
|
|
155
|
+
dependencies: depEndpoints,
|
|
156
|
+
injectedDependencies: injectedCount,
|
|
157
|
+
meshPositions: [],
|
|
158
|
+
}).catch(() => {
|
|
159
|
+
// Silently ignore publish errors
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
// Register with fastmcp
|
|
165
|
+
// Use passthrough() to allow trace context fields (_trace_id, _parent_span)
|
|
166
|
+
// to pass through Zod validation without being stripped
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
|
+
const schema = def.parameters;
|
|
169
|
+
const parametersWithPassthrough = typeof schema.passthrough === "function"
|
|
170
|
+
? schema.passthrough()
|
|
171
|
+
: def.parameters;
|
|
172
|
+
this.server.addTool({
|
|
173
|
+
name: toolName,
|
|
174
|
+
description: def.description,
|
|
175
|
+
parameters: parametersWithPassthrough,
|
|
176
|
+
execute: wrappedExecute,
|
|
177
|
+
});
|
|
178
|
+
// Store mesh metadata with JSON Schema for LLM tool resolution
|
|
179
|
+
const inputSchema = this.convertZodToJsonSchema(def.parameters);
|
|
180
|
+
this.tools.set(toolName, {
|
|
181
|
+
capability: def.capability ?? toolName,
|
|
182
|
+
version: def.version ?? "1.0.0",
|
|
183
|
+
tags: def.tags ?? [],
|
|
184
|
+
description: def.description ?? "",
|
|
185
|
+
inputSchema: JSON.stringify(inputSchema),
|
|
186
|
+
dependencies: normalizedDeps,
|
|
187
|
+
dependencyKwargs: def.dependencyKwargs,
|
|
188
|
+
});
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Add an LLM provider to the agent.
|
|
193
|
+
*
|
|
194
|
+
* This creates a zero-code LLM provider that other agents can use
|
|
195
|
+
* via mesh delegation.
|
|
196
|
+
*
|
|
197
|
+
* @param config - LLM provider configuration
|
|
198
|
+
* @returns This agent for chaining
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* agent.addLlmProvider({
|
|
203
|
+
* model: "anthropic/claude-sonnet-4-5",
|
|
204
|
+
* capability: "llm",
|
|
205
|
+
* tags: ["llm", "claude", "anthropic", "provider"],
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
addLlmProvider(config) {
|
|
210
|
+
// Create the LLM provider tool definition
|
|
211
|
+
const toolDef = llmProvider(config);
|
|
212
|
+
// Add to FastMCP server
|
|
213
|
+
this.server.addTool({
|
|
214
|
+
name: toolDef.name,
|
|
215
|
+
description: toolDef.description,
|
|
216
|
+
parameters: toolDef.parameters,
|
|
217
|
+
execute: toolDef.execute,
|
|
218
|
+
});
|
|
219
|
+
// Get mesh metadata from the tool definition
|
|
220
|
+
const meta = getLlmProviderMeta(toolDef);
|
|
221
|
+
if (meta) {
|
|
222
|
+
// Store mesh metadata with JSON Schema for registry
|
|
223
|
+
const inputSchema = this.convertZodToJsonSchema(toolDef.parameters);
|
|
224
|
+
this.tools.set(toolDef.name, {
|
|
225
|
+
capability: meta.capability,
|
|
226
|
+
version: meta.version,
|
|
227
|
+
tags: meta.tags,
|
|
228
|
+
description: toolDef.description,
|
|
229
|
+
inputSchema: JSON.stringify(inputSchema),
|
|
230
|
+
dependencies: [],
|
|
231
|
+
dependencyKwargs: undefined,
|
|
232
|
+
});
|
|
233
|
+
// Store vendor for provider handler selection
|
|
234
|
+
this.llmProviderVendors.set(toolDef.name, meta.vendor);
|
|
235
|
+
}
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Convert Zod schema to JSON Schema.
|
|
240
|
+
*/
|
|
241
|
+
convertZodToJsonSchema(schema) {
|
|
242
|
+
return zodToJsonSchema(schema, { $refStrategy: "none" });
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Internal: Start the agent (called by auto-start mechanism).
|
|
246
|
+
*/
|
|
247
|
+
async _autoStart() {
|
|
248
|
+
if (this.started)
|
|
249
|
+
return;
|
|
250
|
+
this.started = true;
|
|
251
|
+
console.log(`Starting MCP Mesh agent: ${this.agentId}`);
|
|
252
|
+
// 0. Initialize distributed tracing
|
|
253
|
+
const agentMetadata = {
|
|
254
|
+
agentId: this.agentId,
|
|
255
|
+
agentName: this.config.name,
|
|
256
|
+
agentNamespace: this.config.namespace,
|
|
257
|
+
agentHostname: this.config.host,
|
|
258
|
+
agentIp: this.config.host,
|
|
259
|
+
agentPort: this.config.port,
|
|
260
|
+
agentEndpoint: `http://${this.config.host}:${this.config.port}`,
|
|
261
|
+
};
|
|
262
|
+
this.tracingEnabled = await initTracing(agentMetadata);
|
|
263
|
+
// 1. Start HTTP server via fastmcp
|
|
264
|
+
// Note: fastmcp.start() is async and starts the server
|
|
265
|
+
// Use stateless mode so meshctl can call without sessions
|
|
266
|
+
await this.server.start({
|
|
267
|
+
transportType: "httpStream",
|
|
268
|
+
httpStream: {
|
|
269
|
+
port: this.config.port,
|
|
270
|
+
host: "0.0.0.0", // Listen on all interfaces so external IPs work
|
|
271
|
+
stateless: true,
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
console.log(`Agent listening on port ${this.config.port}`);
|
|
275
|
+
// 2. Register LLM tools from LlmToolRegistry
|
|
276
|
+
this.registerLlmTools();
|
|
277
|
+
// 3. Start heartbeat to registry via Rust core
|
|
278
|
+
await this.startHeartbeat();
|
|
279
|
+
// 4. Install signal handlers for graceful shutdown
|
|
280
|
+
this.installSignalHandlers();
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Register LLM tools from LlmToolRegistry.
|
|
284
|
+
* This adds tool metadata for LLM tools created via mesh.llm().
|
|
285
|
+
*/
|
|
286
|
+
registerLlmTools() {
|
|
287
|
+
const registry = LlmToolRegistry.getInstance();
|
|
288
|
+
const configs = registry.getAllConfigs();
|
|
289
|
+
for (const [, config] of configs) {
|
|
290
|
+
// Only register if not already in tools map
|
|
291
|
+
if (this.tools.has(config.name))
|
|
292
|
+
continue;
|
|
293
|
+
this.tools.set(config.name, {
|
|
294
|
+
capability: config.capability,
|
|
295
|
+
version: config.version,
|
|
296
|
+
tags: config.tags,
|
|
297
|
+
description: config.description,
|
|
298
|
+
inputSchema: config.inputSchema,
|
|
299
|
+
dependencies: [], // LLM tools get their deps via llm_tools_updated events
|
|
300
|
+
dependencyKwargs: undefined,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Install signal handlers for graceful shutdown.
|
|
306
|
+
* Ensures agent unregisters from registry on SIGINT/SIGTERM.
|
|
307
|
+
*/
|
|
308
|
+
installSignalHandlers() {
|
|
309
|
+
let shuttingDown = false;
|
|
310
|
+
const shutdownHandler = (signal) => {
|
|
311
|
+
if (shuttingDown)
|
|
312
|
+
return;
|
|
313
|
+
shuttingDown = true;
|
|
314
|
+
console.log(`\nReceived ${signal}, shutting down agent ${this.agentId}...`);
|
|
315
|
+
// Use setImmediate to avoid blocking the async runtime
|
|
316
|
+
setImmediate(async () => {
|
|
317
|
+
try {
|
|
318
|
+
await this.shutdown();
|
|
319
|
+
console.log(`Agent ${this.agentId} unregistered from registry`);
|
|
320
|
+
}
|
|
321
|
+
catch (err) {
|
|
322
|
+
console.error("Error during shutdown:", err);
|
|
323
|
+
}
|
|
324
|
+
process.exit(0);
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
process.on("SIGINT", () => shutdownHandler("SIGINT"));
|
|
328
|
+
process.on("SIGTERM", () => shutdownHandler("SIGTERM"));
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Start the Rust core heartbeat loop.
|
|
332
|
+
*/
|
|
333
|
+
async startHeartbeat() {
|
|
334
|
+
// Get LLM tool registry for llmFilter/llmProvider
|
|
335
|
+
const llmRegistry = LlmToolRegistry.getInstance();
|
|
336
|
+
// Build the agent spec for Rust core
|
|
337
|
+
const tools = Array.from(this.tools.entries()).map(([name, meta]) => {
|
|
338
|
+
// Check if this tool has LLM config
|
|
339
|
+
const llmConfig = llmRegistry.getConfig(name);
|
|
340
|
+
// Build llmFilter as JSON string (like Python does)
|
|
341
|
+
let llmFilter;
|
|
342
|
+
if (llmConfig?.filter && llmConfig.filter.length > 0) {
|
|
343
|
+
llmFilter = JSON.stringify({
|
|
344
|
+
filter: llmConfig.filter,
|
|
345
|
+
filter_mode: llmConfig.filterMode,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
// Build llmProvider as JSON string (like Python does)
|
|
349
|
+
let llmProvider;
|
|
350
|
+
if (llmConfig?.provider && typeof llmConfig.provider === "object") {
|
|
351
|
+
llmProvider = JSON.stringify({
|
|
352
|
+
capability: llmConfig.provider.capability,
|
|
353
|
+
tags: llmConfig.provider.tags ?? [],
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
functionName: name,
|
|
358
|
+
capability: meta.capability,
|
|
359
|
+
version: meta.version,
|
|
360
|
+
tags: meta.tags,
|
|
361
|
+
description: meta.description,
|
|
362
|
+
// Pass dependencies to Rust core for registry resolution
|
|
363
|
+
dependencies: meta.dependencies.map((dep) => ({
|
|
364
|
+
capability: dep.capability,
|
|
365
|
+
tags: dep.tags,
|
|
366
|
+
version: dep.version,
|
|
367
|
+
})),
|
|
368
|
+
inputSchema: meta.inputSchema,
|
|
369
|
+
// LLM filter/provider as JSON strings (matches Python format)
|
|
370
|
+
llmFilter,
|
|
371
|
+
llmProvider,
|
|
372
|
+
};
|
|
373
|
+
});
|
|
374
|
+
// Build LLM agent specs for tools using mesh.llm()
|
|
375
|
+
const llmAgentSpecs = buildLlmAgentSpecs();
|
|
376
|
+
const llmAgents = llmAgentSpecs.length > 0
|
|
377
|
+
? llmAgentSpecs.map((spec) => ({
|
|
378
|
+
functionId: spec.functionId,
|
|
379
|
+
provider: spec.provider,
|
|
380
|
+
filter: spec.filter,
|
|
381
|
+
filterMode: spec.filterMode,
|
|
382
|
+
maxIterations: spec.maxIterations,
|
|
383
|
+
}))
|
|
384
|
+
: undefined;
|
|
385
|
+
const spec = {
|
|
386
|
+
name: this.agentId,
|
|
387
|
+
version: this.config.version,
|
|
388
|
+
description: this.config.description,
|
|
389
|
+
registryUrl: this.config.registryUrl,
|
|
390
|
+
httpPort: this.config.port,
|
|
391
|
+
httpHost: this.config.host,
|
|
392
|
+
namespace: this.config.namespace,
|
|
393
|
+
tools,
|
|
394
|
+
llmAgents,
|
|
395
|
+
heartbeatInterval: this.config.heartbeatInterval,
|
|
396
|
+
};
|
|
397
|
+
// Start the agent via Rust core
|
|
398
|
+
this.handle = startAgent(spec);
|
|
399
|
+
// Count total dependencies
|
|
400
|
+
const totalDeps = tools.reduce((sum, t) => sum + t.dependencies.length, 0);
|
|
401
|
+
console.log(`Registered ${tools.length} capabilities with registry (${totalDeps} dependencies)`);
|
|
402
|
+
// Start event loop (runs in background)
|
|
403
|
+
this.runEventLoop();
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Run the event loop to handle mesh events.
|
|
407
|
+
*/
|
|
408
|
+
async runEventLoop() {
|
|
409
|
+
if (!this.handle)
|
|
410
|
+
return;
|
|
411
|
+
while (true) {
|
|
412
|
+
try {
|
|
413
|
+
const event = await this.handle.nextEvent();
|
|
414
|
+
switch (event.eventType) {
|
|
415
|
+
case "agent_registered":
|
|
416
|
+
console.log(`Agent registered with ID: ${event.agentId}`);
|
|
417
|
+
break;
|
|
418
|
+
case "registration_failed":
|
|
419
|
+
console.error(`Registration failed: ${event.error}`);
|
|
420
|
+
break;
|
|
421
|
+
case "dependency_available":
|
|
422
|
+
this.handleDependencyAvailable(event.capability, event.endpoint, event.functionName, event.agentId, event.requestingFunction, event.depIndex);
|
|
423
|
+
break;
|
|
424
|
+
case "dependency_unavailable":
|
|
425
|
+
this.handleDependencyUnavailable(event.capability, event.requestingFunction, event.depIndex);
|
|
426
|
+
break;
|
|
427
|
+
case "dependency_changed":
|
|
428
|
+
// Handle as available with new endpoint
|
|
429
|
+
this.handleDependencyAvailable(event.capability, event.endpoint, event.functionName, event.agentId, event.requestingFunction, event.depIndex);
|
|
430
|
+
break;
|
|
431
|
+
case "registry_connected":
|
|
432
|
+
console.log("Connected to registry");
|
|
433
|
+
break;
|
|
434
|
+
case "registry_disconnected":
|
|
435
|
+
console.warn(`Disconnected from registry: ${event.reason}`);
|
|
436
|
+
break;
|
|
437
|
+
case "llm_tools_updated":
|
|
438
|
+
// Handle LLM tools update
|
|
439
|
+
if (event.functionId && event.tools) {
|
|
440
|
+
handleLlmToolsUpdated(event.functionId, event.tools.map((t) => ({
|
|
441
|
+
functionName: t.functionName,
|
|
442
|
+
capability: t.capability,
|
|
443
|
+
endpoint: t.endpoint,
|
|
444
|
+
agentId: t.agentId,
|
|
445
|
+
inputSchema: t.inputSchema,
|
|
446
|
+
})));
|
|
447
|
+
}
|
|
448
|
+
break;
|
|
449
|
+
case "llm_provider_available":
|
|
450
|
+
// Handle LLM provider available
|
|
451
|
+
// Note: functionId is inside providerInfo, not on event root
|
|
452
|
+
if (event.providerInfo) {
|
|
453
|
+
const funcId = event.functionId || event.providerInfo.functionId;
|
|
454
|
+
if (funcId) {
|
|
455
|
+
handleLlmProviderAvailable(funcId, {
|
|
456
|
+
agentId: event.providerInfo.agentId,
|
|
457
|
+
endpoint: event.providerInfo.endpoint,
|
|
458
|
+
functionName: event.providerInfo.functionName,
|
|
459
|
+
model: event.providerInfo.model,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
break;
|
|
464
|
+
case "llm_provider_unavailable":
|
|
465
|
+
// Handle LLM provider unavailable
|
|
466
|
+
if (event.functionId) {
|
|
467
|
+
handleLlmProviderUnavailable(event.functionId);
|
|
468
|
+
}
|
|
469
|
+
break;
|
|
470
|
+
case "shutdown":
|
|
471
|
+
console.log("Agent shutting down");
|
|
472
|
+
return;
|
|
473
|
+
default:
|
|
474
|
+
// Handle other events as needed
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
catch (err) {
|
|
479
|
+
console.error("Event loop error:", err);
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Handle dependency_available event.
|
|
486
|
+
* Creates proxy at the exact position specified by the event.
|
|
487
|
+
*
|
|
488
|
+
* The Rust core now sends events with requestingFunction and depIndex,
|
|
489
|
+
* so we can directly create the proxy at the correct position without
|
|
490
|
+
* needing to match by capability.
|
|
491
|
+
*/
|
|
492
|
+
handleDependencyAvailable(capability, endpoint, functionName, agentId, requestingFunction, depIndex) {
|
|
493
|
+
// If we have position info, use it directly (new behavior)
|
|
494
|
+
if (requestingFunction !== undefined && depIndex !== undefined) {
|
|
495
|
+
const meta = this.tools.get(requestingFunction);
|
|
496
|
+
const kwargs = meta?.dependencyKwargs?.[depIndex];
|
|
497
|
+
const depKey = `${requestingFunction}:dep_${depIndex}`;
|
|
498
|
+
const proxy = createProxy(endpoint, capability, functionName, kwargs);
|
|
499
|
+
this.resolvedDeps.set(depKey, proxy);
|
|
500
|
+
console.log(`Dependency available: ${capability} at ${endpoint} (tool: ${requestingFunction}, index: ${depIndex}, agent: ${agentId})`);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
// Fallback for backward compatibility (old events without position info)
|
|
504
|
+
// Iterate through all tools and their dependencies
|
|
505
|
+
let matchCount = 0;
|
|
506
|
+
for (const [toolName, meta] of this.tools.entries()) {
|
|
507
|
+
if (!meta.dependencies)
|
|
508
|
+
continue;
|
|
509
|
+
meta.dependencies.forEach((dep, idx) => {
|
|
510
|
+
if (dep.capability === capability) {
|
|
511
|
+
const kwargs = meta.dependencyKwargs?.[idx];
|
|
512
|
+
const depKey = `${toolName}:dep_${idx}`;
|
|
513
|
+
const proxy = createProxy(endpoint, capability, functionName, kwargs);
|
|
514
|
+
this.resolvedDeps.set(depKey, proxy);
|
|
515
|
+
matchCount++;
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
console.log(`Dependency available: ${capability} at ${endpoint} (agent: ${agentId}, ${matchCount} tool bindings)`);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Handle dependency_unavailable event.
|
|
523
|
+
* Removes proxy at the exact position specified by the event.
|
|
524
|
+
*/
|
|
525
|
+
handleDependencyUnavailable(capability, requestingFunction, depIndex) {
|
|
526
|
+
// If we have position info, use it directly (new behavior)
|
|
527
|
+
if (requestingFunction !== undefined && depIndex !== undefined) {
|
|
528
|
+
const depKey = `${requestingFunction}:dep_${depIndex}`;
|
|
529
|
+
this.resolvedDeps.delete(depKey);
|
|
530
|
+
console.log(`Dependency unavailable: ${capability} (tool: ${requestingFunction}, index: ${depIndex})`);
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
// Fallback for backward compatibility (old events without position info)
|
|
534
|
+
let removeCount = 0;
|
|
535
|
+
for (const [toolName, meta] of this.tools.entries()) {
|
|
536
|
+
if (!meta.dependencies)
|
|
537
|
+
continue;
|
|
538
|
+
meta.dependencies.forEach((dep, idx) => {
|
|
539
|
+
if (dep.capability === capability) {
|
|
540
|
+
const depKey = `${toolName}:dep_${idx}`;
|
|
541
|
+
this.resolvedDeps.delete(depKey);
|
|
542
|
+
removeCount++;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
console.log(`Dependency unavailable: ${capability} (${removeCount} tool bindings removed)`);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Get a resolved dependency proxy by capability name.
|
|
550
|
+
* Returns the first matching proxy if multiple tools depend on the same capability.
|
|
551
|
+
*
|
|
552
|
+
* For more precise lookup, use getDependencyByKey with composite key "toolName:dep_index".
|
|
553
|
+
*/
|
|
554
|
+
getDependency(capability) {
|
|
555
|
+
// Find first matching capability in any tool
|
|
556
|
+
for (const [toolName, meta] of this.tools.entries()) {
|
|
557
|
+
if (!meta.dependencies)
|
|
558
|
+
continue;
|
|
559
|
+
const depIndex = meta.dependencies.findIndex((d) => d.capability === capability);
|
|
560
|
+
if (depIndex >= 0) {
|
|
561
|
+
return this.resolvedDeps.get(`${toolName}:dep_${depIndex}`) ?? null;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Get a resolved dependency proxy by composite key.
|
|
568
|
+
*
|
|
569
|
+
* @param toolName - The tool name
|
|
570
|
+
* @param depIndex - The dependency index within that tool
|
|
571
|
+
* @returns The proxy or null if not available
|
|
572
|
+
*/
|
|
573
|
+
getDependencyByKey(toolName, depIndex) {
|
|
574
|
+
return this.resolvedDeps.get(`${toolName}:dep_${depIndex}`) ?? null;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Get all resolved dependencies.
|
|
578
|
+
*/
|
|
579
|
+
getAllDependencies() {
|
|
580
|
+
return new Map(this.resolvedDeps);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Get the agent handle for advanced operations.
|
|
584
|
+
*/
|
|
585
|
+
getHandle() {
|
|
586
|
+
return this.handle;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Get the resolved configuration.
|
|
590
|
+
*/
|
|
591
|
+
getConfig() {
|
|
592
|
+
return this.config;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Get the agent ID.
|
|
596
|
+
*/
|
|
597
|
+
getAgentId() {
|
|
598
|
+
return this.agentId;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Shutdown the agent gracefully.
|
|
602
|
+
*/
|
|
603
|
+
async shutdown() {
|
|
604
|
+
if (this.handle) {
|
|
605
|
+
await this.handle.shutdown();
|
|
606
|
+
this.handle = null;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Create a MeshAgent wrapping a FastMCP server.
|
|
612
|
+
*
|
|
613
|
+
* This is the main entry point for creating MCP Mesh agents.
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* ```typescript
|
|
617
|
+
* const agent = mesh(server, {
|
|
618
|
+
* name: "calculator",
|
|
619
|
+
* port: 9002,
|
|
620
|
+
* });
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
export function mesh(server, config) {
|
|
624
|
+
return new MeshAgent(server, config);
|
|
625
|
+
}
|
|
626
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,UAAU,GAMX,MAAM,eAAe,CAAC;AAWvB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,gBAAgB,GAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,yCAAyC;AACzC,IAAI,YAAY,GAAqB,IAAI,CAAC;AAC1C,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B,qDAAqD;AACrD,SAAS,iBAAiB;IACxB,IAAI,kBAAkB;QAAE,OAAO;IAC/B,kBAAkB,GAAG,IAAI,CAAC;IAE1B,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;QACpB,IAAI,YAAY,EAAE,CAAC;YACjB,YAAY,CAAC,UAAU,EAAE,CAAC,KAAK,C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