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.

docs: describe the desktop app in place of the Mac and Linux apps

leepokaicc04e5233b1c
diff --git a/docs/README.md b/docs/README.md
index 05aa22a7..5fef09da 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -9,6 +9,7 @@ Source review, a passing build, local integration tests and production acceptanc
|---|---|
| Find a module or decide where a file belongs | [File structure](architecture/file-structure.md) |
| Understand clients, host, cloud and data ownership | [Architecture](architecture/overview.md) |
+| Work on the macOS and Linux desktop app (Electron) | [Desktop app](architecture/desktop-app.md) |
| Build, install, restart and run checks | [Development](guides/development.md) |
| Test a phone over Cloudflare instead of LAN | [Cloudflare testing](guides/cloudflare-testing.md) |
| Configure dev/main or deploy the services | [Environments and deployment](guides/environments-and-deployment.md) |
@@ -16,7 +17,7 @@ Source review, a passing build, local integration tests and production acceptanc
| Set up accounts, approvals or desktop SSH | [Accounts and SSH](guides/accounts-and-ssh.md) |
| Change transport or cryptography | [Remote protocol](reference/remote-relay.md) and [shared vectors](reference/fixtures/README.md) |
| Change what the host and clients exchange | [Client and host compatibility](reference/compatibility.md) |
-| Change an Apple screen or button | [UI conventions](design/ui-conventions.md) |
+| Change an iPhone or desktop screen or button | [UI conventions](design/ui-conventions.md) |
## Features
diff --git a/docs/architecture/file-structure.md b/docs/architecture/file-structure.md
index 4e7088fc..71a5ab1f 100644
--- a/docs/architecture/file-structure.md
+++ b/docs/architecture/file-structure.md
@@ -19,31 +19,35 @@ Codync/
│ │ ├── market/ # Marketplace, Composio, MCP OAuth
│ │ └── tui/ # Terminal client (manage.rs + sheets.rs: settings; connections.rs: secure connection requests)
│ └── tests/ # Host integration tests and scripted ACP agents
-├── kit/ # Shared Swift package
-│ ├── Sources/
-│ │ ├── CodyncKit/ # Wire models, transports, design; widget-safe
-│ │ │ ├── Client/
-│ │ │ ├── Models/
-│ │ │ ├── Design/
-│ │ │ └── Resources/
-│ │ └── CodyncUI/ # Stores, shared screens and custom controls
-│ │ ├── Store/
-│ │ ├── Bots/
-│ │ ├── Thread/
-│ │ ├── Call/
-│ │ ├── Screen/
-│ │ ├── Marketplace/
-│ │ ├── Usage/
-│ │ └── Resources/
-│ └── Tests/ # CodyncKitTests and CodyncUITests
├── apps/
│ ├── project.yml # XcodeGen source of truth for every Apple target
│ ├── Codync.xcodeproj/ # Generated Xcode project
│ ├── shared/ # AccountSession, ComputerStatus, Config/{dev,main}.plist
│ ├── ios/ # App/, Views/, Resources/, Widgets/, NotificationService/
-│ ├── macos/ # App/, Views/, Resources/, LaunchAgents/
-│ ├── linux/ # GTK 4/libadwaita desktop client
-│ ├── screen-macos/ # macOS screen helper
+│ │ └── Kit/ # The iPhone app's Swift package
+│ │ ├── Sources/
+│ │ │ ├── CodyncKit/ # Wire models, transports, design; widget-safe
+│ │ │ │ ├── Client/
+│ │ │ │ ├── Models/
+│ │ │ │ ├── Design/
+│ │ │ │ └── Resources/
+│ │ │ └── CodyncUI/ # Stores, screens and custom controls
+│ │ │ ├── Store/
+│ │ │ ├── Bots/
+│ │ │ ├── Thread/
+│ │ │ ├── Call/
+│ │ │ ├── Screen/
+│ │ │ ├── Marketplace/
+│ │ │ ├── Routines/
+│ │ │ ├── Usage/
+│ │ │ └── Resources/
+│ │ └── Tests/ # CodyncKitTests and CodyncUITests
+│ ├── desktop/ # Electron app for macOS and Linux (see desktop-app.md)
+│ │ ├── src/main/ # Host service, tray, account, updates, SSH, screen, speech
+│ │ ├── src/preload/ # window.codync bridge
+│ │ ├── src/renderer/ # React UI: store/, components/, views/
+│ │ └── native/ # codync-speech (macOS on-device speech helper)
+│ ├── screen-macos/ # macOS screen helper (Xcode Screen target)
│ └── screen-linux/ # Linux portal/GStreamer screen helper
├── cloud/ # Account API + encrypted relay Worker and Durable Object
│ ├── src/
@@ -58,7 +62,7 @@ Codync/
└── .github/workflows/ # CI, signing and release automation
```
-`build/`, `kit/.build/`, Cargo `target/`, `node_modules/` and Wrangler local state are generated working data. They are not source modules and should not become documentation locations. Edit `apps/project.yml` and run `xcodegen generate --spec apps/project.yml`; never hand-edit `project.pbxproj`.
+`build/`, `apps/ios/Kit/.build/`, `apps/desktop/out/`, `apps/desktop/dist/`, Cargo `target/`, `node_modules/` and Wrangler local state are generated working data. They are not source modules and should not become documentation locations. Edit `apps/project.yml` and run `xcodegen generate --spec apps/project.yml`; never hand-edit `project.pbxproj`.
## Where to make a change
@@ -75,22 +79,23 @@ Codync/
| Agent discovery, sign-in, setup terminal | `host/src/agent/backends.rs`, `registry.rs`, `auth.rs`, `term.rs` |
| Marketplace, Composio, connector OAuth | `host/src/market/` |
| Screen bridge and built-in MCP tools | `host/src/screen.rs`, `mcp.rs` |
-| Swift transport and cloud API | `kit/Sources/CodyncKit/Client/` |
-| Account aggregation / one host mirror | `kit/Sources/CodyncUI/Store/AccountStore.swift` / `BotStore.swift` |
-| Chat, replies, composer and trace | `kit/Sources/CodyncUI/Thread/` |
-| Reusable Apple UI chrome | `kit/Sources/CodyncUI/Chrome.swift`, `Controls.swift`, `Platform.swift` |
+| Swift transport and cloud API | `apps/ios/Kit/Sources/CodyncKit/Client/` |
+| Account aggregation / one host mirror | `apps/ios/Kit/Sources/CodyncUI/Store/AccountStore.swift` / `BotStore.swift` |
+| iPhone chat, replies, composer and trace | `apps/ios/Kit/Sources/CodyncUI/Thread/` |
+| Reusable iPhone UI chrome | `apps/ios/Kit/Sources/CodyncUI/Chrome.swift`, `Controls.swift`, `Platform.swift` |
| iOS navigation, pairing, account settings | `apps/ios/Views/RootView.swift`, `BotListView.swift`, `PairingView.swift`, `AccountSwitcherView.swift`, `SettingsView.swift` |
| Apple account sessions / public environment config | `apps/shared/AccountSession.swift`, `apps/shared/Config/` |
-| Mac local host / SSH lifecycle | `apps/macos/App/HostController.swift`, `SSHTunnel.swift` |
+| Desktop local host / SSH lifecycle | `apps/desktop/src/main/host-controller.ts`, `ssh.ts` |
+| Desktop store, chat and controls | `apps/desktop/src/renderer/store/bot-store.ts`, `views/thread/`, `components/` |
| Cloud routes / authentication / relay | `cloud/src/index.ts`, `api.ts`, `auth.ts`, `relay.ts` |
| Push encryption / APNs delivery / decryption | `host/src/remote/push.rs`, `relay/src/`, `apps/ios/NotificationService/` |
-| Widget and activity rendering | `kit/Sources/CodyncKit/Design/`, `apps/ios/Widgets/` |
+| Widget and activity rendering | `apps/ios/Kit/Sources/CodyncKit/Design/`, `apps/ios/Widgets/` |
## Dependency rules
- `CodyncKit` owns serializable models, clients and rendering primitives shared with widgets. It must not import `CodyncUI` or ClerkKit.
-- `CodyncUI` owns observable stores and shared application screens. App-specific lifecycle, OAuth configuration and device hooks belong in `apps/`.
-- Each `BotStore` talks to one computer. `AccountStore` aggregates stores and routes by `BotReference`; bare bot IDs are not globally unique.
+- `CodyncUI` owns the iPhone app's observable stores and screens. App-specific lifecycle, OAuth configuration and device hooks belong in `apps/`.
+- Each `BotStore` (Swift, and its TypeScript port in the desktop app) talks to one computer. `AccountStore` aggregates stores and routes by `BotReference`; bare bot IDs are not globally unique.
- The host owns routing, reply counts, permissions and group turn scheduling. Clients render these results; they do not reimplement host policy.
- `cloud/` transports encrypted chat traffic and manages account metadata. `relay/` delivers APNs pushes. The two Workers have separate configuration and tests.
@@ -109,8 +114,8 @@ Codync/
| computer / host | User-facing paired environment / the daemon that serves it |
| cloud / relay | Account + E2E service / context-dependent transport or APNs Worker; always name the directory when ambiguous |
-Use lowercase repository folders; PascalCase folders inside Swift targets. Swift files follow their main type (`UpperCamelCase.swift`), Rust uses `snake_case.rs` (a folder module is `name/mod.rs`), and TypeScript uses `kebab-case.ts`. Prefer one main type per file; small related view siblings can share a plural file such as `ChatRows.swift`.
+Use lowercase repository folders; PascalCase folders inside Swift targets. Swift files follow their main type (`UpperCamelCase.swift`), Rust uses `snake_case.rs` (a folder module is `name/mod.rs`), TypeScript uses `kebab-case.ts`, and React components use `PascalCase.tsx`. Prefer one main type per file; small related view siblings can share a plural file such as `ChatRows.swift`.
-Role suffixes: `View`, `Row`, `Card`, `Window`, `Store`, `Controller`; button styles describe the effect (`PressScale`). Keep feature vocabulary aligned across Swift, Rust, Linux and the terminal client.
+Role suffixes: `View`, `Row`, `Card`, `Window`, `Store`, `Controller`; button styles describe the effect (`PressScale`). Keep feature vocabulary aligned across Swift, the desktop app, Rust and the terminal client.
-UI-specific rules, including the native iPhone toolbar exception, live in [UI conventions](../design/ui-conventions.md).
+UI-specific rules, including the native iPhone toolbar exception and the desktop controls, live in [UI conventions](../design/ui-conventions.md).
diff --git a/docs/architecture/overview.md b/docs/architecture/overview.md
index 785b30a0..9bc6c44d 100644
--- a/docs/architecture/overview.md
+++ b/docs/architecture/overview.md
@@ -6,11 +6,11 @@ Codync keeps agents and their working files on a computer. Clients address that
```mermaid
flowchart LR
- Phone[iPhone / remote Apple client] -->|Encrypted WebSocket| Cloud[cloud/ Worker + ComputerRelay DO]
+ Phone[iPhone] -->|Encrypted WebSocket| Cloud[cloud/ Worker + ComputerRelay DO]
Phone -->|Encrypted direct channel| Host[codync-host]
Cloud <-->|Encrypted frames| Host
- Local[Mac / Linux / TUI] -->|Loopback HTTP + SSE| Host
- SSH[Mac SSH tunnel] -->|Forwarded loopback HTTP + SSE| Host
+ Local[Desktop app / TUI] -->|Loopback HTTP + SSE| Host
+ SSH[Desktop SSH tunnel] -->|Forwarded loopback HTTP + SSE| Host
Host -->|ACP over stdio| Agents[Coding agents]
Host --> DB[(Local SQLite)]
Host -->|Sealed alert| Push[relay/ APNs Worker]
@@ -31,7 +31,8 @@ The phone tries direct candidates first, with a 1.5-second connection race, then
| Long-term bot memory | Host `bots/<botId>/memory/` |
| Account users, computer ownership, devices and grants | `cloud/` D1 |
| Presence, host-signed ACL, offline encrypted mailbox | Per-computer `ComputerRelay` Durable Object |
-| Phone/Mac remote-device signing and push keys | Keychain, partitioned by account context |
+| Phone remote-device signing and push keys | Keychain, partitioned by account context |
+| Desktop account token and cloud device key | App data, encrypted with Electron `safeStorage` |
| Client mirror, widget snapshots, selected computer | Per-account cache/App Group storage |
| APNs signing key and ticket encryption key | `relay/` Worker secrets |
@@ -43,13 +44,13 @@ Cloud account metadata includes names, public keys, ownership and access state.
`agent/bot.rs` serializes each bot's turns and owns its ACP process. A main chat and its reply threads can have distinct sessions. Group turns are queued on member bots and use their main sessions; the group itself has no harness. See [groups and threads](../features/groups-and-threads.md), [collaboration](../features/bot-collaboration.md) and [context/memory](../features/context-and-memory.md).
-## Apple state and routing
+## Client state and routing
-- `AccountSession` owns Clerk integration; `AccountStore` owns one account context's computer stores.
+- On iPhone, `AccountSession` owns Clerk integration; `AccountStore` owns one account context's computer stores.
- `BotReference(accountId, computerId, botId)` identifies a destination. Widgets and pushes carry account/computer scope.
- `BotStore` mirrors one computer and consumes a `HostTransport`: loopback or encrypted channel.
- Account changes retire the old stores; late responses must not update the new context. Signing out erases that context's local credentials and caches.
-- The Mac attaches its local host and configured SSH hosts through loopback transports. Remote Apple connections use device identities.
+- The desktop app (`apps/desktop/`) has its own TypeScript `BotStore` and attaches its local host and configured SSH hosts through loopback only ([desktop app](desktop-app.md)). iPhone connections use device identities.
The product currently prioritizes one computer. Existing account-scoped aggregation and SSH support remain; their presence is not a reason to add multi-computer features without a product requirement.
@@ -63,4 +64,4 @@ Remote screen uses the channel for signaling and WebRTC for media/input. Cloudfl
Application/host major versions must match. The channel wire version (`v=1`), pairing URL version (`v=3`) and the cloud health endpoint's service version are separate values.
-Debug Apple builds use `apps/shared/Config/dev.plist`; Release uses `main.plist`. The host has no default cloud URL. Production fields are currently incomplete in checked-in configuration, so a successful Debug install is not production readiness. See [environments](../guides/environments-and-deployment.md).
+Debug iOS builds use `apps/shared/Config/dev.plist`; Release uses `main.plist`. The desktop app takes the same values through `apps/desktop/tools/account-config.mjs`. The host has no default cloud URL. Production fields are currently incomplete in checked-in configuration, so a successful Debug install is not production readiness. See [environments](../guides/environments-and-deployment.md).
diff --git a/docs/design/mobile-widgets.md b/docs/design/mobile-widgets.md
index eea33cbe..219d36f0 100644
--- a/docs/design/mobile-widgets.md
+++ b/docs/design/mobile-widgets.md
@@ -43,7 +43,7 @@
- App 教學、設定清單與說明支援 Dynamic Type;無障礙大字體改用選單切換類型/provider。固定大小的 widget 保留緊湊數值,並提供完整的 VoiceOver 用量與重置描述。
- 教學涵蓋 Home Screen 與 Lock Screen;新增 WidgetKit 原生預覽涵蓋小/中尺寸、矩形/圓形/行內配件與空狀態。
-`kit/Sources/CodyncKit/Design/WidgetCards.swift` 是共用繪製元件;`apps/ios/Views/WidgetGalleryView.swift` 與 `apps/ios/Widgets/CodyncWidgets.swift` 共用它,減少預覽與實際 widget 的差異。
+`apps/ios/Kit/Sources/CodyncKit/Design/WidgetCards.swift` 是共用繪製元件;`apps/ios/Views/WidgetGalleryView.swift` 與 `apps/ios/Widgets/CodyncWidgets.swift` 共用它,減少預覽與實際 widget 的差異。
## Live Activity 與 Dynamic Island
@@ -84,13 +84,13 @@ Dynamic Island 固定黑底,文字採淺色;Lock Screen 卡片配合系統
## 驗證
-執行 `swift test --package-path kit` 與 `python3 tools/render-widgets.py` 檢查共用邏輯及繪製。系統 WidgetKit/ActivityKit 預覽在 `apps/ios/Widgets/WidgetPreviews.swift`。
+在 `apps/ios/Kit` 以 iOS 模擬器執行 `xcodebuild test -scheme CodyncKit-Package`檢查共用邏輯。系統 WidgetKit/ActivityKit 預覽在 `apps/ios/Widgets/WidgetPreviews.swift`。
實機仍需分別確認加入 Home/Lock Screen widget、編輯 provider、跨帳號切換、背景刷新,以及 Live Activity/APNs 更新。共用圖片與 build 成功不等於這些系統整合已通過。[歷史檢查紀錄](../archive/mobile-widgets-verification-2026-09-26.md) 保留當時的測試範圍與操作限制。
## Halftone 與 Thinking Orbs(2026-09-26)
-Bot 的角色頭像使用 `CharacterAvatar` 點陣;provider 圖示由 `ProviderMascot` 選擇,小尺寸可使用隨 app 打包的官方 provider 圖示。15 pt 用 7 × 7、20–26 pt 用 9 × 9、28 pt 以上用 13 × 13 網格,保留鏤空眼睛並提高小尺寸墨色。iOS 與 macOS 共用 provider 呈現邏輯。
+Bot 的角色頭像使用 `CharacterAvatar` 點陣;provider 圖示由 `ProviderMascot` 選擇,小尺寸可使用隨 app 打包的官方 provider 圖示。15 pt 用 7 × 7、20–26 pt 用 9 × 9、28 pt 以上用 13 × 13 網格,保留鏤空眼睛並提高小尺寸墨色。iOS App 與 widgets 共用 provider 呈現邏輯;桌面 App 的對應實作在 `apps/desktop/src/renderer/views/usage/ProviderMascot.tsx`。
狀態圖示以 [Jakub Antalik 的 thinking-orbs](https://github.com/Jakubantalik/thinking-orbs) 為來源,這次原生移植四種實際使用的造型:
@@ -107,4 +107,4 @@ Bot 的角色頭像使用 `CharacterAvatar` 點陣;provider 圖示由 `Provide
App 內動畫最多 30 fps;離開畫面、App 非 active 或啟用 Reduce Motion 時顯示靜態幀。Widget、Live Activity 與 Dynamic Island 明確傳入 `animated: false`,不依賴持續動畫計時。狀態仍隨既有資料更新。
-上游 MIT 授權全文隨 `CodyncKit` resource bundle 發佈,位於 `kit/Sources/CodyncKit/Resources/ThirdPartyNotices/thinking-orbs-LICENSE.txt`。`ThinkingOrbGeometryTests` 使用上游獨立 golden vectors 的取樣,驗證四種造型 × 兩尺寸 × 四時間點的 dot/line 數量、位置、半徑、墨色及深度順序。其餘五種上游造型暫未移植;有對應產品狀態時再加入。
+上游 MIT 授權全文隨 `CodyncKit` resource bundle 發佈,位於 `apps/ios/Kit/Sources/CodyncKit/Resources/ThirdPartyNotices/thinking-orbs-LICENSE.txt`。`ThinkingOrbGeometryTests` 使用上游獨立 golden vectors 的取樣,驗證四種造型 × 兩尺寸 × 四時間點的 dot/line 數量、位置、半徑、墨色及深度順序。其餘五種上游造型暫未移植;有對應產品狀態時再加入。
diff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.md
index 4711c237..70e6a20b 100644
--- a/docs/design/ui-conventions.md
+++ b/docs/design/ui-conventions.md
@@ -2,64 +2,60 @@
## iPhone navigation
-The bot list and conversation use the system `NavigationStack` toolbar. `ToolbarItem` owns the account button, centered computer status/filter menu, and new-chat button. Computer management is inside the centered menu. The conversation copies Grok Bot: the title pill is a native `Menu` (details and the bot's actions), the only trailing button is the computer (remote screen; it pulses while this bot operates the screen), and the call button sits in the composer as a filled waveform capsule while the box is empty. Menus opened from toolbar buttons (New, the computer filter, the title) are native `Menu`s, because the bar hosts its items outside SwiftUI's layout and `.codyncMenu` can't anchor to them; the conversation uses the system back button. iOS supplies Liquid Glass, control sizing, grouping and interaction feedback.
+The bot list and conversation use the system `NavigationStack` toolbar. `ToolbarItem` owns the account button, centered computer status/filter menu, and new-chat button. Computer management is inside the centered menu. The conversation copies Grok Bot: the title pill is a native `Menu` (details and the bot's actions), the only trailing button is the computer (remote screen; it pulses while this bot operates the screen), and the call button sits in the composer as a filled waveform capsule while the box is empty. Menus opened from toolbar buttons (New, the computer filter, the title) are native `Menu`s, like every iOS menu; the conversation uses the system back button. iOS supplies Liquid Glass, control sizing, grouping and interaction feedback.
The conversation keeps the native glass buttons over the chat with a soft top scroll-edge effect, so messages blur out under the header instead of running sharp behind it. Root error dialogs use an in-place, full-screen scrim so presenting them does not change the underlying glass controls' appearance.
Do not wrap those toolbar controls in `IconButtonStyle`, hand-sized rounded backgrounds or another glass effect. The account avatar is toolbar content, with the system supplying the enclosing surface. This is the explicit exception to the custom-chrome rule below.
-Connecting and reconnecting are background work. `BotStore` gives initial offline reports 1 second to recover and holds drops from online (including relay "computer offline" reports) for 5 seconds. "No access" shows immediately. Automatic read acknowledgements never open an error dialog and visible conversations are acknowledged again after reconnecting. An action taken during a reconnect (back in the foreground, a new network, a drop still inside its grace) waits for the link, up to 20 seconds, instead of failing; while one waits, headers read `Connecting…` and the conversation's connection label shows a spinner. Calls that are safe to repeat (send, stop, approvals, pin, hide, mark as read, delete) are tried again when the link drops under them. Tapping while the header says Offline because the computer can't be reached starts a fresh connection attempt and waits for it, instead of failing until the backoff gets there; a computer the relay reports as off fails at once, since the relay says when it is back. A permission card shows a spinner on the chosen option, dims the others and takes no second answer until the computer has it. The Linux app and the TUI follow the same rule over loopback: a command the host can't be reached for is retried for up to 20 seconds behind their "Reconnecting…" indicator (the `hello` probe that explains an unreachable host still answers at once), and their permission cards spin on the chosen option. The "Something went wrong" dialog is left for a computer that is off, a refused device, the computer's own answers, and reconnects that outlast the wait. Background work (cloud refresh, device registration, automatic access requests) logs connection, busy-cloud and stale-token failures instead of showing them. The iOS app disconnects only in `.background`, not `.inactive`. Connection status lives only in headers and their menus. The roster header shows a small summary (`1 connected`, `1/2 connected`, `2 offline`, or `Connecting…`). Its computer menu supports multiple selections, Show only, All computers, reconnect, and management. At least one available computer stays selected; if saved exclusions would hide every computer, the list falls back to all. Filters persist on the device. Bots sort pinned first, then by recency. On iPhone, when more than one computer is shown, each computer gets a light heading (badge, name, connection, and "No bots yet" when empty) above its own bots; with one computer the list stays flat. Tapping a heading folds that computer's bots away (chevron; saved on the device). Long-press a heading to lift the whole section and drag it up or down; the other sections slide out of its way and the order is saved on the device on release (`AccountStore.move`; VoiceOver: Move up / Move down). The Mac shows a flat roster. There are no connection banners. The compact Mac rail uses a computer icon for the same menu. Conversation headers show a small connection label, with the computer name available in the header menu or help text. Pull-to-refresh remains available on iPhone. Computer setup and access requests live under Manage computers.
+Connecting and reconnecting are background work. `BotStore` gives initial offline reports 1 second to recover and holds drops from online (including relay "computer offline" reports) for 5 seconds. "No access" shows immediately. Automatic read acknowledgements never open an error dialog and visible conversations are acknowledged again after reconnecting. An action taken during a reconnect (back in the foreground, a new network, a drop still inside its grace) waits for the link, up to 20 seconds, instead of failing; while one waits, headers read `Connecting…` and the conversation's connection label shows a spinner. Calls that are safe to repeat (send, stop, approvals, pin, hide, mark as read, delete) are tried again when the link drops under them. Tapping while the header says Offline because the computer can't be reached starts a fresh connection attempt and waits for it, instead of failing until the backoff gets there; a computer the relay reports as off fails at once, since the relay says when it is back. A permission card shows a spinner on the chosen option, dims the others and takes no second answer until the computer has it. The desktop app's `BotStore` (`apps/desktop/src/renderer/store/bot-store.ts`) applies the same graces and 20-second wait. The TUI follows the same rule over loopback: a command the host can't be reached for is retried for up to 20 seconds behind its "Reconnecting…" indicator (the `hello` probe that explains an unreachable host still answers at once), and its permission cards spin on the chosen option. The "Something went wrong" dialog is left for a computer that is off, a refused device, the computer's own answers, and reconnects that outlast the wait. Background work (cloud refresh, device registration, automatic access requests) logs connection, busy-cloud and stale-token failures instead of showing them. The iOS app disconnects only in `.background`, not `.inactive`. Connection status lives only in headers and their menus. The roster header shows a small summary (`1 connected`, `1/2 connected`, `2 offline`, or `Connecting…`). Its computer menu supports multiple selections, Show only, All computers, reconnect, and management. At least one available computer stays selected; if saved exclusions would hide every computer, the list falls back to all. Filters persist on the device. Bots sort pinned first, then by recency. On iPhone, when more than one computer is shown, each computer gets a light heading (badge, name, connection, and "No bots yet" when empty) above its own bots; with one computer the list stays flat. Tapping a heading folds that computer's bots away (chevron; saved on the device). Long-press a heading to lift the whole section and drag it up or down; the other sections slide out of its way and the order is saved on the device on release (`AccountStore.move`; VoiceOver: Move up / Move down). The desktop app shows a flat roster. There are no connection banners. The compact desktop rail uses a computer icon for the same menu. Conversation headers show a small connection label, with the computer name available in the header menu or help text. Pull-to-refresh remains available on iPhone. Computer setup and access requests live under Manage computers.
-Sources: `apps/ios/Views/BotListView.swift`, `AccountSwitcherView.swift`, `kit/Sources/CodyncUI/Thread/ThreadView+iOS.swift`, `Bots/ComputerFilterHeader.swift`, `Store/ComputerSelection.swift`, `Bots/BotRow.swift`.
+Sources: `apps/ios/Views/BotListView.swift`, `AccountSwitcherView.swift`, `apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView+iOS.swift`, `Bots/ComputerFilterHeader.swift`, `Store/ComputerSelection.swift`, `Bots/BotRow.swift`; desktop: `apps/desktop/src/renderer/views/ChatWindow.tsx`, `ComputerFilterHeader.tsx`, `BotRow.tsx`.
-## macOS menu bar
+## Desktop menu bar (tray)
-Release update controls live in the native Settings → Updates menu; the chat
+Release update controls live in the tray's Settings → Updates submenu; the chat
window's Settings has the same controls on its Updates page (**Check for updates**,
-which becomes **Update to <version>** once a release is found). GTK's Settings has
-Host updates on its Updates page and the TUI action list has **Check for updates**.
-Sparkle's standard update/install windows are a native system-integration exception; keep
-signature errors, progress and relaunch in its supported user driver.
+which becomes **Update to <version>** once a release is found). The TUI action list
+has **Check for updates**. Download and install go through electron-updater
+(`apps/desktop/src/main/updates.ts`); there is no separate update window.
-Use `MenuBarExtra` with `.menuBarExtraStyle(.menu)`. Its commands, submenus, checkmarked toggles, usage-icon picker, separators and keyboard navigation use system styling. Do not add custom cards, hover backgrounds, icon buttons or a window-style menu panel here.
+The tray menu is Electron's native `Menu` (`apps/desktop/src/main/tray.ts`), the only system menu in the desktop app. Its commands, submenus, checkboxes, usage-icon radio items, separators and keyboard navigation use system styling. Do not add custom cards, hover backgrounds, icon buttons or a window-style menu panel here.
-The menu retains host installation/restart, bot conversation/stop actions, approval review, usage limits, remote-screen permissions, launch-at-login and quit. Pairing opens a separate titled window because its QR needs a persistent scanning surface. The chat window retains its own UI conventions.
+The menu retains host installation/restart, bot conversation/stop actions, approval review, usage limits, remote-screen permissions, open-at-login and quit. Pairing opens a separate titled window because its QR needs a persistent scanning surface. The chat window retains its own UI conventions.
Usage limits appear directly in the top-level menu, grouped by provider with native section headers. Show each window's percentage, reset time when available, and the provider's last update; do not hide them in submenus. The account menu's
Usage row shows no number; it opens Settings' Usage page with the same per-provider bars (`UsageLimits`).
-## Account menu and Settings (Mac, Linux)
+## Account menu and Settings (desktop)
-The chat window's account menu copies Grok Bot's: Usage, Get Codync for mobile, Support, Settings, then the signed-in account and Sign out. Everything else is a page of **Settings**, laid out like ChatGPT's desktop settings (references in `reference/chatgpt-settings-*.png`): a sidebar of pages under small group labels (Personal: General, Voice chat, Usage; This Mac: Computers, Updates) and a large page title over the page's sections. Manage computers and approval badges lead to the Computers page. Linux uses `adw::PreferencesDialog` with Computers, Usage and Updates pages (it has no account or voice chat); the iPhone keeps its Computers & settings sheet. Source: `apps/macos/Views/SettingsView.swift`, `apps/linux/src/dialogs.rs` (`settings_page`).
+The chat window's account menu copies Grok Bot's: Usage, Get Codync for mobile, Support, Settings, then the signed-in account and Sign out. Everything else is a page of **Settings**, laid out like ChatGPT's desktop settings (references in `reference/chatgpt-settings-*.png`): a sidebar of pages under small group labels (Personal: General, Voice chat, Usage; This Mac, or This computer on Linux: Computers, Updates) and a large page title over the page's sections. Manage computers and approval badges lead to the Computers page. The iPhone keeps its Computers & settings sheet. Source: `apps/desktop/src/renderer/views/settings/SettingsView.tsx`, account menu in `apps/desktop/src/renderer/views/ChatWindow.tsx`.
-Source: `apps/macos/App/CodyncMacApp.swift`.
+## iPhone and desktop code
-## Shared code across iPhone and Mac
+The iPhone and the desktop no longer share UI code. `CodyncUI` (`apps/ios/Kit/`) is the iPhone app's own package; the desktop app (`apps/desktop/src/renderer/`) is a TypeScript port of the same screens with its own `BotStore`, chat items (`views/thread/chat-items.ts`) and Markdown blocks (`markdown-blocks.ts`).
-`CodyncUI` is compiled into both apps, so editing a shared view or a control's default changes both. To keep a change for one platform from leaking into the other:
-
-- A shared view or control must look the same on both platforms, apart from `InterfaceMetrics.value(mac:mobile:)` sizes. A one-platform look goes in that value's own side, or in a platform file; never change a shared default (fill, spacing, font) for one platform.
-- Where a screen's chrome differs, it lives in a whole-file platform extension (`ThreadView+iOS.swift`, `ThreadView+macOS.swift`: `platformBody`, `platformChrome`, `header`), not in `#if os()` branches inside the shared body.
-- The conversation itself is per platform too: `transcript` (a chat's messages) and `messages` (a thread's replies) live in `ThreadView+…` / `RepliesView+…`. The Mac keeps every loaded message in a lazy stack and scrolls to the newest as it changes. iPhone renders the newest page first and earlier ones as the reader scrolls up, follows the newest message until they scroll away (`ConversationFollow+iOS.swift`, with a round "Jump to latest" button), and reveals a reply steadily as it's written (`ChatRows+iOS.swift`, `MarkdownText+iOS.swift`). Logic both can use stays shared: `ChatItem.build`, `MarkdownBlocks`.
-- A commit that touches `kit/` is scoped `kit`, not `macos` or `ios`, and is checked on both platforms.
+- iPhone chrome lives in whole-file platform extensions (`ThreadView+iOS.swift`: `platformBody`, `platformChrome`, `header`). The iPhone conversation renders the newest page first and earlier ones as the reader scrolls up, follows the newest message until they scroll away (`ConversationFollow+iOS.swift`, with a round "Jump to latest" button), and reveals a reply steadily as it's written (`ChatRows+iOS.swift`, `MarkdownText+iOS.swift`).
+- The desktop UI rules (custom controls, no system menus except the tray, icon-only buttons, fill or border) are implemented in `apps/desktop/src/renderer/components/` (`Controls.tsx`, `Overlay.tsx`, `Icon.tsx`).
+- A change to one lands in the other and the TUI in the same change; see [native client parity](#native-client-parity).
## Shared application controls
-Other custom screens use `Chrome.swift` and `Controls.swift`:
+Other custom iPhone screens use `Chrome.swift` and `Controls.swift`. The desktop equivalents are in `Overlay.tsx` (`Sheet`, `Dialog`, `AnchoredMenu`, `ModalHeader`) and `Controls.tsx` (`IconButton`, `DropdownMenu`, `ChoicePicker`, `Switch`, `CardForm`, `CardSection`, `ValueRow`).
| Need | Component |
|---|---|
-| Modal or full-window overlay | `.codyncSheet` (system sheet on iPhone, centered card on Mac), `.codyncOverlay` |
+| Modal or full-window overlay | `.codyncSheet` (system sheet), `.codyncOverlay` |
| Header outside the native bot navigation flow | `ModalHeader`, `ScreenHeader` |
| Icon action | `IconButton` |
| Tab selection | `TabBar` |
-| Menu / confirmation | `.codyncMenu` (macOS), `DropdownMenu` / `.contextActions` (system menus on iOS), `.codyncDialog` |
+| Menu / confirmation | `DropdownMenu` / `.contextActions` (system menus), `.codyncDialog` |
| Toggle | `ToggleStyle.codync` |
| Form-like content | `CardForm`, `CardSection` (a small bold heading over a filled, rounded group; rows split by inset hairlines; a row is `ValueRow` with an optional one-line `detail`, and its picker is an outlined `ChoicePicker`) |
Avoid adding stock `Menu`, `Picker`, `Form`/`List` styling, switch toggles, alerts, `ProgressView`, `TabView` or system sheets to these flows. System presentation APIs inside the shared chrome implementation are implementation details, not permission to bypass the components in feature screens. Native WidgetKit/ActivityKit containers and OS authentication/permission flows remain system integrations.
-No scroll bars: scroll indicators never show, on either platform (`.scrollIndicators(.never)` on each app's root, so every scroll view inherits it).
+No scroll bars: scroll indicators never show (`.scrollIndicators(.never)` on the iPhone app's root, so every scroll view inherits it; hidden scrollbars in `apps/desktop/src/renderer/styles/theme.css`).
Anything with a background fill gets no extra drawn border. Use `Palette`, `InterfaceMetrics` and `Motion`; visibility changes animate and honor Reduce Motion. Icon-only actions have an accessibility label and desktop help where applicable. Reserve text for actions an icon cannot clearly express.
@@ -67,23 +63,23 @@ Anything with a background fill gets no extra drawn border. Use `Palette`, `Inte
`CharacterAvatar` identifies a bot. `ThinkingOrb` conveys working, searching, listening or connecting and needs adjacent text or an accessible outer label. In-app animation pauses off-screen, when inactive, or with Reduce Motion. Widgets/activities use static frames.
-Provider identity and activity presentation are shared in `CodyncKit/Design`; use those components rather than re-creating mappings per app. See [mobile widgets](mobile-widgets.md) for current rendering and previews.
+On iPhone, provider identity and activity presentation are shared with widgets in `CodyncKit/Design`; use those components rather than re-creating mappings per target. The desktop draws them in `components/AgentIcon.tsx`, `Avatar.tsx` and `ThinkingOrb.tsx`. See [mobile widgets](mobile-widgets.md) for current rendering and previews.
The [2026-09-25 audit](../archive/ui-audit-2026-09-25.md) is historical. Its old line numbers and recommendations are not the current UI policy or a list of confirmed open bugs.
Model discovery keeps loading and refresh in one fixed-size slot beside the Model picker. Refresh retains the current catalog while loading, and loading does not add a separate row to the settings card. The Model label keeps its intrinsic width; the model picker takes the remaining width and truncates long names, with the full name available in its tooltip and menu.
-## macOS conversation details
+## Desktop conversation details
-The details inspector uses a compact device summary instead of an empty screen preview. Keep the computer name, remote-screen state, and iPhone hint together; show the hint only when screen capture is ready. Use 16-point horizontal insets and 28-point section gaps. Its sections (computer, Routines, Agent) and the Settings tab (`BotSettingsForm`: Profile, Agent, Activity, Connectors, Skills, Memory) use the `CardSection` look: filled 16-point groups without borders, hairline-split rows, a note under each option.
+The details inspector (`apps/desktop/src/renderer/views/thread/DetailsPanel.tsx`) uses a compact device summary instead of an empty screen preview. Keep the computer name, remote-screen state, and iPhone hint together; show the hint only when screen capture is ready. Use 16-point horizontal insets and 28-point section gaps. Its sections (computer, Routines, Agent) and the Settings tab (`BotSettingsForm`: Profile, Agent, Activity, Connectors, Skills, Memory) use the `CardSection` look: filled 16-point groups without borders, hairline-split rows, a note under each option.
-Routines are a compact grouped list: name, a one-line schedule (or the live run state), and an on/off switch per row; tapping a row opens the same form as +, filled in, with delete and test run beside Save. On the Mac the form card fits its content. The header's chat button asks the bot (puts "I want a routine that " in the composer); + opens the form, where When to run is a type choice and cron is typed directly. The empty state is one line of text. A saved webhook routine's form shows the public URL and key as filled monospaced rows with copy, show/hide and replace-key (confirmed) icon buttons, and one caption on how to send and that deliveries pass through the Codync cloud. Agent metadata uses Runtime and Workspace labels for personal bots, or Project folder for explicitly configured projects; project paths remain selectable and wrap. Personal workspace paths stay out of the default details UI. Keep status and section headings readable in both appearances through `Palette`.
+Routines are a compact grouped list: name, a one-line schedule (or the live run state), and an on/off switch per row; tapping a row opens the same form as +, filled in, with delete and test run beside Save. On the desktop the form card fits its content. The header's chat button asks the bot (puts "I want a routine that " in the composer); + opens the form, where When to run is a type choice and cron is typed directly. The empty state is one line of text. A saved webhook routine's form shows the public URL and key as filled monospaced rows with copy, show/hide and replace-key (confirmed) icon buttons, and one caption on how to send and that deliveries pass through the Codync cloud. Agent metadata uses Runtime and Workspace labels for personal bots, or Project folder for explicitly configured projects; project paths remain selectable and wrap. Personal workspace paths stay out of the default details UI. Keep status and section headings readable in both appearances through `Palette`.
On iPhone, the routine editor keeps the full-width save action in a fixed footer on the sheet background. When required fields are empty, the footer explains why saving is unavailable.
New bots use automatically allocated personal workspaces. Settings offer Personal or an optional project folder; see [bot workspaces](../features/bot-workspaces.md).
-Shared `.codyncMenu` lists scroll vertically when their content exceeds 420 points or the available space beside the trigger. Menus open toward the side with more vertical room; short lists keep their content height. Menu width is capped at 320 points and constrained to the window, and long option titles remain available through help text. This applies to Agent, Model, and other shared choice menus on macOS. On iOS every menu is the system one: `DropdownMenu` and `ChoicePicker` present the native `Menu` (choices as checkmarked toggles) and `.contextActions` the native `contextMenu` (reactions as a palette row), because an overlay anchored by global frame lands in the wrong place inside `.codyncSheet`, scroll views and the composer (the + menu opened mid-screen on iPhone, 2026-09-30). `.codyncMenu` is macOS-only and does not compile on iOS. Each computer has its own marketplace; its header names the computer and, with several online, switches between them. A new bot's editor on iPhone has a Computer dropdown listing every computer in the current account, including computers hidden by the roster filter and offline computers. It remains a dropdown with one computer. Offline choices stay selectable and are labeled; creation waits until the selected computer is online. Switching computers resets the folder, model and connectors that belonged to the old computer.
+Desktop menus (`AnchoredMenu` in `Overlay.tsx`) scroll vertically when their content exceeds 420 points or the available space beside the trigger. Menus open toward the side with more vertical room; short lists keep their content height. Menu width is capped at 320 points and constrained to the window, and long option titles remain available through help text. This applies to Agent, Model, and other choice menus on the desktop. On iOS every menu is the system one: `DropdownMenu` and `ChoicePicker` present the native `Menu` (choices as checkmarked toggles) and `.contextActions` the native `contextMenu` (reactions as a palette row), because an overlay anchored by global frame lands in the wrong place inside `.codyncSheet`, scroll views and the composer (the + menu opened mid-screen on iPhone, 2026-09-30). Each computer has its own marketplace; its header names the computer and, with several online, switches between them. A new bot's editor on iPhone has a Computer dropdown listing every computer in the current account, including computers hidden by the roster filter and offline computers. It remains a dropdown with one computer. Offline choices stay selectable and are labeled; creation waits until the selected computer is online. Switching computers resets the folder, model and connectors that belonged to the old computer.
## Reading conversations
@@ -94,54 +90,31 @@ The iPhone conversation navigation title includes a compact second line with the
## Native client parity
-UI changes apply to SwiftUI (iOS/macOS), Linux GTK and the terminal client together.
-Use each platform's controls while preserving the same actions, information and states.
-The October 2026 parity changes bring GTK and TUI up to the existing SwiftUI behavior;
-SwiftUI already supplies these actions and needs no duplicate implementation.
+UI changes apply to iOS SwiftUI (`apps/ios/`, `apps/ios/Kit/Sources/CodyncUI/`), the
+desktop app (`apps/desktop/src/renderer/`) and the terminal client (`host/src/tui/`)
+together. Use each platform's controls while preserving the same actions, information
+and states. The desktop app was ported view by view from the SwiftUI Mac app and
+carries its behavior; the October 2026 parity changes brought the TUI up to it.
- Chat and threads show the latest non-final agent segment only while that lane is
working and connected. Earlier narration, tools, empty text and `(pass)` stay out
of chat. Completed replies remain visible.
-- GTK's **Load earlier messages** requests older history without evicting loaded pages.
- Failed messages retain their attachments and nonce for **Resend**, and can be deleted.
- Reactions work in chats and threads. Attachments save to Downloads without replacing
- an existing file.
- TUI keeps text and attachments in the composer until sending succeeds. A failed
send can be retried with Enter; it reuses the nonce. A late response must not erase
a draft edited while the request was running.
-- GTK bot menus include **Memory** and **Routines**. Memory supports forgetting one or
- all facts. Routines are a boxed list with an on/off switch,
- edit, test run and delete per row; + opens the form (type + raw cron, host
- preview) and the chat button asks the bot in the composer. The host validates schedules;
- editing can preserve existing event, interval and multiple triggers.
-- GTK **Marketplace** includes agents, connectors and skills. Agent setup supports
- install/login terminals, browser authentication and masked credential fields.
- VTE's terminal sends ordered input, receives output, resizes with its view and closes
- the host terminal when dismissed. Ctrl+click opens HTTP(S) links.
- TUI **C** opens a pending connection request in the current lane; selecting a request
and pressing Enter opens that request. Credentials, connector installation/sign-in
and hosted apps use the secure setup APIs. Ctrl+X cancels the request; Escape closes
the editor without cancelling. Secrets are masked and never sent as chat text.
-- TUI bot settings include **Use computer**, matching SwiftUI and GTK. The separate
- remote-screen viewer and voice-call UI remain phone-specific capabilities.
+- TUI bot settings include **Use computer**, matching the iPhone and desktop apps. The
+ remote-screen viewer and voice-call UI are not in the TUI.
### Verification
-Run Rust format, Clippy and tests for `host/` and `apps/linux/`. Linux needs
-`libgtk-4-dev`, `libadwaita-1-dev` and `libvte-2.91-gtk4-dev` (VTE 0.70+).
-
-The native GTK test runs real widgets and HTTP/SSE calls against an isolated fixture:
-
-```sh
-cd apps/linux
-GTK_A11Y=none CODYNC_UI_ARTIFACTS=/tmp/codync-ui \
- xvfb-run -a dbus-run-session -- python3 tests/ui_fixture.py
-```
-
-Install `xvfb`, `dbus-x11` and `imagemagick` for that command. It exercises history,
-streaming, retry/discard, reactions, attachment downloads, memory, routines, skill
-installation, masked agent credentials and terminal cleanup. Downloads and tokens stay
-inside its temporary directory. CI runs it on both Linux architectures and uploads
-screenshots as `native-ui-linux-*` artifacts. Host tests cover TUI draft recovery,
-lane-specific streaming, computer settings and complete connection-request API flows.
-These fixtures do not authenticate real third-party accounts.
+Run Rust format, Clippy and tests for `host/`, `npm run typecheck && npm test` in
+`apps/desktop/`, and `xcodebuild test -scheme CodyncKit-Package` on an iOS simulator
+from `apps/ios/Kit/`. Desktop UI checks use the `CODYNC_DEBUG_OPEN` and
+`CODYNC_REMOTE_DEBUG` switches described in the
+[desktop app doc](../architecture/desktop-app.md#development). Host tests cover TUI
+draft recovery, lane-specific streaming, computer settings and complete
+connection-request API flows. These checks do not authenticate real third-party accounts.
diff --git a/docs/features/bot-collaboration.md b/docs/features/bot-collaboration.md
index e96c1753..166941c7 100644
--- a/docs/features/bot-collaboration.md
+++ b/docs/features/bot-collaboration.md
@@ -6,7 +6,7 @@ Create two or more bots normally, giving each a clear name, description, project
Every bot receives the built-in `team` MCP server. `list_bots` returns the other visible bots' IDs, descriptions, agents, folders and status. `ask_bot(botId, message)` sends a self-contained request and waits for the recipient's final text reply. The requesting bot incorporates that answer into its response to you. The same tools work across ACP backends that support MCP servers.
-The host records the request and its outcome in both chats using existing notice entries, so the current iOS, macOS, Linux and terminal clients can display them. Tool details also remain in the trace. There is no additional team setup screen.
+The host records the request and its outcome in both chats using existing notice entries, so the current iOS, desktop and terminal clients can display them. Tool details also remain in the trace. There is no additional team setup screen.
## Execution
diff --git a/docs/features/connector-credentials.md b/docs/features/connector-credentials.md
index c45855e6..39af43ef 100644
--- a/docs/features/connector-credentials.md
+++ b/docs/features/connector-credentials.md
@@ -1,6 +1,6 @@
# Connector setup and credentials
-Codync uses one host-owned connection workflow on iOS, macOS and Linux. A
+Codync uses one host-owned connection workflow on iOS and the desktop app (macOS, Linux). A
Marketplace installation and a bot's connection request use the same installation,
OAuth and verification endpoints. The clients never implement a separate password
store. A phone submits credentials through its authenticated encrypted channel to
diff --git a/docs/features/file-attachments.md b/docs/features/file-attachments.md
index 3663c3d4..1eea2fa5 100644
--- a/docs/features/file-attachments.md
+++ b/docs/features/file-attachments.md
@@ -1,10 +1,11 @@
# File attachments
-Photos and files sent with a message, from the iPhone and the Mac.
+Photos and files sent with a message, from the iPhone and the desktop app.
- Composer: the **+** button left of the message box. iPhone: a menu with Photos (sent as JPEG) and
- Files (plus Paste when the clipboard has an image); Mac: an open panel. Files and images can
- also be dropped on the box or pasted: ⌘V on the Mac takes a copied image or file, and on the
+ Files (plus Paste when the clipboard has an image); desktop: an open panel. Files and images can
+ also be dropped on the box or pasted: ⌘V / Ctrl+V on the desktop takes a copied image or file
+ (`apps/desktop/src/renderer/views/thread/Composer.tsx`), and on the
iPhone a "Paste image" chip appears above the box while typing after an image was copied.
HEIC/TIFF/BMP become JPEG (`OutgoingFile.prepared`, `Thread/Attachments.swift`). Picked files show as chips above
the text and can be removed; a message can be files only. Not in group chats (a group has no
@@ -24,8 +25,7 @@ Photos and files sent with a message, from the iPhone and the Mac.
- Chat: images show as pictures (tap for full size), other files as cards. Other devices fetch a
sent file with `readUpload {botId, uploadId, offset}` (384 KiB chunks) and cache it; the sender
caches its own copy at upload.
-- Linux app: the paperclip in the composer (file chooser) or files dropped on the box; sent files
- show as name/size cards (no image previews yet). Terminal UI: dragging a file onto the terminal
- pastes its path, which becomes an attachment (⌫ on an empty draft removes the last one); sent
- files show as `▤ name size` lines. Both upload with the same `upload` chunks.
+- Terminal UI: dragging a file onto the terminal pastes its path, which becomes an attachment (⌫ on
+ an empty draft removes the last one); sent files show as `▤ name size` lines. It uploads with the
+ same `upload` chunks.
- A files-only message previews in the roster as its file names.
diff --git a/docs/features/groups-and-threads.md b/docs/features/groups-and-threads.md
index 86b11398..ba6271c8 100644
--- a/docs/features/groups-and-threads.md
+++ b/docs/features/groups-and-threads.md
@@ -1,6 +1,6 @@
# Group chats and threads
-Both features live in the host. Every client (iPhone, Mac, Linux, terminal) calls the same
+Both features live in the host. Every client (iPhone, desktop, terminal) calls the same
methods and renders the same data: none of them routes messages, parses mentions or counts
replies itself.
@@ -69,6 +69,6 @@ replies itself.
## Client checklist
Roster row for groups (member avatars), a trace per lane (main chat, or one thread), author label on group replies, the thread summary
-under a root (opens the thread; "N new" while `unread > 0`), "Reply in thread" on any main-chat message (Mac: while the pointer is over a message, its footer beside the time shows quick reactions, reply, copy — never on the bubble; iPhone: long-press, reactions on top of the menu), reactions under a message (tap to take back), a thread view
+under a root (opens the thread; "N new" while `unread > 0`), "Reply in thread" on any main-chat message (desktop: while the pointer is over a message, its footer beside the time shows quick reactions, reply, copy — never on the bubble; iPhone: long-press, reactions on top of the menu), reactions under a message (tap to take back), a thread view
(root, replies, composer sending `threadId`), group create/edit (name, members), Stop in a
group calls `stop` with the group id.
diff --git a/docs/features/marketplace.md b/docs/features/marketplace.md
index f51a133b..ec79ad20 100644
--- a/docs/features/marketplace.md
+++ b/docs/features/marketplace.md
@@ -21,7 +21,7 @@ Installing a remote connector probes it; a 401 marks it `signedOut` and bots don
| Where the user signs in | Redirect URI | Who finishes |
| --- | --- | --- |
-| On the computer (Mac app, TUI; loopback caller) | `http://127.0.0.1:<port>/oauth/callback` | the host's callback page |
+| On the computer (desktop app, TUI; loopback caller) | `http://127.0.0.1:<port>/oauth/callback` | the host's callback page |
| On the phone (E2E channel caller) | `<cloud>/v1/oauth/callback` → 302 `codync://oauth?…` | the app's system sign-in sheet sends `connectorSignInFinish` |
The cloud page is stateless and the code is useless without the PKCE verifier held by the host. Servers without dynamic client registration (e.g. GitHub) need a token header instead (custom connector, URL + headers). `connectorTarget` (loopback only) hands the proxy the URL and headers.
diff --git a/docs/features/remote-screen.md b/docs/features/remote-screen.md
index 0f3613f7..e512a9c3 100644
--- a/docs/features/remote-screen.md
+++ b/docs/features/remote-screen.md
@@ -23,15 +23,15 @@ held and the system rotation lock. The Rotate button remains available for an
explicit override. Closing the last viewer restores the app's portrait layout.
The video fits the available bounds, and touch coordinates use the resized viewport.
-The iPad already supports all orientations. macOS, Linux GTK and the TUI do not
+The iPad already supports all orientations. The desktop app and the TUI do not
use the iPhone viewer or its orientation policy; the capture helpers stream the
computer display without choosing the phone's orientation.
## Boundaries
- `host/src/screen.rs` coordinates access to the local helper and owns viewer sessions. Another device cannot renegotiate or close a session it does not own.
-- `apps/screen-macos/` is the macOS capture/input helper, installed through `SMAppService` and responsible for the OS permissions.
-- `apps/screen-linux/` implements the Linux helper using desktop portals and GStreamer, including ICE URL conversion and TURN transport configuration.
+- `apps/screen-macos/` is the macOS capture/input helper (Xcode `Screen` target, `CodyncScreen.app`). The desktop app bundles it and registers it through `SMAppService` (`apps/desktop/src/main/screen.ts`); it is responsible for the OS permissions.
+- `apps/screen-linux/` implements the Linux helper using desktop portals and GStreamer, including ICE URL conversion and TURN transport configuration. The host starts it.
- Helpers communicate locally through `~/.codync/screen.sock`. SDP is non-trickle; input uses the `input` and `input-fast` data channels.
- Screen access is off by default. Enabling through `setScreenEnabled` requires a loopback caller. Interactive OS permission prompts must be completed on the computer.
- Bots with their computer capability enabled receive the built-in `computer` MCP tools (`host/src/mcp.rs`). Their permission policy still applies. An interactive phone can take over; bots may still look.
@@ -56,7 +56,7 @@ References: [Cloudflare credential issuance](https://developers.cloudflare.com/r
## Verification
-Run cloud tests/type checking, host formatting/Clippy/tests, Swift package tests, and builds of the iOS app and Mac screen helper. Run Linux helper tests in a Linux environment with GStreamer and PipeWire development packages.
+Run cloud tests/type checking, host formatting/Clippy/tests, iOS Kit package tests, and builds of the iOS app and the macOS `Screen` helper target. Run Linux helper tests in a Linux environment with GStreamer and PipeWire development packages.
Live acceptance requires the configured Worker and fresh host/helper/phone builds:
diff --git a/docs/features/routines.md b/docs/features/routines.md
index 7a2a0571..a93f8763 100644
--- a/docs/features/routines.md
+++ b/docs/features/routines.md
@@ -1,7 +1,7 @@
# Routines
Routines belong to an agent bot and are usually created by talking to it ("I want
-a routine that…"). Every agent receives the built-in `routines` MCP server. The Mac
+a routine that…"). Every agent receives the built-in `routines` MCP server. The desktop
conversation details panel and the iPhone's **More → Routines** show a compact list
(name, schedule, on/off switch). The header's chat button puts "I want a routine
that " in the composer; **+** opens the form for doing it by hand. A row opens
@@ -11,10 +11,9 @@ Claude Code routines also offer besides GitHub events) and a run timeout; cron i
written directly as five fields plus an IANA time zone, and the host checks it and
shows the summary and next run. One-off times, intervals, events and multiple
triggers are left to the bot: editing such a routine shows its current triggers as
-the selected type and keeps them until Schedule or Webhook replaces them. Linux (boxed list with switches,
-same form) and the TUI (`n` form with a typed When, `c` asks the bot) match.
+the selected type and keeps them until Schedule or Webhook replaces them. The TUI (`n` form with a typed When, `c` asks the bot) match.
A saved webhook routine's form shows its public URL and key (copy, reveal, replace
-with confirmation; Linux the same, TUI `w` copies a curl command and `W` replaces the
+with confirmation; TUI `w` copies a curl command and `W` replaces the
key). Creation/update notices open the routine.
## Apple setup interface
@@ -153,7 +152,7 @@ All normal methods use the existing authenticated host API / authorized E2E chan
| `routineWebhook` | `botId`, `id`, optional `rotate`; returns `url` (public or null), `localUrl`, `key`, `connected` |
The local-only `routineCall` backs the MCP tools. Each MCP instance is scoped to
-its bot. Phone and Mac panels refresh while visible; definitions do not currently
+its bot. Phone and desktop panels refresh while visible; definitions do not currently
participate in offline client caches. Run transcript entries use normal rev/SSE.
## Reference and parity
diff --git a/docs/features/voice-call.md b/docs/features/voice-call.md
index 8eb5de01..eaec914b 100644
--- a/docs/features/voice-call.md
+++ b/docs/features/voice-call.md
@@ -1,13 +1,13 @@
# Voice call
-A hands-free call with one bot from the iPhone or Mac chat (the waveform button in an empty composer).
-Linux and the terminal UI have no calls: neither has an audio stack (GTK app, TUI); they show the
-"Voice chat · 00:16" notice like every client.
+A hands-free call with one bot from the iPhone or desktop chat (the waveform button in an empty composer).
+On Linux the desktop app offers only the cloud engines (on-device speech is macOS only). The terminal
+UI has no calls (no audio stack); it shows the "Voice chat · 00:16" notice like every client.
The bot is the same agent on the computer; the call only changes how you talk to it.
## On-device voice
-- `kit/Sources/CodyncUI/Call/`: `CallView` (the call bar) over a `VoiceEngine`; `OnDeviceEngine` is the default audio loop.
+- `apps/ios/Kit/Sources/CodyncUI/Call/` (iPhone) and `apps/desktop/src/renderer/views/call/` (desktop): `CallView` (the call bar) over a `VoiceEngine`; `OnDeviceEngine` is the default audio loop. On the Mac the desktop app runs speech recognition in `codync-speech` (`apps/desktop/native/speech-macos/`, driven by `apps/desktop/src/main/speech.ts`).
- UI follows Grok Bot: a floating capsule over the top of the chat (`ThreadView` overlay), and the
chat stays readable and usable underneath. Left to right: the bot's avatar (pulses while
speaking; tap it to interrupt), a dotted level line (your voice while listening, a ripple while
@@ -113,7 +113,7 @@ built into the host and the app (today `gpt-realtime-2.1`, `gpt-transcribe`, `gp
list arrives.
Voice settings (`VoiceChatSettingsView`) open from the call bar's gear and from settings: on the
-iPhone, **Computers & settings → Voice chat**; on the Mac, **Account → Voice chat** (this Mac's
+iPhone, **Computers & settings → Voice chat**; on the desktop, **Settings → Voice chat** (this
computer) or the waveform button on a computer's card in **Computers & devices**. Keys are entered
on the computer only: the host takes `setVoiceKey` from loopback, and the iPhone shows whether a key
is there and can test it. Picking a cloud engine shows its key form instead of the on-device settings: a secure field, a link
@@ -129,7 +129,7 @@ shows the provider's name next to the dots whenever audio leaves the device.
- On the computer, in the host's vault (`host/src/voice.rs`, slot `voice`: encrypted in
`codync.db` with the vault key from Keychain / Secret Service), so one key serves the iPhone and the
- Mac. It reaches the host once, over the encrypted channel, and never leaves it again; it is never
+ desktop app. It reaches the host once, over the encrypted channel, and never leaves it again; it is never
logged and never sent to the relay or our cloud.
- Host methods (control scope): `voiceStatus` (which providers have a key), `setVoiceKey
{provider, key}` (checked with one credential mint before it's kept; empty removes it),
diff --git a/docs/guides/accounts-and-ssh.md b/docs/guides/accounts-and-ssh.md
index e56dd73c..e15c2f38 100644
--- a/docs/guides/accounts-and-ssh.md
+++ b/docs/guides/accounts-and-ssh.md
@@ -1,33 +1,31 @@
# Accounts, device approval and SSH
-The macOS app uses the official ClerkKit SDK (1.5.6). The sidebar's account
-panel is a custom SwiftUI overlay, independent of the system authentication browser.
-The footer displays **Account**, never the Mac user's local name.
+The iOS app uses the official ClerkKit SDK (1.5.6). The desktop app talks to Clerk's
+Frontend API directly, the way ClerkKit does on native apps (`apps/desktop/src/main/account.ts`):
+a device token kept encrypted with Electron `safeStorage`, OAuth in the system browser.
## Configuration
-Both Apple apps use `apps/shared/AccountSession.swift`. Public keys and cloud URLs come from `apps/shared/Config/<env>.plist`, copied into the bundle as `AccountConfig.plist` by `project.yml`. Debug selects dev; Release selects main. See [environments](environments-and-deployment.md).
+The iOS app uses `apps/shared/AccountSession.swift`. Public keys and cloud URLs come from `apps/shared/Config/<env>.plist`, copied into the bundle as `AccountConfig.plist` by `project.yml`; Debug selects dev and Release selects main. The desktop app reads the same plist through `node apps/desktop/tools/account-config.mjs <env>`, which writes `resources/account-config.json` (`CODYNC_CLERK_PUBLISHABLE_KEY` / `CODYNC_CLOUD_URL` override it). See [environments](environments-and-deployment.md).
-Confirm Apple and Google sign-in, Native API and the native app registrations in the intended Clerk instance. macOS uses `com.pokai.Codync`, iOS uses `com.pokai.Codync.ios`, with their matching `://callback` URLs. Dashboard configuration and actual OAuth consent must be verified independently of the checked-in plist. Do not bundle Clerk secret keys.
+Confirm Apple and Google sign-in, Native API and the native app registrations in the intended Clerk instance. The desktop app uses `com.pokai.Codync`, iOS uses `com.pokai.Codync.ios`, with their matching `://callback` URLs. Dashboard configuration and actual OAuth consent must be verified independently of the checked-in plist. Do not bundle Clerk secret keys.
-### macOS Sign in with Apple
+### Desktop Sign in with Apple
-The sidebar account menu offers **Continue with Apple** and **Continue with
-Google** with the same row styling in both sidebar layouts. Both actions are
-disabled while authentication is in progress; cancellation stays silent and
-errors reopen the account menu. Signed-in accounts retain the existing Log out
-action.
+The welcome screen (`apps/desktop/src/renderer/views/AccountWelcomeView.tsx`) offers
+**Continue with Apple** and **Continue with Google**; **Settings → General → Account**
+has Sign out.
-On macOS, `AccountSession.signIn(provider: .apple)` uses
-`clerk.auth.signInWithOAuth(provider: .apple)` in a system authentication browser.
-This uses Clerk's Apple Services ID and does not require the native Sign in with
-Apple entitlement on the independently distributed Mac app. iOS continues using
-Clerk's native Apple authorization.
+On the desktop, `AccountService.signIn('apple')` starts Clerk's `oauth_apple` sign-in
+and opens its redirect in the system browser, which returns to
+`com.pokai.Codync://callback` (`apps/desktop/src/main/auth.ts`). This uses Clerk's
+Apple Services ID and needs no native Sign in with Apple entitlement. iOS continues
+using Clerk's native Apple authorization.
The production Services ID `com.pokai.Codync.signin` is associated with primary
App ID `com.pokai.Codync.ios` in Apple Developer. Keep that association: Apple's
web and native authorization must represent the same identity rather than being
-joined by email. The Mac's `com.pokai.Codync://callback` must also remain allowed
+joined by email. The desktop app's `com.pokai.Codync://callback` must also remain allowed
in Clerk. See [Apple's web configuration guide](https://developer.apple.com/help/account/capabilities/configure-sign-in-with-apple-for-the-web/)
and [Clerk's Apple OAuth guide](https://clerk.com/docs/guides/configure/auth-strategies/social-connections/apple).
@@ -35,21 +33,19 @@ The development instance uses the same custom credentials (Services ID, team
`7FUM8A8H72`, key `8S76D7ADWU`) since 2026-10-03, with
`sunny-mollusk-8651.clerk.accounts.dev` and its `/v1/oauth_callback` added to the
Services ID. Clerk's shared Apple credentials belong to Clerk's team, so with them
-the Mac's web sign-in and the iPhone's native sign-in got different Apple user IDs
+the computer's web sign-in and the iPhone's native sign-in got different Apple user IDs
and became two Clerk users; don't switch development back to shared credentials.
To check cross-device discovery, sign in with the same Apple Account on both
devices of one environment (Debug ↔ Debug, Release ↔ Release) and verify that
-Clerk has one user ID. Then verify that the Mac joins the account and the phone
+Clerk has one user ID. Then verify that the computer joins the account and the phone
requests access with the existing approval flow. Hide My Email does not change the
device approval requirement.
-Verified on 2026-09-30: the Mac Debug build completed Apple OAuth and displayed
-the signed-in private relay address and Log out action. The Apple and Google
-rows use the same font and sizing, and both disable during the pending flow.
-The iOS simulator build also passed after introducing the platform-specific
-Apple authentication route. The Mac Release build passed as well. Production
-cross-device identity matching still needs an Apple sign-in on that build.
+Verified on 2026-09-30 with the SwiftUI Mac app that preceded the desktop app:
+Apple OAuth completed and showed the signed-in private relay address. The desktop
+app's Apple sign-in and production cross-device identity matching still need to be
+checked on a release build.
### iOS Sign in with Apple
@@ -97,18 +93,18 @@ offers **Computers** to pair later. Skipping while adding a computer from settin
only closes that pairing sheet. It does not grant access to a computer or change
the account approval flow. **Start over** resets the onboarding choice.
-The Mac's menu bar **Settings → Reset all data…** (confirmed in the window) is the
-Mac's start over: it removes this computer from the account, revokes every paired
-device, signs out, uninstalls the host, deletes its data folder and the app's
+The desktop app's menu bar **Settings → Reset all data…** (confirmed in the window) is
+the computer's start over: it removes this computer from the account, revokes every
+paired device, signs out, uninstalls the host, deletes its data folder and the app's
settings, and relaunches into the welcome screen. The host comes back with a new
identity, so phones see the old computer as **No access** (if they were connected)
or as an older copy once the new one is reachable, and offer to remove it; pair
again or ask for access to reach the new one.
-On the Mac, open Codync in the menu bar and choose **Pair iPhone**, then scan the
+On the computer, open Codync in the menu bar and choose **Pair iPhone…**, then scan the
code on the phone (or paste its `codync://pair` link). The host approves the phone's
device key; the phone saves the computer in its current account context. This
-works when the phone uses Apple Hide My Email and the Mac uses Google. Automatic
+works when the phone uses Apple Hide My Email and the computer uses Google. Automatic
account discovery, in contrast, requires the same Clerk user ID on both devices.
On 2026-09-30, the production dashboard confirmed a successful Apple registration
@@ -123,24 +119,26 @@ claim and an Apple relay address.
## Flow
-`apps/shared/AccountSession.swift` configures Clerk once per app. Continue with Google calls `clerk.auth.signInWithOAuth(provider: .google)`
+On iPhone, `apps/shared/AccountSession.swift` configures Clerk once. Continue with Google calls `clerk.auth.signInWithOAuth(provider: .google)`
directly, without the Clerk Account Portal intermediary. Google authorization
uses the SDK's system browser authentication session. Clerk handles new-user
transfer, callback validation, session restoration and Keychain storage.
Incomplete sign-in/sign-up results are reported explicitly; additional MFA or
required profile fields need a separate continuation UI if enabled later. Browser cancellation is silent;
network failures leave the user in the custom account menu with a retryable
-error. Log out calls Clerk's sign-out API.
+error. Log out calls Clerk's sign-out API. The desktop app follows the same
+flow over the Frontend API (`apps/desktop/src/main/account.ts`).
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
+available. `AccountSession.sessionToken()` (desktop: `AccountService.sessionToken()`, used by `cloud.ts`)
+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 protocol](../reference/remote-relay.md) §4.2). Conversations are not uploaded.
## Verification
-- Build the macOS scheme after `xcodegen generate --spec apps/project.yml`.
+- Build the iOS scheme after `xcodegen generate --spec apps/project.yml`, and run the
+ desktop app with `npm run dev` after `node tools/account-config.mjs dev` in `apps/desktop/`.
- Open the account menu from either sidebar layout; test arrows, Return, Escape
and clicking outside the panel.
- Sign in with Apple and Google test users, verify the avatar/email, restart the app and
@@ -183,21 +181,21 @@ Verify with two real Google accounts: add both, switch, cancel OAuth, restart,
check each account's pairings, sign out just one, and verify the other remains.
A simulator build verifies compilation, not the Dashboard settings or OAuth flow.
-## Mac: computers, approvals and SSH
+## Desktop: computers, approvals and SSH
-The Mac keeps one `AccountStore` per account context too (`HostController`). This Mac's
-host and SSH computers are attached over loopback and follow into whichever account is
-active; the account's other computers are reached over the encrypted channel with the
-Mac's own device key. Log out erases the account's keys and caches, as on iPhone.
+The desktop app attaches this computer's host and its SSH computers over loopback; they
+follow into whichever account is active. The account's other computers are not reached
+directly (the encrypted channel wasn't ported to the desktop app), so their
+"Ask for access" rows show status only. See [desktop app](../architecture/desktop-app.md).
-**Computers & devices** (account menu) shows, for this Mac and each SSH computer:
+**Computers & devices** (Settings) shows, for this computer and each SSH computer:
*Reach from anywhere* (`setCloud`, using the app's `cloudURL` when the host has none),
*Add to account* (claim: `POST /v1/claims` → loopback `claimSign` → complete) and
*Remove from account* (`unclaim`), a pairing QR, and the authorized devices with revoke.
A device asking for access raises the menu bar dot and opens the approval sheet with the
6-digit code; Approve stays disabled until the device revealed its code.
-SSH computers use the system OpenSSH (`apps/macos/App/SSHTunnel.swift`): `ssh -G` to
+SSH computers use the system OpenSSH (`apps/desktop/src/main/ssh.ts`): `ssh -G` to
resolve the target, `ssh-keygen -F` against `~/.ssh/known_hosts` and
`~/.codync/ssh_known_hosts`, a fingerprint confirmation on first contact (no proxy),
`codync-host info --json` for the identity and loopback token, then
@@ -207,13 +205,12 @@ ssh-agent only (`BatchMode`: nothing prompts for a password or passphrase); a re
stops with a message instead of retrying. The remote command searches Homebrew,
`~/.local/bin` and the Mac app bundle for `codync-host` too, since `sh -l` doesn't read
`~/.zprofile`. At launch the app kills tunnels a crashed or force-quit copy left behind
-(`pkill` on the `.codync/ssh_known_hosts` argument only Codync's tunnels carry). Debug
-builds run `SSH.selfCheck()` at launch (argv, `ssh -G` parsing, validation).
+(`pkill` on the `.codync/ssh_known_hosts` argument only Codync's tunnels carry).
## Verification boundaries
Build with normal simulator signing for Clerk Keychain access. Test Google consent, cancellation, restoration, two-account switching, per-account cache isolation and sign-out on real test accounts. Build success cannot verify Clerk Dashboard state.
-For SSH, verify first-contact fingerprints and changed-key rejection. With ProxyJump/ProxyCommand, establish trust in a terminal first. The app checks that the local forwarding listener belongs to its SSH process. The Mac is not a phone-to-SSH gateway.
+For SSH, verify first-contact fingerprints and changed-key rejection. With ProxyJump/ProxyCommand, establish trust in a terminal first. The app checks that the local forwarding listener belongs to its SSH process. The desktop app is not a phone-to-SSH gateway.
Use [Cloudflare testing](cloudflare-testing.md) for remote account approval and relay acceptance.
diff --git a/docs/guides/cloudflare-testing.md b/docs/guides/cloudflare-testing.md
index 9efc569f..c03cc7aa 100644
--- a/docs/guides/cloudflare-testing.md
+++ b/docs/guides/cloudflare-testing.md
@@ -57,7 +57,7 @@ This runner does not validate a deployed Worker, actual Google consent, APNs or
- **Direct works, relay fails:** compare cloud URLs, cloud enablement, registration status and host logs.
- **Signed in, no access:** check account ownership and the host's pending approval; compare the displayed code before approving.
-- **Old UI/protocol:** stop stale Mac/host copies and relaunch the installed phone process.
+- **Old UI/protocol:** stop stale desktop app/host copies and relaunch the installed phone process.
- **Chat works, push fails:** inspect notification permission and APNs configuration separately.
- **Release fails while Debug works:** inspect the main environment's empty configuration before diagnosing networking.
diff --git a/docs/guides/development.md b/docs/guides/development.md
index 8756252e..d50bba4b 100644
--- a/docs/guides/development.md
+++ b/docs/guides/development.md
@@ -4,32 +4,34 @@ For release updates, automatic installation and host rollback, see [updates](upd
Run commands from the repository root unless a block changes directory. See [file structure](../architecture/file-structure.md) for ownership and [environment configuration](environments-and-deployment.md) before testing cloud access.
-## Apple apps
+## Desktop app
-Install Xcode and XcodeGen, then generate the project from its source:
+The macOS and Linux app is the Electron app in `apps/desktop/`; setup, UI-check switches and packaging are in [desktop app](../architecture/desktop-app.md#development):
```sh
-xcodegen generate --spec apps/project.yml
-xcodebuild build -project apps/Codync.xcodeproj -scheme macOS -configuration Debug -derivedDataPath build/dd
+cd apps/desktop
+npm ci
+node tools/account-config.mjs dev
+npm run icons # macOS only
+npm run dev
```
-Use the `iOS` scheme with a connected device or simulator in Xcode. CLI builds accept `-destination 'platform=iOS,id=<device-id>'`. Do not edit `project.pbxproj` directly. Keep normal simulator signing: Clerk uses Keychain, and unsigned simulator builds can fail initialization with OSStatus -34018.
-
-Before launching a newly built Mac app, quit running copies, including DerivedData copies:
+Before launching a new build, quit running copies (the installed app and earlier `npm run dev` windows):
```sh
osascript -e 'tell application id "com.pokai.Codync" to quit'
pkill -x Codync
-open build/dd/Build/Products/Debug/Codync.app
```
`pkill` can return nonzero when no process exists.
-The Mac app compares the running host's executable path and SHA-256 fingerprint
-with its bundled host, so reopening a rebuild replaces the service even when the
-version number has not changed. **Restart host** reinstalls the service from this
-app and waits for the old host's data lock to be released. If a manually started
-host still owns that data directory, installation fails instead of reporting a
+The desktop app (`apps/desktop/src/main/host-controller.ts`) compares the running
+host's executable path and SHA-256 fingerprint with the host it would install (the
+bundled one in a packaged Mac app, else `CODYNC_HOST_BIN` or an installed
+`codync-host`), so reopening after a rebuild replaces the service even when the
+version number has not changed. **Restart host** runs `codync-host install` again,
+which waits for the old host's data lock to be released. If a manually started host
+still owns that data directory, installation fails instead of reporting a
successful restart; stop that host in its terminal and retry. Hosts attached using
`CODYNC_PORT` are managed manually.
@@ -39,16 +41,26 @@ also kills tools and MCP servers that remain in its group. Processes that detach
into their own sessions and unrelated hosts using other data directories are
outside this cleanup.
-After rebuilding the host, restart the launch agent (it runs
-`build/dd/.../Codync.app/Contents/MacOS/codync-host`) and kill any `codync-host`
-still running from a different path. Test hosts you start yourself must be
-stopped when done:
+After rebuilding the host, restart the service (macOS launch agent shown; Linux
+uses the `codync-host` systemd user unit) and kill any `codync-host` still running
+from a different path. Test hosts you start yourself must be stopped when done:
```sh
launchctl kickstart -k gui/$(id -u)/com.pokai.codync.host
pgrep -fl codync-host
```
+## iOS app
+
+Install Xcode and XcodeGen, then generate the project from its source. The Xcode project holds the `iOS`, `Widgets` and `NotificationService` targets plus the macOS `Screen` helper the desktop app bundles:
+
+```sh
+xcodegen generate --spec apps/project.yml
+xcodebuild build -project apps/Codync.xcodeproj -scheme iOS -configuration Debug -derivedDataPath build/dd -destination 'platform=iOS,id=<device-id>'
+```
+
+Use the `iOS` scheme with a connected device or simulator in Xcode. Do not edit `project.pbxproj` directly. Keep normal simulator signing: Clerk uses Keychain, and unsigned simulator builds can fail initialization with OSStatus -34018.
+
Install the device build and replace the old iPhone process (substitute its device ID):
```sh
@@ -64,11 +76,11 @@ Unlock the phone when required. Build, install, launch, and visual inspection ar
| --- | --- | --- |
| Host | `cd host && cargo build` | rustup; `rust-toolchain.toml` pins the version CI uses (a Homebrew `rust` ahead of rustup on PATH ignores it) |
| Host checks | `cd host && cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test` | Local agent credentials are unnecessary for unit tests |
-| Shared Swift | `swift test --package-path kit` | Swift 6 / Xcode |
+| iOS Kit | `cd apps/ios/Kit && xcodebuild test -scheme CodyncKit-Package -destination 'platform=iOS Simulator,id=<sim-id>'` | Swift 6 / Xcode; iOS-only package |
+| Desktop | `cd apps/desktop && npm ci && npm run typecheck && npm test` | Node and npm; CI uses Node 24 |
| Cloud | `cd cloud && npm ci && npm test && npm run typecheck` | Node and npm; CI uses Node 24 |
| Cloud integration | `cd cloud && env -u CODYNC_CLOUD npm run e2e` | Built host; see [Cloudflare testing](cloudflare-testing.md) |
| APNs relay | `cd relay && npm ci && npm test && npm run typecheck` | Separate package from `cloud/` |
-| Linux desktop | `cd apps/linux && cargo test` | GTK 4 and libadwaita development packages |
### Screen helpers
@@ -87,10 +99,10 @@ Host development: `cargo run --manifest-path host/Cargo.toml -- serve`. Avoid co
## Visual checks
-Follow [UI conventions](../design/ui-conventions.md) for native toolbar behavior and [widget design](../design/mobile-widgets.md) for previews. Widget images can be rendered with `python3 tools/render-widgets.py`; output is under `build/widget-previews/`.
+Follow [UI conventions](../design/ui-conventions.md) for native toolbar behavior and [widget design](../design/mobile-widgets.md) for previews. Widget previews live in `apps/ios/Widgets/WidgetPreviews.swift`.
-Versions are defined in `apps/project.yml`; keep the host package version aligned with `MARKETING_VERSION`, then regenerate the Xcode project.
+Versions are defined in `apps/project.yml` (`MARKETING_VERSION`), `host/Cargo.toml` and `apps/desktop/package.json`; keep them equal (the desktop release workflow fails when the app and host differ), then regenerate the Xcode project.
## iOS releases (Xcode Cloud)
-The Xcode Cloud workflow "Release" on the product "iOS" has no automatic start condition (its own tag trigger never fired); it only runs when started through the API, and it archives the `iOS` scheme in Release with deployment preparation **TestFlight and App Store** (the "Internal Testing Only" option produces builds App Review can't take) and uploads it to App Store Connect. Xcode Cloud overrides the build number with its own counter (`CI_BUILD_NUMBER`, configured under Xcode Cloud settings → Build Number in App Store Connect), so `CURRENT_PROJECT_VERSION` in `project.yml` is only the local default. The checked-in `apps/Codync.xcodeproj` is what the cloud builds: regenerate it whenever `project.yml` changes, and commit `apps/Codync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved` whenever a package version changes (Xcode Cloud never resolves packages itself; copy `kit/Package.resolved` there if Xcode wrote it to `kit/`). Xcode Cloud reads public package repositories without any connection; its setup wizard still blocked on Sparkle (asking for a GitHub app install only its owners can grant), so the product was created with Sparkle temporarily removed from `project.yml`. The `Submit iOS` GitHub workflow (`.github/workflows/ios-submit.yml` → `tools/asc-submit.py`, secrets `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY`) runs on every `v*` tag (the tags Auto Tag pushes after a version bump on `main`). It compares the tag with the last version sent to the App Store: when nothing the iPhone app is built from changed (`apps/ios/`, `apps/shared/`, `kit/`, the package pins, or `apps/project.yml` beyond its version lines), iOS skips that release, so host- or Mac-only releases neither build nor touch a version in review. Otherwise it starts the Xcode Cloud archive on the tag, waits for that build to finish processing and submits it for App Review, released automatically after approval. The latest version wins: a version still *Waiting for Review* is pulled back, renamed and resubmitted with the new build; one already *In Review* or approved is left alone (rerun the workflow with the version once it is out). *What's New* comes from the version's `## <version>` section in `apps/ios/WhatsNew.md` (one `### <locale>` per App Store language, written in the version bump); without one, the `### zh-Hant` / `### en-US` bullets under `## What's New` in the PR template are collected from every PR merged since the last App Store version (changes pushed to `main` without a PR add nothing); with neither, empty fields get a generic "Bug fixes and improvements" line. Running `Submit iOS` by hand with a version ships it even without iPhone changes. `python3 tools/asc-submit-test.py` checks the PR parsing and the change detection. `DRY_RUN=1 tools/asc-submit.py <version>` prints the writes without making them.
+The Xcode Cloud workflow "Release" on the product "iOS" has no automatic start condition (its own tag trigger never fired); it only runs when started through the API, and it archives the `iOS` scheme in Release with deployment preparation **TestFlight and App Store** (the "Internal Testing Only" option produces builds App Review can't take) and uploads it to App Store Connect. Xcode Cloud overrides the build number with its own counter (`CI_BUILD_NUMBER`, configured under Xcode Cloud settings → Build Number in App Store Connect), so `CURRENT_PROJECT_VERSION` in `project.yml` is only the local default. The checked-in `apps/Codync.xcodeproj` is what the cloud builds: regenerate it whenever `project.yml` changes, and commit `apps/Codync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved` whenever a package version changes (Xcode Cloud never resolves packages itself; copy `apps/ios/Kit/Package.resolved` there if Xcode wrote it to `apps/ios/Kit/`). Xcode Cloud reads public package repositories without any connection. The `Submit iOS` GitHub workflow (`.github/workflows/ios-submit.yml` → `tools/asc-submit.py`, secrets `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY`) runs on every `v*` tag (the tags Auto Tag pushes after a version bump on `main`). It compares the tag with the last version sent to the App Store: when nothing the iPhone app is built from changed (`apps/ios/` including `apps/ios/Kit/`, `apps/shared/`, the package pins, or `apps/project.yml` beyond its version lines), iOS skips that release, so host- or desktop-only releases neither build nor touch a version in review. Otherwise it starts the Xcode Cloud archive on the tag, waits for that build to finish processing and submits it for App Review, released automatically after approval. The latest version wins: a version still *Waiting for Review* is pulled back, renamed and resubmitted with the new build; one already *In Review* or approved is left alone (rerun the workflow with the version once it is out). *What's New* comes from the version's `## <version>` section in `apps/ios/WhatsNew.md` (one `### <locale>` per App Store language, written in the version bump); without one, the `### zh-Hant` / `### en-US` bullets under `## What's New` in the PR template are collected from every PR merged since the last App Store version (changes pushed to `main` without a PR add nothing); with neither, empty fields get a generic "Bug fixes and improvements" line. Running `Submit iOS` by hand with a version ships it even without iPhone changes. `python3 tools/asc-submit-test.py` checks the PR parsing and the change detection. `DRY_RUN=1 tools/asc-submit.py <version>` prints the writes without making them.
diff --git a/docs/guides/linux-servers.md b/docs/guides/linux-servers.md
index 79def5c2..caa67a95 100644
--- a/docs/guides/linux-servers.md
+++ b/docs/guides/linux-servers.md
@@ -1,6 +1,6 @@
# Running the host on a Linux server or cloud VM
-`codync-host` runs on any 64-bit Linux machine: a desktop, a home server, or a headless cloud VM (AWS, GCP, Azure, Hetzner, DigitalOcean…). It needs no display. Bots run on that machine and you message them from the iPhone, the Mac app or `codync-host tui`.
+`codync-host` runs on any 64-bit Linux machine: a desktop, a home server, or a headless cloud VM (AWS, GCP, Azure, Hetzner, DigitalOcean…). It needs no display. Bots run on that machine and you message them from the iPhone, the desktop app or `codync-host tui`.
## Requirements
@@ -36,14 +36,14 @@ The phone connects over the encrypted device channel. The pairing link lists onl
- **Tailscale (recommended for VMs):** install Tailscale on the VM and on the phone, then `codync-host pair`. The Tailscale name comes first in the link. You don't need to open port 19222 in the cloud firewall.
- **Cloudflare cloud:** `codync-host cloud --url https://…` if you run your own Codync cloud. The production cloud isn't live yet (see [environments](environments-and-deployment.md)).
-- **Mac app over SSH:** the Mac app can attach an SSH computer and tunnel to its loopback API ([Accounts and SSH](accounts-and-ssh.md)). From any terminal: `ssh -L 19222:127.0.0.1:19222 vm`, then `codync-host tui` locally.
+- **Desktop app over SSH:** the desktop app (macOS or Linux) can attach an SSH computer and tunnel to its loopback API ([Accounts and SSH](accounts-and-ssh.md)). From any terminal: `ssh -L 19222:127.0.0.1:19222 vm`, then `codync-host tui` locally.
The host listens on `0.0.0.0:19222`. The local API (`/api/*`, `/events`, terminals; bearer token) answers **loopback callers only**, so a public address never exposes it. From outside, only `/health` (host id, computer id, version) and the end-to-end encrypted device channel answer, and the channel only serves devices holding this host's pairing keys. Keep 19222 closed in the cloud firewall anyway unless you deliberately pair over a VPN or private network.
## Limitations on a headless server
- **Remote screen and the `computer` tool don't work.** They need a desktop session (portals + GStreamer, `apps/screen-linux/`). The feature is off by default, so nothing else is affected.
-- **No Linux desktop app.** The GTK app (`codync`) needs a desktop, and its release build needs glibc 2.39+ (Ubuntu 24.04 or newer). On a server, use the phone, the Mac app over SSH, or `codync-host tui`.
+- **No desktop app.** The Linux desktop app (`codync`, AppImage/deb/tar.gz) needs a graphical session; it uses the installed `codync-host`. On a server, use the phone, the desktop app on another computer over SSH, or `codync-host tui`.
- **Keep-awake is a no-op.** The host tries `systemd-inhibit` while a bot works; VMs don't sleep, and failure only logs a warning.
- **One computer per account.** A VM counts as the account's computer; multiple computers are future work.
- **Usage limits** come from the local Claude and Codex installs, same as on a desktop.
diff --git a/docs/guides/updates.md b/docs/guides/updates.md
index 51a37fa6..bcb875c6 100644
--- a/docs/guides/updates.md
+++ b/docs/guides/updates.md
@@ -3,29 +3,32 @@
A client and a host on versions that can't work together say which one to update:
[Client and host compatibility](../reference/compatibility.md).
-## macOS
+## Desktop app
-Release builds use Sparkle 2.10.0. Open **Settings → Updates** in the menu bar
+Release builds update through electron-updater from GitHub releases
+(`apps/desktop/src/main/updates.ts`). Open **Settings → Updates** in the menu bar
to check for a release, enable scheduled checks, or opt into automatic downloads
-and installation. The chat window's account menu has the same **Check for
-updates** action. Debug builds disable the production updater.
-
-The app checks daily. Automatic installation waits until the app is inactive,
-there has been no keyboard/mouse input for ten minutes, and the local host reports
-no working bots, pending input, or running setup terminals. A staged update can
-also install when quitting. Manual installation can interrupt work.
-
-Before replacement, Codync unregisters its screen helper and stops the host,
-waiting for its data lock to be released. If cleanup fails, installation pauses
-with a retry action. A persistent restart marker makes the next app launch
-reinstall the host service from the new bundle; remote screen registration is
-restored when the host reports that it is enabled. Ordinary Quit keeps the host
-running when no update is staged.
-
-Sparkle verifies Ed25519 signatures before extraction. Its standard installer
-handles app replacement and relaunch. Appcast URLs identify an immutable release
-archive; the feed itself is served from the latest GitHub release. macOS build
-versions follow the marketing version; the iOS build counter is independent.
+and installation. The chat window's Settings has the same **Check for updates**
+action on its Updates page. Development builds (`npm run dev`) don't update.
+
+The app checks daily (hourly while a release waits for the iPhone app, below).
+Automatic installation waits until no Codync window is focused, there has been no
+keyboard/mouse input for ten minutes, and the local host reports that it is idle.
+A staged update also installs when quitting. Manual installation can interrupt work.
+A release whose `latest-mac.yml` names a `minApp` newer than the App Store's iPhone
+app waits while an iPhone is paired with this host.
+
+Before replacement, Codync unregisters its screen helper and stops the host
+(`codync-host stop`). If that fails, installation pauses with a retry action. A
+persistent restart marker makes the next app launch reinstall the host service from
+the new bundle; remote screen registration is restored when the host reports that
+it is enabled. Ordinary Quit keeps the host running when no update is staged.
+
+The release workflow publishes `latest-mac.yml` and `latest-linux*.yml` with the
+app archives. macOS build versions follow the marketing version; the iOS build
+counter is independent. Installs of the SwiftUI Mac app that preceded the desktop
+app still read the Sparkle appcast; the release workflow generates one for the
+desktop zip, so those installs move to the desktop app.
## Standalone hosts on Linux and macOS
@@ -42,8 +45,7 @@ update to interrupt bots. Stop a manually launched host before replacing it.
Automatic updates require an installed background service and are off by default.
They check daily while idle; failures are reported in update status.
-The Linux app exposes these controls under **Computers & devices → Host updates**
-(also reached from the account menu's **Check for updates**); the TUI's action
+The TUI's action
list (`^k`) has **Check for updates**, which reports the result in the status line.
The API operations (`hostUpdateStatus`, `checkHostUpdate`, `installHostUpdate`,
`setHostAutomaticUpdates`) require a local connection, including an SSH tunnel.
@@ -61,16 +63,17 @@ computer identity within 30 seconds. Startup failure restores and restarts the
previous binary. Data is preserved; this is binary rollback, not database rollback
or recovery from power loss during installation.
-Bundled hosts are updated with the Mac app. Homebrew hosts use
+The host bundled in the Mac desktop app is updated with the app. Homebrew hosts use
`brew upgrade leepokai/codync/codync-host`, followed by `codync-host install`.
Development builds must be rebuilt. The independent updater refuses to overwrite
-those installations. The Linux desktop executable remains package-managed or
-manually installed; its update controls update the host.
+those installations. The Linux desktop app uses the installed host, which updates
+with the commands above, independently of the app.
## Release configuration
-Both workflows run for a `vMAJOR.MINOR.PATCH` tag. Keep the host Cargo version and
-the app marketing version aligned before tagging. The host workflow refuses a
+Both workflows (`host.yml`, `release-desktop.yml`) run for a `vMAJOR.MINOR.PATCH` tag. Keep the host Cargo version,
+`apps/desktop/package.json` and the marketing version aligned before tagging; the
+desktop workflow fails when the app and host versions differ. The host workflow refuses a
tag/version mismatch. Existing clients without this updater need one manual
upgrade to adopt it.
@@ -80,11 +83,12 @@ already distributed clients. Repository Actions secrets:
| Secret | Contents |
| --- | --- |
-| `SPARKLE_PRIVATE_KEY` | Sparkle's base64 Ed25519 private key export |
+| `SPARKLE_PRIVATE_KEY` | Sparkle's base64 Ed25519 private key export (the migration appcast) |
| `HOST_UPDATE_SIGNING_KEY` | Separate base64 32-byte Ed25519 seed for host manifests |
-The Mac workflow signs/notarizes the app, builds its DMG, generates `appcast.xml`,
-then verifies the actual DMG signature and metadata before upload. The host
+The desktop workflow signs and notarizes the Mac app, builds its DMG and zip, adds
+`minApp` to `latest-mac.yml` and generates `appcast.xml` for the zip; it builds the
+Linux AppImage, deb and tar.gz on x86_64 and arm64. The host
workflow emits `codync-host-<platform>.update.json` and `.update.json.sig` alongside
each archive. Signing fails if a private key does not match the committed public
key. Never commit private keys or put them in command-line arguments.
@@ -95,9 +99,9 @@ used. Building locally or configuring secrets does not publish a release.
## References
+- [electron-updater](https://www.electron.build/auto-update)
- [Sparkle publishing documentation](https://sparkle-project.org/documentation/publishing/)
-- [Sparkle gentle reminders](https://sparkle-project.org/documentation/gentle-reminders/)
- [Grok Bot's safe relaunch gate](https://github.com/b-nnett/grok-bot-0.18-reconstructed/blob/main/source/electron-main/update/safe-relaunch-gate.ts)
Grok Bot supplied the reference for opt-in, staged updates and idle-gated restart.
-Codync uses app inactivity and input idle time; it does not require a locked screen.
+Codync uses window focus and input idle time; it does not require a locked screen.
diff --git a/docs/reference/compatibility.md b/docs/reference/compatibility.md
index 05dc2055..f65b64e8 100644
--- a/docs/reference/compatibility.md
+++ b/docs/reference/compatibility.md
@@ -1,20 +1,20 @@
# Client and host compatibility
-Clients (iPhone, Mac window, Linux app, terminal client) and the host update on different
-schedules: the iPhone app waits for App Review, Mac and standalone hosts update when their
-owner (or the opt-in automatic updater) installs a release, and the Linux desktop app is
-package-managed. Any client can meet an older or a newer host.
+Clients (iPhone, desktop app on macOS and Linux, terminal client) and the host update on
+different schedules: the iPhone app waits for App Review, the desktop app and standalone hosts
+update when their owner (or the opt-in automatic updater) installs a release. Any client can
+meet an older or a newer host.
## Rule
Each side names the **oldest version of the other side** it still works with. Versions are
-the ordinary release versions (`MARKETING_VERSION`, `host/Cargo.toml`, `apps/linux/Cargo.toml`,
+the ordinary release versions (`MARKETING_VERSION`, `host/Cargo.toml`, `apps/desktop/package.json`,
always equal). There is no separate protocol number.
| Floor | Lives in | Meaning |
|---|---|---|
| `minApp` | `host/src/compat.rs` `MIN_APP`, sent in `hello` | The oldest client this host serves correctly. |
-| `minHost` | `kit/.../Models/Compatibility.swift` `VersionMismatch.minHost`, `apps/linux/src/compat.rs` `MIN_HOST`, `host/src/compat.rs` `MIN_HOST` (terminal client) | The oldest host this client works with. |
+| `minHost` | `apps/ios/Kit/.../Models/Compatibility.swift` `VersionMismatch.minHost`, `apps/desktop/src/shared/compat.ts` `MIN_HOST`, `host/src/compat.rs` `MIN_HOST` (terminal client) | The oldest host this client works with. |
On every (re)connect the client reads `hello` and decides, in this order:
@@ -29,17 +29,17 @@ floor applies to them.
## What each client does
-| | Apple apps (`BotStore.mismatch`) | Linux app | Terminal client |
-|---|---|---|---|
-| Notice | `UpdateNeededCard` above the computer's bots and in place of the composer; status reads *Needs update* | Banner over the roster | *needs update* in the status line, with the reason |
-| Update this app | iPhone: App Store page. Mac: Sparkle | Opens the GitHub release page (the desktop app is package-managed) | Text only |
-| Update the host | Mac: its own host is reinstalled from the app bundle. iPhone: instructions for that computer | `installHostUpdate` | `^k` → Check for updates |
-| Sync while mismatched | Stopped; `hello` is asked again every 30 s and on every reconnect | Continues (JSON is read leniently); sending is blocked | Continues; sending is blocked |
+| | iPhone and desktop (`BotStore.mismatch`) | Terminal client |
+|---|---|---|
+| Notice | `UpdateNeededCard` above the computer's bots and in place of the composer; status reads *Needs update* | *needs update* in the status line, with the reason |
+| Update this app | iPhone: App Store page. Desktop: electron-updater check (`apps/desktop/src/main/updates.ts`) | Text only |
+| Update the host | Desktop: its own host is reinstalled (**Restart host**). iPhone: instructions for that computer | `^k` → Check for updates |
+| Sync while mismatched | Stopped; `hello` is asked again every 30 s and on every reconnect | Continues; sending is blocked |
Drafts are kept while sending is blocked. A host update restarts the host, so the reconnect
reads the new `hello` and the notice goes away on its own.
-Apple apps also treat **undecodable data from a newer host** as *Update this app*: an event
+The iPhone and desktop apps also treat **undecodable data from a newer host** as *Update this app*: an event
that stays undecodable after the one rewind, or a `hello` whose other fields can't be decoded
(its `version` and `minApp` are still read). From an older or equal host it's only logged.
@@ -53,7 +53,7 @@ couldn't get the matching side yet.
Swift fields are optional), new methods, new enum values (kept as strings).
- **Renaming, removing or changing the meaning** of anything an older client reads or sends:
change it, set `MIN_APP` to this release (its iPhone part ships with it: the change
- touches `kit/`, so `Submit iOS` includes it), add a row to the floor history, and re-record
+ touches `apps/ios/Kit/`, so `Submit iOS` includes it), add a row to the floor history, and re-record
the wire shape snapshot. Hosts hold that release back until the App Store has the iPhone
app (next section), so nobody is asked for an update that isn't there yet.
- **Raise `minHost`** when the client's core flows need something older hosts lack. Hosts
@@ -85,15 +85,13 @@ installing such a release:
(`codync-host compat`) instead. The signed manifest itself is unchanged, as old hosts
expect it. Waiting shows as phase `waitingForApp` with `requiredApp` and `appStoreVersion`
in the update status; `codync-host update --skip-app-check` (API
- `installHostUpdate {"skipAppCheck": true}`, the Linux app's *Update anyway*) installs
- anyway. With automatic updates on, a waiting host asks the App Store hourly and updates as
+ `installHostUpdate {"skipAppCheck": true}`) installs anyway. With automatic updates on, a waiting host asks the App Store hourly and updates as
soon as the app is there.
-- **Mac app** (Sparkle): the release workflow adds `<codync:minApp>` to the appcast item
- (`packaging/updates/annotate-appcast.py`, checked by `verify-appcast.py`), and
- `UpdatesManager` declines it in `shouldProceedWithUpdate` while the App Store is behind,
- before Sparkle shows or downloads anything. A check the person starts shows why; one
- started without an App Store answer goes ahead. While waiting it asks the App Store hourly
- and starts a background check as soon as the app is there.
+- **Desktop app** (electron-updater): the release workflow adds `minApp` to `latest-mac.yml`,
+ and `Updates.available` (`apps/desktop/src/main/updates.ts`) holds the release while the
+ local host's `minApp` is lower, an iPhone is paired and the App Store is behind, before
+ anything downloads. A check the person starts shows why. While waiting it checks hourly. The Sparkle appcast kept for the
+ SwiftUI Mac app's installs carries `<codync:minApp>` (`packaging/updates/annotate-appcast.py`).
- Hosts released before 2.5.0 don't have this gate and install any release. Before the first
real `minApp` raise, most computers should be on 2.5.0 or newer.
@@ -110,8 +108,7 @@ trails them (App Store review), so nudging a computer from it would only be nois
| Client | This app is behind |
|---|---|
| iPhone | Card at the top of the bot list (App Store version from the lookup), *Update* opens the App Store |
-| Mac | Sparkle's own update prompts |
-| Linux app | Toast with *Get update* (release page) |
+| Desktop | *Update to <version>* in the menu bar's Settings → Updates and on the Settings Updates page |
| Terminal client | — (it is the host binary) |
### Wire shape snapshot
diff --git a/docs/reference/fixtures/README.md b/docs/reference/fixtures/README.md
index d2f30036..b07b87b5 100644
--- a/docs/reference/fixtures/README.md
+++ b/docs/reference/fixtures/README.md
@@ -14,7 +14,7 @@ cmp docs/reference/fixtures/remote-relay-vectors.json /tmp/codync-relay-vectors.
Consumers:
- `host/src/remote/crypto.rs` (`include_str!`)
-- `kit/Tests/CodyncKitTests/RelayVectorsTests.swift`
+- `apps/ios/Kit/Tests/CodyncKitTests/RelayVectorsTests.swift`
- `cloud/test/vectors.test.ts` and `cloud/test/relay.test.ts`
-When moving or changing a fixture, update those paths and the cloud/kit/host CI path filters. Run the affected vector tests; a Markdown link check alone cannot validate executable imports. [Protocol reference](../remote-relay.md).
+When moving or changing a fixture, update those paths and the cloud, iOS Kit (`kit.yml`) and host CI path filters. Run the affected vector tests; a Markdown link check alone cannot validate executable imports. [Protocol reference](../remote-relay.md).
diff --git a/docs/reference/remote-relay.md b/docs/reference/remote-relay.md
index 803f21cf..fc5d4280 100644
--- a/docs/reference/remote-relay.md
+++ b/docs/reference/remote-relay.md
@@ -14,8 +14,8 @@ Shared deterministic [vectors](fixtures/remote-relay-vectors.json) and their [ge
| D4 | **Host 是授權的唯一權威**。host 在本機 SQLite 保存「已授權裝置」表;**只有兩條路能新增列**:本機 QR 配對(§4.1)與 host 自己的核准動作(`decideAccessRequest` approve,§4.2 B)。雲端 state **只能縮短**授權(刪除列、延長既有列的 lease),永遠不能新增。host 把此表簽成 **ACL** 發佈到自己的 DO,DO 據此放行 WebSocket;E2E 握手時 host 再驗一次。 | 無帳號模式也能用中繼(host 以機器金鑰向雲端註冊,不需帳號);雲端被攻破也無法新增可解密的裝置(新增要 host 本機的使用者動作、ACL 要 host 簽、握手要 host 私鑰);撤權有兩道即時關卡(DO 封鎖 + host 關 channel)。 |
| D5 | **Computer ID 由 host 簽章公鑰推導**:`computerId = b64url(SHA-256(hostSignPub)[0..16])`。不由雲端分配。 | 自我驗證、離線可得、無法被搶註;DO 名稱可直接推導。代價:換 host 金鑰 = 新 computer(見 §3.5)。 |
| D6 | 帳號 → Computers → Bots:`AccountStore`(`[ComputerID: BotStore]`),`BotReference = accountId + computerId + botId`。 | 依帳號與電腦隔離狀態。 |
-| D7 | 共用 bearer token(`~/.codync/token`)**只接受 loopback 連線**(Mac App 本機、SSH tunnel、statusline、MCP、TUI、Linux App)。手機與其他遠端 client 一律走 E2E channel。 | 移除「一個 token 開所有手機」的舊模型;不留相容路徑。 |
-| D8 | SSH:macOS App 以系統 OpenSSH `-L` 轉發到遠端 host 的 loopback API;遠端側看到的是 loopback 呼叫者,所以 SSH 帳號等同本機使用者權限(能讀 `~/.codync/token` 的人本來就有這權限)。 | 產品決策 6;重用 loopback API,不需要額外授權層。 |
+| D7 | 共用 bearer token(`~/.codync/token`)**只接受 loopback 連線**(桌面 App 本機、SSH tunnel、statusline、MCP、TUI)。手機與其他遠端 client 一律走 E2E channel。 | 移除「一個 token 開所有手機」的舊模型;不留相容路徑。 |
+| D8 | SSH:桌面 App(`apps/desktop/src/main/ssh.ts`)以系統 OpenSSH `-L` 轉發到遠端 host 的 loopback API;遠端側看到的是 loopback 呼叫者,所以 SSH 帳號等同本機使用者權限(能讀 `~/.codync/token` 的人本來就有這權限)。 | 產品決策 6;重用 loopback API,不需要額外授權層。 |
| D10 | **推播內容也加密**:host 以裝置註冊的 X25519 push key 封裝通知標題/內文(§6.7),APNs 只帶通用文字 + `mutable-content`,iOS Notification Service Extension 解開。Live Activity 只推狀態 enum,不推自由文字。 | 決策 2:Cloudflare(`relay/`)只看得到密文。 |
**審查後的取捨(rev 2)**:
@@ -24,7 +24,7 @@ Shared deterministic [vectors](fixtures/remote-relay-vectors.json) and their [ge
- SSH 目標設了 `ProxyJump`/`ProxyCommand` 時不做 keyscan、也不做 `SSH_ASKPASS` 首次確認:要求使用者先在終端機連過一次(host key 已在 `~/.ssh/known_hosts`)。少見情境,換來不必實作 askpass helper。
- 推播選擇「加密 + NSE」而非「只送通用文字」:保留 Grok Bot 式的通知預覽。
-明確不做(這一版):雲端保存聊天、Mac 當手機的 SSH gateway、手機原生 SSH、host 金鑰輪替後沿用舊授權、團隊共享。
+明確不做(這一版):雲端保存聊天、桌面 App 當手機的 SSH gateway、手機原生 SSH、host 金鑰輪替後沿用舊授權、團隊共享。
---
@@ -59,9 +59,10 @@ Shared deterministic [vectors](fixtures/remote-relay-vectors.json) and their [ge
| Cloud schema | `cloud/migrations/` |
| Host identity / crypto / channel | `host/src/remote/identity.rs`, `crypto.rs`, `channel.rs` |
| Host cloud / relay | `host/src/remote/cloud.rs`, `relay.rs` |
-| Swift transports / identity | `kit/Sources/CodyncKit/Client/` |
-| Account and per-computer state | `kit/Sources/CodyncUI/` |
-| Apple account integration | `apps/shared/AccountSession.swift` |
+| Swift transports / identity | `apps/ios/Kit/Sources/CodyncKit/Client/` |
+| Account and per-computer state | `apps/ios/Kit/Sources/CodyncUI/` |
+| iOS account integration | `apps/shared/AccountSession.swift` |
+| Desktop account, device key, cloud API | `apps/desktop/src/main/account.ts`, `cloud.ts` |
See [architecture](../architecture/overview.md) and [file structure](../architecture/file-structure.md). Application/host compatibility follows their major version; channel `v`, QR version and Worker package version are separate values.
@@ -77,14 +78,14 @@ See [architecture](../architecture/overview.md) and [file structure](../architec
- 寫入:先寫 `identity.json.tmp`(0600)再 rename。讀取失敗(格式錯)→ 啟動失敗並說明,不自動覆蓋。
- `computerId` 由 `sign` 公鑰推導(§1)。
-### 3.2 Device(iPhone、Mac 作為 client)
+### 3.2 Device(iPhone、桌面 App 作為 client)
- 只有一把 Ed25519 金鑰(`Curve25519.Signing.PrivateKey`)。
- 每個 `SharedStore.Context.id`(帳號 namespace,`local` 或 hash(userID))一把,避免跨帳號關聯。
- 另有一把 X25519 **push key**(`Curve25519.KeyAgreement.PrivateKey`),同樣每 context 一把,只用於解開推播(§6.7)。
- Keychain:`kSecClassGenericPassword`,`kSecAttrService = "com.pokai.Codync.device-key"`(push key 用 `"com.pokai.Codync.push-key"`),`kSecAttrAccount = context.id`,值 = 32-byte `rawRepresentation`,`kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`,`kSecAttrSynchronizable = false`。
-- macOS:**不設** `kSecUseDataProtectionKeychain`(Mac App 是 Developer ID、未 sandbox、沒有 entitlements 檔;data protection keychain 需要 provisioning profile 背書的 entitlement,否則 `-34018`)。使用 login keychain,不設 access group。
-- iOS App、Widgets、NotificationService 共用 access group `$(AppIdentifierPrefix)com.pokai.Codync`(APPLE-APPS 在 `project.yml` 對這三個 target 加 `keychain-access-groups` entitlement;kit 從 Info.plist `CodyncKeychainGroup` 讀 group,缺值則不設 group)。
+- 桌面 App(`apps/desktop/src/main/cloud.ts`):每個帳號一把 Ed25519 device key,seed 以 Electron `safeStorage`(OS keychain)加密後存在 app 的 userData 目錄;只用於雲端 `/v1` API 的 `Codync-Sig`。
+- iOS App、Widgets、NotificationService 共用 access group `$(AppIdentifierPrefix)com.pokai.Codync`(`project.yml` 對這三個 target 加 `keychain-access-groups` entitlement;`CodyncKit` 從 Info.plist `CodyncKeychainGroup` 讀 group,缺值則不設 group)。
- 私鑰永不離開 Keychain/process;雲端只存公鑰。
- 帳號登出/移除帳號:刪除該 context 的 device key、computers 快取、mailbox 草稿、widget snapshot。
@@ -103,7 +104,7 @@ See [architecture](../architecture/overview.md) and [file structure](../architec
| 動作 | 效果 |
|---|---|
-| 在電腦上撤銷裝置(Mac UI/`codync-host devices revoke`) | host 刪除裝置列與其 push tickets、Live Activity tickets → 立即關閉該裝置所有 channel → 發佈新 ACL → DO 關閉其 WebSocket;帳號來源的另呼叫 `DELETE` 對應 grant(見 §8.4 `POST /v1/host/grants/{id}/revoke`) |
+| 在電腦上撤銷裝置(桌面 App/`codync-host devices revoke`) | host 刪除裝置列與其 push tickets、Live Activity tickets → 立即關閉該裝置所有 channel → 發佈新 ACL → DO 關閉其 WebSocket;帳號來源的另呼叫 `DELETE` 對應 grant(見 §8.4 `POST /v1/host/grants/{id}/revoke`) |
| 雲端撤銷 grant/裝置/解除綁定/刪帳號 | Worker 寫 D1 → 呼叫 DO `/internal/block`(`[{dk, grantId}]`,立即關閉並封鎖)→ DO 通知 host `cloud.changed` → host 拉 `/v1/host/state` 並刪除裝置列 |
| host 連不到雲端 | 帳號來源裝置的 lease 最長 15 分鐘後失效,host 關閉 channel;本機(QR)來源裝置不受影響 |
@@ -139,7 +140,7 @@ codync://pair?v=3&name=<pct>&id=<computerId>&sk=<signPub>&bk=<boxPub>&code=<pair
`urls` 與 `cloud` 至少要有一個。`offerId = b64url(SHA-256("codync/offer/v1" ‖ codeBytes)[0..16])`。
流程:
-1. 使用者在電腦上開 QR(Mac 選單 → loopback `pairing`;或 `codync-host pair`)。host 產生 code,記在記憶體,並立即發佈含 `offers` 的新 ACL。
+1. 使用者在電腦上開 QR(桌面 App 選單列 → loopback `pairing`;或 `codync-host pair`)。host 產生 code,記在記憶體,並立即發佈含 `offers` 的新 ACL。
2. 手機載入/建立 device key,用 §7.5 的連線策略連線,hello 帶 `"pair": true`(中繼另需 URL `pair=<offerId>`)。
3. 握手成功(手機已用 QR 的 `sk` 驗證 host)後,第一個 request 必須是:
```json
@@ -157,11 +158,11 @@ codync://pair?v=3&name=<pct>&id=<computerId>&sk=<signPub>&bk=<boxPub>&code=<pair
### 4.2 帳號流程
-**A. 電腦加入帳號(claim)**—在該電腦上的 Mac App(或經 SSH tunnel 的 Mac App)操作:
-1. Mac App(Clerk 已登入)`POST /v1/claims` → `{claimId, nonce, expiresAt}`(5 分鐘)。
-2. Mac App 呼叫 loopback `claimSign {claimId, nonce, userId}` → host 回傳註冊資料與簽章:
+**A. 電腦加入帳號(claim)**—在該電腦上的桌面 App(或經 SSH tunnel 的桌面 App)操作:
+1. 桌面 App(Clerk 已登入)`POST /v1/claims` → `{claimId, nonce, expiresAt}`(5 分鐘)。
+2. 桌面 App 呼叫 loopback `claimSign {claimId, nonce, userId}` → host 回傳註冊資料與簽章:
`sig = Ed25519_host("codync/claim/v1\n" + claimId + "\n" + nonce + "\n" + userId + "\n" + computerId + "\n" + boxKey)`(UTF-8,**無結尾換行**;向量 `claim`)。Worker 以此 `boxKey` 建立或更新 `computers.box_pub`,不接受 client 另給的值。
-3. Mac App `POST /v1/claims/{claimId}/complete`(Clerk)帶上 host 回傳的內容。Worker 驗 Clerk、claim、簽章,原子化設定 owner。
+3. 桌面 App `POST /v1/claims/{claimId}/complete`(Clerk)帶上 host 回傳的內容。Worker 驗 Clerk、claim、簽章,原子化設定 owner。
4. Worker 通知 DO `cloud.changed` → host 拉 state 得知 owner。
**B. 手機取得存取權**(commit-then-reveal SAS,ZRTP/BLE numeric comparison 同型):
@@ -170,7 +171,7 @@ codync://pair?v=3&name=<pct>&id=<computerId>&sk=<signPub>&bk=<boxPub>&code=<pair
3. 對 `access == "none"` 的電腦:手機產生 32 random bytes `nD`(只存記憶體),`POST /v1/computers/{id}/access-requests {"commit": b64url(SHA-256("codync/sascommit/v1" ‖ dk ‖ nD))}` → `{requestId, expiresAt}`。
4. Worker 通知 DO → host 拉 state → 看到新申請(含 `commit`)→ host 產生 32 random bytes `nH`(存本機記憶體,每個 requestId 只產生一次)→ `POST /v1/host/access-requests/{id}/nonce {"nonce": nH}`(已有 host nonce → `409 conflict`,host 不得換)。
5. 手機輪詢 `GET /v1/access-requests/{id}`(每 2 秒)→ 出現 `hostNonce` 後才 `POST /v1/access-requests/{id}/reveal {"nonce": nD}` → Worker 存入並通知 DO `cloud.changed`。手機此時計算 SAS 顯示「在電腦上確認代碼 123456」。
-6. host 拉 state 取得 `deviceNonce` → 驗 `SHA-256("codync/sascommit/v1" ‖ dk ‖ nD) == commit`(不符 → 自動 deny 並記 `warn`)→ 計算 SAS → `accessRequests` 事件 → Mac App 顯示核准對話框(裝置名稱、平台、帳號 email、SAS)。**`nD` 驗證通過前 host 不顯示 SAS、不接受 approve**(`decideAccessRequest` 回 409)。無 GUI 的 host:`codync-host access list|approve|deny`。
+6. host 拉 state 取得 `deviceNonce` → 驗 `SHA-256("codync/sascommit/v1" ‖ dk ‖ nD) == commit`(不符 → 自動 deny 並記 `warn`)→ 計算 SAS → `accessRequests` 事件 → 桌面 App 顯示核准對話框(裝置名稱、平台、帳號 email、SAS)。**`nD` 驗證通過前 host 不顯示 SAS、不接受 approve**(`decideAccessRequest` 回 409)。無 GUI 的 host:`codync-host access list|approve|deny`。
7. 核准 → host `POST /v1/host/access-requests/{id}/decision {"decision":"approve"}` → D1 建立 grant → 回 `grantId` → host **以自己顯示給使用者的 `dk` 與回傳的 `grantId`** 新增裝置列(`source=account`,lease 15 分鐘)→ 發佈 ACL。
8. 手機輪詢到 `approved` → 連線(§7.5)。第一次 `hello` 回應帶 `boxKey`,此時 pin(§3.3)。
@@ -508,13 +509,13 @@ The route table below summarizes the contract. Executable schema and validation
`codync-host cloud` reports cloud status; `devices` lists/revokes device access; `access` handles pending approval. `reset-token` rotates the local bearer credential, not remote device grants.
-## 10. Shared Swift integration
+## 10. iOS Swift integration
-`CodyncKit/Client` owns transport, crypto, identity and cloud API models. `CodyncUI` owns account/per-computer stores and presentation. Consumers must retain account and computer scope when handling asynchronous responses, links and cached widget data. See [file structure](../architecture/file-structure.md).
+`CodyncKit/Client` (`apps/ios/Kit/`) owns transport, crypto, identity and cloud API models. `CodyncUI` owns account/per-computer stores and presentation. The desktop app doesn't use the device channel; it reaches its own host and SSH computers over loopback. Consumers must retain account and computer scope when handling asynchronous responses, links and cached widget data. See [file structure](../architecture/file-structure.md).
-## 11. Apple apps and SSH
+## 11. Apps and SSH
-The Apple apps share Clerk integration. QR pairing remains usable without an account; account sign-in requires host-approved device access. macOS uses OpenSSH forwarding for SSH computers, not a mobile SSH gateway. See [accounts and SSH](../guides/accounts-and-ssh.md).
+The iOS app (ClerkKit) and the desktop app (Clerk Frontend API) sign in to the same Clerk instance. QR pairing remains usable without an account; account sign-in requires host-approved device access. The desktop app uses OpenSSH forwarding for SSH computers, not a mobile SSH gateway. See [accounts and SSH](../guides/accounts-and-ssh.md).
## 12. Verification
@@ -552,7 +553,7 @@ The following implemented clarifications take precedence over the original contr
- **ACL**:列表中 `grant` 為 null 的已封鎖 dk 會被解除封鎖;被封鎖的 dk 仍可開 pairing socket。
- **帳號裝置 mailbox**:第一次拉取 state 之前收到的 item 先保留、不 ack。
- **SSH forward**:以 `lsof` 確認本機 listener 屬於我們啟動的 `ssh`。
-- **取消 access request**:iOS SAS sheet 與 Mac computers 視窗都有取消按鈕(`DELETE /v1/access-requests/{id}`)。
+- **取消 access request**:iOS SAS sheet 有取消按鈕(`DELETE /v1/access-requests/{id}`)。
## 15. Limits and risks