Files
Kigi-CLI/crates/codegen/kigi-tui/src/app/dispatch/mod.rs
T
ZacharyZhang-NY ea0ce9d15f F3: Kimi inference pipeline + full grok cloud-surface excision
Sampler / inference (PRD F3):
- kimi_compat.rs: single adaptation point for the Kimi chat/completions
  dialect (thinking-field mapping, model_id stripping, empty-content
  tool-call message fix, stream_options.include_usage), with kimi-cli
  source citations
- Rate-limit handling reworked for Kimi/Moonshot semantics; UA kigi/{version}
- /models replaces the xAI models-v2 endpoint everywhere; idle model
  refresh carries X-Msh-* device headers only (X-XAI-Token-Auth and
  x-grok-client-mode/CLIENT_MODE_HEADER machinery deleted)

Cloud-surface excision (PRD §5, zero-egress):
- remote/ conversations lane, cli-chat-proxy-types crate, prod/ dir,
  share command, credit bar: deleted (single local session lane;
  paginate() replaces merge_and_paginate)
- Subscription/tier gate stack deleted end-to-end: AppView
  gate/tier/team/ZDR fields, app/subscription.rs watch loop,
  dispatch/billing.rs paywall + SuperGrok upsell, free-usage-exhausted
  chain, tier-restricted commands, GateInfo, RemoteSettings gate fields,
  SettingsUpdateNotification gate fields
- /privacy + coding-data-sharing setting deleted (backed by a dead xAI
  RPC; Kigi is zero-egress — nothing to share or retain remotely)

Auth UX correctness (user-reported):
- Device-flow fixtures now mirror the live Kimi payload shape
  (https://www.kimi.com/code/authorize_device?user_code=..., verified
  against auth.kimi.com); the fabricated auth.kimi.com/device?code=...
  URLs are gone
- open_browser_detached is a no-op under cfg(test): unit tests drove
  wiremock fixture URLs into the real browser (root cause of the
  "garbage mock link" ABCD-1234 tabs)
- Welcome/pager-minimal rebrand: Grok Build -> Kigi, grok.com ->
  kimi.com, "Sign in to Grok" -> "Sign in to Kimi"
2026-07-17 16:05:51 -04:00

60 lines
2.1 KiB
Rust

//! Synchronous state dispatch: [`Action`](crate::app::actions::Action) → state mutations + [`Effect`](crate::app::actions::Effect)s.
//!
//! This is the core business logic of the application. It takes an action,
//! mutates application state, and returns a list of async effects to execute.
//!
//! **Invariants:**
//! - This module never touches the terminal, network, or filesystem.
//! - All mutations are synchronous and deterministic.
//! - Async work is described as [`Effect`](crate::app::actions::Effect) values, not executed.
//! - This makes dispatch fully testable without tokio or a terminal.
//!
//! Imports in this tree use at most one `super::` hop (absolute `crate::` paths
//! otherwise); tests/ shares a fixture prelude via `use super::*;`.
mod auth;
mod ctx;
mod dashboard;
mod import_claude;
mod interject;
mod jump;
mod modes;
mod notes;
mod permissions;
mod prompt;
mod queue;
mod rewind;
mod router;
mod session;
mod settings;
mod status;
mod task_result;
mod transcript;
mod turn;
pub(crate) use modes::{downgrade_displayed_auto_if_gated, effective_auto};
pub(crate) use notes::{recap_unavailable_toast, scrollback_has_user_messages};
pub(crate) use permissions::resolve_permission_queue_transition;
pub(crate) use prompt::dispatch_initial_prompt;
pub(in crate::app) use prompt::show_small_screen_tip;
pub(super) use queue::{
apply_turn_start_shim, arm_send_now_and_paint, maybe_drain_queue, shim_renders_own_user_block,
};
pub(in crate::app) use rewind::{find_user_prompt_entry_for_shell_index, shell_prompt_index_at};
pub(crate) use router::dispatch;
pub(crate) use settings::ui::refresh_open_settings_modals;
pub(crate) use status::commit_minimal_update_notice;
pub(crate) use turn::reconcile_overdue_turn_ends;
// Test-only consumers (cfg(test) mods elsewhere in the crate); a plain
// re-export trips -D unused-imports in the lib build.
#[cfg(test)]
pub(crate) use ctx::{SwitchCause, switch_to_agent};
#[cfg(test)]
pub(crate) use settings::ui::{ROLLBACK_NO_ARM_TOAST, build_pager_snapshot};
#[cfg(test)]
pub(crate) use turn::TURN_END_RECONCILE_GRACE;
#[cfg(test)]
mod tests;