Skip to content

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.

iPhone first launch: a welcome screen, then pairing one step per page

leepokaiefe4017396d4
diff --git a/Codync.xcodeproj/project.pbxproj b/Codync.xcodeproj/project.pbxproj
index aa7ef37b..1dca28d0 100644
--- a/Codync.xcodeproj/project.pbxproj
+++ b/Codync.xcodeproj/project.pbxproj
@@ -37,6 +37,7 @@
AA601649E43A5AF73DCF5B5E /* WebRTC in Frameworks */ = {isa = PBXBuildFile; productRef = 2D9748E611692583AFC5A152 /* WebRTC */; };
ACCB28F3DB9C89108B7911E3 /* Input.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842DA106CA15E3810C3C9461 /* Input.swift */; };
AD4428FB4374EC7B1B89F1FD /* ActivityGalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B6C42CD9B7CED28A1EE536C /* ActivityGalleryView.swift */; };
+ AD70E2D55507BF2A75743763 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57273C989336832CFF7B7ACD /* WelcomeView.swift */; };
AFC0CD8BD1FA61F810C96057 /* com.pokai.Codync.screen.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 895BB6C2EB8986266EB4159A /* com.pokai.Codync.screen.plist */; };
B55C0D49B47C628C367BD92A /* AXTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97876A72710A37EB86A082C1 /* AXTree.swift */; };
B75DD137E6F645F797B60B09 /* PairingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 739EC95223CC8F8717C33736 /* PairingView.swift */; };
@@ -134,6 +135,7 @@
4CFB70DD8757C90695CDA211 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4EDD440CC0624F03363AC1BA /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
55AABA9596547D7459B1CC5B /* Push.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Push.swift; sourceTree = "<group>"; };
+ 57273C989336832CFF7B7ACD /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
57DFD81025893713D631B5D7 /* ComputersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComputersView.swift; sourceTree = "<group>"; };
60422D3CA8FEBCDC5AC465E0 /* iOS.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
6D734BEE7CD3F84677B0218B /* Widgets.appex */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.app-extension"; path = Widgets.appex; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -229,6 +231,7 @@
E1B79D48C1D6F90D53751B3F /* RootView.swift */,
DE4AE9A34F61B3D28E0C2550 /* SettingsView.swift */,
47BCE8E2AFA6CA829DBC489A /* UsageView.swift */,
+ 57273C989336832CFF7B7ACD /* WelcomeView.swift */,
0E8563C243AB130DFA063CAD /* WidgetGalleryView.swift */,
);
path = Views;
@@ -719,6 +722,7 @@
E430F9317B690366F62164DB /* RootView.swift in Sources */,
DEF7478AB86DB605F52905F5 /* SettingsView.swift in Sources */,
ED143C01BF7AD4953101D160 /* UsageView.swift in Sources */,
+ AD70E2D55507BF2A75743763 /* WelcomeView.swift in Sources */,
A12D125989D2EA1AC5308218 /* WidgetGalleryView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/apps/ios/Views/PairingView.swift b/apps/ios/Views/PairingView.swift
index 79b5d832..954f060d 100644
--- a/apps/ios/Views/PairingView.swift
+++ b/apps/ios/Views/PairingView.swift
@@ -3,103 +3,254 @@ import CodyncUI
import SwiftUI
import VisionKit
-/// First run: explain the model, then pair with a computer running codync-host.
-struct PairingView: View {
- var introductory = true
- /// Adding another computer from the computers sheet: titled, with a close button; closes once paired.
+/// Pair with a computer running codync-host, one thing per page: install it, then scan its code.
+struct PairingView<Leading: View>: View {
+ /// Adding another computer from the computers sheet: has a close button; closes once paired.
var inModal = false
- @Environment(AppStore.self) private var app
+ /// Top-left on the first page (back to the welcome, the account switcher).
+ @ViewBuilder var leading: Leading
+
+ private enum Step { case install, scan }
+ @State private var step = Step.install
+ @State private var os = ComputerOS.mac
@Environment(\.dismissModal) private var dismissModal
@Environment(\.accessibilityReduceMotion) private var reduceMotion
- @State private var scanning = false
+
+ var body: some View {
+ VStack(spacing: 0) {
+ ScreenHeader {
+ if step == .scan { BackButton { go(.install) } } else { leading }
+ } title: {
+ HStack(spacing: 6) {
+ Capsule().fill(Palette.text).frame(width: 18, height: 4)
+ Capsule().fill(step == .scan ? Palette.text : Palette.accentDim).frame(width: 18, height: 4)
+ }
+ .accessibilityElement()
+ .accessibilityLabel(step == .install ? "Step 1 of 2" : "Step 2 of 2")
+ } trailing: {
+ if inModal { IconButton("Close", systemImage: "xmark") { dismissModal() } }
+ }
+
+ ZStack {
+ switch step {
+ case .install:
+ InstallPage(os: $os) { go(.scan) }
+ .transition(.move(edge: .leading).combined(with: .opacity))
+ case .scan:
+ ScanPage(os: os) { if inModal { dismissModal() } }
+ .transition(.move(edge: .trailing).combined(with: .opacity))
+ }
+ }
+ .frame(maxHeight: .infinity)
+ .clipped()
+ }
+ .background(Palette.background)
+ }
+
+ private func go(_ next: Step) {
+ withAnimation(Motion.reduced(.spring(duration: 0.45, bounce: 0), reduceMotion)) { step = next }
+ }
+}
+
+extension PairingView where Leading == EmptyView {
+ init(inModal: Bool) { self.init(inModal: inModal) { EmptyView() } }
+}
+
+private enum ComputerOS: Hashable { case mac, linux }
+
+// MARK: - Install
+
+private struct InstallPage: View {
+ @Binding var os: ComputerOS
+ let next: () -> Void
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 0) {
+ ScrollView {
+ VStack(alignment: .leading, spacing: 24) {
+ // A bot on the computer's screen: that's where it lives.
+ ZStack {
+ Image(systemName: "laptopcomputer")
+ .font(.system(size: 150, weight: .ultraLight))
+ .foregroundStyle(Palette.tertiary)
+ CharacterAvatar(shape: "blob", color: "blue", size: 52, mood: .working)
+ .offset(y: -12)
+ }
+ .frame(maxWidth: .infinity)
+ .padding(.top, 8)
+
+ VStack(alignment: .leading, spacing: 10) {
+ Text("Install Codync\non your computer")
+ .font(.system(size: 30, weight: .semibold))
+ .tracking(-0.5)
+ .foregroundStyle(Palette.text)
+ Text("Your bots run there. This iPhone is how you talk to them.")
+ .font(.body)
+ .foregroundStyle(Palette.secondary)
+ }
+
+ SegmentedChoice(selection: $os, options: [(.mac, "Mac"), (.linux, "Linux")])
+
+ VStack(alignment: .leading, spacing: 10) {
+ CommandBlock(os == .mac
+ ? "brew install --cask leepokai/codync/codync"
+ : "brew install leepokai/codync/codync-host\ncodync-host install")
+ if os == .mac {
+ Text("Then open Codync in the menu bar and click Install host.")
+ .font(.subheadline)
+ .foregroundStyle(Palette.secondary)
+ .transition(.opacity)
+ }
+ }
+ .animation(Motion.layout, value: os)
+ }
+ .padding(.horizontal, 24)
+ .padding(.bottom, 16)
+ }
+
+ Button(action: next) {
+ Text("Continue").font(.headline).frame(maxWidth: .infinity, minHeight: 50)
+ }
+ .buttonStyle(.primary)
+ .padding(.horizontal, 24)
+ .padding(.bottom, 12)
+ }
+ }
+}
+
+/// A terminal command with a copy button.
+private struct CommandBlock: View {
+ let command: String
+ @State private var copied = false
+
+ init(_ command: String) { self.command = command }
+
+ var body: some View {
+ HStack(alignment: .top, spacing: 8) {
+ Text(command)
+ .font(.footnote.monospaced())
+ .foregroundStyle(Palette.text)
+ .textSelection(.enabled)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.vertical, 6)
+ .contentTransition(.opacity)
+ IconButton(copied ? "Copied" : "Copy", systemImage: copied ? "checkmark" : "doc.on.doc") {
+ UIPasteboard.general.string = command
+ withAnimation(Motion.morph) { copied = true }
+ Task {
+ try? await Task.sleep(for: .seconds(1.5))
+ withAnimation(Motion.morph) { copied = false }
+ }
+ }
+ .contentTransition(.symbolEffect(.replace))
+ }
+ .padding(.leading, 14)
+ .padding(.trailing, 4)
+ .padding(.vertical, 4)
+ .background(Palette.codeBackground, in: RoundedRectangle(cornerRadius: 12))
+ .animation(Motion.fade, value: command)
+ }
+}
+
+// MARK: - Scan
+
+private struct ScanPage: View {
+ let os: ComputerOS
+ let paired: () -> Void
+ @Environment(AppStore.self) private var app
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @Environment(\.scenePhase) private var scenePhase
+ @Environment(\.openURL) private var openURL
@State private var pairing = false
@State private var pasted = ""
@State private var error: String?
+ /// Bumped after a failed pair so the scanner starts looking again.
+ @State private var attempt = 0
@State private var tailscaleOn = Tailscale.isConnected
- @Environment(\.scenePhase) private var scenePhase
var body: some View {
ScrollView {
- VStack(alignment: .leading, spacing: 28) {
- if introductory {
- HStack(spacing: -10) {
- CharacterAvatar(shape: "blob", color: "blue", size: 64, mood: .working)
- CharacterAvatar(shape: "squircle", color: "orange", size: 64)
- CharacterAvatar(shape: "teardrop", color: "violet", size: 64, mood: .working)
- }
- .padding(.top, 40)
- }
-
+ VStack(alignment: .leading, spacing: 24) {
VStack(alignment: .leading, spacing: 10) {
- Text(introductory ? "Your coding agents,\nas teammates." : "Connect a computer")
- .font(.system(size: 34, weight: .semibold))
- .tracking(-0.6)
+ Text("Scan the pairing code")
+ .font(.system(size: 30, weight: .semibold))
+ .tracking(-0.5)
.foregroundStyle(Palette.text)
- Text(introductory
- ? "Give each agent a name, a job and a project. Then just message the right one — it works on your computer while your phone is in your pocket."
- : "Pair a Mac or Linux computer to see its bots in this account.")
+ Text(os == .mac
+ ? "On your Mac, click Codync in the menu bar, then Pair iPhone."
+ : "On your computer, run this in a terminal:")
.font(.body)
.foregroundStyle(Palette.secondary)
+ if os == .linux { CommandBlock("codync-host pair") }
}
+ viewfinder
- VStack(alignment: .leading, spacing: 14) {
- Step(n: 1, title: "Install Codync on your computer", detail: "Mac — then open Codync in the menu bar and click Install host:", code: "brew install --cask leepokai/codync/codync")
- Step(n: nil, title: "", detail: "Linux:", code: "brew install leepokai/codync/codync-host\ncodync-host install")
- Step(n: 2, title: "Show the pairing code", detail: "On a Mac, click Codync in the menu bar → Pair iPhone. Or run:", code: "codync-host pair")
- Step(n: 3, title: "Scan it", detail: "Use the button below, or point the Camera app at the code.", code: nil)
- TailscaleStep(connected: tailscaleOn)
+ HStack {
+ TextField("Or paste a codync://pair link", text: $pasted)
+ .textInputAutocapitalization(.never)
+ .autocorrectionDisabled()
+ .font(.callout.monospaced())
+ .onSubmit { pair(pasted) }
+ IconButton("Pair", systemImage: "arrow.right") { pair(pasted) }
+ .disabled(pasted.isEmpty || pairing)
}
+ .padding(.leading, 14)
+ .padding(.trailing, 4)
+ .padding(.vertical, 4)
+ .background(Palette.surface, in: RoundedRectangle(cornerRadius: 12))
- VStack(spacing: 12) {
- Button {
- scanning = true
- } label: {
- Group {
- if pairing {
- Spinner(size: 18)
- } else {
- Label("Scan pairing code", systemImage: "qrcode.viewfinder")
- }
- }
- .font(.headline)
- .frame(maxWidth: .infinity, minHeight: 50)
- }
- .buttonStyle(.primary)
- .disabled(!DataScannerViewController.isSupported || pairing)
-
- HStack {
- TextField("…or paste a codync://pair link", text: $pasted)
- .textInputAutocapitalization(.never)
- .autocorrectionDisabled()
- .font(.callout.monospaced())
- IconButton("Pair", systemImage: "arrow.right.circle.fill") { pair(pasted) }
- .disabled(pasted.isEmpty || pairing)
- }
- .padding(12)
- .background(Palette.surface, in: RoundedRectangle(cornerRadius: 12))
+ if let error {
+ Text(error).font(.footnote).foregroundStyle(Palette.danger)
+ .transition(.opacity)
+ }
- if let error {
- Text(error).font(.footnote).foregroundStyle(Palette.danger)
- .transition(.opacity)
+ VStack(alignment: .leading, spacing: 8) {
+ Label("End-to-end encrypted, on Wi-Fi or anywhere else. Your code and chats stay on the computer.",
+ systemImage: "lock.fill")
+ if tailscaleOn {
+ Label("Tailscale is on, so Codync connects over it directly.", systemImage: "checkmark.circle.fill")
+ } else {
+ Button { openURL(Tailscale.downloadURL) } label: {
+ Label("Use Tailscale? Codync connects over it directly.", systemImage: "arrow.up.right")
+ }
+ .buttonStyle(PressScale())
}
}
-
- Text("No Tailscale or open ports needed: on the same Wi-Fi your iPhone talks to the computer directly, anywhere else through Codync's relay. Either way it's end-to-end encrypted, and your code and chats stay on the computer.")
- .font(.footnote)
- .foregroundStyle(Palette.tertiary)
+ .font(.footnote)
+ .foregroundStyle(Palette.tertiary)
}
- .padding(24)
- }
- .background(Palette.background)
- .safeAreaInset(edge: .top, spacing: 0) {
- if inModal { ModalHeader("Pair a computer").background(Palette.background) }
+ .padding(.horizontal, 24)
+ .padding(.bottom, 24)
}
+ .scrollDismissesKeyboard(.interactively)
// Coming back from the Tailscale app: show whether it's connected now.
.onChange(of: scenePhase) { _, phase in if phase == .active { tailscaleOn = Tailscale.isConnected } }
- .codyncSheet(isPresented: $scanning) {
- ScannerSheet { code in pair(code) }
+ }
+
+ /// The camera, right on the page: no extra sheet between the instruction and the scan.
+ private var viewfinder: some View {
+ ZStack {
+ if DataScannerViewController.isSupported {
+ QRScanner { code in pair(code) }
+ .id(attempt)
+ } else {
+ VStack(spacing: 10) {
+ Image(systemName: "qrcode.viewfinder").font(.system(size: 44, weight: .light))
+ Text("Camera not available. Paste the link below.").font(.footnote)
+ }
+ .foregroundStyle(Palette.tertiary)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background(Palette.surface)
+ }
+ if pairing {
+ Palette.background.opacity(0.7)
+ Spinner(size: 28)
+ }
}
+ .aspectRatio(1, contentMode: .fit)
+ .clipShape(RoundedRectangle(cornerRadius: 24, style: .continuous))
+ .animation(Motion.fade, value: pairing)
}
private func pair(_ text: String) {
@@ -117,7 +268,7 @@ struct PairingView: View {
do {
_ = try await app.pair(p)
pasted = ""
- if inModal { dismissModal() }
+ paired()
} catch {
show(error)
}
@@ -125,92 +276,11 @@ struct PairingView: View {
}
private func show(_ error: Error) {
+ attempt += 1
withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { self.error = error.localizedDescription }
}
}
-private struct Step: View {
- let n: Int?
- let title: String
- let detail: String
- let code: String?
-
- var body: some View {
- HStack(alignment: .top, spacing: 12) {
- Text(n.map { String(format: "%02d", $0) } ?? "")
- .font(.system(size: 12, weight: .medium, design: .monospaced))
- .frame(width: 24, alignment: .leading)
- .padding(.top, 2)
- .foregroundStyle(Palette.tertiary)
- VStack(alignment: .leading, spacing: 6) {
- if !title.isEmpty {
- Text(title).font(.headline).foregroundStyle(Palette.text)
- }
- Text(detail).font(.subheadline).foregroundStyle(Palette.secondary)
- if let code {
- Text(code)
- .font(.footnote.monospaced())
- .textSelection(.enabled)
- .padding(10)
- .frame(maxWidth: .infinity, alignment: .leading)
- .background(Palette.codeBackground, in: RoundedRectangle(cornerRadius: 8))
- }
- }
- }
- }
-}
-
-/// Optional: Tailscale is an alternative way in for people who already use it; the relay doesn't need it.
-private struct TailscaleStep: View {
- let connected: Bool
- @Environment(\.openURL) private var openURL
-
- var body: some View {
- HStack(alignment: .top, spacing: 12) {
- Text("")
- .font(.system(size: 12, weight: .medium, design: .monospaced))
- .frame(width: 24, alignment: .leading)
- .padding(.top, 2)
- .foregroundStyle(Palette.tertiary)
- VStack(alignment: .leading, spacing: 6) {
- Text("Already use Tailscale? (optional)").font(.headline).foregroundStyle(Palette.text)
- Text("Codync works away from home without it. If Tailscale runs on this iPhone and the computer, Codync connects over it directly instead of the relay.")
- .font(.subheadline)
- .foregroundStyle(Palette.secondary)
- if connected {
- Label("Tailscale is on", systemImage: "checkmark.circle.fill")
- .font(.subheadline.weight(.medium))
- .foregroundStyle(Palette.added)
- } else {
- Button { openURL(Tailscale.downloadURL) } label: {
- Label("Get Tailscale", systemImage: "arrow.down.circle")
- .font(.subheadline.weight(.medium))
- .foregroundStyle(Palette.accent)
- }
- .buttonStyle(PressScale())
- }
- }
- }
- }
-}
-
-/// The camera scanner in a Codync sheet; closes as soon as it reads a pairing code.
-private struct ScannerSheet: View {
- let onCode: (String) -> Void
- @Environment(\.dismissModal) private var dismiss
-
- var body: some View {
- VStack(spacing: 0) {
- ModalHeader("Scan pairing code")
- QRScanner { code in
- dismiss()
- onCode(code)
- }
- .ignoresSafeArea(edges: .bottom)
- }
- }
-}
-
/// VisionKit live QR scanner.
struct QRScanner: UIViewControllerRepresentable {
let onCode: (String) -> Void
diff --git a/apps/ios/Views/RootView.swift b/apps/ios/Views/RootView.swift
index 2cb10719..61b47e8d 100644
--- a/apps/ios/Views/RootView.swift
+++ b/apps/ios/Views/RootView.swift
@@ -8,6 +8,8 @@ struct RootView: View {
@Environment(AccountStore.self) private var accounts
@AppStorage("onboardingCompleted") private var onboardingCompleted = false
@Environment(\.accessibilityReduceMotion) private var reduceMotion
+ /// First launch only: past the welcome, on to setup.
+ @State private var welcomed = false
/// The open bot, as a NavigationStack path.
private var path: Binding<[BotReference]> {
@@ -17,11 +19,18 @@ struct RootView: View {
var body: some View {
Group {
if accounts.computers.isEmpty && accounts.cloudComputers.isEmpty {
- VStack(spacing: 0) {
- if onboardingCompleted {
- ScreenHeader { AccountSwitcherButton() } title: { EmptyView() } trailing: { EmptyView() }
+ if !onboardingCompleted && !welcomed {
+ WelcomeView { withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { welcomed = true } }
+ .transition(.move(edge: .leading).combined(with: .opacity))
+ } else {
+ PairingView {
+ if onboardingCompleted {
+ AccountSwitcherButton()
+ } else {
+ BackButton { withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { welcomed = false } }
+ }
}
- PairingView(introductory: !onboardingCompleted)
+ .transition(.move(edge: .trailing).combined(with: .opacity))
}
} else {
tabs
diff --git a/apps/ios/Views/SettingsView.swift b/apps/ios/Views/SettingsView.swift
index 2f315a29..00bbc28c 100644
--- a/apps/ios/Views/SettingsView.swift
+++ b/apps/ios/Views/SettingsView.swift
@@ -115,7 +115,7 @@ struct SettingsView: View {
}
.task { await accounts.refreshCloud() }
.codyncSheet(isPresented: $addingComputer) {
- PairingView(introductory: false, inModal: true)
+ PairingView(inModal: true)
}
.codyncSheet(item: $access) { target in
AccessRequestView(computer: target.computer, pending: accounts.pendingAccess[target.id] != nil)
diff --git a/apps/ios/Views/WelcomeView.swift b/apps/ios/Views/WelcomeView.swift
new file mode 100644
index 00000000..7c08b140
--- /dev/null
+++ b/apps/ios/Views/WelcomeView.swift
@@ -0,0 +1,139 @@
+import CodyncKit
+import CodyncUI
+import SwiftUI
+
+/// First launch, before any setup: who the bots are, a glimpse of talking to one, one way forward.
+struct WelcomeView: View {
+ let start: () -> Void
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ /// 0 = nothing yet … 4 = everything shown. Each beat enters in turn.
+ @State private var beat = 0
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 0) {
+ Spacer(minLength: 24)
+
+ Crew(shown: beat >= 1)
+ .frame(maxWidth: .infinity)
+
+ Spacer(minLength: 24)
+
+ ChatGlimpse(shown: beat >= 2)
+ .padding(.bottom, 32)
+
+ VStack(alignment: .leading, spacing: 10) {
+ Text("Your coding agents,\nas teammates.")
+ .font(.system(size: 34, weight: .semibold))
+ .tracking(-0.6)
+ .foregroundStyle(Palette.text)
+ Text("Give each one a name and a project. They work on your computer while you're away.")
+ .font(.body)
+ .foregroundStyle(Palette.secondary)
+ }
+ .rise(beat >= 3)
+
+ Spacer(minLength: 32)
+
+ Button(action: start) {
+ Text("Get started").font(.headline).frame(maxWidth: .infinity, minHeight: 50)
+ }
+ .buttonStyle(.primary)
+ .rise(beat >= 4)
+ }
+ .padding(.horizontal, 24)
+ .padding(.bottom, 12)
+ .background(Palette.background)
+ .task {
+ if reduceMotion { beat = 4; return }
+ for next in 1...4 {
+ try? await Task.sleep(for: .milliseconds(next == 1 ? 150 : 280))
+ withAnimation(.spring(duration: 0.6, bounce: 0.25)) { beat = next }
+ }
+ }
+ }
+}
+
+/// Five bots bobbing out of step: the "persistent, named" part of the pitch, without words.
+private struct Crew: View {
+ let shown: Bool
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ private let members: [(shape: String, color: String, size: CGFloat, x: CGFloat, y: CGFloat, mood: CharacterAvatar.Mood)] = [
+ ("blob", "blue", 92, 0, 0, .working),
+ ("squircle", "orange", 64, -104, -34, .idle),
+ ("teardrop", "violet", 58, 100, -46, .working),
+ ("hex", "green", 48, -76, 64, .idle),
+ ("cloud", "magenta", 52, 84, 58, .needsInput),
+ ]
+
+ var body: some View {
+ TimelineView(.animation(paused: reduceMotion || !shown)) { context in
+ let t = context.date.timeIntervalSinceReferenceDate
+ ZStack {
+ ForEach(members.indices, id: \.self) { i in
+ let m = members[i]
+ CharacterAvatar(shape: m.shape, color: m.color, size: m.size, mood: m.mood)
+ .offset(x: m.x, y: m.y + (reduceMotion ? 0 : sin(t * 1.3 + Double(i) * 1.7) * 5))
+ .scaleEffect(shown ? 1 : 0.3)
+ .opacity(shown ? 1 : 0)
+ .animation(.spring(duration: 0.7, bounce: 0.4).delay(Double(i) * 0.07), value: shown)
+ }
+ }
+ }
+ .frame(height: 200)
+ }
+}
+
+/// One exchange, played once: you ask, a bot works, a bot answers.
+private struct ChatGlimpse: View {
+ let shown: Bool
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @State private var replied = false
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 10) {
+ Text("Fix the flaky login test")
+ .bubble(Palette.bubbleUser)
+ .frame(maxWidth: .infinity, alignment: .trailing)
+ .rise(shown)
+
+ HStack(alignment: .bottom, spacing: 8) {
+ CharacterAvatar(shape: "blob", color: "blue", size: 28, mood: replied ? .idle : .working)
+ if replied {
+ Text("Done. It raced the session refresh; tests pass on fix/login.")
+ .bubble(Palette.bubbleAgent)
+ .transition(.opacity.combined(with: .scale(scale: 0.92, anchor: .bottomLeading)))
+ } else {
+ Text("Working…")
+ .font(.subheadline)
+ .foregroundStyle(Palette.tertiary)
+ .transition(.opacity)
+ }
+ }
+ .rise(shown)
+ }
+ .accessibilityElement(children: .combine)
+ .onChange(of: shown) { _, shown in
+ guard shown else { return }
+ Task {
+ try? await Task.sleep(for: .seconds(reduceMotion ? 0 : 1.6))
+ withAnimation(Motion.reduced(.spring(duration: 0.45, bounce: 0.2), reduceMotion)) { replied = true }
+ }
+ }
+ }
+}
+
+private extension View {
+ func bubble(_ fill: Color) -> some View {
+ font(.subheadline)
+ .foregroundStyle(Palette.text)
+ .padding(.horizontal, 14)
+ .padding(.vertical, 9)
+ .background(fill, in: RoundedRectangle(cornerRadius: 18))
+ }
+
+ /// Fades up into place once `shown`.
+ func rise(_ shown: Bool) -> some View {
+ opacity(shown ? 1 : 0).offset(y: shown ? 0 : 14)
+ }
+}