supercompat 3.14.0 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +354 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -4
- package/dist/index.d.ts +55 -4
- package/dist/index.js +346 -175
- package/dist/index.js.map +1 -1
- package/dist/supercompat.cjs +15 -6
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js +16 -7
- package/dist/supercompat.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -174,12 +174,22 @@ function _object_spread_props(target, source) {
|
|
|
174
174
|
}
|
|
175
175
|
function _object_without_properties(source, excluded) {
|
|
176
176
|
if (source == null) return {};
|
|
177
|
-
var target =
|
|
178
|
-
|
|
177
|
+
var target = {}, sourceKeys, key, i;
|
|
178
|
+
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
179
|
+
sourceKeys = Reflect.ownKeys(source);
|
|
180
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
181
|
+
key = sourceKeys[i];
|
|
182
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
183
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
184
|
+
target[key] = source[key];
|
|
185
|
+
}
|
|
186
|
+
return target;
|
|
187
|
+
}
|
|
188
|
+
target = _object_without_properties_loose(source, excluded);
|
|
179
189
|
if (Object.getOwnPropertySymbols) {
|
|
180
|
-
|
|
181
|
-
for(i = 0; i <
|
|
182
|
-
key =
|
|
190
|
+
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
191
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
192
|
+
key = sourceKeys[i];
|
|
183
193
|
if (excluded.indexOf(key) >= 0) continue;
|
|
184
194
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
185
195
|
target[key] = source[key];
|
|
@@ -189,12 +199,11 @@ function _object_without_properties(source, excluded) {
|
|
|
189
199
|
}
|
|
190
200
|
function _object_without_properties_loose(source, excluded) {
|
|
191
201
|
if (source == null) return {};
|
|
192
|
-
var target = {};
|
|
193
|
-
var sourceKeys = Object.keys(source);
|
|
194
|
-
var key, i;
|
|
202
|
+
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
195
203
|
for(i = 0; i < sourceKeys.length; i++){
|
|
196
204
|
key = sourceKeys[i];
|
|
197
205
|
if (excluded.indexOf(key) >= 0) continue;
|
|
206
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
198
207
|
target[key] = source[key];
|
|
199
208
|
}
|
|
200
209
|
return target;
|
|
@@ -226,9 +235,17 @@ function _ts_generator(thisArg, body) {
|
|
|
226
235
|
},
|
|
227
236
|
trys: [],
|
|
228
237
|
ops: []
|
|
229
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
230
|
-
return
|
|
231
|
-
|
|
238
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
239
|
+
return d(g, "next", {
|
|
240
|
+
value: verb(0)
|
|
241
|
+
}), d(g, "throw", {
|
|
242
|
+
value: verb(1)
|
|
243
|
+
}), d(g, "return", {
|
|
244
|
+
value: verb(2)
|
|
245
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
246
|
+
value: function() {
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
232
249
|
}), g;
|
|
233
250
|
function verb(n) {
|
|
234
251
|
return function(v) {
|
|
@@ -398,6 +415,9 @@ __export(index_exports, {
|
|
|
398
415
|
azureOpenaiClientAdapter: function() {
|
|
399
416
|
return azureOpenaiClientAdapter;
|
|
400
417
|
},
|
|
418
|
+
azureResponsesStorageAdapter: function() {
|
|
419
|
+
return azureResponsesStorageAdapter;
|
|
420
|
+
},
|
|
401
421
|
completionsRunAdapter: function() {
|
|
402
422
|
return completionsRunAdapter;
|
|
403
423
|
},
|
|
@@ -456,7 +476,8 @@ var storageRequestHandlers = function(param) {
|
|
|
456
476
|
client: wrappedClient
|
|
457
477
|
})
|
|
458
478
|
}),
|
|
459
|
-
client: wrappedClient
|
|
479
|
+
client: wrappedClient,
|
|
480
|
+
originalClient: client
|
|
460
481
|
});
|
|
461
482
|
return result.requestHandlers;
|
|
462
483
|
};
|
|
@@ -537,7 +558,7 @@ var supercompatFetch = function(param) {
|
|
|
537
558
|
args[_key] = arguments[_key];
|
|
538
559
|
}
|
|
539
560
|
return _async_to_generator(function() {
|
|
540
|
-
var _args, url, options, pathHandler,
|
|
561
|
+
var _ref, _args, url, options, pathHandler, method, requestHandler;
|
|
541
562
|
return _ts_generator(this, function(_state) {
|
|
542
563
|
_args = _sliced_to_array(args, 2), url = _args[0], options = _args[1];
|
|
543
564
|
pathHandler = findRequestHandler({
|
|
@@ -553,7 +574,7 @@ var supercompatFetch = function(param) {
|
|
|
553
574
|
})
|
|
554
575
|
];
|
|
555
576
|
}
|
|
556
|
-
method = (
|
|
577
|
+
method = (_ref = options === null || options === void 0 ? void 0 : options.method) !== null && _ref !== void 0 ? _ref : "";
|
|
557
578
|
requestHandler = pathHandler[method.toLowerCase()];
|
|
558
579
|
if (!requestHandler) {
|
|
559
580
|
return [
|
|
@@ -1241,16 +1262,16 @@ var models3 = function(param) {
|
|
|
1241
1262
|
};
|
|
1242
1263
|
};
|
|
1243
1264
|
// src/adapters/client/mistralClientAdapter/completions/serializeChunk.ts
|
|
1244
|
-
var serializeDelta = function(
|
|
1245
|
-
var
|
|
1265
|
+
var serializeDelta = function(_0) {
|
|
1266
|
+
var _ref = _0.delta, toolCalls = _ref.toolCalls, rest = _object_without_properties(_ref, [
|
|
1246
1267
|
"toolCalls"
|
|
1247
1268
|
]);
|
|
1248
1269
|
return _object_spread({}, rest, toolCalls ? {
|
|
1249
1270
|
tool_calls: toolCalls
|
|
1250
1271
|
} : {});
|
|
1251
1272
|
};
|
|
1252
|
-
var serializeChoice = function(
|
|
1253
|
-
var
|
|
1273
|
+
var serializeChoice = function(_0) {
|
|
1274
|
+
var _ref = _0.choice, finishReason = _ref.finishReason, delta = _ref.delta, rest = _object_without_properties(_ref, [
|
|
1254
1275
|
"finishReason",
|
|
1255
1276
|
"delta"
|
|
1256
1277
|
]);
|
|
@@ -1272,10 +1293,10 @@ var serializeChunk = function(param) {
|
|
|
1272
1293
|
} : {});
|
|
1273
1294
|
};
|
|
1274
1295
|
// src/adapters/client/mistralClientAdapter/completions/serializeBody.ts
|
|
1275
|
-
var serializeMessage = function(
|
|
1276
|
-
var
|
|
1277
|
-
tool_calls =
|
|
1278
|
-
tool_call_id =
|
|
1296
|
+
var serializeMessage = function(_0) {
|
|
1297
|
+
var _ref = _0.message, // @ts-ignore-next-line
|
|
1298
|
+
tool_calls = _ref.tool_calls, // @ts-ignore-next-line
|
|
1299
|
+
tool_call_id = _ref.tool_call_id, rest = _object_without_properties(_ref, [
|
|
1279
1300
|
"tool_calls",
|
|
1280
1301
|
"tool_call_id"
|
|
1281
1302
|
]);
|
|
@@ -1920,7 +1941,7 @@ var serializeMessage2 = function(param) {
|
|
|
1920
1941
|
if (!trimmed) return {};
|
|
1921
1942
|
try {
|
|
1922
1943
|
return JSON.parse(trimmed);
|
|
1923
|
-
} catch (
|
|
1944
|
+
} catch (unused) {
|
|
1924
1945
|
return {};
|
|
1925
1946
|
}
|
|
1926
1947
|
};
|
|
@@ -2184,17 +2205,15 @@ var parseKeys = function(input) {
|
|
|
2184
2205
|
};
|
|
2185
2206
|
var normalizeKeys = function(keys) {
|
|
2186
2207
|
return keys.map(function(key) {
|
|
2187
|
-
var lowerKey = key.toLowerCase();
|
|
2188
2208
|
var _keyAliasMap_lowerKey;
|
|
2209
|
+
var lowerKey = key.toLowerCase();
|
|
2189
2210
|
return (_keyAliasMap_lowerKey = keyAliasMap[lowerKey]) !== null && _keyAliasMap_lowerKey !== void 0 ? _keyAliasMap_lowerKey : lowerKey;
|
|
2190
2211
|
});
|
|
2191
2212
|
};
|
|
2192
2213
|
var normalizeScroll = function(details) {
|
|
2193
|
-
var _sanitizeNumber;
|
|
2214
|
+
var _sanitizeNumber, _sanitizeNumber1, _ref, _sanitizeNumber2;
|
|
2194
2215
|
var scrollX = (_sanitizeNumber = sanitizeNumber(details.scroll_x)) !== null && _sanitizeNumber !== void 0 ? _sanitizeNumber : 0;
|
|
2195
|
-
var _sanitizeNumber1;
|
|
2196
2216
|
var scrollY = (_sanitizeNumber1 = sanitizeNumber(details.scroll_y)) !== null && _sanitizeNumber1 !== void 0 ? _sanitizeNumber1 : 0;
|
|
2197
|
-
var _sanitizeNumber2, _ref;
|
|
2198
2217
|
var amount = (_ref = (_sanitizeNumber2 = sanitizeNumber(details.scroll_amount)) !== null && _sanitizeNumber2 !== void 0 ? _sanitizeNumber2 : sanitizeNumber(details.amount)) !== null && _ref !== void 0 ? _ref : 0;
|
|
2199
2218
|
var direction = typeof details.scroll_direction === "string" ? details.scroll_direction.toLowerCase() : typeof details.direction === "string" ? details.direction.toLowerCase() : void 0;
|
|
2200
2219
|
if (!scrollX && !scrollY && direction && amount) {
|
|
@@ -2231,46 +2250,46 @@ var normalizeActionString = function(action, details) {
|
|
|
2231
2250
|
case "right_click":
|
|
2232
2251
|
case "middle_click":
|
|
2233
2252
|
{
|
|
2234
|
-
var
|
|
2253
|
+
var _ref, _ref1;
|
|
2235
2254
|
return {
|
|
2236
2255
|
type: "click",
|
|
2237
2256
|
button: clickButtonMap[action],
|
|
2238
|
-
x: (
|
|
2239
|
-
y: (
|
|
2257
|
+
x: (_ref = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref !== void 0 ? _ref : 0,
|
|
2258
|
+
y: (_ref1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref1 !== void 0 ? _ref1 : 0
|
|
2240
2259
|
};
|
|
2241
2260
|
}
|
|
2242
2261
|
case "double_click":
|
|
2243
|
-
var
|
|
2262
|
+
var _ref2, _ref3;
|
|
2244
2263
|
return {
|
|
2245
2264
|
type: "double_click",
|
|
2246
|
-
x: (
|
|
2247
|
-
y: (
|
|
2265
|
+
x: (_ref2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref2 !== void 0 ? _ref2 : 0,
|
|
2266
|
+
y: (_ref3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref3 !== void 0 ? _ref3 : 0
|
|
2248
2267
|
};
|
|
2249
2268
|
case "triple_click":
|
|
2250
|
-
var
|
|
2269
|
+
var _ref4, _ref5;
|
|
2251
2270
|
return {
|
|
2252
2271
|
type: "double_click",
|
|
2253
|
-
x: (
|
|
2254
|
-
y: (
|
|
2272
|
+
x: (_ref4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref4 !== void 0 ? _ref4 : 0,
|
|
2273
|
+
y: (_ref5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref5 !== void 0 ? _ref5 : 0,
|
|
2255
2274
|
repetitions: 3
|
|
2256
2275
|
};
|
|
2257
2276
|
case "left_mouse_down":
|
|
2258
|
-
var
|
|
2277
|
+
var _ref6, _ref7;
|
|
2259
2278
|
return {
|
|
2260
2279
|
type: "click",
|
|
2261
2280
|
button: clickButtonMap[action],
|
|
2262
2281
|
state: "down",
|
|
2263
|
-
x: (
|
|
2264
|
-
y: (
|
|
2282
|
+
x: (_ref6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref6 !== void 0 ? _ref6 : 0,
|
|
2283
|
+
y: (_ref7 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref7 !== void 0 ? _ref7 : 0
|
|
2265
2284
|
};
|
|
2266
2285
|
case "left_mouse_up":
|
|
2267
|
-
var
|
|
2286
|
+
var _ref8, _ref9;
|
|
2268
2287
|
return {
|
|
2269
2288
|
type: "click",
|
|
2270
2289
|
button: clickButtonMap[action],
|
|
2271
2290
|
state: "up",
|
|
2272
|
-
x: (
|
|
2273
|
-
y: (
|
|
2291
|
+
x: (_ref8 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref8 !== void 0 ? _ref8 : 0,
|
|
2292
|
+
y: (_ref9 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref9 !== void 0 ? _ref9 : 0
|
|
2274
2293
|
};
|
|
2275
2294
|
case "left_click_drag":
|
|
2276
2295
|
{
|
|
@@ -2288,20 +2307,20 @@ var normalizeActionString = function(action, details) {
|
|
|
2288
2307
|
}
|
|
2289
2308
|
case "mouse_move":
|
|
2290
2309
|
case "cursor_position":
|
|
2291
|
-
var
|
|
2310
|
+
var _ref10, _ref11;
|
|
2292
2311
|
return {
|
|
2293
2312
|
type: "move",
|
|
2294
|
-
x: (
|
|
2295
|
-
y: (
|
|
2313
|
+
x: (_ref10 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref10 !== void 0 ? _ref10 : 0,
|
|
2314
|
+
y: (_ref11 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref11 !== void 0 ? _ref11 : 0
|
|
2296
2315
|
};
|
|
2297
2316
|
case "scroll":
|
|
2298
2317
|
{
|
|
2318
|
+
var _ref12, _ref13;
|
|
2299
2319
|
var _normalizeScroll = normalizeScroll(details), scroll_x = _normalizeScroll.scroll_x, scroll_y = _normalizeScroll.scroll_y;
|
|
2300
|
-
var _coords_x6, _coords_y6;
|
|
2301
2320
|
return _object_spread({
|
|
2302
2321
|
type: "scroll",
|
|
2303
|
-
x: (
|
|
2304
|
-
y: (
|
|
2322
|
+
x: (_ref12 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref12 !== void 0 ? _ref12 : 0,
|
|
2323
|
+
y: (_ref13 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref13 !== void 0 ? _ref13 : 0,
|
|
2305
2324
|
scroll_x: scroll_x,
|
|
2306
2325
|
scroll_y: scroll_y
|
|
2307
2326
|
}, typeof details.scroll_direction === "string" ? {
|
|
@@ -2325,8 +2344,8 @@ var normalizeActionString = function(action, details) {
|
|
|
2325
2344
|
case "key":
|
|
2326
2345
|
case "hold_key":
|
|
2327
2346
|
{
|
|
2328
|
-
var
|
|
2329
|
-
var keys = normalizeKeys(parseKeys((
|
|
2347
|
+
var _ref14, _details_text;
|
|
2348
|
+
var keys = normalizeKeys(parseKeys((_ref14 = (_details_text = details.text) !== null && _details_text !== void 0 ? _details_text : details.keys) !== null && _ref14 !== void 0 ? _ref14 : details.key));
|
|
2330
2349
|
var normalized = {
|
|
2331
2350
|
type: "keypress",
|
|
2332
2351
|
keys: keys
|
|
@@ -2434,7 +2453,7 @@ var normalizeComputerToolCallPayload = function(payload) {
|
|
|
2434
2453
|
var parseJson = function(value) {
|
|
2435
2454
|
try {
|
|
2436
2455
|
return JSON.parse(value);
|
|
2437
|
-
} catch (
|
|
2456
|
+
} catch (unused) {
|
|
2438
2457
|
return void 0;
|
|
2439
2458
|
}
|
|
2440
2459
|
};
|
|
@@ -2492,7 +2511,7 @@ var post5 = function(param) {
|
|
|
2492
2511
|
stream = new ReadableStream({
|
|
2493
2512
|
start: function start(controller) {
|
|
2494
2513
|
return _async_to_generator(function() {
|
|
2495
|
-
var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex, parseJson2, getOrCreateIndexForToolUseId, assignBlockToToolUse, markComputerToolUse, getToolUseIdFromBlock, emitNormalizedToolCall, getOrCreateIndexForBlock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value,
|
|
2514
|
+
var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex, parseJson2, getOrCreateIndexForToolUseId, assignBlockToToolUse, markComputerToolUse, getToolUseIdFromBlock, emitNormalizedToolCall, getOrCreateIndexForBlock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, toolUseId, _toolUseIdArgumentBuffer_get, buffered, parsed, normalized, toolCallIndex, chunkIndex, _toolUseIdArgumentBuffer_get1, buffered1, toolCallIndex1, chunkIndex1, messageDelta, delta, toolUseId1, _toolUseIdArgumentBuffer_get2, _chunk_delta_partial_json, existing, updated, parsed1, normalized1, toolCallIndex2, chunkIndex2, _toolUseIdArgumentBuffer_get3, _chunk_delta_partial_json1, existing1, index, messageDelta1, delta1, toolName, normalizedToolName, index1, index2, _chunk_content_block_content, _getToolUseIdFromBlock, outputPayload, toolCallId, index3, _getToolUseIdFromBlock1, _chunk_content_block_content1, toolCallId1, _chunk_content_block, _toolUseId, _type, _id, rest, index4, outputPayload1, messageDelta2, messageDelta3, err;
|
|
2496
2515
|
return _ts_generator(this, function(_state) {
|
|
2497
2516
|
switch(_state.label){
|
|
2498
2517
|
case 0:
|
|
@@ -2505,18 +2524,18 @@ var post5 = function(param) {
|
|
|
2505
2524
|
parseJson2 = function(value) {
|
|
2506
2525
|
try {
|
|
2507
2526
|
return JSON.parse(value);
|
|
2508
|
-
} catch (
|
|
2527
|
+
} catch (unused) {
|
|
2509
2528
|
return void 0;
|
|
2510
2529
|
}
|
|
2511
2530
|
};
|
|
2512
2531
|
getOrCreateIndexForToolUseId = function(toolUseId) {
|
|
2532
|
+
var _toolUseIdToIndex_get;
|
|
2513
2533
|
if (!toolUseId) {
|
|
2514
2534
|
return 0;
|
|
2515
2535
|
}
|
|
2516
2536
|
if (!toolUseIdToIndex.has(toolUseId)) {
|
|
2517
2537
|
toolUseIdToIndex.set(toolUseId, nextToolCallIndex++);
|
|
2518
2538
|
}
|
|
2519
|
-
var _toolUseIdToIndex_get;
|
|
2520
2539
|
return (_toolUseIdToIndex_get = toolUseIdToIndex.get(toolUseId)) !== null && _toolUseIdToIndex_get !== void 0 ? _toolUseIdToIndex_get : 0;
|
|
2521
2540
|
};
|
|
2522
2541
|
assignBlockToToolUse = function(param) {
|
|
@@ -2593,8 +2612,7 @@ var post5 = function(param) {
|
|
|
2593
2612
|
5
|
|
2594
2613
|
];
|
|
2595
2614
|
_value = _step.value;
|
|
2596
|
-
|
|
2597
|
-
chunk = _ref;
|
|
2615
|
+
chunk = _value;
|
|
2598
2616
|
if (chunk.type === "content_block_stop") {
|
|
2599
2617
|
toolUseId = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
|
|
2600
2618
|
if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
|
|
@@ -2662,7 +2680,6 @@ var post5 = function(param) {
|
|
|
2662
2680
|
if (toolUseId1 && computerToolUseIds.has(toolUseId1)) {
|
|
2663
2681
|
;
|
|
2664
2682
|
existing = (_toolUseIdArgumentBuffer_get2 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get2 !== void 0 ? _toolUseIdArgumentBuffer_get2 : "";
|
|
2665
|
-
;
|
|
2666
2683
|
updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
|
|
2667
2684
|
toolUseIdArgumentBuffer.set(toolUseId1, updated);
|
|
2668
2685
|
if (!normalizedComputerCalls.has(toolUseId1)) {
|
|
@@ -2687,7 +2704,6 @@ var post5 = function(param) {
|
|
|
2687
2704
|
if (toolUseId1) {
|
|
2688
2705
|
;
|
|
2689
2706
|
existing1 = (_toolUseIdArgumentBuffer_get3 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get3 !== void 0 ? _toolUseIdArgumentBuffer_get3 : "";
|
|
2690
|
-
;
|
|
2691
2707
|
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 : ""));
|
|
2692
2708
|
}
|
|
2693
2709
|
index = getOrCreateIndexForBlock(chunk.index);
|
|
@@ -2778,7 +2794,6 @@ var post5 = function(param) {
|
|
|
2778
2794
|
outputPayload = {
|
|
2779
2795
|
content: (_chunk_content_block_content = chunk.content_block.content) !== null && _chunk_content_block_content !== void 0 ? _chunk_content_block_content : []
|
|
2780
2796
|
};
|
|
2781
|
-
;
|
|
2782
2797
|
toolCallId = (_getToolUseIdFromBlock = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock !== void 0 ? _getToolUseIdFromBlock : "";
|
|
2783
2798
|
index3 = getOrCreateIndexForToolUseId(toolCallId);
|
|
2784
2799
|
assignBlockToToolUse({
|
|
@@ -2815,7 +2830,6 @@ var post5 = function(param) {
|
|
|
2815
2830
|
blockIndex: chunk.index,
|
|
2816
2831
|
toolUseId: toolCallId1
|
|
2817
2832
|
});
|
|
2818
|
-
;
|
|
2819
2833
|
outputPayload1 = Object.keys(rest).length > 0 ? rest : {
|
|
2820
2834
|
content: (_chunk_content_block_content1 = chunk.content_block.content) !== null && _chunk_content_block_content1 !== void 0 ? _chunk_content_block_content1 : {}
|
|
2821
2835
|
};
|
|
@@ -3280,60 +3294,67 @@ var togetherClientAdapter = function(param) {
|
|
|
3280
3294
|
};
|
|
3281
3295
|
};
|
|
3282
3296
|
// src/adapters/client/googleClientAdapter/models/get.ts
|
|
3283
|
-
var models8 = [
|
|
3284
|
-
"gemini-2.5-flash-preview-04-17",
|
|
3285
|
-
"gemini-2.5-pro-preview-03-25",
|
|
3286
|
-
"gemini-2.0-flash",
|
|
3287
|
-
"gemini-2.0-flash-lite",
|
|
3288
|
-
"gemini-1.5-flash",
|
|
3289
|
-
"gemini-1.5-flash-8b",
|
|
3290
|
-
"gemini-1.5-pro"
|
|
3291
|
-
];
|
|
3292
3297
|
var get7 = function(param) {
|
|
3293
3298
|
var google = param.google;
|
|
3294
3299
|
return function(_url, _options) {
|
|
3295
3300
|
return _async_to_generator(function() {
|
|
3301
|
+
var response, error;
|
|
3296
3302
|
return _ts_generator(this, function(_state) {
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3303
|
+
switch(_state.label){
|
|
3304
|
+
case 0:
|
|
3305
|
+
_state.trys.push([
|
|
3306
|
+
0,
|
|
3307
|
+
2,
|
|
3308
|
+
,
|
|
3309
|
+
3
|
|
3310
|
+
]);
|
|
3311
|
+
return [
|
|
3312
|
+
4,
|
|
3313
|
+
google.models.list()
|
|
3314
|
+
];
|
|
3315
|
+
case 1:
|
|
3316
|
+
response = _state.sent();
|
|
3317
|
+
return [
|
|
3318
|
+
2,
|
|
3319
|
+
new Response(JSON.stringify({
|
|
3320
|
+
type: "list",
|
|
3321
|
+
data: response.data.map(function(model) {
|
|
3322
|
+
return {
|
|
3323
|
+
id: model.id,
|
|
3324
|
+
object: "model"
|
|
3325
|
+
};
|
|
3326
|
+
})
|
|
3327
|
+
}), {
|
|
3328
|
+
status: 200,
|
|
3329
|
+
headers: {
|
|
3330
|
+
"Content-Type": "application/json"
|
|
3331
|
+
}
|
|
3307
3332
|
})
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
];
|
|
3333
|
+
];
|
|
3334
|
+
case 2:
|
|
3335
|
+
error = _state.sent();
|
|
3336
|
+
return [
|
|
3337
|
+
2,
|
|
3338
|
+
new Response(JSON.stringify({
|
|
3339
|
+
error: error
|
|
3340
|
+
}), {
|
|
3341
|
+
status: 500,
|
|
3342
|
+
headers: {
|
|
3343
|
+
"Content-Type": "application/json"
|
|
3344
|
+
}
|
|
3345
|
+
})
|
|
3346
|
+
];
|
|
3347
|
+
case 3:
|
|
3348
|
+
return [
|
|
3349
|
+
2
|
|
3350
|
+
];
|
|
3327
3351
|
}
|
|
3328
|
-
return [
|
|
3329
|
-
2
|
|
3330
|
-
];
|
|
3331
3352
|
});
|
|
3332
3353
|
})();
|
|
3333
3354
|
};
|
|
3334
3355
|
};
|
|
3335
3356
|
// src/adapters/client/googleClientAdapter/models/index.ts
|
|
3336
|
-
var
|
|
3357
|
+
var models8 = function(param) {
|
|
3337
3358
|
var google = param.google;
|
|
3338
3359
|
return {
|
|
3339
3360
|
get: get7({
|
|
@@ -3558,7 +3579,7 @@ var googleClientAdapter = function(param) {
|
|
|
3558
3579
|
return {
|
|
3559
3580
|
client: google,
|
|
3560
3581
|
requestHandlers: {
|
|
3561
|
-
"^/v1/models$":
|
|
3582
|
+
"^/v1/models$": models8({
|
|
3562
3583
|
google: google
|
|
3563
3584
|
}),
|
|
3564
3585
|
"^/(?:v1|/?openai)/chat/completions$": completions7({
|
|
@@ -3568,7 +3589,7 @@ var googleClientAdapter = function(param) {
|
|
|
3568
3589
|
};
|
|
3569
3590
|
};
|
|
3570
3591
|
// src/adapters/client/humirisClientAdapter/models/get.ts
|
|
3571
|
-
var
|
|
3592
|
+
var models9 = [
|
|
3572
3593
|
"Humiris/humiris-moai"
|
|
3573
3594
|
];
|
|
3574
3595
|
var get8 = function(param) {
|
|
@@ -3581,7 +3602,7 @@ var get8 = function(param) {
|
|
|
3581
3602
|
2,
|
|
3582
3603
|
new Response(JSON.stringify({
|
|
3583
3604
|
type: "list",
|
|
3584
|
-
data:
|
|
3605
|
+
data: models9.map(function(model) {
|
|
3585
3606
|
return {
|
|
3586
3607
|
id: model,
|
|
3587
3608
|
object: "model"
|
|
@@ -3615,7 +3636,7 @@ var get8 = function(param) {
|
|
|
3615
3636
|
};
|
|
3616
3637
|
};
|
|
3617
3638
|
// src/adapters/client/humirisClientAdapter/models/index.ts
|
|
3618
|
-
var
|
|
3639
|
+
var models10 = function(param) {
|
|
3619
3640
|
var humiris = param.humiris;
|
|
3620
3641
|
return {
|
|
3621
3642
|
get: get8({
|
|
@@ -3745,7 +3766,7 @@ var humirisClientAdapter = function(param) {
|
|
|
3745
3766
|
return {
|
|
3746
3767
|
client: humiris,
|
|
3747
3768
|
requestHandlers: {
|
|
3748
|
-
"^/v1/models$":
|
|
3769
|
+
"^/v1/models$": models10({
|
|
3749
3770
|
humiris: humiris
|
|
3750
3771
|
}),
|
|
3751
3772
|
"^/(?:v1|/?openai)/chat/completions$": completions8({
|
|
@@ -3807,7 +3828,7 @@ var get9 = function(param) {
|
|
|
3807
3828
|
};
|
|
3808
3829
|
};
|
|
3809
3830
|
// src/adapters/client/ollamaClientAdapter/models/index.ts
|
|
3810
|
-
var
|
|
3831
|
+
var models11 = function(param) {
|
|
3811
3832
|
var ollama = param.ollama;
|
|
3812
3833
|
return {
|
|
3813
3834
|
get: get9({
|
|
@@ -3999,7 +4020,7 @@ var ollamaClientAdapter = function(param) {
|
|
|
3999
4020
|
return {
|
|
4000
4021
|
client: ollama,
|
|
4001
4022
|
requestHandlers: {
|
|
4002
|
-
"^/v1/models$":
|
|
4023
|
+
"^/v1/models$": models11({
|
|
4003
4024
|
ollama: ollama
|
|
4004
4025
|
}),
|
|
4005
4026
|
"^/(?:v1|/?openai)/chat/completions$": completions9({
|
|
@@ -4022,6 +4043,7 @@ var validToolCallContentTypes = [
|
|
|
4022
4043
|
];
|
|
4023
4044
|
var serializeToolContent = function(param) {
|
|
4024
4045
|
var toolCall = param.toolCall;
|
|
4046
|
+
var _toolCall_function_output;
|
|
4025
4047
|
if ((0, import_radash5.isArray)(toolCall.function.output)) {
|
|
4026
4048
|
var isEveryToolPartValid = toolCall.function.output.every(function(toolPart) {
|
|
4027
4049
|
if (!(0, import_radash5.isObject)(toolPart)) return false;
|
|
@@ -4032,7 +4054,6 @@ var serializeToolContent = function(param) {
|
|
|
4032
4054
|
}
|
|
4033
4055
|
return JSON.stringify(toolCall.function.output);
|
|
4034
4056
|
}
|
|
4035
|
-
var _toolCall_function_output;
|
|
4036
4057
|
return (_toolCall_function_output = toolCall.function.output) !== null && _toolCall_function_output !== void 0 ? _toolCall_function_output : "";
|
|
4037
4058
|
};
|
|
4038
4059
|
var serializeToolCall = function(param) {
|
|
@@ -4210,7 +4231,7 @@ var completionsRunAdapter = function() {
|
|
|
4210
4231
|
handleRun: function(param) {
|
|
4211
4232
|
var client = param.client, run4 = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages;
|
|
4212
4233
|
return _async_to_generator(function() {
|
|
4213
|
-
var opts, _tmp, providerResponse, e,
|
|
4234
|
+
var _message_toolCalls, opts, _tmp, providerResponse, e, _ref, _ref1, _e_cause, message, toolCallsRunStep, currentContent, currentToolCalls, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices, choices, choice, delta, _delta_content, err, messageToolCalls, functionToolCalls, pendingFunctionToolCalls, requiredToolCalls;
|
|
4214
4235
|
return _ts_generator(this, function(_state) {
|
|
4215
4236
|
switch(_state.label){
|
|
4216
4237
|
case 0:
|
|
@@ -4268,7 +4289,7 @@ var completionsRunAdapter = function() {
|
|
|
4268
4289
|
status: "in_progress",
|
|
4269
4290
|
last_error: {
|
|
4270
4291
|
code: "server_error",
|
|
4271
|
-
message: "".concat((
|
|
4292
|
+
message: "".concat((_ref = e === null || e === void 0 ? void 0 : e.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = e === null || e === void 0 ? void 0 : (_e_cause = e.cause) === null || _e_cause === void 0 ? void 0 : _e_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
|
|
4272
4293
|
}
|
|
4273
4294
|
})
|
|
4274
4295
|
})
|
|
@@ -4573,19 +4594,19 @@ var completionsRunAdapter = function() {
|
|
|
4573
4594
|
];
|
|
4574
4595
|
case 25:
|
|
4575
4596
|
requiredToolCalls = pendingFunctionToolCalls.map(function(toolCall) {
|
|
4597
|
+
var _ref, _ref1;
|
|
4576
4598
|
var _toolCall_function, _toolCall_function1, _toolCall_function2;
|
|
4577
|
-
var
|
|
4578
|
-
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 : "";
|
|
4599
|
+
var args = (_ref = (_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.arguments) !== null && _ref !== void 0 ? _ref : "";
|
|
4579
4600
|
if (((_toolCall_function1 = toolCall.function) === null || _toolCall_function1 === void 0 ? void 0 : _toolCall_function1.name) === "computer_call") {
|
|
4601
|
+
var _ref2, _ref3;
|
|
4580
4602
|
var parsedArguments = {};
|
|
4581
4603
|
try {
|
|
4582
4604
|
parsedArguments = JSON.parse(args || "{}");
|
|
4583
|
-
} catch (
|
|
4605
|
+
} catch (unused) {
|
|
4584
4606
|
parsedArguments = {};
|
|
4585
4607
|
}
|
|
4586
|
-
var _parsedArguments_action, _ref;
|
|
4587
4608
|
var computerCall = {
|
|
4588
|
-
action: (
|
|
4609
|
+
action: (_ref2 = (_ref3 = parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.action) !== null && _ref3 !== void 0 ? _ref3 : parsedArguments) !== null && _ref2 !== void 0 ? _ref2 : {},
|
|
4589
4610
|
pending_safety_checks: Array.isArray(parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.pending_safety_checks) ? parsedArguments.pending_safety_checks : []
|
|
4590
4611
|
};
|
|
4591
4612
|
return {
|
|
@@ -4594,12 +4615,11 @@ var completionsRunAdapter = function() {
|
|
|
4594
4615
|
computer_call: computerCall
|
|
4595
4616
|
};
|
|
4596
4617
|
}
|
|
4597
|
-
var _toolCall_function_name;
|
|
4598
4618
|
return {
|
|
4599
4619
|
id: toolCall.id,
|
|
4600
4620
|
type: "function",
|
|
4601
4621
|
function: {
|
|
4602
|
-
name: (
|
|
4622
|
+
name: (_ref1 = (_toolCall_function2 = toolCall.function) === null || _toolCall_function2 === void 0 ? void 0 : _toolCall_function2.name) !== null && _ref1 !== void 0 ? _ref1 : "",
|
|
4603
4623
|
arguments: args
|
|
4604
4624
|
}
|
|
4605
4625
|
};
|
|
@@ -4839,16 +4859,16 @@ var get10 = function(param) {
|
|
|
4839
4859
|
var prisma = param.prisma;
|
|
4840
4860
|
return function(urlString) {
|
|
4841
4861
|
return _async_to_generator(function() {
|
|
4842
|
-
var _this, url, _url_pathname_match, threadId,
|
|
4862
|
+
var _ref, _this, url, _url_pathname_match, threadId, _ref1, limit, order, after, pageSize, messagesPlusOne, messages5;
|
|
4843
4863
|
return _ts_generator(this, function(_state) {
|
|
4844
4864
|
switch(_state.label){
|
|
4845
4865
|
case 0:
|
|
4846
4866
|
url = new URL(urlString);
|
|
4847
4867
|
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(messagesRegexp)), 2), threadId = _url_pathname_match[1];
|
|
4848
|
-
|
|
4868
|
+
_ref1 = (0, import_radash10.assign)({
|
|
4849
4869
|
limit: "20",
|
|
4850
4870
|
order: "desc"
|
|
4851
|
-
}, Object.fromEntries(url.searchParams)), limit =
|
|
4871
|
+
}, Object.fromEntries(url.searchParams)), limit = _ref1.limit, order = _ref1.order, after = _ref1.after;
|
|
4852
4872
|
pageSize = parseInt(limit);
|
|
4853
4873
|
return [
|
|
4854
4874
|
4,
|
|
@@ -4879,7 +4899,7 @@ var get10 = function(param) {
|
|
|
4879
4899
|
});
|
|
4880
4900
|
}),
|
|
4881
4901
|
has_more: messagesPlusOne.length > pageSize,
|
|
4882
|
-
last_id: (
|
|
4902
|
+
last_id: (_ref = (_this = (0, import_radash10.last)(messages5)) === null || _this === void 0 ? void 0 : _this.id) !== null && _ref !== void 0 ? _ref : null
|
|
4883
4903
|
}), {
|
|
4884
4904
|
status: 200,
|
|
4885
4905
|
headers: {
|
|
@@ -4974,16 +4994,16 @@ var get11 = function(param) {
|
|
|
4974
4994
|
var prisma = param.prisma;
|
|
4975
4995
|
return function(urlString) {
|
|
4976
4996
|
return _async_to_generator(function() {
|
|
4977
|
-
var _runs4_at, url, _url_pathname_match, threadId,
|
|
4997
|
+
var _ref, _runs4_at, url, _url_pathname_match, threadId, _ref1, limit, order, after, pageSize, runsPlusOne, runs4;
|
|
4978
4998
|
return _ts_generator(this, function(_state) {
|
|
4979
4999
|
switch(_state.label){
|
|
4980
5000
|
case 0:
|
|
4981
5001
|
url = new URL(urlString);
|
|
4982
5002
|
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(runsRegexp)), 2), threadId = _url_pathname_match[1];
|
|
4983
|
-
|
|
5003
|
+
_ref1 = (0, import_radash11.assign)({
|
|
4984
5004
|
limit: "20",
|
|
4985
5005
|
order: "desc"
|
|
4986
|
-
}, Object.fromEntries(url.searchParams)), limit =
|
|
5006
|
+
}, Object.fromEntries(url.searchParams)), limit = _ref1.limit, order = _ref1.order, after = _ref1.after;
|
|
4987
5007
|
pageSize = parseInt(limit, 10);
|
|
4988
5008
|
return [
|
|
4989
5009
|
4,
|
|
@@ -5014,7 +5034,7 @@ var get11 = function(param) {
|
|
|
5014
5034
|
});
|
|
5015
5035
|
}),
|
|
5016
5036
|
has_more: runsPlusOne.length > pageSize,
|
|
5017
|
-
last_id: (
|
|
5037
|
+
last_id: (_ref = (_runs4_at = runs4.at(-1)) === null || _runs4_at === void 0 ? void 0 : _runs4_at.id) !== null && _ref !== void 0 ? _ref : null
|
|
5018
5038
|
}), {
|
|
5019
5039
|
status: 200,
|
|
5020
5040
|
headers: {
|
|
@@ -5490,7 +5510,7 @@ var post12 = function(param) {
|
|
|
5490
5510
|
readableStream = new ReadableStream({
|
|
5491
5511
|
start: function start(controller) {
|
|
5492
5512
|
return _async_to_generator(function() {
|
|
5493
|
-
var error,
|
|
5513
|
+
var error, _ref, _ref1, _error_cause;
|
|
5494
5514
|
return _ts_generator(this, function(_state) {
|
|
5495
5515
|
switch(_state.label){
|
|
5496
5516
|
case 0:
|
|
@@ -5541,7 +5561,7 @@ var post12 = function(param) {
|
|
|
5541
5561
|
failed_at: (0, import_dayjs7.default)().unix(),
|
|
5542
5562
|
last_error: {
|
|
5543
5563
|
code: "server_error",
|
|
5544
|
-
message: "".concat((
|
|
5564
|
+
message: "".concat((_ref = error === null || error === void 0 ? void 0 : error.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
|
|
5545
5565
|
}
|
|
5546
5566
|
}
|
|
5547
5567
|
});
|
|
@@ -5667,16 +5687,16 @@ var get13 = function(param) {
|
|
|
5667
5687
|
var prisma = param.prisma;
|
|
5668
5688
|
return function(urlString) {
|
|
5669
5689
|
return _async_to_generator(function() {
|
|
5670
|
-
var _runSteps_at, url, _url_pathname_match, threadId, runId,
|
|
5690
|
+
var _ref, _runSteps_at, url, _url_pathname_match, threadId, runId, _ref1, limit, order, after, pageSize, runStepsPlusOne, runSteps;
|
|
5671
5691
|
return _ts_generator(this, function(_state) {
|
|
5672
5692
|
switch(_state.label){
|
|
5673
5693
|
case 0:
|
|
5674
5694
|
url = new URL(urlString);
|
|
5675
5695
|
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(stepsRegexp)), 3), threadId = _url_pathname_match[1], runId = _url_pathname_match[2];
|
|
5676
|
-
|
|
5696
|
+
_ref1 = (0, import_radash13.assign)({
|
|
5677
5697
|
limit: "20",
|
|
5678
5698
|
order: "desc"
|
|
5679
|
-
}, Object.fromEntries(url.searchParams)), limit =
|
|
5699
|
+
}, Object.fromEntries(url.searchParams)), limit = _ref1.limit, order = _ref1.order, after = _ref1.after;
|
|
5680
5700
|
pageSize = parseInt(limit, 10);
|
|
5681
5701
|
return [
|
|
5682
5702
|
4,
|
|
@@ -5708,7 +5728,7 @@ var get13 = function(param) {
|
|
|
5708
5728
|
});
|
|
5709
5729
|
}),
|
|
5710
5730
|
has_more: runStepsPlusOne.length > pageSize,
|
|
5711
|
-
last_id: (
|
|
5731
|
+
last_id: (_ref = (_runSteps_at = runSteps.at(-1)) === null || _runSteps_at === void 0 ? void 0 : _runSteps_at.id) !== null && _ref !== void 0 ? _ref : null
|
|
5712
5732
|
}), {
|
|
5713
5733
|
status: 200,
|
|
5714
5734
|
headers: {
|
|
@@ -6468,7 +6488,7 @@ function responseId(param) {
|
|
|
6468
6488
|
try {
|
|
6469
6489
|
arr = JSON.parse(raw);
|
|
6470
6490
|
if (!Array.isArray(arr)) continue;
|
|
6471
|
-
} catch (
|
|
6491
|
+
} catch (unused) {
|
|
6472
6492
|
continue;
|
|
6473
6493
|
}
|
|
6474
6494
|
for(var j = arr.length - 1; j >= 0; j--){
|
|
@@ -6619,10 +6639,10 @@ var fetchResponsesForItems = function(param) {
|
|
|
6619
6639
|
var assignTimestamps = function(param) {
|
|
6620
6640
|
var items = param.items, responseMap = param.responseMap, sortOrder = param.sortOrder, conversationCreatedAt = param.conversationCreatedAt;
|
|
6621
6641
|
var itemsWithTimestamps = items.map(function(entry) {
|
|
6642
|
+
var _ref;
|
|
6622
6643
|
var _responseMap_get;
|
|
6623
|
-
var _responseMap_get_created_at;
|
|
6624
6644
|
return _object_spread_props(_object_spread({}, entry), {
|
|
6625
|
-
timestamp: entry.runId ? (
|
|
6645
|
+
timestamp: entry.runId ? (_ref = (_responseMap_get = responseMap.get(entry.runId)) === null || _responseMap_get === void 0 ? void 0 : _responseMap_get.created_at) !== null && _ref !== void 0 ? _ref : null : null,
|
|
6626
6646
|
assignedTimestamp: 0
|
|
6627
6647
|
});
|
|
6628
6648
|
});
|
|
@@ -6733,29 +6753,28 @@ var import_radash18 = require("radash");
|
|
|
6733
6753
|
// src/lib/responses/serializeResponseAsRun.ts
|
|
6734
6754
|
var serializeStatus = function(param) {
|
|
6735
6755
|
var response = param.response;
|
|
6756
|
+
var _ref;
|
|
6736
6757
|
var _response_status;
|
|
6737
6758
|
if (response.error) return "failed";
|
|
6738
|
-
|
|
6739
|
-
return (_response_status_toLowerCase = (_response_status = response.status) === null || _response_status === void 0 ? void 0 : _response_status.toLowerCase()) !== null && _response_status_toLowerCase !== void 0 ? _response_status_toLowerCase : "completed";
|
|
6759
|
+
return (_ref = (_response_status = response.status) === null || _response_status === void 0 ? void 0 : _response_status.toLowerCase()) !== null && _ref !== void 0 ? _ref : "completed";
|
|
6740
6760
|
};
|
|
6741
6761
|
var serializeUsage = function(param) {
|
|
6742
6762
|
var response = param.response;
|
|
6763
|
+
var _ref, _ref1, _ref2;
|
|
6743
6764
|
var _response_usage, _response_usage1, _response_usage2;
|
|
6744
|
-
var _response_usage_input_tokens, _response_usage_output_tokens, _response_usage_total_tokens;
|
|
6745
6765
|
return {
|
|
6746
|
-
prompt_tokens: (
|
|
6747
|
-
completion_tokens: (
|
|
6748
|
-
total_tokens: (
|
|
6766
|
+
prompt_tokens: (_ref = (_response_usage = response.usage) === null || _response_usage === void 0 ? void 0 : _response_usage.input_tokens) !== null && _ref !== void 0 ? _ref : 0,
|
|
6767
|
+
completion_tokens: (_ref1 = (_response_usage1 = response.usage) === null || _response_usage1 === void 0 ? void 0 : _response_usage1.output_tokens) !== null && _ref1 !== void 0 ? _ref1 : 0,
|
|
6768
|
+
total_tokens: (_ref2 = (_response_usage2 = response.usage) === null || _response_usage2 === void 0 ? void 0 : _response_usage2.total_tokens) !== null && _ref2 !== void 0 ? _ref2 : 0
|
|
6749
6769
|
};
|
|
6750
6770
|
};
|
|
6751
6771
|
var findPendingToolCalls = function(param) {
|
|
6752
6772
|
var response = param.response;
|
|
6753
|
-
var _response_output;
|
|
6773
|
+
var _response_output, _response_output1;
|
|
6754
6774
|
var toolCalls = ((_response_output = response.output) !== null && _response_output !== void 0 ? _response_output : []).filter(function(item) {
|
|
6755
6775
|
return item.type === "function_call";
|
|
6756
6776
|
});
|
|
6757
6777
|
if (toolCalls.length === 0) return [];
|
|
6758
|
-
var _response_output1;
|
|
6759
6778
|
var completedCallIds = new Set(((_response_output1 = response.output) !== null && _response_output1 !== void 0 ? _response_output1 : []).filter(function(item) {
|
|
6760
6779
|
return(// @ts-expect-error missing openai type
|
|
6761
6780
|
item.type === "function_call_output");
|
|
@@ -6841,7 +6860,7 @@ function parseBucket(param) {
|
|
|
6841
6860
|
try {
|
|
6842
6861
|
var arr = JSON.parse(value);
|
|
6843
6862
|
return Array.isArray(arr) ? arr : [];
|
|
6844
|
-
} catch (
|
|
6863
|
+
} catch (unused) {
|
|
6845
6864
|
return [];
|
|
6846
6865
|
}
|
|
6847
6866
|
}
|
|
@@ -7254,7 +7273,7 @@ var post17 = function(param) {
|
|
|
7254
7273
|
readableStream = new ReadableStream({
|
|
7255
7274
|
start: function start(controller) {
|
|
7256
7275
|
return _async_to_generator(function() {
|
|
7257
|
-
var error,
|
|
7276
|
+
var error, _ref, _ref1, _error_cause, event;
|
|
7258
7277
|
return _ts_generator(this, function(_state) {
|
|
7259
7278
|
switch(_state.label){
|
|
7260
7279
|
case 0:
|
|
@@ -7297,7 +7316,7 @@ var post17 = function(param) {
|
|
|
7297
7316
|
failed_at: (0, import_dayjs11.default)().unix(),
|
|
7298
7317
|
last_error: {
|
|
7299
7318
|
code: "server_error",
|
|
7300
|
-
message: "".concat((
|
|
7319
|
+
message: "".concat((_ref = error === null || error === void 0 ? void 0 : error.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
|
|
7301
7320
|
}
|
|
7302
7321
|
}
|
|
7303
7322
|
};
|
|
@@ -7740,7 +7759,7 @@ var serializeStatus5 = function(param) {
|
|
|
7740
7759
|
};
|
|
7741
7760
|
var serializeItemAsMcpCallRunStep = function(param) {
|
|
7742
7761
|
var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs17.default)().unix() : _param_completedAt;
|
|
7743
|
-
var
|
|
7762
|
+
var _ref, _item_output;
|
|
7744
7763
|
var toolCall = {
|
|
7745
7764
|
id: "ftc".concat(item.id),
|
|
7746
7765
|
type: "function",
|
|
@@ -7961,7 +7980,7 @@ var get17 = function(param) {
|
|
|
7961
7980
|
var client = param.client, runAdapter = param.runAdapter;
|
|
7962
7981
|
return function(urlString) {
|
|
7963
7982
|
return _async_to_generator(function() {
|
|
7964
|
-
var _this, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data
|
|
7983
|
+
var _ref, _this, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data;
|
|
7965
7984
|
return _ts_generator(this, function(_state) {
|
|
7966
7985
|
switch(_state.label){
|
|
7967
7986
|
case 0:
|
|
@@ -8109,7 +8128,7 @@ var get17 = function(param) {
|
|
|
8109
8128
|
new Response(JSON.stringify({
|
|
8110
8129
|
data: data,
|
|
8111
8130
|
has_more: false,
|
|
8112
|
-
last_id: (
|
|
8131
|
+
last_id: (_ref = (_this = (0, import_radash22.last)(response.output)) === null || _this === void 0 ? void 0 : _this.id) !== null && _ref !== void 0 ? _ref : null
|
|
8113
8132
|
}), {
|
|
8114
8133
|
status: 200,
|
|
8115
8134
|
headers: {
|
|
@@ -8152,7 +8171,7 @@ var computerCallOutput = function(param) {
|
|
|
8152
8171
|
var parsedOutput;
|
|
8153
8172
|
try {
|
|
8154
8173
|
parsedOutput = JSON.parse(toolOutput.output);
|
|
8155
|
-
} catch (
|
|
8174
|
+
} catch (unused) {
|
|
8156
8175
|
return {
|
|
8157
8176
|
isComputerCallOutput: false
|
|
8158
8177
|
};
|
|
@@ -8464,6 +8483,155 @@ var responsesStorageAdapter = function() {
|
|
|
8464
8483
|
};
|
|
8465
8484
|
};
|
|
8466
8485
|
};
|
|
8486
|
+
// src/adapters/storage/azureResponsesStorageAdapter/index.ts
|
|
8487
|
+
var azureResponsesStorageAdapter = function() {
|
|
8488
|
+
var createResponseItems = [];
|
|
8489
|
+
var cachedClient = null;
|
|
8490
|
+
return function(param) {
|
|
8491
|
+
var runAdapter = param.runAdapter, client = param.client, originalClient = param.originalClient;
|
|
8492
|
+
var getAIProjectClient = function() {
|
|
8493
|
+
if (originalClient && (typeof originalClient === "undefined" ? "undefined" : _type_of(originalClient)) === "object" && "client" in originalClient) {
|
|
8494
|
+
return originalClient.client;
|
|
8495
|
+
}
|
|
8496
|
+
return client;
|
|
8497
|
+
};
|
|
8498
|
+
var getAzureClient = function() {
|
|
8499
|
+
return _async_to_generator(function() {
|
|
8500
|
+
var aiProjectClient, azureClient;
|
|
8501
|
+
return _ts_generator(this, function(_state) {
|
|
8502
|
+
switch(_state.label){
|
|
8503
|
+
case 0:
|
|
8504
|
+
if (cachedClient) {
|
|
8505
|
+
return [
|
|
8506
|
+
2,
|
|
8507
|
+
cachedClient
|
|
8508
|
+
];
|
|
8509
|
+
}
|
|
8510
|
+
aiProjectClient = getAIProjectClient();
|
|
8511
|
+
if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
|
|
8512
|
+
3,
|
|
8513
|
+
2
|
|
8514
|
+
];
|
|
8515
|
+
return [
|
|
8516
|
+
4,
|
|
8517
|
+
aiProjectClient.getOpenAIClient()
|
|
8518
|
+
];
|
|
8519
|
+
case 1:
|
|
8520
|
+
azureClient = _state.sent();
|
|
8521
|
+
cachedClient = azureClient;
|
|
8522
|
+
return [
|
|
8523
|
+
2,
|
|
8524
|
+
azureClient
|
|
8525
|
+
];
|
|
8526
|
+
case 2:
|
|
8527
|
+
cachedClient = aiProjectClient;
|
|
8528
|
+
return [
|
|
8529
|
+
2,
|
|
8530
|
+
aiProjectClient
|
|
8531
|
+
];
|
|
8532
|
+
}
|
|
8533
|
+
});
|
|
8534
|
+
})();
|
|
8535
|
+
};
|
|
8536
|
+
var wrappedRunAdapter = _object_spread_props(_object_spread({}, runAdapter), {
|
|
8537
|
+
handleRun: function(args) {
|
|
8538
|
+
return _async_to_generator(function() {
|
|
8539
|
+
var azureClient;
|
|
8540
|
+
return _ts_generator(this, function(_state) {
|
|
8541
|
+
switch(_state.label){
|
|
8542
|
+
case 0:
|
|
8543
|
+
return [
|
|
8544
|
+
4,
|
|
8545
|
+
getAzureClient()
|
|
8546
|
+
];
|
|
8547
|
+
case 1:
|
|
8548
|
+
azureClient = _state.sent();
|
|
8549
|
+
return [
|
|
8550
|
+
2,
|
|
8551
|
+
runAdapter.handleRun(_object_spread_props(_object_spread({}, args), {
|
|
8552
|
+
client: azureClient
|
|
8553
|
+
}))
|
|
8554
|
+
];
|
|
8555
|
+
}
|
|
8556
|
+
});
|
|
8557
|
+
})();
|
|
8558
|
+
}
|
|
8559
|
+
});
|
|
8560
|
+
var wrapHandlerMethod = function(handlerFactory, method) {
|
|
8561
|
+
return function(urlString, options) {
|
|
8562
|
+
return _async_to_generator(function() {
|
|
8563
|
+
var openaiClient, handler;
|
|
8564
|
+
return _ts_generator(this, function(_state) {
|
|
8565
|
+
switch(_state.label){
|
|
8566
|
+
case 0:
|
|
8567
|
+
return [
|
|
8568
|
+
4,
|
|
8569
|
+
getAzureClient()
|
|
8570
|
+
];
|
|
8571
|
+
case 1:
|
|
8572
|
+
openaiClient = _state.sent();
|
|
8573
|
+
handler = handlerFactory({
|
|
8574
|
+
client: openaiClient,
|
|
8575
|
+
runAdapter: wrappedRunAdapter,
|
|
8576
|
+
createResponseItems: createResponseItems
|
|
8577
|
+
});
|
|
8578
|
+
return [
|
|
8579
|
+
2,
|
|
8580
|
+
handler[method](urlString, options)
|
|
8581
|
+
];
|
|
8582
|
+
}
|
|
8583
|
+
});
|
|
8584
|
+
})();
|
|
8585
|
+
};
|
|
8586
|
+
};
|
|
8587
|
+
var createWrappedHandlers = function(handlerFactory, methods) {
|
|
8588
|
+
var wrapped = {};
|
|
8589
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8590
|
+
try {
|
|
8591
|
+
for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8592
|
+
var method = _step.value;
|
|
8593
|
+
wrapped[method] = wrapHandlerMethod(handlerFactory, method);
|
|
8594
|
+
}
|
|
8595
|
+
} catch (err) {
|
|
8596
|
+
_didIteratorError = true;
|
|
8597
|
+
_iteratorError = err;
|
|
8598
|
+
} finally{
|
|
8599
|
+
try {
|
|
8600
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8601
|
+
_iterator.return();
|
|
8602
|
+
}
|
|
8603
|
+
} finally{
|
|
8604
|
+
if (_didIteratorError) {
|
|
8605
|
+
throw _iteratorError;
|
|
8606
|
+
}
|
|
8607
|
+
}
|
|
8608
|
+
}
|
|
8609
|
+
return wrapped;
|
|
8610
|
+
};
|
|
8611
|
+
var _obj;
|
|
8612
|
+
return {
|
|
8613
|
+
requestHandlers: (_obj = {
|
|
8614
|
+
"^/(?:v1|/?openai)/assistants$": assistants2({
|
|
8615
|
+
runAdapter: wrappedRunAdapter
|
|
8616
|
+
}),
|
|
8617
|
+
"^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
|
|
8618
|
+
"post"
|
|
8619
|
+
])
|
|
8620
|
+
}, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
|
|
8621
|
+
"get",
|
|
8622
|
+
"post"
|
|
8623
|
+
])), _define_property(_obj, runsRegexp, createWrappedHandlers(runs2, [
|
|
8624
|
+
"post"
|
|
8625
|
+
])), _define_property(_obj, runRegexp, createWrappedHandlers(run2, [
|
|
8626
|
+
"get"
|
|
8627
|
+
])), _define_property(_obj, stepsRegexp, createWrappedHandlers(steps2, [
|
|
8628
|
+
"get"
|
|
8629
|
+
])), _define_property(_obj, submitToolOutputsRegexp, createWrappedHandlers(submitToolOutputs2, [
|
|
8630
|
+
"post"
|
|
8631
|
+
])), _obj)
|
|
8632
|
+
};
|
|
8633
|
+
};
|
|
8634
|
+
};
|
|
8467
8635
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/post.ts
|
|
8468
8636
|
var import_dayjs21 = __toESM(require("dayjs"), 1);
|
|
8469
8637
|
var post20 = function(param) {
|
|
@@ -8596,8 +8764,8 @@ var post21 = function(param) {
|
|
|
8596
8764
|
}
|
|
8597
8765
|
};
|
|
8598
8766
|
} else if (c.type === "image_file") {
|
|
8599
|
-
var imageFile = c.image_file || c.imageFile || {};
|
|
8600
8767
|
var _imageFile_detail;
|
|
8768
|
+
var imageFile = c.image_file || c.imageFile || {};
|
|
8601
8769
|
return {
|
|
8602
8770
|
type: "image_file",
|
|
8603
8771
|
image_file: {
|
|
@@ -8721,8 +8889,8 @@ var get19 = function(param) {
|
|
|
8721
8889
|
}
|
|
8722
8890
|
};
|
|
8723
8891
|
} else if (c.type === "image_file") {
|
|
8724
|
-
var imageFile = c.image_file || c.imageFile || {};
|
|
8725
8892
|
var _imageFile_detail;
|
|
8893
|
+
var imageFile = c.image_file || c.imageFile || {};
|
|
8726
8894
|
return {
|
|
8727
8895
|
type: "image_file",
|
|
8728
8896
|
image_file: {
|
|
@@ -8885,7 +9053,7 @@ var post22 = function(param) {
|
|
|
8885
9053
|
readableStream = new ReadableStream({
|
|
8886
9054
|
start: function start(controller) {
|
|
8887
9055
|
return _async_to_generator(function() {
|
|
8888
|
-
var error,
|
|
9056
|
+
var error, _ref, _ref1, _error_cause, event;
|
|
8889
9057
|
return _ts_generator(this, function(_state) {
|
|
8890
9058
|
switch(_state.label){
|
|
8891
9059
|
case 0:
|
|
@@ -8930,7 +9098,7 @@ var post22 = function(param) {
|
|
|
8930
9098
|
failed_at: (0, import_dayjs24.default)().unix(),
|
|
8931
9099
|
last_error: {
|
|
8932
9100
|
code: "server_error",
|
|
8933
|
-
message: "".concat((
|
|
9101
|
+
message: "".concat((_ref = error === null || error === void 0 ? void 0 : error.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
|
|
8934
9102
|
}
|
|
8935
9103
|
}
|
|
8936
9104
|
};
|
|
@@ -9332,7 +9500,7 @@ var get22 = function(param) {
|
|
|
9332
9500
|
file_search: tc.fileSearch || {}
|
|
9333
9501
|
};
|
|
9334
9502
|
} else if (tc.type === "function") {
|
|
9335
|
-
var
|
|
9503
|
+
var _ref, _tc_function_output;
|
|
9336
9504
|
return {
|
|
9337
9505
|
id: tc.id,
|
|
9338
9506
|
type: "function",
|
|
@@ -9449,12 +9617,12 @@ var steps3 = function(param) {
|
|
|
9449
9617
|
};
|
|
9450
9618
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
9451
9619
|
var import_dayjs27 = __toESM(require("dayjs"), 1);
|
|
9452
|
-
function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
9620
|
+
function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
|
|
9453
9621
|
var event = azureEvent.event, data = azureEvent.data;
|
|
9454
9622
|
var eventType = event;
|
|
9455
9623
|
if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
|
|
9456
|
-
var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
|
|
9457
9624
|
var _data_temperature, _data_topP;
|
|
9625
|
+
var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
|
|
9458
9626
|
return {
|
|
9459
9627
|
event: eventType,
|
|
9460
9628
|
data: {
|
|
@@ -9582,8 +9750,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9582
9750
|
type: "tool_calls",
|
|
9583
9751
|
tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
|
|
9584
9752
|
if (tc.type === "code_interpreter") {
|
|
9585
|
-
var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
|
|
9586
9753
|
var _tc_index;
|
|
9754
|
+
var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
|
|
9587
9755
|
return {
|
|
9588
9756
|
index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
|
|
9589
9757
|
id: tc.id,
|
|
@@ -9600,8 +9768,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9600
9768
|
};
|
|
9601
9769
|
}
|
|
9602
9770
|
if (output.type === "image") {
|
|
9603
|
-
var _output_image;
|
|
9604
9771
|
var _output_index1;
|
|
9772
|
+
var _output_image;
|
|
9605
9773
|
return {
|
|
9606
9774
|
index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
|
|
9607
9775
|
type: "image",
|
|
@@ -9623,8 +9791,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9623
9791
|
file_search: tc.fileSearch || {}
|
|
9624
9792
|
};
|
|
9625
9793
|
} else if (tc.type === "function") {
|
|
9794
|
+
var _tc_index2, _ref, _ref1;
|
|
9626
9795
|
var _tc_function, _tc_function1, _tc_function2;
|
|
9627
|
-
var _tc_index2;
|
|
9628
9796
|
return {
|
|
9629
9797
|
index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
|
|
9630
9798
|
id: tc.id,
|
|
@@ -9632,7 +9800,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9632
9800
|
function: {
|
|
9633
9801
|
name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
|
|
9634
9802
|
arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
|
|
9635
|
-
output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output)
|
|
9803
|
+
output: (_ref = (_ref1 = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) !== null && _ref1 !== void 0 ? _ref1 : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
|
|
9636
9804
|
}
|
|
9637
9805
|
};
|
|
9638
9806
|
}
|
|
@@ -9710,6 +9878,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9710
9878
|
file_search: tc.fileSearch || {}
|
|
9711
9879
|
};
|
|
9712
9880
|
} else if (tc.type === "function") {
|
|
9881
|
+
var _ref, _ref1;
|
|
9713
9882
|
var _tc_function, _tc_function1, _tc_function2;
|
|
9714
9883
|
return {
|
|
9715
9884
|
id: tc.id,
|
|
@@ -9717,7 +9886,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9717
9886
|
function: {
|
|
9718
9887
|
name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
|
|
9719
9888
|
arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
|
|
9720
|
-
output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output)
|
|
9889
|
+
output: (_ref = (_ref1 = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) !== null && _ref1 !== void 0 ? _ref1 : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
|
|
9721
9890
|
}
|
|
9722
9891
|
};
|
|
9723
9892
|
}
|
|
@@ -9771,7 +9940,7 @@ var post23 = function(param) {
|
|
|
9771
9940
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9772
9941
|
return function(urlString, options) {
|
|
9773
9942
|
return _async_to_generator(function() {
|
|
9774
|
-
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
|
|
9943
|
+
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, outputsMap, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
|
|
9775
9944
|
return _ts_generator(this, function(_state) {
|
|
9776
9945
|
switch(_state.label){
|
|
9777
9946
|
case 0:
|
|
@@ -9782,6 +9951,12 @@ var post23 = function(param) {
|
|
|
9782
9951
|
}
|
|
9783
9952
|
body = JSON.parse(options.body);
|
|
9784
9953
|
tool_outputs = body.tool_outputs, stream = body.stream;
|
|
9954
|
+
outputsMap = new Map(tool_outputs.map(function(output) {
|
|
9955
|
+
return [
|
|
9956
|
+
output.tool_call_id,
|
|
9957
|
+
output.output
|
|
9958
|
+
];
|
|
9959
|
+
}));
|
|
9785
9960
|
return [
|
|
9786
9961
|
4,
|
|
9787
9962
|
Promise.all(tool_outputs.map(function(output) {
|
|
@@ -9820,7 +9995,7 @@ var post23 = function(param) {
|
|
|
9820
9995
|
}));
|
|
9821
9996
|
streamRun = function(onEvent2) {
|
|
9822
9997
|
return _async_to_generator(function() {
|
|
9823
|
-
var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error,
|
|
9998
|
+
var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error, _ref, _ref1, _error_cause;
|
|
9824
9999
|
return _ts_generator(this, function(_state) {
|
|
9825
10000
|
switch(_state.label){
|
|
9826
10001
|
case 0:
|
|
@@ -9859,7 +10034,7 @@ var post23 = function(param) {
|
|
|
9859
10034
|
];
|
|
9860
10035
|
_value = _step.value;
|
|
9861
10036
|
azureEvent = _value;
|
|
9862
|
-
openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId);
|
|
10037
|
+
openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap);
|
|
9863
10038
|
if (!openaiEvent) return [
|
|
9864
10039
|
3,
|
|
9865
10040
|
6
|
|
@@ -9945,7 +10120,7 @@ var post23 = function(param) {
|
|
|
9945
10120
|
required_action: null,
|
|
9946
10121
|
last_error: {
|
|
9947
10122
|
code: "server_error",
|
|
9948
|
-
message: "".concat((
|
|
10123
|
+
message: "".concat((_ref = error === null || error === void 0 ? void 0 : error.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
|
|
9949
10124
|
},
|
|
9950
10125
|
expires_at: null,
|
|
9951
10126
|
started_at: (0, import_dayjs27.default)().unix(),
|
|
@@ -10086,7 +10261,7 @@ var post24 = function(param) {
|
|
|
10086
10261
|
var runAdapter = param.runAdapter;
|
|
10087
10262
|
return function(_urlString, options) {
|
|
10088
10263
|
return _async_to_generator(function() {
|
|
10089
|
-
var
|
|
10264
|
+
var _body_top_p, _body_temperature, body, openaiAssistant;
|
|
10090
10265
|
return _ts_generator(this, function(_state) {
|
|
10091
10266
|
if (typeof options.body !== "string") {
|
|
10092
10267
|
throw new Error("Request body is required");
|
|
@@ -10150,10 +10325,9 @@ var toUnixSeconds = function(value) {
|
|
|
10150
10325
|
return parsed.isValid() ? parsed.unix() : void 0;
|
|
10151
10326
|
};
|
|
10152
10327
|
var transformAzureFile = function(file2) {
|
|
10153
|
-
var _toUnixSeconds;
|
|
10328
|
+
var _toUnixSeconds, _file2_bytes;
|
|
10154
10329
|
var createdAtUnix = (_toUnixSeconds = toUnixSeconds(file2.createdAt)) !== null && _toUnixSeconds !== void 0 ? _toUnixSeconds : (0, import_dayjs28.default)().unix();
|
|
10155
10330
|
var expiresAtUnix = toUnixSeconds(file2.expiresAt);
|
|
10156
|
-
var _file2_bytes;
|
|
10157
10331
|
var openaiFile = {
|
|
10158
10332
|
id: file2.id,
|
|
10159
10333
|
object: file2.object || "file",
|
|
@@ -10340,7 +10514,7 @@ var fileContent = function(param) {
|
|
|
10340
10514
|
return {
|
|
10341
10515
|
get: function(url) {
|
|
10342
10516
|
return _async_to_generator(function() {
|
|
10343
|
-
var pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body
|
|
10517
|
+
var _nodeResponse_status, pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body;
|
|
10344
10518
|
return _ts_generator(this, function(_state) {
|
|
10345
10519
|
switch(_state.label){
|
|
10346
10520
|
case 0:
|
|
@@ -12482,8 +12656,8 @@ var import_radash25 = require("radash");
|
|
|
12482
12656
|
function transformAnnotations(annotations) {
|
|
12483
12657
|
return annotations.map(function(ann) {
|
|
12484
12658
|
if (ann.type === "file_citation") {
|
|
12485
|
-
var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
|
|
12486
12659
|
var _ann_startIndex, _ann_endIndex;
|
|
12660
|
+
var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
|
|
12487
12661
|
return {
|
|
12488
12662
|
type: "file_citation",
|
|
12489
12663
|
text: ann.text,
|
|
@@ -12495,8 +12669,8 @@ function transformAnnotations(annotations) {
|
|
|
12495
12669
|
}
|
|
12496
12670
|
};
|
|
12497
12671
|
} else if (ann.type === "file_path") {
|
|
12498
|
-
var _ann_filePath, _ann_file_path;
|
|
12499
12672
|
var _ann_startIndex1, _ann_endIndex1;
|
|
12673
|
+
var _ann_filePath, _ann_file_path;
|
|
12500
12674
|
return {
|
|
12501
12675
|
type: "file_path",
|
|
12502
12676
|
text: ann.text,
|
|
@@ -12522,8 +12696,8 @@ function transformMessageContentItem(content) {
|
|
|
12522
12696
|
};
|
|
12523
12697
|
}
|
|
12524
12698
|
if (content.type === "image_file") {
|
|
12525
|
-
var imageFile = content.image_file || content.imageFile || {};
|
|
12526
12699
|
var _imageFile_detail;
|
|
12700
|
+
var imageFile = content.image_file || content.imageFile || {};
|
|
12527
12701
|
return {
|
|
12528
12702
|
type: "image_file",
|
|
12529
12703
|
image_file: {
|
|
@@ -12547,8 +12721,8 @@ function transformMessageDeltaContentItem(content) {
|
|
|
12547
12721
|
};
|
|
12548
12722
|
}
|
|
12549
12723
|
if (content.type === "image_file") {
|
|
12550
|
-
var imageFile = content.image_file || content.imageFile || {};
|
|
12551
12724
|
var _imageFile_detail;
|
|
12725
|
+
var imageFile = content.image_file || content.imageFile || {};
|
|
12552
12726
|
return {
|
|
12553
12727
|
index: content.index || 0,
|
|
12554
12728
|
type: "image_file",
|
|
@@ -12564,8 +12738,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12564
12738
|
var event = azureEvent.event, data = azureEvent.data;
|
|
12565
12739
|
var eventType = event;
|
|
12566
12740
|
if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
|
|
12567
|
-
var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
|
|
12568
12741
|
var _data_temperature, _data_topP;
|
|
12742
|
+
var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
|
|
12569
12743
|
return {
|
|
12570
12744
|
event: eventType,
|
|
12571
12745
|
data: {
|
|
@@ -12672,8 +12846,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12672
12846
|
type: "tool_calls",
|
|
12673
12847
|
tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
|
|
12674
12848
|
if (tc.type === "code_interpreter") {
|
|
12675
|
-
var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
|
|
12676
12849
|
var _tc_index;
|
|
12850
|
+
var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
|
|
12677
12851
|
return {
|
|
12678
12852
|
index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
|
|
12679
12853
|
id: tc.id,
|
|
@@ -12690,8 +12864,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12690
12864
|
};
|
|
12691
12865
|
}
|
|
12692
12866
|
if (output.type === "image") {
|
|
12693
|
-
var _output_image;
|
|
12694
12867
|
var _output_index1;
|
|
12868
|
+
var _output_image;
|
|
12695
12869
|
return {
|
|
12696
12870
|
index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
|
|
12697
12871
|
type: "image",
|
|
@@ -12713,8 +12887,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12713
12887
|
file_search: tc.fileSearch || {}
|
|
12714
12888
|
};
|
|
12715
12889
|
} else if (tc.type === "function") {
|
|
12716
|
-
var _tc_function, _tc_function1, _tc_function2;
|
|
12717
12890
|
var _tc_index2;
|
|
12891
|
+
var _tc_function, _tc_function1, _tc_function2;
|
|
12718
12892
|
return {
|
|
12719
12893
|
index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
|
|
12720
12894
|
id: tc.id,
|
|
@@ -13049,6 +13223,7 @@ var azureAgentsRunAdapter = function(param) {
|
|
|
13049
13223
|
azureAgentsStorageAdapter: azureAgentsStorageAdapter,
|
|
13050
13224
|
azureAiProjectClientAdapter: azureAiProjectClientAdapter,
|
|
13051
13225
|
azureOpenaiClientAdapter: azureOpenaiClientAdapter,
|
|
13226
|
+
azureResponsesStorageAdapter: azureResponsesStorageAdapter,
|
|
13052
13227
|
completionsRunAdapter: completionsRunAdapter,
|
|
13053
13228
|
googleClientAdapter: googleClientAdapter,
|
|
13054
13229
|
groqClientAdapter: groqClientAdapter,
|