billion-context 0.1.102-pr.641.521 → 0.1.102-pr.654.520
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/README.md +4 -4
- package/dist/index.js +102 -162
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,7 +158,7 @@ rewrite until dsh gains a settings-path env or an upstream loopback opt-out.
|
|
|
158
158
|
Overlay dirs created by older versions are left in place and never merged back
|
|
159
159
|
into the real home.
|
|
160
160
|
|
|
161
|
-
### Option 1 — Launcher (`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes` / `bili dsh` / `bili
|
|
161
|
+
### Option 1 — Launcher (`bili pi` / `bili codex` / `bili claude` / `bili omp` / `bili opencode` / `bili hermes` / `bili dsh` / `bili qoder`)
|
|
162
162
|
|
|
163
163
|
The launcher wraps a client in one command: it starts a proxy on an
|
|
164
164
|
independent port (a fresh instance is always spawned — a port is never
|
|
@@ -176,9 +176,9 @@ bili claude # launch claude through the proxy
|
|
|
176
176
|
bili omp # pi-style, file-free (#535): env + extension registerProvider + compaction cancel, real ~/.omp untouched
|
|
177
177
|
bili opencode # MITM for HTTPS + temp opencode.json (/bili/ for HTTP) + thin /acp plugin
|
|
178
178
|
bili hermes # file-free (#535): hermes proxy env (HTTPS_PROXY + HERMES_CA_BUNDLE) — https via CONNECT MITM, http via absolute-form forward proxy; real ~/.hermes untouched
|
|
179
|
-
bili dsh # deepseek-harness: non-loopback upstreams ride proxy envs (https MITM, http absolute-form), loopback keeps the overlay DSH_HOME (~/.dsh-bili) rewrite (#535), built-in deepseek route via DEEPSEEK_BASE_URL, native /acp command injected via --patch
|
|
180
|
-
bili
|
|
181
|
-
bili pi --mitm-domain api.foo.com # add a domain to the MITM whitelist
|
|
179
|
+
bili dsh # deepseek-harness: non-loopback upstreams ride proxy envs (https MITM, http absolute-form), loopback keeps the overlay DSH_HOME (~/.dsh-bili) rewrite (#535), built-in deepseek route via DEEPSEEK_BASE_URL, native /acp command injected via --patch
|
|
180
|
+
bili qoder # qoder: model endpoint is hardcoded https (no /bili/ rewrite possible) — cert-MITM via HTTPS_PROXY + NODE_EXTRA_CA_CERTS, default model hosts whitelisted (#653)
|
|
181
|
+
bili pi --mitm-domain api.foo.com # add a domain to the MITM whitelist
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
### Option 2 — URL change (`/bili/` prefix)
|
package/dist/index.js
CHANGED
|
@@ -57282,6 +57282,55 @@ import path10 from "path";
|
|
|
57282
57282
|
function toModelWindow(id, contextWindow) {
|
|
57283
57283
|
return typeof id === "string" && id.length > 0 && typeof contextWindow === "number" && Number.isFinite(contextWindow) && contextWindow > 0 ? { id, contextWindow: Math.floor(contextWindow) } : null;
|
|
57284
57284
|
}
|
|
57285
|
+
var QODER_DEFAULT_MODEL_HOSTS = [
|
|
57286
|
+
"api2-v2.qoder.sh",
|
|
57287
|
+
"api1.qoder.sh",
|
|
57288
|
+
"api2.qoder.sh",
|
|
57289
|
+
"api3.qoder.sh",
|
|
57290
|
+
"gateway.qoder.com.cn"
|
|
57291
|
+
];
|
|
57292
|
+
function qoderIsCnSite(env = process.env) {
|
|
57293
|
+
const site = env.QODERCLI_SITE?.trim().toLowerCase();
|
|
57294
|
+
if (site === "cn") return true;
|
|
57295
|
+
if (nonEmpty2(env.QODERCN_CONFIG_DIR) || nonEmpty2(env.QODERCN_CLI_HOME)) return true;
|
|
57296
|
+
const h = os.homedir();
|
|
57297
|
+
const cnDir = path10.join(h, ".qoder-cn");
|
|
57298
|
+
const intlDir = path10.join(h, ".qoder");
|
|
57299
|
+
try {
|
|
57300
|
+
if (fs6.existsSync(cnDir) && !fs6.existsSync(intlDir)) return true;
|
|
57301
|
+
} catch {
|
|
57302
|
+
}
|
|
57303
|
+
return false;
|
|
57304
|
+
}
|
|
57305
|
+
function resolveQoderHome(env = process.env) {
|
|
57306
|
+
const h = os.homedir();
|
|
57307
|
+
const cn2 = qoderIsCnSite(env);
|
|
57308
|
+
const configDir2 = cn2 ? env.QODERCN_CONFIG_DIR : env.QODER_CONFIG_DIR;
|
|
57309
|
+
if (nonEmpty2(configDir2)) return configDir2;
|
|
57310
|
+
const cliHomeEnv = cn2 ? env.QODERCN_CLI_HOME : env.QODER_CLI_HOME;
|
|
57311
|
+
const cliHome = nonEmpty2(cliHomeEnv) ? cliHomeEnv : h;
|
|
57312
|
+
const dirNameEnv = cn2 ? env.QODERCN_CONFIG_DIR_NAME : env.QODER_CONFIG_DIR_NAME;
|
|
57313
|
+
const dirName = nonEmpty2(dirNameEnv) ? dirNameEnv : cn2 ? ".qoder-cn" : ".qoder";
|
|
57314
|
+
return path10.join(cliHome, dirName);
|
|
57315
|
+
}
|
|
57316
|
+
function readQoderConfig(qoderHome, env = process.env) {
|
|
57317
|
+
const result = {};
|
|
57318
|
+
const obj = readJsonObject(path10.join(qoderHome, "settings.json"));
|
|
57319
|
+
const model = obj?.model;
|
|
57320
|
+
if (typeof model === "string" && model.trim().length > 0) {
|
|
57321
|
+
result.model = model.trim();
|
|
57322
|
+
} else if (model && typeof model === "object" && !Array.isArray(model)) {
|
|
57323
|
+
const name = model.name;
|
|
57324
|
+
if (nonEmpty2(name)) result.model = name.trim();
|
|
57325
|
+
}
|
|
57326
|
+
const cn2 = qoderIsCnSite(env);
|
|
57327
|
+
const host = nonEmpty2(cn2 ? env.QODERCN_MODEL_SERVER_HOST : env.QODER_MODEL_SERVER_HOST) ? cn2 ? env.QODERCN_MODEL_SERVER_HOST : env.QODER_MODEL_SERVER_HOST : void 0;
|
|
57328
|
+
if (host) {
|
|
57329
|
+
const bare = host.trim().replace(/^https?:\/\//i, "").replace(/\/+$/, "");
|
|
57330
|
+
if (bare.length > 0) result.modelServerHost = bare;
|
|
57331
|
+
}
|
|
57332
|
+
return result;
|
|
57333
|
+
}
|
|
57285
57334
|
function nonEmpty2(s3) {
|
|
57286
57335
|
return typeof s3 === "string" && s3.trim().length > 0;
|
|
57287
57336
|
}
|
|
@@ -57314,98 +57363,6 @@ function resolveCodexHome(env) {
|
|
|
57314
57363
|
const h = os.homedir();
|
|
57315
57364
|
return nonEmpty2(env.CODEX_HOME) ? env.CODEX_HOME : path10.join(h, ".codex");
|
|
57316
57365
|
}
|
|
57317
|
-
function resolveCodebuddyHome(env) {
|
|
57318
|
-
const h = os.homedir();
|
|
57319
|
-
return nonEmpty2(env.CODEBUDDY_CONFIG_DIR) ? env.CODEBUDDY_CONFIG_DIR : path10.join(h, ".codebuddy");
|
|
57320
|
-
}
|
|
57321
|
-
function parseCodebuddyModelsJson(obj) {
|
|
57322
|
-
const out = { models: [], urls: [] };
|
|
57323
|
-
const seenUrl = /* @__PURE__ */ new Set();
|
|
57324
|
-
const collect = (id, entry) => {
|
|
57325
|
-
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return;
|
|
57326
|
-
const e = entry;
|
|
57327
|
-
const url = e.url;
|
|
57328
|
-
if (typeof url === "string" && url.length > 0 && !seenUrl.has(url)) {
|
|
57329
|
-
seenUrl.add(url);
|
|
57330
|
-
out.urls.push(url);
|
|
57331
|
-
}
|
|
57332
|
-
const win = toModelWindow(id, e.maxInputTokens);
|
|
57333
|
-
if (win) out.models.push(win);
|
|
57334
|
-
};
|
|
57335
|
-
if (!obj) return out;
|
|
57336
|
-
if (Array.isArray(obj)) {
|
|
57337
|
-
for (const item of obj) {
|
|
57338
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
57339
|
-
const it2 = item;
|
|
57340
|
-
collect(it2.id ?? it2.name, it2);
|
|
57341
|
-
}
|
|
57342
|
-
return out;
|
|
57343
|
-
}
|
|
57344
|
-
if (typeof obj !== "object") return out;
|
|
57345
|
-
const root = obj;
|
|
57346
|
-
const modelsField = root.models;
|
|
57347
|
-
if (Array.isArray(modelsField)) {
|
|
57348
|
-
for (const item of modelsField) {
|
|
57349
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
57350
|
-
const it2 = item;
|
|
57351
|
-
collect(it2.id ?? it2.name, it2);
|
|
57352
|
-
}
|
|
57353
|
-
return out;
|
|
57354
|
-
}
|
|
57355
|
-
if (modelsField && typeof modelsField === "object") {
|
|
57356
|
-
for (const [id, val] of Object.entries(modelsField)) collect(id, val);
|
|
57357
|
-
return out;
|
|
57358
|
-
}
|
|
57359
|
-
for (const [id, val] of Object.entries(root)) collect(id, val);
|
|
57360
|
-
return out;
|
|
57361
|
-
}
|
|
57362
|
-
function readJsonFile(filePath) {
|
|
57363
|
-
try {
|
|
57364
|
-
return JSON.parse(fs6.readFileSync(filePath, "utf8"));
|
|
57365
|
-
} catch {
|
|
57366
|
-
return null;
|
|
57367
|
-
}
|
|
57368
|
-
}
|
|
57369
|
-
function readCodebuddyConfig(codebuddyHome, cwd, env = process.env) {
|
|
57370
|
-
let codebuddyBaseUrl;
|
|
57371
|
-
let model;
|
|
57372
|
-
let autoCompactWindow;
|
|
57373
|
-
const settings = readJsonObject(path10.join(codebuddyHome, "settings.json"));
|
|
57374
|
-
const settingsEnv = settings?.env;
|
|
57375
|
-
if (settingsEnv && typeof settingsEnv === "object" && !Array.isArray(settingsEnv)) {
|
|
57376
|
-
const e = settingsEnv;
|
|
57377
|
-
const v2 = e.CODEBUDDY_BASE_URL;
|
|
57378
|
-
if (nonEmpty2(v2)) codebuddyBaseUrl = v2;
|
|
57379
|
-
}
|
|
57380
|
-
const tm = settings?.model;
|
|
57381
|
-
if (nonEmpty2(tm)) model = String(tm);
|
|
57382
|
-
const tacw = Number(settings?.autoCompactWindow);
|
|
57383
|
-
if (Number.isFinite(tacw) && tacw > 0) autoCompactWindow = tacw;
|
|
57384
|
-
if (!codebuddyBaseUrl && nonEmpty2(env.CODEBUDDY_BASE_URL)) codebuddyBaseUrl = env.CODEBUDDY_BASE_URL;
|
|
57385
|
-
const windowByModel = /* @__PURE__ */ new Map();
|
|
57386
|
-
const urls = [];
|
|
57387
|
-
const seenUrl = /* @__PURE__ */ new Set();
|
|
57388
|
-
for (const f2 of [
|
|
57389
|
-
path10.join(codebuddyHome, "models.json"),
|
|
57390
|
-
path10.join(cwd, ".codebuddy", "models.json")
|
|
57391
|
-
]) {
|
|
57392
|
-
const parsed = parseCodebuddyModelsJson(readJsonFile(f2));
|
|
57393
|
-
for (const w2 of parsed.models) windowByModel.set(w2.id, w2.contextWindow);
|
|
57394
|
-
for (const u2 of parsed.urls) {
|
|
57395
|
-
if (!seenUrl.has(u2)) {
|
|
57396
|
-
seenUrl.add(u2);
|
|
57397
|
-
urls.push(u2);
|
|
57398
|
-
}
|
|
57399
|
-
}
|
|
57400
|
-
}
|
|
57401
|
-
return {
|
|
57402
|
-
...codebuddyBaseUrl ? { codebuddyBaseUrl } : {},
|
|
57403
|
-
...model ? { model } : {},
|
|
57404
|
-
...autoCompactWindow ? { autoCompactWindow } : {},
|
|
57405
|
-
...windowByModel.size > 0 ? { models: [...windowByModel.entries()].map(([id, contextWindow]) => ({ id, contextWindow })) } : {},
|
|
57406
|
-
...urls.length > 0 ? { modelUrls: urls } : {}
|
|
57407
|
-
};
|
|
57408
|
-
}
|
|
57409
57366
|
function parseDshSettingsYaml(text) {
|
|
57410
57367
|
const out = [];
|
|
57411
57368
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -57779,7 +57736,7 @@ function loadClientConfig(env, cwd) {
|
|
|
57779
57736
|
config.opencode = readOpencodeConfig(resolveOpencodeConfigFile(env));
|
|
57780
57737
|
config.hermes = readHermesConfig(resolveHermesHome(env));
|
|
57781
57738
|
config.dsh = readDshConfig(resolveDshHome(env));
|
|
57782
|
-
config.
|
|
57739
|
+
config.qoder = readQoderConfig(resolveQoderHome(env), env);
|
|
57783
57740
|
return config;
|
|
57784
57741
|
}
|
|
57785
57742
|
function collectModelWindows(config, scope) {
|
|
@@ -57794,14 +57751,12 @@ function collectModelWindows(config, scope) {
|
|
|
57794
57751
|
else if (scope === "pi") for (const p2 of Object.values(config.pi?.providers ?? {})) add(p2.models);
|
|
57795
57752
|
else if (scope === "omp") for (const p2 of Object.values(config.omp?.providers ?? {})) add(p2.models);
|
|
57796
57753
|
else if (scope === "opencode") for (const p2 of Object.values(config.opencode?.providers ?? {})) add(p2.models);
|
|
57797
|
-
else if (scope === "codebuddy") add(config.codebuddy?.models);
|
|
57798
57754
|
return out;
|
|
57799
57755
|
}
|
|
57800
57756
|
for (const p2 of Object.values(config.pi?.providers ?? {})) add(p2.models);
|
|
57801
57757
|
for (const p2 of Object.values(config.omp?.providers ?? {})) add(p2.models);
|
|
57802
57758
|
for (const p2 of Object.values(config.opencode?.providers ?? {})) add(p2.models);
|
|
57803
57759
|
add(config.codex?.modelWindows);
|
|
57804
|
-
add(config.codebuddy?.models);
|
|
57805
57760
|
return out;
|
|
57806
57761
|
}
|
|
57807
57762
|
|
|
@@ -57839,9 +57794,9 @@ function extractHttpsHosts(config) {
|
|
|
57839
57794
|
if (config.zcode) {
|
|
57840
57795
|
for (const prov of Object.values(config.zcode.providers)) push(prov.baseURL);
|
|
57841
57796
|
}
|
|
57842
|
-
if (config.
|
|
57843
|
-
|
|
57844
|
-
for (const
|
|
57797
|
+
if (config.qoder) {
|
|
57798
|
+
const hosts = nonEmpty2(config.qoder.modelServerHost) ? [config.qoder.modelServerHost] : QODER_DEFAULT_MODEL_HOSTS;
|
|
57799
|
+
for (const h of hosts) push(`https://${h}`);
|
|
57845
57800
|
}
|
|
57846
57801
|
return out;
|
|
57847
57802
|
}
|
|
@@ -57849,16 +57804,13 @@ function configFilePaths(env) {
|
|
|
57849
57804
|
const home = os2.homedir();
|
|
57850
57805
|
const codexHome = nonEmpty2(env.CODEX_HOME) ? env.CODEX_HOME : path11.join(home, ".codex");
|
|
57851
57806
|
const zcodeHome = nonEmpty2(env.ZCODE_DATA_BASE_DIR) ? env.ZCODE_DATA_BASE_DIR : path11.join(home, ".zcode");
|
|
57852
|
-
const codebuddyHome = resolveCodebuddyHome(env);
|
|
57853
57807
|
return [
|
|
57854
57808
|
path11.join(home, ".claude", "settings.json"),
|
|
57855
57809
|
path11.join(process.cwd(), ".claude", "settings.json"),
|
|
57856
57810
|
path11.join(codexHome, "config.toml"),
|
|
57857
57811
|
path11.join(resolvePiHome(env), "models.json"),
|
|
57858
57812
|
path11.join(zcodeHome, "v2", "config.json"),
|
|
57859
|
-
path11.join(
|
|
57860
|
-
path11.join(codebuddyHome, "models.json"),
|
|
57861
|
-
path11.join(process.cwd(), ".codebuddy", "models.json")
|
|
57813
|
+
path11.join(resolveQoderHome(env), "settings.json")
|
|
57862
57814
|
];
|
|
57863
57815
|
}
|
|
57864
57816
|
function readMtimes(paths) {
|
|
@@ -65486,7 +65438,7 @@ function selfDistFile(name) {
|
|
|
65486
65438
|
return path15.join(selfPackageRoot(), "dist", name);
|
|
65487
65439
|
}
|
|
65488
65440
|
var LAUNCHER_DEFAULT_HOST = "127.0.0.1";
|
|
65489
|
-
var LAUNCH_CLIENTS = ["pi", "codex", "claude", "omp", "opencode", "hermes", "dsh", "
|
|
65441
|
+
var LAUNCH_CLIENTS = ["pi", "codex", "claude", "omp", "opencode", "hermes", "dsh", "qoder", "pi-test"];
|
|
65490
65442
|
var HEALTH_PATH = "/__bili/health";
|
|
65491
65443
|
var HEALTH_POLL_INTERVAL_MS = 200;
|
|
65492
65444
|
var SPAWN_WAIT_MS = 2e4;
|
|
@@ -65574,29 +65526,6 @@ function discoverRoutes(client, config) {
|
|
|
65574
65526
|
}
|
|
65575
65527
|
} catch {
|
|
65576
65528
|
}
|
|
65577
|
-
} else if (client === "codebuddy") {
|
|
65578
|
-
const raw = nonEmpty2(config.codebuddy?.codebuddyBaseUrl) ? config.codebuddy.codebuddyBaseUrl : "https://tencent.sso.codebuddy.cn/v2";
|
|
65579
|
-
const real = unwrapUpstream2(raw);
|
|
65580
|
-
try {
|
|
65581
|
-
const url = new URL(real);
|
|
65582
|
-
if ((url.protocol === "https:" || url.protocol === "http:") && !rewriteKeys.has("CODEBUDDY_BASE_URL")) {
|
|
65583
|
-
rewriteKeys.add("CODEBUDDY_BASE_URL");
|
|
65584
|
-
httpRewrites.push({ key: "CODEBUDDY_BASE_URL", realUpstream: real });
|
|
65585
|
-
}
|
|
65586
|
-
} catch {
|
|
65587
|
-
}
|
|
65588
|
-
for (const rawModelUrl of config.codebuddy?.modelUrls ?? []) {
|
|
65589
|
-
try {
|
|
65590
|
-
const url = new URL(unwrapUpstream2(rawModelUrl));
|
|
65591
|
-
if (url.protocol !== "https:") continue;
|
|
65592
|
-
const host = url.hostname;
|
|
65593
|
-
if (host && !httpsSeen.has(host.toLowerCase())) {
|
|
65594
|
-
httpsSeen.add(host.toLowerCase());
|
|
65595
|
-
httpsDomains.push(host);
|
|
65596
|
-
}
|
|
65597
|
-
} catch {
|
|
65598
|
-
}
|
|
65599
|
-
}
|
|
65600
65529
|
} else if (client === "pi") {
|
|
65601
65530
|
for (const [name, prov] of Object.entries(config.pi?.providers ?? {})) {
|
|
65602
65531
|
classify(prov.baseUrl, name);
|
|
@@ -65658,6 +65587,15 @@ function discoverRoutes(client, config) {
|
|
|
65658
65587
|
} catch {
|
|
65659
65588
|
}
|
|
65660
65589
|
}
|
|
65590
|
+
} else if (client === "qoder") {
|
|
65591
|
+
const hosts = nonEmpty2(config.qoder?.modelServerHost) ? [config.qoder.modelServerHost] : QODER_DEFAULT_MODEL_HOSTS;
|
|
65592
|
+
for (const host of hosts) {
|
|
65593
|
+
const h = host.toLowerCase();
|
|
65594
|
+
if (h && !httpsSeen.has(h)) {
|
|
65595
|
+
httpsSeen.add(h);
|
|
65596
|
+
httpsDomains.push(h);
|
|
65597
|
+
}
|
|
65598
|
+
}
|
|
65661
65599
|
} else {
|
|
65662
65600
|
for (const [name, prov] of Object.entries(config.codex?.providers ?? {})) {
|
|
65663
65601
|
classify(prov.baseUrl, `model_providers.${name}.base_url`);
|
|
@@ -65740,20 +65678,15 @@ function buildClaudeEnv(origin, caPath, httpRewrites, httpsRewrites, baseEnv) {
|
|
|
65740
65678
|
if (hr2) env.ANTHROPIC_BASE_URL = hr2.realUpstream;
|
|
65741
65679
|
return env;
|
|
65742
65680
|
}
|
|
65743
|
-
|
|
65744
|
-
|
|
65745
|
-
|
|
65681
|
+
function buildQoderEnv(origin, caPath, baseEnv) {
|
|
65682
|
+
return { ...baseEnv, HTTPS_PROXY: origin, NODE_EXTRA_CA_CERTS: caPath, BILLION_CONTEXT_PROXY: origin };
|
|
65683
|
+
}
|
|
65684
|
+
async function resolveQoderBudgetEnv(opts) {
|
|
65685
|
+
const { model, userAutoCompactWindow, windowKey, routes, upstreamUrl } = opts;
|
|
65686
|
+
if (!model || nonEmpty2(userAutoCompactWindow)) return {};
|
|
65746
65687
|
const window2 = await resolveLauncherWindow(model, routes, upstreamUrl);
|
|
65747
65688
|
if (!window2) return {};
|
|
65748
|
-
return {
|
|
65749
|
-
}
|
|
65750
|
-
function buildCodebuddyEnv(origin, caPath, httpRewrites, httpsRewrites, baseEnv) {
|
|
65751
|
-
const env = { ...baseEnv, HTTPS_PROXY: origin, NODE_EXTRA_CA_CERTS: caPath, BILLION_CONTEXT_PROXY: origin };
|
|
65752
|
-
const r = httpRewrites.find((rw) => rw.key === "CODEBUDDY_BASE_URL");
|
|
65753
|
-
if (r) env.CODEBUDDY_BASE_URL = wrapUpstream(origin, r.realUpstream);
|
|
65754
|
-
const hr2 = httpsRewrites.find((rw) => rw.key === "CODEBUDDY_BASE_URL");
|
|
65755
|
-
if (hr2) env.CODEBUDDY_BASE_URL = hr2.realUpstream;
|
|
65756
|
-
return env;
|
|
65689
|
+
return { [windowKey]: String(window2) };
|
|
65757
65690
|
}
|
|
65758
65691
|
function launcherDirectUrl(env) {
|
|
65759
65692
|
return env.BILI_LAUNCHER_DIRECT === "1";
|
|
@@ -65795,7 +65728,7 @@ function isPrivateIPv4(host) {
|
|
|
65795
65728
|
return false;
|
|
65796
65729
|
}
|
|
65797
65730
|
function launcherInjectMcp(env, base, codexUpstream) {
|
|
65798
|
-
if (base === "pi" || base === "omp" || base === "opencode" || base === "hermes" || base === "dsh" || base === "
|
|
65731
|
+
if (base === "pi" || base === "omp" || base === "opencode" || base === "hermes" || base === "dsh" || base === "qoder") return false;
|
|
65799
65732
|
if (env.BILI_LAUNCHER_PLUGIN === "0") return false;
|
|
65800
65733
|
if (base === "codex" && env.BILI_LAUNCHER_PLUGIN === void 0 && codexUpstream !== void 0 && isPrivateUpstreamHost(codexUpstream)) {
|
|
65801
65734
|
return false;
|
|
@@ -66618,9 +66551,9 @@ function resolveClientCommand(client, env) {
|
|
|
66618
66551
|
);
|
|
66619
66552
|
return { command: process.execPath, prefixArgs: [cli] };
|
|
66620
66553
|
}
|
|
66621
|
-
if (client === "
|
|
66622
|
-
const resolved2 = resolveOnPath("
|
|
66623
|
-
return { command: resolved2 ?? "
|
|
66554
|
+
if (client === "qoder") {
|
|
66555
|
+
const resolved2 = resolveOnPath("qoder", env) ?? resolveOnPath("qodercli", env);
|
|
66556
|
+
return { command: resolved2 ?? "qoder", prefixArgs: [] };
|
|
66624
66557
|
}
|
|
66625
66558
|
const resolved = resolveOnPath(client, env);
|
|
66626
66559
|
return { command: resolved ?? client, prefixArgs: [] };
|
|
@@ -66688,6 +66621,10 @@ async function runLaunch(params, deps = {}) {
|
|
|
66688
66621
|
console.error(
|
|
66689
66622
|
"bili: direct-URL mode \u2014 claude's ANTHROPIC_BASE_URL is overridden to the proxy; a pre-configured relay is bypassed unless BILI_CLAUDE_UPSTREAM=<relay> is set. OAuth-subscription traffic requires the default MITM mode."
|
|
66690
66623
|
);
|
|
66624
|
+
} else if (base === "qoder") {
|
|
66625
|
+
console.error(
|
|
66626
|
+
"bili: BILI_LAUNCHER_DIRECT has no effect for qoder \u2014 its model endpoint scheme is hardcoded https with no base-URL override env, so qoder always runs in cert-MITM mode."
|
|
66627
|
+
);
|
|
66691
66628
|
}
|
|
66692
66629
|
}
|
|
66693
66630
|
const codexUpstream = base === "codex" ? codexUpstreamUrl(config.codex) : void 0;
|
|
@@ -66757,6 +66694,21 @@ async function runLaunch(params, deps = {}) {
|
|
|
66757
66694
|
}
|
|
66758
66695
|
const dshAcpPatch = writeDshAcpPatch(dshHomeDir);
|
|
66759
66696
|
if (dshAcpPatch) clientArgs = dshArgsWithPatch(clientArgs, dshAcpPatch);
|
|
66697
|
+
} else if (base === "qoder") {
|
|
66698
|
+
env = buildQoderEnv(origin, ca, stripInheritedProxy(process.env));
|
|
66699
|
+
const qoderPrefix = qoderIsCnSite(process.env) ? "QODERCN" : "QODER";
|
|
66700
|
+
env[`${qoderPrefix}_MODEL_TRANSPORT`] = "http";
|
|
66701
|
+
const qoderBudget = await resolveQoderBudgetEnv({
|
|
66702
|
+
model: nonEmpty2(process.env[`${qoderPrefix}_MODEL`]) ? process.env[`${qoderPrefix}_MODEL`] : config.qoder?.model,
|
|
66703
|
+
userAutoCompactWindow: process.env[`${qoderPrefix}_AUTOCOMPACT_WINDOW`],
|
|
66704
|
+
windowKey: `${qoderPrefix}_AUTOCOMPACT_WINDOW`,
|
|
66705
|
+
routes: biliRoutes,
|
|
66706
|
+
upstreamUrl: `https://${config.qoder?.modelServerHost ?? QODER_DEFAULT_MODEL_HOSTS[0]}`
|
|
66707
|
+
});
|
|
66708
|
+
Object.assign(env, qoderBudget);
|
|
66709
|
+
if (qoderBudget[`${qoderPrefix}_AUTOCOMPACT_WINDOW`] !== void 0) {
|
|
66710
|
+
console.error(`bili: qoder budget aligned \u2014 ${qoderPrefix}_AUTOCOMPACT_WINDOW=${qoderBudget[`${qoderPrefix}_AUTOCOMPACT_WINDOW`]}`);
|
|
66711
|
+
}
|
|
66760
66712
|
} else if (base === "codex") {
|
|
66761
66713
|
const codexConversationId = injectMcp ? randomUUID5() : void 0;
|
|
66762
66714
|
if (directUrl) {
|
|
@@ -66787,19 +66739,6 @@ async function runLaunch(params, deps = {}) {
|
|
|
66787
66739
|
Object.assign(env, inj.envPatch);
|
|
66788
66740
|
if (inj.warning) console.error(`bili: ${inj.warning}`);
|
|
66789
66741
|
}
|
|
66790
|
-
} else if (base === "codebuddy") {
|
|
66791
|
-
env = buildCodebuddyEnv(origin, ca, routes.httpRewrites, routes.httpsRewrites, process.env);
|
|
66792
|
-
const codebuddyBudget = await resolveCodebuddyBudgetEnv({
|
|
66793
|
-
model: config.codebuddy?.model,
|
|
66794
|
-
userAutoCompactWindow: config.codebuddy?.autoCompactWindow,
|
|
66795
|
-
shellAutoCompactWindow: process.env.CODEBUDDY_AUTO_COMPACT_WINDOW,
|
|
66796
|
-
routes: biliRoutes,
|
|
66797
|
-
upstreamUrl: config.codebuddy?.codebuddyBaseUrl ?? "https://tencent.sso.codebuddy.cn/v2"
|
|
66798
|
-
});
|
|
66799
|
-
Object.assign(env, codebuddyBudget);
|
|
66800
|
-
if (codebuddyBudget.CODEBUDDY_AUTO_COMPACT_WINDOW !== void 0) {
|
|
66801
|
-
console.error(`bili: codebuddy budget aligned \u2014 CODEBUDDY_AUTO_COMPACT_WINDOW=${codebuddyBudget.CODEBUDDY_AUTO_COMPACT_WINDOW}`);
|
|
66802
|
-
}
|
|
66803
66742
|
} else {
|
|
66804
66743
|
env = directUrl ? buildClaudePluginEnv(origin, true, process.env) : buildClaudeEnv(origin, ca, routes.httpRewrites, routes.httpsRewrites, process.env);
|
|
66805
66744
|
if (directUrl) env.BILLION_CONTEXT_PROXY = origin;
|
|
@@ -67054,7 +66993,7 @@ Usage:
|
|
|
67054
66993
|
bili opencode [opts --] [args] start a proxy + launch opencode against it (cert-MITM)
|
|
67055
66994
|
bili hermes [opts --] [args] start a proxy + launch hermes-agent against it (/bili/ rewrite)
|
|
67056
66995
|
bili dsh [opts --] [args] start a proxy + launch deepseek-harness against it (/bili/ rewrite)
|
|
67057
|
-
bili
|
|
66996
|
+
bili qoder [opts --] [args] start a proxy + launch qoder against it (cert-MITM)
|
|
67058
66997
|
bili test pi non-polluting pi smoke test through the proxy
|
|
67059
66998
|
bili export [session] [--full] list sessions / export one as a Markdown handoff
|
|
67060
66999
|
(--full includes original messages; --output FILE)
|
|
@@ -67069,12 +67008,13 @@ Usage:
|
|
|
67069
67008
|
bili --version print version
|
|
67070
67009
|
bili --help show this help
|
|
67071
67010
|
|
|
67072
|
-
Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili hermes / bili dsh / bili
|
|
67011
|
+
Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili hermes / bili dsh / bili qoder):
|
|
67073
67012
|
Brings up a proxy on an independent port (a fresh instance every launch), then runs the client pointed at it via HTTPS_PROXY + the proxy's
|
|
67074
67013
|
MITM CA \u2014 no config-file edits. Discovered HTTPS upstream domains are
|
|
67075
67014
|
auto-whitelisted for MITM so the proxy TLS-terminates exactly the hosts the
|
|
67076
|
-
|
|
67077
|
-
|
|
67015
|
+
client uses; HTTP / localhost providers go direct. pi/claude/qoder trust
|
|
67016
|
+
the CA via NODE_EXTRA_CA_CERTS, codex via SSL_CERT_FILE. Proxy killed on
|
|
67017
|
+
client exit.
|
|
67078
67018
|
bili flags (-F, --mitm-domain, --port, ...) must precede the client name;
|
|
67079
67019
|
everything after the client name is passed through to the client.
|
|
67080
67020
|
bili pi # launch pi through the proxy
|
|
@@ -67084,9 +67024,9 @@ Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili h
|
|
|
67084
67024
|
bili claude # launch claude through the proxy
|
|
67085
67025
|
bili omp # launch omp through the proxy (pi-based; /bili/ rewrite)
|
|
67086
67026
|
bili hermes # launch hermes-agent through the proxy (/bili/ rewrite of ~/.hermes/config.yaml)
|
|
67087
|
-
|
|
67088
|
-
|
|
67089
|
-
|
|
67027
|
+
bili dsh --profile web "task" # launch deepseek-harness through the proxy (/bili/ rewrite of ~/.dsh/settings.yaml)
|
|
67028
|
+
bili qoder # launch qoder through the proxy (cert-MITM; model endpoint is hardcoded https, so no /bili/ rewrite)
|
|
67029
|
+
bili test pi # quick end-to-end check of the pi path
|
|
67090
67030
|
bili --mitm-domain api.foo.com pi # add a domain to the MITM whitelist (flags precede the client)
|
|
67091
67031
|
bili -F http://127.0.0.1:7897 codex # route bili's upstream through a proxy (gost-style -F)
|
|
67092
67032
|
|