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.js
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
|
}
|
|
@@ -8468,6 +8475,16 @@ var post21 = function(param) {
|
|
|
8468
8475
|
annotations: annotations
|
|
8469
8476
|
}
|
|
8470
8477
|
};
|
|
8478
|
+
} else if (c.type === "image_file") {
|
|
8479
|
+
var imageFile = c.image_file || c.imageFile || {};
|
|
8480
|
+
var _imageFile_detail;
|
|
8481
|
+
return {
|
|
8482
|
+
type: "image_file",
|
|
8483
|
+
image_file: {
|
|
8484
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
8485
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
8486
|
+
}
|
|
8487
|
+
};
|
|
8471
8488
|
}
|
|
8472
8489
|
return c;
|
|
8473
8490
|
}),
|
|
@@ -8583,6 +8600,16 @@ var get19 = function(param) {
|
|
|
8583
8600
|
annotations: annotations
|
|
8584
8601
|
}
|
|
8585
8602
|
};
|
|
8603
|
+
} else if (c.type === "image_file") {
|
|
8604
|
+
var imageFile = c.image_file || c.imageFile || {};
|
|
8605
|
+
var _imageFile_detail;
|
|
8606
|
+
return {
|
|
8607
|
+
type: "image_file",
|
|
8608
|
+
image_file: {
|
|
8609
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
8610
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
8611
|
+
}
|
|
8612
|
+
};
|
|
8586
8613
|
}
|
|
8587
8614
|
return c;
|
|
8588
8615
|
}),
|
|
@@ -9938,6 +9965,300 @@ var assistants3 = function(param) {
|
|
|
9938
9965
|
})
|
|
9939
9966
|
};
|
|
9940
9967
|
};
|
|
9968
|
+
// src/lib/files/fileRegexp.ts
|
|
9969
|
+
var fileRegexp = "^/(?:v1|/?openai)/files/([^/]+)$";
|
|
9970
|
+
// src/lib/files/fileContentRegexp.ts
|
|
9971
|
+
var fileContentRegexp = "^/(?:v1|/?openai)/files/([^/]+)/content$";
|
|
9972
|
+
// src/lib/files/transformAzureFile.ts
|
|
9973
|
+
import dayjs28 from "dayjs";
|
|
9974
|
+
var toUnixSeconds = function(value) {
|
|
9975
|
+
if (!value) return void 0;
|
|
9976
|
+
if (_instanceof(value, Date)) {
|
|
9977
|
+
return dayjs28(value).unix();
|
|
9978
|
+
}
|
|
9979
|
+
if (typeof value === "number") {
|
|
9980
|
+
if (value > 9999999999) {
|
|
9981
|
+
return dayjs28(value).unix();
|
|
9982
|
+
}
|
|
9983
|
+
return Math.floor(value);
|
|
9984
|
+
}
|
|
9985
|
+
var parsed = dayjs28(value);
|
|
9986
|
+
return parsed.isValid() ? parsed.unix() : void 0;
|
|
9987
|
+
};
|
|
9988
|
+
var transformAzureFile = function(file2) {
|
|
9989
|
+
var _toUnixSeconds;
|
|
9990
|
+
var createdAtUnix = (_toUnixSeconds = toUnixSeconds(file2.createdAt)) !== null && _toUnixSeconds !== void 0 ? _toUnixSeconds : dayjs28().unix();
|
|
9991
|
+
var expiresAtUnix = toUnixSeconds(file2.expiresAt);
|
|
9992
|
+
var _file2_bytes;
|
|
9993
|
+
var openaiFile = {
|
|
9994
|
+
id: file2.id,
|
|
9995
|
+
object: file2.object || "file",
|
|
9996
|
+
bytes: (_file2_bytes = file2.bytes) !== null && _file2_bytes !== void 0 ? _file2_bytes : 0,
|
|
9997
|
+
created_at: createdAtUnix,
|
|
9998
|
+
filename: file2.filename || "file",
|
|
9999
|
+
purpose: file2.purpose || "assistants",
|
|
10000
|
+
status: file2.status || "processed"
|
|
10001
|
+
};
|
|
10002
|
+
if (expiresAtUnix !== void 0) {
|
|
10003
|
+
openaiFile.expires_at = expiresAtUnix;
|
|
10004
|
+
}
|
|
10005
|
+
if (file2.statusDetails) {
|
|
10006
|
+
openaiFile.status_details = file2.statusDetails;
|
|
10007
|
+
}
|
|
10008
|
+
return openaiFile;
|
|
10009
|
+
};
|
|
10010
|
+
// src/adapters/storage/azureAgentsStorageAdapter/files/get.ts
|
|
10011
|
+
var file = function(param) {
|
|
10012
|
+
var azureAiProject = param.azureAiProject;
|
|
10013
|
+
return {
|
|
10014
|
+
get: function(url) {
|
|
10015
|
+
return _async_to_generator(function() {
|
|
10016
|
+
var pathname, match, _match, fileId, azureFile, openaiFile;
|
|
10017
|
+
return _ts_generator(this, function(_state) {
|
|
10018
|
+
switch(_state.label){
|
|
10019
|
+
case 0:
|
|
10020
|
+
pathname = new URL(url).pathname;
|
|
10021
|
+
match = pathname.match(new RegExp(fileRegexp));
|
|
10022
|
+
if (!match) {
|
|
10023
|
+
return [
|
|
10024
|
+
2,
|
|
10025
|
+
new Response("Not Found", {
|
|
10026
|
+
status: 404
|
|
10027
|
+
})
|
|
10028
|
+
];
|
|
10029
|
+
}
|
|
10030
|
+
_match = _sliced_to_array(match, 2), fileId = _match[1];
|
|
10031
|
+
return [
|
|
10032
|
+
4,
|
|
10033
|
+
azureAiProject.agents.files.get(fileId)
|
|
10034
|
+
];
|
|
10035
|
+
case 1:
|
|
10036
|
+
azureFile = _state.sent();
|
|
10037
|
+
openaiFile = transformAzureFile(azureFile);
|
|
10038
|
+
return [
|
|
10039
|
+
2,
|
|
10040
|
+
new Response(JSON.stringify(openaiFile), {
|
|
10041
|
+
status: 200,
|
|
10042
|
+
headers: {
|
|
10043
|
+
"Content-Type": "application/json"
|
|
10044
|
+
}
|
|
10045
|
+
})
|
|
10046
|
+
];
|
|
10047
|
+
}
|
|
10048
|
+
});
|
|
10049
|
+
})();
|
|
10050
|
+
}
|
|
10051
|
+
};
|
|
10052
|
+
};
|
|
10053
|
+
// src/adapters/storage/azureAgentsStorageAdapter/files/content.ts
|
|
10054
|
+
import { Readable } from "stream";
|
|
10055
|
+
var headersToRecord = function(headers) {
|
|
10056
|
+
if (!headers) return {};
|
|
10057
|
+
if (typeof headers.get === "function") {
|
|
10058
|
+
var result = {};
|
|
10059
|
+
for(var _i = 0, _iter = [
|
|
10060
|
+
"content-type",
|
|
10061
|
+
"content-length"
|
|
10062
|
+
]; _i < _iter.length; _i++){
|
|
10063
|
+
var headerName = _iter[_i];
|
|
10064
|
+
var value = headers.get(headerName);
|
|
10065
|
+
if (value) {
|
|
10066
|
+
result[headerName] = value;
|
|
10067
|
+
}
|
|
10068
|
+
}
|
|
10069
|
+
return result;
|
|
10070
|
+
}
|
|
10071
|
+
var json = typeof headers.toJSON === "function" ? headers.toJSON() : headers;
|
|
10072
|
+
return (typeof json === "undefined" ? "undefined" : _type_of(json)) === "object" && json !== null ? json : {};
|
|
10073
|
+
};
|
|
10074
|
+
var toBody = function(nodeStream) {
|
|
10075
|
+
return _async_to_generator(function() {
|
|
10076
|
+
var chunks, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
10077
|
+
return _ts_generator(this, function(_state) {
|
|
10078
|
+
switch(_state.label){
|
|
10079
|
+
case 0:
|
|
10080
|
+
if (typeof Readable.toWeb === "function") {
|
|
10081
|
+
return [
|
|
10082
|
+
2,
|
|
10083
|
+
Readable.toWeb(nodeStream)
|
|
10084
|
+
];
|
|
10085
|
+
}
|
|
10086
|
+
chunks = [];
|
|
10087
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
10088
|
+
_state.label = 1;
|
|
10089
|
+
case 1:
|
|
10090
|
+
_state.trys.push([
|
|
10091
|
+
1,
|
|
10092
|
+
6,
|
|
10093
|
+
7,
|
|
10094
|
+
12
|
|
10095
|
+
]);
|
|
10096
|
+
_iterator = _async_iterator(nodeStream);
|
|
10097
|
+
_state.label = 2;
|
|
10098
|
+
case 2:
|
|
10099
|
+
return [
|
|
10100
|
+
4,
|
|
10101
|
+
_iterator.next()
|
|
10102
|
+
];
|
|
10103
|
+
case 3:
|
|
10104
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
10105
|
+
3,
|
|
10106
|
+
5
|
|
10107
|
+
];
|
|
10108
|
+
_value = _step.value;
|
|
10109
|
+
chunk = _value;
|
|
10110
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
10111
|
+
_state.label = 4;
|
|
10112
|
+
case 4:
|
|
10113
|
+
_iteratorAbruptCompletion = false;
|
|
10114
|
+
return [
|
|
10115
|
+
3,
|
|
10116
|
+
2
|
|
10117
|
+
];
|
|
10118
|
+
case 5:
|
|
10119
|
+
return [
|
|
10120
|
+
3,
|
|
10121
|
+
12
|
|
10122
|
+
];
|
|
10123
|
+
case 6:
|
|
10124
|
+
err = _state.sent();
|
|
10125
|
+
_didIteratorError = true;
|
|
10126
|
+
_iteratorError = err;
|
|
10127
|
+
return [
|
|
10128
|
+
3,
|
|
10129
|
+
12
|
|
10130
|
+
];
|
|
10131
|
+
case 7:
|
|
10132
|
+
_state.trys.push([
|
|
10133
|
+
7,
|
|
10134
|
+
,
|
|
10135
|
+
10,
|
|
10136
|
+
11
|
|
10137
|
+
]);
|
|
10138
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
10139
|
+
3,
|
|
10140
|
+
9
|
|
10141
|
+
];
|
|
10142
|
+
return [
|
|
10143
|
+
4,
|
|
10144
|
+
_iterator.return()
|
|
10145
|
+
];
|
|
10146
|
+
case 8:
|
|
10147
|
+
_state.sent();
|
|
10148
|
+
_state.label = 9;
|
|
10149
|
+
case 9:
|
|
10150
|
+
return [
|
|
10151
|
+
3,
|
|
10152
|
+
11
|
|
10153
|
+
];
|
|
10154
|
+
case 10:
|
|
10155
|
+
if (_didIteratorError) {
|
|
10156
|
+
throw _iteratorError;
|
|
10157
|
+
}
|
|
10158
|
+
return [
|
|
10159
|
+
7
|
|
10160
|
+
];
|
|
10161
|
+
case 11:
|
|
10162
|
+
return [
|
|
10163
|
+
7
|
|
10164
|
+
];
|
|
10165
|
+
case 12:
|
|
10166
|
+
return [
|
|
10167
|
+
2,
|
|
10168
|
+
Buffer.concat(chunks)
|
|
10169
|
+
];
|
|
10170
|
+
}
|
|
10171
|
+
});
|
|
10172
|
+
})();
|
|
10173
|
+
};
|
|
10174
|
+
var fileContent = function(param) {
|
|
10175
|
+
var azureAiProject = param.azureAiProject;
|
|
10176
|
+
return {
|
|
10177
|
+
get: function(url) {
|
|
10178
|
+
return _async_to_generator(function() {
|
|
10179
|
+
var pathname, match, _match, fileId, streamable, nodeResponse, nodeStream, headerRecord, headers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, body, _nodeResponse_status;
|
|
10180
|
+
return _ts_generator(this, function(_state) {
|
|
10181
|
+
switch(_state.label){
|
|
10182
|
+
case 0:
|
|
10183
|
+
pathname = new URL(url).pathname;
|
|
10184
|
+
match = pathname.match(new RegExp(fileContentRegexp));
|
|
10185
|
+
if (!match) {
|
|
10186
|
+
return [
|
|
10187
|
+
2,
|
|
10188
|
+
new Response("Not Found", {
|
|
10189
|
+
status: 404
|
|
10190
|
+
})
|
|
10191
|
+
];
|
|
10192
|
+
}
|
|
10193
|
+
_match = _sliced_to_array(match, 2), fileId = _match[1];
|
|
10194
|
+
streamable = azureAiProject.agents.files.getContent(fileId);
|
|
10195
|
+
if (!streamable || typeof streamable.asNodeStream !== "function") {
|
|
10196
|
+
return [
|
|
10197
|
+
2,
|
|
10198
|
+
new Response("File content unavailable", {
|
|
10199
|
+
status: 500
|
|
10200
|
+
})
|
|
10201
|
+
];
|
|
10202
|
+
}
|
|
10203
|
+
return [
|
|
10204
|
+
4,
|
|
10205
|
+
streamable.asNodeStream()
|
|
10206
|
+
];
|
|
10207
|
+
case 1:
|
|
10208
|
+
nodeResponse = _state.sent();
|
|
10209
|
+
nodeStream = nodeResponse.body;
|
|
10210
|
+
if (!nodeStream) {
|
|
10211
|
+
return [
|
|
10212
|
+
2,
|
|
10213
|
+
new Response("", {
|
|
10214
|
+
status: 204
|
|
10215
|
+
})
|
|
10216
|
+
];
|
|
10217
|
+
}
|
|
10218
|
+
headerRecord = headersToRecord(nodeResponse.headers);
|
|
10219
|
+
headers = new Headers();
|
|
10220
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10221
|
+
try {
|
|
10222
|
+
for(_iterator = Object.entries(headerRecord)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
10223
|
+
_step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
10224
|
+
headers.set(key, value);
|
|
10225
|
+
}
|
|
10226
|
+
} catch (err) {
|
|
10227
|
+
_didIteratorError = true;
|
|
10228
|
+
_iteratorError = err;
|
|
10229
|
+
} finally{
|
|
10230
|
+
try {
|
|
10231
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
10232
|
+
_iterator.return();
|
|
10233
|
+
}
|
|
10234
|
+
} finally{
|
|
10235
|
+
if (_didIteratorError) {
|
|
10236
|
+
throw _iteratorError;
|
|
10237
|
+
}
|
|
10238
|
+
}
|
|
10239
|
+
}
|
|
10240
|
+
if (!headers.has("content-type")) {
|
|
10241
|
+
headers.set("Content-Type", "application/octet-stream");
|
|
10242
|
+
}
|
|
10243
|
+
return [
|
|
10244
|
+
4,
|
|
10245
|
+
toBody(nodeStream)
|
|
10246
|
+
];
|
|
10247
|
+
case 2:
|
|
10248
|
+
body = _state.sent();
|
|
10249
|
+
return [
|
|
10250
|
+
2,
|
|
10251
|
+
new Response(body, {
|
|
10252
|
+
status: (_nodeResponse_status = nodeResponse.status) !== null && _nodeResponse_status !== void 0 ? _nodeResponse_status : 200,
|
|
10253
|
+
headers: headers
|
|
10254
|
+
})
|
|
10255
|
+
];
|
|
10256
|
+
}
|
|
10257
|
+
});
|
|
10258
|
+
})();
|
|
10259
|
+
}
|
|
10260
|
+
};
|
|
10261
|
+
};
|
|
9941
10262
|
// src/adapters/storage/azureAgentsStorageAdapter/index.ts
|
|
9942
10263
|
var azureAgentsStorageAdapter = function(param) {
|
|
9943
10264
|
var azureAiProject = param.azureAiProject;
|
|
@@ -9967,12 +10288,16 @@ var azureAgentsStorageAdapter = function(param) {
|
|
|
9967
10288
|
})), _define_property(_obj, submitToolOutputsRegexp, submitToolOutputs3({
|
|
9968
10289
|
azureAiProject: azureAiProject,
|
|
9969
10290
|
runAdapter: runAdapter
|
|
10291
|
+
})), _define_property(_obj, fileRegexp, file({
|
|
10292
|
+
azureAiProject: azureAiProject
|
|
10293
|
+
})), _define_property(_obj, fileContentRegexp, fileContent({
|
|
10294
|
+
azureAiProject: azureAiProject
|
|
9970
10295
|
})), _obj)
|
|
9971
10296
|
};
|
|
9972
10297
|
};
|
|
9973
10298
|
};
|
|
9974
10299
|
// src/adapters/run/responsesRunAdapter/index.ts
|
|
9975
|
-
import
|
|
10300
|
+
import dayjs29 from "dayjs";
|
|
9976
10301
|
import { uid as uid9 } from "radash";
|
|
9977
10302
|
var serializeToolCalls2 = function(param) {
|
|
9978
10303
|
var toolCalls = param.toolCalls;
|
|
@@ -10320,7 +10645,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10320
10645
|
4,
|
|
10321
10646
|
onEvent2.apply(void 0, [
|
|
10322
10647
|
(_tmp6.data = serializeItemAsMessage.apply(void 0, [
|
|
10323
|
-
(_tmp7.openaiAssistant = _state.sent(), _tmp7.createdAt =
|
|
10648
|
+
(_tmp7.openaiAssistant = _state.sent(), _tmp7.createdAt = dayjs29().unix(), _tmp7.runId = responseCreatedResponse.id, _tmp7.status = "in_progress", _tmp7)
|
|
10324
10649
|
]), _tmp6)
|
|
10325
10650
|
])
|
|
10326
10651
|
];
|
|
@@ -10417,7 +10742,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10417
10742
|
4,
|
|
10418
10743
|
onEvent2.apply(void 0, [
|
|
10419
10744
|
(_tmp12.data = serializeItemAsMessage.apply(void 0, [
|
|
10420
|
-
(_tmp13.openaiAssistant = _state.sent(), _tmp13.createdAt =
|
|
10745
|
+
(_tmp13.openaiAssistant = _state.sent(), _tmp13.createdAt = dayjs29().unix(), _tmp13.runId = responseCreatedResponse.id, _tmp13.status = "in_progress", _tmp13)
|
|
10421
10746
|
]), _tmp12)
|
|
10422
10747
|
])
|
|
10423
10748
|
];
|
|
@@ -10504,7 +10829,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10504
10829
|
4,
|
|
10505
10830
|
onEvent2.apply(void 0, [
|
|
10506
10831
|
(_tmp18.data = serializeItemAsMessage.apply(void 0, [
|
|
10507
|
-
(_tmp19.openaiAssistant = _state.sent(), _tmp19.createdAt =
|
|
10832
|
+
(_tmp19.openaiAssistant = _state.sent(), _tmp19.createdAt = dayjs29().unix(), _tmp19.runId = responseCreatedResponse.id, _tmp19.status = "in_progress", _tmp19)
|
|
10508
10833
|
]), _tmp18)
|
|
10509
10834
|
])
|
|
10510
10835
|
];
|
|
@@ -10590,7 +10915,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10590
10915
|
4,
|
|
10591
10916
|
onEvent2.apply(void 0, [
|
|
10592
10917
|
(_tmp24.data = serializeItemAsMessage.apply(void 0, [
|
|
10593
|
-
(_tmp25.openaiAssistant = _state.sent(), _tmp25.createdAt =
|
|
10918
|
+
(_tmp25.openaiAssistant = _state.sent(), _tmp25.createdAt = dayjs29().unix(), _tmp25.runId = responseCreatedResponse.id, _tmp25.status = "in_progress", _tmp25)
|
|
10594
10919
|
]), _tmp24)
|
|
10595
10920
|
])
|
|
10596
10921
|
];
|
|
@@ -10676,7 +11001,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10676
11001
|
4,
|
|
10677
11002
|
onEvent2.apply(void 0, [
|
|
10678
11003
|
(_tmp30.data = serializeItemAsMessage.apply(void 0, [
|
|
10679
|
-
(_tmp31.openaiAssistant = _state.sent(), _tmp31.createdAt =
|
|
11004
|
+
(_tmp31.openaiAssistant = _state.sent(), _tmp31.createdAt = dayjs29().unix(), _tmp31.runId = responseCreatedResponse.id, _tmp31.status = "in_progress", _tmp31)
|
|
10680
11005
|
]), _tmp30)
|
|
10681
11006
|
])
|
|
10682
11007
|
];
|
|
@@ -10762,7 +11087,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10762
11087
|
4,
|
|
10763
11088
|
onEvent2.apply(void 0, [
|
|
10764
11089
|
(_tmp36.data = serializeItemAsMessage.apply(void 0, [
|
|
10765
|
-
(_tmp37.openaiAssistant = _state.sent(), _tmp37.createdAt =
|
|
11090
|
+
(_tmp37.openaiAssistant = _state.sent(), _tmp37.createdAt = dayjs29().unix(), _tmp37.runId = responseCreatedResponse.id, _tmp37.status = "in_progress", _tmp37)
|
|
10766
11091
|
]), _tmp36)
|
|
10767
11092
|
])
|
|
10768
11093
|
];
|
|
@@ -10849,7 +11174,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10849
11174
|
4,
|
|
10850
11175
|
onEvent2.apply(void 0, [
|
|
10851
11176
|
(_tmp42.data = serializeItemAsMessage.apply(void 0, [
|
|
10852
|
-
(_tmp43.openaiAssistant = _state.sent(), _tmp43.createdAt =
|
|
11177
|
+
(_tmp43.openaiAssistant = _state.sent(), _tmp43.createdAt = dayjs29().unix(), _tmp43.runId = responseCreatedResponse.id, _tmp43.status = "in_progress", _tmp43)
|
|
10853
11178
|
]), _tmp42)
|
|
10854
11179
|
])
|
|
10855
11180
|
];
|
|
@@ -10936,7 +11261,7 @@ var responsesRunAdapter = function(param) {
|
|
|
10936
11261
|
4,
|
|
10937
11262
|
onEvent2.apply(void 0, [
|
|
10938
11263
|
(_tmp48.data = serializeItemAsMessage.apply(void 0, [
|
|
10939
|
-
(_tmp49.openaiAssistant = _state.sent(), _tmp49.createdAt =
|
|
11264
|
+
(_tmp49.openaiAssistant = _state.sent(), _tmp49.createdAt = dayjs29().unix(), _tmp49.runId = responseCreatedResponse.id, _tmp49.status = "in_progress", _tmp49)
|
|
10940
11265
|
]), _tmp48)
|
|
10941
11266
|
])
|
|
10942
11267
|
];
|
|
@@ -11051,7 +11376,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11051
11376
|
4,
|
|
11052
11377
|
onEvent2.apply(void 0, [
|
|
11053
11378
|
(_tmp56.data = serializeItemAsMessage.apply(void 0, [
|
|
11054
|
-
(_tmp57.openaiAssistant = _state.sent(), _tmp57.createdAt =
|
|
11379
|
+
(_tmp57.openaiAssistant = _state.sent(), _tmp57.createdAt = dayjs29().unix(), _tmp57.runId = responseCreatedResponse.id, _tmp57)
|
|
11055
11380
|
]), _tmp56)
|
|
11056
11381
|
])
|
|
11057
11382
|
];
|
|
@@ -11173,7 +11498,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11173
11498
|
4,
|
|
11174
11499
|
onEvent2.apply(void 0, [
|
|
11175
11500
|
(_tmp64.data = serializeItemAsMessage.apply(void 0, [
|
|
11176
|
-
(_tmp65.openaiAssistant = _state.sent(), _tmp65.createdAt =
|
|
11501
|
+
(_tmp65.openaiAssistant = _state.sent(), _tmp65.createdAt = dayjs29().unix(), _tmp65.runId = responseCreatedResponse.id, _tmp65)
|
|
11177
11502
|
]), _tmp64)
|
|
11178
11503
|
])
|
|
11179
11504
|
];
|
|
@@ -11259,7 +11584,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11259
11584
|
4,
|
|
11260
11585
|
onEvent2.apply(void 0, [
|
|
11261
11586
|
(_tmp70.data = serializeItemAsMessage.apply(void 0, [
|
|
11262
|
-
(_tmp71.openaiAssistant = _state.sent(), _tmp71.createdAt =
|
|
11587
|
+
(_tmp71.openaiAssistant = _state.sent(), _tmp71.createdAt = dayjs29().unix(), _tmp71.runId = responseCreatedResponse.id, _tmp71)
|
|
11263
11588
|
]), _tmp70)
|
|
11264
11589
|
])
|
|
11265
11590
|
];
|
|
@@ -11345,7 +11670,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11345
11670
|
4,
|
|
11346
11671
|
onEvent2.apply(void 0, [
|
|
11347
11672
|
(_tmp76.data = serializeItemAsMessage.apply(void 0, [
|
|
11348
|
-
(_tmp77.openaiAssistant = _state.sent(), _tmp77.createdAt =
|
|
11673
|
+
(_tmp77.openaiAssistant = _state.sent(), _tmp77.createdAt = dayjs29().unix(), _tmp77.runId = responseCreatedResponse.id, _tmp77)
|
|
11349
11674
|
]), _tmp76)
|
|
11350
11675
|
])
|
|
11351
11676
|
];
|
|
@@ -11431,7 +11756,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11431
11756
|
4,
|
|
11432
11757
|
onEvent2.apply(void 0, [
|
|
11433
11758
|
(_tmp82.data = serializeItemAsMessage.apply(void 0, [
|
|
11434
|
-
(_tmp83.openaiAssistant = _state.sent(), _tmp83.createdAt =
|
|
11759
|
+
(_tmp83.openaiAssistant = _state.sent(), _tmp83.createdAt = dayjs29().unix(), _tmp83.runId = responseCreatedResponse.id, _tmp83)
|
|
11435
11760
|
]), _tmp82)
|
|
11436
11761
|
])
|
|
11437
11762
|
];
|
|
@@ -11517,7 +11842,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11517
11842
|
4,
|
|
11518
11843
|
onEvent2.apply(void 0, [
|
|
11519
11844
|
(_tmp88.data = serializeItemAsMessage.apply(void 0, [
|
|
11520
|
-
(_tmp89.openaiAssistant = _state.sent(), _tmp89.createdAt =
|
|
11845
|
+
(_tmp89.openaiAssistant = _state.sent(), _tmp89.createdAt = dayjs29().unix(), _tmp89.runId = responseCreatedResponse.id, _tmp89)
|
|
11521
11846
|
]), _tmp88)
|
|
11522
11847
|
])
|
|
11523
11848
|
];
|
|
@@ -11603,7 +11928,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11603
11928
|
4,
|
|
11604
11929
|
onEvent2.apply(void 0, [
|
|
11605
11930
|
(_tmp94.data = serializeItemAsMessage.apply(void 0, [
|
|
11606
|
-
(_tmp95.openaiAssistant = _state.sent(), _tmp95.createdAt =
|
|
11931
|
+
(_tmp95.openaiAssistant = _state.sent(), _tmp95.createdAt = dayjs29().unix(), _tmp95.runId = responseCreatedResponse.id, _tmp95)
|
|
11607
11932
|
]), _tmp94)
|
|
11608
11933
|
])
|
|
11609
11934
|
];
|
|
@@ -11700,7 +12025,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11700
12025
|
_tmp97 = {
|
|
11701
12026
|
id: event.item_id,
|
|
11702
12027
|
object: "thread.message",
|
|
11703
|
-
created_at:
|
|
12028
|
+
created_at: dayjs29().unix(),
|
|
11704
12029
|
thread_id: threadId,
|
|
11705
12030
|
completed_at: null,
|
|
11706
12031
|
incomplete_at: null,
|
|
@@ -11738,7 +12063,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11738
12063
|
_tmp99 = {
|
|
11739
12064
|
id: event.item_id,
|
|
11740
12065
|
object: "thread.message",
|
|
11741
|
-
created_at:
|
|
12066
|
+
created_at: dayjs29().unix(),
|
|
11742
12067
|
thread_id: threadId,
|
|
11743
12068
|
completed_at: null,
|
|
11744
12069
|
incomplete_at: null,
|
|
@@ -11926,7 +12251,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11926
12251
|
return [
|
|
11927
12252
|
4,
|
|
11928
12253
|
onEvent2.apply(void 0, [
|
|
11929
|
-
(_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.status = "failed", _tmp102.failed_at =
|
|
12254
|
+
(_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.status = "failed", _tmp102.failed_at = dayjs29().unix(), _tmp102.last_error = {
|
|
11930
12255
|
code: "server_error",
|
|
11931
12256
|
message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
|
|
11932
12257
|
}, _tmp102), _tmp101)
|
|
@@ -11986,7 +12311,7 @@ var responsesRunAdapter = function(param) {
|
|
|
11986
12311
|
};
|
|
11987
12312
|
};
|
|
11988
12313
|
// src/adapters/run/azureAgentsRunAdapter/index.ts
|
|
11989
|
-
import
|
|
12314
|
+
import dayjs30 from "dayjs";
|
|
11990
12315
|
import { uid as uid10 } from "radash";
|
|
11991
12316
|
function transformAnnotations(annotations) {
|
|
11992
12317
|
return annotations.map(function(ann) {
|
|
@@ -12019,6 +12344,56 @@ function transformAnnotations(annotations) {
|
|
|
12019
12344
|
return ann;
|
|
12020
12345
|
});
|
|
12021
12346
|
}
|
|
12347
|
+
function transformMessageContentItem(content) {
|
|
12348
|
+
if (content.type === "text") {
|
|
12349
|
+
var _content_text, _content_text1;
|
|
12350
|
+
return {
|
|
12351
|
+
type: "text",
|
|
12352
|
+
text: {
|
|
12353
|
+
value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
|
|
12354
|
+
annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
|
|
12355
|
+
}
|
|
12356
|
+
};
|
|
12357
|
+
}
|
|
12358
|
+
if (content.type === "image_file") {
|
|
12359
|
+
var imageFile = content.image_file || content.imageFile || {};
|
|
12360
|
+
var _imageFile_detail;
|
|
12361
|
+
return {
|
|
12362
|
+
type: "image_file",
|
|
12363
|
+
image_file: {
|
|
12364
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
12365
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
12366
|
+
}
|
|
12367
|
+
};
|
|
12368
|
+
}
|
|
12369
|
+
return content;
|
|
12370
|
+
}
|
|
12371
|
+
function transformMessageDeltaContentItem(content) {
|
|
12372
|
+
if (content.type === "text") {
|
|
12373
|
+
var _content_text, _content_text1;
|
|
12374
|
+
return {
|
|
12375
|
+
index: content.index || 0,
|
|
12376
|
+
type: "text",
|
|
12377
|
+
text: {
|
|
12378
|
+
value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
|
|
12379
|
+
annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
|
|
12380
|
+
}
|
|
12381
|
+
};
|
|
12382
|
+
}
|
|
12383
|
+
if (content.type === "image_file") {
|
|
12384
|
+
var imageFile = content.image_file || content.imageFile || {};
|
|
12385
|
+
var _imageFile_detail;
|
|
12386
|
+
return {
|
|
12387
|
+
index: content.index || 0,
|
|
12388
|
+
type: "image_file",
|
|
12389
|
+
image_file: {
|
|
12390
|
+
file_id: imageFile.file_id || imageFile.fileId || "",
|
|
12391
|
+
detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
|
|
12392
|
+
}
|
|
12393
|
+
};
|
|
12394
|
+
}
|
|
12395
|
+
return content;
|
|
12396
|
+
}
|
|
12022
12397
|
function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
12023
12398
|
var event = azureEvent.event, data = azureEvent.data;
|
|
12024
12399
|
var eventType = event;
|
|
@@ -12030,7 +12405,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12030
12405
|
data: {
|
|
12031
12406
|
id: data.id,
|
|
12032
12407
|
object: "thread.run",
|
|
12033
|
-
created_at:
|
|
12408
|
+
created_at: dayjs30(data.createdAt).unix(),
|
|
12034
12409
|
thread_id: data.threadId,
|
|
12035
12410
|
assistant_id: assistantId,
|
|
12036
12411
|
status: data.status,
|
|
@@ -12054,10 +12429,10 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12054
12429
|
message: JSON.stringify(data.lastError)
|
|
12055
12430
|
} : null,
|
|
12056
12431
|
expires_at: null,
|
|
12057
|
-
started_at: data.startedAt ?
|
|
12058
|
-
cancelled_at: data.cancelledAt ?
|
|
12059
|
-
failed_at: data.failedAt ?
|
|
12060
|
-
completed_at: data.completedAt ?
|
|
12432
|
+
started_at: data.startedAt ? dayjs30(data.startedAt).unix() : null,
|
|
12433
|
+
cancelled_at: data.cancelledAt ? dayjs30(data.cancelledAt).unix() : null,
|
|
12434
|
+
failed_at: data.failedAt ? dayjs30(data.failedAt).unix() : null,
|
|
12435
|
+
completed_at: data.completedAt ? dayjs30(data.completedAt).unix() : null,
|
|
12061
12436
|
incomplete_details: null,
|
|
12062
12437
|
model: data.model || "",
|
|
12063
12438
|
instructions: data.instructions || "",
|
|
@@ -12085,28 +12460,18 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12085
12460
|
data: {
|
|
12086
12461
|
id: data.id,
|
|
12087
12462
|
object: "thread.message",
|
|
12088
|
-
created_at:
|
|
12463
|
+
created_at: dayjs30(data.createdAt).unix(),
|
|
12089
12464
|
thread_id: data.threadId,
|
|
12090
12465
|
role: data.role,
|
|
12091
12466
|
content: ((_data_content = data.content) === null || _data_content === void 0 ? void 0 : _data_content.map(function(c) {
|
|
12092
|
-
|
|
12093
|
-
var _c_text, _c_text1;
|
|
12094
|
-
return {
|
|
12095
|
-
type: "text",
|
|
12096
|
-
text: {
|
|
12097
|
-
value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
|
|
12098
|
-
annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
|
|
12099
|
-
}
|
|
12100
|
-
};
|
|
12101
|
-
}
|
|
12102
|
-
return c;
|
|
12467
|
+
return transformMessageContentItem(c);
|
|
12103
12468
|
})) || [],
|
|
12104
12469
|
assistant_id: assistantId,
|
|
12105
12470
|
run_id: data.runId || null,
|
|
12106
12471
|
attachments: data.attachments || [],
|
|
12107
12472
|
metadata: data.metadata || {},
|
|
12108
12473
|
status: data.status || "completed",
|
|
12109
|
-
completed_at: data.completedAt ?
|
|
12474
|
+
completed_at: data.completedAt ? dayjs30(data.completedAt).unix() : null,
|
|
12110
12475
|
incomplete_at: null,
|
|
12111
12476
|
incomplete_details: null
|
|
12112
12477
|
}
|
|
@@ -12121,18 +12486,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12121
12486
|
object: "thread.message.delta",
|
|
12122
12487
|
delta: {
|
|
12123
12488
|
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) {
|
|
12124
|
-
|
|
12125
|
-
var _c_text, _c_text1;
|
|
12126
|
-
return {
|
|
12127
|
-
index: c.index || 0,
|
|
12128
|
-
type: "text",
|
|
12129
|
-
text: {
|
|
12130
|
-
value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
|
|
12131
|
-
annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
|
|
12132
|
-
}
|
|
12133
|
-
};
|
|
12134
|
-
}
|
|
12135
|
-
return c;
|
|
12489
|
+
return transformMessageDeltaContentItem(c);
|
|
12136
12490
|
})) || []
|
|
12137
12491
|
}
|
|
12138
12492
|
}
|
|
@@ -12306,7 +12660,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12306
12660
|
data: {
|
|
12307
12661
|
id: data.id,
|
|
12308
12662
|
object: "thread.run.step",
|
|
12309
|
-
created_at:
|
|
12663
|
+
created_at: dayjs30(data.createdAt).unix(),
|
|
12310
12664
|
assistant_id: assistantId,
|
|
12311
12665
|
thread_id: data.threadId,
|
|
12312
12666
|
run_id: data.runId,
|
|
@@ -12315,9 +12669,9 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12315
12669
|
step_details: stepDetails,
|
|
12316
12670
|
last_error: data.lastError || null,
|
|
12317
12671
|
expired_at: null,
|
|
12318
|
-
cancelled_at: data.cancelledAt ?
|
|
12319
|
-
failed_at: data.failedAt ?
|
|
12320
|
-
completed_at: data.completedAt ?
|
|
12672
|
+
cancelled_at: data.cancelledAt ? dayjs30(data.cancelledAt).unix() : null,
|
|
12673
|
+
failed_at: data.failedAt ? dayjs30(data.failedAt).unix() : null,
|
|
12674
|
+
completed_at: data.completedAt ? dayjs30(data.completedAt).unix() : null,
|
|
12321
12675
|
metadata: data.metadata || {},
|
|
12322
12676
|
usage: null
|
|
12323
12677
|
}
|
|
@@ -12329,7 +12683,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
|
|
|
12329
12683
|
data: {
|
|
12330
12684
|
id: data.id,
|
|
12331
12685
|
object: "thread",
|
|
12332
|
-
created_at:
|
|
12686
|
+
created_at: dayjs30(data.createdAt).unix(),
|
|
12333
12687
|
metadata: data.metadata || {},
|
|
12334
12688
|
tool_resources: data.toolResources || null
|
|
12335
12689
|
}
|
|
@@ -12470,7 +12824,7 @@ var azureAgentsRunAdapter = function(param) {
|
|
|
12470
12824
|
data: {
|
|
12471
12825
|
id: errorRunId,
|
|
12472
12826
|
object: "thread.run",
|
|
12473
|
-
created_at:
|
|
12827
|
+
created_at: dayjs30().unix(),
|
|
12474
12828
|
thread_id: threadId,
|
|
12475
12829
|
assistant_id: assistantId,
|
|
12476
12830
|
status: "failed",
|
|
@@ -12480,9 +12834,9 @@ var azureAgentsRunAdapter = function(param) {
|
|
|
12480
12834
|
message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
|
|
12481
12835
|
},
|
|
12482
12836
|
expires_at: null,
|
|
12483
|
-
started_at:
|
|
12837
|
+
started_at: dayjs30().unix(),
|
|
12484
12838
|
cancelled_at: null,
|
|
12485
|
-
failed_at:
|
|
12839
|
+
failed_at: dayjs30().unix(),
|
|
12486
12840
|
completed_at: null,
|
|
12487
12841
|
incomplete_details: null,
|
|
12488
12842
|
model: "",
|