Skip to content

desktop/src-tauri/crates/core/src/quota_history.rs

Comment 1, line 1

desktop/src-tauri/crates/core/src/quota_history.rs:1

//! Agent-independent quota history.

Comment 2, line 2

desktop/src-tauri/crates/core/src/quota_history.rs:2

//!

Comment 3, line 3

desktop/src-tauri/crates/core/src/quota_history.rs:3

//! Normalize account/rate-limit/remaining-quota observations into QuotaObservation

Comment 4, line 4

desktop/src-tauri/crates/core/src/quota_history.rs:4

//! and quota_history. These observations remain separate from recorded token usage;

Comment 5, line 5

desktop/src-tauri/crates/core/src/quota_history.rs:5

//! display independently and never convert requests/credits into usage tokens (data-contract).

Comment 6, line 6

desktop/src-tauri/crates/core/src/quota_history.rs:6

//! Copilot premium requests are the first integration. Other verified local quota formats

Comment 7, line 7

desktop/src-tauri/crates/core/src/quota_history.rs:7

//! can reuse this table/query interface; examples do not establish Warp or other-client support.

Comment 8, line 14

desktop/src-tauri/crates/core/src/quota_history.rs:14

/// One normalized quota observation, independent of Agent.

Comment 9, line 17

desktop/src-tauri/crates/core/src/quota_history.rs:17

/// Source snapshot time; use collection time only when absent.

Comment 10, line 19

desktop/src-tauri/crates/core/src/quota_history.rs:19

/// Statistics Agent name, such as "copilot".

Comment 11, line 21

desktop/src-tauri/crates/core/src/quota_history.rs:21

/// Quota identifier, such as "premium_interactions".

Comment 12, line 23

desktop/src-tauri/crates/core/src/quota_history.rs:23

/// Quota kind: rate_limit / credits / balance / subscription_window.

Comment 13, line 25

desktop/src-tauri/crates/core/src/quota_history.rs:25

/// Source unit: requests / credits / tokens / usd_minor, among others.

Comment 14, line 27

desktop/src-tauri/crates/core/src/quota_history.rs:27

/// Period limit; None means unlimited or unknown.

Comment 15, line 29

desktop/src-tauri/crates/core/src/quota_history.rs:29

/// Used amount; None is unknown, without substituting zero.

Comment 16, line 31

desktop/src-tauri/crates/core/src/quota_history.rs:31

/// Remaining amount; None is unknown.

Comment 17, line 36

desktop/src-tauri/crates/core/src/quota_history.rs:36

/// True only for verified local usage; account-wide cross-device totals use false.

Comment 18, line 41

desktop/src-tauri/crates/core/src/quota_history.rs:41

/// Latest quota row per (agent, quota_id), for the overview.

Comment 19, line 56

desktop/src-tauri/crates/core/src/quota_history.rs:56

/// Daily trend point: last observation on each local day.

Comment 20, line 65

desktop/src-tauri/crates/core/src/quota_history.rs:65

/// Skip identical snapshot times/fields; atomically replace corrections at the same time.

Comment 21, line 66

desktop/src-tauri/crates/core/src/quota_history.rs:66

/// Use source time for local-day grouping; equal values at a new time remain a new observation.

Comment 22, line 169

desktop/src-tauri/crates/core/src/quota_history.rs:169

/// Latest row per (agent, quota_id); agent=None selects all Agents.

Comment 23, line 205

desktop/src-tauri/crates/core/src/quota_history.rs:205

/// Daily trend for (agent, quota_id), selecting the last observation of each local day.

Comment 24, line 285

desktop/src-tauri/crates/core/src/quota_history.rs:285

// Identical source time and values: skip.

Comment 25, line 290

desktop/src-tauri/crates/core/src/quota_history.rs:290

// Changed values at the same source time: record the correction.