feat(goose-acp): enable parallel sessions with isolated agent state (#6392)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -12,17 +12,17 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
rmcp = { workspace = true, features = ["server", "client", "transport-io", "macros"] }
|
||||
anyhow = "1.0.94"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
anyhow = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-stream = { version = "0.1", features = ["io-util"] }
|
||||
tracing = "0.1"
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
tracing-appender = "0.2"
|
||||
url = "2.5"
|
||||
base64 = "0.21"
|
||||
thiserror = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
serde_json = { workspace = true }
|
||||
schemars = "1.0"
|
||||
lazy_static = "1.5"
|
||||
shellexpand = "3.1.0"
|
||||
@@ -38,7 +38,8 @@ etcetera = { workspace = true }
|
||||
tempfile = "3.8"
|
||||
include_dir = "0.7.4"
|
||||
webbrowser = {workspace = true}
|
||||
regex = "1.11.1"
|
||||
http-body-util = "0.1.2"
|
||||
regex = { workspace = true }
|
||||
once_cell = "1.20.2"
|
||||
ignore = { workspace = true }
|
||||
lopdf = "0.36.0"
|
||||
@@ -71,12 +72,13 @@ libc = "0.2"
|
||||
# ~1000 downloads). Pinned to exact version to prevent supply chain attacks.
|
||||
mpatch = "=0.2.0"
|
||||
tokio-util = "0.7.16"
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
serial_test = "3.0.0"
|
||||
sysinfo = "0.32.1"
|
||||
temp-env = "0.3.6"
|
||||
colored = "2"
|
||||
serial_test = { workspace = true }
|
||||
|
||||
[features]
|
||||
utoipa = ["dep:utoipa"]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use etcetera::AppStrategyArgs;
|
||||
use once_cell::sync::Lazy;
|
||||
use rmcp::{ServerHandler, ServiceExt};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub static APP_STRATEGY: Lazy<AppStrategyArgs> = Lazy::new(|| AppStrategyArgs {
|
||||
top_level_domain: "Block".to_string(),
|
||||
@@ -19,3 +21,52 @@ pub use computercontroller::ComputerControllerServer;
|
||||
pub use developer::rmcp_developer::DeveloperServer;
|
||||
pub use memory::MemoryServer;
|
||||
pub use tutorial::TutorialServer;
|
||||
|
||||
pub type SpawnServerFn = fn(tokio::io::DuplexStream, tokio::io::DuplexStream);
|
||||
|
||||
pub struct BuiltinDef {
|
||||
pub name: &'static str,
|
||||
pub spawn_server: SpawnServerFn,
|
||||
}
|
||||
|
||||
fn spawn_and_serve<S>(
|
||||
name: &'static str,
|
||||
server: S,
|
||||
transport: (tokio::io::DuplexStream, tokio::io::DuplexStream),
|
||||
) where
|
||||
S: ServerHandler + Send + 'static,
|
||||
{
|
||||
tokio::spawn(async move {
|
||||
match server.serve(transport).await {
|
||||
Ok(running) => {
|
||||
let _ = running.waiting().await;
|
||||
}
|
||||
Err(e) => tracing::error!(builtin = name, error = %e, "server error"),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
macro_rules! builtin {
|
||||
($name:ident, $server_ty:ty) => {{
|
||||
fn spawn(r: tokio::io::DuplexStream, w: tokio::io::DuplexStream) {
|
||||
spawn_and_serve(stringify!($name), <$server_ty>::new(), (r, w));
|
||||
}
|
||||
(
|
||||
stringify!($name),
|
||||
BuiltinDef {
|
||||
name: stringify!($name),
|
||||
spawn_server: spawn,
|
||||
},
|
||||
)
|
||||
}};
|
||||
}
|
||||
|
||||
pub static BUILTIN_EXTENSIONS: Lazy<HashMap<&'static str, BuiltinDef>> = Lazy::new(|| {
|
||||
HashMap::from([
|
||||
builtin!(developer, DeveloperServer),
|
||||
builtin!(autovisualiser, AutoVisualiserRouter),
|
||||
builtin!(computercontroller, ComputerControllerServer),
|
||||
builtin!(memory, MemoryServer),
|
||||
builtin!(tutorial, TutorialServer),
|
||||
])
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user