@lunaroute/cli 0.10.0 → 0.11.0

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.
Files changed (2) hide show
  1. package/dist/index.js +31 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import { Command, InvalidArgumentError, Option } from "commander";
5
5
 
6
6
  // package.json
7
- var version = "0.10.0";
7
+ var version = "0.11.0";
8
8
 
9
9
  // src/login.ts
10
10
  import { createServer } from "http";
@@ -1184,7 +1184,14 @@ function buildPlan3(ctx) {
1184
1184
  // translate back to canonical models at ingress, and the header is
1185
1185
  // informational only (never auth/entitlements/billing). Claude Code sends
1186
1186
  // ANTHROPIC_CUSTOM_HEADERS on the discovery GET too (vendor gateway guide).
1187
- { name: "ANTHROPIC_CUSTOM_HEADERS", value: "X-LunaRoute-Client: claude-desktop" }
1187
+ { name: "ANTHROPIC_CUSTOM_HEADERS", value: "X-LunaRoute-Client: claude-desktop" },
1188
+ // Populates the /model picker from GET /v1/models. Gateway discovery is
1189
+ // opt-in since Claude Code v2.1.129: without this export the picker lists
1190
+ // only ANTHROPIC_MODEL and the aliases silently never appear (kata d7fm).
1191
+ // Mirrors the run adapter and the Connect tab. The hint header above is a
1192
+ // separate setting: that one fast-paths auxiliary requests, this one
1193
+ // fills the picker.
1194
+ { name: "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY", value: "1" }
1188
1195
  ],
1189
1196
  notes: [
1190
1197
  ...isWin ? [
@@ -1330,11 +1337,20 @@ function buildPlan5(ctx) {
1330
1337
  "[model_providers.lunaroute]",
1331
1338
  'name = "LunaRoute"',
1332
1339
  `base_url = "${base}/v1"`,
1340
+ // Codex's model discovery decodes {models:[ModelInfo]} and cannot read
1341
+ // the OpenAI-shaped /v1/models, so it fetches its own Codex-shaped path
1342
+ // (kata 3jrx). This is what populates the /model picker.
1343
+ `model_catalog_url = "${base}/v1/codex/models"`,
1333
1344
  'env_key = "LUNAROUTE_API_KEY"',
1334
1345
  'wire_api = "responses"',
1335
1346
  // Codex only calls /v1/alpha/search when the provider opts in; the
1336
1347
  // endpoint is derived from base_url by the /responses suffix swap.
1337
- "supports_standalone_web_search = true"
1348
+ "supports_standalone_web_search = true",
1349
+ "",
1350
+ // No-op on current Codex (Stable, default-on); enables discovery on
1351
+ // builds where the flag was still under development.
1352
+ "[features]",
1353
+ "api_key_model_discovery = true"
1338
1354
  ]).join("\n") + "\n";
1339
1355
  return {
1340
1356
  fileWrites: [{ kind: "text", path: codexProfilePath(), content }],
@@ -1344,7 +1360,7 @@ function buildPlan5(ctx) {
1344
1360
  `Change model to any of: ${ctx.models.map((m) => m.id).join(", ")}, or pass \`--model <id>\` for one session. If you change model, update or remove model_context_window to match.`,
1345
1361
  "The key rides the Authorization: Bearer header via env_key; LunaRoute authenticates the lr_ key at the edge and never forwards it upstream.",
1346
1362
  "One file: the model and the named provider live in the profile file \u2014 your ~/.codex/config.toml is untouched.",
1347
- "Codex logs a `Model metadata ... fallback metadata` warning for LunaRoute models (its /v1/models catalog shape differs); it is expected and harmless \u2014 model_context_window pins the real window above."
1363
+ "Codex discovers the LunaRoute catalog via the profile's `model_catalog_url`, so its `/model` picker lists all LunaRoute chat models and the `fallback metadata` warning is gone."
1348
1364
  ]
1349
1365
  };
1350
1366
  }
@@ -3026,21 +3042,29 @@ function buildRunSpec(ctx) {
3026
3042
  // at ingress. Informational header only — it never affects
3027
3043
  // auth/entitlements/billing. Claude Code sends ANTHROPIC_CUSTOM_HEADERS
3028
3044
  // on the discovery GET too (vendor gateway guide).
3029
- ANTHROPIC_CUSTOM_HEADERS: "X-LunaRoute-Client: claude-desktop"
3045
+ ANTHROPIC_CUSTOM_HEADERS: "X-LunaRoute-Client: claude-desktop",
3046
+ // LunaRoute fast-paths auxiliary requests (auto-mode classifier and
3047
+ // friends) that carry this hint instead of queueing them behind the
3048
+ // session's own requests. Mirrors setup's export and the Connect tab;
3049
+ // its absence here was the mirror image of the missing discovery flag
3050
+ // (kata d7fm).
3051
+ CLAUDE_CODE_GATEWAY_HINT_HEADERS: "1"
3030
3052
  }
3031
3053
  };
3032
3054
  }
3033
3055
 
3034
3056
  // src/run/adapters/codex.ts
3035
3057
  function buildRunSpec2(ctx) {
3036
- const provider = `{name="LunaRoute",base_url="${ctx.routingUrl}/v1",env_key="LUNAROUTE_API_KEY",wire_api="responses",supports_standalone_web_search=true}`;
3058
+ const provider = `{name="LunaRoute",base_url="${ctx.routingUrl}/v1",model_catalog_url="${ctx.routingUrl}/v1/codex/models",env_key="LUNAROUTE_API_KEY",wire_api="responses",supports_standalone_web_search=true}`;
3037
3059
  const args = [
3038
3060
  "-c",
3039
3061
  'model_provider="lunaroute"',
3040
3062
  "-c",
3041
3063
  `model_providers.lunaroute=${provider}`,
3042
3064
  "-c",
3043
- `model="${ctx.model}"`
3065
+ `model="${ctx.model}"`,
3066
+ "-c",
3067
+ "features.api_key_model_discovery=true"
3044
3068
  ];
3045
3069
  if (Number.isInteger(ctx.contextWindow) && (ctx.contextWindow ?? 0) > 0) {
3046
3070
  args.push("-c", `model_context_window=${ctx.contextWindow}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunaroute/cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "LunaRoute CLI — configure coding harnesses and manage your LunaRoute account.",
5
5
  "repository": {
6
6
  "type": "git",