claudish 3.3.5 → 3.3.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.
- package/dist/index.js +25 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57078,28 +57078,32 @@ class OpenAIHandler {
|
|
|
57078
57078
|
continue;
|
|
57079
57079
|
}
|
|
57080
57080
|
if (msg.role === "assistant" && msg.tool_calls) {
|
|
57081
|
-
const content = [];
|
|
57082
57081
|
if (msg.content) {
|
|
57083
57082
|
const textContent = typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content);
|
|
57084
57083
|
if (textContent) {
|
|
57085
|
-
|
|
57084
|
+
result.push({
|
|
57085
|
+
type: "message",
|
|
57086
|
+
role: "assistant",
|
|
57087
|
+
content: [{ type: "output_text", text: textContent }]
|
|
57088
|
+
});
|
|
57086
57089
|
}
|
|
57087
57090
|
}
|
|
57088
57091
|
for (const toolCall of msg.tool_calls) {
|
|
57089
57092
|
if (toolCall.type === "function") {
|
|
57090
|
-
|
|
57093
|
+
result.push({
|
|
57091
57094
|
type: "function_call",
|
|
57092
57095
|
call_id: toolCall.id,
|
|
57093
57096
|
name: toolCall.function.name,
|
|
57094
|
-
arguments: toolCall.function.arguments
|
|
57097
|
+
arguments: toolCall.function.arguments,
|
|
57098
|
+
status: "completed"
|
|
57095
57099
|
});
|
|
57096
57100
|
}
|
|
57097
57101
|
}
|
|
57098
|
-
result.push({ role: "assistant", content });
|
|
57099
57102
|
continue;
|
|
57100
57103
|
}
|
|
57101
57104
|
if (typeof msg.content === "string") {
|
|
57102
57105
|
result.push({
|
|
57106
|
+
type: "message",
|
|
57103
57107
|
role: msg.role,
|
|
57104
57108
|
content: [
|
|
57105
57109
|
{
|
|
@@ -57128,12 +57132,17 @@ class OpenAIHandler {
|
|
|
57128
57132
|
return block;
|
|
57129
57133
|
});
|
|
57130
57134
|
result.push({
|
|
57135
|
+
type: "message",
|
|
57131
57136
|
role: msg.role,
|
|
57132
57137
|
content: convertedContent
|
|
57133
57138
|
});
|
|
57134
57139
|
continue;
|
|
57135
57140
|
}
|
|
57136
|
-
|
|
57141
|
+
if (msg.role) {
|
|
57142
|
+
result.push({ type: "message", ...msg });
|
|
57143
|
+
} else {
|
|
57144
|
+
result.push(msg);
|
|
57145
|
+
}
|
|
57137
57146
|
}
|
|
57138
57147
|
return result;
|
|
57139
57148
|
}
|
|
@@ -57216,6 +57225,9 @@ data: ${JSON.stringify(messageStart)}
|
|
|
57216
57225
|
continue;
|
|
57217
57226
|
try {
|
|
57218
57227
|
const event = JSON.parse(data);
|
|
57228
|
+
if (getLogLevel() === "debug" && event.type) {
|
|
57229
|
+
log(`[OpenAIHandler] Responses event: ${event.type}`);
|
|
57230
|
+
}
|
|
57219
57231
|
if (event.type === "response.output_text.delta") {
|
|
57220
57232
|
if (!hasTextContent) {
|
|
57221
57233
|
const blockStart = {
|
|
@@ -57298,10 +57310,15 @@ data: ${JSON.stringify(blockStop)}
|
|
|
57298
57310
|
`));
|
|
57299
57311
|
}
|
|
57300
57312
|
}
|
|
57301
|
-
} else if (event.type === "response.completed") {
|
|
57313
|
+
} else if (event.type === "response.completed" || event.type === "response.done") {
|
|
57302
57314
|
if (event.response?.usage) {
|
|
57303
57315
|
inputTokens = event.response.usage.input_tokens || 0;
|
|
57304
57316
|
outputTokens = event.response.usage.output_tokens || 0;
|
|
57317
|
+
log(`[OpenAIHandler] Responses API usage: input=${inputTokens}, output=${outputTokens}`);
|
|
57318
|
+
} else if (event.usage) {
|
|
57319
|
+
inputTokens = event.usage.input_tokens || 0;
|
|
57320
|
+
outputTokens = event.usage.output_tokens || 0;
|
|
57321
|
+
log(`[OpenAIHandler] Responses API usage (alt): input=${inputTokens}, output=${outputTokens}`);
|
|
57305
57322
|
}
|
|
57306
57323
|
}
|
|
57307
57324
|
} catch (parseError) {
|
|
@@ -59438,7 +59455,7 @@ function printAvailableModelsJSON() {
|
|
|
59438
59455
|
console.log(JSON.stringify(output, null, 2));
|
|
59439
59456
|
}
|
|
59440
59457
|
}
|
|
59441
|
-
var __filename6, __dirname6, VERSION = "3.3.
|
|
59458
|
+
var __filename6, __dirname6, VERSION = "3.3.5", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, ALL_MODELS_JSON_PATH2;
|
|
59442
59459
|
var init_cli = __esm(() => {
|
|
59443
59460
|
init_dist11();
|
|
59444
59461
|
init_model_loader2();
|