Files
codex/codex-rs/tui/src/analytics/tool_panel.rs
T
Felipe Coury ca53e19c75 Add an account analytics dashboard to /usage (#45764)
## What changed

- Add “Explore analytics” to the `/usage` menu for ChatGPT accounts, opening a full-screen dashboard.
- Show usage and messages for consumer accounts, credits and token usage for Business and Enterprise accounts, and plugin and skill activity for both.
- Support overview and maximized views, 7- and 30-day ranges, report grouping, daily details, model filtering for token usage, and refresh.
- Keep report loading and errors independent, cancel pending loads on close, and retain navigation state across reopening while preserving the composer draft.

## Testing

Add regression and snapshot coverage for account-specific reports, range and grouping changes, model filtering, loading and cancellation, small terminals, terminal colors, and draft preservation.

GitOrigin-RevId: 46da94a14d6e227551e740b85f9d2d552aaf75b0
2026-09-15 19:01:41 +00:00

27 lines
731 B
Rust

//! Human-readable plugin and skill labels.
pub(super) fn tool_name(label: &str) -> String {
let label = match label.split_once(':') {
Some((namespace, name)) if namespace.trim().eq_ignore_ascii_case(name.trim()) => {
name.trim()
}
_ => label,
};
label
.split_whitespace()
.map(|word| match word.to_ascii_lowercase().as_str() {
"pr" => "PR",
"cli" => "CLI",
"api" => "API",
"ide" => "IDE",
"mcp" => "MCP",
"sdk" => "SDK",
"ui" => "UI",
"tui" => "TUI",
"openai" => "OpenAI",
_ => word,
})
.collect::<Vec<_>>()
.join(" ")
}