@ngosangns/ns-bridge 0.1.7 → 0.1.8
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/refresh-entry.js +75 -48
- package/package.json +1 -1
package/dist/refresh-entry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.8 — catalog refresh bundle.
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
var __create = Object.create;
|
|
@@ -18933,8 +18933,8 @@ function getBunSandboxEnvValue(name) {
|
|
|
18933
18933
|
if (procEnvCache === null) {
|
|
18934
18934
|
procEnvCache = /* @__PURE__ */ new Map();
|
|
18935
18935
|
try {
|
|
18936
|
-
const { readFileSync:
|
|
18937
|
-
const data =
|
|
18936
|
+
const { readFileSync: readFileSync8 } = __require("node:fs");
|
|
18937
|
+
const data = readFileSync8("/proc/self/environ", "utf-8");
|
|
18938
18938
|
for (const entry of data.split("\0")) {
|
|
18939
18939
|
const idx = entry.indexOf("=");
|
|
18940
18940
|
if (idx > 0) {
|
|
@@ -92324,8 +92324,8 @@ var init_typesafe_system_one = __esm({
|
|
|
92324
92324
|
|
|
92325
92325
|
// ../kiro-core/dist/debug.js
|
|
92326
92326
|
import { appendFileSync, mkdirSync as mkdirSync4 } from "node:fs";
|
|
92327
|
-
import { homedir as
|
|
92328
|
-
import { dirname as dirname5, join as
|
|
92327
|
+
import { homedir as homedir6 } from "node:os";
|
|
92328
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
92329
92329
|
function debugLog(section, data) {
|
|
92330
92330
|
if (!ENABLED)
|
|
92331
92331
|
return;
|
|
@@ -92361,7 +92361,7 @@ var init_debug = __esm({
|
|
|
92361
92361
|
"../kiro-core/dist/debug.js"() {
|
|
92362
92362
|
"use strict";
|
|
92363
92363
|
ENABLED = !!process.env.KIRO_DEBUG && process.env.KIRO_DEBUG !== "0";
|
|
92364
|
-
LOG_FILE = process.env.KIRO_DEBUG_LOG ||
|
|
92364
|
+
LOG_FILE = process.env.KIRO_DEBUG_LOG || join7(homedir6(), ".ns-kiro-provider", "logs", "kiro-debug.log");
|
|
92365
92365
|
dirReady = false;
|
|
92366
92366
|
PROFILE_ARN_PATTERN = /arn:[a-z0-9-]+:codewhisperer:[^:\s"']*:[^:\s"']*:profile\/[^\s"',}\]]+/gi;
|
|
92367
92367
|
BEARER_TOKEN_PATTERN = /(\bBearer\s+)[^\s"',}\]]+/gi;
|
|
@@ -92434,13 +92434,13 @@ __export(kiro_cli_exports, {
|
|
|
92434
92434
|
import { execFileSync, execSync } from "node:child_process";
|
|
92435
92435
|
import { existsSync as existsSync3 } from "node:fs";
|
|
92436
92436
|
import { createRequire } from "node:module";
|
|
92437
|
-
import { homedir as
|
|
92438
|
-
import { join as
|
|
92437
|
+
import { homedir as homedir7, platform } from "node:os";
|
|
92438
|
+
import { join as join8 } from "node:path";
|
|
92439
92439
|
function getKiroCliDbPath() {
|
|
92440
92440
|
const p = platform();
|
|
92441
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
92442
|
-
const roamingAppData = process.env.APPDATA ||
|
|
92443
|
-
const candidates = p === "win32" ? [
|
|
92441
|
+
const localAppData = process.env.LOCALAPPDATA || join8(homedir7(), "AppData", "Local");
|
|
92442
|
+
const roamingAppData = process.env.APPDATA || join8(homedir7(), "AppData", "Roaming");
|
|
92443
|
+
const candidates = p === "win32" ? [join8(localAppData, "Kiro-Cli", "data.sqlite3"), join8(roamingAppData, "kiro-cli", "data.sqlite3")] : p === "darwin" ? [join8(homedir7(), "Library", "Application Support", "kiro-cli", "data.sqlite3")] : [join8(homedir7(), ".local", "share", "kiro-cli", "data.sqlite3")];
|
|
92444
92444
|
return candidates.find((candidate) => existsSync3(candidate));
|
|
92445
92445
|
}
|
|
92446
92446
|
function getKiroCliExternalIdpCredentials() {
|
|
@@ -92821,14 +92821,14 @@ var init_http = __esm({
|
|
|
92821
92821
|
});
|
|
92822
92822
|
|
|
92823
92823
|
// ../kiro-core/dist/kiro-ide.js
|
|
92824
|
-
import { existsSync as existsSync4, readFileSync as
|
|
92825
|
-
import { homedir as
|
|
92826
|
-
import { join as
|
|
92824
|
+
import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
|
|
92825
|
+
import { homedir as homedir8 } from "node:os";
|
|
92826
|
+
import { join as join9 } from "node:path";
|
|
92827
92827
|
function readKiroIdeToken(allowExpired) {
|
|
92828
92828
|
try {
|
|
92829
92829
|
if (!existsSync4(KIRO_IDE_TOKEN_PATH))
|
|
92830
92830
|
return void 0;
|
|
92831
|
-
const tokenData = JSON.parse(
|
|
92831
|
+
const tokenData = JSON.parse(readFileSync6(KIRO_IDE_TOKEN_PATH, "utf-8"));
|
|
92832
92832
|
if (!tokenData.accessToken || !tokenData.refreshToken)
|
|
92833
92833
|
return void 0;
|
|
92834
92834
|
const expiresAt = new Date(tokenData.expiresAt).getTime();
|
|
@@ -92838,10 +92838,10 @@ function readKiroIdeToken(allowExpired) {
|
|
|
92838
92838
|
let clientId = "";
|
|
92839
92839
|
let clientSecret = "";
|
|
92840
92840
|
if (tokenData.clientIdHash) {
|
|
92841
|
-
const regPath =
|
|
92841
|
+
const regPath = join9(SSO_CACHE_DIR, `${tokenData.clientIdHash}.json`);
|
|
92842
92842
|
if (existsSync4(regPath)) {
|
|
92843
92843
|
try {
|
|
92844
|
-
const reg = JSON.parse(
|
|
92844
|
+
const reg = JSON.parse(readFileSync6(regPath, "utf-8"));
|
|
92845
92845
|
clientId = reg.clientId ?? "";
|
|
92846
92846
|
clientSecret = reg.clientSecret ?? "";
|
|
92847
92847
|
} catch {
|
|
@@ -92873,8 +92873,8 @@ var SSO_CACHE_DIR, KIRO_IDE_TOKEN_PATH;
|
|
|
92873
92873
|
var init_kiro_ide = __esm({
|
|
92874
92874
|
"../kiro-core/dist/kiro-ide.js"() {
|
|
92875
92875
|
"use strict";
|
|
92876
|
-
SSO_CACHE_DIR =
|
|
92877
|
-
KIRO_IDE_TOKEN_PATH =
|
|
92876
|
+
SSO_CACHE_DIR = join9(homedir8(), ".aws", "sso", "cache");
|
|
92877
|
+
KIRO_IDE_TOKEN_PATH = join9(SSO_CACHE_DIR, "kiro-auth-token.json");
|
|
92878
92878
|
}
|
|
92879
92879
|
});
|
|
92880
92880
|
|
|
@@ -96416,6 +96416,11 @@ async function refreshDevinModels(options = {}) {
|
|
|
96416
96416
|
return { models: getCachedModels().map(toPiDevinModel), fromCache };
|
|
96417
96417
|
}
|
|
96418
96418
|
|
|
96419
|
+
// ../pi-provider/src/grok/register.ts
|
|
96420
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
96421
|
+
import { homedir as homedir5 } from "node:os";
|
|
96422
|
+
import { join as join6 } from "node:path";
|
|
96423
|
+
|
|
96419
96424
|
// ../grok-core/dist/catalog.js
|
|
96420
96425
|
var GROK_BOOTSTRAP_MODEL_IDS = ["grok-4.7", "grok-4.7-build-fast", "grok-4.6", "grok-4.5"];
|
|
96421
96426
|
var GROK_DEFAULT_CONTEXT_WINDOW = 5e5;
|
|
@@ -96638,7 +96643,26 @@ async function resolveGrokBinary(env3 = process.env) {
|
|
|
96638
96643
|
|
|
96639
96644
|
// ../grok-core/dist/agent/models.js
|
|
96640
96645
|
import { execFile as execFile2 } from "node:child_process";
|
|
96641
|
-
function
|
|
96646
|
+
function grokContextWindowsFromCache(raw) {
|
|
96647
|
+
const windows = /* @__PURE__ */ new Map();
|
|
96648
|
+
if (!raw?.trim())
|
|
96649
|
+
return windows;
|
|
96650
|
+
try {
|
|
96651
|
+
const parsed = JSON.parse(raw);
|
|
96652
|
+
const models = parsed?.models;
|
|
96653
|
+
if (!models || typeof models !== "object")
|
|
96654
|
+
return windows;
|
|
96655
|
+
for (const [id, entry] of Object.entries(models)) {
|
|
96656
|
+
const info = entry?.info;
|
|
96657
|
+
const window2 = info?.context_window;
|
|
96658
|
+
if (typeof window2 === "number" && Number.isInteger(window2) && window2 > 0)
|
|
96659
|
+
windows.set(id, window2);
|
|
96660
|
+
}
|
|
96661
|
+
} catch {
|
|
96662
|
+
}
|
|
96663
|
+
return windows;
|
|
96664
|
+
}
|
|
96665
|
+
function parseGrokModelsOutput(stdout, contextWindows) {
|
|
96642
96666
|
const models = [];
|
|
96643
96667
|
const seen = /* @__PURE__ */ new Set();
|
|
96644
96668
|
const bullet = /^\s*[*•-]\s+(\S+)/;
|
|
@@ -96649,31 +96673,28 @@ function parseGrokModelsOutput(stdout) {
|
|
|
96649
96673
|
const id = m2[1].replace(/[(),]+$/g, "");
|
|
96650
96674
|
if (!seen.has(id)) {
|
|
96651
96675
|
seen.add(id);
|
|
96652
|
-
models.push(
|
|
96653
|
-
id,
|
|
96654
|
-
name: id,
|
|
96655
|
-
contextWindow: GROK_DEFAULT_CONTEXT_WINDOW,
|
|
96656
|
-
maxTokens: GROK_DEFAULT_MAX_TOKENS,
|
|
96657
|
-
supportsReasoningEffort: true
|
|
96658
|
-
});
|
|
96676
|
+
models.push(describe(id, contextWindows));
|
|
96659
96677
|
}
|
|
96660
96678
|
continue;
|
|
96661
96679
|
}
|
|
96662
96680
|
const d = line.match(defaultLine);
|
|
96663
96681
|
if (d && !seen.has(d[1])) {
|
|
96664
96682
|
seen.add(d[1]);
|
|
96665
|
-
models.unshift(
|
|
96666
|
-
id: d[1],
|
|
96667
|
-
name: d[1],
|
|
96668
|
-
contextWindow: GROK_DEFAULT_CONTEXT_WINDOW,
|
|
96669
|
-
maxTokens: GROK_DEFAULT_MAX_TOKENS,
|
|
96670
|
-
supportsReasoningEffort: true
|
|
96671
|
-
});
|
|
96683
|
+
models.unshift(describe(d[1], contextWindows));
|
|
96672
96684
|
}
|
|
96673
96685
|
}
|
|
96674
96686
|
return models;
|
|
96675
96687
|
}
|
|
96676
|
-
|
|
96688
|
+
function describe(id, contextWindows) {
|
|
96689
|
+
return {
|
|
96690
|
+
id,
|
|
96691
|
+
name: id,
|
|
96692
|
+
contextWindow: contextWindows?.get(id) ?? GROK_DEFAULT_CONTEXT_WINDOW,
|
|
96693
|
+
maxTokens: GROK_DEFAULT_MAX_TOKENS,
|
|
96694
|
+
supportsReasoningEffort: true
|
|
96695
|
+
};
|
|
96696
|
+
}
|
|
96697
|
+
async function discoverGrokModels(binary, contextWindows) {
|
|
96677
96698
|
try {
|
|
96678
96699
|
const bin = binary ?? await resolveGrokBinary();
|
|
96679
96700
|
const stdout = await new Promise((resolve2, reject) => {
|
|
@@ -96684,7 +96705,7 @@ async function discoverGrokModels(binary) {
|
|
|
96684
96705
|
resolve2(out);
|
|
96685
96706
|
});
|
|
96686
96707
|
});
|
|
96687
|
-
const parsed = parseGrokModelsOutput(stdout);
|
|
96708
|
+
const parsed = parseGrokModelsOutput(stdout, contextWindows);
|
|
96688
96709
|
if (parsed.length === 0) {
|
|
96689
96710
|
return { models: [], source: "fallback", error: "empty model list from CLI" };
|
|
96690
96711
|
}
|
|
@@ -96722,8 +96743,8 @@ function fallbackModels() {
|
|
|
96722
96743
|
supportsReasoningEffort: model.reasoning
|
|
96723
96744
|
}));
|
|
96724
96745
|
}
|
|
96725
|
-
async function discoverModels(binary) {
|
|
96726
|
-
const discovered = await discoverGrokModels(binary);
|
|
96746
|
+
async function discoverModels(binary, contextCache) {
|
|
96747
|
+
const discovered = await discoverGrokModels(binary, grokContextWindowsFromCache(contextCache));
|
|
96727
96748
|
if (discovered.source === "live") return discovered;
|
|
96728
96749
|
return { ...discovered, models: fallbackModels() };
|
|
96729
96750
|
}
|
|
@@ -98586,7 +98607,13 @@ async function refreshGrokModels(options = {}) {
|
|
|
98586
98607
|
} catch {
|
|
98587
98608
|
binary = void 0;
|
|
98588
98609
|
}
|
|
98589
|
-
|
|
98610
|
+
let contextCache;
|
|
98611
|
+
try {
|
|
98612
|
+
contextCache = readFileSync5(join6(homedir5(), ".grok", "models_cache.json"), "utf8");
|
|
98613
|
+
} catch {
|
|
98614
|
+
contextCache = void 0;
|
|
98615
|
+
}
|
|
98616
|
+
const discovered = await discoverModels(binary, contextCache);
|
|
98590
98617
|
const catalog = descriptorsToCatalog(discovered.models);
|
|
98591
98618
|
cache.store(GROK_PROVIDER_ID, catalog, { version: "grok-cli-v1" });
|
|
98592
98619
|
return {
|
|
@@ -98689,9 +98716,9 @@ async function resolveKiroRequestCredentials(hostKey) {
|
|
|
98689
98716
|
|
|
98690
98717
|
// ../kiro-core/dist/models.js
|
|
98691
98718
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
98692
|
-
import { existsSync as existsSync5, readFileSync as
|
|
98693
|
-
import { homedir as
|
|
98694
|
-
import { join as
|
|
98719
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
98720
|
+
import { homedir as homedir9 } from "node:os";
|
|
98721
|
+
import { join as join10 } from "node:path";
|
|
98695
98722
|
|
|
98696
98723
|
// ../kiro-core/dist/types.js
|
|
98697
98724
|
var KIRO_EFFORT_ORDER = ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
@@ -98759,7 +98786,7 @@ function getKiroEffortConfig(schema, kiroModelId) {
|
|
|
98759
98786
|
init_endpoints();
|
|
98760
98787
|
var KIRO_MANAGEMENT_CACHE_VERSION = 1;
|
|
98761
98788
|
var KIRO_MANAGEMENT_CACHE_SOURCE = "ns-kiro-provider-management";
|
|
98762
|
-
var KIRO_MANAGEMENT_CACHE_PATH =
|
|
98789
|
+
var KIRO_MANAGEMENT_CACHE_PATH = join10(homedir9(), ".ns-kiro-provider-models-cache.json");
|
|
98763
98790
|
var CACHE_MAX_AGE_MS = 36e5;
|
|
98764
98791
|
var DEFAULT_CONTEXT_WINDOW3 = 2e5;
|
|
98765
98792
|
var DEFAULT_MAX_TOKENS3 = 8192;
|
|
@@ -99032,7 +99059,7 @@ function readManagementCache() {
|
|
|
99032
99059
|
if (!existsSync5(KIRO_MANAGEMENT_CACHE_PATH))
|
|
99033
99060
|
return void 0;
|
|
99034
99061
|
try {
|
|
99035
|
-
return parseManagementCache(
|
|
99062
|
+
return parseManagementCache(readFileSync7(KIRO_MANAGEMENT_CACHE_PATH, "utf-8"));
|
|
99036
99063
|
} catch {
|
|
99037
99064
|
return void 0;
|
|
99038
99065
|
}
|
|
@@ -99236,10 +99263,10 @@ init_oauth();
|
|
|
99236
99263
|
init_token_type();
|
|
99237
99264
|
|
|
99238
99265
|
// ../kiro-core/dist/transport.js
|
|
99239
|
-
import { homedir as
|
|
99240
|
-
import { join as
|
|
99241
|
-
var CAPACITY_LOG_DIR =
|
|
99242
|
-
var CAPACITY_LOG_FILE =
|
|
99266
|
+
import { homedir as homedir10 } from "node:os";
|
|
99267
|
+
import { join as join11 } from "node:path";
|
|
99268
|
+
var CAPACITY_LOG_DIR = join11(homedir10(), ".ns-kiro-provider", "logs");
|
|
99269
|
+
var CAPACITY_LOG_FILE = join11(CAPACITY_LOG_DIR, "capacity-retries.log");
|
|
99243
99270
|
|
|
99244
99271
|
// ../kiro-core/dist/usage-tracking.js
|
|
99245
99272
|
var DEFAULT_USD_PER_CREDIT = 0.04;
|