feat(web): show tool call duration in the detail dialog (#1036)

* refactor(web): export formatDuration for reuse

* feat(web): show tool call duration in the detail dialog

Show a completed tool's execution duration at the top of its detail
dialog. The value is derived from the Claude entry's own timestamps
(the execution machine's wall clock) rather than the hub's
message-receive time, and is used only when both the tool_use and
tool_result entries carry a real timestamp — otherwise it falls back to
the hub receive times on both sides, so the two clocks are never mixed.
Running/pending tools show nothing, the running-state live timer is
unchanged, and clock skew is guarded against. Reuses the existing
formatDuration formatter. No schema changes.

* fix(web): backfill hub startedAt on reorder so duration isn't 0.0s

When a tool_result entry is reduced before its tool_use, the tool block
is created from the result, so the hub startedAt is the result receive
time. The tool_use path only lowered the exec start, not the hub
startedAt, so a timestamp-less pair (no exec duration available) fell
back to startedAt === completedAt and the detail dialog showed 0.0s.
Lower the hub startedAt to the earlier tool_use receive time as well.
This commit is contained in:
Junmo Kim
2026-07-16 12:32:00 +08:00
committed by GitHub
parent f457156bd1
commit 2ce6d3ef3a
23 changed files with 652 additions and 8 deletions
+1
View File
@@ -384,6 +384,7 @@ export default {
'tool.trace': '追踪',
'tool.trace.callsSuffix': '次调用',
'tool.result': '结果',
'tool.duration': '耗时',
'tool.semanticTitle.readFile': '读取文件',
'tool.semanticTitle.runShell': '运行命令',
'tool.semanticTitle.search': '搜索',