supercompat 3.3.0 → 3.4.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.cjs CHANGED
@@ -5378,34 +5378,71 @@ var import_radash14 = require("radash");
5378
5378
  var import_radash13 = require("radash");
5379
5379
  var serializeContent2 = function(param) {
5380
5380
  var item = param.item;
5381
- if (item.type !== "message") return [];
5382
- return item.content.map(function(contentBlock) {
5383
- if (contentBlock.type === "input_text") {
5384
- return {
5385
- type: "text",
5386
- text: {
5387
- value: contentBlock.text,
5388
- annotations: []
5389
- }
5390
- };
5391
- } else if (contentBlock.type === "output_text") {
5392
- return {
5393
- type: "text",
5394
- text: {
5395
- value: contentBlock.text,
5396
- annotations: []
5381
+ if (item.type === "message") {
5382
+ return item.content.map(function(contentBlock) {
5383
+ if (contentBlock.type === "input_text") {
5384
+ return {
5385
+ type: "text",
5386
+ text: {
5387
+ value: contentBlock.text,
5388
+ annotations: []
5389
+ }
5390
+ };
5391
+ } else if (contentBlock.type === "output_text") {
5392
+ return {
5393
+ type: "text",
5394
+ text: {
5395
+ value: contentBlock.text,
5396
+ annotations: []
5397
+ }
5398
+ };
5399
+ } else if (contentBlock.type === "input_image") {
5400
+ return {
5401
+ type: "image_file",
5402
+ image_file: {
5403
+ file_id: contentBlock.file_id,
5404
+ detail: "auto"
5405
+ }
5406
+ };
5407
+ }
5408
+ return null;
5409
+ }).filter(Boolean);
5410
+ } else if (item.type === "image_generation_call") {
5411
+ if (!item.result) return [];
5412
+ return [
5413
+ {
5414
+ type: "image_url",
5415
+ image_url: {
5416
+ url: "data:image/".concat(item.output_format, ";base64,").concat(item.result),
5417
+ detail: "auto"
5397
5418
  }
5398
- };
5399
- }
5400
- return null;
5401
- }).filter(Boolean);
5419
+ }
5420
+ ];
5421
+ } else {
5422
+ return [];
5423
+ }
5402
5424
  };
5403
5425
  var serializeAttachments = function(param) {
5404
5426
  var item = param.item;
5405
- return [];
5427
+ if (item.type !== "message") return [];
5428
+ var inputFiles = item.content.filter(function(contentBlock) {
5429
+ return contentBlock.type === "input_file" && contentBlock.file_id;
5430
+ });
5431
+ return inputFiles.map(function(inputFile) {
5432
+ return {
5433
+ file_id: inputFile.file_id
5434
+ };
5435
+ });
5406
5436
  };
5407
5437
  var serializeMetadata = function(param) {
5408
5438
  var item = param.item;
5439
+ if (item.type === "image_generation_call") {
5440
+ return {
5441
+ item: JSON.stringify(_object_spread_props(_object_spread({}, item), {
5442
+ result: "truncated"
5443
+ }))
5444
+ };
5445
+ }
5409
5446
  return {
5410
5447
  item: JSON.stringify(item)
5411
5448
  };
@@ -5436,8 +5473,7 @@ var serializeItemAsMessage = function(param) {
5436
5473
  };
5437
5474
  };
5438
5475
  // src/adapters/storage/responsesStorageAdapter/threads/messages/post.ts
5439
- var import_radash15 = require("radash");
5440
- var messageContentBlocks2 = function(param) {
5476
+ var contentBlocksFromContent = function(param) {
5441
5477
  var content = param.content;
5442
5478
  if ((0, import_radash14.isArray)(content)) {
5443
5479
  return content.map(function(item) {
@@ -5476,25 +5512,41 @@ var messageContentBlocks2 = function(param) {
5476
5512
  }
5477
5513
  ];
5478
5514
  };
5515
+ var contentBlocksFromAttachments = function(param) {
5516
+ var attachments = param.attachments;
5517
+ return attachments.map(function(attachment) {
5518
+ return {
5519
+ type: "input_file",
5520
+ file_id: attachment.file_id
5521
+ };
5522
+ });
5523
+ };
5524
+ var messageContentBlocks2 = function(param) {
5525
+ var content = param.content, attachments = param.attachments;
5526
+ return _to_consumable_array(contentBlocksFromContent({
5527
+ content: content
5528
+ })).concat(_to_consumable_array(contentBlocksFromAttachments({
5529
+ attachments: attachments
5530
+ })));
5531
+ };
5479
5532
  var post16 = function(param) {
5480
5533
  var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
5481
5534
  return /*#__PURE__*/ function() {
5482
5535
  var _ref = _async_to_generator(function(urlString, options) {
5483
- var url, _url_pathname_match, threadId, body, role, content, metadata, item, openaiAssistant;
5536
+ var url, _url_pathname_match, threadId, body, role, content, _body_attachments, attachments, item, openaiAssistant;
5484
5537
  return _ts_generator(this, function(_state) {
5485
5538
  switch(_state.label){
5486
5539
  case 0:
5487
5540
  url = new URL(urlString);
5488
5541
  _url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(messagesRegexp)), 2), threadId = _url_pathname_match[1];
5489
5542
  body = JSON.parse(options.body);
5490
- role = body.role, content = body.content, metadata = body.metadata;
5543
+ role = body.role, content = body.content, _body_attachments = body.attachments, attachments = _body_attachments === void 0 ? [] : _body_attachments;
5491
5544
  item = {
5492
- id: "msg_".concat((0, import_radash15.uid)(24)),
5493
- status: "in_progress",
5494
5545
  type: "message",
5495
5546
  role: role,
5496
5547
  content: messageContentBlocks2({
5497
- content: content
5548
+ content: content,
5549
+ attachments: attachments
5498
5550
  })
5499
5551
  };
5500
5552
  createResponseItems.push(item);
@@ -5527,7 +5579,7 @@ var post16 = function(param) {
5527
5579
  }();
5528
5580
  };
5529
5581
  // src/adapters/storage/responsesStorageAdapter/threads/messages/get.ts
5530
- var import_radash16 = require("radash");
5582
+ var import_radash15 = require("radash");
5531
5583
  // src/lib/items/responseId.ts
5532
5584
  function responseId(param) {
5533
5585
  var conversation = param.conversation, itemId = param.itemId;
@@ -5575,7 +5627,7 @@ var get14 = function(param) {
5575
5627
  case 0:
5576
5628
  url = new URL(urlString);
5577
5629
  _url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(messagesRegexp)), 2), threadId = _url_pathname_match[1];
5578
- _ref = (0, import_radash16.assign)({
5630
+ _ref = (0, import_radash15.assign)({
5579
5631
  limit: "20",
5580
5632
  order: "desc"
5581
5633
  }, Object.fromEntries(url.searchParams)), limit = _ref.limit, order = _ref.order, after = _ref.after;
@@ -5815,9 +5867,9 @@ var get15 = function() {
5815
5867
  }();
5816
5868
  };
5817
5869
  // src/adapters/storage/responsesStorageAdapter/threads/runs/post.ts
5818
- var import_radash17 = require("radash");
5870
+ var import_radash16 = require("radash");
5819
5871
  var import_dayjs11 = __toESM(require("dayjs"), 1);
5820
- var import_radash18 = require("radash");
5872
+ var import_radash17 = require("radash");
5821
5873
  // src/lib/responses/serializeResponseAsRun.ts
5822
5874
  var serializeStatus = function(param) {
5823
5875
  var response = param.response;
@@ -6223,7 +6275,7 @@ var post17 = function(param) {
6223
6275
  _url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(runsRegexp)), 2), threadId = _url_pathname_match[1];
6224
6276
  body = JSON.parse(options.body);
6225
6277
  assistant_id = body.assistant_id, stream = body.stream;
6226
- _ = (0, import_radash18.assign);
6278
+ _ = (0, import_radash17.assign);
6227
6279
  _tmp = [
6228
6280
  {},
6229
6281
  defaultAssistant
@@ -6304,7 +6356,7 @@ var post17 = function(param) {
6304
6356
  event = {
6305
6357
  event: "thread.run.failed",
6306
6358
  data: {
6307
- id: (0, import_radash17.uid)(24),
6359
+ id: (0, import_radash16.uid)(24),
6308
6360
  failed_at: (0, import_dayjs11.default)().unix(),
6309
6361
  last_error: {
6310
6362
  code: "server_error",
@@ -6746,13 +6798,13 @@ function _pMap() {
6746
6798
  }
6747
6799
  var pMapSkip = Symbol("skip");
6748
6800
  // src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
6749
- var import_radash20 = require("radash");
6801
+ var import_radash19 = require("radash");
6750
6802
  // src/lib/items/serializeItemAsRunStep.ts
6751
6803
  var import_dayjs12 = __toESM(require("dayjs"), 1);
6752
- var import_radash19 = require("radash");
6804
+ var import_radash18 = require("radash");
6753
6805
  function serializeItemAsRunStep(param) {
6754
- var item = param.item, items = param.items, threadId = param.threadId, openaiAssistant = param.openaiAssistant, _param_runId = param.runId, runId = _param_runId === void 0 ? "run_".concat((0, import_radash19.uid)(24)) : _param_runId, tmp = param.status, status3 = tmp === void 0 ? "completed" : tmp, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs12.default)().unix() : _param_completedAt;
6755
- var itemId = typeof item.id === "string" ? item.id : "item_".concat((0, import_radash19.uid)(18));
6806
+ var item = param.item, items = param.items, threadId = param.threadId, openaiAssistant = param.openaiAssistant, _param_runId = param.runId, runId = _param_runId === void 0 ? "run_".concat((0, import_radash18.uid)(24)) : _param_runId, tmp = param.status, status3 = tmp === void 0 ? "completed" : tmp, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs12.default)().unix() : _param_completedAt;
6807
+ var itemId = typeof item.id === "string" ? item.id : "item_".concat((0, import_radash18.uid)(18));
6756
6808
  var base = {
6757
6809
  id: itemId,
6758
6810
  object: "thread.run.step",
@@ -6808,6 +6860,22 @@ function serializeItemAsRunStep(param) {
6808
6860
  }
6809
6861
  });
6810
6862
  }
6863
+ if (item.type === "image_generation_call") {
6864
+ return _object_spread_props(_object_spread({}, base), {
6865
+ type: "message_creation",
6866
+ step_details: {
6867
+ type: "message_creation",
6868
+ message_creation: {
6869
+ message_id: itemId
6870
+ }
6871
+ },
6872
+ metadata: {
6873
+ item: JSON.stringify(_object_spread_props(_object_spread({}, item), {
6874
+ result: "truncated"
6875
+ }))
6876
+ }
6877
+ });
6878
+ }
6811
6879
  return _object_spread_props(_object_spread({}, base), {
6812
6880
  type: "message_creation",
6813
6881
  step_details: {
@@ -6821,6 +6889,283 @@ function serializeItemAsRunStep(param) {
6821
6889
  }
6822
6890
  });
6823
6891
  }
6892
+ // src/lib/items/serializeItemAsImageGenerationRunStep.ts
6893
+ var import_dayjs13 = __toESM(require("dayjs"), 1);
6894
+ var serializeStatus2 = function(param) {
6895
+ var item = param.item;
6896
+ if (item.status === "generating") {
6897
+ return "in_progress";
6898
+ }
6899
+ return item.status;
6900
+ };
6901
+ var serializeItemAsImageGenerationRunStep = function(param) {
6902
+ var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs13.default)().unix() : _param_completedAt;
6903
+ var toolCall = {
6904
+ id: "ftc".concat(item.id),
6905
+ type: "function",
6906
+ function: {
6907
+ name: "image_generation",
6908
+ arguments: "{}",
6909
+ output: JSON.stringify({
6910
+ status: item.status,
6911
+ background: item.background,
6912
+ output_format: item.output_format,
6913
+ quality: item.quality,
6914
+ result: item.result,
6915
+ size: item.size,
6916
+ revised_prompt: item.revised_prompt
6917
+ })
6918
+ }
6919
+ };
6920
+ return {
6921
+ id: "fc".concat(item.id),
6922
+ object: "thread.run.step",
6923
+ created_at: (0, import_dayjs13.default)().unix(),
6924
+ assistant_id: openaiAssistant.id,
6925
+ thread_id: threadId,
6926
+ run_id: runId,
6927
+ status: serializeStatus2({
6928
+ item: item
6929
+ }),
6930
+ last_error: null,
6931
+ expired_at: null,
6932
+ cancelled_at: null,
6933
+ failed_at: null,
6934
+ completed_at: completedAt,
6935
+ metadata: {},
6936
+ usage: null,
6937
+ type: "tool_calls",
6938
+ step_details: {
6939
+ type: "tool_calls",
6940
+ tool_calls: [
6941
+ toolCall
6942
+ ]
6943
+ }
6944
+ };
6945
+ };
6946
+ // src/lib/items/serializeItemAsWebSearchRunStep.ts
6947
+ var import_dayjs14 = __toESM(require("dayjs"), 1);
6948
+ var serializeStatus3 = function(param) {
6949
+ var item = param.item;
6950
+ if (item.status === "searching") {
6951
+ return "in_progress";
6952
+ }
6953
+ return item.status;
6954
+ };
6955
+ var serializeItemAsWebSearchRunStep = function(param) {
6956
+ var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs14.default)().unix() : _param_completedAt;
6957
+ var toolCall = {
6958
+ id: "ftc".concat(item.id),
6959
+ type: "function",
6960
+ function: {
6961
+ name: "web_search",
6962
+ arguments: JSON.stringify({
6963
+ action: item.action
6964
+ }),
6965
+ output: JSON.stringify({
6966
+ status: item.status
6967
+ })
6968
+ }
6969
+ };
6970
+ return {
6971
+ id: "fc".concat(item.id),
6972
+ object: "thread.run.step",
6973
+ created_at: (0, import_dayjs14.default)().unix(),
6974
+ assistant_id: openaiAssistant.id,
6975
+ thread_id: threadId,
6976
+ run_id: runId,
6977
+ status: serializeStatus3({
6978
+ item: item
6979
+ }),
6980
+ last_error: null,
6981
+ expired_at: null,
6982
+ cancelled_at: null,
6983
+ failed_at: null,
6984
+ completed_at: completedAt,
6985
+ metadata: {},
6986
+ usage: null,
6987
+ type: "tool_calls",
6988
+ step_details: {
6989
+ type: "tool_calls",
6990
+ tool_calls: [
6991
+ toolCall
6992
+ ]
6993
+ }
6994
+ };
6995
+ };
6996
+ // src/lib/items/serializeItemAsMcpListToolsRunStep.ts
6997
+ var import_dayjs15 = __toESM(require("dayjs"), 1);
6998
+ var serializeStatus4 = function(param) {
6999
+ var item = param.item;
7000
+ if (item.error) {
7001
+ return "failed";
7002
+ }
7003
+ return "completed";
7004
+ };
7005
+ var serializeItemAsMcpListToolsRunStep = function(param) {
7006
+ var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs15.default)().unix() : _param_completedAt;
7007
+ var toolCall = {
7008
+ id: "ftc".concat(item.id),
7009
+ type: "function",
7010
+ function: {
7011
+ name: "mcp_list_tools",
7012
+ arguments: JSON.stringify({
7013
+ server_label: item.server_label
7014
+ }),
7015
+ output: JSON.stringify(_object_spread({
7016
+ tools: item.tools
7017
+ }, item.error && {
7018
+ error: item.error
7019
+ }))
7020
+ }
7021
+ };
7022
+ return {
7023
+ id: "fc".concat(item.id),
7024
+ object: "thread.run.step",
7025
+ created_at: (0, import_dayjs15.default)().unix(),
7026
+ assistant_id: openaiAssistant.id,
7027
+ thread_id: threadId,
7028
+ run_id: runId,
7029
+ status: serializeStatus4({
7030
+ item: item
7031
+ }),
7032
+ last_error: null,
7033
+ expired_at: null,
7034
+ cancelled_at: null,
7035
+ failed_at: null,
7036
+ completed_at: completedAt,
7037
+ metadata: {},
7038
+ usage: null,
7039
+ type: "tool_calls",
7040
+ step_details: {
7041
+ type: "tool_calls",
7042
+ tool_calls: [
7043
+ toolCall
7044
+ ]
7045
+ }
7046
+ };
7047
+ };
7048
+ // src/lib/items/serializeItemAsMcpCallRunStep.ts
7049
+ var import_dayjs16 = __toESM(require("dayjs"), 1);
7050
+ var serializeStatus5 = function(param) {
7051
+ var item = param.item;
7052
+ if (item.error) {
7053
+ return "failed";
7054
+ }
7055
+ return "completed";
7056
+ };
7057
+ var serializeItemAsMcpCallRunStep = function(param) {
7058
+ var item = param.item, openaiAssistant = param.openaiAssistant, threadId = param.threadId, runId = param.runId, _param_completedAt = param.completedAt, completedAt = _param_completedAt === void 0 ? (0, import_dayjs16.default)().unix() : _param_completedAt;
7059
+ var _item_output, _ref;
7060
+ var toolCall = {
7061
+ id: "ftc".concat(item.id),
7062
+ type: "function",
7063
+ function: {
7064
+ name: item.name,
7065
+ arguments: item.arguments,
7066
+ server_label: item.server_label,
7067
+ output: (_ref = (_item_output = item.output) !== null && _item_output !== void 0 ? _item_output : item.error) !== null && _ref !== void 0 ? _ref : null
7068
+ }
7069
+ };
7070
+ return {
7071
+ id: "fc".concat(item.id),
7072
+ object: "thread.run.step",
7073
+ created_at: (0, import_dayjs16.default)().unix(),
7074
+ assistant_id: openaiAssistant.id,
7075
+ thread_id: threadId,
7076
+ run_id: runId,
7077
+ status: serializeStatus5({
7078
+ item: item
7079
+ }),
7080
+ last_error: item.error ? {
7081
+ code: "server_error",
7082
+ message: item.error
7083
+ } : null,
7084
+ expired_at: null,
7085
+ cancelled_at: null,
7086
+ failed_at: item.error ? (0, import_dayjs16.default)().unix() : null,
7087
+ completed_at: item.error ? null : completedAt,
7088
+ metadata: {},
7089
+ usage: null,
7090
+ type: "tool_calls",
7091
+ step_details: {
7092
+ type: "tool_calls",
7093
+ tool_calls: [
7094
+ toolCall
7095
+ ]
7096
+ }
7097
+ };
7098
+ };
7099
+ // src/lib/items/serializeItemAsCodeInterpreterCallRunStep.ts
7100
+ var import_dayjs17 = __toESM(require("dayjs"), 1);
7101
+ var serializeStatus6 = function(param) {
7102
+ var item = param.item;
7103
+ if (item.status === "incomplete") {
7104
+ return "in_progress";
7105
+ } else if (item.status === "interpreting") {
7106
+ return "in_progress";
7107
+ }
7108
+ return item.status;
7109
+ };
7110
+ var serializeOutput = function(param) {
7111
+ var output = param.output;
7112
+ return {
7113
+ type: output.type,
7114
+ logs: output.logs
7115
+ };
7116
+ };
7117
+ var serializeOutputs = function(param) {
7118
+ var item = param.item;
7119
+ if (!item.outputs) return [];
7120
+ return item.outputs.filter(function(o) {
7121
+ return o.type === "logs";
7122
+ }).map(function(output) {
7123
+ return serializeOutput({
7124
+ output: output
7125
+ });
7126
+ });
7127
+ };
7128
+ var serializeItemAsCodeInterpreterCallRunStep = function(param) {
7129
+ 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;
7130
+ var _item_code;
7131
+ var toolCall = {
7132
+ id: "citc".concat(item.id),
7133
+ type: "code_interpreter",
7134
+ code_interpreter: {
7135
+ input: (_item_code = item.code) !== null && _item_code !== void 0 ? _item_code : "",
7136
+ outputs: serializeOutputs({
7137
+ item: item
7138
+ })
7139
+ }
7140
+ };
7141
+ return {
7142
+ id: "fc".concat(item.id),
7143
+ object: "thread.run.step",
7144
+ created_at: (0, import_dayjs17.default)().unix(),
7145
+ assistant_id: openaiAssistant.id,
7146
+ thread_id: threadId,
7147
+ run_id: runId,
7148
+ status: serializeStatus6({
7149
+ item: item
7150
+ }),
7151
+ last_error: null,
7152
+ expired_at: null,
7153
+ cancelled_at: null,
7154
+ failed_at: null,
7155
+ completed_at: completedAt,
7156
+ metadata: {
7157
+ item: JSON.stringify(item)
7158
+ },
7159
+ usage: null,
7160
+ type: "tool_calls",
7161
+ step_details: {
7162
+ type: "tool_calls",
7163
+ tool_calls: [
7164
+ toolCall
7165
+ ]
7166
+ }
7167
+ };
7168
+ };
6824
7169
  // src/adapters/storage/responsesStorageAdapter/threads/runs/steps/get.ts
6825
7170
  var get17 = function(param) {
6826
7171
  var client = param.client, runAdapter = param.runAdapter;
@@ -6906,6 +7251,56 @@ var get17 = function(param) {
6906
7251
  synthCreation,
6907
7252
  step
6908
7253
  ];
7254
+ } else if (item.type === "image_generation_call") {
7255
+ return [
7256
+ serializeItemAsImageGenerationRunStep({
7257
+ item: item,
7258
+ openaiAssistant: openaiAssistant,
7259
+ threadId: threadId,
7260
+ runId: response.id
7261
+ }),
7262
+ step
7263
+ ];
7264
+ } else if (item.type === "web_search_call") {
7265
+ return [
7266
+ serializeItemAsWebSearchRunStep({
7267
+ item: item,
7268
+ openaiAssistant: openaiAssistant,
7269
+ threadId: threadId,
7270
+ runId: response.id
7271
+ }),
7272
+ step
7273
+ ];
7274
+ } else if (item.type === "mcp_list_tools") {
7275
+ return [
7276
+ serializeItemAsMcpListToolsRunStep({
7277
+ item: item,
7278
+ openaiAssistant: openaiAssistant,
7279
+ threadId: threadId,
7280
+ runId: response.id
7281
+ }),
7282
+ step
7283
+ ];
7284
+ } else if (item.type === "mcp_call") {
7285
+ return [
7286
+ serializeItemAsMcpCallRunStep({
7287
+ item: item,
7288
+ openaiAssistant: openaiAssistant,
7289
+ threadId: threadId,
7290
+ runId: response.id
7291
+ }),
7292
+ step
7293
+ ];
7294
+ } else if (item.type === "code_interpreter_call") {
7295
+ return [
7296
+ serializeItemAsCodeInterpreterCallRunStep({
7297
+ item: item,
7298
+ openaiAssistant: openaiAssistant,
7299
+ threadId: threadId,
7300
+ runId: response.id
7301
+ }),
7302
+ step
7303
+ ];
6909
7304
  }
6910
7305
  return [
6911
7306
  step
@@ -6916,7 +7311,7 @@ var get17 = function(param) {
6916
7311
  new Response(JSON.stringify({
6917
7312
  data: data,
6918
7313
  has_more: false,
6919
- last_id: (_id = (_this = (0, import_radash20.last)(response.output)) === null || _this === void 0 ? void 0 : _this.id) !== null && _id !== void 0 ? _id : null
7314
+ last_id: (_id = (_this = (0, import_radash19.last)(response.output)) === null || _this === void 0 ? void 0 : _this.id) !== null && _id !== void 0 ? _id : null
6920
7315
  }), {
6921
7316
  status: 200,
6922
7317
  headers: {
@@ -7202,8 +7597,8 @@ var responsesStorageAdapter = function() {
7202
7597
  };
7203
7598
  };
7204
7599
  // src/adapters/run/responsesRunAdapter/index.ts
7205
- var import_dayjs13 = __toESM(require("dayjs"), 1);
7206
- var import_radash21 = require("radash");
7600
+ var import_dayjs18 = __toESM(require("dayjs"), 1);
7601
+ var import_radash20 = require("radash");
7207
7602
  var serializeToolCalls2 = function(param) {
7208
7603
  var toolCalls = param.toolCalls;
7209
7604
  return toolCalls.map(function(toolCall) {
@@ -7248,30 +7643,32 @@ var responsesRunAdapter = function(param) {
7248
7643
  }();
7249
7644
  var handleRun = /*#__PURE__*/ function() {
7250
7645
  var _ref = _async_to_generator(function(param) {
7251
- var client, threadId, response, onEvent2, responseCreatedResponse, toolCalls, 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, toolCall, err, e, _tmp23, _tmp24;
7646
+ 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, toolCall, mcpCall, _tmp83, _tmp84, _tmp85, _tmp86, err, e, _tmp87, _tmp88;
7252
7647
  return _ts_generator(this, function(_state) {
7253
7648
  switch(_state.label){
7254
7649
  case 0:
7255
7650
  client = param.client, threadId = param.threadId, response = param.response, onEvent2 = param.onEvent;
7256
7651
  responseCreatedResponse = null;
7257
7652
  toolCalls = {};
7653
+ mcpCalls = {};
7654
+ codeInterpreterCalls = {};
7258
7655
  itemIds = [];
7259
7656
  _state.label = 1;
7260
7657
  case 1:
7261
7658
  _state.trys.push([
7262
7659
  1,
7263
- 53,
7264
- 56,
7265
- 59
7660
+ 131,
7661
+ 134,
7662
+ 137
7266
7663
  ]);
7267
7664
  _iteratorAbruptCompletion = false, _didIteratorError = false;
7268
7665
  _state.label = 2;
7269
7666
  case 2:
7270
7667
  _state.trys.push([
7271
7668
  2,
7272
- 46,
7273
- 47,
7274
- 52
7669
+ 124,
7670
+ 125,
7671
+ 130
7275
7672
  ]);
7276
7673
  _iterator = _async_iterator(response);
7277
7674
  _state.label = 3;
@@ -7283,7 +7680,7 @@ var responsesRunAdapter = function(param) {
7283
7680
  case 4:
7284
7681
  if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
7285
7682
  3,
7286
- 45
7683
+ 123
7287
7684
  ];
7288
7685
  _value = _step.value;
7289
7686
  event = _value;
@@ -7322,17 +7719,37 @@ var responsesRunAdapter = function(param) {
7322
7719
  case "response.output_item.done":
7323
7720
  return [
7324
7721
  3,
7325
- 32
7722
+ 67
7326
7723
  ];
7327
7724
  case "response.function_call_arguments.delta":
7328
7725
  return [
7329
7726
  3,
7330
- 41
7727
+ 111
7728
+ ];
7729
+ case "response.mcp_call_arguments.delta":
7730
+ return [
7731
+ 3,
7732
+ 113
7733
+ ];
7734
+ case "response.image_generation_call.in_progress":
7735
+ return [
7736
+ 3,
7737
+ 115
7738
+ ];
7739
+ case "response.image_generation_call.generating":
7740
+ return [
7741
+ 3,
7742
+ 115
7743
+ ];
7744
+ case "response.image_generation_call.partial_image":
7745
+ return [
7746
+ 3,
7747
+ 118
7331
7748
  ];
7332
7749
  }
7333
7750
  return [
7334
7751
  3,
7335
- 43
7752
+ 121
7336
7753
  ];
7337
7754
  case 5:
7338
7755
  responseCreatedResponse = event.response;
@@ -7359,7 +7776,7 @@ var responsesRunAdapter = function(param) {
7359
7776
  _state.sent();
7360
7777
  return [
7361
7778
  3,
7362
- 44
7779
+ 122
7363
7780
  ];
7364
7781
  case 8:
7365
7782
  _tmp2 = {
@@ -7385,7 +7802,7 @@ var responsesRunAdapter = function(param) {
7385
7802
  _state.sent();
7386
7803
  return [
7387
7804
  3,
7388
- 44
7805
+ 122
7389
7806
  ];
7390
7807
  case 11:
7391
7808
  itemIds = event.response.output.filter(function(o) {
@@ -7467,7 +7884,7 @@ var responsesRunAdapter = function(param) {
7467
7884
  case 17:
7468
7885
  return [
7469
7886
  3,
7470
- 44
7887
+ 122
7471
7888
  ];
7472
7889
  case 18:
7473
7890
  _tmp9 = {
@@ -7493,7 +7910,7 @@ var responsesRunAdapter = function(param) {
7493
7910
  _state.sent();
7494
7911
  return [
7495
7912
  3,
7496
- 44
7913
+ 122
7497
7914
  ];
7498
7915
  case 21:
7499
7916
  return [
@@ -7506,7 +7923,7 @@ var responsesRunAdapter = function(param) {
7506
7923
  content: [
7507
7924
  {
7508
7925
  type: "text",
7509
- index: event.output_index - 1,
7926
+ index: event.content_index,
7510
7927
  text: {
7511
7928
  value: event.delta
7512
7929
  }
@@ -7520,7 +7937,7 @@ var responsesRunAdapter = function(param) {
7520
7937
  _state.sent();
7521
7938
  return [
7522
7939
  3,
7523
- 44
7940
+ 122
7524
7941
  ];
7525
7942
  case 23:
7526
7943
  if (!(event.item.type === "message")) return [
@@ -7528,11 +7945,10 @@ var responsesRunAdapter = function(param) {
7528
7945
  28
7529
7946
  ];
7530
7947
  _tmp11 = {
7531
- event: "thread.run.step.created"
7948
+ event: "thread.message.created"
7532
7949
  };
7533
7950
  _tmp12 = {
7534
7951
  item: event.item,
7535
- items: [],
7536
7952
  threadId: threadId
7537
7953
  };
7538
7954
  return [
@@ -7543,17 +7959,593 @@ var responsesRunAdapter = function(param) {
7543
7959
  return [
7544
7960
  4,
7545
7961
  onEvent2.apply(void 0, [
7546
- (_tmp11.data = serializeItemAsRunStep.apply(void 0, [
7547
- (_tmp12.openaiAssistant = _state.sent(), _tmp12.runId = responseCreatedResponse.id, _tmp12.status = "in_progress", _tmp12.completedAt = null, _tmp12)
7962
+ (_tmp11.data = serializeItemAsMessage.apply(void 0, [
7963
+ (_tmp12.openaiAssistant = _state.sent(), _tmp12.createdAt = (0, import_dayjs18.default)().unix(), _tmp12.runId = responseCreatedResponse.id, _tmp12.status = "in_progress", _tmp12)
7548
7964
  ]), _tmp11)
7549
7965
  ])
7550
7966
  ];
7551
7967
  case 25:
7552
7968
  _state.sent();
7553
7969
  _tmp13 = {
7554
- event: "thread.message.created"
7970
+ event: "thread.run.step.created"
7971
+ };
7972
+ _tmp14 = {
7973
+ item: event.item,
7974
+ items: [],
7975
+ threadId: threadId
7976
+ };
7977
+ return [
7978
+ 4,
7979
+ getOpenaiAssistant()
7980
+ ];
7981
+ case 26:
7982
+ return [
7983
+ 4,
7984
+ onEvent2.apply(void 0, [
7985
+ (_tmp13.data = serializeItemAsRunStep.apply(void 0, [
7986
+ (_tmp14.openaiAssistant = _state.sent(), _tmp14.runId = responseCreatedResponse.id, _tmp14.status = "in_progress", _tmp14.completedAt = null, _tmp14)
7987
+ ]), _tmp13)
7988
+ ])
7989
+ ];
7990
+ case 27:
7991
+ _state.sent();
7992
+ return [
7993
+ 3,
7994
+ 66
7995
+ ];
7996
+ case 28:
7997
+ if (!(event.item.type === "function_call")) return [
7998
+ 3,
7999
+ 31
8000
+ ];
8001
+ toolCalls[event.item.id] = event.item;
8002
+ _tmp15 = {
8003
+ event: "thread.run.step.created"
8004
+ };
8005
+ _tmp16 = {
8006
+ item: event.item,
8007
+ items: [],
8008
+ threadId: threadId
8009
+ };
8010
+ return [
8011
+ 4,
8012
+ getOpenaiAssistant()
8013
+ ];
8014
+ case 29:
8015
+ return [
8016
+ 4,
8017
+ onEvent2.apply(void 0, [
8018
+ (_tmp15.data = serializeItemAsRunStep.apply(void 0, [
8019
+ (_tmp16.openaiAssistant = _state.sent(), _tmp16.runId = responseCreatedResponse.id, _tmp16)
8020
+ ]), _tmp15)
8021
+ ])
8022
+ ];
8023
+ case 30:
8024
+ _state.sent();
8025
+ return [
8026
+ 3,
8027
+ 66
8028
+ ];
8029
+ case 31:
8030
+ if (!(event.item.type === "image_generation_call")) return [
8031
+ 3,
8032
+ 38
8033
+ ];
8034
+ _tmp17 = {
8035
+ event: "thread.message.created"
8036
+ };
8037
+ _tmp18 = {
8038
+ item: event.item,
8039
+ threadId: threadId
8040
+ };
8041
+ return [
8042
+ 4,
8043
+ getOpenaiAssistant()
8044
+ ];
8045
+ case 32:
8046
+ return [
8047
+ 4,
8048
+ onEvent2.apply(void 0, [
8049
+ (_tmp17.data = serializeItemAsMessage.apply(void 0, [
8050
+ (_tmp18.openaiAssistant = _state.sent(), _tmp18.createdAt = (0, import_dayjs18.default)().unix(), _tmp18.runId = responseCreatedResponse.id, _tmp18.status = "in_progress", _tmp18)
8051
+ ]), _tmp17)
8052
+ ])
8053
+ ];
8054
+ case 33:
8055
+ _state.sent();
8056
+ _tmp19 = {
8057
+ event: "thread.run.step.created"
8058
+ };
8059
+ _tmp20 = {
8060
+ item: event.item,
8061
+ items: [],
8062
+ threadId: threadId
8063
+ };
8064
+ return [
8065
+ 4,
8066
+ getOpenaiAssistant()
8067
+ ];
8068
+ case 34:
8069
+ return [
8070
+ 4,
8071
+ onEvent2.apply(void 0, [
8072
+ (_tmp19.data = serializeItemAsRunStep.apply(void 0, [
8073
+ (_tmp20.openaiAssistant = _state.sent(), _tmp20.runId = responseCreatedResponse.id, _tmp20.status = "in_progress", _tmp20.completedAt = null, _tmp20)
8074
+ ]), _tmp19)
8075
+ ])
8076
+ ];
8077
+ case 35:
8078
+ _state.sent();
8079
+ _tmp21 = {
8080
+ event: "thread.run.step.created"
8081
+ };
8082
+ _tmp22 = {
8083
+ item: event.item
8084
+ };
8085
+ return [
8086
+ 4,
8087
+ getOpenaiAssistant()
8088
+ ];
8089
+ case 36:
8090
+ return [
8091
+ 4,
8092
+ onEvent2.apply(void 0, [
8093
+ (_tmp21.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
8094
+ (_tmp22.openaiAssistant = _state.sent(), _tmp22.threadId = threadId, _tmp22.runId = responseCreatedResponse.id, _tmp22.completedAt = null, _tmp22)
8095
+ ]), _tmp21)
8096
+ ])
8097
+ ];
8098
+ case 37:
8099
+ _state.sent();
8100
+ return [
8101
+ 3,
8102
+ 66
8103
+ ];
8104
+ case 38:
8105
+ if (!(event.item.type === "web_search_call")) return [
8106
+ 3,
8107
+ 45
8108
+ ];
8109
+ _tmp23 = {
8110
+ event: "thread.message.created"
8111
+ };
8112
+ _tmp24 = {
8113
+ item: event.item,
8114
+ threadId: threadId
8115
+ };
8116
+ return [
8117
+ 4,
8118
+ getOpenaiAssistant()
8119
+ ];
8120
+ case 39:
8121
+ return [
8122
+ 4,
8123
+ onEvent2.apply(void 0, [
8124
+ (_tmp23.data = serializeItemAsMessage.apply(void 0, [
8125
+ (_tmp24.openaiAssistant = _state.sent(), _tmp24.createdAt = (0, import_dayjs18.default)().unix(), _tmp24.runId = responseCreatedResponse.id, _tmp24.status = "in_progress", _tmp24)
8126
+ ]), _tmp23)
8127
+ ])
8128
+ ];
8129
+ case 40:
8130
+ _state.sent();
8131
+ _tmp25 = {
8132
+ event: "thread.run.step.created"
8133
+ };
8134
+ _tmp26 = {
8135
+ item: event.item,
8136
+ items: [],
8137
+ threadId: threadId
8138
+ };
8139
+ return [
8140
+ 4,
8141
+ getOpenaiAssistant()
8142
+ ];
8143
+ case 41:
8144
+ return [
8145
+ 4,
8146
+ onEvent2.apply(void 0, [
8147
+ (_tmp25.data = serializeItemAsRunStep.apply(void 0, [
8148
+ (_tmp26.openaiAssistant = _state.sent(), _tmp26.runId = responseCreatedResponse.id, _tmp26.status = "in_progress", _tmp26.completedAt = null, _tmp26)
8149
+ ]), _tmp25)
8150
+ ])
8151
+ ];
8152
+ case 42:
8153
+ _state.sent();
8154
+ _tmp27 = {
8155
+ event: "thread.run.step.created"
8156
+ };
8157
+ _tmp28 = {
8158
+ item: event.item
8159
+ };
8160
+ return [
8161
+ 4,
8162
+ getOpenaiAssistant()
8163
+ ];
8164
+ case 43:
8165
+ return [
8166
+ 4,
8167
+ onEvent2.apply(void 0, [
8168
+ (_tmp27.data = serializeItemAsWebSearchRunStep.apply(void 0, [
8169
+ (_tmp28.openaiAssistant = _state.sent(), _tmp28.threadId = threadId, _tmp28.runId = responseCreatedResponse.id, _tmp28.completedAt = null, _tmp28)
8170
+ ]), _tmp27)
8171
+ ])
8172
+ ];
8173
+ case 44:
8174
+ _state.sent();
8175
+ return [
8176
+ 3,
8177
+ 66
8178
+ ];
8179
+ case 45:
8180
+ if (!(event.item.type === "mcp_list_tools")) return [
8181
+ 3,
8182
+ 52
8183
+ ];
8184
+ _tmp29 = {
8185
+ event: "thread.message.created"
8186
+ };
8187
+ _tmp30 = {
8188
+ item: event.item,
8189
+ threadId: threadId
8190
+ };
8191
+ return [
8192
+ 4,
8193
+ getOpenaiAssistant()
8194
+ ];
8195
+ case 46:
8196
+ return [
8197
+ 4,
8198
+ onEvent2.apply(void 0, [
8199
+ (_tmp29.data = serializeItemAsMessage.apply(void 0, [
8200
+ (_tmp30.openaiAssistant = _state.sent(), _tmp30.createdAt = (0, import_dayjs18.default)().unix(), _tmp30.runId = responseCreatedResponse.id, _tmp30.status = "in_progress", _tmp30)
8201
+ ]), _tmp29)
8202
+ ])
8203
+ ];
8204
+ case 47:
8205
+ _state.sent();
8206
+ _tmp31 = {
8207
+ event: "thread.run.step.created"
8208
+ };
8209
+ _tmp32 = {
8210
+ item: event.item,
8211
+ items: [],
8212
+ threadId: threadId
8213
+ };
8214
+ return [
8215
+ 4,
8216
+ getOpenaiAssistant()
8217
+ ];
8218
+ case 48:
8219
+ return [
8220
+ 4,
8221
+ onEvent2.apply(void 0, [
8222
+ (_tmp31.data = serializeItemAsRunStep.apply(void 0, [
8223
+ (_tmp32.openaiAssistant = _state.sent(), _tmp32.runId = responseCreatedResponse.id, _tmp32.status = "in_progress", _tmp32.completedAt = null, _tmp32)
8224
+ ]), _tmp31)
8225
+ ])
8226
+ ];
8227
+ case 49:
8228
+ _state.sent();
8229
+ _tmp33 = {
8230
+ event: "thread.run.step.created"
8231
+ };
8232
+ _tmp34 = {
8233
+ item: event.item
8234
+ };
8235
+ return [
8236
+ 4,
8237
+ getOpenaiAssistant()
8238
+ ];
8239
+ case 50:
8240
+ return [
8241
+ 4,
8242
+ onEvent2.apply(void 0, [
8243
+ (_tmp33.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
8244
+ (_tmp34.openaiAssistant = _state.sent(), _tmp34.threadId = threadId, _tmp34.runId = responseCreatedResponse.id, _tmp34.completedAt = null, _tmp34)
8245
+ ]), _tmp33)
8246
+ ])
8247
+ ];
8248
+ case 51:
8249
+ _state.sent();
8250
+ return [
8251
+ 3,
8252
+ 66
8253
+ ];
8254
+ case 52:
8255
+ if (!(event.item.type === "mcp_call")) return [
8256
+ 3,
8257
+ 59
8258
+ ];
8259
+ mcpCalls[event.item.id] = event.item;
8260
+ _tmp35 = {
8261
+ event: "thread.message.created"
8262
+ };
8263
+ _tmp36 = {
8264
+ item: event.item,
8265
+ threadId: threadId
8266
+ };
8267
+ return [
8268
+ 4,
8269
+ getOpenaiAssistant()
8270
+ ];
8271
+ case 53:
8272
+ return [
8273
+ 4,
8274
+ onEvent2.apply(void 0, [
8275
+ (_tmp35.data = serializeItemAsMessage.apply(void 0, [
8276
+ (_tmp36.openaiAssistant = _state.sent(), _tmp36.createdAt = (0, import_dayjs18.default)().unix(), _tmp36.runId = responseCreatedResponse.id, _tmp36.status = "in_progress", _tmp36)
8277
+ ]), _tmp35)
8278
+ ])
8279
+ ];
8280
+ case 54:
8281
+ _state.sent();
8282
+ _tmp37 = {
8283
+ event: "thread.run.step.created"
8284
+ };
8285
+ _tmp38 = {
8286
+ item: event.item,
8287
+ items: [],
8288
+ threadId: threadId
8289
+ };
8290
+ return [
8291
+ 4,
8292
+ getOpenaiAssistant()
8293
+ ];
8294
+ case 55:
8295
+ return [
8296
+ 4,
8297
+ onEvent2.apply(void 0, [
8298
+ (_tmp37.data = serializeItemAsRunStep.apply(void 0, [
8299
+ (_tmp38.openaiAssistant = _state.sent(), _tmp38.runId = responseCreatedResponse.id, _tmp38.status = "in_progress", _tmp38.completedAt = null, _tmp38)
8300
+ ]), _tmp37)
8301
+ ])
8302
+ ];
8303
+ case 56:
8304
+ _state.sent();
8305
+ _tmp39 = {
8306
+ event: "thread.run.step.created"
8307
+ };
8308
+ _tmp40 = {
8309
+ item: event.item
8310
+ };
8311
+ return [
8312
+ 4,
8313
+ getOpenaiAssistant()
8314
+ ];
8315
+ case 57:
8316
+ return [
8317
+ 4,
8318
+ onEvent2.apply(void 0, [
8319
+ (_tmp39.data = serializeItemAsMcpCallRunStep.apply(void 0, [
8320
+ (_tmp40.openaiAssistant = _state.sent(), _tmp40.threadId = threadId, _tmp40.runId = responseCreatedResponse.id, _tmp40.completedAt = null, _tmp40)
8321
+ ]), _tmp39)
8322
+ ])
8323
+ ];
8324
+ case 58:
8325
+ _state.sent();
8326
+ return [
8327
+ 3,
8328
+ 66
8329
+ ];
8330
+ case 59:
8331
+ if (!(event.item.type === "code_interpreter_call")) return [
8332
+ 3,
8333
+ 66
8334
+ ];
8335
+ codeInterpreterCalls[event.item.id] = event.item;
8336
+ _tmp41 = {
8337
+ event: "thread.message.created"
8338
+ };
8339
+ _tmp42 = {
8340
+ item: event.item,
8341
+ threadId: threadId
8342
+ };
8343
+ return [
8344
+ 4,
8345
+ getOpenaiAssistant()
8346
+ ];
8347
+ case 60:
8348
+ return [
8349
+ 4,
8350
+ onEvent2.apply(void 0, [
8351
+ (_tmp41.data = serializeItemAsMessage.apply(void 0, [
8352
+ (_tmp42.openaiAssistant = _state.sent(), _tmp42.createdAt = (0, import_dayjs18.default)().unix(), _tmp42.runId = responseCreatedResponse.id, _tmp42.status = "in_progress", _tmp42)
8353
+ ]), _tmp41)
8354
+ ])
8355
+ ];
8356
+ case 61:
8357
+ _state.sent();
8358
+ _tmp43 = {
8359
+ event: "thread.run.step.created"
8360
+ };
8361
+ _tmp44 = {
8362
+ item: event.item,
8363
+ items: [],
8364
+ threadId: threadId
8365
+ };
8366
+ return [
8367
+ 4,
8368
+ getOpenaiAssistant()
8369
+ ];
8370
+ case 62:
8371
+ return [
8372
+ 4,
8373
+ onEvent2.apply(void 0, [
8374
+ (_tmp43.data = serializeItemAsRunStep.apply(void 0, [
8375
+ (_tmp44.openaiAssistant = _state.sent(), _tmp44.runId = responseCreatedResponse.id, _tmp44.status = "in_progress", _tmp44.completedAt = null, _tmp44)
8376
+ ]), _tmp43)
8377
+ ])
8378
+ ];
8379
+ case 63:
8380
+ _state.sent();
8381
+ _tmp45 = {
8382
+ event: "thread.run.step.created"
8383
+ };
8384
+ _tmp46 = {
8385
+ item: event.item
8386
+ };
8387
+ return [
8388
+ 4,
8389
+ getOpenaiAssistant()
8390
+ ];
8391
+ case 64:
8392
+ return [
8393
+ 4,
8394
+ onEvent2.apply(void 0, [
8395
+ (_tmp45.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
8396
+ (_tmp46.openaiAssistant = _state.sent(), _tmp46.threadId = threadId, _tmp46.runId = responseCreatedResponse.id, _tmp46.completedAt = null, _tmp46)
8397
+ ]), _tmp45)
8398
+ ])
8399
+ ];
8400
+ case 65:
8401
+ _state.sent();
8402
+ _state.label = 66;
8403
+ case 66:
8404
+ if (event.item.id) itemIds.push(event.item.id);
8405
+ return [
8406
+ 3,
8407
+ 122
8408
+ ];
8409
+ case 67:
8410
+ if (!(event.item.type === "message")) return [
8411
+ 3,
8412
+ 72
8413
+ ];
8414
+ _tmp47 = {
8415
+ event: "thread.run.step.completed"
8416
+ };
8417
+ _tmp48 = {
8418
+ item: event.item,
8419
+ items: [],
8420
+ threadId: threadId
8421
+ };
8422
+ return [
8423
+ 4,
8424
+ getOpenaiAssistant()
8425
+ ];
8426
+ case 68:
8427
+ return [
8428
+ 4,
8429
+ onEvent2.apply(void 0, [
8430
+ (_tmp47.data = serializeItemAsRunStep.apply(void 0, [
8431
+ (_tmp48.openaiAssistant = _state.sent(), _tmp48.runId = responseCreatedResponse.id, _tmp48)
8432
+ ]), _tmp47)
8433
+ ])
8434
+ ];
8435
+ case 69:
8436
+ _state.sent();
8437
+ _tmp49 = {
8438
+ event: "thread.message.completed"
8439
+ };
8440
+ _tmp50 = {
8441
+ item: event.item,
8442
+ threadId: threadId
8443
+ };
8444
+ return [
8445
+ 4,
8446
+ getOpenaiAssistant()
8447
+ ];
8448
+ case 70:
8449
+ return [
8450
+ 4,
8451
+ onEvent2.apply(void 0, [
8452
+ (_tmp49.data = serializeItemAsMessage.apply(void 0, [
8453
+ (_tmp50.openaiAssistant = _state.sent(), _tmp50.createdAt = (0, import_dayjs18.default)().unix(), _tmp50.runId = responseCreatedResponse.id, _tmp50)
8454
+ ]), _tmp49)
8455
+ ])
8456
+ ];
8457
+ case 71:
8458
+ _state.sent();
8459
+ return [
8460
+ 3,
8461
+ 110
8462
+ ];
8463
+ case 72:
8464
+ if (!(event.item.type === "function_call")) return [
8465
+ 3,
8466
+ 75
8467
+ ];
8468
+ toolCalls[event.item.id] = event.item;
8469
+ _tmp51 = {
8470
+ event: "thread.run.step.in_progress"
8471
+ };
8472
+ _tmp52 = {
8473
+ item: event.item,
8474
+ items: [],
8475
+ threadId: threadId
8476
+ };
8477
+ return [
8478
+ 4,
8479
+ getOpenaiAssistant()
8480
+ ];
8481
+ case 73:
8482
+ return [
8483
+ 4,
8484
+ onEvent2.apply(void 0, [
8485
+ (_tmp51.data = serializeItemAsRunStep.apply(void 0, [
8486
+ (_tmp52.openaiAssistant = _state.sent(), _tmp52.runId = responseCreatedResponse.id, _tmp52)
8487
+ ]), _tmp51)
8488
+ ])
8489
+ ];
8490
+ case 74:
8491
+ _state.sent();
8492
+ return [
8493
+ 3,
8494
+ 110
8495
+ ];
8496
+ case 75:
8497
+ if (!(event.item.type === "image_generation_call")) return [
8498
+ 3,
8499
+ 82
8500
+ ];
8501
+ _tmp53 = {
8502
+ event: "thread.run.step.completed"
8503
+ };
8504
+ _tmp54 = {
8505
+ item: event.item
8506
+ };
8507
+ return [
8508
+ 4,
8509
+ getOpenaiAssistant()
8510
+ ];
8511
+ case 76:
8512
+ return [
8513
+ 4,
8514
+ onEvent2.apply(void 0, [
8515
+ (_tmp53.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
8516
+ (_tmp54.openaiAssistant = _state.sent(), _tmp54.threadId = threadId, _tmp54.runId = responseCreatedResponse.id, _tmp54)
8517
+ ]), _tmp53)
8518
+ ])
8519
+ ];
8520
+ case 77:
8521
+ _state.sent();
8522
+ _tmp55 = {
8523
+ event: "thread.run.step.completed"
8524
+ };
8525
+ _tmp56 = {
8526
+ item: event.item,
8527
+ items: [],
8528
+ threadId: threadId
8529
+ };
8530
+ return [
8531
+ 4,
8532
+ getOpenaiAssistant()
8533
+ ];
8534
+ case 78:
8535
+ return [
8536
+ 4,
8537
+ onEvent2.apply(void 0, [
8538
+ (_tmp55.data = serializeItemAsRunStep.apply(void 0, [
8539
+ (_tmp56.openaiAssistant = _state.sent(), _tmp56.runId = responseCreatedResponse.id, _tmp56)
8540
+ ]), _tmp55)
8541
+ ])
8542
+ ];
8543
+ case 79:
8544
+ _state.sent();
8545
+ _tmp57 = {
8546
+ event: "thread.message.completed"
7555
8547
  };
7556
- _tmp14 = {
8548
+ _tmp58 = {
7557
8549
  item: event.item,
7558
8550
  threadId: threadId
7559
8551
  };
@@ -7561,31 +8553,51 @@ var responsesRunAdapter = function(param) {
7561
8553
  4,
7562
8554
  getOpenaiAssistant()
7563
8555
  ];
7564
- case 26:
8556
+ case 80:
7565
8557
  return [
7566
8558
  4,
7567
8559
  onEvent2.apply(void 0, [
7568
- (_tmp13.data = serializeItemAsMessage.apply(void 0, [
7569
- (_tmp14.openaiAssistant = _state.sent(), _tmp14.createdAt = (0, import_dayjs13.default)().unix(), _tmp14.runId = responseCreatedResponse.id, _tmp14.status = "in_progress", _tmp14)
7570
- ]), _tmp13)
8560
+ (_tmp57.data = serializeItemAsMessage.apply(void 0, [
8561
+ (_tmp58.openaiAssistant = _state.sent(), _tmp58.createdAt = (0, import_dayjs18.default)().unix(), _tmp58.runId = responseCreatedResponse.id, _tmp58)
8562
+ ]), _tmp57)
7571
8563
  ])
7572
8564
  ];
7573
- case 27:
8565
+ case 81:
7574
8566
  _state.sent();
7575
8567
  return [
7576
8568
  3,
7577
- 31
8569
+ 110
7578
8570
  ];
7579
- case 28:
7580
- if (!(event.item.type === "function_call")) return [
8571
+ case 82:
8572
+ if (!(event.item.type === "web_search_call")) return [
7581
8573
  3,
7582
- 31
8574
+ 89
7583
8575
  ];
7584
- toolCalls[event.item.id] = event.item;
7585
- _tmp15 = {
7586
- event: "thread.run.step.created"
8576
+ _tmp59 = {
8577
+ event: "thread.run.step.completed"
7587
8578
  };
7588
- _tmp16 = {
8579
+ _tmp60 = {
8580
+ item: event.item
8581
+ };
8582
+ return [
8583
+ 4,
8584
+ getOpenaiAssistant()
8585
+ ];
8586
+ case 83:
8587
+ return [
8588
+ 4,
8589
+ onEvent2.apply(void 0, [
8590
+ (_tmp59.data = serializeItemAsWebSearchRunStep.apply(void 0, [
8591
+ (_tmp60.openaiAssistant = _state.sent(), _tmp60.threadId = threadId, _tmp60.runId = responseCreatedResponse.id, _tmp60)
8592
+ ]), _tmp59)
8593
+ ])
8594
+ ];
8595
+ case 84:
8596
+ _state.sent();
8597
+ _tmp61 = {
8598
+ event: "thread.run.step.completed"
8599
+ };
8600
+ _tmp62 = {
7589
8601
  item: event.item,
7590
8602
  items: [],
7591
8603
  threadId: threadId
@@ -7594,33 +8606,73 @@ var responsesRunAdapter = function(param) {
7594
8606
  4,
7595
8607
  getOpenaiAssistant()
7596
8608
  ];
7597
- case 29:
8609
+ case 85:
7598
8610
  return [
7599
8611
  4,
7600
8612
  onEvent2.apply(void 0, [
7601
- (_tmp15.data = serializeItemAsRunStep.apply(void 0, [
7602
- (_tmp16.openaiAssistant = _state.sent(), _tmp16.runId = responseCreatedResponse.id, _tmp16)
7603
- ]), _tmp15)
8613
+ (_tmp61.data = serializeItemAsRunStep.apply(void 0, [
8614
+ (_tmp62.openaiAssistant = _state.sent(), _tmp62.runId = responseCreatedResponse.id, _tmp62)
8615
+ ]), _tmp61)
7604
8616
  ])
7605
8617
  ];
7606
- case 30:
8618
+ case 86:
8619
+ _state.sent();
8620
+ _tmp63 = {
8621
+ event: "thread.message.completed"
8622
+ };
8623
+ _tmp64 = {
8624
+ item: event.item,
8625
+ threadId: threadId
8626
+ };
8627
+ return [
8628
+ 4,
8629
+ getOpenaiAssistant()
8630
+ ];
8631
+ case 87:
8632
+ return [
8633
+ 4,
8634
+ onEvent2.apply(void 0, [
8635
+ (_tmp63.data = serializeItemAsMessage.apply(void 0, [
8636
+ (_tmp64.openaiAssistant = _state.sent(), _tmp64.createdAt = (0, import_dayjs18.default)().unix(), _tmp64.runId = responseCreatedResponse.id, _tmp64)
8637
+ ]), _tmp63)
8638
+ ])
8639
+ ];
8640
+ case 88:
7607
8641
  _state.sent();
7608
- _state.label = 31;
7609
- case 31:
7610
- if (event.item.id) itemIds.push(event.item.id);
7611
8642
  return [
7612
8643
  3,
7613
- 44
8644
+ 110
7614
8645
  ];
7615
- case 32:
7616
- if (!(event.item.type === "message")) return [
8646
+ case 89:
8647
+ if (!(event.item.type === "mcp_list_tools")) return [
7617
8648
  3,
7618
- 37
8649
+ 96
7619
8650
  ];
7620
- _tmp17 = {
8651
+ _tmp65 = {
7621
8652
  event: "thread.run.step.completed"
7622
8653
  };
7623
- _tmp18 = {
8654
+ _tmp66 = {
8655
+ item: event.item
8656
+ };
8657
+ return [
8658
+ 4,
8659
+ getOpenaiAssistant()
8660
+ ];
8661
+ case 90:
8662
+ return [
8663
+ 4,
8664
+ onEvent2.apply(void 0, [
8665
+ (_tmp65.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
8666
+ (_tmp66.openaiAssistant = _state.sent(), _tmp66.threadId = threadId, _tmp66.runId = responseCreatedResponse.id, _tmp66)
8667
+ ]), _tmp65)
8668
+ ])
8669
+ ];
8670
+ case 91:
8671
+ _state.sent();
8672
+ _tmp67 = {
8673
+ event: "thread.run.step.completed"
8674
+ };
8675
+ _tmp68 = {
7624
8676
  item: event.item,
7625
8677
  items: [],
7626
8678
  threadId: threadId
@@ -7629,21 +8681,21 @@ var responsesRunAdapter = function(param) {
7629
8681
  4,
7630
8682
  getOpenaiAssistant()
7631
8683
  ];
7632
- case 33:
8684
+ case 92:
7633
8685
  return [
7634
8686
  4,
7635
8687
  onEvent2.apply(void 0, [
7636
- (_tmp17.data = serializeItemAsRunStep.apply(void 0, [
7637
- (_tmp18.openaiAssistant = _state.sent(), _tmp18.runId = responseCreatedResponse.id, _tmp18)
7638
- ]), _tmp17)
8688
+ (_tmp67.data = serializeItemAsRunStep.apply(void 0, [
8689
+ (_tmp68.openaiAssistant = _state.sent(), _tmp68.runId = responseCreatedResponse.id, _tmp68)
8690
+ ]), _tmp67)
7639
8691
  ])
7640
8692
  ];
7641
- case 34:
8693
+ case 93:
7642
8694
  _state.sent();
7643
- _tmp19 = {
8695
+ _tmp69 = {
7644
8696
  event: "thread.message.completed"
7645
8697
  };
7646
- _tmp20 = {
8698
+ _tmp70 = {
7647
8699
  item: event.item,
7648
8700
  threadId: threadId
7649
8701
  };
@@ -7651,31 +8703,51 @@ var responsesRunAdapter = function(param) {
7651
8703
  4,
7652
8704
  getOpenaiAssistant()
7653
8705
  ];
7654
- case 35:
8706
+ case 94:
7655
8707
  return [
7656
8708
  4,
7657
8709
  onEvent2.apply(void 0, [
7658
- (_tmp19.data = serializeItemAsMessage.apply(void 0, [
7659
- (_tmp20.openaiAssistant = _state.sent(), _tmp20.createdAt = (0, import_dayjs13.default)().unix(), _tmp20.runId = responseCreatedResponse.id, _tmp20)
7660
- ]), _tmp19)
8710
+ (_tmp69.data = serializeItemAsMessage.apply(void 0, [
8711
+ (_tmp70.openaiAssistant = _state.sent(), _tmp70.createdAt = (0, import_dayjs18.default)().unix(), _tmp70.runId = responseCreatedResponse.id, _tmp70)
8712
+ ]), _tmp69)
7661
8713
  ])
7662
8714
  ];
7663
- case 36:
8715
+ case 95:
7664
8716
  _state.sent();
7665
8717
  return [
7666
8718
  3,
7667
- 40
8719
+ 110
7668
8720
  ];
7669
- case 37:
7670
- if (!(event.item.type === "function_call")) return [
8721
+ case 96:
8722
+ if (!(event.item.type === "mcp_call")) return [
7671
8723
  3,
7672
- 40
8724
+ 103
7673
8725
  ];
7674
- toolCalls[event.item.id] = event.item;
7675
- _tmp21 = {
7676
- event: "thread.run.step.in_progress"
8726
+ _tmp71 = {
8727
+ event: "thread.run.step.completed"
7677
8728
  };
7678
- _tmp22 = {
8729
+ _tmp72 = {
8730
+ item: event.item
8731
+ };
8732
+ return [
8733
+ 4,
8734
+ getOpenaiAssistant()
8735
+ ];
8736
+ case 97:
8737
+ return [
8738
+ 4,
8739
+ onEvent2.apply(void 0, [
8740
+ (_tmp71.data = serializeItemAsMcpCallRunStep.apply(void 0, [
8741
+ (_tmp72.openaiAssistant = _state.sent(), _tmp72.threadId = threadId, _tmp72.runId = responseCreatedResponse.id, _tmp72)
8742
+ ]), _tmp71)
8743
+ ])
8744
+ ];
8745
+ case 98:
8746
+ _state.sent();
8747
+ _tmp73 = {
8748
+ event: "thread.run.step.completed"
8749
+ };
8750
+ _tmp74 = {
7679
8751
  item: event.item,
7680
8752
  items: [],
7681
8753
  threadId: threadId
@@ -7684,28 +8756,125 @@ var responsesRunAdapter = function(param) {
7684
8756
  4,
7685
8757
  getOpenaiAssistant()
7686
8758
  ];
7687
- case 38:
8759
+ case 99:
7688
8760
  return [
7689
8761
  4,
7690
8762
  onEvent2.apply(void 0, [
7691
- (_tmp21.data = serializeItemAsRunStep.apply(void 0, [
7692
- (_tmp22.openaiAssistant = _state.sent(), _tmp22.runId = responseCreatedResponse.id, _tmp22)
7693
- ]), _tmp21)
8763
+ (_tmp73.data = serializeItemAsRunStep.apply(void 0, [
8764
+ (_tmp74.openaiAssistant = _state.sent(), _tmp74.runId = responseCreatedResponse.id, _tmp74)
8765
+ ]), _tmp73)
7694
8766
  ])
7695
8767
  ];
7696
- case 39:
8768
+ case 100:
8769
+ _state.sent();
8770
+ _tmp75 = {
8771
+ event: "thread.message.completed"
8772
+ };
8773
+ _tmp76 = {
8774
+ item: event.item,
8775
+ threadId: threadId
8776
+ };
8777
+ return [
8778
+ 4,
8779
+ getOpenaiAssistant()
8780
+ ];
8781
+ case 101:
8782
+ return [
8783
+ 4,
8784
+ onEvent2.apply(void 0, [
8785
+ (_tmp75.data = serializeItemAsMessage.apply(void 0, [
8786
+ (_tmp76.openaiAssistant = _state.sent(), _tmp76.createdAt = (0, import_dayjs18.default)().unix(), _tmp76.runId = responseCreatedResponse.id, _tmp76)
8787
+ ]), _tmp75)
8788
+ ])
8789
+ ];
8790
+ case 102:
7697
8791
  _state.sent();
7698
- _state.label = 40;
7699
- case 40:
7700
8792
  return [
7701
8793
  3,
7702
- 44
8794
+ 110
7703
8795
  ];
7704
- case 41:
8796
+ case 103:
8797
+ if (!(event.item.type === "code_interpreter_call")) return [
8798
+ 3,
8799
+ 110
8800
+ ];
8801
+ _tmp77 = {
8802
+ event: "thread.run.step.completed"
8803
+ };
8804
+ _tmp78 = {
8805
+ item: event.item
8806
+ };
8807
+ return [
8808
+ 4,
8809
+ getOpenaiAssistant()
8810
+ ];
8811
+ case 104:
8812
+ return [
8813
+ 4,
8814
+ onEvent2.apply(void 0, [
8815
+ (_tmp77.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
8816
+ (_tmp78.openaiAssistant = _state.sent(), _tmp78.threadId = threadId, _tmp78.runId = responseCreatedResponse.id, _tmp78)
8817
+ ]), _tmp77)
8818
+ ])
8819
+ ];
8820
+ case 105:
8821
+ _state.sent();
8822
+ _tmp79 = {
8823
+ event: "thread.run.step.completed"
8824
+ };
8825
+ _tmp80 = {
8826
+ item: event.item,
8827
+ items: [],
8828
+ threadId: threadId
8829
+ };
8830
+ return [
8831
+ 4,
8832
+ getOpenaiAssistant()
8833
+ ];
8834
+ case 106:
8835
+ return [
8836
+ 4,
8837
+ onEvent2.apply(void 0, [
8838
+ (_tmp79.data = serializeItemAsRunStep.apply(void 0, [
8839
+ (_tmp80.openaiAssistant = _state.sent(), _tmp80.runId = responseCreatedResponse.id, _tmp80)
8840
+ ]), _tmp79)
8841
+ ])
8842
+ ];
8843
+ case 107:
8844
+ _state.sent();
8845
+ _tmp81 = {
8846
+ event: "thread.message.completed"
8847
+ };
8848
+ _tmp82 = {
8849
+ item: event.item,
8850
+ threadId: threadId
8851
+ };
8852
+ return [
8853
+ 4,
8854
+ getOpenaiAssistant()
8855
+ ];
8856
+ case 108:
8857
+ return [
8858
+ 4,
8859
+ onEvent2.apply(void 0, [
8860
+ (_tmp81.data = serializeItemAsMessage.apply(void 0, [
8861
+ (_tmp82.openaiAssistant = _state.sent(), _tmp82.createdAt = (0, import_dayjs18.default)().unix(), _tmp82.runId = responseCreatedResponse.id, _tmp82)
8862
+ ]), _tmp81)
8863
+ ])
8864
+ ];
8865
+ case 109:
8866
+ _state.sent();
8867
+ _state.label = 110;
8868
+ case 110:
8869
+ return [
8870
+ 3,
8871
+ 122
8872
+ ];
8873
+ case 111:
7705
8874
  toolCall = toolCalls[event.item_id];
7706
8875
  if (!toolCall) return [
7707
8876
  3,
7708
- 44
8877
+ 122
7709
8878
  ];
7710
8879
  return [
7711
8880
  4,
@@ -7734,82 +8903,200 @@ var responsesRunAdapter = function(param) {
7734
8903
  }
7735
8904
  })
7736
8905
  ];
7737
- case 42:
8906
+ case 112:
7738
8907
  _state.sent();
7739
8908
  return [
7740
8909
  3,
7741
- 44
8910
+ 122
7742
8911
  ];
7743
- case 43:
8912
+ case 113:
8913
+ mcpCall = mcpCalls[event.item_id];
8914
+ if (!mcpCall) return [
8915
+ 3,
8916
+ 122
8917
+ ];
8918
+ return [
8919
+ 4,
8920
+ onEvent2({
8921
+ event: "thread.run.step.delta",
8922
+ data: {
8923
+ id: "fc".concat(event.item_id),
8924
+ object: "thread.run.step.delta",
8925
+ delta: {
8926
+ step_details: {
8927
+ type: "tool_calls",
8928
+ tool_calls: [
8929
+ {
8930
+ id: "ftc".concat(mcpCall.id),
8931
+ type: "function",
8932
+ index: event.output_index,
8933
+ function: {
8934
+ name: mcpCall.name,
8935
+ arguments: event.delta,
8936
+ output: null
8937
+ }
8938
+ }
8939
+ ]
8940
+ }
8941
+ }
8942
+ }
8943
+ })
8944
+ ];
8945
+ case 114:
8946
+ _state.sent();
7744
8947
  return [
7745
8948
  3,
7746
- 44
8949
+ 122
7747
8950
  ];
7748
- case 44:
8951
+ case 115:
8952
+ _tmp83 = {
8953
+ event: "thread.message.in_progress"
8954
+ };
8955
+ _tmp84 = {
8956
+ id: event.item_id,
8957
+ object: "thread.message",
8958
+ created_at: (0, import_dayjs18.default)().unix(),
8959
+ thread_id: threadId,
8960
+ completed_at: null,
8961
+ incomplete_at: null,
8962
+ incomplete_details: null,
8963
+ role: "assistant",
8964
+ content: []
8965
+ };
8966
+ return [
8967
+ 4,
8968
+ getOpenaiAssistant()
8969
+ ];
8970
+ case 116:
8971
+ return [
8972
+ 4,
8973
+ onEvent2.apply(void 0, [
8974
+ (_tmp83.data = (_tmp84.assistant_id = _state.sent().id, _tmp84.run_id = responseCreatedResponse.id, _tmp84.attachments = [], _tmp84.status = "in_progress", _tmp84.metadata = {
8975
+ event: JSON.stringify(event)
8976
+ }, _tmp84), _tmp83)
8977
+ ])
8978
+ ];
8979
+ case 117:
8980
+ _state.sent();
8981
+ return [
8982
+ 3,
8983
+ 122
8984
+ ];
8985
+ case 118:
8986
+ _tmp85 = {
8987
+ event: "thread.message.in_progress"
8988
+ };
8989
+ _tmp86 = {
8990
+ id: event.item_id,
8991
+ object: "thread.message",
8992
+ created_at: (0, import_dayjs18.default)().unix(),
8993
+ thread_id: threadId,
8994
+ completed_at: null,
8995
+ incomplete_at: null,
8996
+ incomplete_details: null,
8997
+ role: "assistant",
8998
+ content: [
8999
+ {
9000
+ type: "image_url",
9001
+ image_url: {
9002
+ url: "data:image/png;base64,".concat(event.partial_image_b64),
9003
+ // url: `data:image/png;base64,truncated`,
9004
+ detail: "auto"
9005
+ }
9006
+ }
9007
+ ]
9008
+ };
9009
+ return [
9010
+ 4,
9011
+ getOpenaiAssistant()
9012
+ ];
9013
+ case 119:
9014
+ return [
9015
+ 4,
9016
+ onEvent2.apply(void 0, [
9017
+ (_tmp85.data = (_tmp86.assistant_id = _state.sent().id, _tmp86.run_id = responseCreatedResponse.id, _tmp86.attachments = [], _tmp86.status = "in_progress", _tmp86.metadata = {
9018
+ event: JSON.stringify(_object_spread_props(_object_spread({}, event), {
9019
+ partial_image_b64: "truncated"
9020
+ }))
9021
+ }, _tmp86), _tmp85)
9022
+ ])
9023
+ ];
9024
+ case 120:
9025
+ _state.sent();
9026
+ return [
9027
+ 3,
9028
+ 122
9029
+ ];
9030
+ case 121:
9031
+ return [
9032
+ 3,
9033
+ 122
9034
+ ];
9035
+ case 122:
7749
9036
  _iteratorAbruptCompletion = false;
7750
9037
  return [
7751
9038
  3,
7752
9039
  3
7753
9040
  ];
7754
- case 45:
9041
+ case 123:
7755
9042
  return [
7756
9043
  3,
7757
- 52
9044
+ 130
7758
9045
  ];
7759
- case 46:
9046
+ case 124:
7760
9047
  err = _state.sent();
7761
9048
  _didIteratorError = true;
7762
9049
  _iteratorError = err;
7763
9050
  return [
7764
9051
  3,
7765
- 52
9052
+ 130
7766
9053
  ];
7767
- case 47:
9054
+ case 125:
7768
9055
  _state.trys.push([
7769
- 47,
9056
+ 125,
7770
9057
  ,
7771
- 50,
7772
- 51
9058
+ 128,
9059
+ 129
7773
9060
  ]);
7774
9061
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
7775
9062
  3,
7776
- 49
9063
+ 127
7777
9064
  ];
7778
9065
  return [
7779
9066
  4,
7780
9067
  _iterator.return()
7781
9068
  ];
7782
- case 48:
9069
+ case 126:
7783
9070
  _state.sent();
7784
- _state.label = 49;
7785
- case 49:
9071
+ _state.label = 127;
9072
+ case 127:
7786
9073
  return [
7787
9074
  3,
7788
- 51
9075
+ 129
7789
9076
  ];
7790
- case 50:
9077
+ case 128:
7791
9078
  if (_didIteratorError) {
7792
9079
  throw _iteratorError;
7793
9080
  }
7794
9081
  return [
7795
9082
  7
7796
9083
  ];
7797
- case 51:
9084
+ case 129:
7798
9085
  return [
7799
9086
  7
7800
9087
  ];
7801
- case 52:
9088
+ case 130:
7802
9089
  return [
7803
9090
  3,
7804
- 59
9091
+ 137
7805
9092
  ];
7806
- case 53:
9093
+ case 131:
7807
9094
  e = _state.sent();
7808
- _tmp23 = {
9095
+ _tmp87 = {
7809
9096
  event: "thread.run.failed"
7810
9097
  };
7811
- _tmp24 = {
7812
- id: (responseCreatedResponse === null || responseCreatedResponse === void 0 ? void 0 : responseCreatedResponse.id) || "run_".concat((0, import_radash21.uid)(18)),
9098
+ _tmp88 = {
9099
+ id: (responseCreatedResponse === null || responseCreatedResponse === void 0 ? void 0 : responseCreatedResponse.id) || "run_".concat((0, import_radash20.uid)(18)),
7813
9100
  object: "thread.run",
7814
9101
  thread_id: threadId
7815
9102
  };
@@ -7817,26 +9104,26 @@ var responsesRunAdapter = function(param) {
7817
9104
  4,
7818
9105
  getOpenaiAssistant()
7819
9106
  ];
7820
- case 54:
9107
+ case 132:
7821
9108
  return [
7822
9109
  4,
7823
9110
  onEvent2.apply(void 0, [
7824
- (_tmp23.data = (_tmp24.assistant_id = _state.sent().id, _tmp24.status = "failed", _tmp24.failed_at = (0, import_dayjs13.default)().unix(), _tmp24.last_error = {
9111
+ (_tmp87.data = (_tmp88.assistant_id = _state.sent().id, _tmp88.status = "failed", _tmp88.failed_at = (0, import_dayjs18.default)().unix(), _tmp88.last_error = {
7825
9112
  code: "server_error",
7826
9113
  message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
7827
- }, _tmp24), _tmp23)
9114
+ }, _tmp88), _tmp87)
7828
9115
  ])
7829
9116
  ];
7830
- case 55:
9117
+ case 133:
7831
9118
  _state.sent();
7832
9119
  return [
7833
9120
  3,
7834
- 59
9121
+ 137
7835
9122
  ];
7836
- case 56:
9123
+ case 134:
7837
9124
  if (!((responseCreatedResponse === null || responseCreatedResponse === void 0 ? void 0 : responseCreatedResponse.id) && itemIds.length > 0)) return [
7838
9125
  3,
7839
- 58
9126
+ 136
7840
9127
  ];
7841
9128
  return [
7842
9129
  4,
@@ -7847,14 +9134,14 @@ var responsesRunAdapter = function(param) {
7847
9134
  itemIds: itemIds
7848
9135
  })
7849
9136
  ];
7850
- case 57:
9137
+ case 135:
7851
9138
  _state.sent();
7852
- _state.label = 58;
7853
- case 58:
9139
+ _state.label = 136;
9140
+ case 136:
7854
9141
  return [
7855
9142
  7
7856
9143
  ];
7857
- case 59:
9144
+ case 137:
7858
9145
  return [
7859
9146
  2
7860
9147
  ];