Skip to main content

Module loader

Module loader 

Source
Expand description

Async extension loading orchestration.

The chat UI owns the manager behind an async lock; this module keeps startup snappy by running discovery/loading in the background and streaming progress events back to the UI (which can render them as toasts).

Enums§

ExtensionLoaderEvent

Functions§

emit_session_end
Session-level: fire on_session_end for one session — concurrent dispatch (the hook only allows continue, so ordering cannot matter), fail-open under budget. Clears the session’s keyed injection afterwards. Returns false if the budget elapsed (handlers may not have flushed; the transcript is already saved by the caller, so nothing is lost). Per session, not per process: every session in a daemon gets its own end event.
emit_session_start
Session-level: fire on_session_start for one session and store any inject as that session’s keyed injection (stream.rs reads it when composing the system prompt). Call AFTER discovery is known-finished — in-process hosts get that from spawn_discover_and_load itself; the daemon’s SessionActor awaits EngineHost::extensions_ready() first. Never re-runs discovery. Returns true when something was injected.
spawn_discover_and_load
Discover and load extensions in the background, then fire on_session_start.