Skip to main content

oxios_kernel/token_maxing/
mod.rs

1//! Token Maxing Mode (RFC-031 v2).
2//!
3//! Autonomous burn of subscription-quota providers during a user-configured
4//! time window. v2 derives eligibility from live quota API responses
5//! instead of the v1 `[[token-maxing.providers]]` opt-in block.
6//!
7//! Architecture:
8//!
9//! - [`config`] — TOML schema (`[token-maxing]`). The v1
10//!   `[[token-maxing.providers]]` block is now optional — providers
11//!   are auto-discovered when a live subscription snapshot exists.
12//! - [`budget`] — `ProviderBudget`, the self-tracked counter. Fallback
13//!   when no live quota API exists.
14//! - [`live_quota`] — kernel-side `QuotaSnapshot`/`PlanType`/
15//!   `QuotaFetcher` trait. The v2 eligibility signal #1.
16//! - [`quota_tracker`] — `QuotaTracker`, the decision layer. v2 reads
17//!   live snapshots first; v1 config gate is the fallback.
18//! - [`planner`], [`maxer`], [`session`] — Phase 3.
19
20pub mod budget;
21pub mod config;
22pub mod live_quota;
23pub mod maxer;
24pub mod planner;
25pub mod quota_tracker;
26pub mod session;
27
28pub use budget::{ProviderBudget, ProviderSnapshot, ProviderState, ReserveError};
29pub use config::{SUBSCRIPTION_BILLING_MODEL, TokenMaxingConfig, TokenMaxingProviderConfig};
30pub use live_quota::{PlanType, QuotaFetcher, QuotaSnapshot, RateWindow};
31pub use maxer::TokenMaxer;
32pub use planner::{PlannedTask, WorkPlanner};
33pub use quota_tracker::{
34    Availability, CooldownRecord, QuotaTracker, QuotaTrackerSnapshot, RecalibrationOutcome,
35    RecalibrationRecord,
36};
37pub use session::{
38    MaxerStatus, MaxingStart, MaxingWindow, ProviderSessionRecord, ProviderWindowRecord,
39    SessionTotals, StopReason, TaskRecord, TaskSource, TokenMaxingSession,
40};