Skip to main content

Module setup

Module setup 

Source
Expand description

Engine setup — boot sequence shared by TUI and headless modes.

Extracts the initialization logic that was previously inlined in chatui/mod.rs so both renderers can use the same boot path.

Structs§

BackgroundTasks
Background tasks spawned during boot. Aborts on drop.
ContinueInfo
Info about how a continued session was resolved.
EngineBoot
Result of the boot sequence — everything a renderer needs to start.
EngineOpts
Options for engine boot.

Functions§

boot
Run the full engine boot sequence: config → system prompt → skills → MCP → session → sockets → extensions
lock_session
The session lock for a boot() host that drives Runtime itself (rpc, synaps server). Continuing a session that another process (a TUI, the daemon, another rpc) holds is REFUSED: two writers would fork its history and the older one’s saves would overwrite the newer’s. So is continuing a session already compacted into a successor (its history is closed). A fresh session, or a lock that cannot be taken for another reason (e.g. a read-only sessions dir), proceeds best-effort, as the session actor does. The lock is held for the returned value’s lifetime; a holder that continued a session runs crash recovery (recover_turn_draft).
recover_turn_draft
Crash recovery: if sessions/<id>.turn exists, the process that last ran this session died with a turn open. Fold the draft into the history (engine::interrupt::recover_crashed_turn), persist that, THEN remove the draft.