Skip to content

feat: token usage dashboard in Dune UI#92

Closed
DorianZheng wants to merge 1 commit into
mainfrom
feat/usage-dashboard
Closed

feat: token usage dashboard in Dune UI#92
DorianZheng wants to merge 1 commit into
mainfrom
feat/usage-dashboard

Conversation

@DorianZheng

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a new 'Usage' section to Dune Settings (after Models)
  • Shows total cost and tokens for current project (all-time and last 7 days)
  • Breaks down by agent and by model with CSS bar charts (no new deps)
  • Pulls data via usage_get_summary AgentLite action through IPC bridge
  • Graceful degradation when AgentLite action is unavailable

Files changed

  • src/shared/electron/ipc-channels.ts — new IPC channel
  • src/electron/preload.ts — usageSummary bridge method
  • src/electron/main/ — IPC handler wiring to agentLiteRuntime
  • src/renderer/features/settings/types.ts — added 'usage' route
  • src/renderer/features/settings/components/UsageSettings.tsx — new component
  • src/renderer/features/settings/config/settings-sections.ts — registered section
  • src/renderer/app/global.d.ts — type declarations

Test plan

  • 'Usage' appears in Settings sidebar
  • All time / Last 7 days toggle works
  • Agent bar chart sorted by cost desc
  • Model bar chart sorted by cost desc
  • Empty state shown when no data
  • Loading skeleton shows during fetch
  • Unavailable banner shown when AgentLite returns null

🤖 Generated with Claude Code / Codex

@DorianZheng DorianZheng force-pushed the feat/usage-dashboard branch from 1bfc829 to a9098a1 Compare April 24, 2026 16:59
Adds a new 'Usage' section to Dune Settings showing per-agent and
per-model token consumption and cost. The UI is built speculatively
against the planned AgentLite usage_get_summary action — the IPC
handler returns null gracefully until that action is available, and
the component shows a clear "not yet available" banner in that state.

Changes:
- ipc-channels.ts: add getUsageSummary channel
- desktop-bridge.ts: add UsageSummaryResult types + getUsageSummary method
- preload.ts: wire IPC call through context bridge
- main.ts: add IPC handler (returns null until AgentLite tracking lands)
- desktop-runtime-controller.ts: stub getUsageSummary returning null
- types.ts: add 'usage' to SettingsRoute union
- UsageSettings.tsx: full component with time range toggle, stat cards,
  CSS bar charts by agent and by model, skeleton loading, and unavailable banner
- settings-sections.ts: register Usage section between Shortcuts and Nuclear
- settings-sections.test.ts: update expected section order

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@DorianZheng DorianZheng force-pushed the feat/usage-dashboard branch from a9098a1 to 87f8bed Compare April 24, 2026 17:02
@DorianZheng

Copy link
Copy Markdown
Collaborator Author

Fixed the two review blockers:

  • Rebuilt feat/usage-dashboard from origin/main and force-pushed only the usage dashboard commit. The unrelated Telegram commits are no longer in this PR.
  • Replaced the getUsageSummary stub with a real AgentLite action call path for usage_get_summary, returning null on unavailable/failure as intended.

Verification: npx tsc --noEmit passes in /tmp/usage-fix.

@DorianZheng

Copy link
Copy Markdown
Collaborator Author

Replaced by #95 from clean branch fix/usage-dashboard-blockers. The replacement branch contains only the dashboard commit plus the getUsageSummary AgentLite action wiring fix.

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.

1 participant