@kervnet/opencode-kiro-auth 1.7.8 → 1.7.9
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.
|
@@ -3,8 +3,10 @@ export declare class AuthHandler {
|
|
|
3
3
|
private config;
|
|
4
4
|
private repository;
|
|
5
5
|
private accountManager?;
|
|
6
|
+
private refreshTimer?;
|
|
6
7
|
constructor(config: any, repository: AccountRepository);
|
|
7
8
|
initialize(): Promise<void>;
|
|
9
|
+
private startBackgroundRefresh;
|
|
8
10
|
setAccountManager(am: any): void;
|
|
9
11
|
getMethods(): Array<{
|
|
10
12
|
id: string;
|
|
@@ -4,6 +4,7 @@ export class AuthHandler {
|
|
|
4
4
|
config;
|
|
5
5
|
repository;
|
|
6
6
|
accountManager;
|
|
7
|
+
refreshTimer;
|
|
7
8
|
constructor(config, repository) {
|
|
8
9
|
this.config = config;
|
|
9
10
|
this.repository = repository;
|
|
@@ -11,6 +12,24 @@ export class AuthHandler {
|
|
|
11
12
|
async initialize() {
|
|
12
13
|
const { syncFromKiroCli } = await import('../../plugin/sync/kiro-cli.js');
|
|
13
14
|
await syncFromKiroCli();
|
|
15
|
+
// Start background token refresh every 15 minutes
|
|
16
|
+
this.startBackgroundRefresh();
|
|
17
|
+
}
|
|
18
|
+
startBackgroundRefresh() {
|
|
19
|
+
// Clear existing timer if any
|
|
20
|
+
if (this.refreshTimer) {
|
|
21
|
+
clearInterval(this.refreshTimer);
|
|
22
|
+
}
|
|
23
|
+
// Refresh every 15 minutes
|
|
24
|
+
this.refreshTimer = setInterval(async () => {
|
|
25
|
+
try {
|
|
26
|
+
const { syncFromKiroCli } = await import('../../plugin/sync/kiro-cli.js');
|
|
27
|
+
await syncFromKiroCli();
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
// Silent fail - will retry in 15 minutes
|
|
31
|
+
}
|
|
32
|
+
}, 15 * 60 * 1000);
|
|
14
33
|
}
|
|
15
34
|
setAccountManager(am) {
|
|
16
35
|
this.accountManager = am;
|
package/package.json
CHANGED