refactor: clean CLI taxonomy — canonical subcommands, merged memory.update, no aliases
- calendar: split write → create/read/update/delete/share - contacts: rename lookup → read - memory: merge write+forget → update (unified action field in operations) - Remove all alias/normalization logic from adapter and handlers - Update tool_postprocessor ui_hints builders to canonical keys - Remove frontend legacy TOOL_CALL_START/ARGS/END events and ToolCallItem - Update SKILL.md files and protocol docs - Update tests and settings screens
This commit is contained in:
@@ -127,6 +127,11 @@ data: <json>
|
||||
|
||||
### 3.3 Tool 事件
|
||||
|
||||
前端渲染约束(当前实现):
|
||||
|
||||
- tool UI 渲染仅消费 `TOOL_CALL_RESULT.ui_schema`。
|
||||
- `TOOL_CALL_START` / `TOOL_CALL_ARGS` / `TOOL_CALL_END` 仅作为执行观测事件保留,前端主聊天流不渲染中间态卡片。
|
||||
|
||||
#### `TOOL_CALL_START`
|
||||
|
||||
```json
|
||||
@@ -184,18 +189,22 @@ data: <json>
|
||||
"tool_call_id": "...",
|
||||
"tool_call_args": {},
|
||||
"status": "success" | "failure" | "partial",
|
||||
"result": "...",
|
||||
"error": null
|
||||
"result": {},
|
||||
"error": null,
|
||||
"ui_schema": {}
|
||||
}
|
||||
```
|
||||
|
||||
说明:`TOOL_CALL_RESULT` 不再携带 `ui_schema`。tool 结果通过 `result` 字段提供紧凑、结构化、可执行的信息(优先包含 id/status/count 等关键事实),用于 agent 后续推理与工具编排。
|
||||
说明:`TOOL_CALL_RESULT` 中 `result` 字段提供紧凑、结构化、可执行的信息(优先包含 id/status/count 等关键事实),用于 agent 后续推理与工具编排。若对应工具输出存在 `ui_hints`,后端会在 codec 层编译得到 `ui_schema` 并随事件下发。
|
||||
|
||||
当前 `ui_hints` 策略:仅对当前 canonical CLI 的 CRUD 子命令生成(`calendar.create/read/update/delete`、`contacts.read`、`memory.update`);`calendar.share` 不生成 `ui_hints`。
|
||||
|
||||
补充约束:
|
||||
|
||||
- `tool_call_id` 必须与同次调用的 `TOOL_CALL_START/ARGS/END.toolCallId` 一致,并在每次工具调用中保持唯一。
|
||||
- `tool_call_args` 仅表示输入参数快照。
|
||||
- `result` 仅表示执行输出事实,不重复 `tool_call_args` 已包含的输入参数。
|
||||
- `ui_schema` 为可渲染 UI 线缆格式;其源数据来自 `metadata.tool_agent_output.ui_hints`。
|
||||
|
||||
#### 3.3.1 tool 名称展示规范(前端本地化)
|
||||
|
||||
@@ -206,21 +215,22 @@ SSE 协议中的工具名字段保持后端原样,不做服务端翻译:
|
||||
|
||||
前端展示层统一通过工具名本地化映射进行中文渲染,要求兼容两类命名风格:
|
||||
|
||||
- dot 风格:`memory.write`、`calendar.read`
|
||||
- snake 风格:`memory_write`、`calendar_read`
|
||||
- dot 风格:`memory.update`、`calendar.read`
|
||||
- snake 风格:`memory_update`、`calendar_read`
|
||||
|
||||
当前规范映射(canonical -> 中文)如下:
|
||||
|
||||
- `calendar.read` -> `读取日程`
|
||||
- `calendar.write` -> `写入日程`
|
||||
- `calendar.create` -> `创建日程`
|
||||
- `calendar.update` -> `更新日程`
|
||||
- `calendar.delete` -> `删除日程`
|
||||
- `calendar.share` -> `共享日程`
|
||||
- `user.lookup` -> `查找联系人`
|
||||
- `memory.write` -> `写入记忆`
|
||||
- `memory.forget` -> `清理记忆`
|
||||
- `contacts.read` -> `读取联系人`
|
||||
- `memory.update` -> `更新记忆`
|
||||
|
||||
兼容策略:
|
||||
|
||||
1. 优先按 alias 归一化(例如 `memory_write` -> `memory.write`)
|
||||
1. 优先按 alias 归一化(例如 `memory_update` -> `memory.update`)
|
||||
2. 命中 canonical 映射后展示中文
|
||||
3. 未命中时回退显示原始工具名(保证向后兼容)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user