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 +189 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +189 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6220,7 +6220,7 @@ var serializeThread2 = function(param) {
|
|
|
6220
6220
|
};
|
|
6221
6221
|
// src/adapters/storage/responsesStorageAdapter/threads/post.ts
|
|
6222
6222
|
var post15 = function(param) {
|
|
6223
|
-
var client = param.client;
|
|
6223
|
+
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6224
6224
|
return function(_urlString, options) {
|
|
6225
6225
|
return _async_to_generator(function() {
|
|
6226
6226
|
var body, messages5, metadata, conversation;
|
|
@@ -6238,15 +6238,82 @@ var post15 = function(param) {
|
|
|
6238
6238
|
client.conversations.create({
|
|
6239
6239
|
metadata: metadata,
|
|
6240
6240
|
items: messages5.map(function(message) {
|
|
6241
|
+
var contentType = message.role === "user" ? "input_text" : "output_text";
|
|
6242
|
+
var contentArray;
|
|
6243
|
+
if (typeof message.content === "string") {
|
|
6244
|
+
var contentItem = {
|
|
6245
|
+
type: contentType,
|
|
6246
|
+
text: message.content
|
|
6247
|
+
};
|
|
6248
|
+
if (addAnnotations) {
|
|
6249
|
+
contentItem.annotations = [];
|
|
6250
|
+
}
|
|
6251
|
+
contentArray = [
|
|
6252
|
+
contentItem
|
|
6253
|
+
];
|
|
6254
|
+
} else if (Array.isArray(message.content)) {
|
|
6255
|
+
contentArray = message.content.map(function(part) {
|
|
6256
|
+
if (typeof part === "string") {
|
|
6257
|
+
var item2 = {
|
|
6258
|
+
type: contentType,
|
|
6259
|
+
text: part
|
|
6260
|
+
};
|
|
6261
|
+
if (addAnnotations) {
|
|
6262
|
+
item2.annotations = [];
|
|
6263
|
+
}
|
|
6264
|
+
return item2;
|
|
6265
|
+
}
|
|
6266
|
+
if (part.type === "text") {
|
|
6267
|
+
var item21 = {
|
|
6268
|
+
type: contentType,
|
|
6269
|
+
text: part.text
|
|
6270
|
+
};
|
|
6271
|
+
if (addAnnotations) {
|
|
6272
|
+
item21.annotations = [];
|
|
6273
|
+
}
|
|
6274
|
+
return item21;
|
|
6275
|
+
}
|
|
6276
|
+
if (part.type === "image_file") {
|
|
6277
|
+
var _part_image_file_detail;
|
|
6278
|
+
return {
|
|
6279
|
+
type: "input_image",
|
|
6280
|
+
file_id: part.image_file.file_id,
|
|
6281
|
+
detail: (_part_image_file_detail = part.image_file.detail) !== null && _part_image_file_detail !== void 0 ? _part_image_file_detail : "auto"
|
|
6282
|
+
};
|
|
6283
|
+
}
|
|
6284
|
+
if (part.type === "image_url") {
|
|
6285
|
+
var _part_image_url_detail;
|
|
6286
|
+
return {
|
|
6287
|
+
type: "input_image",
|
|
6288
|
+
image_url: part.image_url.url,
|
|
6289
|
+
detail: (_part_image_url_detail = part.image_url.detail) !== null && _part_image_url_detail !== void 0 ? _part_image_url_detail : "auto"
|
|
6290
|
+
};
|
|
6291
|
+
}
|
|
6292
|
+
var item = {
|
|
6293
|
+
type: contentType,
|
|
6294
|
+
text: ""
|
|
6295
|
+
};
|
|
6296
|
+
if (addAnnotations) {
|
|
6297
|
+
item.annotations = [];
|
|
6298
|
+
}
|
|
6299
|
+
return item;
|
|
6300
|
+
});
|
|
6301
|
+
} else {
|
|
6302
|
+
var contentItem1 = {
|
|
6303
|
+
type: contentType,
|
|
6304
|
+
text: ""
|
|
6305
|
+
};
|
|
6306
|
+
if (addAnnotations) {
|
|
6307
|
+
contentItem1.annotations = [];
|
|
6308
|
+
}
|
|
6309
|
+
contentArray = [
|
|
6310
|
+
contentItem1
|
|
6311
|
+
];
|
|
6312
|
+
}
|
|
6241
6313
|
return {
|
|
6242
6314
|
type: "message",
|
|
6243
6315
|
role: message.role === "user" ? "user" : "assistant",
|
|
6244
|
-
content:
|
|
6245
|
-
{
|
|
6246
|
-
type: message.role === "user" ? "input_text" : "output_text",
|
|
6247
|
-
text: message.content
|
|
6248
|
-
}
|
|
6249
|
-
]
|
|
6316
|
+
content: contentArray
|
|
6250
6317
|
};
|
|
6251
6318
|
})
|
|
6252
6319
|
})
|
|
@@ -6271,10 +6338,11 @@ var post15 = function(param) {
|
|
|
6271
6338
|
};
|
|
6272
6339
|
// src/adapters/storage/responsesStorageAdapter/threads/index.ts
|
|
6273
6340
|
var threads2 = function(param) {
|
|
6274
|
-
var client = param.client;
|
|
6341
|
+
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6275
6342
|
return {
|
|
6276
6343
|
post: post15({
|
|
6277
|
-
client: client
|
|
6344
|
+
client: client,
|
|
6345
|
+
addAnnotations: addAnnotations
|
|
6278
6346
|
})
|
|
6279
6347
|
};
|
|
6280
6348
|
};
|
|
@@ -6382,14 +6450,18 @@ var serializeItemAsMessage = function(param) {
|
|
|
6382
6450
|
};
|
|
6383
6451
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/post.ts
|
|
6384
6452
|
var contentBlocksFromContent = function(param) {
|
|
6385
|
-
var content = param.content;
|
|
6453
|
+
var content = param.content, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6386
6454
|
if (isArray3(content)) {
|
|
6387
6455
|
return content.map(function(item) {
|
|
6388
6456
|
if (item.type === "text") {
|
|
6389
|
-
|
|
6457
|
+
var textItem3 = {
|
|
6390
6458
|
type: "input_text",
|
|
6391
6459
|
text: item.text
|
|
6392
6460
|
};
|
|
6461
|
+
if (addAnnotations) {
|
|
6462
|
+
textItem3.annotations = [];
|
|
6463
|
+
}
|
|
6464
|
+
return textItem3;
|
|
6393
6465
|
}
|
|
6394
6466
|
if (item.type === "image_file") {
|
|
6395
6467
|
var _item_image_file_detail;
|
|
@@ -6407,17 +6479,25 @@ var contentBlocksFromContent = function(param) {
|
|
|
6407
6479
|
detail: (_item_image_url_detail = item.image_url.detail) !== null && _item_image_url_detail !== void 0 ? _item_image_url_detail : "auto"
|
|
6408
6480
|
};
|
|
6409
6481
|
}
|
|
6410
|
-
|
|
6482
|
+
var textItem2 = {
|
|
6411
6483
|
type: "input_text",
|
|
6412
6484
|
text: ""
|
|
6413
6485
|
};
|
|
6486
|
+
if (addAnnotations) {
|
|
6487
|
+
textItem2.annotations = [];
|
|
6488
|
+
}
|
|
6489
|
+
return textItem2;
|
|
6414
6490
|
});
|
|
6415
6491
|
}
|
|
6492
|
+
var textItem = {
|
|
6493
|
+
type: "input_text",
|
|
6494
|
+
text: content !== null && content !== void 0 ? content : ""
|
|
6495
|
+
};
|
|
6496
|
+
if (addAnnotations) {
|
|
6497
|
+
textItem.annotations = [];
|
|
6498
|
+
}
|
|
6416
6499
|
return [
|
|
6417
|
-
|
|
6418
|
-
type: "input_text",
|
|
6419
|
-
text: content !== null && content !== void 0 ? content : ""
|
|
6420
|
-
}
|
|
6500
|
+
textItem
|
|
6421
6501
|
];
|
|
6422
6502
|
};
|
|
6423
6503
|
var contentBlocksFromAttachments = function(param) {
|
|
@@ -6430,15 +6510,16 @@ var contentBlocksFromAttachments = function(param) {
|
|
|
6430
6510
|
});
|
|
6431
6511
|
};
|
|
6432
6512
|
var messageContentBlocks2 = function(param) {
|
|
6433
|
-
var content = param.content, attachments = param.attachments;
|
|
6513
|
+
var content = param.content, attachments = param.attachments, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6434
6514
|
return _to_consumable_array(contentBlocksFromContent({
|
|
6435
|
-
content: content
|
|
6515
|
+
content: content,
|
|
6516
|
+
addAnnotations: addAnnotations
|
|
6436
6517
|
})).concat(_to_consumable_array(contentBlocksFromAttachments({
|
|
6437
6518
|
attachments: attachments
|
|
6438
6519
|
})));
|
|
6439
6520
|
};
|
|
6440
6521
|
var post16 = function(param) {
|
|
6441
|
-
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
6522
|
+
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6442
6523
|
return function(urlString, options) {
|
|
6443
6524
|
return _async_to_generator(function() {
|
|
6444
6525
|
var url, _url_pathname_match, threadId, body, role, content, _body_attachments, attachments, item, openaiAssistant;
|
|
@@ -6457,7 +6538,8 @@ var post16 = function(param) {
|
|
|
6457
6538
|
role: role,
|
|
6458
6539
|
content: messageContentBlocks2({
|
|
6459
6540
|
content: content,
|
|
6460
|
-
attachments: attachments
|
|
6541
|
+
attachments: attachments,
|
|
6542
|
+
addAnnotations: addAnnotations
|
|
6461
6543
|
})
|
|
6462
6544
|
};
|
|
6463
6545
|
createResponseItems.push(item);
|
|
@@ -6739,11 +6821,12 @@ var assignTimestamps = function(param) {
|
|
|
6739
6821
|
};
|
|
6740
6822
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/index.ts
|
|
6741
6823
|
var messages3 = function(param) {
|
|
6742
|
-
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
6824
|
+
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6743
6825
|
return {
|
|
6744
6826
|
post: post16({
|
|
6745
6827
|
runAdapter: runAdapter,
|
|
6746
|
-
createResponseItems: createResponseItems
|
|
6828
|
+
createResponseItems: createResponseItems,
|
|
6829
|
+
addAnnotations: addAnnotations
|
|
6747
6830
|
}),
|
|
6748
6831
|
get: get15({
|
|
6749
6832
|
client: client,
|
|
@@ -8509,6 +8592,48 @@ var responsesStorageAdapter = function() {
|
|
|
8509
8592
|
};
|
|
8510
8593
|
};
|
|
8511
8594
|
};
|
|
8595
|
+
// src/lib/responses/responseRegexp.ts
|
|
8596
|
+
var responseRegexp = "^/(?:v1|/?openai)/responses/([^/]+)$";
|
|
8597
|
+
// src/adapters/storage/azureResponsesStorageAdapter/responses/get.ts
|
|
8598
|
+
var get20 = function(param) {
|
|
8599
|
+
var client = param.client;
|
|
8600
|
+
return function(urlString) {
|
|
8601
|
+
return _async_to_generator(function() {
|
|
8602
|
+
var url, _url_pathname_match, responseId2, response;
|
|
8603
|
+
return _ts_generator(this, function(_state) {
|
|
8604
|
+
switch(_state.label){
|
|
8605
|
+
case 0:
|
|
8606
|
+
url = new URL(urlString);
|
|
8607
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(responseRegexp)), 2), responseId2 = _url_pathname_match[1];
|
|
8608
|
+
return [
|
|
8609
|
+
4,
|
|
8610
|
+
client.responses.retrieve(responseId2)
|
|
8611
|
+
];
|
|
8612
|
+
case 1:
|
|
8613
|
+
response = _state.sent();
|
|
8614
|
+
return [
|
|
8615
|
+
2,
|
|
8616
|
+
new Response(JSON.stringify(response), {
|
|
8617
|
+
status: 200,
|
|
8618
|
+
headers: {
|
|
8619
|
+
"Content-Type": "application/json"
|
|
8620
|
+
}
|
|
8621
|
+
})
|
|
8622
|
+
];
|
|
8623
|
+
}
|
|
8624
|
+
});
|
|
8625
|
+
})();
|
|
8626
|
+
};
|
|
8627
|
+
};
|
|
8628
|
+
// src/adapters/storage/azureResponsesStorageAdapter/responses/index.ts
|
|
8629
|
+
var responses = function(param) {
|
|
8630
|
+
var client = param.client;
|
|
8631
|
+
return {
|
|
8632
|
+
get: get20({
|
|
8633
|
+
client: client
|
|
8634
|
+
})
|
|
8635
|
+
};
|
|
8636
|
+
};
|
|
8512
8637
|
// src/adapters/storage/azureResponsesStorageAdapter/index.ts
|
|
8513
8638
|
var azureResponsesStorageAdapter = function() {
|
|
8514
8639
|
var createResponseItems = [];
|
|
@@ -8611,13 +8736,39 @@ var azureResponsesStorageAdapter = function() {
|
|
|
8611
8736
|
};
|
|
8612
8737
|
};
|
|
8613
8738
|
var createWrappedHandlers = function(handlerFactory, methods) {
|
|
8739
|
+
var additionalArgs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8614
8740
|
var wrapped = {};
|
|
8615
8741
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8616
8742
|
try {
|
|
8617
|
-
|
|
8743
|
+
var _loop = function() {
|
|
8618
8744
|
var method = _step.value;
|
|
8619
|
-
wrapped[method] =
|
|
8620
|
-
|
|
8745
|
+
wrapped[method] = function(urlString, options) {
|
|
8746
|
+
return _async_to_generator(function() {
|
|
8747
|
+
var openaiClient, handler;
|
|
8748
|
+
return _ts_generator(this, function(_state) {
|
|
8749
|
+
switch(_state.label){
|
|
8750
|
+
case 0:
|
|
8751
|
+
return [
|
|
8752
|
+
4,
|
|
8753
|
+
getAzureClient()
|
|
8754
|
+
];
|
|
8755
|
+
case 1:
|
|
8756
|
+
openaiClient = _state.sent();
|
|
8757
|
+
handler = handlerFactory(_object_spread({
|
|
8758
|
+
client: openaiClient,
|
|
8759
|
+
runAdapter: wrappedRunAdapter,
|
|
8760
|
+
createResponseItems: createResponseItems
|
|
8761
|
+
}, additionalArgs));
|
|
8762
|
+
return [
|
|
8763
|
+
2,
|
|
8764
|
+
handler[method](urlString, options)
|
|
8765
|
+
];
|
|
8766
|
+
}
|
|
8767
|
+
});
|
|
8768
|
+
})();
|
|
8769
|
+
};
|
|
8770
|
+
};
|
|
8771
|
+
for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
8621
8772
|
} catch (err) {
|
|
8622
8773
|
_didIteratorError = true;
|
|
8623
8774
|
_iteratorError = err;
|
|
@@ -8642,7 +8793,9 @@ var azureResponsesStorageAdapter = function() {
|
|
|
8642
8793
|
}),
|
|
8643
8794
|
"^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
|
|
8644
8795
|
"post"
|
|
8645
|
-
]
|
|
8796
|
+
], {
|
|
8797
|
+
addAnnotations: true
|
|
8798
|
+
})
|
|
8646
8799
|
}, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
|
|
8647
8800
|
"get",
|
|
8648
8801
|
"post"
|
|
@@ -8654,6 +8807,8 @@ var azureResponsesStorageAdapter = function() {
|
|
|
8654
8807
|
"get"
|
|
8655
8808
|
])), _define_property(_obj, submitToolOutputsRegexp, createWrappedHandlers(submitToolOutputs2, [
|
|
8656
8809
|
"post"
|
|
8810
|
+
])), _define_property(_obj, responseRegexp, createWrappedHandlers(responses, [
|
|
8811
|
+
"get"
|
|
8657
8812
|
])), _obj)
|
|
8658
8813
|
};
|
|
8659
8814
|
};
|
|
@@ -8827,7 +8982,7 @@ var post21 = function(param) {
|
|
|
8827
8982
|
};
|
|
8828
8983
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/messages/get.ts
|
|
8829
8984
|
import dayjs23 from "dayjs";
|
|
8830
|
-
var
|
|
8985
|
+
var get21 = function(param) {
|
|
8831
8986
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
8832
8987
|
return function(urlString) {
|
|
8833
8988
|
return _async_to_generator(function() {
|
|
@@ -9019,14 +9174,14 @@ var messages4 = function(param) {
|
|
|
9019
9174
|
azureAiProject: azureAiProject,
|
|
9020
9175
|
runAdapter: runAdapter
|
|
9021
9176
|
}),
|
|
9022
|
-
get:
|
|
9177
|
+
get: get21({
|
|
9023
9178
|
azureAiProject: azureAiProject,
|
|
9024
9179
|
runAdapter: runAdapter
|
|
9025
9180
|
})
|
|
9026
9181
|
};
|
|
9027
9182
|
};
|
|
9028
9183
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/get.ts
|
|
9029
|
-
var
|
|
9184
|
+
var get22 = function() {
|
|
9030
9185
|
return function() {
|
|
9031
9186
|
return _async_to_generator(function() {
|
|
9032
9187
|
var response;
|
|
@@ -9322,7 +9477,7 @@ var post22 = function(param) {
|
|
|
9322
9477
|
var runs3 = function(param) {
|
|
9323
9478
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9324
9479
|
return {
|
|
9325
|
-
get:
|
|
9480
|
+
get: get22(),
|
|
9326
9481
|
post: post22({
|
|
9327
9482
|
azureAiProject: azureAiProject,
|
|
9328
9483
|
runAdapter: runAdapter
|
|
@@ -9331,7 +9486,7 @@ var runs3 = function(param) {
|
|
|
9331
9486
|
};
|
|
9332
9487
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/run/get.ts
|
|
9333
9488
|
import dayjs25 from "dayjs";
|
|
9334
|
-
var
|
|
9489
|
+
var get23 = function(param) {
|
|
9335
9490
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9336
9491
|
return function(urlString) {
|
|
9337
9492
|
return _async_to_generator(function() {
|
|
@@ -9415,7 +9570,7 @@ var get22 = function(param) {
|
|
|
9415
9570
|
var run3 = function(param) {
|
|
9416
9571
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9417
9572
|
return {
|
|
9418
|
-
get:
|
|
9573
|
+
get: get23({
|
|
9419
9574
|
azureAiProject: azureAiProject,
|
|
9420
9575
|
runAdapter: runAdapter
|
|
9421
9576
|
})
|
|
@@ -9423,7 +9578,7 @@ var run3 = function(param) {
|
|
|
9423
9578
|
};
|
|
9424
9579
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
|
|
9425
9580
|
import dayjs26 from "dayjs";
|
|
9426
|
-
var
|
|
9581
|
+
var get24 = function(param) {
|
|
9427
9582
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9428
9583
|
return function(urlString) {
|
|
9429
9584
|
return _async_to_generator(function() {
|
|
@@ -9634,7 +9789,7 @@ var get23 = function(param) {
|
|
|
9634
9789
|
var steps3 = function(param) {
|
|
9635
9790
|
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9636
9791
|
return {
|
|
9637
|
-
get:
|
|
9792
|
+
get: get24({
|
|
9638
9793
|
azureAiProject: azureAiProject,
|
|
9639
9794
|
runAdapter: runAdapter,
|
|
9640
9795
|
prisma: prisma
|