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.

An offline account computer named like one you use shows as an older copy with a remove button; a Mac cleans its earlier identities out of the account when it rejoins

leepokai00545ea9a6ca
diff --git a/apps/ios/Views/SettingsView.swift b/apps/ios/Views/SettingsView.swift
index 736a845b..27eb5949 100644
--- a/apps/ios/Views/SettingsView.swift
+++ b/apps/ios/Views/SettingsView.swift
@@ -19,6 +19,7 @@ struct SettingsView: View {
@State private var confirmRevoke: CloudComputer?
@State private var access: AccessTarget?
@State private var confirmStartOver = false
+ @State private var confirmRemoveCopy: CloudComputer?
var body: some View {
CardForm {
@@ -34,9 +35,13 @@ struct SettingsView: View {
}
}
ForEach(accountOnly) { computer in
- AccountComputerRow(computer: computer, ticket: accounts.pendingAccess[computer.computerId],
- ask: { access = AccessTarget(computer: computer) },
- revoke: { confirmRevoke = computer })
+ if accounts.isOlderCopy(computer) {
+ OlderCopyRow(computer: computer) { confirmRemoveCopy = computer }
+ } else {
+ AccountComputerRow(computer: computer, ticket: accounts.pendingAccess[computer.computerId],
+ ask: { access = AccessTarget(computer: computer) },
+ revoke: { confirmRevoke = computer })
+ }
}
Button {
addingComputer = true
@@ -116,6 +121,12 @@ struct SettingsView: View {
.buttonStyle(.plain)
}
}
+ .codyncDialog("Remove the older \(confirmRemoveCopy?.name ?? "computer")?", isPresented: Binding(
+ get: { confirmRemoveCopy != nil }, set: { if !$0 { confirmRemoveCopy = nil } }
+ ), message: "It's this computer under an earlier identity and can't be reached anymore. Removing it only cleans up your account.") {
+ guard let copy = confirmRemoveCopy else { return [] }
+ return [DialogAction("Remove", destructive: true) { Task { await accounts.removeFromAccount(copy.computerId) } }]
+ }
.codyncDialog("Start over?", isPresented: $confirmStartOver,
message: "Signs out of every account and forgets every computer on this iPhone, then shows the welcome again. Your computers keep their bots and chats; pair again to use them.") {
[DialogAction("Start over", destructive: true) { Task { await app.startOver() } }]
@@ -354,6 +365,31 @@ private struct AccountComputerRow: View {
}
}
+/// The same machine under an earlier identity: one tap cleans it out of the account.
+private struct OlderCopyRow: View {
+ let computer: CloudComputer
+ let remove: () -> Void
+
+ var body: some View {
+ HStack(spacing: 12) {
+ ComputerBadge(Computer(id: computer.computerId, name: computer.name, signKey: computer.signKey, device: computer.device), size: 40)
+ .opacity(0.35)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(computer.name).font(.body.weight(.semibold)).foregroundStyle(Palette.secondary)
+ Text(detail).font(.subheadline).foregroundStyle(Palette.tertiary).lineLimit(2)
+ }
+ Spacer()
+ IconButton("Remove from account", systemImage: "trash", action: remove)
+ }
+ .padding(.vertical, 2)
+ }
+
+ private var detail: String {
+ let seen = computer.lastSeenAt.map { " · last seen \(RelativeTime.day(Date(milliseconds: $0)))" } ?? ""
+ return "Older copy of this computer\(seen)"
+ }
+}
+
/// A navigation row label with a trailing chevron.
private struct LinkRow<Content: View>: View {
@ViewBuilder let content: Content
diff --git a/apps/macos/App/HostController.swift b/apps/macos/App/HostController.swift
index 0be2ef6b..5414d316 100644
--- a/apps/macos/App/HostController.swift
+++ b/apps/macos/App/HostController.swift
@@ -293,6 +293,7 @@ final class HostController {
let signed = try await client.claimSign(claimId: challenge.claimId, nonce: challenge.nonce, userId: userID)
_ = try await cloud.completeClaim(challenge.claimId, signed: signed)
await accounts.refreshCloud()
+ if store.computer.id == self.store?.computer.id { await forgetEarlierIdentities(of: store.computer.id) }
} catch {
accounts.lastError = error.localizedDescription
}
@@ -305,6 +306,10 @@ final class HostController {
} onChange: { [weak self] in
Task { @MainActor in self?.watchAutoClaim() }
}
+ // Remember which identity is this Mac while it's in the account, so a later key reset can clean it up.
+ if let store, let userID = account.userID, store.cloud?.owner?.userId == userID {
+ UserDefaults.standard.set([store.computer.id], forKey: "claimedComputerIds")
+ }
guard let pending, !autoClaiming else { return }
autoClaiming = true
Task {
@@ -334,6 +339,17 @@ final class HostController {
UserDefaults.standard.set(Array(ids), forKey: "keptOutOfAccount.\(userID)")
}
+ /// This Mac's host got new keys (a reset `~/.codync`, a reinstall): the identities this Mac claimed
+ /// before are dead copies of it, so they leave the account instead of showing up as a second Mac.
+ private func forgetEarlierIdentities(of current: ComputerID) async {
+ let key = "claimedComputerIds"
+ let earlier = Set(UserDefaults.standard.stringArray(forKey: key) ?? []).subtracting([current])
+ for computer in accounts.cloudComputers where earlier.contains(computer.computerId) && !computer.isOnline {
+ await accounts.removeFromAccount(computer.computerId)
+ }
+ UserDefaults.standard.set([current], forKey: key)
+ }
+
func unclaim(_ store: BotStore) async {
if let userID = account.userID { Self.setKeptOut(store.computer.id, true, userID: userID) }
do {
diff --git a/kit/Sources/CodyncUI/Store/AccountStore.swift b/kit/Sources/CodyncUI/Store/AccountStore.swift
index 06f0e701..9405a84a 100644
--- a/kit/Sources/CodyncUI/Store/AccountStore.swift
+++ b/kit/Sources/CodyncUI/Store/AccountStore.swift
@@ -183,6 +183,27 @@ public final class AccountStore {
return ticket
}
+ /// An offline account computer named like one this device uses or sees online: most likely the same
+ /// machine under an earlier identity (its host keys were reset), left behind in the account.
+ public func isOlderCopy(_ computer: CloudComputer) -> Bool {
+ !computer.isOnline && cloudComputers.contains { other in
+ other.computerId != computer.computerId && other.name == computer.name
+ && (stores[other.computerId] != nil || other.isOnline)
+ }
+ }
+
+ /// Takes a computer out of the account (its grants and pending requests go with it).
+ public func removeFromAccount(_ id: ComputerID) async {
+ guard let cloud else { return }
+ do {
+ try await cloud.removeComputer(id)
+ pendingAccess[id] = nil
+ await refreshCloud()
+ } catch {
+ lastError = error.localizedDescription
+ }
+ }
+
private func askForAccess() async {
let waiting = cloudComputers.filter { c in
c.isOnline && c.access != "granted" && !asked.contains(c.computerId)