mount acp in the goosed server to migrate using acp protocols iteratively (#9097)

This commit is contained in:
Lifei Zhou
2026-05-18 09:43:30 +10:00
committed by GitHub
parent d04c882388
commit 1fafd74413
17 changed files with 1430 additions and 61 deletions
+6 -1
View File
@@ -33,7 +33,12 @@ impl GooseAcpAgent {
pub(super) async fn on_get_extensions(
&self,
) -> Result<GetExtensionsResponse, agent_client_protocol::Error> {
let extensions = crate::config::extensions::get_all_extensions();
let extensions = crate::config::extensions::get_all_extensions()
.into_iter()
.filter(|ext| {
!crate::agents::extension_manager::is_hidden_extension(&ext.config.name())
})
.collect::<Vec<_>>();
let warnings = crate::config::extensions::get_warnings();
let extensions_json = extensions
.into_iter()
+19 -9
View File
@@ -94,10 +94,8 @@ async fn health() -> &'static str {
"ok"
}
pub fn create_router(server: Arc<AcpServer>, secret_key: String) -> Router {
let registry = Arc::new(connection::ConnectionRegistry::new(server));
let cors = CorsLayer::new()
fn acp_cors_layer() -> CorsLayer {
CorsLayer::new()
.allow_origin(Any)
.allow_methods([Method::GET, Method::POST, Method::DELETE, Method::OPTIONS])
.allow_headers([
@@ -113,14 +111,26 @@ pub fn create_router(server: Arc<AcpServer>, secret_key: String) -> Router {
.expose_headers([
HeaderName::from_static("acp-connection-id"),
HeaderName::from_static("acp-session-id"),
]);
])
}
fn create_acp_routes(server: Arc<AcpServer>) -> Router {
let registry = Arc::new(connection::ConnectionRegistry::new(server));
Router::new()
.route("/health", get(health))
.route("/status", get(health))
.route("/acp", post(http::handle_post).with_state(registry.clone()))
.route("/acp", get(handle_get).with_state(registry.clone()))
.route("/acp", delete(http::handle_delete).with_state(registry))
.merge(super::mcp_app_proxy::routes(secret_key))
.layer(cors)
}
pub fn create_acp_router(server: Arc<AcpServer>) -> Router {
create_acp_routes(server).layer(acp_cors_layer())
}
pub fn create_router(server: Arc<AcpServer>, secret_key: String) -> Router {
create_acp_routes(server)
.route("/health", get(health))
.route("/status", get(health))
.merge(super::mcp_app_proxy::routes(secret_key))
.layer(acp_cors_layer())
}