claudish 9.0.5 → 9.0.7

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 +123 -7
  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.0.5";
718
+ var VERSION = "9.0.7";
719
719
 
720
720
  // src/logger.ts
721
721
  import { appendFile, existsSync as existsSync2, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
@@ -18330,6 +18330,9 @@ function lookupModelCapabilities(modelId, cachePath) {
18330
18330
  return;
18331
18331
  return { supportsTools: entry.supportsTools, supportsThinking: entry.supportsThinking };
18332
18332
  }
18333
+ function lookupModelEndpoint(modelId, transport, cachePath) {
18334
+ return findCacheEntry(modelId, cachePath)?.endpoints?.[transport];
18335
+ }
18333
18336
  function lookupModelForProvider(modelId, provider, cachePath) {
18334
18337
  const entry = findCacheEntry(modelId, cachePath);
18335
18338
  if (!entry)
@@ -20319,6 +20322,62 @@ function normalizeType(type) {
20319
20322
  }
20320
20323
  return type;
20321
20324
  }
20325
+ function canonicalKey(value) {
20326
+ if (value === null || typeof value !== "object")
20327
+ return JSON.stringify(value) ?? "null";
20328
+ if (Array.isArray(value))
20329
+ return `[${value.map(canonicalKey).join(",")}]`;
20330
+ return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalKey(value[key])}`).join(",")}}`;
20331
+ }
20332
+ function dedupeBranches(branches) {
20333
+ const seen = new Set;
20334
+ const unique = [];
20335
+ for (const branch of branches) {
20336
+ const key = canonicalKey(branch);
20337
+ if (seen.has(key))
20338
+ continue;
20339
+ seen.add(key);
20340
+ unique.push(branch);
20341
+ }
20342
+ return unique;
20343
+ }
20344
+ function describesNothing(entry) {
20345
+ return Object.keys(entry).every((key) => ANNOTATION_KEYWORDS.has(key));
20346
+ }
20347
+ function unionBranches(entries) {
20348
+ const branches = [];
20349
+ for (const entry of entries) {
20350
+ if (!entry || typeof entry !== "object")
20351
+ continue;
20352
+ if (entry.type === "null")
20353
+ continue;
20354
+ if (describesNothing(entry))
20355
+ branches.push(...ANY_VALUE_BRANCHES.map((b) => ({ ...b })));
20356
+ else
20357
+ branches.push(sanitizeSchemaForGemini(entry));
20358
+ }
20359
+ return dedupeBranches(branches);
20360
+ }
20361
+ function tupleElementSchema(entries) {
20362
+ const branches = unionBranches(entries);
20363
+ if (branches.length === 0)
20364
+ return { type: "string" };
20365
+ if (branches.length === 1)
20366
+ return branches[0];
20367
+ return { anyOf: branches };
20368
+ }
20369
+ function describeTuple(entries) {
20370
+ const shape = entries.map((entry) => {
20371
+ if (!entry || typeof entry !== "object" || describesNothing(entry))
20372
+ return "any";
20373
+ const type = normalizeType(entry.type);
20374
+ const values = Array.isArray(entry.enum) ? entry.enum.filter((v) => typeof v === "string" || typeof v === "number") : [];
20375
+ if (values.length === 0)
20376
+ return type;
20377
+ return `${type} (one of: ${values.map((v) => JSON.stringify(v)).join(", ")})`;
20378
+ }).join(", ");
20379
+ return `Ordered ${entries.length}-element array: [${shape}].`;
20380
+ }
20322
20381
  function sanitizeSchemaForGemini(schema) {
20323
20382
  if (!schema || typeof schema !== "object") {
20324
20383
  return schema;
@@ -20326,6 +20385,18 @@ function sanitizeSchemaForGemini(schema) {
20326
20385
  if (Array.isArray(schema)) {
20327
20386
  return schema.map((item) => sanitizeSchemaForGemini(item));
20328
20387
  }
20388
+ const unionSource = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : null;
20389
+ const hasStructuralSiblings = schema.type !== undefined || schema.properties !== undefined || schema.required !== undefined || schema.items !== undefined || schema.prefixItems !== undefined;
20390
+ if (unionSource && !hasStructuralSiblings) {
20391
+ const branches = unionBranches(unionSource);
20392
+ if (branches.length > 0) {
20393
+ const union = branches.length === 1 ? branches[0] : { anyOf: branches };
20394
+ if (typeof schema.description === "string" && !union.description) {
20395
+ union.description = schema.description;
20396
+ }
20397
+ return union;
20398
+ }
20399
+ }
20329
20400
  const result = {};
20330
20401
  const normalizedType = normalizeType(schema.type);
20331
20402
  result.type = normalizedType;
@@ -20346,12 +20417,27 @@ function sanitizeSchemaForGemini(schema) {
20346
20417
  }
20347
20418
  }
20348
20419
  }
20349
- if (schema.items) {
20350
- if (typeof schema.items === "object" && !Array.isArray(schema.items)) {
20351
- result.items = sanitizeSchemaForGemini(schema.items);
20352
- } else if (Array.isArray(schema.items)) {
20353
- result.items = sanitizeSchemaForGemini(schema.items[0]);
20420
+ if (typeof schema.minItems === "number")
20421
+ result.minItems = schema.minItems;
20422
+ if (typeof schema.maxItems === "number")
20423
+ result.maxItems = schema.maxItems;
20424
+ const tupleEntries = Array.isArray(schema.prefixItems) ? schema.prefixItems : Array.isArray(schema.items) ? schema.items : null;
20425
+ if (tupleEntries) {
20426
+ const restSchema = Array.isArray(schema.prefixItems) && schema.items && typeof schema.items === "object" ? [schema.items] : [];
20427
+ result.items = tupleElementSchema([...tupleEntries, ...restSchema]);
20428
+ result.type = "array";
20429
+ if (tupleEntries.length > 0) {
20430
+ const note = describeTuple(tupleEntries);
20431
+ result.description = result.description ? `${result.description} ${note}` : note;
20354
20432
  }
20433
+ if (schema.items === false && result.maxItems === undefined) {
20434
+ result.maxItems = tupleEntries.length;
20435
+ }
20436
+ } else if (schema.items && typeof schema.items === "object") {
20437
+ result.items = sanitizeSchemaForGemini(schema.items);
20438
+ }
20439
+ if (result.type === "array" && !result.items) {
20440
+ result.items = { type: "string" };
20355
20441
  }
20356
20442
  return result;
20357
20443
  }
@@ -20377,8 +20463,21 @@ function convertToolsToGemini(tools) {
20377
20463
  }
20378
20464
  return [{ functionDeclarations }];
20379
20465
  }
20466
+ var ANY_VALUE_BRANCHES, ANNOTATION_KEYWORDS;
20380
20467
  var init_gemini_schema = __esm(() => {
20381
20468
  init_logger();
20469
+ ANY_VALUE_BRANCHES = [{ type: "string" }, { type: "number" }, { type: "boolean" }];
20470
+ ANNOTATION_KEYWORDS = new Set([
20471
+ "description",
20472
+ "title",
20473
+ "$comment",
20474
+ "default",
20475
+ "examples",
20476
+ "example",
20477
+ "deprecated",
20478
+ "readOnly",
20479
+ "writeOnly"
20480
+ ]);
20382
20481
  });
20383
20482
 
20384
20483
  // src/handlers/shared/format/identity-filter.ts
@@ -31993,6 +32092,14 @@ var init_model_unsupported = __esm(() => {
31993
32092
  ];
31994
32093
  });
