mirror of
https://github.com/openai/codex.git
synced 2026-11-10 21:00:47 +00:00
## What changed - Extend `account/usage/read` with an optional `threadId` request and a backward-compatible `threadUsage` response containing estimated credits, optional USD cost, and model, reasoning, speed, and token breakdowns. - Fetch thread usage for eligible Business and Enterprise plans when `/status` is opened, then update the rendered status card asynchronously. - Preserve terminal scrollback when replacing a visible status-card tail, and append a refreshed card when the original tail can no longer be updated. ## Testing - Add app-server coverage for authentication, canonical thread IDs, unavailable billing routes, and malformed IDs. - Add TUI coverage for usage formatting, stale responses, retries, history updates, terminal reflow, and scrollback preservation. GitOrigin-RevId: 49300914b3fba917c0f08e8595363e04e5ba6d37
36 lines
1.3 KiB
Rust
36 lines
1.3 KiB
Rust
//! Status output formatting and display adapters for the TUI.
|
|
//!
|
|
//! This module turns protocol-level snapshots into stable display structures used by `/status`
|
|
//! output and footer/status-line helpers, while keeping rendering concerns out of transport-facing
|
|
//! code.
|
|
//!
|
|
//! `rate_limits` is the main integration point for status-line usage-limit items: it converts raw
|
|
//! window snapshots into local-time labels and classifies data as available, stale, or missing.
|
|
mod account;
|
|
mod card;
|
|
mod format;
|
|
mod helpers;
|
|
mod rate_limits;
|
|
pub(crate) mod remote_connection;
|
|
mod thread_usage;
|
|
|
|
pub(crate) use account::StatusAccountDisplay;
|
|
pub(crate) use card::StatusHistoryHandle;
|
|
#[cfg(test)]
|
|
pub(crate) use card::new_status_output;
|
|
#[cfg(test)]
|
|
pub(crate) use card::new_status_output_with_rate_limits;
|
|
pub(crate) use card::new_status_output_with_rate_limits_handle;
|
|
pub(crate) use helpers::compose_agents_summary;
|
|
pub(crate) use helpers::format_directory_display;
|
|
pub(crate) use helpers::format_tokens_compact;
|
|
pub(crate) use helpers::plan_type_display_name;
|
|
pub(crate) use rate_limits::RateLimitSnapshotDisplay;
|
|
pub(crate) use rate_limits::RateLimitWindowDisplay;
|
|
#[cfg(test)]
|
|
pub(crate) use rate_limits::rate_limit_snapshot_display;
|
|
pub(crate) use rate_limits::rate_limit_snapshot_display_for_limit;
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|