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
-14
View File
@@ -653,16 +653,6 @@ pub struct AgentSession {
/// fires, so the subsequent `TurnFailed` can be suppressed (the retry handler
/// already displayed a user-friendly message). Cleared on `finish_turn`.
pub model_incompatible: bool,
/// Set when a `RetryState::Failed` carries a 403 credit-limit error, so
/// the error message is suppressed in favour of the upsell modal.
/// Cleared on `finish_turn`.
pub credit_limit_blocked: bool,
/// Set when a rate-limit `RetryState::Exhausted` carries the
/// `subscription:free-usage-exhausted` code, so the PromptResponse
/// handler shows the free-usage paywall instead of the generic
/// rate-limit message. Always set together with [`Self::rate_limited`].
/// Cleared on `finish_turn`.
pub free_usage_blocked: bool,
pub(crate) tracker: AcpUpdateTracker,
/// ACP-advertised slash commands. Seeded from `InitializeResponse.meta`,
/// updated by `AvailableCommandsUpdate`. The prompt-side registry syncs
@@ -796,8 +786,6 @@ impl AgentSession {
self.state = AgentState::Idle;
self.rate_limited = false;
self.model_incompatible = false;
self.credit_limit_blocked = false;
self.free_usage_blocked = false;
self.in_flight_prompt = None;
self.current_prompt_id = None;
}
@@ -999,8 +987,6 @@ mod tests {
restore_degree: None,
rate_limited: false,
model_incompatible: false,
credit_limit_blocked: false,
free_usage_blocked: false,
available_commands: Vec::new(),
available_commands_generation: 0,
available_tools: None,