§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:
@@ -10,7 +10,7 @@ pub use kigi_tty_utils::{detach_from_tty, pager_env};
|
||||
/// Env var set on agent-spawned terminal processes so host tools (e.g. `x ban`)
|
||||
/// can distinguish agent invocations from human interactive shells.
|
||||
/// Note: the CLI also uses `KIGI_AGENT` as an
|
||||
/// optional agent-definition selector for launching `grok` itself; child terminal
|
||||
/// optional agent-definition selector for launching `kigi` itself; child terminal
|
||||
/// processes only need the sentinel value `"1"`.
|
||||
pub const KIGI_AGENT_ENV: &str = "KIGI_AGENT";
|
||||
|
||||
@@ -19,7 +19,7 @@ pub const KIGI_AGENT_ENV_VALUE: &str = "1";
|
||||
|
||||
/// Force `KIGI_AGENT=1` on an agent terminal child so request/login env cannot
|
||||
/// clear the agent marker.
|
||||
pub fn apply_grok_agent_marker(cmd: &mut tokio::process::Command) {
|
||||
pub fn apply_kigi_agent_marker(cmd: &mut tokio::process::Command) {
|
||||
cmd.env(KIGI_AGENT_ENV, KIGI_AGENT_ENV_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Shared hashing utilities for hashline anchor generation.
|
||||
//!
|
||||
//! Provides FNV-1a 32-bit hashing and whitespace-normalized line fingerprinting.
|
||||
//! Used by the `grok_build_hashline` anchor schemes.
|
||||
//! Used by the `kigi_hashline` anchor schemes.
|
||||
//!
|
||||
//! ## Normalization policy
|
||||
//!
|
||||
|
||||
@@ -37,7 +37,7 @@ pub const MCP_MAX_OUTPUT_BYTES: usize = 20_000;
|
||||
/// truncation is byte-oriented (`truncate_str`).
|
||||
pub const ENV_MAX_MCP_OUTPUT_BYTES: &str = "MAX_MCP_OUTPUT_BYTES";
|
||||
|
||||
/// Grok-native env override for the MCP inline output cap (bytes).
|
||||
/// Kigi-native env override for the MCP inline output cap (bytes).
|
||||
pub const ENV_KIGI_MAX_MCP_OUTPUT_BYTES: &str = "KIGI_MAX_MCP_OUTPUT_BYTES";
|
||||
|
||||
/// Process-wide effective limit. `0` = host has not seeded; fall through to
|
||||
@@ -62,7 +62,7 @@ fn parse_positive_bytes_env(name: &str) -> Option<usize> {
|
||||
|
||||
/// Env tier: `KIGI_MAX_MCP_OUTPUT_BYTES` then `MAX_MCP_OUTPUT_BYTES`.
|
||||
///
|
||||
/// Grok-native wins when both are set. Positive integers only. Used by the
|
||||
/// Kigi-native wins when both are set. Positive integers only. Used by the
|
||||
/// shell resolver and as the standalone fallback when the host has not called
|
||||
/// [`set_mcp_max_output_bytes`].
|
||||
pub fn mcp_max_output_bytes_from_env() -> Option<usize> {
|
||||
@@ -298,7 +298,7 @@ mod tests {
|
||||
// Clear host seed; with no env, effective limit is the built-in default.
|
||||
set_mcp_max_output_bytes(0);
|
||||
let prev_max = std::env::var(ENV_MAX_MCP_OUTPUT_BYTES).ok();
|
||||
let prev_grok = std::env::var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES).ok();
|
||||
let prev_kigi = std::env::var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES).ok();
|
||||
unsafe {
|
||||
std::env::remove_var(ENV_MAX_MCP_OUTPUT_BYTES);
|
||||
std::env::remove_var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES);
|
||||
@@ -324,7 +324,7 @@ mod tests {
|
||||
Some(v) => std::env::set_var(ENV_MAX_MCP_OUTPUT_BYTES, v),
|
||||
None => std::env::remove_var(ENV_MAX_MCP_OUTPUT_BYTES),
|
||||
}
|
||||
match prev_grok {
|
||||
match prev_kigi {
|
||||
Some(v) => std::env::set_var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES, v),
|
||||
None => std::env::remove_var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES),
|
||||
}
|
||||
@@ -337,7 +337,7 @@ mod tests {
|
||||
fn env_parser_rejects_zero_and_junk() {
|
||||
with_mcp_limit_lock(|| {
|
||||
let prev_max = std::env::var(ENV_MAX_MCP_OUTPUT_BYTES).ok();
|
||||
let prev_grok = std::env::var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES).ok();
|
||||
let prev_kigi = std::env::var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES).ok();
|
||||
unsafe {
|
||||
std::env::remove_var(ENV_MAX_MCP_OUTPUT_BYTES);
|
||||
std::env::remove_var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES);
|
||||
@@ -353,7 +353,7 @@ mod tests {
|
||||
unsafe { std::env::set_var(ENV_MAX_MCP_OUTPUT_BYTES, "12345") };
|
||||
assert_eq!(mcp_max_output_bytes_from_env(), Some(12_345));
|
||||
|
||||
// GROK_* wins over MAX_* when both set.
|
||||
// KIGI_* wins over MAX_* when both set.
|
||||
unsafe { std::env::set_var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES, "99999") };
|
||||
assert_eq!(mcp_max_output_bytes_from_env(), Some(99_999));
|
||||
|
||||
@@ -365,7 +365,7 @@ mod tests {
|
||||
Some(v) => std::env::set_var(ENV_MAX_MCP_OUTPUT_BYTES, v),
|
||||
None => std::env::remove_var(ENV_MAX_MCP_OUTPUT_BYTES),
|
||||
}
|
||||
match prev_grok {
|
||||
match prev_kigi {
|
||||
Some(v) => std::env::set_var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES, v),
|
||||
None => std::env::remove_var(ENV_KIGI_MAX_MCP_OUTPUT_BYTES),
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ pub use command_display::strip_redundant_session_cd;
|
||||
#[cfg(unix)]
|
||||
pub use env::detach_from_tty;
|
||||
pub use env::substitute_plugin_tokens;
|
||||
pub use env::{KIGI_AGENT_ENV, KIGI_AGENT_ENV_VALUE, apply_grok_agent_marker, pager_env};
|
||||
pub use env::{KIGI_AGENT_ENV, KIGI_AGENT_ENV_VALUE, apply_kigi_agent_marker, pager_env};
|
||||
pub use fs::{UnicodePathMatch, canonicalize_with_timeout, try_resolve_unicode_filename};
|
||||
pub use kigi_home::{kigi_application, kigi_home};
|
||||
pub use kigi_tty_utils::detach_std_command;
|
||||
|
||||
Reference in New Issue
Block a user