@dbx-tools/ui-mastra 0.9.190 → 0.9.193

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.
@@ -293,7 +293,10 @@ export const MarkdownWithEmbeds = ({
293
293
  if (seg.kind === "text") {
294
294
  if (seg.text.trim().length === 0) return null;
295
295
  return (
296
- <AssistantMarkdown key={`t-${i}`} animate={streaming}>
296
+ <AssistantMarkdown
297
+ key={`${streaming ? "streaming" : "settled"}-t-${i}`}
298
+ animate={streaming}
299
+ >
297
300
  {seg.text}
298
301
  </AssistantMarkdown>
299
302
  );
@@ -1,7 +1,13 @@
1
1
  import { getAuthStatus } from "@dbx-tools/shared-auth";
2
2
  import { hash, log, toError } from "@dbx-tools/shared-core";
3
- import { isStaleMastraResumeError, type GenieVisualizationMode } from "@dbx-tools/shared-mastra";
3
+ import {
4
+ isStaleMastraResumeError,
5
+ type GenieVisualizationMode,
6
+ type ModelRoutePartData,
7
+ type ModelUsagePartData,
8
+ } from "@dbx-tools/shared-mastra";
4
9
  import type { ReasoningEffort } from "@dbx-tools/shared-model";
10
+ import type { AiDecideStrategy } from "@dbx-tools/shared-model-gateway";
5
11
  import { useBrand } from "@dbx-tools/ui/branding/react";
6
12
  import type { RequestContext } from "@mastra/client-js";
7
13
  import type { FileUIPart, UIMessage } from "ai";
@@ -21,6 +27,12 @@ import {
21
27
  removeStoredActiveRun,
22
28
  storeActiveRun,
23
29
  } from "../support/active-runs.ts";
30
+ import {
31
+ browserTranscriptStorageKey,
32
+ readStoredBrowserTranscript,
33
+ storeBrowserTranscript,
34
+ withBrowserMessageTimestamps,
35
+ } from "../support/browser-transcript.ts";
24
36
  import type { EmbedResolver, ExportFormat } from "../support/export.ts";
25
37
  import { GenieChatClient } from "../support/genie-client.ts";
26
38
  import {
@@ -47,6 +59,8 @@ import {
47
59
  } from "../support/request-context.ts";
48
60
  import { threadStorageKey } from "../support/thread-persistence.ts";
49
61
  import {
62
+ conversationRequestMessages,
63
+ type ConversationHistorySource,
50
64
  DEFAULT_THREAD_SESSION_KEY,
51
65
  enqueueSteer,
52
66
  interruptedTurnMessages,
@@ -62,6 +76,12 @@ const EMPTY_REASONING_EFFORTS: readonly ReasoningEffort[] = [];
62
76
  /** Why the active managed thread changed. */
63
77
  export type ThreadIdChangeReason = "hydrate" | "select" | "new" | "delete" | "missing" | "resolve";
64
78
 
79
+ /** Browser transcript persistence limits for agents without durable Mastra memory. */
80
+ export interface BrowserConversationPersistenceOptions {
81
+ /** Newest messages retained per thread. Defaults to 100. */
82
+ maxMessages?: number;
83
+ }
84
+
65
85
  // Self-contained drop-in chat. `useMastraChat` consumes native AI SDK
66
86
  // `UIMessage` streams through one client contract: Mastra agents use the
67
87
  // official chat route and direct Genie projects its events onto that wire.
@@ -83,11 +103,15 @@ export type ThreadIdChangeReason = "hydrate" | "select" | "new" | "delete" | "mi
83
103
  const logger = log.logger("ui-mastra/chat");
84
104
  const STEER_INTERRUPT_SETTLEMENT_TIMEOUT_MS = 2_000;
85
105
 
86
- const makeUserMessage = (text: string, files: FileUIPart[] = []): UIMessage => ({
87
- id: hash.id(),
88
- role: "user",
89
- parts: [...files, ...(text ? [{ type: "text" as const, text }] : [])],
90
- });
106
+ const makeUserMessage = (text: string, files: FileUIPart[] = []): UIMessage =>
107
+ withBrowserMessageTimestamps(
108
+ {
109
+ id: hash.id(),
110
+ role: "user",
111
+ parts: [...files, ...(text ? [{ type: "text" as const, text }] : [])],
112
+ },
113
+ { createdAt: new Date().toISOString() },
114
+ );
91
115
 
92
116
  /** Project a native Mastra memory thread down to the sidebar's view. */
93
117
  const toThreadSummary = (thread: MastraMemoryThread): ThreadSummary => ({
@@ -189,6 +213,44 @@ export interface UseMastraChatOptions<
189
213
  * when `false` the model catalogue isn't even fetched.
190
214
  */
191
215
  showModelPicker?: boolean;
216
+ /**
217
+ * Show the concrete selected model in each assistant footer.
218
+ * Off by default; useful for routing diagnostics and model comparisons.
219
+ */
220
+ showSelectedModel?: boolean;
221
+ /**
222
+ * Per-turn metrics rendered at the right edge of the assistant footer.
223
+ * Omit to keep metrics hidden.
224
+ */
225
+ metrics?: ChatViewProps["metrics"];
226
+ /**
227
+ * Fixed per-instance model override. Unlike the model picker selection, this
228
+ * is not persisted by agent id, so parallel views of the same agent can each
229
+ * route through a different model or family query.
230
+ */
231
+ model?: string;
232
+ /** Optimization objective used when {@link model} is the `ai-decide` virtual model. */
233
+ aiDecideStrategy?: AiDecideStrategy;
234
+ /**
235
+ * Conversation context source. `"memory"` sends only the newest message and
236
+ * lets Mastra's stored thread remain authoritative. `"browser"` sends the
237
+ * full browser-held transcript, as Mastra recommends for agents without memory.
238
+ * Defaults to `"memory"` for backward compatibility.
239
+ */
240
+ conversationHistory?: ConversationHistorySource;
241
+ /**
242
+ * Persist the browser-held transcript in local storage so it survives page
243
+ * reloads and application restarts. Use with `conversationHistory="browser"`
244
+ * when Mastra memory is intentionally disabled. `true` uses the default
245
+ * 100-message limit.
246
+ */
247
+ browserPersistence?: boolean | BrowserConversationPersistenceOptions;
248
+ /**
249
+ * Whether a message submitted during an active turn waits in the steer
250
+ * queue. Defaults to true. Set false to interrupt the active turn and start
251
+ * the replacement immediately.
252
+ */
253
+ queueMessages?: boolean;
192
254
  /**
193
255
  * Starter questions shown as one-tap buttons on the empty state.
194
256
  * When omitted, the drop-in auto-sources them from the agent's
@@ -244,6 +306,11 @@ export interface UseMastraChatOptions<
244
306
  * not need a second way to erase the active conversation.
245
307
  */
246
308
  enableClear?: boolean;
309
+ /**
310
+ * Show retry actions for the latest assistant response and failed turns.
311
+ * Defaults to true.
312
+ */
313
+ enableRetry?: boolean;
247
314
  /**
248
315
  * Surface per-message feedback controls for the destination selected by the
249
316
  * server. Genie Agent Mode posts Rating and Comment to Genie; traced agent
@@ -255,8 +322,18 @@ export interface UseMastraChatOptions<
255
322
  * `requestContext` field. A resolver is read when each turn is submitted.
256
323
  */
257
324
  requestContext?: MastraRequestContextSource<TValues>;
325
+ /** Receives the concrete model route before response generation begins. */
326
+ onModelRoute?: (route: ModelRoutePartData) => void;
327
+ /** Receives the resolved model and latest cumulative usage as model steps complete. */
328
+ onModelUsage?: (usage: ModelUsagePartData) => void;
258
329
  }
259
330
 
331
+ /** Headless Mastra chat state and handlers consumed by {@link ChatView}. */
332
+ export type UseMastraChatResult = Omit<ChatViewProps, "className"> & {
333
+ /** Whether the active browser transcript has finished restoring. */
334
+ browserPersistenceHydrated: boolean;
335
+ };
336
+
260
337
  /**
261
338
  * Headless driver for the Mastra chat experience. Owns the full
262
339
  * conversation lifecycle (streaming, tool-event tracking, approvals,
@@ -267,7 +344,7 @@ export interface UseMastraChatOptions<
267
344
  */
268
345
  export const useMastraChat = <TValues extends Record<string, unknown> = Record<string, unknown>>(
269
346
  options: UseMastraChatOptions<TValues> = {},
270
- ): Omit<ChatViewProps, "className"> => {
347
+ ): UseMastraChatResult => {
271
348
  // One client drives both the agent stream and the plugin's custom
272
349
  // routes (history / threads / models / suggestions / feedback /
273
350
  // embeds). Its identity is
@@ -290,6 +367,15 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
290
367
  ? `genie:${genieSpace}`
291
368
  : (options.agentId ?? mastraClient.defaultAgent);
292
369
  const showModelPicker = Boolean(options.showModelPicker) && !genieSpace;
370
+ const controlledModel = options.model?.trim() || undefined;
371
+ const queueMessages = options.queueMessages !== false;
372
+ const conversationHistory = options.conversationHistory ?? "memory";
373
+ const browserPersistence =
374
+ options.browserPersistence === true
375
+ ? {}
376
+ : options.browserPersistence === false
377
+ ? undefined
378
+ : options.browserPersistence;
293
379
  const modelKey = modelStorageKey(mastraClient.basePath, agentId);
294
380
  const [model, setModel] = useState(() => (showModelPicker ? readStoredModel(modelKey) : ""));
295
381
  const [reasoningEffort, setReasoningEffort] = useState<ReasoningEffort | undefined>();
@@ -301,19 +387,31 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
301
387
  [modelKey],
302
388
  );
303
389
  useEffect(() => {
304
- setModel(showModelPicker ? readStoredModel(modelKey) : "");
305
- }, [modelKey, showModelPicker]);
390
+ setModel(showModelPicker && !controlledModel ? readStoredModel(modelKey) : "");
391
+ }, [controlledModel, modelKey, showModelPicker]);
306
392
  // The selected model rides each turn as a per-call override (see
307
393
  // `runStream`), never stored on the shared client - so two threads can
308
394
  // stream under different models without clobbering each other. Mirror it
309
395
  // into a ref so the send path reads the latest selection without adding
310
396
  // `model` to its dependency list.
311
397
  const modelRef = useRef(model);
312
- modelRef.current = model;
398
+ modelRef.current = controlledModel ?? model;
313
399
  const reasoningEffortRef = useRef(reasoningEffort);
314
400
  reasoningEffortRef.current = reasoningEffort;
401
+ const aiDecideStrategyRef = useRef(options.aiDecideStrategy);
402
+ aiDecideStrategyRef.current = options.aiDecideStrategy;
315
403
  const requestContextRef = useRef(options.requestContext);
316
404
  requestContextRef.current = options.requestContext;
405
+ const modelRouteRef = useRef(options.onModelRoute);
406
+ modelRouteRef.current = options.onModelRoute;
407
+ const handleModelRoute = useCallback((route: ModelRoutePartData) => {
408
+ modelRouteRef.current?.(route);
409
+ }, []);
410
+ const modelUsageRef = useRef(options.onModelUsage);
411
+ modelUsageRef.current = options.onModelUsage;
412
+ const handleModelUsage = useCallback((usage: ModelUsagePartData) => {
413
+ modelUsageRef.current?.(usage);
414
+ }, []);
317
415
  // Built-in conversation management. When on, the chat always drives an
318
416
  // explicit client thread id (rather than leaning on the per-session
319
417
  // cookie) so it can reference, persist, and switch between the
@@ -495,7 +593,8 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
495
593
  defaultModelId,
496
594
  loading: defaultModelLoading,
497
595
  } = useMastraDefaultModel(agentId, showModelPicker);
498
- const activeModel = model || defaultModelId || undefined;
596
+ const selectedModel = controlledModel ?? model;
597
+ const activeModel = selectedModel || defaultModelId || undefined;
499
598
  const activeModelOption = models.find((option) => option.name === activeModel);
500
599
  const reasoningEfforts = activeModelOption?.reasoningEfforts ?? EMPTY_REASONING_EFFORTS;
501
600
  const reasoningDefault = defaultReasoningEffort(reasoningEfforts);
@@ -534,6 +633,40 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
534
633
  updateSession,
535
634
  writeMessages,
536
635
  } = useChatSessions(activeThreadId);
636
+ const browserTranscriptKey =
637
+ browserPersistence && persistenceReady
638
+ ? browserTranscriptStorageKey(
639
+ mastraClient.basePath,
640
+ agentId,
641
+ activeKey,
642
+ resourceScope || undefined,
643
+ )
644
+ : undefined;
645
+ const [hydratedBrowserTranscriptKey, setHydratedBrowserTranscriptKey] = useState<string>();
646
+ useEffect(() => {
647
+ setHydratedBrowserTranscriptKey(undefined);
648
+ if (!browserTranscriptKey) return;
649
+ const stored = readStoredBrowserTranscript(browserTranscriptKey);
650
+ if (stored.length > 0 && getSession(activeKey).messages.length === 0) {
651
+ writeMessages(activeKey, stored);
652
+ }
653
+ setHydratedBrowserTranscriptKey(browserTranscriptKey);
654
+ }, [activeKey, browserTranscriptKey, getSession, writeMessages]);
655
+ useEffect(() => {
656
+ if (!browserTranscriptKey || hydratedBrowserTranscriptKey !== browserTranscriptKey) {
657
+ return;
658
+ }
659
+ storeBrowserTranscript(
660
+ browserTranscriptKey,
661
+ activeSession.messages,
662
+ browserPersistence?.maxMessages,
663
+ );
664
+ }, [
665
+ activeSession.messages,
666
+ browserPersistence?.maxMessages,
667
+ browserTranscriptKey,
668
+ hydratedBrowserTranscriptKey,
669
+ ]);
537
670
  useEffect(() => {
538
671
  if (
539
672
  !enableThreads ||
@@ -642,13 +775,20 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
642
775
  [activateThread, moveSession],
643
776
  );
644
777
 
645
- const processStream = useChatStream({ getSession, updateSession, writeMessages });
778
+ const processStream = useChatStream({
779
+ getSession,
780
+ onModelRoute: handleModelRoute,
781
+ onModelUsage: handleModelUsage,
782
+ updateSession,
783
+ writeMessages,
784
+ });
646
785
  const driveStream = useCallback(
647
786
  async (
648
787
  threadId: string,
649
788
  assistantId: string,
650
789
  open: (signal: AbortSignal) => Promise<MastraStreamResponse>,
651
790
  ) => {
791
+ const turnStartedAt = new Date().toISOString();
652
792
  const controller = new AbortController();
653
793
  let token = 0;
654
794
  updateSession(threadId, (session) => {
@@ -684,6 +824,7 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
684
824
  assistantId,
685
825
  runIdRef,
686
826
  controller.signal,
827
+ turnStartedAt,
687
828
  );
688
829
  adoptAssignedThreadId();
689
830
  } catch (initialError) {
@@ -721,6 +862,7 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
721
862
  assistantId,
722
863
  runIdRef,
723
864
  controller.signal,
865
+ turnStartedAt,
724
866
  );
725
867
  } catch (reconnectError) {
726
868
  writeMessages(threadId, messagesBeforeReplay);
@@ -879,6 +1021,7 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
879
1021
  runId,
880
1022
  threadId: streamThreadId,
881
1023
  model,
1024
+ aiDecideStrategy: aiDecideStrategyRef.current,
882
1025
  reasoningEffort: turnReasoningEffort,
883
1026
  requestContext,
884
1027
  signal,
@@ -970,8 +1113,12 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
970
1113
  ...session,
971
1114
  queuedSteers: removeSteerFromQueue(session.queuedSteers, head.id),
972
1115
  }));
973
- const { message } = appendUserMessage(threadId, head.text ?? "", head.files);
974
- void runStream(threadId, message, head.requestContext);
1116
+ const { message, next } = appendUserMessage(threadId, head.text ?? "", head.files);
1117
+ void runStream(
1118
+ threadId,
1119
+ conversationRequestMessages(conversationHistory, next, message),
1120
+ head.requestContext,
1121
+ );
975
1122
  };
976
1123
 
977
1124
  // Cancel a thread's in-flight run. Defaults to the active thread (the
@@ -1128,10 +1275,9 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1128
1275
  [activeThreadId, enableThreads, getSession, noteThreadActivity, threads, writeMessages],
1129
1276
  );
1130
1277
 
1131
- // Send a message on the active thread. Submitting while a turn is already
1132
- // streaming ENQUEUES the message as a steer (it waits, no interrupt) - the
1133
- // queue drains oldest-first when the turn ends, or the user fires one early
1134
- // with `sendSteerNow`. An idle submit starts a turn right away.
1278
+ // Send a message on the active thread. The default queues submissions made
1279
+ // during an active turn. Callers that disable queuing interrupt the active
1280
+ // run and immediately start the replacement instead.
1135
1281
  const sendMessage = useCallback<ChatViewProps["sendMessage"]>(
1136
1282
  (message) => {
1137
1283
  const text = message.text ?? "";
@@ -1139,22 +1285,55 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1139
1285
  if (!text && files.length === 0) return;
1140
1286
  const threadId = activeKey;
1141
1287
  const requestContext = snapshotRequestContext(requestContextRef.current);
1142
- if (isSessionRunning(getSession(threadId))) {
1143
- updateSession(threadId, (session) => ({
1144
- ...session,
1145
- queuedSteers: enqueueSteer(session.queuedSteers, {
1146
- id: hash.id(),
1147
- text,
1148
- ...(files.length > 0 ? { files } : {}),
1149
- ...(requestContext ? { requestContext } : {}),
1150
- }),
1151
- }));
1288
+ const current = getSession(threadId);
1289
+ if (isSessionRunning(current)) {
1290
+ if (queueMessages) {
1291
+ updateSession(threadId, (session) => ({
1292
+ ...session,
1293
+ queuedSteers: enqueueSteer(session.queuedSteers, {
1294
+ id: hash.id(),
1295
+ text,
1296
+ ...(files.length > 0 ? { files } : {}),
1297
+ ...(requestContext ? { requestContext } : {}),
1298
+ }),
1299
+ }));
1300
+ return;
1301
+ }
1302
+ void (async () => {
1303
+ await interruptActiveRun(threadId);
1304
+ const replacementThreadId = resolveThreadId(threadId);
1305
+ const { message: replacement } = appendUserMessage(replacementThreadId, text, files);
1306
+ const replacementMessages =
1307
+ conversationHistory === "browser"
1308
+ ? conversationRequestMessages(
1309
+ conversationHistory,
1310
+ current.messages,
1311
+ replacement,
1312
+ current.assistantId,
1313
+ )
1314
+ : interruptedTurnMessages(current.messages, replacement);
1315
+ void runStream(replacementThreadId, replacementMessages, requestContext);
1316
+ })();
1152
1317
  return;
1153
1318
  }
1154
- const { message: userMessage } = appendUserMessage(threadId, text, files);
1155
- void runStream(threadId, userMessage, requestContext);
1319
+ const { message: userMessage, next } = appendUserMessage(threadId, text, files);
1320
+ void runStream(
1321
+ threadId,
1322
+ conversationRequestMessages(conversationHistory, next, userMessage),
1323
+ requestContext,
1324
+ );
1156
1325
  },
1157
- [appendUserMessage, runStream, activeKey, getSession, updateSession],
1326
+ [
1327
+ activeKey,
1328
+ appendUserMessage,
1329
+ getSession,
1330
+ interruptActiveRun,
1331
+ queueMessages,
1332
+ resolveThreadId,
1333
+ runStream,
1334
+ conversationHistory,
1335
+ updateSession,
1336
+ ],
1158
1337
  );
1159
1338
 
1160
1339
  // Fire a queued steer immediately, out of order. Wait for the interrupted
@@ -1176,7 +1355,15 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1176
1355
  await interruptActiveRun(threadId);
1177
1356
  const replacementThreadId = resolveThreadId(threadId);
1178
1357
  const { message } = appendUserMessage(replacementThreadId, steer.text ?? "", steer.files);
1179
- const replacementMessages = interruptedTurnMessages(current.messages, message);
1358
+ const replacementMessages =
1359
+ conversationHistory === "browser"
1360
+ ? conversationRequestMessages(
1361
+ conversationHistory,
1362
+ current.messages,
1363
+ message,
1364
+ current.assistantId,
1365
+ )
1366
+ : interruptedTurnMessages(current.messages, message);
1180
1367
  void runStream(replacementThreadId, replacementMessages, steer.requestContext);
1181
1368
  })();
