replicant-mcp 1.6.2 → 1.6.4

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.
Files changed (47) hide show
  1. package/dist/adapters/ui-automator.d.ts +6 -6
  2. package/dist/adapters/ui-automator.js +19 -31
  3. package/dist/adapters/ui-fallback-find.js +44 -4
  4. package/dist/parsers/ui-dump.d.ts +1 -0
  5. package/dist/parsers/ui-dump.js +34 -2
  6. package/dist/schemas/derive.d.ts +8 -0
  7. package/dist/schemas/derive.js +19 -0
  8. package/dist/schemas/inputs.d.ts +9 -0
  9. package/dist/schemas/inputs.js +44 -0
  10. package/dist/server.js +3 -18
  11. package/dist/tools/adb-app.d.ts +6 -30
  12. package/dist/tools/adb-app.js +10 -29
  13. package/dist/tools/adb-device.d.ts +4 -12
  14. package/dist/tools/adb-device.js +4 -12
  15. package/dist/tools/adb-logcat.d.ts +5 -29
  16. package/dist/tools/adb-logcat.js +6 -14
  17. package/dist/tools/adb-shell.d.ts +8 -28
  18. package/dist/tools/adb-shell.js +10 -16
  19. package/dist/tools/cache.d.ts +9 -32
  20. package/dist/tools/cache.js +9 -25
  21. package/dist/tools/emulator-device.d.ts +4 -25
  22. package/dist/tools/emulator-device.js +5 -27
  23. package/dist/tools/gradle-build.d.ts +4 -16
  24. package/dist/tools/gradle-build.js +5 -14
  25. package/dist/tools/gradle-get-details.d.ts +7 -27
  26. package/dist/tools/gradle-get-details.js +11 -27
  27. package/dist/tools/gradle-list.d.ts +4 -13
  28. package/dist/tools/gradle-list.js +5 -13
  29. package/dist/tools/gradle-test.d.ts +4 -20
  30. package/dist/tools/gradle-test.js +9 -19
  31. package/dist/tools/index.d.ts +197 -0
  32. package/dist/tools/index.js +33 -0
  33. package/dist/tools/rtfm.d.ts +4 -12
  34. package/dist/tools/rtfm.js +10 -11
  35. package/dist/tools/ui-action.d.ts +18 -41
  36. package/dist/tools/ui-action.js +179 -35
  37. package/dist/tools/ui-capture.d.ts +7 -26
  38. package/dist/tools/ui-capture.js +9 -21
  39. package/dist/tools/ui-query.d.ts +13 -72
  40. package/dist/tools/ui-query.js +39 -46
  41. package/dist/types/errors.d.ts +1 -0
  42. package/dist/types/errors.js +1 -0
  43. package/dist/types/schemas/ui-output.d.ts +92 -6
  44. package/dist/types/schemas/ui-output.js +20 -0
  45. package/docs/contracts/replicant-mcp.contract.json +241 -57
  46. package/docs/contracts/tool-schema-tokens.json +67 -0
  47. package/package.json +9 -6
@@ -7,38 +7,19 @@ export declare const uiCaptureInputSchema: z.ZodObject<{
7
7
  "visual-snapshot": "visual-snapshot";
8
8
  }>;
9
9
  localPath: z.ZodOptional<z.ZodString>;
10
- inline: z.ZodOptional<z.ZodBoolean>;
11
- maxDimension: z.ZodOptional<z.ZodNumber>;
12
- raw: z.ZodOptional<z.ZodBoolean>;
13
- }, z.core.$strip>;
10
+ inline: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
11
+ maxDimension: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | number, unknown>, z.ZodCoercedNumber<unknown>>>;
12
+ raw: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
13
+ }, z.core.$strict>;
14
14
  export type UiCaptureInput = z.infer<typeof uiCaptureInputSchema>;
15
15
  export declare function handleUiCaptureTool(input: UiCaptureInput, context: ServerContext, uiConfig?: UiConfig): Promise<Record<string, unknown>>;
