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
+12 -8
View File
@@ -141,7 +141,7 @@ pub(super) fn render_auth(buf: &mut Buffer, area: Rect, theme: &Theme, hint: &Mi
area,
y,
bottom,
Line::from(Span::styled("Sign in to Grok", bold)),
Line::from(Span::styled("Sign in to Kimi", bold)),
);
y = put_line(buf, area, y, bottom, Line::default());
match url {
@@ -242,12 +242,13 @@ mod tests {
#[test]
fn device_user_code_parses_verification_url() {
// The live Kimi device flow returns this exact URL shape.
assert_eq!(
device_user_code("https://accounts.x.ai/oauth2/device?user_code=ABCD-EFGH"),
device_user_code("https://www.kimi.com/code/authorize_device?user_code=ABCD-EFGH"),
Some("ABCD-EFGH")
);
assert_eq!(
device_user_code("https://accounts.x.ai/oauth2/device"),
device_user_code("https://www.kimi.com/code/authorize_device"),
None
);
assert_eq!(device_user_code("https://x/device?other=1"), None);
@@ -261,14 +262,14 @@ mod tests {
let st = AuthState::Authenticating {
request_seq: 1,
handle: None,
auth_url: Some("https://accounts.x.ai/device?user_code=ABCD-EFGH".into()),
auth_url: Some("https://www.kimi.com/code/authorize_device?user_code=ABCD-EFGH".into()),
mode: AuthMode::Device,
};
match minimal_auth_hint(&st) {
MinimalAuthHint::SigningIn { url, code } => {
assert_eq!(
url.as_deref(),
Some("https://accounts.x.ai/device?user_code=ABCD-EFGH")
Some("https://www.kimi.com/code/authorize_device?user_code=ABCD-EFGH")
);
assert_eq!(code.as_deref(), Some("ABCD-EFGH"));
}
@@ -308,7 +309,7 @@ mod tests {
let area = Rect::new(0, 0, 80, 12);
let mut buf = Buffer::empty(area);
let hint = MinimalAuthHint::SigningIn {
url: Some("https://accounts.x.ai/device?user_code=ABCD-EFGH".into()),
url: Some("https://www.kimi.com/code/authorize_device?user_code=ABCD-EFGH".into()),
code: Some("ABCD-EFGH".into()),
};
render_auth(&mut buf, area, &theme, &hint);
@@ -320,8 +321,11 @@ mod tests {
}
}
}
assert!(text.contains("Sign in to Grok"), "header: {text:?}");
assert!(text.contains("accounts.x.ai/device"), "url: {text:?}");
assert!(text.contains("Sign in to Kimi"), "header: {text:?}");
assert!(
text.contains("www.kimi.com/code/authorize_device"),
"url: {text:?}"
);
assert!(text.contains("ABCD-EFGH"), "device code: {text:?}");
assert!(
text.contains("Waiting for approval"),