Skip to main content

ReloadContext

Struct ReloadContext 

Source
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: ExtensionSessionCell

The 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: ActionBridgeCell

The 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: Handle

The ambient runtime handle (captured in build) — PluggableProvider

  • the fresh ActionBridge need a captured Handle to spawn from any thread.
§cwd: PathBuf

The cwd (for static resource-dir resolution + context-file walk).

§project_trusted: bool

The 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: Args

The 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: Model

The 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: ReloadMailbox

The 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

Source§

fn clone(&self) -> ReloadContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more