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
fix: show whole chats after an update and count thread replies right
leepokai0e017f17b8ad
diff --git a/apps/desktop/src/renderer/store/bot-sync.ts b/apps/desktop/src/renderer/store/bot-sync.tsindex 93856974..a04320a5 100644--- a/apps/desktop/src/renderer/store/bot-sync.ts+++ b/apps/desktop/src/renderer/store/bot-sync.ts@@ -11,6 +11,16 @@ const MISMATCH_RECHECK = 30_000export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))const same = (a: Connection, b: Connection) => a.kind === b.kind && JSON.stringify(a) === JSON.stringify(b)+/** Each chat's entries that `keep` accepts; chats left empty go. */+function keptEntries(entries: Map<string, Entry[]>, keep: (e: Entry) => boolean) {+ const kept = new Map<string, Entry[]>()+ for (const [id, list] of entries) {+ const rest = list.filter(keep)+ if (rest.length) kept.set(id, rest)+ }+ return kept+}+/*** The link half of `BotStore`: the events stream (catch-up since `rev`, then live), connection* graces, waiting for the link before an action, and read acknowledgements.@@ -167,7 +177,7 @@ export class BotSync extends BotMirror {const cached = this.cacheStamp !== null && this.cacheStamp !== `${this.appVersion}/${next.version}`if (cached || (this.hostVersion && this.hostVersion.version !== next.version)) {// A different host version or app build: data may carry new fields, so fetch it all again.- this.rev = 0+ this.refetchAll()this.rewound = falsethis.unreadable = false}@@ -225,7 +235,7 @@ export class BotSync extends BotMirror {// Never skip past data we couldn't read: rewind once and fetch everything again.if (!this.rewound) {this.rewound = true- this.rev = 0+ this.refetchAll()this.restartEvents()} else if (!this.unreadable) {this.unreadable = true@@ -240,12 +250,7 @@ export class BotSync extends BotMirror {private resetMirror() {this.composerDrafts.clear()this.bots = new Map()- const kept = new Map<string, Entry[]>()- for (const [id, list] of this.entries) {- const local = list.filter((e) => e.id.startsWith('local-'))- if (local.length) kept.set(id, local)- }- this.entries = kept+ this.entries = keptEntries(this.entries, (e) => e.id.startsWith('local-'))this.selection = nullthis.onRosterChanged?.()this.rev = 0@@ -256,6 +261,17 @@ export class BotSync extends BotMirror {this.saveCache()}+ /**+ * Fetches everything again from rev 0. That catch-up brings only each chat's newest entries, so the+ * main-chat ones held now go too: an older one kept would hide the gap from `loadOlder`, which pages+ * from the oldest one held. Threads (loaded whole when opened) and messages still sending stay.+ */+ private refetchAll() {+ this.rev = 0+ this.entries = keptEntries(this.entries, (e) => !!e.threadId || e.id.startsWith('local-'))+ this.historyComplete = new Set()+ }+private isBelowFloor(e: Entry) {const held = this.allEntries(e.botId).some((x) => x.id === e.id)return isOutsideLoadedWindow(this.floors.get(e.botId), held, e)diff --git a/apps/desktop/src/renderer/views/thread/RepliesView.tsx b/apps/desktop/src/renderer/views/thread/RepliesView.tsxindex d6906d9c..f3c57a7a 100644--- a/apps/desktop/src/renderer/views/thread/RepliesView.tsx+++ b/apps/desktop/src/renderer/views/thread/RepliesView.tsx@@ -55,7 +55,7 @@ export function RepliesView({ botId, rootId, close }: { botId: string; rootId: s<ChatRow entry={root} groupStart chat={chat} openTrace={openTrace} /><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '12px 0' }}><span style={{ ...font('caption'), color: 'var(--tertiary)', whiteSpace: 'nowrap' }}>- {replies.length === 0 ? 'No replies yet' : replies.length === 1 ? '1 reply' : `${replies.length} replies`}+ {replyCount(root.data.thread?.count ?? 0)}</span><div style={{ flex: 1, height: 1, background: 'var(--border)' }} /></div>@@ -91,3 +91,8 @@ export function RepliesView({ botId, rootId, close }: { botId: string; rootId: s</div>)}++/** The host's count, as on the thread's chip: messages, not the agent's trace. */+function replyCount(count: number) {+ return count === 0 ? 'No replies yet' : count === 1 ? '1 reply' : `${count} replies`+}diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sync.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sync.swiftindex ddbd5c60..42cd2d16 100644--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sync.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sync.swift@@ -67,7 +67,7 @@ extension BotStore {let cached = cacheStamp.map { $0 != "\(Self.appBuild)/\(new.version)" } ?? falseif cached || (hostVersion.map { $0.version != new.version } ?? false) {// A different host version or app build: data may carry new fields, so fetch it all again.- rev = 0+ refetchAll()rewound = falseunreadable = false}@@ -142,7 +142,7 @@ extension BotStore {log.error("undecodable \(type) event")if !rewound {rewound = true- rev = 0+ refetchAll()restartEvents()} else if !unreadable {Motion.animate { unreadable = true }@@ -174,6 +174,16 @@ extension BotStore {saveCache()}+ /// Fetches everything again from rev 0. That catch-up brings only each chat's newest entries, so+ /// the main-chat ones held now go too: an older one kept would hide the gap from `loadOlder`, which+ /// pages from the oldest one held. Threads (loaded whole when opened) and messages still sending stay.+ private func refetchAll() {+ rev = 0+ entries = entries.mapValues { $0.filter { $0.threadId != nil || $0.id.hasPrefix("local-") } }+ .filter { !$0.value.isEmpty }+ historyComplete = []+ }+/// Resubscribes from the current `rev` on the same link.private func restartEvents() {guard let client, eventsTask != nil else { return }diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swiftindex da04d1a3..5989a760 100644--- a/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swift@@ -73,13 +73,15 @@ extension RepliesView {let items = ChatItem.build(replies)var rows: [ConversationRow] = []if let root {+ // The host's count, as on the thread's chip: messages, not the agent's trace.+ let count = root.data.thread?.count ?? 0rows.append(ConversationRow("root") {ChatRow(entry: root, groupStart: true, chat: chat) { showTrace = true }.equatable()})rows.append(ConversationRow("count") {HStack(spacing: 10) {- Text(replies.isEmpty ? "No replies yet" : replies.count == 1 ? "1 reply" : "\(replies.count) replies")+ Text(count == 0 ? "No replies yet" : count == 1 ? "1 reply" : "\(count) replies").font(.caption).foregroundStyle(Palette.tertiary).fixedSize()