claudish 3.3.3 → 3.3.4

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 +70 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -57064,10 +57064,79 @@ class OpenAIHandler {
57064
57064
  }
57065
57065
  return payload;
57066
57066
  }
57067
+ convertMessagesToResponsesAPI(messages) {
57068
+ return messages.filter((msg) => msg.role !== "system").map((msg) => {
57069
+ if (msg.role === "tool") {
57070
+ return {
57071
+ role: "user",
57072
+ content: [
57073
+ {
57074
+ type: "input_text",
57075
+ text: `[Tool Result for ${msg.tool_call_id}]: ${typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content)}`
57076
+ }
57077
+ ]
57078
+ };
57079
+ }
57080
+ if (msg.role === "assistant" && msg.tool_calls) {
57081
+ const content = [];
57082
+ if (msg.content) {
57083
+ const textContent = typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content);
57084
+ if (textContent) {
57085
+ content.push({ type: "output_text", text: textContent });
57086
+ }
57087
+ }
57088
+ for (const toolCall of msg.tool_calls) {
57089
+ if (toolCall.type === "function") {
57090
+ content.push({
57091
+ type: "function_call",
57092
+ id: toolCall.id,
57093
+ name: toolCall.function.name,
57094
+ arguments: toolCall.function.arguments
57095
+ });
57096
+ }
57097
+ }
57098
+ return { role: "assistant", content };
57099
+ }
57100
+ if (typeof msg.content === "string") {
57101
+ return {
57102
+ role: msg.role,
57103
+ content: [
57104
+ {
57105
+ type: msg.role === "user" ? "input_text" : "output_text",
57106
+ text: msg.content
57107
+ }
57108
+ ]
57109
+ };
57110
+ }
57111
+ if (Array.isArray(msg.content)) {
57112
+ const convertedContent = msg.content.map((block) => {
57113
+ if (block.type === "text") {
57114
+ return {
57115
+ type: msg.role === "user" ? "input_text" : "output_text",
57116
+ text: block.text
57117
+ };
57118
+ }
57119
+ if (block.type === "image_url") {
57120
+ return {
57121
+ type: "input_image",
57122
+ image_url: block.image_url
57123
+ };
57124
+ }
57125
+ return block;
57126
+ });
57127
+ return {
57128
+ role: msg.role,
57129
+ content: convertedContent
57130
+ };
57131
+ }
57132
+ return msg;
57133
+ });
57134
+ }
57067
57135
  buildResponsesPayload(claudeRequest, messages, tools) {
57136
+ const convertedMessages = this.convertMessagesToResponsesAPI(messages);
57068
57137
  const payload = {
57069
57138
  model: this.modelName,
57070
- input: messages,
57139
+ input: convertedMessages,
57071
57140
  stream: true
57072
57141
  };
57073
57142
  if (claudeRequest.system) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
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",