assistsx-js 0.1.41 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +32 -0
  2. package/dist/index.cjs +7957 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.mts +4231 -0
  5. package/dist/index.d.ts +4231 -30
  6. package/dist/index.global.js +46 -0
  7. package/dist/index.global.js.map +1 -0
  8. package/dist/index.js +7879 -30
  9. package/dist/index.js.map +1 -0
  10. package/package.json +11 -5
  11. package/src/{AssistsXAsync.ts → assistsx-async.ts} +8 -8
  12. package/src/{AssistsX.ts → assistsx.ts} +8 -8
  13. package/src/barutils/bar-utils.ts +3 -3
  14. package/src/filesystem/fileio/file-io.ts +2 -2
  15. package/src/filesystem/fileutils/file-utils.ts +2 -2
  16. package/src/filesystem/path.ts +2 -2
  17. package/src/floatingwindow/float.ts +4 -4
  18. package/src/gallery/gallery.ts +2 -2
  19. package/src/global.d.ts +6 -1
  20. package/src/imageutils/image-utils.ts +2 -2
  21. package/src/ime/ime.ts +2 -2
  22. package/src/index.ts +21 -20
  23. package/src/log/log-call-method.ts +28 -0
  24. package/src/log/log.ts +445 -0
  25. package/src/mlkit/mlkit.ts +3 -3
  26. package/src/network/http.ts +2 -2
  27. package/src/{NodeAsync.ts → node-async.ts} +5 -5
  28. package/src/{Node.ts → node.ts} +5 -5
  29. package/src/{StepAsync.ts → step-async.ts} +8 -8
  30. package/src/{Step.ts → step.ts} +7 -7
  31. package/dist/AccessibilityEventFilter.d.ts +0 -105
  32. package/dist/AccessibilityEventFilter.js +0 -89
  33. package/dist/AppInfo.d.ts +0 -45
  34. package/dist/AppInfo.js +0 -38
  35. package/dist/AssistsX.d.ts +0 -484
  36. package/dist/AssistsX.js +0 -828
  37. package/dist/AssistsXAsync.d.ts +0 -532
  38. package/dist/AssistsXAsync.js +0 -874
  39. package/dist/Bounds.d.ts +0 -48
  40. package/dist/Bounds.js +0 -68
  41. package/dist/CallMethod.d.ts +0 -69
  42. package/dist/CallMethod.js +0 -71
  43. package/dist/CallResponse.d.ts +0 -10
  44. package/dist/CallResponse.js +0 -28
  45. package/dist/DeviceInfo.d.ts +0 -69
  46. package/dist/DeviceInfo.js +0 -50
  47. package/dist/Node.d.ts +0 -334
  48. package/dist/Node.js +0 -369
  49. package/dist/NodeAsync.d.ts +0 -213
  50. package/dist/NodeAsync.js +0 -313
  51. package/dist/NodeClassValue.d.ts +0 -15
  52. package/dist/NodeClassValue.js +0 -15
  53. package/dist/Step.d.ts +0 -355
  54. package/dist/Step.js +0 -689
  55. package/dist/StepAsync.d.ts +0 -162
  56. package/dist/StepAsync.js +0 -264
  57. package/dist/StepError.d.ts +0 -35
  58. package/dist/StepError.js +0 -26
  59. package/dist/StepStateStore.d.ts +0 -14
  60. package/dist/StepStateStore.js +0 -37
  61. package/dist/Utils.d.ts +0 -3
  62. package/dist/Utils.js +0 -20
  63. package/dist/WindowFlags.d.ts +0 -75
  64. package/dist/WindowFlags.js +0 -97
  65. package/dist/barutils/BarUtilsCallMethod.d.ts +0 -24
  66. package/dist/barutils/BarUtilsCallMethod.js +0 -26
  67. package/dist/barutils/bar-utils.d.ts +0 -41
  68. package/dist/barutils/bar-utils.js +0 -205
  69. package/dist/filesystem/fileio/file-io.d.ts +0 -101
  70. package/dist/filesystem/fileio/file-io.js +0 -235
  71. package/dist/filesystem/fileutils/file-utils.d.ts +0 -242
  72. package/dist/filesystem/fileutils/file-utils.js +0 -493
  73. package/dist/filesystem/path.d.ts +0 -252
  74. package/dist/filesystem/path.js +0 -589
  75. package/dist/floatingwindow/FloatCallMethod.d.ts +0 -19
  76. package/dist/floatingwindow/FloatCallMethod.js +0 -18
  77. package/dist/floatingwindow/float.d.ts +0 -29
  78. package/dist/floatingwindow/float.js +0 -149
  79. package/dist/gallery/gallery.d.ts +0 -60
  80. package/dist/gallery/gallery.js +0 -142
  81. package/dist/imageutils/image-utils.d.ts +0 -442
  82. package/dist/imageutils/image-utils.js +0 -543
  83. package/dist/ime/ime.d.ts +0 -80
  84. package/dist/ime/ime.js +0 -141
  85. package/dist/mlkit/MlkitCallMethod.d.ts +0 -27
  86. package/dist/mlkit/MlkitCallMethod.js +0 -26
  87. package/dist/mlkit/mlkit.d.ts +0 -86
  88. package/dist/mlkit/mlkit.js +0 -169
  89. package/dist/network/http.d.ts +0 -127
  90. package/dist/network/http.js +0 -202
  91. /package/src/{AccessibilityEventFilter.ts → accessibility-event-filter.ts} +0 -0
  92. /package/src/{AppInfo.ts → app-info.ts} +0 -0
  93. /package/src/barutils/{BarUtilsCallMethod.ts → bar-utils-call-method.ts} +0 -0
  94. /package/src/{Bounds.ts → bounds.ts} +0 -0
  95. /package/src/{CallMethod.ts → call-method.ts} +0 -0
  96. /package/src/{CallResponse.ts → call-response.ts} +0 -0
  97. /package/src/{DeviceInfo.ts → device-info.ts} +0 -0
  98. /package/src/floatingwindow/{FloatCallMethod.ts → float-call-method.ts} +0 -0
  99. /package/src/mlkit/{MlkitCallMethod.ts → mlkit-call-method.ts} +0 -0
  100. /package/src/{NodeClassValue.ts → node-class-value.ts} +0 -0
  101. /package/src/{StepError.ts → step-error.ts} +0 -0
  102. /package/src/{StepStateStore.ts → step-state-store.ts} +0 -0
  103. /package/src/{Utils.ts → utils.ts} +0 -0
  104. /package/src/{WindowFlags.ts → window-flags.ts} +0 -0
