fix: use pathToFileURL for Windows-compatible file URLs in look_at tool (#279)

Fixes #276 - The look_at tool was constructing invalid file:// URLs on Windows
by using template literals. Now uses Node.js pathToFileURL() which correctly
handles backslashes, spaces, and the triple-slash prefix required on Windows.

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-27 23:47:59 +09:00
committed by GitHub
parent 0cee39dafb
commit 1d2dc69ae5

View File

@@ -1,4 +1,5 @@
import { extname, basename } from "node:path"
import { pathToFileURL } from "node:url"
import { tool, type PluginInput, type ToolDefinition } from "@opencode-ai/plugin"
import { LOOK_AT_DESCRIPTION, MULTIMODAL_LOOKER_AGENT } from "./constants"
import type { LookAtArgs } from "./types"
@@ -78,7 +79,7 @@ If the requested information is not found, clearly state what is missing.`
},
parts: [
{ type: "text", text: prompt },
{ type: "file", mime: mimeType, url: `file://${args.file_path}`, filename },
{ type: "file", mime: mimeType, url: pathToFileURL(args.file_path).href, filename },
],
},
})