summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLuke Parker <[email protected]>2026-02-25 10:24:47 +1000
committerGitHub <[email protected]>2026-02-25 10:24:47 +1000
commit3af12c53c433d1f49abde0874dc02c2e6c018930 (patch)
treeb7334ae67ef1798909d35c8700d93a86a95affed
parent29ddd55088af6f31c24f392c9f5dbf472918114f (diff)
downloadopencode-3af12c53c433d1f49abde0874dc02c2e6c018930.tar.gz
opencode-3af12c53c433d1f49abde0874dc02c2e6c018930.zip
fix(opencode): import custom tools via file URL (#14971)
-rw-r--r--packages/opencode/src/tool/registry.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/opencode/src/tool/registry.ts b/packages/opencode/src/tool/registry.ts
index ef0e78ffa..cf3c2cad8 100644
--- a/packages/opencode/src/tool/registry.ts
+++ b/packages/opencode/src/tool/registry.ts
@@ -28,6 +28,7 @@ import { Truncate } from "./truncation"
import { PlanExitTool, PlanEnterTool } from "./plan"
import { ApplyPatchTool } from "./apply_patch"
import { Glob } from "../util/glob"
+import { pathToFileURL } from "url"
export namespace ToolRegistry {
const log = Log.create({ service: "tool.registry" })
@@ -43,7 +44,7 @@ export namespace ToolRegistry {
if (matches.length) await Config.waitForDependencies()
for (const match of matches) {
const namespace = path.basename(match, path.extname(match))
- const mod = await import(match)
+ const mod = await import(pathToFileURL(match).href)
for (const [id, def] of Object.entries<ToolDefinition>(mod)) {
custom.push(fromPlugin(id === "default" ? namespace : `${namespace}_${id}`, def))
}