@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.
Files changed (2) hide show
  1. package/dist/plugin.js +10 -13
  2. 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 (shouldSkipAccount) {
291
- if (isPermanent) {
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhafron/opencode-kiro-auth",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "OpenCode plugin for AWS Kiro (CodeWhisperer) providing access to Claude models",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",