@pyrokine/mcp-chrome 1.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.
Files changed (100) hide show
  1. package/README.md +333 -0
  2. package/dist/anti-detection/behavior.d.ts +58 -0
  3. package/dist/anti-detection/behavior.d.ts.map +1 -0
  4. package/dist/anti-detection/behavior.js +113 -0
  5. package/dist/anti-detection/behavior.js.map +1 -0
  6. package/dist/anti-detection/index.d.ts +6 -0
  7. package/dist/anti-detection/index.d.ts.map +1 -0
  8. package/dist/anti-detection/index.js +6 -0
  9. package/dist/anti-detection/index.js.map +1 -0
  10. package/dist/anti-detection/injection.d.ts +19 -0
  11. package/dist/anti-detection/injection.d.ts.map +1 -0
  12. package/dist/anti-detection/injection.js +270 -0
  13. package/dist/anti-detection/injection.js.map +1 -0
  14. package/dist/cdp/client.d.ts +73 -0
  15. package/dist/cdp/client.d.ts.map +1 -0
  16. package/dist/cdp/client.js +275 -0
  17. package/dist/cdp/client.js.map +1 -0
  18. package/dist/cdp/index.d.ts +6 -0
  19. package/dist/cdp/index.d.ts.map +1 -0
  20. package/dist/cdp/index.js +6 -0
  21. package/dist/cdp/index.js.map +1 -0
  22. package/dist/cdp/launcher.d.ts +42 -0
  23. package/dist/cdp/launcher.d.ts.map +1 -0
  24. package/dist/cdp/launcher.js +181 -0
  25. package/dist/cdp/launcher.js.map +1 -0
  26. package/dist/core/auto-wait.d.ts +71 -0
  27. package/dist/core/auto-wait.d.ts.map +1 -0
  28. package/dist/core/auto-wait.js +165 -0
  29. package/dist/core/auto-wait.js.map +1 -0
  30. package/dist/core/errors.d.ts +123 -0
  31. package/dist/core/errors.d.ts.map +1 -0
  32. package/dist/core/errors.js +226 -0
  33. package/dist/core/errors.js.map +1 -0
  34. package/dist/core/index.d.ts +10 -0
  35. package/dist/core/index.d.ts.map +1 -0
  36. package/dist/core/index.js +10 -0
  37. package/dist/core/index.js.map +1 -0
  38. package/dist/core/locator.d.ts +130 -0
  39. package/dist/core/locator.d.ts.map +1 -0
  40. package/dist/core/locator.js +402 -0
  41. package/dist/core/locator.js.map +1 -0
  42. package/dist/core/retry.d.ts +27 -0
  43. package/dist/core/retry.d.ts.map +1 -0
  44. package/dist/core/retry.js +51 -0
  45. package/dist/core/retry.js.map +1 -0
  46. package/dist/core/session.d.ts +254 -0
  47. package/dist/core/session.d.ts.map +1 -0
  48. package/dist/core/session.js +893 -0
  49. package/dist/core/session.js.map +1 -0
  50. package/dist/core/types.d.ts +263 -0
  51. package/dist/core/types.d.ts.map +1 -0
  52. package/dist/core/types.js +90 -0
  53. package/dist/core/types.js.map +1 -0
  54. package/dist/index.d.ts +14 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +121 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/tools/browse.d.ts +92 -0
  59. package/dist/tools/browse.d.ts.map +1 -0
  60. package/dist/tools/browse.js +368 -0
  61. package/dist/tools/browse.js.map +1 -0
  62. package/dist/tools/cookies.d.ts +75 -0
  63. package/dist/tools/cookies.d.ts.map +1 -0
  64. package/dist/tools/cookies.js +230 -0
  65. package/dist/tools/cookies.js.map +1 -0
  66. package/dist/tools/evaluate.d.ts +45 -0
  67. package/dist/tools/evaluate.d.ts.map +1 -0
  68. package/dist/tools/evaluate.js +85 -0
  69. package/dist/tools/evaluate.js.map +1 -0
  70. package/dist/tools/extract.d.ts +213 -0
  71. package/dist/tools/extract.d.ts.map +1 -0
  72. package/dist/tools/extract.js +304 -0
  73. package/dist/tools/extract.js.map +1 -0
  74. package/dist/tools/index.d.ts +13 -0
  75. package/dist/tools/index.d.ts.map +1 -0
  76. package/dist/tools/index.js +13 -0
  77. package/dist/tools/index.js.map +1 -0
  78. package/dist/tools/input.d.ts +241 -0
  79. package/dist/tools/input.d.ts.map +1 -0
  80. package/dist/tools/input.js +325 -0
  81. package/dist/tools/input.js.map +1 -0
  82. package/dist/tools/logs.d.ts +57 -0
  83. package/dist/tools/logs.d.ts.map +1 -0
  84. package/dist/tools/logs.js +165 -0
  85. package/dist/tools/logs.js.map +1 -0
  86. package/dist/tools/manage.d.ts +65 -0
  87. package/dist/tools/manage.d.ts.map +1 -0
  88. package/dist/tools/manage.js +270 -0
  89. package/dist/tools/manage.js.map +1 -0
  90. package/dist/tools/schema.d.ts +261 -0
  91. package/dist/tools/schema.d.ts.map +1 -0
  92. package/dist/tools/schema.js +151 -0
  93. package/dist/tools/schema.js.map +1 -0
  94. package/dist/tools/wait.d.ts +203 -0
  95. package/dist/tools/wait.d.ts.map +1 -0
  96. package/dist/tools/wait.js +254 -0
  97. package/dist/tools/wait.js.map +1 -0
  98. package/package.json +43 -0
  99. package/scripts/start-chrome-headless.sh +37 -0
  100. package/scripts/start-chrome.sh +41 -0
