§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

@@ -200,7 +200,7 @@ impl McpInitProgress {
/// Whether the progress indicator should be visible in the UI.
///
/// - `total > 0` (real servers): always visible until
/// `x.ai/mcp_initialized` clears the progress.
/// `kigi/mcp_initialized` clears the progress.
/// - `total == 0` (seed / 0-server): visible for at most
/// [`SEED_EXPIRE`] seconds, then auto-expires as
/// defense-in-depth against the shell failing to send
@@ -559,7 +559,7 @@ pub(crate) struct SessionReload {
saw_todo_update: bool,
}
/// Follow-up suggestion chips for the latest assistant response
/// (`x.ai/follow_ups`). Streaming-only: never persisted, does not survive a
/// (`kigi/follow_ups`). Streaming-only: never persisted, does not survive a
/// session reload. Keyed by the assistant `response_id` (the newest-wins key).
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct FollowUps {
@@ -799,7 +799,7 @@ pub struct AgentView {
/// answering questions via `AskUserQuestion`). Reset when the turn ends.
pub turn_paused_duration: std::time::Duration,
/// IDs of interjections this client sent and already rendered locally
/// (optimistic echo). The shell broadcasts `x.ai/session/interjection` to
/// (optimistic echo). The shell broadcasts `kigi/session/interjection` to
/// every attached pane; when our own broadcast echoes back carrying an id
/// in this set, `handle_interjection` drops it (we already showed it) and
/// removes the id. Other panes (which lack the id) render it. This is the
@@ -1133,7 +1133,7 @@ pub struct AgentView {
/// (`When::DashboardOverlay`) are lit in the overlay and dimmed elsewhere.
pub(crate) in_dashboard_overlay: bool,
/// MCP server init progress. Set when the shell starts connecting
/// MCP servers, cleared when `x.ai/mcp_initialized` arrives.
/// MCP servers, cleared when `kigi/mcp_initialized` arrives.
/// Shown in the turn status line while the agent is idle.
pub(crate) mcp_init_progress: Option<McpInitProgress>,
/// Last synced ACP command generation. When this differs from
@@ -1206,7 +1206,7 @@ pub struct AgentView {
/// lands on a tick; borrowed during render so streaming redraws don't
/// rescan/allocate the prompt every frame.
pub(crate) timeline_hover_preview: Option<(usize, String)>,
/// Running agent definition for this session (`x.ai/session/info` `agentName`).
/// Running agent definition for this session (`kigi/session/info` `agentName`).
pub session_agent_name: Option<String>,
/// Map of child session IDs to subagent metadata. Populated on
/// `SubagentSpawned` notifications, used for permission routing
@@ -1286,7 +1286,7 @@ pub struct AgentView {
/// complete. Kind-only: the payload is re-derived from the widget on
/// reissue so the freshly attached image chip travels with it.
pub(crate) deferred_send: Option<AgentDeferredSend>,
/// Armed when an `x.ai/session/prompt_complete` broadcast arrives for the
/// Armed when an `kigi/session/prompt_complete` broadcast arrives for the
/// turn THIS client drives while it is still awaiting that turn's
/// `session/prompt` RPC response. The RPC normally lands milliseconds
/// later and disarms this; if it never does (lost in leader response
@@ -1317,17 +1317,17 @@ pub struct AgentView {
pub(crate) follow_without_jump_prompt_id: Option<String>,
/// Ids of THIS client's server-queue rows that are still optimistic
/// echoes — the `session/prompt` RPC is in flight and no
/// `x.ai/queue/changed` broadcast has confirmed the row yet. Inserted by
/// `kigi/queue/changed` broadcast has confirmed the row yet. Inserted by
/// the echo push, drained when a broadcast lists the id (queued or
/// running) or the RPC resolves without the row landing.
pub(crate) optimistic_queue_ids: std::collections::HashSet<String>,
/// A queue-row send-now the user fired while the row was still an
/// optimistic echo. Firing `x.ai/queue/interject` then would race the
/// optimistic echo. Firing `kigi/queue/interject` then would race the
/// row's own in-flight `session/prompt` and silently no-op shell-side
/// (a rapid double-Enter on a queued bash command could "disappear" — the
/// interject overtook the row, the no-op dropped the send-now, and the
/// armed cancel expectation hid the still-queued row).
/// Parked here and fired from the confirming `x.ai/queue/changed`
/// Parked here and fired from the confirming `kigi/queue/changed`
/// broadcast with the row's authoritative version.
pub(crate) send_now_awaiting_confirm: Option<String>,
/// User blocks painted at send-now dispatch, keyed by prompt id; the
@@ -1337,7 +1337,7 @@ pub struct AgentView {
pub(crate) send_now_painted_blocks:
std::collections::HashMap<String, (crate::scrollback::EntryId, bool)>,
/// Follow-up suggestion chips for the latest assistant response
/// (`x.ai/follow_ups`). `None` when no chips are shown. Set by
/// (`kigi/follow_ups`). `None` when no chips are shown. Set by
/// [`AgentView::apply_follow_ups`]; cleared at each turn start.
pub(crate) follow_ups: Option<FollowUps>,
/// `promptId` (turn identity) of the currently-shown `follow_ups`, when the
@@ -1371,7 +1371,7 @@ pub struct AgentView {
/// The ordering key for newest-wins: a fresh id takes the next value (the
/// new high-water), so every previously-seen id is strictly lower.
pub(crate) follow_up_next_gen: u64,
/// Stamped `x.ai/follow_ups` that arrived for a turn that is NOT yet the
/// Stamped `kigi/follow_ups` that arrived for a turn that is NOT yet the
/// currently-adopted one, keyed by `promptId`. Ext notifications and
/// `session/update` travel on separate channels, so a turn's follow_ups can
/// land BEFORE the `session/update` that adopts it. Rather than drop such a
@@ -1891,7 +1891,7 @@ fn resolve_action(action_id: Option<ActionId>) -> Option<InputOutcome> {
fn question_visible_h(
scroll_region: Option<(u16, u16)>,
prompt_height: u16,
question: &kigi_tools::implementations::grok_build::ask_user_question::Question,
question: &kigi_tools::implementations::kigi::ask_user_question::Question,
content_w: usize,
preview: Option<&str>,
fullscreen: bool,
@@ -2625,7 +2625,7 @@ pub(super) mod test_fixtures {
);
assert_eq!(agent.follow_ups.as_ref().unwrap().suggestions, vec!["a"]);
}
/// FIX 4 (b): after adopting a NEW turn, a buffer-replayed `x.ai/follow_ups`
/// FIX 4 (b): after adopting a NEW turn, a buffer-replayed `kigi/follow_ups`
/// for a PRIOR turn's response_id must NOT revive stale chips — its
/// `promptId` is not the active turn and it is already in the seen ring.
#[test]
@@ -2646,7 +2646,7 @@ pub(super) mod test_fixtures {
assert!(agent.apply_follow_ups_with_prompt("resp-2".into(), Some("p2"), vec!["b".into()]));
assert_eq!(agent.follow_ups.as_ref().unwrap().response_id, "resp-2");
}
/// FINDING B (stamped path): a LATE FIRST-TIME (never-seen) `x.ai/follow_ups`
/// FINDING B (stamped path): a LATE FIRST-TIME (never-seen) `kigi/follow_ups`
/// for a PRIOR turn — arriving while a newer turn is active — must NOT
/// render. Before the fix it slipped through the "strictly newer" branch
/// (never recorded in `follow_up_seen`, so the seen-reject didn't catch it).
@@ -2702,7 +2702,7 @@ pub(super) mod test_fixtures {
/// distinguished from the new turn's first follow_ups, so it follows the
/// legacy newest-wins (renders). This path is not reachable for current
/// shells (which always stamp `promptId`) or for buffer-replays (suppressed
/// upstream by the `_meta["x.ai/replayed"]` gate); it is pinned here so the
/// upstream by the `_meta["kigi/replayed"]` gate); it is pinned here so the
/// stamped-path fix above is understood to be the deterministic guard.
#[test]
fn apply_follow_ups_none_prompt_first_time_follows_legacy_newest_wins() {
@@ -2714,7 +2714,7 @@ pub(super) mod test_fixtures {
);
assert_eq!(agent.follow_ups.as_ref().unwrap().response_id, "resp-x");
}
/// FIX (buffer-before-adoption): a stamped `x.ai/follow_ups` for a turn that
/// FIX (buffer-before-adoption): a stamped `kigi/follow_ups` for a turn that
/// is NOT yet current (its `session/update` adoption raced behind the ext
/// channel) must be BUFFERED, not dropped — and then RENDER when that turn
/// becomes current and is flushed.