Skip to main content

Module domain

Module domain 

Source
Expand description

Pure-function reducer: fn update(State, Msg) -> (State, Vec<Cmd>).

Heart of the MVU architecture. Everything here is synchronous, does no I/O, and is testable without tokio or a terminal. The effect runner (crate::effect) takes the Cmd values the reducer emits and performs the actual work; results come back as Msg events that feed into another update call.

The split is load-bearing: stale events racing with cancellation, lost tool results, and two event loops competing for input are all impossible to express against these types.

Re-exports§

pub use action::ActionDetails;
pub use action::ActionDisplay;
pub use action::ActionResult;
pub use cmd::ChatRequest;
pub use cmd::Cmd;
pub use cmd::ToolDefinition;
pub use compaction::CompactionArchive;
pub use compaction::CompactionPolicy;
pub use compaction::CompactionRecord;
pub use compaction::CompactionRequest;
pub use compaction::CompactionResult;
pub use compaction::CompactionTrigger;
pub use compaction::PreparedCompaction;
pub use compaction::build_replacement_messages;
pub use compaction::build_summary_request;
pub use compaction::build_verification_request;
pub use compaction::combine_usage;
pub use compaction::compaction_receipt;
pub use compaction::context_exceeds_hard_limit;
pub use compaction::format_compact_count;
pub use compaction::normalize_summary;
pub use compaction::prepare_compaction;
pub use compaction::should_auto_compact;
pub use ids::IdAllocator;
pub use ids::ToolCallId;
pub use ids::TurnId;
pub use msg::Key;
pub use msg::KeyCode;
pub use msg::KeyMods;
pub use msg::Msg;
pub use msg::MsgKind;
pub use msg::Paste;
pub use msg::SlashCmd;
pub use msg::StartupConfig;
pub use reducer::build_chat_request;
pub use reducer::update;
pub use runtime::ManagedProcess;
pub use runtime::ManagedProcessStatus;
pub use runtime::ProviderCapabilitySnapshot;
pub use runtime::RuntimeSignal;
pub use runtime::RuntimeState;
pub use runtime::RuntimeTimelineEvent;
pub use runtime::RuntimeTimelineKind;
pub use runtime::ToolArtifact;
pub use runtime::ToolMetadata;
pub use runtime::ToolRunMetadata;
pub use runtime::ToolStatus;
pub use slash_commands::COMMAND_REGISTRY;
pub use slash_commands::SlashCommand;
pub use slash_commands::filter_by_prefix;
pub use state::Attachment;
pub use state::Confirmation;
pub use state::ConfirmationTarget;
pub use state::ContextUsageSnapshot;
pub use state::ConversationSummary;
pub use state::GenPhase;
pub use state::IdAllocatorBundle;
pub use state::McpServerEntry;
pub use state::McpServerStatus;
pub use state::McpState;
pub use state::McpToolSpec;
pub use state::PendingToolCall;
pub use state::PromptTokenBreakdown;
pub use state::Session;
pub use state::State;
pub use state::StatusKind;
pub use state::StatusLine;
pub use state::TokenUsageTotals;
pub use state::ToolOutcome;
pub use state::TurnState;
pub use state::UiMode;
pub use state::UiState;
pub use state::estimate_context_usage_for_request;
pub use transition::action_display_for;
pub use transition::commit_assistant_message;
pub use transition::fill_outcome;
pub use transition::start_executing_tools;
pub use transition::start_generating;
pub use transition::tool_result_messages;
pub use transition::try_complete_outcomes;

Modules§

action
Value types describing one tool action’s display.
cmd
Everything the reducer asks the outside world to do.
compaction
Conversation context compaction.
ids
Typed identifiers used throughout the reducer.
msg
Every input to the reducer.
reducer
The pure reducer: fn update(State, Msg) -> (State, Vec<Cmd>).
runtime
Runtime metadata shared by the reducer, recorder, and renderer.
slash_commands
Single source of truth for slash commands. Used by:
state
The single state shape for the whole application.
transition
Helpers that enforce invariants during turn-state transitions.