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.cjs CHANGED
@@ -174,12 +174,22 @@ function _object_spread_props(target, source) {
174
174
  }
175
175
  function _object_without_properties(source, excluded) {
176
176
  if (source == null) return {};
177
- var target = _object_without_properties_loose(source, excluded);
178
- var key, i;
177
+ var target = {}, sourceKeys, key, i;
178
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
179
+ sourceKeys = Reflect.ownKeys(source);
180
+ for(i = 0; i < sourceKeys.length; i++){
181
+ key = sourceKeys[i];
182
+ if (excluded.indexOf(key) >= 0) continue;
183
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
184
+ target[key] = source[key];
185
+ }
186
+ return target;
187
+ }
188
+ target = _object_without_properties_loose(source, excluded);
179
189
  if (Object.getOwnPropertySymbols) {
180
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
181
- for(i = 0; i < sourceSymbolKeys.length; i++){
182
- key = sourceSymbolKeys[i];
190
+ sourceKeys = Object.getOwnPropertySymbols(source);
191
+ for(i = 0; i < sourceKeys.length; i++){
192
+ key = sourceKeys[i];
183
193
  if (excluded.indexOf(key) >= 0) continue;
184
194
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
185
195
  target[key] = source[key];
@@ -189,12 +199,11 @@ function _object_without_properties(source, excluded) {
189
199
  }
190
200
  function _object_without_properties_loose(source, excluded) {
191
201
  if (source == null) return {};
192
- var target = {};
193
- var sourceKeys = Object.keys(source);
194
- var key, i;
202
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
195
203
  for(i = 0; i < sourceKeys.length; i++){
196
204
  key = sourceKeys[i];
197
205
  if (excluded.indexOf(key) >= 0) continue;
206
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
198
207
  target[key] = source[key];
199
208
  }
200
209
  return target;
@@ -226,9 +235,17 @@ function _ts_generator(thisArg, body) {
226
235
  },
227
236
  trys: [],
228
237
  ops: []
229
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
230
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
231
- return this;
238
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
239
+ return d(g, "next", {
240
+ value: verb(0)
241
+ }), d(g, "throw", {
242
+ value: verb(1)
243
+ }), d(g, "return", {
244
+ value: verb(2)
245
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
246
+ value: function() {
247
+ return this;
248
+ }
232
249
  }), g;
233
250
  function verb(n) {
234
251
  return function(v) {
@@ -398,6 +415,9 @@ __export(index_exports, {
398
415
  azureOpenaiClientAdapter: function() {
399
416
  return azureOpenaiClientAdapter;
400
417
  },
418
+ azureResponsesStorageAdapter: function() {
419
+ return azureResponsesStorageAdapter;
420
+ },
401
421
  completionsRunAdapter: function() {
402
422
  return completionsRunAdapter;
403
423
  },
@@ -456,7 +476,8 @@ var storageRequestHandlers = function(param) {
456
476
  client: wrappedClient
457
477
  })
458
478
  }),
459
- client: wrappedClient
479
+ client: wrappedClient,
480
+ originalClient: client
460
481
  });
461
482
  return result.requestHandlers;
462
483
  };
@@ -537,7 +558,7 @@ var supercompatFetch = function(param) {
537
558
  args[_key] = arguments[_key];
538
559
  }
539
560
  return _async_to_generator(function() {
540
- var _args, url, options, pathHandler, _options_method, method, requestHandler;
561
+ var _ref, _args, url, options, pathHandler, method, requestHandler;
541
562
  return _ts_generator(this, function(_state) {
542
563
  _args = _sliced_to_array(args, 2), url = _args[0], options = _args[1];
543
564
  pathHandler = findRequestHandler({
@@ -553,7 +574,7 @@ var supercompatFetch = function(param) {
553
574
  })
554
575
  ];
555
576
  }
556
- method = (_options_method = options === null || options === void 0 ? void 0 : options.method) !== null && _options_method !== void 0 ? _options_method : "";
577
+ method = (_ref = options === null || options === void 0 ? void 0 : options.method) !== null && _ref !== void 0 ? _ref : "";
557
578
  requestHandler = pathHandler[method.toLowerCase()];
558
579
  if (!requestHandler) {
559
580
  return [
@@ -1170,17 +1191,166 @@ var azureOpenaiClientAdapter = function(param) {
1170
1191
  }
1171
1192
  };
1172
1193
  };
1194
+ // src/adapters/client/azureAiProjectClientAdapter/models/get.ts
1195
+ var get3 = function(param) {
1196
+ var azureAiProject = param.azureAiProject;
1197
+ return function(_url, _options) {
1198
+ return _async_to_generator(function() {
1199
+ var models13, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, deployment, err, error;
1200
+ return _ts_generator(this, function(_state) {
1201
+ switch(_state.label){
1202
+ case 0:
1203
+ _state.trys.push([
1204
+ 0,
1205
+ 13,
1206
+ ,
1207
+ 14
1208
+ ]);
1209
+ models13 = [];
1210
+ _iteratorAbruptCompletion = false, _didIteratorError = false;
1211
+ _state.label = 1;
1212
+ case 1:
1213
+ _state.trys.push([
1214
+ 1,
1215
+ 6,
1216
+ 7,
1217
+ 12
1218
+ ]);
1219
+ _iterator = _async_iterator(azureAiProject.deployments.list());
1220
+ _state.label = 2;
1221
+ case 2:
1222
+ return [
1223
+ 4,
1224
+ _iterator.next()
1225
+ ];
1226
+ case 3:
1227
+ if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
1228
+ 3,
1229
+ 5
1230
+ ];
1231
+ _value = _step.value;
1232
+ deployment = _value;
1233
+ if (deployment.type === "ModelDeployment" && "modelName" in deployment && "modelPublisher" in deployment) {
1234
+ models13.push({
1235
+ id: deployment.modelName,
1236
+ object: "model",
1237
+ created: Date.now(),
1238
+ owned_by: deployment.modelPublisher
1239
+ });
1240
+ }
1241
+ _state.label = 4;
1242
+ case 4:
1243
+ _iteratorAbruptCompletion = false;
1244
+ return [
1245
+ 3,
1246
+ 2
1247
+ ];
1248
+ case 5:
1249
+ return [
1250
+ 3,
1251
+ 12
1252
+ ];
1253
+ case 6:
1254
+ err = _state.sent();
1255
+ _didIteratorError = true;
1256
+ _iteratorError = err;
1257
+ return [
1258
+ 3,
1259
+ 12
1260
+ ];
1261
+ case 7:
1262
+ _state.trys.push([
1263
+ 7,
1264
+ ,
1265
+ 10,
1266
+ 11
1267
+ ]);
1268
+ if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
1269
+ 3,
1270
+ 9
1271
+ ];
1272
+ return [
1273
+ 4,
1274
+ _iterator.return()
1275
+ ];
1276
+ case 8:
1277
+ _state.sent();
1278
+ _state.label = 9;
1279
+ case 9:
1280
+ return [
1281
+ 3,
1282
+ 11
1283
+ ];
1284
+ case 10:
1285
+ if (_didIteratorError) {
1286
+ throw _iteratorError;
1287
+ }
1288
+ return [
1289
+ 7
1290
+ ];
1291
+ case 11:
1292
+ return [
1293
+ 7
1294
+ ];
1295
+ case 12:
1296
+ return [
1297
+ 2,
1298
+ new Response(JSON.stringify({
1299
+ object: "list",
1300
+ data: models13
1301
+ }), {
1302
+ status: 200,
1303
+ headers: {
1304
+ "Content-Type": "application/json"
1305
+ }
1306
+ })
1307
+ ];
1308
+ case 13:
1309
+ error = _state.sent();
1310
+ return [
1311
+ 2,
1312
+ new Response(JSON.stringify({
1313
+ error: error
1314
+ }), {
1315
+ status: 500,
1316
+ headers: {
1317
+ "Content-Type": "application/json"
1318
+ }
1319
+ })
1320
+ ];
1321
+ case 14:
1322
+ return [
1323
+ 2
1324
+ ];
1325
+ }
1326
+ });
1327
+ })();
1328
+ };
1329
+ };
1330
+ // src/adapters/client/azureAiProjectClientAdapter/models/index.ts
1331
+ var models3 = function(param) {
1332
+ var azureAiProject = param.azureAiProject;
1333
+ return {
1334
+ get: get3({
1335
+ azureAiProject: azureAiProject
1336
+ })
1337
+ };
1338
+ };
1173
1339
  // src/adapters/client/azureAiProjectClientAdapter/index.ts
1174
1340
  var azureAiProjectClientAdapter = function(param) {
1175
1341
  var azureAiProject = param.azureAiProject;
1176
1342
  return {
1177
1343
  type: "AZURE_AI_PROJECT",
1178
1344
  client: azureAiProject,
1179
- requestHandlers: {}
1345
+ requestHandlers: {
1346
+ "^/v1/models$": models3({
1347
+ azureAiProject: azureAiProject
1348
+ })
1349
+ }
1180
1350
  };
1181
1351
  };
1182
1352
  // src/adapters/client/mistralClientAdapter/models/get.ts
1183
- var get3 = function(param) {
1353
+ var get4 = function(param) {
1184
1354
  var mistral = param.mistral;
1185
1355
  return function(_url, _options) {
1186
1356
  return _async_to_generator(function() {
@@ -1232,25 +1402,25 @@ var get3 = function(param) {
1232
1402
  };
1233
1403
  };
1234
1404
  // src/adapters/client/mistralClientAdapter/models/index.ts
1235
- var models3 = function(param) {
1405
+ var models4 = function(param) {
1236
1406
  var mistral = param.mistral;
1237
1407
  return {
1238
- get: get3({
1408
+ get: get4({
1239
1409
  mistral: mistral
1240
1410
  })
1241
1411
  };
1242
1412
  };
1243
1413
  // src/adapters/client/mistralClientAdapter/completions/serializeChunk.ts
1244
- var serializeDelta = function(_param) {
1245
- var toolCalls = _param.delta.toolCalls, rest = _object_without_properties(_param.delta, [
1414
+ var serializeDelta = function(_0) {
1415
+ var _ref = _0.delta, toolCalls = _ref.toolCalls, rest = _object_without_properties(_ref, [
1246
1416
  "toolCalls"
1247
1417
  ]);
1248
1418
  return _object_spread({}, rest, toolCalls ? {
1249
1419
  tool_calls: toolCalls
1250
1420
  } : {});
1251
1421
  };
1252
- var serializeChoice = function(_param) {
1253
- var _param_choice = _param.choice, finishReason = _param_choice.finishReason, delta = _param_choice.delta, rest = _object_without_properties(_param.choice, [
1422
+ var serializeChoice = function(_0) {
1423
+ var _ref = _0.choice, finishReason = _ref.finishReason, delta = _ref.delta, rest = _object_without_properties(_ref, [
1254
1424
  "finishReason",
1255
1425
  "delta"
1256
1426
  ]);
@@ -1272,10 +1442,10 @@ var serializeChunk = function(param) {
1272
1442
  } : {});
1273
1443
  };
1274
1444
  // src/adapters/client/mistralClientAdapter/completions/serializeBody.ts
1275
- var serializeMessage = function(_param) {
1276
- var _param_message = _param.message, // @ts-ignore-next-line
1277
- tool_calls = _param_message.tool_calls, // @ts-ignore-next-line
1278
- tool_call_id = _param_message.tool_call_id, rest = _object_without_properties(_param.message, [
1445
+ var serializeMessage = function(_0) {
1446
+ var _ref = _0.message, // @ts-ignore-next-line
1447
+ tool_calls = _ref.tool_calls, // @ts-ignore-next-line
1448
+ tool_call_id = _ref.tool_call_id, rest = _object_without_properties(_ref, [
1279
1449
  "tool_calls",
1280
1450
  "tool_call_id"
1281
1451
  ]);
@@ -1485,7 +1655,7 @@ var mistralClientAdapter = function(param) {
1485
1655
  return {
1486
1656
  client: mistral,
1487
1657
  requestHandlers: {
1488
- "^/v1/models$": models3({
1658
+ "^/v1/models$": models4({
1489
1659
  mistral: mistral
1490
1660
  }),
1491
1661
  "^/v1/chat/completions$": completions3({
@@ -1495,7 +1665,7 @@ var mistralClientAdapter = function(param) {
1495
1665
  };
1496
1666
  };
1497
1667
  // src/adapters/client/perplexityClientAdapter/models/get.ts
1498
- var models4 = [
1668
+ var models5 = [
1499
1669
  "sonar-reasoning-pro",
1500
1670
  "sonar-reasoning",
1501
1671
  "sonar-pro",
@@ -1505,7 +1675,7 @@ var models4 = [
1505
1675
  "llama-3.1-sonar-large-128k-online",
1506
1676
  "llama-3.1-sonar-huge-128k-online"
1507
1677
  ];
1508
- var get4 = function(param) {
1678
+ var get5 = function(param) {
1509
1679
  var perplexity = param.perplexity;
1510
1680
  return function(_url, _options) {
1511
1681
  return _async_to_generator(function() {
@@ -1515,7 +1685,7 @@ var get4 = function(param) {
1515
1685
  2,
1516
1686
  new Response(JSON.stringify({
1517
1687
  type: "list",
1518
- data: models4.map(function(model) {
1688
+ data: models5.map(function(model) {
1519
1689
  return {
1520
1690
  id: model,
1521
1691
  object: "model"
@@ -1549,10 +1719,10 @@ var get4 = function(param) {
1549
1719
  };
1550
1720
  };
1551
1721
  // src/adapters/client/perplexityClientAdapter/models/index.ts
1552
- var models5 = function(param) {
1722
+ var models6 = function(param) {
1553
1723
  var perplexity = param.perplexity;
1554
1724
  return {
1555
- get: get4({
1725
+ get: get5({
1556
1726
  perplexity: perplexity
1557
1727
  })
1558
1728
  };
@@ -1772,7 +1942,7 @@ var perplexityClientAdapter = function(param) {
1772
1942
  return {
1773
1943
  client: perplexity,
1774
1944
  requestHandlers: {
1775
- "^/v1/models$": models5({
1945
+ "^/v1/models$": models6({
1776
1946
  perplexity: perplexity
1777
1947
  }),
1778
1948
  "^/v1/chat/completions$": completions4({
@@ -1782,7 +1952,7 @@ var perplexityClientAdapter = function(param) {
1782
1952
  };
1783
1953
  };
1784
1954
  // src/adapters/client/anthropicClientAdapter/models/get.ts
1785
- var get5 = function(param) {
1955
+ var get6 = function(param) {
1786
1956
  var anthropic = param.anthropic;
1787
1957
  return function(_url, _options) {
1788
1958
  return _async_to_generator(function() {
@@ -1842,10 +2012,10 @@ var get5 = function(param) {
1842
2012
  };
1843
2013
  };
1844
2014
  // src/adapters/client/anthropicClientAdapter/models/index.ts
1845
- var models6 = function(param) {
2015
+ var models7 = function(param) {
1846
2016
  var anthropic = param.anthropic;
1847
2017
  return {
1848
- get: get5({
2018
+ get: get6({
1849
2019
  anthropic: anthropic
1850
2020
  })
1851
2021
  };
@@ -1920,7 +2090,7 @@ var serializeMessage2 = function(param) {
1920
2090
  if (!trimmed) return {};
1921
2091
  try {
1922
2092
  return JSON.parse(trimmed);
1923
- } catch (e) {
2093
+ } catch (unused) {
1924
2094
  return {};
1925
2095
  }
1926
2096
  };
@@ -2184,17 +2354,15 @@ var parseKeys = function(input) {
2184
2354
  };
2185
2355
  var normalizeKeys = function(keys) {
2186
2356
  return keys.map(function(key) {
2187
- var lowerKey = key.toLowerCase();
2188
2357
  var _keyAliasMap_lowerKey;
2358
+ var lowerKey = key.toLowerCase();
2189
2359
  return (_keyAliasMap_lowerKey = keyAliasMap[lowerKey]) !== null && _keyAliasMap_lowerKey !== void 0 ? _keyAliasMap_lowerKey : lowerKey;
2190
2360
  });
2191
2361
  };
2192
2362
  var normalizeScroll = function(details) {
2193
- var _sanitizeNumber;
2363
+ var _sanitizeNumber, _sanitizeNumber1, _ref, _sanitizeNumber2;
2194
2364
  var scrollX = (_sanitizeNumber = sanitizeNumber(details.scroll_x)) !== null && _sanitizeNumber !== void 0 ? _sanitizeNumber : 0;
2195
- var _sanitizeNumber1;
2196
2365
  var scrollY = (_sanitizeNumber1 = sanitizeNumber(details.scroll_y)) !== null && _sanitizeNumber1 !== void 0 ? _sanitizeNumber1 : 0;
2197
- var _sanitizeNumber2, _ref;
2198
2366
  var amount = (_ref = (_sanitizeNumber2 = sanitizeNumber(details.scroll_amount)) !== null && _sanitizeNumber2 !== void 0 ? _sanitizeNumber2 : sanitizeNumber(details.amount)) !== null && _ref !== void 0 ? _ref : 0;
2199
2367
  var direction = typeof details.scroll_direction === "string" ? details.scroll_direction.toLowerCase() : typeof details.direction === "string" ? details.direction.toLowerCase() : void 0;
2200
2368
  if (!scrollX && !scrollY && direction && amount) {
@@ -2231,46 +2399,46 @@ var normalizeActionString = function(action, details) {
2231
2399
  case "right_click":
2232
2400
  case "middle_click":
2233
2401
  {
2234
- var _coords_x, _coords_y;
2402
+ var _ref, _ref1;
2235
2403
  return {
2236
2404
  type: "click",
2237
2405
  button: clickButtonMap[action],
2238
- x: (_coords_x = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x !== void 0 ? _coords_x : 0,
2239
- y: (_coords_y = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y !== void 0 ? _coords_y : 0
2406
+ x: (_ref = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref !== void 0 ? _ref : 0,
2407
+ y: (_ref1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref1 !== void 0 ? _ref1 : 0
2240
2408
  };
2241
2409
  }
2242
2410
  case "double_click":
2243
- var _coords_x1, _coords_y1;
2411
+ var _ref2, _ref3;
2244
2412
  return {
2245
2413
  type: "double_click",
2246
- x: (_coords_x1 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x1 !== void 0 ? _coords_x1 : 0,
2247
- y: (_coords_y1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y1 !== void 0 ? _coords_y1 : 0
2414
+ x: (_ref2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref2 !== void 0 ? _ref2 : 0,
2415
+ y: (_ref3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref3 !== void 0 ? _ref3 : 0
2248
2416
  };
2249
2417
  case "triple_click":
2250
- var _coords_x2, _coords_y2;
2418
+ var _ref4, _ref5;
2251
2419
  return {
2252
2420
  type: "double_click",
2253
- x: (_coords_x2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x2 !== void 0 ? _coords_x2 : 0,
2254
- y: (_coords_y2 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y2 !== void 0 ? _coords_y2 : 0,
2421
+ x: (_ref4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref4 !== void 0 ? _ref4 : 0,
2422
+ y: (_ref5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref5 !== void 0 ? _ref5 : 0,
2255
2423
  repetitions: 3
2256
2424
  };
2257
2425
  case "left_mouse_down":
2258
- var _coords_x3, _coords_y3;
2426
+ var _ref6, _ref7;
2259
2427
  return {
2260
2428
  type: "click",
2261
2429
  button: clickButtonMap[action],
2262
2430
  state: "down",
2263
- x: (_coords_x3 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x3 !== void 0 ? _coords_x3 : 0,
2264
- y: (_coords_y3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y3 !== void 0 ? _coords_y3 : 0
2431
+ x: (_ref6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref6 !== void 0 ? _ref6 : 0,
2432
+ y: (_ref7 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref7 !== void 0 ? _ref7 : 0
2265
2433
  };
2266
2434
  case "left_mouse_up":
2267
- var _coords_x4, _coords_y4;
2435
+ var _ref8, _ref9;
2268
2436
  return {
2269
2437
  type: "click",
2270
2438
  button: clickButtonMap[action],
2271
2439
  state: "up",
2272
- x: (_coords_x4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x4 !== void 0 ? _coords_x4 : 0,
2273
- y: (_coords_y4 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y4 !== void 0 ? _coords_y4 : 0
2440
+ x: (_ref8 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref8 !== void 0 ? _ref8 : 0,
2441
+ y: (_ref9 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref9 !== void 0 ? _ref9 : 0
2274
2442
  };
2275
2443
  case "left_click_drag":
2276
2444
  {
@@ -2288,20 +2456,20 @@ var normalizeActionString = function(action, details) {
2288
2456
  }
2289
2457
  case "mouse_move":
2290
2458
  case "cursor_position":
2291
- var _coords_x5, _coords_y5;
2459
+ var _ref10, _ref11;
2292
2460
  return {
2293
2461
  type: "move",
2294
- x: (_coords_x5 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x5 !== void 0 ? _coords_x5 : 0,
2295
- y: (_coords_y5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y5 !== void 0 ? _coords_y5 : 0
2462
+ x: (_ref10 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref10 !== void 0 ? _ref10 : 0,
2463
+ y: (_ref11 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref11 !== void 0 ? _ref11 : 0
2296
2464
  };
2297
2465
  case "scroll":
2298
2466
  {
2467
+ var _ref12, _ref13;
2299
2468
  var _normalizeScroll = normalizeScroll(details), scroll_x = _normalizeScroll.scroll_x, scroll_y = _normalizeScroll.scroll_y;
2300
- var _coords_x6, _coords_y6;
2301
2469
  return _object_spread({
2302
2470
  type: "scroll",
2303
- x: (_coords_x6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x6 !== void 0 ? _coords_x6 : 0,
2304
- y: (_coords_y6 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y6 !== void 0 ? _coords_y6 : 0,
2471
+ x: (_ref12 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _ref12 !== void 0 ? _ref12 : 0,
2472
+ y: (_ref13 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _ref13 !== void 0 ? _ref13 : 0,
2305
2473
  scroll_x: scroll_x,
2306
2474
  scroll_y: scroll_y
2307
2475
  }, typeof details.scroll_direction === "string" ? {
@@ -2325,8 +2493,8 @@ var normalizeActionString = function(action, details) {
2325
2493
  case "key":
2326
2494
  case "hold_key":
2327
2495
  {
2328
- var _details_text, _ref;
2329
- 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));
2496
+ var _ref14, _details_text;
2497
+ var keys = normalizeKeys(parseKeys((_ref14 = (_details_text = details.text) !== null && _details_text !== void 0 ? _details_text : details.keys) !== null && _ref14 !== void 0 ? _ref14 : details.key));
2330
2498
  var normalized = {
2331
2499
  type: "keypress",
2332
2500
  keys: keys
@@ -2434,7 +2602,7 @@ var normalizeComputerToolCallPayload = function(payload) {
2434
2602
  var parseJson = function(value) {
2435
2603
  try {
2436
2604
  return JSON.parse(value);
2437
- } catch (e) {
2605
+ } catch (unused) {
2438
2606
  return void 0;
2439
2607
  }
2440
2608
  };
@@ -2492,7 +2660,7 @@ var post5 = function(param) {
2492
2660
  stream = new ReadableStream({
2493
2661
  start: function start(controller) {
2494
2662
  return _async_to_generator(function() {
2495
- var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex, parseJson2, getOrCreateIndexForToolUseId, assignBlockToToolUse, markComputerToolUse, getToolUseIdFromBlock, emitNormalizedToolCall, getOrCreateIndexForBlock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, _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;
2663
+ var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex, parseJson2, getOrCreateIndexForToolUseId, assignBlockToToolUse, markComputerToolUse, getToolUseIdFromBlock, emitNormalizedToolCall, getOrCreateIndexForBlock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, toolUseId, _toolUseIdArgumentBuffer_get, buffered, parsed, normalized, toolCallIndex, chunkIndex, _toolUseIdArgumentBuffer_get1, buffered1, toolCallIndex1, chunkIndex1, messageDelta, delta, toolUseId1, _toolUseIdArgumentBuffer_get2, _chunk_delta_partial_json, existing, updated, parsed1, normalized1, toolCallIndex2, chunkIndex2, _toolUseIdArgumentBuffer_get3, _chunk_delta_partial_json1, existing1, index, messageDelta1, delta1, toolName, normalizedToolName, index1, index2, _chunk_content_block_content, _getToolUseIdFromBlock, outputPayload, toolCallId, index3, _getToolUseIdFromBlock1, _chunk_content_block_content1, toolCallId1, _chunk_content_block, _toolUseId, _type, _id, rest, index4, outputPayload1, messageDelta2, messageDelta3, err;
2496
2664
  return _ts_generator(this, function(_state) {
2497
2665
  switch(_state.label){
2498
2666
  case 0:
@@ -2505,18 +2673,18 @@ var post5 = function(param) {
2505
2673
  parseJson2 = function(value) {
2506
2674
  try {
2507
2675
  return JSON.parse(value);
2508
- } catch (e) {
2676
+ } catch (unused) {
2509
2677
  return void 0;
2510
2678
  }
2511
2679
  };
2512
2680
  getOrCreateIndexForToolUseId = function(toolUseId) {
2681
+ var _toolUseIdToIndex_get;
2513
2682
  if (!toolUseId) {
2514
2683
  return 0;
2515
2684
  }
2516
2685
  if (!toolUseIdToIndex.has(toolUseId)) {
2517
2686
  toolUseIdToIndex.set(toolUseId, nextToolCallIndex++);
2518
2687
  }
2519
- var _toolUseIdToIndex_get;
2520
2688
  return (_toolUseIdToIndex_get = toolUseIdToIndex.get(toolUseId)) !== null && _toolUseIdToIndex_get !== void 0 ? _toolUseIdToIndex_get : 0;
2521
2689
  };
2522
2690
  assignBlockToToolUse = function(param) {
@@ -2593,8 +2761,7 @@ var post5 = function(param) {
2593
2761
  5
2594
2762
  ];
2595
2763
  _value = _step.value;
2596
- _ref = _value;
2597
- chunk = _ref;
2764
+ chunk = _value;
2598
2765
  if (chunk.type === "content_block_stop") {
2599
2766
  toolUseId = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
2600
2767
  if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
@@ -2662,7 +2829,6 @@ var post5 = function(param) {
2662
2829
  if (toolUseId1 && computerToolUseIds.has(toolUseId1)) {
2663
2830
  ;
2664
2831
  existing = (_toolUseIdArgumentBuffer_get2 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get2 !== void 0 ? _toolUseIdArgumentBuffer_get2 : "";
2665
- ;
2666
2832
  updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
2667
2833
  toolUseIdArgumentBuffer.set(toolUseId1, updated);
2668
2834
  if (!normalizedComputerCalls.has(toolUseId1)) {
@@ -2687,7 +2853,6 @@ var post5 = function(param) {
2687
2853
  if (toolUseId1) {
2688
2854
  ;
2689
2855
  existing1 = (_toolUseIdArgumentBuffer_get3 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get3 !== void 0 ? _toolUseIdArgumentBuffer_get3 : "";
2690
- ;
2691
2856
  toolUseIdArgumentBuffer.set(toolUseId1, "".concat(existing1).concat((_chunk_delta_partial_json1 = chunk.delta.partial_json) !== null && _chunk_delta_partial_json1 !== void 0 ? _chunk_delta_partial_json1 : ""));
2692
2857
  }
2693
2858
  index = getOrCreateIndexForBlock(chunk.index);
@@ -2778,7 +2943,6 @@ var post5 = function(param) {
2778
2943
  outputPayload = {
2779
2944
  content: (_chunk_content_block_content = chunk.content_block.content) !== null && _chunk_content_block_content !== void 0 ? _chunk_content_block_content : []
2780
2945
  };
2781
- ;
2782
2946
  toolCallId = (_getToolUseIdFromBlock = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock !== void 0 ? _getToolUseIdFromBlock : "";
2783
2947
  index3 = getOrCreateIndexForToolUseId(toolCallId);
2784
2948
  assignBlockToToolUse({
@@ -2815,7 +2979,6 @@ var post5 = function(param) {
2815
2979
  blockIndex: chunk.index,
2816
2980
  toolUseId: toolCallId1
2817
2981
  });
2818
- ;
2819
2982
  outputPayload1 = Object.keys(rest).length > 0 ? rest : {
2820
2983
  content: (_chunk_content_block_content1 = chunk.content_block.content) !== null && _chunk_content_block_content1 !== void 0 ? _chunk_content_block_content1 : {}
2821
2984
  };
@@ -3012,7 +3175,7 @@ var anthropicClientAdapter = function(param) {
3012
3175
  return {
3013
3176
  client: anthropic,
3014
3177
  requestHandlers: {
3015
- "^/v1/models$": models6({
3178
+ "^/v1/models$": models7({
3016
3179
  anthropic: anthropic
3017
3180
  }),
3018
3181
  "^/v1/chat/completions$": completions5({
@@ -3022,7 +3185,7 @@ var anthropicClientAdapter = function(param) {
3022
3185
  };
3023
3186
  };
3024
3187
  // src/adapters/client/togetherClientAdapter/models/get.ts
3025
- var get6 = function(param) {
3188
+ var get7 = function(param) {
3026
3189
  var together = param.together;
3027
3190
  return function(_url, _options) {
3028
3191
  return _async_to_generator(function() {
@@ -3078,10 +3241,10 @@ var get6 = function(param) {
3078
3241
  };
3079
3242
  };
3080
3243
  // src/adapters/client/togetherClientAdapter/models/index.ts
3081
- var models7 = function(param) {
3244
+ var models8 = function(param) {
3082
3245
  var together = param.together;
3083
3246
  return {
3084
- get: get6({
3247
+ get: get7({
3085
3248
  together: together
3086
3249
  })
3087
3250
  };
@@ -3270,7 +3433,7 @@ var togetherClientAdapter = function(param) {
3270
3433
  return {
3271
3434
  client: together,
3272
3435
  requestHandlers: {
3273
- "^/v1/models$": models7({
3436
+ "^/v1/models$": models8({
3274
3437
  together: together
3275
3438
  }),
3276
3439
  "^/(?:v1|/?openai)/chat/completions$": completions6({
@@ -3280,54 +3443,61 @@ var togetherClientAdapter = function(param) {
3280
3443
  };
3281
3444
  };
3282
3445
  // src/adapters/client/googleClientAdapter/models/get.ts
3283
- var models8 = [
3284
- "gemini-2.5-flash-preview-04-17",
3285
- "gemini-2.5-pro-preview-03-25",
3286
- "gemini-2.0-flash",
3287
- "gemini-2.0-flash-lite",
3288
- "gemini-1.5-flash",
3289
- "gemini-1.5-flash-8b",
3290
- "gemini-1.5-pro"
3291
- ];
3292
- var get7 = function(param) {
3446
+ var get8 = function(param) {
3293
3447
  var google = param.google;
3294
3448
  return function(_url, _options) {
3295
3449
  return _async_to_generator(function() {
3450
+ var response, error;
3296
3451
  return _ts_generator(this, function(_state) {
3297
- try {
3298
- return [
3299
- 2,
3300
- new Response(JSON.stringify({
3301
- type: "list",
3302
- data: models8.map(function(model) {
3303
- return {
3304
- id: model,
3305
- object: "model"
3306
- };
3452
+ switch(_state.label){
3453
+ case 0:
3454
+ _state.trys.push([
3455
+ 0,
3456
+ 2,
3457
+ ,
3458
+ 3
3459
+ ]);
3460
+ return [
3461
+ 4,
3462
+ google.models.list()
3463
+ ];
3464
+ case 1:
3465
+ response = _state.sent();
3466
+ return [
3467
+ 2,
3468
+ new Response(JSON.stringify({
3469
+ type: "list",
3470
+ data: response.data.map(function(model) {
3471
+ return {
3472
+ id: model.id,
3473
+ object: "model"
3474
+ };
3475
+ })
3476
+ }), {
3477
+ status: 200,
3478
+ headers: {
3479
+ "Content-Type": "application/json"
3480
+ }
3307
3481
  })
3308
- }), {
3309
- status: 200,
3310
- headers: {
3311
- "Content-Type": "application/json"
3312
- }
3313
- })
3314
- ];
3315
- } catch (error) {
3316
- return [
3317
- 2,
3318
- new Response(JSON.stringify({
3319
- error: error
3320
- }), {
3321
- status: 500,
3322
- headers: {
3323
- "Content-Type": "application/json"
3324
- }
3325
- })
3326
- ];
3482
+ ];
3483
+ case 2:
3484
+ error = _state.sent();
3485
+ return [
3486
+ 2,
3487
+ new Response(JSON.stringify({
3488
+ error: error
3489
+ }), {
3490
+ status: 500,
3491
+ headers: {
3492
+ "Content-Type": "application/json"
3493
+ }
3494
+ })
3495
+ ];
3496
+ case 3:
3497
+ return [
3498
+ 2
3499
+ ];
3327
3500
  }
3328
- return [
3329
- 2
3330
- ];
3331
3501
  });
3332
3502
  })();
3333
3503
  };
@@ -3336,7 +3506,7 @@ var get7 = function(param) {
3336
3506
  var models9 = function(param) {
3337
3507
  var google = param.google;
3338
3508
  return {
3339
- get: get7({
3509
+ get: get8({
3340
3510
  google: google
3341
3511
  })
3342
3512
  };
@@ -3571,7 +3741,7 @@ var googleClientAdapter = function(param) {
3571
3741
  var models10 = [
3572
3742
  "Humiris/humiris-moai"
3573
3743
  ];
3574
- var get8 = function(param) {
3744
+ var get9 = function(param) {
3575
3745
  var humiris = param.humiris;
3576
3746
  return function(_url, _options) {
3577
3747
  return _async_to_generator(function() {
@@ -3618,7 +3788,7 @@ var get8 = function(param) {
3618
3788
  var models11 = function(param) {
3619
3789
  var humiris = param.humiris;
3620
3790
  return {
3621
- get: get8({
3791
+ get: get9({
3622
3792
  humiris: humiris
3623
3793
  })
3624
3794
  };
@@ -3755,7 +3925,7 @@ var humirisClientAdapter = function(param) {
3755
3925
  };
3756
3926
  };
3757
3927
  // src/adapters/client/ollamaClientAdapter/models/get.ts
3758
- var get9 = function(param) {
3928
+ var get10 = function(param) {
3759
3929
  var ollama = param.ollama;
3760
3930
  return function(_url, _options) {
3761
3931
  return _async_to_generator(function() {
@@ -3810,7 +3980,7 @@ var get9 = function(param) {
3810
3980
  var models12 = function(param) {
3811
3981
  var ollama = param.ollama;
3812
3982
  return {
3813
- get: get9({
3983
+ get: get10({
3814
3984
  ollama: ollama
3815
3985
  })
3816
3986
  };
@@ -4022,6 +4192,7 @@ var validToolCallContentTypes = [
4022
4192
  ];
4023
4193
  var serializeToolContent = function(param) {
4024
4194
  var toolCall = param.toolCall;
4195
+ var _toolCall_function_output;
4025
4196
  if ((0, import_radash5.isArray)(toolCall.function.output)) {
4026
4197
  var isEveryToolPartValid = toolCall.function.output.every(function(toolPart) {
4027
4198
  if (!(0, import_radash5.isObject)(toolPart)) return false;
@@ -4032,7 +4203,6 @@ var serializeToolContent = function(param) {
4032
4203
  }
4033
4204
  return JSON.stringify(toolCall.function.output);
4034
4205
  }
4035
- var _toolCall_function_output;
4036
4206
  return (_toolCall_function_output = toolCall.function.output) !== null && _toolCall_function_output !== void 0 ? _toolCall_function_output : "";
4037
4207
  };
4038
4208
  var serializeToolCall = function(param) {
@@ -4210,7 +4380,7 @@ var completionsRunAdapter = function() {
4210
4380
  handleRun: function(param) {
4211
4381
  var client = param.client, run4 = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages;
4212
4382
  return _async_to_generator(function() {
4213
- 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;
4383
+ var _message_toolCalls, opts, _tmp, providerResponse, e, _ref, _ref1, _e_cause, message, toolCallsRunStep, currentContent, currentToolCalls, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices, choices, choice, delta, _delta_content, err, messageToolCalls, functionToolCalls, pendingFunctionToolCalls, requiredToolCalls;
4214
4384
  return _ts_generator(this, function(_state) {
4215
4385
  switch(_state.label){
4216
4386
  case 0:
@@ -4268,7 +4438,7 @@ var completionsRunAdapter = function() {
4268
4438
  status: "in_progress",
4269
4439
  last_error: {
4270
4440
  code: "server_error",
4271
- 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 : "")
4441
+ message: "".concat((_ref = e === null || e === void 0 ? void 0 : e.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = e === null || e === void 0 ? void 0 : (_e_cause = e.cause) === null || _e_cause === void 0 ? void 0 : _e_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
4272
4442
  }
4273
4443
  })
4274
4444
  })
@@ -4573,19 +4743,19 @@ var completionsRunAdapter = function() {
4573
4743
  ];
4574
4744
  case 25:
4575
4745
  requiredToolCalls = pendingFunctionToolCalls.map(function(toolCall) {
4746
+ var _ref, _ref1;
4576
4747
  var _toolCall_function, _toolCall_function1, _toolCall_function2;
4577
- var _toolCall_function_arguments;
4578
- var args = (_toolCall_function_arguments = (_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.arguments) !== null && _toolCall_function_arguments !== void 0 ? _toolCall_function_arguments : "";
4748
+ var args = (_ref = (_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.arguments) !== null && _ref !== void 0 ? _ref : "";
4579
4749
  if (((_toolCall_function1 = toolCall.function) === null || _toolCall_function1 === void 0 ? void 0 : _toolCall_function1.name) === "computer_call") {
4750
+ var _ref2, _ref3;
4580
4751
  var parsedArguments = {};
4581
4752
  try {
4582
4753
  parsedArguments = JSON.parse(args || "{}");
4583
- } catch (e) {
4754
+ } catch (unused) {
4584
4755
  parsedArguments = {};
4585
4756
  }
4586
- var _parsedArguments_action, _ref;
4587
4757
  var computerCall = {
4588
- 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 : {},
4758
+ action: (_ref2 = (_ref3 = parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.action) !== null && _ref3 !== void 0 ? _ref3 : parsedArguments) !== null && _ref2 !== void 0 ? _ref2 : {},
4589
4759
  pending_safety_checks: Array.isArray(parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.pending_safety_checks) ? parsedArguments.pending_safety_checks : []
4590
4760
  };
4591
4761
  return {
@@ -4594,12 +4764,11 @@ var completionsRunAdapter = function() {
4594
4764
  computer_call: computerCall
4595
4765
  };
4596
4766
  }
4597
- var _toolCall_function_name;
4598
4767
  return {
4599
4768
  id: toolCall.id,
4600
4769
  type: "function",
4601
4770
  function: {
4602
- 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 : "",
4771
+ name: (_ref1 = (_toolCall_function2 = toolCall.function) === null || _toolCall_function2 === void 0 ? void 0 : _toolCall_function2.name) !== null && _ref1 !== void 0 ? _ref1 : "",
4603
4772
  arguments: args
4604
4773
  }
4605
4774
  };
@@ -4835,20 +5004,20 @@ var post11 = function(param) {
4835
5004
  };
4836
5005
  // src/adapters/storage/prismaStorageAdapter/threads/messages/get.ts
4837
5006
  var import_radash10 = require("radash");
4838
- var get10 = function(param) {
5007
+ var get11 = function(param) {
4839
5008
  var prisma = param.prisma;
4840
5009
  return function(urlString) {
4841
5010
  return _async_to_generator(function() {
4842
- var _this, url, _url_pathname_match, threadId, _ref, limit, order, after, pageSize, messagesPlusOne, messages5, _id;
5011
+ var _ref, _this, url, _url_pathname_match, threadId, _ref1, limit, order, after, pageSize, messagesPlusOne, messages5;
4843
5012
  return _ts_generator(this, function(_state) {
4844
5013
  switch(_state.label){
4845
5014
  case 0:
4846
5015
  url = new URL(urlString);
4847
5016
  _url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(messagesRegexp)), 2), threadId = _url_pathname_match[1];
4848
- _ref = (0, import_radash10.assign)({
5017
+ _ref1 = (0, import_radash10.assign)({
4849
5018
  limit: "20",
4850
5019
  order: "desc"
4851
- }, Object.fromEntries(url.searchParams)), limit = _ref.limit, order = _ref.order, after = _ref.after;
5020
+ }, Object.fromEntries(url.searchParams)), limit = _ref1.limit, order = _ref1.order, after = _ref1.after;
4852
5021
  pageSize = parseInt(limit);
4853
5022
  return [
4854
5023
  4,
@@ -4879,7 +5048,7 @@ var get10 = function(param) {
4879
5048
  });
4880
5049
  }),
4881
5050
  has_more: messagesPlusOne.length > pageSize,
4882
- last_id: (_id = (_this = (0, import_radash10.last)(messages5)) === null || _this === void 0 ? void 0 : _this.id) !== null && _id !== void 0 ? _id : null
5051
+ last_id: (_ref = (_this = (0, import_radash10.last)(messages5)) === null || _this === void 0 ? void 0 : _this.id) !== null && _ref !== void 0 ? _ref : null
4883
5052
  }), {
4884
5053
  status: 200,
4885
5054
  headers: {
@@ -4899,7 +5068,7 @@ var messages2 = function(param) {
4899
5068
  post: post11({
4900
5069
  prisma: prisma
4901
5070
  }),
4902
- get: get10({
5071
+ get: get11({
4903
5072
  prisma: prisma
4904
5073
  })
4905
5074
  };
@@ -4970,20 +5139,20 @@ var mapPrismaRun = function(run4) {
4970
5139
  };
4971
5140
  };
4972
5141
  // src/adapters/storage/prismaStorageAdapter/threads/runs/get.ts
4973
- var get11 = function(param) {
5142
+ var get12 = function(param) {
4974
5143
  var prisma = param.prisma;
4975
5144
  return function(urlString) {
4976
5145
  return _async_to_generator(function() {
4977
- var _runs4_at, url, _url_pathname_match, threadId, _ref, limit, order, after, pageSize, runsPlusOne, runs4, _runs4_at_id;
5146
+ var _ref, _runs4_at, url, _url_pathname_match, threadId, _ref1, limit, order, after, pageSize, runsPlusOne, runs4;
4978
5147
  return _ts_generator(this, function(_state) {
4979
5148
  switch(_state.label){
4980
5149
  case 0:
4981
5150
  url = new URL(urlString);
4982
5151
  _url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(runsRegexp)), 2), threadId = _url_pathname_match[1];
4983
- _ref = (0, import_radash11.assign)({
5152
+ _ref1 = (0, import_radash11.assign)({
4984
5153
  limit: "20",
4985
5154
  order: "desc"
4986
- }, Object.fromEntries(url.searchParams)), limit = _ref.limit, order = _ref.order, after = _ref.after;
5155
+ }, Object.fromEntries(url.searchParams)), limit = _ref1.limit, order = _ref1.order, after = _ref1.after;
4987
5156
  pageSize = parseInt(limit, 10);
4988
5157
  return [
4989
5158
  4,
@@ -5014,7 +5183,7 @@ var get11 = function(param) {
5014
5183
  });
5015
5184
  }),
5016
5185
  has_more: runsPlusOne.length > pageSize,
5017
- 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
5186
+ last_id: (_ref = (_runs4_at = runs4.at(-1)) === null || _runs4_at === void 0 ? void 0 : _runs4_at.id) !== null && _ref !== void 0 ? _ref : null
5018
5187
  }), {
5019
5188
  status: 200,
5020
5189
  headers: {
@@ -5490,7 +5659,7 @@ var post12 = function(param) {
5490
5659
  readableStream = new ReadableStream({
5491
5660
  start: function start(controller) {
5492
5661
  return _async_to_generator(function() {
5493
- var error, _error_cause, _error_message, _error_cause_message;
5662
+ var error, _ref, _ref1, _error_cause;
5494
5663
  return _ts_generator(this, function(_state) {
5495
5664
  switch(_state.label){
5496
5665
  case 0:
@@ -5541,7 +5710,7 @@ var post12 = function(param) {
5541
5710
  failed_at: (0, import_dayjs7.default)().unix(),
5542
5711
  last_error: {
5543
5712
  code: "server_error",
5544
- 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 : "")
5713
+ message: "".concat((_ref = error === null || error === void 0 ? void 0 : error.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
5545
5714
  }
5546
5715
  }
5547
5716
  });
@@ -5591,7 +5760,7 @@ var post12 = function(param) {
5591
5760
  var runs = function(param) {
5592
5761
  var prisma = param.prisma, runAdapter = param.runAdapter;
5593
5762
  return {
5594
- get: get11({
5763
+ get: get12({
5595
5764
  prisma: prisma
5596
5765
  }),
5597
5766
  post: post12({
@@ -5601,7 +5770,7 @@ var runs = function(param) {
5601
5770
  };
5602
5771
  };
5603
5772
  // src/adapters/storage/prismaStorageAdapter/threads/run/get.ts
5604
- var get12 = function(param) {
5773
+ var get13 = function(param) {
5605
5774
  var prisma = param.prisma;
5606
5775
  return function(urlString) {
5607
5776
  return _async_to_generator(function() {
@@ -5656,27 +5825,27 @@ var get12 = function(param) {
5656
5825
  var run = function(param) {
5657
5826
  var prisma = param.prisma, runAdapter = param.runAdapter;
5658
5827
  return {
5659
- get: get12({
5828
+ get: get13({
5660
5829
  prisma: prisma
5661
5830
  })
5662
5831
  };
5663
5832
  };
5664
5833
  // src/adapters/storage/prismaStorageAdapter/threads/runs/steps/get.ts
5665
5834
  var import_radash13 = require("radash");
5666
- var get13 = function(param) {
5835
+ var get14 = function(param) {
5667
5836
  var prisma = param.prisma;
5668
5837
  return function(urlString) {
5669
5838
  return _async_to_generator(function() {
5670
- var _runSteps_at, url, _url_pathname_match, threadId, runId, _ref, limit, order, after, pageSize, runStepsPlusOne, runSteps, _runSteps_at_id;
5839
+ var _ref, _runSteps_at, url, _url_pathname_match, threadId, runId, _ref1, limit, order, after, pageSize, runStepsPlusOne, runSteps;
5671
5840
  return _ts_generator(this, function(_state) {
5672
5841
  switch(_state.label){
5673
5842
  case 0:
5674
5843
  url = new URL(urlString);
5675
5844
  _url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(stepsRegexp)), 3), threadId = _url_pathname_match[1], runId = _url_pathname_match[2];
5676
- _ref = (0, import_radash13.assign)({
5845
+ _ref1 = (0, import_radash13.assign)({
5677
5846
  limit: "20",
5678
5847
  order: "desc"
5679
- }, Object.fromEntries(url.searchParams)), limit = _ref.limit, order = _ref.order, after = _ref.after;
5848
+ }, Object.fromEntries(url.searchParams)), limit = _ref1.limit, order = _ref1.order, after = _ref1.after;
5680
5849
  pageSize = parseInt(limit, 10);
5681
5850
  return [
5682
5851
  4,
@@ -5708,7 +5877,7 @@ var get13 = function(param) {
5708
5877
  });
5709
5878
  }),
5710
5879
  has_more: runStepsPlusOne.length > pageSize,
5711
- 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
5880
+ last_id: (_ref = (_runSteps_at = runSteps.at(-1)) === null || _runSteps_at === void 0 ? void 0 : _runSteps_at.id) !== null && _ref !== void 0 ? _ref : null
5712
5881
  }), {
5713
5882
  status: 200,
5714
5883
  headers: {
@@ -5725,7 +5894,7 @@ var get13 = function(param) {
5725
5894
  var steps = function(param) {
5726
5895
  var prisma = param.prisma;
5727
5896
  return {
5728
- get: get13({
5897
+ get: get14({
5729
5898
  prisma: prisma
5730
5899
  })
5731
5900
  };
@@ -6468,7 +6637,7 @@ function responseId(param) {
6468
6637
  try {
6469
6638
  arr = JSON.parse(raw);
6470
6639
  if (!Array.isArray(arr)) continue;
6471
- } catch (e) {
6640
+ } catch (unused) {
6472
6641
  continue;
6473
6642
  }
6474
6643
  for(var j = arr.length - 1; j >= 0; j--){
@@ -6482,7 +6651,7 @@ function responseId(param) {
6482
6651
  return null;
6483
6652
  }
6484
6653
  // src/adapters/storage/responsesStorageAdapter/threads/messages/get.ts
6485
- var get14 = function(param) {
6654
+ var get15 = function(param) {
6486
6655
  var client = param.client, runAdapter = param.runAdapter;
6487
6656
  return function(urlString) {
6488
6657
  return _async_to_generator(function() {
@@ -6619,10 +6788,10 @@ var fetchResponsesForItems = function(param) {
6619
6788
  var assignTimestamps = function(param) {
6620
6789
  var items = param.items, responseMap = param.responseMap, sortOrder = param.sortOrder, conversationCreatedAt = param.conversationCreatedAt;
6621
6790
  var itemsWithTimestamps = items.map(function(entry) {
6791
+ var _ref;
6622
6792
  var _responseMap_get;
6623
- var _responseMap_get_created_at;
6624
6793
  return _object_spread_props(_object_spread({}, entry), {
6625
- 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,
6794
+ timestamp: entry.runId ? (_ref = (_responseMap_get = responseMap.get(entry.runId)) === null || _responseMap_get === void 0 ? void 0 : _responseMap_get.created_at) !== null && _ref !== void 0 ? _ref : null : null,
6626
6795
  assignedTimestamp: 0
6627
6796
  });
6628
6797
  });
@@ -6698,14 +6867,14 @@ var messages3 = function(param) {
6698
6867
  runAdapter: runAdapter,
6699
6868
  createResponseItems: createResponseItems
6700
6869
  }),
6701
- get: get14({
6870
+ get: get15({
6702
6871
  client: client,
6703
6872
  runAdapter: runAdapter
6704
6873
  })
6705
6874
  };
6706
6875
  };
6707
6876
  // src/adapters/storage/responsesStorageAdapter/threads/runs/get.ts
6708
- var get15 = function() {
6877
+ var get16 = function() {
6709
6878
  return function(urlString) {
6710
6879
  return _async_to_generator(function() {
6711
6880
  return _ts_generator(this, function(_state) {
@@ -6733,29 +6902,28 @@ var import_radash18 = require("radash");
6733
6902
  // src/lib/responses/serializeResponseAsRun.ts
6734
6903
  var serializeStatus = function(param) {
6735
6904
  var response = param.response;
6905
+ var _ref;
6736
6906
  var _response_status;
6737
6907
  if (response.error) return "failed";
6738
- var _response_status_toLowerCase;
6739
- return (_response_status_toLowerCase = (_response_status = response.status) === null || _response_status === void 0 ? void 0 : _response_status.toLowerCase()) !== null && _response_status_toLowerCase !== void 0 ? _response_status_toLowerCase : "completed";
6908
+ return (_ref = (_response_status = response.status) === null || _response_status === void 0 ? void 0 : _response_status.toLowerCase()) !== null && _ref !== void 0 ? _ref : "completed";
6740
6909
  };
6741
6910
  var serializeUsage = function(param) {
6742
6911
  var response = param.response;
6912
+ var _ref, _ref1, _ref2;
6743
6913
  var _response_usage, _response_usage1, _response_usage2;
6744
- var _response_usage_input_tokens, _response_usage_output_tokens, _response_usage_total_tokens;
6745
6914
  return {
6746
- 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,
6747
- 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,
6748
- 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
6915
+ prompt_tokens: (_ref = (_response_usage = response.usage) === null || _response_usage === void 0 ? void 0 : _response_usage.input_tokens) !== null && _ref !== void 0 ? _ref : 0,
6916
+ completion_tokens: (_ref1 = (_response_usage1 = response.usage) === null || _response_usage1 === void 0 ? void 0 : _response_usage1.output_tokens) !== null && _ref1 !== void 0 ? _ref1 : 0,
6917
+ total_tokens: (_ref2 = (_response_usage2 = response.usage) === null || _response_usage2 === void 0 ? void 0 : _response_usage2.total_tokens) !== null && _ref2 !== void 0 ? _ref2 : 0
6749
6918
  };
6750
6919
  };
6751
6920
  var findPendingToolCalls = function(param) {
6752
6921
  var response = param.response;
6753
- var _response_output;
6922
+ var _response_output, _response_output1;
6754
6923
  var toolCalls = ((_response_output = response.output) !== null && _response_output !== void 0 ? _response_output : []).filter(function(item) {
6755
6924
  return item.type === "function_call";
6756
6925
  });
6757
6926
  if (toolCalls.length === 0) return [];
6758
- var _response_output1;
6759
6927
  var completedCallIds = new Set(((_response_output1 = response.output) !== null && _response_output1 !== void 0 ? _response_output1 : []).filter(function(item) {
6760
6928
  return(// @ts-expect-error missing openai type
6761
6929
  item.type === "function_call_output");
@@ -6841,7 +7009,7 @@ function parseBucket(param) {
6841
7009
  try {
6842
7010
  var arr = JSON.parse(value);
6843
7011
  return Array.isArray(arr) ? arr : [];
6844
- } catch (e) {
7012
+ } catch (unused) {
6845
7013
  return [];
6846
7014
  }
6847
7015
  }
@@ -7254,7 +7422,7 @@ var post17 = function(param) {
7254
7422
  readableStream = new ReadableStream({
7255
7423
  start: function start(controller) {
7256
7424
  return _async_to_generator(function() {
7257
- var error, _error_cause, _error_message, _error_cause_message, event;
7425
+ var error, _ref, _ref1, _error_cause, event;
7258
7426
  return _ts_generator(this, function(_state) {
7259
7427
  switch(_state.label){
7260
7428
  case 0:
@@ -7297,7 +7465,7 @@ var post17 = function(param) {
7297
7465
  failed_at: (0, import_dayjs11.default)().unix(),
7298
7466
  last_error: {
7299
7467
  code: "server_error",
7300
- 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 : "")
7468
+ message: "".concat((_ref = error === null || error === void 0 ? void 0 : error.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
7301
7469
  }
7302
7470
  }
7303
7471
  };
@@ -7377,7 +7545,7 @@ var post17 = function(param) {
7377
7545
  var runs2 = function(param) {
7378
7546
  var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
7379
7547
  return {
7380
- get: get15(),
7548
+ get: get16(),
7381
7549
  post: post17({
7382
7550
  client: client,
7383
7551
  createResponseItems: createResponseItems,
@@ -7386,7 +7554,7 @@ var runs2 = function(param) {
7386
7554
  };
7387
7555
  };
7388
7556
  // src/adapters/storage/responsesStorageAdapter/threads/run/get.ts
7389
- var get16 = function(param) {
7557
+ var get17 = function(param) {
7390
7558
  var client = param.client, runAdapter = param.runAdapter;
7391
7559
  return function(urlString) {
7392
7560
  return _async_to_generator(function() {
@@ -7436,7 +7604,7 @@ var get16 = function(param) {
7436
7604
  var run2 = function(param) {
7437
7605
  var client = param.client, runAdapter = param.runAdapter;
7438
7606
  return {
7439
- get: get16({
7607
+ get: get17({
7440
7608
  client: client,
7441
7609
  runAdapter: runAdapter
7442
7610
  })
@@ -7740,7 +7908,7 @@ var serializeStatus5 = function(param) {
7740
7908
  };
7741
7909
  var serializeItemAsMcpCallRunStep = function(param) {
7742
7910
  var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs17.default)().unix() : _param_completedAt;
7743
- var _item_output, _ref;
7911
+ var _ref, _item_output;
7744
7912
  var toolCall = {
7745
7913
  id: "ftc".concat(item.id),
7746
7914
  type: "function",
@@ -7957,11 +8125,11 @@ var serializeItemAsReasoningRunStep = function(param) {
7957
8125
  };
7958
8126
  };
7959
8127
  // src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
7960
- var get17 = function(param) {
8128
+ var get18 = function(param) {
7961
8129
  var client = param.client, runAdapter = param.runAdapter;
7962
8130
  return function(urlString) {
7963
8131
  return _async_to_generator(function() {
7964
- var _this, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data, _id;
8132
+ var _ref, _this, url, _url_pathname_match, threadId, runId, response, latestToolCallItem, functionCallOutputItems, computerCallOutputItems, items, openaiAssistant, data;
7965
8133
  return _ts_generator(this, function(_state) {
7966
8134
  switch(_state.label){
7967
8135
  case 0:
@@ -8109,7 +8277,7 @@ var get17 = function(param) {
8109
8277
  new Response(JSON.stringify({
8110
8278
  data: data,
8111
8279
  has_more: false,
8112
- last_id: (_id = (_this = (0, import_radash22.last)(response.output)) === null || _this === void 0 ? void 0 : _this.id) !== null && _id !== void 0 ? _id : null
8280
+ last_id: (_ref = (_this = (0, import_radash22.last)(response.output)) === null || _this === void 0 ? void 0 : _this.id) !== null && _ref !== void 0 ? _ref : null
8113
8281
  }), {
8114
8282
  status: 200,
8115
8283
  headers: {
@@ -8126,7 +8294,7 @@ var get17 = function(param) {
8126
8294
  var steps2 = function(param) {
8127
8295
  var client = param.client, runAdapter = param.runAdapter;
8128
8296
  return {
8129
- get: get17({
8297
+ get: get18({
8130
8298
  client: client,
8131
8299
  runAdapter: runAdapter
8132
8300
  })
@@ -8152,7 +8320,7 @@ var computerCallOutput = function(param) {
8152
8320
  var parsedOutput;
8153
8321
  try {
8154
8322
  parsedOutput = JSON.parse(toolOutput.output);
8155
- } catch (e) {
8323
+ } catch (unused) {
8156
8324
  return {
8157
8325
  isComputerCallOutput: false
8158
8326
  };
@@ -8348,7 +8516,7 @@ var submitToolOutputs2 = function(param) {
8348
8516
  };
8349
8517
  };
8350
8518
  // src/adapters/storage/responsesStorageAdapter/assistants/get.ts
8351
- var get18 = function(param) {
8519
+ var get19 = function(param) {
8352
8520
  var runAdapter = param.runAdapter;
8353
8521
  return function(_urlString) {
8354
8522
  return _async_to_generator(function() {
@@ -8423,7 +8591,7 @@ var post19 = function() {
8423
8591
  var assistants2 = function(param) {
8424
8592
  var runAdapter = param.runAdapter;
8425
8593
  return {
8426
- get: get18({
8594
+ get: get19({
8427
8595
  runAdapter: runAdapter
8428
8596
  }),
8429
8597
  post: post19()
@@ -8464,6 +8632,155 @@ var responsesStorageAdapter = function() {
8464
8632
  };
8465
8633
  };
8466
8634
  };
8635
+ // src/adapters/storage/azureResponsesStorageAdapter/index.ts
8636
+ var azureResponsesStorageAdapter = function() {
8637
+ var createResponseItems = [];
8638
+ var cachedClient = null;
8639
+ return function(param) {
8640
+ var runAdapter = param.runAdapter, client = param.client, originalClient = param.originalClient;
8641
+ var getAIProjectClient = function() {
8642
+ if (originalClient && (typeof originalClient === "undefined" ? "undefined" : _type_of(originalClient)) === "object" && "client" in originalClient) {
8643
+ return originalClient.client;
8644
+ }
8645
+ return client;
8646
+ };
8647
+ var getAzureClient = function() {
8648
+ return _async_to_generator(function() {
8649
+ var aiProjectClient, azureClient;
8650
+ return _ts_generator(this, function(_state) {
8651
+ switch(_state.label){
8652
+ case 0:
8653
+ if (cachedClient) {
8654
+ return [
8655
+ 2,
8656
+ cachedClient
8657
+ ];
8658
+ }
8659
+ aiProjectClient = getAIProjectClient();
8660
+ if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
8661
+ 3,
8662
+ 2
8663
+ ];
8664
+ return [
8665
+ 4,
8666
+ aiProjectClient.getOpenAIClient()
8667
+ ];
8668
+ case 1:
8669
+ azureClient = _state.sent();
8670
+ cachedClient = azureClient;
8671
+ return [
8672
+ 2,
8673
+ azureClient
8674
+ ];
8675
+ case 2:
8676
+ cachedClient = aiProjectClient;
8677
+ return [
8678
+ 2,
8679
+ aiProjectClient
8680
+ ];
8681
+ }
8682
+ });
8683
+ })();
8684
+ };
8685
+ var wrappedRunAdapter = _object_spread_props(_object_spread({}, runAdapter), {
8686
+ handleRun: function(args) {
8687
+ return _async_to_generator(function() {
8688
+ var azureClient;
8689
+ return _ts_generator(this, function(_state) {
8690
+ switch(_state.label){
8691
+ case 0:
8692
+ return [
8693
+ 4,
8694
+ getAzureClient()
8695
+ ];
8696
+ case 1:
8697
+ azureClient = _state.sent();
8698
+ return [
8699
+ 2,
8700
+ runAdapter.handleRun(_object_spread_props(_object_spread({}, args), {
8701
+ client: azureClient
8702
+ }))
8703
+ ];
8704
+ }
8705
+ });
8706
+ })();
8707
+ }
8708
+ });
8709
+ var wrapHandlerMethod = function(handlerFactory, method) {
8710
+ return function(urlString, options) {
8711
+ return _async_to_generator(function() {
8712
+ var openaiClient, handler;
8713
+ return _ts_generator(this, function(_state) {
8714
+ switch(_state.label){
8715
+ case 0:
8716
+ return [
8717
+ 4,
8718
+ getAzureClient()
8719
+ ];
8720
+ case 1:
8721
+ openaiClient = _state.sent();
8722
+ handler = handlerFactory({
8723
+ client: openaiClient,
8724
+ runAdapter: wrappedRunAdapter,
8725
+ createResponseItems: createResponseItems
8726
+ });
8727
+ return [
8728
+ 2,
8729
+ handler[method](urlString, options)
8730
+ ];
8731
+ }
8732
+ });
8733
+ })();
8734
+ };
8735
+ };
8736
+ var createWrappedHandlers = function(handlerFactory, methods) {
8737
+ var wrapped = {};
8738
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8739
+ try {
8740
+ for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8741
+ var method = _step.value;
8742
+ wrapped[method] = wrapHandlerMethod(handlerFactory, method);
8743
+ }
8744
+ } catch (err) {
8745
+ _didIteratorError = true;
8746
+ _iteratorError = err;
8747
+ } finally{
8748
+ try {
8749
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
8750
+ _iterator.return();
8751
+ }
8752
+ } finally{
8753
+ if (_didIteratorError) {
8754
+ throw _iteratorError;
8755
+ }
8756
+ }
8757
+ }
8758
+ return wrapped;
8759
+ };
8760
+ var _obj;
8761
+ return {
8762
+ requestHandlers: (_obj = {
8763
+ "^/(?:v1|/?openai)/assistants$": assistants2({
8764
+ runAdapter: wrappedRunAdapter
8765
+ }),
8766
+ "^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
8767
+ "post"
8768
+ ])
8769
+ }, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
8770
+ "get",
8771
+ "post"
8772
+ ])), _define_property(_obj, runsRegexp, createWrappedHandlers(runs2, [
8773
+ "post"
8774
+ ])), _define_property(_obj, runRegexp, createWrappedHandlers(run2, [
8775
+ "get"
8776
+ ])), _define_property(_obj, stepsRegexp, createWrappedHandlers(steps2, [
8777
+ "get"
8778
+ ])), _define_property(_obj, submitToolOutputsRegexp, createWrappedHandlers(submitToolOutputs2, [
8779
+ "post"
8780
+ ])), _obj)
8781
+ };
8782
+ };
8783
+ };
8467
8784
  // src/adapters/storage/azureAgentsStorageAdapter/threads/post.ts
8468
8785
  var import_dayjs21 = __toESM(require("dayjs"), 1);
8469
8786
  var post20 = function(param) {
@@ -8596,8 +8913,8 @@ var post21 = function(param) {
8596
8913
  }
8597
8914
  };
8598
8915
  } else if (c.type === "image_file") {
8599
- var imageFile = c.image_file || c.imageFile || {};
8600
8916
  var _imageFile_detail;
8917
+ var imageFile = c.image_file || c.imageFile || {};
8601
8918
  return {
8602
8919
  type: "image_file",
8603
8920
  image_file: {
@@ -8633,7 +8950,7 @@ var post21 = function(param) {
8633
8950
  };
8634
8951
  // src/adapters/storage/azureAgentsStorageAdapter/threads/messages/get.ts
8635
8952
  var import_dayjs23 = __toESM(require("dayjs"), 1);
8636
- var get19 = function(param) {
8953
+ var get20 = function(param) {
8637
8954
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
8638
8955
  return function(urlString) {
8639
8956
  return _async_to_generator(function() {
@@ -8721,8 +9038,8 @@ var get19 = function(param) {
8721
9038
  }
8722
9039
  };
8723
9040
  } else if (c.type === "image_file") {
8724
- var imageFile = c.image_file || c.imageFile || {};
8725
9041
  var _imageFile_detail;
9042
+ var imageFile = c.image_file || c.imageFile || {};
8726
9043
  return {
8727
9044
  type: "image_file",
8728
9045
  image_file: {
@@ -8825,14 +9142,14 @@ var messages4 = function(param) {
8825
9142
  azureAiProject: azureAiProject,
8826
9143
  runAdapter: runAdapter
8827
9144
  }),
8828
- get: get19({
9145
+ get: get20({
8829
9146
  azureAiProject: azureAiProject,
8830
9147
  runAdapter: runAdapter
8831
9148
  })
8832
9149
  };
8833
9150
  };
8834
9151
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/get.ts
8835
- var get20 = function() {
9152
+ var get21 = function() {
8836
9153
  return function() {
8837
9154
  return _async_to_generator(function() {
8838
9155
  var response;
@@ -8885,7 +9202,7 @@ var post22 = function(param) {
8885
9202
  readableStream = new ReadableStream({
8886
9203
  start: function start(controller) {
8887
9204
  return _async_to_generator(function() {
8888
- var error, _error_cause, _error_message, _error_cause_message, event;
9205
+ var error, _ref, _ref1, _error_cause, event;
8889
9206
  return _ts_generator(this, function(_state) {
8890
9207
  switch(_state.label){
8891
9208
  case 0:
@@ -8930,7 +9247,7 @@ var post22 = function(param) {
8930
9247
  failed_at: (0, import_dayjs24.default)().unix(),
8931
9248
  last_error: {
8932
9249
  code: "server_error",
8933
- 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 : "")
9250
+ message: "".concat((_ref = error === null || error === void 0 ? void 0 : error.message) !== null && _ref !== void 0 ? _ref : "", " ").concat((_ref1 = error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.message) !== null && _ref1 !== void 0 ? _ref1 : "")
8934
9251
  }
8935
9252
  }
8936
9253
  };
@@ -9128,7 +9445,7 @@ var post22 = function(param) {
9128
9445
  var runs3 = function(param) {
9129
9446
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9130
9447
  return {
9131
- get: get20(),
9448
+ get: get21(),
9132
9449
  post: post22({
9133
9450
  azureAiProject: azureAiProject,
9134
9451
  runAdapter: runAdapter
@@ -9137,7 +9454,7 @@ var runs3 = function(param) {
9137
9454
  };
9138
9455
  // src/adapters/storage/azureAgentsStorageAdapter/threads/run/get.ts
9139
9456
  var import_dayjs25 = __toESM(require("dayjs"), 1);
9140
- var get21 = function(param) {
9457
+ var get22 = function(param) {
9141
9458
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9142
9459
  return function(urlString) {
9143
9460
  return _async_to_generator(function() {
@@ -9221,7 +9538,7 @@ var get21 = function(param) {
9221
9538
  var run3 = function(param) {
9222
9539
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9223
9540
  return {
9224
- get: get21({
9541
+ get: get22({
9225
9542
  azureAiProject: azureAiProject,
9226
9543
  runAdapter: runAdapter
9227
9544
  })
@@ -9229,7 +9546,7 @@ var run3 = function(param) {
9229
9546
  };
9230
9547
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
9231
9548
  var import_dayjs26 = __toESM(require("dayjs"), 1);
9232
- var get22 = function(param) {
9549
+ var get23 = function(param) {
9233
9550
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9234
9551
  return function(urlString) {
9235
9552
  return _async_to_generator(function() {
@@ -9332,7 +9649,7 @@ var get22 = function(param) {
9332
9649
  file_search: tc.fileSearch || {}
9333
9650
  };
9334
9651
  } else if (tc.type === "function") {
9335
- var _tc_function_output, _ref;
9652
+ var _ref, _tc_function_output;
9336
9653
  return {
9337
9654
  id: tc.id,
9338
9655
  type: "function",
@@ -9440,7 +9757,7 @@ var get22 = function(param) {
9440
9757
  var steps3 = function(param) {
9441
9758
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9442
9759
  return {
9443
- get: get22({
9760
+ get: get23({
9444
9761
  azureAiProject: azureAiProject,
9445
9762
  runAdapter: runAdapter,
9446
9763
  prisma: prisma
@@ -9453,8 +9770,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9453
9770
  var event = azureEvent.event, data = azureEvent.data;
9454
9771
  var eventType = event;
9455
9772
  if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
9456
- var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
9457
9773
  var _data_temperature, _data_topP;
9774
+ var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
9458
9775
  return {
9459
9776
  event: eventType,
9460
9777
  data: {
@@ -9582,8 +9899,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9582
9899
  type: "tool_calls",
9583
9900
  tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
9584
9901
  if (tc.type === "code_interpreter") {
9585
- var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
9586
9902
  var _tc_index;
9903
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
9587
9904
  return {
9588
9905
  index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
9589
9906
  id: tc.id,
@@ -9600,8 +9917,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9600
9917
  };
9601
9918
  }
9602
9919
  if (output.type === "image") {
9603
- var _output_image;
9604
9920
  var _output_index1;
9921
+ var _output_image;
9605
9922
  return {
9606
9923
  index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
9607
9924
  type: "image",
@@ -9623,8 +9940,8 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9623
9940
  file_search: tc.fileSearch || {}
9624
9941
  };
9625
9942
  } else if (tc.type === "function") {
9943
+ var _tc_index2, _ref, _ref1;
9626
9944
  var _tc_function, _tc_function1, _tc_function2;
9627
- var _tc_index2, _tc_function_output, _ref;
9628
9945
  return {
9629
9946
  index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
9630
9947
  id: tc.id,
@@ -9632,7 +9949,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9632
9949
  function: {
9633
9950
  name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
9634
9951
  arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
9635
- 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
9952
+ output: (_ref = (_ref1 = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) !== null && _ref1 !== void 0 ? _ref1 : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
9636
9953
  }
9637
9954
  };
9638
9955
  }
@@ -9710,15 +10027,15 @@ function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
9710
10027
  file_search: tc.fileSearch || {}
9711
10028
  };
9712
10029
  } else if (tc.type === "function") {
10030
+ var _ref, _ref1;
9713
10031
  var _tc_function, _tc_function1, _tc_function2;
9714
- var _tc_function_output, _ref;
9715
10032
  return {
9716
10033
  id: tc.id,
9717
10034
  type: "function",
9718
10035
  function: {
9719
10036
  name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
9720
10037
  arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
9721
- 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
10038
+ 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
9722
10039
  }
9723
10040
  };
9724
10041
  }
@@ -9827,7 +10144,7 @@ var post23 = function(param) {
9827
10144
  }));
9828
10145
  streamRun = function(onEvent2) {
9829
10146
  return _async_to_generator(function() {
9830
- var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error, _error_cause, _error_message, _error_cause_message;
10147
+ var stream2, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, azureEvent, openaiEvent, err, error, _ref, _ref1, _error_cause;
9831
10148
  return _ts_generator(this, function(_state) {
9832
10149
  switch(_state.label){
9833
10150
  case 0:
@@ -9952,7 +10269,7 @@ var post23 = function(param) {
9952
10269
  required_action: null,
9953
10270
  last_error: {
9954
10271
  code: "server_error",
9955
- 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 : "")
10272
+ 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 : "")
9956
10273
  },
9957
10274
  expires_at: null,
9958
10275
  started_at: (0, import_dayjs27.default)().unix(),
@@ -10093,7 +10410,7 @@ var post24 = function(param) {
10093
10410
  var runAdapter = param.runAdapter;
10094
10411
  return function(_urlString, options) {
10095
10412
  return _async_to_generator(function() {
10096
- var body, _body_top_p, _body_temperature, openaiAssistant;
10413
+ var _body_top_p, _body_temperature, body, openaiAssistant;
10097
10414
  return _ts_generator(this, function(_state) {
10098
10415
  if (typeof options.body !== "string") {
10099
10416
  throw new Error("Request body is required");
@@ -10157,10 +10474,9 @@ var toUnixSeconds = function(value) {
10157
10474
  return parsed.isValid() ? parsed.unix() : void 0;
10158
10475
  };
10159
10476
  var transformAzureFile = function(file2) {
10160
- var _toUnixSeconds;
10477
+ var _toUnixSeconds, _file2_bytes;
10161
10478
  var createdAtUnix = (_toUnixSeconds = toUnixSeconds(file2.createdAt)) !== null && _toUnixSeconds !== void 0 ? _toUnixSeconds : (0, import_dayjs28.default)().unix();
10162
10479
  var expiresAtUnix = toUnixSeconds(file2.expiresAt);
10163
- var _file2_bytes;
10164
10480
  var openaiFile = {
10165
10481
  id: file2.id,
10166
10482
  object: file2.object || "file",
@@ -10347,7 +10663,7 @@ var fileContent = function(param) {
10347
10663
  return {
10348
10664
  get: function(url) {
10349
10665
  return _async_to_generator(function() {
10350
- var pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body, _nodeResponse_status;
10666
+ var _nodeResponse_status, pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body;
10351
10667
  return _ts_generator(this, function(_state) {
10352
10668
  switch(_state.label){
10353
10669
  case 0:
@@ -12489,8 +12805,8 @@ var import_radash25 = require("radash");
12489
12805
  function transformAnnotations(annotations) {
12490
12806
  return annotations.map(function(ann) {
12491
12807
  if (ann.type === "file_citation") {
12492
- var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
12493
12808
  var _ann_startIndex, _ann_endIndex;
12809
+ var _ann_fileCitation, _ann_file_citation, _ann_fileCitation1, _ann_file_citation1;
12494
12810
  return {
12495
12811
  type: "file_citation",
12496
12812
  text: ann.text,
@@ -12502,8 +12818,8 @@ function transformAnnotations(annotations) {
12502
12818
  }
12503
12819
  };
12504
12820
  } else if (ann.type === "file_path") {
12505
- var _ann_filePath, _ann_file_path;
12506
12821
  var _ann_startIndex1, _ann_endIndex1;
12822
+ var _ann_filePath, _ann_file_path;
12507
12823
  return {
12508
12824
  type: "file_path",
12509
12825
  text: ann.text,
@@ -12529,8 +12845,8 @@ function transformMessageContentItem(content) {
12529
12845
  };
12530
12846
  }
12531
12847
  if (content.type === "image_file") {
12532
- var imageFile = content.image_file || content.imageFile || {};
12533
12848
  var _imageFile_detail;
12849
+ var imageFile = content.image_file || content.imageFile || {};
12534
12850
  return {
12535
12851
  type: "image_file",
12536
12852
  image_file: {
@@ -12554,8 +12870,8 @@ function transformMessageDeltaContentItem(content) {
12554
12870
  };
12555
12871
  }
12556
12872
  if (content.type === "image_file") {
12557
- var imageFile = content.image_file || content.imageFile || {};
12558
12873
  var _imageFile_detail;
12874
+ var imageFile = content.image_file || content.imageFile || {};
12559
12875
  return {
12560
12876
  index: content.index || 0,
12561
12877
  type: "image_file",
@@ -12571,8 +12887,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12571
12887
  var event = azureEvent.event, data = azureEvent.data;
12572
12888
  var eventType = event;
12573
12889
  if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
12574
- var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
12575
12890
  var _data_temperature, _data_topP;
12891
+ var _data_requiredAction_submitToolOutputs_toolCalls, _data_requiredAction_submitToolOutputs;
12576
12892
  return {
12577
12893
  event: eventType,
12578
12894
  data: {
@@ -12679,8 +12995,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12679
12995
  type: "tool_calls",
12680
12996
  tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
12681
12997
  if (tc.type === "code_interpreter") {
12682
- var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12683
12998
  var _tc_index;
12999
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12684
13000
  return {
12685
13001
  index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
12686
13002
  id: tc.id,
@@ -12697,8 +13013,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12697
13013
  };
12698
13014
  }
12699
13015
  if (output.type === "image") {
12700
- var _output_image;
12701
13016
  var _output_index1;
13017
+ var _output_image;
12702
13018
  return {
12703
13019
  index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
12704
13020
  type: "image",
@@ -12720,8 +13036,8 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12720
13036
  file_search: tc.fileSearch || {}
12721
13037
  };
12722
13038
  } else if (tc.type === "function") {
12723
- var _tc_function, _tc_function1, _tc_function2;
12724
13039
  var _tc_index2;
13040
+ var _tc_function, _tc_function1, _tc_function2;
12725
13041
  return {
12726
13042
  index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
12727
13043
  id: tc.id,
@@ -13056,6 +13372,7 @@ var azureAgentsRunAdapter = function(param) {
13056
13372
  azureAgentsStorageAdapter: azureAgentsStorageAdapter,
13057
13373
  azureAiProjectClientAdapter: azureAiProjectClientAdapter,
13058
13374
  azureOpenaiClientAdapter: azureOpenaiClientAdapter,
13375
+ azureResponsesStorageAdapter: azureResponsesStorageAdapter,
13059
13376
  completionsRunAdapter: completionsRunAdapter,
13060
13377
  googleClientAdapter: googleClientAdapter,
13061
13378
  groqClientAdapter: groqClientAdapter,