supercompat 3.12.0 → 3.13.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 +412 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +412 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -93,6 +93,13 @@ function _define_property(obj, key, value) {
|
|
|
93
93
|
}
|
|
94
94
|
return obj;
|
|
95
95
|
}
|
|
96
|
+
function _instanceof(left, right) {
|
|
97
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
98
|
+
return !!right[Symbol.hasInstance](left);
|
|
99
|
+
} else {
|
|
100
|
+
return left instanceof right;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
96
103
|
function _iterable_to_array(iter) {
|
|
97
104
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
98
105
|
}
|
|
@@ -8588,6 +8595,16 @@ var post21 = function(param) {
|
|
|
8588
8595
|
annotations: annotations
|
|
8589
8596
|
}
|
|
8590
8597
|
};
|
|
8598
|
+
} else if (c.type === "image_file") {
|
|
8599
|
+
var imageFile = c.image_file || c.imageFile || {};
|
|
8600
|
+
var _imageFile_detail;
|
|
8601
|
+
return {
|
|
8602
|
+
type: "image_file",
|
|
8603
|
+
image_file: {
|
|
8604
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
8605
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
8606
|
+
}
|
|
8607
|
+
};
|
|
8591
8608
|
}
|
|
8592
8609
|
return c;
|
|
8593
8610
|
}),
|
|
@@ -8703,6 +8720,16 @@ var get19 = function(param) {
|
|
|
8703
8720
|
annotations: annotations
|
|
8704
8721
|
}
|
|
8705
8722
|
};
|
|
8723
|
+
} else if (c.type === "image_file") {
|
|
8724
|
+
var imageFile = c.image_file || c.imageFile || {};
|
|
8725
|
+
var _imageFile_detail;
|
|
8726
|
+
return {
|
|
8727
|
+
type: "image_file",
|
|
8728
|
+
image_file: {
|
|
8729
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
8730
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
8731
|
+
}
|
|
8732
|
+
};
|
|
8706
8733
|
}
|
|
8707
8734
|
return c;
|
|
8708
8735
|
}),
|
|
@@ -10058,6 +10085,300 @@ var assistants3 = function(param) {
|
|
|
10058
10085
|
})
|
|
10059
10086
|
};
|
|
10060
10087
|
};
|
|
10088
|
+
// src/lib/files/fileRegexp.ts
|
|
10089
|
+
var fileRegexp = "^/(?:v1|/?openai)/files/([^/]+)$";
|
|
10090
|
+
// src/lib/files/fileContentRegexp.ts
|
|
10091
|
+
var fileContentRegexp = "^/(?:v1|/?openai)/files/([^/]+)/content$";
|
|
10092
|
+
// src/lib/files/transformAzureFile.ts
|
|
10093
|
+
var import_dayjs28 = __toESM(require("dayjs"), 1);
|
|
10094
|
+
var toUnixSeconds = function(value) {
|
|
10095
|
+
if (!value) return void 0;
|
|
10096
|
+
if (_instanceof(value, Date)) {
|
|
10097
|
+
return (0, import_dayjs28.default)(value).unix();
|
|
10098
|
+
}
|
|
10099
|
+
if (typeof value === "number") {
|
|
10100
|
+
if (value > 9999999999) {
|
|
10101
|
+
return (0, import_dayjs28.default)(value).unix();
|
|
10102
|
+
}
|
|
10103
|
+
return Math.floor(value);
|
|
10104
|
+
}
|
|
10105
|
+
var parsed = (0, import_dayjs28.default)(value);
|
|
10106
|
+
return parsed.isValid() ? parsed.unix() : void 0;
|
|
10107
|
+
};
|
|
10108
|
+
var transformAzureFile = function(file2) {
|
|
10109
|
+
var _toUnixSeconds;
|
|
10110
|
+
var createdAtUnix = (_toUnixSeconds = toUnixSeconds(file2.createdAt)) !== null && _toUnixSeconds !== void 0 ? _toUnixSeconds : (0, import_dayjs28.default)().unix();
|
|
10111
|
+
var expiresAtUnix = toUnixSeconds(file2.expiresAt);
|
|
10112
|
+
var _file2_bytes;
|
|
10113
|
+
var openaiFile = {
|
|
10114
|
+
id: file2.id,
|
|
10115
|
+
object: file2.object || "file",
|
|
10116
|
+
bytes: (_file2_bytes = file2.bytes) !== null && _file2_bytes !== void 0 ? _file2_bytes : 0,
|
|
10117
|
+
created_at: createdAtUnix,
|
|
10118
|
+
filename: file2.filename || "file",
|
|
10119
|
+
purpose: file2.purpose || "assistants",
|
|
10120
|
+
status: file2.status || "processed"
|
|
10121
|
+
};
|
|
10122
|
+
if (expiresAtUnix !== void 0) {
|
|
10123
|
+
openaiFile.expires_at = expiresAtUnix;
|
|
10124
|
+
}
|
|
10125
|
+
if (file2.statusDetails) {
|
|
10126
|
+
openaiFile.status_details = file2.statusDetails;
|
|
10127
|
+
}
|
|
10128
|
+
return openaiFile;
|
|
10129
|
+
};
|
|
10130
|
+
// src/adapters/storage/azureAgentsStorageAdapter/files/get.ts
|
|
10131
|
+
var file = function(param) {
|
|
10132
|
+
var azureAiProject = param.azureAiProject;
|
|
10133
|
+
return {
|
|
10134
|
+
get: function(url) {
|
|
10135
|
+
return _async_to_generator(function() {
|
|
10136
|
+
var pathname, match, _match, fileId, azureFile, openaiFile;
|
|
10137
|
+
return _ts_generator(this, function(_state) {
|
|
10138
|
+
switch(_state.label){
|
|
10139
|
+
case 0:
|
|
10140
|
+
pathname = new URL(url).pathname;
|
|
10141
|
+
match = pathname.match(new RegExp(fileRegexp));
|
|
10142
|
+
if (!match) {
|
|
10143
|
+
return [
|
|
10144
|
+
2,
|
|
10145
|
+
new Response("Not Found", {
|
|
10146
|
+
status: 404
|
|
10147
|
+
})
|
|
10148
|
+
];
|
|
10149
|
+
}
|
|
10150
|
+
_match = _sliced_to_array(match, 2), fileId = _match[1];
|
|
10151
|
+
return [
|
|
10152
|
+
4,
|
|
10153
|
+
azureAiProject.agents.files.get(fileId)
|
|
10154
|
+
];
|
|
10155
|
+
case 1:
|
|
10156
|
+
azureFile = _state.sent();
|
|
10157
|
+
openaiFile = transformAzureFile(azureFile);
|
|
10158
|
+
return [
|
|
10159
|
+
2,
|
|
10160
|
+
new Response(JSON.stringify(openaiFile), {
|
|
10161
|
+
status: 200,
|
|
10162
|
+
headers: {
|
|
10163
|
+
"Content-Type": "application/json"
|
|
10164
|
+
}
|
|
10165
|
+
})
|
|
10166
|
+
];
|
|
10167
|
+
}
|
|
10168
|
+
});
|
|
10169
|
+
})();
|
|
10170
|
+
}
|
|
10171
|
+
};
|
|
10172
|
+
};
|
|
10173
|
+
// src/adapters/storage/azureAgentsStorageAdapter/files/content.ts
|
|
10174
|
+
var import_node_stream = require("stream");
|
|
10175
|
+
var headersToRecord = function(headers) {
|
|
10176
|
+
if (!headers) return {};
|
|
10177
|
+
if (typeof headers.get === "function") {
|
|
10178
|
+
var result = {};
|
|
10179
|
+
for(var _i = 0, _iter = [
|
|
10180
|
+
"content-type",
|
|
10181
|
+
"content-length"
|
|
10182
|
+
]; _i < _iter.length; _i++){
|
|
10183
|
+
var headerName = _iter[_i];
|
|
10184
|
+
var value = headers.get(headerName);
|
|
10185
|
+
if (value) {
|
|
10186
|
+
result[headerName] = value;
|
|
10187
|
+
}
|
|
10188
|
+
}
|
|
10189
|
+
return result;
|
|
10190
|
+
}
|
|
10191
|
+
var json = typeof headers.toJSON === "function" ? headers.toJSON() : headers;
|
|
10192
|
+
return (typeof json === "undefined" ? "undefined" : _type_of(json)) === "object" && json !== null ? json : {};
|
|
10193
|
+
};
|
|
10194
|
+
var toBody = function(nodeStream) {
|
|
10195
|
+
return _async_to_generator(function() {
|
|
10196
|
+
var chunks, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
10197
|
+
return _ts_generator(this, function(_state) {
|
|
10198
|
+
switch(_state.label){
|
|
10199
|
+
case 0:
|
|
10200
|
+
if (typeof import_node_stream.Readable.toWeb === "function") {
|
|
10201
|
+
return [
|
|
10202
|
+
2,
|
|
10203
|
+
import_node_stream.Readable.toWeb(nodeStream)
|
|
10204
|
+
];
|
|
10205
|
+
}
|
|
10206
|
+
chunks = [];
|
|
10207
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
10208
|
+
_state.label = 1;
|
|
10209
|
+
case 1:
|
|
10210
|
+
_state.trys.push([
|
|
10211
|
+
1,
|
|
10212
|
+
6,
|
|
10213
|
+
7,
|
|
10214
|
+
12
|
|
10215
|
+
]);
|
|
10216
|
+
_iterator = _async_iterator(nodeStream);
|
|
10217
|
+
_state.label = 2;
|
|
10218
|
+
case 2:
|
|
10219
|
+
return [
|
|
10220
|
+
4,
|
|
10221
|
+
_iterator.next()
|
|
10222
|
+
];
|
|
10223
|
+
case 3:
|
|
10224
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
10225
|
+
3,
|
|
10226
|
+
5
|
|
10227
|
+
];
|
|
10228
|
+
_value = _step.value;
|
|
10229
|
+
chunk = _value;
|
|
10230
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
10231
|
+
_state.label = 4;
|
|
10232
|
+
case 4:
|
|
10233
|
+
_iteratorAbruptCompletion = false;
|
|
10234
|
+
return [
|
|
10235
|
+
3,
|
|
10236
|
+
2
|
|
10237
|
+
];
|
|
10238
|
+
case 5:
|
|
10239
|
+
return [
|
|
10240
|
+
3,
|
|
10241
|
+
12
|
|
10242
|
+
];
|
|
10243
|
+
case 6:
|
|
10244
|
+
err = _state.sent();
|
|
10245
|
+
_didIteratorError = true;
|
|
10246
|
+
_iteratorError = err;
|
|
10247
|
+
return [
|
|
10248
|
+
3,
|
|
10249
|
+
12
|
|
10250
|
+
];
|
|
10251
|
+
case 7:
|
|
10252
|
+
_state.trys.push([
|
|
10253
|
+
7,
|
|
10254
|
+
,
|
|
10255
|
+
10,
|
|
10256
|
+
11
|
|
10257
|
+
]);
|
|
10258
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
10259
|
+
3,
|
|
10260
|
+
9
|
|
10261
|
+
];
|
|
10262
|
+
return [
|
|
10263
|
+
4,
|
|
10264
|
+
_iterator.return()
|
|
10265
|
+
];
|
|
10266
|
+
case 8:
|
|
10267
|
+
_state.sent();
|
|
10268
|
+
_state.label = 9;
|
|
10269
|
+
case 9:
|
|
10270
|
+
return [
|
|
10271
|
+
3,
|
|
10272
|
+
11
|
|
10273
|
+
];
|
|
10274
|
+
case 10:
|
|
10275
|
+
if (_didIteratorError) {
|
|
10276
|
+
throw _iteratorError;
|
|
10277
|
+
}
|
|
10278
|
+
return [
|
|
10279
|
+
7
|
|
10280
|
+
];
|
|
10281
|
+
case 11:
|
|
10282
|
+
return [
|
|
10283
|
+
7
|
|
10284
|
+
];
|
|
10285
|
+
case 12:
|
|
10286
|
+
return [
|
|
10287
|
+
2,
|
|
10288
|
+
Buffer.concat(chunks)
|
|
10289
|
+
];
|
|
10290
|
+
}
|
|
10291
|
+
});
|
|
10292
|
+
})();
|
|
10293
|
+
};
|
|
10294
|
+
var fileContent = function(param) {
|
|
10295
|
+
var azureAiProject = param.azureAiProject;
|
|
10296
|
+
return {
|
|
10297
|
+
get: function(url) {
|
|
10298
|
+
return _async_to_generator(function() {
|
|
10299
|
+
var pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body, _nodeResponse_status;
|
|
10300
|
+
return _ts_generator(this, function(_state) {
|
|
10301
|
+
switch(_state.label){
|
|
10302
|
+
case 0:
|
|
10303
|
+
pathname = new URL(url).pathname;
|
|
10304
|
+
match = pathname.match(new RegExp(fileContentRegexp));
|
|
10305
|
+
if (!match) {
|
|
10306
|
+
return [
|
|
10307
|
+
2,
|
|
10308
|
+
new Response("Not Found", {
|
|
10309
|
+
status: 404
|
|
10310
|
+
})
|
|
10311
|
+
];
|
|
10312
|
+
}
|
|
10313
|
+
_match = _sliced_to_array(match, 2), fileId = _match[1];
|
|
10314
|
+
streamable = azureAiProject.agents.files.getContent(fileId);
|
|
10315
|
+
if (!streamable || typeof streamable.asNodeStream !== "function") {
|
|
10316
|
+
return [
|
|
10317
|
+
2,
|
|
10318
|
+
new Response("File content unavailable", {
|
|
10319
|
+
status: 500
|
|
10320
|
+
})
|
|
10321
|
+
];
|
|
10322
|
+
}
|
|
10323
|
+
return [
|
|
10324
|
+
4,
|
|
10325
|
+
streamable.asNodeStream()
|
|
10326
|
+
];
|
|
10327
|
+
case 1:
|
|
10328
|
+
nodeResponse = _state.sent();
|
|
10329
|
+
nodeStream = nodeResponse.body;
|
|
10330
|
+
if (!nodeStream) {
|
|
10331
|
+
return [
|
|
10332
|
+
2,
|
|
10333
|
+
new Response("", {
|
|
10334
|
+
status: 204
|
|
10335
|
+
})
|
|
10336
|
+
];
|
|
10337
|
+
}
|
|
10338
|
+
headerRecord = headersToRecord(nodeResponse.headers);
|
|
10339
|
+
headers = new Headers();
|
|
10340
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10341
|
+
try {
|
|
10342
|
+
for(_iterator = Object.entries(headerRecord)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
10343
|
+
_step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
10344
|
+
headers.set(key, value);
|
|
10345
|
+
}
|
|
10346
|
+
} catch (err) {
|
|
10347
|
+
_didIteratorError = true;
|
|
10348
|
+
_iteratorError = err;
|
|
10349
|
+
} finally{
|
|
10350
|
+
try {
|
|
10351
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
10352
|
+
_iterator.return();
|
|
10353
|
+
}
|
|
10354
|
+
} finally{
|
|
10355
|
+
if (_didIteratorError) {
|
|
10356
|
+
throw _iteratorError;
|
|
10357
|
+
}
|
|
10358
|
+
}
|
|
10359
|
+
}
|
|
10360
|
+
if (!headers.has("content-type")) {
|
|
10361
|
+
headers.set("Content-Type", "application/octet-stream");
|
|
10362
|
+
}
|
|
10363
|
+
return [
|
|
10364
|
+
4,
|
|
10365
|
+
toBody(nodeStream)
|
|
10366
|
+
];
|
|
10367
|
+
case 2:
|
|
10368
|
+
body = _state.sent();
|
|
10369
|
+
return [
|
|
10370
|
+
2,
|
|
10371
|
+
new Response(body, {
|
|
10372
|
+
status: (_nodeResponse_status = nodeResponse.status) !== null && _nodeResponse_status !== void 0 ? _nodeResponse_status : 200,
|
|
10373
|
+
headers: headers
|
|
10374
|
+
})
|
|
10375
|
+
];
|
|
10376
|
+
}
|
|
10377
|
+
});
|
|
10378
|
+
})();
|
|
10379
|
+
}
|
|
10380
|
+
};
|
|
10381
|
+
};
|
|
10061
10382
|
// src/adapters/storage/azureAgentsStorageAdapter/index.ts
|
|
10062
10383
|
var azureAgentsStorageAdapter = function(param) {
|
|
10063
10384
|
var azureAiProject = param.azureAiProject;
|
|
@@ -10087,12 +10408,16 @@ var azureAgentsStorageAdapter = function(param) {
|
|
|
10087
10408
|
})), _define_property(_obj, submitToolOutputsRegexp, submitToolOutputs3({
|
|
10088
10409
|
azureAiProject: azureAiProject,
|
|
10089
10410
|
runAdapter: runAdapter
|
|
10411
|
+
})), _define_property(_obj, fileRegexp, file({
|
|
10412
|
+
azureAiProject: azureAiProject
|
|
10413
|
+
})), _define_property(_obj, fileContentRegexp, fileContent({
|
|
10414
|
+
azureAiProject: azureAiProject
|
|
10090
10415
|
})), _obj)
|
|
10091
10416
|
};
|
|
10092
10417
|
};
|
|
10093
10418
|
};
|
|
10094
10419
|
// src/adapters/run/responsesRunAdapter/index.ts
|
|
10095
|
-
var
|
|
10420
|
+
var import_dayjs29 = __toESM(require("dayjs"), 1);
|
|
10096
10421
|
var import_radash24 = require("radash");
|
|
10097
10422
|
var serializeToolCalls2 = function(param) {
|
|
10098
10423
|
var toolCalls = param.toolCalls;
|
|
@@ -10440,7 +10765,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10440
10765
|
4,
|
|
10441
10766
|
onEvent2.apply(void 0, [
|
|
10442
10767
|
(_tmp6.data = serializeItemAsMessage.apply(void 0, [
|
|
10443
|
-
(_tmp7.openaiAssistant = _state.sent(), _tmp7.createdAt = (0,
|
|
10768
|
+
(_tmp7.openaiAssistant = _state.sent(), _tmp7.createdAt = (0, import_dayjs29.default)().unix(), _tmp7.runId = responseCreatedResponse.id, _tmp7.status = "in_progress", _tmp7)
|
|
10444
10769
|
]), _tmp6)
|
|
10445
10770
|
])
|
|
10446
10771
|
];
|
|
@@ -10537,7 +10862,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10537
10862
|
4,
|
|
10538
10863
|
onEvent2.apply(void 0, [
|
|
10539
10864
|
(_tmp12.data = serializeItemAsMessage.apply(void 0, [
|
|
10540
|
-
(_tmp13.openaiAssistant = _state.sent(), _tmp13.createdAt = (0,
|
|
10865
|
+
(_tmp13.openaiAssistant = _state.sent(), _tmp13.createdAt = (0, import_dayjs29.default)().unix(), _tmp13.runId = responseCreatedResponse.id, _tmp13.status = "in_progress", _tmp13)
|
|
10541
10866
|
]), _tmp12)
|
|
10542
10867
|
])
|
|
10543
10868
|
];
|
|
@@ -10624,7 +10949,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10624
10949
|
4,
|
|
10625
10950
|
onEvent2.apply(void 0, [
|
|
10626
10951
|
(_tmp18.data = serializeItemAsMessage.apply(void 0, [
|
|
10627
|
-
(_tmp19.openaiAssistant = _state.sent(), _tmp19.createdAt = (0,
|
|
10952
|
+
(_tmp19.openaiAssistant = _state.sent(), _tmp19.createdAt = (0, import_dayjs29.default)().unix(), _tmp19.runId = responseCreatedResponse.id, _tmp19.status = "in_progress", _tmp19)
|
|
10628
10953
|
]), _tmp18)
|
|
10629
10954
|
])
|
|
10630
10955
|
];
|
|
@@ -10710,7 +11035,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10710
11035
|
4,
|
|
10711
11036
|
onEvent2.apply(void 0, [
|
|
10712
11037
|
(_tmp24.data = serializeItemAsMessage.apply(void 0, [
|
|
10713
|
-
(_tmp25.openaiAssistant = _state.sent(), _tmp25.createdAt = (0,
|
|
11038
|
+
(_tmp25.openaiAssistant = _state.sent(), _tmp25.createdAt = (0, import_dayjs29.default)().unix(), _tmp25.runId = responseCreatedResponse.id, _tmp25.status = "in_progress", _tmp25)
|
|
10714
11039
|
]), _tmp24)
|
|
10715
11040
|
])
|
|
10716
11041
|
];
|
|
@@ -10796,7 +11121,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10796
11121
|
4,
|
|
10797
11122
|
onEvent2.apply(void 0, [
|
|
10798
11123
|
(_tmp30.data = serializeItemAsMessage.apply(void 0, [
|
|
10799
|
-
(_tmp31.openaiAssistant = _state.sent(), _tmp31.createdAt = (0,
|
|
11124
|
+
(_tmp31.openaiAssistant = _state.sent(), _tmp31.createdAt = (0, import_dayjs29.default)().unix(), _tmp31.runId = responseCreatedResponse.id, _tmp31.status = "in_progress", _tmp31)
|
|
10800
11125
|
]), _tmp30)
|
|
10801
11126
|
])
|
|
10802
11127
|
];
|
|
@@ -10882,7 +11207,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10882
11207
|
4,
|
|
10883
11208
|
onEvent2.apply(void 0, [
|
|
10884
11209
|
(_tmp36.data = serializeItemAsMessage.apply(void 0, [
|
|
10885
|
-
(_tmp37.openaiAssistant = _state.sent(), _tmp37.createdAt = (0,
|
|
11210
|
+
(_tmp37.openaiAssistant = _state.sent(), _tmp37.createdAt = (0, import_dayjs29.default)().unix(), _tmp37.runId = responseCreatedResponse.id, _tmp37.status = "in_progress", _tmp37)
|
|
10886
11211
|
]), _tmp36)
|
|
10887
11212
|
])
|
|
10888
11213
|
];
|
|
@@ -10969,7 +11294,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10969
11294
|
4,
|
|
10970
11295
|
onEvent2.apply(void 0, [
|
|
10971
11296
|
(_tmp42.data = serializeItemAsMessage.apply(void 0, [
|
|
10972
|
-
(_tmp43.openaiAssistant = _state.sent(), _tmp43.createdAt = (0,
|
|
11297
|
+
(_tmp43.openaiAssistant = _state.sent(), _tmp43.createdAt = (0, import_dayjs29.default)().unix(), _tmp43.runId = responseCreatedResponse.id, _tmp43.status = "in_progress", _tmp43)
|
|
10973
11298
|
]), _tmp42)
|
|
10974
11299
|
])
|
|
10975
11300
|
];
|
|
@@ -11056,7 +11381,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11056
11381
|
4,
|
|
11057
11382
|
onEvent2.apply(void 0, [
|
|
11058
11383
|
(_tmp48.data = serializeItemAsMessage.apply(void 0, [
|
|
11059
|
-
(_tmp49.openaiAssistant = _state.sent(), _tmp49.createdAt = (0,
|
|
11384
|
+
(_tmp49.openaiAssistant = _state.sent(), _tmp49.createdAt = (0, import_dayjs29.default)().unix(), _tmp49.runId = responseCreatedResponse.id, _tmp49.status = "in_progress", _tmp49)
|
|
11060
11385
|
]), _tmp48)
|
|
11061
11386
|
])
|
|
11062
11387
|
];
|
|
@@ -11171,7 +11496,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11171
11496
|
4,
|
|
11172
11497
|
onEvent2.apply(void 0, [
|
|
11173
11498
|
(_tmp56.data = serializeItemAsMessage.apply(void 0, [
|
|
11174
|
-
(_tmp57.openaiAssistant = _state.sent(), _tmp57.createdAt = (0,
|
|
11499
|
+
(_tmp57.openaiAssistant = _state.sent(), _tmp57.createdAt = (0, import_dayjs29.default)().unix(), _tmp57.runId = responseCreatedResponse.id, _tmp57)
|
|
11175
11500
|
]), _tmp56)
|
|
11176
11501
|
])
|
|
11177
11502
|
];
|
|
@@ -11293,7 +11618,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11293
11618
|
4,
|
|
11294
11619
|
onEvent2.apply(void 0, [
|
|
11295
11620
|
(_tmp64.data = serializeItemAsMessage.apply(void 0, [
|
|
11296
|
-
(_tmp65.openaiAssistant = _state.sent(), _tmp65.createdAt = (0,
|
|
11621
|
+
(_tmp65.openaiAssistant = _state.sent(), _tmp65.createdAt = (0, import_dayjs29.default)().unix(), _tmp65.runId = responseCreatedResponse.id, _tmp65)
|
|
11297
11622
|
]), _tmp64)
|
|
11298
11623
|
])
|
|
11299
11624
|
];
|
|
@@ -11379,7 +11704,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11379
11704
|
4,
|
|
11380
11705
|
onEvent2.apply(void 0, [
|
|
11381
11706
|
(_tmp70.data = serializeItemAsMessage.apply(void 0, [
|
|
11382
|
-
(_tmp71.openaiAssistant = _state.sent(), _tmp71.createdAt = (0,
|
|
11707
|
+
(_tmp71.openaiAssistant = _state.sent(), _tmp71.createdAt = (0, import_dayjs29.default)().unix(), _tmp71.runId = responseCreatedResponse.id, _tmp71)
|
|
11383
11708
|
]), _tmp70)
|
|
11384
11709
|
])
|
|
11385
11710
|
];
|
|
@@ -11465,7 +11790,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11465
11790
|
4,
|
|
11466
11791
|
onEvent2.apply(void 0, [
|
|
11467
11792
|
(_tmp76.data = serializeItemAsMessage.apply(void 0, [
|
|
11468
|
-
(_tmp77.openaiAssistant = _state.sent(), _tmp77.createdAt = (0,
|
|
11793
|
+
(_tmp77.openaiAssistant = _state.sent(), _tmp77.createdAt = (0, import_dayjs29.default)().unix(), _tmp77.runId = responseCreatedResponse.id, _tmp77)
|
|
11469
11794
|
]), _tmp76)
|
|
11470
11795
|
])
|
|
11471
11796
|
];
|
|
@@ -11551,7 +11876,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11551
11876
|
4,
|
|
11552
11877
|
onEvent2.apply(void 0, [
|
|
11553
11878
|
(_tmp82.data = serializeItemAsMessage.apply(void 0, [
|
|
11554
|
-
(_tmp83.openaiAssistant = _state.sent(), _tmp83.createdAt = (0,
|
|
11879
|
+
(_tmp83.openaiAssistant = _state.sent(), _tmp83.createdAt = (0, import_dayjs29.default)().unix(), _tmp83.runId = responseCreatedResponse.id, _tmp83)
|
|
11555
11880
|
]), _tmp82)
|
|
11556
11881
|
])
|
|
11557
11882
|
];
|
|
@@ -11637,7 +11962,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11637
11962
|
4,
|
|
11638
11963
|
onEvent2.apply(void 0, [
|
|
11639
11964
|
(_tmp88.data = serializeItemAsMessage.apply(void 0, [
|
|
11640
|
-
(_tmp89.openaiAssistant = _state.sent(), _tmp89.createdAt = (0,
|
|
11965
|
+
(_tmp89.openaiAssistant = _state.sent(), _tmp89.createdAt = (0, import_dayjs29.default)().unix(), _tmp89.runId = responseCreatedResponse.id, _tmp89)
|
|
11641
11966
|
]), _tmp88)
|
|
11642
11967
|
])
|
|
11643
11968
|
];
|
|
@@ -11723,7 +12048,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11723
12048
|
4,
|
|
11724
12049
|
onEvent2.apply(void 0, [
|
|
11725
12050
|
(_tmp94.data = serializeItemAsMessage.apply(void 0, [
|
|
11726
|
-
(_tmp95.openaiAssistant = _state.sent(), _tmp95.createdAt = (0,
|
|
12051
|
+
(_tmp95.openaiAssistant = _state.sent(), _tmp95.createdAt = (0, import_dayjs29.default)().unix(), _tmp95.runId = responseCreatedResponse.id, _tmp95)
|
|
11727
12052
|
]), _tmp94)
|
|
11728
12053
|
])
|
|
11729
12054
|
];
|
|
@@ -11820,7 +12145,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11820
12145
|
_tmp97 = {
|
|
11821
12146
|
id: event.item_id,
|
|
11822
12147
|
object: "thread.message",
|
|
11823
|
-
created_at: (0,
|
|
12148
|
+
created_at: (0, import_dayjs29.default)().unix(),
|
|
11824
12149
|
thread_id: threadId,
|
|
11825
12150
|
completed_at: null,
|
|
11826
12151
|
incomplete_at: null,
|
|
@@ -11858,7 +12183,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11858
12183
|
_tmp99 = {
|
|
11859
12184
|
id: event.item_id,
|
|
11860
12185
|
object: "thread.message",
|
|
11861
|
-
created_at: (0,
|
|
12186
|
+
created_at: (0, import_dayjs29.default)().unix(),
|
|
11862
12187
|
thread_id: threadId,
|
|
11863
12188
|
completed_at: null,
|
|
11864
12189
|
incomplete_at: null,
|
|
@@ -12046,7 +12371,7 @@ var responsesRunAdapter = function(param) {
|
|
|
12046
12371
|
return [
|
|
12047
12372
|
4,
|
|
12048
12373
|
onEvent2.apply(void 0, [
|
|
12049
|
-
(_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.status = "failed", _tmp102.failed_at = (0,
|
|
12374
|
+
(_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.status = "failed", _tmp102.failed_at = (0, import_dayjs29.default)().unix(), _tmp102.last_error = {
|
|
12050
12375
|
code: "server_error",
|
|
12051
12376
|
message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
|
|
12052
12377
|
}, _tmp102), _tmp101)
|
|
@@ -12106,7 +12431,7 @@ var responsesRunAdapter = function(param) {
|
|
|
12106
12431
|
};
|
|
12107
12432
|
};
|
|
12108
12433
|
// src/adapters/run/azureAgentsRunAdapter/index.ts
|
|
12109
|
-
var
|
|
12434
|
+
var import_dayjs30 = __toESM(require("dayjs"), 1);
|
|
12110
12435
|
var import_radash25 = require("radash");
|
|
12111
12436
|
function transformAnnotations(annotations) {
|
|
12112
12437
|
return annotations.map(function(ann) {
|
|
@@ -12139,6 +12464,56 @@ function transformAnnotations(annotations) {
|
|
|
12139
12464
|
return ann;
|
|
12140
12465
|
});
|
|
12141
12466
|
}
|
|
12467
|
+
function transformMessageContentItem(content) {
|
|
12468
|
+
if (content.type === "text") {
|
|
12469
|
+
var _content_text, _content_text1;
|
|
12470
|
+
return {
|
|
12471
|
+
type: "text",
|
|
12472
|
+
text: {
|
|
12473
|
+
value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
|
|
12474
|
+
annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
|
|
12475
|
+
}
|
|
12476
|
+
};
|
|
12477
|
+
}
|
|
12478
|
+
if (content.type === "image_file") {
|
|
12479
|
+
var imageFile = content.image_file || content.imageFile || {};
|
|
12480
|
+
var _imageFile_detail;
|
|
12481
|
+
return {
|
|
12482
|
+
type: "image_file",
|
|
12483
|
+
image_file: {
|
|
12484
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
12485
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
12486
|
+
}
|
|
12487
|
+
};
|
|
12488
|
+
}
|
|
12489
|
+
return content;
|
|
12490
|
+
}
|
|
12491
|
+
function transformMessageDeltaContentItem(content) {
|
|
12492
|
+
if (content.type === "text") {
|
|
12493
|
+
var _content_text, _content_text1;
|
|
12494
|
+
return {
|
|
12495
|
+
index: content.index || 0,
|
|
12496
|
+
type: "text",
|
|
12497
|
+
text: {
|
|
12498
|
+
value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
|
|
12499
|
+
annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
|
|
12500
|
+
}
|
|
12501
|
+
};
|
|
12502
|
+
}
|
|
12503
|
+
if (content.type === "image_file") {
|
|
12504
|
+
var imageFile = content.image_file || content.imageFile || {};
|
|
12505
|
+
var _imageFile_detail;
|
|
12506
|
+
return {
|
|
12507
|
+
index: content.index || 0,
|
|
12508
|
+
type: "image_file",
|
|
12509
|
+
image_file: {
|
|
12510
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
12511
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
12512
|
+
}
|
|
12513
|
+
};
|
|
12514
|
+
}
|
|
12515
|
+
return content;
|
|
12516
|
+
}
|
|
12142
12517
|
function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
12143
12518
|
var event = azureEvent.event, data = azureEvent.data;
|
|
12144
12519
|
var eventType = event;
|
|
@@ -12150,7 +12525,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12150
12525
|
data: {
|
|
12151
12526
|
id: data.id,
|
|
12152
12527
|
object: "thread.run",
|
|
12153
|
-
created_at: (0,
|
|
12528
|
+
created_at: (0, import_dayjs30.default)(data.createdAt).unix(),
|
|
12154
12529
|
thread_id: data.threadId,
|
|
12155
12530
|
assistant_id: assistantId,
|
|
12156
12531
|
status: data.status,
|
|
@@ -12174,10 +12549,10 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12174
12549
|
message: JSON.stringify(data.lastError)
|
|
12175
12550
|
} : null,
|
|
12176
12551
|
expires_at: null,
|
|
12177
|
-
started_at: data.startedAt ? (0,
|
|
12178
|
-
cancelled_at: data.cancelledAt ? (0,
|
|
12179
|
-
failed_at: data.failedAt ? (0,
|
|
12180
|
-
completed_at: data.completedAt ? (0,
|
|
12552
|
+
started_at: data.startedAt ? (0, import_dayjs30.default)(data.startedAt).unix() : null,
|
|
12553
|
+
cancelled_at: data.cancelledAt ? (0, import_dayjs30.default)(data.cancelledAt).unix() : null,
|
|
12554
|
+
failed_at: data.failedAt ? (0, import_dayjs30.default)(data.failedAt).unix() : null,
|
|
12555
|
+
completed_at: data.completedAt ? (0, import_dayjs30.default)(data.completedAt).unix() : null,
|
|
12181
12556
|
incomplete_details: null,
|
|
12182
12557
|
model: data.model || "",
|
|
12183
12558
|
instructions: data.instructions || "",
|
|
@@ -12205,28 +12580,18 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12205
12580
|
data: {
|
|
12206
12581
|
id: data.id,
|
|
12207
12582
|
object: "thread.message",
|
|
12208
|
-
created_at: (0,
|
|
12583
|
+
created_at: (0, import_dayjs30.default)(data.createdAt).unix(),
|
|
12209
12584
|
thread_id: data.threadId,
|
|
12210
12585
|
role: data.role,
|
|
12211
12586
|
content: ((_data_content = data.content) === null || _data_content === void 0 ? void 0 : _data_content.map(function(c) {
|
|
12212
|
-
|
|
12213
|
-
var _c_text, _c_text1;
|
|
12214
|
-
return {
|
|
12215
|
-
type: "text",
|
|
12216
|
-
text: {
|
|
12217
|
-
value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
|
|
12218
|
-
annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
|
|
12219
|
-
}
|
|
12220
|
-
};
|
|
12221
|
-
}
|
|
12222
|
-
return c;
|
|
12587
|
+
return transformMessageContentItem(c);
|
|
12223
12588
|
})) || [],
|
|
12224
12589
|
assistant_id: assistantId,
|
|
12225
12590
|
run_id: data.runId || null,
|
|
12226
12591
|
attachments: data.attachments || [],
|
|
12227
12592
|
metadata: data.metadata || {},
|
|
12228
12593
|
status: data.status || "completed",
|
|
12229
|
-
completed_at: data.completedAt ? (0,
|
|
12594
|
+
completed_at: data.completedAt ? (0, import_dayjs30.default)(data.completedAt).unix() : null,
|
|
12230
12595
|
incomplete_at: null,
|
|
12231
12596
|
incomplete_details: null
|
|
12232
12597
|
}
|
|
@@ -12241,18 +12606,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12241
12606
|
object: "thread.message.delta",
|
|
12242
12607
|
delta: {
|
|
12243
12608
|
content: ((_data_delta = data.delta) === null || _data_delta === void 0 ? void 0 : (_data_delta_content = _data_delta.content) === null || _data_delta_content === void 0 ? void 0 : _data_delta_content.map(function(c) {
|
|
12244
|
-
|
|
12245
|
-
var _c_text, _c_text1;
|
|
12246
|
-
return {
|
|
12247
|
-
index: c.index || 0,
|
|
12248
|
-
type: "text",
|
|
12249
|
-
text: {
|
|
12250
|
-
value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
|
|
12251
|
-
annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
|
|
12252
|
-
}
|
|
12253
|
-
};
|
|
12254
|
-
}
|
|
12255
|
-
return c;
|
|
12609
|
+
return transformMessageDeltaContentItem(c);
|
|
12256
12610
|
})) || []
|
|
12257
12611
|
}
|
|
12258
12612
|
}
|
|
@@ -12426,7 +12780,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12426
12780
|
data: {
|
|
12427
12781
|
id: data.id,
|
|
12428
12782
|
object: "thread.run.step",
|
|
12429
|
-
created_at: (0,
|
|
12783
|
+
created_at: (0, import_dayjs30.default)(data.createdAt).unix(),
|
|
12430
12784
|
assistant_id: assistantId,
|
|
12431
12785
|
thread_id: data.threadId,
|
|
12432
12786
|
run_id: data.runId,
|
|
@@ -12435,9 +12789,9 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12435
12789
|
step_details: stepDetails,
|
|
12436
12790
|
last_error: data.lastError || null,
|
|
12437
12791
|
expired_at: null,
|
|
12438
|
-
cancelled_at: data.cancelledAt ? (0,
|
|
12439
|
-
failed_at: data.failedAt ? (0,
|
|
12440
|
-
completed_at: data.completedAt ? (0,
|
|
12792
|
+
cancelled_at: data.cancelledAt ? (0, import_dayjs30.default)(data.cancelledAt).unix() : null,
|
|
12793
|
+
failed_at: data.failedAt ? (0, import_dayjs30.default)(data.failedAt).unix() : null,
|
|
12794
|
+
completed_at: data.completedAt ? (0, import_dayjs30.default)(data.completedAt).unix() : null,
|
|
12441
12795
|
metadata: data.metadata || {},
|
|
12442
12796
|
usage: null
|
|
12443
12797
|
}
|
|
@@ -12449,7 +12803,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12449
12803
|
data: {
|
|
12450
12804
|
id: data.id,
|
|
12451
12805
|
object: "thread",
|
|
12452
|
-
created_at: (0,
|
|
12806
|
+
created_at: (0, import_dayjs30.default)(data.createdAt).unix(),
|
|
12453
12807
|
metadata: data.metadata || {},
|
|
12454
12808
|
tool_resources: data.toolResources || null
|
|
12455
12809
|
}
|
|
@@ -12590,7 +12944,7 @@ var azureAgentsRunAdapter = function(param) {
|
|
|
12590
12944
|
data: {
|
|
12591
12945
|
id: errorRunId,
|
|
12592
12946
|
object: "thread.run",
|
|
12593
|
-
created_at: (0,
|
|
12947
|
+
created_at: (0, import_dayjs30.default)().unix(),
|
|
12594
12948
|
thread_id: threadId,
|
|
12595
12949
|
assistant_id: assistantId,
|
|
12596
12950
|
status: "failed",
|
|
@@ -12600,9 +12954,9 @@ var azureAgentsRunAdapter = function(param) {
|
|
|
12600
12954
|
message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
|
|
12601
12955
|
},
|
|
12602
12956
|
expires_at: null,
|
|
12603
|
-
started_at: (0,
|
|
12957
|
+
started_at: (0, import_dayjs30.default)().unix(),
|
|
12604
12958
|
cancelled_at: null,
|
|
12605
|
-
failed_at: (0,
|
|
12959
|
+
failed_at: (0, import_dayjs30.default)().unix(),
|
|
12606
12960
|
completed_at: null,
|
|
12607
12961
|
incomplete_details: null,
|
|
12608
12962
|
model: "",
|