From 0ff91b3aa7759eb873600d10a423bca4e32ce3ab Mon Sep 17 00:00:00 2001 From: tsouth89 Date: Sun, 2 Aug 2026 03:17:51 -0400 Subject: [PATCH] Show tertiary window label instead of 'Extra' for OpenCode Go monthly bar --- apps/desktop-tauri/src-tauri/src/auto_refresh.rs | 2 ++ .../desktop-tauri/src-tauri/src/capacity_events.rs | 1 + .../desktop-tauri/src-tauri/src/commands/bridge.rs | 3 +++ apps/desktop-tauri/src-tauri/src/enforcement.rs | 1 + apps/desktop-tauri/src-tauri/src/powertoys.rs | 2 ++ .../src-tauri/src/quota_run_history.rs | 1 + apps/desktop-tauri/src-tauri/src/taskbar_widget.rs | 1 + apps/desktop-tauri/src-tauri/src/tray_bridge.rs | 1 + apps/desktop-tauri/src/lib/capacityPresentation.ts | 2 +- apps/desktop-tauri/src/types/bridge.ts | 1 + rust/src/core/usage_snapshot.rs | 13 +++++++++++++ rust/src/providers/opencodego/mod.rs | 14 ++++++++------ 12 files changed, 35 insertions(+), 7 deletions(-) diff --git a/apps/desktop-tauri/src-tauri/src/auto_refresh.rs b/apps/desktop-tauri/src-tauri/src/auto_refresh.rs index 7b0d4348..942122c0 100644 --- a/apps/desktop-tauri/src-tauri/src/auto_refresh.rs +++ b/apps/desktop-tauri/src-tauri/src/auto_refresh.rs @@ -226,6 +226,7 @@ mod tests { secondary_label: Some("Weekly".into()), model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), @@ -268,6 +269,7 @@ mod tests { primary: window_resetting_at(Some("2026-07-21T05:00:00Z")), secondary: Some(window_resetting_at(Some("2026-07-28T02:00:00Z"))), tertiary: Some(window_resetting_at(None)), + tertiary_label: None, model_specific: Some(window_resetting_at(Some("not-a-timestamp"))), ..sample_snapshot() }; diff --git a/apps/desktop-tauri/src-tauri/src/capacity_events.rs b/apps/desktop-tauri/src-tauri/src/capacity_events.rs index 3b471965..1ae19eee 100644 --- a/apps/desktop-tauri/src-tauri/src/capacity_events.rs +++ b/apps/desktop-tauri/src-tauri/src/capacity_events.rs @@ -946,6 +946,7 @@ mod tests { secondary_label: None, model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), diff --git a/apps/desktop-tauri/src-tauri/src/commands/bridge.rs b/apps/desktop-tauri/src-tauri/src/commands/bridge.rs index b30a54a8..089215f1 100644 --- a/apps/desktop-tauri/src-tauri/src/commands/bridge.rs +++ b/apps/desktop-tauri/src-tauri/src/commands/bridge.rs @@ -116,6 +116,7 @@ pub struct ProviderUsageSnapshot { pub secondary_label: Option, pub model_specific: Option, pub tertiary: Option, + pub tertiary_label: Option, pub extra_rate_windows: Vec, pub inactive_rate_windows: Vec, pub promo_signals: Vec, @@ -274,6 +275,7 @@ impl ProviderUsageSnapshot { .tertiary .as_ref() .map(RateWindowSnapshot::from_rate_window), + tertiary_label: usage.tertiary_label.clone(), extra_rate_windows: usage .extra_rate_windows .iter() @@ -361,6 +363,7 @@ impl ProviderUsageSnapshot { secondary_label: None, model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), diff --git a/apps/desktop-tauri/src-tauri/src/enforcement.rs b/apps/desktop-tauri/src-tauri/src/enforcement.rs index 00fa0a3b..6acd1b17 100644 --- a/apps/desktop-tauri/src-tauri/src/enforcement.rs +++ b/apps/desktop-tauri/src-tauri/src/enforcement.rs @@ -192,6 +192,7 @@ mod tests { secondary_label: Some("Weekly".into()), model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), diff --git a/apps/desktop-tauri/src-tauri/src/powertoys.rs b/apps/desktop-tauri/src-tauri/src/powertoys.rs index 573a35c7..e155cd2e 100644 --- a/apps/desktop-tauri/src-tauri/src/powertoys.rs +++ b/apps/desktop-tauri/src-tauri/src/powertoys.rs @@ -210,6 +210,7 @@ mod tests { secondary_label: None, model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), @@ -276,6 +277,7 @@ mod tests { secondary_label: None, model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), diff --git a/apps/desktop-tauri/src-tauri/src/quota_run_history.rs b/apps/desktop-tauri/src-tauri/src/quota_run_history.rs index 1d98c18a..cc78d8c0 100644 --- a/apps/desktop-tauri/src-tauri/src/quota_run_history.rs +++ b/apps/desktop-tauri/src-tauri/src/quota_run_history.rs @@ -862,6 +862,7 @@ mod tests { secondary_label: None, model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), diff --git a/apps/desktop-tauri/src-tauri/src/taskbar_widget.rs b/apps/desktop-tauri/src-tauri/src/taskbar_widget.rs index fa63dbf7..02dad2b1 100644 --- a/apps/desktop-tauri/src-tauri/src/taskbar_widget.rs +++ b/apps/desktop-tauri/src-tauri/src/taskbar_widget.rs @@ -2111,6 +2111,7 @@ mod tests { secondary_label: None, model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), diff --git a/apps/desktop-tauri/src-tauri/src/tray_bridge.rs b/apps/desktop-tauri/src-tauri/src/tray_bridge.rs index 35b09485..ac14e44f 100644 --- a/apps/desktop-tauri/src-tauri/src/tray_bridge.rs +++ b/apps/desktop-tauri/src-tauri/src/tray_bridge.rs @@ -1312,6 +1312,7 @@ mod tests { reserve_will_last_to_reset: false, reserve_eta_seconds: None, }), + tertiary_label: None, inactive_rate_windows: Vec::new(), extra_rate_windows: Vec::new(), promo_signals: Vec::new(), diff --git a/apps/desktop-tauri/src/lib/capacityPresentation.ts b/apps/desktop-tauri/src/lib/capacityPresentation.ts index a206bfc1..c8ab90dc 100644 --- a/apps/desktop-tauri/src/lib/capacityPresentation.ts +++ b/apps/desktop-tauri/src/lib/capacityPresentation.ts @@ -252,7 +252,7 @@ function nonPrimaryWindows( push("secondary", provider.secondaryLabel, provider.secondary, "Weekly"); push("model", null, provider.modelSpecific, "Model"); - push("tertiary", null, provider.tertiary, "Extra"); + push("tertiary", provider.tertiaryLabel, provider.tertiary, "Extra"); for (const extra of provider.extraRateWindows ?? []) { if (extra.id === "reset-credits") continue; push(`extra-${extra.id}`, extra.title, extra.window, extra.title); diff --git a/apps/desktop-tauri/src/types/bridge.ts b/apps/desktop-tauri/src/types/bridge.ts index 9370f13d..d2ba337d 100644 --- a/apps/desktop-tauri/src/types/bridge.ts +++ b/apps/desktop-tauri/src/types/bridge.ts @@ -429,6 +429,7 @@ export interface ProviderUsageSnapshot { secondaryLabel?: string; modelSpecific: RateWindowSnapshot | null; tertiary: RateWindowSnapshot | null; + tertiaryLabel?: string; extraRateWindows: Array<{ id: string; title: string; diff --git a/rust/src/core/usage_snapshot.rs b/rust/src/core/usage_snapshot.rs index 99c53afa..9d266637 100755 --- a/rust/src/core/usage_snapshot.rs +++ b/rust/src/core/usage_snapshot.rs @@ -211,6 +211,12 @@ pub struct UsageSnapshot { #[serde(skip_serializing_if = "Option::is_none")] pub tertiary: Option, + /// Label for the tertiary window, shown in the UI instead of the "Extra" + /// fallback. Set this when the tertiary slot has a known purpose (for + /// example "Monthly" for the OpenCode Go monthly quota). + #[serde(skip_serializing_if = "Option::is_none")] + pub tertiary_label: Option, + /// Additional labeled windows that do not fit the primary/secondary/model slots. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub extra_rate_windows: Vec, @@ -251,6 +257,7 @@ impl UsageSnapshot { secondary: None, model_specific: None, tertiary: None, + tertiary_label: None, extra_rate_windows: Vec::new(), inactive_rate_windows: Vec::new(), promo_signals: Vec::new(), @@ -280,6 +287,12 @@ impl UsageSnapshot { self } + /// Builder pattern: set a display label for the tertiary window + pub fn with_tertiary_label(mut self, label: impl Into) -> Self { + self.tertiary_label = Some(label.into()); + self + } + /// Builder pattern: append a labeled extra rate window pub fn with_extra_rate_window( mut self, diff --git a/rust/src/providers/opencodego/mod.rs b/rust/src/providers/opencodego/mod.rs index 12a6e865..2b4d9b7b 100644 --- a/rust/src/providers/opencodego/mod.rs +++ b/rust/src/providers/opencodego/mod.rs @@ -154,12 +154,14 @@ impl OpenCodeGoProvider { } if let Some((pct, reset)) = monthly { - snap = snap.with_tertiary(RateWindow::with_details( - pct, - Some(43200), - Some(now + chrono::Duration::seconds(reset)), - None, - )); + snap = snap + .with_tertiary(RateWindow::with_details( + pct, + Some(43200), + Some(now + chrono::Duration::seconds(reset)), + None, + )) + .with_tertiary_label("Monthly"); } if let Some(renews_at) = Self::extract_renewal(text) {