Repository navigation
feat(status-bar): mirror CLI status bar with per-conversation tokens and tools count - #216
Merged
Merged
Conversation
…and tools count Fold TokenReadout into StatusBar as one dim, dot-separated row (Tools, in, out, cached, tool calls). Token usage now lives in the per-conversation chat reducer so it switches with the active chat and drops on delete. The tools list is fetched once the CLI is ready (and after Restart CLI) instead of lazily on the !! picker. Settings gets a Show status bar checkbox backed by chat.status_bar.enabled in the CLI config, so one toggle drives both. Closes #213
This was referenced Sep 12, 2026
edenreich
marked this pull request as ready for review
September 12, 2026 16:19
edenreich
commented
Sep 12, 2026
Contributor
Author
|
Token counters depend on inference-gateway/cli#1186 (the CLI currently emits |
This was referenced Sep 12, 2026
The CLI (inference-gateway/cli#1187) puts the stats under result, not stats, and the totals are cumulative for the whole session, so the reducer now replaces the conversation's usage instead of adding to it.
edenreich
pushed a commit
to inference-gateway/cli
that referenced
this pull request
Sep 12, 2026
) Resolves #1186 ## Summary `RUN_FINISHED` now carries the per-session token, cost, and tool-call totals in its `result`, as `docs/ag-ui-output.md` already promised. `RenderAGUI` receives the conversation repository and reads the same stats `RenderJSON` reports in its `session_stats` line, so AG-UI consumers (the desktop sidecar, inference-gateway/desktop#216) see real usage instead of zeros. ## Changes - `RenderAGUI` now takes the conversation repository; after a successful run it attaches `sessionResult` to the terminal `RUN_FINISHED` through the AG-UI SDK's `WithResult` option. - `result` keys: `inputTokens`, `outputTokens`, `cacheReadTokens`, `totalToolCalls` (counted from the session's assistant messages), `cost`, `lastInputTokens`, `contextWindow` (omitted when the model's window is unknown). - Gated exactly like `RenderJSON`: a run with no model requests (e.g. a shortcut answer) emits `RUN_FINISHED` without `result`. - Both call sites updated: headless `renderStream` and the browser extension bridge (which now passes its repo, so the desktop panel's AG-UI path benefits too). - `render_test.go`: `TestRenderAGUI_RunFinishedCarriesSessionStats` asserts every field is present and non-zero for a run with at least one request, plus the zero-request case; `docs/ag-ui-output.md` documents the exact key names. ## Affected repos - inference-gateway/desktop: parser can now consume `result` (desktop#216, desktop#217, desktop#218); follow-up tracking issue filed there. Co-authored-by: inference-gateway-maintainer[bot] <246577062+inference-gateway-maintainer[bot]@users.noreply.github.com>
Contributor
|
🎉 This PR is included in version 0.32.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Phase 1 of #213: the desktop status row now shows what the CLI's status bar shows from the data the desktop already has. Token counters are per conversation,
Tools: Nis visible before the first prompt, and aShow status barsetting is persisted to the CLI keychat.status_bar.enabledso one toggle drives both the CLI and the desktop.Closes #213
Changes
StatusBar.tsx: single rowTools: N · in: N · out: N · cached: N · tool calls: Nbetween the agent-status button and the auto-mode toggle; returns null when the setting is off.#status-bar,Agent statusaria-label and the Shift+Tab toggle are unchanged.TokenReadout.tsxremoved.transcript.ts:ChatState.usageholds the CLI's session totals per conversation (eachRUN_FINISHEDcarries cumulative stats, so the reducer replaces rather than adds); resets on new chat, dropped with the transcript on delete. Reopened history starts at zero (ponytail:note).store.tsx: global accumulator removed;toolsfetched vialist_toolson CLIReady(start and restart);showStatusBarloaded from config at startup.Composer.tsx:!!picker reads the store's tools list instead of fetching lazily.SettingsView.tsx: nativeShow status barcheckbox; saving pushes the value into the store so the row hides without a restart.backend/src/config.rs:status_bar_enabledonDesktopConfig, read viabool_at(["chat","status_bar","enabled"]), written withset_section, default true. Round-trip test added.backend/src/agent.rs: reads the stats fromRUN_FINISHED.result(fix(render): carry session stats in the AG-UI RUN_FINISHED result cli#1187), falling back tostats.transcript.test.ts: two conversations, separate totals, reset on new chat.Token columns need inference-gateway/cli#1187 to show non-zero values.
Phase 2 (not in this PR)
Filed as separate issues, linked from #213: #217 (context usage %), #218 (cost), #219 (MCP / A2A live counts).
Docs ticket draft (inference-gateway/docs)
Title: [DOCS] Desktop status bar and
chat.status_bar.enabledsettingBody: Document the desktop status row (tools count, per-conversation token usage) and the Settings > General > Show status bar checkbox, noting it shares
chat.status_bar.enabledwith the CLI. Source: this PR.Affected pages: desktop settings / desktop overview.