Replace env-paths with xdg-basedir for better XDG compliance and cross-platform directory handling

🤖 Generated with opencode
Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
Dax Raad
2025-06-03 14:46:28 -04:00
parent 9ad0477af6
commit 8e769dcac0
7 changed files with 30 additions and 22 deletions

View File

@@ -95,13 +95,18 @@ export namespace Provider {
const s = await state()
if (s.sdk.has(providerID)) return s.sdk.get(providerID)!
const dir = path.join(Global.cache(), `node_modules`, `@ai-sdk`, providerID)
const dir = path.join(
Global.Path.cache,
`node_modules`,
`@ai-sdk`,
providerID,
)
if (!(await Bun.file(path.join(dir, "package.json")).exists())) {
log.info("installing", {
providerID,
})
BunProc.run(["add", `@ai-sdk/${providerID}@alpha`], {
cwd: Global.cache(),
cwd: Global.Path.cache,
})
}
const mod = await import(path.join(dir))