Let an AI model use a real iPhone with a $7 ESP32: AirPlay eyes, USB HID hands, any OpenAI-compatible vision model. No Mac, no developer account, no jailbreak.
Add home status refresh through pull and character gestures
Henryc995e419c895
diff --git a/docs/home-status-refresh-2026-10-16.md b/docs/home-status-refresh-2026-10-16.mdnew file mode 100644index 0000000..c8fc388--- /dev/null+++ b/docs/home-status-refresh-2026-10-16.md@@ -0,0 +1,9 @@+# Home status refresh++Source: `c12039631ee46c22c83da36fa0c4af0a43d6daa3`. The source checkout had only untracked `ios/fastlane/`, which was left untouched. Implementation used the isolated `codex/home-refresh` worktree.++Pulling down the Agent list or releasing a tap/drag on its character refreshes readiness. Existing character expressions remain available. Requests are coalesced while refreshing and for two seconds afterward.++Refresh reads fresh board status and signal strength, reconnecting to the remembered board when needed. It preserves pairing, shows progress and actionable failures, and clears stale failure text when fresh status arrives. Model readiness remains the existing local validation state; this gesture does not run a model inference test.++Validation: signed iOS device build succeeded; whitespace checks passed. Installation was attempted, but CoreDevice reported the user's iPhone unavailable. Physical gesture behavior and installation remain unverified for this change.diff --git a/ios/IPhoneAgent/App/AppModel.swift b/ios/IPhoneAgent/App/AppModel.swiftindex 7759418..5ac9152 100644--- a/ios/IPhoneAgent/App/AppModel.swift+++ b/ios/IPhoneAgent/App/AppModel.swift@@ -25,6 +25,9 @@ import UIKitlet pointer: Pointerlet agent: AgentLoop@Published private(set) var log: [LogLine] = []+ @Published var refreshingStatus = false+ @Published var statusRefreshError: String?+ private var lastStatusRefresh = 0.0@Published var modelError: String?@Published var modelTestStarted: Date?@Published var modelTestSeconds: Double?@@ -102,6 +105,7 @@ import UIKit}board.onVideo = { [weak self] in self?.feed.receive($0) }board.onStatus = { [weak self] s in+ self?.statusRefreshError = nilself?.feed.mirroring = s.ap == "streaming"if let up = s.up { self?.feed.boardClock(ms: up) }self?.metrics.status(s)@@ -237,6 +241,24 @@ import UIKit}}+ /// Shared by pull-to-refresh and character interactions; rapid pokes coalesce.+ func refreshHomeStatus() async {+ guard !refreshingStatus, now() - lastStatusRefresh > 2 else { return }+ refreshingStatus = true+ statusRefreshError = nil+ defer { refreshingStatus = false; lastStatusRefresh = now(); publishWidget() }+ do {+ try await board.refreshStatus()+ runs.reload()+ say("Home status refreshed")+ } catch is CancellationError {+ return+ } catch {+ statusRefreshError = error.localizedDescription+ say("Home status refresh: \(error.localizedDescription)")+ }+ }+func pingLLM() async {guard modelTestStarted == nil else { return }if MockMode.on {diff --git a/ios/IPhoneAgent/Board/BoardLink.swift b/ios/IPhoneAgent/Board/BoardLink.swiftindex 306b6d0..fe833b0 100644--- a/ios/IPhoneAgent/Board/BoardLink.swift+++ b/ios/IPhoneAgent/Board/BoardLink.swift@@ -29,6 +29,7 @@ import Foundationvar onLinkUp: (() -> Void)?var onLinkDown: (() -> Void)?private var lastNotify = 0.0 // last notification of any kind, to tell a supervision timeout from a peer drop+ private var statusRevision = 0private var readySince = 0.0var log: (String) -> Void = { print($0) }@@ -62,6 +63,38 @@ import Foundation// MARK: - scan / pair+ /// Refresh readiness without forgetting pairing or changing streaming/gesture state.+ func refreshStatus() async throws {+ if mock { return }+ guard state == .poweredOn else {+ throw DeviceError(message: String(localized: "Turn on Bluetooth to refresh the board status."))+ }+ if !connected {+ if pairedID != nil { reconnect() }+ else if !scanning { scan() }+ let deadline = now() + 8+ while !connected && now() < deadline && (connecting || linking || scanning) {+ try await Task.sleep(for: .milliseconds(200))+ }+ }+ guard connected, let peripheral, let characteristic = chars[BoardUUID.status] else {+ let message = !lastError.isEmpty ? lastError : pairedID == nil+ ? String(localized: "Tap Board to choose a device.")+ : String(localized: "Still reconnecting. Keep the board nearby.")+ throw DeviceError(message: message)+ }+ let revision = statusRevision+ peripheral.readValue(for: characteristic)+ peripheral.readRSSI()+ let deadline = now() + 3+ while connected && revision == statusRevision && now() < deadline {+ try await Task.sleep(for: .milliseconds(100))+ }+ guard connected, statusRevision != revision else {+ throw DeviceError(message: String(localized: "No fresh board status received. Try again."))+ }+ }+func scan() {guard state == .poweredOn, !mock, !connected, !connecting, !linking else { return }found = []@@ -467,6 +500,7 @@ extension BoardLink: CBPeripheralDelegate {case BoardUUID.status:if let s = BoardStatus.decode(v) {let merged = status?.merged(with: s) ?? s+ statusRevision += 1status = mergedonStatus?(merged)}diff --git a/ios/IPhoneAgent/Localizable.xcstrings b/ios/IPhoneAgent/Localizable.xcstringsindex dfcbb7f..f568561 100644--- a/ios/IPhoneAgent/Localizable.xcstrings+++ b/ios/IPhoneAgent/Localizable.xcstrings@@ -5467,6 +5467,66 @@}}}+ },+ "Refreshing status…" : {+ "localizations" : {+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "正在刷新状态…"+ }+ }+ }+ },+ "Refresh status" : {+ "localizations" : {+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "刷新状态"+ }+ }+ }+ },+ "Turn on Bluetooth to refresh the board status." : {+ "localizations" : {+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "请开启蓝牙后刷新设备状态。"+ }+ }+ }+ },+ "Tap Board to choose a device." : {+ "localizations" : {+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "点按 Board 选择设备。"+ }+ }+ }+ },+ "Still reconnecting. Keep the board nearby." : {+ "localizations" : {+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "仍在重新连接,请将设备放近一些。"+ }+ }+ }+ },+ "No fresh board status received. Try again." : {+ "localizations" : {+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未收到最新设备状态,请重试。"+ }+ }+ }}},"version" : "1.0"diff --git a/ios/IPhoneAgent/UI/HomeView.swift b/ios/IPhoneAgent/UI/HomeView.swiftindex 310e686..d4d4946 100644--- a/ios/IPhoneAgent/UI/HomeView.swift+++ b/ios/IPhoneAgent/UI/HomeView.swift@@ -34,6 +34,7 @@ struct HomeView: View {intentSection}.listStyle(.insetGrouped)+ .refreshable { await app.refreshHomeStatus() }.scrollDismissesKeyboard(.interactively).navigationTitle(Text(verbatim: settings.agentName)).navigationBarTitleDisplayMode(.inline)@@ -100,7 +101,8 @@ struct HomeView: View {private var hero: some View {VStack(spacing: Space.m) {- PokeableFace(mood: editing ? .listening : app.mood, look: lookAt, busy: app.agent.running)+ PokeableFace(mood: editing ? .listening : app.mood, look: lookAt, busy: app.agent.running,+ onInteract: { Task { await app.refreshHomeStatus() } }).frame(width: 128, height: 143).padding(.top, Space.s)Text(greeting)@@ -109,6 +111,12 @@ struct HomeView: View {.multilineTextAlignment(.center).padding(.horizontal, Space.xl)StatusChips(app: app, board: board, pointer: app.pointer, calibrator: app.calibrator)+ if app.refreshingStatus {+ ProgressView("Refreshing status…").font(.footnote)+ } else if let error = app.statusRefreshError {+ Text(verbatim: error).font(.footnote).foregroundStyle(.secondary)+ .multilineTextAlignment(.center).padding(.horizontal, Space.l)+ }}.frame(maxWidth: .infinity).padding(.bottom, Space.s)diff --git a/ios/IPhoneAgent/UI/PokeableFace.swift b/ios/IPhoneAgent/UI/PokeableFace.swiftindex 437c436..ac12b01 100644--- a/ios/IPhoneAgent/UI/PokeableFace.swift+++ b/ios/IPhoneAgent/UI/PokeableFace.swift@@ -13,6 +13,7 @@ struct PokeableFace: View {var mood: Moodvar look: CGPoint = .zerovar busy = false+ var onInteract: (() -> Void)?@Environment(\.accessibilityReduceMotion) private var reduceMotion@State private var override: Mood?@State private var gaze: CGPoint?@@ -37,7 +38,8 @@ struct PokeableFace: View {.contentShape(Rectangle()).gesture(touch(in: g.size))}- .accessibilityAction(named: Text("Poke")) { tapped() }+ .accessibilityAction(named: Text("Poke")) { tapped(); onInteract?() }+ .accessibilityAction(named: Text("Refresh status")) { onInteract?() }}// MARK: - gesture@@ -85,6 +87,7 @@ struct PokeableFace: View {}private func ended() {+ defer { onInteract?() }pet?.cancel()let held = touchStart.map { Date().timeIntervalSince($0) } ?? 0touchStart = nil