§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:
@@ -166,14 +166,14 @@ pub fn kill_process_by_pid(pid: u32) -> std::io::Result<()> {
|
||||
terminate.map_err(|e| std::io::Error::other(format!("TerminateProcess({pid}): {e}")))
|
||||
}
|
||||
}
|
||||
/// True if `pid` is a grok process; pairs with [`kill_process_by_pid`] to avoid killing a recycled PID.
|
||||
/// True if `pid` is a kigi process; pairs with [`kill_process_by_pid`] to avoid killing a recycled PID.
|
||||
/// Best-effort on macOS/BSD (liveness-only via `kill -0`), exact on Linux (/proc cmdline) and Windows (image path).
|
||||
pub fn is_grok_process(pid: u32) -> bool {
|
||||
pub fn is_kigi_process(pid: u32) -> bool {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let cmdline_path = format!("/proc/{pid}/cmdline");
|
||||
match std::fs::read(&cmdline_path) {
|
||||
Ok(data) => String::from_utf8_lossy(&data).contains("grok"),
|
||||
Ok(data) => String::from_utf8_lossy(&data).contains("kigi"),
|
||||
Err(_) => false,
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ pub fn is_grok_process(pid: u32) -> bool {
|
||||
}
|
||||
String::from_utf16_lossy(&buf[..size as usize])
|
||||
.to_ascii_lowercase()
|
||||
.contains("grok")
|
||||
.contains("kigi")
|
||||
}
|
||||
#[cfg(all(not(target_os = "linux"), not(windows)))]
|
||||
{
|
||||
@@ -229,7 +229,7 @@ mod tests {
|
||||
}
|
||||
#[test]
|
||||
fn test_is_production_coding_api_url_rejects_public_api() {
|
||||
assert!(!is_production_coding_api_url("https://api.x.ai/v1"));
|
||||
assert!(!is_production_coding_api_url("https://byok.example/v1"));
|
||||
}
|
||||
#[test]
|
||||
fn test_is_production_coding_api_url_rejects_spoofed_hostname() {
|
||||
@@ -248,7 +248,7 @@ mod tests {
|
||||
}
|
||||
#[test]
|
||||
fn test_is_effective_coding_endpoint_url_rejects_remote_third_party() {
|
||||
assert!(!is_effective_coding_endpoint_url("https://api.x.ai/v1"));
|
||||
assert!(!is_effective_coding_endpoint_url("https://byok.example/v1"));
|
||||
assert!(!is_effective_coding_endpoint_url(
|
||||
"https://localhost.evil.example/v1"
|
||||
));
|
||||
@@ -264,7 +264,7 @@ mod tests {
|
||||
assert!(is_first_party_url(
|
||||
"https://api.kimi.com/coding/v1/chat/completions"
|
||||
));
|
||||
assert!(!is_first_party_url("https://api.x.ai/v1"));
|
||||
assert!(!is_first_party_url("https://byok.example/v1"));
|
||||
assert!(!is_first_party_url("https://api.openai.com/v1"));
|
||||
assert!(!is_first_party_url("https://api.anthropic.com/v1"));
|
||||
assert!(!is_first_party_url("https://api.kimi.com.evil.example/v1"));
|
||||
@@ -310,8 +310,8 @@ mod tests {
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn is_grok_process_self_true_impossible_pid_false() {
|
||||
assert!(is_grok_process(std::process::id()));
|
||||
assert!(!is_grok_process(u32::MAX));
|
||||
fn is_kigi_process_self_true_impossible_pid_false() {
|
||||
assert!(is_kigi_process(std::process::id()));
|
||||
assert!(!is_kigi_process(u32::MAX));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user