@kervnet/opencode-kiro-auth 1.7.21 → 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) {
|
|
@@ -201,7 +201,8 @@ export class RequestHandler {
|
|
|
201
201
|
showToast('All accounts unhealthy. Forcing kiro-cli token refresh...', 'warning');
|
|
202
202
|
try {
|
|
203
203
|
const { execSync } = await import('node:child_process');
|
|
204
|
-
|
|
204
|
+
const { getCliBinPath } = await import('../../plugin/sync/kiro-cli-parser.js');
|
|
205
|
+
execSync(`${getCliBinPath()} whoami`, { timeout: 15000, stdio: 'pipe' });
|
|
205
206
|
logger.log('[RequestHandler] kiro-cli whoami succeeded');
|
|
206
207
|
}
|
|
207
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