@lunaroute/cli 0.14.0 → 0.14.2

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 +22 -5
  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.14.0";
7
+ var version = "0.14.2";
8
8
 
9
9
  // src/login.ts
10
10
  import { createServer } from "http";
@@ -667,7 +667,8 @@ var NON_CHAT_CAPABILITIES = [
667
667
  "image_generation",
668
668
  "embeddings",
669
669
  "rerank",
670
- "systemone"
670
+ "systemone",
671
+ "transcription"
671
672
  ];
672
673
  function isChatModel(m) {
673
674
  for (const c of NON_CHAT_CAPABILITIES) {
@@ -1339,6 +1340,9 @@ function requireFirstModel(ctx, harness) {
1339
1340
  function buildPlan3(ctx) {
1340
1341
  const firstModel = requireFirstModel(ctx, "claude-code");
1341
1342
  const isWin = (ctx.dialect ?? resolveDialect()) === "win32";
1343
+ const row = ctx.models[0];
1344
+ const windowTokens = row?.context_window_tokens && row.context_window_tokens > 0 ? row.context_window_tokens : void 0;
1345
+ const outputTokens = row?.max_output_tokens && row.max_output_tokens > 0 ? row.max_output_tokens : void 0;
1342
1346
  return {
1343
1347
  fileWrites: [],
1344
1348
  exports: [
@@ -1354,6 +1358,10 @@ function buildPlan3(ctx) {
1354
1358
  // 009h).
1355
1359
  { name: "ANTHROPIC_AUTH_TOKEN", value: `$${ctx.keyEnvVar}` },
1356
1360
  { name: "ANTHROPIC_MODEL", value: firstModel },
1361
+ // Declaring a below-200K window also stops a session from silently
1362
+ // outgrowing what we accept: Claude Code would not compact until 200K.
1363
+ ...windowTokens ? [{ name: "CLAUDE_CODE_MAX_CONTEXT_TOKENS", value: String(windowTokens) }] : [],
1364
+ ...outputTokens ? [{ name: "CLAUDE_CODE_MAX_OUTPUT_TOKENS", value: String(outputTokens) }] : [],
1357
1365
  // Pins Claude Code's background (Haiku-class) model — titles, summaries,
1358
1366
  // compaction, the auxiliary classifier — so those requests route through
1359
1367
  // LunaRoute instead of 404'ing against Anthropic's hardcoded Haiku id,
@@ -1395,6 +1403,9 @@ function buildPlan3(ctx) {
1395
1403
  "WSL is a separate environment: Windows user variables do not cross into it (WSLENV is the bridge) and the npm global install is separate. Run `lunaroute setup claude-code` again inside the distribution."
1396
1404
  ] : [],
1397
1405
  `Change ANTHROPIC_MODEL to any of: ${ctx.models.map((m) => m.id).join(", ")}`,
1406
+ ...windowTokens || outputTokens ? [
1407
+ "CLAUDE_CODE_MAX_CONTEXT_TOKENS / CLAUDE_CODE_MAX_OUTPUT_TOKENS carry the pinned model's real window and output cap: Claude Code otherwise assumes 200K and asks for 32K whatever /v1/models reports. They describe ANTHROPIC_MODEL, not the Claude-shaped alias ids the /model picker lists (Claude Code ignores the window variable for those, and for any id it recognizes as a Claude model \u2014 those run at their built-in window), and one value serves the whole session \u2014 re-run setup when you switch to a model with a different window or output cap. Claude Code clamps the output value to its own maximum, and a bigger output cap leaves less context before compaction."
1408
+ ] : [],
1398
1409
  "ANTHROPIC_CUSTOM_HEADERS carries X-LunaRoute-Client: claude-desktop so the /model picker's gateway discovery returns Claude-shaped alias ids instead of an empty list: Claude Code drops any discovered id without 'claude'/'anthropic' in it, and LunaRoute's normal catalog has none. The aliases route back to the real model at the gateway \u2014 pick one in /model like any other, or set ANTHROPIC_MODEL to a plain model id to skip the aliases.",
1399
1410
  "ANTHROPIC_DEFAULT_HAIKU_MODEL pins Claude Code's background model (titles, summaries, compaction, the auxiliary classifier) \u2014 it defaults to your main model, and you can point it at a smaller/faster model from the list above.",
1400
1411
  "(Auth travels in the Authorization: Bearer header via ANTHROPIC_AUTH_TOKEN.)",
@@ -3308,6 +3319,8 @@ async function runSkillInstall(profile, opts) {
3308
3319
 
3309
3320
  // src/run/adapters/claudeCode.ts
3310
3321
  function buildRunSpec(ctx) {
3322
+ const windowTokens = ctx.contextWindow && ctx.contextWindow > 0 ? ctx.contextWindow : void 0;
3323
+ const outputTokens = ctx.maxOutputTokens && ctx.maxOutputTokens > 0 ? ctx.maxOutputTokens : void 0;
3311
3324
  return {
3312
3325
  command: "claude",
3313
3326
  args: [],
@@ -3315,6 +3328,8 @@ function buildRunSpec(ctx) {
3315
3328
  ANTHROPIC_BASE_URL: ctx.routingUrl,
3316
3329
  ANTHROPIC_AUTH_TOKEN: ctx.apiKey,
3317
3330
  ANTHROPIC_MODEL: ctx.model,
3331
+ ...windowTokens ? { CLAUDE_CODE_MAX_CONTEXT_TOKENS: String(windowTokens) } : {},
3332
+ ...outputTokens ? { CLAUDE_CODE_MAX_OUTPUT_TOKENS: String(outputTokens) } : {},
3318
3333
  // Pins the Haiku/background model so Claude Code's background tasks
3319
3334
  // (titles, summaries, compaction) route through LunaRoute instead of
3320
3335
  // 404'ing against Anthropic's hardcoded Haiku id. Mirrors the Connect tab
@@ -3510,6 +3525,7 @@ var ADAPTERS2 = {
3510
3525
  agy: buildRunSpec4
3511
3526
  };
3512
3527
  var MODEL_LOOKUP_TIMEOUT_MS = 3e3;
3528
+ var WANTS_MODEL_ROW = /* @__PURE__ */ new Set(["codex", "claude", "claude-code"]);
3513
3529
  var INSTALL_HINT = {
3514
3530
  claude: "Install Claude Code: https://docs.anthropic.com/claude-code/install",
3515
3531
  "claude-code": "Install Claude Code: https://docs.anthropic.com/claude-code/install",
@@ -3551,7 +3567,7 @@ async function runRun(harness, opts, deps = realDeps) {
3551
3567
  return 1;
3552
3568
  }
3553
3569
  console.error(`# using model ${model} (pass --model to change)`);
3554
- } else if (usesModel && harness === "codex") {
3570
+ } else if (usesModel && WANTS_MODEL_ROW.has(harness)) {
3555
3571
  try {
3556
3572
  models = await deps.fetchModels(creds.routing_url, creds.routing_key, {
3557
3573
  signal: AbortSignal.timeout(MODEL_LOOKUP_TIMEOUT_MS)
@@ -3560,12 +3576,13 @@ async function runRun(harness, opts, deps = realDeps) {
3560
3576
  models = [];
3561
3577
  }
3562
3578
  }
3563
- const contextWindow = models.find((m) => m.id === model)?.context_window_tokens;
3579
+ const row = models.find((m) => m.id === model);
3564
3580
  const spec = adapter({
3565
3581
  routingUrl: creds.routing_url,
3566
3582
  apiKey: creds.routing_key,
3567
3583
  model,
3568
- contextWindow
3584
+ contextWindow: row?.context_window_tokens,
3585
+ maxOutputTokens: row?.max_output_tokens
3569
3586
  });
3570
3587
  if (spec.notice) console.error(spec.notice);
3571
3588
  const args = spec.args.concat(opts.passthrough ?? []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunaroute/cli",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "description": "LunaRoute CLI — configure coding harnesses and manage your LunaRoute account.",
5
5
  "repository": {
6
6
  "type": "git",