enhance Kiro profile ARN resolution

This commit is contained in:
decolua
2026-06-13 09:28:55 +07:00
parent 4443903900
commit b309261166
8 changed files with 40 additions and 22 deletions

View File

@@ -428,7 +428,7 @@ export async function refreshKiroToken(refreshToken, providerSpecificData, log,
accessToken: tokens.accessToken,
refreshToken: tokens.refreshToken || refreshToken,
expiresIn: tokens.expiresIn,
...(await resolveKiroProfileArnPatch(providerSpecificData, tokens.accessToken)),
...(await resolveKiroProfileArnPatch(providerSpecificData, tokens.accessToken, tokens.profileArn)),
};
}

View File

@@ -4,6 +4,7 @@
import { CLIENT_METADATA, getPlatformUserAgent } from "../config/appConstants.js";
import { proxyAwareFetch } from "../utils/proxyFetch.js";
import { resolveDefaultProfileArn } from "../config/kiroConstants.js";
// GitHub API config
const GITHUB_CONFIG = {
@@ -753,10 +754,8 @@ function parseKiroQuotaData(data) {
}
async function getKiroUsage(accessToken, providerSpecificData, proxyOptions = null) {
// Default profileArn fallback
const DEFAULT_PROFILE_ARN = "arn:aws:codewhisperer:us-east-1:638616132270:profile/AAAACCCCXXXX";
const profileArn = providerSpecificData?.profileArn || DEFAULT_PROFILE_ARN;
const authMethod = providerSpecificData?.authMethod || "builder-id";
const profileArn = providerSpecificData?.profileArn || resolveDefaultProfileArn(authMethod);
const getUsageParams = new URLSearchParams({
isEmailRequired: "true",