supercompat 3.9.5 → 3.10.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 +1246 -578
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1195 -527
- package/dist/index.js.map +1 -1
- package/dist/supercompat.cjs +46 -52
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js +46 -52
- package/dist/supercompat.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -211,7 +211,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
211
211
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
212
212
|
}
|
|
213
213
|
function _ts_generator(thisArg, body) {
|
|
214
|
-
var f, y, t,
|
|
214
|
+
var f, y, t, _ = {
|
|
215
215
|
label: 0,
|
|
216
216
|
sent: function() {
|
|
217
217
|
if (t[0] & 1) throw t[1];
|
|
@@ -219,12 +219,8 @@ function _ts_generator(thisArg, body) {
|
|
|
219
219
|
},
|
|
220
220
|
trys: [],
|
|
221
221
|
ops: []
|
|
222
|
-
};
|
|
223
|
-
return g = {
|
|
224
|
-
next: verb(0),
|
|
225
|
-
"throw": verb(1),
|
|
226
|
-
"return": verb(2)
|
|
227
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
222
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
223
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
228
224
|
return this;
|
|
229
225
|
}), g;
|
|
230
226
|
function verb(n) {
|
|
@@ -237,7 +233,7 @@ function _ts_generator(thisArg, body) {
|
|
|
237
233
|
}
|
|
238
234
|
function step(op) {
|
|
239
235
|
if (f) throw new TypeError("Generator is already executing.");
|
|
240
|
-
while(_)try {
|
|
236
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
241
237
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
242
238
|
if (y = 0, t) op = [
|
|
243
239
|
op[0] & 2,
|
|
@@ -359,13 +355,13 @@ var findRequestHandler = function(param) {
|
|
|
359
355
|
}
|
|
360
356
|
};
|
|
361
357
|
// src/supercompatFetch/originalFetch.ts
|
|
362
|
-
var originalFetch =
|
|
363
|
-
var
|
|
364
|
-
|
|
358
|
+
var originalFetch = function(param) {
|
|
359
|
+
var args = param.args, client = param.client;
|
|
360
|
+
return _async_to_generator(function() {
|
|
361
|
+
var _client_client, _args, url, options, clientHeaders, newOptions;
|
|
365
362
|
return _ts_generator(this, function(_state) {
|
|
366
363
|
switch(_state.label){
|
|
367
364
|
case 0:
|
|
368
|
-
args = param.args, client = param.client;
|
|
369
365
|
if (!((_client_client = client.client) === null || _client_client === void 0 ? void 0 : _client_client.fetch)) return [
|
|
370
366
|
3,
|
|
371
367
|
2
|
|
@@ -401,11 +397,8 @@ var originalFetch = /*#__PURE__*/ function() {
|
|
|
401
397
|
];
|
|
402
398
|
}
|
|
403
399
|
});
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
return _ref.apply(this, arguments);
|
|
407
|
-
};
|
|
408
|
-
}();
|
|
400
|
+
})();
|
|
401
|
+
};
|
|
409
402
|
// src/supercompatFetch/index.ts
|
|
410
403
|
var supercompatFetch = function(param) {
|
|
411
404
|
var client = param.client, storage = param.storage, runAdapter = param.runAdapter;
|
|
@@ -414,44 +407,45 @@ var supercompatFetch = function(param) {
|
|
|
414
407
|
storage: storage,
|
|
415
408
|
runAdapter: runAdapter
|
|
416
409
|
});
|
|
417
|
-
return
|
|
418
|
-
var _len, args
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
410
|
+
return function() {
|
|
411
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
412
|
+
args[_key] = arguments[_key];
|
|
413
|
+
}
|
|
414
|
+
return _async_to_generator(function() {
|
|
415
|
+
var _args, url, options, pathHandler, _options_method, method, requestHandler;
|
|
416
|
+
return _ts_generator(this, function(_state) {
|
|
417
|
+
_args = _sliced_to_array(args, 2), url = _args[0], options = _args[1];
|
|
418
|
+
pathHandler = findRequestHandler({
|
|
419
|
+
url: url,
|
|
420
|
+
requestHandlers: requestHandlers2
|
|
421
|
+
});
|
|
422
|
+
if (!pathHandler) {
|
|
423
|
+
return [
|
|
424
|
+
2,
|
|
425
|
+
originalFetch({
|
|
426
|
+
client: client,
|
|
427
|
+
args: args
|
|
428
|
+
})
|
|
429
|
+
];
|
|
430
|
+
}
|
|
431
|
+
method = (_options_method = options === null || options === void 0 ? void 0 : options.method) !== null && _options_method !== void 0 ? _options_method : "";
|
|
432
|
+
requestHandler = pathHandler[method.toLowerCase()];
|
|
433
|
+
if (!requestHandler) {
|
|
434
|
+
return [
|
|
435
|
+
2,
|
|
436
|
+
originalFetch({
|
|
437
|
+
client: client,
|
|
438
|
+
args: args
|
|
439
|
+
})
|
|
440
|
+
];
|
|
441
|
+
}
|
|
441
442
|
return [
|
|
442
443
|
2,
|
|
443
|
-
|
|
444
|
-
client: client,
|
|
445
|
-
args: args
|
|
446
|
-
})
|
|
444
|
+
requestHandler.apply(void 0, _to_consumable_array(args))
|
|
447
445
|
];
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
requestHandler.apply(void 0, _to_consumable_array(args))
|
|
452
|
-
];
|
|
453
|
-
});
|
|
454
|
-
});
|
|
446
|
+
});
|
|
447
|
+
})();
|
|
448
|
+
};
|
|
455
449
|
};
|
|
456
450
|
// src/lib/azureOpenai/endpointFromBaseUrl.ts
|
|
457
451
|
var endpointFromBaseUrl = function(param) {
|
|
@@ -487,8 +481,8 @@ var supercompat = function(param) {
|
|
|
487
481
|
// src/adapters/client/groqClientAdapter/models/get.ts
|
|
488
482
|
var get = function(param) {
|
|
489
483
|
var groq = param.groq;
|
|
490
|
-
return
|
|
491
|
-
|
|
484
|
+
return function(_url, _options) {
|
|
485
|
+
return _async_to_generator(function() {
|
|
492
486
|
var data, error;
|
|
493
487
|
return _ts_generator(this, function(_state) {
|
|
494
488
|
switch(_state.label){
|
|
@@ -533,11 +527,8 @@ var get = function(param) {
|
|
|
533
527
|
];
|
|
534
528
|
}
|
|
535
529
|
});
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
return _ref.apply(this, arguments);
|
|
539
|
-
};
|
|
540
|
-
}();
|
|
530
|
+
})();
|
|
531
|
+
};
|
|
541
532
|
};
|
|
542
533
|
// src/adapters/client/groqClientAdapter/models/index.ts
|
|
543
534
|
var models = function(param) {
|
|
@@ -551,8 +542,8 @@ var models = function(param) {
|
|
|
551
542
|
// src/adapters/client/groqClientAdapter/completions/post.ts
|
|
552
543
|
var post = function(param) {
|
|
553
544
|
var groq = param.groq;
|
|
554
|
-
return
|
|
555
|
-
|
|
545
|
+
return function(_url, options) {
|
|
546
|
+
return _async_to_generator(function() {
|
|
556
547
|
var body, response, stream, data, error;
|
|
557
548
|
return _ts_generator(this, function(_state) {
|
|
558
549
|
switch(_state.label){
|
|
@@ -714,11 +705,8 @@ var post = function(param) {
|
|
|
714
705
|
];
|
|
715
706
|
}
|
|
716
707
|
});
|
|
717
|
-
});
|
|
718
|
-
|
|
719
|
-
return _ref.apply(this, arguments);
|
|
720
|
-
};
|
|
721
|
-
}();
|
|
708
|
+
})();
|
|
709
|
+
};
|
|
722
710
|
};
|
|
723
711
|
// src/adapters/client/groqClientAdapter/completions/index.ts
|
|
724
712
|
var completions = function(param) {
|
|
@@ -747,8 +735,8 @@ var groqClientAdapter = function(param) {
|
|
|
747
735
|
// src/adapters/client/openaiClientAdapter/models/get.ts
|
|
748
736
|
var get2 = function(param) {
|
|
749
737
|
var openai = param.openai;
|
|
750
|
-
return
|
|
751
|
-
|
|
738
|
+
return function(_url, _options) {
|
|
739
|
+
return _async_to_generator(function() {
|
|
752
740
|
var data, error;
|
|
753
741
|
return _ts_generator(this, function(_state) {
|
|
754
742
|
switch(_state.label){
|
|
@@ -793,11 +781,8 @@ var get2 = function(param) {
|
|
|
793
781
|
];
|
|
794
782
|
}
|
|
795
783
|
});
|
|
796
|
-
});
|
|
797
|
-
|
|
798
|
-
return _ref.apply(this, arguments);
|
|
799
|
-
};
|
|
800
|
-
}();
|
|
784
|
+
})();
|
|
785
|
+
};
|
|
801
786
|
};
|
|
802
787
|
// src/adapters/client/openaiClientAdapter/models/index.ts
|
|
803
788
|
var models2 = function(param) {
|
|
@@ -848,8 +833,8 @@ var omitKeys = function(param) {
|
|
|
848
833
|
};
|
|
849
834
|
var post2 = function(param) {
|
|
850
835
|
var openai = param.openai;
|
|
851
|
-
return
|
|
852
|
-
|
|
836
|
+
return function(_url, options) {
|
|
837
|
+
return _async_to_generator(function() {
|
|
853
838
|
var body, messages4, resultOptions, response, stream, data, error;
|
|
854
839
|
return _ts_generator(this, function(_state) {
|
|
855
840
|
switch(_state.label){
|
|
@@ -1020,11 +1005,8 @@ var post2 = function(param) {
|
|
|
1020
1005
|
];
|
|
1021
1006
|
}
|
|
1022
1007
|
});
|
|
1023
|
-
});
|
|
1024
|
-
|
|
1025
|
-
return _ref.apply(this, arguments);
|
|
1026
|
-
};
|
|
1027
|
-
}();
|
|
1008
|
+
})();
|
|
1009
|
+
};
|
|
1028
1010
|
};
|
|
1029
1011
|
// src/adapters/client/openaiClientAdapter/completions/index.ts
|
|
1030
1012
|
var completions2 = function(param) {
|
|
@@ -1066,8 +1048,8 @@ var azureOpenaiClientAdapter = function(param) {
|
|
|
1066
1048
|
// src/adapters/client/mistralClientAdapter/models/get.ts
|
|
1067
1049
|
var get3 = function(param) {
|
|
1068
1050
|
var mistral = param.mistral;
|
|
1069
|
-
return
|
|
1070
|
-
|
|
1051
|
+
return function(_url, _options) {
|
|
1052
|
+
return _async_to_generator(function() {
|
|
1071
1053
|
var data, error;
|
|
1072
1054
|
return _ts_generator(this, function(_state) {
|
|
1073
1055
|
switch(_state.label){
|
|
@@ -1112,11 +1094,8 @@ var get3 = function(param) {
|
|
|
1112
1094
|
];
|
|
1113
1095
|
}
|
|
1114
1096
|
});
|
|
1115
|
-
});
|
|
1116
|
-
|
|
1117
|
-
return _ref.apply(this, arguments);
|
|
1118
|
-
};
|
|
1119
|
-
}();
|
|
1097
|
+
})();
|
|
1098
|
+
};
|
|
1120
1099
|
};
|
|
1121
1100
|
// src/adapters/client/mistralClientAdapter/models/index.ts
|
|
1122
1101
|
var models3 = function(param) {
|
|
@@ -1185,8 +1164,8 @@ var serializeBody = function(param) {
|
|
|
1185
1164
|
// src/adapters/client/mistralClientAdapter/completions/post.ts
|
|
1186
1165
|
var post3 = function(param) {
|
|
1187
1166
|
var mistral = param.mistral;
|
|
1188
|
-
return
|
|
1189
|
-
|
|
1167
|
+
return function(_url, options) {
|
|
1168
|
+
return _async_to_generator(function() {
|
|
1190
1169
|
var body, serializedBody, response, stream, data, error;
|
|
1191
1170
|
return _ts_generator(this, function(_state) {
|
|
1192
1171
|
switch(_state.label){
|
|
@@ -1354,11 +1333,8 @@ var post3 = function(param) {
|
|
|
1354
1333
|
];
|
|
1355
1334
|
}
|
|
1356
1335
|
});
|
|
1357
|
-
});
|
|
1358
|
-
|
|
1359
|
-
return _ref.apply(this, arguments);
|
|
1360
|
-
};
|
|
1361
|
-
}();
|
|
1336
|
+
})();
|
|
1337
|
+
};
|
|
1362
1338
|
};
|
|
1363
1339
|
// src/adapters/client/mistralClientAdapter/completions/index.ts
|
|
1364
1340
|
var completions3 = function(param) {
|
|
@@ -1397,8 +1373,8 @@ var models4 = [
|
|
|
1397
1373
|
];
|
|
1398
1374
|
var get4 = function(param) {
|
|
1399
1375
|
var perplexity = param.perplexity;
|
|
1400
|
-
return
|
|
1401
|
-
|
|
1376
|
+
return function(_url, _options) {
|
|
1377
|
+
return _async_to_generator(function() {
|
|
1402
1378
|
return _ts_generator(this, function(_state) {
|
|
1403
1379
|
try {
|
|
1404
1380
|
return [
|
|
@@ -1435,11 +1411,8 @@ var get4 = function(param) {
|
|
|
1435
1411
|
2
|
|
1436
1412
|
];
|
|
1437
1413
|
});
|
|
1438
|
-
});
|
|
1439
|
-
|
|
1440
|
-
return _ref.apply(this, arguments);
|
|
1441
|
-
};
|
|
1442
|
-
}();
|
|
1414
|
+
})();
|
|
1415
|
+
};
|
|
1443
1416
|
};
|
|
1444
1417
|
// src/adapters/client/perplexityClientAdapter/models/index.ts
|
|
1445
1418
|
var models5 = function(param) {
|
|
@@ -1479,8 +1452,8 @@ var alternatingMessages = function(param) {
|
|
|
1479
1452
|
// src/adapters/client/perplexityClientAdapter/completions/post.ts
|
|
1480
1453
|
var post4 = function(param) {
|
|
1481
1454
|
var perplexity = param.perplexity;
|
|
1482
|
-
return
|
|
1483
|
-
|
|
1455
|
+
return function(_url, options) {
|
|
1456
|
+
return _async_to_generator(function() {
|
|
1484
1457
|
var body, messages4, response, stream, data, error;
|
|
1485
1458
|
return _ts_generator(this, function(_state) {
|
|
1486
1459
|
switch(_state.label){
|
|
@@ -1647,11 +1620,8 @@ var post4 = function(param) {
|
|
|
1647
1620
|
];
|
|
1648
1621
|
}
|
|
1649
1622
|
});
|
|
1650
|
-
});
|
|
1651
|
-
|
|
1652
|
-
return _ref.apply(this, arguments);
|
|
1653
|
-
};
|
|
1654
|
-
}();
|
|
1623
|
+
})();
|
|
1624
|
+
};
|
|
1655
1625
|
};
|
|
1656
1626
|
// src/adapters/client/perplexityClientAdapter/completions/index.ts
|
|
1657
1627
|
var completions4 = function(param) {
|
|
@@ -1680,8 +1650,8 @@ var perplexityClientAdapter = function(param) {
|
|
|
1680
1650
|
// src/adapters/client/anthropicClientAdapter/models/get.ts
|
|
1681
1651
|
var get5 = function(param) {
|
|
1682
1652
|
var anthropic = param.anthropic;
|
|
1683
|
-
return
|
|
1684
|
-
|
|
1653
|
+
return function(_url, _options) {
|
|
1654
|
+
return _async_to_generator(function() {
|
|
1685
1655
|
var response, error;
|
|
1686
1656
|
return _ts_generator(this, function(_state) {
|
|
1687
1657
|
switch(_state.label){
|
|
@@ -1734,11 +1704,8 @@ var get5 = function(param) {
|
|
|
1734
1704
|
];
|
|
1735
1705
|
}
|
|
1736
1706
|
});
|
|
1737
|
-
});
|
|
1738
|
-
|
|
1739
|
-
return _ref.apply(this, arguments);
|
|
1740
|
-
};
|
|
1741
|
-
}();
|
|
1707
|
+
})();
|
|
1708
|
+
};
|
|
1742
1709
|
};
|
|
1743
1710
|
// src/adapters/client/anthropicClientAdapter/models/index.ts
|
|
1744
1711
|
var models6 = function(param) {
|
|
@@ -1750,7 +1717,7 @@ var models6 = function(param) {
|
|
|
1750
1717
|
};
|
|
1751
1718
|
};
|
|
1752
1719
|
// src/adapters/client/anthropicClientAdapter/completions/post.ts
|
|
1753
|
-
import { uid, fork, omit as
|
|
1720
|
+
import { uid, fork, omit as omit3 } from "radash";
|
|
1754
1721
|
// src/lib/messages/nonEmptyMessages.ts
|
|
1755
1722
|
var nonEmptyContent = function(param) {
|
|
1756
1723
|
var message = param.message;
|
|
@@ -1805,12 +1772,24 @@ var serializeTools = function(param) {
|
|
|
1805
1772
|
}
|
|
1806
1773
|
};
|
|
1807
1774
|
}
|
|
1808
|
-
return
|
|
1775
|
+
return _object_spread({
|
|
1776
|
+
type: tool.type
|
|
1777
|
+
}, tool[tool.type] || {});
|
|
1809
1778
|
});
|
|
1810
1779
|
};
|
|
1811
1780
|
// src/adapters/client/anthropicClientAdapter/completions/serializeMessages/serializeMessage.ts
|
|
1812
1781
|
var serializeMessage2 = function(param) {
|
|
1813
1782
|
var message = param.message;
|
|
1783
|
+
var parseArguments = function(value) {
|
|
1784
|
+
if (typeof value !== "string") return {};
|
|
1785
|
+
var trimmed = value.trim();
|
|
1786
|
+
if (!trimmed) return {};
|
|
1787
|
+
try {
|
|
1788
|
+
return JSON.parse(trimmed);
|
|
1789
|
+
} catch (e) {
|
|
1790
|
+
return {};
|
|
1791
|
+
}
|
|
1792
|
+
};
|
|
1814
1793
|
if (message.role === "user") {
|
|
1815
1794
|
return {
|
|
1816
1795
|
role: "user",
|
|
@@ -1832,7 +1811,7 @@ var serializeMessage2 = function(param) {
|
|
|
1832
1811
|
// @ts-expect-error todo
|
|
1833
1812
|
name: toolCall.function.name,
|
|
1834
1813
|
// @ts-expect-error todo
|
|
1835
|
-
input:
|
|
1814
|
+
input: parseArguments(toolCall.function.arguments)
|
|
1836
1815
|
};
|
|
1837
1816
|
})))
|
|
1838
1817
|
};
|
|
@@ -1858,12 +1837,479 @@ var serializeMessages = function(param) {
|
|
|
1858
1837
|
});
|
|
1859
1838
|
});
|
|
1860
1839
|
};
|
|
1840
|
+
// src/adapters/client/anthropicClientAdapter/completions/serializeBetas.ts
|
|
1841
|
+
var serializeBetas = function(param) {
|
|
1842
|
+
var _param_tools = param.tools, tools = _param_tools === void 0 ? [] : _param_tools;
|
|
1843
|
+
var betas = [];
|
|
1844
|
+
if (tools.some(function(tool) {
|
|
1845
|
+
return tool.type === "computer_20250124";
|
|
1846
|
+
})) {
|
|
1847
|
+
betas.push("computer-use-2025-01-24");
|
|
1848
|
+
}
|
|
1849
|
+
if (tools.some(function(tool) {
|
|
1850
|
+
return tool.type === "code_execution_20250825";
|
|
1851
|
+
})) {
|
|
1852
|
+
betas.push("code-execution-2025-08-25");
|
|
1853
|
+
}
|
|
1854
|
+
if (!betas.length) {
|
|
1855
|
+
return {};
|
|
1856
|
+
}
|
|
1857
|
+
return {
|
|
1858
|
+
betas: betas
|
|
1859
|
+
};
|
|
1860
|
+
};
|
|
1861
|
+
// src/adapters/client/anthropicClientAdapter/normalizeComputerToolCallPayload.ts
|
|
1862
|
+
import { omit as omit2 } from "radash";
|
|
1863
|
+
var coordinateKeys = [
|
|
1864
|
+
"coordinate",
|
|
1865
|
+
"coordinates",
|
|
1866
|
+
"coordinate_start",
|
|
1867
|
+
"coordinate_end",
|
|
1868
|
+
"start",
|
|
1869
|
+
"end",
|
|
1870
|
+
"from",
|
|
1871
|
+
"to",
|
|
1872
|
+
"target",
|
|
1873
|
+
"point",
|
|
1874
|
+
"position",
|
|
1875
|
+
"cursor_position",
|
|
1876
|
+
"path"
|
|
1877
|
+
];
|
|
1878
|
+
var clickButtonMap = {
|
|
1879
|
+
left_click: "left",
|
|
1880
|
+
right_click: "right",
|
|
1881
|
+
middle_click: "wheel",
|
|
1882
|
+
double_click: "left",
|
|
1883
|
+
triple_click: "left",
|
|
1884
|
+
left_mouse_down: "left",
|
|
1885
|
+
left_mouse_up: "left"
|
|
1886
|
+
};
|
|
1887
|
+
var keyAliasMap = {
|
|
1888
|
+
ctrl: "ctrl",
|
|
1889
|
+
control: "ctrl",
|
|
1890
|
+
cmd: "meta",
|
|
1891
|
+
command: "meta",
|
|
1892
|
+
meta: "meta",
|
|
1893
|
+
win: "meta",
|
|
1894
|
+
option: "alt",
|
|
1895
|
+
alt: "alt",
|
|
1896
|
+
shift: "shift",
|
|
1897
|
+
enter: "enter",
|
|
1898
|
+
return: "enter",
|
|
1899
|
+
esc: "escape",
|
|
1900
|
+
escape: "escape",
|
|
1901
|
+
tab: "tab",
|
|
1902
|
+
space: "space",
|
|
1903
|
+
spacebar: "space",
|
|
1904
|
+
backspace: "backspace",
|
|
1905
|
+
del: "delete",
|
|
1906
|
+
delete: "delete",
|
|
1907
|
+
pageup: "pageup",
|
|
1908
|
+
pagedown: "pagedown",
|
|
1909
|
+
up: "up",
|
|
1910
|
+
down: "down",
|
|
1911
|
+
left: "left",
|
|
1912
|
+
right: "right"
|
|
1913
|
+
};
|
|
1914
|
+
var sanitizeNumber = function(value) {
|
|
1915
|
+
return typeof value === "number" ? value : void 0;
|
|
1916
|
+
};
|
|
1917
|
+
var toCoordinate = function(value) {
|
|
1918
|
+
if (!value) return void 0;
|
|
1919
|
+
if (Array.isArray(value)) {
|
|
1920
|
+
if (value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number") {
|
|
1921
|
+
return {
|
|
1922
|
+
x: value[0],
|
|
1923
|
+
y: value[1]
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
if (value.length > 0 && Array.isArray(value[0])) {
|
|
1927
|
+
var tuple = value[0];
|
|
1928
|
+
if (tuple.length === 2 && typeof tuple[0] === "number" && typeof tuple[1] === "number") {
|
|
1929
|
+
return {
|
|
1930
|
+
x: tuple[0],
|
|
1931
|
+
y: tuple[1]
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
|
|
1937
|
+
var maybe = value;
|
|
1938
|
+
var x = sanitizeNumber(maybe.x);
|
|
1939
|
+
var y = sanitizeNumber(maybe.y);
|
|
1940
|
+
if (typeof x === "number" && typeof y === "number") {
|
|
1941
|
+
return {
|
|
1942
|
+
x: x,
|
|
1943
|
+
y: y
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
if (typeof value === "string") {
|
|
1948
|
+
var parts = value.split(/[, ]+/).map(Number).filter(Number.isFinite);
|
|
1949
|
+
if (parts.length >= 2) {
|
|
1950
|
+
return {
|
|
1951
|
+
x: parts[0],
|
|
1952
|
+
y: parts[1]
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
return void 0;
|
|
1957
|
+
};
|
|
1958
|
+
var findCoordinatesInDetails = function(details) {
|
|
1959
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1960
|
+
try {
|
|
1961
|
+
for(var _iterator = coordinateKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1962
|
+
var key = _step.value;
|
|
1963
|
+
var value = details[key];
|
|
1964
|
+
var coords = toCoordinate(value);
|
|
1965
|
+
if (coords) {
|
|
1966
|
+
return coords;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
} catch (err) {
|
|
1970
|
+
_didIteratorError = true;
|
|
1971
|
+
_iteratorError = err;
|
|
1972
|
+
} finally{
|
|
1973
|
+
try {
|
|
1974
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1975
|
+
_iterator.return();
|
|
1976
|
+
}
|
|
1977
|
+
} finally{
|
|
1978
|
+
if (_didIteratorError) {
|
|
1979
|
+
throw _iteratorError;
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
return void 0;
|
|
1984
|
+
};
|
|
1985
|
+
var buildDragPath = function(details) {
|
|
1986
|
+
var path = [];
|
|
1987
|
+
if (Array.isArray(details.path)) {
|
|
1988
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1989
|
+
try {
|
|
1990
|
+
for(var _iterator = details.path[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1991
|
+
var point = _step.value;
|
|
1992
|
+
var coords = toCoordinate(point);
|
|
1993
|
+
if (coords) {
|
|
1994
|
+
path.push(coords);
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
} catch (err) {
|
|
1998
|
+
_didIteratorError = true;
|
|
1999
|
+
_iteratorError = err;
|
|
2000
|
+
} finally{
|
|
2001
|
+
try {
|
|
2002
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2003
|
+
_iterator.return();
|
|
2004
|
+
}
|
|
2005
|
+
} finally{
|
|
2006
|
+
if (_didIteratorError) {
|
|
2007
|
+
throw _iteratorError;
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
if (!path.length) {
|
|
2013
|
+
var start = toCoordinate(details.coordinate_start) || toCoordinate(details.start) || toCoordinate(details.from);
|
|
2014
|
+
if (start) {
|
|
2015
|
+
path.push(start);
|
|
2016
|
+
}
|
|
2017
|
+
var end = toCoordinate(details.coordinate_end) || toCoordinate(details.end) || toCoordinate(details.to) || toCoordinate(details.target);
|
|
2018
|
+
if (end) {
|
|
2019
|
+
path.push(end);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
if (!path.length) {
|
|
2023
|
+
var coords1 = findCoordinatesInDetails(details);
|
|
2024
|
+
if (coords1) {
|
|
2025
|
+
path.push(coords1);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
if (!path.length) {
|
|
2029
|
+
path.push({
|
|
2030
|
+
x: 0,
|
|
2031
|
+
y: 0
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
return path;
|
|
2035
|
+
};
|
|
2036
|
+
var parseKeys = function(input) {
|
|
2037
|
+
if (Array.isArray(input)) {
|
|
2038
|
+
return input.map(String).map(function(key) {
|
|
2039
|
+
return key.trim();
|
|
2040
|
+
}).filter(Boolean);
|
|
2041
|
+
}
|
|
2042
|
+
if (typeof input === "string") {
|
|
2043
|
+
return input.split(RegExp("(?:(?<!\\\\)\\+|\\s+)")).map(function(key) {
|
|
2044
|
+
return key.replace(/\\\+/g, "+");
|
|
2045
|
+
}).map(function(key) {
|
|
2046
|
+
return key.trim();
|
|
2047
|
+
}).filter(Boolean);
|
|
2048
|
+
}
|
|
2049
|
+
return [];
|
|
2050
|
+
};
|
|
2051
|
+
var normalizeKeys = function(keys) {
|
|
2052
|
+
return keys.map(function(key) {
|
|
2053
|
+
var lowerKey = key.toLowerCase();
|
|
2054
|
+
var _keyAliasMap_lowerKey;
|
|
2055
|
+
return (_keyAliasMap_lowerKey = keyAliasMap[lowerKey]) !== null && _keyAliasMap_lowerKey !== void 0 ? _keyAliasMap_lowerKey : lowerKey;
|
|
2056
|
+
});
|
|
2057
|
+
};
|
|
2058
|
+
var normalizeScroll = function(details) {
|
|
2059
|
+
var _sanitizeNumber;
|
|
2060
|
+
var scrollX = (_sanitizeNumber = sanitizeNumber(details.scroll_x)) !== null && _sanitizeNumber !== void 0 ? _sanitizeNumber : 0;
|
|
2061
|
+
var _sanitizeNumber1;
|
|
2062
|
+
var scrollY = (_sanitizeNumber1 = sanitizeNumber(details.scroll_y)) !== null && _sanitizeNumber1 !== void 0 ? _sanitizeNumber1 : 0;
|
|
2063
|
+
var _sanitizeNumber2, _ref;
|
|
2064
|
+
var amount = (_ref = (_sanitizeNumber2 = sanitizeNumber(details.scroll_amount)) !== null && _sanitizeNumber2 !== void 0 ? _sanitizeNumber2 : sanitizeNumber(details.amount)) !== null && _ref !== void 0 ? _ref : 0;
|
|
2065
|
+
var direction = typeof details.scroll_direction === "string" ? details.scroll_direction.toLowerCase() : typeof details.direction === "string" ? details.direction.toLowerCase() : void 0;
|
|
2066
|
+
if (!scrollX && !scrollY && direction && amount) {
|
|
2067
|
+
switch(direction){
|
|
2068
|
+
case "up":
|
|
2069
|
+
scrollY = -amount;
|
|
2070
|
+
break;
|
|
2071
|
+
case "down":
|
|
2072
|
+
scrollY = amount;
|
|
2073
|
+
break;
|
|
2074
|
+
case "left":
|
|
2075
|
+
scrollX = -amount;
|
|
2076
|
+
break;
|
|
2077
|
+
case "right":
|
|
2078
|
+
scrollX = amount;
|
|
2079
|
+
break;
|
|
2080
|
+
default:
|
|
2081
|
+
break;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
return {
|
|
2085
|
+
scroll_x: scrollX,
|
|
2086
|
+
scroll_y: scrollY
|
|
2087
|
+
};
|
|
2088
|
+
};
|
|
2089
|
+
var normalizeActionString = function(action, details) {
|
|
2090
|
+
var coords = findCoordinatesInDetails(details);
|
|
2091
|
+
switch(action){
|
|
2092
|
+
case "screenshot":
|
|
2093
|
+
return {
|
|
2094
|
+
type: "screenshot"
|
|
2095
|
+
};
|
|
2096
|
+
case "left_click":
|
|
2097
|
+
case "right_click":
|
|
2098
|
+
case "middle_click":
|
|
2099
|
+
{
|
|
2100
|
+
var _coords_x, _coords_y;
|
|
2101
|
+
return {
|
|
2102
|
+
type: "click",
|
|
2103
|
+
button: clickButtonMap[action],
|
|
2104
|
+
x: (_coords_x = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x !== void 0 ? _coords_x : 0,
|
|
2105
|
+
y: (_coords_y = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y !== void 0 ? _coords_y : 0
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2108
|
+
case "double_click":
|
|
2109
|
+
var _coords_x1, _coords_y1;
|
|
2110
|
+
return {
|
|
2111
|
+
type: "double_click",
|
|
2112
|
+
x: (_coords_x1 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x1 !== void 0 ? _coords_x1 : 0,
|
|
2113
|
+
y: (_coords_y1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y1 !== void 0 ? _coords_y1 : 0
|
|
2114
|
+
};
|
|
2115
|
+
case "triple_click":
|
|
2116
|
+
var _coords_x2, _coords_y2;
|
|
2117
|
+
return {
|
|
2118
|
+
type: "double_click",
|
|
2119
|
+
x: (_coords_x2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x2 !== void 0 ? _coords_x2 : 0,
|
|
2120
|
+
y: (_coords_y2 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y2 !== void 0 ? _coords_y2 : 0,
|
|
2121
|
+
repetitions: 3
|
|
2122
|
+
};
|
|
2123
|
+
case "left_mouse_down":
|
|
2124
|
+
var _coords_x3, _coords_y3;
|
|
2125
|
+
return {
|
|
2126
|
+
type: "click",
|
|
2127
|
+
button: clickButtonMap[action],
|
|
2128
|
+
state: "down",
|
|
2129
|
+
x: (_coords_x3 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x3 !== void 0 ? _coords_x3 : 0,
|
|
2130
|
+
y: (_coords_y3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y3 !== void 0 ? _coords_y3 : 0
|
|
2131
|
+
};
|
|
2132
|
+
case "left_mouse_up":
|
|
2133
|
+
var _coords_x4, _coords_y4;
|
|
2134
|
+
return {
|
|
2135
|
+
type: "click",
|
|
2136
|
+
button: clickButtonMap[action],
|
|
2137
|
+
state: "up",
|
|
2138
|
+
x: (_coords_x4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x4 !== void 0 ? _coords_x4 : 0,
|
|
2139
|
+
y: (_coords_y4 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y4 !== void 0 ? _coords_y4 : 0
|
|
2140
|
+
};
|
|
2141
|
+
case "left_click_drag":
|
|
2142
|
+
{
|
|
2143
|
+
var path = buildDragPath(details).map(function(param) {
|
|
2144
|
+
var x = param.x, y = param.y;
|
|
2145
|
+
return {
|
|
2146
|
+
x: x,
|
|
2147
|
+
y: y
|
|
2148
|
+
};
|
|
2149
|
+
});
|
|
2150
|
+
return {
|
|
2151
|
+
type: "drag",
|
|
2152
|
+
path: path
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
case "mouse_move":
|
|
2156
|
+
case "cursor_position":
|
|
2157
|
+
var _coords_x5, _coords_y5;
|
|
2158
|
+
return {
|
|
2159
|
+
type: "move",
|
|
2160
|
+
x: (_coords_x5 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x5 !== void 0 ? _coords_x5 : 0,
|
|
2161
|
+
y: (_coords_y5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y5 !== void 0 ? _coords_y5 : 0
|
|
2162
|
+
};
|
|
2163
|
+
case "scroll":
|
|
2164
|
+
{
|
|
2165
|
+
var _normalizeScroll = normalizeScroll(details), scroll_x = _normalizeScroll.scroll_x, scroll_y = _normalizeScroll.scroll_y;
|
|
2166
|
+
var _coords_x6, _coords_y6;
|
|
2167
|
+
return _object_spread({
|
|
2168
|
+
type: "scroll",
|
|
2169
|
+
x: (_coords_x6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x6 !== void 0 ? _coords_x6 : 0,
|
|
2170
|
+
y: (_coords_y6 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y6 !== void 0 ? _coords_y6 : 0,
|
|
2171
|
+
scroll_x: scroll_x,
|
|
2172
|
+
scroll_y: scroll_y
|
|
2173
|
+
}, typeof details.scroll_direction === "string" ? {
|
|
2174
|
+
direction: details.scroll_direction
|
|
2175
|
+
} : typeof details.direction === "string" ? {
|
|
2176
|
+
direction: details.direction
|
|
2177
|
+
} : {}, typeof details.scroll_amount === "number" ? {
|
|
2178
|
+
amount: details.scroll_amount
|
|
2179
|
+
} : typeof details.amount === "number" ? {
|
|
2180
|
+
amount: details.amount
|
|
2181
|
+
} : {});
|
|
2182
|
+
}
|
|
2183
|
+
case "type":
|
|
2184
|
+
{
|
|
2185
|
+
var text = typeof details.text === "string" ? details.text : typeof details.input === "string" ? details.input : "";
|
|
2186
|
+
return {
|
|
2187
|
+
type: "type",
|
|
2188
|
+
text: text
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
case "key":
|
|
2192
|
+
case "hold_key":
|
|
2193
|
+
{
|
|
2194
|
+
var _details_text, _ref;
|
|
2195
|
+
var keys = normalizeKeys(parseKeys((_ref = (_details_text = details.text) !== null && _details_text !== void 0 ? _details_text : details.keys) !== null && _ref !== void 0 ? _ref : details.key));
|
|
2196
|
+
var normalized = {
|
|
2197
|
+
type: "keypress",
|
|
2198
|
+
keys: keys
|
|
2199
|
+
};
|
|
2200
|
+
if (action === "hold_key") {
|
|
2201
|
+
var duration = sanitizeNumber(details.duration);
|
|
2202
|
+
if (typeof duration === "number") {
|
|
2203
|
+
normalized.hold_duration_ms = Math.round(duration * 1e3);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
return normalized;
|
|
2207
|
+
}
|
|
2208
|
+
case "wait":
|
|
2209
|
+
{
|
|
2210
|
+
var duration1 = sanitizeNumber(details.duration);
|
|
2211
|
+
return _object_spread({
|
|
2212
|
+
type: "wait"
|
|
2213
|
+
}, typeof duration1 === "number" ? {
|
|
2214
|
+
duration_ms: Math.round(duration1 * 1e3)
|
|
2215
|
+
} : {});
|
|
2216
|
+
}
|
|
2217
|
+
default:
|
|
2218
|
+
{
|
|
2219
|
+
return _object_spread({
|
|
2220
|
+
type: action
|
|
2221
|
+
}, coords ? {
|
|
2222
|
+
x: coords.x,
|
|
2223
|
+
y: coords.y
|
|
2224
|
+
} : {}, omit2(details, _to_consumable_array(coordinateKeys).concat([
|
|
2225
|
+
"text",
|
|
2226
|
+
"scroll_direction",
|
|
2227
|
+
"direction",
|
|
2228
|
+
"scroll_amount",
|
|
2229
|
+
"amount",
|
|
2230
|
+
"scroll_x",
|
|
2231
|
+
"scroll_y",
|
|
2232
|
+
"keys",
|
|
2233
|
+
"duration"
|
|
2234
|
+
])));
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
};
|
|
2238
|
+
var normalizeAction = function(payload) {
|
|
2239
|
+
if (payload && (typeof payload === "undefined" ? "undefined" : _type_of(payload)) === "object") {
|
|
2240
|
+
var rawAction = payload.action;
|
|
2241
|
+
if (typeof rawAction === "string") {
|
|
2242
|
+
var parsedAction = parseJson(rawAction);
|
|
2243
|
+
if (parsedAction && (typeof parsedAction === "undefined" ? "undefined" : _type_of(parsedAction)) === "object") {
|
|
2244
|
+
rawAction = parsedAction;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
if (rawAction && (typeof rawAction === "undefined" ? "undefined" : _type_of(rawAction)) === "object" && typeof rawAction.type === "string") {
|
|
2248
|
+
return rawAction;
|
|
2249
|
+
}
|
|
2250
|
+
if (typeof rawAction === "string") {
|
|
2251
|
+
var details = omit2(payload, [
|
|
2252
|
+
"action",
|
|
2253
|
+
"pending_safety_checks",
|
|
2254
|
+
"status"
|
|
2255
|
+
]);
|
|
2256
|
+
return normalizeActionString(rawAction, details);
|
|
2257
|
+
}
|
|
2258
|
+
if (typeof payload.type === "string") {
|
|
2259
|
+
return payload;
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
if (typeof payload === "string") {
|
|
2263
|
+
var parsed = parseJson(payload);
|
|
2264
|
+
if (parsed && (typeof parsed === "undefined" ? "undefined" : _type_of(parsed)) === "object") {
|
|
2265
|
+
return normalizeAction(parsed);
|
|
2266
|
+
}
|
|
2267
|
+
return {
|
|
2268
|
+
type: payload
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
return {
|
|
2272
|
+
type: "unknown",
|
|
2273
|
+
value: payload
|
|
2274
|
+
};
|
|
2275
|
+
};
|
|
2276
|
+
var normalizeComputerToolCallPayload = function(payload) {
|
|
2277
|
+
var normalizedPayload = payload;
|
|
2278
|
+
if (typeof payload === "string") {
|
|
2279
|
+
var parsed = parseJson(payload);
|
|
2280
|
+
if (parsed !== void 0) {
|
|
2281
|
+
normalizedPayload = parsed;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
var pendingSafetyChecksRaw = normalizedPayload && (typeof normalizedPayload === "undefined" ? "undefined" : _type_of(normalizedPayload)) === "object" ? normalizedPayload.pending_safety_checks : void 0;
|
|
2285
|
+
if (typeof pendingSafetyChecksRaw === "string") {
|
|
2286
|
+
var parsed1 = parseJson(pendingSafetyChecksRaw);
|
|
2287
|
+
pendingSafetyChecksRaw = Array.isArray(parsed1) ? parsed1 : [];
|
|
2288
|
+
}
|
|
2289
|
+
var pendingSafetyChecks = Array.isArray(pendingSafetyChecksRaw) ? pendingSafetyChecksRaw : [];
|
|
2290
|
+
var normalizedAction = normalizeAction(normalizedPayload);
|
|
2291
|
+
var result = {
|
|
2292
|
+
action: normalizedAction,
|
|
2293
|
+
pending_safety_checks: pendingSafetyChecks
|
|
2294
|
+
};
|
|
2295
|
+
if (normalizedPayload && (typeof normalizedPayload === "undefined" ? "undefined" : _type_of(normalizedPayload)) === "object" && "status" in normalizedPayload) {
|
|
2296
|
+
result.status = normalizedPayload.status;
|
|
2297
|
+
}
|
|
2298
|
+
return result;
|
|
2299
|
+
};
|
|
2300
|
+
var parseJson = function(value) {
|
|
2301
|
+
try {
|
|
2302
|
+
return JSON.parse(value);
|
|
2303
|
+
} catch (e) {
|
|
2304
|
+
return void 0;
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
1861
2307
|
// src/adapters/client/anthropicClientAdapter/completions/post.ts
|
|
1862
2308
|
var post5 = function(param) {
|
|
1863
2309
|
var anthropic = param.anthropic;
|
|
1864
|
-
return
|
|
1865
|
-
|
|
1866
|
-
var body, messages4, _fork, systemMessages, otherMessages, system, chatMessages, resultOptions, response, stream, data, error;
|
|
2310
|
+
return function(_url, options) {
|
|
2311
|
+
return _async_to_generator(function() {
|
|
2312
|
+
var body, messages4, _fork, systemMessages, otherMessages, system, chatMessages, resultOptions, response, stream, data, normalizedContent, normalizedData, error;
|
|
1867
2313
|
return _ts_generator(this, function(_state) {
|
|
1868
2314
|
switch(_state.label){
|
|
1869
2315
|
case 0:
|
|
@@ -1882,10 +2328,14 @@ var post5 = function(param) {
|
|
|
1882
2328
|
})
|
|
1883
2329
|
})
|
|
1884
2330
|
});
|
|
1885
|
-
resultOptions = _object_spread_props(_object_spread({},
|
|
2331
|
+
resultOptions = _object_spread_props(_object_spread(_object_spread_props(_object_spread({}, omit3(body, [
|
|
1886
2332
|
"response_format"
|
|
1887
2333
|
])), {
|
|
1888
|
-
|
|
2334
|
+
model: body.model
|
|
2335
|
+
}), serializeBetas({
|
|
2336
|
+
tools: body.tools
|
|
2337
|
+
})), {
|
|
2338
|
+
stream: body.stream,
|
|
1889
2339
|
system: system,
|
|
1890
2340
|
messages: serializeMessages({
|
|
1891
2341
|
messages: chatMessages
|
|
@@ -1895,23 +2345,98 @@ var post5 = function(param) {
|
|
|
1895
2345
|
tools: body.tools
|
|
1896
2346
|
})
|
|
1897
2347
|
});
|
|
1898
|
-
if (!
|
|
2348
|
+
if (!resultOptions.stream) return [
|
|
1899
2349
|
3,
|
|
1900
2350
|
2
|
|
1901
2351
|
];
|
|
1902
2352
|
return [
|
|
1903
2353
|
4,
|
|
1904
|
-
anthropic.messages.
|
|
2354
|
+
anthropic.beta.messages.create(resultOptions)
|
|
1905
2355
|
];
|
|
1906
2356
|
case 1:
|
|
1907
2357
|
response = _state.sent();
|
|
1908
2358
|
stream = new ReadableStream({
|
|
1909
2359
|
start: function start(controller) {
|
|
1910
2360
|
return _async_to_generator(function() {
|
|
1911
|
-
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, delta, messageDelta, delta1, messageDelta1, messageDelta2, err;
|
|
2361
|
+
var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex, parseJson2, getOrCreateIndexForToolUseId, assignBlockToToolUse, markComputerToolUse, getToolUseIdFromBlock, emitNormalizedToolCall, getOrCreateIndexForBlock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, _ref, chunk, toolUseId, _toolUseIdArgumentBuffer_get, buffered, parsed, normalized, toolCallIndex, chunkIndex, delta, toolUseId1, _toolUseIdArgumentBuffer_get1, existing, _chunk_delta_partial_json, updated, parsed1, normalized1, toolCallIndex1, chunkIndex1, _toolUseIdArgumentBuffer_get2, existing1, _chunk_delta_partial_json1, index, messageDelta, delta1, toolName, normalizedToolName, index1, index2, _chunk_content_block_content, outputPayload, _getToolUseIdFromBlock, toolCallId, index3, _getToolUseIdFromBlock1, toolCallId1, _chunk_content_block, _toolUseId, _type, _id, rest, index4, _chunk_content_block_content1, outputPayload1, messageDelta1, messageDelta2, err;
|
|
1912
2362
|
return _ts_generator(this, function(_state) {
|
|
1913
2363
|
switch(_state.label){
|
|
1914
2364
|
case 0:
|
|
2365
|
+
blockIndexToToolUseId = /* @__PURE__ */ new Map();
|
|
2366
|
+
toolUseIdToIndex = /* @__PURE__ */ new Map();
|
|
2367
|
+
toolUseIdArgumentBuffer = /* @__PURE__ */ new Map();
|
|
2368
|
+
computerToolUseIds = /* @__PURE__ */ new Set();
|
|
2369
|
+
normalizedComputerCalls = /* @__PURE__ */ new Set();
|
|
2370
|
+
nextToolCallIndex = 0;
|
|
2371
|
+
parseJson2 = function(value) {
|
|
2372
|
+
try {
|
|
2373
|
+
return JSON.parse(value);
|
|
2374
|
+
} catch (e) {
|
|
2375
|
+
return void 0;
|
|
2376
|
+
}
|
|
2377
|
+
};
|
|
2378
|
+
getOrCreateIndexForToolUseId = function(toolUseId) {
|
|
2379
|
+
if (!toolUseId) {
|
|
2380
|
+
return 0;
|
|
2381
|
+
}
|
|
2382
|
+
if (!toolUseIdToIndex.has(toolUseId)) {
|
|
2383
|
+
toolUseIdToIndex.set(toolUseId, nextToolCallIndex++);
|
|
2384
|
+
}
|
|
2385
|
+
var _toolUseIdToIndex_get;
|
|
2386
|
+
return (_toolUseIdToIndex_get = toolUseIdToIndex.get(toolUseId)) !== null && _toolUseIdToIndex_get !== void 0 ? _toolUseIdToIndex_get : 0;
|
|
2387
|
+
};
|
|
2388
|
+
assignBlockToToolUse = function(param) {
|
|
2389
|
+
var blockIndex = param.blockIndex, toolUseId = param.toolUseId;
|
|
2390
|
+
if (typeof blockIndex === "number" && toolUseId) {
|
|
2391
|
+
blockIndexToToolUseId.set(blockIndex, toolUseId);
|
|
2392
|
+
}
|
|
2393
|
+
};
|
|
2394
|
+
markComputerToolUse = function(toolUseId) {
|
|
2395
|
+
if (!toolUseId) return;
|
|
2396
|
+
computerToolUseIds.add(toolUseId);
|
|
2397
|
+
normalizedComputerCalls.delete(toolUseId);
|
|
2398
|
+
toolUseIdArgumentBuffer.set(toolUseId, "");
|
|
2399
|
+
};
|
|
2400
|
+
getToolUseIdFromBlock = function(block) {
|
|
2401
|
+
if (!block || (typeof block === "undefined" ? "undefined" : _type_of(block)) !== "object") return void 0;
|
|
2402
|
+
if (typeof block.tool_use_id === "string") {
|
|
2403
|
+
return block.tool_use_id;
|
|
2404
|
+
}
|
|
2405
|
+
if (typeof block.id === "string") {
|
|
2406
|
+
return block.id;
|
|
2407
|
+
}
|
|
2408
|
+
return void 0;
|
|
2409
|
+
};
|
|
2410
|
+
emitNormalizedToolCall = function(param) {
|
|
2411
|
+
var normalized = param.normalized, toolCallIndex = param.toolCallIndex, chunkIndex = param.chunkIndex;
|
|
2412
|
+
var messageDelta = {
|
|
2413
|
+
id: "chatcmpl-".concat(uid(29)),
|
|
2414
|
+
object: "chat.completion.chunk",
|
|
2415
|
+
choices: [
|
|
2416
|
+
{
|
|
2417
|
+
index: chunkIndex,
|
|
2418
|
+
delta: {
|
|
2419
|
+
tool_calls: [
|
|
2420
|
+
{
|
|
2421
|
+
index: toolCallIndex,
|
|
2422
|
+
function: {
|
|
2423
|
+
arguments: JSON.stringify(normalized)
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
]
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
]
|
|
2430
|
+
};
|
|
2431
|
+
controller.enqueue("data: ".concat(JSON.stringify(messageDelta), "\n\n"));
|
|
2432
|
+
};
|
|
2433
|
+
getOrCreateIndexForBlock = function(blockIndex) {
|
|
2434
|
+
if (typeof blockIndex !== "number") {
|
|
2435
|
+
return 0;
|
|
2436
|
+
}
|
|
2437
|
+
var toolUseId = blockIndexToToolUseId.get(blockIndex);
|
|
2438
|
+
return getOrCreateIndexForToolUseId(toolUseId);
|
|
2439
|
+
};
|
|
1915
2440
|
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
1916
2441
|
_state.label = 1;
|
|
1917
2442
|
case 1:
|
|
@@ -1934,14 +2459,79 @@ var post5 = function(param) {
|
|
|
1934
2459
|
5
|
|
1935
2460
|
];
|
|
1936
2461
|
_value = _step.value;
|
|
1937
|
-
|
|
2462
|
+
_ref = _value;
|
|
2463
|
+
chunk = _ref;
|
|
2464
|
+
if (chunk.type === "content_block_stop") {
|
|
2465
|
+
toolUseId = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
|
|
2466
|
+
if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
|
|
2467
|
+
;
|
|
2468
|
+
buffered = (_toolUseIdArgumentBuffer_get = toolUseIdArgumentBuffer.get(toolUseId)) !== null && _toolUseIdArgumentBuffer_get !== void 0 ? _toolUseIdArgumentBuffer_get : "";
|
|
2469
|
+
parsed = buffered ? parseJson2(buffered) : void 0;
|
|
2470
|
+
if (parsed !== void 0) {
|
|
2471
|
+
normalized = normalizeComputerToolCallPayload(parsed);
|
|
2472
|
+
toolCallIndex = getOrCreateIndexForToolUseId(toolUseId);
|
|
2473
|
+
chunkIndex = typeof chunk.index === "number" ? chunk.index : 0;
|
|
2474
|
+
emitNormalizedToolCall({
|
|
2475
|
+
normalized: normalized,
|
|
2476
|
+
toolCallIndex: toolCallIndex,
|
|
2477
|
+
chunkIndex: chunkIndex
|
|
2478
|
+
});
|
|
2479
|
+
normalizedComputerCalls.add(toolUseId);
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
if (toolUseId) {
|
|
2483
|
+
toolUseIdArgumentBuffer.delete(toolUseId);
|
|
2484
|
+
computerToolUseIds.delete(toolUseId);
|
|
2485
|
+
normalizedComputerCalls.delete(toolUseId);
|
|
2486
|
+
}
|
|
2487
|
+
if (typeof chunk.index === "number") {
|
|
2488
|
+
blockIndexToToolUseId.delete(chunk.index);
|
|
2489
|
+
}
|
|
2490
|
+
return [
|
|
2491
|
+
3,
|
|
2492
|
+
4
|
|
2493
|
+
];
|
|
2494
|
+
}
|
|
1938
2495
|
if (chunk.type === "content_block_delta") {
|
|
1939
2496
|
delta = void 0;
|
|
1940
2497
|
if (chunk.delta.type === "input_json_delta") {
|
|
2498
|
+
toolUseId1 = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
|
|
2499
|
+
if (toolUseId1 && computerToolUseIds.has(toolUseId1)) {
|
|
2500
|
+
;
|
|
2501
|
+
existing = (_toolUseIdArgumentBuffer_get1 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get1 !== void 0 ? _toolUseIdArgumentBuffer_get1 : "";
|
|
2502
|
+
;
|
|
2503
|
+
updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
|
|
2504
|
+
toolUseIdArgumentBuffer.set(toolUseId1, updated);
|
|
2505
|
+
if (!normalizedComputerCalls.has(toolUseId1)) {
|
|
2506
|
+
parsed1 = parseJson2(updated);
|
|
2507
|
+
if (parsed1 !== void 0) {
|
|
2508
|
+
normalized1 = normalizeComputerToolCallPayload(parsed1);
|
|
2509
|
+
toolCallIndex1 = getOrCreateIndexForToolUseId(toolUseId1);
|
|
2510
|
+
chunkIndex1 = typeof chunk.index === "number" ? chunk.index : 0;
|
|
2511
|
+
emitNormalizedToolCall({
|
|
2512
|
+
normalized: normalized1,
|
|
2513
|
+
toolCallIndex: toolCallIndex1,
|
|
2514
|
+
chunkIndex: chunkIndex1
|
|
2515
|
+
});
|
|
2516
|
+
normalizedComputerCalls.add(toolUseId1);
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
return [
|
|
2520
|
+
3,
|
|
2521
|
+
4
|
|
2522
|
+
];
|
|
2523
|
+
}
|
|
2524
|
+
if (toolUseId1) {
|
|
2525
|
+
;
|
|
2526
|
+
existing1 = (_toolUseIdArgumentBuffer_get2 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get2 !== void 0 ? _toolUseIdArgumentBuffer_get2 : "";
|
|
2527
|
+
;
|
|
2528
|
+
toolUseIdArgumentBuffer.set(toolUseId1, "".concat(existing1).concat((_chunk_delta_partial_json1 = chunk.delta.partial_json) !== null && _chunk_delta_partial_json1 !== void 0 ? _chunk_delta_partial_json1 : ""));
|
|
2529
|
+
}
|
|
2530
|
+
index = getOrCreateIndexForBlock(chunk.index);
|
|
1941
2531
|
delta = {
|
|
1942
2532
|
tool_calls: [
|
|
1943
2533
|
{
|
|
1944
|
-
index:
|
|
2534
|
+
index: index,
|
|
1945
2535
|
function: {
|
|
1946
2536
|
arguments: chunk.delta.partial_json
|
|
1947
2537
|
}
|
|
@@ -1971,11 +2561,46 @@ var post5 = function(param) {
|
|
|
1971
2561
|
} else if (chunk.type === "content_block_start") {
|
|
1972
2562
|
delta1 = void 0;
|
|
1973
2563
|
if (chunk.content_block.type === "tool_use") {
|
|
2564
|
+
toolName = chunk.content_block.name;
|
|
2565
|
+
normalizedToolName = toolName === "computer" ? "computer_call" : toolName;
|
|
2566
|
+
index1 = getOrCreateIndexForToolUseId(chunk.content_block.id);
|
|
2567
|
+
assignBlockToToolUse({
|
|
2568
|
+
blockIndex: chunk.index,
|
|
2569
|
+
toolUseId: chunk.content_block.id
|
|
2570
|
+
});
|
|
2571
|
+
if (normalizedToolName === "computer_call") {
|
|
2572
|
+
markComputerToolUse(chunk.content_block.id);
|
|
2573
|
+
} else if (!toolUseIdArgumentBuffer.has(chunk.content_block.id)) {
|
|
2574
|
+
toolUseIdArgumentBuffer.set(chunk.content_block.id, "");
|
|
2575
|
+
}
|
|
1974
2576
|
delta1 = {
|
|
1975
2577
|
content: null,
|
|
1976
2578
|
tool_calls: [
|
|
1977
2579
|
{
|
|
1978
|
-
index:
|
|
2580
|
+
index: index1,
|
|
2581
|
+
id: chunk.content_block.id,
|
|
2582
|
+
type: "function",
|
|
2583
|
+
function: {
|
|
2584
|
+
name: normalizedToolName,
|
|
2585
|
+
arguments: ""
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
]
|
|
2589
|
+
};
|
|
2590
|
+
} else if (chunk.content_block.type === "server_tool_use") {
|
|
2591
|
+
index2 = getOrCreateIndexForToolUseId(chunk.content_block.id);
|
|
2592
|
+
assignBlockToToolUse({
|
|
2593
|
+
blockIndex: chunk.index,
|
|
2594
|
+
toolUseId: chunk.content_block.id
|
|
2595
|
+
});
|
|
2596
|
+
if (!toolUseIdArgumentBuffer.has(chunk.content_block.id)) {
|
|
2597
|
+
toolUseIdArgumentBuffer.set(chunk.content_block.id, "");
|
|
2598
|
+
}
|
|
2599
|
+
delta1 = {
|
|
2600
|
+
content: null,
|
|
2601
|
+
tool_calls: [
|
|
2602
|
+
{
|
|
2603
|
+
index: index2,
|
|
1979
2604
|
id: chunk.content_block.id,
|
|
1980
2605
|
type: "function",
|
|
1981
2606
|
function: {
|
|
@@ -1985,6 +2610,65 @@ var post5 = function(param) {
|
|
|
1985
2610
|
}
|
|
1986
2611
|
]
|
|
1987
2612
|
};
|
|
2613
|
+
} else if (chunk.content_block.type === "web_search_tool_result") {
|
|
2614
|
+
;
|
|
2615
|
+
outputPayload = {
|
|
2616
|
+
content: (_chunk_content_block_content = chunk.content_block.content) !== null && _chunk_content_block_content !== void 0 ? _chunk_content_block_content : []
|
|
2617
|
+
};
|
|
2618
|
+
;
|
|
2619
|
+
toolCallId = (_getToolUseIdFromBlock = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock !== void 0 ? _getToolUseIdFromBlock : "";
|
|
2620
|
+
index3 = getOrCreateIndexForToolUseId(toolCallId);
|
|
2621
|
+
assignBlockToToolUse({
|
|
2622
|
+
blockIndex: chunk.index,
|
|
2623
|
+
toolUseId: toolCallId
|
|
2624
|
+
});
|
|
2625
|
+
delta1 = {
|
|
2626
|
+
content: null,
|
|
2627
|
+
tool_calls: [
|
|
2628
|
+
{
|
|
2629
|
+
index: index3,
|
|
2630
|
+
id: toolCallId,
|
|
2631
|
+
type: "function",
|
|
2632
|
+
function: {
|
|
2633
|
+
output: JSON.stringify(outputPayload)
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
]
|
|
2637
|
+
};
|
|
2638
|
+
} else if ([
|
|
2639
|
+
"code_execution_tool_result",
|
|
2640
|
+
"bash_code_execution_tool_result",
|
|
2641
|
+
"python_code_execution_tool_result"
|
|
2642
|
+
].includes(chunk.content_block.type)) {
|
|
2643
|
+
;
|
|
2644
|
+
toolCallId1 = (_getToolUseIdFromBlock1 = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock1 !== void 0 ? _getToolUseIdFromBlock1 : "";
|
|
2645
|
+
_chunk_content_block = chunk.content_block, _toolUseId = _chunk_content_block.tool_use_id, _type = _chunk_content_block.type, _id = _chunk_content_block.id, rest = _object_without_properties(_chunk_content_block, [
|
|
2646
|
+
"tool_use_id",
|
|
2647
|
+
"type",
|
|
2648
|
+
"id"
|
|
2649
|
+
]);
|
|
2650
|
+
index4 = getOrCreateIndexForToolUseId(toolCallId1);
|
|
2651
|
+
assignBlockToToolUse({
|
|
2652
|
+
blockIndex: chunk.index,
|
|
2653
|
+
toolUseId: toolCallId1
|
|
2654
|
+
});
|
|
2655
|
+
;
|
|
2656
|
+
outputPayload1 = Object.keys(rest).length > 0 ? rest : {
|
|
2657
|
+
content: (_chunk_content_block_content1 = chunk.content_block.content) !== null && _chunk_content_block_content1 !== void 0 ? _chunk_content_block_content1 : {}
|
|
2658
|
+
};
|
|
2659
|
+
delta1 = {
|
|
2660
|
+
content: null,
|
|
2661
|
+
tool_calls: [
|
|
2662
|
+
{
|
|
2663
|
+
index: index4,
|
|
2664
|
+
id: toolCallId1,
|
|
2665
|
+
type: "function",
|
|
2666
|
+
function: {
|
|
2667
|
+
output: JSON.stringify(outputPayload1)
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
]
|
|
2671
|
+
};
|
|
1988
2672
|
} else if ("text" in chunk.content_block) {
|
|
1989
2673
|
delta1 = {
|
|
1990
2674
|
content: chunk.content_block.text
|
|
@@ -2105,10 +2789,22 @@ var post5 = function(param) {
|
|
|
2105
2789
|
];
|
|
2106
2790
|
case 3:
|
|
2107
2791
|
data = _state.sent();
|
|
2792
|
+
normalizedContent = Array.isArray(data === null || data === void 0 ? void 0 : data.content) ? data.content.map(function(block) {
|
|
2793
|
+
if ((block === null || block === void 0 ? void 0 : block.type) === "tool_use" && (block === null || block === void 0 ? void 0 : block.name) === "computer") {
|
|
2794
|
+
var _block_input;
|
|
2795
|
+
return _object_spread_props(_object_spread({}, block), {
|
|
2796
|
+
input: normalizeComputerToolCallPayload((_block_input = block.input) !== null && _block_input !== void 0 ? _block_input : {})
|
|
2797
|
+
});
|
|
2798
|
+
}
|
|
2799
|
+
return block;
|
|
2800
|
+
}) : data === null || data === void 0 ? void 0 : data.content;
|
|
2801
|
+
normalizedData = _object_spread({}, data, normalizedContent ? {
|
|
2802
|
+
content: normalizedContent
|
|
2803
|
+
} : {});
|
|
2108
2804
|
return [
|
|
2109
2805
|
2,
|
|
2110
2806
|
new Response(JSON.stringify({
|
|
2111
|
-
data:
|
|
2807
|
+
data: normalizedData
|
|
2112
2808
|
}), {
|
|
2113
2809
|
status: 200,
|
|
2114
2810
|
headers: {
|
|
@@ -2135,11 +2831,8 @@ var post5 = function(param) {
|
|
|
2135
2831
|
];
|
|
2136
2832
|
}
|
|
2137
2833
|
});
|
|
2138
|
-
});
|
|
2139
|
-
|
|
2140
|
-
return _ref.apply(this, arguments);
|
|
2141
|
-
};
|
|
2142
|
-
}();
|
|
2834
|
+
})();
|
|
2835
|
+
};
|
|
2143
2836
|
};
|
|
2144
2837
|
// src/adapters/client/anthropicClientAdapter/completions/index.ts
|
|
2145
2838
|
var completions5 = function(param) {
|
|
@@ -2168,8 +2861,8 @@ var anthropicClientAdapter = function(param) {
|
|
|
2168
2861
|
// src/adapters/client/togetherClientAdapter/models/get.ts
|
|
2169
2862
|
var get6 = function(param) {
|
|
2170
2863
|
var together = param.together;
|
|
2171
|
-
return
|
|
2172
|
-
|
|
2864
|
+
return function(_url, _options) {
|
|
2865
|
+
return _async_to_generator(function() {
|
|
2173
2866
|
var data, error;
|
|
2174
2867
|
return _ts_generator(this, function(_state) {
|
|
2175
2868
|
switch(_state.label){
|
|
@@ -2218,11 +2911,8 @@ var get6 = function(param) {
|
|
|
2218
2911
|
];
|
|
2219
2912
|
}
|
|
2220
2913
|
});
|
|
2221
|
-
});
|
|
2222
|
-
|
|
2223
|
-
return _ref.apply(this, arguments);
|
|
2224
|
-
};
|
|
2225
|
-
}();
|
|
2914
|
+
})();
|
|
2915
|
+
};
|
|
2226
2916
|
};
|
|
2227
2917
|
// src/adapters/client/togetherClientAdapter/models/index.ts
|
|
2228
2918
|
var models7 = function(param) {
|
|
@@ -2236,8 +2926,8 @@ var models7 = function(param) {
|
|
|
2236
2926
|
// src/adapters/client/togetherClientAdapter/completions/post.ts
|
|
2237
2927
|
var post6 = function(param) {
|
|
2238
2928
|
var together = param.together;
|
|
2239
|
-
return
|
|
2240
|
-
|
|
2929
|
+
return function(_url, options) {
|
|
2930
|
+
return _async_to_generator(function() {
|
|
2241
2931
|
var body, response, stream, data, error;
|
|
2242
2932
|
return _ts_generator(this, function(_state) {
|
|
2243
2933
|
switch(_state.label){
|
|
@@ -2399,11 +3089,8 @@ var post6 = function(param) {
|
|
|
2399
3089
|
];
|
|
2400
3090
|
}
|
|
2401
3091
|
});
|
|
2402
|
-
});
|
|
2403
|
-
|
|
2404
|
-
return _ref.apply(this, arguments);
|
|
2405
|
-
};
|
|
2406
|
-
}();
|
|
3092
|
+
})();
|
|
3093
|
+
};
|
|
2407
3094
|
};
|
|
2408
3095
|
// src/adapters/client/togetherClientAdapter/completions/index.ts
|
|
2409
3096
|
var completions6 = function(param) {
|
|
@@ -2441,8 +3128,8 @@ var models8 = [
|
|
|
2441
3128
|
];
|
|
2442
3129
|
var get7 = function(param) {
|
|
2443
3130
|
var google = param.google;
|
|
2444
|
-
return
|
|
2445
|
-
|
|
3131
|
+
return function(_url, _options) {
|
|
3132
|
+
return _async_to_generator(function() {
|
|
2446
3133
|
return _ts_generator(this, function(_state) {
|
|
2447
3134
|
try {
|
|
2448
3135
|
return [
|
|
@@ -2479,11 +3166,8 @@ var get7 = function(param) {
|
|
|
2479
3166
|
2
|
|
2480
3167
|
];
|
|
2481
3168
|
});
|
|
2482
|
-
});
|
|
2483
|
-
|
|
2484
|
-
return _ref.apply(this, arguments);
|
|
2485
|
-
};
|
|
2486
|
-
}();
|
|
3169
|
+
})();
|
|
3170
|
+
};
|
|
2487
3171
|
};
|
|
2488
3172
|
// src/adapters/client/googleClientAdapter/models/index.ts
|
|
2489
3173
|
var models9 = function(param) {
|
|
@@ -2498,8 +3182,8 @@ var models9 = function(param) {
|
|
|
2498
3182
|
import { createId } from "@paralleldrive/cuid2";
|
|
2499
3183
|
var post7 = function(param) {
|
|
2500
3184
|
var google = param.google;
|
|
2501
|
-
return
|
|
2502
|
-
|
|
3185
|
+
return function(_url, options) {
|
|
3186
|
+
return _async_to_generator(function() {
|
|
2503
3187
|
var body, resultOptions, response, stream, data, error;
|
|
2504
3188
|
return _ts_generator(this, function(_state) {
|
|
2505
3189
|
switch(_state.label){
|
|
@@ -2693,11 +3377,8 @@ var post7 = function(param) {
|
|
|
2693
3377
|
];
|
|
2694
3378
|
}
|
|
2695
3379
|
});
|
|
2696
|
-
});
|
|
2697
|
-
|
|
2698
|
-
return _ref.apply(this, arguments);
|
|
2699
|
-
};
|
|
2700
|
-
}();
|
|
3380
|
+
})();
|
|
3381
|
+
};
|
|
2701
3382
|
};
|
|
2702
3383
|
// src/adapters/client/googleClientAdapter/completions/index.ts
|
|
2703
3384
|
var completions7 = function(param) {
|
|
@@ -2729,8 +3410,8 @@ var models10 = [
|
|
|
2729
3410
|
];
|
|
2730
3411
|
var get8 = function(param) {
|
|
2731
3412
|
var humiris = param.humiris;
|
|
2732
|
-
return
|
|
2733
|
-
|
|
3413
|
+
return function(_url, _options) {
|
|
3414
|
+
return _async_to_generator(function() {
|
|
2734
3415
|
return _ts_generator(this, function(_state) {
|
|
2735
3416
|
try {
|
|
2736
3417
|
return [
|
|
@@ -2767,11 +3448,8 @@ var get8 = function(param) {
|
|
|
2767
3448
|
2
|
|
2768
3449
|
];
|
|
2769
3450
|
});
|
|
2770
|
-
});
|
|
2771
|
-
|
|
2772
|
-
return _ref.apply(this, arguments);
|
|
2773
|
-
};
|
|
2774
|
-
}();
|
|
3451
|
+
})();
|
|
3452
|
+
};
|
|
2775
3453
|
};
|
|
2776
3454
|
// src/adapters/client/humirisClientAdapter/models/index.ts
|
|
2777
3455
|
var models11 = function(param) {
|
|
@@ -2785,8 +3463,8 @@ var models11 = function(param) {
|
|
|
2785
3463
|
// src/adapters/client/humirisClientAdapter/completions/post.ts
|
|
2786
3464
|
var post8 = function(param) {
|
|
2787
3465
|
var humiris = param.humiris;
|
|
2788
|
-
return
|
|
2789
|
-
|
|
3466
|
+
return function(_url, options) {
|
|
3467
|
+
return _async_to_generator(function() {
|
|
2790
3468
|
var body, data, stream, data1, error;
|
|
2791
3469
|
return _ts_generator(this, function(_state) {
|
|
2792
3470
|
switch(_state.label){
|
|
@@ -2886,11 +3564,8 @@ var post8 = function(param) {
|
|
|
2886
3564
|
];
|
|
2887
3565
|
}
|
|
2888
3566
|
});
|
|
2889
|
-
});
|
|
2890
|
-
|
|
2891
|
-
return _ref.apply(this, arguments);
|
|
2892
|
-
};
|
|
2893
|
-
}();
|
|
3567
|
+
})();
|
|
3568
|
+
};
|
|
2894
3569
|
};
|
|
2895
3570
|
// src/adapters/client/humirisClientAdapter/completions/index.ts
|
|
2896
3571
|
var completions8 = function(param) {
|
|
@@ -2919,8 +3594,8 @@ var humirisClientAdapter = function(param) {
|
|
|
2919
3594
|
// src/adapters/client/ollamaClientAdapter/models/get.ts
|
|
2920
3595
|
var get9 = function(param) {
|
|
2921
3596
|
var ollama = param.ollama;
|
|
2922
|
-
return
|
|
2923
|
-
|
|
3597
|
+
return function(_url, _options) {
|
|
3598
|
+
return _async_to_generator(function() {
|
|
2924
3599
|
var data, error;
|
|
2925
3600
|
return _ts_generator(this, function(_state) {
|
|
2926
3601
|
switch(_state.label){
|
|
@@ -2965,11 +3640,8 @@ var get9 = function(param) {
|
|
|
2965
3640
|
];
|
|
2966
3641
|
}
|
|
2967
3642
|
});
|
|
2968
|
-
});
|
|
2969
|
-
|
|
2970
|
-
return _ref.apply(this, arguments);
|
|
2971
|
-
};
|
|
2972
|
-
}();
|
|
3643
|
+
})();
|
|
3644
|
+
};
|
|
2973
3645
|
};
|
|
2974
3646
|
// src/adapters/client/ollamaClientAdapter/models/index.ts
|
|
2975
3647
|
var models12 = function(param) {
|
|
@@ -2983,8 +3655,8 @@ var models12 = function(param) {
|
|
|
2983
3655
|
// src/adapters/client/ollamaClientAdapter/completions/post.ts
|
|
2984
3656
|
var post9 = function(param) {
|
|
2985
3657
|
var ollama = param.ollama;
|
|
2986
|
-
return
|
|
2987
|
-
|
|
3658
|
+
return function(_url, options) {
|
|
3659
|
+
return _async_to_generator(function() {
|
|
2988
3660
|
var body, response, stream, data, error;
|
|
2989
3661
|
return _ts_generator(this, function(_state) {
|
|
2990
3662
|
switch(_state.label){
|
|
@@ -3146,11 +3818,8 @@ var post9 = function(param) {
|
|
|
3146
3818
|
];
|
|
3147
3819
|
}
|
|
3148
3820
|
});
|
|
3149
|
-
});
|
|
3150
|
-
|
|
3151
|
-
return _ref.apply(this, arguments);
|
|
3152
|
-
};
|
|
3153
|
-
}();
|
|
3821
|
+
})();
|
|
3822
|
+
};
|
|
3154
3823
|
};
|
|
3155
3824
|
// src/adapters/client/ollamaClientAdapter/completions/index.ts
|
|
3156
3825
|
var completions9 = function(param) {
|
|
@@ -3178,7 +3847,7 @@ var ollamaClientAdapter = function(param) {
|
|
|
3178
3847
|
};
|
|
3179
3848
|
// src/adapters/run/completionsRunAdapter/index.ts
|
|
3180
3849
|
import _ from "lodash";
|
|
3181
|
-
import { uid as uid2, omit as
|
|
3850
|
+
import { uid as uid2, omit as omit4, isEmpty as isEmpty2 } from "radash";
|
|
3182
3851
|
import dayjs from "dayjs";
|
|
3183
3852
|
// src/adapters/run/completionsRunAdapter/messages/index.ts
|
|
3184
3853
|
import { flat } from "radash";
|
|
@@ -3267,13 +3936,13 @@ var serializeMessage3 = function(param) {
|
|
|
3267
3936
|
return result;
|
|
3268
3937
|
};
|
|
3269
3938
|
// src/adapters/run/completionsRunAdapter/messages/index.ts
|
|
3270
|
-
var messages =
|
|
3271
|
-
var
|
|
3272
|
-
|
|
3939
|
+
var messages = function(param) {
|
|
3940
|
+
var run3 = param.run, getMessages2 = param.getMessages;
|
|
3941
|
+
return _async_to_generator(function() {
|
|
3942
|
+
var _, _1;
|
|
3273
3943
|
return _ts_generator(this, function(_state) {
|
|
3274
3944
|
switch(_state.label){
|
|
3275
3945
|
case 0:
|
|
3276
|
-
run3 = param.run, getMessages2 = param.getMessages;
|
|
3277
3946
|
_1 = (_ = _to_consumable_array(run3.instructions ? [
|
|
3278
3947
|
{
|
|
3279
3948
|
role: "system",
|
|
@@ -3301,15 +3970,12 @@ var messages = /*#__PURE__*/ function() {
|
|
|
3301
3970
|
];
|
|
3302
3971
|
}
|
|
3303
3972
|
});
|
|
3304
|
-
});
|
|
3305
|
-
|
|
3306
|
-
return _ref.apply(this, arguments);
|
|
3307
|
-
};
|
|
3308
|
-
}();
|
|
3973
|
+
})();
|
|
3974
|
+
};
|
|
3309
3975
|
// src/adapters/run/completionsRunAdapter/index.ts
|
|
3310
3976
|
var updatedToolCall = function(param) {
|
|
3311
3977
|
var toolCall = param.toolCall, delta = param.delta;
|
|
3312
|
-
if (!toolCall) return
|
|
3978
|
+
if (!toolCall) return omit4(delta, [
|
|
3313
3979
|
"index"
|
|
3314
3980
|
]);
|
|
3315
3981
|
var result = _.cloneDeep(toolCall);
|
|
@@ -3340,10 +4006,11 @@ var toolCallsData = function(param) {
|
|
|
3340
4006
|
var prevToolCalls = param.prevToolCalls, delta = param.delta;
|
|
3341
4007
|
if (!prevToolCalls) {
|
|
3342
4008
|
return delta.tool_calls.map(function(tc) {
|
|
4009
|
+
var _tc_type;
|
|
3343
4010
|
return _object_spread({
|
|
3344
4011
|
id: uid2(24),
|
|
3345
|
-
type: "function"
|
|
3346
|
-
},
|
|
4012
|
+
type: (_tc_type = tc.type) !== null && _tc_type !== void 0 ? _tc_type : "function"
|
|
4013
|
+
}, omit4(tc, [
|
|
3347
4014
|
"index"
|
|
3348
4015
|
]));
|
|
3349
4016
|
});
|
|
@@ -3376,13 +4043,13 @@ var toolCallsData = function(param) {
|
|
|
3376
4043
|
};
|
|
3377
4044
|
var completionsRunAdapter = function() {
|
|
3378
4045
|
return {
|
|
3379
|
-
handleRun:
|
|
3380
|
-
var
|
|
3381
|
-
|
|
4046
|
+
handleRun: function(param) {
|
|
4047
|
+
var client = param.client, run3 = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages;
|
|
4048
|
+
return _async_to_generator(function() {
|
|
4049
|
+
var opts, _tmp, providerResponse, e, _e_cause, _e_message, _e_cause_message, message, toolCallsRunStep, currentContent, currentToolCalls, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices, choices, choice, delta, _delta_content, err, _message_toolCalls, messageToolCalls, functionToolCalls, pendingFunctionToolCalls, requiredToolCalls;
|
|
3382
4050
|
return _ts_generator(this, function(_state) {
|
|
3383
4051
|
switch(_state.label){
|
|
3384
4052
|
case 0:
|
|
3385
|
-
client = param.client, run3 = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages;
|
|
3386
4053
|
if (run3.status !== "queued") return [
|
|
3387
4054
|
2
|
|
3388
4055
|
];
|
|
@@ -3585,9 +4252,10 @@ var completionsRunAdapter = function() {
|
|
|
3585
4252
|
step_details: {
|
|
3586
4253
|
type: "tool_calls",
|
|
3587
4254
|
tool_calls: delta.tool_calls.map(function(tc) {
|
|
4255
|
+
var _tc_type;
|
|
3588
4256
|
return _object_spread({
|
|
3589
4257
|
id: uid2(24),
|
|
3590
|
-
type: "function"
|
|
4258
|
+
type: (_tc_type = tc.type) !== null && _tc_type !== void 0 ? _tc_type : "function"
|
|
3591
4259
|
}, tc);
|
|
3592
4260
|
})
|
|
3593
4261
|
}
|
|
@@ -3695,18 +4363,83 @@ var completionsRunAdapter = function() {
|
|
|
3695
4363
|
];
|
|
3696
4364
|
case 22:
|
|
3697
4365
|
message = _state.sent();
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
4366
|
+
messageToolCalls = (_message_toolCalls = message.toolCalls) !== null && _message_toolCalls !== void 0 ? _message_toolCalls : [];
|
|
4367
|
+
functionToolCalls = messageToolCalls.filter(function(toolCall) {
|
|
4368
|
+
return toolCall.type === "function";
|
|
4369
|
+
});
|
|
4370
|
+
pendingFunctionToolCalls = functionToolCalls.filter(function(toolCall) {
|
|
4371
|
+
var _toolCall_function;
|
|
4372
|
+
return !((_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.output);
|
|
4373
|
+
});
|
|
4374
|
+
if (!isEmpty2(pendingFunctionToolCalls)) return [
|
|
4375
|
+
3,
|
|
4376
|
+
25
|
|
4377
|
+
];
|
|
4378
|
+
if (!toolCallsRunStep) return [
|
|
4379
|
+
3,
|
|
4380
|
+
24
|
|
4381
|
+
];
|
|
4382
|
+
return [
|
|
4383
|
+
4,
|
|
4384
|
+
onEvent2({
|
|
4385
|
+
event: "thread.run.step.completed",
|
|
4386
|
+
data: _object_spread_props(_object_spread({}, toolCallsRunStep), {
|
|
4387
|
+
status: "completed",
|
|
4388
|
+
completed_at: dayjs().unix(),
|
|
4389
|
+
step_details: {
|
|
4390
|
+
type: "tool_calls",
|
|
4391
|
+
tool_calls: currentToolCalls !== null && currentToolCalls !== void 0 ? currentToolCalls : []
|
|
4392
|
+
}
|
|
3707
4393
|
})
|
|
3708
|
-
|
|
3709
|
-
|
|
4394
|
+
})
|
|
4395
|
+
];
|
|
4396
|
+
case 23:
|
|
4397
|
+
toolCallsRunStep = _state.sent();
|
|
4398
|
+
_state.label = 24;
|
|
4399
|
+
case 24:
|
|
4400
|
+
return [
|
|
4401
|
+
2,
|
|
4402
|
+
onEvent2({
|
|
4403
|
+
event: "thread.run.completed",
|
|
4404
|
+
data: _object_spread_props(_object_spread({}, run3), {
|
|
4405
|
+
status: "completed",
|
|
4406
|
+
completed_at: dayjs().unix()
|
|
4407
|
+
})
|
|
4408
|
+
})
|
|
4409
|
+
];
|
|
4410
|
+
case 25:
|
|
4411
|
+
requiredToolCalls = pendingFunctionToolCalls.map(function(toolCall) {
|
|
4412
|
+
var _toolCall_function, _toolCall_function1, _toolCall_function2;
|
|
4413
|
+
var _toolCall_function_arguments;
|
|
4414
|
+
var args = (_toolCall_function_arguments = (_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.arguments) !== null && _toolCall_function_arguments !== void 0 ? _toolCall_function_arguments : "";
|
|
4415
|
+
if (((_toolCall_function1 = toolCall.function) === null || _toolCall_function1 === void 0 ? void 0 : _toolCall_function1.name) === "computer_call") {
|
|
4416
|
+
var parsedArguments = {};
|
|
4417
|
+
try {
|
|
4418
|
+
parsedArguments = JSON.parse(args || "{}");
|
|
4419
|
+
} catch (e) {
|
|
4420
|
+
parsedArguments = {};
|
|
4421
|
+
}
|
|
4422
|
+
var _parsedArguments_action, _ref;
|
|
4423
|
+
var computerCall = {
|
|
4424
|
+
action: (_ref = (_parsedArguments_action = parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.action) !== null && _parsedArguments_action !== void 0 ? _parsedArguments_action : parsedArguments) !== null && _ref !== void 0 ? _ref : {},
|
|
4425
|
+
pending_safety_checks: Array.isArray(parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.pending_safety_checks) ? parsedArguments.pending_safety_checks : []
|
|
4426
|
+
};
|
|
4427
|
+
return {
|
|
4428
|
+
id: toolCall.id,
|
|
4429
|
+
type: "computer_call",
|
|
4430
|
+
computer_call: computerCall
|
|
4431
|
+
};
|
|
4432
|
+
}
|
|
4433
|
+
var _toolCall_function_name;
|
|
4434
|
+
return {
|
|
4435
|
+
id: toolCall.id,
|
|
4436
|
+
type: "function",
|
|
4437
|
+
function: {
|
|
4438
|
+
name: (_toolCall_function_name = (_toolCall_function2 = toolCall.function) === null || _toolCall_function2 === void 0 ? void 0 : _toolCall_function2.name) !== null && _toolCall_function_name !== void 0 ? _toolCall_function_name : "",
|
|
4439
|
+
arguments: args
|
|
4440
|
+
}
|
|
4441
|
+
};
|
|
4442
|
+
});
|
|
3710
4443
|
return [
|
|
3711
4444
|
2,
|
|
3712
4445
|
onEvent2({
|
|
@@ -3716,7 +4449,7 @@ var completionsRunAdapter = function() {
|
|
|
3716
4449
|
required_action: {
|
|
3717
4450
|
type: "submit_tool_outputs",
|
|
3718
4451
|
submit_tool_outputs: {
|
|
3719
|
-
tool_calls:
|
|
4452
|
+
tool_calls: requiredToolCalls
|
|
3720
4453
|
}
|
|
3721
4454
|
}
|
|
3722
4455
|
})
|
|
@@ -3724,11 +4457,8 @@ var completionsRunAdapter = function() {
|
|
|
3724
4457
|
];
|
|
3725
4458
|
}
|
|
3726
4459
|
});
|
|
3727
|
-
});
|
|
3728
|
-
|
|
3729
|
-
return _ref.apply(this, arguments);
|
|
3730
|
-
};
|
|
3731
|
-
}()
|
|
4460
|
+
})();
|
|
4461
|
+
}
|
|
3732
4462
|
};
|
|
3733
4463
|
};
|
|
3734
4464
|
// src/lib/messages/messagesRegexp.ts
|
|
@@ -3759,8 +4489,8 @@ var serializeThread = function(param) {
|
|
|
3759
4489
|
// src/adapters/storage/prismaStorageAdapter/threads/post.ts
|
|
3760
4490
|
var post10 = function(param) {
|
|
3761
4491
|
var prisma = param.prisma;
|
|
3762
|
-
return
|
|
3763
|
-
|
|
4492
|
+
return function(_urlString, options) {
|
|
4493
|
+
return _async_to_generator(function() {
|
|
3764
4494
|
var body, messages4, metadataRecord, assistantId, initialCreatedAt, messageData, threadData, thread;
|
|
3765
4495
|
return _ts_generator(this, function(_state) {
|
|
3766
4496
|
switch(_state.label){
|
|
@@ -3826,11 +4556,8 @@ var post10 = function(param) {
|
|
|
3826
4556
|
];
|
|
3827
4557
|
}
|
|
3828
4558
|
});
|
|
3829
|
-
});
|
|
3830
|
-
|
|
3831
|
-
return _ref.apply(this, arguments);
|
|
3832
|
-
};
|
|
3833
|
-
}();
|
|
4559
|
+
})();
|
|
4560
|
+
};
|
|
3834
4561
|
};
|
|
3835
4562
|
// src/adapters/storage/prismaStorageAdapter/threads/index.ts
|
|
3836
4563
|
var threads = function(param) {
|
|
@@ -3898,8 +4625,8 @@ var messageContentBlocks = function(param) {
|
|
|
3898
4625
|
};
|
|
3899
4626
|
var post11 = function(param) {
|
|
3900
4627
|
var prisma = param.prisma;
|
|
3901
|
-
return
|
|
3902
|
-
|
|
4628
|
+
return function(urlString, options) {
|
|
4629
|
+
return _async_to_generator(function() {
|
|
3903
4630
|
var url, _url_pathname_match, threadId, body, role, content, metadata, message;
|
|
3904
4631
|
return _ts_generator(this, function(_state) {
|
|
3905
4632
|
switch(_state.label){
|
|
@@ -3939,18 +4666,15 @@ var post11 = function(param) {
|
|
|
3939
4666
|
];
|
|
3940
4667
|
}
|
|
3941
4668
|
});
|
|
3942
|
-
});
|
|
3943
|
-
|
|
3944
|
-
return _ref.apply(this, arguments);
|
|
3945
|
-
};
|
|
3946
|
-
}();
|
|
4669
|
+
})();
|
|
4670
|
+
};
|
|
3947
4671
|
};
|
|
3948
4672
|
// src/adapters/storage/prismaStorageAdapter/threads/messages/get.ts
|
|
3949
4673
|
import { assign as assign3, last } from "radash";
|
|
3950
4674
|
var get10 = function(param) {
|
|
3951
4675
|
var prisma = param.prisma;
|
|
3952
|
-
return
|
|
3953
|
-
|
|
4676
|
+
return function(urlString) {
|
|
4677
|
+
return _async_to_generator(function() {
|
|
3954
4678
|
var _last, url, _url_pathname_match, threadId, _assign3, limit, order, after, pageSize, messagesPlusOne, messages4, _last_id;
|
|
3955
4679
|
return _ts_generator(this, function(_state) {
|
|
3956
4680
|
switch(_state.label){
|
|
@@ -4001,11 +4725,8 @@ var get10 = function(param) {
|
|
|
4001
4725
|
];
|
|
4002
4726
|
}
|
|
4003
4727
|
});
|
|
4004
|
-
});
|
|
4005
|
-
|
|
4006
|
-
return _ref.apply(this, arguments);
|
|
4007
|
-
};
|
|
4008
|
-
}();
|
|
4728
|
+
})();
|
|
4729
|
+
};
|
|
4009
4730
|
};
|
|
4010
4731
|
// src/adapters/storage/prismaStorageAdapter/threads/messages/index.ts
|
|
4011
4732
|
var messages2 = function(param) {
|
|
@@ -4087,8 +4808,8 @@ var mapPrismaRun = function(run3) {
|
|
|
4087
4808
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/get.ts
|
|
4088
4809
|
var get11 = function(param) {
|
|
4089
4810
|
var prisma = param.prisma;
|
|
4090
|
-
return
|
|
4091
|
-
|
|
4811
|
+
return function(urlString) {
|
|
4812
|
+
return _async_to_generator(function() {
|
|
4092
4813
|
var _runs3_at, url, _url_pathname_match, threadId, _assign4, limit, order, after, pageSize, runsPlusOne, runs3, _runs3_at_id;
|
|
4093
4814
|
return _ts_generator(this, function(_state) {
|
|
4094
4815
|
switch(_state.label){
|
|
@@ -4139,11 +4860,8 @@ var get11 = function(param) {
|
|
|
4139
4860
|
];
|
|
4140
4861
|
}
|
|
4141
4862
|
});
|
|
4142
|
-
});
|
|
4143
|
-
|
|
4144
|
-
return _ref.apply(this, arguments);
|
|
4145
|
-
};
|
|
4146
|
-
}();
|
|
4863
|
+
})();
|
|
4864
|
+
};
|
|
4147
4865
|
};
|
|
4148
4866
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/post.ts
|
|
4149
4867
|
import dayjs7 from "dayjs";
|
|
@@ -4244,13 +4962,13 @@ var status = function(event) {
|
|
|
4244
4962
|
if (event.data.status === "expired") return "EXPIRED" /* EXPIRED */ ;
|
|
4245
4963
|
throw new Error("Unknown status: ".concat(event.data.status));
|
|
4246
4964
|
};
|
|
4247
|
-
var threadRunStepCreated =
|
|
4248
|
-
var
|
|
4249
|
-
|
|
4965
|
+
var threadRunStepCreated = function(param) {
|
|
4966
|
+
var prisma = param.prisma, event = param.event, controller = param.controller;
|
|
4967
|
+
return _async_to_generator(function() {
|
|
4968
|
+
var runStep, serializedRunStep;
|
|
4250
4969
|
return _ts_generator(this, function(_state) {
|
|
4251
4970
|
switch(_state.label){
|
|
4252
4971
|
case 0:
|
|
4253
|
-
prisma = param.prisma, event = param.event, controller = param.controller;
|
|
4254
4972
|
return [
|
|
4255
4973
|
4,
|
|
4256
4974
|
prisma.runStep.create({
|
|
@@ -4279,16 +4997,43 @@ var threadRunStepCreated = /*#__PURE__*/ function() {
|
|
|
4279
4997
|
];
|
|
4280
4998
|
}
|
|
4281
4999
|
});
|
|
4282
|
-
});
|
|
4283
|
-
|
|
4284
|
-
return _ref.apply(this, arguments);
|
|
4285
|
-
};
|
|
4286
|
-
}();
|
|
5000
|
+
})();
|
|
5001
|
+
};
|
|
4287
5002
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/threadRunStepDelta.ts
|
|
4288
5003
|
var threadRunStepDelta = function(param) {
|
|
4289
5004
|
var event = param.event, controller = param.controller;
|
|
4290
5005
|
return controller.enqueue(event);
|
|
4291
5006
|
};
|
|
5007
|
+
// src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/threadRunStepCompleted.ts
|
|
5008
|
+
var threadRunStepCompleted = function(param) {
|
|
5009
|
+
var prisma = param.prisma, event = param.event, controller = param.controller;
|
|
5010
|
+
return _async_to_generator(function() {
|
|
5011
|
+
return _ts_generator(this, function(_state) {
|
|
5012
|
+
switch(_state.label){
|
|
5013
|
+
case 0:
|
|
5014
|
+
controller.enqueue(event);
|
|
5015
|
+
return [
|
|
5016
|
+
4,
|
|
5017
|
+
prisma.runStep.update({
|
|
5018
|
+
where: {
|
|
5019
|
+
id: event.data.id
|
|
5020
|
+
},
|
|
5021
|
+
data: {
|
|
5022
|
+
status: "COMPLETED" /* COMPLETED */ ,
|
|
5023
|
+
stepDetails: event.data.step_details,
|
|
5024
|
+
completedAt: event.data.completed_at
|
|
5025
|
+
}
|
|
5026
|
+
})
|
|
5027
|
+
];
|
|
5028
|
+
case 1:
|
|
5029
|
+
_state.sent();
|
|
5030
|
+
return [
|
|
5031
|
+
2
|
|
5032
|
+
];
|
|
5033
|
+
}
|
|
5034
|
+
});
|
|
5035
|
+
})();
|
|
5036
|
+
};
|
|
4292
5037
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/threadMessageCreated.ts
|
|
4293
5038
|
var status2 = function(event) {
|
|
4294
5039
|
if (event.data.status === "completed") return "COMPLETED" /* COMPLETED */ ;
|
|
@@ -4296,13 +5041,13 @@ var status2 = function(event) {
|
|
|
4296
5041
|
if (event.data.status === "incomplete") return "INCOMPLETE" /* INCOMPLETE */ ;
|
|
4297
5042
|
throw new Error("Unknown status: ".concat(event.data.status));
|
|
4298
5043
|
};
|
|
4299
|
-
var threadMessageCreated =
|
|
4300
|
-
var
|
|
4301
|
-
|
|
5044
|
+
var threadMessageCreated = function(param) {
|
|
5045
|
+
var prisma = param.prisma, event = param.event, controller = param.controller;
|
|
5046
|
+
return _async_to_generator(function() {
|
|
5047
|
+
var message, serializedMessage;
|
|
4302
5048
|
return _ts_generator(this, function(_state) {
|
|
4303
5049
|
switch(_state.label){
|
|
4304
5050
|
case 0:
|
|
4305
|
-
prisma = param.prisma, event = param.event, controller = param.controller;
|
|
4306
5051
|
return [
|
|
4307
5052
|
4,
|
|
4308
5053
|
prisma.message.create({
|
|
@@ -4330,24 +5075,21 @@ var threadMessageCreated = /*#__PURE__*/ function() {
|
|
|
4330
5075
|
];
|
|
4331
5076
|
}
|
|
4332
5077
|
});
|
|
4333
|
-
});
|
|
4334
|
-
|
|
4335
|
-
return _ref.apply(this, arguments);
|
|
4336
|
-
};
|
|
4337
|
-
}();
|
|
5078
|
+
})();
|
|
5079
|
+
};
|
|
4338
5080
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/threadMessageDelta.ts
|
|
4339
5081
|
var threadMessageDelta = function(param) {
|
|
4340
5082
|
var event = param.event, controller = param.controller;
|
|
4341
5083
|
return controller.enqueue(event);
|
|
4342
5084
|
};
|
|
4343
5085
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/threadMessageCompleted.ts
|
|
4344
|
-
var threadMessageCompleted =
|
|
4345
|
-
var
|
|
4346
|
-
|
|
5086
|
+
var threadMessageCompleted = function(param) {
|
|
5087
|
+
var prisma = param.prisma, event = param.event, controller = param.controller;
|
|
5088
|
+
return _async_to_generator(function() {
|
|
5089
|
+
var toolCalls, latestRunStep;
|
|
4347
5090
|
return _ts_generator(this, function(_state) {
|
|
4348
5091
|
switch(_state.label){
|
|
4349
5092
|
case 0:
|
|
4350
|
-
prisma = param.prisma, event = param.event, controller = param.controller;
|
|
4351
5093
|
controller.enqueue(event);
|
|
4352
5094
|
toolCalls = event.data.tool_calls;
|
|
4353
5095
|
if (!(toolCalls !== void 0)) return [
|
|
@@ -4406,11 +5148,8 @@ var threadMessageCompleted = /*#__PURE__*/ function() {
|
|
|
4406
5148
|
];
|
|
4407
5149
|
}
|
|
4408
5150
|
});
|
|
4409
|
-
});
|
|
4410
|
-
|
|
4411
|
-
return _ref.apply(this, arguments);
|
|
4412
|
-
};
|
|
4413
|
-
}();
|
|
5151
|
+
})();
|
|
5152
|
+
};
|
|
4414
5153
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/index.ts
|
|
4415
5154
|
var handlers = {
|
|
4416
5155
|
"thread.run.in_progress": threadRunInProgress,
|
|
@@ -4419,6 +5158,7 @@ var handlers = {
|
|
|
4419
5158
|
"thread.run.requires_action": threadRunRequiresAction,
|
|
4420
5159
|
"thread.run.step.created": threadRunStepCreated,
|
|
4421
5160
|
"thread.run.step.delta": threadRunStepDelta,
|
|
5161
|
+
"thread.run.step.completed": threadRunStepCompleted,
|
|
4422
5162
|
"thread.message.created": threadMessageCreated,
|
|
4423
5163
|
"thread.message.delta": threadMessageDelta,
|
|
4424
5164
|
"thread.message.completed": threadMessageCompleted
|
|
@@ -4458,63 +5198,65 @@ var getTake = function(param) {
|
|
|
4458
5198
|
};
|
|
4459
5199
|
var getMessages = function(param) {
|
|
4460
5200
|
var prisma = param.prisma, run3 = param.run;
|
|
4461
|
-
return
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
5201
|
+
return function() {
|
|
5202
|
+
return _async_to_generator(function() {
|
|
5203
|
+
var take, messages4;
|
|
5204
|
+
return _ts_generator(this, function(_state) {
|
|
5205
|
+
switch(_state.label){
|
|
5206
|
+
case 0:
|
|
5207
|
+
take = getTake({
|
|
5208
|
+
run: run3
|
|
5209
|
+
});
|
|
5210
|
+
return [
|
|
5211
|
+
4,
|
|
5212
|
+
prisma.message.findMany(_object_spread({
|
|
5213
|
+
where: {
|
|
5214
|
+
threadId: run3.threadId
|
|
5215
|
+
},
|
|
5216
|
+
include: {
|
|
5217
|
+
run: {
|
|
5218
|
+
include: {
|
|
5219
|
+
runSteps: true
|
|
5220
|
+
}
|
|
4479
5221
|
}
|
|
5222
|
+
},
|
|
5223
|
+
orderBy: {
|
|
5224
|
+
createdAt: "asc"
|
|
4480
5225
|
}
|
|
4481
|
-
},
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
2,
|
|
4493
|
-
messages4.map(function(message) {
|
|
4494
|
-
return _object_spread_props(_object_spread({}, serializeMessage4({
|
|
4495
|
-
message: message
|
|
4496
|
-
})), {
|
|
4497
|
-
run: message.run ? _object_spread_props(_object_spread({}, serializeRun({
|
|
4498
|
-
run: mapPrismaRun(message.run)
|
|
5226
|
+
}, take ? {
|
|
5227
|
+
take: take
|
|
5228
|
+
} : {}))
|
|
5229
|
+
];
|
|
5230
|
+
case 1:
|
|
5231
|
+
messages4 = _state.sent();
|
|
5232
|
+
return [
|
|
5233
|
+
2,
|
|
5234
|
+
messages4.map(function(message) {
|
|
5235
|
+
return _object_spread_props(_object_spread({}, serializeMessage4({
|
|
5236
|
+
message: message
|
|
4499
5237
|
})), {
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
5238
|
+
run: message.run ? _object_spread_props(_object_spread({}, serializeRun({
|
|
5239
|
+
run: mapPrismaRun(message.run)
|
|
5240
|
+
})), {
|
|
5241
|
+
runSteps: message.run.runSteps.map(function(runStep) {
|
|
5242
|
+
return serializeRunStep({
|
|
5243
|
+
runStep: runStep
|
|
5244
|
+
});
|
|
5245
|
+
})
|
|
5246
|
+
}) : null
|
|
5247
|
+
});
|
|
5248
|
+
})
|
|
5249
|
+
];
|
|
5250
|
+
}
|
|
5251
|
+
});
|
|
5252
|
+
})();
|
|
5253
|
+
};
|
|
4512
5254
|
};
|
|
4513
5255
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/post.ts
|
|
4514
5256
|
var post12 = function(param) {
|
|
4515
5257
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
4516
|
-
return
|
|
4517
|
-
|
|
5258
|
+
return function(urlString, options) {
|
|
5259
|
+
return _async_to_generator(function() {
|
|
4518
5260
|
var url, _url_pathname_match, threadId, body, assistant_id, stream, assistant, _assign5, model, instructions, // additional_instructions,
|
|
4519
5261
|
tools, metadata, response_format, truncation_strategy, run3, data, readableStream;
|
|
4520
5262
|
return _ts_generator(this, function(_state) {
|
|
@@ -4678,11 +5420,8 @@ var post12 = function(param) {
|
|
|
4678
5420
|
];
|
|
4679
5421
|
}
|
|
4680
5422
|
});
|
|
4681
|
-
});
|
|
4682
|
-
|
|
4683
|
-
return _ref.apply(this, arguments);
|
|
4684
|
-
};
|
|
4685
|
-
}();
|
|
5423
|
+
})();
|
|
5424
|
+
};
|
|
4686
5425
|
};
|
|
4687
5426
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/index.ts
|
|
4688
5427
|
var runs = function(param) {
|
|
@@ -4700,8 +5439,8 @@ var runs = function(param) {
|
|
|
4700
5439
|
// src/adapters/storage/prismaStorageAdapter/threads/run/get.ts
|
|
4701
5440
|
var get12 = function(param) {
|
|
4702
5441
|
var prisma = param.prisma;
|
|
4703
|
-
return
|
|
4704
|
-
|
|
5442
|
+
return function(urlString) {
|
|
5443
|
+
return _async_to_generator(function() {
|
|
4705
5444
|
var url, _url_pathname_match, threadId, runId, run3;
|
|
4706
5445
|
return _ts_generator(this, function(_state) {
|
|
4707
5446
|
switch(_state.label){
|
|
@@ -4746,11 +5485,8 @@ var get12 = function(param) {
|
|
|
4746
5485
|
];
|
|
4747
5486
|
}
|
|
4748
5487
|
});
|
|
4749
|
-
});
|
|
4750
|
-
|
|
4751
|
-
return _ref.apply(this, arguments);
|
|
4752
|
-
};
|
|
4753
|
-
}();
|
|
5488
|
+
})();
|
|
5489
|
+
};
|
|
4754
5490
|
};
|
|
4755
5491
|
// src/adapters/storage/prismaStorageAdapter/threads/run/index.ts
|
|
4756
5492
|
var run = function(param) {
|
|
@@ -4765,8 +5501,8 @@ var run = function(param) {
|
|
|
4765
5501
|
import { assign as assign6 } from "radash";
|
|
4766
5502
|
var get13 = function(param) {
|
|
4767
5503
|
var prisma = param.prisma;
|
|
4768
|
-
return
|
|
4769
|
-
|
|
5504
|
+
return function(urlString) {
|
|
5505
|
+
return _async_to_generator(function() {
|
|
4770
5506
|
var _runSteps_at, url, _url_pathname_match, threadId, runId, _assign6, limit, order, after, pageSize, runStepsPlusOne, runSteps, _runSteps_at_id;
|
|
4771
5507
|
return _ts_generator(this, function(_state) {
|
|
4772
5508
|
switch(_state.label){
|
|
@@ -4818,11 +5554,8 @@ var get13 = function(param) {
|
|
|
4818
5554
|
];
|
|
4819
5555
|
}
|
|
4820
5556
|
});
|
|
4821
|
-
});
|
|
4822
|
-
|
|
4823
|
-
return _ref.apply(this, arguments);
|
|
4824
|
-
};
|
|
4825
|
-
}();
|
|
5557
|
+
})();
|
|
5558
|
+
};
|
|
4826
5559
|
};
|
|
4827
5560
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/steps/index.ts
|
|
4828
5561
|
var steps = function(param) {
|
|
@@ -4835,16 +5568,15 @@ var steps = function(param) {
|
|
|
4835
5568
|
};
|
|
4836
5569
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/submitToolOutputs/post/updateRun.ts
|
|
4837
5570
|
import dayjs8 from "dayjs";
|
|
4838
|
-
var updateRun =
|
|
4839
|
-
var
|
|
4840
|
-
|
|
5571
|
+
var updateRun = function(param) {
|
|
5572
|
+
var prisma = param.prisma, runId = param.runId, threadId = param.threadId, _param_onThreadRunStepCompleted = param.onThreadRunStepCompleted, onThreadRunStepCompleted = _param_onThreadRunStepCompleted === void 0 ? function() {} : _param_onThreadRunStepCompleted, tool_outputs = param.tool_outputs;
|
|
5573
|
+
return _async_to_generator(function() {
|
|
4841
5574
|
return _ts_generator(this, function(_state) {
|
|
4842
|
-
prisma = param.prisma, runId = param.runId, threadId = param.threadId, _param_onThreadRunStepCompleted = param.onThreadRunStepCompleted, onThreadRunStepCompleted = _param_onThreadRunStepCompleted === void 0 ? function() {} : _param_onThreadRunStepCompleted, tool_outputs = param.tool_outputs;
|
|
4843
|
-
// @ts-expect-error prisma transaction typing is broken
|
|
4844
5575
|
return [
|
|
4845
5576
|
2,
|
|
4846
|
-
prisma
|
|
4847
|
-
|
|
5577
|
+
// @ts-expect-error prisma transaction typing is broken
|
|
5578
|
+
prisma.$transaction(function(prisma2) {
|
|
5579
|
+
return _async_to_generator(function() {
|
|
4848
5580
|
var runSteps, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err;
|
|
4849
5581
|
return _ts_generator(this, function(_state) {
|
|
4850
5582
|
switch(_state.label){
|
|
@@ -4990,23 +5722,17 @@ var updateRun = /*#__PURE__*/ function() {
|
|
|
4990
5722
|
];
|
|
4991
5723
|
}
|
|
4992
5724
|
});
|
|
4993
|
-
});
|
|
4994
|
-
|
|
4995
|
-
return _ref.apply(this, arguments);
|
|
4996
|
-
};
|
|
4997
|
-
}())
|
|
5725
|
+
})();
|
|
5726
|
+
})
|
|
4998
5727
|
];
|
|
4999
5728
|
});
|
|
5000
|
-
});
|
|
5001
|
-
|
|
5002
|
-
return _ref.apply(this, arguments);
|
|
5003
|
-
};
|
|
5004
|
-
}();
|
|
5729
|
+
})();
|
|
5730
|
+
};
|
|
5005
5731
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
5006
5732
|
var post13 = function(param) {
|
|
5007
5733
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
5008
|
-
return
|
|
5009
|
-
|
|
5734
|
+
return function(urlString, options) {
|
|
5735
|
+
return _async_to_generator(function() {
|
|
5010
5736
|
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, readableStream, run3;
|
|
5011
5737
|
return _ts_generator(this, function(_state) {
|
|
5012
5738
|
switch(_state.label){
|
|
@@ -5033,11 +5759,10 @@ var post13 = function(param) {
|
|
|
5033
5759
|
runId: runId,
|
|
5034
5760
|
threadId: threadId,
|
|
5035
5761
|
tool_outputs: tool_outputs,
|
|
5036
|
-
onThreadRunStepCompleted:
|
|
5037
|
-
var
|
|
5038
|
-
|
|
5762
|
+
onThreadRunStepCompleted: function(param) {
|
|
5763
|
+
var runStep = param.runStep;
|
|
5764
|
+
return _async_to_generator(function() {
|
|
5039
5765
|
return _ts_generator(this, function(_state) {
|
|
5040
|
-
runStep = param.runStep;
|
|
5041
5766
|
controller.enqueue("data: ".concat(JSON.stringify({
|
|
5042
5767
|
event: "thread.run.step.completed",
|
|
5043
5768
|
data: serializeRunStep({
|
|
@@ -5048,11 +5773,8 @@ var post13 = function(param) {
|
|
|
5048
5773
|
2
|
|
5049
5774
|
];
|
|
5050
5775
|
});
|
|
5051
|
-
});
|
|
5052
|
-
|
|
5053
|
-
return _ref.apply(this, arguments);
|
|
5054
|
-
};
|
|
5055
|
-
}()
|
|
5776
|
+
})();
|
|
5777
|
+
}
|
|
5056
5778
|
})
|
|
5057
5779
|
];
|
|
5058
5780
|
case 1:
|
|
@@ -5168,11 +5890,8 @@ var post13 = function(param) {
|
|
|
5168
5890
|
];
|
|
5169
5891
|
}
|
|
5170
5892
|
});
|
|
5171
|
-
});
|
|
5172
|
-
|
|
5173
|
-
return _ref.apply(this, arguments);
|
|
5174
|
-
};
|
|
5175
|
-
}();
|
|
5893
|
+
})();
|
|
5894
|
+
};
|
|
5176
5895
|
};
|
|
5177
5896
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/submitToolOutputs/index.ts
|
|
5178
5897
|
var submitToolOutputs = function(param) {
|
|
@@ -5189,8 +5908,8 @@ var submitToolOutputs = function(param) {
|
|
|
5189
5908
|
import dayjs9 from "dayjs";
|
|
5190
5909
|
var post14 = function(param) {
|
|
5191
5910
|
var prisma = param.prisma;
|
|
5192
|
-
return
|
|
5193
|
-
|
|
5911
|
+
return function(_url, options) {
|
|
5912
|
+
return _async_to_generator(function() {
|
|
5194
5913
|
var body, model, instructions, assistant, data;
|
|
5195
5914
|
return _ts_generator(this, function(_state) {
|
|
5196
5915
|
switch(_state.label){
|
|
@@ -5233,11 +5952,8 @@ var post14 = function(param) {
|
|
|
5233
5952
|
];
|
|
5234
5953
|
}
|
|
5235
5954
|
});
|
|
5236
|
-
});
|
|
5237
|
-
|
|
5238
|
-
return _ref.apply(this, arguments);
|
|
5239
|
-
};
|
|
5240
|
-
}();
|
|
5955
|
+
})();
|
|
5956
|
+
};
|
|
5241
5957
|
};
|
|
5242
5958
|
// src/adapters/storage/prismaStorageAdapter/assistants/index.ts
|
|
5243
5959
|
var assistants = function(param) {
|
|
@@ -5294,8 +6010,8 @@ var serializeThread2 = function(param) {
|
|
|
5294
6010
|
// src/adapters/storage/responsesStorageAdapter/threads/post.ts
|
|
5295
6011
|
var post15 = function(param) {
|
|
5296
6012
|
var client = param.client;
|
|
5297
|
-
return
|
|
5298
|
-
|
|
6013
|
+
return function(_urlString, options) {
|
|
6014
|
+
return _async_to_generator(function() {
|
|
5299
6015
|
var body, messages4, metadata, conversation;
|
|
5300
6016
|
return _ts_generator(this, function(_state) {
|
|
5301
6017
|
switch(_state.label){
|
|
@@ -5339,11 +6055,8 @@ var post15 = function(param) {
|
|
|
5339
6055
|
];
|
|
5340
6056
|
}
|
|
5341
6057
|
});
|
|
5342
|
-
});
|
|
5343
|
-
|
|
5344
|
-
return _ref.apply(this, arguments);
|
|
5345
|
-
};
|
|
5346
|
-
}();
|
|
6058
|
+
})();
|
|
6059
|
+
};
|
|
5347
6060
|
};
|
|
5348
6061
|
// src/adapters/storage/responsesStorageAdapter/threads/index.ts
|
|
5349
6062
|
var threads2 = function(param) {
|
|
@@ -5515,8 +6228,8 @@ var messageContentBlocks2 = function(param) {
|
|
|
5515
6228
|
};
|
|
5516
6229
|
var post16 = function(param) {
|
|
5517
6230
|
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
5518
|
-
return
|
|
5519
|
-
|
|
6231
|
+
return function(urlString, options) {
|
|
6232
|
+
return _async_to_generator(function() {
|
|
5520
6233
|
var url, _url_pathname_match, threadId, body, role, content, _body_attachments, attachments, item, openaiAssistant;
|
|
5521
6234
|
return _ts_generator(this, function(_state) {
|
|
5522
6235
|
switch(_state.label){
|
|
@@ -5563,11 +6276,8 @@ var post16 = function(param) {
|
|
|
5563
6276
|
];
|
|
5564
6277
|
}
|
|
5565
6278
|
});
|
|
5566
|
-
});
|
|
5567
|
-
|
|
5568
|
-
return _ref.apply(this, arguments);
|
|
5569
|
-
};
|
|
5570
|
-
}();
|
|
6279
|
+
})();
|
|
6280
|
+
};
|
|
5571
6281
|
};
|
|
5572
6282
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/get.ts
|
|
5573
6283
|
import { assign as assign7 } from "radash";
|
|
@@ -5610,8 +6320,8 @@ function responseId(param) {
|
|
|
5610
6320
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/get.ts
|
|
5611
6321
|
var get14 = function(param) {
|
|
5612
6322
|
var client = param.client, runAdapter = param.runAdapter;
|
|
5613
|
-
return
|
|
5614
|
-
|
|
6323
|
+
return function(urlString) {
|
|
6324
|
+
return _async_to_generator(function() {
|
|
5615
6325
|
var url, _url_pathname_match, threadId, _assign7, limit, order, after, conversation, sortOrder, items, itemsWithRunIds, responseMap, timestampedItems, openaiAssistant;
|
|
5616
6326
|
return _ts_generator(this, function(_state) {
|
|
5617
6327
|
switch(_state.label){
|
|
@@ -5692,11 +6402,8 @@ var get14 = function(param) {
|
|
|
5692
6402
|
];
|
|
5693
6403
|
}
|
|
5694
6404
|
});
|
|
5695
|
-
});
|
|
5696
|
-
|
|
5697
|
-
return _ref.apply(this, arguments);
|
|
5698
|
-
};
|
|
5699
|
-
}();
|
|
6405
|
+
})();
|
|
6406
|
+
};
|
|
5700
6407
|
};
|
|
5701
6408
|
var mapItemsWithRunIds = function(param) {
|
|
5702
6409
|
var conversation = param.conversation, items = param.items;
|
|
@@ -5710,13 +6417,13 @@ var mapItemsWithRunIds = function(param) {
|
|
|
5710
6417
|
};
|
|
5711
6418
|
});
|
|
5712
6419
|
};
|
|
5713
|
-
var fetchResponsesForItems =
|
|
5714
|
-
var
|
|
5715
|
-
|
|
6420
|
+
var fetchResponsesForItems = function(param) {
|
|
6421
|
+
var client = param.client, items = param.items;
|
|
6422
|
+
return _async_to_generator(function() {
|
|
6423
|
+
var responseIds, results, map;
|
|
5716
6424
|
return _ts_generator(this, function(_state) {
|
|
5717
6425
|
switch(_state.label){
|
|
5718
6426
|
case 0:
|
|
5719
|
-
client = param.client, items = param.items;
|
|
5720
6427
|
responseIds = Array.from(new Set(items.map(function(param) {
|
|
5721
6428
|
var runId = param.runId;
|
|
5722
6429
|
return runId;
|
|
@@ -5743,11 +6450,8 @@ var fetchResponsesForItems = /*#__PURE__*/ function() {
|
|
|
5743
6450
|
];
|
|
5744
6451
|
}
|
|
5745
6452
|
});
|
|
5746
|
-
});
|
|
5747
|
-
|
|
5748
|
-
return _ref.apply(this, arguments);
|
|
5749
|
-
};
|
|
5750
|
-
}();
|
|
6453
|
+
})();
|
|
6454
|
+
};
|
|
5751
6455
|
var assignTimestamps = function(param) {
|
|
5752
6456
|
var items = param.items, responseMap = param.responseMap, sortOrder = param.sortOrder, conversationCreatedAt = param.conversationCreatedAt;
|
|
5753
6457
|
var itemsWithTimestamps = items.map(function(entry) {
|
|
@@ -5838,8 +6542,8 @@ var messages3 = function(param) {
|
|
|
5838
6542
|
};
|
|
5839
6543
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/get.ts
|
|
5840
6544
|
var get15 = function() {
|
|
5841
|
-
return
|
|
5842
|
-
|
|
6545
|
+
return function(urlString) {
|
|
6546
|
+
return _async_to_generator(function() {
|
|
5843
6547
|
return _ts_generator(this, function(_state) {
|
|
5844
6548
|
return [
|
|
5845
6549
|
2,
|
|
@@ -5855,11 +6559,8 @@ var get15 = function() {
|
|
|
5855
6559
|
})
|
|
5856
6560
|
];
|
|
5857
6561
|
});
|
|
5858
|
-
});
|
|
5859
|
-
|
|
5860
|
-
return _ref.apply(this, arguments);
|
|
5861
|
-
};
|
|
5862
|
-
}();
|
|
6562
|
+
})();
|
|
6563
|
+
};
|
|
5863
6564
|
};
|
|
5864
6565
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/post.ts
|
|
5865
6566
|
import { uid as uid4 } from "radash";
|
|
@@ -6266,11 +6967,8 @@ function appendItemIdsToConversationMetadata(param) {
|
|
|
6266
6967
|
changed: changed
|
|
6267
6968
|
};
|
|
6268
6969
|
}
|
|
6269
|
-
function saveResponseItemsToConversationMetadata(
|
|
6270
|
-
return
|
|
6271
|
-
}
|
|
6272
|
-
function _saveResponseItemsToConversationMetadata() {
|
|
6273
|
-
_saveResponseItemsToConversationMetadata = _async_to_generator(function(param) {
|
|
6970
|
+
function saveResponseItemsToConversationMetadata(_0) {
|
|
6971
|
+
return _async_to_generator(function(param) {
|
|
6274
6972
|
var client, threadId, responseId2, itemIds, conversation, _appendItemIdsToConversationMetadata, updated, changed;
|
|
6275
6973
|
return _ts_generator(this, function(_state) {
|
|
6276
6974
|
switch(_state.label){
|
|
@@ -6303,8 +7001,7 @@ function _saveResponseItemsToConversationMetadata() {
|
|
|
6303
7001
|
];
|
|
6304
7002
|
}
|
|
6305
7003
|
});
|
|
6306
|
-
});
|
|
6307
|
-
return _saveResponseItemsToConversationMetadata.apply(this, arguments);
|
|
7004
|
+
}).apply(this, arguments);
|
|
6308
7005
|
}
|
|
6309
7006
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/post.ts
|
|
6310
7007
|
var serializeTools2 = function(param) {
|
|
@@ -6338,8 +7035,8 @@ var defaultAssistant = {
|
|
|
6338
7035
|
};
|
|
6339
7036
|
var post17 = function(param) {
|
|
6340
7037
|
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
6341
|
-
return
|
|
6342
|
-
|
|
7038
|
+
return function(urlString, options) {
|
|
7039
|
+
return _async_to_generator(function() {
|
|
6343
7040
|
var url, _url_pathname_match, threadId, body, assistant_id, stream, _assign8, model, instructions, // additional_instructions,
|
|
6344
7041
|
tools, metadata, response_format, truncation_strategy, _tmp, response, readableStream, _response_output, itemIds, data;
|
|
6345
7042
|
return _ts_generator(this, function(_state) {
|
|
@@ -6407,19 +7104,16 @@ var post17 = function(param) {
|
|
|
6407
7104
|
runAdapter.handleRun({
|
|
6408
7105
|
threadId: threadId,
|
|
6409
7106
|
response: response,
|
|
6410
|
-
onEvent:
|
|
6411
|
-
|
|
7107
|
+
onEvent: function(event) {
|
|
7108
|
+
return _async_to_generator(function() {
|
|
6412
7109
|
return _ts_generator(this, function(_state) {
|
|
6413
7110
|
return [
|
|
6414
7111
|
2,
|
|
6415
7112
|
controller.enqueue("data: ".concat(JSON.stringify(event), "\n\n"))
|
|
6416
7113
|
];
|
|
6417
7114
|
});
|
|
6418
|
-
});
|
|
6419
|
-
|
|
6420
|
-
return _ref.apply(this, arguments);
|
|
6421
|
-
};
|
|
6422
|
-
}()
|
|
7115
|
+
})();
|
|
7116
|
+
}
|
|
6423
7117
|
})
|
|
6424
7118
|
];
|
|
6425
7119
|
case 1:
|
|
@@ -6511,11 +7205,8 @@ var post17 = function(param) {
|
|
|
6511
7205
|
];
|
|
6512
7206
|
}
|
|
6513
7207
|
});
|
|
6514
|
-
});
|
|
6515
|
-
|
|
6516
|
-
return _ref.apply(this, arguments);
|
|
6517
|
-
};
|
|
6518
|
-
}();
|
|
7208
|
+
})();
|
|
7209
|
+
};
|
|
6519
7210
|
};
|
|
6520
7211
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/index.ts
|
|
6521
7212
|
var runs2 = function(param) {
|
|
@@ -6532,8 +7223,8 @@ var runs2 = function(param) {
|
|
|
6532
7223
|
// src/adapters/storage/responsesStorageAdapter/threads/run/get.ts
|
|
6533
7224
|
var get16 = function(param) {
|
|
6534
7225
|
var client = param.client, runAdapter = param.runAdapter;
|
|
6535
|
-
return
|
|
6536
|
-
|
|
7226
|
+
return function(urlString) {
|
|
7227
|
+
return _async_to_generator(function() {
|
|
6537
7228
|
var url, _url_pathname_match, _threadId, runId, response, data, _tmp;
|
|
6538
7229
|
return _ts_generator(this, function(_state) {
|
|
6539
7230
|
switch(_state.label){
|
|
@@ -6573,11 +7264,8 @@ var get16 = function(param) {
|
|
|
6573
7264
|
];
|
|
6574
7265
|
}
|
|
6575
7266
|
});
|
|
6576
|
-
});
|
|
6577
|
-
|
|
6578
|
-
return _ref.apply(this, arguments);
|
|
6579
|
-
};
|
|
6580
|
-
}();
|
|
7267
|
+
})();
|
|
7268
|
+
};
|
|
6581
7269
|
};
|
|
6582
7270
|
// src/adapters/storage/responsesStorageAdapter/threads/run/index.ts
|
|
6583
7271
|
var run2 = function(param) {
|
|
@@ -7106,8 +7794,8 @@ var serializeItemAsReasoningRunStep = function(param) {
|
|
|
7106
7794
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
|
|
7107
7795
|
var get17 = function(param) {
|
|
7108
7796
|
var client = param.client, runAdapter = param.runAdapter;
|
|
7109
|
-
return
|
|
7110
|
-
|
|
7797
|
+
return function(urlString) {
|
|
7798
|
+
return _async_to_generator(function() {
|
|
7111
7799
|
var _last2, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data, _last2_id;
|
|
7112
7800
|
return _ts_generator(this, function(_state) {
|
|
7113
7801
|
switch(_state.label){
|
|
@@ -7266,11 +7954,8 @@ var get17 = function(param) {
|
|
|
7266
7954
|
];
|
|
7267
7955
|
}
|
|
7268
7956
|
});
|
|
7269
|
-
});
|
|
7270
|
-
|
|
7271
|
-
return _ref.apply(this, arguments);
|
|
7272
|
-
};
|
|
7273
|
-
}();
|
|
7957
|
+
})();
|
|
7958
|
+
};
|
|
7274
7959
|
};
|
|
7275
7960
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/steps/index.ts
|
|
7276
7961
|
var steps2 = function(param) {
|
|
@@ -7359,8 +8044,8 @@ var truncation2 = function(param) {
|
|
|
7359
8044
|
};
|
|
7360
8045
|
var post18 = function(param) {
|
|
7361
8046
|
var client = param.client, runAdapter = param.runAdapter;
|
|
7362
|
-
return
|
|
7363
|
-
|
|
8047
|
+
return function(urlString, options) {
|
|
8048
|
+
return _async_to_generator(function() {
|
|
7364
8049
|
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, toolCallOutputItems, input, previousResponse, openaiAssistant, response, readableStream;
|
|
7365
8050
|
return _ts_generator(this, function(_state) {
|
|
7366
8051
|
switch(_state.label){
|
|
@@ -7451,19 +8136,16 @@ var post18 = function(param) {
|
|
|
7451
8136
|
runAdapter.handleRun({
|
|
7452
8137
|
threadId: threadId,
|
|
7453
8138
|
response: response,
|
|
7454
|
-
onEvent:
|
|
7455
|
-
|
|
8139
|
+
onEvent: function(event) {
|
|
8140
|
+
return _async_to_generator(function() {
|
|
7456
8141
|
return _ts_generator(this, function(_state) {
|
|
7457
8142
|
return [
|
|
7458
8143
|
2,
|
|
7459
8144
|
controller.enqueue("data: ".concat(JSON.stringify(event), "\n\n"))
|
|
7460
8145
|
];
|
|
7461
8146
|
});
|
|
7462
|
-
});
|
|
7463
|
-
|
|
7464
|
-
return _ref.apply(this, arguments);
|
|
7465
|
-
};
|
|
7466
|
-
}()
|
|
8147
|
+
})();
|
|
8148
|
+
}
|
|
7467
8149
|
})
|
|
7468
8150
|
];
|
|
7469
8151
|
case 1:
|
|
@@ -7487,11 +8169,8 @@ var post18 = function(param) {
|
|
|
7487
8169
|
];
|
|
7488
8170
|
}
|
|
7489
8171
|
});
|
|
7490
|
-
});
|
|
7491
|
-
|
|
7492
|
-
return _ref.apply(this, arguments);
|
|
7493
|
-
};
|
|
7494
|
-
}();
|
|
8172
|
+
})();
|
|
8173
|
+
};
|
|
7495
8174
|
};
|
|
7496
8175
|
// src/adapters/storage/responsesStorageAdapter/threads/runs/submitToolOutputs/index.ts
|
|
7497
8176
|
var submitToolOutputs2 = function(param) {
|
|
@@ -7506,8 +8185,8 @@ var submitToolOutputs2 = function(param) {
|
|
|
7506
8185
|
// src/adapters/storage/responsesStorageAdapter/assistants/get.ts
|
|
7507
8186
|
var get18 = function(param) {
|
|
7508
8187
|
var runAdapter = param.runAdapter;
|
|
7509
|
-
return
|
|
7510
|
-
|
|
8188
|
+
return function(_urlString) {
|
|
8189
|
+
return _async_to_generator(function() {
|
|
7511
8190
|
var _, _1, _tmp;
|
|
7512
8191
|
return _ts_generator(this, function(_state) {
|
|
7513
8192
|
switch(_state.label){
|
|
@@ -7549,32 +8228,31 @@ var get18 = function(param) {
|
|
|
7549
8228
|
];
|
|
7550
8229
|
}
|
|
7551
8230
|
});
|
|
7552
|
-
});
|
|
7553
|
-
|
|
7554
|
-
return _ref.apply(this, arguments);
|
|
7555
|
-
};
|
|
7556
|
-
}();
|
|
8231
|
+
})();
|
|
8232
|
+
};
|
|
7557
8233
|
};
|
|
7558
8234
|
// src/adapters/storage/responsesStorageAdapter/assistants/post.ts
|
|
7559
8235
|
var post19 = function() {
|
|
7560
|
-
return
|
|
7561
|
-
return
|
|
7562
|
-
return
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
8236
|
+
return function() {
|
|
8237
|
+
return _async_to_generator(function() {
|
|
8238
|
+
return _ts_generator(this, function(_state) {
|
|
8239
|
+
return [
|
|
8240
|
+
2,
|
|
8241
|
+
new Response(JSON.stringify({
|
|
8242
|
+
error: {
|
|
8243
|
+
message: "Assistant creation is not implemented for the Responses storage adapter.",
|
|
8244
|
+
type: "not_implemented"
|
|
8245
|
+
}
|
|
8246
|
+
}), {
|
|
8247
|
+
status: 501,
|
|
8248
|
+
headers: {
|
|
8249
|
+
"Content-Type": "application/json"
|
|
8250
|
+
}
|
|
8251
|
+
})
|
|
8252
|
+
];
|
|
8253
|
+
});
|
|
8254
|
+
})();
|
|
8255
|
+
};
|
|
7578
8256
|
};
|
|
7579
8257
|
// src/adapters/storage/responsesStorageAdapter/assistants/index.ts
|
|
7580
8258
|
var assistants2 = function(param) {
|
|
@@ -7653,14 +8331,13 @@ var responsesRunAdapter = function(param) {
|
|
|
7653
8331
|
return p.then(function() {});
|
|
7654
8332
|
} : _param_waitUntil;
|
|
7655
8333
|
var cachedOpenaiAssistant = null;
|
|
7656
|
-
var getOpenaiAssistant =
|
|
7657
|
-
var _ref =
|
|
7658
|
-
|
|
7659
|
-
var
|
|
8334
|
+
var getOpenaiAssistant = function() {
|
|
8335
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, tmp = _ref.select, _ref1 = tmp === void 0 ? {} : tmp, _ref_id = _ref1.id, id = _ref_id === void 0 ? false : _ref_id;
|
|
8336
|
+
return _async_to_generator(function() {
|
|
8337
|
+
var args, _tmp;
|
|
7660
8338
|
return _ts_generator(this, function(_state) {
|
|
7661
8339
|
switch(_state.label){
|
|
7662
8340
|
case 0:
|
|
7663
|
-
_ref = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, tmp = _ref.select, _ref1 = tmp === void 0 ? {} : tmp, _ref_id = _ref1.id, id = _ref_id === void 0 ? false : _ref_id;
|
|
7664
8341
|
args = {
|
|
7665
8342
|
select: {
|
|
7666
8343
|
id: id
|
|
@@ -7701,18 +8378,15 @@ var responsesRunAdapter = function(param) {
|
|
|
7701
8378
|
];
|
|
7702
8379
|
}
|
|
7703
8380
|
});
|
|
7704
|
-
});
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
var _ref = _async_to_generator(function(param) {
|
|
7711
|
-
var client, threadId, response, onEvent2, responseCreatedResponse, responseCompletedResponse, toolCalls, mcpCalls, codeInterpreterCalls, itemIds, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, event, _, _tmp, _tmp1, _tmp2, _tmp3, _tmp4, _tmp5, _tmp6, _tmp7, _tmp8, _tmp9, _tmp10, _tmp11, _tmp12, _tmp13, _tmp14, _tmp15, _tmp16, _tmp17, _tmp18, _tmp19, _tmp20, _tmp21, _tmp22, _tmp23, _tmp24, _tmp25, _tmp26, _tmp27, _tmp28, _tmp29, _tmp30, _tmp31, _tmp32, _tmp33, _tmp34, _tmp35, _tmp36, _tmp37, _tmp38, _tmp39, _tmp40, _tmp41, _tmp42, _tmp43, _tmp44, _tmp45, _tmp46, _tmp47, _tmp48, _tmp49, _tmp50, _tmp51, _tmp52, _tmp53, _tmp54, _tmp55, _tmp56, _tmp57, _tmp58, _tmp59, _tmp60, _tmp61, _tmp62, _tmp63, _tmp64, _tmp65, _tmp66, _tmp67, _tmp68, _tmp69, _tmp70, _tmp71, _tmp72, _tmp73, _tmp74, _tmp75, _tmp76, _tmp77, _tmp78, _tmp79, _tmp80, _tmp81, _tmp82, _tmp83, _tmp84, _tmp85, _tmp86, _tmp87, _tmp88, _tmp89, _tmp90, _tmp91, _tmp92, _tmp93, _tmp94, _tmp95, toolCall, mcpCall, _tmp96, _tmp97, _tmp98, _tmp99, err, _responseCompletedResponse_output, toolCalls2, serializedRun, _tmp100, e, _tmp101, _tmp102;
|
|
8381
|
+
})();
|
|
8382
|
+
};
|
|
8383
|
+
var handleRun = function(param) {
|
|
8384
|
+
var client = param.client, threadId = param.threadId, response = param.response, onEvent2 = param.onEvent;
|
|
8385
|
+
return _async_to_generator(function() {
|
|
8386
|
+
var responseCreatedResponse, responseCompletedResponse, toolCalls, mcpCalls, codeInterpreterCalls, itemIds, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, event, _, _tmp, _tmp1, _tmp2, _tmp3, _tmp4, _tmp5, _tmp6, _tmp7, _tmp8, _tmp9, _tmp10, _tmp11, _tmp12, _tmp13, _tmp14, _tmp15, _tmp16, _tmp17, _tmp18, _tmp19, _tmp20, _tmp21, _tmp22, _tmp23, _tmp24, _tmp25, _tmp26, _tmp27, _tmp28, _tmp29, _tmp30, _tmp31, _tmp32, _tmp33, _tmp34, _tmp35, _tmp36, _tmp37, _tmp38, _tmp39, _tmp40, _tmp41, _tmp42, _tmp43, _tmp44, _tmp45, _tmp46, _tmp47, _tmp48, _tmp49, _tmp50, _tmp51, _tmp52, _tmp53, _tmp54, _tmp55, _tmp56, _tmp57, _tmp58, _tmp59, _tmp60, _tmp61, _tmp62, _tmp63, _tmp64, _tmp65, _tmp66, _tmp67, _tmp68, _tmp69, _tmp70, _tmp71, _tmp72, _tmp73, _tmp74, _tmp75, _tmp76, _tmp77, _tmp78, _tmp79, _tmp80, _tmp81, _tmp82, _tmp83, _tmp84, _tmp85, _tmp86, _tmp87, _tmp88, _tmp89, _tmp90, _tmp91, _tmp92, _tmp93, _tmp94, _tmp95, toolCall, mcpCall, _tmp96, _tmp97, _tmp98, _tmp99, err, _responseCompletedResponse_output, toolCalls2, serializedRun, _tmp100, e, _tmp101, _tmp102;
|
|
7712
8387
|
return _ts_generator(this, function(_state) {
|
|
7713
8388
|
switch(_state.label){
|
|
7714
8389
|
case 0:
|
|
7715
|
-
client = param.client, threadId = param.threadId, response = param.response, onEvent2 = param.onEvent;
|
|
7716
8390
|
responseCreatedResponse = null;
|
|
7717
8391
|
responseCompletedResponse = null;
|
|
7718
8392
|
toolCalls = {};
|
|
@@ -9593,8 +10267,8 @@ var responsesRunAdapter = function(param) {
|
|
|
9593
10267
|
155
|
|
9594
10268
|
];
|
|
9595
10269
|
case 154:
|
|
9596
|
-
waitUntil(new Promise(
|
|
9597
|
-
|
|
10270
|
+
waitUntil(new Promise(function(resolve) {
|
|
10271
|
+
return _async_to_generator(function() {
|
|
9598
10272
|
return _ts_generator(this, function(_state) {
|
|
9599
10273
|
switch(_state.label){
|
|
9600
10274
|
case 0:
|
|
@@ -9621,11 +10295,8 @@ var responsesRunAdapter = function(param) {
|
|
|
9621
10295
|
];
|
|
9622
10296
|
}
|
|
9623
10297
|
});
|
|
9624
|
-
});
|
|
9625
|
-
|
|
9626
|
-
return _ref.apply(this, arguments);
|
|
9627
|
-
};
|
|
9628
|
-
}()));
|
|
10298
|
+
})();
|
|
10299
|
+
}));
|
|
9629
10300
|
return [
|
|
9630
10301
|
7
|
|
9631
10302
|
];
|
|
@@ -9635,11 +10306,8 @@ var responsesRunAdapter = function(param) {
|
|
|
9635
10306
|
];
|
|
9636
10307
|
}
|
|
9637
10308
|
});
|
|
9638
|
-
});
|
|
9639
|
-
|
|
9640
|
-
return _ref.apply(this, arguments);
|
|
9641
|
-
};
|
|
9642
|
-
}();
|
|
10309
|
+
})();
|
|
10310
|
+
};
|
|
9643
10311
|
return {
|
|
9644
10312
|
handleRun: handleRun,
|
|
9645
10313
|
getOpenaiAssistant: getOpenaiAssistant
|