fix(uwf-hermes): read turn data from session file instead of ACP stream #520

Merged
xiaomo merged 1 commits from fix/519-read-session-file into main 2026-05-25 14:24:42 +00:00
Owner

What

从 Hermes session JSON 文件读取 turn 数据,替代从 ACP 流式 update 重建。

Why

ACP 协议的 tool_call update 只有展示用的 title(没有结构化工具名),且常用工具不填 rawInput,导致 uwf step show/read 显示的 name 和 args 全是错的。

Changes

  • hermes.ts: storePromptResult 改用 loadHermesSession(sessionId) 从文件读
  • acp-client.ts: 删除 messages/tool-call 收集逻辑,只保留 text chunk 拼接
  • step.ts: TurnData 增加 role + toolCalls,formatTurnBody 渲染工具名和参数
  • README: 文档化 sessions.write_json_snapshots: true 配置要求

Ref

Closes #519

## What 从 Hermes session JSON 文件读取 turn 数据,替代从 ACP 流式 update 重建。 ## Why ACP 协议的 tool_call update 只有展示用的 title(没有结构化工具名),且常用工具不填 rawInput,导致 uwf step show/read 显示的 name 和 args 全是错的。 ## Changes - hermes.ts: storePromptResult 改用 loadHermesSession(sessionId) 从文件读 - acp-client.ts: 删除 messages/tool-call 收集逻辑,只保留 text chunk 拼接 - step.ts: TurnData 增加 role + toolCalls,formatTurnBody 渲染工具名和参数 - README: 文档化 sessions.write_json_snapshots: true 配置要求 ## Ref Closes #519
xingyue added 1 commit 2026-05-25 14:21:59 +00:00
Closes #519

The ACP protocol's tool_call updates only carry a display title (not a
structured tool name) and omit rawInput for polished tools, making the
reconstructed messages unusable for step read/show.

Changes:
- hermes.ts: storePromptResult reads ~/.hermes/sessions/session_{id}.json
  via loadHermesSession() instead of using ACP-reconstructed messages
- acp-client.ts: strip message/tool-call collection logic, keep only
  text chunk accumulation for final response extraction
- step.ts: TurnData gains role + toolCalls fields; formatTurnBody
  renders them in step read markdown output
- README: document sessions.write_json_snapshots requirement
xiaomo approved these changes 2026-05-25 14:24:40 +00:00
xiaomo left a comment
Owner

LGTM 正确的架构决策 — 从 session 文件读结构化数据比从 ACP 流重建靠谱得多。ACP client 瘦身效果显著,删掉了 pendingTools/messages/reasoning 整套收集逻辑,只保留 text chunk 拼接。step read 的 formatTurnBody 渲染也清晰。

LGTM ✅ 正确的架构决策 — 从 session 文件读结构化数据比从 ACP 流重建靠谱得多。ACP client 瘦身效果显著,删掉了 pendingTools/messages/reasoning 整套收集逻辑,只保留 text chunk 拼接。step read 的 formatTurnBody 渲染也清晰。
xiaomo merged commit 8123399189 into main 2026-05-25 14:24:42 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#520