feat(app): add expand-last thinking display option and format markdown - #3370
feat(app): add expand-last thinking display option and format markdown#3370mcowger wants to merge 6 commits into
Conversation
|
| Filename | Overview |
|---|---|
| packages/app/src/utils/thinking-text-formatter.ts | Adds header normalization and code preservation, but valid tilde fences and variable-length backtick spans remain exposed to content rewriting. |
| packages/app/src/utils/thinking-text-formatter.test.ts | Covers common prose and code cases but omits Markdown delimiter forms that remain corrupted. |
| packages/app/src/agent-stream/view.tsx | Implements latest-thought selection and applies the new display mode and formatter to streamed reasoning. |
| packages/app/src/hooks/use-settings/storage.ts | Introduces the three-state preference and backward-compatible parsing of stored values. |
| packages/app/src/components/tool-call-details.tsx | Renders string tool details as compact Markdown and keeps streaming content pinned when the user is near the bottom. |
Reviews (6): Last reviewed commit: "Merge branch 'main' into feat-expand-act..." | Re-trigger Greptile
| return ""; | ||
| } | ||
|
|
||
| // Preserve code blocks (including in-progress streaming code blocks) and inline code spans |
There was a problem hiding this comment.
Code delimiters remain unprotected
When thinking or tool text contains adjacent bold-like characters inside a tilde-fenced block or a code span using multiple backticks, the preservation regex fails to recognize the code region and inserts blank lines into it, causing the rendered content to differ from the model or tool output.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Type of change
Reasoning
Users often want to monitor agent reasoning while it is actively streaming and keep the most recent thinking block visible after it completes, without having every historic block across previous turns permanently expanded. Furthermore, certain models (e.g. Codex) output bold thinking headers without separating newlines (
**title1****title2**), and previously thinking blocks were rendered as raw unformatted text rather than parsed Markdown.This PR adds an Expand Last thinking display detail option so the latest thinking block remains expanded while streaming and stays expanded once complete, collapsing older thinking blocks. It also formats thinking headers cleanly and renders thinking content as rich compact Markdown.
Goals
Expand Lastoption to the thinking display setting alongsideCollapsedandAlways expand.Expand Lastis selected.true->expanded,false->collapsed,expand_active->expand_last).**title1****title2**->**title1**\n\n**title2**) without breaking inline prose markdown.<MarkdownRenderer compact />.Non-goals
QA
storage.test.tsfor boolean flags and enum values (collapsed,expand_last,expanded,expand_active).thinking-text-formatter.test.tsacross adjacent headers, numbered steps, streaming inputs, and inline bold prose.resources.test.ts.typecheck,lint, andformat.Checklist