pub struct ReloadContext {Show 14 fields
pub extension_session: ExtensionSessionCell,
pub js_extension_session: Option<JsExtensionSession>,
pub package_resources: Arc<PackageResources>,
pub action_bridge: ActionBridgeCell,
pub catalog: Vec<Model>,
pub gateway: 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 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).
js_extension_session: Option<JsExtensionSession>JS/TS Pi extension host kept alive for the interactive session.
package_resources: Arc<PackageResources>The exact trust-gated package set resolved during initial build. The TUI reuses this snapshot so failed startup remediation is not retried or accidentally exposed by a second best-effort discovery pass.
action_bridge: ActionBridgeCellThe live action-bridge cell (swapped + old invalidated on reload).
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).
gateway: Arc<dyn Provider>The resolved gateway provider clone (for rebuilding models =
vec![gateway] + 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.
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§
Source§impl Clone for ReloadContext
impl Clone for ReloadContext
Source§fn clone(&self) -> ReloadContext
fn clone(&self) -> ReloadContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more