§9 acceptance: grep-zero sweep — every internal x.ai/grok identifier renamed

The PRD's first acceptance gate now holds: grep -RinE '\bx\.ai\b|grok'
crates/ --include='*.rs' → 0 matches (exempt: NOTICE and third-party
license archives, README provenance, and the required 'Based on Grok
Build Open Source' attribution, now sourced from version_attribution.txt).

Wire-visible renames (both sides in this repo, changed in lockstep):
- Auth method id 'grok.com' → 'kimi-code' (AuthMethodKind::KimiCode).
- Every x.ai/* and _x.ai/* ACP ext method and meta key → kigi/* /
  _kigi/* (~200 names; grokShell → kigiShell). Session-file replay keeps
  a read-side alias for the legacy '_x.ai/session/update' method so
  existing updates.jsonl histories load; writes emit only the new name
  (both directions test-pinned).
- Agent types grok-build* → kigi* with a documented legacy-prefix alias
  at resolution time so persisted sessions keep resolving.
- ToolNamespace/BuiltinAgentName GrokBuild* → Kigi* (wire snake_case
  kigi/kigi_concise/kigi_hashline; schema regenerated); grok_build
  implementation dirs renamed to kigi*.
- x-grok-* headers → x-kigi-*, __GROK_* sentinels → __KIGI_*, themes
  grokday/groknight → kigiday/kiginight (old persisted values fall back
  to the default theme), web_fetch allowlist xAI hosts → kimi.com +
  moonshot platforms, changelog CDN → this repo, grok-build changelog
  archives deleted.
- BYOK default endpoint removed: [endpoints] api_base_url is now truly
  optional with NO default — consumers fail fast with the flag name when
  unset (no silent x.ai egress). Mock harnesses inject it explicitly.
- System-prompt identity fixed: 'released by xAI' → 'an unofficial
  community CLI for Kimi' (template + regenerated encrypted form).

Also repaired pre-existing grok-era test debt found by the sweep: the
stale trace_classify default-model pin, the grok-pager UA label test,
pty-harness stale-binary reuse and non-hermetic moonshot routing (a PTY
test could previously reach the real api.moonshot.cn), and the outdated
oauth fixture scope key.

Gates: §9 grep 0; fmt clean; workspace check/clippy 0/0 (-D warnings);
FULL cargo test --workspace: 234 suites, 21,961 passed, 0 failed;
deny advisories ok.
This commit is contained in:
2026-07-18 02:48:46 -04:00
parent 86e3724310
commit 6f31415ed6
1056 changed files with 8410 additions and 18307 deletions
@@ -7,7 +7,7 @@
//! unnecessary network requests.
//!
//! ACP integration: on text change (after debounce), sends an
//! `x.ai/suggest` request through the Effect pipeline. Stale responses
//! `kigi/suggest` request through the Effect pipeline. Stale responses
//! are discarded via generation tracking.
/// Source of a shell command suggestion.
@@ -46,14 +46,14 @@ pub(crate) struct GhostTextState {
pub(crate) generation: u64,
}
/// Parsed ghost suggestion from an ACP `x.ai/suggest` response.
/// Parsed ghost suggestion from an ACP `kigi/suggest` response.
#[derive(Debug, Clone)]
pub struct GhostSuggestionParsed {
pub suffix: String,
pub source: SuggestionSource,
}
/// A single completion item from an ACP `x.ai/suggest` response.
/// A single completion item from an ACP `kigi/suggest` response.
// `Default` (empty item) exists for downstream test fixtures — functional-
// update construction (`..Default::default()`) keeps out-of-crate literals
// (e.g. kigi-pager-minimal's) compiling when optional fields are added.
@@ -87,7 +87,7 @@ impl CompletionItemParsed {
}
}
/// Parsed response from an ACP `x.ai/suggest` request.
/// Parsed response from an ACP `kigi/suggest` request.
#[derive(Debug, Clone)]
pub struct SuggestResponseParsed {
pub ghost: Option<GhostSuggestionParsed>,
@@ -96,7 +96,7 @@ pub struct SuggestResponseParsed {
}
impl SuggestResponseParsed {
/// Parse a raw JSON value from an ACP `x.ai/suggest` response.
/// Parse a raw JSON value from an ACP `kigi/suggest` response.
pub fn from_json(value: &serde_json::Value) -> Option<Self> {
let result = value.get("result").unwrap_or(value);
let generation = result.get("generation")?.as_u64()?;
@@ -197,7 +197,7 @@ pub enum SuggestionAction {
Debounce { generation: u64 },
}
/// Wire `limit` for `x.ai/suggest` fetches. Matches the shell file
/// Wire `limit` for `kigi/suggest` fetches. Matches the shell file
/// provider's ranked-result cap (`MAX_RESULTS` in the shell crate's
/// `file_provider.rs`): the provider ranks BEFORE capping, the dropdown
/// renders 6 rows and scrolls the rest. Both fetch sites (Tab and the
@@ -326,7 +326,7 @@ pub struct SuggestionController {
/// Whether AI-powered suggestions are enabled.
/// Resolved at construction from `KIGI_SUGGESTIONS_AI` env var.
pub ai_enabled: bool,
/// Model to use for AI suggestions. Sent in the `x.ai/suggest` request.
/// Model to use for AI suggestions. Sent in the `kigi/suggest` request.
/// Resolved at construction from `KIGI_SUGGESTIONS_AI_MODEL` env var.
pub ai_model: Option<String>,
}
@@ -734,7 +734,7 @@ impl SuggestionController {
generation == self.generation
}
/// Called when an ACP `x.ai/suggest` response arrives, with the text and
/// Called when an ACP `kigi/suggest` response arrives, with the text and
/// cursor the request was built from (the anchor item `replace_range`
/// offsets index into, and the position Tab targets). Takes ownership to
/// avoid copying strings. Discards stale responses.