§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
+63 -63
View File
@@ -179,23 +179,23 @@ pub enum Action {
/// Try to drain the next queued prompt (after editing completes, etc.).
DrainQueue,
/// Remove a server-authoritative (shared) queued prompt by its stable
/// `prompt_id`. Routed to the agent as `x.ai/queue/remove`;
/// the resulting `x.ai/queue/changed` rebroadcast is the source of truth.
/// `prompt_id`. Routed to the agent as `kigi/queue/remove`;
/// the resulting `kigi/queue/changed` rebroadcast is the source of truth.
QueueRemoveShared {
id: String,
expected_version: u64,
},
/// Reorder the server-authoritative (shared) queued prompts to match
/// `ordered_ids`. Routed as `x.ai/queue/reorder`.
/// `ordered_ids`. Routed as `kigi/queue/reorder`.
QueueReorderShared {
ordered_ids: Vec<String>,
},
/// Clear the caller's server-authoritative (shared) queued prompts.
/// Routed as `x.ai/queue/clear`.
/// Routed as `kigi/queue/clear`.
QueueClearShared,
/// Replace the text of a server-authoritative (shared) queued prompt.
/// Routed to the agent as `x.ai/queue/edit`; the rebroadcast of
/// `x.ai/queue/changed` is the source of truth. Last write wins via the
/// Routed to the agent as `kigi/queue/edit`; the rebroadcast of
/// `kigi/queue/changed` is the source of truth. Last write wins via the
/// session actor's serialized mailbox; no client-side conflict resolution.
QueueEditShared {
id: String,
@@ -203,8 +203,8 @@ pub enum Action {
},
/// Interject a server-authoritative (shared) queued prompt into the running
/// turn: the agent atomically removes it from the queue and
/// merges its text into the in-flight turn. Routed as `x.ai/queue/interject`;
/// the `x.ai/session/interjection` + `x.ai/queue/changed` rebroadcasts are
/// merges its text into the in-flight turn. Routed as `kigi/queue/interject`;
/// the `kigi/session/interjection` + `kigi/queue/changed` rebroadcasts are
/// the source of truth (no optimistic client-side block). Mirrors the local
/// "Send now" / `Ctrl+Enter` path, which uses [`Interject`](Self::Interject)
/// directly because the local queue is client-owned.
@@ -301,7 +301,7 @@ pub enum Action {
/// duration. The dispatch handler renders + writes the file and arms
/// `AppView::pending_pager_path`; the event loop does the suspend/restore.
OpenTranscriptPager,
/// Minimal mode (`grok --minimal`): re-print the most-recently committed
/// Minimal mode (`kigi --minimal`): re-print the most-recently committed
/// folded block (collapsed reasoning / truncated tool output) into native
/// scrollback, fully expanded, below the conversation (design decision K10).
/// Bound to `Ctrl+E` and the `/expand` command. No-op outside minimal mode
@@ -330,12 +330,12 @@ pub enum Action {
ExecuteHooksAction(kigi_hooks_plugins_types::HooksAction),
/// Execute a plugins management action from the modal.
ExecutePluginsAction(kigi_hooks_plugins_types::PluginsAction),
/// Add or update an MCP server via x.ai/mcp/upsert.
/// Add or update an MCP server via kigi/mcp/upsert.
UpsertMcpServer {
name: String,
config: Box<kigi_shell::util::config::McpServerConfig>,
},
/// Delete an MCP server via x.ai/mcp/delete.
/// Delete an MCP server via kigi/mcp/delete.
DeleteMcpServer {
server_name: String,
},
@@ -344,7 +344,7 @@ pub enum Action {
server_name: String,
enabled: bool,
},
/// Toggle a skill enable/disable via x.ai/skills/toggle.
/// Toggle a skill enable/disable via kigi/skills/toggle.
ToggleSkill {
skill_name: String,
enabled: bool,
@@ -373,7 +373,7 @@ pub enum Action {
CancelScheduledTask(String),
/// Demote the currently running execute tool to a background task.
DemoteToBackground,
/// Request current bundle cache status via `x.ai/bundle/status`.
/// Request current bundle cache status via `kigi/bundle/status`.
RequestBundleStatus,
/// View a catalog entry's raw content in the block viewer.
ViewCatalogEntry {
@@ -484,7 +484,7 @@ pub enum Action {
SetContextualHintSendNow(bool),
SetContextualHintSmallScreen(bool),
SetContextualHintWordSelect(bool),
/// Commit the active theme (canonical name, e.g. `"groknight"`, `"auto"`).
/// Commit the active theme (canonical name, e.g. `"kiginight"`, `"auto"`).
SetTheme(String),
/// Commit the theme used when the OS is in dark mode. Only updates
/// the live display when `theme = "auto"` AND system is in dark mode.
@@ -697,7 +697,7 @@ pub enum Action {
},
/// Persist the memory modal fullscreen preference to config.toml.
PersistMemoryFullscreen(bool),
/// Open the Agent Dashboard view (`/dashboard`, `Ctrl+\`, `grok dashboard`).
/// Open the Agent Dashboard view (`/dashboard`, `Ctrl+\`, `kigi dashboard`).
OpenDashboard,
/// Close the dashboard, returning to the previous `ActiveView`.
ExitDashboard,
@@ -913,7 +913,7 @@ pub enum Action {
/// Persist-and-notify semantics for [`Effect::PersistPermissionMode`].
///
/// Both variants write to `~/.kigi/config.toml` and route ACP
/// `x.ai/yolo_mode_changed` notifications. The ACP notification is
/// `kigi/yolo_mode_changed` notifications. The ACP notification is
/// gated on disk-write success when `WithRollback` is used.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PermissionModePersist {
@@ -1352,7 +1352,7 @@ pub enum Effect {
},
/// Fetch session list for the welcome screen session picker.
FetchSessionList {
/// Text search pushed down to `x.ai/session/list` as `query` (chat
/// Text search pushed down to `kigi/session/list` as `query` (chat
/// mode: forwarded to the backend conversations search). `None`
/// fetches the unfiltered list.
query: Option<String>,
@@ -1367,11 +1367,11 @@ pub enum Effect {
/// against the deep-search seq; chat: server refetch against the list seq).
DebounceSessionSearch { query: String, seq: u64 },
/// Fetch the leader session roster (FleetView dashboard) via
/// `x.ai/sessions/list`. Only issued in leader mode while the
/// `kigi/sessions/list`. Only issued in leader mode while the
/// dashboard is open.
FetchRoster,
/// Fetch the local on-disk session list (dormant/idle sessions) for the
/// dashboard via `x.ai/session/list` — the non-leader fallback for the
/// dashboard via `kigi/session/list` — the non-leader fallback for the
/// FleetView roster. Issued while the dashboard is open and NOT in leader
/// mode so the dashboard shows idle sessions instead of being empty.
FetchDashboardSessions,
@@ -1440,7 +1440,7 @@ pub enum Effect {
session_id: acp::SessionId,
task_id: String,
},
/// Cancel a subagent via `x.ai/subagent/cancel`.
/// Cancel a subagent via `kigi/subagent/cancel`.
KillSubagent {
session_id: acp::SessionId,
subagent_id: String,
@@ -1531,31 +1531,31 @@ pub enum Effect {
/// Toggle plan mode — fire-and-forget signal to the shell.
TogglePlanMode { session_id: acp::SessionId },
/// Remove a server-owned queued prompt: fire-and-forget
/// `x.ai/queue/remove`. The agent re-broadcasts the authoritative queue.
/// `kigi/queue/remove`. The agent re-broadcasts the authoritative queue.
QueueRemove {
session_id: acp::SessionId,
id: String,
expected_version: u64,
},
/// Reorder server-owned queued prompts: fire-and-forget `x.ai/queue/reorder`.
/// Reorder server-owned queued prompts: fire-and-forget `kigi/queue/reorder`.
QueueReorder {
session_id: acp::SessionId,
ordered_ids: Vec<String>,
},
/// Clear the caller's server-owned queued prompts: fire-and-forget
/// `x.ai/queue/clear`.
/// `kigi/queue/clear`.
QueueClear { session_id: acp::SessionId },
/// Replace the text of a server-owned queued prompt in place: fire-and-forget
/// `x.ai/queue/edit`. The session actor's serialized mailbox makes this
/// `kigi/queue/edit`. The session actor's serialized mailbox makes this
/// last-writer-wins for concurrent edits; the rebroadcast of
/// `x.ai/queue/changed` is the truth signal.
/// `kigi/queue/changed` is the truth signal.
QueueEdit {
session_id: acp::SessionId,
id: String,
new_text: String,
},
/// Interject a server-owned queued prompt into the running turn:
/// fire-and-forget `x.ai/queue/interject`. The session actor atomically
/// fire-and-forget `kigi/queue/interject`. The session actor atomically
/// removes it from the queue and merges its text into the in-flight turn,
/// then broadcasts both the interjection and the authoritative queue.
/// `new_text` (when `Some`, serialized as `newText`) replaces the stored
@@ -1595,7 +1595,7 @@ pub enum Effect {
cwd: std::path::PathBuf,
session_id: String,
},
/// Resolve the running agent name for a session (`x.ai/session/info`).
/// Resolve the running agent name for a session (`kigi/session/info`).
FetchSessionAgentName {
agent_id: AgentId,
session_id: acp::SessionId,
@@ -1611,24 +1611,24 @@ pub enum Effect {
PollAuthUrl { request_seq: u64 },
/// Submit a manually-pasted auth code (ext request).
SubmitAuthCode { request_seq: u64, code: String },
/// Fetch MCP server list from the shell (x.ai/mcp/list).
/// Fetch MCP server list from the shell (kigi/mcp/list).
FetchMcpsList {
agent_id: AgentId,
session_id: acp::SessionId,
cache: bool,
},
/// Trigger MCP OAuth for a server (x.ai/mcp/auth_trigger).
/// Trigger MCP OAuth for a server (kigi/mcp/auth_trigger).
McpAuthTrigger {
agent_id: AgentId,
session_id: acp::SessionId,
server_name: String,
},
/// Fetch hooks list from the shell (x.ai/hooks/list).
/// Fetch hooks list from the shell (kigi/hooks/list).
FetchHooksList {
agent_id: AgentId,
session_id: acp::SessionId,
},
/// Fetch plugins list from the shell (x.ai/plugins/list).
/// Fetch plugins list from the shell (kigi/plugins/list).
FetchPluginsList {
agent_id: AgentId,
session_id: acp::SessionId,
@@ -1645,39 +1645,39 @@ pub enum Effect {
session_id: acp::SessionId,
action: kigi_hooks_plugins_types::PluginsAction,
},
/// Fetch skills list from the shell (x.ai/skills/list).
/// Fetch skills list from the shell (kigi/skills/list).
FetchSkillsList {
agent_id: AgentId,
session_id: acp::SessionId,
},
/// Toggle a skill via x.ai/skills/toggle (enable/disable without restart).
/// Toggle a skill via kigi/skills/toggle (enable/disable without restart).
ToggleSkill {
agent_id: AgentId,
session_id: acp::SessionId,
skill_name: String,
enabled: bool,
},
/// Upsert an MCP server via x.ai/mcp/upsert.
/// Upsert an MCP server via kigi/mcp/upsert.
UpsertMcpServer {
agent_id: AgentId,
session_id: acp::SessionId,
name: String,
config: Box<kigi_shell::util::config::McpServerConfig>,
},
/// Delete an MCP server via x.ai/mcp/delete.
/// Delete an MCP server via kigi/mcp/delete.
DeleteMcpServer {
agent_id: AgentId,
session_id: acp::SessionId,
server_name: String,
},
/// Live-toggle an MCP server via x.ai/mcp/toggle (no restart needed).
/// Live-toggle an MCP server via kigi/mcp/toggle (no restart needed).
ToggleMcpServer {
agent_id: AgentId,
session_id: acp::SessionId,
server_name: String,
enabled: bool,
},
/// Toggle a single MCP tool via x.ai/mcp/toggle_tool.
/// Toggle a single MCP tool via kigi/mcp/toggle_tool.
ToggleMcpTool {
agent_id: AgentId,
session_id: acp::SessionId,
@@ -1685,20 +1685,20 @@ pub enum Effect {
tool_name: String,
enabled: bool,
},
/// Fetch and display session info via x.ai/session/info.
/// Fetch and display session info via kigi/session/info.
ShowSessionInfo {
agent_id: AgentId,
session_id: acp::SessionId,
show_resolved_model: bool,
},
/// Fetch and display detailed context usage via x.ai/session/info.
/// Fetch and display detailed context usage via kigi/session/info.
ShowContextInfo {
agent_id: AgentId,
session_id: acp::SessionId,
},
/// Fetch current bundle cache status via `x.ai/bundle/status`.
/// Fetch current bundle cache status via `kigi/bundle/status`.
FetchBundleStatus,
/// Fetch a bundled entry's raw content via `x.ai/bundle/entry/get`.
/// Fetch a bundled entry's raw content via `kigi/bundle/entry/get`.
FetchCatalogEntry { kind: String, name: String },
/// Send feedback about the current session (fire-and-forget POST).
SendFeedback {
@@ -1712,7 +1712,7 @@ pub enum Effect {
text: String,
cwd: std::path::PathBuf,
},
/// Send raw note to x.ai/memory/rewrite for LLM-powered reformatting.
/// Send raw note to kigi/memory/rewrite for LLM-powered reformatting.
/// On success, the rewritten text populates the prompt for inline review.
/// On failure, falls back to showing the raw text for review.
RewriteMemoryNote {
@@ -1733,31 +1733,31 @@ pub enum Effect {
agent_id: AgentId,
cwd: std::path::PathBuf,
},
/// Fire a /btw side question via x.ai/btw ext method.
/// Fire a /btw side question via kigi/btw ext method.
SendBtw {
agent_id: AgentId,
session_id: acp::SessionId,
question: String,
},
/// Request a session recap via the x.ai/recap ext method. Fire-and-forget:
/// Request a session recap via the kigi/recap ext method. Fire-and-forget:
/// the recap arrives later as a `SessionRecap` notification.
SendRecap {
session_id: acp::SessionId,
auto: bool,
},
/// Send a mid-turn interjection via x.ai/interject ext method.
/// Send a mid-turn interjection via kigi/interject ext method.
SendInterject {
agent_id: AgentId,
session_id: acp::SessionId,
text: String,
/// Client-minted id echoed back on the `x.ai/session/interjection`
/// Client-minted id echoed back on the `kigi/session/interjection`
/// broadcast so the originator can dedup its optimistic local block.
interjection_id: String,
/// Structured text + image content blocks. `None` for text-only
/// interjections — the wire shape stays byte-identical to legacy.
blocks: Option<Vec<acp::ContentBlock>>,
},
/// Log out via `x.ai/auth/logout` (shell clears auth.json + in-memory state).
/// Log out via `kigi/auth/logout` (shell clears auth.json + in-memory state).
Logout,
/// Log out then authenticate sequentially in one task.
SwitchAccount {
@@ -1785,7 +1785,7 @@ pub enum Effect {
cwd: std::path::PathBuf,
},
/// Delete a session's stored data (local + remote) via
/// `x.ai/session/delete`.
/// `kigi/session/delete`.
DeleteSession {
source: String,
session_id: String,
@@ -1793,7 +1793,7 @@ pub enum Effect {
},
/// Deep-search sessions by content (FTS via ACP).
DeepSearchSessions { query: String, seq: u64 },
/// Call `x.ai/session/fork` to create a peer session that resumes
/// Call `kigi/session/fork` to create a peer session that resumes
/// from `parent_session_id` in the same cwd (no worktree). Mirror of
/// the worktree branch of [`Effect::CreateWorktreeSession`]; the
/// worktree-fork path reuses `CreateWorktreeSession { load_session_id }`
@@ -1833,14 +1833,14 @@ pub enum Effect {
target_prompt_index: usize,
mode: crate::views::rewind::RewindMode,
},
/// Fetch Kimi usage/quota rows from the agent's `x.ai/billing`
/// Fetch Kimi usage/quota rows from the agent's `kigi/billing`
/// extension (`GET {base}/usages` shell-side) for the `/usage` view.
FetchUsage { agent_id: AgentId },
/// Spawn a debounce sleep task for shell suggestions. `agent_id` rides
/// to the expiry so the fetch is built from the arming agent, not
/// whatever view is active when the timer fires.
DebounceSuggestions { agent_id: AgentId, generation: u64 },
/// Send an ACP `x.ai/suggest` request to the shell. `agent_id` is echoed
/// Send an ACP `kigi/suggest` request to the shell. `agent_id` is echoed
/// on the result so the response routes to the agent that fetched, not
/// whatever view is active when it lands.
FetchShellSuggestions {
@@ -1857,13 +1857,13 @@ pub enum Effect {
/// (path/file); the as-you-type surface keeps all of them.
token_only: bool,
},
/// Send an ACP `x.ai/suggestPrompt` request to the shell — predict the
/// Send an ACP `kigi/suggestPrompt` request to the shell — predict the
/// user's likely next prompt after a completed turn (tab autocomplete
/// ghost text).
FetchPromptSuggestion {
agent_id: AgentId,
generation: u64,
/// Suggestion model resolved by the pager (`grok-build-0.1` when the
/// Suggestion model resolved by the pager (`kigi-0.1` when the
/// catalog offers it); `None` = shell falls back to the session model.
model: Option<String>,
session_id: Option<String>,
@@ -1884,7 +1884,7 @@ pub enum Effect {
preparation: crate::prompt_images::PromptImagePreviewPreparation,
},
}
/// Outcome of an `x.ai/subagent/cancel` request, telling dispatch whether the
/// Outcome of an `kigi/subagent/cancel` request, telling dispatch whether the
/// pager must finalize the subagent row itself.
#[derive(Debug)]
pub enum SubagentKillOutcome {
@@ -1951,7 +1951,7 @@ pub enum TaskResult {
restore_summary: Option<String>,
restore_degree: Option<kigi_workspace::session::git::RestoreDegree>,
/// The session's in-flight running prompt id (from the load response
/// `_meta["x.ai/runningPromptId"]`), present only when the session was
/// `_meta["kigi/runningPromptId"]`), present only when the session was
/// loaded MID-turn (another client is driving). The loader adopts it to
/// pass the live `session/update` gate without re-rendering the user
/// block (replay already rendered it).
@@ -2014,7 +2014,7 @@ pub enum TaskResult {
query: String,
seq: u64,
},
/// Leader session roster loaded via `x.ai/sessions/list`.
/// Leader session roster loaded via `kigi/sessions/list`.
RosterLoaded {
sessions: Vec<crate::app::roster::RosterEntry>,
},
@@ -2085,7 +2085,7 @@ pub enum TaskResult {
/// Cancel notification was sent (fire-and-forget).
/// The real turn end comes via PromptResponse.
CancelComplete,
/// Response to `x.ai/subagent/cancel`; see [`SubagentKillOutcome`].
/// Response to `kigi/subagent/cancel`; see [`SubagentKillOutcome`].
KillSubagentComplete {
session_id: acp::SessionId,
subagent_id: String,
@@ -2155,7 +2155,7 @@ pub enum TaskResult {
/// Deprecated: superseded by `mode` (authoritative). Kept only as a
/// back-compat fallback for older agents that don't send `mode`.
external: bool,
/// Presentation mode from `x.ai/auth/get_url`; `None` on older agents.
/// Presentation mode from `kigi/auth/get_url`; `None` on older agents.
mode: Option<String>,
},
/// Auth code was submitted (fire-and-forget).
@@ -2303,7 +2303,7 @@ pub enum TaskResult {
agent_id: AgentId,
result: Result<String, String>,
},
/// `x.ai/recap` request acknowledged (fire-and-forget). The recap itself
/// `kigi/recap` request acknowledged (fire-and-forget). The recap itself
/// arrives separately as a `SessionRecap` notification; this only carries
/// a transport error, if any, for logging.
RecapRequested {
@@ -2342,7 +2342,7 @@ pub enum TaskResult {
results: Vec<kigi_shell::extensions::session_search::SearchSessionHit>,
seq: u64,
},
/// `x.ai/session/fork` completed (no-worktree path). The pager adopts
/// `kigi/session/fork` completed (no-worktree path). The pager adopts
/// the new session id and emits [`Effect::LoadSession`] to start the
/// replay. Mirrors [`TaskResult::WorktreeForked`] in shape.
ForkSessionReady {
@@ -2350,7 +2350,7 @@ pub enum TaskResult {
new_session_id: acp::SessionId,
cwd: std::path::PathBuf,
},
/// `x.ai/session/fork` failed. The placeholder agent stays in
/// `kigi/session/fork` failed. The placeholder agent stays in
/// `app.agents` with no `session_id` so the user can switch away.
ForkSessionFailed {
agent_id: AgentId,
@@ -2393,7 +2393,7 @@ pub enum TaskResult {
agent_id: AgentId,
generation: u64,
},
/// Shell suggestions loaded from ACP `x.ai/suggest`. `request_text` /
/// Shell suggestions loaded from ACP `kigi/suggest`. `request_text` /
/// `request_cursor` echo what the request was built from — the anchor
/// the items' `replaceRange` offsets index into and the position Tab
/// targets, paired atomically with them; `agent_id` routes the landing
@@ -2404,7 +2404,7 @@ pub enum TaskResult {
request_text: String,
request_cursor: usize,
},
/// Predicted next prompt loaded from ACP `x.ai/suggestPrompt`.
/// Predicted next prompt loaded from ACP `kigi/suggestPrompt`.
/// `suggestion` is `None` when the shell had nothing to suggest.
PromptSuggestionLoaded {
agent_id: AgentId,