Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(host): list each agent once when the ACP registry also has it

leepokaieaa9c4232af2
diff --git a/apps/desktop/e2e/agent-picker.spec.ts b/apps/desktop/e2e/agent-picker.spec.ts
new file mode 100644
index 00000000..bf0f4b71
--- /dev/null
+++ b/apps/desktop/e2e/agent-picker.spec.ts
@@ -0,0 +1,37 @@
+import { test, expect } from '@playwright/test'
+import { api, attach, steerBot } from './sandbox.ts'
+
+type Hello = { backends: { id: string; name: string }[] }
+
+test('going from agents back to models leaves no agent rows behind', async () => {
+ const { browser, page } = await attach()
+ const name = `Agent picker e2e ${Date.now()}`
+ let botId: string | undefined
+ try {
+ // Clients key their agent lists by id, so the host lists each agent once.
+ const { backends } = await api<Hello>(page, 'hello', {})
+ const ids = backends.map((b) => b.id)
+ expect(new Set(ids).size, ids.join(', ')).toBe(ids.length)
+ expect(backends.filter((b) => b.name === 'Kiro CLI')).toHaveLength(1)
+
+ botId = (await steerBot(page, name, 1)).id
+ await page.locator('.roster-row', { hasText: name }).click()
+ await page.getByRole('button', { name: `${name}, view details` }).click()
+ const picker = page.locator('.details-panel .agent-picker')
+ await picker.locator('.agent-picker-summary').click()
+ const items = picker.locator('.agent-picker-item')
+ const search = picker.getByRole('textbox', { name: /^Search (agents|models)$/ })
+ await expect(search).toHaveAttribute('aria-label', 'Search models')
+
+ for (const agent of ['Kiro CLI (not installed)', 'Custom command', 'Kiro CLI (not installed)']) {
+ await picker.locator('.agent-picker-choice').first().click()
+ await expect(search).toHaveAttribute('aria-label', 'Search agents')
+ await items.filter({ hasText: agent }).first().click()
+ await expect(search).toHaveAttribute('aria-label', 'Search models')
+ await expect(items.filter({ hasText: /\(not installed\)|^Custom command$/ })).toHaveCount(0)
+ }
+ } finally {
+ if (botId) await api(page, 'deleteBot', { botId }).catch(() => {})
+ await browser.close()
+ }
+})
diff --git a/host/src/agent/backends.rs b/host/src/agent/backends.rs
index 72235275..511db8d2 100644
--- a/host/src/agent/backends.rs
+++ b/host/src/agent/backends.rs
@@ -11,7 +11,6 @@
use crate::agent::{acp, node, registry};
use crate::shell;
use serde_json::{Value, json};
-use std::collections::HashSet;
use std::path::Path;
mod catalog;
@@ -46,6 +45,13 @@ pub struct Harness {
pub signed_in: Option<SignInCheck>,
}
+impl Harness {
+ /// A backend id is this harness's: its own id or its registry entry's.
+ fn answers_to(&self, id: &str) -> bool {
+ self.id == id || self.registry == Some(id)
+ }
+}
+
#[derive(Clone, Copy)]
pub enum Install {
/// A vendor install script (`curl … | bash`), Unix only.
@@ -107,10 +113,9 @@ pub fn list() -> Vec<Value> {
})
.collect();
// Registry agents we don't know by name: runnable, but you sign in yourself.
- let known: HashSet<&str> = HARNESSES.iter().filter_map(|h| h.registry).collect();
for a in &registry {
let id = a["id"].as_str().unwrap_or_default();
- if id.is_empty() || known.contains(id) || id == "github-copilot" {
+ if id.is_empty() || HARNESSES.iter().any(|h| h.answers_to(id)) || id == "github-copilot" {
continue;
}
out.push(json!({
@@ -139,7 +144,7 @@ pub fn belongs_to_other(backend: &str, program: &str) -> bool {
return backend != "workbuddy";
}
let name = Path::new(program).file_name().and_then(|n| n.to_str()).unwrap_or(program);
- let own = |h: &Harness| h.id == backend || h.registry == Some(backend);
+ let own = |h: &Harness| h.answers_to(backend);
HARNESSES.iter().any(|h| !own(h) && h.bins.contains(&name))
&& !HARNESSES.iter().any(|h| own(h) && h.bins.contains(&name))
}
diff --git a/host/src/agent/backends/tests.rs b/host/src/agent/backends/tests.rs
index db9bffd7..f819e719 100644
--- a/host/src/agent/backends/tests.rs
+++ b/host/src/agent/backends/tests.rs
@@ -1,5 +1,6 @@
use super::search_path::TestSearchPath;
use super::*;
+use std::collections::HashSet;
use std::path::PathBuf;
struct TempDir(PathBuf);
@@ -51,6 +52,20 @@ fn an_installed_cli_comes_before_the_registry_build() {
}
}
+#[test]
+fn a_harness_the_registry_also_lists_shows_once() {
+ let dir = TempDir::new();
+ let _path = TestSearchPath::set(dir.0.clone());
+ let agents: Vec<_> =
+ HARNESSES.iter().map(|h| h.id).chain(["unknown-agent"]).map(|id| json!({"id": id, "name": id})).collect();
+ registry::set_cache(Some(json!({"agents": agents})));
+ let listed = list();
+ registry::set_cache(None);
+ let ids: Vec<_> = listed.iter().filter_map(|b| b["id"].as_str()).collect();
+ assert_eq!(ids.iter().collect::<HashSet<_>>().len(), ids.len(), "clients key their lists by id: {ids:?}");
+ assert!(ids.contains(&"unknown-agent"), "a registry agent we don't know by name is still offered");
+}
+
#[test]
fn every_harness_is_unique() {
let ids: HashSet<_> = HARNESSES.iter().map(|h| h.id).collect();