@zhafron/opencode-kiro-auth 1.4.2 → 1.4.3
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/dist/plugin.js +10 -13
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -268,18 +268,16 @@ export const createKiroPlugin = (id) => async ({ client, directory }) => {
|
|
|
268
268
|
if ((res.status === 402 || res.status === 403) && count > 1) {
|
|
269
269
|
let errorReason = res.status === 402 ? 'Quota' : 'Forbidden';
|
|
270
270
|
let isPermanent = false;
|
|
271
|
-
let shouldSkipAccount = false;
|
|
272
271
|
try {
|
|
273
272
|
const errorBody = await res.text();
|
|
274
273
|
const errorData = JSON.parse(errorBody);
|
|
274
|
+
if (errorData.reason === 'INVALID_MODEL_ID') {
|
|
275
|
+
logger.warn(`Invalid model ID for ${acc.email}: ${errorData.message}`);
|
|
276
|
+
throw new Error(`Invalid model: ${errorData.message}`);
|
|
277
|
+
}
|
|
275
278
|
if (errorData.reason === 'TEMPORARILY_SUSPENDED') {
|
|
276
279
|
errorReason = 'Account Suspended';
|
|
277
280
|
isPermanent = true;
|
|
278
|
-
shouldSkipAccount = true;
|
|
279
|
-
}
|
|
280
|
-
else if (errorData.reason === 'INVALID_MODEL_ID') {
|
|
281
|
-
logger.warn(`Invalid model ID for ${acc.email}: ${errorData.message}`);
|
|
282
|
-
throw new Error(`Invalid model: ${errorData.message}`);
|
|
283
281
|
}
|
|
284
282
|
}
|
|
285
283
|
catch (e) {
|
|
@@ -287,14 +285,13 @@ export const createKiroPlugin = (id) => async ({ client, directory }) => {
|
|
|
287
285
|
throw e;
|
|
288
286
|
}
|
|
289
287
|
}
|
|
290
|
-
if (
|
|
291
|
-
|
|
292
|
-
acc.failCount = 10;
|
|
293
|
-
}
|
|
294
|
-
am.markUnhealthy(acc, errorReason);
|
|
295
|
-
await am.saveToDisk();
|
|
296
|
-
continue;
|
|
288
|
+
if (isPermanent) {
|
|
289
|
+
acc.failCount = 10;
|
|
297
290
|
}
|
|
291
|
+
am.markUnhealthy(acc, errorReason);
|
|
292
|
+
await am.saveToDisk();
|
|
293
|
+
showToast(`${errorReason}. Switching account...`, 'warning');
|
|
294
|
+
continue;
|
|
298
295
|
}
|
|
299
296
|
const h = {};
|
|
300
297
|
res.headers.forEach((v, k) => {
|