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): let the bot itself move on live activity phase changes
leepokaidfe1acccf376
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swiftindex 67b4a8b3..40bf237b 100644--- a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift@@ -38,21 +38,14 @@ public extension BotActivityPresentation {}public extension AnyTransition {- /// The bot's face and the state mark on a phase change: the old one bursts out larger- /// while the new one grows in from small and overshoots (with `Motion.activityPop`).- /// Built-in transitions only: Live Activities don't run custom ones.- static var activityFace: AnyTransition {- .asymmetric(insertion: .scale(scale: 0.2).combined(with: .opacity),- removal: .scale(scale: 1.6).combined(with: .opacity))- }-/// Rows a new phase brings (the Review button, the timer): rise and fade in.static var activityRow: AnyTransition {.asymmetric(insertion: .move(edge: .bottom).combined(with: .opacity), removal: .opacity)}}-/// The bot's face in its phase's mood, swapped with a pop when the phase changes.+/// The bot's face in its phase's mood. On a phase change the bot itself moves: the halftone+/// highlight sweeps to the new side and the eyes glance over (or the ripple appears).public struct ActivityAvatar: View {let shape: Stringlet color: String@@ -64,13 +57,8 @@ public struct ActivityAvatar: View {}public var body: some View {- ZStack {- CharacterAvatar(shape: shape, color: color, size: size, mood: state.mood, still: true)- .id(state.phase)- .transition(.activityFace)- }- .frame(width: size, height: size)- .animation(Motion.activityPop, value: state.phase)+ CharacterAvatar(shape: shape, color: color, size: size, mood: state.mood, still: true)+ .animation(Motion.activityPhase, value: state.mood)}}@@ -178,7 +166,7 @@ public struct BotActivityIndicator: View {}public var body: some View {- // A new mark per phase (orb → orb too: working → needs you), so every change pops.+ // The orb and the end symbols cross-fade; the bot beside it carries the motion.ZStack {Group {if let orb = state.orbState {@@ -188,11 +176,11 @@ public struct BotActivityIndicator: View {}}.id(state.phase)- .transition(.activityFace)+ .transition(.opacity)}.frame(width: size, height: size).foregroundStyle(state.tint)- .animation(Motion.activityPop, value: state.phase)+ .animation(Motion.activityPhase, value: state.phase).accessibilityElement().accessibilityLabel(state.title)}diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swift b/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swiftindex 0f2ea38c..2f6f9318 100644--- a/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swift@@ -13,8 +13,8 @@ public struct CharacterAvatar: View {let mood: Moodlet still: Bool- /// `still` draws the mood's face without animating it (widgets and Live Activities,- /// which render one frame).+ /// `still` draws one frame of the mood (widgets and Live Activities render one frame);+ /// a change of mood then moves the halftone highlight and the eyes, animatable dot by dot.public init(shape: String, color: String, size: CGFloat = 40, mood: Mood = .idle, still: Bool = false) {self.init(shape: shape, tint: AvatarPalette.color(color), size: size, mood: mood, still: still)}@@ -69,49 +69,103 @@ private struct DottedBody: View {let paused: Bool@Environment(\.accessibilityReduceMotion) private var reduceMotion+ /// Where the light sits and where the eyes look.+ struct Pose: Equatable {+ var yaw: Double+ var glance: Int+ var blinking = false+ /// The needs-you ripple's phase, nil without one.+ var ripple: Double?++ /// One frame of the mood: in widgets and Live Activities, which render one frame, a+ /// change of mood moves the halftone highlight and the eyes to the new pose.+ static func still(_ mood: CharacterAvatar.Mood) -> Pose {+ switch mood {+ case .idle: Pose(yaw: -0.7, glance: 0)+ case .working: Pose(yaw: 1.1, glance: 1)+ case .needsInput: Pose(yaw: 0, glance: 0, ripple: 0.6)+ }+ }+ }++ /// One dot's look for a pose: radius, grey ink, and how much of the bot's color shows.+ struct Ink {+ let dot: Dot+ let radius: CGFloat+ let ink: Double+ let tint: Double+ let eye: Bool+ }+var body: some View {let grid = Grid(size: size)let step = size / CGFloat(grid.cells)let dots = Self.grid(shape: shape, size: size, step: step, cells: grid.cells)- let still = mood == .idle || reduceMotion || paused- TimelineView(.animation(paused: still)) { timeline in- let t = still ? 0 : timeline.date.timeIntervalSinceReferenceDate.truncatingRemainder(dividingBy: 3600)- // Glance: whole-cell steps left / center / right, like a small display.- let glance = mood == .working ? Int((sin(t * 2 * .pi / 3.2) * 1.4).rounded()) : 0- let blinking = !still && (t / 4.7).truncatingRemainder(dividingBy: 1) < 0.035- let eyeRows = blinking ? Array(grid.eyeRows.suffix(1)) : grid.eyeRows- let eyeCols = grid.eyeColumns.map { $0 + glance }- Canvas { ctx, _ in- let half = size / 2- let yaw = mood == .working ? t * 1.4 : -0.7- let lx = sin(yaw) * 0.8, ly = 0.55, lz = cos(yaw) * 0.5 + 0.6 // never fully behind- let ll = (lx * lx + ly * ly + lz * lz).squareRoot()- for d in dots where !(eyeCols.contains(d.col) && eyeRows.contains(d.row)) {- let p = d.center- let u = (p.x - half) / half, v = (half - p.y) / half- let z = max(0.2, 1 - u * u - v * v).squareRoot()- let nl = (u * u + v * v + z * z).squareRoot()- var shade = 0.3 + 0.7 * max(0, (u * lx + v * ly + z * lz) / (nl * ll))- if mood == .needsInput {- let ripple = 0.5 + 0.5 * sin((u * u + v * v).squareRoot() * 9 - t * 5)- shade *= 0.6 + 0.4 * ripple- }- let r = step * 0.42 * (0.55 + 0.45 * shade)- let dot = Path(ellipseIn: CGRect(x: p.x - r, y: p.y - r, width: r * 2, height: r * 2))- let ink = grid.cells < 13 ? 0.4 + 0.4 * shade : 0.2 + 0.4 * min(1, shade / 0.7)- ctx.fill(dot, with: .color(Palette.text.opacity(ink)))- if shade > 0.6 {- ctx.fill(dot, with: .color(color.opacity((shade - 0.6) / 0.4)))+ if paused {+ // One view per dot (not a Canvas), so the system interpolates each dot's size and+ // color between two poses, also inside a Live Activity.+ ZStack(alignment: .topLeading) {+ ForEach(Self.inks(dots, grid: grid, step: step, size: size, pose: .still(mood)), id: \.dot.id) { d in+ Circle()+ .fill(Palette.text.opacity(d.ink))+ .overlay(Circle().fill(color.opacity(d.tint)))+ .frame(width: d.radius * 2, height: d.radius * 2)+ .position(d.dot.center)+ .opacity(d.eye ? 0 : 1)+ }+ }+ .frame(width: size, height: size)+ } else {+ let still = mood == .idle || reduceMotion+ TimelineView(.animation(paused: still)) { timeline in+ let t = still ? 0 : timeline.date.timeIntervalSinceReferenceDate.truncatingRemainder(dividingBy: 3600)+ // Glance: whole-cell steps left / center / right, like a small display.+ let pose = Pose(yaw: mood == .working ? t * 1.4 : -0.7,+ glance: mood == .working ? Int((sin(t * 2 * .pi / 3.2) * 1.4).rounded()) : 0,+ blinking: !still && (t / 4.7).truncatingRemainder(dividingBy: 1) < 0.035,+ ripple: mood == .needsInput ? t * 5 : nil)+ Canvas { ctx, _ in+ for d in Self.inks(dots, grid: grid, step: step, size: size, pose: pose) where !d.eye {+ let p = d.dot.center, r = d.radius+ let dot = Path(ellipseIn: CGRect(x: p.x - r, y: p.y - r, width: r * 2, height: r * 2))+ ctx.fill(dot, with: .color(Palette.text.opacity(d.ink)))+ if d.tint > 0 { ctx.fill(dot, with: .color(color.opacity(d.tint))) }}}}}}+ /// Shades the dots as a lit ball; the eyes stay hollow.+ static func inks(_ dots: [Dot], grid: Grid, step: CGFloat, size: CGFloat, pose: Pose) -> [Ink] {+ let eyeRows = pose.blinking ? Array(grid.eyeRows.suffix(1)) : grid.eyeRows+ let eyeCols = grid.eyeColumns.map { $0 + pose.glance }+ let half = size / 2+ let lx = sin(pose.yaw) * 0.8, ly = 0.55, lz = cos(pose.yaw) * 0.5 + 0.6 // never fully behind+ let ll = (lx * lx + ly * ly + lz * lz).squareRoot()+ return dots.map { d in+ let p = d.center+ let u = (p.x - half) / half, v = (half - p.y) / half+ let z = max(0.2, 1 - u * u - v * v).squareRoot()+ let nl = (u * u + v * v + z * z).squareRoot()+ var shade = 0.3 + 0.7 * max(0, (u * lx + v * ly + z * lz) / (nl * ll))+ if let phase = pose.ripple {+ let ripple = 0.5 + 0.5 * sin((u * u + v * v).squareRoot() * 9 - phase)+ shade *= 0.6 + 0.4 * ripple+ }+ return Ink(dot: d,+ radius: step * 0.42 * (0.55 + 0.45 * shade),+ ink: grid.cells < 13 ? 0.4 + 0.4 * shade : 0.2 + 0.4 * min(1, shade / 0.7),+ tint: shade > 0.6 ? (shade - 0.6) / 0.4 : 0,+ eye: eyeCols.contains(d.col) && eyeRows.contains(d.row))+ }+ }+struct Dot {let row: Intlet col: Intlet center: CGPoint+ var id: Int { row * 100 + col }}/// Square-grid dot centers that fall inside the silhouette.diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swift b/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swiftindex 162efd9f..3cbc09a8 100644--- a/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swift@@ -23,9 +23,6 @@ public enum Motion {/// A Live Activity's phase change (working → needs you → done): a soft spring that/// finishes well inside the 2 s iOS gives activity updates.public static let activityPhase = Animation.spring(duration: 0.6, bounce: 0.3)- /// The state mark and the bot's face swapping on a phase change: a bouncier spring so the- /// new one overshoots as it lands.- public static let activityPop = Animation.spring(duration: 0.7, bounce: 0.5)/// `--ui-press-scale`.public static let pressScale: CGFloat = 0.98diff --git a/docs/design/mobile-widgets.md b/docs/design/mobile-widgets.mdindex 4fd4fefb..dfa01a6f 100644--- a/docs/design/mobile-widgets.md+++ b/docs/design/mobile-widgets.md@@ -59,7 +59,7 @@ State 分頁的 Live Activity 頁顯示鎖定畫面形式,Dynamic Island 頁| Minimal | 只有 orb(或結束符號),VoiceOver 包含 bot 名稱 || Expanded | bot、上色的一行說明、orb;底部是經過時間,待回應時換成 Review;整塊點擊回到對話 |-狀態色:待回應琥珀(`Palette.attention`)、失敗紅、完成綠;工作中的說明維持灰色,只有需要注意的狀態跳出來。經過時間用 `Text(startedAt, style: .timer)` 由系統自己往上數,不需要推播(`startedAt` 已在 remote content state 裡)。狀態切換時頭像和右側狀態記號(orb、勾號、警告)一起「爆出再彈入」:舊的放大到 1.6 倍淡出,新的從 0.2 倍長出並回彈(`Motion.activityPop`,0.7 s、bounce 0.5);orb 換 orb(工作中 → 待回應)也會彈。文字用 `.contentTransition(.interpolate)`,Review/時間列由下往上進場(`Motion.activityPhase`,0.6 s)。全部在 iOS 給 activity 更新的 2 s 內,而且只用內建 transition,因為 Live Activity 不執行自訂 transition。展開島底部的時間是單一置中 Text(圖示內嵌),避免 timer Text 佔滿寬度後偏左。Review 只開啟對話,核准仍在 App 的 permission card。+狀態色:待回應琥珀(`Palette.attention`)、失敗紅、完成綠;工作中的說明維持灰色,只有需要注意的狀態跳出來。經過時間用 `Text(startedAt, style: .timer)` 由系統自己往上數,不需要推播(`startedAt` 已在 remote content state 裡)。狀態切換時動的是 bot 本身:每個 mood 有固定的一幀姿勢(idle 光從左上、working 光掃到右側且眼睛往右看、needs you 正面光加漣漪),`still: true` 時每顆點是獨立的 view,系統會逐點插值大小與顏色,所以 halftone 的亮處會滑到新位置、眼睛移過去(`Motion.activityPhase`)。右側的 orb/勾號/警告只做淡入淡出。文字用 `.contentTransition(.interpolate)`,Review/時間列由下往上進場。全部在 iOS 給 activity 更新的 2 s 內,而且只用內建 transition,因為 Live Activity 不執行自訂 transition。展開島底部的時間是單一置中 Text(圖示內嵌),避免 timer Text 佔滿寬度後偏左。Review 只開啟對話,核准仍在 App 的 permission card。模擬器截圖看不到 Live Activity,所以 Live Activity、動態島(各狀態 × Lock Screen/Compact/Minimal/Expanded,淺色與深色)和 widget 卡片改用 render 測試輸出 PNG 檢查: