@kervnet/opencode-kiro-auth 1.7.20 → 1.7.22
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.
|
@@ -41,9 +41,8 @@ export class AuthHandler {
|
|
|
41
41
|
try {
|
|
42
42
|
const { existsSync } = await import('node:fs');
|
|
43
43
|
const { Database } = await import('bun:sqlite');
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const cliDbPath = path.join(os.homedir(), 'Library', 'Application Support', 'kiro-cli', 'data.sqlite3');
|
|
44
|
+
const { getCliDbPath } = await import('../../plugin/sync/kiro-cli-parser.js');
|
|
45
|
+
const cliDbPath = getCliDbPath();
|
|
47
46
|
if (!existsSync(cliDbPath)) {
|
|
48
47
|
logger.log('Background token refresh: kiro-cli database not found, skipping');
|
|
49
48
|
return;
|
|
@@ -60,8 +59,9 @@ export class AuthHandler {
|
|
|
60
59
|
if (needsRefresh) {
|
|
61
60
|
logger.log('Background token refresh: forcing kiro-cli whoami...');
|
|
62
61
|
const { execSync } = await import('node:child_process');
|
|
62
|
+
const { getCliBinPath } = await import('../../plugin/sync/kiro-cli-parser.js');
|
|
63
63
|
try {
|
|
64
|
-
execSync(
|
|
64
|
+
execSync(`${getCliBinPath()} whoami`, { timeout: 15000, stdio: 'pipe' });
|
|
65
65
|
logger.log('Background token refresh: kiro-cli whoami succeeded');
|
|
66
66
|
}
|
|
67
67
|
catch {
|
|
@@ -41,7 +41,8 @@ export class TokenRefresher {
|
|
|
41
41
|
logger.log('[TokenRefresher] Forcing kiro-cli token refresh via whoami...');
|
|
42
42
|
try {
|
|
43
43
|
const { execSync } = await import('node:child_process');
|
|
44
|
-
|
|
44
|
+
const { getCliBinPath } = await import('../../plugin/sync/kiro-cli-parser.js');
|
|
45
|
+
execSync(`${getCliBinPath()} whoami`, { timeout: 15000, stdio: 'pipe' });
|
|
45
46
|
logger.log('[TokenRefresher] kiro-cli whoami succeeded');
|
|
46
47
|
}
|
|
47
48
|
catch (e) {
|
|
@@ -122,14 +122,12 @@ export class RequestHandler {
|
|
|
122
122
|
return transformToCodeWhisperer(url, body, model, auth, think, budget, reductionFactor);
|
|
123
123
|
}
|
|
124
124
|
handleSuccessfulRequest(acc) {
|
|
125
|
-
if (acc.failCount
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.repository.save(acc).catch(() => { });
|
|
132
|
-
}
|
|
125
|
+
if (acc.failCount || acc.unhealthyReason) {
|
|
126
|
+
acc.failCount = 0;
|
|
127
|
+
acc.isHealthy = true;
|
|
128
|
+
delete acc.unhealthyReason;
|
|
129
|
+
delete acc.recoveryTime;
|
|
130
|
+
this.repository.save(acc).catch(() => { });
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
logRequest(prep, acc, timestamp) {
|
|
@@ -203,7 +201,8 @@ export class RequestHandler {
|
|
|
203
201
|
showToast('All accounts unhealthy. Forcing kiro-cli token refresh...', 'warning');
|
|
204
202
|
try {
|
|
205
203
|
const { execSync } = await import('node:child_process');
|
|
206
|
-
|
|
204
|
+
const { getCliBinPath } = await import('../../plugin/sync/kiro-cli-parser.js');
|
|
205
|
+
execSync(`${getCliBinPath()} whoami`, { timeout: 15000, stdio: 'pipe' });
|
|
207
206
|
logger.log('[RequestHandler] kiro-cli whoami succeeded');
|
|
208
207
|
}
|
|
209
208
|
catch (e) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function getCliDbPath(): string;
|
|
2
|
+
export declare function getCliBinPath(): string;
|
|
2
3
|
export declare function safeJsonParse(value: unknown): any | null;
|
|
3
4
|
export declare function normalizeExpiresAt(input: unknown): number;
|
|
4
5
|
export declare function findClientCredsRecursive(input: unknown): {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
2
3
|
import { homedir, platform } from 'node:os';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
5
|
export function getCliDbPath() {
|
|
@@ -12,6 +13,18 @@ export function getCliDbPath() {
|
|
|
12
13
|
return join(homedir(), 'Library', 'Application Support', 'kiro-cli', 'data.sqlite3');
|
|
13
14
|
return join(homedir(), '.local', 'share', 'kiro-cli', 'data.sqlite3');
|
|
14
15
|
}
|
|
16
|
+
export function getCliBinPath() {
|
|
17
|
+
const candidates = [
|
|
18
|
+
join(homedir(), '.local', 'bin', 'kiro-cli'),
|
|
19
|
+
join(homedir(), '.kiro', 'bin', 'kiro-cli'),
|
|
20
|
+
'/usr/local/bin/kiro-cli',
|
|
21
|
+
];
|
|
22
|
+
for (const c of candidates) {
|
|
23
|
+
if (existsSync(c))
|
|
24
|
+
return c;
|
|
25
|
+
}
|
|
26
|
+
return 'kiro-cli'; // fallback to PATH
|
|
27
|
+
}
|
|
15
28
|
export function safeJsonParse(value) {
|
|
16
29
|
if (typeof value !== 'string')
|
|
17
30
|
return null;
|
package/package.json
CHANGED