1182
1369
  },
@@ -1187,6 +1374,7 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1187
1374
  interruptActiveRun,
1188
1375
  resolveThreadId,
1189
1376
  runStream,
1377
+ conversationHistory,
1190
1378
  updateSession,
1191
1379
  ],
1192
1380
  );
@@ -1366,7 +1554,11 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1366
1554
  })
1367
1555
  .then(() => {
1368
1556
  writeMessages(threadId, trimmed);
1369
- void runStream(threadId, lastUser, getSession(threadId).lastRequestContext);
1557
+ void runStream(
1558
+ threadId,
1559
+ conversationRequestMessages(conversationHistory, trimmed, lastUser),
1560
+ getSession(threadId).lastRequestContext,
1561
+ );
1370
1562
  })
1371
1563
  .catch((error: unknown) => {
1372
1564
  logger.error("regenerate cleanup error", {
@@ -1386,6 +1578,7 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1386
1578
  getSession,
1387
1579
  mastraClient,
1388
1580
  runStream,
1581
+ conversationHistory,
1389
1582
  updateSession,
1390
1583
  writeMessages,
1391
1584
  ]);
@@ -1554,18 +1747,20 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1554
1747
  onSendSteerNow: sendSteerNow,
1555
1748
  onRemoveSteer: removeSteer,
1556
1749
  onReorderSteers: reorderSteers,
1557
- regenerate,
1750
+ regenerate: options.enableRetry === false ? undefined : regenerate,
1558
1751
  onStop: stop,
1559
1752
  suggestions,
1560
1753
  followUpSuggestions: mastraClient.followUpSuggestions,
1561
1754
  followUpSuggestionLimit: mastraClient.followUpSuggestionLimit,
1755
+ showSelectedModel: options.showSelectedModel ?? false,
1756
+ metrics: options.metrics,
1562
1757
  pendingApprovalsByMessage: activeSession.pendingApprovalsByMessage,
1563
1758
  onResolveToolApproval: handleApproval,
1564
1759
  // Picker is opt-in: only hand ChatView the catalogue + change
1565
1760
  // handler when `showModelPicker` is on, otherwise the header hides
1566
1761
  // it (ChatView shows it only when both are present).
1567
1762
  models: showModelPicker ? models : undefined,
1568
- model,
1763
+ model: selectedModel,
1569
1764
  onModelChange: showModelPicker ? handleModelChange : undefined,
1570
1765
  reasoningEffort,
1571
1766
  onReasoningEffortChange: showModelPicker ? setReasoningEffort : undefined,
@@ -1575,7 +1770,17 @@ export const useMastraChat = <TValues extends Record<string, unknown> = Record<s
1575
1770
  onLoadMore: loadOlderHistory,
1576
1771
  isLoadingMore,
1577
1772
  hasMore: activeSession.hasMoreHistory,
1578
- isLoadingHistory: !persistenceReady || isLoadingHistory,
1773
+ isLoadingHistory:
1774
+ !persistenceReady ||
1775
+ isLoadingHistory ||
1776
+ Boolean(browserTranscriptKey && hydratedBrowserTranscriptKey !== browserTranscriptKey),
1777
+ browserPersistenceHydrated:
1778
+ !browserPersistence ||
1779
+ Boolean(
1780
+ persistenceReady &&
1781
+ browserTranscriptKey &&
1782
+ hydratedBrowserTranscriptKey === browserTranscriptKey,
1783
+ ),
1579
1784
  ...(mastraClient.attachments ? {} : { allowAttachments: false }),
1580
1785
  ...(enableClear ? { onClear: handleClear } : {}),
1581
1786
  threadPlacement,