§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

@@ -46,7 +46,7 @@ pub(super) fn handle_mcp_init_progress(notif: &acp::ExtNotification, app: &mut A
is_active
}
/// Handle `x.ai/mcp/tools_changed` and `x.ai/mcp_initialized`.
/// Handle `kigi/mcp/tools_changed` and `kigi/mcp_initialized`.
///
/// Routing rules (verified against the four shell emit sites in
/// `kigi-shell/src/session/acp_session.rs` — toggle-tool ~L6661,
@@ -78,8 +78,8 @@ pub(super) fn handle_mcp_init_progress(notif: &acp::ExtNotification, app: &mut A
pub(super) fn handle_mcp_tools_changed(notif: &acp::ExtNotification, app: &mut AppView) -> bool {
let method = notif.method.as_ref();
// Both `x.ai/mcp_initialized` and (newer shell)
// `x.ai/mcp/tools_changed` carry `sessionId`. Route by it so a
// Both `kigi/mcp_initialized` and (newer shell)
// `kigi/mcp/tools_changed` carry `sessionId`. Route by it so a
// background agent's notification updates *its* state — not
// whichever agent is foregrounded. Unknown and subagent (child)
// sessions are dropped; a missing sessionId falls back to the
@@ -119,7 +119,7 @@ pub(super) fn handle_mcp_tools_changed(notif: &acp::ExtNotification, app: &mut A
let mut redraw = false;
// `mcp_initialized` clears the matched agent's connecting indicator.
if method == "x.ai/mcp_initialized"
if method == "kigi/mcp_initialized"
&& let Some(agent) = app.agents.get_mut(&id)
&& agent.mcp_init_progress.take().is_some()
{
@@ -163,7 +163,7 @@ pub(super) fn agent_has_pending_mcps_fetch(app: &AppView, agent_id: AgentId) ->
})
}
/// Handle `x.ai/mcp/server_status`.
/// Handle `kigi/mcp/server_status`.
///
/// Routes by the notification's `sessionId` via
/// [`find_session_match`] — the matched agent's extensions modal is
@@ -206,7 +206,7 @@ pub(super) fn handle_mcp_server_status(notif: &acp::ExtNotification, app: &mut A
let Ok(payload) = serde_json::from_str::<McpServerStatusPayload>(notif.params.get()) else {
tracing::warn!(
"Failed to parse x.ai/mcp/server_status: {}",
"Failed to parse kigi/mcp/server_status: {}",
&notif.params.get()
[..crate::render::line_utils::floor_char_boundary(notif.params.get(), 100)]
);
@@ -263,7 +263,7 @@ pub(super) fn handle_mcp_server_status(notif: &acp::ExtNotification, app: &mut A
tracing::warn!(
server = %payload.name,
error = %e,
"x.ai/mcp/server_status: tools field present but not Vec<McpToolEntry>; status still applied"
"kigi/mcp/server_status: tools field present but not Vec<McpToolEntry>; status still applied"
);
None
}
@@ -273,7 +273,7 @@ pub(super) fn handle_mcp_server_status(notif: &acp::ExtNotification, app: &mut A
mutated && is_active
}
/// Handle `x.ai/mcp/servers_updated`.
/// Handle `kigi/mcp/servers_updated`.
///
/// Emitted by the shell from `MvpAgent` on managed-config resolve and
/// on config reload (`crates/codegen/kigi-shell/src/agent/mvp_agent.rs`