@dexto/core 1.6.25 → 1.6.27
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/agent/DextoAgent.cjs +102 -104
- package/dist/agent/DextoAgent.d.ts +11 -10
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +103 -105
- package/dist/agent/error-codes.cjs +1 -0
- package/dist/agent/error-codes.d.ts +1 -0
- package/dist/agent/error-codes.d.ts.map +1 -1
- package/dist/agent/error-codes.js +1 -0
- package/dist/agent/errors.cjs +13 -0
- package/dist/agent/errors.d.ts +6 -0
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/errors.js +13 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/schemas.d.ts +2 -2
- package/dist/agent/types.d.ts +11 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/approval/factory.cjs +1 -0
- package/dist/approval/factory.d.ts.map +1 -1
- package/dist/approval/factory.js +1 -0
- package/dist/approval/manager.cjs +345 -182
- package/dist/approval/manager.d.ts +45 -31
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +345 -182
- package/dist/approval/schemas.cjs +10 -0
- package/dist/approval/schemas.d.ts +305 -0
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +10 -0
- package/dist/approval/session-approval-store.cjs +91 -0
- package/dist/approval/session-approval-store.d.ts +55 -0
- package/dist/approval/session-approval-store.d.ts.map +1 -0
- package/dist/approval/session-approval-store.js +68 -0
- package/dist/events/index.cjs +210 -75
- package/dist/events/index.d.ts +44 -181
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +206 -74
- package/dist/hooks/manager.cjs +5 -2
- package/dist/hooks/manager.d.ts +2 -0
- package/dist/hooks/manager.d.ts.map +1 -1
- package/dist/hooks/manager.js +5 -2
- package/dist/hooks/types.d.ts +3 -0
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/llm/executor/turn-executor.cjs +15 -7
- package/dist/llm/executor/turn-executor.d.ts +3 -1
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +15 -7
- package/dist/llm/services/factory.cjs +10 -4
- package/dist/llm/services/factory.d.ts +2 -21
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +11 -7
- package/dist/llm/services/types.d.ts +33 -2
- package/dist/llm/services/types.d.ts.map +1 -1
- package/dist/llm/services/vercel.cjs +33 -11
- package/dist/llm/services/vercel.d.ts +6 -3
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +29 -8
- package/dist/logger/default-logger-factory.d.ts +12 -12
- package/dist/logger/v2/schemas.d.ts +6 -6
- package/dist/mcp/manager.cjs +7 -2
- package/dist/mcp/manager.d.ts +3 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +7 -2
- package/dist/mcp/mcp-client.cjs +71 -62
- package/dist/mcp/mcp-client.d.ts +3 -2
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +71 -62
- package/dist/mcp/schemas.d.ts +10 -10
- package/dist/resources/handlers/filesystem-handler.cjs +22 -3
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +22 -3
- package/dist/runtime/host-runtime.cjs +163 -0
- package/dist/runtime/host-runtime.d.ts +23 -0
- package/dist/runtime/host-runtime.d.ts.map +1 -0
- package/dist/runtime/host-runtime.js +133 -0
- package/dist/runtime/index.cjs +42 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +21 -0
- package/dist/runtime/run-context.cjs +53 -0
- package/dist/runtime/run-context.d.ts +13 -0
- package/dist/runtime/run-context.d.ts.map +1 -0
- package/dist/runtime/run-context.js +34 -0
- package/dist/session/chat-session.cjs +67 -71
- package/dist/session/chat-session.d.ts +25 -25
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +68 -72
- package/dist/session/error-codes.cjs +1 -0
- package/dist/session/error-codes.d.ts +2 -1
- package/dist/session/error-codes.d.ts.map +1 -1
- package/dist/session/error-codes.js +1 -0
- package/dist/session/errors.cjs +13 -0
- package/dist/session/errors.d.ts +6 -0
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/errors.js +13 -0
- package/dist/session/message-queue-store.cjs +75 -0
- package/dist/session/message-queue-store.d.ts +16 -0
- package/dist/session/message-queue-store.d.ts.map +1 -0
- package/dist/session/message-queue-store.js +52 -0
- package/dist/session/message-queue.cjs +140 -46
- package/dist/session/message-queue.d.ts +18 -6
- package/dist/session/message-queue.d.ts.map +1 -1
- package/dist/session/message-queue.js +140 -46
- package/dist/session/session-manager.cjs +130 -25
- package/dist/session/session-manager.d.ts +18 -1
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +130 -25
- package/dist/session/title-generator.cjs +9 -2
- package/dist/session/title-generator.d.ts +2 -0
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/title-generator.js +9 -2
- package/dist/telemetry/decorators.cjs +75 -57
- package/dist/telemetry/decorators.d.ts +2 -0
- package/dist/telemetry/decorators.d.ts.map +1 -1
- package/dist/telemetry/decorators.js +75 -57
- package/dist/telemetry/errors.cjs +2 -2
- package/dist/telemetry/errors.js +2 -2
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +3 -1
- package/dist/telemetry/telemetry.cjs +62 -21
- package/dist/telemetry/telemetry.d.ts +14 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/telemetry/telemetry.js +62 -21
- package/dist/telemetry/utils.cjs +9 -6
- package/dist/telemetry/utils.d.ts +3 -0
- package/dist/telemetry/utils.d.ts.map +1 -1
- package/dist/telemetry/utils.js +9 -6
- package/dist/test-utils/session-state-stores.cjs +68 -0
- package/dist/test-utils/session-state-stores.js +42 -0
- package/dist/tools/session-tool-preferences-store.cjs +86 -0
- package/dist/tools/session-tool-preferences-store.d.ts +29 -0
- package/dist/tools/session-tool-preferences-store.d.ts.map +1 -0
- package/dist/tools/session-tool-preferences-store.js +63 -0
- package/dist/tools/tool-manager.cjs +223 -68
- package/dist/tools/tool-manager.d.ts +29 -9
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +223 -68
- package/dist/tools/types.d.ts +7 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/service-initializer.cjs +38 -5
- package/dist/utils/service-initializer.d.ts +11 -1
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +36 -4
- package/package.json +1 -1
package/dist/mcp/manager.cjs
CHANGED
|
@@ -387,9 +387,10 @@ class MCPManager {
|
|
|
387
387
|
* @param toolName Name of the MCP tool to execute (may include server prefix)
|
|
388
388
|
* @param args Arguments to pass to the tool
|
|
389
389
|
* @param sessionId Optional session ID
|
|
390
|
+
* @param runContext Optional execution-scoped context for this tool call
|
|
390
391
|
* @returns Promise resolving to the tool execution result
|
|
391
392
|
*/
|
|
392
|
-
async executeTool(toolName, args,
|
|
393
|
+
async executeTool(toolName, args, sessionId, runContext) {
|
|
393
394
|
const client = this.getToolClient(toolName);
|
|
394
395
|
if (!client) {
|
|
395
396
|
this.logger.error(`\u274C No MCP tool found: ${toolName}`);
|
|
@@ -406,7 +407,11 @@ class MCPManager {
|
|
|
406
407
|
`\u25B6\uFE0F Executing MCP tool '${actualToolName}' on server '${serverName}'...`
|
|
407
408
|
);
|
|
408
409
|
try {
|
|
409
|
-
const
|
|
410
|
+
const invocation = sessionId !== void 0 || runContext !== void 0 ? {
|
|
411
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
412
|
+
...runContext !== void 0 ? { runContext } : {}
|
|
413
|
+
} : void 0;
|
|
414
|
+
const result = await client.callTool(actualToolName, args, invocation);
|
|
410
415
|
return result;
|
|
411
416
|
} catch (error) {
|
|
412
417
|
this.logger.error(
|
package/dist/mcp/manager.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { type AgentEventBus } from '../events/index.js';
|
|
|
7
7
|
import type { PromptDefinition } from '../prompts/types.js';
|
|
8
8
|
import type { JSONSchema7 } from 'json-schema';
|
|
9
9
|
import type { ApprovalManager } from '../approval/manager.js';
|
|
10
|
+
import type { AgentRunContext } from '../runtime/run-context.js';
|
|
10
11
|
type ToolCacheEntry = {
|
|
11
12
|
serverName: string;
|
|
12
13
|
client: McpClient;
|
|
@@ -130,9 +131,10 @@ export declare class MCPManager {
|
|
|
130
131
|
* @param toolName Name of the MCP tool to execute (may include server prefix)
|
|
131
132
|
* @param args Arguments to pass to the tool
|
|
132
133
|
* @param sessionId Optional session ID
|
|
134
|
+
* @param runContext Optional execution-scoped context for this tool call
|
|
133
135
|
* @returns Promise resolving to the tool execution result
|
|
134
136
|
*/
|
|
135
|
-
executeTool(toolName: string, args: any,
|
|
137
|
+
executeTool(toolName: string, args: any, sessionId?: string, runContext?: AgentRunContext): Promise<any>;
|
|
136
138
|
/**
|
|
137
139
|
* Get all available prompt names from all connected clients, updating the cache.
|
|
138
140
|
* @returns Promise resolving to an array of unique prompt names.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/mcp/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EACR,eAAe,EACf,kBAAkB,EAErB,MAAM,oCAAo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,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwClF;;;OAGG;IACH,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;IAIpC;;;OAGG;IACH,oBAAoB,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;IAI7E,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI1D,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI9D,eAAe,CAAC,IAAI,EAAE,MAAM;IAQ5B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAInE;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAc9B;;;OAGG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B/C;;;;OAIG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuEhD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBpC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA4BhC;;OAEG;YACW,qBAAqB;IAuCnC;;OAEG;YACW,wBAAwB;IAkDtC;;OAEG;YACW,sBAAsB;CA4HvC"}
|
package/dist/mcp/manager.js
CHANGED
|
@@ -365,9 +365,10 @@ class MCPManager {
|
|
|
365
365
|
* @param toolName Name of the MCP tool to execute (may include server prefix)
|
|
366
366
|
* @param args Arguments to pass to the tool
|
|
367
367
|
* @param sessionId Optional session ID
|
|
368
|
+
* @param runContext Optional execution-scoped context for this tool call
|
|
368
369
|
* @returns Promise resolving to the tool execution result
|
|
369
370
|
*/
|
|
370
|
-
async executeTool(toolName, args,
|
|
371
|
+
async executeTool(toolName, args, sessionId, runContext) {
|
|
371
372
|
const client = this.getToolClient(toolName);
|
|
372
373
|
if (!client) {
|
|
373
374
|
this.logger.error(`\u274C No MCP tool found: ${toolName}`);
|
|
@@ -384,7 +385,11 @@ class MCPManager {
|
|
|
384
385
|
`\u25B6\uFE0F Executing MCP tool '${actualToolName}' on server '${serverName}'...`
|
|
385
386
|
);
|
|
386
387
|
try {
|
|
387
|
-
const
|
|
388
|
+
const invocation = sessionId !== void 0 || runContext !== void 0 ? {
|
|
389
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
390
|
+
...runContext !== void 0 ? { runContext } : {}
|
|
391
|
+
} : void 0;
|
|
392
|
+
const result = await client.callTool(actualToolName, args, invocation);
|
|
388
393
|
return result;
|
|
389
394
|
} catch (error) {
|
|
390
395
|
this.logger.error(
|
package/dist/mcp/mcp-client.cjs
CHANGED
|
@@ -22,6 +22,7 @@ __export(mcp_client_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(mcp_client_exports);
|
|
24
24
|
var import_client = require("@modelcontextprotocol/sdk/client/index.js");
|
|
25
|
+
var import_async_hooks = require("async_hooks");
|
|
25
26
|
var import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
26
27
|
var import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
27
28
|
var import_streamableHttp = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
@@ -49,6 +50,7 @@ function buildClientCapabilities() {
|
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
class DextoMcpClient extends import_events.EventEmitter {
|
|
53
|
+
toolInvocationContext = new import_async_hooks.AsyncLocalStorage();
|
|
52
54
|
client = null;
|
|
53
55
|
transport = null;
|
|
54
56
|
isConnected = false;
|
|
@@ -322,71 +324,75 @@ class DextoMcpClient extends import_events.EventEmitter {
|
|
|
322
324
|
* @param args Tool arguments
|
|
323
325
|
* @returns Result of the tool execution
|
|
324
326
|
*/
|
|
325
|
-
async callTool(name, args) {
|
|
327
|
+
async callTool(name, args, invocation) {
|
|
326
328
|
this.ensureConnected();
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
this.logger.debug(`Calling tool '${name}' with args: ${JSON.stringify(args, null, 2)}`);
|
|
342
|
-
let toolArgs = args;
|
|
343
|
-
if (typeof args === "string") {
|
|
344
|
-
try {
|
|
345
|
-
toolArgs = JSON.parse(args);
|
|
346
|
-
} catch {
|
|
347
|
-
toolArgs = { input: args };
|
|
329
|
+
return await this.toolInvocationContext.run(invocation, async () => {
|
|
330
|
+
const shouldTrace = (0, import_utils.hasActiveTelemetry)();
|
|
331
|
+
const tracer = shouldTrace ? import_api.trace.getTracer("dexto") : null;
|
|
332
|
+
const span = tracer?.startSpan(`mcp.tool.${name}`, {
|
|
333
|
+
kind: import_api.SpanKind.CLIENT
|
|
334
|
+
});
|
|
335
|
+
try {
|
|
336
|
+
if (span) {
|
|
337
|
+
const ctx = import_api.trace.setSpan(import_api.context.active(), span);
|
|
338
|
+
(0, import_utils.addBaggageAttributesToSpan)(span, ctx, this.logger);
|
|
339
|
+
span.setAttribute("tool.name", name);
|
|
340
|
+
span.setAttribute("tool.server", this.serverAlias || "unknown");
|
|
341
|
+
span.setAttribute("tool.timeout", this.timeout);
|
|
342
|
+
span.setAttribute("tool.arguments", (0, import_safe_stringify.safeStringify)(args, 4096));
|
|
348
343
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const logResult = JSON.stringify(
|
|
359
|
-
result,
|
|
360
|
-
(key, value) => {
|
|
361
|
-
if (key === "data" && typeof value === "string" && value.length > 100) {
|
|
362
|
-
return `[Base64 data: ${value.length} chars]`;
|
|
344
|
+
this.logger.debug(
|
|
345
|
+
`Calling tool '${name}' with args: ${JSON.stringify(args, null, 2)}`
|
|
346
|
+
);
|
|
347
|
+
let toolArgs = args;
|
|
348
|
+
if (typeof args === "string") {
|
|
349
|
+
try {
|
|
350
|
+
toolArgs = JSON.parse(args);
|
|
351
|
+
} catch {
|
|
352
|
+
toolArgs = { input: args };
|
|
363
353
|
}
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
354
|
+
}
|
|
355
|
+
this.logger.debug(`Using timeout: ${this.timeout}`);
|
|
356
|
+
const result = await this.client.callTool(
|
|
357
|
+
{ name, arguments: toolArgs },
|
|
358
|
+
void 0,
|
|
359
|
+
// resultSchema (optional)
|
|
360
|
+
{ timeout: this.timeout }
|
|
361
|
+
// Use server-specific timeout, default 1 minute
|
|
362
|
+
);
|
|
363
|
+
const logResult = JSON.stringify(
|
|
364
|
+
result,
|
|
365
|
+
(key, value) => {
|
|
366
|
+
if (key === "data" && typeof value === "string" && value.length > 100) {
|
|
367
|
+
return `[Base64 data: ${value.length} chars]`;
|
|
368
|
+
}
|
|
369
|
+
return value;
|
|
370
|
+
},
|
|
371
|
+
2
|
|
372
|
+
);
|
|
373
|
+
this.logger.debug(`Tool '${name}' result: ${logResult}`);
|
|
374
|
+
if (span) {
|
|
375
|
+
span.setAttribute("tool.result", (0, import_safe_stringify.safeStringify)(result, 4096));
|
|
376
|
+
span.setStatus({ code: import_api.SpanStatusCode.OK });
|
|
377
|
+
}
|
|
378
|
+
if (result === null || result === void 0) {
|
|
379
|
+
return "Tool executed successfully with no result data.";
|
|
380
|
+
}
|
|
381
|
+
return result;
|
|
382
|
+
} catch (error) {
|
|
383
|
+
this.logger.error(`Tool call '${name}' failed: ${JSON.stringify(error, null, 2)}`);
|
|
384
|
+
if (span) {
|
|
385
|
+
span.recordException(error);
|
|
386
|
+
span.setStatus({
|
|
387
|
+
code: import_api.SpanStatusCode.ERROR,
|
|
388
|
+
message: error instanceof Error ? error.message : String(error)
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
return `Error executing tool '${name}': ${error instanceof Error ? error.message : String(error)}`;
|
|
392
|
+
} finally {
|
|
393
|
+
span?.end();
|
|
385
394
|
}
|
|
386
|
-
|
|
387
|
-
} finally {
|
|
388
|
-
span?.end();
|
|
389
|
-
}
|
|
395
|
+
});
|
|
390
396
|
}
|
|
391
397
|
/**
|
|
392
398
|
* Get the list of tools provided by this client
|
|
@@ -657,10 +663,13 @@ class DextoMcpClient extends import_events.EventEmitter {
|
|
|
657
663
|
);
|
|
658
664
|
return { action: "decline" };
|
|
659
665
|
}
|
|
666
|
+
const invocation = this.toolInvocationContext.getStore();
|
|
660
667
|
const response = await this.approvalManager.requestElicitation({
|
|
661
668
|
schema: params.requestedSchema,
|
|
662
669
|
prompt: params.message,
|
|
663
|
-
serverName: this.serverAlias || "unknown"
|
|
670
|
+
serverName: this.serverAlias || "unknown",
|
|
671
|
+
...invocation?.sessionId !== void 0 ? { sessionId: invocation.sessionId } : {},
|
|
672
|
+
...invocation?.runContext?.hostRuntime !== void 0 ? { hostRuntime: invocation.runContext.hostRuntime } : {}
|
|
664
673
|
});
|
|
665
674
|
if (response.status === import_types2.ApprovalStatus.APPROVED && response.data) {
|
|
666
675
|
const formData = response.data && typeof response.data === "object" && "formData" in response.data ? response.data.formData : {};
|
package/dist/mcp/mcp-client.d.ts
CHANGED
|
@@ -3,13 +3,14 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import type { Logger } from '../logger/v2/types.js';
|
|
4
4
|
import type { ApprovalManager } from '../approval/manager.js';
|
|
5
5
|
import type { ValidatedMcpServerConfig } from './schemas.js';
|
|
6
|
-
import type { ToolSet } from '../tools/types.js';
|
|
6
|
+
import type { ToolExecutionContextBase, ToolSet } from '../tools/types.js';
|
|
7
7
|
import type { McpClient, MCPResourceSummary, McpAuthProviderFactory } from './types.js';
|
|
8
8
|
import type { GetPromptResult, ReadResourceResult, Prompt } from '@modelcontextprotocol/sdk/types.js';
|
|
9
9
|
/**
|
|
10
10
|
* Wrapper on top of Client class provided in model context protocol SDK, to add additional metadata about the server
|
|
11
11
|
*/
|
|
12
12
|
export declare class DextoMcpClient extends EventEmitter implements McpClient {
|
|
13
|
+
private readonly toolInvocationContext;
|
|
13
14
|
private client;
|
|
14
15
|
private transport;
|
|
15
16
|
private isConnected;
|
|
@@ -52,7 +53,7 @@ export declare class DextoMcpClient extends EventEmitter implements McpClient {
|
|
|
52
53
|
* @param args Tool arguments
|
|
53
54
|
* @returns Result of the tool execution
|
|
54
55
|
*/
|
|
55
|
-
callTool(name: string, args: any): Promise<any>;
|
|
56
|
+
callTool(name: string, args: any, invocation?: Pick<ToolExecutionContextBase, 'sessionId' | 'runContext'>): Promise<any>;
|
|
56
57
|
/**
|
|
57
58
|
* Get the list of tools provided by this client
|
|
58
59
|
* @returns Array of available tools
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAMnE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9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G,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;QACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB;IAYD;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAO3C,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAsCjC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAK7B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAKhC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAK9B;;OAEG;IACH,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;IAQ1D;;OAEG;IACH,OAAO,CAAC,uBAAuB;CA2GlC"}
|
package/dist/mcp/mcp-client.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../chunk-PTJYTZNU.js";
|
|
2
2
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
3
4
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
4
5
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
5
6
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
@@ -31,6 +32,7 @@ function buildClientCapabilities() {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
class DextoMcpClient extends EventEmitter {
|
|
35
|
+
toolInvocationContext = new AsyncLocalStorage();
|
|
34
36
|
client = null;
|
|
35
37
|
transport = null;
|
|
36
38
|
isConnected = false;
|
|
@@ -304,71 +306,75 @@ class DextoMcpClient extends EventEmitter {
|
|
|
304
306
|
* @param args Tool arguments
|
|
305
307
|
* @returns Result of the tool execution
|
|
306
308
|
*/
|
|
307
|
-
async callTool(name, args) {
|
|
309
|
+
async callTool(name, args, invocation) {
|
|
308
310
|
this.ensureConnected();
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
this.logger.debug(`Calling tool '${name}' with args: ${JSON.stringify(args, null, 2)}`);
|
|
324
|
-
let toolArgs = args;
|
|
325
|
-
if (typeof args === "string") {
|
|
326
|
-
try {
|
|
327
|
-
toolArgs = JSON.parse(args);
|
|
328
|
-
} catch {
|
|
329
|
-
toolArgs = { input: args };
|
|
311
|
+
return await this.toolInvocationContext.run(invocation, async () => {
|
|
312
|
+
const shouldTrace = hasActiveTelemetry();
|
|
313
|
+
const tracer = shouldTrace ? trace.getTracer("dexto") : null;
|
|
314
|
+
const span = tracer?.startSpan(`mcp.tool.${name}`, {
|
|
315
|
+
kind: SpanKind.CLIENT
|
|
316
|
+
});
|
|
317
|
+
try {
|
|
318
|
+
if (span) {
|
|
319
|
+
const ctx = trace.setSpan(context.active(), span);
|
|
320
|
+
addBaggageAttributesToSpan(span, ctx, this.logger);
|
|
321
|
+
span.setAttribute("tool.name", name);
|
|
322
|
+
span.setAttribute("tool.server", this.serverAlias || "unknown");
|
|
323
|
+
span.setAttribute("tool.timeout", this.timeout);
|
|
324
|
+
span.setAttribute("tool.arguments", safeStringify(args, 4096));
|
|
330
325
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
const logResult = JSON.stringify(
|
|
341
|
-
result,
|
|
342
|
-
(key, value) => {
|
|
343
|
-
if (key === "data" && typeof value === "string" && value.length > 100) {
|
|
344
|
-
return `[Base64 data: ${value.length} chars]`;
|
|
326
|
+
this.logger.debug(
|
|
327
|
+
`Calling tool '${name}' with args: ${JSON.stringify(args, null, 2)}`
|
|
328
|
+
);
|
|
329
|
+
let toolArgs = args;
|
|
330
|
+
if (typeof args === "string") {
|
|
331
|
+
try {
|
|
332
|
+
toolArgs = JSON.parse(args);
|
|
333
|
+
} catch {
|
|
334
|
+
toolArgs = { input: args };
|
|
345
335
|
}
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
336
|
+
}
|
|
337
|
+
this.logger.debug(`Using timeout: ${this.timeout}`);
|
|
338
|
+
const result = await this.client.callTool(
|
|
339
|
+
{ name, arguments: toolArgs },
|
|
340
|
+
void 0,
|
|
341
|
+
// resultSchema (optional)
|
|
342
|
+
{ timeout: this.timeout }
|
|
343
|
+
// Use server-specific timeout, default 1 minute
|
|
344
|
+
);
|
|
345
|
+
const logResult = JSON.stringify(
|
|
346
|
+
result,
|
|
347
|
+
(key, value) => {
|
|
348
|
+
if (key === "data" && typeof value === "string" && value.length > 100) {
|
|
349
|
+
return `[Base64 data: ${value.length} chars]`;
|
|
350
|
+
}
|
|
351
|
+
return value;
|
|
352
|
+
},
|
|
353
|
+
2
|
|
354
|
+
);
|
|
355
|
+
this.logger.debug(`Tool '${name}' result: ${logResult}`);
|
|
356
|
+
if (span) {
|
|
357
|
+
span.setAttribute("tool.result", safeStringify(result, 4096));
|
|
358
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
359
|
+
}
|
|
360
|
+
if (result === null || result === void 0) {
|
|
361
|
+
return "Tool executed successfully with no result data.";
|
|
362
|
+
}
|
|
363
|
+
return result;
|
|
364
|
+
} catch (error) {
|
|
365
|
+
this.logger.error(`Tool call '${name}' failed: ${JSON.stringify(error, null, 2)}`);
|
|
366
|
+
if (span) {
|
|
367
|
+
span.recordException(error);
|
|
368
|
+
span.setStatus({
|
|
369
|
+
code: SpanStatusCode.ERROR,
|
|
370
|
+
message: error instanceof Error ? error.message : String(error)
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
return `Error executing tool '${name}': ${error instanceof Error ? error.message : String(error)}`;
|
|
374
|
+
} finally {
|
|
375
|
+
span?.end();
|
|
367
376
|
}
|
|
368
|
-
|
|
369
|
-
} finally {
|
|
370
|
-
span?.end();
|
|
371
|
-
}
|
|
377
|
+
});
|
|
372
378
|
}
|
|
373
379
|
/**
|
|
374
380
|
* Get the list of tools provided by this client
|
|
@@ -639,10 +645,13 @@ class DextoMcpClient extends EventEmitter {
|
|
|
639
645
|
);
|
|
640
646
|
return { action: "decline" };
|
|
641
647
|
}
|
|
648
|
+
const invocation = this.toolInvocationContext.getStore();
|
|
642
649
|
const response = await this.approvalManager.requestElicitation({
|
|
643
650
|
schema: params.requestedSchema,
|
|
644
651
|
prompt: params.message,
|
|
645
|
-
serverName: this.serverAlias || "unknown"
|
|
652
|
+
serverName: this.serverAlias || "unknown",
|
|
653
|
+
...invocation?.sessionId !== void 0 ? { sessionId: invocation.sessionId } : {},
|
|
654
|
+
...invocation?.runContext?.hostRuntime !== void 0 ? { hostRuntime: invocation.runContext.hostRuntime } : {}
|
|
646
655
|
});
|
|
647
656
|
if (response.status === ApprovalStatus.APPROVED && response.data) {
|
|
648
657
|
const formData = response.data && typeof response.data === "object" && "formData" in response.data ? response.data.formData : {};
|
package/dist/mcp/schemas.d.ts
CHANGED
|
@@ -54,9 +54,9 @@ export declare const SseServerConfigSchema: z.ZodObject<{
|
|
|
54
54
|
}, "strict", z.ZodTypeAny, {
|
|
55
55
|
timeout: number;
|
|
56
56
|
type: "sse";
|
|
57
|
+
url: string;
|
|
57
58
|
enabled: boolean;
|
|
58
59
|
connectionMode: "strict" | "lenient";
|
|
59
|
-
url: string;
|
|
60
60
|
headers: Record<string, string>;
|
|
61
61
|
}, {
|
|
62
62
|
type: "sse";
|
|
@@ -78,9 +78,9 @@ export declare const HttpServerConfigSchema: z.ZodObject<{
|
|
|
78
78
|
}, "strict", z.ZodTypeAny, {
|
|
79
79
|
timeout: number;
|
|
80
80
|
type: "http";
|
|
81
|
+
url: string;
|
|
81
82
|
enabled: boolean;
|
|
82
83
|
connectionMode: "strict" | "lenient";
|
|
83
|
-
url: string;
|
|
84
84
|
headers: Record<string, string>;
|
|
85
85
|
}, {
|
|
86
86
|
type: "http";
|
|
@@ -126,9 +126,9 @@ export declare const McpServerConfigSchema: z.ZodBranded<z.ZodEffects<z.ZodDiscr
|
|
|
126
126
|
}, "strict", z.ZodTypeAny, {
|
|
127
127
|
timeout: number;
|
|
128
128
|
type: "sse";
|
|
129
|
+
url: string;
|
|
129
130
|
enabled: boolean;
|
|
130
131
|
connectionMode: "strict" | "lenient";
|
|
131
|
-
url: string;
|
|
132
132
|
headers: Record<string, string>;
|
|
133
133
|
}, {
|
|
134
134
|
type: "sse";
|
|
@@ -147,9 +147,9 @@ export declare const McpServerConfigSchema: z.ZodBranded<z.ZodEffects<z.ZodDiscr
|
|
|
147
147
|
}, "strict", z.ZodTypeAny, {
|
|
148
148
|
timeout: number;
|
|
149
149
|
type: "http";
|
|
150
|
+
url: string;
|
|
150
151
|
enabled: boolean;
|
|
151
152
|
connectionMode: "strict" | "lenient";
|
|
152
|
-
url: string;
|
|
153
153
|
headers: Record<string, string>;
|
|
154
154
|
}, {
|
|
155
155
|
type: "http";
|
|
@@ -169,16 +169,16 @@ export declare const McpServerConfigSchema: z.ZodBranded<z.ZodEffects<z.ZodDiscr
|
|
|
169
169
|
} | {
|
|
170
170
|
timeout: number;
|
|
171
171
|
type: "sse";
|
|
172
|
+
url: string;
|
|
172
173
|
enabled: boolean;
|
|
173
174
|
connectionMode: "strict" | "lenient";
|
|
174
|
-
url: string;
|
|
175
175
|
headers: Record<string, string>;
|
|
176
176
|
} | {
|
|
177
177
|
timeout: number;
|
|
178
178
|
type: "http";
|
|
179
|
+
url: string;
|
|
179
180
|
enabled: boolean;
|
|
180
181
|
connectionMode: "strict" | "lenient";
|
|
181
|
-
url: string;
|
|
182
182
|
headers: Record<string, string>;
|
|
183
183
|
}, {
|
|
184
184
|
type: "stdio";
|
|
@@ -239,9 +239,9 @@ export declare const ServersConfigSchema: z.ZodBranded<z.ZodRecord<z.ZodString,
|
|
|
239
239
|
}, "strict", z.ZodTypeAny, {
|
|
240
240
|
timeout: number;
|
|
241
241
|
type: "sse";
|
|
242
|
+
url: string;
|
|
242
243
|
enabled: boolean;
|
|
243
244
|
connectionMode: "strict" | "lenient";
|
|
244
|
-
url: string;
|
|
245
245
|
headers: Record<string, string>;
|
|
246
246
|
}, {
|
|
247
247
|
type: "sse";
|
|
@@ -260,9 +260,9 @@ export declare const ServersConfigSchema: z.ZodBranded<z.ZodRecord<z.ZodString,
|
|
|
260
260
|
}, "strict", z.ZodTypeAny, {
|
|
261
261
|
timeout: number;
|
|
262
262
|
type: "http";
|
|
263
|
+
url: string;
|
|
263
264
|
enabled: boolean;
|
|
264
265
|
connectionMode: "strict" | "lenient";
|
|
265
|
-
url: string;
|
|
266
266
|
headers: Record<string, string>;
|
|
267
267
|
}, {
|
|
268
268
|
type: "http";
|
|
@@ -282,16 +282,16 @@ export declare const ServersConfigSchema: z.ZodBranded<z.ZodRecord<z.ZodString,
|
|
|
282
282
|
} | {
|
|
283
283
|
timeout: number;
|
|
284
284
|
type: "sse";
|
|
285
|
+
url: string;
|
|
285
286
|
enabled: boolean;
|
|
286
287
|
connectionMode: "strict" | "lenient";
|
|
287
|
-
url: string;
|
|
288
288
|
headers: Record<string, string>;
|
|
289
289
|
} | {
|
|
290
290
|
timeout: number;
|
|
291
291
|
type: "http";
|
|
292
|
+
url: string;
|
|
292
293
|
enabled: boolean;
|
|
293
294
|
connectionMode: "strict" | "lenient";
|
|
294
|
-
url: string;
|
|
295
295
|
headers: Record<string, string>;
|
|
296
296
|
}, {
|
|
297
297
|
type: "stdio";
|
|
@@ -305,11 +305,21 @@ class FileSystemResourceHandler {
|
|
|
305
305
|
".cache",
|
|
306
306
|
".vscode",
|
|
307
307
|
".idea",
|
|
308
|
-
".changeset",
|
|
309
308
|
".github",
|
|
310
309
|
".husky",
|
|
310
|
+
".agents",
|
|
311
|
+
".claude",
|
|
312
|
+
".cursor",
|
|
313
|
+
".dexto",
|
|
314
|
+
".conductor",
|
|
315
|
+
".logs",
|
|
311
316
|
"tmp",
|
|
312
|
-
"temp"
|
|
317
|
+
"temp",
|
|
318
|
+
"__pycache__",
|
|
319
|
+
".pytest_cache",
|
|
320
|
+
"target",
|
|
321
|
+
"vendor",
|
|
322
|
+
"site"
|
|
313
323
|
];
|
|
314
324
|
return ignoredDirectories.includes(basename);
|
|
315
325
|
}
|
|
@@ -320,15 +330,24 @@ class FileSystemResourceHandler {
|
|
|
320
330
|
if (!includeHidden) {
|
|
321
331
|
const allowedDotfiles = [
|
|
322
332
|
".gitignore",
|
|
333
|
+
".gitattributes",
|
|
323
334
|
".env",
|
|
324
335
|
".env.example",
|
|
336
|
+
".env.local",
|
|
337
|
+
".env.development",
|
|
338
|
+
".env.production",
|
|
325
339
|
".npmignore",
|
|
326
340
|
".dockerignore",
|
|
327
|
-
".editorconfig"
|
|
341
|
+
".editorconfig",
|
|
342
|
+
".prettierignore",
|
|
343
|
+
".eslintignore",
|
|
344
|
+
".nvmrc",
|
|
345
|
+
".node-version"
|
|
328
346
|
];
|
|
329
347
|
if (!allowedDotfiles.includes(basename)) return false;
|
|
330
348
|
}
|
|
331
349
|
if (basename === ".env" || basename.startsWith(".env.")) return true;
|
|
350
|
+
if (basename === ".nvmrc" || basename === ".node-version") return true;
|
|
332
351
|
}
|
|
333
352
|
if (!ext) {
|
|
334
353
|
const commonNoExtFiles = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-handler.d.ts","sourceRoot":"","sources":["../../../src/resources/handlers/filesystem-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA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