From b09f62a1c365dc75b6d663523bd89f54f24f2dd2 Mon Sep 17 00:00:00 2001 From: Colin Young Date: Mon, 6 Oct 2025 18:59:37 -0700 Subject: [PATCH] [Codex] Use Number instead of BigInt for TokenCountEvent (#4856) Adjust to use typescript number so reduce casting and normalizing code for VSCE since js supports up to 2^53-1 --- codex-rs/protocol/src/protocol.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index bdd1d3e2..3b6520be 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, } @@ -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, /// Seconds until the window resets. + #[ts(type = "number | null")] pub resets_in_seconds: Option, }