@developerz.ai/ui-debugger-mcp 1.1.0 → 1.2.0
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/README.md +22 -10
- package/dist/adapters/android/adb.d.ts +34 -5
- package/dist/adapters/android/adb.js +74 -20
- package/dist/adapters/android/adb.js.map +1 -1
- package/dist/adapters/android/android-adapter.d.ts +23 -7
- package/dist/adapters/android/android-adapter.js +106 -36
- package/dist/adapters/android/android-adapter.js.map +1 -1
- package/dist/adapters/android/android-adapter.test-helpers.d.ts +52 -0
- package/dist/adapters/android/android-adapter.test-helpers.js +115 -0
- package/dist/adapters/android/android-adapter.test-helpers.js.map +1 -0
- package/dist/adapters/android/commands.d.ts +27 -4
- package/dist/adapters/android/commands.js +66 -4
- package/dist/adapters/android/commands.js.map +1 -1
- package/dist/adapters/android/ports.d.ts +32 -0
- package/dist/adapters/android/ports.js +47 -0
- package/dist/adapters/android/ports.js.map +1 -0
- package/dist/adapters/android/uiautomator.d.ts +10 -2
- package/dist/adapters/android/uiautomator.js +36 -4
- package/dist/adapters/android/uiautomator.js.map +1 -1
- package/dist/adapters/browser/browser-adapter.d.ts +14 -13
- package/dist/adapters/browser/browser-adapter.js +69 -306
- package/dist/adapters/browser/browser-adapter.js.map +1 -1
- package/dist/adapters/browser/cdp.js +18 -11
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/extractor.d.ts +49 -0
- package/dist/adapters/browser/extractor.js +208 -0
- package/dist/adapters/browser/extractor.js.map +1 -0
- package/dist/adapters/browser/filters.d.ts +15 -0
- package/dist/adapters/browser/filters.js +93 -0
- package/dist/adapters/browser/filters.js.map +1 -0
- package/dist/adapters/browser/launch.d.ts +41 -0
- package/dist/adapters/browser/launch.js +61 -0
- package/dist/adapters/browser/launch.js.map +1 -0
- package/dist/adapters/budget.d.ts +16 -0
- package/dist/adapters/budget.js +25 -0
- package/dist/adapters/budget.js.map +1 -0
- package/dist/adapters/contract.d.ts +13 -6
- package/dist/adapters/desktop/atspi.d.ts +15 -0
- package/dist/adapters/desktop/atspi.js +37 -17
- package/dist/adapters/desktop/atspi.js.map +1 -1
- package/dist/adapters/desktop/capture.js +8 -1
- package/dist/adapters/desktop/capture.js.map +1 -1
- package/dist/adapters/desktop/desktop-adapter.d.ts +9 -2
- package/dist/adapters/desktop/desktop-adapter.js +84 -32
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
- package/dist/adapters/desktop/input.d.ts +16 -1
- package/dist/adapters/desktop/input.js +30 -0
- package/dist/adapters/desktop/input.js.map +1 -1
- package/dist/adapters/desktop/proc.d.ts +18 -3
- package/dist/adapters/desktop/proc.js +48 -5
- package/dist/adapters/desktop/proc.js.map +1 -1
- package/dist/adapters/factory.d.ts +3 -1
- package/dist/adapters/factory.js +6 -2
- package/dist/adapters/factory.js.map +1 -1
- package/dist/adapters/limit.d.ts +10 -0
- package/dist/adapters/limit.js +19 -0
- package/dist/adapters/limit.js.map +1 -0
- package/dist/agent/belt/act.d.ts +27 -5
- package/dist/agent/belt/act.js +75 -17
- package/dist/agent/belt/act.js.map +1 -1
- package/dist/agent/belt/observe.d.ts +29 -15
- package/dist/agent/belt/observe.js +74 -19
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/belt/report.d.ts +29 -9
- package/dist/agent/belt/report.js +77 -10
- package/dist/agent/belt/report.js.map +1 -1
- package/dist/agent/belt/trail.d.ts +34 -0
- package/dist/agent/belt/trail.js +64 -0
- package/dist/agent/belt/trail.js.map +1 -0
- package/dist/agent/capabilities.d.ts +4 -4
- package/dist/agent/capabilities.js +38 -13
- package/dist/agent/capabilities.js.map +1 -1
- package/dist/agent/loop.d.ts +58 -19
- package/dist/agent/loop.js +134 -46
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/prompts/compose.d.ts +9 -1
- package/dist/agent/prompts/compose.js +5 -4
- package/dist/agent/prompts/compose.js.map +1 -1
- package/dist/agent/prompts/debug-agent.d.ts +13 -1
- package/dist/agent/prompts/debug-agent.js +45 -11
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/desktop-addendum.d.ts +1 -1
- package/dist/agent/prompts/desktop-addendum.js +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +1 -1
- package/dist/agent/prompts/web-addendum.js +16 -18
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/cli/control.d.ts +3 -1
- package/dist/cli/control.js +26 -40
- package/dist/cli/control.js.map +1 -1
- package/dist/cli/help.d.ts +3 -1
- package/dist/cli/help.js +6 -2
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/init.d.ts +3 -6
- package/dist/cli/init.js +64 -16
- package/dist/cli/init.js.map +1 -1
- package/dist/config/load.js +8 -1
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +12 -5
- package/dist/config/schema.js +17 -7
- package/dist/config/schema.js.map +1 -1
- package/dist/errors.d.ts +14 -2
- package/dist/errors.js +24 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/main.js +22 -8
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.d.ts +16 -1
- package/dist/mcp/server.js +23 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/server.test-helpers.d.ts +23 -0
- package/dist/mcp/server.test-helpers.js +49 -0
- package/dist/mcp/server.test-helpers.js.map +1 -0
- package/dist/mcp/tools/describe.js +5 -0
- package/dist/mcp/tools/describe.js.map +1 -1
- package/dist/mcp/tools/end-session.js +5 -0
- package/dist/mcp/tools/end-session.js.map +1 -1
- package/dist/mcp/tools/get-findings.js +23 -3
- package/dist/mcp/tools/get-findings.js.map +1 -1
- package/dist/mcp/tools/output.d.ts +50 -0
- package/dist/mcp/tools/output.js +55 -0
- package/dist/mcp/tools/output.js.map +1 -0
- package/dist/mcp/tools/result.d.ts +24 -1
- package/dist/mcp/tools/result.js +106 -5
- package/dist/mcp/tools/result.js.map +1 -1
- package/dist/mcp/tools/send-message.js +5 -0
- package/dist/mcp/tools/send-message.js.map +1 -1
- package/dist/mcp/tools/start-debug.js +7 -1
- package/dist/mcp/tools/start-debug.js.map +1 -1
- package/dist/services/debug-service.d.ts +38 -6
- package/dist/services/debug-service.js +122 -13
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/session-builder.d.ts +20 -3
- package/dist/services/session-builder.js +43 -13
- package/dist/services/session-builder.js.map +1 -1
- package/dist/session/atomic-write.d.ts +24 -0
- package/dist/session/atomic-write.js +39 -0
- package/dist/session/atomic-write.js.map +1 -0
- package/dist/session/findings-store.js +3 -4
- package/dist/session/findings-store.js.map +1 -1
- package/dist/session/process-identity.d.ts +16 -0
- package/dist/session/process-identity.js +29 -0
- package/dist/session/process-identity.js.map +1 -1
- package/dist/session/session.js +10 -2
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.d.ts +51 -5
- package/dist/session/state-file.js +60 -8
- package/dist/session/state-file.js.map +1 -1
- package/dist/session/workspace.d.ts +11 -0
- package/dist/session/workspace.js +14 -1
- package/dist/session/workspace.js.map +1 -1
- package/package.json +4 -1
package/dist/errors.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Each error type extends the base UiDebuggerError for proper error handling and recovery.
|
|
4
4
|
*/
|
|
5
5
|
export declare class UiDebuggerError extends Error {
|
|
6
|
-
constructor(message: string);
|
|
6
|
+
constructor(message: string, options?: ErrorOptions);
|
|
7
7
|
}
|
|
8
8
|
export declare class ConfigError extends UiDebuggerError {
|
|
9
9
|
constructor(message: string);
|
|
@@ -22,7 +22,15 @@ export declare class TargetNotFoundError extends UiDebuggerError {
|
|
|
22
22
|
constructor(message: string);
|
|
23
23
|
}
|
|
24
24
|
export declare class AdapterError extends UiDebuggerError {
|
|
25
|
-
constructor(message: string);
|
|
25
|
+
constructor(message: string, options?: ErrorOptions);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A CLI tool blew its per-invocation wall-clock cap and was killed (desktop transport).
|
|
29
|
+
* Its own subtype so callers that tolerate an ordinary non-zero exit — "this node has no
|
|
30
|
+
* Component", "no window matched yet" — can still refuse to swallow a wedged process.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ExecTimeoutError extends AdapterError {
|
|
33
|
+
constructor(message: string, options?: ErrorOptions);
|
|
26
34
|
}
|
|
27
35
|
/** A failed ADB invocation (android transport). Extends {@link AdapterError} so the agent loop catches it. */
|
|
28
36
|
export declare class AdbError extends AdapterError {
|
|
@@ -45,6 +53,10 @@ export declare class ProviderError extends UiDebuggerError {
|
|
|
45
53
|
export declare class FindingsError extends UiDebuggerError {
|
|
46
54
|
constructor(message: string);
|
|
47
55
|
}
|
|
56
|
+
/** `ui-debugger-mcp init` scaffold failures (fs writes, gitignore updates). */
|
|
57
|
+
export declare class InitError extends UiDebuggerError {
|
|
58
|
+
constructor(message: string);
|
|
59
|
+
}
|
|
48
60
|
export declare class McpServerError extends UiDebuggerError {
|
|
49
61
|
constructor(message: string);
|
|
50
62
|
}
|
package/dist/errors.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Each error type extends the base UiDebuggerError for proper error handling and recovery.
|
|
4
4
|
*/
|
|
5
5
|
export class UiDebuggerError extends Error {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super(message);
|
|
6
|
+
constructor(message, options) {
|
|
7
|
+
super(message, options);
|
|
8
8
|
this.name = 'UiDebuggerError';
|
|
9
9
|
Object.setPrototypeOf(this, UiDebuggerError.prototype);
|
|
10
10
|
}
|
|
@@ -46,12 +46,24 @@ export class TargetNotFoundError extends UiDebuggerError {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
export class AdapterError extends UiDebuggerError {
|
|
49
|
-
constructor(message) {
|
|
50
|
-
super(message);
|
|
49
|
+
constructor(message, options) {
|
|
50
|
+
super(message, options);
|
|
51
51
|
this.name = 'AdapterError';
|
|
52
52
|
Object.setPrototypeOf(this, AdapterError.prototype);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* A CLI tool blew its per-invocation wall-clock cap and was killed (desktop transport).
|
|
57
|
+
* Its own subtype so callers that tolerate an ordinary non-zero exit — "this node has no
|
|
58
|
+
* Component", "no window matched yet" — can still refuse to swallow a wedged process.
|
|
59
|
+
*/
|
|
60
|
+
export class ExecTimeoutError extends AdapterError {
|
|
61
|
+
constructor(message, options) {
|
|
62
|
+
super(message, options);
|
|
63
|
+
this.name = 'ExecTimeoutError';
|
|
64
|
+
Object.setPrototypeOf(this, ExecTimeoutError.prototype);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
55
67
|
/** A failed ADB invocation (android transport). Extends {@link AdapterError} so the agent loop catches it. */
|
|
56
68
|
export class AdbError extends AdapterError {
|
|
57
69
|
constructor(message) {
|
|
@@ -93,6 +105,14 @@ export class FindingsError extends UiDebuggerError {
|
|
|
93
105
|
Object.setPrototypeOf(this, FindingsError.prototype);
|
|
94
106
|
}
|
|
95
107
|
}
|
|
108
|
+
/** `ui-debugger-mcp init` scaffold failures (fs writes, gitignore updates). */
|
|
109
|
+
export class InitError extends UiDebuggerError {
|
|
110
|
+
constructor(message) {
|
|
111
|
+
super(message);
|
|
112
|
+
this.name = 'InitError';
|
|
113
|
+
Object.setPrototypeOf(this, InitError.prototype);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
96
116
|
export class McpServerError extends UiDebuggerError {
|
|
97
117
|
constructor(message) {
|
|
98
118
|
super(message);
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACx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rD,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const NAME = "ui-debugger-mcp";
|
|
2
|
-
export declare const VERSION = "1.
|
|
2
|
+
export declare const VERSION = "1.2.0";
|
package/dist/index.js
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { isAbsolute, join } from 'node:path';
|
|
2
3
|
import { supportsImageInput } from './agent/capabilities.js';
|
|
3
4
|
import { resolveModels } from './agent/models.js';
|
|
4
5
|
import { createOpenRouterProvider, resolveProviderConfig } from './agent/provider.js';
|
|
5
6
|
import { runStatus, runStop } from './cli/control.js';
|
|
6
|
-
import { runHelp, runVersion } from './cli/help.js';
|
|
7
|
+
import { printUsage, runHelp, runVersion } from './cli/help.js';
|
|
7
8
|
import { runInit } from './cli/init.js';
|
|
8
9
|
import { loadConfig } from './config/load.js';
|
|
9
10
|
import { NAME, VERSION } from './index.js';
|
|
@@ -42,12 +43,22 @@ async function main() {
|
|
|
42
43
|
}
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
46
|
+
// Unknown subcommand → print usage and exit 1 (runHelp() would exit 0 first).
|
|
47
|
+
if (subcmd !== undefined) {
|
|
48
|
+
console.error(`${NAME}: unknown subcommand '${subcmd}'.`);
|
|
49
|
+
printUsage();
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
45
52
|
try {
|
|
46
53
|
// Load project config (cwd-keyed)
|
|
47
54
|
const config = loadConfig();
|
|
48
55
|
const cwd = process.cwd();
|
|
49
56
|
// Bootstrap workspace directories (chrome-user-data/, sessions/)
|
|
50
|
-
|
|
57
|
+
// Anchor relative workspace paths to the project root.
|
|
58
|
+
const workspaceBase = isAbsolute(config.workspace)
|
|
59
|
+
? config.workspace
|
|
60
|
+
: join(cwd, config.workspace);
|
|
61
|
+
const workspace = workspacePaths(cwd, workspaceBase);
|
|
51
62
|
await ensureWorkspace(workspace);
|
|
52
63
|
// Resolve provider + per-role models (driver, vision, summary)
|
|
53
64
|
const providerOptions = {
|
|
@@ -87,17 +98,20 @@ async function main() {
|
|
|
87
98
|
});
|
|
88
99
|
// Graceful stop: a CLI `stop` (or any SIGTERM/SIGINT) tears the run down —
|
|
89
100
|
// abort the loop, close the browser, free the profile — then exits cleanly.
|
|
90
|
-
const shutdown = (
|
|
101
|
+
const shutdown = (exitCode) => {
|
|
91
102
|
service
|
|
92
103
|
.endActive()
|
|
93
104
|
.catch(() => undefined)
|
|
94
|
-
.finally(() => process.exit(
|
|
105
|
+
.finally(() => process.exit(exitCode));
|
|
95
106
|
};
|
|
96
|
-
process.once('SIGTERM', () => shutdown(
|
|
97
|
-
process.once('SIGINT', () => shutdown(
|
|
98
|
-
// Boot stdio MCP server with outer tools
|
|
107
|
+
process.once('SIGTERM', () => shutdown(0));
|
|
108
|
+
process.once('SIGINT', () => shutdown(130));
|
|
109
|
+
// Boot stdio MCP server with outer tools. A dead client is a shutdown too:
|
|
110
|
+
// nothing can read findings or `end_session` any more, so the run must not
|
|
111
|
+
// keep a browser (and the profile lock) alive until its cap. Same idempotent
|
|
112
|
+
// teardown path as the signals above.
|
|
99
113
|
const tools = outerTools(service);
|
|
100
|
-
await startStdioServer(tools);
|
|
114
|
+
await startStdioServer(tools, { onClose: () => shutdown(0) });
|
|
101
115
|
}
|
|
102
116
|
catch (err) {
|
|
103
117
|
console.error(`${NAME} v${VERSION}: ${err instanceof Error ? err.message : String(err)}`);
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE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
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
3
|
/**
|
|
3
4
|
* A self-registering outer MCP tool.
|
|
@@ -18,8 +19,22 @@ export interface McpTool {
|
|
|
18
19
|
* Fails fast on a duplicate tool name so collisions surface loud.
|
|
19
20
|
*/
|
|
20
21
|
export declare function createMcpServer(tools: readonly McpTool[]): McpServer;
|
|
22
|
+
/** Wiring for {@link startStdioServer}. */
|
|
23
|
+
export interface StdioServerInit {
|
|
24
|
+
/**
|
|
25
|
+
* Called exactly once when the client connection drops for any reason — the
|
|
26
|
+
* client process dying (stdin EOF) or an explicit close. The caller's hook to
|
|
27
|
+
* tear a live run down: with nobody left to read findings or send
|
|
28
|
+
* `end_session`, a browser must not outlive the client.
|
|
29
|
+
*/
|
|
30
|
+
readonly onClose?: () => void;
|
|
31
|
+
/** Stream the transport reads. Defaults to this process's stdin; a test seam. */
|
|
32
|
+
readonly stdin?: Readable;
|
|
33
|
+
/** Stream the transport writes. Defaults to this process's stdout; a test seam. */
|
|
34
|
+
readonly stdout?: Writable;
|
|
35
|
+
}
|
|
21
36
|
/**
|
|
22
37
|
* Boot the stdio MCP server: register the tools, connect the stdio transport,
|
|
23
38
|
* and return the live server. Callers wire dependencies into the tools.
|
|
24
39
|
*/
|
|
25
|
-
export declare function startStdioServer(tools: readonly McpTool[]): Promise<McpServer>;
|
|
40
|
+
export declare function startStdioServer(tools: readonly McpTool[], { onClose, stdin, stdout }?: StdioServerInit): Promise<McpServer>;
|
package/dist/mcp/server.js
CHANGED
|
@@ -22,9 +22,30 @@ export function createMcpServer(tools) {
|
|
|
22
22
|
* Boot the stdio MCP server: register the tools, connect the stdio transport,
|
|
23
23
|
* and return the live server. Callers wire dependencies into the tools.
|
|
24
24
|
*/
|
|
25
|
-
export async function startStdioServer(tools) {
|
|
25
|
+
export async function startStdioServer(tools, { onClose, stdin = process.stdin, stdout = process.stdout } = {}) {
|
|
26
26
|
const server = createMcpServer(tools);
|
|
27
|
-
const transport = new StdioServerTransport();
|
|
27
|
+
const transport = new StdioServerTransport(stdin, stdout);
|
|
28
|
+
// Both drop paths below can reach this, so it fires at most once.
|
|
29
|
+
let notified = false;
|
|
30
|
+
const dropped = () => {
|
|
31
|
+
if (notified)
|
|
32
|
+
return;
|
|
33
|
+
notified = true;
|
|
34
|
+
onClose?.();
|
|
35
|
+
};
|
|
36
|
+
server.server.onclose = dropped;
|
|
37
|
+
// The SDK's stdio transport listens for `data`/`error` on stdin and nothing
|
|
38
|
+
// else — EOF (the client died) never reaches `onclose` on its own. Watch it
|
|
39
|
+
// here and close the server, so client death and an explicit close land on the
|
|
40
|
+
// same hook. Wired before `connect` starts the flow: no EOF can slip past.
|
|
41
|
+
const clientGone = () => {
|
|
42
|
+
void server
|
|
43
|
+
.close()
|
|
44
|
+
.catch(() => undefined)
|
|
45
|
+
.finally(dropped);
|
|
46
|
+
};
|
|
47
|
+
stdin.once('end', clientGone);
|
|
48
|
+
stdin.once('close', clientGone);
|
|
28
49
|
await server.connect(transport);
|
|
29
50
|
return server;
|
|
30
51
|
}
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAiB5C;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;I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AAK,EAAE,UAAU,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAEhC,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared fixtures for `server.test.ts` + `server.stdio.test.ts` — a fake
|
|
3
|
+
* `SessionBuilder` wired to a real `Session`/`FindingsStore`, so both files can
|
|
4
|
+
* drive a `DebugService` without a real adapter/browser.
|
|
5
|
+
*/
|
|
6
|
+
import type { ResolvedConfig } from '../config/load.js';
|
|
7
|
+
import type { BuiltSession } from '../services/session-builder.js';
|
|
8
|
+
import type { LoopRunner, SessionAdapter } from '../session/session.js';
|
|
9
|
+
export declare const CWD = "/project/app";
|
|
10
|
+
export declare const NOW = 1700000000000;
|
|
11
|
+
export declare const CONFIG: ResolvedConfig;
|
|
12
|
+
export declare class FakeAdapter implements SessionAdapter {
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/** A run that idles until aborted. */
|
|
16
|
+
export declare const idleRun: LoopRunner;
|
|
17
|
+
/** A `SessionBuilder` stub rooted at the caller's tmp workspace dir. */
|
|
18
|
+
export declare function fakeBuilder(tmpDir: string): (params: {
|
|
19
|
+
id: string;
|
|
20
|
+
target: string;
|
|
21
|
+
goal: string;
|
|
22
|
+
criteria?: string;
|
|
23
|
+
}) => Promise<BuiltSession>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared fixtures for `server.test.ts` + `server.stdio.test.ts` — a fake
|
|
3
|
+
* `SessionBuilder` wired to a real `Session`/`FindingsStore`, so both files can
|
|
4
|
+
* drive a `DebugService` without a real adapter/browser.
|
|
5
|
+
*/
|
|
6
|
+
import { FindingsStore } from '../session/findings-store.js';
|
|
7
|
+
import { Session } from '../session/session.js';
|
|
8
|
+
import { sessionPaths, workspacePaths } from '../session/workspace.js';
|
|
9
|
+
export const CWD = '/project/app';
|
|
10
|
+
export const NOW = 1_700_000_000_000;
|
|
11
|
+
export const CONFIG = {
|
|
12
|
+
models: { driver: 'deepseek/x', vision: 'glm/y', summary: 'deepseek/z' },
|
|
13
|
+
workspace: './tmp/ui-debugger-mcp',
|
|
14
|
+
targets: {
|
|
15
|
+
web: { adapter: 'browser', url: 'http://localhost:3000', headless: true },
|
|
16
|
+
},
|
|
17
|
+
provider: { apiKey: 'sk-test', baseUrl: 'https://openrouter.ai/api/v1' },
|
|
18
|
+
};
|
|
19
|
+
export class FakeAdapter {
|
|
20
|
+
async close() { }
|
|
21
|
+
}
|
|
22
|
+
/** A run that idles until aborted. */
|
|
23
|
+
export const idleRun = ({ signal }) => new Promise((resolve) => {
|
|
24
|
+
if (signal.aborted)
|
|
25
|
+
resolve();
|
|
26
|
+
else
|
|
27
|
+
signal.addEventListener('abort', () => resolve(), { once: true });
|
|
28
|
+
});
|
|
29
|
+
/** A `SessionBuilder` stub rooted at the caller's tmp workspace dir. */
|
|
30
|
+
export function fakeBuilder(tmpDir) {
|
|
31
|
+
return async (params) => {
|
|
32
|
+
const adapter = new FakeAdapter();
|
|
33
|
+
const store = new FindingsStore(sessionPaths(workspacePaths(CWD, tmpDir), params.id));
|
|
34
|
+
const session = new Session({
|
|
35
|
+
id: params.id,
|
|
36
|
+
story: params.goal,
|
|
37
|
+
criteria: params.criteria,
|
|
38
|
+
adapter,
|
|
39
|
+
findingsStore: store,
|
|
40
|
+
});
|
|
41
|
+
const built = {
|
|
42
|
+
session,
|
|
43
|
+
open: async () => { },
|
|
44
|
+
run: idleRun,
|
|
45
|
+
};
|
|
46
|
+
return built;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=server.test-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.test-helpers.js","sourceRoot":"","sources":["../../src/mcp/server.test-helpers.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,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACtF,MAAM,OAAO,GAAG,IAAI,OAAO,CAAiB;YAC1C,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,IAAI;YAClB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO;YACP,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;QACH,MAAM,KAAK,GAAiB;YAC1B,OAAO;YACP,IAAI,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;YACpB,GAAG,EAAE,OAAO;SACb,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* {@link DebugApi.describe}.
|
|
8
8
|
*/
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
+
import { DescribeResultSchema } from './output.js';
|
|
10
11
|
import { toToolResult } from './result.js';
|
|
11
12
|
/** Build the `describe` outer tool bound to the debug service. */
|
|
12
13
|
export function describeTool(service) {
|
|
@@ -18,6 +19,9 @@ export function describeTool(service) {
|
|
|
18
19
|
description: 'List the configured targets for this project (name, adapter, managed|attach, whether wired, ' +
|
|
19
20
|
'and web url/headless) plus the resolved per-role models and workspace. Call this first to pick ' +
|
|
20
21
|
'a valid target for start_debug. Pass target to narrow to one.',
|
|
22
|
+
annotations: {
|
|
23
|
+
readOnlyHint: true,
|
|
24
|
+
},
|
|
21
25
|
inputSchema: {
|
|
22
26
|
target: z
|
|
23
27
|
.string()
|
|
@@ -25,6 +29,7 @@ export function describeTool(service) {
|
|
|
25
29
|
.optional()
|
|
26
30
|
.describe('Optional target name to narrow the catalog to a single entry.'),
|
|
27
31
|
},
|
|
32
|
+
outputSchema: DescribeResultSchema,
|
|
28
33
|
}, (args) => toToolResult(service.describe(args)));
|
|
29
34
|
},
|
|
30
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../src/mcp/tools/describe.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,OAAiB;IAC5C,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,CAAC,MAAM;YACb,MAAM,CAAC,YAAY,CACjB,UAAU,EACV;gBACE,KAAK,EAAE,wBAAwB;gBAC/B,WAAW,EACT,8FAA8F;oBAC9F,iGAAiG;oBACjG,+DAA+D;gBACjE,WAAW,EAAE;oBACX,MAAM,EAAE,CAAC;yBACN,MAAM,EAAE;yBACR,GAAG,CAAC,CAAC,CAAC;yBACN,QAAQ,EAAE;yBACV,QAAQ,CAAC,+DAA+D,CAAC;iBAC7E;
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../src/mcp/tools/describe.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,OAAiB;IAC5C,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,CAAC,MAAM;YACb,MAAM,CAAC,YAAY,CACjB,UAAU,EACV;gBACE,KAAK,EAAE,wBAAwB;gBAC/B,WAAW,EACT,8FAA8F;oBAC9F,iGAAiG;oBACjG,+DAA+D;gBACjE,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;iBACnB;gBACD,WAAW,EAAE;oBACX,MAAM,EAAE,CAAC;yBACN,MAAM,EAAE;yBACR,GAAG,CAAC,CAAC,CAAC;yBACN,QAAQ,EAAE;yBACV,QAAQ,CAAC,+DAA+D,CAAC;iBAC7E;gBACD,YAAY,EAAE,oBAAoB;aACnC,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAC/C,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Zod-validate, call {@link DebugApi.end}, ack.
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
+
import { AckSchema } from './output.js';
|
|
9
10
|
import { toToolResult } from './result.js';
|
|
10
11
|
/** Build the `end_session` outer tool bound to the debug service. */
|
|
11
12
|
export function endSessionTool(service) {
|
|
@@ -17,9 +18,13 @@ export function endSessionTool(service) {
|
|
|
17
18
|
description: 'Close the active run: abort the loop, release the target (managed Chrome is stopped; an ' +
|
|
18
19
|
'attached browser is only disconnected), and free the project lock so a new start_debug can ' +
|
|
19
20
|
'run. The last get_findings snapshot remains on disk.',
|
|
21
|
+
annotations: {
|
|
22
|
+
idempotentHint: true,
|
|
23
|
+
},
|
|
20
24
|
inputSchema: {
|
|
21
25
|
session_id: z.string().min(1).describe('The id returned by start_debug.'),
|
|
22
26
|
},
|
|
27
|
+
outputSchema: AckSchema,
|
|
23
28
|
}, async (args) => toToolResult(await service.end(args)));
|
|
24
29
|
},
|
|
25
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-session.js","sourceRoot":"","sources":["../../../src/mcp/tools/end-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,qEAAqE;AACrE,MAAM,UAAU,cAAc,CAAC,OAAiB;IAC9C,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,QAAQ,CAAC,MAAM;YACb,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;gBACE,KAAK,EAAE,mBAAmB;gBAC1B,WAAW,EACT,0FAA0F;oBAC1F,6FAA6F;oBAC7F,sDAAsD;gBACxD,WAAW,EAAE;oBACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;iBAC1E;
|
|
1
|
+
{"version":3,"file":"end-session.js","sourceRoot":"","sources":["../../../src/mcp/tools/end-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,qEAAqE;AACrE,MAAM,UAAU,cAAc,CAAC,OAAiB;IAC9C,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,QAAQ,CAAC,MAAM;YACb,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;gBACE,KAAK,EAAE,mBAAmB;gBAC1B,WAAW,EACT,0FAA0F;oBAC1F,6FAA6F;oBAC7F,sDAAsD;gBACxD,WAAW,EAAE;oBACX,cAAc,EAAE,IAAI;iBACrB;gBACD,WAAW,EAAE;oBACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;iBAC1E;gBACD,YAAY,EAAE,SAAS;aACxB,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CACtD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -11,6 +11,14 @@ import { FindingsSchema } from '../../findings/schema.js';
|
|
|
11
11
|
import { toToolResult } from './result.js';
|
|
12
12
|
/** Selectable top-level findings keys, derived from the findings schema. */
|
|
13
13
|
const FindingsField = FindingsSchema.keyof();
|
|
14
|
+
/**
|
|
15
|
+
* Declared output: the findings object with every key optional.
|
|
16
|
+
*
|
|
17
|
+
* A `fields` projection returns only the requested keys, so no key can be
|
|
18
|
+
* promised — an all-required schema would make every sparse read fail output
|
|
19
|
+
* validation. Types stay exact per key; only presence is loose.
|
|
20
|
+
*/
|
|
21
|
+
const FindingsOutputSchema = FindingsSchema.partial();
|
|
14
22
|
/** Build the `get_findings` outer tool bound to the debug service. */
|
|
15
23
|
export function getFindingsTool(service) {
|
|
16
24
|
return {
|
|
@@ -20,7 +28,12 @@ export function getFindingsTool(service) {
|
|
|
20
28
|
title: 'Get run findings',
|
|
21
29
|
description: 'Poll the run: status (running|passed|failed) plus structured findings — the step trail, ' +
|
|
22
30
|
'functional bugs, visual/UX feedback, summary, and evidence paths (screenshots, logs). ' +
|
|
23
|
-
'Pass wait (ms) to long-poll until the run settles; pass fields to return only some keys.'
|
|
31
|
+
'Pass wait (ms) to long-poll until the run settles; pass fields to return only some keys. ' +
|
|
32
|
+
'A run that auto-ended (wall-clock timeout or client disconnect) stays readable under its ' +
|
|
33
|
+
'id until end_session or the next start_debug.',
|
|
34
|
+
annotations: {
|
|
35
|
+
readOnlyHint: true,
|
|
36
|
+
},
|
|
24
37
|
inputSchema: {
|
|
25
38
|
session_id: z.string().min(1).describe('The id returned by start_debug.'),
|
|
26
39
|
wait: z
|
|
@@ -32,10 +45,17 @@ export function getFindingsTool(service) {
|
|
|
32
45
|
.describe('Long-poll up to this many ms for a terminal verdict before reading. Omit/0 to read now.'),
|
|
33
46
|
fields: z
|
|
34
47
|
.array(FindingsField)
|
|
48
|
+
.min(1)
|
|
35
49
|
.optional()
|
|
36
|
-
.describe('Project a subset of findings keys (e.g. ["status","bugs"]). Omit for the whole
|
|
50
|
+
.describe('Project a subset of findings keys (e.g. ["status","bugs"]). Omit for the whole ' +
|
|
51
|
+
'object, whose lists are capped at 20 items; a projected read returns them in full.'),
|
|
37
52
|
},
|
|
38
|
-
|
|
53
|
+
outputSchema: FindingsOutputSchema,
|
|
54
|
+
},
|
|
55
|
+
// Cap the lists only on a whole-object read: the steering note points back
|
|
56
|
+
// at `fields=[...]`, so a projected read must come back complete or the
|
|
57
|
+
// recovery path it names would be a lie.
|
|
58
|
+
async (args) => toToolResult(await service.getFindings(args), { capLists: args.fields === undefined }));
|
|
39
59
|
},
|
|
40
60
|
};
|
|
41
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-findings.js","sourceRoot":"","sources":["../../../src/mcp/tools/get-findings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,4EAA4E;AAC5E,MAAM,aAAa,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;AAE7C,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAAC,OAAiB;IAC/C,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,CAAC,MAAM;YACb,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;gBACE,KAAK,EAAE,kBAAkB;gBACzB,WAAW,EACT,0FAA0F;oBAC1F,wFAAwF;oBACxF,
|
|
1
|
+
{"version":3,"file":"get-findings.js","sourceRoot":"","sources":["../../../src/mcp/tools/get-findings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,4EAA4E;AAC5E,MAAM,aAAa,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,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toToolResult} returns each service value BOTH as pretty text and as
|
|
5
|
+
* `structuredContent`; the SDK validates that structured half against the
|
|
6
|
+
* `outputSchema` a tool declares, and clients compile it to type the payload
|
|
7
|
+
* they receive. Declaring them here keeps "Zod at every boundary" true on the
|
|
8
|
+
* way *out* too: a service shape that drifts fails loud at the boundary instead
|
|
9
|
+
* of reaching the caller unchecked.
|
|
10
|
+
*
|
|
11
|
+
* Each schema is pinned to its service interface with `satisfies`, so a rename
|
|
12
|
+
* in `debug-service.ts` that this file misses fails typecheck.
|
|
13
|
+
*
|
|
14
|
+
* `get_findings` declares its own (the findings schema, projected) — see
|
|
15
|
+
* `get-findings.ts`.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
/** `start_debug` output — the id every later call is keyed by. */
|
|
19
|
+
export declare const StartResultSchema: z.ZodObject<{
|
|
20
|
+
session_id: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/** `send_message` / `end_session` output — a plain acknowledgement. */
|
|
23
|
+
export declare const AckSchema: z.ZodObject<{
|
|
24
|
+
ok: z.ZodLiteral<true>;
|
|
25
|
+
session_id: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/** `describe` output — the target catalog plus the resolved models + workspace. */
|
|
28
|
+
export declare const DescribeResultSchema: z.ZodObject<{
|
|
29
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
adapter: z.ZodEnum<{
|
|
32
|
+
browser: "browser";
|
|
33
|
+
desktop: "desktop";
|
|
34
|
+
android: "android";
|
|
35
|
+
}>;
|
|
36
|
+
mode: z.ZodEnum<{
|
|
37
|
+
managed: "managed";
|
|
38
|
+
attach: "attach";
|
|
39
|
+
}>;
|
|
40
|
+
operational: z.ZodBoolean;
|
|
41
|
+
url: z.ZodOptional<z.ZodString>;
|
|
42
|
+
headless: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
models: z.ZodObject<{
|
|
45
|
+
driver: z.ZodString;
|
|
46
|
+
vision: z.ZodString;
|
|
47
|
+
summary: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
workspace: z.ZodString;
|
|
50
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output schemas for the outer tools — the typed half of every tool result.
|
|
3
|
+
*
|
|
4
|
+
* {@link toToolResult} returns each service value BOTH as pretty text and as
|
|
5
|
+
* `structuredContent`; the SDK validates that structured half against the
|
|
6
|
+
* `outputSchema` a tool declares, and clients compile it to type the payload
|
|
7
|
+
* they receive. Declaring them here keeps "Zod at every boundary" true on the
|
|
8
|
+
* way *out* too: a service shape that drifts fails loud at the boundary instead
|
|
9
|
+
* of reaching the caller unchecked.
|
|
10
|
+
*
|
|
11
|
+
* Each schema is pinned to its service interface with `satisfies`, so a rename
|
|
12
|
+
* in `debug-service.ts` that this file misses fails typecheck.
|
|
13
|
+
*
|
|
14
|
+
* `get_findings` declares its own (the findings schema, projected) — see
|
|
15
|
+
* `get-findings.ts`.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
/** `start_debug` output — the id every later call is keyed by. */
|
|
19
|
+
export const StartResultSchema = z.object({
|
|
20
|
+
session_id: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(1)
|
|
23
|
+
.describe('Pass this to get_findings, send_message and end_session.'),
|
|
24
|
+
});
|
|
25
|
+
/** `send_message` / `end_session` output — a plain acknowledgement. */
|
|
26
|
+
export const AckSchema = z.object({
|
|
27
|
+
ok: z
|
|
28
|
+
.literal(true)
|
|
29
|
+
.describe('The call was accepted; a failure arrives as an error result instead.'),
|
|
30
|
+
session_id: z.string().min(1).describe('The run this ack is for.'),
|
|
31
|
+
});
|
|
32
|
+
/** One configured target's public shape — secrets (api keys, profiles) stay out. */
|
|
33
|
+
const TargetInfoSchema = z.object({
|
|
34
|
+
name: z.string().describe('Target name to pass to start_debug.'),
|
|
35
|
+
adapter: z.enum(['browser', 'desktop', 'android']).describe('Which adapter drives this target.'),
|
|
36
|
+
mode: z
|
|
37
|
+
.enum(['managed', 'attach'])
|
|
38
|
+
.describe('managed = the server launches and owns it; attach = it connects to a running one.'),
|
|
39
|
+
operational: z.boolean().describe('Whether this adapter is wired and usable.'),
|
|
40
|
+
url: z.string().optional().describe('Entry url (web targets only).'),
|
|
41
|
+
headless: z.boolean().optional().describe('Headless flag (web targets only).'),
|
|
42
|
+
});
|
|
43
|
+
/** `describe` output — the target catalog plus the resolved models + workspace. */
|
|
44
|
+
export const DescribeResultSchema = z.object({
|
|
45
|
+
targets: z.array(TargetInfoSchema).describe('Targets configured for this project.'),
|
|
46
|
+
models: z
|
|
47
|
+
.object({
|
|
48
|
+
driver: z.string().describe('Fast guy — drives the target (text-only).'),
|
|
49
|
+
vision: z.string().describe('Vision guy — judges screenshots.'),
|
|
50
|
+
summary: z.string().describe('Compresses findings for the caller.'),
|
|
51
|
+
})
|
|
52
|
+
.describe('Resolved per-role model ids.'),
|
|
53
|
+
workspace: z.string().describe('Per-project workspace path; evidence lands under it.'),
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/mcp/tools/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,0DAA0D,CAAC;CACxE,CAAkC,CAAC;AAEpC,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,E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AC/D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACpE,CAAC;SACD,QAAQ,CAAC,8BAA8B,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;CACvF,CAAqC,CAAC"}
|
|
@@ -4,7 +4,30 @@
|
|
|
4
4
|
* back BOTH as pretty-printed `text` (human/log readable) and as
|
|
5
5
|
* `structuredContent` (the typed channel MCP clients parse). Keeps the five tool
|
|
6
6
|
* handlers a single `toToolResult(await service.x(args))` line each.
|
|
7
|
+
*
|
|
8
|
+
* Two spec-alignment behaviors live here too, so no tool handler has to think
|
|
9
|
+
* about them:
|
|
10
|
+
* - **Truncation steering** (opt-in, see {@link ToolResultOptions.capLists}):
|
|
11
|
+
* a list over {@link MAX_LIST_ITEMS} gets capped and a trailing text block
|
|
12
|
+
* names the retrieval that returns it whole. Never capped without one — a
|
|
13
|
+
* dropped entry the caller cannot ask for again is silent data loss.
|
|
14
|
+
* - **`resource_link`s**: evidence paths (screenshots, `replay.mp4`, logs) ride
|
|
15
|
+
* as `resource_link` content items (file:// URIs) alongside the text block —
|
|
16
|
+
* the spec-blessed form, not inline path strings the caller has to notice.
|
|
7
17
|
*/
|
|
8
18
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
19
|
+
/** Per-call switches for {@link toToolResult}. */
|
|
20
|
+
export interface ToolResultOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Cap over-long top-level arrays and append {@link steeringNote}.
|
|
23
|
+
*
|
|
24
|
+
* Opt-in, because the note has to name a retrieval that really returns the
|
|
25
|
+
* dropped items. Only `get_findings` has one — and only for an unprojected
|
|
26
|
+
* read, since `fields=[...]` comes back uncapped. Everything else stays whole:
|
|
27
|
+
* `describe.targets` is the configured catalog, there is no page 2, so a
|
|
28
|
+
* capped entry would be undiscoverable.
|
|
29
|
+
*/
|
|
30
|
+
capLists?: boolean;
|
|
31
|
+
}
|
|
9
32
|
/** Wrap a service result as a tool response: pretty `text` plus `structuredContent` for records. */
|
|
10
|
-
export declare function toToolResult(data: unknown): CallToolResult;
|
|
33
|
+
export declare function toToolResult(data: unknown, options?: ToolResultOptions): CallToolResult;
|