From 288bc88e40ef69f0c018aa653a04cbb868f7a95b Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:47:39 +1000 Subject: [PATCH] fix: Tool calling on windows (#4234) --- packages/opencode/src/storage/storage.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/opencode/src/storage/storage.ts b/packages/opencode/src/storage/storage.ts index cff7211c..5d4f6394 100644 --- a/packages/opencode/src/storage/storage.ts +++ b/packages/opencode/src/storage/storage.ts @@ -170,7 +170,8 @@ export namespace Storage { const target = path.join(dir, ...key) + ".json" return withErrorHandling(async () => { using _ = await Lock.read(target) - return Bun.file(target).json() as Promise + const result = await Bun.file(target).json() + return result as T }) } @@ -178,7 +179,7 @@ export namespace Storage { const dir = await state().then((x) => x.dir) const target = path.join(dir, ...key) + ".json" return withErrorHandling(async () => { - using _ = await Lock.write("storage") + using _ = await Lock.write(target) const content = await Bun.file(target).json() fn(content) await Bun.write(target, JSON.stringify(content, null, 2)) @@ -190,7 +191,7 @@ export namespace Storage { const dir = await state().then((x) => x.dir) const target = path.join(dir, ...key) + ".json" return withErrorHandling(async () => { - using _ = await Lock.write("storage") + using _ = await Lock.write(target) await Bun.write(target, JSON.stringify(content, null, 2)) }) }