ai 3.1.30 → 3.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -563
- package/dist/index.d.ts +4 -563
- package/dist/index.js +31 -508
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -496
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -34
- package/prompts/dist/index.d.mts +2 -129
- package/prompts/dist/index.d.ts +2 -129
- package/prompts/dist/index.js.map +1 -1
- package/prompts/dist/index.mjs.map +1 -1
- package/react/dist/index.d.mts +9 -648
- package/react/dist/index.d.ts +9 -648
- package/react/dist/index.js +4 -1441
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +9 -1429
- package/react/dist/index.mjs.map +1 -1
- package/rsc/dist/rsc-server.mjs +44 -298
- package/rsc/dist/rsc-server.mjs.map +1 -1
- package/rsc/dist/rsc-shared.d.mts +5 -1
- package/rsc/dist/rsc-shared.mjs +69 -44
- package/rsc/dist/rsc-shared.mjs.map +1 -1
- package/solid/dist/index.d.mts +7 -465
- package/solid/dist/index.d.ts +7 -465
- package/solid/dist/index.js +3 -1057
- package/solid/dist/index.js.map +1 -1
- package/solid/dist/index.mjs +7 -1056
- package/solid/dist/index.mjs.map +1 -1
- package/svelte/dist/index.d.mts +12 -422
- package/svelte/dist/index.d.ts +12 -422
- package/svelte/dist/index.js +12 -768
- package/svelte/dist/index.js.map +1 -1
- package/svelte/dist/index.mjs +10 -762
- package/svelte/dist/index.mjs.map +1 -1
- package/vue/dist/index.d.mts +7 -459
- package/vue/dist/index.d.ts +7 -459
- package/vue/dist/index.js +3 -1057
- package/vue/dist/index.js.map +1 -1
- package/vue/dist/index.mjs +7 -1046
- package/vue/dist/index.mjs.map +1 -1
package/rsc/dist/rsc-server.mjs
CHANGED
@@ -3,8 +3,6 @@ import { AsyncLocalStorage } from "async_hooks";
|
|
3
3
|
import * as jsondiffpatch from "jsondiffpatch";
|
4
4
|
|
5
5
|
// rsc/utils.tsx
|
6
|
-
import { Suspense } from "react";
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
8
6
|
function createResolvablePromise() {
|
9
7
|
let resolve, reject;
|
10
8
|
const promise = new Promise((res, rej) => {
|
@@ -17,34 +15,6 @@ function createResolvablePromise() {
|
|
17
15
|
reject
|
18
16
|
};
|
19
17
|
}
|
20
|
-
var R = [
|
21
|
-
async ({
|
22
|
-
c,
|
23
|
-
// current
|
24
|
-
n
|
25
|
-
// next
|
26
|
-
}) => {
|
27
|
-
const chunk = await n;
|
28
|
-
if (chunk.done) {
|
29
|
-
return chunk.value;
|
30
|
-
}
|
31
|
-
if (chunk.append) {
|
32
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
33
|
-
c,
|
34
|
-
/* @__PURE__ */ jsx(Suspense, { fallback: chunk.value, children: /* @__PURE__ */ jsx(R, { c: chunk.value, n: chunk.next }) })
|
35
|
-
] });
|
36
|
-
}
|
37
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: chunk.value, children: /* @__PURE__ */ jsx(R, { c: chunk.value, n: chunk.next }) });
|
38
|
-
}
|
39
|
-
][0];
|
40
|
-
function createSuspensedChunk(initialValue) {
|
41
|
-
const { promise, resolve, reject } = createResolvablePromise();
|
42
|
-
return {
|
43
|
-
row: /* @__PURE__ */ jsx(Suspense, { fallback: initialValue, children: /* @__PURE__ */ jsx(R, { c: initialValue, n: promise }) }),
|
44
|
-
resolve,
|
45
|
-
reject
|
46
|
-
};
|
47
|
-
}
|
48
18
|
var isFunction = (x) => typeof x === "function";
|
49
19
|
var consumeStream = async (stream) => {
|
50
20
|
const reader = stream.getReader();
|
@@ -175,6 +145,7 @@ function getMutableAIState(...args) {
|
|
175
145
|
}
|
176
146
|
|
177
147
|
// rsc/streamable.tsx
|
148
|
+
import { isValidElement } from "react";
|
178
149
|
import zodToJsonSchema2 from "zod-to-json-schema";
|
179
150
|
|
180
151
|
// core/util/retry-with-exponential-backoff.ts
|
@@ -537,238 +508,6 @@ function prepareToolsAndToolChoice({
|
|
537
508
|
};
|
538
509
|
}
|
539
510
|
|
540
|
-
// shared/stream-parts.ts
|
541
|
-
var textStreamPart = {
|
542
|
-
code: "0",
|
543
|
-
name: "text",
|
544
|
-
parse: (value) => {
|
545
|
-
if (typeof value !== "string") {
|
546
|
-
throw new Error('"text" parts expect a string value.');
|
547
|
-
}
|
548
|
-
return { type: "text", value };
|
549
|
-
}
|
550
|
-
};
|
551
|
-
var functionCallStreamPart = {
|
552
|
-
code: "1",
|
553
|
-
name: "function_call",
|
554
|
-
parse: (value) => {
|
555
|
-
if (value == null || typeof value !== "object" || !("function_call" in value) || typeof value.function_call !== "object" || value.function_call == null || !("name" in value.function_call) || !("arguments" in value.function_call) || typeof value.function_call.name !== "string" || typeof value.function_call.arguments !== "string") {
|
556
|
-
throw new Error(
|
557
|
-
'"function_call" parts expect an object with a "function_call" property.'
|
558
|
-
);
|
559
|
-
}
|
560
|
-
return {
|
561
|
-
type: "function_call",
|
562
|
-
value
|
563
|
-
};
|
564
|
-
}
|
565
|
-
};
|
566
|
-
var dataStreamPart = {
|
567
|
-
code: "2",
|
568
|
-
name: "data",
|
569
|
-
parse: (value) => {
|
570
|
-
if (!Array.isArray(value)) {
|
571
|
-
throw new Error('"data" parts expect an array value.');
|
572
|
-
}
|
573
|
-
return { type: "data", value };
|
574
|
-
}
|
575
|
-
};
|
576
|
-
var errorStreamPart = {
|
577
|
-
code: "3",
|
578
|
-
name: "error",
|
579
|
-
parse: (value) => {
|
580
|
-
if (typeof value !== "string") {
|
581
|
-
throw new Error('"error" parts expect a string value.');
|
582
|
-
}
|
583
|
-
return { type: "error", value };
|
584
|
-
}
|
585
|
-
};
|
586
|
-
var assistantMessageStreamPart = {
|
587
|
-
code: "4",
|
588
|
-
name: "assistant_message",
|
589
|
-
parse: (value) => {
|
590
|
-
if (value == null || typeof value !== "object" || !("id" in value) || !("role" in value) || !("content" in value) || typeof value.id !== "string" || typeof value.role !== "string" || value.role !== "assistant" || !Array.isArray(value.content) || !value.content.every(
|
591
|
-
(item) => item != null && typeof item === "object" && "type" in item && item.type === "text" && "text" in item && item.text != null && typeof item.text === "object" && "value" in item.text && typeof item.text.value === "string"
|
592
|
-
)) {
|
593
|
-
throw new Error(
|
594
|
-
'"assistant_message" parts expect an object with an "id", "role", and "content" property.'
|
595
|
-
);
|
596
|
-
}
|
597
|
-
return {
|
598
|
-
type: "assistant_message",
|
599
|
-
value
|
600
|
-
};
|
601
|
-
}
|
602
|
-
};
|
603
|
-
var assistantControlDataStreamPart = {
|
604
|
-
code: "5",
|
605
|
-
name: "assistant_control_data",
|
606
|
-
parse: (value) => {
|
607
|
-
if (value == null || typeof value !== "object" || !("threadId" in value) || !("messageId" in value) || typeof value.threadId !== "string" || typeof value.messageId !== "string") {
|
608
|
-
throw new Error(
|
609
|
-
'"assistant_control_data" parts expect an object with a "threadId" and "messageId" property.'
|
610
|
-
);
|
611
|
-
}
|
612
|
-
return {
|
613
|
-
type: "assistant_control_data",
|
614
|
-
value: {
|
615
|
-
threadId: value.threadId,
|
616
|
-
messageId: value.messageId
|
617
|
-
}
|
618
|
-
};
|
619
|
-
}
|
620
|
-
};
|
621
|
-
var dataMessageStreamPart = {
|
622
|
-
code: "6",
|
623
|
-
name: "data_message",
|
624
|
-
parse: (value) => {
|
625
|
-
if (value == null || typeof value !== "object" || !("role" in value) || !("data" in value) || typeof value.role !== "string" || value.role !== "data") {
|
626
|
-
throw new Error(
|
627
|
-
'"data_message" parts expect an object with a "role" and "data" property.'
|
628
|
-
);
|
629
|
-
}
|
630
|
-
return {
|
631
|
-
type: "data_message",
|
632
|
-
value
|
633
|
-
};
|
634
|
-
}
|
635
|
-
};
|
636
|
-
var toolCallsStreamPart = {
|
637
|
-
code: "7",
|
638
|
-
name: "tool_calls",
|
639
|
-
parse: (value) => {
|
640
|
-
if (value == null || typeof value !== "object" || !("tool_calls" in value) || typeof value.tool_calls !== "object" || value.tool_calls == null || !Array.isArray(value.tool_calls) || value.tool_calls.some(
|
641
|
-
(tc) => tc == null || typeof tc !== "object" || !("id" in tc) || typeof tc.id !== "string" || !("type" in tc) || typeof tc.type !== "string" || !("function" in tc) || tc.function == null || typeof tc.function !== "object" || !("arguments" in tc.function) || typeof tc.function.name !== "string" || typeof tc.function.arguments !== "string"
|
642
|
-
)) {
|
643
|
-
throw new Error(
|
644
|
-
'"tool_calls" parts expect an object with a ToolCallPayload.'
|
645
|
-
);
|
646
|
-
}
|
647
|
-
return {
|
648
|
-
type: "tool_calls",
|
649
|
-
value
|
650
|
-
};
|
651
|
-
}
|
652
|
-
};
|
653
|
-
var messageAnnotationsStreamPart = {
|
654
|
-
code: "8",
|
655
|
-
name: "message_annotations",
|
656
|
-
parse: (value) => {
|
657
|
-
if (!Array.isArray(value)) {
|
658
|
-
throw new Error('"message_annotations" parts expect an array value.');
|
659
|
-
}
|
660
|
-
return { type: "message_annotations", value };
|
661
|
-
}
|
662
|
-
};
|
663
|
-
var toolCallStreamPart = {
|
664
|
-
code: "9",
|
665
|
-
name: "tool_call",
|
666
|
-
parse: (value) => {
|
667
|
-
if (value == null || typeof value !== "object" || !("toolCallId" in value) || typeof value.toolCallId !== "string" || !("toolName" in value) || typeof value.toolName !== "string" || !("args" in value) || typeof value.args !== "object") {
|
668
|
-
throw new Error(
|
669
|
-
'"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.'
|
670
|
-
);
|
671
|
-
}
|
672
|
-
return {
|
673
|
-
type: "tool_call",
|
674
|
-
value
|
675
|
-
};
|
676
|
-
}
|
677
|
-
};
|
678
|
-
var toolResultStreamPart = {
|
679
|
-
code: "a",
|
680
|
-
name: "tool_result",
|
681
|
-
parse: (value) => {
|
682
|
-
if (value == null || typeof value !== "object" || !("toolCallId" in value) || typeof value.toolCallId !== "string" || !("toolName" in value) || typeof value.toolName !== "string" || !("args" in value) || typeof value.args !== "object" || !("result" in value)) {
|
683
|
-
throw new Error(
|
684
|
-
'"tool_result" parts expect an object with a "toolCallId", "toolName", "args", and "result" property.'
|
685
|
-
);
|
686
|
-
}
|
687
|
-
return {
|
688
|
-
type: "tool_result",
|
689
|
-
value
|
690
|
-
};
|
691
|
-
}
|
692
|
-
};
|
693
|
-
var streamParts = [
|
694
|
-
textStreamPart,
|
695
|
-
functionCallStreamPart,
|
696
|
-
dataStreamPart,
|
697
|
-
errorStreamPart,
|
698
|
-
assistantMessageStreamPart,
|
699
|
-
assistantControlDataStreamPart,
|
700
|
-
dataMessageStreamPart,
|
701
|
-
toolCallsStreamPart,
|
702
|
-
messageAnnotationsStreamPart,
|
703
|
-
toolCallStreamPart,
|
704
|
-
toolResultStreamPart
|
705
|
-
];
|
706
|
-
var streamPartsByCode = {
|
707
|
-
[textStreamPart.code]: textStreamPart,
|
708
|
-
[functionCallStreamPart.code]: functionCallStreamPart,
|
709
|
-
[dataStreamPart.code]: dataStreamPart,
|
710
|
-
[errorStreamPart.code]: errorStreamPart,
|
711
|
-
[assistantMessageStreamPart.code]: assistantMessageStreamPart,
|
712
|
-
[assistantControlDataStreamPart.code]: assistantControlDataStreamPart,
|
713
|
-
[dataMessageStreamPart.code]: dataMessageStreamPart,
|
714
|
-
[toolCallsStreamPart.code]: toolCallsStreamPart,
|
715
|
-
[messageAnnotationsStreamPart.code]: messageAnnotationsStreamPart,
|
716
|
-
[toolCallStreamPart.code]: toolCallStreamPart,
|
717
|
-
[toolResultStreamPart.code]: toolResultStreamPart
|
718
|
-
};
|
719
|
-
var StreamStringPrefixes = {
|
720
|
-
[textStreamPart.name]: textStreamPart.code,
|
721
|
-
[functionCallStreamPart.name]: functionCallStreamPart.code,
|
722
|
-
[dataStreamPart.name]: dataStreamPart.code,
|
723
|
-
[errorStreamPart.name]: errorStreamPart.code,
|
724
|
-
[assistantMessageStreamPart.name]: assistantMessageStreamPart.code,
|
725
|
-
[assistantControlDataStreamPart.name]: assistantControlDataStreamPart.code,
|
726
|
-
[dataMessageStreamPart.name]: dataMessageStreamPart.code,
|
727
|
-
[toolCallsStreamPart.name]: toolCallsStreamPart.code,
|
728
|
-
[messageAnnotationsStreamPart.name]: messageAnnotationsStreamPart.code,
|
729
|
-
[toolCallStreamPart.name]: toolCallStreamPart.code,
|
730
|
-
[toolResultStreamPart.name]: toolResultStreamPart.code
|
731
|
-
};
|
732
|
-
var validCodes = streamParts.map((part) => part.code);
|
733
|
-
var parseStreamPart = (line) => {
|
734
|
-
const firstSeparatorIndex = line.indexOf(":");
|
735
|
-
if (firstSeparatorIndex === -1) {
|
736
|
-
throw new Error("Failed to parse stream string. No separator found.");
|
737
|
-
}
|
738
|
-
const prefix = line.slice(0, firstSeparatorIndex);
|
739
|
-
if (!validCodes.includes(prefix)) {
|
740
|
-
throw new Error(`Failed to parse stream string. Invalid code ${prefix}.`);
|
741
|
-
}
|
742
|
-
const code = prefix;
|
743
|
-
const textValue = line.slice(firstSeparatorIndex + 1);
|
744
|
-
const jsonValue = JSON.parse(textValue);
|
745
|
-
return streamPartsByCode[code].parse(jsonValue);
|
746
|
-
};
|
747
|
-
function formatStreamPart(type, value) {
|
748
|
-
const streamPart = streamParts.find((part) => part.name === type);
|
749
|
-
if (!streamPart) {
|
750
|
-
throw new Error(`Invalid stream part type: ${type}`);
|
751
|
-
}
|
752
|
-
return `${streamPart.code}:${JSON.stringify(value)}
|
753
|
-
`;
|
754
|
-
}
|
755
|
-
|
756
|
-
// shared/utils.ts
|
757
|
-
function createChunkDecoder(complex) {
|
758
|
-
const decoder = new TextDecoder();
|
759
|
-
if (!complex) {
|
760
|
-
return function(chunk) {
|
761
|
-
if (!chunk)
|
762
|
-
return "";
|
763
|
-
return decoder.decode(chunk, { stream: true });
|
764
|
-
};
|
765
|
-
}
|
766
|
-
return function(chunk) {
|
767
|
-
const decoded = decoder.decode(chunk, { stream: true }).split("\n").filter((line) => line !== "");
|
768
|
-
return decoded.map(parseStreamPart).filter(Boolean);
|
769
|
-
};
|
770
|
-
}
|
771
|
-
|
772
511
|
// streams/ai-stream.ts
|
773
512
|
import {
|
774
513
|
createParser
|
@@ -894,6 +633,7 @@ function readableFromAsyncIterable(iterable) {
|
|
894
633
|
}
|
895
634
|
|
896
635
|
// streams/stream-data.ts
|
636
|
+
import { formatStreamPart } from "@ai-sdk/ui-utils";
|
897
637
|
function createStreamDataTransformer() {
|
898
638
|
const encoder = new TextEncoder();
|
899
639
|
const decoder = new TextDecoder();
|
@@ -906,6 +646,10 @@ function createStreamDataTransformer() {
|
|
906
646
|
}
|
907
647
|
|
908
648
|
// streams/openai-stream.ts
|
649
|
+
import {
|
650
|
+
createChunkDecoder,
|
651
|
+
formatStreamPart as formatStreamPart2
|
652
|
+
} from "@ai-sdk/ui-utils";
|
909
653
|
function parseOpenAIStream() {
|
910
654
|
const extract = chunkToText();
|
911
655
|
return (data) => extract(JSON.parse(data));
|
@@ -1070,7 +814,7 @@ function createFunctionCallTransformer(callbacks) {
|
|
1070
814
|
}
|
1071
815
|
if (!isFunctionStreamingIn) {
|
1072
816
|
controller.enqueue(
|
1073
|
-
textEncoder.encode(
|
817
|
+
textEncoder.encode(formatStreamPart2("text", message))
|
1074
818
|
);
|
1075
819
|
return;
|
1076
820
|
} else {
|
@@ -1181,7 +925,7 @@ function createFunctionCallTransformer(callbacks) {
|
|
1181
925
|
if (!functionResponse) {
|
1182
926
|
controller.enqueue(
|
1183
927
|
textEncoder.encode(
|
1184
|
-
|
928
|
+
formatStreamPart2(
|
1185
929
|
payload.function_call ? "function_call" : "tool_calls",
|
1186
930
|
// parse to prevent double-encoding:
|
1187
931
|
JSON.parse(aggregatedResponse)
|
@@ -1191,7 +935,7 @@ function createFunctionCallTransformer(callbacks) {
|
|
1191
935
|
return;
|
1192
936
|
} else if (typeof functionResponse === "string") {
|
1193
937
|
controller.enqueue(
|
1194
|
-
textEncoder.encode(
|
938
|
+
textEncoder.encode(formatStreamPart2("text", functionResponse))
|
1195
939
|
);
|
1196
940
|
aggregatedFinalCompletionResponse = functionResponse;
|
1197
941
|
return;
|
@@ -1228,10 +972,11 @@ var STREAMABLE_VALUE_TYPE = Symbol.for("ui.streamable.value");
|
|
1228
972
|
var DEV_DEFAULT_STREAMABLE_WARNING_TIME = 15 * 1e3;
|
1229
973
|
|
1230
974
|
// rsc/streamable.tsx
|
975
|
+
import { InternalStreamableUIClient } from "./rsc-shared.mjs";
|
976
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
1231
977
|
function createStreamableUI(initialValue) {
|
1232
|
-
|
978
|
+
const innerStreamable = createStreamableValue(initialValue);
|
1233
979
|
let closed = false;
|
1234
|
-
let { row, resolve, reject } = createSuspensedChunk(initialValue);
|
1235
980
|
function assertStream(method) {
|
1236
981
|
if (closed) {
|
1237
982
|
throw new Error(method + ": UI stream is already closed.");
|
@@ -1252,28 +997,16 @@ function createStreamableUI(initialValue) {
|
|
1252
997
|
}
|
1253
998
|
warnUnclosedStream();
|
1254
999
|
const streamable2 = {
|
1255
|
-
value:
|
1000
|
+
value: /* @__PURE__ */ jsx(InternalStreamableUIClient, { s: innerStreamable.value }),
|
1256
1001
|
update(value) {
|
1257
1002
|
assertStream(".update()");
|
1258
|
-
|
1259
|
-
warnUnclosedStream();
|
1260
|
-
return streamable2;
|
1261
|
-
}
|
1262
|
-
const resolvable = createResolvablePromise();
|
1263
|
-
currentValue = value;
|
1264
|
-
resolve({ value: currentValue, done: false, next: resolvable.promise });
|
1265
|
-
resolve = resolvable.resolve;
|
1266
|
-
reject = resolvable.reject;
|
1003
|
+
innerStreamable.update(value);
|
1267
1004
|
warnUnclosedStream();
|
1268
1005
|
return streamable2;
|
1269
1006
|
},
|
1270
1007
|
append(value) {
|
1271
1008
|
assertStream(".append()");
|
1272
|
-
|
1273
|
-
currentValue = value;
|
1274
|
-
resolve({ value, done: false, append: true, next: resolvable.promise });
|
1275
|
-
resolve = resolvable.resolve;
|
1276
|
-
reject = resolvable.reject;
|
1009
|
+
innerStreamable.append(value);
|
1277
1010
|
warnUnclosedStream();
|
1278
1011
|
return streamable2;
|
1279
1012
|
},
|
@@ -1283,7 +1016,7 @@ function createStreamableUI(initialValue) {
|
|
1283
1016
|
clearTimeout(warningTimeout);
|
1284
1017
|
}
|
1285
1018
|
closed = true;
|
1286
|
-
|
1019
|
+
innerStreamable.error(error);
|
1287
1020
|
return streamable2;
|
1288
1021
|
},
|
1289
1022
|
done(...args) {
|
@@ -1293,10 +1026,10 @@ function createStreamableUI(initialValue) {
|
|
1293
1026
|
}
|
1294
1027
|
closed = true;
|
1295
1028
|
if (args.length) {
|
1296
|
-
|
1029
|
+
innerStreamable.done(args[0]);
|
1297
1030
|
return streamable2;
|
1298
1031
|
}
|
1299
|
-
|
1032
|
+
innerStreamable.done();
|
1300
1033
|
return streamable2;
|
1301
1034
|
}
|
1302
1035
|
};
|
@@ -1416,25 +1149,38 @@ function createStreamableValueImpl(initialValue) {
|
|
1416
1149
|
},
|
1417
1150
|
append(value) {
|
1418
1151
|
assertStream(".append()");
|
1419
|
-
if (typeof
|
1152
|
+
if (typeof value !== "string" && !isValidElement(value)) {
|
1420
1153
|
throw new Error(
|
1421
|
-
`.append(): The
|
1154
|
+
`.append(): The value type can't be appended to the stream. Received: ${typeof value}`
|
1422
1155
|
);
|
1423
1156
|
}
|
1424
|
-
if (typeof
|
1157
|
+
if (typeof currentValue === "undefined") {
|
1158
|
+
currentPatchValue = void 0;
|
1159
|
+
currentValue = value;
|
1160
|
+
} else if (typeof currentValue === "string") {
|
1161
|
+
if (typeof value === "string") {
|
1162
|
+
currentPatchValue = [0, value];
|
1163
|
+
currentValue = currentValue + value;
|
1164
|
+
} else {
|
1165
|
+
currentPatchValue = [1, value];
|
1166
|
+
currentValue = /* @__PURE__ */ jsxs(Fragment, { children: [
|
1167
|
+
currentValue,
|
1168
|
+
value
|
1169
|
+
] });
|
1170
|
+
}
|
1171
|
+
} else if (isValidElement(currentValue)) {
|
1172
|
+
currentPatchValue = [1, value];
|
1173
|
+
currentValue = /* @__PURE__ */ jsxs(Fragment, { children: [
|
1174
|
+
currentValue,
|
1175
|
+
value
|
1176
|
+
] });
|
1177
|
+
} else {
|
1425
1178
|
throw new Error(
|
1426
|
-
`.append(): The value
|
1179
|
+
`.append(): The current value doesn't support appending data. Type: ${typeof currentValue}`
|
1427
1180
|
);
|
1428
1181
|
}
|
1429
1182
|
const resolvePrevious = resolvable.resolve;
|
1430
1183
|
resolvable = createResolvablePromise();
|
1431
|
-
if (typeof currentValue === "string") {
|
1432
|
-
currentPatchValue = [0, value];
|
1433
|
-
currentValue = currentValue + value;
|
1434
|
-
} else {
|
1435
|
-
currentPatchValue = void 0;
|
1436
|
-
currentValue = value;
|
1437
|
-
}
|
1438
1184
|
currentPromise = resolvable.promise;
|
1439
1185
|
resolvePrevious(createWrapped());
|
1440
1186
|
warnUnclosedStream();
|
@@ -1800,7 +1546,7 @@ async function streamUI({
|
|
1800
1546
|
}
|
1801
1547
|
|
1802
1548
|
// rsc/provider.tsx
|
1803
|
-
import * as
|
1549
|
+
import * as React from "react";
|
1804
1550
|
import { InternalAIProvider } from "./rsc-shared.mjs";
|
1805
1551
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
1806
1552
|
async function innerAction({
|
@@ -1839,7 +1585,7 @@ function createAI({
|
|
1839
1585
|
const wrappedSyncUIState = onGetUIState ? wrapAction(onGetUIState, {}) : void 0;
|
1840
1586
|
const AI = async (props) => {
|
1841
1587
|
var _a, _b;
|
1842
|
-
if ("useState" in
|
1588
|
+
if ("useState" in React) {
|
1843
1589
|
throw new Error(
|
1844
1590
|
"This component can only be used inside Server Components."
|
1845
1591
|
);
|