Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/desktop-tauri/src-tauri/src/auto_refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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()
};
Expand Down
1 change: 1 addition & 0 deletions apps/desktop-tauri/src-tauri/src/capacity_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop-tauri/src-tauri/src/commands/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub struct ProviderUsageSnapshot {
pub secondary_label: Option<String>,
pub model_specific: Option<RateWindowSnapshot>,
pub tertiary: Option<RateWindowSnapshot>,
pub tertiary_label: Option<String>,
pub extra_rate_windows: Vec<NamedRateWindowSnapshot>,
pub inactive_rate_windows: Vec<InactiveRateWindowSnapshot>,
pub promo_signals: Vec<PromoSignalSnapshot>,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions apps/desktop-tauri/src-tauri/src/enforcement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-tauri/src-tauri/src/powertoys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions apps/desktop-tauri/src-tauri/src/quota_run_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions apps/desktop-tauri/src-tauri/src/taskbar_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions apps/desktop-tauri/src-tauri/src/tray_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop-tauri/src/lib/capacityPresentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions apps/desktop-tauri/src/types/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ export interface ProviderUsageSnapshot {
secondaryLabel?: string;
modelSpecific: RateWindowSnapshot | null;
tertiary: RateWindowSnapshot | null;
tertiaryLabel?: string;
extraRateWindows: Array<{
id: string;
title: string;
Expand Down
13 changes: 13 additions & 0 deletions rust/src/core/usage_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ pub struct UsageSnapshot {
#[serde(skip_serializing_if = "Option::is_none")]
pub tertiary: Option<RateWindow>,

/// 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<String>,

/// 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<NamedRateWindow>,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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<String>) -> Self {
self.tertiary_label = Some(label.into());
self
}

/// Builder pattern: append a labeled extra rate window
pub fn with_extra_rate_window(
mut self,
Expand Down
14 changes: 8 additions & 6 deletions rust/src/providers/opencodego/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,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) {
Expand Down
Loading