supercompat 3.11.0 → 3.11.2

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
@@ -9226,15 +9226,51 @@ var get22 = function(param) {
9226
9226
  step_details: step.type === "tool_calls" ? {
9227
9227
  type: "tool_calls",
9228
9228
  tool_calls: step.stepDetails.toolCalls.map(function(tc) {
9229
- return {
9230
- id: tc.id,
9231
- type: "function",
9232
- function: {
9233
- name: tc.function.name,
9234
- arguments: tc.function.arguments,
9235
- output: tc.function.output || null
9236
- }
9237
- };
9229
+ if (tc.type === "code_interpreter") {
9230
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
9231
+ return {
9232
+ id: tc.id,
9233
+ type: "code_interpreter",
9234
+ code_interpreter: {
9235
+ input: ((_tc_codeInterpreter = tc.codeInterpreter) === null || _tc_codeInterpreter === void 0 ? void 0 : _tc_codeInterpreter.input) || "",
9236
+ outputs: ((_tc_codeInterpreter1 = tc.codeInterpreter) === null || _tc_codeInterpreter1 === void 0 ? void 0 : (_tc_codeInterpreter_outputs = _tc_codeInterpreter1.outputs) === null || _tc_codeInterpreter_outputs === void 0 ? void 0 : _tc_codeInterpreter_outputs.map(function(output) {
9237
+ if (output.type === "logs") {
9238
+ return {
9239
+ type: "logs",
9240
+ logs: output.logs || ""
9241
+ };
9242
+ }
9243
+ if (output.type === "image") {
9244
+ var _output_image;
9245
+ return {
9246
+ type: "image",
9247
+ image: {
9248
+ file_id: ((_output_image = output.image) === null || _output_image === void 0 ? void 0 : _output_image.fileId) || ""
9249
+ }
9250
+ };
9251
+ }
9252
+ return output;
9253
+ })) || []
9254
+ }
9255
+ };
9256
+ } else if (tc.type === "file_search") {
9257
+ return {
9258
+ id: tc.id,
9259
+ type: "file_search",
9260
+ file_search: tc.fileSearch || {}
9261
+ };
9262
+ } else if (tc.type === "function") {
9263
+ return {
9264
+ id: tc.id,
9265
+ type: "function",
9266
+ function: {
9267
+ name: tc.function.name,
9268
+ arguments: tc.function.arguments,
9269
+ output: tc.function.output || null
9270
+ }
9271
+ };
9272
+ }
9273
+ return tc;
9238
9274
  })
9239
9275
  } : {
9240
9276
  type: "message_creation",
@@ -11965,7 +12001,157 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
11965
12001
  }
11966
12002
  };
11967
12003
  }
