pub struct ReloadContext {Show 16 fields
pub extension_session: ExtensionSessionCell,
pub tool_context: ToolCallContext,
pub action_bridge: ActionBridgeCell,
pub ext_status: ExtensionStatusMailbox,
pub editor_text: EditorTextMailbox,
pub catalog: Vec<Model>,
pub providers: Vec<Arc<dyn Provider>>,
pub runtime: Handle,
pub cwd: PathBuf,
pub project_trusted: bool,
pub args: Args,
pub resolved_model: Model,
pub broadcast: Arc<dyn AgentEmitter>,
pub mailbox: ReloadMailbox,
pub ui_dialog: UiDialogMailbox,
pub dev_extension: Option<Arc<DevExtension>>,
}Expand description
Everything /reload needs to rebuild extension + resource state into a live
harness. Built once in build (alongside the harness) and held by the TUI
(cloned into the reload callback the bridge carries + the /reload command
handler). The harness itself is NOT held here — the TUI already owns a
&AgentHarness / a clone; passing it at the call site keeps this struct
free of a harness back-reference (so it can be Clone and moved into the
reload callback without borrowing the harness).
Fields§
§extension_session: ExtensionSessionCellThe live extension-session cell (swapped on reload).
tool_context: ToolCallContextThe session’s plugin-tool context (cwd + session id), reused — not
rebuilt — on reload so the rebuilt adapters keep serving the SAME
session. A reload that made a fresh context would leave every plugin
tool without a session id until the next launch.
action_bridge: ActionBridgeCellThe live action-bridge cell (swapped + old invalidated on reload).
ext_status: ExtensionStatusMailboxThe extension status registry the TUI renders in its footer (SetStatus).
Lives in the context (not the cell) so it survives a bridge swap.
editor_text: EditorTextMailboxThe extension editor-text queue the TUI drains into the prompt editor
(SetEditorText, runtime action 19). Lives in the context (not the cell)
so it survives a bridge swap — exactly like ext_status. A voice plugin
writes a transcription here as a draft; the TUI applies it, starts the
optional auto-send countdown, and submits through the normal path so the
user bubble renders as usual.
catalog: Vec<Model>The model catalog (read-only) the host uses to resolve set_model(id).
available_catalog(resolved) is captured once — reload does not re-resolve
the provider (auth/provider resolution is a startup concern; reloading
extensions does not re-open auth).
providers: Vec<Arc<dyn Provider>>The resolved provider runtimes (for rebuilding models =
providers + PluggableProvider::from_session). Cheap to clone (Arc).
runtime: HandleThe ambient runtime handle (captured in build) — PluggableProvider
- the fresh
ActionBridgeneed a capturedHandleto spawn from any thread.
cwd: PathBufThe cwd (for static resource-dir resolution + context-file walk).
project_trusted: boolThe project-trust decision captured before provider and session setup. Startup consumers reuse this value so extension code cannot change the effective policy by mutating the process cwd while it is loading.
args: ArgsThe parsed args (cloned) — --no-*/--tools/--exclude-tools/
--extensions-dir/--no-extensions/--system-prompt/etc all apply on
reload exactly as at startup (a reload re-reads the same flags; it does
not pick up argv changes mid-session, which is the right contract — pi’s
/reload re-runs discovery with the same config).
resolved_model: ModelThe resolved model + thinking level (the harness’s active model stays
unless set_model changed it; reload does not touch the model).
broadcast: Arc<dyn AgentEmitter>The broadcast emitter the harness was built with. Reload rebuilds the
TeeEmitter over the fresh ExtensionEmitter (the old tee’s extension
child is dropped, unsubscribing from the old registry). The broadcast
half stays live the whole session (the TUI’s drain task holds the
receiver), so we keep a handle to re-wrap.
mailbox: ReloadMailboxThe session-long reload mailbox (B5d). Build creates one, installs it on
the initial ActionBridge via [reload_callback_from_mailbox], and hands
a clone to the TUI. The TUI installs its TuiMessage sender so a plugin’s
runtime_action(Reload) signals the main loop — the reload routine reuses
THIS mailbox (not a fresh default) when building the fresh bridge, so the
bridge always carries the mailbox the TUI installed across reloads.
ui_dialog: UiDialogMailboxSession-long UI-dialog mailbox (runtime action 17). The initial bridge
carries it; the TUI attaches itself and polls take_pending from its key
loop, and /reload reuses THIS mailbox when it builds the fresh bridge.
A detached mailbox makes ask_user fail with “requires an interactive
UI” (headless contract).
dev_extension: Option<Arc<DevExtension>>Active rpi dev extension builder. /reload rebuilds it before
swapping plugin sessions; its watcher signals mailbox after a
successful background build.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ReloadContext
impl !UnwindSafe for ReloadContext
impl Freeze for ReloadContext
impl Send for ReloadContext
impl Sync for ReloadContext
impl Unpin for ReloadContext
impl UnsafeUnpin for ReloadContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more