@doubao-dev/framework 0.0.41 → 0.0.42

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/api.d.ts CHANGED
@@ -191,12 +191,23 @@ export declare interface AddPhoneRepeatCalendarParams extends AddPhoneCalendarPa
191
191
  repeatEndTime?: number;
192
192
  }
193
193
 
194
+ /**
195
+ * 相册精细授权状态。
196
+ *
197
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
198
+ * - `limited`:只能访问用户选择的部分照片;支持 iOS 和 Android 14 及以上版本。
199
+ * - `add only`:只能向相册添加照片,不能读取相册内容;仅 iOS 支持。
200
+ *
201
+ * @public
202
+ */
203
+ export declare type AlbumAuthorizationDetail = BasicAuthorizationDetail | 'limited' | 'add only';
204
+
194
205
  /** @public */
195
206
  export declare type AppAuthorizeStatus = 'authorized' | 'denied' | 'not determined';
196
207
 
197
208
  /** @public */
198
209
  export declare interface AppBaseInfoHost {
199
- /** 宿主 app 对应的 appId */
210
+ /** 当前豆包客户端的 appId */
200
211
  appId: string;
201
212
  }
202
213
 
@@ -441,6 +452,16 @@ export declare interface BackgroundAudioState {
441
452
  playbackRate?: number;
442
453
  }
443
454
 
455
+ /**
456
+ * 只有完整授权和未授权状态的权限所使用的通用精细状态。
457
+ *
458
+ * 继承 {@link UnauthorizedDetail} 的全部取值,并增加:
459
+ * - `full`:已获得该权限的完整访问能力。
460
+ *
461
+ * @public
462
+ */
463
+ export declare type BasicAuthorizationDetail = UnauthorizedDetail | 'full';
464
+
444
465
  /**
445
466
  * 电池信息变化事件。
446
467
  *
@@ -529,6 +550,16 @@ export declare type BluetoothAdapterStateChangeEvent = GetBluetoothAdapterStateR
529
550
  /** @public */
530
551
  export declare type BluetoothAdapterStateChangeListener = (event: BluetoothAdapterStateChangeEvent) => void;
531
552
 
553
+ /**
554
+ * 蓝牙精细授权状态。
555
+ *
556
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
557
+ * - `partial`:只获得部分已声明的蓝牙子权限;仅 Android 支持。
558
+ *
559
+ * @public
560
+ */
561
+ export declare type BluetoothAuthorizationDetail = BasicAuthorizationDetail | 'partial';
562
+
532
563
  /**
533
564
  * 蓝牙广播二进制字段。
534
565
  *
@@ -739,6 +770,155 @@ export declare type BottomSheetCancelSource = 'mask' | 'gesture' | 'hostUnavaila
739
770
  */
740
771
  export declare type CalendarRepeatInterval = 'day' | 'week' | 'month' | 'year';
741
772
 
773
+ /**
774
+ * 调用当前应用的 Tool。
775
+ *
776
+ * 豆包会根据当前智能服务页面或会话 Widget 确定应用和版本,开发者只需传入 Tool 名称和参数。
777
+ * Tool 正常结果通过 `toolResult` 返回,Tool 业务错误通过 `toolError` 返回,两者都会正常
778
+ * resolve;调用前校验、鉴权或返回结构校验失败时 Promise reject。
779
+ *
780
+ * @param params - Tool 名称和参数。
781
+ * @returns Tool 正常结果或业务错误,以及 Widget 场景下可选的更新错误。
782
+ * @example
783
+ * ```typescript
784
+ * import { callTool } from '@doubao-dev/framework/api';
785
+ *
786
+ * const result = await callTool({
787
+ * toolName: 'query_order',
788
+ * toolArgs: {
789
+ * orderId: 'order-123'
790
+ * }
791
+ * });
792
+ *
793
+ * if (result.toolError) {
794
+ * console.warn(result.toolError.code, result.toolError.message);
795
+ * } else {
796
+ * console.log(result.toolResult);
797
+ * }
798
+ * ```
799
+ *
800
+ * @since 0.0.42
801
+ * @contractStatus verified | 公开参数、页面与 Widget 调用场景、Widget 更新控制、互斥返回结构及 Android、iOS 错误字段一致。
802
+ * @platformSupport Android | supported | 支持在智能服务页面和会话 Widget 中调用当前应用的 Tool。
803
+ * @platformSupport iOS | supported | 支持在智能服务页面和会话 Widget 中调用当前应用的 Tool。
804
+ * @platformSupport PC | unsupported | 客户端尚未实现 callTool。
805
+ * @platformSupport HarmonyOS | unsupported | 客户端尚未实现 callTool。
806
+ * @permission none | - | none | Android,iOS | 无需额外权限
807
+ * @precondition Android | 在当前应用的智能服务页面或由当前应用真实生成的会话 Widget 内调用,且目标 Tool 已在当前应用版本中配置。
808
+ * @precondition iOS | 在当前应用的智能服务页面或由当前应用真实生成的会话 Widget 内调用,且目标 Tool 已在当前应用版本中配置。
809
+ * @usageNote All | toolResult 与 toolError 互斥;toolError 是正常返回的 Tool 业务错误,不会导致 Promise reject。skipWidgetUpdate 为 true 时不执行 Widget 更新阶段,因此不会返回 cardUpdateError;否则 cardUpdateError 表示 Tool 已执行但当前 Widget 更新失败。重试会再次执行 Tool,请避免重复触发。
810
+ * @resultExample
811
+ * ```json
812
+ * {
813
+ * "toolResult": {
814
+ * "content": [
815
+ * {
816
+ * "type": "text",
817
+ * "text": "订单已支付"
818
+ * }
819
+ * ],
820
+ * "structuredContent": {
821
+ * "orderId": "order-123",
822
+ * "status": "paid"
823
+ * }
824
+ * }
825
+ * }
826
+ * ```
827
+ * @errorExample
828
+ * ```json
829
+ * {
830
+ * "errNo": 104,
831
+ * "errMsg": "invalid parameter"
832
+ * }
833
+ * ```
834
+ * @errorCode common | 102 | Android,iOS
835
+ * @errorCode errNo | 103 | feature not support | Android,iOS | 在 Worker 等非智能服务页面、Widget 容器中调用 | 仅在智能服务页面或会话 Widget 中调用。
836
+ * @errorCode errNo | 104 | invalid parameter | Android,iOS | toolName 为空、toolArgs 无法序列化为 JSON 对象,或传入的 skipWidgetUpdate 不是布尔值 | 修正 Tool 名称、参数和 Widget 更新控制参数后重试。
837
+ * @errorCode errNo | 112 | invalid result | Android,iOS | Tool 正常结果、业务错误或 Widget 更新错误结构无效 | 稍后重试;持续失败时反馈 Tool 或服务端返回异常。
838
+ * @platformNote All | 非智能服务页面、Widget 容器返回 103;参数非法返回 104;返回结构无效返回 112;上下文无效、网络或服务端调用失败返回 102。
839
+ * @knownIssue All | Web SDK 模拟器暂不支持 skipWidgetUpdate 为 true;请在 Android 或 iOS 豆包客户端验证跳过 Widget 更新的调用。
840
+ *
841
+ * @public
842
+ */
843
+ export declare const callTool: (params: CallToolParams) => Promise<CallToolResult>;
844
+
845
+ /**
846
+ * Tool 正常完成调用后返回的业务错误。
847
+ *
848
+ * @public
849
+ */
850
+ export declare interface CallToolBusinessError {
851
+ /** Tool 业务错误码。 */
852
+ code: number;
853
+ /** Tool 业务错误信息。 */
854
+ message: string;
855
+ }
856
+
857
+ /**
858
+ * Widget 更新阶段的错误。
859
+ *
860
+ * @public
861
+ */
862
+ export declare interface CallToolError {
863
+ /** 错误码。 */
864
+ code: string;
865
+ /** 错误信息。 */
866
+ message: string;
867
+ /** 错误阶段,固定为渲染阶段。 */
868
+ phase: 'render';
869
+ }
870
+
871
+ /**
872
+ * 调用 Tool 的参数。
873
+ *
874
+ * @public
875
+ */
876
+ export declare interface CallToolParams {
877
+ /** 当前应用内需要调用的 Tool 名称。 */
878
+ toolName: string;
879
+ /** Tool 入参。 */
880
+ toolArgs: Record<string, unknown>;
881
+ /**
882
+ * 是否跳过 Widget 更新阶段。设为 `true` 时,即使 Tool 下发 Widget,也只返回 Tool 数据,
883
+ * 不更新当前 Widget。
884
+ *
885
+ * @default false
886
+ * @constraint 仅影响会下发 Widget 的 Tool。
887
+ */
888
+ skipWidgetUpdate?: boolean;
889
+ }
890
+
891
+ /**
892
+ * 调用 Tool 的结果。
893
+ *
894
+ * @public
895
+ */
896
+ export declare type CallToolResult = {
897
+ /**
898
+ * Tool 已执行,但返回结果未能用于更新当前 Widget 时的错误。仅 Widget 场景可能返回。
899
+ *
900
+ * @default -
901
+ */
902
+ cardUpdateError?: CallToolError;
903
+ } & ({
904
+ /** Tool 正常结果,与 `toolError` 二选一。 */
905
+ toolResult: ToolResult;
906
+ /** @hidden */
907
+ toolError?: never;
908
+ } | {
909
+ /** Tool 业务错误,与 `toolResult` 二选一。该字段不会导致 API reject。 */
910
+ toolError: CallToolBusinessError;
911
+ /** @hidden */
912
+ toolResult?: never;
913
+ });
914
+
915
+ /**
916
+ * 摄像头精细授权状态,取值与 {@link BasicAuthorizationDetail} 一致。
917
+ *
918
+ * @public
919
+ */
920
+ export declare type CameraAuthorizationDetail = BasicAuthorizationDetail;
921
+
742
922
  /** @public */
