refactor(ui): unify Per Session and Live Sessions tables into shared renderer#336
Merged
Conversation
…renderer Both the Cost Intelligence and Cache Warming pages now render the same unified live-sessions table via buildLiveSessionRows() + renderLiveSessionsTable(). The unified table merges all columns from both: identity (Project, Session), activity (Turns, Idle), cost (Conversation, Worker, Total, Savings), and warming (TTL, S(t), P(returns), Status, Warmups, Hits). Both pages gain features they were missing: Costs page gets warming columns and text filter; Warming page gets project/session links and cost columns.
- Replace ensureProject() (write) with projectId() (read-only) in render path - Parameterize buildLiveSessionRows() to accept pre-fetched data, eliminating double calls to getAllSessionCosts/getActiveSessions/computeWarmingSnapshot - Derive warming page summary stats from same rows as table (fixes count divergence) - Reduce from 14 to 9 columns: merge Conversation+Worker into Total, drop S(t) and TTL, merge Idle into Status badge, merge Warmups+Hits into single column - Add Cache Hit % column (cacheReadTokens / total input tokens) - Show '-' instead of '$0.00' for cost columns when no cost data exists - Show '-' instead of '0' for warming columns when no warming snapshot exists - Fix TTL fallback: show '5m' when snap exists but ttl is undefined (was '-') - Restore informative empty-state message on warming page - Add data-sort to Session column
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.
Summary
renderLiveSessionsTable()rendererWhat each page gains
Review fixes (2nd commit)
ensureProject()(DB write) with read-onlyprojectId()in the render pathbuildLiveSessionRows()to accept pre-fetched data — eliminates double calls togetAllSessionCosts/getActiveSessions/computeWarmingSnapshot-instead of$0.00/0when cost or warming data is absent5mwhen snapshot exists but TTL is undefined (was showing-)data-sortto Session columnSingle file change:
packages/gateway/src/ui.ts