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(desktop): ship a Windows app

leepokai465aac8b3a8c
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index e13c54f1..f3511b5b 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -1,6 +1,6 @@
name: Release desktop
-# The Electron app (apps/desktop) for macOS and Linux. A v* tag publishes it; anything else is a
+# The Electron app (apps/desktop) for macOS, Linux and Windows. A v* tag publishes it; anything else is a
# dry run that builds, signs and notarizes but publishes nothing.
on:
push:
@@ -158,6 +158,57 @@ jobs:
git commit -m "Update Codync to $VERSION" || exit 0
git push
+ windows:
+ needs: check
+ runs-on: windows-latest
+ defaults:
+ run:
+ shell: bash
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 24
+ cache: npm
+ cache-dependency-path: apps/desktop/package-lock.json
+ - name: Install Rust (rust-toolchain.toml)
+ run: rustup toolchain install
+ - uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: host
+ - name: Build
+ working-directory: apps/desktop
+ # Unsigned for now: SmartScreen warns on first launch until the app has a code signing certificate.
+ run: |
+ npm ci
+ npm run dist:win:main -- --publish never
+ cd dist
+ shasum -a 256 codync-windows-x64.exe > codync-windows-x64.exe.sha256
+ - name: Smoke test the bundled host
+ working-directory: apps/desktop/dist/win-unpacked/resources
+ run: |
+ ./codync-host.exe --version
+ CODYNC_HOME="$RUNNER_TEMP/codync" ./codync-host.exe serve --port 19333 &
+ for i in $(seq 1 30); do curl -sf http://127.0.0.1:19333/health && break; sleep 1; done
+ curl -sf http://127.0.0.1:19333/health | grep -q computerId
+ TOKEN=$(cat "$RUNNER_TEMP/codync/token")
+ curl -sf -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{}' http://127.0.0.1:19333/api/refreshBackends
+ - uses: actions/upload-artifact@v4
+ if: "!startsWith(github.ref, 'refs/tags/')"
+ with:
+ name: codync-windows-x64
+ path: |
+ apps/desktop/dist/codync-windows-x64.exe
+ apps/desktop/dist/latest.yml
+ - uses: softprops/action-gh-release@v2
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: |
+ apps/desktop/dist/codync-windows-x64.exe
+ apps/desktop/dist/codync-windows-x64.exe.sha256
+ apps/desktop/dist/codync-windows-x64.exe.blockmap
+ apps/desktop/dist/latest.yml
+
linux:
needs: check
strategy:
diff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.yml
index b9767912..c6f2f52f 100644
--- a/apps/desktop/electron-builder.yml
+++ b/apps/desktop/electron-builder.yml
@@ -1,6 +1,7 @@
-# Packaging for macOS (DMG + zip for updates) and Linux (AppImage, deb, tar.gz).
+# Packaging for macOS (DMG + zip for updates), Linux (AppImage, deb, tar.gz) and Windows (NSIS).
# CI puts the native pieces in place first (see .github/workflows/release-desktop.yml):
# build/native/codync-host the host for this platform (macOS: universal)
+# build/native/codync-host.exe Windows: the host, and codync-hostw.exe that runs it at sign-in
# build/native/codync-speech macOS on-device speech helper
# build/native/CodyncScreen.app macOS screen helper (Xcode `Screen` target)
appId: com.pokai.Codync
@@ -79,3 +80,23 @@ linux:
desktop:
entry:
StartupWMClass: Codync
+
+win:
+ icon: resources/icon.png
+ target:
+ - target: nsis
+ arch: x64
+ artifactName: codync-windows-x64.${ext}
+ # The host ships inside the app, as on macOS: a per-user install keeps its path stable for
+ # the sign-in entry that starts it.
+ extraResources:
+ - from: build/native/codync-host.exe
+ to: codync-host.exe
+ - from: build/native/codync-hostw.exe
+ to: codync-hostw.exe
+ # The tray icon (template glyphs are for macOS).
+ - from: resources/icon.png
+ to: icon.png
+nsis:
+ oneClick: true
+ perMachine: false
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index dd67d8ab..e3e436c6 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -2,7 +2,7 @@
"name": "codync-desktop",
"productName": "Codync",
"version": "2.8.0",
- "description": "Codync for macOS and Linux: your coding agents as teammates.",
+ "description": "Codync for macOS, Linux and Windows: your coding agents as teammates.",
"author": {
"name": "leepokai",
"email": "[email protected]"
@@ -21,7 +21,9 @@
"dist:mac:dev": "node tools/account-config.mjs dev && node tools/native-host.mjs dev && node tools/native-screen.mjs && electron-vite build && CSC_NAME=\"Pokai Lee (6KFK5J2LB4)\" electron-builder --mac",
"dist:mac:main": "node tools/account-config.mjs main && node tools/native-host.mjs main && node tools/native-screen.mjs && electron-vite build && electron-builder --mac",
"dist:linux:dev": "node tools/account-config.mjs dev && electron-vite build && electron-builder --linux",
- "dist:linux:main": "node tools/account-config.mjs main && electron-vite build && electron-builder --linux"
+ "dist:linux:main": "node tools/account-config.mjs main && electron-vite build && electron-builder --linux",
+ "dist:win:dev": "node tools/account-config.mjs dev && node tools/native-host.mjs dev && electron-vite build && electron-builder --win",
+ "dist:win:main": "node tools/account-config.mjs main && node tools/native-host.mjs main && electron-vite build && electron-builder --win"
},
"devDependencies": {
"@types/node": "^24.0.0",
diff --git a/apps/desktop/resources/installer.nsh b/apps/desktop/resources/installer.nsh
new file mode 100644
index 00000000..f1520a46
--- /dev/null
+++ b/apps/desktop/resources/installer.nsh
@@ -0,0 +1,7 @@
+; Removing Codync takes its background host with it (the sign-in entry and the running host).
+; An update reinstalls over the old version, and the new app starts the host again itself.
+!macro customUnInstall
+ ${ifNot} ${isUpdated}
+ ExecWait '"$INSTDIR\resources\codync-host.exe" uninstall'
+ ${endIf}
+!macroend
diff --git a/apps/desktop/src/main/host-controller.ts b/apps/desktop/src/main/host-controller.ts
index b877dafc..b9c62ae7 100644
--- a/apps/desktop/src/main/host-controller.ts
+++ b/apps/desktop/src/main/host-controller.ts
@@ -1,4 +1,4 @@
-import { execFile } from 'node:child_process'
+import { execFile, execFileSync } from 'node:child_process'
import { createHash } from 'node:crypto'
import { EventEmitter } from 'node:events'
import { existsSync, promises as fs, readFileSync, realpathSync } from 'node:fs'
@@ -34,7 +34,7 @@ export async function fetchHealth(url = baseURL, timeoutMs = 2000): Promise<Heal
export function run(bin: string, args: string[]): Promise<{ status: number; output: string }> {
return new Promise((resolve) => {
- execFile(bin, args, { maxBuffer: 8 * 1024 * 1024 }, (error, stdout, stderr) => {
+ execFile(bin, args, { maxBuffer: 8 * 1024 * 1024, windowsHide: true }, (error, stdout, stderr) => {
const status = error ? (typeof error.code === 'number' ? error.code : 1) : 0
resolve({ status, output: `${stdout}${stderr}`.trim() })
})
@@ -42,11 +42,28 @@ export function run(bin: string, args: string[]): Promise<{ status: number; outp
}
const isMac = platform() === 'darwin'
+const isWindows = platform() === 'win32'
+/** macOS and Windows ship the host inside the app; Linux uses the installed one. */
+export const bundlesHost = isMac || isWindows
-/** The service definition `codync-host install` writes. */
-const serviceFile = isMac
- ? join(homedir(), 'Library/LaunchAgents/com.pokai.codync.host.plist')
- : join(homedir(), '.config/systemd/user/codync-host.service')
+/** The service definition `codync-host install` wrote (`null`: not installed). */
+function serviceDefinition(): string | null {
+ try {
+ if (isWindows) {
+ // The per-user Run key that starts the host at sign-in.
+ const key = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run'
+ return execFileSync('reg', ['query', key, '/v', 'CodyncHost'], { encoding: 'utf8', windowsHide: true })
+ }
+ const file = isMac
+ ? join(homedir(), 'Library/LaunchAgents/com.pokai.codync.host.plist')
+ : join(homedir(), '.config/systemd/user/codync-host.service')
+ return readFileSync(file, 'utf8')
+ } catch {
+ return null
+ }
+}
+
+const serviceInstalled = () => serviceDefinition() !== null
/**
* Manages the local codync-host (binary, background service, health) the way the native
@@ -66,6 +83,7 @@ export class HostController extends EventEmitter {
get binary(): string | null {
const candidates = [
app.isPackaged && isMac ? join(process.resourcesPath, 'codync-host') : null,
+ app.isPackaged && isWindows ? join(process.resourcesPath, 'codync-host.exe') : null,
process.env.CODYNC_HOST_BIN ?? null,
join(homedir(), '.local/bin/codync-host'),
'/opt/homebrew/bin/codync-host',
@@ -101,8 +119,8 @@ export class HostController extends EventEmitter {
async refresh() {
if (this.preparingForUpdate) return
if (!this.binary && devPort === null) return this.setState({ kind: 'missingBinary' })
- if (devPort === null && prefs.get('hostRestartAfterAppUpdate') === true && existsSync(serviceFile)) return this.install()
- if (devPort === null && !existsSync(serviceFile)) {
+ if (devPort === null && prefs.get('hostRestartAfterAppUpdate') === true && serviceInstalled()) return this.install()
+ if (devPort === null && !serviceInstalled()) {
// The app is the way to run the host: set it up right away, unless the user took it out.
if (this.uninstalled()) return this.setState({ kind: 'notInstalled' })
return this.install()
@@ -169,14 +187,14 @@ export class HostController extends EventEmitter {
/**
* Stops the service before the app replaces itself; `resumeAfterCancelledUpdate` undoes it.
- * macOS only: there the host runs from inside the app. Linux uses the installed host, which an
- * app update leaves alone.
+ * macOS and Windows: there the host runs from inside the app (and Windows can't replace a
+ * running program). Linux uses the installed host, which an app update leaves alone.
*/
async prepareForUpdate() {
- if (devPort !== null || !isMac) return
+ if (devPort !== null || !bundlesHost) return
if (this.installing) throw new Error('The host is being installed. Try again when it finishes.')
this.preparingForUpdate = true
- if (existsSync(serviceFile)) prefs.set('hostRestartAfterAppUpdate', true)
+ if (serviceInstalled()) prefs.set('hostRestartAfterAppUpdate', true)
this.stopLoop()
unregisterScreenAgent()
const bin = this.binary
@@ -188,13 +206,13 @@ export class HostController extends EventEmitter {
resumeAfterCancelledUpdate() {
if (!this.preparingForUpdate) return
this.preparingForUpdate = false
- if (existsSync(serviceFile)) void this.install()
+ if (serviceInstalled()) void this.install()
else void this.refresh()
}
async isIdleForUpdate(): Promise<boolean> {
if (this.installing || this.preparingForUpdate || devPort !== null) return false
- if (!existsSync(serviceFile)) return true
+ if (!serviceInstalled()) return true
const health = await fetchHealth()
return health?.busy === false
}
@@ -282,12 +300,11 @@ function resolved(path: string) {
/** Whether the installed service starts this binary. */
function serviceRuns(bin: string) {
- try {
- const service = readFileSync(serviceFile, 'utf8')
- return service.includes(bin) || service.includes(resolved(bin))
- } catch {
- return false
- }
+ const service = serviceDefinition()
+ if (service === null) return false
+ // Windows' service starts the launcher next to the host (codync-hostw.exe).
+ const runs = (path: string) => service.includes(isWindows ? path.replace(/codync-host\.exe$/, 'codync-hostw.exe') : path)
+ return runs(bin) || runs(resolved(bin))
}
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
diff --git a/apps/desktop/src/main/tray.ts b/apps/desktop/src/main/tray.ts
index 500db553..5bc4172d 100644
--- a/apps/desktop/src/main/tray.ts
+++ b/apps/desktop/src/main/tray.ts
@@ -25,10 +25,14 @@ export class Tray {
constructor(private deps: Deps) {
this.tray = new ElectronTray(this.icon(false))
this.tray.setToolTip('Codync')
+ // Windows opens a tray icon's menu on right-click; a left-click opens the chat.
+ if (process.platform === 'win32') this.tray.on('click', () => this.deps.openChat())
this.rebuild()
}
private icon(alert: boolean) {
+ // Black template glyphs vanish on Windows' dark taskbar: the app icon reads on either theme.
+ if (process.platform === 'win32') return nativeImage.createFromPath(join(resources(), 'icon.png')).resize({ width: 16, height: 16 })
const image = nativeImage.createFromPath(join(resources(), 'tray', alert ? 'trayAlertTemplate.png' : 'trayTemplate.png'))
image.setTemplateImage(true)
return image
diff --git a/apps/desktop/src/renderer/store/cloud.ts b/apps/desktop/src/renderer/store/cloud.ts
index 96c29773..9ba47e92 100644
--- a/apps/desktop/src/renderer/store/cloud.ts
+++ b/apps/desktop/src/renderer/store/cloud.ts
@@ -288,5 +288,5 @@ export class CloudModel extends Observable {
/** This computer's name for the account's device list. */
async function deviceName() {
- return window.codync.computerName || (window.codync.platform === 'darwin' ? 'Mac' : 'Linux')
+ return window.codync.computerName || { darwin: 'Mac', linux: 'Linux', win32: 'Windows' }[window.codync.platform]
}
diff --git a/apps/desktop/src/renderer/views/UpdateNeededCard.tsx b/apps/desktop/src/renderer/views/UpdateNeededCard.tsx
index e08ea0aa..5c53eeb1 100644
--- a/apps/desktop/src/renderer/views/UpdateNeededCard.tsx
+++ b/apps/desktop/src/renderer/views/UpdateNeededCard.tsx
@@ -32,12 +32,12 @@ export function UpdateNeededCard() {
const store = useStore()
const mismatch = store.mismatch
if (!mismatch) return null
- // This app updates itself; on macOS this computer's own host is put back on the app's bundled
- // copy. Linux has no bundled host, so the card says how to update it instead.
+ // This app updates itself; on macOS and Windows this computer's own host is put back on the
+ // app's bundled copy. Linux has no bundled host, so the card says how to update it instead.
const action: [string, () => void] | null =
mismatch.kind === 'updateApp'
? ['Update Codync', () => window.codync.updates.check()]
- : store === app.local && !app.host.dev && window.codync.platform === 'darwin'
+ : store === app.local && !app.host.dev && window.codync.platform !== 'linux'
? [`Update ${store.hostName}`, () => window.codync.host.restart()]
: null
return (
diff --git a/apps/desktop/src/renderer/views/call/voice.ts b/apps/desktop/src/renderer/views/call/voice.ts
index 6bada123..3906e557 100644
--- a/apps/desktop/src/renderer/views/call/voice.ts
+++ b/apps/desktop/src/renderer/views/call/voice.ts
@@ -27,7 +27,9 @@ export const SPEECH_CHUNK: Record<VoiceProvider, number> = { openai: 600, gemini
/** Recognition through the Swift helper: macOS only. */
export const onDeviceAvailable = () => window.codync.speech.available
export const onDeviceUnavailableReason = () =>
- window.codync.platform === 'darwin' ? "On-device speech isn't available in this build." : "On-device speech isn't available on Linux."
+ window.codync.platform === 'darwin'
+ ? "On-device speech isn't available in this build."
+ : `On-device speech isn't available on ${window.codync.platform === 'win32' ? 'Windows' : 'Linux'}.`
export const VoiceSettings = {
/** The provider picked in the call settings; null for on-device. */
diff --git a/apps/desktop/tools/native-host.mjs b/apps/desktop/tools/native-host.mjs
index 7b3b8012..30226cfc 100644
--- a/apps/desktop/tools/native-host.mjs
+++ b/apps/desktop/tools/native-host.mjs
@@ -1,24 +1,33 @@
-// Builds the host the Mac app bundles (build/native/codync-host, universal) for the same
-// environment as the app: node tools/native-host.mjs dev|main compiles it in as CODYNC_ENV.
-// Built on every package so a host made for another environment is never shipped. Linux apps
-// use the installed host, so there's nothing to do there.
+// Builds the host the app bundles for the same environment as the app: node tools/native-host.mjs
+// dev|main compiles it in as CODYNC_ENV. Built on every package so a host made for another
+// environment is never shipped. macOS: build/native/codync-host (universal). Windows:
+// build/native/codync-host.exe and codync-hostw.exe (runs it at sign-in). Linux apps use the
+// installed host, so there's nothing to do there.
+import { copyFileSync, mkdirSync } from 'node:fs'
import { execFileSync } from 'node:child_process'
-import { mkdirSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
-if (process.platform !== 'darwin') process.exit(0)
+if (!['darwin', 'win32'].includes(process.platform)) process.exit(0)
const env = process.argv[2]
if (!['dev', 'main'].includes(env)) throw new Error(`unknown environment ${env}`)
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
const host = join(root, '../../host')
-const targets = ['aarch64-apple-darwin', 'x86_64-apple-darwin']
+const out = join(root, 'build/native')
// The pinned toolchain (rust-toolchain.toml) through rustup, even when another cargo (Homebrew's)
// comes first on PATH: only rustup's has the x86_64 target.
const tool = (name) => execFileSync('rustup', ['which', name], { cwd: host, encoding: 'utf8' }).trim()
const [cargo, rustc] = [tool('cargo'), tool('rustc')]
const run = (cmd, args) => execFileSync(cmd, args, { stdio: 'inherit', env: { ...process.env, CODYNC_ENV: env, RUSTC: rustc } })
-for (const target of targets) run(cargo,['build', '--release', '--manifest-path', join(host, 'Cargo.toml'), '--target', target])
-mkdirSync(join(root, 'build/native'), { recursive: true })
-run('lipo', ['-create', '-output', join(root, 'build/native/codync-host'), ...targets.map((t) => join(host, 'target', t, 'release/codync-host'))])
+const build = (target) => run(cargo, ['build', '--release', '--manifest-path', join(host, 'Cargo.toml'), '--target', target])
+mkdirSync(out, { recursive: true })
+if (process.platform === 'win32') {
+ const target = 'x86_64-pc-windows-msvc'
+ build(target)
+ for (const exe of ['codync-host.exe', 'codync-hostw.exe']) copyFileSync(join(host, 'target', target, 'release', exe), join(out, exe))
+} else {
+ const targets = ['aarch64-apple-darwin', 'x86_64-apple-darwin']
+ for (const target of targets) build(target)
+ run('lipo', ['-create', '-output', join(out, 'codync-host'), ...targets.map((t) => join(host, 'target', t, 'release/codync-host'))])
+}
console.log(`host: ${env}`)