context_store: Refactor state management (#29910)
Because we instantiated `ContextServerManager` both in `agent` and `assistant-context-editor`, and these two entities track the running MCP servers separately, we were effectively running every MCP server twice. This PR moves the `ContextServerManager` into the project crate (now called `ContextServerStore`). The store can be accessed via a project instance. This ensures that we only instantiate one `ContextServerStore` per project. Also, this PR adds a bunch of tests to ensure that the `ContextServerStore` behaves correctly (Previously there were none). Closes #28714 Closes #29530 Release Notes: - N/A
This commit is contained in:
parent
8199664a5a
commit
9cb5ffac25
43 changed files with 1570 additions and 1049 deletions
|
@ -362,6 +362,8 @@ pub trait ExtensionContextServerProxy: Send + Sync + 'static {
|
|||
server_id: Arc<str>,
|
||||
cx: &mut App,
|
||||
);
|
||||
|
||||
fn unregister_context_server(&self, server_id: Arc<str>, cx: &mut App);
|
||||
}
|
||||
|
||||
impl ExtensionContextServerProxy for ExtensionHostProxy {
|
||||
|
@ -377,6 +379,14 @@ impl ExtensionContextServerProxy for ExtensionHostProxy {
|
|||
|
||||
proxy.register_context_server(extension, server_id, cx)
|
||||
}
|
||||
|
||||
fn unregister_context_server(&self, server_id: Arc<str>, cx: &mut App) {
|
||||
let Some(proxy) = self.context_server_proxy.read().clone() else {
|
||||
return;
|
||||
};
|
||||
|
||||
proxy.unregister_context_server(server_id, cx)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ExtensionIndexedDocsProviderProxy: Send + Sync + 'static {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue