Skip to content

feat(ui): auto-collapse cross-message process groups, result first (PR 0001) - #171

Open
tokg-venv wants to merge 4 commits into
deer-flow:mainfrom
tokg-venv:pr/0001-collapsible-process-groups
Open

tokg-venv wants to merge 4 commits into
deer-flow:mainfrom
tokg-venv:pr/0001-collapsible-process-groups

Conversation

@tokg-venv

Copy link
Copy Markdown
Contributor

Re-submission of #166, which GitHub auto-closed when its head fork was deleted during a fork-network repair on 2026-09-13. The head branch here is the exact commit SHA the original PR was reviewed at (recovered from GitHub's retained PR refs). Original description follows.


Summary

Implements spec 0001: after an agent run finishes, its intermediate steps (thinking + tool calls spread across consecutive messages) collapse into a single expandable header row, so the final answer leads the conversation.

Grouping rule (derived view layer, no store/runtime changes):

  • member = assistant message with no body text and (thinking and/or tool calls)
  • a group ends at a user message or at an assistant message with body text (the result)
  • groups only wrap runs that finished with a result; the live streaming message is never wrapped

Details

  • process-groups.ts: grouping rule, span detection, master switch hook (localStorage llm-space-collapse-process-groups, on by default)
  • display-messages.ts: resolveDisplayRows folds settled runs into group rows
  • process-group-header.tsx: "N tool calls · Last: " with a warning state when a step failed
  • message-list-view.tsx: virtualizer treats a collapsed group as one fixed header row; an id→display-index map keeps jump/autofocus/validation targets correct while member rows are hidden; message navigator anchors to the group's first member
  • thread-store: expandedProcessGroupIds + toggleProcessGroupExpanded (store-only, never persisted); removeMessage cleans up stale ids
  • Settings → General: "Collapse process steps" toggle (en/zh)

Test plan

  • process-groups.test.ts (grouping boundaries, expand/collapse, virtualization row mapping) — passes
  • full packages/ui suite (121 tests) and i18n tests pass
  • bun run typecheck:changed / bun run lint:changed clean

Notes

This PR is a dependency for the planned agent-layout PR (run timeline jumps reference result rows).

zcai7675-bot added 3 commits September 8, 2026 20:55
…R 0001)

When an agent run finishes, its intermediate steps (thinking + tool calls
across consecutive messages) now collapse into a single expandable header
row, so the final answer leads the conversation.

- process-groups.ts: grouping rule (assistant messages without body text,
  with thinking and/or tool calls), span detection, master switch hook
  (localStorage 'llm-space-collapse-process-groups', on by default)
- display-messages.ts: resolveDisplayRows folds settled runs into group
  rows; live streaming messages are never wrapped
- process-group-header.tsx: collapsed header shows 'N tool calls',
  last tool name, and a warning state when a step failed
- message-list-view.tsx: virtualizer treats a collapsed group as one
  fixed header row; id->display-index map keeps jump/autofocus/validation
  targets correct while member rows are hidden; navigator anchors to the
  group's first member
- thread-store: expandedProcessGroupIds + toggleProcessGroupExpanded
  (store-only, never persisted); removeMessage cleans up stale ids
- Settings → General: 'Collapse process steps' toggle (en/zh)
- i18n: playground-labels processGroups block (en/zh + type)

Tests: process-groups.test.ts (grouping boundaries, expand/collapse,
virtualization row mapping).
- Keep historical process groups collapsed while a new run is in flight:
  grouping is now purely structural instead of disabled for the whole
  conversation while preparing/running, so a long thread's list height and
  reading position no longer shift mid-run. A new run's steps stay expanded
  because they form a trailing, unterminated span.
- Reveal a collapsed group before scrolling/focusing a run-validation or
  autofocus target inside it. Hidden members no longer map to their header
  row (they map to nothing), and a small effect expands the owning group so
  the target row mounts before the scroll/focus effects run.
- A user message now only ends a candidate span instead of qualifying it:
  only an assistant message with a result body makes a group collapsible, so
  steps from an interrupted run (followed by a user message) stay expanded
  as failure context, matching the stated goal.

Tests: interrupted-run grouping, older-group stability during a run, and
findCollapsedGroupIdForMessage lookup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant