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.

Signed in on the iPhone, account computers are asked for access on their own; a computer can skip the 6-digit check for its account's devices, after a clear warning

leepokai1d9734c458dc
diff --git a/apps/ios/App/CodyncApp.swift b/apps/ios/App/CodyncApp.swift
index 5acab2db..f2b040c2 100644
--- a/apps/ios/App/CodyncApp.swift
+++ b/apps/ios/App/CodyncApp.swift
@@ -37,6 +37,8 @@ struct CodyncApp: App {
.onOpenURL { url in app.open(url) }
.onChange(of: scenePhase, initial: true) { _, phase in
app.accounts.setActive(phase == .active)
+ // Back in the app: a computer may have joined the account meanwhile.
+ if phase == .active { Task { await app.accounts.refreshCloud() } }
}
#if DEBUG
.task {
@@ -160,6 +162,7 @@ final class AppStore {
let identity = storage.accountID == nil ? nil : try? DeviceIdentity.load(context: storage)
let cloud = session.cloudClient(for: storage.accountID, identity: identity)
let accounts = AccountStore(storage: storage, clientKind: "ios", cloud: cloud)
+ accounts.asksForAccess = true
accounts.onConnected = { store in
PushRegistrar.shared.syncDevice(with: store)
store.onUsageChanged = { _, _ in WidgetCenter.shared.reloadTimelines(ofKind: "CodyncUsage") }
diff --git a/apps/ios/Views/RootView.swift b/apps/ios/Views/RootView.swift
index a1e18521..6308b0ea 100644
--- a/apps/ios/Views/RootView.swift
+++ b/apps/ios/Views/RootView.swift
@@ -77,11 +77,14 @@ struct RootView: View {
.animation(Motion.reduced(Motion.fade, reduceMotion), value: app.tab)
.safeAreaInset(edge: .bottom, spacing: 0) {
if accounts.selection == nil {
- TabBar(selection: Bindable(app).tab, tabs: [
- (id: AppTab.bots, title: "Bots", icon: "bubble.left.and.bubble.right.fill"),
- (id: AppTab.usage, title: "Usage", icon: "chart.bar.fill"),
- ])
- .padding(.bottom, 4)
+ VStack(spacing: 8) {
+ AccessBanners()
+ TabBar(selection: Bindable(app).tab, tabs: [
+ (id: AppTab.bots, title: "Bots", icon: "bubble.left.and.bubble.right.fill"),
+ (id: AppTab.usage, title: "Usage", icon: "chart.bar.fill"),
+ ])
+ .padding(.bottom, 4)
+ }
.transition(.move(edge: .bottom).combined(with: .opacity))
}
}
@@ -259,3 +262,36 @@ private extension View {
.accessibilityHidden(!selected)
}
}
+
+/// Account computers this iPhone asked on its own after sign-in: the code to check, until they answer.
+private struct AccessBanners: View {
+ @Environment(AccountStore.self) private var accounts
+
+ var body: some View {
+ VStack(spacing: 8) {
+ ForEach(Array(accounts.pendingAccess.values).sorted { $0.requestId < $1.requestId }) { ticket in
+ let name = accounts.cloudComputers.first { $0.computerId == ticket.computerId }?.name ?? "Your computer"
+ HStack(spacing: 12) {
+ Spinner(size: 16)
+ VStack(alignment: .leading, spacing: 1) {
+ Text("Approve on \(name)").font(.subheadline.weight(.medium)).foregroundStyle(Palette.text)
+ Text("Code \(ticket.code.prefix(3)) \(ticket.code.suffix(3))")
+ .font(.footnote.monospacedDigit()).foregroundStyle(Palette.secondary)
+ }
+ Spacer(minLength: 8)
+ IconButton("Cancel request", systemImage: "xmark") {
+ Task { await accounts.cancelAccess(ticket.computerId) }
+ }
+ }
+ .padding(.leading, 14)
+ .padding(.trailing, 6)
+ .padding(.vertical, 8)
+ .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 16, style: .continuous))
+ .transition(.move(edge: .bottom).combined(with: .opacity))
+ }
+ }
+ .padding(.horizontal, 16)
+ .animation(Motion.layout, value: accounts.pendingAccess.keys.sorted())
+ .accessibilityElement(children: .contain)
+ }
+}
diff --git a/apps/macos/Views/ComputersView.swift b/apps/macos/Views/ComputersView.swift
index a87695f4..29a1f366 100644
--- a/apps/macos/Views/ComputersView.swift
+++ b/apps/macos/Views/ComputersView.swift
@@ -301,9 +301,11 @@ private struct ManagedComputerCard: View {
@State private var showPairing = false
@State private var confirmRevoke: AuthorizedDevice?
@State private var confirmUnclaim = false
+ @State private var confirmAutoApproval = false
@Environment(\.accessibilityReduceMotion) private var reduceMotion
private var cloud: CloudStatus? { store.cloud }
+ private var autoApproval: Bool { cloud?.approval == .auto }
var body: some View {
VStack(alignment: .leading, spacing: 12) {
@@ -337,6 +339,21 @@ private struct ManagedComputerCard: View {
accountLine
+ if cloud?.owner != nil {
+ Toggle(isOn: Binding(get: { autoApproval }, set: { on in
+ if on { confirmAutoApproval = true } else { setApproval(.code) }
+ })) {
+ VStack(alignment: .leading, spacing: 1) {
+ Text("Skip the 6-digit check")
+ Text(autoApproval ? "Devices on your account get in on their own." : "Each new device shows a code you approve here.")
+ .font(.caption).foregroundStyle(autoApproval ? Palette.warning : Palette.secondary)
+ }
+ }
+ .toggleStyle(.codync)
+ .disabled(busy || store.connection != .online)
+ .transition(.opacity)
+ }
+
VStack(alignment: .leading, spacing: 6) {
Text("Devices that can use \(store.hostName)").font(.subheadline.weight(.semibold))
if let devices {
@@ -364,6 +381,10 @@ private struct ManagedComputerCard: View {
}
}]
}
+ .codyncDialog("Let account devices in without a code?", isPresented: $confirmAutoApproval,
+ message: "Any device signed in to your account gets full control of \(store.hostName): its files, terminals and bots, with no check here. If someone gets into your Google account, or Codync's cloud is ever compromised, they could add their own device and you'd have no chance to stop it. Devices paired with a QR code aren't affected.") {
+ [DialogAction("Skip the check", destructive: true) { setApproval(.auto) }]
+ }
.codyncDialog("Remove \(store.hostName) from the account?", isPresented: $confirmUnclaim,
message: "Devices that were approved through the account lose access. Devices paired with a QR code keep it.") {
[DialogAction("Remove from account", destructive: true) { run { await host.unclaim(store) } }]
@@ -376,6 +397,12 @@ private struct ManagedComputerCard: View {
return cloud.connected == true ? "Reachable from anywhere through Cloudflare (encrypted)." : "Connecting to Cloudflare…"
}
+ private func setApproval(_ approval: AccountApproval) {
+ run {
+ do { _ = try await store.client?.setApproval(approval) } catch { host.accounts.lastError = error.localizedDescription }
+ }
+ }
+
@ViewBuilder private var accountLine: some View {
HStack(spacing: 8) {
if let owner = cloud?.owner {
diff --git a/host/src/acp.rs b/host/src/agent/acp.rs
similarity index 100%
rename from host/src/acp.rs
rename to host/src/agent/acp.rs
diff --git a/host/src/auth.rs b/host/src/agent/auth.rs
similarity index 100%
rename from host/src/auth.rs
rename to host/src/agent/auth.rs
diff --git a/host/src/backends.rs b/host/src/agent/backends.rs
similarity index 100%
rename from host/src/backends.rs
rename to host/src/agent/backends.rs
diff --git a/host/src/bot.rs b/host/src/agent/bot.rs
similarity index 100%
rename from host/src/bot.rs
rename to host/src/agent/bot.rs
diff --git a/host/src/registry.rs b/host/src/agent/registry.rs
similarity index 100%
rename from host/src/registry.rs
rename to host/src/agent/registry.rs
diff --git a/host/src/term.rs b/host/src/agent/term.rs
similarity index 100%
rename from host/src/term.rs
rename to host/src/agent/term.rs
diff --git a/host/src/devices.rs b/host/src/api/devices.rs
similarity index 100%
rename from host/src/devices.rs
rename to host/src/api/devices.rs
diff --git a/host/src/api.rs b/host/src/api/mod.rs
similarity index 100%
rename from host/src/api.rs
rename to host/src/api/mod.rs
diff --git a/host/src/context.rs b/host/src/chat/context.rs
similarity index 100%
rename from host/src/context.rs
rename to host/src/chat/context.rs
diff --git a/host/src/group.rs b/host/src/chat/group.rs
similarity index 100%
rename from host/src/group.rs
rename to host/src/chat/group.rs
diff --git a/host/src/memory.rs b/host/src/chat/memory.rs
similarity index 100%
rename from host/src/memory.rs
rename to host/src/chat/memory.rs
diff --git a/host/src/team.rs b/host/src/chat/team.rs
similarity index 100%
rename from host/src/team.rs
rename to host/src/chat/team.rs
diff --git a/host/src/composio.rs b/host/src/market/composio.rs
similarity index 100%
rename from host/src/composio.rs
rename to host/src/market/composio.rs
diff --git a/host/src/market.rs b/host/src/market/mod.rs
similarity index 100%
rename from host/src/market.rs
rename to host/src/market/mod.rs
diff --git a/host/src/channel.rs b/host/src/remote/channel.rs
similarity index 100%
rename from host/src/channel.rs
rename to host/src/remote/channel.rs
diff --git a/host/src/cloud.rs b/host/src/remote/cloud.rs
similarity index 100%
rename from host/src/cloud.rs
rename to host/src/remote/cloud.rs
diff --git a/host/src/crypto.rs b/host/src/remote/crypto.rs
similarity index 100%
rename from host/src/crypto.rs
rename to host/src/remote/crypto.rs
diff --git a/host/src/identity.rs b/host/src/remote/identity.rs
similarity index 100%
rename from host/src/identity.rs
rename to host/src/remote/identity.rs
diff --git a/host/src/push.rs b/host/src/remote/push.rs
similarity index 100%
rename from host/src/push.rs
rename to host/src/remote/push.rs
diff --git a/host/src/relay.rs b/host/src/remote/relay.rs
similarity index 100%
rename from host/src/relay.rs
rename to host/src/remote/relay.rs
diff --git a/kit/Sources/CodyncKit/Client/HostClient.swift b/kit/Sources/CodyncKit/Client/HostClient.swift
index a979b4f9..5e4e9225 100644
--- a/kit/Sources/CodyncKit/Client/HostClient.swift
+++ b/kit/Sources/CodyncKit/Client/HostClient.swift
@@ -342,6 +342,10 @@ public extension HostClient {
return try await call("setCloud", Body(enabled: enabled, url: url?.absoluteString), timeout: 30)
}
+ func setApproval(_ approval: AccountApproval) async throws -> CloudStatus {
+ try await call("setApproval", ["approval": approval.rawValue])
+ }
+
func unclaim() async throws {
let _: Empty = try await call("unclaim", timeout: 30)
}
diff --git a/kit/Sources/CodyncKit/Models/Cloud.swift b/kit/Sources/CodyncKit/Models/Cloud.swift
index 35b20680..44e5e0bd 100644
--- a/kit/Sources/CodyncKit/Models/Cloud.swift
+++ b/kit/Sources/CodyncKit/Models/Cloud.swift
@@ -1,7 +1,7 @@
import Foundation
// Wire types for the Codync cloud (`/v1`, cloud/src/api.ts), the host's loopback-only
-// account methods (host/src/api.rs) and the relay mailbox. Times are epoch milliseconds.
+// account methods (host/src/api/mod.rs) and the relay mailbox. Times are epoch milliseconds.
// Decoding is lenient: unknown fields are ignored and anything the server may omit is optional.
/// `GET /v1/me`.
@@ -112,6 +112,20 @@ public struct CloudStatus: Codable, Hashable, Sendable {
public var connected: Bool?
public var owner: CloudOwner?
public var lastError: String?
+ /// Missing from older hosts: they always ask for the code.
+ public var approval: AccountApproval?
+}
+
+/// How devices on the computer's account get in (loopback `setApproval`).
+public enum AccountApproval: String, Codable, Hashable, Sendable {
+ /// Compare the 6-digit code and approve each device at the computer.
+ case code
+ /// Let them in without anyone comparing the code.
+ case auto
+
+ public init(from decoder: any Decoder) throws {
+ self = Self(rawValue: try decoder.singleValueContainer().decode(String.self)) ?? .code
+ }
}
/// `POST /v1/claims`.
diff --git a/kit/Sources/CodyncUI/Store/AccountStore.swift b/kit/Sources/CodyncUI/Store/AccountStore.swift
index 4e55b9c3..8b1e8cf4 100644
--- a/kit/Sources/CodyncUI/Store/AccountStore.swift
+++ b/kit/Sources/CodyncUI/Store/AccountStore.swift
@@ -30,6 +30,9 @@ public final class AccountStore {
/// Access requests waiting for approval on the computer, with the SAS to show.
public private(set) var pendingAccess: [ComputerID: AccessTicket] = [:]
public var lastError: String?
+ /// Signed in, ask every account computer this device can't use yet for access, without a tap.
+ /// Computers set to auto-approve let it straight in; the others show the code to check.
+ public var asksForAccess = false
public var selection: BotReference? {
didSet { if let id = selection?.computerId, !retired { storage.lastComputerId = id } }
}
@@ -50,6 +53,8 @@ public final class AccountStore {
private var accessPolls: [ComputerID: Task<Void, Never>] = [:]
private var isActive = true
private var retired = false
+ /// Asked once per launch: a denied or cancelled request isn't repeated behind the user's back.
+ private var asked: Set<ComputerID> = []
public convenience init(storage: SharedStore.Context, clientKind: String, cloud: CloudClient?) {
self.init(storage: storage, clientKind: clientKind, cloud: cloud) { computer, route in
@@ -145,6 +150,7 @@ public final class AccountStore {
let list = try await cloud.computers()
guard !retired else { return }
cloudComputers = list
+ if asksForAccess { await askForAccess() }
} catch {
lastError = error.localizedDescription
}
@@ -164,6 +170,21 @@ public final class AccountStore {
return ticket
}
+ private func askForAccess() async {
+ let waiting = cloudComputers.filter { c in
+ c.isOnline && c.access != "granted" && !asked.contains(c.computerId)
+ && pendingAccess[c.computerId] == nil && stores[c.computerId] == nil
+ }
+ for computer in waiting {
+ asked.insert(computer.computerId)
+ do {
+ _ = try await requestAccess(computer.computerId)
+ } catch {
+ lastError = error.localizedDescription
+ }
+ }
+ }
+
/// Withdraws a pending access request; the computer drops it from its approval list.
public func cancelAccess(_ id: ComputerID) async {
guard let ticket = pendingAccess[id] else { return }