Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

[Codex] Use Number instead of BigInt for TokenCountEvent (#4856)

Colin Youngb09f62a1c365
diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs
index bdd1d3e241..3b6520be67 100644
--- a/codex-rs/protocol/src/protocol.rs
+++ b/codex-rs/protocol/src/protocol.rs
@@ -548,10 +548,15 @@ pub struct TaskStartedEvent {
#[derive(Debug, Clone, Deserialize, Serialize, Default, TS)]
pub struct TokenUsage {
+ #[ts(type = "number")]
pub input_tokens: u64,
+ #[ts(type = "number")]
pub cached_input_tokens: u64,
+ #[ts(type = "number")]
pub output_tokens: u64,
+ #[ts(type = "number")]
pub reasoning_output_tokens: u64,
+ #[ts(type = "number")]
pub total_tokens: u64,
}
@@ -559,6 +564,7 @@ pub struct TokenUsage {
pub struct TokenUsageInfo {
pub total_token_usage: TokenUsage,
pub last_token_usage: TokenUsage,
+ #[ts(type = "number | null")]
pub model_context_window: Option<u64>,
}
@@ -634,8 +640,10 @@ pub struct RateLimitWindow {
/// Percentage (0-100) of the window that has been consumed.
pub used_percent: f64,
/// Rolling window duration, in minutes.
+ #[ts(type = "number | null")]
pub window_minutes: Option<u64>,
/// Seconds until the window resets.
+ #[ts(type = "number | null")]
pub resets_in_seconds: Option<u64>,
}