supercompat 3.14.1 → 3.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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 [
@@ -1052,17 +1070,166 @@ var azureOpenaiClientAdapter = function(param) {
1052
1070
  }
1053
1071
  };
1054
1072
  };
1073
+ // src/adapters/client/azureAiProjectClientAdapter/models/get.ts
1074
+ var get3 = function(param) {
1075
+ var azureAiProject = param.azureAiProject;
1076
+ return function(_url, _options) {
1077
+ return _async_to_generator(function() {
1078
+ var models13, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, deployment, err, error;
1079
+ return _ts_generator(this, function(_state) {
1080
+ switch(_state.label){
1081
+ case 0:
1082
+ _state.trys.push([
1083
+ 0,
1084
+ 13,
1085
+ ,
1086
+ 14
1087
+ ]);
1088
+ models13 = [];
1089
+ _iteratorAbruptCompletion = false, _didIteratorError = false;
1090
+ _state.label = 1;
1091
+ case 1:
1092
+ _state.trys.push([
1093
+ 1,
1094
+ 6,
1095
+ 7,
1096
+ 12
1097
+ ]);
1098
+ _iterator = _async_iterator(azureAiProject.deployments.list());
1099
+ _state.label = 2;
1100
+ case 2:
1101
+ return [
1102
+ 4,
1103
+ _iterator.next()
1104
+ ];
1105
+ case 3:
1106
+ if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
1107
+ 3,
1108
+ 5
1109
+ ];
1110
+ _value = _step.value;
1111
+ deployment = _value;
1112
+ if (deployment.type === "ModelDeployment" && "modelName" in deployment && "modelPublisher" in deployment) {
1113
+ models13.push({
1114
+ id: deployment.modelName,
1115
+ object: "model",
1116
+ created: Date.now(),
1117
+ owned_by: deployment.modelPublisher
1118
+ });
1119
+ }
1120
+ _state.label = 4;
1121
+ case 4:
1122
+ _iteratorAbruptCompletion = false;
1123
+ return [
1124
+ 3,
1125
+ 2
1126
+ ];
1127
+ case 5:
1128
+ return [
1129
+ 3,
1130
+ 12
1131
+ ];
1132
+ case 6:
1133
+ err = _state.sent();
1134
+ _didIteratorError = true;
1135
+ _iteratorError = err;
1136
+ return [
1137
+ 3,
1138
+ 12
1139
+ ];
1140
+ case 7:
1141
+ _state.trys.push([
1142
+ 7,
1143
+ ,
1144
+ 10,
1145
+ 11
1146
+ ]);
1147
+ if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
1148
+ 3,
1149
+ 9
1150
+ ];
1151
+ return [
1152
+ 4,
1153
+ _iterator.return()
1154
+ ];
1155
+ case 8:
1156
+ _state.sent();
1157
+ _state.label = 9;
1158
+ case 9:
1159
+ return [
1160
+ 3,
1161
+ 11
1162
+ ];
1163
+ case 10:
1164
+ if (_didIteratorError) {
1165
+ throw _iteratorError;
1166
+ }
1167
+ return [
1168
+ 7
1169
+ ];
1170
+ case 11:
1171
+ return [
1172
+ 7
1173
+ ];
1174
+ case 12:
1175
+ return [
1176
+ 2,
1177
+ new Response(JSON.stringify({
1178
+ object: "list",
1179
+ data: models13
1180
+ }), {
1181
+ status: 200,
1182
+ headers: {
1183
+ "Content-Type": "application/json"
1184
+ }
1185
+ })
1186
+ ];
1187
+ case 13:
1188
+ error = _state.sent();
1189
+ return [
1190
+ 2,
1191
+ new Response(JSON.stringify({
1192
+ error: error
1193
+ }), {
1194
+ status: 500,
1195
+ headers: {
1196
+ "Content-Type": "application/json"
1197
+ }
1198
+ })
1199
+ ];
1200
+ case 14:
1201
+ return [
1202
+ 2
1203
+ ];
1204
+ }
1205
+ });
1206
+ })();
1207
+ };
1208
+ };
1209
+ // src/adapters/client/azureAiProjectClientAdapter/models/index.ts
1210
+ var models3 = function(param) {
1211
+ var azureAiProject = param.azureAiProject;
1212
+ return {
1213
+ get: get3({
1214
+ azureAiProject: azureAiProject
1215
+ })
1216
+ };
1217
+ };
1055
1218
  // src/adapters/client/azureAiProjectClientAdapter/index.ts
1056
1219
  var azureAiProjectClientAdapter = function(param) {
1057
1220
  var azureAiProject = param.azureAiProject;
1058
1221
  return {
1059
1222
  type: "AZURE_AI_PROJECT",
1060
1223
  client: azureAiProject,
1061
- requestHandlers: {}
1224
+ requestHandlers: {
1225
+ "^/v1/models$": models3({
1226
+ azureAiProject: azureAiProject
1227
+ })
1228
+ }
1062
1229
  };
1063
1230
  };
1064
1231
  // src/adapters/client/mistralClientAdapter/models/get.ts
1065
- var get3 = function(param) {
1232
+ var get4 = function(param) {
1066
1233
  var mistral = param.mistral;
1067
1234
  return function(_url, _options) {
1068
1235
  return _async_to_generator(function() {
@@ -1114,25 +1281,25 @@ var get3 = function(param) {
1114
1281
  };
1115
1282
  };
1116
1283
  // src/adapters/client/mistralClientAdapter/models/index.ts
1117
- var models3 = function(param) {
1284
+ var models4 = function(param) {
1118
1285
  var mistral = param.mistral;
1119
1286
  return {
1120
- get: get3({
1287
+ get: get4({
1121
1288
  mistral: mistral
1122
1289
  })
1123
1290
  };
1124
1291
  };
1125
1292
  // src/adapters/client/mistralClientAdapter/completions/serializeChunk.ts
1126
- var serializeDelta = function(_param) {
1127
- var toolCalls = _param.delta.toolCalls, rest = _object_without_properties(_param.delta, [
1293
+ var serializeDelta = function(_0) {
1294
+ var _ref = _0.delta, toolCalls = _ref.toolCalls, rest = _object_without_properties(_ref, [
1128
1295
  "toolCalls"
1129
1296
  ]);
1130
1297
  return _object_spread({}, rest, toolCalls ? {
1131
1298
  tool_calls: toolCalls
1132
1299
  } : {});
1133
1300
  };
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, [
1301
+ var serializeChoice = function(_0) {
1302
+ var _ref = _0.choice, finishReason = _ref.finishReason, delta = _ref.delta, rest = _object_without_properties(_ref, [
1136
1303
  "finishReason",
1137
1304
  "delta"
1138
1305
  ]);
@@ -1154,10 +1321,10 @@ var serializeChunk = function(param) {
1154
1321
  } : {});
1155
1322
  };
1156
1323
  // 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, [
1324
+ var serializeMessage = function(_0) {
1325
+ var _ref = _0.message, // @ts-ignore-next-line
1326
+ tool_calls = _ref.tool_calls, // @ts-ignore-next-line
1327
+ tool_call_id = _ref.tool_call_id, rest = _object_without_properties(_ref, [
1161
1328
  "tool_calls",
1162
1329
  "tool_call_id"
1163
1330
  ]);
@@ -1367,7 +1534,7 @@ var mistralClientAdapter = function(param) {
1367
1534
  return {
1368
1535
  client: mistral,
1369
1536
  requestHandlers: {
1370
- "^/v1/models$": models3({
1537
+ "^/v1/models$": models4({
1371
1538
  mistral: mistral
1372
1539
  }),
1373
1540
  "^/v1/chat/completions$": completions3({
@@ -1377,7 +1544,7 @@ var mistralClientAdapter = function(param) {
1377
1544
  };
1378
1545
  };
1379
1546
  // src/adapters/client/perplexityClientAdapter/models/get.ts
1380
- var models4 = [
1547
+ var models5 = [
1381
1548
  "sonar-reasoning-pro",
1382
1549
  "sonar-reasoning",
1383
1550
  "sonar-pro",
@@ -1387,7 +1554,7 @@ var models4 = [
1387
1554
  "llama-3.1-sonar-large-128k-online",
1388
1555
  "llama-3.1-sonar-huge-128k-online"
1389
1556
  ];
1390
- var get4 = function(param) {
1557
+ var get5 = function(param) {
1391
1558
  var perplexity = param.perplexity;
1392
1559
  return function(_url, _options) {
1393
1560
  return _async_to_generator(function() {
@@ -1397,7 +1564,7 @@ var get4 = function(param) {
1397
1564
  2,
1398
1565
  new Response(JSON.stringify({
1399
1566
  type: "list",
1400
- data: models4.map(function(model) {
1567
+ data: models5.map(function(model) {
1401
1568
  return {
1402
1569
  id: model,
1403
1570
  object: "model"
@@ -1431,10 +1598,10 @@ var get4 = function(param) {
1431
1598
  };
1432
1599
  };
1433
1600
  // src/adapters/client/perplexityClientAdapter/models/index.ts
1434
- var models5 = function(param) {
1601
+ var models6 = function(param) {
1435
1602
  var perplexity = param.perplexity;
1436
1603
  return {
1437
- get: get4({
1604
+ get: get5({
1438
1605
  perplexity: perplexity
1439
1606
  })
1440
1607
  };
@@ -1654,7 +1821,7 @@ var perplexityClientAdapter = function(param) {
1654
1821
  return {
1655
1822
  client: perplexity,
1656
1823
  requestHandlers: {
1657
- "^/v1/models$": models5({
1824
+ "^/v1/models$": models6({
1658
1825
  perplexity: perplexity
1659
1826
  }),
1660
1827
  "^/v1/chat/completions$": completions4({
@@ -1664,7 +1831,7 @@ var perplexityClientAdapter = function(param) {
1664
1831
  };
1665
1832
  };
1666
1833
  // src/adapters/client/anthropicClientAdapter/models/get.ts
1667
- var get5 = function(param) {
1834
+ var get6 = function(param) {
1668
1835
  var anthropic = param.anthropic;
1669
1836
  return function(_url, _options) {
1670
1837
  return _async_to_generator(function() {
@@ -1724,10 +1891,10 @@ var get5 = function(param) {
1724
1891
  };
1725
1892
  };
1726
1893
  // src/adapters/client/anthropicClientAdapter/models/index.ts
1727
- var models6 = function(param) {
1894
+ var models7 = function(param) {
1728
1895
  var anthropic = param.anthropic;
1729
1896
  return {
1730
- get: get5({
1897
+ get: get6({
1731
1898
  anthropic: anthropic
1732
1899
  })
1733
1900
  };
@@ -1802,7 +1969,7 @@ var serializeMessage2 = function(param) {
1802
1969
  if (!trimmed) return {};
1803
1970
  try {
1804
1971
  return JSON.parse(trimmed);
1805
- } catch (e) {
1972
+ } catch (unused) {
1806
1973
  return {};
1807
1974
  }
1808
1975
  };
@@ -2066,17 +2233,15 @@ var parseKeys = function(input) {
2066
2233
  };
2067
2234
  var normalizeKeys = function(keys) {
2068
2235
  return keys.map(function(key) {
2069
- var lowerKey = key.toLowerCase();
2070
2236
  var _keyAliasMap_lowerKey;
2237
+ var lowerKey = key.toLowerCase();
2071
2238
  return (_keyAliasMap_lowerKey = keyAliasMap[lowerKey]) !== null && _keyAliasMap_lowerKey !== void 0 ? _keyAliasMap_lowerKey : lowerKey;
2072
2239
  });
2073
2240
  };
2074
2241
  var normalizeScroll = function(details) {
2075
- var _sanitizeNumber;
2242
+ var _sanitizeNumber, _sanitizeNumber1, _ref, _sanitizeNumber2;
2076
2243
  var scrollX = (_sanitizeNumber = sanitizeNumber(details.scroll_x)) !== null && _sanitizeNumber !== void 0 ? _sanitizeNumber : 0;
2077
- var _sanitizeNumber1;
2078
2244
  var scrollY = (_sanitizeNumber1 = sanitizeNumber(details.scroll_y)) !== null && _sanitizeNumber1 !== void 0 ? _sanitizeNumber1 : 0;
2079
- var _sanitizeNumber2, _ref;
2080
2245
  var amount = (_ref = (_sanitizeNumber2 = sanitizeNumber(details.scroll_amount)) !== null && _sanitizeNumber2 !== void 0 ? _sanitizeNumber2 : sanitizeNumber(details.amount)) !== null && _ref !== void 0 ? _ref : 0;
2081
2246
  var direction = typeof details.scroll_direction === "string" ? details.scroll_direction.toLowerCase() : typeof details.direction === "string" ? details.direction.toLowerCase() : void 0;
2082
2247
  if (!scrollX && !scrollY && direction && amount) {
@@ -2113,46 +2278,46 @@ var normalizeActionString = function(action, details) {
2113
2278
  case "right_click":
2114
2279
  case "middle_click":
2115
2280
  {
2116
- var _coords_x, _coords_y;
2281
+ var _ref, _ref1;
2117
2282
  return {
2118
2283
  type: "click",
2119
2284
  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
2285
+ x: (_ref = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref !== void 0 ? _ref : 0,
2286
+ y: (_ref1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref1 !== void 0 ? _ref1 : 0
2122
2287
  };
2123
2288
  }
2124
2289
  case "double_click":
2125
- var _coords_x1, _coords_y1;
2290
+ var _ref2, _ref3;
2126
2291
  return {
2127
2292
  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
2293
+ x: (_ref2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref2 !== void 0 ? _ref2 : 0,
2294
+ y: (_ref3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref3 !== void 0 ? _ref3 : 0
2130
2295
  };
2131
2296
  case "triple_click":
2132
- var _coords_x2, _coords_y2;
2297
+ var _ref4, _ref5;
2133
2298
  return {
2134
2299
  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,
2300
+ x: (_ref4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref4 !== void 0 ? _ref4 : 0,
2301
+ y: (_ref5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref5 !== void 0 ? _ref5 : 0,
2137
2302
  repetitions: 3
2138
2303
  };
2139
2304
  case "left_mouse_down":
2140
- var _coords_x3, _coords_y3;
2305
+ var _ref6, _ref7;
2141
2306
  return {
2142
2307
  type: "click",
2143
2308
  button: clickButtonMap[action],
2144
2309
  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
2310
+ x: (_ref6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref6 !== void 0 ? _ref6 : 0,
2311
+ y: (_ref7 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref7 !== void 0 ? _ref7 : 0
2147
2312
  };
2148
2313
  case "left_mouse_up":
2149
- var _coords_x4, _coords_y4;
2314
+ var _ref8, _ref9;
2150
2315
  return {
2151
2316
  type: "click",
2152
2317
  button: clickButtonMap[action],
2153
2318
  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
2319
+ x: (_ref8 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref8 !== void 0 ? _ref8 : 0,
2320
+ y: (_ref9 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref9 !== void 0 ? _ref9 : 0
2156
2321
  };
2157
2322
  case "left_click_drag":
2158
2323
  {
@@ -2170,20 +2335,20 @@ var normalizeActionString = function(action, details) {
2170
2335
  }
2171
2336
  case "mouse_move":
2172
2337
  case "cursor_position":
2173
- var _coords_x5, _coords_y5;
2338
+ var _ref10, _ref11;
2174
2339
  return {
2175
2340
  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
2341
+ x: (_ref10 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref10 !== void 0 ? _ref10 : 0,
2342
+ y: (_ref11 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref11 !== void 0 ? _ref11 : 0
2178
2343
  };
2179
2344
  case "scroll":
2180
2345
  {
2346
+ var _ref12, _ref13;
2181
2347
  var _normalizeScroll = normalizeScroll(details), scroll_x = _normalizeScroll.scroll_x, scroll_y = _normalizeScroll.scroll_y;
2182
- var _coords_x6, _coords_y6;
2183
2348
  return _object_spread({
2184
2349
  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,
2350
+ x: (_ref12 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref12 !== void 0 ? _ref12 : 0,
2351
+ y: (_ref13 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref13 !== void 0 ? _ref13 : 0,
2187
2352
  scroll_x: scroll_x,
2188
2353
  scroll_y: scroll_y
2189
2354
  }, typeof details.scroll_direction === "string" ? {
@@ -2207,8 +2372,8 @@ var normalizeActionString = function(action, details) {
2207
2372
  case "key":
2208
2373
  case "hold_key":
2209
2374
  {
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));
2375
+ var _ref14, _details_text;
2376
+ 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
2377
  var normalized = {
2213
2378
  type: "keypress",
2214
2379
  keys: keys
@@ -2316,7 +2481,7 @@ var normalizeComputerToolCallPayload = function(payload) {
2316
2481
  var parseJson = function(value) {
2317
2482
  try {
2318
2483
  return JSON.parse(value);
2319
- } catch (e) {
2484
+ } catch (unused) {
2320
2485
  return void 0;
2321
2486
  }
2322
2487
  };
@@ -2374,7 +2539,7 @@ var post5 = function(param) {
2374
2539
  stream = new ReadableStream({
2375
2540
  start: function start(controller) {
2376
2541
  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;
2542
+ 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
2543
  return _ts_generator(this, function(_state) {
2379
2544
  switch(_state.label){
2380
2545
  case 0:
@@ -2387,18 +2552,18 @@ var post5 = function(param) {
2387
2552
  parseJson2 = function(value) {
2388
2553
  try {
2389
2554
  return JSON.parse(value);
2390
- } catch (e) {
2555
+ } catch (unused) {
2391
2556
  return void 0;
2392
2557
  }
2393
2558
  };
2394
2559
  getOrCreateIndexForToolUseId = function(toolUseId) {
2560
+ var _toolUseIdToIndex_get;
2395
2561
  if (!toolUseId) {
2396
2562
  return 0;
2397
2563
  }
2398
2564
  if (!toolUseIdToIndex.has(toolUseId)) {
2399
2565
  toolUseIdToIndex.set(toolUseId, nextToolCallIndex++);
2400
2566
  }
2401
- var _toolUseIdToIndex_get;
2402
2567
  return (_toolUseIdToIndex_get = toolUseIdToIndex.get(toolUseId)) !== null && _toolUseIdToIndex_get !== void 0 ? _toolUseIdToIndex_get : 0;
2403
2568
  };
2404
2569
  assignBlockToToolUse = function(param) {
@@ -2475,8 +2640,7 @@ var post5 = function(param) {
2475
2640
  5
2476
2641
  ];
2477
2642
  _value = _step.value;
2478
- _ref = _value;
2479
- chunk = _ref;
2643
+ chunk = _value;
2480
2644
  if (chunk.type === "content_block_stop") {
2481
2645
  toolUseId = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
2482
2646
  if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
@@ -2544,7 +2708,6 @@ var post5 = function(param) {
2544
2708
  if (toolUseId1 && computerToolUseIds.has(toolUseId1)) {
2545
2709
  ;
2546
2710
  existing = (_toolUseIdArgumentBuffer_get2 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get2 !== void 0 ? _toolUseIdArgumentBuffer_get2 : "";
2547
- ;
2548
2711
  updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
2549
2712
  toolUseIdArgumentBuffer.set(toolUseId1, updated);
2550
2713
  if (!normalizedComputerCalls.has(toolUseId1)) {
@@ -2569,7 +2732,6 @@ var post5 = function(param) {
2569
2732
  if (toolUseId1) {
2570
2733
  ;
2571
2734
  existing1 = (_toolUseIdArgumentBuffer_get3 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get3 !== void 0 ? _toolUseIdArgumentBuffer_get3 : "";
2572
- ;
2573
2735
  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
2736
  }
2575
2737
  index = getOrCreateIndexForBlock(chunk.index);
@@ -2660,7 +2822,6 @@ var post5 = function(param) {
2660
2822
  outputPayload = {
2661
2823
  content: (_chunk_content_block_content = chunk.content_block.content) !== null && _chunk_content_block_content !== void 0 ? _chunk_content_block_content : []
2662
2824
  };
2663
- ;
2664
2825
  toolCallId = (_getToolUseIdFromBlock = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock !== void 0 ? _getToolUseIdFromBlock : "";
2665
2826
  index3 = getOrCreateIndexForToolUseId(toolCallId);
2666
2827
  assignBlockToToolUse({
@@ -2697,7 +2858,6 @@ var post5 = function(param) {
2697
2858
  blockIndex: chunk.index,
2698
2859
  toolUseId: toolCallId1
2699
2860
  });
2700
- ;
2701
2861
  outputPayload1 = Object.keys(rest).length > 0 ? rest : {
2702
2862
  content: (_chunk_content_block_content1 = chunk.content_block.content) !== null && _chunk_content_block_content1 !== void 0 ? _chunk_content_block_content1 : {}
2703
2863
  };
@@ -2894,7 +3054,7 @@ var anthropicClientAdapter = function(param) {
2894
3054
  return {
2895
3055
  client: anthropic,
2896
3056
  requestHandlers: {
2897
- "^/v1/models$": models6({
3057
+ "^/v1/models$": models7({
2898
3058
  anthropic: anthropic
2899
3059
  }),
2900
3060
  "^/v1/chat/completions$": completions5({
@@ -2904,7 +3064,7 @@ var anthropicClientAdapter = function(param) {
2904
3064
  };
2905
3065
  };
2906
3066
  // src/adapters/client/togetherClientAdapter/models/get.ts
2907
- var get6 = function(param) {
3067
+ var get7 = function(param) {
2908
3068
  var together = param.together;
2909
3069
  return function(_url, _options) {
2910
3070
  return _async_to_generator(function() {
@@ -2960,10 +3120,10 @@ var get6 = function(param) {
2960
3120
  };
2961
3121
  };
2962
3122
  // src/adapters/client/togetherClientAdapter/models/index.ts
2963
- var models7 = function(param) {
3123
+ var models8 = function(param) {
2964
3124
  var together = param.together;
2965
3125
  return {
2966
- get: get6({
3126
+ get: get7({
2967
3127
  together: together
2968
3128
  })
2969
3129
  };
@@ -3152,7 +3312,7 @@ var togetherClientAdapter = function(param) {
3152
3312
  return {
3153
3313
  client: together,
3154
3314
  requestHandlers: {
3155
- "^/v1/models$": models7({
3315
+ "^/v1/models$": models8({
3156
3316
  together: together
3157
3317
  }),
3158
3318
  "^/(?:v1|/?openai)/chat/completions$": completions6({
@@ -3162,54 +3322,61 @@ var togetherClientAdapter = function(param) {
3162
3322
  };
3163
3323
  };
3164
3324
  // 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
- var get7 = function(param) {
3325
+ var get8 = function(param) {
3175
3326
  var google = param.google;
3176
3327
  return function(_url, _options) {
3177
3328
  return _async_to_generator(function() {
3329
+ var response, error;
3178
3330
  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
- };
3331
+ switch(_state.label){
3332
+ case 0:
3333
+ _state.trys.push([
3334
+ 0,
3335
+ 2,
3336
+ ,
3337
+ 3
3338
+ ]);
3339
+ return [
3340
+ 4,
3341
+ google.models.list()
3342
+ ];
3343
+ case 1:
3344
+ response = _state.sent();
3345
+ return [
3346
+ 2,
3347
+ new Response(JSON.stringify({
3348
+ type: "list",
3349
+ data: response.data.map(function(model) {
3350
+ return {
3351
+ id: model.id,
3352
+ object: "model"
3353
+ };
3354
+ })
3355
+ }), {
3356
+ status: 200,
3357
+ headers: {
3358
+ "Content-Type": "application/json"
3359
+ }
3189
3360
  })
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
- ];
3361
+ ];
3362
+ case 2:
3363
+ error = _state.sent();
3364
+ return [
3365
+ 2,
3366
+ new Response(JSON.stringify({
3367
+ error: error
3368
+ }), {
3369
+ status: 500,
3370
+ headers: {
3371
+ "Content-Type": "application/json"
3372
+ }
3373
+ })
3374
+ ];
3375
+ case 3:
3376
+ return [
3377
+ 2
3378
+ ];
3209
3379
  }
3210
- return [
3211
- 2
3212
- ];
3213
3380
  });
3214
3381
  })();
3215
3382
  };
@@ -3218,7 +3385,7 @@ var get7 = function(param) {
3218
3385
  var models9 = function(param) {
3219
3386
  var google = param.google;
3220
3387
  return {
3221
- get: get7({
3388
+ get: get8({
3222
3389
  google: google
3223
3390
  })
3224
3391
  };
@@ -3453,7 +3620,7 @@ var googleClientAdapter = function(param) {
3453
3620
  var models10 = [
3454
3621
  "Humiris/humiris-moai"
3455
3622
  ];
3456
- var get8 = function(param) {
3623
+ var get9 = function(param) {
3457
3624
  var humiris = param.humiris;
3458
3625
  return function(_url, _options) {
3459
3626
  return _async_to_generator(function() {
@@ -3500,7 +3667,7 @@ var get8 = function(param) {
3500
3667
  var models11 = function(param) {
3501
3668
  var humiris = param.humiris;
3502
3669
  return {
3503
- get: get8({
3670
+ get: get9({
3504
3671
  humiris: humiris
3505
3672
  })
3506
3673
  };
@@ -3637,7 +3804,7 @@ var humirisClientAdapter = function(param) {
3637
3804
  };
3638
3805
  };
3639
3806
  // src/adapters/client/ollamaClientAdapter/models/get.ts
3640
- var get9 = function(param) {
3807
+ var get10 = function(param) {
3641
3808
  var ollama = param.ollama;
3642
3809
  return function(_url, _options) {
3643
3810
  return _async_to_generator(function() {
@@ -3692,7 +3859,7 @@ var get9 = function(param) {
3692
3859
  var models12 = function(param) {
3693
3860
  var ollama = param.ollama;
3694
3861
  return {
3695
- get: get9({
3862
+ get: get10({
3696
3863
  ollama: ollama
3697
3864
  })
3698
3865
  };
@@ -3904,6 +4071,7 @@ var validToolCallContentTypes = [
3904
4071
  ];
3905
4072
  var serializeToolContent = function(param) {
3906
4073
  var toolCall = param.toolCall;
4074
+ var _toolCall_function_output;
3907
4075
  if (isArray(toolCall.function.output)) {
3908
4076
  var isEveryToolPartValid = toolCall.function.output.every(function(toolPart) {
3909
4077
  if (!isObject(toolPart)) return false;
@@ -3914,7 +4082,6 @@ var serializeToolContent = function(param) {
3914
4082
  }
3915
4083
  return JSON.stringify(toolCall.function.output);
3916
4084
  }
3917
- var _toolCall_function_output;
3918
4085
  return (_toolCall_function_output = toolCall.function.output) !== null && _toolCall_function_output !== void 0 ? _toolCall_function_output : "";
3919
4086
  };
3920
4087
  var serializeToolCall = function(param) {
@@ -4091,7 +4258,7 @@ var completionsRunAdapter = function() {
4091
4258
  handleRun: function(param) {
4092
4259
  var client = param.client, run4 = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages;
4093
4260
  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;
4261
+ 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
4262
  return _ts_generator(this, function(_state) {
4096
4263
  switch(_state.label){
4097
4264
  case 0:
@@ -4149,7 +4316,7 @@ var completionsRunAdapter = function() {
4149
4316
  status: "in_progress",
4150
4317
  last_error: {
4151
4318
  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 : "")
4319
+ 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
4320
  }
4154
4321
  })
4155
4322
  })
@@ -4454,19 +4621,19 @@ var completionsRunAdapter = function() {
4454
4621
  ];
4455
4622
  case 25:
4456
4623
  requiredToolCalls = pendingFunctionToolCalls.map(function(toolCall) {
4624
+ var _ref, _ref1;
4457
4625
  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 : "";
4626
+ var args = (_ref = (_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.arguments) !== null && _ref !== void 0 ? _ref : "";
4460
4627
  if (((_toolCall_function1 = toolCall.function) === null || _toolCall_function1 === void 0 ? void 0 : _toolCall_function1.name) === "computer_call") {
4628
+ var _ref2, _ref3;
4461
4629
  var parsedArguments = {};
4462
4630
  try {
4463
4631
  parsedArguments = JSON.parse(args || "{}");
4464
- } catch (e) {
4632
+ } catch (unused) {
4465
4633
  parsedArguments = {};
4466
4634
  }
4467
- var _parsedArguments_action, _ref;
4468
4635
  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 : {},
4636
+ action: (_ref2 = (_ref3 = parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.action) !== null && _ref3 !== void 0 ? _ref3 : parsedArguments) !== null && _ref2 !== void 0 ? _ref2 : {},
4470
4637
  pending_safety_checks: Array.isArray(parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.pending_safety_checks) ? parsedArguments.pending_safety_checks : []
4471
4638
  };
4472
4639
  return {
@@ -4475,12 +4642,11 @@ var completionsRunAdapter = function() {
4475
4642
  computer_call: computerCall
4476
4643
  };
4477
4644
  }
4478
- var _toolCall_function_name;
4479
4645
  return {
4480
4646
  id: toolCall.id,
4481
4647
  type: "function",
4482
4648
  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 : "",
4649
+ name: (_ref1 = (_toolCall_function2 = toolCall.function) === null || _toolCall_function2 === void 0 ? void 0 : _toolCall_function2.name) !== null && _ref1 !== void 0 ? _ref1 : "",
4484
4650
  arguments: args
4485
4651
  }
4486
4652
  };
@@ -4716,11 +4882,11 @@ var post11 = function(param) {
4716
4882
  };
4717
4883
  // src/adapters/storage/prismaStorageAdapter/threads/messages/get.ts
4718
4884
  import { assign as assign3, last } from "radash";
4719
- var get10 = function(param) {
4885
+ var get11 = function(param) {
4720
4886
  var prisma = param.prisma;
4721
4887
  return function(urlString) {
4722
4888
  return _async_to_generator(function() {
4723
- var _last, url, _url_pathname_match, threadId, _assign3, limit, order, after, pageSize, messagesPlusOne, messages5, _last_id;
4889
+ var _ref, _last, url, _url_pathname_match, threadId, _assign3, limit, order, after, pageSize, messagesPlusOne, messages5;
4724
4890
  return _ts_generator(this, function(_state) {
4725
4891
  switch(_state.label){
4726
4892
  case 0:
@@ -4760,7 +4926,7 @@ var get10 = function(param) {
4760
4926
  });
4761
4927
  }),
4762
4928
  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
4929
+ last_id: (_ref = (_last = last(messages5)) === null || _last === void 0 ? void 0 : _last.id) !== null && _ref !== void 0 ? _ref : null
4764
4930
  }), {
4765
4931
  status: 200,
4766
4932
  headers: {
@@ -4780,7 +4946,7 @@ var messages2 = function(param) {
4780
4946
  post: post11({
4781
4947
  prisma: prisma
4782
4948
  }),
4783
- get: get10({
4949
+ get: get11({
4784
4950
  prisma: prisma
4785
4951
  })
4786
4952
  };
@@ -4851,11 +5017,11 @@ var mapPrismaRun = function(run4) {
4851
5017
  };
4852
5018
  };
4853
5019
  // src/adapters/storage/prismaStorageAdapter/threads/runs/get.ts
4854
- var get11 = function(param) {
5020
+ var get12 = function(param) {
4855
5021
  var prisma = param.prisma;
4856
5022
  return function(urlString) {
4857
5023
  return _async_to_generator(function() {
4858
- var _runs4_at, url, _url_pathname_match, threadId, _assign4, limit, order, after, pageSize, runsPlusOne, runs4, _runs4_at_id;
5024
+ var _ref, _runs4_at, url, _url_pathname_match, threadId, _assign4, limit, order, after, pageSize, runsPlusOne, runs4;
4859
5025
  return _ts_generator(this, function(_state) {
4860
5026
  switch(_state.label){
4861
5027
  case 0:
@@ -4895,7 +5061,7 @@ var get11 = function(param) {
4895
5061
  });
4896
5062
  }),
4897
5063
  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
5064
+ 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
5065
  }), {
4900
5066
  status: 200,
4901
5067
  headers: {
@@ -5371,7 +5537,7 @@ var post12 = function(param) {
5371
5537
  readableStream = new ReadableStream({
5372
5538
  start: function start(controller) {
5373
5539
  return _async_to_generator(function() {
5374
- var error, _error_cause, _error_message, _error_cause_message;
5540
+ var error, _ref, _ref1, _error_cause;
5375
5541
  return _ts_generator(this, function(_state) {
5376
5542
  switch(_state.label){
5377
5543
  case 0:
@@ -5422,7 +5588,7 @@ var post12 = function(param) {
5422
5588
  failed_at: dayjs7().unix(),
5423
5589
  last_error: {
5424
5590
  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 : "")
5591
+ 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
5592
  }
5427
5593
  }
5428
5594
  });
@@ -5472,7 +5638,7 @@ var post12 = function(param) {
5472
5638
  var runs = function(param) {
5473
5639
  var prisma = param.prisma, runAdapter = param.runAdapter;
5474
5640
  return {
5475
- get: get11({
5641
+ get: get12({
5476
5642
  prisma: prisma
5477
5643
  }),
5478
5644
  post: post12({
@@ -5482,7 +5648,7 @@ var runs = function(param) {
5482
5648
  };
5483
5649
  };
5484
5650
  // src/adapters/storage/prismaStorageAdapter/threads/run/get.ts
5485
- var get12 = function(param) {
5651
+ var get13 = function(param) {
5486
5652
  var prisma = param.prisma;
5487
5653
  return function(urlString) {
5488
5654
  return _async_to_generator(function() {
@@ -5537,18 +5703,18 @@ var get12 = function(param) {
5537
5703
  var run = function(param) {
5538
5704
  var prisma = param.prisma, runAdapter = param.runAdapter;
5539
5705
  return {
5540
- get: get12({
5706
+ get: get13({
5541
5707
  prisma: prisma
5542
5708
  })
5543
5709
  };
5544
5710
  };
5545
5711
  // src/adapters/storage/prismaStorageAdapter/threads/runs/steps/get.ts
5546
5712
  import { assign as assign6 } from "radash";
5547
- var get13 = function(param) {
5713
+ var get14 = function(param) {
5548
5714
  var prisma = param.prisma;
5549
5715
  return function(urlString) {
5550
5716
  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;
5717
+ var _ref, _runSteps_at, url, _url_pathname_match, threadId, runId, _assign6, limit, order, after, pageSize, runStepsPlusOne, runSteps;
5552
5718
  return _ts_generator(this, function(_state) {
5553
5719
  switch(_state.label){
5554
5720
  case 0:
@@ -5589,7 +5755,7 @@ var get13 = function(param) {
5589
5755
  });
5590
5756
  }),
5591
5757
  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
5758
+ 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
5759
  }), {
5594
5760
  status: 200,
5595
5761
  headers: {
@@ -5606,7 +5772,7 @@ var get13 = function(param) {
5606
5772
  var steps = function(param) {
5607
5773
  var prisma = param.prisma;
5608
5774
  return {
5609
- get: get13({
5775
+ get: get14({
5610
5776
  prisma: prisma
5611
5777
  })
5612
5778
  };
@@ -6349,7 +6515,7 @@ function responseId(param) {
6349
6515
  try {
6350
6516
  arr = JSON.parse(raw);
6351
6517
  if (!Array.isArray(arr)) continue;
6352
- } catch (e) {
6518
+ } catch (unused) {
6353
6519
  continue;
6354
6520
  }
6355
6521
  for(var j = arr.length - 1; j >= 0; j--){
@@ -6363,7 +6529,7 @@ function responseId(param) {
6363
6529
  return null;
6364
6530
  }
6365
6531
  // src/adapters/storage/responsesStorageAdapter/threads/messages/get.ts
6366
- var get14 = function(param) {
6532
+ var get15 = function(param) {
6367
6533
  var client = param.client, runAdapter = param.runAdapter;
6368
6534
  return function(urlString) {
6369
6535
  return _async_to_generator(function() {
@@ -6500,10 +6666,10 @@ var fetchResponsesForItems = function(param) {
6500
6666
  var assignTimestamps = function(param) {
6501
6667
  var items = param.items, responseMap = param.responseMap, sortOrder = param.sortOrder, conversationCreatedAt = param.conversationCreatedAt;
6502
6668
  var itemsWithTimestamps = items.map(function(entry) {
6669
+ var _ref;
6503
6670
  var _responseMap_get;
6504
- var _responseMap_get_created_at;
6505
6671
  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,
6672
+ 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
6673
  assignedTimestamp: 0
6508
6674
  });
6509
6675
  });
@@ -6579,14 +6745,14 @@ var messages3 = function(param) {
6579
6745
  runAdapter: runAdapter,
6580
6746
  createResponseItems: createResponseItems
6581
6747
  }),
6582
- get: get14({
6748
+ get: get15({
6583
6749
  client: client,
6584
6750
  runAdapter: runAdapter
6585
6751
  })
6586
6752
  };
6587
6753
  };
6588
6754
  // src/adapters/storage/responsesStorageAdapter/threads/runs/get.ts
6589
- var get15 = function() {
6755
+ var get16 = function() {
6590
6756
  return function(urlString) {
6591
6757
  return _async_to_generator(function() {
6592
6758
  return _ts_generator(this, function(_state) {
@@ -6614,29 +6780,28 @@ import { assign as assign8 } from "radash";
6614
6780
  // src/lib/responses/serializeResponseAsRun.ts
6615
6781
  var serializeStatus = function(param) {
6616
6782
  var response = param.response;
6783
+ var _ref;
6617
6784
  var _response_status;
6618
6785
  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";
6786
+ return (_ref = (_response_status = response.status) === null || _response_status === void 0 ? void 0 : _response_status.toLowerCase()) !== null && _ref !== void 0 ? _ref : "completed";
6621
6787
  };
6622
6788
  var serializeUsage = function(param) {
6623
6789
  var response = param.response;
6790
+ var _ref, _ref1, _ref2;
6624
6791
  var _response_usage, _response_usage1, _response_usage2;
6625
- var _response_usage_input_tokens, _response_usage_output_tokens, _response_usage_total_tokens;
6626
6792
  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
6793
+ prompt_tokens: (_ref = (_response_usage = response.usage) === null || _response_usage === void 0 ? void 0 : _response_usage.input_tokens) !== null && _ref !== void 0 ? _ref : 0,
6794
+ completion_tokens: (_ref1 = (_response_usage1 = response.usage) === null || _response_usage1 === void 0 ? void 0 : _response_usage1.output_tokens) !== null && _ref1 !== void 0 ? _ref1 : 0,
6795
+ 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
6796
  };
6631
6797
  };
6632
6798
  var findPendingToolCalls = function(param) {
6633
6799
  var response = param.response;
6634
- var _response_output;
6800
+ var _response_output, _response_output1;
6635
6801
  var toolCalls = ((_response_output = response.output) !== null && _response_output !== void 0 ? _response_output : []).filter(function(item) {
6636
6802
  return item.type === "function_call";
6637
6803
  });
6638
6804
  if (toolCalls.length === 0) return [];
6639
- var _response_output1;
6640
6805
  var completedCallIds = new Set(((_response_output1 = response.output) !== null && _response_output1 !== void 0 ? _response_output1 : []).filter(function(item) {
6641
6806
  return(// @ts-expect-error missing openai type
6642
6807
  item.type === "function_call_output");
@@ -6722,7 +6887,7 @@ function parseBucket(param) {
6722
6887
  try {
6723
6888
  var arr = JSON.parse(value);
6724
6889
  return Array.isArray(arr) ? arr : [];
6725
- } catch (e) {
6890
+ } catch (unused) {
6726
6891
  return [];
6727
6892
  }
6728
6893
  }
@@ -7134,7 +7299,7 @@ var post17 = function(param) {
7134
7299
  readableStream = new ReadableStream({
7135
7300
  start: function start(controller) {
7136
7301
  return _async_to_generator(function() {
7137
- var error, _error_cause, _error_message, _error_cause_message, event;
7302
+ var error, _ref, _ref1, _error_cause, event;
7138
7303
  return _ts_generator(this, function(_state) {
7139
7304
  switch(_state.label){
7140
7305
  case 0:
@@ -7177,7 +7342,7 @@ var post17 = function(param) {
7177
7342
  failed_at: dayjs11().unix(),
7178
7343
  last_error: {
7179
7344
  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 : "")
7345
+ 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
7346
  }
7182
7347
  }
7183
7348
  };
@@ -7257,7 +7422,7 @@ var post17 = function(param) {
7257
7422
  var runs2 = function(param) {
7258
7423
  var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
7259
7424
  return {
7260
- get: get15(),
7425
+ get: get16(),
7261
7426
  post: post17({
7262
7427
  client: client,
7263
7428
  createResponseItems: createResponseItems,
@@ -7266,7 +7431,7 @@ var runs2 = function(param) {
7266
7431
  };
7267
7432
  };
7268
7433
  // src/adapters/storage/responsesStorageAdapter/threads/run/get.ts
7269
- var get16 = function(param) {
7434
+ var get17 = function(param) {
7270
7435
  var client = param.client, runAdapter = param.runAdapter;
7271
7436
  return function(urlString) {
7272
7437
  return _async_to_generator(function() {
@@ -7316,7 +7481,7 @@ var get16 = function(param) {
7316
7481
  var run2 = function(param) {
7317
7482
  var client = param.client, runAdapter = param.runAdapter;
7318
7483
  return {
7319
- get: get16({
7484
+ get: get17({
7320
7485
  client: client,
7321
7486
  runAdapter: runAdapter
7322
7487
  })
@@ -7620,7 +7785,7 @@ var serializeStatus5 = function(param) {
7620
7785
  };
7621
7786
  var serializeItemAsMcpCallRunStep = function(param) {
7622
7787
  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;
7788
+ var _ref, _item_output;
7624
7789
  var toolCall = {
7625
7790
  id: "ftc".concat(item.id),
7626
7791
  type: "function",
@@ -7837,11 +8002,11 @@ var serializeItemAsReasoningRunStep = function(param) {
7837
8002
  };
7838
8003
  };
7839
8004
  // src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
7840
- var get17 = function(param) {
8005
+ var get18 = function(param) {
7841
8006
  var client = param.client, runAdapter = param.runAdapter;
7842
8007
  return function(urlString) {
7843
8008
  return _async_to_generator(function() {
7844
- var _last2, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data, _last2_id;
8009
+ var _ref, _last2, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data;
7845
8010
  return _ts_generator(this, function(_state) {
7846
8011
  switch(_state.label){
7847
8012
  case 0:
@@ -7989,7 +8154,7 @@ var get17 = function(param) {
7989
8154
  new Response(JSON.stringify({
7990
8155
  data: data,
7991
8156
  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
8157
+ last_id: (_ref = (_last2 = last2(response.output)) === null || _last2 === void 0 ? void 0 : _last2.id) !== null && _ref !== void 0 ? _ref : null
7993
8158
  }), {
7994
8159
  status: 200,
7995
8160
  headers: {
@@ -8006,7 +8171,7 @@ var get17 = function(param) {
8006
8171
  var steps2 = function(param) {
8007
8172
  var client = param.client, runAdapter = param.runAdapter;
8008
8173
  return {
8009
- get: get17({
8174
+ get: get18({
8010
8175
  client: client,
8011
8176
  runAdapter: runAdapter
8012
8177
  })
@@ -8032,7 +8197,7 @@ var computerCallOutput = function(param) {
8032
8197
  var parsedOutput;
8033
8198
  try {
8034
8199
  parsedOutput = JSON.parse(toolOutput.output);
8035
- } catch (e) {
8200
+ } catch (unused) {
8036
8201
  return {
8037
8202
  isComputerCallOutput: false
8038
8203
  };
@@ -8228,7 +8393,7 @@ var submitToolOutputs2 = function(param) {
8228
8393
  };
8229
8394
  };
8230
8395
  // src/adapters/storage/responsesStorageAdapter/assistants/get.ts
8231
- var get18 = function(param) {
8396
+ var get19 = function(param) {
8232
8397
  var runAdapter = param.runAdapter;
8233
8398
  return function(_urlString) {
8234
8399
  return _async_to_generator(function() {
@@ -8303,7 +8468,7 @@ var post19 = function() {
8303
8468
  var assistants2 = function(param) {
8304
8469
  var runAdapter = param.runAdapter;
8305
8470
  return {
8306
- get: get18({
8471
+ get: get19({
8307
8472
  runAdapter: runAdapter
8308
8473
  }),
8309
8474
  post: post19()
@@ -8344,6 +8509,155 @@ var responsesStorageAdapter = function() {
8344
8509
  };
8345
8510
  };
8346
8511
  };
8512
+ // src/adapters/storage/azureResponsesStorageAdapter/index.ts
8513
+ var azureResponsesStorageAdapter = function() {
8514
+ var createResponseItems = [];
8515
+ var cachedClient = null;
8516
+ return function(param) {
8517
+ var runAdapter = param.runAdapter, client = param.client, originalClient = param.originalClient;
8518
+ var getAIProjectClient = function() {
8519
+ if (originalClient && (typeof originalClient === "undefined" ? "undefined" : _type_of(originalClient)) === "object" && "client" in originalClient) {
8520
+ return originalClient.client;
8521
+ }
8522
+ return client;
8523
+ };
8524
+ var getAzureClient = function() {
8525
+ return _async_to_generator(function() {
8526
+ var aiProjectClient, azureClient;
8527
+ return _ts_generator(this, function(_state) {
8528
+ switch(_state.label){
8529
+ case 0:
8530
+ if (cachedClient) {
8531
+ return [
8532
+ 2,
8533
+ cachedClient
8534
+ ];
8535
+ }
8536
+ aiProjectClient = getAIProjectClient();
8537
+ if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
8538
+ 3,
8539
+ 2
8540
+ ];
8541
+ return [
8542
+ 4,
8543
+ aiProjectClient.getOpenAIClient()
8544
+ ];
8545
+ case 1:
8546
+ azureClient = _state.sent();
8547
+ cachedClient = azureClient;
8548
+ return [
8549
+ 2,
8550
+ azureClient
8551
+ ];
8552
+ case 2:
8553
+ cachedClient = aiProjectClient;
8554
+ return [
8555
+ 2,
8556
+ aiProjectClient
8557
+ ];
8558
+ }
8559
+ });
8560
+ })();
8561
+ };
8562
+ var wrappedRunAdapter = _object_spread_props(_object_spread({}, runAdapter), {
8563
+ handleRun: function(args) {
8564
+ return _async_to_generator(function() {
8565
+ var azureClient;
8566
+ return _ts_generator(this, function(_state) {
8567
+ switch(_state.label){
8568
+ case 0:
8569
+ return [
8570
+ 4,
8571
+ getAzureClient()
8572
+ ];
8573
+ case 1:
8574
+ azureClient = _state.sent();
8575
+ return [
8576
+ 2,
8577
+ runAdapter.handleRun(_object_spread_props(_object_spread({}, args), {
8578
+ client: azureClient
8579
+ }))
8580
+ ];
8581
+ }
8582
+ });
8583
+ })();
8584
+ }
8585
+ });
8586
+ var wrapHandlerMethod = function(handlerFactory, method) {
8587
+ return function(urlString, options) {
8588
+ return _async_to_generator(function() {
8589
+ var openaiClient, handler;
8590
+ return _ts_generator(this, function(_state) {
8591
+ switch(_state.label){
8592
+ case 0:
8593
+ return [
8594
+ 4,
8595
+ getAzureClient()
8596
+ ];
8597
+ case 1:
8598
+ openaiClient = _state.sent();
8599
+ handler = handlerFactory({
8600
+ client: openaiClient,
8601
+ runAdapter: wrappedRunAdapter,
8602
+ createResponseItems: createResponseItems
8603
+ });
8604
+ return [
8605
+ 2,
8606
+ handler[method](urlString, options)
8607
+ ];
8608
+ }
8609
+ });
8610
+ })();
8611
+ };
8612
+ };
8613
+ var createWrappedHandlers = function(handlerFactory, methods) {
8614
+ var wrapped = {};
8615
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8616
+ try {
8617
+ for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8618
+ var method = _step.value;
8619
+ wrapped[method] = wrapHandlerMethod(handlerFactory, method);
8620
+ }
8621
+ } catch (err) {
8622
+ _didIteratorError = true;
8623
+ _iteratorError = err;
8624
+ } finally{
8625
+ try {
8626
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
8627
+ _iterator.return();
8628
+ }
8629
+ } finally{
8630
+ if (_didIteratorError) {
8631
+ throw _iteratorError;
8632
+ }
8633
+ }
8634
+ }
8635
+ return wrapped;
8636
+ };
8637
+ var _obj;
8638
+ return {
8639
+ requestHandlers: (_obj = {
8640
+ "^/(?:v1|/?openai)/assistants$": assistants2({
8641
+ runAdapter: wrappedRunAdapter
8642
+ }),
8643
+ "^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
8644
+ "post"
8645
+ ])
8646
+ }, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
8647
+ "get",
8648
+ "post"
8649
+ ])), _define_property(_obj, runsRegexp, createWrappedHandlers(runs2, [
8650
+ "post"
8651
+ ])), _define_property(_obj, runRegexp, createWrappedHandlers(run2, [
8652
+ "get"
8653
+ ])), _define_property(_obj, stepsRegexp, createWrappedHandlers(steps2, [
8654
+ "get"
8655
+ ])), _define_property(_obj, submitToolOutputsRegexp, createWrappedHandlers(submitToolOutputs2, [
8656
+ "post"
8657
+ ])), _obj)
8658
+ };
8659
+ };
8660
+ };
8347
8661
  // src/adapters/storage/azureAgentsStorageAdapter/threads/post.ts
8348
8662
  import dayjs21 from "dayjs";
8349
8663
  var post20 = function(param) {
@@ -8476,8 +8790,8 @@ var post21 = function(param) {
8476
8790
  }
8477
8791
  };
8478
8792
  } else if (c.type === "image_file") {
8479
- var imageFile = c.image_file || c.imageFile || {};
8480
8793
  var _imageFile_detail;
8794
+ var imageFile = c.image_file || c.imageFile || {};
8481
8795
  return {
8482
8796
  type: "image_file",
8483
8797
  image_file: {
@@ -8513,7 +8827,7 @@ var post21 = function(param) {
8513
8827
  };
8514
8828
  // src/adapters/storage/azureAgentsStorageAdapter/threads/messages/get.ts
8515
8829
  import dayjs23 from "dayjs";
8516
- var get19 = function(param) {
8830
+ var get20 = function(param) {
8517
8831
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
8518
8832
  return function(urlString) {
8519
8833
  return _async_to_generator(function() {
@@ -8601,8 +8915,8 @@ var get19 = function(param) {
8601
8915
  }
8602
8916
  };
8603
8917
  } else if (c.type === "image_file") {
8604
- var imageFile = c.image_file || c.imageFile || {};
8605
8918
  var _imageFile_detail;
8919
+ var imageFile = c.image_file || c.imageFile || {};
8606
8920
  return {
8607
8921
  type: "image_file",
8608
8922
  image_file: {
@@ -8705,14 +9019,14 @@ var messages4 = function(param) {
8705
9019
  azureAiProject: azureAiProject,
8706
9020
  runAdapter: runAdapter
8707
9021
  }),
8708
- get: get19({
9022
+ get: get20({
8709
9023
  azureAiProject: azureAiProject,
8710
9024
  runAdapter: runAdapter
8711
9025
  })
8712
9026
  };
8713
9027
  };
8714
9028
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/get.ts
8715
- var get20 = function() {
9029
+ var get21 = function() {
8716
9030
  return function() {
8717
9031
  return _async_to_generator(function() {
8718
9032
  var response;
@@ -8765,7 +9079,7 @@ var post22 = function(param) {
8765
9079
  readableStream = new ReadableStream({
8766
9080
  start: function start(controller) {
8767
9081
  return _async_to_generator(function() {
8768
- var error, _error_cause, _error_message, _error_cause_message, event;
9082
+ var error, _ref, _ref1, _error_cause, event;
8769
9083
  return _ts_generator(this, function(_state) {
8770
9084
  switch(_state.label){
8771
9085
  case 0:
@@ -8810,7 +9124,7 @@ var post22 = function(param) {
8810
9124
  failed_at: dayjs24().unix(),
8811
9125
  last_error: {
8812
9126
  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 : "")
9127
+ 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
9128
  }
8815
9129
  }
8816
9130
  };
@@ -9008,7 +9322,7 @@ var post22 = function(param) {
9008
9322
  var runs3 = function(param) {
9009
9323
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9010
9324
  return {
9011
- get: get20(),
9325
+ get: get21(),
9012
9326
  post: post22({
9013
9327
  azureAiProject: azureAiProject,
9014
9328
  runAdapter: runAdapter
@@ -9017,7 +9331,7 @@ var runs3 = function(param) {
9017
9331
  };
9018
9332
  // src/adapters/storage/azureAgentsStorageAdapter/threads/run/get.ts
9019
9333
  import dayjs25 from "dayjs";
9020
- var get21 = function(param) {
9334
+ var get22 = function(param) {
9021
9335
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9022
9336
  return function(urlString) {
9023
9337
  return _async_to_generator(function() {
@@ -9101,7 +9415,7 @@ var get21 = function(param) {
9101
9415
  var run3 = function(param) {
9102
9416
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9103
9417
  return {
9104
- get: get21({
9418
+ get: get22({
9105
9419
  azureAiProject: azureAiProject,
9106
9420
  runAdapter: runAdapter
9107
9421
  })
@@ -9109,7 +9423,7 @@ var run3 = function(param) {
9109
9423
  };
9110
9424
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
9111
9425
  import dayjs26 from "dayjs";
9112
- var get22 = function(param) {
9426
+ var get23 = function(param) {
9113
9427
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9114
9428
  return function(urlString) {
9115
9429
  return _async_to_generator(function() {
@@ -9212,7 +9526,7 @@ var get22 = function(param) {
9212
9526
  file_search: tc.fileSearch || {}
9213
9527
  };
9214
9528
  } else if (tc.type === "function") {
9215
- var _tc_function_output, _ref;
9529
+ var _ref, _tc_function_output;
9216
9530
  return {
9217
9531
  id: tc.id,
9218
9532
  type: "function",
@@ -9320,7 +9634,7 @@ var get22 = function(param) {
9320
9634
  var steps3 = function(param) {
9321
9635
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9322
9636
  return {
9323
- get: get22({
9637
+ get: get23({
9324
9638
  azureAiProject: azureAiProject,
9325
9639
  runAdapter: runAdapter,
9326
9640
  prisma: prisma
@@ -9333,8 +9647,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9333
9647
  var event = azureEvent.event, data = azureEvent.data;
9334
9648
  var eventType = event;
9335
9649
  if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
9336
- var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
9337
9650
  var _data_temperature, _data_topP;
9651
+ var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
9338
9652
  return {
9339
9653
  event: eventType,
9340
9654
  data: {
@@ -9462,8 +9776,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9462
9776
  type: "tool_calls",
9463
9777
  tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
9464
9778
  if (tc.type === "code_interpreter") {
9465
- var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
9466
9779
  var _tc_index;
9780
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
9467
9781
  return {
9468
9782
  index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
9469
9783
  id: tc.id,
@@ -9480,8 +9794,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9480
9794
  };
9481
9795
  }
9482
9796
  if (output.type === "image") {
9483
- var _output_image;
9484
9797
  var _output_index1;
9798
+ var _output_image;
9485
9799
  return {
9486
9800
  index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
9487
9801
  type: "image",
@@ -9503,8 +9817,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9503
9817
  file_search: tc.fileSearch || {}
9504
9818
  };
9505
9819
  } else if (tc.type === "function") {
9820
+ var _tc_index2, _ref, _ref1;
9506
9821
  var _tc_function, _tc_function1, _tc_function2;
9507
- var _tc_index2, _tc_function_output, _ref;
9508
9822
  return {
9509
9823
  index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
9510
9824
  id: tc.id,
@@ -9512,7 +9826,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9512
9826
  function: {
9513
9827
  name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
9514
9828
  arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
9515
- output: (_ref = (_tc_function_output = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) !== null && _tc_function_output !== void 0 ? _tc_function_output : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
9829
+ 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
9830
  }
9517
9831
  };
9518
9832
  }
@@ -9590,15 +9904,15 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9590
9904
  file_search: tc.fileSearch || {}
9591
9905
  };
9592
9906
  } else if (tc.type === "function") {
9907
+ var _ref, _ref1;
9593
9908
  var _tc_function, _tc_function1, _tc_function2;
9594
- var _tc_function_output, _ref;
9595
9909
  return {
9596
9910
  id: tc.id,
9597
9911
  type: "function",
9598
9912
  function: {
9599
9913
  name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
9600
9914
  arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
9601
- output: (_ref = (_tc_function_output = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) !== null && _tc_function_output !== void 0 ? _tc_function_output : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
9915
+ 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
9602
9916
  }
9603
9917
  };
9604
9918
  }
@@ -9707,7 +10021,7 @@ var post23 = function(param) {
9707
10021
  }));
9708
10022
  streamRun = function(onEvent2) {
9709
10023
  return _async_to_generator(function() {
9710
- var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error, _error_cause, _error_message, _error_cause_message;
10024
+ var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error, _ref, _ref1, _error_cause;
9711
10025
  return _ts_generator(this, function(_state) {
9712
10026
  switch(_state.label){
9713
10027
  case 0:
@@ -9832,7 +10146,7 @@ var post23 = function(param) {
9832
10146
  required_action: null,
9833
10147
  last_error: {
9834
10148
  code: "server_error",
9835
- 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 : "")
10149
+ 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 : "")
9836
10150
  },
9837
10151
  expires_at: null,
9838
10152
  started_at: dayjs27().unix(),
@@ -9973,7 +10287,7 @@ var post24 = function(param) {
9973
10287
  var runAdapter = param.runAdapter;
9974
10288
  return function(_urlString, options) {
9975
10289
  return _async_to_generator(function() {
9976
- var body, _body_top_p, _body_temperature, openaiAssistant;
10290
+ var _body_top_p, _body_temperature, body, openaiAssistant;
9977
10291
  return _ts_generator(this, function(_state) {
9978
10292
  if (typeof options.body !== "string") {
9979
10293
  throw new Error("Request body is required");
@@ -10037,10 +10351,9 @@ var toUnixSeconds = function(value) {
10037
10351
  return parsed.isValid() ? parsed.unix() : void 0;
10038
10352
  };
10039
10353
  var transformAzureFile = function(file2) {
10040
- var _toUnixSeconds;
10354
+ var _toUnixSeconds, _file2_bytes;
10041
10355
  var createdAtUnix = (_toUnixSeconds = toUnixSeconds(file2.createdAt)) !== null && _toUnixSeconds !== void 0 ? _toUnixSeconds : dayjs28().unix();
10042
10356
  var expiresAtUnix = toUnixSeconds(file2.expiresAt);
10043
- var _file2_bytes;
10044
10357
  var openaiFile = {
10045
10358
  id: file2.id,
10046
10359
  object: file2.object || "file",
@@ -10227,7 +10540,7 @@ var fileContent = function(param) {
10227
10540
  return {
10228
10541
  get: function(url) {
10229
10542
  return _async_to_generator(function() {
10230
- var pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body, _nodeResponse_status;
10543
+ var _nodeResponse_status, pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body;
10231
10544
  return _ts_generator(this, function(_state) {
10232
10545
  switch(_state.label){
10233
10546
  case 0:
@@ -12369,8 +12682,8 @@ import { uid as uid10 } from "radash";
12369
12682
  function transformAnnotations(annotations) {
12370
12683
  return annotations.map(function(ann) {
12371
12684
  if (ann.type === "file_citation") {
12372
- var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
12373
12685
  var _ann_startIndex, _ann_endIndex;
12686
+ var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
12374
12687
  return {
12375
12688
  type: "file_citation",
12376
12689
  text: ann.text,
@@ -12382,8 +12695,8 @@ function transformAnnotations(annotations) {
12382
12695
  }
12383
12696
  };
12384
12697
  } else if (ann.type === "file_path") {
12385
- var _ann_filePath, _ann_file_path;
12386
12698
  var _ann_startIndex1, _ann_endIndex1;
12699
+ var _ann_filePath, _ann_file_path;
12387
12700
  return {
12388
12701
  type: "file_path",
12389
12702
  text: ann.text,
@@ -12409,8 +12722,8 @@ function transformMessageContentItem(content) {
12409
12722
  };
12410
12723
  }
12411
12724
  if (content.type === "image_file") {
12412
- var imageFile = content.image_file || content.imageFile || {};
12413
12725
  var _imageFile_detail;
12726
+ var imageFile = content.image_file || content.imageFile || {};
12414
12727
  return {
12415
12728
  type: "image_file",
12416
12729
  image_file: {
@@ -12434,8 +12747,8 @@ function transformMessageDeltaContentItem(content) {
12434
12747
  };
12435
12748
  }
12436
12749
  if (content.type === "image_file") {
12437
- var imageFile = content.image_file || content.imageFile || {};
12438
12750
  var _imageFile_detail;
12751
+ var imageFile = content.image_file || content.imageFile || {};
12439
12752
  return {
12440
12753
  index: content.index || 0,
12441
12754
  type: "image_file",
@@ -12451,8 +12764,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12451
12764
  var event = azureEvent.event, data = azureEvent.data;
12452
12765
  var eventType = event;
12453
12766
  if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
12454
- var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
12455
12767
  var _data_temperature, _data_topP;
12768
+ var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
12456
12769
  return {
12457
12770
  event: eventType,
12458
12771
  data: {
@@ -12559,8 +12872,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12559
12872
  type: "tool_calls",
12560
12873
  tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
12561
12874
  if (tc.type === "code_interpreter") {
12562
- var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12563
12875
  var _tc_index;
12876
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12564
12877
  return {
12565
12878
  index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
12566
12879
  id: tc.id,
@@ -12577,8 +12890,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12577
12890
  };
12578
12891
  }
12579
12892
  if (output.type === "image") {
12580
- var _output_image;
12581
12893
  var _output_index1;
12894
+ var _output_image;
12582
12895
  return {
12583
12896
  index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
12584
12897
  type: "image",
@@ -12600,8 +12913,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12600
12913
  file_search: tc.fileSearch || {}
12601
12914
  };
12602
12915
  } else if (tc.type === "function") {
12603
- var _tc_function, _tc_function1, _tc_function2;
12604
12916
  var _tc_index2;
12917
+ var _tc_function, _tc_function1, _tc_function2;
12605
12918
  return {
12606
12919
  index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
12607
12920
  id: tc.id,
@@ -12929,5 +13242,5 @@ var azureAgentsRunAdapter = function(param) {
12929
13242
  handleRun: handleRun
12930
13243
  };
12931
13244
  };
12932
- export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, supercompat, togetherClientAdapter };
13245
+ export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, azureResponsesStorageAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, supercompat, togetherClientAdapter };
12933
13246
  //# sourceMappingURL=index.js.map