pub struct ExtensionSession { /* private fields */ }Expand description
The result of loading a session’s worth of extensions: a shared keepalive for
the cdylib handles + a snapshot of the merged registry. Built by
load_session; the host (pi-cli) stashes one per harness build and hands
clones of the keepalive to each adapter it constructs from the snapshot.
The snapshot is held behind Arc so the host can hand a clone to the
ExtensionEmitter (installed as the harness’s
agent_emitter) without borrowing — the emitter must outlive this session
local (it lives for the harness lifetime inside AgentHarnessOptions).
Clone (B5d): every field is already cheaply clonable (Arc<PluginKeepalive>,
Option<Arc<RegistrySnapshot>>, Vec<PathBuf>, Option<Arc<ActionBridge>>),
so the reload routine can clone the live session out of its Mutex cell for
local inspection (snapshot/keepalive/loaded_paths) and store a fresh one back
in — without a borrow spanning the store.
Implementations§
Source§impl ExtensionSession
impl ExtensionSession
Sourcepub fn from_parts(
snapshot: Arc<RegistrySnapshot>,
keepalive: Arc<PluginKeepalive>,
loaded_paths: Vec<PathBuf>,
action_bridge: Option<Arc<ActionBridge>>,
) -> Self
pub fn from_parts( snapshot: Arc<RegistrySnapshot>, keepalive: Arc<PluginKeepalive>, loaded_paths: Vec<PathBuf>, action_bridge: Option<Arc<ActionBridge>>, ) -> Self
Assemble a session from already-loaded parts (explicit --extension
files via load_one + merge_registries). Mirrors load_session’s
internal assembly so callers can build a session without a dir scan.
Sourcepub fn keepalive(&self) -> Arc<PluginKeepalive> ⓘ
pub fn keepalive(&self) -> Arc<PluginKeepalive> ⓘ
The shared keepalive — clone one per adapter/emitter you build from this session so the cdylibs outlive them.
Sourcepub fn snapshot(&self) -> Option<&RegistrySnapshot>
pub fn snapshot(&self) -> Option<&RegistrySnapshot>
The merged registry snapshot (tools/commands/handlers), if any plugin
loaded. None when no plugins loaded successfully. Borrowed view for
iterating tools/commands; for an owned share (e.g. handing to the
emitter) use snapshot_arc.
Sourcepub fn snapshot_arc(&self) -> Option<Arc<RegistrySnapshot>>
pub fn snapshot_arc(&self) -> Option<Arc<RegistrySnapshot>>
A shared (Arc) clone of the merged registry snapshot, for host code that
must keep the snapshot alive beyond this session local — notably the
ExtensionEmitter installed into
AgentHarnessOptions.agent_emitter.
Sourcepub fn loaded_paths(&self) -> &[PathBuf]
pub fn loaded_paths(&self) -> &[PathBuf]
Paths of the cdylibs that loaded + registered successfully (diagnostics).
Sourcepub fn summary(&self) -> Option<String>
pub fn summary(&self) -> Option<String>
A one-line human summary for --verbose startup output, or None when
nothing loaded (so the line is omitted entirely).
Sourcepub fn action_bridge(&self) -> Option<Arc<ActionBridge>>
pub fn action_bridge(&self) -> Option<Arc<ActionBridge>>
B5a: the session’s action bridge, if one was threaded into load_*.
rpi-cli recovers this after AgentHarness::create succeeds to call
HarnessActionHost::set_harness (filling the host cell the bridge’s
user_data-recovered host reads on the first plugin→host action). The
bridge pointer was already handed to plugins during register, so this
must happen before any run. None when no plugins loaded / tests /
--no-extensions.
Trait Implementations§
Source§impl Clone for ExtensionSession
impl Clone for ExtensionSession
Source§fn clone(&self) -> ExtensionSession
fn clone(&self) -> ExtensionSession
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more