claudish 14.16.0 → 14.16.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 +31 -24
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -5491,7 +5491,7 @@ var init_onepassword_config = __esm(() => {
5491
5491
  });
5492
5492
 
5493
5493
  // src/version.ts
5494
- var VERSION = "14.16.0";
5494
+ var VERSION = "14.16.1";
5495
5495
 
5496
5496
  // src/redact.ts
5497
5497
  function isPlaceholder(value) {
@@ -55948,6 +55948,27 @@ function startAllowanceFlight() {
55948
55948
  return () => {};
55949
55949
  }
55950
55950
  }
55951
+ function replaceUnsupportedParts(messages, types) {
55952
+ const replacePart = (part) => {
55953
+ if (part?.type === "tool_result" && Array.isArray(part.content)) {
55954
+ return { ...part, content: part.content.map(replacePart) };
55955
+ }
55956
+ if (!types.includes(part?.type))
55957
+ return part;
55958
+ const kind = part.type === "document" ? "document" : "image";
55959
+ return { type: "text", text: `[${kind} omitted: this model does not accept ${kind} input]` };
55960
+ };
55961
+ for (const msg of messages) {
55962
+ if (!Array.isArray(msg.content))
55963
+ continue;
55964
+ msg.content = msg.content.map(replacePart);
55965
+ if (msg.content.length === 1 && msg.content[0].type === "text") {
55966
+ msg.content = msg.content[0].text;
55967
+ } else if (msg.content.length === 0) {
55968
+ msg.content = "";
55969
+ }
55970
+ }
55971
+ }
55951
55972
  function extractAuthHeaders(c) {
55952
55973
  const headers = c.req.header();
55953
55974
  const auth = {};
@@ -56457,20 +56478,24 @@ class ComposedHandler {
56457
56478
  tools = tools.slice(0, maxToolCount);
56458
56479
  }
56459
56480
  if (!this.getModelSupportsVision()) {
56481
+ const isUnsupportedPart = (part) => part?.type === "image_url" || part?.type === "image" || part?.type === "document";
56460
56482
  const imageBlocks = [];
56483
+ let nestedImageCount = 0;
56461
56484
  for (let msgIdx = 0;msgIdx < messages.length; msgIdx++) {
56462
56485
  const msg = messages[msgIdx];
56463
56486
  if (Array.isArray(msg.content)) {
56464
56487
  for (let partIdx = 0;partIdx < msg.content.length; partIdx++) {
56465
56488
  const part = msg.content[partIdx];
56466
- if (part.type === "image_url" || part.type === "image" || part.type === "document") {
56489
+ if (isUnsupportedPart(part)) {
56467
56490
  imageBlocks.push({ msgIdx, partIdx, block: part });
56491
+ } else if (part?.type === "tool_result" && Array.isArray(part.content)) {
56492
+ nestedImageCount += part.content.filter(isUnsupportedPart).length;
56468
56493
  }
56469
56494
  }
56470
56495
  }
56471
56496
  }
56472
- if (imageBlocks.length > 0) {
56473
- log(`[ComposedHandler] Non-vision model received ${imageBlocks.length} image(s), calling vision proxy`);
56497
+ if (imageBlocks.length + nestedImageCount > 0) {
56498
+ log(`[ComposedHandler] Non-vision model received ${imageBlocks.length + nestedImageCount} image(s), calling vision proxy`);
56474
56499
  const openAIImageBlocks = imageBlocks.filter((b) => b.block.type === "image_url");
56475
56500
  let descriptions = null;
56476
56501
  if (openAIImageBlocks.length > 0) {
@@ -56486,28 +56511,10 @@ class ComposedHandler {
56486
56511
  };
56487
56512
  }
56488
56513
  log(`[ComposedHandler] Vision proxy described ${descriptions.length} image(s)`);
56489
- for (const msg of messages) {
56490
- if (Array.isArray(msg.content)) {
56491
- msg.content = msg.content.filter((part) => part.type !== "image" && part.type !== "document");
56492
- if (msg.content.length === 1 && msg.content[0].type === "text") {
56493
- msg.content = msg.content[0].text;
56494
- } else if (msg.content.length === 0) {
56495
- msg.content = "";
56496
- }
56497
- }
56498
- }
56514
+ replaceUnsupportedParts(messages, ["image", "document"]);
56499
56515
  } else {
56500
56516
  log("[ComposedHandler] Stripping image/document blocks (vision not supported)");
56501
- for (const msg of messages) {
56502
- if (Array.isArray(msg.content)) {
56503
- msg.content = msg.content.filter((part) => part.type !== "image_url" && part.type !== "image" && part.type !== "document");
56504
- if (msg.content.length === 1 && msg.content[0].type === "text") {
56505
- msg.content = msg.content[0].text;
56506
- } else if (msg.content.length === 0) {
56507
- msg.content = "";
56508
- }
56509
- }
56510
- }
56517
+ replaceUnsupportedParts(messages, ["image_url", "image", "document"]);
56511
56518
  }
56512
56519
  }
56513
56520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "14.16.0",
3
+ "version": "14.16.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",
@@ -71,10 +71,10 @@
71
71
  "ai"
72
72
  ],
73
73
  "optionalDependencies": {
74
- "@claudish/magmux-darwin-arm64": "14.16.0",
75
- "@claudish/magmux-darwin-x64": "14.16.0",
76
- "@claudish/magmux-linux-arm64": "14.16.0",
77
- "@claudish/magmux-linux-x64": "14.16.0"
74
+ "@claudish/magmux-darwin-arm64": "14.16.1",
75
+ "@claudish/magmux-darwin-x64": "14.16.1",
76
+ "@claudish/magmux-linux-arm64": "14.16.1",
77
+ "@claudish/magmux-linux-x64": "14.16.1"
78
78
  },
79
79
  "author": "Jack Rudenko <i@madappgang.com>",
80
80
  "license": "MIT",