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(apps): calls show on the Lock Screen, in the Dynamic Island and in the notification
leepokai9b6b9edeeb0a
diff --git a/apps/android/WhatsNew.md b/apps/android/WhatsNew.mdindex b2c6da97..49d92b65 100644--- a/apps/android/WhatsNew.md+++ b/apps/android/WhatsNew.md@@ -13,11 +13,13 @@ else a generic "Bug fixes and improvements" line. Delete old sections.- Bot 工作時,Gemini 與 OpenAI 的語音會主動告訴你它在做什麼、有沒有等你核准或遇到問題,做完就念出結果。- 通話中短暫斷線再連上時,錯過的回覆會補念給你聽。- Gemini 或 OpenAI 通話斷線時會自動重新連上並接著聊,不必重打。+- 通話的通知會顯示通話狀態和 Bot 正在做的事。### en-US- While the bot works, the Gemini and OpenAI voice says what it's doing, when an approval waits or something fails, and reads the result.- Replies missed while a call reconnects are read once it's back.- A dropped Gemini or OpenAI call reconnects without hanging up.+- The call's notification shows its state and what the bot is doing.## 2.25.0diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AppStoreVoice.kt b/apps/android/app/src/main/kotlin/com/codync/android/AppStoreVoice.ktindex fe32fadf..84316f1a 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/AppStoreVoice.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/AppStoreVoice.kt@@ -27,6 +27,8 @@ internal class VoiceBinding(val id: String, val botId: String, val generation: Ivar recording: () -> Int? = { null }/** What the voice service sees: the current engine, never the failure it fell back from. */val state = MutableStateFlow(VoiceState())+ /** What the bot is doing, from the computer's progress cues, for the call's notification; cleared by its reply. */+ val progress = MutableStateFlow<String?>(null)/** `voice_call_started` (and `callStarted`) went out: once per call, with the engine that got it going. */var reported = false/** The call on the computer. */@@ -190,6 +192,11 @@ internal fun AppStore.hearCalls(events: List<MirrorEvent>) {if (cue.call != call.id || cue.seq <= call.heard || engine == null) continuecall.heard = cue.seqengine.hear(cue)+ when (cue.kind) {+ CallCue.Kind.Progress -> call.progress.value = cue.text+ CallCue.Kind.Reply -> call.progress.value = null+ CallCue.Kind.Notice -> {}+ }}}diff --git a/apps/android/app/src/main/kotlin/com/codync/android/VoiceService.kt b/apps/android/app/src/main/kotlin/com/codync/android/VoiceService.ktindex a58dfea2..460a10c3 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/VoiceService.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/VoiceService.kt@@ -12,7 +12,7 @@ import androidx.core.app.NotificationCompatimport androidx.core.content.ContextCompatimport com.codync.android.core.*import kotlinx.coroutines.*-import kotlinx.coroutines.flow.collectLatest+import kotlinx.coroutines.flow.*/** The call the UI shows; `notice` is the line under the bar, e.g. why it fell back to on-device voice. */data class VoiceCallViewState(val id: String, val botId: String, val state: VoiceState = VoiceState(), val notice: String? = null)@@ -90,9 +90,13 @@ class VoiceService : Service() {receivers = trueval call = request.store.attachVoice(request.id, request.botId) ?: throw IllegalStateException("The active account changed")session = call- scope.launch { call.state.collectLatest { state ->+ // At most one notification update a second: progress lines can come quickly.+ scope.launch { combine(call.state, call.progress, ::Pair).conflate().collect { (state, progress) ->if (state.phase in listOf(VoicePhase.Failed, VoicePhase.Ended)) end(state.error)- else getSystemService(NotificationManager::class.java).notify(NOTIFICATION, notification(state))+ else {+ getSystemService(NotificationManager::class.java).notify(NOTIFICATION, notification(state, progress))+ delay(1_000)+ }} }} catch (_: Exception) { end("Couldn't start voice chat. Check microphone access and Android's audio settings.") }} else if (id == callId) {@@ -118,7 +122,7 @@ class VoiceService : Service() {manager.isSpeakerphoneOn = !bluetooth && available.none { it.type in listOf(AudioDeviceInfo.TYPE_WIRED_HEADSET, AudioDeviceInfo.TYPE_USB_HEADSET) }}}- private fun notification(state: VoiceState): Notification {+ private fun notification(state: VoiceState, progress: String? = null): Notification {val snapshot = store?.state?.valueval call = snapshot?.voiceval bot = snapshot?.bots?.firstOrNull { it.id == call?.botId }@@ -130,11 +134,9 @@ class VoiceService : Service() {.setAction(kind).putExtra(ID, callId), PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)return NotificationCompat.Builder(this, CHANNEL).setSmallIcon(R.drawable.ic_notification).setContentTitle("Voice chat · ${bot?.name ?: "Codync"}")- .setContentText(if (state.muted) "Microphone muted" else when (state.phase) {- VoicePhase.Starting -> "Connecting…"; VoicePhase.Reconnecting -> "Reconnecting…"; VoicePhase.Speaking -> "Speaking"- VoicePhase.Interrupted -> "Audio interrupted · return to resume"- else -> "Listening · " + (state.provider?.title ?: "on this phone")- }).setContentIntent(content).setOngoing(true).setCategory(NotificationCompat.CATEGORY_CALL)+ .setContentText(callNotificationText(state, progress))+ .setStyle(NotificationCompat.BigTextStyle().bigText(callNotificationText(state, progress, "\n")))+ .setContentIntent(content).setOngoing(true).setCategory(NotificationCompat.CATEGORY_CALL).setVisibility(NotificationCompat.VISIBILITY_PRIVATE).setOnlyAlertOnce(true).addAction(0, if (state.muted) "Unmute" else "Mute", action(MUTE)).addAction(0, "End call", action(END)).build()}@@ -201,3 +203,13 @@ class VoiceService : Service() {}}}++/** The call's notification text: its state, then what the bot is doing (the computer's latest progress line). */+internal fun callNotificationText(state: VoiceState, progress: String?, separator: String = " · "): String {+ val status = if (state.muted) "Microphone muted" else when (state.phase) {+ VoicePhase.Starting -> "Connecting…"; VoicePhase.Reconnecting -> "Reconnecting…"; VoicePhase.Speaking -> "Speaking"+ VoicePhase.Interrupted -> "Audio interrupted · return to resume"+ else -> "Listening · " + (state.provider?.title ?: "on this phone")+ }+ return if (progress.isNullOrBlank()) status else status + separator + progress+}diff --git a/apps/android/app/src/test/kotlin/com/codync/android/CallNotificationTest.kt b/apps/android/app/src/test/kotlin/com/codync/android/CallNotificationTest.ktnew file mode 100644index 00000000..e1d4f815--- /dev/null+++ b/apps/android/app/src/test/kotlin/com/codync/android/CallNotificationTest.kt@@ -0,0 +1,19 @@+package com.codync.android++import com.codync.android.core.VoicePhase+import com.codync.android.core.VoiceProvider+import com.codync.android.core.VoiceState+import org.junit.Assert.assertEquals+import org.junit.Test++class CallNotificationTest {+ @Test fun theNotificationShowsTheCallThenTheBotsProgress() {+ val listening = VoiceState(phase = VoicePhase.Listening, provider = VoiceProvider.Gemini)+ assertEquals("Listening · Gemini", callNotificationText(listening, null))+ assertEquals("Listening · Gemini · Running the tests", callNotificationText(listening, "Running the tests"))+ assertEquals("Speaking\nRunning the tests",+ callNotificationText(VoiceState(phase = VoicePhase.Speaking), "Running the tests", "\n"))+ assertEquals("Microphone muted", callNotificationText(listening.copy(muted = true), " "))+ assertEquals("Reconnecting…", callNotificationText(VoiceState(phase = VoicePhase.Reconnecting), null))+ }+}diff --git a/apps/ios/App/Push.swift b/apps/ios/App/Push.swiftindex 4eaebe1c..0043ec2c 100644--- a/apps/ios/App/Push.swift+++ b/apps/ios/App/Push.swift@@ -227,7 +227,11 @@ final class LiveActivities {// A mailbox message may wait hours for its computer: that isn't a delayed update.let staleDate: Date? = progress == .queued ? nil : .now + 15 * 60if Self.find(ref) != nil {- Task.detached { await Self.find(ref)?.update(.init(state: state, staleDate: staleDate)) }+ let onCall = CallActivity.isLive(botId: ref.botId)+ Task.detached {+ guard let activity = Self.find(ref) else { return }+ await activity.update(.init(state: state.keepingCall(of: activity, onCall: onCall), staleDate: staleDate))+ }return}guard UserDefaults.standard.object(forKey: "liveActivitiesEnabled") as? Bool ?? true,@@ -245,6 +249,7 @@ final class LiveActivities {/// Reattach token observers after a relaunch or connection replacement.func resume(with store: BotStore) {guard UserDefaults.standard.object(forKey: "liveActivitiesEnabled") as? Bool ?? true else { return }+ endLeftoverCalls()guard let client = store.client else { return }for activity in Activity<BotActivityAttributes>.activitieswhere activity.attributes.computerId == store.computer.id {@@ -252,6 +257,26 @@ final class LiveActivities {}}+ /// A call the app was closed in the middle of leaves its fields on the activity: they go, and an activity that+ /// only showed the call ends.+ private func endLeftoverCalls() {+ let over = Activity<BotActivityAttributes>.activities+ .filter { $0.content.state.call != nil && !CallActivity.isLive(botId: $0.attributes.botId) }.map(\.id)+ guard !over.isEmpty else { return }+ Task.detached {+ for activity in Activity<BotActivityAttributes>.activities where over.contains(activity.id) {+ var state = activity.content.state+ state.call = nil+ state.callStartedAt = nil+ if ["idle", "completed"].contains(state.status) {+ await activity.end(nil, dismissalPolicy: .immediate)+ } else {+ await activity.update(.init(state: state, staleDate: activity.content.staleDate))+ }+ }+ }+ }+private func observe(_ activity: Activity<BotActivityAttributes>, client: HostClient) {requests[activity.id]?.cancel()requests[activity.id] = Task {@@ -294,8 +319,9 @@ final class LiveActivities {// while this phone is connected; APNs payloads continue to contain no free text.activity: bot.activity,startedAt: bot.startedAt.map(Date.init(milliseconds:))- )- let working = bot.isWorking+ ).keepingCall(of: current, onCall: CallActivity.isLive(botId: ref.botId))+ // A call with the bot keeps its activity up after the task.+ let working = bot.isWorking || state.call != nilTask.detached { await Self.apply(ref, state: state, end: !working) }}@@ -308,3 +334,15 @@ final class LiveActivities {}}}++private extension BotActivityAttributes.ContentState {+ /// The call this phone is on with the bot stays on the activity (the app sets it, the computer never does); one+ /// left by a call that's over (the app was closed mid-call) goes.+ func keepingCall(of activity: Activity<BotActivityAttributes>, onCall: Bool) -> Self {+ guard onCall else { return self }+ var state = self+ state.call = activity.content.state.call+ state.callStartedAt = activity.content.state.callStartedAt+ return state+ }+}diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swiftindex 7abe5c47..50e89188 100644--- a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift@@ -43,7 +43,7 @@ public extension BotActivityPresentation {/// The elapsed time counts up on its own (no push) while the task is live.func elapsedStart(_ startedAt: Date?) -> Date? {- phase == .working || phase == .needsInput ? startedAt : nil+ phase == .working || phase == .needsInput || call != nil ? startedAt : nil}}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swift b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swiftindex eac64e91..e7c9eafc 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swift@@ -10,11 +10,17 @@ public struct BotActivityAttributes: ActivityAttributes {/// Local app updates may show the current step; remote pushes leave it empty (§6.7).public var activity: Stringpublic var startedAt: Date?+ /// A voice call with the bot this phone is on: connecting | listening | speaking | paused. Set by the app only.+ public var call: String?+ /// When that call started, for its length.+ public var callStartedAt: Date?- public init(status: String, activity: String, startedAt: Date?) {+ public init(status: String, activity: String, startedAt: Date?, call: String? = nil, callStartedAt: Date? = nil) {self.status = statusself.activity = activityself.startedAt = startedAt+ self.call = call+ self.callStartedAt = callStartedAt}}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swift b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swiftindex 4ab00a0f..5bddf6d2 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivityPresentation.swift@@ -10,8 +10,10 @@ public struct BotActivityPresentation: Hashable, Sendable {public let phase: Phasepublic let activity: String+ /// The voice call with the bot this phone is on (`ContentState.call`), if any.+ public let call: String?- public init(status: String, activity: String, isStale: Bool = false) {+ public init(status: String, activity: String, isStale: Bool = false, call: String? = nil) {let phase: Phase = switch status {case "sending": .sendingcase "queued": .queued@@ -21,12 +23,27 @@ public struct BotActivityPresentation: Hashable, Sendable {case "error": .faileddefault: .waiting}- self.phase = isStale && (phase == .working || phase == .needsInput || phase == .sending) ? .stale : phase+ let shown = isStale && (phase == .working || phase == .needsInput || phase == .sending) ? .stale : phase+ // On a call, a bot that isn't working or waiting on you shows the call instead of "Done".+ self.phase = call != nil && [.completed, .stale, .waiting].contains(shown) ? .waiting : shownself.activity = activity+ self.call = call+ }++ /// The call's state in words, while this phone is on one with the bot.+ public var callTitle: String? {+ switch call {+ case "connecting": "Connecting the call"+ case "speaking": "On a call · Speaking"+ case "paused": "Call paused"+ case nil: nil+ default: "On a call · Listening"+ }}public var title: String {- switch phase {+ if phase == .waiting, let callTitle { return callTitle }+ return switch phase {case .sending: "Sending"case .queued: "Waiting for your computer"case .working: "Working"@@ -40,14 +57,16 @@ public struct BotActivityPresentation: Hashable, Sendable {/// The one line of text beside the orb: the bot's current step while it's live, else the state.public var caption: String {- switch phase {+ if phase == .waiting, let callTitle { return callTitle }+ return switch phase {case .working, .needsInput: activity.isEmpty ? title : activitycase .sending, .queued, .completed, .failed, .stale, .waiting: title}}public var symbol: String {- switch phase {+ if phase == .waiting, call != nil { return "waveform" }+ return switch phase {case .completed: "checkmark"case .failed: "exclamationmark.triangle.fill"case .queued: "desktopcomputer"diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.jsonindex f2aefc28..47c9d0e9 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json@@ -1210,5 +1210,9 @@"Open the call": "Anruf öffnen","Opens the call": "Öffnet den Anruf","Loading the call": "Anruf wird geladen",- "Couldn't load the call.": "Der Anruf konnte nicht geladen werden."+ "Couldn't load the call.": "Der Anruf konnte nicht geladen werden.",+ "Connecting the call": "Anruf wird verbunden",+ "On a call · Listening": "Im Anruf · Hört zu",+ "On a call · Speaking": "Im Anruf · Spricht",+ "Call paused": "Anruf pausiert"}diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.jsonindex e6e856ba..536db55b 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json@@ -1210,5 +1210,9 @@"Open the call": "Abrir la llamada","Opens the call": "Abre la llamada","Loading the call": "Cargando la llamada",- "Couldn't load the call.": "No se pudo cargar la llamada."+ "Couldn't load the call.": "No se pudo cargar la llamada.",+ "Connecting the call": "Conectando la llamada",+ "On a call · Listening": "En llamada · Escuchando",+ "On a call · Speaking": "En llamada · Hablando",+ "Call paused": "Llamada en pausa"}diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.jsonindex cfe0a52a..106b7fb0 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json@@ -1210,5 +1210,9 @@"Open the call": "Ouvrir l'appel","Opens the call": "Ouvre l'appel","Loading the call": "Chargement de l'appel",- "Couldn't load the call.": "Impossible de charger l'appel."+ "Couldn't load the call.": "Impossible de charger l'appel.",+ "Connecting the call": "Connexion de l’appel",+ "On a call · Listening": "En appel · À l’écoute",+ "On a call · Speaking": "En appel · Parle",+ "Call paused": "Appel en pause"}diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.jsonindex da3b78da..ff7d8a98 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json@@ -1210,5 +1210,9 @@"Open the call": "通話を開く","Opens the call": "通話を開きます","Loading the call": "通話を読み込んでいます",- "Couldn't load the call.": "通話を読み込めませんでした。"+ "Couldn't load the call.": "通話を読み込めませんでした。",+ "Connecting the call": "通話に接続中",+ "On a call · Listening": "通話中 · 聞いています",+ "On a call · Speaking": "通話中 · 話しています",+ "Call paused": "通話は一時停止中"}diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.jsonindex c46d4347..8ab59460 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json@@ -1210,5 +1210,9 @@"Open the call": "통화 열기","Opens the call": "통화를 엽니다","Loading the call": "통화를 불러오는 중",- "Couldn't load the call.": "통화를 불러올 수 없습니다."+ "Couldn't load the call.": "통화를 불러올 수 없습니다.",+ "Connecting the call": "통화 연결 중",+ "On a call · Listening": "통화 중 · 듣는 중",+ "On a call · Speaking": "통화 중 · 말하는 중",+ "Call paused": "통화 일시정지됨"}diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.jsonindex 609fad3c..9edeb82e 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json@@ -1210,5 +1210,9 @@"Open the call": "打开这通电话","Opens the call": "打开这通电话","Loading the call": "正在加载这通电话",- "Couldn't load the call.": "无法加载这通电话。"+ "Couldn't load the call.": "无法加载这通电话。",+ "Connecting the call": "正在连接通话",+ "On a call · Listening": "通话中 · 聆听",+ "On a call · Speaking": "通话中 · 说话",+ "Call paused": "通话已暂停"}diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.jsonindex 1760456d..92fc9b1e 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json@@ -1210,5 +1210,9 @@"Open the call": "打開這通電話","Opens the call": "打開這通電話","Loading the call": "正在載入這通電話",- "Couldn't load the call.": "無法載入這通電話。"+ "Couldn't load the call.": "無法載入這通電話。",+ "Connecting the call": "正在連接通話",+ "On a call · Listening": "通話中 · 聆聽",+ "On a call · Speaking": "通話中 · 說話",+ "Call paused": "通話已暫停"}diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/CallActivity.swift b/apps/ios/Kit/Sources/CodyncUI/Call/CallActivity.swiftnew file mode 100644index 00000000..addcc613--- /dev/null+++ b/apps/ios/Kit/Sources/CodyncUI/Call/CallActivity.swift@@ -0,0 +1,92 @@+import ActivityKit+import CodyncKit+import Foundation++/// The bot's Live Activity while this phone is on a call with it: the call's state and length, and the bot's latest+/// progress from the computer. Uses the bot's activity if one is up (a task it was given), else starts one for the call.+@MainActor+public final class CallActivity {+ /// Bots this phone is on a call with now: an activity's call fields outlive a killed app otherwise.+ private static var live: Set<String> = []++ /// Whether this phone is on a call with the bot (the activity's call fields are current).+ public static func isLive(botId: String) -> Bool { live.contains(botId) }++ private let attributes: BotActivityAttributes+ private let startedAt = Date.now+ /// The activity this call started itself (none was up), ended with the call.+ private var ownID: String?+ private var call: String?+ private var progress: String?++ init(bot: Bot, computerId: ComputerID, link: URL?) {+ attributes = BotActivityAttributes(bot: bot, computerId: computerId, link: link)+ Self.live.insert(bot.id)+ }++ /// `ContentState.call` for a phase: nil once the call can't go on.+ static func state(_ phase: VoicePhase) -> String? {+ switch phase {+ case .starting, .reconnecting: "connecting"+ case .listening: "listening"+ case .speaking: "speaking"+ case .interrupted: "paused"+ case .failed: nil+ }+ }++ func phase(_ phase: VoicePhase) {+ let state = Self.state(phase)+ guard state != call else { return }+ call = state+ show()+ }++ /// What the bot is doing, from the computer's progress cues.+ func progress(_ text: String) {+ progress = text+ show()+ }++ func end() {+ call = nil+ Self.live.remove(attributes.botId)+ let (botId, computerId, own) = (attributes.botId, attributes.computerId, ownID)+ Task.detached {+ guard let activity = Self.find(botId: botId, computerId: computerId) else { return }+ if activity.id == own {+ await activity.end(nil, dismissalPolicy: .immediate)+ } else {+ var state = activity.content.state+ state.call = nil+ state.callStartedAt = nil+ await activity.update(.init(state: state, staleDate: activity.content.staleDate))+ }+ }+ }++ private func show() {+ let (botId, computerId) = (attributes.botId, attributes.computerId)+ let (call, startedAt, progress) = (call, startedAt, progress)+ if Self.find(botId: botId, computerId: computerId) == nil {+ guard call != nil, UserDefaults.standard.object(forKey: "liveActivitiesEnabled") as? Bool ?? true,+ ActivityAuthorizationInfo().areActivitiesEnabled else { return }+ let state = BotActivityAttributes.ContentState(status: "idle", activity: progress ?? "", startedAt: nil,+ call: call, callStartedAt: startedAt)+ ownID = try? Activity.request(attributes: attributes, content: .init(state: state, staleDate: nil), pushType: nil).id+ return+ }+ Task.detached {+ guard let activity = Self.find(botId: botId, computerId: computerId) else { return }+ var state = activity.content.state+ state.call = call+ state.callStartedAt = startedAt+ if let progress { state.activity = progress }+ await activity.update(.init(state: state, staleDate: nil))+ }+ }++ private nonisolated static func find(botId: String, computerId: ComputerID) -> Activity<BotActivityAttributes>? {+ Activity<BotActivityAttributes>.activities.first { $0.attributes.botId == botId && $0.attributes.computerId == computerId }+ }+}diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/CallAudio.swift b/apps/ios/Kit/Sources/CodyncUI/Call/CallAudio.swiftindex f40820ea..a1f125bb 100644--- a/apps/ios/Kit/Sources/CodyncUI/Call/CallAudio.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Call/CallAudio.swift@@ -29,8 +29,27 @@ enum AudioInterruption {case ended(shouldResume: Bool)}-/// The audio session's events a call follows: interruptions, and `engine` reconfiguring (a route change such as-/// AirPods, voice processing settling), which stops it.+/// Who lets go of a call's audio session: the call's engine, or the system when it runs the call (CallKit activates the+/// session itself and deactivates it once the call ends; an engine deactivating it mid-call would cut the audio).+@MainActor+enum CallAudioSession {+ /// A CallKit call carries the audio (`SystemCall`).+ static var systemRuns = false++ /// After an engine stops: deactivates the session unless the system runs the call.+ static func release() {+ guard !systemRuns else { return }+ try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)+ }+}++extension Notification.Name {+ /// CallKit put the call on hold (`held` true: a phone call took over) or took it off hold.+ static let callHeld = Notification.Name("CodyncCallHeld")+}++/// The audio session's events a call follows: interruptions (also CallKit holding the call), and `engine`+/// reconfiguring (a route change such as AirPods, voice processing settling), which stops it.@MainActorfinal class AudioSessionEvents {private var observers: [any NSObjectProtocol] = []@@ -49,6 +68,10 @@ final class AudioSessionEvents {}}})+ observers.append(center.addObserver(forName: .callHeld, object: nil, queue: .main) { note in+ let held = note.userInfo?["held"] as? Bool == true+ MainActor.assumeIsolated { interrupted(held ? .began : .ended(shouldResume: true)) }+ })if let engine {observers.append(center.addObserver(forName: .AVAudioEngineConfigurationChange, object: engine, queue: .main) { _ inMainActor.assumeIsolated { reconfigured() }@@ -151,6 +174,6 @@ final class VoiceProcessingAudio: CallAudio {engine.stop()started = false}- try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)+ CallAudioSession.release()}}diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift b/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swiftindex 73c61a04..58fee6ab 100644--- a/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift@@ -28,6 +28,12 @@ struct CallView: View {@State private var reported = false/// Each engine's `voice_call_quality`.@State private var quality = CallQuality()+ /// The call as the system shows it (CallKit); nil where CallKit isn't offered (mainland China) or it refused.+ @State private var system: SystemCall?+ /// The bot's Live Activity showing the call.+ @State private var activity: CallActivity?+ /// The call view went away (before its engine may have started).+ @State private var closed = falseprivate var bot: Bot? { model.bots[botId] }private var call: String { callID.uuidString }@@ -53,9 +59,25 @@ struct CallView: View {.onAppear {startedAt = .nowlink = CallLink(model: model, botId: botId, call: call)- begin(cloud: VoiceSettings.provider)+ if let bot {+ let ref = BotReference(accountId: model.storage.accountID, computerId: model.computer.id, botId: botId)+ activity = CallActivity(bot: bot, computerId: model.computer.id, link: model.storage.botURL(ref))+ }+ Task {+ // The system runs the call where it may: the engine starts once its audio session is up.+ if await SystemCallPolicy.allowed(), !closed {+ let system = CallKitCalls.shared.start(id: callID, name: bot?.name ?? "Codync")+ system.onEnd = close+ system.onMute = { muted in session?.muted = muted }+ self.system = system+ await system.audioReady()+ }+ guard !closed else { return }+ begin(cloud: VoiceSettings.provider)+ }}.onDisappear {+ closed = truesession?.end()countCloudMinutes()isSpeaking = false@@ -63,9 +85,15 @@ struct CallView: View {model.endVoiceCall(callID)link?.end(seconds: Int(Date.now.timeIntervalSince(startedAt)))quality.report()+ // After the engine let go of the audio: CallKit deactivates the session as its call ends.+ system?.end()+ activity?.end()}.onChange(of: session?.phase) { _, phase in- if let phase { quality.phase(phase) }+ if let phase {+ quality.phase(phase)+ activity?.phase(phase)+ }isSpeaking = phase == .speakinginterrupt = phase == .speaking ? { session?.interrupt() } : nil// Counted once audio flows, so it names the engine the call ended up on.@@ -73,6 +101,7 @@ struct CallView: View {reported = trueAnalytics.shared.capture(.voiceCallStarted(session.analyticsName))model.callStarted(botId, call: call)+ system?.connected()}// A cloud engine that can't start or drops mid-call hands over to on-device voice.if case .failed(let message, _) = phase, let provider = session?.provider {@@ -126,7 +155,10 @@ struct CallView: View {(engine as? GeminiLiveEngine)?.onStall = { [quality] in quality.stalled() }engine.onActivityChanged = { [weak engine, model, callID] active inif active {- model.beginVoiceCall(callID, hear: { [weak engine] in engine?.hear($0) }, end: { [weak engine] in engine?.end() })+ model.beginVoiceCall(callID, hear: { [weak engine, activity] cue in+ engine?.hear(cue)+ if cue.kind == .progress { activity?.progress(cue.text) }+ }, end: { [weak engine] in engine?.end() })} else {model.endVoiceCall(callID)}@@ -181,7 +213,10 @@ struct CallView: View {}round("Call settings", "gearshape") { settings = true }let muted = session?.muted == true- round(muted ? "Unmute" : "Mute", muted ? "mic.slash" : "mic", on: muted) { session?.muted.toggle() }+ round(muted ? "Unmute" : "Mute", muted ? "mic.slash" : "mic", on: muted) {+ session?.muted.toggle()+ system?.setMuted(session?.muted == true)+ }Button(action: close) {Image(systemName: "xmark").font(.system(size: Self.iconSize, weight: .semibold))diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/CloudSpeechEngine.swift b/apps/ios/Kit/Sources/CodyncUI/Call/CloudSpeechEngine.swiftindex 95de42c6..6f87e96a 100644--- a/apps/ios/Kit/Sources/CodyncUI/Call/CloudSpeechEngine.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Call/CloudSpeechEngine.swift@@ -148,7 +148,7 @@ final class CloudSpeechEngine: VoiceEngine {engine.stop()audioRunning = false}- try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)+ CallAudioSession.release()}func interrupt() {diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/OnDeviceEngine.swift b/apps/ios/Kit/Sources/CodyncUI/Call/OnDeviceEngine.swiftindex 305f94b1..70dd4099 100644--- a/apps/ios/Kit/Sources/CodyncUI/Call/OnDeviceEngine.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Call/OnDeviceEngine.swift@@ -132,7 +132,7 @@ final class OnDeviceEngine: VoiceEngine {events = nilstopListening()synthesizer.stopSpeaking(at: .immediate)- try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)+ CallAudioSession.release()}/// Reads a reply aloud (the bot's final message), pausing the microphone meanwhile.diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/SystemCall.swift b/apps/ios/Kit/Sources/CodyncUI/Call/SystemCall.swiftnew file mode 100644index 00000000..b4ff820e--- /dev/null+++ b/apps/ios/Kit/Sources/CodyncUI/Call/SystemCall.swift@@ -0,0 +1,212 @@+import AVFoundation+import CallKit+import Foundation+import StoreKit+import os++private let log = Logger(subsystem: "com.pokai.Codync", category: "Call")++/// The call as the system shows it (CallKit): on the Lock Screen and in the Dynamic Island, ended or muted from there+/// or from AirPods, held by a phone call, with the audio session the system activates for it.+@MainActor+protocol SystemCall: AnyObject {+ /// The system ended the call (Lock Screen, Dynamic Island, AirPods, another call answered instead).+ var onEnd: (() -> Void)? { get set }+ /// The system muted or unmuted the call.+ var onMute: ((Bool) -> Void)? { get set }+ /// The call reached its voice.+ func connected()+ /// The app muted or unmuted the call.+ func setMuted(_ muted: Bool)+ /// The app hung up.+ func end()+ /// Returns once the system activated the call's audio session, or after a moment if it doesn't (the Simulator).+ func audioReady() async+}++/// Where CallKit may carry calls: not in apps offered in mainland China's App Store, which doesn't allow CallKit.+enum SystemCallPolicy {+ static func allowed(storefront: String?, region: String?) -> Bool {+ if let storefront { return storefront != "CHN" }+ return region != "CN"+ }++ static func allowed() async -> Bool {+ allowed(storefront: await Storefront.current?.countryCode, region: Locale.current.region?.identifier)+ }+}++/// The app's one CallKit provider; a call starts as an outgoing call to its bot.+@MainActor+final class CallKitCalls: NSObject {+ static let shared = CallKitCalls()++ private let provider: CXProvider+ private let controller = CXCallController()+ private var current: CallKitCall?++ private override init() {+ let config = CXProviderConfiguration()+ config.supportsVideo = false+ config.maximumCallGroups = 1+ config.maximumCallsPerCallGroup = 1+ config.supportedHandleTypes = [.generic]+ config.includesCallsInRecents = false+ provider = CXProvider(configuration: config)+ super.init()+ provider.setDelegate(self, queue: nil)+ }++ func start(id: UUID, name: String) -> SystemCall {+ current?.systemEnded()+ let call = CallKitCall(id: id, calls: self)+ current = call+ CallAudioSession.systemRuns = true+ let start = CXStartCallAction(call: id, handle: CXHandle(type: .generic, value: name))+ controller.request(CXTransaction(action: start)) { error in+ guard let error else { return }+ Task { @MainActor in+ // The call goes on without the system's (the Simulator, CallKit unavailable).+ log.info("CallKit didn't take the call: \(error.localizedDescription, privacy: .public)")+ call.declined()+ self.finished(call)+ }+ }+ return call+ }++ fileprivate func connected(_ call: CallKitCall) {+ provider.reportOutgoingCall(with: call.id, connectedAt: nil)+ }++ fileprivate func request(_ action: CXCallAction) {+ controller.request(CXTransaction(action: action)) { error in+ if let error { log.info("CallKit action failed: \(error.localizedDescription, privacy: .public)") }+ }+ }++ /// The call is over for CallKit (ended, or never taken): the engines manage the audio session again.+ fileprivate func finished(_ call: CallKitCall) {+ call.systemEnded()+ guard current === call else { return }+ current = nil+ CallAudioSession.systemRuns = false+ }+}++extension CallKitCalls: @preconcurrency CXProviderDelegate {+ /// CallKit dropped its calls (its daemon restarted, or it isn't available): the call goes on without the system's.+ func providerDidReset(_ provider: CXProvider) {+ guard let current else { return }+ current.declined()+ finished(current)+ }++ func provider(_ provider: CXProvider, perform action: CXStartCallAction) {+ // CallKit activates the session it finds configured.+ try? AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .voiceChat,+ options: [.defaultToSpeaker, .allowBluetoothHFP])+ provider.reportOutgoingCall(with: action.callUUID, startedConnectingAt: nil)+ action.fulfill()+ }++ func provider(_ provider: CXProvider, perform action: CXEndCallAction) {+ if let current, current.id == action.callUUID {+ // An end before the call ever got its audio or connected is CallKit dropping it (the Simulator ends+ // calls right after starting them): the call goes on without the system's.+ if !current.live {+ log.info("CallKit ended the call before it connected; going on without it")+ current.declined()+ }+ finished(current)+ }+ action.fulfill()+ }++ func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {+ if let current, current.id == action.callUUID { current.onMute?(action.isMuted) }+ action.fulfill()+ }++ func provider(_ provider: CXProvider, perform action: CXSetHeldCallAction) {+ NotificationCenter.default.post(name: .callHeld, object: nil, userInfo: ["held": action.isOnHold])+ action.fulfill()+ }++ func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {+ current?.audioActivated()+ }++ func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {}+}++@MainActor+final class CallKitCall: SystemCall {+ var onEnd: (() -> Void)?+ var onMute: ((Bool) -> Void)?+ let id: UUID+ private weak var calls: CallKitCalls?+ private var over = false+ /// The call got its audio session or connected: from here an end from the system is the user's.+ fileprivate private(set) var live = false+ private var audioActive = false+ private var waiting: [CheckedContinuation<Void, Never>] = []++ fileprivate init(id: UUID, calls: CallKitCalls) {+ self.id = id+ self.calls = calls+ }++ func connected() {+ guard !over else { return }+ live = true+ calls?.connected(self)+ }++ func setMuted(_ muted: Bool) {+ guard !over else { return }+ calls?.request(CXSetMutedCallAction(call: id, muted: muted))+ }++ func end() {+ guard !over else { return }+ over = true+ calls?.request(CXEndCallAction(call: id))+ resumeWaiting()+ }++ func audioReady() async {+ guard !audioActive, !over else { return }+ Task { [weak self] in+ try? await Task.sleep(for: .seconds(1.5))+ self?.resumeWaiting()+ }+ await withCheckedContinuation { waiting.append($0) }+ }++ fileprivate func audioActivated() {+ audioActive = true+ live = true+ resumeWaiting()+ }++ /// CallKit refused the call: it goes on without the system's.+ fileprivate func declined() {+ over = true+ resumeWaiting()+ }++ /// CallKit ended the call; the app hangs up too unless it started the ending.+ fileprivate func systemEnded() {+ resumeWaiting()+ guard !over else { return }+ over = true+ onEnd?()+ }++ private func resumeWaiting() {+ let continuations = waiting+ waiting = []+ for continuation in continuations { continuation.resume() }+ }+}diff --git a/apps/ios/Kit/Tests/CodyncKitTests/ActivityPresentationTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/ActivityPresentationTests.swiftindex 04eaf642..f91383db 100644--- a/apps/ios/Kit/Tests/CodyncKitTests/ActivityPresentationTests.swift+++ b/apps/ios/Kit/Tests/CodyncKitTests/ActivityPresentationTests.swift@@ -39,3 +39,15 @@ import Testing// A deleted pick falls back to automatic.#expect(BotsTeamCard.slots(bots: bots, picks: ["gone"]).first??.id == "preview-review")}++@Test func aCallShowsOnTheActivityInsteadOfDone() {+ let idle = BotActivityPresentation(status: "idle", activity: "Old step", call: "listening")+ #expect(idle.phase == .waiting)+ #expect(idle.caption == "On a call · Listening")+ #expect(idle.symbol == "waveform")+ #expect(BotActivityPresentation(status: "idle", activity: "", call: "connecting").caption == "Connecting the call")+ // While the bot works, its progress is the line; a waiting approval stays visible.+ #expect(BotActivityPresentation(status: "working", activity: "Running the tests", call: "speaking").caption == "Running the tests")+ #expect(BotActivityPresentation(status: "needsInput", activity: "Choose", call: "listening").phase == .needsInput)+ #expect(BotActivityPresentation(status: "idle", activity: "").title == "Done")+}diff --git a/apps/ios/Kit/Tests/CodyncUITests/SystemCallTests.swift b/apps/ios/Kit/Tests/CodyncUITests/SystemCallTests.swiftnew file mode 100644index 00000000..07ef27f3--- /dev/null+++ b/apps/ios/Kit/Tests/CodyncUITests/SystemCallTests.swift@@ -0,0 +1,21 @@+import Foundation+import Testing+@testable import CodyncUI++@Test func callKitStaysOffWhereTheAppStoreIsMainlandChinas() {+ #expect(!SystemCallPolicy.allowed(storefront: "CHN", region: "US"))+ #expect(SystemCallPolicy.allowed(storefront: "TWN", region: "CN"))+ // Without a storefront (no App Store account), the region decides.+ #expect(!SystemCallPolicy.allowed(storefront: nil, region: "CN"))+ #expect(SystemCallPolicy.allowed(storefront: nil, region: "HK"))+ #expect(SystemCallPolicy.allowed(storefront: nil, region: nil))+}++@MainActor @Test func theLiveActivityFollowsTheCallsPhase() {+ #expect(CallActivity.state(.starting) == "connecting")+ #expect(CallActivity.state(.reconnecting) == "connecting")+ #expect(CallActivity.state(.listening) == "listening")+ #expect(CallActivity.state(.speaking) == "speaking")+ #expect(CallActivity.state(.interrupted) == "paused")+ #expect(CallActivity.state(.failed("x", .connection)) == nil)+}diff --git a/apps/ios/Resources/Info.plist b/apps/ios/Resources/Info.plistindex f80677a8..98e9974c 100644--- a/apps/ios/Resources/Info.plist+++ b/apps/ios/Resources/Info.plist@@ -33,6 +33,7 @@<key>UIBackgroundModes</key><array><string>audio</string>+ <string>voip</string></array><key>NSAppTransportSecurity</key><dict>diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.mdindex cabd89f8..41a65bed 100644--- a/apps/ios/WhatsNew.md+++ b/apps/ios/WhatsNew.md@@ -12,11 +12,13 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o- Bot 工作時,Gemini 與 OpenAI 的語音會主動告訴你它在做什麼、有沒有等你核准或遇到問題,做完就念出結果。- 通話中短暫斷線再連上時,錯過的回覆會補念給你聽。- Gemini 或 OpenAI 通話斷線時會自動重新連上並接著聊,不必重打;來電、Siri 或其他 App 佔用聲音時通話會暫停,結束後自動繼續,也可以點一下通話列下方繼續。+- 語音通話像一般電話一樣出現在鎖定畫面和動態島,可以從那裡或 AirPods 靜音、掛斷;來電時通話先保留,掛斷後接著聊。Bot 的即時動態也會顯示通話狀態和它正在做的事。### en-US- While the bot works, the Gemini and OpenAI voice keeps you posted on what it's doing, tells you when an approval waits or something fails, and reads the result when it's done.- A reply that arrives while a call briefly loses its connection is read once it's back.- A Gemini or OpenAI call that loses its connection reconnects and carries on without hanging up; a phone call, Siri or another app's audio pauses the call, which picks up again when it ends, or with a tap under the call bar.+- Calls show like phone calls on the Lock Screen and in the Dynamic Island: mute or end them there or with AirPods, and a phone call holds them until you're back. The bot's Live Activity shows the call and what the bot is doing.## 2.25.0diff --git a/apps/ios/Widgets/CodyncWidgets.swift b/apps/ios/Widgets/CodyncWidgets.swiftindex 9e41d264..3ca8e19d 100644--- a/apps/ios/Widgets/CodyncWidgets.swift+++ b/apps/ios/Widgets/CodyncWidgets.swift@@ -598,7 +598,7 @@ struct BotLiveActivity: Widget {ActivityConfiguration(for: BotActivityAttributes.self) { context inlet state = presentation(context)BotActivityCard(name: context.attributes.name, state: state,- startedAt: context.state.startedAt, link: context.attributes.link) {+ startedAt: since(context), link: context.attributes.link) {avatar(context, state: state, size: 32)} mark: {indicator(context, state: state, size: 28)@@ -628,7 +628,7 @@ struct BotLiveActivity: Widget {.animation(Motion.activityPhase, value: state)}DynamicIslandExpandedRegion(.bottom) {- ActivityIslandFooter(state: state, startedAt: context.state.startedAt, link: context.attributes.link)+ ActivityIslandFooter(state: state, startedAt: since(context), link: context.attributes.link).padding(.horizontal, 4)}} compactLeading: {@@ -645,7 +645,12 @@ struct BotLiveActivity: Widget {}private func presentation(_ context: ActivityViewContext<BotActivityAttributes>) -> BotActivityPresentation {- .init(status: context.state.status, activity: context.state.activity, isStale: context.isStale)+ .init(status: context.state.status, activity: context.state.activity, isStale: context.isStale, call: context.state.call)+ }++ /// The time shown: the call's length while this phone is on a call with the bot, else how long it has worked.+ private func since(_ context: ActivityViewContext<BotActivityAttributes>) -> Date? {+ context.state.call == nil ? context.state.startedAt : context.state.callStartedAt}/// While the bot works, the orb keeps orbiting (in step with the face); otherwise it holdsdiff --git a/docs/architecture/file-structure.md b/docs/architecture/file-structure.mdindex 59bdb751..4cc988a2 100644--- a/docs/architecture/file-structure.md+++ b/docs/architecture/file-structure.md@@ -91,7 +91,7 @@ Codync/| Agent process, ACP, queue and session lifecycle | `host/src/agent/bot/` (`launch.rs`, `queue.rs`, `session.rs`, `turn.rs`, `updates.rs`), `acp.rs` || Compaction timing and rollover | `host/src/agent/bot/compaction.rs`, the handoff card in `host/src/chat/handoff.rs`; the rules in `codync-mem`'s `compaction.rs` || Group room turns / bot-to-bot requests | `host/src/chat/group.rs` / `team.rs` |-| Voice calls (the call, the voice's instructions and tools, transcripts, call lines) | `host/src/chat/calls/` (`mod.rs`, `context.rs`, `project.rs` the git state, `tools.rs`, `announce.rs` what the voice hears while the call lasts, `speech.rs` text as a voice says it); the user's messages it relays go through `host/src/chat/messages.rs` like typed ones; clients' `CallLink` (iPhone `CodyncUI/Call/CallLink.swift`, desktop `views/call/call-link.ts`, Android `core/Calls.kt` + `HostCallLink.kt`) and call rows (`CallRows`) |+| Voice calls (the call, the voice's instructions and tools, transcripts, call lines) | `host/src/chat/calls/` (`mod.rs`, `context.rs`, `project.rs` the git state, `tools.rs`, `announce.rs` what the voice hears while the call lasts, `speech.rs` text as a voice says it); the user's messages it relays go through `host/src/chat/messages.rs` like typed ones; clients' `CallLink` (iPhone `CodyncUI/Call/CallLink.swift`, desktop `views/call/call-link.ts`, Android `core/Calls.kt` + `HostCallLink.kt`) and call rows (`CallRows`); the system's call on the iPhone (`CodyncUI/Call/SystemCall.swift` CallKit, `CallActivity.swift` the Live Activity) and Android's call notification (`VoiceService.kt`) || Team management (bots creating and changing bots) | `host/src/chat/manage.rs`, its approval card (`Cmd::Approve`) in `agent/bot/updates.rs` || Prompt snapshots and memory | `host/src/chat/context.rs`, `memory/` (`api.rs` the apps' read-only view, `tools.rs` and `file_tools.rs` the MCP tools, `files.rs` the folders and scan, `turns.rs` which bot's turn a found change is credited to, `file_api.rs`, `dream.rs`, `import.rs`); the rules in `host/crates/memory` (`codync-mem`: files and facts in `files/`, dreaming in `dream/`, tombstones in `store.rs`, the old entries in `legacy.rs`); harnesses' own memory turned off in `host/src/agent/own_memory.rs` || Identity, encryption and direct channel | `host/src/remote/identity.rs`, `crypto.rs`, `channel.rs` |diff --git a/docs/design/push-and-live-activity.md b/docs/design/push-and-live-activity.mdindex 2953a42f..74723a32 100644--- a/docs/design/push-and-live-activity.md+++ b/docs/design/push-and-live-activity.md@@ -40,7 +40,7 @@ flowchart LR- The extension then turns the alert into a communication notification (`INSendMessageIntent`) so the banner shows the bot's avatar instead of the app icon. A group alert carries the speaking member (`from`, sealed with the text) and shows as a group conversation: the group's avatar and name, with the member as sender. The sealed alert carries `faces` (name, shape and color of the chat, its first two members and the speaker), so a bot created while the app was closed still gets its avatar; alerts from an older host fall back to the widget snapshot in the App Group, and a bot in neither keeps the plain banner. Needs the app's Communication Notifications entitlement and `NSUserActivityTypes: INSendMessageIntent`. [Apple communication notifications](https://developer.apple.com/documentation/usernotifications/implementing-communication-notifications)- ActivityKit renders both Lock Screen and Dynamic Island. A separate Dynamic Island Worker or event API is unnecessary. APNs updates use a dedicated activity token, not the normal notification token. [Apple ActivityKit push updates](https://developer.apple.com/documentation/ActivityKit/starting-and-updating-live-activities-with-activitykit-push-notifications)-Remote activity content contains only `status`, empty `activity`, and `startedAt`. Foreground app updates may show the current step from the encrypted connection; a remote update clears that free text. The notification service extension is not an ActivityKit decryption stage. The UI therefore does not promise private task summaries in background Live Activities. Bot identity and its deep link are set locally when starting the activity.+Remote activity content contains only `status`, empty `activity`, and `startedAt`. During a voice call the app also sets `call` and `callStartedAt` locally ([the call on the system](../features/voice-call.md#the-call-on-the-system)); the computer never sends them. Foreground app updates may show the current step from the encrypted connection; a remote update clears that free text. The notification service extension is not an ActivityKit decryption stage. The UI therefore does not promise private task summaries in background Live Activities. Bot identity and its deep link are set locally when starting the activity.## Registration and lifecyclediff --git a/docs/features/voice-call.md b/docs/features/voice-call.mdindex 2fbb56fd..8359f968 100644--- a/docs/features/voice-call.md+++ b/docs/features/voice-call.md@@ -366,6 +366,24 @@ carries audio and talks to these methods:`CallRecoveryTests`, desktop `call-recovery.test.ts`, Android `VoiceEnginesTest` (Gemini over MockWebServer, OpenAIover a fake peer).+### The call on the system++- iPhone: a call is a CallKit outgoing call to the bot (`SystemCall.swift`, one `CXProvider`, audio only, not in+ Recents): it shows on the Lock Screen and in the Dynamic Island, ends or mutes from there and from AirPods, and a+ phone call holds it (`CXSetHeldCallAction` pauses the engine the way an interruption does, and taking it off hold+ resumes). CallKit activates the audio session: the engine starts once it has (at most 1.5 s later where it never+ does, as on the Simulator), and the engines leave deactivating it to CallKit (`CallAudioSession`). The call reports+ connected once the engine reaches ready. Where CallKit refuses the call, it goes on without it.+- CallKit isn't allowed in apps offered in mainland China's App Store: with the storefront `CHN` (or, without a+ storefront, the region `CN`) the call keeps the app's own audio session, as before (`SystemCallPolicy`).+- iPhone Live Activity: while a call is on, the bot's activity shows it (`ContentState.call`: connecting, listening,+ speaking, paused; `callStartedAt` for its length) and the bot's latest progress line from the computer+ (`CallActivity`). It uses the bot's activity if one is up and starts one for the call otherwise (ended with the+ call). The computer never sets these fields; the app's own updates keep them.+- Android: the call's foreground notification shows its state and the bot's latest progress line (cleared by its+ reply), updated in place at most once a second, with Mute and End call.+- The desktop and the terminal have no system call UI to join.+### Failure and cost- No key on the computer, invalid key, quota or network failure at start, a dropped connection that three triesdiff --git a/docs/plans/voice-architecture.md b/docs/plans/voice-architecture.mdindex dcc470c5..52037c30 100644--- a/docs/plans/voice-architecture.md+++ b/docs/plans/voice-architecture.md@@ -1,6 +1,6 @@# Voice calls owned by the host-Status: stage 1 shipped (2.25.0), stage 2 (2.26.0); stages 3–4 planned. Supersedes [voice call transcripts](voice-call-transcripts.md),+Status: all four stages shipped (stage 1 in 2.25.0, stages 2–4 in 2.26.0). Supersedes [voice call transcripts](voice-call-transcripts.md),which became stage 1 of this plan. Current behavior: [voice call](../features/voice-call.md#the-call-on-the-host).A realtime voice model (Gemini Live, OpenAI Realtime) stays in front of the bot: coding agents are text-only and@@ -78,6 +78,10 @@ replayed end to end in the iPhone and desktop tests (its events are).### 4. Platform+Shipped in 2.26.0 ([the call on the system](../features/voice-call.md#the-call-on-the-system)). CallKit stays off where+the App Store storefront is mainland China's. OpenAI's WebRTC audio isn't handed to CallKit's session activation+(`useManualAudio`); it still activates the session itself.+- iPhone: CallKit for the call (lock screen, Dynamic Island, AirPods controls, interruptions handled by the system),and the bot's progress in the call's Live Activity.- Android: the call's foreground notification shows the same progress.diff --git a/web/content/docs/voice.mdx b/web/content/docs/voice.mdxindex a2e6cbf9..1e50b6ed 100644--- a/web/content/docs/voice.mdx+++ b/web/content/docs/voice.mdx@@ -24,7 +24,9 @@ What you say on a call, and the bot's replies during it, don't fill up the chat.The bot remembers what matters from the call like from any conversation: its memory picks up what you said, not the voice's wording.-On the iPhone, the first call asks for Microphone and Speech Recognition access. The call keeps going if you leave Codync for the Home Screen.+On the iPhone, the first call asks for Microphone and Speech Recognition access. The call keeps going if you leave Codync for the Home Screen. It shows like a phone call: on the Lock Screen and in the Dynamic Island, where you can mute or end it (AirPods controls work too), and a real phone call puts it on hold until you're back. Calls with bots don't appear in the Phone app's Recents. Where the App Store is mainland China's, calls stay inside Codync (Apple doesn't allow this there). The bot's Live Activity shows the call and what the bot is doing while you talk.++On Android, the call's notification shows the same: the call's state and what the bot is working on, with Mute and End call.### From Shortcuts (iPhone)