@splitfireai / agent / commits / c98bdcf

Add a library target so hosts can embed the agent

src/lib.rs exposes the SplitFire profile (SplitFire, INFO, DEMUCS) and re-exports ed_acp, so an app can serve the agent in-process with ed_acp::serve instead of launching the binary. KaroKowe Jam does this to stay inside the App Store sandbox. The terminal UI and the MCP test stub move behind a default `cli` feature, and both binaries require it. A host builds with default-features = false and doesn't pull in ratatui and crossterm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Seto committed Oct 9, 2026 at 15:11 UTC c98bdcff7d69d629c7b0e268c098e8f3bb9a48bb
3 files changed +34 -9
Cargo.toml
+18 -2
@@ -6,11 +6,27 @@ license = "Apache-2.0"
6 description = "Music-domain ACP agent: theory, production, industry, culture and live shows, backed by any OpenAI-compatible chat completions API"
7 repository = "https://github.com/splitfireai/splitfire-agent"
8
9 +[features]
10 +default = ["cli"]
11 +# The `splitfire-agent` binary: its terminal UI, plus the MCP stub the integration tests run.
12 +# A host embedding the library turns this off.
13 +cli = ["dep:ed-acp-tui", "ed-mcp/test-server"]
14 +
15 +[[bin]]
16 +name = "splitfire-agent"
17 +path = "src/main.rs"
18 +required-features = ["cli"]
19 +
20 +[[bin]]
21 +name = "mcp_stdio_stub"
22 +path = "src/bin/mcp_stdio_stub.rs"
23 +required-features = ["cli"]
24 +
25 [dependencies]
26 # Onde Agent Platform: the ACP server, terminal UI and MCP layer, from the onde-ed workspace.
27 ed-acp = { version = "1.1.0" }
12 -ed-acp-tui = { version = "1.1.0" }
13 -ed-mcp = { version = "1.1.0", features = ["test-server"] }
28 +ed-acp-tui = { version = "1.1.0", optional = true }
29 +ed-mcp = { version = "1.1.0" }
30 agent-client-protocol = "2.2"
31 anyhow = "1.0.104"
32 async-trait = "0.1"
src/lib.rs new
+15
@@ -0,0 +1,15 @@
1 +//! SplitFire as a library: the music agent's [`Profile`](ed_acp::Profile), for hosts that
2 +//! embed it instead of launching the `splitfire-agent` binary.
3 +//!
4 +//! A host serves [`SplitFire`] with `ed_acp::serve` over an in-memory channel and runs an ACP
5 +//! client on the other end, which keeps the agent inside an app sandbox that can't spawn it as
6 +//! a subprocess. Build with `default-features = false` to leave out the terminal UI.
7 +
8 +mod audio;
9 +pub mod profile;
10 +mod prompt;
11 +mod theory;
12 +mod tools;
13 +
14 +pub use ed_acp;
15 +pub use profile::{DEMUCS, INFO, SplitFire};
src/main.rs
+1 -7
@@ -7,12 +7,6 @@
7 //! it speaks ACP over stdio. Set ONDE_API_KEY (`app-id:app-secret`) or run `--setup`.
8 //! SPLITFIRE_YOLO=1 skips permission prompts. Logs go to stderr (RUST_LOG).
9
10 -mod audio;
11 -mod profile;
12 -mod prompt;
13 -mod theory;
14 -mod tools;
15 -
10 use std::io::IsTerminal;
11 use std::path::PathBuf;
12 use std::sync::Arc;
@@ -20,7 +14,7 @@ use std::sync::Arc;
14 use ed_acp::{LlmConfig, ServeOptions, cli};
15 use ed_acp_tui::TuiConfig;
16
23 -use profile::{INFO, SplitFire};
17 +use splitfire_agent::{INFO, SplitFire};
18
19 const USAGE: &str = "\
20 Usage: splitfire-agent [--acp] [--yolo] [--list-models] [--root <path>...] [--setup] [--version]