dsh-mcp-panel 0.4.0 → 0.4.2
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/CHANGELOG.md +17 -0
- package/README.es.md +179 -48
- package/README.hi.md +178 -47
- package/README.md +128 -69
- package/README.pt.md +181 -50
- package/README.zh.md +134 -74
- package/lib/index.js +53 -44
- package/lib/types/aggregate.d.ts +3 -3
- package/lib/types/client/McpPanelTab.d.ts +1 -1
- package/lib/types/client/ServerEditor.d.ts +1 -1
- package/lib/types/client/TrialConsole.d.ts +1 -1
- package/lib/types/client/index.d.ts +5 -5
- package/lib/types/client/present.d.ts +1 -1
- package/lib/types/client/remote.d.ts +1 -1
- package/lib/types/command.d.ts +2 -2
- package/lib/types/diagnostics.d.ts +1 -1
- package/lib/types/grouping.d.ts +1 -1
- package/lib/types/index.d.ts +14 -14
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/patch.d.ts +1 -1
- package/lib/types/probe.d.ts +1 -1
- package/lib/types/service.d.ts +4 -2
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/trial.d.ts +16 -9
- package/lib/types/trial.d.ts.map +1 -1
- package/package.json +28 -19
- package/src/index.ts +1 -1
- package/src/probe.ts +1 -1
- package/src/service.ts +5 -2
- package/src/trial.ts +52 -45
package/lib/types/service.d.ts
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import type { Context } from '@deepseek-ai/cordis';
|
|
28
28
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
29
|
-
import type { McpServerStatus } from './upstream.
|
|
30
|
-
import type { McpPanelSnapshot, McpTrialResultWire, PatchPreview, PatchWriteResult, ProbeStarted } from './wire.
|
|
29
|
+
import type { McpServerStatus } from './upstream.js';
|
|
30
|
+
import type { McpPanelSnapshot, McpTrialResultWire, PatchPreview, PatchWriteResult, ProbeStarted } from './wire.js';
|
|
31
31
|
declare module '@deepseek-ai/cordis' {
|
|
32
32
|
interface Context {
|
|
33
33
|
/** MCP management console snapshot + actions service (this package). */
|
|
@@ -75,6 +75,8 @@ export declare class McpPanelService extends TypertRemoteService {
|
|
|
75
75
|
private readonly observedAt;
|
|
76
76
|
/** Latest passive-probe reachability per server namespace. */
|
|
77
77
|
private readonly probeStates;
|
|
78
|
+
/** The trial caller with this instance's own callId sequence. */
|
|
79
|
+
private readonly trialCaller;
|
|
78
80
|
/** Passive-probe loop guard: one sweep at a time. */
|
|
79
81
|
private passiveRunning;
|
|
80
82
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAyBtE,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAA;AACpE,OAAO,KAAK,EAEV,gBAAgB,EAEhB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACb,MAAM,WAAW,CAAA;AAElB,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,wEAAwE;QACxE,QAAQ,EAAE,eAAe,CAAA;KAC1B;CACF;AAoDD,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACpC,yCAAyC;IACzC,cAAc,EAAE,MAAM,CAAA;IACtB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,8DAA8D;IAC9D,iBAAiB,EAAE,MAAM,CAAA;IACzB,2CAA2C;IAC3C,mBAAmB,EAAE,OAAO,CAAA;IAC5B,8CAA8C;IAC9C,sBAAsB,EAAE,MAAM,CAAA;IAC9B,iDAAiD;IACjD,YAAY,EAAE,OAAO,CAAA;IACrB,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAA;IACt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C,UAAU;IAIlB,4EAA4E;YAC9D,gBAAgB;IAiB9B;;;;;;;;OAQG;IACH,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,SAAS,CAwB5F;IAED,gFAAgF;IAChF,OAAO,CAAC,UAAU;IAoBlB,4EAA4E;IAC5E,OAAO,CAAC,SAAS;CAMlB;eASc,eAAe"}
|
package/lib/types/trial.d.ts
CHANGED
|
@@ -59,14 +59,21 @@ export interface McpTrialLimits {
|
|
|
59
59
|
*/
|
|
60
60
|
export declare function validateTrialRequest(request: unknown): string | null;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* @
|
|
65
|
-
* @param agents - optional live agent registry for approval routing.
|
|
66
|
-
* @param sessionId - optional current session id from the client.
|
|
67
|
-
* @param request - the validated trial request.
|
|
68
|
-
* @param limits - panel-side deadline and result cap.
|
|
69
|
-
* @returns the wire result.
|
|
62
|
+
* Create the trial caller: one callId sequence per service instance, so a
|
|
63
|
+
* plugin reload never carries counter state across mounts.
|
|
64
|
+
* @returns the trial caller bound to its own sequence.
|
|
70
65
|
*/
|
|
71
|
-
export declare function
|
|
66
|
+
export declare function createTrialCaller(): {
|
|
67
|
+
/**
|
|
68
|
+
* Run one trial call through the official tool pipeline.
|
|
69
|
+
*
|
|
70
|
+
* @param tools - the registry the call executes through.
|
|
71
|
+
* @param agents - optional live agent registry for approval routing.
|
|
72
|
+
* @param sessionId - optional current session id from the client.
|
|
73
|
+
* @param request - the validated trial request.
|
|
74
|
+
* @param limits - panel-side deadline and result cap.
|
|
75
|
+
* @returns the wire result.
|
|
76
|
+
*/
|
|
77
|
+
runTrialCall(tools: ToolRuntime, agents: McpAgentRegistryFace | undefined, sessionId: string | undefined, request: McpTrialRequest, limits: McpTrialLimits): Promise<McpTrialResult>;
|
|
78
|
+
};
|
|
72
79
|
//# sourceMappingURL=trial.d.ts.map
|
package/lib/types/trial.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trial.d.ts","sourceRoot":"","sources":["../../src/trial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAA2C,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAElG,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAA;IAChB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CACrC;AAED,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAA;CACvB;
|
|
1
|
+
{"version":3,"file":"trial.d.ts","sourceRoot":"","sources":["../../src/trial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAA2C,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAElG,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAA;IAChB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CACrC;AAED,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAA;CACvB;AAKD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAWpE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB;IAG7B;;;;;;;;;OASG;IACG,YAAY,QACT,WAAW,UACV,oBAAoB,GAAG,SAAS,aAC7B,MAAM,GAAG,SAAS,WACpB,eAAe,UAChB,cAAc,GACrB,OAAO,CAAC,cAAc,CAAC;EA+B7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp-panel",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "MCP management console for the official DeepSeek Harness MCP client: /mcp command with health diagnostics and pipeline trial calls, a Settings MCP tab with server CRUD (append-only profile-patch fragments, approval-gated writes with automatic backups), a tool trial console over the official tool pipeline, connection status, reconnect counts and sanitized tool inventory, plus an optional Streamable HTTP probe.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -81,8 +81,7 @@
|
|
|
81
81
|
],
|
|
82
82
|
"compatibility": {
|
|
83
83
|
"dshVersions": [
|
|
84
|
-
"0.1.0-rc.
|
|
85
|
-
"0.1.0-rc.6"
|
|
84
|
+
"0.1.0-rc.8"
|
|
86
85
|
]
|
|
87
86
|
},
|
|
88
87
|
"capability": {
|
|
@@ -117,11 +116,11 @@
|
|
|
117
116
|
"peerDependencies": {
|
|
118
117
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
119
118
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.2",
|
|
120
|
-
"@deepseek-ai/
|
|
121
|
-
"@deepseek-ai/dsh-
|
|
122
|
-
"@deepseek-ai/dsh-
|
|
123
|
-
"@deepseek-ai/dsh-
|
|
124
|
-
"@deepseek-ai/
|
|
119
|
+
"@deepseek-ai/dsh-commands": ">=0.1.0-rc.8 <0.2.0",
|
|
120
|
+
"@deepseek-ai/dsh-jobs": ">=0.1.0-rc.8 <0.2.0",
|
|
121
|
+
"@deepseek-ai/dsh-tools": ">=0.1.0-rc.8 <0.2.0",
|
|
122
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.1.0-rc.8 <0.2.0",
|
|
123
|
+
"@deepseek-ai/schemastery": "^3.18.0"
|
|
125
124
|
},
|
|
126
125
|
"dependencies": {
|
|
127
126
|
"tsdown": "^0.22.14",
|
|
@@ -130,22 +129,29 @@
|
|
|
130
129
|
},
|
|
131
130
|
"devDependencies": {
|
|
132
131
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
132
|
+
"@deepseek-ai/cordis-plugin-include": "1.0.6",
|
|
133
133
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.2",
|
|
134
|
+
"@deepseek-ai/dsh-agent": "0.1.0-rc.8",
|
|
135
|
+
"@deepseek-ai/dsh-app-boot": "0.1.0-rc.8",
|
|
136
|
+
"@deepseek-ai/dsh-client-connection": "0.1.0-rc.8",
|
|
137
|
+
"@deepseek-ai/dsh-client-locale": "0.1.0-rc.8",
|
|
138
|
+
"@deepseek-ai/dsh-client-runtime": "0.1.0-rc.8",
|
|
139
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.8",
|
|
140
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.8",
|
|
141
|
+
"@deepseek-ai/dsh-cmdline": "0.1.0-rc.8",
|
|
142
|
+
"@deepseek-ai/dsh-commands": "0.1.0-rc.8",
|
|
143
|
+
"@deepseek-ai/dsh-home-paths": "0.1.0-rc.8",
|
|
144
|
+
"@deepseek-ai/dsh-jobs": "0.1.0-rc.8",
|
|
145
|
+
"@deepseek-ai/dsh-session": "0.1.0-rc.8",
|
|
146
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.0-rc.8",
|
|
147
|
+
"@deepseek-ai/dsh-tools": "0.1.0-rc.8",
|
|
148
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.8",
|
|
134
149
|
"@deepseek-ai/schemastery": "^3.18.0",
|
|
135
|
-
"@deepseek-ai/dsh-agent": "0.1.0-rc.6",
|
|
136
|
-
"@deepseek-ai/dsh-client-connection": "0.1.0-rc.6",
|
|
137
|
-
"@deepseek-ai/dsh-client-locale": "0.1.0-rc.6",
|
|
138
|
-
"@deepseek-ai/dsh-client-runtime": "0.1.0-rc.6",
|
|
139
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.6",
|
|
140
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.6",
|
|
141
|
-
"@deepseek-ai/dsh-commands": "0.1.0-rc.6",
|
|
142
|
-
"@deepseek-ai/dsh-jobs": "0.1.0-rc.6",
|
|
143
|
-
"@deepseek-ai/dsh-session": "0.1.0-rc.6",
|
|
144
|
-
"@deepseek-ai/dsh-tools": "0.1.0-rc.6",
|
|
145
|
-
"@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.6",
|
|
146
150
|
"@types/node": "^22.19.0",
|
|
147
151
|
"@types/react": "18.3.31",
|
|
152
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
148
153
|
"jsdom": "^30.0.1",
|
|
154
|
+
"oxlint": "0.18.1",
|
|
149
155
|
"react": "18.3.1",
|
|
150
156
|
"react-dom": "18.3.1",
|
|
151
157
|
"vitest": "^4.1.10"
|
|
@@ -157,6 +163,9 @@
|
|
|
157
163
|
"typecheck:ci": "tsc -p tsconfig.ci.json --noEmit",
|
|
158
164
|
"test": "vitest run",
|
|
159
165
|
"test:watch": "vitest",
|
|
166
|
+
"test:coverage": "vitest run --coverage",
|
|
167
|
+
"lint": "oxlint",
|
|
168
|
+
"check:readmes": "node scripts/check-readme-sync.mjs",
|
|
160
169
|
"verify:self-contained": "node scripts/verify-self-contained.mjs",
|
|
161
170
|
"verify:artifacts": "node scripts/verify-artifacts.mjs"
|
|
162
171
|
}
|
package/src/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ export {
|
|
|
65
65
|
type McpPatchResolution,
|
|
66
66
|
} from './patch.ts'
|
|
67
67
|
export { appendPatchFragment } from './write.ts'
|
|
68
|
-
export {
|
|
68
|
+
export { createTrialCaller, validateTrialRequest, type McpTrialRequest, type McpTrialResult } from './trial.ts'
|
|
69
69
|
export { MCP_STATUS_EVENT, type McpStatusPayload, type McpStatusQuery, type McpServerStatus } from './upstream.ts'
|
|
70
70
|
export type * from './wire.ts'
|
|
71
71
|
|
package/src/probe.ts
CHANGED
|
@@ -31,7 +31,7 @@ const INITIALIZE_PROTOCOL_VERSION = '2024-11-05'
|
|
|
31
31
|
/** MCP clientInfo facts; protocol constants, not configuration. Exported so the
|
|
32
32
|
* version-consistency tripwire (`tests/version.spec.ts`) can assert the
|
|
33
33
|
* advertised version tracks the package version. */
|
|
34
|
-
export const PROBE_CLIENT_INFO = { name: 'dsh-mcp-panel', version: '0.4.
|
|
34
|
+
export const PROBE_CLIENT_INFO = { name: 'dsh-mcp-panel', version: '0.4.2' }
|
|
35
35
|
|
|
36
36
|
/** One settled probe: outcome status plus a sanitized one-line detail. */
|
|
37
37
|
export interface ProbeOutcome {
|
package/src/service.ts
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
type McpPatchResolution,
|
|
51
51
|
} from './patch.ts'
|
|
52
52
|
import { appendPatchFragment } from './write.ts'
|
|
53
|
-
import {
|
|
53
|
+
import { createTrialCaller, validateTrialRequest, type McpAgentRegistryFace, type McpTrialRequest } from './trial.ts'
|
|
54
54
|
import { probeEndpoint, probeJob, PROBE_KIND } from './probe.ts'
|
|
55
55
|
import { sanitizeText } from './sanitize.ts'
|
|
56
56
|
import type { McpServerStatus, McpStatusPhase } from './upstream.ts'
|
|
@@ -194,6 +194,9 @@ export class McpPanelService extends TypertRemoteService {
|
|
|
194
194
|
private readonly observedAt = new Map<string, number>()
|
|
195
195
|
/** Latest passive-probe reachability per server namespace. */
|
|
196
196
|
private readonly probeStates = new Map<string, { state: 'reachable' | 'unreachable'; checkedAt: number }>()
|
|
197
|
+
|
|
198
|
+
/** The trial caller with this instance's own callId sequence. */
|
|
199
|
+
private readonly trialCaller = createTrialCaller()
|
|
197
200
|
/** Passive-probe loop guard: one sweep at a time. */
|
|
198
201
|
private passiveRunning = false
|
|
199
202
|
|
|
@@ -448,7 +451,7 @@ export class McpPanelService extends TypertRemoteService {
|
|
|
448
451
|
}
|
|
449
452
|
const problem = validateTrialRequest(request)
|
|
450
453
|
if (problem !== null) throw new Error(`dsh-mcp-panel: ${problem}`)
|
|
451
|
-
return runTrialCall(
|
|
454
|
+
return this.trialCaller.runTrialCall(
|
|
452
455
|
this.ctx.tools,
|
|
453
456
|
agentsOf(this.ctx),
|
|
454
457
|
sessionId,
|
package/src/trial.ts
CHANGED
|
@@ -59,9 +59,6 @@ export interface McpTrialLimits {
|
|
|
59
59
|
/** Panel-owned marker prefix so trial callIds can never collide with model calls. */
|
|
60
60
|
const TRIAL_CALL_PREFIX = 'mcp-panel-trial'
|
|
61
61
|
|
|
62
|
-
/** Trial callId counter per service instance. */
|
|
63
|
-
let trialCounter = 0
|
|
64
|
-
|
|
65
62
|
/**
|
|
66
63
|
* Validate one trial request structurally; returns an English error string
|
|
67
64
|
* or null. Never throws on untrusted input.
|
|
@@ -83,50 +80,60 @@ export function validateTrialRequest(request: unknown): string | null {
|
|
|
83
80
|
}
|
|
84
81
|
|
|
85
82
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @
|
|
89
|
-
* @param agents - optional live agent registry for approval routing.
|
|
90
|
-
* @param sessionId - optional current session id from the client.
|
|
91
|
-
* @param request - the validated trial request.
|
|
92
|
-
* @param limits - panel-side deadline and result cap.
|
|
93
|
-
* @returns the wire result.
|
|
83
|
+
* Create the trial caller: one callId sequence per service instance, so a
|
|
84
|
+
* plugin reload never carries counter state across mounts.
|
|
85
|
+
* @returns the trial caller bound to its own sequence.
|
|
94
86
|
*/
|
|
95
|
-
export
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
87
|
+
export function createTrialCaller() {
|
|
88
|
+
let trialCounter = 0
|
|
89
|
+
return {
|
|
90
|
+
/**
|
|
91
|
+
* Run one trial call through the official tool pipeline.
|
|
92
|
+
*
|
|
93
|
+
* @param tools - the registry the call executes through.
|
|
94
|
+
* @param agents - optional live agent registry for approval routing.
|
|
95
|
+
* @param sessionId - optional current session id from the client.
|
|
96
|
+
* @param request - the validated trial request.
|
|
97
|
+
* @param limits - panel-side deadline and result cap.
|
|
98
|
+
* @returns the wire result.
|
|
99
|
+
*/
|
|
100
|
+
async runTrialCall(
|
|
101
|
+
tools: ToolRuntime,
|
|
102
|
+
agents: McpAgentRegistryFace | undefined,
|
|
103
|
+
sessionId: string | undefined,
|
|
104
|
+
request: McpTrialRequest,
|
|
105
|
+
limits: McpTrialLimits,
|
|
106
|
+
): Promise<McpTrialResult> {
|
|
107
|
+
const { serverName, toolName } = request
|
|
108
|
+
const prefix = `mcp__${serverName}__`
|
|
109
|
+
if (!toolName.startsWith(prefix)) {
|
|
110
|
+
throw new Error(`tool "${toolName}" does not belong to server "${serverName}" (expected the ${prefix}… namespace)`)
|
|
111
|
+
}
|
|
112
|
+
if (tools.get(toolName) === undefined) {
|
|
113
|
+
throw new Error(`tool "${toolName}" is not registered — the server may be down or its sync failed`)
|
|
114
|
+
}
|
|
115
|
+
let argumentsValue: unknown
|
|
116
|
+
try {
|
|
117
|
+
argumentsValue = JSON.parse(request.argsJson)
|
|
118
|
+
} catch {
|
|
119
|
+
throw new Error('argsJson is not valid JSON')
|
|
120
|
+
}
|
|
121
|
+
const agent = sessionId === undefined || sessionId === '' ? undefined : agents?.get(sessionId)
|
|
122
|
+
const callId = `${TRIAL_CALL_PREFIX}-${++trialCounter}` as unknown as ToolExecutionInput['callId']
|
|
123
|
+
const started = Date.now()
|
|
124
|
+
const execution: ToolExecutionInput = {
|
|
125
|
+
callId,
|
|
126
|
+
name: toolName,
|
|
127
|
+
arguments: argumentsValue,
|
|
128
|
+
...agent === undefined ? {} : { agent: agent as NonNullable<ToolExecutionInput['agent']> },
|
|
129
|
+
signal: AbortSignal.timeout(limits.timeoutMs),
|
|
130
|
+
}
|
|
131
|
+
const result = await tools.execute(execution)
|
|
132
|
+
const durationMs = Date.now() - started
|
|
133
|
+
const { json, truncated } = projectTrialResult(result, limits.maxResultChars)
|
|
134
|
+
return { callId: String(callId), isError: result.isError, truncated, durationMs, resultJson: json }
|
|
135
|
+
},
|
|
125
136
|
}
|
|
126
|
-
const result = await tools.execute(execution)
|
|
127
|
-
const durationMs = Date.now() - started
|
|
128
|
-
const { json, truncated } = projectTrialResult(result, limits.maxResultChars)
|
|
129
|
-
return { callId: String(callId), isError: result.isError, truncated, durationMs, resultJson: json }
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
/** Project the registry outcome onto the lossless JSON the client renders. */
|