@zhafron/opencode-kiro-auth 1.4.0 → 1.4.1
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/accounts.js +8 -5
- package/dist/plugin.js +1 -1
- package/package.json +1 -1
package/dist/plugin/accounts.js
CHANGED
|
@@ -51,13 +51,13 @@ export class AccountManager {
|
|
|
51
51
|
getAccounts() {
|
|
52
52
|
return [...this.accounts];
|
|
53
53
|
}
|
|
54
|
-
shouldShowToast(debounce =
|
|
54
|
+
shouldShowToast(debounce = 10000) {
|
|
55
55
|
if (Date.now() - this.lastToastTime < debounce)
|
|
56
56
|
return false;
|
|
57
57
|
this.lastToastTime = Date.now();
|
|
58
58
|
return true;
|
|
59
59
|
}
|
|
60
|
-
shouldShowUsageToast(debounce =
|
|
60
|
+
shouldShowUsageToast(debounce = 10000) {
|
|
61
61
|
if (Date.now() - this.lastUsageToastTime < debounce)
|
|
62
62
|
return false;
|
|
63
63
|
this.lastUsageToastTime = Date.now();
|
|
@@ -175,10 +175,13 @@ export class AccountManager {
|
|
|
175
175
|
markUnhealthy(a, reason, recovery) {
|
|
176
176
|
const acc = this.accounts.find((x) => x.id === a.id);
|
|
177
177
|
if (acc) {
|
|
178
|
-
acc.isHealthy = false;
|
|
179
|
-
acc.unhealthyReason = reason;
|
|
180
178
|
acc.failCount = (acc.failCount || 0) + 1;
|
|
181
|
-
acc.
|
|
179
|
+
acc.unhealthyReason = reason;
|
|
180
|
+
acc.lastUsed = Date.now();
|
|
181
|
+
if (acc.failCount >= 3) {
|
|
182
|
+
acc.isHealthy = false;
|
|
183
|
+
acc.recoveryTime = recovery || Date.now() + 3600000;
|
|
184
|
+
}
|
|
182
185
|
kiroDb.upsertAccount(acc);
|
|
183
186
|
}
|
|
184
187
|
}
|
package/dist/plugin.js
CHANGED
|
@@ -103,7 +103,7 @@ export const createKiroPlugin = (id) => async ({ client, directory }) => {
|
|
|
103
103
|
}
|
|
104
104
|
throw new Error('All accounts are unhealthy or rate-limited');
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
106
|
+
if (am.shouldShowToast())
|
|
107
107
|
showToast(`Using ${acc.email} (${am.getAccounts().indexOf(acc) + 1}/${count})`, 'info');
|
|
108
108
|
if (am.shouldShowUsageToast() &&
|
|
109
109
|
acc.usedCount !== undefined &&
|