feat: bundle a slim goose agent (goose-acp) as a desktop sidecar

Adds goose-acp/, a workspace-excluded crate that builds goose's ACP
stdio server from the goose library crate with default-features off
(rustls-tls only): no code-mode/V8, no local-inference/llama.cpp, no
keyring/AWS/telemetry, no goose CLI. Full agent loop, providers,
sessions, and MCP extensions intact. ~32 MB on macOS arm64 (~9 MB
added to the compressed download) vs ~240 MB for a stock goose
install; drops to ~14 MB once goose's analyze/tiktoken feature gates
land upstream and the rev pin is bumped.

Workspace exclusion is deliberate: goose's ~700-crate graph stays out
of the workspace lockfile, and rmcp stays pinned at 1.7.0 (goose does
not compile against 1.8) in goose-acp's own Cargo.lock.

Wiring:
- buzz-acp: goose-acp identity takes no 'acp' subcommand (it is
  already the ACP server), with tests
- desktop: goose runtime discovery also accepts goose-acp, so the
  bundled sidecar is found when no user-installed goose exists;
  orphan sweep already matches it via the goose- prefix rule
- packaging: tauri externalBin entry, sidecar stubs (justfile + CI),
  bundle-sidecars.sh stages it when built, release workflow builds it
  for all targets
This commit is contained in:
Michael Neale
2026-07-05 20:09:11 +10:00
parent 6abf614fd4
commit 0f92884043
13 changed files with 6427 additions and 7 deletions

View File

@@ -827,7 +827,7 @@ jobs:
shell: bash
run: |
mkdir -p desktop/src-tauri/binaries
for bin in buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz; do
for bin in buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz goose-acp; do
touch "desktop/src-tauri/binaries/${bin}-${TARGET}.exe"
done
- name: Clippy (workspace)
@@ -904,6 +904,7 @@ jobs:
touch "desktop/src-tauri/binaries/buzz-dev-mcp-$TARGET"
touch "desktop/src-tauri/binaries/git-credential-nostr-$TARGET"
touch "desktop/src-tauri/binaries/buzz-$TARGET"
touch "desktop/src-tauri/binaries/goose-acp-$TARGET"
# Mesh rev is derived from Cargo.lock so a dependency bump needs no
# lockstep edit here; the cache key tracks it automatically.
- name: Resolve mesh-llm rev

View File

@@ -130,6 +130,7 @@ jobs:
- name: Build sidecars
run: |
cargo build --release -p buzz-acp -p buzz-agent -p buzz-dev-mcp -p git-credential-nostr -p buzz-cli
cargo build --release --manifest-path goose-acp/Cargo.toml
./scripts/bundle-sidecars.sh
# Mesh rev derived from Cargo.lock (no lockstep edit on dep bump); cache key tracks it.
@@ -334,6 +335,7 @@ jobs:
- name: Build sidecars
run: |
cargo build --release --target "$TARGET" -p buzz-acp -p buzz-agent -p buzz-dev-mcp -p git-credential-nostr -p buzz-cli
cargo build --release --target "$TARGET" --manifest-path goose-acp/Cargo.toml
./scripts/bundle-sidecars.sh "$TARGET"
- name: Build unsigned Tauri app
@@ -504,6 +506,7 @@ jobs:
- name: Build sidecars
run: |
cargo build --release -p buzz-acp -p buzz-agent -p buzz-dev-mcp -p git-credential-nostr -p buzz-cli
cargo build --release --manifest-path goose-acp/Cargo.toml
./scripts/bundle-sidecars.sh
- name: Generate release config
@@ -645,6 +648,7 @@ jobs:
shell: bash
run: |
cargo build --release --target "$TARGET" -p buzz-acp -p buzz-agent -p buzz-dev-mcp -p git-credential-nostr -p buzz-cli
cargo build --release --target "$TARGET" --manifest-path goose-acp/Cargo.toml
./scripts/bundle-sidecars.sh "$TARGET"
- name: Build Windows NSIS installer (unsigned)

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
# Build artifacts
/target/
/dist/
/goose-acp/target/
# lefthook-generated hook scripts (machine-specific)
.hooks/

View File

@@ -26,7 +26,9 @@ members = [
"crates/buzz-dev-mcp",
"examples/countdown-bot",
]
exclude = ["desktop/src-tauri"]
# goose-acp is excluded so goose's dependency graph (and its rmcp 1.7 pin)
# stays out of the workspace lockfile — see goose-acp/Cargo.toml.
exclude = ["desktop/src-tauri", "goose-acp"]
resolver = "2"
[workspace.package]

View File

