Procházet zdrojové kódy

fix(opencode): ACP File write should create the file if it doesn't exist (#12854)

Bryce Ryan před 2 týdny
rodič
revize
56b340b5d5
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      packages/opencode/src/acp/agent.ts

+ 2 - 2
packages/opencode/src/acp/agent.ts

@@ -228,8 +228,8 @@ export namespace ACP {
                 const metadata = permission.metadata || {}
                 const filepath = typeof metadata["filepath"] === "string" ? metadata["filepath"] : ""
                 const diff = typeof metadata["diff"] === "string" ? metadata["diff"] : ""
-
-                const content = await Bun.file(filepath).text()
+                const file = Bun.file(filepath)
+                const content = await file.exists() ? await file.text() : ""
                 const newContent = getNewContent(content, diff)
 
                 if (newContent) {