Skip to content

Commit dd1c2af

Browse files
loganjLarryLarryLarry
authored
Discover alternate Buzz ACP commands (#6948)
🤖 I’m Larry. ## Summary Managed-agent definitions can now choose which installed ACP transport will launch the agent. The choice sits beside **Agent harness** while creating or editing an agent, so it is made before first deployment and remains visible afterward. Buzz discovers executable commands named `buzz-*-acp`, keeps **Buzz ACP (default)** as the safe default, and preserves existing custom command values. Discovery and launch share the same resolver, so a command offered in the picker is the command Buzz will execute. ## UX walkthrough ### 1. The ACP command picker appears while creating the agent The default is explicit, and the helper text explains that this selection controls deployment. ![Create-agent form with the ACP command picker beside Agent harness](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6948/01-persona-create-acp-selector.png) ### 2. Installed wrapper commands are offered by name Here Buzz has discovered `buzz-janet-acp` alongside the stock transport. ![ACP command menu offering Buzz ACP and buzz-janet-acp](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6948/02-discovered-wrapper-dropdown.png) ### 3. The wrapper is selected before deployment ![Create-agent form with buzz-janet-acp selected](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6948/03-wrapper-selected-before-deploy.png) ### 4. The deployed profile reports the effective command ![Deployed agent Runtime profile showing buzz-janet-acp](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6948/04-deployed-profile-effective-acp.png) ### 5. Editing the deployed agent reopens its definition with the choice preserved ![Edit-agent form retaining buzz-janet-acp](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6948/05-edit-shows-persisted-wrapper.png) ## Details - Definitions carry the selected ACP command through relay publication, snapshots, imports, team adoption, deployment, and later edits. - Existing definitions without this field continue to use `buzz-acp`. - Unknown persisted commands remain visible but unavailable rather than being silently replaced. - Discovery is read-only and never executes candidates. It filters non-files and non-executables, supports Windows `.exe`, `.cmd`, and `.bat` shims, deduplicates aliases, and returns a stable sorted list. - Command names remain portable; Buzz does not persist machine-specific absolute paths. --------- Signed-off-by: Logan Johnson <[email protected]> Signed-off-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz> Signed-off-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@nostr> Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz> Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
1 parent 611faf7 commit dd1c2af

81 files changed

Lines changed: 1184 additions & 125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎desktop/src-tauri/src/commands/agent_config_tests.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ fn persona_with_model(model: &str) -> AgentDefinition {
138138
display_name: "Persona".to_string(),
139139
avatar_url: None,
140140
system_prompt: "You are a persona.".to_string(),
141+
acp_command: None,
141142
runtime: None,
142143
model: Some(model.to_string()),
143144
provider: None,

‎desktop/src-tauri/src/commands/agent_models_tests.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use super::*;
2-
32
#[test]
43
fn access_policy_change_requires_runtime_refresh_for_effective_gate_changes() {
54
use crate::managed_agents::RespondTo;

‎desktop/src-tauri/src/commands/agent_providers.rs‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
use crate::managed_agents::{discover_provider_candidates, invoke_provider, BackendProviderInfo};
1+
use crate::managed_agents::{
2+
discover_acp_command_candidates, discover_provider_candidates, invoke_provider,
3+
AcpCommandCandidate, BackendProviderInfo,
4+
};
5+
6+
#[tauri::command]
7+
pub async fn discover_acp_commands() -> Result<Vec<AcpCommandCandidate>, String> {
8+
tokio::task::spawn_blocking(|| {
9+
discover_acp_command_candidates()
10+
.into_iter()
11+
.map(|(command, path)| AcpCommandCandidate {
12+
command,
13+
binary_path: path.display().to_string(),
14+
})
15+
.collect()
16+
})
17+
.await
18+
.map_err(|e| format!("spawn_blocking failed: {e}"))
19+
}
220

321
#[tauri::command]
422
pub async fn discover_backend_providers() -> Result<Vec<BackendProviderInfo>, String> {

‎desktop/src-tauri/src/commands/agents.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
use super::managed_agent_definition::validate_create_definition;
12
use nostr::{Keys, ToBech32};
23
use tauri::{AppHandle, State};
34

4-
use super::managed_agent_definition::validate_create_definition;
5-
65
use crate::{
76
app_state::AppState,
87
managed_agents::{
@@ -609,9 +608,10 @@ pub async fn create_managed_agent(
609608
auth_tag: auth_tag.clone(),
610609
relay_url: resolved_relay_url.clone(),
611610
avatar_url: resolved_avatar_url.clone(),
612-
acp_command: input
613-
.acp_command
614-
.as_deref()
611+
acp_command: linked_persona
612+
.as_ref()
613+
.and_then(|persona| persona.acp_command.as_deref())
614+
.or(input.acp_command.as_deref())
615615
.map(str::trim)
616616
.filter(|value| !value.is_empty())
617617
.unwrap_or(DEFAULT_ACP_COMMAND)

‎desktop/src-tauri/src/commands/agents_tests.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ fn persona_record(id: &str, model: Option<&str>, provider: Option<&str>) -> Agen
7878
display_name: "Test Persona".to_string(),
7979
avatar_url: None,
8080
system_prompt: "".to_string(),
81+
acp_command: None,
8182
runtime: None,
8283
model: model.map(str::to_string),
8384
provider: provider.map(str::to_string),

‎desktop/src-tauri/src/commands/media_download.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ mod tests {
610610
version: FORMAT_VERSION,
611611
definition: AgentSnapshotDefinition {
612612
session_policy: Default::default(),
613+
acp_command: None,
613614
name: "test".to_string(),
614615
source_is_builtin: false,
615616
system_prompt: None,
@@ -661,6 +662,7 @@ mod tests {
661662
version: FORMAT_VERSION,
662663
definition: AgentSnapshotDefinition {
663664
session_policy: Default::default(),
665+
acp_command: None,
664666
name: "test".to_string(),
665667
source_is_builtin: false,
666668
system_prompt: None,
@@ -708,6 +710,7 @@ mod tests {
708710
version: FORMAT_VERSION,
709711
definition: AgentSnapshotDefinition {
710712
session_policy: Default::default(),
713+
acp_command: None,
711714
name: "test".to_string(),
712715
source_is_builtin: false,
713716
system_prompt: None,

‎desktop/src-tauri/src/commands/media_snapshot_png.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ mod tests {
158158
version: 1,
159159
definition: AgentSnapshotDefinition {
160160
session_policy: Default::default(),
161+
acp_command: None,
161162
name: "Tree Trunks".to_string(),
162163
source_is_builtin: false,
163164
system_prompt: Some("You are a helpful agent.".to_string()),

‎desktop/src-tauri/src/commands/personas/create.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub async fn create_persona(
3131
validate_agent_definition_text(&display_name, &system_prompt)?;
3232
let description = normalize_description(input.description)?;
3333
let avatar_url = trim_optional(input.avatar_url);
34+
let acp_command = trim_optional(input.acp_command);
3435
let runtime = trim_optional(input.runtime);
3536
let model = trim_optional(input.model);
3637
let provider = trim_optional(input.provider);
@@ -61,6 +62,7 @@ pub async fn create_persona(
6162
avatar_url,
6263
description,
6364
system_prompt,
65+
acp_command,
6466
runtime,
6567
model,
6668
provider,

‎desktop/src-tauri/src/commands/personas/inbound.rs‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,11 @@ fn event_d_tag(event: &nostr::Event) -> Result<String, String> {
674674
/// in place, or push it when none matches.
675675
///
676676
/// The match key is `persona_d_tag` — the same derivation the outbound path
677-
/// uses — so the inbound and outbound keys can never drift. On match, only the
678-
/// projected fields are overwritten; local `id`, `env_vars`, `source_team`, and
679-
/// `created_at` survive. On no match, the parsed record is inserted as-is; since
677+
/// uses — so the inbound and outbound keys can never drift. On match, every
678+
/// field projected by `PersonaEventContent` is overwritten (except a redacted
679+
/// shared transport preserves a nonportable local override), while local `id`,
680+
/// `env_vars`, `source_team`, and `created_at` survive. On no match, the parsed
681+
/// record is inserted as-is; since
680682
/// `persona_from_event` sets `id = d_tag`, an in-app persona reuses its d-tag as
681683
/// the id and a re-received event stays idempotent (no duplicate row).
682684
fn apply_inbound_persona(personas: &mut Vec<AgentDefinition>, inbound: AgentDefinition) {
@@ -690,6 +692,17 @@ fn apply_inbound_persona(personas: &mut Vec<AgentDefinition>, inbound: AgentDefi
690692
local.avatar_url = inbound.avatar_url;
691693
local.description = inbound.description;
692694
local.system_prompt = inbound.system_prompt;
695+
// Shared absence can be a redacted machine-local transport. Keep
696+
// only that local override; portable/legacy absence still resets.
697+
// Shared writers emit explicit buzz-acp for an intentional reset.
698+
let redacted_local_command = inbound.shared
699+
&& inbound.acp_command.is_none()
700+
&& local.acp_command.as_deref().is_some_and(|command| {
701+
!crate::managed_agents::is_portable_acp_command(command)
702+
});
703+
if !redacted_local_command {
704+
local.acp_command = inbound.acp_command;
705+
}
693706
local.runtime = inbound.runtime;
694707
local.model = inbound.model;
695708
local.provider = inbound.provider;

‎desktop/src-tauri/src/commands/personas/inbound/catalog_reconcile_tests.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fn member(id: &str, display_name: &str) -> AgentDefinition {
3232
description: None,
3333
avatar_url: None,
3434
system_prompt: "Do the work.".to_string(),
35+
acp_command: None,
3536
runtime: None,
3637
model: None,
3738
provider: None,

0 commit comments

Comments
 (0)