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

@@ -13,11 +13,10 @@ use crate::prompt_images::{InlineMediaInfo, ScrollbackImageRef, ScrollbackVideoR
use super::blocks::mermaid_content::DiagramAffordance;
use super::blocks::{
AgentMessageBlock, BgTaskBlock, BtwBlock, ContextInfoBlock, CreditLimitBlock,
EditToolCallBlock, ExecuteToolCallBlock, LineRange, ListDirToolCallBlock, OtherToolCallBlock,
ReadToolCallBlock, SearchFileMatch, SearchToolCallBlock, SessionEvent, SessionEventBlock,
SubagentBlock, SubagentBlockKind, SystemMessageBlock, ThinkingBlock, ToolCallBlock,
UserPromptBlock,
AgentMessageBlock, BgTaskBlock, BtwBlock, ContextInfoBlock, EditToolCallBlock,
ExecuteToolCallBlock, LineRange, ListDirToolCallBlock, OtherToolCallBlock, ReadToolCallBlock,
SearchFileMatch, SearchToolCallBlock, SessionEvent, SessionEventBlock, SubagentBlock,
SubagentBlockKind, SystemMessageBlock, ThinkingBlock, ToolCallBlock, UserPromptBlock,
};
use super::types::{
AccentStyle, BlockBackground, BlockContext, BlockOutput, DisplayMode, RenderedBlockOutput,
@@ -383,8 +382,6 @@ pub enum RenderBlock {
Btw(BtwBlock),
/// `/context` snapshot with categorical bar + breakdown.
ContextInfo(ContextInfoBlock),
/// Credit-limit card for max-tier users (red accent, single action).
CreditLimit(CreditLimitBlock),
}
/// Delegate a method call to the inner block variant.
@@ -402,7 +399,6 @@ macro_rules! delegate_block {
RenderBlock::Subagent(b) => b.$method($($arg),*),
RenderBlock::Btw(b) => b.$method($($arg),*),
RenderBlock::ContextInfo(b) => b.$method($($arg),*),
RenderBlock::CreditLimit(b) => b.$method($($arg),*),
}
};
}
@@ -778,15 +774,6 @@ impl RenderBlock {
RenderBlock::SessionEvent(SessionEventBlock::new(event))
}
/// Create a credit-limit card (inline scrollback block for max-tier users).
pub fn credit_limit_card(
heading: impl Into<String>,
action: crate::scrollback::blocks::CreditLimitCardAction,
url: impl Into<String>,
) -> Self {
RenderBlock::CreditLimit(CreditLimitBlock::new(heading, action, url))
}
/// Create a "Task started" background task block.
pub fn bg_task(command: impl Into<String>, task_id: impl Into<String>) -> Self {
RenderBlock::BgTask(BgTaskBlock::started(command, task_id))
@@ -912,11 +899,6 @@ impl RenderBlock {
matches!(self, RenderBlock::AgentMessage(_))
}
/// Check if this block is a CreditLimit card.
pub fn is_credit_limit(&self) -> bool {
matches!(self, RenderBlock::CreditLimit(_))
}
/// Check if this block is a plan mode tool call (enter or exit).
///
/// Exact-matches the canonical tool-name set rather than substring-matching
@@ -1014,10 +996,9 @@ impl RenderBlock {
None
}
}
RenderBlock::System(_)
| RenderBlock::SessionEvent(_)
| RenderBlock::ContextInfo(_)
| RenderBlock::CreditLimit(_) => None,
RenderBlock::System(_) | RenderBlock::SessionEvent(_) | RenderBlock::ContextInfo(_) => {
None
}
RenderBlock::Btw(_) => Some(theme.accent_plan),
RenderBlock::Stub(block) => Some(block.accent_color),
}
@@ -1161,9 +1142,6 @@ impl RenderBlock {
Some(b.content().rendered_plain_text()),
]),
RenderBlock::ContextInfo(b) => join_searchable([Some(b.model.clone())]),
RenderBlock::CreditLimit(b) => {
join_searchable([Some(b.heading.clone()), Some(b.url.clone())])
}
RenderBlock::ToolCall(tc) => tc.searchable_text(),
}
}
@@ -1566,18 +1544,6 @@ mod searchable_text_tests {
assert_eq!(block.searchable_text().as_deref(), Some("grok-4.5"));
}
#[test]
fn credit_limit_indexes_heading_and_url() {
let block = RenderBlock::credit_limit_card(
"credit limit reached",
crate::scrollback::blocks::CreditLimitCardAction::EnablePayg,
"https://grok.com?_s=usage",
);
let text = block.searchable_text().expect("credit limit text");
assert!(text.contains("credit limit reached"), "got: {text:?}");
assert!(text.contains("https://grok.com?_s=usage"), "got: {text:?}");
}
#[test]
fn search_tool_indexes_pattern_and_match_line() {
let block = RenderBlock::search(