@@ -0,0 +1,261 @@
1
+ /**
2
+ * 公共 JSON Schema 定义
3
+ *
4
+ * 用于 MCP 工具的 inputSchema,确保客户端侧的类型提示和契约校验
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * Target Zod Schema(运行时校验)
9
+ *
10
+ * 支持的定位方式:
11
+ * - role/name: 可访问性树定位
12
+ * - text: 文本内容定位
13
+ * - label: 表单 label 定位
14
+ * - placeholder: 输入框占位符定位
15
+ * - title: title 属性定位
16
+ * - alt: alt 属性定位
17
+ * - testId: data-testid 定位
18
+ * - css: CSS 选择器定位
19
+ * - xpath: XPath 定位
20
+ * - x/y: 坐标定位
21
+ */
22
+ export declare const targetZodSchema: z.ZodUnion<[z.ZodObject<{
23
+ role: z.ZodString;
24
+ name: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ role: string;
27
+ name?: string | undefined;
28
+ }, {
29
+ role: string;
30
+ name?: string | undefined;
31
+ }>, z.ZodObject<{
32
+ text: z.ZodString;
33
+ exact: z.ZodOptional<z.ZodBoolean>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ text: string;
36
+ exact?: boolean | undefined;
37
+ }, {
38
+ text: string;
39
+ exact?: boolean | undefined;
40
+ }>, z.ZodObject<{
41
+ label: z.ZodString;
42
+ exact: z.ZodOptional<z.ZodBoolean>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ label: string;
45
+ exact?: boolean | undefined;
46
+ }, {
47
+ label: string;
48
+ exact?: boolean | undefined;
49
+ }>, z.ZodObject<{
50
+ placeholder: z.ZodString;
51
+ exact: z.ZodOptional<z.ZodBoolean>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ placeholder: string;
54
+ exact?: boolean | undefined;
55
+ }, {
56
+ placeholder: string;
57
+ exact?: boolean | undefined;
58
+ }>, z.ZodObject<{
59
+ title: z.ZodString;
60
+ exact: z.ZodOptional<z.ZodBoolean>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ title: string;
63
+ exact?: boolean | undefined;
64
+ }, {
65
+ title: string;
66
+ exact?: boolean | undefined;
67
+ }>, z.ZodObject<{
68
+ alt: z.ZodString;
69
+ exact: z.ZodOptional<z.ZodBoolean>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ alt: string;
72
+ exact?: boolean | undefined;
73
+ }, {
74
+ alt: string;
75
+ exact?: boolean | undefined;
76
+ }>, z.ZodObject<{
77
+ testId: z.ZodString;
78
+ }, "strip", z.ZodTypeAny, {
79
+ testId: string;
80
+ }, {
81
+ testId: string;
82
+ }>, z.ZodObject<{
83
+ css: z.ZodString;
84
+ }, "strip", z.ZodTypeAny, {
85
+ css: string;
86
+ }, {
87
+ css: string;
88
+ }>, z.ZodObject<{
89
+ xpath: z.ZodString;
90
+ }, "strip", z.ZodTypeAny, {
91
+ xpath: string;
92
+ }, {
93
+ xpath: string;
94
+ }>, z.ZodObject<{
95
+ x: z.ZodNumber;
96
+ y: z.ZodNumber;
97
+ }, "strip", z.ZodTypeAny, {
98
+ x: number;
99
+ y: number;
100
+ }, {
101
+ x: number;
102
+ y: number;
103
+ }>]>;
104
+ /**
105
+ * Target JSON Schema(MCP 契约)
106
+ *
107
+ * 使用 oneOf 表示互斥的定位方式,客户端可根据此生成参数提示
108
+ */
109
+ export declare const targetJsonSchema: {
110
+ readonly oneOf: readonly [{
111
+ readonly type: "object";
112
+ readonly title: "可访问性树定位";
113
+ readonly description: "通过 ARIA role 和 name 定位元素";
114
+ readonly properties: {
115
+ readonly role: {
116
+ readonly type: "string";
117
+ readonly description: "ARIA role(如 button、link、textbox)";
118
+ };
119
+ readonly name: {
120
+ readonly type: "string";
121
+ readonly description: "可访问名称(可选)";
122
+ };
123
+ };
124
+ readonly required: readonly ["role"];
125
+ readonly additionalProperties: false;
126
+ }, {
127
+ readonly type: "object";
128
+ readonly title: "文本内容定位";
129
+ readonly description: "通过元素文本内容定位";
130
+ readonly properties: {
131
+ readonly text: {
132
+ readonly type: "string";
133
+ readonly description: "文本内容";
134
+ };
135
+ readonly exact: {
136
+ readonly type: "boolean";
137
+ readonly description: "是否精确匹配(默认 false)";
138
+ };
139
+ };
140
+ readonly required: readonly ["text"];
141
+ readonly additionalProperties: false;
142
+ }, {
143
+ readonly type: "object";
144
+ readonly title: "Label 定位";
145
+ readonly description: "通过表单 label 文本定位关联的输入元素";
146
+ readonly properties: {
147
+ readonly label: {
148
+ readonly type: "string";
149
+ readonly description: "label 文本";
150
+ };
151
+ readonly exact: {
152
+ readonly type: "boolean";
153
+ readonly description: "是否精确匹配(默认 false)";
154
+ };
155
+ };
156
+ readonly required: readonly ["label"];
157
+ readonly additionalProperties: false;
158
+ }, {
159
+ readonly type: "object";
160
+ readonly title: "Placeholder 定位";
161
+ readonly description: "通过输入框的 placeholder 属性定位";
162
+ readonly properties: {
163
+ readonly placeholder: {
164
+ readonly type: "string";
165
+ readonly description: "placeholder 文本";
166
+ };
167
+ readonly exact: {
168
+ readonly type: "boolean";
169
+ readonly description: "是否精确匹配(默认 false)";
170
+ };
171
+ };
172
+ readonly required: readonly ["placeholder"];
173
+ readonly additionalProperties: false;
174
+ }, {
175
+ readonly type: "object";
176
+ readonly title: "Title 属性定位";
177
+ readonly description: "通过元素的 title 属性定位";
178
+ readonly properties: {
179
+ readonly title: {
180
+ readonly type: "string";
181
+ readonly description: "title 属性值";
182
+ };
183
+ readonly exact: {
184
+ readonly type: "boolean";
185
+ readonly description: "是否精确匹配(默认 false)";
186
+ };
187
+ };
188
+ readonly required: readonly ["title"];
189
+ readonly additionalProperties: false;
190
+ }, {
191
+ readonly type: "object";
192
+ readonly title: "Alt 属性定位";
193
+ readonly description: "通过图片的 alt 属性定位";
194
+ readonly properties: {
195
+ readonly alt: {
196
+ readonly type: "string";
197
+ readonly description: "alt 属性值";
198
+ };
199
+ readonly exact: {
200
+ readonly type: "boolean";
201
+ readonly description: "是否精确匹配(默认 false)";
202
+ };
203
+ };
204
+ readonly required: readonly ["alt"];
205
+ readonly additionalProperties: false;
206
+ }, {
207
+ readonly type: "object";
208
+ readonly title: "TestId 定位";
209
+ readonly description: "通过 data-testid 属性定位";
210
+ readonly properties: {
211
+ readonly testId: {
212
+ readonly type: "string";
213
+ readonly description: "data-testid 值";
214
+ };
215
+ };
216
+ readonly required: readonly ["testId"];
217
+ readonly additionalProperties: false;
218
+ }, {
219
+ readonly type: "object";
220
+ readonly title: "CSS 选择器定位";
221
+ readonly description: "通过 CSS 选择器定位";
222
+ readonly properties: {
223
+ readonly css: {
224
+ readonly type: "string";
225
+ readonly description: "CSS 选择器";
226
+ };
227
+ };
228
+ readonly required: readonly ["css"];
229
+ readonly additionalProperties: false;
230
+ }, {
231
+ readonly type: "object";
232
+ readonly title: "XPath 定位";
233
+ readonly description: "通过 XPath 表达式定位";
234
+ readonly properties: {
235
+ readonly xpath: {
236
+ readonly type: "string";
237
+ readonly description: "XPath 表达式";
238
+ };
239
+ };
240
+ readonly required: readonly ["xpath"];
241
+ readonly additionalProperties: false;
242
+ }, {
243
+ readonly type: "object";
244
+ readonly title: "坐标定位";
245
+ readonly description: "通过页面坐标定位";
246
+ readonly properties: {
247
+ readonly x: {
248
+ readonly type: "number";
249
+ readonly description: "X 坐标(像素)";
250
+ };
251
+ readonly y: {
252
+ readonly type: "number";
253
+ readonly description: "Y 坐标(像素)";
254
+ };
255
+ };
256
+ readonly required: readonly ["x", "y"];
257
+ readonly additionalProperties: false;
258
+ }];
259
+ readonly description: "目标元素定位方式";
260
+ };
261
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/tools/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWa,CAAA;AAEzC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GnB,CAAA"}
@@ -0,0 +1,151 @@
1
+ /**
2
+ * 公共 JSON Schema 定义
3
+ *
4
+ * 用于 MCP 工具的 inputSchema,确保客户端侧的类型提示和契约校验
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * Target Zod Schema(运行时校验)
9
+ *
10
+ * 支持的定位方式:
11
+ * - role/name: 可访问性树定位
12
+ * - text: 文本内容定位
13
+ * - label: 表单 label 定位
14
+ * - placeholder: 输入框占位符定位
15
+ * - title: title 属性定位
16
+ * - alt: alt 属性定位
17
+ * - testId: data-testid 定位
18
+ * - css: CSS 选择器定位
19
+ * - xpath: XPath 定位
20
+ * - x/y: 坐标定位
21
+ */
22
+ export const targetZodSchema = z.union([
23
+ z.object({ role: z.string(), name: z.string().optional() }),
24
+ z.object({ text: z.string(), exact: z.boolean().optional() }),
25
+ z.object({ label: z.string(), exact: z.boolean().optional() }),
26
+ z.object({ placeholder: z.string(), exact: z.boolean().optional() }),
27
+ z.object({ title: z.string(), exact: z.boolean().optional() }),
28
+ z.object({ alt: z.string(), exact: z.boolean().optional() }),
29
+ z.object({ testId: z.string() }),
30
+ z.object({ css: z.string() }),
31
+ z.object({ xpath: z.string() }),
32
+ z.object({ x: z.number(), y: z.number() }),
33
+ ]);
34
+ /**
35
+ * Target JSON Schema(MCP 契约)
36
+ *
37
+ * 使用 oneOf 表示互斥的定位方式,客户端可根据此生成参数提示
38
+ */
39
+ export const targetJsonSchema = {
40
+ oneOf: [
41
+ {
42
+ type: 'object',
43
+ title: '可访问性树定位',
44
+ description: '通过 ARIA role 和 name 定位元素',
45
+ properties: {
46
+ role: { type: 'string', description: 'ARIA role(如 button、link、textbox)' },
47
+ name: { type: 'string', description: '可访问名称(可选)' },
48
+ },
49
+ required: ['role'],
50
+ additionalProperties: false,
51
+ },
52
+ {
53
+ type: 'object',
54
+ title: '文本内容定位',
55
+ description: '通过元素文本内容定位',
56
+ properties: {
57
+ text: { type: 'string', description: '文本内容' },
58
+ exact: { type: 'boolean', description: '是否精确匹配(默认 false)' },
59
+ },
60
+ required: ['text'],
61
+ additionalProperties: false,
62
+ },
63
+ {
64
+ type: 'object',
65
+ title: 'Label 定位',
66
+ description: '通过表单 label 文本定位关联的输入元素',
67
+ properties: {
68
+ label: { type: 'string', description: 'label 文本' },
69
+ exact: { type: 'boolean', description: '是否精确匹配(默认 false)' },
70
+ },
71
+ required: ['label'],
72
+ additionalProperties: false,
73
+ },
74
+ {
75
+ type: 'object',
76
+ title: 'Placeholder 定位',
77
+ description: '通过输入框的 placeholder 属性定位',
78
+ properties: {
79
+ placeholder: { type: 'string', description: 'placeholder 文本' },
80
+ exact: { type: 'boolean', description: '是否精确匹配(默认 false)' },
81
+ },
82
+ required: ['placeholder'],
83
+ additionalProperties: false,
84
+ },
85
+ {
86
+ type: 'object',
87
+ title: 'Title 属性定位',
88
+ description: '通过元素的 title 属性定位',
89
+ properties: {
90
+ title: { type: 'string', description: 'title 属性值' },
91
+ exact: { type: 'boolean', description: '是否精确匹配(默认 false)' },
92
+ },
93
+ required: ['title'],
94
+ additionalProperties: false,
95
+ },
96
+ {
97
+ type: 'object',
98
+ title: 'Alt 属性定位',
99
+ description: '通过图片的 alt 属性定位',
100
+ properties: {
101
+ alt: { type: 'string', description: 'alt 属性值' },
102
+ exact: { type: 'boolean', description: '是否精确匹配(默认 false)' },
103
+ },
104
+ required: ['alt'],
105
+ additionalProperties: false,
106
+ },
107
+ {
108
+ type: 'object',
109
+ title: 'TestId 定位',
110
+ description: '通过 data-testid 属性定位',
111
+ properties: {
112
+ testId: { type: 'string', description: 'data-testid 值' },
113
+ },
114
+ required: ['testId'],
115
+ additionalProperties: false,
116
+ },
117
+ {
118
+ type: 'object',
119
+ title: 'CSS 选择器定位',
120
+ description: '通过 CSS 选择器定位',
121
+ properties: {
122
+ css: { type: 'string', description: 'CSS 选择器' },
123
+ },
124
+ required: ['css'],
125
+ additionalProperties: false,
126
+ },
127
+ {
128
+ type: 'object',
129
+ title: 'XPath 定位',
130
+ description: '通过 XPath 表达式定位',
131
+ properties: {
132
+ xpath: { type: 'string', description: 'XPath 表达式' },
133
+ },
134
+ required: ['xpath'],
135
+ additionalProperties: false,
136
+ },
137
+ {
138
+ type: 'object',
139
+ title: '坐标定位',
140
+ description: '通过页面坐标定位',
141
+ properties: {
142
+ x: { type: 'number', description: 'X 坐标(像素)' },
143
+ y: { type: 'number', description: 'Y 坐标(像素)' },
144
+ },
145
+ required: ['x', 'y'],
146
+ additionalProperties: false,
147
+ },
148
+ ],
149
+ description: '目标元素定位方式',
150
+ };
151
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/tools/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB;;;;;;;;;;;;;;GAcG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;gBACR,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAC;aAChD;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;YACjB,oBAAoB,EAAE,KAAK;SAC9B;QACD;YACI,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,gBAAgB;YAC7B,UAAU,EAAE;gBACR,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAC;aACpD;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;YACnB,oBAAoB,EAAE,KAAK;SAC9B;QACD;YACI,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,UAAU;YACvB,UAAU,EAAE;gBACR,CAAC,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAC;gBAC5C,CAAC,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAC;aAC/C;YACD,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;YACpB,oBAAoB,EAAE,KAAK;SAC9B;KACJ;IACD,WAAW,EAAE,UAAU;CACjB,CAAA"}
@@ -0,0 +1,203 @@
1
+ /**
2
+ * wait 工具
3
+ *
4
+ * 等待条件:
5
+ * - element: 等待元素出现/消失/可见/隐藏
6
+ * - navigation: 等待导航完成
7
+ * - time: 固定等待时间
8
+ * - idle: 等待网络空闲
9
+ */
10
+ /**
11
+ * wait 工具定义
12
+ */
13
+ export declare const waitToolDefinition: {
14
+ name: string;
15
+ description: string;
16
+ inputSchema: {
17
+ type: "object";
18
+ properties: {
19
+ for: {
20
+ type: string;
21
+ enum: string[];
22
+ description: string;
23
+ };
24
+ target: {
25
+ description: string;
26
+ oneOf: readonly [{
27
+ readonly type: "object";
28
+ readonly title: "可访问性树定位";
29
+ readonly description: "通过 ARIA role 和 name 定位元素";
30
+ readonly properties: {
31
+ readonly role: {
32
+ readonly type: "string";
33
+ readonly description: "ARIA role(如 button、link、textbox)";
34
+ };
35
+ readonly name: {
36
+ readonly type: "string";
37
+ readonly description: "可访问名称(可选)";
38
+ };
39
+ };
40
+ readonly required: readonly ["role"];
41
+ readonly additionalProperties: false;
42
+ }, {
43
+ readonly type: "object";
44
+ readonly title: "文本内容定位";
45
+ readonly description: "通过元素文本内容定位";
46
+ readonly properties: {
47
+ readonly text: {
48
+ readonly type: "string";
49
+ readonly description: "文本内容";
50
+ };
51
+ readonly exact: {
52
+ readonly type: "boolean";
53
+ readonly description: "是否精确匹配(默认 false)";
54
+ };
55
+ };
56
+ readonly required: readonly ["text"];
57
+ readonly additionalProperties: false;
58
+ }, {
59
+ readonly type: "object";
60
+ readonly title: "Label 定位";
61
+ readonly description: "通过表单 label 文本定位关联的输入元素";
62
+ readonly properties: {
63
+ readonly label: {
64
+ readonly type: "string";
65
+ readonly description: "label 文本";
66
+ };
67
+ readonly exact: {
68
+ readonly type: "boolean";
69
+ readonly description: "是否精确匹配(默认 false)";
70
+ };
71
+ };
72
+ readonly required: readonly ["label"];
73
+ readonly additionalProperties: false;
74
+ }, {
75
+ readonly type: "object";
76
+ readonly title: "Placeholder 定位";
77
+ readonly description: "通过输入框的 placeholder 属性定位";
78
+ readonly properties: {
79
+ readonly placeholder: {
80
+ readonly type: "string";
81
+ readonly description: "placeholder 文本";
82
+ };
83
+ readonly exact: {
84
+ readonly type: "boolean";
85
+ readonly description: "是否精确匹配(默认 false)";
86
+ };
87
+ };
88
+ readonly required: readonly ["placeholder"];
89
+ readonly additionalProperties: false;
90
+ }, {
91
+ readonly type: "object";
92
+ readonly title: "Title 属性定位";
93
+ readonly description: "通过元素的 title 属性定位";
94
+ readonly properties: {
95
+ readonly title: {
96
+ readonly type: "string";
97
+ readonly description: "title 属性值";
98
+ };
99
+ readonly exact: {
100
+ readonly type: "boolean";
101
+ readonly description: "是否精确匹配(默认 false)";
102
+ };
103
+ };
104
+ readonly required: readonly ["title"];
105
+ readonly additionalProperties: false;
106
+ }, {
107
+ readonly type: "object";
108
+ readonly title: "Alt 属性定位";
109
+ readonly description: "通过图片的 alt 属性定位";
110
+ readonly properties: {
111
+ readonly alt: {
112
+ readonly type: "string";
113
+ readonly description: "alt 属性值";
114
+ };
115
+ readonly exact: {
116
+ readonly type: "boolean";
117
+ readonly description: "是否精确匹配(默认 false)";
118
+ };
119
+ };
120
+ readonly required: readonly ["alt"];
121
+ readonly additionalProperties: false;
122
+ }, {
123
+ readonly type: "object";
124
+ readonly title: "TestId 定位";
125
+ readonly description: "通过 data-testid 属性定位";
126
+ readonly properties: {
127
+ readonly testId: {
128
+ readonly type: "string";
129
+ readonly description: "data-testid 值";
130
+ };
131
+ };
132
+ readonly required: readonly ["testId"];
133
+ readonly additionalProperties: false;
134
+ }, {
135
+ readonly type: "object";
136
+ readonly title: "CSS 选择器定位";
137
+ readonly description: "通过 CSS 选择器定位";
138
+ readonly properties: {
139
+ readonly css: {
140
+ readonly type: "string";
141
+ readonly description: "CSS 选择器";
142
+ };
143
+ };
144
+ readonly required: readonly ["css"];
145
+ readonly additionalProperties: false;
146
+ }, {
147
+ readonly type: "object";
148
+ readonly title: "XPath 定位";
149
+ readonly description: "通过 XPath 表达式定位";
150
+ readonly properties: {
151
+ readonly xpath: {
152
+ readonly type: "string";
153
+ readonly description: "XPath 表达式";
154
+ };
155
+ };
156
+ readonly required: readonly ["xpath"];
157
+ readonly additionalProperties: false;
158
+ }, {
159
+ readonly type: "object";
160
+ readonly title: "坐标定位";
161
+ readonly description: "通过页面坐标定位";
162
+ readonly properties: {
163
+ readonly x: {
164
+ readonly type: "number";
165
+ readonly description: "X 坐标(像素)";
166
+ };
167
+ readonly y: {
168
+ readonly type: "number";
169
+ readonly description: "Y 坐标(像素)";
170
+ };
171
+ };
172
+ readonly required: readonly ["x", "y"];
173
+ readonly additionalProperties: false;
174
+ }];
175
+ };
176
+ state: {
177
+ type: string;
178
+ enum: string[];
179
+ description: string;
180
+ };
181
+ ms: {
182
+ type: string;
183
+ description: string;
184
+ };
185
+ timeout: {
186
+ type: string;
187
+ description: string;
188
+ };
189
+ };
190
+ required: string[];
191
+ };
192
+ };
193
+ /**
194
+ * wait 工具处理器
195
+ */
196
+ export declare function handleWait(params: unknown): Promise<{
197
+ content: Array<{
198
+ type: 'text';
199
+ text: string;
200
+ }>;
201
+ isError?: boolean;
202
+ }>;
203
+ //# sourceMappingURL=wait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../src/tools/wait.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B9B,CAAA;AAeD;;GAEG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;IACvD,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CA8HD"}