From 1d2dc69ae57f86502932616f22cab742572a7c47 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 27 Dec 2025 23:47:59 +0900 Subject: [PATCH] fix: use pathToFileURL for Windows-compatible file URLs in look_at tool (#279) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/tools/look-at/tools.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/look-at/tools.ts b/src/tools/look-at/tools.ts index b384bdd..711a56c 100644 --- a/src/tools/look-at/tools.ts +++ b/src/tools/look-at/tools.ts @@ -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 }, ], }, })