@gt-fe/eap-runtime 0.0.12 → 0.0.13
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.
|
@@ -8,6 +8,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { resolveAgentModelAllowlist, resolveAgentDefaultModel } from './agent-models.js';
|
|
10
10
|
import { DEFAULT_HTTP_TOOL_TIMEOUT_SEC, DEFAULT_TOOL_TIMEOUT_SEC } from '../tool/timeout.js';
|
|
11
|
+
import { resolveStdioMcpCwd } from './mcp-stdio-cwd.js';
|
|
11
12
|
import { createDeploymentSnapshotFromEnv, isInlineToolDeclaration, overlayToolRefPolicies, } from './deployment-snapshot.js';
|
|
12
13
|
import { preloadGraphNotFound, preloadManifestNotFound, preloadSkillNotFound, preloadToolNotFound, } from './preload-errors.js';
|
|
13
14
|
import { PreinstallDefinitionCache, resolveDefinitionCacheEnabled, } from './definition-cache.js';
|
|
@@ -306,10 +307,19 @@ function expandPreinstallToolset(pre, options) {
|
|
|
306
307
|
}
|
|
307
308
|
else if (setType === 'mcp') {
|
|
308
309
|
type = 'mcp';
|
|
310
|
+
const transport = server?.transport ?? (server?.url ? 'streamable_http' : 'stdio');
|
|
311
|
+
const resolvedServer = server
|
|
312
|
+
? {
|
|
313
|
+
...server,
|
|
314
|
+
...(transport === 'stdio'
|
|
315
|
+
? { cwd: resolveStdioMcpCwd(pre.bundlePath, server.cwd) }
|
|
316
|
+
: {}),
|
|
317
|
+
}
|
|
318
|
+
: server;
|
|
309
319
|
execution = {
|
|
310
320
|
protocol: 'mcp',
|
|
311
|
-
transport
|
|
312
|
-
server,
|
|
321
|
+
transport,
|
|
322
|
+
server: resolvedServer,
|
|
313
323
|
toolName: name,
|
|
314
324
|
timeout: st.timeout ?? server?.timeout ?? DEFAULT_TOOL_TIMEOUT_SEC,
|
|
315
325
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* stdio MCP 的工作目录:自包含工具包以预装根为 cwd。
|
|
4
|
+
* 绝对路径仍尊重清单(本机问数仓)。空或相对路径落到 bundlePath。
|
|
5
|
+
*/
|
|
6
|
+
export function resolveStdioMcpCwd(bundlePath, cwd) {
|
|
7
|
+
const raw = typeof cwd === 'string' ? cwd.trim() : '';
|
|
8
|
+
if (raw && path.isAbsolute(raw))
|
|
9
|
+
return raw;
|
|
10
|
+
if (!bundlePath)
|
|
11
|
+
return raw || undefined;
|
|
12
|
+
return raw ? path.resolve(bundlePath, raw) : bundlePath;
|
|
13
|
+
}
|