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.

fix(desktop): take over a host service left by another app copy

leepokai53e13dc64f8d
diff --git a/apps/desktop/src/main/host-controller.ts b/apps/desktop/src/main/host-controller.ts
index 27a72719..d1fd89d1 100644
--- a/apps/desktop/src/main/host-controller.ts
+++ b/apps/desktop/src/main/host-controller.ts
@@ -107,6 +107,9 @@ export class HostController extends EventEmitter {
if (this.uninstalled()) return this.setState({ kind: 'notInstalled' })
return this.install()
}
+ // A service left by another copy of the app (moved, deleted or replaced) can't start this
+ // app's host; the health check only catches that once something answers.
+ if (devPort === null && this.binary && !serviceRuns(this.binary) && !this.uninstalled()) return this.install()
this.connect()
}
@@ -273,6 +276,16 @@ 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 sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
/** Main-process preferences (a small JSON file in the app's data folder). */