supercompat 3.12.1 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -93,6 +93,13 @@ function _define_property(obj, key, value) {
93
93
  }
94
94
  return obj;
95
95
  }
96
+ function _instanceof(left, right) {
97
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
98
+ return !!right[Symbol.hasInstance](left);
99
+ } else {
100
+ return left instanceof right;
101
+ }
102
+ }
96
103
  function _iterable_to_array(iter) {
97
104
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
98
105
  }
@@ -9103,10 +9110,10 @@ var run3 = function(param) {
9103
9110
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
9104
9111
  import dayjs26 from "dayjs";
9105
9112
  var get22 = function(param) {
9106
- var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9113
+ var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9107
9114
  return function(urlString) {
9108
9115
  return _async_to_generator(function() {
9109
- var _stepsList_, _stepsList_1, url, _url_pathname_match, threadId, runId, azureSteps, stepsList, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, step, _step_stepDetails_messageCreation, assistantId, err, response;
9116
+ var _stepsList_, _stepsList_1, url, _url_pathname_match, threadId, runId, azureSteps, storedOutputs, outputsMap, stepsList, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, step, _step_stepDetails_messageCreation, assistantId, err, response;
9110
9117
  return _ts_generator(this, function(_state) {
9111
9118
  switch(_state.label){
9112
9119
  case 0:
@@ -9118,27 +9125,43 @@ var get22 = function(param) {
9118
9125
  ];
9119
9126
  case 1:
9120
9127
  azureSteps = _state.sent();
9128
+ return [
9129
+ 4,
9130
+ prisma.azureAgentsFunctionOutput.findMany({
9131
+ where: {
9132
+ runId: runId
9133
+ }
9134
+ })
9135
+ ];
9136
+ case 2:
9137
+ storedOutputs = _state.sent();
9138
+ outputsMap = new Map(storedOutputs.map(function(o) {
9139
+ return [
9140
+ o.toolCallId,
9141
+ o.output
9142
+ ];
9143
+ }));
9121
9144
  stepsList = [];
9122
9145
  _iteratorAbruptCompletion = false, _didIteratorError = false;
9123
- _state.label = 2;
9124
- case 2:
9146
+ _state.label = 3;
9147
+ case 3:
9125
9148
  _state.trys.push([
9126
- 2,
9127
- 7,
9149
+ 3,
9128
9150
  8,
9129
- 13
9151
+ 9,
9152
+ 14
9130
9153
  ]);
9131
9154
  _iterator = _async_iterator(azureSteps);
9132
- _state.label = 3;
9133
- case 3:
9155
+ _state.label = 4;
9156
+ case 4:
9134
9157
  return [
9135
9158
  4,
9136
9159
  _iterator.next()
9137
9160
  ];
9138
- case 4:
9161
+ case 5:
9139
9162
  if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
9140
9163
  3,
9141
- 6
9164
+ 7
9142
9165
  ];
9143
9166
  _value = _step.value;
9144
9167
  step = _value;
@@ -9189,13 +9212,16 @@ var get22 = function(param) {
9189
9212
  file_search: tc.fileSearch || {}
9190
9213
  };
9191
9214
  } else if (tc.type === "function") {
9215
+ var _tc_function_output, _ref;
9192
9216
  return {
9193
9217
  id: tc.id,
9194
9218
  type: "function",
9195
9219
  function: {
9196
9220
  name: tc.function.name,
9197
9221
  arguments: tc.function.arguments,
9198
- output: tc.function.output || null
9222
+ // Retrieve output from database if Azure doesn't provide it
9223
+ // Use nullish coalescing (??) to preserve empty strings
9224
+ output: (_ref = (_tc_function_output = tc.function.output) !== null && _tc_function_output !== void 0 ? _tc_function_output : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
9199
9225
  }
9200
9226
  };
9201
9227
  }
@@ -9215,61 +9241,61 @@ var get22 = function(param) {
9215
9241
  metadata: step.metadata || {},
9216
9242
  usage: null
9217
9243
  });
9218
- _state.label = 5;
9219
- case 5:
9244
+ _state.label = 6;
9245
+ case 6:
9220
9246
  _iteratorAbruptCompletion = false;
9221
9247
  return [
9222
9248
  3,
9223
- 3
9249
+ 4
9224
9250
  ];
9225
- case 6:
9251
+ case 7:
9226
9252
  return [
9227
9253
  3,
9228
- 13
9254
+ 14
9229
9255
  ];
9230
- case 7:
9256
+ case 8:
9231
9257
  err = _state.sent();
9232
9258
  _didIteratorError = true;
9233
9259
  _iteratorError = err;
9234
9260
  return [
9235
9261
  3,
9236
- 13
9262
+ 14
9237
9263
  ];
9238
- case 8:
9264
+ case 9:
9239
9265
  _state.trys.push([
9240
- 8,
9266
+ 9,
9241
9267
  ,
9242
- 11,
9243
- 12
9268
+ 12,
9269
+ 13
9244
9270
  ]);
9245
9271
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
9246
9272
  3,
9247
- 10
9273
+ 11
9248
9274
  ];
9249
9275
  return [
9250
9276
  4,
9251
9277
  _iterator.return()
9252
9278
  ];
9253
- case 9:
9254
- _state.sent();
9255
- _state.label = 10;
9256
9279
  case 10:
9280
+ _state.sent();
9281
+ _state.label = 11;
9282
+ case 11:
9257
9283
  return [
9258
9284
  3,
9259
- 12
9285
+ 13
9260
9286
  ];
9261
- case 11:
9287
+ case 12:
9262
9288
  if (_didIteratorError) {
9263
9289
  throw _iteratorError;
9264
9290
  }
9265
9291
  return [
9266
9292
  7
9267
9293
  ];
9268
- case 12:
9294
+ case 13:
9269
9295
  return [
9270
9296
  7
9271
9297
  ];
9272
- case 13:
9298
+ case 14:
9273
9299
  response = {
9274
9300
  data: stepsList,
9275
9301
  first_id: ((_stepsList_ = stepsList[0]) === null || _stepsList_ === void 0 ? void 0 : _stepsList_.id) || null,
@@ -9292,11 +9318,12 @@ var get22 = function(param) {
9292
9318
  };
9293
9319
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/index.ts
9294
9320
  var steps3 = function(param) {
9295
- var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9321
+ var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9296
9322
  return {
9297
9323
  get: get22({
9298
9324
  azureAiProject: azureAiProject,
9299
- runAdapter: runAdapter
9325
+ runAdapter: runAdapter,
9326
+ prisma: prisma
9300
9327
  })
9301
9328
  };
9302
9329
  };
@@ -9621,7 +9648,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
9621
9648
  return null;
9622
9649
  }
9623
9650
  var post23 = function(param) {
9624
- var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9651
+ var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9625
9652
  return function(urlString, options) {
9626
9653
  return _async_to_generator(function() {
9627
9654
  var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
@@ -9637,9 +9664,32 @@ var post23 = function(param) {
9637
9664
  tool_outputs = body.tool_outputs, stream = body.stream;
9638
9665
  return [
9639
9666
  4,
9640
- azureAiProject.agents.runs.get(threadId, runId)
9667
+ Promise.all(tool_outputs.map(function(output) {
9668
+ return prisma.azureAgentsFunctionOutput.upsert({
9669
+ where: {
9670
+ runId_toolCallId: {
9671
+ runId: runId,
9672
+ toolCallId: output.tool_call_id
9673
+ }
9674
+ },
9675
+ create: {
9676
+ runId: runId,
9677
+ toolCallId: output.tool_call_id,
9678
+ output: output.output
9679
+ },
9680
+ update: {
9681
+ output: output.output
9682
+ }
9683
+ });
9684
+ }))
9641
9685
  ];
9642
9686
  case 1:
9687
+ _state.sent();
9688
+ return [
9689
+ 4,
9690
+ azureAiProject.agents.runs.get(threadId, runId)
9691
+ ];
9692
+ case 2:
9643
9693
  existingRun = _state.sent();
9644
9694
  assistantId = existingRun.assistantId;
9645
9695
  submitResponse = azureAiProject.agents.runs.submitToolOutputs(threadId, runId, tool_outputs.map(function(to) {
@@ -9848,7 +9898,7 @@ var post23 = function(param) {
9848
9898
  });
9849
9899
  if (!stream) return [
9850
9900
  3,
9851
- 2
9901
+ 3
9852
9902
  ];
9853
9903
  return [
9854
9904
  2,
@@ -9858,7 +9908,7 @@ var post23 = function(param) {
9858
9908
  }
9859
9909
  })
9860
9910
  ];
9861
- case 2:
9911
+ case 3:
9862
9912
  events = [];
9863
9913
  finalRun = null;
9864
9914
  return [
@@ -9877,7 +9927,7 @@ var post23 = function(param) {
9877
9927
  })();
9878
9928
  })
9879
9929
  ];
9880
- case 3:
9930
+ case 4:
9881
9931
  _state.sent();
9882
9932
  if (!finalRun) {
9883
9933
  throw new Error("Run did not complete");
@@ -9891,7 +9941,7 @@ var post23 = function(param) {
9891
9941
  }
9892
9942
  })
9893
9943
  ];
9894
- case 4:
9944
+ case 5:
9895
9945
  return [
9896
9946
  2
9897
9947
  ];
@@ -9902,11 +9952,12 @@ var post23 = function(param) {
9902
9952
  };
9903
9953
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/submitToolOutputs/index.ts
9904
9954
  var submitToolOutputs3 = function(param) {
9905
- var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9955
+ var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9906
9956
  return {
9907
9957
  post: post23({
9908
9958
  azureAiProject: azureAiProject,
9909
- runAdapter: runAdapter
9959
+ runAdapter: runAdapter,
9960
+ prisma: prisma
9910
9961
  })
9911
9962
  };
9912
9963
  };
@@ -9958,9 +10009,303 @@ var assistants3 = function(param) {
9958
10009
  })
9959
10010
  };
9960
10011
  };
10012
+ // src/lib/files/fileRegexp.ts
10013
+ var fileRegexp = "^/(?:v1|/?openai)/files/([^/]+)$";
10014
+ // src/lib/files/fileContentRegexp.ts
10015
+ var fileContentRegexp = "^/(?:v1|/?openai)/files/([^/]+)/content$";
10016
+ // src/lib/files/transformAzureFile.ts
10017
+ import dayjs28 from "dayjs";
10018
+ var toUnixSeconds = function(value) {
10019
+ if (!value) return void 0;
10020
+ if (_instanceof(value, Date)) {
10021
+ return dayjs28(value).unix();
10022
+ }
10023
+ if (typeof value === "number") {
10024
+ if (value > 9999999999) {
10025
+ return dayjs28(value).unix();
10026
+ }
10027
+ return Math.floor(value);
10028
+ }
10029
+ var parsed = dayjs28(value);
10030
+ return parsed.isValid() ? parsed.unix() : void 0;
10031
+ };
10032
+ var transformAzureFile = function(file2) {
10033
+ var _toUnixSeconds;
10034
+ var createdAtUnix = (_toUnixSeconds = toUnixSeconds(file2.createdAt)) !== null && _toUnixSeconds !== void 0 ? _toUnixSeconds : dayjs28().unix();
10035
+ var expiresAtUnix = toUnixSeconds(file2.expiresAt);
10036
+ var _file2_bytes;
10037
+ var openaiFile = {
10038
+ id: file2.id,
10039
+ object: file2.object || "file",
10040
+ bytes: (_file2_bytes = file2.bytes) !== null && _file2_bytes !== void 0 ? _file2_bytes : 0,
10041
+ created_at: createdAtUnix,
10042
+ filename: file2.filename || "file",
10043
+ purpose: file2.purpose || "assistants",
10044
+ status: file2.status || "processed"
10045
+ };
10046
+ if (expiresAtUnix !== void 0) {
10047
+ openaiFile.expires_at = expiresAtUnix;
10048
+ }
10049
+ if (file2.statusDetails) {
10050
+ openaiFile.status_details = file2.statusDetails;
10051
+ }
10052
+ return openaiFile;
10053
+ };
10054
+ // src/adapters/storage/azureAgentsStorageAdapter/files/get.ts
10055
+ var file = function(param) {
10056
+ var azureAiProject = param.azureAiProject;
10057
+ return {
10058
+ get: function(url) {
10059
+ return _async_to_generator(function() {
10060
+ var pathname, match, _match, fileId, azureFile, openaiFile;
10061
+ return _ts_generator(this, function(_state) {
10062
+ switch(_state.label){
10063
+ case 0:
10064
+ pathname = new URL(url).pathname;
10065
+ match = pathname.match(new RegExp(fileRegexp));
10066
+ if (!match) {
10067
+ return [
10068
+ 2,
10069
+ new Response("Not Found", {
10070
+ status: 404
10071
+ })
10072
+ ];
10073
+ }
10074
+ _match = _sliced_to_array(match, 2), fileId = _match[1];
10075
+ return [
10076
+ 4,
10077
+ azureAiProject.agents.files.get(fileId)
10078
+ ];
10079
+ case 1:
10080
+ azureFile = _state.sent();
10081
+ openaiFile = transformAzureFile(azureFile);
10082
+ return [
10083
+ 2,
10084
+ new Response(JSON.stringify(openaiFile), {
10085
+ status: 200,
10086
+ headers: {
10087
+ "Content-Type": "application/json"
10088
+ }
10089
+ })
10090
+ ];
10091
+ }
10092
+ });
10093
+ })();
10094
+ }
10095
+ };
10096
+ };
10097
+ // src/adapters/storage/azureAgentsStorageAdapter/files/content.ts
10098
+ import { Readable } from "stream";
10099
+ var headersToRecord = function(headers) {
10100
+ if (!headers) return {};
10101
+ if (typeof headers.get === "function") {
10102
+ var result = {};
10103
+ for(var _i = 0, _iter = [
10104
+ "content-type",
10105
+ "content-length"
10106
+ ]; _i < _iter.length; _i++){
10107
+ var headerName = _iter[_i];
10108
+ var value = headers.get(headerName);
10109
+ if (value) {
10110
+ result[headerName] = value;
10111
+ }
10112
+ }
10113
+ return result;
10114
+ }
10115
+ var json = typeof headers.toJSON === "function" ? headers.toJSON() : headers;
10116
+ return (typeof json === "undefined" ? "undefined" : _type_of(json)) === "object" && json !== null ? json : {};
10117
+ };
10118
+ var toBody = function(nodeStream) {
10119
+ return _async_to_generator(function() {
10120
+ var chunks, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
10121
+ return _ts_generator(this, function(_state) {
10122
+ switch(_state.label){
10123
+ case 0:
10124
+ if (typeof Readable.toWeb === "function") {
10125
+ return [
10126
+ 2,
10127
+ Readable.toWeb(nodeStream)
10128
+ ];
10129
+ }
10130
+ chunks = [];
10131
+ _iteratorAbruptCompletion = false, _didIteratorError = false;
10132
+ _state.label = 1;
10133
+ case 1:
10134
+ _state.trys.push([
10135
+ 1,
10136
+ 6,
10137
+ 7,
10138
+ 12
10139
+ ]);
10140
+ _iterator = _async_iterator(nodeStream);
10141
+ _state.label = 2;
10142
+ case 2:
10143
+ return [
10144
+ 4,
10145
+ _iterator.next()
10146
+ ];
10147
+ case 3:
10148
+ if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
10149
+ 3,
10150
+ 5
10151
+ ];
10152
+ _value = _step.value;
10153
+ chunk = _value;
10154
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
10155
+ _state.label = 4;
10156
+ case 4:
10157
+ _iteratorAbruptCompletion = false;
10158
+ return [
10159
+ 3,
10160
+ 2
10161
+ ];
10162
+ case 5:
10163
+ return [
10164
+ 3,
10165
+ 12
10166
+ ];
10167
+ case 6:
10168
+ err = _state.sent();
10169
+ _didIteratorError = true;
10170
+ _iteratorError = err;
10171
+ return [
10172
+ 3,
10173
+ 12
10174
+ ];
10175
+ case 7:
10176
+ _state.trys.push([
10177
+ 7,
10178
+ ,
10179
+ 10,
10180
+ 11
10181
+ ]);
10182
+ if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
10183
+ 3,
10184
+ 9
10185
+ ];
10186
+ return [
10187
+ 4,
10188
+ _iterator.return()
10189
+ ];
10190
+ case 8:
10191
+ _state.sent();
10192
+ _state.label = 9;
10193
+ case 9:
10194
+ return [
10195
+ 3,
10196
+ 11
10197
+ ];
10198
+ case 10:
10199
+ if (_didIteratorError) {
10200
+ throw _iteratorError;
10201
+ }
10202
+ return [
10203
+ 7
10204
+ ];
10205
+ case 11:
10206
+ return [
10207
+ 7
10208
+ ];
10209
+ case 12:
10210
+ return [
10211
+ 2,
10212
+ Buffer.concat(chunks)
10213
+ ];
10214
+ }
10215
+ });
10216
+ })();
10217
+ };
10218
+ var fileContent = function(param) {
10219
+ var azureAiProject = param.azureAiProject;
10220
+ return {
10221
+ get: function(url) {
10222
+ return _async_to_generator(function() {
10223
+ var pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body, _nodeResponse_status;
10224
+ return _ts_generator(this, function(_state) {
10225
+ switch(_state.label){
10226
+ case 0:
10227
+ pathname = new URL(url).pathname;
10228
+ match = pathname.match(new RegExp(fileContentRegexp));
10229
+ if (!match) {
10230
+ return [
10231
+ 2,
10232
+ new Response("Not Found", {
10233
+ status: 404
10234
+ })
10235
+ ];
10236
+ }
10237
+ _match = _sliced_to_array(match, 2), fileId = _match[1];
10238
+ streamable = azureAiProject.agents.files.getContent(fileId);
10239
+ if (!streamable || typeof streamable.asNodeStream !== "function") {
10240
+ return [
10241
+ 2,
10242
+ new Response("File content unavailable", {
10243
+ status: 500
10244
+ })
10245
+ ];
10246
+ }
10247
+ return [
10248
+ 4,
10249
+ streamable.asNodeStream()
10250
+ ];
10251
+ case 1:
10252
+ nodeResponse = _state.sent();
10253
+ nodeStream = nodeResponse.body;
10254
+ if (!nodeStream) {
10255
+ return [
10256
+ 2,
10257
+ new Response("", {
10258
+ status: 204
10259
+ })
10260
+ ];
10261
+ }
10262
+ headerRecord = headersToRecord(nodeResponse.headers);
10263
+ headers = new Headers();
10264
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
10265
+ try {
10266
+ for(_iterator = Object.entries(headerRecord)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
10267
+ _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
10268
+ headers.set(key, value);
10269
+ }
10270
+ } catch (err) {
10271
+ _didIteratorError = true;
10272
+ _iteratorError = err;
10273
+ } finally{
10274
+ try {
10275
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
10276
+ _iterator.return();
10277
+ }
10278
+ } finally{
10279
+ if (_didIteratorError) {
10280
+ throw _iteratorError;
10281
+ }
10282
+ }
10283
+ }
10284
+ if (!headers.has("content-type")) {
10285
+ headers.set("Content-Type", "application/octet-stream");
10286
+ }
10287
+ return [
10288
+ 4,
10289
+ toBody(nodeStream)
10290
+ ];
10291
+ case 2:
10292
+ body = _state.sent();
10293
+ return [
10294
+ 2,
10295
+ new Response(body, {
10296
+ status: (_nodeResponse_status = nodeResponse.status) !== null && _nodeResponse_status !== void 0 ? _nodeResponse_status : 200,
10297
+ headers: headers
10298
+ })
10299
+ ];
10300
+ }
10301
+ });
10302
+ })();
10303
+ }
10304
+ };
10305
+ };
9961
10306
  // src/adapters/storage/azureAgentsStorageAdapter/index.ts
