@beeos-ai/device-agent 0.9.3 → 0.9.5
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/adapters/transport-bridge-ws.d.ts +12 -0
- package/dist/adapters/transport-bridge-ws.js +27 -3
- package/dist/adapters/transport-bridge-ws.js.map +1 -1
- package/dist/agent-runtime/core.d.ts +1 -1
- package/dist/agent-runtime/core.js +41 -0
- package/dist/agent-runtime/core.js.map +1 -1
- package/dist/app/session-manager.d.ts +14 -11
- package/dist/app/session-manager.js +8 -9
- package/dist/app/session-manager.js.map +1 -1
- package/dist/bootstrap.js +140 -11
- package/dist/bootstrap.js.map +1 -1
- package/dist/chat.js +11 -1
- package/dist/chat.js.map +1 -1
- package/dist/config/loader.js +3 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +3 -0
- package/dist/config/schema.js +51 -15
- package/dist/config/schema.js.map +1 -1
- package/dist/fleet/adapters/process/node-process-manager.d.ts +115 -13
- package/dist/fleet/adapters/process/node-process-manager.js +412 -64
- package/dist/fleet/adapters/process/node-process-manager.js.map +1 -1
- package/dist/fleet/adapters/state/port-allocator.d.ts +12 -0
- package/dist/fleet/adapters/state/port-allocator.js +39 -5
- package/dist/fleet/adapters/state/port-allocator.js.map +1 -1
- package/dist/fleet/domain/events.d.ts +23 -1
- package/dist/fleet/domain/fsm.d.ts +13 -1
- package/dist/fleet/domain/fsm.js +70 -0
- package/dist/fleet/domain/fsm.js.map +1 -1
- package/dist/fleet/supervisor.js +30 -0
- package/dist/fleet/supervisor.js.map +1 -1
- package/dist/health/adb-track-devices.d.ts +103 -0
- package/dist/health/adb-track-devices.js +171 -0
- package/dist/health/adb-track-devices.js.map +1 -0
- package/dist/health/health-reporter.d.ts +67 -0
- package/dist/health/health-reporter.js +123 -0
- package/dist/health/health-reporter.js.map +1 -0
- package/dist/health/index.d.ts +6 -0
- package/dist/health/index.js +4 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/mcp-health-monitor.d.ts +190 -0
- package/dist/health/mcp-health-monitor.js +267 -0
- package/dist/health/mcp-health-monitor.js.map +1 -0
- package/dist/inbound/cli/main.js +8 -1
- package/dist/inbound/cli/main.js.map +1 -1
- package/dist/inbound/cli/run-command.js +11 -1
- package/dist/inbound/cli/run-command.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-client/action-mapping.d.ts +45 -0
- package/dist/mcp-client/action-mapping.js +224 -0
- package/dist/mcp-client/action-mapping.js.map +1 -0
- package/dist/mcp-client/autospawn.d.ts +15 -2
- package/dist/mcp-client/autospawn.js +82 -4
- package/dist/mcp-client/autospawn.js.map +1 -1
- package/dist/mcp-client/client.d.ts +134 -38
- package/dist/mcp-client/client.js +394 -87
- package/dist/mcp-client/client.js.map +1 -1
- package/dist/mcp-client/index.d.ts +5 -3
- package/dist/mcp-client/index.js +2 -1
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/mcp-client/inproc.d.ts +2 -2
- package/dist/mcp-client/inproc.js.map +1 -1
- package/dist/mcp-client/runtime.d.ts +124 -21
- package/dist/mcp-client/runtime.js +18 -7
- package/dist/mcp-client/runtime.js.map +1 -1
- package/dist/model/adapters/autoglm.js +44 -45
- package/dist/model/adapters/autoglm.js.map +1 -1
- package/dist/plugins/acp/index.d.ts +35 -0
- package/dist/plugins/acp/index.js +121 -0
- package/dist/plugins/acp/index.js.map +1 -1
- package/dist/ports/transport.d.ts +11 -0
- package/package.json +3 -2
|
@@ -1,93 +1,159 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* McpClient — typed
|
|
2
|
+
* McpClient — typed wrapper around the official `@modelcontextprotocol/sdk`
|
|
3
|
+
* Client connected over Streamable HTTP to the sibling
|
|
4
|
+
* `device-mcp-server` (or any other MCP server speaking the same tools).
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* 0.4.0 reshape:
|
|
7
|
+
* - The bespoke `/healthz` / `/mcp/tools/list` / `/mcp/tools/call` /
|
|
8
|
+
* `/act` REST surface is gone — everything goes through the SDK
|
|
9
|
+
* `Client.callTool` and the `initialize` handshake handled by
|
|
10
|
+
* `Client.connect(transport)`.
|
|
11
|
+
* - `device-mcp-server` is now a singleton multi-device process; this
|
|
12
|
+
* client owns a `defaultDevice` (Ed25519-derived ADB serial / "desktop")
|
|
13
|
+
* and injects it as the `device` argument on every `callTool` so the
|
|
14
|
+
* server's `BackendRegistry.resolve(...)` always lands on the right
|
|
15
|
+
* backend.
|
|
16
|
+
* - `act(action)` is implemented locally by translating the Action into
|
|
17
|
+
* the matching tool call via `mapActionToTool` and synthesising the
|
|
18
|
+
* legacy `ActResponse` envelope on top of the SDK `CallToolResult`.
|
|
9
19
|
*
|
|
10
20
|
* Defaults:
|
|
11
|
-
* - baseUrl: http://127.0.0.1:7900
|
|
21
|
+
* - baseUrl: http://127.0.0.1:7900 (override via `MCP_URL` env)
|
|
12
22
|
* - timeout: 30s per request
|
|
13
23
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
24
|
+
* Threading: `Client.connect` is invoked lazily on first call. Concurrent
|
|
25
|
+
* callers share a single in-flight connect promise so the handshake only
|
|
26
|
+
* runs once. After connect, the client is stateless from the caller's
|
|
27
|
+
* point of view — every `callTool` is an independent JSON-RPC request.
|
|
17
28
|
*/
|
|
29
|
+
import { EventEmitter } from "node:events";
|
|
30
|
+
import { createRequire } from "node:module";
|
|
31
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
32
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
18
33
|
import { McpUnreachableError, } from "@beeos-ai/device-common";
|
|
34
|
+
import { mapActionToTool } from "./action-mapping.js";
|
|
19
35
|
const DEFAULT_BASE_URL = "http://127.0.0.1:7900";
|
|
36
|
+
const DEFAULT_MCP_PATH = "/mcp";
|
|
20
37
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
38
|
+
const CLIENT_NAME = "beeos-device-agent";
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the client version string from `package.json` at startup so the
|
|
41
|
+
* MCP `initialize` handshake advertises the actual installed agent version
|
|
42
|
+
* (vs. the hardcoded "0.4.0" that drifted across 0.5–0.9.x). Falls back to
|
|
43
|
+
* "0.0.0" if the file can't be located (e.g. bundled into a single file).
|
|
44
|
+
*
|
|
45
|
+
* Using `createRequire` instead of `import "...json" with { type: "json" }`
|
|
46
|
+
* keeps this working under both `tsx` (src/) and compiled `dist/` — the
|
|
47
|
+
* relative path from `mcp-client/client.{ts,js}` to `package.json` is
|
|
48
|
+
* `../../package.json` in both layouts.
|
|
49
|
+
*/
|
|
50
|
+
const CLIENT_VERSION = (() => {
|
|
51
|
+
try {
|
|
52
|
+
const req = createRequire(import.meta.url);
|
|
53
|
+
const pkg = req("../../package.json");
|
|
54
|
+
return typeof pkg.version === "string" ? pkg.version : "0.0.0";
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return "0.0.0";
|
|
58
|
+
}
|
|
59
|
+
})();
|
|
21
60
|
/**
|
|
22
61
|
* Resolve the default MCP base URL (env-aware).
|
|
23
62
|
*/
|
|
24
63
|
export function resolveDefaultMcpUrl() {
|
|
25
64
|
return process.env.MCP_URL ?? DEFAULT_BASE_URL;
|
|
26
65
|
}
|
|
27
|
-
|
|
28
|
-
|
|
66
|
+
/** Read the version string the McpClient advertises via MCP `initialize`. */
|
|
67
|
+
export function getClientVersion() {
|
|
68
|
+
return CLIENT_VERSION;
|
|
69
|
+
}
|
|
70
|
+
export class McpClient extends EventEmitter {
|
|
71
|
+
endpoint;
|
|
29
72
|
timeoutMs;
|
|
73
|
+
defaultDevice;
|
|
30
74
|
authToken;
|
|
31
|
-
|
|
75
|
+
backendFamily;
|
|
76
|
+
client;
|
|
77
|
+
injectedTransport;
|
|
78
|
+
connectPromise;
|
|
32
79
|
constructor(opts = {}) {
|
|
33
|
-
|
|
80
|
+
super();
|
|
81
|
+
const raw = opts.baseUrl ?? resolveDefaultMcpUrl();
|
|
82
|
+
this.endpoint = normaliseEndpoint(raw);
|
|
34
83
|
this.timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
84
|
+
this.defaultDevice = opts.defaultDevice || undefined;
|
|
35
85
|
this.authToken = opts.authToken;
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
async health() {
|
|
40
|
-
try {
|
|
41
|
-
return await this.request("GET", "/healthz");
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
throw new McpUnreachableError(`MCP server unreachable at ${this.baseUrl}: ${e.message}`, e);
|
|
45
|
-
}
|
|
86
|
+
this.backendFamily = opts.backendFamily;
|
|
87
|
+
this.injectedTransport = opts.transport;
|
|
88
|
+
this.client = new Client({ name: CLIENT_NAME, version: CLIENT_VERSION }, { capabilities: {} });
|
|
46
89
|
}
|
|
47
90
|
/**
|
|
48
|
-
* Wait until the MCP server's
|
|
49
|
-
* bootstrap to gate startup on the sibling process.
|
|
91
|
+
* Wait until the MCP server's `initialize` handshake succeeds. Used by
|
|
92
|
+
* bootstrap to gate startup on the sibling process. Replaces the
|
|
93
|
+
* pre-0.4 `health()` + `/healthz` probe.
|
|
50
94
|
*
|
|
51
95
|
* Strategy: linear retry with `attemptDelayMs` between probes; gives up
|
|
52
|
-
* after `attempts` tries. Default:
|
|
96
|
+
* after `attempts` tries. Default: 30 × 500ms = ~15s — large enough to
|
|
97
|
+
* cover the cold-start window of an autospawned `device-mcp-server`
|
|
98
|
+
* binary (especially under `tsx`/Node ESM resolve on the first run)
|
|
99
|
+
* without blocking too long when the server is genuinely unreachable.
|
|
53
100
|
*/
|
|
54
101
|
async waitUntilReady(opts = {}) {
|
|
55
|
-
const attempts = opts.attempts ??
|
|
102
|
+
const attempts = opts.attempts ?? 30;
|
|
56
103
|
const delay = opts.attemptDelayMs ?? 500;
|
|
57
104
|
let lastErr;
|
|
58
105
|
for (let i = 0; i < attempts; i++) {
|
|
59
106
|
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return h;
|
|
107
|
+
await this.ensureConnected();
|
|
108
|
+
return { ok: true };
|
|
63
109
|
}
|
|
64
110
|
catch (e) {
|
|
65
111
|
lastErr = e;
|
|
66
112
|
}
|
|
67
113
|
await new Promise((res) => setTimeout(res, delay));
|
|
68
114
|
}
|
|
69
|
-
throw new McpUnreachableError(`MCP server at ${this.
|
|
115
|
+
throw new McpUnreachableError(`MCP server at ${this.endpoint.href} did not become ready after ${attempts} attempts`, lastErr);
|
|
70
116
|
}
|
|
71
|
-
/**
|
|
72
|
-
async listTools() {
|
|
73
|
-
return this.request("POST", "/mcp/tools/list", {});
|
|
74
|
-
}
|
|
75
|
-
/** Invoke a single MCP tool by name. */
|
|
117
|
+
/** Generic MCP tool dispatch — used for tools without a typed convenience method. */
|
|
76
118
|
async callTool(name, args = {}) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
119
|
+
const t0 = Date.now();
|
|
120
|
+
let result;
|
|
121
|
+
try {
|
|
122
|
+
result = await this.invoke(name, args);
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
// Transport / connect failures (typically `McpUnreachableError` from
|
|
126
|
+
// openTransport, or a fetch / timeout from the HTTP transport)
|
|
127
|
+
// never produce a `CallToolResult`. Emit the synthetic
|
|
128
|
+
// "mcp_unreachable" signal so the health monitor can treat them
|
|
129
|
+
// distinctly from device-level failures, then re-throw so existing
|
|
130
|
+
// call sites' error handling stays intact.
|
|
131
|
+
this.emit("callResult", { ok: false, subtype: "mcp_unreachable" });
|
|
132
|
+
throw e;
|
|
133
|
+
}
|
|
134
|
+
const durationMs = Date.now() - t0;
|
|
135
|
+
const isError = result.isError === true;
|
|
136
|
+
// r3 ActionableError model: server may signal "user/LLM can fix this"
|
|
137
|
+
// by NOT setting `isError: true` and instead returning
|
|
138
|
+
// `structuredContent: { actionable: true, subtype, error }`. We surface
|
|
139
|
+
// those as `ok: false` so callers don't treat them as success.
|
|
140
|
+
const structured = result.structuredContent;
|
|
141
|
+
const sc = structured;
|
|
142
|
+
const isActionable = sc?.actionable === true;
|
|
143
|
+
const ok = !isError && !isActionable;
|
|
144
|
+
// Emit the call outcome unconditionally so subscribers (e.g. the
|
|
145
|
+
// device-agent's MCPHealthMonitor) can derive a fresh signal on
|
|
146
|
+
// every tool round-trip — both successes (resets the failure
|
|
147
|
+
// window) and structured failures (e.g. subtype="adb_unauthorized"
|
|
148
|
+
// → device_unauthorized).
|
|
149
|
+
const subtype = typeof sc?.subtype === "string" ? sc.subtype : undefined;
|
|
150
|
+
this.emit("callResult", { ok, ...(subtype !== undefined ? { subtype } : {}) });
|
|
151
|
+
return { ok, raw: result, structured, durationMs };
|
|
86
152
|
}
|
|
87
153
|
/** Convenience: take a screenshot via `tool: screenshot`. */
|
|
88
154
|
async screenshot() {
|
|
89
155
|
const r = await this.callTool("screenshot", {});
|
|
90
|
-
return r
|
|
156
|
+
return ensureStructured(r, "screenshot");
|
|
91
157
|
}
|
|
92
158
|
/**
|
|
93
159
|
* Convenience: dump UI hierarchy. `format: "compact"` returns the LLM-ready
|
|
@@ -100,16 +166,18 @@ export class McpClient {
|
|
|
100
166
|
if (opts.format !== undefined)
|
|
101
167
|
args.format = opts.format;
|
|
102
168
|
const r = await this.callTool("ui_dump", args);
|
|
103
|
-
return r
|
|
169
|
+
return ensureStructured(r, "ui_dump");
|
|
104
170
|
}
|
|
105
171
|
/** Convenience: backend `device_info` tool — the canonical DeviceInfo descriptor. */
|
|
106
172
|
async info() {
|
|
107
173
|
const r = await this.callTool("device_info", {});
|
|
108
|
-
return r
|
|
174
|
+
return ensureStructured(r, "device_info");
|
|
109
175
|
}
|
|
110
176
|
/** Convenience: install an APK on the (Android) sandbox. */
|
|
111
177
|
async installApk(path) {
|
|
112
|
-
await this.callTool("install_apk", { path });
|
|
178
|
+
const r = await this.callTool("install_apk", { path });
|
|
179
|
+
if (!r.ok)
|
|
180
|
+
throw asError(r, "install_apk");
|
|
113
181
|
}
|
|
114
182
|
/** Convenience: run a shell command on the sandbox. */
|
|
115
183
|
async executeCommand(body, opts = {}) {
|
|
@@ -118,62 +186,301 @@ export class McpClient {
|
|
|
118
186
|
...(opts.timeoutS !== undefined ? { timeoutS: opts.timeoutS } : {}),
|
|
119
187
|
...(opts.cwd !== undefined ? { cwd: opts.cwd } : {}),
|
|
120
188
|
});
|
|
121
|
-
return r
|
|
189
|
+
return ensureStructured(r, "execute_command");
|
|
122
190
|
}
|
|
123
191
|
/**
|
|
124
192
|
* Convenience: push `bytes` to an absolute device-local `path` via
|
|
125
|
-
* the MCP `file_write` tool.
|
|
126
|
-
* to land downloaded URL payloads on-device before the VLM sees them.
|
|
193
|
+
* the MCP `file_write` tool.
|
|
127
194
|
*/
|
|
128
195
|
async fileWrite(path, bytes) {
|
|
129
|
-
await this.callTool("file_write", {
|
|
196
|
+
const r = await this.callTool("file_write", {
|
|
130
197
|
path,
|
|
131
198
|
contentB64: bytes.toString("base64"),
|
|
132
199
|
});
|
|
200
|
+
if (!r.ok)
|
|
201
|
+
throw asError(r, "file_write");
|
|
133
202
|
}
|
|
134
203
|
/* ------------------------------------------------------------------ */
|
|
135
|
-
/*
|
|
204
|
+
/* 0.4.1 mobile-mcp parity helpers */
|
|
205
|
+
/* */
|
|
206
|
+
/* Plain wrappers over `callTool` — the agent-runtime never reaches */
|
|
207
|
+
/* into these (it goes through `act()`), but plugins / skills / the */
|
|
208
|
+
/* fleet HTTP surface do, and exposing them as typed methods saves */
|
|
209
|
+
/* every call site from re-spelling tool names + arg shapes. */
|
|
136
210
|
/* ------------------------------------------------------------------ */
|
|
137
|
-
async
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
211
|
+
async screenshotToFile(path, opts = {}) {
|
|
212
|
+
const r = await this.callTool("screenshot_to_file", {
|
|
213
|
+
path,
|
|
214
|
+
...(opts.displayId !== undefined ? { displayId: opts.displayId } : {}),
|
|
215
|
+
...(opts.maxEdge !== undefined ? { maxEdge: opts.maxEdge } : {}),
|
|
216
|
+
...(opts.quality !== undefined ? { quality: opts.quality } : {}),
|
|
217
|
+
...(opts.format !== undefined ? { format: opts.format } : {}),
|
|
218
|
+
});
|
|
219
|
+
return ensureStructured(r, "screenshot_to_file");
|
|
220
|
+
}
|
|
221
|
+
async startScreenRecord(opts = {}) {
|
|
222
|
+
const args = {};
|
|
223
|
+
if (opts.output !== undefined)
|
|
224
|
+
args.output = opts.output;
|
|
225
|
+
if (opts.timeLimitS !== undefined)
|
|
226
|
+
args.timeLimitS = opts.timeLimitS;
|
|
227
|
+
const r = await this.callTool("screen_record_start", args);
|
|
228
|
+
return ensureStructured(r, "screen_record_start");
|
|
229
|
+
}
|
|
230
|
+
async stopScreenRecord(id, path) {
|
|
231
|
+
const r = await this.callTool("screen_record_stop", {
|
|
232
|
+
id,
|
|
233
|
+
...(path !== undefined ? { path } : {}),
|
|
234
|
+
});
|
|
235
|
+
return ensureStructured(r, "screen_record_stop");
|
|
236
|
+
}
|
|
237
|
+
async swipeDirection(direction, opts = {}) {
|
|
238
|
+
const r = await this.callTool("swipe_direction", {
|
|
239
|
+
direction,
|
|
240
|
+
...(opts.x !== undefined ? { x: opts.x } : {}),
|
|
241
|
+
...(opts.y !== undefined ? { y: opts.y } : {}),
|
|
242
|
+
...(opts.distance !== undefined ? { distance: opts.distance } : {}),
|
|
243
|
+
...(opts.durationMs !== undefined ? { durationMs: opts.durationMs } : {}),
|
|
244
|
+
});
|
|
245
|
+
if (!r.ok)
|
|
246
|
+
throw asError(r, "swipe_direction");
|
|
247
|
+
}
|
|
248
|
+
async pressButton(button) {
|
|
249
|
+
const r = await this.callTool("press_button", { button });
|
|
250
|
+
if (!r.ok)
|
|
251
|
+
throw asError(r, "press_button");
|
|
252
|
+
}
|
|
253
|
+
async terminateApp(pkg) {
|
|
254
|
+
const r = await this.callTool("terminate_app", { pkg });
|
|
255
|
+
if (!r.ok)
|
|
256
|
+
throw asError(r, "terminate_app");
|
|
257
|
+
}
|
|
258
|
+
async openUrl(url) {
|
|
259
|
+
const r = await this.callTool("open_url", { url });
|
|
260
|
+
if (!r.ok)
|
|
261
|
+
throw asError(r, "open_url");
|
|
262
|
+
}
|
|
263
|
+
async listApps(opts = {}) {
|
|
264
|
+
const r = await this.callTool("list_apps", {
|
|
265
|
+
...(opts.includeSystem !== undefined ? { includeSystem: opts.includeSystem } : {}),
|
|
266
|
+
...(opts.launchableOnly !== undefined ? { launchableOnly: opts.launchableOnly } : {}),
|
|
267
|
+
});
|
|
268
|
+
return ensureStructured(r, "list_apps").apps;
|
|
269
|
+
}
|
|
270
|
+
async listCrashes() {
|
|
271
|
+
const r = await this.callTool("list_crashes", {});
|
|
272
|
+
return ensureStructured(r, "list_crashes").crashes;
|
|
273
|
+
}
|
|
274
|
+
async getCrash(id) {
|
|
275
|
+
const r = await this.callTool("get_crash", { id });
|
|
276
|
+
const s = ensureStructured(r, "get_crash");
|
|
277
|
+
if (s && typeof s.content === "string")
|
|
278
|
+
return s.content;
|
|
279
|
+
if (s && typeof s.text === "string")
|
|
280
|
+
return s.text;
|
|
281
|
+
// Fallback: the server may return only `content[]` text blocks.
|
|
282
|
+
const raw = r.raw;
|
|
283
|
+
if (Array.isArray(raw?.content)) {
|
|
284
|
+
for (const c of raw.content) {
|
|
285
|
+
if (c?.type === "text" && typeof c.text === "string")
|
|
286
|
+
return c.text;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return "";
|
|
290
|
+
}
|
|
291
|
+
async uninstallApp(pkg) {
|
|
292
|
+
const r = await this.callTool("uninstall_app", { pkg });
|
|
293
|
+
if (!r.ok)
|
|
294
|
+
throw asError(r, "uninstall_app");
|
|
295
|
+
}
|
|
296
|
+
async setOrientation(orientation) {
|
|
297
|
+
const r = await this.callTool("set_orientation", { orientation });
|
|
298
|
+
if (!r.ok)
|
|
299
|
+
throw asError(r, "set_orientation");
|
|
300
|
+
}
|
|
301
|
+
async getOrientation() {
|
|
302
|
+
const r = await this.callTool("get_orientation", {});
|
|
303
|
+
return ensureStructured(r, "get_orientation").orientation;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* MCP `tools/list` — best-effort wrapper for compatibility probes
|
|
307
|
+
* (bootstrap warns when an old server is missing r3 tools). The
|
|
308
|
+
* underlying SDK call uses `client.listTools()` and fails gracefully
|
|
309
|
+
* on transport errors so the caller can decide to log-and-continue.
|
|
310
|
+
*/
|
|
311
|
+
async listTools() {
|
|
312
|
+
await this.ensureConnected();
|
|
313
|
+
const r = (await this.client.listTools());
|
|
314
|
+
return Array.isArray(r.tools) ? r.tools : [];
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Read the server-advertised version (from MCP `initialize` response).
|
|
318
|
+
* `undefined` when not yet connected. The SDK `getServerVersion()`
|
|
319
|
+
* returns the full `Implementation { name, version }` shape; we only
|
|
320
|
+
* need the version string.
|
|
321
|
+
*/
|
|
322
|
+
getServerVersion() {
|
|
323
|
+
const impl = this.client.getServerVersion();
|
|
324
|
+
return impl?.version ? String(impl.version) : undefined;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Submit a unified `Action`. Implemented locally as
|
|
328
|
+
* `mapActionToTool(action)` → `callTool(...)`. Terminal verbs short-circuit
|
|
329
|
+
* with a synthetic `{ ok: true, terminal: true }` envelope so the
|
|
330
|
+
* AgentLoop / ACP handlers can keep treating `act()` as the single dispatch
|
|
331
|
+
* point.
|
|
332
|
+
*/
|
|
333
|
+
async act(action) {
|
|
334
|
+
const t0 = Date.now();
|
|
335
|
+
let mapped;
|
|
144
336
|
try {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
337
|
+
mapped = mapActionToTool(action, this.backendFamily);
|
|
338
|
+
}
|
|
339
|
+
catch (e) {
|
|
340
|
+
// mapActionToTool throws DeviceError(invalid_args / unsupported)
|
|
341
|
+
// for caller-fixable problems (empty hotkey, mobile-only verbs).
|
|
342
|
+
// Surface those as actionable so the agent loop's reflector
|
|
343
|
+
// routes them through the same path as server-side actionable
|
|
344
|
+
// errors and the LLM gets a coherent retry hint.
|
|
345
|
+
const err = e;
|
|
346
|
+
const subtype = typeof err.subtype === "string" ? err.subtype : undefined;
|
|
347
|
+
return {
|
|
348
|
+
ok: false,
|
|
349
|
+
action: action.type,
|
|
350
|
+
durationMs: Date.now() - t0,
|
|
351
|
+
error: {
|
|
352
|
+
message: typeof err.message === "string" ? err.message : String(e),
|
|
353
|
+
...(subtype !== undefined ? { subtype } : {}),
|
|
354
|
+
...(subtype === "invalid_args" || subtype === "unsupported"
|
|
355
|
+
? { actionable: true }
|
|
356
|
+
: {}),
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
if ("terminal" in mapped) {
|
|
361
|
+
return { ok: true, action: mapped.type, durationMs: Date.now() - t0 };
|
|
362
|
+
}
|
|
363
|
+
try {
|
|
364
|
+
const r = await this.invoke(mapped.toolName, mapped.args);
|
|
365
|
+
const durationMs = Date.now() - t0;
|
|
366
|
+
const isError = r.isError === true;
|
|
367
|
+
const structured = r.structuredContent;
|
|
368
|
+
const sc = structured;
|
|
369
|
+
const isActionable = sc?.actionable === true;
|
|
370
|
+
const ok = !isError && !isActionable;
|
|
371
|
+
// Mirror the callTool emit so act()-driven traffic (the AgentLoop's
|
|
372
|
+
// hot path) feeds the same health-monitor stream as direct
|
|
373
|
+
// callTool() consumers (plugins, fleet HTTP).
|
|
374
|
+
const subtype = typeof sc?.subtype === "string" ? sc.subtype : undefined;
|
|
375
|
+
this.emit("callResult", { ok, ...(subtype !== undefined ? { subtype } : {}) });
|
|
376
|
+
if (isError || isActionable) {
|
|
377
|
+
const scMessage = typeof sc?.error === "string" && sc.error.length > 0 ? sc.error : undefined;
|
|
378
|
+
return {
|
|
379
|
+
ok: false,
|
|
380
|
+
action: action.type,
|
|
381
|
+
durationMs,
|
|
382
|
+
error: {
|
|
383
|
+
message: scMessage ?? extractErrorText(r),
|
|
384
|
+
...(subtype !== undefined ? { subtype } : {}),
|
|
385
|
+
...(isActionable ? { actionable: true } : {}),
|
|
386
|
+
},
|
|
387
|
+
};
|
|
160
388
|
}
|
|
161
|
-
return
|
|
389
|
+
return {
|
|
390
|
+
ok: true,
|
|
391
|
+
action: action.type,
|
|
392
|
+
durationMs,
|
|
393
|
+
result: structured,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
catch (e) {
|
|
397
|
+
// Transport failure during act(): surface the synthetic
|
|
398
|
+
// mcp_unreachable signal (matching callTool's catch path) so the
|
|
399
|
+
// monitor sees a consistent stream.
|
|
400
|
+
this.emit("callResult", { ok: false, subtype: "mcp_unreachable" });
|
|
401
|
+
return {
|
|
402
|
+
ok: false,
|
|
403
|
+
action: action.type,
|
|
404
|
+
durationMs: Date.now() - t0,
|
|
405
|
+
error: { message: e instanceof Error ? e.message : String(e) },
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/* ------------------------------------------------------------------ */
|
|
410
|
+
/* Internal: SDK plumbing */
|
|
411
|
+
/* ------------------------------------------------------------------ */
|
|
412
|
+
async ensureConnected() {
|
|
413
|
+
if (!this.connectPromise) {
|
|
414
|
+
this.connectPromise = this.openTransport().catch((err) => {
|
|
415
|
+
// Reset so the next call can retry instead of caching the failure.
|
|
416
|
+
this.connectPromise = undefined;
|
|
417
|
+
throw err;
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return this.connectPromise;
|
|
421
|
+
}
|
|
422
|
+
async openTransport() {
|
|
423
|
+
const transport = this.injectedTransport ?? this.buildHttpTransport();
|
|
424
|
+
try {
|
|
425
|
+
await this.client.connect(transport);
|
|
162
426
|
}
|
|
163
|
-
|
|
164
|
-
|
|
427
|
+
catch (e) {
|
|
428
|
+
throw new McpUnreachableError(`MCP server unreachable at ${this.endpoint.href}: ${e.message}`, e);
|
|
165
429
|
}
|
|
166
430
|
}
|
|
431
|
+
buildHttpTransport() {
|
|
432
|
+
const requestInit = this.authToken
|
|
433
|
+
? { headers: { authorization: `Bearer ${this.authToken}` } }
|
|
434
|
+
: undefined;
|
|
435
|
+
return new StreamableHTTPClientTransport(this.endpoint, {
|
|
436
|
+
...(requestInit ? { requestInit } : {}),
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
async invoke(name, args) {
|
|
440
|
+
await this.ensureConnected();
|
|
441
|
+
const merged = this.withDefaultDevice(args);
|
|
442
|
+
return this.client.callTool({ name, arguments: merged }, undefined, { timeout: this.timeoutMs });
|
|
443
|
+
}
|
|
444
|
+
withDefaultDevice(args) {
|
|
445
|
+
if (!this.defaultDevice)
|
|
446
|
+
return args;
|
|
447
|
+
if (typeof args.device === "string" && args.device)
|
|
448
|
+
return args;
|
|
449
|
+
return { ...args, device: this.defaultDevice };
|
|
450
|
+
}
|
|
167
451
|
}
|
|
168
|
-
|
|
169
|
-
|
|
452
|
+
/* -------------------------------------------------------------------------- */
|
|
453
|
+
/* Helpers */
|
|
454
|
+
/* -------------------------------------------------------------------------- */
|
|
455
|
+
function normaliseEndpoint(raw) {
|
|
456
|
+
const trimmed = raw.endsWith("/") ? raw.slice(0, -1) : raw;
|
|
457
|
+
const url = new URL(trimmed);
|
|
458
|
+
// If the caller supplied a bare origin, point at /mcp; otherwise honour
|
|
459
|
+
// an explicit path (some deployments mount MCP behind a sub-path).
|
|
460
|
+
if (url.pathname === "" || url.pathname === "/") {
|
|
461
|
+
url.pathname = DEFAULT_MCP_PATH;
|
|
462
|
+
}
|
|
463
|
+
return url;
|
|
170
464
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
173
|
-
|
|
465
|
+
function ensureStructured(out, tool) {
|
|
466
|
+
if (!out.ok)
|
|
467
|
+
throw asError(out, tool);
|
|
468
|
+
if (out.structured === undefined) {
|
|
469
|
+
throw new Error(`MCP tool '${tool}' returned no structuredContent`);
|
|
174
470
|
}
|
|
175
|
-
|
|
176
|
-
|
|
471
|
+
return out.structured;
|
|
472
|
+
}
|
|
473
|
+
function asError(out, tool) {
|
|
474
|
+
return new Error(`MCP tool '${tool}' failed: ${extractErrorText(out.raw)}`);
|
|
475
|
+
}
|
|
476
|
+
function extractErrorText(raw) {
|
|
477
|
+
const content = raw.content;
|
|
478
|
+
if (!Array.isArray(content))
|
|
479
|
+
return "unknown error";
|
|
480
|
+
for (const c of content) {
|
|
481
|
+
if (c?.type === "text" && typeof c.text === "string")
|
|
482
|
+
return c.text;
|
|
177
483
|
}
|
|
484
|
+
return "unknown error";
|
|
178
485
|
}
|
|
179
486
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/mcp-client/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,mBAAmB,GAUpB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACjD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAmBlC;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,gBAAgB,CAAC;AACjD,CAAC;AAED,MAAM,OAAO,SAAS;IACH,OAAO,CAAS;IAChB,SAAS,CAAS;IAClB,SAAS,CAAU;IACnB,SAAS,CAAe;IAEzC,YAAY,OAAyB,EAAE;QACrC,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,IAAI,oBA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,SAAS,gBAAgB,CAAC,GAAY;IACpC,MAAM,OAAO,GAAI,GAAuD,CAAC,OAAO,CAAC;IACjF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,eAAe,CAAC;IACpD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,EAAE,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC;IACtE,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export { McpClient, resolveDefaultMcpUrl } from "./client.js";
|
|
2
|
-
export type { McpClientOptions,
|
|
3
|
-
export type { IMcpRuntime, UiDumpOptions,
|
|
1
|
+
export { McpClient, getClientVersion, resolveDefaultMcpUrl } from "./client.js";
|
|
2
|
+
export type { McpClientOptions, McpCallResult } from "./client.js";
|
|
3
|
+
export type { ActResponse, CallToolOutput, ExecuteCommandOptions, IMcpRuntime, ListAppsOptions, ScreenshotToFileOptions, StartScreenRecordOptions, SwipeDirectionOptions, UiDumpOptions, } from "./runtime.js";
|
|
4
|
+
export { mapActionToTool } from "./action-mapping.js";
|
|
5
|
+
export type { ActionMappingResult, ToolCall } from "./action-mapping.js";
|
|
4
6
|
export { InProcMcpClient } from "./inproc.js";
|
|
5
7
|
export type { InProcMcpClientOptions } from "./inproc.js";
|
|
6
8
|
export { autospawnMcpServer } from "./autospawn.js";
|
package/dist/mcp-client/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { McpClient, resolveDefaultMcpUrl } from "./client.js";
|
|
1
|
+
export { McpClient, getClientVersion, resolveDefaultMcpUrl } from "./client.js";
|
|
2
|
+
export { mapActionToTool } from "./action-mapping.js";
|
|
2
3
|
export { InProcMcpClient } from "./inproc.js";
|
|
3
4
|
export { autospawnMcpServer } from "./autospawn.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp-client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp-client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAahF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|