@magpie-community/opencode-qoder-auth 0.2.10 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +8 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1314,6 +1314,9 @@ const makePlugin = (site) => async ({ client }) => {
|
|
|
1314
1314
|
}
|
|
1315
1315
|
// each account's listing, the model configs a request carries
|
|
1316
1316
|
const listings = new Map()
|
|
1317
|
+
// A public and a VPC account can name the same uid but have different
|
|
1318
|
+
// catalogs. Keep each deployment's listing apart.
|
|
1319
|
+
const listingKey = (cred) => `${cred.vpc ?? ""}\0${cred.uid}`
|
|
1317
1320
|
// the accounts fresh renewed: the built-in took the lapse mark off on a
|
|
1318
1321
|
// renewed job token (qoderPersist), whatever the request then met
|
|
1319
1322
|
const renewals = new WeakSet()
|
|
@@ -1322,7 +1325,7 @@ const makePlugin = (site) => async ({ client }) => {
|
|
|
1322
1325
|
// says "renewed" for it
|
|
1323
1326
|
const unsaid = new Set()
|
|
1324
1327
|
const renewed = (cred) => {
|
|
1325
|
-
const was = unsaid.delete(cred
|
|
1328
|
+
const was = unsaid.delete(listingKey(cred))
|
|
1326
1329
|
return renewals.has(cred) || was
|
|
1327
1330
|
}
|
|
1328
1331
|
|
|
@@ -1343,10 +1346,11 @@ const makePlugin = (site) => async ({ client }) => {
|
|
|
1343
1346
|
})
|
|
1344
1347
|
|
|
1345
1348
|
const models = async (cred, again = false) => {
|
|
1346
|
-
|
|
1349
|
+
const key = listingKey(cred)
|
|
1350
|
+
let l = listings.get(key)
|
|
1347
1351
|
if (!l || again) {
|
|
1348
1352
|
l = modelInfos(await fetchListing(siteOf(site, cred), cred))
|
|
1349
|
-
listings.set(
|
|
1353
|
+
listings.set(key, l)
|
|
1350
1354
|
}
|
|
1351
1355
|
return l
|
|
1352
1356
|
}
|
|
@@ -1559,7 +1563,7 @@ const makePlugin = (site) => async ({ client }) => {
|
|
|
1559
1563
|
if (e?.expired) throw Object.assign(new Error(e.message), { signIn: "expired" })
|
|
1560
1564
|
return provider.models
|
|
1561
1565
|
}
|
|
1562
|
-
if (renewals.has(cred)) unsaid.add(cred
|
|
1566
|
+
if (renewals.has(cred)) unsaid.add(listingKey(cred))
|
|
1563
1567
|
try {
|
|
1564
1568
|
const ms = await models(cred, true)
|
|
1565
1569
|
if (!ms.length) return provider.models
|
package/package.json
CHANGED