billion-context 0.1.46-pr.211.25 → 0.1.46-pr.211.26

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 CHANGED
@@ -52115,7 +52115,7 @@ function resolveOmpHome(env) {
52115
52115
  const h = os.homedir();
52116
52116
  return nonEmpty2(env.PI_CODING_AGENT_DIR) ? env.PI_CODING_AGENT_DIR : path8.join(h, ".omp", "agent");
52117
52117
  }
52118
- function readClaudeSettings(homeDir, cwd) {
52118
+ function readClaudeSettings(homeDir, cwd, env = process.env) {
52119
52119
  const files = [
52120
52120
  path8.join(homeDir, ".claude", "settings.json"),
52121
52121
  path8.join(cwd, ".claude", "settings.json")
@@ -52123,12 +52123,13 @@ function readClaudeSettings(homeDir, cwd) {
52123
52123
  let anthropicBaseUrl;
52124
52124
  for (const f2 of files) {
52125
52125
  const obj = readJsonObject(f2);
52126
- const env = obj?.env;
52127
- if (env && typeof env === "object" && !Array.isArray(env)) {
52128
- const v2 = env.ANTHROPIC_BASE_URL;
52126
+ const settingsEnv = obj?.env;
52127
+ if (settingsEnv && typeof settingsEnv === "object" && !Array.isArray(settingsEnv)) {
52128
+ const v2 = settingsEnv.ANTHROPIC_BASE_URL;
52129
52129
  if (nonEmpty2(v2)) anthropicBaseUrl = v2;
52130
52130
  }
52131
52131
  }
52132
+ if (!anthropicBaseUrl && nonEmpty2(env.ANTHROPIC_BASE_URL)) anthropicBaseUrl = env.ANTHROPIC_BASE_URL;
52132
52133
  return anthropicBaseUrl ? { anthropicBaseUrl } : {};
52133
52134
  }
52134
52135
  function parseCodexToml(text) {
@@ -52295,7 +52296,7 @@ function readZcodeConfig(zcodeHome) {
52295
52296
  function loadClientConfig(env, cwd) {
52296
52297
  const home = os.homedir();
52297
52298
  const config = {};
52298
- config.claude = readClaudeSettings(home, cwd);
52299
+ config.claude = readClaudeSettings(home, cwd, env);
52299
52300
  const codexHome = nonEmpty2(env.CODEX_HOME) ? env.CODEX_HOME : path8.join(home, ".codex");
52300
52301
  config.codex = readCodexConfig(codexHome);
52301
52302
  config.pi = readPiConfig(resolvePiHome(env));
@@ -58475,9 +58476,16 @@ function discoverRoutes(client, config) {
58475
58476
  }
58476
58477
  };
58477
58478
  if (client === "claude") {
58478
- const u2 = config.claude?.anthropicBaseUrl;
58479
- if (nonEmpty2(u2)) classify(u2, "ANTHROPIC_BASE_URL");
58480
- else classify("https://api.anthropic.com", "ANTHROPIC_BASE_URL");
58479
+ const raw = nonEmpty2(config.claude?.anthropicBaseUrl) ? config.claude.anthropicBaseUrl : "https://api.anthropic.com";
58480
+ const real = unwrapUpstream2(raw);
58481
+ try {
58482
+ const url = new URL(real);
58483
+ if ((url.protocol === "https:" || url.protocol === "http:") && !rewriteKeys.has("ANTHROPIC_BASE_URL")) {
58484
+ rewriteKeys.add("ANTHROPIC_BASE_URL");
58485
+ httpRewrites.push({ key: "ANTHROPIC_BASE_URL", realUpstream: real });
58486
+ }
58487
+ } catch {
58488
+ }
58481
58489
  } else if (client === "pi") {
58482
58490
  for (const [name, prov] of Object.entries(config.pi?.providers ?? {})) {
58483
58491
  classify(prov.baseUrl, name);
@@ -59283,7 +59291,8 @@ function parseArgs(argv) {
59283
59291
  const a = argv[i];
59284
59292
  if (!client && positional.length === 0 && isLaunchClient(a)) {
59285
59293
  client = a;
59286
- clientArgs = argv.slice(i + 1);
59294
+ const rest = argv.slice(i + 1);
59295
+ clientArgs = rest[0] === "--" ? rest.slice(1) : rest;
59287
59296
  break;
59288
59297
  }
59289
59298
  switch (a) {