2026-07-16 06:46:02 +01:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
/// Access gate from `grok_build_access_gate`.
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
|
pub struct GateInfo {
|
|
|
|
|
pub message: String,
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub url: Option<String>,
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub label: Option<String>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Typed auth metadata passed from the shell to the pager via ACP.
|
2026-07-18 19:48:28 +01:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2026-07-16 06:46:02 +01:00
|
|
|
pub struct AuthMeta {
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub email: Option<String>,
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub auth_mode: Option<String>,
|
|
|
|
|
/// Team principal UUID when the session is a team login (`None` for personal).
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub team_id: Option<String>,
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub team_name: Option<String>,
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub is_zdr: bool,
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub team_role: Option<String>,
|
2026-07-18 19:48:28 +01:00
|
|
|
/// Defaults to opted-out (safer) until auth meta is populated.
|
|
|
|
|
#[serde(default = "crate::auth::default_coding_data_retention_opt_out")]
|
2026-07-16 06:46:02 +01:00
|
|
|
pub coding_data_retention_opt_out: bool,
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub show_resolved_model: Option<bool>,
|
|
|
|
|
/// `Some` = user is blocked; `None` = user has access.
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub gate: Option<GateInfo>,
|
|
|
|
|
/// User-friendly display name for the current subscription tier
|
|
|
|
|
/// (e.g. "SuperGrok Heavy", "X Premium", "Free"). From CCP `/settings`.
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub subscription_tier: Option<String>,
|
|
|
|
|
}
|
2026-07-18 19:48:28 +01:00
|
|
|
|
|
|
|
|
impl Default for AuthMeta {
|
|
|
|
|
fn default() -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
email: None,
|
|
|
|
|
auth_mode: None,
|
|
|
|
|
team_id: None,
|
|
|
|
|
team_name: None,
|
|
|
|
|
is_zdr: false,
|
|
|
|
|
team_role: None,
|
|
|
|
|
coding_data_retention_opt_out: crate::auth::default_coding_data_retention_opt_out(),
|
|
|
|
|
show_resolved_model: None,
|
|
|
|
|
gate: None,
|
|
|
|
|
subscription_tier: None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|