supercompat 3.15.7 → 3.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.
- package/dist/index.cjs +1183 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +1159 -72
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1076,7 +1076,7 @@ var get3 = function(param) {
|
|
|
1076
1076
|
var azureAiProject = param.azureAiProject;
|
|
1077
1077
|
return function(_url, _options) {
|
|
1078
1078
|
return _async_to_generator(function() {
|
|
1079
|
-
var
|
|
1079
|
+
var models14, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, deployment, err, error;
|
|
1080
1080
|
return _ts_generator(this, function(_state) {
|
|
1081
1081
|
switch(_state.label){
|
|
1082
1082
|
case 0:
|
|
@@ -1086,7 +1086,7 @@ var get3 = function(param) {
|
|
|
1086
1086
|
,
|
|
1087
1087
|
14
|
|
1088
1088
|
]);
|
|
1089
|
-
|
|
1089
|
+
models14 = [];
|
|
1090
1090
|
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
1091
1091
|
_state.label = 1;
|
|
1092
1092
|
case 1:
|
|
@@ -1111,7 +1111,7 @@ var get3 = function(param) {
|
|
|
1111
1111
|
_value = _step.value;
|
|
1112
1112
|
deployment = _value;
|
|
1113
1113
|
if (deployment.type === "ModelDeployment" && "modelName" in deployment && "modelPublisher" in deployment) {
|
|
1114
|
-
|
|
1114
|
+
models14.push({
|
|
1115
1115
|
id: deployment.modelName,
|
|
1116
1116
|
object: "model",
|
|
1117
1117
|
created: Date.now(),
|
|
@@ -1177,7 +1177,7 @@ var get3 = function(param) {
|
|
|
1177
1177
|
2,
|
|
1178
1178
|
new Response(JSON.stringify({
|
|
1179
1179
|
object: "list",
|
|
1180
|
-
data:
|
|
1180
|
+
data: models14
|
|
1181
1181
|
}), {
|
|
1182
1182
|
status: 200,
|
|
1183
1183
|
headers: {
|
|
@@ -2540,7 +2540,7 @@ var post5 = function(param) {
|
|
|
2540
2540
|
stream = new ReadableStream({
|
|
2541
2541
|
start: function start(controller) {
|
|
2542
2542
|
return _async_to_generator(function() {
|
|
2543
|
-
var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex,
|
|
2543
|
+
var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex, parseJson3, getOrCreateIndexForToolUseId, assignBlockToToolUse, markComputerToolUse, getToolUseIdFromBlock, emitNormalizedToolCall, getOrCreateIndexForBlock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, toolUseId, _toolUseIdArgumentBuffer_get, buffered, parsed, normalized, toolCallIndex, chunkIndex, _toolUseIdArgumentBuffer_get1, buffered1, toolCallIndex1, chunkIndex1, messageDelta, delta, toolUseId1, _toolUseIdArgumentBuffer_get2, _chunk_delta_partial_json, existing, updated, parsed1, normalized1, toolCallIndex2, chunkIndex2, _toolUseIdArgumentBuffer_get3, _chunk_delta_partial_json1, existing1, index, messageDelta1, delta1, toolName, normalizedToolName, index1, index2, _chunk_content_block_content, _getToolUseIdFromBlock, outputPayload, toolCallId, index3, _getToolUseIdFromBlock1, _chunk_content_block_content1, toolCallId1, _chunk_content_block, _toolUseId, _type, _id, rest, index4, outputPayload1, messageDelta2, messageDelta3, err;
|
|
2544
2544
|
return _ts_generator(this, function(_state) {
|
|
2545
2545
|
switch(_state.label){
|
|
2546
2546
|
case 0:
|
|
@@ -2550,7 +2550,7 @@ var post5 = function(param) {
|
|
|
2550
2550
|
computerToolUseIds = /* @__PURE__ */ new Set();
|
|
2551
2551
|
normalizedComputerCalls = /* @__PURE__ */ new Set();
|
|
2552
2552
|
nextToolCallIndex = 0;
|
|
2553
|
-
|
|
2553
|
+
parseJson3 = function(value) {
|
|
2554
2554
|
try {
|
|
2555
2555
|
return JSON.parse(value);
|
|
2556
2556
|
} catch (unused) {
|
|
@@ -2647,7 +2647,7 @@ var post5 = function(param) {
|
|
|
2647
2647
|
if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
|
|
2648
2648
|
;
|
|
2649
2649
|
buffered = (_toolUseIdArgumentBuffer_get = toolUseIdArgumentBuffer.get(toolUseId)) !== null && _toolUseIdArgumentBuffer_get !== void 0 ? _toolUseIdArgumentBuffer_get : "";
|
|
2650
|
-
parsed = buffered ?
|
|
2650
|
+
parsed = buffered ? parseJson3(buffered) : void 0;
|
|
2651
2651
|
if (parsed !== void 0) {
|
|
2652
2652
|
normalized = normalizeComputerToolCallPayload(parsed);
|
|
2653
2653
|
toolCallIndex = getOrCreateIndexForToolUseId(toolUseId);
|
|
@@ -2712,7 +2712,7 @@ var post5 = function(param) {
|
|
|
2712
2712
|
updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
|
|
2713
2713
|
toolUseIdArgumentBuffer.set(toolUseId1, updated);
|
|
2714
2714
|
if (!normalizedComputerCalls.has(toolUseId1)) {
|
|
2715
|
-
parsed1 =
|
|
2715
|
+
parsed1 = parseJson3(updated);
|
|
2716
2716
|
if (parsed1 !== void 0) {
|
|
2717
2717
|
normalized1 = normalizeComputerToolCallPayload(parsed1);
|
|
2718
2718
|
toolCallIndex2 = getOrCreateIndexForToolUseId(toolUseId1);
|
|
@@ -4058,6 +4058,1093 @@ var ollamaClientAdapter = function(param) {
|
|
|
4058
4058
|
}
|
|
4059
4059
|
};
|
|
4060
4060
|
};
|
|
4061
|
+
// src/adapters/client/openRouterClientAdapter/models/get.ts
|
|
4062
|
+
var get11 = function(param) {
|
|
4063
|
+
var openRouter = param.openRouter;
|
|
4064
|
+
return function(_url, _options) {
|
|
4065
|
+
return _async_to_generator(function() {
|
|
4066
|
+
var data, error;
|
|
4067
|
+
return _ts_generator(this, function(_state) {
|
|
4068
|
+
switch(_state.label){
|
|
4069
|
+
case 0:
|
|
4070
|
+
_state.trys.push([
|
|
4071
|
+
0,
|
|
4072
|
+
2,
|
|
4073
|
+
,
|
|
4074
|
+
3
|
|
4075
|
+
]);
|
|
4076
|
+
return [
|
|
4077
|
+
4,
|
|
4078
|
+
openRouter.models.list()
|
|
4079
|
+
];
|
|
4080
|
+
case 1:
|
|
4081
|
+
data = _state.sent();
|
|
4082
|
+
return [
|
|
4083
|
+
2,
|
|
4084
|
+
new Response(JSON.stringify(data), {
|
|
4085
|
+
status: 200,
|
|
4086
|
+
headers: {
|
|
4087
|
+
"Content-Type": "application/json"
|
|
4088
|
+
}
|
|
4089
|
+
})
|
|
4090
|
+
];
|
|
4091
|
+
case 2:
|
|
4092
|
+
error = _state.sent();
|
|
4093
|
+
return [
|
|
4094
|
+
2,
|
|
4095
|
+
new Response(JSON.stringify({
|
|
4096
|
+
error: error
|
|
4097
|
+
}), {
|
|
4098
|
+
status: 500,
|
|
4099
|
+
headers: {
|
|
4100
|
+
"Content-Type": "application/json"
|
|
4101
|
+
}
|
|
4102
|
+
})
|
|
4103
|
+
];
|
|
4104
|
+
case 3:
|
|
4105
|
+
return [
|
|
4106
|
+
2
|
|
4107
|
+
];
|
|
4108
|
+
}
|
|
4109
|
+
});
|
|
4110
|
+
})();
|
|
4111
|
+
};
|
|
4112
|
+
};
|
|
4113
|
+
// src/adapters/client/openRouterClientAdapter/models/index.ts
|
|
4114
|
+
var models13 = function(param) {
|
|
4115
|
+
var openRouter = param.openRouter;
|
|
4116
|
+
return {
|
|
4117
|
+
get: get11({
|
|
4118
|
+
openRouter: openRouter
|
|
4119
|
+
})
|
|
4120
|
+
};
|
|
4121
|
+
};
|
|
4122
|
+
// src/adapters/client/openRouterClientAdapter/completions/normalizeComputerCall.ts
|
|
4123
|
+
var MODEL_QUIRKS = {
|
|
4124
|
+
"z-ai/glm-4.6v": {
|
|
4125
|
+
normalizedCoords: true,
|
|
4126
|
+
cleanArtifacts: true
|
|
4127
|
+
},
|
|
4128
|
+
"qwen/": {
|
|
4129
|
+
fuzzyFallback: true
|
|
4130
|
+
},
|
|
4131
|
+
"google/": {
|
|
4132
|
+
normalizedCoords: true
|
|
4133
|
+
}
|
|
4134
|
+
};
|
|
4135
|
+
var getQuirks = function(model) {
|
|
4136
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4137
|
+
try {
|
|
4138
|
+
for(var _iterator = Object.entries(MODEL_QUIRKS)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4139
|
+
var _step_value = _sliced_to_array(_step.value, 2), prefix = _step_value[0], quirks = _step_value[1];
|
|
4140
|
+
if (model.startsWith(prefix)) return quirks;
|
|
4141
|
+
}
|
|
4142
|
+
} catch (err) {
|
|
4143
|
+
_didIteratorError = true;
|
|
4144
|
+
_iteratorError = err;
|
|
4145
|
+
} finally{
|
|
4146
|
+
try {
|
|
4147
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4148
|
+
_iterator.return();
|
|
4149
|
+
}
|
|
4150
|
+
} finally{
|
|
4151
|
+
if (_didIteratorError) {
|
|
4152
|
+
throw _iteratorError;
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
return {};
|
|
4157
|
+
};
|
|
4158
|
+
var cleanTextArtifacts = function(text) {
|
|
4159
|
+
return text.replace(/<\|begin_of_box\|>/g, "").replace(/<\|end_of_box\|>/g, "").replace(/<arg_key>[^<]*<\/arg_key>/g, "").replace(/<\/arg_value>/g, "").trim();
|
|
4160
|
+
};
|
|
4161
|
+
var KNOWN_ACTION_TYPES = [
|
|
4162
|
+
"double_click",
|
|
4163
|
+
"screenshot",
|
|
4164
|
+
"keypress",
|
|
4165
|
+
"scroll",
|
|
4166
|
+
"click",
|
|
4167
|
+
"move",
|
|
4168
|
+
"type",
|
|
4169
|
+
"drag",
|
|
4170
|
+
"wait"
|
|
4171
|
+
];
|
|
4172
|
+
var splitCoordDigits = function(numStr) {
|
|
4173
|
+
for(var i = 1; i < numStr.length; i++){
|
|
4174
|
+
var x = parseInt(numStr.slice(0, i));
|
|
4175
|
+
var y = parseInt(numStr.slice(i));
|
|
4176
|
+
if (x >= 0 && x <= 1e3 && y >= 0 && y <= 1e3) {
|
|
4177
|
+
return {
|
|
4178
|
+
x: x,
|
|
4179
|
+
y: y
|
|
4180
|
+
};
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
return null;
|
|
4184
|
+
};
|
|
4185
|
+
var cleanGlmAction = function(action) {
|
|
4186
|
+
var typeVal = action.type;
|
|
4187
|
+
if (typeof typeVal !== "string") return action;
|
|
4188
|
+
var argValueMatch = typeVal.match(/<arg_value>\s*(\{[\s\S]*\})\s*$/);
|
|
4189
|
+
if (argValueMatch) {
|
|
4190
|
+
var inner = parseJson2(argValueMatch[1]);
|
|
4191
|
+
if (inner && (typeof inner === "undefined" ? "undefined" : _type_of(inner)) === "object") {
|
|
4192
|
+
return inner;
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
var cleanedType = typeVal.replace(/<\/?[^>]+>/g, "").replace(/\n/g, "").trim();
|
|
4196
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4197
|
+
try {
|
|
4198
|
+
for(var _iterator = KNOWN_ACTION_TYPES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4199
|
+
var actionType = _step.value;
|
|
4200
|
+
if (cleanedType.startsWith(actionType) && cleanedType !== actionType) {
|
|
4201
|
+
var rest = cleanedType.slice(actionType.length);
|
|
4202
|
+
var nums = rest.match(/\d+/g);
|
|
4203
|
+
if (nums && nums.length >= 2) {
|
|
4204
|
+
return _object_spread_props(_object_spread({}, action), {
|
|
4205
|
+
type: actionType,
|
|
4206
|
+
x: parseInt(nums[0]),
|
|
4207
|
+
y: parseInt(nums[1])
|
|
4208
|
+
});
|
|
4209
|
+
}
|
|
4210
|
+
if (nums && nums.length === 1 && nums[0].length >= 2) {
|
|
4211
|
+
var coords = splitCoordDigits(nums[0]);
|
|
4212
|
+
if (coords) {
|
|
4213
|
+
return _object_spread(_object_spread_props(_object_spread({}, action), {
|
|
4214
|
+
type: actionType
|
|
4215
|
+
}), coords);
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
return _object_spread_props(_object_spread({}, action), {
|
|
4219
|
+
type: actionType
|
|
4220
|
+
});
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4223
|
+
} catch (err) {
|
|
4224
|
+
_didIteratorError = true;
|
|
4225
|
+
_iteratorError = err;
|
|
4226
|
+
} finally{
|
|
4227
|
+
try {
|
|
4228
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4229
|
+
_iterator.return();
|
|
4230
|
+
}
|
|
4231
|
+
} finally{
|
|
4232
|
+
if (_didIteratorError) {
|
|
4233
|
+
throw _iteratorError;
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
}
|
|
4237
|
+
if (cleanedType === typeVal) return action;
|
|
4238
|
+
return _object_spread_props(_object_spread({}, action), {
|
|
4239
|
+
type: cleanedType
|
|
4240
|
+
});
|
|
4241
|
+
};
|
|
4242
|
+
var cleanGlmFields = function(action) {
|
|
4243
|
+
var result = _object_spread({}, action);
|
|
4244
|
+
if (typeof result.x === "string") {
|
|
4245
|
+
var nums = result.x.match(/\d+/g);
|
|
4246
|
+
if (nums && nums.length >= 2) {
|
|
4247
|
+
result.x = parseInt(nums[0]);
|
|
4248
|
+
if (result.y === void 0 || typeof result.y === "string") {
|
|
4249
|
+
result.y = parseInt(nums[1]);
|
|
4250
|
+
}
|
|
4251
|
+
} else if (nums && nums.length === 1) {
|
|
4252
|
+
result.x = parseInt(nums[0]);
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
if (typeof result.y === "string") {
|
|
4256
|
+
var nums1 = result.y.match(/\d+/g);
|
|
4257
|
+
if (nums1 && nums1.length >= 1) {
|
|
4258
|
+
result.y = parseInt(nums1[0]);
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
for(var _i = 0, _iter = [
|
|
4262
|
+
"scroll_x",
|
|
4263
|
+
"scroll_y"
|
|
4264
|
+
]; _i < _iter.length; _i++){
|
|
4265
|
+
var key = _iter[_i];
|
|
4266
|
+
if (typeof result[key] === "string") {
|
|
4267
|
+
var nums2 = result[key].match(/\d+/g);
|
|
4268
|
+
if (nums2) result[key] = parseInt(nums2[0]);
|
|
4269
|
+
}
|
|
4270
|
+
}
|
|
4271
|
+
if (typeof result.type === "string") {
|
|
4272
|
+
result.type = result.type.replace(/<[^>]*>/g, "").replace(/^\{|\}$/g, "").replace(/\n/g, "").trim();
|
|
4273
|
+
}
|
|
4274
|
+
return result;
|
|
4275
|
+
};
|
|
4276
|
+
var applyArtifactCleanup = function(action) {
|
|
4277
|
+
return cleanGlmFields(cleanGlmAction(action));
|
|
4278
|
+
};
|
|
4279
|
+
var parseJson2 = function(text) {
|
|
4280
|
+
try {
|
|
4281
|
+
return JSON.parse(text);
|
|
4282
|
+
} catch (unused) {
|
|
4283
|
+
return void 0;
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4286
|
+
var extractJson = function(text) {
|
|
4287
|
+
var direct = parseJson2(text);
|
|
4288
|
+
if (direct) return direct;
|
|
4289
|
+
var codeBlockMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
4290
|
+
if (codeBlockMatch) {
|
|
4291
|
+
var parsed = parseJson2(codeBlockMatch[1].trim());
|
|
4292
|
+
if (parsed) return parsed;
|
|
4293
|
+
}
|
|
4294
|
+
var jsonMatch = text.match(/(\{[\s\S]*\})\s*$/);
|
|
4295
|
+
if (jsonMatch) {
|
|
4296
|
+
var parsed1 = parseJson2(jsonMatch[1].trim());
|
|
4297
|
+
if (parsed1) return parsed1;
|
|
4298
|
+
}
|
|
4299
|
+
return void 0;
|
|
4300
|
+
};
|
|
4301
|
+
var fuzzyExtractJson = function(text) {
|
|
4302
|
+
var clickMatch = text.match(/"action"\s*:\s*"click"\s*,\s*"x"\s*:\s*\[?\s*(\d+)\s*,\s*(\d+)/);
|
|
4303
|
+
if (clickMatch) {
|
|
4304
|
+
return {
|
|
4305
|
+
action: {
|
|
4306
|
+
type: "click",
|
|
4307
|
+
x: parseInt(clickMatch[1]),
|
|
4308
|
+
y: parseInt(clickMatch[2])
|
|
4309
|
+
}
|
|
4310
|
+
};
|
|
4311
|
+
}
|
|
4312
|
+
var actionTypeMatch = text.match(/"type"\s*:\s*"(\w+)"/);
|
|
4313
|
+
if (actionTypeMatch) {
|
|
4314
|
+
var result = {
|
|
4315
|
+
type: actionTypeMatch[1]
|
|
4316
|
+
};
|
|
4317
|
+
var xMatch = text.match(/"x"\s*:\s*\[?\s*(\d+)/);
|
|
4318
|
+
var yMatch = text.match(/"y"\s*:\s*(\d+)/);
|
|
4319
|
+
if (xMatch) result.x = parseInt(xMatch[1]);
|
|
4320
|
+
if (yMatch) {
|
|
4321
|
+
result.y = parseInt(yMatch[1]);
|
|
4322
|
+
} else if (xMatch) {
|
|
4323
|
+
var _xMatch_index;
|
|
4324
|
+
var afterX = text.slice(((_xMatch_index = xMatch.index) !== null && _xMatch_index !== void 0 ? _xMatch_index : 0) + xMatch[0].length);
|
|
4325
|
+
var nextNum = afterX.match(/\s*,?\s*(\d+)/);
|
|
4326
|
+
if (nextNum) result.y = parseInt(nextNum[1]);
|
|
4327
|
+
}
|
|
4328
|
+
var textMatch = text.match(/"text"\s*:\s*"([^"]*)"/);
|
|
4329
|
+
if (textMatch) result.text = textMatch[1];
|
|
4330
|
+
return {
|
|
4331
|
+
action: result
|
|
4332
|
+
};
|
|
4333
|
+
}
|
|
4334
|
+
return void 0;
|
|
4335
|
+
};
|
|
4336
|
+
var denormalize = function(value, dimension) {
|
|
4337
|
+
return Math.round(value / 1e3 * dimension);
|
|
4338
|
+
};
|
|
4339
|
+
var denormalizeAction = function(action, displayWidth, displayHeight) {
|
|
4340
|
+
var result = _object_spread({}, action);
|
|
4341
|
+
if (typeof result.x === "number") {
|
|
4342
|
+
result.x = denormalize(result.x, displayWidth);
|
|
4343
|
+
}
|
|
4344
|
+
if (typeof result.y === "number") {
|
|
4345
|
+
result.y = denormalize(result.y, displayHeight);
|
|
4346
|
+
}
|
|
4347
|
+
if (Array.isArray(result.path)) {
|
|
4348
|
+
result.path = result.path.map(function(point) {
|
|
4349
|
+
if (point && (typeof point === "undefined" ? "undefined" : _type_of(point)) === "object") {
|
|
4350
|
+
return _object_spread({}, point, typeof point.x === "number" ? {
|
|
4351
|
+
x: denormalize(point.x, displayWidth)
|
|
4352
|
+
} : {}, typeof point.y === "number" ? {
|
|
4353
|
+
y: denormalize(point.y, displayHeight)
|
|
4354
|
+
} : {});
|
|
4355
|
+
}
|
|
4356
|
+
return point;
|
|
4357
|
+
});
|
|
4358
|
+
}
|
|
4359
|
+
return result;
|
|
4360
|
+
};
|
|
4361
|
+
var COORD_FIELDS = [
|
|
4362
|
+
"x",
|
|
4363
|
+
"y",
|
|
4364
|
+
"text",
|
|
4365
|
+
"keys",
|
|
4366
|
+
"button",
|
|
4367
|
+
"direction",
|
|
4368
|
+
"scroll_x",
|
|
4369
|
+
"scroll_y",
|
|
4370
|
+
"path"
|
|
4371
|
+
];
|
|
4372
|
+
var normalizeStructure = function(parsed, shouldCleanArtifacts) {
|
|
4373
|
+
var clean = shouldCleanArtifacts ? function(action) {
|
|
4374
|
+
return applyArtifactCleanup(action);
|
|
4375
|
+
} : function(action) {
|
|
4376
|
+
return action;
|
|
4377
|
+
};
|
|
4378
|
+
if (parsed.action && _type_of(parsed.action) === "object") {
|
|
4379
|
+
return _object_spread_props(_object_spread({}, parsed), {
|
|
4380
|
+
action: clean(parsed.action)
|
|
4381
|
+
});
|
|
4382
|
+
}
|
|
4383
|
+
if (typeof parsed.action === "string") {
|
|
4384
|
+
var actionObj = {
|
|
4385
|
+
type: parsed.action
|
|
4386
|
+
};
|
|
4387
|
+
var rest = {};
|
|
4388
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4389
|
+
try {
|
|
4390
|
+
for(var _iterator = Object.entries(parsed)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4391
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
4392
|
+
if (key === "action") continue;
|
|
4393
|
+
if (COORD_FIELDS.includes(key)) {
|
|
4394
|
+
actionObj[key] = value;
|
|
4395
|
+
} else {
|
|
4396
|
+
rest[key] = value;
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
} catch (err) {
|
|
4400
|
+
_didIteratorError = true;
|
|
4401
|
+
_iteratorError = err;
|
|
4402
|
+
} finally{
|
|
4403
|
+
try {
|
|
4404
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4405
|
+
_iterator.return();
|
|
4406
|
+
}
|
|
4407
|
+
} finally{
|
|
4408
|
+
if (_didIteratorError) {
|
|
4409
|
+
throw _iteratorError;
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
return _object_spread_props(_object_spread({}, rest), {
|
|
4414
|
+
action: clean(actionObj)
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
if (typeof parsed.type === "string") {
|
|
4418
|
+
var actionObj1 = {};
|
|
4419
|
+
var rest1 = {};
|
|
4420
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
4421
|
+
try {
|
|
4422
|
+
for(var _iterator1 = Object.entries(parsed)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
4423
|
+
var _step_value1 = _sliced_to_array(_step1.value, 2), key1 = _step_value1[0], value1 = _step_value1[1];
|
|
4424
|
+
if (key1 === "type" || COORD_FIELDS.includes(key1)) {
|
|
4425
|
+
actionObj1[key1] = value1;
|
|
4426
|
+
} else {
|
|
4427
|
+
rest1[key1] = value1;
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
} catch (err) {
|
|
4431
|
+
_didIteratorError1 = true;
|
|
4432
|
+
_iteratorError1 = err;
|
|
4433
|
+
} finally{
|
|
4434
|
+
try {
|
|
4435
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
4436
|
+
_iterator1.return();
|
|
4437
|
+
}
|
|
4438
|
+
} finally{
|
|
4439
|
+
if (_didIteratorError1) {
|
|
4440
|
+
throw _iteratorError1;
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
return _object_spread_props(_object_spread({}, rest1), {
|
|
4445
|
+
action: clean(actionObj1)
|
|
4446
|
+
});
|
|
4447
|
+
}
|
|
4448
|
+
return parsed;
|
|
4449
|
+
};
|
|
4450
|
+
var denormalizeComputerCallArguments = function(param) {
|
|
4451
|
+
var argumentsText = param.argumentsText, displayWidth = param.displayWidth, displayHeight = param.displayHeight, model = param.model;
|
|
4452
|
+
if ((typeof argumentsText === "undefined" ? "undefined" : _type_of(argumentsText)) === "object" && argumentsText !== null) {
|
|
4453
|
+
argumentsText = JSON.stringify(argumentsText);
|
|
4454
|
+
}
|
|
4455
|
+
var quirks = getQuirks(model);
|
|
4456
|
+
var text = argumentsText;
|
|
4457
|
+
if (quirks.cleanArtifacts) {
|
|
4458
|
+
text = cleanTextArtifacts(text);
|
|
4459
|
+
}
|
|
4460
|
+
var parsed = extractJson(text);
|
|
4461
|
+
if (!parsed && (quirks.cleanArtifacts || quirks.fuzzyFallback)) {
|
|
4462
|
+
parsed = fuzzyExtractJson(text);
|
|
4463
|
+
}
|
|
4464
|
+
if (!parsed || (typeof parsed === "undefined" ? "undefined" : _type_of(parsed)) !== "object") {
|
|
4465
|
+
return argumentsText;
|
|
4466
|
+
}
|
|
4467
|
+
var normalized = normalizeStructure(parsed, !!quirks.cleanArtifacts);
|
|
4468
|
+
if (quirks.normalizedCoords && normalized.action && _type_of(normalized.action) === "object") {
|
|
4469
|
+
return JSON.stringify(_object_spread_props(_object_spread({}, normalized), {
|
|
4470
|
+
action: denormalizeAction(normalized.action, displayWidth, displayHeight)
|
|
4471
|
+
}));
|
|
4472
|
+
}
|
|
4473
|
+
return JSON.stringify(normalized);
|
|
4474
|
+
};
|
|
4475
|
+
// src/adapters/client/openRouterClientAdapter/completions/computerUseTool.ts
|
|
4476
|
+
var buildComputerCallFunction = function(model, displayWidth, displayHeight) {
|
|
4477
|
+
var quirks = getQuirks(model);
|
|
4478
|
+
var coordDesc = quirks.normalizedCoords ? "Coordinates use 0-1000 normalized scale (0,0=top-left, 1000,1000=bottom-right)." : "Coordinates are in pixels (screen is ".concat(displayWidth, "x").concat(displayHeight, ").");
|
|
4479
|
+
var xDesc = quirks.normalizedCoords ? "X coordinate (0-1000 normalized)" : "X coordinate in pixels (0-".concat(displayWidth, ")");
|
|
4480
|
+
var yDesc = quirks.normalizedCoords ? "Y coordinate (0-1000 normalized)" : "Y coordinate in pixels (0-".concat(displayHeight, ")");
|
|
4481
|
+
return {
|
|
4482
|
+
name: "computer_call",
|
|
4483
|
+
description: "Perform a computer action. ".concat(coordDesc),
|
|
4484
|
+
parameters: {
|
|
4485
|
+
type: "object",
|
|
4486
|
+
properties: {
|
|
4487
|
+
action: {
|
|
4488
|
+
type: "object",
|
|
4489
|
+
description: "The action to perform",
|
|
4490
|
+
properties: {
|
|
4491
|
+
type: {
|
|
4492
|
+
type: "string",
|
|
4493
|
+
enum: [
|
|
4494
|
+
"screenshot",
|
|
4495
|
+
"click",
|
|
4496
|
+
"double_click",
|
|
4497
|
+
"type",
|
|
4498
|
+
"keypress",
|
|
4499
|
+
"scroll",
|
|
4500
|
+
"move",
|
|
4501
|
+
"drag",
|
|
4502
|
+
"wait"
|
|
4503
|
+
]
|
|
4504
|
+
},
|
|
4505
|
+
x: {
|
|
4506
|
+
type: "number",
|
|
4507
|
+
description: xDesc
|
|
4508
|
+
},
|
|
4509
|
+
y: {
|
|
4510
|
+
type: "number",
|
|
4511
|
+
description: yDesc
|
|
4512
|
+
},
|
|
4513
|
+
text: {
|
|
4514
|
+
type: "string",
|
|
4515
|
+
description: "Text to type"
|
|
4516
|
+
},
|
|
4517
|
+
keys: {
|
|
4518
|
+
type: "array",
|
|
4519
|
+
items: {
|
|
4520
|
+
type: "string"
|
|
4521
|
+
},
|
|
4522
|
+
description: "Keys to press"
|
|
4523
|
+
},
|
|
4524
|
+
button: {
|
|
4525
|
+
type: "string",
|
|
4526
|
+
enum: [
|
|
4527
|
+
"left",
|
|
4528
|
+
"right",
|
|
4529
|
+
"wheel"
|
|
4530
|
+
]
|
|
4531
|
+
},
|
|
4532
|
+
direction: {
|
|
4533
|
+
type: "string",
|
|
4534
|
+
enum: [
|
|
4535
|
+
"up",
|
|
4536
|
+
"down",
|
|
4537
|
+
"left",
|
|
4538
|
+
"right"
|
|
4539
|
+
]
|
|
4540
|
+
},
|
|
4541
|
+
scroll_x: {
|
|
4542
|
+
type: "number"
|
|
4543
|
+
},
|
|
4544
|
+
scroll_y: {
|
|
4545
|
+
type: "number"
|
|
4546
|
+
},
|
|
4547
|
+
path: {
|
|
4548
|
+
type: "array",
|
|
4549
|
+
items: {
|
|
4550
|
+
type: "object",
|
|
4551
|
+
properties: {
|
|
4552
|
+
x: {
|
|
4553
|
+
type: "number"
|
|
4554
|
+
},
|
|
4555
|
+
y: {
|
|
4556
|
+
type: "number"
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4559
|
+
},
|
|
4560
|
+
description: "Path for drag action"
|
|
4561
|
+
}
|
|
4562
|
+
},
|
|
4563
|
+
required: [
|
|
4564
|
+
"type"
|
|
4565
|
+
]
|
|
4566
|
+
},
|
|
4567
|
+
pending_safety_checks: {
|
|
4568
|
+
type: "array",
|
|
4569
|
+
items: {
|
|
4570
|
+
type: "object"
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4573
|
+
},
|
|
4574
|
+
required: [
|
|
4575
|
+
"action"
|
|
4576
|
+
]
|
|
4577
|
+
}
|
|
4578
|
+
};
|
|
4579
|
+
};
|
|
4580
|
+
var transformTools = function(tools, model) {
|
|
4581
|
+
if (!tools || tools.length === 0) {
|
|
4582
|
+
return {
|
|
4583
|
+
tools: tools !== null && tools !== void 0 ? tools : [],
|
|
4584
|
+
computerUseConfig: null
|
|
4585
|
+
};
|
|
4586
|
+
}
|
|
4587
|
+
var computerUseConfig = null;
|
|
4588
|
+
var transformed = tools.map(function(tool) {
|
|
4589
|
+
if (tool.type === "computer_use_preview") {
|
|
4590
|
+
var _tool_computer_use_preview, _ref, _config_display_width, _ref1, _config_display_height;
|
|
4591
|
+
var config = (_tool_computer_use_preview = tool.computer_use_preview) !== null && _tool_computer_use_preview !== void 0 ? _tool_computer_use_preview : tool;
|
|
4592
|
+
computerUseConfig = {
|
|
4593
|
+
displayWidth: (_ref = (_config_display_width = config.display_width) !== null && _config_display_width !== void 0 ? _config_display_width : config.display_width_px) !== null && _ref !== void 0 ? _ref : 1280,
|
|
4594
|
+
displayHeight: (_ref1 = (_config_display_height = config.display_height) !== null && _config_display_height !== void 0 ? _config_display_height : config.display_height_px) !== null && _ref1 !== void 0 ? _ref1 : 720
|
|
4595
|
+
};
|
|
4596
|
+
return {
|
|
4597
|
+
type: "function",
|
|
4598
|
+
function: buildComputerCallFunction(model, computerUseConfig.displayWidth, computerUseConfig.displayHeight)
|
|
4599
|
+
};
|
|
4600
|
+
}
|
|
4601
|
+
return tool;
|
|
4602
|
+
});
|
|
4603
|
+
return {
|
|
4604
|
+
tools: transformed,
|
|
4605
|
+
computerUseConfig: computerUseConfig
|
|
4606
|
+
};
|
|
4607
|
+
};
|
|
4608
|
+
// src/adapters/client/openRouterClientAdapter/completions/post.ts
|
|
4609
|
+
var ARTIFACT_TAGS = /<\|begin_of_box\|>|<\|end_of_box\|>/g;
|
|
4610
|
+
var sanitizeContent = function(content) {
|
|
4611
|
+
if (!content) return content;
|
|
4612
|
+
return content.replace(ARTIFACT_TAGS, "").trim();
|
|
4613
|
+
};
|
|
4614
|
+
var post10 = function(param) {
|
|
4615
|
+
var openRouter = param.openRouter;
|
|
4616
|
+
return function(_url, options) {
|
|
4617
|
+
return _async_to_generator(function() {
|
|
4618
|
+
var body, model, _transformTools, transformedTools, computerUseConfig, resultOptions, response, shouldCleanArtifacts, stream2, displayWidth, displayHeight, stream, data, _data_choices, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, choice, _ref, _choice_message, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, tc, fn, _data_choices1, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, choice1, _choice_message1, error;
|
|
4619
|
+
return _ts_generator(this, function(_state) {
|
|
4620
|
+
switch(_state.label){
|
|
4621
|
+
case 0:
|
|
4622
|
+
body = JSON.parse(options.body);
|
|
4623
|
+
model = body.model;
|
|
4624
|
+
_transformTools = transformTools(body.tools, model), transformedTools = _transformTools.tools, computerUseConfig = _transformTools.computerUseConfig;
|
|
4625
|
+
resultOptions = _object_spread({}, body, transformedTools.length > 0 ? {
|
|
4626
|
+
tools: transformedTools
|
|
4627
|
+
} : {});
|
|
4628
|
+
if (!body.stream) return [
|
|
4629
|
+
3,
|
|
4630
|
+
2
|
|
4631
|
+
];
|
|
4632
|
+
return [
|
|
4633
|
+
4,
|
|
4634
|
+
openRouter.chat.completions.create(resultOptions)
|
|
4635
|
+
];
|
|
4636
|
+
case 1:
|
|
4637
|
+
response = _state.sent();
|
|
4638
|
+
shouldCleanArtifacts = getQuirks(model).cleanArtifacts;
|
|
4639
|
+
if (!computerUseConfig) {
|
|
4640
|
+
stream2 = new ReadableStream({
|
|
4641
|
+
start: function start(controller) {
|
|
4642
|
+
return _async_to_generator(function() {
|
|
4643
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices_, _chunk_choices, delta, err;
|
|
4644
|
+
return _ts_generator(this, function(_state) {
|
|
4645
|
+
switch(_state.label){
|
|
4646
|
+
case 0:
|
|
4647
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
4648
|
+
_state.label = 1;
|
|
4649
|
+
case 1:
|
|
4650
|
+
_state.trys.push([
|
|
4651
|
+
1,
|
|
4652
|
+
6,
|
|
4653
|
+
7,
|
|
4654
|
+
12
|
|
4655
|
+
]);
|
|
4656
|
+
_iterator = _async_iterator(response);
|
|
4657
|
+
_state.label = 2;
|
|
4658
|
+
case 2:
|
|
4659
|
+
return [
|
|
4660
|
+
4,
|
|
4661
|
+
_iterator.next()
|
|
4662
|
+
];
|
|
4663
|
+
case 3:
|
|
4664
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
4665
|
+
3,
|
|
4666
|
+
5
|
|
4667
|
+
];
|
|
4668
|
+
_value = _step.value;
|
|
4669
|
+
chunk = _value;
|
|
4670
|
+
if (shouldCleanArtifacts) {
|
|
4671
|
+
;
|
|
4672
|
+
delta = (_chunk_choices = chunk.choices) === null || _chunk_choices === void 0 ? void 0 : (_chunk_choices_ = _chunk_choices[0]) === null || _chunk_choices_ === void 0 ? void 0 : _chunk_choices_.delta;
|
|
4673
|
+
if (delta === null || delta === void 0 ? void 0 : delta.content) {
|
|
4674
|
+
delta.content = sanitizeContent(delta.content);
|
|
4675
|
+
}
|
|
4676
|
+
}
|
|
4677
|
+
controller.enqueue("data: ".concat(JSON.stringify(chunk), "\n\n"));
|
|
4678
|
+
_state.label = 4;
|
|
4679
|
+
case 4:
|
|
4680
|
+
_iteratorAbruptCompletion = false;
|
|
4681
|
+
return [
|
|
4682
|
+
3,
|
|
4683
|
+
2
|
|
4684
|
+
];
|
|
4685
|
+
case 5:
|
|
4686
|
+
return [
|
|
4687
|
+
3,
|
|
4688
|
+
12
|
|
4689
|
+
];
|
|
4690
|
+
case 6:
|
|
4691
|
+
err = _state.sent();
|
|
4692
|
+
_didIteratorError = true;
|
|
4693
|
+
_iteratorError = err;
|
|
4694
|
+
return [
|
|
4695
|
+
3,
|
|
4696
|
+
12
|
|
4697
|
+
];
|
|
4698
|
+
case 7:
|
|
4699
|
+
_state.trys.push([
|
|
4700
|
+
7,
|
|
4701
|
+
,
|
|
4702
|
+
10,
|
|
4703
|
+
11
|
|
4704
|
+
]);
|
|
4705
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
4706
|
+
3,
|
|
4707
|
+
9
|
|
4708
|
+
];
|
|
4709
|
+
return [
|
|
4710
|
+
4,
|
|
4711
|
+
_iterator.return()
|
|
4712
|
+
];
|
|
4713
|
+
case 8:
|
|
4714
|
+
_state.sent();
|
|
4715
|
+
_state.label = 9;
|
|
4716
|
+
case 9:
|
|
4717
|
+
return [
|
|
4718
|
+
3,
|
|
4719
|
+
11
|
|
4720
|
+
];
|
|
4721
|
+
case 10:
|
|
4722
|
+
if (_didIteratorError) {
|
|
4723
|
+
throw _iteratorError;
|
|
4724
|
+
}
|
|
4725
|
+
return [
|
|
4726
|
+
7
|
|
4727
|
+
];
|
|
4728
|
+
case 11:
|
|
4729
|
+
return [
|
|
4730
|
+
7
|
|
4731
|
+
];
|
|
4732
|
+
case 12:
|
|
4733
|
+
controller.close();
|
|
4734
|
+
return [
|
|
4735
|
+
2
|
|
4736
|
+
];
|
|
4737
|
+
}
|
|
4738
|
+
});
|
|
4739
|
+
})();
|
|
4740
|
+
}
|
|
4741
|
+
});
|
|
4742
|
+
return [
|
|
4743
|
+
2,
|
|
4744
|
+
new Response(stream2, {
|
|
4745
|
+
headers: {
|
|
4746
|
+
"Content-Type": "text/event-stream"
|
|
4747
|
+
}
|
|
4748
|
+
})
|
|
4749
|
+
];
|
|
4750
|
+
}
|
|
4751
|
+
displayWidth = computerUseConfig.displayWidth, displayHeight = computerUseConfig.displayHeight;
|
|
4752
|
+
stream = new ReadableStream({
|
|
4753
|
+
start: function start(controller) {
|
|
4754
|
+
return _async_to_generator(function() {
|
|
4755
|
+
var computerCallIndices, argumentBuffers, emittedIndices, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices, _choice_delta, choices, choice, passThrough, _iteratorNormalCompletion, _didIteratorError1, _iteratorError1, _iterator1, _step1, tc, _tc_function, _ref, _tc_function1, initialArgs, denormalized, _argumentBuffers_get, _ref1, _tc_function2, buf, denormalized1, modifiedChunk, err1, _iteratorNormalCompletion1, _didIteratorError2, _iteratorError2, _iterator2, _step2, _step_value, index, buf1, denormalized2, flushChunk;
|
|
4756
|
+
return _ts_generator(this, function(_state) {
|
|
4757
|
+
switch(_state.label){
|
|
4758
|
+
case 0:
|
|
4759
|
+
computerCallIndices = /* @__PURE__ */ new Set();
|
|
4760
|
+
argumentBuffers = /* @__PURE__ */ new Map();
|
|
4761
|
+
emittedIndices = /* @__PURE__ */ new Set();
|
|
4762
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
4763
|
+
_state.label = 1;
|
|
4764
|
+
case 1:
|
|
4765
|
+
_state.trys.push([
|
|
4766
|
+
1,
|
|
4767
|
+
6,
|
|
4768
|
+
7,
|
|
4769
|
+
12
|
|
4770
|
+
]);
|
|
4771
|
+
_iterator = _async_iterator(response);
|
|
4772
|
+
_state.label = 2;
|
|
4773
|
+
case 2:
|
|
4774
|
+
return [
|
|
4775
|
+
4,
|
|
4776
|
+
_iterator.next()
|
|
4777
|
+
];
|
|
4778
|
+
case 3:
|
|
4779
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
4780
|
+
3,
|
|
4781
|
+
5
|
|
4782
|
+
];
|
|
4783
|
+
_value = _step.value;
|
|
4784
|
+
chunk = _value;
|
|
4785
|
+
choices = (_chunk_choices = chunk.choices) !== null && _chunk_choices !== void 0 ? _chunk_choices : [];
|
|
4786
|
+
choice = choices[0];
|
|
4787
|
+
if (!(choice === null || choice === void 0 ? void 0 : (_choice_delta = choice.delta) === null || _choice_delta === void 0 ? void 0 : _choice_delta.tool_calls)) {
|
|
4788
|
+
controller.enqueue("data: ".concat(JSON.stringify(chunk), "\n\n"));
|
|
4789
|
+
return [
|
|
4790
|
+
3,
|
|
4791
|
+
4
|
|
4792
|
+
];
|
|
4793
|
+
}
|
|
4794
|
+
passThrough = [];
|
|
4795
|
+
_iteratorNormalCompletion = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
4796
|
+
try {
|
|
4797
|
+
for(_iterator1 = choice.delta.tool_calls[Symbol.iterator](); !(_iteratorNormalCompletion = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion = true){
|
|
4798
|
+
tc = _step1.value;
|
|
4799
|
+
;
|
|
4800
|
+
if (((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) === "computer_call") {
|
|
4801
|
+
;
|
|
4802
|
+
;
|
|
4803
|
+
computerCallIndices.add(tc.index);
|
|
4804
|
+
initialArgs = (_ref = (_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) !== null && _ref !== void 0 ? _ref : "";
|
|
4805
|
+
argumentBuffers.set(tc.index, initialArgs);
|
|
4806
|
+
passThrough.push(_object_spread_props(_object_spread({}, tc), {
|
|
4807
|
+
function: _object_spread_props(_object_spread({}, tc.function), {
|
|
4808
|
+
arguments: ""
|
|
4809
|
+
})
|
|
4810
|
+
}));
|
|
4811
|
+
if (initialArgs) {
|
|
4812
|
+
try {
|
|
4813
|
+
JSON.parse(initialArgs);
|
|
4814
|
+
denormalized = denormalizeComputerCallArguments({
|
|
4815
|
+
argumentsText: initialArgs,
|
|
4816
|
+
displayWidth: displayWidth,
|
|
4817
|
+
displayHeight: displayHeight,
|
|
4818
|
+
model: model
|
|
4819
|
+
});
|
|
4820
|
+
passThrough.push({
|
|
4821
|
+
index: tc.index,
|
|
4822
|
+
function: {
|
|
4823
|
+
arguments: denormalized
|
|
4824
|
+
}
|
|
4825
|
+
});
|
|
4826
|
+
emittedIndices.add(tc.index);
|
|
4827
|
+
} catch (unused) {}
|
|
4828
|
+
}
|
|
4829
|
+
continue;
|
|
4830
|
+
}
|
|
4831
|
+
if (computerCallIndices.has(tc.index)) {
|
|
4832
|
+
;
|
|
4833
|
+
;
|
|
4834
|
+
buf = ((_argumentBuffers_get = argumentBuffers.get(tc.index)) !== null && _argumentBuffers_get !== void 0 ? _argumentBuffers_get : "") + ((_ref1 = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.arguments) !== null && _ref1 !== void 0 ? _ref1 : "");
|
|
4835
|
+
argumentBuffers.set(tc.index, buf);
|
|
4836
|
+
if (!emittedIndices.has(tc.index)) {
|
|
4837
|
+
try {
|
|
4838
|
+
JSON.parse(buf);
|
|
4839
|
+
denormalized1 = denormalizeComputerCallArguments({
|
|
4840
|
+
argumentsText: buf,
|
|
4841
|
+
displayWidth: displayWidth,
|
|
4842
|
+
displayHeight: displayHeight,
|
|
4843
|
+
model: model
|
|
4844
|
+
});
|
|
4845
|
+
passThrough.push({
|
|
4846
|
+
index: tc.index,
|
|
4847
|
+
function: {
|
|
4848
|
+
arguments: denormalized1
|
|
4849
|
+
}
|
|
4850
|
+
});
|
|
4851
|
+
emittedIndices.add(tc.index);
|
|
4852
|
+
} catch (unused) {}
|
|
4853
|
+
}
|
|
4854
|
+
continue;
|
|
4855
|
+
}
|
|
4856
|
+
passThrough.push(tc);
|
|
4857
|
+
}
|
|
4858
|
+
} catch (err) {
|
|
4859
|
+
_didIteratorError1 = true;
|
|
4860
|
+
_iteratorError1 = err;
|
|
4861
|
+
} finally{
|
|
4862
|
+
try {
|
|
4863
|
+
if (!_iteratorNormalCompletion && _iterator1.return != null) {
|
|
4864
|
+
_iterator1.return();
|
|
4865
|
+
}
|
|
4866
|
+
} finally{
|
|
4867
|
+
if (_didIteratorError1) {
|
|
4868
|
+
throw _iteratorError1;
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
}
|
|
4872
|
+
if (passThrough.length > 0) {
|
|
4873
|
+
modifiedChunk = _object_spread_props(_object_spread({}, chunk), {
|
|
4874
|
+
choices: [
|
|
4875
|
+
_object_spread_props(_object_spread({}, choice), {
|
|
4876
|
+
delta: _object_spread_props(_object_spread({}, choice.delta), {
|
|
4877
|
+
tool_calls: passThrough
|
|
4878
|
+
})
|
|
4879
|
+
})
|
|
4880
|
+
]
|
|
4881
|
+
});
|
|
4882
|
+
controller.enqueue("data: ".concat(JSON.stringify(modifiedChunk), "\n\n"));
|
|
4883
|
+
}
|
|
4884
|
+
_state.label = 4;
|
|
4885
|
+
case 4:
|
|
4886
|
+
_iteratorAbruptCompletion = false;
|
|
4887
|
+
return [
|
|
4888
|
+
3,
|
|
4889
|
+
2
|
|
4890
|
+
];
|
|
4891
|
+
case 5:
|
|
4892
|
+
return [
|
|
4893
|
+
3,
|
|
4894
|
+
12
|
|
4895
|
+
];
|
|
4896
|
+
case 6:
|
|
4897
|
+
err1 = _state.sent();
|
|
4898
|
+
_didIteratorError = true;
|
|
4899
|
+
_iteratorError = err1;
|
|
4900
|
+
return [
|
|
4901
|
+
3,
|
|
4902
|
+
12
|
|
4903
|
+
];
|
|
4904
|
+
case 7:
|
|
4905
|
+
_state.trys.push([
|
|
4906
|
+
7,
|
|
4907
|
+
,
|
|
4908
|
+
10,
|
|
4909
|
+
11
|
|
4910
|
+
]);
|
|
4911
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
4912
|
+
3,
|
|
4913
|
+
9
|
|
4914
|
+
];
|
|
4915
|
+
return [
|
|
4916
|
+
4,
|
|
4917
|
+
_iterator.return()
|
|
4918
|
+
];
|
|
4919
|
+
case 8:
|
|
4920
|
+
_state.sent();
|
|
4921
|
+
_state.label = 9;
|
|
4922
|
+
case 9:
|
|
4923
|
+
return [
|
|
4924
|
+
3,
|
|
4925
|
+
11
|
|
4926
|
+
];
|
|
4927
|
+
case 10:
|
|
4928
|
+
if (_didIteratorError) {
|
|
4929
|
+
throw _iteratorError;
|
|
4930
|
+
}
|
|
4931
|
+
return [
|
|
4932
|
+
7
|
|
4933
|
+
];
|
|
4934
|
+
case 11:
|
|
4935
|
+
return [
|
|
4936
|
+
7
|
|
4937
|
+
];
|
|
4938
|
+
case 12:
|
|
4939
|
+
_iteratorNormalCompletion1 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
4940
|
+
try {
|
|
4941
|
+
for(_iterator2 = Array.from(argumentBuffers)[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion1 = true){
|
|
4942
|
+
_step_value = _sliced_to_array(_step2.value, 2), index = _step_value[0], buf1 = _step_value[1];
|
|
4943
|
+
if (!emittedIndices.has(index) && buf1) {
|
|
4944
|
+
denormalized2 = denormalizeComputerCallArguments({
|
|
4945
|
+
argumentsText: buf1,
|
|
4946
|
+
displayWidth: displayWidth,
|
|
4947
|
+
displayHeight: displayHeight,
|
|
4948
|
+
model: model
|
|
4949
|
+
});
|
|
4950
|
+
flushChunk = {
|
|
4951
|
+
object: "chat.completion.chunk",
|
|
4952
|
+
choices: [
|
|
4953
|
+
{
|
|
4954
|
+
index: 0,
|
|
4955
|
+
delta: {
|
|
4956
|
+
tool_calls: [
|
|
4957
|
+
{
|
|
4958
|
+
index: index,
|
|
4959
|
+
function: {
|
|
4960
|
+
arguments: denormalized2
|
|
4961
|
+
}
|
|
4962
|
+
}
|
|
4963
|
+
]
|
|
4964
|
+
}
|
|
4965
|
+
}
|
|
4966
|
+
]
|
|
4967
|
+
};
|
|
4968
|
+
controller.enqueue("data: ".concat(JSON.stringify(flushChunk), "\n\n"));
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
} catch (err) {
|
|
4972
|
+
_didIteratorError2 = true;
|
|
4973
|
+
_iteratorError2 = err;
|
|
4974
|
+
} finally{
|
|
4975
|
+
try {
|
|
4976
|
+
if (!_iteratorNormalCompletion1 && _iterator2.return != null) {
|
|
4977
|
+
_iterator2.return();
|
|
4978
|
+
}
|
|
4979
|
+
} finally{
|
|
4980
|
+
if (_didIteratorError2) {
|
|
4981
|
+
throw _iteratorError2;
|
|
4982
|
+
}
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4985
|
+
controller.close();
|
|
4986
|
+
return [
|
|
4987
|
+
2
|
|
4988
|
+
];
|
|
4989
|
+
}
|
|
4990
|
+
});
|
|
4991
|
+
})();
|
|
4992
|
+
}
|
|
4993
|
+
});
|
|
4994
|
+
return [
|
|
4995
|
+
2,
|
|
4996
|
+
new Response(stream, {
|
|
4997
|
+
headers: {
|
|
4998
|
+
"Content-Type": "text/event-stream"
|
|
4999
|
+
}
|
|
5000
|
+
})
|
|
5001
|
+
];
|
|
5002
|
+
case 2:
|
|
5003
|
+
_state.trys.push([
|
|
5004
|
+
2,
|
|
5005
|
+
4,
|
|
5006
|
+
,
|
|
5007
|
+
5
|
|
5008
|
+
]);
|
|
5009
|
+
return [
|
|
5010
|
+
4,
|
|
5011
|
+
openRouter.chat.completions.create(resultOptions)
|
|
5012
|
+
];
|
|
5013
|
+
case 3:
|
|
5014
|
+
data = _state.sent();
|
|
5015
|
+
if (computerUseConfig) {
|
|
5016
|
+
;
|
|
5017
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5018
|
+
try {
|
|
5019
|
+
for(_iterator = ((_data_choices = data.choices) !== null && _data_choices !== void 0 ? _data_choices : [])[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5020
|
+
choice = _step.value;
|
|
5021
|
+
;
|
|
5022
|
+
;
|
|
5023
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
5024
|
+
try {
|
|
5025
|
+
for(_iterator1 = ((_ref = (_choice_message = choice.message) === null || _choice_message === void 0 ? void 0 : _choice_message.tool_calls) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
5026
|
+
tc = _step1.value;
|
|
5027
|
+
fn = tc.function;
|
|
5028
|
+
if ((fn === null || fn === void 0 ? void 0 : fn.name) === "computer_call") {
|
|
5029
|
+
fn.arguments = denormalizeComputerCallArguments({
|
|
5030
|
+
argumentsText: fn.arguments,
|
|
5031
|
+
displayWidth: computerUseConfig.displayWidth,
|
|
5032
|
+
displayHeight: computerUseConfig.displayHeight,
|
|
5033
|
+
model: model
|
|
5034
|
+
});
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
} catch (err) {
|
|
5038
|
+
_didIteratorError1 = true;
|
|
5039
|
+
_iteratorError1 = err;
|
|
5040
|
+
} finally{
|
|
5041
|
+
try {
|
|
5042
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
5043
|
+
_iterator1.return();
|
|
5044
|
+
}
|
|
5045
|
+
} finally{
|
|
5046
|
+
if (_didIteratorError1) {
|
|
5047
|
+
throw _iteratorError1;
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
}
|
|
5051
|
+
}
|
|
5052
|
+
} catch (err) {
|
|
5053
|
+
_didIteratorError = true;
|
|
5054
|
+
_iteratorError = err;
|
|
5055
|
+
} finally{
|
|
5056
|
+
try {
|
|
5057
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5058
|
+
_iterator.return();
|
|
5059
|
+
}
|
|
5060
|
+
} finally{
|
|
5061
|
+
if (_didIteratorError) {
|
|
5062
|
+
throw _iteratorError;
|
|
5063
|
+
}
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
if (getQuirks(model).cleanArtifacts) {
|
|
5068
|
+
;
|
|
5069
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
5070
|
+
try {
|
|
5071
|
+
for(_iterator2 = ((_data_choices1 = data.choices) !== null && _data_choices1 !== void 0 ? _data_choices1 : [])[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
5072
|
+
choice1 = _step2.value;
|
|
5073
|
+
;
|
|
5074
|
+
if ((_choice_message1 = choice1.message) === null || _choice_message1 === void 0 ? void 0 : _choice_message1.content) {
|
|
5075
|
+
choice1.message.content = sanitizeContent(choice1.message.content);
|
|
5076
|
+
}
|
|
5077
|
+
}
|
|
5078
|
+
} catch (err) {
|
|
5079
|
+
_didIteratorError2 = true;
|
|
5080
|
+
_iteratorError2 = err;
|
|
5081
|
+
} finally{
|
|
5082
|
+
try {
|
|
5083
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
5084
|
+
_iterator2.return();
|
|
5085
|
+
}
|
|
5086
|
+
} finally{
|
|
5087
|
+
if (_didIteratorError2) {
|
|
5088
|
+
throw _iteratorError2;
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
return [
|
|
5094
|
+
2,
|
|
5095
|
+
new Response(JSON.stringify(data), {
|
|
5096
|
+
status: 200,
|
|
5097
|
+
headers: {
|
|
5098
|
+
"Content-Type": "application/json"
|
|
5099
|
+
}
|
|
5100
|
+
})
|
|
5101
|
+
];
|
|
5102
|
+
case 4:
|
|
5103
|
+
error = _state.sent();
|
|
5104
|
+
return [
|
|
5105
|
+
2,
|
|
5106
|
+
new Response(JSON.stringify({
|
|
5107
|
+
error: error
|
|
5108
|
+
}), {
|
|
5109
|
+
status: 500,
|
|
5110
|
+
headers: {
|
|
5111
|
+
"Content-Type": "application/json"
|
|
5112
|
+
}
|
|
5113
|
+
})
|
|
5114
|
+
];
|
|
5115
|
+
case 5:
|
|
5116
|
+
return [
|
|
5117
|
+
2
|
|
5118
|
+
];
|
|
5119
|
+
}
|
|
5120
|
+
});
|
|
5121
|
+
})();
|
|
5122
|
+
};
|
|
5123
|
+
};
|
|
5124
|
+
// src/adapters/client/openRouterClientAdapter/completions/index.ts
|
|
5125
|
+
var completions10 = function(param) {
|
|
5126
|
+
var openRouter = param.openRouter;
|
|
5127
|
+
return {
|
|
5128
|
+
post: post10({
|
|
5129
|
+
openRouter: openRouter
|
|
5130
|
+
})
|
|
5131
|
+
};
|
|
5132
|
+
};
|
|
5133
|
+
// src/adapters/client/openRouterClientAdapter/index.ts
|
|
5134
|
+
var openRouterClientAdapter = function(param) {
|
|
5135
|
+
var openRouter = param.openRouter;
|
|
5136
|
+
return {
|
|
5137
|
+
client: openRouter,
|
|
5138
|
+
requestHandlers: {
|
|
5139
|
+
"^/v1/models$": models13({
|
|
5140
|
+
openRouter: openRouter
|
|
5141
|
+
}),
|
|
5142
|
+
"^/(?:v1|/?openai)/chat/completions$": completions10({
|
|
5143
|
+
openRouter: openRouter
|
|
5144
|
+
})
|
|
5145
|
+
}
|
|
5146
|
+
};
|
|
5147
|
+
};
|
|
4061
5148
|
// src/adapters/run/completionsRunAdapter/index.ts
|
|
4062
5149
|
import _ from "lodash";
|
|
4063
5150
|
import { uid as uid2, omit as omit4, isEmpty as isEmpty2 } from "radash";
|
|
@@ -4699,7 +5786,7 @@ var serializeThread = function(param) {
|
|
|
4699
5786
|
};
|
|
4700
5787
|
};
|
|
4701
5788
|
// src/adapters/storage/prismaStorageAdapter/threads/post.ts
|
|
4702
|
-
var
|
|
5789
|
+
var post11 = function(param) {
|
|
4703
5790
|
var prisma = param.prisma;
|
|
4704
5791
|
return function(_urlString, options) {
|
|
4705
5792
|
return _async_to_generator(function() {
|
|
@@ -4775,7 +5862,7 @@ var post10 = function(param) {
|
|
|
4775
5862
|
var threads = function(param) {
|
|
4776
5863
|
var prisma = param.prisma;
|
|
4777
5864
|
return {
|
|
4778
|
-
post:
|
|
5865
|
+
post: post11({
|
|
4779
5866
|
prisma: prisma
|
|
4780
5867
|
})
|
|
4781
5868
|
};
|
|
@@ -4835,7 +5922,7 @@ var messageContentBlocks = function(param) {
|
|
|
4835
5922
|
}
|
|
4836
5923
|
];
|
|
4837
5924
|
};
|
|
4838
|
-
var
|
|
5925
|
+
var post12 = function(param) {
|
|
4839
5926
|
var prisma = param.prisma;
|
|
4840
5927
|
return function(urlString, options) {
|
|
4841
5928
|
return _async_to_generator(function() {
|
|
@@ -4883,7 +5970,7 @@ var post11 = function(param) {
|
|
|
4883
5970
|
};
|
|
4884
5971
|
// src/adapters/storage/prismaStorageAdapter/threads/messages/get.ts
|
|
4885
5972
|
import { assign as assign3, last } from "radash";
|
|
4886
|
-
var
|
|
5973
|
+
var get12 = function(param) {
|
|
4887
5974
|
var prisma = param.prisma;
|
|
4888
5975
|
return function(urlString) {
|
|
4889
5976
|
return _async_to_generator(function() {
|
|
@@ -4944,10 +6031,10 @@ var get11 = function(param) {
|
|
|
4944
6031
|
var messages2 = function(param) {
|
|
4945
6032
|
var prisma = param.prisma;
|
|
4946
6033
|
return {
|
|
4947
|
-
post:
|
|
6034
|
+
post: post12({
|
|
4948
6035
|
prisma: prisma
|
|
4949
6036
|
}),
|
|
4950
|
-
get:
|
|
6037
|
+
get: get12({
|
|
4951
6038
|
prisma: prisma
|
|
4952
6039
|
})
|
|
4953
6040
|
};
|
|
@@ -5018,7 +6105,7 @@ var mapPrismaRun = function(run4) {
|
|
|
5018
6105
|
};
|
|
5019
6106
|
};
|
|
5020
6107
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/get.ts
|
|
5021
|
-
var
|
|
6108
|
+
var get13 = function(param) {
|
|
5022
6109
|
var prisma = param.prisma;
|
|
5023
6110
|
return function(urlString) {
|
|
5024
6111
|
return _async_to_generator(function() {
|
|
@@ -5465,7 +6552,7 @@ var getMessages = function(param) {
|
|
|
5465
6552
|
};
|
|
5466
6553
|
};
|
|
5467
6554
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/post.ts
|
|
5468
|
-
var
|
|
6555
|
+
var post13 = function(param) {
|
|
5469
6556
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5470
6557
|
return function(urlString, options) {
|
|
5471
6558
|
return _async_to_generator(function() {
|
|
@@ -5639,17 +6726,17 @@ var post12 = function(param) {
|
|
|
5639
6726
|
var runs = function(param) {
|
|
5640
6727
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5641
6728
|
return {
|
|
5642
|
-
get:
|
|
6729
|
+
get: get13({
|
|
5643
6730
|
prisma: prisma
|
|
5644
6731
|
}),
|
|
5645
|
-
post:
|
|
6732
|
+
post: post13({
|
|
5646
6733
|
prisma: prisma,
|
|
5647
6734
|
runAdapter: runAdapter
|
|
5648
6735
|
})
|
|
5649
6736
|
};
|
|
5650
6737
|
};
|
|
5651
6738
|
// src/adapters/storage/prismaStorageAdapter/threads/run/get.ts
|
|
5652
|
-
var
|
|
6739
|
+
var get14 = function(param) {
|
|
5653
6740
|
var prisma = param.prisma;
|
|
5654
6741
|
return function(urlString) {
|
|
5655
6742
|
return _async_to_generator(function() {
|
|
@@ -5704,14 +6791,14 @@ var get13 = function(param) {
|
|
|
5704
6791
|
var run = function(param) {
|
|
5705
6792
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5706
6793
|
return {
|
|
5707
|
-
get:
|
|
6794
|
+
get: get14({
|
|
5708
6795
|
prisma: prisma
|
|
5709
6796
|
})
|
|
5710
6797
|
};
|
|
5711
6798
|
};
|
|
5712
6799
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/steps/get.ts
|
|
5713
6800
|
import { assign as assign6 } from "radash";
|
|
5714
|
-
var
|
|
6801
|
+
var get15 = function(param) {
|
|
5715
6802
|
var prisma = param.prisma;
|
|
5716
6803
|
return function(urlString) {
|
|
5717
6804
|
return _async_to_generator(function() {
|
|
@@ -5773,7 +6860,7 @@ var get14 = function(param) {
|
|
|
5773
6860
|
var steps = function(param) {
|
|
5774
6861
|
var prisma = param.prisma;
|
|
5775
6862
|
return {
|
|
5776
|
-
get:
|
|
6863
|
+
get: get15({
|
|
5777
6864
|
prisma: prisma
|
|
5778
6865
|
})
|
|
5779
6866
|
};
|
|
@@ -5941,7 +7028,7 @@ var updateRun = function(param) {
|
|
|
5941
7028
|
})();
|
|
5942
7029
|
};
|
|
5943
7030
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
5944
|
-
var
|
|
7031
|
+
var post14 = function(param) {
|
|
5945
7032
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5946
7033
|
return function(urlString, options) {
|
|
5947
7034
|
return _async_to_generator(function() {
|
|
@@ -6109,7 +7196,7 @@ var post13 = function(param) {
|
|
|
6109
7196
|
var submitToolOutputs = function(param) {
|
|
6110
7197
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
6111
7198
|
return {
|
|
6112
|
-
post:
|
|
7199
|
+
post: post14({
|
|
6113
7200
|
prisma: prisma,
|
|
6114
7201
|
// @ts-ignore-next-line
|
|
6115
7202
|
runAdapter: runAdapter
|
|
@@ -6118,7 +7205,7 @@ var submitToolOutputs = function(param) {
|
|
|
6118
7205
|
};
|
|
6119
7206
|
// src/adapters/storage/prismaStorageAdapter/assistants/post.ts
|
|
6120
7207
|
import dayjs9 from "dayjs";
|
|
6121
|
-
var
|
|
7208
|
+
var post15 = function(param) {
|
|
6122
7209
|
var prisma = param.prisma;
|
|
6123
7210
|
return function(_url, options) {
|
|
6124
7211
|
return _async_to_generator(function() {
|
|
@@ -6171,7 +7258,7 @@ var post14 = function(param) {
|
|
|
6171
7258
|
var assistants = function(param) {
|
|
6172
7259
|
var prisma = param.prisma;
|
|
6173
7260
|
return {
|
|
6174
|
-
post:
|
|
7261
|
+
post: post15({
|
|
6175
7262
|
prisma: prisma
|
|
6176
7263
|
})
|
|
6177
7264
|
};
|
|
@@ -6220,7 +7307,7 @@ var serializeThread2 = function(param) {
|
|
|
6220
7307
|
};
|
|
6221
7308
|
};
|
|
6222
7309
|
// src/adapters/storage/responsesStorageAdapter/threads/post.ts
|
|
6223
|
-
var
|
|
7310
|
+
var post16 = function(param) {
|
|
6224
7311
|
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6225
7312
|
return function(_urlString, options) {
|
|
6226
7313
|
return _async_to_generator(function() {
|
|
@@ -6341,7 +7428,7 @@ var post15 = function(param) {
|
|
|
6341
7428
|
var threads2 = function(param) {
|
|
6342
7429
|
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6343
7430
|
return {
|
|
6344
|
-
post:
|
|
7431
|
+
post: post16({
|
|
6345
7432
|
client: client,
|
|
6346
7433
|
addAnnotations: addAnnotations
|
|
6347
7434
|
})
|
|
@@ -6519,7 +7606,7 @@ var messageContentBlocks2 = function(param) {
|
|
|
6519
7606
|
attachments: attachments
|
|
6520
7607
|
})));
|
|
6521
7608
|
};
|
|
6522
|
-
var
|
|
7609
|
+
var post17 = function(param) {
|
|
6523
7610
|
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6524
7611
|
return function(urlString, options) {
|
|
6525
7612
|
return _async_to_generator(function() {
|
|
@@ -6612,7 +7699,7 @@ function responseId(param) {
|
|
|
6612
7699
|
return null;
|
|
6613
7700
|
}
|
|
6614
7701
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/get.ts
|
|
6615
|
-
var
|
|
7702
|
+
var get16 = function(param) {
|
|
6616
7703
|
var client = param.client, runAdapter = param.runAdapter;
|
|
6617
7704
|
return function(urlString) {
|
|
6618
7705
|
return _async_to_generator(function() {
|
|
@@ -6824,19 +7911,19 @@ var assignTimestamps = function(param) {
|
|
|
6824
7911
|
var messages3 = function(param) {
|
|
6825
7912
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6826
7913
|
return {
|
|
6827
|
-
post:
|
|
7914
|
+
post: post17({
|
|
6828
7915
|
runAdapter: runAdapter,
|
|
6829
7916
|
createResponseItems: createResponseItems,
|
|
6830
7917
|
addAnnotations: addAnnotations
|
|
6831
7918
|
}),
|
|
6832
|
-
get:
|
|
7919
|
+
get: get16({
|
|
6833
7920
|
client: client,
|
|
6834
7921
|
runAdapter: runAdapter
|
|
6835
7922
|
})
|
|
6836
7923
|
};
|
|
6837
7924
|
};
|
|
6838
7925
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/get.ts
|
|
6839
|
-
var
|
|
7926
|
+
var get17 = function() {
|
|
6840
7927
|
return function(urlString) {
|
|
6841
7928
|
return _async_to_generator(function() {
|
|
6842
7929
|
return _ts_generator(this, function(_state) {
|
|
@@ -7337,7 +8424,7 @@ var defaultAssistant = {
|
|
|
7337
8424
|
}
|
|
7338
8425
|
};
|
|
7339
8426
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/post.ts
|
|
7340
|
-
var
|
|
8427
|
+
var post18 = function(param) {
|
|
7341
8428
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
7342
8429
|
return function(urlString, options) {
|
|
7343
8430
|
return _async_to_generator(function() {
|
|
@@ -7516,8 +8603,8 @@ var post17 = function(param) {
|
|
|
7516
8603
|
var runs2 = function(param) {
|
|
7517
8604
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
7518
8605
|
return {
|
|
7519
|
-
get:
|
|
7520
|
-
post:
|
|
8606
|
+
get: get17(),
|
|
8607
|
+
post: post18({
|
|
7521
8608
|
client: client,
|
|
7522
8609
|
createResponseItems: createResponseItems,
|
|
7523
8610
|
runAdapter: runAdapter
|
|
@@ -7525,7 +8612,7 @@ var runs2 = function(param) {
|
|
|
7525
8612
|
};
|
|
7526
8613
|
};
|
|
7527
8614
|
// src/adapters/storage/responsesStorageAdapter/threads/run/get.ts
|
|
7528
|
-
var
|
|
8615
|
+
var get18 = function(param) {
|
|
7529
8616
|
var client = param.client, runAdapter = param.runAdapter;
|
|
7530
8617
|
return function(urlString) {
|
|
7531
8618
|
return _async_to_generator(function() {
|
|
@@ -7575,7 +8662,7 @@ var get17 = function(param) {
|
|
|
7575
8662
|
var run2 = function(param) {
|
|
7576
8663
|
var client = param.client, runAdapter = param.runAdapter;
|
|
7577
8664
|
return {
|
|
7578
|
-
get:
|
|
8665
|
+
get: get18({
|
|
7579
8666
|
client: client,
|
|
7580
8667
|
runAdapter: runAdapter
|
|
7581
8668
|
})
|
|
@@ -8096,7 +9183,7 @@ var serializeItemAsReasoningRunStep = function(param) {
|
|
|
8096
9183
|
};
|
|
8097
9184
|
};
|
|
8098
9185
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
|
|
8099
|
-
var
|
|
9186
|
+
var get19 = function(param) {
|
|
8100
9187
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8101
9188
|
return function(urlString) {
|
|
8102
9189
|
return _async_to_generator(function() {
|
|
@@ -8265,7 +9352,7 @@ var get18 = function(param) {
|
|
|
8265
9352
|
var steps2 = function(param) {
|
|
8266
9353
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8267
9354
|
return {
|
|
8268
|
-
get:
|
|
9355
|
+
get: get19({
|
|
8269
9356
|
client: client,
|
|
8270
9357
|
runAdapter: runAdapter
|
|
8271
9358
|
})
|
|
@@ -8347,7 +9434,7 @@ var truncation2 = function(param) {
|
|
|
8347
9434
|
return "auto";
|
|
8348
9435
|
};
|
|
8349
9436
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
8350
|
-
var
|
|
9437
|
+
var post19 = function(param) {
|
|
8351
9438
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8352
9439
|
return function(urlString, options) {
|
|
8353
9440
|
return _async_to_generator(function() {
|
|
@@ -8484,14 +9571,14 @@ var post18 = function(param) {
|
|
|
8484
9571
|
var submitToolOutputs2 = function(param) {
|
|
8485
9572
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8486
9573
|
return {
|
|
8487
|
-
post:
|
|
9574
|
+
post: post19({
|
|
8488
9575
|
client: client,
|
|
8489
9576
|
runAdapter: runAdapter
|
|
8490
9577
|
})
|
|
8491
9578
|
};
|
|
8492
9579
|
};
|
|
8493
9580
|
// src/adapters/storage/responsesStorageAdapter/assistants/get.ts
|
|
8494
|
-
var
|
|
9581
|
+
var get20 = function(param) {
|
|
8495
9582
|
var runAdapter = param.runAdapter;
|
|
8496
9583
|
return function(_urlString) {
|
|
8497
9584
|
return _async_to_generator(function() {
|
|
@@ -8540,7 +9627,7 @@ var get19 = function(param) {
|
|
|
8540
9627
|
};
|
|
8541
9628
|
};
|
|
8542
9629
|
// src/adapters/storage/responsesStorageAdapter/assistants/post.ts
|
|
8543
|
-
var
|
|
9630
|
+
var post20 = function() {
|
|
8544
9631
|
return function() {
|
|
8545
9632
|
return _async_to_generator(function() {
|
|
8546
9633
|
return _ts_generator(this, function(_state) {
|
|
@@ -8566,10 +9653,10 @@ var post19 = function() {
|
|
|
8566
9653
|
var assistants2 = function(param) {
|
|
8567
9654
|
var runAdapter = param.runAdapter;
|
|
8568
9655
|
return {
|
|
8569
|
-
get:
|
|
9656
|
+
get: get20({
|
|
8570
9657
|
runAdapter: runAdapter
|
|
8571
9658
|
}),
|
|
8572
|
-
post:
|
|
9659
|
+
post: post20()
|
|
8573
9660
|
};
|
|
8574
9661
|
};
|
|
8575
9662
|
// src/adapters/storage/responsesStorageAdapter/index.ts
|
|
@@ -8613,7 +9700,7 @@ var responseRegexp = "^/(?:v1|/?openai)/responses/([^/]+)$";
|
|
|
8613
9700
|
import { uid as uid8 } from "radash";
|
|
8614
9701
|
import dayjs21 from "dayjs";
|
|
8615
9702
|
import { assign as assign9 } from "radash";
|
|
8616
|
-
var
|
|
9703
|
+
var post21 = function(param) {
|
|
8617
9704
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
8618
9705
|
return function(urlString, options) {
|
|
8619
9706
|
return _async_to_generator(function() {
|
|
@@ -8804,8 +9891,8 @@ var post20 = function(param) {
|
|
|
8804
9891
|
var runs3 = function(param) {
|
|
8805
9892
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
8806
9893
|
return {
|
|
8807
|
-
get:
|
|
8808
|
-
post:
|
|
9894
|
+
get: get17(),
|
|
9895
|
+
post: post21({
|
|
8809
9896
|
client: client,
|
|
8810
9897
|
createResponseItems: createResponseItems,
|
|
8811
9898
|
runAdapter: runAdapter
|
|
@@ -8813,7 +9900,7 @@ var runs3 = function(param) {
|
|
|
8813
9900
|
};
|
|
8814
9901
|
};
|
|
8815
9902
|
// src/adapters/storage/azureResponsesStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
8816
|
-
var
|
|
9903
|
+
var post22 = function(param) {
|
|
8817
9904
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8818
9905
|
return function(urlString, options) {
|
|
8819
9906
|
return _async_to_generator(function() {
|
|
@@ -8959,14 +10046,14 @@ var post21 = function(param) {
|
|
|
8959
10046
|
var submitToolOutputs3 = function(param) {
|
|
8960
10047
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8961
10048
|
return {
|
|
8962
|
-
post:
|
|
10049
|
+
post: post22({
|
|
8963
10050
|
client: client,
|
|
8964
10051
|
runAdapter: runAdapter
|
|
8965
10052
|
})
|
|
8966
10053
|
};
|
|
8967
10054
|
};
|
|
8968
10055
|
// src/adapters/storage/azureResponsesStorageAdapter/responses/get.ts
|
|
8969
|
-
var
|
|
10056
|
+
var get21 = function(param) {
|
|
8970
10057
|
var client = param.client;
|
|
8971
10058
|
return function(urlString) {
|
|
8972
10059
|
return _async_to_generator(function() {
|
|
@@ -9000,7 +10087,7 @@ var get20 = function(param) {
|
|
|
9000
10087
|
var responses = function(param) {
|
|
9001
10088
|
var client = param.client;
|
|
9002
10089
|
return {
|
|
9003
|
-
get:
|
|
10090
|
+
get: get21({
|
|
9004
10091
|
client: client
|
|
9005
10092
|
})
|
|
9006
10093
|
};
|
|
@@ -9211,7 +10298,7 @@ var azureResponsesStorageAdapter = function() {
|
|
|
9211
10298
|
};
|
|
9212
10299
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/post.ts
|
|
9213
10300
|
import dayjs22 from "dayjs";
|
|
9214
|
-
var
|
|
10301
|
+
var post23 = function(param) {
|
|
9215
10302
|
var azureAiProject = param.azureAiProject;
|
|
9216
10303
|
return function(_urlString, options) {
|
|
9217
10304
|
return _async_to_generator(function() {
|
|
@@ -9257,14 +10344,14 @@ var post22 = function(param) {
|
|
|
9257
10344
|
var threads3 = function(param) {
|
|
9258
10345
|
var azureAiProject = param.azureAiProject;
|
|
9259
10346
|
return {
|
|
9260
|
-
post:
|
|
10347
|
+
post: post23({
|
|
9261
10348
|
azureAiProject: azureAiProject
|
|
9262
10349
|
})
|
|
9263
10350
|
};
|
|
9264
10351
|
};
|
|
9265
10352
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/messages/post.ts
|
|
9266
10353
|
import dayjs23 from "dayjs";
|
|
9267
|
-
var
|
|
10354
|
+
var post24 = function(param) {
|
|
9268
10355
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9269
10356
|
return function(urlString, options) {
|
|
9270
10357
|
return _async_to_generator(function() {
|
|
@@ -9378,7 +10465,7 @@ var post23 = function(param) {
|
|
|
9378
10465
|
};
|
|
9379
10466
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/messages/get.ts
|
|
9380
10467
|
import dayjs24 from "dayjs";
|
|
9381
|
-
var
|
|
10468
|
+
var get22 = function(param) {
|
|
9382
10469
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9383
10470
|
return function(urlString) {
|
|
9384
10471
|
return _async_to_generator(function() {
|
|
@@ -9566,18 +10653,18 @@ var get21 = function(param) {
|
|
|
9566
10653
|
var messages4 = function(param) {
|
|
9567
10654
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9568
10655
|
return {
|
|
9569
|
-
post:
|
|
10656
|
+
post: post24({
|
|
9570
10657
|
azureAiProject: azureAiProject,
|
|
9571
10658
|
runAdapter: runAdapter
|
|
9572
10659
|
}),
|
|
9573
|
-
get:
|
|
10660
|
+
get: get22({
|
|
9574
10661
|
azureAiProject: azureAiProject,
|
|
9575
10662
|
runAdapter: runAdapter
|
|
9576
10663
|
})
|
|
9577
10664
|
};
|
|
9578
10665
|
};
|
|
9579
10666
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/get.ts
|
|
9580
|
-
var
|
|
10667
|
+
var get23 = function() {
|
|
9581
10668
|
return function() {
|
|
9582
10669
|
return _async_to_generator(function() {
|
|
9583
10670
|
var response;
|
|
@@ -9604,7 +10691,7 @@ var get22 = function() {
|
|
|
9604
10691
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/post.ts
|
|
9605
10692
|
import { uid as uid9 } from "radash";
|
|
9606
10693
|
import dayjs25 from "dayjs";
|
|
9607
|
-
var
|
|
10694
|
+
var post25 = function(param) {
|
|
9608
10695
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9609
10696
|
return function(urlString, options) {
|
|
9610
10697
|
return _async_to_generator(function() {
|
|
@@ -9873,8 +10960,8 @@ var post24 = function(param) {
|
|
|
9873
10960
|
var runs4 = function(param) {
|
|
9874
10961
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9875
10962
|
return {
|
|
9876
|
-
get:
|
|
9877
|
-
post:
|
|
10963
|
+
get: get23(),
|
|
10964
|
+
post: post25({
|
|
9878
10965
|
azureAiProject: azureAiProject,
|
|
9879
10966
|
runAdapter: runAdapter
|
|
9880
10967
|
})
|
|
@@ -9882,7 +10969,7 @@ var runs4 = function(param) {
|
|
|
9882
10969
|
};
|
|
9883
10970
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/run/get.ts
|
|
9884
10971
|
import dayjs26 from "dayjs";
|
|
9885
|
-
var
|
|
10972
|
+
var get24 = function(param) {
|
|
9886
10973
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9887
10974
|
return function(urlString) {
|
|
9888
10975
|
return _async_to_generator(function() {
|
|
@@ -9966,7 +11053,7 @@ var get23 = function(param) {
|
|
|
9966
11053
|
var run3 = function(param) {
|
|
9967
11054
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9968
11055
|
return {
|
|
9969
|
-
get:
|
|
11056
|
+
get: get24({
|
|
9970
11057
|
azureAiProject: azureAiProject,
|
|
9971
11058
|
runAdapter: runAdapter
|
|
9972
11059
|
})
|
|
@@ -9974,7 +11061,7 @@ var run3 = function(param) {
|
|
|
9974
11061
|
};
|
|
9975
11062
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
|
|
9976
11063
|
import dayjs27 from "dayjs";
|
|
9977
|
-
var
|
|
11064
|
+
var get25 = function(param) {
|
|
9978
11065
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9979
11066
|
return function(urlString) {
|
|
9980
11067
|
return _async_to_generator(function() {
|
|
@@ -10185,7 +11272,7 @@ var get24 = function(param) {
|
|
|
10185
11272
|
var steps3 = function(param) {
|
|
10186
11273
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10187
11274
|
return {
|
|
10188
|
-
get:
|
|
11275
|
+
get: get25({
|
|
10189
11276
|
azureAiProject: azureAiProject,
|
|
10190
11277
|
runAdapter: runAdapter,
|
|
10191
11278
|
prisma: prisma
|
|
@@ -10513,7 +11600,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
|
|
|
10513
11600
|
}
|
|
10514
11601
|
return null;
|
|
10515
11602
|
}
|
|
10516
|
-
var
|
|
11603
|
+
var post26 = function(param) {
|
|
10517
11604
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10518
11605
|
return function(urlString, options) {
|
|
10519
11606
|
return _async_to_generator(function() {
|
|
@@ -10826,7 +11913,7 @@ var post25 = function(param) {
|
|
|
10826
11913
|
var submitToolOutputs4 = function(param) {
|
|
10827
11914
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10828
11915
|
return {
|
|
10829
|
-
post:
|
|
11916
|
+
post: post26({
|
|
10830
11917
|
azureAiProject: azureAiProject,
|
|
10831
11918
|
runAdapter: runAdapter,
|
|
10832
11919
|
prisma: prisma
|
|
@@ -10834,7 +11921,7 @@ var submitToolOutputs4 = function(param) {
|
|
|
10834
11921
|
};
|
|
10835
11922
|
};
|
|
10836
11923
|
// src/adapters/storage/azureAgentsStorageAdapter/assistants/post.ts
|
|
10837
|
-
var
|
|
11924
|
+
var post27 = function(param) {
|
|
10838
11925
|
var runAdapter = param.runAdapter;
|
|
10839
11926
|
return function(_urlString, options) {
|
|
10840
11927
|
return _async_to_generator(function() {
|
|
@@ -10876,7 +11963,7 @@ var post26 = function(param) {
|
|
|
10876
11963
|
var assistants3 = function(param) {
|
|
10877
11964
|
var runAdapter = param.runAdapter;
|
|
10878
11965
|
return {
|
|
10879
|
-
post:
|
|
11966
|
+
post: post27({
|
|
10880
11967
|
runAdapter: runAdapter
|
|
10881
11968
|
})
|
|
10882
11969
|
};
|
|
@@ -13793,5 +14880,5 @@ var azureAgentsRunAdapter = function(param) {
|
|
|
13793
14880
|
handleRun: handleRun
|
|
13794
14881
|
};
|
|
13795
14882
|
};
|
|
13796
|
-
export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, azureResponsesStorageAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, supercompat, togetherClientAdapter };
|
|
14883
|
+
export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, azureResponsesStorageAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openRouterClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, supercompat, togetherClientAdapter };
|
|
13797
14884
|
//# sourceMappingURL=index.js.map
|