mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Show task tokens and usage estimates in the agent command center (#44970)
## What changed - Display input/output token counts and estimated credits and USD cost in task details. Prefer live token totals, falling back to complete totals from usage breakdowns. - Fetch estimates for the selected task on a one-minute cadence for supported Business and Enterprise plans. Cache results, preserve prior nonzero estimates when a response reports zero, and stop fetching when the capability is unavailable. - Clear cached usage and discard pending results on account changes, reconnects, or missed server events. Prioritize activity and usage over the original prompt when space is limited. ## Testing Add a rendering snapshot and tests covering caching, stale results, unavailable usage, token resets, and incomplete usage breakdowns. GitOrigin-RevId: b72c96053557389fdc723a70fab0dab841a52e49
This commit is contained in:
1 parent
7efb0262d6
commit
aee8a55ab6
15 files changed
+533
-4
No files matched your search
@@ -36,6 +36,7 @@ pub(super) fn preview_markdown(text: &str) -> String {
|
||||
#[derive(Clone, Default)]
|
||||
pub(super) struct AgentsOverviewDetails {
|
||||
pub(super) lines: Vec<Line<'static>>,
|
||||
pub(super) usage_lines: Vec<Line<'static>>,
|
||||
pub(super) last_message: Option<(String, AbsolutePathBuf)>,
|
||||
}
|
||||
|
||||
@@ -216,6 +217,11 @@ impl App {
|
||||
.map(|message| (message.clone(), source.cwd.clone()));
|
||||
AgentsOverviewDetails {
|
||||
lines,
|
||||
usage_lines: ThreadId::from_string(&root.id)
|
||||
.ok()
|
||||
.and_then(|id| self.agents_overview.usage.get(&id))
|
||||
.map(super::agents_overview_usage::usage_lines)
|
||||
.unwrap_or_default(),
|
||||
last_message,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user