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
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 18 additions & 10 deletions crates/xcb-core/src/usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,32 @@ impl QuotaPoint {
}
}

/// The windows that carry account-scope quota for each provider. Claude uses
/// `five_hour`/`seven_day`; Codex's account-level ChatGPT windows arrive as
/// `codex.primary`/`codex.secondary`; Devin has no account-scope meter. The
/// same vocabulary gates admission (`quota_blocked_until`) and feeds the
/// read-only usage projection so a window that can block a lease is the same
/// window a projection reports.
pub fn account_windows(provider: Provider) -> &'static [&'static str] {
match provider {
Provider::Claude => &["five_hour", "seven_day"],
Provider::Codex => &["codex.primary", "codex.secondary"],
Provider::Devin => &[],
}
}

/// The latest observation in each known account-wide window is authoritative
/// until its reported reset, even after percentage telemetry becomes stale.
/// Claude uses `five_hour`/`seven_day`; Codex's account-level ChatGPT windows
/// arrive as `codex.primary`/`codex.secondary`. Callers must bind `pool` to the
/// current account credential generation; model-specific and other-provider
/// windows are deliberately not inferred to have account scope.
/// Callers must bind `pool` to the current account credential generation;
/// model-specific and other-provider windows are deliberately not inferred
/// to have account scope.
pub fn quota_blocked_until(
points: &[QuotaPoint],
pool: &Id,
provider: Provider,
now: u64,
) -> Option<u64> {
let windows: &[&str] = match provider {
Provider::Claude => &["five_hour", "seven_day"],
Provider::Codex => &["codex.primary", "codex.secondary"],
Provider::Devin => &[],
};
windows
account_windows(provider)
.iter()
.copied()
.filter_map(|window| {
Expand Down
2 changes: 1 addition & 1 deletion crates/xcb-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ workspace = true
[dependencies]
aes-gcm = "=0.11.1"
aicharts-core = { git = "https://github.com/hraness/aicharts", rev = "091433796f7253386c3e3186c67c275fb273b704", version = "0.1.0" }
algal = { git = "https://github.com/hraness/algal", rev = "2c7f86a257761dc1a2adaf064adc18dfcdf35925", version = "0.2.0" }
algal = { git = "https://github.com/hraness/algal", rev = "9922202a2da45bb1f7e0db82c0be5a1c6770c21b", version = "0.2.0" }
base64 = "=0.23.1"
convex = "=0.10.4"
getrandom = "=0.4.3"
Expand Down
Loading
Loading