@kervnet/opencode-kiro-auth 1.7.6 → 1.7.7
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.
|
@@ -12,6 +12,8 @@ export declare class TokenRefresher {
|
|
|
12
12
|
private accountManager;
|
|
13
13
|
private syncFromKiroCli;
|
|
14
14
|
private repository;
|
|
15
|
+
private lastSyncTime;
|
|
16
|
+
private readonly SYNC_COOLDOWN_MS;
|
|
15
17
|
constructor(config: TokenRefresherConfig, accountManager: AccountManager, syncFromKiroCli: () => Promise<void>, repository: AccountRepository);
|
|
16
18
|
refreshIfNeeded(account: ManagedAccount, auth: KiroAuthDetails, showToast: ToastFunction): Promise<{
|
|
17
19
|
account: ManagedAccount;
|
|
@@ -6,6 +6,8 @@ export class TokenRefresher {
|
|
|
6
6
|
accountManager;
|
|
7
7
|
syncFromKiroCli;
|
|
8
8
|
repository;
|
|
9
|
+
lastSyncTime = 0;
|
|
10
|
+
SYNC_COOLDOWN_MS = 5000; // Only sync once per 5 seconds
|
|
9
11
|
constructor(config, accountManager, syncFromKiroCli, repository) {
|
|
10
12
|
this.config = config;
|
|
11
13
|
this.accountManager = accountManager;
|
|
@@ -27,7 +29,10 @@ export class TokenRefresher {
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
async handleRefreshError(error, account, showToast) {
|
|
30
|
-
if
|
|
32
|
+
// Only sync if cooldown period has passed
|
|
33
|
+
const now = Date.now();
|
|
34
|
+
if (this.config.auto_sync_kiro_cli && now - this.lastSyncTime > this.SYNC_COOLDOWN_MS) {
|
|
35
|
+
this.lastSyncTime = now;
|
|
31
36
|
await this.syncFromKiroCli();
|
|
32
37
|
}
|
|
33
38
|
this.repository.invalidateCache();
|
package/package.json
CHANGED