Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: build marker inside the app archive

ogsamratb78a472f5816
diff --git a/apps/desktop/electron-builder.base.yml b/apps/desktop/electron-builder.base.yml
index 4a1b9a9b..3baf8e29 100644
--- a/apps/desktop/electron-builder.base.yml
+++ b/apps/desktop/electron-builder.base.yml
@@ -14,9 +14,6 @@ extraResources:
to: computer-use/relay.mjs
- from: .electron-runtime/omnirush-sentry.json
to: omnirush-sentry.json
- # The build variant (scripts/stamp-build-variant.mjs, electron/build-variant.mjs).
- - from: .electron-runtime/omnirush-build.json
- to: omnirush-build.json
# Bundled UI-control MCP (scripts/prepare-ui-mcp.mjs). Launched with the app's
# own binary and ELECTRON_RUN_AS_NODE=1; never fetched from a registry.
- from: .electron-runtime/omnirush-ui-mcp
diff --git a/apps/desktop/electron/build-variant.mjs b/apps/desktop/electron/build-variant.mjs
index 682538b4..e1e82bd7 100644
--- a/apps/desktop/electron/build-variant.mjs
+++ b/apps/desktop/electron/build-variant.mjs
@@ -1,8 +1,9 @@
// Which build of the desktop app this is, fixed when it was packaged; nothing
// at runtime (environment, settings) changes it.
//
-// A packaged app reads <resources>/omnirush-build.json, written by
-// scripts/electron-build.mjs: { variant: "release" | "dev", engineSha256 }.
+// A packaged app reads server/omnirush-build.json inside its app.asar (with
+// the server it stamps), written by scripts/electron-build.mjs:
+// { variant: "release" | "dev", engineSha256 }.
// The file missing or unreadable in a packaged app is a release build with no
// engine it may run. An app run from the source tree (electron-dev) is dev.
//
@@ -29,7 +30,7 @@ export function readDesktopBuild({
const packaged = Boolean(resourcesPath) && exists(path.join(resourcesPath, "app.asar"));
if (!packaged) return { variant: "dev", engineSha256: null, packaged: false };
try {
- const value = JSON.parse(read(path.join(resourcesPath, DESKTOP_BUILD_FILE)));
+ const value = JSON.parse(read(path.join(resourcesPath, "app.asar", "server", DESKTOP_BUILD_FILE)));
const engineSha256 = typeof value?.engineSha256 === "string" && /^[0-9a-f]{64}$/.test(value.engineSha256) ? value.engineSha256 : null;
return { variant: value?.variant === "dev" ? "dev" : "release", engineSha256, packaged: true };
} catch {
diff --git a/apps/desktop/electron/build-variant.test.mjs b/apps/desktop/electron/build-variant.test.mjs
index 5c192aa8..4f503594 100644
--- a/apps/desktop/electron/build-variant.test.mjs
+++ b/apps/desktop/electron/build-variant.test.mjs
@@ -20,11 +20,11 @@ test("the build marker: source tree is dev, a packaged app is release unless it
const files = new Map();
const at = { resourcesPath: "/r", exists: (file) => file === "/r/app.asar" || files.has(file), read: (file) => { if (!files.has(file)) throw new Error("missing"); return files.get(file); } };
assert.equal(readDesktopBuild(at).variant, "release");
- files.set("/r/omnirush-build.json", "not json");
+ files.set("/r/app.asar/server/omnirush-build.json", "not json");
assert.equal(readDesktopBuild(at).variant, "release");
- files.set("/r/omnirush-build.json", JSON.stringify({ variant: "dev", engineSha256: null }));
+ files.set("/r/app.asar/server/omnirush-build.json", JSON.stringify({ variant: "dev", engineSha256: null }));
assert.equal(readDesktopBuild(at).variant, "dev");
- files.set("/r/omnirush-build.json", JSON.stringify({ variant: "release", engineSha256: "b".repeat(64) }));
+ files.set("/r/app.asar/server/omnirush-build.json", JSON.stringify({ variant: "release", engineSha256: "b".repeat(64) }));
assert.deepEqual(readDesktopBuild(at), { variant: "release", engineSha256: "b".repeat(64), packaged: true });
});
diff --git a/apps/desktop/scripts/electron-build.mjs b/apps/desktop/scripts/electron-build.mjs
index e28d199b..01eeeafa 100644
--- a/apps/desktop/scripts/electron-build.mjs
+++ b/apps/desktop/scripts/electron-build.mjs
@@ -84,7 +84,8 @@ copyFileSync(resolve(repoRoot, "apps", "server", "package.json"), resolve(packag
const desktopBuild = stampBuildVariant({
sidecarDir: electronSidecarDir,
serverDistDir: resolve(packagedServerRoot, "dist"),
- buildFilePath: resolve(desktopRoot, ".electron-runtime", "omnirush-build.json"),
+ // Inside app.asar, beside the stamped server (electron/build-variant.mjs reads it there).
+ buildFilePath: resolve(packagedServerRoot, "omnirush-build.json"),
});
process.stdout.write(`Desktop build variant: ${desktopBuild.variant}\n`);
for (const fileName of readdirSync(electronRoot).filter((name) => name.endsWith(".mjs")).sort()) {