@dompling/trollscript-types 1.0.47 → 1.0.49

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 (2) hide show
  1. package/index.d.ts +521 -733
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -33,12 +33,6 @@ interface Console {
33
33
  */
34
34
  debug(...args: any[]): void;
35
35
 
36
- /**
37
- * 以表格形式输出
38
- * @param data 要显示的表格数据
39
- */
40
- table(data: any): void;
41
-
42
36
  /**
43
37
  * 清空控制台
44
38
  */
@@ -89,6 +83,12 @@ interface Clipboard {
89
83
  */
90
84
  clear(): void;
91
85
 
86
+ /**
87
+ * 检查剪贴板是否包含文本
88
+ * @returns 剪贴板是否有文本内容
89
+ */
90
+ hasText(): boolean;
91
+
92
92
  }
93
93
 
94
94
  declare const clipboard: Clipboard;
@@ -126,17 +126,17 @@ interface Storage {
126
126
  */
127
127
  has(key: string): boolean;
128
128
 
129
+ /**
130
+ * 获取所有存储的键
131
+ * @returns 所有键名的数组
132
+ */
133
+ keys(): any;
134
+
129
135
  }
130
136
 
131
137
  declare const storage: Storage;
132
138
 
133
139
  interface Icloud {
134
- /**
135
- * 检查 iCloud 是否可用
136
- * @returns 是否可用
137
- */
138
- isAvailable(): boolean;
139
-
140
140
  /**
141
141
  * 获取 iCloud 容器路径
142
142
  * @returns iCloud 容器的本地路径,不可用时返回 null
@@ -170,7 +170,7 @@ interface Icloud {
170
170
  * @param path 目录路径,默认为根目录
171
171
  * @returns 文件名列表数组
172
172
  */
173
- list(path: string): any;
173
+ list(path?: string): any;
174
174
 
175
175
  }
176
176
 
@@ -331,62 +331,69 @@ declare const file: File;
331
331
 
332
332
  interface Http {
333
333
  /**
334
- * 发送 GET 请求
334
+ * 发送 GET 请求(异步,返回 Promise)
335
335
  * @param url 请求地址
336
- * @param options 请求选项 { headers, timeout }
337
- * @returns 包含状态码、响应数据、响应头的对象
336
+ * @param options 请求选项 { headers, timeout, insecure, sync }
337
+ * @returns 返回 Promise,resolve 时包含成功状态、状态码、响应数据、响应头的对象。设置 sync: true 可使用同步模式
338
338
  */
339
- get(url: string, options: Record<string, any>): any;
339
+ get(url: string, options?: Record<string, any>): any;
340
340
 
341
341
  /**
342
- * 发送 POST 请求
342
+ * 发送 POST 请求(异步,返回 Promise)
343
343
  * @param url 请求地址
344
- * @param options 请求选项 { body, headers, timeout }
344
+ * @param options 请求选项 { body, headers, timeout, insecure, sync }
345
+ * @returns 返回 Promise,resolve 时包含响应结果。设置 sync: true 可使用同步模式
345
346
  */
346
- post(url: string, options: Record<string, any>): any;
347
+ post(url: string, options?: Record<string, any>): any;
347
348
 
348
349
  /**
349
- * 发送 PUT 请求
350
+ * 发送 PUT 请求(异步,返回 Promise)
350
351
  * @param url 请求地址
351
- * @param options 请求选项 { body, headers, timeout }
352
+ * @param options 请求选项 { body, headers, timeout, insecure, sync }
353
+ * @returns 返回 Promise,resolve 时包含响应结果
352
354
  */
353
- put(url: string, options: Record<string, any>): any;
355
+ put(url: string, options?: Record<string, any>): any;
354
356
 
355
357
  /**
356
- * 发送 DELETE 请求
358
+ * 发送 DELETE 请求(异步,返回 Promise)
357
359
  * @param url 请求地址
358
- * @param options 请求选项 { headers, timeout }
360
+ * @param options 请求选项 { headers, timeout, insecure, sync }
361
+ * @returns 返回 Promise,resolve 时包含响应结果
359
362
  */
360
- delete(url: string, options: Record<string, any>): any;
363
+ delete(url: string, options?: Record<string, any>): any;
361
364
 
362
365
  /**
363
- * 发送 PATCH 请求
366
+ * 发送 PATCH 请求(异步,返回 Promise)
364
367
  * @param url 请求地址
365
- * @param options 请求选项 { body, headers, timeout }
368
+ * @param options 请求选项 { body, headers, timeout, insecure, sync }
369
+ * @returns 返回 Promise,resolve 时包含响应结果
366
370
  */
367
- patch(url: string, options: Record<string, any>): any;
371
+ patch(url: string, options?: Record<string, any>): any;
368
372
 
369
373
  /**
370
- * 发送 HEAD 请求
374
+ * 发送 HEAD 请求(异步,返回 Promise)
371
375
  * @param url 请求地址
372
- * @param options 请求选项 { headers, timeout }
376
+ * @param options 请求选项 { headers, timeout, insecure, sync }
377
+ * @returns 返回 Promise,resolve 时包含响应结果(HEAD 请求通常 data 为空)
373
378
  */
374
- head(url: string, options: Record<string, any>): any;
379
+ head(url: string, options?: Record<string, any>): any;
375
380
 
376
381
  /**
377
- * 发送自定义请求
382
+ * 发送自定义 HTTP 请求(异步,返回 Promise)
378
383
  * @param url 请求地址
379
- * @param options 请求选项 { method, body, headers, timeout }
384
+ * @param options 请求选项 { method, body, headers, timeout, insecure, sync }
385
+ * @returns 返回 Promise,resolve 时包含响应结果
380
386
  */
381
387
  request(url: string, options: Record<string, any>): any;
382
388
 
383
389
  /**
384
- * 下载文件
390
+ * 下载文件(异步,返回 Promise)
385
391
  * @param url 下载地址
386
392
  * @param path 保存路径
387
- * @returns 包含本地文件路径的对象
393
+ * @param options 请求选项 { insecure, sync }
394
+ * @returns 返回 Promise,resolve 时包含成功状态和本地文件路径
388
395
  */
389
- download(url: string, path: string): any;
396
+ download(url: string, path: string, options?: Record<string, any>): any;
390
397
 
391
398
  }
392
399
 
@@ -411,12 +418,6 @@ interface Network {
411
418
  */
412
419
  getIPAddress(): any;
413
420
 
414
- /**
415
- * 获取 WiFi 信息
416
- * @returns 包含 SSID 和 BSSID 的对象
417
- */
418
- getWiFiInfo(): any;
419
-
420
421
  /**
421
422
  * URL 编码
422
423
  * @param string 要编码的字符串
@@ -444,12 +445,12 @@ interface Network {
444
445
  * @param params 查询参数
445
446
  * @returns 构建的 URL 字符串
446
447
  */
447
- buildURL(baseURL: string, params: Record<string, any>): string;
448
+ buildURL(baseURL: string, params?: Record<string, any>): string;
448
449
 
449
450
  /**
450
451
  * Ping 主机
451
452
  * @param host 主机名或 IP
452
- * @returns 包含延迟和成功状态的对象
453
+ * @returns 包含成功状态和延迟(毫秒)的对象
453
454
  */
454
455
  ping(host: string): any;
455
456
 
@@ -457,22 +458,9 @@ interface Network {
457
458
  * 下载文件
458
459
  * @param url 下载地址
459
460
  * @param filename 保存文件名
460
- * @returns 包含本地文件路径的对象
461
- */
462
- download(url: string, filename: string): any;
463
-
464
- /**
465
- * 获取飞行模式状态
466
- * @returns 是否开启
461
+ * @returns 包含成功状态和本地文件路径的对象
467
462
  */
468
- getAirplaneMode(): boolean;
469
-
470
- /**
471
- * 设置飞行模式
472
- * @param enabled 是否开启
473
- * @returns 是否设置成功
474
- */
475
- setAirplaneMode(enabled: boolean): boolean;
463
+ download(url: string, filename?: string): any;
476
464
 
477
465
  /**
478
466
  * 列出 VPN 配置
@@ -485,7 +473,7 @@ interface Network {
485
473
  * @param name VPN 名称,默认第一个
486
474
  * @returns 是否发起连接成功
487
475
  */
488
- connectVPN(name: string): boolean;
476
+ connectVPN(name?: string): boolean;
489
477
 
490
478
  /**
491
479
  * 断开 VPN
@@ -499,25 +487,12 @@ interface Network {
499
487
  */
500
488
  getVPNStatus(): any;
501
489
 
502
- /**
503
- * 获取 WiFi 开关状态
504
- * @returns 是否开启
505
- */
506
- getWiFiEnabled(): boolean;
507
-
508
- /**
509
- * 设置 WiFi 开关
510
- * @param enabled 是否开启
511
- * @returns 是否设置成功
512
- */
513
- setWiFi(enabled: boolean): boolean;
514
-
515
490
  /**
516
491
  * 打开系统设置
517
492
  * @param section 设置页面(如 'WIFI')
518
493
  * @returns 是否成功打开
519
494
  */
520
- openSettings(section: string): boolean;
495
+ openSettings(section?: string): boolean;
521
496
 
522
497
  }
523
498
 
@@ -530,12 +505,30 @@ interface App {
530
505
  */
531
506
  version(): string;
532
507
 
508
+ /**
509
+ * 获取应用构建号
510
+ * @returns 应用构建号 (CFBundleVersion)
511
+ */
512
+ build(): string;
513
+
514
+ /**
515
+ * 获取应用 Bundle ID
516
+ * @returns 应用的 Bundle Identifier
517
+ */
518
+ bundleId(): string;
519
+
520
+ /**
521
+ * 获取应用完整信息
522
+ * @returns 包含 name, version, build, bundleId, language 的应用信息对象
523
+ */
524
+ info(): any;
525
+
533
526
  /**
534
527
  * 打开 URL/Scheme
535
528
  * @param url 要打开的 URL
536
529
  * @returns 是否成功打开
537
530
  */
538
- open(url: string): any;
531
+ open(url: string): boolean;
539
532
 
540
533
  /**
541
534
  * 检查是否能打开
@@ -554,7 +547,7 @@ interface App {
554
547
  * @param limit 返回的日志条数
555
548
  * @returns 日志对象数组
556
549
  */
557
- getLogs(limit: number): any;
550
+ getLogs(limit?: number): any;
558
551
 
559
552
  /**
560
553
  * 导出日志为字符串
@@ -579,6 +572,107 @@ interface App {
579
572
  */
580
573
  clearLogs(): void;
581
574
 
575
+ /**
576
+ * 退出应用(仅用于调试)
577
+ * @param code 退出码,默认为 0
578
+ */
579
+ exit(code?: number): void;
580
+
581
+ /**
582
+ * 打开应用设置页面
583
+ * @returns 是否成功打开设置
584
+ */
585
+ openSettings(): boolean;
586
+
587
+ /**
588
+ * 获取所有已安装应用列表 (TrollStore 权限)
589
+ * @returns 应用信息数组,包含 bundleIdentifier, name, version, type 等字段
590
+ */
591
+ list(): any;
592
+
593
+ /**
594
+ * 获取指定应用的详细信息 (TrollStore 权限)
595
+ * @param bundleId 应用的 Bundle Identifier
596
+ * @returns 应用信息对象,包含 bundleIdentifier, name, version, build, type, teamID, bundlePath, dataContainerPath, urlSchemes 等
597
+ */
598
+ getAppInfo(bundleId: string): any;
599
+
600
+ /**
601
+ * 启动指定应用 (TrollStore 权限)
602
+ * @param bundleId 应用的 Bundle Identifier
603
+ * @returns 是否成功启动
604
+ */
605
+ launch(bundleId: string): boolean;
606
+
607
+ /**
608
+ * 终止指定应用 (TrollStore 权限,需要后台权限)
609
+ * @param bundleId 应用的 Bundle Identifier
610
+ * @returns 是否成功终止
611
+ */
612
+ terminate(bundleId: string): boolean;
613
+
614
+ /**
615
+ * 检查应用是否已安装
616
+ * @param bundleId 应用的 Bundle Identifier
617
+ * @returns 是否已安装
618
+ */
619
+ isInstalled(bundleId: string): boolean;
620
+
621
+ /**
622
+ * 获取应用数据容器路径 (TrollStore 权限)
623
+ * @param bundleId 应用的 Bundle Identifier
624
+ * @returns 数据容器路径,未找到返回 null
625
+ */
626
+ getDataContainer(bundleId: string): any;
627
+
628
+ /**
629
+ * 获取 CPU 使用率(进程级 + 系统级)
630
+ * @returns 包含 process (进程 CPU %) 和 system (系统 CPU 对象,含 total/user/system/idle/nice/cores) 的对象
631
+ */
632
+ cpuUsage(): any;
633
+
634
+ /**
635
+ * 获取内存使用情况
636
+ * @returns 包含 usage (当前使用 MB), peak (峰值 MB), unit (单位) 的对象
637
+ */
638
+ memoryUsage(): any;
639
+
640
+ /**
641
+ * 获取当前帧率
642
+ * @returns 包含 fps (帧率), isWarning (警告状态), isCritical (危险状态) 的对象
643
+ */
644
+ fps(): any;
645
+
646
+ /**
647
+ * 获取完整性能指标快照
648
+ * @returns 包含 cpu, memory, fps, isMonitoring, timestamp 的完整性能快照
649
+ */
650
+ performanceSnapshot(): any;
651
+
652
+ /**
653
+ * 开启性能监控(FPS 采样、指标记录)
654
+ * @returns 是否成功开启
655
+ */
656
+ startMonitoring(): boolean;
657
+
658
+ /**
659
+ * 停止性能监控
660
+ * @returns 是否成功停止
661
+ */
662
+ stopMonitoring(): boolean;
663
+
664
+ /**
665
+ * 获取历史性能记录
666
+ * @param limit 返回的记录数量,默认 50
667
+ * @returns 性能记录数组,包含 id, scriptName, executionTime, peakMemory, averageCPU, timestamp, success
668
+ */
669
+ performanceRecords(limit?: number): any;
670
+
671
+ /**
672
+ * 清除所有性能记录
673
+ */
674
+ clearPerformanceRecords(): void;
675
+
582
676
  }
583
677
 
584
678
  declare const app: App;
@@ -588,7 +682,7 @@ interface Haptic {
588
682
  * 触觉冲击反馈
589
683
  * @param style 'light' | 'medium' | 'heavy' | 'soft' | 'rigid'
590
684
  */
591
- impact(style: string): void;
685
+ impact(style?: string): void;
592
686
 
593
687
  /**
594
688
  * 通知触觉反馈
@@ -650,24 +744,27 @@ interface Display {
650
744
  /**
651
745
  * 设置屏幕亮度
652
746
  * @param value 亮度值 (0.0 - 1.0)
747
+ * @returns 是否设置成功
653
748
  */
654
- setBrightness(value: number): void;
749
+ setBrightness(value: number): boolean;
655
750
 
656
751
  /**
657
752
  * 增加亮度
658
753
  * @param amount 增加量 (默认 0.1)
754
+ * @returns 是否设置成功
659
755
  */
660
- increaseBrightness(amount: number): void;
756
+ increaseBrightness(amount?: number): boolean;
661
757
 
662
758
  /**
663
759
  * 降低亮度
664
760
  * @param amount 减少量 (默认 0.1)
761
+ * @returns 是否设置成功
665
762
  */
666
- decreaseBrightness(amount: number): void;
763
+ decreaseBrightness(amount?: number): boolean;
667
764
 
668
765
  /**
669
766
  * 获取屏幕信息
670
- * @returns 包含宽度、高度、缩放比例的对象
767
+ * @returns 包含宽度、高度、缩放比例和原生分辨率的对象
671
768
  */
672
769
  getScreenInfo(): any;
673
770
 
@@ -691,72 +788,70 @@ interface Display {
691
788
  setLowPowerMode(enabled: boolean): boolean;
692
789
 
693
790
  /**
694
- * 获取夜览状态
791
+ * 自动亮度是否开启
695
792
  * @returns 是否开启
696
793
  */
697
- getNightShiftStatus(): boolean;
794
+ isAutoBrightnessEnabled(): boolean;
698
795
 
699
796
  /**
700
- * 设置夜览
797
+ * 设置自动亮度
701
798
  * @param enabled 是否开启
702
799
  * @returns 是否设置成功
703
800
  */
704
- setNightShift(enabled: boolean): boolean;
801
+ setAutoBrightness(enabled: boolean): boolean;
705
802
 
706
803
  /**
707
- * 获取原彩显示状态
708
- * @returns 是否开启
804
+ * 打开显示设置
805
+ * @returns 是否成功打开
709
806
  */
710
- getTrueToneStatus(): boolean;
807
+ openSettings(): boolean;
711
808
 
712
809
  /**
713
- * 设置原彩显示
714
- * @param enabled 是否开启
810
+ * 保持屏幕常亮
811
+ * @param enabled 是否保持常亮
715
812
  * @returns 是否设置成功
716
813
  */
717
- setTrueTone(enabled: boolean): boolean;
814
+ keepAwake(enabled: boolean): boolean;
718
815
 
719
- /**
720
- * 自动亮度是否开启
721
- * @returns 是否开启
722
- */
723
- isAutoBrightnessEnabled(): boolean;
816
+ }
817
+
818
+ declare const display: Display;
724
819
 
820
+ interface Hud {
725
821
  /**
726
- * 设置自动亮度
727
- * @param enabled 是否开启
728
- * @returns 是否设置成功
822
+ * 创建 HUD 窗口
823
+ * @param config 窗口配置 { id?, width?, height?, x?, y?, draggable?, dismissible?, autoClear?, style? },style 为 { backgroundColor?, textColor?, fontSize?, fontWeight?, cornerRadius?, padding?, opacity?, shadow? }
824
+ * @returns 窗口对象,可用于添加元素和控制窗口
729
825
  */
730
- setAutoBrightness(enabled: boolean): boolean;
826
+ createWindow(config: Record<string, any>): any;
731
827
 
732
828
  /**
733
- * 打开显示设置
734
- * @returns 是否成功打开
829
+ * 根据 ID 获取已存在的窗口
830
+ * @param id 窗口 ID
831
+ * @returns 窗口对象,未找到返回 null
735
832
  */
736
- openSettings(): boolean;
833
+ getWindow(id: string): any;
737
834
 
738
835
  /**
739
- * 获取自动锁定时间
740
- * @returns 自动锁定时间(秒),0 表示永不
836
+ * 获取屏幕尺寸信息
837
+ * @returns 包含 width, height, scale 的屏幕信息对象
741
838
  */
742
- getAutoLockTime(): number;
839
+ getScreenSize(): any;
743
840
 
744
841
  /**
745
- * 设置自动锁定时间
746
- * @param seconds 锁定时间(秒),0 表示永不
747
- * @returns 是否设置成功
842
+ * 清除所有 HUD 窗口
748
843
  */
749
- setAutoLock(seconds: number): boolean;
844
+ clearAll(): void;
750
845
 
751
846
  /**
752
- * 保持屏幕常亮
753
- * @param enabled 是否保持常亮
847
+ * 获取所有窗口 ID 列表
848
+ * @returns 窗口 ID 数组
754
849
  */
755
- keepAwake(enabled: boolean): void;
850
+ getAllWindows(): any;
756
851
 
757
852
  }
758
853
 
759
- declare const display: Display;
854
+ declare const hud: Hud;
760
855
 
761
856
  interface Util {
762
857
  /**
@@ -787,12 +882,31 @@ interface Util {
787
882
  base64Decode(string: string): string;
788
883
 
789
884
  /**
790
- * 格式化日期
791
- * @param date 日期对象
792
- * @param format 格式字符串 (如 'yyyy-MM-dd')
885
+ * 计算 SHA256 哈希
886
+ * @param string 要计算的字符串
887
+ * @returns SHA256 哈希值
888
+ */
889
+ sha256(string: string): string;
890
+
891
+ /**
892
+ * 格式化时间戳为字符串
893
+ * @param timestamp 时间戳(毫秒)
894
+ * @param format 格式模式(如 'yyyy-MM-dd'),默认为 'yyyy-MM-dd HH:mm:ss'
793
895
  * @returns 格式化后的日期字符串
794
896
  */
795
- formatDate(date: any, format: string): string;
897
+ formatDate(timestamp: number, format?: string): string;
898
+
899
+ /**
900
+ * 获取当前时间戳(毫秒)
901
+ * @returns 当前时间戳
902
+ */
903
+ now(): number;
904
+
905
+ /**
906
+ * 休眠指定时长
907
+ * @param ms 休眠时长(毫秒)
908
+ */
909
+ sleep(ms: number): void;
796
910
 
797
911
  }
798
912
 
@@ -818,13 +932,13 @@ interface Location {
818
932
 
819
933
  /**
820
934
  * 获取当前位置
821
- * @returns 位置信息对象(包含经纬度、海拔等)
935
+ * @returns 位置信息对象(包含经纬度、海拔、精度等),失败返回 null
822
936
  */
823
937
  getCurrent(): any;
824
938
 
825
939
  /**
826
940
  * 获取当前位置(别名)
827
- * @returns 位置信息对象
941
+ * @returns 位置信息对象,失败返回 null
828
942
  */
829
943
  current(): any;
830
944
 
@@ -849,9 +963,10 @@ interface Location {
849
963
  * 坐标转地址
850
964
  * @param lat 纬度
851
965
  * @param lng 经度
966
+ * @param locale 语言区域标识(可选,如 'zh_CN'、'en_US',默认使用系统语言)
852
967
  * @returns 地址信息对象数组
853
968
  */
854
- reverseGeocode(lat: number, lng: number): any;
969
+ reverseGeocode(lat: number, lng: number, locale?: string): any;
855
970
 
856
971
  /**
857
972
  * 定位服务是否开启
@@ -859,6 +974,25 @@ interface Location {
859
974
  */
860
975
  isLocationServicesEnabled(): boolean;
861
976
 
977
+ /**
978
+ * 检查是否有 TrollStore 权限
979
+ * @returns 是否有权限
980
+ */
981
+ hasTrollStorePermission(): boolean;
982
+
983
+ /**
984
+ * 开关系统定位服务(需要 TrollStore 权限)
985
+ * @param enabled true 开启,false 关闭
986
+ * @returns 操作结果(success 表示是否成功,enabled 为当前状态)
987
+ */
988
+ setLocationServicesEnabled(enabled: boolean): any;
989
+
990
+ /**
991
+ * 切换定位服务状态(需要 TrollStore 权限)
992
+ * @returns 操作结果(success 表示是否成功,enabled 为切换后状态)
993
+ */
994
+ toggleLocationServices(): any;
995
+
862
996
  }
863
997
 
864
998
  declare const location: Location;
@@ -873,7 +1007,7 @@ interface Calendar {
873
1007
  * 请求日历权限
874
1008
  * @returns 是否授权成功
875
1009
  */
876
- requestAccess(): any;
1010
+ requestAccess(): boolean;
877
1011
 
878
1012
  /**
879
1013
  * 获取所有日历
@@ -894,7 +1028,7 @@ interface Calendar {
894
1028
  * @param calendarId 日历 ID
895
1029
  * @returns 事件数组
896
1030
  */
897
- getEvents(start: number, end: number, calendarId: string): any;
1031
+ getEvents(start: number, end: number, calendarId?: string): any;
898
1032
 
899
1033
  /**
900
1034
  * 创建日历事件
@@ -902,16 +1036,16 @@ interface Calendar {
902
1036
  * @param start 开始时间戳
903
1037
  * @param end 结束时间戳
904
1038
  * @param options 选项 { calendarId, notes, location, url, allDay }
905
- * @returns 创建的事件 ID
1039
+ * @returns 创建的事件 ID,失败返回 null
906
1040
  */
907
- create(title: string, start: number, end: number, options: Record<string, any>): any;
1041
+ create(title: string, start: number, end: number, options?: Record<string, any>): any;
908
1042
 
909
1043
  /**
910
1044
  * 删除日历事件
911
1045
  * @param id 事件 ID
912
1046
  * @returns 是否删除成功
913
1047
  */
914
- delete(id: string): any;
1048
+ delete(id: string): boolean;
915
1049
 
916
1050
  }
917
1051
 
@@ -928,7 +1062,7 @@ interface Reminder {
928
1062
  * 请求提醒事项权限
929
1063
  * @returns 是否授权成功
930
1064
  */
931
- requestAccess(): any;
1065
+ requestAccess(): boolean;
932
1066
 
933
1067
  /**
934
1068
  * 获取所有提醒列表
@@ -941,43 +1075,43 @@ interface Reminder {
941
1075
  * @param listId 列表 ID
942
1076
  * @returns 提醒事项数组
943
1077
  */
944
- getAll(listId: string): any;
1078
+ getAll(listId?: string): any;
945
1079
 
946
1080
  /**
947
1081
  * 创建提醒事项
948
1082
  * @param title 标题
949
- * @param options 选项 { listId, notes, dueDate, priority, sortOrder, isPinned }
950
- * @returns 创建的提醒 ID
1083
+ * @param options 选项 { listId, notes, dueDate, priority, location: { latitude, longitude, radius, onArrive, name } }
1084
+ * @returns 创建的提醒 ID,如果是位置提醒则返回详细对象
951
1085
  */
952
- create(title: string, options: Record<string, any>): any;
1086
+ create(title: string, options?: Record<string, any>): any;
953
1087
 
954
1088
  /**
955
1089
  * 标记为已完成
956
1090
  * @param id 提醒事项 ID
957
1091
  * @returns 是否成功
958
1092
  */
959
- complete(id: string): any;
1093
+ complete(id: string): boolean;
960
1094
 
961
1095
  /**
962
1096
  * 删除提醒事项
963
1097
  * @param id 提醒事项 ID
964
1098
  * @returns 是否成功
965
1099
  */
966
- delete(id: string): any;
1100
+ delete(id: string): boolean;
967
1101
 
968
1102
  /**
969
1103
  * 获取排序后的提醒
970
1104
  * @param options { sortBy: 'createdAt'|'dueDate'|'priority'|'title', ascending: boolean, completed: boolean }
971
1105
  * @returns 排序后的提醒列表
972
1106
  */
973
- getSorted(options: Record<string, any>): any;
1107
+ getSorted(options?: Record<string, any>): any;
974
1108
 
975
1109
  /**
976
1110
  * 获取即将到期的提醒
977
1111
  * @param days 未来几天,默认 7 天
978
1112
  * @returns 即将到期的提醒列表
979
1113
  */
980
- getUpcoming(days: number): any;
1114
+ getUpcoming(days?: number): any;
981
1115
 
982
1116
  /**
983
1117
  * 获取已过期的提醒
@@ -988,20 +1122,20 @@ interface Reminder {
988
1122
  /**
989
1123
  * 批量重排序
990
1124
  * @param ids 按顺序排列的 ID 数组
991
- * @returns { success: boolean, count: number }
1125
+ * @returns 操作结果(注意:系统提醒不支持重排序)
992
1126
  */
993
1127
  reorder(ids: any): any;
994
1128
 
995
1129
  /**
996
- * 创建系统提醒(支持位置触发)
1130
+ * 创建系统提醒(支持位置触发等高级功能)
997
1131
  * @param title 标题
998
1132
  * @param options { listId, notes, dueDate, priority, location: { latitude, longitude, radius, onArrive, name } }
999
- * @returns { success: boolean, id: string, title: string, isSystemReminder: true }
1133
+ * @returns 包含成功状态和系统提醒详情的对象
1000
1134
  */
1001
- createSystemReminder(title: string, options: Record<string, any>): any;
1135
+ createSystemReminder(title: string, options?: Record<string, any>): any;
1002
1136
 
1003
1137
  /**
1004
- * 获取系统提醒列表
1138
+ * 获取系统管理的提醒列表
1005
1139
  * @returns 系统提醒列表数组
1006
1140
  */
1007
1141
  getSystemLists(): any;
@@ -1030,12 +1164,12 @@ interface Contacts {
1030
1164
  isAuthorized(): boolean;
1031
1165
 
1032
1166
  /**
1033
- * 获取所有联系人
1167
+ * 获取所有联系人(支持分页)
1034
1168
  * @param offset 跳过的记录数,默认 0
1035
1169
  * @param limit 返回的最大数量,默认全部
1036
1170
  * @returns 联系人对象数组
1037
1171
  */
1038
- getAll(offset: number, limit: number): any;
1172
+ getAll(offset?: number, limit?: number): any;
1039
1173
 
1040
1174
  /**
1041
1175
  * 获取联系人总数
@@ -1045,597 +1179,236 @@ interface Contacts {
1045
1179
 
1046
1180
  /**
1047
1181
  * 按名字搜索联系人
1048
- * @param query 搜索关键词(匹配姓名)
1049
- * @returns 联系人对象数组
1182
+ * @param query 搜索关键词(匹配姓名字段)
1183
+ * @returns 匹配的联系人对象数组
1050
1184
  */
1051
1185
  search(query: string): any;
1052
1186
 
1053
1187
  /**
1054
- * 按电话搜索联系人
1188
+ * 按电话号码搜索联系人
1055
1189
  * @param phone 电话号码(支持模糊匹配)
1056
- * @returns 联系人对象数组
1190
+ * @returns 匹配的联系人对象数组
1057
1191
  */
1058
1192
  searchByPhone(phone: string): any;
1059
1193
 
1060
1194
  /**
1061
- * 按邮箱搜索联系人
1062
- * @param email 邮箱地址(支持模糊匹配)
1063
- * @returns 联系人对象数组
1064
- */
1065
- searchByEmail(email: string): any;
1066
-
1067
- /**
1068
- * 根据 ID 获取联系人
1195
+ * 根据唯一标识符获取联系人
1069
1196
  * @param id 联系人唯一标识符
1070
- * @returns 联系人对象
1197
+ * @returns 联系人对象,未找到返回 null
1071
1198
  */
1072
1199
  getById(id: string): any;
1073
1200
 
1074
1201
  /**
1075
- * 创建联系人
1076
- * @param data 联系人数据 { givenName, familyName, phoneNumbers?, emailAddresses?, ... }
1077
- * @returns 包含成功状态和 ID 的对象
1202
+ * 创建新联系人
1203
+ * @param data 联系人数据,包含 givenName, familyName, phoneNumbers, emailAddresses
1204
+ * @returns 包含成功状态和新联系人 ID 的对象
1078
1205
  */
1079
1206
  create(data: Record<string, any>): any;
1080
1207
 
1081
1208
  /**
1082
- * 更新联系人
1083
- * @param id 联系人唯一标识符
1084
- * @param data 要更新的字段
1085
- * @returns 包含成功状态的对象
1086
- */
1087
- update(id: string, data: Record<string, any>): any;
1088
-
1089
- /**
1090
- * 删除联系人
1209
+ * 删除指定联系人
1091
1210
  * @param id 联系人唯一标识符
1092
1211
  * @returns 包含成功状态的对象
1093
1212
  */
1094
1213
  delete(id: string): any;
1095
1214
 
1096
1215
  /**
1097
- * 获取所有分组
1098
- * @returns 分组数组
1216
+ * 获取所有联系人分组
1217
+ * @returns 分组对象数组
1099
1218
  */
1100
1219
  getGroups(): any;
1101
1220
 
1102
- /**
1103
- * 获取分组内联系人
1104
- * @param groupId 分组唯一标识符
1105
- * @returns 联系人对象数组
1106
- */
1107
- getContactsInGroup(groupId: string): any;
1108
-
1109
1221
  }
1110
1222
 
1111
1223
  declare const contacts: Contacts;
1112
1224
 
1113
- interface Notification {
1114
- /**
1115
- * 发送通知
1116
- * @param title 通知标题
1117
- * @param body 通知内容
1118
- * @param options 选项 { url, userInfo, sound, badge }
1119
- * @returns 发送的通知 ID
1120
- */
1121
- send(title: string, body: string, options: Record<string, any>): any;
1122
-
1123
- /**
1124
- * 取消通知
1125
- * @param id 通知 ID
1126
- */
1127
- cancel(id: string): void;
1128
-
1129
- /**
1130
- * 取消所有通知
1131
- */
1132
- cancelAll(): void;
1133
-
1134
- /**
1135
- * 获取待发送通知
1136
- * @returns 待发送通知列表
1137
- */
1138
- getPending(): any;
1139
-
1140
- /**
1141
- * 获取已发送通知
1142
- * @returns 已发送通知列表
1143
- */
1144
- getDelivered(): any;
1145
-
1146
- /**
1147
- * 请求通知权限
1148
- * @returns 是否授权成功
1149
- */
1150
- requestPermission(): any;
1151
-
1152
- /**
1153
- * 获取权限状态
1154
- * @returns 权限状态
1155
- */
1156
- getPermissionStatus(): any;
1157
-
1158
- /**
1159
- * 设置角标数字
1160
- * @param count 角标数
1161
- */
1162
- setBadge(count: number): void;
1163
-
1164
- /**
1165
- * 获取角标数字
1166
- * @returns 角标数字
1167
- */
1168
- getBadge(): any;
1169
-
1170
- /**
1171
- * 清除角标
1172
- */
1173
- clearBadge(): void;
1174
-
1175
- /**
1176
- * 定时通知
1177
- * @param title 通知标题
1178
- * @param body 通知内容
1179
- * @param date 触发时间戳
1180
- * @param options 选项 { url, userInfo, sound, badge, repeat: 'daily'|'weekly'|'monthly' }
1181
- * @returns 发送的通知 ID
1182
- */
1183
- schedule(title: string, body: string, date: number, options: Record<string, any>): any;
1184
-
1185
- }
1186
-
1187
- declare const notification: Notification;
1188
-
1189
- interface Alarm {
1190
- /**
1191
- * 请求通知权限
1192
- * @returns 是否授权成功
1193
- */
1194
- requestAccess(): any;
1195
-
1196
- /**
1197
- * 获取权限状态
1198
- * @returns 权限状态
1199
- */
1200
- getAccessStatus(): any;
1201
-
1202
- /**
1203
- * 创建一次性闹钟
1204
- * @param timestamp 触发时间戳
1205
- * @param title 标题
1206
- * @param options 选项 { sound }
1207
- * @returns 创建的闹钟 ID
1208
- */
1209
- createOnce(timestamp: number, title: string, options: Record<string, any>): any;
1210
-
1211
- /**
1212
- * 创建每日重复闹钟
1213
- * @param hour 小时 (0-23)
1214
- * @param minute 分钟 (0-59)
1215
- * @param title 标题
1216
- * @param options 选项 { sound }
1217
- * @returns 创建的闹钟 ID
1218
- */
1219
- createDaily(hour: number, minute: number, title: string, options: Record<string, any>): any;
1220
-
1221
- /**
1222
- * 创建每周重复闹钟
1223
- * @param weekday 周几 (1-7, 周日为1)
1224
- * @param hour 小时 (0-23)
1225
- * @param minute 分钟 (0-59)
1226
- * @param title 标题
1227
- * @param options 选项 { sound }
1228
- * @returns 创建的闹钟 ID
1229
- */
1230
- createWeekly(weekday: number, hour: number, minute: number, title: string, options: Record<string, any>): any;
1231
-
1232
- /**
1233
- * 创建倒计时提醒
1234
- * @param seconds 秒数
1235
- * @param title 标题
1236
- * @param options 选项 { sound }
1237
- * @returns 创建的闹钟 ID
1238
- */
1239
- createCountdown(seconds: number, title: string, options: Record<string, any>): any;
1240
-
1241
- /**
1242
- * 获取待触发的闹钟
1243
- * @returns 待触发闹钟列表
1244
- */
1245
- getPending(): any;
1246
-
1247
- /**
1248
- * 获取闹钟数量
1249
- * @returns 闹钟数量
1250
- */
1251
- getCount(): any;
1252
-
1253
- /**
1254
- * 取消指定闹钟
1255
- * @param id 闹钟 ID
1256
- */
1257
- cancel(id: string): void;
1258
-
1259
- /**
1260
- * 取消所有闹钟
1261
- */
1262
- cancelAll(): void;
1263
-
1264
- /**
1265
- * 打开系统时钟
1266
- */
1267
- openClockApp(): void;
1268
-
1269
- /**
1270
- * 打开计时器
1271
- */
1272
- openTimer(): void;
1273
-
1274
- }
1275
-
1276
- declare const alarm: Alarm;
1277
-
1278
- interface Media {
1279
- /**
1280
- * 播放
1281
- */
1282
- play(): void;
1283
-
1284
- /**
1285
- * 暂停
1286
- */
1287
- pause(): void;
1288
-
1289
- /**
1290
- * 停止
1291
- */
1292
- stop(): void;
1293
-
1294
- /**
1295
- * 切换播放/暂停
1296
- */
1297
- togglePlayPause(): void;
1298
-
1299
- /**
1300
- * 下一首
1301
- */
1302
- next(): void;
1303
-
1304
- /**
1305
- * 上一首
1306
- */
1307
- previous(): void;
1308
-
1309
- /**
1310
- * 跳到开头
1311
- */
1312
- skipToBeginning(): void;
1313
-
1314
- /**
1315
- * 获取播放状态
1316
- * @returns 播放状态
1317
- */
1318
- getPlaybackState(): any;
1319
-
1320
- /**
1321
- * 是否正在播放
1322
- * @returns 是否正在播放
1323
- */
1324
- isPlaying(): boolean;
1325
-
1326
- /**
1327
- * 获取当前播放信息
1328
- * @returns 当前播放信息对象
1329
- */
1330
- getNowPlaying(): any;
1331
-
1332
- /**
1333
- * 获取音量
1334
- * @returns 当前音量(0.0-1.0)
1335
- */
1336
- getVolume(): number;
1337
-
1338
- /**
1339
- * 设置音量
1340
- * @param volume 音量 (0.0 - 1.0)
1341
- */
1342
- setVolume(volume: number): void;
1343
-
1344
- /**
1345
- * 获取重复模式
1346
- * @returns 重复模式
1347
- */
1348
- getRepeatMode(): any;
1349
-
1350
- /**
1351
- * 设置重复模式
1352
- * @param mode 'none' | 'one' | 'all'
1353
- */
1354
- setRepeatMode(mode: string): void;
1355
-
1356
- /**
1357
- * 获取随机播放模式
1358
- * @returns 随机播放模式
1359
- */
1360
- getShuffleMode(): any;
1361
-
1362
- /**
1363
- * 设置随机播放模式
1364
- * @param mode 'off' | 'songs' | 'albums'
1365
- */
1366
- setShuffleMode(mode: string): void;
1367
-
1368
- /**
1369
- * 获取当前播放时间
1370
- * @returns 当前播放时间(秒)
1371
- */
1372
- getCurrentTime(): number;
1373
-
1374
- /**
1375
- * 设置播放时间
1376
- * @param time 时间 (秒)
1377
- */
1378
- setCurrentTime(time: number): void;
1379
-
1380
- /**
1381
- * 快进
1382
- * @param seconds 秒数 (默认 15)
1383
- */
1384
- seekForward(seconds: number): void;
1385
-
1386
- /**
1387
- * 快退
1388
- * @param seconds 秒数 (默认 15)
1389
- */
1390
- seekBackward(seconds: number): void;
1391
-
1392
- /**
1393
- * 请求音乐库权限
1394
- * @returns 是否授权成功
1395
- */
1396
- requestAccess(): any;
1397
-
1398
- /**
1399
- * 获取权限状态
1400
- * @returns 权限状态
1401
- */
1402
- getAccessStatus(): any;
1403
-
1404
- /**
1405
- * 搜索音乐库
1406
- * @param query 搜索关键词
1407
- * @returns 歌曲列表数组
1408
- */
1409
- searchSongs(query: string): any;
1410
-
1411
- /**
1412
- * 播放指定歌曲
1413
- * @param persistentID 歌曲 ID
1414
- */
1415
- playSong(persistentID: string): void;
1416
-
1417
- /**
1418
- * 获取所有歌曲
1419
- * @returns 歌曲列表数组
1420
- */
1421
- getAllSongs(): any;
1422
-
1423
- /**
1424
- * 获取所有专辑
1425
- * @returns 专辑列表数组
1426
- */
1427
- getAlbums(): any;
1428
-
1429
- /**
1430
- * 获取所有艺术家
1431
- * @returns 艺术家列表数组
1432
- */
1433
- getArtists(): any;
1434
-
1435
- /**
1436
- * 获取播放列表
1437
- * @returns 播放列表数组
1438
- */
1439
- getPlaylists(): any;
1440
-
1441
- /**
1442
- * 播放专辑
1443
- * @param id 专辑 ID
1444
- */
1445
- playAlbum(id: string): void;
1446
-
1225
+ interface Sms {
1447
1226
  /**
1448
- * 播放艺术家
1449
- * @param id 艺术家 ID
1227
+ * 检查是否可以访问真实短信数据
1228
+ * @returns 应用是否有权访问短信数据库
1450
1229
  */
1451
- playArtist(id: string): void;
1230
+ isRealDataAvailable(): boolean;
1452
1231
 
1453
1232
  /**
1454
- * 播放播放列表
1455
- * @param id 播放列表 ID
1456
- * @returns 无返回值
1233
+ * 读取最近的短信
1234
+ * @param limit 最大返回数量(默认 50)
1235
+ * @param offset 跳过的消息数(默认 0)
1236
+ * @returns 短信对象数组
1457
1237
  */
1458
- playPlaylist(id: string): void;
1459
-
1460
- }
1461
-
1462
- declare const media: Media;
1238
+ read(limit?: number, offset?: number): any;
1463
1239
 
1464
- interface Mail {
1465
1240
  /**
1466
- * 检查是否能发送邮件
1467
- * @returns 是否能发送
1241
+ * 按关键词搜索短信
1242
+ * @param keyword 搜索关键词
1243
+ * @param limit 最大返回数量(默认 50)
1244
+ * @returns 匹配的短信对象数组
1468
1245
  */
1469
- canSendMail(): boolean;
1246
+ search(keyword: string, limit?: number): any;
1470
1247
 
1471
1248
  /**
1472
- * 获取邮件功能状态
1473
- * @returns 邮件功能状态
1249
+ * 获取指定号码的短信
1250
+ * @param address 发送者号码或地址
1251
+ * @param limit 最大返回数量(默认 50)
1252
+ * @returns 短信对象数组
1474
1253
  */
1475
- getStatus(): any;
1254
+ getByAddress(address: string, limit?: number): any;
1476
1255
 
1477
1256
  /**
1478
- * 发送简单邮件
1479
- * @param to 收件人列表
1480
- * @param subject 主题
1481
- * @param body 正文
1482
- * @returns 是否发送成功
1257
+ * 获取会话列表
1258
+ * @param limit 最大返回数量(默认 50)
1259
+ * @returns 会话对象数组
1483
1260
  */
1484
- send(to: any, subject: string, body: string): any;
1261
+ getChats(limit?: number): any;
1485
1262
 
1486
1263
  /**
1487
- * 发送邮件(完整选项)
1488
- * @param options 选项 { to, cc, bcc, subject, body, isHtml, attachments }
1489
- * @returns 是否发送成功
1264
+ * 获取短信统计信息
1265
+ * @returns 包含统计信息的对象
1490
1266
  */
1491
- sendAdvanced(options: Record<string, any>): any;
1267
+ getStatistics(): any;
1492
1268
 
1493
1269
  /**
1494
- * 打开邮件 App
1495
- * @returns 无返回值
1270
+ * 获取最新短信
1271
+ * @returns 最新短信对象或 null
1496
1272
  */
1497
- openMailApp(): void;
1273
+ getLatest(): any;
1498
1274
 
1499
1275
  /**
1500
- * 打开指定邮件 App
1501
- * @param appName App 名称
1502
- * @returns 无返回值
1276
+ * 获取未读短信
1277
+ * @param limit 最大返回数量(默认 50)
1278
+ * @returns 未读短信对象数组
1503
1279
  */
1504
- openSpecificMailApp(appName: string): void;
1280
+ getUnread(limit?: number): any;
1505
1281
 
1506
1282
  /**
1507
- * 验证邮箱格式
1508
- * @param email 邮箱地址
1509
- * @returns 是否有效
1283
+ * 通过 Root Helper 检查短信数据库访问权限
1284
+ * @returns 访问状态信息
1510
1285
  */
1511
- isValidEmail(email: string): boolean;
1286
+ helperCheck(): Record<string, any>;
1512
1287
 
1513
1288
  /**
1514
- * 检测已安装的邮件 App
1515
- * @returns 已安装的邮件 App 名称数组
1289
+ * 通过 Root Helper 复制短信数据库到临时目录
1290
+ * @returns 复制操作结果
1516
1291
  */
1517
- getInstalledMailApps(): any;
1292
+ helperCopy(): any;
1518
1293
 
1519
1294
  /**
1520
- * 从模板生成邮件
1521
- * @param templateName 模板名称
1522
- * @param variables 变量字典
1523
- * @returns 生成的邮件内容
1295
+ * 通过 Root Helper 列出目录内容
1296
+ * @param path 要列出的目录路径
1297
+ * @returns 目录列表结果
1524
1298
  */
1525
- fromTemplate(templateName: string, variables: Record<string, any>): any;
1299
+ helperList(path: string): Record<string, any>;
1526
1300
 
1527
1301
  /**
1528
- * 获取可用模板列表
1529
- * @returns 模板名称数组
1302
+ * 检查 Root Helper 是否可用
1303
+ * @returns Root Helper 是否可访问
1530
1304
  */
1531
- getTemplates(): any;
1305
+ helperAvailable(): boolean;
1532
1306
 
1533
1307
  }
1534
1308
 
1535
- declare const mail: Mail;
1309
+ declare const sms: Sms;
1536
1310
 
1537
- interface Sms {
1311
+ interface Sql {
1538
1312
  /**
1539
- * 检查短信权限
1540
- * @returns 是否有权限
1313
+ * 打开或创建 SQLite 数据库
1314
+ * @param name 数据库名称(默认为 'default')。文件将在 Documents 目录下创建为 {name}.sqlite
1315
+ * @returns 数据库是否成功打开
1541
1316
  */
1542
- checkAccess(): boolean;
1317
+ open(name?: string): boolean;
1543
1318
 
1544
1319
  /**
1545
- * 尝试直接访问短信数据库(调试用)
1546
- * @returns 是否访问成功
1320
+ * 关闭数据库连接
1321
+ * @param name 数据库名称(默认为 'default')
1322
+ * @returns 始终返回 true
1547
1323
  */
1548
- tryAccess(): boolean;
1324
+ close(name?: string): boolean;
1549
1325
 
1550
1326
  /**
1551
- * 读取最近的短信
1552
- * @param limit 限制条数 (默认 10)
1553
- * @returns 短信对象数组
1327
+ * 执行 INSERT、UPDATE、DELETE 或 DDL 语句
1328
+ * @param name 数据库名称(默认为 'default')
1329
+ * @param sql 要执行的 SQL 语句
1330
+ * @param params 预处理语句的参数(使用 ? 占位符)
1331
+ * @returns 包含成功状态、受影响行数和最后插入行 ID 的结果对象
1554
1332
  */
1555
- read(limit: number): any;
1333
+ execute(name?: string, sql: string, params?: any[]): any;
1556
1334
 
1557
1335
  /**
1558
- * 获取验证码
1559
- * @param minutes 查找最近几分钟内的验证码 (默认 5)
1560
- * @returns 验证码或 null
1336
+ * execute() 的别名
1337
+ * @param name 数据库名称(默认为 'default')
1338
+ * @param sql 要执行的 SQL 语句
1339
+ * @param params 预处理语句的参数
1340
+ * @returns 结果对象
1561
1341
  */
1562
- getVerificationCode(minutes: number): any;
1342
+ exec(name?: string, sql: string, params?: any[]): any;
1563
1343
 
1564
1344
  /**
1565
- * 搜索短信
1566
- * @param keyword 关键词
1567
- * @returns 短信对象数组
1345
+ * 执行 SELECT 查询并返回所有匹配的行
1346
+ * @param name 数据库名称(默认为 'default')
1347
+ * @param sql 要执行的 SELECT 查询
1348
+ * @param params 预处理语句的参数
1349
+ * @returns 行对象数组(列名 -> 值)
1568
1350
  */
1569
- search(keyword: string): any;
1351
+ query(name?: string, sql: string, params?: any[]): any;
1570
1352
 
1571
1353
  /**
1572
- * 按号码获取短信
1573
- * @param address 发送者号码
1574
- * @returns 短信对象数组
1354
+ * 执行 SELECT 查询并返回第一行
1355
+ * @param name 数据库名称(默认为 'default')
1356
+ * @param sql 要执行的 SELECT 查询
1357
+ * @param params 预处理语句的参数
1358
+ * @returns 第一行对象,如果没有结果则返回 null
1575
1359
  */
1576
- getByAddress(address: string): any;
1360
+ queryOne(name?: string, sql: string, params?: any[]): any;
1577
1361
 
1578
1362
  /**
1579
- * 获取会话列表
1580
- * @returns 会话列表数组
1363
+ * 检查数据库中是否存在指定表
1364
+ * @param name 数据库名称(默认为 'default')
1365
+ * @param tableName 要检查的表名
1366
+ * @returns 表是否存在
1581
1367
  */
1582
- getChats(): any;
1368
+ tableExists(name?: string, tableName: string): boolean;
1583
1369
 
1584
1370
  /**
1585
- * 获取短信统计
1586
- * @returns 统计信息对象
1587
- */
1588
- getStatistics(): any;
1589
-
1590
- /**
1591
- * 获取最新短信
1592
- * @returns 最新短信对象或 null
1371
+ * 列出数据库中的所有表
1372
+ * @param name 数据库名称(默认为 'default')
1373
+ * @returns 表名数组
1593
1374
  */
1594
- getLatest(): any;
1375
+ getTables(name?: string): any;
1595
1376
 
1596
1377
  /**
1597
- * 获取未读短信
1598
- * @returns 未读短信对象数组
1378
+ * 获取表的列信息
1379
+ * @param name 数据库名称(默认为 'default')
1380
+ * @param tableName 表名
1381
+ * @returns 列信息对象数组
1599
1382
  */
1600
- getUnread(): any;
1601
-
1602
- }
1383
+ getTableInfo(name?: string, tableName: string): any;
1603
1384
 
1604
- declare const sms: Sms;
1605
-
1606
- interface Sql {
1607
1385
  /**
1608
- * 执行 SELECT 查询并返回结果
1609
- * @param dbPath 数据库路径
1610
- * @param sql SQL 语句
1611
- * @param params 参数列表
1612
- * @returns 查询结果数组
1386
+ * 开始数据库事务
1387
+ * @param name 数据库名称(默认为 'default')
1388
+ * @returns 事务是否成功开始
1613
1389
  */
1614
- query(dbPath: string, sql: string, params: any[]): any[];
1390
+ beginTransaction(name?: string): boolean;
1615
1391
 
1616
1392
  /**
1617
- * 执行 INSERT/UPDATE/DELETE
1618
- * @param dbPath 数据库路径
1619
- * @param sql SQL 语句
1620
- * @param params 参数列表
1621
- * @returns 执行结果对象
1393
+ * 提交当前事务
1394
+ * @param name 数据库名称(默认为 'default')
1395
+ * @returns 提交是否成功
1622
1396
  */
1623
- execute(dbPath: string, sql: string, params: any[]): any;
1397
+ commit(name?: string): boolean;
1624
1398
 
1625
1399
  /**
1626
- * 列出数据库中的所有表
1627
- * @param dbPath 数据库路径
1628
- * @returns 表名数组
1400
+ * 回滚当前事务
1401
+ * @param name 数据库名称(默认为 'default')
1402
+ * @returns 回滚是否成功
1629
1403
  */
1630
- tables(dbPath: string): any;
1404
+ rollback(name?: string): boolean;
1631
1405
 
1632
1406
  /**
1633
- * 获取表结构
1634
- * @param dbPath 数据库路径
1635
- * @param tableName 表名
1636
- * @returns 表结构 SQL
1407
+ * 通过回收未使用的空间来优化数据库
1408
+ * @param name 数据库名称(默认为 'default')
1409
+ * @returns vacuum 操作是否成功
1637
1410
  */
1638
- schema(dbPath: string, tableName: string): string;
1411
+ vacuum(name?: string): boolean;
1639
1412
 
1640
1413
  }
1641
1414
 
@@ -1645,208 +1418,223 @@ interface Shortcuts {
1645
1418
  /**
1646
1419
  * 运行快捷指令
1647
1420
  * @param name 快捷指令名称
1648
- * @returns 快捷指令执行结果
1421
+ * @param input 输入文本(可选)
1422
+ * @returns 是否成功打开快捷指令
1649
1423
  */
1650
- run(name: string): any;
1424
+ run(name: string, input?: string): boolean;
1651
1425
 
1652
1426
  /**
1653
- * 运行快捷指令(带文本输入)
1427
+ * 运行快捷指令(带 x-callback-url 回调)
1654
1428
  * @param name 快捷指令名称
1655
- * @param text 输入文本
1656
- * @returns 快捷指令执行结果
1429
+ * @param input 输入文本(可选)
1430
+ * @returns 是否成功打开快捷指令
1657
1431
  */
1658
- runWithText(name: string, text: string): any;
1432
+ runWithCallback(name: string, input?: string): boolean;
1659
1433
 
1660
1434
  /**
1661
- * 运行快捷指令(剪贴板输入)
1662
- * @param name 快捷指令名称
1663
- */
1664
- runWithClipboard(name: string): any;
1665
-
1666
- /**
1667
- * 运行快捷指令(高级选项)
1668
- * @param name 快捷指令名称
1669
- * @param options 选项 { input, showOutput }
1435
+ * 打开快捷指令 App
1436
+ * @returns 是否成功打开
1670
1437
  */
1671
- runAdvanced(name: string, options: Record<string, any>): any;
1438
+ open(): boolean;
1672
1439
 
1673
1440
  /**
1674
- * 打开快捷指令 App
1675
- * @returns 无返回值
1441
+ * 打开快捷指令中心/库
1442
+ * @returns 是否成功打开
1676
1443
  */
1677
- openApp(): void;
1444
+ openGallery(): boolean;
1678
1445
 
1679
1446
  /**
1680
- * 打开快捷指令库
1681
- * @returns 无返回值
1447
+ * 创建新快捷指令
1448
+ * @param name 快捷指令名称
1449
+ * @returns 是否成功打开创建界面
1682
1450
  */
1683
- openGallery(): void;
1451
+ create(name: string): boolean;
1684
1452
 
1685
1453
  /**
1686
- * 打开指定快捷指令
1687
- * @param name 快捷指令名称
1688
- * @returns 无返回值
1454
+ * 通过链接导入快捷指令
1455
+ * @param url 快捷指令 URL
1456
+ * @returns 是否成功打开导入界面
1689
1457
  */
1690
- openShortcut(name: string): void;
1458
+ import(url: string): boolean;
1691
1459
 
1692
1460
  /**
1693
- * 创建新快捷指令
1694
- * @returns 无返回值
1461
+ * 检查是否安装快捷指令 App
1462
+ * @returns 是否可用
1695
1463
  */
1696
- createNew(): void;
1464
+ isAvailable(): boolean;
1697
1465
 
1698
1466
  /**
1699
- * 通过链接导入快捷指令
1700
- * @param url 快捷指令 URL
1701
- * @returns 无返回值
1467
+ * 捐赠 Siri 建议
1468
+ * @param title 建议标题/调用短语
1469
+ * @param identifier 交互标识符
1470
+ * @returns 是否成功捐赠
1702
1471
  */
1703
- importFromUrl(url: string): void;
1472
+ donateInteraction(title: string, identifier: string): boolean;
1704
1473
 
1705
1474
  /**
1706
- * 检查是否安装快捷指令
1475
+ * 删除指定的 Siri 建议
1476
+ * @param identifier 交互标识符
1477
+ * @returns 是否成功删除
1707
1478
  */
1708
- isAvailable(): boolean;
1479
+ deleteInteraction(identifier: string): boolean;
1709
1480
 
1710
1481
  /**
1711
- * 获取常用快捷指令模板
1482
+ * 删除所有 Siri 建议
1483
+ * @returns 是否成功删除
1712
1484
  */
1713
- getCommonShortcuts(): any;
1485
+ deleteAllInteractions(): boolean;
1714
1486
 
1715
1487
  }
1716
1488
 
1717
1489
  declare const shortcuts: Shortcuts;
1718
1490
 
1719
- interface Bluetooth {
1491
+ interface System {
1720
1492
  /**
1721
- * 蓝牙是否开启
1493
+ * 检查 WiFi 是否开启
1494
+ * @returns WiFi 是否开启
1722
1495
  */
1723
- isEnabled(): boolean;
1496
+ isWiFiEnabled(): boolean;
1724
1497
 
1725
1498
  /**
1726
- * 获取蓝牙状态
1499
+ * 设置 WiFi 开关 (TrollStore 权限)
1500
+ * @param enabled 是否开启 WiFi
1501
+ * @returns 是否设置成功
1727
1502
  */
1728
- getStatus(): any;
1503
+ setWiFi(enabled: boolean): boolean;
1729
1504
 
1730
1505
  /**
1731
- * 设置蓝牙开关
1732
- * @param enabled 是否开启
1733
- * @returns 无返回值
1506
+ * 检查蓝牙是否开启
1507
+ * @returns 蓝牙是否开启
1734
1508
  */
1735
- setEnabled(enabled: boolean): void;
1509
+ isBluetoothEnabled(): boolean;
1736
1510
 
1737
1511
  /**
1738
- * 打开蓝牙
1739
- * @returns 无返回值
1512
+ * 设置蓝牙开关 (TrollStore 权限)
1513
+ * @param enabled 是否开启蓝牙
1514
+ * @returns 是否设置成功
1740
1515
  */
1741
- turnOn(): void;
1516
+ setBluetooth(enabled: boolean): boolean;
1742
1517
 
1743
1518
  /**
1744
- * 关闭蓝牙
1745
- * @returns 无返回值
1519
+ * 检查飞行模式是否开启
1520
+ * @returns 飞行模式是否开启
1746
1521
  */
1747
- turnOff(): void;
1522
+ isAirplaneModeEnabled(): boolean;
1748
1523
 
1749
1524
  /**
1750
- * 获取配对设备
1525
+ * 设置飞行模式 (TrollStore 权限)
1526
+ * @param enabled 是否开启飞行模式
1527
+ * @returns 是否设置成功
1751
1528
  */
1752
- getPairedDevices(): any;
1529
+ setAirplaneMode(enabled: boolean): boolean;
1753
1530
 
1754
1531
  /**
1755
- * 获取已连接设备
1532
+ * 检查勿扰模式是否开启
1533
+ * @returns 勿扰模式是否开启
1756
1534
  */
1757
- getConnectedDevices(): any;
1535
+ isDoNotDisturbEnabled(): boolean;
1758
1536
 
1759
1537
  /**
1760
- * 连接设备
1761
- * @param id 设备 UUID
1538
+ * 设置勿扰模式
1539
+ * @param enabled 是否开启勿扰模式
1540
+ * @returns 是否设置成功
1762
1541
  */
1763
- connectDevice(id: string): any;
1542
+ setDoNotDisturb(enabled: boolean): boolean;
1764
1543
 
1765
1544
  /**
1766
- * 断开设备
1767
- * @param id 设备 UUID
1545
+ * 获取系统音量
1546
+ * @param category 音量类别: 'System', 'Ringer', 'Media',默认 'Media'
1547
+ * @returns 当前音量 (0.0 - 1.0)
1768
1548
  */
1769
- disconnectDevice(id: string): any;
1549
+ getVolume(category?: string): number;
1770
1550
 
1771
1551
  /**
1772
- * 开始扫描
1773
- * @returns 无返回值
1552
+ * 设置系统音量
1553
+ * @param level 音量级别 (0.0 - 1.0)
1554
+ * @param category 音量类别: 'System', 'Ringer', 'Media',默认 'Media'
1555
+ * @returns 是否设置成功
1774
1556
  */
1775
- startScan(): void;
1557
+ setVolume(level: number, category?: string): boolean;
1776
1558
 
1777
1559
  /**
1778
- * 停止扫描
1779
- * @returns 无返回值
1560
+ * 检查设备是否有闪光灯
1561
+ * @returns 是否有闪光灯
1780
1562
  */
1781
- stopScan(): void;
1563
+ hasFlashlight(): boolean;
1782
1564
 
1783
1565
  /**
1784
- * 打开蓝牙设置
1785
- * @returns 无返回值
1566
+ * 检查闪光灯是否开启
1567
+ * @returns 闪光灯是否开启
1786
1568
  */
1787
- openSettings(): void;
1569
+ isFlashlightOn(): boolean;
1788
1570
 
1789
- }
1571
+ /**
1572
+ * 设置闪光灯
1573
+ * @param enabled 是否开启闪光灯
1574
+ * @param level 亮度级别 (0.0 - 1.0),默认 1.0
1575
+ * @returns 是否设置成功
1576
+ */
1577
+ setFlashlight(enabled: boolean, level?: number): boolean;
1790
1578
 
1791
- declare const bluetooth: Bluetooth;
1579
+ /**
1580
+ * 检查方向锁定是否开启
1581
+ * @returns 方向锁定是否开启
1582
+ */
1583
+ isOrientationLockEnabled(): boolean;
1792
1584
 
1793
- interface Memo {
1794
1585
  /**
1795
- * 创建备忘录
1796
- * @param title 备忘录标题
1797
- * @param content 备忘录内容
1798
- * @param tags 标签列表
1799
- * @returns { success: 是否成功, id: 备忘录ID, memo: 备忘录对象 }
1586
+ * 设置方向锁定
1587
+ * @param enabled 是否开启方向锁定
1588
+ * @returns 是否设置成功
1800
1589
  */
1801
- create(title: string, content: string, tags: any): Record<string, any>;
1590
+ setOrientationLock(enabled: boolean): boolean;
1802
1591
 
1803
1592
  /**
1804
- * 获取所有备忘录
1805
- * @returns 备忘录数组 [{ id: ID, title: 标题, content: 内容, createdAt: 创建时间, updatedAt: 更新时间, tags: 标签 }]
1593
+ * 检查低电量模式是否开启
1594
+ * @returns 低电量模式是否开启
1806
1595
  */
1807
- getAll(): any;
1596
+ isLowPowerModeEnabled(): boolean;
1808
1597
 
1809
1598
  /**
1810
- * 根据 ID 获取备忘录
1811
- * @param id 备忘录 ID
1812
- * @returns 备忘录对象或 null(不存在时)
1599
+ * 设置低电量模式 (TrollStore 权限)
1600
+ * @param enabled 是否开启低电量模式
1601
+ * @returns 是否设置成功
1813
1602
  */
1814
- getById(id: string): any;
1603
+ setLowPowerMode(enabled: boolean): boolean;
1815
1604
 
1816
1605
  /**
1817
- * 搜索备忘录(标题和内容)
1818
- * @param keyword 搜索关键词
1819
- * @returns 匹配的备忘录数组
1606
+ * 检查位置服务是否开启
1607
+ * @returns 位置服务是否开启
1820
1608
  */
1821
- search(keyword: string): any;
1609
+ isLocationServicesEnabled(): boolean;
1822
1610
 
1823
1611
  /**
1824
- * 更新备忘录
1825
- * @param id 备忘录 ID
1826
- * @param data 更新数据 { title?: 新标题, content?: 新内容, tags?: 新标签 }
1827
- * @returns { success: 是否成功, id: 备忘录ID }
1612
+ * 设置位置服务 (TrollStore 权限)
1613
+ * @param enabled 是否开启位置服务
1614
+ * @returns 是否设置成功
1828
1615
  */
1829
- update(id: string, data: Record<string, any>): Record<string, any>;
1616
+ setLocationServices(enabled: boolean): boolean;
1830
1617
 
1831
1618
  /**
1832
- * 删除备忘录
1833
- * @param id 备忘录 ID
1834
- * @returns { success: 是否成功, id: 已删除的ID }
1619
+ * 检查蜂窝数据是否开启
1620
+ * @returns 蜂窝数据是否开启
1835
1621
  */
1836
- delete(id: string): Record<string, any>;
1622
+ isCellularDataEnabled(): boolean;
1837
1623
 
1838
1624
  /**
1839
- * 清空所有备忘录
1840
- * @returns { success: 是否成功 }
1625
+ * 设置蜂窝数据 (TrollStore 权限)
1626
+ * @param enabled 是否开启蜂窝数据
1627
+ * @returns 是否设置成功
1841
1628
  */
1842
- clear(): Record<string, any>;
1629
+ setCellularData(enabled: boolean): boolean;
1843
1630
 
1844
1631
  /**
1845
- * 获取备忘录数量
1846
- * @returns 备忘录总数
1632
+ * 打开系统设置
1633
+ * @param section 设置页面: 'WIFI', 'BLUETOOTH', 'CELLULAR', 'VPN', 'GENERAL', 'DISPLAY', 'SOUND', 'NOTIFICATION', 'PRIVACY', 'BATTERY', 'STORAGE', 'WALLPAPER', 'SIRI', 'ACCESSIBILITY', 'DND', 'SCREEN_TIME', 'PASSWORDS'
1634
+ * @returns 是否成功打开
1847
1635
  */
1848
- count(): number;
1636
+ openSettings(section?: string): boolean;
1849
1637
 
1850
1638
  }
1851
1639
 
1852
- declare const memo: Memo;
1640
+ declare const system: System;