supercompat 3.15.6 → 3.16.0
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 +1160 -115
- 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 +1136 -95
- package/dist/index.js.map +1 -1
- package/dist/supercompat.cjs +0 -9
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js +0 -9
- package/dist/supercompat.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -436,6 +436,9 @@ __export(index_exports, {
|
|
|
436
436
|
ollamaClientAdapter: function() {
|
|
437
437
|
return ollamaClientAdapter;
|
|
438
438
|
},
|
|
439
|
+
openRouterClientAdapter: function() {
|
|
440
|
+
return openRouterClientAdapter;
|
|
441
|
+
},
|
|
439
442
|
openaiClientAdapter: function() {
|
|
440
443
|
return openaiClientAdapter;
|
|
441
444
|
},
|
|
@@ -493,18 +496,13 @@ var requestHandlers = function(param) {
|
|
|
493
496
|
var findRequestHandler = function(param) {
|
|
494
497
|
var url = param.url, requestHandlers2 = param.requestHandlers;
|
|
495
498
|
var pathname = new URL(url).pathname;
|
|
496
|
-
console.log("[findRequestHandler] Looking for handler for pathname:", pathname);
|
|
497
|
-
console.log("[findRequestHandler] Available patterns:", Object.keys(requestHandlers2));
|
|
498
499
|
for(var key in requestHandlers2){
|
|
499
500
|
var regex = new RegExp(key);
|
|
500
501
|
var matches = regex.test(pathname);
|
|
501
|
-
console.log("[findRequestHandler] Testing pattern:", key, "- Matches:", matches);
|
|
502
502
|
if (matches) {
|
|
503
|
-
console.log("[findRequestHandler] Found handler!");
|
|
504
503
|
return requestHandlers2[key];
|
|
505
504
|
}
|
|
506
505
|
}
|
|
507
|
-
console.log("[findRequestHandler] No handler found for pathname:", pathname);
|
|
508
506
|
};
|
|
509
507
|
// src/supercompatFetch/originalFetch.ts
|
|
510
508
|
var originalFetch = function(param) {
|
|
@@ -567,13 +565,11 @@ var supercompatFetch = function(param) {
|
|
|
567
565
|
var _ref, _args, url, options, pathHandler, method, requestHandler;
|
|
568
566
|
return _ts_generator(this, function(_state) {
|
|
569
567
|
_args = _sliced_to_array(args, 2), url = _args[0], options = _args[1];
|
|
570
|
-
console.log("[supercompatFetch] Request:", (options === null || options === void 0 ? void 0 : options.method) || "GET", url);
|
|
571
568
|
pathHandler = findRequestHandler({
|
|
572
569
|
url: url,
|
|
573
570
|
requestHandlers: requestHandlers2
|
|
574
571
|
});
|
|
575
572
|
if (!pathHandler) {
|
|
576
|
-
console.log("[supercompatFetch] No handler found, using originalFetch");
|
|
577
573
|
return [
|
|
578
574
|
2,
|
|
579
575
|
originalFetch({
|
|
@@ -585,7 +581,6 @@ var supercompatFetch = function(param) {
|
|
|
585
581
|
method = (_ref = options === null || options === void 0 ? void 0 : options.method) !== null && _ref !== void 0 ? _ref : "";
|
|
586
582
|
requestHandler = pathHandler[method.toLowerCase()];
|
|
587
583
|
if (!requestHandler) {
|
|
588
|
-
console.log("[supercompatFetch] Handler found but no method handler, using originalFetch");
|
|
589
584
|
return [
|
|
590
585
|
2,
|
|
591
586
|
originalFetch({
|
|
@@ -594,7 +589,6 @@ var supercompatFetch = function(param) {
|
|
|
594
589
|
})
|
|
595
590
|
];
|
|
596
591
|
}
|
|
597
|
-
console.log("[supercompatFetch] Handler found, calling it");
|
|
598
592
|
return [
|
|
599
593
|
2,
|
|
600
594
|
requestHandler.apply(void 0, _to_consumable_array(args))
|
|
@@ -1206,7 +1200,7 @@ var get3 = function(param) {
|
|
|
1206
1200
|
var azureAiProject = param.azureAiProject;
|
|
1207
1201
|
return function(_url, _options) {
|
|
1208
1202
|
return _async_to_generator(function() {
|
|
1209
|
-
var
|
|
1203
|
+
var models14, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, deployment, err, error;
|
|
1210
1204
|
return _ts_generator(this, function(_state) {
|
|
1211
1205
|
switch(_state.label){
|
|
1212
1206
|
case 0:
|
|
@@ -1216,7 +1210,7 @@ var get3 = function(param) {
|
|
|
1216
1210
|
,
|
|
1217
1211
|
14
|
|
1218
1212
|
]);
|
|
1219
|
-
|
|
1213
|
+
models14 = [];
|
|
1220
1214
|
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
1221
1215
|
_state.label = 1;
|
|
1222
1216
|
case 1:
|
|
@@ -1241,7 +1235,7 @@ var get3 = function(param) {
|
|
|
1241
1235
|
_value = _step.value;
|
|
1242
1236
|
deployment = _value;
|
|
1243
1237
|
if (deployment.type === "ModelDeployment" && "modelName" in deployment && "modelPublisher" in deployment) {
|
|
1244
|
-
|
|
1238
|
+
models14.push({
|
|
1245
1239
|
id: deployment.modelName,
|
|
1246
1240
|
object: "model",
|
|
1247
1241
|
created: Date.now(),
|
|
@@ -1307,7 +1301,7 @@ var get3 = function(param) {
|
|
|
1307
1301
|
2,
|
|
1308
1302
|
new Response(JSON.stringify({
|
|
1309
1303
|
object: "list",
|
|
1310
|
-
data:
|
|
1304
|
+
data: models14
|
|
1311
1305
|
}), {
|
|
1312
1306
|
status: 200,
|
|
1313
1307
|
headers: {
|
|
@@ -2670,7 +2664,7 @@ var post5 = function(param) {
|
|
|
2670
2664
|
stream = new ReadableStream({
|
|
2671
2665
|
start: function start(controller) {
|
|
2672
2666
|
return _async_to_generator(function() {
|
|
2673
|
-
var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex,
|
|
2667
|
+
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;
|
|
2674
2668
|
return _ts_generator(this, function(_state) {
|
|
2675
2669
|
switch(_state.label){
|
|
2676
2670
|
case 0:
|
|
@@ -2680,7 +2674,7 @@ var post5 = function(param) {
|
|
|
2680
2674
|
computerToolUseIds = /* @__PURE__ */ new Set();
|
|
2681
2675
|
normalizedComputerCalls = /* @__PURE__ */ new Set();
|
|
2682
2676
|
nextToolCallIndex = 0;
|
|
2683
|
-
|
|
2677
|
+
parseJson3 = function(value) {
|
|
2684
2678
|
try {
|
|
2685
2679
|
return JSON.parse(value);
|
|
2686
2680
|
} catch (unused) {
|
|
@@ -2777,7 +2771,7 @@ var post5 = function(param) {
|
|
|
2777
2771
|
if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
|
|
2778
2772
|
;
|
|
2779
2773
|
buffered = (_toolUseIdArgumentBuffer_get = toolUseIdArgumentBuffer.get(toolUseId)) !== null && _toolUseIdArgumentBuffer_get !== void 0 ? _toolUseIdArgumentBuffer_get : "";
|
|
2780
|
-
parsed = buffered ?
|
|
2774
|
+
parsed = buffered ? parseJson3(buffered) : void 0;
|
|
2781
2775
|
if (parsed !== void 0) {
|
|
2782
2776
|
normalized = normalizeComputerToolCallPayload(parsed);
|
|
2783
2777
|
toolCallIndex = getOrCreateIndexForToolUseId(toolUseId);
|
|
@@ -2842,7 +2836,7 @@ var post5 = function(param) {
|
|
|
2842
2836
|
updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
|
|
2843
2837
|
toolUseIdArgumentBuffer.set(toolUseId1, updated);
|
|
2844
2838
|
if (!normalizedComputerCalls.has(toolUseId1)) {
|
|
2845
|
-
parsed1 =
|
|
2839
|
+
parsed1 = parseJson3(updated);
|
|
2846
2840
|
if (parsed1 !== void 0) {
|
|
2847
2841
|
normalized1 = normalizeComputerToolCallPayload(parsed1);
|
|
2848
2842
|
toolCallIndex2 = getOrCreateIndexForToolUseId(toolUseId1);
|
|
@@ -4018,10 +4012,874 @@ var post9 = function(param) {
|
|
|
4018
4012
|
stream = new ReadableStream({
|
|
4019
4013
|
start: function start(controller) {
|
|
4020
4014
|
return _async_to_generator(function() {
|
|
4021
|
-
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
4015
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
4016
|
+
return _ts_generator(this, function(_state) {
|
|
4017
|
+
switch(_state.label){
|
|
4018
|
+
case 0:
|
|
4019
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
4020
|
+
_state.label = 1;
|
|
4021
|
+
case 1:
|
|
4022
|
+
_state.trys.push([
|
|
4023
|
+
1,
|
|
4024
|
+
6,
|
|
4025
|
+
7,
|
|
4026
|
+
12
|
|
4027
|
+
]);
|
|
4028
|
+
_iterator = _async_iterator(response);
|
|
4029
|
+
_state.label = 2;
|
|
4030
|
+
case 2:
|
|
4031
|
+
return [
|
|
4032
|
+
4,
|
|
4033
|
+
_iterator.next()
|
|
4034
|
+
];
|
|
4035
|
+
case 3:
|
|
4036
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
4037
|
+
3,
|
|
4038
|
+
5
|
|
4039
|
+
];
|
|
4040
|
+
_value = _step.value;
|
|
4041
|
+
chunk = _value;
|
|
4042
|
+
controller.enqueue("data: ".concat(JSON.stringify(chunk), "\n\n"));
|
|
4043
|
+
_state.label = 4;
|
|
4044
|
+
case 4:
|
|
4045
|
+
_iteratorAbruptCompletion = false;
|
|
4046
|
+
return [
|
|
4047
|
+
3,
|
|
4048
|
+
2
|
|
4049
|
+
];
|
|
4050
|
+
case 5:
|
|
4051
|
+
return [
|
|
4052
|
+
3,
|
|
4053
|
+
12
|
|
4054
|
+
];
|
|
4055
|
+
case 6:
|
|
4056
|
+
err = _state.sent();
|
|
4057
|
+
_didIteratorError = true;
|
|
4058
|
+
_iteratorError = err;
|
|
4059
|
+
return [
|
|
4060
|
+
3,
|
|
4061
|
+
12
|
|
4062
|
+
];
|
|
4063
|
+
case 7:
|
|
4064
|
+
_state.trys.push([
|
|
4065
|
+
7,
|
|
4066
|
+
,
|
|
4067
|
+
10,
|
|
4068
|
+
11
|
|
4069
|
+
]);
|
|
4070
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
4071
|
+
3,
|
|
4072
|
+
9
|
|
4073
|
+
];
|
|
4074
|
+
return [
|
|
4075
|
+
4,
|
|
4076
|
+
_iterator.return()
|
|
4077
|
+
];
|
|
4078
|
+
case 8:
|
|
4079
|
+
_state.sent();
|
|
4080
|
+
_state.label = 9;
|
|
4081
|
+
case 9:
|
|
4082
|
+
return [
|
|
4083
|
+
3,
|
|
4084
|
+
11
|
|
4085
|
+
];
|
|
4086
|
+
case 10:
|
|
4087
|
+
if (_didIteratorError) {
|
|
4088
|
+
throw _iteratorError;
|
|
4089
|
+
}
|
|
4090
|
+
return [
|
|
4091
|
+
7
|
|
4092
|
+
];
|
|
4093
|
+
case 11:
|
|
4094
|
+
return [
|
|
4095
|
+
7
|
|
4096
|
+
];
|
|
4097
|
+
case 12:
|
|
4098
|
+
controller.close();
|
|
4099
|
+
return [
|
|
4100
|
+
2
|
|
4101
|
+
];
|
|
4102
|
+
}
|
|
4103
|
+
});
|
|
4104
|
+
})();
|
|
4105
|
+
}
|
|
4106
|
+
});
|
|
4107
|
+
return [
|
|
4108
|
+
2,
|
|
4109
|
+
new Response(stream, {
|
|
4110
|
+
headers: {
|
|
4111
|
+
"Content-Type": "text/event-stream"
|
|
4112
|
+
}
|
|
4113
|
+
})
|
|
4114
|
+
];
|
|
4115
|
+
case 2:
|
|
4116
|
+
_state.trys.push([
|
|
4117
|
+
2,
|
|
4118
|
+
4,
|
|
4119
|
+
,
|
|
4120
|
+
5
|
|
4121
|
+
]);
|
|
4122
|
+
return [
|
|
4123
|
+
4,
|
|
4124
|
+
ollama.chat.completions.create(body)
|
|
4125
|
+
];
|
|
4126
|
+
case 3:
|
|
4127
|
+
data = _state.sent();
|
|
4128
|
+
return [
|
|
4129
|
+
2,
|
|
4130
|
+
new Response(JSON.stringify({
|
|
4131
|
+
data: data
|
|
4132
|
+
}), {
|
|
4133
|
+
status: 200,
|
|
4134
|
+
headers: {
|
|
4135
|
+
"Content-Type": "application/json"
|
|
4136
|
+
}
|
|
4137
|
+
})
|
|
4138
|
+
];
|
|
4139
|
+
case 4:
|
|
4140
|
+
error = _state.sent();
|
|
4141
|
+
return [
|
|
4142
|
+
2,
|
|
4143
|
+
new Response(JSON.stringify({
|
|
4144
|
+
error: error
|
|
4145
|
+
}), {
|
|
4146
|
+
status: 500,
|
|
4147
|
+
headers: {
|
|
4148
|
+
"Content-Type": "application/json"
|
|
4149
|
+
}
|
|
4150
|
+
})
|
|
4151
|
+
];
|
|
4152
|
+
case 5:
|
|
4153
|
+
return [
|
|
4154
|
+
2
|
|
4155
|
+
];
|
|
4156
|
+
}
|
|
4157
|
+
});
|
|
4158
|
+
})();
|
|
4159
|
+
};
|
|
4160
|
+
};
|
|
4161
|
+
// src/adapters/client/ollamaClientAdapter/completions/index.ts
|
|
4162
|
+
var completions9 = function(param) {
|
|
4163
|
+
var ollama = param.ollama;
|
|
4164
|
+
return {
|
|
4165
|
+
post: post9({
|
|
4166
|
+
ollama: ollama
|
|
4167
|
+
})
|
|
4168
|
+
};
|
|
4169
|
+
};
|
|
4170
|
+
// src/adapters/client/ollamaClientAdapter/index.ts
|
|
4171
|
+
var ollamaClientAdapter = function(param) {
|
|
4172
|
+
var ollama = param.ollama;
|
|
4173
|
+
return {
|
|
4174
|
+
client: ollama,
|
|
4175
|
+
requestHandlers: {
|
|
4176
|
+
"^/v1/models$": models12({
|
|
4177
|
+
ollama: ollama
|
|
4178
|
+
}),
|
|
4179
|
+
"^/(?:v1|/?openai)/chat/completions$": completions9({
|
|
4180
|
+
ollama: ollama
|
|
4181
|
+
})
|
|
4182
|
+
}
|
|
4183
|
+
};
|
|
4184
|
+
};
|
|
4185
|
+
// src/adapters/client/openRouterClientAdapter/models/get.ts
|
|
4186
|
+
var get11 = function(param) {
|
|
4187
|
+
var openRouter = param.openRouter;
|
|
4188
|
+
return function(_url, _options) {
|
|
4189
|
+
return _async_to_generator(function() {
|
|
4190
|
+
var data, error;
|
|
4191
|
+
return _ts_generator(this, function(_state) {
|
|
4192
|
+
switch(_state.label){
|
|
4193
|
+
case 0:
|
|
4194
|
+
_state.trys.push([
|
|
4195
|
+
0,
|
|
4196
|
+
2,
|
|
4197
|
+
,
|
|
4198
|
+
3
|
|
4199
|
+
]);
|
|
4200
|
+
return [
|
|
4201
|
+
4,
|
|
4202
|
+
openRouter.models.list()
|
|
4203
|
+
];
|
|
4204
|
+
case 1:
|
|
4205
|
+
data = _state.sent();
|
|
4206
|
+
return [
|
|
4207
|
+
2,
|
|
4208
|
+
new Response(JSON.stringify(data), {
|
|
4209
|
+
status: 200,
|
|
4210
|
+
headers: {
|
|
4211
|
+
"Content-Type": "application/json"
|
|
4212
|
+
}
|
|
4213
|
+
})
|
|
4214
|
+
];
|
|
4215
|
+
case 2:
|
|
4216
|
+
error = _state.sent();
|
|
4217
|
+
return [
|
|
4218
|
+
2,
|
|
4219
|
+
new Response(JSON.stringify({
|
|
4220
|
+
error: error
|
|
4221
|
+
}), {
|
|
4222
|
+
status: 500,
|
|
4223
|
+
headers: {
|
|
4224
|
+
"Content-Type": "application/json"
|
|
4225
|
+
}
|
|
4226
|
+
})
|
|
4227
|
+
];
|
|
4228
|
+
case 3:
|
|
4229
|
+
return [
|
|
4230
|
+
2
|
|
4231
|
+
];
|
|
4232
|
+
}
|
|
4233
|
+
});
|
|
4234
|
+
})();
|
|
4235
|
+
};
|
|
4236
|
+
};
|
|
4237
|
+
// src/adapters/client/openRouterClientAdapter/models/index.ts
|
|
4238
|
+
var models13 = function(param) {
|
|
4239
|
+
var openRouter = param.openRouter;
|
|
4240
|
+
return {
|
|
4241
|
+
get: get11({
|
|
4242
|
+
openRouter: openRouter
|
|
4243
|
+
})
|
|
4244
|
+
};
|
|
4245
|
+
};
|
|
4246
|
+
// src/adapters/client/openRouterClientAdapter/completions/normalizeComputerCall.ts
|
|
4247
|
+
var MODEL_QUIRKS = {
|
|
4248
|
+
"z-ai/glm-4.6v": {
|
|
4249
|
+
normalizedCoords: true,
|
|
4250
|
+
cleanArtifacts: true
|
|
4251
|
+
},
|
|
4252
|
+
"qwen/": {
|
|
4253
|
+
fuzzyFallback: true
|
|
4254
|
+
}
|
|
4255
|
+
};
|
|
4256
|
+
var getQuirks = function(model) {
|
|
4257
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4258
|
+
try {
|
|
4259
|
+
for(var _iterator = Object.entries(MODEL_QUIRKS)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4260
|
+
var _step_value = _sliced_to_array(_step.value, 2), prefix = _step_value[0], quirks = _step_value[1];
|
|
4261
|
+
if (model.startsWith(prefix)) return quirks;
|
|
4262
|
+
}
|
|
4263
|
+
} catch (err) {
|
|
4264
|
+
_didIteratorError = true;
|
|
4265
|
+
_iteratorError = err;
|
|
4266
|
+
} finally{
|
|
4267
|
+
try {
|
|
4268
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4269
|
+
_iterator.return();
|
|
4270
|
+
}
|
|
4271
|
+
} finally{
|
|
4272
|
+
if (_didIteratorError) {
|
|
4273
|
+
throw _iteratorError;
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
return {};
|
|
4278
|
+
};
|
|
4279
|
+
var cleanTextArtifacts = function(text) {
|
|
4280
|
+
return text.replace(/<\|begin_of_box\|>/g, "").replace(/<\|end_of_box\|>/g, "").replace(/<arg_key>[^<]*<\/arg_key>/g, "").replace(/<\/arg_value>/g, "").trim();
|
|
4281
|
+
};
|
|
4282
|
+
var KNOWN_ACTION_TYPES = [
|
|
4283
|
+
"double_click",
|
|
4284
|
+
"screenshot",
|
|
4285
|
+
"keypress",
|
|
4286
|
+
"scroll",
|
|
4287
|
+
"click",
|
|
4288
|
+
"move",
|
|
4289
|
+
"type",
|
|
4290
|
+
"drag",
|
|
4291
|
+
"wait"
|
|
4292
|
+
];
|
|
4293
|
+
var splitCoordDigits = function(numStr) {
|
|
4294
|
+
for(var i = 1; i < numStr.length; i++){
|
|
4295
|
+
var x = parseInt(numStr.slice(0, i));
|
|
4296
|
+
var y = parseInt(numStr.slice(i));
|
|
4297
|
+
if (x >= 0 && x <= 1e3 && y >= 0 && y <= 1e3) {
|
|
4298
|
+
return {
|
|
4299
|
+
x: x,
|
|
4300
|
+
y: y
|
|
4301
|
+
};
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
return null;
|
|
4305
|
+
};
|
|
4306
|
+
var cleanGlmAction = function(action) {
|
|
4307
|
+
var typeVal = action.type;
|
|
4308
|
+
if (typeof typeVal !== "string") return action;
|
|
4309
|
+
var argValueMatch = typeVal.match(/<arg_value>\s*(\{[\s\S]*\})\s*$/);
|
|
4310
|
+
if (argValueMatch) {
|
|
4311
|
+
var inner = parseJson2(argValueMatch[1]);
|
|
4312
|
+
if (inner && (typeof inner === "undefined" ? "undefined" : _type_of(inner)) === "object") {
|
|
4313
|
+
return inner;
|
|
4314
|
+
}
|
|
4315
|
+
}
|
|
4316
|
+
var cleanedType = typeVal.replace(/<\/?[^>]+>/g, "").replace(/\n/g, "").trim();
|
|
4317
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4318
|
+
try {
|
|
4319
|
+
for(var _iterator = KNOWN_ACTION_TYPES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4320
|
+
var actionType = _step.value;
|
|
4321
|
+
if (cleanedType.startsWith(actionType) && cleanedType !== actionType) {
|
|
4322
|
+
var rest = cleanedType.slice(actionType.length);
|
|
4323
|
+
var nums = rest.match(/\d+/g);
|
|
4324
|
+
if (nums && nums.length >= 2) {
|
|
4325
|
+
return _object_spread_props(_object_spread({}, action), {
|
|
4326
|
+
type: actionType,
|
|
4327
|
+
x: parseInt(nums[0]),
|
|
4328
|
+
y: parseInt(nums[1])
|
|
4329
|
+
});
|
|
4330
|
+
}
|
|
4331
|
+
if (nums && nums.length === 1 && nums[0].length >= 2) {
|
|
4332
|
+
var coords = splitCoordDigits(nums[0]);
|
|
4333
|
+
if (coords) {
|
|
4334
|
+
return _object_spread(_object_spread_props(_object_spread({}, action), {
|
|
4335
|
+
type: actionType
|
|
4336
|
+
}), coords);
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
return _object_spread_props(_object_spread({}, action), {
|
|
4340
|
+
type: actionType
|
|
4341
|
+
});
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
} catch (err) {
|
|
4345
|
+
_didIteratorError = true;
|
|
4346
|
+
_iteratorError = err;
|
|
4347
|
+
} finally{
|
|
4348
|
+
try {
|
|
4349
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4350
|
+
_iterator.return();
|
|
4351
|
+
}
|
|
4352
|
+
} finally{
|
|
4353
|
+
if (_didIteratorError) {
|
|
4354
|
+
throw _iteratorError;
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
if (cleanedType === typeVal) return action;
|
|
4359
|
+
return _object_spread_props(_object_spread({}, action), {
|
|
4360
|
+
type: cleanedType
|
|
4361
|
+
});
|
|
4362
|
+
};
|
|
4363
|
+
var cleanGlmFields = function(action) {
|
|
4364
|
+
var result = _object_spread({}, action);
|
|
4365
|
+
if (typeof result.x === "string") {
|
|
4366
|
+
var nums = result.x.match(/\d+/g);
|
|
4367
|
+
if (nums && nums.length >= 2) {
|
|
4368
|
+
result.x = parseInt(nums[0]);
|
|
4369
|
+
if (result.y === void 0 || typeof result.y === "string") {
|
|
4370
|
+
result.y = parseInt(nums[1]);
|
|
4371
|
+
}
|
|
4372
|
+
} else if (nums && nums.length === 1) {
|
|
4373
|
+
result.x = parseInt(nums[0]);
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
if (typeof result.y === "string") {
|
|
4377
|
+
var nums1 = result.y.match(/\d+/g);
|
|
4378
|
+
if (nums1 && nums1.length >= 1) {
|
|
4379
|
+
result.y = parseInt(nums1[0]);
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
for(var _i = 0, _iter = [
|
|
4383
|
+
"scroll_x",
|
|
4384
|
+
"scroll_y"
|
|
4385
|
+
]; _i < _iter.length; _i++){
|
|
4386
|
+
var key = _iter[_i];
|
|
4387
|
+
if (typeof result[key] === "string") {
|
|
4388
|
+
var nums2 = result[key].match(/\d+/g);
|
|
4389
|
+
if (nums2) result[key] = parseInt(nums2[0]);
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
if (typeof result.type === "string") {
|
|
4393
|
+
result.type = result.type.replace(/<[^>]*>/g, "").replace(/^\{|\}$/g, "").replace(/\n/g, "").trim();
|
|
4394
|
+
}
|
|
4395
|
+
return result;
|
|
4396
|
+
};
|
|
4397
|
+
var applyArtifactCleanup = function(action) {
|
|
4398
|
+
return cleanGlmFields(cleanGlmAction(action));
|
|
4399
|
+
};
|
|
4400
|
+
var parseJson2 = function(text) {
|
|
4401
|
+
try {
|
|
4402
|
+
return JSON.parse(text);
|
|
4403
|
+
} catch (unused) {
|
|
4404
|
+
return void 0;
|
|
4405
|
+
}
|
|
4406
|
+
};
|
|
4407
|
+
var extractJson = function(text) {
|
|
4408
|
+
var direct = parseJson2(text);
|
|
4409
|
+
if (direct) return direct;
|
|
4410
|
+
var codeBlockMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
4411
|
+
if (codeBlockMatch) {
|
|
4412
|
+
var parsed = parseJson2(codeBlockMatch[1].trim());
|
|
4413
|
+
if (parsed) return parsed;
|
|
4414
|
+
}
|
|
4415
|
+
var jsonMatch = text.match(/(\{[\s\S]*\})\s*$/);
|
|
4416
|
+
if (jsonMatch) {
|
|
4417
|
+
var parsed1 = parseJson2(jsonMatch[1].trim());
|
|
4418
|
+
if (parsed1) return parsed1;
|
|
4419
|
+
}
|
|
4420
|
+
return void 0;
|
|
4421
|
+
};
|
|
4422
|
+
var fuzzyExtractJson = function(text) {
|
|
4423
|
+
var clickMatch = text.match(/"action"\s*:\s*"click"\s*,\s*"x"\s*:\s*\[?\s*(\d+)\s*,\s*(\d+)/);
|
|
4424
|
+
if (clickMatch) {
|
|
4425
|
+
return {
|
|
4426
|
+
action: {
|
|
4427
|
+
type: "click",
|
|
4428
|
+
x: parseInt(clickMatch[1]),
|
|
4429
|
+
y: parseInt(clickMatch[2])
|
|
4430
|
+
}
|
|
4431
|
+
};
|
|
4432
|
+
}
|
|
4433
|
+
var actionTypeMatch = text.match(/"type"\s*:\s*"(\w+)"/);
|
|
4434
|
+
if (actionTypeMatch) {
|
|
4435
|
+
var result = {
|
|
4436
|
+
type: actionTypeMatch[1]
|
|
4437
|
+
};
|
|
4438
|
+
var xMatch = text.match(/"x"\s*:\s*\[?\s*(\d+)/);
|
|
4439
|
+
var yMatch = text.match(/"y"\s*:\s*(\d+)/);
|
|
4440
|
+
if (xMatch) result.x = parseInt(xMatch[1]);
|
|
4441
|
+
if (yMatch) {
|
|
4442
|
+
result.y = parseInt(yMatch[1]);
|
|
4443
|
+
} else if (xMatch) {
|
|
4444
|
+
var _xMatch_index;
|
|
4445
|
+
var afterX = text.slice(((_xMatch_index = xMatch.index) !== null && _xMatch_index !== void 0 ? _xMatch_index : 0) + xMatch[0].length);
|
|
4446
|
+
var nextNum = afterX.match(/\s*,?\s*(\d+)/);
|
|
4447
|
+
if (nextNum) result.y = parseInt(nextNum[1]);
|
|
4448
|
+
}
|
|
4449
|
+
var textMatch = text.match(/"text"\s*:\s*"([^"]*)"/);
|
|
4450
|
+
if (textMatch) result.text = textMatch[1];
|
|
4451
|
+
return {
|
|
4452
|
+
action: result
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
return void 0;
|
|
4456
|
+
};
|
|
4457
|
+
var denormalize = function(value, dimension) {
|
|
4458
|
+
return Math.round(value / 1e3 * dimension);
|
|
4459
|
+
};
|
|
4460
|
+
var denormalizeAction = function(action, displayWidth, displayHeight) {
|
|
4461
|
+
var result = _object_spread({}, action);
|
|
4462
|
+
if (typeof result.x === "number") {
|
|
4463
|
+
result.x = denormalize(result.x, displayWidth);
|
|
4464
|
+
}
|
|
4465
|
+
if (typeof result.y === "number") {
|
|
4466
|
+
result.y = denormalize(result.y, displayHeight);
|
|
4467
|
+
}
|
|
4468
|
+
if (Array.isArray(result.path)) {
|
|
4469
|
+
result.path = result.path.map(function(point) {
|
|
4470
|
+
if (point && (typeof point === "undefined" ? "undefined" : _type_of(point)) === "object") {
|
|
4471
|
+
return _object_spread({}, point, typeof point.x === "number" ? {
|
|
4472
|
+
x: denormalize(point.x, displayWidth)
|
|
4473
|
+
} : {}, typeof point.y === "number" ? {
|
|
4474
|
+
y: denormalize(point.y, displayHeight)
|
|
4475
|
+
} : {});
|
|
4476
|
+
}
|
|
4477
|
+
return point;
|
|
4478
|
+
});
|
|
4479
|
+
}
|
|
4480
|
+
return result;
|
|
4481
|
+
};
|
|
4482
|
+
var COORD_FIELDS = [
|
|
4483
|
+
"x",
|
|
4484
|
+
"y",
|
|
4485
|
+
"text",
|
|
4486
|
+
"keys",
|
|
4487
|
+
"button",
|
|
4488
|
+
"direction",
|
|
4489
|
+
"scroll_x",
|
|
4490
|
+
"scroll_y",
|
|
4491
|
+
"path"
|
|
4492
|
+
];
|
|
4493
|
+
var normalizeStructure = function(parsed, shouldCleanArtifacts) {
|
|
4494
|
+
var clean = shouldCleanArtifacts ? function(action) {
|
|
4495
|
+
return applyArtifactCleanup(action);
|
|
4496
|
+
} : function(action) {
|
|
4497
|
+
return action;
|
|
4498
|
+
};
|
|
4499
|
+
if (parsed.action && _type_of(parsed.action) === "object") {
|
|
4500
|
+
return _object_spread_props(_object_spread({}, parsed), {
|
|
4501
|
+
action: clean(parsed.action)
|
|
4502
|
+
});
|
|
4503
|
+
}
|
|
4504
|
+
if (typeof parsed.action === "string") {
|
|
4505
|
+
var actionObj = {
|
|
4506
|
+
type: parsed.action
|
|
4507
|
+
};
|
|
4508
|
+
var rest = {};
|
|
4509
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4510
|
+
try {
|
|
4511
|
+
for(var _iterator = Object.entries(parsed)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4512
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
4513
|
+
if (key === "action") continue;
|
|
4514
|
+
if (COORD_FIELDS.includes(key)) {
|
|
4515
|
+
actionObj[key] = value;
|
|
4516
|
+
} else {
|
|
4517
|
+
rest[key] = value;
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
} catch (err) {
|
|
4521
|
+
_didIteratorError = true;
|
|
4522
|
+
_iteratorError = err;
|
|
4523
|
+
} finally{
|
|
4524
|
+
try {
|
|
4525
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4526
|
+
_iterator.return();
|
|
4527
|
+
}
|
|
4528
|
+
} finally{
|
|
4529
|
+
if (_didIteratorError) {
|
|
4530
|
+
throw _iteratorError;
|
|
4531
|
+
}
|
|
4532
|
+
}
|
|
4533
|
+
}
|
|
4534
|
+
return _object_spread_props(_object_spread({}, rest), {
|
|
4535
|
+
action: clean(actionObj)
|
|
4536
|
+
});
|
|
4537
|
+
}
|
|
4538
|
+
if (typeof parsed.type === "string") {
|
|
4539
|
+
var actionObj1 = {};
|
|
4540
|
+
var rest1 = {};
|
|
4541
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
4542
|
+
try {
|
|
4543
|
+
for(var _iterator1 = Object.entries(parsed)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
4544
|
+
var _step_value1 = _sliced_to_array(_step1.value, 2), key1 = _step_value1[0], value1 = _step_value1[1];
|
|
4545
|
+
if (key1 === "type" || COORD_FIELDS.includes(key1)) {
|
|
4546
|
+
actionObj1[key1] = value1;
|
|
4547
|
+
} else {
|
|
4548
|
+
rest1[key1] = value1;
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4551
|
+
} catch (err) {
|
|
4552
|
+
_didIteratorError1 = true;
|
|
4553
|
+
_iteratorError1 = err;
|
|
4554
|
+
} finally{
|
|
4555
|
+
try {
|
|
4556
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
4557
|
+
_iterator1.return();
|
|
4558
|
+
}
|
|
4559
|
+
} finally{
|
|
4560
|
+
if (_didIteratorError1) {
|
|
4561
|
+
throw _iteratorError1;
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
return _object_spread_props(_object_spread({}, rest1), {
|
|
4566
|
+
action: clean(actionObj1)
|
|
4567
|
+
});
|
|
4568
|
+
}
|
|
4569
|
+
return parsed;
|
|
4570
|
+
};
|
|
4571
|
+
var denormalizeComputerCallArguments = function(param) {
|
|
4572
|
+
var argumentsText = param.argumentsText, displayWidth = param.displayWidth, displayHeight = param.displayHeight, model = param.model;
|
|
4573
|
+
if ((typeof argumentsText === "undefined" ? "undefined" : _type_of(argumentsText)) === "object" && argumentsText !== null) {
|
|
4574
|
+
argumentsText = JSON.stringify(argumentsText);
|
|
4575
|
+
}
|
|
4576
|
+
var quirks = getQuirks(model);
|
|
4577
|
+
var text = argumentsText;
|
|
4578
|
+
if (quirks.cleanArtifacts) {
|
|
4579
|
+
text = cleanTextArtifacts(text);
|
|
4580
|
+
}
|
|
4581
|
+
var parsed = extractJson(text);
|
|
4582
|
+
if (!parsed && (quirks.cleanArtifacts || quirks.fuzzyFallback)) {
|
|
4583
|
+
parsed = fuzzyExtractJson(text);
|
|
4584
|
+
}
|
|
4585
|
+
if (!parsed || (typeof parsed === "undefined" ? "undefined" : _type_of(parsed)) !== "object") {
|
|
4586
|
+
return argumentsText;
|
|
4587
|
+
}
|
|
4588
|
+
var normalized = normalizeStructure(parsed, !!quirks.cleanArtifacts);
|
|
4589
|
+
if (quirks.normalizedCoords && normalized.action && _type_of(normalized.action) === "object") {
|
|
4590
|
+
return JSON.stringify(_object_spread_props(_object_spread({}, normalized), {
|
|
4591
|
+
action: denormalizeAction(normalized.action, displayWidth, displayHeight)
|
|
4592
|
+
}));
|
|
4593
|
+
}
|
|
4594
|
+
return JSON.stringify(normalized);
|
|
4595
|
+
};
|
|
4596
|
+
// src/adapters/client/openRouterClientAdapter/completions/computerUseTool.ts
|
|
4597
|
+
var buildComputerCallFunction = function(model, displayWidth, displayHeight) {
|
|
4598
|
+
var quirks = getQuirks(model);
|
|
4599
|
+
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, ").");
|
|
4600
|
+
var xDesc = quirks.normalizedCoords ? "X coordinate (0-1000 normalized)" : "X coordinate in pixels (0-".concat(displayWidth, ")");
|
|
4601
|
+
var yDesc = quirks.normalizedCoords ? "Y coordinate (0-1000 normalized)" : "Y coordinate in pixels (0-".concat(displayHeight, ")");
|
|
4602
|
+
return {
|
|
4603
|
+
name: "computer_call",
|
|
4604
|
+
description: "Perform a computer action. ".concat(coordDesc),
|
|
4605
|
+
parameters: {
|
|
4606
|
+
type: "object",
|
|
4607
|
+
properties: {
|
|
4608
|
+
action: {
|
|
4609
|
+
type: "object",
|
|
4610
|
+
description: "The action to perform",
|
|
4611
|
+
properties: {
|
|
4612
|
+
type: {
|
|
4613
|
+
type: "string",
|
|
4614
|
+
enum: [
|
|
4615
|
+
"screenshot",
|
|
4616
|
+
"click",
|
|
4617
|
+
"double_click",
|
|
4618
|
+
"type",
|
|
4619
|
+
"keypress",
|
|
4620
|
+
"scroll",
|
|
4621
|
+
"move",
|
|
4622
|
+
"drag",
|
|
4623
|
+
"wait"
|
|
4624
|
+
]
|
|
4625
|
+
},
|
|
4626
|
+
x: {
|
|
4627
|
+
type: "number",
|
|
4628
|
+
description: xDesc
|
|
4629
|
+
},
|
|
4630
|
+
y: {
|
|
4631
|
+
type: "number",
|
|
4632
|
+
description: yDesc
|
|
4633
|
+
},
|
|
4634
|
+
text: {
|
|
4635
|
+
type: "string",
|
|
4636
|
+
description: "Text to type"
|
|
4637
|
+
},
|
|
4638
|
+
keys: {
|
|
4639
|
+
type: "array",
|
|
4640
|
+
items: {
|
|
4641
|
+
type: "string"
|
|
4642
|
+
},
|
|
4643
|
+
description: "Keys to press"
|
|
4644
|
+
},
|
|
4645
|
+
button: {
|
|
4646
|
+
type: "string",
|
|
4647
|
+
enum: [
|
|
4648
|
+
"left",
|
|
4649
|
+
"right",
|
|
4650
|
+
"wheel"
|
|
4651
|
+
]
|
|
4652
|
+
},
|
|
4653
|
+
direction: {
|
|
4654
|
+
type: "string",
|
|
4655
|
+
enum: [
|
|
4656
|
+
"up",
|
|
4657
|
+
"down",
|
|
4658
|
+
"left",
|
|
4659
|
+
"right"
|
|
4660
|
+
]
|
|
4661
|
+
},
|
|
4662
|
+
scroll_x: {
|
|
4663
|
+
type: "number"
|
|
4664
|
+
},
|
|
4665
|
+
scroll_y: {
|
|
4666
|
+
type: "number"
|
|
4667
|
+
},
|
|
4668
|
+
path: {
|
|
4669
|
+
type: "array",
|
|
4670
|
+
items: {
|
|
4671
|
+
type: "object",
|
|
4672
|
+
properties: {
|
|
4673
|
+
x: {
|
|
4674
|
+
type: "number"
|
|
4675
|
+
},
|
|
4676
|
+
y: {
|
|
4677
|
+
type: "number"
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
},
|
|
4681
|
+
description: "Path for drag action"
|
|
4682
|
+
}
|
|
4683
|
+
},
|
|
4684
|
+
required: [
|
|
4685
|
+
"type"
|
|
4686
|
+
]
|
|
4687
|
+
},
|
|
4688
|
+
pending_safety_checks: {
|
|
4689
|
+
type: "array",
|
|
4690
|
+
items: {
|
|
4691
|
+
type: "object"
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
},
|
|
4695
|
+
required: [
|
|
4696
|
+
"action"
|
|
4697
|
+
]
|
|
4698
|
+
}
|
|
4699
|
+
};
|
|
4700
|
+
};
|
|
4701
|
+
var transformTools = function(tools, model) {
|
|
4702
|
+
if (!tools || tools.length === 0) {
|
|
4703
|
+
return {
|
|
4704
|
+
tools: tools !== null && tools !== void 0 ? tools : [],
|
|
4705
|
+
computerUseConfig: null
|
|
4706
|
+
};
|
|
4707
|
+
}
|
|
4708
|
+
var computerUseConfig = null;
|
|
4709
|
+
var transformed = tools.map(function(tool) {
|
|
4710
|
+
if (tool.type === "computer_use_preview") {
|
|
4711
|
+
var _tool_computer_use_preview, _ref, _config_display_width, _ref1, _config_display_height;
|
|
4712
|
+
var config = (_tool_computer_use_preview = tool.computer_use_preview) !== null && _tool_computer_use_preview !== void 0 ? _tool_computer_use_preview : tool;
|
|
4713
|
+
computerUseConfig = {
|
|
4714
|
+
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,
|
|
4715
|
+
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
|
|
4716
|
+
};
|
|
4717
|
+
return {
|
|
4718
|
+
type: "function",
|
|
4719
|
+
function: buildComputerCallFunction(model, computerUseConfig.displayWidth, computerUseConfig.displayHeight)
|
|
4720
|
+
};
|
|
4721
|
+
}
|
|
4722
|
+
return tool;
|
|
4723
|
+
});
|
|
4724
|
+
return {
|
|
4725
|
+
tools: transformed,
|
|
4726
|
+
computerUseConfig: computerUseConfig
|
|
4727
|
+
};
|
|
4728
|
+
};
|
|
4729
|
+
// src/adapters/client/openRouterClientAdapter/completions/post.ts
|
|
4730
|
+
var ARTIFACT_TAGS = /<\|begin_of_box\|>|<\|end_of_box\|>/g;
|
|
4731
|
+
var sanitizeContent = function(content) {
|
|
4732
|
+
if (!content) return content;
|
|
4733
|
+
return content.replace(ARTIFACT_TAGS, "").trim();
|
|
4734
|
+
};
|
|
4735
|
+
var post10 = function(param) {
|
|
4736
|
+
var openRouter = param.openRouter;
|
|
4737
|
+
return function(_url, options) {
|
|
4738
|
+
return _async_to_generator(function() {
|
|
4739
|
+
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;
|
|
4740
|
+
return _ts_generator(this, function(_state) {
|
|
4741
|
+
switch(_state.label){
|
|
4742
|
+
case 0:
|
|
4743
|
+
body = JSON.parse(options.body);
|
|
4744
|
+
model = body.model;
|
|
4745
|
+
_transformTools = transformTools(body.tools, model), transformedTools = _transformTools.tools, computerUseConfig = _transformTools.computerUseConfig;
|
|
4746
|
+
resultOptions = _object_spread({}, body, transformedTools.length > 0 ? {
|
|
4747
|
+
tools: transformedTools
|
|
4748
|
+
} : {});
|
|
4749
|
+
if (!body.stream) return [
|
|
4750
|
+
3,
|
|
4751
|
+
2
|
|
4752
|
+
];
|
|
4753
|
+
return [
|
|
4754
|
+
4,
|
|
4755
|
+
openRouter.chat.completions.create(resultOptions)
|
|
4756
|
+
];
|
|
4757
|
+
case 1:
|
|
4758
|
+
response = _state.sent();
|
|
4759
|
+
shouldCleanArtifacts = getQuirks(model).cleanArtifacts;
|
|
4760
|
+
if (!computerUseConfig) {
|
|
4761
|
+
stream2 = new ReadableStream({
|
|
4762
|
+
start: function start(controller) {
|
|
4763
|
+
return _async_to_generator(function() {
|
|
4764
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices_, _chunk_choices, delta, err;
|
|
4765
|
+
return _ts_generator(this, function(_state) {
|
|
4766
|
+
switch(_state.label){
|
|
4767
|
+
case 0:
|
|
4768
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
4769
|
+
_state.label = 1;
|
|
4770
|
+
case 1:
|
|
4771
|
+
_state.trys.push([
|
|
4772
|
+
1,
|
|
4773
|
+
6,
|
|
4774
|
+
7,
|
|
4775
|
+
12
|
|
4776
|
+
]);
|
|
4777
|
+
_iterator = _async_iterator(response);
|
|
4778
|
+
_state.label = 2;
|
|
4779
|
+
case 2:
|
|
4780
|
+
return [
|
|
4781
|
+
4,
|
|
4782
|
+
_iterator.next()
|
|
4783
|
+
];
|
|
4784
|
+
case 3:
|
|
4785
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
4786
|
+
3,
|
|
4787
|
+
5
|
|
4788
|
+
];
|
|
4789
|
+
_value = _step.value;
|
|
4790
|
+
chunk = _value;
|
|
4791
|
+
if (shouldCleanArtifacts) {
|
|
4792
|
+
;
|
|
4793
|
+
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;
|
|
4794
|
+
if (delta === null || delta === void 0 ? void 0 : delta.content) {
|
|
4795
|
+
delta.content = sanitizeContent(delta.content);
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4798
|
+
controller.enqueue("data: ".concat(JSON.stringify(chunk), "\n\n"));
|
|
4799
|
+
_state.label = 4;
|
|
4800
|
+
case 4:
|
|
4801
|
+
_iteratorAbruptCompletion = false;
|
|
4802
|
+
return [
|
|
4803
|
+
3,
|
|
4804
|
+
2
|
|
4805
|
+
];
|
|
4806
|
+
case 5:
|
|
4807
|
+
return [
|
|
4808
|
+
3,
|
|
4809
|
+
12
|
|
4810
|
+
];
|
|
4811
|
+
case 6:
|
|
4812
|
+
err = _state.sent();
|
|
4813
|
+
_didIteratorError = true;
|
|
4814
|
+
_iteratorError = err;
|
|
4815
|
+
return [
|
|
4816
|
+
3,
|
|
4817
|
+
12
|
|
4818
|
+
];
|
|
4819
|
+
case 7:
|
|
4820
|
+
_state.trys.push([
|
|
4821
|
+
7,
|
|
4822
|
+
,
|
|
4823
|
+
10,
|
|
4824
|
+
11
|
|
4825
|
+
]);
|
|
4826
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
4827
|
+
3,
|
|
4828
|
+
9
|
|
4829
|
+
];
|
|
4830
|
+
return [
|
|
4831
|
+
4,
|
|
4832
|
+
_iterator.return()
|
|
4833
|
+
];
|
|
4834
|
+
case 8:
|
|
4835
|
+
_state.sent();
|
|
4836
|
+
_state.label = 9;
|
|
4837
|
+
case 9:
|
|
4838
|
+
return [
|
|
4839
|
+
3,
|
|
4840
|
+
11
|
|
4841
|
+
];
|
|
4842
|
+
case 10:
|
|
4843
|
+
if (_didIteratorError) {
|
|
4844
|
+
throw _iteratorError;
|
|
4845
|
+
}
|
|
4846
|
+
return [
|
|
4847
|
+
7
|
|
4848
|
+
];
|
|
4849
|
+
case 11:
|
|
4850
|
+
return [
|
|
4851
|
+
7
|
|
4852
|
+
];
|
|
4853
|
+
case 12:
|
|
4854
|
+
controller.close();
|
|
4855
|
+
return [
|
|
4856
|
+
2
|
|
4857
|
+
];
|
|
4858
|
+
}
|
|
4859
|
+
});
|
|
4860
|
+
})();
|
|
4861
|
+
}
|
|
4862
|
+
});
|
|
4863
|
+
return [
|
|
4864
|
+
2,
|
|
4865
|
+
new Response(stream2, {
|
|
4866
|
+
headers: {
|
|
4867
|
+
"Content-Type": "text/event-stream"
|
|
4868
|
+
}
|
|
4869
|
+
})
|
|
4870
|
+
];
|
|
4871
|
+
}
|
|
4872
|
+
displayWidth = computerUseConfig.displayWidth, displayHeight = computerUseConfig.displayHeight;
|
|
4873
|
+
stream = new ReadableStream({
|
|
4874
|
+
start: function start(controller) {
|
|
4875
|
+
return _async_to_generator(function() {
|
|
4876
|
+
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, _argumentBuffers_get, _ref, _tc_function1, buf, denormalized, modifiedChunk, err1, _iteratorNormalCompletion1, _didIteratorError2, _iteratorError2, _iterator2, _step2, _step_value, index, buf1, denormalized1, flushChunk;
|
|
4022
4877
|
return _ts_generator(this, function(_state) {
|
|
4023
4878
|
switch(_state.label){
|
|
4024
4879
|
case 0:
|
|
4880
|
+
computerCallIndices = /* @__PURE__ */ new Set();
|
|
4881
|
+
argumentBuffers = /* @__PURE__ */ new Map();
|
|
4882
|
+
emittedIndices = /* @__PURE__ */ new Set();
|
|
4025
4883
|
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
4026
4884
|
_state.label = 1;
|
|
4027
4885
|
case 1:
|
|
@@ -4045,7 +4903,84 @@ var post9 = function(param) {
|
|
|
4045
4903
|
];
|
|
4046
4904
|
_value = _step.value;
|
|
4047
4905
|
chunk = _value;
|
|
4048
|
-
|
|
4906
|
+
choices = (_chunk_choices = chunk.choices) !== null && _chunk_choices !== void 0 ? _chunk_choices : [];
|
|
4907
|
+
choice = choices[0];
|
|
4908
|
+
if (!(choice === null || choice === void 0 ? void 0 : (_choice_delta = choice.delta) === null || _choice_delta === void 0 ? void 0 : _choice_delta.tool_calls)) {
|
|
4909
|
+
controller.enqueue("data: ".concat(JSON.stringify(chunk), "\n\n"));
|
|
4910
|
+
return [
|
|
4911
|
+
3,
|
|
4912
|
+
4
|
|
4913
|
+
];
|
|
4914
|
+
}
|
|
4915
|
+
passThrough = [];
|
|
4916
|
+
_iteratorNormalCompletion = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
4917
|
+
try {
|
|
4918
|
+
for(_iterator1 = choice.delta.tool_calls[Symbol.iterator](); !(_iteratorNormalCompletion = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion = true){
|
|
4919
|
+
tc = _step1.value;
|
|
4920
|
+
;
|
|
4921
|
+
if (((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) === "computer_call") {
|
|
4922
|
+
computerCallIndices.add(tc.index);
|
|
4923
|
+
argumentBuffers.set(tc.index, "");
|
|
4924
|
+
passThrough.push(_object_spread_props(_object_spread({}, tc), {
|
|
4925
|
+
function: _object_spread_props(_object_spread({}, tc.function), {
|
|
4926
|
+
arguments: ""
|
|
4927
|
+
})
|
|
4928
|
+
}));
|
|
4929
|
+
continue;
|
|
4930
|
+
}
|
|
4931
|
+
if (computerCallIndices.has(tc.index)) {
|
|
4932
|
+
;
|
|
4933
|
+
;
|
|
4934
|
+
buf = ((_argumentBuffers_get = argumentBuffers.get(tc.index)) !== null && _argumentBuffers_get !== void 0 ? _argumentBuffers_get : "") + ((_ref = (_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) !== null && _ref !== void 0 ? _ref : "");
|
|
4935
|
+
argumentBuffers.set(tc.index, buf);
|
|
4936
|
+
if (!emittedIndices.has(tc.index)) {
|
|
4937
|
+
try {
|
|
4938
|
+
JSON.parse(buf);
|
|
4939
|
+
denormalized = denormalizeComputerCallArguments({
|
|
4940
|
+
argumentsText: buf,
|
|
4941
|
+
displayWidth: displayWidth,
|
|
4942
|
+
displayHeight: displayHeight,
|
|
4943
|
+
model: model
|
|
4944
|
+
});
|
|
4945
|
+
passThrough.push({
|
|
4946
|
+
index: tc.index,
|
|
4947
|
+
function: {
|
|
4948
|
+
arguments: denormalized
|
|
4949
|
+
}
|
|
4950
|
+
});
|
|
4951
|
+
emittedIndices.add(tc.index);
|
|
4952
|
+
} catch (unused) {}
|
|
4953
|
+
}
|
|
4954
|
+
continue;
|
|
4955
|
+
}
|
|
4956
|
+
passThrough.push(tc);
|
|
4957
|
+
}
|
|
4958
|
+
} catch (err) {
|
|
4959
|
+
_didIteratorError1 = true;
|
|
4960
|
+
_iteratorError1 = err;
|
|
4961
|
+
} finally{
|
|
4962
|
+
try {
|
|
4963
|
+
if (!_iteratorNormalCompletion && _iterator1.return != null) {
|
|
4964
|
+
_iterator1.return();
|
|
4965
|
+
}
|
|
4966
|
+
} finally{
|
|
4967
|
+
if (_didIteratorError1) {
|
|
4968
|
+
throw _iteratorError1;
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
}
|
|
4972
|
+
if (passThrough.length > 0) {
|
|
4973
|
+
modifiedChunk = _object_spread_props(_object_spread({}, chunk), {
|
|
4974
|
+
choices: [
|
|
4975
|
+
_object_spread_props(_object_spread({}, choice), {
|
|
4976
|
+
delta: _object_spread_props(_object_spread({}, choice.delta), {
|
|
4977
|
+
tool_calls: passThrough
|
|
4978
|
+
})
|
|
4979
|
+
})
|
|
4980
|
+
]
|
|
4981
|
+
});
|
|
4982
|
+
controller.enqueue("data: ".concat(JSON.stringify(modifiedChunk), "\n\n"));
|
|
4983
|
+
}
|
|
4049
4984
|
_state.label = 4;
|
|
4050
4985
|
case 4:
|
|
4051
4986
|
_iteratorAbruptCompletion = false;
|
|
@@ -4059,9 +4994,9 @@ var post9 = function(param) {
|
|
|
4059
4994
|
12
|
|
4060
4995
|
];
|
|
4061
4996
|
case 6:
|
|
4062
|
-
|
|
4997
|
+
err1 = _state.sent();
|
|
4063
4998
|
_didIteratorError = true;
|
|
4064
|
-
_iteratorError =
|
|
4999
|
+
_iteratorError = err1;
|
|
4065
5000
|
return [
|
|
4066
5001
|
3,
|
|
4067
5002
|
12
|
|
@@ -4101,6 +5036,52 @@ var post9 = function(param) {
|
|
|
4101
5036
|
7
|
|
4102
5037
|
];
|
|
4103
5038
|
case 12:
|
|
5039
|
+
_iteratorNormalCompletion1 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
5040
|
+
try {
|
|
5041
|
+
for(_iterator2 = Array.from(argumentBuffers)[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion1 = true){
|
|
5042
|
+
_step_value = _sliced_to_array(_step2.value, 2), index = _step_value[0], buf1 = _step_value[1];
|
|
5043
|
+
if (!emittedIndices.has(index) && buf1) {
|
|
5044
|
+
denormalized1 = denormalizeComputerCallArguments({
|
|
5045
|
+
argumentsText: buf1,
|
|
5046
|
+
displayWidth: displayWidth,
|
|
5047
|
+
displayHeight: displayHeight,
|
|
5048
|
+
model: model
|
|
5049
|
+
});
|
|
5050
|
+
flushChunk = {
|
|
5051
|
+
object: "chat.completion.chunk",
|
|
5052
|
+
choices: [
|
|
5053
|
+
{
|
|
5054
|
+
index: 0,
|
|
5055
|
+
delta: {
|
|
5056
|
+
tool_calls: [
|
|
5057
|
+
{
|
|
5058
|
+
index: index,
|
|
5059
|
+
function: {
|
|
5060
|
+
arguments: denormalized1
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
]
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5066
|
+
]
|
|
5067
|
+
};
|
|
5068
|
+
controller.enqueue("data: ".concat(JSON.stringify(flushChunk), "\n\n"));
|
|
5069
|
+
}
|
|
5070
|
+
}
|
|
5071
|
+
} catch (err) {
|
|
5072
|
+
_didIteratorError2 = true;
|
|
5073
|
+
_iteratorError2 = err;
|
|
5074
|
+
} finally{
|
|
5075
|
+
try {
|
|
5076
|
+
if (!_iteratorNormalCompletion1 && _iterator2.return != null) {
|
|
5077
|
+
_iterator2.return();
|
|
5078
|
+
}
|
|
5079
|
+
} finally{
|
|
5080
|
+
if (_didIteratorError2) {
|
|
5081
|
+
throw _iteratorError2;
|
|
5082
|
+
}
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
4104
5085
|
controller.close();
|
|
4105
5086
|
return [
|
|
4106
5087
|
2
|
|
@@ -4127,15 +5108,91 @@ var post9 = function(param) {
|
|
|
4127
5108
|
]);
|
|
4128
5109
|
return [
|
|
4129
5110
|
4,
|
|
4130
|
-
|
|
5111
|
+
openRouter.chat.completions.create(resultOptions)
|
|
4131
5112
|
];
|
|
4132
5113
|
case 3:
|
|
4133
5114
|
data = _state.sent();
|
|
5115
|
+
if (computerUseConfig) {
|
|
5116
|
+
;
|
|
5117
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5118
|
+
try {
|
|
5119
|
+
for(_iterator = ((_data_choices = data.choices) !== null && _data_choices !== void 0 ? _data_choices : [])[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5120
|
+
choice = _step.value;
|
|
5121
|
+
;
|
|
5122
|
+
;
|
|
5123
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
5124
|
+
try {
|
|
5125
|
+
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){
|
|
5126
|
+
tc = _step1.value;
|
|
5127
|
+
fn = tc.function;
|
|
5128
|
+
if ((fn === null || fn === void 0 ? void 0 : fn.name) === "computer_call") {
|
|
5129
|
+
fn.arguments = denormalizeComputerCallArguments({
|
|
5130
|
+
argumentsText: fn.arguments,
|
|
5131
|
+
displayWidth: computerUseConfig.displayWidth,
|
|
5132
|
+
displayHeight: computerUseConfig.displayHeight,
|
|
5133
|
+
model: model
|
|
5134
|
+
});
|
|
5135
|
+
}
|
|
5136
|
+
}
|
|
5137
|
+
} catch (err) {
|
|
5138
|
+
_didIteratorError1 = true;
|
|
5139
|
+
_iteratorError1 = err;
|
|
5140
|
+
} finally{
|
|
5141
|
+
try {
|
|
5142
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
5143
|
+
_iterator1.return();
|
|
5144
|
+
}
|
|
5145
|
+
} finally{
|
|
5146
|
+
if (_didIteratorError1) {
|
|
5147
|
+
throw _iteratorError1;
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5152
|
+
} catch (err) {
|
|
5153
|
+
_didIteratorError = true;
|
|
5154
|
+
_iteratorError = err;
|
|
5155
|
+
} finally{
|
|
5156
|
+
try {
|
|
5157
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5158
|
+
_iterator.return();
|
|
5159
|
+
}
|
|
5160
|
+
} finally{
|
|
5161
|
+
if (_didIteratorError) {
|
|
5162
|
+
throw _iteratorError;
|
|
5163
|
+
}
|
|
5164
|
+
}
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5167
|
+
if (getQuirks(model).cleanArtifacts) {
|
|
5168
|
+
;
|
|
5169
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
5170
|
+
try {
|
|
5171
|
+
for(_iterator2 = ((_data_choices1 = data.choices) !== null && _data_choices1 !== void 0 ? _data_choices1 : [])[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
5172
|
+
choice1 = _step2.value;
|
|
5173
|
+
;
|
|
5174
|
+
if ((_choice_message1 = choice1.message) === null || _choice_message1 === void 0 ? void 0 : _choice_message1.content) {
|
|
5175
|
+
choice1.message.content = sanitizeContent(choice1.message.content);
|
|
5176
|
+
}
|
|
5177
|
+
}
|
|
5178
|
+
} catch (err) {
|
|
5179
|
+
_didIteratorError2 = true;
|
|
5180
|
+
_iteratorError2 = err;
|
|
5181
|
+
} finally{
|
|
5182
|
+
try {
|
|
5183
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
5184
|
+
_iterator2.return();
|
|
5185
|
+
}
|
|
5186
|
+
} finally{
|
|
5187
|
+
if (_didIteratorError2) {
|
|
5188
|
+
throw _iteratorError2;
|
|
5189
|
+
}
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
4134
5193
|
return [
|
|
4135
5194
|
2,
|
|
4136
|
-
new Response(JSON.stringify({
|
|
4137
|
-
data: data
|
|
4138
|
-
}), {
|
|
5195
|
+
new Response(JSON.stringify(data), {
|
|
4139
5196
|
status: 200,
|
|
4140
5197
|
headers: {
|
|
4141
5198
|
"Content-Type": "application/json"
|
|
@@ -4164,26 +5221,26 @@ var post9 = function(param) {
|
|
|
4164
5221
|
})();
|
|
4165
5222
|
};
|
|
4166
5223
|
};
|
|
4167
|
-
// src/adapters/client/
|
|
4168
|
-
var
|
|
4169
|
-
var
|
|
5224
|
+
// src/adapters/client/openRouterClientAdapter/completions/index.ts
|
|
5225
|
+
var completions10 = function(param) {
|
|
5226
|
+
var openRouter = param.openRouter;
|
|
4170
5227
|
return {
|
|
4171
|
-
post:
|
|
4172
|
-
|
|
5228
|
+
post: post10({
|
|
5229
|
+
openRouter: openRouter
|
|
4173
5230
|
})
|
|
4174
5231
|
};
|
|
4175
5232
|
};
|
|
4176
|
-
// src/adapters/client/
|
|
4177
|
-
var
|
|
4178
|
-
var
|
|
5233
|
+
// src/adapters/client/openRouterClientAdapter/index.ts
|
|
5234
|
+
var openRouterClientAdapter = function(param) {
|
|
5235
|
+
var openRouter = param.openRouter;
|
|
4179
5236
|
return {
|
|
4180
|
-
client:
|
|
5237
|
+
client: openRouter,
|
|
4181
5238
|
requestHandlers: {
|
|
4182
|
-
"^/v1/models$":
|
|
4183
|
-
|
|
5239
|
+
"^/v1/models$": models13({
|
|
5240
|
+
openRouter: openRouter
|
|
4184
5241
|
}),
|
|
4185
|
-
"^/(?:v1|/?openai)/chat/completions$":
|
|
4186
|
-
|
|
5242
|
+
"^/(?:v1|/?openai)/chat/completions$": completions10({
|
|
5243
|
+
openRouter: openRouter
|
|
4187
5244
|
})
|
|
4188
5245
|
}
|
|
4189
5246
|
};
|
|
@@ -4830,7 +5887,7 @@ var serializeThread = function(param) {
|
|
|
4830
5887
|
};
|
|
4831
5888
|
};
|
|
4832
5889
|
// src/adapters/storage/prismaStorageAdapter/threads/post.ts
|
|
4833
|
-
var
|
|
5890
|
+
var post11 = function(param) {
|
|
4834
5891
|
var prisma = param.prisma;
|
|
4835
5892
|
return function(_urlString, options) {
|
|
4836
5893
|
return _async_to_generator(function() {
|
|
@@ -4906,7 +5963,7 @@ var post10 = function(param) {
|
|
|
4906
5963
|
var threads = function(param) {
|
|
4907
5964
|
var prisma = param.prisma;
|
|
4908
5965
|
return {
|
|
4909
|
-
post:
|
|
5966
|
+
post: post11({
|
|
4910
5967
|
prisma: prisma
|
|
4911
5968
|
})
|
|
4912
5969
|
};
|
|
@@ -4966,7 +6023,7 @@ var messageContentBlocks = function(param) {
|
|
|
4966
6023
|
}
|
|
4967
6024
|
];
|
|
4968
6025
|
};
|
|
4969
|
-
var
|
|
6026
|
+
var post12 = function(param) {
|
|
4970
6027
|
var prisma = param.prisma;
|
|
4971
6028
|
return function(urlString, options) {
|
|
4972
6029
|
return _async_to_generator(function() {
|
|
@@ -5014,7 +6071,7 @@ var post11 = function(param) {
|
|
|
5014
6071
|
};
|
|
5015
6072
|
// src/adapters/storage/prismaStorageAdapter/threads/messages/get.ts
|
|
5016
6073
|
var import_radash10 = require("radash");
|
|
5017
|
-
var
|
|
6074
|
+
var get12 = function(param) {
|
|
5018
6075
|
var prisma = param.prisma;
|
|
5019
6076
|
return function(urlString) {
|
|
5020
6077
|
return _async_to_generator(function() {
|
|
@@ -5075,10 +6132,10 @@ var get11 = function(param) {
|
|
|
5075
6132
|
var messages2 = function(param) {
|
|
5076
6133
|
var prisma = param.prisma;
|
|
5077
6134
|
return {
|
|
5078
|
-
post:
|
|
6135
|
+
post: post12({
|
|
5079
6136
|
prisma: prisma
|
|
5080
6137
|
}),
|
|
5081
|
-
get:
|
|
6138
|
+
get: get12({
|
|
5082
6139
|
prisma: prisma
|
|
5083
6140
|
})
|
|
5084
6141
|
};
|
|
@@ -5149,7 +6206,7 @@ var mapPrismaRun = function(run4) {
|
|
|
5149
6206
|
};
|
|
5150
6207
|
};
|
|
5151
6208
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/get.ts
|
|
5152
|
-
var
|
|
6209
|
+
var get13 = function(param) {
|
|
5153
6210
|
var prisma = param.prisma;
|
|
5154
6211
|
return function(urlString) {
|
|
5155
6212
|
return _async_to_generator(function() {
|
|
@@ -5596,7 +6653,7 @@ var getMessages = function(param) {
|
|
|
5596
6653
|
};
|
|
5597
6654
|
};
|
|
5598
6655
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/post.ts
|
|
5599
|
-
var
|
|
6656
|
+
var post13 = function(param) {
|
|
5600
6657
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5601
6658
|
return function(urlString, options) {
|
|
5602
6659
|
return _async_to_generator(function() {
|
|
@@ -5770,17 +6827,17 @@ var post12 = function(param) {
|
|
|
5770
6827
|
var runs = function(param) {
|
|
5771
6828
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5772
6829
|
return {
|
|
5773
|
-
get:
|
|
6830
|
+
get: get13({
|
|
5774
6831
|
prisma: prisma
|
|
5775
6832
|
}),
|
|
5776
|
-
post:
|
|
6833
|
+
post: post13({
|
|
5777
6834
|
prisma: prisma,
|
|
5778
6835
|
runAdapter: runAdapter
|
|
5779
6836
|
})
|
|
5780
6837
|
};
|
|
5781
6838
|
};
|
|
5782
6839
|
// src/adapters/storage/prismaStorageAdapter/threads/run/get.ts
|
|
5783
|
-
var
|
|
6840
|
+
var get14 = function(param) {
|
|
5784
6841
|
var prisma = param.prisma;
|
|
5785
6842
|
return function(urlString) {
|
|
5786
6843
|
return _async_to_generator(function() {
|
|
@@ -5835,14 +6892,14 @@ var get13 = function(param) {
|
|
|
5835
6892
|
var run = function(param) {
|
|
5836
6893
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5837
6894
|
return {
|
|
5838
|
-
get:
|
|
6895
|
+
get: get14({
|
|
5839
6896
|
prisma: prisma
|
|
5840
6897
|
})
|
|
5841
6898
|
};
|
|
5842
6899
|
};
|
|
5843
6900
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/steps/get.ts
|
|
5844
6901
|
var import_radash13 = require("radash");
|
|
5845
|
-
var
|
|
6902
|
+
var get15 = function(param) {
|
|
5846
6903
|
var prisma = param.prisma;
|
|
5847
6904
|
return function(urlString) {
|
|
5848
6905
|
return _async_to_generator(function() {
|
|
@@ -5904,7 +6961,7 @@ var get14 = function(param) {
|
|
|
5904
6961
|
var steps = function(param) {
|
|
5905
6962
|
var prisma = param.prisma;
|
|
5906
6963
|
return {
|
|
5907
|
-
get:
|
|
6964
|
+
get: get15({
|
|
5908
6965
|
prisma: prisma
|
|
5909
6966
|
})
|
|
5910
6967
|
};
|
|
@@ -6072,7 +7129,7 @@ var updateRun = function(param) {
|
|
|
6072
7129
|
})();
|
|
6073
7130
|
};
|
|
6074
7131
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
6075
|
-
var
|
|
7132
|
+
var post14 = function(param) {
|
|
6076
7133
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
6077
7134
|
return function(urlString, options) {
|
|
6078
7135
|
return _async_to_generator(function() {
|
|
@@ -6240,7 +7297,7 @@ var post13 = function(param) {
|
|
|
6240
7297
|
var submitToolOutputs = function(param) {
|
|
6241
7298
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
6242
7299
|
return {
|
|
6243
|
-
post:
|
|
7300
|
+
post: post14({
|
|
6244
7301
|
prisma: prisma,
|
|
6245
7302
|
// @ts-ignore-next-line
|
|
6246
7303
|
runAdapter: runAdapter
|
|
@@ -6249,7 +7306,7 @@ var submitToolOutputs = function(param) {
|
|
|
6249
7306
|
};
|
|
6250
7307
|
// src/adapters/storage/prismaStorageAdapter/assistants/post.ts
|
|
6251
7308
|
var import_dayjs9 = __toESM(require("dayjs"), 1);
|
|
6252
|
-
var
|
|
7309
|
+
var post15 = function(param) {
|
|
6253
7310
|
var prisma = param.prisma;
|
|
6254
7311
|
return function(_url, options) {
|
|
6255
7312
|
return _async_to_generator(function() {
|
|
@@ -6302,7 +7359,7 @@ var post14 = function(param) {
|
|
|
6302
7359
|
var assistants = function(param) {
|
|
6303
7360
|
var prisma = param.prisma;
|
|
6304
7361
|
return {
|
|
6305
|
-
post:
|
|
7362
|
+
post: post15({
|
|
6306
7363
|
prisma: prisma
|
|
6307
7364
|
})
|
|
6308
7365
|
};
|
|
@@ -6351,7 +7408,7 @@ var serializeThread2 = function(param) {
|
|
|
6351
7408
|
};
|
|
6352
7409
|
};
|
|
6353
7410
|
// src/adapters/storage/responsesStorageAdapter/threads/post.ts
|
|
6354
|
-
var
|
|
7411
|
+
var post16 = function(param) {
|
|
6355
7412
|
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6356
7413
|
return function(_urlString, options) {
|
|
6357
7414
|
return _async_to_generator(function() {
|
|
@@ -6472,7 +7529,7 @@ var post15 = function(param) {
|
|
|
6472
7529
|
var threads2 = function(param) {
|
|
6473
7530
|
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6474
7531
|
return {
|
|
6475
|
-
post:
|
|
7532
|
+
post: post16({
|
|
6476
7533
|
client: client,
|
|
6477
7534
|
addAnnotations: addAnnotations
|
|
6478
7535
|
})
|
|
@@ -6650,7 +7707,7 @@ var messageContentBlocks2 = function(param) {
|
|
|
6650
7707
|
attachments: attachments
|
|
6651
7708
|
})));
|
|
6652
7709
|
};
|
|
6653
|
-
var
|
|
7710
|
+
var post17 = function(param) {
|
|
6654
7711
|
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6655
7712
|
return function(urlString, options) {
|
|
6656
7713
|
return _async_to_generator(function() {
|
|
@@ -6743,7 +7800,7 @@ function responseId(param) {
|
|
|
6743
7800
|
return null;
|
|
6744
7801
|
}
|
|
6745
7802
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/get.ts
|
|
6746
|
-
var
|
|
7803
|
+
var get16 = function(param) {
|
|
6747
7804
|
var client = param.client, runAdapter = param.runAdapter;
|
|
6748
7805
|
return function(urlString) {
|
|
6749
7806
|
return _async_to_generator(function() {
|
|
@@ -6955,19 +8012,19 @@ var assignTimestamps = function(param) {
|
|
|
6955
8012
|
var messages3 = function(param) {
|
|
6956
8013
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6957
8014
|
return {
|
|
6958
|
-
post:
|
|
8015
|
+
post: post17({
|
|
6959
8016
|
runAdapter: runAdapter,
|
|
6960
8017
|
createResponseItems: createResponseItems,
|
|
6961
8018
|
addAnnotations: addAnnotations
|
|
6962
8019
|
}),
|
|
6963
|
-
get:
|
|
8020
|
+
get: get16({
|
|
6964
8021
|
client: client,
|
|
6965
8022
|
runAdapter: runAdapter
|
|
6966
8023
|
})
|
|
6967
8024
|
};
|
|
6968
8025
|
};
|
|
6969
8026
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/get.ts
|
|
6970
|
-
var
|
|
8027
|
+
var get17 = function() {
|
|
6971
8028
|
return function(urlString) {
|
|
6972
8029
|
return _async_to_generator(function() {
|
|
6973
8030
|
return _ts_generator(this, function(_state) {
|
|
@@ -7468,7 +8525,7 @@ var defaultAssistant = {
|
|
|
7468
8525
|
}
|
|
7469
8526
|
};
|
|
7470
8527
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/post.ts
|
|
7471
|
-
var
|
|
8528
|
+
var post18 = function(param) {
|
|
7472
8529
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
7473
8530
|
return function(urlString, options) {
|
|
7474
8531
|
return _async_to_generator(function() {
|
|
@@ -7647,8 +8704,8 @@ var post17 = function(param) {
|
|
|
7647
8704
|
var runs2 = function(param) {
|
|
7648
8705
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
7649
8706
|
return {
|
|
7650
|
-
get:
|
|
7651
|
-
post:
|
|
8707
|
+
get: get17(),
|
|
8708
|
+
post: post18({
|
|
7652
8709
|
client: client,
|
|
7653
8710
|
createResponseItems: createResponseItems,
|
|
7654
8711
|
runAdapter: runAdapter
|
|
@@ -7656,7 +8713,7 @@ var runs2 = function(param) {
|
|
|
7656
8713
|
};
|
|
7657
8714
|
};
|
|
7658
8715
|
// src/adapters/storage/responsesStorageAdapter/threads/run/get.ts
|
|
7659
|
-
var
|
|
8716
|
+
var get18 = function(param) {
|
|
7660
8717
|
var client = param.client, runAdapter = param.runAdapter;
|
|
7661
8718
|
return function(urlString) {
|
|
7662
8719
|
return _async_to_generator(function() {
|
|
@@ -7706,7 +8763,7 @@ var get17 = function(param) {
|
|
|
7706
8763
|
var run2 = function(param) {
|
|
7707
8764
|
var client = param.client, runAdapter = param.runAdapter;
|
|
7708
8765
|
return {
|
|
7709
|
-
get:
|
|
8766
|
+
get: get18({
|
|
7710
8767
|
client: client,
|
|
7711
8768
|
runAdapter: runAdapter
|
|
7712
8769
|
})
|
|
@@ -8227,7 +9284,7 @@ var serializeItemAsReasoningRunStep = function(param) {
|
|
|
8227
9284
|
};
|
|
8228
9285
|
};
|
|
8229
9286
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
|
|
8230
|
-
var
|
|
9287
|
+
var get19 = function(param) {
|
|
8231
9288
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8232
9289
|
return function(urlString) {
|
|
8233
9290
|
return _async_to_generator(function() {
|
|
@@ -8396,7 +9453,7 @@ var get18 = function(param) {
|
|
|
8396
9453
|
var steps2 = function(param) {
|
|
8397
9454
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8398
9455
|
return {
|
|
8399
|
-
get:
|
|
9456
|
+
get: get19({
|
|
8400
9457
|
client: client,
|
|
8401
9458
|
runAdapter: runAdapter
|
|
8402
9459
|
})
|
|
@@ -8478,7 +9535,7 @@ var truncation2 = function(param) {
|
|
|
8478
9535
|
return "auto";
|
|
8479
9536
|
};
|
|
8480
9537
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
8481
|
-
var
|
|
9538
|
+
var post19 = function(param) {
|
|
8482
9539
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8483
9540
|
return function(urlString, options) {
|
|
8484
9541
|
return _async_to_generator(function() {
|
|
@@ -8615,14 +9672,14 @@ var post18 = function(param) {
|
|
|
8615
9672
|
var submitToolOutputs2 = function(param) {
|
|
8616
9673
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8617
9674
|
return {
|
|
8618
|
-
post:
|
|
9675
|
+
post: post19({
|
|
8619
9676
|
client: client,
|
|
8620
9677
|
runAdapter: runAdapter
|
|
8621
9678
|
})
|
|
8622
9679
|
};
|
|
8623
9680
|
};
|
|
8624
9681
|
// src/adapters/storage/responsesStorageAdapter/assistants/get.ts
|
|
8625
|
-
var
|
|
9682
|
+
var get20 = function(param) {
|
|
8626
9683
|
var runAdapter = param.runAdapter;
|
|
8627
9684
|
return function(_urlString) {
|
|
8628
9685
|
return _async_to_generator(function() {
|
|
@@ -8671,7 +9728,7 @@ var get19 = function(param) {
|
|
|
8671
9728
|
};
|
|
8672
9729
|
};
|
|
8673
9730
|
// src/adapters/storage/responsesStorageAdapter/assistants/post.ts
|
|
8674
|
-
var
|
|
9731
|
+
var post20 = function() {
|
|
8675
9732
|
return function() {
|
|
8676
9733
|
return _async_to_generator(function() {
|
|
8677
9734
|
return _ts_generator(this, function(_state) {
|
|
@@ -8697,10 +9754,10 @@ var post19 = function() {
|
|
|
8697
9754
|
var assistants2 = function(param) {
|
|
8698
9755
|
var runAdapter = param.runAdapter;
|
|
8699
9756
|
return {
|
|
8700
|
-
get:
|
|
9757
|
+
get: get20({
|
|
8701
9758
|
runAdapter: runAdapter
|
|
8702
9759
|
}),
|
|
8703
|
-
post:
|
|
9760
|
+
post: post20()
|
|
8704
9761
|
};
|
|
8705
9762
|
};
|
|
8706
9763
|
// src/adapters/storage/responsesStorageAdapter/index.ts
|
|
@@ -8744,7 +9801,7 @@ var responseRegexp = "^/(?:v1|/?openai)/responses/([^/]+)$";
|
|
|
8744
9801
|
var import_radash23 = require("radash");
|
|
8745
9802
|
var import_dayjs21 = __toESM(require("dayjs"), 1);
|
|
8746
9803
|
var import_radash24 = require("radash");
|
|
8747
|
-
var
|
|
9804
|
+
var post21 = function(param) {
|
|
8748
9805
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
8749
9806
|
return function(urlString, options) {
|
|
8750
9807
|
return _async_to_generator(function() {
|
|
@@ -8935,8 +9992,8 @@ var post20 = function(param) {
|
|
|
8935
9992
|
var runs3 = function(param) {
|
|
8936
9993
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
8937
9994
|
return {
|
|
8938
|
-
get:
|
|
8939
|
-
post:
|
|
9995
|
+
get: get17(),
|
|
9996
|
+
post: post21({
|
|
8940
9997
|
client: client,
|
|
8941
9998
|
createResponseItems: createResponseItems,
|
|
8942
9999
|
runAdapter: runAdapter
|
|
@@ -8944,7 +10001,7 @@ var runs3 = function(param) {
|
|
|
8944
10001
|
};
|
|
8945
10002
|
};
|
|
8946
10003
|
// src/adapters/storage/azureResponsesStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
8947
|
-
var
|
|
10004
|
+
var post22 = function(param) {
|
|
8948
10005
|
var client = param.client, runAdapter = param.runAdapter;
|
|
8949
10006
|
return function(urlString, options) {
|
|
8950
10007
|
return _async_to_generator(function() {
|
|
@@ -9090,14 +10147,14 @@ var post21 = function(param) {
|
|
|
9090
10147
|
var submitToolOutputs3 = function(param) {
|
|
9091
10148
|
var client = param.client, runAdapter = param.runAdapter;
|
|
9092
10149
|
return {
|
|
9093
|
-
post:
|
|
10150
|
+
post: post22({
|
|
9094
10151
|
client: client,
|
|
9095
10152
|
runAdapter: runAdapter
|
|
9096
10153
|
})
|
|
9097
10154
|
};
|
|
9098
10155
|
};
|
|
9099
10156
|
// src/adapters/storage/azureResponsesStorageAdapter/responses/get.ts
|
|
9100
|
-
var
|
|
10157
|
+
var get21 = function(param) {
|
|
9101
10158
|
var client = param.client;
|
|
9102
10159
|
return function(urlString) {
|
|
9103
10160
|
return _async_to_generator(function() {
|
|
@@ -9131,7 +10188,7 @@ var get20 = function(param) {
|
|
|
9131
10188
|
var responses = function(param) {
|
|
9132
10189
|
var client = param.client;
|
|
9133
10190
|
return {
|
|
9134
|
-
get:
|
|
10191
|
+
get: get21({
|
|
9135
10192
|
client: client
|
|
9136
10193
|
})
|
|
9137
10194
|
};
|
|
@@ -9150,26 +10207,22 @@ var azureResponsesStorageAdapter = function() {
|
|
|
9150
10207
|
};
|
|
9151
10208
|
var getAzureClient = function() {
|
|
9152
10209
|
return _async_to_generator(function() {
|
|
9153
|
-
var _aiProjectClient__options, aiProjectClient, apiVersion,
|
|
10210
|
+
var _aiProjectClient__options, aiProjectClient, apiVersion, azureClient, azureClient1;
|
|
9154
10211
|
return _ts_generator(this, function(_state) {
|
|
9155
10212
|
switch(_state.label){
|
|
9156
10213
|
case 0:
|
|
9157
|
-
console.log("[azureResponsesStorageAdapter] getAzureClient called");
|
|
9158
10214
|
if (cachedClient) {
|
|
9159
|
-
console.log("[azureResponsesStorageAdapter] Returning cached Azure client");
|
|
9160
10215
|
return [
|
|
9161
10216
|
2,
|
|
9162
10217
|
cachedClient
|
|
9163
10218
|
];
|
|
9164
10219
|
}
|
|
9165
10220
|
aiProjectClient = getAIProjectClient();
|
|
9166
|
-
console.log("[azureResponsesStorageAdapter] aiProjectClient obtained");
|
|
9167
10221
|
apiVersion = (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" ? (_aiProjectClient__options = aiProjectClient._options) === null || _aiProjectClient__options === void 0 ? void 0 : _aiProjectClient__options.apiVersion : void 0;
|
|
9168
10222
|
if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getAzureOpenAIClient" in aiProjectClient && typeof aiProjectClient.getAzureOpenAIClient === "function")) return [
|
|
9169
10223
|
3,
|
|
9170
10224
|
2
|
|
9171
10225
|
];
|
|
9172
|
-
console.log("[azureResponsesStorageAdapter] Calling getAzureOpenAIClient()");
|
|
9173
10226
|
return [
|
|
9174
10227
|
4,
|
|
9175
10228
|
aiProjectClient.getAzureOpenAIClient(apiVersion ? {
|
|
@@ -9178,9 +10231,6 @@ var azureResponsesStorageAdapter = function() {
|
|
|
9178
10231
|
];
|
|
9179
10232
|
case 1:
|
|
9180
10233
|
azureClient = _state.sent();
|
|
9181
|
-
console.log("[azureResponsesStorageAdapter] Azure OpenAI client obtained");
|
|
9182
|
-
console.log("[azureResponsesStorageAdapter] Azure client baseURL:", azureClient.baseURL);
|
|
9183
|
-
console.log("[azureResponsesStorageAdapter] Azure client apiKey:", ((_azureClient_apiKey = azureClient.apiKey) === null || _azureClient_apiKey === void 0 ? void 0 : _azureClient_apiKey.substring(0, 20)) + "...");
|
|
9184
10234
|
cachedClient = azureClient;
|
|
9185
10235
|
return [
|
|
9186
10236
|
2,
|
|
@@ -9191,7 +10241,6 @@ var azureResponsesStorageAdapter = function() {
|
|
|
9191
10241
|
3,
|
|
9192
10242
|
4
|
|
9193
10243
|
];
|
|
9194
|
-
console.log("[azureResponsesStorageAdapter] Calling getOpenAIClient()");
|
|
9195
10244
|
return [
|
|
9196
10245
|
4,
|
|
9197
10246
|
aiProjectClient.getOpenAIClient(apiVersion ? {
|
|
@@ -9200,16 +10249,12 @@ var azureResponsesStorageAdapter = function() {
|
|
|
9200
10249
|
];
|
|
9201
10250
|
case 3:
|
|
9202
10251
|
azureClient1 = _state.sent();
|
|
9203
|
-
console.log("[azureResponsesStorageAdapter] Azure OpenAI client obtained");
|
|
9204
|
-
console.log("[azureResponsesStorageAdapter] Azure client baseURL:", azureClient1.baseURL);
|
|
9205
|
-
console.log("[azureResponsesStorageAdapter] Azure client apiKey:", ((_azureClient_apiKey1 = azureClient1.apiKey) === null || _azureClient_apiKey1 === void 0 ? void 0 : _azureClient_apiKey1.substring(0, 20)) + "...");
|
|
9206
10252
|
cachedClient = azureClient1;
|
|
9207
10253
|
return [
|
|
9208
10254
|
2,
|
|
9209
10255
|
azureClient1
|
|
9210
10256
|
];
|
|
9211
10257
|
case 4:
|
|
9212
|
-
console.log("[azureResponsesStorageAdapter] Not an AIProjectClient, treating as OpenAI client");
|
|
9213
10258
|
cachedClient = aiProjectClient;
|
|
9214
10259
|
return [
|
|
9215
10260
|
2,
|
|
@@ -9284,7 +10329,6 @@ var azureResponsesStorageAdapter = function() {
|
|
|
9284
10329
|
return _ts_generator(this, function(_state) {
|
|
9285
10330
|
switch(_state.label){
|
|
9286
10331
|
case 0:
|
|
9287
|
-
console.log("[azureResponsesStorageAdapter] Handler called for:", urlString);
|
|
9288
10332
|
return [
|
|
9289
10333
|
4,
|
|
9290
10334
|
getAzureClient()
|
|
@@ -9355,7 +10399,7 @@ var azureResponsesStorageAdapter = function() {
|
|
|
9355
10399
|
};
|
|
9356
10400
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/post.ts
|
|
9357
10401
|
var import_dayjs22 = __toESM(require("dayjs"), 1);
|
|
9358
|
-
var
|
|
10402
|
+
var post23 = function(param) {
|
|
9359
10403
|
var azureAiProject = param.azureAiProject;
|
|
9360
10404
|
return function(_urlString, options) {
|
|
9361
10405
|
return _async_to_generator(function() {
|
|
@@ -9401,14 +10445,14 @@ var post22 = function(param) {
|
|
|
9401
10445
|
var threads3 = function(param) {
|
|
9402
10446
|
var azureAiProject = param.azureAiProject;
|
|
9403
10447
|
return {
|
|
9404
|
-
post:
|
|
10448
|
+
post: post23({
|
|
9405
10449
|
azureAiProject: azureAiProject
|
|
9406
10450
|
})
|
|
9407
10451
|
};
|
|
9408
10452
|
};
|
|
9409
10453
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/messages/post.ts
|
|
9410
10454
|
var import_dayjs23 = __toESM(require("dayjs"), 1);
|
|
9411
|
-
var
|
|
10455
|
+
var post24 = function(param) {
|
|
9412
10456
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9413
10457
|
return function(urlString, options) {
|
|
9414
10458
|
return _async_to_generator(function() {
|
|
@@ -9522,7 +10566,7 @@ var post23 = function(param) {
|
|
|
9522
10566
|
};
|
|
9523
10567
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/messages/get.ts
|
|
9524
10568
|
var import_dayjs24 = __toESM(require("dayjs"), 1);
|
|
9525
|
-
var
|
|
10569
|
+
var get22 = function(param) {
|
|
9526
10570
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9527
10571
|
return function(urlString) {
|
|
9528
10572
|
return _async_to_generator(function() {
|
|
@@ -9710,18 +10754,18 @@ var get21 = function(param) {
|
|
|
9710
10754
|
var messages4 = function(param) {
|
|
9711
10755
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9712
10756
|
return {
|
|
9713
|
-
post:
|
|
10757
|
+
post: post24({
|
|
9714
10758
|
azureAiProject: azureAiProject,
|
|
9715
10759
|
runAdapter: runAdapter
|
|
9716
10760
|
}),
|
|
9717
|
-
get:
|
|
10761
|
+
get: get22({
|
|
9718
10762
|
azureAiProject: azureAiProject,
|
|
9719
10763
|
runAdapter: runAdapter
|
|
9720
10764
|
})
|
|
9721
10765
|
};
|
|
9722
10766
|
};
|
|
9723
10767
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/get.ts
|
|
9724
|
-
var
|
|
10768
|
+
var get23 = function() {
|
|
9725
10769
|
return function() {
|
|
9726
10770
|
return _async_to_generator(function() {
|
|
9727
10771
|
var response;
|
|
@@ -9748,7 +10792,7 @@ var get22 = function() {
|
|
|
9748
10792
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/post.ts
|
|
9749
10793
|
var import_radash25 = require("radash");
|
|
9750
10794
|
var import_dayjs25 = __toESM(require("dayjs"), 1);
|
|
9751
|
-
var
|
|
10795
|
+
var post25 = function(param) {
|
|
9752
10796
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9753
10797
|
return function(urlString, options) {
|
|
9754
10798
|
return _async_to_generator(function() {
|
|
@@ -10017,8 +11061,8 @@ var post24 = function(param) {
|
|
|
10017
11061
|
var runs4 = function(param) {
|
|
10018
11062
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
10019
11063
|
return {
|
|
10020
|
-
get:
|
|
10021
|
-
post:
|
|
11064
|
+
get: get23(),
|
|
11065
|
+
post: post25({
|
|
10022
11066
|
azureAiProject: azureAiProject,
|
|
10023
11067
|
runAdapter: runAdapter
|
|
10024
11068
|
})
|
|
@@ -10026,7 +11070,7 @@ var runs4 = function(param) {
|
|
|
10026
11070
|
};
|
|
10027
11071
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/run/get.ts
|
|
10028
11072
|
var import_dayjs26 = __toESM(require("dayjs"), 1);
|
|
10029
|
-
var
|
|
11073
|
+
var get24 = function(param) {
|
|
10030
11074
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
10031
11075
|
return function(urlString) {
|
|
10032
11076
|
return _async_to_generator(function() {
|
|
@@ -10110,7 +11154,7 @@ var get23 = function(param) {
|
|
|
10110
11154
|
var run3 = function(param) {
|
|
10111
11155
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
10112
11156
|
return {
|
|
10113
|
-
get:
|
|
11157
|
+
get: get24({
|
|
10114
11158
|
azureAiProject: azureAiProject,
|
|
10115
11159
|
runAdapter: runAdapter
|
|
10116
11160
|
})
|
|
@@ -10118,7 +11162,7 @@ var run3 = function(param) {
|
|
|
10118
11162
|
};
|
|
10119
11163
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
|
|
10120
11164
|
var import_dayjs27 = __toESM(require("dayjs"), 1);
|
|
10121
|
-
var
|
|
11165
|
+
var get25 = function(param) {
|
|
10122
11166
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10123
11167
|
return function(urlString) {
|
|
10124
11168
|
return _async_to_generator(function() {
|
|
@@ -10329,7 +11373,7 @@ var get24 = function(param) {
|
|
|
10329
11373
|
var steps3 = function(param) {
|
|
10330
11374
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10331
11375
|
return {
|
|
10332
|
-
get:
|
|
11376
|
+
get: get25({
|
|
10333
11377
|
azureAiProject: azureAiProject,
|
|
10334
11378
|
runAdapter: runAdapter,
|
|
10335
11379
|
prisma: prisma
|
|
@@ -10657,7 +11701,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
|
|
|
10657
11701
|
}
|
|
10658
11702
|
return null;
|
|
10659
11703
|
}
|
|
10660
|
-
var
|
|
11704
|
+
var post26 = function(param) {
|
|
10661
11705
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10662
11706
|
return function(urlString, options) {
|
|
10663
11707
|
return _async_to_generator(function() {
|
|
@@ -10970,7 +12014,7 @@ var post25 = function(param) {
|
|
|
10970
12014
|
var submitToolOutputs4 = function(param) {
|
|
10971
12015
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10972
12016
|
return {
|
|
10973
|
-
post:
|
|
12017
|
+
post: post26({
|
|
10974
12018
|
azureAiProject: azureAiProject,
|
|
10975
12019
|
runAdapter: runAdapter,
|
|
10976
12020
|
prisma: prisma
|
|
@@ -10978,7 +12022,7 @@ var submitToolOutputs4 = function(param) {
|
|
|
10978
12022
|
};
|
|
10979
12023
|
};
|
|
10980
12024
|
// src/adapters/storage/azureAgentsStorageAdapter/assistants/post.ts
|
|
10981
|
-
var
|
|
12025
|
+
var post27 = function(param) {
|
|
10982
12026
|
var runAdapter = param.runAdapter;
|
|
10983
12027
|
return function(_urlString, options) {
|
|
10984
12028
|
return _async_to_generator(function() {
|
|
@@ -11020,7 +12064,7 @@ var post26 = function(param) {
|
|
|
11020
12064
|
var assistants3 = function(param) {
|
|
11021
12065
|
var runAdapter = param.runAdapter;
|
|
11022
12066
|
return {
|
|
11023
|
-
post:
|
|
12067
|
+
post: post27({
|
|
11024
12068
|
runAdapter: runAdapter
|
|
11025
12069
|
})
|
|
11026
12070
|
};
|
|
@@ -13951,6 +14995,7 @@ var azureAgentsRunAdapter = function(param) {
|
|
|
13951
14995
|
humirisClientAdapter: humirisClientAdapter,
|
|
13952
14996
|
mistralClientAdapter: mistralClientAdapter,
|
|
13953
14997
|
ollamaClientAdapter: ollamaClientAdapter,
|
|
14998
|
+
openRouterClientAdapter: openRouterClientAdapter,
|
|
13954
14999
|
openaiClientAdapter: openaiClientAdapter,
|
|
13955
15000
|
perplexityClientAdapter: perplexityClientAdapter,
|
|
13956
15001
|
prismaStorageAdapter: prismaStorageAdapter,
|