tui: fix Windows plugin loading by using direct paths instead of file URLs

pull/16961/head
Dax Raad 2026-03-10 01:18:34 -04:00
parent 3c2fda4d91
commit b2eae867a1
1 changed files with 1 additions and 4 deletions

View File

@ -30,7 +30,6 @@ import { Truncate } from "./truncation"
import { ApplyPatchTool } from "./apply_patch"
import { Glob } from "../util/glob"
import { pathToFileURL } from "url"
import { createRequire } from "module"
export namespace ToolRegistry {
const log = Log.create({ service: "tool.registry" })
@ -46,9 +45,7 @@ export namespace ToolRegistry {
if (matches.length) await Config.waitForDependencies()
for (const match of matches) {
const namespace = path.basename(match, path.extname(match))
const require = createRequire(match)
const resolved = require.resolve(match)
const mod = await import(pathToFileURL(resolved).href)
const mod = await import(process.platform === "win32" ? match : pathToFileURL(match).href)
for (const [id, def] of Object.entries<ToolDefinition>(mod)) {
custom.push(fromPlugin(id === "default" ? namespace : `${namespace}_${id}`, def))
}