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(ios): show sending and waiting-for-computer in the live activity
leepokai1a32d15d727f
diff --git a/apps/ios/App/CodyncApp.swift b/apps/ios/App/CodyncApp.swiftindex 1c56f59e..ff210474 100644--- a/apps/ios/App/CodyncApp.swift+++ b/apps/ios/App/CodyncApp.swift@@ -231,9 +231,9 @@ final class AppStore {WidgetCenter.shared.reloadAllTimelines()}}- accounts.onSent = { [weak accounts] ref, bot in+ accounts.onSent = { [weak accounts] ref, bot, progress inguard let store = accounts?.store(for: ref.computerId) else { return }- LiveActivities.shared.start(ref, bot: bot, store: store)+ LiveActivities.shared.sent(ref, bot: bot, progress: progress, store: store)}if let cloud {// Signed in: make this iPhone known to the account, then list its computers.diff --git a/apps/ios/App/Push.swift b/apps/ios/App/Push.swiftindex d7240721..e955dc18 100644--- a/apps/ios/App/Push.swift+++ b/apps/ios/App/Push.swift@@ -203,15 +203,36 @@ final class LiveActivities {Activity<BotActivityAttributes>.activities.first { $0.attributes.botId == ref.botId && $0.attributes.computerId == ref.computerId }}- func start(_ ref: BotReference, bot: Bot, store: BotStore) {- guard UserDefaults.standard.object(forKey: "liveActivitiesEnabled") as? Bool ?? true else { return }- guard ActivityAuthorizationInfo().areActivitiesEnabled, Self.find(ref) == nil, let client = store.client else { return }+ /// Follows a message from this phone: the activity starts as it leaves (Sending), waits with+ /// it in the relay mailbox while the computer is offline, then follows the bot's own status.+ func sent(_ ref: BotReference, bot: Bot, progress: SendProgress, store: BotStore) {+ let status: String+ switch progress {+ case .sending: status = "sending"+ case .queued: status = "queued"+ case .delivered: status = bot.needsInput ? "needsInput" : "working"+ case .failed:+ let state = BotActivityAttributes.ContentState(status: "error", activity: "Couldn't send", startedAt: nil)+ Task.detached { await Self.apply(ref, state: state, end: true) }+ return+ case .cancelled:+ Task.detached { await Self.find(ref)?.end(nil, dismissalPolicy: .immediate) }+ return+ }+ let state = BotActivityAttributes.ContentState(status: status, activity: "", startedAt: progress == .delivered ? .now : nil)+ // A mailbox message may wait hours for its computer: that isn't a delayed update.+ let staleDate: Date? = progress == .queued ? nil : .now + 15 * 60+ if Self.find(ref) != nil {+ Task.detached { await Self.find(ref)?.update(.init(state: state, staleDate: staleDate)) }+ return+ }+ guard UserDefaults.standard.object(forKey: "liveActivitiesEnabled") as? Bool ?? true,+ ActivityAuthorizationInfo().areActivitiesEnabled else { return }let attributes = BotActivityAttributes(bot: bot, computerId: ref.computerId, link: store.storage.botURL(ref))do {- let state = BotActivityAttributes.ContentState(status: "working", activity: "", startedAt: .now)- let activity = try Activity.request(attributes: attributes,- content: .init(state: state, staleDate: .now + 15 * 60), pushType: .token)- observe(activity, client: client)+ let activity = try Activity.request(attributes: attributes, content: .init(state: state, staleDate: staleDate), pushType: .token)+ // Offline (mailbox): `resume(with:)` registers the push token once the computer connects.+ if let client = store.client { observe(activity, client: client) }} catch {log.error("Live activity not started: \(error.localizedDescription)")}@@ -259,7 +280,10 @@ final class LiveActivities {/// Local updates while the app is open; the computer pushes them otherwise.func update(_ ref: BotReference, bot: Bot) {- guard Self.find(ref) != nil else { return }+ guard let current = Self.find(ref) else { return }+ // Until the computer starts on the message, an idle bot just hasn't begun yet.+ let local = ["sending", "queued"].contains(current.content.state.status)+ guard !local || bot.isWorking else { return }let state = BotActivityAttributes.ContentState(status: bot.status,// ACP activity is already visible in the app. Show it in the local Live Activitydiff --git a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swiftindex 40bf237b..6a82869a 100644--- a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift@@ -5,8 +5,8 @@ public extension BotActivityPresentation {switch phase {case .working: .workingcase .needsInput: .listening- case .waiting, .stale: .connecting- case .completed, .failed: nil+ case .sending, .waiting, .stale: .connecting+ case .queued, .completed, .failed: nil}}@@ -15,7 +15,7 @@ public extension BotActivityPresentation {case .needsInput: Palette.attentioncase .failed: Palette.dangercase .completed: Palette.added- case .stale, .waiting: Palette.secondary+ case .sending, .queued, .stale, .waiting: Palette.secondarycase .working: Palette.text}}@@ -27,7 +27,7 @@ public extension BotActivityPresentation {switch phase {case .working: .workingcase .needsInput: .needsInput- case .completed, .failed, .stale, .waiting: .idle+ case .sending, .queued, .completed, .failed, .stale, .waiting: .idle}}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swift b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swiftindex 6ce4ffad..4ab00a0f 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swift@@ -3,7 +3,9 @@ import Foundation/// Presentation only; the ActivityKit payload and host push contract stay unchanged.public struct BotActivityPresentation: Hashable, Sendable {public enum Phase: String, CaseIterable, Sendable {- case working, needsInput, completed, failed, stale, waiting+ /// `sending` and `queued` are this phone's own (a message on its way, or waiting in the+ /// relay mailbox for an offline computer); the computer only pushes the others.+ case sending, queued, working, needsInput, completed, failed, stale, waiting}public let phase: Phase@@ -11,18 +13,22 @@ public struct BotActivityPresentation: Hashable, Sendable {public init(status: String, activity: String, isStale: Bool = false) {let phase: Phase = switch status {+ case "sending": .sending+ case "queued": .queuedcase "working": .workingcase "needsInput": .needsInputcase "idle", "completed": .completedcase "error": .faileddefault: .waiting}- self.phase = isStale && (phase == .working || phase == .needsInput) ? .stale : phase+ self.phase = isStale && (phase == .working || phase == .needsInput || phase == .sending) ? .stale : phaseself.activity = activity}public var title: String {switch phase {+ case .sending: "Sending"+ case .queued: "Waiting for your computer"case .working: "Working"case .needsInput: "Needs you"case .completed: "Done"@@ -36,7 +42,7 @@ public struct BotActivityPresentation: Hashable, Sendable {public var caption: String {switch phase {case .working, .needsInput: activity.isEmpty ? title : activity- case .completed, .failed, .stale, .waiting: title+ case .sending, .queued, .completed, .failed, .stale, .waiting: title}}@@ -44,7 +50,8 @@ public struct BotActivityPresentation: Hashable, Sendable {switch phase {case .completed: "checkmark"case .failed: "exclamationmark.triangle.fill"- case .working, .needsInput, .stale, .waiting: "ellipsis"+ case .queued: "desktopcomputer"+ case .sending, .working, .needsInput, .stale, .waiting: "ellipsis"}}}diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/AccountStore.swift b/apps/ios/Kit/Sources/CodyncUI/Store/AccountStore.swiftindex a5038fa1..5e16b64d 100644--- a/apps/ios/Kit/Sources/CodyncUI/Store/AccountStore.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Store/AccountStore.swift@@ -41,7 +41,7 @@ public final class AccountStore {public var onBotUpdated: (@MainActor (BotReference, Bot) -> Void)?public var onConnected: (@MainActor (BotStore) -> Void)?- public var onSent: (@MainActor (BotReference, Bot) -> Void)?+ public var onSent: (@MainActor (BotReference, Bot, SendProgress) -> Void)?/// The combined roster changed: a bot came, changed or went, or a computer did.public var onRosterChanged: (@MainActor ([RosterItem]) -> Void)?@@ -312,9 +312,9 @@ public final class AccountStore {guard let self, !self.retired else { return }self.onBotUpdated?(BotReference(accountId: self.accountId, computerId: id, botId: bot.id), bot)}- store.onSent = { [weak self] bot in+ store.onSent = { [weak self] bot, progress inguard let self, !self.retired else { return }- self.onSent?(BotReference(accountId: self.accountId, computerId: id, botId: bot.id), bot)+ self.onSent?(BotReference(accountId: self.accountId, computerId: id, botId: bot.id), bot, progress)}store.onConnected = { [weak self] store inguard let self, !self.retired else { return }diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swiftindex 844f4dd1..ec5f8cd5 100644--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift@@ -12,6 +12,12 @@ public struct ScreenRequest: Identifiable, Hashable, Sendable {public init(watching: String? = nil) { self.watching = watching }}+/// Where a message from this phone is: on its way, waiting in the relay mailbox for an offline+/// computer, accepted by the computer, or not sent.+public enum SendProgress: Sendable {+ case sending, queued, delivered, failed, cancelled+}+/// One computer's mirror (bots, transcripts) for a client (iPhone app, Mac window), kept by one/// events stream (catch-up since `rev`, then live) over the encrypted channel./// `AccountStore` holds one per computer.@@ -75,7 +81,8 @@ public final class BotStore {public var onConnected: (@MainActor (BotStore) -> Void)?public var onBotUpdated: (@MainActor (Bot) -> Void)?public var onUsageChanged: (@MainActor (ComputerID, Usage) -> Void)?- public var onSent: (@MainActor (Bot) -> Void)?+ /// A message to the bot from this phone moved along (the Live Activity follows it).+ public var onSent: (@MainActor (Bot, SendProgress) -> Void)?/// A bot appeared, changed or went away.var onRosterChanged: (@MainActor () -> Void)?/// The computer's addresses or keys changed (merged from its `hello`); persist it.@@ -709,6 +716,7 @@ public final class BotStore {)upsert(local)storage.lastComputerId = computer.id+ if let bot = bots[botId] { onSent?(bot, .sending) }// The relay mailbox holds text only: files wait for the computer.if canQueue, files.isEmpty, let remote = transport as? any RemoteTransport {enqueue(remote, text: trimmed, botId: botId, thread: thread, nonce: nonce)@@ -737,7 +745,7 @@ public final class BotStore {}outgoingFiles[nonce] = nilupsert(e)- if let bot = bots[botId] { onSent?(bot) }+ if let bot = bots[botId] { onSent?(bot, .delivered) }} catch {if outgoingFiles[nonce] != nil { lastError = "Couldn't send the files: \(error.localizedDescription)" }markLocal(nonce: nonce, botId: botId, status: "failed")@@ -752,7 +760,7 @@ public final class BotStore {Task {do {try await remote.enqueue(botId: botId, text: text, clientNonce: nonce, threadId: thread)- if let bot = bots[botId] { onSent?(bot) }+ if let bot = bots[botId] { onSent?(bot, .queued) }} catch MailboxError.hostOnline {// Presence can race the stream state. Wait for the host's events channel// before trying the normal API, instead of turning that race into a failure.@@ -789,6 +797,7 @@ public final class BotStore {switch await remote.cancelQueued(clientNonce: nonce) {case .cancelled:discard(entry)+ if let bot = bots[entry.botId] { onSent?(bot, .cancelled) }case .delivering:markLocal(nonce: nonce, botId: entry.botId, status: "delivering")case .unknown:@@ -874,6 +883,7 @@ public final class BotStore {list[i].data.status = statusentries[botId] = listscheduleSave()+ if status == "failed", let bot = bots[botId] { onSent?(bot, .failed) }}public func stop(_ botId: String) { perform(replay: true) { try await $0.stop(botId) } }diff --git a/apps/ios/Kit/Tests/CodyncKitTests/SurfaceRenderTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/SurfaceRenderTests.swiftindex 3876cf74..0be425ca 100644--- a/apps/ios/Kit/Tests/CodyncKitTests/SurfaceRenderTests.swift+++ b/apps/ios/Kit/Tests/CodyncKitTests/SurfaceRenderTests.swift@@ -11,6 +11,8 @@ import Testinglet bot = Bot.widgetPreview[0]let started = Date.now - 154let phases: [(String, BotActivityPresentation)] = [+ ("Sending", .init(status: "sending", activity: "")),+ ("Waiting for computer", .init(status: "queued", activity: "")),("Working", .init(status: "working", activity: "Running the test suite.")),("Needs you", .init(status: "needsInput", activity: "Review the proposed changes.")),("Done", .init(status: "idle", activity: "")),diff --git a/apps/ios/Views/ActivityGalleryView.swift b/apps/ios/Views/ActivityGalleryView.swiftindex e54cc9d4..5627f154 100644--- a/apps/ios/Views/ActivityGalleryView.swift+++ b/apps/ios/Views/ActivityGalleryView.swift@@ -18,6 +18,8 @@ struct ActivityGalleryView: View {private var state: BotActivityPresentation {let status: String = switch phase {+ case .sending: "sending"+ case .queued: "queued"case .working, .stale: "working"case .needsInput: "needsInput"case .completed: "idle"@@ -60,6 +62,7 @@ struct ActivityGalleryView: View {ChoicePicker(selection: Binding(get: { form ?? forms[0] }, set: { form = $0 }), options: forms.map { ($0, $0.rawValue) })}ChoicePicker(selection: $phase, options: [+ (.sending, "Sending"), (.queued, "Waiting for computer"),(.working, "Working"), (.needsInput, "Needs you"), (.completed, "Done"),(.failed, "Error"), (.stale, "Update delayed"),])diff --git a/docs/design/push-and-live-activity.md b/docs/design/push-and-live-activity.mdindex c8283c30..31faca1d 100644--- a/docs/design/push-and-live-activity.md+++ b/docs/design/push-and-live-activity.md@@ -6,7 +6,9 @@ Updated: 2026-09-27. This describes the implemented notification contract and it| Event | Notification | Live Activity / Dynamic Island || --- | --- | --- |-| A task is sent from this iPhone | No alert | Start one activity for this bot |+| A task is sent from this iPhone | No alert | Start one activity for this bot as the message leaves: Sending (orb), then Working once the computer accepts it |+| The computer is offline (message waits in the relay mailbox) | No alert | Waiting for your computer (computer symbol), never marked delayed; Working when the computer picks it up |+| The message couldn't be sent | No alert (the chat shows Failed to send) | Failed, “Couldn't send”, then dismiss after 60 seconds; a message taken back out of the mailbox ends the activity || Working | No alert for each tool call | Bot identity and working orb || Input or permission needed | Bot name, “Response needed”, request summary; “Review request” action | Needs you; keep the activity alive || Completed (sent once the last queued message is answered) | Bot name, “Task complete”, final reply preview; “Open conversation” action | Done, then dismiss after 60 seconds |@@ -45,7 +47,7 @@ Remote activity content contains only `status`, empty `activity`, and `startedAt1. iOS registers its APNs token with `POST /register` using `kind: alert` and its build environment.2. The Worker returns an AES-GCM ticket. The phone sends it with its X25519 push public key and account context to `registerDevice` on the host.3. Registration atomically replaces previous alert tickets for that device identity. Delivery also selects only the latest stored ticket per device, so existing duplicate rows cannot fan out before that phone reconnects. Randomized tickets must not accumulate, retain obsolete keys or generate duplicate notifications.-4. A foreground task submission starts an ActivityKit activity with `pushType: .token`. The phone registers each activity token using `kind: liveactivity`, then calls `registerActivity` for the bot.+4. Sending a task starts an ActivityKit activity with `pushType: .token` in the local Sending state (Waiting for your computer when it goes to the mailbox); bot updates that aren't work yet don't end it. The phone registers each activity token using `kind: liveactivity`, then calls `registerActivity` for the bot.5. Activity registration replaces the previous ticket for this device and bot. The app retries registration up to three times and reattaches token observers after reconnect/relaunch. Cancellation stops retries.6. The host sends current state after registration, including terminal state if the task already finished. An idle bot with an unanswered main-chat user message waits for its actor to start rather than reporting immediate completion.7. Status transitions send updates; idle/error sends an end event preserving that status and removes the activity tickets. The group view follows its member runtime using the existing group state logic.