feat(desktop): auto-update via electron-updater (v0.3.0)

Wires electron-updater so Fleet Runner checks for new releases on launch
and downloads them in the background. Users on v0.3.0+ never have to
manually re-download — the next-launch upgrade prompt takes care of it.

Implementation:
- Adds electron-updater@^6.8.3 to desktop deps.
- main.ts: setFeedURL points at maonakamoto/fleetcrown-releases (the
  canonical public host) regardless of where electron-builder publishes
  the build. This decouples the build pipeline's draft target from the
  user-visible update channel — the mirror script in
  scripts/mirror-desktop-release.sh reconciles them.
- checkForUpdatesAndNotify() fires once at boot, disabled in dev to avoid
  interfering with the local Electron cycle.
- Listener on 'update-downloaded' surfaces an OS notification "Update
  downloaded — restart Fleet Runner to apply it." The actual install is
  staged automatically via autoInstallOnAppQuit.

Caveat: existing v0.2.0 users still need one manual download to v0.3.0
(their binaries don't know about the new feed URL). From v0.3.0 onward,
every subsequent release auto-propagates.

Marketing copy (setup step 02) updated to mention the auto-update flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mao NakamotoandClaude Opus 4.7 committed 2026-06-03 15:03:09 +02:00
1 parent ab8cf87e4a
commit deca859893
6 files changed
+172 -80

No files matched your search

+98 -7
View File
@@ -8,6 +8,9 @@
"name": "fleet-runner",
"version": "0.2.0",
"hasInstallScript": true,
"dependencies": {
"electron-updater": "^6.8.3"
},
"devDependencies": {
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/tsconfig": "^1.0.1",
@@ -2433,7 +2436,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true,
"license": "Python-2.0"
},
"node_modules/assert-plus": {
@@ -3376,7 +3378,6 @@
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
@@ -3865,6 +3866,82 @@
"dev": true,
"license": "ISC"
},
"node_modules/electron-updater": {
"version": "6.8.3",
"resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.8.3.tgz",
"integrity": "sha512-Z6sgw3jgbikWKXei1ENdqFOxBP0WlXg3TtKfz0rgw2vIZFJUyI4pD7ZN7jrkm7EoMK+tcm/qTnPUdqfZukBlBQ==",
"license": "MIT",
"dependencies": {
"builder-util-runtime": "9.5.1",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.5",
"lodash.escaperegexp": "^4.1.2",
"lodash.isequal": "^4.5.0",
"semver": "~7.7.3",
"tiny-typed-emitter": "^2.1.0"
}
},
"node_modules/electron-updater/node_modules/builder-util-runtime": {
"version": "9.5.1",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.5.1.tgz",
"integrity": "sha512-qt41tMfgHTllhResqM5DcnHyDIWNgzHvuY2jDcYP9iaGpkWxTUzV6GQjDeLnlR1/DtdlcsWQbA7sByMpmJFTLQ==",
"license": "MIT",
"dependencies": {
"debug": "^4.3.4",
"sax": "^1.2.4"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/electron-updater/node_modules/fs-extra": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/electron-updater/node_modules/jsonfile": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",
"integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",
"license": "MIT",
"dependencies": {
"universalify": "^2.0.0"
},
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/electron-updater/node_modules/semver": {
"version": "7.7.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/electron-updater/node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
"license": "MIT",
"engines": {
"node": ">= 10.0.0"
}
},
"node_modules/electron-vite": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/electron-vite/-/electron-vite-2.3.0.tgz",
@@ -4611,7 +4688,6 @@
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"dev": true,
"license": "ISC"
},
"node_modules/has-flag": {
@@ -5077,7 +5153,6 @@
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz",
"integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==",
"dev": true,
"funding": [
{
"type": "github",
@@ -5168,7 +5243,6 @@
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz",
"integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==",
"dev": true,
"license": "MIT"
},
"node_modules/lilconfig": {
@@ -5198,6 +5272,19 @@
"dev": true,
"license": "MIT"
},
"node_modules/lodash.escaperegexp": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz",
"integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==",
"license": "MIT"
},
"node_modules/lodash.isequal": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
"deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.",
"license": "MIT"
},
"node_modules/log-symbols": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
@@ -5583,7 +5670,6 @@
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true,
"license": "MIT"
},
"node_modules/mz": {
@@ -6642,7 +6728,6 @@
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",
"integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==",
"dev": true,
"license": "BlueOak-1.0.0",
"engines": {
"node": ">=11.0.0"
@@ -7171,6 +7256,12 @@
"node": ">=0.8"
}
},
"node_modules/tiny-typed-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz",
"integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==",
"license": "MIT"
},
"node_modules/tinyglobby": {
"version": "0.2.17",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
+23 -7
View File
@@ -1,6 +1,6 @@
{
"name": "fleet-runner",
"version": "0.2.0",
"version": "0.3.0",
"description": "Fleet Runner — the local authoritative desktop application for the FleetCrown AI agent fleet platform.",
"main": "./out/main/index.js",
"author": {
@@ -34,22 +34,36 @@
"package.json"
],
"extraResources": [
{ "from": "resources", "to": "." }
{
"from": "resources",
"to": "."
}
],
"mac": {
"category": "public.app-category.developer-tools",
"icon": "resources/icon.png",
"target": ["dmg", "zip"]
"target": [
"dmg",
"zip"
]
},
"win": {
"icon": "resources/icon.png",
"target": [
{ "target": "nsis", "arch": ["x64"] }
{
"target": "nsis",
"arch": [
"x64"
]
}
]
},
"linux": {
"icon": "resources/icon.png",
"target": ["AppImage", "deb"],
"target": [
"AppImage",
"deb"
],
"category": "Development"
},
"publish": {
@@ -58,7 +72,9 @@
"repo": "fleetcrown"
}
},
"dependencies": {},
"dependencies": {
"electron-updater": "^6.8.3"
},
"devDependencies": {
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/tsconfig": "^1.0.1",
@@ -78,4 +94,4 @@
"typescript": "^5",
"vite": "^6.0.7"
}
}
}
+50
View File
@@ -1,4 +1,5 @@
import { app, BrowserWindow, ipcMain, Tray, Menu, nativeImage, Notification, session } from 'electron'
import { autoUpdater } from 'electron-updater'
import { join } from 'path'
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import { getLocalRuntimeStatus, getProjects, dispatchIntent, getCurrentState } from './runtime'
@@ -394,6 +395,55 @@ app.whenReady().then(() => {
if (tray) tray.setToolTip(formatTrayTooltip(getPollerStatus()))
}, 5_000)
// Auto-update — read latest-<platform>.yml from the canonical public
// release host (maonakamoto/fleetcrown-releases). We override the feed URL
// explicitly instead of relying on desktop/package.json's publish.repo
// because electron-builder's build pipeline targets a different repo
// (maonakamoto/fleetcrown) than where users actually download from. The
// mirror script reconciles those.
//
// Behavior: silent background check on launch, downloads the newer
// installer in the background if one exists, surfaces a "ready to install"
// notification when complete. The user keeps using the current version
// until they relaunch.
//
// Disabled in dev (would interfere with the local Electron dev cycle) and
// when the renderer is in web-shell mode pointed at a non-prod URL
// (FLEETCROWN_WEB_URL override) — those builds aren't the public binary.
if (!is.dev) {
try {
autoUpdater.autoDownload = true
autoUpdater.autoInstallOnAppQuit = true
autoUpdater.setFeedURL({
provider: 'github',
owner: 'maonakamoto',
repo: 'fleetcrown-releases',
})
autoUpdater.on('error', (err) => {
console.warn('[desktop] auto-update error:', err?.message ?? err)
})
autoUpdater.on('update-available', (info) => {
console.log(`[desktop] auto-update: ${info.version} available (current ${app.getVersion()})`)
})
autoUpdater.on('update-downloaded', (info) => {
console.log(`[desktop] auto-update: ${info.version} downloaded — will install on next quit`)
if (Notification.isSupported()) {
new Notification({
title: `Fleet Runner ${info.version} ready`,
body: 'Update downloaded — restart Fleet Runner to apply it.',
silent: true,
...(APP_ICON_PATH ? { icon: APP_ICON_PATH } : {}),
}).show()
}
})
// Fire-and-forget — failures end up on the 'error' listener above.
void autoUpdater.checkForUpdatesAndNotify()
console.log('[desktop] auto-update check kicked off (fleetcrown-releases)')
} catch (e) {
console.warn('[desktop] auto-update setup failed:', (e as Error).message)
}
}
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
-17
View File
@@ -1,17 +0,0 @@
import type { LucideIcon } from "lucide-react";
export function PlaceholderView({
icon: Icon,
title,
}: {
icon: LucideIcon;
title: string;
}) {
return (
<div className="ui-empty-page h-full text-text-tertiary gap-4">
<Icon className="h-16 w-16" />
<div className="text-xl font-semibold">{title}</div>
<div className="text-sm">Coming in Phase 2</div>
</div>
);
}
-48
View File
@@ -1,48 +0,0 @@
"use client";
import { useEffect, useState } from "react";
import { Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
import { cn } from "@/lib/utils";
export function ThemeToggle({
compact = false,
}: {
compact?: boolean;
}) {
const { resolvedTheme, setTheme } = useTheme();
const [mounted, setMounted] = useState(false);
// eslint-disable-next-line react-hooks/set-state-in-effect -- standard next-themes SSR hydration guard
useEffect(() => setMounted(true), []);
// Render stable placeholder until mounted to avoid SSR/client mismatch
if (!mounted) {
return (
<span
className={cn(
"inline-flex items-center rounded-2xl border border-border-subtle bg-surface-base/80",
compact ? "h-10 w-10 justify-center" : "h-11 w-full px-4",
)}
/>
);
}
const isDark = resolvedTheme !== "light";
const label = isDark ? "Light mode" : "Dark mode";
return (
<button
type="button"
aria-label={isDark ? "Switch to light mode" : "Switch to dark mode"}
title={isDark ? "Switch to light mode" : "Switch to dark mode"}
onClick={() => setTheme(isDark ? "light" : "dark")}
className={cn(
"inline-flex items-center rounded-2xl border border-border-subtle bg-surface-base/80 text-text-secondary transition hover:bg-surface-raised hover:text-text-primary",
compact ? "h-10 w-10 justify-center" : "h-11 w-full justify-between px-4",
)}
>
{isDark ? <Sun className="h-4 w-4" /> : <Moon className="h-4 w-4" />}
{!compact && <span className="text-sm font-medium text-text-secondary">{label}</span>}
</button>
);
}
+1 -1
View File
@@ -336,7 +336,7 @@ export const DESKTOP_DOWNLOAD = {
number: "02",
title: "Sign in — once",
body:
"Use the same FleetCrown account you signed up with on the web. The desktop app opens straight to your dashboard. From the web, you can also click \"Open in Fleet Runner\" to log the desktop app in without copy-pasting a token.",
"Use the same FleetCrown account you signed up with on the web. The desktop app opens straight to your dashboard. From the web, you can also click \"Open in Fleet Runner\" to log the desktop app in without copy-pasting a token. From v0.3.0 onward, Fleet Runner checks for updates on launch and downloads them in the background — you'll never have to manually re-download.",
},
{
number: "03",