Skip to content

feat(status-bar): mirror CLI status bar with per-conversation tokens and tools count - #216

Merged
edenreich merged 3 commits into
mainfrom
feat/status-bar-cli-parity
Sep 12, 2026
Merged

edenreich merged 3 commits into
mainfrom
feat/status-bar-cli-parity

Conversation

@edenreich

@edenreich edenreich commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

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: N is visible before the first prompt, and a Show status bar setting is persisted to the CLI key chat.status_bar.enabled so one toggle drives both the CLI and the desktop.

Closes #213

Changes

  • StatusBar.tsx: single row Tools: N · in: N · out: N · cached: N · tool calls: N between the agent-status button and the auto-mode toggle; returns null when the setting is off. #status-bar, Agent status aria-label and the Shift+Tab toggle are unchanged.
  • TokenReadout.tsx removed.
  • transcript.ts: ChatState.usage holds the CLI's session totals per conversation (each RUN_FINISHED carries 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; tools fetched via list_tools on CLI Ready (start and restart); showStatusBar loaded from config at startup.
  • Composer.tsx: !! picker reads the store's tools list instead of fetching lazily.
  • SettingsView.tsx: native Show status bar checkbox; saving pushes the value into the store so the row hides without a restart.
  • backend/src/config.rs: status_bar_enabled on DesktopConfig, read via bool_at(["chat","status_bar","enabled"]), written with set_section, default true. Round-trip test added.
  • backend/src/agent.rs: reads the stats from RUN_FINISHED.result (fix(render): carry session stats in the AG-UI RUN_FINISHED result cli#1187), falling back to stats.
  • 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.enabled setting
Body: 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.enabled with the CLI. Source: this PR.
Affected pages: desktop settings / desktop overview.

…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
Comment thread frontend/lib/transcript.ts Resolved
@edenreich

Copy link
Copy Markdown
Contributor Author

Token counters depend on inference-gateway/cli#1186 (the CLI currently emits RUN_FINISHED without stats, so the in/out/cached/tool-calls columns read zero until that lands). Tools count and the Show status bar setting work today.

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>
@edenreich
edenreich merged commit cb9e1a8 into main Sep 12, 2026
1 check passed
@edenreich
edenreich deleted the feat/status-bar-cli-parity branch September 12, 2026 17:06
@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.32.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-maintainer inference-gateway-maintainer Bot added the released Shipped in a release label Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Status bar indicator should reflect what the CLI has

1 participant