743
923
  export declare interface CanIUseParams {
744
924
  /** 需要检测的能力标识,例如 API 名称 */
@@ -751,6 +931,47 @@ export declare interface CanIUseResult {
751
931
  result: boolean;
752
932
  }
753
933
 
934
+ /**
935
+ * 对话框高度或展示状态变化事件。
936
+ *
937
+ * @public
938
+ */
939
+ export declare type ChatPanelHeightChangedEvent = ChatPanelInfo;
940
+
941
+ /**
942
+ * 对话框高度或展示状态变化监听函数。
943
+ *
944
+ * @public
945
+ */
946
+ export declare type ChatPanelHeightChangedListener = (event: ChatPanelHeightChangedEvent) => void;
947
+
948
+ /**
949
+ * 对话框状态快照。
950
+ *
951
+ * @public
952
+ */
953
+ export declare interface ChatPanelInfo {
954
+ /**
955
+ * 对话框当前占用的垂直高度,单位为逻辑像素(px),不包含系统键盘高度。
956
+ *
957
+ * @constraint 大于等于 0;收起态高度也可能大于 0
958
+ */
959
+ height: number;
960
+ /**
961
+ * 对话框当前展示状态。
962
+ *
963
+ * `preview` 表示从收起态发送消息后、收到回复前的中间态。
964
+ */
965
+ state: ChatPanelState;
966
+ }
967
+
968
+ /**
969
+ * 对话框展示状态。
970
+ *
971
+ * @public
972
+ */
973
+ export declare type ChatPanelState = 'collapsed' | 'expanded' | 'preview';
974
+
754
975
  /**
755
976
  * 检测无障碍能力是否开启。
756
977
  *
@@ -1428,13 +1649,13 @@ export declare function connectSocket(params: ConnectSocketParams): SocketTask;
1428
1649
  /**
1429
1650
  * 创建 WebSocket 连接的参数。
1430
1651
  *
1431
- * `connectSocket` 会把这些参数透传给宿主侧创建连接。连接创建请求发出后,
1652
+ * `connectSocket` 会把这些参数交给豆包客户端创建连接。连接创建请求发出后,
1432
1653
  * 调用方会立即拿到一个 {@link SocketTask},后续连接成功、失败、收到消息和关闭状态
1433
1654
  * 都通过 `SocketTask` 上注册的事件回调通知。
1434
1655
  *
1435
1656
  * @remarks
1436
- * - `url` 应填写完整的 WebSocket 地址。线上环境通常要求使用 `wss://` 协议,并由宿主侧按当前应用配置校验合法域名和证书。
1437
- * - `header` 用于补充握手请求头,`referer` 等由宿主管控的字段不会被业务代码覆盖。
1657
+ * - `url` 应填写完整的 WebSocket 地址。线上环境通常要求使用 `wss://` 协议,并由豆包客户端按当前智能服务配置校验合法域名和证书。
1658
+ * - `header` 用于补充握手请求头,`referer` 等由豆包客户端管理的字段不会被业务代码覆盖。
1438
1659
  * - `protocols` 非空时,服务端需要在握手响应中选择并返回匹配的子协议,否则连接可能失败。
1439
1660
  * - 同一个页面多次调用会创建多个独立连接,已创建的旧连接不会因为新连接自动关闭。
1440
1661
  *
@@ -1453,7 +1674,7 @@ export declare interface ConnectSocketParams {
1453
1674
  * WebSocket 握手阶段携带的 HTTP Header。
1454
1675
  *
1455
1676
  * 适合放置业务自定义 Header,例如鉴权 token、trace id、客户端能力标识等。
1456
- * `referer` 由宿主侧统一生成和管理,不应依赖该字段被业务传入值覆盖。
1677
+ * `referer` 由豆包客户端统一生成和管理,不应依赖该字段被业务传入值覆盖。
1457
1678
  *
1458
1679
  * @default -
1459
1680
  */
@@ -1463,7 +1684,7 @@ export declare interface ConnectSocketParams {
1463
1684
  *
1464
1685
  * 会作为握手请求中的 `Sec-WebSocket-Protocol` 候选值传给服务端。
1465
1686
  * 如果传入非空数组,服务端需要选择其中一个协议并在握手响应中返回;
1466
- * 服务端不支持或不返回匹配协议时,连接可能被宿主判定为创建失败。
1687
+ * 服务端不支持或不返回匹配协议时,豆包客户端可能判定连接创建失败。
1467
1688
  *
1468
1689
  * @default -
1469
1690
  */
@@ -2071,9 +2292,9 @@ export declare const disableUserScreenRecord: (params?: {} | undefined) => Promi
2071
2292
  * "errMsg": "resource not found"
2072
2293
  * }
2073
2294
  * ```
2074
- * @errorCode errNo | 103 | feature not support | Android,iOS | 当前运行环境未接入消息下发能力(宿主消息依赖或消息服务缺失) | 请在支持消息下发的豆包环境中调用。
2295
+ * @errorCode errNo | 103 | feature not support | Android,iOS | 当前豆包环境未提供消息下发能力 | 请在支持消息下发的豆包环境中调用。
2075
2296
  * @errorCode errNo | 116 | resource not found | Android,iOS | 依据 widgetInstanceId 找不到对应会话 | 确认 widgetInstanceId 有效且处于会话环境后重试。
2076
- * @platformNote All | 找不到会话返回 116;宿主消息依赖或消息服务缺失返回 103。
2297
+ * @platformNote All | 找不到会话返回 116;当前豆包环境未提供消息下发能力时返回 103。
2077
2298
  *
2078
2299
  * @internal
2079
2300
  */
@@ -2189,8 +2410,8 @@ export declare interface DoubaoAppAccountInfo {
2189
2410
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
2190
2411
  * @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
2191
2412
  * @permission none | - | none | Android,iOS | 无需额外权限
2192
- * @precondition All | 下载地址需通过宿主侧下载域名白名单校验,单个文件不得超过 200 MB,单个智能服务同时最多执行 10 个下载任务;指定 filePath 时仅支持临时目录或用户目录。
2193
- * @usageNote All | 未指定 filePath 时文件写入临时目录,并通过 Promise resolve 结果的 tempFilePath 返回;临时文件的生命周期由宿主管理。
2413
+ * @precondition All | 下载地址需通过豆包配置的下载域名白名单校验,单个文件不得超过 200 MB,单个智能服务同时最多执行 10 个下载任务;指定 filePath 时仅支持临时目录或用户目录。
2414
+ * @usageNote All | 未指定 filePath 时文件写入临时目录,并通过 Promise resolve 结果的 tempFilePath 返回;临时文件的生命周期由豆包客户端管理。
2194
2415
  * @usageNote All | 不跟随 HTTP 重定向,3xx 响应使 Promise reject;4xx、5xx 响应在文件写入成功后仍使 Promise resolve。
2195
2416
  * @resultExample
2196
2417
  * ```json
@@ -2214,10 +2435,10 @@ export declare function downloadFile(params: DownloadFileParams): DownloadTask;
2214
2435
  * @public
2215
2436
  */
2216
2437
  export declare interface DownloadFileParams {
2217
- /** 下载资源地址,需为完整 HTTPS URL,并通过宿主侧下载域名白名单校验。 */
2438
+ /** 下载资源地址,需为完整 HTTPS URL,并通过豆包配置的下载域名白名单校验。 */
2218
2439
  url: string;
2219
2440
  /**
2220
- * 请求 Header。`referer` 和 `user-agent` 由宿主管控,业务传入值不会透传。
2441
+ * 请求 Header。`referer` 和 `user-agent` 由豆包客户端管理,业务传入值不会透传。
2221
2442
  *
2222
2443
  * @default -
2223
2444
  */
@@ -2601,30 +2822,34 @@ export declare interface GetAccountInfoResult {
2601
2822
  export declare function getAccountInfoSync(params?: {}): GetAccountInfoResult;
2602
2823
 
2603
2824
  /**
2604
- * 获取宿主应用的系统授权设置。
2825
+ * 获取豆包客户端的系统授权设置。
2605
2826
  *
2606
- * 调用只读取当前系统授权状态,不会申请权限或触发系统授权弹窗。状态字段固定返回
2607
- * `authorized`、`denied` 或 `not determined`。
2827
+ * 调用只读取当前系统授权状态,不会申请权限或触发系统授权弹窗。原有状态字段固定返回
2828
+ * `authorized`、`denied` 或 `not determined`,精细授权字段用于区分部分、只读、只写、前后台等能力。
2608
2829
  *
2609
- * @returns 返回宿主应用相册、蓝牙、摄像头、定位、麦克风、通知和日历权限状态。
2830
+ * @returns 返回豆包客户端的相册、蓝牙、摄像头、定位、麦克风、通知和日历系统权限状态。
2610
2831
  * @example
2611
2832
  * ```typescript
2612
2833
  * import { getAppAuthorizeSetting } from '@doubao-dev/framework/api';
2613
2834
  *
2614
2835
  * const result = getAppAuthorizeSetting();
2615
- * console.log(result.cameraAuthorized, result.microphoneAuthorized);
2616
- * console.log(result.notificationAuthorized, result.locationReducedAccuracy);
2836
+ * const detail = result.phoneCalendarAuthorizationDetail;
2837
+ * const canWriteCalendar =
2838
+ * detail === 'full' ||
2839
+ * detail === 'write only' ||
2840
+ * (detail == null && result.phoneCalendarAuthorized === 'authorized');
2841
+ * console.log(canWriteCalendar);
2617
2842
  * ```
2618
2843
  *
2619
2844
  * @since 0.0.40
2620
- * @contractStatus verified | Android 与 iOS 均同步返回固定 11 个字段;除 locationReducedAccuracy 为 boolean 外,其余授权状态字段均限定为 authorized、denied 或 not determined,调用不会触发权限申请。
2621
- * @platformSupport Android | supported | 支持同步读取宿主应用授权状态。
2622
- * @platformSupport iOS | supported | 支持同步读取宿主应用授权状态。
2845
+ * @contractStatus verified | Android 与 iOS 均同步返回原有授权状态及可映射的精细授权字段;精细字段无法可靠映射或平台不适用时可为空,调用不会触发权限申请。
2846
+ * @platformSupport Android | supported | 支持同步读取豆包客户端的系统权限状态。
2847
+ * @platformSupport iOS | supported | 支持同步读取豆包客户端的系统权限状态。
2623
2848
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
2624
2849
  * @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
2625
2850
  * @permission none | - | none | Android,iOS | 无需额外权限
2626
2851
  * @precondition All | 无额外前置条件
2627
- * @usageNote All | 本接口查询宿主应用权限,不等同于查询当前智能服务 scope 授权。
2852
+ * @usageNote All | 本接口查询豆包客户端的系统权限,不等同于查询当前智能服务的 scope 授权。
2628
2853
  * @usageNote iOS | SDK 首次完成通知设置异步预热前,或应用重新激活后的刷新尚未完成时,四个通知字段可能仍为旧值或 not determined。
2629
2854
  * @resultExample
2630
2855
  * ```json
@@ -2639,14 +2864,23 @@ export declare function getAccountInfoSync(params?: {}): GetAccountInfoResult;
2639
2864
  * "notificationAlertAuthorized": "authorized",
2640
2865
  * "notificationBadgeAuthorized": "denied",
2641
2866
  * "notificationSoundAuthorized": "authorized",
2642
- * "phoneCalendarAuthorized": "not determined"
2867
+ * "phoneCalendarAuthorized": "denied",
2868
+ * "albumAuthorizationDetail": "limited",
2869
+ * "bluetoothAuthorizationDetail": "full",
2870
+ * "cameraAuthorizationDetail": "full",
2871
+ * "locationAuthorizationDetail": "foreground precise",
2872
+ * "microphoneAuthorizationDetail": "full",
2873
+ * "notificationAuthorizationDetail": "provisional",
2874
+ * "phoneCalendarAuthorizationDetail": "write only"
2643
2875
  * }
2644
2876
  * ```
2645
2877
  * @errorCode none | - | - | Android,iOS | 无 API 专属错误码 | 无需处理
2646
2878
  * @platformNote Android | albumAuthorized 和通知分项固定返回 not determined,locationReducedAccuracy 固定返回 false 且不表示实际定位精度
2647
2879
  * @platformNote Android | bluetoothAuthorized、cameraAuthorized、locationAuthorized、microphoneAuthorized、notificationAuthorized 和 phoneCalendarAuthorized 不区分尚未申请和已经拒绝,两种情况均返回 denied
2648
2880
  * @platformNote Android | locationAuthorized 在粗略或精确定位任一权限已授权时返回 authorized;phoneCalendarAuthorized 仅在读、写日历权限均授权时返回 authorized
2881
+ * @platformNote Android | 精细字段区分 Android 14 部分相册、日历读写、定位前后台和精度,以及蓝牙部分子权限
2649
2882
  * @platformNote iOS | 相册 limited 映射为 authorized,通知 provisional 和 ephemeral 映射为 authorized
2883
+ * @platformNote iOS | 精细字段区分相册 limited/add only、日历 write only、定位前后台和精度,以及通知 provisional;ephemeral 暂不映射
2650
2884
  *
2651
2885
  * @public
2652
2886
  */
@@ -2676,12 +2910,56 @@ export declare interface GetAppAuthorizeSettingResult {
2676
2910
  notificationSoundAuthorized: AppAuthorizeStatus;
2677
2911
  /** 系统日历授权状态 */
2678
2912
  phoneCalendarAuthorized: AppAuthorizeStatus;
2913
+ /**
2914
+ * 相册精细授权状态;旧客户端或无法可靠映射时不返回该字段或返回 `null`。
2915
+ *
2916
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
2917
+ * - `limited`:只能访问用户选择的部分照片;支持 iOS 和 Android 14 及以上版本。
2918
+ * - `add only`:只能向相册添加照片,不能读取相册内容;仅 iOS 支持。
2919
+ */
2920
+ albumAuthorizationDetail?: AlbumAuthorizationDetail | null;
2921
+ /**
2922
+ * 蓝牙精细授权状态;旧客户端或无法可靠映射时不返回该字段或返回 `null`。
2923
+ *
2924
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
2925
+ * - `partial`:只获得部分已声明的蓝牙子权限;仅 Android 支持。
2926
+ */
2927
+ bluetoothAuthorizationDetail?: BluetoothAuthorizationDetail | null;
2928
+ /** 摄像头精细授权状态,取值与 {@link BasicAuthorizationDetail} 一致;旧客户端或无法可靠映射时不返回该字段或返回 `null`。 */
2929
+ cameraAuthorizationDetail?: CameraAuthorizationDetail | null;
2930
+ /**
2931
+ * 定位精细授权状态;旧客户端或无法可靠映射时不返回该字段或返回 `null`。
2932
+ *
2933
+ * 继承 {@link UnauthorizedDetail} 的全部取值;获得权限时返回:
2934
+ * - `foreground approximate`:仅应用在前台时可以获取模糊定位。
2935
+ * - `foreground precise`:仅应用在前台时可以获取精确定位。
2936
+ * - `background approximate`:应用在前台或后台时均可以获取模糊定位。
2937
+ * - `background precise`:应用在前台或后台时均可以获取精确定位。
2938
+ */
2939
+ locationAuthorizationDetail?: LocationAuthorizationDetail | null;
2940
+ /** 麦克风精细授权状态,取值与 {@link BasicAuthorizationDetail} 一致;旧客户端或无法可靠映射时不返回该字段或返回 `null`。 */
2941
+ microphoneAuthorizationDetail?: MicrophoneAuthorizationDetail | null;
2942
+ /**
2943
+ * 通知精细授权状态;旧客户端或无法可靠映射时不返回该字段或返回 `null`。
2944
+ *
2945
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
2946
+ * - `provisional`:iOS 临时静默授权;不会弹出授权框,通知只进入通知中心。
2947
+ */
2948
+ notificationAuthorizationDetail?: NotificationAuthorizationDetail | null;
2949
+ /**
2950
+ * 系统日历精细授权状态;旧客户端或无法可靠映射时不返回该字段或返回 `null`。
2951
+ *
2952
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
2953
+ * - `read only`:只能读取日历,不能新增、修改或删除日程;仅 Android 支持。
2954
+ * - `write only`:只能新增日程,不能读取现有日历数据。
2955
+ */
2956
+ phoneCalendarAuthorizationDetail?: PhoneCalendarAuthorizationDetail | null;
2679
2957
  }
2680
2958
 
2681
2959
  /**
2682
2960
  * 获取应用基础信息。
2683
2961
  *
2684
- * @returns 返回 SDK 版本、调试开关、宿主信息、语言和主题等字段,见 {@link GetAppBaseInfoResult}。
2962
+ * @returns 返回 SDK 版本、调试开关、豆包客户端信息、语言和主题等字段,见 {@link GetAppBaseInfoResult}。
2685
2963
  * @example
2686
2964
  * ```typescript
2687
2965
  * import { getAppBaseInfo } from '@doubao-dev/framework/api';
@@ -2726,11 +3004,11 @@ export declare interface GetAppBaseInfoResult {
2726
3004
  SDKVersion?: string;
2727
3005
  /** 是否已打开调试 */
2728
3006
  enableDebug?: boolean;
2729
- /** 当前豆包 App 运行的宿主环境 */
3007
+ /** 当前豆包客户端信息 */
2730
3008
  host?: AppBaseInfoHost;
2731
3009
  /** 当前语言 */
2732
3010
  language: string;
2733
- /** 宿主版本号 */
3011
+ /** 豆包客户端版本号 */
2734
3012
  version?: string;
2735
3013
  /** 当前主题 */
2736
3014
  theme?: 'light' | 'dark';
@@ -2739,7 +3017,7 @@ export declare interface GetAppBaseInfoResult {
2739
3017
  /**
2740
3018
  * 获取应用基础信息。
2741
3019
  *
2742
- * @returns 返回 SDK 版本、调试开关、宿主信息、语言和主题等字段,见 {@link GetAppBaseInfoResult}。
3020
+ * @returns 返回 SDK 版本、调试开关、豆包客户端信息、语言和主题等字段,见 {@link GetAppBaseInfoResult}。
2743
3021
  * @example
2744
3022
  * ```typescript
2745
3023
  * import { getAppBaseInfoSync } from '@doubao-dev/framework/api';
@@ -3307,6 +3585,40 @@ export declare interface GetBluetoothDevicesResult {
3307
3585
  devices: BluetoothDevice[];
3308
3586
  }
3309
3587
 
3588
+ /**
3589
+ * 获取当前对话框状态快照。
3590
+ *
3591
+ * 调用不会改变对话框状态,也不会触发高度变化事件。
3592
+ *
3593
+ * @example
3594
+ * ```typescript
3595
+ * import { getChatPanelInfo } from '@doubao-dev/framework/api';
3596
+ *
3597
+ * const { height, state } = await getChatPanelInfo();
3598
+ * console.log('current chat panel', { height, state });
3599
+ * ```
3600
+ * @since 0.0.42
3601
+ * @contractStatus verified | 请求参数、返回字段和状态枚举与对话框状态查询协议一致。
3602
+ * @platformSupport Android | supported | 支持获取当前对话框状态快照。
3603
+ * @platformSupport iOS | supported | 支持获取当前对话框状态快照。
3604
+ * @platformSupport PC | unsupported | 当前未提供该平台实现。
3605
+ * @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
3606
+ * @permission none | - | none | Android,iOS | 无需额外权限
3607
+ * @precondition All | 当前页面需在 app.config.ts 中声明 chat.enabled 为 true
3608
+ * @usageNote All | 调用只读取当前状态,不会改变对话框状态或触发高度变化事件。
3609
+ * @resultExample
3610
+ * ```json
3611
+ * {
3612
+ * "height": 336,
3613
+ * "state": "expanded"
3614
+ * }
3615
+ * ```
3616
+ * @errorCode none | - | - | Android,iOS | 无 API 专属错误码 | 无需处理
3617
+ *
3618
+ * @public
3619
+ */
3620
+ export declare const getChatPanelInfo: (params?: {} | undefined) => Promise<ChatPanelInfo>;
3621
+
3310
3622
  /**
3311
3623
  * 获取剪贴板内容。
3312
3624
  *
@@ -3555,7 +3867,7 @@ export declare const getDeviceInfo: (params?: {} | undefined) => Promise<GetDevi
3555
3867
  * @public
3556
3868
  */
3557
3869
  export declare interface GetDeviceInfoResult {
3558
- /** 宿主 App 二进制接口类型,仅 Android 支持。 */
3870
+ /** 豆包客户端二进制接口类型,仅 Android 支持。 */
3559
3871
  abi?: string;
3560
3872
  /** 设备二进制接口类型,仅 Android 支持。 */
3561
3873
  deviceAbi?: string;
@@ -3867,6 +4179,13 @@ export declare interface GetLocationParams {
3867
4179
  * @constraint 取值为 0、1 或 2
3868
4180
  */
3869
4181
  mode?: number;
4182
+ /**
4183
+ * 是否接受轻定位结果。轻定位会直接利用设备已有的 Wi-Fi 扫描缓存,由服务端快速计算当前位置,缩短定位耗时。
4184
+ *
4185
+ * @default false
4186
+ * @constraint 仅 Android 生效,需使用 0.0.42 及以上版本的基础库
4187
+ */
4188
+ acceptLightLocation?: boolean;
3870
4189
  /**
3871
4190
  * 超时时间,单位毫秒,默认 30000
3872
4191
  *
@@ -4207,39 +4526,60 @@ export declare interface GetPackageInfoResult {
4207
4526
  }
4208
4527
 
4209
4528
  /**
4210
- * 同步获取当前 package 信息。
4529
+ * 同步获取当前 package 信息,仅供 Web SDK 模拟器使用。
4530
+ *
4531
+ * @internal
4532
+ */
4533
+ export declare const getPackageInfoSync: () => GetPackageInfoResult;
4534
+
4535
+ /**
4536
+ * 获取当前智能服务应用的性能数据。
4537
+ *
4538
+ * Entry 由客户端保存;`getEntries*()` 同步查询当前快照,observer 只接收新完成的 Entry。
4211
4539
  *
4212
- * @returns 返回当前 package appId、展示名称和展示图标地址,见 {@link GetPackageInfoResult}。
4540
+ * @returns 返回可查询性能 Entry 和创建观察者的 {@link Performance}。
4213
4541
  * @example
4214
4542
  * ```typescript
4215
- * import { getPackageInfoSync } from '@doubao-dev/framework/api';
4543
+ * import { getPerformance } from '@doubao-dev/framework/api';
4216
4544
  *
4217
- * const result = getPackageInfoSync();
4545
+ * const performance = getPerformance();
4546
+ * const observer = performance.createObserver((entryList) => {
4547
+ * console.log(entryList.getEntries());
4548
+ * });
4218
4549
  *
4219
- * console.log(result.appId, result.name, result.iconSrc);
4550
+ * performance.setBufferSize(100);
4551
+ * observer.observe({ entryTypes: ['render'] });
4552
+ * console.log(performance.getEntriesByType('render'));
4553
+ * observer.disconnect();
4220
4554
  * ```
4221
4555
  *
4222
- * @since 0.0.34
4223
- * @contractStatus verified | 由智能服务运行环境同步读取,字段与公开类型一致。
4224
- * @platformSupport Android | supported | 支持同步读取当前 package 信息。
4225
- * @platformSupport iOS | supported | 支持同步读取当前 package 信息。
4556
+ * @since 0.0.42
4557
+ * @contractStatus verified | Android 支持同步查询已记录的性能 Entry、设置缓冲区大小,并向已观察的运行时发送新完成的 Entry。
4558
+ * @platformSupport Android | supported | 支持查询性能 Entry、设置性能缓冲区大小和创建性能观察者。
4559
+ * @platformSupport iOS | unsupported | 当前未提供该平台实现。
4226
4560
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
4227
4561
  * @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
4228
4562
  * @permission none | - | none | Android,iOS | 无需额外权限
4229
4563
  * @precondition All | 无额外前置条件
4564
+ * @usageNote All | 仅在需要接收后续新完成的 Entry 时创建 observer;不再需要时调用 disconnect。
4230
4565
  * @resultExample
4231
4566
  * ```json
4232
- * {
4233
- * "appId": "7000000000000000000",
4234
- * "name": "示例智能服务",
4235
- * "iconSrc": "https://example.com/icon.png"
4236
- * }
4567
+ * [
4568
+ * {
4569
+ * "entryType": "render",
4570
+ * "name": "firstRender",
4571
+ * "startTime": 1730000000000,
4572
+ * "duration": 42,
4573
+ * "path": "pages/index/index",
4574
+ * "pageId": 1
4575
+ * }
4576
+ * ]
4237
4577
  * ```
4238
4578
  * @errorCode none | - | - | Android,iOS | 无 API 专属错误码 | 无需处理
4239
4579
  *
4240
4580
  * @public
4241
4581
  */
4242
- export declare const getPackageInfoSync: () => GetPackageInfoResult;
4582
+ export declare function getPerformance(): Performance_2;
4243
4583
 
4244
4584
  /**
4245
4585
  * 获取隐私设置状态。
@@ -4495,7 +4835,7 @@ export declare interface GetSettingParams {
4495
4835
  export declare interface GetSettingResult {
4496
4836
  /** 用户授权结果,key 为权限 scope,value 表示是否已授权 */
4497
4837
  authSetting: AuthSetting;
4498
- /** 用户订阅消息设置,withSubscriptions true 时才会返回 */
4838
+ /** 预留的订阅消息设置字段。豆包当前仅支持 `withSubscriptions: false`,因此不会返回该字段。 */
4499
4839
  subscriptionsSetting?: SubscriptionsSetting;
4500
4840
  }
4501
4841
 
@@ -4696,7 +5036,7 @@ export declare function getStorageSync<TData = unknown>(params: GetStorageParams
4696
5036
  /**
4697
5037
  * 获取系统信息。
4698
5038
  *
4699
- * @returns 返回设备品牌、型号、屏幕尺寸、宿主信息和安全区域等字段,见 {@link GetSystemInfoResult}。
5039
+ * @returns 返回设备品牌、型号、屏幕尺寸、豆包客户端信息和安全区域等字段,见 {@link GetSystemInfoResult}。
4700
5040
  * @example
4701
5041
  * ```typescript
4702
5042
  * import { getSystemInfo } from '@doubao-dev/framework/api';
@@ -4709,7 +5049,7 @@ export declare function getStorageSync<TData = unknown>(params: GetStorageParams
4709
5049
  *
4710
5050
  * @since 0.0.34
4711
5051
  * @contractStatus verified | 设备品牌、屏幕尺寸、系统信息和安全区域等字段与公开类型一致。
4712
- * @contractMismatch non-blocking | return | abi | Android,iOS | abi 为可选字段,返回宿主 App 二进制接口类型 | Android 返回具体 abi,iOS 不返回该字段 | 依赖 abi 的逻辑仅在 Android 生效 | packages/open-api/src/basic/system/system.ts; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge/method/system/GetSystemInfoMethod.kt; ai-sdk/ios/AISDK/Sources/JSBridge/Methods/System | 明确 abi 为 Android 专属字段,或补齐 iOS 对应字段
5052
+ * @contractMismatch non-blocking | return | abi | Android,iOS | abi 为可选字段,返回豆包客户端二进制接口类型 | Android 返回具体 abi,iOS 不返回该字段 | 依赖 abi 的逻辑仅在 Android 生效 | packages/open-api/src/basic/system/system.ts; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge/method/system/GetSystemInfoMethod.kt; ai-sdk/ios/AISDK/Sources/JSBridge/Methods/System | 明确 abi 为 Android 专属字段,或补齐 iOS 对应字段
4713
5053
  * @platformSupport Android | supported | 支持获取系统信息。
4714
5054
  * @platformSupport iOS | supported | 支持获取系统信息。
4715
5055
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -4748,7 +5088,7 @@ export declare function getStorageSync<TData = unknown>(params: GetStorageParams
4748
5088
  * }
4749
5089
  * ```
4750
5090
  * @errorCode common | 102 | Android
4751
- * @platformNote Android | abi 返回宿主 App 二进制接口类型(如 arm64-v8a),iOS 不返回该字段
5091
+ * @platformNote Android | abi 返回豆包客户端二进制接口类型(如 arm64-v8a),iOS 不返回该字段
4752
5092
  *
4753
5093
  * @public
4754
5094
  */
@@ -4774,7 +5114,7 @@ export declare interface GetSystemInfoResult {
4774
5114
  statusBarHeight: number;
4775
5115
  /** 系统语言,格式为 language_region,如 zh_CN、en_US */
4776
5116
  language: string;
4777
- /** 宿主版本号 */
5117
+ /** 豆包客户端版本号 */
4778
5118
  version?: string;
4779
5119
  /** 操作系统及版本,如 "Android 14"、"iOS 17.5" */
4780
5120
  system: string;
@@ -4792,14 +5132,14 @@ export declare interface GetSystemInfoResult {
4792
5132
  enableDebug?: boolean;
4793
5133
  /** 设备方向 */
4794
5134
  deviceOrientation?: 'portrait' | 'landscape';
4795
- /** 宿主 App 二进制接口类型(如 arm64-v8a),仅 Android 返回 */
5135
+ /** 豆包客户端二进制接口类型(如 arm64-v8a),仅 Android 返回 */
4796
5136
  abi?: string;
4797
5137
  }
4798
5138
 
4799
5139
  /**
4800
5140
  * 同步获取系统信息。
4801
5141
  *
4802
- * @returns 返回设备品牌、型号、屏幕尺寸、宿主信息和安全区域等字段,见 {@link GetSystemInfoResult}。
5142
+ * @returns 返回设备品牌、型号、屏幕尺寸、豆包客户端信息和安全区域等字段,见 {@link GetSystemInfoResult}。
4803
5143
  * @example
4804
5144
  * ```typescript
4805
5145
  * import { getSystemInfoSync } from '@doubao-dev/framework/api';
@@ -4812,7 +5152,7 @@ export declare interface GetSystemInfoResult {
4812
5152
  *
4813
5153
  * @since 0.0.34
4814
5154
  * @contractStatus verified | 设备品牌、屏幕尺寸、系统信息和安全区域等字段与公开类型一致。
4815
- * @contractMismatch non-blocking | return | abi | Android,iOS | abi 为可选字段,返回宿主 App 二进制接口类型 | Android 返回具体 abi,iOS 不返回该字段 | 依赖 abi 的逻辑仅在 Android 生效 | packages/open-api/src/basic/system/system.ts; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge/method/system/GetSystemInfoMethod.kt; ai-sdk/ios/AISDK/Sources/JSBridge/Methods/System | 明确 abi 为 Android 专属字段,或补齐 iOS 对应字段
5155
+ * @contractMismatch non-blocking | return | abi | Android,iOS | abi 为可选字段,返回豆包客户端二进制接口类型 | Android 返回具体 abi,iOS 不返回该字段 | 依赖 abi 的逻辑仅在 Android 生效 | packages/open-api/src/basic/system/system.ts; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge/method/system/GetSystemInfoMethod.kt; ai-sdk/ios/AISDK/Sources/JSBridge/Methods/System | 明确 abi 为 Android 专属字段,或补齐 iOS 对应字段
4816
5156
  * @platformSupport Android | supported | 支持同步获取系统信息。
4817
5157
  * @platformSupport iOS | supported | 支持同步获取系统信息。
4818
5158
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -4851,7 +5191,7 @@ export declare interface GetSystemInfoResult {
4851
5191
  * }
4852
5192
  * ```
4853
5193
  * @errorCode common | 102 | Android
4854
- * @platformNote Android | abi 返回宿主 App 二进制接口类型(如 arm64-v8a),iOS 不返回该字段
5194
+ * @platformNote Android | abi 返回豆包客户端二进制接口类型(如 arm64-v8a),iOS 不返回该字段
4855
5195
  *
4856
5196
  * @public
4857
5197
  */
@@ -5404,6 +5744,19 @@ export declare interface KeyboardHeightChangeEvent {
5404
5744
  /** @public */
5405
5745
  export declare type KeyboardHeightChangeListener = (event: KeyboardHeightChangeEvent) => void;
5406
5746
 
5747
+ /**
5748
+ * 定位精细授权状态。
5749
+ *
5750
+ * 继承 {@link UnauthorizedDetail} 的全部取值;获得权限时返回:
5751
+ * - `foreground approximate`:仅应用在前台时可以获取模糊定位。
5752
+ * - `foreground precise`:仅应用在前台时可以获取精确定位。
5753
+ * - `background approximate`:应用在前台或后台时均可以获取模糊定位。
5754
+ * - `background precise`:应用在前台或后台时均可以获取精确定位。
5755
+ *
5756
+ * @public
5757
+ */
5758
+ export declare type LocationAuthorizationDetail = UnauthorizedDetail | 'foreground approximate' | 'foreground precise' | 'background approximate' | 'background precise';
5759
+
5407
5760
  /** @public */
5408
5761
  export declare interface LocationChangeErrorEvent {
5409
5762
  /**
@@ -5774,6 +6127,13 @@ export declare interface MenuButtonBoundingClientRect {
5774
6127
  left: number;
5775
6128
  }
5776
6129
 
6130
+ /**
6131
+ * 麦克风精细授权状态,取值与 {@link BasicAuthorizationDetail} 一致。
6132
+ *
6133
+ * @public
6134
+ */
6135
+ export declare type MicrophoneAuthorizationDetail = BasicAuthorizationDetail;
6136
+
5777
6137
  /**
5778
6138
  * {@link FileSystemManager.mkdir} 的参数。
5779
6139
  *
@@ -5906,6 +6266,16 @@ export declare type NetworkStatusChangeListener = (event: NetworkStatusChangeEve
5906
6266
  */
5907
6267
  export declare type NetworkType = 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none';
5908
6268
 
6269
+ /**
6270
+ * 通知精细授权状态。
6271
+ *
6272
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
6273
+ * - `provisional`:iOS 临时静默授权;不会弹出授权框,通知只进入通知中心。
6274
+ *
6275
+ * @public
6276
+ */
6277
+ export declare type NotificationAuthorizationDetail = BasicAuthorizationDetail | 'provisional';
6278
+
5909
6279
  /**
5910
6280
  * 订阅 BLE 特征值变化。
5911
6281
  *
@@ -6210,6 +6580,43 @@ export declare const onBluetoothAdapterStateChange: ClientEventRegistry<GetBluet
6210
6580
  */
6211
6581
  export declare function onBluetoothDeviceFound(callback: BluetoothDeviceFoundListener): () => void;
6212
6582
 
6583
+ /**
6584
+ * 监听对话框高度或展示状态变化。
6585
+ *
6586
+ * 注册后不会立即回调当前值。需要当前状态时,先调用 {@link getChatPanelInfo}。
6587
+ *
6588
+ * @example
6589
+ * ```typescript
6590
+ * import { onChatPanelHeightChanged } from '@doubao-dev/framework/api';
6591
+ *
6592
+ * const off = onChatPanelHeightChanged(({ height, state }) => {
6593
+ * console.log('chat panel changed', { height, state });
6594
+ * });
6595
+ *
6596
+ * off();
6597
+ * ```
6598
+ * @since 0.0.42
6599
+ * @contractStatus verified | 事件字段、状态枚举和触发语义与对话框高度变化协议一致。
6600
+ * @platformSupport Android | supported | 支持监听对话框高度或展示状态变化。
6601
+ * @platformSupport iOS | supported | 支持监听对话框高度或展示状态变化。
6602
+ * @platformSupport PC | unsupported | 当前未提供该平台实现。
6603
+ * @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
6604
+ * @permission none | - | none | Android,iOS | 无需额外权限
6605
+ * @precondition All | 当前页面需在 app.config.ts 中声明 chat.enabled 为 true
6606
+ * @usageNote All | 注册后不立即回调当前值;页面卸载前调用返回的取消函数。
6607
+ * @resultExample
6608
+ * ```json
6609
+ * {
6610
+ * "height": 336,
6611
+ * "state": "expanded"
6612
+ * }
6613
+ * ```
6614
+ * @errorCode none | - | - | Android,iOS | 事件无错误码 | 无需处理
6615
+ *
6616
+ * @public
6617
+ */
6618
+ export declare const onChatPanelHeightChanged: ClientEventRegistry<ChatPanelInfo>;
6619
+
6213
6620
  /**
6214
6621
  * 监听罗盘数据变化事件。
6215
6622
  *
@@ -6499,7 +6906,7 @@ export declare const onNetworkStatusChange: ClientEventRegistry<NetworkStatusCha
6499
6906
  /**
6500
6907
  * 监听应用主题变化。
6501
6908
  *
6502
- * 当用户在系统设置或宿主内切换浅色、深色主题时触发。回调参数中的 `theme` 表示切换后的主题,可与
6909
+ * 当用户在系统设置或豆包客户端内切换浅色、深色主题时触发。回调参数中的 `theme` 表示切换后的主题,可与
6503
6910
  * {@link getAppBaseInfo} 返回的 `theme` 字段配合使用。
6504
6911
  *
6505
6912
  * @summary 监听应用主题变化。
@@ -6517,7 +6924,7 @@ export declare const onNetworkStatusChange: ClientEventRegistry<NetworkStatusCha
6517
6924
  *
6518
6925
  * @since 0.0.32
6519
6926
  * @contractStatus verified | 主题变化事件回调只包含必需的 theme 字段,与公开类型一致。
6520
- * @contractMismatch non-blocking | behavior | onThemeChange | Android | 用户切换浅色、深色主题时触发回调 | iOS 由客户端主动派发事件,Android 依赖宿主接入主题变化通知,未接入时可能不触发 | Android 上事件触发依赖宿主接入情况 | packages/open-api/src/basic/system/system.ts; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge; ai-sdk/ios/AISDK/Sources/JSBridge | 统一双端主题变化事件派发,保证 Android 稳定触发
6927
+ * @contractMismatch non-blocking | behavior | onThemeChange | Android | 用户切换浅色、深色主题时触发回调 | iOS 由客户端主动派发事件,Android 依赖豆包客户端接入主题变化通知,未接入时可能不触发 | Android 上事件触发依赖豆包客户端的接入情况 | packages/open-api/src/basic/system/system.ts; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge; ai-sdk/ios/AISDK/Sources/JSBridge | 统一双端主题变化事件派发,保证 Android 稳定触发
6521
6928
  * @platformSupport Android | supported | 支持注册主题变化监听。
6522
6929
  * @platformSupport iOS | supported | 支持注册主题变化监听。
6523
6930
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -6532,7 +6939,7 @@ export declare const onNetworkStatusChange: ClientEventRegistry<NetworkStatusCha
6532
6939
  * }
6533
6940
  * ```
6534
6941
  * @errorCode none | - | - | Android,iOS | 该监听只接收成功的主题变化事件 | 无需处理
6535
- * @platformNote Android | 主题变化事件依赖宿主接入主题通知,未接入时可能不触发
6942
+ * @platformNote Android | 主题变化事件依赖豆包客户端接入主题通知,未接入时可能不触发
6536
6943
  *
6537
6944
  * @public
6538
6945
  */
@@ -6763,6 +7170,64 @@ export declare interface OpenLocationParams {
6763
7170
  latitude: number;
6764
7171
  }
6765
7172
 
7173
+ /**
7174
+ * 打开应用内页面。
7175
+ *
7176
+ * 在对话流卡片中调用时会重新打开全页并忽略 `mode`;在全页中调用时按照 `mode` 操作页面栈。
7177
+ *
7178
+ * @param params 打开页面参数,字段见 {@link OpenPageParams}。
7179
+ * @returns 无返回字段。
7180
+ * @example
7181
+ * ```typescript
7182
+ * import { openPage } from '@doubao-dev/framework/api';
7183
+ *
7184
+ * await openPage({
7185
+ * url: '/pages/detail/index?id=1',
7186
+ * mode: 'navigate'
7187
+ * });
7188
+ * ```
7189
+ *
7190
+ * @since 0.0.42
7191
+ * @contractStatus conflict | 新版 url 和页面栈 mode 协议已公开,但当前 Android、iOS 尚未提供对应实现。
7192
+ * @contractMismatch blocking | parameter | params | Android | 接收 url 和可选的 push、replace、navigate、popTo mode | 当前 doubao.openPage 仍映射到旧版 applet.openPage,要求 pageId 和 context,且 mode 仅识别 full、popup、floating | 按新版参数调用无法打开页面 | packages/open-api/src/router/open-page.ts; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge/method/router/AbsOpenPageMethodIDL.kt; ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge/method/router/OpenPageMethod.kt | Native 使用独立的 doubao.openPage handler 实现新版参数和路由语义
7193
+ * @contractMismatch blocking | platform | method registration | iOS | doubao.openPage 可按新版参数调用 | 当前只注册 applet.openPage,未注册新版 doubao.openPage | iOS 无法调用该 API | packages/open-api/src/router/open-page.ts; ai-sdk/ios/AISDK/Sources/JSBridge/Methods/Route/AIBridgeOpenPageMethod.swift; ai-sdk/ios/AISDK/Sources/Core/AISDK.swift | 注册独立的 doubao.openPage handler 并实现新版路由语义
7194
+ * @platformSupport Android | unsupported | 当前版本尚未提供新版 openPage 路由协议。
7195
+ * @platformSupport iOS | unsupported | 当前版本尚未提供新版 openPage 路由协议。
7196
+ * @platformSupport PC | unsupported | 当前未提供该平台实现。
7197
+ * @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
7198
+ * @permission none | - | none | Android,iOS | 无需额外权限
7199
+ * @precondition All | 无额外前置条件
7200
+ * @usageNote All | mode 省略时按 push 处理;对话流卡片中始终重新打开全页,全页中才应用页面栈操作。
7201
+ * @errorCode none | - | - | Android,iOS | 当前没有可审计的新版 Native 失败字段 | 等待 Native 实现后补充错误处理
7202
+ *
7203
+ * @public
7204
+ */
7205
+ export declare const openPage: (params: OpenPageParams) => Promise<object>;
7206
+
7207
+ /**
7208
+ * 打开页面时使用的页面栈操作。
7209
+ *
7210
+ * @public
7211
+ */
7212
+ export declare type OpenPageMode = 'push' | 'replace' | 'navigate' | 'popTo';
7213
+
7214
+ /** @public */
7215
+ export declare interface OpenPageParams {
7216
+ /** 应用内页面路径,可携带查询参数。 */
7217
+ url: string;
7218
+ /**
7219
+ * 页面栈操作。
7220
+ *
7221
+ * - `push`:始终压入新的页面实例。
7222
+ * - `replace`:目标为栈顶页面时更新栈顶页面,否则替换栈顶页面。
7223
+ * - `navigate`:目标已在栈中时回退到最近的目标页面并更新,否则压入新页面。
7224
+ * - `popTo`:目标已在栈中时回退到最近的目标页面并更新,否则替换栈顶页面。
7225
+ *
7226
+ * @default 'push'
7227
+ */
7228
+ mode?: OpenPageMode;
7229
+ }
7230
+
6766
7231
  /**
6767
7232
  * 打开智能服务授权设置页面
6768
7233
  *
@@ -6771,7 +7236,7 @@ export declare interface OpenLocationParams {
6771
7236
  * @returns Promise 对象,设置页关闭后返回最新授权设置
6772
7237
  * @remarks
6773
7238
  * 该接口不要求在用户点击事件中调用。
6774
- * 注意:当前宿主暂不支持订阅模板,传入 `withSubscriptions: true` 时会由宿主返回失败,错误信息为 `subscription templates are not supported yet`。
7239
+ * JavaScript 调用方也不要传入 `withSubscriptions: true`,否则豆包会返回 `subscription templates are not supported yet`。
6775
7240
  * @example
6776
7241
  * ```typescript
6777
7242
  * import { openSetting } from '@doubao-dev/framework/api';
@@ -6823,10 +7288,104 @@ export declare interface OpenSettingOptions {
6823
7288
  export declare interface OpenSettingResult {
6824
7289
  /** 用户授权结果,key 为权限 scope,value 表示是否已授权 */
6825
7290
  authSetting: AuthSetting;
6826
- /** 用户订阅消息设置,withSubscriptions true 时才会返回 */
7291
+ /** 预留的订阅消息设置字段。豆包当前仅支持 `withSubscriptions: false`,因此不会返回该字段。 */
6827
7292
  subscriptionsSetting?: SubscriptionsSetting;
6828
7293
  }
6829
7294
 
7295
+ /** @public */
7296
+ declare interface Performance_2 {
7297
+ /**
7298
+ * 创建性能观察者。调用返回对象的 `observe` 后,回调会接收之后新完成且匹配的 Entry。
7299
+ */
7300
+ createObserver: (callback: PerformanceObserverCallback_2) => PerformanceObserver_2;
7301
+ /** 设置客户端最多保留的性能 Entry 数量。 */
7302
+ setBufferSize: (size: number) => void;
7303
+ /** 返回当前智能服务已记录的全部性能 Entry。 */
7304
+ getEntries: () => PerformanceEntry_2[];
7305
+ /** 返回指定 entryType 的性能 Entry。 */
7306
+ getEntriesByType: (entryType: string) => PerformanceEntry_2[];
7307
+ /** 返回指定名称的性能 Entry;传入 entryType 时同时按类型筛选。 */
7308
+ getEntriesByName: (name: string, entryType?: string) => PerformanceEntry_2[];
7309
+ }
7310
+ export { Performance_2 as Performance }
7311
+
7312
+ /** @public */
7313
+ declare interface PerformanceEntry_2 {
7314
+ /** 性能指标所属类别。 */
7315
+ entryType: PerformanceEntryType;
7316
+ /** 性能指标名称,例如 `appLaunch`、`route`、`evaluateScript` 或 `firstRender`。 */
7317
+ name: string;
7318
+ /** 指标开始或发生时刻的 Unix 时间戳,单位为毫秒。 */
7319
+ startTime: number;
7320
+ /** 指标持续时间,单位为毫秒;仅耗时类指标提供。 */
7321
+ duration?: number;
7322
+ /** 页面路径;仅页面的 navigation 和 render 类型指标提供。 */
7323
+ path?: string;
7324
+ /** `path` 对应的页面实例 Id(随机生成,不保证递增);仅页面相关指标提供。 */
7325
+ pageId?: number;
7326
+ /** 路由来源页面的路径;仅 `navigation / route` 指标提供。 */
7327
+ referrerPath?: string;
7328
+ /** 路由来源页面的实例 ID;仅 `navigation / route` 指标提供。 */
7329
+ referrerPageId?: number;
7330
+ /** 路由开始被渲染层处理的 Unix 时间戳,单位为毫秒;仅 navigation 类型指标提供。 */
7331
+ navigationStart?: number;
7332
+ /** 路由类型。仅 navigation 类型的 Entry 有效。 */
7333
+ navigationType?: string;
7334
+ /** 被执行脚本的模块名称;仅 `script / evaluateScript` 指标提供。 */
7335
+ moduleName?: string;
7336
+ /** 视图层准备完成的 Unix 时间戳,单位为毫秒;仅 `render / firstRender` 指标提供。 */
7337
+ viewLayerReadyTime?: number;
7338
+ /** 视图层首次渲染开始的 Unix 时间戳,单位为毫秒;仅 `render / firstRender` 指标提供。 */
7339
+ viewLayerRenderStartTime?: number;
7340
+ /** 视图层首次渲染结束的 Unix 时间戳,单位为毫秒;仅 `render / firstRender` 指标提供。 */
7341
+ viewLayerRenderEndTime?: number;
7342
+ /** Widget 标识;仅 Widget 的 render 类型指标提供。 */
7343
+ widgetId?: string;
7344
+ /** Widget 实例 Id(随机生成,不保证递增);仅 Widget 的 render 类型指标提供。 */
7345
+ widgetInstanceId?: string;
7346
+ /** Widget 关联的应用是否冷启动;仅 Widget 的 render 类型指标提供。 */
7347
+ isAppColdLaunch?: boolean;
7348
+ }
7349
+ export { PerformanceEntry_2 as PerformanceEntry }
7350
+
7351
+ /** @public */
7352
+ export declare type PerformanceEntryType = 'navigation' | 'script' | 'render';
7353
+
7354
+ /** @public */
7355
+ declare interface PerformanceObserver_2 {
7356
+ observe(options: PerformanceObserverOptions): void;
7357
+ disconnect(): void;
7358
+ }
7359
+ export { PerformanceObserver_2 as PerformanceObserver }
7360
+
7361
+ /** @public */
7362
+ declare type PerformanceObserverCallback_2 = (entryList: PerformanceObserverEntryList_2) => void;
7363
+ export { PerformanceObserverCallback_2 as PerformanceObserverCallback }
7364
+
7365
+ /** @public */
7366
+ declare interface PerformanceObserverEntryList_2 {
7367
+ getEntries(): PerformanceEntry_2[];
7368
+ getEntriesByType(entryType: string): PerformanceEntry_2[];
7369
+ getEntriesByName(name: string, entryType?: string): PerformanceEntry_2[];
7370
+ }
7371
+ export { PerformanceObserverEntryList_2 as PerformanceObserverEntryList }
7372
+
7373
+ /** @public */
7374
+ export declare interface PerformanceObserverOptions {
7375
+ entryTypes: string[];
7376
+ }
7377
+
7378
+ /**
7379
+ * 系统日历精细授权状态。
7380
+ *
7381
+ * 继承 {@link BasicAuthorizationDetail} 的全部取值,并增加:
7382
+ * - `read only`:只能读取日历,不能新增、修改或删除日程;仅 Android 支持。
7383
+ * - `write only`:只能新增日程,不能读取现有日历数据。
7384
+ *
7385
+ * @public
7386
+ */
7387
+ export declare type PhoneCalendarAuthorizationDetail = BasicAuthorizationDetail | 'read only' | 'write only';
7388
+
6830
7389
  /**
6831
7390
  * 插件账号信息(仅在插件中调用时包含)。
6832
7391
  *
@@ -8721,15 +9280,14 @@ export declare interface ShowLoadingParams {
8721
9280
  * ```
8722
9281
  *
8723
9282
  * @since 0.0.26
8724
- * @contractStatus verified | 公开参数、返回动作及 Android、iOS 行为已核对一致;按钮默认文案存在平台差异,已在字段约束中说明。
8725
- * @contractMismatch non-blocking | default | confirmText、cancelText | Android,iOS | 省略时使用统一默认文案 | Android 默认 confirm/cancel,iOS 默认 OK/Cancel | 未传文案时双端按钮文字不同,公开可选类型可承载 | ai-sdk/android/ai-sdk/src/main/java/com/bytedance/ai/bridge/method/ui/ShowModalMethod.kt; ai-sdk/ios/AISDK/Sources/JSBridge/Methods/UI/AIBridgeShowModalMethod.swift | 统一双端默认按钮文案
9283
+ * @contractStatus verified | 参数、返回 action/content 及 Android、iOS 行为已核对一致;HarmonyOS 当前不提供实现。
8726
9284
  * @platformSupport Android | supported | 支持展示模态对话框。
8727
9285
  * @platformSupport iOS | supported | 支持展示模态对话框。
8728
9286
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
8729
9287
  * @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
8730
9288
  * @permission none | - | none | Android,iOS | 无需额外权限
8731
9289
  * @precondition All | 无额外前置条件
8732
- * @usageNote All | content 必填;仅当 showCancel 为 true 时展示取消按钮,仅当 tapMaskToDismiss 为 true 时点击蒙层可关闭。
9290
+ * @usageNote All | 仅当 showCancel 为 true 时展示取消按钮;仅当 tapMaskToDismiss 为 true 时点击蒙层可关闭;editable 为 true 且用户确认时返回输入 content。
8733
9291
  * @resultExample
8734
9292
  * ```json
8735
9293
  * {
@@ -8740,7 +9298,7 @@ export declare interface ShowLoadingParams {
8740
9298
  *
8741
9299
  * @public
8742
9300
  */
8743
- export declare const showModal: (params: ShowModalParams) => Promise<ShowModalResult>;
9301
+ export declare const showModal: (params?: ShowModalParams | undefined) => Promise<ShowModalResult>;
8744
9302
 
8745
9303
  /**
8746
9304
  * 显示模态对话框的参数。
@@ -8753,25 +9311,50 @@ export declare interface ShowModalParams {
8753
9311
  * @default -
8754
9312
  */
8755
9313
  title?: string;
8756
- /** 模态对话框的内容。 */
8757
- content: string;
9314
+ /**
9315
+ * 模态对话框的内容。
9316
+ * @default -
9317
+ */
9318
+ content?: string;
8758
9319
  /**
8759
9320
  * 是否显示取消按钮。
8760
9321
  * @default true
8761
9322
  */
8762
9323
  showCancel?: boolean;
8763
9324
  /**
8764
- * 取消按钮的文字,省略时使用平台默认文案。
8765
- * @default -
8766
- * @constraint Android 默认文案为“cancel”,iOS 默认文案为“Cancel”,需统一时请显式传入。
9325
+ * 取消按钮的文字。
9326
+ * @default 取消
9327
+ * @constraint 最多 4 个字符。
8767
9328
  */
8768
9329
  cancelText?: string;
8769
9330
  /**
8770
- * 确认按钮的文字,省略时使用平台默认文案。
8771
- * @default -
8772
- * @constraint Android 默认文案为“confirm”,iOS 默认文案为“OK”,需统一时请显式传入。
9331
+ * 取消按钮的文字颜色。
9332
+ * @default #000000
9333
+ * @constraint 必须是 16 进制格式的颜色字符串。
9334
+ */
9335
+ cancelColor?: string;
9336
+ /**
9337
+ * 确认按钮的文字。
9338
+ * @default 确定
9339
+ * @constraint 最多 4 个字符。
8773
9340
  */
8774
9341
  confirmText?: string;
9342
+ /**
9343
+ * 确认按钮的文字颜色。
9344
+ * @default #F85959
9345
+ * @constraint 必须是 16 进制格式的颜色字符串。
9346
+ */
9347
+ confirmColor?: string;
9348
+ /**
9349
+ * 是否显示输入框。
9350
+ * @default false
9351
+ */
9352
+ editable?: boolean;
9353
+ /**
9354
+ * 显示输入框时的提示文本。
9355
+ * @default -
9356
+ */
9357
+ placeholderText?: string;
8775
9358
  /**
8776
9359
  * 是否允许点击蒙层关闭对话框。
8777
9360
  * @default true
@@ -8787,22 +9370,17 @@ export declare interface ShowModalParams {
8787
9370
  export declare interface ShowModalResult {
8788
9371
  /** 用户点击的动作。 */
8789
9372
  action: 'confirm' | 'cancel' | 'mask';
9373
+ /** `editable` 为 true 时,用户点击确认后输入的文本。 */
9374
+ content?: string;
8790
9375
  }
8791
9376
 
8792
9377
  /**
8793
9378
  * 显示 Toast 提示。
8794
9379
  *
8795
- * 参数 `options` 包含以下字段:
8796
- * - `message`:提示的内容。
8797
- * - `type`:Toast 的类型,可选值为 'default'、'success'、'error' 或 'warning'。
8798
- * - `duration`:提示的延迟时间,单位毫秒,默认为 2000。
8799
- * - `icon`:图标,可选值为 'success'、'error'、'warn'。
8800
- * - `customIcon`:自定义图标的 URL 或 base64 字符串。
8801
- *
8802
9380
  * @summary 显示 Toast 提示。
8803
9381
  * @returns 返回一个 Promise,在 Toast 显示结束时 resolve。
8804
9382
  * @remarks
8805
- * duration icon 可控制提示表现。
9383
+ * Android 默认显示 3000 毫秒,iOS 默认显示 2000 毫秒;需要双端一致时请显式传入 `duration`。
8806
9384
  * @example
8807
9385
  * ```typescript
8808
9386
  * import { showToast } from '@doubao-dev/framework/api';
@@ -8849,7 +9427,7 @@ export declare interface ShowModalResult {
8849
9427
  * @errorCode errNo | 104 | invalid parameter | Android,iOS | message 为空;iOS 还会在 icon 取值非法或入参无法解析时返回(type 由前端归一化为合法值,非法 type 场景不会触发) | 修正参数后重试。
8850
9428
  * @errorCode errNo | 103 | feature not support | iOS | 豆包 UIService 未实现,无法展示 Toast | 降级到其他提示方式。
8851
9429
  * @errorCode common | 102 | Android
8852
- * @platformNote iOS | 参数校验失败统一返回 errNo 104;UIService 缺失时返回 errNo 103。Android 参数校验失败返回 errNo 104,宿主上下文缺失返回 errNo 102。
9430
+ * @platformNote iOS | 参数校验失败统一返回 errNo 104;UIService 缺失时返回 errNo 103。Android 参数校验失败返回 errNo 104,豆包页面运行上下文缺失返回 errNo 102。
8853
9431
  *
8854
9432
  * @public
8855
9433
  * */
@@ -8866,8 +9444,8 @@ export declare interface ShowToastParams {
8866
9444
  type?: 'default' | 'success' | 'error' | 'warning';
8867
9445
  /**
8868
9446
  * 提示的持续时间,单位毫秒。
8869
- * @default -
8870
- * @constraint Android 默认 3000,iOS 默认 2000,需双端一致时请显式传入。
9447
+ * @default Android 3000,iOS 2000
9448
+ * @constraint 需双端保持一致时请显式传入。
8871
9449
  */
8872
9450
  duration?: number;
8873
9451
  /**
@@ -8888,7 +9466,7 @@ export declare interface ShowToastParams {
8888
9466
  * @param params - `createSignOrder` 返回的平台签约订单号。
8889
9467
  * @returns 签约页面流程正常返回时解析为空对象;该结果不代表签约成功。
8890
9468
  * @remarks
8891
- * 如果用户尚未绑定抖音账号,宿主可能先拉起账号绑定流程,再继续展示签约页面。
9469
+ * 如果用户尚未绑定抖音账号,豆包可能先拉起账号绑定流程,再继续展示签约页面。
8892
9470
  *
8893
9471
  * 用户的最终签约状态必须以业务服务端查询签约单详情或收到的签约结果回调为准。
8894
9472
  * 业务服务端还需要维护业务用户与签约 ID 的对应关系。
@@ -8996,7 +9574,7 @@ export declare interface SocketTask {
8996
9574
  /**
8997
9575
  * 表示 Socket 正在连接。
8998
9576
  *
8999
- * `connectSocket` 刚返回且宿主尚未完成握手时通常处于该状态。
9577
+ * `connectSocket` 刚返回且豆包客户端尚未完成握手时通常处于该状态。
9000
9578
  */
9001
9579
  readonly CONNECTING: 0;
9002
9580
  /**
@@ -9008,7 +9586,7 @@ export declare interface SocketTask {
9008
9586
  /**
9009
9587
  * 表示 Socket 连接关闭中。
9010
9588
  *
9011
- * 调用 {@link SocketTask.close} 后、本地等待宿主侧完成关闭流程时通常处于该状态。
9589
+ * 调用 {@link SocketTask.close} 后,等待豆包客户端完成关闭流程时通常处于该状态。
9012
9590
  */
9013
9591
  readonly CLOSING: 2;
9014
9592
  /**
@@ -9021,7 +9599,7 @@ export declare interface SocketTask {
9021
9599
  * 当前 Socket 连接状态 code。
9022
9600
  *
9023
9601
  * 可与 `CONNECTING`、`OPEN`、`CLOSING`、`CLOSED` 常量比较。
9024
- * 如果因为参数错误等原因导致连接请求没有被宿主成功创建,则为 `undefined`。
9602
+ * 如果因为参数错误等原因导致豆包客户端没有成功创建连接,则为 `undefined`。
9025
9603
  */
9026
9604
  readonly readyState: number | undefined;
9027
9605
  /**
@@ -9073,7 +9651,7 @@ export declare interface SocketTask {
9073
9651
  /**
9074
9652
  * WebSocket 关闭事件。
9075
9653
  *
9076
- * 当前连接被主动关闭、服务端关闭或宿主侧因异常回收连接时触发。
9654
+ * 当前连接被主动关闭、服务端关闭或豆包客户端因异常回收连接时触发。
9077
9655
  * 触发后 `readyState` 会变为 `SocketTask.CLOSED`,该 `SocketTask` 不应再继续发送数据。
9078
9656
  *
9079
9657
  * @public
@@ -9082,31 +9660,31 @@ export declare interface SocketTaskCloseEvent {
9082
9660
  /**
9083
9661
  * 关闭状态码。
9084
9662
  *
9085
- * 可能来自调用 {@link SocketTask.close} 时传入的 `code`,也可能来自服务端或宿主侧。
9663
+ * 可能来自调用 {@link SocketTask.close} 时传入的 `code`,也可能来自服务端或豆包客户端。
9086
9664
  */
9087
9665
  code?: number;
9088
9666
  /**
9089
9667
  * 关闭原因。
9090
9668
  *
9091
- * 可能来自调用 {@link SocketTask.close} 时传入的 `reason`,也可能来自服务端或宿主侧。
9669
+ * 可能来自调用 {@link SocketTask.close} 时传入的 `reason`,也可能来自服务端或豆包客户端。
9092
9670
  */
9093
9671
  reason?: string;
9094
9672
  /**
9095
9673
  * 错误信息。
9096
9674
  *
9097
- * 非正常关闭时宿主侧可能通过该字段补充失败原因;正常关闭时通常为空。
9675
+ * 非正常关闭时豆包客户端可能通过该字段补充失败原因;正常关闭时通常为空。
9098
9676
  */
9099
9677
  errMsg?: string;
9100
9678
  /**
9101
9679
  * 当前连接使用的网络传输层协议。
9102
9680
  *
9103
- * 该字段由宿主侧返回,部分运行环境可能不提供。
9681
+ * 该字段由豆包客户端返回,部分运行环境可能不提供。
9104
9682
  */
9105
9683
  protocolType?: string;
9106
9684
  /**
9107
- * 宿主侧使用的 WebSocket 实现类型。
9685
+ * 豆包客户端使用的 WebSocket 实现类型。
9108
9686
  *
9109
- * 该字段由宿主侧返回,部分运行环境可能不提供。
9687
+ * 该字段由豆包客户端返回,部分运行环境可能不提供。
9110
9688
  */
9111
9689
  socketType?: string;
9112
9690
  }
@@ -9123,10 +9701,10 @@ export declare interface SocketTaskCloseParams {
9123
9701
  /**
9124
9702
  * 关闭连接状态码。
9125
9703
  *
9126
- * 不传时由宿主侧按正常关闭处理,通常等价于 `1000`。
9704
+ * 不传时由豆包客户端按正常关闭处理,通常等价于 `1000`。
9127
9705
  * 常见值包括:
9128
9706
  * - `1000`: 正常关闭;
9129
- * - `1001`: 因页面进入后台、宿主回收连接等原因关闭。
9707
+ * - `1001`: 因页面进入后台、豆包客户端回收连接等原因关闭。
9130
9708
  */
9131
9709
  code?: number;
9132
9710
  /**
@@ -9149,7 +9727,7 @@ export declare interface SocketTaskErrorEvent {
9149
9727
  /**
9150
9728
  * 错误信息。
9151
9729
  *
9152
- * 由前端参数校验、编码过程或宿主侧返回的失败原因组成,可直接用于日志上报。
9730
+ * 由前端参数校验、编码过程或豆包客户端返回的失败原因组成,可直接用于日志上报。
9153
9731
  */
9154
9732
  errMsg: string;
9155
9733
  }
@@ -9175,13 +9753,13 @@ export declare interface SocketTaskMessageEvent {
9175
9753
  /**
9176
9754
  * 当前消息所属连接使用的协议。
9177
9755
  *
9178
- * 该字段由宿主侧返回,部分运行环境可能不提供。
9756
+ * 该字段由豆包客户端返回,部分运行环境可能不提供。
9179
9757
  */
9180
9758
  protocolType?: string;
9181
9759
  /**
9182
- * 宿主侧使用的 WebSocket 实现类型。
9760
+ * 豆包客户端使用的 WebSocket 实现类型。
9183
9761
  *
9184
- * 该字段由宿主侧返回,部分运行环境可能不提供。
9762
+ * 该字段由豆包客户端返回,部分运行环境可能不提供。
9185
9763
  */
9186
9764
  socketType?: string;
9187
9765
  }
@@ -9189,7 +9767,7 @@ export declare interface SocketTaskMessageEvent {
9189
9767
  /**
9190
9768
  * WebSocket 连接成功事件。
9191
9769
  *
9192
- * 当宿主侧完成 WebSocket 握手并进入 open 状态后触发。
9770
+ * 当豆包客户端完成 WebSocket 握手并进入 open 状态后触发。
9193
9771
  * 收到该事件后,调用方可以开始通过 {@link SocketTask.send} 发送数据。
9194
9772
  *
9195
9773
  * @public
@@ -9205,13 +9783,13 @@ export declare interface SocketTaskOpenEvent {
9205
9783
  /**
9206
9784
  * 当前连接使用的网络传输层协议。
9207
9785
  *
9208
- * 该字段由宿主侧返回,部分运行环境可能不提供。
9786
+ * 该字段由豆包客户端返回,部分运行环境可能不提供。
9209
9787
  */
9210
9788
  protocolType?: string;
9211
9789
  /**
9212
- * 宿主侧使用的 WebSocket 实现类型。
9790
+ * 豆包客户端使用的 WebSocket 实现类型。
9213
9791
  *
9214
- * 可能的值由宿主实现决定,例如传统 WebSocket 实现或宿主网络库实现;
9792
+ * 可能的值由豆包客户端实现决定,例如系统 WebSocket 实现或豆包网络库实现;
9215
9793
  * 部分运行环境可能不提供。
9216
9794
  */
9217
9795
  socketType?: string;
@@ -9230,7 +9808,7 @@ export declare interface SocketTaskSendParams {
9230
9808
  * 需要发送给服务端的数据。
9231
9809
  *
9232
9810
  * - 传入 `string` 时按文本消息发送;
9233
- * - 传入 `ArrayBuffer` 时按二进制消息发送,内部会编码后交给宿主侧处理。
9811
+ * - 传入 `ArrayBuffer` 时按二进制消息发送,内部会编码后交给豆包客户端处理。
9234
9812
  *
9235
9813
  * 建议只在 `onOpen` 回调触发后调用 `send`,此时 `readyState` 通常为 `SocketTask.OPEN`。
9236
9814
  */
@@ -9613,14 +10191,14 @@ export declare interface StartGyroscopeParams {
9613
10191
  * }
9614
10192
  * ```
9615
10193
  * @errorCode common | 102 | Android,iOS
9616
- * @errorCode errNo | 103 | feature not support | Android,iOS | 宿主未注册持续定位能力(location service 不可用) | 确认宿主已集成持续定位能力,不可用时不要调用
10194
+ * @errorCode errNo | 103 | feature not support | Android,iOS | 当前豆包客户端未提供持续定位能力(location service 不可用) | 请在支持持续定位的豆包版本中调用
9617
10195
  * @errorCode errNo | 114 | operation cancelled | Android,iOS | 启动过程中被取消(用户取消授权,或授权返回前已调用 stopLocationUpdate) | 需要时重新调用 startLocationUpdate
9618
10196
  * @errorCode errNo | 118 | already exists | Android,iOS | 持续定位已启动,重复调用 startLocationUpdate | 先调用 stopLocationUpdate 再重新启动
9619
10197
  * @errorCode errNo | 1700001 | location permission denied | Android,iOS | 用户拒绝应用位置授权或系统定位权限被拒 | 调用 authorize 重新发起授权并在系统设置中开启定位权限后重试
9620
10198
  * @errorCode errNo | 1700002 | location network error | Android,iOS | 位置授权过程中发生网络错误 | 检查网络连接后重试
9621
10199
  * @errorCode errNo | 104 | invalid parameter | iOS | 位置授权 scope 非法 | 检查应用权限声明中配置的 scope 后重试
9622
- * @platformNote Android | 用户拒绝授权返回 1700001、取消返回 114、授权网络失败返回 1700002;宿主未注册持续定位能力返回 103;其他失败统一返回 102。
9623
- * @platformNote iOS | 用户拒绝授权返回 1700001、取消返回 114、授权网络失败返回 1700002、非法 scope 返回 104;宿主未注册持续定位能力返回 103;其他失败统一返回 102。
10200
+ * @platformNote Android | 用户拒绝授权返回 1700001、取消返回 114、授权网络失败返回 1700002;当前豆包客户端不支持持续定位时返回 103;其他失败统一返回 102。
10201
+ * @platformNote iOS | 用户拒绝授权返回 1700001、取消返回 114、授权网络失败返回 1700002、非法 scope 返回 104;当前豆包客户端不支持持续定位时返回 103;其他失败统一返回 102。
9624
10202
  *
9625
10203
  * @public
9626
10204
  */
@@ -9930,7 +10508,7 @@ export declare const stopGyroscope: (params?: {} | undefined) => Promise<object>
9930
10508
  * }
9931
10509
  * ```
9932
10510
  * @errorCode common | 102 | Android,iOS
9933
- * @errorCode errNo | 103 | feature not support | Android,iOS | 持续定位已启动,但宿主未注册持续定位能力(location service 不可用),无法停止 | 确认宿主已集成持续定位能力
10511
+ * @errorCode errNo | 103 | feature not support | Android,iOS | 当前豆包客户端未提供持续定位能力(location service 不可用),无法停止 | 请在支持持续定位的豆包版本中调用
9934
10512
  * @platformNote All | 未启动或仍在授权阶段调用直接返回成功;仅在已启动后停止失败时返回错误码,其他失败统一返回 102。
9935
10513
  *
9936
10514
  * @public
@@ -10116,6 +10694,18 @@ export declare interface ThemeChangeEvent {
10116
10694
  */
10117
10695
  export declare type ThemeChangeListener = (event: ThemeChangeEvent) => void;
10118
10696
 
10697
+ /**
10698
+ * Tool 返回的标准内容。
10699
+ *
10700
+ * @public
10701
+ */
10702
+ export declare interface ToolResult {
10703
+ /** Tool 返回的内容块。 */
10704
+ content?: Array<Record<string, unknown>>;
10705
+ /** Tool 返回的结构化内容。 */
10706
+ structuredContent?: unknown;
10707
+ }
10708
+
10119
10709
  /**
10120
10710
  * {@link FileSystemManager.truncate} 的参数。
10121
10711
  *
@@ -10139,6 +10729,18 @@ export declare interface TruncateParams {
10139
10729
 
10140
10730
  declare type TypeGuard<From, To extends From> = (from: From) => from is To;
10141
10731
 
10732
+ /**
10733
+ * 尚未获得权限时的精细状态。
10734
+ *
10735
+ * 取值说明:
10736
+ * - `not determined`:系统明确表示用户尚未作出选择
10737
+ * - `denied`:当前没有权限;可能是用户拒绝、关闭权限,或平台无法进一步区分拒绝原因
10738
+ * - `restricted`:系统明确表示权限受设备管理、家长控制等策略限制,用户无法直接修改
10739
+ *
10740
+ * @public
10741
+ */
10742
+ export declare type UnauthorizedDetail = 'not determined' | 'denied' | 'restricted';
10743
+
10142
10744
  /**
10143
10745
  * {@link FileSystemManager.unlink} 的参数。
10144
10746
  *
@@ -10282,10 +10884,10 @@ export declare interface UpdateModelContextParams {
10282
10884
  * }
10283
10885
  * ```
10284
10886
  * @errorCode common | 102 | Android,iOS
10285
- * @errorCode errNo | 103 | feature not support | Android,iOS | 当前运行环境未接入消息更新能力(宿主消息依赖或消息服务缺失) | 请在支持卡片消息更新的豆包环境中调用。
10887
+ * @errorCode errNo | 103 | feature not support | Android,iOS | 当前豆包环境未提供消息更新能力 | 请在支持卡片消息更新的豆包环境中调用。
10286
10888
  * @errorCode errNo | 104 | invalid parameter | Android,iOS | widgetInstanceId 或 widgetData 为空,或传入了空字符串的 widgetId | 传入非空的 widgetInstanceId、widgetData,并确保 widgetId 有效后重试。
10287
10889
  * @errorCode errNo | 116 | resource not found | Android,iOS | 依据 widgetInstanceId 找不到对应消息,或依据 widgetId 找不到已注册的 Widget | 确认 widgetInstanceId 与 widgetId 有效后重试。
10288
- * @platformNote All | 参数为空返回 104;消息或 Widget 未找到返回 116;宿主消息依赖或消息服务缺失返回 103;其他失败统一返回 102。
10890
+ * @platformNote All | 参数为空返回 104;消息或 Widget 未找到返回 116;当前豆包环境未提供消息更新能力时返回 103;其他失败统一返回 102。
10289
10891
  *
10290
10892
  * @public
10291
10893
  */
@@ -10367,7 +10969,7 @@ export declare interface UpdateWidgetParams {
10367
10969
  * @errorCode errNo | 121902 | uploadFile:fail no file exist | Android,iOS | filePath 为空、文件不存在或路径不是文件 | 使用文件 API 获取当前智能服务可访问的有效文件路径
10368
10970
  * @errorCode errNo | 121905 | uploadFile:fail upload file abort | Android,iOS | 调用 UploadTask.abort 中断上传 | 按业务需要处理取消状态,无需自动重试
10369
10971
  * @errorCode errNo | 121906 | uploadFile:fail file path permission denied | Android,iOS | 当前智能服务无权访问 filePath | 改用当前智能服务目录内的文件
10370
- * @errorCode errNo | 121920 | uploadFile:fail request time out | Android,iOS | 上传超过宿主超时时间 | 检查网络或设置合理的 timeout 后重试
10972
+ * @errorCode errNo | 121920 | uploadFile:fail request time out | Android,iOS | 上传超过豆包客户端的超时时间 | 检查网络或设置合理的 timeout 后重试
10371
10973
  * @errorCode errNo | 121985 | uploadFile:fail network unavailable | Android,iOS | 当前网络不可用 | 恢复网络连接后重试
10372
10974
  * @errorCode errNo | 121991 | uploadFile:fail network error | Android,iOS | 上传过程中发生网络错误 | 检查网络和服务端状态后重试
10373
10975
  * @errorCode errNo | 121992 | uploadFile:fail enableProfile is not supported | Android,iOS | enableProfile 设置为 true | 移除 enableProfile 或设置为 false
@@ -10400,14 +11002,14 @@ export declare function uploadFile(params: UploadFileParams): UploadTask;
10400
11002
  * @public
10401
11003
  */
10402
11004
  export declare interface UploadFileParams {
10403
- /** 开发者服务器地址,需为完整的 HTTP/HTTPS URL,并通过宿主侧上传域名白名单校验。 */
11005
+ /** 开发者服务器地址,需为完整的 HTTP/HTTPS URL,并通过豆包配置的上传域名白名单校验。 */
10404
11006
  url: string;
10405
11007
  /** 要上传文件资源的本地路径。 */
10406
11008
  filePath: string;
10407
11009
  /** 文件对应的 form field name/key,服务端通过该 key 获取文件内容;multipart filename 使用 filePath 的 basename。 */
10408
11010
  name: string;
10409
11011
  /**
10410
- * HTTP 请求 Header。`referer`、`user-agent`、`content-type` 等宿主管控字段不会被业务覆盖。
11012
+ * HTTP 请求 Header。`referer`、`user-agent`、`content-type` 等由豆包客户端管理的字段不会被业务覆盖。
10411
11013
  *
10412
11014
  * @default -
10413
11015
  */
@@ -10419,7 +11021,7 @@ export declare interface UploadFileParams {
10419
11021
  */
10420
11022
  formData?: Record<string, unknown>;
10421
11023
  /**
10422
- * 超时时间,单位 ms;不传时使用宿主侧默认超时配置。
11024
+ * 超时时间,单位 ms;不传时使用豆包客户端的默认超时配置。
10423
11025
  *
10424
11026
  * @default -
10425
11027
  */
@@ -10461,7 +11063,7 @@ export declare interface UploadTask extends Promise<UploadFileResult> {
10461
11063
  /**
10462
11064
  * 监听上传进度变化。
10463
11065
  *
10464
- * 同一个任务可以注册多个回调,每次收到宿主进度事件时依次调用。
11066
+ * 同一个任务可以注册多个回调,每次收到豆包客户端的进度事件时依次调用。
10465
11067
  */
10466
11068
  onProgressUpdate: (callback: (event: UploadTaskProgressUpdateEvent) => void) => void;
10467
11069
  /**
@@ -10473,7 +11075,7 @@ export declare interface UploadTask extends Promise<UploadFileResult> {
10473
11075
  /**
10474
11076
  * 监听 HTTP Response Header 事件。
10475
11077
  *
10476
- * 同一个任务可以注册多个回调,宿主收到上传响应头时依次调用。
11078
+ * 同一个任务可以注册多个回调,豆包客户端收到上传响应头时依次调用。
10477
11079
  */
10478
11080
  onHeadersReceived: (callback: (event: UploadTaskHeadersReceivedEvent) => void) => void;
10479
11081
  /**