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 bot list and chats use the system bar with Liquid Glass; usage can show each provider's original icon; Live Activity shows the current step and elapsed time; widget setup gets an animated guide

leepokai3cf7c91c92c8
diff --git a/.github/workflows/cloud.yml b/.github/workflows/cloud.yml
index 08d76561..3cd2171b 100644
--- a/.github/workflows/cloud.yml
+++ b/.github/workflows/cloud.yml
@@ -3,9 +3,9 @@ name: codync-cloud
on:
push:
branches: [main, v2]
- paths: ["cloud/**", "relay/**", "docs/remote-relay-vectors.json", ".github/workflows/cloud.yml"]
+ paths: ["cloud/**", "relay/**", "docs/reference/fixtures/remote-relay-vectors.json", ".github/workflows/cloud.yml"]
pull_request:
- paths: ["cloud/**", "relay/**", "docs/remote-relay-vectors.json"]
+ paths: ["cloud/**", "relay/**", "docs/reference/fixtures/remote-relay-vectors.json"]
jobs:
cloud:
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index 5b5461d1..bd2dd20b 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -3,9 +3,9 @@ name: CodyncKit
on:
push:
branches: [main, v2]
- paths: ["kit/**", "docs/remote-relay-vectors.json", ".github/workflows/kit.yml"]
+ paths: ["kit/**", "docs/reference/fixtures/remote-relay-vectors.json", ".github/workflows/kit.yml"]
pull_request:
- paths: ["kit/**", "docs/remote-relay-vectors.json"]
+ paths: ["kit/**", "docs/reference/fixtures/remote-relay-vectors.json"]
jobs:
test:
diff --git a/AGENTS.md b/AGENTS.md
index 2f9f93d2..5dce36c5 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -30,7 +30,7 @@ Whenever you build and install/run a new build, stop the old copies so nothing s
Use four-space indentation for Swift and Rust. Follow Swift 6 strict concurrency, SwiftUI, and structured `async/await`; avoid unchecked sendability. Rust uses edition 2024, rustfmt, and Clippy; avoid `unwrap()` outside tests.
-Name Swift files after their main `UpperCamelCase` type; use `snake_case.rs` and `kebab-case.ts`. Follow role suffixes such as `View`, `Row`, and `Store`. See `docs/structure.md` and `CLAUDE.md` for architectural conventions.
+Name Swift files after their main `UpperCamelCase` type; use `snake_case.rs` and `kebab-case.ts`. Follow role suffixes such as `View`, `Row`, and `Store`. See `docs/architecture/file-structure.md` and `CLAUDE.md` for architectural conventions.
- No native/system UI at all: no `Menu`/`Picker`, `.switch` toggles, `Form`/`List` styling, `confirmationDialog`/`alert`, `ProgressView`, `.sheet`/`.popover`/`.fullScreenCover`, `.toolbar`/navigation bars, `TabView`, `ContentUnavailableView`. Use `kit/Sources/CodyncUI/Controls.swift` + `Chrome.swift` (`.codyncSheet`, `ModalHeader`, `ScreenHeader`, `TabBar`, `.codyncMenu`, `.codyncDialog`, `ToggleStyle.codync`). Every tap that shows/hides something animates (`Motion`). Anything with a background fill gets no border line.
diff --git a/CLAUDE.md b/CLAUDE.md
index 03ac1d35..20fee374 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -20,18 +20,18 @@ Bot-based remote for coding agents: persistent named bots on your computer, mess
- No native/system UI at all: no `Menu`/`Picker`, `.switch` toggles, `Form`/`List` styling, `confirmationDialog`/`alert`, `ProgressView`, `.sheet`/`.popover`/`.fullScreenCover`, `.toolbar`/navigation bars, `TabView`, `ContentUnavailableView`. Use `kit/Sources/CodyncUI/Controls.swift` + `Chrome.swift` (`.codyncSheet`, `ModalHeader`, `ScreenHeader`, `TabBar`, `.codyncMenu`, `.codyncDialog`, `ToggleStyle.codync`). Every tap that shows/hides something animates (`Motion`). Anything with a background fill gets no border line.
- `host/` — **codync-host** (Rust, macOS + Linux). Detects installed harnesses (`backends.rs`: login-shell PATH + known dirs) and the ACP registry (`registry.rs`, cached in `~/.codync/registry.json`, binaries under `~/.codync/agents`). Drives agents over **ACP** (JSON-RPC on stdio, hand-rolled in `acp.rs`, updates kept as `serde_json::Value` so new adapter variants never break parsing). One actor per bot (`bot.rs`) owns the agent process + session and maps `session/update` onto transcript entries.
- **Chat ≠ session**: a bot is one endless transcript (SQLite `entries`, ordered by `seq`); the ACP session underneath is resumed with `session/load` or replaced by *New session*.
-- **Group chats and threads** are host features every client drives through the same methods (`send` with `threadId`, `thread`, `createBot {kind: group}`); clients never route, parse mentions or count replies themselves. A group is a roster row whose members answer in their own sessions (Grok Bot's room turns); a thread on a bot's message is a forked session: [docs/groups-and-threads.md](docs/groups-and-threads.md).
-- Bot collaboration: built-in `team` MCP (`team.rs`) lists visible bots and asks one for a reply through its actor queue. Requests are separate turns, cycle-checked and cancellable; native subagents stay with the harness. See [docs/bot-collaboration.md](docs/bot-collaboration.md).
-- **Context & memory** (Grok Bot's design): frozen instruction snapshot per session + compaction epoch (Claude gets it as a system prompt), profile edits as update blocks, per-bot memory files written by a keeper agent, busy-time messages folded into one turn, interrupted turns resumed: [docs/context-and-memory.md](docs/context-and-memory.md).
+- **Group chats and threads** are host features every client drives through the same methods (`send` with `threadId`, `thread`, `createBot {kind: group}`); clients never route, parse mentions or count replies themselves. A group is a roster row whose members answer in their own sessions (Grok Bot's room turns); a thread on a bot's message is a forked session: [docs/features/groups-and-threads.md](docs/features/groups-and-threads.md).
+- Bot collaboration: built-in `team` MCP (`team.rs`) lists visible bots and asks one for a reply through its actor queue. Requests are separate turns, cycle-checked and cancellable; native subagents stay with the harness. See [docs/features/bot-collaboration.md](docs/features/bot-collaboration.md).
+- **Context & memory** (Grok Bot's design): frozen instruction snapshot per session + compaction epoch (Claude gets it as a system prompt), profile edits as update blocks, per-bot memory files written by a keeper agent, busy-time messages folded into one turn, interrupted turns resumed: [docs/features/context-and-memory.md](docs/features/context-and-memory.md).
- **Chat shows only**: user messages, the *final* agent message of each turn (`data.final`), permission cards, notices. Narration, thoughts, tool calls, plans are trace entries (Full conversation sheet).
- **Sync**: every mutation stamps a global `rev`. Clients call `GET /events?since=<rev>` (catch-up in rev order, then live). Emission happens under `Hub::emit_lock` so events leave in rev order. Clients upsert by id; never skip undecodable events (the iOS app rewinds to rev 0).
- API: `POST /api/<method>` + SSE with the bearer token (`~/.codync/token`) is **loopback only** (Mac app, SSH tunnel, local helpers). Phones and other remote clients use the E2E channel (`/channel` direct, or the Cloudflare relay). Default port **19222**.
-- Remote access (Cloudflare relay primary, direct LAN/Tailscale alternative, accounts, SSH): [docs/remote-relay-spec.md](docs/remote-relay-spec.md).
+- Remote access (Cloudflare relay primary, direct LAN/Tailscale alternative, accounts, SSH): [docs/reference/remote-relay.md](docs/reference/remote-relay.md).
- Remote screen (`host/src/screen.rs` is the reference): phones view/control the computer over WebRTC (hardware H.264, non-trickle SDP relayed by `screenOffer`, input on data channels `input` / `input-fast`); bots get the built-in `computer` MCP server (`codync-host mcp computer`, `host/src/mcp.rs`) when their `computer` flag is on. Capture/input live in a helper on `~/.codync/screen.sock`: `apps/screen` (macOS, launchd agent via `SMAppService`, owns the TCC grants) or `apps/screen-linux` (`codync-screen`: portals + GStreamer, started by the host). Off by default; `setScreenEnabled` is accepted only from loopback. An interactive phone takes over (bots may only look).
- Multiple computers per account are future work, not a current priority: the product targets one computer. The multi-computer structure (`AccountStore`, `BotReference`) stays because relay/accounts/SSH build on it; don't extend or polish multi-computer features unless asked.
-- Environments: **dev** (`dev-api.codync.dev`, Clerk development instance, Debug builds) and **main** (`api.codync.dev`, Clerk production, Release builds); `apps/shared/Config/<env>.plist` becomes `AccountConfig.plist`. Details: [spec §14.0](docs/remote-relay-spec.md).
+- Environments: **dev** (`dev-api.codync.dev`, Clerk development instance, Debug builds) and **main** (`api.codync.dev`, Clerk production, Release builds); `apps/shared/Config/<env>.plist` becomes `AccountConfig.plist`. Details: [spec §14.0](docs/reference/remote-relay.md).
- Push: iOS registers its APNs token with `relay/` → gets an AES-GCM ticket → gives it (plus its X25519 push key) to the host; the host seals title/body to that key and a Notification Service Extension opens it, so `relay/` sees only generic text. Only two alert kinds: *needs you* and *done*, suppressed while the iOS app is connected.
-- Voice call (iPhone): on-device speech in, bot's final replies read aloud; the host sees plain messages. Pro cloud-realtime plan: [docs/voice-call.md](docs/voice-call.md).
+- Voice call (iPhone): on-device speech in, bot's final replies read aloud; the host sees plain messages. Pro cloud-realtime plan: [docs/features/voice-call.md](docs/features/voice-call.md).
- Usage: local only — `claude -p /usage --no-session-persistence`, the Claude status line (`codync-host statusline`, wrapping any existing one), Claude ACP `usage_update` rate-limit meta, Codex rollout files. Never call provider APIs with agent credentials.
- macOS app is thin: embeds `codync-host` in `Contents/MacOS` (Xcode post-build script runs cargo), installs it as a launchd agent via `codync-host install`; menu bar shows status/pairing/usage and opens the native chat window (NavigationSplitView over `CodyncUI`). Not sandboxed, not Mac App Store (the host must spawn CLIs).
@@ -74,7 +74,7 @@ Whenever you build and install/run a new build, stop the old copies so nothing s
## Layout & naming
-Folder layout, file naming and shared terms: [docs/structure.md](docs/structure.md). Follow it when adding or moving files.
+Folder layout, file naming and shared terms: [docs/architecture/file-structure.md](docs/architecture/file-structure.md). Follow it when adding or moving files.
## Keeping this file short
diff --git a/README.md b/README.md
index 10089f06..6b3f2e44 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ iPhone · Mac window · Linux (GTK) ⇄ HTTP + SSE ⇄ codync-host ⇄ ACP
```
- **Bots** have a name, a character avatar, standing instructions, an agent backend, a project folder and a permission policy. Each bot is **one endless conversation**; the agent sessions underneath are an implementation detail (resumed with `session/load`, restarted with *New session*).
-- **Bots can ask each other for help.** Tell one “ask Reviewer to check these changes.” The built-in `team` MCP server lets it discover your other visible bots and wait for a reply. Requests appear in both chats; each recipient keeps its own agent, folder and approvals. Native subagents stay under the coding agent's control. See [bot collaboration](docs/bot-collaboration.md).
+- **Bots can ask each other for help.** Tell one “ask Reviewer to check these changes.” The built-in `team` MCP server lets it discover your other visible bots and wait for a reply. Requests appear in both chats; each recipient keeps its own agent, folder and approvals. Native subagents stay under the coding agent's control. See [bot collaboration](docs/features/bot-collaboration.md).
- **The chat only shows what matters**: your messages, each turn's final reply, approval cards and notices. Every tool call, diff, plan and thought is one tap away in *Full conversation*. While a bot works, its row shows what it's doing right now.
- **Agents are detected automatically**: the host hydrates PATH from your login shell (plus Homebrew, ~/.local/bin, nvm, bun, volta, asdf, mise, pnpm…), finds every harness you have installed, and prefers its native ACP mode. Anything else in the official [ACP registry](https://agentclientprotocol.com/registry) can be picked too — Codync fetches it on first use (npx, uvx or a checksummed binary).
- **codync-host** (Rust, macOS + Linux) runs on your computer. It speaks the [Agent Client Protocol](https://agentclientprotocol.com) to each agent, keeps transcripts in SQLite, and serves the phone. Every change carries a global `rev`, so the phone reconnects with `since: rev` and never misses anything.
diff --git a/apps/ios/App/Push.swift b/apps/ios/App/Push.swift
index 971bbe8f..9ace10d6 100644
--- a/apps/ios/App/Push.swift
+++ b/apps/ios/App/Push.swift
@@ -150,7 +150,7 @@ final class LiveActivities {
private func finishedRequest(_ id: UUID) { requests[id] = nil }
private nonisolated static func request(attributes: BotActivityAttributes, client: HostClient) async {
- // Status only: pushes never carry free text, so local updates don't either.
+ // Start with status only. Later foreground updates may add the current ACP step locally.
let state = BotActivityAttributes.ContentState(status: "working", activity: "", startedAt: .now)
do {
try Task.checkCancellation()
@@ -172,7 +172,9 @@ final class LiveActivities {
guard Self.find(ref) != nil else { return }
let state = BotActivityAttributes.ContentState(
status: bot.status,
- activity: "",
+ // ACP activity is already visible in the app. Show it in the local Live Activity
+ // while this phone is connected; APNs payloads continue to contain no free text.
+ activity: bot.activity,
startedAt: bot.startedAt.map(Date.init(milliseconds:))
)
let working = bot.isWorking
diff --git a/apps/ios/Views/AccountSwitcherView.swift b/apps/ios/Views/AccountSwitcherView.swift
index 1dfb310c..e2f8a69c 100644
--- a/apps/ios/Views/AccountSwitcherView.swift
+++ b/apps/ios/Views/AccountSwitcherView.swift
@@ -14,7 +14,6 @@ struct AccountSwitcherButton: View {
.foregroundStyle(Palette.secondary)
}
}
- .buttonStyle(PressScale())
.accessibilityLabel("Switch account")
.accessibilityValue(account.email ?? "Local pairing")
}
diff --git a/apps/ios/Views/BotListView.swift b/apps/ios/Views/BotListView.swift
index e6da9198..56433fcd 100644
--- a/apps/ios/Views/BotListView.swift
+++ b/apps/ios/Views/BotListView.swift
@@ -21,7 +21,7 @@ struct BotListView: View {
let roster = accounts.roster
ScrollView {
LazyVStack(spacing: 0) {
- // One banner per computer that isn't reachable; the others keep working.
+ // Keep actionable offline warnings; transient connecting state lives in the header.
ForEach(accounts.computers) { computer in
if let store = accounts.store(for: computer.id), store.connection != .online {
ConnectionBanner()
@@ -44,15 +44,27 @@ struct BotListView: View {
.padding(.horizontal, 16)
}
.background(Palette.background)
- // Grok-style bare top bar: no visible title, just the buttons.
- .safeAreaInset(edge: .top, spacing: 0) {
- ScreenHeader {
+ .navigationTitle("Bots")
+ .navigationBarTitleDisplayMode(.inline)
+ .toolbar(.visible, for: .navigationBar)
+ .toolbar {
+ ToolbarItem(placement: .topBarLeading) {
AccountSwitcherButton()
- } title: {
- EmptyView()
- } trailing: {
- IconButton("Computers", systemImage: "desktopcomputer") { app.showComputers = true }
- IconButton("New", systemImage: "plus") { newMenu = true }
+ }
+ ToolbarItem(placement: .principal) {
+ // Keep the center empty when connected, while the system owns the bar's layout.
+ ZStack {
+ Color.clear.frame(width: 1, height: 1)
+ ConnectingIndicator(isConnecting: accounts.computers.contains {
+ accounts.store(for: $0.id)?.connection == .connecting
+ })
+ }
+ }
+ ToolbarItem(placement: .topBarTrailing) {
+ Button("Computers", systemImage: "desktopcomputer") { app.showComputers = true }
+ }
+ ToolbarItem(placement: .topBarTrailing) {
+ Button("New", systemImage: "plus") { newMenu = true }
.disabled(onlineStores.isEmpty)
.codyncMenu(isPresented: $newMenu) {
[
@@ -62,7 +74,6 @@ struct BotListView: View {
}
}
}
- .hidesSystemNavigationBar()
.refreshable {
for computer in accounts.computers { accounts.store(for: computer.id)?.restartStream() }
await accounts.refreshCloud()
diff --git a/apps/ios/Views/UsageView.swift b/apps/ios/Views/UsageView.swift
index d00a8766..13d6840d 100644
--- a/apps/ios/Views/UsageView.swift
+++ b/apps/ios/Views/UsageView.swift
@@ -49,12 +49,14 @@ struct UsageView: View {
private struct ProviderCard: View {
let provider: UsageProvider
@Binding var collapsed: Bool
+ @AppStorage(SharedStore.usageIconStyleKey, store: UserDefaults(suiteName: SharedStore.appGroup))
+ private var usageIconStyle = UsageIconStyle.character.rawValue
@Environment(\.accessibilityReduceMotion) private var reduceMotion
var body: some View {
VStack(alignment: .leading, spacing: 12) {
HStack(spacing: 10) {
- CharacterAvatar(shape: provider.mascotShape, tint: provider.widgetTint, size: 22)
+ ProviderMascot(provider, size: 22, style: UsageIconStyle(rawValue: usageIconStyle) ?? .character)
.frame(width: 34, height: 34)
.background(provider.tint.opacity(0.12), in: RoundedRectangle(cornerRadius: 10, style: .continuous))
Text(provider.name).font(.subheadline.weight(.semibold)).foregroundStyle(Palette.text)
diff --git a/apps/ios/Views/WidgetGalleryView.swift b/apps/ios/Views/WidgetGalleryView.swift
index dc388fc3..54371c7f 100644
--- a/apps/ios/Views/WidgetGalleryView.swift
+++ b/apps/ios/Views/WidgetGalleryView.swift
@@ -17,6 +17,8 @@ struct WidgetGalleryView: View {
@State private var size = "medium"
@State private var hasWidget: Bool?
@State private var widgetCheckFailed = false
+ @AppStorage(SharedStore.usageIconStyleKey, store: UserDefaults(suiteName: SharedStore.appGroup))
+ private var usageIconStyle = UsageIconStyle.character.rawValue
private var provider: UsageProvider? { Usage.widgetPreview.providers.first { $0.id == providerID } }
@@ -87,7 +89,17 @@ struct WidgetGalleryView: View {
}
VStack(alignment: .leading, spacing: 12) {
- sectionLabel("More ways to stay up to date")
+ sectionLabel("Choose the look")
+ SegmentedChoice(selection: Binding(
+ get: { usageIconStyle },
+ set: { usageIconStyle = $0; WidgetCenter.shared.reloadTimelines(ofKind: "CodyncProviderUsage") }
+ ), options: [(UsageIconStyle.character.rawValue, "Character"), (UsageIconStyle.original.rawValue, "Original icon")])
+ Text("Applies to Usage on iPhone and in the Mac menu bar.")
+ .font(.caption).foregroundStyle(Palette.secondary)
+ }
+
+ VStack(alignment: .leading, spacing: 12) {
+ sectionLabel("Keep tasks in view")
Button { page = .lockScreen } label: {
Label("Lock Screen widgets", systemImage: "lock.rectangle").foregroundStyle(Palette.accent)
}
@@ -100,14 +112,15 @@ struct WidgetGalleryView: View {
.font(.subheadline)
.frame(maxWidth: .infinity, alignment: .leading)
- guide(number: "01", title: "Add the widget", icon: "plus.square.on.square",
- detail: "Touch and hold your Home Screen. Tap Edit, then Add Widget. Search for Codync and choose Bots or Provider usage.")
- guide(number: "02", title: "Make it yours", icon: "slider.horizontal.3",
- detail: "Touch and hold Provider usage, then tap Edit Widget to choose Claude or Codex. Widgets follow the account selected in Codync.")
- guide(number: "03", title: "On your Lock Screen", icon: "lock",
- detail: "Touch and hold your Lock Screen. Tap Customize, choose the Lock Screen, then tap the widget area. Select Codync to add Bots or Usage limits.")
- Text("Widgets show the last reported state. Open Codync for live updates and approvals.")
- .font(.caption).foregroundStyle(Palette.secondary)
+ VStack(alignment: .leading, spacing: 12) {
+ sectionLabel("Add a widget")
+ WidgetSetupAnimation()
+ Text("Touch and hold the Home Screen · Edit · Add Widget · Codync")
+ .font(.caption).foregroundStyle(Palette.secondary)
+ .frame(maxWidth: .infinity, alignment: .center)
+ }
+ Text("Widgets show the latest report. Open Codync for live updates and approvals.")
+ .font(.caption2).foregroundStyle(Palette.tertiary)
}
.padding(18)
.frame(maxWidth: 560)
@@ -172,25 +185,6 @@ struct WidgetGalleryView: View {
.accessibilityValue(status ?? (complete ? "Complete" : "Not complete"))
}
- private func guide(number: String, title: String, icon: String, detail: String) -> some View {
- VStack(alignment: .leading, spacing: 12) {
- sectionLabel(title)
- HStack(alignment: .top, spacing: 14) {
- VStack(spacing: 8) {
- Image(systemName: icon).font(.system(size: 24, weight: .light))
- Text(number).font(.system(size: 10, weight: .medium, design: .monospaced))
- .foregroundStyle(Palette.tertiary)
- }
- .frame(width: 42)
- Text(detail).font(.footnote).foregroundStyle(Palette.secondary)
- .fixedSize(horizontal: false, vertical: true)
- }
- .padding(18)
- .frame(maxWidth: .infinity, alignment: .leading)
- .background(Palette.surface, in: RoundedRectangle(cornerRadius: 20))
- }
- }
-
private func checkWidgets() {
let animation = Motion.reduced(Motion.layout, reduceMotion)
withAnimation(animation) { widgetCheckFailed = false }
@@ -205,3 +199,102 @@ struct WidgetGalleryView: View {
}
}
}
+
+private struct WidgetSetupAnimation: View {
+ private enum Stage: CaseIterable { case home, choose, placed }
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ var body: some View {
+ Group {
+ if reduceMotion {
+ stageContent(.placed)
+ } else {
+ PhaseAnimator(Stage.allCases) { stage in
+ stageContent(stage)
+ } animation: { _ in .easeInOut(duration: 0.55) }
+ }
+ }
+ }
+
+ private func stageContent(_ stage: Stage) -> some View {
+ ZStack {
+ RoundedRectangle(cornerRadius: 24).fill(Palette.bubbleAgent)
+ switch stage {
+ case .home:
+ VStack(spacing: 14) {
+ Text("9:41").font(.system(size: 32, weight: .medium, design: .rounded)).foregroundStyle(Palette.text)
+ HStack(spacing: 12) {
+ appIcon("message.fill", "Messages", .green)
+ appIcon("calendar", "Calendar", .red)
+ appIcon("photo.fill", "Photos", .blue)
+ appIcon("gearshape.fill", "Settings", .gray)
+ }
+ Label("Touch & hold", systemImage: "hand.tap.fill")
+ .font(.caption.weight(.medium)).foregroundStyle(Palette.secondary)
+ }
+ .transition(.opacity.combined(with: .scale(scale: 0.96)))
+ case .choose:
+ VStack(spacing: 10) {
+ HStack(spacing: 8) {
+ Image(systemName: "magnifyingglass").foregroundStyle(Palette.tertiary)
+ Text("Search widgets").foregroundStyle(Palette.secondary)
+ Spacer()
+ }
+ .font(.caption).padding(10).background(Palette.surface, in: Capsule())
+ HStack(spacing: 12) {
+ CharacterAvatar(shape: "hex", color: "gray", size: 38)
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Codync").font(.subheadline.weight(.semibold)).foregroundStyle(Palette.text)
+ Text("Bots · Usage").font(.caption).foregroundStyle(Palette.secondary)
+ }
+ Spacer()
+ Image(systemName: "plus.circle.fill").font(.title2).foregroundStyle(Palette.accent)
+ }
+ .padding(14).background(Palette.surface, in: RoundedRectangle(cornerRadius: 18))
+ }
+ .padding(20).transition(.opacity.combined(with: .move(edge: .trailing)))
+ case .placed:
+ HStack(spacing: 16) {
+ VStack(alignment: .leading, spacing: 10) {
+ Text("Codync").font(.caption.weight(.semibold)).foregroundStyle(Palette.text)
+ HStack(spacing: 6) {
+ CharacterAvatar(shape: "blob", color: "green", size: 24)
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Reviewer").font(.system(size: 10, weight: .semibold))
+ Text("Needs you").font(.system(size: 9)).foregroundStyle(Palette.warning)
+ }
+ Spacer(minLength: 0)
+ }
+ HStack(spacing: 6) {
+ CharacterAvatar(shape: "hex", color: "orange", size: 24)
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Builder").font(.system(size: 10, weight: .semibold))
+ Text("Running tests").font(.system(size: 9)).foregroundStyle(Palette.secondary)
+ }
+ Spacer(minLength: 0)
+ }
+ }
+ .padding(14).frame(width: 188, height: 142, alignment: .topLeading)
+ .background(Palette.surface, in: RoundedRectangle(cornerRadius: 22))
+ VStack(spacing: 10) {
+ Image(systemName: "checkmark.circle.fill").font(.system(size: 32)).foregroundStyle(Palette.added)
+ Text("Added").font(.caption.weight(.medium)).foregroundStyle(Palette.text)
+ }
+ .transition(.scale.combined(with: .opacity))
+ }
+ .transition(.opacity.combined(with: .scale(scale: 0.96)))
+ }
+ }
+ .frame(height: 190)
+ .padding(10)
+ .accessibilityLabel("Widget setup preview, \(stage == .home ? "hold the Home Screen" : stage == .choose ? "choose Codync" : "widget added")")
+ }
+
+ private func appIcon(_ symbol: String, _ title: String, _ tint: Color) -> some View {
+ VStack(spacing: 5) {
+ Image(systemName: symbol).font(.system(size: 17, weight: .medium)).foregroundStyle(.white)
+ .frame(width: 38, height: 38).background(tint, in: RoundedRectangle(cornerRadius: 11))
+ Text(title).font(.system(size: 8)).foregroundStyle(Palette.secondary)
+ }
+ }
+}
diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swift
index c0ab2069..c7c98f30 100644
--- a/apps/macos/App/CodyncMacApp.swift
+++ b/apps/macos/App/CodyncMacApp.swift
@@ -55,6 +55,8 @@ struct MenuView: View {
@Environment(\.openWindow) private var openWindow
@State private var showPairing = false
@State private var showSettings = false
+ @AppStorage(SharedStore.usageIconStyleKey, store: UserDefaults(suiteName: SharedStore.appGroup))
+ private var usageIconStyle = UsageIconStyle.character.rawValue
@Environment(\.accessibilityReduceMotion) private var reduceMotion
var body: some View {
@@ -237,6 +239,12 @@ struct MenuView: View {
IconButton("Settings", systemImage: "gearshape", selected: showSettings) { showSettings.toggle() }
.codyncMenu(isPresented: $showSettings) {
[
+ MenuItem("Usage icon · Character", selected: usageIconStyle == UsageIconStyle.character.rawValue) {
+ usageIconStyle = UsageIconStyle.character.rawValue
+ },
+ MenuItem("Usage icon · Original", selected: usageIconStyle == UsageIconStyle.original.rawValue) {
+ usageIconStyle = UsageIconStyle.original.rawValue
+ },
MenuItem("Open at login", selected: host.launchAtLogin) { host.setLaunchAtLogin(!host.launchAtLogin) },
MenuItem("Restart host", divider: true) { host.restart() },
MenuItem("Open log") { NSWorkspace.shared.open(host.logURL) },
@@ -353,11 +361,13 @@ private struct PermissionLine: View {
/// One provider's limits: its character and name, then a thin bar per limit in its color.
private struct UsageBlock: View {
let provider: UsageProvider
+ @AppStorage(SharedStore.usageIconStyleKey, store: UserDefaults(suiteName: SharedStore.appGroup))
+ private var usageIconStyle = UsageIconStyle.character.rawValue
var body: some View {
VStack(alignment: .leading, spacing: 7) {
HStack(spacing: 6) {
- CharacterAvatar(shape: provider.mascotShape, tint: provider.widgetTint, size: 15)
+ ProviderMascot(provider, size: 15, style: UsageIconStyle(rawValue: usageIconStyle) ?? .character)
Text(provider.name).font(.caption.weight(.semibold)).foregroundStyle(Palette.text)
Spacer()
Text("updated \(RelativeTime.short(Date(milliseconds: provider.updatedAt)))")
diff --git a/cloud/README.md b/cloud/README.md
index 1c99c449..6f69d5b6 100644
--- a/cloud/README.md
+++ b/cloud/README.md
@@ -1,6 +1,6 @@
# Codync cloud
-Cloudflare Worker for accounts and the off-LAN relay (spec: [docs/remote-relay-spec.md](../docs/remote-relay-spec.md)).
+Cloudflare Worker for accounts and the off-LAN relay (spec: [docs/reference/remote-relay.md](../docs/reference/remote-relay.md)).
- **`/v1` API** (`src/api.ts`): Clerk-authenticated account routes (devices, claims, computers, access
requests, grants), `Codync-Sig`-authenticated host routes (`/v1/host/*`), the Clerk webhook, and a
@@ -25,7 +25,7 @@ npm test # vitest in workerd: vectors, Codync-Sig, API, DO relay/mailbo
```
`test/ref.ts` is a device/host reference implementation on `@noble/*`, checked against
-`docs/remote-relay-vectors.json` and reused by the relay tests and the e2e harness.
+`docs/reference/fixtures/remote-relay-vectors.json` and reused by the relay tests and the e2e harness.
The vitest pool's bundled workerd may trail wrangler's; `vitest.config.ts` pins the test compatibility
date to the newest one it supports. `wrangler.toml` keeps the deploy date.
diff --git a/cloud/src/index.ts b/cloud/src/index.ts
index c93e1698..55ab44af 100644
--- a/cloud/src/index.ts
+++ b/cloud/src/index.ts
@@ -1,6 +1,6 @@
// Codync cloud: accounts (Clerk), computers, access grants (D1) and the end-to-end encrypted relay
// (one ComputerRelay Durable Object per computer). The cloud only ever sees ciphertext and routing
-// metadata; the host stays the sole authority on which devices may decrypt (docs/remote-relay-spec.md).
+// metadata; the host stays the sole authority on which devices may decrypt (docs/reference/remote-relay.md).
import * as api from "./api";
import { ApiError, type Ctx } from "./api";
diff --git a/cloud/test/ref.ts b/cloud/test/ref.ts
index 47ba7638..d62a2638 100644
--- a/cloud/test/ref.ts
+++ b/cloud/test/ref.ts
@@ -1,5 +1,5 @@
// Reference device/host crypto for the Codync relay protocol (spec §4–§7), built on @noble/*.
-// Test-only: checked against docs/remote-relay-vectors.json, then used by the unit tests and the e2e harness.
+// Test-only: checked against docs/reference/fixtures/remote-relay-vectors.json, then used by the unit tests and the e2e harness.
// Runs in both workerd (vitest) and Node (e2e).
import { chacha20poly1305 } from "@noble/ciphers/chacha.js";
diff --git a/cloud/test/relay.test.ts b/cloud/test/relay.test.ts
index 923f2357..a2d9716e 100644
--- a/cloud/test/relay.test.ts
+++ b/cloud/test/relay.test.ts
@@ -2,7 +2,7 @@
import { runDurableObjectAlarm, runInDurableObject, SELF } from "cloudflare:test";
import { describe, expect, it } from "vitest";
-import V from "../../docs/remote-relay-vectors.json";
+import V from "../../docs/reference/fixtures/remote-relay-vectors.json";
import type { ComputerRelay } from "../src/relay";
import { acl, call, devicePath, env, hostSocket, newHost, sleep, socket, upgrade, type TestHost } from "./helpers";
import * as ref from "./ref";
diff --git a/cloud/test/vectors.test.ts b/cloud/test/vectors.test.ts
index 8d9b7af4..35c81ddc 100644
--- a/cloud/test/vectors.test.ts
+++ b/cloud/test/vectors.test.ts
@@ -1,7 +1,7 @@
-// docs/remote-relay-vectors.json, field by field: the TS reference implementation and the Worker's own code.
+// docs/reference/fixtures/remote-relay-vectors.json, field by field: the TS reference implementation and the Worker's own code.
import { describe, expect, it } from "vitest";
-import V from "../../docs/remote-relay-vectors.json";
+import V from "../../docs/reference/fixtures/remote-relay-vectors.json";
import { claimCanonical as workerClaimCanonical } from "../src/api";
import { computerIdFor, fromB64url, sigCanonical, verifyEd25519, verifySig } from "../src/auth";
import { parseAcl } from "../src/relay";
diff --git a/docs/structure.md b/docs/architecture/file-structure.md
similarity index 51%
rename from docs/structure.md
rename to docs/architecture/file-structure.md
index 0a473858..5b8259be 100644
--- a/docs/structure.md
+++ b/docs/architecture/file-structure.md
@@ -7,9 +7,9 @@ kit/Sources/CodyncUI/ Store/ Bots/ Thread/ Call/ Screen/ Marketplace/
host/ cloud/ relay/ web/ packaging/
```
-Remote access ([spec](remote-relay-spec.md)): host `identity.rs` (keys) · `crypto.rs` (wire crypto) · `devices.rs` (authorized devices, `Caller`) · `channel.rs` (E2E channel, direct or relayed) · `relay.rs` (relay socket) · `cloud.rs` (cloud HTTP client, access requests). Kit `Client/`: `RelayCrypto`, `DeviceIdentity`, `Pairing`, `HostTransport`, `ChannelTransport`, `HostConnector`, `CloudClient`; models `Computer`, `Cloud`; `CodyncUI/Store/AccountStore`. Apps: `apps/shared/{AccountSession,ComputerStatus}.swift`, iOS `AccessRequestView` + `AccountSwitcherView` + `NotificationService/` (decrypts pushes), Mac `App/{HostController,SSHTunnel}.swift` + `Views/ComputersView.swift`. Cloud (`cloud/`, Worker + Durable Objects): `src/{index,auth,api,relay}.ts`, `migrations/` (D1), `test/` (vitest; `test/e2e/` against a live host).
+Remote access ([spec](../reference/remote-relay.md)): host `identity.rs` (keys) · `crypto.rs` (wire crypto) · `devices.rs` (authorized devices, `Caller`) · `channel.rs` (E2E channel, direct or relayed) · `relay.rs` (relay socket) · `cloud.rs` (cloud HTTP client, access requests). Kit `Client/`: `RelayCrypto`, `DeviceIdentity`, `Pairing`, `HostTransport`, `ChannelTransport`, `HostConnector`, `CloudClient`; models `Computer`, `Cloud`; `CodyncUI/Store/AccountStore`. Apps: `apps/shared/{AccountSession,ComputerStatus}.swift`, iOS `AccessRequestView` + `AccountSwitcherView` + `NotificationService/` (decrypts pushes), Mac `App/{HostController,SSHTunnel}.swift` + `Views/ComputersView.swift`. Cloud (`cloud/`, Worker + Durable Objects): `src/{index,auth,api,relay}.ts`, `migrations/` (D1), `test/` (vitest; `test/e2e/` against a live host).
-Bot memory & teams ([context-and-memory](context-and-memory.md), [bot-collaboration](bot-collaboration.md)): host `memory.rs`, `context.rs`, `team.rs` (+ `tests/team_e2e.rs`); kit `CodyncUI/Bots/MemoryView.swift`. Widgets ([design](mobile-widgets-design.md)): shared cards in `CodyncKit/Design/WidgetCards.swift`, iOS `Widgets/WidgetPreviews.swift` + `Views/WidgetGalleryView.swift`.
+Bot memory & teams ([context-and-memory](../features/context-and-memory.md), [bot-collaboration](../features/bot-collaboration.md)): host `memory.rs`, `context.rs`, `team.rs` (+ `tests/team_e2e.rs`); kit `CodyncUI/Bots/MemoryView.swift`. Widgets ([design](../design/mobile-widgets.md)): shared cards in `CodyncKit/Design/WidgetCards.swift`, iOS `Widgets/WidgetPreviews.swift` + `Views/WidgetGalleryView.swift`.
- Directories: lowercase for repo-level roles (`apps/`, `kit/`, `host/`); PascalCase inside Swift targets (`Views/`, `Thread/`). Apple app folders are `App/` (entry point, app-wide services), `Views/`, `Resources/` (Info.plist, entitlements, xcprivacy, xcassets).
- Files follow their language: Swift `UpperCamelCase.swift` named after the file's main type; Rust/TS `snake_case.rs` / `kebab-case.ts`.
@@ -17,3 +17,9 @@ Bot memory & teams ([context-and-memory](context-and-memory.md), [bot-collaborat
- Type suffixes by role: full screen / sheet → `…View`; list item → `…Row`; card → `…Card`; chat bubble → `…Bubble`; window scene → `…Window`; `@Observable` state → `…Store` / `…Controller`; `ButtonStyle` → describes the effect (`PressScale`).
- One word per concept across Swift, Rust host and Linux: **bot** (the persona you message), **agent** (the harness it runs, `Backend` in code), **chat** (the endless conversation with a bot or group; not conversation/session), **thread** (replies on one chat message), **group** (a chat with several bots), **lane** (a chat or thread a turn talks in), **session** (the ACP session only), **trace** (full conversation sheet), **marketplace** for UI / **market** for its data, **computer** (a paired host, user-facing) vs **host** (code).
- Linux mirrors the Swift feature names in its module names (`thread`, `editor`, `trace`, `settings`) when a file is split; don't invent new terms there.
+
+## iPhone navigation chrome
+
+The bot list and conversation use the native `NavigationStack` toolbar: account and action buttons are `ToolbarItem`s, and the conversation uses the system back button. iOS supplies their Liquid Glass, sizing, grouping and press feedback. Do not add glass backgrounds or `IconButtonStyle` to these toolbar buttons. Other screens continue to use Codync's custom chrome.
+
+Transient connection status appears in the toolbar center and remains visible for at least 0.7 seconds. It does not insert a connecting banner into the bot list or conversation content.
diff --git a/docs/bot-computer-ssh-plan.md b/docs/archive/bot-computer-ssh-plan-2026-09-25.md
similarity index 98%
rename from docs/bot-computer-ssh-plan.md
rename to docs/archive/bot-computer-ssh-plan-2026-09-25.md
index a381d8c2..50e9c965 100644
--- a/docs/bot-computer-ssh-plan.md
+++ b/docs/archive/bot-computer-ssh-plan-2026-09-25.md
@@ -1,7 +1,7 @@
# Bot、computer、帳號切換與 SSH 遠端執行計畫
日期:2026-09-25
-狀態:規劃;**多 computer 是未來方向,目前不是優先事項**:產品先以單一 computer 為主,已實作的多 computer 結構保留(中繼、帳號、SSH 建在其上,單台時照常運作),但暫不擴充或打磨多 computer 功能。補充 [Cloudflare 帳號與裝置管理計畫](cloudflare-account-device-plan.md)。實作細節(SSH tunnel、多 computer store、中繼)以 [遠端連線實作規格](remote-relay-spec.md) 為準。
+狀態:規劃;**多 computer 是未來方向,目前不是優先事項**:產品先以單一 computer 為主,已實作的多 computer 結構保留(中繼、帳號、SSH 建在其上,單台時照常運作),但暫不擴充或打磨多 computer 功能。補充 [Cloudflare 帳號與裝置管理計畫](cloudflare-account-device-plan-2026-09-25.md)。實作細節(SSH tunnel、多 computer store、中繼)以 [遠端連線實作規格](../reference/remote-relay.md) 為準。
## 1. 產品目標
diff --git a/docs/cloudflare-account-device-plan.md b/docs/archive/cloudflare-account-device-plan-2026-09-25.md
similarity index 97%
rename from docs/cloudflare-account-device-plan.md
rename to docs/archive/cloudflare-account-device-plan-2026-09-25.md
index 149a5861..74de8da1 100644
--- a/docs/cloudflare-account-device-plan.md
+++ b/docs/archive/cloudflare-account-device-plan-2026-09-25.md
@@ -9,7 +9,7 @@ Cloudflare API、D1、裝置目錄、雲端授權/撤權與中繼由 Claude Co
前後端整合時以已驗證的 Clerk user ID 作帳號關聯;不要把目前手機的配對資料分區誤認為已完成後端 ownership。新增 API 後應接到 `CloudClient`/account store,而非重新複製一套登入流程。
-> **2026-09-25 更新:實作以 [遠端連線實作規格](remote-relay-spec.md) 為準。** 與本文不同之處:
+> **2026-09-25 更新:實作以 [遠端連線實作規格](../reference/remote-relay.md) 為準。** 與本文不同之處:
> - Cloudflare 中繼(Workers + 每台電腦一個 Durable Object)是第一版的**主要**離家連線路徑;LAN/Tailscale 直連是替代,Tailscale 不是必要條件。
> - 中繼**端對端加密**:直連與中繼共用同一套 E2E channel(Ed25519 + X25519 + HKDF-SHA256 + ChaCha20-Poly1305),Worker/DO 只看得到密文與路由 metadata。
> - Host 是授權權威:本機 QR 配對與帳號 grant 都寫進 host 的已授權裝置表,host 簽署 ACL 發佈到 DO;無帳號的本機模式也能用中繼。
@@ -46,13 +46,13 @@ Cloudflare API、D1、裝置目錄、雲端授權/撤權與中繼由 Claude Co
目標階層為 `Account → Computers → Bots`,帳號下的 bot 清單可跨 computer 彙整。使用者可以同時保有本機 bot 與遠端 bot,不需要每次先切換全域 host。
-具體的多 computer 路由與 SSH 計畫見 [Bot 與遠端 computer 計畫](bot-computer-ssh-plan.md)。
+具體的多 computer 路由與 SSH 計畫見 [Bot 與遠端 computer 計畫](bot-computer-ssh-plan-2026-09-25.md)。
## 2. 已確認的專案現況
| 現況 | 程式位置 | 對計畫的影響 |
|---|---|---|
-| Mac 已使用 ClerkKit,支援 Google 登入 | `apps/shared/AccountSession.swift`、`docs/clerk-macos.md` | 延伸現有登入,不另建帳號系統 |
+| Mac 已使用 ClerkKit,支援 Google 登入 | `apps/shared/AccountSession.swift`、`docs/guides/accounts-and-ssh.md` | 延伸現有登入,不另建帳號系統 |
| iOS 已接 Clerk 帳號入口,電腦仍靠掃碼配對 | `apps/ios/App/CodyncApp.swift`、`apps/ios/Views/RootView.swift`、`PairingView.swift` | 登入入口已建立;雲端電腦清單待實作 |
| host SQLite 位於 `~/.codync/codync.db` | `host/src/main.rs`、`host/src/store.rs` | 保留本機資料與既有 `rev` 同步機制 |
| host 使用共用 pairing token,旋轉會使所有舊裝置失效 | `host/src/main.rs`、`host/src/api.rs` | 必須新增逐裝置授權,才能精準撤權 |
@@ -81,7 +81,7 @@ SQLite 是資料庫引擎;本機 SQLite 存在使用者電腦,D1 的資料
雲端目錄的價值:新手機即使還沒連到 Mac,也能知道帳號擁有哪些電腦,並啟動授權流程。電腦離線時仍能顯示清單,但無法讀取最新 bots、聊天或執行新指令。
-推播的標題與內文由 host 以裝置的 push key 加密,Cloudflare(`relay/`)與 APNs 只看到通用文字與 ID(規格 §6.7)。聊天中繼採端對端加密:Cloudflare 只經手密文與路由 metadata(computer/裝置公鑰、時間、大小),見 [規格](remote-relay-spec.md) §15。
+推播的標題與內文由 host 以裝置的 push key 加密,Cloudflare(`relay/`)與 APNs 只看到通用文字與 ID(規格 §6.7)。聊天中繼採端對端加密:Cloudflare 只經手密文與路由 metadata(computer/裝置公鑰、時間、大小),見 [規格](../reference/remote-relay.md) §15。
## 4. 服務配置與範圍
@@ -202,7 +202,7 @@ Worker 驗證 Clerk token 的簽章、issuer、到期與適用的 audience/aut
- host 私鑰使用 OS 安全儲存或受限制權限的檔案;Linux 至少使用專屬使用者與 `0600`。
- 所有遠端連線(LAN、Tailscale、中繼)都走同一套 E2E channel;長效 token 只接受 loopback。
- 不在 URL query、一般 log、分析事件或 crash report 中記錄憑證。現有 query token 相容入口需列入退場範圍。
-- 中繼的端對端加密設計見 [規格](remote-relay-spec.md) §3、§6;不能把 TLS 描述成端對端加密。
+- 中繼的端對端加密設計見 [規格](../reference/remote-relay.md) §3、§6;不能把 TLS 描述成端對端加密。
## 8. D1 資料模型
@@ -298,7 +298,7 @@ API 使用 `/v1`,錯誤固定為 `{ error: { code, message }, requestId }`。
WebRTC 優先直連,必要時使用 TURN;憑證需短效且受裝置授權約束。Cloudflare 是否承接 TURN、其容量和費用,在該階段核對官方文件後決定。
-中繼採端對端加密;首次信任(QR 或 SAS 比對)、換機、key rotation、撤權與復原定義於 [規格](remote-relay-spec.md)。
+中繼採端對端加密;首次信任(QR 或 SAS 比對)、換機、key rotation、撤權與復原定義於 [規格](../reference/remote-relay.md)。
## 13. 儲存庫實作位置
@@ -313,7 +313,7 @@ WebRTC 優先直連,必要時使用 TURN;憑證需短效且受裝置授權
| `kit/Sources/CodyncUI/Store/` | 本機/雲端電腦清單合併、帳號切換、grant 更新 |
| `host/src/` | host identity、cloud client、逐裝置 auth、撤權與版本協商 |
| `project.yml` | iOS Clerk 依賴、shared sources、config 與 Keychain entitlement 配置 |
-| `docs/clerk-macos.md`、README、PairingView 文案 | 更新帳號、資料處理與本機模式說明 |
+| `docs/guides/accounts-and-ssh.md`、README、PairingView 文案 | 更新帳號、資料處理與本機模式說明 |
實作應保持帳號 SDK 與 widget-safe 資料模型分離,避免 widget 因共享套件被迫初始化 Clerk。不要把雲端管理 API 全塞進現有 `HostClient`。
@@ -364,7 +364,7 @@ WebRTC 優先直連,必要時使用 TURN;憑證需短效且受裝置授權
- SSH 試行不依賴雲端中繼,可以在 P2 後、P3 前交付;但必須先完成 host 身分驗證、獨立授權、連線生命週期及正確路由。
- 手機直接連 SSH host、手機經 Mac gateway 存取,以及免安裝 remote host 是不同工作項;不因桌面 tunnel 成功就宣稱三者均完成。
-完成條件與延後原因詳見 [SSH 計畫的整合門檻](bot-computer-ssh-plan.md#6-整合順序與是否現在一起做)。
+完成條件與延後原因詳見 [SSH 計畫的整合門檻](bot-computer-ssh-plan-2026-09-25.md#6-整合順序與是否現在一起做)。
### P4:商業與可選同步
@@ -434,4 +434,4 @@ Worker 執行 typecheck 與具 D1 binding 的整合測試;Rust 執行 auth/
- [Cloudflare Queues](https://developers.cloudflare.com/queues/)
- [Apple App Review Guidelines](https://developer.apple.com/app-store/review/guidelines/)
-本地參考:[專案結構](structure.md)、[目前 macOS Clerk 設定](clerk-macos.md)、[既有推播 relay](../relay/README.md)。
+本地參考:[專案結構](../architecture/file-structure.md)、[目前 macOS Clerk 設定](../guides/accounts-and-ssh.md)、[既有推播 relay](../../relay/README.md)。
diff --git a/docs/ui-audit.md b/docs/archive/ui-audit-2026-09-25.md
similarity index 100%
rename from docs/ui-audit.md
rename to docs/archive/ui-audit-2026-09-25.md
diff --git a/docs/mobile-widgets-design.md b/docs/design/mobile-widgets.md
similarity index 98%
rename from docs/mobile-widgets-design.md
rename to docs/design/mobile-widgets.md
index d8a6657e..4f0bea38 100644
--- a/docs/mobile-widgets-design.md
+++ b/docs/design/mobile-widgets.md
@@ -112,7 +112,7 @@ python3 tools/render-widgets.py
DEBUG simulator build 也可用 `SIMCTL_CHILD_CODYNC_ACTIVITY_PREVIEW=needsInput xcrun simctl launch --terminate-running-process booted com.pokai.Codync.ios` 啟動系統範例。值可為 `working`、`needsInput`、`idle`、`error`、`stale` 或 `multiple`;以 `stop` 結束範例。此入口只存在於 DEBUG simulator,不連 host/relay/APNs,清理僅針對 `codync-design-preview-` 的活動。
-帳號/雲端架構與 SSH computer 路線分別見 [帳號與裝置計畫](cloudflare-account-device-plan.md) 與 [Bot/computer/SSH 計畫](bot-computer-ssh-plan.md)。
+帳號/雲端架構與 SSH computer 路線分別見 [帳號與裝置計畫](../archive/cloudflare-account-device-plan-2026-09-25.md) 與 [Bot/computer/SSH 計畫](../archive/bot-computer-ssh-plan-2026-09-25.md)。
## Halftone 與 Thinking Orbs(2026-09-26)
diff --git a/docs/bot-collaboration.md b/docs/features/bot-collaboration.md
similarity index 100%
rename from docs/bot-collaboration.md
rename to docs/features/bot-collaboration.md
diff --git a/docs/context-and-memory.md b/docs/features/context-and-memory.md
similarity index 100%
rename from docs/context-and-memory.md
rename to docs/features/context-and-memory.md
diff --git a/docs/groups-and-threads.md b/docs/features/groups-and-threads.md
similarity index 100%
rename from docs/groups-and-threads.md
rename to docs/features/groups-and-threads.md
diff --git a/docs/voice-call.md b/docs/features/voice-call.md
similarity index 100%
rename from docs/voice-call.md
rename to docs/features/voice-call.md
diff --git a/docs/clerk-macos.md b/docs/guides/accounts-and-ssh.md
similarity index 98%
rename from docs/clerk-macos.md
rename to docs/guides/accounts-and-ssh.md
index 4fb31769..415df09c 100644
--- a/docs/clerk-macos.md
+++ b/docs/guides/accounts-and-ssh.md
@@ -38,7 +38,7 @@ The custom account menu displays the authenticated email and avatar when
available. `AccountSession.sessionToken()` hands the session JWT to the Codync
cloud client. A Clerk session never authorizes a computer by itself: each
computer approves each device after comparing a 6-digit code
-([remote-relay-spec.md](remote-relay-spec.md) §4.2). Conversations are not uploaded.
+([remote-relay-spec.md](../reference/remote-relay.md) §4.2). Conversations are not uploaded.
## Verification
diff --git a/docs/remote-relay-vectors.json b/docs/reference/fixtures/remote-relay-vectors.json
similarity index 100%
rename from docs/remote-relay-vectors.json
rename to docs/reference/fixtures/remote-relay-vectors.json
diff --git a/docs/remote-relay-vectors.py b/docs/reference/fixtures/remote-relay-vectors.py
similarity index 98%
rename from docs/remote-relay-vectors.py
rename to docs/reference/fixtures/remote-relay-vectors.py
index 336ec258..85662c45 100644
--- a/docs/remote-relay-vectors.py
+++ b/docs/reference/fixtures/remote-relay-vectors.py
@@ -1,4 +1,4 @@
-# Generates docs/remote-relay-vectors.json (Codync relay crypto, protocol v1 (spec rev 2)).
+# Generates docs/reference/fixtures/remote-relay-vectors.json (Codync relay crypto, protocol v1 (spec rev 2)).
import base64, hashlib, json, struct
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey, X25519PublicKey
diff --git a/docs/remote-relay-spec.md b/docs/reference/remote-relay.md
similarity index 98%
rename from docs/remote-relay-spec.md
rename to docs/reference/remote-relay.md
index 2c0e65a0..af12488d 100644
--- a/docs/remote-relay-spec.md
+++ b/docs/reference/remote-relay.md
@@ -1,8 +1,8 @@
# 遠端連線實作規格:Cloudflare 中繼(主要)、直連(替代)、帳號與 SSH
日期:2026-09-25(rev 2:安全與可實作性審查後修訂)
-狀態:**實作規格**,交給平行的 CLOUD/HOST/APPLE-KIT/APPLE-APPS 四條 track。與 [帳號與裝置計畫](cloudflare-account-device-plan.md)、[SSH 計畫](bot-computer-ssh-plan.md) 衝突時,以本文件為準。
-測試向量:[remote-relay-vectors.json](remote-relay-vectors.json)(由 [remote-relay-vectors.py](remote-relay-vectors.py) 以固定種子產生,`python3` + `cryptography`;三種語言的實作都必須逐欄通過)。
+狀態:**實作規格**,交給平行的 CLOUD/HOST/APPLE-KIT/APPLE-APPS 四條 track。與 [帳號與裝置計畫](../archive/cloudflare-account-device-plan-2026-09-25.md)、[SSH 計畫](../archive/bot-computer-ssh-plan-2026-09-25.md) 衝突時,以本文件為準。
+測試向量:[remote-relay-vectors.json](fixtures/remote-relay-vectors.json)(由 [remote-relay-vectors.py](fixtures/remote-relay-vectors.py) 以固定種子產生,`python3` + `cryptography`;三種語言的實作都必須逐欄通過)。
本文件中「必須/不得」是介面契約;沒有寫到的內部結構由各 track 自行決定。各 track 之間**只透過本文件溝通**,發現本文件有矛盾或缺漏時停下回報,不要自行發明另一套 wire format。
@@ -62,13 +62,13 @@
| **CLOUD** | `cloud/**`(新建)、`relay/**`(只改 §6.7 的 `mutableContent` 透傳)、`.github/workflows/cloud.yml`(新建) | Worker(`/v1` API + Clerk + D1)、`ComputerRelay` DO、migrations、vitest、e2e 測試、`cloud/README.md`、CI |
| **HOST** | `host/**`、`.github/workflows/host.yml` | identity、channel、relay client、cloud client、逐裝置授權、loopback-only token、CLI |
| **APPLE-KIT** | `kit/**`、`.github/workflows/kit.yml`(新建,`swift test`) | `DeviceIdentity`、channel 加密、`HostTransport`、`HostConnector`、`CloudClient`、`AccountStore`、`BotStore` 調整、models |
-| **APPLE-APPS** | `apps/ios/**`(含 `apps/ios/Widgets`、新 `apps/ios/NotificationService`)、`apps/macos/**`、`apps/shared/**`、`project.yml`、`Codync.xcodeproj`(只經 `xcodegen generate`)、`docs/clerk-macos.md`、`.github/workflows/release-macos.yml` | UI、帳號流程、Mac 核准介面、SSH、Notification Service Extension、entitlements、設定檔 |
+| **APPLE-APPS** | `apps/ios/**`(含 `apps/ios/Widgets`、新 `apps/ios/NotificationService`)、`apps/macos/**`、`apps/shared/**`、`project.yml`、`Codync.xcodeproj`(只經 `xcodegen generate`)、`docs/guides/accounts-and-ssh.md`、`.github/workflows/release-macos.yml` | UI、帳號流程、Mac 核准介面、SSH、Notification Service Extension、entitlements、設定檔 |
- `relay/`(APNs 推播)只加一個欄位:`/push` body 的 `mutableContent: true` → `aps["mutable-content"] = 1`。其他不變。推播撤權由 host 端「ticket 綁定 deviceKey、撤權即刪」達成(§9.4)。
-- `docs/structure.md` 的 `cloud/` 一行已由本規格作者加入。
+- `docs/architecture/file-structure.md` 的 `cloud/` 一行已由本規格作者加入。
- `apps/linux/**`、`apps/screen*/**`:不動(它們只用 loopback token / unix socket)。
-- 共用唯讀檔:`docs/remote-relay-spec.md`、`docs/remote-relay-vectors.json`。任何 track 要改它們 → 回報 orchestrator,不自行修改。
-- `CLAUDE.md`、`docs/cloudflare-account-device-plan.md`、`docs/bot-computer-ssh-plan.md`:由本規格作者更新;各 track 不改。
+- 共用唯讀檔:`docs/reference/remote-relay.md`、`docs/reference/fixtures/remote-relay-vectors.json`。任何 track 要改它們 → 回報 orchestrator,不自行修改。
+- `CLAUDE.md`、`docs/archive/cloudflare-account-device-plan-2026-09-25.md`、`docs/archive/bot-computer-ssh-plan-2026-09-25.md`:由本規格作者更新;各 track 不改。
- 版本:HOST 把 `host/Cargo.toml` 的 `version` 設為 `2.2.0`;APPLE-APPS 把 `project.yml` 的 `MARKETING_VERSION` 設為 `2.2.0`(`CURRENT_PROJECT_VERSION` 只在上傳時遞增)。
**順序**:四條 track 同時開始,各自以 `remote-relay-vectors.json` 做單元測試,互不等待。APPLE-APPS 依賴 APPLE-KIT 的公開 API(§10.1 已定死簽章),可先以本文件寫 UI,kit 完成後接上。跨 track 整合測試(§12.1)由 CLOUD 擁有,在 HOST 合併後執行。
@@ -773,7 +773,7 @@ Rust 以 enum 表示:`DeviceSource { Local, Account }`、`Scope { Control, Scr
### 9.8 HOST 測試
-- `crypto.rs`:通過 `remote-relay-vectors.json` 全部欄位(`include_str!("../../docs/remote-relay-vectors.json")`)。
+- `crypto.rs`:通過 `remote-relay-vectors.json` 全部欄位(`include_str!("../../docs/reference/fixtures/remote-relay-vectors.json")`)。
- 授權:未知 dk 被拒、pairing 流程(回應後 4100、pairing channel 上非 `pair` 被關)、無 code 時 `pair:true` 在 ECDH 前被拒、code 單次、lease 到期關閉 channel、撤權關閉進行中的 events 訂閱並刪 push/activity tickets、scope 拒絕、loopback-only 方法經 channel 被拒、非 loopback bearer 被拒、`::ffff:127.0.0.1` 視為 loopback。
- state 套用:未知 grant 被忽略(表不變)、已知 grant 續約、缺席者刪除;relay 連上後 state 拉取前帳號裝置握手被拒;relay link 上 `hello.dk != open.dk` 被關;SAS commit 不符自動 deny、reveal 前 approve 被拒。
- `acl_ver`:刪 DB 保留 identity → `staleVersion` 後以 `max+1` 成功。
diff --git a/host/src/crypto.rs b/host/src/crypto.rs
index d6910f6b..13699883 100644
--- a/host/src/crypto.rs
+++ b/host/src/crypto.rs
@@ -1,10 +1,10 @@
-//! Wire cryptography of the phone ↔ host protocol (docs/remote-relay-spec.md §5, §6):
+//! Wire cryptography of the phone ↔ host protocol (docs/reference/remote-relay.md §5, §6):
//! the signed-ephemeral handshake, frame sealing and chunking, mailbox opening,
//! push sealing, SAS, pairing offer ids and the canonical strings that get signed.
//!
//! Pure functions over bytes, no host state: `tests/e2e.rs` includes this file
//! as its device-side implementation, so it must only use external crates.
-//! Every construction is checked against `docs/remote-relay-vectors.json`.
+//! Every construction is checked against `docs/reference/fixtures/remote-relay-vectors.json`.
use anyhow::{Result, anyhow, bail, ensure};
use base64::Engine as _;
@@ -322,7 +322,7 @@ mod tests {
use serde_json::Value;
fn vectors() -> Value {
- serde_json::from_str(include_str!("../../docs/remote-relay-vectors.json")).unwrap()
+ serde_json::from_str(include_str!("../../docs/reference/fixtures/remote-relay-vectors.json")).unwrap()
}
fn b(v: &Value) -> Vec<u8> {
diff --git a/kit/Package.swift b/kit/Package.swift
index 6ec8ef18..5b2d99d3 100644
--- a/kit/Package.swift
+++ b/kit/Package.swift
@@ -16,7 +16,7 @@ let package = Package(
.package(url: "https://github.com/migueldeicaza/SwiftTerm.git", exact: "1.18.0"),
],
targets: [
- .target(name: "CodyncKit", resources: [.copy("Resources/ThirdPartyNotices")]),
+ .target(name: "CodyncKit", resources: [.copy("Resources/ThirdPartyNotices"), .process("Resources/ProviderIcons.xcassets")]),
.target(
name: "CodyncUI",
dependencies: [
diff --git a/kit/Sources/CodyncKit/Client/RelayCrypto.swift b/kit/Sources/CodyncKit/Client/RelayCrypto.swift
index 67e345e1..55aed0f1 100644
--- a/kit/Sources/CodyncKit/Client/RelayCrypto.swift
+++ b/kit/Sources/CodyncKit/Client/RelayCrypto.swift
@@ -1,8 +1,8 @@
import CryptoKit
import Foundation
-// The relay protocol's cryptography (docs/remote-relay-spec.md §5, §6), checked field by field
-// against docs/remote-relay-vectors.json. Labels are ASCII without a trailing NUL.
+// The relay protocol's cryptography (docs/reference/remote-relay.md §5, §6), checked field by field
+// against docs/reference/fixtures/remote-relay-vectors.json. Labels are ASCII without a trailing NUL.
extension Data {
/// Strict base64url without padding (RFC 4648 §5).
diff --git a/kit/Sources/CodyncKit/Design/ActivityCards.swift b/kit/Sources/CodyncKit/Design/ActivityCards.swift
index 13cbbc13..2c72d20b 100644
--- a/kit/Sources/CodyncKit/Design/ActivityCards.swift
+++ b/kit/Sources/CodyncKit/Design/ActivityCards.swift
@@ -53,6 +53,15 @@ public struct BotActivityCard: View {
}
Text(state.detail).font(.system(size: 12)).foregroundStyle(Palette.secondary)
.lineLimit(2).fixedSize(horizontal: false, vertical: true)
+ if state.phase == .working, let started = state.startedAt {
+ HStack(spacing: 6) {
+ Image(systemName: "clock")
+ Text(started, style: .timer).monospacedDigit()
+ Text("elapsed")
+ }
+ .font(.system(size: 10, weight: .medium))
+ .foregroundStyle(Palette.tertiary)
+ }
}
.padding(16)
.accessibilityElement(children: .combine)
diff --git a/kit/Sources/CodyncKit/Design/UsageBar.swift b/kit/Sources/CodyncKit/Design/UsageBar.swift
index 76e33af8..e39faab7 100644
--- a/kit/Sources/CodyncKit/Design/UsageBar.swift
+++ b/kit/Sources/CodyncKit/Design/UsageBar.swift
@@ -1,5 +1,20 @@
import SwiftUI
+public enum UsageIconStyle: String, CaseIterable, Sendable {
+ case character, original
+
+ public var title: String { self == .character ? "Character" : "Original icon" }
+}
+
+public extension SharedStore {
+ static let usageIconStyleKey = "usageIconStyle"
+
+ static var usageIconStyle: UsageIconStyle {
+ get { UserDefaults(suiteName: appGroup)?.string(forKey: usageIconStyleKey).flatMap(UsageIconStyle.init(rawValue:)) ?? .character }
+ set { UserDefaults(suiteName: appGroup)?.set(newValue.rawValue, forKey: usageIconStyleKey) }
+ }
+}
+
/// One place for "how full is this limit" colors, shared by the apps, the menu bar and widgets.
public extension Palette {
/// Fill for bars: ink, amber from 70%, red from 90%.
@@ -73,23 +88,34 @@ public extension UsageWindow {
public struct ProviderMascot: View {
let provider: UsageProvider
let size: CGFloat
+ var style: UsageIconStyle = .character
- public init(_ provider: UsageProvider, size: CGFloat) {
+ public init(_ provider: UsageProvider, size: CGFloat, style: UsageIconStyle = .character) {
self.provider = provider
self.size = size
+ self.style = style
}
public var body: some View {
let full = (provider.tightest?.percent ?? 0) >= 90
- CharacterAvatar(shape: provider.mascotShape, tint: provider.tint, size: size, mood: full ? .needsInput : .idle)
- .overlay(alignment: .topTrailing) {
- if full {
- Image(systemName: "exclamationmark.circle.fill")
- .font(.system(size: size * 0.34, weight: .bold))
- .symbolRenderingMode(.palette)
- .foregroundStyle(.white, Palette.danger)
- .offset(x: size * 0.12, y: -size * 0.12)
+ Group {
+ if style == .original {
+ Image("agent-\(provider.registry)", bundle: .module)
+ .resizable().scaledToFit().padding(size * 0.08)
+ .foregroundStyle(provider.tint)
+ } else {
+ CharacterAvatar(shape: provider.mascotShape, tint: provider.tint, size: size, mood: full ? .needsInput : .idle)
+ .overlay(alignment: .topTrailing) {
+ if full {
+ Image(systemName: "exclamationmark.circle.fill")
+ .font(.system(size: size * 0.34, weight: .bold))
+ .symbolRenderingMode(.palette)
+ .foregroundStyle(.white, Palette.danger)
+ .offset(x: size * 0.12, y: -size * 0.12)
+ }
+ }
}
- }
+ }
+ .frame(width: size, height: size)
}
}
diff --git a/kit/Sources/CodyncKit/Design/WidgetCards.swift b/kit/Sources/CodyncKit/Design/WidgetCards.swift
index 3c583ce7..0a420ce6 100644
--- a/kit/Sources/CodyncKit/Design/WidgetCards.swift
+++ b/kit/Sources/CodyncKit/Design/WidgetCards.swift
@@ -7,17 +7,19 @@ public struct ProviderWidgetCard: View {
let provider: UsageProvider
let layout: Layout
let date: Date
+ let iconStyle: UsageIconStyle
- public init(provider: UsageProvider, layout: Layout, date: Date = .now) {
+ public init(provider: UsageProvider, layout: Layout, date: Date = .now, iconStyle: UsageIconStyle = SharedStore.usageIconStyle) {
self.provider = provider
self.layout = layout
self.date = date
+ self.iconStyle = iconStyle
}
public var body: some View {
VStack(alignment: .leading, spacing: layout == .small ? 6 : 8) {
HStack(spacing: 7) {
- CharacterAvatar(shape: provider.mascotShape, tint: provider.widgetTint, size: 22)
+ ProviderMascot(provider, size: 22, style: iconStyle)
Text(provider.name)
.font(.system(size: 13, weight: .semibold))
.foregroundStyle(Palette.text)
diff --git a/kit/Sources/CodyncKit/Models/BotActivity.swift b/kit/Sources/CodyncKit/Models/BotActivity.swift
index e9b45eae..10bf76a9 100644
--- a/kit/Sources/CodyncKit/Models/BotActivity.swift
+++ b/kit/Sources/CodyncKit/Models/BotActivity.swift
@@ -8,7 +8,7 @@ public struct BotActivityAttributes: ActivityAttributes {
public struct ContentState: Codable, Hashable, Sendable {
/// idle | working | needsInput | error
public var status: String
- /// Always empty: pushes never carry free text (§6.7). Kept so the content state shape stays stable.
+ /// Local app updates may show the current step; remote pushes leave it empty (§6.7).
public var activity: String
public var startedAt: Date?
diff --git a/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/Contents.json b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/Contents.json
new file mode 100644
index 00000000..73c00596
--- /dev/null
+++ b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-claude-acp.imageset/Contents.json b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-claude-acp.imageset/Contents.json
new file mode 100644
index 00000000..539b074f
--- /dev/null
+++ b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-claude-acp.imageset/Contents.json
@@ -0,0 +1,5 @@
+{
+ "images" : [ { "filename" : "claude-acp.svg", "idiom" : "universal" } ],
+ "info" : { "author" : "xcode", "version" : 1 },
+ "properties" : { "template-rendering-intent" : "template", "preserves-vector-representation" : true }
+}
diff --git a/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-claude-acp.imageset/claude-acp.svg b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-claude-acp.imageset/claude-acp.svg
new file mode 100644
index 00000000..98dd82db
--- /dev/null
+++ b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-claude-acp.imageset/claude-acp.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 1200 1200">
+ <path fill="currentColor" d="M 233.959793 800.214905 L 468.644287 668.536987 L 472.590637 657.100647 L 468.644287 650.738403 L 457.208069 650.738403 L 417.986633 648.322144 L 283.892639 644.69812 L 167.597321 639.865845 L 54.926208 633.825623 L 26.577238 627.785339 L 3.3e-05 592.751709 L 2.73832 575.27533 L 26.577238 559.248352 L 60.724873 562.228149 L 136.187973 567.382629 L 249.422867 575.194763 L 331.570496 580.026978 L 453.261841 592.671082 L 472.590637 592.671082 L 475.328857 584.859009 L 468.724915 580.026978 L 463.570557 575.194763 L 346.389313 495.785217 L 219.543671 411.865906 L 153.100723 363.543762 L 117.181267 339.060425 L 99.060455 316.107361 L 91.248367 266.01355 L 123.865784 230.093994 L 167.677887 233.073853 L 178.872513 236.053772 L 223.248367 270.201477 L 318.040283 343.570496 L 441.825592 434.738342 L 459.946411 449.798706 L 467.194672 444.64447 L 468.080597 441.020203 L 459.946411 427.409485 L 392.617493 305.718323 L 320.778564 181.932983 L 288.80542 130.630859 L 280.348999 99.865845 C 277.369171 87.221436 275.194641 76.590698 275.194641 63.624268 L 312.322174 13.20813 L 332.8591 6.604126 L 382.389313 13.20813 L 403.248352 31.328979 L 434.013519 101.71814 L 483.865753 212.537048 L 561.181274 363.221497 L 583.812134 407.919434 L 595.892639 449.315491 L 600.40271 461.959839 L 608.214783 461.959839 L 608.214783 454.711609 L 614.577271 369.825623 L 626.335632 265.61084 L 637.771851 131.516846 L 641.718201 93.745117 L 660.402832 48.483276 L 697.530334 24.000122 L 726.52356 37.852417 L 750.362549 72 L 747.060486 94.067139 L 732.886047 186.201416 L 705.100708 330.52356 L 686.979919 427.167847 L 697.530334 427.167847 L 709.61084 415.087341 L 758.496704 350.174561 L 840.644348 247.490051 L 876.885925 206.738342 L 919.167847 161.71814 L 946.308838 140.29541 L 997.61084 140.29541 L 1035.38269 196.429626 L 1018.469849 254.416199 L 965.637634 321.422852 L 921.825562 378.201538 L 859.006714 462.765259 L 819.785278 530.41626 L 823.409424 535.812073 L 832.75177 534.92627 L 974.657776 504.724915 L 1051.328979 490.872559 L 1142.818848 475.167786 L 1184.214844 494.496582 L 1188.724854 514.147644 L 1172.456421 554.335693 L 1074.604126 578.496765 L 959.838989 601.449829 L 788.939636 641.879272 L 786.845764 643.409485 L 789.261841 646.389343 L 866.255127 653.637634 L 899.194702 655.409424 L 979.812134 655.409424 L 1129.932861 666.604187 L 1169.154419 692.537109 L 1192.671265 724.268677 L 1188.724854 748.429688 L 1128.322144 779.194641 L 1046.818848 759.865845 L 856.590759 714.604126 L 791.355774 698.335754 L 782.335693 698.335754 L 782.335693 703.731567 L 836.69812 756.885986 L 936.322205 846.845581 L 1061.073975 962.81897 L 1067.436279 991.490112 L 1051.409424 1014.120911 L 1034.496704 1011.704712 L 924.885986 929.234924 L 882.604126 892.107544 L 786.845764 811.48999 L 780.483276 811.48999 L 780.483276 819.946289 L 802.550415 852.241699 L 919.087341 1027.409424 L 925.127625 1081.127686 L 916.671204 1098.604126 L 886.469849 1109.154419 L 853.288696 1103.114136 L 785.073914 1007.355835 L 714.684631 899.516785 L 657.906067 802.872498 L 650.979858 806.81897 L 617.476624 1167.704834 L 601.771851 1186.147705 L 565.530212 1200 L 535.328857 1177.046997 L 519.302124 1139.919556 L 535.328857 1066.550537 L 554.657776 970.792053 L 570.362488 894.68457 L 584.536926 800.134277 L 592.993347 768.724976 L 592.429626 766.630859 L 585.503479 767.516968 L 514.22821 865.369263 L 405.825531 1011.865906 L 320.053711 1103.677979 L 299.516815 1111.812256 L 263.919525 1093.369263 L 267.221497 1060.429688 L 287.114136 1031.114136 L 405.825531 880.107361 L 477.422913 786.52356 L 523.651062 732.483276 L 523.328918 724.671265 L 520.590698 724.671265 L 205.288605 929.395935 L 149.154434 936.644409 L 124.993355 914.01355 L 127.973183 876.885986 L 139.409409 864.80542 L 234.201385 799.570435 L 233.879227 799.8927 Z"/>
+</svg>
diff --git a/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-codex-acp.imageset/Contents.json b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-codex-acp.imageset/Contents.json
new file mode 100644
index 00000000..6b66372d
--- /dev/null
+++ b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-codex-acp.imageset/Contents.json
@@ -0,0 +1,5 @@
+{
+ "images" : [ { "filename" : "codex-acp.svg", "idiom" : "universal" } ],
+ "info" : { "author" : "xcode", "version" : 1 },
+ "properties" : { "template-rendering-intent" : "template", "preserves-vector-representation" : true }
+}
diff --git a/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-codex-acp.imageset/codex-acp.svg b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-codex-acp.imageset/codex-acp.svg
new file mode 100644
index 00000000..42c78a06
--- /dev/null
+++ b/kit/Sources/CodyncKit/Resources/ProviderIcons.xcassets/agent-codex-acp.imageset/codex-acp.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
+ <path fill="currentColor" d="M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.815 3.355-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.393.681zm1.097-2.365l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z"/>
+</svg>
diff --git a/kit/Sources/CodyncUI/Bots/BotRow.swift b/kit/Sources/CodyncUI/Bots/BotRow.swift
index c3deea67..4ef779da 100644
--- a/kit/Sources/CodyncUI/Bots/BotRow.swift
+++ b/kit/Sources/CodyncUI/Bots/BotRow.swift
@@ -114,13 +114,7 @@ public struct ConnectionBanner: View {
case .online, .unpaired:
EmptyView()
case .connecting:
- Label {
- Text("Connecting to \(model.hostName)…")
- } icon: {
- ThinkingOrb(state: .connecting, size: 18, color: Palette.secondary)
- }
- .font(.footnote)
- .foregroundStyle(Palette.secondary)
+ EmptyView()
case let .computerOffline(lastSeen):
let seen = lastSeen.map { " Last seen \(RelativeTime.day($0))." } ?? ""
banner(icon: "moon.zzz", title: "\(model.hostName) is offline",
diff --git a/kit/Sources/CodyncUI/Chrome.swift b/kit/Sources/CodyncUI/Chrome.swift
index 3e5dc505..dfd14bc7 100644
--- a/kit/Sources/CodyncUI/Chrome.swift
+++ b/kit/Sources/CodyncUI/Chrome.swift
@@ -4,20 +4,9 @@ import SwiftUI
import UIKit
#endif
-private struct ScreenHeaderIconGlassKey: EnvironmentKey {
- static let defaultValue = false
-}
-
-private extension EnvironmentValues {
- var screenHeaderIconGlass: Bool {
- get { self[ScreenHeaderIconGlassKey.self] }
- set { self[ScreenHeaderIconGlassKey.self] = newValue }
- }
-}
-
// Codync's own screen chrome: modals, headers, icon buttons and the iPhone tab bar.
-// Never use `.sheet`, `.popover`, `.toolbar`/`ToolbarItem`, navigation bars or
-// `TabView`: present with `.codyncSheet`, title with `ModalHeader` / `ScreenHeader`.
+// Present with `.codyncSheet`, title with `ModalHeader` / `ScreenHeader`.
+// The iPhone bot list and conversation use the native navigation toolbar for Liquid Glass.
// Every transition animates (Motion.layout / Motion.fade), honoring Reduce Motion.
// MARK: - Icon button
@@ -63,24 +52,16 @@ public struct IconButtonStyle: ButtonStyle {
let size: CGFloat
@State private var hovering = false
@Environment(\.isEnabled) private var isEnabled
- @Environment(\.screenHeaderIconGlass) private var screenHeaderIconGlass
var body: some View {
configuration.label
.font(.system(size: size / 2, weight: .medium))
.foregroundStyle(selected ? Palette.onAccent : hovering ? Palette.text : Palette.secondary)
.frame(width: size, height: size)
- .background {
- let shape = RoundedRectangle(cornerRadius: size * 0.34, style: .continuous)
- #if os(iOS)
- if screenHeaderIconGlass {
- shape.fill(.clear).glass(in: shape)
- }
- #endif
- shape.fill(
- selected ? Palette.accentFill : Palette.text.opacity(configuration.isPressed ? 0.14 : hovering ? 0.08 : 0)
- )
- }
+ .background(
+ selected ? Palette.accentFill : Palette.text.opacity(configuration.isPressed ? 0.14 : hovering ? 0.08 : 0),
+ in: RoundedRectangle(cornerRadius: size * 0.28, style: .continuous)
+ )
.opacity(isEnabled ? 1 : 0.35)
.scaleEffect(configuration.isPressed ? Motion.pressScale : 1)
.animation(Motion.press, value: configuration.isPressed)
@@ -146,7 +127,6 @@ public struct ScreenHeader<Leading: View, Title: View, Trailing: View>: View {
Spacer(minLength: 8)
trailing
}
- .environment(\.screenHeaderIconGlass, true)
}
.padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 12))
.frame(height: InterfaceMetrics.value(mac: 44, mobile: 52))
@@ -154,6 +134,48 @@ public struct ScreenHeader<Leading: View, Title: View, Trailing: View>: View {
}
}
+/// A small connection state shown in the center of a screen header.
+public struct ConnectingIndicator: View {
+ let isConnecting: Bool
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @State private var isVisible = false
+ @State private var shownAt = Date.distantPast
+
+ public init(isConnecting: Bool) { self.isConnecting = isConnecting }
+
+ public var body: some View {
+ Group {
+ if isVisible {
+ HStack(spacing: 6) {
+ ThinkingOrb(state: .connecting, size: 14, color: Palette.secondary)
+ Text("Connecting")
+ .font(.system(size: 12, weight: .medium))
+ .foregroundStyle(Palette.secondary)
+ .lineLimit(1)
+ }
+ .transition(.opacity)
+ .accessibilityLabel("Connecting")
+ }
+ }
+ .task(id: isConnecting) {
+ if isConnecting {
+ if !isVisible {
+ shownAt = .now
+ withAnimation(Motion.reduced(Motion.fade, reduceMotion)) { isVisible = true }
+ }
+ } else if isVisible {
+ let remainingMilliseconds = max(0, Int((0.7 - Date.now.timeIntervalSince(shownAt)) * 1_000))
+ if remainingMilliseconds > 0 {
+ try? await Task.sleep(for: .milliseconds(Int64(remainingMilliseconds)))
+ }
+ guard !Task.isCancelled else { return }
+ withAnimation(Motion.reduced(Motion.fade, reduceMotion)) { isVisible = false }
+ }
+ }
+ .frame(minWidth: 1, minHeight: 1)
+ }
+}
+
/// The back button for a pushed screen.
public struct BackButton: View {
let action: () -> Void
diff --git a/kit/Sources/CodyncUI/Thread/ThreadView.swift b/kit/Sources/CodyncUI/Thread/ThreadView.swift
index abbfe452..b838c700 100644
--- a/kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -23,6 +23,7 @@ public struct ThreadView: View {
@State private var availableWidth: CGFloat = 800
@State private var compactDetails = false
@State private var calling = false
+ @State private var showMenu = false
@Environment(\.accessibilityReduceMotion) private var reduceMotion
private var bot: Bot? { model.bots[botId] }
@@ -133,28 +134,31 @@ public struct ThreadView: View {
}
}
#if os(iOS)
- .safeAreaInset(edge: .top, spacing: 0) {
- ScreenHeader {
- BackButton { dismiss() }
- } title: {
- header
- } trailing: {
- if model.screen?.agentBot == botId {
+ .navigationBarTitleDisplayMode(.inline)
+ .toolbar(.visible, for: .navigationBar)
+ .toolbar {
+ ToolbarItem(placement: .principal) {
+ VStack(spacing: 0) {
+ header
+ ConnectingIndicator(isConnecting: model.connection == .connecting)
+ }
+ }
+ if model.screen?.agentBot == botId {
+ ToolbarItem(placement: .topBarTrailing) {
// The bot is operating the computer: watch it live (and take over from there).
- IconButton("Watch the screen", systemImage: "cursorarrow.motionlines") {
+ Button("Watch the screen", systemImage: "cursorarrow.motionlines") {
model.screenRequest = ScreenRequest(watching: botId)
}
.symbolEffect(.pulse, options: .repeating)
- .transition(.opacity)
}
- if bot?.isGroup != true {
- IconButton("Call", systemImage: "phone") { calling = true }
+ }
+ if bot?.isGroup != true {
+ ToolbarItem(placement: .topBarTrailing) {
+ Button("Call", systemImage: "phone") { calling = true }
}
- menu
}
- .animation(Motion.reduced(Motion.fade, reduceMotion), value: model.screen?.agentBot == botId)
+ ToolbarItem(placement: .topBarTrailing) { menu }
}
- .hidesSystemNavigationBar()
.codyncOverlay(isPresented: $calling) { close in
CallView(botId: botId, close: close)
}
@@ -252,13 +256,10 @@ public struct ThreadView: View {
.foregroundStyle(Palette.text)
.lineLimit(1)
}
- #if os(iOS)
- .padding(.horizontal, 12)
- .padding(.vertical, 6)
- .glass(in: Capsule())
- #endif
}
- .buttonStyle(.plain)
+ #if os(macOS)
+ .buttonStyle(.plain)
+ #endif
.accessibilityLabel("View conversation details")
.help("View conversation details")
}
@@ -281,41 +282,48 @@ public struct ThreadView: View {
}
#endif
- private var menu: some View {
- DropdownMenu {
- var items = [MenuItem("Full conversation", icon: "list.bullet.rectangle") { showTrace = true }]
- if let bot, bot.isGroup {
- items.append(MenuItem("Edit group", icon: "person.2") { editingGroup = true })
- items.append(MenuItem(bot.pinned ? "Unpin" : "Pin", icon: "pin") { model.setPinned(bot, !bot.pinned) })
- items.append(MenuItem("Delete group", icon: "trash", destructive: true, divider: true) { confirmDelete = bot })
- return items
- }
- if let bot {
- items.append(MenuItem("Edit profile", icon: "pencil") {
- #if os(macOS)
- withAnimation(Motion.reduced(Motion.layout, reduceMotion)) {
- editingDetails = true
- showSettings = true
- }
- if availableWidth < 680 { compactDetails = true }
- #else
- editing = EditorRequest(BotDraft(bot))
- #endif
- })
- items.append(MenuItem(bot.pinned ? "Unpin" : "Pin", icon: "pin") { model.setPinned(bot, !bot.pinned) })
- }
- items.append(MenuItem("New session", icon: "arrow.counterclockwise") { confirmNewSession = true })
- items.append(MenuItem("Delete bot", icon: "trash", destructive: true, divider: true) { confirmDelete = bot })
+ private var menuItems: [MenuItem] {
+ var items = [MenuItem("Full conversation", icon: "list.bullet.rectangle") { showTrace = true }]
+ if let bot, bot.isGroup {
+ items.append(MenuItem("Edit group", icon: "person.2") { editingGroup = true })
+ items.append(MenuItem(bot.pinned ? "Unpin" : "Pin", icon: "pin") { model.setPinned(bot, !bot.pinned) })
+ items.append(MenuItem("Delete group", icon: "trash", destructive: true, divider: true) { confirmDelete = bot })
return items
- } label: {
- Image(systemName: "ellipsis.circle")
- .font(.system(size: InterfaceMetrics.value(mac: 14, mobile: 18), weight: .medium))
- .foregroundStyle(Palette.secondary)
- .frame(width: InterfaceMetrics.value(mac: 28, mobile: 36), height: InterfaceMetrics.value(mac: 28, mobile: 36))
- .contentShape(Rectangle())
}
- .accessibilityLabel("More")
- .help("More")
+ if let bot {
+ items.append(MenuItem("Edit profile", icon: "pencil") {
+ #if os(macOS)
+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) {
+ editingDetails = true
+ showSettings = true
+ }
+ if availableWidth < 680 { compactDetails = true }
+ #else
+ editing = EditorRequest(BotDraft(bot))
+ #endif
+ })
+ items.append(MenuItem(bot.pinned ? "Unpin" : "Pin", icon: "pin") { model.setPinned(bot, !bot.pinned) })
+ }
+ items.append(MenuItem("New session", icon: "arrow.counterclockwise") { confirmNewSession = true })
+ items.append(MenuItem("Delete bot", icon: "trash", destructive: true, divider: true) { confirmDelete = bot })
+ return items
+ }
+
+ private var menu: some View {
+ #if os(iOS)
+ Button("More", systemImage: "ellipsis") { showMenu = true }
+ .codyncMenu(isPresented: $showMenu) { menuItems }
+ #else
+ DropdownMenu { menuItems } label: {
+ Image(systemName: "ellipsis.circle")
+ .font(.system(size: 14, weight: .medium))
+ .foregroundStyle(Palette.secondary)
+ .frame(width: 28, height: 28)
+ .contentShape(Rectangle())
+ }
+ .accessibilityLabel("More")
+ .help("More")
+ #endif
}
}
diff --git a/kit/Tests/CodyncKitTests/RelayVectorsTests.swift b/kit/Tests/CodyncKitTests/RelayVectorsTests.swift
index 5dd0dafe..4c40226b 100644
--- a/kit/Tests/CodyncKitTests/RelayVectorsTests.swift
+++ b/kit/Tests/CodyncKitTests/RelayVectorsTests.swift
@@ -3,13 +3,13 @@ import Foundation
import Testing
@testable import CodyncKit
-/// docs/remote-relay-vectors.json, the single source of truth shared with the host and the cloud.
+/// docs/reference/fixtures/remote-relay-vectors.json, the single source of truth shared with the host and the cloud.
struct Vectors: Sendable {
let data: Data
var json: [String: Any] { (try? JSONSerialization.jsonObject(with: data) as? [String: Any]) ?? [:] }
static let shared = Vectors(data: (try? Data(contentsOf: URL(filePath: #filePath).deletingLastPathComponent()
- .appending(path: "../../../docs/remote-relay-vectors.json").standardized)) ?? Data())
+ .appending(path: "../../../docs/reference/fixtures/remote-relay-vectors.json").standardized)) ?? Data())
subscript(_ section: String) -> [String: Any] { json[section] as? [String: Any] ?? [:] }