12004
+ if (eventType === "thread.run.step.delta") {
12005
+ var _data_delta1;
12006
+ var stepDetailsDelta = {};
12007
+ if ((_data_delta1 = data.delta) === null || _data_delta1 === void 0 ? void 0 : _data_delta1.stepDetails) {
12008
+ var details = data.delta.stepDetails;
12009
+ if (details.type === "tool_calls") {
12010
+ var _details_toolCalls;
12011
+ stepDetailsDelta = {
12012
+ type: "tool_calls",
12013
+ tool_calls: ((_details_toolCalls = details.toolCalls) === null || _details_toolCalls === void 0 ? void 0 : _details_toolCalls.map(function(tc) {
12014
+ if (tc.type === "code_interpreter") {
12015
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12016
+ var _tc_index;
12017
+ return {
12018
+ index: (_tc_index = tc.index) !== null && _tc_index !== void 0 ? _tc_index : 0,
12019
+ id: tc.id,
12020
+ type: "code_interpreter",
12021
+ code_interpreter: {
12022
+ input: ((_tc_codeInterpreter = tc.codeInterpreter) === null || _tc_codeInterpreter === void 0 ? void 0 : _tc_codeInterpreter.input) || "",
12023
+ outputs: ((_tc_codeInterpreter1 = tc.codeInterpreter) === null || _tc_codeInterpreter1 === void 0 ? void 0 : (_tc_codeInterpreter_outputs = _tc_codeInterpreter1.outputs) === null || _tc_codeInterpreter_outputs === void 0 ? void 0 : _tc_codeInterpreter_outputs.map(function(output) {
12024
+ if (output.type === "logs") {
12025
+ var _output_index;
12026
+ return {
12027
+ index: (_output_index = output.index) !== null && _output_index !== void 0 ? _output_index : 0,
12028
+ type: "logs",
12029
+ logs: output.logs || ""
12030
+ };
12031
+ }
12032
+ if (output.type === "image") {
12033
+ var _output_image;
12034
+ var _output_index1;
12035
+ return {
12036
+ index: (_output_index1 = output.index) !== null && _output_index1 !== void 0 ? _output_index1 : 0,
12037
+ type: "image",
12038
+ image: {
12039
+ file_id: ((_output_image = output.image) === null || _output_image === void 0 ? void 0 : _output_image.fileId) || ""
12040
+ }
12041
+ };
12042
+ }
12043
+ return output;
12044
+ })) || []
12045
+ }
12046
+ };
12047
+ } else if (tc.type === "file_search") {
12048
+ var _tc_index1;
12049
+ return {
12050
+ index: (_tc_index1 = tc.index) !== null && _tc_index1 !== void 0 ? _tc_index1 : 0,
12051
+ id: tc.id,
12052
+ type: "file_search",
12053
+ file_search: tc.fileSearch || {}
12054
+ };
12055
+ } else if (tc.type === "function") {
12056
+ var _tc_function, _tc_function1, _tc_function2;
12057
+ var _tc_index2;
12058
+ return {
12059
+ index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
12060
+ id: tc.id,
12061
+ type: "function",
12062
+ function: {
12063
+ name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
12064
+ arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
12065
+ output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) || null
12066
+ }
12067
+ };
12068
+ }
12069
+ return tc;
12070
+ })) || []
12071
+ };
12072
+ } else {
12073
+ stepDetailsDelta = details;
12074
+ }
12075
+ }
12076
+ return {
12077
+ event: "thread.run.step.delta",
12078
+ data: {
12079
+ id: data.id,
12080
+ object: "thread.run.step.delta",
12081
+ delta: {
12082
+ step_details: stepDetailsDelta
12083
+ }
12084
+ }
12085
+ };
12086
+ }
11968
12087
  if (eventType.startsWith("thread.run.step.")) {
12088
+ var stepDetails = {};
12089
+ if (data.stepDetails) {
12090
+ if (data.stepDetails.type === "message_creation") {
12091
+ var _data_stepDetails_messageCreation;
12092
+ stepDetails = {
12093
+ type: "message_creation",
12094
+ message_creation: {
12095
+ message_id: ((_data_stepDetails_messageCreation = data.stepDetails.messageCreation) === null || _data_stepDetails_messageCreation === void 0 ? void 0 : _data_stepDetails_messageCreation.messageId) || ""
12096
+ }
12097
+ };
12098
+ } else if (data.stepDetails.type === "tool_calls") {
12099
+ var _data_stepDetails_toolCalls;
12100
+ stepDetails = {
12101
+ type: "tool_calls",
12102
+ tool_calls: ((_data_stepDetails_toolCalls = data.stepDetails.toolCalls) === null || _data_stepDetails_toolCalls === void 0 ? void 0 : _data_stepDetails_toolCalls.map(function(tc) {
12103
+ if (tc.type === "code_interpreter") {
12104
+ var _tc_codeInterpreter, _tc_codeInterpreter_outputs, _tc_codeInterpreter1;
12105
+ return {
12106
+ id: tc.id,
12107
+ type: "code_interpreter",
12108
+ code_interpreter: {
12109
+ input: ((_tc_codeInterpreter = tc.codeInterpreter) === null || _tc_codeInterpreter === void 0 ? void 0 : _tc_codeInterpreter.input) || "",
12110
+ outputs: ((_tc_codeInterpreter1 = tc.codeInterpreter) === null || _tc_codeInterpreter1 === void 0 ? void 0 : (_tc_codeInterpreter_outputs = _tc_codeInterpreter1.outputs) === null || _tc_codeInterpreter_outputs === void 0 ? void 0 : _tc_codeInterpreter_outputs.map(function(output) {
12111
+ if (output.type === "logs") {
12112
+ return {
12113
+ type: "logs",
12114
+ logs: output.logs || ""
12115
+ };
12116
+ }
12117
+ if (output.type === "image") {
12118
+ var _output_image;
12119
+ return {
12120
+ type: "image",
12121
+ image: {
12122
+ file_id: ((_output_image = output.image) === null || _output_image === void 0 ? void 0 : _output_image.fileId) || ""
12123
+ }
12124
+ };
12125
+ }
12126
+ return output;
12127
+ })) || []
12128
+ }
12129
+ };
12130
+ } else if (tc.type === "file_search") {
12131
+ return {
12132
+ id: tc.id,
12133
+ type: "file_search",
12134
+ file_search: tc.fileSearch || {}
12135
+ };
12136
+ } else if (tc.type === "function") {
12137
+ var _tc_function, _tc_function1, _tc_function2;
12138
+ return {
12139
+ id: tc.id,
12140
+ type: "function",
12141
+ function: {
12142
+ name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
12143
+ arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
12144
+ output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) || null
12145
+ }
12146
+ };
12147
+ }
12148
+ return tc;
12149
+ })) || []
12150
+ };
12151
+ } else {
12152
+ stepDetails = data.stepDetails;
12153
+ }
12154
+ }
11969
12155
  return {
11970
12156
  event: eventType,
11971
12157
  data: {
@@ -11977,7 +12163,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
11977
12163
  run_id: data.runId,
11978
12164
  type: data.type,
11979
12165
  status: data.status,
11980
- step_details: data.stepDetails || {},
12166
+ step_details: stepDetails,
11981
12167
  last_error: data.lastError || null,
11982
12168
  expired_at: null,
11983
12169
  cancelled_at: data.cancelledAt ? (0, import_dayjs29.default)(data.cancelledAt).unix() : null,