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.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat(tui): per-bot network and cloud assistant switches in bot settings
leepokai00fc1a3068d4
diff --git a/host/src/tui/app/bot.rs b/host/src/tui/app/bot.rsindex d47d3d84..65c173c2 100644--- a/host/src/tui/app/bot.rs+++ b/host/src/tui/app/bot.rs@@ -48,6 +48,9 @@ pub struct Bot {pub computer: bool,/// It creates bots and changes any bot's setup (`chat::manage`); `None` from a host without it.pub manage_team: Option<bool>,+ /// `None`: the host has no per-bot network switches.+ pub offered_to_network: Option<bool>,+ pub reachable_by_assistants: Option<bool>,/// The bot that created this one; `None` when the user did.pub created_by: Option<String>,pub created_at: i64,@@ -178,6 +181,8 @@ impl Bot {notify: v["notify"].as_bool().unwrap_or(true),computer: v["computer"].as_bool().unwrap_or(false),manage_team: v["manageTeam"].as_bool(),+ offered_to_network: v["offeredToNetwork"].as_bool(),+ reachable_by_assistants: v["reachableByAssistants"].as_bool(),created_by: v["createdBy"].as_str().map(str::to_owned),created_at: v["createdAt"].as_i64().unwrap_or(0),harness_memory: v["harnessMemory"]diff --git a/host/src/tui/app/events.rs b/host/src/tui/app/events.rsindex a4125581..5ec295bd 100644--- a/host/src/tui/app/events.rs+++ b/host/src/tui/app/events.rs@@ -56,6 +56,7 @@ impl App {match v["type"].as_str() {Some("hello") => {self.snapshot_floors();+ self.network = v["network"].clone();if !v["usage"].is_null() {self.usage = v["usage"].clone();}diff --git a/host/src/tui/app/forms.rs b/host/src/tui/app/forms.rsindex 26dc72dd..5a45388b 100644--- a/host/src/tui/app/forms.rs+++ b/host/src/tui/app/forms.rs@@ -139,6 +139,8 @@ impl App {notify: b.notify,computer: b.computer,manage_team: b.manage_team,+ offered_to_network: b.offered_to_network,+ reachable_by_assistants: b.reachable_by_assistants,color: COLORS.iter().position(|c| *c == b.color).unwrap_or(7),shape: SHAPES.iter().position(|s| *s == b.shape).unwrap_or(0),connectors: b.connectors.iter().map(|id| Toggle { id: id.clone(), name: id.clone(), on: true }).collect(),@@ -231,6 +233,8 @@ impl App {| Field::Notify| Field::Computer| Field::Team+ | Field::Network+ | Field::Assistants| Field::Color| Field::Shape| Field::ModelOptions@@ -259,6 +263,8 @@ impl App {Field::Notify => f.notify = !f.notify,Field::Computer => f.computer = !f.computer,Field::Team => f.manage_team = f.manage_team.map(|on| !on),+ Field::Network => f.offered_to_network = f.offered_to_network.map(|on| !on),+ Field::Assistants => f.reachable_by_assistants = f.reachable_by_assistants.map(|on| !on),Field::Color if !space => f.color = cycle(f.color, d, COLORS.len()),Field::Shape if !space => f.shape = cycle(f.shape, d, SHAPES.len()),Field::ModelOptions => {@@ -355,6 +361,8 @@ impl Form {"notify": self.notify,"computer": self.computer,"manageTeam": self.manage_team.unwrap_or_default(),+ "offeredToNetwork": self.offered_to_network.unwrap_or(true),+ "reachableByAssistants": self.reachable_by_assistants.unwrap_or(true),"avatarColor": COLORS[self.color],"avatarShape": SHAPES[self.shape],"connectors": self.connectors.iter().filter(|t| t.on).map(|t| t.id.clone()).collect::<Vec<_>>(),@@ -417,6 +425,27 @@ mod tests {assert_eq!(f.changes(), json!({"notify": false}), "a model changed elsewhere meanwhile stays");}+ #[tokio::test]+ async fn the_network_switches_need_a_host_that_has_them() {+ let mut app = test_app();+ let old = json!({"id": "a", "name": "Old", "backend": "claude"});+ let new = json!({"id": "b", "name": "New", "backend": "claude", "offeredToNetwork": true, "reachableByAssistants": true});+ for bot in [&old, &new] {+ app.bots.insert(bot["id"].as_str().unwrap().into(), Bot::parse(bot).expect("a bot"));+ }+ for (id, offered) in [("a", None), ("b", Some(false))] {+ app.selected = Some(id.into());+ app.edit_bot();+ let Some(Overlay::Form(mut f)) = app.overlays.pop() else { panic!("the editor opens") };+ f.field = FIELDS.iter().position(|x| *x == Field::Network).unwrap();+ let keep = app.form_key(f, KeyEvent::new(KeyCode::Right, KeyModifiers::NONE));+ let Some(Overlay::Form(f)) = keep else { panic!("the form stays") };+ assert_eq!(f.offered_to_network, offered);+ let changed = f.changes();+ assert_eq!(changed.get("offeredToNetwork").cloned(), offered.map(Value::from), "{changed}");+ }+ }+#[test]fn a_new_group_has_no_about_and_an_edited_one_keeps_it() {let mut app = test_app();diff --git a/host/src/tui/app/mod.rs b/host/src/tui/app/mod.rsindex cf360f5c..983fb3a7 100644--- a/host/src/tui/app/mod.rs+++ b/host/src/tui/app/mod.rs@@ -61,6 +61,8 @@ pub struct App {pub entries: HashMap<String, BTreeMap<i64, Entry>>,pub usage: Value,pub screen: Value,+ /// This computer's network (`networkView`'s shape); null on hosts without one.+ pub network: Value,pub backends: Vec<Value>,pub selected: Option<String>,pub focus: Focus,@@ -150,6 +152,7 @@ impl App {entries: HashMap::new(),usage: Value::Null,screen: Value::Null,+ network: Value::Null,backends: vec![],selected: None,focus: Focus::Roster,diff --git a/host/src/tui/app/ui.rs b/host/src/tui/app/ui.rsindex 3ca24c30..f087fa0b 100644--- a/host/src/tui/app/ui.rs+++ b/host/src/tui/app/ui.rs@@ -171,13 +171,15 @@ pub enum Field {Notify,Computer,Team,+ Network,+ Assistants,Color,Shape,Connectors,Skills,}-pub const FIELDS: [Field; 17] = [+pub const FIELDS: [Field; 19] = [Field::Name,Field::Instructions,Field::Agent,@@ -191,6 +193,8 @@ pub const FIELDS: [Field; 17] = [Field::Notify,Field::Computer,Field::Team,+ Field::Network,+ Field::Assistants,Field::Color,Field::Shape,Field::Connectors,@@ -222,6 +226,9 @@ pub struct Form {pub computer: bool,/// `None`: the host has no Manage the team.pub manage_team: Option<bool>,+ /// `None`: the host has no per-bot network switches.+ pub offered_to_network: Option<bool>,+ pub reachable_by_assistants: Option<bool>,pub color: usize,pub shape: usize,pub connectors: Vec<Toggle>,diff --git a/host/src/tui/manage/network.rs b/host/src/tui/manage/network.rsindex f38752dd..434ec638 100644--- a/host/src/tui/manage/network.rs+++ b/host/src/tui/manage/network.rs@@ -156,6 +156,7 @@ impl App {/// The `network` event: what the open sheet shows.pub(in crate::tui) fn network_changed(&mut self, view: &Value) {+ self.network = view.clone();for o in &mut self.overlays {if let Overlay::Network(n) = o {n.cursor = n.cursor.min(rows(view).len().saturating_sub(1));diff --git a/host/src/tui/view/forms.rs b/host/src/tui/view/forms.rsindex 136929e1..40e88997 100644--- a/host/src/tui/view/forms.rs+++ b/host/src/tui/view/forms.rs@@ -61,6 +61,8 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {Field::Notify => "Notify",Field::Computer => "Use computer",Field::Team => "Manage team",+ Field::Network => "Network",+ Field::Assistants => "Assistants",Field::Color => "Color",Field::Shape => "Shape",Field::Connectors => "Connectors",@@ -213,6 +215,20 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {};put(buf, vx, y, vw, s, t.text.patch(base));}+ Field::Network | Field::Assistants => {+ let (on, applies, off_here) = if *field == Field::Network {+ (f.offered_to_network, app.network["joined"] == true, "this computer isn't in a network")+ } else {+ (f.reachable_by_assistants, app.network["assistants"] == true, "cloud assistants are off here")+ };+ let s = match on {+ Some(true) => "◉ On ○ Off",+ Some(false) => "○ On ◉ Off",+ None => "Needs a newer Codync host",+ };+ let s = if on.is_some() && !applies { format!("{s} · {}", tr(off_here)) } else { s.into() };+ put(buf, vx, y, vw, &s, t.text.patch(base));+ }Field::Notify => {let s = if f.notify { "◉ Done and needs-you ○ Off" } else { "○ Done and needs-you ◉ Off" };put(buf, vx, y, vw, s, t.text.patch(base));@@ -283,6 +299,13 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {let line ="Let this bot create bots and change any bot's setup, its own included. The bots it creates can too.";put(buf, inner.x, by - 1, inner.width, line, t.dim.patch(t.panel));+ } else if f.current() == Field::Network {+ let line = tr("Offered to the network: bots on your other computers can see and message this bot.");+ put(buf, inner.x, by - 1, inner.width, &line, t.dim.patch(t.panel));+ } else if f.current() == Field::Assistants {+ let line =+ tr("Reachable by cloud assistants: ChatGPT or Claude in your Codync account can see and message this bot.");+ put(buf, inner.x, by - 1, inner.width, &line, t.dim.patch(t.panel));}let save = if f.saving { " … Saving " } else { " ↵ Save " };let x = put(buf, inner.x, by, 14, save, t.btn_primary) + 1;@@ -302,7 +325,9 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {| Field::Approvals| Field::Notify| Field::Computer- | Field::Team => "←→ change · tab next field",+ | Field::Team+ | Field::Network+ | Field::Assistants => "←→ change · tab next field",Field::Instructions => "⇧↵ new line · tab next field",Field::Name => "tab next field · ^s save",};