claudish 9.0.5 → 9.0.6

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 +102 -6
  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.6";
719
719
 
720
720
  // src/logger.ts
721
721
  import { appendFile, existsSync as existsSync2, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
@@ -20319,6 +20319,62 @@ function normalizeType(type) {
20319
20319
  }
20320
20320
  return type;
20321
20321
  }
20322
+ function canonicalKey(value) {
20323
+ if (value === null || typeof value !== "object")
20324
+ return JSON.stringify(value) ?? "null";
20325
+ if (Array.isArray(value))
20326
+ return `[${value.map(canonicalKey).join(",")}]`;
20327
+ return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalKey(value[key])}`).join(",")}}`;
20328
+ }
20329
+ function dedupeBranches(branches) {
20330
+ const seen = new Set;
20331
+ const unique = [];
20332
+ for (const branch of branches) {
20333
+ const key = canonicalKey(branch);
20334
+ if (seen.has(key))
20335
+ continue;
20336
+ seen.add(key);
20337
+ unique.push(branch);
20338
+ }
20339
+ return unique;
20340
+ }
20341
+ function describesNothing(entry) {
20342
+ return Object.keys(entry).every((key) => ANNOTATION_KEYWORDS.has(key));
20343
+ }
20344
+ function unionBranches(entries) {
20345
+ const branches = [];
20346
+ for (const entry of entries) {
20347
+ if (!entry || typeof entry !== "object")
20348
+ continue;
20349
+ if (entry.type === "null")
20350
+ continue;
20351
+ if (describesNothing(entry))
20352
+ branches.push(...ANY_VALUE_BRANCHES.map((b) => ({ ...b })));
20353
+ else
20354
+ branches.push(sanitizeSchemaForGemini(entry));
20355
+ }
20356
+ return dedupeBranches(branches);
20357
+ }
20358
+ function tupleElementSchema(entries) {
20359
+ const branches = unionBranches(entries);
20360
+ if (branches.length === 0)
20361
+ return { type: "string" };
20362
+ if (branches.length === 1)
20363
+ return branches[0];
20364
+ return { anyOf: branches };
20365
+ }
20366
+ function describeTuple(entries) {
20367
+ const shape = entries.map((entry) => {
20368
+ if (!entry || typeof entry !== "object" || describesNothing(entry))
20369
+ return "any";
20370
+ const type = normalizeType(entry.type);
20371
+ const values = Array.isArray(entry.enum) ? entry.enum.filter((v) => typeof v === "string" || typeof v === "number") : [];
20372
+ if (values.length === 0)
20373
+ return type;
20374
+ return `${type} (one of: ${values.map((v) => JSON.stringify(v)).join(", ")})`;
20375
+ }).join(", ");
20376
+ return `Ordered ${entries.length}-element array: [${shape}].`;
20377
+ }
20322
20378
  function sanitizeSchemaForGemini(schema) {
20323
20379
  if (!schema || typeof schema !== "object") {
20324
20380
  return schema;
@@ -20326,6 +20382,18 @@ function sanitizeSchemaForGemini(schema) {
20326
20382
  if (Array.isArray(schema)) {
20327
20383
  return schema.map((item) => sanitizeSchemaForGemini(item));
20328
20384
  }
20385
+ const unionSource = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : null;
20386
+ const hasStructuralSiblings = schema.type !== undefined || schema.properties !== undefined || schema.required !== undefined || schema.items !== undefined || schema.prefixItems !== undefined;
20387
+ if (unionSource && !hasStructuralSiblings) {
20388
+ const branches = unionBranches(unionSource);
20389
+ if (branches.length > 0) {
20390
+ const union = branches.length === 1 ? branches[0] : { anyOf: branches };
20391
+ if (typeof schema.description === "string" && !union.description) {
20392
+ union.description = schema.description;
20393
+ }
20394
+ return union;
20395
+ }
20396
+ }
20329
20397
  const result = {};
20330
20398
  const normalizedType = normalizeType(schema.type);
20331
20399
  result.type = normalizedType;
@@ -20346,12 +20414,27 @@ function sanitizeSchemaForGemini(schema) {
20346
20414
  }
20347
20415
  }
20348
20416
  }
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]);
20417
+ if (typeof schema.minItems === "number")
20418
+ result.minItems = schema.minItems;
20419
+ if (typeof schema.maxItems === "number")
20420
+ result.maxItems = schema.maxItems;
20421
+ const tupleEntries = Array.isArray(schema.prefixItems) ? schema.prefixItems : Array.isArray(schema.items) ? schema.items : null;
20422
+ if (tupleEntries) {
20423
+ const restSchema = Array.isArray(schema.prefixItems) && schema.items && typeof schema.items === "object" ? [schema.items] : [];
20424
+ result.items = tupleElementSchema([...tupleEntries, ...restSchema]);
20425
+ result.type = "array";
20426
+ if (tupleEntries.length > 0) {
20427
+ const note = describeTuple(tupleEntries);
20428
+ result.description = result.description ? `${result.description} ${note}` : note;
20354
20429
  }
20430
+ if (schema.items === false && result.maxItems === undefined) {
20431
+ result.maxItems = tupleEntries.length;
20432
+ }
20433
+ } else if (schema.items && typeof schema.items === "object") {
20434
+ result.items = sanitizeSchemaForGemini(schema.items);
20435
+ }
20436
+ if (result.type === "array" && !result.items) {
20437
+ result.items = { type: "string" };
20355
20438
  }
20356
20439
  return result;
20357
20440
  }
@@ -20377,8 +20460,21 @@ function convertToolsToGemini(tools) {
20377
20460
  }
20378
20461
  return [{ functionDeclarations }];
20379
20462
  }
20463
+ var ANY_VALUE_BRANCHES, ANNOTATION_KEYWORDS;
20380
20464
  var init_gemini_schema = __esm(() => {
20381
20465
  init_logger();
20466
+ ANY_VALUE_BRANCHES = [{ type: "string" }, { type: "number" }, { type: "boolean" }];
20467
+ ANNOTATION_KEYWORDS = new Set([
20468
+ "description",
20469
+ "title",
20470
+ "$comment",
20471
+ "default",
20472
+ "examples",
20473
+ "example",
20474
+ "deprecated",
20475
+ "readOnly",
20476
+ "writeOnly"
20477
+ ]);
20382
20478
  });
20383
20479
 
20384
20480
  // src/handlers/shared/format/identity-filter.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "9.0.5",
3
+ "version": "9.0.6",
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.6",
64
+ "@claudish/magmux-darwin-x64": "9.0.6",
65
+ "@claudish/magmux-linux-arm64": "9.0.6",
66
+ "@claudish/magmux-linux-x64": "9.0.6"
67
67
  },
68
68
  "author": "Jack Rudenko <i@madappgang.com>",
69
69
  "license": "MIT",