agent: Remove context server settings when uninstalling MCP extension (#32560)
Release Notes: - agent: Automatically remove context server settings when uninstalling MCP extension
This commit is contained in:
parent
e8ba8bb1eb
commit
717bf35484
6 changed files with 171 additions and 19 deletions
|
@ -132,6 +132,7 @@ pub enum Event {
|
|||
ExtensionsUpdated,
|
||||
StartedReloading,
|
||||
ExtensionInstalled(Arc<str>),
|
||||
ExtensionUninstalled(Arc<str>),
|
||||
ExtensionFailedToLoad(Arc<str>),
|
||||
}
|
||||
|
||||
|
@ -842,6 +843,8 @@ impl ExtensionStore {
|
|||
let work_dir = self.wasm_host.work_dir.join(extension_id.as_ref());
|
||||
let fs = self.fs.clone();
|
||||
|
||||
let extension_manifest = self.extension_manifest_for_id(&extension_id).cloned();
|
||||
|
||||
match self.outstanding_operations.entry(extension_id.clone()) {
|
||||
btree_map::Entry::Occupied(_) => return,
|
||||
btree_map::Entry::Vacant(e) => e.insert(ExtensionOperation::Remove),
|
||||
|
@ -878,6 +881,17 @@ impl ExtensionStore {
|
|||
)
|
||||
.await?;
|
||||
|
||||
this.update(cx, |_, cx| {
|
||||
cx.emit(Event::ExtensionUninstalled(extension_id.clone()));
|
||||
if let Some(events) = ExtensionEvents::try_global(cx) {
|
||||
if let Some(manifest) = extension_manifest {
|
||||
events.update(cx, |this, cx| {
|
||||
this.emit(extension::Event::ExtensionUninstalled(manifest.clone()), cx)
|
||||
});
|
||||
}
|
||||
}
|
||||
})?;
|
||||
|
||||
anyhow::Ok(())
|
||||
})
|
||||
.detach_and_log_err(cx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue