Simon Klee 4 jam lalu
induk
melakukan
3fb8f5337f

+ 7 - 4
packages/opencode/src/cli/cmd/run/session.shared.ts

@@ -3,8 +3,6 @@
 // Fetches session messages from the SDK and extracts user turn text for
 // the prompt history ring. Also finds the most recently used variant for
 // the current model so the footer can pre-select it.
-import path from "path"
-import { fileURLToPath } from "url"
 import { promptCopy, promptSame } from "./prompt.shared"
 import type { RunInput, RunPrompt } from "./types"
 
@@ -31,8 +29,13 @@ function fileName(url: string, filename?: string) {
 
   try {
     const next = new URL(url)
-    if (next.protocol === "file:") {
-      return path.basename(fileURLToPath(next)) || url
+    if (next.protocol !== "file:") {
+      return url
+    }
+
+    const name = next.pathname.split("/").at(-1)
+    if (name) {
+      return decodeURIComponent(name)
     }
   } catch {}
 

+ 3 - 3
packages/opencode/src/cli/cmd/run/tool.ts

@@ -265,14 +265,14 @@ export function toolPath(input?: string, opts: { home?: boolean } = {}): string
   }
 
   if (!rel.startsWith("..")) {
-    return rel
+    return rel.replaceAll("\\", "/")
   }
 
   if (opts.home && home && (abs === home || abs.startsWith(home + path.sep))) {
-    return abs.replace(home, "~")
+    return abs.replace(home, "~").replaceAll("\\", "/")
   }
 
-  return abs
+  return abs.replaceAll("\\", "/")
 }
 
 function fallbackInline(ctx: ToolFrame): ToolInline {