billion-context 0.1.63 → 0.1.64-pr.358.209
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 +28 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47708,8 +47708,9 @@ function loadOptions(env = process.env) {
|
|
|
47708
47708
|
const webProxy = nonEmpty(fileConfig.upstreamProxy);
|
|
47709
47709
|
const configProxy = nonEmpty(fileConfig.proxy);
|
|
47710
47710
|
const rawProxyMode = env.BILI_UPSTREAM_PROXY_MODE ?? fileConfig.upstreamProxyMode ?? (webProxy ? "manual" : void 0);
|
|
47711
|
-
const
|
|
47712
|
-
const
|
|
47711
|
+
const effectiveMode = rawProxyMode ?? "direct";
|
|
47712
|
+
const proxyMode = parseUpstreamProxyMode(effectiveMode);
|
|
47713
|
+
const explicitDirect = proxyMode === "direct" && !biliProxy;
|
|
47713
47714
|
const proxy = biliProxy ?? (proxyMode === "direct" ? "" : proxyMode === "manual" ? webProxy ?? configProxy : configProxy);
|
|
47714
47715
|
const proxySource = biliProxy ? "bili-env" : proxyMode === "direct" ? "direct" : proxyMode === "manual" && webProxy ? "web-manual" : configProxy ? "config" : "auto";
|
|
47715
47716
|
const httpProxy = nonEmpty(env.HTTP_PROXY ?? env.http_proxy);
|
|
@@ -56445,6 +56446,20 @@ function injectResponsesTool(tools, toolsToAdd = ACP_TOOLS_RESPONSES) {
|
|
|
56445
56446
|
const additions = toolsToAdd.filter((t) => !present.has(t.name));
|
|
56446
56447
|
return [...tools, ...additions];
|
|
56447
56448
|
}
|
|
56449
|
+
var loggedUpstreamProxyDecisions = /* @__PURE__ */ new Set();
|
|
56450
|
+
function logUpstreamProxyDecision(opts, upstreamUrl, decision) {
|
|
56451
|
+
if (!upstreamUrl) return;
|
|
56452
|
+
let host = upstreamUrl;
|
|
56453
|
+
try {
|
|
56454
|
+
host = new URL(upstreamUrl).host;
|
|
56455
|
+
} catch {
|
|
56456
|
+
}
|
|
56457
|
+
const key = `${host}|${decision.proxy ?? ""}|${decision.source}`;
|
|
56458
|
+
if (loggedUpstreamProxyDecisions.has(key)) return;
|
|
56459
|
+
loggedUpstreamProxyDecisions.add(key);
|
|
56460
|
+
const via = decision.proxy ? `via ${maskUrlForLog(decision.proxy)}` : "direct";
|
|
56461
|
+
logMsg(opts, "info", `[upstream-proxy] ${maskHostPortForLog(host)} ${via} (source=${decision.source})`);
|
|
56462
|
+
}
|
|
56448
56463
|
function buildForwardTarget(req, opts, route, affinity, hopMarker) {
|
|
56449
56464
|
const reqUrl = req.url ?? "";
|
|
56450
56465
|
const isAbsoluteUrl = /^https?:\/\//i.test(reqUrl);
|
|
@@ -56468,8 +56483,9 @@ function buildForwardTarget(req, opts, route, affinity, hopMarker) {
|
|
|
56468
56483
|
if (affinity && !clientConversationHeader(req.headers)) {
|
|
56469
56484
|
headers["x-session-id"] = affinity;
|
|
56470
56485
|
}
|
|
56471
|
-
const
|
|
56472
|
-
|
|
56486
|
+
const decision = resolveProxyDecision(opts.routes, opts.proxy, route?.rewrittenUrl ?? upstreamUrl, opts.proxyFallback);
|
|
56487
|
+
logUpstreamProxyDecision(opts, upstreamUrl, decision);
|
|
56488
|
+
return { upstreamUrl, headers, proxyUrl: decision.proxy };
|
|
56473
56489
|
}
|
|
56474
56490
|
function isPreflightFailFast(outcome) {
|
|
56475
56491
|
return "failFast" in outcome;
|
|
@@ -62263,6 +62279,8 @@ Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili h
|
|
|
62263
62279
|
auto-whitelisted for MITM so the proxy TLS-terminates exactly the hosts the
|
|
62264
62280
|
client uses; HTTP / localhost providers go direct. pi/claude trust the CA
|
|
62265
62281
|
via NODE_EXTRA_CA_CERTS, codex via SSL_CERT_FILE. Proxy killed on client exit.
|
|
62282
|
+
bili flags (-F, --mitm-domain, --port, ...) must precede the client name;
|
|
62283
|
+
everything after the client name is passed through to the client.
|
|
62266
62284
|
bili pi # launch pi through the proxy
|
|
62267
62285
|
bili pi -- print "hi" # args after the client are passed through
|
|
62268
62286
|
bili pi-test # pi through the proxy with extensions off (proxy owns compression)
|
|
@@ -62272,9 +62290,12 @@ Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili h
|
|
|
62272
62290
|
bili hermes # launch hermes-agent through the proxy (/bili/ rewrite of ~/.hermes/config.yaml)
|
|
62273
62291
|
bili dsh --profile web "task" # launch deepseek-harness through the proxy (/bili/ rewrite of ~/.dsh/settings.yaml)
|
|
62274
62292
|
bili test pi # quick end-to-end check of the pi path
|
|
62275
|
-
bili
|
|
62293
|
+
bili --mitm-domain api.foo.com pi # add a domain to the MITM whitelist (flags precede the client)
|
|
62294
|
+
bili -F http://127.0.0.1:7897 codex # route bili's upstream through a proxy (gost-style -F)
|
|
62276
62295
|
|
|
62277
62296
|
Options (override config file / env):
|
|
62297
|
+
-F <url> upstream proxy to forward through (gost-style;
|
|
62298
|
+
http://host:port; must precede the client name)
|
|
62278
62299
|
--port <N> listen port (default 8787)
|
|
62279
62300
|
--host <ADDR> listen host (default 127.0.0.1)
|
|
62280
62301
|
--mitm-domain <domain> extra MITM domain (repeatable; launcher only)
|
|
@@ -62353,6 +62374,7 @@ function parseArgs(argv) {
|
|
|
62353
62374
|
exportOutput = val;
|
|
62354
62375
|
break;
|
|
62355
62376
|
}
|
|
62377
|
+
case "-F":
|
|
62356
62378
|
case "--port":
|
|
62357
62379
|
case "--host":
|
|
62358
62380
|
case "--config":
|
|
@@ -62369,6 +62391,7 @@ function parseArgs(argv) {
|
|
|
62369
62391
|
else if (a === "--config") overrides.BILI_CONFIG_FILE = val;
|
|
62370
62392
|
else if (a === "--origin") overrides.BILI_MCP_PROXY = val;
|
|
62371
62393
|
else if (a === "--bin") process.env.BILI_CLIENT_BIN = val;
|
|
62394
|
+
else if (a === "-F") overrides.BILI_UPSTREAM_PROXY = val;
|
|
62372
62395
|
else overrides.BILI_PLUGIN_AGENT = val;
|
|
62373
62396
|
break;
|
|
62374
62397
|
}
|