F3: Kimi inference pipeline + full grok cloud-surface excision

Sampler / inference (PRD F3):
- kimi_compat.rs: single adaptation point for the Kimi chat/completions
  dialect (thinking-field mapping, model_id stripping, empty-content
  tool-call message fix, stream_options.include_usage), with kimi-cli
  source citations
- Rate-limit handling reworked for Kimi/Moonshot semantics; UA kigi/{version}
- /models replaces the xAI models-v2 endpoint everywhere; idle model
  refresh carries X-Msh-* device headers only (X-XAI-Token-Auth and
  x-grok-client-mode/CLIENT_MODE_HEADER machinery deleted)

Cloud-surface excision (PRD §5, zero-egress):
- remote/ conversations lane, cli-chat-proxy-types crate, prod/ dir,
  share command, credit bar: deleted (single local session lane;
  paginate() replaces merge_and_paginate)
- Subscription/tier gate stack deleted end-to-end: AppView
  gate/tier/team/ZDR fields, app/subscription.rs watch loop,
  dispatch/billing.rs paywall + SuperGrok upsell, free-usage-exhausted
  chain, tier-restricted commands, GateInfo, RemoteSettings gate fields,
  SettingsUpdateNotification gate fields
- /privacy + coding-data-sharing setting deleted (backed by a dead xAI
  RPC; Kigi is zero-egress — nothing to share or retain remotely)

Auth UX correctness (user-reported):
- Device-flow fixtures now mirror the live Kimi payload shape
  (https://www.kimi.com/code/authorize_device?user_code=..., verified
  against auth.kimi.com); the fabricated auth.kimi.com/device?code=...
  URLs are gone
- open_browser_detached is a no-op under cfg(test): unit tests drove
  wiremock fixture URLs into the real browser (root cause of the
  "garbage mock link" ABCD-1234 tabs)
- Welcome/pager-minimal rebrand: Grok Build -> Kigi, grok.com ->
  kimi.com, "Sign in to Grok" -> "Sign in to Kimi"
This commit is contained in:
2026-07-17 16:05:51 -04:00
parent fe1f885bb3
commit ea0ce9d15f
231 changed files with 4730 additions and 26358 deletions
@@ -119,30 +119,6 @@ const PERMISSION_MODE_CHOICES: &[EnumChoice] = &[
},
];
// ---------------------------------------------------------------------------
// Coding-data-sharing catalog.
//
// Persisted in auth metadata (`AuthEntry::coding_data_retention_opt_out`),
// NOT config.toml. Two choices only — the pager has no `Option`/`Unset`
// representation for this field.
//
// `supports_preview: false` — toggling fires an async ACP call that
// can fail. Commit on Enter only.
// ---------------------------------------------------------------------------
const CODING_DATA_SHARING_CHOICES: &[EnumChoice] = &[
EnumChoice {
canonical: "opt-in",
display: "Opt in",
description: "Allow SpaceXAI to retain and use coding session data for training and product improvement.",
},
EnumChoice {
canonical: "opt-out",
display: "Opt out",
description: "Do not retain coding session data. Code requests will not be used for training.",
},
];
// ---------------------------------------------------------------------------
// Plan-mode catalog.
//
@@ -947,35 +923,6 @@ pub fn default_settings() -> Vec<SettingMeta> {
restart_required: false,
hidden_in_minimal: false,
},
// SHELL-owned. Persisted in auth metadata (not config.toml).
// Reads from `PagerLocalSnapshot.coding_data_sharing_opt_out`.
// Default "opt-in" matches `AuthEntry::coding_data_retention_opt_out = false`.
// ZDR / non-admin guards are enforced at dispatch time.
SettingMeta {
key: "coding_data_sharing",
category: SettingCategory::Privacy,
owner: SettingOwner::Shell,
label: "Coding data sharing",
description: "Controls whether SpaceXAI may retain and train on coding session data.",
keywords: &[
"privacy",
"data",
"sharing",
"coding",
"retention",
"telemetry",
"training",
"opt-in",
"opt-out",
],
kind: SettingKind::Enum {
default: "opt-in",
choices: CODING_DATA_SHARING_CHOICES,
supports_preview: false,
},
restart_required: false,
hidden_in_minimal: false,
},
// SHELL-owned, persisted to `[ui].default_selected_permission` in
// config.toml. Read by the pager via `appearance::permission_cursor`.
// Canonical `always_allow_all_sessions` (the effective default) lands
@@ -38,7 +38,6 @@ pub enum SettingCategory {
Mouse,
Editor,
Agent,
Privacy,
Models,
Session,
Advanced,
@@ -51,7 +50,6 @@ impl SettingCategory {
Self::Mouse,
Self::Editor,
Self::Agent,
Self::Privacy,
Self::Models,
Self::Session,
Self::Advanced,
@@ -64,7 +62,6 @@ impl SettingCategory {
Self::Mouse => "Mouse",
Self::Editor => "Editor & Input",
Self::Agent => "Agent & Approval",
Self::Privacy => "Privacy",
Self::Models => "Models",
Self::Session => "Session",
Self::Advanced => "Advanced",
@@ -247,10 +244,6 @@ pub struct PagerLocalSnapshot {
/// Cloned into the snapshot so the modal's validator/resolver is
/// self-contained (the modal outlives the borrow on `app.agents`).
pub available_models: Vec<(String, acp::ModelId)>,
/// Whether the user has opted OUT of coding data sharing.
/// Lives in auth metadata (no `UiConfig` field). Inverted mapping:
/// `opt_out == false` → canonical "opt-in".
pub coding_data_sharing_opt_out: bool,
/// Whether plan mode is active. Uses effective state
/// (`pending.unwrap_or(active)`) so rapid toggles don't double-send.
/// Refreshed on all mutation paths including ACP `CurrentModeUpdate`.
@@ -285,7 +278,6 @@ impl Default for PagerLocalSnapshot {
auto_mode: false,
current_model_name: None,
available_models: Vec::new(),
coding_data_sharing_opt_out: false,
plan_mode_active: false,
show_tips: None,
auto_update: None,
@@ -602,12 +594,6 @@ pub fn current_value_for(
)),
// max_thoughts_width: `u16` widened to `i64`.
"max_thoughts_width" => Some(SettingValue::Int(ui.max_thoughts_width as i64)),
// coding_data_sharing: inverts the `_opt_out` bool.
"coding_data_sharing" => Some(SettingValue::Enum(if pager.coding_data_sharing_opt_out {
"opt-out"
} else {
"opt-in"
})),
// plan_mode: canonical via `PlanModeKind::from_bool().as_canonical()`.
"plan_mode" => Some(SettingValue::Enum(
crate::app::actions::PlanModeKind::from_bool(pager.plan_mode_active).as_canonical(),
@@ -816,17 +802,6 @@ mod tests {
"max_thoughts_width default drifts from UiConfig::default()",
);
}
// coding_data_sharing: no UiConfig field; default pinned
// against auth metadata (opt_out=false → "opt-in").
("coding_data_sharing", SettingKind::Enum { default, .. }) => {
let expected = "opt-in";
assert_eq!(
*default, expected,
"coding_data_sharing registry default must be 'opt-in' — \
the on-disk source of truth is `AuthEntry::coding_data_retention_opt_out: \
bool` (defaults to `false`, i.e. user has NOT opted out)",
);
}
// CLI batch: fields live on CliConfig, not UiConfig.
// Defaults pinned literally.
("show_tips", SettingKind::Bool { default }) => {