9962
10307
  var azureAgentsStorageAdapter = function(param) {
9963
- var azureAiProject = param.azureAiProject;
10308
+ var azureAiProject = param.azureAiProject, prisma = param.prisma;
9964
10309
  return function(param) {
9965
10310
  var runAdapter = param.runAdapter;
9966
10311
  var _obj;
@@ -9983,16 +10328,22 @@ var azureAgentsStorageAdapter = function(param) {
9983
10328
  runAdapter: runAdapter
9984
10329
  })), _define_property(_obj, stepsRegexp, steps3({
9985
10330
  azureAiProject: azureAiProject,
9986
- runAdapter: runAdapter
10331
+ runAdapter: runAdapter,
10332
+ prisma: prisma
9987
10333
  })), _define_property(_obj, submitToolOutputsRegexp, submitToolOutputs3({
9988
10334
  azureAiProject: azureAiProject,
9989
- runAdapter: runAdapter
10335
+ runAdapter: runAdapter,
10336
+ prisma: prisma
10337
+ })), _define_property(_obj, fileRegexp, file({
10338
+ azureAiProject: azureAiProject
10339
+ })), _define_property(_obj, fileContentRegexp, fileContent({
10340
+ azureAiProject: azureAiProject
9990
10341
  })), _obj)
9991
10342
  };
