
This PR abstracts the communication layer for context servers, laying the groundwork for supporting multiple transport mechanisms and taking one step towards enabling remote servers. Key changes centre around creating a new `Transport` trait with methods for sending and receiving messages. I've implemented this trait for the existing stdio-based communication, which is now encapsulated in a `StdioTransport` struct. The `Client` struct has been refactored to use this new `Transport` trait instead of directly managing stdin and stdout. The next steps will involve implementing an SSE + HTTP transport and defining alternative context server settings for remote servers. Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <git@maxdeviant.com>
30 lines
877 B
Rust
30 lines
877 B
Rust
pub mod client;
|
|
mod context_server_tool;
|
|
mod extension_context_server;
|
|
pub mod manager;
|
|
pub mod protocol;
|
|
mod registry;
|
|
mod transport;
|
|
pub mod types;
|
|
|
|
use command_palette_hooks::CommandPaletteFilter;
|
|
pub use context_server_settings::{ContextServerSettings, ServerCommand, ServerConfig};
|
|
use gpui::{actions, App};
|
|
|
|
pub use crate::context_server_tool::ContextServerTool;
|
|
pub use crate::registry::ContextServerFactoryRegistry;
|
|
|
|
actions!(context_servers, [Restart]);
|
|
|
|
/// The namespace for the context servers actions.
|
|
pub const CONTEXT_SERVERS_NAMESPACE: &'static str = "context_servers";
|
|
|
|
pub fn init(cx: &mut App) {
|
|
context_server_settings::init(cx);
|
|
ContextServerFactoryRegistry::default_global(cx);
|
|
extension_context_server::init(cx);
|
|
|
|
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
filter.hide_namespace(CONTEXT_SERVERS_NAMESPACE);
|
|
});
|
|
}
|