|
History
|
||
|---|---|---|
| .. | ||
| CoreFFI | ||
| Zeron | ||
| Zeron.xcodeproj | ||
| ZeronLiveActivity | ||
| ZeronShared | ||
| ZeronTests | ||
| ZeronUITests | ||
| README.md | ||
| Zeron.entitlements | ||
Zeron for iOS
A UIKit viewport onto the zeron mesh, built on the Rust mobile core. The phone is a peer device: it mirrors the workspace registry, joins per-chat session rooms, and drives remote engines through the durable command ledger. No agent runs on the phone.
Rust decides what to paint and where; Swift paints, scrolls and handles
gestures. Everything in Rust is platform-neutral — the future Android app
links the same library. See docs/mobile-rewrite.md.
Build & run
Requires Xcode 26+ and a Rust toolchain with the iOS targets:
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
cd apps/ios
xcodebuild -project Zeron.xcodeproj -scheme Zeron \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' build
The Zeron target's Rust core build phase runs scripts/ios/build-core.sh,
which builds crates/mobile for the active platform (always optimized — the
mobile cargo profile) and refreshes the committed UniFFI bindings in
Zeron/Core/Generated/. ZERON_SKIP_CORE=1 reuses the last built library
when iterating on Swift only.
Layout
Zeron/
App/ AppDelegate, SceneDelegate, AppModel (owns CoreClient; maps
workspace snapshots to view models; Keychain credentials)
Core/ Generated UniFFI bindings; Fonts (the exact bytes Rust measures,
registered with CoreText) + CoreText fallback measurer
Design/ Palette (Zeron color roles → light/dark), Glass helpers,
cell-grid status glyph, harness brand marks
Transcript/ TranscriptListView (virtualized scroll host over LayoutFrame),
RowView/RowModel (CoreText painter for Rust display lists,
streaming veil), FrameRelay
Session/ SessionViewController, SessionSource (Core/Fixture), new-session
canvas
Companions/ What works alongside a session: the companions panel (sheet on
iPhone, inspector column beside the session on iPad / unfolded
iPhone Duo), subagent transcripts, side chats, terminals (grid
painter + key bar over the core's emulator)
Composer/ ComposerBar (glass capsule ⇄ card with inline context chips;
send/queue/steer/stop), question and queue panels, attachments
Threads/ Sessions (foldable sidebar sections)/folder/search lists,
cells, new-project folder browser
Shell/ Tab bar (Sessions, Settings, search; "New session" accessory
with live summary), sign-in
Debug/ Transcript lab + hitch meter
ZeronLiveActivity/ Widget extension: the voice call's Live Activity (Dynamic
Island + Lock Screen), with the orb's states exported from
zeron-orb as vector assets
ZeronShared/ Compiled into the app and the extension: the activity's
attributes and its mute/end App Intents
Companions
A session's subagents, side chats and terminals (Companions/):
- Subagents come off the transcript (
SessionHandle.subagents()): a spawn's card opens its own transcript, read-only — the host's live doc while it runs, its uploaded copy once done (TranscriptView.attachSubagent). - Side chats are child chats: a fresh one shares its parent's host,
folder and agent (
CoreClient.createSideChat; closed unused, it's deleted), a fork copies the conversation through its latest reply (forkSideChat, answered by the chat's host). - Terminals are PTYs on the chat's host.
crates/mobile/src/terminalruns the desktop's emulator and echo predictor (crates/term) over the client's resumableTerminalLink; Swift paints frames and sends keys. Terminals persist per chat and reattach after a relaunch.
Transcript pipeline
zeron-clientapplies session-doc updates incrementally (O(changed entries)) and publishes immutable snapshots.TranscriptView.attach(client, chatId)subscribes in Rust; the layout thread turns entries into rows (one per markdown block / user message / tool group), reparses streaming markdown incrementally, and measures every row withzeron-textat the viewport width.- Each pass publishes a
LayoutFrame: exact heights + prefix-sum offsets.rowsIn(y0, y1)is a binary search;display(i)builds a display list (text runs at exact positions, boxes, links, scrollers, widgets). TranscriptListViewpositions reusableRowViews at those offsets and paints runs with CoreText at the Rust coordinates — measurement and rendering can't disagree. Display models for rows beyond the viewport are prefetched off the main thread.- Agent visuals (
show_visualLuau scripts) get a worker thread each (crates/mobile/src/visual): it runs the script, lays the node tree out, draws canvases and charts as vector paint, renders scenes and shaders with wgpu, and reports its height back to the row.VisualViewpaints what arrives (rasterized on the worker thread) and forwards touches; the demo's "Agent visuals" chat (-demo -route chat:chat-visuals) has one of each.
Launch arguments
| Arg | Effect |
|---|---|
-demo |
Offline demo workspace (Rust DemoHost: registry, docs, streaming replies) |
-fast / -longreply |
Demo stream speed / reply length |
-big / -huge |
Demo transcripts with 120 / 600 turns |
-route chat:<id> / new / more / search |
Open a screen at launch |
-send-on-open <text> |
With -route chat:<id>: send this once the session is open, for rigs driving a real stack (DEBUG) |
-network-offline |
Report no network path whatever the OS says: a simulator shares its Mac's network (DEBUG) |
-no-relay-layer |
Behave as a build without the relay layer does: an old phone in an account of new devices (DEBUG) |
-companions / -terminal [-terminal-demo] / -subagent <tool id> / -side-chat <id> |
With -route chat:<id>: open its companions panel, a terminal (typing a scripted demo), a subagent, or a side chat (DEBUG) |
-signedout |
Clear stored credentials |
-dev <userId> <orgId> [-edge <url>] |
Dev bearer against an AUTH_MODE=dev edge (e.g. wrangler dev); not persisted |
-harness <id> |
Default harness for new sessions (mock for live-stack tests) |
-bench (with -lab) |
Display-link fling benchmark; writes Documents/bench.json |
-measureopen |
Session open latency; writes Documents/open.json |
-lab [-turns N] [-autostream] [-autoscroll] [-top] [-meter] |
Transcript lab over fixture markdown, with an on-screen hitch meter |
Tests
# Rust
cargo test -p zeron-text -p zeron-markdown -p zeron-client -p zeron-mobile
cargo test --release -p zeron-mobile --lib bench_layout -- --ignored --nocapture
# Line-break accuracy vs CoreText (same font bytes), flows, hitch benchmarks
xcodebuild … -only-testing:ZeronTests/LineBreakAccuracyTests test
xcodebuild … -only-testing:ZeronUITests/SessionFlowTests test
xcodebuild … -only-testing:ZeronUITests/ScrollPerformanceTests test
Live stack (real edge + headless engine; see ZeronUITests/LiveStackTests.swift):
(cd edge && npx wrangler dev --port 27650 --var AUTH_MODE:dev) &
ZERON_DATA_DIR=/tmp/e2e ZERON_IPC_PORT=27811 ZERON_EDGE_URL=http://localhost:27650 \
ZERON_EDGE_TOKEN=alice@org1 ZERON_ORG_ID=org1 ZERON_HARNESS=mock target/debug/zeron headless &
TEST_RUNNER_ZERON_LIVE_EDGE=http://localhost:27650 xcodebuild … -only-testing:ZeronUITests/LiveStackTests test
The test launches the app with -harness mock: a chat's configured harness
wins over the engine's ZERON_HARNESS default, so without it a real agent
would run.
Session notifications
The edge sends them (edge/src/push-notify.ts, registry-room.ts): when a
session's registry row changes it applies the desktop's rule (run finished,
waiting on your input, run failed) and pushes to every phone that registered
with POST /registry/:org/push-target. The app asks for permission the first
time a session is started from the phone (or from Settings → Notifications),
registers its APNs token with the choices from Settings, stays quiet while
open, and opens the session a notification is tapped for.
Setup once per deployment: an APNs auth key (Apple Developer → Keys →
Apple Push Notifications service), then wrangler secret put APNS_KEY_P8 (the
.p8 contents) and wrangler secret put APNS_KEY_ID in edge/. The
TestFlight workflow enables the Push capability on the App ID itself.
/registry/:org/stats shows registered phones and recent deliveries.
TestFlight release
Run the TestFlight workflow from GitHub Actions on main. It installs the
Rust iOS targets, selects the next build number from App Store Connect,
archives (device, Release — the Rust core builds in the archive) with
automatic signing, and uploads a TestFlight build (internal, or external with
beta review). Secrets: AC_API_KEY_P8, AC_API_KEY_ID,
AC_API_ISSUER_ID.