supercompat 3.5.1 → 3.6.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
@@ -7131,6 +7131,64 @@ var serializeItemAsComputerCallRunStep = function(param) {
7131
7131
  }
7132
7132
  });
7133
7133
  };
7134
+ // src/lib/items/serializeItemAsReasoningRunStep.ts
7135
+ var import_dayjs20 = __toESM(require("dayjs"), 1);
7136
+ var serializeStatus7 = function(param) {
7137
+ var item = param.item, completedAt = param.completedAt;
7138
+ if (!item.status) {
7139
+ if (completedAt) {
7140
+ return "completed";
7141
+ } else {
7142
+ return "in_progress";
7143
+ }
7144
+ }
7145
+ if (item.status === "incomplete") {
7146
+ return "in_progress";
7147
+ }
7148
+ return item.status;
7149
+ };
7150
+ var serializeItemAsReasoningRunStep = function(param) {
7151
+ var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs20.default)().unix() : _param_completedAt;
7152
+ var toolCall = {
7153
+ id: "ftc".concat(item.id),
7154
+ type: "function",
7155
+ function: {
7156
+ name: "reasoning",
7157
+ arguments: "{}",
7158
+ output: JSON.stringify({
7159
+ summary: item.summary,
7160
+ content: item.content,
7161
+ encrypted_content: item.encrypted_content
7162
+ })
7163
+ }
7164
+ };
7165
+ return {
7166
+ id: "fc".concat(item.id),
7167
+ object: "thread.run.step",
7168
+ created_at: (0, import_dayjs20.default)().unix(),
7169
+ assistant_id: openaiAssistant.id,
7170
+ thread_id: threadId,
7171
+ run_id: runId,
7172
+ status: serializeStatus7({
7173
+ item: item,
7174
+ completedAt: completedAt
7175
+ }),
7176
+ last_error: null,
7177
+ expired_at: null,
7178
+ cancelled_at: null,
7179
+ failed_at: null,
7180
+ completed_at: completedAt,
7181
+ metadata: {},
7182
+ usage: null,
7183
+ type: "tool_calls",
7184
+ step_details: {
7185
+ type: "tool_calls",
7186
+ tool_calls: [
7187
+ toolCall
7188
+ ]
7189
+ }
7190
+ };
7191
+ };
7134
7192
  // src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
7135
7193
  var get17 = function(param) {
7136
7194
  var client = param.client, runAdapter = param.runAdapter;
@@ -7214,6 +7272,16 @@ var get17 = function(param) {
7214
7272
  }),
7215
7273
  step
7216
7274
  ];
