feat: pass mode into task tool (#1248)

This commit is contained in:
Yihui Khuu
2025-07-24 10:29:59 +10:00
committed by GitHub
parent 3e69d5276b
commit 507c975e92
4 changed files with 24 additions and 2 deletions

View File

@@ -72,6 +72,22 @@ export namespace Storage {
} catch (e) {}
}
},
async (dir: string) => {
const files = new Bun.Glob("session/message/*/*.json").scanSync({
cwd: dir,
absolute: true,
})
for (const file of files) {
try {
const content = await Bun.file(file).json()
if (content.role === "assistant" && !content.mode) {
log.info("adding mode field to message", { file })
content.mode = "build"
await Bun.write(file, JSON.stringify(content, null, 2))
}
} catch (e) {}
}
},
]
const state = App.state("storage", async () => {