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.

feat(macos): offer reset all data in release builds

leepokaiaa26901dbfc3
diff --git a/apps/ios/Views/SettingsView.swift b/apps/ios/Views/SettingsView.swift
index 28f496f3..efc97794 100644
--- a/apps/ios/Views/SettingsView.swift
+++ b/apps/ios/Views/SettingsView.swift
@@ -216,7 +216,7 @@ private struct ComputerRow: View {
VStack(alignment: .leading, spacing: 2) {
Text(store.hostName).font(.body.weight(.semibold)).foregroundStyle(Palette.text)
HStack(spacing: 4) {
- Text(detail).lineLimit(1)
+ Text(detail).lineLimit(stale ? 2 : 1)
if store.connection == .online { RouteIcon(route: store.hostRoute) }
}
.font(.subheadline)
@@ -229,21 +229,26 @@ private struct ComputerRow: View {
if store.screen != nil, store.connection == .online {
IconButton("Screen", systemImage: "display", action: openScreen)
}
- // Which route goes first, and whether Cloudflare is a fallback at all.
- DropdownMenu {
- ConnectionRoute.allCases.map { route in
- MenuItem(route.title, icon: route.icon, selected: route == preference) {
- accounts.setRoute(store.computer.id, route)
+ if stale {
+ // Revoked, or this computer under an earlier identity: nothing to do but remove it.
+ IconButton("Remove", systemImage: "trash", action: remove)
+ } else {
+ // Which route goes first, and whether Cloudflare is a fallback at all.
+ DropdownMenu {
+ ConnectionRoute.allCases.map { route in
+ MenuItem(route.title, icon: route.icon, selected: route == preference) {
+ accounts.setRoute(store.computer.id, route)
+ }
}
+ } label: {
+ Image(systemName: preference.icon)
+ .font(.system(size: 18, weight: .medium))
+ .foregroundStyle(Palette.secondary)
+ .frame(width: 36, height: 36)
+ .contentShape(Rectangle())
}
- } label: {
- Image(systemName: preference.icon)
- .font(.system(size: 18, weight: .medium))
- .foregroundStyle(Palette.secondary)
- .frame(width: 36, height: 36)
- .contentShape(Rectangle())
+ .accessibilityLabel("Connection")
}
- .accessibilityLabel("Connection")
if inAccount != nil {
Image(systemName: "person.crop.circle.badge.checkmark")
.foregroundStyle(Palette.tertiary)
@@ -284,8 +289,10 @@ private struct ComputerRow: View {
private var preference: ConnectionRoute { store.computer.route ?? .automatic }
+ private var stale: Bool { accounts.isStale(store.computer.id) }
+
private var detail: String {
- guard store.connection == .online else { return store.statusText }
+ guard store.connection == .online else { return accounts.statusText(store) }
let count = store.roster.count
let route = switch store.hostRoute {
case .direct: " · Wi-Fi/Tailscale"
diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swift
index e44f980c..48e256c3 100644
--- a/apps/macos/App/CodyncMacApp.swift
+++ b/apps/macos/App/CodyncMacApp.swift
@@ -136,13 +136,11 @@ struct MenuView: View {
Button("Open log") { NSWorkspace.shared.open(host.logURL) }
Divider()
Button("Uninstall host service") { host.uninstall() }
- #if DEBUG
Divider()
Button("Reset all data…") {
host.confirmsReset = true
open("chat")
}
- #endif
}
if let version = host.version { Text("Version \(version)") }
Button("Quit Codync") { NSApp.terminate(nil) }
diff --git a/apps/macos/App/HostController.swift b/apps/macos/App/HostController.swift
index 3af2a4ba..2e0a9f54 100644
--- a/apps/macos/App/HostController.swift
+++ b/apps/macos/App/HostController.swift
@@ -275,13 +275,19 @@ final class HostController {
}
}
- #if DEBUG
- /// Debug builds: the menu asks the chat window to confirm a full reset.
+ /// The menu asks the chat window to confirm a full reset.
var confirmsReset = false
- /// Debug builds: back to a first launch. Signs out every account, stops the host, deletes
- /// its data folder (bots, transcripts, keys) and this app's settings, then relaunches.
+ /// Back to a first launch. Removes this computer from the account and revokes its
+ /// paired devices, signs out every account, stops the host, deletes its data folder (bots,
+ /// transcripts, keys) and this app's settings, then relaunches.
func resetAllData() async {
+ // Tell paired devices first: connected ones see "No access" at once, and the account drops this
+ // computer instead of keeping an unreachable older copy of it.
+ if let client = store?.client {
+ try? await client.unclaim()
+ for device in (try? await client.devices()) ?? [] { try? await client.revokeDevice(device.key) }
+ }
let accountIDs = account.accounts.map(\.id)
await account.signOutAll()
for id in accountIDs + [nil] { SharedStore.Context(accountID: id).erase() }
@@ -296,7 +302,6 @@ final class HostController {
try? relaunch.run()
NSApp.terminate(nil)
}
- #endif
func setLaunchAtLogin(_ on: Bool) {
do {
diff --git a/apps/macos/Views/ChatWindow.swift b/apps/macos/Views/ChatWindow.swift
index 467ea9a7..8fcbb5d3 100644
--- a/apps/macos/Views/ChatWindow.swift
+++ b/apps/macos/Views/ChatWindow.swift
@@ -52,12 +52,10 @@ struct ChatWindow: View {
.background(Palette.background)
.tint(Palette.accent)
.ignoresSafeArea(.container, edges: .top)
- #if DEBUG
.codyncDialog("Reset all data?", isPresented: Bindable(host).confirmsReset,
message: "Signs out every account and deletes this Mac's bots, conversations, keys and settings. Codync then starts over from the welcome screen.") {
[DialogAction("Reset everything", destructive: true) { Task { await host.resetAllData() } }]
}
- #endif
// Approving a device: the code the device shows must match (spec §4.2 B).
// It closes when the request is decided or put off (both change `currentApproval`);
// closing it puts the request off.
diff --git a/apps/macos/Views/ComputersView.swift b/apps/macos/Views/ComputersView.swift
index 3723f203..5e6f049c 100644
--- a/apps/macos/Views/ComputersView.swift
+++ b/apps/macos/Views/ComputersView.swift
@@ -189,7 +189,8 @@ struct ComputersView: View {
ComputerBadge(store.computer, size: 22)
VStack(alignment: .leading, spacing: 1) {
Text(store.hostName).font(.callout.weight(.medium))
- Text(store.statusText).font(.caption).foregroundStyle(Palette.secondary)
+ Text(host.accounts.statusText(store)).font(.caption)
+ .foregroundStyle(host.accounts.isStale(computer.id) ? Palette.warning : Palette.secondary)
}
RouteLabel(store: store, ssh: false).foregroundStyle(Palette.tertiary)
Spacer()
diff --git a/apps/shared/ComputerStatus.swift b/apps/shared/ComputerStatus.swift
index b247a75d..b6a9d806 100644
--- a/apps/shared/ComputerStatus.swift
+++ b/apps/shared/ComputerStatus.swift
@@ -10,12 +10,20 @@ extension BotStore {
case .connecting: "Connecting…"
case let .computerOffline(lastSeen): lastSeen.map { "Offline · seen \(RelativeTime.day($0))" } ?? "Offline"
case .offline: "Can't reach"
- case .unauthorized: "No access"
+ case let .unauthorized(message): message
case .unpaired: "Not paired"
}
}
}
+extension AccountStore {
+ /// A computer's status line; one that's offline while its new identity is around says so.
+ func statusText(_ store: BotStore) -> String {
+ if case .unauthorized = store.connection { return store.statusText }
+ return isStale(store.computer.id) ? "Older copy of this computer · \(store.statusText)" : store.statusText
+ }
+}
+
/// How the phone reaches a computer right now: a subtle icon, direct Wi-Fi/LAN or the encrypted relay.
struct RouteIcon: View {
let route: HostRoute?
diff --git a/docs/guides/accounts-and-ssh.md b/docs/guides/accounts-and-ssh.md
index a498c348..cc7bb671 100644
--- a/docs/guides/accounts-and-ssh.md
+++ b/docs/guides/accounts-and-ssh.md
@@ -91,6 +91,14 @@ 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
+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
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
diff --git a/kit/Sources/CodyncUI/Store/AccountStore.swift b/kit/Sources/CodyncUI/Store/AccountStore.swift
index 8ee1fe92..1cc4b664 100644
--- a/kit/Sources/CodyncUI/Store/AccountStore.swift
+++ b/kit/Sources/CodyncUI/Store/AccountStore.swift
@@ -212,6 +212,23 @@ public final class AccountStore {
}
}
+ /// A computer this device uses that won't come back as it is: it turned this device away (access
+ /// revoked, or its identity changed after a reset or reinstall), or it's offline while a computer
+ /// with its name is reachable, the same machine under a new identity. Removing it is the fix.
+ public func isStale(_ id: ComputerID) -> Bool {
+ guard let store = stores[id] else { return false }
+ switch store.connection {
+ case .unauthorized:
+ return true
+ case .computerOffline, .offline:
+ let name = store.computer.name
+ return stores.values.contains { $0.computer.id != id && $0.computer.name == name && $0.connection == .online }
+ || cloudComputers.contains { $0.computerId != id && $0.name == name && $0.isOnline }
+ default:
+ return false
+ }
+ }
+
/// Access requests appear and settle with an animation, like connection changes.
private func setPending(_ id: ComputerID, _ ticket: AccessTicket?) {
guard pendingAccess[id] != ticket else { return }