Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: the packaged app ships the claude provider files as they are

ogsamrat9c28874a8240
diff --git a/apps/desktop/electron-builder.base.yml b/apps/desktop/electron-builder.base.yml
index 3ebacff5..a960826e 100644
--- a/apps/desktop/electron-builder.base.yml
+++ b/apps/desktop/electron-builder.base.yml
@@ -27,8 +27,10 @@ extraResources:
filter:
- "*.js"
- "*.wasm"
- # The Claude provider is a folder (the engine loads claude-provider/index.js).
- - "claude-provider/*.js"
+ # The Claude provider is a folder (the engine loads claude-provider/index.js), its source files as they are.
+ - "claude-provider/index.js"
+ - "claude-provider/map.js"
+ - "claude-provider/PARITY.sha256"
- from: ../../packages/docs
to: omnirush-docs
filter:
diff --git a/apps/desktop/electron/omnirush-ui-mcp.test.mjs b/apps/desktop/electron/omnirush-ui-mcp.test.mjs
index b344e01b..e111d87d 100644
--- a/apps/desktop/electron/omnirush-ui-mcp.test.mjs
+++ b/apps/desktop/electron/omnirush-ui-mcp.test.mjs
@@ -154,6 +154,16 @@ describe("bundled UI-control MCP packaging", () => {
const archive = path.join(resources, "app.asar");
await asar.createPackage(appSource, archive);
const verifier = path.join(desktopRoot, "scripts", "verify-packaged-imports.mjs");
+ // The Claude provider beside the archive, as the build ships it; a changed file fails the build too.
+ const providerSource = path.join(desktopRoot, "..", "server", "src", "opencode-plugins", "claude-provider");
+ const provider = path.join(resources, "opencode-plugins", "claude-provider");
+ mkdirSync(provider, { recursive: true });
+ for (const name of ["index.js", "map.js", "PARITY.sha256"]) writeFileSync(path.join(provider, name), readFileSync(path.join(providerSource, name)));
+ writeFileSync(path.join(provider, "map.js"), "export {};\n");
+ const changed = spawnSync(process.execPath, [verifier, archive], { encoding: "utf8" });
+ assert.equal(changed.status, 1, changed.stdout);
+ assert.match(changed.stderr, /claude-provider\/map\.js does not match its PARITY\.sha256 entry/);
+ writeFileSync(path.join(provider, "map.js"), readFileSync(path.join(providerSource, "map.js")));
const missing = spawnSync(process.execPath, [verifier, archive], { encoding: "utf8" });
assert.equal(missing.status, 1, missing.stdout);
diff --git a/apps/desktop/scripts/verify-packaged-imports.mjs b/apps/desktop/scripts/verify-packaged-imports.mjs
index 5cbb3834..76daa9ab 100644
--- a/apps/desktop/scripts/verify-packaged-imports.mjs
+++ b/apps/desktop/scripts/verify-packaged-imports.mjs
@@ -15,7 +15,8 @@
//
// Usage: node apps/desktop/scripts/verify-packaged-imports.mjs [app.asar ...]
// With no arguments it scans apps/desktop/dist-electron/** for app.asar files.
-import { existsSync, readdirSync, statSync } from "node:fs";
+import { createHash } from "node:crypto";
+import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
import { createRequire } from "node:module";
import { dirname, join, posix, resolve } from "node:path";
import { fileURLToPath } from "node:url";
@@ -100,6 +101,20 @@ if (targets.length === 0) {
console.error(`[verify-packaged-imports] no app.asar found under ${distElectron}`);
process.exit(2);
}
+function claudeProviderProblems(dir) {
+ const parity = join(dir, "PARITY.sha256");
+ if (!existsSync(parity)) return ["opencode-plugins/claude-provider/PARITY.sha256 is missing from the resources"];
+ const rows = readFileSync(parity, "utf8").split("\n").filter((line) => line.trim() && !line.startsWith("#")).map((line) => line.trim().split(/\s+/));
+ const problems = [];
+ for (const name of ["index.js", "map.js"]) {
+ const row = rows.find(([, file]) => file === name);
+ const file = join(dir, name);
+ if (!existsSync(file)) problems.push(`opencode-plugins/claude-provider/${name} is missing from the resources`);
+ else if (!row || createHash("sha256").update(readFileSync(file)).digest("hex") !== row[0]) problems.push(`opencode-plugins/claude-provider/${name} does not match its PARITY.sha256 entry`);
+ }
+ return problems;
+}
+
let failed = false;
for (const target of targets) {
statSync(target);
@@ -111,10 +126,10 @@ for (const target of targets) {
} else {
console.log(`[verify-packaged-imports] ${target}: ${modules} modules, all relative imports resolve inside the archive`);
}
- // The engine's Claude provider ships beside the archive (opencode-plugins/claude-provider/index.js).
- if (!existsSync(join(dirname(target), "opencode-plugins", "claude-provider", "index.js"))) {
+ // The engine's Claude provider ships beside the archive (opencode-plugins/claude-provider/): its files as PARITY.sha256 lists them.
+ for (const line of claudeProviderProblems(join(dirname(target), "opencode-plugins", "claude-provider"))) {
failed = true;
- console.error(`[verify-packaged-imports] ${target}: opencode-plugins/claude-provider/index.js is missing from the resources`);
+ console.error(`[verify-packaged-imports] ${target}: ${line}`);
}
const uiMcpProblems = verifyBundledUiMcp(dirname(target));
if (uiMcpProblems.length) {
diff --git a/apps/server/package.json b/apps/server/package.json
index ff3fb304..3e5f2786 100644
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@ -12,7 +12,7 @@
"test:coverage": "bun --conditions=development test --coverage --coverage-reporter=text --coverage-reporter=lcov --coverage-dir=coverage",
"test:artifacts": "bun --conditions=development test src/artifact-files.e2e.test.ts src/workspace-init.test.ts src/server.normalizeWorkspaceRelativePath.test.ts",
"build:enterprise-mcp-client": "pnpm --filter @omnirush/enterprise-mcp-client build",
- "build": "pnpm --filter @omnirush/types build && pnpm build:enterprise-mcp-client && tsc -p tsconfig.json && node scripts/copy-mcp-allow.mjs && node scripts/copy-shared-modules.mjs && bun build src/opencode-plugins/managed-policy-next.ts src/opencode-plugins/omnirush-session-next.ts src/opencode-plugins/managed-policy.ts src/opencode-plugins/omnirush-chrome-devtools.ts src/opencode-plugins/omnirush-extensions-preview.ts src/opencode-plugins/omnirush-capabilities-knowledge.ts src/opencode-plugins/omnirush-office-attachments.ts src/opencode-plugins/omnirush-spreadsheets.ts src/opencode-plugins/omnirush-pdf-attachments.ts src/opencode-plugins/omnirush-anthropic-adaptive-thinking.ts src/opencode-plugins/omnirush-anthropic-tool-schema.ts src/opencode-plugins/omnirush-title-recovery.ts src/opencode-plugins/omnirush-reasoning-effort.ts src/opencode-plugins/omnirush-swarm.ts src/opencode-plugins/omnirush-budget-wrap.ts src/opencode-plugins/omnirush-mcp-policy.ts src/opencode-plugins/omnirush-box.ts src/opencode-plugins/omnirush-box-next.ts src/opencode-plugins/omnirush-buildathon.ts src/opencode-plugins/omnirush-agent-assist.ts src/opencode-plugins/claude-provider/index.js --root src/opencode-plugins --outdir dist/opencode-plugins --target node --format esm && node scripts/copy-pdfium-wasm.mjs dist/opencode-plugins",
+ "build": "pnpm --filter @omnirush/types build && pnpm build:enterprise-mcp-client && tsc -p tsconfig.json && node scripts/copy-mcp-allow.mjs && node scripts/copy-shared-modules.mjs && bun build src/opencode-plugins/managed-policy-next.ts src/opencode-plugins/omnirush-session-next.ts src/opencode-plugins/managed-policy.ts src/opencode-plugins/omnirush-chrome-devtools.ts src/opencode-plugins/omnirush-extensions-preview.ts src/opencode-plugins/omnirush-capabilities-knowledge.ts src/opencode-plugins/omnirush-office-attachments.ts src/opencode-plugins/omnirush-spreadsheets.ts src/opencode-plugins/omnirush-pdf-attachments.ts src/opencode-plugins/omnirush-anthropic-adaptive-thinking.ts src/opencode-plugins/omnirush-anthropic-tool-schema.ts src/opencode-plugins/omnirush-title-recovery.ts src/opencode-plugins/omnirush-reasoning-effort.ts src/opencode-plugins/omnirush-swarm.ts src/opencode-plugins/omnirush-budget-wrap.ts src/opencode-plugins/omnirush-mcp-policy.ts src/opencode-plugins/omnirush-box.ts src/opencode-plugins/omnirush-box-next.ts src/opencode-plugins/omnirush-buildathon.ts src/opencode-plugins/omnirush-agent-assist.ts --root src/opencode-plugins --outdir dist/opencode-plugins --target node --format esm && node scripts/copy-pdfium-wasm.mjs dist/opencode-plugins",
"build:bin": "pnpm --filter @omnirush/types build && pnpm build:enterprise-mcp-client && bun build --compile src/cli.ts --outfile dist/bin/omnirush-server",
"build:bin:all": "pnpm --filter @omnirush/types build && pnpm build:enterprise-mcp-client && bun ./script/build.ts --outdir dist/bin --target bun-darwin-arm64 --target bun-darwin-x64 --target bun-linux-x64 --target bun-linux-arm64 --target bun-windows-x64 --target bun-windows-arm64",
"prepare:npm": "pnpm build:bin && node scripts/publish-npm.mjs --prepare-only",
diff --git a/apps/server/scripts/copy-shared-modules.mjs b/apps/server/scripts/copy-shared-modules.mjs
index aff8c342..8c32b84d 100644
--- a/apps/server/scripts/copy-shared-modules.mjs
+++ b/apps/server/scripts/copy-shared-modules.mjs
@@ -26,6 +26,14 @@ for (const file of plainModules(src)) {
copyFileSync(file, target);
copied.push(relative(src, file));
}
+// The Claude provider ships as its source files (the CLI ships the same files, see its PARITY.sha256), not bundled.
+for (const name of ["index.js", "map.js", "PARITY.sha256"]) {
+ const file = join(src, "opencode-plugins", "claude-provider", name);
+ const target = join(dist, relative(src, file));
+ mkdirSync(dirname(target), { recursive: true });
+ copyFileSync(file, target);
+ copied.push(relative(src, file));
+}
const missing = copied.filter((name) => !existsSync(join(dist, name)));
if (missing.length) {
process.stderr.write(`copy-shared-modules: not in dist: ${missing.join(", ")}\n`);