16
16
  export declare const uiCaptureToolDefinition: {
17
17
  name: string;
18
18
  description: string;
19
19
  inputSchema: {
20
- type: string;
21
- properties: {
22
- operation: {
23
- type: string;
24
- enum: string[];
25
- };
26
- localPath: {
27
- type: string;
28
- };
29
- inline: {
30
- type: string;
31
- };
32
- maxDimension: {
33
- type: string;
34
- description: string;
35
- };
36
- raw: {
37
- type: string;
38
- description: string;
39
- };
40
- };
41
- required: string[];
20
+ type: "object";
21
+ properties?: Record<string, unknown>;
22
+ required?: string[];
42
23
  };
43
24
  annotations: {
44
25
  readOnlyHint: boolean;
@@ -1,12 +1,16 @@
1
1
  import { z } from "zod";
2
2
  import { ReplicantError, ErrorCode } from "../types/index.js";
3
3
  import { DEFAULT_CONFIG } from "../types/config.js";
4
- export const uiCaptureInputSchema = z.object({
4
+ import { booleanInput, numberInput, toolSchema } from "../schemas/inputs.js";
5
+ import { toMcpJsonSchema } from "../schemas/derive.js";
6
+ export const uiCaptureInputSchema = toolSchema({
5
7
  operation: z.enum(["screenshot", "visual-snapshot"]),
6
8
  localPath: z.string().optional(),
7
- inline: z.boolean().optional(),
8
- maxDimension: z.number().optional(),
9
- raw: z.boolean().optional(),
9
+ inline: booleanInput().optional(),
10
+ maxDimension: numberInput()
11
+ .optional()
12
+ .describe(`Max image dimension in pixels (default: ${DEFAULT_CONFIG.ui.maxImageDimension}). Higher = better quality, more tokens.`),
13
+ raw: booleanInput().optional().describe("Skip scaling, full device resolution."),
10
14
  });
11
15
  const operations = {
12
16
  screenshot: handleScreenshot,
@@ -39,23 +43,7 @@ async function handleVisualSnapshot(input, context, config, deviceId) {
39
43
  export const uiCaptureToolDefinition = {
40
44
  name: "ui-capture",
41
45
  description: "Capture screenshots or visual snapshots.",
42
- inputSchema: {
43
- type: "object",
44
- properties: {
45
- operation: {
46
- type: "string",
47
- enum: ["screenshot", "visual-snapshot"],
48
- },
49
- localPath: { type: "string" },
50
- inline: { type: "boolean" },
51
- maxDimension: {
52
- type: "number",
53
- description: `Max image dimension in pixels (default: ${DEFAULT_CONFIG.ui.maxImageDimension}). Higher = better quality, more tokens.`,
54
- },
55
- raw: { type: "boolean", description: "Skip scaling, full device resolution." },
56
- },
57
- required: ["operation"],
58
- },
46
+ inputSchema: toMcpJsonSchema(uiCaptureInputSchema),
59
47
  annotations: {
60
48
  readOnlyHint: false,
61
49
  destructiveHint: false,
@@ -7,89 +7,30 @@ export declare const uiQueryInputSchema: z.ZodObject<{
7
7
  dump: "dump";
8
8
  "accessibility-check": "accessibility-check";
9
9
  }>;
10
- selector: z.ZodOptional<z.ZodObject<{
10
+ selector: z.ZodOptional<z.ZodPipe<z.ZodTransform<any, unknown>, z.ZodObject<{
11
11
  resourceId: z.ZodOptional<z.ZodString>;
12
12
  text: z.ZodOptional<z.ZodString>;
13
13
  textContains: z.ZodOptional<z.ZodString>;
14
14
  className: z.ZodOptional<z.ZodString>;
15
15
  nearestTo: z.ZodOptional<z.ZodString>;
16
- }, z.core.$strip>>;
17
- debug: z.ZodOptional<z.ZodBoolean>;
18
- maxTier: z.ZodOptional<z.ZodNumber>;
19
- gridCell: z.ZodOptional<z.ZodNumber>;
20
- gridPosition: z.ZodOptional<z.ZodNumber>;
21
- compact: z.ZodOptional<z.ZodBoolean>;
22
- limit: z.ZodOptional<z.ZodNumber>;
23
- offset: z.ZodOptional<z.ZodNumber>;
24
- }, z.core.$strip>;
16
+ }, z.core.$strict>>>;
17
+ debug: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
18
+ maxTier: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | number, unknown>, z.ZodCoercedNumber<unknown>>>;
19
+ gridCell: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | number, unknown>, z.ZodCoercedNumber<unknown>>>;
20
+ gridPosition: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | number, unknown>, z.ZodCoercedNumber<unknown>>>;
21
+ compact: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
22
+ limit: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | number, unknown>, z.ZodCoercedNumber<unknown>>>;
23
+ offset: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | number, unknown>, z.ZodCoercedNumber<unknown>>>;
24
+ }, z.core.$strict>;
25
25
  export type UiQueryInput = z.infer<typeof uiQueryInputSchema>;
26
26
  export declare function handleUiQueryTool(input: UiQueryInput, context: ServerContext, uiConfig?: UiConfig): Promise<Record<string, unknown>>;
27
27
  export declare const uiQueryToolDefinition: {
28
28
  name: string;
29
29
  description: string;
30
30
  inputSchema: {
31
- type: string;
32
- properties: {
33
- operation: {
34
- type: string;
35
- enum: string[];
36
- };
37
- selector: {
38
- type: string;
39
- properties: {
40
- resourceId: {
41
- type: string;
42
- };
43
- text: {
44
- type: string;
45
- };
46
- textContains: {
47
- type: string;
48
- };
49
- className: {
50
- type: string;
51
- };
52
- nearestTo: {
53
- type: string;
54
- description: string;
55
- };
56
- };
57
- };
58
- debug: {
59
- type: string;
60
- };
61
- maxTier: {
62
- type: string;
63
- minimum: number;
64
- maximum: number;
65
- description: string;
66
- };
67
- gridCell: {
68
- type: string;
69
- minimum: number;
70
- maximum: number;
71
- };
72
- gridPosition: {
73
- type: string;
74
- minimum: number;
75
- maximum: number;
76
- };
77
- compact: {
78
- type: string;
79
- description: string;
80
- };
81
- limit: {
82
- type: string;
83
- minimum: number;
84
- maximum: number;
85
- description: string;
86
- };
87
- offset: {
88
- type: string;
89
- minimum: number;
90
- };
91
- };
92
- required: string[];
31
+ type: "object";
32
+ properties?: Record<string, unknown>;
33
+ required?: string[];
93
34
  };
94
35
  annotations: {
95
36
  readOnlyHint: boolean;
@@ -3,22 +3,31 @@ import { CACHE_TTLS, ReplicantError, ErrorCode } from "../types/index.js";
3
3
  import { flattenTree } from "../parsers/ui-dump.js";
4
4
  import { DEFAULT_CONFIG } from "../types/config.js";
5
5
  import { handleFind } from "./ui-find.js";
6
- export const uiQueryInputSchema = z.object({
6
+ import { booleanInput, jsonObjectInput, numberInput, toolSchema, } from "../schemas/inputs.js";
7
+ import { toMcpJsonSchema } from "../schemas/derive.js";
8
+ export const uiQueryInputSchema = toolSchema({
7
9
  operation: z.enum(["dump", "find", "accessibility-check"]),
8
- selector: z.object({
10
+ selector: jsonObjectInput({
9
11
  resourceId: z.string().optional(),
10
12
  text: z.string().optional(),
11
13
  textContains: z.string().optional(),
12
14
  className: z.string().optional(),
13
- nearestTo: z.string().optional(),
15
+ nearestTo: z
16
+ .string()
17
+ .optional()
18
+ .describe("Find elements nearest to this text (spatial proximity)"),
14
19
  }).optional(),
15
- debug: z.boolean().optional(),
16
- maxTier: z.number().min(1).max(5).optional(),
17
- gridCell: z.number().min(1).max(24).optional(),
18
- gridPosition: z.number().min(1).max(5).optional(),
19
- compact: z.boolean().optional(),
20
- limit: z.number().min(1).max(100).optional(),
21
- offset: z.number().min(0).optional(),
20
+ debug: booleanInput().optional(),
21
+ maxTier: numberInput({ min: 1, max: 5 })
22
+ .optional()
23
+ .describe("Max fallback tier (1-5). Use 3 to stop before visual/grid payloads."),
24
+ gridCell: numberInput({ min: 1, max: 24 }).optional(),
25
+ gridPosition: numberInput({ min: 1, max: 5 }).optional(),
26
+ compact: booleanInput()
27
+ .optional()
28
+ .describe("Paginated flat list (default: true). false for full tree."),
29
+ limit: numberInput({ min: 1, max: 100 }).optional().describe("Default: 20"),
30
+ offset: numberInput({ min: 0 }).optional(),
22
31
  });
23
32
  const operations = {
24
33
  dump: handleDump,
@@ -34,6 +43,18 @@ export async function handleUiQueryTool(input, context, uiConfig) {
34
43
  }
35
44
  return handler(input, context, config, device.id);
36
45
  }
46
+ function buildCoordinateMeta(context) {
47
+ const scalingState = context.ui.getScalingState();
48
+ if (!scalingState) {
49
+ return { coordinateSpace: "device", scaleFactor: 1.0 };
50
+ }
51
+ return {
52
+ coordinateSpace: "device",
53
+ scaleFactor: scalingState.scaleFactor,
54
+ deviceDimensions: { width: scalingState.deviceWidth, height: scalingState.deviceHeight },
55
+ imageDimensions: { width: scalingState.imageWidth, height: scalingState.imageHeight },
56
+ };
57
+ }
37
58
  async function handleDump(input, context, _config, deviceId) {
38
59
  const tree = await context.ui.dump(deviceId);
39
60
  const dumpId = context.cache.generateId("ui-dump");
@@ -41,12 +62,13 @@ async function handleDump(input, context, _config, deviceId) {
41
62
  const emptyWarning = tree.length === 0
42
63
  ? "No accessibility nodes found. Possible causes: (1) UI still loading - wait and retry, (2) App uses custom rendering (Flutter, games, video players) - use screenshot instead, (3) App blocks accessibility services."
43
64
  : undefined;
65
+ const coordMeta = buildCoordinateMeta(context);
44
66
  if (input.compact !== false) {
45
- return handleCompactDump(tree, input, dumpId, deviceId, emptyWarning);
67
+ return handleCompactDump(tree, input, dumpId, deviceId, emptyWarning, coordMeta);
46
68
  }
47
- return handleFullDump(tree, dumpId, deviceId, emptyWarning);
69
+ return handleFullDump(tree, dumpId, deviceId, emptyWarning, coordMeta);
48
70
  }
49
- function handleCompactDump(tree, input, dumpId, deviceId, emptyWarning) {
71
+ function handleCompactDump(tree, input, dumpId, deviceId, emptyWarning, coordMeta) {
50
72
  const flat = flattenTree(tree);
51
73
  const interactive = flat.filter((n) => n.clickable || n.focusable);
52
74
  const limit = input.limit ?? 20;
@@ -76,11 +98,12 @@ function handleCompactDump(tree, input, dumpId, deviceId, emptyWarning) {
76
98
  offset,
77
99
  limit,
78
100
  deviceId,
101
+ ...coordMeta,
79
102
  hint,
80
103
  warning: emptyWarning || noInteractiveWarning,
81
104
  };
82
105
  }
83
- function handleFullDump(tree, dumpId, deviceId, emptyWarning) {
106
+ function handleFullDump(tree, dumpId, deviceId, emptyWarning, coordMeta) {
84
107
  const simplifyNode = (node) => ({
85
108
  className: node.className.split(".").pop(),
86
109
  text: node.text || undefined,
@@ -93,6 +116,7 @@ function handleFullDump(tree, dumpId, deviceId, emptyWarning) {
93
116
  dumpId,
94
117
  tree: tree.map((n) => simplifyNode(n)),
95
118
  deviceId,
119
+ ...coordMeta,
96
120
  warning: emptyWarning,
97
121
  };
98
122
  }
@@ -103,38 +127,7 @@ async function handleAccessibilityCheck(_input, context, _config, deviceId) {
103
127
  export const uiQueryToolDefinition = {
104
128
  name: "ui-query",
105
129
  description: "Query app UI. Accessibility-first.",
106
- inputSchema: {
107
- type: "object",
108
- properties: {
109
- operation: {
110
- type: "string",
111
- enum: ["dump", "find", "accessibility-check"],
112
- },
113
- selector: {
114
- type: "object",
115
- properties: {
116
- resourceId: { type: "string" },
117
- text: { type: "string" },
118
- textContains: { type: "string" },
119
- className: { type: "string" },
120
- nearestTo: { type: "string", description: "Find elements nearest to this text (spatial proximity)" },
121
- },
122
- },
123
- debug: { type: "boolean" },
124
- maxTier: {
125
- type: "number",
126
- minimum: 1,
127
- maximum: 5,
128
- description: "Max fallback tier (1-5). Use 3 to stop before visual/grid payloads.",
129
- },
130
- gridCell: { type: "number", minimum: 1, maximum: 24 },
131
- gridPosition: { type: "number", minimum: 1, maximum: 5 },
132
- compact: { type: "boolean", description: "Paginated flat list (default: true). false for full tree." },
133
- limit: { type: "number", minimum: 1, maximum: 100, description: "Default: 20" },
134
- offset: { type: "number", minimum: 0 },
135
- },
136
- required: ["operation"],
137
- },
130
+ inputSchema: toMcpJsonSchema(uiQueryInputSchema),
138
131
  annotations: {
139
132
  readOnlyHint: true,
140
133
  destructiveHint: false,
@@ -15,6 +15,7 @@ export declare const ErrorCode: {
15
15
  readonly INPUT_VALIDATION_FAILED: "INPUT_VALIDATION_FAILED";
16
16
  readonly INVALID_OPERATION: "INVALID_OPERATION";
17
17
  readonly ELEMENT_NOT_FOUND: "ELEMENT_NOT_FOUND";
18
+ readonly AMBIGUOUS_MATCH: "AMBIGUOUS_MATCH";
18
19
  readonly COMMAND_BLOCKED: "COMMAND_BLOCKED";
19
20
  readonly TIMEOUT: "TIMEOUT";
20
21
  readonly CACHE_MISS: "CACHE_MISS";
@@ -20,6 +20,7 @@ export const ErrorCode = {
20
20
  INPUT_VALIDATION_FAILED: "INPUT_VALIDATION_FAILED",
21
21
  INVALID_OPERATION: "INVALID_OPERATION",
22
22
  ELEMENT_NOT_FOUND: "ELEMENT_NOT_FOUND",
23
+ AMBIGUOUS_MATCH: "AMBIGUOUS_MATCH",
23
24
  // Safety errors
24
25
  COMMAND_BLOCKED: "COMMAND_BLOCKED",
25
26
  TIMEOUT: "TIMEOUT",
@@ -3,6 +3,17 @@ import { z } from "zod";
3
3
  * Output for ui dump operation (full mode)
4
4
  */
5
5
  export declare const UiDumpFullOutput: z.ZodObject<{
6
+ warning: z.ZodOptional<z.ZodString>;
7
+ coordinateSpace: z.ZodLiteral<"device">;
8
+ scaleFactor: z.ZodNumber;
9
+ deviceDimensions: z.ZodOptional<z.ZodObject<{
10
+ width: z.ZodNumber;
11
+ height: z.ZodNumber;
12
+ }, z.core.$strip>>;
13
+ imageDimensions: z.ZodOptional<z.ZodObject<{
14
+ width: z.ZodNumber;
15
+ height: z.ZodNumber;
16
+ }, z.core.$strip>>;
6
17
  dumpId: z.ZodString;
7
18
  tree: z.ZodArray<z.ZodType<{
8
19
  className?: string;
@@ -20,12 +31,23 @@ export declare const UiDumpFullOutput: z.ZodObject<{
20
31
  children?: unknown[];
21
32
  }, unknown>>>;
22
33
  deviceId: z.ZodString;
23
- warning: z.ZodOptional<z.ZodString>;
24
34
  }, z.core.$strip>;
25
35
  /**
26
36
  * Output for ui dump operation (compact mode)
27
37
  */
28
38
  export declare const UiDumpCompactOutput: z.ZodObject<{
39
+ hint: z.ZodOptional<z.ZodString>;
40
+ warning: z.ZodOptional<z.ZodString>;
41
+ coordinateSpace: z.ZodLiteral<"device">;
42
+ scaleFactor: z.ZodNumber;
43
+ deviceDimensions: z.ZodOptional<z.ZodObject<{
44
+ width: z.ZodNumber;
45
+ height: z.ZodNumber;
46
+ }, z.core.$strip>>;
47
+ imageDimensions: z.ZodOptional<z.ZodObject<{
48
+ width: z.ZodNumber;
49
+ height: z.ZodNumber;
50
+ }, z.core.$strip>>;
29
51
  dumpId: z.ZodString;
30
52
  elements: z.ZodArray<z.ZodObject<{
31
53
  text: z.ZodOptional<z.ZodString>;
@@ -40,8 +62,6 @@ export declare const UiDumpCompactOutput: z.ZodObject<{
40
62
  offset: z.ZodNumber;
41
63
  limit: z.ZodNumber;
42
64
  deviceId: z.ZodString;
43
- hint: z.ZodOptional<z.ZodString>;
44
- warning: z.ZodOptional<z.ZodString>;
45
65
  }, z.core.$strip>;
46
66
  /**
47
67
  * Output for ui find operation
@@ -136,6 +156,13 @@ export declare const UiTapOutput: z.ZodObject<{
136
156
  deviceSpace: z.ZodBoolean;
137
157
  }, z.core.$strip>;
138
158
  deviceId: z.ZodString;
159
+ matchedSelector: z.ZodOptional<z.ZodObject<{
160
+ resourceId: z.ZodOptional<z.ZodString>;
161
+ text: z.ZodOptional<z.ZodString>;
162
+ textContains: z.ZodOptional<z.ZodString>;
163
+ className: z.ZodOptional<z.ZodString>;
164
+ nearestTo: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>>;
139
166
  }, z.core.$strip>;
140
167
  /**
141
168
  * Output for ui input operation
@@ -143,6 +170,13 @@ export declare const UiTapOutput: z.ZodObject<{
143
170
  export declare const UiInputOutput: z.ZodObject<{
144
171
  input: z.ZodString;
145
172
  deviceId: z.ZodString;
173
+ matchedSelector: z.ZodOptional<z.ZodObject<{
174
+ resourceId: z.ZodOptional<z.ZodString>;
175
+ text: z.ZodOptional<z.ZodString>;
176
+ textContains: z.ZodOptional<z.ZodString>;
177
+ className: z.ZodOptional<z.ZodString>;
178
+ nearestTo: z.ZodOptional<z.ZodString>;
179
+ }, z.core.$strip>>;
146
180
  }, z.core.$strip>;
147
181
  /**
148
182
  * Output for ui scroll operation
@@ -156,8 +190,17 @@ export declare const UiScrollOutput: z.ZodObject<{
156
190
  right: "right";
157
191
  }>;
158
192
  amount: z.ZodNumber;
193
+ container: z.ZodOptional<z.ZodString>;
159
194
  }, z.core.$strip>;
160
195
  deviceId: z.ZodString;
196
+ matchedSelector: z.ZodOptional<z.ZodObject<{
197
+ resourceId: z.ZodOptional<z.ZodString>;
198
+ text: z.ZodOptional<z.ZodString>;
199
+ textContains: z.ZodOptional<z.ZodString>;
200
+ className: z.ZodOptional<z.ZodString>;
201
+ nearestTo: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$strip>>;
203
+ warning: z.ZodOptional<z.ZodString>;
161
204
  }, z.core.$strip>;
162
205
  /**
163
206
  * Output for ui screenshot operation (passthrough from adapter)
@@ -196,6 +239,17 @@ export declare const UiVisualSnapshotOutput: z.ZodObject<{
196
239
  * Union of all ui tool outputs
197
240
  */
198
241
  export declare const UiOutput: z.ZodUnion<readonly [z.ZodObject<{
242
+ warning: z.ZodOptional<z.ZodString>;
243
+ coordinateSpace: z.ZodLiteral<"device">;
244
+ scaleFactor: z.ZodNumber;
245
+ deviceDimensions: z.ZodOptional<z.ZodObject<{
246
+ width: z.ZodNumber;
247
+ height: z.ZodNumber;
248
+ }, z.core.$strip>>;
249
+ imageDimensions: z.ZodOptional<z.ZodObject<{
250
+ width: z.ZodNumber;
251
+ height: z.ZodNumber;
252
+ }, z.core.$strip>>;
199
253
  dumpId: z.ZodString;
200
254
  tree: z.ZodArray<z.ZodType<{
201
255
  className?: string;
@@ -213,8 +267,19 @@ export declare const UiOutput: z.ZodUnion<readonly [z.ZodObject<{
213
267
  children?: unknown[];
214
268
  }, unknown>>>;
215
269
  deviceId: z.ZodString;
216
- warning: z.ZodOptional<z.ZodString>;
217
270
  }, z.core.$strip>, z.ZodObject<{
271
+ hint: z.ZodOptional<z.ZodString>;
272
+ warning: z.ZodOptional<z.ZodString>;
273
+ coordinateSpace: z.ZodLiteral<"device">;
274
+ scaleFactor: z.ZodNumber;
275
+ deviceDimensions: z.ZodOptional<z.ZodObject<{
276
+ width: z.ZodNumber;
277
+ height: z.ZodNumber;
278
+ }, z.core.$strip>>;
279
+ imageDimensions: z.ZodOptional<z.ZodObject<{
280
+ width: z.ZodNumber;
281
+ height: z.ZodNumber;
282
+ }, z.core.$strip>>;
218
283
  dumpId: z.ZodString;
219
284
  elements: z.ZodArray<z.ZodObject<{
220
285
  text: z.ZodOptional<z.ZodString>;
@@ -229,8 +294,6 @@ export declare const UiOutput: z.ZodUnion<readonly [z.ZodObject<{
229
294
  offset: z.ZodNumber;
230
295
  limit: z.ZodNumber;
231
296
  deviceId: z.ZodString;
232
- hint: z.ZodOptional<z.ZodString>;
233
- warning: z.ZodOptional<z.ZodString>;
234
297
  }, z.core.$strip>, z.ZodObject<{
235
298
  elements: z.ZodArray<z.ZodObject<{
236
299
  index: z.ZodNumber;
@@ -317,9 +380,23 @@ export declare const UiOutput: z.ZodUnion<readonly [z.ZodObject<{
317
380
  deviceSpace: z.ZodBoolean;
318
381
  }, z.core.$strip>;
319
382
  deviceId: z.ZodString;
383
+ matchedSelector: z.ZodOptional<z.ZodObject<{
384
+ resourceId: z.ZodOptional<z.ZodString>;
385
+ text: z.ZodOptional<z.ZodString>;
386
+ textContains: z.ZodOptional<z.ZodString>;
387
+ className: z.ZodOptional<z.ZodString>;
388
+ nearestTo: z.ZodOptional<z.ZodString>;
389
+ }, z.core.$strip>>;
320
390
  }, z.core.$strip>, z.ZodObject<{
321
391
  input: z.ZodString;
322
392
  deviceId: z.ZodString;
393
+ matchedSelector: z.ZodOptional<z.ZodObject<{
394
+ resourceId: z.ZodOptional<z.ZodString>;
395
+ text: z.ZodOptional<z.ZodString>;
396
+ textContains: z.ZodOptional<z.ZodString>;
397
+ className: z.ZodOptional<z.ZodString>;
398
+ nearestTo: z.ZodOptional<z.ZodString>;
399
+ }, z.core.$strip>>;
323
400
  }, z.core.$strip>, z.ZodObject<{
324
401
  scrolled: z.ZodObject<{
325
402
  direction: z.ZodEnum<{
@@ -329,8 +406,17 @@ export declare const UiOutput: z.ZodUnion<readonly [z.ZodObject<{
329
406
  right: "right";
330
407
  }>;
331
408
  amount: z.ZodNumber;
409
+ container: z.ZodOptional<z.ZodString>;
332
410
  }, z.core.$strip>;
333
411
  deviceId: z.ZodString;
412
+ matchedSelector: z.ZodOptional<z.ZodObject<{
413
+ resourceId: z.ZodOptional<z.ZodString>;
414
+ text: z.ZodOptional<z.ZodString>;
415
+ textContains: z.ZodOptional<z.ZodString>;
416
+ className: z.ZodOptional<z.ZodString>;
417
+ nearestTo: z.ZodOptional<z.ZodString>;
418
+ }, z.core.$strip>>;
419
+ warning: z.ZodOptional<z.ZodString>;
334
420
  }, z.core.$strip>, z.ZodObject<{
335
421
  screenshotPath: z.ZodOptional<z.ZodString>;
336
422
  base64: z.ZodOptional<z.ZodString>;
@@ -16,6 +16,12 @@ const SimplifiedNodeSchema = z.lazy(() => z.object({
16
16
  clickable: z.boolean().optional(),
17
17
  children: z.array(SimplifiedNodeSchema).optional(),
18
18
  }));
19
+ const DumpCoordMetaShape = {
20
+ coordinateSpace: z.literal("device"),
21
+ scaleFactor: z.number(),
22
+ deviceDimensions: z.object({ width: z.number(), height: z.number() }).optional(),
23
+ imageDimensions: z.object({ width: z.number(), height: z.number() }).optional(),
24
+ };
19
25
  /**
20
26
  * Output for ui dump operation (full mode)
21
27
  */
@@ -23,6 +29,7 @@ export const UiDumpFullOutput = z.object({
23
29
  dumpId: z.string(),
24
30
  tree: z.array(SimplifiedNodeSchema),
25
31
  deviceId: z.string(),
32
+ ...DumpCoordMetaShape,
26
33
  warning: z.string().optional(),
27
34
  });
28
35
  /**
@@ -47,6 +54,7 @@ export const UiDumpCompactOutput = z.object({
47
54
  offset: z.number(),
48
55
  limit: z.number(),
49
56
  deviceId: z.string(),
57
+ ...DumpCoordMetaShape,
50
58
  hint: z.string().optional(),
51
59
  warning: z.string().optional(),
52
60
  });
@@ -111,6 +119,13 @@ export const UiFindOutput = z.object({
111
119
  hint: z.string().optional(),
112
120
  }).optional(),
113
121
  });
122
+ const SelectorEcho = z.object({
123
+ resourceId: z.string().optional(),
124
+ text: z.string().optional(),
125
+ textContains: z.string().optional(),
126
+ className: z.string().optional(),
127
+ nearestTo: z.string().optional(),
128
+ });
114
129
  /**
115
130
  * Output for ui tap operation
116
131
  */
@@ -121,6 +136,7 @@ export const UiTapOutput = z.object({
121
136
  deviceSpace: z.boolean(),
122
137
  }),
123
138
  deviceId: z.string(),
139
+ matchedSelector: SelectorEcho.optional(),
124
140
  });
125
141
  /**
126
142
  * Output for ui input operation
@@ -128,6 +144,7 @@ export const UiTapOutput = z.object({
128
144
  export const UiInputOutput = z.object({
129
145
  input: z.string(),
130
146
  deviceId: z.string(),
147
+ matchedSelector: SelectorEcho.optional(),
131
148
  });
132
149
  /**
133
150
  * Output for ui scroll operation
@@ -136,8 +153,11 @@ export const UiScrollOutput = z.object({
136
153
  scrolled: z.object({
137
154
  direction: z.enum(["up", "down", "left", "right"]),
138
155
  amount: z.number(),
156
+ container: z.string().optional(),
139
157
  }),
140
158
  deviceId: z.string(),
159
+ matchedSelector: SelectorEcho.optional(),
160
+ warning: z.string().optional(),
141
161
  });
142
162
  /**
143
163
  * Output for ui screenshot operation (passthrough from adapter)