feat(chat): bundle turn tool blocks behind collapse preference - #1001
Open
beruro wants to merge 4 commits into
Open
feat(chat): bundle turn tool blocks behind collapse preference#1001beruro wants to merge 4 commits into
beruro wants to merge 4 commits into
Conversation
Add a session-menu toggle that groups per-turn tool and activity rows into one collapsible stack with a right-side type summary, keeping assistant messages and interactive cards outside the bundle. Pre-commit hook ran. Total eslint: 0, total circular: 0
Pre-commit hook ran. Total eslint: 0, total circular: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Chat sessions with many tool/activity rows (thinking, explore, shell, image reads, etc.) become visually noisy. Users need a way to collapse that activity without hiding assistant messages or interactive cards such as ask_question.
Per-block collapse also left many separate header rows visible, which did not match the desired UX of grouping all tool activity in a turn into one collapsible stack.
Solution
Add a persisted session-menu toggle (Collapse tools / 折叠 Tool) backed by
chatToolBlocksCollapsedAtom.When enabled, the chat projection post-processes each turn group and merges consecutive bundlable tool/activity items into a single
turnToolBundlerow rendered byTurnToolBundleGroup. The bundle header shows the total item count on the left and a right-side type summary (for example思考 · 探索 ×5 · 执行命令). Expanding the bundle renders the original nested rows unchanged.Assistant prose, user messages, and interactive cards remain outside the bundle. Collapsed tool/thinking headers hide their detail summaries; the turn bundle keeps its item count visible and removes the nested stack height cap when expanded. Bundling logic and type classification live in pure helpers (
turnToolBundle.ts) with Vitest coverage.Integrated
developthrough89bda2ea1without rewriting the PR history. Collapse tools now lives inside the shared UI settings submenu alongside the existing display switches, and is wired through Chat Panel, WorkStation, and the detached session window. The bundle icon uses the repository'sBotIconinstead of the removedlucide-reactpackage.Potential risks
orgii:chatToolBlocksCollapsed; no database or IPC migration is required. Roll back by disabling the toggle or reverting the feature; older versions ignore the new preference.Verification
Post-integration checks:
pnpm run typecheck— passed on the final resolution. The first run found the removedlucide-reactimport; it was replaced with the repository icon before the successful rerun.pnpm exec vitest run src/engines/ChatPanel/components/SessionHeaderActionsMenu.test.ts src/engines/ChatPanel/ChatPanelHeader.test.ts src/engines/ChatPanel/ChatHistory/__tests__/turnToolBundle.test.ts— 44 tests passed across 3 files. Covers submenu placement, enabling/disabling tool collapse without closing the menu, existing header behavior, and bundle classification/grouping.git diff --name-only --diff-filter=ACMR origin/develop -- '*.ts' '*.tsx' | xargs pnpm exec eslint --max-warnings 0— passed for all 18 changed TypeScript files after replacing the stale icon import.pnpm exec prettier --check src/engines/ChatPanel/components/SessionHeaderActionsMenu.tsx src/engines/ChatPanel/components/SessionHeaderActionsMenu.test.ts src/engines/ChatPanel/ChatPanelHeader.test.ts src/modules/SessionWindow/index.tsxandpnpm exec prettier --check src/engines/ChatPanel/ChatItems/TurnToolBundleGroup/index.tsx— passed.git diff --checkandgit diff --cached --check— passed; final diff inspected for conflict markers, credentials, personal paths, debug logs, and unrelated changes.Manual QA recommended (not run in this handoff):
Live desktop QA and screenshots were not run because desktop control was not requested. The full application test suite was not run; checks were scoped to the affected menu, header, and tool-bundle behavior.