supercompat 3.13.0 → 3.14.1
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 +103 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +103 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9230,10 +9230,10 @@ var run3 = function(param) {
|
|
|
9230
9230
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
|
|
9231
9231
|
var import_dayjs26 = __toESM(require("dayjs"), 1);
|
|
9232
9232
|
var get22 = function(param) {
|
|
9233
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9233
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9234
9234
|
return function(urlString) {
|
|
9235
9235
|
return _async_to_generator(function() {
|
|
9236
|
-
var _stepsList_, _stepsList_1, url, _url_pathname_match, threadId, runId, azureSteps, stepsList, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, step, _step_stepDetails_messageCreation, assistantId, err, response;
|
|
9236
|
+
var _stepsList_, _stepsList_1, url, _url_pathname_match, threadId, runId, azureSteps, storedOutputs, outputsMap, stepsList, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, step, _step_stepDetails_messageCreation, assistantId, err, response;
|
|
9237
9237
|
return _ts_generator(this, function(_state) {
|
|
9238
9238
|
switch(_state.label){
|
|
9239
9239
|
case 0:
|
|
@@ -9245,27 +9245,43 @@ var get22 = function(param) {
|
|
|
9245
9245
|
];
|
|
9246
9246
|
case 1:
|
|
9247
9247
|
azureSteps = _state.sent();
|
|
9248
|
+
return [
|
|
9249
|
+
4,
|
|
9250
|
+
prisma.azureAgentsFunctionOutput.findMany({
|
|
9251
|
+
where: {
|
|
9252
|
+
runId: runId
|
|
9253
|
+
}
|
|
9254
|
+
})
|
|
9255
|
+
];
|
|
9256
|
+
case 2:
|
|
9257
|
+
storedOutputs = _state.sent();
|
|
9258
|
+
outputsMap = new Map(storedOutputs.map(function(o) {
|
|
9259
|
+
return [
|
|
9260
|
+
o.toolCallId,
|
|
9261
|
+
o.output
|
|
9262
|
+
];
|
|
9263
|
+
}));
|
|
9248
9264
|
stepsList = [];
|
|
9249
9265
|
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
9250
|
-
_state.label =
|
|
9251
|
-
case
|
|
9266
|
+
_state.label = 3;
|
|
9267
|
+
case 3:
|
|
9252
9268
|
_state.trys.push([
|
|
9253
|
-
|
|
9254
|
-
7,
|
|
9269
|
+
3,
|
|
9255
9270
|
8,
|
|
9256
|
-
|
|
9271
|
+
9,
|
|
9272
|
+
14
|
|
9257
9273
|
]);
|
|
9258
9274
|
_iterator = _async_iterator(azureSteps);
|
|
9259
|
-
_state.label =
|
|
9260
|
-
case
|
|
9275
|
+
_state.label = 4;
|
|
9276
|
+
case 4:
|
|
9261
9277
|
return [
|
|
9262
9278
|
4,
|
|
9263
9279
|
_iterator.next()
|
|
9264
9280
|
];
|
|
9265
|
-
case
|
|
9281
|
+
case 5:
|
|
9266
9282
|
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
9267
9283
|
3,
|
|
9268
|
-
|
|
9284
|
+
7
|
|
9269
9285
|
];
|
|
9270
9286
|
_value = _step.value;
|
|
9271
9287
|
step = _value;
|
|
@@ -9316,13 +9332,16 @@ var get22 = function(param) {
|
|
|
9316
9332
|
file_search: tc.fileSearch || {}
|
|
9317
9333
|
};
|
|
9318
9334
|
} else if (tc.type === "function") {
|
|
9335
|
+
var _tc_function_output, _ref;
|
|
9319
9336
|
return {
|
|
9320
9337
|
id: tc.id,
|
|
9321
9338
|
type: "function",
|
|
9322
9339
|
function: {
|
|
9323
9340
|
name: tc.function.name,
|
|
9324
9341
|
arguments: tc.function.arguments,
|
|
9325
|
-
|
|
9342
|
+
// Retrieve output from database if Azure doesn't provide it
|
|
9343
|
+
// Use nullish coalescing (??) to preserve empty strings
|
|
9344
|
+
output: (_ref = (_tc_function_output = tc.function.output) !== null && _tc_function_output !== void 0 ? _tc_function_output : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
|
|
9326
9345
|
}
|
|
9327
9346
|
};
|
|
9328
9347
|
}
|
|
@@ -9342,61 +9361,61 @@ var get22 = function(param) {
|
|
|
9342
9361
|
metadata: step.metadata || {},
|
|
9343
9362
|
usage: null
|
|
9344
9363
|
});
|
|
9345
|
-
_state.label =
|
|
9346
|
-
case
|
|
9364
|
+
_state.label = 6;
|
|
9365
|
+
case 6:
|
|
9347
9366
|
_iteratorAbruptCompletion = false;
|
|
9348
9367
|
return [
|
|
9349
9368
|
3,
|
|
9350
|
-
|
|
9369
|
+
4
|
|
9351
9370
|
];
|
|
9352
|
-
case
|
|
9371
|
+
case 7:
|
|
9353
9372
|
return [
|
|
9354
9373
|
3,
|
|
9355
|
-
|
|
9374
|
+
14
|
|
9356
9375
|
];
|
|
9357
|
-
case
|
|
9376
|
+
case 8:
|
|
9358
9377
|
err = _state.sent();
|
|
9359
9378
|
_didIteratorError = true;
|
|
9360
9379
|
_iteratorError = err;
|
|
9361
9380
|
return [
|
|
9362
9381
|
3,
|
|
9363
|
-
|
|
9382
|
+
14
|
|
9364
9383
|
];
|
|
9365
|
-
case
|
|
9384
|
+
case 9:
|
|
9366
9385
|
_state.trys.push([
|
|
9367
|
-
|
|
9386
|
+
9,
|
|
9368
9387
|
,
|
|
9369
|
-
|
|
9370
|
-
|
|
9388
|
+
12,
|
|
9389
|
+
13
|
|
9371
9390
|
]);
|
|
9372
9391
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
9373
9392
|
3,
|
|
9374
|
-
|
|
9393
|
+
11
|
|
9375
9394
|
];
|
|
9376
9395
|
return [
|
|
9377
9396
|
4,
|
|
9378
9397
|
_iterator.return()
|
|
9379
9398
|
];
|
|
9380
|
-
case 9:
|
|
9381
|
-
_state.sent();
|
|
9382
|
-
_state.label = 10;
|
|
9383
9399
|
case 10:
|
|
9400
|
+
_state.sent();
|
|
9401
|
+
_state.label = 11;
|
|
9402
|
+
case 11:
|
|
9384
9403
|
return [
|
|
9385
9404
|
3,
|
|
9386
|
-
|
|
9405
|
+
13
|
|
9387
9406
|
];
|
|
9388
|
-
case
|
|
9407
|
+
case 12:
|
|
9389
9408
|
if (_didIteratorError) {
|
|
9390
9409
|
throw _iteratorError;
|
|
9391
9410
|
}
|
|
9392
9411
|
return [
|
|
9393
9412
|
7
|
|
9394
9413
|
];
|
|
9395
|
-
case
|
|
9414
|
+
case 13:
|
|
9396
9415
|
return [
|
|
9397
9416
|
7
|
|
9398
9417
|
];
|
|
9399
|
-
case
|
|
9418
|
+
case 14:
|
|
9400
9419
|
response = {
|
|
9401
9420
|
data: stepsList,
|
|
9402
9421
|
first_id: ((_stepsList_ = stepsList[0]) === null || _stepsList_ === void 0 ? void 0 : _stepsList_.id) || null,
|
|
@@ -9419,17 +9438,18 @@ var get22 = function(param) {
|
|
|
9419
9438
|
};
|
|
9420
9439
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/index.ts
|
|
9421
9440
|
var steps3 = function(param) {
|
|
9422
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9441
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9423
9442
|
return {
|
|
9424
9443
|
get: get22({
|
|
9425
9444
|
azureAiProject: azureAiProject,
|
|
9426
|
-
runAdapter: runAdapter
|
|
9445
|
+
runAdapter: runAdapter,
|
|
9446
|
+
prisma: prisma
|
|
9427
9447
|
})
|
|
9428
9448
|
};
|
|
9429
9449
|
};
|
|
9430
9450
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
9431
9451
|
var import_dayjs27 = __toESM(require("dayjs"), 1);
|
|
9432
|
-
function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
9452
|
+
function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
|
|
9433
9453
|
var event = azureEvent.event, data = azureEvent.data;
|
|
9434
9454
|
var eventType = event;
|
|
9435
9455
|
if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
|
|
@@ -9604,7 +9624,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9604
9624
|
};
|
|
9605
9625
|
} else if (tc.type === "function") {
|
|
9606
9626
|
var _tc_function, _tc_function1, _tc_function2;
|
|
9607
|
-
var _tc_index2;
|
|
9627
|
+
var _tc_index2, _tc_function_output, _ref;
|
|
9608
9628
|
return {
|
|
9609
9629
|
index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
|
|
9610
9630
|
id: tc.id,
|
|
@@ -9612,7 +9632,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9612
9632
|
function: {
|
|
9613
9633
|
name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
|
|
9614
9634
|
arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
|
|
9615
|
-
output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output)
|
|
9635
|
+
output: (_ref = (_tc_function_output = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) !== null && _tc_function_output !== void 0 ? _tc_function_output : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
|
|
9616
9636
|
}
|
|
9617
9637
|
};
|
|
9618
9638
|
}
|
|
@@ -9691,13 +9711,14 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9691
9711
|
};
|
|
9692
9712
|
} else if (tc.type === "function") {
|
|
9693
9713
|
var _tc_function, _tc_function1, _tc_function2;
|
|
9714
|
+
var _tc_function_output, _ref;
|
|
9694
9715
|
return {
|
|
9695
9716
|
id: tc.id,
|
|
9696
9717
|
type: "function",
|
|
9697
9718
|
function: {
|
|
9698
9719
|
name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
|
|
9699
9720
|
arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
|
|
9700
|
-
output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output)
|
|
9721
|
+
output: (_ref = (_tc_function_output = (_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output) !== null && _tc_function_output !== void 0 ? _tc_function_output : outputsMap.get(tc.id)) !== null && _ref !== void 0 ? _ref : null
|
|
9701
9722
|
}
|
|
9702
9723
|
};
|
|
9703
9724
|
}
|
|
@@ -9748,10 +9769,10 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9748
9769
|
return null;
|
|
9749
9770
|
}
|
|
9750
9771
|
var post23 = function(param) {
|
|
9751
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9772
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9752
9773
|
return function(urlString, options) {
|
|
9753
9774
|
return _async_to_generator(function() {
|
|
9754
|
-
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
|
|
9775
|
+
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, outputsMap, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
|
|
9755
9776
|
return _ts_generator(this, function(_state) {
|
|
9756
9777
|
switch(_state.label){
|
|
9757
9778
|
case 0:
|
|
@@ -9762,11 +9783,40 @@ var post23 = function(param) {
|
|
|
9762
9783
|
}
|
|
9763
9784
|
body = JSON.parse(options.body);
|
|
9764
9785
|
tool_outputs = body.tool_outputs, stream = body.stream;
|
|
9786
|
+
outputsMap = new Map(tool_outputs.map(function(output) {
|
|
9787
|
+
return [
|
|
9788
|
+
output.tool_call_id,
|
|
9789
|
+
output.output
|
|
9790
|
+
];
|
|
9791
|
+
}));
|
|
9765
9792
|
return [
|
|
9766
9793
|
4,
|
|
9767
|
-
|
|
9794
|
+
Promise.all(tool_outputs.map(function(output) {
|
|
9795
|
+
return prisma.azureAgentsFunctionOutput.upsert({
|
|
9796
|
+
where: {
|
|
9797
|
+
runId_toolCallId: {
|
|
9798
|
+
runId: runId,
|
|
9799
|
+
toolCallId: output.tool_call_id
|
|
9800
|
+
}
|
|
9801
|
+
},
|
|
9802
|
+
create: {
|
|
9803
|
+
runId: runId,
|
|
9804
|
+
toolCallId: output.tool_call_id,
|
|
9805
|
+
output: output.output
|
|
9806
|
+
},
|
|
9807
|
+
update: {
|
|
9808
|
+
output: output.output
|
|
9809
|
+
}
|
|
9810
|
+
});
|
|
9811
|
+
}))
|
|
9768
9812
|
];
|
|
9769
9813
|
case 1:
|
|
9814
|
+
_state.sent();
|
|
9815
|
+
return [
|
|
9816
|
+
4,
|
|
9817
|
+
azureAiProject.agents.runs.get(threadId, runId)
|
|
9818
|
+
];
|
|
9819
|
+
case 2:
|
|
9770
9820
|
existingRun = _state.sent();
|
|
9771
9821
|
assistantId = existingRun.assistantId;
|
|
9772
9822
|
submitResponse = azureAiProject.agents.runs.submitToolOutputs(threadId, runId, tool_outputs.map(function(to) {
|
|
@@ -9816,7 +9866,7 @@ var post23 = function(param) {
|
|
|
9816
9866
|
];
|
|
9817
9867
|
_value = _step.value;
|
|
9818
9868
|
azureEvent = _value;
|
|
9819
|
-
openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId);
|
|
9869
|
+
openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap);
|
|
9820
9870
|
if (!openaiEvent) return [
|
|
9821
9871
|
3,
|
|
9822
9872
|
6
|
|
@@ -9975,7 +10025,7 @@ var post23 = function(param) {
|
|
|
9975
10025
|
});
|
|
9976
10026
|
if (!stream) return [
|
|
9977
10027
|
3,
|
|
9978
|
-
|
|
10028
|
+
3
|
|
9979
10029
|
];
|
|
9980
10030
|
return [
|
|
9981
10031
|
2,
|
|
@@ -9985,7 +10035,7 @@ var post23 = function(param) {
|
|
|
9985
10035
|
}
|
|
9986
10036
|
})
|
|
9987
10037
|
];
|
|
9988
|
-
case
|
|
10038
|
+
case 3:
|
|
9989
10039
|
events = [];
|
|
9990
10040
|
finalRun = null;
|
|
9991
10041
|
return [
|
|
@@ -10004,7 +10054,7 @@ var post23 = function(param) {
|
|
|
10004
10054
|
})();
|
|
10005
10055
|
})
|
|
10006
10056
|
];
|
|
10007
|
-
case
|
|
10057
|
+
case 4:
|
|
10008
10058
|
_state.sent();
|
|
10009
10059
|
if (!finalRun) {
|
|
10010
10060
|
throw new Error("Run did not complete");
|
|
@@ -10018,7 +10068,7 @@ var post23 = function(param) {
|
|
|
10018
10068
|
}
|
|
10019
10069
|
})
|
|
10020
10070
|
];
|
|
10021
|
-
case
|
|
10071
|
+
case 5:
|
|
10022
10072
|
return [
|
|
10023
10073
|
2
|
|
10024
10074
|
];
|
|
@@ -10029,11 +10079,12 @@ var post23 = function(param) {
|
|
|
10029
10079
|
};
|
|
10030
10080
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/submitToolOutputs/index.ts
|
|
10031
10081
|
var submitToolOutputs3 = function(param) {
|
|
10032
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
10082
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
10033
10083
|
return {
|
|
10034
10084
|
post: post23({
|
|
10035
10085
|
azureAiProject: azureAiProject,
|
|
10036
|
-
runAdapter: runAdapter
|
|
10086
|
+
runAdapter: runAdapter,
|
|
10087
|
+
prisma: prisma
|
|
10037
10088
|
})
|
|
10038
10089
|
};
|
|
10039
10090
|
};
|
|
@@ -10381,7 +10432,7 @@ var fileContent = function(param) {
|
|
|
10381
10432
|
};
|
|
10382
10433
|
// src/adapters/storage/azureAgentsStorageAdapter/index.ts
|
|
10383
10434
|
var azureAgentsStorageAdapter = function(param) {
|
|
10384
|
-
var azureAiProject = param.azureAiProject;
|
|
10435
|
+
var azureAiProject = param.azureAiProject, prisma = param.prisma;
|
|
10385
10436
|
return function(param) {
|
|
10386
10437
|
var runAdapter = param.runAdapter;
|
|
10387
10438
|
var _obj;
|
|
@@ -10404,10 +10455,12 @@ var azureAgentsStorageAdapter = function(param) {
|
|
|
10404
10455
|
runAdapter: runAdapter
|
|
10405
10456
|
})), _define_property(_obj, stepsRegexp, steps3({
|
|
10406
10457
|
azureAiProject: azureAiProject,
|
|
10407
|
-
runAdapter: runAdapter
|
|
10458
|
+
runAdapter: runAdapter,
|
|
10459
|
+
prisma: prisma
|
|
10408
10460
|
})), _define_property(_obj, submitToolOutputsRegexp, submitToolOutputs3({
|
|
10409
10461
|
azureAiProject: azureAiProject,
|
|
10410
|
-
runAdapter: runAdapter
|
|
10462
|
+
runAdapter: runAdapter,
|
|
10463
|
+
prisma: prisma
|
|
10411
10464
|
})), _define_property(_obj, fileRegexp, file({
|
|
10412
10465
|
azureAiProject: azureAiProject
|
|
10413
10466
|
})), _define_property(_obj, fileContentRegexp, fileContent({
|