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): mute or end a call from its Live Activity
leepokai1c6526b98dea
diff --git a/apps/Codync.xcodeproj/project.pbxproj b/apps/Codync.xcodeproj/project.pbxprojindex 05cbfa76..c3ff4f8b 100644--- a/apps/Codync.xcodeproj/project.pbxproj+++ b/apps/Codync.xcodeproj/project.pbxproj@@ -57,10 +57,12 @@A1B7C7774E7FAF6D45D1BEF8 /* Permissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FA78A055791BBBA79DF8C8B /* Permissions.swift */; };AA601649E43A5AF73DCF5B5E /* WebRTC in Frameworks */ = {isa = PBXBuildFile; productRef = 2D9748E611692583AFC5A152 /* WebRTC */; };ABE57DA1C72A08A22262AAB1 /* CodyncOrb-Ghost.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E783FFF5EC2697C16FA2E1B /* CodyncOrb-Ghost.ttf */; };+ AF04355DFF3452C3ED0CA641 /* CallControlIntents.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1162D95B42A1BF2EB5EC0E9 /* CallControlIntents.swift */; };B09F6D6EDC6C6B0B9919D6BF /* CodyncBot-blob-Ink.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C484135603CEF437C27BE67B /* CodyncBot-blob-Ink.ttf */; };B1815C13D0D78E99415C2DC2 /* CodyncBot-cloud-Ink.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5A21538E748C62E82DF7B139 /* CodyncBot-cloud-Ink.ttf */; };B3450CFD87D4096B3BCA7885 /* CodyncBot-wedge-Ink.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C6B96EE690FC5355C9E3D1B5 /* CodyncBot-wedge-Ink.ttf */; };B3554D38F39916698E961A37 /* WidgetGalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B22589689593E0089118FDB /* WidgetGalleryView.swift */; };+ B6ECB0743C67903DA1956B29 /* CallControlIntents.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1162D95B42A1BF2EB5EC0E9 /* CallControlIntents.swift */; };BA978F06CB1E58511FFB541B /* WidgetSetupDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D8961FADA8810B6CC479705 /* WidgetSetupDemo.swift */; };BCB60463C96AF5725EC4A2C7 /* CodyncBot-hex-Tint.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D827E43025A592B41CB68EFD /* CodyncBot-hex-Tint.ttf */; };BF77DD7946621D8818EDAB9B /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A87B0091DAF0E4807D62017 /* SettingsView.swift */; };@@ -69,6 +71,7 @@E695251CFD06AC6F4E3396B7 /* OpenBotIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4EB0DBA2F08CD7C0E25E30 /* OpenBotIntent.swift */; };E78E3B5FAFEB79F31AAC104D /* CodyncBot-teardrop-Tint.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C8F46BD8301E7E2C83C35111 /* CodyncBot-teardrop-Tint.ttf */; };EBB0417A5FB2CE6D514D21BE /* ClerkKit in Frameworks */ = {isa = PBXBuildFile; productRef = D9AB2F442A5F243653EAE936 /* ClerkKit */; };+ ECE1339FED40D7D5D8806608 /* CallLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5B2717A8DFD43DC6DAA9D8C /* CallLiveActivity.swift */; };F171F16563D1FF6308697173 /* CodyncUI in Frameworks */ = {isa = PBXBuildFile; productRef = 06C9F37C6502131CAF0F145E /* CodyncUI */; };F6A380E8A026CA849620F2F7 /* Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D16AD9979C77D976BC832D1 /* Driver.swift */; };F842AE1C5ED96AF9A7F5D16C /* Widgets.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 6D734BEE7CD3F84677B0218B /* Widgets.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };@@ -173,8 +176,10 @@DD3DE9A4EEB369C4F75C9448 /* ActivityGalleryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityGalleryView.swift; sourceTree = "<group>"; };E3BF4D3B82FE8274F610C703 /* Push.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Push.swift; sourceTree = "<group>"; };ECD0B4EA4BBA2BB2826C4362 /* PairingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairingView.swift; sourceTree = "<group>"; };+ F1162D95B42A1BF2EB5EC0E9 /* CallControlIntents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallControlIntents.swift; sourceTree = "<group>"; };F21AEC12DC761C28A997BEF3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };F4375A206703EC65F0D15BD6 /* CodyncBot-pebble-Ink.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "CodyncBot-pebble-Ink.ttf"; sourceTree = "<group>"; };+ F5B2717A8DFD43DC6DAA9D8C /* CallLiveActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallLiveActivity.swift; sourceTree = "<group>"; };F6932F782C1B87C9608359A6 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };F7CAD5C4F330637102B40288 /* CodyncBot-tablet-Tint.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "CodyncBot-tablet-Tint.ttf"; sourceTree = "<group>"; };F99C11684BFBEB49006600A9 /* Session.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Session.swift; sourceTree = "<group>"; };@@ -280,6 +285,8 @@5756AB2A238F70069A04CA65 /* Widgets */ = {isa = PBXGroup;children = (+ F1162D95B42A1BF2EB5EC0E9 /* CallControlIntents.swift */,+ F5B2717A8DFD43DC6DAA9D8C /* CallLiveActivity.swift */,FAB9BDB52C3A9F7B2568A750 /* CodyncWidgets.swift */,5C4EB0DBA2F08CD7C0E25E30 /* OpenBotIntent.swift */,305DDCC18BB8AA6CD9D19CEF /* WidgetPreviews.swift */,@@ -645,6 +652,8 @@isa = PBXSourcesBuildPhase;buildActionMask = 2147483647;files = (+ B6ECB0743C67903DA1956B29 /* CallControlIntents.swift in Sources */,+ ECE1339FED40D7D5D8806608 /* CallLiveActivity.swift in Sources */,2CDF3DF16A13DAF83CA42168 /* CodyncWidgets.swift in Sources */,5C9AE497DA83EB32AEC9057C /* OpenBotIntent.swift in Sources */,3BCC04815E5CA8953E0DDCAD /* WidgetPreviews.swift in Sources */,@@ -679,6 +688,7 @@16C24A622E33414C24B0C148 /* AppearanceSettings.swift in Sources */,01A1F820EFEE49A8FCCFC3F3 /* BotListView.swift in Sources */,E0D116BF893B81AEC0D2135A /* BotShortcuts.swift in Sources */,+ AF04355DFF3452C3ED0CA641 /* CallControlIntents.swift in Sources */,7C20764DC05D499075BC5E8C /* CodyncApp.swift in Sources */,2002C16E427B4E4E7279E1C4 /* ComputerStatus.swift in Sources */,5A56EF5D36D12ACCEA100642 /* LanguageSettings.swift in Sources */,diff --git a/apps/android/WhatsNew.md b/apps/android/WhatsNew.mdindex 7ac654cc..a3a95da2 100644--- a/apps/android/WhatsNew.md+++ b/apps/android/WhatsNew.md@@ -13,14 +13,14 @@ else a generic "Bug fixes and improvements" line. Delete old sections.- Bot 工作時,Gemini 與 OpenAI 的語音會主動告訴你它在做什麼、有沒有等你核准或遇到問題,做完就念出結果。- 通話中短暫斷線再連上時,錯過的回覆會補念給你聽。- Gemini 或 OpenAI 通話斷線時會自動重新連上並接著聊,不必重打。-- 通話的通知會顯示通話狀態和 Bot 正在做的事。+- 通話的通知會顯示通話時長、狀態和 Bot 正在做的事。- Gemini 與 OpenAI 的語音用你正在說的語言回答,你換語言它就跟著換。### 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.+- The call's notification shows its length, state and what the bot is doing.- The Gemini and OpenAI voice answers in the language you speak and follows when you switch.## 2.25.0diff --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 88877909..9cbacb47 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@@ -133,6 +133,9 @@ class VoiceService : Service() {.setContentTitle("Voice chat · ${bot?.name ?: "Codync"}").setContentText(callNotificationText(state, progress)).setStyle(NotificationCompat.BigTextStyle().bigText(callNotificationText(state, progress, "\n")))+ // The call's length counts up beside the bot's name.+ .setUsesChronometer(true).setShowWhen(true)+ .setWhen(callStartedWallClock(session?.startedAt, SystemClock.elapsedRealtime(), System.currentTimeMillis())).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,6 +204,10 @@ class VoiceService : Service() {}}+/** When the call started on the wall clock, for the notification's chronometer; `startedAt` is on `elapsedRealtime`. */+internal fun callStartedWallClock(startedAt: Long?, nowElapsed: Long, nowWall: Long): Long =+ nowWall - (nowElapsed - (startedAt ?: nowElapsed)).coerceAtLeast(0)+/** 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) {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.ktindex e1d4f815..cc892204 100644--- a/apps/android/app/src/test/kotlin/com/codync/android/CallNotificationTest.kt+++ b/apps/android/app/src/test/kotlin/com/codync/android/CallNotificationTest.kt@@ -16,4 +16,9 @@ class CallNotificationTest {assertEquals("Microphone muted", callNotificationText(listening.copy(muted = true), " "))assertEquals("Reconnecting…", callNotificationText(VoiceState(phase = VoicePhase.Reconnecting), null))}++ @Test fun theChronometerCountsFromTheCallsStart() {+ assertEquals(1_000_000L - 43_000L, callStartedWallClock(startedAt = 7_000, nowElapsed = 50_000, nowWall = 1_000_000))+ assertEquals(1_000_000L, callStartedWallClock(startedAt = null, nowElapsed = 50_000, nowWall = 1_000_000))+ }}diff --git a/apps/ios/App/CodyncApp.swift b/apps/ios/App/CodyncApp.swiftindex 8f563559..43b1337e 100644--- a/apps/ios/App/CodyncApp.swift+++ b/apps/ios/App/CodyncApp.swift@@ -20,6 +20,8 @@ struct CodyncApp: App {init() {// A tapped widget bot arrives as an intent, not a URL.OpenBotIntent.open = { AppStore.shared.open($0) }+ MuteCallIntent.run = { CallActivity.toggleMute(botId: $0) }+ EndCallIntent.run = { CallActivity.hangUp(botId: $0) }}var body: some Scene {diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swift b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swiftindex be48ade4..ca5aac15 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/BotActivity.swift@@ -37,13 +37,17 @@ public struct BotActivityAttributes: ActivityAttributes {public var call: CallState?/// When that call started, for its length.public var callStartedAt: Date?+ /// That call's microphone is muted (its Live Activity's mute button).+ public var callMuted: Bool?- public init(status: String, activity: String, startedAt: Date?, call: CallState? = nil, callStartedAt: Date? = nil) {+ public init(status: String, activity: String, startedAt: Date?, call: CallState? = nil, callStartedAt: Date? = nil,+ callMuted: Bool? = nil) {self.status = statusself.activity = activityself.startedAt = startedAtself.call = callself.callStartedAt = callStartedAt+ self.callMuted = callMuted}}diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/CallActivity.swift b/apps/ios/Kit/Sources/CodyncUI/Call/CallActivity.swiftindex 85a56163..2ffc149a 100644--- a/apps/ios/Kit/Sources/CodyncUI/Call/CallActivity.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Call/CallActivity.swift@@ -23,14 +23,27 @@ public final class CallActivity {private var call: CallState?/// The computer's latest progress line, until the bot's reply.private var progress: String?+ private var muted = false+ /// The call's own mute and hang-up, which the activity's buttons press (`MuteCallIntent`, `EndCallIntent`).+ private let toggleMute: @MainActor () -> Void+ private let hangUp: @MainActor () -> Void/// The activity followed for the computer's updates, and the tasks following it.private var followed: (id: String, tasks: [Task<Void, Never>])?- init(bot: Bot, computerId: ComputerID, link: URL?) {+ init(bot: Bot, computerId: ComputerID, link: URL?, toggleMute: @escaping @MainActor () -> Void = {},+ hangUp: @escaping @MainActor () -> Void = {}) {attributes = BotActivityAttributes(bot: bot, computerId: computerId, link: link)+ self.toggleMute = toggleMute+ self.hangUp = hangUpSelf.calls[bot.id] = self}+ /// The activity's mute button: the call's microphone goes off or back on, as with the call bar's.+ public static func toggleMute(botId: String) { calls[botId]?.toggleMute() }++ /// The activity's end button: the call ends as with the call bar's.+ public static func hangUp(botId: String) { calls[botId]?.hangUp() }+/// Whether this phone is on a call with the bot.public static func isLive(botId: String) -> Bool { calls[botId] != nil }@@ -42,7 +55,7 @@ public final class CallActivity {/// `state` with the fields of the call this phone is on with the bot, or with none.public static func withCall(_ state: State, botId: String) -> State {let live = calls[botId]- return merge(state, call: live?.call, since: live?.startedAt)+ return merge(state, call: live?.call, since: live?.startedAt, muted: live?.muted == true)}/// `ContentState.call` for a phase: nil once the call can't go on.@@ -63,6 +76,13 @@ public final class CallActivity {show()}+ /// The call's microphone went off or on (its call bar or the activity's button).+ func muted(_ on: Bool) {+ guard on != muted else { return }+ muted = on+ show()+ }+/// What the computer said on the call: its progress shows until the bot's reply.func heard(_ cue: CallCue) {switch cue.kind {@@ -99,10 +119,11 @@ public final class CallActivity {}}- nonisolated static func merge(_ state: State, call: CallState?, since: Date?) -> State {+ nonisolated static func merge(_ state: State, call: CallState?, since: Date?, muted: Bool = false) -> State {var state = statestate.call = callstate.callStartedAt = call == nil ? nil : since+ state.callMuted = call == nil || !muted ? nil : truereturn state}@@ -112,10 +133,10 @@ public final class CallActivity {guard Self.calls[botId] === self else { return }guard let shown = BotActivityAttributes.shown(botId: botId, computerId: computerId) else { return start() }follow(shown)- let (call, startedAt) = (call, startedAt)+ let (call, startedAt, muted) = (call, startedAt, muted)Task.detached {guard let activity = BotActivityAttributes.shown(botId: botId, computerId: computerId) else { return }- var state = Self.merge(activity.content.state, call: call, since: startedAt)+ var state = Self.merge(activity.content.state, call: call, since: startedAt, muted: muted)if let text { state.activity = text }guard state != activity.content.state else { return }await activity.update(.init(state: state, staleDate: activity.content.staleDate))@@ -124,7 +145,8 @@ public final class CallActivity {private func start() {guard call != nil, BotActivityAttributes.mayStart else { return }- let state = Self.merge(.init(status: "idle", activity: progress ?? "", startedAt: nil), call: call, since: startedAt)+ let state = Self.merge(.init(status: "idle", activity: progress ?? "", startedAt: nil), call: call, since: startedAt,+ muted: muted)do {let activity = try Activity.request(attributes: attributes, content: .init(state: state, staleDate: nil), pushType: nil)ownID = activity.iddiff --git a/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift b/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swiftindex f751eac5..498eac01 100644--- a/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift@@ -57,7 +57,8 @@ struct CallView: View {link = CallLink(model: model, botId: botId, call: call)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))+ activity = CallActivity(bot: bot, computerId: model.computer.id, link: model.storage.botURL(ref),+ toggleMute: { session?.muted.toggle() }, hangUp: { close() })}begin(cloud: VoiceSettings.provider)}@@ -91,6 +92,7 @@ struct CallView: View {begin(cloud: nil)}}+ .onChange(of: session?.muted) { _, muted in activity?.muted(muted == true) }.onChange(of: settings) { _, open in if !open { switchEngine() } }.codyncSheet(isPresented: $settings) { VoiceChatSettingsView() }}diff --git a/apps/ios/Kit/Tests/CodyncUITests/CallActivityTests.swift b/apps/ios/Kit/Tests/CodyncUITests/CallActivityTests.swiftindex ae1ac7f1..b31077a4 100644--- a/apps/ios/Kit/Tests/CodyncUITests/CallActivityTests.swift+++ b/apps/ios/Kit/Tests/CodyncUITests/CallActivityTests.swift@@ -34,3 +34,25 @@ import Testing#expect(!CallActivity.isLive(botId: bot.id))#expect(CallActivity.withCall(leftover, botId: bot.id) == pushed)}++@MainActor @Test func theActivitysButtonsReachTheCallAndShowItsMute() throws {+ var bot = try #require(Bot.widgetPreview.first)+ bot.id = "call-activity-buttons"+ var mutes = 0, hangUps = 0+ let call = CallActivity(bot: bot, computerId: "computer", link: nil, toggleMute: { mutes += 1 }, hangUp: { hangUps += 1 })+ call.phase(.listening)+ CallActivity.toggleMute(botId: bot.id)+ CallActivity.hangUp(botId: bot.id)+ CallActivity.toggleMute(botId: "another-bot")+ #expect(mutes == 1 && hangUps == 1)++ let pushed = BotActivityAttributes.ContentState(status: "idle", activity: "", startedAt: nil)+ #expect(CallActivity.withCall(pushed, botId: bot.id).callMuted == nil)+ call.muted(true)+ #expect(CallActivity.withCall(pushed, botId: bot.id).callMuted == true)+ call.end()+ // A call that's over leaves no mute behind, and its buttons do nothing.+ #expect(CallActivity.withCall(pushed, botId: bot.id).callMuted == nil)+ CallActivity.hangUp(botId: bot.id)+ #expect(hangUps == 1)+}diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.mdindex 3f4fdb45..2b86ee28 100644--- a/apps/ios/WhatsNew.md+++ b/apps/ios/WhatsNew.md@@ -12,14 +12,14 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o- Bot 工作時,Gemini 與 OpenAI 的語音會主動告訴你它在做什麼、有沒有等你核准或遇到問題,做完就念出結果。- 通話中短暫斷線再連上時,錯過的回覆會補念給你聽。- Gemini 或 OpenAI 通話斷線時會自動重新連上並接著聊,不必重打;來電、Siri 或其他 App 佔用聲音時通話會暫停,結束後自動繼續,也可以點一下通話列下方繼續。-- 通話中,Bot 的即時動態會在鎖定畫面和動態島顯示通話狀態和它正在做的事。+- 通話中,Bot 的即時動態會在鎖定畫面和動態島顯示通話時長和它正在做的事,還能直接靜音或結束通話,不用打開 App。- Gemini 與 OpenAI 的語音用你正在說的語言回答,你換語言它就跟著換。### 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.-- During a call, the bot's Live Activity on the Lock Screen and in the Dynamic Island shows the call and what the bot is doing.+- During a call, the bot's Live Activity on the Lock Screen and in the Dynamic Island shows how long the call has run and what the bot is doing, with buttons to mute or end it without opening Codync.- The Gemini and OpenAI voice answers in the language you speak and follows when you switch.## 2.25.0diff --git a/apps/ios/Widgets/CallControlIntents.swift b/apps/ios/Widgets/CallControlIntents.swiftnew file mode 100644index 00000000..3f5e3f96--- /dev/null+++ b/apps/ios/Widgets/CallControlIntents.swift@@ -0,0 +1,42 @@+import AppIntents++// The call's Live Activity buttons. A Live Activity intent runs in the app without opening it, so these are built into+// the app as well and run there; the app sets `run` at launch, and the widget extension only shows the buttons.++/// Mutes the call with a bot, or unmutes it.+struct MuteCallIntent: LiveActivityIntent {+ static let title: LocalizedStringResource = "Mute Call"+ static let isDiscoverable = false++ @MainActor static var run: (String) -> Void = { _ in }++ @Parameter(title: "Bot") var botId: String++ init() {}++ init(botId: String) { self.botId = botId }++ @MainActor func perform() async throws -> some IntentResult {+ Self.run(botId)+ return .result()+ }+}++/// Ends the call with a bot.+struct EndCallIntent: LiveActivityIntent {+ static let title: LocalizedStringResource = "End Call"+ static let isDiscoverable = false++ @MainActor static var run: (String) -> Void = { _ in }++ @Parameter(title: "Bot") var botId: String++ init() {}++ init(botId: String) { self.botId = botId }++ @MainActor func perform() async throws -> some IntentResult {+ Self.run(botId)+ return .result()+ }+}diff --git a/apps/ios/Widgets/CallLiveActivity.swift b/apps/ios/Widgets/CallLiveActivity.swiftnew file mode 100644index 00000000..23e99db8--- /dev/null+++ b/apps/ios/Widgets/CallLiveActivity.swift@@ -0,0 +1,102 @@+import ActivityKit+import CodyncKit+import SwiftUI+import WidgetKit++/// The bot's Live Activity while this phone is on a call with it: the bot, the call's length and its two buttons+/// (mute, end), which work without opening the app (`MuteCallIntent`, `EndCallIntent`).+@MainActor+struct CallActivityViews {+ let context: ActivityViewContext<BotActivityAttributes>+ let state: BotActivityPresentation++ private var since: Date { context.state.callStartedAt ?? .now }+ private var muted: Bool { context.state.callMuted == true }++ func avatar(_ size: CGFloat) -> some View {+ ActivityAvatar(shape: context.attributes.avatarShape, color: context.attributes.avatarColor, state: state, size: size)+ }++ func timer(size: CGFloat) -> some View {+ Text(since, style: .timer)+ .font(.system(size: size).monospacedDigit())+ .foregroundStyle(Palette.secondary)+ .lineLimit(1)+ }++ /// The call's length over the bot's name.+ var title: some View {+ VStack(alignment: .leading, spacing: 1) {+ timer(size: 14)+ Text(context.attributes.name).font(.system(size: 20, weight: .semibold)).foregroundStyle(Palette.text).lineLimit(1)+ }+ }++ /// Mute and end, round. `fill` is the mute button's ground (the island is always dark; the Lock Screen follows+ /// the system's appearance).+ func buttons(fill: Color, size: CGFloat = 44) -> some View {+ HStack(spacing: 10) {+ Button(intent: MuteCallIntent(botId: context.attributes.botId)) {+ Image(systemName: muted ? "mic.slash" : "mic")+ .font(.system(size: size * 0.42, weight: .medium))+ .foregroundStyle(muted ? Palette.onAccent : Palette.text)+ .frame(width: size, height: size)+ .background(muted ? Palette.accentFill : fill, in: Circle())+ }+ .accessibilityLabel(muted ? "Unmute" : "Mute")+ Button(intent: EndCallIntent(botId: context.attributes.botId)) {+ Image(systemName: "xmark")+ .font(.system(size: size * 0.42, weight: .semibold))+ .foregroundStyle(.white)+ .frame(width: size, height: size)+ .background(Palette.danger, in: Circle())+ }+ .accessibilityLabel("End call")+ }+ .buttonStyle(.plain)+ }++ /// The island: expanded, the bot and the call's length on one side and the buttons on the other; compact, the+ /// avatar and the length; minimal, the avatar.+ var island: DynamicIsland {+ DynamicIsland {+ DynamicIslandExpandedRegion(.leading) {+ HStack(spacing: 12) {+ avatar(44)+ title+ }+ .frame(maxHeight: .infinity)+ .dynamicIsland(verticalPlacement: .belowIfTooWide)+ }+ DynamicIslandExpandedRegion(.trailing) {+ buttons(fill: .white.opacity(0.18)).frame(maxHeight: .infinity)+ }+ } compactLeading: {+ avatar(20)+ } compactTrailing: {+ timer(size: 14).frame(maxWidth: 44)+ } minimal: {+ avatar(20).accessibilityLabel("\(context.attributes.name), \(state.title)")+ }+ .keylineTint(state.tint)+ .widgetURL(context.attributes.link ?? AppEnvironment.current.link("computers"))+ }++ /// The Lock Screen and banner card: the bot, the call, its buttons, and what the bot is doing.+ var card: some View {+ VStack(alignment: .leading, spacing: 10) {+ HStack(spacing: 12) {+ avatar(44)+ title+ Spacer(minLength: 8)+ buttons(fill: Palette.text.opacity(0.12))+ }+ Text(context.state.activity.isEmpty ? L10n.tr(state.title) : context.state.activity)+ .font(.system(size: 13))+ .foregroundStyle(Palette.secondary)+ .lineLimit(1)+ .contentTransition(.interpolate)+ }+ .padding(16)+ }+}diff --git a/apps/ios/Widgets/CodyncWidgets.swift b/apps/ios/Widgets/CodyncWidgets.swiftindex 3ca8e19d..b858198d 100644--- a/apps/ios/Widgets/CodyncWidgets.swift+++ b/apps/ios/Widgets/CodyncWidgets.swift@@ -597,16 +597,23 @@ struct BotLiveActivity: Widget {var body: some WidgetConfiguration {ActivityConfiguration(for: BotActivityAttributes.self) { context inlet state = presentation(context)- BotActivityCard(name: context.attributes.name, state: state,- startedAt: since(context), link: context.attributes.link) {- avatar(context, state: state, size: 32)- } mark: {- indicator(context, state: state, size: 28)+ Group {+ if context.state.call != nil {+ CallActivityViews(context: context, state: state).card+ } else {+ BotActivityCard(name: context.attributes.name, state: state,+ startedAt: since(context), link: context.attributes.link) {+ avatar(context, state: state, size: 32)+ } mark: {+ indicator(context, state: state, size: 28)+ }+ }}.modifier(SurfaceTint()).widgetURL(context.attributes.link ?? AppEnvironment.current.link("computers"))} dynamicIsland: { context inlet state = presentation(context)+ if context.state.call != nil { return CallActivityViews(context: context, state: state).island }return DynamicIsland {DynamicIslandExpandedRegion(.leading) {avatar(context, state: state, size: 26).frame(maxHeight: .infinity)diff --git a/apps/project.yml b/apps/project.ymlindex 1924907e..3d57ecaa 100644--- a/apps/project.yml+++ b/apps/project.yml@@ -147,8 +147,9 @@ targets:- WhatsNew.md# The app's shared Swift package (models, client, screens), added as a package below.- Kit- # The widget's bot buttons run this intent in the app.+ # The widget's bot buttons and the call's Live Activity buttons run these intents in the app.- ios/Widgets/OpenBotIntent.swift+ - ios/Widgets/CallControlIntents.swiftdependencies:- package: Clerkproduct: ClerkKitdiff --git a/docs/design/push-and-live-activity.md b/docs/design/push-and-live-activity.mdindex 714a5aa6..cda4177b 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`. During a voice call the app also sets `call` and `callStartedAt` locally ([the call outside the app](../features/voice-call.md#the-call-outside-the-app)); the computer never sends them, so a remote update drops them and the app puts them back, and the app doesn't end the activity while the call lasts. 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`, `callStartedAt` and `callMuted` locally (the call's layout with its mute and end buttons) ([the call outside the app](../features/voice-call.md#the-call-outside-the-app)); the computer never sends them, so a remote update drops them and the app puts them back, and the app doesn't end the activity while the call lasts. 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 ad1bb134..4d3952a4 100644--- a/docs/features/voice-call.md+++ b/docs/features/voice-call.md@@ -382,8 +382,15 @@ carries audio and talks to these methods:computer replaces the state, and gives the call its own activity again when the computer's last push ends thetask's. When the call ends, an activity whose bot is idle or failed ends (at once if the call started it, else aminute later) and one with a task under way stays without the call.+ While the call lasts the activity takes the call's own layout (`CallLiveActivity.swift`): the bot's avatar, the+ call's length over its name, and two round buttons, mute (`mic` / `mic.slash`, from `callMuted`) and end, in the+ expanded island and on the Lock Screen card, which also shows the progress line; the compact island shows the+ avatar and the length, the minimal one the avatar. The buttons are `LiveActivityIntent`s (`MuteCallIntent`,+ `EndCallIntent`, built into the app and the widget extension) that run in the app without opening it and press+ the call bar's own mute and end (`CallActivity.toggleMute` / `hangUp`), so an ended call logs its line as usual;+ muting from the call bar updates the activity.- Android: the call's foreground notification shows its state and the bot's latest progress line (cleared by its- reply), updated in place, with Mute and End call.+ reply), updated in place, with the bot's name, the call's length (a chronometer from its start) and Mute and End call.- The desktop and the terminal have no Live Activity or call notification.### Failure and costdiff --git a/web/content/docs/voice.mdx b/web/content/docs/voice.mdxindex 153d4e1e..02469f2b 100644--- a/web/content/docs/voice.mdx+++ b/web/content/docs/voice.mdx@@ -24,7 +24,7 @@ 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, and the bot's Live Activity on the Lock Screen and in the Dynamic Island shows the call and what the bot is doing while you talk.+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, and the bot's Live Activity on the Lock Screen and in the Dynamic Island shows the call, how long it has run and what the bot is doing while you talk, with buttons to mute or end the call without opening Codync.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.