@@ -0,0 +1,4231 @@
1
+ import * as pinia from 'pinia';
2
+
3
+ declare class Bounds {
4
+ readonly left: number;
5
+ readonly top: number;
6
+ readonly right: number;
7
+ readonly bottom: number;
8
+ readonly width: number;
9
+ readonly height: number;
10
+ readonly centerX: number;
11
+ readonly centerY: number;
12
+ readonly exactCenterX: number;
13
+ readonly exactCenterY: number;
14
+ readonly isEmpty: boolean;
15
+ constructor(left: number, top: number, right: number, bottom: number, width: number, height: number, centerX: number, centerY: number, exactCenterX: number, exactCenterY: number, isEmpty: boolean);
16
+ /**
17
+ * 判断该 Bounds 是否在屏幕内(满足基本几何有效性)
18
+ * @returns {boolean}
19
+ */
20
+ isInScreen(): boolean;
21
+ static from(data: {
22
+ left: number;
23
+ top: number;
24
+ right: number;
25
+ bottom: number;
26
+ width: number;
27
+ height: number;
28
+ centerX: number;
29
+ centerY: number;
30
+ exactCenterX: number;
31
+ exactCenterY: number;
32
+ isEmpty: boolean;
33
+ }): Bounds;
34
+ static fromJSON(json: string): Bounds;
35
+ static fromData(data: any): Bounds;
36
+ toJSON(): {
37
+ left: number;
38
+ top: number;
39
+ right: number;
40
+ bottom: number;
41
+ width: number;
42
+ height: number;
43
+ centerX: number;
44
+ centerY: number;
45
+ exactCenterX: number;
46
+ exactCenterY: number;
47
+ isEmpty: boolean;
48
+ };
49
+ clone(): Bounds;
50
+ }
51
+
52
+ /**
53
+ * 节点类
54
+ * 表示界面上的一个可交互元素,包含元素的属性和可执行的操作
55
+ */
56
+
57
+ declare class NodeAsync {
58
+ private node;
59
+ /**
60
+ * 构造函数
61
+ * @param node Node实例
62
+ */
63
+ constructor(node: Node);
64
+ /**
65
+ * 查找第一个匹配标签的父节点
66
+ * @param className 类名
67
+ * @returns 父节点
68
+ */
69
+ findFirstParentByTags(className: string): Promise<Node>;
70
+ /**
71
+ * 对节点执行点击手势
72
+ * @param offsetX X轴偏移
73
+ * @param offsetY Y轴偏移
74
+ * @param switchWindowIntervalDelay 窗口切换延迟
75
+ * @param clickDuration 点击持续时间
76
+ * @returns 是否点击成功
77
+ */
78
+ clickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration, }?: {
79
+ offsetX?: number;
80
+ offsetY?: number;
81
+ switchWindowIntervalDelay?: number;
82
+ clickDuration?: number;
83
+ }): Promise<boolean>;
84
+ /**
85
+ * 对节点执行双击手势
86
+ * @param offsetX X轴偏移
87
+ * @param offsetY Y轴偏移
88
+ * @param switchWindowIntervalDelay 窗口切换延迟
89
+ * @param clickDuration 点击持续时间
90
+ * @param clickInterval 点击间隔
91
+ * @returns 是否双击成功
92
+ */
93
+ doubleClickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, }?: {
94
+ offsetX?: number;
95
+ offsetY?: number;
96
+ switchWindowIntervalDelay?: number;
97
+ clickDuration?: number;
98
+ clickInterval?: number;
99
+ }): Promise<boolean>;
100
+ longPressNodeByGestureAutoPaste(text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
101
+ matchedPackageName?: string;
102
+ matchedText?: string;
103
+ timeoutMillis?: number;
104
+ longPressDuration?: number;
105
+ }): Promise<boolean>;
106
+ /**
107
+ * 在当前节点范围内通过标签查找节点
108
+ * @param className 类名
109
+ * @param filterText 文本过滤
110
+ * @param filterViewId 视图ID过滤
111
+ * @param filterDes 描述过滤
112
+ * @returns 节点数组
113
+ */
114
+ findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
115
+ filterText?: string;
116
+ filterViewId?: string;
117
+ filterDes?: string;
118
+ }): Promise<Node[]>;
119
+ /**
120
+ * 在当前节点范围内通过ID查找节点
121
+ * @param id 节点ID
122
+ * @param filterClass 类名过滤
123
+ * @param filterText 文本过滤
124
+ * @param filterDes 描述过滤
125
+ * @returns 节点数组
126
+ */
127
+ findById(id: string, { filterClass, filterText, filterDes, }?: {
128
+ filterClass?: string;
129
+ filterText?: string;
130
+ filterDes?: string;
131
+ }): Promise<Node[]>;
132
+ /**
133
+ * 在当前节点范围内通过文本查找节点
134
+ * @param text 要查找的文本
135
+ * @param filterClass 类名过滤
136
+ * @param filterViewId 视图ID过滤
137
+ * @param filterDes 描述过滤
138
+ * @returns 节点数组
139
+ */
140
+ findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
141
+ filterClass?: string;
142
+ filterViewId?: string;
143
+ filterDes?: string;
144
+ }): Promise<Node[]>;
145
+ /**
146
+ * 向前滚动节点
147
+ * @returns 是否滚动成功
148
+ */
149
+ scrollForward(): Promise<boolean>;
150
+ /**
151
+ * 向后滚动节点
152
+ * @returns 是否滚动成功
153
+ */
154
+ scrollBackward(): Promise<boolean>;
155
+ /**
156
+ * 检查节点是否可见
157
+ * @param compareNode 比较节点
158
+ * @param isFullyByCompareNode 是否完全可见
159
+ * @returns 是否可见
160
+ */
161
+ isVisible({ compareNode, isFullyByCompareNode, }?: {
162
+ compareNode?: Node;
163
+ isFullyByCompareNode?: boolean;
164
+ }): Promise<boolean>;
165
+ /**
166
+ * 对节点进行截图
167
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
168
+ * @returns 截图路径
169
+ */
170
+ takeScreenshot(overlayHiddenScreenshotDelayMillis?: number): Promise<string>;
171
+ /**
172
+ * 设置节点文本
173
+ * @param text 要设置的文本
174
+ * @returns 是否设置成功
175
+ */
176
+ setNodeText(text: string): Promise<boolean>;
177
+ paste(text: string): Promise<boolean>;
178
+ focus(): Promise<boolean>;
179
+ /**
180
+ * 点击节点
181
+ * @returns 是否点击成功
182
+ */
183
+ click(): Promise<boolean>;
184
+ /**
185
+ * 长按节点
186
+ * @returns 是否长按成功
187
+ */
188
+ longClick(): Promise<boolean>;
189
+ /**
190
+ * 查找第一个可点击的父节点
191
+ * @returns 可点击的父节点
192
+ */
193
+ findFirstParentClickable(): Promise<Node>;
194
+ /**
195
+ * 获取节点在屏幕中的边界
196
+ * @returns 边界对象
197
+ */
198
+ getBoundsInScreen(): Promise<Bounds>;
199
+ /**
200
+ * 获取节点的所有子节点
201
+ * @returns 子节点数组
202
+ */
203
+ getNodes(): Promise<Node[]>;
204
+ /**
205
+ * 获取节点的直接子节点
206
+ * @returns 子节点数组
207
+ */
208
+ getChildren(): Promise<Node[]>;
209
+ /**
210
+ * 从JSON字符串创建节点实例
211
+ * @param json JSON字符串
212
+ * @returns 节点实例
213
+ */
214
+ static fromJSON(json: string): Node;
215
+ /**
216
+ * 从普通对象创建节点实例
217
+ * @param data 对象数据
218
+ * @returns 节点实例
219
+ */
220
+ static from(data: any): Node;
221
+ /**
222
+ * JSON.parse的reviver函数,用于将解析的JSON对象转换为Node实例
223
+ * @param key 属性键
224
+ * @param value 属性值
225
+ * @returns 转换后的值
226
+ */
227
+ static reviver(key: string, value: any): any;
228
+ /**
229
+ * 创建新的节点实例
230
+ * @param params 节点参数对象
231
+ * @returns 节点实例
232
+ */
233
+ static create(params: {
234
+ nodeId: string;
235
+ text: string;
236
+ des: string;
237
+ viewId: string;
238
+ className: string;
239
+ isScrollable: boolean;
240
+ isClickable: boolean;
241
+ isEnabled: boolean;
242
+ stepId: string | undefined;
243
+ hintText: string;
244
+ isCheckable: boolean;
245
+ isChecked: boolean;
246
+ isFocusable: boolean;
247
+ isFocused: boolean;
248
+ isLongClickable: boolean;
249
+ isPassword: boolean;
250
+ isSelected: boolean;
251
+ isVisibleToUser: boolean;
252
+ drawingOrder: number;
253
+ bounds?: Bounds;
254
+ /** @deprecated 请使用 bounds 替代 */
255
+ boundsInScreen?: Bounds;
256
+ }): Node;
257
+ /**
258
+ * 从JSON数组创建节点数组
259
+ * @param array JSON数组
260
+ * @returns 节点数组
261
+ */
262
+ static fromJSONArray(array: Array<any>): Node[];
263
+ }
264
+
265
+ /**
266
+ * 节点类
267
+ * 表示界面上的一个可交互元素,包含元素的属性和可执行的操作
268
+ */
269
+
270
+ declare class Node {
271
+ /**
272
+ * 节点唯一标识
273
+ */
274
+ nodeId: string;
275
+ /**
276
+ * 节点文本内容
277
+ */
278
+ text: string;
279
+ /**
280
+ * 节点描述信息
281
+ */
282
+ des: string;
283
+ /**
284
+ * 节点视图ID
285
+ */
286
+ viewId: string;
287
+ /**
288
+ * 节点类名
289
+ */
290
+ className: string;
291
+ /**
292
+ * 是否可滚动
293
+ */
294
+ isScrollable: boolean;
295
+ /**
296
+ * 是否可点击
297
+ */
298
+ isClickable: boolean;
299
+ /**
300
+ * 是否启用
301
+ */
302
+ isEnabled: boolean;
303
+ /**
304
+ * 所属步骤ID
305
+ */
306
+ stepId: string | undefined;
307
+ /**
308
+ * 提示文本
309
+ */
310
+ hintText: string;
311
+ /**
312
+ * 是否可选择
313
+ */
314
+ isCheckable: boolean;
315
+ /**
316
+ * 是否已选中
317
+ */
318
+ isChecked: boolean;
319
+ /**
320
+ * 是否可聚焦
321
+ */
322
+ isFocusable: boolean;
323
+ /**
324
+ * 是否已聚焦
325
+ */
326
+ isFocused: boolean;
327
+ /**
328
+ * 是否可长按
329
+ */
330
+ isLongClickable: boolean;
331
+ /**
332
+ * 是否为密码字段
333
+ */
334
+ isPassword: boolean;
335
+ /**
336
+ * 是否已选中
337
+ */
338
+ isSelected: boolean;
339
+ /**
340
+ * 是否对用户可见
341
+ */
342
+ isVisibleToUser: boolean;
343
+ /**
344
+ * 绘制顺序
345
+ */
346
+ drawingOrder: number;
347
+ /**
348
+ * 节点在屏幕中的边界
349
+ */
350
+ bounds: Bounds;
351
+ /**
352
+ * 节点在屏幕中的边界
353
+ * @deprecated 请使用 bounds 字段替代
354
+ */
355
+ get boundsInScreen(): Bounds;
356
+ /**
357
+ * 构造函数
358
+ * @param params 节点参数对象
359
+ */
360
+ constructor(params: {
361
+ nodeId: string;
362
+ text: string;
363
+ des: string;
364
+ viewId: string;
365
+ className: string;
366
+ isScrollable: boolean;
367
+ isClickable: boolean;
368
+ isEnabled: boolean;
369
+ stepId: string | undefined;
370
+ hintText: string;
371
+ isCheckable: boolean;
372
+ isChecked: boolean;
373
+ isFocusable: boolean;
374
+ isFocused: boolean;
375
+ isLongClickable: boolean;
376
+ isPassword: boolean;
377
+ isSelected: boolean;
378
+ isVisibleToUser: boolean;
379
+ drawingOrder: number;
380
+ /** @deprecated 请使用 bounds 替代 */
381
+ boundsInScreen?: Bounds | any;
382
+ bounds?: Bounds | any;
383
+ });
384
+ get async(): NodeAsync;
385
+ /**
386
+ * 查找第一个匹配标签的父节点
387
+ * @param className 类名
388
+ * @returns 父节点
389
+ */
390
+ findFirstParentByTags(className: string): Node;
391
+ /**
392
+ * 对节点执行点击手势
393
+ * @param offsetX X轴偏移
394
+ * @param offsetY Y轴偏移
395
+ * @param switchWindowIntervalDelay 窗口切换延迟
396
+ * @param clickDuration 点击持续时间
397
+ * @returns 是否点击成功
398
+ */
399
+ clickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration, }?: {
400
+ offsetX?: number;
401
+ offsetY?: number;
402
+ switchWindowIntervalDelay?: number;
403
+ clickDuration?: number;
404
+ }): Promise<boolean>;
405
+ /**
406
+ * 对节点执行双击手势
407
+ * @param offsetX X轴偏移
408
+ * @param offsetY Y轴偏移
409
+ * @param switchWindowIntervalDelay 窗口切换延迟
410
+ * @param clickDuration 点击持续时间
411
+ * @param clickInterval 点击间隔
412
+ * @returns 是否双击成功
413
+ */
414
+ doubleClickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, }?: {
415
+ offsetX?: number;
416
+ offsetY?: number;
417
+ switchWindowIntervalDelay?: number;
418
+ clickDuration?: number;
419
+ clickInterval?: number;
420
+ }): Promise<boolean>;
421
+ longPressNodeByGestureAutoPaste(text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
422
+ matchedPackageName?: string;
423
+ matchedText?: string;
424
+ timeoutMillis?: number;
425
+ longPressDuration?: number;
426
+ }): Promise<boolean>;
427
+ /**
428
+ * 在当前节点范围内通过标签查找节点
429
+ * @param className 类名
430
+ * @param filterText 文本过滤
431
+ * @param filterViewId 视图ID过滤
432
+ * @param filterDes 描述过滤
433
+ * @returns 节点数组
434
+ */
435
+ findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
436
+ filterText?: string;
437
+ filterViewId?: string;
438
+ filterDes?: string;
439
+ }): Node[];
440
+ /**
441
+ * 在当前节点范围内通过ID查找节点
442
+ * @param id 节点ID
443
+ * @param filterClass 类名过滤
444
+ * @param filterText 文本过滤
445
+ * @param filterDes 描述过滤
446
+ * @returns 节点数组
447
+ */
448
+ findById(id: string, { filterClass, filterText, filterDes, }?: {
449
+ filterClass?: string;
450
+ filterText?: string;
451
+ filterDes?: string;
452
+ }): Node[];
453
+ /**
454
+ * 在当前节点范围内通过文本查找节点
455
+ * @param text 要查找的文本
456
+ * @param filterClass 类名过滤
457
+ * @param filterViewId 视图ID过滤
458
+ * @param filterDes 描述过滤
459
+ * @returns 节点数组
460
+ */
461
+ findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
462
+ filterClass?: string;
463
+ filterViewId?: string;
464
+ filterDes?: string;
465
+ }): Node[];
466
+ /**
467
+ * 向前滚动节点
468
+ * @returns 是否滚动成功
469
+ */
470
+ scrollForward(): boolean;
471
+ /**
472
+ * 向后滚动节点
473
+ * @returns 是否滚动成功
474
+ */
475
+ scrollBackward(): boolean;
476
+ /**
477
+ * 检查节点是否可见
478
+ * @param compareNode 比较节点
479
+ * @param isFullyByCompareNode 是否完全可见
480
+ * @returns 是否可见
481
+ */
482
+ isVisible({ compareNode, isFullyByCompareNode, }?: {
483
+ compareNode?: Node;
484
+ isFullyByCompareNode?: boolean;
485
+ }): boolean;
486
+ /**
487
+ * 对节点进行截图
488
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
489
+ * @returns 截图路径
490
+ */
491
+ takeScreenshot(overlayHiddenScreenshotDelayMillis?: number): Promise<string>;
492
+ /**
493
+ * 保存节点截图到文件
494
+ * @param options 截图保存选项
495
+ * @param options.filePath 文件路径(可选,不提供则自动生成)
496
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认为 "PNG"
497
+ * @param options.overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒),默认为 250
498
+ * @returns 保存的文件路径
499
+ */
500
+ takeScreenshotToFile(options?: {
501
+ filePath?: string;
502
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
503
+ overlayHiddenScreenshotDelayMillis?: number;
504
+ }): Promise<string>;
505
+ /**
506
+ * 设置节点文本
507
+ * @param text 要设置的文本
508
+ * @returns 是否设置成功
509
+ */
510
+ setNodeText(text: string): boolean;
511
+ paste(text: string): boolean;
512
+ focus(): boolean;
513
+ /**
514
+ * 点击节点
515
+ * @returns 是否点击成功
516
+ */
517
+ click(): boolean;
518
+ /**
519
+ * 长按节点
520
+ * @returns 是否长按成功
521
+ */
522
+ longClick(): boolean;
523
+ /**
524
+ * 查找第一个可点击的父节点
525
+ * @returns 可点击的父节点
526
+ */
527
+ findFirstParentClickable(): Node;
528
+ /**
529
+ * 获取节点在屏幕中的边界
530
+ * @returns 边界对象
531
+ */
532
+ getBoundsInScreen(): Bounds;
533
+ /**
534
+ * 获取节点的所有子节点
535
+ * @returns 子节点数组
536
+ */
537
+ getNodes(): Node[];
538
+ /**
539
+ * 获取节点的直接子节点
540
+ * @returns 子节点数组
541
+ */
542
+ getChildren(): Node[];
543
+ /**
544
+ * 从JSON字符串创建节点实例
545
+ * @param json JSON字符串
546
+ * @returns 节点实例
547
+ */
548
+ static fromJSON(json: string): Node;
549
+ /**
550
+ * 从普通对象创建节点实例
551
+ * @param data 对象数据
552
+ * @returns 节点实例
553
+ */
554
+ static from(data: any): Node;
555
+ /**
556
+ * JSON.parse的reviver函数,用于将解析的JSON对象转换为Node实例
557
+ * @param key 属性键
558
+ * @param value 属性值
559
+ * @returns 转换后的值
560
+ */
561
+ static reviver(key: string, value: any): any;
562
+ /**
563
+ * 创建新的节点实例
564
+ * @param params 节点参数对象
565
+ * @returns 节点实例
566
+ */
567
+ static create(params: {
568
+ nodeId: string;
569
+ text: string;
570
+ des: string;
571
+ viewId: string;
572
+ className: string;
573
+ isScrollable: boolean;
574
+ isClickable: boolean;
575
+ isEnabled: boolean;
576
+ stepId: string | undefined;
577
+ hintText: string;
578
+ isCheckable: boolean;
579
+ isChecked: boolean;
580
+ isFocusable: boolean;
581
+ isFocused: boolean;
582
+ isLongClickable: boolean;
583
+ isPassword: boolean;
584
+ isSelected: boolean;
585
+ isVisibleToUser: boolean;
586
+ drawingOrder: number;
587
+ bounds?: Bounds;
588
+ /** @deprecated 请使用 bounds 替代 */
589
+ boundsInScreen?: Bounds;
590
+ }): Node;
591
+ /**
592
+ * 从JSON数组创建节点数组
593
+ * @param array JSON数组
594
+ * @returns 节点数组
595
+ */
596
+ static fromJSONArray(array: Array<any>): Node[];
597
+ }
598
+
599
+ declare class CallResponse {
600
+ readonly code: number;
601
+ readonly data: any | null;
602
+ readonly callbackId: string | null;
603
+ constructor(code: number, data: any | null, callbackId: string | null);
604
+ isSuccess(): boolean;
605
+ getData(): any | null;
606
+ getDataOrNull(): any | null;
607
+ getDataOrDefault(defaultValue: any): any;
608
+ }
609
+
610
+ /**
611
+ * AccessibilityEvent过滤配置接口
612
+ * 用于配置AccessibilityEvent的处理方式和过滤条件
613
+ */
614
+ interface AccessibilityEventFilterConfig {
615
+ /**
616
+ * 包名过滤
617
+ * 如果为空或null,则处理所有包的事件
618
+ * 如果指定包名,则只处理该包的事件
619
+ */
620
+ packageName?: string | null;
621
+ /**
622
+ * 是否在子线程中处理AccessibilityEvent
623
+ * true: 在子线程中处理,避免阻塞主线程
624
+ * false: 在主线程中处理
625
+ */
626
+ processInBackground?: boolean;
627
+ /**
628
+ * 是否获取节点信息
629
+ * true: 获取并解析AccessibilityNodeInfo节点信息
630
+ * false: 不获取节点信息,提高处理性能
631
+ */
632
+ fetchNodeInfo?: boolean;
633
+ /**
634
+ * 是否启用日志输出
635
+ * true: 输出AccessibilityEvent处理日志
636
+ * false: 不输出日志
637
+ */
638
+ enableLogging?: boolean;
639
+ /**
640
+ * 事件类型过滤
641
+ * 如果为空,则处理所有类型的事件
642
+ * 如果指定类型,则只处理指定类型的事件
643
+ */
644
+ eventTypes?: number[] | null;
645
+ /**
646
+ * 是否启用事件去重
647
+ * true: 启用去重,避免重复处理相同事件
648
+ * false: 不启用去重
649
+ */
650
+ enableDeduplication?: boolean;
651
+ }
652
+ /**
653
+ * AccessibilityEvent过滤配置类
654
+ * 用于配置AccessibilityEvent的处理方式和过滤条件
655
+ */
656
+ declare class AccessibilityEventFilter {
657
+ /**
658
+ * 包名过滤
659
+ */
660
+ readonly packageName: string | null;
661
+ /**
662
+ * 是否在子线程中处理AccessibilityEvent
663
+ */
664
+ readonly processInBackground: boolean;
665
+ /**
666
+ * 是否获取节点信息
667
+ */
668
+ readonly fetchNodeInfo: boolean;
669
+ /**
670
+ * 是否启用日志输出
671
+ */
672
+ readonly enableLogging: boolean;
673
+ /**
674
+ * 事件类型过滤
675
+ */
676
+ readonly eventTypes?: number[] | null;
677
+ /**
678
+ * 是否启用事件去重
679
+ */
680
+ readonly enableDeduplication: boolean;
681
+ constructor(config?: AccessibilityEventFilterConfig);
682
+ /**
683
+ * 检查是否应该处理指定包的事件
684
+ * @param targetPackageName 目标包名
685
+ * @returns true表示应该处理,false表示应该过滤
686
+ */
687
+ shouldProcessPackage(targetPackageName: string | null): boolean;
688
+ /**
689
+ * 检查是否应该处理指定类型的事件
690
+ * @param eventType 事件类型
691
+ * @returns true表示应该处理,false表示应该过滤
692
+ */
693
+ shouldProcessEventType(eventType: number): boolean;
694
+ /**
695
+ * 创建默认的过滤配置
696
+ * 所有包名,子线程处理,获取节点信息,启用日志
697
+ */
698
+ static createDefault(): AccessibilityEventFilter;
699
+ /**
700
+ * 创建高性能配置
701
+ * 不获取节点信息,不启用日志,启用去重
702
+ */
703
+ static createHighPerformance(): AccessibilityEventFilter;
704
+ /**
705
+ * 创建调试配置
706
+ * 启用所有功能,便于调试
707
+ */
708
+ static createDebug(): AccessibilityEventFilter;
709
+ /**
710
+ * 创建指定包名的过滤配置
711
+ * @param targetPackageName 目标包名
712
+ */
713
+ static createForPackage(targetPackageName: string): AccessibilityEventFilter;
714
+ }
715
+
716
+ /**
717
+ * 应用信息实体类
718
+ */
719
+ declare class AppInfo {
720
+ /**
721
+ * 是否为系统应用
722
+ */
723
+ isSystem: boolean;
724
+ /**
725
+ * 最低SDK版本
726
+ */
727
+ minSdkVersion: number;
728
+ /**
729
+ * 应用名称
730
+ */
731
+ name: string;
732
+ /**
733
+ * 应用包名
734
+ */
735
+ packageName: string;
736
+ /**
737
+ * 目标SDK版本
738
+ */
739
+ targetSdkVersion: number;
740
+ /**
741
+ * 版本号
742
+ */
743
+ versionCode: number;
744
+ /**
745
+ * 版本名称
746
+ */
747
+ versionName: string;
748
+ constructor(isSystem?: boolean, minSdkVersion?: number, name?: string, packageName?: string, targetSdkVersion?: number, versionCode?: number, versionName?: string);
749
+ /**
750
+ * 从JSON对象创建AppInfo实例
751
+ * @param data JSON对象
752
+ * @returns AppInfo实例
753
+ */
754
+ static fromJSON(data: any): AppInfo;
755
+ /**
756
+ * 转换为JSON对象
757
+ * @returns JSON对象
758
+ */
759
+ toJSON(): any;
760
+ }
761
+
762
+ /**
763
+ * 设备信息实体类
764
+ */
765
+ declare class DeviceInfo {
766
+ /**
767
+ * 设备唯一标识
768
+ */
769
+ uniqueDeviceId: string;
770
+ /**
771
+ * Android ID
772
+ */
773
+ androidID: string;
774
+ /**
775
+ * MAC地址
776
+ */
777
+ macAddress: string;
778
+ /**
779
+ * 是否已Root
780
+ */
781
+ isDeviceRooted: boolean;
782
+ /**
783
+ * 制造商
784
+ */
785
+ manufacturer: string;
786
+ /**
787
+ * 设备型号
788
+ */
789
+ model: string;
790
+ /**
791
+ * SDK版本号
792
+ */
793
+ sdkVersionCode: number;
794
+ /**
795
+ * SDK版本名称
796
+ */
797
+ sdkVersionName: string;
798
+ /**
799
+ * ABI列表
800
+ */
801
+ abiList: string[];
802
+ /**
803
+ * 是否启用ADB调试
804
+ */
805
+ isAdbEnabled: boolean;
806
+ /**
807
+ * 是否启用开发者选项
808
+ */
809
+ isDevelopmentSettingsEnabled: boolean;
810
+ /**
811
+ * 是否为模拟器
812
+ */
813
+ isEmulator: boolean;
814
+ /**
815
+ * 是否为平板
816
+ */
817
+ isTablet: boolean;
818
+ constructor(uniqueDeviceId?: string, androidID?: string, macAddress?: string, isDeviceRooted?: boolean, manufacturer?: string, model?: string, sdkVersionCode?: number, sdkVersionName?: string, abiList?: string[], isAdbEnabled?: boolean, isDevelopmentSettingsEnabled?: boolean, isEmulator?: boolean, isTablet?: boolean);
819
+ /**
820
+ * 从JSON对象创建DeviceInfo实例
821
+ * @param data JSON对象
822
+ * @returns DeviceInfo实例
823
+ */
824
+ static fromJSON(data: any): DeviceInfo;
825
+ /**
826
+ * 转换为JSON对象
827
+ * @returns JSON对象
828
+ */
829
+ toJSON(): any;
830
+ }
831
+
832
+ /**
833
+ * AssistsX 类
834
+ * 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
835
+ */
836
+
837
+ /**
838
+ * 无障碍事件数据结构
839
+ */
840
+ interface AccessibilityEventData {
841
+ packageName: string;
842
+ className: string;
843
+ eventType: number;
844
+ action: number;
845
+ texts: string[];
846
+ node: Node | null;
847
+ }
848
+ /**
849
+ * 无障碍事件完整结构
850
+ */
851
+ interface AccessibilityEvent {
852
+ callbackId: string;
853
+ code: number;
854
+ data: AccessibilityEventData;
855
+ message: string;
856
+ }
857
+ /**
858
+ * 无障碍事件监听器类型
859
+ */
860
+ type AccessibilityEventListener = (event: AccessibilityEvent) => void;
861
+ /**
862
+ * Web浮动窗口选项接口定义
863
+ */
864
+ interface WebFloatingWindowOptions {
865
+ initialWidth?: number;
866
+ initialHeight?: number;
867
+ /** Initial window X position (default 0) */
868
+ initialX?: number;
869
+ /** Initial window Y position (default 0) */
870
+ initialY?: number;
871
+ minWidth?: number;
872
+ minHeight?: number;
873
+ maxWidth?: number;
874
+ maxHeight?: number;
875
+ initialCenter?: boolean;
876
+ /** Whether to show top operation area (title bar, close button, etc.) */
877
+ showTopOperationArea?: boolean;
878
+ /** Whether to show bottom operation area (zoom, back/forward/refresh, etc.) */
879
+ showBottomOperationArea?: boolean;
880
+ /** Background color: hex string (e.g. "#ffffff") or Android color int */
881
+ backgroundColor?: string | number;
882
+ }
883
+ declare const callbacks: Map<string, (data: string) => void>;
884
+ declare const accessibilityEventListeners: AccessibilityEventListener[];
885
+ /**
886
+ * 屏幕尺寸类型(width/height 为整型像素值)
887
+ */
888
+ interface Screen {
889
+ width: number;
890
+ height: number;
891
+ }
892
+ /** 全局屏幕尺寸,在 assistsxCallback 初始化后自动加载 */
893
+ declare let screen: Screen | null;
894
+ declare class AssistsX {
895
+ /**
896
+ * 屏幕尺寸(与全局变量 screen 同源)
897
+ * @deprecated 已过时,请使用全局变量 {@link screen}
898
+ */
899
+ static get screenSize(): any;
900
+ /**
901
+ * 执行同步调用
902
+ * @param method 方法名
903
+ * @param args 参数对象
904
+ * @returns 调用响应
905
+ */
906
+ static call(method: string, { args, node }?: {
907
+ args?: any;
908
+ node?: Node;
909
+ }): CallResponse;
910
+ /**
911
+ * 执行异步调用
912
+ * @param method 方法名
913
+ * @param args 参数对象
914
+ * @param timeout 超时时间(秒),默认30秒
915
+ * @returns Promise<调用响应>
916
+ */
917
+ static asyncCall(method: string, { args, node, nodes, timeout, }?: {
918
+ args?: any;
919
+ node?: Node;
920
+ nodes?: Node[];
921
+ timeout?: number;
922
+ }): Promise<CallResponse>;
923
+ /**
924
+ * 设置悬浮窗标志
925
+ * @param flags 标志
926
+ * @returns 是否设置成功
927
+ */
928
+ static setOverlayFlags(flags: number): boolean;
929
+ /**
930
+ * 设置悬浮窗标志
931
+ * @param flags 标志
932
+ * @returns 是否设置成功
933
+ */
934
+ static setOverlayFlagList(flags: number[]): boolean;
935
+ /**
936
+ * 获取所有符合条件的节点
937
+ * @param filterClass 类名过滤
938
+ * @param filterViewId 视图ID过滤
939
+ * @param filterDes 描述过滤
940
+ * @param filterText 文本过滤
941
+ * @returns 节点数组
942
+ */
943
+ static getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
944
+ filterClass?: string;
945
+ filterViewId?: string;
946
+ filterDes?: string;
947
+ filterText?: string;
948
+ }): Node[];
949
+ /**
950
+ * 设置节点文本
951
+ * @param node 目标节点
952
+ * @param text 要设置的文本
953
+ * @returns 是否设置成功
954
+ */
955
+ static setNodeText(node: Node, text: string): boolean;
956
+ /**
957
+ * 获取剪贴板最新文本
958
+ * @returns 剪贴板最新文本
959
+ */
960
+ static getClipboardLatestText(): any;
961
+ /**
962
+ * 获取剪贴板文本内容(异步)
963
+ * @param timeout 超时时间(秒),默认30秒
964
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
965
+ */
966
+ static getClipboardText(timeout?: number): Promise<string>;
967
+ /**
968
+ * 在浏览器中打开URL
969
+ * @param url 要打开的URL
970
+ * @returns 是否成功打开
971
+ */
972
+ static openUrlInBrowser(url: string): boolean;
973
+ /**
974
+ * 保持屏幕常亮
975
+ * @param tip 提示文本
976
+ * @returns 是否保持屏幕常亮成功
977
+ */
978
+ static keepScreenOn(tip?: string): boolean;
979
+ static clearKeepScreenOn(): boolean;
980
+ static isAppInstalled(packageName: string): boolean;
981
+ /**
982
+ * 对指定节点进行截图
983
+ * @param nodes 要截图的节点数组
984
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
985
+ * @param timeout 超时时间(秒),默认30秒
986
+ * @returns 截图路径数组
987
+ */
988
+ static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number, timeout?: number): Promise<string[]>;
989
+ static scanQR(timeout?: number): Promise<string>;
990
+ static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions & {
991
+ timeout?: number;
992
+ }): Promise<any>;
993
+ /**
994
+ * 点击节点
995
+ * @param node 要点击的节点
996
+ * @returns 是否点击成功
997
+ */
998
+ static click(node: Node): boolean;
999
+ /**
1000
+ * 长按节点
1001
+ * @param node 要长按的节点
1002
+ * @returns 是否长按成功
1003
+ */
1004
+ static longClick(node: Node): boolean;
1005
+ /**
1006
+ * 启动应用
1007
+ * @param packageName 应用包名
1008
+ * @returns 是否启动成功
1009
+ */
1010
+ static launchApp(packageName: string): boolean;
1011
+ /**
1012
+ * 获取当前应用包名
1013
+ * @returns 包名
1014
+ */
1015
+ static getPackageName(): string;
1016
+ /**
1017
+ * 显示悬浮提示
1018
+ * @param text 提示文本
1019
+ * @param delay 显示时长(毫秒)
1020
+ * @returns 是否显示成功
1021
+ */
1022
+ static overlayToast(text: string, delay?: number): boolean;
1023
+ /**
1024
+ * 通过ID查找节点
1025
+ * @param id 节点ID
1026
+ * @param filterClass 类名过滤
1027
+ * @param filterText 文本过滤
1028
+ * @param filterDes 描述过滤
1029
+ * @param node 父节点范围
1030
+ * @returns 节点数组
1031
+ */
1032
+ static findById(id: string, { filterClass, filterText, filterDes, node, }?: {
1033
+ filterClass?: string;
1034
+ filterText?: string;
1035
+ filterDes?: string;
1036
+ node?: Node;
1037
+ }): Node[];
1038
+ /**
1039
+ * 通过文本查找节点
1040
+ * @param text 要查找的文本
1041
+ * @param filterClass 类名过滤
1042
+ * @param filterViewId 视图ID过滤
1043
+ * @param filterDes 描述过滤
1044
+ * @param node 父节点范围
1045
+ * @returns 节点数组
1046
+ */
1047
+ static findByText(text: string, { filterClass, filterViewId, filterDes, node, }?: {
1048
+ filterClass?: string;
1049
+ filterViewId?: string;
1050
+ filterDes?: string;
1051
+ node?: Node;
1052
+ }): Node[];
1053
+ /**
1054
+ * 通过标签查找节点
1055
+ * @param className 类名
1056
+ * @param filterText 文本过滤
1057
+ * @param filterViewId 视图ID过滤
1058
+ * @param filterDes 描述过滤
1059
+ * @param node 父节点范围
1060
+ * @returns 节点数组
1061
+ */
1062
+ static findByTags(className: string, { filterText, filterViewId, filterDes, node, }?: {
1063
+ filterText?: string;
1064
+ filterViewId?: string;
1065
+ filterDes?: string;
1066
+ node?: Node;
1067
+ }): Node[];
1068
+ /**
1069
+ * 查找所有匹配文本的节点
1070
+ * @param text 要查找的文本
1071
+ * @returns 节点数组
1072
+ */
1073
+ static findByTextAllMatch(text: string): Node[];
1074
+ /**
1075
+ * 检查是否包含指定文本
1076
+ * @param text 要检查的文本
1077
+ * @returns 是否包含
1078
+ */
1079
+ static containsText(text: string): boolean;
1080
+ /**
1081
+ * 获取所有文本
1082
+ * @returns 文本数组
1083
+ */
1084
+ static getAllText(): string[];
1085
+ /**
1086
+ * 查找第一个匹配标签的父节点
1087
+ * @param className 类名
1088
+ * @returns 父节点
1089
+ */
1090
+ static findFirstParentByTags(node: Node, className: string): Node;
1091
+ /**
1092
+ * 获取节点的所有子节点
1093
+ * @param node 父节点
1094
+ * @returns 子节点数组
1095
+ */
1096
+ static getNodes(node: Node): Node[];
1097
+ /**
1098
+ * 获取节点的直接子节点
1099
+ * @param node 父节点
1100
+ * @returns 子节点数组
1101
+ */
1102
+ static getChildren(node: Node): Node[];
1103
+ /**
1104
+ * 查找第一个可点击的父节点
1105
+ * @param node 起始节点
1106
+ * @returns 可点击的父节点
1107
+ */
1108
+ static findFirstParentClickable(node: Node): Node;
1109
+ /**
1110
+ * 获取节点在屏幕中的边界
1111
+ * @param node 目标节点
1112
+ * @returns 边界对象
1113
+ */
1114
+ static getBoundsInScreen(node: Node): Bounds;
1115
+ /**
1116
+ * 检查节点是否可见
1117
+ * @param node 目标节点
1118
+ * @param compareNode 比较节点
1119
+ * @param isFullyByCompareNode 是否完全可见
1120
+ * @returns 是否可见
1121
+ */
1122
+ static isVisible(node: Node, { compareNode, isFullyByCompareNode, }?: {
1123
+ compareNode?: Node;
1124
+ isFullyByCompareNode?: boolean;
1125
+ }): boolean;
1126
+ /**
1127
+ * 执行点击手势
1128
+ * @param x 横坐标
1129
+ * @param y 纵坐标
1130
+ * @param duration 持续时间
1131
+ * @param timeout 超时时间(秒),默认30秒
1132
+ * @returns 是否成功
1133
+ */
1134
+ static clickByGesture(x: number, y: number, duration: number, timeout?: number): Promise<boolean>;
1135
+ /**
1136
+ * 返回操作
1137
+ * @returns 是否成功
1138
+ */
1139
+ static back(): boolean;
1140
+ /**
1141
+ * 回到主页
1142
+ * @returns 是否成功
1143
+ */
1144
+ static home(): boolean;
1145
+ /**
1146
+ * 打开通知栏
1147
+ * @returns 是否成功
1148
+ */
1149
+ static notifications(): boolean;
1150
+ /**
1151
+ * 显示最近应用
1152
+ * @returns 是否成功
1153
+ */
1154
+ static recentApps(): boolean;
1155
+ /**
1156
+ * 在节点中粘贴文本
1157
+ * @param node 目标节点
1158
+ * @param text 要粘贴的文本
1159
+ * @returns 是否成功
1160
+ */
1161
+ static paste(node: Node, text: string): boolean;
1162
+ static focus(node: Node): boolean;
1163
+ /**
1164
+ * 选择文本
1165
+ * @param node 目标节点
1166
+ * @param selectionStart 选择起始位置
1167
+ * @param selectionEnd 选择结束位置
1168
+ * @returns 是否成功
1169
+ */
1170
+ static selectionText(node: Node, selectionStart: number, selectionEnd: number): boolean;
1171
+ /**
1172
+ * 向前滚动
1173
+ * @param node 可滚动节点
1174
+ * @returns 是否成功
1175
+ */
1176
+ static scrollForward(node: Node): boolean;
1177
+ /**
1178
+ * 向后滚动
1179
+ * @param node 可滚动节点
1180
+ * @returns 是否成功
1181
+ */
1182
+ static scrollBackward(node: Node): boolean;
1183
+ /**
1184
+ * 对节点执行点击手势
1185
+ * @param node 目标节点
1186
+ * @param offsetX X轴偏移
1187
+ * @param offsetY Y轴偏移
1188
+ * @param switchWindowIntervalDelay 窗口切换延迟
1189
+ * @param clickDuration 点击持续时间
1190
+ * @param timeout 超时时间(秒),默认30秒
1191
+ * @returns 是否成功
1192
+ */
1193
+ static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, timeout, }?: {
1194
+ offsetX?: number;
1195
+ offsetY?: number;
1196
+ switchWindowIntervalDelay?: number;
1197
+ clickDuration?: number;
1198
+ timeout?: number;
1199
+ }): Promise<boolean>;
1200
+ /**
1201
+ * 对节点执行双击手势
1202
+ * @param node 目标节点
1203
+ * @param offsetX X轴偏移
1204
+ * @param offsetY Y轴偏移
1205
+ * @param switchWindowIntervalDelay 窗口切换延迟
1206
+ * @param clickDuration 点击持续时间
1207
+ * @param clickInterval 点击间隔
1208
+ * @param timeout 超时时间(秒),默认30秒
1209
+ * @returns 是否成功
1210
+ */
1211
+ static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, timeout, }?: {
1212
+ offsetX?: number;
1213
+ offsetY?: number;
1214
+ switchWindowIntervalDelay?: number;
1215
+ clickDuration?: number;
1216
+ clickInterval?: number;
1217
+ timeout?: number;
1218
+ }): Promise<boolean>;
1219
+ /**
1220
+ * 执行线型手势
1221
+ * @param startPoint
1222
+ * @param endPoint
1223
+ * @param param2
1224
+ * @param timeout 超时时间(秒),默认30秒
1225
+ * @returns
1226
+ */
1227
+ static performLinearGesture(startPoint: {
1228
+ x: number;
1229
+ y: number;
1230
+ }, endPoint: {
1231
+ x: number;
1232
+ y: number;
1233
+ }, { duration, timeout }?: {
1234
+ duration?: number;
1235
+ timeout?: number;
1236
+ }): Promise<boolean>;
1237
+ static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
1238
+ matchedPackageName?: string;
1239
+ matchedText?: string;
1240
+ timeoutMillis?: number;
1241
+ longPressDuration?: number;
1242
+ timeout?: number;
1243
+ }): Promise<boolean>;
1244
+ static longPressGestureAutoPaste(point: {
1245
+ x: number;
1246
+ y: number;
1247
+ }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
1248
+ matchedPackageName?: string;
1249
+ matchedText?: string;
1250
+ timeoutMillis?: number;
1251
+ longPressDuration?: number;
1252
+ timeout?: number;
1253
+ }): Promise<boolean>;
1254
+ static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
1255
+ static getUniqueDeviceId(): any;
1256
+ static getAndroidID(): any;
1257
+ static getMacAddress(timeout?: number): Promise<any>;
1258
+ static getDeviceInfo(timeout?: number): Promise<DeviceInfo>;
1259
+ static getNetworkType(timeout?: number): Promise<any>;
1260
+ /**
1261
+ * 播放系统电话铃声
1262
+ * @param timeout 超时时间(秒),默认30秒
1263
+ * @returns 播放结果消息
1264
+ */
1265
+ static audioPlayRingtone(timeout?: number): Promise<string>;
1266
+ /**
1267
+ * 停止播放系统电话铃声
1268
+ * @param timeout 超时时间(秒),默认30秒
1269
+ * @returns 停止结果消息
1270
+ */
1271
+ static audioStopRingtone(timeout?: number): Promise<string>;
1272
+ static setAccessibilityEventFilters(value: AccessibilityEventFilter[]): Promise<any>;
1273
+ static addAccessibilityEventFilter(value: AccessibilityEventFilter): Promise<any>;
1274
+ /**
1275
+ * 获取屏幕尺寸
1276
+ * @returns 屏幕尺寸对象(width, height)
1277
+ */
1278
+ static getScreenSize(): Screen | null;
1279
+ /**
1280
+ * 获取应用窗口尺寸
1281
+ * @returns 应用窗口尺寸对象
1282
+ */
1283
+ static getAppScreenSize(): any;
1284
+ /**
1285
+ * 添加无障碍事件监听器
1286
+ * @param listener 监听器函数
1287
+ */
1288
+ static addAccessibilityEventListener(listener: AccessibilityEventListener): void;
1289
+ /**
1290
+ * 判断是否包含无障碍事件监听器
1291
+ * @param listener 监听器函数
1292
+ * @returns 是否包含
1293
+ */
1294
+ static containsAccessibilityEventListener(listener: AccessibilityEventListener): boolean;
1295
+ /**
1296
+ * 移除无障碍事件监听器
1297
+ * @param listener 要移除的监听器函数
1298
+ * @returns 是否移除成功
1299
+ */
1300
+ static removeAccessibilityEventListener(listener: AccessibilityEventListener): boolean;
1301
+ /**
1302
+ * 移除所有无障碍事件监听器
1303
+ */
1304
+ static removeAllAccessibilityEventListeners(): void;
1305
+ /**
1306
+ * 获取当前注册的无障碍事件监听器数量
1307
+ * @returns 监听器数量
1308
+ */
1309
+ static getAccessibilityEventListenerCount(): number;
1310
+ }
1311
+
1312
+ declare const CallMethod: {
1313
+ readonly takeScreenshot: "takeScreenshot";
1314
+ readonly takeScreenshotSave: "takeScreenshotSave";
1315
+ readonly takeScreenshotToFile: "takeScreenshotToFile";
1316
+ readonly overlayToast: "overlayToast";
1317
+ readonly setNodeText: "setNodeText";
1318
+ readonly findByTags: "findByTags";
1319
+ readonly findById: "findById";
1320
+ readonly findByText: "findByText";
1321
+ readonly findByTextAllMatch: "findByTextAllMatch";
1322
+ readonly containsText: "containsText";
1323
+ readonly getAllText: "getAllText";
1324
+ readonly findFirstParentByTags: "findFirstParentByTags";
1325
+ readonly getAllNodes: "getAllNodes";
1326
+ readonly getNodes: "getNodes";
1327
+ readonly findFirstParentClickable: "findFirstParentClickable";
1328
+ readonly getChildren: "getChildren";
1329
+ readonly getBoundsInScreen: "getBoundsInScreen";
1330
+ readonly isVisible: "isVisible";
1331
+ readonly click: "click";
1332
+ readonly longClick: "longClick";
1333
+ readonly back: "back";
1334
+ readonly home: "home";
1335
+ readonly notifications: "notifications";
1336
+ readonly recentApps: "recentApps";
1337
+ readonly paste: "paste";
1338
+ readonly focus: "focus";
1339
+ readonly selectionText: "selectionText";
1340
+ readonly scrollForward: "scrollForward";
1341
+ readonly launchApp: "launchApp";
1342
+ readonly getPackageName: "getPackageName";
1343
+ readonly getScreenSize: "getScreenSize";
1344
+ readonly getAppScreenSize: "getAppScreenSize";
1345
+ readonly scrollBackward: "scrollBackward";
1346
+ readonly setOverlayFlags: "setOverlayFlags";
1347
+ readonly scanQR: "scanQR";
1348
+ readonly loadWebViewOverlay: "loadWebViewOverlay";
1349
+ readonly closeOverlay: "closeOverlay";
1350
+ readonly recognizeTextInScreenshot: "recognizeTextInScreenshot";
1351
+ readonly clickByGesture: "clickByGesture";
1352
+ readonly clickNodeByGesture: "clickNodeByGesture";
1353
+ readonly doubleClickNodeByGesture: "doubleClickNodeByGesture";
1354
+ readonly performLinearGesture: "performLinearGesture";
1355
+ readonly longPressGestureAutoPaste: "longPressGestureAutoPaste";
1356
+ readonly getAppInfo: "getAppInfo";
1357
+ readonly getMacAddress: "getMacAddress";
1358
+ readonly getAndroidID: "getAndroidID";
1359
+ readonly getUniqueDeviceId: "getUniqueDeviceId";
1360
+ readonly addAccessibilityEventFilter: "addAccessibilityEventFilter";
1361
+ readonly setAccessibilityEventFilters: "setAccessibilityEventFilters";
1362
+ readonly httpRequest: "httpRequest";
1363
+ readonly getDeviceInfo: "getDeviceInfo";
1364
+ readonly getNetworkType: "getNetworkType";
1365
+ readonly isAppInstalled: "isAppInstalled";
1366
+ readonly getClipboardLatestText: "getClipboardLatestText";
1367
+ readonly getClipboardText: "getClipboardText";
1368
+ readonly openUrlInBrowser: "openUrlInBrowser";
1369
+ readonly keepScreenOn: "keepScreenOn";
1370
+ readonly clearKeepScreenOn: "clearKeepScreenOn";
1371
+ readonly download: "download";
1372
+ readonly audioPlayFromFile: "audioPlayFromFile";
1373
+ readonly audioStop: "audioStop";
1374
+ readonly audioPlayRingtone: "audioPlayRingtone";
1375
+ readonly audioStopRingtone: "audioStopRingtone";
1376
+ readonly addContact: "addContact";
1377
+ readonly getAllContacts: "getAllContacts";
1378
+ readonly saveRootNodeTreeJson: "saveRootNodeTreeJson";
1379
+ };
1380
+ type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
1381
+
1382
+ /**
1383
+ * Android 视图类型常量
1384
+ */
1385
+ declare const NodeClassValue: {
1386
+ readonly ImageView: "android.widget.ImageView";
1387
+ readonly TextView: "android.widget.TextView";
1388
+ readonly LinearLayout: "android.widget.LinearLayout";
1389
+ readonly RelativeLayout: "android.widget.RelativeLayout";
1390
+ readonly Button: "android.widget.Button";
1391
+ readonly ImageButton: "android.widget.ImageButton";
1392
+ readonly EditText: "android.widget.EditText";
1393
+ readonly View: "android.view.View";
1394
+ readonly ViewGroup: "android.view.ViewGroup";
1395
+ readonly FrameLayout: "android.widget.FrameLayout";
1396
+ };
1397
+
1398
+ declare function sleep(ms: number): Promise<void>;
1399
+ declare function generateUUID(): string;
1400
+ declare function decodeBase64UTF8(base64: string): string;
1401
+
1402
+ /**
1403
+ * 步骤执行错误类
1404
+ * 用于携带步骤执行过程中的错误信息和当前步骤对象
1405
+ * 支持传入可选数据:message,data任何类型的数据
1406
+ */
1407
+ declare class StepError extends Error {
1408
+ /**
1409
+ * 步骤实现函数名
1410
+ */
1411
+ readonly impl?: string;
1412
+ /**
1413
+ * 步骤标签
1414
+ */
1415
+ readonly tag?: string | undefined;
1416
+ /**
1417
+ * 步骤数据,可以是任何类型
1418
+ */
1419
+ readonly data?: any;
1420
+ /**
1421
+ * 原始错误
1422
+ */
1423
+ readonly originalError?: any;
1424
+ /**
1425
+ * 当前步骤对象
1426
+ */
1427
+ readonly currentStep?: any;
1428
+ constructor(message?: string, data?: any, impl?: string, tag?: string | undefined, originalError?: any, currentStep?: any | undefined);
1429
+ }
1430
+ /**
1431
+ * 主动停止异常类
1432
+ * 用于表示步骤被主动停止执行
1433
+ */
1434
+ declare class StepStopError extends StepError {
1435
+ constructor(message?: string, data?: any);
1436
+ }
1437
+
1438
+ declare class StepAsync {
1439
+ private step;
1440
+ /**
1441
+ * 构造函数
1442
+ * @param step Step实例
1443
+ */
1444
+ constructor(step: Step);
1445
+ /**
1446
+ * 对单个节点进行截图
1447
+ * @param node 目标节点
1448
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
1449
+ * @returns 截图路径
1450
+ */
1451
+ takeScreenshotByNode(node: Node, overlayHiddenScreenshotDelayMillis?: number): Promise<string>;
1452
+ /**
1453
+ * 对多个节点进行截图
1454
+ * @param nodes 目标节点数组
1455
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
1456
+ * @returns 截图路径数组
1457
+ */
1458
+ takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number): Promise<string[]>;
1459
+ /**
1460
+ * 获取所有符合条件的节点
1461
+ * @param filterClass 类名过滤
1462
+ * @param filterViewId 视图ID过滤
1463
+ * @param filterDes 描述过滤
1464
+ * @param filterText 文本过滤
1465
+ * @returns 节点数组
1466
+ */
1467
+ getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
1468
+ filterClass?: string;
1469
+ filterViewId?: string;
1470
+ filterDes?: string;
1471
+ filterText?: string;
1472
+ }): Promise<Node[]>;
1473
+ /**
1474
+ * 启动应用
1475
+ * @param packageName 应用包名
1476
+ * @returns 是否启动成功
1477
+ */
1478
+ launchApp(packageName: string): Promise<boolean>;
1479
+ /**
1480
+ * 获取当前应用包名
1481
+ * @returns 包名
1482
+ */
1483
+ getPackageName(): Promise<string>;
1484
+ /**
1485
+ * 通过ID查找节点
1486
+ * @param id 节点ID
1487
+ * @param filterClass 类名过滤
1488
+ * @param filterText 文本过滤
1489
+ * @param filterDes 描述过滤
1490
+ * @returns 节点数组
1491
+ */
1492
+ findById(id: string, { filterClass, filterText, filterDes, }?: {
1493
+ filterClass?: string;
1494
+ filterText?: string;
1495
+ filterDes?: string;
1496
+ }): Promise<Node[]>;
1497
+ /**
1498
+ * 通过文本查找节点
1499
+ * @param text 要查找的文本
1500
+ * @param filterClass 类名过滤
1501
+ * @param filterViewId 视图ID过滤
1502
+ * @param filterDes 描述过滤
1503
+ * @returns 节点数组
1504
+ */
1505
+ findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
1506
+ filterClass?: string;
1507
+ filterViewId?: string;
1508
+ filterDes?: string;
1509
+ }): Promise<Node[]>;
1510
+ /**
1511
+ * 通过标签查找节点
1512
+ * @param className 类名
1513
+ * @param filterText 文本过滤
1514
+ * @param filterViewId 视图ID过滤
1515
+ * @param filterDes 描述过滤
1516
+ * @returns 节点数组
1517
+ */
1518
+ findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
1519
+ filterText?: string;
1520
+ filterViewId?: string;
1521
+ filterDes?: string;
1522
+ }): Promise<Node[]>;
1523
+ /**
1524
+ * 查找所有匹配文本的节点
1525
+ * @param text 要查找的文本
1526
+ * @returns 节点数组
1527
+ */
1528
+ findByTextAllMatch(text: string): Promise<Node[]>;
1529
+ /**
1530
+ * 检查是否包含指定文本
1531
+ * @param text 要检查的文本
1532
+ * @returns 是否包含
1533
+ */
1534
+ containsText(text: string): Promise<boolean>;
1535
+ /**
1536
+ * 获取所有文本
1537
+ * @returns 文本数组
1538
+ */
1539
+ getAllText(): Promise<string[]>;
1540
+ /**
1541
+ * 执行点击手势
1542
+ * @param x 横坐标
1543
+ * @param y 纵坐标
1544
+ * @param duration 持续时间(毫秒)
1545
+ * @returns 是否成功
1546
+ */
1547
+ clickByGesture(x: number, y: number, duration: number): Promise<boolean>;
1548
+ longPressGestureAutoPaste(point: {
1549
+ x: number;
1550
+ y: number;
1551
+ }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
1552
+ matchedPackageName?: string;
1553
+ matchedText?: string;
1554
+ timeoutMillis?: number;
1555
+ longPressDuration?: number;
1556
+ }): Promise<boolean>;
1557
+ getAppInfo(packageName: string): Promise<any>;
1558
+ performLinearGesture(startPoint: {
1559
+ x: number;
1560
+ y: number;
1561
+ }, endPoint: {
1562
+ x: number;
1563
+ y: number;
1564
+ }, { duration }?: {
1565
+ duration?: number;
1566
+ }): Promise<boolean>;
1567
+ /**
1568
+ * 返回操作
1569
+ * @returns 是否成功
1570
+ */
1571
+ back(): Promise<boolean>;
1572
+ /**
1573
+ * 回到主页
1574
+ * @returns 是否成功
1575
+ */
1576
+ home(): Promise<boolean>;
1577
+ /**
1578
+ * 打开通知栏
1579
+ * @returns 是否成功
1580
+ */
1581
+ notifications(): Promise<boolean>;
1582
+ /**
1583
+ * 显示最近应用
1584
+ * @returns 是否成功
1585
+ */
1586
+ recentApps(): Promise<boolean>;
1587
+ /**
1588
+ * 获取屏幕尺寸
1589
+ * @returns 屏幕尺寸对象
1590
+ */
1591
+ getScreenSize(): Promise<any>;
1592
+ /**
1593
+ * 获取应用窗口尺寸
1594
+ * @returns 应用窗口尺寸对象
1595
+ */
1596
+ getAppScreenSize(): Promise<any>;
1597
+ }
1598
+
1599
+ type StepResult = Step | undefined;
1600
+ type StepImpl = (step: Step) => Promise<StepResult>;
1601
+ type StepInterceptor = (step: Step) => StepResult | Promise<StepResult>;
1602
+ declare class Step {
1603
+ static delayMsDefault: number;
1604
+ static readonly repeatCountInfinite: number;
1605
+ static repeatCountMaxDefault: number;
1606
+ static showLog: boolean;
1607
+ static exceptionRetryCountMaxDefault: number;
1608
+ /**
1609
+ * 当前执行步骤的ID
1610
+ */
1611
+ private static _stepId;
1612
+ /**
1613
+ * 步骤拦截器列表
1614
+ */
1615
+ private static _interceptors;
1616
+ /**
1617
+ * 步骤异常变量,默认为空
1618
+ */
1619
+ static exception: StepError | undefined;
1620
+ /**
1621
+ * 运行步骤实现
1622
+ * @param impl 步骤实现函数
1623
+ * @param tag 步骤标签
1624
+ * @param data 步骤数据
1625
+ * @param delayMs 步骤延迟时间(毫秒)
1626
+ */
1627
+ static run(impl: StepImpl, { stepId, tag, data, delayMs, exceptionRetryCountMax, }?: {
1628
+ stepId?: string | undefined;
1629
+ tag?: string | undefined;
1630
+ data?: any | undefined;
1631
+ delayMs?: number;
1632
+ exceptionRetryCountMax?: number;
1633
+ }): Promise<Step | undefined>;
1634
+ /**
1635
+ * 获取当前步骤ID
1636
+ */
1637
+ static get stepId(): string | undefined;
1638
+ /**
1639
+ * 验证步骤ID是否匹配,如果不匹配则表示停止
1640
+ * @param stepId 要验证的步骤ID
1641
+ */
1642
+ static assert(stepId: string | undefined): void;
1643
+ /**
1644
+ * 为节点数组分配步骤ID
1645
+ * @param nodes 节点数组
1646
+ * @param stepId 步骤ID
1647
+ */
1648
+ static assignIdsToNodes(nodes: Node[], stepId: string | undefined): void;
1649
+ /**
1650
+ * 停止当前步骤执行
1651
+ * @param exception 可选的异常对象,如果传入则使用该异常,否则使用默认的StepStopError
1652
+ */
1653
+ static stop(exception?: StepError): void;
1654
+ /**
1655
+ * 添加步骤拦截器
1656
+ * @param interceptor 拦截器函数
1657
+ */
1658
+ static addInterceptor(interceptor: StepInterceptor): void;
1659
+ /**
1660
+ * 移除步骤拦截器
1661
+ * @param interceptor 要移除的拦截器函数
1662
+ * @returns 是否成功删除
1663
+ */
1664
+ static removeInterceptor(interceptor: StepInterceptor): boolean;
1665
+ /**
1666
+ * 按索引移除步骤拦截器
1667
+ * @param index 要移除的拦截器索引
1668
+ * @returns 是否成功删除
1669
+ */
1670
+ static removeInterceptorByIndex(index: number): boolean;
1671
+ /**
1672
+ * 移除所有匹配的步骤拦截器
1673
+ * @param interceptor 要移除的拦截器函数
1674
+ * @returns 删除的拦截器数量
1675
+ */
1676
+ static removeAllInterceptors(interceptor: StepInterceptor): number;
1677
+ /**
1678
+ * 按条件移除步骤拦截器
1679
+ * @param predicate 判断是否删除的条件函数
1680
+ * @returns 删除的拦截器数量
1681
+ */
1682
+ static removeInterceptorByPredicate(predicate: (interceptor: StepInterceptor, index: number) => boolean): number;
1683
+ /**
1684
+ * 清空所有拦截器
1685
+ */
1686
+ static clearInterceptors(): void;
1687
+ /**
1688
+ * 获取所有拦截器
1689
+ * @returns 拦截器数组
1690
+ */
1691
+ static getInterceptors(): StepInterceptor[];
1692
+ /**
1693
+ * 步骤ID
1694
+ */
1695
+ stepId: string;
1696
+ /**
1697
+ * 步骤重复执行次数
1698
+ */
1699
+ repeatCount: number;
1700
+ /**
1701
+ * 步骤重复执行最大次数,默认不限制
1702
+ */
1703
+ repeatCountMax: number;
1704
+ /**
1705
+ * 异常重试次数
1706
+ */
1707
+ exceptionRetryCount: number;
1708
+ /**
1709
+ * 异常重试最大次数,默认3次
1710
+ */
1711
+ exceptionRetryCountMax: number;
1712
+ /**
1713
+ * 步骤标签
1714
+ */
1715
+ tag: string | undefined;
1716
+ isEnd: boolean;
1717
+ /**
1718
+ * 步骤数据
1719
+ */
1720
+ data: any | undefined;
1721
+ /**
1722
+ * 步骤延迟时间(毫秒)
1723
+ */
1724
+ delayMs: number;
1725
+ /**
1726
+ * 步骤实现函数
1727
+ */
1728
+ impl: StepImpl | undefined;
1729
+ /**
1730
+ * 构造函数
1731
+ * @param stepId 步骤ID
1732
+ * @param impl 步骤实现函数
1733
+ * @param tag 步骤标签
1734
+ * @param data 步骤数据
1735
+ * @param delayMs 步骤延迟时间(毫秒)
1736
+ */
1737
+ constructor({ stepId, impl, tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, isEnd, }: {
1738
+ stepId: string;
1739
+ impl: StepImpl | undefined;
1740
+ tag?: string | undefined;
1741
+ data?: any | undefined;
1742
+ delayMs?: number;
1743
+ repeatCountMax?: number;
1744
+ exceptionRetryCountMax?: number;
1745
+ isEnd?: boolean;
1746
+ });
1747
+ get async(): StepAsync;
1748
+ /**
1749
+ * 创建下一个步骤
1750
+ * @param impl 下一步骤实现函数
1751
+ * @param tag 步骤标签
1752
+ * @param data 步骤数据
1753
+ * @param delayMs 步骤延迟时间(毫秒)
1754
+ * @returns 新的步骤实例
1755
+ */
1756
+ next(impl: StepImpl, { tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, }?: {
1757
+ tag?: string | undefined;
1758
+ data?: any | undefined;
1759
+ delayMs?: number;
1760
+ repeatCountMax?: number;
1761
+ exceptionRetryCountMax?: number;
1762
+ }): Step;
1763
+ end({ tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, }?: {
1764
+ tag?: string | undefined;
1765
+ data?: any | undefined;
1766
+ delayMs?: number;
1767
+ repeatCountMax?: number;
1768
+ exceptionRetryCountMax?: number;
1769
+ }): Step;
1770
+ /**
1771
+ * 重复当前步骤
1772
+ * @param stepId 步骤ID
1773
+ * @param tag 步骤标签
1774
+ * @param data 步骤数据
1775
+ * @param delayMs 步骤延迟时间(毫秒)
1776
+ * @returns 当前步骤实例
1777
+ */
1778
+ repeat({ stepId, tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, }?: {
1779
+ stepId?: string;
1780
+ tag?: string | undefined;
1781
+ data?: any | undefined;
1782
+ delayMs?: number;
1783
+ repeatCountMax?: number;
1784
+ exceptionRetryCountMax?: number;
1785
+ }): Step;
1786
+ /**
1787
+ * 延迟执行
1788
+ * @param ms 延迟时间(毫秒)
1789
+ * @returns Promise
1790
+ */
1791
+ delay(ms: number): Promise<void>;
1792
+ /**
1793
+ * 等待异步方法执行完成
1794
+ * @param method 异步方法
1795
+ * @returns Promise<T>
1796
+ */
1797
+ await<T>(method: () => Promise<T>): Promise<T>;
1798
+ /**
1799
+ * 对单个节点进行截图
1800
+ * @param node 目标节点
1801
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
1802
+ * @returns 截图路径
1803
+ */
1804
+ takeScreenshotByNode(node: Node, overlayHiddenScreenshotDelayMillis?: number): Promise<string>;
1805
+ /**
1806
+ * 对多个节点进行截图
1807
+ * @param nodes 目标节点数组
1808
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
1809
+ * @returns 截图路径数组
1810
+ */
1811
+ takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number): Promise<string[]>;
1812
+ /**
1813
+ * 获取所有符合条件的节点
1814
+ * @param filterClass 类名过滤
1815
+ * @param filterViewId 视图ID过滤
1816
+ * @param filterDes 描述过滤
1817
+ * @param filterText 文本过滤
1818
+ * @returns 节点数组
1819
+ */
1820
+ getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
1821
+ filterClass?: string;
1822
+ filterViewId?: string;
1823
+ filterDes?: string;
1824
+ filterText?: string;
1825
+ }): Node[];
1826
+ /**
1827
+ * 启动应用
1828
+ * @param packageName 应用包名
1829
+ * @returns 是否启动成功
1830
+ */
1831
+ launchApp(packageName: string): boolean;
1832
+ /**
1833
+ * 获取当前应用包名
1834
+ * @returns 包名
1835
+ */
1836
+ getPackageName(): string;
1837
+ /**
1838
+ * 通过ID查找节点
1839
+ * @param id 节点ID
1840
+ * @param filterClass 类名过滤
1841
+ * @param filterText 文本过滤
1842
+ * @param filterDes 描述过滤
1843
+ * @returns 节点数组
1844
+ */
1845
+ findById(id: string, { filterClass, filterText, filterDes, }?: {
1846
+ filterClass?: string;
1847
+ filterText?: string;
1848
+ filterDes?: string;
1849
+ }): Node[];
1850
+ /**
1851
+ * 通过文本查找节点
1852
+ * @param text 要查找的文本
1853
+ * @param filterClass 类名过滤
1854
+ * @param filterViewId 视图ID过滤
1855
+ * @param filterDes 描述过滤
1856
+ * @returns 节点数组
1857
+ */
1858
+ findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
1859
+ filterClass?: string;
1860
+ filterViewId?: string;
1861
+ filterDes?: string;
1862
+ }): Node[];
1863
+ /**
1864
+ * 通过标签查找节点
1865
+ * @param className 类名
1866
+ * @param filterText 文本过滤
1867
+ * @param filterViewId 视图ID过滤
1868
+ * @param filterDes 描述过滤
1869
+ * @returns 节点数组
1870
+ */
1871
+ findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
1872
+ filterText?: string;
1873
+ filterViewId?: string;
1874
+ filterDes?: string;
1875
+ }): Node[];
1876
+ /**
1877
+ * 查找所有匹配文本的节点
1878
+ * @param text 要查找的文本
1879
+ * @returns 节点数组
1880
+ */
1881
+ findByTextAllMatch(text: string): Node[];
1882
+ /**
1883
+ * 检查是否包含指定文本
1884
+ * @param text 要检查的文本
1885
+ * @returns 是否包含
1886
+ */
1887
+ containsText(text: string): boolean;
1888
+ /**
1889
+ * 获取所有文本
1890
+ * @returns 文本数组
1891
+ */
1892
+ getAllText(): string[];
1893
+ /**
1894
+ * 执行点击手势
1895
+ * @param x 横坐标
1896
+ * @param y 纵坐标
1897
+ * @param duration 持续时间(毫秒)
1898
+ * @returns 是否成功
1899
+ */
1900
+ clickByGesture(x: number, y: number, duration: number): Promise<boolean>;
1901
+ longPressGestureAutoPaste(point: {
1902
+ x: number;
1903
+ y: number;
1904
+ }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
1905
+ matchedPackageName?: string;
1906
+ matchedText?: string;
1907
+ timeoutMillis?: number;
1908
+ longPressDuration?: number;
1909
+ }): Promise<boolean>;
1910
+ getAppInfo(packageName: string): Promise<any>;
1911
+ performLinearGesture(startPoint: {
1912
+ x: number;
1913
+ y: number;
1914
+ }, endPoint: {
1915
+ x: number;
1916
+ y: number;
1917
+ }, { duration }?: {
1918
+ duration?: number;
1919
+ }): Promise<boolean>;
1920
+ /**
1921
+ * 返回操作
1922
+ * @returns 是否成功
1923
+ */
1924
+ back(): boolean;
1925
+ /**
1926
+ * 回到主页
1927
+ * @returns 是否成功
1928
+ */
1929
+ home(): boolean;
1930
+ /**
1931
+ * 打开通知栏
1932
+ * @returns 是否成功
1933
+ */
1934
+ notifications(): boolean;
1935
+ /**
1936
+ * 显示最近应用
1937
+ * @returns 是否成功
1938
+ */
1939
+ recentApps(): boolean;
1940
+ /**
1941
+ * 获取屏幕尺寸
1942
+ * @returns 屏幕尺寸对象
1943
+ */
1944
+ getScreenSize(): any;
1945
+ /**
1946
+ * 获取应用窗口尺寸
1947
+ * @returns 应用窗口尺寸对象
1948
+ */
1949
+ getAppScreenSize(): any;
1950
+ }
1951
+
1952
+ type StepStatus = 'idle' | 'running' | 'completed' | 'error';
1953
+ interface StepState {
1954
+ status: StepStatus;
1955
+ stepId?: string;
1956
+ tag?: string;
1957
+ data?: any;
1958
+ error?: string;
1959
+ }
1960
+ declare const useStepStore: pinia.StoreDefinition<"step", StepState, {}, {
1961
+ startStep(stepId: string, tag?: string, data?: any): void;
1962
+ completeStep(): void;
1963
+ setError(error: string): void;
1964
+ reset(): void;
1965
+ }>;
1966
+
1967
+ /**
1968
+ * 窗口标志位常量类
1969
+ * 定义了各种窗口行为和属性的标志位
1970
+ */
1971
+ declare class WindowFlags {
1972
+ /** 不获取焦点 */
1973
+ static readonly FLAG_NOT_FOCUSABLE = 8;
1974
+ /** 不响应触摸 */
1975
+ static readonly FLAG_NOT_TOUCHABLE = 16;
1976
+ /** 不拦截触摸 */
1977
+ static readonly FLAG_NOT_TOUCH_MODAL = 32;
1978
+ /** 监听窗外点击 */
1979
+ static readonly FLAG_WATCH_OUTSIDE_TOUCH = 4;
1980
+ /** 可绘制超出屏幕 */
1981
+ static readonly FLAG_LAYOUT_NO_LIMITS = 512;
1982
+ /** 屏幕全区域布局 */
1983
+ static readonly FLAG_LAYOUT_IN_SCREEN = 256;
1984
+ /** 全屏显示 */
1985
+ static readonly FLAG_FULLSCREEN = 1024;
1986
+ /** 背景变暗 */
1987
+ static readonly FLAG_DIM_BEHIND = 2;
1988
+ /** 防录屏防截图 */
1989
+ static readonly FLAG_SECURE = 8192;
1990
+ /** 保持常亮 */
1991
+ static readonly FLAG_KEEP_SCREEN_ON = 128;
1992
+ /** 锁屏时可见 */
1993
+ static readonly FLAG_SHOW_WHEN_LOCKED = 524288;
1994
+ /** 解锁屏幕 */
1995
+ static readonly FLAG_DISMISS_KEYGUARD = 4194304;
1996
+ /** 点亮屏幕 */
1997
+ static readonly FLAG_TURN_SCREEN_ON = 2097152;
1998
+ /** 自动锁屏(不常用) */
1999
+ static readonly FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 128;
2000
+ /** 显示墙纸 */
2001
+ static readonly FLAG_SHOW_WALLPAPER = 1048576;
2002
+ /** 强制硬件加速 */
2003
+ static readonly FLAG_HARDWARE_ACCELERATED = 16777216;
2004
+ /**
2005
+ * 获取标志位的十六进制表示
2006
+ * @param flag 标志位值
2007
+ * @returns 十六进制字符串
2008
+ */
2009
+ static toHex(flag: number): string;
2010
+ /**
2011
+ * 检查是否包含指定标志位
2012
+ * @param flags 当前标志位组合
2013
+ * @param flag 要检查的标志位
2014
+ * @returns 是否包含该标志位
2015
+ */
2016
+ static hasFlag(flags: number, flag: number): boolean;
2017
+ /**
2018
+ * 添加标志位
2019
+ * @param flags 当前标志位组合
2020
+ * @param flag 要添加的标志位
2021
+ * @returns 新的标志位组合
2022
+ */
2023
+ static addFlag(flags: number, flag: number): number;
2024
+ /**
2025
+ * 移除标志位
2026
+ * @param flags 当前标志位组合
2027
+ * @param flag 要移除的标志位
2028
+ * @returns 新的标志位组合
2029
+ */
2030
+ static removeFlag(flags: number, flag: number): number;
2031
+ /**
2032
+ * 获取所有标志位的描述信息
2033
+ * @returns 标志位描述对象数组
2034
+ */
2035
+ static getAllFlags(): Array<{
2036
+ name: string;
2037
+ value: number;
2038
+ hex: string;
2039
+ description: string;
2040
+ }>;
2041
+ }
2042
+
2043
+ /**
2044
+ * AssistsX 类
2045
+ * 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
2046
+ */
2047
+
2048
+ /**
2049
+ * 截图识别位置信息
2050
+ */
2051
+ interface RecognizeTextInScreenshotPosition {
2052
+ text: string;
2053
+ left: number;
2054
+ top: number;
2055
+ right: number;
2056
+ bottom: number;
2057
+ width: number;
2058
+ height: number;
2059
+ }
2060
+ /**
2061
+ * 截图识别结果
2062
+ */
2063
+ interface RecognizeTextInScreenshotResult {
2064
+ fullText: string;
2065
+ processingTimeMillis: number;
2066
+ positions: RecognizeTextInScreenshotPosition[];
2067
+ }
2068
+ /**
2069
+ * 截图识别区域参数
2070
+ */
2071
+ interface RecognizeTextRegion {
2072
+ left?: number;
2073
+ top?: number;
2074
+ right?: number;
2075
+ bottom?: number;
2076
+ width?: number;
2077
+ height?: number;
2078
+ }
2079
+ /**
2080
+ * 联系人信息
2081
+ */
2082
+ interface Contact {
2083
+ id: string;
2084
+ name: string;
2085
+ phoneNumbers: string[];
2086
+ emails: string[];
2087
+ address: string;
2088
+ }
2089
+ declare class AssistsXAsync {
2090
+ /**
2091
+ * 执行异步调用
2092
+ * @param method 方法名
2093
+ * @param args 参数对象
2094
+ * @param timeout 超时时间(秒),默认30秒
2095
+ * @returns Promise<调用响应>
2096
+ */
2097
+ private static asyncCall;
2098
+ /**
2099
+ * 设置悬浮窗标志
2100
+ * @param flags 标志
2101
+ * @param timeout 超时时间(秒),默认30秒
2102
+ * @returns 是否设置成功
2103
+ */
2104
+ static setOverlayFlags(flags: number, timeout?: number): Promise<boolean>;
2105
+ /**
2106
+ * 设置悬浮窗标志
2107
+ * @param flags 标志
2108
+ * @param timeout 超时时间(秒),默认30秒
2109
+ * @returns 是否设置成功
2110
+ */
2111
+ static setOverlayFlagList(flags: number[], timeout?: number): Promise<boolean>;
2112
+ /**
2113
+ * 获取所有符合条件的节点
2114
+ * @param filterClass 类名过滤
2115
+ * @param filterViewId 视图ID过滤
2116
+ * @param filterDes 描述过滤
2117
+ * @param filterText 文本过滤
2118
+ * @param timeout 超时时间(秒),默认30秒
2119
+ * @returns 节点数组
2120
+ */
2121
+ static getAllNodes({ filterClass, filterViewId, filterDes, filterText, timeout, }?: {
2122
+ filterClass?: string;
2123
+ filterViewId?: string;
2124
+ filterDes?: string;
2125
+ filterText?: string;
2126
+ timeout?: number;
2127
+ }): Promise<Node[]>;
2128
+ /**
2129
+ * 设置节点文本
2130
+ * @param node 目标节点
2131
+ * @param text 要设置的文本
2132
+ * @param timeout 超时时间(秒),默认30秒
2133
+ * @returns 是否设置成功
2134
+ */
2135
+ static setNodeText(node: Node, text: string, timeout?: number): Promise<boolean>;
2136
+ /**
2137
+ * 对指定节点进行截图
2138
+ * @param nodes 要截图的节点数组
2139
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
2140
+ * @param timeout 超时时间(秒),默认30秒
2141
+ * @returns 截图路径数组
2142
+ */
2143
+ static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number, timeout?: number): Promise<string[]>;
2144
+ /**
2145
+ * 保存全屏截图到文件
2146
+ * @param options 截图保存选项
2147
+ * @param options.filePath 文件路径(可选,不提供则自动生成)
2148
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认为 "PNG"
2149
+ * @param options.overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒),默认为 250
2150
+ * @param options.timeout 超时时间(秒),默认30秒
2151
+ * @returns 保存的文件路径
2152
+ */
2153
+ static takeScreenshotSave(options?: {
2154
+ filePath?: string;
2155
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
2156
+ overlayHiddenScreenshotDelayMillis?: number;
2157
+ timeout?: number;
2158
+ }): Promise<string>;
2159
+ /**
2160
+ * 保存截图到文件(支持多个节点)
2161
+ * @param options 截图保存选项
2162
+ * @param options.nodes 要截图的节点数组(可选,不提供则保存全屏截图)
2163
+ * @param options.filePath 文件路径(可选,不提供则自动生成。多个节点时会自动添加索引后缀)
2164
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认为 "PNG"
2165
+ * @param options.overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒),默认为 250
2166
+ * @param options.timeout 超时时间(秒),默认30秒
2167
+ * @returns 保存的文件路径数组
2168
+ */
2169
+ static takeScreenshotToFile(options?: {
2170
+ nodes?: Node[];
2171
+ filePath?: string;
2172
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
2173
+ overlayHiddenScreenshotDelayMillis?: number;
2174
+ timeout?: number;
2175
+ }): Promise<string[]>;
2176
+ /**
2177
+ * 截图识别文本
2178
+ * @param param0 识别参数
2179
+ * @returns 截图识别结果
2180
+ */
2181
+ static recognizeTextInScreenshot(targetText: string, options?: {
2182
+ rotationDegrees?: number;
2183
+ overlayHiddenScreenshotDelayMillis?: number;
2184
+ restoreOverlay?: boolean;
2185
+ region?: RecognizeTextRegion;
2186
+ timeout?: number;
2187
+ }): Promise<RecognizeTextInScreenshotResult>;
2188
+ static scanQR(timeout?: number): Promise<string>;
2189
+ static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions & {
2190
+ timeout?: number;
2191
+ }): Promise<any>;
2192
+ /**
2193
+ * 关闭当前 WebView 悬浮窗
2194
+ * @param timeout 超时时间(秒),默认30秒
2195
+ * @returns 是否关闭成功(当前页面在悬浮窗内时返回 true,否则 false)
2196
+ */
2197
+ static closeOverlay(timeout?: number): Promise<boolean>;
2198
+ /**
2199
+ * 点击节点
2200
+ * @param node 要点击的节点
2201
+ * @param timeout 超时时间(秒),默认30秒
2202
+ * @returns 是否点击成功
2203
+ */
2204
+ static click(node: Node, timeout?: number): Promise<boolean>;
2205
+ /**
2206
+ * 长按节点
2207
+ * @param node 要长按的节点
2208
+ * @param timeout 超时时间(秒),默认30秒
2209
+ * @returns 是否长按成功
2210
+ */
2211
+ static longClick(node: Node, timeout?: number): Promise<boolean>;
2212
+ /**
2213
+ * 启动应用
2214
+ * @param packageName 应用包名
2215
+ * @param timeout 超时时间(秒),默认30秒
2216
+ * @returns 是否启动成功
2217
+ */
2218
+ static launchApp(packageName: string, timeout?: number): Promise<boolean>;
2219
+ /**
2220
+ * 获取当前应用包名
2221
+ * @param timeout 超时时间(秒),默认30秒
2222
+ * @returns 包名
2223
+ */
2224
+ static getPackageName(timeout?: number): Promise<string>;
2225
+ /**
2226
+ * 显示悬浮提示
2227
+ * @param text 提示文本
2228
+ * @param delay 显示时长(毫秒)
2229
+ * @param timeout 超时时间(秒),默认30秒
2230
+ * @returns 是否显示成功
2231
+ */
2232
+ static overlayToast(text: string, delay?: number, timeout?: number): Promise<boolean>;
2233
+ /**
2234
+ * 通过ID查找节点
2235
+ * @param id 节点ID
2236
+ * @param filterClass 类名过滤
2237
+ * @param filterText 文本过滤
2238
+ * @param filterDes 描述过滤
2239
+ * @param node 父节点范围
2240
+ * @param timeout 超时时间(秒),默认30秒
2241
+ * @returns 节点数组
2242
+ */
2243
+ static findById(id: string, { filterClass, filterText, filterDes, node, timeout, }?: {
2244
+ filterClass?: string;
2245
+ filterText?: string;
2246
+ filterDes?: string;
2247
+ node?: Node;
2248
+ timeout?: number;
2249
+ }): Promise<Node[]>;
2250
+ /**
2251
+ * 通过文本查找节点
2252
+ * @param text 要查找的文本
2253
+ * @param filterClass 类名过滤
2254
+ * @param filterViewId 视图ID过滤
2255
+ * @param filterDes 描述过滤
2256
+ * @param node 父节点范围
2257
+ * @param timeout 超时时间(秒),默认30秒
2258
+ * @returns 节点数组
2259
+ */
2260
+ static findByText(text: string, { filterClass, filterViewId, filterDes, node, timeout, }?: {
2261
+ filterClass?: string;
2262
+ filterViewId?: string;
2263
+ filterDes?: string;
2264
+ node?: Node;
2265
+ timeout?: number;
2266
+ }): Promise<Node[]>;
2267
+ /**
2268
+ * 通过标签查找节点
2269
+ * @param className 类名
2270
+ * @param filterText 文本过滤
2271
+ * @param filterViewId 视图ID过滤
2272
+ * @param filterDes 描述过滤
2273
+ * @param node 父节点范围
2274
+ * @param timeout 超时时间(秒),默认30秒
2275
+ * @returns 节点数组
2276
+ */
2277
+ static findByTags(className: string, { filterText, filterViewId, filterDes, node, timeout, }?: {
2278
+ filterText?: string;
2279
+ filterViewId?: string;
2280
+ filterDes?: string;
2281
+ node?: Node;
2282
+ timeout?: number;
2283
+ }): Promise<Node[]>;
2284
+ /**
2285
+ * 查找所有匹配文本的节点
2286
+ * @param text 要查找的文本
2287
+ * @param timeout 超时时间(秒),默认30秒
2288
+ * @returns 节点数组
2289
+ */
2290
+ static findByTextAllMatch(text: string, timeout?: number): Promise<Node[]>;
2291
+ /**
2292
+ * 检查是否包含指定文本
2293
+ * @param text 要检查的文本
2294
+ * @param timeout 超时时间(秒),默认30秒
2295
+ * @returns 是否包含
2296
+ */
2297
+ static containsText(text: string, timeout?: number): Promise<boolean>;
2298
+ /**
2299
+ * 获取所有文本
2300
+ * @param timeout 超时时间(秒),默认30秒
2301
+ * @returns 文本数组
2302
+ */
2303
+ static getAllText(timeout?: number): Promise<string[]>;
2304
+ /**
2305
+ * 查找第一个匹配标签的父节点
2306
+ * @param className 类名
2307
+ * @param timeout 超时时间(秒),默认30秒
2308
+ * @returns 父节点
2309
+ */
2310
+ static findFirstParentByTags(node: Node, className: string, timeout?: number): Promise<Node>;
2311
+ /**
2312
+ * 获取节点的所有子节点
2313
+ * @param node 父节点
2314
+ * @param timeout 超时时间(秒),默认30秒
2315
+ * @returns 子节点数组
2316
+ */
2317
+ static getNodes(node: Node, timeout?: number): Promise<Node[]>;
2318
+ /**
2319
+ * 获取节点的直接子节点
2320
+ * @param node 父节点
2321
+ * @param timeout 超时时间(秒),默认30秒
2322
+ * @returns 子节点数组
2323
+ */
2324
+ static getChildren(node: Node, timeout?: number): Promise<Node[]>;
2325
+ /**
2326
+ * 查找第一个可点击的父节点
2327
+ * @param node 起始节点
2328
+ * @param timeout 超时时间(秒),默认30秒
2329
+ * @returns 可点击的父节点
2330
+ */
2331
+ static findFirstParentClickable(node: Node, timeout?: number): Promise<Node>;
2332
+ /**
2333
+ * 获取节点在屏幕中的边界
2334
+ * @param node 目标节点
2335
+ * @param timeout 超时时间(秒),默认30秒
2336
+ * @returns 边界对象
2337
+ */
2338
+ static getBoundsInScreen(node: Node, timeout?: number): Promise<Bounds>;
2339
+ /**
2340
+ * 检查节点是否可见
2341
+ * @param node 目标节点
2342
+ * @param compareNode 比较节点
2343
+ * @param isFullyByCompareNode 是否完全可见
2344
+ * @param timeout 超时时间(秒),默认30秒
2345
+ * @returns 是否可见
2346
+ */
2347
+ static isVisible(node: Node, { compareNode, isFullyByCompareNode, timeout, }?: {
2348
+ compareNode?: Node;
2349
+ isFullyByCompareNode?: boolean;
2350
+ timeout?: number;
2351
+ }): Promise<boolean>;
2352
+ /**
2353
+ * 执行点击手势
2354
+ * @param x 横坐标
2355
+ * @param y 纵坐标
2356
+ * @param duration 持续时间
2357
+ * @param timeout 超时时间(秒),默认30秒
2358
+ * @returns 是否成功
2359
+ */
2360
+ static clickByGesture(x: number, y: number, duration: number, timeout?: number): Promise<boolean>;
2361
+ /**
2362
+ * 返回操作
2363
+ * @param timeout 超时时间(秒),默认30秒
2364
+ * @returns 是否成功
2365
+ */
2366
+ static back(timeout?: number): Promise<boolean>;
2367
+ /**
2368
+ * 回到主页
2369
+ * @param timeout 超时时间(秒),默认30秒
2370
+ * @returns 是否成功
2371
+ */
2372
+ static home(timeout?: number): Promise<boolean>;
2373
+ /**
2374
+ * 打开通知栏
2375
+ * @param timeout 超时时间(秒),默认30秒
2376
+ * @returns 是否成功
2377
+ */
2378
+ static notifications(timeout?: number): Promise<boolean>;
2379
+ /**
2380
+ * 显示最近应用
2381
+ * @param timeout 超时时间(秒),默认30秒
2382
+ * @returns 是否成功
2383
+ */
2384
+ static recentApps(timeout?: number): Promise<boolean>;
2385
+ /**
2386
+ * 在节点中粘贴文本
2387
+ * @param node 目标节点
2388
+ * @param text 要粘贴的文本
2389
+ * @param timeout 超时时间(秒),默认30秒
2390
+ * @returns 是否成功
2391
+ */
2392
+ static paste(node: Node, text: string, timeout?: number): Promise<boolean>;
2393
+ static focus(node: Node, timeout?: number): Promise<boolean>;
2394
+ /**
2395
+ * 选择文本
2396
+ * @param node 目标节点
2397
+ * @param selectionStart 选择起始位置
2398
+ * @param selectionEnd 选择结束位置
2399
+ * @param timeout 超时时间(秒),默认30秒
2400
+ * @returns 是否成功
2401
+ */
2402
+ static selectionText(node: Node, selectionStart: number, selectionEnd: number, timeout?: number): Promise<boolean>;
2403
+ /**
2404
+ * 向前滚动
2405
+ * @param node 可滚动节点
2406
+ * @param timeout 超时时间(秒),默认30秒
2407
+ * @returns 是否成功
2408
+ */
2409
+ static scrollForward(node: Node, timeout?: number): Promise<boolean>;
2410
+ /**
2411
+ * 向后滚动
2412
+ * @param node 可滚动节点
2413
+ * @param timeout 超时时间(秒),默认30秒
2414
+ * @returns 是否成功
2415
+ */
2416
+ static scrollBackward(node: Node, timeout?: number): Promise<boolean>;
2417
+ /**
2418
+ * 对节点执行点击手势
2419
+ * @param node 目标节点
2420
+ * @param offsetX X轴偏移
2421
+ * @param offsetY Y轴偏移
2422
+ * @param switchWindowIntervalDelay 窗口切换延迟
2423
+ * @param clickDuration 点击持续时间
2424
+ * @param timeout 超时时间(秒),默认30秒
2425
+ * @returns 是否成功
2426
+ */
2427
+ static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, timeout, }?: {
2428
+ offsetX?: number;
2429
+ offsetY?: number;
2430
+ switchWindowIntervalDelay?: number;
2431
+ clickDuration?: number;
2432
+ timeout?: number;
2433
+ }): Promise<boolean>;
2434
+ /**
2435
+ * 对节点执行双击手势
2436
+ * @param node 目标节点
2437
+ * @param offsetX X轴偏移
2438
+ * @param offsetY Y轴偏移
2439
+ * @param switchWindowIntervalDelay 窗口切换延迟
2440
+ * @param clickDuration 点击持续时间
2441
+ * @param clickInterval 点击间隔
2442
+ * @param timeout 超时时间(秒),默认30秒
2443
+ * @returns 是否成功
2444
+ */
2445
+ static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, timeout, }?: {
2446
+ offsetX?: number;
2447
+ offsetY?: number;
2448
+ switchWindowIntervalDelay?: number;
2449
+ clickDuration?: number;
2450
+ clickInterval?: number;
2451
+ timeout?: number;
2452
+ }): Promise<boolean>;
2453
+ /**
2454
+ * 执行线型手势
2455
+ * @param startPoint
2456
+ * @param endPoint
2457
+ * @param param2
2458
+ * @param timeout 超时时间(秒),默认30秒
2459
+ * @returns
2460
+ */
2461
+ static performLinearGesture(startPoint: {
2462
+ x: number;
2463
+ y: number;
2464
+ }, endPoint: {
2465
+ x: number;
2466
+ y: number;
2467
+ }, { duration, timeout }?: {
2468
+ duration?: number;
2469
+ timeout?: number;
2470
+ }): Promise<boolean>;
2471
+ static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
2472
+ matchedPackageName?: string;
2473
+ matchedText?: string;
2474
+ timeoutMillis?: number;
2475
+ longPressDuration?: number;
2476
+ timeout?: number;
2477
+ }): Promise<boolean>;
2478
+ static longPressGestureAutoPaste(point: {
2479
+ x: number;
2480
+ y: number;
2481
+ }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
2482
+ matchedPackageName?: string;
2483
+ matchedText?: string;
2484
+ timeoutMillis?: number;
2485
+ longPressDuration?: number;
2486
+ timeout?: number;
2487
+ }): Promise<boolean>;
2488
+ static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
2489
+ static getUniqueDeviceId(timeout?: number): Promise<any>;
2490
+ static getAndroidID(timeout?: number): Promise<any>;
2491
+ static getMacAddress(timeout?: number): Promise<any>;
2492
+ static getDeviceInfo(timeout?: number): Promise<DeviceInfo>;
2493
+ /**
2494
+ * 获取屏幕尺寸
2495
+ * @param timeout 超时时间(秒),默认30秒
2496
+ * @returns 屏幕尺寸对象
2497
+ */
2498
+ static getScreenSize(timeout?: number): Promise<any>;
2499
+ /**
2500
+ * 获取应用窗口尺寸
2501
+ * @param timeout 超时时间(秒),默认30秒
2502
+ * @returns 应用窗口尺寸对象
2503
+ */
2504
+ static getAppScreenSize(timeout?: number): Promise<any>;
2505
+ /**
2506
+ * 在浏览器中打开URL
2507
+ * @param url 要打开的URL
2508
+ * @param timeout 超时时间(秒),默认30秒
2509
+ * @returns 是否成功打开
2510
+ */
2511
+ static openUrlInBrowser(url: string, timeout?: number): Promise<boolean>;
2512
+ static download(url: string, timeout?: number): Promise<string | null | undefined>;
2513
+ static audioPlayFromFile(filePath: string, { volume, useAbsoluteVolume, timeout, }: {
2514
+ volume?: number;
2515
+ useAbsoluteVolume?: boolean;
2516
+ timeout?: number;
2517
+ }): Promise<string | null | undefined>;
2518
+ static audioStop({ timeout, }: {
2519
+ timeout?: number;
2520
+ }): Promise<boolean | null | undefined>;
2521
+ /**
2522
+ * 播放系统电话铃声
2523
+ * @param timeout 超时时间(秒),默认30秒
2524
+ * @returns 播放结果消息
2525
+ */
2526
+ static audioPlayRingtone({ timeout, }: {
2527
+ timeout?: number;
2528
+ }): Promise<string>;
2529
+ /**
2530
+ * 停止播放系统电话铃声
2531
+ * @param timeout 超时时间(秒),默认30秒
2532
+ * @returns 停止结果消息
2533
+ */
2534
+ static audioStopRingtone({ timeout, }: {
2535
+ timeout?: number;
2536
+ }): Promise<string>;
2537
+ /**
2538
+ * 添加联系人
2539
+ * @param name 联系人姓名(必填)
2540
+ * @param phoneNumber 电话号码(必填)
2541
+ * @param timeout 超时时间(秒),默认30秒
2542
+ * @returns 是否添加成功
2543
+ */
2544
+ static addContact(name: string, phoneNumber: string, timeout?: number): Promise<boolean>;
2545
+ /**
2546
+ * 获取所有联系人
2547
+ * @param timeout 超时时间(秒),默认30秒
2548
+ * @returns 联系人列表
2549
+ */
2550
+ static getAllContacts(timeout?: number): Promise<Contact[]>;
2551
+ /**
2552
+ * 保存根节点树为JSON文件
2553
+ * @param options 保存选项
2554
+ * @param options.filePath 文件路径(可选,不提供则自动生成)
2555
+ * @param options.prettyPrint 是否格式化输出,默认为 true
2556
+ * @param options.timeout 超时时间(秒),默认30秒
2557
+ * @returns 保存的文件路径
2558
+ */
2559
+ static saveRootNodeTreeJson(options?: {
2560
+ filePath?: string;
2561
+ prettyPrint?: boolean;
2562
+ timeout?: number;
2563
+ }): Promise<string>;
2564
+ /**
2565
+ * 获取剪贴板文本内容
2566
+ * @param timeout 超时时间(秒),默认30秒
2567
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
2568
+ */
2569
+ static getClipboardText(timeout?: number): Promise<string>;
2570
+ }
2571
+
2572
+ /**
2573
+ * HTTP 响应数据接口定义
2574
+ */
2575
+ interface HttpResponse {
2576
+ statusCode: number;
2577
+ statusMessage: string;
2578
+ body: string;
2579
+ headers: Record<string, string>;
2580
+ }
2581
+ /**
2582
+ * HTTP 配置接口定义
2583
+ */
2584
+ interface HttpConfig {
2585
+ connectTimeout?: number;
2586
+ readTimeout?: number;
2587
+ writeTimeout?: number;
2588
+ }
2589
+ /**
2590
+ * HTTP 下载响应接口定义
2591
+ */
2592
+ interface HttpDownloadResponse {
2593
+ statusCode: number;
2594
+ statusMessage: string;
2595
+ savePath: string;
2596
+ fileSize: number;
2597
+ saveToGallerySuccess?: boolean;
2598
+ galleryUri?: string;
2599
+ galleryId?: number;
2600
+ galleryType?: string;
2601
+ headers: Record<string, string>;
2602
+ }
2603
+ /**
2604
+ * 文件上传信息接口定义
2605
+ */
2606
+ interface FileUploadInfo {
2607
+ filePath: string;
2608
+ fieldName?: string;
2609
+ fileName?: string;
2610
+ contentType?: string;
2611
+ }
2612
+ declare class Http {
2613
+ /**
2614
+ * 执行异步调用
2615
+ * @param method 方法名
2616
+ * @param args 参数对象
2617
+ * @param timeout 超时时间(秒),默认30秒
2618
+ * @returns Promise<调用响应>
2619
+ */
2620
+ private asyncCall;
2621
+ /**
2622
+ * 执行 GET 请求
2623
+ * @param url 请求 URL
2624
+ * @param headers 请求头
2625
+ * @param timeout 超时时间(秒),默认30秒
2626
+ * @returns Promise<HTTP响应>
2627
+ */
2628
+ httpGet(url: string, headers?: Record<string, string>, timeout?: number): Promise<HttpResponse>;
2629
+ /**
2630
+ * 执行 POST 请求
2631
+ * @param url 请求 URL
2632
+ * @param body 请求体
2633
+ * @param headers 请求头
2634
+ * @param timeout 超时时间(秒),默认30秒
2635
+ * @returns Promise<HTTP响应>
2636
+ */
2637
+ httpPost(url: string, body: string, headers?: Record<string, string>, timeout?: number): Promise<HttpResponse>;
2638
+ /**
2639
+ * 执行文件上传 POST 请求
2640
+ * 支持单个文件和多文件上传,同时支持多个表单字段
2641
+ *
2642
+ * @param url 请求 URL(必需)
2643
+ * @param files 文件数组(必需),每个文件对象包含:
2644
+ * - filePath: 文件路径(必需)
2645
+ * - fieldName: 字段名(可选,默认 "file")
2646
+ * - fileName: 文件名(可选,默认使用文件原名)
2647
+ * - contentType: 文件类型(可选,默认 "application/octet-stream")
2648
+ * @param formData 表单字段(可选),支持字符串值或字符串数组(同名字段多个值)
2649
+ * @param headers 请求头(可选)
2650
+ * @param timeout 超时时间(秒),默认30秒
2651
+ * @returns Promise<HTTP响应>
2652
+ *
2653
+ * @example
2654
+ * // 单文件上传
2655
+ * await http.httpPostFile("https://example.com/upload", [
2656
+ * { filePath: "/path/to/file.jpg", fieldName: "file" }
2657
+ * ]);
2658
+ *
2659
+ * @example
2660
+ * // 多文件上传
2661
+ * await http.httpPostFile("https://example.com/upload", [
2662
+ * { filePath: "/path/to/file1.jpg", fieldName: "file1" },
2663
+ * { filePath: "/path/to/file2.jpg", fieldName: "file2" }
2664
+ * ], { description: "My files" });
2665
+ */
2666
+ httpPostFile(url: string, files: FileUploadInfo[], formData?: Record<string, string | string[]>, headers?: Record<string, string>, timeout?: number): Promise<HttpResponse>;
2667
+ /**
2668
+ * 下载文件
2669
+ * @param url 下载 URL
2670
+ * @param savePath 保存路径
2671
+ * @param headers 请求头
2672
+ * @param saveToGallery 是否保存到系统相册(仅支持图片和视频文件),默认 false
2673
+ * @param displayName 保存到相册时的显示名称(可选,默认使用文件名)
2674
+ * @param timeout 超时时间(秒),默认30秒
2675
+ * @returns Promise<下载响应>
2676
+ */
2677
+ httpDownload(url: string, savePath: string, headers?: Record<string, string>, saveToGallery?: boolean, displayName?: string, timeout?: number): Promise<HttpDownloadResponse>;
2678
+ /**
2679
+ * 配置 OkHttpClient
2680
+ * @param config 配置选项
2681
+ * @param timeout 超时时间(秒),默认30秒
2682
+ * @returns Promise<配置信息>
2683
+ */
2684
+ httpConfigure(config: HttpConfig, timeout?: number): Promise<HttpConfig>;
2685
+ /**
2686
+ * 重置 OkHttpClient 配置
2687
+ * @param timeout 超时时间(秒),默认30秒
2688
+ * @returns Promise<配置信息>
2689
+ */
2690
+ httpReset(timeout?: number): Promise<HttpConfig>;
2691
+ /**
2692
+ * 获取当前配置信息
2693
+ * @param timeout 超时时间(秒),默认30秒
2694
+ * @returns Promise<配置信息>
2695
+ */
2696
+ httpGetConfig(timeout?: number): Promise<HttpConfig>;
2697
+ }
2698
+ declare const http: Http;
2699
+
2700
+ declare class Path {
2701
+ /**
2702
+ * 执行异步调用
2703
+ * @param method 方法名
2704
+ * @param args 参数对象
2705
+ * @param timeout 超时时间(秒),默认30秒
2706
+ * @returns Promise<调用响应>
2707
+ */
2708
+ private asyncCall;
2709
+ /**
2710
+ * 获取根路径
2711
+ * @param timeout 超时时间(秒),默认30秒
2712
+ * @returns Promise<路径字符串>
2713
+ */
2714
+ getRootPath(timeout?: number): Promise<string>;
2715
+ /**
2716
+ * 获取数据路径
2717
+ * @param timeout 超时时间(秒),默认30秒
2718
+ * @returns Promise<路径字符串>
2719
+ */
2720
+ getDataPath(timeout?: number): Promise<string>;
2721
+ /**
2722
+ * 获取下载缓存路径
2723
+ * @param timeout 超时时间(秒),默认30秒
2724
+ * @returns Promise<路径字符串>
2725
+ */
2726
+ getDownloadCachePath(timeout?: number): Promise<string>;
2727
+ /**
2728
+ * 获取内部应用数据路径
2729
+ * @param timeout 超时时间(秒),默认30秒
2730
+ * @returns Promise<路径字符串>
2731
+ */
2732
+ getInternalAppDataPath(timeout?: number): Promise<string>;
2733
+ /**
2734
+ * 获取内部应用代码缓存目录
2735
+ * @param timeout 超时时间(秒),默认30秒
2736
+ * @returns Promise<路径字符串>
2737
+ */
2738
+ getInternalAppCodeCacheDir(timeout?: number): Promise<string>;
2739
+ /**
2740
+ * 获取内部应用缓存路径
2741
+ * @param timeout 超时时间(秒),默认30秒
2742
+ * @returns Promise<路径字符串>
2743
+ */
2744
+ getInternalAppCachePath(timeout?: number): Promise<string>;
2745
+ /**
2746
+ * 获取内部应用数据库路径
2747
+ * @param timeout 超时时间(秒),默认30秒
2748
+ * @returns Promise<路径字符串>
2749
+ */
2750
+ getInternalAppDbsPath(timeout?: number): Promise<string>;
2751
+ /**
2752
+ * 获取内部应用数据库文件路径
2753
+ * @param dbName 数据库名称
2754
+ * @param timeout 超时时间(秒),默认30秒
2755
+ * @returns Promise<路径字符串>
2756
+ */
2757
+ getInternalAppDbPath(dbName: string, timeout?: number): Promise<string>;
2758
+ /**
2759
+ * 获取内部应用文件路径
2760
+ * @param timeout 超时时间(秒),默认30秒
2761
+ * @returns Promise<路径字符串>
2762
+ */
2763
+ getInternalAppFilesPath(timeout?: number): Promise<string>;
2764
+ /**
2765
+ * 获取内部应用 SharedPreferences 路径
2766
+ * @param timeout 超时时间(秒),默认30秒
2767
+ * @returns Promise<路径字符串>
2768
+ */
2769
+ getInternalAppSpPath(timeout?: number): Promise<string>;
2770
+ /**
2771
+ * 获取内部应用无备份文件路径
2772
+ * @param timeout 超时时间(秒),默认30秒
2773
+ * @returns Promise<路径字符串>
2774
+ */
2775
+ getInternalAppNoBackupFilesPath(timeout?: number): Promise<string>;
2776
+ /**
2777
+ * 获取外部存储路径
2778
+ * @param timeout 超时时间(秒),默认30秒
2779
+ * @returns Promise<路径字符串>
2780
+ */
2781
+ getExternalStoragePath(timeout?: number): Promise<string>;
2782
+ /**
2783
+ * 获取外部音乐路径
2784
+ * @param timeout 超时时间(秒),默认30秒
2785
+ * @returns Promise<路径字符串>
2786
+ */
2787
+ getExternalMusicPath(timeout?: number): Promise<string>;
2788
+ /**
2789
+ * 获取外部播客路径
2790
+ * @param timeout 超时时间(秒),默认30秒
2791
+ * @returns Promise<路径字符串>
2792
+ */
2793
+ getExternalPodcastsPath(timeout?: number): Promise<string>;
2794
+ /**
2795
+ * 获取外部铃声路径
2796
+ * @param timeout 超时时间(秒),默认30秒
2797
+ * @returns Promise<路径字符串>
2798
+ */
2799
+ getExternalRingtonesPath(timeout?: number): Promise<string>;
2800
+ /**
2801
+ * 获取外部闹钟路径
2802
+ * @param timeout 超时时间(秒),默认30秒
2803
+ * @returns Promise<路径字符串>
2804
+ */
2805
+ getExternalAlarmsPath(timeout?: number): Promise<string>;
2806
+ /**
2807
+ * 获取外部通知路径
2808
+ * @param timeout 超时时间(秒),默认30秒
2809
+ * @returns Promise<路径字符串>
2810
+ */
2811
+ getExternalNotificationsPath(timeout?: number): Promise<string>;
2812
+ /**
2813
+ * 获取外部图片路径
2814
+ * @param timeout 超时时间(秒),默认30秒
2815
+ * @returns Promise<路径字符串>
2816
+ */
2817
+ getExternalPicturesPath(timeout?: number): Promise<string>;
2818
+ /**
2819
+ * 获取外部电影路径
2820
+ * @param timeout 超时时间(秒),默认30秒
2821
+ * @returns Promise<路径字符串>
2822
+ */
2823
+ getExternalMoviesPath(timeout?: number): Promise<string>;
2824
+ /**
2825
+ * 获取外部下载路径
2826
+ * @param timeout 超时时间(秒),默认30秒
2827
+ * @returns Promise<路径字符串>
2828
+ */
2829
+ getExternalDownloadsPath(timeout?: number): Promise<string>;
2830
+ /**
2831
+ * 获取外部 DCIM 路径
2832
+ * @param timeout 超时时间(秒),默认30秒
2833
+ * @returns Promise<路径字符串>
2834
+ */
2835
+ getExternalDcimPath(timeout?: number): Promise<string>;
2836
+ /**
2837
+ * 获取外部文档路径
2838
+ * @param timeout 超时时间(秒),默认30秒
2839
+ * @returns Promise<路径字符串>
2840
+ */
2841
+ getExternalDocumentsPath(timeout?: number): Promise<string>;
2842
+ /**
2843
+ * 获取外部应用数据路径
2844
+ * @param timeout 超时时间(秒),默认30秒
2845
+ * @returns Promise<路径字符串>
2846
+ */
2847
+ getExternalAppDataPath(timeout?: number): Promise<string>;
2848
+ /**
2849
+ * 获取外部应用缓存路径
2850
+ * @param timeout 超时时间(秒),默认30秒
2851
+ * @returns Promise<路径字符串>
2852
+ */
2853
+ getExternalAppCachePath(timeout?: number): Promise<string>;
2854
+ /**
2855
+ * 获取外部应用文件路径
2856
+ * @param timeout 超时时间(秒),默认30秒
2857
+ * @returns Promise<路径字符串>
2858
+ */
2859
+ getExternalAppFilesPath(timeout?: number): Promise<string>;
2860
+ /**
2861
+ * 获取外部应用音乐路径
2862
+ * @param timeout 超时时间(秒),默认30秒
2863
+ * @returns Promise<路径字符串>
2864
+ */
2865
+ getExternalAppMusicPath(timeout?: number): Promise<string>;
2866
+ /**
2867
+ * 获取外部应用播客路径
2868
+ * @param timeout 超时时间(秒),默认30秒
2869
+ * @returns Promise<路径字符串>
2870
+ */
2871
+ getExternalAppPodcastsPath(timeout?: number): Promise<string>;
2872
+ /**
2873
+ * 获取外部应用铃声路径
2874
+ * @param timeout 超时时间(秒),默认30秒
2875
+ * @returns Promise<路径字符串>
2876
+ */
2877
+ getExternalAppRingtonesPath(timeout?: number): Promise<string>;
2878
+ /**
2879
+ * 获取外部应用闹钟路径
2880
+ * @param timeout 超时时间(秒),默认30秒
2881
+ * @returns Promise<路径字符串>
2882
+ */
2883
+ getExternalAppAlarmsPath(timeout?: number): Promise<string>;
2884
+ /**
2885
+ * 获取外部应用通知路径
2886
+ * @param timeout 超时时间(秒),默认30秒
2887
+ * @returns Promise<路径字符串>
2888
+ */
2889
+ getExternalAppNotificationsPath(timeout?: number): Promise<string>;
2890
+ /**
2891
+ * 获取外部应用图片路径
2892
+ * @param timeout 超时时间(秒),默认30秒
2893
+ * @returns Promise<路径字符串>
2894
+ */
2895
+ getExternalAppPicturesPath(timeout?: number): Promise<string>;
2896
+ /**
2897
+ * 获取外部应用电影路径
2898
+ * @param timeout 超时时间(秒),默认30秒
2899
+ * @returns Promise<路径字符串>
2900
+ */
2901
+ getExternalAppMoviesPath(timeout?: number): Promise<string>;
2902
+ /**
2903
+ * 获取外部应用下载路径
2904
+ * @param timeout 超时时间(秒),默认30秒
2905
+ * @returns Promise<路径字符串>
2906
+ */
2907
+ getExternalAppDownloadPath(timeout?: number): Promise<string>;
2908
+ /**
2909
+ * 获取外部应用 DCIM 路径
2910
+ * @param timeout 超时时间(秒),默认30秒
2911
+ * @returns Promise<路径字符串>
2912
+ */
2913
+ getExternalAppDcimPath(timeout?: number): Promise<string>;
2914
+ /**
2915
+ * 获取外部应用文档路径
2916
+ * @param timeout 超时时间(秒),默认30秒
2917
+ * @returns Promise<路径字符串>
2918
+ */
2919
+ getExternalAppDocumentsPath(timeout?: number): Promise<string>;
2920
+ /**
2921
+ * 获取外部应用 OBB 路径
2922
+ * @param timeout 超时时间(秒),默认30秒
2923
+ * @returns Promise<路径字符串>
2924
+ */
2925
+ getExternalAppObbPath(timeout?: number): Promise<string>;
2926
+ /**
2927
+ * 获取根路径(优先外部存储)
2928
+ * @param timeout 超时时间(秒),默认30秒
2929
+ * @returns Promise<路径字符串>
2930
+ */
2931
+ getRootPathExternalFirst(timeout?: number): Promise<string>;
2932
+ /**
2933
+ * 获取应用数据路径(优先外部存储)
2934
+ * @param timeout 超时时间(秒),默认30秒
2935
+ * @returns Promise<路径字符串>
2936
+ */
2937
+ getAppDataPathExternalFirst(timeout?: number): Promise<string>;
2938
+ /**
2939
+ * 获取文件路径(优先外部存储)
2940
+ * @param timeout 超时时间(秒),默认30秒
2941
+ * @returns Promise<路径字符串>
2942
+ */
2943
+ getFilesPathExternalFirst(timeout?: number): Promise<string>;
2944
+ /**
2945
+ * 获取缓存路径(优先外部存储)
2946
+ * @param timeout 超时时间(秒),默认30秒
2947
+ * @returns Promise<路径字符串>
2948
+ */
2949
+ getCachePathExternalFirst(timeout?: number): Promise<string>;
2950
+ }
2951
+ declare const pathUtils: Path;
2952
+
2953
+ declare class FileIO {
2954
+ /**
2955
+ * 执行异步调用
2956
+ * @param method 方法名
2957
+ * @param args 参数对象
2958
+ * @param timeout 超时时间(秒),默认30秒
2959
+ * @returns Promise<调用响应>
2960
+ */
2961
+ private asyncCall;
2962
+ /**
2963
+ * 从输入流写入文件
2964
+ * @param filePath 文件路径
2965
+ * @param inputStreamBase64 Base64 编码的输入流数据
2966
+ * @param append 是否追加,默认为 false
2967
+ * @param timeout 超时时间(秒),默认30秒
2968
+ * @returns Promise<是否成功>
2969
+ */
2970
+ writeFileFromIS(filePath: string, inputStreamBase64: string, append?: boolean, timeout?: number): Promise<boolean>;
2971
+ /**
2972
+ * 从字节数组写入文件(使用流)
2973
+ * @param filePath 文件路径
2974
+ * @param bytesBase64 Base64 编码的字节数组
2975
+ * @param append 是否追加,默认为 false
2976
+ * @param timeout 超时时间(秒),默认30秒
2977
+ * @returns Promise<是否成功>
2978
+ */
2979
+ writeFileFromBytesByStream(filePath: string, bytesBase64: string, append?: boolean, timeout?: number): Promise<boolean>;
2980
+ /**
2981
+ * 从字节数组写入文件(使用通道)
2982
+ * @param filePath 文件路径
2983
+ * @param bytesBase64 Base64 编码的字节数组
2984
+ * @param append 是否追加,默认为 false
2985
+ * @param timeout 超时时间(秒),默认30秒
2986
+ * @returns Promise<是否成功>
2987
+ */
2988
+ writeFileFromBytesByChannel(filePath: string, bytesBase64: string, append?: boolean, timeout?: number): Promise<boolean>;
2989
+ /**
2990
+ * 从字节数组写入文件(使用内存映射)
2991
+ * @param filePath 文件路径
2992
+ * @param bytesBase64 Base64 编码的字节数组
2993
+ * @param append 是否追加,默认为 false
2994
+ * @param timeout 超时时间(秒),默认30秒
2995
+ * @returns Promise<是否成功>
2996
+ */
2997
+ writeFileFromBytesByMap(filePath: string, bytesBase64: string, append?: boolean, timeout?: number): Promise<boolean>;
2998
+ /**
2999
+ * 从字符串写入文件
3000
+ * @param filePath 文件路径
3001
+ * @param content 文件内容
3002
+ * @param append 是否追加,默认为 false
3003
+ * @param threadSafe 是否线程安全写入,默认为 false
3004
+ * @param timeout 超时时间(秒),默认30秒
3005
+ * @returns Promise<是否成功>
3006
+ */
3007
+ writeFileFromString(filePath: string, content: string, append?: boolean, threadSafe?: boolean, timeout?: number): Promise<boolean>;
3008
+ /**
3009
+ * 读取文件为字符串列表
3010
+ * @param filePath 文件路径
3011
+ * @param charsetName 字符集名称,默认为 "UTF-8"
3012
+ * @param timeout 超时时间(秒),默认30秒
3013
+ * @returns Promise<字符串数组>
3014
+ */
3015
+ readFile2List(filePath: string, charsetName?: string, timeout?: number): Promise<string[]>;
3016
+ /**
3017
+ * 读取文件为字符串
3018
+ * @param filePath 文件路径
3019
+ * @param charsetName 字符集名称,默认为 "UTF-8"
3020
+ * @param timeout 超时时间(秒),默认30秒
3021
+ * @returns Promise<文件内容字符串>
3022
+ */
3023
+ readFile2String(filePath: string, charsetName?: string, timeout?: number): Promise<string>;
3024
+ /**
3025
+ * 读取文件为字节数组(使用流)
3026
+ * @param filePath 文件路径
3027
+ * @param timeout 超时时间(秒),默认30秒
3028
+ * @returns Promise<Base64 编码的字节数组>
3029
+ */
3030
+ readFile2BytesByStream(filePath: string, timeout?: number): Promise<string>;
3031
+ /**
3032
+ * 读取文件为字节数组(使用通道)
3033
+ * @param filePath 文件路径
3034
+ * @param timeout 超时时间(秒),默认30秒
3035
+ * @returns Promise<Base64 编码的字节数组>
3036
+ */
3037
+ readFile2BytesByChannel(filePath: string, timeout?: number): Promise<string>;
3038
+ /**
3039
+ * 读取文件为字节数组(使用内存映射)
3040
+ * @param filePath 文件路径
3041
+ * @param timeout 超时时间(秒),默认30秒
3042
+ * @returns Promise<Base64 编码的字节数组>
3043
+ */
3044
+ readFile2BytesByMap(filePath: string, timeout?: number): Promise<string>;
3045
+ /**
3046
+ * 设置缓冲区大小
3047
+ * @param bufferSize 缓冲区大小(字节)
3048
+ * @param timeout 超时时间(秒),默认30秒
3049
+ * @returns Promise<是否成功>
3050
+ */
3051
+ setBufferSize(bufferSize: number, timeout?: number): Promise<boolean>;
3052
+ }
3053
+ declare const fileIO: FileIO;
3054
+
3055
+ /**
3056
+ * 文件信息接口定义
3057
+ */
3058
+ interface FileInfo {
3059
+ path: string;
3060
+ exists: boolean;
3061
+ }
3062
+ /**
3063
+ * 文件列表项接口定义
3064
+ */
3065
+ interface FileListItem {
3066
+ path: string;
3067
+ name: string;
3068
+ isDirectory: boolean;
3069
+ length: number;
3070
+ }
3071
+ declare class FileUtils {
3072
+ /**
3073
+ * 执行异步调用
3074
+ * @param method 方法名
3075
+ * @param args 参数对象
3076
+ * @param timeout 超时时间(秒),默认30秒
3077
+ * @returns Promise<调用响应>
3078
+ */
3079
+ private asyncCall;
3080
+ /**
3081
+ * 根据路径获取文件
3082
+ * @param filePath 文件路径
3083
+ * @param timeout 超时时间(秒),默认30秒
3084
+ * @returns Promise<文件信息>
3085
+ */
3086
+ getFileByPath(filePath: string, timeout?: number): Promise<FileInfo>;
3087
+ /**
3088
+ * 检查文件是否存在
3089
+ * @param filePath 文件路径
3090
+ * @param timeout 超时时间(秒),默认30秒
3091
+ * @returns Promise<是否存在>
3092
+ */
3093
+ isFileExists(filePath: string, timeout?: number): Promise<boolean>;
3094
+ /**
3095
+ * 重命名文件
3096
+ * @param filePath 文件路径
3097
+ * @param newName 新名称
3098
+ * @param timeout 超时时间(秒),默认30秒
3099
+ * @returns Promise<是否成功>
3100
+ */
3101
+ rename(filePath: string, newName: string, timeout?: number): Promise<boolean>;
3102
+ /**
3103
+ * 检查是否为目录
3104
+ * @param filePath 文件路径
3105
+ * @param timeout 超时时间(秒),默认30秒
3106
+ * @returns Promise<是否为目录>
3107
+ */
3108
+ isDir(filePath: string, timeout?: number): Promise<boolean>;
3109
+ /**
3110
+ * 检查是否为文件
3111
+ * @param filePath 文件路径
3112
+ * @param timeout 超时时间(秒),默认30秒
3113
+ * @returns Promise<是否为文件>
3114
+ */
3115
+ isFile(filePath: string, timeout?: number): Promise<boolean>;
3116
+ /**
3117
+ * 创建或存在目录
3118
+ * @param dirPath 目录路径
3119
+ * @param timeout 超时时间(秒),默认30秒
3120
+ * @returns Promise<是否成功>
3121
+ */
3122
+ createOrExistsDir(dirPath: string, timeout?: number): Promise<boolean>;
3123
+ /**
3124
+ * 创建或存在文件
3125
+ * @param filePath 文件路径
3126
+ * @param timeout 超时时间(秒),默认30秒
3127
+ * @returns Promise<是否成功>
3128
+ */
3129
+ createOrExistsFile(filePath: string, timeout?: number): Promise<boolean>;
3130
+ /**
3131
+ * 创建文件(如果存在则删除旧文件)
3132
+ * @param filePath 文件路径
3133
+ * @param timeout 超时时间(秒),默认30秒
3134
+ * @returns Promise<是否成功>
3135
+ */
3136
+ createFileByDeleteOldFile(filePath: string, timeout?: number): Promise<boolean>;
3137
+ /**
3138
+ * 复制文件
3139
+ * @param srcFilePath 源文件路径
3140
+ * @param destFilePath 目标文件路径
3141
+ * @param timeout 超时时间(秒),默认30秒
3142
+ * @returns Promise<是否成功>
3143
+ */
3144
+ copy(srcFilePath: string, destFilePath: string, timeout?: number): Promise<boolean>;
3145
+ /**
3146
+ * 移动文件
3147
+ * @param srcFilePath 源文件路径
3148
+ * @param destFilePath 目标文件路径
3149
+ * @param timeout 超时时间(秒),默认30秒
3150
+ * @returns Promise<是否成功>
3151
+ */
3152
+ move(srcFilePath: string, destFilePath: string, timeout?: number): Promise<boolean>;
3153
+ /**
3154
+ * 删除文件或目录
3155
+ * @param filePath 文件路径
3156
+ * @param timeout 超时时间(秒),默认30秒
3157
+ * @returns Promise<是否成功>
3158
+ */
3159
+ delete(filePath: string, timeout?: number): Promise<boolean>;
3160
+ /**
3161
+ * 删除目录中的所有内容
3162
+ * @param dirPath 目录路径
3163
+ * @param timeout 超时时间(秒),默认30秒
3164
+ * @returns Promise<是否成功>
3165
+ */
3166
+ deleteAllInDir(dirPath: string, timeout?: number): Promise<boolean>;
3167
+ /**
3168
+ * 删除目录中的所有文件
3169
+ * @param dirPath 目录路径
3170
+ * @param timeout 超时时间(秒),默认30秒
3171
+ * @returns Promise<是否成功>
3172
+ */
3173
+ deleteFilesInDir(dirPath: string, timeout?: number): Promise<boolean>;
3174
+ /**
3175
+ * 删除目录中匹配过滤器的文件
3176
+ * @param dirPath 目录路径
3177
+ * @param filterPattern 过滤模式(正则表达式)
3178
+ * @param timeout 超时时间(秒),默认30秒
3179
+ * @returns Promise<是否成功>
3180
+ */
3181
+ deleteFilesInDirWithFilter(dirPath: string, filterPattern?: string, timeout?: number): Promise<boolean>;
3182
+ /**
3183
+ * 列出目录中的文件
3184
+ * @param dirPath 目录路径
3185
+ * @param timeout 超时时间(秒),默认30秒
3186
+ * @returns Promise<文件列表>
3187
+ */
3188
+ listFilesInDir(dirPath: string, timeout?: number): Promise<FileListItem[]>;
3189
+ /**
3190
+ * 列出目录中匹配过滤器的文件
3191
+ * @param dirPath 目录路径
3192
+ * @param filterPattern 过滤模式(正则表达式)
3193
+ * @param timeout 超时时间(秒),默认30秒
3194
+ * @returns Promise<文件列表>
3195
+ */
3196
+ listFilesInDirWithFilter(dirPath: string, filterPattern?: string, timeout?: number): Promise<FileListItem[]>;
3197
+ /**
3198
+ * 获取文件最后修改时间
3199
+ * @param filePath 文件路径
3200
+ * @param timeout 超时时间(秒),默认30秒
3201
+ * @returns Promise<时间戳(毫秒)>
3202
+ */
3203
+ getFileLastModified(filePath: string, timeout?: number): Promise<number>;
3204
+ /**
3205
+ * 获取文件字符集(简单检测)
3206
+ * @param filePath 文件路径
3207
+ * @param timeout 超时时间(秒),默认30秒
3208
+ * @returns Promise<字符集名称>
3209
+ */
3210
+ getFileCharsetSimple(filePath: string, timeout?: number): Promise<string>;
3211
+ /**
3212
+ * 获取文件行数
3213
+ * @param filePath 文件路径
3214
+ * @param timeout 超时时间(秒),默认30秒
3215
+ * @returns Promise<行数>
3216
+ */
3217
+ getFileLines(filePath: string, timeout?: number): Promise<number>;
3218
+ /**
3219
+ * 获取文件或目录大小
3220
+ * @param filePath 文件路径
3221
+ * @param timeout 超时时间(秒),默认30秒
3222
+ * @returns Promise<大小(字节)>
3223
+ */
3224
+ getSize(filePath: string, timeout?: number): Promise<number>;
3225
+ /**
3226
+ * 获取文件长度
3227
+ * @param filePath 文件路径
3228
+ * @param timeout 超时时间(秒),默认30秒
3229
+ * @returns Promise<长度(字节)>
3230
+ */
3231
+ getLength(filePath: string, timeout?: number): Promise<number>;
3232
+ /**
3233
+ * 获取文件 MD5(Base64 编码)
3234
+ * @param filePath 文件路径
3235
+ * @param timeout 超时时间(秒),默认30秒
3236
+ * @returns Promise<Base64 编码的 MD5>
3237
+ */
3238
+ getFileMD5(filePath: string, timeout?: number): Promise<string>;
3239
+ /**
3240
+ * 获取文件 MD5(字符串)
3241
+ * @param filePath 文件路径
3242
+ * @param timeout 超时时间(秒),默认30秒
3243
+ * @returns Promise<MD5 字符串>
3244
+ */
3245
+ getFileMD5ToString(filePath: string, timeout?: number): Promise<string>;
3246
+ /**
3247
+ * 获取目录名
3248
+ * @param filePath 文件路径
3249
+ * @param timeout 超时时间(秒),默认30秒
3250
+ * @returns Promise<目录名>
3251
+ */
3252
+ getDirName(filePath: string, timeout?: number): Promise<string>;
3253
+ /**
3254
+ * 获取文件名
3255
+ * @param filePath 文件路径
3256
+ * @param timeout 超时时间(秒),默认30秒
3257
+ * @returns Promise<文件名>
3258
+ */
3259
+ getFileName(filePath: string, timeout?: number): Promise<string>;
3260
+ /**
3261
+ * 获取文件名(不含扩展名)
3262
+ * @param filePath 文件路径
3263
+ * @param timeout 超时时间(秒),默认30秒
3264
+ * @returns Promise<文件名(不含扩展名)>
3265
+ */
3266
+ getFileNameNoExtension(filePath: string, timeout?: number): Promise<string>;
3267
+ /**
3268
+ * 获取文件扩展名
3269
+ * @param filePath 文件路径
3270
+ * @param timeout 超时时间(秒),默认30秒
3271
+ * @returns Promise<扩展名>
3272
+ */
3273
+ getFileExtension(filePath: string, timeout?: number): Promise<string>;
3274
+ /**
3275
+ * 通知系统扫描文件
3276
+ * @param filePath 文件路径
3277
+ * @param timeout 超时时间(秒),默认30秒
3278
+ * @returns Promise<是否成功>
3279
+ */
3280
+ notifySystemToScan(filePath: string, timeout?: number): Promise<boolean>;
3281
+ /**
3282
+ * 获取文件系统总大小
3283
+ * @param filePath 文件路径
3284
+ * @param timeout 超时时间(秒),默认30秒
3285
+ * @returns Promise<总大小(字节)>
3286
+ */
3287
+ getFsTotalSize(filePath: string, timeout?: number): Promise<number>;
3288
+ /**
3289
+ * 获取文件系统可用大小
3290
+ * @param filePath 文件路径
3291
+ * @param timeout 超时时间(秒),默认30秒
3292
+ * @returns Promise<可用大小(字节)>
3293
+ */
3294
+ getFsAvailableSize(filePath: string, timeout?: number): Promise<number>;
3295
+ }
3296
+ declare const fileUtils: FileUtils;
3297
+
3298
+ /**
3299
+ * IME 动作 ID 常量
3300
+ */
3301
+ declare enum ImeAction {
3302
+ /** 无动作 */
3303
+ NONE = 0,
3304
+ /** 前往 */
3305
+ GO = 2,
3306
+ /** 搜索 */
3307
+ SEARCH = 3,
3308
+ /** 发送 */
3309
+ SEND = 4,
3310
+ /** 下一步 */
3311
+ NEXT = 5,
3312
+ /** 完成 */
3313
+ DONE = 6,
3314
+ /** 上一个 */
3315
+ PREVIOUS = 7
3316
+ }
3317
+ /**
3318
+ * 执行编辑器动作响应接口定义
3319
+ */
3320
+ interface PerformEditorActionResponse {
3321
+ success: boolean;
3322
+ actionId: number;
3323
+ }
3324
+ /**
3325
+ * 打开输入法设置响应接口定义
3326
+ */
3327
+ interface OpenInputMethodSettingsResponse {
3328
+ success: boolean;
3329
+ }
3330
+ /**
3331
+ * 检查输入法是否启用响应接口定义
3332
+ */
3333
+ interface IsInputMethodEnabledResponse {
3334
+ enabled: boolean;
3335
+ }
3336
+ /**
3337
+ * 检查当前选中的输入法是否是当前输入法响应接口定义
3338
+ */
3339
+ interface IsCurrentInputMethodResponse {
3340
+ isCurrent: boolean;
3341
+ }
3342
+ declare class Ime {
3343
+ /**
3344
+ * 执行异步调用
3345
+ * @param method 方法名
3346
+ * @param args 参数对象
3347
+ * @param timeout 超时时间(秒),默认30秒
3348
+ * @returns Promise<调用响应>
3349
+ */
3350
+ private asyncCall;
3351
+ /**
3352
+ * 执行编辑器动作(如搜索)
3353
+ * @param actionId 动作 ID,默认为 ImeAction.SEARCH
3354
+ * @param timeout 超时时间(秒),默认30秒
3355
+ * @returns Promise<执行结果>
3356
+ */
3357
+ performEditorAction(actionId?: number, timeout?: number): Promise<PerformEditorActionResponse>;
3358
+ /**
3359
+ * 跳转到输入法管理页面
3360
+ * @param timeout 超时时间(秒),默认30秒
3361
+ * @returns Promise<执行结果>
3362
+ */
3363
+ openInputMethodSettings(timeout?: number): Promise<OpenInputMethodSettingsResponse>;
3364
+ /**
3365
+ * 检查输入法是否启用
3366
+ * @param timeout 超时时间(秒),默认30秒
3367
+ * @returns Promise<检查结果>
3368
+ */
3369
+ isInputMethodEnabled(timeout?: number): Promise<IsInputMethodEnabledResponse>;
3370
+ /**
3371
+ * 检查当前选中的输入法是否是当前输入法
3372
+ * @param timeout 超时时间(秒),默认30秒
3373
+ * @returns Promise<检查结果>
3374
+ */
3375
+ isCurrentInputMethod(timeout?: number): Promise<IsCurrentInputMethodResponse>;
3376
+ }
3377
+ declare const ime: Ime;
3378
+
3379
+ /**
3380
+ * 图片尺寸信息
3381
+ */
3382
+ interface ImageSize {
3383
+ filePath: string;
3384
+ width: number;
3385
+ height: number;
3386
+ }
3387
+ /**
3388
+ * 图片类型信息
3389
+ */
3390
+ interface ImageType {
3391
+ filePath: string;
3392
+ imageType: string;
3393
+ }
3394
+ /**
3395
+ * 图片旋转角度信息
3396
+ */
3397
+ interface ImageRotateDegree {
3398
+ filePath: string;
3399
+ degree: number;
3400
+ }
3401
+ /**
3402
+ * 图片处理结果
3403
+ */
3404
+ interface ImageProcessResult {
3405
+ filePath: string;
3406
+ }
3407
+ /**
3408
+ * 图片保存结果
3409
+ */
3410
+ interface ImageSaveResult {
3411
+ success: boolean;
3412
+ filePath: string;
3413
+ }
3414
+ declare class ImageUtils {
3415
+ /**
3416
+ * 执行异步调用
3417
+ * @param method 方法名
3418
+ * @param args 参数对象
3419
+ * @param timeout 超时时间(秒),默认30秒
3420
+ * @returns Promise<调用响应>
3421
+ */
3422
+ private asyncCall;
3423
+ /**
3424
+ * 获取图片尺寸
3425
+ * @param imagePath 图片路径
3426
+ * @param timeout 超时时间(秒),默认30秒
3427
+ * @returns Promise<图片尺寸信息>
3428
+ */
3429
+ getSize(imagePath: string, timeout?: number): Promise<ImageSize>;
3430
+ /**
3431
+ * 获取图片类型
3432
+ * @param imagePath 图片路径
3433
+ * @param timeout 超时时间(秒),默认30秒
3434
+ * @returns Promise<图片类型信息>
3435
+ */
3436
+ getImageType(imagePath: string, timeout?: number): Promise<ImageType>;
3437
+ /**
3438
+ * 判断是否为图片
3439
+ * @param fileName 文件名
3440
+ * @param timeout 超时时间(秒),默认30秒
3441
+ * @returns Promise<是否为图片>
3442
+ */
3443
+ isImage(fileName: string, timeout?: number): Promise<boolean>;
3444
+ /**
3445
+ * 获取图片旋转角度
3446
+ * @param imagePath 图片路径
3447
+ * @param timeout 超时时间(秒),默认30秒
3448
+ * @returns Promise<图片旋转角度信息>
3449
+ */
3450
+ getRotateDegree(imagePath: string, timeout?: number): Promise<ImageRotateDegree>;
3451
+ /**
3452
+ * 缩放图片
3453
+ * @param imagePath 图片路径
3454
+ * @param options 缩放选项
3455
+ * @param options.scaleWidth 缩放宽度(可选)
3456
+ * @param options.scaleHeight 缩放高度(可选)
3457
+ * @param options.savePath 保存路径(可选)
3458
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3459
+ * @param options.timeout 超时时间(秒),默认30秒
3460
+ * @returns Promise<处理后的图片路径>
3461
+ */
3462
+ scale(imagePath: string, options?: {
3463
+ scaleWidth?: number;
3464
+ scaleHeight?: number;
3465
+ savePath?: string;
3466
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3467
+ timeout?: number;
3468
+ }): Promise<string>;
3469
+ /**
3470
+ * 裁剪图片
3471
+ * @param imagePath 图片路径
3472
+ * @param options 裁剪选项
3473
+ * @param options.x 起始X坐标,默认0
3474
+ * @param options.y 起始Y坐标,默认0
3475
+ * @param options.width 裁剪宽度(可选,不提供则裁剪到图片右边界)
3476
+ * @param options.height 裁剪高度(可选,不提供则裁剪到图片下边界)
3477
+ * @param options.savePath 保存路径(可选)
3478
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3479
+ * @param options.timeout 超时时间(秒),默认30秒
3480
+ * @returns Promise<处理后的图片路径>
3481
+ */
3482
+ clip(imagePath: string, options?: {
3483
+ x?: number;
3484
+ y?: number;
3485
+ width?: number;
3486
+ height?: number;
3487
+ savePath?: string;
3488
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3489
+ timeout?: number;
3490
+ }): Promise<string>;
3491
+ /**
3492
+ * 倾斜图片
3493
+ * @param imagePath 图片路径
3494
+ * @param options 倾斜选项
3495
+ * @param options.kx X轴倾斜系数,默认0
3496
+ * @param options.ky Y轴倾斜系数,默认0
3497
+ * @param options.px X轴倾斜点(可选)
3498
+ * @param options.py Y轴倾斜点(可选)
3499
+ * @param options.savePath 保存路径(可选)
3500
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3501
+ * @param options.timeout 超时时间(秒),默认30秒
3502
+ * @returns Promise<处理后的图片路径>
3503
+ */
3504
+ skew(imagePath: string, options?: {
3505
+ kx?: number;
3506
+ ky?: number;
3507
+ px?: number;
3508
+ py?: number;
3509
+ savePath?: string;
3510
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3511
+ timeout?: number;
3512
+ }): Promise<string>;
3513
+ /**
3514
+ * 旋转图片
3515
+ * @param imagePath 图片路径
3516
+ * @param options 旋转选项
3517
+ * @param options.degree 旋转角度,默认0
3518
+ * @param options.px 旋转中心X坐标(可选)
3519
+ * @param options.py 旋转中心Y坐标(可选)
3520
+ * @param options.savePath 保存路径(可选)
3521
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3522
+ * @param options.timeout 超时时间(秒),默认30秒
3523
+ * @returns Promise<处理后的图片路径>
3524
+ */
3525
+ rotate(imagePath: string, options?: {
3526
+ degree?: number;
3527
+ px?: number;
3528
+ py?: number;
3529
+ savePath?: string;
3530
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3531
+ timeout?: number;
3532
+ }): Promise<string>;
3533
+ /**
3534
+ * 转为圆形图片
3535
+ * @param imagePath 图片路径
3536
+ * @param options 选项
3537
+ * @param options.savePath 保存路径(可选)
3538
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3539
+ * @param options.timeout 超时时间(秒),默认30秒
3540
+ * @returns Promise<处理后的图片路径>
3541
+ */
3542
+ toRound(imagePath: string, options?: {
3543
+ savePath?: string;
3544
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3545
+ timeout?: number;
3546
+ }): Promise<string>;
3547
+ /**
3548
+ * 转为圆角图片
3549
+ * @param imagePath 图片路径
3550
+ * @param options 选项
3551
+ * @param options.radius 圆角半径,默认0
3552
+ * @param options.savePath 保存路径(可选)
3553
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3554
+ * @param options.timeout 超时时间(秒),默认30秒
3555
+ * @returns Promise<处理后的图片路径>
3556
+ */
3557
+ toRoundCorner(imagePath: string, options?: {
3558
+ radius?: number;
3559
+ savePath?: string;
3560
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3561
+ timeout?: number;
3562
+ }): Promise<string>;
3563
+ /**
3564
+ * 添加圆角边框
3565
+ * @param imagePath 图片路径
3566
+ * @param options 选项
3567
+ * @param options.borderSize 边框大小,默认0
3568
+ * @param options.color 边框颜色,默认"#000000"
3569
+ * @param options.cornerRadius 圆角半径,默认0
3570
+ * @param options.savePath 保存路径(可选)
3571
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3572
+ * @param options.timeout 超时时间(秒),默认30秒
3573
+ * @returns Promise<处理后的图片路径>
3574
+ */
3575
+ addCornerBorder(imagePath: string, options?: {
3576
+ borderSize?: number;
3577
+ color?: string;
3578
+ cornerRadius?: number;
3579
+ savePath?: string;
3580
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3581
+ timeout?: number;
3582
+ }): Promise<string>;
3583
+ /**
3584
+ * 添加圆形边框
3585
+ * @param imagePath 图片路径
3586
+ * @param options 选项
3587
+ * @param options.borderSize 边框大小,默认0
3588
+ * @param options.color 边框颜色,默认"#000000"
3589
+ * @param options.savePath 保存路径(可选)
3590
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3591
+ * @param options.timeout 超时时间(秒),默认30秒
3592
+ * @returns Promise<处理后的图片路径>
3593
+ */
3594
+ addCircleBorder(imagePath: string, options?: {
3595
+ borderSize?: number;
3596
+ color?: string;
3597
+ savePath?: string;
3598
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3599
+ timeout?: number;
3600
+ }): Promise<string>;
3601
+ /**
3602
+ * 添加倒影
3603
+ * @param imagePath 图片路径
3604
+ * @param options 选项
3605
+ * @param options.reflectionHeight 倒影高度,默认0
3606
+ * @param options.savePath 保存路径(可选)
3607
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3608
+ * @param options.timeout 超时时间(秒),默认30秒
3609
+ * @returns Promise<处理后的图片路径>
3610
+ */
3611
+ addReflection(imagePath: string, options?: {
3612
+ reflectionHeight?: number;
3613
+ savePath?: string;
3614
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3615
+ timeout?: number;
3616
+ }): Promise<string>;
3617
+ /**
3618
+ * 添加文字水印
3619
+ * @param imagePath 图片路径
3620
+ * @param options 选项
3621
+ * @param options.text 水印文字,默认""
3622
+ * @param options.x 文字X坐标,默认0
3623
+ * @param options.y 文字Y坐标,默认0
3624
+ * @param options.color 文字颜色,默认"#000000"
3625
+ * @param options.size 文字大小,默认16
3626
+ * @param options.savePath 保存路径(可选)
3627
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3628
+ * @param options.timeout 超时时间(秒),默认30秒
3629
+ * @returns Promise<处理后的图片路径>
3630
+ */
3631
+ addTextWatermark(imagePath: string, options?: {
3632
+ text?: string;
3633
+ x?: number;
3634
+ y?: number;
3635
+ color?: string;
3636
+ size?: number;
3637
+ savePath?: string;
3638
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3639
+ timeout?: number;
3640
+ }): Promise<string>;
3641
+ /**
3642
+ * 添加图片水印
3643
+ * @param imagePath 图片路径
3644
+ * @param options 选项
3645
+ * @param options.watermarkPath 水印图片路径(必需)
3646
+ * @param options.x 水印X坐标,默认0
3647
+ * @param options.y 水印Y坐标,默认0
3648
+ * @param options.alpha 透明度,默认255
3649
+ * @param options.savePath 保存路径(可选)
3650
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3651
+ * @param options.timeout 超时时间(秒),默认30秒
3652
+ * @returns Promise<处理后的图片路径>
3653
+ */
3654
+ addImageWatermark(imagePath: string, options: {
3655
+ watermarkPath: string;
3656
+ x?: number;
3657
+ y?: number;
3658
+ alpha?: number;
3659
+ savePath?: string;
3660
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3661
+ timeout?: number;
3662
+ }): Promise<string>;
3663
+ /**
3664
+ * 转为 alpha 位图
3665
+ * @param imagePath 图片路径
3666
+ * @param options 选项
3667
+ * @param options.savePath 保存路径(可选)
3668
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3669
+ * @param options.timeout 超时时间(秒),默认30秒
3670
+ * @returns Promise<处理后的图片路径>
3671
+ */
3672
+ toAlpha(imagePath: string, options?: {
3673
+ savePath?: string;
3674
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3675
+ timeout?: number;
3676
+ }): Promise<string>;
3677
+ /**
3678
+ * 转为灰度图片
3679
+ * @param imagePath 图片路径
3680
+ * @param options 选项
3681
+ * @param options.savePath 保存路径(可选)
3682
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3683
+ * @param options.timeout 超时时间(秒),默认30秒
3684
+ * @returns Promise<处理后的图片路径>
3685
+ */
3686
+ toGray(imagePath: string, options?: {
3687
+ savePath?: string;
3688
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3689
+ timeout?: number;
3690
+ }): Promise<string>;
3691
+ /**
3692
+ * 快速模糊
3693
+ * @param imagePath 图片路径
3694
+ * @param options 选项
3695
+ * @param options.radius 模糊半径,默认0
3696
+ * @param options.scale 缩放比例,默认1
3697
+ * @param options.savePath 保存路径(可选)
3698
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3699
+ * @param options.timeout 超时时间(秒),默认30秒
3700
+ * @returns Promise<处理后的图片路径>
3701
+ */
3702
+ fastBlur(imagePath: string, options?: {
3703
+ radius?: number;
3704
+ scale?: number;
3705
+ savePath?: string;
3706
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3707
+ timeout?: number;
3708
+ }): Promise<string>;
3709
+ /**
3710
+ * RenderScript 模糊
3711
+ * @param imagePath 图片路径
3712
+ * @param options 选项
3713
+ * @param options.radius 模糊半径,默认0
3714
+ * @param options.savePath 保存路径(可选)
3715
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3716
+ * @param options.timeout 超时时间(秒),默认30秒
3717
+ * @returns Promise<处理后的图片路径>
3718
+ */
3719
+ renderScriptBlur(imagePath: string, options?: {
3720
+ radius?: number;
3721
+ savePath?: string;
3722
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3723
+ timeout?: number;
3724
+ }): Promise<string>;
3725
+ /**
3726
+ * Stack 模糊
3727
+ * @param imagePath 图片路径
3728
+ * @param options 选项
3729
+ * @param options.radius 模糊半径,默认0
3730
+ * @param options.savePath 保存路径(可选)
3731
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3732
+ * @param options.timeout 超时时间(秒),默认30秒
3733
+ * @returns Promise<处理后的图片路径>
3734
+ */
3735
+ stackBlur(imagePath: string, options?: {
3736
+ radius?: number;
3737
+ savePath?: string;
3738
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3739
+ timeout?: number;
3740
+ }): Promise<string>;
3741
+ /**
3742
+ * 按缩放压缩
3743
+ * @param imagePath 图片路径
3744
+ * @param options 选项
3745
+ * @param options.scaleWidth 缩放宽度(可选)
3746
+ * @param options.scaleHeight 缩放高度(可选)
3747
+ * @param options.savePath 保存路径(可选)
3748
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3749
+ * @param options.timeout 超时时间(秒),默认30秒
3750
+ * @returns Promise<压缩后的图片路径>
3751
+ */
3752
+ compressByScale(imagePath: string, options?: {
3753
+ scaleWidth?: number;
3754
+ scaleHeight?: number;
3755
+ savePath?: string;
3756
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3757
+ timeout?: number;
3758
+ }): Promise<string>;
3759
+ /**
3760
+ * 按质量压缩
3761
+ * @param imagePath 图片路径
3762
+ * @param options 选项
3763
+ * @param options.quality 压缩质量,0-100,默认100
3764
+ * @param options.format 图片格式,支持 "JPEG"、"PNG"、"WEBP",默认"JPEG"
3765
+ * @param options.savePath 保存路径(可选)
3766
+ * @param options.timeout 超时时间(秒),默认30秒
3767
+ * @returns Promise<压缩后的图片路径>
3768
+ */
3769
+ compressByQuality(imagePath: string, options?: {
3770
+ quality?: number;
3771
+ format?: "JPEG" | "PNG" | "WEBP";
3772
+ savePath?: string;
3773
+ timeout?: number;
3774
+ }): Promise<string>;
3775
+ /**
3776
+ * 按采样大小压缩
3777
+ * @param imagePath 图片路径
3778
+ * @param options 选项
3779
+ * @param options.sampleSize 采样大小,默认1
3780
+ * @param options.savePath 保存路径(可选)
3781
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3782
+ * @param options.timeout 超时时间(秒),默认30秒
3783
+ * @returns Promise<压缩后的图片路径>
3784
+ */
3785
+ compressBySampleSize(imagePath: string, options?: {
3786
+ sampleSize?: number;
3787
+ savePath?: string;
3788
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3789
+ timeout?: number;
3790
+ }): Promise<string>;
3791
+ /**
3792
+ * 保存图片
3793
+ * @param imagePath 图片路径
3794
+ * @param options 选项
3795
+ * @param options.savePath 保存路径(可选,不提供则自动生成)
3796
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3797
+ * @param options.timeout 超时时间(秒),默认30秒
3798
+ * @returns Promise<保存结果>
3799
+ */
3800
+ save(imagePath: string, options?: {
3801
+ savePath?: string;
3802
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3803
+ timeout?: number;
3804
+ }): Promise<ImageSaveResult>;
3805
+ /**
3806
+ * 保存图片到相册
3807
+ * @param imagePath 图片路径
3808
+ * @param options 选项
3809
+ * @param options.fileName 文件名(可选,不提供则自动生成)
3810
+ * @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认"PNG"
3811
+ * @param options.timeout 超时时间(秒),默认30秒
3812
+ * @returns Promise<保存结果>
3813
+ */
3814
+ save2Album(imagePath: string, options?: {
3815
+ fileName?: string;
3816
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP";
3817
+ timeout?: number;
3818
+ }): Promise<ImageSaveResult>;
3819
+ }
3820
+ declare const imageUtils: ImageUtils;
3821
+
3822
+ /**
3823
+ * 相册操作响应接口定义
3824
+ */
3825
+ interface GalleryResponse {
3826
+ success: boolean;
3827
+ uri?: string;
3828
+ id?: number;
3829
+ type?: string;
3830
+ message?: string;
3831
+ }
3832
+ /**
3833
+ * 删除相册项响应接口定义
3834
+ */
3835
+ interface GalleryDeleteResponse {
3836
+ success: boolean;
3837
+ deletedRows: number;
3838
+ message?: string;
3839
+ }
3840
+ declare class Gallery {
3841
+ /**
3842
+ * 执行异步调用
3843
+ * @param method 方法名
3844
+ * @param args 参数对象
3845
+ * @param timeout 超时时间(秒),默认30秒
3846
+ * @returns Promise<调用响应>
3847
+ */
3848
+ private asyncCall;
3849
+ /**
3850
+ * 添加图片到系统相册
3851
+ * @param filePath 图片文件路径(必需)
3852
+ * @param displayName 显示名称(可选,默认使用文件名)
3853
+ * @param timeout 超时时间(秒),默认30秒
3854
+ * @returns Promise<相册操作响应>
3855
+ */
3856
+ addImageToGallery(filePath: string, displayName?: string, timeout?: number): Promise<GalleryResponse>;
3857
+ /**
3858
+ * 添加视频到系统相册
3859
+ * @param filePath 视频文件路径(必需)
3860
+ * @param displayName 显示名称(可选,默认使用文件名)
3861
+ * @param timeout 超时时间(秒),默认30秒
3862
+ * @returns Promise<相册操作响应>
3863
+ */
3864
+ addVideoToGallery(filePath: string, displayName?: string, timeout?: number): Promise<GalleryResponse>;
3865
+ /**
3866
+ * 从系统相册删除
3867
+ * @param uri 媒体文件的URI(必需,格式如:content://media/external/images/media/123)
3868
+ * @param timeout 超时时间(秒),默认30秒
3869
+ * @returns Promise<删除响应>
3870
+ */
3871
+ deleteFromGalleryByUri(uri: string, timeout?: number): Promise<GalleryDeleteResponse>;
3872
+ /**
3873
+ * 从系统相册删除(通过ID和类型)
3874
+ * @param id 媒体文件的ID(必需)
3875
+ * @param type 媒体类型,"image" 或 "video"(必需)
3876
+ * @param timeout 超时时间(秒),默认30秒
3877
+ * @returns Promise<删除响应>
3878
+ */
3879
+ deleteFromGalleryById(id: number, type: "image" | "video", timeout?: number): Promise<GalleryDeleteResponse>;
3880
+ }
3881
+ declare const gallery: Gallery;
3882
+
3883
+ /**
3884
+ * 识别区域接口,用于限定识别范围
3885
+ */
3886
+ interface MlkitRegion {
3887
+ left: number;
3888
+ top: number;
3889
+ right: number;
3890
+ bottom: number;
3891
+ }
3892
+ /**
3893
+ * 文字位置信息
3894
+ */
3895
+ interface TextPosition {
3896
+ text: string;
3897
+ left: number;
3898
+ top: number;
3899
+ right: number;
3900
+ bottom: number;
3901
+ }
3902
+ /**
3903
+ * findPhrasePositions / getScreenTextPositions 返回结果
3904
+ */
3905
+ interface ScreenTextRecognitionResult {
3906
+ fullText: string;
3907
+ positions: TextPosition[];
3908
+ processingTimeMillis: number;
3909
+ }
3910
+ /**
3911
+ * findPhrasePositionsOnScreenAsJson / getScreenTextPositionsAsJson 返回结果
3912
+ */
3913
+ interface ScreenTextJsonResult {
3914
+ jsonResult: string;
3915
+ }
3916
+ declare class Mlkit {
3917
+ /**
3918
+ * 执行异步调用
3919
+ * @param method 方法名
3920
+ * @param args 参数对象
3921
+ * @param timeout 超时时间(秒),默认30秒
3922
+ * @returns Promise<调用响应>
3923
+ */
3924
+ private asyncCall;
3925
+ /**
3926
+ * 识别屏幕中指定词组的位置(基于当前截图)
3927
+ * @param targetText 要搜索的目标词组(必填)
3928
+ * @param options 可选参数:region 识别区域;rotationDegrees 旋转角度,默认 0;timeout 超时时间
3929
+ * @returns Promise<识别结果>
3930
+ */
3931
+ findPhrasePositions(targetText: string, options?: {
3932
+ region?: MlkitRegion;
3933
+ rotationDegrees?: number;
3934
+ timeout?: number;
3935
+ }): Promise<ScreenTextRecognitionResult>;
3936
+ /**
3937
+ * 识别屏幕中所有文字内容及其位置(基于当前截图)
3938
+ * @param options 可选参数:region 识别区域;rotationDegrees 旋转角度,默认 0;timeout 超时时间
3939
+ * @returns Promise<识别结果>
3940
+ */
3941
+ getScreenTextPositions(options?: {
3942
+ region?: MlkitRegion;
3943
+ rotationDegrees?: number;
3944
+ timeout?: number;
3945
+ }): Promise<ScreenTextRecognitionResult>;
3946
+ /**
3947
+ * 识别屏幕中指定词组的位置,直接返回 JSON 字符串(基于当前截图)
3948
+ * @param targetText 要搜索的目标词组(必填)
3949
+ * @param options 可选参数:region 识别区域;rotationDegrees 旋转角度,默认 0;timeout 超时时间
3950
+ * @returns Promise<JSON 字符串结果>
3951
+ */
3952
+ findPhrasePositionsOnScreenAsJson(targetText: string, options?: {
3953
+ region?: MlkitRegion;
3954
+ rotationDegrees?: number;
3955
+ timeout?: number;
3956
+ }): Promise<string>;
3957
+ /**
3958
+ * 识别屏幕中所有文字及其位置,直接返回 JSON 字符串(基于当前截图)
3959
+ * @param options 可选参数:region 识别区域;rotationDegrees 旋转角度,默认 0;timeout 超时时间
3960
+ * @returns Promise<JSON 字符串结果>
3961
+ */
3962
+ getScreenTextPositionsAsJson(options?: {
3963
+ region?: MlkitRegion;
3964
+ rotationDegrees?: number;
3965
+ timeout?: number;
3966
+ }): Promise<string>;
3967
+ }
3968
+ declare const mlkit: Mlkit;
3969
+
3970
+ /**
3971
+ * ML Kit 文字识别相关的方法常量定义
3972
+ * 支持识别屏幕中指定词组位置以及识别屏幕文字内容位置
3973
+ */
3974
+ declare const MlkitCallMethod: {
3975
+ /**
3976
+ * 识别屏幕中指定词组的位置(基于当前截图)
3977
+ * 参数:targetText 必填;region 可选 { left, top, right, bottom };rotationDegrees 可选,默认 0
3978
+ */
3979
+ readonly findPhrasePositions: "findPhrasePositions";
3980
+ /**
3981
+ * 识别屏幕中所有文字内容及其位置(基于当前截图)
3982
+ * 参数:region 可选 { left, top, right, bottom };rotationDegrees 可选,默认 0
3983
+ */
3984
+ readonly getScreenTextPositions: "getScreenTextPositions";
3985
+ /**
3986
+ * 识别屏幕中指定词组的位置,直接返回 JSON 字符串(基于当前截图)
3987
+ * 参数:targetText 必填;region 可选 { left, top, right, bottom };rotationDegrees 可选,默认 0
3988
+ */
3989
+ readonly findPhrasePositionsOnScreenAsJson: "findPhrasePositionsOnScreenAsJson";
3990
+ /**
3991
+ * 识别屏幕中所有文字及其位置,直接返回 JSON 字符串(基于当前截图)
3992
+ * 参数:region 可选 { left, top, right, bottom };rotationDegrees 可选,默认 0
3993
+ */
3994
+ readonly getScreenTextPositionsAsJson: "getScreenTextPositionsAsJson";
3995
+ };
3996
+ type MlkitCallMethodType = (typeof MlkitCallMethod)[keyof typeof MlkitCallMethod];
3997
+
3998
+ declare class BarUtils {
3999
+ private asyncCall;
4000
+ private errorMessage;
4001
+ /** Get status bar height in px. */
4002
+ getStatusBarHeight(timeout?: number): Promise<number>;
4003
+ /** Set status bar visibility. */
4004
+ setStatusBarVisibility(isVisible?: boolean, timeout?: number): Promise<void>;
4005
+ /** Check if status bar is visible. */
4006
+ isStatusBarVisible(timeout?: number): Promise<boolean>;
4007
+ /** Set status bar light mode (light content on dark background). */
4008
+ setStatusBarLightMode(isLightMode?: boolean, timeout?: number): Promise<void>;
4009
+ /** Check if status bar is in light mode. */
4010
+ isStatusBarLightMode(timeout?: number): Promise<boolean>;
4011
+ /** Set status bar color. color: Android color int (e.g. 0xff0000). isDecor: whether to apply to decor. */
4012
+ setStatusBarColor(color: number, options?: {
4013
+ isDecor?: boolean;
4014
+ }, timeout?: number): Promise<void>;
4015
+ /** Make status bar transparent. */
4016
+ transparentStatusBar(timeout?: number): Promise<void>;
4017
+ /** Get action bar height in px. */
4018
+ getActionBarHeight(timeout?: number): Promise<number>;
4019
+ /** Get navigation bar height in px. */
4020
+ getNavBarHeight(timeout?: number): Promise<number>;
4021
+ /** Set navigation bar visibility. */
4022
+ setNavBarVisibility(isVisible?: boolean, timeout?: number): Promise<void>;
4023
+ /** Check if navigation bar is visible. */
4024
+ isNavBarVisible(timeout?: number): Promise<boolean>;
4025
+ /** Set navigation bar color. color: Android color int. */
4026
+ setNavBarColor(color: number, timeout?: number): Promise<void>;
4027
+ /** Get current navigation bar color. */
4028
+ getNavBarColor(timeout?: number): Promise<number>;
4029
+ /** Check if device supports navigation bar. */
4030
+ isSupportNavBar(timeout?: number): Promise<boolean>;
4031
+ /** Set navigation bar light mode. */
4032
+ setNavBarLightMode(isLightMode?: boolean, timeout?: number): Promise<void>;
4033
+ /** Check if navigation bar is in light mode. */
4034
+ isNavBarLightMode(timeout?: number): Promise<boolean>;
4035
+ /** Make navigation bar transparent. */
4036
+ transparentNavBar(timeout?: number): Promise<void>;
4037
+ }
4038
+ declare const barUtils: BarUtils;
4039
+
4040
+ /**
4041
+ * Bar utils (status bar, nav bar, action bar) method constants.
4042
+ * Matches BarUtilsCallMethod in Kotlin.
4043
+ */
4044
+ declare const BarUtilsCallMethod: {
4045
+ readonly getStatusBarHeight: "getStatusBarHeight";
4046
+ readonly setStatusBarVisibility: "setStatusBarVisibility";
4047
+ readonly isStatusBarVisible: "isStatusBarVisible";
4048
+ readonly setStatusBarLightMode: "setStatusBarLightMode";
4049
+ readonly isStatusBarLightMode: "isStatusBarLightMode";
4050
+ readonly setStatusBarColor: "setStatusBarColor";
4051
+ readonly transparentStatusBar: "transparentStatusBar";
4052
+ readonly getActionBarHeight: "getActionBarHeight";
4053
+ readonly getNavBarHeight: "getNavBarHeight";
4054
+ readonly setNavBarVisibility: "setNavBarVisibility";
4055
+ readonly isNavBarVisible: "isNavBarVisible";
4056
+ readonly setNavBarColor: "setNavBarColor";
4057
+ readonly getNavBarColor: "getNavBarColor";
4058
+ readonly isSupportNavBar: "isSupportNavBar";
4059
+ readonly setNavBarLightMode: "setNavBarLightMode";
4060
+ readonly isNavBarLightMode: "isNavBarLightMode";
4061
+ readonly transparentNavBar: "transparentNavBar";
4062
+ };
4063
+ type BarUtilsCallMethodType = (typeof BarUtilsCallMethod)[keyof typeof BarUtilsCallMethod];
4064
+
4065
+ declare class Float {
4066
+ private asyncCall;
4067
+ private errorMessage;
4068
+ /** Load floating window */
4069
+ open(url: string, options?: WebFloatingWindowOptions & {
4070
+ timeout?: number;
4071
+ }): Promise<boolean>;
4072
+ /** Close current floating window */
4073
+ close(timeout?: number): Promise<boolean>;
4074
+ /** Set overlay flags */
4075
+ setFlags(flags: number | number[], timeout?: number): Promise<void>;
4076
+ /** Show overlay toast */
4077
+ toast(text: string, delay?: number, timeout?: number): Promise<void>;
4078
+ /** Move floating window to x, y */
4079
+ move(x: number, y: number, timeout?: number): Promise<void>;
4080
+ /** Refresh floating window view config. Optional: showTopOperationArea, showBottomOperationArea, backgroundColor, width, height, x, y (omit to keep current) */
4081
+ refresh(options?: {
4082
+ showTopOperationArea?: boolean;
4083
+ showBottomOperationArea?: boolean;
4084
+ backgroundColor?: string | number;
4085
+ width?: number;
4086
+ height?: number;
4087
+ x?: number;
4088
+ y?: number;
4089
+ timeout?: number;
4090
+ }): Promise<void>;
4091
+ }
4092
+ declare const float: Float;
4093
+
4094
+ /**
4095
+ * Float window method constants.
4096
+ * Matches FloatCallMethod.kt.
4097
+ */
4098
+ declare const FloatCallMethod: {
4099
+ /** Load floating window */
4100
+ readonly open: "open";
4101
+ /** Close floating window */
4102
+ readonly close: "close";
4103
+ /** Set overlay flags */
4104
+ readonly setFlags: "setFlags";
4105
+ /** Show overlay toast */
4106
+ readonly toast: "toast";
4107
+ /** Move floating window by x, y */
4108
+ readonly move: "move";
4109
+ /** Refresh floating window view config (width, height, x, y) */
4110
+ readonly refresh: "refresh";
4111
+ };
4112
+ type FloatCallMethodType = (typeof FloatCallMethod)[keyof typeof FloatCallMethod];
4113
+
4114
+ /**
4115
+ * 日志桥接方法名(与 tools/log/AssistsLogCallMethod.kt 一致)
4116
+ */
4117
+ declare const LogCallMethod: {
4118
+ readonly readAllText: "readAllText";
4119
+ readonly clear: "clear";
4120
+ readonly refreshFromFile: "refreshFromFile";
4121
+ readonly appendLine: "appendLine";
4122
+ readonly appendTimestampedEntry: "appendTimestampedEntry";
4123
+ readonly replaceAll: "replaceAll";
4124
+ readonly subscribe: "subscribe";
4125
+ readonly unsubscribe: "unsubscribe";
4126
+ readonly uploadLogs: "uploadLogs";
4127
+ /** 获取日志服务当前域名(origin,无路径;与上传、管理后台同源),对应 AssistsLogDiagnostics.adminWebBaseUrl() */
4128
+ readonly getLogServiceBaseUrl: "getLogServiceBaseUrl";
4129
+ };
4130
+ /** 与 ASWebView / AssistsLogJavascriptInterface companion 对齐 */
4131
+ declare const LogStream: {
4132
+ readonly latestLine: "latestLine";
4133
+ readonly entireLogText: "entireLogText";
4134
+ };
4135
+ type LogStreamType = (typeof LogStream)[keyof typeof LogStream];
4136
+ type LogCallMethodType = (typeof LogCallMethod)[keyof typeof LogCallMethod];
4137
+
4138
+ /**
4139
+ * onAssistsLogUpdate 推送的监听器列表(与 accessibilityEventListeners 风格一致)。
4140
+ * 在页面加载本模块后,向此数组 push,或使用 log.addLogUpdateListener。
4141
+ * 注意:若页面在 import 本模块之前已自定义 `window.onAssistsLogUpdate`,则不会安装默认分发函数,需自行解码并转发到监听器。
4142
+ */
4143
+ declare const logUpdateListeners: Array<(payload: LogUpdateEvent) => void>;
4144
+ /**
4145
+ * Base64 解码后的 CallResponse,data 含 stream / text
4146
+ */
4147
+ interface LogUpdateEvent {
4148
+ code: number;
4149
+ data: LogUpdateData | null;
4150
+ message?: string;
4151
+ callbackId?: string | null;
4152
+ }
4153
+ interface LogUpdateData {
4154
+ stream: LogStreamType;
4155
+ text: string;
4156
+ }
4157
+ interface LogSubscribeUpdatePayload {
4158
+ text: string;
4159
+ stream: string;
4160
+ subscriptionId: string;
4161
+ }
4162
+ interface LogUploadOptions {
4163
+ baseUrl?: string;
4164
+ /** PNG(默认)| JPEG | JPG | WEBP */
4165
+ format?: "PNG" | "JPEG" | "JPG" | "WEBP" | string;
4166
+ prettyPrint?: boolean;
4167
+ overlayHiddenDelayMillis?: number;
4168
+ /** 与 Kotlin handleUploadLogs / AssistsLogDiagnostics.uploadLogs 的 uploadKey 一致 */
4169
+ uploadKey?: string;
4170
+ }
4171
+ /** 与 Kotlin assistsLogUploadResultToJson 对齐 */
4172
+ interface LogUploadResult {
4173
+ success: boolean;
4174
+ message: string;
4175
+ httpCode?: number;
4176
+ responseBody?: string;
4177
+ data?: unknown;
4178
+ localLogFilePath?: string;
4179
+ localScreenshotFilePath?: string;
4180
+ localNodeTreeFilePath?: string;
4181
+ causeMessage?: string;
4182
+ }
4183
+ declare class Log {
4184
+ private getBridge;
4185
+ private asyncCall;
4186
+ /** 读取当前日志全文 */
4187
+ readAllText(timeout?: number): Promise<string>;
4188
+ /**
4189
+ * 获取日志服务当前域名(origin,无路径;与上传、管理后台同源)。
4190
+ * 与 Kotlin getLogServiceBaseUrl / adminWebBaseUrl 对齐。
4191
+ */
4192
+ getLogServiceBaseUrl(timeout?: number): Promise<string>;
4193
+ /** 清空日志 */
4194
+ clear(timeout?: number): Promise<boolean>;
4195
+ /** 从文件重新加载到内存 Flow */
4196
+ refreshFromFile(timeout?: number): Promise<boolean>;
4197
+ /** 追加一行 */
4198
+ appendLine(line: string, maxLength?: number, timeout?: number): Promise<boolean>;
4199
+ /** 追加带时间戳的条目 */
4200
+ appendTimestampedEntry(message: string, timeout?: number): Promise<boolean>;
4201
+ /** 替换全部内容 */
4202
+ replaceAll(content: string, timeout?: number): Promise<boolean>;
4203
+ /**
4204
+ * 订阅 Flow:先收到 subscribed,再多次 update。
4205
+ * resolve 后请保留 dispose 或调用 unsubscribe(subscriptionId) 以释放原生协程与 JS 回调。
4206
+ */
4207
+ subscribe(stream: LogStreamType, onUpdate: (payload: LogSubscribeUpdatePayload) => void, options?: {
4208
+ timeout?: number;
4209
+ }): Promise<{
4210
+ subscriptionId: string;
4211
+ dispose: () => Promise<void>;
4212
+ }>;
4213
+ /** 取消订阅(与 Kotlin handleUnsubscribe 对齐) */
4214
+ unsubscribe(subscriptionId: string, timeout?: number): Promise<boolean>;
4215
+ /** 截图 + 节点树 + 日志上传(需 Android API 30+) */
4216
+ uploadLogs(options?: LogUploadOptions & {
4217
+ timeout?: number;
4218
+ }): Promise<LogUploadResult>;
4219
+ /**
4220
+ * 注册 onAssistsLogUpdate 推送监听(ASWebView 注入的 Base64 CallResponse,解码后见 LogUpdateEvent)
4221
+ */
4222
+ addLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void;
4223
+ /**
4224
+ * 移除先前通过 addLogUpdateListener 注册的同一函数引用
4225
+ */
4226
+ removeLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void;
4227
+ }
4228
+ /** 默认单例,用法与 floatingwindow 模块导出的 float 一致 */
4229
+ declare const log: Log;
4230
+
4231
+ export { type AccessibilityEvent, type AccessibilityEventData, AccessibilityEventFilter, type AccessibilityEventFilterConfig, type AccessibilityEventListener, AppInfo, AssistsX, AssistsXAsync, BarUtils, BarUtilsCallMethod, type BarUtilsCallMethodType, Bounds, CallMethod, type CallMethodType, CallResponse, type Contact, DeviceInfo, FileIO, type FileInfo, type FileListItem, type FileUploadInfo, FileUtils, Float, FloatCallMethod, type FloatCallMethodType, Gallery, type GalleryDeleteResponse, type GalleryResponse, Http, type HttpConfig, type HttpDownloadResponse, type HttpResponse, type ImageProcessResult, type ImageRotateDegree, type ImageSaveResult, type ImageSize, type ImageType, ImageUtils, Ime, ImeAction, type IsCurrentInputMethodResponse, type IsInputMethodEnabledResponse, Log, LogCallMethod, type LogCallMethodType, LogStream, type LogStreamType, type LogSubscribeUpdatePayload, type LogUpdateData, type LogUpdateEvent, type LogUploadOptions, type LogUploadResult, Mlkit, MlkitCallMethod, type MlkitCallMethodType, type MlkitRegion, Node, NodeAsync, NodeClassValue, type OpenInputMethodSettingsResponse, Path, type PerformEditorActionResponse, type RecognizeTextInScreenshotPosition, type RecognizeTextInScreenshotResult, type RecognizeTextRegion, type Screen, type ScreenTextJsonResult, type ScreenTextRecognitionResult, Step, StepAsync, StepError, type StepImpl, type StepInterceptor, type StepResult, type StepState, type StepStatus, StepStopError, type TextPosition, type WebFloatingWindowOptions, WindowFlags, accessibilityEventListeners, barUtils, callbacks, decodeBase64UTF8, fileIO, fileUtils, float, gallery, generateUUID, http, imageUtils, ime, log, logUpdateListeners, mlkit, pathUtils, screen, sleep, useStepStore };