Skip to main content

oxios_kernel/token_maxing/
mod.rs

1//! Token Maxing Mode (RFC-031).
2//!
3//! Autonomous burn of subscription-quota providers during a user-configured
4//! time window. The hard rule: **only subscription providers** are eligible —
5//! metered keys can never be silently drafted into a maxing run.
6//!
7//! Architecture:
8//!
9//! - [`config`] — TOML schema (`[token-maxing]`).
10//! - [`budget`] — `ProviderBudget`, the self-tracked counter. Reuses the
11//!   `BudgetManager` window+reset pattern, re-keyed by provider.
12//! - [`quota_tracker`] — `QuotaTracker`, the decision layer that merges
13//!   self-tracked, recalibration, and reactive 429 signals into one
14//!   `Availability` verdict per provider.
15//! - [`planner`] — `WorkPlanner`, three-source task synthesis (autonomous
16//!   skills → projects/mounts → recurring patterns). (Phase 3.)
17//! - [`maxer`] — `TokenMaxer`, the drain → rotate → wait → resume loop.
18//!   (Phase 3.)
19//! - [`session`] — `TokenMaxingSession` + persisted report. (Phase 3.)
20//!
21//! The non-obvious invariant is the eligibility check: providers missing
22//! from `[token-maxing.providers]` (or any with `billing_model !=
23//! "subscription"`) are **never** eligible. This is the single choke point
24//! that upholds the user's "절대 동작하면 안 된다" constraint.
25
26pub mod budget;
27pub mod config;
28pub mod maxer;
29pub mod planner;
30pub mod quota_tracker;
31pub mod session;
32
33pub use budget::{ProviderBudget, ProviderSnapshot, ProviderState, ReserveError};
34pub use config::{SUBSCRIPTION_BILLING_MODEL, TokenMaxingConfig, TokenMaxingProviderConfig};
35pub use maxer::TokenMaxer;
36pub use planner::{PlannedTask, WorkPlanner};
37pub use quota_tracker::{
38    Availability, CooldownRecord, QuotaTracker, QuotaTrackerSnapshot, RecalibrationOutcome,
39    RecalibrationRecord,
40};
41pub use session::{
42    MaxerStatus, MaxingStart, MaxingWindow, ProviderSessionRecord, ProviderWindowRecord,
43    SessionTotals, StopReason, TaskRecord, TaskSource, TokenMaxingSession,
44};