supercompat 3.15.1 → 3.15.3

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
@@ -6342,7 +6342,7 @@ var serializeThread2 = function(param) {
6342
6342
  };
6343
6343
  // src/adapters/storage/responsesStorageAdapter/threads/post.ts
6344
6344
  var post15 = function(param) {
6345
- var client = param.client;
6345
+ var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
6346
6346
  return function(_urlString, options) {
6347
6347
  return _async_to_generator(function() {
6348
6348
  var body, messages5, metadata, conversation;
@@ -6360,15 +6360,82 @@ var post15 = function(param) {
6360
6360
  client.conversations.create({
6361
6361
  metadata: metadata,
6362
6362
  items: messages5.map(function(message) {
6363
+ var contentType = message.role === "user" ? "input_text" : "output_text";
6364
+ var contentArray;
6365
+ if (typeof message.content === "string") {
6366
+ var contentItem = {
6367
+ type: contentType,
6368
+ text: message.content
6369
+ };
6370
+ if (addAnnotations) {
6371
+ contentItem.annotations = [];
6372
+ }
6373
+ contentArray = [
6374
+ contentItem
6375
+ ];
6376
+ } else if (Array.isArray(message.content)) {
6377
+ contentArray = message.content.map(function(part) {
6378
+ if (typeof part === "string") {
6379
+ var item2 = {
6380
+ type: contentType,
6381
+ text: part
6382
+ };
6383
+ if (addAnnotations) {
6384
+ item2.annotations = [];
6385
+ }
6386
+ return item2;
6387
+ }
6388
+ if (part.type === "text") {
6389
+ var item21 = {
6390
+ type: contentType,
6391
+ text: part.text
6392
+ };
6393
+ if (addAnnotations) {
6394
+ item21.annotations = [];
6395
+ }
6396
+ return item21;
6397
+ }
6398
+ if (part.type === "image_file") {
6399
+ var _part_image_file_detail;
6400
+ return {
6401
+ type: "input_image",
6402
+ file_id: part.image_file.file_id,
6403
+ detail: (_part_image_file_detail = part.image_file.detail) !== null && _part_image_file_detail !== void 0 ? _part_image_file_detail : "auto"
6404
+ };
6405
+ }
6406
+ if (part.type === "image_url") {
6407
+ var _part_image_url_detail;
6408
+ return {
6409
+ type: "input_image",
6410
+ image_url: part.image_url.url,
6411
+ detail: (_part_image_url_detail = part.image_url.detail) !== null && _part_image_url_detail !== void 0 ? _part_image_url_detail : "auto"
6412
+ };
6413
+ }
6414
+ var item = {
6415
+ type: contentType,
6416
+ text: ""
6417
+ };
6418
+ if (addAnnotations) {
6419
+ item.annotations = [];
6420
+ }
6421
+ return item;
6422
+ });
6423
+ } else {
6424
+ var contentItem1 = {
6425
+ type: contentType,
6426
+ text: ""
6427
+ };
6428
+ if (addAnnotations) {
6429
+ contentItem1.annotations = [];
6430
+ }
6431
+ contentArray = [
6432
+ contentItem1
6433
+ ];
6434
+ }
6363
6435
  return {
6364
6436
  type: "message",
6365
6437
  role: message.role === "user" ? "user" : "assistant",
6366
- content: [
6367
- {
6368
- type: message.role === "user" ? "input_text" : "output_text",
6369
- text: message.content
6370
- }
6371
- ]
6438
+ content: contentArray
6372
6439
  };
6373
6440
  })
6374
6441
  })
@@ -6393,10 +6460,11 @@ var post15 = function(param) {
6393
6460
  };
6394
6461
  // src/adapters/storage/responsesStorageAdapter/threads/index.ts
6395
6462
  var threads2 = function(param) {
6396
- var client = param.client;
6463
+ var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
6397
6464
  return {
6398
6465
  post: post15({
6399
- client: client
6466
+ client: client,
6467
+ addAnnotations: addAnnotations
6400
6468
  })
6401
6469
  };
6402
6470
  };
@@ -6504,14 +6572,18 @@ var serializeItemAsMessage = function(param) {
6504
6572
  };
6505
6573
  // src/adapters/storage/responsesStorageAdapter/threads/messages/post.ts
6506
6574
  var contentBlocksFromContent = function(param) {
6507
- var content = param.content;
6575
+ var content = param.content, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
6508
6576
  if ((0, import_radash15.isArray)(content)) {
6509
6577
  return content.map(function(item) {
6510
6578
  if (item.type === "text") {
6511
- return {
6579
+ var textItem3 = {
6512
6580
  type: "input_text",
6513
6581
  text: item.text
6514
6582
  };
6583
+ if (addAnnotations) {
6584
+ textItem3.annotations = [];
6585
+ }
6586
+ return textItem3;
6515
6587
  }
6516
6588
  if (item.type === "image_file") {
6517
6589
  var _item_image_file_detail;
@@ -6529,17 +6601,25 @@ var contentBlocksFromContent = function(param) {
6529
6601
  detail: (_item_image_url_detail = item.image_url.detail) !== null && _item_image_url_detail !== void 0 ? _item_image_url_detail : "auto"
6530
6602
  };
6531
6603
  }
6532
- return {
6604
+ var textItem2 = {
6533
6605
  type: "input_text",
6534
6606
  text: ""
6535
6607
  };
6608
+ if (addAnnotations) {
6609
+ textItem2.annotations = [];
6610
+ }
6611
+ return textItem2;
6536
6612
  });
6537
6613
  }
6614
+ var textItem = {
6615
+ type: "input_text",
6616
+ text: content !== null && content !== void 0 ? content : ""
6617
+ };
6618
+ if (addAnnotations) {
6619
+ textItem.annotations = [];
6620
+ }
6538
6621
  return [
6539
- {
6540
- type: "input_text",
6541
- text: content !== null && content !== void 0 ? content : ""
6542
- }
6622
+ textItem
6543
6623
  ];
6544
6624
  };
6545
6625
  var contentBlocksFromAttachments = function(param) {
@@ -6552,15 +6632,16 @@ var contentBlocksFromAttachments = function(param) {
6552
6632
  });
6553
6633
  };
6554
6634
  var messageContentBlocks2 = function(param) {
6555
- var content = param.content, attachments = param.attachments;
6635
+ var content = param.content, attachments = param.attachments, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
6556
6636
  return _to_consumable_array(contentBlocksFromContent({
6557
- content: content
6637
+ content: content,
6638
+ addAnnotations: addAnnotations
6558
6639
  })).concat(_to_consumable_array(contentBlocksFromAttachments({
6559
6640
  attachments: attachments
6560
6641
  })));
6561
6642
  };
6562
6643
  var post16 = function(param) {
6563
- var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
6644
+ var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
6564
6645
  return function(urlString, options) {
6565
6646
  return _async_to_generator(function() {
6566
6647
  var url, _url_pathname_match, threadId, body, role, content, _body_attachments, attachments, item, openaiAssistant;
@@ -6579,7 +6660,8 @@ var post16 = function(param) {
6579
6660
  role: role,
6580
6661
  content: messageContentBlocks2({
6581
6662
  content: content,
6582
- attachments: attachments
6663
+ attachments: attachments,
6664
+ addAnnotations: addAnnotations
6583
6665
  })
6584
6666
  };
6585
6667
  createResponseItems.push(item);
@@ -6861,11 +6943,12 @@ var assignTimestamps = function(param) {
6861
6943
  };
6862
6944
  // src/adapters/storage/responsesStorageAdapter/threads/messages/index.ts
6863
6945
  var messages3 = function(param) {
6864
- var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
6946
+ var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
6865
6947
  return {
6866
6948
  post: post16({
6867
6949
  runAdapter: runAdapter,
6868
- createResponseItems: createResponseItems
6950
+ createResponseItems: createResponseItems,
6951
+ addAnnotations: addAnnotations
6869
6952
  }),
6870
6953
  get: get15({
6871
6954
  client: client,
@@ -8632,6 +8715,48 @@ var responsesStorageAdapter = function() {
8632
8715
  };
8633
8716
  };
8634
8717
  };
8718
+ // src/lib/responses/responseRegexp.ts
8719
+ var responseRegexp = "^/(?:v1|/?openai)/responses/([^/]+)$";
8720
+ // src/adapters/storage/azureResponsesStorageAdapter/responses/get.ts
8721
+ var get20 = function(param) {
8722
+ var client = param.client;
8723
+ return function(urlString) {
8724
+ return _async_to_generator(function() {
8725
+ var url, _url_pathname_match, responseId2, response;
8726
+ return _ts_generator(this, function(_state) {
8727
+ switch(_state.label){
8728
+ case 0:
8729
+ url = new URL(urlString);
8730
+ _url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(responseRegexp)), 2), responseId2 = _url_pathname_match[1];
8731
+ return [
8732
+ 4,
8733
+ client.responses.retrieve(responseId2)
8734
+ ];
8735
+ case 1:
8736
+ response = _state.sent();
8737
+ return [
8738
+ 2,
8739
+ new Response(JSON.stringify(response), {
8740
+ status: 200,
8741
+ headers: {
8742
+ "Content-Type": "application/json"
8743
+ }
8744
+ })
8745
+ ];
8746
+ }
8747
+ });
8748
+ })();
8749
+ };
8750
+ };
8751
+ // src/adapters/storage/azureResponsesStorageAdapter/responses/index.ts
8752
+ var responses = function(param) {
8753
+ var client = param.client;
8754
+ return {
8755
+ get: get20({
8756
+ client: client
8757
+ })
8758
+ };
8759
+ };
8635
8760
  // src/adapters/storage/azureResponsesStorageAdapter/index.ts
8636
8761
  var azureResponsesStorageAdapter = function() {
8637
8762
  var createResponseItems = [];
@@ -8734,13 +8859,39 @@ var azureResponsesStorageAdapter = function() {
8734
8859
  };
8735
8860
  };
8736
8861
  var createWrappedHandlers = function(handlerFactory, methods) {
8862
+ var additionalArgs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
8737
8863
  var wrapped = {};
8738
8864
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8739
8865
  try {
8740
- for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8866
+ var _loop = function() {
8741
8867
  var method = _step.value;
8742
- wrapped[method] = wrapHandlerMethod(handlerFactory, method);
8743
- }
8868
+ wrapped[method] = function(urlString, options) {
8869
+ return _async_to_generator(function() {
8870
+ var openaiClient, handler;
8871
+ return _ts_generator(this, function(_state) {
8872
+ switch(_state.label){
8873
+ case 0:
8874
+ return [
8875
+ 4,
8876
+ getAzureClient()
8877
+ ];
8878
+ case 1:
8879
+ openaiClient = _state.sent();
8880
+ handler = handlerFactory(_object_spread({
8881
+ client: openaiClient,
8882
+ runAdapter: wrappedRunAdapter,
8883
+ createResponseItems: createResponseItems
8884
+ }, additionalArgs));
8885
+ return [
8886
+ 2,
8887
+ handler[method](urlString, options)
8888
+ ];
8889
+ }
8890
+ });
8891
+ })();
8892
+ };
8893
+ };
8894
+ for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
8744
8895
  } catch (err) {
8745
8896
  _didIteratorError = true;
8746
8897
  _iteratorError = err;
@@ -8765,7 +8916,9 @@ var azureResponsesStorageAdapter = function() {
8765
8916
  }),
8766
8917
  "^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
8767
8918
  "post"
8768
- ])
8919
+ ], {
8920
+ addAnnotations: true
8921
+ })
8769
8922
  }, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
8770
8923
  "get",
8771
8924
  "post"
@@ -8777,6 +8930,8 @@ var azureResponsesStorageAdapter = function() {
8777
8930
  "get"
8778
8931
  ])), _define_property(_obj, submitToolOutputsRegexp, createWrappedHandlers(submitToolOutputs2, [
8779
8932
  "post"
8933
+ ])), _define_property(_obj, responseRegexp, createWrappedHandlers(responses, [
8934
+ "get"
8780
8935
  ])), _obj)
8781
8936
  };
8782
8937
  };
