assistsx-js 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -29,6 +29,8 @@ __export(index_exports, {
29
29
  Bounds: () => Bounds,
30
30
  CallMethod: () => CallMethod,
31
31
  CallResponse: () => CallResponse,
32
+ Db: () => Db,
33
+ DbCallMethod: () => DbCallMethod,
32
34
  DeviceInfo: () => DeviceInfo,
33
35
  FileIO: () => FileIO,
34
36
  FileUtils: () => FileUtils,
@@ -50,6 +52,9 @@ __export(index_exports, {
50
52
  NodeAsync: () => NodeAsync,
51
53
  NodeClassValue: () => NodeClassValue,
52
54
  Path: () => Path,
55
+ PluginInfo: () => PluginInfo,
56
+ Screenshot: () => Screenshot,
57
+ ScreenshotCallMethod: () => ScreenshotCallMethod,
53
58
  Step: () => Step,
54
59
  StepAsync: () => StepAsync,
55
60
  StepError: () => StepError,
@@ -58,6 +63,7 @@ __export(index_exports, {
58
63
  accessibilityEventListeners: () => accessibilityEventListeners,
59
64
  barUtils: () => barUtils,
60
65
  callbacks: () => callbacks,
66
+ db: () => db,
61
67
  decodeBase64UTF8: () => decodeBase64UTF8,
62
68
  ensureAssistsXPinia: () => ensureAssistsXPinia,
63
69
  fileIO: () => fileIO,
@@ -73,6 +79,7 @@ __export(index_exports, {
73
79
  mlkit: () => mlkit,
74
80
  pathUtils: () => pathUtils,
75
81
  screen: () => screen,
82
+ screenshot: () => screenshot,
76
83
  sleep: () => sleep,
77
84
  useStepStore: () => useStepStore
78
85
  });
@@ -229,6 +236,7 @@ var CallMethod = {
229
236
  performLinearGesture: "performLinearGesture",
230
237
  longPressGestureAutoPaste: "longPressGestureAutoPaste",
231
238
  getAppInfo: "getAppInfo",
239
+ getCurrentPlugin: "getCurrentPlugin",
232
240
  getMacAddress: "getMacAddress",
233
241
  getAndroidID: "getAndroidID",
234
242
  getUniqueDeviceId: "getUniqueDeviceId",
@@ -349,6 +357,52 @@ var AppInfo = class _AppInfo {
349
357
  }
350
358
  };
351
359
 
360
+ // src/plugin-info.ts
361
+ var PluginInfo = class _PluginInfo {
362
+ constructor(id = "", name = "", packageName = "", versionName = "", versionCode = 0, description = "", path = "", index = "", port = 0, needScreenCapture = false) {
363
+ this.id = id;
364
+ this.name = name;
365
+ this.packageName = packageName;
366
+ this.versionName = versionName;
367
+ this.versionCode = versionCode;
368
+ this.description = description;
369
+ this.path = path;
370
+ this.index = index;
371
+ this.port = port;
372
+ this.needScreenCapture = needScreenCapture;
373
+ }
374
+ static fromJSON(data) {
375
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
376
+ const record = data != null ? data : {};
377
+ return new _PluginInfo(
378
+ String((_a2 = record.id) != null ? _a2 : ""),
379
+ String((_b = record.name) != null ? _b : ""),
380
+ String((_c = record.packageName) != null ? _c : ""),
381
+ String((_d = record.versionName) != null ? _d : ""),
382
+ Number((_e = record.versionCode) != null ? _e : 0),
383
+ String((_f = record.description) != null ? _f : ""),
384
+ String((_g = record.path) != null ? _g : ""),
385
+ String((_h = record.index) != null ? _h : ""),
386
+ Number((_i = record.port) != null ? _i : 0),
387
+ Boolean((_j = record.needScreenCapture) != null ? _j : false)
388
+ );
389
+ }
390
+ toJSON() {
391
+ return {
392
+ id: this.id,
393
+ name: this.name,
394
+ packageName: this.packageName,
395
+ versionName: this.versionName,
396
+ versionCode: this.versionCode,
397
+ description: this.description,
398
+ path: this.path,
399
+ index: this.index,
400
+ port: this.port,
401
+ needScreenCapture: this.needScreenCapture
402
+ };
403
+ }
404
+ };
405
+
352
406
  // src/device-info.ts
353
407
  var DeviceInfo = class _DeviceInfo {
354
408
  constructor(uniqueDeviceId = "", androidID = "", macAddress = "", isDeviceRooted = false, manufacturer = "", model = "", sdkVersionCode = 0, sdkVersionName = "", abiList = [], isAdbEnabled = false, isDevelopmentSettingsEnabled = false, isEmulator = false, isTablet = false) {
@@ -412,6 +466,137 @@ var DeviceInfo = class _DeviceInfo {
412
466
  }
413
467
  };
414
468
 
469
+ // src/window-flags.ts
470
+ var _WindowFlags = class _WindowFlags {
471
+ // 0x1000000
472
+ /**
473
+ * 获取标志位的十六进制表示
474
+ * @param flag 标志位值
475
+ * @returns 十六进制字符串
476
+ */
477
+ static toHex(flag) {
478
+ return `0x${flag.toString(16).toUpperCase()}`;
479
+ }
480
+ /**
481
+ * 检查是否包含指定标志位
482
+ * @param flags 当前标志位组合
483
+ * @param flag 要检查的标志位
484
+ * @returns 是否包含该标志位
485
+ */
486
+ static hasFlag(flags, flag) {
487
+ return (flags & flag) === flag;
488
+ }
489
+ /**
490
+ * 添加标志位
491
+ * @param flags 当前标志位组合
492
+ * @param flag 要添加的标志位
493
+ * @returns 新的标志位组合
494
+ */
495
+ static addFlag(flags, flag) {
496
+ return flags | flag;
497
+ }
498
+ /**
499
+ * 移除标志位
500
+ * @param flags 当前标志位组合
501
+ * @param flag 要移除的标志位
502
+ * @returns 新的标志位组合
503
+ */
504
+ static removeFlag(flags, flag) {
505
+ return flags & ~flag;
506
+ }
507
+ /** 输入框获取焦点时使用的悬浮窗 flag 组合(不含 FLAG_NOT_FOCUSABLE) */
508
+ static getOverlayInputFocusFlagList() {
509
+ return [
510
+ _WindowFlags.FLAG_WATCH_OUTSIDE_TOUCH,
511
+ _WindowFlags.FLAG_NOT_TOUCH_MODAL,
512
+ _WindowFlags.FLAG_LAYOUT_NO_LIMITS,
513
+ _WindowFlags.FLAG_LAYOUT_IN_SCREEN
514
+ ];
515
+ }
516
+ /** 输入框失去焦点时使用的悬浮窗 flag 组合(含 FLAG_NOT_FOCUSABLE) */
517
+ static getOverlayInputBlurFlagList() {
518
+ return [
519
+ _WindowFlags.FLAG_WATCH_OUTSIDE_TOUCH,
520
+ _WindowFlags.FLAG_NOT_TOUCH_MODAL,
521
+ _WindowFlags.FLAG_LAYOUT_NO_LIMITS,
522
+ _WindowFlags.FLAG_NOT_FOCUSABLE,
523
+ _WindowFlags.FLAG_LAYOUT_IN_SCREEN
524
+ ];
525
+ }
526
+ /**
527
+ * 获取所有标志位的描述信息
528
+ * @returns 标志位描述对象数组
529
+ */
530
+ static getAllFlags() {
531
+ return [
532
+ { name: "FLAG_NOT_FOCUSABLE", value: this.FLAG_NOT_FOCUSABLE, hex: this.toHex(this.FLAG_NOT_FOCUSABLE), description: "\u4E0D\u83B7\u53D6\u7126\u70B9" },
533
+ { name: "FLAG_NOT_TOUCHABLE", value: this.FLAG_NOT_TOUCHABLE, hex: this.toHex(this.FLAG_NOT_TOUCHABLE), description: "\u4E0D\u54CD\u5E94\u89E6\u6478" },
534
+ { name: "FLAG_NOT_TOUCH_MODAL", value: this.FLAG_NOT_TOUCH_MODAL, hex: this.toHex(this.FLAG_NOT_TOUCH_MODAL), description: "\u4E0D\u62E6\u622A\u89E6\u6478" },
535
+ { name: "FLAG_WATCH_OUTSIDE_TOUCH", value: this.FLAG_WATCH_OUTSIDE_TOUCH, hex: this.toHex(this.FLAG_WATCH_OUTSIDE_TOUCH), description: "\u76D1\u542C\u7A97\u5916\u70B9\u51FB" },
536
+ { name: "FLAG_LAYOUT_NO_LIMITS", value: this.FLAG_LAYOUT_NO_LIMITS, hex: this.toHex(this.FLAG_LAYOUT_NO_LIMITS), description: "\u53EF\u7ED8\u5236\u8D85\u51FA\u5C4F\u5E55" },
537
+ { name: "FLAG_LAYOUT_IN_SCREEN", value: this.FLAG_LAYOUT_IN_SCREEN, hex: this.toHex(this.FLAG_LAYOUT_IN_SCREEN), description: "\u5C4F\u5E55\u5168\u533A\u57DF\u5E03\u5C40" },
538
+ { name: "FLAG_FULLSCREEN", value: this.FLAG_FULLSCREEN, hex: this.toHex(this.FLAG_FULLSCREEN), description: "\u5168\u5C4F\u663E\u793A" },
539
+ { name: "FLAG_DIM_BEHIND", value: this.FLAG_DIM_BEHIND, hex: this.toHex(this.FLAG_DIM_BEHIND), description: "\u80CC\u666F\u53D8\u6697" },
540
+ { name: "FLAG_SECURE", value: this.FLAG_SECURE, hex: this.toHex(this.FLAG_SECURE), description: "\u9632\u5F55\u5C4F\u9632\u622A\u56FE" },
541
+ { name: "FLAG_KEEP_SCREEN_ON", value: this.FLAG_KEEP_SCREEN_ON, hex: this.toHex(this.FLAG_KEEP_SCREEN_ON), description: "\u4FDD\u6301\u5E38\u4EAE" },
542
+ { name: "FLAG_SHOW_WHEN_LOCKED", value: this.FLAG_SHOW_WHEN_LOCKED, hex: this.toHex(this.FLAG_SHOW_WHEN_LOCKED), description: "\u9501\u5C4F\u65F6\u53EF\u89C1" },
543
+ { name: "FLAG_DISMISS_KEYGUARD", value: this.FLAG_DISMISS_KEYGUARD, hex: this.toHex(this.FLAG_DISMISS_KEYGUARD), description: "\u89E3\u9501\u5C4F\u5E55" },
544
+ { name: "FLAG_TURN_SCREEN_ON", value: this.FLAG_TURN_SCREEN_ON, hex: this.toHex(this.FLAG_TURN_SCREEN_ON), description: "\u70B9\u4EAE\u5C4F\u5E55" },
545
+ { name: "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON", value: this.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, hex: this.toHex(this.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON), description: "\u81EA\u52A8\u9501\u5C4F\uFF08\u4E0D\u5E38\u7528\uFF09" },
546
+ { name: "FLAG_SHOW_WALLPAPER", value: this.FLAG_SHOW_WALLPAPER, hex: this.toHex(this.FLAG_SHOW_WALLPAPER), description: "\u663E\u793A\u5899\u7EB8" },
547
+ { name: "FLAG_HARDWARE_ACCELERATED", value: this.FLAG_HARDWARE_ACCELERATED, hex: this.toHex(this.FLAG_HARDWARE_ACCELERATED), description: "\u5F3A\u5236\u786C\u4EF6\u52A0\u901F" }
548
+ ];
549
+ }
550
+ };
551
+ /** 不获取焦点 */
552
+ _WindowFlags.FLAG_NOT_FOCUSABLE = 8;
553
+ // 0x08
554
+ /** 不响应触摸 */
555
+ _WindowFlags.FLAG_NOT_TOUCHABLE = 16;
556
+ // 0x10
557
+ /** 不拦截触摸 */
558
+ _WindowFlags.FLAG_NOT_TOUCH_MODAL = 32;
559
+ // 0x20
560
+ /** 监听窗外点击 */
561
+ _WindowFlags.FLAG_WATCH_OUTSIDE_TOUCH = 4;
562
+ // 0x04
563
+ /** 可绘制超出屏幕 */
564
+ _WindowFlags.FLAG_LAYOUT_NO_LIMITS = 512;
565
+ // 0x200
566
+ /** 屏幕全区域布局 */
567
+ _WindowFlags.FLAG_LAYOUT_IN_SCREEN = 256;
568
+ // 0x100
569
+ /** 全屏显示 */
570
+ _WindowFlags.FLAG_FULLSCREEN = 1024;
571
+ // 0x400
572
+ /** 背景变暗 */
573
+ _WindowFlags.FLAG_DIM_BEHIND = 2;
574
+ // 0x02
575
+ /** 防录屏防截图 */
576
+ _WindowFlags.FLAG_SECURE = 8192;
577
+ // 0x2000
578
+ /** 保持常亮 */
579
+ _WindowFlags.FLAG_KEEP_SCREEN_ON = 128;
580
+ // 0x80
581
+ /** 锁屏时可见 */
582
+ _WindowFlags.FLAG_SHOW_WHEN_LOCKED = 524288;
583
+ // 0x80000
584
+ /** 解锁屏幕 */
585
+ _WindowFlags.FLAG_DISMISS_KEYGUARD = 4194304;
586
+ // 0x400000
587
+ /** 点亮屏幕 */
588
+ _WindowFlags.FLAG_TURN_SCREEN_ON = 2097152;
589
+ // 0x200000
590
+ /** 自动锁屏(不常用) */
591
+ _WindowFlags.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 128;
592
+ // 0x80
593
+ /** 显示墙纸 */
594
+ _WindowFlags.FLAG_SHOW_WALLPAPER = 1048576;
595
+ // 0x100000
596
+ /** 强制硬件加速 */
597
+ _WindowFlags.FLAG_HARDWARE_ACCELERATED = 16777216;
598
+ var WindowFlags = _WindowFlags;
599
+
415
600
  // src/assistsx-async.ts
416
601
  var AssistsXAsync = class {
417
602
  /**
@@ -483,6 +668,18 @@ var AssistsXAsync = class {
483
668
  });
484
669
  return response.getDataOrDefault(false);
485
670
  }
671
+ /**
672
+ * 设置悬浮窗可获取焦点(WebView 内输入框 focus 时调用)
673
+ */
674
+ static async setOverlayInputFocus(timeout) {
675
+ return this.setOverlayFlagList(WindowFlags.getOverlayInputFocusFlagList(), timeout);
676
+ }
677
+ /**
678
+ * 取消悬浮窗焦点(WebView 内输入框 blur 时调用)
679
+ */
680
+ static async clearOverlayInputFocus(timeout) {
681
+ return this.setOverlayFlagList(WindowFlags.getOverlayInputBlurFlagList(), timeout);
682
+ }
486
683
  /**
487
684
  * 获取所有符合条件的节点
488
685
  * @param filterClass 类名过滤
@@ -1248,6 +1445,22 @@ var AssistsXAsync = class {
1248
1445
  });
1249
1446
  return AppInfo.fromJSON(response.getDataOrDefault({}));
1250
1447
  }
1448
+ /**
1449
+ * 获取当前运行的 AssistsX 插件信息(仅 AssistsX 宿主有效,否则返回 null)
1450
+ */
1451
+ static async getCurrentPlugin(timeout) {
1452
+ const response = await this.asyncCall(CallMethod.getCurrentPlugin, {
1453
+ timeout
1454
+ });
1455
+ if (!response.isSuccess()) {
1456
+ return null;
1457
+ }
1458
+ const data = response.getDataOrNull();
1459
+ if (!data) {
1460
+ return null;
1461
+ }
1462
+ return PluginInfo.fromJSON(data);
1463
+ }
1251
1464
  static async getUniqueDeviceId(timeout) {
1252
1465
  const response = await this.asyncCall(CallMethod.getUniqueDeviceId, {
1253
1466
  timeout
@@ -3456,6 +3669,20 @@ var AssistsX2 = class {
3456
3669
  });
3457
3670
  return response.getDataOrDefault(false);
3458
3671
  }
3672
+ /**
3673
+ * 设置悬浮窗可获取焦点(WebView 内输入框 focus 时调用)
3674
+ * @returns 是否设置成功
3675
+ */
3676
+ static setOverlayInputFocus() {
3677
+ return this.setOverlayFlagList(WindowFlags.getOverlayInputFocusFlagList());
3678
+ }
3679
+ /**
3680
+ * 取消悬浮窗焦点(WebView 内输入框 blur 时调用)
3681
+ * @returns 是否设置成功
3682
+ */
3683
+ static clearOverlayInputFocus() {
3684
+ return this.setOverlayFlagList(WindowFlags.getOverlayInputBlurFlagList());
3685
+ }
3459
3686
  /**
3460
3687
  * 获取所有符合条件的节点
3461
3688
  * @param filterClass 类名过滤
@@ -4101,6 +4328,20 @@ var AssistsX2 = class {
4101
4328
  });
4102
4329
  return AppInfo.fromJSON(response.getDataOrDefault({}));
4103
4330
  }
4331
+ /**
4332
+ * 获取当前运行的 AssistsX 插件信息(仅 AssistsX 宿主有效,否则返回 null)
4333
+ */
4334
+ static getCurrentPlugin() {
4335
+ const response = this.call(CallMethod.getCurrentPlugin);
4336
+ if (!response.isSuccess()) {
4337
+ return null;
4338
+ }
4339
+ const data = response.getDataOrNull();
4340
+ if (!data) {
4341
+ return null;
4342
+ }
4343
+ return PluginInfo.fromJSON(data);
4344
+ }
4104
4345
  static getUniqueDeviceId() {
4105
4346
  const response = this.call(CallMethod.getUniqueDeviceId);
4106
4347
  return response.getDataOrDefault("");
@@ -4252,117 +4493,6 @@ var NodeClassValue = {
4252
4493
  FrameLayout: "android.widget.FrameLayout"
4253
4494
  };
4254
4495
 
4255
- // src/window-flags.ts
4256
- var WindowFlags = class {
4257
- // 0x1000000
4258
- /**
4259
- * 获取标志位的十六进制表示
4260
- * @param flag 标志位值
4261
- * @returns 十六进制字符串
4262
- */
4263
- static toHex(flag) {
4264
- return `0x${flag.toString(16).toUpperCase()}`;
4265
- }
4266
- /**
4267
- * 检查是否包含指定标志位
4268
- * @param flags 当前标志位组合
4269
- * @param flag 要检查的标志位
4270
- * @returns 是否包含该标志位
4271
- */
4272
- static hasFlag(flags, flag) {
4273
- return (flags & flag) === flag;
4274
- }
4275
- /**
4276
- * 添加标志位
4277
- * @param flags 当前标志位组合
4278
- * @param flag 要添加的标志位
4279
- * @returns 新的标志位组合
4280
- */
4281
- static addFlag(flags, flag) {
4282
- return flags | flag;
4283
- }
4284
- /**
4285
- * 移除标志位
4286
- * @param flags 当前标志位组合
4287
- * @param flag 要移除的标志位
4288
- * @returns 新的标志位组合
4289
- */
4290
- static removeFlag(flags, flag) {
4291
- return flags & ~flag;
4292
- }
4293
- /**
4294
- * 获取所有标志位的描述信息
4295
- * @returns 标志位描述对象数组
4296
- */
4297
- static getAllFlags() {
4298
- return [
4299
- { name: "FLAG_NOT_FOCUSABLE", value: this.FLAG_NOT_FOCUSABLE, hex: this.toHex(this.FLAG_NOT_FOCUSABLE), description: "\u4E0D\u83B7\u53D6\u7126\u70B9" },
4300
- { name: "FLAG_NOT_TOUCHABLE", value: this.FLAG_NOT_TOUCHABLE, hex: this.toHex(this.FLAG_NOT_TOUCHABLE), description: "\u4E0D\u54CD\u5E94\u89E6\u6478" },
4301
- { name: "FLAG_NOT_TOUCH_MODAL", value: this.FLAG_NOT_TOUCH_MODAL, hex: this.toHex(this.FLAG_NOT_TOUCH_MODAL), description: "\u4E0D\u62E6\u622A\u89E6\u6478" },
4302
- { name: "FLAG_WATCH_OUTSIDE_TOUCH", value: this.FLAG_WATCH_OUTSIDE_TOUCH, hex: this.toHex(this.FLAG_WATCH_OUTSIDE_TOUCH), description: "\u76D1\u542C\u7A97\u5916\u70B9\u51FB" },
4303
- { name: "FLAG_LAYOUT_NO_LIMITS", value: this.FLAG_LAYOUT_NO_LIMITS, hex: this.toHex(this.FLAG_LAYOUT_NO_LIMITS), description: "\u53EF\u7ED8\u5236\u8D85\u51FA\u5C4F\u5E55" },
4304
- { name: "FLAG_LAYOUT_IN_SCREEN", value: this.FLAG_LAYOUT_IN_SCREEN, hex: this.toHex(this.FLAG_LAYOUT_IN_SCREEN), description: "\u5C4F\u5E55\u5168\u533A\u57DF\u5E03\u5C40" },
4305
- { name: "FLAG_FULLSCREEN", value: this.FLAG_FULLSCREEN, hex: this.toHex(this.FLAG_FULLSCREEN), description: "\u5168\u5C4F\u663E\u793A" },
4306
- { name: "FLAG_DIM_BEHIND", value: this.FLAG_DIM_BEHIND, hex: this.toHex(this.FLAG_DIM_BEHIND), description: "\u80CC\u666F\u53D8\u6697" },
4307
- { name: "FLAG_SECURE", value: this.FLAG_SECURE, hex: this.toHex(this.FLAG_SECURE), description: "\u9632\u5F55\u5C4F\u9632\u622A\u56FE" },
4308
- { name: "FLAG_KEEP_SCREEN_ON", value: this.FLAG_KEEP_SCREEN_ON, hex: this.toHex(this.FLAG_KEEP_SCREEN_ON), description: "\u4FDD\u6301\u5E38\u4EAE" },
4309
- { name: "FLAG_SHOW_WHEN_LOCKED", value: this.FLAG_SHOW_WHEN_LOCKED, hex: this.toHex(this.FLAG_SHOW_WHEN_LOCKED), description: "\u9501\u5C4F\u65F6\u53EF\u89C1" },
4310
- { name: "FLAG_DISMISS_KEYGUARD", value: this.FLAG_DISMISS_KEYGUARD, hex: this.toHex(this.FLAG_DISMISS_KEYGUARD), description: "\u89E3\u9501\u5C4F\u5E55" },
4311
- { name: "FLAG_TURN_SCREEN_ON", value: this.FLAG_TURN_SCREEN_ON, hex: this.toHex(this.FLAG_TURN_SCREEN_ON), description: "\u70B9\u4EAE\u5C4F\u5E55" },
4312
- { name: "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON", value: this.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, hex: this.toHex(this.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON), description: "\u81EA\u52A8\u9501\u5C4F\uFF08\u4E0D\u5E38\u7528\uFF09" },
4313
- { name: "FLAG_SHOW_WALLPAPER", value: this.FLAG_SHOW_WALLPAPER, hex: this.toHex(this.FLAG_SHOW_WALLPAPER), description: "\u663E\u793A\u5899\u7EB8" },
4314
- { name: "FLAG_HARDWARE_ACCELERATED", value: this.FLAG_HARDWARE_ACCELERATED, hex: this.toHex(this.FLAG_HARDWARE_ACCELERATED), description: "\u5F3A\u5236\u786C\u4EF6\u52A0\u901F" }
4315
- ];
4316
- }
4317
- };
4318
- /** 不获取焦点 */
4319
- WindowFlags.FLAG_NOT_FOCUSABLE = 8;
4320
- // 0x08
4321
- /** 不响应触摸 */
4322
- WindowFlags.FLAG_NOT_TOUCHABLE = 16;
4323
- // 0x10
4324
- /** 不拦截触摸 */
4325
- WindowFlags.FLAG_NOT_TOUCH_MODAL = 32;
4326
- // 0x20
4327
- /** 监听窗外点击 */
4328
- WindowFlags.FLAG_WATCH_OUTSIDE_TOUCH = 4;
4329
- // 0x04
4330
- /** 可绘制超出屏幕 */
4331
- WindowFlags.FLAG_LAYOUT_NO_LIMITS = 512;
4332
- // 0x200
4333
- /** 屏幕全区域布局 */
4334
- WindowFlags.FLAG_LAYOUT_IN_SCREEN = 256;
4335
- // 0x100
4336
- /** 全屏显示 */
4337
- WindowFlags.FLAG_FULLSCREEN = 1024;
4338
- // 0x400
4339
- /** 背景变暗 */
4340
- WindowFlags.FLAG_DIM_BEHIND = 2;
4341
- // 0x02
4342
- /** 防录屏防截图 */
4343
- WindowFlags.FLAG_SECURE = 8192;
4344
- // 0x2000
4345
- /** 保持常亮 */
4346
- WindowFlags.FLAG_KEEP_SCREEN_ON = 128;
4347
- // 0x80
4348
- /** 锁屏时可见 */
4349
- WindowFlags.FLAG_SHOW_WHEN_LOCKED = 524288;
4350
- // 0x80000
4351
- /** 解锁屏幕 */
4352
- WindowFlags.FLAG_DISMISS_KEYGUARD = 4194304;
4353
- // 0x400000
4354
- /** 点亮屏幕 */
4355
- WindowFlags.FLAG_TURN_SCREEN_ON = 2097152;
4356
- // 0x200000
4357
- /** 自动锁屏(不常用) */
4358
- WindowFlags.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 128;
4359
- // 0x80
4360
- /** 显示墙纸 */
4361
- WindowFlags.FLAG_SHOW_WALLPAPER = 1048576;
4362
- // 0x100000
4363
- /** 强制硬件加速 */
4364
- WindowFlags.FLAG_HARDWARE_ACCELERATED = 16777216;
4365
-
4366
4496
  // src/accessibility-event-filter.ts
4367
4497
  var AccessibilityEventFilter = class _AccessibilityEventFilter {
4368
4498
  constructor(config = {}) {
@@ -7155,6 +7285,342 @@ var Mlkit = class {
7155
7285
  };
7156
7286
  var mlkit = new Mlkit();
7157
7287
 
7288
+ // src/screenshot/screenshot-call-method.ts
7289
+ var ScreenshotCallMethod = {
7290
+ /** 截取全屏并返回 Base64 */
7291
+ takeScreenshotBase64: "takeScreenshotBase64",
7292
+ /** 截取指定节点区域并返回 Base64,需传 node.nodeId */
7293
+ takeNodeScreenshotBase64: "takeNodeScreenshotBase64",
7294
+ /** 批量截取节点区域并返回 Base64 数组,nodes 为空时返回全屏 */
7295
+ takeScreenshotNodesBase64: "takeScreenshotNodesBase64"
7296
+ };
7297
+
7298
+ // src/screenshot/screenshot.ts
7299
+ var callbacks10 = /* @__PURE__ */ new Map();
7300
+ if (typeof window !== "undefined" && !window.assistsxScreenshotCallback) {
7301
+ window.assistsxScreenshotCallback = (data) => {
7302
+ let callbackId;
7303
+ try {
7304
+ const json = decodeBase64UTF8(data);
7305
+ const response = JSON.parse(json);
7306
+ callbackId = response.callbackId;
7307
+ if (callbackId) {
7308
+ const callback = callbacks10.get(callbackId);
7309
+ if (callback) {
7310
+ callback(json);
7311
+ }
7312
+ }
7313
+ } catch (e) {
7314
+ console.error("Screenshot callback error:", e);
7315
+ } finally {
7316
+ if (callbackId) {
7317
+ callbacks10.delete(callbackId);
7318
+ }
7319
+ }
7320
+ };
7321
+ }
7322
+ function createNodeStub(nodeId) {
7323
+ return { nodeId };
7324
+ }
7325
+ function parseScreenshotBase64Data(data) {
7326
+ if (!data || typeof data !== "object") {
7327
+ return null;
7328
+ }
7329
+ const record = data;
7330
+ const base64 = typeof record.base64 === "string" ? record.base64 : "";
7331
+ const mimeType = typeof record.mimeType === "string" ? record.mimeType : "image/png";
7332
+ const dataUrl = typeof record.dataUrl === "string" ? record.dataUrl : `data:${mimeType};base64,${base64}`;
7333
+ if (!base64) {
7334
+ return null;
7335
+ }
7336
+ return { base64, dataUrl, mimeType };
7337
+ }
7338
+ var Screenshot = class {
7339
+ /**
7340
+ * 执行异步调用
7341
+ */
7342
+ async asyncCall(method, {
7343
+ args,
7344
+ node,
7345
+ nodes,
7346
+ timeout = 30
7347
+ } = {}) {
7348
+ const uuid = generateUUID();
7349
+ const params = {
7350
+ method,
7351
+ arguments: args ? args : void 0,
7352
+ node: node ? node : void 0,
7353
+ nodes: nodes ? nodes : void 0,
7354
+ callbackId: uuid
7355
+ };
7356
+ const promise = new Promise((resolve) => {
7357
+ callbacks10.set(uuid, (data) => {
7358
+ resolve(data);
7359
+ });
7360
+ setTimeout(() => {
7361
+ callbacks10.delete(uuid);
7362
+ resolve(JSON.stringify(new CallResponse(0, null, uuid)));
7363
+ }, timeout * 1e3);
7364
+ });
7365
+ window.assistsxScreenshot.call(JSON.stringify(params));
7366
+ const promiseResult = await promise;
7367
+ if (typeof promiseResult === "string") {
7368
+ const responseData = JSON.parse(promiseResult);
7369
+ return new CallResponse(
7370
+ responseData.code,
7371
+ responseData.data,
7372
+ responseData.callbackId
7373
+ );
7374
+ }
7375
+ throw new Error("Screenshot call failed");
7376
+ }
7377
+ buildScreenshotArgs(options = {}) {
7378
+ const {
7379
+ overlayHiddenScreenshotDelayMillis = 250,
7380
+ format = "PNG",
7381
+ withDataUrlPrefix = true
7382
+ } = options;
7383
+ return {
7384
+ overlayHiddenScreenshotDelayMillis,
7385
+ format,
7386
+ withDataUrlPrefix
7387
+ };
7388
+ }
7389
+ /**
7390
+ * 截取全屏并返回 Base64
7391
+ */
7392
+ async takeScreenshotBase64(options = {}) {
7393
+ const { timeout = 30, ...rest } = options;
7394
+ const response = await this.asyncCall(ScreenshotCallMethod.takeScreenshotBase64, {
7395
+ args: this.buildScreenshotArgs(rest),
7396
+ timeout
7397
+ });
7398
+ if (!response.isSuccess()) {
7399
+ return null;
7400
+ }
7401
+ return parseScreenshotBase64Data(response.getDataOrNull());
7402
+ }
7403
+ /**
7404
+ * 截取指定节点区域并返回 Base64
7405
+ */
7406
+ async takeNodeScreenshotBase64(nodeId, options = {}) {
7407
+ if (!nodeId) {
7408
+ throw new Error("nodeId is required");
7409
+ }
7410
+ const { timeout = 30, ...rest } = options;
7411
+ const response = await this.asyncCall(ScreenshotCallMethod.takeNodeScreenshotBase64, {
7412
+ args: this.buildScreenshotArgs(rest),
7413
+ node: createNodeStub(nodeId),
7414
+ timeout
7415
+ });
7416
+ if (!response.isSuccess()) {
7417
+ return null;
7418
+ }
7419
+ return parseScreenshotBase64Data(response.getDataOrNull());
7420
+ }
7421
+ /**
7422
+ * 批量截取节点区域;nodeIds 为空时返回全屏截图
7423
+ */
7424
+ async takeScreenshotNodesBase64(nodeIds = [], options = {}) {
7425
+ const { timeout = 30, ...rest } = options;
7426
+ const nodes = nodeIds.map((nodeId) => createNodeStub(nodeId));
7427
+ const response = await this.asyncCall(ScreenshotCallMethod.takeScreenshotNodesBase64, {
7428
+ args: this.buildScreenshotArgs(rest),
7429
+ nodes,
7430
+ timeout
7431
+ });
7432
+ if (!response.isSuccess()) {
7433
+ return [];
7434
+ }
7435
+ const data = response.getDataOrNull();
7436
+ return Array.isArray(data == null ? void 0 : data.images) ? data.images : [];
7437
+ }
7438
+ };
7439
+ var screenshot = new Screenshot();
7440
+
7441
+ // src/db/db-call-method.ts
7442
+ var DbCallMethod = {
7443
+ exec: "exec",
7444
+ query: "query",
7445
+ execBatch: "execBatch",
7446
+ close: "close"
7447
+ };
7448
+
7449
+ // src/db/db.ts
7450
+ var callbacks11 = /* @__PURE__ */ new Map();
7451
+ if (typeof window !== "undefined" && !window.assistsxDbCallback) {
7452
+ window.assistsxDbCallback = (data) => {
7453
+ let callbackId;
7454
+ try {
7455
+ const json = decodeBase64UTF8(data);
7456
+ const response = JSON.parse(json);
7457
+ callbackId = response.callbackId;
7458
+ if (callbackId) {
7459
+ const callback = callbacks11.get(callbackId);
7460
+ if (callback) {
7461
+ callback(json);
7462
+ }
7463
+ }
7464
+ } catch (e) {
7465
+ console.error("Db callback error:", e);
7466
+ } finally {
7467
+ if (callbackId) {
7468
+ callbacks11.delete(callbackId);
7469
+ }
7470
+ }
7471
+ };
7472
+ }
7473
+ function buildDbArguments(target, extra) {
7474
+ const args = { ...extra };
7475
+ if (target.dbPath) {
7476
+ args.dbPath = target.dbPath;
7477
+ }
7478
+ if (target.dbName) {
7479
+ args.dbName = target.dbName;
7480
+ }
7481
+ return args;
7482
+ }
7483
+ function normalizeBindArgs(bindArgs) {
7484
+ if (!bindArgs || bindArgs.length === 0) {
7485
+ return void 0;
7486
+ }
7487
+ return bindArgs.map((value) => {
7488
+ if (value === null) {
7489
+ return null;
7490
+ }
7491
+ return String(value);
7492
+ });
7493
+ }
7494
+ function parseExecResult(data) {
7495
+ var _a2, _b;
7496
+ const record = data != null ? data : {};
7497
+ return {
7498
+ rowsAffected: Number((_a2 = record.rowsAffected) != null ? _a2 : 0),
7499
+ lastInsertRowId: Number((_b = record.lastInsertRowId) != null ? _b : 0)
7500
+ };
7501
+ }
7502
+ function parseQueryResult(data) {
7503
+ var _a2;
7504
+ const record = data != null ? data : {};
7505
+ const columns = Array.isArray(record.columns) ? record.columns.map((item) => String(item)) : [];
7506
+ const rows = Array.isArray(record.rows) ? record.rows : [];
7507
+ return {
7508
+ columns,
7509
+ rows,
7510
+ rowCount: Number((_a2 = record.rowCount) != null ? _a2 : rows.length)
7511
+ };
7512
+ }
7513
+ function parseExecBatchResult(data) {
7514
+ var _a2;
7515
+ const record = data != null ? data : {};
7516
+ const results = Array.isArray(record.results) ? record.results.map((item) => parseExecResult(item)) : [];
7517
+ return {
7518
+ count: Number((_a2 = record.count) != null ? _a2 : results.length),
7519
+ results
7520
+ };
7521
+ }
7522
+ var Db = class {
7523
+ /**
7524
+ * 执行异步调用
7525
+ */
7526
+ async asyncCall(method, args, timeout = 30) {
7527
+ const uuid = generateUUID();
7528
+ const params = {
7529
+ method,
7530
+ arguments: args ? args : void 0,
7531
+ callbackId: uuid
7532
+ };
7533
+ const promise = new Promise((resolve) => {
7534
+ callbacks11.set(uuid, (data) => {
7535
+ resolve(data);
7536
+ });
7537
+ setTimeout(() => {
7538
+ callbacks11.delete(uuid);
7539
+ resolve(JSON.stringify(new CallResponse(0, null, uuid)));
7540
+ }, timeout * 1e3);
7541
+ });
7542
+ window.assistsxDb.call(JSON.stringify(params));
7543
+ const promiseResult = await promise;
7544
+ if (typeof promiseResult !== "string") {
7545
+ throw new Error("Db call failed");
7546
+ }
7547
+ const responseData = JSON.parse(promiseResult);
7548
+ if (responseData.code !== 0) {
7549
+ throw new Error(responseData.message || "Db call failed");
7550
+ }
7551
+ return new CallResponse(
7552
+ responseData.code,
7553
+ responseData.data,
7554
+ responseData.callbackId
7555
+ );
7556
+ }
7557
+ /**
7558
+ * 将 query 结果中的 Base64 BLOB 字段解码为 Uint8Array
7559
+ */
7560
+ decodeBlobBase64(base64) {
7561
+ const binary = atob(base64);
7562
+ const bytes = new Uint8Array(binary.length);
7563
+ for (let i = 0; i < binary.length; i++) {
7564
+ bytes[i] = binary.charCodeAt(i);
7565
+ }
7566
+ return bytes;
7567
+ }
7568
+ /**
7569
+ * 执行非查询 SQL
7570
+ */
7571
+ async exec(sql, options) {
7572
+ const { timeout = 30, bindArgs, ...target } = options;
7573
+ const response = await this.asyncCall(
7574
+ DbCallMethod.exec,
7575
+ buildDbArguments(target, {
7576
+ sql,
7577
+ bindArgs: normalizeBindArgs(bindArgs)
7578
+ }),
7579
+ timeout
7580
+ );
7581
+ return parseExecResult(response.getDataOrNull());
7582
+ }
7583
+ /**
7584
+ * 执行查询 SQL
7585
+ */
7586
+ async query(sql, options) {
7587
+ const { timeout = 30, bindArgs, ...target } = options;
7588
+ const response = await this.asyncCall(
7589
+ DbCallMethod.query,
7590
+ buildDbArguments(target, {
7591
+ sql,
7592
+ bindArgs: normalizeBindArgs(bindArgs)
7593
+ }),
7594
+ timeout
7595
+ );
7596
+ return parseQueryResult(response.getDataOrNull());
7597
+ }
7598
+ /**
7599
+ * 事务内批量执行多条 SQL
7600
+ */
7601
+ async execBatch(statements, options) {
7602
+ const { timeout = 30, ...target } = options;
7603
+ const response = await this.asyncCall(
7604
+ DbCallMethod.execBatch,
7605
+ buildDbArguments(target, { statements }),
7606
+ timeout
7607
+ );
7608
+ return parseExecBatchResult(response.getDataOrNull());
7609
+ }
7610
+ /**
7611
+ * 关闭并释放指定数据库连接
7612
+ */
7613
+ async close(options) {
7614
+ const { timeout = 30, ...target } = options;
7615
+ await this.asyncCall(
7616
+ DbCallMethod.close,
7617
+ buildDbArguments(target),
7618
+ timeout
7619
+ );
7620
+ }
7621
+ };
7622
+ var db = new Db();
7623
+
7158
7624
  // src/barutils/bar-utils-call-method.ts
7159
7625
  var BarUtilsCallMethod = {
7160
7626
  // Status bar
@@ -7180,7 +7646,7 @@ var BarUtilsCallMethod = {
7180
7646
  };
7181
7647
 
7182
7648
  // src/barutils/bar-utils.ts
7183
- var callbacks10 = /* @__PURE__ */ new Map();
7649
+ var callbacks12 = /* @__PURE__ */ new Map();
7184
7650
  if (typeof window !== "undefined" && !window.assistsxBarUtilsCallback) {
7185
7651
  window.assistsxBarUtilsCallback = (data) => {
7186
7652
  let callbackId;
@@ -7189,7 +7655,7 @@ if (typeof window !== "undefined" && !window.assistsxBarUtilsCallback) {
7189
7655
  const response = JSON.parse(json);
7190
7656
  callbackId = response.callbackId;
7191
7657
  if (callbackId) {
7192
- const callback = callbacks10.get(callbackId);
7658
+ const callback = callbacks12.get(callbackId);
7193
7659
  if (callback) {
7194
7660
  callback(json);
7195
7661
  }
@@ -7198,7 +7664,7 @@ if (typeof window !== "undefined" && !window.assistsxBarUtilsCallback) {
7198
7664
  console.error("BarUtils callback error:", e);
7199
7665
  } finally {
7200
7666
  if (callbackId) {
7201
- callbacks10.delete(callbackId);
7667
+ callbacks12.delete(callbackId);
7202
7668
  }
7203
7669
  }
7204
7670
  };
@@ -7212,11 +7678,11 @@ var BarUtils = class {
7212
7678
  callbackId: uuid
7213
7679
  };
7214
7680
  const promise = new Promise((resolve) => {
7215
- callbacks10.set(uuid, (data) => {
7681
+ callbacks12.set(uuid, (data) => {
7216
7682
  resolve(data);
7217
7683
  });
7218
7684
  setTimeout(() => {
7219
- callbacks10.delete(uuid);
7685
+ callbacks12.delete(uuid);
7220
7686
  resolve(
7221
7687
  JSON.stringify(
7222
7688
  new CallResponse(-1, { message: "Timeout" }, uuid)
@@ -7497,7 +7963,7 @@ var FloatCallMethod = {
7497
7963
  };
7498
7964
 
7499
7965
  // src/floatingwindow/float.ts
7500
- var callbacks11 = /* @__PURE__ */ new Map();
7966
+ var callbacks13 = /* @__PURE__ */ new Map();
7501
7967
  if (typeof window !== "undefined" && !window.assistsxFloatCallback) {
7502
7968
  window.assistsxFloatCallback = (data) => {
7503
7969
  let callbackId;
@@ -7506,7 +7972,7 @@ if (typeof window !== "undefined" && !window.assistsxFloatCallback) {
7506
7972
  const response = JSON.parse(json);
7507
7973
  callbackId = response.callbackId;
7508
7974
  if (callbackId) {
7509
- const callback = callbacks11.get(callbackId);
7975
+ const callback = callbacks13.get(callbackId);
7510
7976
  if (callback) {
7511
7977
  callback(json);
7512
7978
  }
@@ -7515,7 +7981,7 @@ if (typeof window !== "undefined" && !window.assistsxFloatCallback) {
7515
7981
  console.error("Float callback error:", e);
7516
7982
  } finally {
7517
7983
  if (callbackId) {
7518
- callbacks11.delete(callbackId);
7984
+ callbacks13.delete(callbackId);
7519
7985
  }
7520
7986
  }
7521
7987
  };
@@ -7529,11 +7995,11 @@ var Float = class {
7529
7995
  callbackId: uuid
7530
7996
  };
7531
7997
  const promise = new Promise((resolve) => {
7532
- callbacks11.set(uuid, (data) => {
7998
+ callbacks13.set(uuid, (data) => {
7533
7999
  resolve(data);
7534
8000
  });
7535
8001
  setTimeout(() => {
7536
- callbacks11.delete(uuid);
8002
+ callbacks13.delete(uuid);
7537
8003
  resolve(
7538
8004
  JSON.stringify(
7539
8005
  new CallResponse(-1, { message: "Timeout" }, uuid)
@@ -7695,7 +8161,9 @@ var LogCallMethod = {
7695
8161
  unsubscribe: "unsubscribe",
7696
8162
  uploadLogs: "uploadLogs",
7697
8163
  /** 获取日志服务当前域名(origin,无路径;与上传、管理后台同源),对应 AssistsLogDiagnostics.adminWebBaseUrl() */
7698
- getLogServiceBaseUrl: "getLogServiceBaseUrl"
8164
+ getLogServiceBaseUrl: "getLogServiceBaseUrl",
8165
+ /** 解析日志文件绝对路径(不创建文件) */
8166
+ resolveLogPath: "resolveLogPath"
7699
8167
  };
7700
8168
  var LogStream = {
7701
8169
  latestLine: "latestLine",
@@ -7706,6 +8174,26 @@ var LogStream = {
7706
8174
  var pendingCallbacks = /* @__PURE__ */ new Map();
7707
8175
  var streamHandlers = /* @__PURE__ */ new Map();
7708
8176
  var subscriptionIdToCallbackId = /* @__PURE__ */ new Map();
8177
+ function buildLogArguments(target, extra) {
8178
+ const args = { ...extra };
8179
+ if ((target == null ? void 0 : target.dirPath) !== void 0) {
8180
+ args.dirPath = target.dirPath;
8181
+ }
8182
+ if ((target == null ? void 0 : target.fileName) !== void 0) {
8183
+ args.fileName = target.fileName;
8184
+ }
8185
+ return Object.keys(args).length > 0 ? args : void 0;
8186
+ }
8187
+ function resolveTimeout(timeoutOrOptions, fallback = 30) {
8188
+ var _a2;
8189
+ if (typeof timeoutOrOptions === "number") {
8190
+ return { timeout: timeoutOrOptions };
8191
+ }
8192
+ return {
8193
+ timeout: (_a2 = timeoutOrOptions == null ? void 0 : timeoutOrOptions.timeout) != null ? _a2 : fallback,
8194
+ target: timeoutOrOptions
8195
+ };
8196
+ }
7709
8197
  if (typeof window !== "undefined" && !window.assistsxLogCallback) {
7710
8198
  window.assistsxLogCallback = (data) => {
7711
8199
  try {
@@ -7781,11 +8269,12 @@ var Log = class {
7781
8269
  throw new Error("Log bridge call failed");
7782
8270
  }
7783
8271
  /** 读取当前日志全文 */
7784
- async readAllText(timeout) {
8272
+ async readAllText(timeoutOrOptions) {
7785
8273
  var _a2;
8274
+ const { timeout, target } = resolveTimeout(timeoutOrOptions);
7786
8275
  const res = await this.asyncCall(
7787
8276
  LogCallMethod.readAllText,
7788
- void 0,
8277
+ buildLogArguments(target),
7789
8278
  timeout
7790
8279
  );
7791
8280
  const d = res.getDataOrNull();
@@ -7805,42 +8294,69 @@ var Log = class {
7805
8294
  const d = res.getDataOrNull();
7806
8295
  return (_a2 = d == null ? void 0 : d.baseUrl) != null ? _a2 : "";
7807
8296
  }
8297
+ /**
8298
+ * 解析日志文件绝对路径(不创建文件)。
8299
+ * AssistsX 插件环境下会经原生拦截追加 log-{packageName} 子目录。
8300
+ */
8301
+ async resolveLogPath(targetOrOptions) {
8302
+ var _a2;
8303
+ const { timeout, target } = resolveTimeout(targetOrOptions);
8304
+ const res = await this.asyncCall(
8305
+ LogCallMethod.resolveLogPath,
8306
+ buildLogArguments(target),
8307
+ timeout
8308
+ );
8309
+ const d = res.getDataOrNull();
8310
+ return (_a2 = d == null ? void 0 : d.logFilePath) != null ? _a2 : "";
8311
+ }
7808
8312
  /** 清空日志 */
7809
- async clear(timeout) {
8313
+ async clear(timeoutOrOptions) {
8314
+ const { timeout, target } = resolveTimeout(timeoutOrOptions);
7810
8315
  const res = await this.asyncCall(
7811
8316
  LogCallMethod.clear,
7812
- void 0,
8317
+ buildLogArguments(target),
7813
8318
  timeout
7814
8319
  );
7815
8320
  return res.isSuccess();
7816
8321
  }
7817
8322
  /** 从文件重新加载到内存 Flow */
7818
- async refreshFromFile(timeout) {
8323
+ async refreshFromFile(timeoutOrOptions) {
8324
+ const { timeout, target } = resolveTimeout(timeoutOrOptions);
7819
8325
  const res = await this.asyncCall(
7820
8326
  LogCallMethod.refreshFromFile,
7821
- void 0,
8327
+ buildLogArguments(target),
7822
8328
  timeout
7823
8329
  );
7824
8330
  return res.isSuccess();
7825
8331
  }
7826
8332
  /** 追加一行 */
7827
- async appendLine(line, maxLength, timeout) {
7828
- const args = { line };
7829
- if (maxLength !== void 0) {
7830
- args.maxLength = maxLength;
8333
+ async appendLine(line, maxLengthOrOptions, timeout) {
8334
+ var _a2;
8335
+ let options;
8336
+ if (typeof maxLengthOrOptions === "number") {
8337
+ options = { maxLength: maxLengthOrOptions, timeout };
8338
+ } else {
8339
+ options = maxLengthOrOptions;
8340
+ }
8341
+ const args = (_a2 = buildLogArguments(options, { line })) != null ? _a2 : { line };
8342
+ if ((options == null ? void 0 : options.maxLength) !== void 0) {
8343
+ args.maxLength = options.maxLength;
7831
8344
  }
7832
8345
  const res = await this.asyncCall(
7833
8346
  LogCallMethod.appendLine,
7834
8347
  args,
7835
- timeout
8348
+ options == null ? void 0 : options.timeout
7836
8349
  );
7837
8350
  return res.isSuccess();
7838
8351
  }
7839
8352
  /** 追加带时间戳的条目 */
7840
- async appendTimestampedEntry(message, timeout) {
8353
+ async appendTimestampedEntry(message, timeoutOrOptions) {
8354
+ var _a2;
8355
+ const { timeout, target } = resolveTimeout(timeoutOrOptions);
8356
+ const args = (_a2 = buildLogArguments(target, { message })) != null ? _a2 : { message };
7841
8357
  const res = await this.asyncCall(
7842
8358
  LogCallMethod.appendTimestampedEntry,
7843
- { message },
8359
+ args,
7844
8360
  timeout
7845
8361
  );
7846
8362
  return res.isSuccess();
@@ -7850,17 +8366,20 @@ var Log = class {
7850
8366
  * 默认带时间戳;`timestamped: false` 时走 appendLine。
7851
8367
  */
7852
8368
  async append(text, options) {
7853
- const { timestamped = true, maxLength, timeout } = options != null ? options : {};
8369
+ const { timestamped = true, maxLength, timeout, ...target } = options != null ? options : {};
7854
8370
  if (timestamped) {
7855
- return this.appendTimestampedEntry(text, timeout);
8371
+ return this.appendTimestampedEntry(text, { ...target, timeout });
7856
8372
  }
7857
- return this.appendLine(text, maxLength, timeout);
8373
+ return this.appendLine(text, { ...target, maxLength, timeout });
7858
8374
  }
7859
8375
  /** 替换全部内容 */
7860
- async replaceAll(content, timeout) {
8376
+ async replaceAll(content, timeoutOrOptions) {
8377
+ var _a2;
8378
+ const { timeout, target } = resolveTimeout(timeoutOrOptions);
8379
+ const args = (_a2 = buildLogArguments(target, { content })) != null ? _a2 : { content };
7861
8380
  const res = await this.asyncCall(
7862
8381
  LogCallMethod.replaceAll,
7863
- { content },
8382
+ args,
7864
8383
  timeout
7865
8384
  );
7866
8385
  return res.isSuccess();
@@ -7870,10 +8389,11 @@ var Log = class {
7870
8389
  * resolve 后请保留 dispose 或调用 unsubscribe(subscriptionId) 以释放原生协程与 JS 回调。
7871
8390
  */
7872
8391
  async subscribe(stream, onUpdate, options) {
7873
- var _a2;
8392
+ var _a2, _b;
7874
8393
  const self = this;
7875
8394
  const callbackId = generateUUID();
7876
8395
  const timeoutSec = (_a2 = options == null ? void 0 : options.timeout) != null ? _a2 : 30;
8396
+ const subscribeArgs = (_b = buildLogArguments(options, { stream })) != null ? _b : { stream };
7877
8397
  return new Promise((resolve, reject) => {
7878
8398
  let settled = false;
7879
8399
  const timer = setTimeout(() => {
@@ -7884,7 +8404,7 @@ var Log = class {
7884
8404
  }
7885
8405
  }, timeoutSec * 1e3);
7886
8406
  streamHandlers.set(callbackId, (raw) => {
7887
- var _a3, _b, _c;
8407
+ var _a3, _b2, _c;
7888
8408
  let response;
7889
8409
  try {
7890
8410
  response = JSON.parse(raw);
@@ -7923,9 +8443,10 @@ var Log = class {
7923
8443
  }
7924
8444
  if ((data == null ? void 0 : data.event) === "update" && data.subscriptionId) {
7925
8445
  onUpdate({
7926
- text: (_b = data.text) != null ? _b : "",
8446
+ text: (_b2 = data.text) != null ? _b2 : "",
7927
8447
  stream: (_c = data.stream) != null ? _c : stream,
7928
- subscriptionId: data.subscriptionId
8448
+ subscriptionId: data.subscriptionId,
8449
+ logFilePath: data.logFilePath
7929
8450
  });
7930
8451
  }
7931
8452
  });
@@ -7933,7 +8454,7 @@ var Log = class {
7933
8454
  this.getBridge().call(
7934
8455
  JSON.stringify({
7935
8456
  method: LogCallMethod.subscribe,
7936
- arguments: { stream },
8457
+ arguments: subscribeArgs,
7937
8458
  callbackId
7938
8459
  })
7939
8460
  );
@@ -7977,6 +8498,12 @@ var Log = class {
7977
8498
  if (args.uploadKey !== void 0) {
7978
8499
  payload.uploadKey = args.uploadKey;
7979
8500
  }
8501
+ if (args.dirPath !== void 0) {
8502
+ payload.dirPath = args.dirPath;
8503
+ }
8504
+ if (args.fileName !== void 0) {
8505
+ payload.fileName = args.fileName;
8506
+ }
7980
8507
  const uuid = generateUUID();
7981
8508
  const params = {
7982
8509
  method: LogCallMethod.uploadLogs,
@@ -8032,6 +8559,8 @@ var log = new Log();
8032
8559
  Bounds,
8033
8560
  CallMethod,
8034
8561
  CallResponse,
8562
+ Db,
8563
+ DbCallMethod,
8035
8564
  DeviceInfo,
8036
8565
  FileIO,
8037
8566
  FileUtils,
@@ -8053,6 +8582,9 @@ var log = new Log();
8053
8582
  NodeAsync,
8054
8583
  NodeClassValue,
8055
8584
  Path,
8585
+ PluginInfo,
8586
+ Screenshot,
8587
+ ScreenshotCallMethod,
8056
8588
  Step,
8057
8589
  StepAsync,
8058
8590
  StepError,
@@ -8061,6 +8593,7 @@ var log = new Log();
8061
8593
  accessibilityEventListeners,
8062
8594
  barUtils,
8063
8595
  callbacks,
8596
+ db,
8064
8597
  decodeBase64UTF8,
8065
8598
  ensureAssistsXPinia,
8066
8599
  fileIO,
@@ -8076,6 +8609,7 @@ var log = new Log();
8076
8609
  mlkit,
8077
8610
  pathUtils,
8078
8611
  screen,
8612
+ screenshot,
8079
8613
  sleep,
8080
8614
  useStepStore
8081
8615
  });