pub struct ExtensionManager { /* private fields */ }Expand description
Manages the lifecycle of all loaded extensions.
Implementations§
Source§impl ExtensionManager
impl ExtensionManager
Sourcepub fn new_with_tools(
hook_bus: Arc<HookBus>,
tools: Arc<RwLock<ToolRegistry>>,
) -> Self
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.
Sourcepub async fn load(
&mut self,
id: &str,
manifest: &ExtensionManifest,
) -> Result<(), String>
pub async fn load( &mut self, id: &str, manifest: &ExtensionManifest, ) -> Result<(), String>
Load and start an extension from its manifest.
Sourcepub async fn load_with_cwd(
&mut self,
id: &str,
manifest: &ExtensionManifest,
cwd: Option<PathBuf>,
) -> Result<(), String>
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.
Sourcepub async fn unload(&mut self, id: &str) -> Result<(), String>
pub async fn unload(&mut self, id: &str) -> Result<(), String>
Unload an extension — unsubscribe hooks and shut down the process.
Sourcepub async fn reload(
&mut self,
id: &str,
manifest: &ExtensionManifest,
cwd: Option<PathBuf>,
) -> Result<(), String>
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.
Sourcepub async fn shutdown_all(&mut self)
pub async fn shutdown_all(&mut self)
Shut down all extensions gracefully.
Sourcepub fn shutdown_all_detached(manager: Arc<RwLock<Self>>) -> JoinHandle<()>
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.
Sourcepub async fn statuses(&self) -> Vec<ExtensionStatus>
pub async fn statuses(&self) -> Vec<ExtensionStatus>
Return health snapshots for all loaded extensions, sorted by ID.
Sourcepub fn providers(&self) -> Vec<&RegisteredProvider>
pub fn providers(&self) -> Vec<&RegisteredProvider>
Return registered provider metadata sorted by runtime id.
Sourcepub fn provider(&self, runtime_id: &str) -> Option<&RegisteredProvider>
pub fn provider(&self, runtime_id: &str) -> Option<&RegisteredProvider>
Return registered provider metadata by runtime id.
Sourcepub fn plugin_info(&self, id: &str) -> Option<&PluginInfo>
pub fn plugin_info(&self, id: &str) -> Option<&PluginInfo>
Return optional cached plugin info reported by info.get.
Sourcepub async fn sidecar_spawn_args(
&self,
id: &str,
) -> Result<SidecarSpawnArgs, String>
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”.
Sourcepub async fn invoke_command(
&self,
id: &str,
command: &str,
args: Vec<String>,
request_id: &str,
sink: UnboundedSender<InvokeCommandEvent>,
) -> Result<Value, String>
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.
pub async fn settings_editor_open( &self, id: &str, category: &str, field: &str, ) -> Result<Value, String>
pub async fn settings_editor_key( &self, id: &str, category: &str, field: &str, key: &str, ) -> Result<Value, String>
pub async fn settings_editor_commit( &self, id: &str, category: &str, field: &str, value: Value, ) -> Result<Value, String>
Sourcepub fn plugin_infos(&self) -> Vec<(&str, &PluginInfo)>
pub fn plugin_infos(&self) -> Vec<(&str, &PluginInfo)>
Return all cached plugin info sorted by extension id.
Sourcepub fn provider_summaries(&self) -> Vec<RegisteredProviderSummary>
pub fn provider_summaries(&self) -> Vec<RegisteredProviderSummary>
Return provider status summaries sorted by provider runtime id.
Sourcepub async fn capability_snapshots(&self) -> Vec<ExtensionCapabilitySnapshot>
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.
Sourcepub fn provider_tool_use_runtime_ids(&self) -> Vec<String>
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.
Sourcepub fn provider_trust_view(&self) -> BTreeMap<String, bool>
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.
Sourcepub fn config_diagnostics(&self, id: &str) -> Option<ExtensionConfigDiagnostics>
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.
Sourcepub fn all_config_diagnostics(&self) -> Vec<ExtensionConfigDiagnostics>
pub fn all_config_diagnostics(&self) -> Vec<ExtensionConfigDiagnostics>
Diagnostics for all loaded extensions, sorted alphabetically by id.
Get the shared tool registry, when this manager was constructed with one.
Sourcepub async fn discover_and_load(
&mut self,
) -> (Vec<String>, Vec<ExtensionLoadFailure>)
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.
Sourcepub async fn discover_and_load_with_progress<F>(
&mut self,
progress: F,
) -> (Vec<String>, Vec<ExtensionLoadFailure>)where
F: FnMut(ExtensionLoaderEvent),
pub async fn discover_and_load_with_progress<F>(
&mut self,
progress: F,
) -> (Vec<String>, Vec<ExtensionLoadFailure>)where
F: FnMut(ExtensionLoaderEvent),
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§
impl Freeze for ExtensionManager
impl !RefUnwindSafe for ExtensionManager
impl Send for ExtensionManager
impl Sync for ExtensionManager
impl Unpin for ExtensionManager
impl UnsafeUnpin for ExtensionManager
impl !UnwindSafe for ExtensionManager
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.