billion-context 0.1.89-pr.612.430 → 0.1.89-pr.614.433
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 +32 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +24 -1
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57645,6 +57645,7 @@ var LAUNCHER_MODEL_WINDOWS = parseLauncherModelWindows(process.env.BILI_LAUNCHER
|
|
|
57645
57645
|
function launcherContextWindow(model) {
|
|
57646
57646
|
return LAUNCHER_MODEL_WINDOWS[model];
|
|
57647
57647
|
}
|
|
57648
|
+
var windowSourceLogged = /* @__PURE__ */ new Set();
|
|
57648
57649
|
function anthropicBetaContextWindow(headers) {
|
|
57649
57650
|
const raw = headers["anthropic-beta"];
|
|
57650
57651
|
if (raw === void 0) return void 0;
|
|
@@ -58253,6 +58254,13 @@ ${bodyBuffer.toString("utf8")}`);
|
|
|
58253
58254
|
if (native) nativeFromFallback = false;
|
|
58254
58255
|
}
|
|
58255
58256
|
reqConfig = resolveRequestConfig(config, opts.routes, embeddedUrl, model, native, opts.compress);
|
|
58257
|
+
{
|
|
58258
|
+
if (!windowSourceLogged.has(model)) {
|
|
58259
|
+
windowSourceLogged.add(model);
|
|
58260
|
+
const wsSource = betaWindow ? "anthropic-beta" : pluginWindow ? "plugin" : launcherWindow ? "launcher" : configuredWindow ? "configured" : peekWindow ? "registry-peek" : native ? "table-or-registry" : "default";
|
|
58261
|
+
log2("info", `[window] model=${model} source=${wsSource} native=${native ?? "none"} effective=${reqConfig.modelContextLimit} launcher=${launcherWindow ?? "none"} configured=${configuredWindow ?? "none"} peek=${peekWindow ?? "none"} fallback=${nativeFromFallback}`);
|
|
58262
|
+
}
|
|
58263
|
+
}
|
|
58256
58264
|
const aligned = operatorWindowTuned ? { limit: reqConfig.modelContextLimit, clamped: false } : codexAlignedWindow(reqConfig.modelContextLimit, model, req.headers);
|
|
58257
58265
|
if (aligned.clamped) {
|
|
58258
58266
|
const before = reqConfig.modelContextLimit;
|
|
@@ -63426,11 +63434,22 @@ var VERSION2 = (() => {
|
|
|
63426
63434
|
}
|
|
63427
63435
|
})();
|
|
63428
63436
|
var DEFAULT_PROXY_ORIGIN = "http://127.0.0.1:8787";
|
|
63437
|
+
var warnedStaleRecord = false;
|
|
63429
63438
|
function resolveProxyOrigin() {
|
|
63430
63439
|
const fromEnv = process.env.BILI_MCP_PROXY?.trim();
|
|
63431
63440
|
if (fromEnv && fromEnv.length > 0) return fromEnv;
|
|
63432
63441
|
const discovered = readProxyInstanceFile();
|
|
63433
|
-
if (discovered && /^https?:\/\/\S+$/.test(discovered.origin))
|
|
63442
|
+
if (discovered && /^https?:\/\/\S+$/.test(discovered.origin)) {
|
|
63443
|
+
if (isProxyInstanceFile(discovered) && discovered.pid > 0 && !isPidAlive(discovered.pid)) {
|
|
63444
|
+
if (!warnedStaleRecord) {
|
|
63445
|
+
warnedStaleRecord = true;
|
|
63446
|
+
process.stderr.write(`[bili-mcp] recorded bili proxy (${discovered.origin}, pid ${discovered.pid}) is not running \u2014 falling back to ${DEFAULT_PROXY_ORIGIN}; set BILI_MCP_PROXY if your proxy listens elsewhere
|
|
63447
|
+
`);
|
|
63448
|
+
}
|
|
63449
|
+
return DEFAULT_PROXY_ORIGIN;
|
|
63450
|
+
}
|
|
63451
|
+
return discovered.origin;
|
|
63452
|
+
}
|
|
63434
63453
|
return DEFAULT_PROXY_ORIGIN;
|
|
63435
63454
|
}
|
|
63436
63455
|
var TOOL_TIMEOUT_MS = 6e4;
|
|
@@ -64910,8 +64929,16 @@ async function ensureProxyRunning(opts, deps = {}) {
|
|
|
64910
64929
|
child.unref?.();
|
|
64911
64930
|
} catch {
|
|
64912
64931
|
}
|
|
64932
|
+
let childExit;
|
|
64933
|
+
child.on?.("exit", (...rest) => {
|
|
64934
|
+
childExit = {
|
|
64935
|
+
code: typeof rest[0] === "number" ? rest[0] : null,
|
|
64936
|
+
signal: typeof rest[1] === "string" ? rest[1] : null
|
|
64937
|
+
};
|
|
64938
|
+
});
|
|
64913
64939
|
const deadline = now() + SPAWN_WAIT_MS;
|
|
64914
64940
|
while (now() < deadline) {
|
|
64941
|
+
if (childExit) break;
|
|
64915
64942
|
await sleepImpl(HEALTH_POLL_INTERVAL_MS);
|
|
64916
64943
|
const inst = readInstance();
|
|
64917
64944
|
if (isProxyInstanceFile(inst) && inst.launchToken === launchToken) {
|
|
@@ -64925,6 +64952,10 @@ async function ensureProxyRunning(opts, deps = {}) {
|
|
|
64925
64952
|
return { origin: proxyOrigin(opts.host, port), port, child, logPath: logPath2 };
|
|
64926
64953
|
}
|
|
64927
64954
|
}
|
|
64955
|
+
if (childExit) {
|
|
64956
|
+
const detail = childExit.code !== null ? `code ${childExit.code}` : childExit.signal ? `signal ${childExit.signal}` : "unknown reason";
|
|
64957
|
+
throw new Error(`bili: proxy child exited before becoming healthy (${detail}) (log: ${logPath2})`);
|
|
64958
|
+
}
|
|
64928
64959
|
throw new Error(`bili: proxy did not become healthy within ${SPAWN_WAIT_MS}ms (log: ${logPath2})`);
|
|
64929
64960
|
}
|
|
64930
64961
|
function stopProxy(handle2) {
|