Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 288bc88

Browse files
authored
fix: Tool calling on windows (anomalyco#4234)
1 parent 6d36dbf commit 288bc88

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/opencode/src/storage/storage.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,16 @@ export namespace Storage {
170170
const target = path.join(dir, ...key) + ".json"
171171
return withErrorHandling(async () => {
172172
using _ = await Lock.read(target)
173-
return Bun.file(target).json() as Promise<T>
173+
const result = await Bun.file(target).json()
174+
return result as T
174175
})
175176
}
176177

177178
export async function update<T>(key: string[], fn: (draft: T) => void) {
178179
const dir = await state().then((x) => x.dir)
179180
const target = path.join(dir, ...key) + ".json"
180181
return withErrorHandling(async () => {
181-
using _ = await Lock.write("storage")
182+
using _ = await Lock.write(target)
182183
const content = await Bun.file(target).json()
183184
fn(content)
184185
await Bun.write(target, JSON.stringify(content, null, 2))
@@ -190,7 +191,7 @@ export namespace Storage {
190191
const dir = await state().then((x) => x.dir)
191192
const target = path.join(dir, ...key) + ".json"
192193
return withErrorHandling(async () => {
193-
using _ = await Lock.write("storage")
194+
using _ = await Lock.write(target)
194195
await Bun.write(target, JSON.stringify(content, null, 2))
195196
})
196197
}

0 commit comments

Comments
 (0)