Detect plan tier from .claude.json; seed sane caps per tier (Pro/Max 5x/Max 20x)
This commit is contained in:
parent
106ad28f9f
commit
ef84257ddd
7 changed files with 236 additions and 7 deletions
|
|
@ -1,8 +1,9 @@
|
|||
//! Tauri command surface — every JS-callable function lives here.
|
||||
|
||||
use crate::paths::{list_wsl_distros, resolve_roots, ResolvedRoots};
|
||||
use crate::settings::{save as save_settings, Settings};
|
||||
use crate::settings::{save as save_settings, Caps, Settings};
|
||||
use crate::state::SharedState;
|
||||
use crate::tier::{detect as detect_tier, PlanTier};
|
||||
use crate::usage::{build_snapshot, UsageSnapshot};
|
||||
use crate::watch::refresh_and_emit;
|
||||
|
||||
|
|
@ -70,3 +71,22 @@ pub async fn quit_app(app: tauri::AppHandle) -> Result<(), String> {
|
|||
app.exit(0);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
pub struct TierInfo {
|
||||
/// The classified tier — `Pro`, `Max5x`, `Max20x`, etc.
|
||||
pub tier: PlanTier,
|
||||
/// Human-readable label for the UI ("Max 5×" / "Pro" / "Unknown").
|
||||
pub label: String,
|
||||
/// The caps that this tier maps to. The user's current Settings may
|
||||
/// differ if they tuned manually.
|
||||
pub recommended_caps: Caps,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn detect_plan_tier() -> Result<TierInfo, String> {
|
||||
let tier = detect_tier();
|
||||
let label = tier.label();
|
||||
let recommended_caps = tier.caps();
|
||||
Ok(TierInfo { tier, label, recommended_caps })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue