Skip to main content

Module app

Module app 

Source

Re-exports§

pub use event_source::event_to_msg;
pub use lifecycle::RuntimeLifecycle;
pub use recorder::RECORDING_FORMAT_VERSION;
pub use recorder::RecordLine;
pub use recorder::Recorder;
pub use recorder::Replay;
pub use recorder::ReplayEntry;
pub use recorder::SessionHeader;
pub use replay::ReplayReport;
pub use replay::replay_recording;
pub use replay::run_replay;
pub use run::InteractiveOptions;
pub use run::run_interactive_with;
pub use run_non_interactive::RunOptions;
pub use run_non_interactive::RunResult;
pub use run_non_interactive::format_result;
pub use run_non_interactive::run_non_interactive_with;
pub use terminal::TerminalGuard;

Modules§

event_source
Crossterm event stream → Msg.
instructions
Project-instructions loader (Step 5h).
lifecycle
Process lifecycle signal handling.
memory
Durable semantic memory (v0.10.0).
plugin_assets
Plugin-contributed assets beyond skills: MCP servers (manifest.mcp), slash-command prompts (manifest.prompts), and agent types (manifest.agents).
recorder
--record / --replay support.
replay
--replay <file>: fold a recorded Msg log back through the pure reducer and reconstruct the session it describes.
run
The ~30-line main loop.
run_non_interactive
Headless driver for mermaid run <prompt>.
sandbox_exec
The hidden mermaid __sandbox-exec re-exec launcher.
skills
SKILL.md discovery + the always-injected skills index.
terminal
Terminal setup and teardown.

Functions§

get_config_dir
Get the configuration directory
init_config
Create a default configuration file if it doesn’t exist
load_config
Load the user-scope configuration (defaults + the user file, no project or session layers). This is the view persistence baselines, the daemon, and runtime re-reads use — anything that must not observe another repo’s project config or a one-off CLI flag.
load_config_or_warn
Like load_config (user scope, no session flags) but never fails: on a malformed config, warn on stderr (secret-redacted, #F13) and fall back to defaults (#111). For standalone subcommands that only read user settings.
load_layered_config
Load the full layered configuration: defaults < user file < project file < session flags. cwd locates the project layer (<git-root>/.mermaid/config.toml, sanitized + safety-clamped); pass None to skip it (daemon, tests).
load_layered_config_or_warn
Like load_layered_config but never fails — the startup entry point. On success, prints notices and layer-attributed warnings to stderr. On a malformed layer, warns (secret-redacted, #F13) and degrades: the session flags are re-applied over bare defaults so --no-network/-c survive a corrupt user file rather than being silently dropped with it.
load_project_scoped_config
The project-scoped view (defaults + user + project, NO session flags) for runtime re-reads keyed to a workdir — e.g. the memory settings consulted per operation. Never fails and never prints; warnings/notices were already surfaced by the startup load.
persist_default_reasoning
Persist the user’s default reasoning level. Used by the /reasoning slash command and the Alt+T cycle handler so the choice survives across sessions.
persist_last_model
Persist the last used model to the user config file.
persist_ollama_allow_ram_offload
Persist the Ollama RAM-offload toggle (/context offload on|off).
persist_ollama_num_ctx_for_model
Persist (or clear) a per-model Ollama num_ctx override. Some(n) sets it, None removes the entry (returning that model to auto-fit).
persist_plan_config
Persist the whole [plan] table (the /plan config picker). Values the user set through the picker are explicit choices, so writing them — including ones that currently match defaults — is correct; unset Options stay absent via skip_serializing_if.
persist_reasoning_for_model
Persist a reasoning level for a specific model ID (e.g. <provider>/<model>). The TUI calls this from Alt+T, /reasoning <level>, and the does-not-support-thinking auto-snap so the choice sticks per-model rather than bleeding into other models on next session start.
persist_ui_theme
Persist the TUI theme choice (/theme dark|light).
remove_user_config_key
Remove one key (pre-split path segments) from the USER config file. Returns whether the key existed.
resolve_model_id
Resolve which model to use: CLI arg > last_used > [default_model] > a local Ollama model > a configured provider’s default_model.
update_user_config_key
Set one key (pre-split path segments, so map keys containing dots — e.g. reasoning_per_model."ollama/qwen3:8b" — address correctly) in the USER config file, leaving every other key untouched.