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(ios): stream chat answers smoothly
leepokai51da44746096
diff --git a/kit/Sources/CodyncKit/Design/Motion.swift b/kit/Sources/CodyncKit/Design/Motion.swiftindex de274707..d54d8855 100644--- a/kit/Sources/CodyncKit/Design/Motion.swift+++ b/kit/Sources/CodyncKit/Design/Motion.swift@@ -20,6 +20,8 @@ public enum Motion {/// Size and layout changes (panels growing, cards resizing): the critically damped/// `.3s` spring Grok writes as a `linear()` curve.public static let layout = Animation.spring(duration: 0.3, bounce: 0)+ /// A slightly slower, critically damped spring for a new chat message and its scroll.+ public static let conversation = Animation.spring(duration: 0.42, bounce: 0)/// Tiles moving into place: `{type: "spring", stiffness: 1000, damping: 63}`.public static let tile = Animation.interpolatingSpring(mass: 1, stiffness: 1000, damping: 63)diff --git a/kit/Sources/CodyncUI/Thread/ChatRows.swift b/kit/Sources/CodyncUI/Thread/ChatRows.swiftindex 421b912b..cf749c8c 100644--- a/kit/Sources/CodyncUI/Thread/ChatRows.swift+++ b/kit/Sources/CodyncUI/Thread/ChatRows.swift@@ -217,7 +217,7 @@ struct AgentBubble: View {var body: some View {VStack(alignment: .leading, spacing: 4) {- MarkdownText(entry.data.text ?? "")+ MarkdownText(entry.data.text ?? "", streaming: entry.data.final == false).padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 16)).padding(.vertical, InterfaceMetrics.value(mac: 8, mobile: 10)).background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 22, style: .continuous))diff --git a/kit/Sources/CodyncUI/Thread/Composer.swift b/kit/Sources/CodyncUI/Thread/Composer.swiftindex b68cdb58..2a7b9d3c 100644--- a/kit/Sources/CodyncUI/Thread/Composer.swift+++ b/kit/Sources/CodyncUI/Thread/Composer.swift@@ -12,6 +12,7 @@ struct Composer: View {/// Starts a voice call; while the box is empty it takes the send button's place.var onCall: (() -> Void)?@Environment(BotStore.self) private var model+ @Environment(\.accessibilityReduceMotion) private var reduceMotion@State private var draft = ""/// Files going out with the next message.@State private var files: [OutgoingFile] = []@@ -380,9 +381,10 @@ struct Composer: View {private func submit() {guard canSend else { return }- model.send(draft, to: botId, thread: thread, files: files)- draft = ""- files = []+ withAnimation(Motion.reduced(Motion.conversation, reduceMotion)) {+ model.send(draft, to: botId, thread: thread, files: files)+ draft = ""+ files = []+ }}}-diff --git a/kit/Sources/CodyncUI/Thread/MarkdownText.swift b/kit/Sources/CodyncUI/Thread/MarkdownText.swiftindex 00e10245..58dd9d8f 100644--- a/kit/Sources/CodyncUI/Thread/MarkdownText.swift+++ b/kit/Sources/CodyncUI/Thread/MarkdownText.swift@@ -5,9 +5,20 @@ import SwiftUI/// fenced code; inline styling comes from `AttributedString(markdown:)`.public struct MarkdownText: View {let blocks: [Block]+ let streaming: Bool+ @Environment(\.accessibilityReduceMotion) private var reduceMotion- public init(_ source: String) {+ private var contentTransition: ContentTransition {+ streaming && !reduceMotion ? .interpolate : .identity+ }++ private var textAnimation: Animation? {+ streaming ? Motion.reduced(Motion.fade, reduceMotion) : nil+ }++ public init(_ source: String, streaming: Bool = false) {blocks = Self.parse(source)+ self.streaming = streaming}enum Block: Hashable {@@ -30,21 +41,32 @@ public struct MarkdownText: View {@ViewBuilder private func view(for block: Block) -> some View {switch block {case let .paragraph(t):- Text(Self.inline(t)).font(InterfaceMetrics.body).foregroundStyle(Palette.text)+ Text(Self.inline(t))+ .font(InterfaceMetrics.body)+ .foregroundStyle(Palette.text)+ .contentTransition(contentTransition)+ .animation(textAnimation, value: t)case let .heading(t, level):Text(Self.inline(t)).font(level == 1 ? .title3.bold() : level == 2 ? .headline : .subheadline.bold()).foregroundStyle(Palette.text)+ .contentTransition(contentTransition)+ .animation(textAnimation, value: t)case let .bullet(t, marker):HStack(alignment: .firstTextBaseline, spacing: 6) {Text(marker).foregroundStyle(Palette.secondary).monospacedDigit()- Text(Self.inline(t)).foregroundStyle(Palette.text)+ Text(Self.inline(t))+ .foregroundStyle(Palette.text)+ .contentTransition(contentTransition)+ .animation(textAnimation, value: t)}.font(InterfaceMetrics.body)case let .quote(t):Text(Self.inline(t)).font(InterfaceMetrics.body).foregroundStyle(Palette.secondary)+ .contentTransition(contentTransition)+ .animation(textAnimation, value: t).padding(.leading, 10).overlay(alignment: .leading) { Rectangle().fill(Palette.border).frame(width: 3) }case let .code(t, _):diff --git a/kit/Sources/CodyncUI/Thread/ThreadView.swift b/kit/Sources/CodyncUI/Thread/ThreadView.swiftindex a1e25c45..02d3a275 100644--- a/kit/Sources/CodyncUI/Thread/ThreadView.swift+++ b/kit/Sources/CodyncUI/Thread/ThreadView.swift@@ -104,6 +104,9 @@ public struct ThreadView: View {ForEach(items) { item inrow(item).id(item.id)+ .transition(item.id == items.last?.id+ ? .asymmetric(insertion: .move(edge: .bottom).combined(with: .opacity), removal: .opacity)+ : .identity)}// Offline, "working" is only what the computer last said; don't show it as live.if let bot, bot.isWorking(in: botId, thread: nil), !model.isOffline {@@ -115,6 +118,7 @@ public struct ThreadView: View {}.padding(.horizontal, 16).padding(.top, 8)+ .animation(Motion.reduced(Motion.conversation, reduceMotion), value: items.last?.id)#if os(macOS).frame(maxWidth: 820).frame(maxWidth: .infinity)@@ -129,11 +133,21 @@ public struct ThreadView: View {#endif.onChange(of: items.last?.id) { _, _ inguard isAtBottom || items.last?.isUserMessage == true else { return }- proxy.scrollTo("bottom", anchor: .bottom)+ withAnimation(Motion.reduced(Motion.conversation, reduceMotion)) {+ proxy.scrollTo("bottom", anchor: .bottom)+ }+ }+ .onChange(of: items.last?.textContent) { _, _ in+ guard isAtBottom else { return }+ withAnimation(Motion.reduced(Motion.conversation, reduceMotion)) {+ proxy.scrollTo("bottom", anchor: .bottom)+ }}.onChange(of: bot?.isWorking) { _, _ inguard isAtBottom else { return }- proxy.scrollTo("bottom", anchor: .bottom)+ withAnimation(Motion.reduced(Motion.conversation, reduceMotion)) {+ proxy.scrollTo("bottom", anchor: .bottom)+ }}}.background(Palette.background)@@ -448,7 +462,9 @@ struct ChatItem: Identifiable {var out: [ChatItem] = []var lastDate: Date?var lastAuthor: String?- for e in entries where e.isChat {+ // Agent text is streamed as a stable entry with final=false, then updated in place.+ // Render that same row while it is generating so the completed answer never pops in later.+ for e in entries where e.isChat || (e.kind == "agent" && e.data.final == false && !(e.data.text ?? "").isEmpty) {let date = e.datelet id = e.kind == "user" ? e.data.clientNonce.map { "user-\($0)" } ?? e.id : e.idif lastDate.map({ date.timeIntervalSince($0) > 3600 }) ?? true {@@ -467,6 +483,10 @@ struct ChatItem: Identifiable {var isUserMessage: Bool {if case let .entry(entry, _) = kind { entry.kind == "user" } else { false }}++ var textContent: String? {+ if case let .entry(entry, _) = kind { entry.data.text } else { nil }+ }}/// The start of an empty group chat: who's in it and how the room works.