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:
ZacharyZhang-NY committed 2026-07-17 16:05:51 -04:00
1 parent fe1f885bb3
commit ea0ce9d15f
231 files changed
+4730 -26358

No files matched your search

+9 -41
View File
@@ -351,12 +351,6 @@ impl CommandRegistry {
self.available_tools = Some(tools);
}
/// Show or hide the /share command.
/// When hidden, it won't appear in the dropdown or be executable.
pub fn set_share_visible(&mut self, visible: bool) {
self.set_command_visible("share", visible);
}
/// Show or hide the /usage command.
/// When hidden, it won't appear in the dropdown or be executable.
pub fn set_usage_visible(&mut self, visible: bool) {
@@ -699,35 +693,6 @@ mod tests {
assert!(registry.get("flush").is_none());
}
#[test]
fn set_share_visible_hides_and_restores_share_command() {
let share: Arc<dyn SlashCommand> = Arc::new(DummyCommand {
name: "share",
aliases: &[],
});
let other: Arc<dyn SlashCommand> = Arc::new(DummyCommand {
name: "exit",
aliases: &[],
});
let mut registry = CommandRegistry::new(vec![share, other]);
// Default: /share is visible.
assert!(registry.get("share").is_some());
assert!(registry.triggers().iter().any(|t| t.canonical == "share"));
// Hiding /share removes it from lookup and triggers.
registry.set_share_visible(false);
assert!(registry.get("share").is_none());
assert!(!registry.triggers().iter().any(|t| t.canonical == "share"));
// Other commands are unaffected.
assert!(registry.get("exit").is_some());
// Re-enabling restores it.
registry.set_share_visible(true);
assert!(registry.get("share").is_some());
assert!(registry.triggers().iter().any(|t| t.canonical == "share"));
}
#[test]
fn set_usage_visible_hides_and_restores_usage_command() {
let usage: Arc<dyn SlashCommand> = Arc::new(DummyCommand {
@@ -1110,9 +1075,9 @@ mod tests {
/// unresolvable for dispatch, exactly like `get()`.
#[test]
fn get_for_dispatch_respects_hard_gates() {
// Hard-hidden by name (e.g. /dashboard default, /share toggle).
let share: Arc<dyn SlashCommand> = Arc::new(DummyCommand {
name: "share",
// Hard-hidden by name (e.g. /dashboard default).
let dashboard: Arc<dyn SlashCommand> = Arc::new(DummyCommand {
name: "dashboard",
aliases: &[],
});
// Tier-restricted.
@@ -1125,11 +1090,14 @@ mod tests {
name: "loop",
required: &["scheduler_create"],
});
let mut reg = CommandRegistry::new(vec![share, usage, gated]);
reg.set_share_visible(false);
let mut reg = CommandRegistry::new(vec![dashboard, usage, gated]);
reg.set_dashboard_visible(false);
reg.set_restricted_commands(&["usage".to_string()]);
assert!(reg.get_for_dispatch("share").is_none(), "hidden stays hard");
assert!(
reg.get_for_dispatch("dashboard").is_none(),
"hidden stays hard"
);
assert!(
reg.get_for_dispatch("usage").is_none(),
"restricted stays blocked (upsell path owns it)"