@@ -139,7 +139,7 @@ _ensure-sidecar-stubs:
set -euo pipefail
TARGET=$(rustc -vV | sed -n 's|host: ||p')
mkdir -p desktop/src-tauri/binaries
for bin in buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz; do
for bin in buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz goose-acp; do
touch "desktop/src-tauri/binaries/${bin}-${TARGET}"
done
@@ -199,6 +199,7 @@ desktop-release-build target="aarch64-apple-darwin":
touch "desktop/src-tauri/binaries/buzz-dev-mcp-$TARGET"
touch "desktop/src-tauri/binaries/git-credential-nostr-$TARGET"
touch "desktop/src-tauri/binaries/buzz-$TARGET"
touch "desktop/src-tauri/binaries/goose-acp-$TARGET"
pnpm install
cd {{desktop_dir}} && pnpm tauri build --features mesh-llm --target {{target}}

View File

@@ -561,8 +561,10 @@ pub(crate) fn normalize_agent_command_identity(command: &str) -> String {
fn default_agent_args(command: &str) -> Option<Vec<String>> {
match normalize_agent_command_identity(command).as_str() {
"goose" => Some(vec!["acp".to_string()]),
"codex" | "codex-acp" | "claude-agent-acp" | "claude-code-acp" | "claude-code"
| "claudecode" | "buzz-agent" => Some(Vec::new()),
// The bundled slim goose (goose-acp/) is already the ACP stdio
// server — no subcommand needed.
"goose-acp" | "codex" | "codex-acp" | "claude-agent-acp" | "claude-code-acp"
| "claude-code" | "claudecode" | "buzz-agent" => Some(Vec::new()),
_ => None,
}
}
@@ -1420,6 +1422,24 @@ mod tests {
assert_eq!(normalize_agent_args("goose", vec!["".into()]), vec!["acp"]);
}
#[test]
fn bundled_goose_acp_takes_no_subcommand() {
// The bundled slim goose (goose-acp/) is already the ACP stdio
// server; passing `acp` would be an unknown-argument error.
assert_eq!(
normalize_agent_args("goose-acp", Vec::new()),
Vec::<String>::new()
);
assert_eq!(
normalize_agent_args("goose-acp", vec!["acp".into()]),
Vec::<String>::new()
);
assert_eq!(
normalize_agent_args("/path/to/goose-acp", vec!["".into()]),
Vec::<String>::new()
);
}
#[test]
fn normalizes_codex_and_claude_args_to_empty() {
assert_eq!(

View File

@@ -90,7 +90,7 @@ const KNOWN_ACP_RUNTIMES: &[KnownAcpRuntime] = &[
KnownAcpRuntime {
id: "goose",
label: "Goose",
commands: &["goose"],
commands: &["goose", "goose-acp"], // goose-acp = bundled slim sidecar; installed goose wins
aliases: &[],
avatar_url: GOOSE_AVATAR_URL,
mcp_command: None,

View File

@@ -55,7 +55,8 @@
"binaries/buzz-agent",
"binaries/buzz-dev-mcp",
"binaries/git-credential-nostr",
"binaries/buzz"
"binaries/buzz",
"binaries/goose-acp"
],
"icon": [
"icons/32x32.png",

6263
goose-acp/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

37
goose-acp/Cargo.toml Normal file
View File

@@ -0,0 +1,37 @@
# goose-acp — a slim goose agent served over ACP on stdio, for bundling
# alongside the Buzz distribution.
#
# This crate is deliberately EXCLUDED from the Buzz workspace (see the root
# Cargo.toml `exclude` list): it has its own Cargo.lock so goose's ~700-crate
# dependency graph never touches the workspace lockfile, and so rmcp can be
# pinned independently (goose requires rmcp 1.7.x; 1.8 breaks its build —
# if you regenerate the lockfile, run `cargo update rmcp --precise 1.7.0`).
#
# Build: cargo build --release --manifest-path goose-acp/Cargo.toml
# Result: a ~32 MB `goose-acp` binary (macOS arm64) that buzz-acp spawns via
# BUZZ_ACP_AGENT_COMMAND. Feature-slimmed: no code-mode/V8, no
# local-inference/llama.cpp, no keyring/AWS/telemetry — agent loop,
# providers, sessions, and MCP extensions intact.
#
# The pinned rev is goose main HEAD as of 2026-07-05. When goose lands the
# analyze/tiktoken feature gates (micn/slim-features), bump the rev and add
# nothing — the binary drops to ~14 MB automatically via default-features=false.
[package]
name = "goose-acp"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
goose = { git = "https://github.com/aaif-goose/goose", rev = "c26dbb26b", default-features = false, features = ["rustls-tls"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
anyhow = "1"
# Size-optimized: measured 32 MB vs 41 MB with the stock release profile.
[profile.release]
opt-level = "z"
lto = "fat"
codegen-units = 1
panic = "abort"
strip = true

56
goose-acp/README.md Normal file
View File

@@ -0,0 +1,56 @@
# goose-acp — bundled slim goose agent
A minimal binary exposing [goose](https://github.com/aaif-goose/goose) as an
ACP agent server on stdio, so the Buzz distribution can bundle a capable
goose agent without users installing goose themselves.
## What's in / what's out
Built from the `goose` library crate with `default-features = false`,
`features = ["rustls-tls"]`:
| Included | Excluded |
|---|---|
| Full agent loop, sessions, compaction | code-mode (pctx → V8 JS/TS runtime) |
| All API providers (Anthropic, OpenAI, …) | local-inference (llama.cpp/candle) |
| MCP extensions, developer builtin | system keyring, AWS providers |
| ACP stdio server | telemetry/otel, goose CLI/TUI |
Result: ~32 MB on macOS arm64 (vs ~240 MB for a full goose install), adding
~9 MB to the compressed desktop download. When goose's `analyze`/`tiktoken`
feature gates land upstream (branch `micn/slim-features`), bumping the pinned
rev drops this to ~14 MB raw / ~5 MB compressed with no changes here.
## Why a separate workspace
This crate is excluded from the Buzz workspace on purpose:
- goose's ~700-crate dependency graph stays out of the workspace Cargo.lock
- goose requires **rmcp 1.7.x** (1.8 breaks its build). The pin lives in this
crate's own lockfile. If you ever regenerate it:
`cargo update rmcp --precise 1.7.0`
## Building
```bash
cargo build --release --manifest-path goose-acp/Cargo.toml
# → goose-acp/target/release/goose-acp
```
`scripts/bundle-sidecars.sh` stages it as a Tauri sidecar
(`binaries/goose-acp-<triple>`) when present. Release CI builds it
explicitly; local dev flows that skip it still work (the desktop app treats
a missing/stub binary as "not installed" and falls back to `goose` on PATH
or `buzz-agent`).
## Using it
The binary **is** the ACP server — no `acp` subcommand (buzz-acp knows this;
see `default_agent_args` in `crates/buzz-acp/src/config.rs`):
```bash
BUZZ_ACP_AGENT_COMMAND=/path/to/goose-acp buzz-acp ...
```
Provider/model configuration is standard goose: `GOOSE_PROVIDER`,
`GOOSE_MODEL`, provider API-key env vars, or `~/.config/goose/config.yaml`.

14
goose-acp/src/main.rs Normal file
View File

@@ -0,0 +1,14 @@
//! Slim goose agent as an ACP stdio server.
//!
//! Buzz talks to agents over ACP (see `buzz-acp`); this binary lets the Buzz
//! distribution bundle a capable goose agent without requiring users to
//! install goose. It is the entire integration: goose's public ACP server on
//! stdin/stdout, with no builtin-extension overrides (goose registers its
//! defaults, e.g. developer, itself).
fn main() -> anyhow::Result<()> {
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()?
.block_on(goose::acp::server::run(Vec::new()))
}

View File

@@ -2,6 +2,9 @@
set -euo pipefail
SIDECARS=(buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz)
# goose-acp lives outside the workspace (own lockfile — see goose-acp/Cargo.toml)
# so it builds into its own target dir and is staged separately below.
GOOSE_ACP_DIR="goose-acp"
HOST=$(rustc -vV | sed -n 's|host: ||p')
TARGET=${1:-$HOST}
BINARIES_DIR="desktop/src-tauri/binaries"
@@ -37,4 +40,21 @@ mkdir -p "$BINARIES_DIR"
for bin in "${SIDECARS[@]}"; do
cp "$SRC_DIR/${bin}${EXE}" "$BINARIES_DIR/${bin}-${TARGET}${EXE}"
done
# Bundled slim goose ACP agent (optional today: staged only when built, so
# local flows that skip it keep working; CI builds it explicitly).
if [[ -n "${1:-}" ]]; then
GOOSE_ACP_SRC="$GOOSE_ACP_DIR/target/${TARGET}/release/goose-acp${EXE}"
else
GOOSE_ACP_SRC="$GOOSE_ACP_DIR/target/release/goose-acp${EXE}"
fi
if [[ -f "$GOOSE_ACP_SRC" ]]; then
cp "$GOOSE_ACP_SRC" "$BINARIES_DIR/goose-acp-${TARGET}${EXE}"
# cp onto an existing stub (touched by _ensure-sidecar-stubs) keeps the
# stub's non-executable mode — restore it explicitly.
chmod +x "$BINARIES_DIR/goose-acp-${TARGET}${EXE}"
echo "Bundled goose-acp"
else
echo "Note: goose-acp not built ($GOOSE_ACP_SRC missing); skipping." >&2
fi
echo "Sidecars bundled for $TARGET"