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.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
Mac window and menu open every panel as Codync's own animated card
leepokai06289eec247c
diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swiftindex aae5ee35..85f43768 100644--- a/apps/macos/App/CodyncMacApp.swift+++ b/apps/macos/App/CodyncMacApp.swift@@ -18,10 +18,10 @@ struct CodyncMacApp: App {var body: some Scene {MenuBarExtra {MenuView()- .environment(host)- .environment(account).frame(width: 340).modalHost()+ .environment(host)+ .environment(account)} label: {// The Codync mark; a dot joins it when a bot needs you.Image(host.needsAttention ? "MenuBarIconAlert" : "MenuBarIcon")@@ -55,6 +55,7 @@ struct MenuView: View {@Environment(\.openWindow) private var openWindow@State private var showPairing = false@State private var showSettings = false+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {VStack(alignment: .leading, spacing: 0) {@@ -73,7 +74,10 @@ struct MenuView: View {footer}.background(Palette.background)- .animation(Motion.layout, value: showPairing)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: showPairing)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.state)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.approvals.map(\.id))+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.roster.isEmpty)}// MARK: header@@ -258,6 +262,7 @@ private extension View {/// One line when all is well; it only grows to say what's missing.private struct RemoteScreenSection: View {@Environment(HostController.self) private var host+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {let screen = host.screen ?? ScreenState()@@ -302,7 +307,8 @@ private struct RemoteScreenSection: View {Text(error).font(.caption).foregroundStyle(Palette.danger).fixedSize(horizontal: false, vertical: true)}}- .animation(Motion.layout, value: screen)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: screen)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.screenError)}private func subtitle(_ screen: ScreenState) -> String {@@ -440,6 +446,7 @@ struct PairingPanel: View {let store: BotStore@State private var info: PairingInfo?@State private var error: String?+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {VStack(spacing: 12) {@@ -487,6 +494,8 @@ struct PairingPanel: View {}.frame(maxWidth: .infinity).padding(16)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: info?.pairingUrl)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: error).task(id: store.computer.id) { await load() }}diff --git a/apps/macos/Views/ChatWindow.swift b/apps/macos/Views/ChatWindow.swiftindex a28375bb..3d726911 100644--- a/apps/macos/Views/ChatWindow.swift+++ b/apps/macos/Views/ChatWindow.swift@@ -6,31 +6,85 @@ import SwiftUI/// (Grok Bot's desktop layout), sharing its views with the iPhone app.struct ChatWindow: View {@Environment(HostController.self) private var host+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ private var showsChat: Bool { host.state == .running || !host.accounts.computers.isEmpty }var body: some View {- Group {- if host.state == .running || !host.accounts.computers.isEmpty {+ ZStack {+ if showsChat {ChatSplitView().id(host.contextID)+ .transition(.opacity)} else {- ContentUnavailableView(- "Codync host isn't running",- systemImage: "desktopcomputer.trianglebadge.exclamationmark",- description: Text("Open Codync from the menu bar to install or restart it.")+ EmptyState(+ icon: "desktopcomputer.trianglebadge.exclamationmark",+ title: "Codync host isn't running",+ message: "Open Codync from the menu bar to install or restart it.")+ .transition(.opacity.combined(with: .scale(scale: 0.97)))}}+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: showsChat).frame(minWidth: 760, minHeight: 500)+ .frame(maxWidth: .infinity, maxHeight: .infinity).background(Palette.background).tint(Palette.accent).ignoresSafeArea(.container, edges: .top)// 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`).- .sheet(item: Binding(get: { host.currentApproval }, set: { _ in })) {- ApprovalSheet(approval: $0)+ // It closes when the request is decided or put off (both change `currentApproval`);+ // closing it puts the request off.+ .codyncSheet(isPresented: Binding(+ get: { host.currentApproval != nil },+ set: { if !$0, let approval = host.currentApproval { host.deferApproval(approval) } }+ )) {+ CurrentApprovalSheet()}}}+/// The request being decided, swapped in place when the next one comes up; keeps the last+/// one on screen while the card animates away.+private struct CurrentApprovalSheet: View {+ @Environment(HostController.self) private var host+ @State private var last: Approval?++ var body: some View {+ if let approval = host.currentApproval ?? last {+ ApprovalSheet(approval: approval)+ .id(approval.id)+ .onAppear { last = approval }+ }+ }+}++/// A quiet placeholder for an empty screen: icon, title, a line of help and an optional action.+struct EmptyState: View {+ let icon: String+ let title: String+ let message: String+ var action: (title: String, run: () -> Void)?++ var body: some View {+ VStack(spacing: 10) {+ Image(systemName: icon)+ .font(.system(size: 36, weight: .light))+ .foregroundStyle(Palette.tertiary)+ .accessibilityHidden(true)+ Text(title).font(.title3.weight(.semibold)).foregroundStyle(Palette.text)+ Text(message)+ .font(.callout)+ .foregroundStyle(Palette.secondary)+ .multilineTextAlignment(.center)+ .frame(maxWidth: 360)+ if let action {+ Button(action.title, action: action.run).buttonStyle(.primary).padding(.top, 4)+ }+ }+ .padding(32)+ .frame(maxWidth: .infinity, maxHeight: .infinity)+ }+}+/// A bot together with the store of the computer it lives on.@MainActorprivate struct BotTarget {@@ -96,10 +150,7 @@ private struct ChatSplitView: View {VStack(spacing: 0) {HStack {Spacer()- Button("New chat", systemImage: "plus", action: compose)- .labelStyle(.iconOnly)- .buttonStyle(.plain)- .help("New chat (⌘N)")+ IconButton("New chat", systemImage: "plus", action: compose).keyboardShortcut("n").disabled(onlineStores.isEmpty)}@@ -206,12 +257,7 @@ private struct ChatSplitView: View {.multilineTextAlignment(.center).frame(maxWidth: 420)Button("New Bot", action: compose)- .buttonStyle(.plain)- .font(.body.weight(.semibold))- .padding(.horizontal, 18)- .padding(.vertical, 9)- .background(Palette.accentFill, in: Capsule())- .foregroundStyle(Palette.onAccent)+ .buttonStyle(.primary).disabled(onlineStores.isEmpty)}.padding(32)@@ -283,14 +329,16 @@ private struct ChatSplitView: View {}}.animation(Motion.reduced(Motion.fade, reduceMotion), value: showAccount)+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: contextBot?.bot.id).ignoresSafeArea(.container, edges: .top)- .sheet(item: $editing) { target in- NavigationStack { BotEditorView(draft: target.request.draft) }+ .codyncSheet(item: $editing) { target in+ BotEditorView(draft: target.request.draft).environment(target.store).frame(width: 520, height: min(680, sheetHeight))}- .sheet(isPresented: Binding(get: { marketplace != nil }, set: { if !$0 { marketplace = nil } })) {+ .codyncSheet(isPresented: Binding(get: { marketplace != nil }, set: { if !$0 { marketplace = nil } })) {if let store = marketplace.flatMap(accounts.store(for:)) {+ // MarketplaceView pushes its Installed page with navigationDestination, which needs a stack.NavigationStack {MarketplaceView { marketplace = nil }}@@ -298,32 +346,12 @@ private struct ChatSplitView: View {.frame(width: min(920, windowSize.width - 80), height: sheetHeight)}}- .sheet(isPresented: $showComputers) {- ComputersView { showComputers = false }+ .codyncSheet(isPresented: $showComputers) {+ ComputersView().frame(width: 620, height: sheetHeight)}- .sheet(isPresented: $showUsage) {- VStack(alignment: .leading, spacing: 20) {- HStack {- Text("Usage").font(.title2.bold())- Spacer()- Button("Done") { showUsage = false }.keyboardShortcut(.cancelAction)- }- let withUsage = stores.filter { !$0.usage.providers.isEmpty }- if withUsage.isEmpty {- Text("No usage information yet.").foregroundStyle(Palette.secondary)- } else {- ForEach(withUsage, id: \.computer.id) { store in- if stores.count > 1 {- Label { Text(store.hostName) } icon: { ComputerBadge(store.computer, size: 16) }- .font(.headline)- }- UsageStrip(usage: store.usage)- }- }- }- .padding(24)- .frame(width: 520)+ .codyncSheet(isPresented: $showUsage) {+ UsageSheet().frame(width: 520)}.background {collapseButton.hidden()@@ -447,8 +475,10 @@ extension ChatSplitView {Button("Clear search", systemImage: "xmark.circle.fill") { search = "" }.labelStyle(.iconOnly).buttonStyle(.plain).foregroundStyle(Palette.secondary)+ .transition(.opacity.combined(with: .scale(scale: 0.8)))}}+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: search.isEmpty).font(.system(size: 13)).padding(.horizontal, 9).frame(height: 28)@@ -669,6 +699,34 @@ extension ChatSplitView {}}+/// Usage per computer, read live from the stores.+private struct UsageSheet: View {+ @Environment(HostController.self) private var host++ var body: some View {+ let stores = host.accounts.computers.compactMap { host.accounts.store(for: $0.id) }+ let withUsage = stores.filter { !$0.usage.providers.isEmpty }+ VStack(alignment: .leading, spacing: 0) {+ ModalHeader("Usage")+ VStack(alignment: .leading, spacing: 20) {+ if withUsage.isEmpty {+ Text("No usage information yet.").foregroundStyle(Palette.secondary)+ } else {+ ForEach(withUsage, id: \.computer.id) { store in+ if stores.count > 1 {+ Label { Text(store.hostName) } icon: { ComputerBadge(store.computer, size: 16) }+ .font(.headline)+ }+ UsageStrip(usage: store.usage)+ }+ }+ }+ .padding([.horizontal, .bottom], 24)+ .padding(.top, 4)+ }+ }+}+extension View {@ViewBuilder fileprivate func hiddenWindowTitle() -> some View {if #available(macOS 15.0, *) { toolbar(removing: .title) } else { self }@@ -694,6 +752,7 @@ private struct SidebarAccountPanel: View {@State private var page = "main"@State private var highlighted = 0@FocusState private var menuFocused: Bool+ @Environment(\.accessibilityReduceMotion) private var reduceMotionprivate struct Item {let title: String@@ -796,8 +855,10 @@ private struct SidebarAccountPanel: View {}private func navigate(_ destination: String) {- page = destination- highlighted = 0+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) {+ page = destination+ highlighted = 0+ }menuFocused = true}diff --git a/apps/macos/Views/ComputersView.swift b/apps/macos/Views/ComputersView.swiftindex 8e94a4d0..5996fb7a 100644--- a/apps/macos/Views/ComputersView.swift+++ b/apps/macos/Views/ComputersView.swift@@ -51,15 +51,23 @@ struct ApprovalSheet: View {@Environment(HostController.self) private var host@State private var busy = false@State private var error: String?+ @Environment(\.accessibilityReduceMotion) private var reduceMotionprivate var request: AccessRequest { approval.request }var body: some View {+ VStack(spacing: 0) {+ // Closing puts the request off (the sheet's binding defers it).+ ModalHeader("Access request")+ content+ }+ .frame(width: 420)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: request.code)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: error)+ }++ private var content: some View {VStack(spacing: 16) {- HStack {- Spacer()- IconButton("Decide later", systemImage: "xmark") { host.deferApproval(approval) }- }Image(systemName: request.platform == "macos" ? "laptopcomputer" : "iphone").font(.system(size: 40, weight: .light)).foregroundStyle(Palette.secondary)@@ -91,6 +99,7 @@ struct ApprovalSheet: View {}if let error {Text(error).font(.caption).foregroundStyle(Palette.danger).multilineTextAlignment(.center)+ .transition(.opacity.combined(with: .move(edge: .top)))}HStack(spacing: 12) {Button("Deny") { decide(false) }@@ -101,8 +110,7 @@ struct ApprovalSheet: View {.disabled(busy || request.code == nil)}}- .padding(24)- .frame(width: 420)+ .padding([.horizontal, .bottom], 24)}private func decide(_ approve: Bool) {@@ -129,19 +137,14 @@ struct ApprovalSheet: View {/// Computers this Mac manages (itself and SSH), with their account, relay and authorized devices;/// SSH profiles; and the account's other computers.struct ComputersView: View {- let close: () -> Void@Environment(HostController.self) private var host@Environment(AccountSession.self) private var account@State private var editingSSH: SSHProfile?+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {VStack(spacing: 0) {- HStack {- Text("Computers & devices").font(.title2.bold())- Spacer()- Button("Done", action: close).keyboardShortcut(.cancelAction)- }- .padding(20)+ ModalHeader("Computers & devices")ScrollView {VStack(alignment: .leading, spacing: 22) {ForEach(host.managedStores, id: \.computer.id) { store in@@ -151,12 +154,17 @@ struct ComputersView: View {accountSection}.padding(.horizontal, 20)+ .padding(.top, 4).padding(.bottom, 20)}}.background(Palette.background)- .sheet(item: $editingSSH) { profile in- SSHProfileEditor(profile: profile, isNew: !host.ssh.profiles.contains { $0.id == profile.id }) { editingSSH = nil }+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.ssh.profiles.map(\.id))+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.accounts.computers.map(\.id))+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.accounts.cloudComputers.map(\.id))+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: account.isSignedIn)+ .codyncSheet(item: $editingSSH) { profile in+ SSHProfileEditor(profile: profile, isNew: !host.ssh.profiles.contains { $0.id == profile.id })}}@@ -234,6 +242,7 @@ private struct AccountComputerRow: View {let computer: CloudComputer@Environment(HostController.self) private var host@State private var busy = false+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {let ticket = host.accounts.pendingAccess[computer.id]@@ -255,7 +264,9 @@ private struct AccountComputerRow: View {}}}+ .buttonStyle(.secondary).disabled(busy)+ .transition(.opacity)}}if let ticket {@@ -267,16 +278,15 @@ private struct AccountComputerRow: View {.font(.callout).foregroundStyle(Palette.secondary).fixedSize(horizontal: false, vertical: true)Spacer()- Button("Cancel request", systemImage: "xmark.circle") {+ IconButton("Cancel request", systemImage: "xmark.circle") {Task { await host.accounts.cancelAccess(computer.id) }}- .labelStyle(.iconOnly)- .buttonStyle(.plain)- .help("Cancel request")}+ .transition(.opacity.combined(with: .move(edge: .top)))}}.card()+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: ticket?.code)}}@@ -291,6 +301,7 @@ private struct ManagedComputerCard: View {@State private var showPairing = false@State private var confirmRevoke: AuthorizedDevice?@State private var confirmUnclaim = false+ @Environment(\.accessibilityReduceMotion) private var reduceMotionprivate var cloud: CloudStatus? { store.cloud }@@ -306,8 +317,12 @@ private struct ManagedComputerCard: View {Spacer()IconButton("Pair iPhone", systemImage: "qrcode", selected: showPairing) { showPairing.toggle() }.disabled(store.connection != .online)- .popover(isPresented: $showPairing, arrowEdge: .bottom) {- PairingPanel(store: store).frame(width: 300)+ .codyncSheet(isPresented: $showPairing) {+ VStack(spacing: 0) {+ ModalHeader("Pair iPhone with \(store.hostName)")+ PairingPanel(store: store)+ }+ .frame(width: 340)}}@@ -328,13 +343,15 @@ private struct ManagedComputerCard: View {if devices.isEmpty {Text("None yet. Pair an iPhone, or approve one from your account.").font(.caption).foregroundStyle(Palette.secondary)}- ForEach(devices) { device in deviceRow(device) }+ ForEach(devices) { device in deviceRow(device).transition(.opacity.combined(with: .move(edge: .top))) }} else {Spinner()}}}.card()+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: devices?.map(\.key))+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: cloud?.owner == nil).task(id: "\(store.computer.id)/\(store.connection == .online)/\(store.accessRequests.count)") { await loadDevices() }.codyncDialog("Revoke \(confirmRevoke?.name ?? "device")?", isPresented: Binding(get: { confirmRevoke != nil }, set: { if !$0 { confirmRevoke = nil } }@@ -367,6 +384,7 @@ private struct ManagedComputerCard: View {.font(.callout)Spacer()Button("Remove from account") { confirmUnclaim = true }+ .buttonStyle(.secondary).disabled(busy || store.connection != .online)} else {Image(systemName: "person.crop.circle.badge.plus").foregroundStyle(Palette.secondary).accessibilityHidden(true)@@ -374,6 +392,7 @@ private struct ManagedComputerCard: View {Spacer()if account.isSignedIn {Button(busy ? "Adding…" : "Add to account") { run { await host.claim(store) } }+ .buttonStyle(.secondary).disabled(busy || store.connection != .online)}}@@ -426,6 +445,7 @@ private struct SSHRow: View {let profile: SSHProfilelet edit: () -> Void@Environment(HostController.self) private var host+ @Environment(\.accessibilityReduceMotion) private var reduceMotionvar body: some View {let status = host.ssh.status(of: profile.id)@@ -454,11 +474,11 @@ private struct SSHRow: View {.fixedSize(horizontal: false, vertical: true)ForEach(fingerprints, id: \.self) { Text($0).font(.caption.monospaced()).textSelection(.enabled) }HStack {- Button("Trust and connect") { host.ssh.trustHostKey(profile.id) }- Button("Cancel") { host.ssh.disconnect(profile.id) }+ Button("Trust and connect") { host.ssh.trustHostKey(profile.id) }.buttonStyle(.primary)+ Button("Cancel") { host.ssh.disconnect(profile.id) }.buttonStyle(.secondary)}- .controlSize(.small)}+ .transition(.opacity.combined(with: .move(edge: .top)))}if status == .notInstalled {HStack(spacing: 6) {@@ -473,9 +493,11 @@ private struct SSHRow: View {NSPasteboard.general.setString(SSH.installCommand, forType: .string)}}+ .transition(.opacity.combined(with: .move(edge: .top)))}}.card()+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: status)}private func line(_ status: SSHComputers.Status) -> String {@@ -503,26 +525,41 @@ private struct SSHRow: View {private struct SSHProfileEditor: View {@State var profile: SSHProfilelet isNew: Bool- let close: () -> Void@Environment(HostController.self) private var host+ @Environment(\.dismissModal) private var dismiss+ @Environment(\.accessibilityReduceMotion) private var reduceMotion@State private var port = ""@State private var remotePort = ""@State private var user = ""@State private var chooseKey = false@State private var problem: String?- init(profile: SSHProfile, isNew: Bool, close: @escaping () -> Void) {+ init(profile: SSHProfile, isNew: Bool) {_profile = State(initialValue: profile)self.isNew = isNew- self.close = close_port = State(initialValue: profile.port.map(String.init) ?? "")_remotePort = State(initialValue: String(profile.remotePort))_user = State(initialValue: profile.user ?? "")}var body: some View {+ VStack(spacing: 0) {+ ModalHeader(isNew ? "Add SSH computer" : "Edit SSH computer") {+ IconButton(isNew ? "Add" : "Save", systemImage: "checkmark", action: save)+ .keyboardShortcut(.defaultAction)+ }+ form+ }+ .frame(width: 460)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: problem)+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: profile.identityFile)+ .fileImporter(isPresented: $chooseKey, allowedContentTypes: [.item]) { result in+ if case let .success(url) = result { profile.identityFile = url.path }+ }+ }++ private var form: some View {VStack(alignment: .leading, spacing: 16) {- Text(isNew ? "Add SSH computer" : "Edit SSH computer").font(.title3.bold())CardSection {SSHField("Name", text: $profile.name, prompt: "Optional")SSHField("Host", text: $profile.host, prompt: "SSH alias or hostname")@@ -536,6 +573,7 @@ private struct SSHProfileEditor: View {IconButton("Choose key file", systemImage: "key") { chooseKey = true }if profile.identityFile != nil {IconButton("Use ssh-agent", systemImage: "xmark.circle") { profile.identityFile = nil }+ .transition(.opacity.combined(with: .scale(scale: 0.8)))}}SSHField("Codync port", text: $remotePort, prompt: "")@@ -545,18 +583,11 @@ private struct SSHProfileEditor: View {.fixedSize(horizontal: false, vertical: true)if let problem {Text(problem).font(.caption).foregroundStyle(Palette.danger)+ .transition(.opacity.combined(with: .move(edge: .top)))}- HStack {- Spacer()- Button("Cancel", action: close).buttonStyle(.secondary).keyboardShortcut(.cancelAction)- Button(isNew ? "Add" : "Save", action: save).buttonStyle(.primary).keyboardShortcut(.defaultAction)- }- }- .padding(20)- .frame(width: 460)- .fileImporter(isPresented: $chooseKey, allowedContentTypes: [.item]) { result in- if case let .success(url) = result { profile.identityFile = url.path }}+ .padding([.horizontal, .bottom], 20)+ .padding(.top, 4)}private func save() {@@ -588,7 +619,7 @@ private struct SSHProfileEditor: View {return}if isNew { host.ssh.add(p) } else { host.ssh.update(p) }- close()+ dismiss()}}@@ -597,7 +628,6 @@ private extension View {padding(12).frame(maxWidth: .infinity, alignment: .leading).background(Palette.surface, in: RoundedRectangle(cornerRadius: 12, style: .continuous))- .overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).strokeBorder(Palette.border, lineWidth: 0.5))}}