@@ -8950,7 +9105,7 @@ var post21 = function(param) {
8950
9105
  };
8951
9106
  // src/adapters/storage/azureAgentsStorageAdapter/threads/messages/get.ts
8952
9107
  var import_dayjs23 = __toESM(require("dayjs"), 1);
8953
- var get20 = function(param) {
9108
+ var get21 = function(param) {
8954
9109
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
8955
9110
  return function(urlString) {
8956
9111
  return _async_to_generator(function() {
@@ -9142,14 +9297,14 @@ var messages4 = function(param) {
9142
9297
  azureAiProject: azureAiProject,
9143
9298
  runAdapter: runAdapter
9144
9299
  }),
9145
- get: get20({
9300
+ get: get21({
9146
9301
  azureAiProject: azureAiProject,
9147
9302
  runAdapter: runAdapter
9148
9303
  })
9149
9304
  };
9150
9305
  };
9151
9306
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/get.ts
9152
- var get21 = function() {
9307
+ var get22 = function() {
9153
9308
  return function() {
9154
9309
  return _async_to_generator(function() {
9155
9310
  var response;
@@ -9445,7 +9600,7 @@ var post22 = function(param) {
9445
9600
  var runs3 = function(param) {
9446
9601
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9447
9602
  return {
9448
- get: get21(),
9603
+ get: get22(),
9449
9604
  post: post22({
9450
9605
  azureAiProject: azureAiProject,
9451
9606
  runAdapter: runAdapter
@@ -9454,7 +9609,7 @@ var runs3 = function(param) {
9454
9609
  };
9455
9610
  // src/adapters/storage/azureAgentsStorageAdapter/threads/run/get.ts
9456
9611
  var import_dayjs25 = __toESM(require("dayjs"), 1);
9457
- var get22 = function(param) {
9612
+ var get23 = function(param) {
9458
9613
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9459
9614
  return function(urlString) {
9460
9615
  return _async_to_generator(function() {
@@ -9538,7 +9693,7 @@ var get22 = function(param) {
9538
9693
  var run3 = function(param) {
9539
9694
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
9540
9695
  return {
9541
- get: get22({
9696
+ get: get23({
9542
9697
  azureAiProject: azureAiProject,
9543
9698
  runAdapter: runAdapter
9544
9699
  })
@@ -9546,7 +9701,7 @@ var run3 = function(param) {
9546
9701
  };
9547
9702
  // src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
9548
9703
  var import_dayjs26 = __toESM(require("dayjs"), 1);
9549
- var get23 = function(param) {
9704
+ var get24 = function(param) {
9550
9705
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9551
9706
  return function(urlString) {
9552
9707
  return _async_to_generator(function() {
@@ -9757,7 +9912,7 @@ var get23 = function(param) {
9757
9912
  var steps3 = function(param) {
9758
9913
  var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
9759
9914
  return {
9760
- get: get23({
9915
+ get: get24({
9761
9916
  azureAiProject: azureAiProject,
9762
9917
  runAdapter: runAdapter,
9763
9918
  prisma: prisma