@gt-fe/eap-runtime 0.0.37 → 0.0.38
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/graph/adapters/langgraph.adapter.js +0 -1
- package/dist/registry/graph-loader.js +0 -21
- package/dist/tool/dev-mcp-executor.js +1 -2
- package/dist/tool/mcp-list.d.ts +1 -7
- package/dist/tool/mcp-list.js +4 -17
- package/dist/tool/mcp-tool-executor.d.ts +1 -1
- package/dist/tool/mcp-tool-executor.js +1 -2
- package/dist/tool/tool-executor.interface.d.ts +0 -6
- package/package.json +1 -1
|
@@ -1172,7 +1172,6 @@ export class LangGraphAdapter {
|
|
|
1172
1172
|
},
|
|
1173
1173
|
correlationId: typeof state['correlationId'] === 'string' ? state['correlationId'] : undefined,
|
|
1174
1174
|
taskId: typeof state['taskId'] === 'string' ? state['taskId'] : undefined,
|
|
1175
|
-
sessionId: typeof state['sessionId'] === 'string' ? state['sessionId'] : undefined,
|
|
1176
1175
|
onListFailure: ({ toolset, error }) => {
|
|
1177
1176
|
this.emitToolExecutionEvents({
|
|
1178
1177
|
toolCallId: `mcp-list:${toolset}`,
|
|
@@ -270,26 +270,6 @@ function resolveMcpServer(manifest) {
|
|
|
270
270
|
}
|
|
271
271
|
return undefined;
|
|
272
272
|
}
|
|
273
|
-
function mcpKnownToolNames(manifest) {
|
|
274
|
-
const tools = manifest.tools;
|
|
275
|
-
if (!Array.isArray(tools))
|
|
276
|
-
return [];
|
|
277
|
-
const names = [];
|
|
278
|
-
const seen = new Set();
|
|
279
|
-
for (const tool of tools) {
|
|
280
|
-
if (!tool || typeof tool !== 'object')
|
|
281
|
-
continue;
|
|
282
|
-
const name = tool.name;
|
|
283
|
-
if (typeof name !== 'string')
|
|
284
|
-
continue;
|
|
285
|
-
const trimmed = name.trim();
|
|
286
|
-
if (!trimmed || seen.has(trimmed))
|
|
287
|
-
continue;
|
|
288
|
-
seen.add(trimmed);
|
|
289
|
-
names.push(trimmed);
|
|
290
|
-
}
|
|
291
|
-
return names;
|
|
292
|
-
}
|
|
293
273
|
/** 门户把同一次注册的「用户确认」写在每个 tools[] 上。MCP 不展开这份清单,占位记录读这个值。 */
|
|
294
274
|
function mcpToolsRequireConfirmation(manifest) {
|
|
295
275
|
const tools = manifest.tools;
|
|
@@ -321,7 +301,6 @@ function mcpDiscoverStub(pre, options) {
|
|
|
321
301
|
if (options?.autoApprove && options.autoApprove.length > 0) {
|
|
322
302
|
execution.autoApprove = options.autoApprove;
|
|
323
303
|
}
|
|
324
|
-
execution.knownTools = mcpKnownToolNames(m);
|
|
325
304
|
return {
|
|
326
305
|
toolId: pre.toolId,
|
|
327
306
|
name: pre.name,
|
|
@@ -73,8 +73,7 @@ export class DevMcpExecutor {
|
|
|
73
73
|
const url = execution.server?.url ?? '';
|
|
74
74
|
const cmd = execution.server?.command ?? '';
|
|
75
75
|
const args = (execution.server?.args ?? []).join('\0');
|
|
76
|
-
const
|
|
77
|
-
const key = `${url || `stdio:${cmd}:${args}`}\0${request.authContext?.userId ?? ''}\0${request.authContext?.agentCode ?? ''}\0${scope}`;
|
|
76
|
+
const key = `${url || `stdio:${cmd}:${args}`}\0${request.authContext?.userId ?? ''}\0${request.authContext?.agentCode ?? ''}`;
|
|
78
77
|
const cached = this.listCache.get(key);
|
|
79
78
|
if (cached)
|
|
80
79
|
return cached;
|
package/dist/tool/mcp-list.d.ts
CHANGED
|
@@ -25,8 +25,6 @@ export interface McpDiscoverExecution {
|
|
|
25
25
|
bundlePath?: string;
|
|
26
26
|
enabledTools?: string[];
|
|
27
27
|
autoApprove?: string[];
|
|
28
|
-
/** 预装清单里已有的子工具名。缺省表示沿用 stub 的确认规则。 */
|
|
29
|
-
knownTools?: string[];
|
|
30
28
|
}
|
|
31
29
|
export declare function readMcpDiscoverExecution(raw: unknown): McpDiscoverExecution | null;
|
|
32
30
|
export declare function isMcpDiscoverStub(def: LoadedToolDefinition): boolean;
|
|
@@ -73,7 +71,6 @@ export interface HydrateMcpToolsAuth {
|
|
|
73
71
|
authContext: AuthContext;
|
|
74
72
|
correlationId?: string;
|
|
75
73
|
taskId?: string;
|
|
76
|
-
sessionId?: string;
|
|
77
74
|
onListFailure?: (failure: {
|
|
78
75
|
toolset: string;
|
|
79
76
|
endpoint: string;
|
|
@@ -82,13 +79,10 @@ export interface HydrateMcpToolsAuth {
|
|
|
82
79
|
}
|
|
83
80
|
/**
|
|
84
81
|
* 将 MCP discover stub 替换为 tools/list 结果。
|
|
85
|
-
* 无 stub
|
|
82
|
+
* 无 stub 时原样返回(同一引用)。按 endpoint+user+agent 在执行器内缓存 list。
|
|
86
83
|
* enabledTools 为可选白名单;autoApprove 的子工具 requireConfirmation=false。
|
|
87
|
-
* knownTools 之外的新工具,不是只读时要用户确认。
|
|
88
84
|
* 单个 endpoint 的 list 失败只跳过该工具集;全部失败才抛错(错误含工具集名)。
|
|
89
85
|
*/
|
|
90
86
|
export declare function hydrateMcpTools(loadedTools: LoadedToolMap | undefined, executor: IToolExecutor | undefined, auth: HydrateMcpToolsAuth): Promise<LoadedToolMap | undefined>;
|
|
91
|
-
/** 登记过的名字沿用 stub;新名字在不是只读时要确认。没有 knownTools 时全部沿用 stub。 */
|
|
92
|
-
export declare function mcpChildNeedsConfirmation(tool: McpListedTool, stub: LoadedToolDefinition, autoApprove: boolean, known: Set<string> | null): boolean;
|
|
93
87
|
/** 测试与 HITL 续跑:从已 hydrate 的 map 判断是否还要 list */
|
|
94
88
|
export declare function needsMcpHydration(loadedTools: LoadedToolMap | undefined): boolean;
|
package/dist/tool/mcp-list.js
CHANGED
|
@@ -24,7 +24,6 @@ export function parseListedTools(result) {
|
|
|
24
24
|
name: t.name,
|
|
25
25
|
description: typeof t.description === 'string' ? t.description : undefined,
|
|
26
26
|
inputSchema,
|
|
27
|
-
...(t.annotations?.readOnlyHint === true ? { readOnly: true } : {}),
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
return out;
|
|
@@ -145,9 +144,8 @@ export function toolTraceIdentity(loaded, toolName) {
|
|
|
145
144
|
}
|
|
146
145
|
/**
|
|
147
146
|
* 将 MCP discover stub 替换为 tools/list 结果。
|
|
148
|
-
* 无 stub
|
|
147
|
+
* 无 stub 时原样返回(同一引用)。按 endpoint+user+agent 在执行器内缓存 list。
|
|
149
148
|
* enabledTools 为可选白名单;autoApprove 的子工具 requireConfirmation=false。
|
|
150
|
-
* knownTools 之外的新工具,不是只读时要用户确认。
|
|
151
149
|
* 单个 endpoint 的 list 失败只跳过该工具集;全部失败才抛错(错误含工具集名)。
|
|
152
150
|
*/
|
|
153
151
|
export async function hydrateMcpTools(loadedTools, executor, auth) {
|
|
@@ -195,7 +193,6 @@ export async function hydrateMcpTools(loadedTools, executor, auth) {
|
|
|
195
193
|
execution: primary.manifest.execution,
|
|
196
194
|
...(toolsetCode ? { toolsetCode } : {}),
|
|
197
195
|
...(primary.manifest.version ? { toolVersion: primary.manifest.version } : {}),
|
|
198
|
-
...(auth.sessionId ? { sessionId: auth.sessionId } : {}),
|
|
199
196
|
});
|
|
200
197
|
}
|
|
201
198
|
catch (err) {
|
|
@@ -216,13 +213,12 @@ export async function hydrateMcpTools(loadedTools, executor, auth) {
|
|
|
216
213
|
const enabled = exec?.enabledTools;
|
|
217
214
|
const enabledSet = enabled && enabled.length > 0 ? new Set(enabled) : null;
|
|
218
215
|
const autoApprove = new Set(exec?.autoApprove ?? []);
|
|
219
|
-
const known = Array.isArray(exec?.knownTools) ? new Set(exec.knownTools) : null;
|
|
220
216
|
const picked = enabledSet ? listed.filter((t) => enabledSet.has(t.name)) : listed;
|
|
221
217
|
for (const tool of picked) {
|
|
222
218
|
if (emitted.has(tool.name))
|
|
223
219
|
continue;
|
|
224
220
|
emitted.add(tool.name);
|
|
225
|
-
result[tool.name] = listedToolToDefinition(tool, stub,
|
|
221
|
+
result[tool.name] = listedToolToDefinition(tool, stub, autoApprove.has(tool.name));
|
|
226
222
|
}
|
|
227
223
|
}
|
|
228
224
|
}
|
|
@@ -231,20 +227,11 @@ export async function hydrateMcpTools(loadedTools, executor, auth) {
|
|
|
231
227
|
}
|
|
232
228
|
return result;
|
|
233
229
|
}
|
|
234
|
-
|
|
235
|
-
export function mcpChildNeedsConfirmation(tool, stub, autoApprove, known) {
|
|
236
|
-
if (autoApprove)
|
|
237
|
-
return false;
|
|
238
|
-
if (known === null || known.has(tool.name))
|
|
239
|
-
return Boolean(stub.manifest.requireConfirmation);
|
|
240
|
-
return tool.readOnly !== true;
|
|
241
|
-
}
|
|
242
|
-
function listedToolToDefinition(tool, stub, requireConfirmation) {
|
|
230
|
+
function listedToolToDefinition(tool, stub, autoApprove) {
|
|
243
231
|
const exec = { ...(readMcpDiscoverExecution(stub.manifest.execution) ?? {}) };
|
|
244
232
|
delete exec.discover;
|
|
245
233
|
delete exec.enabledTools;
|
|
246
234
|
delete exec.autoApprove;
|
|
247
|
-
delete exec.knownTools;
|
|
248
235
|
const rest = exec;
|
|
249
236
|
return {
|
|
250
237
|
toolId: `${stub.toolId}:${tool.name}`,
|
|
@@ -258,7 +245,7 @@ function listedToolToDefinition(tool, stub, requireConfirmation) {
|
|
|
258
245
|
description: tool.description,
|
|
259
246
|
toolRuntime: stub.manifest.toolRuntime,
|
|
260
247
|
dataScope: stub.manifest.dataScope,
|
|
261
|
-
requireConfirmation,
|
|
248
|
+
requireConfirmation: autoApprove ? false : Boolean(stub.manifest.requireConfirmation),
|
|
262
249
|
execution: {
|
|
263
250
|
...rest,
|
|
264
251
|
protocol: 'mcp',
|
|
@@ -18,7 +18,7 @@ export declare class McpToolExecutor implements IToolExecutor {
|
|
|
18
18
|
private readonly mcpUrl;
|
|
19
19
|
private rpcId;
|
|
20
20
|
private initialized;
|
|
21
|
-
/**
|
|
21
|
+
/** endpoint+user+agent+toolset+version → in-flight / completed tools/list */
|
|
22
22
|
private readonly listCache;
|
|
23
23
|
constructor(options: McpToolExecutorOptions);
|
|
24
24
|
execute(request: ToolCallRequest): Promise<ToolCallResult>;
|
|
@@ -81,7 +81,6 @@ function mcpListCacheKey(mcpUrl, request) {
|
|
|
81
81
|
request.authContext.agentCode,
|
|
82
82
|
request.toolsetCode?.trim() ?? '',
|
|
83
83
|
request.toolVersion?.trim() ?? '',
|
|
84
|
-
request.sessionId?.trim() || request.taskId?.trim() || '',
|
|
85
84
|
].join('\0');
|
|
86
85
|
}
|
|
87
86
|
export class McpToolExecutor {
|
|
@@ -90,7 +89,7 @@ export class McpToolExecutor {
|
|
|
90
89
|
mcpUrl;
|
|
91
90
|
rpcId = 1;
|
|
92
91
|
initialized = false;
|
|
93
|
-
/**
|
|
92
|
+
/** endpoint+user+agent+toolset+version → in-flight / completed tools/list */
|
|
94
93
|
listCache = new Map();
|
|
95
94
|
constructor(options) {
|
|
96
95
|
if (!isAbsoluteHttpUrl(options.baseUrl)) {
|
|
@@ -38,10 +38,6 @@ export interface ToolCallRequest {
|
|
|
38
38
|
taskId?: string;
|
|
39
39
|
/** 链路关联 ID;缺省可用 toolCallId */
|
|
40
40
|
correlationId?: string;
|
|
41
|
-
/**
|
|
42
|
-
* 会话标识。MCP tools/list 按会话缓存:同一会话复用名单,新会话重新向 Gateway 要。
|
|
43
|
-
*/
|
|
44
|
-
sessionId?: string;
|
|
45
41
|
/** 路由用:manifest type */
|
|
46
42
|
toolType?: string;
|
|
47
43
|
/** 路由用:manifest runtime */
|
|
@@ -147,8 +143,6 @@ export interface McpListedTool {
|
|
|
147
143
|
name: string;
|
|
148
144
|
description?: string;
|
|
149
145
|
inputSchema?: Record<string, unknown>;
|
|
150
|
-
/** 上游 annotations.readOnlyHint 为 true。缺省视为会改数据。 */
|
|
151
|
-
readOnly?: boolean;
|
|
152
146
|
}
|
|
153
147
|
/**
|
|
154
148
|
* IToolExecutor — Tool 执行网关接口
|