Skip to main content

ExtensionManager

Struct ExtensionManager 

Source
pub struct ExtensionManager { /* private fields */ }
Expand description

Manages the lifecycle of all loaded extensions.

Implementations§

Source§

impl ExtensionManager

Source

pub fn new(hook_bus: Arc<HookBus>) -> Self

Create a new manager with a shared hook bus.

Source

pub fn new_with_tools( hook_bus: Arc<HookBus>, tools: Arc<RwLock<ToolRegistry>>, ) -> Self

Create a new manager with shared hook bus and tool registry.

Source

pub async fn load( &mut self, id: &str, manifest: &ExtensionManifest, ) -> Result<(), String>

Load and start an extension from its manifest.

Source

pub async fn load_with_cwd( &mut self, id: &str, manifest: &ExtensionManifest, cwd: Option<PathBuf>, ) -> Result<(), String>

Load and start an extension from its manifest with a process cwd.

Source

pub async fn unload(&mut self, id: &str) -> Result<(), String>

Unload an extension — unsubscribe hooks and shut down the process.

Source

pub async fn reload( &mut self, id: &str, manifest: &ExtensionManifest, cwd: Option<PathBuf>, ) -> Result<(), String>

Reload one extension by unloading any existing instance first, then loading the supplied manifest. If the new load fails, the previous instance remains unloaded so duplicate handlers cannot survive a broken reload.

Source

pub async fn shutdown_all(&mut self)

Shut down all extensions gracefully.

Source

pub fn shutdown_all_detached(manager: Arc<RwLock<Self>>) -> JoinHandle<()>

Start shutting down all extensions in the background.

This is intended for process exit: the UI should not hang waiting for extension child processes to acknowledge shutdown. Dropping the join handle lets Tokio abort remaining work when the runtime exits.

Source

pub fn list(&self) -> Vec<&str>

List running extension IDs.

Source

pub fn count(&self) -> usize

Number of running extensions.

Source

pub async fn statuses(&self) -> Vec<ExtensionStatus>

Return health snapshots for all loaded extensions, sorted by ID.

Source

pub fn providers(&self) -> Vec<&RegisteredProvider>

Return registered provider metadata sorted by runtime id.

Source

pub fn provider(&self, runtime_id: &str) -> Option<&RegisteredProvider>

Return registered provider metadata by runtime id.

Source

pub fn plugin_info(&self, id: &str) -> Option<&PluginInfo>

Return optional cached plugin info reported by info.get.

Source

pub async fn sidecar_spawn_args( &self, id: &str, ) -> Result<SidecarSpawnArgs, String>

Ask a plugin for its sidecar spawn arguments. Best-effort — plugins that don’t host a sidecar (or pre-Phase-7 plugins that haven’t implemented the RPC yet) return Err. Callers are expected to treat that as “no overrides; use manifest defaults”.

Source

pub async fn invoke_command( &self, id: &str, command: &str, args: Vec<String>, request_id: &str, sink: UnboundedSender<InvokeCommandEvent>, ) -> Result<Value, String>

Invoke an interactive plugin command on extension id. Streams command.output (matching request_id) and task.* notifications to sink. Returns the final JSON-RPC response value.

Source

pub async fn settings_editor_open( &self, id: &str, category: &str, field: &str, ) -> Result<Value, String>

Source

pub async fn settings_editor_key( &self, id: &str, category: &str, field: &str, key: &str, ) -> Result<Value, String>

Source

pub async fn settings_editor_commit( &self, id: &str, category: &str, field: &str, value: Value, ) -> Result<Value, String>

Source

pub fn plugin_infos(&self) -> Vec<(&str, &PluginInfo)>

Return all cached plugin info sorted by extension id.

Source

pub fn provider_summaries(&self) -> Vec<RegisteredProviderSummary>

Return provider status summaries sorted by provider runtime id.

Source

pub async fn capability_snapshots(&self) -> Vec<ExtensionCapabilitySnapshot>

Unified capability snapshot per loaded extension, sorted by id.

Aggregates hook subscriptions, extension-provided tools, and registered providers. future carries plugin-defined capability kinds and capabilities land.

Source

pub fn provider_tool_use_runtime_ids(&self) -> Vec<String>

Return runtime ids of registered providers that declare at least one tool-use-capable model. Sorted by runtime id.

Source

pub fn provider_trust_view(&self) -> BTreeMap<String, bool>

Return a runtime_id -> enabled map for every registered provider, computed from the persisted trust state. Providers without an entry default to enabled. If the trust state file is missing, all providers are reported as enabled (default). If the file is corrupt, all providers are reported as disabled (fail-closed) and a warning is logged.

Source

pub fn config_diagnostics(&self, id: &str) -> Option<ExtensionConfigDiagnostics>

Compute config diagnostics for a loaded extension by id. Returns None if the extension is not loaded.

Source

pub fn all_config_diagnostics(&self) -> Vec<ExtensionConfigDiagnostics>

Diagnostics for all loaded extensions, sorted alphabetically by id.

Source

pub fn hook_bus(&self) -> &Arc<HookBus>

Get the shared hook bus.

Source

pub fn tools_shared(&self) -> Option<Arc<RwLock<ToolRegistry>>>

Get the shared tool registry, when this manager was constructed with one.

Source

pub async fn discover_and_load( &mut self, ) -> (Vec<String>, Vec<ExtensionLoadFailure>)

Discover and load all extensions from the user and project plugin directories.

Scans ~/.synaps-cli/plugins/*/.synaps-plugin/plugin.json and ./.synaps/plugins/*/.synaps-plugin/plugin.json for manifests that contain an extension field. Project-local plugins override user plugins with the same directory name.

Source

pub async fn discover_and_load_with_progress<F>( &mut self, progress: F, ) -> (Vec<String>, Vec<ExtensionLoadFailure>)

Discover and load all extensions, invoking progress after each load attempt. Used by the async UI loader to update startup toasts without blocking first paint.

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<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,