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.

Start a group chat by adding several bots to the To: field; groups have no size limit

leepokai212426c3bad3
diff --git a/apps/linux/src/dialogs.rs b/apps/linux/src/dialogs.rs
index f9115126..5c77612b 100644
--- a/apps/linux/src/dialogs.rs
+++ b/apps/linux/src/dialogs.rs
@@ -376,8 +376,6 @@ pub fn editor(ui: &App, bot: Option<Value>) {
// MARK: group editor
-const MAX_MEMBERS: usize = 6;
-
/// Create a group chat, or rename one and change who's in it (up to six bots).
pub fn group_editor(ui: &App, group: Option<Value>) {
let is_new = group.is_none();
@@ -474,10 +472,7 @@ pub fn group_editor(ui: &App, group: Option<Value>) {
);
move || {
let m = members.borrow();
- bots_group.set_title(&format!("Bots · {} of {MAX_MEMBERS}", m.len()));
- for (_, _, check) in checks.iter() {
- check.set_sensitive(check.is_active() || m.len() < MAX_MEMBERS);
- }
+ bots_group.set_title(&format!("Bots · {}", m.len()));
let names: Vec<&str> = m
.iter()
.filter_map(|id| checks.iter().find(|c| c.0 == *id).map(|c| c.1.as_str()))
diff --git a/docs/groups-and-threads.md b/docs/groups-and-threads.md
index 9600ad11..8e08eb1a 100644
--- a/docs/groups-and-threads.md
+++ b/docs/groups-and-threads.md
@@ -15,7 +15,7 @@ replies itself.
## Data (all over the existing sync: `bot` and `entry` events)
-- Bot: `kind` (`agent` | `group`), `members` (group: bot ids, max 6), `workingChat` /
+- Bot: `kind` (`agent` | `group`), `members` (group: bot ids, any number), `workingChat` /
`workingThread` (where the running turn talks). A group's `status` / `activity` are its busy
member's (`"Alice: Writing a reply…"`); its `lastMessage` names who spoke (`"Alice: …"`).
- Entry: `threadId`; `data.author` (the bot that wrote it; every agent-made entry has one);
diff --git a/host/src/group.rs b/host/src/group.rs
index b23a3904..f8d4b7d1 100644
--- a/host/src/group.rs
+++ b/host/src/group.rs
@@ -22,7 +22,6 @@ use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use tokio::sync::oneshot;
-pub const MAX_MEMBERS: usize = 6;
const MAX_ROUNDS: usize = 3;
/// Replies per room turn, across all rounds.
const MAX_REPLIES: usize = 10;
@@ -76,7 +75,7 @@ impl Rooms {
}
}
-/// Existing, distinct agent bots (not groups, not the group itself), at most [`MAX_MEMBERS`].
+/// Existing, distinct agent bots (not groups, not the group itself).
pub fn valid_members(store: &Store, group_id: &str, ids: &[String]) -> Result<Vec<String>> {
let mut out: Vec<String> = vec![];
for id in ids.iter().map(|i| i.trim()) {
@@ -92,9 +91,6 @@ pub fn valid_members(store: &Store, group_id: &str, ids: &[String]) -> Result<Ve
if out.is_empty() {
bail!("a group needs at least one bot");
}
- if out.len() > MAX_MEMBERS {
- bail!("groups can have up to {MAX_MEMBERS} bots");
- }
Ok(out)
}
diff --git a/host/src/tui/app.rs b/host/src/tui/app.rs
index 94569736..794bed53 100644
--- a/host/src/tui/app.rs
+++ b/host/src/tui/app.rs
@@ -508,9 +508,6 @@ impl Form {
}
}
-/// A group's bots: at most this many.
-pub const MAX_MEMBERS: usize = 6;
-
/// Create a group chat, or rename one and change who's in it.
pub struct GroupForm {
/// The group being edited; `None` creates one.
@@ -1571,10 +1568,8 @@ impl App {
g.error = None;
if let Some(i) = g.members.iter().position(|m| *m == id) {
g.members.remove(i);
- } else if g.members.len() < MAX_MEMBERS {
- g.members.push(id);
} else {
- g.error = Some(format!("A group holds up to {MAX_MEMBERS} bots."));
+ g.members.push(id);
}
}
}
diff --git a/host/src/tui/view.rs b/host/src/tui/view.rs
index d889fbdd..8925f619 100644
--- a/host/src/tui/view.rs
+++ b/host/src/tui/view.rs
@@ -16,7 +16,7 @@ use std::sync::LazyLock;
use super::app::{
ACTIONS, App, Bot, COLORS, Click, Editor, Entry, FIELDS, FILTERS, Field, Focus, Form, GotoItem, GroupForm, Kind,
- MAX_MEMBERS, Mark, Overlay, SHAPES, Status, TraceMode, Width, tilde,
+ Mark, Overlay, SHAPES, Status, TraceMode, Width, tilde,
};
use super::md::{self, truncate, width as w};
@@ -2010,14 +2010,7 @@ fn group_view(buf: &mut Buffer, area: Rect, app: &App, g: &GroupForm) {
placeholder,
g.on_name,
);
- put(
- buf,
- inner.x,
- inner.y + 2,
- inner.width,
- &format!("Bots · {} of {MAX_MEMBERS}", g.members.len()),
- label(!g.on_name),
- );
+ put(buf, inner.x, inner.y + 2, inner.width, &format!("Bots · {}", g.members.len()), label(!g.on_name));
let list_h = usize::from(inner.height.saturating_sub(7));
let off = g.cursor.saturating_sub(list_h.saturating_sub(1));
if bots.is_empty() {
diff --git a/kit/Sources/CodyncUI/Bots/GroupEditorView.swift b/kit/Sources/CodyncUI/Bots/GroupEditorView.swift
index 8562fc14..2372a44d 100644
--- a/kit/Sources/CodyncUI/Bots/GroupEditorView.swift
+++ b/kit/Sources/CodyncUI/Bots/GroupEditorView.swift
@@ -1,7 +1,7 @@
import CodyncKit
import SwiftUI
-/// Create a group chat, or rename one and change who's in it (up to six bots).
+/// Create a group chat, or rename one and change who's in it.
public struct GroupEditorView: View {
@Environment(BotStore.self) private var model
@Environment(\.dismissModal) private var dismiss
@@ -13,8 +13,6 @@ public struct GroupEditorView: View {
@State private var error: String?
@State private var confirmDelete: Bot?
- static let maxMembers = 6
-
public init(group: Bot? = nil, members: [String] = []) {
groupId = group?.id
_name = State(initialValue: group?.name ?? "")
@@ -43,7 +41,7 @@ public struct GroupEditorView: View {
Field("Name") {
TextField(defaultName, text: $name).fieldBox()
}
- Field("Bots · \(members.count) of \(Self.maxMembers)") {
+ Field("Bots · \(members.count)") {
VStack(spacing: 2) {
ForEach(candidates) { bot in memberRow(bot) }
}
@@ -77,7 +75,7 @@ public struct GroupEditorView: View {
let on = members.contains(bot.id)
return Button {
withAnimation(Motion.layout) {
- if on { members.removeAll { $0 == bot.id } } else if members.count < Self.maxMembers { members.append(bot.id) }
+ if on { members.removeAll { $0 == bot.id } } else { members.append(bot.id) }
}
} label: {
HStack(spacing: 12) {
@@ -97,7 +95,6 @@ public struct GroupEditorView: View {
.contentShape(Rectangle())
}
.buttonStyle(PressScale())
- .disabled(!on && members.count >= Self.maxMembers)
.accessibilityAddTraits(on ? .isSelected : [])
}
diff --git a/kit/Sources/CodyncUI/Bots/NewChatView.swift b/kit/Sources/CodyncUI/Bots/NewChatView.swift
index 2cd1e588..f15147c9 100644
--- a/kit/Sources/CodyncUI/Bots/NewChatView.swift
+++ b/kit/Sources/CodyncUI/Bots/NewChatView.swift
@@ -1,39 +1,66 @@
import CodyncKit
import SwiftUI
-/// Desktop "new message" page (Grok Bot's compose): a To: field that searches
-/// your bots or creates a new one, with ⌘1…⌘9 shortcuts, and the message box
-/// underneath. Whatever you typed is sent to the bot you pick.
+/// Desktop "new message" page (Grok Bot's compose): a To: field that searches your
+/// bots or creates a new one, with ⌘1…⌘9 shortcuts, and the message box underneath.
+/// Picked bots become chips in the To: field; one opens its chat, several start a
+/// group chat with them (or open the one they already share). Whatever you typed is sent.
public struct NewChatView: View {
let close: () -> Void
@Environment(BotStore.self) private var model
@State private var query = ""
@State private var draft = ""
+ @State private var recipients: [String] = []
@State private var creating = false
- @State private var creatingGroup = false
@FocusState private var toFocused: Bool
public init(close: @escaping () -> Void) { self.close = close }
+ /// Bots not picked yet; a group can only be opened on its own, so groups go once someone's picked.
private var matches: [Bot] {
let q = query.trimmingCharacters(in: .whitespaces)
- return model.roster.filter { q.isEmpty || $0.name.localizedCaseInsensitiveContains(q) }
+ return model.roster.filter {
+ !recipients.contains($0.id) && !($0.isGroup && !recipients.isEmpty)
+ && (q.isEmpty || $0.name.localizedCaseInsensitiveContains(q))
+ }
}
+ private var picked: [Bot] { recipients.compactMap { model.bots[$0] } }
+
public var body: some View {
VStack(spacing: 0) {
HStack(spacing: 8) {
Text("To:").foregroundStyle(Palette.secondary)
- TextField("Search or create bots", text: $query)
- .textFieldStyle(.plain)
- .focused($toFocused)
- .onSubmit { if let first = matches.first { pick(first) } else { create() } }
+ ScrollViewReader { proxy in
+ ScrollView(.horizontal, showsIndicators: false) {
+ HStack(spacing: 6) {
+ ForEach(picked) { bot in
+ RecipientChip(bot: bot) { remove(bot.id) }
+ .transition(.scale(scale: 0.85).combined(with: .opacity))
+ }
+ TextField(recipients.isEmpty ? "Search or create bots" : "Add another bot", text: $query)
+ .textFieldStyle(.plain)
+ .focused($toFocused)
+ .frame(minWidth: 200)
+ .onSubmit(submitTo)
+ .onKeyPress(.delete) {
+ // Backspace in an empty field takes the last chip back out.
+ guard query.isEmpty, let last = recipients.last else { return .ignored }
+ remove(last)
+ return .handled
+ }
+ .id("field")
+ }
+ .animation(Motion.layout, value: recipients)
+ }
+ .onChange(of: recipients) { _, _ in withAnimation(Motion.layout) { proxy.scrollTo("field", anchor: .trailing) } }
+ }
IconButton("Close", systemImage: "xmark", action: close)
.keyboardShortcut(.cancelAction)
}
.font(.title3)
.padding(.horizontal, 22)
- .padding(.vertical, 16)
+ .padding(.vertical, 12)
Rectangle().fill(Palette.border).frame(height: 0.5)
ScrollView {
@@ -46,16 +73,8 @@ public struct NewChatView: View {
} label: {
Text(query.isEmpty ? "Create new Bot" : "Create “\(query)”")
}
- PickRow(shortcut: 2, action: { creatingGroup = true }) {
- Image(systemName: "person.2")
- .font(.system(size: 12, weight: .medium))
- .frame(width: 26, height: 26)
- .background(Palette.bubbleAgent, in: Circle())
- } label: {
- Text("Create group chat")
- }
ForEach(Array(matches.enumerated()), id: \.element.id) { i, bot in
- PickRow(shortcut: i + 3 <= 9 ? i + 3 : nil, action: { pick(bot) }) {
+ PickRow(shortcut: i + 2 <= 9 ? i + 2 : nil, action: { choose(bot) }) {
if bot.isGroup {
GroupAvatar(members: model.members(of: bot), size: 26, animated: false)
} else {
@@ -76,14 +95,16 @@ public struct NewChatView: View {
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 22)
.padding(.top, 10)
+ .animation(Motion.layout, value: matches.map(\.id))
Spacer(minLength: 0)
HStack(alignment: .bottom, spacing: 8) {
- TextField("Message Bot", text: $draft, axis: .vertical)
+ TextField(placeholder, text: $draft, axis: .vertical)
.lineLimit(1...6)
.textFieldStyle(.plain)
.padding(.vertical, 11)
+ .sendOnReturn(start)
}
.padding(.leading, 18)
.padding(.trailing, 6)
@@ -96,24 +117,61 @@ public struct NewChatView: View {
await Task.yield()
toFocused = true
}
- .codyncSheet(isPresented: $creatingGroup) {
- GroupEditorView()
- .frame(width: 420, height: 560)
- .onDisappear { if model.selection != nil { finishGroup() } }
+ }
+
+ private var placeholder: String {
+ switch picked.count {
+ case 0: "Message Bot"
+ case 1: "Message \(picked[0].name)"
+ default: "Message \(picked.map(\.name).joined(separator: ", "))"
}
}
- private func pick(_ bot: Bot) {
- let text = draft.trimmingCharacters(in: .whitespacesAndNewlines)
- model.selection = bot.id
- if !text.isEmpty { model.send(text, to: bot.id) }
- close()
+ /// A bot becomes a chip; a group (with nobody picked) opens right away.
+ private func choose(_ bot: Bot) {
+ if bot.isGroup {
+ open(bot.id)
+ return
+ }
+ withAnimation(Motion.layout) { recipients.append(bot.id) }
+ query = ""
+ toFocused = true
+ }
+
+ private func remove(_ id: String) {
+ withAnimation(Motion.layout) { recipients.removeAll { $0 == id } }
}
- /// The new group is selected: carry over what was typed and close.
- private func finishGroup() {
- guard let id = model.selection else { return }
+ /// Return in To: picks the top match, or with the field empty, starts the chat.
+ private func submitTo() {
+ if !query.trimmingCharacters(in: .whitespaces).isEmpty {
+ if let first = matches.first { choose(first) } else { create() }
+ } else {
+ start()
+ }
+ }
+
+ /// One bot: its chat. Several: their group chat.
+ private func start() {
+ switch recipients.count {
+ case 0: return
+ case 1: open(recipients[0])
+ default:
+ let names = picked.map(\.name).joined(separator: ", ")
+ Task {
+ do {
+ let group = try await model.createGroup(name: names, members: recipients)
+ open(group.id)
+ } catch {
+ model.lastError = error.localizedDescription
+ }
+ }
+ }
+ }
+
+ private func open(_ id: String) {
let text = draft.trimmingCharacters(in: .whitespacesAndNewlines)
+ model.selection = id
if !text.isEmpty { model.send(text, to: id) }
close()
}
@@ -130,7 +188,13 @@ public struct NewChatView: View {
d.name = name
bot = try await model.save(d)
}
- pick(bot)
+ if recipients.isEmpty {
+ open(bot.id)
+ } else {
+ // `createDefaultBot` selected it; stay here and add it to the others.
+ model.selection = nil
+ choose(bot)
+ }
} catch {
model.lastError = error.localizedDescription
}
@@ -139,6 +203,38 @@ public struct NewChatView: View {
}
}
+/// A picked bot in the To: field; its x takes it back out.
+private struct RecipientChip: View {
+ let bot: Bot
+ let remove: () -> Void
+
+ var body: some View {
+ HStack(spacing: 6) {
+ CharacterAvatar(bot: bot, size: 20, animated: false)
+ Text(bot.name)
+ .font(.body)
+ .foregroundStyle(Palette.text)
+ .lineLimit(1)
+ .frame(maxWidth: 220, alignment: .leading)
+ .fixedSize(horizontal: true, vertical: false)
+ Button(action: remove) {
+ Image(systemName: "xmark")
+ .font(.system(size: 10, weight: .semibold))
+ .foregroundStyle(Palette.secondary)
+ .frame(width: 18, height: 18)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel("Remove \(bot.name)")
+ .help("Remove \(bot.name)")
+ }
+ .padding(.leading, 8)
+ .padding(.trailing, 6)
+ .padding(.vertical, 5)
+ .background(Palette.bubbleAgent, in: Capsule())
+ }
+}
+
private struct PickRow<Icon: View, Label: View>: View {
let shortcut: Int?
let action: () -> Void