Skip to content

feat(transcript): merge consecutive thinking/text chunks in agent transcript#3114

Open
sendwealth wants to merge 7 commits into
multica-ai:mainfrom
sendwealth:feat/mobile-group-chat-timeline-steps
Open

feat(transcript): merge consecutive thinking/text chunks in agent transcript#3114
sendwealth wants to merge 7 commits into
multica-ai:mainfrom
sendwealth:feat/mobile-group-chat-timeline-steps

Conversation

@sendwealth
Copy link
Copy Markdown

@sendwealth sendwealth commented May 23, 2026

Summary

  • Agent transcripts show consecutive thinking and text chunks as separate rows. This PR merges consecutive same-type chunks into a single combined row in the agent transcript dialog.
  • New step-grouping.ts lib in packages/views/common/task-transcript/ with pure grouping function
  • Modified agent-transcript-dialog.tsx to consume grouping
  • Single chunks render identically to before; consecutive same-type chunks merge into one row

Closes #3113

Files changed

File Action
packages/views/common/task-transcript/step-grouping.ts Create — pure grouping function
packages/views/common/task-transcript/step-grouping.test.ts Create — unit tests
packages/views/common/task-transcript/agent-transcript-dialog.tsx Modify — consume grouping

Test plan

  • Open an agent transcript with consecutive thinking chunks — verify they merge into a single row
  • Verify single isolated chunks still render as before
  • Verify mixed sequences (thinking → text → thinking) are correctly separated
  • Run pnpm --filter @multica/views exec vitest run common/task-transcript/step-grouping.test.ts

🤖 Generated with Claude Code

Agent tasks produce bursts of same-type events (thinking, tool calls)
that each render as a separate row. Add a grouping layer that merges
consecutive same-type events into a single collapsible row per group,
reducing visual noise while preserving all detail on expand.

- New `apps/mobile/lib/step-grouping.ts` with pure grouping function
- Modified `chat-timeline.tsx` with `StepGroupRow` component
- Single items render identically to before (no visual change)
- Groups of 2+ show a collapsed summary (e.g. "3 thinking steps")

Closes multica-ai#3113

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

@oklaM is attempting to deploy a commit to the IndexLabs Team on Vercel.

A member of the Team first needs to authorize it.

oklaM and others added 5 commits May 23, 2026 13:53
Apply the same grouping logic from mobile to the shared
packages/views/ chat timeline. Consecutive same-type events
(thinking, tool_use, tool_result, error) merge into a single
collapsible row per group. Web and desktop both benefit.

- New `packages/views/chat/lib/step-grouping.ts` with pure grouping
- Modified `chat-message-list.tsx` with `StepGroupRow` component
- Added i18n keys for group labels (en + zh-Hans)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers empty input, singles, consecutive groups, alternating types,
text breaks, and all event types (thinking, tool_use, tool_result, error).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Ionicons expects a specific string literal union, not a broad \`string\`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…rows

Streaming outputs arrive as many small chunks. Consecutive thinking
and text (Agent) events are now merged into one row with concatenated
content and a ×N badge showing how many chunks were combined.
Tool calls, results, and errors stay as individual rows.

- New `step-grouping.ts` with `mergeStreamingChunks()` for transcript
- Updated `TranscriptEventRow` to render merged items with seq range
- Tests: 9 cases covering all merge scenarios

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…line

Revert the step-grouping feature from chat/mobile while keeping the
transcript merge (eb887c2). The grouping added visual complexity
that wasn't ready yet.

Reverts: ea0444b, 000b12f, ebc5419, f7e4976

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@sendwealth sendwealth changed the title feat(mobile): group consecutive same-type events in chat timeline feat(transcript): merge consecutive thinking/text chunks in agent transcript May 24, 2026
getEventLabel only uses `type` and `tool`, but was typed as MergedItem
which requires `mergedCount`. The filterOptions loop passes TimelineItem
which lacks that field. Widen to a structural type both satisfy.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

feat(transcript): merge consecutive thinking/text chunks in agent transcript

2 participants