@assistant-ui/react-ai-sdk 0.5.16 → 0.6.0

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.js CHANGED
@@ -66,83 +66,56 @@ var getVercelRSCMessage = (message) => {
66
66
  return (0, import_react2.getExternalStoreMessage)(message);
67
67
  };
68
68
 
69
- // src/ui/use-chat/useVercelUseChatRuntime.tsx
70
- var import_react8 = require("react");
71
-
72
- // src/ui/use-chat/VercelUseChatRuntime.tsx
73
- var import_react7 = require("@assistant-ui/react");
74
-
75
- // src/ui/use-chat/VercelUseChatThreadRuntime.tsx
76
- var import_react6 = require("@assistant-ui/react");
77
- var import_zustand = require("zustand");
78
-
79
- // src/ui/getVercelAIMessage.tsx
80
- var symbolInnerAIMessage = Symbol("innerVercelAIUIMessage");
81
- var getVercelAIMessage = (message) => {
82
- return message[symbolInnerAIMessage];
83
- };
84
-
85
- // src/ui/utils/sliceMessagesUntil.tsx
86
- var sliceMessagesUntil = (messages, messageId) => {
87
- if (messageId == null) return [];
88
- let messageIdx = messages.findIndex((m) => m.id === messageId);
89
- if (messageIdx === -1)
90
- throw new Error(
91
- "useVercelAIThreadState: Message not found. This is liekly an internal bug in assistant-ui."
92
- );
93
- while (messages[messageIdx + 1]?.role === "assistant") {
94
- messageIdx++;
69
+ // src/ui/utils/useCachedChunkedMessages.ts
70
+ var import_react3 = require("react");
71
+ var hasItems = (messages) => messages.length > 0;
72
+ var chunkedMessages = (messages) => {
73
+ const chunks = [];
74
+ let currentChunk = [];
75
+ for (const message of messages) {
76
+ if (message.role === "assistant" || message.role === "data") {
77
+ currentChunk.push(message);
78
+ } else {
79
+ if (hasItems(currentChunk)) {
80
+ chunks.push(currentChunk);
81
+ currentChunk = [];
82
+ }
83
+ chunks.push([message]);
84
+ }
95
85
  }
96
- return messages.slice(0, messageIdx + 1);
86
+ if (hasItems(currentChunk)) {
87
+ chunks.push(currentChunk);
88
+ }
89
+ return chunks;
97
90
  };
98
-
99
- // src/ui/utils/useVercelAIComposerSync.tsx
100
- var import_react3 = require("@assistant-ui/react");
101
- var import_react4 = require("react");
102
- var useVercelAIComposerSync = (vercel) => {
103
- const { useComposer, useThreadRuntime } = (0, import_react3.useThreadContext)();
104
- (0, import_react4.useEffect)(() => {
105
- useThreadRuntime.getState().composer.setText(vercel.input);
106
- }, [useComposer, useThreadRuntime, vercel.input]);
107
- (0, import_react4.useEffect)(() => {
108
- useComposer.setState({
109
- setText: (t) => {
110
- vercel.setInput(t);
111
- useThreadRuntime.getState().composer.setText(t);
112
- }
113
- });
114
- }, [useComposer, useThreadRuntime, vercel]);
91
+ var shallowArrayEqual = (a, b) => {
92
+ if (a.length !== b.length) return false;
93
+ for (let i = 0; i < a.length; i++) {
94
+ if (a[i] !== b[i]) return false;
95
+ }
96
+ return true;
115
97
  };
116
-
117
- // src/ui/utils/useVercelAIThreadSync.tsx
118
- var import_react5 = require("react");
119
-
120
- // src/utils/ThreadMessageConverter.ts
121
- var ThreadMessageConverter = class {
122
- cache = /* @__PURE__ */ new WeakMap();
123
- convertMessages(messages, converter, keyMapper = (key) => key) {
124
- return messages.map((m) => {
125
- const key = keyMapper(m);
126
- const cached = this.cache.get(key);
127
- const newMessage = converter(m, cached);
128
- this.cache.set(key, newMessage);
129
- return newMessage;
98
+ var useCachedChunkedMessages = (messages) => {
99
+ const cache = (0, import_react3.useMemo)(() => /* @__PURE__ */ new WeakMap(), []);
100
+ return (0, import_react3.useMemo)(() => {
101
+ return chunkedMessages(messages).map((m) => {
102
+ const key = m[0];
103
+ if (!key) return m;
104
+ const cached = cache.get(key);
105
+ if (cached && shallowArrayEqual(cached, m)) return cached;
106
+ cache.set(key, m);
107
+ return m;
130
108
  });
131
- }
109
+ }, [messages, cache]);
132
110
  };
133
111
 
134
- // src/ui/utils/useVercelAIThreadSync.tsx
135
- var getIsRunning = (vercel) => {
136
- if ("isLoading" in vercel) return vercel.isLoading;
137
- return vercel.status === "in_progress";
138
- };
139
- var vercelToThreadMessage2 = (messages, status) => {
112
+ // src/ui/utils/convertMessage.ts
113
+ var convertMessage = (messages) => {
140
114
  const firstMessage = messages[0];
141
115
  if (!firstMessage) throw new Error("No messages found");
142
116
  const common = {
143
117
  id: firstMessage.id,
144
- createdAt: firstMessage.createdAt ?? /* @__PURE__ */ new Date(),
145
- [symbolInnerAIMessage]: messages
118
+ createdAt: firstMessage.createdAt ?? /* @__PURE__ */ new Date()
146
119
  };
147
120
  switch (firstMessage.role) {
148
121
  case "user":
@@ -182,8 +155,7 @@ var vercelToThreadMessage2 = (messages, status) => {
182
155
  ) ?? [],
183
156
  ...typeof message.data === "object" && !Array.isArray(message.data) && message.data?.["type"] === "tool-call" ? [message.data] : []
184
157
  ];
185
- }),
186
- status
158
+ })
187
159
  };
188
160
  for (const message of messages) {
189
161
  if (typeof message.data === "object" && !Array.isArray(message.data) && message.data?.["type"] === "tool-result") {
@@ -204,381 +176,133 @@ var vercelToThreadMessage2 = (messages, status) => {
204
176
  );
205
177
  }
206
178
  };
207
- var hasItems = (messages) => messages.length > 0;
208
- var chunkedMessages = (messages) => {
209
- const chunks = [];
210
- let currentChunk = [];
211
- for (const message of messages) {
212
- if (message.role === "assistant" || message.role === "data") {
213
- currentChunk.push(message);
214
- } else {
215
- if (hasItems(currentChunk)) {
216
- chunks.push(currentChunk);
217
- currentChunk = [];
218
- }
219
- chunks.push([message]);
220
- }
221
- }
222
- if (hasItems(currentChunk)) {
223
- chunks.push(currentChunk);
224
- }
225
- return chunks;
226
- };
227
- var shallowArrayEqual = (a, b) => {
228
- if (a.length !== b.length) return false;
229
- for (let i = 0; i < a.length; i++) {
230
- if (a[i] !== b[i]) return false;
231
- }
232
- return true;
233
- };
234
- var useVercelAIThreadSync = (vercel, updateData) => {
235
- const isRunning = getIsRunning(vercel);
236
- const converter = (0, import_react5.useMemo)(() => new ThreadMessageConverter(), []);
237
- (0, import_react5.useEffect)(() => {
238
- const lastMessageId = vercel.messages.at(-1)?.id;
239
- const convertCallback = (messages2, cache) => {
240
- const status = lastMessageId === messages2[0].id && isRunning ? {
241
- type: "running"
242
- } : {
243
- type: "complete",
244
- reason: "unknown"
245
- };
246
- if (cache && shallowArrayEqual(cache.content, messages2) && (cache.role !== "assistant" || cache.status.type === status.type))
247
- return cache;
248
- return vercelToThreadMessage2(messages2, status);
249
- };
250
- const messages = converter.convertMessages(
251
- chunkedMessages(vercel.messages),
252
- convertCallback,
253
- (m) => m[0]
254
- );
255
- updateData(isRunning, messages);
256
- }, [updateData, isRunning, vercel.messages, converter]);
257
- };
258
179
 
259
- // src/ui/use-chat/VercelUseChatThreadRuntime.tsx
260
- var { MessageRepository } = import_react6.INTERNAL;
261
- var hasUpcomingMessage = (isRunning, messages) => {
262
- return isRunning && messages[messages.length - 1]?.role !== "assistant";
263
- };
264
- var CAPABILITIES = Object.freeze({
265
- switchToBranch: true,
266
- edit: true,
267
- reload: true,
268
- cancel: true,
269
- copy: true
270
- });
271
- var VercelUseChatThreadRuntime = class {
272
- constructor(vercel) {
273
- this.vercel = vercel;
274
- this.useVercel = (0, import_zustand.create)(() => ({
275
- vercel
276
- }));
277
- }
278
- _subscriptions = /* @__PURE__ */ new Set();
279
- repository = new MessageRepository();
280
- assistantOptimisticId = null;
281
- useVercel;
282
- capabilities = CAPABILITIES;
283
- messages = [];
284
- isDisabled = false;
285
- composer = {
286
- text: "",
287
- setText: (value) => {
288
- this.composer.text = value;
289
- for (const callback of this._subscriptions) callback();
180
+ // src/ui/use-chat/useVercelUseChatRuntime.tsx
181
+ var import_react6 = require("@assistant-ui/react");
182
+
183
+ // src/ui/utils/useInputSync.tsx
184
+ var import_react4 = require("react");
185
+ var import_react5 = require("@assistant-ui/react");
186
+ var useInputSync = (helpers, runtime) => {
187
+ const helpersRef = (0, import_react4.useRef)(helpers);
188
+ (0, import_react4.useEffect)(() => {
189
+ helpersRef.current = helpers;
190
+ if (runtime.thread.composer.text !== helpers.input) {
191
+ runtime.thread.composer.setText(helpers.input);
290
192
  }
291
- };
292
- getBranches(messageId) {
293
- return this.repository.getBranches(messageId);
294
- }
295
- switchToBranch(branchId) {
296
- this.repository.switchToBranch(branchId);
297
- this.updateVercelMessages(this.repository.getMessages());
298
- }
299
- async append(message) {
300
- if (message.content.length !== 1 || message.content[0]?.type !== "text")
301
- throw new Error(
302
- "Only text content is supported by VercelUseChatRuntime. Use the Edge runtime for image support."
303
- );
304
- const newMessages = sliceMessagesUntil(
305
- this.vercel.messages,
306
- message.parentId
307
- );
308
- this.vercel.setMessages(newMessages);
309
- await this.vercel.append({
310
- role: message.role,
311
- content: message.content[0].text
193
+ }, [helpers, runtime]);
194
+ (0, import_react4.useEffect)(() => {
195
+ return (0, import_react5.subscribeToMainThread)(runtime, () => {
196
+ if (runtime.thread.composer.text !== helpersRef.current.input) {
197
+ helpersRef.current.setInput(runtime.thread.composer.text);
198
+ }
312
199
  });
313
- }
314
- async startRun(parentId) {
315
- const newMessages = sliceMessagesUntil(this.vercel.messages, parentId);
316
- this.vercel.setMessages(newMessages);
317
- await this.vercel.reload();
318
- }
319
- cancelRun() {
320
- const previousMessage = this.vercel.messages.at(-1);
321
- this.vercel.stop();
322
- if (this.assistantOptimisticId) {
323
- this.repository.deleteMessage(this.assistantOptimisticId);
324
- this.assistantOptimisticId = null;
325
- }
326
- let messages = this.repository.getMessages();
327
- if (previousMessage?.role === "user" && previousMessage.id === messages.at(-1)?.id) {
328
- this.vercel.setInput(previousMessage.content);
329
- this.repository.deleteMessage(previousMessage.id);
330
- messages = this.repository.getMessages();
331
- }
332
- setTimeout(() => {
333
- this.updateVercelMessages(messages);
334
- }, 0);
335
- }
336
- subscribe(callback) {
337
- this._subscriptions.add(callback);
338
- return () => this._subscriptions.delete(callback);
339
- }
340
- updateVercelMessages = (messages) => {
341
- this.vercel.setMessages(
342
- messages.flatMap(getVercelAIMessage).filter((m) => m != null)
343
- );
344
- };
345
- onVercelUpdated() {
346
- if (this.useVercel.getState().vercel !== this.vercel) {
347
- this.useVercel.setState({ vercel: this.vercel });
348
- }
349
- }
350
- updateData = (isRunning, vm) => {
351
- for (let i = 0; i < vm.length; i++) {
352
- const message = vm[i];
353
- const parent = vm[i - 1];
354
- this.repository.addOrUpdateMessage(parent?.id ?? null, message);
355
- }
356
- if (this.assistantOptimisticId) {
357
- this.repository.deleteMessage(this.assistantOptimisticId);
358
- this.assistantOptimisticId = null;
359
- }
360
- if (hasUpcomingMessage(isRunning, vm)) {
361
- this.assistantOptimisticId = this.repository.appendOptimisticMessage(
362
- vm.at(-1)?.id ?? null,
363
- {
364
- role: "assistant",
365
- content: []
366
- }
367
- );
368
- }
369
- this.repository.resetHead(
370
- this.assistantOptimisticId ?? vm.at(-1)?.id ?? null
371
- );
372
- this.messages = this.repository.getMessages();
373
- for (const callback of this._subscriptions) callback();
374
- };
375
- unstable_synchronizer = () => {
376
- const { vercel } = this.useVercel();
377
- useVercelAIThreadSync(vercel, this.updateData);
378
- useVercelAIComposerSync(vercel);
379
- return null;
380
- };
381
- addToolResult({ toolCallId, result }) {
382
- this.vercel.addToolResult({ toolCallId, result });
383
- }
200
+ }, [runtime]);
384
201
  };
385
202
 
386
- // src/ui/use-chat/VercelUseChatRuntime.tsx
387
- var { ProxyConfigProvider, BaseAssistantRuntime } = import_react7.INTERNAL;
388
- var VercelUseChatRuntime = class extends BaseAssistantRuntime {
389
- _proxyConfigProvider = new ProxyConfigProvider();
390
- constructor(vercel) {
391
- super(new VercelUseChatThreadRuntime(vercel));
392
- }
393
- set vercel(vercel) {
394
- this.thread.vercel = vercel;
395
- }
396
- onVercelUpdated() {
397
- return this.thread.onVercelUpdated();
398
- }
399
- getModelConfig() {
400
- return this._proxyConfigProvider.getModelConfig();
401
- }
402
- registerModelConfigProvider(provider) {
403
- return this._proxyConfigProvider.registerModelConfigProvider(provider);
404
- }
405
- switchToThread(threadId) {
406
- if (threadId) {
407
- throw new Error(
408
- "VercelAIRuntime does not yet support switching threads."
409
- );
410
- }
411
- this.thread.vercel.messages = [];
412
- this.thread.vercel.input = "";
413
- this.thread.vercel.setMessages([]);
414
- this.thread.vercel.setInput("");
415
- this.thread = new VercelUseChatThreadRuntime(this.thread.vercel);
203
+ // src/ui/utils/sliceMessagesUntil.tsx
204
+ var sliceMessagesUntil = (messages, messageId) => {
205
+ if (messageId == null) return [];
206
+ let messageIdx = messages.findIndex((m) => m.id === messageId);
207
+ if (messageIdx === -1)
208
+ throw new Error(
209
+ "useVercelAIThreadState: Message not found. This is liekly an internal bug in assistant-ui."
210
+ );
211
+ while (messages[messageIdx + 1]?.role === "assistant") {
212
+ messageIdx++;
416
213
  }
214
+ return messages.slice(0, messageIdx + 1);
417
215
  };
418
216
 
419
217
  // src/ui/use-chat/useVercelUseChatRuntime.tsx
420
218
  var useVercelUseChatRuntime = (chatHelpers) => {
421
- const [runtime] = (0, import_react8.useState)(() => new VercelUseChatRuntime(chatHelpers));
422
- (0, import_react8.useInsertionEffect)(() => {
423
- runtime.vercel = chatHelpers;
424
- });
425
- (0, import_react8.useEffect)(() => {
426
- runtime.onVercelUpdated();
427
- });
428
- return runtime;
429
- };
430
-
431
- // src/ui/use-assistant/useVercelUseAssistantRuntime.tsx
432
- var import_react10 = require("react");
433
-
434
- // src/ui/use-assistant/VercelUseAssistantRuntime.tsx
435
- var import_react9 = require("@assistant-ui/react");
436
-
437
- // src/ui/use-assistant/VercelUseAssistantThreadRuntime.tsx
438
- var import_zustand2 = require("zustand");
439
- var EMPTY_BRANCHES = Object.freeze([]);
440
- var CAPABILITIES2 = Object.freeze({
441
- switchToBranch: false,
442
- edit: false,
443
- reload: false,
444
- cancel: false,
445
- copy: true
446
- });
447
- var VercelUseAssistantThreadRuntime = class {
448
- constructor(vercel) {
449
- this.vercel = vercel;
450
- this.useVercel = (0, import_zustand2.create)(() => ({
451
- vercel
452
- }));
453
- }
454
- _subscriptions = /* @__PURE__ */ new Set();
455
- capabilities = CAPABILITIES2;
456
- useVercel;
457
- messages = [];
458
- composer = {
459
- text: "",
460
- setText: (value) => {
461
- this.composer.text = value;
462
- for (const callback of this._subscriptions) callback();
463
- }
464
- };
465
- isDisabled = false;
466
- getBranches() {
467
- return EMPTY_BRANCHES;
468
- }
469
- switchToBranch() {
470
- throw new Error(
471
- "VercelUseAssistantRuntime does not support switching branches."
472
- );
473
- }
474
- async append(message) {
475
- if (message.role !== "user")
476
- throw new Error(
477
- "Only appending user messages are supported in VercelUseAssistantRuntime. This is likely an internal bug in assistant-ui."
478
- );
479
- if (message.content.length !== 1 || message.content[0]?.type !== "text")
480
- throw new Error("VercelUseAssistantRuntime only supports text content.");
481
- if (message.parentId !== (this.messages.at(-1)?.id ?? null))
482
- throw new Error(
483
- "VercelUseAssistantRuntime does not support editing messages."
219
+ const messages = useCachedChunkedMessages(chatHelpers.messages);
220
+ const runtime = (0, import_react6.useExternalStoreRuntime)({
221
+ isRunning: chatHelpers.isLoading,
222
+ messages,
223
+ setMessages: (messages2) => chatHelpers.setMessages(messages2.flat()),
224
+ onCancel: async () => chatHelpers.stop(),
225
+ onNew: async (message) => {
226
+ if (message.content.length !== 1 || message.content[0]?.type !== "text")
227
+ throw new Error(
228
+ "Only text content is supported by VercelUseChatRuntime. Use the Edge runtime for image support."
229
+ );
230
+ await chatHelpers.append({
231
+ role: message.role,
232
+ content: message.content[0].text
233
+ });
234
+ },
235
+ onEdit: async (message) => {
236
+ if (message.content.length !== 1 || message.content[0]?.type !== "text")
237
+ throw new Error(
238
+ "Only text content is supported by VercelUseChatRuntime. Use the Edge runtime for image support."
239
+ );
240
+ const newMessages = sliceMessagesUntil(
241
+ chatHelpers.messages,
242
+ message.parentId
484
243
  );
485
- await this.vercel.append({
486
- role: "user",
487
- content: message.content[0].text
488
- });
489
- }
490
- async startRun() {
491
- throw new Error("VercelUseAssistantRuntime does not support reloading.");
492
- }
493
- cancelRun() {
494
- const previousMessage = this.vercel.messages.at(-1);
495
- this.vercel.stop();
496
- if (previousMessage?.role === "user") {
497
- this.vercel.setInput(previousMessage.content);
498
- }
499
- }
500
- subscribe(callback) {
501
- this._subscriptions.add(callback);
502
- return () => this._subscriptions.delete(callback);
503
- }
504
- onVercelUpdated() {
505
- if (this.useVercel.getState().vercel !== this.vercel) {
506
- this.useVercel.setState({ vercel: this.vercel });
507
- }
508
- }
509
- updateData = (isRunning, vm) => {
510
- if (hasUpcomingMessage2(isRunning, vm)) {
511
- vm.push({
512
- id: "__optimistic__result",
513
- createdAt: /* @__PURE__ */ new Date(),
514
- status: { type: "running" },
515
- role: "assistant",
516
- content: []
244
+ chatHelpers.setMessages(newMessages);
245
+ await chatHelpers.append({
246
+ role: message.role,
247
+ content: message.content[0].text
517
248
  });
518
- }
519
- this.messages = vm;
520
- for (const callback of this._subscriptions) callback();
521
- };
522
- unstable_synchronizer = () => {
523
- const { vercel } = this.useVercel();
524
- useVercelAIThreadSync(vercel, this.updateData);
525
- useVercelAIComposerSync(vercel);
526
- return null;
527
- };
528
- addToolResult() {
529
- throw new Error(
530
- "VercelUseAssistantRuntime does not support adding tool results."
531
- );
532
- }
533
- };
534
-
535
- // src/ui/use-assistant/VercelUseAssistantRuntime.tsx
536
- var { ProxyConfigProvider: ProxyConfigProvider2, BaseAssistantRuntime: BaseAssistantRuntime2 } = import_react9.INTERNAL;
537
- var hasUpcomingMessage2 = (isRunning, messages) => {
538
- return isRunning && messages[messages.length - 1]?.role !== "assistant";
539
- };
540
- var VercelUseAssistantRuntime = class extends BaseAssistantRuntime2 {
541
- _proxyConfigProvider = new ProxyConfigProvider2();
542
- constructor(vercel) {
543
- super(new VercelUseAssistantThreadRuntime(vercel));
544
- }
545
- set vercel(vercel) {
546
- this.thread.vercel = vercel;
547
- }
548
- onVercelUpdated() {
549
- return this.thread.onVercelUpdated();
550
- }
551
- getModelConfig() {
552
- return this._proxyConfigProvider.getModelConfig();
553
- }
554
- registerModelConfigProvider(provider) {
555
- return this._proxyConfigProvider.registerModelConfigProvider(provider);
556
- }
557
- switchToThread(threadId) {
558
- if (threadId) {
559
- throw new Error("VercelAIRuntime does not yet support switching threads");
560
- }
561
- this.thread.vercel.messages = [];
562
- this.thread.vercel.input = "";
563
- this.thread.vercel.setMessages([]);
564
- this.thread.vercel.setInput("");
565
- this.thread = new VercelUseAssistantThreadRuntime(this.thread.vercel);
566
- }
249
+ },
250
+ onReload: async (parentId) => {
251
+ const newMessages = sliceMessagesUntil(chatHelpers.messages, parentId);
252
+ chatHelpers.setMessages(newMessages);
253
+ await chatHelpers.reload();
254
+ },
255
+ onAddToolResult: ({ toolCallId, result }) => {
256
+ chatHelpers.addToolResult({ toolCallId, result });
257
+ },
258
+ // onCopy // TODO
259
+ onNewThread: () => {
260
+ chatHelpers.messages = [];
261
+ chatHelpers.input = "";
262
+ chatHelpers.setMessages([]);
263
+ chatHelpers.setInput("");
264
+ },
265
+ convertMessage
266
+ });
267
+ useInputSync(chatHelpers, runtime);
268
+ return runtime;
567
269
  };
568
270
 
569
271
  // src/ui/use-assistant/useVercelUseAssistantRuntime.tsx
272
+ var import_react7 = require("@assistant-ui/react");
570
273
  var useVercelUseAssistantRuntime = (assistantHelpers) => {
571
- const [runtime] = (0, import_react10.useState)(
572
- () => new VercelUseAssistantRuntime(assistantHelpers)
573
- );
574
- (0, import_react10.useInsertionEffect)(() => {
575
- runtime.vercel = assistantHelpers;
576
- });
577
- (0, import_react10.useEffect)(() => {
578
- runtime.onVercelUpdated();
274
+ const messages = useCachedChunkedMessages(assistantHelpers.messages);
275
+ const runtime = (0, import_react7.useExternalStoreRuntime)({
276
+ isRunning: assistantHelpers.status === "in_progress",
277
+ messages,
278
+ onCancel: async () => assistantHelpers.stop(),
279
+ onNew: async (message) => {
280
+ if (message.content.length !== 1 || message.content[0]?.type !== "text")
281
+ throw new Error(
282
+ "VercelUseAssistantRuntime only supports text content."
283
+ );
284
+ await assistantHelpers.append({
285
+ role: message.role,
286
+ content: message.content[0].text
287
+ });
288
+ },
289
+ onNewThread: () => {
290
+ assistantHelpers.messages = [];
291
+ assistantHelpers.input = "";
292
+ assistantHelpers.setMessages([]);
293
+ assistantHelpers.setInput("");
294
+ },
295
+ convertMessage
579
296
  });
297
+ useInputSync(assistantHelpers, runtime);
580
298
  return runtime;
581
299
  };
300
+
301
+ // src/ui/getVercelAIMessage.tsx
302
+ var import_react8 = require("@assistant-ui/react");
303
+ var getVercelAIMessage = (message) => {
304
+ return (0, import_react8.getExternalStoreMessage)(message);
305
+ };
582
306
  // Annotate the CommonJS export names for ESM import in node:
583
307
  0 && (module.exports = {
584
308
  getVercelAIMessage,