ai 4.1.50 → 4.1.52
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +28 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
@@ -4944,7 +4944,7 @@ var DefaultStreamTextResult = class {
|
|
4944
4944
|
let recordedStepText = "";
|
4945
4945
|
let recordedContinuationText = "";
|
4946
4946
|
let recordedFullText = "";
|
4947
|
-
|
4947
|
+
let stepReasoning = [];
|
4948
4948
|
let activeReasoningText = void 0;
|
4949
4949
|
let recordedStepSources = [];
|
4950
4950
|
const recordedSources = [];
|
@@ -5058,6 +5058,8 @@ var DefaultStreamTextResult = class {
|
|
5058
5058
|
recordedToolResults = [];
|
5059
5059
|
recordedStepText = "";
|
5060
5060
|
recordedStepSources = [];
|
5061
|
+
stepReasoning = [];
|
5062
|
+
activeReasoningText = void 0;
|
5061
5063
|
if (nextStepType !== "done") {
|
5062
5064
|
stepType = nextStepType;
|
5063
5065
|
}
|
@@ -5723,7 +5725,8 @@ var DefaultStreamTextResult = class {
|
|
5723
5725
|
// mask error messages for safety by default
|
5724
5726
|
sendUsage = true,
|
5725
5727
|
sendReasoning = false,
|
5726
|
-
sendSources = false
|
5728
|
+
sendSources = false,
|
5729
|
+
experimental_sendFinish = true
|
5727
5730
|
}) {
|
5728
5731
|
return this.fullStream.pipeThrough(
|
5729
5732
|
new TransformStream({
|
@@ -5835,15 +5838,17 @@ var DefaultStreamTextResult = class {
|
|
5835
5838
|
break;
|
5836
5839
|
}
|
5837
5840
|
case "finish": {
|
5838
|
-
|
5839
|
-
|
5840
|
-
|
5841
|
-
|
5842
|
-
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5841
|
+
if (experimental_sendFinish) {
|
5842
|
+
controller.enqueue(
|
5843
|
+
formatDataStreamPart2("finish_message", {
|
5844
|
+
finishReason: chunk.finishReason,
|
5845
|
+
usage: sendUsage ? {
|
5846
|
+
promptTokens: chunk.usage.promptTokens,
|
5847
|
+
completionTokens: chunk.usage.completionTokens
|
5848
|
+
} : void 0
|
5849
|
+
})
|
5850
|
+
);
|
5851
|
+
}
|
5847
5852
|
break;
|
5848
5853
|
}
|
5849
5854
|
default: {
|
@@ -5863,7 +5868,8 @@ var DefaultStreamTextResult = class {
|
|
5863
5868
|
getErrorMessage: getErrorMessage5,
|
5864
5869
|
sendUsage,
|
5865
5870
|
sendReasoning,
|
5866
|
-
sendSources
|
5871
|
+
sendSources,
|
5872
|
+
experimental_sendFinish
|
5867
5873
|
} = {}) {
|
5868
5874
|
writeToServerResponse({
|
5869
5875
|
response,
|
@@ -5878,7 +5884,8 @@ var DefaultStreamTextResult = class {
|
|
5878
5884
|
getErrorMessage: getErrorMessage5,
|
5879
5885
|
sendUsage,
|
5880
5886
|
sendReasoning,
|
5881
|
-
sendSources
|
5887
|
+
sendSources,
|
5888
|
+
experimental_sendFinish
|
5882
5889
|
})
|
5883
5890
|
});
|
5884
5891
|
}
|
@@ -5899,7 +5906,8 @@ var DefaultStreamTextResult = class {
|
|
5899
5906
|
getErrorMessage: options == null ? void 0 : options.getErrorMessage,
|
5900
5907
|
sendUsage: options == null ? void 0 : options.sendUsage,
|
5901
5908
|
sendReasoning: options == null ? void 0 : options.sendReasoning,
|
5902
|
-
sendSources: options == null ? void 0 : options.sendSources
|
5909
|
+
sendSources: options == null ? void 0 : options.sendSources,
|
5910
|
+
experimental_sendFinish: options == null ? void 0 : options.experimental_sendFinish
|
5903
5911
|
}).pipeThrough(new TextEncoderStream());
|
5904
5912
|
return (options == null ? void 0 : options.data) ? mergeStreams(options == null ? void 0 : options.data.stream, stream) : stream;
|
5905
5913
|
}
|
@@ -5909,7 +5917,8 @@ var DefaultStreamTextResult = class {
|
|
5909
5917
|
getErrorMessage: writer.onError,
|
5910
5918
|
sendUsage: options == null ? void 0 : options.sendUsage,
|
5911
5919
|
sendReasoning: options == null ? void 0 : options.sendReasoning,
|
5912
|
-
sendSources: options == null ? void 0 : options.sendSources
|
5920
|
+
sendSources: options == null ? void 0 : options.sendSources,
|
5921
|
+
experimental_sendFinish: options == null ? void 0 : options.experimental_sendFinish
|
5913
5922
|
})
|
5914
5923
|
);
|
5915
5924
|
}
|
@@ -5921,7 +5930,8 @@ var DefaultStreamTextResult = class {
|
|
5921
5930
|
getErrorMessage: getErrorMessage5,
|
5922
5931
|
sendUsage,
|
5923
5932
|
sendReasoning,
|
5924
|
-
sendSources
|
5933
|
+
sendSources,
|
5934
|
+
experimental_sendFinish
|
5925
5935
|
} = {}) {
|
5926
5936
|
return new Response(
|
5927
5937
|
this.toDataStream({
|
@@ -5929,7 +5939,8 @@ var DefaultStreamTextResult = class {
|
|
5929
5939
|
getErrorMessage: getErrorMessage5,
|
5930
5940
|
sendUsage,
|
5931
5941
|
sendReasoning,
|
5932
|
-
sendSources
|
5942
|
+
sendSources,
|
5943
|
+
experimental_sendFinish
|
5933
5944
|
}),
|
5934
5945
|
{
|
5935
5946
|
status,
|