@kervnet/opencode-kiro-auth 1.7.2 → 1.7.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.
|
@@ -16,7 +16,7 @@ export class KiroCliAuthMethod {
|
|
|
16
16
|
const { syncFromKiroCli } = await import('../../plugin/sync/kiro-cli.js');
|
|
17
17
|
await syncFromKiroCli();
|
|
18
18
|
// Give it a moment for the database to be written
|
|
19
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
19
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
20
20
|
// Check if we have any accounts
|
|
21
21
|
const accounts = await this.repository.findAll();
|
|
22
22
|
if (accounts.length === 0) {
|
|
@@ -42,12 +42,20 @@ export class TokenRefresher {
|
|
|
42
42
|
(error.code === 'ExpiredTokenException' ||
|
|
43
43
|
error.code === 'InvalidTokenException' ||
|
|
44
44
|
error.code === 'HTTP_401' ||
|
|
45
|
-
error.code === 'HTTP_403' ||
|
|
46
45
|
error.message.includes('Invalid refresh token provided'))) {
|
|
47
46
|
this.accountManager.markUnhealthy(account, error.message);
|
|
48
47
|
await this.repository.batchSave(this.accountManager.getAccounts());
|
|
49
48
|
return { account, shouldContinue: true };
|
|
50
49
|
}
|
|
50
|
+
// For HTTP_403, only mark unhealthy after multiple failures
|
|
51
|
+
if (error instanceof KiroTokenRefreshError && error.code === 'HTTP_403') {
|
|
52
|
+
account.failCount = (account.failCount || 0) + 1;
|
|
53
|
+
if (account.failCount >= 3) {
|
|
54
|
+
this.accountManager.markUnhealthy(account, error.message);
|
|
55
|
+
}
|
|
56
|
+
await this.repository.batchSave(this.accountManager.getAccounts());
|
|
57
|
+
return { account, shouldContinue: true };
|
|
58
|
+
}
|
|
51
59
|
throw error;
|
|
52
60
|
}
|
|
53
61
|
}
|
package/package.json
CHANGED