@doubao-dev/framework 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -3
- package/components-style.css +1 -1
- package/dist/api.d.ts +273 -126
- package/dist/components.d.ts +86 -13
- package/dist/index.d.ts +8 -3
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -312,10 +312,10 @@ export declare function arrayBufferToBase64(buffer: ArrayBuffer): string;
|
|
|
312
312
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
313
313
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
314
314
|
* @permission applet | 非 scope.healthData 的 scope | required | Android,iOS | 按传入 scope 发起对应的应用授权。
|
|
315
|
-
* @permission applet | scope.healthData | none | iOS | 不校验 manifest
|
|
315
|
+
* @permission applet | scope.healthData | none | iOS | 不校验 manifest,也不查询或更新服务端应用插件的 scope 状态。
|
|
316
316
|
* @permission system | HealthKit read | required | iOS | scope.healthData 会申请 options.types 对应的系统读取权限。
|
|
317
|
-
* @authorizationBehavior Android | 非健康 scope
|
|
318
|
-
* @authorizationBehavior iOS | 非健康 scope
|
|
317
|
+
* @authorizationBehavior Android | 非健康 scope 会发起应用插件及相应系统授权;当前不支持 scope.healthData。
|
|
318
|
+
* @authorizationBehavior iOS | 非健康 scope 会发起应用插件及相应系统授权;scope.healthData 仅可能展示 HealthKit 系统授权框。
|
|
319
319
|
* @precondition Android | 非健康 scope 需要在应用权限声明中配置;当前不支持 scope.healthData。
|
|
320
320
|
* @precondition iOS | 非健康 scope 需要在应用权限声明中配置;scope.healthData 不需要 manifest 声明。
|
|
321
321
|
* @usageNote Android | 非健康 scope 的授权状态可通过 `getSetting` 查询;当前不支持 scope.healthData。
|
|
@@ -860,7 +860,7 @@ export declare type CalendarRepeatInterval = 'day' | 'week' | 'month' | 'year';
|
|
|
860
860
|
/**
|
|
861
861
|
* 调用当前应用的 Tool。
|
|
862
862
|
*
|
|
863
|
-
*
|
|
863
|
+
* 豆包会根据当前应用插件页面或会话 Widget 确定应用和版本,开发者只需传入 Tool 名称和参数。
|
|
864
864
|
* Tool 正常结果通过 `toolResult` 返回,Tool 业务错误通过 `toolError` 返回,两者都会正常
|
|
865
865
|
* resolve;调用前校验、鉴权或返回结构校验失败时 Promise reject。
|
|
866
866
|
*
|
|
@@ -887,14 +887,14 @@ export declare type CalendarRepeatInterval = 'day' | 'week' | 'month' | 'year';
|
|
|
887
887
|
* @since 0.0.42
|
|
888
888
|
* @containerSupport Page | supported
|
|
889
889
|
* @containerSupport Widget | supported
|
|
890
|
-
* @platformSupport Android | supported |
|
|
891
|
-
* @platformSupport iOS | supported |
|
|
890
|
+
* @platformSupport Android | supported | 支持在应用插件页面和会话 Widget 中调用当前应用的 Tool。
|
|
891
|
+
* @platformSupport iOS | supported | 支持在应用插件页面和会话 Widget 中调用当前应用的 Tool。
|
|
892
892
|
* @platformSupport PC | unsupported | 客户端尚未实现 callTool。
|
|
893
893
|
* @platformSupport HarmonyOS | unsupported | 客户端尚未实现 callTool。
|
|
894
894
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
895
|
-
* @precondition Android |
|
|
896
|
-
* @precondition iOS |
|
|
897
|
-
* @usageNote All | toolResult 与 toolError 互斥;toolError 是正常返回的 Tool 业务错误,不会导致 Promise reject。skipWidgetUpdate 为 true 时不执行 Widget 更新阶段,因此不会返回 cardUpdateError;否则 cardUpdateError 表示 Tool 已执行但当前 Widget
|
|
895
|
+
* @precondition Android | 在当前应用的应用插件页面或由当前应用真实生成的会话 Widget 内调用,且目标 Tool 已在当前应用版本中配置。
|
|
896
|
+
* @precondition iOS | 在当前应用的应用插件页面或由当前应用真实生成的会话 Widget 内调用,且目标 Tool 已在当前应用版本中配置。
|
|
897
|
+
* @usageNote All | toolResult 与 toolError 互斥;toolError 是正常返回的 Tool 业务错误,不会导致 Promise reject。skipWidgetUpdate 为 true 时不执行 Widget 更新阶段,因此不会返回 cardUpdateError;否则 cardUpdateError 表示 Tool 已执行但当前 Widget 更新失败。reloadWidget 默认为 true,仅影响更新后的 Widget 是否重建。重试会再次执行 Tool,请避免重复触发。
|
|
898
898
|
* @resultExample
|
|
899
899
|
* ```json
|
|
900
900
|
* {
|
|
@@ -920,10 +920,10 @@ export declare type CalendarRepeatInterval = 'day' | 'week' | 'month' | 'year';
|
|
|
920
920
|
* }
|
|
921
921
|
* ```
|
|
922
922
|
* @errorCode common | 102 | Android,iOS
|
|
923
|
-
* @errorCode errNo | 103 | feature not support | Android,iOS | 在 Worker
|
|
924
|
-
* @errorCode errNo | 104 | invalid parameter | Android,iOS | toolName 为空、toolArgs 无法序列化为 JSON 对象,或传入的 skipWidgetUpdate 不是布尔值 | 修正 Tool 名称、参数和 Widget 更新控制参数后重试。
|
|
923
|
+
* @errorCode errNo | 103 | feature not support | Android,iOS | 在 Worker 等非应用插件页面、Widget 容器中调用 | 仅在应用插件页面或会话 Widget 中调用。
|
|
924
|
+
* @errorCode errNo | 104 | invalid parameter | Android,iOS | toolName 为空、toolArgs 无法序列化为 JSON 对象,或传入的 skipWidgetUpdate、reloadWidget 不是布尔值 | 修正 Tool 名称、参数和 Widget 更新控制参数后重试。
|
|
925
925
|
* @errorCode errNo | 112 | invalid result | Android,iOS | Tool 正常结果、业务错误或 Widget 更新错误结构无效 | 稍后重试;持续失败时反馈 Tool 或服务端返回异常。
|
|
926
|
-
* @platformNote All |
|
|
926
|
+
* @platformNote All | 非应用插件页面、Widget 容器返回 103;参数非法返回 104;返回结构无效返回 112;上下文无效、网络或服务端调用失败返回 102。
|
|
927
927
|
*
|
|
928
928
|
* @public
|
|
929
929
|
*/
|
|
@@ -973,6 +973,11 @@ export declare interface CallToolParams {
|
|
|
973
973
|
* @constraint 仅影响会下发 Widget 的 Tool。
|
|
974
974
|
*/
|
|
975
975
|
skipWidgetUpdate?: boolean;
|
|
976
|
+
/**
|
|
977
|
+
* 是否重新创建更新后的 Widget 组件;设为 `false` 时复用当前组件。
|
|
978
|
+
* @default true
|
|
979
|
+
*/
|
|
980
|
+
reloadWidget?: boolean;
|
|
976
981
|
}
|
|
977
982
|
|
|
978
983
|
/**
|
|
@@ -1049,6 +1054,7 @@ export declare interface ChatPanelInfo {
|
|
|
1049
1054
|
*
|
|
1050
1055
|
* - `preview` 表示从收起态发送消息后、收到回复前的中间态。
|
|
1051
1056
|
* - `invisible` 表示对话框当前不可见。
|
|
1057
|
+
* - `floating` 表示对话框当前以悬浮形态展示。
|
|
1052
1058
|
*/
|
|
1053
1059
|
state: ChatPanelState;
|
|
1054
1060
|
}
|
|
@@ -1058,7 +1064,16 @@ export declare interface ChatPanelInfo {
|
|
|
1058
1064
|
*
|
|
1059
1065
|
* @public
|
|
1060
1066
|
*/
|
|
1061
|
-
export declare type ChatPanelState = 'collapsed' | 'expanded' | 'preview' | 'invisible';
|
|
1067
|
+
export declare type ChatPanelState = 'collapsed' | 'expanded' | 'preview' | 'invisible' | 'floating';
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* 可主动设置的对话框展示状态。
|
|
1071
|
+
*
|
|
1072
|
+
* `preview` 是对话回复过程中的只读状态,不能主动设置。
|
|
1073
|
+
*
|
|
1074
|
+
* @public
|
|
1075
|
+
*/
|
|
1076
|
+
export declare type ChatPanelTargetState = Exclude<ChatPanelState, 'preview'>;
|
|
1062
1077
|
|
|
1063
1078
|
/**
|
|
1064
1079
|
* 检测无障碍能力是否开启。
|
|
@@ -1365,13 +1380,13 @@ export declare type ChooseMessageFileType = 'all' | 'video' | 'image' | 'file';
|
|
|
1365
1380
|
* @since 0.0.17
|
|
1366
1381
|
* @containerSupport Page | supported
|
|
1367
1382
|
* @containerSupport Widget | supported
|
|
1368
|
-
* @platformSupport Android | supported |
|
|
1369
|
-
* @platformSupport iOS | supported |
|
|
1383
|
+
* @platformSupport Android | supported | 支持清空当前应用插件的全部本地缓存。
|
|
1384
|
+
* @platformSupport iOS | supported | 支持清空当前应用插件的全部本地缓存。
|
|
1370
1385
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
1371
1386
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
1372
1387
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
1373
1388
|
* @precondition All | 无额外前置条件
|
|
1374
|
-
* @usageNote All |
|
|
1389
|
+
* @usageNote All | 只清空当前登录用户在当前应用插件下的缓存,不影响其他用户或其他应用插件的数据。
|
|
1375
1390
|
* @errorCode common | 102 | Android
|
|
1376
1391
|
*
|
|
1377
1392
|
* @public
|
|
@@ -1392,13 +1407,13 @@ export declare const clearStorage: (params?: object | undefined) => Promise<obje
|
|
|
1392
1407
|
* @since 0.0.19
|
|
1393
1408
|
* @containerSupport Page | supported
|
|
1394
1409
|
* @containerSupport Widget | supported
|
|
1395
|
-
* @platformSupport Android | supported |
|
|
1396
|
-
* @platformSupport iOS | supported |
|
|
1410
|
+
* @platformSupport Android | supported | 支持同步清空当前应用插件的全部本地缓存。
|
|
1411
|
+
* @platformSupport iOS | supported | 支持同步清空当前应用插件的全部本地缓存。
|
|
1397
1412
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
1398
1413
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
1399
1414
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
1400
1415
|
* @precondition All | 无额外前置条件
|
|
1401
|
-
* @usageNote All |
|
|
1416
|
+
* @usageNote All | 只清空当前登录用户在当前应用插件下的缓存,不影响其他用户或其他应用插件的数据。
|
|
1402
1417
|
* @errorCode common | 102 | Android
|
|
1403
1418
|
*
|
|
1404
1419
|
* @public
|
|
@@ -1569,12 +1584,12 @@ export declare type CompassChangeListener = (event: CompassChangeEvent) => void;
|
|
|
1569
1584
|
* @since 0.0.26
|
|
1570
1585
|
* @containerSupport Page | supported
|
|
1571
1586
|
* @containerSupport Widget | unsupported
|
|
1572
|
-
* @platformSupport Android | supported |
|
|
1573
|
-
* @platformSupport iOS | supported |
|
|
1587
|
+
* @platformSupport Android | supported | 支持压缩豆包应用插件本地图片
|
|
1588
|
+
* @platformSupport iOS | supported | 支持压缩豆包应用插件本地图片
|
|
1574
1589
|
* @platformSupport PC | unsupported | 暂不支持
|
|
1575
1590
|
* @platformSupport HarmonyOS | unsupported | 暂不支持
|
|
1576
1591
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
1577
|
-
* @precondition All | src
|
|
1592
|
+
* @precondition All | src 指向豆包应用插件可访问、存在且可解码的本地图片。
|
|
1578
1593
|
* @resultExample
|
|
1579
1594
|
* ```json
|
|
1580
1595
|
* {
|
|
@@ -1704,7 +1719,7 @@ export declare interface ConnectedBluetoothDevice {
|
|
|
1704
1719
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
1705
1720
|
* @precondition All | 无额外前置条件。
|
|
1706
1721
|
* @usageNote All | 不再使用的连接应主动调用 SocketTask.close 释放资源,避免占用连接名额。
|
|
1707
|
-
* @knownIssue All |
|
|
1722
|
+
* @knownIssue All | 同一应用插件内最多同时保持 5 条 WebSocket 连接,超过上限时 connectSocket 会立即同步失败并通过 SocketTask.onError 通知。
|
|
1708
1723
|
* @resultExample
|
|
1709
1724
|
* ```json
|
|
1710
1725
|
* {
|
|
@@ -1721,10 +1736,10 @@ export declare interface ConnectedBluetoothDevice {
|
|
|
1721
1736
|
* @errorCode common | 102 | Android
|
|
1722
1737
|
* @errorCode common | 113 | Android,iOS
|
|
1723
1738
|
* @errorCode errNo | 104 | invalid parameter | Android,iOS | 创建连接时 url 为空或非 ws/wss,或调用 send 时 base64 数据非法、dataType 不支持 | 传入合法的 ws/wss url 与受支持的发送数据后重试。
|
|
1724
|
-
* @errorCode errNo | 110 | API call prohibited | Android,iOS | socket url 未通过域名白名单校验 |
|
|
1739
|
+
* @errorCode errNo | 110 | API call prohibited | Android,iOS | socket url 未通过域名白名单校验 | 确认目标域名已在应用插件中配置后重试。
|
|
1725
1740
|
* @errorCode errNo | 116 | resource not found | Android,iOS | 对已关闭或不存在的 socketTaskId 调用 send/close | 仅在 onOpen 后、onClose 前操作连接,不要复用已关闭的连接。
|
|
1726
1741
|
* @errorCode errNo | 305 | network failure | Android,iOS | 建立连接、发送或关闭过程中发生网络错误 | 检查网络连接,必要时重新建立连接。
|
|
1727
|
-
* @errorCode errNo | 1501001 | websocket connection limit exceeded | Android,iOS |
|
|
1742
|
+
* @errorCode errNo | 1501001 | websocket connection limit exceeded | Android,iOS | 同一应用插件的 WebSocket 连接数超过上限 | 关闭不再使用的连接后重试。
|
|
1728
1743
|
* @errorCode errNo | 1501002 | websocket is not open | iOS | 连接尚未打开或已关闭时调用 send | 在收到 onOpen 事件后再发送数据。
|
|
1729
1744
|
* @platformNote Android | 建立连接失败统一返回 102;send 在连接未打开时返回 305 或 116。
|
|
1730
1745
|
* @platformNote iOS | send 在连接未打开时返回 1501002。
|
|
@@ -1741,7 +1756,7 @@ export declare function connectSocket(params: ConnectSocketParams): SocketTask;
|
|
|
1741
1756
|
* 都通过 `SocketTask` 上注册的事件回调通知。
|
|
1742
1757
|
*
|
|
1743
1758
|
* @remarks
|
|
1744
|
-
* - `url` 应填写完整的 WebSocket 地址。线上环境通常要求使用 `wss://`
|
|
1759
|
+
* - `url` 应填写完整的 WebSocket 地址。线上环境通常要求使用 `wss://` 协议,并由豆包客户端按当前应用插件配置校验合法域名和证书。
|
|
1745
1760
|
* - `header` 用于补充握手请求头,`referer` 等由豆包客户端管理的字段不会被业务代码覆盖。
|
|
1746
1761
|
* - `protocols` 非空时,服务端需要在握手响应中选择并返回匹配的子协议,否则连接可能失败。
|
|
1747
1762
|
* - 同一个页面多次调用会创建多个独立连接,已创建的旧连接不会因为新连接自动关闭。
|
|
@@ -1985,7 +2000,7 @@ export declare const createCustomEvent: typeof createCustomEvent_2;
|
|
|
1985
2000
|
/**
|
|
1986
2001
|
* 创建一组用于发送和监听自定义事件的函数。
|
|
1987
2002
|
*
|
|
1988
|
-
*
|
|
2003
|
+
* 发送函数会向当前应用插件的其他页面或卡片实例广播事件;监听注册函数可注册多个处理函数,
|
|
1989
2004
|
* 并返回对应的注销函数。发送端和接收端应复用同一份事件定义,确保事件名称和参数类型一致。
|
|
1990
2005
|
*
|
|
1991
2006
|
* @summary 创建自定义事件。
|
|
@@ -2013,9 +2028,9 @@ export declare const createCustomEvent: typeof createCustomEvent_2;
|
|
|
2013
2028
|
* ```
|
|
2014
2029
|
*
|
|
2015
2030
|
* @since 0.0.1
|
|
2016
|
-
* @platformSupport Android | supported |
|
|
2017
|
-
* @platformSupport iOS | supported |
|
|
2018
|
-
* @platformSupport PC | supported |
|
|
2031
|
+
* @platformSupport Android | supported | 支持在应用插件的页面或卡片实例之间发送和接收自定义事件。
|
|
2032
|
+
* @platformSupport iOS | supported | 支持在应用插件的页面或卡片实例之间发送和接收自定义事件。
|
|
2033
|
+
* @platformSupport PC | supported | 支持在应用插件的页面或卡片实例之间发送和接收自定义事件。
|
|
2019
2034
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
2020
2035
|
* @permission none | - | none | Android,iOS,PC | 无需额外权限
|
|
2021
2036
|
* @precondition All | 发送端与接收端需使用相同的事件名称和参数结构。
|
|
@@ -2076,7 +2091,7 @@ declare function createCustomEvent_2<Params extends object>(name: string, option
|
|
|
2076
2091
|
* ```
|
|
2077
2092
|
* @errorCode event.errCode | -2002 | inner audio instance not found | Android,iOS | 实例已销毁或不存在时继续操作 | 重新创建上下文,不要继续使用已销毁实例。
|
|
2078
2093
|
* @errorCode event.errCode | -2003 | inner audio src is empty | Android,iOS | 未设置 src 就调用 play | 设置有效 src 后重试。
|
|
2079
|
-
* @errorCode event.errCode | -2004 | inner audio src is invalid | Android,iOS | src 无法解析或不受支持 | 改用有效的 HTTP、HTTPS
|
|
2094
|
+
* @errorCode event.errCode | -2004 | inner audio src is invalid | Android,iOS | src 无法解析或不受支持 | 改用有效的 HTTP、HTTPS 地址或豆包应用插件本地文件路径。
|
|
2080
2095
|
* @errorCode event.errCode | -2005 | inner audio player unavailable | Android,iOS | 播放器无法创建或已不可用 | 销毁当前实例,重新创建后重试。
|
|
2081
2096
|
* @errorCode event.errCode | -2006 | inner audio seek failed | Android,iOS | 播放位置跳转失败 | 等待 canplay 后在音频时长范围内重试。
|
|
2082
2097
|
* @errorCode event.errCode | -2007 | inner audio play failed | Android,iOS | 音频播放失败 | 检查资源地址和网络状态后重试。
|
|
@@ -2282,7 +2297,7 @@ export declare type CustomEventCaller<Params extends object = object> = CustomEv
|
|
|
2282
2297
|
/**
|
|
2283
2298
|
* 自定义事件发送函数。
|
|
2284
2299
|
*
|
|
2285
|
-
*
|
|
2300
|
+
* 调用后会向当前应用插件的其他页面或卡片实例广播事件,不返回处理结果。
|
|
2286
2301
|
*
|
|
2287
2302
|
* @public
|
|
2288
2303
|
*/
|
|
@@ -2429,7 +2444,7 @@ export declare const disableUserScreenRecord: (params?: {} | undefined) => Promi
|
|
|
2429
2444
|
* @deprecated 使用 {@link sendFollowUpMessage} 发送后续消息。
|
|
2430
2445
|
* @remarks
|
|
2431
2446
|
* 适用于卡片交互后向模型补充结构化动作上下文,例如按钮点击、选项选择或表单提交。
|
|
2432
|
-
* `getWidgetInstanceId`
|
|
2447
|
+
* `getWidgetInstanceId` 仅在卡片环境中有效,在应用插件页面中会返回 `undefined`。如果需要在页面中调用,
|
|
2433
2448
|
* 请在 `navigateTo` 时通过参数传递卡片实例 ID。
|
|
2434
2449
|
*
|
|
2435
2450
|
* @example
|
|
@@ -2478,7 +2493,7 @@ export declare interface DispatchActionDirectiveParams {
|
|
|
2478
2493
|
/**
|
|
2479
2494
|
* 会话消息关联的卡片实例 ID。
|
|
2480
2495
|
*
|
|
2481
|
-
* 在卡片环境可通过 `getWidgetInstanceId`
|
|
2496
|
+
* 在卡片环境可通过 `getWidgetInstanceId` 获取;在应用插件页面等非卡片环境需要通过传参或通信传递。
|
|
2482
2497
|
*/
|
|
2483
2498
|
widgetInstanceId: string;
|
|
2484
2499
|
/** 动作类型,参见 {@link ActionDirectiveType}。 */
|
|
@@ -2508,15 +2523,15 @@ export declare interface DispatchActionDirectiveParams {
|
|
|
2508
2523
|
}
|
|
2509
2524
|
|
|
2510
2525
|
/**
|
|
2511
|
-
*
|
|
2526
|
+
* 应用插件账号信息。
|
|
2512
2527
|
*
|
|
2513
2528
|
* @public
|
|
2514
2529
|
*/
|
|
2515
2530
|
export declare interface DoubaoAppAccountInfo {
|
|
2516
|
-
/**
|
|
2531
|
+
/** 应用插件 appId */
|
|
2517
2532
|
appId: string;
|
|
2518
2533
|
/**
|
|
2519
|
-
*
|
|
2534
|
+
* 当前应用插件的版本类型。
|
|
2520
2535
|
*
|
|
2521
2536
|
* - develop:开发版
|
|
2522
2537
|
* - trial:体验版
|
|
@@ -2526,7 +2541,7 @@ export declare interface DoubaoAppAccountInfo {
|
|
|
2526
2541
|
*/
|
|
2527
2542
|
envVersion: 'develop' | 'trial' | 'release';
|
|
2528
2543
|
/**
|
|
2529
|
-
*
|
|
2544
|
+
* 应用插件版本号。
|
|
2530
2545
|
*
|
|
2531
2546
|
*/
|
|
2532
2547
|
version: string;
|
|
@@ -2580,7 +2595,7 @@ export declare interface DoubaoAppAccountInfo {
|
|
|
2580
2595
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
2581
2596
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
2582
2597
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
2583
|
-
* @precondition All | 下载地址需通过豆包配置的下载域名白名单校验,单个文件不得超过 200 MB
|
|
2598
|
+
* @precondition All | 下载地址需通过豆包配置的下载域名白名单校验,单个文件不得超过 200 MB,单个应用插件同时最多执行 10 个下载任务;指定 filePath 时仅支持临时目录或用户目录。
|
|
2584
2599
|
* @usageNote All | 未指定 filePath 时文件写入临时目录,并通过 Promise resolve 结果的 tempFilePath 返回;临时文件的生命周期由豆包客户端管理。
|
|
2585
2600
|
* @usageNote All | 不跟随 HTTP 重定向,3xx 响应使 Promise reject;4xx、5xx 响应在文件写入成功后仍使 Promise resolve。
|
|
2586
2601
|
* @resultExample
|
|
@@ -2739,7 +2754,7 @@ export declare interface DypayParams {
|
|
|
2739
2754
|
|
|
2740
2755
|
/**
|
|
2741
2756
|
* 开启页面返回前提醒。
|
|
2742
|
-
*
|
|
2757
|
+
* 当用户在应用插件的非最底层页面点击左上角返回按钮、左上角首页按钮或客户端返回键时,弹起询问弹窗
|
|
2743
2758
|
*
|
|
2744
2759
|
* 返回询问对话框只会对调用的当前页面生效,通过手势滑动返回时不会弹起询问对话框
|
|
2745
2760
|
*
|
|
@@ -2832,13 +2847,13 @@ export declare const enableUserScreenRecord: (params?: {} | undefined) => Promis
|
|
|
2832
2847
|
* @since 0.0.20
|
|
2833
2848
|
* @containerSupport Page | supported
|
|
2834
2849
|
* @containerSupport Widget | unsupported
|
|
2835
|
-
* @platformSupport Android | supported |
|
|
2836
|
-
* @platformSupport iOS | supported |
|
|
2850
|
+
* @platformSupport Android | supported | 支持退出当前应用插件的全部页面。
|
|
2851
|
+
* @platformSupport iOS | supported | 支持退出当前应用插件的全部页面。
|
|
2837
2852
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
2838
2853
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
2839
2854
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
2840
2855
|
* @precondition All | 无额外前置条件
|
|
2841
|
-
* @usageNote All | 会退出当前所有页面;当 navigateBack 已无法继续返回时,使用 exitApp
|
|
2856
|
+
* @usageNote All | 会退出当前所有页面;当 navigateBack 已无法继续返回时,使用 exitApp 退出应用插件。
|
|
2842
2857
|
* @errorCode common | 102 | Android,iOS
|
|
2843
2858
|
*
|
|
2844
2859
|
* @public
|
|
@@ -2853,7 +2868,7 @@ export declare const exitApp: () => Promise<object>;
|
|
|
2853
2868
|
* @remarks
|
|
2854
2869
|
* 用于将状态已经过期的 Widget 实例转换为固定卡片,用户点击后可跳转到指定页面。
|
|
2855
2870
|
*
|
|
2856
|
-
* `getWidgetInstanceId`
|
|
2871
|
+
* `getWidgetInstanceId` 仅在卡片环境中有效,在应用插件页面中会返回 `undefined`。如果需要在页面中调用,
|
|
2857
2872
|
* 请在 `navigateTo` 时通过参数传递卡片实例 ID。
|
|
2858
2873
|
*
|
|
2859
2874
|
* @example
|
|
@@ -2893,11 +2908,11 @@ export declare interface ExpiredWidgetParams {
|
|
|
2893
2908
|
/**
|
|
2894
2909
|
* 卡片实例 ID。
|
|
2895
2910
|
*
|
|
2896
|
-
* 在卡片环境可通过 `getWidgetInstanceId`
|
|
2911
|
+
* 在卡片环境可通过 `getWidgetInstanceId` 获取;在应用插件页面等非卡片环境需要通过传参或通信传递。
|
|
2897
2912
|
*/
|
|
2898
2913
|
widgetInstanceId: string;
|
|
2899
2914
|
/**
|
|
2900
|
-
* 点击失效卡要跳转的页面 URL 或 sslocal schema
|
|
2915
|
+
* 点击失效卡要跳转的页面 URL 或 sslocal schema。应用插件页面 URL 格式与 navigateTo 的 url 参数一致。
|
|
2901
2916
|
*
|
|
2902
2917
|
* @default -
|
|
2903
2918
|
*/
|
|
@@ -3014,8 +3029,8 @@ export declare interface FileSystemManager {
|
|
|
3014
3029
|
* @since 0.0.18
|
|
3015
3030
|
* @containerSupport Page | supported
|
|
3016
3031
|
* @containerSupport Widget | supported
|
|
3017
|
-
* @platformSupport Android | supported |
|
|
3018
|
-
* @platformSupport iOS | supported |
|
|
3032
|
+
* @platformSupport Android | supported | 支持获取当前应用插件账号信息。
|
|
3033
|
+
* @platformSupport iOS | supported | 支持获取当前应用插件账号信息。
|
|
3019
3034
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
3020
3035
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
3021
3036
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -3042,7 +3057,7 @@ export declare function getAccountInfo(params?: {}): Promise<GetAccountInfoResul
|
|
|
3042
3057
|
* @public
|
|
3043
3058
|
*/
|
|
3044
3059
|
export declare interface GetAccountInfoResult {
|
|
3045
|
-
/**
|
|
3060
|
+
/** 应用插件账号信息 */
|
|
3046
3061
|
miniProgram: DoubaoAppAccountInfo;
|
|
3047
3062
|
/** 插件账号信息(仅在插件中调用时包含) */
|
|
3048
3063
|
plugin?: PluginAccountInfo;
|
|
@@ -3063,8 +3078,8 @@ export declare interface GetAccountInfoResult {
|
|
|
3063
3078
|
* @since 0.0.18
|
|
3064
3079
|
* @containerSupport Page | supported
|
|
3065
3080
|
* @containerSupport Widget | supported
|
|
3066
|
-
* @platformSupport Android | supported |
|
|
3067
|
-
* @platformSupport iOS | supported |
|
|
3081
|
+
* @platformSupport Android | supported | 支持同步获取当前应用插件账号信息。
|
|
3082
|
+
* @platformSupport iOS | supported | 支持同步获取当前应用插件账号信息。
|
|
3068
3083
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
3069
3084
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
3070
3085
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -3115,7 +3130,7 @@ export declare function getAccountInfoSync(params?: {}): GetAccountInfoResult;
|
|
|
3115
3130
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
3116
3131
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
3117
3132
|
* @precondition All | 无额外前置条件
|
|
3118
|
-
* @usageNote All |
|
|
3133
|
+
* @usageNote All | 本接口查询豆包客户端的系统权限,不等同于查询当前应用插件的 scope 授权。
|
|
3119
3134
|
* @usageNote iOS | SDK 首次完成通知设置异步预热前,或应用重新激活后的刷新尚未完成时,四个通知字段可能仍为旧值或 not determined。
|
|
3120
3135
|
* @usageNote iOS | healthDataAuthorizationDetail 使用异步缓存;首次预热或应用重新激活刷新完成前可能返回 UNKNOWN。Apple 不公开精确读取授权,DENIED/GRANTED 为轻量查询推断。
|
|
3121
3136
|
* @resultExample
|
|
@@ -3389,7 +3404,7 @@ export declare const getAppBaseInfoSync: (_params?: {}) => GetAppBaseInfoResult;
|
|
|
3389
3404
|
* @errorCode event.errCode | -1002 | background audio play failed | Android | 播放器启动失败 | 检查资源地址和网络状态后重试。
|
|
3390
3405
|
* @errorCode event.errCode | -1003 | background audio seek failed | Android,iOS | 播放位置跳转失败 | 等待 canplay 后在音频时长范围内重试。
|
|
3391
3406
|
* @errorCode event.errCode | -1004 | background audio player unavailable | Android,iOS | 播放器无法创建或已经不可用 | 重新设置 src 后重试。
|
|
3392
|
-
* @errorCode event.errCode | -1005 | background audio is occupied by another applet | Android,iOS |
|
|
3407
|
+
* @errorCode event.errCode | -1005 | background audio is occupied by another applet | Android,iOS | 另一应用插件正在占用背景音频 | 提示用户结束其他背景音频后重试。
|
|
3393
3408
|
* @platformNote iOS | 部分系统播放器错误会在 onError 中返回系统错误码和错误信息,请为未识别的 errCode 提供兜底处理。
|
|
3394
3409
|
* @knownIssue All | 背景音频管理器是全局单例;后一次调用获取到的是同一实例和同一组播放状态。
|
|
3395
3410
|
*
|
|
@@ -4328,7 +4343,7 @@ export declare function getFileSystemManager(): FileSystemManager;
|
|
|
4328
4343
|
* @platformSupport PC | unsupported | 暂不支持
|
|
4329
4344
|
* @platformSupport HarmonyOS | unsupported | 暂不支持
|
|
4330
4345
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
4331
|
-
* @precondition All | src
|
|
4346
|
+
* @precondition All | src 为豆包应用插件可访问的本地图片路径,或可直接下载的 HTTP、HTTPS 图片地址。
|
|
4332
4347
|
* @usageNote All | 网络图片会产生下载流量;如需重复读取,建议先下载为本地临时文件。
|
|
4333
4348
|
* @resultExample
|
|
4334
4349
|
* ```json
|
|
@@ -4832,7 +4847,7 @@ export declare interface GetPackageInfoResult {
|
|
|
4832
4847
|
export declare const getPackageInfoSync: () => GetPackageInfoResult;
|
|
4833
4848
|
|
|
4834
4849
|
/**
|
|
4835
|
-
*
|
|
4850
|
+
* 获取当前应用插件的性能数据。
|
|
4836
4851
|
*
|
|
4837
4852
|
* Entry 由客户端保存;`getEntries*()` 同步查询当前快照,observer 只接收新完成的 Entry。
|
|
4838
4853
|
*
|
|
@@ -5097,7 +5112,7 @@ export declare interface GetScreenBrightnessResult {
|
|
|
5097
5112
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
5098
5113
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
5099
5114
|
* @precondition All | 无额外前置条件
|
|
5100
|
-
* @usageNote All | authSetting
|
|
5115
|
+
* @usageNote All | authSetting 只表示当前应用插件的 scope 授权,不表示操作系统权限;HealthKit 逐类型系统状态通过 getAppAuthorizeSetting 查询。
|
|
5101
5116
|
* @usageNote All | authSetting 只包含已向用户请求过且状态明确的权限;豆包当前不支持订阅模板,不要传入 withSubscriptions: true。
|
|
5102
5117
|
* @resultExample
|
|
5103
5118
|
* ```json
|
|
@@ -5117,7 +5132,7 @@ export declare interface GetScreenBrightnessResult {
|
|
|
5117
5132
|
* ```
|
|
5118
5133
|
* @errorCode common | 102 | Android,iOS
|
|
5119
5134
|
* @errorCode errNo | 103 | feature not support | Android,iOS | 传入 withSubscriptions: true,豆包当前不支持订阅消息模板 | 不要传入 withSubscriptions: true,仅使用默认的 false
|
|
5120
|
-
* @errorCode errNo | 116 | resource not found | Android |
|
|
5135
|
+
* @errorCode errNo | 116 | resource not found | Android | 豆包未找到当前应用插件 | 确认当前应用插件已正确安装后重试
|
|
5121
5136
|
* @platformNote iOS | iOS 不返回 errNo 116(resource not found),相应失败场景统一以 errNo 102(internal error)返回。
|
|
5122
5137
|
*
|
|
5123
5138
|
* @public
|
|
@@ -5162,8 +5177,8 @@ export declare interface GetSettingResult {
|
|
|
5162
5177
|
* @since 0.0.17
|
|
5163
5178
|
* @containerSupport Page | supported
|
|
5164
5179
|
* @containerSupport Widget | supported
|
|
5165
|
-
* @platformSupport Android | supported |
|
|
5166
|
-
* @platformSupport iOS | supported |
|
|
5180
|
+
* @platformSupport Android | supported | 支持按应用插件维度读取本地缓存。
|
|
5181
|
+
* @platformSupport iOS | supported | 支持按应用插件维度读取本地缓存。
|
|
5167
5182
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
5168
5183
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
5169
5184
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -5209,8 +5224,8 @@ export declare function getStorage<TData = unknown>(params: GetStorageParams): P
|
|
|
5209
5224
|
* @since 0.0.17
|
|
5210
5225
|
* @containerSupport Page | supported
|
|
5211
5226
|
* @containerSupport Widget | supported
|
|
5212
|
-
* @platformSupport Android | supported |
|
|
5213
|
-
* @platformSupport iOS | supported |
|
|
5227
|
+
* @platformSupport Android | supported | 支持查询当前应用插件的本地缓存信息。
|
|
5228
|
+
* @platformSupport iOS | supported | 支持查询当前应用插件的本地缓存信息。
|
|
5214
5229
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
5215
5230
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
5216
5231
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -5256,8 +5271,8 @@ export declare interface GetStorageInfoResult {
|
|
|
5256
5271
|
* @since 0.0.19
|
|
5257
5272
|
* @containerSupport Page | supported
|
|
5258
5273
|
* @containerSupport Widget | supported
|
|
5259
|
-
* @platformSupport Android | supported |
|
|
5260
|
-
* @platformSupport iOS | supported |
|
|
5274
|
+
* @platformSupport Android | supported | 支持同步查询当前应用插件的本地缓存信息。
|
|
5275
|
+
* @platformSupport iOS | supported | 支持同步查询当前应用插件的本地缓存信息。
|
|
5261
5276
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
5262
5277
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
5263
5278
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -5308,8 +5323,8 @@ export declare interface GetStorageResult<TData = unknown> {
|
|
|
5308
5323
|
* @since 0.0.19
|
|
5309
5324
|
* @containerSupport Page | supported
|
|
5310
5325
|
* @containerSupport Widget | supported
|
|
5311
|
-
* @platformSupport Android | supported |
|
|
5312
|
-
* @platformSupport iOS | supported |
|
|
5326
|
+
* @platformSupport Android | supported | 支持按应用插件维度同步读取本地缓存。
|
|
5327
|
+
* @platformSupport iOS | supported | 支持按应用插件维度同步读取本地缓存。
|
|
5313
5328
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
5314
5329
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
5315
5330
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -5555,6 +5570,55 @@ export declare interface GetSystemSettingResult {
|
|
|
5555
5570
|
deviceOrientation: DeviceOrientation;
|
|
5556
5571
|
}
|
|
5557
5572
|
|
|
5573
|
+
/**
|
|
5574
|
+
* 获取当前用户的加密设备标识,参数可省略或传入空对象。
|
|
5575
|
+
*
|
|
5576
|
+
* @returns 包含 edid 的标识对象。
|
|
5577
|
+
* @example
|
|
5578
|
+
* ```typescript
|
|
5579
|
+
* import { getUserIdentifiers } from '@doubao-dev/framework/api';
|
|
5580
|
+
* const { edid } = await getUserIdentifiers({});
|
|
5581
|
+
* ```
|
|
5582
|
+
*
|
|
5583
|
+
* @doc internal
|
|
5584
|
+
* @since 0.5.0
|
|
5585
|
+
* @platformSupport Android | supported | -
|
|
5586
|
+
* @platformSupport iOS | supported | -
|
|
5587
|
+
* @platformSupport PC | unsupported | 未实现
|
|
5588
|
+
* @platformSupport HarmonyOS | unsupported | 未实现
|
|
5589
|
+
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
5590
|
+
* @precondition All | 用户已登录且标识服务可用。
|
|
5591
|
+
* @usageNote All | 同一用户、设备和应用插件的成功结果在进程内缓存。
|
|
5592
|
+
* @resultExample
|
|
5593
|
+
* ```json
|
|
5594
|
+
* { "edid": "example-encrypted-identifier" }
|
|
5595
|
+
* ```
|
|
5596
|
+
* @errorExample
|
|
5597
|
+
* ```json
|
|
5598
|
+
* { "errNo": 303, "errMsg": "no network connection" }
|
|
5599
|
+
* ```
|
|
5600
|
+
* @errorCode common | 102 | Android,iOS
|
|
5601
|
+
* @errorCode common | 103 | Android,iOS
|
|
5602
|
+
* @errorCode common | 104 | Android,iOS
|
|
5603
|
+
* @errorCode common | 105 | Android,iOS
|
|
5604
|
+
* @errorCode common | 112 | Android,iOS
|
|
5605
|
+
* @errorCode errNo | 302 | connection timed out | Android,iOS | 请求超时 | 稍后重试
|
|
5606
|
+
* @errorCode errNo | 303 | no network connection | Android,iOS | 无网络连接 | 联网后重试
|
|
5607
|
+
* @errorCode errNo | 305 | network failure | Android,iOS | 请求失败 | 检查网络和服务后重试
|
|
5608
|
+
*
|
|
5609
|
+
* @public
|
|
5610
|
+
*/
|
|
5611
|
+
export declare const getUserIdentifiers: (params?: {} | undefined) => Promise<GetUserIdentifiersResult>;
|
|
5612
|
+
|
|
5613
|
+
/**
|
|
5614
|
+
* @doc internal
|
|
5615
|
+
* @public
|
|
5616
|
+
*/
|
|
5617
|
+
export declare interface GetUserIdentifiersResult {
|
|
5618
|
+
/** 用户加密设备标识,成功时非空。 */
|
|
5619
|
+
edid: string;
|
|
5620
|
+
}
|
|
5621
|
+
|
|
5558
5622
|
/**
|
|
5559
5623
|
* 获取 Wi-Fi 列表。
|
|
5560
5624
|
*
|
|
@@ -5917,7 +5981,7 @@ export { ImageOrientation_2 as ImageOrientation }
|
|
|
5917
5981
|
* @public
|
|
5918
5982
|
*/
|
|
5919
5983
|
export declare interface InnerAudioContext {
|
|
5920
|
-
/** 音频资源地址,支持 HTTP、HTTPS
|
|
5984
|
+
/** 音频资源地址,支持 HTTP、HTTPS 地址和豆包应用插件本地文件路径。 */
|
|
5921
5985
|
src: string;
|
|
5922
5986
|
/** 开始播放的位置,单位秒,默认为 0。 */
|
|
5923
5987
|
startTime: number;
|
|
@@ -6073,7 +6137,7 @@ export declare interface JumpSchemaData {
|
|
|
6073
6137
|
*/
|
|
6074
6138
|
path?: string;
|
|
6075
6139
|
/**
|
|
6076
|
-
*
|
|
6140
|
+
* 页面参数,应用插件内消费时会自动 base64 url encode,需要 decode。
|
|
6077
6141
|
*
|
|
6078
6142
|
* @default -
|
|
6079
6143
|
*/
|
|
@@ -6082,7 +6146,7 @@ export declare interface JumpSchemaData {
|
|
|
6082
6146
|
|
|
6083
6147
|
/** @public */
|
|
6084
6148
|
export declare interface KeyboardHeightChangeEvent {
|
|
6085
|
-
/**
|
|
6149
|
+
/** 键盘高度,Android SDK 0.5.0 起单位为 dp,此前为 px;iOS 单位为 pt(points)。 */
|
|
6086
6150
|
height: number;
|
|
6087
6151
|
}
|
|
6088
6152
|
|
|
@@ -6169,7 +6233,7 @@ export declare type LocationOperationResult = Record<string, never>;
|
|
|
6169
6233
|
* 换取 OpenID,并完成业务账号登录或绑定。不要在前端保存长期 Token,也不要把应用密钥下发到前端。
|
|
6170
6234
|
*
|
|
6171
6235
|
* 此 `code` 不是业务登录态、MCP AccessToken,也不是传给 `postLoginResult` 的三方短期兑换 code。
|
|
6172
|
-
*
|
|
6236
|
+
* 应用插件内的自定义登录态及其与 OpenID 的绑定关系需要由业务方维护,平台不存储三方登录态。
|
|
6173
6237
|
* 用户拒绝登录、登录失败或调用超时时,Promise 将被拒绝。
|
|
6174
6238
|
* @example
|
|
6175
6239
|
* ```typescript
|
|
@@ -6185,8 +6249,8 @@ export declare type LocationOperationResult = Record<string, never>;
|
|
|
6185
6249
|
* @since 0.0.19
|
|
6186
6250
|
* @containerSupport Page | supported
|
|
6187
6251
|
* @containerSupport Widget | supported
|
|
6188
|
-
* @platformSupport Android | supported |
|
|
6189
|
-
* @platformSupport iOS | supported |
|
|
6252
|
+
* @platformSupport Android | supported | 支持获取当前应用插件的一次性登录凭证。
|
|
6253
|
+
* @platformSupport iOS | supported | 支持获取当前应用插件的一次性登录凭证。
|
|
6190
6254
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
6191
6255
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
6192
6256
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -6279,7 +6343,7 @@ export declare const LoginType: {
|
|
|
6279
6343
|
* @returns 返回所选平台交互是否成功完成。
|
|
6280
6344
|
* @remarks
|
|
6281
6345
|
* 此 API 只处理 `loginType` 对应的平台交互,不会返回 `login()` 的一次性 `login_code`,
|
|
6282
|
-
*
|
|
6346
|
+
* 也不会替业务方创建应用插件登录态或完成 MCP Token 交换。
|
|
6283
6347
|
*
|
|
6284
6348
|
* 业务方仍需按实际场景完成服务端账号登录;MCP 授权登录还需在业务服务端生成三方短期兑换 code,
|
|
6285
6349
|
* 并通过 `postLoginResult` 回传最终登录结果。
|
|
@@ -6521,7 +6585,7 @@ export declare interface MkdirParams {
|
|
|
6521
6585
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
6522
6586
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
6523
6587
|
* @precondition All | 无额外前置条件
|
|
6524
|
-
* @usageNote All | navigateBack
|
|
6588
|
+
* @usageNote All | navigateBack 只能在页面栈内返回;当前页面已是页面栈中的最后一个页面时无法继续返回,需要退出应用插件请调用 exitApp。
|
|
6525
6589
|
* @errorCode common | 102 | Android,iOS
|
|
6526
6590
|
*
|
|
6527
6591
|
* @public
|
|
@@ -6553,13 +6617,13 @@ export declare interface NavigateBackParams {
|
|
|
6553
6617
|
* @since 0.0.19
|
|
6554
6618
|
* @containerSupport Page | supported
|
|
6555
6619
|
* @containerSupport Widget | supported
|
|
6556
|
-
* @platformSupport Android | supported |
|
|
6557
|
-
* @platformSupport iOS | supported |
|
|
6620
|
+
* @platformSupport Android | supported | 支持在当前应用插件内跳转到指定页面。
|
|
6621
|
+
* @platformSupport iOS | supported | 支持在当前应用插件内跳转到指定页面。
|
|
6558
6622
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
6559
6623
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
6560
6624
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
6561
6625
|
* @precondition All | 无额外前置条件
|
|
6562
|
-
* @usageNote All | url
|
|
6626
|
+
* @usageNote All | url 为应用插件内的页面路径,可携带查询参数;跳转后当前页面会保留在页面栈中,可通过 navigateBack 返回。
|
|
6563
6627
|
* @errorExample
|
|
6564
6628
|
* ```json
|
|
6565
6629
|
* {
|
|
@@ -6568,7 +6632,7 @@ export declare interface NavigateBackParams {
|
|
|
6568
6632
|
* }
|
|
6569
6633
|
* ```
|
|
6570
6634
|
* @errorCode common | 102 | Android,iOS
|
|
6571
|
-
* @errorCode errNo | 104 | invalid url | Android,iOS | url
|
|
6635
|
+
* @errorCode errNo | 104 | invalid url | Android,iOS | url 为空或无法解析为有效的应用插件页面路径 | 检查 url 是否为合法的应用内页面路径后重试。
|
|
6572
6636
|
*
|
|
6573
6637
|
* @public
|
|
6574
6638
|
*/
|
|
@@ -7119,8 +7183,8 @@ export declare const onGyroscopeChange: ClientEventRegistry<GyroscopeChangeEvent
|
|
|
7119
7183
|
* }
|
|
7120
7184
|
* ```
|
|
7121
7185
|
* @errorCode none | - | - | Android,iOS | 事件无错误码 | 无需处理
|
|
7122
|
-
* @platformNote Android |
|
|
7123
|
-
* @platformNote iOS |
|
|
7186
|
+
* @platformNote Android | Android SDK 0.5.0 起高度单位为 dp(密度无关像素),此前版本为 px(物理像素)。
|
|
7187
|
+
* @platformNote iOS | 高度单位为 pt(points)。
|
|
7124
7188
|
*
|
|
7125
7189
|
* @public
|
|
7126
7190
|
*/
|
|
@@ -7575,7 +7639,7 @@ export declare const openPage: (params: OpenPageParams) => Promise<object>;
|
|
|
7575
7639
|
/**
|
|
7576
7640
|
* 在当前关联的主对话流中以半屏形式打开应用内页面。
|
|
7577
7641
|
*
|
|
7578
|
-
*
|
|
7642
|
+
* 调用后不会创建或操作全页页面栈。需要进入全页应用插件或操作已有页面栈时,请使用 {@link openPage}。
|
|
7579
7643
|
*
|
|
7580
7644
|
* @param params 打开页面参数,字段见 {@link OpenPageInChatParams}。
|
|
7581
7645
|
* @returns 无返回字段。
|
|
@@ -7597,7 +7661,7 @@ export declare const openPage: (params: OpenPageParams) => Promise<object>;
|
|
|
7597
7661
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
7598
7662
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
7599
7663
|
* @precondition All | 当前应用需要关联主对话流
|
|
7600
|
-
* @usageNote All | 不接受页面栈 mode
|
|
7664
|
+
* @usageNote All | 不接受页面栈 mode;需要进入应用插件全页或操作已有页面栈时使用 openPage。
|
|
7601
7665
|
* @errorCode none | - | - | Android,iOS | 无 API 专属错误码 | 无需处理
|
|
7602
7666
|
*
|
|
7603
7667
|
* @doc internal
|
|
@@ -7636,7 +7700,7 @@ export declare interface OpenPageParams {
|
|
|
7636
7700
|
}
|
|
7637
7701
|
|
|
7638
7702
|
/**
|
|
7639
|
-
*
|
|
7703
|
+
* 打开应用插件授权设置页面
|
|
7640
7704
|
*
|
|
7641
7705
|
* @param params - 打开设置页参数
|
|
7642
7706
|
* @param params.withSubscriptions - 是否同时获取用户订阅消息的订阅状态
|
|
@@ -7665,7 +7729,7 @@ export declare interface OpenPageParams {
|
|
|
7665
7729
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
7666
7730
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
7667
7731
|
* @precondition All | 无额外前置条件,不要求在用户点击事件中调用。
|
|
7668
|
-
* @usageNote All |
|
|
7732
|
+
* @usageNote All | 设置页只能修改当前应用插件的 scope,不承载 HealthKit 系统权限设置。
|
|
7669
7733
|
* @usageNote All | 豆包当前不支持订阅模板,不要传入 withSubscriptions: true。
|
|
7670
7734
|
* @resultExample
|
|
7671
7735
|
* ```json
|
|
@@ -7709,7 +7773,7 @@ declare interface Performance_2 {
|
|
|
7709
7773
|
createObserver: (callback: PerformanceObserverCallback_2) => PerformanceObserver_2;
|
|
7710
7774
|
/** 设置客户端最多保留的性能 Entry 数量。 */
|
|
7711
7775
|
setBufferSize: (size: number) => void;
|
|
7712
|
-
/**
|
|
7776
|
+
/** 返回当前应用插件已记录的全部性能 Entry。 */
|
|
7713
7777
|
getEntries: () => PerformanceEntry_2[];
|
|
7714
7778
|
/** 返回指定 entryType 的性能 Entry。 */
|
|
7715
7779
|
getEntriesByType: (entryType: string) => PerformanceEntry_2[];
|
|
@@ -7904,8 +7968,8 @@ export declare interface PostLoginResultRequest {
|
|
|
7904
7968
|
* @since 0.0.26
|
|
7905
7969
|
* @containerSupport Page | supported
|
|
7906
7970
|
* @containerSupport Widget | supported
|
|
7907
|
-
* @platformSupport Android | supported |
|
|
7908
|
-
* @platformSupport iOS | supported |
|
|
7971
|
+
* @platformSupport Android | supported | 支持预览网络图片和豆包应用插件本地图片
|
|
7972
|
+
* @platformSupport iOS | supported | 支持预览网络图片和豆包应用插件本地图片
|
|
7909
7973
|
* @platformSupport PC | unsupported | 暂不支持
|
|
7910
7974
|
* @platformSupport HarmonyOS | unsupported | 暂不支持
|
|
7911
7975
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -8272,7 +8336,7 @@ export declare type RecorderSampleRate = 8000 | 11025 | 12000 | 16000 | 22050 |
|
|
|
8272
8336
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
8273
8337
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
8274
8338
|
* @precondition All | 无额外前置条件
|
|
8275
|
-
* @usageNote All | url
|
|
8339
|
+
* @usageNote All | url 为应用插件内的页面路径,可携带查询参数;跳转会替换当前页面,不保留在页面栈中。
|
|
8276
8340
|
* @errorExample
|
|
8277
8341
|
* ```json
|
|
8278
8342
|
* {
|
|
@@ -8281,7 +8345,7 @@ export declare type RecorderSampleRate = 8000 | 11025 | 12000 | 16000 | 22050 |
|
|
|
8281
8345
|
* }
|
|
8282
8346
|
* ```
|
|
8283
8347
|
* @errorCode common | 102 | Android,iOS
|
|
8284
|
-
* @errorCode errNo | 104 | invalid url | Android,iOS | url
|
|
8348
|
+
* @errorCode errNo | 104 | invalid url | Android,iOS | url 为空或无法解析为有效的应用插件页面路径 | 检查 url 是否为合法的应用内页面路径后重试。
|
|
8285
8349
|
*
|
|
8286
8350
|
* @public
|
|
8287
8351
|
*/
|
|
@@ -8308,7 +8372,7 @@ export declare const redirectTo: (params: NavigateToParams) => Promise<object>;
|
|
|
8308
8372
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
8309
8373
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
8310
8374
|
* @precondition All | 无额外前置条件
|
|
8311
|
-
* @usageNote All | url
|
|
8375
|
+
* @usageNote All | url 为应用插件内的页面路径,可携带查询参数;跳转会关闭现有全部页面并以目标页面作为唯一页面。
|
|
8312
8376
|
* @errorExample
|
|
8313
8377
|
* ```json
|
|
8314
8378
|
* {
|
|
@@ -8317,7 +8381,7 @@ export declare const redirectTo: (params: NavigateToParams) => Promise<object>;
|
|
|
8317
8381
|
* }
|
|
8318
8382
|
* ```
|
|
8319
8383
|
* @errorCode common | 102 | Android,iOS
|
|
8320
|
-
* @errorCode errNo | 104 | invalid url | Android,iOS | url
|
|
8384
|
+
* @errorCode errNo | 104 | invalid url | Android,iOS | url 为空或无法解析为有效的应用插件页面路径 | 检查 url 是否为合法的应用内页面路径后重试。
|
|
8321
8385
|
*
|
|
8322
8386
|
* @public
|
|
8323
8387
|
*/
|
|
@@ -8384,8 +8448,8 @@ export declare interface RemoveSavedFileParams {
|
|
|
8384
8448
|
* @since 0.0.17
|
|
8385
8449
|
* @containerSupport Page | supported
|
|
8386
8450
|
* @containerSupport Widget | supported
|
|
8387
|
-
* @platformSupport Android | supported |
|
|
8388
|
-
* @platformSupport iOS | supported |
|
|
8451
|
+
* @platformSupport Android | supported | 支持按应用插件维度删除指定 key。
|
|
8452
|
+
* @platformSupport iOS | supported | 支持按应用插件维度删除指定 key。
|
|
8389
8453
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
8390
8454
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
8391
8455
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -8427,8 +8491,8 @@ export declare interface RemoveStorageParams {
|
|
|
8427
8491
|
* @since 0.0.19
|
|
8428
8492
|
* @containerSupport Page | supported
|
|
8429
8493
|
* @containerSupport Widget | supported
|
|
8430
|
-
* @platformSupport Android | supported |
|
|
8431
|
-
* @platformSupport iOS | supported |
|
|
8494
|
+
* @platformSupport Android | supported | 支持按应用插件维度同步删除指定 key。
|
|
8495
|
+
* @platformSupport iOS | supported | 支持按应用插件维度同步删除指定 key。
|
|
8432
8496
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
8433
8497
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
8434
8498
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -8490,8 +8554,8 @@ export declare interface RenameParams {
|
|
|
8490
8554
|
* @since 0.0.28
|
|
8491
8555
|
* @containerSupport Page | supported
|
|
8492
8556
|
* @containerSupport Widget | supported
|
|
8493
|
-
* @platformSupport Android | supported |
|
|
8494
|
-
* @platformSupport iOS | supported |
|
|
8557
|
+
* @platformSupport Android | supported | 支持上报应用插件数据分析事件。
|
|
8558
|
+
* @platformSupport iOS | supported | 支持上报应用插件数据分析事件。
|
|
8495
8559
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
8496
8560
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
8497
8561
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
@@ -8570,7 +8634,7 @@ export declare interface ReportEventParams {
|
|
|
8570
8634
|
* ```
|
|
8571
8635
|
* @errorCode common | 102 | iOS
|
|
8572
8636
|
* @errorCode errNo | 104 | invalid parameter | Android,iOS | url 为空、method 非法,或请求参数、请求体校验失败 | 修正 url、method 与请求参数后重试。
|
|
8573
|
-
* @errorCode errNo | 110 | API call prohibited | Android,iOS | 请求 URL 未通过域名白名单校验 |
|
|
8637
|
+
* @errorCode errNo | 110 | API call prohibited | Android,iOS | 请求 URL 未通过域名白名单校验 | 确认目标域名已在应用插件中配置后重试。
|
|
8574
8638
|
* @errorCode errNo | 301 | network request cancelled | iOS | 网络请求被取消 | 确认应用与网络状态后重试。
|
|
8575
8639
|
* @errorCode errNo | 302 | connection timed out | Android,iOS | 网络连接超时 | 检查网络连接后重试。
|
|
8576
8640
|
* @errorCode errNo | 303 | no network connection | Android,iOS | 当前无可用网络连接 | 恢复网络连接后重试。
|
|
@@ -8809,7 +8873,7 @@ export declare interface SaveFileResult {
|
|
|
8809
8873
|
* @permission system | 相册写入权限 | conditional | Android,iOS | 系统版本要求相册或外部存储写入授权时需要授予
|
|
8810
8874
|
* @authorizationBehavior Android | API 不主动展示应用授权弹窗。系统版本要求外部存储写入权限且权限未授予时,保存会失败;请引导用户在系统设置中开启后重试。
|
|
8811
8875
|
* @authorizationBehavior iOS | 首次写入系统相册时由系统请求相册写入权限。用户拒绝或撤销后保存失败;请引导用户在系统设置中开启后重试。
|
|
8812
|
-
* @precondition All |
|
|
8876
|
+
* @precondition All | 传入豆包应用插件可访问、存在且可解码的本地图片路径。
|
|
8813
8877
|
* @resultExample
|
|
8814
8878
|
* ```json
|
|
8815
8879
|
* {}
|
|
@@ -8950,7 +9014,7 @@ export declare type SelectedMessageFileType = 'video' | 'image' | 'file';
|
|
|
8950
9014
|
* @param params - 要发送的后续消息内容。
|
|
8951
9015
|
* @returns 返回一个 Promise,在消息发送请求提交后解析。
|
|
8952
9016
|
* @remarks
|
|
8953
|
-
*
|
|
9017
|
+
* 可在卡片或应用插件页面中调用,不支持在 app.ts 代码中调用。客户端会根据调用上下文关联会话:
|
|
8954
9018
|
* 卡片使用其所在会话,从卡片打开的页面沿用该会话,其他页面使用主会话。
|
|
8955
9019
|
*
|
|
8956
9020
|
* @example
|
|
@@ -8981,13 +9045,13 @@ export declare type SelectedMessageFileType = 'video' | 'image' | 'file';
|
|
|
8981
9045
|
* @since 0.0.37
|
|
8982
9046
|
* @containerSupport Page | supported
|
|
8983
9047
|
* @containerSupport Widget | supported
|
|
8984
|
-
* @platformSupport Android | supported |
|
|
8985
|
-
* @platformSupport iOS | supported |
|
|
9048
|
+
* @platformSupport Android | supported | 支持在卡片或应用插件页面中发送后续消息。
|
|
9049
|
+
* @platformSupport iOS | supported | 支持在卡片和应用插件页面中发送后续消息。
|
|
8986
9050
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
8987
9051
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
8988
9052
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
8989
|
-
* @precondition Android |
|
|
8990
|
-
* @precondition iOS |
|
|
9053
|
+
* @precondition Android | 在卡片或应用插件页面中调用。
|
|
9054
|
+
* @precondition iOS | 在卡片或应用插件页面中调用,且当前上下文已关联有效会话。
|
|
8991
9055
|
* @usageNote All | Promise 解析表示发送请求已提交,不表示消息已成功送达;实际发送失败不会通过该 Promise 返回。
|
|
8992
9056
|
* @errorCode none | - | - | Android,iOS | 调用失败时未稳定返回 API 专属错误码 | 检查 content 与调用场景后重试
|
|
8993
9057
|
*
|
|
@@ -9240,6 +9304,65 @@ export declare interface SetBLEMTUResult {
|
|
|
9240
9304
|
mtu: number;
|
|
9241
9305
|
}
|
|
9242
9306
|
|
|
9307
|
+
/**
|
|
9308
|
+
* 设置对话框展示状态。
|
|
9309
|
+
*
|
|
9310
|
+
* @param params 设置参数,字段见 {@link SetChatPanelStateParams}。
|
|
9311
|
+
* @returns 不包含字段的结果对象。
|
|
9312
|
+
* @example
|
|
9313
|
+
* ```typescript
|
|
9314
|
+
* import { setChatPanelState } from '@doubao-dev/framework/api';
|
|
9315
|
+
*
|
|
9316
|
+
* await setChatPanelState({ state: 'collapsed' });
|
|
9317
|
+
* ```
|
|
9318
|
+
*
|
|
9319
|
+
* @since 0.5.0
|
|
9320
|
+
* @containerSupport Page | supported
|
|
9321
|
+
* @containerSupport Widget | unsupported
|
|
9322
|
+
* @platformSupport Android | supported | 支持收起、展开、隐藏或将对话框切换为悬浮胶囊态。
|
|
9323
|
+
* @platformSupport iOS | supported | 支持收起、展开、隐藏或将对话框切换为悬浮胶囊态。
|
|
9324
|
+
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
9325
|
+
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
9326
|
+
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
9327
|
+
* @precondition All | 当前页面需在 app.config.ts 中声明 chat.enabled 为 true
|
|
9328
|
+
* @usageNote All | preview 是只读状态,不能作为目标状态;floating 用于将对话框切换为悬浮胶囊态;设置 invisible 后可通过 collapsed、expanded 或 floating 再次显示对话框。
|
|
9329
|
+
* @resultExample
|
|
9330
|
+
* ```json
|
|
9331
|
+
* {}
|
|
9332
|
+
* ```
|
|
9333
|
+
* @errorExample
|
|
9334
|
+
* ```json
|
|
9335
|
+
* {
|
|
9336
|
+
* "errNo": 104,
|
|
9337
|
+
* "errMsg": "invalid parameter"
|
|
9338
|
+
* }
|
|
9339
|
+
* ```
|
|
9340
|
+
* @errorCode common | 102 | Android
|
|
9341
|
+
* @errorCode errNo | 104 | invalid parameter | Android,iOS | state 不是 collapsed、expanded、invisible 或 floating | 传入受支持的目标状态后重试。
|
|
9342
|
+
* @errorCode errNo | 116 | resource not found | Android | 当前应用插件实例不存在 | 确认当前页面仍处于运行状态后重试。
|
|
9343
|
+
*
|
|
9344
|
+
* @doc internal
|
|
9345
|
+
* @public
|
|
9346
|
+
*/
|
|
9347
|
+
export declare const setChatPanelState: (params: SetChatPanelStateParams) => Promise<object>;
|
|
9348
|
+
|
|
9349
|
+
/**
|
|
9350
|
+
* 设置对话框状态的参数。
|
|
9351
|
+
*
|
|
9352
|
+
* @public
|
|
9353
|
+
*/
|
|
9354
|
+
export declare interface SetChatPanelStateParams {
|
|
9355
|
+
/**
|
|
9356
|
+
* 目标状态。
|
|
9357
|
+
*
|
|
9358
|
+
* - `collapsed`:显示对话框并完全收起面板。
|
|
9359
|
+
* - `expanded`:显示对话框并完全展开面板。
|
|
9360
|
+
* - `invisible`:隐藏对话框。
|
|
9361
|
+
* - `floating`:将对话框切换为悬浮胶囊态。
|
|
9362
|
+
*/
|
|
9363
|
+
state: ChatPanelTargetState;
|
|
9364
|
+
}
|
|
9365
|
+
|
|
9243
9366
|
/**
|
|
9244
9367
|
* 设置系统剪贴板内容。
|
|
9245
9368
|
*
|
|
@@ -9350,9 +9473,9 @@ export declare interface SetKeepScreenOnParams {
|
|
|
9350
9473
|
* @platformSupport HarmonyOS | unsupported | 暂不支持
|
|
9351
9474
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
9352
9475
|
* @precondition All | value 必须是 0 到 1 之间的有限数字
|
|
9353
|
-
* @usageNote All |
|
|
9476
|
+
* @usageNote All | 该设置仅在当前应用插件生命周期内生效,退出后自动恢复原亮度
|
|
9354
9477
|
* @platformNote Android | 使用当前宿主窗口亮度,不修改系统全局亮度
|
|
9355
|
-
* @platformNote iOS |
|
|
9478
|
+
* @platformNote iOS | 应用插件进入后台时恢复系统亮度,回到前台时重新应用设置值
|
|
9356
9479
|
* @resultExample
|
|
9357
9480
|
* ```json
|
|
9358
9481
|
* {}
|
|
@@ -9397,13 +9520,13 @@ export declare interface SetScreenBrightnessParams {
|
|
|
9397
9520
|
* @since 0.0.17
|
|
9398
9521
|
* @containerSupport Page | supported
|
|
9399
9522
|
* @containerSupport Widget | supported
|
|
9400
|
-
* @platformSupport Android | supported |
|
|
9401
|
-
* @platformSupport iOS | supported |
|
|
9523
|
+
* @platformSupport Android | supported | 支持按应用插件维度写入本地缓存。
|
|
9524
|
+
* @platformSupport iOS | supported | 支持按应用插件维度写入本地缓存。
|
|
9402
9525
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
9403
9526
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
9404
9527
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
9405
9528
|
* @precondition All | 无额外前置条件
|
|
9406
|
-
* @usageNote All |
|
|
9529
|
+
* @usageNote All | 数据按登录用户与应用插件双重隔离存储;单个 value 序列化后不超过 1MB,且全部数据总量不超过 10MB,超出会写入失败。
|
|
9407
9530
|
* @errorExample
|
|
9408
9531
|
* ```json
|
|
9409
9532
|
* {
|
|
@@ -9447,13 +9570,13 @@ export declare interface SetStorageParams<TData = unknown> {
|
|
|
9447
9570
|
* @since 0.0.19
|
|
9448
9571
|
* @containerSupport Page | supported
|
|
9449
9572
|
* @containerSupport Widget | supported
|
|
9450
|
-
* @platformSupport Android | supported |
|
|
9451
|
-
* @platformSupport iOS | supported |
|
|
9573
|
+
* @platformSupport Android | supported | 支持按应用插件维度同步写入本地缓存。
|
|
9574
|
+
* @platformSupport iOS | supported | 支持按应用插件维度同步写入本地缓存。
|
|
9452
9575
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
9453
9576
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
9454
9577
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
9455
9578
|
* @precondition All | 无额外前置条件
|
|
9456
|
-
* @usageNote All |
|
|
9579
|
+
* @usageNote All | 数据按登录用户与应用插件双重隔离存储;单个 value 序列化后不超过 1MB,且全部数据总量不超过 10MB,超出会写入失败。
|
|
9457
9580
|
* @errorExample
|
|
9458
9581
|
* ```json
|
|
9459
9582
|
* {
|
|
@@ -9618,7 +9741,7 @@ export declare interface ShowActionSheetResult {
|
|
|
9618
9741
|
* const result = await showBottomSheet({
|
|
9619
9742
|
* title: '隐私协议提示',
|
|
9620
9743
|
* content:
|
|
9621
|
-
* '<p
|
|
9744
|
+
* '<p>感谢您使用当前应用插件。</p><p><b>•</b> 详情请见<a href="https://www.doubao.com/chat/"><b>《应用插件条款》</b></a></p>',
|
|
9622
9745
|
* buttons: [
|
|
9623
9746
|
* { role: 'agreeMain', text: '同意并继续' },
|
|
9624
9747
|
* { role: 'reject', text: '暂不同意' }
|
|
@@ -11178,10 +11301,18 @@ export declare type ThemeChangeListener = (event: ThemeChangeEvent) => void;
|
|
|
11178
11301
|
* @public
|
|
11179
11302
|
*/
|
|
11180
11303
|
export declare interface ToolResult {
|
|
11181
|
-
/** Tool 返回的内容块。
|
|
11304
|
+
/** Tool 返回的内容块。
|
|
11305
|
+
* @default -
|
|
11306
|
+
*/
|
|
11182
11307
|
content?: Array<Record<string, unknown>>;
|
|
11183
|
-
/** Tool 返回的结构化内容。
|
|
11308
|
+
/** Tool 返回的结构化内容。
|
|
11309
|
+
* @default -
|
|
11310
|
+
*/
|
|
11184
11311
|
structuredContent?: unknown;
|
|
11312
|
+
/** Tool 执行是否返回错误结果。
|
|
11313
|
+
* @default false
|
|
11314
|
+
*/
|
|
11315
|
+
isError?: boolean;
|
|
11185
11316
|
}
|
|
11186
11317
|
|
|
11187
11318
|
/**
|
|
@@ -11332,7 +11463,10 @@ export declare interface UpdateModelContextParams {
|
|
|
11332
11463
|
* 用于卡片内操作后刷新卡片展示、把服务端最新结果写回卡片,或由 Page 根据传入的
|
|
11333
11464
|
* `widgetInstanceId` 更新原卡片;需要替换卡片类型时可同时传入新的 `widgetId`。
|
|
11334
11465
|
*
|
|
11335
|
-
*
|
|
11466
|
+
* `widgetData` 与 `toolResult` 二选一。传入 `toolResult` 时不能切换 `widgetId`,
|
|
11467
|
+
* 结构化结果必须符合当前应用的 Entity 协议。切换 `widgetId` 时不能关闭重新创建。
|
|
11468
|
+
*
|
|
11469
|
+
* @param params - Widget 实例标识及新的渲染数据或 ToolResult。
|
|
11336
11470
|
* @returns 返回一个 Promise,在卡片更新完成时解析。
|
|
11337
11471
|
* @example
|
|
11338
11472
|
* ```typescript
|
|
@@ -11355,7 +11489,7 @@ export declare interface UpdateModelContextParams {
|
|
|
11355
11489
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
11356
11490
|
* @precondition Android | 在卡片或消息环境中调用,需传入有效的 widgetInstanceId。
|
|
11357
11491
|
* @precondition iOS | 在卡片或消息环境中调用,需传入有效的 widgetInstanceId。
|
|
11358
|
-
* @usageNote All |
|
|
11492
|
+
* @usageNote All | widgetData 和 toolResult 互斥;应用插件支持 toolResult 和 reloadWidget,旧版 Applet Widget 仅支持 widgetData。toolResult 更新模型上下文并须符合 Entity 协议,不能同时切换 widgetId。reloadWidget 默认为 true;切换 widgetId 时不能设为 false。
|
|
11359
11493
|
* @errorExample
|
|
11360
11494
|
* ```json
|
|
11361
11495
|
* {
|
|
@@ -11364,8 +11498,8 @@ export declare interface UpdateModelContextParams {
|
|
|
11364
11498
|
* }
|
|
11365
11499
|
* ```
|
|
11366
11500
|
* @errorCode common | 102 | Android,iOS
|
|
11367
|
-
* @errorCode errNo | 103 | feature not support | Android,iOS |
|
|
11368
|
-
* @errorCode errNo | 104 | invalid parameter | Android,iOS | widgetInstanceId
|
|
11501
|
+
* @errorCode errNo | 103 | feature not support | Android,iOS | 当前豆包环境未提供消息更新能力,或旧版 Applet Widget 传入 reloadWidget/toolResult | 在支持的环境调用;旧版 Applet Widget 只传 widgetData。
|
|
11502
|
+
* @errorCode errNo | 104 | invalid parameter | Android,iOS | widgetInstanceId 为空、widgetData 与 toolResult 未二选一、reloadWidget 类型错误,或切换 widgetId 时关闭重建 | 修正参数后重试。
|
|
11369
11503
|
* @errorCode errNo | 116 | resource not found | Android,iOS | 依据 widgetInstanceId 找不到对应消息,或依据 widgetId 找不到已注册的 Widget | 确认 widgetInstanceId 与 widgetId 有效后重试。
|
|
11370
11504
|
* @platformNote All | 参数为空返回 104;消息或 Widget 未找到返回 116;当前豆包环境未提供消息更新能力时返回 103;其他失败统一返回 102。
|
|
11371
11505
|
*
|
|
@@ -11374,22 +11508,35 @@ export declare interface UpdateModelContextParams {
|
|
|
11374
11508
|
export declare const updateWidget: (params: UpdateWidgetParams) => Promise<object>;
|
|
11375
11509
|
|
|
11376
11510
|
/** @public */
|
|
11377
|
-
export declare
|
|
11511
|
+
export declare type UpdateWidgetParams = {
|
|
11378
11512
|
/**
|
|
11379
11513
|
* 需要更新的 Widget 实例 ID。
|
|
11380
11514
|
*
|
|
11381
11515
|
* 卡片内可通过 `getWidgetInstanceId()` 获取;页面中需要由路由参数或业务数据传入。
|
|
11382
11516
|
*/
|
|
11383
11517
|
widgetInstanceId: string;
|
|
11518
|
+
/**
|
|
11519
|
+
* 是否重新创建 Widget 组件;设为 `false` 时仅更新同一 Widget 的数据。
|
|
11520
|
+
* 仅应用插件支持;旧版 Applet Widget 使用 IM 更新,不支持此参数。
|
|
11521
|
+
* @default true
|
|
11522
|
+
*/
|
|
11523
|
+
reloadWidget?: boolean;
|
|
11524
|
+
} & ({
|
|
11384
11525
|
/**
|
|
11385
11526
|
* 可选的新 widgetId。传入后会把当前实例切换成另一个已注册的 Widget。
|
|
11386
|
-
*
|
|
11387
11527
|
* @default -
|
|
11388
11528
|
*/
|
|
11389
11529
|
widgetId?: string;
|
|
11390
|
-
/** 新的卡片渲染数据,通常传入 `JSON.stringify(viewData)
|
|
11530
|
+
/** 新的卡片渲染数据,通常传入 `JSON.stringify(viewData)`;不会更新模型上下文。 */
|
|
11391
11531
|
widgetData: string;
|
|
11392
|
-
|
|
11532
|
+
toolResult?: never;
|
|
11533
|
+
} | {
|
|
11534
|
+
/** 保持当前 Widget 时可显式传入相同的 widgetId。 */
|
|
11535
|
+
widgetId?: string;
|
|
11536
|
+
widgetData?: never;
|
|
11537
|
+
/** 符合 Entity 协议的 ToolResult;仅应用插件支持,更新卡片并同步模型上下文。 */
|
|
11538
|
+
toolResult: ToolResult;
|
|
11539
|
+
});
|
|
11393
11540
|
|
|
11394
11541
|
/**
|
|
11395
11542
|
* 上传本地文件,并返回可用于监听进度和中断上传的 {@link UploadTask}。
|
|
@@ -11442,14 +11589,14 @@ export declare interface UpdateWidgetParams {
|
|
|
11442
11589
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
11443
11590
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
11444
11591
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
11445
|
-
* @precondition All | url
|
|
11592
|
+
* @precondition All | url 需命中当前应用插件的上传域名白名单,filePath 需指向当前应用插件可访问的本地文件。
|
|
11446
11593
|
* @usageNote All | 上传成功时 Promise resolve,上传失败或取消时 Promise reject;任务结束或不再使用时应移除监听,必要时调用 abort。
|
|
11447
11594
|
* @errorCode errNo | 121999 | uploadFile:fail url is invalid | Android,iOS | url 缺失或不是有效上传地址 | 传入完整的 HTTP/HTTPS URL
|
|
11448
11595
|
* @errorCode errNo | 121999 | uploadFile:fail name is required | Android,iOS | name 缺失或为空 | 传入服务端接收文件所使用的 form field name
|
|
11449
|
-
* @errorCode errNo | 121901 | uploadFile:fail url not in domain list | Android,iOS | url 未命中上传域名白名单 |
|
|
11450
|
-
* @errorCode errNo | 121902 | uploadFile:fail no file exist | Android,iOS | filePath 为空、文件不存在或路径不是文件 | 使用文件 API
|
|
11596
|
+
* @errorCode errNo | 121901 | uploadFile:fail url not in domain list | Android,iOS | url 未命中上传域名白名单 | 在应用插件配置中添加上传域名后重试
|
|
11597
|
+
* @errorCode errNo | 121902 | uploadFile:fail no file exist | Android,iOS | filePath 为空、文件不存在或路径不是文件 | 使用文件 API 获取当前应用插件可访问的有效文件路径
|
|
11451
11598
|
* @errorCode errNo | 121905 | uploadFile:fail upload file abort | Android,iOS | 调用 UploadTask.abort 中断上传 | 按业务需要处理取消状态,无需自动重试
|
|
11452
|
-
* @errorCode errNo | 121906 | uploadFile:fail file path permission denied | Android,iOS |
|
|
11599
|
+
* @errorCode errNo | 121906 | uploadFile:fail file path permission denied | Android,iOS | 当前应用插件无权访问 filePath | 改用当前应用插件目录内的文件
|
|
11453
11600
|
* @errorCode errNo | 121920 | uploadFile:fail request time out | Android,iOS | 上传超过豆包客户端的超时时间 | 检查网络或设置合理的 timeout 后重试
|
|
11454
11601
|
* @errorCode errNo | 121985 | uploadFile:fail network unavailable | Android,iOS | 当前网络不可用 | 恢复网络连接后重试
|
|
11455
11602
|
* @errorCode errNo | 121991 | uploadFile:fail network error | Android,iOS | 上传过程中发生网络错误 | 检查网络和服务端状态后重试
|