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.d.cts
CHANGED
|
@@ -185,8 +185,9 @@ declare const responsesStorageAdapter: () => ((args: ResponsesStorageAdapterArgs
|
|
|
185
185
|
type AzureAgentsStorageAdapterArgs = StorageAdapterArgs & {
|
|
186
186
|
runAdapter: RunAdapterWithAssistant;
|
|
187
187
|
};
|
|
188
|
-
declare const azureAgentsStorageAdapter: ({ azureAiProject, }: {
|
|
188
|
+
declare const azureAgentsStorageAdapter: ({ azureAiProject, prisma, }: {
|
|
189
189
|
azureAiProject: AIProjectClient;
|
|
190
|
+
prisma: PrismaClient;
|
|
190
191
|
}) => ({ runAdapter }: AzureAgentsStorageAdapterArgs) => {
|
|
191
192
|
requestHandlers: {
|
|
192
193
|
'^/(?:v1|/?openai)/assistants$': {
|
package/dist/index.d.ts
CHANGED
|
@@ -185,8 +185,9 @@ declare const responsesStorageAdapter: () => ((args: ResponsesStorageAdapterArgs
|
|
|
185
185
|
type AzureAgentsStorageAdapterArgs = StorageAdapterArgs & {
|
|
186
186
|
runAdapter: RunAdapterWithAssistant;
|
|
187
187
|
};
|
|
188
|
-
declare const azureAgentsStorageAdapter: ({ azureAiProject, }: {
|
|
188
|
+
declare const azureAgentsStorageAdapter: ({ azureAiProject, prisma, }: {
|
|
189
189
|
azureAiProject: AIProjectClient;
|
|
190
|
+
prisma: PrismaClient;
|
|
190
191
|
}) => ({ runAdapter }: AzureAgentsStorageAdapterArgs) => {
|
|
191
192
|
requestHandlers: {
|
|
192
193
|
'^/(?:v1|/?openai)/assistants$': {
|
package/dist/index.js
CHANGED
|
@@ -9110,10 +9110,10 @@ var run3 = function(param) {
|
|
|
9110
9110
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/get.ts
|
|
9111
9111
|
import dayjs26 from "dayjs";
|
|
9112
9112
|
var get22 = function(param) {
|
|
9113
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9113
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9114
9114
|
return function(urlString) {
|
|
9115
9115
|
return _async_to_generator(function() {
|
|
9116
|
-
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;
|
|
9116
|
+
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;
|
|
9117
9117
|
return _ts_generator(this, function(_state) {
|
|
9118
9118
|
switch(_state.label){
|
|
9119
9119
|
case 0:
|
|
@@ -9125,27 +9125,43 @@ var get22 = function(param) {
|
|
|
9125
9125
|
];
|
|
9126
9126
|
case 1:
|
|
9127
9127
|
azureSteps = _state.sent();
|
|
9128
|
+
return [
|
|
9129
|
+
4,
|
|
9130
|
+
prisma.azureAgentsFunctionOutput.findMany({
|
|
9131
|
+
where: {
|
|
9132
|
+
runId: runId
|
|
9133
|
+
}
|
|
9134
|
+
})
|
|
9135
|
+
];
|
|
9136
|
+
case 2:
|
|
9137
|
+
storedOutputs = _state.sent();
|
|
9138
|
+
outputsMap = new Map(storedOutputs.map(function(o) {
|
|
9139
|
+
return [
|
|
9140
|
+
o.toolCallId,
|
|
9141
|
+
o.output
|
|
9142
|
+
];
|
|
9143
|
+
}));
|
|
9128
9144
|
stepsList = [];
|
|
9129
9145
|
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
9130
|
-
_state.label =
|
|
9131
|
-
case
|
|
9146
|
+
_state.label = 3;
|
|
9147
|
+
case 3:
|
|
9132
9148
|
_state.trys.push([
|
|
9133
|
-
|
|
9134
|
-
7,
|
|
9149
|
+
3,
|
|
9135
9150
|
8,
|
|
9136
|
-
|
|
9151
|
+
9,
|
|
9152
|
+
14
|
|
9137
9153
|
]);
|
|
9138
9154
|
_iterator = _async_iterator(azureSteps);
|
|
9139
|
-
_state.label =
|
|
9140
|
-
case
|
|
9155
|
+
_state.label = 4;
|
|
9156
|
+
case 4:
|
|
9141
9157
|
return [
|
|
9142
9158
|
4,
|
|
9143
9159
|
_iterator.next()
|
|
9144
9160
|
];
|
|
9145
|
-
case
|
|
9161
|
+
case 5:
|
|
9146
9162
|
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
9147
9163
|
3,
|
|
9148
|
-
|
|
9164
|
+
7
|
|
9149
9165
|
];
|
|
9150
9166
|
_value = _step.value;
|
|
9151
9167
|
step = _value;
|
|
@@ -9196,13 +9212,16 @@ var get22 = function(param) {
|
|
|
9196
9212
|
file_search: tc.fileSearch || {}
|
|
9197
9213
|
};
|
|
9198
9214
|
} else if (tc.type === "function") {
|
|
9215
|
+
var _tc_function_output, _ref;
|
|
9199
9216
|
return {
|
|
9200
9217
|
id: tc.id,
|
|
9201
9218
|
type: "function",
|
|
9202
9219
|
function: {
|
|
9203
9220
|
name: tc.function.name,
|
|
9204
9221
|
arguments: tc.function.arguments,
|
|
9205
|
-
|
|
9222
|
+
// Retrieve output from database if Azure doesn't provide it
|
|
9223
|
+
// Use nullish coalescing (??) to preserve empty strings
|
|
9224
|
+
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
|
|
9206
9225
|
}
|
|
9207
9226
|
};
|
|
9208
9227
|
}
|
|
@@ -9222,61 +9241,61 @@ var get22 = function(param) {
|
|
|
9222
9241
|
metadata: step.metadata || {},
|
|
9223
9242
|
usage: null
|
|
9224
9243
|
});
|
|
9225
|
-
_state.label =
|
|
9226
|
-
case
|
|
9244
|
+
_state.label = 6;
|
|
9245
|
+
case 6:
|
|
9227
9246
|
_iteratorAbruptCompletion = false;
|
|
9228
9247
|
return [
|
|
9229
9248
|
3,
|
|
9230
|
-
|
|
9249
|
+
4
|
|
9231
9250
|
];
|
|
9232
|
-
case
|
|
9251
|
+
case 7:
|
|
9233
9252
|
return [
|
|
9234
9253
|
3,
|
|
9235
|
-
|
|
9254
|
+
14
|
|
9236
9255
|
];
|
|
9237
|
-
case
|
|
9256
|
+
case 8:
|
|
9238
9257
|
err = _state.sent();
|
|
9239
9258
|
_didIteratorError = true;
|
|
9240
9259
|
_iteratorError = err;
|
|
9241
9260
|
return [
|
|
9242
9261
|
3,
|
|
9243
|
-
|
|
9262
|
+
14
|
|
9244
9263
|
];
|
|
9245
|
-
case
|
|
9264
|
+
case 9:
|
|
9246
9265
|
_state.trys.push([
|
|
9247
|
-
|
|
9266
|
+
9,
|
|
9248
9267
|
,
|
|
9249
|
-
|
|
9250
|
-
|
|
9268
|
+
12,
|
|
9269
|
+
13
|
|
9251
9270
|
]);
|
|
9252
9271
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
9253
9272
|
3,
|
|
9254
|
-
|
|
9273
|
+
11
|
|
9255
9274
|
];
|
|
9256
9275
|
return [
|
|
9257
9276
|
4,
|
|
9258
9277
|
_iterator.return()
|
|
9259
9278
|
];
|
|
9260
|
-
case 9:
|
|
9261
|
-
_state.sent();
|
|
9262
|
-
_state.label = 10;
|
|
9263
9279
|
case 10:
|
|
9280
|
+
_state.sent();
|
|
9281
|
+
_state.label = 11;
|
|
9282
|
+
case 11:
|
|
9264
9283
|
return [
|
|
9265
9284
|
3,
|
|
9266
|
-
|
|
9285
|
+
13
|
|
9267
9286
|
];
|
|
9268
|
-
case
|
|
9287
|
+
case 12:
|
|
9269
9288
|
if (_didIteratorError) {
|
|
9270
9289
|
throw _iteratorError;
|
|
9271
9290
|
}
|
|
9272
9291
|
return [
|
|
9273
9292
|
7
|
|
9274
9293
|
];
|
|
9275
|
-
case
|
|
9294
|
+
case 13:
|
|
9276
9295
|
return [
|
|
9277
9296
|
7
|
|
9278
9297
|
];
|
|
9279
|
-
case
|
|
9298
|
+
case 14:
|
|
9280
9299
|
response = {
|
|
9281
9300
|
data: stepsList,
|
|
9282
9301
|
first_id: ((_stepsList_ = stepsList[0]) === null || _stepsList_ === void 0 ? void 0 : _stepsList_.id) || null,
|
|
@@ -9299,17 +9318,18 @@ var get22 = function(param) {
|
|
|
9299
9318
|
};
|
|
9300
9319
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/steps/index.ts
|
|
9301
9320
|
var steps3 = function(param) {
|
|
9302
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9321
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9303
9322
|
return {
|
|
9304
9323
|
get: get22({
|
|
9305
9324
|
azureAiProject: azureAiProject,
|
|
9306
|
-
runAdapter: runAdapter
|
|
9325
|
+
runAdapter: runAdapter,
|
|
9326
|
+
prisma: prisma
|
|
9307
9327
|
})
|
|
9308
9328
|
};
|
|
9309
9329
|
};
|
|
9310
9330
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
9311
9331
|
import dayjs27 from "dayjs";
|
|
9312
|
-
function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
9332
|
+
function convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap) {
|
|
9313
9333
|
var event = azureEvent.event, data = azureEvent.data;
|
|
9314
9334
|
var eventType = event;
|
|
9315
9335
|
if (eventType.startsWith("thread.run.") && !eventType.startsWith("thread.run.step.")) {
|
|
@@ -9484,7 +9504,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9484
9504
|
};
|
|
9485
9505
|
} else if (tc.type === "function") {
|
|
9486
9506
|
var _tc_function, _tc_function1, _tc_function2;
|
|
9487
|
-
var _tc_index2;
|
|
9507
|
+
var _tc_index2, _tc_function_output, _ref;
|
|
9488
9508
|
return {
|
|
9489
9509
|
index: (_tc_index2 = tc.index) !== null && _tc_index2 !== void 0 ? _tc_index2 : 0,
|
|
9490
9510
|
id: tc.id,
|
|
@@ -9492,7 +9512,7 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9492
9512
|
function: {
|
|
9493
9513
|
name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
|
|
9494
9514
|
arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
|
|
9495
|
-
output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output)
|
|
9515
|
+
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
|
|
9496
9516
|
}
|
|
9497
9517
|
};
|
|
9498
9518
|
}
|
|
@@ -9571,13 +9591,14 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9571
9591
|
};
|
|
9572
9592
|
} else if (tc.type === "function") {
|
|
9573
9593
|
var _tc_function, _tc_function1, _tc_function2;
|
|
9594
|
+
var _tc_function_output, _ref;
|
|
9574
9595
|
return {
|
|
9575
9596
|
id: tc.id,
|
|
9576
9597
|
type: "function",
|
|
9577
9598
|
function: {
|
|
9578
9599
|
name: ((_tc_function = tc.function) === null || _tc_function === void 0 ? void 0 : _tc_function.name) || "",
|
|
9579
9600
|
arguments: ((_tc_function1 = tc.function) === null || _tc_function1 === void 0 ? void 0 : _tc_function1.arguments) || "",
|
|
9580
|
-
output: ((_tc_function2 = tc.function) === null || _tc_function2 === void 0 ? void 0 : _tc_function2.output)
|
|
9601
|
+
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
|
|
9581
9602
|
}
|
|
9582
9603
|
};
|
|
9583
9604
|
}
|
|
@@ -9628,10 +9649,10 @@ function convertAzureEventToOpenAI(azureEvent, assistantId) {
|
|
|
9628
9649
|
return null;
|
|
9629
9650
|
}
|
|
9630
9651
|
var post23 = function(param) {
|
|
9631
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9652
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9632
9653
|
return function(urlString, options) {
|
|
9633
9654
|
return _async_to_generator(function() {
|
|
9634
|
-
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
|
|
9655
|
+
var url, _url_pathname_match, threadId, runId, body, tool_outputs, stream, outputsMap, existingRun, assistantId, submitResponse, streamRun, readableStream, events, finalRun;
|
|
9635
9656
|
return _ts_generator(this, function(_state) {
|
|
9636
9657
|
switch(_state.label){
|
|
9637
9658
|
case 0:
|
|
@@ -9642,11 +9663,40 @@ var post23 = function(param) {
|
|
|
9642
9663
|
}
|
|
9643
9664
|
body = JSON.parse(options.body);
|
|
9644
9665
|
tool_outputs = body.tool_outputs, stream = body.stream;
|
|
9666
|
+
outputsMap = new Map(tool_outputs.map(function(output) {
|
|
9667
|
+
return [
|
|
9668
|
+
output.tool_call_id,
|
|
9669
|
+
output.output
|
|
9670
|
+
];
|
|
9671
|
+
}));
|
|
9645
9672
|
return [
|
|
9646
9673
|
4,
|
|
9647
|
-
|
|
9674
|
+
Promise.all(tool_outputs.map(function(output) {
|
|
9675
|
+
return prisma.azureAgentsFunctionOutput.upsert({
|
|
9676
|
+
where: {
|
|
9677
|
+
runId_toolCallId: {
|
|
9678
|
+
runId: runId,
|
|
9679
|
+
toolCallId: output.tool_call_id
|
|
9680
|
+
}
|
|
9681
|
+
},
|
|
9682
|
+
create: {
|
|
9683
|
+
runId: runId,
|
|
9684
|
+
toolCallId: output.tool_call_id,
|
|
9685
|
+
output: output.output
|
|
9686
|
+
},
|
|
9687
|
+
update: {
|
|
9688
|
+
output: output.output
|
|
9689
|
+
}
|
|
9690
|
+
});
|
|
9691
|
+
}))
|
|
9648
9692
|
];
|
|
9649
9693
|
case 1:
|
|
9694
|
+
_state.sent();
|
|
9695
|
+
return [
|
|
9696
|
+
4,
|
|
9697
|
+
azureAiProject.agents.runs.get(threadId, runId)
|
|
9698
|
+
];
|
|
9699
|
+
case 2:
|
|
9650
9700
|
existingRun = _state.sent();
|
|
9651
9701
|
assistantId = existingRun.assistantId;
|
|
9652
9702
|
submitResponse = azureAiProject.agents.runs.submitToolOutputs(threadId, runId, tool_outputs.map(function(to) {
|
|
@@ -9696,7 +9746,7 @@ var post23 = function(param) {
|
|
|
9696
9746
|
];
|
|
9697
9747
|
_value = _step.value;
|
|
9698
9748
|
azureEvent = _value;
|
|
9699
|
-
openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId);
|
|
9749
|
+
openaiEvent = convertAzureEventToOpenAI(azureEvent, assistantId, outputsMap);
|
|
9700
9750
|
if (!openaiEvent) return [
|
|
9701
9751
|
3,
|
|
9702
9752
|
6
|
|
@@ -9855,7 +9905,7 @@ var post23 = function(param) {
|
|
|
9855
9905
|
});
|
|
9856
9906
|
if (!stream) return [
|
|
9857
9907
|
3,
|
|
9858
|
-
|
|
9908
|
+
3
|
|
9859
9909
|
];
|
|
9860
9910
|
return [
|
|
9861
9911
|
2,
|
|
@@ -9865,7 +9915,7 @@ var post23 = function(param) {
|
|
|
9865
9915
|
}
|
|
9866
9916
|
})
|
|
9867
9917
|
];
|
|
9868
|
-
case
|
|
9918
|
+
case 3:
|
|
9869
9919
|
events = [];
|
|
9870
9920
|
finalRun = null;
|
|
9871
9921
|
return [
|
|
@@ -9884,7 +9934,7 @@ var post23 = function(param) {
|
|
|
9884
9934
|
})();
|
|
9885
9935
|
})
|
|
9886
9936
|
];
|
|
9887
|
-
case
|
|
9937
|
+
case 4:
|
|
9888
9938
|
_state.sent();
|
|
9889
9939
|
if (!finalRun) {
|
|
9890
9940
|
throw new Error("Run did not complete");
|
|
@@ -9898,7 +9948,7 @@ var post23 = function(param) {
|
|
|
9898
9948
|
}
|
|
9899
9949
|
})
|
|
9900
9950
|
];
|
|
9901
|
-
case
|
|
9951
|
+
case 5:
|
|
9902
9952
|
return [
|
|
9903
9953
|
2
|
|
9904
9954
|
];
|
|
@@ -9909,11 +9959,12 @@ var post23 = function(param) {
|
|
|
9909
9959
|
};
|
|
9910
9960
|
// src/adapters/storage/azureAgentsStorageAdapter/threads/runs/submitToolOutputs/index.ts
|
|
9911
9961
|
var submitToolOutputs3 = function(param) {
|
|
9912
|
-
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter;
|
|
9962
|
+
var azureAiProject = param.azureAiProject, runAdapter = param.runAdapter, prisma = param.prisma;
|
|
9913
9963
|
return {
|
|
9914
9964
|
post: post23({
|
|
9915
9965
|
azureAiProject: azureAiProject,
|
|
9916
|
-
runAdapter: runAdapter
|
|
9966
|
+
runAdapter: runAdapter,
|
|
9967
|
+
prisma: prisma
|
|
9917
9968
|
})
|
|
9918
9969
|
};
|
|
9919
9970
|
};
|
|
@@ -10261,7 +10312,7 @@ var fileContent = function(param) {
|
|
|
10261
10312
|
};
|
|
10262
10313
|
// src/adapters/storage/azureAgentsStorageAdapter/index.ts
|
|
10263
10314
|
var azureAgentsStorageAdapter = function(param) {
|
|
10264
|
-
var azureAiProject = param.azureAiProject;
|
|
10315
|
+
var azureAiProject = param.azureAiProject, prisma = param.prisma;
|
|
10265
10316
|
return function(param) {
|
|
10266
10317
|
var runAdapter = param.runAdapter;
|
|
10267
10318
|
var _obj;
|
|
@@ -10284,10 +10335,12 @@ var azureAgentsStorageAdapter = function(param) {
|
|
|
10284
10335
|
runAdapter: runAdapter
|
|
10285
10336
|
})), _define_property(_obj, stepsRegexp, steps3({
|
|
10286
10337
|
azureAiProject: azureAiProject,
|
|
10287
|
-
runAdapter: runAdapter
|
|
10338
|
+
runAdapter: runAdapter,
|
|
10339
|
+
prisma: prisma
|
|
10288
10340
|
})), _define_property(_obj, submitToolOutputsRegexp, submitToolOutputs3({
|
|
10289
10341
|
azureAiProject: azureAiProject,
|
|
10290
|
-
runAdapter: runAdapter
|
|
10342
|
+
runAdapter: runAdapter,
|
|
10343
|
+
prisma: prisma
|
|
10291
10344
|
})), _define_property(_obj, fileRegexp, file({
|
|
10292
10345
|
azureAiProject: azureAiProject
|
|
10293
10346
|
})), _define_property(_obj, fileContentRegexp, fileContent({
|