31995
32094
 
32095
+ // src/handlers/shared/request-shape.ts
32096
+ function isRequestShapeError(errorBody) {
32097
+ if (!errorBody)
32098
+ return false;
32099
+ const lower = errorBody.toLowerCase();
32100
+ return lower.includes("unknown_parameter") || lower.includes("unsupported_parameter") || lower.includes("invalid_parameter") || lower.includes("unknown parameter:") || lower.includes("unsupported parameter:") || lower.includes("invalid parameter:");
32101
+ }
32102
+
31996
32103
  // src/handlers/shared/stream-head-sniffer.ts
31997
32104
  function isRetryableStreamError(code, type, message) {
31998
32105
  if (RETRYABLE_ERROR_CODES.has(code))
@@ -34915,6 +35022,9 @@ function getRecoveryHint(status, errorText, providerName, transportTerminal429)
34915
35022
  if (lower.includes("unsupported content type") || lower.includes("unsupported_content_type")) {
34916
35023
  return "Model doesn't support this content format. Try a different model.";
34917
35024
  }
35025
+ if (isRequestShapeError(errorText)) {
35026
+ return "Wrong request shape for this endpoint \u2014 the provider named the parameter it rejected (see the message below). Nothing was too large; a shorter prompt will not help.";
35027
+ }
34918
35028
  if (lower.includes("context") || lower.includes("too long") || lower.includes("token")) {
34919
35029
  return "Input too large. Reduce message history or use a larger-context model.";
34920
35030
  }
@@ -35653,9 +35763,14 @@ __export(exports_provider_profiles, {
35653
35763
  openCodeZenProfile: () => openCodeZenProfile,
35654
35764
  openaiCodexProfile: () => openaiCodexProfile,
35655
35765
  openaiProfile: () => openaiProfile,
35766
+ requiresResponsesApi: () => requiresResponsesApi,
35656
35767
  vertexProfile: () => vertexProfile
35657
35768
  });
35658
- function requiresResponsesApi(modelName) {
35769
+ function requiresResponsesApi(modelName, cachePath) {
35770
+ const endpoint = lookupModelEndpoint(modelName, "openai", cachePath);
35771
+ if (endpoint?.api === "responses" || endpoint?.toolsWithReasoning === "requires-responses") {
35772
+ return true;
35773
+ }
35659
35774
  const name = modelName.toLowerCase();
35660
35775
  return /^gpt-5\.6/.test(name) || name.includes("codex");
35661
35776
  }
@@ -35684,6 +35799,7 @@ var init_provider_profiles = __esm(() => {
35684
35799
  init_devin_api_format();
35685
35800
  init_gemini_api_format();
35686
35801
  init_litellm_api_format();
35802
+ init_model_catalog();
35687
35803
  init_ollama_api_format();
35688
35804
  init_openai_api_format();
35689
35805
  init_vertex_auth();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "9.0.5",
3
+ "version": "9.0.7",
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.0.5",
64
- "@claudish/magmux-darwin-x64": "9.0.5",
65
- "@claudish/magmux-linux-arm64": "9.0.5",
66
- "@claudish/magmux-linux-x64": "9.0.5"
63
+ "@claudish/magmux-darwin-arm64": "9.0.7",
64
+ "@claudish/magmux-darwin-x64": "9.0.7",
65
+ "@claudish/magmux-linux-arm64": "9.0.7",
66
+ "@claudish/magmux-linux-x64": "9.0.7"
67
67
  },
68
68
  "author": "Jack Rudenko <i@madappgang.com>",
69
69
  "license": "MIT",