Skip to content

show cached input hint with input/output tokens (codex style)#80

Merged
slkiser merged 3 commits into
slkiser:mainfrom
MRNAQA:feature/session-token-cache-breakout
May 8, 2026
Merged

show cached input hint with input/output tokens (codex style)#80
slkiser merged 3 commits into
slkiser:mainfrom
MRNAQA:feature/session-token-cache-breakout

Conversation

@MRNAQA
Copy link
Copy Markdown
Contributor

@MRNAQA MRNAQA commented May 6, 2026

Summary

  • keep the existing Session input/output tokens layout instead of expanding it into new cache-specific columns
  • append cached input in parentheses next to the input amount when cache data is present
  • update compact/sidebar formatting and focused tests to preserve the old visual shape while making cache usage explicit
  • document the showSessionTokens behavior in the README

Linked Issue

  • No linked issue. This is a small, user-facing clarification to make session token semantics match the underlying cache-aware accounting without changing the established layout.

OpenCode Validation

  • Tested against OpenCode 1.14.39
  • Verified behavior against cache-aware session token data paths already exposed by the plugin's quota stats layer
  • Local OpenCode config was switched to a tarball build from this branch for follow-up manual verification

Quality Checklist

  • npm run build
  • npm run typecheck
  • npm test -- --run tests/session-tokens-format.test.ts tests/format.test.ts tests/quota-command-format.test.ts tests/tui-sidebar-format.test.ts tests/tui-compact-format.test.ts tests/quota-stats.test.ts
  • Updated README for the user-facing session token behavior

Copilot AI review requested due to automatic review settings May 6, 2026 08:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the session token summary model to carry cached input and combined (new + cached) input totals, and updates the various renderers (full rows, sidebar summary, and compact/TUI status line) to display a richer token breakdown when cache data is present.

Changes:

  • Add cachedInput and totalInput to per-model session token rows, plus aggregate totalCachedInput and totalCombinedInput.
  • Update session token formatting to render new, cache, in (combined), and out where applicable, including compact/sidebar variants.
  • Update/extend tests to lock in the new display semantics across formats.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/tui-sidebar-format.test.ts Updates sidebar expectations to include new/cache/combined token display.
tests/tui-compact-format.test.ts Updates compact status line expectations for cache-aware token breakdown.
tests/session-tokens-format.test.ts Adds coverage for cache-aware rendering in both detailed and sidebar-summary renderers.
tests/quota-command-format.test.ts Updates /quota output expectations to include cache breakdown.
tests/format.test.ts Adds coverage for cache-aware session token rendering in single/all window toast formats.
src/lib/tui-compact-format.ts Renders cache-aware token segment in the compact/TUI status line.
src/lib/session-tokens.ts Threads cache/combined totals through the display fetch result.
src/lib/session-tokens-format.ts Implements cache-aware formatting for detailed + compact + sidebar-summary session token sections.
src/lib/quota-stats.ts Aggregates cached input and combined input in getSessionTokenSummary.
src/lib/entries.ts Extends the session token data interfaces to include cached + combined input fields.

Comment thread src/lib/session-tokens-format.ts Outdated
Comment thread src/lib/tui-compact-format.ts Outdated
Comment thread src/lib/session-tokens-format.ts
Comment thread src/lib/session-tokens-format.ts Outdated
@MRNAQA MRNAQA changed the title Add cached input to session token displays Keep session token layout and show cached input hint May 6, 2026
@MRNAQA MRNAQA changed the title Keep session token layout and show cached input hint show cached input hint with input/output tokens (codex style) May 6, 2026
@slkiser
Copy link
Copy Markdown
Owner

slkiser commented May 8, 2026

@MRNAQA Thanks for the contribution

@slkiser slkiser merged commit fc132df into slkiser:main May 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants