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.js CHANGED
@@ -1,4 +1,3 @@
1
- // src/supercompat.ts
2
1
  function _array_like_to_array(arr, len) {
3
2
  if (len == null || len > arr.length) len = arr.length;
4
3
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -174,12 +173,22 @@ function _object_spread_props(target, source) {
174
173
  }
175
174
  function _object_without_properties(source, excluded) {
176
175
  if (source == null) return {};
177
- var target = _object_without_properties_loose(source, excluded);
178
- var key, i;
176
+ var target = {}, sourceKeys, key, i;
177
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
178
+ sourceKeys = Reflect.ownKeys(source);
179
+ for(i = 0; i < sourceKeys.length; i++){
180
+ key = sourceKeys[i];
181
+ if (excluded.indexOf(key) >= 0) continue;
182
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
183
+ target[key] = source[key];
184
+ }
185
+ return target;
186
+ }
187
+ target = _object_without_properties_loose(source, excluded);
179
188
  if (Object.getOwnPropertySymbols) {
180
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
181
- for(i = 0; i < sourceSymbolKeys.length; i++){
182
- key = sourceSymbolKeys[i];
189
+ sourceKeys = Object.getOwnPropertySymbols(source);
190
+ for(i = 0; i < sourceKeys.length; i++){
191
+ key = sourceKeys[i];
183
192
  if (excluded.indexOf(key) >= 0) continue;
184
193
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
185
194
  target[key] = source[key];
@@ -189,12 +198,11 @@ function _object_without_properties(source, excluded) {
189
198
  }
190
199
  function _object_without_properties_loose(source, excluded) {
191
200
  if (source == null) return {};
192
- var target = {};
193
- var sourceKeys = Object.keys(source);
194
- var key, i;
201
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
195
202
  for(i = 0; i < sourceKeys.length; i++){
196
203
  key = sourceKeys[i];
197
204
  if (excluded.indexOf(key) >= 0) continue;
205
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
198
206
  target[key] = source[key];
199
207
  }
200
208
  return target;
@@ -226,9 +234,17 @@ function _ts_generator(thisArg, body) {
226
234
  },
227
235
  trys: [],
228
236
  ops: []
229
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
230
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
231
- return this;
237
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
238
+ return d(g, "next", {
239
+ value: verb(0)
240
+ }), d(g, "throw", {
241
+ value: verb(1)
242
+ }), d(g, "return", {
243
+ value: verb(2)
244
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
245
+ value: function() {
246
+ return this;
247
+ }
232
248
  }), g;
233
249
  function verb(n) {
234
250
  return function(v) {
@@ -322,6 +338,7 @@ function _ts_values(o) {
322
338
  };
323
339
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
324
340
  }
341
+ // src/supercompat.ts
325
342
  import OpenAI, { AzureOpenAI } from "openai";
326
343
  // src/supercompatFetch/requestHandlers.ts
327
344
  import { assign, partob } from "radash";
@@ -338,7 +355,8 @@ var storageRequestHandlers = function(param) {
338
355
  client: wrappedClient
339
356
  })
340
357
  }),
341
- client: wrappedClient
358
+ client: wrappedClient,
359
+ originalClient: client
342
360
  });
343
361
  return result.requestHandlers;
344
362
  };
@@ -419,7 +437,7 @@ var supercompatFetch = function(param) {
419
437
  args[_key] = arguments[_key];
420
438
  }
421
439
  return _async_to_generator(function() {
422
- var _args, url, options, pathHandler, _options_method, method, requestHandler;
440
+ var _ref, _args, url, options, pathHandler, method, requestHandler;
423
441
  return _ts_generator(this, function(_state) {
424
442
  _args = _sliced_to_array(args, 2), url = _args[0], options = _args[1];
425
443
  pathHandler = findRequestHandler({
@@ -435,7 +453,7 @@ var supercompatFetch = function(param) {
435
453
  })
436
454
  ];
437
455
  }
438
- method = (_options_method = options === null || options === void 0 ? void 0 : options.method) !== null && _options_method !== void 0 ? _options_method : "";
456
+ method = (_ref = options === null || options === void 0 ? void 0 : options.method) !== null && _ref !== void 0 ? _ref : "";
439
457
  requestHandler = pathHandler[method.toLowerCase()];
440
458
  if (!requestHandler) {
441
459
  return [
@@ -1123,16 +1141,16 @@ var models3 = function(param) {
1123
1141
  };
1124
1142
  };
1125
1143
  // src/adapters/client/mistralClientAdapter/completions/serializeChunk.ts
1126
- var serializeDelta = function(_param) {
1127
- var toolCalls = _param.delta.toolCalls, rest = _object_without_properties(_param.delta, [
1144
+ var serializeDelta = function(_0) {
1145
+ var _ref = _0.delta, toolCalls = _ref.toolCalls, rest = _object_without_properties(_ref, [
1128
1146
  "toolCalls"
1129
1147
  ]);
1130
1148
  return _object_spread({}, rest, toolCalls ? {
1131
1149
  tool_calls: toolCalls
1132
1150
  } : {});
1133
1151
  };
1134
- var serializeChoice = function(_param) {
1135
- var _param_choice = _param.choice, finishReason = _param_choice.finishReason, delta = _param_choice.delta, rest = _object_without_properties(_param.choice, [
1152
+ var serializeChoice = function(_0) {
1153
+ var _ref = _0.choice, finishReason = _ref.finishReason, delta = _ref.delta, rest = _object_without_properties(_ref, [
1136
1154
  "finishReason",
1137
1155
  "delta"
1138
1156
  ]);
@@ -1154,10 +1172,10 @@ var serializeChunk = function(param) {
1154
1172
  } : {});
1155
1173
  };
1156
1174
  // src/adapters/client/mistralClientAdapter/completions/serializeBody.ts
1157
- var serializeMessage = function(_param) {
1158
- var _param_message = _param.message, // @ts-ignore-next-line
1159
- tool_calls = _param_message.tool_calls, // @ts-ignore-next-line
1160
- tool_call_id = _param_message.tool_call_id, rest = _object_without_properties(_param.message, [
1175
+ var serializeMessage = function(_0) {
1176
+ var _ref = _0.message, // @ts-ignore-next-line
1177
+ tool_calls = _ref.tool_calls, // @ts-ignore-next-line
1178
+ tool_call_id = _ref.tool_call_id, rest = _object_without_properties(_ref, [
1161
1179
  "tool_calls",
1162
1180
  "tool_call_id"
1163
1181
  ]);
@@ -1802,7 +1820,7 @@ var serializeMessage2 = function(param) {
1802
1820
  if (!trimmed) return {};
1803
1821
  try {
1804
1822
  return JSON.parse(trimmed);
1805
- } catch (e) {
1823
+ } catch (unused) {
1806
1824
  return {};
1807
1825
  }
1808
1826
  };
@@ -2066,17 +2084,15 @@ var parseKeys = function(input) {
2066
2084
  };
2067
2085
  var normalizeKeys = function(keys) {
2068
2086
  return keys.map(function(key) {
2069
- var lowerKey = key.toLowerCase();
2070
2087
  var _keyAliasMap_lowerKey;
2088
+ var lowerKey = key.toLowerCase();
2071
2089
  return (_keyAliasMap_lowerKey = keyAliasMap[lowerKey]) !== null && _keyAliasMap_lowerKey !== void 0 ? _keyAliasMap_lowerKey : lowerKey;
2072
2090
  });
2073
2091
  };
2074
2092
  var normalizeScroll = function(details) {
2075
- var _sanitizeNumber;
2093
+ var _sanitizeNumber, _sanitizeNumber1, _ref, _sanitizeNumber2;
2076
2094
  var scrollX = (_sanitizeNumber = sanitizeNumber(details.scroll_x)) !== null && _sanitizeNumber !== void 0 ? _sanitizeNumber : 0;
2077
- var _sanitizeNumber1;
2078
2095
  var scrollY = (_sanitizeNumber1 = sanitizeNumber(details.scroll_y)) !== null && _sanitizeNumber1 !== void 0 ? _sanitizeNumber1 : 0;
2079
- var _sanitizeNumber2, _ref;
2080
2096
  var amount = (_ref = (_sanitizeNumber2 = sanitizeNumber(details.scroll_amount)) !== null && _sanitizeNumber2 !== void 0 ? _sanitizeNumber2 : sanitizeNumber(details.amount)) !== null && _ref !== void 0 ? _ref : 0;
2081
2097
  var direction = typeof details.scroll_direction === "string" ? details.scroll_direction.toLowerCase() : typeof details.direction === "string" ? details.direction.toLowerCase() : void 0;
2082
2098
  if (!scrollX && !scrollY && direction && amount) {
@@ -2113,46 +2129,46 @@ var normalizeActionString = function(action, details) {
2113
2129
  case "right_click":
2114
2130
  case "middle_click":
2115
2131
  {
2116
- var _coords_x, _coords_y;
2132
+ var _ref, _ref1;
2117
2133
  return {
2118
2134
  type: "click",
2119
2135
  button: clickButtonMap[action],
2120
- x: (_coords_x = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x !== void 0 ? _coords_x : 0,
2121
- y: (_coords_y = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y !== void 0 ? _coords_y : 0
2136
+ x: (_ref = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref !== void 0 ? _ref : 0,
2137
+ y: (_ref1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref1 !== void 0 ? _ref1 : 0
2122
2138
  };
2123
2139
  }
2124
2140
  case "double_click":
2125
- var _coords_x1, _coords_y1;
2141
+ var _ref2, _ref3;
2126
2142
  return {
2127
2143
  type: "double_click",
2128
- x: (_coords_x1 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x1 !== void 0 ? _coords_x1 : 0,
2129
- y: (_coords_y1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y1 !== void 0 ? _coords_y1 : 0
2144
+ x: (_ref2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref2 !== void 0 ? _ref2 : 0,
2145
+ y: (_ref3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref3 !== void 0 ? _ref3 : 0
2130
2146
  };
2131
2147
  case "triple_click":
2132
- var _coords_x2, _coords_y2;
2148
+ var _ref4, _ref5;
2133
2149
  return {
2134
2150
  type: "double_click",
2135
- x: (_coords_x2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x2 !== void 0 ? _coords_x2 : 0,
2136
- y: (_coords_y2 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y2 !== void 0 ? _coords_y2 : 0,
2151
+ x: (_ref4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref4 !== void 0 ? _ref4 : 0,
2152
+ y: (_ref5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref5 !== void 0 ? _ref5 : 0,
2137
2153
  repetitions: 3
2138
2154
  };
2139
2155
  case "left_mouse_down":
2140
- var _coords_x3, _coords_y3;
2156
+ var _ref6, _ref7;
2141
2157
  return {
2142
2158
  type: "click",
2143
2159
  button: clickButtonMap[action],
2144
2160
  state: "down",
2145
- x: (_coords_x3 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x3 !== void 0 ? _coords_x3 : 0,
2146
- y: (_coords_y3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y3 !== void 0 ? _coords_y3 : 0
2161
+ x: (_ref6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref6 !== void 0 ? _ref6 : 0,
2162
+ y: (_ref7 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref7 !== void 0 ? _ref7 : 0
2147
2163
  };
2148
2164
  case "left_mouse_up":
2149
- var _coords_x4, _coords_y4;
2165
+ var _ref8, _ref9;
2150
2166
  return {
2151
2167
  type: "click",
2152
2168
  button: clickButtonMap[action],
2153
2169
  state: "up",
2154
- x: (_coords_x4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x4 !== void 0 ? _coords_x4 : 0,
2155
- y: (_coords_y4 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y4 !== void 0 ? _coords_y4 : 0
2170
+ x: (_ref8 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref8 !== void 0 ? _ref8 : 0,
2171
+ y: (_ref9 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref9 !== void 0 ? _ref9 : 0
2156
2172
  };
2157
2173
  case "left_click_drag":
2158
2174
  {
@@ -2170,20 +2186,20 @@ var normalizeActionString = function(action, details) {
2170
2186
  }
2171
2187
  case "mouse_move":
2172
2188
  case "cursor_position":
2173
- var _coords_x5, _coords_y5;
2189
+ var _ref10, _ref11;
2174
2190
  return {
2175
2191
  type: "move",
2176
- x: (_coords_x5 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x5 !== void 0 ? _coords_x5 : 0,
2177
- y: (_coords_y5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y5 !== void 0 ? _coords_y5 : 0
2192
+ x: (_ref10 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref10 !== void 0 ? _ref10 : 0,
2193
+ y: (_ref11 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref11 !== void 0 ? _ref11 : 0
2178
2194
  };
2179
2195
  case "scroll":
2180
2196
  {
2197
+ var _ref12, _ref13;
2181
2198
  var _normalizeScroll = normalizeScroll(details), scroll_x = _normalizeScroll.scroll_x, scroll_y = _normalizeScroll.scroll_y;
2182
- var _coords_x6, _coords_y6;
2183
2199
  return _object_spread({
2184
2200
  type: "scroll",
2185
- x: (_coords_x6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x6 !== void 0 ? _coords_x6 : 0,
2186
- y: (_coords_y6 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y6 !== void 0 ? _coords_y6 : 0,
2201
+ x: (_ref12 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref12 !== void 0 ? _ref12 : 0,
2202
+ y: (_ref13 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref13 !== void 0 ? _ref13 : 0,
2187
2203
  scroll_x: scroll_x,
2188
2204
  scroll_y: scroll_y
2189
2205
  }, typeof details.scroll_direction === "string" ? {
@@ -2207,8 +2223,8 @@ var normalizeActionString = function(action, details) {
2207
2223
  case "key":
2208
2224
  case "hold_key":
2209
2225
  {
2210
- var _details_text, _ref;
2211
- 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));
2226
+ var _ref14, _details_text;
2227
+ 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));
2212
2228
  var normalized = {
2213
2229
  type: "keypress",
2214
2230
  keys: keys
@@ -2316,7 +2332,7 @@ var normalizeComputerToolCallPayload = function(payload) {
2316
2332
  var parseJson = function(value) {
2317
2333
  try {
2318
2334
  return JSON.parse(value);
2319
- } catch (e) {
2335
+ } catch (unused) {
2320
2336
  return void 0;
2321
2337
  }
2322
2338
  };
@@ -2374,7 +2390,7 @@ var post5 = function(param) {
2374
2390
  stream = new ReadableStream({
2375
2391
  start: function start(controller) {
2376
2392
  return _async_to_generator(function() {
2377
- 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, _toolUseIdArgumentBuffer_get1, buffered1, toolCallIndex1, chunkIndex1, messageDelta, delta, toolUseId1, _toolUseIdArgumentBuffer_get2, existing, _chunk_delta_partial_json, updated, parsed1, normalized1, toolCallIndex2, chunkIndex2, _toolUseIdArgumentBuffer_get3, existing1, _chunk_delta_partial_json1, index, messageDelta1, 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, messageDelta2, messageDelta3, err;
2393
+ 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;
2378
2394
  return _ts_generator(this, function(_state) {
2379
2395
  switch(_state.label){
2380
2396
  case 0:
@@ -2387,18 +2403,18 @@ var post5 = function(param) {
2387
2403
  parseJson2 = function(value) {
2388
2404
  try {
2389
2405
  return JSON.parse(value);
2390
- } catch (e) {
2406
+ } catch (unused) {
2391
2407
  return void 0;
2392
2408
  }
2393
2409
  };
2394
2410
  getOrCreateIndexForToolUseId = function(toolUseId) {
2411
+ var _toolUseIdToIndex_get;
2395
2412
  if (!toolUseId) {
2396
2413
  return 0;
2397
2414
  }
2398
2415
  if (!toolUseIdToIndex.has(toolUseId)) {
2399
2416
  toolUseIdToIndex.set(toolUseId, nextToolCallIndex++);
2400
2417
  }
2401
- var _toolUseIdToIndex_get;
2402
2418
  return (_toolUseIdToIndex_get = toolUseIdToIndex.get(toolUseId)) !== null && _toolUseIdToIndex_get !== void 0 ? _toolUseIdToIndex_get : 0;
2403
2419
  };
2404
2420
  assignBlockToToolUse = function(param) {
@@ -2475,8 +2491,7 @@ var post5 = function(param) {
2475
2491
  5
2476
2492
  ];
2477
2493
  _value = _step.value;
2478
- _ref = _value;
2479
- chunk = _ref;
2494
+ chunk = _value;
2480
2495
  if (chunk.type === "content_block_stop") {
2481
2496
  toolUseId = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
2482
2497
  if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
@@ -2544,7 +2559,6 @@ var post5 = function(param) {
2544
2559
  if (toolUseId1 && computerToolUseIds.has(toolUseId1)) {
2545
2560
  ;
2546
2561
  existing = (_toolUseIdArgumentBuffer_get2 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get2 !== void 0 ? _toolUseIdArgumentBuffer_get2 : "";
2547
- ;
2548
2562
  updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
2549
2563
  toolUseIdArgumentBuffer.set(toolUseId1, updated);
2550
2564
  if (!normalizedComputerCalls.has(toolUseId1)) {
@@ -2569,7 +2583,6 @@ var post5 = function(param) {
2569
2583
  if (toolUseId1) {
2570
2584
  ;
2571
2585
  existing1 = (_toolUseIdArgumentBuffer_get3 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get3 !== void 0 ? _toolUseIdArgumentBuffer_get3 : "";
2572
- ;
2573
2586
  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 : ""));
2574
2587
  }
2575
2588
  index = getOrCreateIndexForBlock(chunk.index);
@@ -2660,7 +2673,6 @@ var post5 = function(param) {
2660
2673
  outputPayload = {
2661
2674
  content: (_chunk_content_block_content = chunk.content_block.content) !== null && _chunk_content_block_content !== void 0 ? _chunk_content_block_content : []
2662
2675
  };
2663
- ;
2664
2676
  toolCallId = (_getToolUseIdFromBlock = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock !== void 0 ? _getToolUseIdFromBlock : "";
2665
2677
  index3 = getOrCreateIndexForToolUseId(toolCallId);
2666
2678
  assignBlockToToolUse({
@@ -2697,7 +2709,6 @@ var post5 = function(param) {
2697
2709
  blockIndex: chunk.index,
2698
2710
  toolUseId: toolCallId1
2699
2711
  });
2700
- ;
2701
2712
  outputPayload1 = Object.keys(rest).length > 0 ? rest : {
2702
2713
  content: (_chunk_content_block_content1 = chunk.content_block.content) !== null && _chunk_content_block_content1 !== void 0 ? _chunk_content_block_content1 : {}
2703
2714
  };
@@ -3162,60 +3173,67 @@ var togetherClientAdapter = function(param) {
3162
3173
  };
3163
3174
  };
3164
3175
  // src/adapters/client/googleClientAdapter/models/get.ts
3165
- var models8 = [
3166
- "gemini-2.5-flash-preview-04-17",
3167
- "gemini-2.5-pro-preview-03-25",
3168
- "gemini-2.0-flash",
3169
- "gemini-2.0-flash-lite",
3170
- "gemini-1.5-flash",
3171
- "gemini-1.5-flash-8b",
3172
- "gemini-1.5-pro"
3173
- ];
3174
3176
  var get7 = function(param) {
3175
3177
  var google = param.google;
3176
3178
  return function(_url, _options) {
3177
3179
  return _async_to_generator(function() {
3180
+ var response, error;
3178
3181
  return _ts_generator(this, function(_state) {
3179
- try {
3180
- return [
3181
- 2,
3182
- new Response(JSON.stringify({
3183
- type: "list",
3184
- data: models8.map(function(model) {
3185
- return {
3186
- id: model,
3187
- object: "model"
3188
- };
3182
+ switch(_state.label){
3183
+ case 0:
3184
+ _state.trys.push([
3185
+ 0,
3186
+ 2,
3187
+ ,
3188
+ 3
3189
+ ]);
3190
+ return [
3191
+ 4,
3192
+ google.models.list()
3193
+ ];
3194
+ case 1:
3195
+ response = _state.sent();
3196
+ return [
3197
+ 2,
3198
+ new Response(JSON.stringify({
3199
+ type: "list",
3200
+ data: response.data.map(function(model) {
3201
+ return {
3202
+ id: model.id,
3203
+ object: "model"
3204
+ };
3205
+ })
3206
+ }), {
3207
+ status: 200,
3208
+ headers: {
3209
+ "Content-Type": "application/json"
3210
+ }
3189
3211
  })
3190
- }), {
3191
- status: 200,
3192
- headers: {
3193
- "Content-Type": "application/json"
3194
- }
3195
- })
3196
- ];
3197
- } catch (error) {
3198
- return [
3199
- 2,
3200
- new Response(JSON.stringify({
3201
- error: error
3202
- }), {
3203
- status: 500,
3204
- headers: {
3205
- "Content-Type": "application/json"
3206
- }
3207
- })
3208
- ];
3212
+ ];
3213
+ case 2:
3214
+ error = _state.sent();
3215
+ return [
3216
+ 2,
3217
+ new Response(JSON.stringify({
3218
+ error: error
3219
+ }), {
3220
+ status: 500,
3221
+ headers: {
3222
+ "Content-Type": "application/json"
3223
+ }
3224
+ })
3225
+ ];
3226
+ case 3:
3227
+ return [
3228
+ 2
3229
+ ];
3209
3230
  }
3210
- return [
3211
- 2
3212
- ];
3213
3231
  });
3214
3232
  })();
3215
3233
  };
3216
3234
  };
3217
3235
  // src/adapters/client/googleClientAdapter/models/index.ts
3218
- var models9 = function(param) {
3236
+ var models8 = function(param) {
3219
3237
  var google = param.google;
3220
3238
  return {
3221
3239
  get: get7({
@@ -3440,7 +3458,7 @@ var googleClientAdapter = function(param) {
3440
3458
  return {
3441
3459
  client: google,
3442
3460
  requestHandlers: {
3443
- "^/v1/models$": models9({
3461
+ "^/v1/models$": models8({
3444
3462
  google: google
3445
3463
  }),
3446
3464
  "^/(?:v1|/?openai)/chat/completions$": completions7({
@@ -3450,7 +3468,7 @@ var googleClientAdapter = function(param) {
3450
3468
  };
3451
3469
  };
3452
3470
  // src/adapters/client/humirisClientAdapter/models/get.ts
3453
- var models10 = [
3471
+ var models9 = [
3454
3472
  "Humiris/humiris-moai"
3455
3473
  ];
3456
3474
  var get8 = function(param) {
@@ -3463,7 +3481,7 @@ var get8 = function(param) {
3463
3481
  2,
3464
3482
  new Response(JSON.stringify({
3465
3483
  type: "list",
3466
- data: models10.map(function(model) {
3484
+ data: models9.map(function(model) {
3467
3485
  return {
3468
3486
  id: model,
3469
3487
  object: "model"
@@ -3497,7 +3515,7 @@ var get8 = function(param) {
3497
3515
  };
3498
3516
  };
3499
3517
  // src/adapters/client/humirisClientAdapter/models/index.ts
3500
- var models11 = function(param) {
3518
+ var models10 = function(param) {
3501
3519
  var humiris = param.humiris;
3502
3520
  return {
3503
3521
  get: get8({
@@ -3627,7 +3645,7 @@ var humirisClientAdapter = function(param) {
3627
3645
  return {
3628
3646
  client: humiris,
3629
3647
  requestHandlers: {
3630
- "^/v1/models$": models11({
3648
+ "^/v1/models$": models10({
3631
3649
  humiris: humiris
3632
3650
  }),
3633
3651
  "^/(?:v1|/?openai)/chat/completions$": completions8({
@@ -3689,7 +3707,7 @@ var get9 = function(param) {
3689
3707
  };
3690
3708
  };
3691
3709
  // src/adapters/client/ollamaClientAdapter/models/index.ts
3692
- var models12 = function(param) {
3710
+ var models11 = function(param) {
3693
3711
  var ollama = param.ollama;
3694
3712
  return {
3695
3713
  get: get9({
@@ -3881,7 +3899,7 @@ var ollamaClientAdapter = function(param) {
3881
3899
  return {
3882
3900
  client: ollama,
3883
3901
  requestHandlers: {
3884
- "^/v1/models$": models12({
3902
+ "^/v1/models$": models11({
3885
3903
  ollama: ollama
3886
3904
  }),
3887
3905
  "^/(?:v1|/?openai)/chat/completions$": completions9({
@@ -3904,6 +3922,7 @@ var validToolCallContentTypes = [
3904
3922
  ];
3905
3923
  var serializeToolContent = function(param) {
3906
3924
  var toolCall = param.toolCall;
3925
+ var _toolCall_function_output;
3907
3926
  if (isArray(toolCall.function.output)) {
3908
3927
  var isEveryToolPartValid = toolCall.function.output.every(function(toolPart) {
3909
3928
  if (!isObject(toolPart)) return false;
@@ -3914,7 +3933,6 @@ var serializeToolContent = function(param) {
3914
3933
  }
3915
3934
  return JSON.stringify(toolCall.function.output);
3916
3935
  }
3917
- var _toolCall_function_output;
3918
3936
  return (_toolCall_function_output = toolCall.function.output) !== null && _toolCall_function_output !== void 0 ? _toolCall_function_output : "";
3919
3937
  };
3920
3938
  var serializeToolCall = function(param) {
@@ -4091,7 +4109,7 @@ var completionsRunAdapter = function() {
4091
4109
  handleRun: function(param) {
4092
4110
  var client = param.client, run4 = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages;
4093
4111
  return _async_to_generator(function() {
4094
- 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;
4112
+ 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;
4095
4113
  return _ts_generator(this, function(_state) {
4096
4114
  switch(_state.label){
4097
4115
  case 0:
@@ -4149,7 +4167,7 @@ var completionsRunAdapter = function() {
4149
4167
  status: "in_progress",
4150
4168
  last_error: {
4151
4169
  code: "server_error",
4152
- message: "".concat((_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "", " ").concat((_e_cause_message = e === null || e === void 0 ? void 0 : (_e_cause = e.cause) === null || _e_cause === void 0 ? void 0 : _e_cause.message) !== null && _e_cause_message !== void 0 ? _e_cause_message : "")
4170
+ 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 : "")
4153
4171
  }
4154
4172
  })
4155
4173
  })
@@ -4454,19 +4472,19 @@ var completionsRunAdapter = function() {
4454
4472
  ];
4455
4473
  case 25:
4456
4474
  requiredToolCalls = pendingFunctionToolCalls.map(function(toolCall) {
4475
+ var _ref, _ref1;
4457
4476
  var _toolCall_function, _toolCall_function1, _toolCall_function2;
4458
- var _toolCall_function_arguments;
4459
- 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 : "";
4477
+ var args = (_ref = (_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.arguments) !== null && _ref !== void 0 ? _ref : "";
4460
4478
  if (((_toolCall_function1 = toolCall.function) === null || _toolCall_function1 === void 0 ? void 0 : _toolCall_function1.name) === "computer_call") {
4479
+ var _ref2, _ref3;
4461
4480
  var parsedArguments = {};
4462
4481
  try {
4463
4482
  parsedArguments = JSON.parse(args || "{}");
4464
- } catch (e) {
4483
+ } catch (unused) {
4465
4484
  parsedArguments = {};
4466
4485
  }
4467
- var _parsedArguments_action, _ref;
4468
4486
  var computerCall = {
4469
- 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 : {},
4487
+ action: (_ref2 = (_ref3 = parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.action) !== null && _ref3 !== void 0 ? _ref3 : parsedArguments) !== null && _ref2 !== void 0 ? _ref2 : {},
4470
4488
  pending_safety_checks: Array.isArray(parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.pending_safety_checks) ? parsedArguments.pending_safety_checks : []
4471
4489
  };
4472
4490
  return {
@@ -4475,12 +4493,11 @@ var completionsRunAdapter = function() {
4475
4493
  computer_call: computerCall
4476
4494
  };
4477
4495
  }
4478
- var _toolCall_function_name;
4479
4496
  return {
4480
4497
  id: toolCall.id,
4481
4498
  type: "function",
4482
4499
  function: {
4483
- 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 : "",
4500
+ name: (_ref1 = (_toolCall_function2 = toolCall.function) === null || _toolCall_function2 === void 0 ? void 0 : _toolCall_function2.name) !== null && _ref1 !== void 0 ? _ref1 : "",
4484
4501
  arguments: args
4485
4502
  }
4486
4503
  };
@@ -4720,7 +4737,7 @@ var get10 = function(param) {
4720
4737
  var prisma = param.prisma;
4721
4738
  return function(urlString) {
4722
4739
  return _async_to_generator(function() {
4723
- var _last, url, _url_pathname_match, threadId, _assign3, limit, order, after, pageSize, messagesPlusOne, messages5, _last_id;
4740
+ var _ref, _last, url, _url_pathname_match, threadId, _assign3, limit, order, after, pageSize, messagesPlusOne, messages5;
4724
4741
  return _ts_generator(this, function(_state) {
4725
4742
  switch(_state.label){
4726
4743
  case 0:
@@ -4760,7 +4777,7 @@ var get10 = function(param) {
4760
4777
  });
4761
4778
  }),
4762
4779
  has_more: messagesPlusOne.length > pageSize,
4763
- last_id: (_last_id = (_last = last(messages5)) === null || _last === void 0 ? void 0 : _last.id) !== null && _last_id !== void 0 ? _last_id : null
4780
+ last_id: (_ref = (_last = last(messages5)) === null || _last === void 0 ? void 0 : _last.id) !== null && _ref !== void 0 ? _ref : null
4764
4781
  }), {
4765
4782
  status: 200,
4766
4783
  headers: {
@@ -4855,7 +4872,7 @@ var get11 = function(param) {
4855
4872
  var prisma = param.prisma;
4856
4873
  return function(urlString) {
4857
4874
  return _async_to_generator(function() {
4858
- var _runs4_at, url, _url_pathname_match, threadId, _assign4, limit, order, after, pageSize, runsPlusOne, runs4, _runs4_at_id;
4875
+ var _ref, _runs4_at, url, _url_pathname_match, threadId, _assign4, limit, order, after, pageSize, runsPlusOne, runs4;
4859
4876
  return _ts_generator(this, function(_state) {
4860
4877
  switch(_state.label){
4861
4878
  case 0:
@@ -4895,7 +4912,7 @@ var get11 = function(param) {
4895
4912
  });
4896
4913
  }),
4897
4914
  has_more: runsPlusOne.length > pageSize,
4898
- last_id: (_runs4_at_id = (_runs4_at = runs4.at(-1)) === null || _runs4_at === void 0 ? void 0 : _runs4_at.id) !== null && _runs4_at_id !== void 0 ? _runs4_at_id : null
4915
+ last_id: (_ref = (_runs4_at = runs4.at(-1)) === null || _runs4_at === void 0 ? void 0 : _runs4_at.id) !== null && _ref !== void 0 ? _ref : null
4899
4916
  }), {
4900
4917
  status: 200,
4901
4918
  headers: {
@@ -5371,7 +5388,7 @@ var post12 = function(param) {
5371
5388
  readableStream = new ReadableStream({
5372
5389
  start: function start(controller) {
5373
5390
  return _async_to_generator(function() {
5374
- var error, _error_cause, _error_message, _error_cause_message;
5391
+ var error, _ref, _ref1, _error_cause;
5375
5392
  return _ts_generator(this, function(_state) {
5376
5393
  switch(_state.label){
5377
5394
  case 0:
@@ -5422,7 +5439,7 @@ var post12 = function(param) {
5422
5439
  failed_at: dayjs7().unix(),
5423
5440
  last_error: {
5424
5441
  code: "server_error",
5425
- message: "".concat((_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : "", " ").concat((_error_cause_message = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _error_cause_message !== void 0 ? _error_cause_message : "")
5442
+ 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 : "")
5426
5443
  }
5427
5444
  }
5428
5445
  });
@@ -5548,7 +5565,7 @@ var get13 = function(param) {
5548
5565
  var prisma = param.prisma;
5549
5566
  return function(urlString) {
5550
5567
  return _async_to_generator(function() {
5551
- var _runSteps_at, url, _url_pathname_match, threadId, runId, _assign6, limit, order, after, pageSize, runStepsPlusOne, runSteps, _runSteps_at_id;
5568
+ var _ref, _runSteps_at, url, _url_pathname_match, threadId, runId, _assign6, limit, order, after, pageSize, runStepsPlusOne, runSteps;
5552
5569
  return _ts_generator(this, function(_state) {
5553
5570
  switch(_state.label){
5554
5571
  case 0:
@@ -5589,7 +5606,7 @@ var get13 = function(param) {
5589
5606
  });
5590
5607
  }),
5591
5608
  has_more: runStepsPlusOne.length > pageSize,
5592
- last_id: (_runSteps_at_id = (_runSteps_at = runSteps.at(-1)) === null || _runSteps_at === void 0 ? void 0 : _runSteps_at.id) !== null && _runSteps_at_id !== void 0 ? _runSteps_at_id : null
5609
+ last_id: (_ref = (_runSteps_at = runSteps.at(-1)) === null || _runSteps_at === void 0 ? void 0 : _runSteps_at.id) !== null && _ref !== void 0 ? _ref : null
5593
5610
  }), {
5594
5611
  status: 200,
5595
5612
  headers: {
@@ -6349,7 +6366,7 @@ function responseId(param) {
6349
6366
  try {
6350
6367
  arr = JSON.parse(raw);
6351
6368
  if (!Array.isArray(arr)) continue;
6352
- } catch (e) {
6369
+ } catch (unused) {
6353
6370
  continue;
6354
6371
  }
6355
6372
  for(var j = arr.length - 1; j >= 0; j--){
@@ -6500,10 +6517,10 @@ var fetchResponsesForItems = function(param) {
6500
6517
  var assignTimestamps = function(param) {
6501
6518
  var items = param.items, responseMap = param.responseMap, sortOrder = param.sortOrder, conversationCreatedAt = param.conversationCreatedAt;
6502
6519
  var itemsWithTimestamps = items.map(function(entry) {
6520
+ var _ref;
6503
6521
  var _responseMap_get;
6504
- var _responseMap_get_created_at;
6505
6522
  return _object_spread_props(_object_spread({}, entry), {
6506
- timestamp: entry.runId ? (_responseMap_get_created_at = (_responseMap_get = responseMap.get(entry.runId)) === null || _responseMap_get === void 0 ? void 0 : _responseMap_get.created_at) !== null && _responseMap_get_created_at !== void 0 ? _responseMap_get_created_at : null : null,
6523
+ 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,
6507
6524
  assignedTimestamp: 0
6508
6525
  });
6509
6526
  });
@@ -6614,29 +6631,28 @@ import { assign as assign8 } from "radash";
6614
6631
  // src/lib/responses/serializeResponseAsRun.ts
6615
6632
  var serializeStatus = function(param) {
6616
6633
  var response = param.response;
6634
+ var _ref;
6617
6635
  var _response_status;
6618
6636
  if (response.error) return "failed";
6619
- var _response_status_toLowerCase;
6620
- 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";
6637
+ return (_ref = (_response_status = response.status) === null || _response_status === void 0 ? void 0 : _response_status.toLowerCase()) !== null && _ref !== void 0 ? _ref : "completed";
6621
6638
  };
6622
6639
  var serializeUsage = function(param) {
6623
6640
  var response = param.response;
6641
+ var _ref, _ref1, _ref2;
6624
6642
  var _response_usage, _response_usage1, _response_usage2;
6625
- var _response_usage_input_tokens, _response_usage_output_tokens, _response_usage_total_tokens;
6626
6643
  return {
6627
- prompt_tokens: (_response_usage_input_tokens = (_response_usage = response.usage) === null || _response_usage === void 0 ? void 0 : _response_usage.input_tokens) !== null && _response_usage_input_tokens !== void 0 ? _response_usage_input_tokens : 0,
6628
- completion_tokens: (_response_usage_output_tokens = (_response_usage1 = response.usage) === null || _response_usage1 === void 0 ? void 0 : _response_usage1.output_tokens) !== null && _response_usage_output_tokens !== void 0 ? _response_usage_output_tokens : 0,
6629
- total_tokens: (_response_usage_total_tokens = (_response_usage2 = response.usage) === null || _response_usage2 === void 0 ? void 0 : _response_usage2.total_tokens) !== null && _response_usage_total_tokens !== void 0 ? _response_usage_total_tokens : 0
6644
+ prompt_tokens: (_ref = (_response_usage = response.usage) === null || _response_usage === void 0 ? void 0 : _response_usage.input_tokens) !== null && _ref !== void 0 ? _ref : 0,
6645
+ completion_tokens: (_ref1 = (_response_usage1 = response.usage) === null || _response_usage1 === void 0 ? void 0 : _response_usage1.output_tokens) !== null && _ref1 !== void 0 ? _ref1 : 0,
6646
+ total_tokens: (_ref2 = (_response_usage2 = response.usage) === null || _response_usage2 === void 0 ? void 0 : _response_usage2.total_tokens) !== null && _ref2 !== void 0 ? _ref2 : 0
6630
6647
  };
6631
6648
  };
6632
6649
  var findPendingToolCalls = function(param) {
6633
6650
  var response = param.response;
6634
- var _response_output;
6651
+ var _response_output, _response_output1;
6635
6652
  var toolCalls = ((_response_output = response.output) !== null && _response_output !== void 0 ? _response_output : []).filter(function(item) {
6636
6653
  return item.type === "function_call";
6637
6654
  });
6638
6655
  if (toolCalls.length === 0) return [];
6639
- var _response_output1;
6640
6656
  var completedCallIds = new Set(((_response_output1 = response.output) !== null && _response_output1 !== void 0 ? _response_output1 : []).filter(function(item) {
6641
6657
  return(// @ts-expect-error missing openai type
6642
6658
  item.type === "function_call_output");
@@ -6722,7 +6738,7 @@ function parseBucket(param) {
6722
6738
  try {
6723
6739
  var arr = JSON.parse(value);
6724
6740
  return Array.isArray(arr) ? arr : [];
6725
- } catch (e) {
6741
+ } catch (unused) {
6726
6742
  return [];
6727
6743
  }
6728
6744
  }
@@ -7134,7 +7150,7 @@ var post17 = function(param) {
7134
7150
  readableStream = new ReadableStream({
7135
7151
  start: function start(controller) {
7136
7152
  return _async_to_generator(function() {
7137
- var error, _error_cause, _error_message, _error_cause_message, event;
7153
+ var error, _ref, _ref1, _error_cause, event;
7138
7154
  return _ts_generator(this, function(_state) {
7139
7155
  switch(_state.label){
7140
7156
  case 0:
@@ -7177,7 +7193,7 @@ var post17 = function(param) {
7177
7193
  failed_at: dayjs11().unix(),
7178
7194
  last_error: {
7179
7195
  code: "server_error",
7180
- message: "".concat((_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : "", " ").concat((_error_cause_message = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _error_cause_message !== void 0 ? _error_cause_message : "")
7196
+ 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 : "")
7181
7197
  }
7182
7198
  }
7183
7199
  };
@@ -7620,7 +7636,7 @@ var serializeStatus5 = function(param) {
7620
7636
  };
7621
7637
  var serializeItemAsMcpCallRunStep = function(param) {
7622
7638
  var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? dayjs17().unix() : _param_completedAt;
7623
- var _item_output, _ref;
7639
+ var _ref, _item_output;
7624
7640
  var toolCall = {
7625
7641
  id: "ftc".concat(item.id),
7626
7642
  type: "function",
@@ -7841,7 +7857,7 @@ var get17 = function(param) {
7841
7857
  var client = param.client, runAdapter = param.runAdapter;
7842
7858
  return function(urlString) {
7843
7859
  return _async_to_generator(function() {
7844
- var _last2, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data, _last2_id;
7860
+ var _ref, _last2, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data;
7845
7861
  return _ts_generator(this, function(_state) {
7846
7862
  switch(_state.label){
7847
7863
  case 0:
@@ -7989,7 +8005,7 @@ var get17 = function(param) {
7989
8005
  new Response(JSON.stringify({
7990
8006
  data: data,
7991
8007
  has_more: false,
7992
- last_id: (_last2_id = (_last2 = last2(response.output)) === null || _last2 === void 0 ? void 0 : _last2.id) !== null && _last2_id !== void 0 ? _last2_id : null
8008
+ last_id: (_ref = (_last2 = last2(response.output)) === null || _last2 === void 0 ? void 0 : _last2.id) !== null && _ref !== void 0 ? _ref : null
7993
8009
  }), {
7994
8010
  status: 200,
7995
8011
  headers: {
@@ -8032,7 +8048,7 @@ var computerCallOutput = function(param) {
8032
8048
  var parsedOutput;
8033
8049
  try {
8034
8050
  parsedOutput = JSON.parse(toolOutput.output);
8035
- } catch (e) {
8051
+ } catch (unused) {
8036
8052
  return {
8037
8053
  isComputerCallOutput: false
8038
8054
  };
@@ -8344,6 +8360,155 @@ var responsesStorageAdapter = function() {
8344
8360
  };
8345
8361
  };
8346
8362
  };
8363
+ // src/adapters/storage/azureResponsesStorageAdapter/index.ts
8364
+ var azureResponsesStorageAdapter = function() {
8365
+ var createResponseItems = [];
8366
+ var cachedClient = null;
8367
+ return function(param) {
8368
+ var runAdapter = param.runAdapter, client = param.client, originalClient = param.originalClient;
8369
+ var getAIProjectClient = function() {
8370
+ if (originalClient && (typeof originalClient === "undefined" ? "undefined" : _type_of(originalClient)) === "object" && "client" in originalClient) {
8371
+ return originalClient.client;
8372
+ }
8373
+ return client;
8374
+ };
8375
+ var getAzureClient = function() {
8376
+ return _async_to_generator(function() {
8377
+ var aiProjectClient, azureClient;
8378
+ return _ts_generator(this, function(_state) {
8379
+ switch(_state.label){
8380
+ case 0:
8381
+ if (cachedClient) {
8382
+ return [
8383
+ 2,
8384
+ cachedClient
8385
+ ];
8386
+ }
8387
+ aiProjectClient = getAIProjectClient();
8388
+ if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
8389
+ 3,
8390
+ 2
8391
+ ];
8392
+ return [
8393
+ 4,
8394
+ aiProjectClient.getOpenAIClient()
8395
+ ];
8396
+ case 1:
8397
+ azureClient = _state.sent();
8398
+ cachedClient = azureClient;
8399
+ return [
8400
+ 2,
8401
+ azureClient
8402
+ ];
8403
+ case 2:
8404
+ cachedClient = aiProjectClient;
8405
+ return [
8406
+ 2,
8407
+ aiProjectClient
8408
+ ];
8409
+ }
8410
+ });
8411
+ })();
8412
+ };
8413
+ var wrappedRunAdapter = _object_spread_props(_object_spread({}, runAdapter), {
8414
+ handleRun: function(args) {
8415
+ return _async_to_generator(function() {
8416
+ var azureClient;
8417
+ return _ts_generator(this, function(_state) {
8418
+ switch(_state.label){
8419
+ case 0:
8420
+ return [
8421
+ 4,
8422
+ getAzureClient()
8423
+ ];
8424
+ case 1:
8425
+ azureClient = _state.sent();
8426
+ return [
8427
+ 2,
8428
+ runAdapter.handleRun(_object_spread_props(_object_spread({}, args), {
8429
+ client: azureClient
8430
+ }))
8431
+ ];
8432
+ }
8433
+ });
8434
+ })();
8435
+ }
8436
+ });
8437
+ var wrapHandlerMethod = function(handlerFactory, method) {
8438
+ return function(urlString, options) {
8439
+ return _async_to_generator(function() {
8440
+ var openaiClient, handler;
8441
+ return _ts_generator(this, function(_state) {
8442
+ switch(_state.label){
8443
+ case 0:
8444
+ return [
8445
+ 4,
8446
+ getAzureClient()
8447
+ ];
8448
+ case 1:
8449
+ openaiClient = _state.sent();
8450
+ handler = handlerFactory({
8451
+ client: openaiClient,
8452
+ runAdapter: wrappedRunAdapter,
8453
+ createResponseItems: createResponseItems
8454
+ });
8455
+ return [
8456
+ 2,
8457
+ handler[method](urlString, options)
8458
+ ];
8459
+ }
8460
+ });
8461
+ })();
8462
+ };
8463
+ };
8464
+ var createWrappedHandlers = function(handlerFactory, methods) {
8465
+ var wrapped = {};
8466
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8467
+ try {
8468
+ for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8469
+ var method = _step.value;
8470
+ wrapped[method] = wrapHandlerMethod(handlerFactory, method);
8471
+ }
8472
+ } catch (err) {
8473
+ _didIteratorError = true;
8474
+ _iteratorError = err;
8475
+ } finally{
8476
+ try {
8477
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
8478
+ _iterator.return();
8479
+ }
8480
+ } finally{
8481
+ if (_didIteratorError) {
8482
+ throw _iteratorError;
8483
+ }
8484
+ }
8485
+ }
8486
+ return wrapped;
8487
+ };
8488
+ var _obj;
8489
+ return {
8490
+ requestHandlers: (_obj = {
8491
+ "^/(?:v1|/?openai)/assistants$": assistants2({
8492
+ runAdapter: wrappedRunAdapter
8493
+ }),
8494
+ "^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
8495
+ "post"
8496
+ ])
8497
+ }, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
8498
+ "get",
8499
+ "post"
8500
+ ])), _define_property(_obj, runsRegexp, createWrappedHandlers(runs2, [
8501
+ "post"
8502
+ ])), _define_property(_obj, runRegexp, createWrappedHandlers(run2, [
8503
+ "get"
8504
+ ])), _define_property(_obj, stepsRegexp, createWrappedHandlers(steps2, [
8505
+ "get"
8506
+ ])), _define_property(_obj, submitToolOutputsRegexp, createWrappedHandlers(submitToolOutputs2, [
8507
+ "post"
8508
+ ])), _obj)
8509
+ };
8510
+ };
8511
+ };
8347
8512
  // src/adapters/storage/azureAgentsStorageAdapter/threads/post.ts
8348
8513
  import dayjs21 from "dayjs";
8349
8514
  var post20 = function(param) {
@@ -8476,8 +8641,8 @@ var post21 = function(param) {
8476
8641
  }
8477
8642
  };
8478
8643
  } else if (c.type === "image_file") {
8479
- var imageFile = c.image_file || c.imageFile || {};
8480
8644
  var _imageFile_detail;
8645
+ var imageFile = c.image_file || c.imageFile || {};
8481
8646
  return {
8482
8647
  type: "image_file",
8483
8648
  image_file: {
@@ -8601,8 +8766,8 @@ var get19 = function(param) {
8601
8766
  }
8602
8767
  };
8603
8768
  } else if (c.type === "image_file") {
8604
- var imageFile = c.image_file || c.imageFile || {};
8605
8769
  var _imageFile_detail;
8770
+ var imageFile = c.image_file || c.imageFile || {};
8606
8771
  return {
8607
8772
  type: "image_file",
8608
8773
  image_file: {
@@ -8765,7 +8930,7 @@ var post22 = function(param) {
8765
8930
  readableStream = new ReadableStream({
8766
8931
  start: function start(controller) {
8767
8932
  return _async_to_generator(function() {
8768
- var error, _error_cause, _error_message, _error_cause_message, event;
8933
+ var error, _ref, _ref1, _error_cause, event;
8769
8934
  return _ts_generator(this, function(_state) {
8770
8935
  switch(_state.label){
8771
8936
  case 0:
@@ -8810,7 +8975,7 @@ var post22 = function(param) {
8810
8975
  failed_at: dayjs24().unix(),
8811
8976
  last_error: {
8812
8977
  code: "server_error",
8813
- message: "".concat((_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : "", " ").concat((_error_cause_message = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _error_cause_message !== void 0 ? _error_cause_message : "")
8978
+ 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 : "")
8814
8979
  }
8815
8980
  }
8816
8981
  };
@@ -9212,7 +9377,7 @@ var get22 = function(param) {
9212
9377
  file_search: tc.fileSearch || {}
9213
9378
  };
9214
9379
  } else if (tc.type === "function") {
9215
- var _tc_function_output, _ref;
9380
+ var _ref, _tc_function_output;
9216
9381
  return {
9217
9382
  id: tc.id,
9218
9383
  type: "function",
@@ -9329,12 +9494,12 @@ var steps3 = function(param) {
9329
9494
  };
9330
9495
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
9331
9496
  import dayjs27 from "dayjs";
9332
- function convertAzureEventToOpenAI(azureEvent, assistantId) {
9497
+ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9333
9498
  var event = azureEvent.event, data = azureEvent.data;
9334
9499
  var eventType = event;
9335
9500
  if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
9336
- var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
9337
9501
  var _data_temperature, _data_topP;
9502
+ var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
9338
9503
  return {
9339
9504
  event: eventType,
9340
9505
  data: {
@@ -9462,8 +9627,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
9462
9627
  type: "tool_calls",
9463
9628
  tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
9464
9629
  if (tc.type === "code_interpreter") {
9465
- var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
9466
9630
  var _tc_index;
9631
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
9467
9632
  return {
9468
9633
  index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
9469
9634
  id: tc.id,
@@ -9480,8 +9645,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
9480
9645
  };
9481
9646
  }
9482
9647
  if (output.type === "image") {
9483
- var _output_image;
9484
9648
  var _output_index1;
9649
+ var _output_image;
9485
9650
  return {
9486
9651
  index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
9487
9652
  type: "image",
@@ -9503,8 +9668,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
9503
9668
  file_search: tc.fileSearch || {}
9504
9669
  };
9505
9670
  } else if (tc.type === "function") {
9671
+ var _tc_index2, _ref, _ref1;
9506
9672
  var _tc_function, _tc_function1, _tc_function2;
9507
- var _tc_index2;
9508
9673
  return {
9509
9674
  index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
9510
9675
  id: tc.id,
@@ -9512,7 +9677,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
9512
9677
  function: {
9513
9678
  name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
9514
9679
  arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
9515
- output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) || null
9680
+ 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
9516
9681
  }
9517
9682
  };
9518
9683
  }
@@ -9590,6 +9755,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
9590
9755
  file_search: tc.fileSearch || {}
9591
9756
  };
9592
9757
  } else if (tc.type === "function") {
9758
+ var _ref, _ref1;
9593
9759
  var _tc_function, _tc_function1, _tc_function2;
9594
9760
  return {
9595
9761
  id: tc.id,
@@ -9597,7 +9763,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
9597
9763
  function: {
9598
9764
  name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
9599
9765
  arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
9600
- output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) || null
9766
+ 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
9601
9767
  }
9602
9768
  };
9603
9769
  }
@@ -9651,7 +9817,7 @@ var post23 = function(param) {
9651
9817
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9652
9818
  return function(urlString, options) {
9653
9819
  return _async_to_generator(function() {
9654
- var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
9820
+ var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, outputsMap, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
9655
9821
  return _ts_generator(this, function(_state) {
9656
9822
  switch(_state.label){
9657
9823
  case 0:
@@ -9662,6 +9828,12 @@ var post23 = function(param) {
9662
9828
  }
9663
9829
  body = JSON.parse(options.body);
9664
9830
  tool_outputs = body.tool_outputs, stream = body.stream;
9831
+ outputsMap = new Map(tool_outputs.map(function(output) {
9832
+ return [
9833
+ output.tool_call_id,
9834
+ output.output
9835
+ ];
9836
+ }));
9665
9837
  return [
9666
9838
  4,
9667
9839
  Promise.all(tool_outputs.map(function(output) {
@@ -9700,7 +9872,7 @@ var post23 = function(param) {
9700
9872
  }));
9701
9873
  streamRun = function(onEvent2) {
9702
9874
  return _async_to_generator(function() {
9703
- var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error, _error_cause, _error_message, _error_cause_message;
9875
+ var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error, _ref, _ref1, _error_cause;
9704
9876
  return _ts_generator(this, function(_state) {
9705
9877
  switch(_state.label){
9706
9878
  case 0:
@@ -9739,7 +9911,7 @@ var post23 = function(param) {
9739
9911
  ];
9740
9912
  _value = _step.value;
9741
9913
  azureEvent = _value;
9742
- openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId);
9914
+ openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap);
9743
9915
  if (!openaiEvent) return [
9744
9916
  3,
9745
9917
  6
@@ -9825,7 +9997,7 @@ var post23 = function(param) {
9825
9997
  required_action: null,
9826
9998
  last_error: {
9827
9999
  code: "server_error",
9828
- message: "".concat((_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : "", " ").concat((_error_cause_message = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _error_cause_message !== void 0 ? _error_cause_message : "")
10000
+ 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 : "")
9829
10001
  },
9830
10002
  expires_at: null,
9831
10003
  started_at: dayjs27().unix(),
@@ -9966,7 +10138,7 @@ var post24 = function(param) {
9966
10138
  var runAdapter = param.runAdapter;
9967
10139
  return function(_urlString, options) {
9968
10140
  return _async_to_generator(function() {
9969
- var body, _body_top_p, _body_temperature, openaiAssistant;
10141
+ var _body_top_p, _body_temperature, body, openaiAssistant;
9970
10142
  return _ts_generator(this, function(_state) {
9971
10143
  if (typeof options.body !== "string") {
9972
10144
  throw new Error("Request body is required");
@@ -10030,10 +10202,9 @@ var toUnixSeconds = function(value) {
10030
10202
  return parsed.isValid() ? parsed.unix() : void 0;
10031
10203
  };
10032
10204
  var transformAzureFile = function(file2) {
10033
- var _toUnixSeconds;
10205
+ var _toUnixSeconds, _file2_bytes;
10034
10206
  var createdAtUnix = (_toUnixSeconds = toUnixSeconds(file2.createdAt)) !== null && _toUnixSeconds !== void 0 ? _toUnixSeconds : dayjs28().unix();
10035
10207
  var expiresAtUnix = toUnixSeconds(file2.expiresAt);
10036
- var _file2_bytes;
10037
10208
  var openaiFile = {
10038
10209
  id: file2.id,
10039
10210
  object: file2.object || "file",
@@ -10220,7 +10391,7 @@ var fileContent = function(param) {
10220
10391
  return {
10221
10392
  get: function(url) {
10222
10393
  return _async_to_generator(function() {
10223
- var pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body, _nodeResponse_status;
10394
+ var _nodeResponse_status, pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body;
10224
10395
  return _ts_generator(this, function(_state) {
10225
10396
  switch(_state.label){
10226
10397
  case 0:
@@ -12362,8 +12533,8 @@ import { uid as uid10 } from "radash";
12362
12533
  function transformAnnotations(annotations) {
12363
12534
  return annotations.map(function(ann) {
12364
12535
  if (ann.type === "file_citation") {
12365
- var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
12366
12536
  var _ann_startIndex, _ann_endIndex;
12537
+ var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
12367
12538
  return {
12368
12539
  type: "file_citation",
12369
12540
  text: ann.text,
@@ -12375,8 +12546,8 @@ function transformAnnotations(annotations) {
12375
12546
  }
12376
12547
  };
12377
12548
  } else if (ann.type === "file_path") {
12378
- var _ann_filePath, _ann_file_path;
12379
12549
  var _ann_startIndex1, _ann_endIndex1;
12550
+ var _ann_filePath, _ann_file_path;
12380
12551
  return {
12381
12552
  type: "file_path",
12382
12553
  text: ann.text,
@@ -12402,8 +12573,8 @@ function transformMessageContentItem(content) {
12402
12573
  };
12403
12574
  }
12404
12575
  if (content.type === "image_file") {
12405
- var imageFile = content.image_file || content.imageFile || {};
12406
12576
  var _imageFile_detail;
12577
+ var imageFile = content.image_file || content.imageFile || {};
12407
12578
  return {
12408
12579
  type: "image_file",
12409
12580
  image_file: {
@@ -12427,8 +12598,8 @@ function transformMessageDeltaContentItem(content) {
12427
12598
  };
12428
12599
  }
12429
12600
  if (content.type === "image_file") {
12430
- var imageFile = content.image_file || content.imageFile || {};
12431
12601
  var _imageFile_detail;
12602
+ var imageFile = content.image_file || content.imageFile || {};
12432
12603
  return {
12433
12604
  index: content.index || 0,
12434
12605
  type: "image_file",
@@ -12444,8 +12615,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12444
12615
  var event = azureEvent.event, data = azureEvent.data;
12445
12616
  var eventType = event;
12446
12617
  if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
12447
- var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
12448
12618
  var _data_temperature, _data_topP;
12619
+ var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
12449
12620
  return {
12450
12621
  event: eventType,
12451
12622
  data: {
@@ -12552,8 +12723,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12552
12723
  type: "tool_calls",
12553
12724
  tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
12554
12725
  if (tc.type === "code_interpreter") {
12555
- var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12556
12726
  var _tc_index;
12727
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12557
12728
  return {
12558
12729
  index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
12559
12730
  id: tc.id,
@@ -12570,8 +12741,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12570
12741
  };
12571
12742
  }
12572
12743
  if (output.type === "image") {
12573
- var _output_image;
12574
12744
  var _output_index1;
12745
+ var _output_image;
12575
12746
  return {
12576
12747
  index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
12577
12748
  type: "image",
@@ -12593,8 +12764,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12593
12764
  file_search: tc.fileSearch || {}
12594
12765
  };
12595
12766
  } else if (tc.type === "function") {
12596
- var _tc_function, _tc_function1, _tc_function2;
12597
12767
  var _tc_index2;
12768
+ var _tc_function, _tc_function1, _tc_function2;
12598
12769
  return {
12599
12770
  index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
12600
12771
  id: tc.id,
@@ -12922,5 +13093,5 @@ var azureAgentsRunAdapter = function(param) {
12922
13093
  handleRun: handleRun
12923
13094
  };
12924
13095
  };
12925
- export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, supercompat, togetherClientAdapter };
13096
+ export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, azureResponsesStorageAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, supercompat, togetherClientAdapter };
12926
13097
  //# sourceMappingURL=index.js.map