§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
@@ -23,7 +23,7 @@ use crate::tools::ToolContext;
use agent_client_protocol as acp;
use kigi_acp_lib::AcpAgentGatewaySender as GatewaySender;
use kigi_hunk_tracker::HunkTrackerHandle;
use kigi_tools::implementations::grok_build::task::types::*;
use kigi_tools::implementations::kigi::task::types::*;
use kigi_workspace::file_system::AsyncFileSystem;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
@@ -197,7 +197,7 @@ pub(crate) struct SubagentSpawnContext {
/// Parent's scheduler handle. When `Some`, the subagent reuses the
/// parent's scheduler actor so scheduled tasks survive subagent exit.
pub parent_scheduler_handle:
Option<kigi_tools::implementations::grok_build::scheduler::types::SchedulerHandle>,
Option<kigi_tools::implementations::kigi::scheduler::types::SchedulerHandle>,
/// Parent's session environment variables (.envrc + color settings).
/// Shared so the child inherits the same env without re-loading.
pub session_env: Arc<HashMap<String, String>>,
@@ -207,10 +207,10 @@ pub(crate) struct SubagentSpawnContext {
/// Resolved sampling config for web_search.
pub web_search_config: kigi_tools::implementations::WebSearchConfig,
/// Resolved config for web fetch.
pub web_fetch_config: kigi_tools::implementations::grok_build::web_fetch::WebFetchConfig,
pub web_fetch_config: kigi_tools::implementations::kigi::web_fetch::WebFetchConfig,
/// Resolved config for the deploy service.
pub app_builder_deployer_config:
kigi_tools::implementations::grok_build::deploy_app::AppBuilderDeployerConfig,
kigi_tools::implementations::kigi::deploy_app::AppBuilderDeployerConfig,
/// Whether the write_file tool is enabled.
pub write_file_enabled: bool,
/// Whether goal mode (`/goal`) is enabled.
@@ -301,7 +301,7 @@ pub(crate) struct SubagentSpawnContext {
/// goes through `agent/config.rs::sampling_config_for_model`
/// which always sets that field to `None`.
pub attribution_callback: Option<kigi_sampler::SharedAttributionCallback>,
/// Parent session's agent name (e.g. "grok-build").
/// Parent session's agent name (e.g. "kigi").
pub parent_agent_name: Option<String>,
/// `agent_type` of the parent's current model — the harness-flavor fallback
/// when `parent_agent_name` is not a recognized harness, e.g. a custom
@@ -1639,12 +1639,12 @@ pub(crate) fn subagent_harness_flavor_is_representable(_agent_type: &str) -> boo
/// Apply the harness-dependent toolset/prompt re-selection to a resolved
/// agent definition.
///
/// The harness flavor (alternate vs grok-build) normally follows the PARENT
/// agent: `GrokBuildOrchestrator` parents give children
/// The harness flavor (alternate vs kigi) normally follows the PARENT
/// agent: `KigiOrchestrator` parents give children
/// the alternate harness; the orchestrator keeps children lean, and other parents
/// inherit the file-tool override (hashline vs standard). A `/goal` role may
/// pass `harness_agent_type` to OVERRIDE that flavor regardless of the parent
/// (so a grok-build session can run an alternate-harness verifier and vice-versa);
/// (so a kigi session can run an alternate-harness verifier and vice-versa);
/// `None` for every non-goal spawn ⇒ the parent decides (unchanged). The base
/// toolset stays role-dependent on `subagent_type` (general-purpose →
/// implementer, else explorer), so the role keeps a capable toolset on the
@@ -2170,7 +2170,7 @@ fn emit_subagent_notification(
.ok();
if let Some(params) = params {
let ext_notification =
acp::ExtNotification::new("x.ai/session_notification", params.into());
acp::ExtNotification::new("kigi/session_notification", params.into());
gateway.forward_fire_and_forget(ext_notification);
}
}
@@ -2224,7 +2224,7 @@ fn goal_tick_cmd_tx(
///
/// Notifications are **not** persisted to JSONL — they are transient UI
/// hints, not authoritative lifecycle events. The TUI can resync via
/// `x.ai/subagent/list_running` on reconnect.
/// `kigi/subagent/list_running` on reconnect.
fn spawn_progress_publisher(
signals_handle: crate::session::signals::SessionSignalsHandle,
gateway: GatewaySender,
@@ -2289,7 +2289,7 @@ fn spawn_progress_publisher(
}
if let Some(params) = params {
let ext_notification =
acp::ExtNotification::new("x.ai/session_notification", params.into());
acp::ExtNotification::new("kigi/session_notification", params.into());
gateway.forward_fire_and_forget(ext_notification);
}
}