9992
10343
  };
9993
10344
  };
9994
10345
  // src/adapters/run/responsesRunAdapter/index.ts
9995
- import dayjs28 from "dayjs";
10346
+ import dayjs29 from "dayjs";
9996
10347
  import { uid as uid9 } from "radash";
9997
10348
  var serializeToolCalls2 = function(param) {
9998
10349
  var toolCalls = param.toolCalls;
@@ -10340,7 +10691,7 @@ var responsesRunAdapter = function(param) {
10340
10691
  4,
10341
10692
  onEvent2.apply(void 0, [
10342
10693
  (_tmp6.data = serializeItemAsMessage.apply(void 0, [
10343
- (_tmp7.openaiAssistant = _state.sent(), _tmp7.createdAt = dayjs28().unix(), _tmp7.runId = responseCreatedResponse.id, _tmp7.status = "in_progress", _tmp7)
10694
+ (_tmp7.openaiAssistant = _state.sent(), _tmp7.createdAt = dayjs29().unix(), _tmp7.runId = responseCreatedResponse.id, _tmp7.status = "in_progress", _tmp7)
10344
10695
  ]), _tmp6)
10345
10696
  ])
10346
10697
  ];
@@ -10437,7 +10788,7 @@ var responsesRunAdapter = function(param) {
10437
10788
  4,
10438
10789
  onEvent2.apply(void 0, [
10439
10790
  (_tmp12.data = serializeItemAsMessage.apply(void 0, [
10440
- (_tmp13.openaiAssistant = _state.sent(), _tmp13.createdAt = dayjs28().unix(), _tmp13.runId = responseCreatedResponse.id, _tmp13.status = "in_progress", _tmp13)
10791
+ (_tmp13.openaiAssistant = _state.sent(), _tmp13.createdAt = dayjs29().unix(), _tmp13.runId = responseCreatedResponse.id, _tmp13.status = "in_progress", _tmp13)
10441
10792
  ]), _tmp12)
10442
10793
  ])
10443
10794
  ];
@@ -10524,7 +10875,7 @@ var responsesRunAdapter = function(param) {
10524
10875
  4,
10525
10876
  onEvent2.apply(void 0, [
10526
10877
  (_tmp18.data = serializeItemAsMessage.apply(void 0, [
10527
- (_tmp19.openaiAssistant = _state.sent(), _tmp19.createdAt = dayjs28().unix(), _tmp19.runId = responseCreatedResponse.id, _tmp19.status = "in_progress", _tmp19)
10878
+ (_tmp19.openaiAssistant = _state.sent(), _tmp19.createdAt = dayjs29().unix(), _tmp19.runId = responseCreatedResponse.id, _tmp19.status = "in_progress", _tmp19)
10528
10879
  ]), _tmp18)
10529
10880
  ])
10530
10881
  ];
@@ -10610,7 +10961,7 @@ var responsesRunAdapter = function(param) {
10610
10961
  4,
10611
10962
  onEvent2.apply(void 0, [
10612
10963
  (_tmp24.data = serializeItemAsMessage.apply(void 0, [
10613
- (_tmp25.openaiAssistant = _state.sent(), _tmp25.createdAt = dayjs28().unix(), _tmp25.runId = responseCreatedResponse.id, _tmp25.status = "in_progress", _tmp25)
10964
+ (_tmp25.openaiAssistant = _state.sent(), _tmp25.createdAt = dayjs29().unix(), _tmp25.runId = responseCreatedResponse.id, _tmp25.status = "in_progress", _tmp25)
10614
10965
  ]), _tmp24)
10615
10966
  ])
10616
10967
  ];
@@ -10696,7 +11047,7 @@ var responsesRunAdapter = function(param) {
10696
11047
  4,
10697
11048
  onEvent2.apply(void 0, [
10698
11049
  (_tmp30.data = serializeItemAsMessage.apply(void 0, [
10699
- (_tmp31.openaiAssistant = _state.sent(), _tmp31.createdAt = dayjs28().unix(), _tmp31.runId = responseCreatedResponse.id, _tmp31.status = "in_progress", _tmp31)
11050
+ (_tmp31.openaiAssistant = _state.sent(), _tmp31.createdAt = dayjs29().unix(), _tmp31.runId = responseCreatedResponse.id, _tmp31.status = "in_progress", _tmp31)
10700
11051
  ]), _tmp30)
10701
11052
  ])
10702
11053
  ];
@@ -10782,7 +11133,7 @@ var responsesRunAdapter = function(param) {
10782
11133
  4,
10783
11134
  onEvent2.apply(void 0, [
10784
11135
  (_tmp36.data = serializeItemAsMessage.apply(void 0, [
10785
- (_tmp37.openaiAssistant = _state.sent(), _tmp37.createdAt = dayjs28().unix(), _tmp37.runId = responseCreatedResponse.id, _tmp37.status = "in_progress", _tmp37)
11136
+ (_tmp37.openaiAssistant = _state.sent(), _tmp37.createdAt = dayjs29().unix(), _tmp37.runId = responseCreatedResponse.id, _tmp37.status = "in_progress", _tmp37)
10786
11137
  ]), _tmp36)
10787
11138
  ])
10788
11139
  ];
@@ -10869,7 +11220,7 @@ var responsesRunAdapter = function(param) {
10869
11220
  4,
10870
11221
  onEvent2.apply(void 0, [
10871
11222
  (_tmp42.data = serializeItemAsMessage.apply(void 0, [
10872
- (_tmp43.openaiAssistant = _state.sent(), _tmp43.createdAt = dayjs28().unix(), _tmp43.runId = responseCreatedResponse.id, _tmp43.status = "in_progress", _tmp43)
11223
+ (_tmp43.openaiAssistant = _state.sent(), _tmp43.createdAt = dayjs29().unix(), _tmp43.runId = responseCreatedResponse.id, _tmp43.status = "in_progress", _tmp43)
10873
11224
  ]), _tmp42)
10874
11225
  ])
10875
11226
  ];
@@ -10956,7 +11307,7 @@ var responsesRunAdapter = function(param) {
10956
11307
  4,
10957
11308
  onEvent2.apply(void 0, [
10958
11309
  (_tmp48.data = serializeItemAsMessage.apply(void 0, [
10959
- (_tmp49.openaiAssistant = _state.sent(), _tmp49.createdAt = dayjs28().unix(), _tmp49.runId = responseCreatedResponse.id, _tmp49.status = "in_progress", _tmp49)
11310
+ (_tmp49.openaiAssistant = _state.sent(), _tmp49.createdAt = dayjs29().unix(), _tmp49.runId = responseCreatedResponse.id, _tmp49.status = "in_progress", _tmp49)
10960
11311
  ]), _tmp48)
10961
11312
  ])
10962
11313
  ];
@@ -11071,7 +11422,7 @@ var responsesRunAdapter = function(param) {
11071
11422
  4,
11072
11423
  onEvent2.apply(void 0, [
11073
11424
  (_tmp56.data = serializeItemAsMessage.apply(void 0, [
11074
- (_tmp57.openaiAssistant = _state.sent(), _tmp57.createdAt = dayjs28().unix(), _tmp57.runId = responseCreatedResponse.id, _tmp57)
11425
+ (_tmp57.openaiAssistant = _state.sent(), _tmp57.createdAt = dayjs29().unix(), _tmp57.runId = responseCreatedResponse.id, _tmp57)
11075
11426
  ]), _tmp56)
11076
11427
  ])
11077
11428
  ];
@@ -11193,7 +11544,7 @@ var responsesRunAdapter = function(param) {
11193
11544
  4,
11194
11545
  onEvent2.apply(void 0, [
11195
11546
  (_tmp64.data = serializeItemAsMessage.apply(void 0, [
11196
- (_tmp65.openaiAssistant = _state.sent(), _tmp65.createdAt = dayjs28().unix(), _tmp65.runId = responseCreatedResponse.id, _tmp65)
11547
+ (_tmp65.openaiAssistant = _state.sent(), _tmp65.createdAt = dayjs29().unix(), _tmp65.runId = responseCreatedResponse.id, _tmp65)
11197
11548
  ]), _tmp64)
11198
11549
  ])
11199
11550
  ];
@@ -11279,7 +11630,7 @@ var responsesRunAdapter = function(param) {
11279
11630
  4,
11280
11631
  onEvent2.apply(void 0, [
11281
11632
  (_tmp70.data = serializeItemAsMessage.apply(void 0, [
11282
- (_tmp71.openaiAssistant = _state.sent(), _tmp71.createdAt = dayjs28().unix(), _tmp71.runId = responseCreatedResponse.id, _tmp71)
11633
+ (_tmp71.openaiAssistant = _state.sent(), _tmp71.createdAt = dayjs29().unix(), _tmp71.runId = responseCreatedResponse.id, _tmp71)
11283
11634
  ]), _tmp70)
11284
11635
  ])
11285
11636
  ];
@@ -11365,7 +11716,7 @@ var responsesRunAdapter = function(param) {
11365
11716
  4,
11366
11717
  onEvent2.apply(void 0, [
11367
11718
  (_tmp76.data = serializeItemAsMessage.apply(void 0, [
11368
- (_tmp77.openaiAssistant = _state.sent(), _tmp77.createdAt = dayjs28().unix(), _tmp77.runId = responseCreatedResponse.id, _tmp77)
11719
+ (_tmp77.openaiAssistant = _state.sent(), _tmp77.createdAt = dayjs29().unix(), _tmp77.runId = responseCreatedResponse.id, _tmp77)
11369
11720
  ]), _tmp76)
11370
11721
  ])
11371
11722
  ];
@@ -11451,7 +11802,7 @@ var responsesRunAdapter = function(param) {
11451
11802
  4,
11452
11803
  onEvent2.apply(void 0, [
11453
11804
  (_tmp82.data = serializeItemAsMessage.apply(void 0, [
11454
- (_tmp83.openaiAssistant = _state.sent(), _tmp83.createdAt = dayjs28().unix(), _tmp83.runId = responseCreatedResponse.id, _tmp83)
11805
+ (_tmp83.openaiAssistant = _state.sent(), _tmp83.createdAt = dayjs29().unix(), _tmp83.runId = responseCreatedResponse.id, _tmp83)
11455
11806
  ]), _tmp82)
11456
11807
  ])
11457
11808
  ];
@@ -11537,7 +11888,7 @@ var responsesRunAdapter = function(param) {
11537
11888
  4,
11538
11889
  onEvent2.apply(void 0, [
11539
11890
  (_tmp88.data = serializeItemAsMessage.apply(void 0, [
11540
- (_tmp89.openaiAssistant = _state.sent(), _tmp89.createdAt = dayjs28().unix(), _tmp89.runId = responseCreatedResponse.id, _tmp89)
11891
+ (_tmp89.openaiAssistant = _state.sent(), _tmp89.createdAt = dayjs29().unix(), _tmp89.runId = responseCreatedResponse.id, _tmp89)
11541
11892
  ]), _tmp88)
11542
11893
  ])
11543
11894
  ];
@@ -11623,7 +11974,7 @@ var responsesRunAdapter = function(param) {
11623
11974
  4,
11624
11975
  onEvent2.apply(void 0, [
11625
11976
  (_tmp94.data = serializeItemAsMessage.apply(void 0, [
11626
- (_tmp95.openaiAssistant = _state.sent(), _tmp95.createdAt = dayjs28().unix(), _tmp95.runId = responseCreatedResponse.id, _tmp95)
11977
+ (_tmp95.openaiAssistant = _state.sent(), _tmp95.createdAt = dayjs29().unix(), _tmp95.runId = responseCreatedResponse.id, _tmp95)
11627
11978
  ]), _tmp94)
11628
11979
  ])
11629
11980
  ];
@@ -11720,7 +12071,7 @@ var responsesRunAdapter = function(param) {
11720
12071
  _tmp97 = {
11721
12072
  id: event.item_id,
11722
12073
  object: "thread.message",
11723
- created_at: dayjs28().unix(),
12074
+ created_at: dayjs29().unix(),
11724
12075
  thread_id: threadId,
11725
12076
  completed_at: null,
11726
12077
  incomplete_at: null,
@@ -11758,7 +12109,7 @@ var responsesRunAdapter = function(param) {
11758
12109
  _tmp99 = {
11759
12110
  id: event.item_id,
11760
12111
  object: "thread.message",
11761
- created_at: dayjs28().unix(),
12112
+ created_at: dayjs29().unix(),
11762
12113
  thread_id: threadId,
11763
12114
  completed_at: null,
11764
12115
  incomplete_at: null,
@@ -11946,7 +12297,7 @@ var responsesRunAdapter = function(param) {
11946
12297
  return [
11947
12298
  4,
11948
12299
  onEvent2.apply(void 0, [
11949
- (_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.status = "failed", _tmp102.failed_at = dayjs28().unix(), _tmp102.last_error = {
12300
+ (_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.status = "failed", _tmp102.failed_at = dayjs29().unix(), _tmp102.last_error = {
11950
12301
  code: "server_error",
11951
12302
  message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
11952
12303
  }, _tmp102), _tmp101)
@@ -12006,7 +12357,7 @@ var responsesRunAdapter = function(param) {
12006
12357
  };
12007
12358
  };
12008
12359
  // src/adapters/run/azureAgentsRunAdapter/index.ts
12009
- import dayjs29 from "dayjs";
12360
+ import dayjs30 from "dayjs";
12010
12361
  import { uid as uid10 } from "radash";
12011
12362
  function transformAnnotations(annotations) {
12012
12363
  return annotations.map(function(ann) {
@@ -12100,7 +12451,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12100
12451
  data: {
12101
12452
  id: data.id,
12102
12453
  object: "thread.run",
12103
- created_at: dayjs29(data.createdAt).unix(),
12454
+ created_at: dayjs30(data.createdAt).unix(),
12104
12455
  thread_id: data.threadId,
12105
12456
  assistant_id: assistantId,
12106
12457
  status: data.status,
@@ -12124,10 +12475,10 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12124
12475
  message: JSON.stringify(data.lastError)
12125
12476
  } : null,
12126
12477
  expires_at: null,
12127
- started_at: data.startedAt ? dayjs29(data.startedAt).unix() : null,
12128
- cancelled_at: data.cancelledAt ? dayjs29(data.cancelledAt).unix() : null,
12129
- failed_at: data.failedAt ? dayjs29(data.failedAt).unix() : null,
12130
- completed_at: data.completedAt ? dayjs29(data.completedAt).unix() : null,
12478
+ started_at: data.startedAt ? dayjs30(data.startedAt).unix() : null,
12479
+ cancelled_at: data.cancelledAt ? dayjs30(data.cancelledAt).unix() : null,
12480
+ failed_at: data.failedAt ? dayjs30(data.failedAt).unix() : null,
12481
+ completed_at: data.completedAt ? dayjs30(data.completedAt).unix() : null,
12131
12482
  incomplete_details: null,
12132
12483
  model: data.model || "",
12133
12484
  instructions: data.instructions || "",
@@ -12155,7 +12506,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12155
12506
  data: {
12156
12507
  id: data.id,
12157
12508
  object: "thread.message",
12158
- created_at: dayjs29(data.createdAt).unix(),
12509
+ created_at: dayjs30(data.createdAt).unix(),
12159
12510
  thread_id: data.threadId,
12160
12511
  role: data.role,
12161
12512
  content: ((_data_content = data.content) === null || _data_content === void 0 ? void 0 : _data_content.map(function(c) {
@@ -12166,7 +12517,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12166
12517
  attachments: data.attachments || [],
12167
12518
  metadata: data.metadata || {},
12168
12519
  status: data.status || "completed",
12169
- completed_at: data.completedAt ? dayjs29(data.completedAt).unix() : null,
12520
+ completed_at: data.completedAt ? dayjs30(data.completedAt).unix() : null,
12170
12521
  incomplete_at: null,
12171
12522
  incomplete_details: null
12172
12523
  }
@@ -12355,7 +12706,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12355
12706
  data: {
12356
12707
  id: data.id,
12357
12708
  object: "thread.run.step",
12358
- created_at: dayjs29(data.createdAt).unix(),
12709
+ created_at: dayjs30(data.createdAt).unix(),
12359
12710
  assistant_id: assistantId,
12360
12711
  thread_id: data.threadId,
12361
12712
  run_id: data.runId,
@@ -12364,9 +12715,9 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12364
12715
  step_details: stepDetails,
12365
12716
  last_error: data.lastError || null,
12366
12717
  expired_at: null,
12367
- cancelled_at: data.cancelledAt ? dayjs29(data.cancelledAt).unix() : null,
12368
- failed_at: data.failedAt ? dayjs29(data.failedAt).unix() : null,
12369
- completed_at: data.completedAt ? dayjs29(data.completedAt).unix() : null,
12718
+ cancelled_at: data.cancelledAt ? dayjs30(data.cancelledAt).unix() : null,
12719
+ failed_at: data.failedAt ? dayjs30(data.failedAt).unix() : null,
12720
+ completed_at: data.completedAt ? dayjs30(data.completedAt).unix() : null,
12370
12721
  metadata: data.metadata || {},
12371
12722
  usage: null
12372
12723
  }
@@ -12378,7 +12729,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12378
12729
  data: {
12379
12730
  id: data.id,
12380
12731
  object: "thread",
12381
- created_at: dayjs29(data.createdAt).unix(),
12732
+ created_at: dayjs30(data.createdAt).unix(),
12382
12733
  metadata: data.metadata || {},
12383
12734
  tool_resources: data.toolResources || null
12384
12735
  }
@@ -12519,7 +12870,7 @@ var azureAgentsRunAdapter = function(param) {
12519
12870
  data: {
12520
12871
  id: errorRunId,
12521
12872
  object: "thread.run",
12522
- created_at: dayjs29().unix(),
12873
+ created_at: dayjs30().unix(),
12523
12874
  thread_id: threadId,
12524
12875
  assistant_id: assistantId,
12525
12876
  status: "failed",
@@ -12529,9 +12880,9 @@ var azureAgentsRunAdapter = function(param) {
12529
12880
  message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
12530
12881
  },
12531
12882
  expires_at: null,
12532
- started_at: dayjs29().unix(),
12883
+ started_at: dayjs30().unix(),
12533
12884
  cancelled_at: null,
12534
- failed_at: dayjs29().unix(),
12885
+ failed_at: dayjs30().unix(),
12535
12886
  completed_at: null,
12536
12887
  incomplete_details: null,
12537
12888
  model: "",