§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:
ZacharyZhang-NY committed 2026-07-18 02:48:46 -04:00
1 parent 86e3724310
commit 6f31415ed6
1056 files changed
+8410 -18307

No files matched your search

@@ -248,7 +248,7 @@ pub(in crate::app::dispatch) fn set_ask_user_question_timeout_enabled(
app: &mut AppView,
new: bool,
) -> Vec<Effect> {
use kigi_tools::implementations::grok_build::ask_user_question;
use kigi_tools::implementations::kigi::ask_user_question;
let prev_state = app.ask_user_question_timeout_enabled;
let prev_effective =
prev_state.unwrap_or(ask_user_question::DEFAULT_ASK_USER_QUESTION_TIMEOUT_ENABLED);
@@ -1206,8 +1206,8 @@ pub(in crate::app::dispatch) fn set_auto_dark_theme(app: &mut AppView, new: Stri
.as_deref()
.and_then(crate::theme::canonical_name)
.filter(|s| *s != "auto")
// No prior config: fall back to GrokNight (the default).
.unwrap_or_else(|| crate::theme::ThemeKind::GrokNight.display_name());
// No prior config: fall back to KigiNight (the default).
.unwrap_or_else(|| crate::theme::ThemeKind::KigiNight.display_name());
let new_canonical = match crate::theme::canonical_name(&new) {
Some(c) if c != crate::theme::ThemeKind::Auto.display_name() => c,
_ => {
@@ -1320,7 +1320,7 @@ pub(in crate::app::dispatch) fn set_auto_light_theme(
.as_deref()
.and_then(crate::theme::canonical_name)
.filter(|s| *s != "auto")
.unwrap_or_else(|| crate::theme::ThemeKind::GrokDay.display_name());
.unwrap_or_else(|| crate::theme::ThemeKind::KigiDay.display_name());
let new_canonical = match crate::theme::canonical_name(&new) {
Some(c) if c != crate::theme::ThemeKind::Auto.display_name() => c,
_ => {
@@ -1430,7 +1430,7 @@ pub(in crate::app::dispatch) fn set_default_model_inner(
// or `/clear` creates a fresh session by cloning `app.models`
// (`dispatch_new_session_inner_with_id`), so without this the new session —
// and the welcome card it commits — would show the previous default until
// the next `x.ai/models/update` roundtrip.
// the next `kigi/models/update` roundtrip.
if app.models.available.contains_key(id) {
app.models.set_current(id.clone(), None);
}
@@ -1510,7 +1510,7 @@ pub(in crate::app::dispatch) fn set_default_model(
// Persist the **model ID** (catalog key), not the display name.
// The shell's `resolve_default_model` matches by slug / map key,
// so persisting the human-readable name (e.g. "Grok Build")
// so persisting the human-readable name (e.g. "Kigi")
// would silently fail to resolve on the next startup.
//
// Chat (`--chat` / KIGI_CHAT_MODE) catalogs use opaque `/rest/modes`
@@ -1798,7 +1798,7 @@ pub(in crate::app::dispatch) fn set_max_thoughts_width(app: &mut AppView, new: i
/// (`show_tips`, `auto_update`, ask_user_question timeout).
/// Matches the consumer's `.unwrap_or(...)` fallback.
pub(super) fn pr13_effective_default(key: &str) -> Option<bool> {
use kigi_tools::implementations::grok_build::ask_user_question;
use kigi_tools::implementations::kigi::ask_user_question;
match key {
"show_tips" => Some(true),
"auto_update" => Some(true),