7275
+ } else if (item.type === "reasoning") {
7276
+ return [
7277
+ serializeItemAsReasoningRunStep({
7278
+ item: item,
7279
+ openaiAssistant: openaiAssistant,
7280
+ threadId: threadId,
7281
+ runId: response.id
7282
+ }),
7283
+ step
7284
+ ];
7217
7285
  } else if (item.type === "image_generation_call") {
7218
7286
  return [
7219
7287
  serializeItemAsImageGenerationRunStep({
@@ -7630,7 +7698,7 @@ var responsesStorageAdapter = function() {
7630
7698
  };
7631
7699
  };
7632
7700
  // src/adapters/run/responsesRunAdapter/index.ts
7633
- var import_dayjs20 = __toESM(require("dayjs"), 1);
7701
+ var import_dayjs21 = __toESM(require("dayjs"), 1);
7634
7702
  var import_radash22 = require("radash");
7635
7703
  var serializeToolCalls2 = function(param) {
7636
7704
  var toolCalls = param.toolCalls;
@@ -7657,7 +7725,9 @@ var serializeToolCalls2 = function(param) {
7657
7725
  });
7658
7726
  };
7659
7727
  var responsesRunAdapter = function(param) {
7660
- var getDirectOpenaiAssistant = param.getOpenaiAssistant;
7728
+ var getDirectOpenaiAssistant = param.getOpenaiAssistant, _param_waitUntil = param.waitUntil, waitUntil = _param_waitUntil === void 0 ? function(p) {
7729
+ return p.then(function() {});
7730
+ } : _param_waitUntil;
7661
7731
  var cachedOpenaiAssistant = null;
7662
7732
  var getOpenaiAssistant = /*#__PURE__*/ function() {
7663
7733
  var _ref = _async_to_generator(function() {
@@ -7714,7 +7784,7 @@ var responsesRunAdapter = function(param) {
7714
7784
  }();
7715
7785
  var handleRun = /*#__PURE__*/ function() {
7716
7786
  var _ref = _async_to_generator(function(param) {
7717
- var client, threadId, response, onEvent2, responseCreatedResponse, toolCalls, mcpCalls, codeInterpreterCalls, itemIds, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, event, _, _tmp, _tmp1, _tmp2, _tmp3, toolCalls2, _tmp4, _tmp5, _tmp6, _tmp7, _tmp8, _tmp9, _tmp10, _tmp11, _tmp12, _tmp13, _tmp14, _tmp15, _tmp16, _tmp17, _tmp18, _tmp19, _tmp20, _tmp21, _tmp22, _tmp23, _tmp24, _tmp25, _tmp26, _tmp27, _tmp28, _tmp29, _tmp30, _tmp31, _tmp32, _tmp33, _tmp34, _tmp35, _tmp36, _tmp37, _tmp38, _tmp39, _tmp40, _tmp41, _tmp42, _tmp43, _tmp44, _tmp45, _tmp46, _tmp47, _tmp48, _tmp49, _tmp50, _tmp51, _tmp52, _tmp53, _tmp54, _tmp55, _tmp56, _tmp57, _tmp58, _tmp59, _tmp60, _tmp61, _tmp62, _tmp63, _tmp64, _tmp65, _tmp66, _tmp67, _tmp68, _tmp69, _tmp70, _tmp71, _tmp72, _tmp73, _tmp74, _tmp75, _tmp76, _tmp77, _tmp78, _tmp79, _tmp80, _tmp81, _tmp82, _tmp83, _tmp84, _tmp85, _tmp86, _tmp87, _tmp88, toolCall, mcpCall, _tmp89, _tmp90, _tmp91, _tmp92, err, e, _tmp93, _tmp94;
7787
+ var client, threadId, response, onEvent2, responseCreatedResponse, toolCalls, mcpCalls, codeInterpreterCalls, itemIds, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, event, _, _tmp, _tmp1, _tmp2, _tmp3, toolCalls2, _tmp4, _tmp5, _tmp6, _tmp7, _tmp8, _tmp9, _tmp10, _tmp11, _tmp12, _tmp13, _tmp14, _tmp15, _tmp16, _tmp17, _tmp18, _tmp19, _tmp20, _tmp21, _tmp22, _tmp23, _tmp24, _tmp25, _tmp26, _tmp27, _tmp28, _tmp29, _tmp30, _tmp31, _tmp32, _tmp33, _tmp34, _tmp35, _tmp36, _tmp37, _tmp38, _tmp39, _tmp40, _tmp41, _tmp42, _tmp43, _tmp44, _tmp45, _tmp46, _tmp47, _tmp48, _tmp49, _tmp50, _tmp51, _tmp52, _tmp53, _tmp54, _tmp55, _tmp56, _tmp57, _tmp58, _tmp59, _tmp60, _tmp61, _tmp62, _tmp63, _tmp64, _tmp65, _tmp66, _tmp67, _tmp68, _tmp69, _tmp70, _tmp71, _tmp72, _tmp73, _tmp74, _tmp75, _tmp76, _tmp77, _tmp78, _tmp79, _tmp80, _tmp81, _tmp82, _tmp83, _tmp84, _tmp85, _tmp86, _tmp87, _tmp88, _tmp89, _tmp90, _tmp91, _tmp92, _tmp93, _tmp94, _tmp95, _tmp96, _tmp97, _tmp98, _tmp99, _tmp100, toolCall, mcpCall, _tmp101, _tmp102, _tmp103, _tmp104, err, e, _tmp105, _tmp106;
7718
7788
  return _ts_generator(this, function(_state) {
7719
7789
  switch(_state.label){
7720
7790
  case 0:
@@ -7728,18 +7798,18 @@ var responsesRunAdapter = function(param) {
7728
7798
  case 1:
7729
7799
  _state.trys.push([
7730
7800
  1,
7731
- 138,
7732
- 141,
7733
- 144
7801
+ 152,
7802
+ 155,
7803
+ 156
7734
7804
  ]);
7735
7805
  _iteratorAbruptCompletion = false, _didIteratorError = false;
7736
7806
  _state.label = 2;
7737
7807
  case 2:
7738
7808
  _state.trys.push([
7739
7809
  2,
7740
- 131,
7741
- 132,
7742
- 137
7810
+ 145,
7811
+ 146,
7812
+ 151
7743
7813
  ]);
7744
7814
  _iterator = _async_iterator(response);
7745
7815
  _state.label = 3;
@@ -7751,7 +7821,7 @@ var responsesRunAdapter = function(param) {
7751
7821
  case 4:
7752
7822
  if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
7753
7823
  3,
7754
- 130
7824
+ 144
7755
7825
  ];
7756
7826
  _value = _step.value;
7757
7827
  event = _value;
@@ -7790,37 +7860,37 @@ var responsesRunAdapter = function(param) {
7790
7860
  case "response.output_item.done":
7791
7861
  return [
7792
7862
  3,
7793
- 74
7863
+ 81
7794
7864
  ];
7795
7865
  case "response.function_call_arguments.delta":
7796
7866
  return [
7797
7867
  3,
7798
- 118
7868
+ 132
7799
7869
  ];
7800
7870
  case "response.mcp_call_arguments.delta":
7801
7871
  return [
7802
7872
  3,
7803
- 120
7873
+ 134
7804
7874
  ];
7805
7875
  case "response.image_generation_call.in_progress":
7806
7876
  return [
7807
7877
  3,
7808
- 122
7878
+ 136
7809
7879
  ];
7810
7880
  case "response.image_generation_call.generating":
7811
7881
  return [
7812
7882
  3,
7813
- 122
7883
+ 136
7814
7884
  ];
7815
7885
  case "response.image_generation_call.partial_image":
7816
7886
  return [
7817
7887
  3,
7818
- 125
7888
+ 139
7819
7889
  ];
7820
7890
  }
7821
7891
  return [
7822
7892
  3,
7823
- 128
7893
+ 142
7824
7894
  ];
7825
7895
  case 5:
7826
7896
  responseCreatedResponse = event.response;
@@ -7851,7 +7921,7 @@ var responsesRunAdapter = function(param) {
7851
7921
  _state.sent();
7852
7922
  return [
7853
7923
  3,
7854
- 129
7924
+ 143
7855
7925
  ];
7856
7926
  case 8:
7857
7927
  _tmp2 = {
@@ -7881,7 +7951,7 @@ var responsesRunAdapter = function(param) {
7881
7951
  _state.sent();
7882
7952
  return [
7883
7953
  3,
7884
- 129
7954
+ 143
7885
7955
  ];
7886
7956
  case 11:
7887
7957
  itemIds = event.response.output.filter(function(o) {
@@ -7971,7 +8041,7 @@ var responsesRunAdapter = function(param) {
7971
8041
  case 17:
7972
8042
  return [
7973
8043
  3,
7974
- 129
8044
+ 143
7975
8045
  ];
7976
8046
  case 18:
7977
8047
  _tmp9 = {
@@ -8001,7 +8071,7 @@ var responsesRunAdapter = function(param) {
8001
8071
  _state.sent();
8002
8072
  return [
8003
8073
  3,
8004
- 129
8074
+ 143
8005
8075
  ];
8006
8076
  case 21:
8007
8077
  return [
@@ -8028,7 +8098,7 @@ var responsesRunAdapter = function(param) {
8028
8098
  _state.sent();
8029
8099
  return [
8030
8100
  3,
8031
- 129
8101
+ 143
8032
8102
  ];
8033
8103
  case 23:
8034
8104
  if (!(event.item.type === "message")) return [
@@ -8055,7 +8125,7 @@ var responsesRunAdapter = function(param) {
8055
8125
  4,
8056
8126
  onEvent2.apply(void 0, [
8057
8127
  (_tmp11.data = serializeItemAsMessage.apply(void 0, [
8058
- (_tmp12.openaiAssistant = _state.sent(), _tmp12.createdAt = (0, import_dayjs20.default)().unix(), _tmp12.runId = responseCreatedResponse.id, _tmp12.status = "in_progress", _tmp12)
8128
+ (_tmp12.openaiAssistant = _state.sent(), _tmp12.createdAt = (0, import_dayjs21.default)().unix(), _tmp12.runId = responseCreatedResponse.id, _tmp12.status = "in_progress", _tmp12)
8059
8129
  ]), _tmp11)
8060
8130
  ])
8061
8131
  ];
@@ -8089,7 +8159,7 @@ var responsesRunAdapter = function(param) {
8089
8159
  _state.sent();
8090
8160
  return [
8091
8161
  3,
8092
- 73
8162
+ 80
8093
8163
  ];
8094
8164
  case 28:
8095
8165
  if (!(event.item.type === "function_call")) return [
@@ -8125,7 +8195,7 @@ var responsesRunAdapter = function(param) {
8125
8195
  _state.sent();
8126
8196
  return [
8127
8197
  3,
8128
- 73
8198
+ 80
8129
8199
  ];
8130
8200
  case 31:
8131
8201
  if (!(event.item.type === "computer_call")) return [
@@ -8152,7 +8222,7 @@ var responsesRunAdapter = function(param) {
8152
8222
  4,
8153
8223
  onEvent2.apply(void 0, [
8154
8224
  (_tmp17.data = serializeItemAsMessage.apply(void 0, [
8155
- (_tmp18.openaiAssistant = _state.sent(), _tmp18.createdAt = (0, import_dayjs20.default)().unix(), _tmp18.runId = responseCreatedResponse.id, _tmp18.status = "in_progress", _tmp18)
8225
+ (_tmp18.openaiAssistant = _state.sent(), _tmp18.createdAt = (0, import_dayjs21.default)().unix(), _tmp18.runId = responseCreatedResponse.id, _tmp18.status = "in_progress", _tmp18)
8156
8226
  ]), _tmp17)
8157
8227
  ])
8158
8228
  ];
@@ -8212,7 +8282,7 @@ var responsesRunAdapter = function(param) {
8212
8282
  _state.sent();
8213
8283
  return [
8214
8284
  3,
8215
- 73
8285
+ 80
8216
8286
  ];
8217
8287
  case 38:
8218
8288
  if (!(event.item.type === "image_generation_call")) return [
@@ -8239,7 +8309,7 @@ var responsesRunAdapter = function(param) {
8239
8309
  4,
8240
8310
  onEvent2.apply(void 0, [
8241
8311
  (_tmp23.data = serializeItemAsMessage.apply(void 0, [
8242
- (_tmp24.openaiAssistant = _state.sent(), _tmp24.createdAt = (0, import_dayjs20.default)().unix(), _tmp24.runId = responseCreatedResponse.id, _tmp24.status = "in_progress", _tmp24)
8312
+ (_tmp24.openaiAssistant = _state.sent(), _tmp24.createdAt = (0, import_dayjs21.default)().unix(), _tmp24.runId = responseCreatedResponse.id, _tmp24.status = "in_progress", _tmp24)
8243
8313
  ]), _tmp23)
8244
8314
  ])
8245
8315
  ];
@@ -8298,10 +8368,10 @@ var responsesRunAdapter = function(param) {
8298
8368
  _state.sent();
8299
8369
  return [
8300
8370
  3,
8301
- 73
8371
+ 80
8302
8372
  ];
8303
8373
  case 45:
8304
- if (!(event.item.type === "web_search_call")) return [
8374
+ if (!(event.item.type === "reasoning")) return [
8305
8375
  3,
8306
8376
  52
8307
8377
  ];
@@ -8325,7 +8395,7 @@ var responsesRunAdapter = function(param) {
8325
8395
  4,
8326
8396
  onEvent2.apply(void 0, [
8327
8397
  (_tmp29.data = serializeItemAsMessage.apply(void 0, [
8328
- (_tmp30.openaiAssistant = _state.sent(), _tmp30.createdAt = (0, import_dayjs20.default)().unix(), _tmp30.runId = responseCreatedResponse.id, _tmp30.status = "in_progress", _tmp30)
8398
+ (_tmp30.openaiAssistant = _state.sent(), _tmp30.createdAt = (0, import_dayjs21.default)().unix(), _tmp30.runId = responseCreatedResponse.id, _tmp30.status = "in_progress", _tmp30)
8329
8399
  ]), _tmp29)
8330
8400
  ])
8331
8401
  ];
@@ -8375,7 +8445,7 @@ var responsesRunAdapter = function(param) {
8375
8445
  return [
8376
8446
  4,
8377
8447
  onEvent2.apply(void 0, [
8378
- (_tmp33.data = serializeItemAsWebSearchRunStep.apply(void 0, [
8448
+ (_tmp33.data = serializeItemAsReasoningRunStep.apply(void 0, [
8379
8449
  (_tmp34.openaiAssistant = _state.sent(), _tmp34.threadId = threadId, _tmp34.runId = responseCreatedResponse.id, _tmp34.completedAt = null, _tmp34)
8380
8450
  ]), _tmp33)
8381
8451
  ])
@@ -8384,10 +8454,10 @@ var responsesRunAdapter = function(param) {
8384
8454
  _state.sent();
8385
8455
  return [
8386
8456
  3,
8387
- 73
8457
+ 80
8388
8458
  ];
8389
8459
  case 52:
8390
- if (!(event.item.type === "mcp_list_tools")) return [
8460
+ if (!(event.item.type === "web_search_call")) return [
8391
8461
  3,
8392
8462
  59
8393
8463
  ];
@@ -8411,7 +8481,7 @@ var responsesRunAdapter = function(param) {
8411
8481
  4,
8412
8482
  onEvent2.apply(void 0, [
8413
8483
  (_tmp35.data = serializeItemAsMessage.apply(void 0, [
8414
- (_tmp36.openaiAssistant = _state.sent(), _tmp36.createdAt = (0, import_dayjs20.default)().unix(), _tmp36.runId = responseCreatedResponse.id, _tmp36.status = "in_progress", _tmp36)
8484
+ (_tmp36.openaiAssistant = _state.sent(), _tmp36.createdAt = (0, import_dayjs21.default)().unix(), _tmp36.runId = responseCreatedResponse.id, _tmp36.status = "in_progress", _tmp36)
8415
8485
  ]), _tmp35)
8416
8486
  ])
8417
8487
  ];
@@ -8461,7 +8531,7 @@ var responsesRunAdapter = function(param) {
8461
8531
  return [
8462
8532
  4,
8463
8533
  onEvent2.apply(void 0, [
8464
- (_tmp39.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
8534
+ (_tmp39.data = serializeItemAsWebSearchRunStep.apply(void 0, [
8465
8535
  (_tmp40.openaiAssistant = _state.sent(), _tmp40.threadId = threadId, _tmp40.runId = responseCreatedResponse.id, _tmp40.completedAt = null, _tmp40)
8466
8536
  ]), _tmp39)
8467
8537
  ])
@@ -8470,14 +8540,13 @@ var responsesRunAdapter = function(param) {
8470
8540
  _state.sent();
8471
8541
  return [
8472
8542
  3,
8473
- 73
8543
+ 80
8474
8544
  ];
8475
8545
  case 59:
8476
- if (!(event.item.type === "mcp_call")) return [
8546
+ if (!(event.item.type === "mcp_list_tools")) return [
8477
8547
  3,
8478
8548
  66
8479
8549
  ];
8480
- mcpCalls[event.item.id] = event.item;
8481
8550
  _tmp41 = {
8482
8551
  event: "thread.message.created"
8483
8552
  };
@@ -8498,7 +8567,7 @@ var responsesRunAdapter = function(param) {
8498
8567
  4,
8499
8568
  onEvent2.apply(void 0, [
8500
8569
  (_tmp41.data = serializeItemAsMessage.apply(void 0, [
8501
- (_tmp42.openaiAssistant = _state.sent(), _tmp42.createdAt = (0, import_dayjs20.default)().unix(), _tmp42.runId = responseCreatedResponse.id, _tmp42.status = "in_progress", _tmp42)
8570
+ (_tmp42.openaiAssistant = _state.sent(), _tmp42.createdAt = (0, import_dayjs21.default)().unix(), _tmp42.runId = responseCreatedResponse.id, _tmp42.status = "in_progress", _tmp42)
8502
8571
  ]), _tmp41)
8503
8572
  ])
8504
8573
  ];
@@ -8548,7 +8617,7 @@ var responsesRunAdapter = function(param) {
8548
8617
  return [
8549
8618
  4,
8550
8619
  onEvent2.apply(void 0, [
8551
- (_tmp45.data = serializeItemAsMcpCallRunStep.apply(void 0, [
8620
+ (_tmp45.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
8552
8621
  (_tmp46.openaiAssistant = _state.sent(), _tmp46.threadId = threadId, _tmp46.runId = responseCreatedResponse.id, _tmp46.completedAt = null, _tmp46)
8553
8622
  ]), _tmp45)
8554
8623
  ])
@@ -8557,14 +8626,14 @@ var responsesRunAdapter = function(param) {
8557
8626
  _state.sent();
8558
8627
  return [
8559
8628
  3,
8560
- 73
8629
+ 80
8561
8630
  ];
8562
8631
  case 66:
8563
- if (!(event.item.type === "code_interpreter_call")) return [
8632
+ if (!(event.item.type === "mcp_call")) return [
8564
8633
  3,
8565
8634
  73
8566
8635
  ];
8567
- codeInterpreterCalls[event.item.id] = event.item;
8636
+ mcpCalls[event.item.id] = event.item;
8568
8637
  _tmp47 = {
8569
8638
  event: "thread.message.created"
8570
8639
  };
@@ -8585,7 +8654,7 @@ var responsesRunAdapter = function(param) {
8585
8654
  4,
8586
8655
  onEvent2.apply(void 0, [
8587
8656
  (_tmp47.data = serializeItemAsMessage.apply(void 0, [
8588
- (_tmp48.openaiAssistant = _state.sent(), _tmp48.createdAt = (0, import_dayjs20.default)().unix(), _tmp48.runId = responseCreatedResponse.id, _tmp48.status = "in_progress", _tmp48)
8657
+ (_tmp48.openaiAssistant = _state.sent(), _tmp48.createdAt = (0, import_dayjs21.default)().unix(), _tmp48.runId = responseCreatedResponse.id, _tmp48.status = "in_progress", _tmp48)
8589
8658
  ]), _tmp47)
8590
8659
  ])
8591
8660
  ];
@@ -8635,27 +8704,25 @@ var responsesRunAdapter = function(param) {
8635
8704
  return [
8636
8705
  4,
8637
8706
  onEvent2.apply(void 0, [
8638
- (_tmp51.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
8707
+ (_tmp51.data = serializeItemAsMcpCallRunStep.apply(void 0, [
8639
8708
  (_tmp52.openaiAssistant = _state.sent(), _tmp52.threadId = threadId, _tmp52.runId = responseCreatedResponse.id, _tmp52.completedAt = null, _tmp52)
8640
8709
  ]), _tmp51)
8641
8710
  ])
8642
8711
  ];
8643
8712
  case 72:
8644
8713
  _state.sent();
8645
- _state.label = 73;
8646
- case 73:
8647
- if (event.item.id) itemIds.push(event.item.id);
8648
8714
  return [
8649
8715
  3,
8650
- 129
8716
+ 80
8651
8717
  ];
8652
- case 74:
8653
- if (!(event.item.type === "message")) return [
8718
+ case 73:
8719
+ if (!(event.item.type === "code_interpreter_call")) return [
8654
8720
  3,
8655
- 79
8721
+ 80
8656
8722
  ];
8723
+ codeInterpreterCalls[event.item.id] = event.item;
8657
8724
  _tmp53 = {
8658
- event: "thread.run.step.completed"
8725
+ event: "thread.message.created"
8659
8726
  };
8660
8727
  _tmp54 = {
8661
8728
  item: event.item,
@@ -8669,19 +8736,19 @@ var responsesRunAdapter = function(param) {
8669
8736
  }
8670
8737
  })
8671
8738
  ];
8672
- case 75:
8739
+ case 74:
8673
8740
  return [
8674
8741
  4,
8675
8742
  onEvent2.apply(void 0, [
8676
- (_tmp53.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8677
- (_tmp54.openaiAssistant = _state.sent(), _tmp54.runId = responseCreatedResponse.id, _tmp54)
8743
+ (_tmp53.data = serializeItemAsMessage.apply(void 0, [
8744
+ (_tmp54.openaiAssistant = _state.sent(), _tmp54.createdAt = (0, import_dayjs21.default)().unix(), _tmp54.runId = responseCreatedResponse.id, _tmp54.status = "in_progress", _tmp54)
8678
8745
  ]), _tmp53)
8679
8746
  ])
8680
8747
  ];
8681
- case 76:
8748
+ case 75:
8682
8749
  _state.sent();
8683
8750
  _tmp55 = {
8684
- event: "thread.message.completed"
8751
+ event: "thread.run.step.created"
8685
8752
  };
8686
8753
  _tmp56 = {
8687
8754
  item: event.item,
@@ -8695,33 +8762,22 @@ var responsesRunAdapter = function(param) {
8695
8762
  }
8696
8763
  })
8697
8764
  ];
8698
- case 77:
8765
+ case 76:
8699
8766
  return [
8700
8767
  4,
8701
8768
  onEvent2.apply(void 0, [
8702
- (_tmp55.data = serializeItemAsMessage.apply(void 0, [
8703
- (_tmp56.openaiAssistant = _state.sent(), _tmp56.createdAt = (0, import_dayjs20.default)().unix(), _tmp56.runId = responseCreatedResponse.id, _tmp56)
8769
+ (_tmp55.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8770
+ (_tmp56.openaiAssistant = _state.sent(), _tmp56.runId = responseCreatedResponse.id, _tmp56.status = "in_progress", _tmp56.completedAt = null, _tmp56)
8704
8771
  ]), _tmp55)
8705
8772
  ])
8706
8773
  ];
8707
- case 78:
8774
+ case 77:
8708
8775
  _state.sent();
8709
- return [
8710
- 3,
8711
- 117
8712
- ];
8713
- case 79:
8714
- if (!(event.item.type === "function_call")) return [
8715
- 3,
8716
- 82
8717
- ];
8718
- toolCalls[event.item.id] = event.item;
8719
8776
  _tmp57 = {
8720
- event: "thread.run.step.in_progress"
8777
+ event: "thread.run.step.created"
8721
8778
  };
8722
8779
  _tmp58 = {
8723
- item: event.item,
8724
- threadId: threadId
8780
+ item: event.item
8725
8781
  };
8726
8782
  return [
8727
8783
  4,
@@ -8731,31 +8787,35 @@ var responsesRunAdapter = function(param) {
8731
8787
  }
8732
8788
  })
8733
8789
  ];
8734
- case 80:
8790
+ case 78:
8735
8791
  return [
8736
8792
  4,
8737
8793
  onEvent2.apply(void 0, [
8738
- (_tmp57.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8739
- (_tmp58.openaiAssistant = _state.sent(), _tmp58.runId = responseCreatedResponse.id, _tmp58)
8794
+ (_tmp57.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
8795
+ (_tmp58.openaiAssistant = _state.sent(), _tmp58.threadId = threadId, _tmp58.runId = responseCreatedResponse.id, _tmp58.completedAt = null, _tmp58)
8740
8796
  ]), _tmp57)
8741
8797
  ])
8742
8798
  ];
8743
- case 81:
8799
+ case 79:
8744
8800
  _state.sent();
8801
+ _state.label = 80;
8802
+ case 80:
8803
+ if (event.item.id) itemIds.push(event.item.id);
8745
8804
  return [
8746
8805
  3,
8747
- 117
8806
+ 143
8748
8807
  ];
8749
- case 82:
8750
- if (!(event.item.type === "image_generation_call")) return [
8808
+ case 81:
8809
+ if (!(event.item.type === "message")) return [
8751
8810
  3,
8752
- 89
8811
+ 86
8753
8812
  ];
8754
8813
  _tmp59 = {
8755
8814
  event: "thread.run.step.completed"
8756
8815
  };
8757
8816
  _tmp60 = {
8758
- item: event.item
8817
+ item: event.item,
8818
+ threadId: threadId
8759
8819
  };
8760
8820
  return [
8761
8821
  4,
@@ -8765,19 +8825,19 @@ var responsesRunAdapter = function(param) {
8765
8825
  }
8766
8826
  })
8767
8827
  ];
8768
- case 83:
8828
+ case 82:
8769
8829
  return [
8770
8830
  4,
8771
8831
  onEvent2.apply(void 0, [
8772
- (_tmp59.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
8773
- (_tmp60.openaiAssistant = _state.sent(), _tmp60.threadId = threadId, _tmp60.runId = responseCreatedResponse.id, _tmp60)
8832
+ (_tmp59.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8833
+ (_tmp60.openaiAssistant = _state.sent(), _tmp60.runId = responseCreatedResponse.id, _tmp60)
8774
8834
  ]), _tmp59)
8775
8835
  ])
8776
8836
  ];
8777
- case 84:
8837
+ case 83:
8778
8838
  _state.sent();
8779
8839
  _tmp61 = {
8780
- event: "thread.run.step.completed"
8840
+ event: "thread.message.completed"
8781
8841
  };
8782
8842
  _tmp62 = {
8783
8843
  item: event.item,
@@ -8791,19 +8851,29 @@ var responsesRunAdapter = function(param) {
8791
8851
  }
8792
8852
  })
8793
8853
  ];
8794
- case 85:
8854
+ case 84:
8795
8855
  return [
8796
8856
  4,
8797
8857
  onEvent2.apply(void 0, [
8798
- (_tmp61.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8799
- (_tmp62.openaiAssistant = _state.sent(), _tmp62.runId = responseCreatedResponse.id, _tmp62)
8858
+ (_tmp61.data = serializeItemAsMessage.apply(void 0, [
8859
+ (_tmp62.openaiAssistant = _state.sent(), _tmp62.createdAt = (0, import_dayjs21.default)().unix(), _tmp62.runId = responseCreatedResponse.id, _tmp62)
8800
8860
  ]), _tmp61)
8801
8861
  ])
8802
8862
  ];
8803
- case 86:
8863
+ case 85:
8804
8864
  _state.sent();
8865
+ return [
8866
+ 3,
8867
+ 131
8868
+ ];
8869
+ case 86:
8870
+ if (!(event.item.type === "function_call")) return [
8871
+ 3,
8872
+ 89
8873
+ ];
8874
+ toolCalls[event.item.id] = event.item;
8805
8875
  _tmp63 = {
8806
- event: "thread.message.completed"
8876
+ event: "thread.run.step.in_progress"
8807
8877
  };
8808
8878
  _tmp64 = {
8809
8879
  item: event.item,
@@ -8821,8 +8891,8 @@ var responsesRunAdapter = function(param) {
8821
8891
  return [
8822
8892
  4,
8823
8893
  onEvent2.apply(void 0, [
8824
- (_tmp63.data = serializeItemAsMessage.apply(void 0, [
8825
- (_tmp64.openaiAssistant = _state.sent(), _tmp64.createdAt = (0, import_dayjs20.default)().unix(), _tmp64.runId = responseCreatedResponse.id, _tmp64)
8894
+ (_tmp63.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8895
+ (_tmp64.openaiAssistant = _state.sent(), _tmp64.runId = responseCreatedResponse.id, _tmp64)
8826
8896
  ]), _tmp63)
8827
8897
  ])
8828
8898
  ];
@@ -8830,10 +8900,10 @@ var responsesRunAdapter = function(param) {
8830
8900
  _state.sent();
8831
8901
  return [
8832
8902
  3,
8833
- 117
8903
+ 131
8834
8904
  ];
8835
8905
  case 89:
8836
- if (!(event.item.type === "web_search_call")) return [
8906
+ if (!(event.item.type === "image_generation_call")) return [
8837
8907
  3,
8838
8908
  96
8839
8909
  ];
@@ -8855,7 +8925,7 @@ var responsesRunAdapter = function(param) {
8855
8925
  return [
8856
8926
  4,
8857
8927
  onEvent2.apply(void 0, [
8858
- (_tmp65.data = serializeItemAsWebSearchRunStep.apply(void 0, [
8928
+ (_tmp65.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
8859
8929
  (_tmp66.openaiAssistant = _state.sent(), _tmp66.threadId = threadId, _tmp66.runId = responseCreatedResponse.id, _tmp66)
8860
8930
  ]), _tmp65)
8861
8931
  ])
@@ -8908,7 +8978,7 @@ var responsesRunAdapter = function(param) {
8908
8978
  4,
8909
8979
  onEvent2.apply(void 0, [
8910
8980
  (_tmp69.data = serializeItemAsMessage.apply(void 0, [
8911
- (_tmp70.openaiAssistant = _state.sent(), _tmp70.createdAt = (0, import_dayjs20.default)().unix(), _tmp70.runId = responseCreatedResponse.id, _tmp70)
8981
+ (_tmp70.openaiAssistant = _state.sent(), _tmp70.createdAt = (0, import_dayjs21.default)().unix(), _tmp70.runId = responseCreatedResponse.id, _tmp70)
8912
8982
  ]), _tmp69)
8913
8983
  ])
8914
8984
  ];
@@ -8916,10 +8986,10 @@ var responsesRunAdapter = function(param) {
8916
8986
  _state.sent();
8917
8987
  return [
8918
8988
  3,
8919
- 117
8989
+ 131
8920
8990
  ];
8921
8991
  case 96:
8922
- if (!(event.item.type === "mcp_list_tools")) return [
8992
+ if (!(event.item.type === "reasoning")) return [
8923
8993
  3,
8924
8994
  103
8925
8995
  ];
@@ -8941,7 +9011,7 @@ var responsesRunAdapter = function(param) {
8941
9011
  return [
8942
9012
  4,
8943
9013
  onEvent2.apply(void 0, [
8944
- (_tmp71.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
9014
+ (_tmp71.data = serializeItemAsReasoningRunStep.apply(void 0, [
8945
9015
  (_tmp72.openaiAssistant = _state.sent(), _tmp72.threadId = threadId, _tmp72.runId = responseCreatedResponse.id, _tmp72)
8946
9016
  ]), _tmp71)
8947
9017
  ])
@@ -8994,7 +9064,7 @@ var responsesRunAdapter = function(param) {
8994
9064
  4,
8995
9065
  onEvent2.apply(void 0, [
8996
9066
  (_tmp75.data = serializeItemAsMessage.apply(void 0, [
8997
- (_tmp76.openaiAssistant = _state.sent(), _tmp76.createdAt = (0, import_dayjs20.default)().unix(), _tmp76.runId = responseCreatedResponse.id, _tmp76)
9067
+ (_tmp76.openaiAssistant = _state.sent(), _tmp76.createdAt = (0, import_dayjs21.default)().unix(), _tmp76.runId = responseCreatedResponse.id, _tmp76)
8998
9068
  ]), _tmp75)
8999
9069
  ])
9000
9070
  ];
@@ -9002,10 +9072,10 @@ var responsesRunAdapter = function(param) {
9002
9072
  _state.sent();
9003
9073
  return [
9004
9074
  3,
9005
- 117
9075
+ 131
9006
9076
  ];
9007
9077
  case 103:
9008
- if (!(event.item.type === "mcp_call")) return [
9078
+ if (!(event.item.type === "web_search_call")) return [
9009
9079
  3,
9010
9080
  110
9011
9081
  ];
@@ -9027,7 +9097,7 @@ var responsesRunAdapter = function(param) {
9027
9097
  return [
9028
9098
  4,
9029
9099
  onEvent2.apply(void 0, [
9030
- (_tmp77.data = serializeItemAsMcpCallRunStep.apply(void 0, [
9100
+ (_tmp77.data = serializeItemAsWebSearchRunStep.apply(void 0, [
9031
9101
  (_tmp78.openaiAssistant = _state.sent(), _tmp78.threadId = threadId, _tmp78.runId = responseCreatedResponse.id, _tmp78)
9032
9102
  ]), _tmp77)
9033
9103
  ])
@@ -9080,7 +9150,7 @@ var responsesRunAdapter = function(param) {
9080
9150
  4,
9081
9151
  onEvent2.apply(void 0, [
9082
9152
  (_tmp81.data = serializeItemAsMessage.apply(void 0, [
9083
- (_tmp82.openaiAssistant = _state.sent(), _tmp82.createdAt = (0, import_dayjs20.default)().unix(), _tmp82.runId = responseCreatedResponse.id, _tmp82)
9153
+ (_tmp82.openaiAssistant = _state.sent(), _tmp82.createdAt = (0, import_dayjs21.default)().unix(), _tmp82.runId = responseCreatedResponse.id, _tmp82)
9084
9154
  ]), _tmp81)
9085
9155
  ])
9086
9156
  ];
@@ -9088,10 +9158,10 @@ var responsesRunAdapter = function(param) {
9088
9158
  _state.sent();
9089
9159
  return [
9090
9160
  3,
9091
- 117
9161
+ 131
9092
9162
  ];
9093
9163
  case 110:
9094
- if (!(event.item.type === "code_interpreter_call")) return [
9164
+ if (!(event.item.type === "mcp_list_tools")) return [
9095
9165
  3,
9096
9166
  117
9097
9167
  ];
@@ -9113,7 +9183,7 @@ var responsesRunAdapter = function(param) {
9113
9183
  return [
9114
9184
  4,
9115
9185
  onEvent2.apply(void 0, [
9116
- (_tmp83.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
9186
+ (_tmp83.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
9117
9187
  (_tmp84.openaiAssistant = _state.sent(), _tmp84.threadId = threadId, _tmp84.runId = responseCreatedResponse.id, _tmp84)
9118
9188
  ]), _tmp83)
9119
9189
  ])
@@ -9166,23 +9236,195 @@ var responsesRunAdapter = function(param) {
9166
9236
  4,
9167
9237
  onEvent2.apply(void 0, [
9168
9238
  (_tmp87.data = serializeItemAsMessage.apply(void 0, [
9169
- (_tmp88.openaiAssistant = _state.sent(), _tmp88.createdAt = (0, import_dayjs20.default)().unix(), _tmp88.runId = responseCreatedResponse.id, _tmp88)
9239
+ (_tmp88.openaiAssistant = _state.sent(), _tmp88.createdAt = (0, import_dayjs21.default)().unix(), _tmp88.runId = responseCreatedResponse.id, _tmp88)
9170
9240
  ]), _tmp87)
9171
9241
  ])
9172
9242
  ];
9173
9243
  case 116:
9174
9244
  _state.sent();
9175
- _state.label = 117;
9176
- case 117:
9177
9245
  return [
9178
9246
  3,
9179
- 129
9247
+ 131
9248
+ ];
9249
+ case 117:
9250
+ if (!(event.item.type === "mcp_call")) return [
9251
+ 3,
9252
+ 124
9253
+ ];
9254
+ _tmp89 = {
9255
+ event: "thread.run.step.completed"
9256
+ };
9257
+ _tmp90 = {
9258
+ item: event.item
9259
+ };
9260
+ return [
9261
+ 4,
9262
+ getOpenaiAssistant({
9263
+ select: {
9264
+ id: true
9265
+ }
9266
+ })
9180
9267
  ];
9181
9268
  case 118:
9269
+ return [
9270
+ 4,
9271
+ onEvent2.apply(void 0, [
9272
+ (_tmp89.data = serializeItemAsMcpCallRunStep.apply(void 0, [
9273
+ (_tmp90.openaiAssistant = _state.sent(), _tmp90.threadId = threadId, _tmp90.runId = responseCreatedResponse.id, _tmp90)
9274
+ ]), _tmp89)
9275
+ ])
9276
+ ];
9277
+ case 119:
9278
+ _state.sent();
9279
+ _tmp91 = {
9280
+ event: "thread.run.step.completed"
9281
+ };
9282
+ _tmp92 = {
9283
+ item: event.item,
9284
+ threadId: threadId
9285
+ };
9286
+ return [
9287
+ 4,
9288
+ getOpenaiAssistant({
9289
+ select: {
9290
+ id: true
9291
+ }
9292
+ })
9293
+ ];
9294
+ case 120:
9295
+ return [
9296
+ 4,
9297
+ onEvent2.apply(void 0, [
9298
+ (_tmp91.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9299
+ (_tmp92.openaiAssistant = _state.sent(), _tmp92.runId = responseCreatedResponse.id, _tmp92)
9300
+ ]), _tmp91)
9301
+ ])
9302
+ ];
9303
+ case 121:
9304
+ _state.sent();
9305
+ _tmp93 = {
9306
+ event: "thread.message.completed"
9307
+ };
9308
+ _tmp94 = {
9309
+ item: event.item,
9310
+ threadId: threadId
9311
+ };
9312
+ return [
9313
+ 4,
9314
+ getOpenaiAssistant({
9315
+ select: {
9316
+ id: true
9317
+ }
9318
+ })
9319
+ ];
9320
+ case 122:
9321
+ return [
9322
+ 4,
9323
+ onEvent2.apply(void 0, [
9324
+ (_tmp93.data = serializeItemAsMessage.apply(void 0, [
9325
+ (_tmp94.openaiAssistant = _state.sent(), _tmp94.createdAt = (0, import_dayjs21.default)().unix(), _tmp94.runId = responseCreatedResponse.id, _tmp94)
9326
+ ]), _tmp93)
9327
+ ])
9328
+ ];
9329
+ case 123:
9330
+ _state.sent();
9331
+ return [
9332
+ 3,
9333
+ 131
9334
+ ];
9335
+ case 124:
9336
+ if (!(event.item.type === "code_interpreter_call")) return [
9337
+ 3,
9338
+ 131
9339
+ ];
9340
+ _tmp95 = {
9341
+ event: "thread.run.step.completed"
9342
+ };
9343
+ _tmp96 = {
9344
+ item: event.item
9345
+ };
9346
+ return [
9347
+ 4,
9348
+ getOpenaiAssistant({
9349
+ select: {
9350
+ id: true
9351
+ }
9352
+ })
9353
+ ];
9354
+ case 125:
9355
+ return [
9356
+ 4,
9357
+ onEvent2.apply(void 0, [
9358
+ (_tmp95.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
9359
+ (_tmp96.openaiAssistant = _state.sent(), _tmp96.threadId = threadId, _tmp96.runId = responseCreatedResponse.id, _tmp96)
9360
+ ]), _tmp95)
9361
+ ])
9362
+ ];
9363
+ case 126:
9364
+ _state.sent();
9365
+ _tmp97 = {
9366
+ event: "thread.run.step.completed"
9367
+ };
9368
+ _tmp98 = {
9369
+ item: event.item,
9370
+ threadId: threadId
9371
+ };
9372
+ return [
9373
+ 4,
9374
+ getOpenaiAssistant({
9375
+ select: {
9376
+ id: true
9377
+ }
9378
+ })
9379
+ ];
9380
+ case 127:
9381
+ return [
9382
+ 4,
9383
+ onEvent2.apply(void 0, [
9384
+ (_tmp97.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9385
+ (_tmp98.openaiAssistant = _state.sent(), _tmp98.runId = responseCreatedResponse.id, _tmp98)
9386
+ ]), _tmp97)
9387
+ ])
9388
+ ];
9389
+ case 128:
9390
+ _state.sent();
9391
+ _tmp99 = {
9392
+ event: "thread.message.completed"
9393
+ };
9394
+ _tmp100 = {
9395
+ item: event.item,
9396
+ threadId: threadId
9397
+ };
9398
+ return [
9399
+ 4,
9400
+ getOpenaiAssistant({
9401
+ select: {
9402
+ id: true
9403
+ }
9404
+ })
9405
+ ];
9406
+ case 129:
9407
+ return [
9408
+ 4,
9409
+ onEvent2.apply(void 0, [
9410
+ (_tmp99.data = serializeItemAsMessage.apply(void 0, [
9411
+ (_tmp100.openaiAssistant = _state.sent(), _tmp100.createdAt = (0, import_dayjs21.default)().unix(), _tmp100.runId = responseCreatedResponse.id, _tmp100)
9412
+ ]), _tmp99)
9413
+ ])
9414
+ ];
9415
+ case 130:
9416
+ _state.sent();
9417
+ _state.label = 131;
9418
+ case 131:
9419
+ return [
9420
+ 3,
9421
+ 143
9422
+ ];
9423
+ case 132:
9182
9424
  toolCall = toolCalls[event.item_id];
9183
9425
  if (!toolCall) return [
9184
9426
  3,
9185
- 129
9427
+ 143
9186
9428
  ];
9187
9429
  return [
9188
9430
  4,
@@ -9211,17 +9453,17 @@ var responsesRunAdapter = function(param) {
9211
9453
  }
9212
9454
  })
9213
9455
  ];
9214
- case 119:
9456
+ case 133:
9215
9457
  _state.sent();
9216
9458
  return [
9217
9459
  3,
9218
- 129
9460
+ 143
9219
9461
  ];
9220
- case 120:
9462
+ case 134:
9221
9463
  mcpCall = mcpCalls[event.item_id];
9222
9464
  if (!mcpCall) return [
9223
9465
  3,
9224
- 129
9466
+ 143
9225
9467
  ];
9226
9468
  return [
9227
9469
  4,
@@ -9250,20 +9492,20 @@ var responsesRunAdapter = function(param) {
9250
9492
  }
9251
9493
  })
9252
9494
  ];
9253
- case 121:
9495
+ case 135:
9254
9496
  _state.sent();
9255
9497
  return [
9256
9498
  3,
9257
- 129
9499
+ 143
9258
9500
  ];
9259
- case 122:
9260
- _tmp89 = {
9501
+ case 136:
9502
+ _tmp101 = {
9261
9503
  event: "thread.message.in_progress"
9262
9504
  };
9263
- _tmp90 = {
9505
+ _tmp102 = {
9264
9506
  id: event.item_id,
9265
9507
  object: "thread.message",
9266
- created_at: (0, import_dayjs20.default)().unix(),
9508
+ created_at: (0, import_dayjs21.default)().unix(),
9267
9509
  thread_id: threadId,
9268
9510
  completed_at: null,
9269
9511
  incomplete_at: null,
@@ -9279,29 +9521,29 @@ var responsesRunAdapter = function(param) {
9279
9521
  }
9280
9522
  })
9281
9523
  ];
9282
- case 123:
9524
+ case 137:
9283
9525
  return [
9284
9526
  4,
9285
9527
  onEvent2.apply(void 0, [
9286
- (_tmp89.data = (_tmp90.assistant_id = _state.sent().id, _tmp90.run_id = responseCreatedResponse.id, _tmp90.attachments = [], _tmp90.status = "in_progress", _tmp90.metadata = {
9528
+ (_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.run_id = responseCreatedResponse.id, _tmp102.attachments = [], _tmp102.status = "in_progress", _tmp102.metadata = {
9287
9529
  event: JSON.stringify(event)
9288
- }, _tmp90), _tmp89)
9530
+ }, _tmp102), _tmp101)
9289
9531
  ])
9290
9532
  ];
9291
- case 124:
9533
+ case 138:
9292
9534
  _state.sent();
9293
9535
  return [
9294
9536
  3,
9295
- 129
9537
+ 143
9296
9538
  ];
9297
- case 125:
9298
- _tmp91 = {
9539
+ case 139:
9540
+ _tmp103 = {
9299
9541
  event: "thread.message.in_progress"
9300
9542
  };
9301
- _tmp92 = {
9543
+ _tmp104 = {
9302
9544
  id: event.item_id,
9303
9545
  object: "thread.message",
9304
- created_at: (0, import_dayjs20.default)().unix(),
9546
+ created_at: (0, import_dayjs21.default)().unix(),
9305
9547
  thread_id: threadId,
9306
9548
  completed_at: null,
9307
9549
  incomplete_at: null,
@@ -9326,92 +9568,92 @@ var responsesRunAdapter = function(param) {
9326
9568
  }
9327
9569
  })
9328
9570
  ];
9329
- case 126:
9571
+ case 140:
9330
9572
  return [
9331
9573
  4,
9332
9574
  onEvent2.apply(void 0, [
9333
- (_tmp91.data = (_tmp92.assistant_id = _state.sent().id, _tmp92.run_id = responseCreatedResponse.id, _tmp92.attachments = [], _tmp92.status = "in_progress", _tmp92.metadata = {
9575
+ (_tmp103.data = (_tmp104.assistant_id = _state.sent().id, _tmp104.run_id = responseCreatedResponse.id, _tmp104.attachments = [], _tmp104.status = "in_progress", _tmp104.metadata = {
9334
9576
  event: JSON.stringify(_object_spread_props(_object_spread({}, event), {
9335
9577
  partial_image_b64: "truncated"
9336
9578
  }))
9337
- }, _tmp92), _tmp91)
9579
+ }, _tmp104), _tmp103)
9338
9580
  ])
9339
9581
  ];
9340
- case 127:
9582
+ case 141:
9341
9583
  _state.sent();
9342
9584
  return [
9343
9585
  3,
9344
- 129
9586
+ 143
9345
9587
  ];
9346
- case 128:
9588
+ case 142:
9347
9589
  return [
9348
9590
  3,
9349
- 129
9591
+ 143
9350
9592
  ];
9351
- case 129:
9593
+ case 143:
9352
9594
  _iteratorAbruptCompletion = false;
9353
9595
  return [
9354
9596
  3,
9355
9597
  3
9356
9598
  ];
9357
- case 130:
9599
+ case 144:
9358
9600
  return [
9359
9601
  3,
9360
- 137
9602
+ 151
9361
9603
  ];
9362
- case 131:
9604
+ case 145:
9363
9605
  err = _state.sent();
9364
9606
  _didIteratorError = true;
9365
9607
  _iteratorError = err;
9366
9608
  return [
9367
9609
  3,
9368
- 137
9610
+ 151
9369
9611
  ];
9370
- case 132:
9612
+ case 146:
9371
9613
  _state.trys.push([
9372
- 132,
9614
+ 146,
9373
9615
  ,
9374
- 135,
9375
- 136
9616
+ 149,
9617
+ 150
9376
9618
  ]);
9377
9619
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
9378
9620
  3,
9379
- 134
9621
+ 148
9380
9622
  ];
9381
9623
  return [
9382
9624
  4,
9383
9625
  _iterator.return()
9384
9626
  ];
9385
- case 133:
9627
+ case 147:
9386
9628
  _state.sent();
9387
- _state.label = 134;
9388
- case 134:
9629
+ _state.label = 148;
9630
+ case 148:
9389
9631
  return [
9390
9632
  3,
9391
- 136
9633
+ 150
9392
9634
  ];
9393
- case 135:
9635
+ case 149:
9394
9636
  if (_didIteratorError) {
9395
9637
  throw _iteratorError;
9396
9638
  }
9397
9639
  return [
9398
9640
  7
9399
9641
  ];
9400
- case 136:
9642
+ case 150:
9401
9643
  return [
9402
9644
  7
9403
9645
  ];
9404
- case 137:
9646
+ case 151:
9405
9647
  return [
9406
9648
  3,
9407
- 144
9649
+ 156
9408
9650
  ];
9409
- case 138:
9651
+ case 152:
9410
9652
  e = _state.sent();
9411
- _tmp93 = {
9653
+ _tmp105 = {
9412
9654
  event: "thread.run.failed"
9413
9655
  };
9414
- _tmp94 = {
9656
+ _tmp106 = {
9415
9657
  id: (responseCreatedResponse === null || responseCreatedResponse === void 0 ? void 0 : responseCreatedResponse.id) || "run_".concat((0, import_radash22.uid)(18)),
9416
9658
  object: "thread.run",
9417
9659
  thread_id: threadId
@@ -9424,44 +9666,60 @@ var responsesRunAdapter = function(param) {
9424
9666
  }
9425
9667
  })
9426
9668
  ];
9427
- case 139:
9669
+ case 153:
9428
9670
  return [
9429
9671
  4,
9430
9672
  onEvent2.apply(void 0, [
9431
- (_tmp93.data = (_tmp94.assistant_id = _state.sent().id, _tmp94.status = "failed", _tmp94.failed_at = (0, import_dayjs20.default)().unix(), _tmp94.last_error = {
9673
+ (_tmp105.data = (_tmp106.assistant_id = _state.sent().id, _tmp106.status = "failed", _tmp106.failed_at = (0, import_dayjs21.default)().unix(), _tmp106.last_error = {
9432
9674
  code: "server_error",
9433
9675
  message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
9434
- }, _tmp94), _tmp93)
9676
+ }, _tmp106), _tmp105)
9435
9677
  ])
9436
9678
  ];
9437
- case 140:
9679
+ case 154:
9438
9680
  _state.sent();
9439
9681
  return [
9440
9682
  3,
9441
- 144
9442
- ];
9443
- case 141:
9444
- if (!((responseCreatedResponse === null || responseCreatedResponse === void 0 ? void 0 : responseCreatedResponse.id) && itemIds.length > 0)) return [
9445
- 3,
9446
- 143
9447
- ];
9448
- return [
9449
- 4,
9450
- saveResponseItemsToConversationMetadata({
9451
- client: client,
9452
- threadId: threadId,
9453
- responseId: responseCreatedResponse.id,
9454
- itemIds: itemIds
9455
- })
9456
- ];
9457
- case 142:
9458
- _state.sent();
9459
- _state.label = 143;
9460
- case 143:
9683
+ 156
9684
+ ];
9685
+ case 155:
9686
+ waitUntil(new Promise(/*#__PURE__*/ function() {
9687
+ var _ref = _async_to_generator(function(resolve) {
9688
+ return _ts_generator(this, function(_state) {
9689
+ switch(_state.label){
9690
+ case 0:
9691
+ if (!((responseCreatedResponse === null || responseCreatedResponse === void 0 ? void 0 : responseCreatedResponse.id) && itemIds.length > 0)) return [
9692
+ 3,
9693
+ 2
9694
+ ];
9695
+ return [
9696
+ 4,
9697
+ saveResponseItemsToConversationMetadata({
9698
+ client: client,
9699
+ threadId: threadId,
9700
+ responseId: responseCreatedResponse.id,
9701
+ itemIds: itemIds
9702
+ })
9703
+ ];
9704
+ case 1:
9705
+ _state.sent();
9706
+ _state.label = 2;
9707
+ case 2:
9708
+ resolve(true);
9709
+ return [
9710
+ 2
9711
+ ];
9712
+ }
9713
+ });
9714
+ });
9715
+ return function(resolve) {
9716
+ return _ref.apply(this, arguments);
9717
+ };
9718
+ }()));
9461
9719
  return [
9462
9720
  7
9463
9721
  ];
9464
- case 144:
9722
+ case 156:
9465
9723
  return [
9466
9724
  2
9467
9725
  ];