react-native-mcp-kit 3.0.0 → 4.0.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/bin/ios-hid +0 -0
- package/dist/client/contexts/McpContext/McpProvider.d.ts.map +1 -1
- package/dist/client/contexts/McpContext/McpProvider.js +5 -5
- package/dist/client/contexts/McpContext/McpProvider.js.map +1 -1
- package/dist/client/core/McpClient.d.ts.map +1 -1
- package/dist/client/core/McpClient.js +26 -32
- package/dist/client/core/McpClient.js.map +1 -1
- package/dist/modules/alert/alert.d.ts.map +1 -1
- package/dist/modules/alert/alert.js +2 -5
- package/dist/modules/alert/alert.js.map +1 -1
- package/dist/modules/console/console.d.ts.map +1 -1
- package/dist/modules/console/console.js +32 -107
- package/dist/modules/console/console.js.map +1 -1
- package/dist/modules/console/types.d.ts +1 -0
- package/dist/modules/console/types.d.ts.map +1 -1
- package/dist/modules/device/device.d.ts.map +1 -1
- package/dist/modules/device/device.js +224 -133
- package/dist/modules/device/device.js.map +1 -1
- package/dist/modules/errors/errors.d.ts.map +1 -1
- package/dist/modules/errors/errors.js +19 -36
- package/dist/modules/errors/errors.js.map +1 -1
- package/dist/modules/fiberTree/children.d.ts +49 -0
- package/dist/modules/fiberTree/children.d.ts.map +1 -0
- package/dist/modules/fiberTree/children.js +182 -0
- package/dist/modules/fiberTree/children.js.map +1 -0
- package/dist/modules/fiberTree/constants.d.ts +13 -0
- package/dist/modules/fiberTree/constants.d.ts.map +1 -0
- package/dist/modules/fiberTree/constants.js +24 -0
- package/dist/modules/fiberTree/constants.js.map +1 -0
- package/dist/modules/fiberTree/fiberTree.d.ts +3 -6
- package/dist/modules/fiberTree/fiberTree.d.ts.map +1 -1
- package/dist/modules/fiberTree/fiberTree.js +219 -1080
- package/dist/modules/fiberTree/fiberTree.js.map +1 -1
- package/dist/modules/fiberTree/finder.d.ts +60 -0
- package/dist/modules/fiberTree/finder.d.ts.map +1 -0
- package/dist/modules/fiberTree/finder.js +107 -0
- package/dist/modules/fiberTree/finder.js.map +1 -0
- package/dist/modules/fiberTree/hooks.d.ts +103 -0
- package/dist/modules/fiberTree/hooks.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks.js +532 -0
- package/dist/modules/fiberTree/hooks.js.map +1 -0
- package/dist/modules/fiberTree/projection.d.ts +49 -0
- package/dist/modules/fiberTree/projection.d.ts.map +1 -0
- package/dist/modules/fiberTree/projection.js +82 -0
- package/dist/modules/fiberTree/projection.js.map +1 -0
- package/dist/modules/fiberTree/query.d.ts +56 -0
- package/dist/modules/fiberTree/query.d.ts.map +1 -0
- package/dist/modules/fiberTree/query.js +151 -0
- package/dist/modules/fiberTree/query.js.map +1 -0
- package/dist/modules/fiberTree/redact.d.ts +24 -0
- package/dist/modules/fiberTree/redact.d.ts.map +1 -0
- package/dist/modules/fiberTree/redact.js +51 -0
- package/dist/modules/fiberTree/redact.js.map +1 -0
- package/dist/modules/fiberTree/types.d.ts +7 -0
- package/dist/modules/fiberTree/types.d.ts.map +1 -1
- package/dist/modules/fiberTree/utils.d.ts +8 -2
- package/dist/modules/fiberTree/utils.d.ts.map +1 -1
- package/dist/modules/fiberTree/utils.js +79 -78
- package/dist/modules/fiberTree/utils.js.map +1 -1
- package/dist/modules/fiberTree/viewport.d.ts +28 -0
- package/dist/modules/fiberTree/viewport.d.ts.map +1 -0
- package/dist/modules/fiberTree/viewport.js +50 -0
- package/dist/modules/fiberTree/viewport.js.map +1 -0
- package/dist/modules/fiberTree/waitFor.d.ts +52 -0
- package/dist/modules/fiberTree/waitFor.d.ts.map +1 -0
- package/dist/modules/fiberTree/waitFor.js +98 -0
- package/dist/modules/fiberTree/waitFor.js.map +1 -0
- package/dist/modules/logBox/logBox.d.ts.map +1 -1
- package/dist/modules/logBox/logBox.js +59 -66
- package/dist/modules/logBox/logBox.js.map +1 -1
- package/dist/modules/navigation/navigation.d.ts.map +1 -1
- package/dist/modules/navigation/navigation.js +115 -114
- package/dist/modules/navigation/navigation.js.map +1 -1
- package/dist/modules/network/network.d.ts.map +1 -1
- package/dist/modules/network/network.js +78 -197
- package/dist/modules/network/network.js.map +1 -1
- package/dist/modules/network/types.d.ts +23 -27
- package/dist/modules/network/types.d.ts.map +1 -1
- package/dist/modules/reactQuery/reactQuery.d.ts.map +1 -1
- package/dist/modules/reactQuery/reactQuery.js +46 -52
- package/dist/modules/reactQuery/reactQuery.js.map +1 -1
- package/dist/modules/storage/storage.d.ts.map +1 -1
- package/dist/modules/storage/storage.js +20 -3
- package/dist/modules/storage/storage.js.map +1 -1
- package/dist/server/host/tools/input.js +2 -2
- package/dist/server/host/tools/input.js.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +33 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcpServer.d.ts.map +1 -1
- package/dist/server/mcpServer.js +43 -3
- package/dist/server/mcpServer.js.map +1 -1
- package/dist/server/metro/eventCapture.d.ts +0 -2
- package/dist/server/metro/eventCapture.d.ts.map +1 -1
- package/dist/server/metro/eventCapture.js +1 -2
- package/dist/server/metro/eventCapture.js.map +1 -1
- package/dist/server/metro/tools/events.d.ts.map +1 -1
- package/dist/server/metro/tools/events.js +11 -11
- package/dist/server/metro/tools/events.js.map +1 -1
- package/dist/shared/projection/projectValue.d.ts +90 -0
- package/dist/shared/projection/projectValue.d.ts.map +1 -0
- package/dist/shared/projection/projectValue.js +322 -0
- package/dist/shared/projection/projectValue.js.map +1 -0
- package/dist/shared/projection/redact.d.ts +31 -0
- package/dist/shared/projection/redact.d.ts.map +1 -0
- package/dist/shared/projection/redact.js +78 -0
- package/dist/shared/projection/redact.js.map +1 -0
- package/dist/shared/projection/resolvePath.d.ts +45 -0
- package/dist/shared/projection/resolvePath.d.ts.map +1 -0
- package/dist/shared/projection/resolvePath.js +211 -0
- package/dist/shared/projection/resolvePath.js.map +1 -0
- package/dist/shared/rn/core.d.ts +48 -0
- package/dist/shared/rn/core.d.ts.map +1 -0
- package/dist/shared/rn/core.js +100 -0
- package/dist/shared/rn/core.js.map +1 -0
- package/dist/shared/rn/deviceInfo.d.ts +40 -0
- package/dist/shared/rn/deviceInfo.d.ts.map +1 -0
- package/dist/shared/rn/deviceInfo.js +78 -0
- package/dist/shared/rn/deviceInfo.js.map +1 -0
- package/package.json +2 -2
- package/dist/client/hooks/useMcpState.d.ts +0 -3
- package/dist/client/hooks/useMcpState.d.ts.map +0 -1
- package/dist/client/hooks/useMcpState.js +0 -20
- package/dist/client/hooks/useMcpState.js.map +0 -1
- package/dist/server/canonicalize.d.ts +0 -8
- package/dist/server/canonicalize.d.ts.map +0 -1
- package/dist/server/canonicalize.js +0 -23
- package/dist/server/canonicalize.js.map +0 -1
- package/dist/server/host/modules/screenshot.d.ts +0 -4
- package/dist/server/host/modules/screenshot.d.ts.map +0 -1
- package/dist/server/host/modules/screenshot.js +0 -615
- package/dist/server/host/modules/screenshot.js.map +0 -1
- package/dist/server/host/tools/connectionStatus.d.ts +0 -9
- package/dist/server/host/tools/connectionStatus.d.ts.map +0 -1
- package/dist/server/host/tools/connectionStatus.js +0 -39
- package/dist/server/host/tools/connectionStatus.js.map +0 -1
- package/dist/server/host/tools/symbolicate.d.ts +0 -3
- package/dist/server/host/tools/symbolicate.d.ts.map +0 -1
- package/dist/server/host/tools/symbolicate.js +0 -209
- package/dist/server/host/tools/symbolicate.js.map +0 -1
- package/dist/server/host/wda.d.ts +0 -15
- package/dist/server/host/wda.d.ts.map +0 -1
- package/dist/server/host/wda.js +0 -100
- package/dist/server/host/wda.js.map +0 -1
- package/dist/server/inputSchemaToZod.d.ts +0 -19
- package/dist/server/inputSchemaToZod.d.ts.map +0 -1
- package/dist/server/inputSchemaToZod.js +0 -89
- package/dist/server/inputSchemaToZod.js.map +0 -1
- package/dist/server/metro/tools/openUrl.d.ts +0 -3
- package/dist/server/metro/tools/openUrl.d.ts.map +0 -1
- package/dist/server/metro/tools/openUrl.js +0 -71
- package/dist/server/metro/tools/openUrl.js.map +0 -1
- package/dist/shared/slice.d.ts +0 -16
- package/dist/shared/slice.d.ts.map +0 -1
- package/dist/shared/slice.js +0 -29
- package/dist/shared/slice.js.map +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.connectionStatusTool = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Reports which RN clients are currently connected to the bridge with their
|
|
6
|
-
* platform, label, app metadata, and registered module names. Replaces the
|
|
7
|
-
* legacy top-level `connection_status` meta-tool with a first-class host tool
|
|
8
|
-
* so it shows up in the MCP catalog like any other.
|
|
9
|
-
*/
|
|
10
|
-
const connectionStatusTool = () => {
|
|
11
|
-
return {
|
|
12
|
-
description: 'List connected React Native clients with their IDs, platforms, labels, app metadata, and registered module names. Use the returned client IDs to disambiguate calls when more than one client is connected.',
|
|
13
|
-
handler: (_args, ctx) => {
|
|
14
|
-
const clients = ctx.bridge.listClients();
|
|
15
|
-
return {
|
|
16
|
-
clientCount: clients.length,
|
|
17
|
-
clients: clients.map((c) => {
|
|
18
|
-
return {
|
|
19
|
-
appName: c.appName,
|
|
20
|
-
appVersion: c.appVersion,
|
|
21
|
-
bundleId: c.bundleId,
|
|
22
|
-
connectedAt: new Date(c.connectedAt).toISOString(),
|
|
23
|
-
devServer: c.devServer,
|
|
24
|
-
deviceId: c.deviceId,
|
|
25
|
-
id: c.id,
|
|
26
|
-
label: c.label,
|
|
27
|
-
modules: c.modules.map((m) => {
|
|
28
|
-
return m.name;
|
|
29
|
-
}),
|
|
30
|
-
platform: c.platform,
|
|
31
|
-
};
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
inputSchema: {},
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
exports.connectionStatusTool = connectionStatusTool;
|
|
39
|
-
//# sourceMappingURL=connectionStatus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectionStatus.js","sourceRoot":"","sources":["../../../../src/server/host/tools/connectionStatus.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACI,MAAM,oBAAoB,GAAG,GAAoB,EAAE;IACxD,OAAO;QACL,WAAW,EACT,6MAA6M;QAC/M,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACtB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACzC,OAAO;gBACL,WAAW,EAAE,OAAO,CAAC,MAAM;gBAC3B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;oBACzB,OAAO;wBACL,OAAO,EAAE,CAAC,CAAC,OAAO;wBAClB,UAAU,EAAE,CAAC,CAAC,UAAU;wBACxB,QAAQ,EAAE,CAAC,CAAC,QAAQ;wBACpB,WAAW,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE;wBAClD,SAAS,EAAE,CAAC,CAAC,SAAS;wBACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ;wBACpB,EAAE,EAAE,CAAC,CAAC,EAAE;wBACR,KAAK,EAAE,CAAC,CAAC,KAAK;wBACd,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC3B,OAAO,CAAC,CAAC,IAAI,CAAC;wBAChB,CAAC,CAAC;wBACF,QAAQ,EAAE,CAAC,CAAC,QAAQ;qBACrB,CAAC;gBACJ,CAAC,CAAC;aACH,CAAC;QACJ,CAAC;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbolicate.d.ts","sourceRoot":"","sources":["../../../../src/server/host/tools/symbolicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA6F3D,eAAO,MAAM,eAAe,QAAO,eA8IlC,CAAC"}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.symbolicateTool = void 0;
|
|
4
|
-
const DEFAULT_METRO = 'http://localhost:8081';
|
|
5
|
-
const METRO_TIMEOUT_MS = 5_000;
|
|
6
|
-
const DEFAULT_MAX_FRAMES = 10;
|
|
7
|
-
const MAX_FRAMES_CEILING = 100;
|
|
8
|
-
/**
|
|
9
|
-
* Parses a raw Error.stack string into structured frames. Supports both the
|
|
10
|
-
* V8 ` at method (file:line:col)` format and the Hermes / JSC
|
|
11
|
-
* `method@file:line:col` form used by React Native. Returns an empty array if
|
|
12
|
-
* nothing matches so the caller can fall back gracefully.
|
|
13
|
-
*/
|
|
14
|
-
const parseStackString = (stack) => {
|
|
15
|
-
const frames = [];
|
|
16
|
-
const v8Regex = /^\s*at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?\s*$/gm;
|
|
17
|
-
let match;
|
|
18
|
-
while ((match = v8Regex.exec(stack)) !== null) {
|
|
19
|
-
frames.push({
|
|
20
|
-
column: Number.parseInt(match[4], 10),
|
|
21
|
-
file: match[2],
|
|
22
|
-
lineNumber: Number.parseInt(match[3], 10),
|
|
23
|
-
methodName: match[1]?.trim() || undefined,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
if (frames.length > 0)
|
|
27
|
-
return frames;
|
|
28
|
-
const hermesRegex = /^(.*?)@(.+?):(\d+):(\d+)$/gm;
|
|
29
|
-
while ((match = hermesRegex.exec(stack)) !== null) {
|
|
30
|
-
frames.push({
|
|
31
|
-
column: Number.parseInt(match[4], 10),
|
|
32
|
-
file: match[2],
|
|
33
|
-
lineNumber: Number.parseInt(match[3], 10),
|
|
34
|
-
methodName: match[1]?.trim() || undefined,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return frames;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Shorten an absolute filesystem path by stripping the current working
|
|
41
|
-
* directory prefix. Leaves URLs and unrelated absolute paths untouched.
|
|
42
|
-
*/
|
|
43
|
-
const relativeToCwd = (file, cwd) => {
|
|
44
|
-
if (!file)
|
|
45
|
-
return file;
|
|
46
|
-
if (file.startsWith('http://') || file.startsWith('https://'))
|
|
47
|
-
return file;
|
|
48
|
-
if (file.startsWith(cwd + '/'))
|
|
49
|
-
return file.slice(cwd.length + 1);
|
|
50
|
-
if (file === cwd)
|
|
51
|
-
return '.';
|
|
52
|
-
return file;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Apply token-saving transforms to a resolved stack:
|
|
56
|
-
* 1. Drop framework frames (`collapse: true` from Metro = node_modules / RN
|
|
57
|
-
* internals) unless explicitly kept via includeFrameworkFrames.
|
|
58
|
-
* 2. Trim to `maxFrames` (from the top — where the actual cause lives).
|
|
59
|
-
* 3. Rewrite file paths relative to cwd unless fullPaths is set.
|
|
60
|
-
* 4. Drop `collapse` from output (already used for filtering).
|
|
61
|
-
*/
|
|
62
|
-
const trimFrames = (frames, opts) => {
|
|
63
|
-
const filtered = opts.includeFramework
|
|
64
|
-
? frames
|
|
65
|
-
: frames.filter((f) => {
|
|
66
|
-
return !f.collapse;
|
|
67
|
-
});
|
|
68
|
-
const limited = filtered.slice(0, opts.maxFrames);
|
|
69
|
-
const cwd = process.cwd();
|
|
70
|
-
return limited.map((f) => {
|
|
71
|
-
const out = {};
|
|
72
|
-
const file = opts.fullPaths ? f.file : relativeToCwd(f.file, cwd);
|
|
73
|
-
if (file)
|
|
74
|
-
out.file = file;
|
|
75
|
-
if (typeof f.lineNumber === 'number')
|
|
76
|
-
out.lineNumber = f.lineNumber;
|
|
77
|
-
if (typeof f.column === 'number' && f.column > 0)
|
|
78
|
-
out.column = f.column;
|
|
79
|
-
if (f.methodName)
|
|
80
|
-
out.methodName = f.methodName;
|
|
81
|
-
return out;
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
const symbolicateTool = () => {
|
|
85
|
-
return {
|
|
86
|
-
description: `Resolve a JS stack trace via Metro's /symbolicate endpoint — maps bundled paths like "http://localhost:8081/index.bundle:12345:67" back to original sources like "src/components/Foo.tsx:42:10".
|
|
87
|
-
|
|
88
|
-
Pass either a raw stack string (from errors__get_errors.stack) or a parsed array of frames (from log_box__get_logs[*].stack). No-ops gracefully when Metro is unreachable (returns { skipped: true, error }), so safe to call opportunistically.
|
|
89
|
-
|
|
90
|
-
TOKEN-SAVING DEFAULTS
|
|
91
|
-
- node_modules / RN-internal frames (collapse: true from Metro) are dropped.
|
|
92
|
-
- Only the top ${DEFAULT_MAX_FRAMES} frames returned.
|
|
93
|
-
- Absolute paths are shortened relative to the MCP server's cwd.
|
|
94
|
-
Opt-out via includeFrameworkFrames / maxFrames / fullPaths.`,
|
|
95
|
-
handler: async (args, ctx) => {
|
|
96
|
-
const stack = args.stack;
|
|
97
|
-
const frames = args.frames;
|
|
98
|
-
const clientResolution = ctx.bridge.resolveClient(args.clientId ?? ctx.requestedClientId);
|
|
99
|
-
const clientDevServerUrl = clientResolution.ok
|
|
100
|
-
? clientResolution.client.devServer?.url
|
|
101
|
-
: undefined;
|
|
102
|
-
const metroUrl = (args.metroUrl ||
|
|
103
|
-
clientDevServerUrl ||
|
|
104
|
-
DEFAULT_METRO).replace(/\/$/, '');
|
|
105
|
-
const includeFramework = args.includeFrameworkFrames === true;
|
|
106
|
-
const fullPaths = args.fullPaths === true;
|
|
107
|
-
const maxFrames = Math.max(1, Math.min(MAX_FRAMES_CEILING, typeof args.maxFrames === 'number' ? Math.floor(args.maxFrames) : DEFAULT_MAX_FRAMES));
|
|
108
|
-
const trimOpts = { fullPaths, includeFramework, maxFrames };
|
|
109
|
-
let rawFrames;
|
|
110
|
-
if (Array.isArray(frames) && frames.length > 0) {
|
|
111
|
-
rawFrames = frames;
|
|
112
|
-
}
|
|
113
|
-
else if (typeof stack === 'string' && stack.length > 0) {
|
|
114
|
-
rawFrames = parseStackString(stack);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return { error: 'Pass either `stack` (string) or `frames` (array).' };
|
|
118
|
-
}
|
|
119
|
-
if (rawFrames.length === 0) {
|
|
120
|
-
return { error: 'No frames parsed from input.', frames: [], skipped: true };
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const controller = new AbortController();
|
|
124
|
-
const timer = setTimeout(() => {
|
|
125
|
-
controller.abort();
|
|
126
|
-
}, METRO_TIMEOUT_MS);
|
|
127
|
-
const res = await fetch(`${metroUrl}/symbolicate`, {
|
|
128
|
-
body: JSON.stringify({ stack: rawFrames }),
|
|
129
|
-
headers: { 'Content-Type': 'application/json' },
|
|
130
|
-
method: 'POST',
|
|
131
|
-
signal: controller.signal,
|
|
132
|
-
});
|
|
133
|
-
clearTimeout(timer);
|
|
134
|
-
if (!res.ok) {
|
|
135
|
-
return {
|
|
136
|
-
error: `Metro responded ${res.status}`,
|
|
137
|
-
frames: trimFrames(rawFrames, trimOpts),
|
|
138
|
-
skipped: true,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
const json = (await res.json());
|
|
142
|
-
const resolved = json.stack ?? rawFrames;
|
|
143
|
-
const totalFrames = includeFramework
|
|
144
|
-
? resolved.length
|
|
145
|
-
: resolved.filter((f) => {
|
|
146
|
-
return !f.collapse;
|
|
147
|
-
}).length;
|
|
148
|
-
const trimmed = trimFrames(resolved, trimOpts);
|
|
149
|
-
const result = { frames: trimmed, totalFrames };
|
|
150
|
-
if (!includeFramework) {
|
|
151
|
-
result.droppedFrameworkFrames = resolved.length - totalFrames;
|
|
152
|
-
}
|
|
153
|
-
if (totalFrames > trimmed.length)
|
|
154
|
-
result.truncated = true;
|
|
155
|
-
return result;
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
return {
|
|
159
|
-
error: `Metro at ${metroUrl} unreachable: ${err.message}`,
|
|
160
|
-
frames: trimFrames(rawFrames, trimOpts),
|
|
161
|
-
skipped: true,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
inputSchema: {
|
|
166
|
-
frames: {
|
|
167
|
-
description: 'Parsed stack frames: [{ file, lineNumber, column, methodName? }]. Takes precedence over `stack` when both are provided.',
|
|
168
|
-
examples: [
|
|
169
|
-
[
|
|
170
|
-
{
|
|
171
|
-
column: 42,
|
|
172
|
-
file: 'http://localhost:8081/index.bundle',
|
|
173
|
-
lineNumber: 1234,
|
|
174
|
-
methodName: 'render',
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
],
|
|
178
|
-
type: 'array',
|
|
179
|
-
},
|
|
180
|
-
fullPaths: {
|
|
181
|
-
description: 'Return absolute file paths instead of ones relative to the MCP server cwd. Default false.',
|
|
182
|
-
type: 'boolean',
|
|
183
|
-
},
|
|
184
|
-
includeFrameworkFrames: {
|
|
185
|
-
description: 'Keep node_modules / React Native internal frames (marked collapse: true by Metro). Default false — framework noise is dropped to save tokens.',
|
|
186
|
-
type: 'boolean',
|
|
187
|
-
},
|
|
188
|
-
maxFrames: {
|
|
189
|
-
description: `Max frames to return after filtering (top-down). Default ${DEFAULT_MAX_FRAMES}, max ${MAX_FRAMES_CEILING}.`,
|
|
190
|
-
type: 'number',
|
|
191
|
-
},
|
|
192
|
-
clientId: {
|
|
193
|
-
description: 'Target client ID — used to pick up the Metro URL the app was actually loaded from (falls back to `metroUrl` or the hardcoded default).',
|
|
194
|
-
type: 'string',
|
|
195
|
-
},
|
|
196
|
-
metroUrl: {
|
|
197
|
-
description: `Base URL of the Metro dev server. Overrides the URL reported by the connected client. Default "${DEFAULT_METRO}".`,
|
|
198
|
-
type: 'string',
|
|
199
|
-
},
|
|
200
|
-
stack: {
|
|
201
|
-
description: 'Raw stack trace string (e.g. from an Error.stack). Parsed into frames.',
|
|
202
|
-
type: 'string',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
timeout: METRO_TIMEOUT_MS + 1_000,
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
exports.symbolicateTool = symbolicateTool;
|
|
209
|
-
//# sourceMappingURL=symbolicate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbolicate.js","sourceRoot":"","sources":["../../../../src/server/host/tools/symbolicate.ts"],"names":[],"mappings":";;;AAEA,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAC9C,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAa/B;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAgB,EAAE;IACvD,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,MAAM,OAAO,GAAG,oDAAoD,CAAC;IACrE,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC;YACtC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAE;YACf,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC;YAC1C,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS;SAC1C,CAAC,CAAC;IACL,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC;IAErC,MAAM,WAAW,GAAG,6BAA6B,CAAC;IAClD,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,CAAC,IAAI,CAA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mBA8I1B"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type AppTargetError } from './helpers';
|
|
2
|
-
import { type ProcessRunner } from './processRunner';
|
|
3
|
-
export declare const tapIos: (udid: string, xPixels: number, yPixels: number, runner: ProcessRunner) => Promise<{
|
|
4
|
-
ok: true;
|
|
5
|
-
} | AppTargetError>;
|
|
6
|
-
export declare const swipeIos: (udid: string, x1Pixels: number, y1Pixels: number, x2Pixels: number, y2Pixels: number, durationMs: number, runner: ProcessRunner) => Promise<{
|
|
7
|
-
ok: true;
|
|
8
|
-
} | AppTargetError>;
|
|
9
|
-
export declare const typeTextIos: (udid: string, text: string, submit: boolean, runner: ProcessRunner) => Promise<{
|
|
10
|
-
ok: true;
|
|
11
|
-
} | AppTargetError>;
|
|
12
|
-
export declare const pressKeyIos: (udid: string, key: string, runner: ProcessRunner) => Promise<{
|
|
13
|
-
ok: true;
|
|
14
|
-
} | AppTargetError>;
|
|
15
|
-
//# sourceMappingURL=wda.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wda.d.ts","sourceRoot":"","sources":["../../../src/server/host/wda.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA8C3E,eAAO,MAAM,MAAM,SACX,MAAM,WACH,MAAM,WACN,MAAM,UACP,aAAa,KACpB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,cAAc,CAGvC,CAAC;AAEF,eAAO,MAAM,QAAQ,SACb,MAAM,YACF,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,cACJ,MAAM,UACV,aAAa,KACpB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,cAAc,CAevC,CAAC;AAEF,eAAO,MAAM,WAAW,SAChB,MAAM,QACN,MAAM,UACJ,OAAO,UACP,aAAa,KACpB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,cAAc,CAGvC,CAAC;AAmBF,eAAO,MAAM,WAAW,SAChB,MAAM,OACP,MAAM,UACH,aAAa,KACpB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,cAAc,CAkBvC,CAAC"}
|
package/dist/server/host/wda.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// iOS input injection via the bundled ios-hid Swift binary.
|
|
3
|
-
// ios-hid uses Apple private frameworks (SimulatorKit, CoreSimulator) to inject
|
|
4
|
-
// HID events directly into iOS Simulator — no WDA, no idb, no external deps.
|
|
5
|
-
// Coordinates are in POINTS (not pixels). Callers must convert.
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.pressKeyIos = exports.typeTextIos = exports.swipeIos = exports.tapIos = void 0;
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
const processRunner_1 = require("./processRunner");
|
|
10
|
-
const IOS_INPUT_TIMEOUT_MS = 5_000;
|
|
11
|
-
// Default pixelRatio for iOS simulators. Most modern iPhones are 3x.
|
|
12
|
-
// iPhone SE is 2x, iPads are 2x. When a connected client provides
|
|
13
|
-
// its pixelRatio via device module we could use that instead, but for
|
|
14
|
-
// now default to 3 which covers the majority of dev simulators.
|
|
15
|
-
const DEFAULT_IOS_PIXEL_RATIO = 3;
|
|
16
|
-
const getIosHidPath = () => {
|
|
17
|
-
// ios-hid binary lives in dist/bin/ relative to the package root.
|
|
18
|
-
// This file is at dist/server/host/wda.js after compilation,
|
|
19
|
-
// so package root is three levels up.
|
|
20
|
-
return (0, node_path_1.join)(__dirname, '..', '..', 'bin', 'ios-hid');
|
|
21
|
-
};
|
|
22
|
-
const runIosHid = async (runner, args, action) => {
|
|
23
|
-
const bin = getIosHidPath();
|
|
24
|
-
try {
|
|
25
|
-
const proc = await runner(bin, args, { timeoutMs: IOS_INPUT_TIMEOUT_MS });
|
|
26
|
-
if (proc.timedOut) {
|
|
27
|
-
return { error: `iOS ${action} timed out after ${IOS_INPUT_TIMEOUT_MS}ms` };
|
|
28
|
-
}
|
|
29
|
-
if (proc.exitCode !== 0) {
|
|
30
|
-
const stderr = proc.stderr.toString('utf8').trim();
|
|
31
|
-
return {
|
|
32
|
-
error: `iOS ${action} failed: ${stderr.slice(0, 500) || `exit code ${proc.exitCode}`}`,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return { ok: true };
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
if (err instanceof processRunner_1.ProcessNotFoundError) {
|
|
39
|
-
return {
|
|
40
|
-
error: 'ios-hid binary not found. This usually means the package was installed on a non-macOS platform. iOS input injection requires macOS with Xcode.',
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return { error: `iOS ${action} failed: ${err.message}` };
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const tapIos = async (udid, xPixels, yPixels, runner) => {
|
|
47
|
-
const r = DEFAULT_IOS_PIXEL_RATIO;
|
|
48
|
-
return runIosHid(runner, ['tap', udid, String(xPixels / r), String(yPixels / r)], 'tap');
|
|
49
|
-
};
|
|
50
|
-
exports.tapIos = tapIos;
|
|
51
|
-
const swipeIos = async (udid, x1Pixels, y1Pixels, x2Pixels, y2Pixels, durationMs, runner) => {
|
|
52
|
-
const r = DEFAULT_IOS_PIXEL_RATIO;
|
|
53
|
-
return runIosHid(runner, [
|
|
54
|
-
'swipe',
|
|
55
|
-
udid,
|
|
56
|
-
String(x1Pixels / r),
|
|
57
|
-
String(y1Pixels / r),
|
|
58
|
-
String(x2Pixels / r),
|
|
59
|
-
String(y2Pixels / r),
|
|
60
|
-
String(durationMs / 1000),
|
|
61
|
-
], 'swipe');
|
|
62
|
-
};
|
|
63
|
-
exports.swipeIos = swipeIos;
|
|
64
|
-
const typeTextIos = async (udid, text, submit, runner) => {
|
|
65
|
-
const fullText = submit ? text + '\n' : text;
|
|
66
|
-
return runIosHid(runner, ['type', udid, fullText], 'type');
|
|
67
|
-
};
|
|
68
|
-
exports.typeTextIos = typeTextIos;
|
|
69
|
-
// Keys that don't exist on iOS
|
|
70
|
-
const IOS_UNSUPPORTED_KEYS = new Set(['back', 'menu', 'power', 'volume_down', 'volume_up']);
|
|
71
|
-
// Map our key names to ios-hid button names
|
|
72
|
-
const IOS_BUTTON_MAP = {
|
|
73
|
-
home: 'home',
|
|
74
|
-
};
|
|
75
|
-
// Map keyboard keys to Unicode values for ios-hid type command
|
|
76
|
-
const IOS_KEY_TEXT = {
|
|
77
|
-
backspace: '\u007F',
|
|
78
|
-
enter: '\n',
|
|
79
|
-
escape: '\u001B',
|
|
80
|
-
space: ' ',
|
|
81
|
-
tab: '\t',
|
|
82
|
-
};
|
|
83
|
-
const pressKeyIos = async (udid, key, runner) => {
|
|
84
|
-
if (IOS_UNSUPPORTED_KEYS.has(key)) {
|
|
85
|
-
return {
|
|
86
|
-
error: `Key '${key}' is not available on iOS Simulator. Supported: enter, tab, space, backspace, escape, home.`,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
const button = IOS_BUTTON_MAP[key];
|
|
90
|
-
if (button) {
|
|
91
|
-
return runIosHid(runner, ['button', udid, button], 'button');
|
|
92
|
-
}
|
|
93
|
-
const keyText = IOS_KEY_TEXT[key];
|
|
94
|
-
if (keyText) {
|
|
95
|
-
return runIosHid(runner, ['type', udid, keyText], 'key');
|
|
96
|
-
}
|
|
97
|
-
return { error: `Unknown key '${key}' for iOS.` };
|
|
98
|
-
};
|
|
99
|
-
exports.pressKeyIos = pressKeyIos;
|
|
100
|
-
//# sourceMappingURL=wda.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wda.js","sourceRoot":"","sources":["../../../src/server/host/wda.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,gFAAgF;AAChF,6EAA6E;AAC7E,gEAAgE;;;AA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|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Converts a module's wire-format `inputSchema` (flat `Record<string, FieldSpec>`)
|
|
4
|
-
* into a Zod raw shape suitable for `McpServer.registerTool`. Always injects an
|
|
5
|
-
* optional `clientId` so multi-client routing has a uniform escape hatch.
|
|
6
|
-
*
|
|
7
|
-
* Pass `injectClientId: false` for host tools that already know their target
|
|
8
|
-
* (or where `clientId` is irrelevant — purely host-local commands).
|
|
9
|
-
*/
|
|
10
|
-
export declare const convertInputSchema: (schema: Record<string, unknown> | undefined, options?: {
|
|
11
|
-
injectClientId?: boolean;
|
|
12
|
-
}) => Record<string, z.ZodTypeAny>;
|
|
13
|
-
/**
|
|
14
|
-
* Stable canonical hash of a tool descriptor for dedup across clients. Strips
|
|
15
|
-
* `examples` from each field — examples are documentation, not contract, and
|
|
16
|
-
* should not break dedup if two builds happen to reorder them.
|
|
17
|
-
*/
|
|
18
|
-
export declare const hashInputSchema: (description: string, schema: Record<string, unknown> | undefined) => string;
|
|
19
|
-
//# sourceMappingURL=inputSchemaToZod.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputSchemaToZod.d.ts","sourceRoot":"","sources":["../../src/server/inputSchemaToZod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,WACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,YAClC;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,KACpC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAgB7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,gBACb,MAAM,UACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KAC1C,MAcF,CAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hashInputSchema = exports.convertInputSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const canonicalize_1 = require("./canonicalize");
|
|
6
|
-
const baseFor = (type) => {
|
|
7
|
-
switch (type) {
|
|
8
|
-
case 'string':
|
|
9
|
-
return zod_1.z.string();
|
|
10
|
-
case 'number':
|
|
11
|
-
return zod_1.z.number();
|
|
12
|
-
case 'boolean':
|
|
13
|
-
return zod_1.z.boolean();
|
|
14
|
-
case 'array':
|
|
15
|
-
return zod_1.z.array(zod_1.z.unknown());
|
|
16
|
-
case 'object':
|
|
17
|
-
return zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
|
|
18
|
-
default:
|
|
19
|
-
return zod_1.z.unknown();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const buildDescription = (spec) => {
|
|
23
|
-
if (!spec.description && !spec.examples?.length)
|
|
24
|
-
return undefined;
|
|
25
|
-
if (!spec.examples?.length)
|
|
26
|
-
return spec.description;
|
|
27
|
-
// Zod has no first-class examples — fold them into the description so the
|
|
28
|
-
// catalog still surfaces them to the agent.
|
|
29
|
-
const ex = spec.examples
|
|
30
|
-
.map((e) => {
|
|
31
|
-
return JSON.stringify(e);
|
|
32
|
-
})
|
|
33
|
-
.join(', ');
|
|
34
|
-
return spec.description ? `${spec.description} Examples: ${ex}` : `Examples: ${ex}`;
|
|
35
|
-
};
|
|
36
|
-
const CLIENT_ID_FIELD = zod_1.z
|
|
37
|
-
.string()
|
|
38
|
-
.optional()
|
|
39
|
-
.describe('Target client ID (e.g. "ios-1"). Required when more than one RN client is connected; auto-picked otherwise.');
|
|
40
|
-
/**
|
|
41
|
-
* Converts a module's wire-format `inputSchema` (flat `Record<string, FieldSpec>`)
|
|
42
|
-
* into a Zod raw shape suitable for `McpServer.registerTool`. Always injects an
|
|
43
|
-
* optional `clientId` so multi-client routing has a uniform escape hatch.
|
|
44
|
-
*
|
|
45
|
-
* Pass `injectClientId: false` for host tools that already know their target
|
|
46
|
-
* (or where `clientId` is irrelevant — purely host-local commands).
|
|
47
|
-
*/
|
|
48
|
-
const convertInputSchema = (schema, options = {}) => {
|
|
49
|
-
const { injectClientId = true } = options;
|
|
50
|
-
const shape = {};
|
|
51
|
-
if (schema) {
|
|
52
|
-
for (const [key, raw] of Object.entries(schema)) {
|
|
53
|
-
const spec = (raw ?? {});
|
|
54
|
-
let zType = baseFor(spec.type);
|
|
55
|
-
const desc = buildDescription(spec);
|
|
56
|
-
if (desc)
|
|
57
|
-
zType = zType.describe(desc);
|
|
58
|
-
shape[key] = zType.optional();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (injectClientId) {
|
|
62
|
-
shape.clientId = CLIENT_ID_FIELD;
|
|
63
|
-
}
|
|
64
|
-
return shape;
|
|
65
|
-
};
|
|
66
|
-
exports.convertInputSchema = convertInputSchema;
|
|
67
|
-
/**
|
|
68
|
-
* Stable canonical hash of a tool descriptor for dedup across clients. Strips
|
|
69
|
-
* `examples` from each field — examples are documentation, not contract, and
|
|
70
|
-
* should not break dedup if two builds happen to reorder them.
|
|
71
|
-
*/
|
|
72
|
-
const hashInputSchema = (description, schema) => {
|
|
73
|
-
const stripped = {};
|
|
74
|
-
if (schema) {
|
|
75
|
-
for (const [k, v] of Object.entries(schema)) {
|
|
76
|
-
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
|
77
|
-
const copy = { ...v };
|
|
78
|
-
delete copy.examples;
|
|
79
|
-
stripped[k] = copy;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
stripped[k] = v;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return (0, canonicalize_1.canonicalize)({ description, schema: stripped });
|
|
87
|
-
};
|
|
88
|
-
exports.hashInputSchema = hashInputSchema;
|
|
89
|
-
//# sourceMappingURL=inputSchemaToZod.js.map
|
|
@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C,MAAM,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpD,MAAM,IAAI,GAAG,EAAE,GAAI,CAA6B,EAAE,CAAC;gBACnD,OAAO,IAAI,CAAC,QAAQ,CAAC;gBACrB,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAA,2BAAY,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openUrl.d.ts","sourceRoot":"","sources":["../../../../src/server/metro/tools/openUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,eAAO,MAAM,WAAW,QAAO,eAgE9B,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.openUrlTool = void 0;
|
|
4
|
-
const resolveMetroUrl_1 = require("../../../server/metro/resolveMetroUrl");
|
|
5
|
-
const METRO_TIMEOUT_MS = 5_000;
|
|
6
|
-
const openUrlTool = () => {
|
|
7
|
-
return {
|
|
8
|
-
description: `Open a URL in the default browser on the machine running Metro — POSTs to Metro's \`/open-url\` endpoint.
|
|
9
|
-
|
|
10
|
-
Useful for handing off to a view the agent has discovered but can't usefully display itself: a CI job page, a Grafana dashboard, a PR diff, a deployed preview build. This runs \`open\` on macOS / \`xdg-open\` on Linux against the host, not on the mobile device. For deep-linking into the app use navigation module or iOS/Android URL schemes instead.
|
|
11
|
-
|
|
12
|
-
Returns { ok: true, url, metroUrl } on success.`,
|
|
13
|
-
handler: async (args, ctx) => {
|
|
14
|
-
const url = typeof args.url === 'string' ? args.url : undefined;
|
|
15
|
-
if (!url) {
|
|
16
|
-
return { error: '`url` is required.' };
|
|
17
|
-
}
|
|
18
|
-
const metroUrl = (0, resolveMetroUrl_1.resolveMetroUrl)(args, ctx);
|
|
19
|
-
try {
|
|
20
|
-
const controller = new AbortController();
|
|
21
|
-
const timer = setTimeout(() => {
|
|
22
|
-
controller.abort();
|
|
23
|
-
}, METRO_TIMEOUT_MS);
|
|
24
|
-
const res = await fetch(`${metroUrl}/open-url`, {
|
|
25
|
-
body: JSON.stringify({ url }),
|
|
26
|
-
headers: { 'Content-Type': 'application/json' },
|
|
27
|
-
method: 'POST',
|
|
28
|
-
signal: controller.signal,
|
|
29
|
-
});
|
|
30
|
-
clearTimeout(timer);
|
|
31
|
-
if (!res.ok) {
|
|
32
|
-
return {
|
|
33
|
-
error: `Metro responded ${res.status}`,
|
|
34
|
-
metroUrl,
|
|
35
|
-
ok: false,
|
|
36
|
-
skipped: true,
|
|
37
|
-
url,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return { metroUrl, ok: true, url };
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
return {
|
|
44
|
-
error: `Metro at ${metroUrl} unreachable: ${err.message}`,
|
|
45
|
-
metroUrl,
|
|
46
|
-
ok: false,
|
|
47
|
-
skipped: true,
|
|
48
|
-
url,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
inputSchema: {
|
|
53
|
-
clientId: {
|
|
54
|
-
description: 'Target client ID — used to pick up the Metro URL the app was loaded from (falls back to `metroUrl` or the hardcoded default).',
|
|
55
|
-
type: 'string',
|
|
56
|
-
},
|
|
57
|
-
metroUrl: {
|
|
58
|
-
description: `Base URL of the Metro dev server. Overrides the URL reported by the connected client. Default "http://localhost:8081".`,
|
|
59
|
-
type: 'string',
|
|
60
|
-
},
|
|
61
|
-
url: {
|
|
62
|
-
description: 'Absolute URL to open on the host (http/https). Deep-linking into the mobile app is a different concern — use navigation tools instead.',
|
|
63
|
-
examples: ['https://example.com/dashboard', 'https://github.com/org/repo/pull/42'],
|
|
64
|
-
type: 'string',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
timeout: METRO_TIMEOUT_MS + 1_000,
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
exports.openUrlTool = openUrlTool;
|
|
71
|
-
//# sourceMappingURL=openUrl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openUrl.js","sourceRoot":"","sources":["../../../../src/server/metro/tools/openUrl.ts"],"names":[],"mappings":";;;AACA,oEAAiE;AAEjE,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,GAAoB,EAAE;IAC/C,OAAO;QACL,WAAW,EAAE;;;;gDAI+B;QAC5C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,GAAG,GAAG,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;YAChE,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;YACzC,CAAC;YACD,MAAM,QAAQ,GAAG,IAAA,iCAAe,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC5C,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;gBACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC5B,UAAU,CAAC,KAAK,EAAE,CAAC;gBACrB,CAAC,EAAE,gBAAgB,CAAC,CAAC;gBACrB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,W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**
|
|
2
|
-
* Shared `slice` input shape for tools that expose a slice-style window into
|
|
3
|
-
* a time-ordered buffer. Two-tuple mirrors `Array.prototype.slice(start, end?)`:
|
|
4
|
-
* negative indices count from the end, so [-10] = last ten, [-20, -10] = the
|
|
5
|
-
* ten before those, [0, 50] = the oldest fifty.
|
|
6
|
-
*/
|
|
7
|
-
export type SliceInput = [number] | [number, number];
|
|
8
|
-
/**
|
|
9
|
-
* Coerce a tool-argument value to a well-formed SliceInput, or undefined when
|
|
10
|
-
* the input is missing/malformed. Callers pick their own default behavior
|
|
11
|
-
* (typically either "return all" or "last N").
|
|
12
|
-
*/
|
|
13
|
-
export declare const parseSliceArg: (raw: unknown) => SliceInput | undefined;
|
|
14
|
-
export declare const applySlice: <T>(arr: T[], slice: SliceInput | undefined) => T[];
|
|
15
|
-
export declare const sliceSchemaDescription: (defaultHint: string) => string;
|
|
16
|
-
//# sourceMappingURL=slice.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slice.d.ts","sourceRoot":"","sources":["../../src/shared/slice.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAS,OAAO,KAAG,UAAU,GAAG,SAOzD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,OAAO,CAAC,EAAE,SAAS,UAAU,GAAG,SAAS,KAAG,CAAC,EAIxE,CAAC;AAEF,eAAO,MAAM,sBAAsB,gBAAiB,MAAM,KAAG,MAE5D,CAAC"}
|