feat: a lean ACP-only Goose binary (#11961)

This commit is contained in:
Jack Amadeo
2026-09-23 12:57:10 +00:00
committed by GitHub
parent 201837dffc
commit e678c3b64a
19 changed files with 505 additions and 219 deletions
+23
View File
@@ -3,13 +3,17 @@ use clap::{Args, CommandFactory, Parser, Subcommand};
use clap_complete::{generate, Shell as ClapShell};
use clap_complete_nushell::Nushell as ClapNushell;
use goose::agents::GoosePlatform;
#[cfg(feature = "bundled-mcp")]
use goose::builtin_extension::register_builtin_extensions;
use goose::config::{Config, GooseMode};
#[cfg(feature = "telemetry")]
use goose::posthog::get_telemetry_choice;
use goose::recipe::Recipe;
#[cfg(feature = "acp-http")]
use goose::source_roots::SourceRoot;
#[cfg(feature = "bundled-mcp")]
use goose_mcp::mcp_server_runner::{serve, McpCommand};
#[cfg(feature = "bundled-mcp")]
use goose_mcp::{AutoVisualiserRouter, ComputerControllerServer, MemoryServer, TutorialServer};
#[cfg(feature = "telemetry")]
@@ -24,6 +28,7 @@ use crate::commands::term::{
handle_term_info, handle_term_init, handle_term_log, handle_term_run, Shell,
};
#[cfg(feature = "scheduler")]
use crate::commands::schedule::{
handle_schedule_add, handle_schedule_cron_help, handle_schedule_list, handle_schedule_remove,
handle_schedule_run_now, handle_schedule_services_status, handle_schedule_services_stop,
@@ -39,8 +44,10 @@ use goose::session::session_manager::SessionType;
use goose::session::SessionManager;
use std::io::Read;
use std::path::PathBuf;
#[cfg(feature = "acp-http")]
const GOOSE_SERVER_SECRET_KEY_ENV: &str = "GOOSE_SERVER__SECRET_KEY";
#[cfg(feature = "acp-http")]
fn generate_serve_secret_key() -> String {
use rand::distr::{Alphanumeric, SampleString};
@@ -605,6 +612,7 @@ enum SessionCommand {
},
}
#[cfg(feature = "scheduler")]
#[derive(Subcommand, Debug)]
enum SchedulerCommand {
#[command(about = "Add a new scheduled job")]
@@ -819,6 +827,7 @@ enum Command {
Doctor {},
/// Manage system prompts and behaviors
#[cfg(feature = "bundled-mcp")]
#[command(about = "Run one of the mcp servers bundled with goose")]
Mcp {
#[arg(value_parser = clap::value_parser!(McpCommand))]
@@ -851,6 +860,7 @@ enum Command {
},
/// Start ACP server over HTTP and WebSocket
#[cfg(feature = "acp-http")]
#[command(about = "Start ACP server over HTTP and WebSocket")]
Serve {
#[arg(long, default_value = "127.0.0.1")]
@@ -1020,6 +1030,7 @@ enum Command {
},
/// Manage scheduled jobs
#[cfg(feature = "scheduler")]
#[command(about = "Manage scheduled jobs", visible_alias = "sched")]
Schedule {
#[command(subcommand)]
@@ -1381,14 +1392,17 @@ fn get_command_name(command: &Option<Command>) -> &'static str {
Some(Command::Configure {}) => "configure",
Some(Command::Doctor {}) => "doctor",
Some(Command::Info { .. }) => "info",
#[cfg(feature = "bundled-mcp")]
Some(Command::Mcp { .. }) => "mcp",
Some(Command::Acp { .. }) => "acp",
#[cfg(feature = "roaming")]
Some(Command::Roam { .. }) => "roam",
#[cfg(feature = "acp-http")]
Some(Command::Serve { .. }) => "serve",
Some(Command::Session { .. }) => "session",
Some(Command::Run { .. }) => "run",
Some(Command::Gateway { .. }) => "gateway",
#[cfg(feature = "scheduler")]
Some(Command::Schedule { .. }) => "schedule",
#[cfg(feature = "update")]
Some(Command::Update { .. }) => "update",
@@ -1611,6 +1625,7 @@ async fn handle_mcp_probe(extension_command: String, script_path: Option<String>
Ok(())
}
#[cfg(feature = "bundled-mcp")]
async fn handle_mcp_command(server: McpCommand) -> Result<()> {
let name = server.name();
let _ = crate::logging::setup_logging(Some(&format!("mcp-{name}")));
@@ -1623,6 +1638,7 @@ async fn handle_mcp_command(server: McpCommand) -> Result<()> {
Ok(())
}
#[cfg(feature = "acp-http")]
struct ServeCommandArgs {
host: String,
@@ -1758,6 +1774,7 @@ async fn start_roam_share(
Ok(node)
}
#[cfg(feature = "acp-http")]
async fn handle_serve_command(args: ServeCommandArgs) -> Result<()> {
use axum::http::HeaderValue;
use goose::acp::server::AcpBuiltinSelection;
@@ -2355,6 +2372,7 @@ async fn handle_gateway_command(command: GatewayCommand) -> Result<()> {
}
}
#[cfg(feature = "scheduler")]
async fn handle_schedule_command(command: SchedulerCommand) -> Result<()> {
match command {
SchedulerCommand::Add {
@@ -2779,6 +2797,7 @@ async fn handle_default_session() -> Result<()> {
}
pub async fn cli() -> anyhow::Result<()> {
#[cfg(feature = "bundled-mcp")]
register_builtin_extensions(goose_mcp::BUILTIN_EXTENSIONS.clone());
let cli = Cli::parse();
@@ -2799,6 +2818,7 @@ pub async fn cli() -> anyhow::Result<()> {
Some(Command::Configure {}) => handle_configure().await,
Some(Command::Doctor {}) => crate::commands::doctor::handle_doctor().await,
Some(Command::Info { verbose, check }) => handle_info(verbose, check).await,
#[cfg(feature = "bundled-mcp")]
Some(Command::Mcp { server }) => handle_mcp_command(server).await,
Some(Command::Acp {
builtins,
@@ -2806,6 +2826,7 @@ pub async fn cli() -> anyhow::Result<()> {
}) => goose::acp::server::run(builtins, enable_scheduler).await,
#[cfg(feature = "roaming")]
Some(Command::Roam { command }) => handle_roam_command(command).await,
#[cfg(feature = "acp-http")]
Some(Command::Serve {
host,
port,
@@ -2885,6 +2906,7 @@ pub async fn cli() -> anyhow::Result<()> {
.await
}
Some(Command::Gateway { command }) => handle_gateway_command(command).await,
#[cfg(feature = "scheduler")]
Some(Command::Schedule { command }) => handle_schedule_command(command).await,
#[cfg(feature = "update")]
Some(Command::Update {
@@ -3097,6 +3119,7 @@ mod tests {
}
}
#[cfg(feature = "acp-http")]
#[test]
fn serve_command_accepts_dangerously_unauthenticated_flag() {
let cli = Cli::try_parse_from([
+1
View File
@@ -13,6 +13,7 @@ pub mod roam_client;
pub mod roam_full_bridge;
#[cfg(feature = "roaming")]
pub mod roam_proxy;
#[cfg(feature = "scheduler")]
pub mod schedule;
pub mod session;
pub mod skills;