diff --git a/bun.lock b/bun.lock index d211e2de8..ed5f4930d 100644 --- a/bun.lock +++ b/bun.lock @@ -285,7 +285,9 @@ "@parcel/watcher-darwin-arm64": "2.5.1", "@parcel/watcher-darwin-x64": "2.5.1", "@parcel/watcher-linux-arm64-glibc": "2.5.1", + "@parcel/watcher-linux-arm64-musl": "2.5.1", "@parcel/watcher-linux-x64-glibc": "2.5.1", + "@parcel/watcher-linux-x64-musl": "2.5.1", "@parcel/watcher-win32-x64": "2.5.1", "@standard-schema/spec": "1.0.0", "@tsconfig/bun": "catalog:", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index bd1bd6634..2c801fcc0 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -23,7 +23,9 @@ "@parcel/watcher-darwin-arm64": "2.5.1", "@parcel/watcher-darwin-x64": "2.5.1", "@parcel/watcher-linux-arm64-glibc": "2.5.1", + "@parcel/watcher-linux-arm64-musl": "2.5.1", "@parcel/watcher-linux-x64-glibc": "2.5.1", + "@parcel/watcher-linux-x64-musl": "2.5.1", "@parcel/watcher-win32-x64": "2.5.1", "@standard-schema/spec": "1.0.0", "@tsconfig/bun": "catalog:", diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts index 64f43b748..5a6ac2584 100755 --- a/packages/opencode/script/build.ts +++ b/packages/opencode/script/build.ts @@ -128,6 +128,7 @@ for (const item of targets) { OTUI_TREE_SITTER_WORKER_PATH: bunfsRoot + workerRelativePath, OPENCODE_WORKER_PATH: workerPath, OPENCODE_CHANNEL: `'${Script.channel}'`, + OPENCODE_LIBC: item.os === "linux" ? `'${item.abi ?? "glibc"}'` : "", }, }) diff --git a/packages/opencode/src/cli/cmd/tui/thread.ts b/packages/opencode/src/cli/cmd/tui/thread.ts index 79638c5e8..3cf8937a9 100644 --- a/packages/opencode/src/cli/cmd/tui/thread.ts +++ b/packages/opencode/src/cli/cmd/tui/thread.ts @@ -60,7 +60,6 @@ export const TuiThreadCommand = cmd({ const cwd = args.project ? path.resolve(baseCwd, args.project) : process.cwd() const localWorker = new URL("./worker.ts", import.meta.url) const distWorker = new URL("./cli/cmd/tui/worker.js", import.meta.url) - const execDir = path.dirname(process.execPath) const workerPath = await iife(async () => { if (typeof OPENCODE_WORKER_PATH !== "undefined") return OPENCODE_WORKER_PATH if (await Bun.file(distWorker).exists()) return distWorker diff --git a/packages/opencode/src/file/watcher.ts b/packages/opencode/src/file/watcher.ts index 4adf721b9..c9985acf3 100644 --- a/packages/opencode/src/file/watcher.ts +++ b/packages/opencode/src/file/watcher.ts @@ -9,6 +9,8 @@ import { createWrapper } from "@parcel/watcher/wrapper" import { lazy } from "@/util/lazy" import type ParcelWatcher from "@parcel/watcher" +declare const OPENCODE_LIBC: string | undefined + export namespace FileWatcher { const log = Log.create({ service: "file.watcher" }) @@ -24,7 +26,7 @@ export namespace FileWatcher { const watcher = lazy(() => { const binding = require( - `@parcel/watcher-${process.platform}-${process.arch}${process.platform === "linux" ? "-glibc" : ""}`, + `@parcel/watcher-${process.platform}-${process.arch}${process.platform === "linux" ? `-${OPENCODE_LIBC || "glibc"}` : ""}`, ) return createWrapper(binding) as typeof import("@parcel/watcher") })