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: check for updates from the account menu

leepokai7658fea699f5
diff --git a/apps/linux/src/dialogs.rs b/apps/linux/src/dialogs.rs
index fef2d620..dc8370d4 100644
--- a/apps/linux/src/dialogs.rs
+++ b/apps/linux/src/dialogs.rs
@@ -1174,16 +1174,6 @@ pub fn bot_menu(ui: &App, parent: &gtk::Widget, point: Option<(f64, f64)>, id: &
/// The sidebar's Account panel: usage, this computer and its devices, the mobile app, help.
pub fn account_menu(ui: &App, anchor: &gtk::Button) {
- let usage = {
- let st = ui.state.borrow();
- st.usage["providers"]
- .as_array()
- .into_iter()
- .flatten()
- .flat_map(|p| p["windows"].as_array().into_iter().flatten())
- .filter_map(|w| w["percent"].as_f64())
- .fold(None, |m: Option<f64>, p| Some(m.map_or(p, |m| m.max(p))))
- };
let open = |url: &'static str| -> Box<dyn Fn()> {
Box::new(move || {
gtk::UriLauncher::new(url).launch(
@@ -1193,14 +1183,13 @@ pub fn account_menu(ui: &App, anchor: &gtk::Button) {
);
})
};
- let (ui2, ui3) = (ui.clone(), ui.clone());
+ let (ui2, ui3, ui4) = (ui.clone(), ui.clone(), ui.clone());
let items = vec![
MenuItem::new(
"power-profile-balanced-symbolic",
"Usage",
Box::new(move || usage_sheet(&ui2)),
)
- .detail(usage.map(|u| format!("{u:.0}%")))
.chevron(),
MenuItem::new(
"computer-symbolic",
@@ -1208,6 +1197,13 @@ pub fn account_menu(ui: &App, anchor: &gtk::Button) {
Box::new(move || settings(&ui3)),
)
.chevron(),
+ // Host updates (check, install, automatic) live in Computers & devices.
+ MenuItem::new(
+ "software-update-available-symbolic",
+ "Check for updates",
+ Box::new(move || settings(&ui4)),
+ )
+ .chevron(),
MenuItem::new(
"phone-symbolic",
"Get Codync for mobile",
diff --git a/apps/linux/src/ui.rs b/apps/linux/src/ui.rs
index b50534f6..9b661998 100644
--- a/apps/linux/src/ui.rs
+++ b/apps/linux/src/ui.rs
@@ -2036,7 +2036,6 @@ pub fn toast(ui: &App, text: &str) {
pub struct MenuItem {
icon: &'static str,
title: String,
- detail: Option<String>,
chevron: bool,
destructive: bool,
divider: bool,
@@ -2048,17 +2047,12 @@ impl MenuItem {
Self {
icon,
title: title.to_owned(),
- detail: None,
chevron: false,
destructive: false,
divider: false,
action,
}
}
- pub fn detail(mut self, d: Option<String>) -> Self {
- self.detail = d;
- self
- }
pub fn chevron(mut self) -> Self {
self.chevron = true;
self
@@ -2101,9 +2095,6 @@ pub fn popup_menu(parent: &impl IsA<gtk::Widget>, point: Option<(f64, f64)>, ite
let t = label(&item.title, &[]);
t.set_hexpand(true);
row.append(&t);
- if let Some(d) = &item.detail {
- row.append(&label(d, &["body13", "secondary"]));
- }
if item.chevron {
let c = gtk::Image::from_icon_name("go-next-symbolic");
c.set_pixel_size(11);
diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swift
index 11cf8570..b256f824 100644
--- a/apps/macos/App/CodyncMacApp.swift
+++ b/apps/macos/App/CodyncMacApp.swift
@@ -64,6 +64,7 @@ struct CodyncMacApp: App {
.modalHost()
.environment(host)
.environment(account)
+ .environment(updates)
}
.defaultSize(width: 1100, height: 760)
.windowStyle(.hiddenTitleBar)
diff --git a/apps/macos/App/UpdatesManager.swift b/apps/macos/App/UpdatesManager.swift
index 68a11c89..b864b1df 100644
--- a/apps/macos/App/UpdatesManager.swift
+++ b/apps/macos/App/UpdatesManager.swift
@@ -77,6 +77,10 @@ final class UpdatesManager: NSObject, SPUUpdaterDelegate, @preconcurrency SPUSta
}
func checkForUpdates() {
+ if let pendingInstall {
+ prepareAndContinue(pendingInstall)
+ return
+ }
if let install = automaticInstall {
automaticInstall = nil
idleTask?.cancel()
diff --git a/apps/macos/Views/ChatWindow.swift b/apps/macos/Views/ChatWindow.swift
index 2ea743a0..88054d77 100644
--- a/apps/macos/Views/ChatWindow.swift
+++ b/apps/macos/Views/ChatWindow.swift
@@ -369,6 +369,7 @@ private struct EditTarget: Identifiable {
private struct ChatSplitView: View {
@Environment(HostController.self) private var host
@Environment(AccountSession.self) private var account
+ @Environment(UpdatesManager.self) private var updates
@State private var editing: EditTarget?
@State private var confirmDelete: BotTarget?
@State private var contextBot: BotTarget?
@@ -567,7 +568,7 @@ private struct ChatSplitView: View {
signedIn: account.isSignedIn,
email: account.email,
busy: account.isBusy,
- errorMessage: account.errorMessage,
+ errorMessage: account.errorMessage ?? updates.errorMessage,
onSignIn: { provider in
dismissAccountMenu()
Task {
@@ -587,11 +588,13 @@ private struct ChatSplitView: View {
}
},
compact: compact,
- usage: stores.flatMap(\.usage.providers).flatMap(\.windows).map(\.percent).max(),
approvals: host.approvals.count,
+ updateVersion: updates.availableVersion,
+ canUpdate: updates.canCheckForUpdates || updates.hasStagedUpdate,
onDismiss: dismissAccountMenu,
onUsage: { dismissAccountMenu(); showUsage = true },
onComputers: { dismissAccountMenu(); showComputers = true },
+ onUpdate: { dismissAccountMenu(); updates.checkForUpdates() },
onToggleSidebar: {
dismissAccountMenu()
compact.toggle()
@@ -1007,7 +1010,7 @@ private struct UsageSheet: View {
Label { Text(store.hostName) } icon: { ComputerBadge(store.computer, size: 16) }
.font(.headline)
}
- UsageStrip(usage: store.usage)
+ UsageLimits(usage: store.usage)
}
}
}
@@ -1033,11 +1036,14 @@ private struct SidebarAccountPanel: View {
let onSignIn: (AccountSession.SignInProvider) -> Void
let onSignOut: () -> Void
let compact: Bool
- let usage: Double?
let approvals: Int
+ /// A release Sparkle found, waiting to be installed.
+ let updateVersion: String?
+ let canUpdate: Bool
let onDismiss: () -> Void
let onUsage: () -> Void
let onComputers: () -> Void
+ let onUpdate: () -> Void
let onToggleSidebar: () -> Void
let onSearch: () -> Void
@State private var page = "main"
@@ -1073,13 +1079,15 @@ private struct SidebarAccountPanel: View {
]
default:
return [
- Item(title: "Usage", icon: "gauge.with.dots.needle.33percent",
- detail: usage.map { "\(Int($0.rounded()))%" }, chevron: true, action: onUsage),
+ Item(title: "Usage", icon: "gauge.with.dots.needle.33percent", chevron: true, action: onUsage),
Item(title: "Computers & devices", icon: "desktopcomputer",
detail: approvals > 0 ? "\(approvals)" : nil, chevron: true, action: onComputers),
Item(title: "Get Codync for mobile", icon: "iphone", action: { open("https://apps.apple.com/app/id6760984418") }),
Item(title: "Support", icon: "book.closed", chevron: true, action: { navigate("support") }),
Item(title: "Settings", icon: "gearshape", action: { navigate("settings") }),
+ Item(title: updateVersion.map { "Update to \($0)" } ?? "Check for updates", icon: "arrow.down.circle",
+ detail: updateVersion == nil ? Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String : nil,
+ disabled: !canUpdate, action: onUpdate),
Item(title: compact ? "Expand sidebar" : "Collapse sidebar", icon: "sidebar.left", action: onToggleSidebar)
] + authenticationItems
}
@@ -1131,8 +1139,8 @@ private struct SidebarAccountPanel: View {
}
@ViewBuilder private func menuRow(_ item: Item, index: Int) -> some View {
- if index == (page == "main" ? 5 : 1) { divider }
- if page == "main" && index == 6 { accountIdentity }
+ if index == (page == "main" ? 6 : 1) { divider }
+ if page == "main" && index == 7 { accountIdentity }
AccountPanelRow(title: item.title, icon: item.icon, assetIcon: item.assetIcon, detail: item.detail,
chevron: item.chevron, keyboardFocused: highlighted == index, action: item.action)
.disabled(item.disabled)
diff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.md
index d2fa98a2..ed39fb9e 100644
--- a/docs/design/ui-conventions.md
+++ b/docs/design/ui-conventions.md
@@ -14,15 +14,19 @@ Sources: `apps/ios/Views/BotListView.swift`, `AccountSwitcherView.swift`, `kit/S
## macOS menu bar
-Release update controls live in the native Settings → Updates menu. Sparkle's
-standard update/install windows are a native system-integration exception; keep
+Release update controls live in the native Settings → Updates menu; the chat
+window's account menu repeats the one action (**Check for updates**, which becomes
+**Update to <version>** once a release is found). GTK's account menu opens Host
+updates in Computers & devices 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.
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 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.
-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.
+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; its sheet lists the same per-provider bars (`UsageLimits`).
Source: `apps/macos/App/CodyncMacApp.swift`.
diff --git a/docs/guides/updates.md b/docs/guides/updates.md
index efe43d3a..d0a5cda2 100644
--- a/docs/guides/updates.md
+++ b/docs/guides/updates.md
@@ -4,7 +4,8 @@
Release builds use Sparkle 2.10.0. Open **Settings → Updates** in the menu bar
to check for a release, enable scheduled checks, or opt into automatic downloads
-and installation. Debug builds disable the production updater.
+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
@@ -38,7 +39,9 @@ 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**.
+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
+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.
diff --git a/host/src/tui/app.rs b/host/src/tui/app.rs
index fae9c061..4513aff4 100644
--- a/host/src/tui/app.rs
+++ b/host/src/tui/app.rs
@@ -35,6 +35,7 @@ pub enum After {
Dirs,
Pairing,
Backends,
+ Update,
Saved,
Connectors,
Skills,
@@ -428,12 +429,13 @@ pub enum Action {
RefreshAgents,
Pair,
Usage,
+ CheckUpdate,
Keys,
}
pub const NEW_GROUP: &str = "New group chat";
-pub const ACTIONS: [(&str, &str, Action); 9] = [
+pub const ACTIONS: [(&str, &str, Action); 10] = [
("New bot…", "n", Action::NewBot),
("New group chat…", "m", Action::NewGroup),
("Marketplace: agents, connectors, skills…", "A", Action::Market),
@@ -442,6 +444,7 @@ pub const ACTIONS: [(&str, &str, Action); 9] = [
("Refresh agents", "", Action::RefreshAgents),
("Pair a phone…", "P", Action::Pair),
("Usage", "U", Action::Usage),
+ ("Check for updates", "", Action::CheckUpdate),
("Keys", "?", Action::Keys),
];
@@ -1118,6 +1121,10 @@ impl App {
self.backends = v["backends"].as_array().cloned().unwrap_or_default();
self.flash("Agents refreshed");
}
+ After::Update => match v["state"]["availableVersion"].as_str() {
+ Some(version) => self.flash(&format!("Version {version} is available: run codync-host update")),
+ None => self.flash("The host is up to date."),
+ },
After::Thread => {
for e in v["entries"].as_array().into_iter().flatten() {
if let Some((bot, e)) = Entry::parse(e) {
@@ -1960,6 +1967,7 @@ impl App {
Action::RefreshAgents => self.call("refreshBackends", json!({}), After::Backends),
Action::Pair => self.open_pair(),
Action::Usage => self.overlays.push(Overlay::Usage),
+ Action::CheckUpdate => self.call("checkHostUpdate", json!({}), After::Update),
Action::Keys => self.overlays.push(Overlay::Help(Editor::default())),
}
}
diff --git a/kit/Sources/CodyncKit/Design/UsageBar.swift b/kit/Sources/CodyncKit/Design/UsageBar.swift
index e39faab7..0b92e039 100644
--- a/kit/Sources/CodyncKit/Design/UsageBar.swift
+++ b/kit/Sources/CodyncKit/Design/UsageBar.swift
@@ -31,10 +31,13 @@ public extension Palette {
public struct UsageBar: View {
let percent: Double
let height: CGFloat
+ let tint: Color?
- public init(percent: Double, height: CGFloat = 6) {
+ /// `tint` is the provider's color below 70%; amber and red still take over above.
+ public init(percent: Double, height: CGFloat = 6, tint: Color? = nil) {
self.percent = percent
self.height = height
+ self.tint = tint
}
public var body: some View {
@@ -42,7 +45,7 @@ public struct UsageBar: View {
ZStack(alignment: .leading) {
Capsule().fill(Palette.bubbleAgent)
Capsule()
- .fill(Palette.usageFill(percent))
+ .fill(percent < 70 ? tint ?? Palette.usageFill(percent) : Palette.usageFill(percent))
.frame(width: geo.size.width * min(1, max(0.02, percent / 100)))
}
}
diff --git a/kit/Sources/CodyncUI/Usage/UsageViews.swift b/kit/Sources/CodyncUI/Usage/UsageViews.swift
index b0ae8e5c..be10c5d6 100644
--- a/kit/Sources/CodyncUI/Usage/UsageViews.swift
+++ b/kit/Sources/CodyncUI/Usage/UsageViews.swift
@@ -1,49 +1,38 @@
import CodyncKit
import SwiftUI
-/// Compact usage chips at the top of the roster.
-public struct UsageStrip: View {
+/// Every limit as a bar under its provider, the way the menu bar lists them.
+public struct UsageLimits: View {
let usage: Usage
+ @AppStorage(SharedStore.usageIconStyleKey, store: UserDefaults(suiteName: SharedStore.appGroup))
+ private var usageIconStyle = UsageIconStyle.character.rawValue
public init(usage: Usage) { self.usage = usage }
public var body: some View {
- ScrollView(.horizontal, showsIndicators: false) {
- HStack(spacing: 8) {
- ForEach(usage.providers) { p in
- ForEach(p.windows.prefix(2)) { w in
- HStack(spacing: 6) {
- AgentIcon(registry: p.registry, size: 14)
- UsageRing(percent: w.percent)
- VStack(alignment: .leading, spacing: 0) {
- Text(w.title).font(.caption2).foregroundStyle(Palette.tertiary)
- Text("\(Int(w.percent.rounded()))%").font(.caption.bold().monospacedDigit()).foregroundStyle(Palette.text)
- }
+ VStack(alignment: .leading, spacing: 18) {
+ ForEach(usage.providers) { provider in
+ VStack(alignment: .leading, spacing: 10) {
+ HStack(spacing: 8) {
+ ProviderMascot(provider, size: 18, style: UsageIconStyle(rawValue: usageIconStyle) ?? .character)
+ Text(provider.name).font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text)
+ }
+ ForEach(provider.windows) { window in
+ HStack(spacing: 10) {
+ Text(window.title).foregroundStyle(Palette.text)
+ .frame(width: 64, alignment: .leading)
+ UsageBar(percent: window.percent, tint: provider.tint)
+ Text("\(Int(window.percent.rounded()))%").monospacedDigit().foregroundStyle(Palette.text)
+ .frame(width: 36, alignment: .trailing)
+ Text(window.resetDescription ?? "").foregroundStyle(Palette.secondary)
+ .frame(width: 130, alignment: .trailing)
}
- .padding(.horizontal, 10)
- .padding(.vertical, 6)
- .background(Palette.surface, in: Capsule())
+ .font(.system(size: 12))
+ .lineLimit(1)
+ .accessibilityElement(children: .combine)
}
}
}
}
}
}
-
-/// A small capacity ring: the replacement for the circular `Gauge`.
-private struct UsageRing: View {
- let percent: Double
-
- var body: some View {
- ZStack {
- Circle().stroke(Palette.text.opacity(0.1), lineWidth: 2.5)
- Circle()
- .trim(from: 0, to: min(max(percent, 0), 100) / 100)
- .stroke(Palette.usageTint(percent), style: StrokeStyle(lineWidth: 2.5, lineCap: .round))
- .rotationEffect(.degrees(-90))
- }
- .frame(width: 16, height: 16)
- .frame(width: 22, height: 22)
- .accessibilityHidden(true)
- }
-}