From d9b89530d963bdfd8215dab54135406ac5b2158b Mon Sep 17 00:00:00 2001 From: Kiet Ho Date: Fri, 13 Feb 2026 22:35:20 -0800 Subject: [PATCH] chore(desktop): remove Claude binary download from build pipeline The Claude Code binary is no longer bundled into the app. The SDK resolves the binary at runtime instead. The chat gracefully handles a missing binary by omitting pathToClaudeCodeExecutable and letting the SDK find it on its own. --- apps/desktop/electron-builder.ts | 14 +++---- apps/desktop/package.json | 4 +- .../utils/session-manager/agent-execution.ts | 39 +++++++++++++------ bun.lock | 2 +- 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/apps/desktop/electron-builder.ts b/apps/desktop/electron-builder.ts index aa9fab3d21e..20883c79586 100644 --- a/apps/desktop/electron-builder.ts +++ b/apps/desktop/electron-builder.ts @@ -56,13 +56,13 @@ const config: Configuration = { to: "resources/migrations", filter: ["**/*"], }, - // Claude Code binary - bundled for AI chat functionality - { - // biome-ignore lint/suspicious/noTemplateCurlyInString: electron-builder variable interpolation - from: "resources/bin/${platform}-${arch}", - to: "bin", - filter: ["**/*"], - }, + // Claude Code binary - no longer bundled; the SDK resolves it at runtime + // { + // // biome-ignore lint/suspicious/noTemplateCurlyInString: electron-builder variable interpolation + // from: "resources/bin/${platform}-${arch}", + // to: "bin", + // filter: ["**/*"], + // }, ], files: [ diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 6047bce345f..69209944af1 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -22,9 +22,9 @@ "copy:native-modules": "bun run scripts/copy-native-modules.ts", "download:claude": "bun run scripts/download-claude-binary.ts", "upgrade:claude": "bun run scripts/upgrade-claude-binary.ts", - "prebuild": "bun run clean:dev && bun run compile:app && bun run copy:native-modules && bun run download:claude", + "prebuild": "bun run clean:dev && bun run compile:app && bun run copy:native-modules", "build": "cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --publish never", - "prepackage": "bun run copy:native-modules && bun run download:claude", + "prepackage": "bun run copy:native-modules", "package": "electron-builder --config electron-builder.ts", "install:deps": "electron-builder install-app-deps", "release": "electron-builder --publish always", diff --git a/apps/desktop/src/lib/trpc/routers/ai-chat/utils/session-manager/agent-execution.ts b/apps/desktop/src/lib/trpc/routers/ai-chat/utils/session-manager/agent-execution.ts index 718a2b2380d..a6289dcf673 100644 --- a/apps/desktop/src/lib/trpc/routers/ai-chat/utils/session-manager/agent-execution.ts +++ b/apps/desktop/src/lib/trpc/routers/ai-chat/utils/session-manager/agent-execution.ts @@ -1,3 +1,4 @@ +import { existsSync } from "node:fs"; import { join } from "node:path"; import { createPermissionRequest, @@ -10,19 +11,30 @@ import type { SessionStore } from "../session-store"; import type { PermissionRequestEvent } from "./session-events"; import type { ActiveSession } from "./session-types"; -function getClaudeBinaryPath(): string { +function getClaudeBinaryPath(): string | null { + let binaryPath: string; if (app.isPackaged) { - return join(process.resourcesPath, "bin", "claude"); + binaryPath = join(process.resourcesPath, "bin", "claude"); + } else { + const platform = process.platform; + const arch = process.arch; + binaryPath = join( + app.getAppPath(), + "resources", + "bin", + `${platform}-${arch}`, + "claude", + ); } - const platform = process.platform; - const arch = process.arch; - return join( - app.getAppPath(), - "resources", - "bin", - `${platform}-${arch}`, - "claude", - ); + + if (!existsSync(binaryPath)) { + console.warn( + `[chat/agent] Claude binary not found at ${binaryPath} — will rely on SDK to resolve`, + ); + return null; + } + + return binaryPath; } export interface ResolvePermissionInput { @@ -56,12 +68,15 @@ export class AgentExecution { onChunk, }: ExecuteAgentInput): Promise { const agentEnv = buildClaudeEnv(); + const claudeBinaryPath = getClaudeBinaryPath(); await executeAgent({ sessionId, prompt, cwd: session.cwd, - pathToClaudeCodeExecutable: getClaudeBinaryPath(), + ...(claudeBinaryPath && { + pathToClaudeCodeExecutable: claudeBinaryPath, + }), env: agentEnv, model: session.model, permissionMode: session.permissionMode ?? "default", diff --git a/bun.lock b/bun.lock index a458df61983..ca6ef70df85 100644 --- a/bun.lock +++ b/bun.lock @@ -105,7 +105,7 @@ }, "apps/desktop": { "name": "@superset/desktop", - "version": "0.0.73", + "version": "0.0.76", "dependencies": { "@better-auth/stripe": "1.4.18", "@dnd-kit/core": "^6.3.1",