Repository navigation
feat: unified collapse bars for thinking, tool calls, and compaction - #1084
Closed
mitchellkager wants to merge 5 commits into
Closed
mitchellkager wants to merge 5 commits into
mitchellkager wants to merge 5 commits into
Conversation
- Compaction card gets a single inline header: compaction (size; X -> Y tokens) elapsed, expanding via the top bar and collapsing via top or bottom bar - Thinking block converted to the same top/bottom bar pattern with duration in the meta column - Tool call cards gain a collapse bottom bar under the existing chevron header - Compaction file metadata uses the shared collapse bars instead of native <details> - session-reader precomputes post-compaction token estimates and elapsed time for loaded sessions; live-streamed entries degrade gracefully
session-reader walks the kept entry chain (firstKeptEntryId to the compaction entry's parent) to estimate the post-compaction token count and derives elapsed time from the entry timestamp gap, so the inline compaction header can show 'X -> Y tokens' and the duration for loaded sessions; live-streamed entries degrade gracefully. Also adds the systemMessage field to the local CompactionEntry type.
- top bar chevron moves to the right, matching the tool-call headers - bottom bar chevron points up (collapses the section upward) - thinking block title reverts to the Thinking icon (plus dimmed preview) - compaction top bar gets the same horizontal padding as the tool-call header - compaction summary renders as a code-style block (mono, subtle background)
Owner
|
Thanks. I'm not going to take this one. It changes behaviour: compaction is now collapsed by default and its summary is shown as raw The new "X → Y tokens" and elapsed time in the compaction header are also wrong in cases I tried: a fully emptied kept range shows ~200k instead of ~100 tokens, tool-call arguments are read from the wrong fields (a 40k-character write counts as ~100 tokens), and idle time before a manual compaction is counted as compaction time. |
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.
What
Unifies the collapse/expand UI for thinking blocks, tool calls, and compaction entries into shared top/bottom collapse bars, and adds post-compaction token estimates and elapsed time to the compaction header.
Why
The compaction summary, thinking blocks, and tool call cards each had their own inconsistent expand/collapse affordance (native
<details>, separate bars). A single shared pattern is easier to scan and keeps the UI consistent across message types. The compaction header also previously gave no sense of what the compaction did — now it shows the token reduction and how long it took.Implementation Notes
lib/message-display.ts: shared collapse bar helpers; compaction gets a single inline header (compaction (size; X → Y tokens) elapsed) expanding via the top bar and collapsing via either bar.lib/session-reader.ts: walks the kept entry chain (firstKeptEntryId→ compaction entry's parent) to estimate the post-compaction token count, and derives elapsed time from the entry timestamp gap, so loaded sessions show the estimate inline; live-streamed entries degrade gracefully.systemMessageadded to the localCompactionEntrytype.Testing
lib/session-reader.test.mjsfor the token-estimate/elapsed-time computation.tsc --noEmit,npm run lint, andnode --testpass (against the known 7 environment-dependent failures that also fail onmain).