@jerome-benoit/sap-ai-provider-v2 4.4.18 → 4.6.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/README.md +16 -9
- package/dist/{chunk-BBWFNLML.js → chunk-BV5Y6RMC.js} +3 -3
- package/dist/{chunk-O6ASHXPO.js → chunk-DBAIFR3B.js} +445 -321
- package/dist/{chunk-O6ASHXPO.js.map → chunk-DBAIFR3B.js.map} +1 -1
- package/dist/{chunk-SD6CRCHX.js → chunk-DQXZH6CW.js} +50 -43
- package/dist/chunk-DQXZH6CW.js.map +1 -0
- package/dist/{chunk-4CAVT2YC.js → chunk-KS5QNMYZ.js} +193 -146
- package/dist/chunk-KS5QNMYZ.js.map +1 -0
- package/dist/{chunk-3M6NFVCS.js → chunk-WYDTQDMJ.js} +11 -5
- package/dist/chunk-WYDTQDMJ.js.map +1 -0
- package/dist/{foundation-models-embedding-model-strategy-XJV5REFR.js → foundation-models-embedding-model-strategy-XLD3PGCK.js} +4 -4
- package/dist/{foundation-models-language-model-strategy-X6VNJZFG.js → foundation-models-language-model-strategy-SNBZBWX4.js} +12 -7
- package/dist/foundation-models-language-model-strategy-SNBZBWX4.js.map +1 -0
- package/dist/index.cjs +714 -509
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{orchestration-embedding-model-strategy-3GIX5HAR.js → orchestration-embedding-model-strategy-6BKD5NW7.js} +4 -4
- package/dist/{orchestration-language-model-strategy-GYBTFP2F.js → orchestration-language-model-strategy-OYSEPGQG.js} +23 -6
- package/dist/orchestration-language-model-strategy-OYSEPGQG.js.map +1 -0
- package/package.json +20 -20
- package/dist/chunk-3M6NFVCS.js.map +0 -1
- package/dist/chunk-4CAVT2YC.js.map +0 -1
- package/dist/chunk-SD6CRCHX.js.map +0 -1
- package/dist/foundation-models-language-model-strategy-X6VNJZFG.js.map +0 -1
- package/dist/orchestration-language-model-strategy-GYBTFP2F.js.map +0 -1
- /package/dist/{chunk-BBWFNLML.js.map → chunk-BV5Y6RMC.js.map} +0 -0
- /package/dist/{foundation-models-embedding-model-strategy-XJV5REFR.js.map → foundation-models-embedding-model-strategy-XLD3PGCK.js.map} +0 -0
- /package/dist/{orchestration-embedding-model-strategy-3GIX5HAR.js.map → orchestration-embedding-model-strategy-6BKD5NW7.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -122,51 +122,34 @@ function convertToSAPMessages(prompt, options = {}) {
|
|
|
122
122
|
for (const part of message.content) {
|
|
123
123
|
switch (part.type) {
|
|
124
124
|
case "file": {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const fileDataUrl = buildDataUrl(part);
|
|
126
|
+
if (part.mediaType.startsWith("image/")) {
|
|
127
|
+
const supportedFormats = [
|
|
128
|
+
"image/png",
|
|
129
|
+
"image/jpeg",
|
|
130
|
+
"image/jpg",
|
|
131
|
+
"image/gif",
|
|
132
|
+
"image/webp"
|
|
133
|
+
];
|
|
134
|
+
if (!supportedFormats.includes(part.mediaType.toLowerCase())) {
|
|
135
|
+
console.warn(
|
|
136
|
+
`Image format ${part.mediaType} may not be supported by all models. Recommended formats: PNG, JPEG, GIF, WebP`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
contentParts.push({
|
|
140
|
+
image_url: {
|
|
141
|
+
url: fileDataUrl
|
|
142
|
+
},
|
|
143
|
+
type: "image_url"
|
|
128
144
|
});
|
|
129
|
-
}
|
|
130
|
-
const supportedFormats = [
|
|
131
|
-
"image/png",
|
|
132
|
-
"image/jpeg",
|
|
133
|
-
"image/jpg",
|
|
134
|
-
"image/gif",
|
|
135
|
-
"image/webp"
|
|
136
|
-
];
|
|
137
|
-
if (!supportedFormats.includes(part.mediaType.toLowerCase())) {
|
|
138
|
-
console.warn(
|
|
139
|
-
`Image format ${part.mediaType} may not be supported by all models. Recommended formats: PNG, JPEG, GIF, WebP`
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
let imageUrl;
|
|
143
|
-
if (part.data instanceof URL) {
|
|
144
|
-
imageUrl = part.data.toString();
|
|
145
|
-
} else if (typeof part.data === "string") {
|
|
146
|
-
imageUrl = `data:${part.mediaType};base64,${part.data}`;
|
|
147
|
-
} else if (part.data instanceof Uint8Array) {
|
|
148
|
-
const base64Data = import_node_buffer.Buffer.from(part.data).toString("base64");
|
|
149
|
-
imageUrl = `data:${part.mediaType};base64,${base64Data}`;
|
|
150
|
-
} else if (import_node_buffer.Buffer.isBuffer(part.data)) {
|
|
151
|
-
const base64Data = import_node_buffer.Buffer.from(part.data).toString("base64");
|
|
152
|
-
imageUrl = `data:${part.mediaType};base64,${base64Data}`;
|
|
153
145
|
} else {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
functionality: "Unsupported file data type for image. Expected URL, base64 string, or Uint8Array."
|
|
161
|
-
});
|
|
162
|
-
}
|
|
146
|
+
contentParts.push({
|
|
147
|
+
file: {
|
|
148
|
+
file_data: fileDataUrl
|
|
149
|
+
},
|
|
150
|
+
type: "file"
|
|
151
|
+
});
|
|
163
152
|
}
|
|
164
|
-
contentParts.push({
|
|
165
|
-
image_url: {
|
|
166
|
-
url: imageUrl
|
|
167
|
-
},
|
|
168
|
-
type: "image_url"
|
|
169
|
-
});
|
|
170
153
|
break;
|
|
171
154
|
}
|
|
172
155
|
case "text": {
|
|
@@ -213,6 +196,30 @@ function unescapeOrchestrationPlaceholders(text) {
|
|
|
213
196
|
if (!text) return text;
|
|
214
197
|
return text.replaceAll(JINJA2_DELIMITERS_ESCAPED_PATTERN, "{$1");
|
|
215
198
|
}
|
|
199
|
+
function buildDataUrl(part) {
|
|
200
|
+
if (part.data instanceof URL) {
|
|
201
|
+
return part.data.toString();
|
|
202
|
+
}
|
|
203
|
+
if (typeof part.data === "string") {
|
|
204
|
+
return `data:${part.mediaType};base64,${part.data}`;
|
|
205
|
+
}
|
|
206
|
+
if (part.data instanceof Uint8Array) {
|
|
207
|
+
const base64Data = import_node_buffer.Buffer.from(part.data).toString("base64");
|
|
208
|
+
return `data:${part.mediaType};base64,${base64Data}`;
|
|
209
|
+
}
|
|
210
|
+
if (import_node_buffer.Buffer.isBuffer(part.data)) {
|
|
211
|
+
const base64Data = import_node_buffer.Buffer.from(part.data).toString("base64");
|
|
212
|
+
return `data:${part.mediaType};base64,${base64Data}`;
|
|
213
|
+
}
|
|
214
|
+
const maybeBufferLike = part.data;
|
|
215
|
+
if (maybeBufferLike !== null && typeof maybeBufferLike === "object" && "toString" in maybeBufferLike) {
|
|
216
|
+
const base64Data = maybeBufferLike.toString("base64");
|
|
217
|
+
return `data:${part.mediaType};base64,${base64Data}`;
|
|
218
|
+
}
|
|
219
|
+
throw new import_provider.UnsupportedFunctionalityError({
|
|
220
|
+
functionality: "Unsupported file data type. Expected URL, base64 string, or Uint8Array."
|
|
221
|
+
});
|
|
222
|
+
}
|
|
216
223
|
var import_provider, import_node_buffer, ZERO_WIDTH_SPACE, JINJA2_DELIMITERS_PATTERN, JINJA2_DELIMITERS_ESCAPED_PATTERN;
|
|
217
224
|
var init_convert_to_sap_messages = __esm({
|
|
218
225
|
"src/convert-to-sap-messages.ts"() {
|
|
@@ -26573,12 +26580,25 @@ var require_axios = __commonJS({
|
|
|
26573
26580
|
};
|
|
26574
26581
|
var isDate = kindOfTest("Date");
|
|
26575
26582
|
var isFile = kindOfTest("File");
|
|
26583
|
+
var isReactNativeBlob = (value) => {
|
|
26584
|
+
return !!(value && typeof value.uri !== "undefined");
|
|
26585
|
+
};
|
|
26586
|
+
var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
|
|
26576
26587
|
var isBlob = kindOfTest("Blob");
|
|
26577
26588
|
var isFileList = kindOfTest("FileList");
|
|
26578
26589
|
var isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
26590
|
+
function getGlobal() {
|
|
26591
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
26592
|
+
if (typeof self !== "undefined") return self;
|
|
26593
|
+
if (typeof window !== "undefined") return window;
|
|
26594
|
+
if (typeof global !== "undefined") return global;
|
|
26595
|
+
return {};
|
|
26596
|
+
}
|
|
26597
|
+
var G = getGlobal();
|
|
26598
|
+
var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
|
|
26579
26599
|
var isFormData = (thing) => {
|
|
26580
26600
|
let kind;
|
|
26581
|
-
return thing && (
|
|
26601
|
+
return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
26582
26602
|
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
|
|
26583
26603
|
};
|
|
26584
26604
|
var isURLSearchParams = kindOfTest("URLSearchParams");
|
|
@@ -26588,7 +26608,9 @@ var require_axios = __commonJS({
|
|
|
26588
26608
|
"Response",
|
|
26589
26609
|
"Headers"
|
|
26590
26610
|
].map(kindOfTest);
|
|
26591
|
-
var trim2 = (str) =>
|
|
26611
|
+
var trim2 = (str) => {
|
|
26612
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
26613
|
+
};
|
|
26592
26614
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
26593
26615
|
if (obj === null || typeof obj === "undefined") {
|
|
26594
26616
|
return;
|
|
@@ -26690,10 +26712,7 @@ var require_axios = __commonJS({
|
|
|
26690
26712
|
return content;
|
|
26691
26713
|
};
|
|
26692
26714
|
var inherits = (constructor, superConstructor, props, descriptors) => {
|
|
26693
|
-
constructor.prototype = Object.create(
|
|
26694
|
-
superConstructor.prototype,
|
|
26695
|
-
descriptors
|
|
26696
|
-
);
|
|
26715
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
26697
26716
|
Object.defineProperty(constructor.prototype, "constructor", {
|
|
26698
26717
|
value: constructor,
|
|
26699
26718
|
writable: true,
|
|
@@ -26892,6 +26911,8 @@ var require_axios = __commonJS({
|
|
|
26892
26911
|
isUndefined,
|
|
26893
26912
|
isDate,
|
|
26894
26913
|
isFile,
|
|
26914
|
+
isReactNativeBlob,
|
|
26915
|
+
isReactNative,
|
|
26895
26916
|
isBlob,
|
|
26896
26917
|
isRegExp,
|
|
26897
26918
|
isFunction: isFunction$1,
|
|
@@ -26938,6 +26959,9 @@ var require_axios = __commonJS({
|
|
|
26938
26959
|
const axiosError = new _AxiosError(error.message, code || error.code, config, request, response);
|
|
26939
26960
|
axiosError.cause = error;
|
|
26940
26961
|
axiosError.name = error.name;
|
|
26962
|
+
if (error.status != null && axiosError.status == null) {
|
|
26963
|
+
axiosError.status = error.status;
|
|
26964
|
+
}
|
|
26941
26965
|
customProps && Object.assign(axiosError, customProps);
|
|
26942
26966
|
return axiosError;
|
|
26943
26967
|
}
|
|
@@ -26954,6 +26978,12 @@ var require_axios = __commonJS({
|
|
|
26954
26978
|
*/
|
|
26955
26979
|
constructor(message, code, config, request, response) {
|
|
26956
26980
|
super(message);
|
|
26981
|
+
Object.defineProperty(this, "message", {
|
|
26982
|
+
value: message,
|
|
26983
|
+
enumerable: true,
|
|
26984
|
+
writable: true,
|
|
26985
|
+
configurable: true
|
|
26986
|
+
});
|
|
26957
26987
|
this.name = "AxiosError";
|
|
26958
26988
|
this.isAxiosError = true;
|
|
26959
26989
|
code && (this.code = code);
|
|
@@ -27021,13 +27051,18 @@ var require_axios = __commonJS({
|
|
|
27021
27051
|
throw new TypeError("target must be an object");
|
|
27022
27052
|
}
|
|
27023
27053
|
formData = formData || new (FormData__default["default"] || FormData)();
|
|
27024
|
-
options = utils$1.toFlatObject(
|
|
27025
|
-
|
|
27026
|
-
|
|
27027
|
-
|
|
27028
|
-
|
|
27029
|
-
|
|
27030
|
-
|
|
27054
|
+
options = utils$1.toFlatObject(
|
|
27055
|
+
options,
|
|
27056
|
+
{
|
|
27057
|
+
metaTokens: true,
|
|
27058
|
+
dots: false,
|
|
27059
|
+
indexes: false
|
|
27060
|
+
},
|
|
27061
|
+
false,
|
|
27062
|
+
function defined(option, source) {
|
|
27063
|
+
return !utils$1.isUndefined(source[option]);
|
|
27064
|
+
}
|
|
27065
|
+
);
|
|
27031
27066
|
const metaTokens = options.metaTokens;
|
|
27032
27067
|
const visitor = options.visitor || defaultVisitor;
|
|
27033
27068
|
const dots = options.dots;
|
|
@@ -27055,6 +27090,10 @@ var require_axios = __commonJS({
|
|
|
27055
27090
|
}
|
|
27056
27091
|
function defaultVisitor(value, key, path) {
|
|
27057
27092
|
let arr = value;
|
|
27093
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
27094
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
27095
|
+
return false;
|
|
27096
|
+
}
|
|
27058
27097
|
if (value && !path && typeof value === "object") {
|
|
27059
27098
|
if (utils$1.endsWith(key, "{}")) {
|
|
27060
27099
|
key = metaTokens ? key : key.slice(0, -2);
|
|
@@ -27090,13 +27129,7 @@ var require_axios = __commonJS({
|
|
|
27090
27129
|
}
|
|
27091
27130
|
stack.push(value);
|
|
27092
27131
|
utils$1.forEach(value, function each(el, key) {
|
|
27093
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
27094
|
-
formData,
|
|
27095
|
-
el,
|
|
27096
|
-
utils$1.isString(key) ? key.trim() : key,
|
|
27097
|
-
path,
|
|
27098
|
-
exposedHelpers
|
|
27099
|
-
);
|
|
27132
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
27100
27133
|
if (result === true) {
|
|
27101
27134
|
build(el, path ? path.concat(key) : [key]);
|
|
27102
27135
|
}
|
|
@@ -27362,70 +27395,74 @@ var require_axios = __commonJS({
|
|
|
27362
27395
|
var defaults = {
|
|
27363
27396
|
transitional: transitionalDefaults,
|
|
27364
27397
|
adapter: ["xhr", "http", "fetch"],
|
|
27365
|
-
transformRequest: [
|
|
27366
|
-
|
|
27367
|
-
|
|
27368
|
-
|
|
27369
|
-
|
|
27370
|
-
|
|
27371
|
-
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
if (
|
|
27389
|
-
|
|
27398
|
+
transformRequest: [
|
|
27399
|
+
function transformRequest(data, headers) {
|
|
27400
|
+
const contentType = headers.getContentType() || "";
|
|
27401
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
27402
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
27403
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
27404
|
+
data = new FormData(data);
|
|
27405
|
+
}
|
|
27406
|
+
const isFormData2 = utils$1.isFormData(data);
|
|
27407
|
+
if (isFormData2) {
|
|
27408
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
27409
|
+
}
|
|
27410
|
+
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
27411
|
+
return data;
|
|
27412
|
+
}
|
|
27413
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
27414
|
+
return data.buffer;
|
|
27415
|
+
}
|
|
27416
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
27417
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
27418
|
+
return data.toString();
|
|
27419
|
+
}
|
|
27420
|
+
let isFileList2;
|
|
27421
|
+
if (isObjectPayload) {
|
|
27422
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
27423
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
27424
|
+
}
|
|
27425
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
27426
|
+
const _FormData = this.env && this.env.FormData;
|
|
27427
|
+
return toFormData(
|
|
27428
|
+
isFileList2 ? { "files[]": data } : data,
|
|
27429
|
+
_FormData && new _FormData(),
|
|
27430
|
+
this.formSerializer
|
|
27431
|
+
);
|
|
27432
|
+
}
|
|
27390
27433
|
}
|
|
27391
|
-
if (
|
|
27392
|
-
|
|
27393
|
-
return
|
|
27394
|
-
isFileList2 ? { "files[]": data } : data,
|
|
27395
|
-
_FormData && new _FormData(),
|
|
27396
|
-
this.formSerializer
|
|
27397
|
-
);
|
|
27434
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
27435
|
+
headers.setContentType("application/json", false);
|
|
27436
|
+
return stringifySafely(data);
|
|
27398
27437
|
}
|
|
27399
|
-
}
|
|
27400
|
-
if (isObjectPayload || hasJSONContentType) {
|
|
27401
|
-
headers.setContentType("application/json", false);
|
|
27402
|
-
return stringifySafely(data);
|
|
27403
|
-
}
|
|
27404
|
-
return data;
|
|
27405
|
-
}],
|
|
27406
|
-
transformResponse: [function transformResponse(data) {
|
|
27407
|
-
const transitional = this.transitional || defaults.transitional;
|
|
27408
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
27409
|
-
const JSONRequested = this.responseType === "json";
|
|
27410
|
-
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
27411
27438
|
return data;
|
|
27412
27439
|
}
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27440
|
+
],
|
|
27441
|
+
transformResponse: [
|
|
27442
|
+
function transformResponse(data) {
|
|
27443
|
+
const transitional = this.transitional || defaults.transitional;
|
|
27444
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
27445
|
+
const JSONRequested = this.responseType === "json";
|
|
27446
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
27447
|
+
return data;
|
|
27448
|
+
}
|
|
27449
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
27450
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
27451
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
27452
|
+
try {
|
|
27453
|
+
return JSON.parse(data, this.parseReviver);
|
|
27454
|
+
} catch (e) {
|
|
27455
|
+
if (strictJSONParsing) {
|
|
27456
|
+
if (e.name === "SyntaxError") {
|
|
27457
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
27458
|
+
}
|
|
27459
|
+
throw e;
|
|
27422
27460
|
}
|
|
27423
|
-
throw e;
|
|
27424
27461
|
}
|
|
27425
27462
|
}
|
|
27463
|
+
return data;
|
|
27426
27464
|
}
|
|
27427
|
-
|
|
27428
|
-
}],
|
|
27465
|
+
],
|
|
27429
27466
|
/**
|
|
27430
27467
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
27431
27468
|
* timeout is not created.
|
|
@@ -27444,7 +27481,7 @@ var require_axios = __commonJS({
|
|
|
27444
27481
|
},
|
|
27445
27482
|
headers: {
|
|
27446
27483
|
common: {
|
|
27447
|
-
|
|
27484
|
+
Accept: "application/json, text/plain, */*",
|
|
27448
27485
|
"Content-Type": void 0
|
|
27449
27486
|
}
|
|
27450
27487
|
}
|
|
@@ -27711,7 +27748,14 @@ var require_axios = __commonJS({
|
|
|
27711
27748
|
return this;
|
|
27712
27749
|
}
|
|
27713
27750
|
};
|
|
27714
|
-
AxiosHeaders.accessor([
|
|
27751
|
+
AxiosHeaders.accessor([
|
|
27752
|
+
"Content-Type",
|
|
27753
|
+
"Content-Length",
|
|
27754
|
+
"Accept",
|
|
27755
|
+
"Accept-Encoding",
|
|
27756
|
+
"User-Agent",
|
|
27757
|
+
"Authorization"
|
|
27758
|
+
]);
|
|
27715
27759
|
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
27716
27760
|
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
27717
27761
|
return {
|
|
@@ -27759,13 +27803,15 @@ var require_axios = __commonJS({
|
|
|
27759
27803
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
27760
27804
|
resolve(response);
|
|
27761
27805
|
} else {
|
|
27762
|
-
reject(
|
|
27763
|
-
|
|
27764
|
-
|
|
27765
|
-
|
|
27766
|
-
|
|
27767
|
-
|
|
27768
|
-
|
|
27806
|
+
reject(
|
|
27807
|
+
new AxiosError$1(
|
|
27808
|
+
"Request failed with status code " + response.status,
|
|
27809
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
27810
|
+
response.config,
|
|
27811
|
+
response.request,
|
|
27812
|
+
response
|
|
27813
|
+
)
|
|
27814
|
+
);
|
|
27769
27815
|
}
|
|
27770
27816
|
}
|
|
27771
27817
|
function isAbsoluteURL(url2) {
|
|
@@ -27784,7 +27830,7 @@ var require_axios = __commonJS({
|
|
|
27784
27830
|
}
|
|
27785
27831
|
return requestedURL;
|
|
27786
27832
|
}
|
|
27787
|
-
var VERSION2 = "1.13.
|
|
27833
|
+
var VERSION2 = "1.13.6";
|
|
27788
27834
|
function parseProtocol(url2) {
|
|
27789
27835
|
const match2 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
|
|
27790
27836
|
return match2 && match2[1] || "";
|
|
@@ -27819,16 +27865,21 @@ var require_axios = __commonJS({
|
|
|
27819
27865
|
var kInternals = /* @__PURE__ */ Symbol("internals");
|
|
27820
27866
|
var AxiosTransformStream = class extends stream__default["default"].Transform {
|
|
27821
27867
|
constructor(options) {
|
|
27822
|
-
options = utils$1.toFlatObject(
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27827
|
-
|
|
27828
|
-
|
|
27829
|
-
|
|
27830
|
-
|
|
27831
|
-
|
|
27868
|
+
options = utils$1.toFlatObject(
|
|
27869
|
+
options,
|
|
27870
|
+
{
|
|
27871
|
+
maxRate: 0,
|
|
27872
|
+
chunkSize: 64 * 1024,
|
|
27873
|
+
minChunkSize: 100,
|
|
27874
|
+
timeWindow: 500,
|
|
27875
|
+
ticksRate: 2,
|
|
27876
|
+
samplesCount: 15
|
|
27877
|
+
},
|
|
27878
|
+
null,
|
|
27879
|
+
(prop, source) => {
|
|
27880
|
+
return !utils$1.isUndefined(source[prop]);
|
|
27881
|
+
}
|
|
27882
|
+
);
|
|
27832
27883
|
super({
|
|
27833
27884
|
readableHighWaterMark: options.chunkSize
|
|
27834
27885
|
});
|
|
@@ -27911,9 +27962,12 @@ var require_axios = __commonJS({
|
|
|
27911
27962
|
chunkRemainder = _chunk.subarray(maxChunkSize);
|
|
27912
27963
|
_chunk = _chunk.subarray(0, maxChunkSize);
|
|
27913
27964
|
}
|
|
27914
|
-
pushChunk(
|
|
27915
|
-
|
|
27916
|
-
|
|
27965
|
+
pushChunk(
|
|
27966
|
+
_chunk,
|
|
27967
|
+
chunkRemainder ? () => {
|
|
27968
|
+
process.nextTick(_callback, null, chunkRemainder);
|
|
27969
|
+
} : _callback
|
|
27970
|
+
);
|
|
27917
27971
|
};
|
|
27918
27972
|
transformChunk(chunk, function transformNextChunk(err, _chunk) {
|
|
27919
27973
|
if (err) {
|
|
@@ -27973,11 +28027,14 @@ var require_axios = __commonJS({
|
|
|
27973
28027
|
yield CRLF_BYTES;
|
|
27974
28028
|
}
|
|
27975
28029
|
static escapeName(name) {
|
|
27976
|
-
return String(name).replace(
|
|
27977
|
-
|
|
27978
|
-
|
|
27979
|
-
|
|
27980
|
-
|
|
28030
|
+
return String(name).replace(
|
|
28031
|
+
/[\r\n"]/g,
|
|
28032
|
+
(match2) => ({
|
|
28033
|
+
"\r": "%0D",
|
|
28034
|
+
"\n": "%0A",
|
|
28035
|
+
'"': "%22"
|
|
28036
|
+
})[match2]
|
|
28037
|
+
);
|
|
27981
28038
|
}
|
|
27982
28039
|
};
|
|
27983
28040
|
var formDataToStream = (form, headersHandler, options) => {
|
|
@@ -28009,13 +28066,15 @@ var require_axios = __commonJS({
|
|
|
28009
28066
|
computedHeaders["Content-Length"] = contentLength;
|
|
28010
28067
|
}
|
|
28011
28068
|
headersHandler && headersHandler(computedHeaders);
|
|
28012
|
-
return stream.Readable.from(
|
|
28013
|
-
|
|
28014
|
-
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28069
|
+
return stream.Readable.from(
|
|
28070
|
+
(async function* () {
|
|
28071
|
+
for (const part of parts) {
|
|
28072
|
+
yield boundaryBytes;
|
|
28073
|
+
yield* part.encode();
|
|
28074
|
+
}
|
|
28075
|
+
yield footerBytes;
|
|
28076
|
+
})()
|
|
28077
|
+
);
|
|
28019
28078
|
};
|
|
28020
28079
|
var formDataToStream$1 = formDataToStream;
|
|
28021
28080
|
var ZlibHeaderTransformStream = class extends stream__default["default"].Transform {
|
|
@@ -28141,11 +28200,14 @@ var require_axios = __commonJS({
|
|
|
28141
28200
|
};
|
|
28142
28201
|
var progressEventDecorator = (total, throttled) => {
|
|
28143
28202
|
const lengthComputable = total != null;
|
|
28144
|
-
return [
|
|
28145
|
-
|
|
28146
|
-
|
|
28147
|
-
|
|
28148
|
-
|
|
28203
|
+
return [
|
|
28204
|
+
(loaded) => throttled[0]({
|
|
28205
|
+
lengthComputable,
|
|
28206
|
+
total,
|
|
28207
|
+
loaded
|
|
28208
|
+
}),
|
|
28209
|
+
throttled[1]
|
|
28210
|
+
];
|
|
28149
28211
|
};
|
|
28150
28212
|
var asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
28151
28213
|
function estimateDataURLDecodedBytes(url2) {
|
|
@@ -28220,9 +28282,12 @@ var require_axios = __commonJS({
|
|
|
28220
28282
|
this.sessions = /* @__PURE__ */ Object.create(null);
|
|
28221
28283
|
}
|
|
28222
28284
|
getSession(authority, options) {
|
|
28223
|
-
options = Object.assign(
|
|
28224
|
-
|
|
28225
|
-
|
|
28285
|
+
options = Object.assign(
|
|
28286
|
+
{
|
|
28287
|
+
sessionTimeout: 1e3
|
|
28288
|
+
},
|
|
28289
|
+
options
|
|
28290
|
+
);
|
|
28226
28291
|
let authoritySessions = this.sessions[authority];
|
|
28227
28292
|
if (authoritySessions) {
|
|
28228
28293
|
let len = authoritySessions.length;
|
|
@@ -28276,10 +28341,7 @@ var require_axios = __commonJS({
|
|
|
28276
28341
|
};
|
|
28277
28342
|
}
|
|
28278
28343
|
session.once("close", removeSession);
|
|
28279
|
-
let entry = [
|
|
28280
|
-
session,
|
|
28281
|
-
options
|
|
28282
|
-
];
|
|
28344
|
+
let entry = [session, options];
|
|
28283
28345
|
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
|
28284
28346
|
return session;
|
|
28285
28347
|
}
|
|
@@ -28365,12 +28427,7 @@ var require_axios = __commonJS({
|
|
|
28365
28427
|
const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
|
|
28366
28428
|
const { http2Options, headers } = options;
|
|
28367
28429
|
const session = http2Sessions.getSession(authority, http2Options);
|
|
28368
|
-
const {
|
|
28369
|
-
HTTP2_HEADER_SCHEME,
|
|
28370
|
-
HTTP2_HEADER_METHOD,
|
|
28371
|
-
HTTP2_HEADER_PATH,
|
|
28372
|
-
HTTP2_HEADER_STATUS
|
|
28373
|
-
} = http2__default["default"].constants;
|
|
28430
|
+
const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } = http2__default["default"].constants;
|
|
28374
28431
|
const http2Headers = {
|
|
28375
28432
|
[HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
|
|
28376
28433
|
[HTTP2_HEADER_METHOD]: options.method,
|
|
@@ -28423,7 +28480,10 @@ var require_axios = __commonJS({
|
|
|
28423
28480
|
const abortEmitter = new events.EventEmitter();
|
|
28424
28481
|
function abort(reason) {
|
|
28425
28482
|
try {
|
|
28426
|
-
abortEmitter.emit(
|
|
28483
|
+
abortEmitter.emit(
|
|
28484
|
+
"abort",
|
|
28485
|
+
!reason || reason.type ? new CanceledError$1(null, config, req) : reason
|
|
28486
|
+
);
|
|
28427
28487
|
} catch (err) {
|
|
28428
28488
|
console.warn("emit error", err);
|
|
28429
28489
|
}
|
|
@@ -28469,11 +28529,13 @@ var require_axios = __commonJS({
|
|
|
28469
28529
|
const dataUrl = String(config.url || fullPath || "");
|
|
28470
28530
|
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
|
28471
28531
|
if (estimated > config.maxContentLength) {
|
|
28472
|
-
return reject(
|
|
28473
|
-
|
|
28474
|
-
|
|
28475
|
-
|
|
28476
|
-
|
|
28532
|
+
return reject(
|
|
28533
|
+
new AxiosError$1(
|
|
28534
|
+
"maxContentLength size of " + config.maxContentLength + " exceeded",
|
|
28535
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
28536
|
+
config
|
|
28537
|
+
)
|
|
28538
|
+
);
|
|
28477
28539
|
}
|
|
28478
28540
|
}
|
|
28479
28541
|
let convertedData;
|
|
@@ -28509,11 +28571,9 @@ var require_axios = __commonJS({
|
|
|
28509
28571
|
});
|
|
28510
28572
|
}
|
|
28511
28573
|
if (supportedProtocols.indexOf(protocol) === -1) {
|
|
28512
|
-
return reject(
|
|
28513
|
-
"Unsupported protocol " + protocol,
|
|
28514
|
-
|
|
28515
|
-
config
|
|
28516
|
-
));
|
|
28574
|
+
return reject(
|
|
28575
|
+
new AxiosError$1("Unsupported protocol " + protocol, AxiosError$1.ERR_BAD_REQUEST, config)
|
|
28576
|
+
);
|
|
28517
28577
|
}
|
|
28518
28578
|
const headers = AxiosHeaders$1.from(config.headers).normalize();
|
|
28519
28579
|
headers.set("User-Agent", "axios/" + VERSION2, false);
|
|
@@ -28523,12 +28583,16 @@ var require_axios = __commonJS({
|
|
|
28523
28583
|
let maxDownloadRate = void 0;
|
|
28524
28584
|
if (utils$1.isSpecCompliantForm(data)) {
|
|
28525
28585
|
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
28526
|
-
data = formDataToStream$1(
|
|
28527
|
-
|
|
28528
|
-
|
|
28529
|
-
|
|
28530
|
-
|
|
28531
|
-
|
|
28586
|
+
data = formDataToStream$1(
|
|
28587
|
+
data,
|
|
28588
|
+
(formHeaders) => {
|
|
28589
|
+
headers.set(formHeaders);
|
|
28590
|
+
},
|
|
28591
|
+
{
|
|
28592
|
+
tag: `axios-${VERSION2}-boundary`,
|
|
28593
|
+
boundary: userBoundary && userBoundary[1] || void 0
|
|
28594
|
+
}
|
|
28595
|
+
);
|
|
28532
28596
|
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
|
|
28533
28597
|
headers.set(data.getHeaders());
|
|
28534
28598
|
if (!headers.hasContentLength()) {
|
|
@@ -28549,19 +28613,23 @@ var require_axios = __commonJS({
|
|
|
28549
28613
|
} else if (utils$1.isString(data)) {
|
|
28550
28614
|
data = Buffer.from(data, "utf-8");
|
|
28551
28615
|
} else {
|
|
28552
|
-
return reject(
|
|
28553
|
-
|
|
28554
|
-
|
|
28555
|
-
|
|
28556
|
-
|
|
28616
|
+
return reject(
|
|
28617
|
+
new AxiosError$1(
|
|
28618
|
+
"Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
|
|
28619
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
28620
|
+
config
|
|
28621
|
+
)
|
|
28622
|
+
);
|
|
28557
28623
|
}
|
|
28558
28624
|
headers.setContentLength(data.length, false);
|
|
28559
28625
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
|
28560
|
-
return reject(
|
|
28561
|
-
|
|
28562
|
-
|
|
28563
|
-
|
|
28564
|
-
|
|
28626
|
+
return reject(
|
|
28627
|
+
new AxiosError$1(
|
|
28628
|
+
"Request body larger than maxBodyLength limit",
|
|
28629
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
28630
|
+
config
|
|
28631
|
+
)
|
|
28632
|
+
);
|
|
28565
28633
|
}
|
|
28566
28634
|
}
|
|
28567
28635
|
const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
|
|
@@ -28575,16 +28643,25 @@ var require_axios = __commonJS({
|
|
|
28575
28643
|
if (!utils$1.isStream(data)) {
|
|
28576
28644
|
data = stream__default["default"].Readable.from(data, { objectMode: false });
|
|
28577
28645
|
}
|
|
28578
|
-
data = stream__default["default"].pipeline(
|
|
28579
|
-
|
|
28580
|
-
|
|
28581
|
-
|
|
28582
|
-
|
|
28583
|
-
|
|
28584
|
-
|
|
28585
|
-
|
|
28646
|
+
data = stream__default["default"].pipeline(
|
|
28647
|
+
[
|
|
28648
|
+
data,
|
|
28649
|
+
new AxiosTransformStream$1({
|
|
28650
|
+
maxRate: utils$1.toFiniteNumber(maxUploadRate)
|
|
28651
|
+
})
|
|
28652
|
+
],
|
|
28653
|
+
utils$1.noop
|
|
28654
|
+
);
|
|
28655
|
+
onUploadProgress && data.on(
|
|
28656
|
+
"progress",
|
|
28657
|
+
flushOnFinish(
|
|
28658
|
+
data,
|
|
28659
|
+
progressEventDecorator(
|
|
28660
|
+
contentLength,
|
|
28661
|
+
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
|
28662
|
+
)
|
|
28586
28663
|
)
|
|
28587
|
-
)
|
|
28664
|
+
);
|
|
28588
28665
|
}
|
|
28589
28666
|
let auth = void 0;
|
|
28590
28667
|
if (config.auth) {
|
|
@@ -28635,7 +28712,11 @@ var require_axios = __commonJS({
|
|
|
28635
28712
|
} else {
|
|
28636
28713
|
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
28637
28714
|
options.port = parsed.port;
|
|
28638
|
-
setProxy(
|
|
28715
|
+
setProxy(
|
|
28716
|
+
options,
|
|
28717
|
+
config.proxy,
|
|
28718
|
+
protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path
|
|
28719
|
+
);
|
|
28639
28720
|
}
|
|
28640
28721
|
let transport;
|
|
28641
28722
|
const isHttpsRequest = isHttps.test(options.protocol);
|
|
@@ -28673,13 +28754,16 @@ var require_axios = __commonJS({
|
|
|
28673
28754
|
const transformStream = new AxiosTransformStream$1({
|
|
28674
28755
|
maxRate: utils$1.toFiniteNumber(maxDownloadRate)
|
|
28675
28756
|
});
|
|
28676
|
-
onDownloadProgress && transformStream.on(
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28757
|
+
onDownloadProgress && transformStream.on(
|
|
28758
|
+
"progress",
|
|
28759
|
+
flushOnFinish(
|
|
28760
|
+
transformStream,
|
|
28761
|
+
progressEventDecorator(
|
|
28762
|
+
responseLength,
|
|
28763
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
|
28764
|
+
)
|
|
28681
28765
|
)
|
|
28682
|
-
)
|
|
28766
|
+
);
|
|
28683
28767
|
streams.push(transformStream);
|
|
28684
28768
|
}
|
|
28685
28769
|
let responseStream = res;
|
|
@@ -28729,12 +28813,14 @@ var require_axios = __commonJS({
|
|
|
28729
28813
|
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
|
|
28730
28814
|
rejected = true;
|
|
28731
28815
|
responseStream.destroy();
|
|
28732
|
-
abort(
|
|
28733
|
-
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
|
|
28737
|
-
|
|
28816
|
+
abort(
|
|
28817
|
+
new AxiosError$1(
|
|
28818
|
+
"maxContentLength size of " + config.maxContentLength + " exceeded",
|
|
28819
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
28820
|
+
config,
|
|
28821
|
+
lastRequest
|
|
28822
|
+
)
|
|
28823
|
+
);
|
|
28738
28824
|
}
|
|
28739
28825
|
});
|
|
28740
28826
|
responseStream.on("aborted", function handlerStreamAborted() {
|
|
@@ -28793,12 +28879,14 @@ var require_axios = __commonJS({
|
|
|
28793
28879
|
if (config.timeout) {
|
|
28794
28880
|
const timeout = parseInt(config.timeout, 10);
|
|
28795
28881
|
if (Number.isNaN(timeout)) {
|
|
28796
|
-
abort(
|
|
28797
|
-
|
|
28798
|
-
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28882
|
+
abort(
|
|
28883
|
+
new AxiosError$1(
|
|
28884
|
+
"error trying to parse `config.timeout` to int",
|
|
28885
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE,
|
|
28886
|
+
config,
|
|
28887
|
+
req
|
|
28888
|
+
)
|
|
28889
|
+
);
|
|
28802
28890
|
return;
|
|
28803
28891
|
}
|
|
28804
28892
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
|
@@ -28808,12 +28896,14 @@ var require_axios = __commonJS({
|
|
|
28808
28896
|
if (config.timeoutErrorMessage) {
|
|
28809
28897
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
28810
28898
|
}
|
|
28811
|
-
abort(
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28899
|
+
abort(
|
|
28900
|
+
new AxiosError$1(
|
|
28901
|
+
timeoutErrorMessage,
|
|
28902
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
28903
|
+
config,
|
|
28904
|
+
req
|
|
28905
|
+
)
|
|
28906
|
+
);
|
|
28817
28907
|
});
|
|
28818
28908
|
} else {
|
|
28819
28909
|
req.setTimeout(0);
|
|
@@ -28962,27 +29052,29 @@ var require_axios = __commonJS({
|
|
|
28962
29052
|
validateStatus: mergeDirectKeys,
|
|
28963
29053
|
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
28964
29054
|
};
|
|
28965
|
-
utils$1.forEach(
|
|
28966
|
-
|
|
28967
|
-
|
|
28968
|
-
|
|
28969
|
-
|
|
28970
|
-
|
|
28971
|
-
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
28972
|
-
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
28973
|
-
}
|
|
28974
|
-
);
|
|
29055
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
29056
|
+
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
29057
|
+
const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
29058
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
29059
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
29060
|
+
});
|
|
28975
29061
|
return config;
|
|
28976
29062
|
}
|
|
28977
29063
|
var resolveConfig = (config) => {
|
|
28978
29064
|
const newConfig = mergeConfig({}, config);
|
|
28979
29065
|
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
28980
29066
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
28981
|
-
newConfig.url = buildURL(
|
|
29067
|
+
newConfig.url = buildURL(
|
|
29068
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
29069
|
+
config.params,
|
|
29070
|
+
config.paramsSerializer
|
|
29071
|
+
);
|
|
28982
29072
|
if (auth) {
|
|
28983
29073
|
headers.set(
|
|
28984
29074
|
"Authorization",
|
|
28985
|
-
"Basic " + btoa(
|
|
29075
|
+
"Basic " + btoa(
|
|
29076
|
+
(auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
|
|
29077
|
+
)
|
|
28986
29078
|
);
|
|
28987
29079
|
}
|
|
28988
29080
|
if (utils$1.isFormData(data)) {
|
|
@@ -29044,13 +29136,17 @@ var require_axios = __commonJS({
|
|
|
29044
29136
|
config,
|
|
29045
29137
|
request
|
|
29046
29138
|
};
|
|
29047
|
-
settle(
|
|
29048
|
-
|
|
29049
|
-
|
|
29050
|
-
|
|
29051
|
-
|
|
29052
|
-
|
|
29053
|
-
|
|
29139
|
+
settle(
|
|
29140
|
+
function _resolve(value) {
|
|
29141
|
+
resolve(value);
|
|
29142
|
+
done();
|
|
29143
|
+
},
|
|
29144
|
+
function _reject(err) {
|
|
29145
|
+
reject(err);
|
|
29146
|
+
done();
|
|
29147
|
+
},
|
|
29148
|
+
response
|
|
29149
|
+
);
|
|
29054
29150
|
request = null;
|
|
29055
29151
|
}
|
|
29056
29152
|
if ("onloadend" in request) {
|
|
@@ -29086,12 +29182,14 @@ var require_axios = __commonJS({
|
|
|
29086
29182
|
if (_config.timeoutErrorMessage) {
|
|
29087
29183
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
29088
29184
|
}
|
|
29089
|
-
reject(
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29185
|
+
reject(
|
|
29186
|
+
new AxiosError$1(
|
|
29187
|
+
timeoutErrorMessage,
|
|
29188
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
29189
|
+
config,
|
|
29190
|
+
request
|
|
29191
|
+
)
|
|
29192
|
+
);
|
|
29095
29193
|
request = null;
|
|
29096
29194
|
};
|
|
29097
29195
|
requestData === void 0 && requestHeaders.setContentType(null);
|
|
@@ -29131,7 +29229,13 @@ var require_axios = __commonJS({
|
|
|
29131
29229
|
}
|
|
29132
29230
|
const protocol = parseProtocol(_config.url);
|
|
29133
29231
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
29134
|
-
reject(
|
|
29232
|
+
reject(
|
|
29233
|
+
new AxiosError$1(
|
|
29234
|
+
"Unsupported protocol " + protocol + ":",
|
|
29235
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
29236
|
+
config
|
|
29237
|
+
)
|
|
29238
|
+
);
|
|
29135
29239
|
return;
|
|
29136
29240
|
}
|
|
29137
29241
|
request.send(requestData || null);
|
|
@@ -29147,7 +29251,9 @@ var require_axios = __commonJS({
|
|
|
29147
29251
|
aborted = true;
|
|
29148
29252
|
unsubscribe();
|
|
29149
29253
|
const err = reason instanceof Error ? reason : this.reason;
|
|
29150
|
-
controller.abort(
|
|
29254
|
+
controller.abort(
|
|
29255
|
+
err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)
|
|
29256
|
+
);
|
|
29151
29257
|
}
|
|
29152
29258
|
};
|
|
29153
29259
|
let timer = timeout && setTimeout(() => {
|
|
@@ -29218,33 +29324,36 @@ var require_axios = __commonJS({
|
|
|
29218
29324
|
onFinish && onFinish(e);
|
|
29219
29325
|
}
|
|
29220
29326
|
};
|
|
29221
|
-
return new ReadableStream(
|
|
29222
|
-
|
|
29223
|
-
|
|
29224
|
-
|
|
29225
|
-
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29229
|
-
|
|
29230
|
-
|
|
29231
|
-
|
|
29232
|
-
|
|
29233
|
-
|
|
29327
|
+
return new ReadableStream(
|
|
29328
|
+
{
|
|
29329
|
+
async pull(controller) {
|
|
29330
|
+
try {
|
|
29331
|
+
const { done: done2, value } = await iterator2.next();
|
|
29332
|
+
if (done2) {
|
|
29333
|
+
_onFinish();
|
|
29334
|
+
controller.close();
|
|
29335
|
+
return;
|
|
29336
|
+
}
|
|
29337
|
+
let len = value.byteLength;
|
|
29338
|
+
if (onProgress) {
|
|
29339
|
+
let loadedBytes = bytes += len;
|
|
29340
|
+
onProgress(loadedBytes);
|
|
29341
|
+
}
|
|
29342
|
+
controller.enqueue(new Uint8Array(value));
|
|
29343
|
+
} catch (err) {
|
|
29344
|
+
_onFinish(err);
|
|
29345
|
+
throw err;
|
|
29234
29346
|
}
|
|
29235
|
-
|
|
29236
|
-
|
|
29237
|
-
_onFinish(
|
|
29238
|
-
|
|
29347
|
+
},
|
|
29348
|
+
cancel(reason) {
|
|
29349
|
+
_onFinish(reason);
|
|
29350
|
+
return iterator2.return();
|
|
29239
29351
|
}
|
|
29240
29352
|
},
|
|
29241
|
-
|
|
29242
|
-
|
|
29243
|
-
return iterator2.return();
|
|
29353
|
+
{
|
|
29354
|
+
highWaterMark: 2
|
|
29244
29355
|
}
|
|
29245
|
-
|
|
29246
|
-
highWaterMark: 2
|
|
29247
|
-
});
|
|
29356
|
+
);
|
|
29248
29357
|
};
|
|
29249
29358
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
29250
29359
|
var { isFunction } = utils$1;
|
|
@@ -29252,10 +29361,7 @@ var require_axios = __commonJS({
|
|
|
29252
29361
|
Request,
|
|
29253
29362
|
Response
|
|
29254
29363
|
}))(utils$1.global);
|
|
29255
|
-
var {
|
|
29256
|
-
ReadableStream: ReadableStream$1,
|
|
29257
|
-
TextEncoder: TextEncoder$1
|
|
29258
|
-
} = utils$1.global;
|
|
29364
|
+
var { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
|
|
29259
29365
|
var test = (fn, ...args) => {
|
|
29260
29366
|
try {
|
|
29261
29367
|
return !!fn(...args);
|
|
@@ -29264,9 +29370,13 @@ var require_axios = __commonJS({
|
|
|
29264
29370
|
}
|
|
29265
29371
|
};
|
|
29266
29372
|
var factory = (env) => {
|
|
29267
|
-
env = utils$1.merge.call(
|
|
29268
|
-
|
|
29269
|
-
|
|
29373
|
+
env = utils$1.merge.call(
|
|
29374
|
+
{
|
|
29375
|
+
skipUndefined: true
|
|
29376
|
+
},
|
|
29377
|
+
globalFetchAPI,
|
|
29378
|
+
env
|
|
29379
|
+
);
|
|
29270
29380
|
const { fetch: envFetch, Request, Response } = env;
|
|
29271
29381
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
|
|
29272
29382
|
const isRequestSupported = isFunction(Request);
|
|
@@ -29299,7 +29409,11 @@ var require_axios = __commonJS({
|
|
|
29299
29409
|
if (method) {
|
|
29300
29410
|
return method.call(res);
|
|
29301
29411
|
}
|
|
29302
|
-
throw new AxiosError$1(
|
|
29412
|
+
throw new AxiosError$1(
|
|
29413
|
+
`Response type '${type}' is not supported`,
|
|
29414
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
29415
|
+
config
|
|
29416
|
+
);
|
|
29303
29417
|
});
|
|
29304
29418
|
});
|
|
29305
29419
|
})();
|
|
@@ -29348,7 +29462,10 @@ var require_axios = __commonJS({
|
|
|
29348
29462
|
} = resolveConfig(config);
|
|
29349
29463
|
let _fetch = envFetch || fetch;
|
|
29350
29464
|
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
29351
|
-
let composedSignal = composeSignals$1(
|
|
29465
|
+
let composedSignal = composeSignals$1(
|
|
29466
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
29467
|
+
timeout
|
|
29468
|
+
);
|
|
29352
29469
|
let request = null;
|
|
29353
29470
|
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
29354
29471
|
composedSignal.unsubscribe();
|
|
@@ -29408,7 +29525,10 @@ var require_axios = __commonJS({
|
|
|
29408
29525
|
);
|
|
29409
29526
|
}
|
|
29410
29527
|
responseType = responseType || "text";
|
|
29411
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](
|
|
29528
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](
|
|
29529
|
+
response,
|
|
29530
|
+
config
|
|
29531
|
+
);
|
|
29412
29532
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
29413
29533
|
return await new Promise((resolve, reject) => {
|
|
29414
29534
|
settle(resolve, reject, {
|
|
@@ -29424,7 +29544,13 @@ var require_axios = __commonJS({
|
|
|
29424
29544
|
unsubscribe && unsubscribe();
|
|
29425
29545
|
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
29426
29546
|
throw Object.assign(
|
|
29427
|
-
new AxiosError$1(
|
|
29547
|
+
new AxiosError$1(
|
|
29548
|
+
"Network Error",
|
|
29549
|
+
AxiosError$1.ERR_NETWORK,
|
|
29550
|
+
config,
|
|
29551
|
+
request,
|
|
29552
|
+
err && err.response
|
|
29553
|
+
),
|
|
29428
29554
|
{
|
|
29429
29555
|
cause: err.cause || err
|
|
29430
29556
|
}
|
|
@@ -29438,11 +29564,7 @@ var require_axios = __commonJS({
|
|
|
29438
29564
|
var getFetch = (config) => {
|
|
29439
29565
|
let env = config && config.env || {};
|
|
29440
29566
|
const { fetch: fetch2, Request, Response } = env;
|
|
29441
|
-
const seeds = [
|
|
29442
|
-
Request,
|
|
29443
|
-
Response,
|
|
29444
|
-
fetch2
|
|
29445
|
-
];
|
|
29567
|
+
const seeds = [Request, Response, fetch2];
|
|
29446
29568
|
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
29447
29569
|
while (i--) {
|
|
29448
29570
|
seed = seeds[i];
|
|
@@ -29527,37 +29649,33 @@ var require_axios = __commonJS({
|
|
|
29527
29649
|
function dispatchRequest(config) {
|
|
29528
29650
|
throwIfCancellationRequested(config);
|
|
29529
29651
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
29530
|
-
config.data = transformData.call(
|
|
29531
|
-
config,
|
|
29532
|
-
config.transformRequest
|
|
29533
|
-
);
|
|
29652
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
29534
29653
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
29535
29654
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
29536
29655
|
}
|
|
29537
29656
|
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
29538
|
-
return adapter(config).then(
|
|
29539
|
-
|
|
29540
|
-
response.data = transformData.call(
|
|
29541
|
-
config,
|
|
29542
|
-
config.transformResponse,
|
|
29543
|
-
response
|
|
29544
|
-
);
|
|
29545
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
29546
|
-
return response;
|
|
29547
|
-
}, function onAdapterRejection(reason) {
|
|
29548
|
-
if (!isCancel(reason)) {
|
|
29657
|
+
return adapter(config).then(
|
|
29658
|
+
function onAdapterResolution(response) {
|
|
29549
29659
|
throwIfCancellationRequested(config);
|
|
29550
|
-
|
|
29551
|
-
|
|
29552
|
-
|
|
29553
|
-
|
|
29554
|
-
|
|
29555
|
-
|
|
29556
|
-
|
|
29660
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
29661
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
29662
|
+
return response;
|
|
29663
|
+
},
|
|
29664
|
+
function onAdapterRejection(reason) {
|
|
29665
|
+
if (!isCancel(reason)) {
|
|
29666
|
+
throwIfCancellationRequested(config);
|
|
29667
|
+
if (reason && reason.response) {
|
|
29668
|
+
reason.response.data = transformData.call(
|
|
29669
|
+
config,
|
|
29670
|
+
config.transformResponse,
|
|
29671
|
+
reason.response
|
|
29672
|
+
);
|
|
29673
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
29674
|
+
}
|
|
29557
29675
|
}
|
|
29676
|
+
return Promise.reject(reason);
|
|
29558
29677
|
}
|
|
29559
|
-
|
|
29560
|
-
});
|
|
29678
|
+
);
|
|
29561
29679
|
}
|
|
29562
29680
|
var validators$1 = {};
|
|
29563
29681
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
@@ -29608,7 +29726,10 @@ var require_axios = __commonJS({
|
|
|
29608
29726
|
const value = options[opt];
|
|
29609
29727
|
const result = value === void 0 || validator2(value, opt, options);
|
|
29610
29728
|
if (result !== true) {
|
|
29611
|
-
throw new AxiosError$1(
|
|
29729
|
+
throw new AxiosError$1(
|
|
29730
|
+
"option " + opt + " must be " + result,
|
|
29731
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
29732
|
+
);
|
|
29612
29733
|
}
|
|
29613
29734
|
continue;
|
|
29614
29735
|
}
|
|
@@ -29668,12 +29789,16 @@ var require_axios = __commonJS({
|
|
|
29668
29789
|
config = mergeConfig(this.defaults, config);
|
|
29669
29790
|
const { transitional, paramsSerializer, headers } = config;
|
|
29670
29791
|
if (transitional !== void 0) {
|
|
29671
|
-
validator.assertOptions(
|
|
29672
|
-
|
|
29673
|
-
|
|
29674
|
-
|
|
29675
|
-
|
|
29676
|
-
|
|
29792
|
+
validator.assertOptions(
|
|
29793
|
+
transitional,
|
|
29794
|
+
{
|
|
29795
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
29796
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
29797
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
29798
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
|
29799
|
+
},
|
|
29800
|
+
false
|
|
29801
|
+
);
|
|
29677
29802
|
}
|
|
29678
29803
|
if (paramsSerializer != null) {
|
|
29679
29804
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
@@ -29681,10 +29806,14 @@ var require_axios = __commonJS({
|
|
|
29681
29806
|
serialize: paramsSerializer
|
|
29682
29807
|
};
|
|
29683
29808
|
} else {
|
|
29684
|
-
validator.assertOptions(
|
|
29685
|
-
|
|
29686
|
-
|
|
29687
|
-
|
|
29809
|
+
validator.assertOptions(
|
|
29810
|
+
paramsSerializer,
|
|
29811
|
+
{
|
|
29812
|
+
encode: validators.function,
|
|
29813
|
+
serialize: validators.function
|
|
29814
|
+
},
|
|
29815
|
+
true
|
|
29816
|
+
);
|
|
29688
29817
|
}
|
|
29689
29818
|
}
|
|
29690
29819
|
if (config.allowAbsoluteUrls !== void 0) ;
|
|
@@ -29693,21 +29822,19 @@ var require_axios = __commonJS({
|
|
|
29693
29822
|
} else {
|
|
29694
29823
|
config.allowAbsoluteUrls = true;
|
|
29695
29824
|
}
|
|
29696
|
-
validator.assertOptions(
|
|
29697
|
-
|
|
29698
|
-
|
|
29699
|
-
|
|
29700
|
-
|
|
29701
|
-
|
|
29702
|
-
|
|
29703
|
-
headers[config.method]
|
|
29704
|
-
);
|
|
29705
|
-
headers && utils$1.forEach(
|
|
29706
|
-
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
29707
|
-
(method) => {
|
|
29708
|
-
delete headers[method];
|
|
29709
|
-
}
|
|
29825
|
+
validator.assertOptions(
|
|
29826
|
+
config,
|
|
29827
|
+
{
|
|
29828
|
+
baseUrl: validators.spelling("baseURL"),
|
|
29829
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
29830
|
+
},
|
|
29831
|
+
true
|
|
29710
29832
|
);
|
|
29833
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
29834
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
29835
|
+
headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
|
|
29836
|
+
delete headers[method];
|
|
29837
|
+
});
|
|
29711
29838
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
29712
29839
|
const requestInterceptorChain = [];
|
|
29713
29840
|
let synchronousRequestInterceptors = true;
|
|
@@ -29774,24 +29901,28 @@ var require_axios = __commonJS({
|
|
|
29774
29901
|
};
|
|
29775
29902
|
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
29776
29903
|
Axios.prototype[method] = function(url2, config) {
|
|
29777
|
-
return this.request(
|
|
29778
|
-
|
|
29779
|
-
|
|
29780
|
-
|
|
29781
|
-
|
|
29904
|
+
return this.request(
|
|
29905
|
+
mergeConfig(config || {}, {
|
|
29906
|
+
method,
|
|
29907
|
+
url: url2,
|
|
29908
|
+
data: (config || {}).data
|
|
29909
|
+
})
|
|
29910
|
+
);
|
|
29782
29911
|
};
|
|
29783
29912
|
});
|
|
29784
29913
|
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
29785
29914
|
function generateHTTPMethod(isForm) {
|
|
29786
29915
|
return function httpMethod(url2, data, config) {
|
|
29787
|
-
return this.request(
|
|
29788
|
-
|
|
29789
|
-
|
|
29790
|
-
|
|
29791
|
-
|
|
29792
|
-
|
|
29793
|
-
|
|
29794
|
-
|
|
29916
|
+
return this.request(
|
|
29917
|
+
mergeConfig(config || {}, {
|
|
29918
|
+
method,
|
|
29919
|
+
headers: isForm ? {
|
|
29920
|
+
"Content-Type": "multipart/form-data"
|
|
29921
|
+
} : {},
|
|
29922
|
+
url: url2,
|
|
29923
|
+
data
|
|
29924
|
+
})
|
|
29925
|
+
);
|
|
29795
29926
|
};
|
|
29796
29927
|
}
|
|
29797
29928
|
Axios.prototype[method] = generateHTTPMethod();
|
|
@@ -30670,6 +30801,19 @@ function buildGenerateResult(config) {
|
|
|
30670
30801
|
tokenUsage,
|
|
30671
30802
|
toolCalls
|
|
30672
30803
|
};
|
|
30804
|
+
const citations = response.getCitations?.();
|
|
30805
|
+
if (citations?.length) {
|
|
30806
|
+
for (const citation of citations) {
|
|
30807
|
+
content.push({
|
|
30808
|
+
id: String(citation.ref_id ?? citation.url),
|
|
30809
|
+
sourceType: "url",
|
|
30810
|
+
title: citation.title,
|
|
30811
|
+
type: "source",
|
|
30812
|
+
url: citation.url
|
|
30813
|
+
});
|
|
30814
|
+
}
|
|
30815
|
+
}
|
|
30816
|
+
const intermediateFailures = response.getIntermediateFailures?.();
|
|
30673
30817
|
return {
|
|
30674
30818
|
content,
|
|
30675
30819
|
finishReason,
|
|
@@ -30677,6 +30821,7 @@ function buildGenerateResult(config) {
|
|
|
30677
30821
|
[providerName]: {
|
|
30678
30822
|
finishReason: finishReasonRaw ?? "unknown",
|
|
30679
30823
|
finishReasonMapped: finishReason,
|
|
30824
|
+
...intermediateFailures?.length ? { intermediateFailures } : {},
|
|
30680
30825
|
...typeof responseHeaders?.["x-request-id"] === "string" ? { requestId: responseHeaders["x-request-id"] } : {},
|
|
30681
30826
|
version: version2
|
|
30682
30827
|
}
|
|
@@ -30687,19 +30832,20 @@ function buildGenerateResult(config) {
|
|
|
30687
30832
|
response: {
|
|
30688
30833
|
body: rawResponseBody,
|
|
30689
30834
|
headers: responseHeaders,
|
|
30835
|
+
id: response.responseId,
|
|
30690
30836
|
modelId,
|
|
30691
30837
|
timestamp: /* @__PURE__ */ new Date()
|
|
30692
30838
|
},
|
|
30693
30839
|
usage: {
|
|
30694
30840
|
inputTokens: {
|
|
30695
|
-
cacheRead:
|
|
30841
|
+
cacheRead: tokenUsage?.prompt_tokens_details?.cached_tokens,
|
|
30696
30842
|
cacheWrite: void 0,
|
|
30697
|
-
noCache: tokenUsage?.prompt_tokens,
|
|
30843
|
+
noCache: tokenUsage?.prompt_tokens_details?.cached_tokens != null ? (tokenUsage.prompt_tokens ?? 0) - tokenUsage.prompt_tokens_details.cached_tokens : tokenUsage?.prompt_tokens,
|
|
30698
30844
|
total: tokenUsage?.prompt_tokens
|
|
30699
30845
|
},
|
|
30700
30846
|
outputTokens: {
|
|
30701
|
-
reasoning:
|
|
30702
|
-
text: tokenUsage?.completion_tokens,
|
|
30847
|
+
reasoning: tokenUsage?.completion_tokens_details?.reasoning_tokens,
|
|
30848
|
+
text: tokenUsage?.completion_tokens_details?.reasoning_tokens != null ? (tokenUsage.completion_tokens ?? 0) - tokenUsage.completion_tokens_details.reasoning_tokens : tokenUsage?.completion_tokens,
|
|
30703
30849
|
total: tokenUsage?.completion_tokens
|
|
30704
30850
|
}
|
|
30705
30851
|
},
|
|
@@ -30875,9 +31021,12 @@ function createStreamTransformer(config) {
|
|
|
30875
31021
|
modelId,
|
|
30876
31022
|
options,
|
|
30877
31023
|
providerName,
|
|
31024
|
+
responseHeaders,
|
|
30878
31025
|
responseId,
|
|
30879
31026
|
sdkStream,
|
|
31027
|
+
streamResponseGetCitations,
|
|
30880
31028
|
streamResponseGetFinishReason,
|
|
31029
|
+
streamResponseGetIntermediateFailures,
|
|
30881
31030
|
streamResponseGetTokenUsage,
|
|
30882
31031
|
url,
|
|
30883
31032
|
version: version2,
|
|
@@ -30886,131 +31035,11 @@ function createStreamTransformer(config) {
|
|
|
30886
31035
|
let textBlockId = null;
|
|
30887
31036
|
const streamState = createInitialStreamState();
|
|
30888
31037
|
const toolCallsInProgress = /* @__PURE__ */ new Map();
|
|
30889
|
-
return
|
|
30890
|
-
|
|
30891
|
-
|
|
30892
|
-
|
|
30893
|
-
controller
|
|
30894
|
-
type: "stream-start",
|
|
30895
|
-
warnings: [...warnings]
|
|
30896
|
-
});
|
|
30897
|
-
try {
|
|
30898
|
-
for await (const chunk of sdkStream) {
|
|
30899
|
-
if (includeRawChunks) {
|
|
30900
|
-
controller.enqueue({
|
|
30901
|
-
rawValue: chunk._data ?? chunk,
|
|
30902
|
-
type: "raw"
|
|
30903
|
-
});
|
|
30904
|
-
}
|
|
30905
|
-
if (streamState.isFirstChunk) {
|
|
30906
|
-
streamState.isFirstChunk = false;
|
|
30907
|
-
controller.enqueue({
|
|
30908
|
-
id: responseId,
|
|
30909
|
-
modelId,
|
|
30910
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
30911
|
-
type: "response-metadata"
|
|
30912
|
-
});
|
|
30913
|
-
}
|
|
30914
|
-
const deltaToolCalls = chunk.getDeltaToolCalls();
|
|
30915
|
-
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
30916
|
-
streamState.finishReason = {
|
|
30917
|
-
raw: void 0,
|
|
30918
|
-
unified: "tool-calls"
|
|
30919
|
-
};
|
|
30920
|
-
}
|
|
30921
|
-
const deltaContent = chunk.getDeltaContent();
|
|
30922
|
-
if (typeof deltaContent === "string" && deltaContent.length > 0 && streamState.finishReason.unified !== "tool-calls") {
|
|
30923
|
-
if (!streamState.activeText) {
|
|
30924
|
-
textBlockId = idGenerator.generateTextBlockId();
|
|
30925
|
-
controller.enqueue({ id: textBlockId, type: "text-start" });
|
|
30926
|
-
streamState.activeText = true;
|
|
30927
|
-
}
|
|
30928
|
-
if (textBlockId) {
|
|
30929
|
-
controller.enqueue({
|
|
30930
|
-
delta: deltaContent,
|
|
30931
|
-
id: textBlockId,
|
|
30932
|
-
type: "text-delta"
|
|
30933
|
-
});
|
|
30934
|
-
}
|
|
30935
|
-
}
|
|
30936
|
-
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
30937
|
-
for (const toolCallChunk of deltaToolCalls) {
|
|
30938
|
-
const index = toolCallChunk.index;
|
|
30939
|
-
if (typeof index !== "number" || !Number.isFinite(index)) {
|
|
30940
|
-
continue;
|
|
30941
|
-
}
|
|
30942
|
-
if (!toolCallsInProgress.has(index)) {
|
|
30943
|
-
toolCallsInProgress.set(index, {
|
|
30944
|
-
arguments: "",
|
|
30945
|
-
didEmitCall: false,
|
|
30946
|
-
didEmitInputStart: false,
|
|
30947
|
-
id: toolCallChunk.id ?? `tool_${String(index)}`,
|
|
30948
|
-
toolName: toolCallChunk.function?.name
|
|
30949
|
-
});
|
|
30950
|
-
}
|
|
30951
|
-
const tc = toolCallsInProgress.get(index);
|
|
30952
|
-
if (!tc) continue;
|
|
30953
|
-
if (toolCallChunk.id) {
|
|
30954
|
-
tc.id = toolCallChunk.id;
|
|
30955
|
-
}
|
|
30956
|
-
const nextToolName = toolCallChunk.function?.name;
|
|
30957
|
-
if (typeof nextToolName === "string" && nextToolName.length > 0) {
|
|
30958
|
-
tc.toolName = nextToolName;
|
|
30959
|
-
}
|
|
30960
|
-
if (!tc.didEmitInputStart && tc.toolName) {
|
|
30961
|
-
tc.didEmitInputStart = true;
|
|
30962
|
-
controller.enqueue({
|
|
30963
|
-
id: tc.id,
|
|
30964
|
-
toolName: tc.toolName,
|
|
30965
|
-
type: "tool-input-start"
|
|
30966
|
-
});
|
|
30967
|
-
}
|
|
30968
|
-
const argumentsDelta = toolCallChunk.function?.arguments;
|
|
30969
|
-
if (typeof argumentsDelta === "string" && argumentsDelta.length > 0) {
|
|
30970
|
-
tc.arguments += argumentsDelta;
|
|
30971
|
-
if (tc.didEmitInputStart) {
|
|
30972
|
-
controller.enqueue({
|
|
30973
|
-
delta: argumentsDelta,
|
|
30974
|
-
id: tc.id,
|
|
30975
|
-
type: "tool-input-delta"
|
|
30976
|
-
});
|
|
30977
|
-
}
|
|
30978
|
-
}
|
|
30979
|
-
}
|
|
30980
|
-
}
|
|
30981
|
-
const chunkFinishReason = chunk.getFinishReason();
|
|
30982
|
-
if (chunkFinishReason) {
|
|
30983
|
-
streamState.finishReason = mapFinishReason(chunkFinishReason);
|
|
30984
|
-
if (streamState.finishReason.unified === "tool-calls") {
|
|
30985
|
-
const toolCalls2 = Array.from(toolCallsInProgress.values());
|
|
30986
|
-
for (const tc of toolCalls2) {
|
|
30987
|
-
if (tc.didEmitCall) {
|
|
30988
|
-
continue;
|
|
30989
|
-
}
|
|
30990
|
-
if (!tc.didEmitInputStart) {
|
|
30991
|
-
tc.didEmitInputStart = true;
|
|
30992
|
-
controller.enqueue({
|
|
30993
|
-
id: tc.id,
|
|
30994
|
-
toolName: tc.toolName ?? "",
|
|
30995
|
-
type: "tool-input-start"
|
|
30996
|
-
});
|
|
30997
|
-
}
|
|
30998
|
-
tc.didEmitCall = true;
|
|
30999
|
-
controller.enqueue({ id: tc.id, type: "tool-input-end" });
|
|
31000
|
-
controller.enqueue({
|
|
31001
|
-
input: tc.arguments,
|
|
31002
|
-
toolCallId: tc.id,
|
|
31003
|
-
toolName: tc.toolName ?? "",
|
|
31004
|
-
type: "tool-call"
|
|
31005
|
-
});
|
|
31006
|
-
}
|
|
31007
|
-
if (streamState.activeText && textBlockId) {
|
|
31008
|
-
controller.enqueue({ id: textBlockId, type: "text-end" });
|
|
31009
|
-
streamState.activeText = false;
|
|
31010
|
-
}
|
|
31011
|
-
}
|
|
31012
|
-
}
|
|
31013
|
-
}
|
|
31038
|
+
return (0, import_provider_utils2.convertAsyncIteratorToReadableStream)(
|
|
31039
|
+
safeIterate(sdkStream)[Symbol.asyncIterator]()
|
|
31040
|
+
).pipeThrough(
|
|
31041
|
+
new TransformStream({
|
|
31042
|
+
flush(controller) {
|
|
31014
31043
|
const toolCalls = Array.from(toolCallsInProgress.values());
|
|
31015
31044
|
let didEmitAnyToolCalls = false;
|
|
31016
31045
|
for (const tc of toolCalls) {
|
|
@@ -31050,15 +31079,34 @@ function createStreamTransformer(config) {
|
|
|
31050
31079
|
const finalUsage = streamResponseGetTokenUsage();
|
|
31051
31080
|
if (finalUsage) {
|
|
31052
31081
|
streamState.usage.inputTokens.total = finalUsage.prompt_tokens;
|
|
31053
|
-
streamState.usage.inputTokens.
|
|
31082
|
+
streamState.usage.inputTokens.cacheRead = finalUsage.prompt_tokens_details?.cached_tokens;
|
|
31083
|
+
streamState.usage.inputTokens.noCache = finalUsage.prompt_tokens_details?.cached_tokens != null ? (finalUsage.prompt_tokens ?? 0) - finalUsage.prompt_tokens_details.cached_tokens : finalUsage.prompt_tokens;
|
|
31054
31084
|
streamState.usage.outputTokens.total = finalUsage.completion_tokens;
|
|
31055
|
-
streamState.usage.outputTokens.
|
|
31085
|
+
streamState.usage.outputTokens.reasoning = finalUsage.completion_tokens_details?.reasoning_tokens;
|
|
31086
|
+
streamState.usage.outputTokens.text = finalUsage.completion_tokens_details?.reasoning_tokens != null ? (finalUsage.completion_tokens ?? 0) - finalUsage.completion_tokens_details.reasoning_tokens : finalUsage.completion_tokens;
|
|
31056
31087
|
}
|
|
31088
|
+
const streamCitations = streamResponseGetCitations?.();
|
|
31089
|
+
if (streamCitations?.length) {
|
|
31090
|
+
for (const citation of streamCitations) {
|
|
31091
|
+
controller.enqueue({
|
|
31092
|
+
id: String(citation.ref_id ?? citation.url),
|
|
31093
|
+
sourceType: "url",
|
|
31094
|
+
title: citation.title,
|
|
31095
|
+
type: "source",
|
|
31096
|
+
url: citation.url
|
|
31097
|
+
});
|
|
31098
|
+
}
|
|
31099
|
+
}
|
|
31100
|
+
const streamIntermediateFailures = streamResponseGetIntermediateFailures?.();
|
|
31057
31101
|
controller.enqueue({
|
|
31058
31102
|
finishReason: streamState.finishReason,
|
|
31059
31103
|
providerMetadata: {
|
|
31060
31104
|
[providerName]: {
|
|
31061
31105
|
finishReason: streamState.finishReason.raw,
|
|
31106
|
+
...streamIntermediateFailures?.length ? {
|
|
31107
|
+
intermediateFailures: streamIntermediateFailures
|
|
31108
|
+
} : {},
|
|
31109
|
+
...typeof responseHeaders?.["x-request-id"] === "string" ? { requestId: responseHeaders["x-request-id"] } : {},
|
|
31062
31110
|
responseId,
|
|
31063
31111
|
version: version2
|
|
31064
31112
|
}
|
|
@@ -31066,21 +31114,144 @@ function createStreamTransformer(config) {
|
|
|
31066
31114
|
type: "finish",
|
|
31067
31115
|
usage: streamState.usage
|
|
31068
31116
|
});
|
|
31069
|
-
|
|
31070
|
-
|
|
31071
|
-
const aiError = convertToAISDKError2(error, {
|
|
31072
|
-
operation: "doStream",
|
|
31073
|
-
requestBody: createAISDKRequestBodySummary(options),
|
|
31074
|
-
url
|
|
31075
|
-
});
|
|
31117
|
+
},
|
|
31118
|
+
start(controller) {
|
|
31076
31119
|
controller.enqueue({
|
|
31077
|
-
|
|
31078
|
-
|
|
31120
|
+
type: "stream-start",
|
|
31121
|
+
warnings: [...warnings]
|
|
31079
31122
|
});
|
|
31080
|
-
|
|
31123
|
+
},
|
|
31124
|
+
transform(chunk, controller) {
|
|
31125
|
+
if (chunk instanceof Error) {
|
|
31126
|
+
const aiError = convertToAISDKError2(chunk, {
|
|
31127
|
+
operation: "doStream",
|
|
31128
|
+
requestBody: createAISDKRequestBodySummary(options),
|
|
31129
|
+
url
|
|
31130
|
+
});
|
|
31131
|
+
controller.enqueue({
|
|
31132
|
+
error: aiError instanceof Error ? aiError : new Error(String(aiError)),
|
|
31133
|
+
type: "error"
|
|
31134
|
+
});
|
|
31135
|
+
controller.terminate();
|
|
31136
|
+
return;
|
|
31137
|
+
}
|
|
31138
|
+
if (includeRawChunks) {
|
|
31139
|
+
controller.enqueue({
|
|
31140
|
+
rawValue: chunk._data ?? chunk,
|
|
31141
|
+
type: "raw"
|
|
31142
|
+
});
|
|
31143
|
+
}
|
|
31144
|
+
if (streamState.isFirstChunk) {
|
|
31145
|
+
streamState.isFirstChunk = false;
|
|
31146
|
+
controller.enqueue({
|
|
31147
|
+
id: responseId,
|
|
31148
|
+
modelId,
|
|
31149
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
31150
|
+
type: "response-metadata"
|
|
31151
|
+
});
|
|
31152
|
+
}
|
|
31153
|
+
const deltaToolCalls = chunk.getDeltaToolCalls();
|
|
31154
|
+
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
31155
|
+
streamState.finishReason = {
|
|
31156
|
+
raw: void 0,
|
|
31157
|
+
unified: "tool-calls"
|
|
31158
|
+
};
|
|
31159
|
+
}
|
|
31160
|
+
const deltaContent = chunk.getDeltaContent();
|
|
31161
|
+
if (typeof deltaContent === "string" && deltaContent.length > 0 && streamState.finishReason.unified !== "tool-calls") {
|
|
31162
|
+
if (!streamState.activeText) {
|
|
31163
|
+
textBlockId = idGenerator.generateTextBlockId();
|
|
31164
|
+
controller.enqueue({ id: textBlockId, type: "text-start" });
|
|
31165
|
+
streamState.activeText = true;
|
|
31166
|
+
}
|
|
31167
|
+
if (textBlockId) {
|
|
31168
|
+
controller.enqueue({
|
|
31169
|
+
delta: deltaContent,
|
|
31170
|
+
id: textBlockId,
|
|
31171
|
+
type: "text-delta"
|
|
31172
|
+
});
|
|
31173
|
+
}
|
|
31174
|
+
}
|
|
31175
|
+
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
31176
|
+
for (const toolCallChunk of deltaToolCalls) {
|
|
31177
|
+
const index = toolCallChunk.index;
|
|
31178
|
+
if (typeof index !== "number" || !Number.isFinite(index)) {
|
|
31179
|
+
continue;
|
|
31180
|
+
}
|
|
31181
|
+
if (!toolCallsInProgress.has(index)) {
|
|
31182
|
+
toolCallsInProgress.set(index, {
|
|
31183
|
+
arguments: "",
|
|
31184
|
+
didEmitCall: false,
|
|
31185
|
+
didEmitInputStart: false,
|
|
31186
|
+
id: toolCallChunk.id ?? `tool_${String(index)}`,
|
|
31187
|
+
toolName: toolCallChunk.function?.name
|
|
31188
|
+
});
|
|
31189
|
+
}
|
|
31190
|
+
const tc = toolCallsInProgress.get(index);
|
|
31191
|
+
if (!tc) continue;
|
|
31192
|
+
if (toolCallChunk.id) {
|
|
31193
|
+
tc.id = toolCallChunk.id;
|
|
31194
|
+
}
|
|
31195
|
+
const nextToolName = toolCallChunk.function?.name;
|
|
31196
|
+
if (typeof nextToolName === "string" && nextToolName.length > 0) {
|
|
31197
|
+
tc.toolName = nextToolName;
|
|
31198
|
+
}
|
|
31199
|
+
if (!tc.didEmitInputStart && tc.toolName) {
|
|
31200
|
+
tc.didEmitInputStart = true;
|
|
31201
|
+
controller.enqueue({
|
|
31202
|
+
id: tc.id,
|
|
31203
|
+
toolName: tc.toolName,
|
|
31204
|
+
type: "tool-input-start"
|
|
31205
|
+
});
|
|
31206
|
+
}
|
|
31207
|
+
const argumentsDelta = toolCallChunk.function?.arguments;
|
|
31208
|
+
if (typeof argumentsDelta === "string" && argumentsDelta.length > 0) {
|
|
31209
|
+
tc.arguments += argumentsDelta;
|
|
31210
|
+
if (tc.didEmitInputStart) {
|
|
31211
|
+
controller.enqueue({
|
|
31212
|
+
delta: argumentsDelta,
|
|
31213
|
+
id: tc.id,
|
|
31214
|
+
type: "tool-input-delta"
|
|
31215
|
+
});
|
|
31216
|
+
}
|
|
31217
|
+
}
|
|
31218
|
+
}
|
|
31219
|
+
}
|
|
31220
|
+
const chunkFinishReason = chunk.getFinishReason();
|
|
31221
|
+
if (chunkFinishReason) {
|
|
31222
|
+
streamState.finishReason = mapFinishReason(chunkFinishReason);
|
|
31223
|
+
if (streamState.finishReason.unified === "tool-calls") {
|
|
31224
|
+
const toolCalls = Array.from(toolCallsInProgress.values());
|
|
31225
|
+
for (const tc of toolCalls) {
|
|
31226
|
+
if (tc.didEmitCall) {
|
|
31227
|
+
continue;
|
|
31228
|
+
}
|
|
31229
|
+
if (!tc.didEmitInputStart) {
|
|
31230
|
+
tc.didEmitInputStart = true;
|
|
31231
|
+
controller.enqueue({
|
|
31232
|
+
id: tc.id,
|
|
31233
|
+
toolName: tc.toolName ?? "",
|
|
31234
|
+
type: "tool-input-start"
|
|
31235
|
+
});
|
|
31236
|
+
}
|
|
31237
|
+
tc.didEmitCall = true;
|
|
31238
|
+
controller.enqueue({ id: tc.id, type: "tool-input-end" });
|
|
31239
|
+
controller.enqueue({
|
|
31240
|
+
input: tc.arguments,
|
|
31241
|
+
toolCallId: tc.id,
|
|
31242
|
+
toolName: tc.toolName ?? "",
|
|
31243
|
+
type: "tool-call"
|
|
31244
|
+
});
|
|
31245
|
+
}
|
|
31246
|
+
if (streamState.activeText && textBlockId) {
|
|
31247
|
+
controller.enqueue({ id: textBlockId, type: "text-end" });
|
|
31248
|
+
streamState.activeText = false;
|
|
31249
|
+
}
|
|
31250
|
+
}
|
|
31251
|
+
}
|
|
31081
31252
|
}
|
|
31082
|
-
}
|
|
31083
|
-
|
|
31253
|
+
})
|
|
31254
|
+
);
|
|
31084
31255
|
}
|
|
31085
31256
|
function extractResponseContent(response) {
|
|
31086
31257
|
const content = [];
|
|
@@ -31223,6 +31394,13 @@ async function prepareEmbeddingCall(config, options) {
|
|
|
31223
31394
|
}
|
|
31224
31395
|
return { embeddingOptions: sapOptions, providerName };
|
|
31225
31396
|
}
|
|
31397
|
+
async function* safeIterate(iterable) {
|
|
31398
|
+
try {
|
|
31399
|
+
yield* iterable;
|
|
31400
|
+
} catch (error) {
|
|
31401
|
+
yield error instanceof Error ? error : new Error(String(error));
|
|
31402
|
+
}
|
|
31403
|
+
}
|
|
31226
31404
|
var import_provider3, import_provider_utils2, import_zod2, StreamIdGenerator;
|
|
31227
31405
|
var init_strategy_utils = __esm({
|
|
31228
31406
|
"src/strategy-utils.ts"() {
|
|
@@ -31255,7 +31433,7 @@ var VERSION;
|
|
|
31255
31433
|
var init_version = __esm({
|
|
31256
31434
|
"src/version.ts"() {
|
|
31257
31435
|
"use strict";
|
|
31258
|
-
VERSION = true ? "4.
|
|
31436
|
+
VERSION = true ? "4.6.0" : "0.0.0-test";
|
|
31259
31437
|
}
|
|
31260
31438
|
});
|
|
31261
31439
|
|
|
@@ -31490,7 +31668,7 @@ var init_base_language_model_strategy = __esm({
|
|
|
31490
31668
|
settings
|
|
31491
31669
|
);
|
|
31492
31670
|
const idGenerator = new StreamIdGenerator();
|
|
31493
|
-
const responseId = idGenerator.generateResponseId();
|
|
31671
|
+
const responseId = streamResponse.responseId ?? idGenerator.generateResponseId();
|
|
31494
31672
|
const streamWarnings = this.collectStreamWarnings(settings, commonParts.sapOptions);
|
|
31495
31673
|
const transformedStream = createStreamTransformer({
|
|
31496
31674
|
convertToAISDKError,
|
|
@@ -31499,9 +31677,12 @@ var init_base_language_model_strategy = __esm({
|
|
|
31499
31677
|
modelId: config.modelId,
|
|
31500
31678
|
options,
|
|
31501
31679
|
providerName: commonParts.providerName,
|
|
31680
|
+
responseHeaders: streamResponse.responseHeaders,
|
|
31502
31681
|
responseId,
|
|
31503
31682
|
sdkStream: streamResponse.stream,
|
|
31683
|
+
streamResponseGetCitations: streamResponse.getCitations,
|
|
31504
31684
|
streamResponseGetFinishReason: streamResponse.getFinishReason,
|
|
31685
|
+
streamResponseGetIntermediateFailures: streamResponse.getIntermediateFailures,
|
|
31505
31686
|
streamResponseGetTokenUsage: streamResponse.getTokenUsage,
|
|
31506
31687
|
url: this.getUrl(),
|
|
31507
31688
|
version: VERSION,
|
|
@@ -31511,6 +31692,9 @@ var init_base_language_model_strategy = __esm({
|
|
|
31511
31692
|
request: {
|
|
31512
31693
|
body: request
|
|
31513
31694
|
},
|
|
31695
|
+
response: {
|
|
31696
|
+
headers: streamResponse.responseHeaders
|
|
31697
|
+
},
|
|
31514
31698
|
stream: transformedStream
|
|
31515
31699
|
};
|
|
31516
31700
|
} catch (error) {
|
|
@@ -31603,6 +31787,7 @@ var init_foundation_models_language_model_strategy = __esm({
|
|
|
31603
31787
|
"src/foundation-models-language-model-strategy.ts"() {
|
|
31604
31788
|
"use strict";
|
|
31605
31789
|
init_base_language_model_strategy();
|
|
31790
|
+
init_sap_ai_error();
|
|
31606
31791
|
init_strategy_utils();
|
|
31607
31792
|
FOUNDATION_MODELS_PARAM_MAPPINGS = [
|
|
31608
31793
|
...BaseLanguageModelStrategy.COMMON_PARAM_MAPPINGS,
|
|
@@ -31650,13 +31835,16 @@ var init_foundation_models_language_model_strategy = __esm({
|
|
|
31650
31835
|
}
|
|
31651
31836
|
async executeApiCall(client, request, abortSignal) {
|
|
31652
31837
|
const response = await client.run(request, abortSignal ? { signal: abortSignal } : void 0);
|
|
31838
|
+
const headers = normalizeHeaders(response.rawResponse.headers);
|
|
31839
|
+
const completionId = response._data?.id ?? headers?.["x-request-id"];
|
|
31653
31840
|
return {
|
|
31654
31841
|
getContent: () => response.getContent(),
|
|
31655
31842
|
getFinishReason: () => response.getFinishReason(),
|
|
31656
31843
|
getTokenUsage: () => response.getTokenUsage(),
|
|
31657
31844
|
getToolCalls: () => response.getToolCalls(),
|
|
31658
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
31659
|
-
rawResponse: { headers: response.rawResponse.headers }
|
|
31845
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- SAP SDK types headers as any
|
|
31846
|
+
rawResponse: { headers: response.rawResponse.headers },
|
|
31847
|
+
responseId: completionId
|
|
31660
31848
|
};
|
|
31661
31849
|
}
|
|
31662
31850
|
async executeStreamCall(client, request, abortSignal, _settings) {
|
|
@@ -31722,6 +31910,7 @@ var init_orchestration_language_model_strategy = __esm({
|
|
|
31722
31910
|
init_base_language_model_strategy();
|
|
31723
31911
|
init_convert_to_sap_messages();
|
|
31724
31912
|
init_deep_merge();
|
|
31913
|
+
init_sap_ai_error();
|
|
31725
31914
|
init_sap_ai_provider_options();
|
|
31726
31915
|
init_strategy_utils();
|
|
31727
31916
|
RESOLVED_CONFIG_REF_KEY = "_resolvedConfigRef";
|
|
@@ -31843,6 +32032,13 @@ var init_orchestration_language_model_strategy = __esm({
|
|
|
31843
32032
|
prompt: promptConfig
|
|
31844
32033
|
}
|
|
31845
32034
|
};
|
|
32035
|
+
if (settings.fallbackModuleConfigs && settings.fallbackModuleConfigs.length > 0) {
|
|
32036
|
+
const configList = [
|
|
32037
|
+
clientConfig,
|
|
32038
|
+
...settings.fallbackModuleConfigs
|
|
32039
|
+
];
|
|
32040
|
+
return new this.ClientClass(configList, config.deploymentConfig, config.destination);
|
|
32041
|
+
}
|
|
31846
32042
|
return new this.ClientClass(clientConfig, config.deploymentConfig, config.destination);
|
|
31847
32043
|
}
|
|
31848
32044
|
async executeApiCall(client, request, abortSignal) {
|
|
@@ -31850,21 +32046,30 @@ var init_orchestration_language_model_strategy = __esm({
|
|
|
31850
32046
|
request,
|
|
31851
32047
|
abortSignal ? { signal: abortSignal } : void 0
|
|
31852
32048
|
);
|
|
32049
|
+
const completionId = response._data?.final_result?.id ?? response.getRequestId();
|
|
31853
32050
|
return {
|
|
32051
|
+
getCitations: () => response.getCitations?.(),
|
|
31854
32052
|
getContent: () => response.getContent(),
|
|
31855
32053
|
getFinishReason: () => response.getFinishReason(),
|
|
32054
|
+
getIntermediateFailures: () => response.getIntermediateFailures?.(),
|
|
31856
32055
|
getTokenUsage: () => response.getTokenUsage(),
|
|
31857
32056
|
getToolCalls: () => response.getToolCalls(),
|
|
31858
32057
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- SAP SDK types headers as any
|
|
31859
|
-
rawResponse: { headers: response.rawResponse.headers }
|
|
32058
|
+
rawResponse: { headers: response.rawResponse.headers },
|
|
32059
|
+
responseId: completionId
|
|
31860
32060
|
};
|
|
31861
32061
|
}
|
|
31862
32062
|
async executeStreamCall(client, request, abortSignal, settings) {
|
|
31863
32063
|
const sdkStreamOptions = this.buildSdkStreamOptions(settings.streamOptions);
|
|
31864
32064
|
const streamResponse = await client.stream(request, abortSignal, sdkStreamOptions);
|
|
32065
|
+
const streamCompletionId = streamResponse._data?.final_result?.id;
|
|
31865
32066
|
return {
|
|
32067
|
+
getCitations: () => streamResponse.getCitations?.(),
|
|
31866
32068
|
getFinishReason: () => streamResponse.getFinishReason(),
|
|
32069
|
+
getIntermediateFailures: () => streamResponse.getIntermediateFailures?.(),
|
|
31867
32070
|
getTokenUsage: () => streamResponse.getTokenUsage(),
|
|
32071
|
+
responseHeaders: normalizeHeaders(streamResponse.rawResponse.headers),
|
|
32072
|
+
responseId: streamCompletionId,
|
|
31868
32073
|
stream: streamResponse.stream
|
|
31869
32074
|
};
|
|
31870
32075
|
}
|
|
@@ -33025,6 +33230,6 @@ mime-types/index.js:
|
|
|
33025
33230
|
*)
|
|
33026
33231
|
|
|
33027
33232
|
axios/dist/node/axios.cjs:
|
|
33028
|
-
(*! Axios v1.13.
|
|
33233
|
+
(*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors *)
|
|
33029
33234
|
*/
|
|
33030
33235
|
//# sourceMappingURL=index-v2.cjs.map
|