@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 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 15 minutes
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
- // Force kiro-cli to refresh its token first
28
+ // Check if kiro-cli has valid tokens before syncing
29
29
  try {
30
- const { exec } = await import('node:child_process');
31
- await new Promise((resolve) => {
32
- exec('kiro-cli whoami', (error) => {
33
- resolve(); // Continue even if it fails
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
- // Silent fail - continue with sync anyway
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
- }, 15 * 60 * 1000);
68
+ }, 5 * 60 * 1000 // 5 minutes
69
+ );
55
70
  }
56
71
  setAccountManager(am) {
57
72
  this.accountManager = am;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kervnet/opencode-kiro-auth",
3
- "version": "1.7.14",
3
+ "version": "1.7.15",
4
4
  "description": "OpenCode plugin for AWS Kiro (CodeWhisperer) with IAM Identity Center profile support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",