supercompat 3.17.0 → 3.17.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.
- package/dist/index.cjs +24 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5176,6 +5176,27 @@ var sanitizeContent = function(content) {
|
|
|
5176
5176
|
if (!content) return content;
|
|
5177
5177
|
return content.replace(ARTIFACT_TAGS, "").trim();
|
|
5178
5178
|
};
|
|
5179
|
+
var convertScreenshotToolMessages = function(messages5) {
|
|
5180
|
+
return messages5.map(function(msg) {
|
|
5181
|
+
if (msg.role !== "tool" || typeof msg.content !== "string") return msg;
|
|
5182
|
+
try {
|
|
5183
|
+
var parsed = JSON.parse(msg.content);
|
|
5184
|
+
if (parsed.type === "computer_screenshot" && parsed.image_url) {
|
|
5185
|
+
return _object_spread_props(_object_spread({}, msg), {
|
|
5186
|
+
content: [
|
|
5187
|
+
{
|
|
5188
|
+
type: "image_url",
|
|
5189
|
+
image_url: {
|
|
5190
|
+
url: parsed.image_url
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5193
|
+
]
|
|
5194
|
+
});
|
|
5195
|
+
}
|
|
5196
|
+
} catch (unused) {}
|
|
5197
|
+
return msg;
|
|
5198
|
+
});
|
|
5199
|
+
};
|
|
5179
5200
|
var post10 = function(param) {
|
|
5180
5201
|
var openRouter = param.openRouter;
|
|
5181
5202
|
return function(_url, options) {
|
|
@@ -5187,7 +5208,9 @@ var post10 = function(param) {
|
|
|
5187
5208
|
body = JSON.parse(options.body);
|
|
5188
5209
|
model = body.model;
|
|
5189
5210
|
_transformTools = transformTools(body.tools, model), transformedTools = _transformTools.tools, computerUseConfig = _transformTools.computerUseConfig;
|
|
5190
|
-
resultOptions = _object_spread({}, body,
|
|
5211
|
+
resultOptions = _object_spread({}, body, computerUseConfig && body.messages ? {
|
|
5212
|
+
messages: convertScreenshotToolMessages(body.messages)
|
|
5213
|
+
} : {}, transformedTools.length > 0 ? {
|
|
5191
5214
|
tools: transformedTools
|
|
5192
5215
|
} : {});
|
|
5193
5216
|
if (!body.stream) return [
|
|
@@ -5736,21 +5759,6 @@ var serializeToolContent = function(param) {
|
|
|
5736
5759
|
}
|
|
5737
5760
|
return JSON.stringify(toolCall.function.output);
|
|
5738
5761
|
}
|
|
5739
|
-
if (typeof toolCall.function.output === "string") {
|
|
5740
|
-
try {
|
|
5741
|
-
var parsed = JSON.parse(toolCall.function.output);
|
|
5742
|
-
if (parsed.type === "computer_screenshot" && parsed.image_url) {
|
|
5743
|
-
return [
|
|
5744
|
-
{
|
|
5745
|
-
type: "image_url",
|
|
5746
|
-
image_url: {
|
|
5747
|
-
url: parsed.image_url
|
|
5748
|
-
}
|
|
5749
|
-
}
|
|
5750
|
-
];
|
|
5751
|
-
}
|
|
5752
|
-
} catch (unused) {}
|
|
5753
|
-
}
|
|
5754
5762
|
return (_toolCall_function_output = toolCall.function.output) !== null && _toolCall_function_output !== void 0 ? _toolCall_function_output : "";
|
|
5755
5763
|
};
|
|
5756
5764
|
var serializeToolCall = function(param) {
|