@kervnet/opencode-kiro-auth 1.6.2 → 1.6.4
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/core/auth/auth-handler.d.ts +1 -1
- package/dist/core/auth/auth-handler.js +9 -1
- package/dist/core/auth/kiro-cli-auth-method.d.ts +9 -0
- package/dist/core/auth/kiro-cli-auth-method.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +14 -3
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IdcAuthMethod } from './idc-auth-method.js';
|
|
2
|
+
import { KiroCliAuthMethod } from './kiro-cli-auth-method.js';
|
|
2
3
|
export class AuthHandler {
|
|
3
4
|
config;
|
|
4
5
|
repository;
|
|
@@ -21,10 +22,17 @@ export class AuthHandler {
|
|
|
21
22
|
return [];
|
|
22
23
|
}
|
|
23
24
|
const idcMethod = new IdcAuthMethod(this.config, this.repository);
|
|
25
|
+
const cliMethod = new KiroCliAuthMethod(this.config, this.repository);
|
|
24
26
|
return [
|
|
27
|
+
{
|
|
28
|
+
id: 'kiro-cli',
|
|
29
|
+
label: 'Use Kiro CLI Session',
|
|
30
|
+
type: 'custom',
|
|
31
|
+
authorize: () => cliMethod.authorize()
|
|
32
|
+
},
|
|
25
33
|
{
|
|
26
34
|
id: 'idc',
|
|
27
|
-
label: 'AWS Builder ID (
|
|
35
|
+
label: 'AWS Builder ID (New Login)',
|
|
28
36
|
type: 'oauth',
|
|
29
37
|
authorize: (inputs) => idcMethod.authorize(inputs)
|
|
30
38
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AccountRepository } from '../../infrastructure/database/account-repository.js';
|
|
2
|
+
export declare class KiroCliAuthMethod {
|
|
3
|
+
private config;
|
|
4
|
+
private repository;
|
|
5
|
+
constructor(config: any, repository: AccountRepository);
|
|
6
|
+
authorize(): Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { syncFromKiroCli } from '../../plugin/sync/kiro-cli.js';
|
|
2
|
+
export class KiroCliAuthMethod {
|
|
3
|
+
config;
|
|
4
|
+
repository;
|
|
5
|
+
constructor(config, repository) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
this.repository = repository;
|
|
8
|
+
}
|
|
9
|
+
async authorize() {
|
|
10
|
+
// Sync from kiro-cli
|
|
11
|
+
await syncFromKiroCli();
|
|
12
|
+
// Check if we have accounts
|
|
13
|
+
const accounts = await this.repository.findAll();
|
|
14
|
+
if (accounts.length === 0) {
|
|
15
|
+
throw new Error('No accounts found. Please run: kiro-cli login');
|
|
16
|
+
}
|
|
17
|
+
return { success: true };
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/plugin.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const createKiroPlugin: (id: string) => ({ client, directory }: a
|
|
|
9
9
|
methods: {
|
|
10
10
|
id: string;
|
|
11
11
|
label: string;
|
|
12
|
-
type: "oauth";
|
|
12
|
+
type: "oauth" | "custom";
|
|
13
13
|
authorize: (inputs?: any) => Promise<any>;
|
|
14
14
|
}[];
|
|
15
15
|
};
|
|
@@ -25,7 +25,7 @@ export declare const KiroOAuthPlugin: ({ client, directory }: any) => Promise<{
|
|
|
25
25
|
methods: {
|
|
26
26
|
id: string;
|
|
27
27
|
label: string;
|
|
28
|
-
type: "oauth";
|
|
28
|
+
type: "oauth" | "custom";
|
|
29
29
|
authorize: (inputs?: any) => Promise<any>;
|
|
30
30
|
}[];
|
|
31
31
|
};
|
package/dist/plugin.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { KIRO_CONSTANTS } from './constants.js';
|
|
2
1
|
import { AuthHandler } from './core/auth/auth-handler.js';
|
|
3
2
|
import { RequestHandler } from './core/request/request-handler.js';
|
|
4
3
|
import { AccountCache } from './infrastructure/database/account-cache.js';
|
|
@@ -21,11 +20,23 @@ export const createKiroPlugin = (id) => async ({ client, directory }) => {
|
|
|
21
20
|
auth: {
|
|
22
21
|
provider: id,
|
|
23
22
|
loader: async (getAuth) => {
|
|
24
|
-
|
|
23
|
+
// Check if we already have accounts synced from kiro-cli
|
|
24
|
+
const accounts = accountManager.getAccounts();
|
|
25
|
+
if (accounts.length === 0) {
|
|
26
|
+
// No accounts, need to authenticate
|
|
27
|
+
await getAuth();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// We have accounts, skip auth prompt
|
|
31
|
+
console.log('[KIRO] Using existing account:', accounts[0]?.email || 'unknown');
|
|
32
|
+
}
|
|
25
33
|
await authHandler.initialize();
|
|
34
|
+
const region = config?.default_region || 'us-east-1';
|
|
35
|
+
const baseURL = `https://q.${region}.amazonaws.com`;
|
|
36
|
+
console.log('[KIRO] Loader called - baseURL:', baseURL, 'region:', region);
|
|
26
37
|
return {
|
|
27
38
|
apiKey: '',
|
|
28
|
-
baseURL
|
|
39
|
+
baseURL,
|
|
29
40
|
fetch: (input, init) => requestHandler.handle(input, init, showToast)
|
|
30
41
|
};
|
|
31
42
|
},
|
package/package.json
CHANGED