feat(web): show subagent task trace in tool dialog (#539)

* refactor(web): extract shared task tool helpers

* feat(web): show subagent task trace in tool dialog

Task tool modals previously showed only Input and Result. This adds a
Trace section between them that surfaces the child tool calls already
wired through the reducer into block.children.

- TraceSection collapses by default when completed, expands when
  running or error so the relevant state is visible on open
- Each child row toggles an inline expand (Input/Result) to avoid
  nested Dialogs
- Header summarises call count, token total and duration via
  readSummaryFields() typed parser, falling back gracefully when any
  value is absent
- formatTaskChildLabel / TaskStateIcon imported from shared helpers.tsx
  (extracted in prior refactor commit) — no local duplicates
- Task name guard: getTaskTraceChildren returns null for non-Task blocks
- children prop renamed to items in TraceSectionInner / TraceChildList
  (react/no-children-prop anti-pattern removed)
- i18n: tool.trace and tool.trace.callsSuffix keys added for en and
  zh-CN; useTranslation hooked up to header label and calls suffix
- 15 unit tests: getTaskTraceChildren (guard, filter, non-Task null),
  getTraceSummaryText (3 branches), TraceSection (open/close/toggle/
  summary/empty)

* feat(web): include input view in trace row expand

Expanded child rows in the Task trace section now render both an Input
section and a Result section, matching the pattern used in the parent
ToolCard dialog. Tools with a registered FullInputView use it; all
others fall back to a JSON CodeBlock. Closes bot review on PR #539.
This commit is contained in:
Junmo Kim
2026-04-28 10:55:10 +08:00
committed by GitHub
parent d66547ff46
commit 52ec08b6cb
6 changed files with 555 additions and 30 deletions
+2
View File
@@ -186,6 +186,8 @@ export default {
'tool.exitPlan': 'Exit Plan Mode',
'tool.patch': 'Patch',
'tool.input': 'Input',
'tool.trace': 'Trace',
'tool.trace.callsSuffix': 'calls',
'tool.result': 'Result',
'tool.questionsAnswers': 'Questions & Answers',
'tool.submit': 'Submit',