claudish 9.6.0 → 9.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 +130 -8
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -715,7 +715,7 @@ var init_onepassword_config = __esm(() => {
715
715
  });
716
716
 
717
717
  // src/version.ts
718
- var VERSION = "9.6.0";
718
+ var VERSION = "9.6.1";
719
719
 
720
720
  // src/logger.ts
721
721
  import { appendFile, existsSync as existsSync2, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
@@ -21200,10 +21200,34 @@ function keepOnlyRealTools(extracted, knownToolNames, decodeToolName) {
21200
21200
  }
21201
21201
  return kept;
21202
21202
  }
21203
+ function unwrapToolCallTags(body) {
21204
+ if (!body.startsWith("<tool_call>"))
21205
+ return null;
21206
+ const blocks = [];
21207
+ let cursor = 0;
21208
+ while (cursor < body.length) {
21209
+ TOOL_CALL_OPEN_AT_CURSOR.lastIndex = cursor;
21210
+ if (!TOOL_CALL_OPEN_AT_CURSOR.exec(body))
21211
+ return null;
21212
+ cursor = TOOL_CALL_OPEN_AT_CURSOR.lastIndex;
21213
+ const close = body.indexOf(TOOL_CALL_CLOSE_TAG, cursor);
21214
+ const block = (close === -1 ? body.slice(cursor) : body.slice(cursor, close)).trim();
21215
+ if (!block.startsWith("<function="))
21216
+ return null;
21217
+ blocks.push(block);
21218
+ if (close === -1)
21219
+ break;
21220
+ cursor = close + TOOL_CALL_CLOSE_TAG.length;
21221
+ cursor += /^\s*/.exec(body.slice(cursor))?.[0].length ?? 0;
21222
+ }
21223
+ return blocks.length > 0 ? blocks.join(`
21224
+ `) : null;
21225
+ }
21203
21226
  function parseFunctionTagEnvelope(text) {
21204
- const body = text.trim();
21205
- if (body.length === 0)
21227
+ const trimmed = text.trim();
21228
+ if (trimmed.length === 0)
21206
21229
  return null;
21230
+ const body = unwrapToolCallTags(trimmed) ?? trimmed;
21207
21231
  if (!body.startsWith("<function="))
21208
21232
  return null;
21209
21233
  const calls = [];
@@ -21440,7 +21464,7 @@ function validateAndRepairToolCall(toolName, argsStr, toolSchemas, textContent)
21440
21464
  }
21441
21465
  return { valid: false, args, repaired: false, missingParams };
21442
21466
  }
