§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
@@ -108,7 +108,7 @@ mod tests {
writer.emit(Event::TurnStarted {
session_id: "test-session".into(),
turn_number: 1,
model_id: "grok-3".into(),
model_id: "kigi-3".into(),
yolo_mode: false,
conversation_message_count: 0,
session_relationship: SessionRelationship::Primary,
@@ -462,7 +462,7 @@ pub enum Event {
#[derive(Debug, Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum InterjectionSource {
/// Direct `x.ai/interject` while a turn was running (Ctrl+Enter).
/// Direct `kigi/interject` while a turn was running (Ctrl+Enter).
Direct,
/// A queued (not-yet-running) prompt promoted into the running turn via
/// `InterjectQueuedPrompt` (queue "send now").
@@ -477,7 +477,7 @@ pub enum InterjectionSource {
#[derive(Debug, Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum RedirectKind {
/// Mid-turn interjection — Ctrl+O / `x.ai/interject`, or "Send now" on a
/// Mid-turn interjection — Ctrl+O / `kigi/interject`, or "Send now" on a
/// queued row. The turn keeps running; nothing is cancelled.
Interjection,
/// The turn was aborted (Ctrl+C / Esc) and the user then typed and sent a
@@ -696,7 +696,7 @@ mod tests {
let with_kind = serde_json::to_value(Event::TurnStarted {
session_id: "s".into(),
turn_number: 2,
model_id: "grok-4".into(),
model_id: "kigi-4".into(),
yolo_mode: false,
conversation_message_count: 3,
session_relationship: SessionRelationship::Primary,
@@ -710,7 +710,7 @@ mod tests {
let normal = serde_json::to_value(Event::TurnStarted {
session_id: "s".into(),
turn_number: 1,
model_id: "grok-4".into(),
model_id: "kigi-4".into(),
yolo_mode: false,
conversation_message_count: 0,
session_relationship: SessionRelationship::Primary,
@@ -745,26 +745,26 @@ mod tests {
attempt: 2,
consecutive_failures: 6,
every: 3,
model_id: "grok-4".to_string(),
model_id: "kigi-4".to_string(),
};
let v = serde_json::to_value(&ev).unwrap();
assert_eq!(v["type"], "goal_strategist_fired");
assert_eq!(v["attempt"], 2);
assert_eq!(v["consecutive_failures"], 6);
assert_eq!(v["every"], 3);
assert_eq!(v["model_id"], "grok-4");
assert_eq!(v["model_id"], "kigi-4");
}
#[test]
fn goal_summarizer_events_serialize_tag_and_fields() {
let fired = Event::GoalSummarizerFired {
attempt: 2,
model_id: "grok-4".to_string(),
model_id: "kigi-4".to_string(),
};
let v = serde_json::to_value(&fired).unwrap();
assert_eq!(v["type"], "goal_summarizer_fired");
assert_eq!(v["attempt"], 2);
assert_eq!(v["model_id"], "grok-4");
assert_eq!(v["model_id"], "kigi-4");
let completed = Event::GoalSummarizerCompleted {
attempt: 2,
@@ -792,7 +792,7 @@ mod tests {
let ev = Event::GoalRoleModelResolved {
role: "skeptic",
skeptic_idx: Some(2),
model_id: "grok-4".to_string(),
model_id: "kigi-4".to_string(),
agent_type: "general-purpose".to_string(),
source: "remote",
};
@@ -800,7 +800,7 @@ mod tests {
assert_eq!(v["type"], "goal_role_model_resolved");
assert_eq!(v["role"], "skeptic");
assert_eq!(v["skeptic_idx"], 2);
assert_eq!(v["model_id"], "grok-4");
assert_eq!(v["model_id"], "kigi-4");
assert_eq!(v["agent_type"], "general-purpose");
assert_eq!(v["source"], "remote");
}
@@ -810,7 +810,7 @@ mod tests {
let ev = Event::GoalRoleModelResolved {
role: "planner",
skeptic_idx: None,
model_id: "grok-4".to_string(),
model_id: "kigi-4".to_string(),
agent_type: "general-purpose".to_string(),
source: "remote",
};
+3 -3
View File
@@ -21,7 +21,7 @@ fn parse_aws_credentials(content: &str) -> anyhow::Result<aws_sdk_s3::config::Cr
&parsed.aws_secret_access_key,
parsed.aws_session_token,
None,
"grok-shell-trace-upload",
"kigi-shell-trace-upload",
));
}
@@ -51,7 +51,7 @@ fn parse_aws_credentials(content: &str) -> anyhow::Result<aws_sdk_s3::config::Cr
&s,
token,
None,
"grok-shell-trace-upload",
"kigi-shell-trace-upload",
)),
_ => anyhow::bail!(
"AWS credentials are neither valid JSON \
@@ -109,7 +109,7 @@ pub(crate) async fn build_s3_client(
"test",
None,
None,
"grok-shell-test",
"kigi-shell-test",
));
}
@@ -252,7 +252,7 @@ mod tests {
use super::*;
#[test]
fn grok_dirs_are_unsafe() {
fn kigi_dirs_are_unsafe() {
if let Some(home) = dirs::home_dir() {
assert!(!is_project_dir(&home.join(".kigi")));
assert!(!is_project_dir(&home.join(".kigi/bin")));
@@ -260,7 +260,7 @@ mod tests {
}
#[test]
fn grok_prefixed_dirs_are_unsafe() {
fn kigi_prefixed_dirs_are_unsafe() {
if let Some(home) = dirs::home_dir() {
assert!(!is_project_dir(&home.join(".kigi-proxy-work")));
}