@tansr/sdk 0.13.0 → 0.13.1

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 CHANGED
@@ -27,7 +27,7 @@ for await (const event of session.events) {
27
27
  }
28
28
  ```
29
29
 
30
- 模型目录与能力位由平台 App 配置(控制台治理)自动下发,本地零配置。
30
+ 模型目录与授权能力由平台 App 配置下发。系统媒体工具须在 `tools.builtin` 中显式选择;仅开启平台授权不会让缺省 SDK 会话自动装入收费媒体工具。
31
31
 
32
32
  ## 应用系统提示词(AP-SP)
33
33
 
@@ -64,10 +64,12 @@ P 和 S 同为模型 system 输入,拼接次序不保证冲突指令谁胜出
64
64
 
65
65
  ## 能力面一览
66
66
 
67
- - **三环工具一个入口**:`tools: { builtin: [...], platform: [...], custom: [...] }`
68
- ——环2 内置本地工具(read/glob/grep/shell/…)、环3 平台托管能力(imageGen 图像
69
- 生成,平台代调按张计费)、环1 `defineTool` 业务函数(注册即说明书,JSON 参数表/
70
- zod 双档);
67
+ - **系统工具与业务工具统一入口**:`tools: { builtin: [...], custom: [...] }`。
68
+ 系统工具包括文件、命令、网络及多媒体;`imageGen`、`videoGen`、`speechToText`、
69
+ `textToSpeech` 与其他系统工具一起从 `tools.builtin` 选择,执行骨架统一在内核。
70
+ SDK 媒体后端由平台提供,受应用授权、模型范围和计量约束。`defineTool` 注册业务函数,
71
+ 接受 JSON 参数表或 zod schema。旧 `tools.platform` 仅为四媒体的弃用兼容别名,
72
+ 会并入同一内置工具集合并去重,不代表另一层工具;
71
73
  - **联网搜索双位双门**:webSearch 工具本体是内置 `WebSearch`(写在 `tools.builtin`,
72
74
  旧写法 `tools.platform` 报迁移错),后端恒平台通道(按次计费归 App,SDK 恒无 BYO
73
75
  径)——装配需双位齐开(`tools.webSearch` 工具位 + `platform.webSearch` 通道位)且
@@ -94,9 +96,32 @@ P 和 S 同为模型 system 输入,拼接次序不保证冲突指令谁胜出
94
96
  - **计量**:`cost.usage.updated` 逐请求;终端自查 `/v1/my-usage` 恒无金额字段,
95
97
  开发者对账 `/v1/app-usage/by-end-user` 含金额(恒不代理给终端)。
96
98
 
97
- 能力位(17 工具位 + 5 平台位:webSearch / imageGen / videoGen / speechToText / textToSpeech,
98
- `CAPABILITY_TOOL_KEYS` / `CAPABILITY_PLATFORM_KEYS` 为事实源)在平台控制台按 App 配置;位关而显式
99
- 选择恒得到装配期可读错(`capability_disabled`,含修复指引),恒不静默缺工具。
99
+ 工具与扩展授权以及平台服务授权均在控制台按 App 配置;字段分别为 `capabilities.tools`
100
+ `capabilities.platform`,键集合由 `CAPABILITY_TOOL_KEYS` / `CAPABILITY_PLATFORM_KEYS`
101
+ 提供。授权合同仍为 17 工具位 + 5 平台位;后者控制平台搜索及四媒体服务的使用权,
102
+ 不是工具归属分类。位关而显式选择得到
103
+ `capability_disabled`,不静默缺工具。
104
+
105
+ ### 系统媒体工具示例 / System media tools
106
+
107
+ ```ts
108
+ const session = await createSession({
109
+ token,
110
+ baseUrl: 'https://api.example.com',
111
+ tools: { builtin: ['imageGen', 'videoGen', 'speechToText', 'textToSpeech'] },
112
+ });
113
+ ```
114
+
115
+ 先在应用配置中授权所需媒体服务与模型。示例只选择四个媒体工具;需要文件、网络等工具时,
116
+ 也应显式加入同一个 `builtin` 列表。权限确认、预算与平台计费继续适用。用户主动录音转写或朗读
117
+ 可以调用 `session.platform.transcribe()` / `.speak()`;这些是直连操作,不会伪造模型工具事件或自动写入聊天历史。
118
+
119
+ All four media tools are built-in system tools selected through `tools.builtin`. The platform supplies
120
+ their backend and enforces app permissions, model access, quotas, and billing. The retained
121
+ `capabilities.platform` fields describe service authorization, not a separate tool category.
122
+ Media tools require explicit selection; the default SDK tool set does not enable them automatically.
123
+ The deprecated `tools.platform` selection remains an equivalent alias. User-triggered transcription
124
+ and speech through `session.platform` are direct operations, separate from model tool calls.
100
125
 
101
126
  ## 文档与示例
102
127