21443
- var FUNCTION_TAG_SOURCE, FUNCTION_TAG_PRESENT, FUNCTION_TAG_AT_CURSOR, PARAMETER_TAG_AT_CURSOR;
21467
+ var FUNCTION_TAG_SOURCE, FUNCTION_TAG_PRESENT, FUNCTION_TAG_AT_CURSOR, PARAMETER_TAG_AT_CURSOR, TOOL_CALL_OPEN_AT_CURSOR, TOOL_CALL_CLOSE_TAG = "</tool_call>";
21444
21468
  var init_tool_call_recovery = __esm(() => {
21445
21469
  init_tool_name_utils();
21446
21470
  init_logger();
@@ -21449,6 +21473,7 @@ var init_tool_call_recovery = __esm(() => {
21449
21473
  FUNCTION_TAG_PRESENT = new RegExp(`<function=${TOOL_NAME_SOURCE}>`);
21450
21474
  FUNCTION_TAG_AT_CURSOR = new RegExp(`<function=(${TOOL_NAME_SOURCE})>`, "y");
21451
21475
  PARAMETER_TAG_AT_CURSOR = /<parameter=([^>\s]+)>/y;
21476
+ TOOL_CALL_OPEN_AT_CURSOR = /<tool_call>\s*/y;
21452
21477
  });
21453
21478
 
21454
21479
  // src/handlers/shared/web-search-detector.ts
@@ -57942,6 +57967,51 @@ var init_api_key_map = __esm(() => {
57942
57967
  };
57943
57968
  });
57944
57969
 
57970
+ // src/providers/provider-slug-resolve.ts
57971
+ function sharedPrefixLength(a, b) {
57972
+ let n = 0;
57973
+ while (n < a.length && n < b.length && a[n] === b[n])
57974
+ n++;
57975
+ return n;
57976
+ }
57977
+ function rankSuggestions(typed, providers) {
57978
+ const needle = typed.toLowerCase();
57979
+ const scored = [];
57980
+ for (const provider of providers) {
57981
+ const slug = provider.slug.toLowerCase();
57982
+ let score = 0;
57983
+ if (slug.includes(needle) || needle.includes(slug)) {
57984
+ score = 2;
57985
+ } else if (sharedPrefixLength(slug, needle) >= MIN_PREFIX_OVERLAP) {
57986
+ score = 1;
57987
+ }
57988
+ if (score > 0)
57989
+ scored.push({ provider, score });
57990
+ }
57991
+ scored.sort((a, b) => b.score - a.score || b.provider.count - a.provider.count);
57992
+ return scored.slice(0, SUGGESTION_LIMIT).map((s) => s.provider);
57993
+ }
57994
+ function resolveProviderSlug(typed, providers) {
57995
+ const routingOwner = reservedNamespaceOwner(typed) ?? null;
57996
+ if (providers.length === 0) {
57997
+ return { kind: "match", canonical: typed, suggestions: [], routingOwner };
57998
+ }
57999
+ const exact = providers.find((p) => p.slug.toLowerCase() === typed.toLowerCase());
58000
+ if (exact) {
58001
+ return { kind: "match", canonical: exact.slug, suggestions: [], routingOwner };
58002
+ }
58003
+ return {
58004
+ kind: "unknown",
58005
+ canonical: null,
58006
+ suggestions: rankSuggestions(typed, providers),
58007
+ routingOwner
58008
+ };
58009
+ }
58010
+ var SUGGESTION_LIMIT = 5, MIN_PREFIX_OVERLAP = 3;
58011
+ var init_provider_slug_resolve = __esm(() => {
58012
+ init_reserved_namespace();
58013
+ });
58014
+
57945
58015
  // src/branding.ts
57946
58016
  function paint(line) {
57947
58017
  const { RESET, BOLD, CYAN, BLUE, DIM } = cliAnsi();
@@ -58512,7 +58582,19 @@ Usage: claudish --models --provider <slug>`);
58512
58582
  const hasJsonFlag = args.includes("--json");
58513
58583
  const forceUpdate = config.forceUpdate || args.includes("--models-refresh");
58514
58584
  const providerIdx = args.indexOf("--provider");
58515
- const providerSlug = providerIdx !== -1 && providerIdx + 1 < args.length ? args[providerIdx + 1] : null;
58585
+ const inlineProvider = args.find((a) => a.startsWith("--provider="));
58586
+ let providerSlug = null;
58587
+ if (inlineProvider) {
58588
+ providerSlug = inlineProvider.slice("--provider=".length);
58589
+ } else if (providerIdx !== -1) {
58590
+ const next = args[providerIdx + 1];
58591
+ providerSlug = next && !next.startsWith("--") ? next : "";
58592
+ }
58593
+ if (providerSlug === "") {
58594
+ console.error("--provider needs a slug: claudish --models --provider <slug>");
58595
+ console.error("Run `claudish --providers` for the full list.");
58596
+ process.exit(1);
58597
+ }
58516
58598
  if (forceUpdate)
58517
58599
  clearAllModelCaches();
58518
58600
  if (query && providerSlug) {
@@ -58787,7 +58869,46 @@ Top ${response.total} models from Firebase (pool: ${response.poolSize} eligible)
58787
58869
  console.log("Top recommended: claudish --models-top");
58788
58870
  console.log("");
58789
58871
  }
58790
- async function printByProvider(providerSlug, jsonOutput) {
58872
+ function printUnknownProviderSlug(typedSlug, resolved, catalogSize, jsonOutput) {
58873
+ if (jsonOutput) {
58874
+ console.log(JSON.stringify({
58875
+ error: `"${typedSlug}" is not a provider slug in the model catalog`,
58876
+ provider: typedSlug,
58877
+ suggestions: resolved.suggestions.map((s) => s.slug),
58878
+ routingPrefixOwner: resolved.routingOwner,
58879
+ validSlugs: catalogSize
58880
+ }, null, 2));
58881
+ return;
58882
+ }
58883
+ console.error(`
58884
+ \u274C "${typedSlug}" is not a provider slug in the model catalog.`);
58885
+ if (resolved.suggestions.length > 0) {
58886
+ const list = resolved.suggestions.map((s) => `${s.slug} (${s.count} active model${s.count === 1 ? "" : "s"})`).join(", ");
58887
+ console.error(`
58888
+ Did you mean: ${list}`);
58889
+ }
58890
+ if (resolved.routingOwner) {
58891
+ console.error(`
58892
+ "${typedSlug}" IS a claudish routing prefix for the "${resolved.routingOwner}" provider \u2014` + `
58893
+ use it with --model: claudish --model ${typedSlug}@<model-id>` + `
58894
+ Routing prefixes and catalog vendor slugs are different vocabularies.`);
58895
+ }
58896
+ console.error(`
58897
+ claudish --providers lists all ${catalogSize} catalog slugs`);
58898
+ console.error(` claudish -s ${typedSlug}${" ".repeat(Math.max(1, 12 - typedSlug.length))}searches model ids instead
58899
+ `);
58900
+ }
58901
+ async function printByProvider(typedSlug, jsonOutput) {
58902
+ let catalogProviders = [];
58903
+ try {
58904
+ catalogProviders = await getProviderList();
58905
+ } catch {}
58906
+ const resolved = resolveProviderSlug(typedSlug, catalogProviders);
58907
+ if (resolved.kind === "unknown") {
58908
+ printUnknownProviderSlug(typedSlug, resolved, catalogProviders.length, jsonOutput);
58909
+ process.exit(1);
58910
+ }
58911
+ const providerSlug = resolved.canonical ?? typedSlug;
58791
58912
  let models;
58792
58913
  try {
58793
58914
  models = await getModelsByProvider(providerSlug, 200);
@@ -58802,8 +58923,8 @@ async function printByProvider(providerSlug, jsonOutput) {
58802
58923
  }
58803
58924
  if (models.length === 0) {
58804
58925
  console.log(`
58805
- No active models found for provider "${providerSlug}". Try \`claudish -s <query>\` to search the full catalog.
58806
- `);
58926
+ Provider "${providerSlug}" is in the catalog but has no active models right now.`);
58927
+ console.log("Try `claudish -s <query>` to search the full catalog.\n");
58807
58928
  return;
58808
58929
  }
58809
58930
  console.log(`
@@ -59884,6 +60005,7 @@ var init_cli = __esm(() => {
59884
60005
  init_probe_live();
59885
60006
  init_probe_runner();
59886
60007
  init_provider_definitions();
60008
+ init_provider_slug_resolve();
59887
60009
  init_routing_rules();
59888
60010
  init_ansi();
59889
60011
  init_provider_resolver();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "9.6.0",
3
+ "version": "9.6.1",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,10 +60,10 @@
60
60
  "ai"
61
61
  ],
62
62
  "optionalDependencies": {
63
- "@claudish/magmux-darwin-arm64": "9.6.0",
64
- "@claudish/magmux-darwin-x64": "9.6.0",
65
- "@claudish/magmux-linux-arm64": "9.6.0",
66
- "@claudish/magmux-linux-x64": "9.6.0"
63
+ "@claudish/magmux-darwin-arm64": "9.6.1",
64
+ "@claudish/magmux-darwin-x64": "9.6.1",
65
+ "@claudish/magmux-linux-arm64": "9.6.1",
66
+ "@claudish/magmux-linux-x64": "9.6.1"
67
67
  },
68
68
  "author": "Jack Rudenko <i@madappgang.com>",
69
69
  "license": "MIT",