Repository navigation
feat(app): collapsible reasoning cards - #46344
4ebuRushka wants to merge 3 commits into
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
229c315 to
e9e55a5
Compare
e320bce to
d71a9ab
Compare
Add collapsibleReasoning setting (default true) with persisted store, i18n (62 locales) and UI toggles in both settings-general variants. Render reasoning parts as collapsible cards in the style of tool calls (brain icon, 80-char subtitle, TextShimmer only on active block, max-height:320px scrollable body, copy button). Each reasoning part is its own card with open/userInteracted state. - Auto-collapse previous blocks in a chain: isLastPart via data.store.part[message.id].at(-1) — previous collapses immediately when next reasoning part appears, not at end of chain. Shimmer and PacedMarkdown streaming only on active (streaming && isLastPart). - Auto-scroll inside card: scrollRef/innerRef signals, autoFollow flag (pause >40px from bottom, resume at bottom), ResizeObserver + MutationObserver + continuous RAF tick while open && streaming && autoFollow — keeps tail visible during PacedMarkdown pacing and large gaps. - Wire collapsibleReasoning through MessagePartProps -> Part -> message-timeline (settings.general.collapsibleReasoning()). Complements anomalyco#45247 (/thinking toggle). Closes anomalyco#8789, anomalyco#14340, anomalyco#37115, anomalyco#21548, partially anomalyco#28322. Refs anomalyco#7866, anomalyco#33906. Co-authored-by: 4ebuRushka
Limit reasoning card to visible width and vertical scroll only. Outer container overflow-x hidden, overflow-y auto with max-width 100%. Reasoning markdown text uses overflow-wrap anywhere and word-break break-word with white-space normal so long lines wrap. Keep pre and pre code as white-space pre with overflow-x auto so code blocks retain internal horizontal scroll without stretching the card.
… opt-in toggle Variant B rework: remove the collapsibleReasoning setting entirely. Reasoning parts always render as collapsible cards while showReasoningSummaries is on, and stay hidden as before while it is off (rows.ts/groupParts untouched).
d71a9ab to
cd36715
Compare
|
Hi — any progress on getting collapsible thinking landed? Happy to help if needed. I also saw #46657 takes a similar approach (reuses also i found out i didn't got opencode v2 installed automatically - that version helps - but closing exapnded thinking is still a hassle |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #8789, Closes #14340, Closes #37115, Closes #21548. Partially addresses #28322. Refs #7866, #33906, #21515.
Type of change
What does this PR do?
Render reasoning parts as collapsible cards instead of flat markdown. Visibility follows the existing "show reasoning summaries" setting: ON = cards, OFF = hidden as before (
rows.ts/groupPartsuntouched).Collapsiblecard inBasicToolstyle:brainicon,Thinkingtitle (ui.sessionTurn.status.thinking), 80-char live subtitle from the first line,max-height:320pxscrollable body with copy buttonstreaming && isLastPart); auto-collapse on completion and when the next block appears — the previous block in areasoning→reasoningchain collapses immediately; shimmer andPacedMarkdown streaminggated byisLastParttoolOpenjournal, so it survives list remounts (scrolling)isLastPartviadata.store.part[message.id].at(-1)?.id === part.idscrollRef/innerRef,autoFollow(pause >40px from bottom, resume at bottom),ResizeObserver+MutationObserver+ continuousRAFtick whileopen && streaming && autoFollowoverflow-wrap: anywhere); ``` code blocks keep their own horizontal scroll without stretching the cardOpen state comes from the existing parent
toolOpen/onToolOpenChangejournal (same mechanism as tool parts). No new settings, no new i18n keys, no migrations, no leftover stored preferences to clean up.How did you verify your code works?
tsgo --noEmit -p packages/session-uicleanbun test --cwd packages/session-ui src/components/message-part.test.ts6 passi18n/parity: only the pre-existingdvfailures (identical on cleandev)oxlinton changed files: 0 errorsupstream/dev@c0f09afe; merge simulation shows 0 conflictsshowReasoningSummariesON/OFF OK, streaming auto-opens, completed auto-collapses,reasoning→reasoningandreasoning→toolchains collapse correctly, shimmer only on active, inner scroll follows without wheel and pauses when user scrolls upelectron-vite devHMR works, no TUI changes (session-uinot used bytui)Screenshots / recordings
Compact collapsible cards interleaved with tool calls, streaming card auto-opens and auto-scrolls, history stays compact. Before: flat markdown prologue filling history.
Checklist