ns-omp-provider-kiro 0.3.0 → 0.3.2
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/index.js +23 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -292,6 +292,7 @@ __export(kiro_cli_exports, {
|
|
|
292
292
|
getKiroCliCredentials: () => getKiroCliCredentials,
|
|
293
293
|
getKiroCliCredentialsAllowExpired: () => getKiroCliCredentialsAllowExpired,
|
|
294
294
|
getKiroCliDbPath: () => getKiroCliDbPath,
|
|
295
|
+
getKiroCliExternalIdpCredentials: () => getKiroCliExternalIdpCredentials,
|
|
295
296
|
getKiroCliModelRates: () => getKiroCliModelRates,
|
|
296
297
|
getKiroCliSocialToken: () => getKiroCliSocialToken,
|
|
297
298
|
getKiroCliSocialTokenAllowExpired: () => getKiroCliSocialTokenAllowExpired,
|
|
@@ -315,6 +316,16 @@ function getKiroCliDbPath() {
|
|
|
315
316
|
dbPath = join2(homedir2(), ".local", "share", "kiro-cli", "data.sqlite3");
|
|
316
317
|
return existsSync(dbPath) ? dbPath : void 0;
|
|
317
318
|
}
|
|
319
|
+
function getKiroCliExternalIdpCredentials() {
|
|
320
|
+
const dbPath = getKiroCliDbPath();
|
|
321
|
+
if (!dbPath)
|
|
322
|
+
return void 0;
|
|
323
|
+
try {
|
|
324
|
+
return tryKiroCliToken(dbPath, EXTERNAL_IDP_TOKEN_KEY, "external-idp", true);
|
|
325
|
+
} catch {
|
|
326
|
+
return void 0;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
318
329
|
function getNodeSqlite() {
|
|
319
330
|
try {
|
|
320
331
|
return require2("node:sqlite");
|
|
@@ -887,17 +898,21 @@ var init_oauth = __esm({
|
|
|
887
898
|
|
|
888
899
|
// ../kiro-core/dist/token-type.js
|
|
889
900
|
function isExternalIdpAccessToken(accessToken) {
|
|
890
|
-
if (typeof accessToken !== "string")
|
|
901
|
+
if (typeof accessToken !== "string" || !accessToken)
|
|
891
902
|
return false;
|
|
892
903
|
const segments = accessToken.split(".");
|
|
893
|
-
if (segments.length !== 3)
|
|
894
|
-
return false;
|
|
895
904
|
const payloadSegment = segments[1];
|
|
896
|
-
if (
|
|
897
|
-
|
|
905
|
+
if (segments.length === 3 && payloadSegment) {
|
|
906
|
+
try {
|
|
907
|
+
const payload = JSON.parse(Buffer.from(payloadSegment.replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf-8"));
|
|
908
|
+
if (payload.aud === EXTERNAL_IDP_AUDIENCE || Array.isArray(payload.aud) && payload.aud.includes(EXTERNAL_IDP_AUDIENCE)) {
|
|
909
|
+
return true;
|
|
910
|
+
}
|
|
911
|
+
} catch {
|
|
912
|
+
}
|
|
913
|
+
}
|
|
898
914
|
try {
|
|
899
|
-
|
|
900
|
-
return payload.aud === EXTERNAL_IDP_AUDIENCE;
|
|
915
|
+
return getKiroCliExternalIdpCredentials()?.access === accessToken;
|
|
901
916
|
} catch {
|
|
902
917
|
return false;
|
|
903
918
|
}
|
|
@@ -909,6 +924,7 @@ var EXTERNAL_IDP_AUDIENCE;
|
|
|
909
924
|
var init_token_type = __esm({
|
|
910
925
|
"../kiro-core/dist/token-type.js"() {
|
|
911
926
|
"use strict";
|
|
927
|
+
init_kiro_cli();
|
|
912
928
|
EXTERNAL_IDP_AUDIENCE = "api://kiro";
|
|
913
929
|
}
|
|
914
930
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ns-omp-provider-kiro",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "OMP (oh-my-pi) provider plugin: adds Kiro (AWS CodeWhisperer/Q) models via your kiro-cli login",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"README.md"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"ns-kiro-core": "0.3.
|
|
40
|
+
"ns-kiro-core": "0.3.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@oh-my-pi/pi-ai": ">=18.2.0",
|