@ai-sdk/rsc 1.0.0-canary.2

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.
@@ -0,0 +1,740 @@
1
+ // src/ai-state.tsx
2
+ import * as jsondiffpatch from "jsondiffpatch";
3
+ import { AsyncLocalStorage } from "async_hooks";
4
+
5
+ // src/util/create-resolvable-promise.ts
6
+ function createResolvablePromise() {
7
+ let resolve;
8
+ let reject;
9
+ const promise = new Promise((res, rej) => {
10
+ resolve = res;
11
+ reject = rej;
12
+ });
13
+ return {
14
+ promise,
15
+ resolve,
16
+ reject
17
+ };
18
+ }
19
+
20
+ // src/util/is-function.ts
21
+ var isFunction = (value) => typeof value === "function";
22
+
23
+ // src/ai-state.tsx
24
+ var asyncAIStateStorage = new AsyncLocalStorage();
25
+ function getAIStateStoreOrThrow(message) {
26
+ const store = asyncAIStateStorage.getStore();
27
+ if (!store) {
28
+ throw new Error(message);
29
+ }
30
+ return store;
31
+ }
32
+ function withAIState({ state, options }, fn) {
33
+ return asyncAIStateStorage.run(
34
+ {
35
+ currentState: JSON.parse(JSON.stringify(state)),
36
+ // deep clone object
37
+ originalState: state,
38
+ sealed: false,
39
+ options
40
+ },
41
+ fn
42
+ );
43
+ }
44
+ function getAIStateDeltaPromise() {
45
+ const store = getAIStateStoreOrThrow("Internal error occurred.");
46
+ return store.mutationDeltaPromise;
47
+ }
48
+ function sealMutableAIState() {
49
+ const store = getAIStateStoreOrThrow("Internal error occurred.");
50
+ store.sealed = true;
51
+ }
52
+ function getAIState(...args) {
53
+ const store = getAIStateStoreOrThrow(
54
+ "`getAIState` must be called within an AI Action."
55
+ );
56
+ if (args.length > 0) {
57
+ const key = args[0];
58
+ if (typeof store.currentState !== "object") {
59
+ throw new Error(
60
+ `You can't get the "${String(
61
+ key
62
+ )}" field from the AI state because it's not an object.`
63
+ );
64
+ }
65
+ return store.currentState[key];
66
+ }
67
+ return store.currentState;
68
+ }
69
+ function getMutableAIState(...args) {
70
+ const store = getAIStateStoreOrThrow(
71
+ "`getMutableAIState` must be called within an AI Action."
72
+ );
73
+ if (store.sealed) {
74
+ throw new Error(
75
+ "`getMutableAIState` must be called before returning from an AI Action. Please move it to the top level of the Action's function body."
76
+ );
77
+ }
78
+ if (!store.mutationDeltaPromise) {
79
+ const { promise, resolve } = createResolvablePromise();
80
+ store.mutationDeltaPromise = promise;
81
+ store.mutationDeltaResolve = resolve;
82
+ }
83
+ function doUpdate(newState, done) {
84
+ var _a, _b;
85
+ if (args.length > 0) {
86
+ if (typeof store.currentState !== "object") {
87
+ const key = args[0];
88
+ throw new Error(
89
+ `You can't modify the "${String(
90
+ key
91
+ )}" field of the AI state because it's not an object.`
92
+ );
93
+ }
94
+ }
95
+ if (isFunction(newState)) {
96
+ if (args.length > 0) {
97
+ store.currentState[args[0]] = newState(store.currentState[args[0]]);
98
+ } else {
99
+ store.currentState = newState(store.currentState);
100
+ }
101
+ } else {
102
+ if (args.length > 0) {
103
+ store.currentState[args[0]] = newState;
104
+ } else {
105
+ store.currentState = newState;
106
+ }
107
+ }
108
+ (_b = (_a = store.options).onSetAIState) == null ? void 0 : _b.call(_a, {
109
+ key: args.length > 0 ? args[0] : void 0,
110
+ state: store.currentState,
111
+ done
112
+ });
113
+ }
114
+ const mutableState = {
115
+ get: () => {
116
+ if (args.length > 0) {
117
+ const key = args[0];
118
+ if (typeof store.currentState !== "object") {
119
+ throw new Error(
120
+ `You can't get the "${String(
121
+ key
122
+ )}" field from the AI state because it's not an object.`
123
+ );
124
+ }
125
+ return store.currentState[key];
126
+ }
127
+ return store.currentState;
128
+ },
129
+ update: function update(newAIState) {
130
+ doUpdate(newAIState, false);
131
+ },
132
+ done: function done(...doneArgs) {
133
+ if (doneArgs.length > 0) {
134
+ doUpdate(doneArgs[0], true);
135
+ }
136
+ const delta = jsondiffpatch.diff(store.originalState, store.currentState);
137
+ store.mutationDeltaResolve(delta);
138
+ }
139
+ };
140
+ return mutableState;
141
+ }
142
+
143
+ // src/provider.tsx
144
+ import * as React from "react";
145
+ import { InternalAIProvider } from "./rsc-shared.mjs";
146
+ import { jsx } from "react/jsx-runtime";
147
+ async function innerAction({
148
+ action,
149
+ options
150
+ }, state, ...args) {
151
+ "use server";
152
+ return await withAIState(
153
+ {
154
+ state,
155
+ options
156
+ },
157
+ async () => {
158
+ const result = await action(...args);
159
+ sealMutableAIState();
160
+ return [getAIStateDeltaPromise(), result];
161
+ }
162
+ );
163
+ }
164
+ function wrapAction(action, options) {
165
+ return innerAction.bind(null, { action, options });
166
+ }
167
+ function createAI({
168
+ actions,
169
+ initialAIState,
170
+ initialUIState,
171
+ onSetAIState,
172
+ onGetUIState
173
+ }) {
174
+ const wrappedActions = {};
175
+ for (const name in actions) {
176
+ wrappedActions[name] = wrapAction(actions[name], {
177
+ onSetAIState
178
+ });
179
+ }
180
+ const wrappedSyncUIState = onGetUIState ? wrapAction(onGetUIState, {}) : void 0;
181
+ const AI = async (props) => {
182
+ var _a, _b;
183
+ if ("useState" in React) {
184
+ throw new Error(
185
+ "This component can only be used inside Server Components."
186
+ );
187
+ }
188
+ let uiState = (_a = props.initialUIState) != null ? _a : initialUIState;
189
+ let aiState = (_b = props.initialAIState) != null ? _b : initialAIState;
190
+ let aiStateDelta = void 0;
191
+ if (wrappedSyncUIState) {
192
+ const [newAIStateDelta, newUIState] = await wrappedSyncUIState(aiState);
193
+ if (newUIState !== void 0) {
194
+ aiStateDelta = newAIStateDelta;
195
+ uiState = newUIState;
196
+ }
197
+ }
198
+ return /* @__PURE__ */ jsx(
199
+ InternalAIProvider,
200
+ {
201
+ wrappedActions,
202
+ wrappedSyncUIState,
203
+ initialUIState: uiState,
204
+ initialAIState: aiState,
205
+ initialAIStatePatch: aiStateDelta,
206
+ children: props.children
207
+ }
208
+ );
209
+ };
210
+ return AI;
211
+ }
212
+
213
+ // src/stream-ui/stream-ui.tsx
214
+ import { safeParseJSON } from "@ai-sdk/provider-utils";
215
+ import {
216
+ InvalidToolArgumentsError,
217
+ NoSuchToolError
218
+ } from "ai";
219
+ import {
220
+ calculateLanguageModelUsage,
221
+ standardizePrompt,
222
+ prepareToolsAndToolChoice,
223
+ prepareRetries,
224
+ prepareCallSettings,
225
+ convertToLanguageModelPrompt
226
+ } from "ai/internal";
227
+
228
+ // src/util/is-async-generator.ts
229
+ function isAsyncGenerator(value) {
230
+ return value != null && typeof value === "object" && Symbol.asyncIterator in value;
231
+ }
232
+
233
+ // src/util/is-generator.ts
234
+ function isGenerator(value) {
235
+ return value != null && typeof value === "object" && Symbol.iterator in value;
236
+ }
237
+
238
+ // src/streamable-ui/create-streamable-ui.tsx
239
+ import { HANGING_STREAM_WARNING_TIME_MS } from "ai/internal";
240
+
241
+ // src/streamable-ui/create-suspended-chunk.tsx
242
+ import { Suspense } from "react";
243
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
244
+ var R = [
245
+ async ({
246
+ c: current,
247
+ n: next
248
+ }) => {
249
+ const chunk = await next;
250
+ if (chunk.done) {
251
+ return chunk.value;
252
+ }
253
+ if (chunk.append) {
254
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
255
+ current,
256
+ /* @__PURE__ */ jsx2(Suspense, { fallback: chunk.value, children: /* @__PURE__ */ jsx2(R, { c: chunk.value, n: chunk.next }) })
257
+ ] });
258
+ }
259
+ return /* @__PURE__ */ jsx2(Suspense, { fallback: chunk.value, children: /* @__PURE__ */ jsx2(R, { c: chunk.value, n: chunk.next }) });
260
+ }
261
+ ][0];
262
+ function createSuspendedChunk(initialValue) {
263
+ const { promise, resolve, reject } = createResolvablePromise();
264
+ return {
265
+ row: /* @__PURE__ */ jsx2(Suspense, { fallback: initialValue, children: /* @__PURE__ */ jsx2(R, { c: initialValue, n: promise }) }),
266
+ resolve,
267
+ reject
268
+ };
269
+ }
270
+
271
+ // src/streamable-ui/create-streamable-ui.tsx
272
+ function createStreamableUI(initialValue) {
273
+ let currentValue = initialValue;
274
+ let closed = false;
275
+ let { row, resolve, reject } = createSuspendedChunk(initialValue);
276
+ function assertStream(method) {
277
+ if (closed) {
278
+ throw new Error(method + ": UI stream is already closed.");
279
+ }
280
+ }
281
+ let warningTimeout;
282
+ function warnUnclosedStream() {
283
+ if (process.env.NODE_ENV === "development") {
284
+ if (warningTimeout) {
285
+ clearTimeout(warningTimeout);
286
+ }
287
+ warningTimeout = setTimeout(() => {
288
+ console.warn(
289
+ "The streamable UI has been slow to update. This may be a bug or a performance issue or you forgot to call `.done()`."
290
+ );
291
+ }, HANGING_STREAM_WARNING_TIME_MS);
292
+ }
293
+ }
294
+ warnUnclosedStream();
295
+ const streamable = {
296
+ value: row,
297
+ update(value) {
298
+ assertStream(".update()");
299
+ if (value === currentValue) {
300
+ warnUnclosedStream();
301
+ return streamable;
302
+ }
303
+ const resolvable = createResolvablePromise();
304
+ currentValue = value;
305
+ resolve({ value: currentValue, done: false, next: resolvable.promise });
306
+ resolve = resolvable.resolve;
307
+ reject = resolvable.reject;
308
+ warnUnclosedStream();
309
+ return streamable;
310
+ },
311
+ append(value) {
312
+ assertStream(".append()");
313
+ const resolvable = createResolvablePromise();
314
+ currentValue = value;
315
+ resolve({ value, done: false, append: true, next: resolvable.promise });
316
+ resolve = resolvable.resolve;
317
+ reject = resolvable.reject;
318
+ warnUnclosedStream();
319
+ return streamable;
320
+ },
321
+ error(error) {
322
+ assertStream(".error()");
323
+ if (warningTimeout) {
324
+ clearTimeout(warningTimeout);
325
+ }
326
+ closed = true;
327
+ reject(error);
328
+ return streamable;
329
+ },
330
+ done(...args) {
331
+ assertStream(".done()");
332
+ if (warningTimeout) {
333
+ clearTimeout(warningTimeout);
334
+ }
335
+ closed = true;
336
+ if (args.length) {
337
+ resolve({ value: args[0], done: true });
338
+ return streamable;
339
+ }
340
+ resolve({ value: currentValue, done: true });
341
+ return streamable;
342
+ }
343
+ };
344
+ return streamable;
345
+ }
346
+
347
+ // src/stream-ui/stream-ui.tsx
348
+ var defaultTextRenderer = ({ content }) => content;
349
+ async function streamUI({
350
+ model,
351
+ tools,
352
+ toolChoice,
353
+ system,
354
+ prompt,
355
+ messages,
356
+ maxRetries,
357
+ abortSignal,
358
+ headers,
359
+ initial,
360
+ text,
361
+ experimental_providerMetadata,
362
+ providerOptions = experimental_providerMetadata,
363
+ onFinish,
364
+ ...settings
365
+ }) {
366
+ if (typeof model === "string") {
367
+ throw new Error(
368
+ "`model` cannot be a string in `streamUI`. Use the actual model instance instead."
369
+ );
370
+ }
371
+ if ("functions" in settings) {
372
+ throw new Error(
373
+ "`functions` is not supported in `streamUI`, use `tools` instead."
374
+ );
375
+ }
376
+ if ("provider" in settings) {
377
+ throw new Error(
378
+ "`provider` is no longer needed in `streamUI`. Use `model` instead."
379
+ );
380
+ }
381
+ if (tools) {
382
+ for (const [name, tool] of Object.entries(tools)) {
383
+ if ("render" in tool) {
384
+ throw new Error(
385
+ "Tool definition in `streamUI` should not have `render` property. Use `generate` instead. Found in tool: " + name
386
+ );
387
+ }
388
+ }
389
+ }
390
+ const ui = createStreamableUI(initial);
391
+ const textRender = text || defaultTextRenderer;
392
+ let finished;
393
+ let finishEvent = null;
394
+ async function render({
395
+ args,
396
+ renderer,
397
+ streamableUI,
398
+ isLastCall = false
399
+ }) {
400
+ if (!renderer)
401
+ return;
402
+ const renderFinished = createResolvablePromise();
403
+ finished = finished ? finished.then(() => renderFinished.promise) : renderFinished.promise;
404
+ const rendererResult = renderer(...args);
405
+ if (isAsyncGenerator(rendererResult) || isGenerator(rendererResult)) {
406
+ while (true) {
407
+ const { done, value } = await rendererResult.next();
408
+ const node = await value;
409
+ if (isLastCall && done) {
410
+ streamableUI.done(node);
411
+ } else {
412
+ streamableUI.update(node);
413
+ }
414
+ if (done)
415
+ break;
416
+ }
417
+ } else {
418
+ const node = await rendererResult;
419
+ if (isLastCall) {
420
+ streamableUI.done(node);
421
+ } else {
422
+ streamableUI.update(node);
423
+ }
424
+ }
425
+ renderFinished.resolve(void 0);
426
+ }
427
+ const { retry } = prepareRetries({ maxRetries });
428
+ const validatedPrompt = standardizePrompt({
429
+ prompt: { system, prompt, messages },
430
+ tools: void 0
431
+ // streamUI tools don't support multi-modal tool result conversion
432
+ });
433
+ const result = await retry(
434
+ async () => {
435
+ var _a;
436
+ return model.doStream({
437
+ ...prepareCallSettings(settings),
438
+ ...prepareToolsAndToolChoice({
439
+ tools,
440
+ toolChoice,
441
+ activeTools: void 0
442
+ }),
443
+ inputFormat: validatedPrompt.type,
444
+ prompt: await convertToLanguageModelPrompt({
445
+ prompt: validatedPrompt,
446
+ modelSupportsImageUrls: model.supportsImageUrls,
447
+ modelSupportsUrl: (_a = model.supportsUrl) == null ? void 0 : _a.bind(model)
448
+ // support 'this' context
449
+ }),
450
+ providerOptions,
451
+ abortSignal,
452
+ headers
453
+ });
454
+ }
455
+ );
456
+ const [stream, forkedStream] = result.stream.tee();
457
+ (async () => {
458
+ try {
459
+ let content = "";
460
+ let hasToolCall = false;
461
+ const reader = forkedStream.getReader();
462
+ while (true) {
463
+ const { done, value } = await reader.read();
464
+ if (done)
465
+ break;
466
+ switch (value.type) {
467
+ case "text-delta": {
468
+ content += value.textDelta;
469
+ render({
470
+ renderer: textRender,
471
+ args: [{ content, done: false, delta: value.textDelta }],
472
+ streamableUI: ui
473
+ });
474
+ break;
475
+ }
476
+ case "tool-call-delta": {
477
+ hasToolCall = true;
478
+ break;
479
+ }
480
+ case "tool-call": {
481
+ const toolName = value.toolName;
482
+ if (!tools) {
483
+ throw new NoSuchToolError({ toolName });
484
+ }
485
+ const tool = tools[toolName];
486
+ if (!tool) {
487
+ throw new NoSuchToolError({
488
+ toolName,
489
+ availableTools: Object.keys(tools)
490
+ });
491
+ }
492
+ hasToolCall = true;
493
+ const parseResult = safeParseJSON({
494
+ text: value.args,
495
+ schema: tool.parameters
496
+ });
497
+ if (parseResult.success === false) {
498
+ throw new InvalidToolArgumentsError({
499
+ toolName,
500
+ toolArgs: value.args,
501
+ cause: parseResult.error
502
+ });
503
+ }
504
+ render({
505
+ renderer: tool.generate,
506
+ args: [
507
+ parseResult.value,
508
+ {
509
+ toolName,
510
+ toolCallId: value.toolCallId
511
+ }
512
+ ],
513
+ streamableUI: ui,
514
+ isLastCall: true
515
+ });
516
+ break;
517
+ }
518
+ case "error": {
519
+ throw value.error;
520
+ }
521
+ case "finish": {
522
+ finishEvent = {
523
+ finishReason: value.finishReason,
524
+ usage: calculateLanguageModelUsage(value.usage),
525
+ warnings: result.warnings,
526
+ rawResponse: result.rawResponse
527
+ };
528
+ break;
529
+ }
530
+ }
531
+ }
532
+ if (!hasToolCall) {
533
+ render({
534
+ renderer: textRender,
535
+ args: [{ content, done: true }],
536
+ streamableUI: ui,
537
+ isLastCall: true
538
+ });
539
+ }
540
+ await finished;
541
+ if (finishEvent && onFinish) {
542
+ await onFinish({
543
+ ...finishEvent,
544
+ value: ui.value
545
+ });
546
+ }
547
+ } catch (error) {
548
+ ui.error(error);
549
+ }
550
+ })();
551
+ return {
552
+ ...result,
553
+ stream,
554
+ value: ui.value
555
+ };
556
+ }
557
+
558
+ // src/streamable-value/create-streamable-value.ts
559
+ import { HANGING_STREAM_WARNING_TIME_MS as HANGING_STREAM_WARNING_TIME_MS2 } from "ai/internal";
560
+
561
+ // src/streamable-value/streamable-value.ts
562
+ var STREAMABLE_VALUE_TYPE = Symbol.for("ui.streamable.value");
563
+
564
+ // src/streamable-value/create-streamable-value.ts
565
+ var STREAMABLE_VALUE_INTERNAL_LOCK = Symbol("streamable.value.lock");
566
+ function createStreamableValue(initialValue) {
567
+ const isReadableStream = initialValue instanceof ReadableStream || typeof initialValue === "object" && initialValue !== null && "getReader" in initialValue && typeof initialValue.getReader === "function" && "locked" in initialValue && typeof initialValue.locked === "boolean";
568
+ if (!isReadableStream) {
569
+ return createStreamableValueImpl(initialValue);
570
+ }
571
+ const streamableValue = createStreamableValueImpl();
572
+ streamableValue[STREAMABLE_VALUE_INTERNAL_LOCK] = true;
573
+ (async () => {
574
+ try {
575
+ const reader = initialValue.getReader();
576
+ while (true) {
577
+ const { value, done } = await reader.read();
578
+ if (done) {
579
+ break;
580
+ }
581
+ streamableValue[STREAMABLE_VALUE_INTERNAL_LOCK] = false;
582
+ if (typeof value === "string") {
583
+ streamableValue.append(value);
584
+ } else {
585
+ streamableValue.update(value);
586
+ }
587
+ streamableValue[STREAMABLE_VALUE_INTERNAL_LOCK] = true;
588
+ }
589
+ streamableValue[STREAMABLE_VALUE_INTERNAL_LOCK] = false;
590
+ streamableValue.done();
591
+ } catch (e) {
592
+ streamableValue[STREAMABLE_VALUE_INTERNAL_LOCK] = false;
593
+ streamableValue.error(e);
594
+ }
595
+ })();
596
+ return streamableValue;
597
+ }
598
+ function createStreamableValueImpl(initialValue) {
599
+ let closed = false;
600
+ let locked = false;
601
+ let resolvable = createResolvablePromise();
602
+ let currentValue = initialValue;
603
+ let currentError;
604
+ let currentPromise = resolvable.promise;
605
+ let currentPatchValue;
606
+ function assertStream(method) {
607
+ if (closed) {
608
+ throw new Error(method + ": Value stream is already closed.");
609
+ }
610
+ if (locked) {
611
+ throw new Error(
612
+ method + ": Value stream is locked and cannot be updated."
613
+ );
614
+ }
615
+ }
616
+ let warningTimeout;
617
+ function warnUnclosedStream() {
618
+ if (process.env.NODE_ENV === "development") {
619
+ if (warningTimeout) {
620
+ clearTimeout(warningTimeout);
621
+ }
622
+ warningTimeout = setTimeout(() => {
623
+ console.warn(
624
+ "The streamable value has been slow to update. This may be a bug or a performance issue or you forgot to call `.done()`."
625
+ );
626
+ }, HANGING_STREAM_WARNING_TIME_MS2);
627
+ }
628
+ }
629
+ warnUnclosedStream();
630
+ function createWrapped(initialChunk) {
631
+ let init;
632
+ if (currentError !== void 0) {
633
+ init = { error: currentError };
634
+ } else {
635
+ if (currentPatchValue && !initialChunk) {
636
+ init = { diff: currentPatchValue };
637
+ } else {
638
+ init = { curr: currentValue };
639
+ }
640
+ }
641
+ if (currentPromise) {
642
+ init.next = currentPromise;
643
+ }
644
+ if (initialChunk) {
645
+ init.type = STREAMABLE_VALUE_TYPE;
646
+ }
647
+ return init;
648
+ }
649
+ function updateValueStates(value) {
650
+ currentPatchValue = void 0;
651
+ if (typeof value === "string") {
652
+ if (typeof currentValue === "string") {
653
+ if (value.startsWith(currentValue)) {
654
+ currentPatchValue = [0, value.slice(currentValue.length)];
655
+ }
656
+ }
657
+ }
658
+ currentValue = value;
659
+ }
660
+ const streamable = {
661
+ set [STREAMABLE_VALUE_INTERNAL_LOCK](state) {
662
+ locked = state;
663
+ },
664
+ get value() {
665
+ return createWrapped(true);
666
+ },
667
+ update(value) {
668
+ assertStream(".update()");
669
+ const resolvePrevious = resolvable.resolve;
670
+ resolvable = createResolvablePromise();
671
+ updateValueStates(value);
672
+ currentPromise = resolvable.promise;
673
+ resolvePrevious(createWrapped());
674
+ warnUnclosedStream();
675
+ return streamable;
676
+ },
677
+ append(value) {
678
+ assertStream(".append()");
679
+ if (typeof currentValue !== "string" && typeof currentValue !== "undefined") {
680
+ throw new Error(
681
+ `.append(): The current value is not a string. Received: ${typeof currentValue}`
682
+ );
683
+ }
684
+ if (typeof value !== "string") {
685
+ throw new Error(
686
+ `.append(): The value is not a string. Received: ${typeof value}`
687
+ );
688
+ }
689
+ const resolvePrevious = resolvable.resolve;
690
+ resolvable = createResolvablePromise();
691
+ if (typeof currentValue === "string") {
692
+ currentPatchValue = [0, value];
693
+ currentValue = currentValue + value;
694
+ } else {
695
+ currentPatchValue = void 0;
696
+ currentValue = value;
697
+ }
698
+ currentPromise = resolvable.promise;
699
+ resolvePrevious(createWrapped());
700
+ warnUnclosedStream();
701
+ return streamable;
702
+ },
703
+ error(error) {
704
+ assertStream(".error()");
705
+ if (warningTimeout) {
706
+ clearTimeout(warningTimeout);
707
+ }
708
+ closed = true;
709
+ currentError = error;
710
+ currentPromise = void 0;
711
+ resolvable.resolve({ error });
712
+ return streamable;
713
+ },
714
+ done(...args) {
715
+ assertStream(".done()");
716
+ if (warningTimeout) {
717
+ clearTimeout(warningTimeout);
718
+ }
719
+ closed = true;
720
+ currentPromise = void 0;
721
+ if (args.length) {
722
+ updateValueStates(args[0]);
723
+ resolvable.resolve(createWrapped());
724
+ return streamable;
725
+ }
726
+ resolvable.resolve({});
727
+ return streamable;
728
+ }
729
+ };
730
+ return streamable;
731
+ }
732
+ export {
733
+ createAI,
734
+ createStreamableUI,
735
+ createStreamableValue,
736
+ getAIState,
737
+ getMutableAIState,
738
+ streamUI
739
+ };
740
+ //# sourceMappingURL=rsc-server.mjs.map