@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- compaction chunks
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @zenning/provider@3.0.6
|
|
10
|
+
- @zenning/gateway@3.0.13
|
|
11
|
+
- @zenning/provider-utils@4.0.8
|
|
12
|
+
|
|
13
|
+
## 6.0.30
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- active
|
|
18
|
+
|
|
3
19
|
## 6.0.29
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -2514,6 +2514,11 @@ type TextStreamPart<TOOLS extends ToolSet> = {
|
|
|
2514
2514
|
} | {
|
|
2515
2515
|
type: 'raw';
|
|
2516
2516
|
rawValue: unknown;
|
|
2517
|
+
} | {
|
|
2518
|
+
type: 'compaction';
|
|
2519
|
+
id: string;
|
|
2520
|
+
encrypted_content: string;
|
|
2521
|
+
providerMetadata?: ProviderMetadata;
|
|
2517
2522
|
};
|
|
2518
2523
|
|
|
2519
2524
|
/**
|
|
@@ -4029,6 +4034,11 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
4029
4034
|
} | {
|
|
4030
4035
|
type: 'raw';
|
|
4031
4036
|
rawValue: unknown;
|
|
4037
|
+
} | {
|
|
4038
|
+
type: 'compaction';
|
|
4039
|
+
id: string;
|
|
4040
|
+
encrypted_content: string;
|
|
4041
|
+
providerMetadata?: ProviderMetadata;
|
|
4032
4042
|
};
|
|
4033
4043
|
|
|
4034
4044
|
declare const symbol$b: unique symbol;
|
package/dist/index.d.ts
CHANGED
|
@@ -2514,6 +2514,11 @@ type TextStreamPart<TOOLS extends ToolSet> = {
|
|
|
2514
2514
|
} | {
|
|
2515
2515
|
type: 'raw';
|
|
2516
2516
|
rawValue: unknown;
|
|
2517
|
+
} | {
|
|
2518
|
+
type: 'compaction';
|
|
2519
|
+
id: string;
|
|
2520
|
+
encrypted_content: string;
|
|
2521
|
+
providerMetadata?: ProviderMetadata;
|
|
2517
2522
|
};
|
|
2518
2523
|
|
|
2519
2524
|
/**
|
|
@@ -4029,6 +4034,11 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
4029
4034
|
} | {
|
|
4030
4035
|
type: 'raw';
|
|
4031
4036
|
rawValue: unknown;
|
|
4037
|
+
} | {
|
|
4038
|
+
type: 'compaction';
|
|
4039
|
+
id: string;
|
|
4040
|
+
encrypted_content: string;
|
|
4041
|
+
providerMetadata?: ProviderMetadata;
|
|
4032
4042
|
};
|
|
4033
4043
|
|
|
4034
4044
|
declare const symbol$b: unique symbol;
|
package/dist/index.js
CHANGED
|
@@ -1001,7 +1001,7 @@ var import_provider_utils3 = require("@zenning/provider-utils");
|
|
|
1001
1001
|
var import_provider_utils4 = require("@zenning/provider-utils");
|
|
1002
1002
|
|
|
1003
1003
|
// src/version.ts
|
|
1004
|
-
var VERSION = true ? "6.0.
|
|
1004
|
+
var VERSION = true ? "6.0.31" : "0.0.0-test";
|
|
1005
1005
|
|
|
1006
1006
|
// src/util/download/download.ts
|
|
1007
1007
|
var download = async ({ url }) => {
|
|
@@ -4839,16 +4839,43 @@ function processUIMessageStream({
|
|
|
4839
4839
|
break;
|
|
4840
4840
|
}
|
|
4841
4841
|
case "text-delta": {
|
|
4842
|
-
|
|
4842
|
+
let textPart = state.activeTextParts[chunk.id];
|
|
4843
|
+
if (!textPart) {
|
|
4844
|
+
const existing = state.message.parts.findLast(
|
|
4845
|
+
(p) => p.type === "text" && p.state !== "done"
|
|
4846
|
+
);
|
|
4847
|
+
if (existing) {
|
|
4848
|
+
textPart = existing;
|
|
4849
|
+
} else {
|
|
4850
|
+
textPart = {
|
|
4851
|
+
type: "text",
|
|
4852
|
+
text: "",
|
|
4853
|
+
state: "streaming"
|
|
4854
|
+
};
|
|
4855
|
+
state.message.parts.push(textPart);
|
|
4856
|
+
}
|
|
4857
|
+
state.activeTextParts[chunk.id] = textPart;
|
|
4858
|
+
}
|
|
4843
4859
|
textPart.text += chunk.delta;
|
|
4844
4860
|
textPart.providerMetadata = (_a16 = chunk.providerMetadata) != null ? _a16 : textPart.providerMetadata;
|
|
4845
4861
|
write();
|
|
4846
4862
|
break;
|
|
4847
4863
|
}
|
|
4848
4864
|
case "text-end": {
|
|
4849
|
-
|
|
4850
|
-
textPart
|
|
4851
|
-
|
|
4865
|
+
let textPart = state.activeTextParts[chunk.id];
|
|
4866
|
+
if (!textPart) {
|
|
4867
|
+
const existing = state.message.parts.findLast(
|
|
4868
|
+
(p) => p.type === "text" && p.state !== "done"
|
|
4869
|
+
);
|
|
4870
|
+
if (existing) {
|
|
4871
|
+
textPart = existing;
|
|
4872
|
+
state.activeTextParts[chunk.id] = textPart;
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
4875
|
+
if (textPart) {
|
|
4876
|
+
textPart.state = "done";
|
|
4877
|
+
textPart.providerMetadata = (_b = chunk.providerMetadata) != null ? _b : textPart.providerMetadata;
|
|
4878
|
+
}
|
|
4852
4879
|
delete state.activeTextParts[chunk.id];
|
|
4853
4880
|
write();
|
|
4854
4881
|
break;
|
|
@@ -4866,16 +4893,43 @@ function processUIMessageStream({
|
|
|
4866
4893
|
break;
|
|
4867
4894
|
}
|
|
4868
4895
|
case "reasoning-delta": {
|
|
4869
|
-
|
|
4896
|
+
let reasoningPart = state.activeReasoningParts[chunk.id];
|
|
4897
|
+
if (!reasoningPart) {
|
|
4898
|
+
const existing = state.message.parts.findLast(
|
|
4899
|
+
(p) => p.type === "reasoning" && p.state !== "done"
|
|
4900
|
+
);
|
|
4901
|
+
if (existing) {
|
|
4902
|
+
reasoningPart = existing;
|
|
4903
|
+
} else {
|
|
4904
|
+
reasoningPart = {
|
|
4905
|
+
type: "reasoning",
|
|
4906
|
+
text: "",
|
|
4907
|
+
state: "streaming"
|
|
4908
|
+
};
|
|
4909
|
+
state.message.parts.push(reasoningPart);
|
|
4910
|
+
}
|
|
4911
|
+
state.activeReasoningParts[chunk.id] = reasoningPart;
|
|
4912
|
+
}
|
|
4870
4913
|
reasoningPart.text += chunk.delta;
|
|
4871
4914
|
reasoningPart.providerMetadata = (_c = chunk.providerMetadata) != null ? _c : reasoningPart.providerMetadata;
|
|
4872
4915
|
write();
|
|
4873
4916
|
break;
|
|
4874
4917
|
}
|
|
4875
4918
|
case "reasoning-end": {
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4919
|
+
let reasoningPart = state.activeReasoningParts[chunk.id];
|
|
4920
|
+
if (!reasoningPart) {
|
|
4921
|
+
const existing = state.message.parts.findLast(
|
|
4922
|
+
(p) => p.type === "reasoning" && p.state !== "done"
|
|
4923
|
+
);
|
|
4924
|
+
if (existing) {
|
|
4925
|
+
reasoningPart = existing;
|
|
4926
|
+
state.activeReasoningParts[chunk.id] = reasoningPart;
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
if (reasoningPart) {
|
|
4930
|
+
reasoningPart.providerMetadata = (_d = chunk.providerMetadata) != null ? _d : reasoningPart.providerMetadata;
|
|
4931
|
+
reasoningPart.state = "done";
|
|
4932
|
+
}
|
|
4879
4933
|
delete state.activeReasoningParts[chunk.id];
|
|
4880
4934
|
write();
|
|
4881
4935
|
break;
|
|
@@ -4944,7 +4998,24 @@ function processUIMessageStream({
|
|
|
4944
4998
|
break;
|
|
4945
4999
|
}
|
|
4946
5000
|
case "tool-input-delta": {
|
|
4947
|
-
|
|
5001
|
+
let partialToolCall = state.partialToolCalls[chunk.toolCallId];
|
|
5002
|
+
if (!partialToolCall) {
|
|
5003
|
+
const existingPart = state.message.parts.find(
|
|
5004
|
+
(p) => isToolUIPart(p) && p.toolCallId === chunk.toolCallId
|
|
5005
|
+
);
|
|
5006
|
+
if (existingPart) {
|
|
5007
|
+
const isDynamic = existingPart.type === "dynamic-tool";
|
|
5008
|
+
partialToolCall = {
|
|
5009
|
+
text: "",
|
|
5010
|
+
toolName: getToolName(existingPart),
|
|
5011
|
+
index: state.message.parts.filter(isStaticToolUIPart).indexOf(existingPart),
|
|
5012
|
+
dynamic: isDynamic
|
|
5013
|
+
};
|
|
5014
|
+
state.partialToolCalls[chunk.toolCallId] = partialToolCall;
|
|
5015
|
+
} else {
|
|
5016
|
+
break;
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
4948
5019
|
partialToolCall.text += chunk.inputTextDelta;
|
|
4949
5020
|
const { value: partialArgs } = await parsePartialJson(
|
|
4950
5021
|
partialToolCall.text
|
|
@@ -5521,7 +5592,8 @@ function runToolsTransformation({
|
|
|
5521
5592
|
case "source":
|
|
5522
5593
|
case "response-metadata":
|
|
5523
5594
|
case "error":
|
|
5524
|
-
case "raw":
|
|
5595
|
+
case "raw":
|
|
5596
|
+
case "compaction": {
|
|
5525
5597
|
controller.enqueue(chunk);
|
|
5526
5598
|
break;
|
|
5527
5599
|
}
|
|
@@ -6588,6 +6660,10 @@ var DefaultStreamTextResult = class {
|
|
|
6588
6660
|
}
|
|
6589
6661
|
break;
|
|
6590
6662
|
}
|
|
6663
|
+
case "compaction": {
|
|
6664
|
+
controller.enqueue(chunk);
|
|
6665
|
+
break;
|
|
6666
|
+
}
|
|
6591
6667
|
default: {
|
|
6592
6668
|
const exhaustiveCheck = chunkType;
|
|
6593
6669
|
throw new Error(`Unknown chunk type: ${exhaustiveCheck}`);
|
|
@@ -7124,6 +7200,14 @@ var DefaultStreamTextResult = class {
|
|
|
7124
7200
|
case "raw": {
|
|
7125
7201
|
break;
|
|
7126
7202
|
}
|
|
7203
|
+
case "compaction": {
|
|
7204
|
+
controller.enqueue({
|
|
7205
|
+
type: "compaction",
|
|
7206
|
+
id: part.id,
|
|
7207
|
+
encrypted_content: part.encrypted_content
|
|
7208
|
+
});
|
|
7209
|
+
break;
|
|
7210
|
+
}
|
|
7127
7211
|
default: {
|
|
7128
7212
|
const exhaustiveCheck = partType;
|
|
7129
7213
|
throw new Error(`Unknown chunk type: ${exhaustiveCheck}`);
|