refactor: 重构 Tool Result 契约,移除 ui_hints 统一使用 result 字段

- ToolAgentOutput 移除 result_summary 和 ui_hints,统一使用 result 字段
- 日历/用户查找工具移除 ui_hints 输出,改为机器可读的结构化结果
- Agent History 移除 tool 消息的 ui_hints 处理逻辑
- App 版本检查改为 manifest.json 方式,支持多渠道发布
- 更新 settings 配置和测试用例适配新结构
This commit is contained in:
qzl
2026-03-17 12:18:09 +08:00
parent c26cdbbc27
commit aa30fe0ce6
44 changed files with 984 additions and 655 deletions
+4 -2
View File
@@ -110,18 +110,20 @@ Base URL: `/api/v1/agent`
messages: Array<{
id: string;
seq: number;
role: "user" | "assistant" | "tool";
role: "user" | "assistant";
content: string;
attachments?: Array<{ // user 附件签名链接列表
mimeType: string;
url: string;
}>;
ui_schema?: object | null; // assistant/tool 的编译后 UI
ui_schema?: object | null; // assistant 的编译后 UI
timestamp: string; // ISO-8601
}>;
}
```
tool 消息在存储层用于运行时上下文续接,不在 `/history` 对外返回。
### 说明
- 若用户没有任何会话:返回
+2 -11
View File
@@ -428,16 +428,6 @@ interface HistoryAttachment {
url: string;
}
// role = "tool"
interface HistoryMessageTool {
id: string;
seq: number;
role: "tool";
content: string;
ui_schema: UiSchemaRenderer | null; // 由 tool_agent_output.ui_hints 编译
timestamp: string;
}
// role = "assistant"
interface HistoryMessageAssistant {
id: string;
@@ -448,7 +438,7 @@ interface HistoryMessageAssistant {
timestamp: string;
}
type HistoryMessage = HistoryMessageUser | HistoryMessageTool | HistoryMessageAssistant;
type HistoryMessage = HistoryMessageUser | HistoryMessageAssistant;
```
### UiSchemaRenderer
@@ -529,3 +519,4 @@ interface UiSchemaRenderer {
- `tools` 是前端工具通道字段;当前后端运行时不基于该字段构造后端工具 prompt
- `RunAgentInput` 同时接受 camelCase 与 snake_case 别名输入(推荐统一使用 camelCase)
- 日历能力依赖 `forwardedProps.client_time` 透传设备时间上下文;缺失时回退用户 profile 时区
- tool 消息在存储层用于运行时上下文续接,不在 `/history` 对外返回
+4 -3
View File
@@ -157,13 +157,14 @@ data: <json>
"tool_name": "...",
"tool_call_id": "...",
"tool_call_args": {},
"status": "success" | "failed",
"result_summary": "...",
"ui_schema": {},
"status": "success" | "failure" | "partial",
"result": "...",
"error": null
}
```
说明:`TOOL_CALL_RESULT` 不再携带 `ui_schema`。tool 结果通过 `result` 字段提供紧凑、结构化、可执行的信息(优先包含 id/status/count 等关键事实),用于 agent 后续推理与工具编排。
### 3.4 文本完成事件
#### `TEXT_MESSAGE_END`