@kervnet/opencode-kiro-auth 1.7.14 → 1.7.15
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/constants.js +4 -1
- package/dist/core/auth/auth-handler.js +25 -10
- package/package.json +1 -1
package/dist/constants.js
CHANGED
|
@@ -37,8 +37,11 @@ export const MODEL_MAPPING = {
|
|
|
37
37
|
'claude-sonnet-4-5-20250929': 'CLAUDE_SONNET_4_5_20250929_V1_0',
|
|
38
38
|
'claude-opus-4-5': 'CLAUDE_OPUS_4_5_20251101_V1_0',
|
|
39
39
|
'claude-opus-4-5-thinking': 'CLAUDE_OPUS_4_5_20251101_V1_0',
|
|
40
|
+
'claude-opus-4-6': 'anthropic.claude-opus-4-6-v1',
|
|
41
|
+
'claude-opus-4-6-thinking': 'anthropic.claude-opus-4-6-v1',
|
|
40
42
|
'claude-sonnet-4-20250514': 'CLAUDE_SONNET_4_20250514_V1_0',
|
|
41
|
-
'claude-3-7-sonnet-20250219': 'CLAUDE_3_7_SONNET_20250219_V1_0'
|
|
43
|
+
'claude-3-7-sonnet-20250219': 'CLAUDE_3_7_SONNET_20250219_V1_0',
|
|
44
|
+
'qwen3-coder-480b': 'qwen3-coder-480b'
|
|
42
45
|
};
|
|
43
46
|
export const SUPPORTED_MODELS = Object.keys(MODEL_MAPPING);
|
|
44
47
|
export const KIRO_AUTH_SERVICE = {
|
|
@@ -20,22 +20,36 @@ export class AuthHandler {
|
|
|
20
20
|
if (this.refreshTimer) {
|
|
21
21
|
clearInterval(this.refreshTimer);
|
|
22
22
|
}
|
|
23
|
-
// Refresh every
|
|
23
|
+
// Refresh every 5 minutes (more frequent to catch kiro-cli token updates)
|
|
24
24
|
this.refreshTimer = setInterval(async () => {
|
|
25
25
|
try {
|
|
26
26
|
const logger = await import('../../plugin/logger.js');
|
|
27
27
|
logger.log('Background token refresh starting...');
|
|
28
|
-
//
|
|
28
|
+
// Check if kiro-cli has valid tokens before syncing
|
|
29
29
|
try {
|
|
30
|
-
const {
|
|
31
|
-
await
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const { existsSync } = await import('node:fs');
|
|
31
|
+
const { Database } = await import('bun:sqlite');
|
|
32
|
+
const os = await import('node:os');
|
|
33
|
+
const path = await import('node:path');
|
|
34
|
+
const cliDbPath = path.join(os.homedir(), 'Library', 'Application Support', 'kiro-cli', 'data.sqlite3');
|
|
35
|
+
if (!existsSync(cliDbPath)) {
|
|
36
|
+
logger.log('Background token refresh: kiro-cli database not found, skipping');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const cliDb = new Database(cliDbPath, { readonly: true });
|
|
40
|
+
const tokenRow = cliDb
|
|
41
|
+
.prepare("SELECT json_extract(value, '$.expires_at') as expires FROM auth_kv WHERE key LIKE '%token' LIMIT 1")
|
|
42
|
+
.get();
|
|
43
|
+
cliDb.close();
|
|
44
|
+
if (!tokenRow || !tokenRow.expires || tokenRow.expires < Date.now()) {
|
|
45
|
+
logger.log('Background token refresh: kiro-cli token expired or missing, skipping');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
logger.log(`Background token refresh: kiro-cli token valid until ${new Date(tokenRow.expires).toLocaleString()}`);
|
|
36
49
|
}
|
|
37
50
|
catch (e) {
|
|
38
|
-
|
|
51
|
+
logger.warn('Background token refresh: failed to check kiro-cli token status', e);
|
|
52
|
+
return;
|
|
39
53
|
}
|
|
40
54
|
const { syncFromKiroCli } = await import('../../plugin/sync/kiro-cli.js');
|
|
41
55
|
await syncFromKiroCli();
|
|
@@ -51,7 +65,8 @@ export class AuthHandler {
|
|
|
51
65
|
const logger = await import('../../plugin/logger.js');
|
|
52
66
|
logger.warn('Background token refresh failed', e);
|
|
53
67
|
}
|
|
54
|
-
},
|
|
68
|
+
}, 5 * 60 * 1000 // 5 minutes
|
|
69
|
+
);
|
|
55
70
|
}
|
|
56
71
|
setAccountManager(am) {
|
|
57
72
|
this.accountManager = am;
|
package/package.json
CHANGED