feat(console): Analytics dashboard for cross-agent spend (#344) - #446
Merged
github-actions[bot] merged 3 commits intoSep 3, 2026
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideThis PR adds a protected Console Analytics experience that derives honest cross-agent spend, token-kind, sandbox-activity, and declared-delegation views from existing APIs, with responsive no-library SVG visualizations, navigation/documentation updates, and focused unit, UI, and verification coverage. Sequence diagram for loading the protected Analytics routesequenceDiagram
actor Operator
participant AppShell
participant Analytics
participant UsageAPI as Usage API
participant AgentsAPI as Agents API
Operator->>AppShell: navigate to /analytics
alt unauthenticated
AppShell-->>Operator: redirect to /login
else authenticated
AppShell->>Analytics: render Analytics
Analytics->>UsageAPI: GET /v1/usage?group_by=agent&days=7
Analytics->>AgentsAPI: GET /v1/agents?limit=100
UsageAPI-->>Analytics: usage summary
AgentsAPI-->>Analytics: agent roster
Analytics-->>Operator: render KPIs and SVG views
end
Flow diagram for Analytics data derivationflowchart TD
Usage[Range-scoped usage payload] --> KPIs[KPI strip: spend, tokens, sessions, agents]
Usage --> TokenMix[Token mix by kind]
Usage --> Cost[Cost by agent: top 10 plus Others]
Usage --> Daily[Daily sandbox-active seconds]
Agents[Agent multiagent rosters] --> Delegation[Declared delegation edges]
Delegation --> Roster[Ranked roster and desktop node-link view]
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Pure AnalyticsSnapshot model for the #344 first slice: Sonnet-class cost-by-agent (top 10 + others), token mix by kind, daily buckets, and declared multiagent delegation edges. No new backend. Co-authored-by: duyet <duyet@users.noreply.github.com>
Dedicated Analytics page charts estimated spend, token mix by kind, cost by agent, daily sandbox activity, and declared callable-agent rosters from existing GET /v1/usage and GET /v1/agents. Inline SVG only; no new backend or charting library. Co-authored-by: duyet <duyet@users.noreply.github.com>
Map /analytics into control-oma so a no-secrets run can prove the signed-out redirect without minting credentials. Co-authored-by: duyet <duyet@users.noreply.github.com>
cursor
Bot
force-pushed
the
cursor/console-analytics-dashboard-cdb7
branch
from
September 3, 2026 18:59
b72e5aa to
ec4b26e
Compare
Merged
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.
First slice of #344 (part of #347): a dedicated Console Analytics page for cross-agent estimated spend, token mix, and declared delegation.
Rebased onto
origin/main(2988ab72, includes Monitor #444, HITL #448, output_file #447). Does not close #344.Why
Dashboard KPIs and the Usage tables are tenant-global and shallow. An operator with many agents cannot answer “who is spending?” or “who can call whom?” from one screen. The existing APIs already carry enough for an honest first cut.
Scope
/analyticsroute, sidebar item, command-palette entry (g y).1d | 7d | 30d(default7d) viaGET /v1/usage?group_by=agent&days=N.GET /v1/agents/:id/stats.daily[]actually contains).GET /v1/agentsmultiagentrosters. Ranked list always, compact SVG node-link on desktop.AGENTS.md,docs/features.md, landing Multi-Agent card.verify-omarecipeconsole-analyticsfor the signed-out gate. Rebase keptconsole-login-mobilefrom main.Usage, Dashboard, CLI, and the control-plane API are unchanged. No charting library. No new endpoint.
Tradeoffs
usage_eventshas no model id, anddaily[]is{ date, active_seconds, runs }only. Scanning session event logs forcall_agent_*would miss the “no new endpoint / page load < 2s” bar. This slice therefore:Those limits are labeled in the UI so the page does not pretend to have data we do not store.
Blast Radius
/analyticsonly (plus a one-line landing-card sentence).GET /v1/usageandGET /v1/agentsare already used by Usage/Dashboard. Analytics adds a range-scoped usage fetch withstaleTime: 5 min./analyticsstill hitsAppShelland redirects to/login..cursor/skills/verify-oma/SKILL.mdandcontrol-oma.mjs(kept bothconsole-login-mobileandconsole-analytics). Other likely-conflict surfaces auto-merged: AppSidebar, CommandPalette, AGENTS.md, docs/features.md, FeaturesSection.Verification
pnpm --filter managed-agents-console typecheck— pass (after rebase)pnpm --filter managed-agents-console test— 69 files, 496 tests passtest/integration/recovery-do.test.ts“does NOT clobber its own heartbeat” — pass locally. Not in this PR’s diff. Prior CI failure on run 33789233067 treated as stale-base / flake; not rewritten.verify-oma(no secrets, Console only, API worker not started):launch console→doctor→drive console-analytics/analyticsredirected to/login;Welcome backvisibleanalytics-charts/analytics-emptyskipped (no session).cursor/skills/verify-oma/artifacts/2026-09-03T19-00-01-199Z/console-analytics/Summary by Sourcery
Add a cross-agent Console Analytics view for estimated spend, token usage, activity, and declared delegation using existing APIs.
New Features:
Enhancements:
Documentation:
Tests:
Chores: