@zhafron/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/constants.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export declare const KIRO_CONSTANTS: {
|
|
|
10
10
|
DEFAULT_REGION: KiroRegion;
|
|
11
11
|
AXIOS_TIMEOUT: number;
|
|
12
12
|
USER_AGENT: string;
|
|
13
|
-
|
|
13
|
+
SDK_VERSION: string;
|
|
14
|
+
SDK_VERSION_USAGE: string;
|
|
14
15
|
CHAT_TRIGGER_TYPE_MANUAL: string;
|
|
15
16
|
ORIGIN_AI_EDITOR: string;
|
|
16
17
|
};
|
package/dist/constants.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { RegionSchema } from './plugin/config/schema';
|
|
2
|
+
const VALID_REGIONS = Object.values(RegionSchema.Values);
|
|
2
3
|
export function isValidRegion(region) {
|
|
3
4
|
return VALID_REGIONS.includes(region);
|
|
4
5
|
}
|
|
@@ -26,7 +27,8 @@ export const KIRO_CONSTANTS = {
|
|
|
26
27
|
DEFAULT_REGION: 'us-east-1',
|
|
27
28
|
AXIOS_TIMEOUT: 120000,
|
|
28
29
|
USER_AGENT: 'KiroIDE',
|
|
29
|
-
|
|
30
|
+
SDK_VERSION: '3.738.0',
|
|
31
|
+
SDK_VERSION_USAGE: '3.0.0',
|
|
30
32
|
CHAT_TRIGGER_TYPE_MANUAL: 'MANUAL',
|
|
31
33
|
ORIGIN_AI_EDITOR: 'AI_EDITOR'
|
|
32
34
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const AccountSelectionStrategySchema: z.ZodEnum<["sticky", "round-robin", "lowest-usage"]>;
|
|
3
3
|
export type AccountSelectionStrategy = z.infer<typeof AccountSelectionStrategySchema>;
|
|
4
|
-
export declare const RegionSchema: z.ZodEnum<["us-east-1", "us-west-2"]>;
|
|
4
|
+
export declare const RegionSchema: z.ZodEnum<["us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-south-2", "ap-southeast-3", "ap-southeast-5", "ap-southeast-4", "ap-south-1", "ap-southeast-6", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-east-2", "ap-southeast-7", "ap-northeast-1", "ca-central-1", "ca-west-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-south-1", "eu-west-3", "eu-south-2", "eu-north-1", "eu-central-2", "il-central-1", "mx-central-1", "me-south-1", "me-central-1", "sa-east-1"]>;
|
|
5
5
|
export type Region = z.infer<typeof RegionSchema>;
|
|
6
6
|
export declare const KiroConfigSchema: z.ZodObject<{
|
|
7
7
|
$schema: z.ZodOptional<z.ZodString>;
|
|
8
8
|
idc_start_url: z.ZodOptional<z.ZodString>;
|
|
9
9
|
account_selection_strategy: z.ZodDefault<z.ZodEnum<["sticky", "round-robin", "lowest-usage"]>>;
|
|
10
|
-
default_region: z.ZodDefault<z.ZodEnum<["us-east-1", "us-west-2"]>>;
|
|
10
|
+
default_region: z.ZodDefault<z.ZodEnum<["us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-south-2", "ap-southeast-3", "ap-southeast-5", "ap-southeast-4", "ap-south-1", "ap-southeast-6", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-east-2", "ap-southeast-7", "ap-northeast-1", "ca-central-1", "ca-west-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-south-1", "eu-west-3", "eu-south-2", "eu-north-1", "eu-central-2", "il-central-1", "mx-central-1", "me-south-1", "me-central-1", "sa-east-1"]>>;
|
|
11
11
|
rate_limit_retry_delay_ms: z.ZodDefault<z.ZodNumber>;
|
|
12
12
|
rate_limit_max_retries: z.ZodDefault<z.ZodNumber>;
|
|
13
13
|
max_request_iterations: z.ZodDefault<z.ZodNumber>;
|
|
@@ -21,7 +21,7 @@ export declare const KiroConfigSchema: z.ZodObject<{
|
|
|
21
21
|
enable_log_api_request: z.ZodDefault<z.ZodBoolean>;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
23
|
account_selection_strategy: "sticky" | "round-robin" | "lowest-usage";
|
|
24
|
-
default_region: "us-east-1" | "us-west-2";
|
|
24
|
+
default_region: "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-east-1" | "ap-south-2" | "ap-southeast-3" | "ap-southeast-5" | "ap-southeast-4" | "ap-south-1" | "ap-southeast-6" | "ap-northeast-3" | "ap-northeast-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-east-2" | "ap-southeast-7" | "ap-northeast-1" | "ca-central-1" | "ca-west-1" | "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-south-1" | "eu-west-3" | "eu-south-2" | "eu-north-1" | "eu-central-2" | "il-central-1" | "mx-central-1" | "me-south-1" | "me-central-1" | "sa-east-1";
|
|
25
25
|
rate_limit_retry_delay_ms: number;
|
|
26
26
|
rate_limit_max_retries: number;
|
|
27
27
|
max_request_iterations: number;
|
|
@@ -39,7 +39,7 @@ export declare const KiroConfigSchema: z.ZodObject<{
|
|
|
39
39
|
$schema?: string | undefined;
|
|
40
40
|
idc_start_url?: string | undefined;
|
|
41
41
|
account_selection_strategy?: "sticky" | "round-robin" | "lowest-usage" | undefined;
|
|
42
|
-
default_region?: "us-east-1" | "us-west-2" | undefined;
|
|
42
|
+
default_region?: "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-east-1" | "ap-south-2" | "ap-southeast-3" | "ap-southeast-5" | "ap-southeast-4" | "ap-south-1" | "ap-southeast-6" | "ap-northeast-3" | "ap-northeast-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-east-2" | "ap-southeast-7" | "ap-northeast-1" | "ca-central-1" | "ca-west-1" | "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-south-1" | "eu-west-3" | "eu-south-2" | "eu-north-1" | "eu-central-2" | "il-central-1" | "mx-central-1" | "me-south-1" | "me-central-1" | "sa-east-1" | undefined;
|
|
43
43
|
rate_limit_retry_delay_ms?: number | undefined;
|
|
44
44
|
rate_limit_max_retries?: number | undefined;
|
|
45
45
|
max_request_iterations?: number | undefined;
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const AccountSelectionStrategySchema = z.enum(['sticky', 'round-robin', 'lowest-usage']);
|
|
3
|
-
export const RegionSchema = z.enum([
|
|
3
|
+
export const RegionSchema = z.enum([
|
|
4
|
+
'us-east-1',
|
|
5
|
+
'us-east-2',
|
|
6
|
+
'us-west-1',
|
|
7
|
+
'us-west-2',
|
|
8
|
+
'af-south-1',
|
|
9
|
+
'ap-east-1',
|
|
10
|
+
'ap-south-2',
|
|
11
|
+
'ap-southeast-3',
|
|
12
|
+
'ap-southeast-5',
|
|
13
|
+
'ap-southeast-4',
|
|
14
|
+
'ap-south-1',
|
|
15
|
+
'ap-southeast-6',
|
|
16
|
+
'ap-northeast-3',
|
|
17
|
+
'ap-northeast-2',
|
|
18
|
+
'ap-southeast-1',
|
|
19
|
+
'ap-southeast-2',
|
|
20
|
+
'ap-east-2',
|
|
21
|
+
'ap-southeast-7',
|
|
22
|
+
'ap-northeast-1',
|
|
23
|
+
'ca-central-1',
|
|
24
|
+
'ca-west-1',
|
|
25
|
+
'eu-central-1',
|
|
26
|
+
'eu-west-1',
|
|
27
|
+
'eu-west-2',
|
|
28
|
+
'eu-south-1',
|
|
29
|
+
'eu-west-3',
|
|
30
|
+
'eu-south-2',
|
|
31
|
+
'eu-north-1',
|
|
32
|
+
'eu-central-2',
|
|
33
|
+
'il-central-1',
|
|
34
|
+
'mx-central-1',
|
|
35
|
+
'me-south-1',
|
|
36
|
+
'me-central-1',
|
|
37
|
+
'sa-east-1'
|
|
38
|
+
]);
|
|
4
39
|
export const KiroConfigSchema = z.object({
|
|
5
40
|
$schema: z.string().optional(),
|
|
6
41
|
idc_start_url: z.string().url().optional(),
|
|
@@ -10,7 +45,7 @@ export const KiroConfigSchema = z.object({
|
|
|
10
45
|
rate_limit_max_retries: z.number().min(0).max(10).default(3),
|
|
11
46
|
max_request_iterations: z.number().min(5).max(1000).default(20),
|
|
12
47
|
request_timeout_ms: z.number().min(30000).max(600000).default(120000),
|
|
13
|
-
token_expiry_buffer_ms: z.number().min(30000).max(300000).default(
|
|
48
|
+
token_expiry_buffer_ms: z.number().min(30000).max(300000).default(300000),
|
|
14
49
|
usage_sync_max_retries: z.number().min(0).max(5).default(3),
|
|
15
50
|
auth_server_port_start: z.number().min(1024).max(65535).default(19847),
|
|
16
51
|
auth_server_port_range: z.number().min(1).max(100).default(10),
|
|
@@ -25,7 +60,7 @@ export const DEFAULT_CONFIG = {
|
|
|
25
60
|
rate_limit_max_retries: 3,
|
|
26
61
|
max_request_iterations: 20,
|
|
27
62
|
request_timeout_ms: 120000,
|
|
28
|
-
token_expiry_buffer_ms:
|
|
63
|
+
token_expiry_buffer_ms: 300000,
|
|
29
64
|
usage_sync_max_retries: 3,
|
|
30
65
|
auth_server_port_start: 19847,
|
|
31
66
|
auth_server_port_range: 10,
|
package/dist/plugin/request.js
CHANGED
|
@@ -215,13 +215,9 @@ export function transformToCodeWhisperer(url, body, model, auth, think = false,
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
const
|
|
219
|
-
.createHash('sha256')
|
|
220
|
-
.update(auth.profileArn || auth.clientId || 'KIRO_DEFAULT_MACHINE')
|
|
221
|
-
.digest('hex');
|
|
222
|
-
const osP = os.platform(), osR = os.release(), nodeV = process.version.replace('v', ''), kiroV = KIRO_CONSTANTS.KIRO_VERSION;
|
|
218
|
+
const osP = os.platform(), osR = os.release(), nodeV = process.version.replace('v', '');
|
|
223
219
|
const osN = osP === 'win32' ? `windows#${osR}` : osP === 'darwin' ? `macos#${osR}` : `${osP}#${osR}`;
|
|
224
|
-
const ua = `aws-sdk-js/
|
|
220
|
+
const ua = `aws-sdk-js/3.738.0 ua/2.1 os/${osN} lang/js md/nodejs#${nodeV} api/codewhisperer#3.738.0 m/E KiroIDE`;
|
|
225
221
|
return {
|
|
226
222
|
url: KIRO_CONSTANTS.BASE_URL.replace('{{region}}', auth.region),
|
|
227
223
|
init: {
|
|
@@ -233,7 +229,7 @@ export function transformToCodeWhisperer(url, body, model, auth, think = false,
|
|
|
233
229
|
'amz-sdk-invocation-id': crypto.randomUUID(),
|
|
234
230
|
'amz-sdk-request': 'attempt=1; max=1',
|
|
235
231
|
'x-amzn-kiro-agent-mode': 'vibe',
|
|
236
|
-
'x-amz-user-agent':
|
|
232
|
+
'x-amz-user-agent': 'aws-sdk-js/3.738.0 KiroIDE',
|
|
237
233
|
'user-agent': ua,
|
|
238
234
|
Connection: 'close'
|
|
239
235
|
},
|
package/dist/plugin/token.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
1
|
import { decodeRefreshToken, encodeRefreshToken } from '../kiro/auth';
|
|
3
2
|
import { KiroTokenRefreshError } from './errors';
|
|
4
3
|
export async function refreshAccessToken(auth) {
|
|
@@ -20,11 +19,9 @@ export async function refreshAccessToken(auth) {
|
|
|
20
19
|
: {
|
|
21
20
|
refreshToken: p.refreshToken
|
|
22
21
|
};
|
|
23
|
-
const
|
|
24
|
-
.
|
|
25
|
-
.
|
|
26
|
-
.digest('hex');
|
|
27
|
-
const ua = isIdc ? 'aws-sdk-js/1.0.0' : `KiroIDE-0.7.45-${machineId}`;
|
|
22
|
+
const ua = isIdc
|
|
23
|
+
? 'aws-sdk-js/3.738.0 ua/2.1 os/other lang/js md/browser#unknown_unknown api/sso-oidc#3.738.0 m/E KiroIDE'
|
|
24
|
+
: 'aws-sdk-js/3.0.0 KiroIDE-0.1.0 os/macos lang/js md/nodejs/18.0.0';
|
|
28
25
|
try {
|
|
29
26
|
const res = await fetch(url, {
|
|
30
27
|
method: 'POST',
|
package/dist/plugin/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { RegionSchema } from './config/schema';
|
|
1
3
|
export type KiroAuthMethod = 'idc' | 'desktop';
|
|
2
|
-
export type KiroRegion =
|
|
4
|
+
export type KiroRegion = z.infer<typeof RegionSchema>;
|
|
3
5
|
export interface KiroAuthDetails {
|
|
4
6
|
refresh: string;
|
|
5
7
|
access: string;
|