@lunaroute/cli 0.6.0 → 0.6.1

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 +24 -11
  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.6.0";
7
+ var version = "0.6.1";
8
8
 
9
9
  // src/login.ts
10
10
  import { createServer } from "http";
@@ -469,7 +469,8 @@ var KeyRejectedError = class extends Error {
469
469
  var NON_CHAT_CAPABILITIES = [
470
470
  "image_generation",
471
471
  "embeddings",
472
- "rerank"
472
+ "rerank",
473
+ "systemone"
473
474
  ];
474
475
  function isChatModel(m) {
475
476
  for (const c of NON_CHAT_CAPABILITIES) {
@@ -1021,9 +1022,20 @@ function buildKeyPlan2(key2) {
1021
1022
  };
1022
1023
  }
1023
1024
 
1025
+ // src/setup/adapters/first-model.ts
1026
+ function requireFirstModel(ctx, harness) {
1027
+ const first = ctx.models[0]?.id;
1028
+ if (!first) {
1029
+ throw new Error(
1030
+ `no LunaRoute chat models in the catalog \u2014 nothing to configure for ${harness}`
1031
+ );
1032
+ }
1033
+ return first;
1034
+ }
1035
+
1024
1036
  // src/setup/adapters/claudeCode.ts
1025
1037
  function buildPlan3(ctx) {
1026
- const firstModel = ctx.models[0]?.id ?? "<model>";
1038
+ const firstModel = requireFirstModel(ctx, "claude-code");
1027
1039
  return {
1028
1040
  fileWrites: [],
1029
1041
  exports: [
@@ -1078,7 +1090,7 @@ function validatedRoutingUrl(routingUrl) {
1078
1090
  // src/setup/adapters/codex.ts
1079
1091
  function buildPlan4(ctx) {
1080
1092
  const base = validatedRoutingUrl(ctx.routingUrl);
1081
- const model = ctx.models[0]?.id ?? "<model>";
1093
+ const model = requireFirstModel(ctx, "codex");
1082
1094
  const contextWindow = ctx.models[0]?.context_window_tokens;
1083
1095
  const lines = [`model = "${model}"`, 'model_provider = "lunaroute"'];
1084
1096
  if (Number.isInteger(contextWindow) && (contextWindow ?? 0) > 0) {
@@ -1107,7 +1119,7 @@ function buildPlan4(ctx) {
1107
1119
 
1108
1120
  // src/setup/adapters/copilotCli.ts
1109
1121
  function buildPlan5(ctx) {
1110
- const firstModel = ctx.models[0]?.id ?? "<model>";
1122
+ const firstModel = requireFirstModel(ctx, "copilot-cli");
1111
1123
  return {
1112
1124
  fileWrites: [],
1113
1125
  exports: [
@@ -1141,8 +1153,8 @@ function buildPlan6(ctx) {
1141
1153
  ` Base URL: ${ctx.routingUrl}/v1`,
1142
1154
  ` Auth: header Authorization: Bearer $${ctx.keyEnvVar}`,
1143
1155
  ` Auth (alt): path ${ctx.routingUrl}/a/$${ctx.keyEnvVar}/v1`,
1144
- ` Sample model id: ${ctx.models[0]?.id ?? "<model>"}`,
1145
- ` All models: ${ctx.models.map((m) => m.id).join(", ")}`
1156
+ ` Sample model id: ${ctx.models[0]?.id ?? "(no chat models in the catalog yet)"}`,
1157
+ ` All models: ${ctx.models.map((m) => m.id).join(", ") || "(none)"}`
1146
1158
  ]
1147
1159
  };
1148
1160
  }
@@ -1154,6 +1166,7 @@ function asRecord(v) {
1154
1166
  function buildPlan7(ctx) {
1155
1167
  const base = validatedRoutingUrl(ctx.routingUrl);
1156
1168
  const models = ctx.models.map((m) => ({ id: m.id, name: m.id }));
1169
+ const primary = requireFirstModel(ctx, "openclaw");
1157
1170
  return {
1158
1171
  fileWrites: [
1159
1172
  {
@@ -1191,7 +1204,7 @@ function buildPlan7(ctx) {
1191
1204
  model: {
1192
1205
  ...model,
1193
1206
  // Preserve an existing primary model, like OpenClaw onboarding.
1194
- primary: model.primary ?? `lunaroute/${ctx.models[0]?.id ?? "<model>"}`
1207
+ primary: model.primary ?? `lunaroute/${primary}`
1195
1208
  }
1196
1209
  }
1197
1210
  }
@@ -1202,7 +1215,7 @@ function buildPlan7(ctx) {
1202
1215
  exports: [{ name: ctx.keyEnvVar, value: "__KEY__" }],
1203
1216
  notes: [
1204
1217
  `
1205
- openclaw: restart the gateway, then \`openclaw models list\` and \`openclaw models set lunaroute/${ctx.models[0]?.id ?? "<model>"}\` (only if you have no default model already). If lunaroute/* models do not appear in \`openclaw models list\`, check that models.mode is merge \u2014 setup preserves whatever mode you have.`
1218
+ openclaw: restart the gateway, then \`openclaw models list\` and \`openclaw models set lunaroute/${primary}\` (only if you have no default model already). If lunaroute/* models do not appear in \`openclaw models list\`, check that models.mode is merge \u2014 setup preserves whatever mode you have.`
1206
1219
  ]
1207
1220
  };
1208
1221
  }
@@ -1380,7 +1393,7 @@ async function runSetup(harness, opts, deps = {
1380
1393
  return 1;
1381
1394
  }
1382
1395
  if (opts.key && (opts.extension || opts.models)) {
1383
- console.error("--key runs the full pi or opencode flow; drop --extension/--models.");
1396
+ console.error("--key runs the full setup flow for every harness; drop --extension/--models.");
1384
1397
  return 1;
1385
1398
  }
1386
1399
  const adapter = ADAPTERS[harness];
@@ -1449,7 +1462,7 @@ async function runSetup(harness, opts, deps = {
1449
1462
  models = await fetchModels(routingUrl, creds.routing_key);
1450
1463
  } catch (err) {
1451
1464
  console.error(
1452
- `Could not fetch the model catalog (${err instanceof Error ? err.message : err}) \u2014 continuing; model ids show as <model> until it answers.`
1465
+ `Could not fetch the model catalog (${err instanceof Error ? err.message : err}).`
1453
1466
  );
1454
1467
  models = [];
1455
1468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunaroute/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "LunaRoute CLI — configure coding harnesses and manage your LunaRoute account.",
5
5
  "repository": {
6
6
  "type": "git",