@ngosangns/ns-bridge 0.1.31 → 0.1.32
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/hosts/dsh/arnict/dist/index.js +1 -1
- package/dist/hosts/dsh/devin/dist/index.js +1 -1
- package/dist/hosts/dsh/grok/dist/index.js +1 -1
- package/dist/hosts/dsh/kiro/dist/index.js +1 -1
- package/dist/hosts/dsh/qoder/dist/index.js +24 -51
- package/dist/hosts/omp/dist/index.js +207 -79
- package/dist/hosts/omp/package.json +1 -1
- package/dist/hosts/pi/dist/index.js +86 -86
- package/dist/hosts/pi/package.json +1 -1
- package/dist/refresh-entry.js +3 -5
- package/dist/serve-entry.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.32 — prebuilt host bundle.
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.32 — prebuilt host bundle.
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
|
|
@@ -1860,14 +1860,13 @@ function requireQoderAuth(env = process.env, home = homedir2()) {
|
|
|
1860
1860
|
|
|
1861
1861
|
// ../qoder-core/dist/catalog.js
|
|
1862
1862
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
1863
|
+
import { homedir as homedir3 } from "node:os";
|
|
1863
1864
|
import { join as join3 } from "node:path";
|
|
1864
1865
|
var QODER_CATALOG_PROVIDER_ID = "qoder";
|
|
1865
1866
|
var QODER_CATALOG_FILE = `${QODER_CATALOG_PROVIDER_ID}.models.json`;
|
|
1866
1867
|
var QODER_CATALOG_CACHE_DIR_ENV = "NS_QODER_CATALOG_CACHE_DIR";
|
|
1867
1868
|
var QODER_DEFAULT_MAX_TOKENS = 16384;
|
|
1868
|
-
var
|
|
1869
|
-
var QODER_WIRE_CONTEXT_WINDOW = QODER_WIRE_BODY_LIMIT_BYTES / 4;
|
|
1870
|
-
var QODER_DEFAULT_CONTEXT_WINDOW = QODER_WIRE_CONTEXT_WINDOW;
|
|
1869
|
+
var QODER_DEFAULT_CONTEXT_WINDOW = 2e5;
|
|
1871
1870
|
var BOOTSTRAP_IDS = [
|
|
1872
1871
|
"auto",
|
|
1873
1872
|
"ultimate",
|
|
@@ -1914,6 +1913,14 @@ function qoderBootstrapModels() {
|
|
|
1914
1913
|
function qoderCatalogPath(cacheDir) {
|
|
1915
1914
|
return join3(cacheDir, QODER_CATALOG_FILE);
|
|
1916
1915
|
}
|
|
1916
|
+
function qoderCatalogCacheDir(env = process.env, home = homedir3()) {
|
|
1917
|
+
const override = env[QODER_CATALOG_CACHE_DIR_ENV]?.trim();
|
|
1918
|
+
return override || join3(home, ".pi", "agent", "cache", "ns-pi-provider");
|
|
1919
|
+
}
|
|
1920
|
+
function resolveQoderModelSpec(modelId, cacheDir = qoderCatalogCacheDir()) {
|
|
1921
|
+
const listed = readQoderCatalog({ cacheDir });
|
|
1922
|
+
return listed.find((model) => model.id === modelId) ?? qoderBootstrapModels().find((model) => model.id === modelId);
|
|
1923
|
+
}
|
|
1917
1924
|
function readQoderCatalog(options) {
|
|
1918
1925
|
try {
|
|
1919
1926
|
const raw = readFileSync3(qoderCatalogPath(options.cacheDir), "utf8");
|
|
@@ -1951,7 +1958,7 @@ function qoderModelFromInfo(info) {
|
|
|
1951
1958
|
name: info.displayName ?? QODER_MODEL_DISPLAY_NAMES[info.value] ?? info.value,
|
|
1952
1959
|
reasoning: info.isReasoning === true || efforts.length > 0,
|
|
1953
1960
|
input: info.isVl === true ? ["text", "image"] : ["text"],
|
|
1954
|
-
contextWindow:
|
|
1961
|
+
contextWindow: declared,
|
|
1955
1962
|
maxTokens: positive(info.maxOutputTokens) ? info.maxOutputTokens : QODER_DEFAULT_MAX_TOKENS,
|
|
1956
1963
|
...efforts.length > 0 ? { efforts } : {}
|
|
1957
1964
|
};
|
|
@@ -2009,7 +2016,9 @@ function toWireMessage(message) {
|
|
|
2009
2016
|
return void 0;
|
|
2010
2017
|
return {
|
|
2011
2018
|
role: "assistant",
|
|
2012
|
-
|
|
2019
|
+
// Kimi, DeepSeek-Flash and MiniMax reject a tool-only turn whose content is
|
|
2020
|
+
// null. An empty string is the same "no text" and those models accept it.
|
|
2021
|
+
content: text || "",
|
|
2013
2022
|
...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
|
|
2014
2023
|
};
|
|
2015
2024
|
}
|
|
@@ -2144,7 +2153,7 @@ function reduceWireChunk(state, chunk) {
|
|
|
2144
2153
|
ensureStart(state, events);
|
|
2145
2154
|
if (typeof record.id === "string" && record.id)
|
|
2146
2155
|
state.responseId = record.id;
|
|
2147
|
-
if (typeof record.model === "string" && record.model)
|
|
2156
|
+
if (typeof record.model === "string" && record.model && record.model !== "auto")
|
|
2148
2157
|
state.upstreamModel = record.model;
|
|
2149
2158
|
if (record.raw_usage !== void 0 || record.usage !== void 0) {
|
|
2150
2159
|
const raw = record.raw_usage ?? record.usage;
|
|
@@ -2285,40 +2294,6 @@ function machineOs() {
|
|
|
2285
2294
|
const arch = process.arch === "arm64" ? "aarch64" : process.arch;
|
|
2286
2295
|
return `${arch}_${process.platform}`;
|
|
2287
2296
|
}
|
|
2288
|
-
function estimateQoderBodyBytes(payload) {
|
|
2289
|
-
try {
|
|
2290
|
-
return Buffer.byteLength(JSON.stringify(payload));
|
|
2291
|
-
} catch {
|
|
2292
|
-
return Number.MAX_SAFE_INTEGER;
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
function fitQoderBody(payload) {
|
|
2296
|
-
const messages = payload.messages;
|
|
2297
|
-
if (!Array.isArray(messages) || messages.length <= 1)
|
|
2298
|
-
return payload;
|
|
2299
|
-
if (estimateQoderBodyBytes(payload) <= QODER_WIRE_BODY_LIMIT_BYTES)
|
|
2300
|
-
return payload;
|
|
2301
|
-
const kept = messages.slice();
|
|
2302
|
-
while (kept.length > 1 && estimateQoderBodyBytes({ ...payload, messages: kept }) > QODER_WIRE_BODY_LIMIT_BYTES) {
|
|
2303
|
-
const dropped = kept[0];
|
|
2304
|
-
kept.shift();
|
|
2305
|
-
if (dropped?.role === "assistant" && Array.isArray(dropped.tool_calls) && dropped.tool_calls.length > 0) {
|
|
2306
|
-
const toolCallIds = new Set(dropped.tool_calls.map((tc) => tc && typeof tc === "object" && "id" in tc ? tc.id : void 0).filter((id) => typeof id === "string"));
|
|
2307
|
-
while (kept.length > 1) {
|
|
2308
|
-
const next = kept[0];
|
|
2309
|
-
if (next?.role === "tool" && typeof next.tool_call_id === "string" && toolCallIds.has(next.tool_call_id)) {
|
|
2310
|
-
kept.shift();
|
|
2311
|
-
toolCallIds.delete(next.tool_call_id);
|
|
2312
|
-
if (toolCallIds.size === 0)
|
|
2313
|
-
break;
|
|
2314
|
-
} else {
|
|
2315
|
-
break;
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
return { ...payload, messages: kept };
|
|
2321
|
-
}
|
|
2322
2297
|
function toWireTool(tool) {
|
|
2323
2298
|
return {
|
|
2324
2299
|
type: "function",
|
|
@@ -2347,7 +2322,7 @@ function lastUserText(messages) {
|
|
|
2347
2322
|
}
|
|
2348
2323
|
function buildRequestBody(options, sessionId) {
|
|
2349
2324
|
const requestId = randomUUID();
|
|
2350
|
-
const spec =
|
|
2325
|
+
const spec = resolveQoderModelSpec(options.model);
|
|
2351
2326
|
const text = lastUserText(options.messages);
|
|
2352
2327
|
const maxTokens = spec?.maxTokens ?? QODER_DEFAULT_MAX_TOKENS;
|
|
2353
2328
|
const payload = {
|
|
@@ -2462,6 +2437,9 @@ function unwrapWireChunk(chunk) {
|
|
|
2462
2437
|
} catch {
|
|
2463
2438
|
}
|
|
2464
2439
|
const status = typeof record.statusCode === "string" ? record.statusCode : String(record.statusCodeValue);
|
|
2440
|
+
if (status === "PAYLOAD_TOO_LARGE") {
|
|
2441
|
+
throw new QoderApiError(`Qoder prompt is too long for this model's context window (${status}${detail ? `: ${detail}` : ""})`);
|
|
2442
|
+
}
|
|
2465
2443
|
throw new QoderApiError(`Qoder model server rejected the request (${status}${detail ? `: ${detail}` : ""})`);
|
|
2466
2444
|
}
|
|
2467
2445
|
try {
|
|
@@ -2548,12 +2526,7 @@ async function* streamQoderResponse(options) {
|
|
|
2548
2526
|
if (payload.messages.length === 0)
|
|
2549
2527
|
throw new QoderApiError("Qoder prompt is empty");
|
|
2550
2528
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2551
|
-
const
|
|
2552
|
-
const body = JSON.stringify(fittedPayload);
|
|
2553
|
-
const bodyBytes = Buffer.byteLength(body);
|
|
2554
|
-
if (bodyBytes > QODER_WIRE_BODY_LIMIT_BYTES) {
|
|
2555
|
-
throw new QoderApiError(`Qoder prompt is too long for this model's context window (${bodyBytes} bytes > ${QODER_WIRE_BODY_LIMIT_BYTES} bytes)`);
|
|
2556
|
-
}
|
|
2529
|
+
const body = JSON.stringify(payload);
|
|
2557
2530
|
const origin = qoderWireUrl(process.env.QODER_MODEL_SERVER_HOST, options.endpoint);
|
|
2558
2531
|
const identity = readQoderSigningIdentity(qoderConfigDir()) ?? ANONYMOUS_SIGNING_IDENTITY;
|
|
2559
2532
|
const signed = signQoderInferRequest(origin, body, options.model, "system", identity, QODER_WIRE_VERSION);
|
|
@@ -2596,7 +2569,7 @@ async function* streamQoderResponse(options) {
|
|
|
2596
2569
|
}
|
|
2597
2570
|
}
|
|
2598
2571
|
function streamQoder(options) {
|
|
2599
|
-
const contextWindow =
|
|
2572
|
+
const contextWindow = resolveQoderModelSpec(options.model)?.contextWindow ?? QODER_DEFAULT_CONTEXT_WINDOW;
|
|
2600
2573
|
return recordUsage(streamQoderResponse(options), {
|
|
2601
2574
|
vendor: "qoder",
|
|
2602
2575
|
model: options.model,
|
|
@@ -2607,9 +2580,9 @@ function streamQoder(options) {
|
|
|
2607
2580
|
}
|
|
2608
2581
|
|
|
2609
2582
|
// ../dsh-llm-qoder/src/catalog.ts
|
|
2610
|
-
import { homedir as
|
|
2583
|
+
import { homedir as homedir4 } from "node:os";
|
|
2611
2584
|
import { join as join4 } from "node:path";
|
|
2612
|
-
function readQoderCatalogFile(home =
|
|
2585
|
+
function readQoderCatalogFile(home = homedir4(), env = process.env) {
|
|
2613
2586
|
const override = env[QODER_CATALOG_CACHE_DIR_ENV]?.trim();
|
|
2614
2587
|
const cacheDir = override || join4(home, ".pi", "agent", "cache", "ns-pi-provider");
|
|
2615
2588
|
return readQoderCatalog({ cacheDir });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.32 — prebuilt host bundle.
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -4727,13 +4727,12 @@ function createProviderConfig(models) {
|
|
|
4727
4727
|
api: ARNICT_API,
|
|
4728
4728
|
models,
|
|
4729
4729
|
streamSimple: streamArnictForPi,
|
|
4730
|
-
// OMP
|
|
4731
|
-
//
|
|
4732
|
-
//
|
|
4733
|
-
// null here and do not become that authoritative list.
|
|
4730
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
4731
|
+
// A disk snapshot, fresh or past the 15-minute TTL, is a real catalog. The
|
|
4732
|
+
// bootstrap list stays null so it is not pinned as authoritative for 24h.
|
|
4734
4733
|
fetchDynamicModels: async () => {
|
|
4735
4734
|
const latest = await refreshArnictModels({ allowNetwork: false });
|
|
4736
|
-
if (
|
|
4735
|
+
if (latest.source !== "cache" || latest.models.length === 0) return null;
|
|
4737
4736
|
return latest.models;
|
|
4738
4737
|
},
|
|
4739
4738
|
async refreshModels() {
|
|
@@ -5454,7 +5453,6 @@ init_endpoints();
|
|
|
5454
5453
|
var KIRO_MANAGEMENT_CACHE_VERSION = 1;
|
|
5455
5454
|
var KIRO_MANAGEMENT_CACHE_SOURCE = "ns-kiro-provider-management";
|
|
5456
5455
|
var KIRO_MANAGEMENT_CACHE_PATH = join8(homedir8(), ".ns-kiro-provider-models-cache.json");
|
|
5457
|
-
var CACHE_MAX_AGE_MS = 36e5;
|
|
5458
5456
|
var ZERO_COST = Object.freeze({ input: 0, output: 0, cacheRead: 0, cacheWrite: 0 });
|
|
5459
5457
|
var bootstrapKiroModels = [
|
|
5460
5458
|
{
|
|
@@ -5743,6 +5741,11 @@ function allCacheEntries(cache) {
|
|
|
5743
5741
|
function kiroProfileCacheKey(profileArn) {
|
|
5744
5742
|
return createHash2("sha256").update(profileArn).digest("base64url").slice(0, 16);
|
|
5745
5743
|
}
|
|
5744
|
+
function hasCachedKiroCatalog(region) {
|
|
5745
|
+
const cache = readManagementCache();
|
|
5746
|
+
const models = activeCacheEntry(cache, region)?.models ?? cache?.regions[region]?.models;
|
|
5747
|
+
return Array.isArray(models) && models.length > 0;
|
|
5748
|
+
}
|
|
5746
5749
|
function activeCacheEntry(cache, region) {
|
|
5747
5750
|
const override = getKiroProfileOverride();
|
|
5748
5751
|
return override ? cache?.profiles?.[kiroProfileCacheKey(override.arn)] : cache?.regions[region];
|
|
@@ -5809,10 +5812,6 @@ function getCachedModels(region) {
|
|
|
5809
5812
|
});
|
|
5810
5813
|
return changed ? corrected : models;
|
|
5811
5814
|
}
|
|
5812
|
-
function isCacheStale(region) {
|
|
5813
|
-
const entry = activeCacheEntry(readManagementCache(), region);
|
|
5814
|
-
return !entry || Date.now() - entry.fetchedAt > CACHE_MAX_AGE_MS;
|
|
5815
|
-
}
|
|
5816
5815
|
function resolveKiroModel(modelId, exactKiroModelId) {
|
|
5817
5816
|
if (exactKiroModelId)
|
|
5818
5817
|
return exactKiroModelId;
|
|
@@ -8478,13 +8477,12 @@ ${current.models.map((model) => model.id).join("\n")}`;
|
|
|
8478
8477
|
authHeader: false,
|
|
8479
8478
|
streamSimple: streamKiroForPi,
|
|
8480
8479
|
models: current.models,
|
|
8481
|
-
// OMP
|
|
8482
|
-
//
|
|
8483
|
-
//
|
|
8484
|
-
// in place and does not lock a stale catalog.
|
|
8480
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
8481
|
+
// A disk catalog is returned even past the 1h TTL. No disk entry stays null
|
|
8482
|
+
// so the bootstrap list is not pinned as authoritative for 24h.
|
|
8485
8483
|
fetchDynamicModels: async () => {
|
|
8486
8484
|
const latest = localKiroCatalog();
|
|
8487
|
-
if (latest.models.length === 0 ||
|
|
8485
|
+
if (latest.models.length === 0 || !hasCachedKiroCatalog(latest.region)) return null;
|
|
8488
8486
|
return latest.models;
|
|
8489
8487
|
},
|
|
8490
8488
|
async refreshModels() {
|
|
@@ -8962,12 +8960,14 @@ function requireQoderAuth(env = process.env, home = homedir10()) {
|
|
|
8962
8960
|
}
|
|
8963
8961
|
|
|
8964
8962
|
// ../qoder-core/dist/catalog.js
|
|
8963
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
8964
|
+
import { homedir as homedir11 } from "node:os";
|
|
8965
|
+
import { join as join11 } from "node:path";
|
|
8965
8966
|
var QODER_CATALOG_PROVIDER_ID = "qoder";
|
|
8966
8967
|
var QODER_CATALOG_FILE = `${QODER_CATALOG_PROVIDER_ID}.models.json`;
|
|
8968
|
+
var QODER_CATALOG_CACHE_DIR_ENV = "NS_QODER_CATALOG_CACHE_DIR";
|
|
8967
8969
|
var QODER_DEFAULT_MAX_TOKENS = 16384;
|
|
8968
|
-
var
|
|
8969
|
-
var QODER_WIRE_CONTEXT_WINDOW = QODER_WIRE_BODY_LIMIT_BYTES / 4;
|
|
8970
|
-
var QODER_DEFAULT_CONTEXT_WINDOW = QODER_WIRE_CONTEXT_WINDOW;
|
|
8970
|
+
var QODER_DEFAULT_CONTEXT_WINDOW = 2e5;
|
|
8971
8971
|
var BOOTSTRAP_IDS = [
|
|
8972
8972
|
"auto",
|
|
8973
8973
|
"ultimate",
|
|
@@ -9011,6 +9011,28 @@ var QODER_MODEL_DISPLAY_NAMES = {
|
|
|
9011
9011
|
function qoderBootstrapModels() {
|
|
9012
9012
|
return BOOTSTRAP_IDS.map((value) => qoderModelFromInfo({ value, isEnabled: true }));
|
|
9013
9013
|
}
|
|
9014
|
+
function qoderCatalogPath(cacheDir) {
|
|
9015
|
+
return join11(cacheDir, QODER_CATALOG_FILE);
|
|
9016
|
+
}
|
|
9017
|
+
function qoderCatalogCacheDir(env = process.env, home = homedir11()) {
|
|
9018
|
+
const override = env[QODER_CATALOG_CACHE_DIR_ENV]?.trim();
|
|
9019
|
+
return override || join11(home, ".pi", "agent", "cache", "ns-pi-provider");
|
|
9020
|
+
}
|
|
9021
|
+
function resolveQoderModelSpec(modelId, cacheDir = qoderCatalogCacheDir()) {
|
|
9022
|
+
const listed2 = readQoderCatalog({ cacheDir });
|
|
9023
|
+
return listed2.find((model) => model.id === modelId) ?? qoderBootstrapModels().find((model) => model.id === modelId);
|
|
9024
|
+
}
|
|
9025
|
+
function readQoderCatalog(options) {
|
|
9026
|
+
try {
|
|
9027
|
+
const raw = readFileSync7(qoderCatalogPath(options.cacheDir), "utf8");
|
|
9028
|
+
const parsed = JSON.parse(raw);
|
|
9029
|
+
if (!parsed?.models?.length)
|
|
9030
|
+
return qoderBootstrapModels();
|
|
9031
|
+
return parsed.models;
|
|
9032
|
+
} catch {
|
|
9033
|
+
return qoderBootstrapModels();
|
|
9034
|
+
}
|
|
9035
|
+
}
|
|
9014
9036
|
var EFFORT_ORDER = ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
9015
9037
|
function positive(value) {
|
|
9016
9038
|
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
@@ -9031,7 +9053,7 @@ function qoderModelFromInfo(info) {
|
|
|
9031
9053
|
name: info.displayName ?? QODER_MODEL_DISPLAY_NAMES[info.value] ?? info.value,
|
|
9032
9054
|
reasoning: info.isReasoning === true || efforts.length > 0,
|
|
9033
9055
|
input: info.isVl === true ? ["text", "image"] : ["text"],
|
|
9034
|
-
contextWindow:
|
|
9056
|
+
contextWindow: declared,
|
|
9035
9057
|
maxTokens: positive(info.maxOutputTokens) ? info.maxOutputTokens : QODER_DEFAULT_MAX_TOKENS,
|
|
9036
9058
|
...efforts.length > 0 ? { efforts } : {}
|
|
9037
9059
|
};
|
|
@@ -9097,8 +9119,8 @@ function qoderModelInfosFromVendorCatalog(raw, scene) {
|
|
|
9097
9119
|
}
|
|
9098
9120
|
|
|
9099
9121
|
// ../qoder-core/dist/models-api.js
|
|
9100
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
9101
|
-
import { join as
|
|
9122
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync8, statSync as statSync2 } from "node:fs";
|
|
9123
|
+
import { join as join12 } from "node:path";
|
|
9102
9124
|
|
|
9103
9125
|
// ../qoder-core/dist/stream.js
|
|
9104
9126
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -9150,7 +9172,9 @@ function toWireMessage(message) {
|
|
|
9150
9172
|
return void 0;
|
|
9151
9173
|
return {
|
|
9152
9174
|
role: "assistant",
|
|
9153
|
-
|
|
9175
|
+
// Kimi, DeepSeek-Flash and MiniMax reject a tool-only turn whose content is
|
|
9176
|
+
// null. An empty string is the same "no text" and those models accept it.
|
|
9177
|
+
content: text || "",
|
|
9154
9178
|
...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
|
|
9155
9179
|
};
|
|
9156
9180
|
}
|
|
@@ -9285,7 +9309,7 @@ function reduceWireChunk(state, chunk) {
|
|
|
9285
9309
|
ensureStart2(state, events);
|
|
9286
9310
|
if (typeof record.id === "string" && record.id)
|
|
9287
9311
|
state.responseId = record.id;
|
|
9288
|
-
if (typeof record.model === "string" && record.model)
|
|
9312
|
+
if (typeof record.model === "string" && record.model && record.model !== "auto")
|
|
9289
9313
|
state.upstreamModel = record.model;
|
|
9290
9314
|
if (record.raw_usage !== void 0 || record.usage !== void 0) {
|
|
9291
9315
|
const raw = record.raw_usage ?? record.usage;
|
|
@@ -9426,40 +9450,6 @@ function machineOs() {
|
|
|
9426
9450
|
const arch = process.arch === "arm64" ? "aarch64" : process.arch;
|
|
9427
9451
|
return `${arch}_${process.platform}`;
|
|
9428
9452
|
}
|
|
9429
|
-
function estimateQoderBodyBytes(payload) {
|
|
9430
|
-
try {
|
|
9431
|
-
return Buffer.byteLength(JSON.stringify(payload));
|
|
9432
|
-
} catch {
|
|
9433
|
-
return Number.MAX_SAFE_INTEGER;
|
|
9434
|
-
}
|
|
9435
|
-
}
|
|
9436
|
-
function fitQoderBody(payload) {
|
|
9437
|
-
const messages = payload.messages;
|
|
9438
|
-
if (!Array.isArray(messages) || messages.length <= 1)
|
|
9439
|
-
return payload;
|
|
9440
|
-
if (estimateQoderBodyBytes(payload) <= QODER_WIRE_BODY_LIMIT_BYTES)
|
|
9441
|
-
return payload;
|
|
9442
|
-
const kept = messages.slice();
|
|
9443
|
-
while (kept.length > 1 && estimateQoderBodyBytes({ ...payload, messages: kept }) > QODER_WIRE_BODY_LIMIT_BYTES) {
|
|
9444
|
-
const dropped = kept[0];
|
|
9445
|
-
kept.shift();
|
|
9446
|
-
if (dropped?.role === "assistant" && Array.isArray(dropped.tool_calls) && dropped.tool_calls.length > 0) {
|
|
9447
|
-
const toolCallIds = new Set(dropped.tool_calls.map((tc) => tc && typeof tc === "object" && "id" in tc ? tc.id : void 0).filter((id) => typeof id === "string"));
|
|
9448
|
-
while (kept.length > 1) {
|
|
9449
|
-
const next = kept[0];
|
|
9450
|
-
if (next?.role === "tool" && typeof next.tool_call_id === "string" && toolCallIds.has(next.tool_call_id)) {
|
|
9451
|
-
kept.shift();
|
|
9452
|
-
toolCallIds.delete(next.tool_call_id);
|
|
9453
|
-
if (toolCallIds.size === 0)
|
|
9454
|
-
break;
|
|
9455
|
-
} else {
|
|
9456
|
-
break;
|
|
9457
|
-
}
|
|
9458
|
-
}
|
|
9459
|
-
}
|
|
9460
|
-
}
|
|
9461
|
-
return { ...payload, messages: kept };
|
|
9462
|
-
}
|
|
9463
9453
|
function toWireTool(tool) {
|
|
9464
9454
|
return {
|
|
9465
9455
|
type: "function",
|
|
@@ -9488,7 +9478,7 @@ function lastUserText(messages) {
|
|
|
9488
9478
|
}
|
|
9489
9479
|
function buildRequestBody(options, sessionId) {
|
|
9490
9480
|
const requestId = randomUUID2();
|
|
9491
|
-
const spec =
|
|
9481
|
+
const spec = resolveQoderModelSpec(options.model);
|
|
9492
9482
|
const text = lastUserText(options.messages);
|
|
9493
9483
|
const maxTokens = spec?.maxTokens ?? QODER_DEFAULT_MAX_TOKENS;
|
|
9494
9484
|
const payload = {
|
|
@@ -9603,6 +9593,9 @@ function unwrapWireChunk(chunk) {
|
|
|
9603
9593
|
} catch {
|
|
9604
9594
|
}
|
|
9605
9595
|
const status = typeof record.statusCode === "string" ? record.statusCode : String(record.statusCodeValue);
|
|
9596
|
+
if (status === "PAYLOAD_TOO_LARGE") {
|
|
9597
|
+
throw new QoderApiError(`Qoder prompt is too long for this model's context window (${status}${detail ? `: ${detail}` : ""})`);
|
|
9598
|
+
}
|
|
9606
9599
|
throw new QoderApiError(`Qoder model server rejected the request (${status}${detail ? `: ${detail}` : ""})`);
|
|
9607
9600
|
}
|
|
9608
9601
|
try {
|
|
@@ -9689,12 +9682,7 @@ async function* streamQoderResponse(options) {
|
|
|
9689
9682
|
if (payload.messages.length === 0)
|
|
9690
9683
|
throw new QoderApiError("Qoder prompt is empty");
|
|
9691
9684
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
9692
|
-
const
|
|
9693
|
-
const body = JSON.stringify(fittedPayload);
|
|
9694
|
-
const bodyBytes = Buffer.byteLength(body);
|
|
9695
|
-
if (bodyBytes > QODER_WIRE_BODY_LIMIT_BYTES) {
|
|
9696
|
-
throw new QoderApiError(`Qoder prompt is too long for this model's context window (${bodyBytes} bytes > ${QODER_WIRE_BODY_LIMIT_BYTES} bytes)`);
|
|
9697
|
-
}
|
|
9685
|
+
const body = JSON.stringify(payload);
|
|
9698
9686
|
const origin = qoderWireUrl(process.env.QODER_MODEL_SERVER_HOST, options.endpoint);
|
|
9699
9687
|
const identity = readQoderSigningIdentity(qoderConfigDir()) ?? ANONYMOUS_SIGNING_IDENTITY;
|
|
9700
9688
|
const signed = signQoderInferRequest(origin, body, options.model, "system", identity, QODER_WIRE_VERSION);
|
|
@@ -9737,7 +9725,7 @@ async function* streamQoderResponse(options) {
|
|
|
9737
9725
|
}
|
|
9738
9726
|
}
|
|
9739
9727
|
function streamQoder(options) {
|
|
9740
|
-
const contextWindow =
|
|
9728
|
+
const contextWindow = resolveQoderModelSpec(options.model)?.contextWindow ?? QODER_DEFAULT_CONTEXT_WINDOW;
|
|
9741
9729
|
return recordUsage(streamQoderResponse(options), {
|
|
9742
9730
|
vendor: "qoder",
|
|
9743
9731
|
model: options.model,
|
|
@@ -9751,7 +9739,7 @@ function streamQoder(options) {
|
|
|
9751
9739
|
var QODER_MODEL_LIST_PATH = "/algo/api/v2/model/list?Encode=1";
|
|
9752
9740
|
function newestCatalogDirectory(root) {
|
|
9753
9741
|
try {
|
|
9754
|
-
const dirs = readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
9742
|
+
const dirs = readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join12(root, entry.name)).flatMap((dir) => {
|
|
9755
9743
|
try {
|
|
9756
9744
|
return [{ dir, mtime: statSync2(dir).mtimeMs }];
|
|
9757
9745
|
} catch {
|
|
@@ -9773,7 +9761,7 @@ function newestCatalog(dir) {
|
|
|
9773
9761
|
try {
|
|
9774
9762
|
const files = readdirSync3(dir).flatMap((name) => {
|
|
9775
9763
|
const match = /^catalog-v(\d+)$/.exec(name);
|
|
9776
|
-
return match ? [{ file:
|
|
9764
|
+
return match ? [{ file: join12(dir, name), version: Number(match[1]) }] : [];
|
|
9777
9765
|
}).sort((a, b) => b.version - a.version);
|
|
9778
9766
|
return files[0]?.file;
|
|
9779
9767
|
} catch {
|
|
@@ -9781,18 +9769,18 @@ function newestCatalog(dir) {
|
|
|
9781
9769
|
}
|
|
9782
9770
|
}
|
|
9783
9771
|
function qoderVendorCatalogFile(configDir) {
|
|
9784
|
-
const root =
|
|
9772
|
+
const root = join12(configDir, ".models");
|
|
9785
9773
|
let uid;
|
|
9786
9774
|
let scene;
|
|
9787
9775
|
try {
|
|
9788
|
-
const pointer = JSON.parse(
|
|
9776
|
+
const pointer = JSON.parse(readFileSync8(join12(root, "default"), "utf8"));
|
|
9789
9777
|
if (typeof pointer.uid === "string" && pointer.uid)
|
|
9790
9778
|
uid = pointer.uid;
|
|
9791
9779
|
if (typeof pointer.scene === "string" && pointer.scene)
|
|
9792
9780
|
scene = pointer.scene;
|
|
9793
9781
|
} catch {
|
|
9794
9782
|
}
|
|
9795
|
-
let dir = uid ?
|
|
9783
|
+
let dir = uid ? join12(root, uid) : void 0;
|
|
9796
9784
|
let file = dir ? newestCatalog(dir) : void 0;
|
|
9797
9785
|
if (!file) {
|
|
9798
9786
|
const found = newestCatalogDirectory(root);
|
|
@@ -9830,7 +9818,7 @@ function readLocalCatalog() {
|
|
|
9830
9818
|
const target = qoderVendorCatalogFile(qoderConfigDir());
|
|
9831
9819
|
if (!target)
|
|
9832
9820
|
return void 0;
|
|
9833
|
-
const plain = decryptQoderModelCache(
|
|
9821
|
+
const plain = decryptQoderModelCache(readFileSync8(target.file, "utf8"), target.uid);
|
|
9834
9822
|
return qoderModelsFromModelInfos(qoderModelInfosFromVendorCatalog(plain, target.scene));
|
|
9835
9823
|
}
|
|
9836
9824
|
async function fetchQoderModels(options = {}) {
|
|
@@ -9851,6 +9839,102 @@ async function fetchQoderModels(options = {}) {
|
|
|
9851
9839
|
return { models: qoderBootstrapModels(), source: "bootstrap", error: error2 };
|
|
9852
9840
|
}
|
|
9853
9841
|
|
|
9842
|
+
// ../qoder-core/dist/quota.js
|
|
9843
|
+
var QUOTA_ORIGIN = "https://center.qoder.sh";
|
|
9844
|
+
var BUCKETS = [
|
|
9845
|
+
{ key: "userQuota", id: "user", label: "Plan credits" },
|
|
9846
|
+
{ key: "addOnQuota", id: "addon", label: "Add-on credits" },
|
|
9847
|
+
{ key: "orgResourcePackage", id: "org", label: "Organization credits" }
|
|
9848
|
+
];
|
|
9849
|
+
function asRecord2(value) {
|
|
9850
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
9851
|
+
}
|
|
9852
|
+
function finiteNumber(value) {
|
|
9853
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
9854
|
+
}
|
|
9855
|
+
function positiveNumber(value) {
|
|
9856
|
+
const number = finiteNumber(value);
|
|
9857
|
+
return number !== void 0 && number > 0 ? number : void 0;
|
|
9858
|
+
}
|
|
9859
|
+
function httpUrl(value) {
|
|
9860
|
+
return typeof value === "string" && value.startsWith("https://") ? value : void 0;
|
|
9861
|
+
}
|
|
9862
|
+
function bucketFrom(id, label, value) {
|
|
9863
|
+
const record = asRecord2(value);
|
|
9864
|
+
if (!record)
|
|
9865
|
+
return void 0;
|
|
9866
|
+
const limit = positiveNumber(record.total) ?? positiveNumber(record.cap);
|
|
9867
|
+
if (limit === void 0)
|
|
9868
|
+
return void 0;
|
|
9869
|
+
const used = finiteNumber(record.used) ?? 0;
|
|
9870
|
+
const remaining = finiteNumber(record.remaining);
|
|
9871
|
+
return {
|
|
9872
|
+
id,
|
|
9873
|
+
label,
|
|
9874
|
+
used,
|
|
9875
|
+
limit,
|
|
9876
|
+
...remaining !== void 0 ? { remaining } : {},
|
|
9877
|
+
unit: "credits"
|
|
9878
|
+
};
|
|
9879
|
+
}
|
|
9880
|
+
function rawWithoutAccount(usage) {
|
|
9881
|
+
const raw = { ...usage };
|
|
9882
|
+
delete raw.userId;
|
|
9883
|
+
delete raw.user_id;
|
|
9884
|
+
return raw;
|
|
9885
|
+
}
|
|
9886
|
+
function parseQoderQuota(usageBody, planBody) {
|
|
9887
|
+
const usage = asRecord2(usageBody);
|
|
9888
|
+
if (!usage)
|
|
9889
|
+
return null;
|
|
9890
|
+
const plan = asRecord2(planBody);
|
|
9891
|
+
const planName = typeof plan?.plan_tier_name === "string" ? plan.plan_tier_name.trim() : "";
|
|
9892
|
+
const resetsAt = finiteNumber(usage.expiresAt) ?? finiteNumber(usage.refreshAt);
|
|
9893
|
+
const addOn = asRecord2(usage.addOnQuota);
|
|
9894
|
+
const manageUrl = httpUrl(addOn?.detailUrl) ?? httpUrl(usage.upgradeUrl);
|
|
9895
|
+
return {
|
|
9896
|
+
...planName ? { planName } : {},
|
|
9897
|
+
...resetsAt !== void 0 ? { resetsAt } : {},
|
|
9898
|
+
...manageUrl ? { manageUrl } : {},
|
|
9899
|
+
buckets: BUCKETS.flatMap((entry) => {
|
|
9900
|
+
const bucket = bucketFrom(entry.id, entry.label, usage[entry.key]);
|
|
9901
|
+
return bucket ? [bucket] : [];
|
|
9902
|
+
}),
|
|
9903
|
+
raw: rawWithoutAccount(usage)
|
|
9904
|
+
};
|
|
9905
|
+
}
|
|
9906
|
+
async function getJson(fetchImpl, token, path, signal) {
|
|
9907
|
+
const response = await fetchImpl(`${QUOTA_ORIGIN}${path}`, {
|
|
9908
|
+
method: "GET",
|
|
9909
|
+
headers: {
|
|
9910
|
+
Accept: "application/json",
|
|
9911
|
+
Authorization: `Bearer ${token}`
|
|
9912
|
+
},
|
|
9913
|
+
signal
|
|
9914
|
+
});
|
|
9915
|
+
if (response.status === 401 || response.status === 403) {
|
|
9916
|
+
throw new QoderAuthError(`${QODER_LOGIN_MESSAGE} (HTTP ${response.status})`);
|
|
9917
|
+
}
|
|
9918
|
+
if (!response.ok) {
|
|
9919
|
+
throw new QoderApiError(`Qoder quota endpoint returned HTTP ${response.status}`);
|
|
9920
|
+
}
|
|
9921
|
+
return response.json();
|
|
9922
|
+
}
|
|
9923
|
+
async function fetchQoderQuota(options = {}) {
|
|
9924
|
+
const token = options.token !== void 0 ? options.token || void 0 : resolveQoderAuth()?.token;
|
|
9925
|
+
if (!token)
|
|
9926
|
+
return null;
|
|
9927
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
9928
|
+
const [usageResult, planResult] = await Promise.allSettled([
|
|
9929
|
+
getJson(fetchImpl, token, "/api/v2/quota/usage", options.signal),
|
|
9930
|
+
getJson(fetchImpl, token, "/api/v2/user/plan", options.signal)
|
|
9931
|
+
]);
|
|
9932
|
+
if (usageResult.status === "rejected")
|
|
9933
|
+
throw usageResult.reason;
|
|
9934
|
+
const plan = planResult.status === "fulfilled" ? planResult.value : void 0;
|
|
9935
|
+
return parseQoderQuota(usageResult.value, plan);
|
|
9936
|
+
}
|
|
9937
|
+
|
|
9854
9938
|
// ../pi-provider/src/qoder/api-mode.ts
|
|
9855
9939
|
function streamViaQoder(model, context, options) {
|
|
9856
9940
|
return streamToPi({
|
|
@@ -9992,9 +10076,12 @@ function createProviderConfig2(models) {
|
|
|
9992
10076
|
api: QODER_API,
|
|
9993
10077
|
models,
|
|
9994
10078
|
streamSimple: streamQoderForPi,
|
|
10079
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
10080
|
+
// A disk snapshot, fresh or past the 15-minute TTL, is a real catalog. The
|
|
10081
|
+
// bootstrap list stays null so it is not pinned as authoritative for 24h.
|
|
9995
10082
|
fetchDynamicModels: async () => {
|
|
9996
10083
|
const latest = await refreshQoderModels({ allowNetwork: false });
|
|
9997
|
-
if (
|
|
10084
|
+
if (latest.source !== "cache" || latest.models.length === 0) return null;
|
|
9998
10085
|
return latest.models;
|
|
9999
10086
|
},
|
|
10000
10087
|
async refreshModels() {
|
|
@@ -10103,6 +10190,44 @@ var kiroUsageProvider = {
|
|
|
10103
10190
|
validatesCredentials: true
|
|
10104
10191
|
};
|
|
10105
10192
|
|
|
10193
|
+
// ../omp-provider/src/qoder-usage.ts
|
|
10194
|
+
function toLimit2(provider, bucket, quota) {
|
|
10195
|
+
const exhausted = bucket.remaining === 0 || bucket.used >= bucket.limit;
|
|
10196
|
+
return {
|
|
10197
|
+
id: bucket.id,
|
|
10198
|
+
label: bucket.label,
|
|
10199
|
+
scope: { provider },
|
|
10200
|
+
...quota.resetsAt !== void 0 ? { window: { id: "billing-period", label: "Billing period", resetsAt: quota.resetsAt } } : {},
|
|
10201
|
+
amount: {
|
|
10202
|
+
used: bucket.used,
|
|
10203
|
+
limit: bucket.limit,
|
|
10204
|
+
unit: "credits"
|
|
10205
|
+
},
|
|
10206
|
+
status: exhausted ? "exhausted" : "ok"
|
|
10207
|
+
};
|
|
10208
|
+
}
|
|
10209
|
+
function toQoderUsageReport(provider, quota, fetchedAt = Date.now()) {
|
|
10210
|
+
return {
|
|
10211
|
+
provider,
|
|
10212
|
+
fetchedAt,
|
|
10213
|
+
limits: quota.buckets.map((bucket) => toLimit2(provider, bucket, quota)),
|
|
10214
|
+
...quota.planName ? { notes: [quota.planName] } : {},
|
|
10215
|
+
metadata: {
|
|
10216
|
+
...quota.manageUrl ? { manageUrl: quota.manageUrl } : {}
|
|
10217
|
+
},
|
|
10218
|
+
raw: quota.raw
|
|
10219
|
+
};
|
|
10220
|
+
}
|
|
10221
|
+
var qoderUsageProvider = {
|
|
10222
|
+
id: "qoder",
|
|
10223
|
+
async fetchUsage(params, ctx) {
|
|
10224
|
+
const quota = await fetchQoderQuota({ fetchImpl: ctx.fetch });
|
|
10225
|
+
if (!quota) return null;
|
|
10226
|
+
return toQoderUsageReport(params.provider, quota);
|
|
10227
|
+
},
|
|
10228
|
+
validatesCredentials: false
|
|
10229
|
+
};
|
|
10230
|
+
|
|
10106
10231
|
// ../omp-provider/src/adapter.ts
|
|
10107
10232
|
var UNSUPPORTED_EVENTS = /* @__PURE__ */ new Set(["session_info_changed"]);
|
|
10108
10233
|
var SESSION_START_ALIASES = ["session_switch", "session_branch"];
|
|
@@ -10208,6 +10333,9 @@ function adaptProviderConfig(config, env = process.env, providerName) {
|
|
|
10208
10333
|
if (providerName === "kiro" && next.usage == null) {
|
|
10209
10334
|
next.usage = kiroUsageProvider;
|
|
10210
10335
|
}
|
|
10336
|
+
if (providerName === "qoder" && next.usage == null) {
|
|
10337
|
+
next.usage = qoderUsageProvider;
|
|
10338
|
+
}
|
|
10211
10339
|
return next;
|
|
10212
10340
|
}
|
|
10213
10341
|
function wrapExtensionApi(pi, options = {}) {
|
|
@@ -10235,9 +10363,9 @@ function wrapExtensionApi(pi, options = {}) {
|
|
|
10235
10363
|
}
|
|
10236
10364
|
|
|
10237
10365
|
// ../pi-provider/src/selection.ts
|
|
10238
|
-
import { readFileSync as
|
|
10239
|
-
import { homedir as
|
|
10240
|
-
import { join as
|
|
10366
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
10367
|
+
import { homedir as homedir12 } from "node:os";
|
|
10368
|
+
import { join as join13 } from "node:path";
|
|
10241
10369
|
var PROVIDER_KEYS = ["kiro", "devin", "grok", "arnict", "qoder"];
|
|
10242
10370
|
var DEFAULT_SELECTION = {
|
|
10243
10371
|
kiro: true,
|
|
@@ -10246,8 +10374,8 @@ var DEFAULT_SELECTION = {
|
|
|
10246
10374
|
arnict: true,
|
|
10247
10375
|
qoder: true
|
|
10248
10376
|
};
|
|
10249
|
-
function selectionFilePath(env = process.env, home =
|
|
10250
|
-
return env.NS_BRIDGE_PROVIDERS ??
|
|
10377
|
+
function selectionFilePath(env = process.env, home = homedir12()) {
|
|
10378
|
+
return env.NS_BRIDGE_PROVIDERS ?? join13(home, ".ns-bridge", "providers.json");
|
|
10251
10379
|
}
|
|
10252
10380
|
function resolveProviderSelection(env = process.env, file = readProviderFile(selectionFilePath(env))) {
|
|
10253
10381
|
const allow = listed(env.NS_OMP_PROVIDERS);
|
|
@@ -10263,7 +10391,7 @@ function resolveProviderSelection(env = process.env, file = readProviderFile(sel
|
|
|
10263
10391
|
function readProviderFile(path) {
|
|
10264
10392
|
let raw;
|
|
10265
10393
|
try {
|
|
10266
|
-
raw =
|
|
10394
|
+
raw = readFileSync9(path, "utf8");
|
|
10267
10395
|
} catch {
|
|
10268
10396
|
return {};
|
|
10269
10397
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.32 — prebuilt host bundle.
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -4773,13 +4773,12 @@ function createProviderConfig(models) {
|
|
|
4773
4773
|
api: ARNICT_API,
|
|
4774
4774
|
models,
|
|
4775
4775
|
streamSimple: streamArnictForPi,
|
|
4776
|
-
// OMP
|
|
4777
|
-
//
|
|
4778
|
-
//
|
|
4779
|
-
// null here and do not become that authoritative list.
|
|
4776
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
4777
|
+
// A disk snapshot, fresh or past the 15-minute TTL, is a real catalog. The
|
|
4778
|
+
// bootstrap list stays null so it is not pinned as authoritative for 24h.
|
|
4780
4779
|
fetchDynamicModels: async () => {
|
|
4781
4780
|
const latest = await refreshArnictModels({ allowNetwork: false });
|
|
4782
|
-
if (
|
|
4781
|
+
if (latest.source !== "cache" || latest.models.length === 0) return null;
|
|
4783
4782
|
return latest.models;
|
|
4784
4783
|
},
|
|
4785
4784
|
async refreshModels() {
|
|
@@ -8460,6 +8459,12 @@ function loadCacheFile() {
|
|
|
8460
8459
|
function getCachedModels() {
|
|
8461
8460
|
return withCompaction(loadCacheFile()?.models ?? devinModels);
|
|
8462
8461
|
}
|
|
8462
|
+
function readDevinDiskModels() {
|
|
8463
|
+
const models = loadCacheFile()?.models;
|
|
8464
|
+
if (!models)
|
|
8465
|
+
return void 0;
|
|
8466
|
+
return withCompaction(models);
|
|
8467
|
+
}
|
|
8463
8468
|
function isCacheStale(now = Date.now()) {
|
|
8464
8469
|
const cache = loadCacheFile();
|
|
8465
8470
|
return cache === void 0 || now - cache.fetchedAt > CACHE_TTL_MS;
|
|
@@ -8733,14 +8738,13 @@ function providerConfig(models, apiKey) {
|
|
|
8733
8738
|
// When CLI credentials.toml (or env) already has a token, set apiKey so Pi
|
|
8734
8739
|
// marks the provider configured for --list-models without /login.
|
|
8735
8740
|
...apiKey ? { apiKey } : {},
|
|
8736
|
-
// OMP
|
|
8737
|
-
//
|
|
8738
|
-
//
|
|
8739
|
-
// landed is what gets stored. `models` above is what the host shows until then.
|
|
8741
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
8742
|
+
// A catalog file on disk is returned even past the 24h TTL. A missing or
|
|
8743
|
+
// empty file stays null so the bootstrap seed is not pinned for a day.
|
|
8740
8744
|
fetchDynamicModels: async () => {
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
return latest.
|
|
8745
|
+
const latest = readDevinDiskModels();
|
|
8746
|
+
if (!latest || latest.length === 0) return null;
|
|
8747
|
+
return latest.map(toPiDevinModel);
|
|
8744
8748
|
},
|
|
8745
8749
|
async refreshModels() {
|
|
8746
8750
|
return models;
|
|
@@ -10124,13 +10128,12 @@ function createProviderConfig2(models) {
|
|
|
10124
10128
|
api: GROK_API,
|
|
10125
10129
|
models,
|
|
10126
10130
|
streamSimple: streamGrokForPi,
|
|
10127
|
-
// OMP
|
|
10128
|
-
//
|
|
10129
|
-
//
|
|
10130
|
-
// null here and do not become that authoritative list.
|
|
10131
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
10132
|
+
// A disk snapshot, fresh or past the 15-minute TTL, is a real catalog. The
|
|
10133
|
+
// bootstrap list stays null so it is not pinned as authoritative for 24h.
|
|
10131
10134
|
fetchDynamicModels: async () => {
|
|
10132
10135
|
const latest = await refreshGrokModels({ allowCli: false });
|
|
10133
|
-
if (
|
|
10136
|
+
if (latest.source !== "cache" || latest.models.length === 0) return null;
|
|
10134
10137
|
return latest.models;
|
|
10135
10138
|
},
|
|
10136
10139
|
async refreshModels() {
|
|
@@ -11104,6 +11107,11 @@ function allCacheEntries(cache) {
|
|
|
11104
11107
|
function kiroProfileCacheKey(profileArn) {
|
|
11105
11108
|
return createHash4("sha256").update(profileArn).digest("base64url").slice(0, 16);
|
|
11106
11109
|
}
|
|
11110
|
+
function hasCachedKiroCatalog(region) {
|
|
11111
|
+
const cache = readManagementCache();
|
|
11112
|
+
const models = activeCacheEntry(cache, region)?.models ?? cache?.regions[region]?.models;
|
|
11113
|
+
return Array.isArray(models) && models.length > 0;
|
|
11114
|
+
}
|
|
11107
11115
|
function activeCacheEntry(cache, region) {
|
|
11108
11116
|
const override = getKiroProfileOverride();
|
|
11109
11117
|
return override ? cache?.profiles?.[kiroProfileCacheKey(override.arn)] : cache?.regions[region];
|
|
@@ -13741,13 +13749,12 @@ ${current.models.map((model) => model.id).join("\n")}`;
|
|
|
13741
13749
|
authHeader: false,
|
|
13742
13750
|
streamSimple: streamKiroForPi,
|
|
13743
13751
|
models: current.models,
|
|
13744
|
-
// OMP
|
|
13745
|
-
//
|
|
13746
|
-
//
|
|
13747
|
-
// in place and does not lock a stale catalog.
|
|
13752
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
13753
|
+
// A disk catalog is returned even past the 1h TTL. No disk entry stays null
|
|
13754
|
+
// so the bootstrap list is not pinned as authoritative for 24h.
|
|
13748
13755
|
fetchDynamicModels: async () => {
|
|
13749
13756
|
const latest = localKiroCatalog();
|
|
13750
|
-
if (latest.models.length === 0 ||
|
|
13757
|
+
if (latest.models.length === 0 || !hasCachedKiroCatalog(latest.region)) return null;
|
|
13751
13758
|
return latest.models;
|
|
13752
13759
|
},
|
|
13753
13760
|
async refreshModels() {
|
|
@@ -14225,12 +14232,14 @@ function requireQoderAuth(env = process.env, home = homedir16()) {
|
|
|
14225
14232
|
}
|
|
14226
14233
|
|
|
14227
14234
|
// ../qoder-core/dist/catalog.js
|
|
14235
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
14236
|
+
import { homedir as homedir17 } from "node:os";
|
|
14237
|
+
import { join as join17 } from "node:path";
|
|
14228
14238
|
var QODER_CATALOG_PROVIDER_ID = "qoder";
|
|
14229
14239
|
var QODER_CATALOG_FILE = `${QODER_CATALOG_PROVIDER_ID}.models.json`;
|
|
14240
|
+
var QODER_CATALOG_CACHE_DIR_ENV = "NS_QODER_CATALOG_CACHE_DIR";
|
|
14230
14241
|
var QODER_DEFAULT_MAX_TOKENS = 16384;
|
|
14231
|
-
var
|
|
14232
|
-
var QODER_WIRE_CONTEXT_WINDOW = QODER_WIRE_BODY_LIMIT_BYTES / 4;
|
|
14233
|
-
var QODER_DEFAULT_CONTEXT_WINDOW = QODER_WIRE_CONTEXT_WINDOW;
|
|
14242
|
+
var QODER_DEFAULT_CONTEXT_WINDOW = 2e5;
|
|
14234
14243
|
var BOOTSTRAP_IDS = [
|
|
14235
14244
|
"auto",
|
|
14236
14245
|
"ultimate",
|
|
@@ -14274,6 +14283,28 @@ var QODER_MODEL_DISPLAY_NAMES = {
|
|
|
14274
14283
|
function qoderBootstrapModels() {
|
|
14275
14284
|
return BOOTSTRAP_IDS.map((value) => qoderModelFromInfo({ value, isEnabled: true }));
|
|
14276
14285
|
}
|
|
14286
|
+
function qoderCatalogPath(cacheDir) {
|
|
14287
|
+
return join17(cacheDir, QODER_CATALOG_FILE);
|
|
14288
|
+
}
|
|
14289
|
+
function qoderCatalogCacheDir(env = process.env, home = homedir17()) {
|
|
14290
|
+
const override = env[QODER_CATALOG_CACHE_DIR_ENV]?.trim();
|
|
14291
|
+
return override || join17(home, ".pi", "agent", "cache", "ns-pi-provider");
|
|
14292
|
+
}
|
|
14293
|
+
function resolveQoderModelSpec(modelId, cacheDir = qoderCatalogCacheDir()) {
|
|
14294
|
+
const listed2 = readQoderCatalog({ cacheDir });
|
|
14295
|
+
return listed2.find((model) => model.id === modelId) ?? qoderBootstrapModels().find((model) => model.id === modelId);
|
|
14296
|
+
}
|
|
14297
|
+
function readQoderCatalog(options) {
|
|
14298
|
+
try {
|
|
14299
|
+
const raw = readFileSync11(qoderCatalogPath(options.cacheDir), "utf8");
|
|
14300
|
+
const parsed = JSON.parse(raw);
|
|
14301
|
+
if (!parsed?.models?.length)
|
|
14302
|
+
return qoderBootstrapModels();
|
|
14303
|
+
return parsed.models;
|
|
14304
|
+
} catch {
|
|
14305
|
+
return qoderBootstrapModels();
|
|
14306
|
+
}
|
|
14307
|
+
}
|
|
14277
14308
|
var EFFORT_ORDER = ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
14278
14309
|
function positive(value) {
|
|
14279
14310
|
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
@@ -14294,7 +14325,7 @@ function qoderModelFromInfo(info) {
|
|
|
14294
14325
|
name: info.displayName ?? QODER_MODEL_DISPLAY_NAMES[info.value] ?? info.value,
|
|
14295
14326
|
reasoning: info.isReasoning === true || efforts.length > 0,
|
|
14296
14327
|
input: info.isVl === true ? ["text", "image"] : ["text"],
|
|
14297
|
-
contextWindow:
|
|
14328
|
+
contextWindow: declared,
|
|
14298
14329
|
maxTokens: positive(info.maxOutputTokens) ? info.maxOutputTokens : QODER_DEFAULT_MAX_TOKENS,
|
|
14299
14330
|
...efforts.length > 0 ? { efforts } : {}
|
|
14300
14331
|
};
|
|
@@ -14360,8 +14391,8 @@ function qoderModelInfosFromVendorCatalog(raw, scene) {
|
|
|
14360
14391
|
}
|
|
14361
14392
|
|
|
14362
14393
|
// ../qoder-core/dist/models-api.js
|
|
14363
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
14364
|
-
import { join as
|
|
14394
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync12, statSync as statSync3 } from "node:fs";
|
|
14395
|
+
import { join as join18 } from "node:path";
|
|
14365
14396
|
|
|
14366
14397
|
// ../qoder-core/dist/stream.js
|
|
14367
14398
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -14413,7 +14444,9 @@ function toWireMessage(message) {
|
|
|
14413
14444
|
return void 0;
|
|
14414
14445
|
return {
|
|
14415
14446
|
role: "assistant",
|
|
14416
|
-
|
|
14447
|
+
// Kimi, DeepSeek-Flash and MiniMax reject a tool-only turn whose content is
|
|
14448
|
+
// null. An empty string is the same "no text" and those models accept it.
|
|
14449
|
+
content: text || "",
|
|
14417
14450
|
...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
|
|
14418
14451
|
};
|
|
14419
14452
|
}
|
|
@@ -14548,7 +14581,7 @@ function reduceWireChunk(state, chunk) {
|
|
|
14548
14581
|
ensureStart3(state, events);
|
|
14549
14582
|
if (typeof record.id === "string" && record.id)
|
|
14550
14583
|
state.responseId = record.id;
|
|
14551
|
-
if (typeof record.model === "string" && record.model)
|
|
14584
|
+
if (typeof record.model === "string" && record.model && record.model !== "auto")
|
|
14552
14585
|
state.upstreamModel = record.model;
|
|
14553
14586
|
if (record.raw_usage !== void 0 || record.usage !== void 0) {
|
|
14554
14587
|
const raw = record.raw_usage ?? record.usage;
|
|
@@ -14689,40 +14722,6 @@ function machineOs() {
|
|
|
14689
14722
|
const arch = process.arch === "arm64" ? "aarch64" : process.arch;
|
|
14690
14723
|
return `${arch}_${process.platform}`;
|
|
14691
14724
|
}
|
|
14692
|
-
function estimateQoderBodyBytes(payload) {
|
|
14693
|
-
try {
|
|
14694
|
-
return Buffer.byteLength(JSON.stringify(payload));
|
|
14695
|
-
} catch {
|
|
14696
|
-
return Number.MAX_SAFE_INTEGER;
|
|
14697
|
-
}
|
|
14698
|
-
}
|
|
14699
|
-
function fitQoderBody(payload) {
|
|
14700
|
-
const messages = payload.messages;
|
|
14701
|
-
if (!Array.isArray(messages) || messages.length <= 1)
|
|
14702
|
-
return payload;
|
|
14703
|
-
if (estimateQoderBodyBytes(payload) <= QODER_WIRE_BODY_LIMIT_BYTES)
|
|
14704
|
-
return payload;
|
|
14705
|
-
const kept = messages.slice();
|
|
14706
|
-
while (kept.length > 1 && estimateQoderBodyBytes({ ...payload, messages: kept }) > QODER_WIRE_BODY_LIMIT_BYTES) {
|
|
14707
|
-
const dropped = kept[0];
|
|
14708
|
-
kept.shift();
|
|
14709
|
-
if (dropped?.role === "assistant" && Array.isArray(dropped.tool_calls) && dropped.tool_calls.length > 0) {
|
|
14710
|
-
const toolCallIds = new Set(dropped.tool_calls.map((tc) => tc && typeof tc === "object" && "id" in tc ? tc.id : void 0).filter((id) => typeof id === "string"));
|
|
14711
|
-
while (kept.length > 1) {
|
|
14712
|
-
const next = kept[0];
|
|
14713
|
-
if (next?.role === "tool" && typeof next.tool_call_id === "string" && toolCallIds.has(next.tool_call_id)) {
|
|
14714
|
-
kept.shift();
|
|
14715
|
-
toolCallIds.delete(next.tool_call_id);
|
|
14716
|
-
if (toolCallIds.size === 0)
|
|
14717
|
-
break;
|
|
14718
|
-
} else {
|
|
14719
|
-
break;
|
|
14720
|
-
}
|
|
14721
|
-
}
|
|
14722
|
-
}
|
|
14723
|
-
}
|
|
14724
|
-
return { ...payload, messages: kept };
|
|
14725
|
-
}
|
|
14726
14725
|
function toWireTool(tool) {
|
|
14727
14726
|
return {
|
|
14728
14727
|
type: "function",
|
|
@@ -14751,7 +14750,7 @@ function lastUserText(messages) {
|
|
|
14751
14750
|
}
|
|
14752
14751
|
function buildRequestBody(options, sessionId) {
|
|
14753
14752
|
const requestId = randomUUID2();
|
|
14754
|
-
const spec =
|
|
14753
|
+
const spec = resolveQoderModelSpec(options.model);
|
|
14755
14754
|
const text = lastUserText(options.messages);
|
|
14756
14755
|
const maxTokens = spec?.maxTokens ?? QODER_DEFAULT_MAX_TOKENS;
|
|
14757
14756
|
const payload = {
|
|
@@ -14866,6 +14865,9 @@ function unwrapWireChunk(chunk) {
|
|
|
14866
14865
|
} catch {
|
|
14867
14866
|
}
|
|
14868
14867
|
const status = typeof record.statusCode === "string" ? record.statusCode : String(record.statusCodeValue);
|
|
14868
|
+
if (status === "PAYLOAD_TOO_LARGE") {
|
|
14869
|
+
throw new QoderApiError(`Qoder prompt is too long for this model's context window (${status}${detail ? `: ${detail}` : ""})`);
|
|
14870
|
+
}
|
|
14869
14871
|
throw new QoderApiError(`Qoder model server rejected the request (${status}${detail ? `: ${detail}` : ""})`);
|
|
14870
14872
|
}
|
|
14871
14873
|
try {
|
|
@@ -14952,12 +14954,7 @@ async function* streamQoderResponse(options) {
|
|
|
14952
14954
|
if (payload.messages.length === 0)
|
|
14953
14955
|
throw new QoderApiError("Qoder prompt is empty");
|
|
14954
14956
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
14955
|
-
const
|
|
14956
|
-
const body = JSON.stringify(fittedPayload);
|
|
14957
|
-
const bodyBytes = Buffer.byteLength(body);
|
|
14958
|
-
if (bodyBytes > QODER_WIRE_BODY_LIMIT_BYTES) {
|
|
14959
|
-
throw new QoderApiError(`Qoder prompt is too long for this model's context window (${bodyBytes} bytes > ${QODER_WIRE_BODY_LIMIT_BYTES} bytes)`);
|
|
14960
|
-
}
|
|
14957
|
+
const body = JSON.stringify(payload);
|
|
14961
14958
|
const origin = qoderWireUrl(process.env.QODER_MODEL_SERVER_HOST, options.endpoint);
|
|
14962
14959
|
const identity = readQoderSigningIdentity(qoderConfigDir()) ?? ANONYMOUS_SIGNING_IDENTITY;
|
|
14963
14960
|
const signed = signQoderInferRequest(origin, body, options.model, "system", identity, QODER_WIRE_VERSION);
|
|
@@ -15000,7 +14997,7 @@ async function* streamQoderResponse(options) {
|
|
|
15000
14997
|
}
|
|
15001
14998
|
}
|
|
15002
14999
|
function streamQoder(options) {
|
|
15003
|
-
const contextWindow =
|
|
15000
|
+
const contextWindow = resolveQoderModelSpec(options.model)?.contextWindow ?? QODER_DEFAULT_CONTEXT_WINDOW;
|
|
15004
15001
|
return recordUsage(streamQoderResponse(options), {
|
|
15005
15002
|
vendor: "qoder",
|
|
15006
15003
|
model: options.model,
|
|
@@ -15014,7 +15011,7 @@ function streamQoder(options) {
|
|
|
15014
15011
|
var QODER_MODEL_LIST_PATH = "/algo/api/v2/model/list?Encode=1";
|
|
15015
15012
|
function newestCatalogDirectory(root) {
|
|
15016
15013
|
try {
|
|
15017
|
-
const dirs = readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
15014
|
+
const dirs = readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join18(root, entry.name)).flatMap((dir) => {
|
|
15018
15015
|
try {
|
|
15019
15016
|
return [{ dir, mtime: statSync3(dir).mtimeMs }];
|
|
15020
15017
|
} catch {
|
|
@@ -15036,7 +15033,7 @@ function newestCatalog(dir) {
|
|
|
15036
15033
|
try {
|
|
15037
15034
|
const files = readdirSync3(dir).flatMap((name) => {
|
|
15038
15035
|
const match = /^catalog-v(\d+)$/.exec(name);
|
|
15039
|
-
return match ? [{ file:
|
|
15036
|
+
return match ? [{ file: join18(dir, name), version: Number(match[1]) }] : [];
|
|
15040
15037
|
}).sort((a, b) => b.version - a.version);
|
|
15041
15038
|
return files[0]?.file;
|
|
15042
15039
|
} catch {
|
|
@@ -15044,18 +15041,18 @@ function newestCatalog(dir) {
|
|
|
15044
15041
|
}
|
|
15045
15042
|
}
|
|
15046
15043
|
function qoderVendorCatalogFile(configDir) {
|
|
15047
|
-
const root =
|
|
15044
|
+
const root = join18(configDir, ".models");
|
|
15048
15045
|
let uid;
|
|
15049
15046
|
let scene;
|
|
15050
15047
|
try {
|
|
15051
|
-
const pointer = JSON.parse(
|
|
15048
|
+
const pointer = JSON.parse(readFileSync12(join18(root, "default"), "utf8"));
|
|
15052
15049
|
if (typeof pointer.uid === "string" && pointer.uid)
|
|
15053
15050
|
uid = pointer.uid;
|
|
15054
15051
|
if (typeof pointer.scene === "string" && pointer.scene)
|
|
15055
15052
|
scene = pointer.scene;
|
|
15056
15053
|
} catch {
|
|
15057
15054
|
}
|
|
15058
|
-
let dir = uid ?
|
|
15055
|
+
let dir = uid ? join18(root, uid) : void 0;
|
|
15059
15056
|
let file = dir ? newestCatalog(dir) : void 0;
|
|
15060
15057
|
if (!file) {
|
|
15061
15058
|
const found = newestCatalogDirectory(root);
|
|
@@ -15093,7 +15090,7 @@ function readLocalCatalog() {
|
|
|
15093
15090
|
const target = qoderVendorCatalogFile(qoderConfigDir());
|
|
15094
15091
|
if (!target)
|
|
15095
15092
|
return void 0;
|
|
15096
|
-
const plain = decryptQoderModelCache(
|
|
15093
|
+
const plain = decryptQoderModelCache(readFileSync12(target.file, "utf8"), target.uid);
|
|
15097
15094
|
return qoderModelsFromModelInfos(qoderModelInfosFromVendorCatalog(plain, target.scene));
|
|
15098
15095
|
}
|
|
15099
15096
|
async function fetchQoderModels(options = {}) {
|
|
@@ -15263,9 +15260,12 @@ function createProviderConfig3(models) {
|
|
|
15263
15260
|
api: QODER_API,
|
|
15264
15261
|
models,
|
|
15265
15262
|
streamSimple: streamQoderForPi,
|
|
15263
|
+
// OMP 19.1.1 reads `.length` on this return, so null throws during discovery.
|
|
15264
|
+
// A disk snapshot, fresh or past the 15-minute TTL, is a real catalog. The
|
|
15265
|
+
// bootstrap list stays null so it is not pinned as authoritative for 24h.
|
|
15266
15266
|
fetchDynamicModels: async () => {
|
|
15267
15267
|
const latest = await refreshQoderModels({ allowNetwork: false });
|
|
15268
|
-
if (
|
|
15268
|
+
if (latest.source !== "cache" || latest.models.length === 0) return null;
|
|
15269
15269
|
return latest.models;
|
|
15270
15270
|
},
|
|
15271
15271
|
async refreshModels() {
|
|
@@ -15308,9 +15308,9 @@ async function registerQoderProvider(pi) {
|
|
|
15308
15308
|
}
|
|
15309
15309
|
|
|
15310
15310
|
// ../pi-provider/src/selection.ts
|
|
15311
|
-
import { readFileSync as
|
|
15312
|
-
import { homedir as
|
|
15313
|
-
import { join as
|
|
15311
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
15312
|
+
import { homedir as homedir18 } from "node:os";
|
|
15313
|
+
import { join as join19 } from "node:path";
|
|
15314
15314
|
var PROVIDER_KEYS = ["kiro", "devin", "grok", "arnict", "qoder"];
|
|
15315
15315
|
var DEFAULT_SELECTION = {
|
|
15316
15316
|
kiro: true,
|
|
@@ -15319,8 +15319,8 @@ var DEFAULT_SELECTION = {
|
|
|
15319
15319
|
arnict: true,
|
|
15320
15320
|
qoder: true
|
|
15321
15321
|
};
|
|
15322
|
-
function selectionFilePath(env = process.env, home =
|
|
15323
|
-
return env.NS_BRIDGE_PROVIDERS ??
|
|
15322
|
+
function selectionFilePath(env = process.env, home = homedir18()) {
|
|
15323
|
+
return env.NS_BRIDGE_PROVIDERS ?? join19(home, ".ns-bridge", "providers.json");
|
|
15324
15324
|
}
|
|
15325
15325
|
function resolveProviderSelection(env = process.env, file = readProviderFile(selectionFilePath(env))) {
|
|
15326
15326
|
const allow = listed(env.NS_OMP_PROVIDERS);
|
|
@@ -15336,7 +15336,7 @@ function resolveProviderSelection(env = process.env, file = readProviderFile(sel
|
|
|
15336
15336
|
function readProviderFile(path) {
|
|
15337
15337
|
let raw;
|
|
15338
15338
|
try {
|
|
15339
|
-
raw =
|
|
15339
|
+
raw = readFileSync13(path, "utf8");
|
|
15340
15340
|
} catch {
|
|
15341
15341
|
return {};
|
|
15342
15342
|
}
|
package/dist/refresh-entry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.32 — bundled entries (catalog refresh, serve).
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
var __create = Object.create;
|
|
@@ -100300,9 +100300,7 @@ function resolveQoderAuth(env3 = process.env, home = homedir13()) {
|
|
|
100300
100300
|
var QODER_CATALOG_PROVIDER_ID = "qoder";
|
|
100301
100301
|
var QODER_CATALOG_FILE = `${QODER_CATALOG_PROVIDER_ID}.models.json`;
|
|
100302
100302
|
var QODER_DEFAULT_MAX_TOKENS = 16384;
|
|
100303
|
-
var
|
|
100304
|
-
var QODER_WIRE_CONTEXT_WINDOW = QODER_WIRE_BODY_LIMIT_BYTES / 4;
|
|
100305
|
-
var QODER_DEFAULT_CONTEXT_WINDOW = QODER_WIRE_CONTEXT_WINDOW;
|
|
100303
|
+
var QODER_DEFAULT_CONTEXT_WINDOW = 2e5;
|
|
100306
100304
|
var BOOTSTRAP_IDS = [
|
|
100307
100305
|
"auto",
|
|
100308
100306
|
"ultimate",
|
|
@@ -100366,7 +100364,7 @@ function qoderModelFromInfo(info) {
|
|
|
100366
100364
|
name: info.displayName ?? QODER_MODEL_DISPLAY_NAMES[info.value] ?? info.value,
|
|
100367
100365
|
reasoning: info.isReasoning === true || efforts.length > 0,
|
|
100368
100366
|
input: info.isVl === true ? ["text", "image"] : ["text"],
|
|
100369
|
-
contextWindow:
|
|
100367
|
+
contextWindow: declared,
|
|
100370
100368
|
maxTokens: positive(info.maxOutputTokens) ? info.maxOutputTokens : QODER_DEFAULT_MAX_TOKENS,
|
|
100371
100369
|
...efforts.length > 0 ? { efforts } : {}
|
|
100372
100370
|
};
|
package/dist/serve-entry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.32 — bundled entries (catalog refresh, serve).
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
var __defProp = Object.defineProperty;
|