@zenning/ai 6.0.29 → 6.0.31
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 +16 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +95 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -11
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -898,7 +898,7 @@ import {
|
|
|
898
898
|
} from "@zenning/provider-utils";
|
|
899
899
|
|
|
900
900
|
// src/version.ts
|
|
901
|
-
var VERSION = true ? "6.0.
|
|
901
|
+
var VERSION = true ? "6.0.31" : "0.0.0-test";
|
|
902
902
|
|
|
903
903
|
// src/util/download/download.ts
|
|
904
904
|
var download = async ({ url }) => {
|
|
@@ -4761,16 +4761,43 @@ function processUIMessageStream({
|
|
|
4761
4761
|
break;
|
|
4762
4762
|
}
|
|
4763
4763
|
case "text-delta": {
|
|
4764
|
-
|
|
4764
|
+
let textPart = state.activeTextParts[chunk.id];
|
|
4765
|
+
if (!textPart) {
|
|
4766
|
+
const existing = state.message.parts.findLast(
|
|
4767
|
+
(p) => p.type === "text" && p.state !== "done"
|
|
4768
|
+
);
|
|
4769
|
+
if (existing) {
|
|
4770
|
+
textPart = existing;
|
|
4771
|
+
} else {
|
|
4772
|
+
textPart = {
|
|
4773
|
+
type: "text",
|
|
4774
|
+
text: "",
|
|
4775
|
+
state: "streaming"
|
|
4776
|
+
};
|
|
4777
|
+
state.message.parts.push(textPart);
|
|
4778
|
+
}
|
|
4779
|
+
state.activeTextParts[chunk.id] = textPart;
|
|
4780
|
+
}
|
|
4765
4781
|
textPart.text += chunk.delta;
|
|
4766
4782
|
textPart.providerMetadata = (_a16 = chunk.providerMetadata) != null ? _a16 : textPart.providerMetadata;
|
|
4767
4783
|
write();
|
|
4768
4784
|
break;
|
|
4769
4785
|
}
|
|
4770
4786
|
case "text-end": {
|
|
4771
|
-
|
|
4772
|
-
textPart
|
|
4773
|
-
|
|
4787
|
+
let textPart = state.activeTextParts[chunk.id];
|
|
4788
|
+
if (!textPart) {
|
|
4789
|
+
const existing = state.message.parts.findLast(
|
|
4790
|
+
(p) => p.type === "text" && p.state !== "done"
|
|
4791
|
+
);
|
|
4792
|
+
if (existing) {
|
|
4793
|
+
textPart = existing;
|
|
4794
|
+
state.activeTextParts[chunk.id] = textPart;
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
if (textPart) {
|
|
4798
|
+
textPart.state = "done";
|
|
4799
|
+
textPart.providerMetadata = (_b = chunk.providerMetadata) != null ? _b : textPart.providerMetadata;
|
|
4800
|
+
}
|
|
4774
4801
|
delete state.activeTextParts[chunk.id];
|
|
4775
4802
|
write();
|
|
4776
4803
|
break;
|
|
@@ -4788,16 +4815,43 @@ function processUIMessageStream({
|
|
|
4788
4815
|
break;
|
|
4789
4816
|
}
|
|
4790
4817
|
case "reasoning-delta": {
|
|
4791
|
-
|
|
4818
|
+
let reasoningPart = state.activeReasoningParts[chunk.id];
|
|
4819
|
+
if (!reasoningPart) {
|
|
4820
|
+
const existing = state.message.parts.findLast(
|
|
4821
|
+
(p) => p.type === "reasoning" && p.state !== "done"
|
|
4822
|
+
);
|
|
4823
|
+
if (existing) {
|
|
4824
|
+
reasoningPart = existing;
|
|
4825
|
+
} else {
|
|
4826
|
+
reasoningPart = {
|
|
4827
|
+
type: "reasoning",
|
|
4828
|
+
text: "",
|
|
4829
|
+
state: "streaming"
|
|
4830
|
+
};
|
|
4831
|
+
state.message.parts.push(reasoningPart);
|
|
4832
|
+
}
|
|
4833
|
+
state.activeReasoningParts[chunk.id] = reasoningPart;
|
|
4834
|
+
}
|
|
4792
4835
|
reasoningPart.text += chunk.delta;
|
|
4793
4836
|
reasoningPart.providerMetadata = (_c = chunk.providerMetadata) != null ? _c : reasoningPart.providerMetadata;
|
|
4794
4837
|
write();
|
|
4795
4838
|
break;
|
|
4796
4839
|
}
|
|
4797
4840
|
case "reasoning-end": {
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4841
|
+
let reasoningPart = state.activeReasoningParts[chunk.id];
|
|
4842
|
+
if (!reasoningPart) {
|
|
4843
|
+
const existing = state.message.parts.findLast(
|
|
4844
|
+
(p) => p.type === "reasoning" && p.state !== "done"
|
|
4845
|
+
);
|
|
4846
|
+
if (existing) {
|
|
4847
|
+
reasoningPart = existing;
|
|
4848
|
+
state.activeReasoningParts[chunk.id] = reasoningPart;
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
if (reasoningPart) {
|
|
4852
|
+
reasoningPart.providerMetadata = (_d = chunk.providerMetadata) != null ? _d : reasoningPart.providerMetadata;
|
|
4853
|
+
reasoningPart.state = "done";
|
|
4854
|
+
}
|
|
4801
4855
|
delete state.activeReasoningParts[chunk.id];
|
|
4802
4856
|
write();
|
|
4803
4857
|
break;
|
|
@@ -4866,7 +4920,24 @@ function processUIMessageStream({
|
|
|
4866
4920
|
break;
|
|
4867
4921
|
}
|
|
4868
4922
|
case "tool-input-delta": {
|
|
4869
|
-
|
|
4923
|
+
let partialToolCall = state.partialToolCalls[chunk.toolCallId];
|
|
4924
|
+
if (!partialToolCall) {
|
|
4925
|
+
const existingPart = state.message.parts.find(
|
|
4926
|
+
(p) => isToolUIPart(p) && p.toolCallId === chunk.toolCallId
|
|
4927
|
+
);
|
|
4928
|
+
if (existingPart) {
|
|
4929
|
+
const isDynamic = existingPart.type === "dynamic-tool";
|
|
4930
|
+
partialToolCall = {
|
|
4931
|
+
text: "",
|
|
4932
|
+
toolName: getToolName(existingPart),
|
|
4933
|
+
index: state.message.parts.filter(isStaticToolUIPart).indexOf(existingPart),
|
|
4934
|
+
dynamic: isDynamic
|
|
4935
|
+
};
|
|
4936
|
+
state.partialToolCalls[chunk.toolCallId] = partialToolCall;
|
|
4937
|
+
} else {
|
|
4938
|
+
break;
|
|
4939
|
+
}
|
|
4940
|
+
}
|
|
4870
4941
|
partialToolCall.text += chunk.inputTextDelta;
|
|
4871
4942
|
const { value: partialArgs } = await parsePartialJson(
|
|
4872
4943
|
partialToolCall.text
|
|
@@ -5445,7 +5516,8 @@ function runToolsTransformation({
|
|
|
5445
5516
|
case "source":
|
|
5446
5517
|
case "response-metadata":
|
|
5447
5518
|
case "error":
|
|
5448
|
-
case "raw":
|
|
5519
|
+
case "raw":
|
|
5520
|
+
case "compaction": {
|
|
5449
5521
|
controller.enqueue(chunk);
|
|
5450
5522
|
break;
|
|
5451
5523
|
}
|
|
@@ -6512,6 +6584,10 @@ var DefaultStreamTextResult = class {
|
|
|
6512
6584
|
}
|
|
6513
6585
|
break;
|
|
6514
6586
|
}
|
|
6587
|
+
case "compaction": {
|
|
6588
|
+
controller.enqueue(chunk);
|
|
6589
|
+
break;
|
|
6590
|
+
}
|
|
6515
6591
|
default: {
|
|
6516
6592
|
const exhaustiveCheck = chunkType;
|
|
6517
6593
|
throw new Error(`Unknown chunk type: ${exhaustiveCheck}`);
|
|
@@ -7048,6 +7124,14 @@ var DefaultStreamTextResult = class {
|
|
|
7048
7124
|
case "raw": {
|
|
7049
7125
|
break;
|
|
7050
7126
|
}
|
|
7127
|
+
case "compaction": {
|
|
7128
|
+
controller.enqueue({
|
|
7129
|
+
type: "compaction",
|
|
7130
|
+
id: part.id,
|
|
7131
|
+
encrypted_content: part.encrypted_content
|
|
7132
|
+
});
|
|
7133
|
+
break;
|
|
7134
|
+
}
|
|
7051
7135
|
default: {
|
|
7052
7136
|
const exhaustiveCheck = partType;
|
|
7053
7137
|
throw new Error(`Unknown chunk type: ${exhaustiveCheck}`);
|