Repository navigation
feat(agent): per-call output speed (tokens/sec) for desktop status bar and runtime footer - #44878
beresfordsalmon wants to merge 12 commits into
Conversation
…r and runtime footer Store last_api_duration and last_output_tokens on the agent after each API call so the gateway can compute output_speed for the desktop status bar and runtime footer tps field. - run_agent.py: initialize last_api_duration / last_output_tokens - agent/conversation_loop.py: persist per-call timing + token counts - tui_gateway/server.py: compute output_speed in _get_usage() - cli.py: expose output_speed in CLI status bar (show_output_speed config) - gateway/runtime_footer.py: add tps field for gateway platforms - gateway/run.py: wire per-call stats into footer + agent result - hermes_cli/config.py: add display.show_output_speed toggle (default off) Closes #9527
- Add /tps to command registry - Add _show_tps handler in CLI - Add session.tps RPC in gateway server - Pass gateway port + session_id to slash worker - Slash worker calls session.tps when local agent has no data
…eate was missing it)
…handles /tps directly)
tonydwb
left a comment
There was a problem hiding this comment.
Good feature addition. Adds per-call output speed (tokens/sec) display to desktop status bar, runtime footer, and /tps CLI command. Tracks last_api_duration and last_output_tokens per call. Clean implementation across 11 files. No issues found.
peak_speed = (last_output_tokens + session_reasoning_tokens) / last_api_duration This is the true decode rate including hidden reasoning tokens. - _get_usage() now emits peak_speed in every session.info event - CLI _get_status_bar_snapshot() also exposes peak_speed - peak_speed is available to the desktop status bar via currentUsage?.peak_speed (frontend must opt-in: s/output_speed/peak_speed in use-statusbar-items.tsx)
|
I was thinking on doing a plugin for my Desktop then found this PR. |
|
This was generated by AI during triage. Summary: Problems: Solution: Evidenceno deterministic fact backs this claim — model belief, not executed or read evidence Checked against |
Resolve conflicts from two months of main drift: - gateway/runtime_footer.py: keep both turn_seconds (main) and response_tokens/elapsed_ms (PR) params on build_footer_line. - gateway/run.py: re-apply last_output_tokens/last_api_duration capture inside the extracted TurnRunner result path (run_sync moved to gateway/turn_runner ctx flow on main). - hermes_cli/config_defaults.py: DEFAULT_CONFIG moved out of config.py; add display.show_output_speed there. - tui_gateway: server.py split into methods_*.py on main — re-apply session.tps RPC in methods_session.py and the direct /tps handler in methods_tools.py slash.exec; keep _get_usage output_speed/peak_speed. Drop dead HERMES_SLASH_GATEWAY_PORT env plumbing (superseded by the direct slash.exec handler within the PR's own commit history). - cli.py: re-apply /tps dispatch + _show_tps + status-bar t/s segment on top of the battery-item refactor. - apps/desktop i18n: add missing shell.statusbar.tokensPerSecond key (en/zh/zh-hant/ja/ar + types).
…issing i18n - tui_gateway/server.py: numeric-coerce last_api_duration/last_output_tokens in _get_usage so partially-built agents and test doubles (MagicMock) can't crash the usage snapshot with a TypeError on comparison. - hermes_cli/commands.py: route /tps via /hermes tps on Slack (_SLACK_VIA_HERMES_ONLY) — a native slot at the 50-slash cap would clamp /insights and break Telegram parity. - contributors/emails: map mcsal@local -> beresfordsalmon (CI attribution gate).
|
Rebased this onto current main (merge commit, contributor commits preserved) and hardened it as part of the weekly Kilo Code scout run (their #12434/#13164 ship the same tok/s display, which independently validates the feature):
Targeted suites green: runtime_footer + tui_gateway_server + commands + turn_summary (726 passed). Awaiting Teknium's review. |
|
Please merge this ASAP |
|
@beresfordsalmon why was this closed? 😞 |
Summary
Stores per-API-call timing and token counts on the agent so downstream consumers (desktop status bar, gateway runtime footer, CLI status bar) can display real-time tokens-per-second.
last_api_duration/last_output_tokenson agentapi_duration+output_tokensafter each successful API responseoutput_speedin_get_usage()(read by desktopsession.infoevents andsession.usageRPC)output_speedin TUI status bar whendisplay.show_output_speedis enabledtpsfield for gateway platforms (messaging, desktop response footer)display.show_output_speedtoggle (default off)Validation
conversation_loop.pySETslast_api_durationandlast_output_tokens(confirmed via debug log)tui_gateway/server.py_get_usage()reads them and emitsoutput_speed(confirmed 48.0 tok/s for DeepSeek v4 Pro)output-speedstatus bar item (needs rebuild to display)Closes #9527
Closes #26877