@mastra/react 0.0.5 → 0.0.6-alpha.1

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/index.cjs +1554 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.js +1491 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/react.css +719 -0
  7. package/dist/src/agent/hooks.d.ts +25 -17
  8. package/dist/src/index.d.ts +1 -0
  9. package/dist/src/lib/ai-sdk/index.d.ts +3 -3
  10. package/dist/src/lib/ai-sdk/memory/resolveInitialMessages.d.ts +2 -0
  11. package/dist/src/lib/ai-sdk/transformers/AISdkNetworkTransformer.d.ts +10 -0
  12. package/dist/src/lib/ai-sdk/transformers/types.d.ts +10 -0
  13. package/dist/src/lib/ai-sdk/types.d.ts +14 -0
  14. package/dist/src/lib/ai-sdk/{toAssistantUIMessage.d.ts → utils/toAssistantUIMessage.d.ts} +1 -1
  15. package/dist/src/lib/ai-sdk/{toUIMessage.d.ts → utils/toUIMessage.d.ts} +6 -5
  16. package/dist/src/mastra-client-context.d.ts +1 -0
  17. package/dist/src/ui/Code/Code.d.ts +13 -0
  18. package/dist/src/ui/Code/highlight.d.ts +3 -0
  19. package/dist/src/ui/Code/index.d.ts +1 -0
  20. package/dist/src/ui/Entity/Entity.d.ts +13 -0
  21. package/dist/src/ui/Entity/Entity.stories.d.ts +22 -0
  22. package/dist/src/ui/Entity/Entry.d.ts +9 -0
  23. package/dist/src/ui/Entity/ToolApproval.d.ts +10 -0
  24. package/dist/src/ui/Entity/context.d.ts +10 -0
  25. package/dist/src/ui/Entity/index.d.ts +4 -0
  26. package/dist/src/ui/Entity/types.d.ts +1 -0
  27. package/dist/src/ui/Icon/Icon.d.ts +11 -0
  28. package/dist/src/ui/Icon/index.d.ts +1 -0
  29. package/dist/src/ui/IconButton/IconButton.d.ts +8 -0
  30. package/dist/src/ui/IconButton/IconButton.stories.d.ts +12 -0
  31. package/dist/src/ui/IconButton/index.d.ts +1 -0
  32. package/dist/src/ui/Icons/AgentIcon.d.ts +2 -0
  33. package/dist/src/ui/Icons/ToolsIcon.d.ts +2 -0
  34. package/dist/src/ui/Icons/WorkflowIcon.d.ts +2 -0
  35. package/dist/src/ui/Icons/index.d.ts +3 -0
  36. package/dist/src/ui/Message/Message.d.ts +25 -0
  37. package/dist/src/ui/Message/Message.stories.d.ts +13 -0
  38. package/dist/src/ui/Message/index.d.ts +1 -0
  39. package/dist/src/ui/Tooltip/Tooltip.d.ts +8 -0
  40. package/dist/src/ui/Tooltip/Tooltip.stories.d.ts +12 -0
  41. package/dist/src/ui/Tooltip/index.d.ts +1 -0
  42. package/dist/src/ui/index.d.ts +7 -0
  43. package/package.json +45 -11
  44. package/dist/index.cjs.js +0 -947
  45. package/dist/index.cjs.js.map +0 -1
  46. package/dist/index.es.js +0 -937
  47. package/dist/index.es.js.map +0 -1
  48. package/dist/src/lib/ai-sdk/toNetworkUIMessage.d.ts +0 -6
  49. package/dist/src/lib/ai-sdk/toNetworkUIMessage.test.d.ts +0 -1
  50. package/dist/src/lib/ai-sdk/toUIMessage.test.d.ts +0 -1
  51. /package/dist/src/lib/ai-sdk/{toAssistantUIMessage.test.d.ts → utils/toAssistantUIMessage.test.d.ts} +0 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,1554 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const jsxRuntime = require('react/jsx-runtime');
6
+ const react = require('react');
7
+ const clientJs = require('@mastra/client-js');
8
+ const reactDom = require('react-dom');
9
+ const lucideReact = require('lucide-react');
10
+ const tailwindMerge = require('tailwind-merge');
11
+ const hastUtilToJsxRuntime = require('hast-util-to-jsx-runtime');
12
+ const web = require('shiki/bundle/web');
13
+ const reactTooltip = require('@radix-ui/react-tooltip');
14
+
15
+ const MastraClientContext = react.createContext({});
16
+ const MastraClientProvider = ({ children, baseUrl, headers }) => {
17
+ const client = createMastraClient(baseUrl, headers);
18
+ return /* @__PURE__ */ jsxRuntime.jsx(MastraClientContext.Provider, { value: client, children });
19
+ };
20
+ const useMastraClient = () => react.useContext(MastraClientContext);
21
+ const createMastraClient = (baseUrl, mastraClientHeaders = {}) => {
22
+ return new clientJs.MastraClient({
23
+ baseUrl: baseUrl || "",
24
+ // only add the header if the baseUrl is not provided i.e it's a local dev environment
25
+ headers: !baseUrl ? { ...mastraClientHeaders, "x-mastra-dev-playground": "true" } : mastraClientHeaders
26
+ });
27
+ };
28
+
29
+ const MastraReactProvider = ({ children, baseUrl, headers }) => {
30
+ return /* @__PURE__ */ jsxRuntime.jsx(MastraClientProvider, { baseUrl, headers, children });
31
+ };
32
+
33
+ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
34
+ if (chunk.type === "workflow-start") {
35
+ return {
36
+ input: prev?.input,
37
+ status: "running",
38
+ steps: prev?.steps || {}
39
+ };
40
+ }
41
+ if (chunk.type === "workflow-canceled") {
42
+ return {
43
+ ...prev,
44
+ status: "canceled"
45
+ };
46
+ }
47
+ if (chunk.type === "workflow-finish") {
48
+ const finalStatus = chunk.payload.workflowStatus;
49
+ const prevSteps = prev?.steps ?? {};
50
+ const lastStep = Object.values(prevSteps).pop();
51
+ return {
52
+ ...prev,
53
+ status: chunk.payload.workflowStatus,
54
+ ...finalStatus === "success" && lastStep?.status === "success" ? { result: lastStep?.output } : finalStatus === "failed" && lastStep?.status === "failed" ? { error: lastStep?.error } : {}
55
+ };
56
+ }
57
+ const { stepCallId, stepName, ...newPayload } = chunk.payload ?? {};
58
+ const newSteps = {
59
+ ...prev?.steps,
60
+ [chunk.payload.id]: {
61
+ ...prev?.steps?.[chunk.payload.id],
62
+ ...newPayload
63
+ }
64
+ };
65
+ if (chunk.type === "workflow-step-start") {
66
+ return {
67
+ ...prev,
68
+ steps: newSteps
69
+ };
70
+ }
71
+ if (chunk.type === "workflow-step-suspended") {
72
+ const suspendedStepIds = Object.entries(newSteps).flatMap(
73
+ ([stepId, stepResult]) => {
74
+ if (stepResult?.status === "suspended") {
75
+ const nestedPath = stepResult?.suspendPayload?.__workflow_meta?.path;
76
+ return nestedPath ? [[stepId, ...nestedPath]] : [[stepId]];
77
+ }
78
+ return [];
79
+ }
80
+ );
81
+ return {
82
+ ...prev,
83
+ status: "suspended",
84
+ steps: newSteps,
85
+ suspendPayload: chunk.payload.suspendPayload,
86
+ suspended: suspendedStepIds
87
+ };
88
+ }
89
+ if (chunk.type === "workflow-step-waiting") {
90
+ return {
91
+ ...prev,
92
+ status: "waiting",
93
+ steps: newSteps
94
+ };
95
+ }
96
+ if (chunk.type === "workflow-step-result") {
97
+ return {
98
+ ...prev,
99
+ steps: newSteps
100
+ };
101
+ }
102
+ return prev;
103
+ };
104
+ const toUIMessage = ({ chunk, conversation, metadata }) => {
105
+ const result = [...conversation];
106
+ switch (chunk.type) {
107
+ case "tripwire": {
108
+ const newMessage = {
109
+ id: `tripwire-${chunk.runId + Date.now()}`,
110
+ role: "assistant",
111
+ parts: [
112
+ {
113
+ type: "text",
114
+ text: chunk.payload.tripwireReason
115
+ }
116
+ ],
117
+ metadata: {
118
+ ...metadata,
119
+ status: "warning"
120
+ }
121
+ };
122
+ return [...result, newMessage];
123
+ }
124
+ case "start": {
125
+ const newMessage = {
126
+ id: `start-${chunk.runId + Date.now()}`,
127
+ role: "assistant",
128
+ parts: [],
129
+ metadata
130
+ };
131
+ return [...result, newMessage];
132
+ }
133
+ case "text-start":
134
+ case "text-delta": {
135
+ const lastMessage = result[result.length - 1];
136
+ if (!lastMessage || lastMessage.role !== "assistant") return result;
137
+ const parts = [...lastMessage.parts];
138
+ let textPartIndex = parts.findIndex((part) => part.type === "text");
139
+ if (chunk.type === "text-start") {
140
+ if (textPartIndex === -1) {
141
+ parts.push({
142
+ type: "text",
143
+ text: "",
144
+ state: "streaming",
145
+ providerMetadata: chunk.payload.providerMetadata
146
+ });
147
+ }
148
+ } else {
149
+ if (textPartIndex === -1) {
150
+ parts.push({
151
+ type: "text",
152
+ text: chunk.payload.text,
153
+ state: "streaming",
154
+ providerMetadata: chunk.payload.providerMetadata
155
+ });
156
+ } else {
157
+ const textPart = parts[textPartIndex];
158
+ if (textPart.type === "text") {
159
+ parts[textPartIndex] = {
160
+ ...textPart,
161
+ text: textPart.text + chunk.payload.text,
162
+ state: "streaming"
163
+ };
164
+ }
165
+ }
166
+ }
167
+ return [
168
+ ...result.slice(0, -1),
169
+ {
170
+ ...lastMessage,
171
+ parts
172
+ }
173
+ ];
174
+ }
175
+ case "reasoning-delta": {
176
+ const lastMessage = result[result.length - 1];
177
+ if (!lastMessage || lastMessage.role !== "assistant") {
178
+ const newMessage = {
179
+ id: `reasoning-${chunk.runId + Date.now()}`,
180
+ role: "assistant",
181
+ parts: [
182
+ {
183
+ type: "reasoning",
184
+ text: chunk.payload.text,
185
+ state: "streaming",
186
+ providerMetadata: chunk.payload.providerMetadata
187
+ }
188
+ ],
189
+ metadata
190
+ };
191
+ return [...result, newMessage];
192
+ }
193
+ const parts = [...lastMessage.parts];
194
+ let reasoningPartIndex = parts.findIndex((part) => part.type === "reasoning");
195
+ if (reasoningPartIndex === -1) {
196
+ parts.push({
197
+ type: "reasoning",
198
+ text: chunk.payload.text,
199
+ state: "streaming",
200
+ providerMetadata: chunk.payload.providerMetadata
201
+ });
202
+ } else {
203
+ const reasoningPart = parts[reasoningPartIndex];
204
+ if (reasoningPart.type === "reasoning") {
205
+ parts[reasoningPartIndex] = {
206
+ ...reasoningPart,
207
+ text: reasoningPart.text + chunk.payload.text,
208
+ state: "streaming"
209
+ };
210
+ }
211
+ }
212
+ return [
213
+ ...result.slice(0, -1),
214
+ {
215
+ ...lastMessage,
216
+ parts
217
+ }
218
+ ];
219
+ }
220
+ case "tool-call": {
221
+ const lastMessage = result[result.length - 1];
222
+ if (!lastMessage || lastMessage.role !== "assistant") {
223
+ const newMessage = {
224
+ id: `tool-call-${chunk.runId + Date.now()}`,
225
+ role: "assistant",
226
+ parts: [
227
+ {
228
+ type: "dynamic-tool",
229
+ toolName: chunk.payload.toolName,
230
+ toolCallId: chunk.payload.toolCallId,
231
+ state: "input-available",
232
+ input: chunk.payload.args,
233
+ callProviderMetadata: chunk.payload.providerMetadata
234
+ }
235
+ ],
236
+ metadata
237
+ };
238
+ return [...result, newMessage];
239
+ }
240
+ const parts = [...lastMessage.parts];
241
+ parts.push({
242
+ type: "dynamic-tool",
243
+ toolName: chunk.payload.toolName,
244
+ toolCallId: chunk.payload.toolCallId,
245
+ state: "input-available",
246
+ input: chunk.payload.args,
247
+ callProviderMetadata: chunk.payload.providerMetadata
248
+ });
249
+ return [
250
+ ...result.slice(0, -1),
251
+ {
252
+ ...lastMessage,
253
+ parts
254
+ }
255
+ ];
256
+ }
257
+ case "tool-result": {
258
+ const lastMessage = result[result.length - 1];
259
+ if (!lastMessage || lastMessage.role !== "assistant") return result;
260
+ const parts = [...lastMessage.parts];
261
+ const toolPartIndex = parts.findIndex(
262
+ (part) => part.type === "dynamic-tool" && "toolCallId" in part && part.toolCallId === chunk.payload.toolCallId
263
+ );
264
+ if (toolPartIndex !== -1) {
265
+ const toolPart = parts[toolPartIndex];
266
+ if (toolPart.type === "dynamic-tool") {
267
+ if (chunk.payload.isError) {
268
+ parts[toolPartIndex] = {
269
+ type: "dynamic-tool",
270
+ toolName: toolPart.toolName,
271
+ toolCallId: toolPart.toolCallId,
272
+ state: "output-error",
273
+ input: toolPart.input,
274
+ errorText: String(chunk.payload.result),
275
+ callProviderMetadata: chunk.payload.providerMetadata
276
+ };
277
+ } else {
278
+ const isWorkflow = Boolean(chunk.payload.result?.result?.steps);
279
+ parts[toolPartIndex] = {
280
+ type: "dynamic-tool",
281
+ toolName: toolPart.toolName,
282
+ toolCallId: toolPart.toolCallId,
283
+ state: "output-available",
284
+ input: toolPart.input,
285
+ output: isWorkflow ? chunk.payload.result?.result : chunk.payload.result,
286
+ callProviderMetadata: chunk.payload.providerMetadata
287
+ };
288
+ }
289
+ }
290
+ }
291
+ return [
292
+ ...result.slice(0, -1),
293
+ {
294
+ ...lastMessage,
295
+ parts
296
+ }
297
+ ];
298
+ }
299
+ case "tool-output": {
300
+ const lastMessage = result[result.length - 1];
301
+ if (!lastMessage || lastMessage.role !== "assistant") return result;
302
+ const parts = [...lastMessage.parts];
303
+ const toolPartIndex = parts.findIndex(
304
+ (part) => part.type === "dynamic-tool" && "toolCallId" in part && part.toolCallId === chunk.payload.toolCallId
305
+ );
306
+ if (toolPartIndex !== -1) {
307
+ const toolPart = parts[toolPartIndex];
308
+ if (toolPart.type === "dynamic-tool") {
309
+ if (chunk.payload.output?.type?.startsWith("workflow-")) {
310
+ const existingWorkflowState = toolPart.output || {};
311
+ const updatedWorkflowState = mapWorkflowStreamChunkToWatchResult(
312
+ existingWorkflowState,
313
+ chunk.payload.output
314
+ );
315
+ parts[toolPartIndex] = {
316
+ ...toolPart,
317
+ output: updatedWorkflowState
318
+ };
319
+ } else {
320
+ const currentOutput = toolPart.output || [];
321
+ const existingOutput = Array.isArray(currentOutput) ? currentOutput : [];
322
+ parts[toolPartIndex] = {
323
+ ...toolPart,
324
+ output: [...existingOutput, chunk.payload.output]
325
+ };
326
+ }
327
+ }
328
+ }
329
+ return [
330
+ ...result.slice(0, -1),
331
+ {
332
+ ...lastMessage,
333
+ parts
334
+ }
335
+ ];
336
+ }
337
+ case "source": {
338
+ const lastMessage = result[result.length - 1];
339
+ if (!lastMessage || lastMessage.role !== "assistant") return result;
340
+ const parts = [...lastMessage.parts];
341
+ if (chunk.payload.sourceType === "url") {
342
+ parts.push({
343
+ type: "source-url",
344
+ sourceId: chunk.payload.id,
345
+ url: chunk.payload.url || "",
346
+ title: chunk.payload.title,
347
+ providerMetadata: chunk.payload.providerMetadata
348
+ });
349
+ } else if (chunk.payload.sourceType === "document") {
350
+ parts.push({
351
+ type: "source-document",
352
+ sourceId: chunk.payload.id,
353
+ mediaType: chunk.payload.mimeType || "application/octet-stream",
354
+ title: chunk.payload.title,
355
+ filename: chunk.payload.filename,
356
+ providerMetadata: chunk.payload.providerMetadata
357
+ });
358
+ }
359
+ return [
360
+ ...result.slice(0, -1),
361
+ {
362
+ ...lastMessage,
363
+ parts
364
+ }
365
+ ];
366
+ }
367
+ case "file": {
368
+ const lastMessage = result[result.length - 1];
369
+ if (!lastMessage || lastMessage.role !== "assistant") return result;
370
+ const parts = [...lastMessage.parts];
371
+ let url;
372
+ if (typeof chunk.payload.data === "string") {
373
+ url = chunk.payload.base64 ? `data:${chunk.payload.mimeType};base64,${chunk.payload.data}` : `data:${chunk.payload.mimeType},${encodeURIComponent(chunk.payload.data)}`;
374
+ } else {
375
+ const base64 = btoa(String.fromCharCode(...chunk.payload.data));
376
+ url = `data:${chunk.payload.mimeType};base64,${base64}`;
377
+ }
378
+ parts.push({
379
+ type: "file",
380
+ mediaType: chunk.payload.mimeType,
381
+ url,
382
+ providerMetadata: chunk.payload.providerMetadata
383
+ });
384
+ return [
385
+ ...result.slice(0, -1),
386
+ {
387
+ ...lastMessage,
388
+ parts
389
+ }
390
+ ];
391
+ }
392
+ case "finish": {
393
+ const lastMessage = result[result.length - 1];
394
+ if (!lastMessage || lastMessage.role !== "assistant") return result;
395
+ const parts = lastMessage.parts.map((part) => {
396
+ if (part.type === "text" && part.state === "streaming") {
397
+ return { ...part, state: "done" };
398
+ }
399
+ if (part.type === "reasoning" && part.state === "streaming") {
400
+ return { ...part, state: "done" };
401
+ }
402
+ return part;
403
+ });
404
+ return [
405
+ ...result.slice(0, -1),
406
+ {
407
+ ...lastMessage,
408
+ parts
409
+ }
410
+ ];
411
+ }
412
+ case "error": {
413
+ const newMessage = {
414
+ id: `error-${chunk.runId + Date.now()}`,
415
+ role: "assistant",
416
+ parts: [
417
+ {
418
+ type: "text",
419
+ text: typeof chunk.payload.error === "string" ? chunk.payload.error : JSON.stringify(chunk.payload.error)
420
+ }
421
+ ],
422
+ metadata: {
423
+ ...metadata,
424
+ status: "error"
425
+ }
426
+ };
427
+ return [...result, newMessage];
428
+ }
429
+ // For all other chunk types, return conversation unchanged
430
+ default:
431
+ return result;
432
+ }
433
+ };
434
+
435
+ const toAssistantUIMessage = (message) => {
436
+ const extendedMessage = message;
437
+ const content = message.parts.map((part) => {
438
+ if (part.type === "text") {
439
+ return {
440
+ type: "text",
441
+ text: part.text,
442
+ metadata: message.metadata
443
+ };
444
+ }
445
+ if (part.type === "reasoning") {
446
+ return {
447
+ type: "reasoning",
448
+ text: part.text,
449
+ metadata: message.metadata
450
+ };
451
+ }
452
+ if (part.type === "source-url") {
453
+ return {
454
+ type: "source",
455
+ sourceType: "url",
456
+ id: part.sourceId,
457
+ url: part.url,
458
+ title: part.title,
459
+ metadata: message.metadata
460
+ };
461
+ }
462
+ if (part.type === "source-document") {
463
+ return {
464
+ type: "file",
465
+ filename: part.filename,
466
+ mimeType: part.mediaType,
467
+ data: "",
468
+ // Source documents don't have inline data
469
+ metadata: message.metadata
470
+ };
471
+ }
472
+ if (part.type === "file") {
473
+ return {
474
+ type: "file",
475
+ mimeType: part.mediaType,
476
+ data: part.url,
477
+ // Use URL as data source
478
+ metadata: message.metadata
479
+ };
480
+ }
481
+ if (part.type === "dynamic-tool") {
482
+ const baseToolCall = {
483
+ type: "tool-call",
484
+ toolCallId: part.toolCallId,
485
+ toolName: part.toolName,
486
+ argsText: JSON.stringify(part.input),
487
+ args: part.input,
488
+ metadata: message.metadata
489
+ };
490
+ if (part.state === "output-error" && "errorText" in part) {
491
+ return { ...baseToolCall, result: part.errorText, isError: true };
492
+ }
493
+ if ("output" in part) {
494
+ return { ...baseToolCall, result: part.output };
495
+ }
496
+ return baseToolCall;
497
+ }
498
+ if (part.type.startsWith("tool-") && part.state !== "input-available") {
499
+ const toolName = "toolName" in part && typeof part.toolName === "string" ? part.toolName : part.type.substring(5);
500
+ const baseToolCall = {
501
+ type: "tool-call",
502
+ toolCallId: "toolCallId" in part && typeof part.toolCallId === "string" ? part.toolCallId : "",
503
+ toolName,
504
+ argsText: "input" in part ? JSON.stringify(part.input) : "{}",
505
+ args: "input" in part ? part.input : {},
506
+ metadata: message.metadata
507
+ };
508
+ if ("output" in part) {
509
+ return { ...baseToolCall, result: part.output };
510
+ } else if ("error" in part) {
511
+ return { ...baseToolCall, result: part.error, isError: true };
512
+ }
513
+ return baseToolCall;
514
+ }
515
+ return {
516
+ type: "text",
517
+ text: "",
518
+ metadata: message.metadata
519
+ };
520
+ });
521
+ let status;
522
+ if (message.role === "assistant" && content.length > 0) {
523
+ const hasStreamingParts = message.parts.some(
524
+ (part) => part.type === "text" && "state" in part && part.state === "streaming" || part.type === "reasoning" && "state" in part && part.state === "streaming"
525
+ );
526
+ const hasToolCalls = message.parts.some((part) => part.type === "dynamic-tool" || part.type.startsWith("tool-"));
527
+ const hasInputAvailableTools = message.parts.some(
528
+ (part) => part.type === "dynamic-tool" && part.state === "input-available"
529
+ );
530
+ const hasErrorTools = message.parts.some(
531
+ (part) => part.type === "dynamic-tool" && part.state === "output-error" || part.type.startsWith("tool-") && "error" in part
532
+ );
533
+ if (hasStreamingParts) {
534
+ status = { type: "running" };
535
+ } else if (hasInputAvailableTools && hasToolCalls) {
536
+ status = { type: "requires-action", reason: "tool-calls" };
537
+ } else if (hasErrorTools) {
538
+ status = { type: "incomplete", reason: "error" };
539
+ } else {
540
+ status = { type: "complete", reason: "stop" };
541
+ }
542
+ }
543
+ const threadMessage = {
544
+ role: message.role,
545
+ content,
546
+ id: message.id,
547
+ createdAt: extendedMessage.createdAt,
548
+ status,
549
+ attachments: extendedMessage.experimental_attachments
550
+ };
551
+ return threadMessage;
552
+ };
553
+
554
+ class AISdkNetworkTransformer {
555
+ transform({ chunk, conversation, metadata }) {
556
+ const newConversation = [...conversation];
557
+ if (chunk.type === "routing-agent-text-delta") {
558
+ return this.handleRoutingAgentConversation(chunk, newConversation);
559
+ }
560
+ if (chunk.type.startsWith("agent-execution-")) {
561
+ return this.handleAgentConversation(chunk, newConversation, metadata);
562
+ }
563
+ if (chunk.type.startsWith("workflow-execution-")) {
564
+ return this.handleWorkflowConversation(chunk, newConversation, metadata);
565
+ }
566
+ if (chunk.type.startsWith("tool-execution-")) {
567
+ return this.handleToolConversation(chunk, newConversation, metadata);
568
+ }
569
+ if (chunk.type === "network-execution-event-step-finish") {
570
+ const lastMessage = newConversation[newConversation.length - 1];
571
+ if (!lastMessage || lastMessage.role !== "assistant") return newConversation;
572
+ const agentChunk = chunk.payload;
573
+ const parts = [...lastMessage.parts];
574
+ const textPartIndex = parts.findIndex((part) => part.type === "text");
575
+ if (textPartIndex === -1) {
576
+ parts.push({
577
+ type: "text",
578
+ text: agentChunk.result,
579
+ state: "done"
580
+ });
581
+ return [
582
+ ...newConversation.slice(0, -1),
583
+ {
584
+ ...lastMessage,
585
+ parts
586
+ }
587
+ ];
588
+ }
589
+ const textPart = parts[textPartIndex];
590
+ if (textPart.type === "text") {
591
+ parts[textPartIndex] = {
592
+ ...textPart,
593
+ state: "done"
594
+ };
595
+ return [
596
+ ...newConversation.slice(0, -1),
597
+ {
598
+ ...lastMessage,
599
+ parts
600
+ }
601
+ ];
602
+ }
603
+ return newConversation;
604
+ }
605
+ return newConversation;
606
+ }
607
+ handleRoutingAgentConversation = (chunk, newConversation) => {
608
+ const lastMessage = newConversation[newConversation.length - 1];
609
+ if (!lastMessage || lastMessage.role !== "assistant") return newConversation;
610
+ const agentChunk = chunk.payload;
611
+ const parts = [...lastMessage.parts];
612
+ const textPartIndex = parts.findIndex((part) => part.type === "text");
613
+ if (textPartIndex === -1) {
614
+ parts.push({
615
+ type: "text",
616
+ text: agentChunk.text,
617
+ state: "streaming"
618
+ });
619
+ return [
620
+ ...newConversation.slice(0, -1),
621
+ {
622
+ ...lastMessage,
623
+ parts
624
+ }
625
+ ];
626
+ }
627
+ const textPart = parts[textPartIndex];
628
+ if (textPart.type === "text") {
629
+ parts[textPartIndex] = {
630
+ ...textPart,
631
+ text: textPart.text + agentChunk.text,
632
+ state: "streaming"
633
+ };
634
+ return [
635
+ ...newConversation.slice(0, -1),
636
+ {
637
+ ...lastMessage,
638
+ parts
639
+ }
640
+ ];
641
+ }
642
+ return newConversation;
643
+ };
644
+ handleAgentConversation = (chunk, newConversation, metadata) => {
645
+ if (chunk.type === "agent-execution-start") {
646
+ const primitiveId = chunk.payload?.args?.primitiveId;
647
+ const runId = chunk.payload.runId;
648
+ if (!primitiveId || !runId) return newConversation;
649
+ const newMessage = {
650
+ id: `agent-execution-start-${runId}-${Date.now()}`,
651
+ role: "assistant",
652
+ parts: [
653
+ {
654
+ type: "dynamic-tool",
655
+ toolName: primitiveId,
656
+ toolCallId: runId,
657
+ state: "input-available",
658
+ input: chunk.payload.args
659
+ }
660
+ ],
661
+ metadata: {
662
+ ...metadata,
663
+ selectionReason: chunk.payload?.args?.selectionReason || "",
664
+ agentInput: chunk.payload?.args?.task,
665
+ mode: "network",
666
+ from: "AGENT"
667
+ }
668
+ };
669
+ return [...newConversation, newMessage];
670
+ }
671
+ if (chunk.type === "agent-execution-end") {
672
+ const lastMessage = newConversation[newConversation.length - 1];
673
+ if (!lastMessage || lastMessage.role !== "assistant") return newConversation;
674
+ const parts = [...lastMessage.parts];
675
+ const toolPartIndex = parts.findIndex((part) => part.type === "dynamic-tool");
676
+ if (toolPartIndex !== -1) {
677
+ const toolPart = parts[toolPartIndex];
678
+ if (toolPart.type === "dynamic-tool") {
679
+ const currentOutput = toolPart.output;
680
+ parts[toolPartIndex] = {
681
+ type: "dynamic-tool",
682
+ toolName: toolPart.toolName,
683
+ toolCallId: toolPart.toolCallId,
684
+ state: "output-available",
685
+ input: toolPart.input,
686
+ output: {
687
+ ...currentOutput,
688
+ result: currentOutput?.result || chunk.payload?.result || ""
689
+ }
690
+ };
691
+ }
692
+ }
693
+ return [
694
+ ...newConversation.slice(0, -1),
695
+ {
696
+ ...lastMessage,
697
+ parts
698
+ }
699
+ ];
700
+ }
701
+ if (chunk.type.startsWith("agent-execution-event-")) {
702
+ const lastMessage = newConversation[newConversation.length - 1];
703
+ if (!lastMessage || lastMessage.role !== "assistant") return newConversation;
704
+ const agentChunk = chunk.payload;
705
+ const parts = [...lastMessage.parts];
706
+ const toolPartIndex = parts.findIndex((part) => part.type === "dynamic-tool");
707
+ if (toolPartIndex === -1) return newConversation;
708
+ const toolPart = parts[toolPartIndex];
709
+ if (agentChunk.type === "text-delta") {
710
+ const childMessages = toolPart?.output?.childMessages || [];
711
+ const lastChildMessage = childMessages[childMessages.length - 1];
712
+ const textMessage = { type: "text", content: (lastChildMessage?.content || "") + agentChunk.payload.text };
713
+ const nextMessages = lastChildMessage?.type === "text" ? [...childMessages.slice(0, -1), textMessage] : [...childMessages, textMessage];
714
+ parts[toolPartIndex] = {
715
+ ...toolPart,
716
+ output: {
717
+ childMessages: nextMessages
718
+ }
719
+ };
720
+ } else if (agentChunk.type === "tool-call") {
721
+ const childMessages = toolPart?.output?.childMessages || [];
722
+ parts[toolPartIndex] = {
723
+ ...toolPart,
724
+ output: {
725
+ ...toolPart?.output,
726
+ childMessages: [
727
+ ...childMessages,
728
+ {
729
+ type: "tool",
730
+ toolCallId: agentChunk.payload.toolCallId,
731
+ toolName: agentChunk.payload.toolName,
732
+ args: agentChunk.payload.args
733
+ }
734
+ ]
735
+ }
736
+ };
737
+ } else if (agentChunk.type === "tool-output") {
738
+ if (agentChunk.payload?.output?.type?.startsWith("workflow-")) {
739
+ const childMessages = toolPart?.output?.childMessages || [];
740
+ const lastToolIndex = childMessages.length - 1;
741
+ const currentMessage = childMessages[lastToolIndex];
742
+ const actualExistingWorkflowState = currentMessage?.toolOutput || {};
743
+ const updatedWorkflowState = mapWorkflowStreamChunkToWatchResult(
744
+ actualExistingWorkflowState,
745
+ agentChunk.payload.output
746
+ );
747
+ if (lastToolIndex >= 0 && childMessages[lastToolIndex]?.type === "tool") {
748
+ parts[toolPartIndex] = {
749
+ ...toolPart,
750
+ output: {
751
+ ...toolPart?.output,
752
+ childMessages: [
753
+ ...childMessages.slice(0, -1),
754
+ {
755
+ ...currentMessage,
756
+ toolOutput: updatedWorkflowState
757
+ }
758
+ ]
759
+ }
760
+ };
761
+ }
762
+ }
763
+ } else if (agentChunk.type === "tool-result") {
764
+ const childMessages = toolPart?.output?.childMessages || [];
765
+ const lastToolIndex = childMessages.length - 1;
766
+ const isWorkflow = Boolean(agentChunk.payload?.result?.result?.steps);
767
+ if (lastToolIndex >= 0 && childMessages[lastToolIndex]?.type === "tool") {
768
+ parts[toolPartIndex] = {
769
+ ...toolPart,
770
+ output: {
771
+ ...toolPart?.output,
772
+ childMessages: [
773
+ ...childMessages.slice(0, -1),
774
+ {
775
+ ...childMessages[lastToolIndex],
776
+ toolOutput: isWorkflow ? agentChunk.payload.result.result : agentChunk.payload.result
777
+ }
778
+ ]
779
+ }
780
+ };
781
+ }
782
+ }
783
+ return [
784
+ ...newConversation.slice(0, -1),
785
+ {
786
+ ...lastMessage,
787
+ parts
788
+ }
789
+ ];
790
+ }
791
+ return newConversation;
792
+ };
793
+ handleWorkflowConversation = (chunk, newConversation, metadata) => {
794
+ if (chunk.type === "workflow-execution-start") {
795
+ const primitiveId = chunk.payload?.args?.primitiveId;
796
+ const runId = chunk.payload.runId;
797
+ if (!primitiveId || !runId) return newConversation;
798
+ let agentInput;
799
+ try {
800
+ agentInput = JSON.parse(chunk?.payload?.args?.prompt);
801
+ } catch (e) {
802
+ agentInput = chunk?.payload?.args?.prompt;
803
+ }
804
+ const newMessage = {
805
+ id: `workflow-start-${runId}-${Date.now()}`,
806
+ role: "assistant",
807
+ parts: [
808
+ {
809
+ type: "dynamic-tool",
810
+ toolName: primitiveId,
811
+ toolCallId: runId,
812
+ state: "input-available",
813
+ input: chunk.payload.args
814
+ }
815
+ ],
816
+ metadata: {
817
+ ...metadata,
818
+ selectionReason: chunk.payload?.args?.selectionReason || "",
819
+ from: "WORKFLOW",
820
+ mode: "network",
821
+ agentInput
822
+ }
823
+ };
824
+ return [...newConversation, newMessage];
825
+ }
826
+ if (chunk.type.startsWith("workflow-execution-event-")) {
827
+ const lastMessage = newConversation[newConversation.length - 1];
828
+ if (!lastMessage || lastMessage.role !== "assistant") return newConversation;
829
+ const parts = [...lastMessage.parts];
830
+ const toolPartIndex = parts.findIndex((part) => part.type === "dynamic-tool");
831
+ if (toolPartIndex === -1) return newConversation;
832
+ const toolPart = parts[toolPartIndex];
833
+ if (toolPart.type !== "dynamic-tool") return newConversation;
834
+ const existingWorkflowState = toolPart.output || {};
835
+ const updatedWorkflowState = mapWorkflowStreamChunkToWatchResult(existingWorkflowState, chunk.payload);
836
+ parts[toolPartIndex] = {
837
+ ...toolPart,
838
+ output: updatedWorkflowState
839
+ };
840
+ return [
841
+ ...newConversation.slice(0, -1),
842
+ {
843
+ ...lastMessage,
844
+ parts
845
+ }
846
+ ];
847
+ }
848
+ return newConversation;
849
+ };
850
+ handleToolConversation = (chunk, newConversation, metadata) => {
851
+ if (chunk.type === "tool-execution-start") {
852
+ const { args: argsData } = chunk.payload;
853
+ const lastMessage = newConversation[newConversation.length - 1];
854
+ const nestedArgs = argsData.args || {};
855
+ if (!lastMessage || lastMessage.role !== "assistant") {
856
+ const newMessage = {
857
+ id: `tool-start-${chunk.runId}-${Date.now()}`,
858
+ role: "assistant",
859
+ parts: [
860
+ {
861
+ type: "dynamic-tool",
862
+ toolName: argsData.toolName || "unknown",
863
+ toolCallId: argsData.toolCallId || "unknown",
864
+ state: "input-available",
865
+ input: nestedArgs
866
+ }
867
+ ],
868
+ metadata: {
869
+ ...metadata,
870
+ selectionReason: metadata?.mode === "network" ? metadata.selectionReason || argsData.selectionReason : "",
871
+ mode: "network",
872
+ agentInput: nestedArgs
873
+ }
874
+ };
875
+ return [...newConversation, newMessage];
876
+ }
877
+ const parts = [...lastMessage.parts];
878
+ parts.push({
879
+ type: "dynamic-tool",
880
+ toolName: argsData.toolName || "unknown",
881
+ toolCallId: argsData.toolCallId || "unknown",
882
+ state: "input-available",
883
+ input: nestedArgs
884
+ });
885
+ return [
886
+ ...newConversation.slice(0, -1),
887
+ {
888
+ ...lastMessage,
889
+ parts
890
+ }
891
+ ];
892
+ }
893
+ if (chunk.type === "tool-execution-end") {
894
+ const lastMessage = newConversation[newConversation.length - 1];
895
+ if (!lastMessage || lastMessage.role !== "assistant") return newConversation;
896
+ const parts = [...lastMessage.parts];
897
+ const toolPartIndex = parts.findIndex(
898
+ (part) => part.type === "dynamic-tool" && "toolCallId" in part && part.toolCallId === chunk.payload.toolCallId
899
+ );
900
+ if (toolPartIndex !== -1) {
901
+ const toolPart = parts[toolPartIndex];
902
+ if (toolPart.type === "dynamic-tool") {
903
+ const currentOutput = toolPart.output;
904
+ parts[toolPartIndex] = {
905
+ type: "dynamic-tool",
906
+ toolName: toolPart.toolName,
907
+ toolCallId: toolPart.toolCallId,
908
+ state: "output-available",
909
+ input: toolPart.input,
910
+ output: currentOutput?.result || chunk.payload?.result || ""
911
+ };
912
+ }
913
+ }
914
+ return [
915
+ ...newConversation.slice(0, -1),
916
+ {
917
+ ...lastMessage,
918
+ parts
919
+ }
920
+ ];
921
+ }
922
+ return newConversation;
923
+ };
924
+ }
925
+
926
+ const resolveInitialMessages = (messages) => {
927
+ return messages.map((message) => {
928
+ const networkPart = message.parts.find((part) => part.type === "text" && part.text.includes('"isNetwork":true'));
929
+ if (networkPart && networkPart.type === "text") {
930
+ try {
931
+ const json = JSON.parse(networkPart.text);
932
+ if (json.isNetwork === true) {
933
+ const selectionReason = json.selectionReason || "";
934
+ const primitiveType = json.primitiveType || "";
935
+ const primitiveId = json.primitiveId || "";
936
+ const finalResult = json.finalResult;
937
+ const toolCalls = finalResult?.toolCalls || [];
938
+ const childMessages = [];
939
+ for (const toolCall of toolCalls) {
940
+ if (toolCall.type === "tool-call" && toolCall.payload) {
941
+ const toolCallId = toolCall.payload.toolCallId;
942
+ let toolResult;
943
+ for (const message2 of finalResult?.messages || []) {
944
+ for (const part of message2.content || []) {
945
+ if (typeof part === "object" && part.type === "tool-result" && part.toolCallId === toolCallId) {
946
+ toolResult = part;
947
+ break;
948
+ }
949
+ }
950
+ }
951
+ const isWorkflow = Boolean(toolResult?.result?.result?.steps);
952
+ childMessages.push({
953
+ type: "tool",
954
+ toolCallId: toolCall.payload.toolCallId,
955
+ toolName: toolCall.payload.toolName,
956
+ args: toolCall.payload.args,
957
+ toolOutput: isWorkflow ? toolResult?.result?.result : toolResult?.result
958
+ });
959
+ }
960
+ }
961
+ if (finalResult && finalResult.text) {
962
+ childMessages.push({
963
+ type: "text",
964
+ content: finalResult.text
965
+ });
966
+ }
967
+ const result = {
968
+ childMessages,
969
+ result: finalResult?.text || ""
970
+ };
971
+ console.log("json", json);
972
+ const nextMessage = {
973
+ role: "assistant",
974
+ parts: [
975
+ {
976
+ type: "dynamic-tool",
977
+ toolCallId: primitiveId,
978
+ toolName: primitiveId,
979
+ state: "output-available",
980
+ input: json.input,
981
+ output: result
982
+ }
983
+ ],
984
+ id: message.id,
985
+ metadata: {
986
+ ...message.metadata,
987
+ mode: "network",
988
+ selectionReason,
989
+ agentInput: json.input,
990
+ from: primitiveType === "agent" ? "AGENT" : "WORKFLOW"
991
+ }
992
+ };
993
+ return nextMessage;
994
+ }
995
+ } catch (error) {
996
+ return message;
997
+ }
998
+ }
999
+ return message;
1000
+ });
1001
+ };
1002
+
1003
+ const useChat = ({ agentId, initializeMessages }) => {
1004
+ const [messages, setMessages] = react.useState(
1005
+ () => resolveInitialMessages(initializeMessages?.() || [])
1006
+ );
1007
+ const baseClient = useMastraClient();
1008
+ const [isRunning, setIsRunning] = react.useState(false);
1009
+ const generate = async ({
1010
+ coreUserMessages,
1011
+ runtimeContext,
1012
+ threadId,
1013
+ modelSettings,
1014
+ signal,
1015
+ onFinish
1016
+ }) => {
1017
+ const {
1018
+ frequencyPenalty,
1019
+ presencePenalty,
1020
+ maxRetries,
1021
+ maxTokens,
1022
+ temperature,
1023
+ topK,
1024
+ topP,
1025
+ instructions,
1026
+ providerOptions,
1027
+ maxSteps
1028
+ } = modelSettings || {};
1029
+ setIsRunning(true);
1030
+ const clientWithAbort = new clientJs.MastraClient({
1031
+ ...baseClient.options,
1032
+ abortSignal: signal
1033
+ });
1034
+ const agent = clientWithAbort.getAgent(agentId);
1035
+ const response = await agent.generate({
1036
+ messages: coreUserMessages,
1037
+ runId: agentId,
1038
+ maxSteps,
1039
+ modelSettings: {
1040
+ frequencyPenalty,
1041
+ presencePenalty,
1042
+ maxRetries,
1043
+ maxOutputTokens: maxTokens,
1044
+ temperature,
1045
+ topK,
1046
+ topP
1047
+ },
1048
+ instructions,
1049
+ runtimeContext,
1050
+ ...threadId ? { threadId, resourceId: agentId } : {},
1051
+ providerOptions
1052
+ });
1053
+ setIsRunning(false);
1054
+ if (response && "uiMessages" in response.response && response.response.uiMessages) {
1055
+ onFinish?.(response.response.uiMessages);
1056
+ const mastraUIMessages = (response.response.uiMessages || []).map((message) => ({
1057
+ ...message,
1058
+ metadata: {
1059
+ mode: "generate"
1060
+ }
1061
+ }));
1062
+ setMessages((prev) => [...prev, ...mastraUIMessages]);
1063
+ }
1064
+ };
1065
+ const stream = async ({ coreUserMessages, runtimeContext, threadId, onChunk, modelSettings, signal }) => {
1066
+ const {
1067
+ frequencyPenalty,
1068
+ presencePenalty,
1069
+ maxRetries,
1070
+ maxTokens,
1071
+ temperature,
1072
+ topK,
1073
+ topP,
1074
+ instructions,
1075
+ providerOptions,
1076
+ maxSteps
1077
+ } = modelSettings || {};
1078
+ setIsRunning(true);
1079
+ const clientWithAbort = new clientJs.MastraClient({
1080
+ ...baseClient.options,
1081
+ abortSignal: signal
1082
+ });
1083
+ const agent = clientWithAbort.getAgent(agentId);
1084
+ const response = await agent.stream({
1085
+ messages: coreUserMessages,
1086
+ runId: agentId,
1087
+ maxSteps,
1088
+ modelSettings: {
1089
+ frequencyPenalty,
1090
+ presencePenalty,
1091
+ maxRetries,
1092
+ maxOutputTokens: maxTokens,
1093
+ temperature,
1094
+ topK,
1095
+ topP
1096
+ },
1097
+ instructions,
1098
+ runtimeContext,
1099
+ ...threadId ? { threadId, resourceId: agentId } : {},
1100
+ providerOptions
1101
+ });
1102
+ if (!response.body) {
1103
+ setIsRunning(false);
1104
+ throw new Error("[Stream] No response body");
1105
+ }
1106
+ await response.processDataStream({
1107
+ onChunk: async (chunk) => {
1108
+ reactDom.flushSync(() => {
1109
+ setMessages((prev) => toUIMessage({ chunk, conversation: prev, metadata: { mode: "stream" } }));
1110
+ });
1111
+ onChunk?.(chunk);
1112
+ }
1113
+ });
1114
+ setIsRunning(false);
1115
+ };
1116
+ const network = async ({
1117
+ coreUserMessages,
1118
+ runtimeContext,
1119
+ threadId,
1120
+ onNetworkChunk,
1121
+ modelSettings,
1122
+ signal
1123
+ }) => {
1124
+ const { frequencyPenalty, presencePenalty, maxRetries, maxTokens, temperature, topK, topP, maxSteps } = modelSettings || {};
1125
+ setIsRunning(true);
1126
+ const clientWithAbort = new clientJs.MastraClient({
1127
+ ...baseClient.options,
1128
+ abortSignal: signal
1129
+ });
1130
+ const agent = clientWithAbort.getAgent(agentId);
1131
+ const response = await agent.network({
1132
+ messages: coreUserMessages,
1133
+ maxSteps,
1134
+ modelSettings: {
1135
+ frequencyPenalty,
1136
+ presencePenalty,
1137
+ maxRetries,
1138
+ maxOutputTokens: maxTokens,
1139
+ temperature,
1140
+ topK,
1141
+ topP
1142
+ },
1143
+ runId: agentId,
1144
+ runtimeContext,
1145
+ ...threadId ? { thread: threadId, resourceId: agentId } : {}
1146
+ });
1147
+ const transformer = new AISdkNetworkTransformer();
1148
+ await response.processDataStream({
1149
+ onChunk: async (chunk) => {
1150
+ reactDom.flushSync(() => {
1151
+ setMessages((prev) => transformer.transform({ chunk, conversation: prev, metadata: { mode: "network" } }));
1152
+ });
1153
+ onNetworkChunk?.(chunk);
1154
+ }
1155
+ });
1156
+ setIsRunning(false);
1157
+ };
1158
+ const sendMessage = async ({ mode = "stream", ...args }) => {
1159
+ const nextMessage = { role: "user", content: [{ type: "text", text: args.message }] };
1160
+ const messages2 = args.coreUserMessages ? [nextMessage, ...args.coreUserMessages] : [nextMessage];
1161
+ setMessages((s) => [...s, { role: "user", parts: [{ type: "text", text: args.message }] }]);
1162
+ if (mode === "generate") {
1163
+ await generate({ ...args, coreUserMessages: messages2 });
1164
+ } else if (mode === "stream") {
1165
+ await stream({ ...args, coreUserMessages: messages2 });
1166
+ } else if (mode === "network") {
1167
+ await network({ ...args, coreUserMessages: messages2 });
1168
+ }
1169
+ };
1170
+ return {
1171
+ setMessages,
1172
+ sendMessage,
1173
+ isRunning,
1174
+ messages,
1175
+ cancelRun: () => setIsRunning(false)
1176
+ };
1177
+ };
1178
+
1179
+ const EntityContext = react.createContext({
1180
+ expanded: false,
1181
+ setExpanded: () => {
1182
+ },
1183
+ variant: "initial",
1184
+ disabled: false
1185
+ });
1186
+ const EntityProvider = EntityContext.Provider;
1187
+ const useEntity = () => react.useContext(EntityContext);
1188
+
1189
+ const IconSizes = {
1190
+ sm: "mastra:[&>svg]:size-3",
1191
+ md: "mastra:[&>svg]:size-4",
1192
+ lg: "mastra:[&>svg]:size-5"
1193
+ };
1194
+ const Icon = ({ children, className, size = "md", ...props }) => {
1195
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || IconSizes[size], ...props, children });
1196
+ };
1197
+
1198
+ const Entity = ({
1199
+ className,
1200
+ variant = "initial",
1201
+ initialExpanded = false,
1202
+ disabled = false,
1203
+ ...props
1204
+ }) => {
1205
+ const [expanded, setExpanded] = react.useState(initialExpanded);
1206
+ return /* @__PURE__ */ jsxRuntime.jsx(EntityProvider, { value: { expanded, setExpanded, variant, disabled }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, ...props }) });
1207
+ };
1208
+ const EntityTriggerClass = tailwindMerge.twMerge(
1209
+ "mastra:aria-disabled:cursor-not-allowed mastra:aria-disabled:bg-surface5 mastra:aria-disabled:text-text3",
1210
+ "mastra:aria-expanded:rounded-b-none mastra:aria-expanded:border-b-0",
1211
+ "mastra:bg-surface3 mastra:text-text6 mastra:hover:bg-surface4 mastra:active:bg-surface5",
1212
+ "mastra:rounded-lg mastra:py-2 mastra:px-4 mastra:border mastra:border-border1",
1213
+ "mastra:cursor-pointer mastra:inline-flex mastra:items-center mastra:gap-1 mastra:font-mono"
1214
+ );
1215
+ const EntityTriggerVariantClasses = {
1216
+ agent: "mastra:[&_svg.mastra-icon]:text-accent1",
1217
+ workflow: "mastra:[&_svg.mastra-icon]:text-accent3",
1218
+ tool: "mastra:[&_svg.mastra-icon]:text-accent6",
1219
+ memory: "mastra:[&_svg.mastra-icon]:text-accent2",
1220
+ initial: "mastra:[&_svg.mastra-icon]:text-text3"
1221
+ };
1222
+ const EntityTrigger = ({ className, children, ...props }) => {
1223
+ const { expanded, setExpanded, variant, disabled } = useEntity();
1224
+ const handleClick = (e) => {
1225
+ if (disabled) return;
1226
+ setExpanded(!expanded);
1227
+ props?.onClick?.(e);
1228
+ };
1229
+ return /* @__PURE__ */ jsxRuntime.jsx(
1230
+ "button",
1231
+ {
1232
+ className: className || tailwindMerge.twMerge(EntityTriggerClass, !disabled && EntityTriggerVariantClasses[variant]),
1233
+ ...props,
1234
+ onClick: handleClick,
1235
+ "aria-expanded": expanded,
1236
+ "aria-disabled": disabled,
1237
+ children
1238
+ }
1239
+ );
1240
+ };
1241
+ const EntityContentClass = tailwindMerge.twMerge(
1242
+ "mastra:space-y-4",
1243
+ "mastra:rounded-lg mastra:rounded-tl-none mastra:p-4 mastra:border mastra:border-border1 mastra:-mt-[0.5px]",
1244
+ "mastra:bg-surface3 mastra:text-text6"
1245
+ );
1246
+ const EntityContent = ({ className, ...props }) => {
1247
+ const { expanded } = useEntity();
1248
+ if (!expanded) return null;
1249
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || EntityContentClass, ...props });
1250
+ };
1251
+ const EntityCaret = ({ className, ...props }) => {
1252
+ const { expanded } = useEntity();
1253
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(
1254
+ lucideReact.ChevronDownIcon,
1255
+ {
1256
+ className: tailwindMerge.twMerge(
1257
+ `mastra:text-text3 mastra:transition-transform mastra:duration-200 mastra:ease-in-out`,
1258
+ expanded ? "mastra:rotate-0" : "mastra:-rotate-90",
1259
+ className
1260
+ ),
1261
+ ...props
1262
+ }
1263
+ ) });
1264
+ };
1265
+
1266
+ const ToolApprovalClass = tailwindMerge.twMerge(
1267
+ "mastra:rounded-lg mastra:border mastra:border-border1 mastra:max-w-1/2 mastra:mt-2",
1268
+ "mastra:bg-surface3 mastra:text-text6"
1269
+ );
1270
+ const ToolApproval = ({ className, ...props }) => {
1271
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || ToolApprovalClass, ...props });
1272
+ };
1273
+ const ToolApprovalTitleClass = tailwindMerge.twMerge("mastra:text-text6 mastra:inline-flex mastra:items-center mastra:gap-1");
1274
+ const ToolApprovalTitle = ({ className, ...props }) => {
1275
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || ToolApprovalTitleClass, ...props });
1276
+ };
1277
+ const ToolApprovalHeaderClass = tailwindMerge.twMerge(
1278
+ "mastra:flex mastra:justify-between mastra:items-center mastra:gap-2",
1279
+ "mastra:border-b mastra:border-border1 mastra:px-4 mastra:py-2"
1280
+ );
1281
+ const ToolApprovalHeader = ({ className, ...props }) => {
1282
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || ToolApprovalHeaderClass, ...props });
1283
+ };
1284
+ const ToolApprovalContentClass = tailwindMerge.twMerge("mastra:text-text6 mastra:p-4");
1285
+ const ToolApprovalContent = ({ className, ...props }) => {
1286
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || ToolApprovalContentClass, ...props });
1287
+ };
1288
+ const ToolApprovalActionsClass = tailwindMerge.twMerge("mastra:flex mastra:gap-2 mastra:items-center");
1289
+ const ToolApprovalActions = ({ className, ...props }) => {
1290
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || ToolApprovalActionsClass, ...props });
1291
+ };
1292
+
1293
+ const EntryClass = "mastra:space-y-2";
1294
+ const Entry = ({ className, ...props }) => {
1295
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || EntryClass, ...props });
1296
+ };
1297
+ const EntryTitleClass = "mastra:font-mono mastra:text-sm mastra:text-text3";
1298
+ const EntryTitle = ({ className, as: Root = "h3", ...props }) => {
1299
+ return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: className || EntryTitleClass, ...props });
1300
+ };
1301
+
1302
+ async function highlight(code, lang) {
1303
+ const out = await web.codeToHast(code, {
1304
+ lang,
1305
+ theme: "dracula-soft"
1306
+ });
1307
+ return hastUtilToJsxRuntime.toJsxRuntime(out, {
1308
+ Fragment: react.Fragment,
1309
+ jsx: jsxRuntime.jsx,
1310
+ jsxs: jsxRuntime.jsxs
1311
+ });
1312
+ }
1313
+
1314
+ const Tooltip = ({ children }) => {
1315
+ return /* @__PURE__ */ jsxRuntime.jsx(reactTooltip.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(reactTooltip.Root, { children }) });
1316
+ };
1317
+ const TooltipContentClass = "mastra:bg-surface4 mastra:text-text6 mastra mastra:rounded-lg mastra:py-1 mastra:px-2 mastra:text-xs mastra:border mastra:border-border1 mastra-tooltip-enter";
1318
+ const TooltipContent = ({ children, className, ...props }) => {
1319
+ return /* @__PURE__ */ jsxRuntime.jsx(reactTooltip.TooltipPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(reactTooltip.TooltipContent, { className: className || TooltipContentClass, ...props, children }) });
1320
+ };
1321
+ const TooltipTrigger = (props) => {
1322
+ return /* @__PURE__ */ jsxRuntime.jsx(reactTooltip.TooltipTrigger, { ...props, asChild: true });
1323
+ };
1324
+
1325
+ const IconButtonClass = "mastra:text-text3 mastra:hover:text-text6 mastra:active:text-text6 mastra:hover:bg-surface4 mastra:active:bg-surface5 mastra:rounded-md mastra:cursor-pointer";
1326
+ const IconButton = ({ children, tooltip, size = "md", className, ...props }) => {
1327
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
1328
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
1329
+ "button",
1330
+ {
1331
+ ...props,
1332
+ className: className || tailwindMerge.twMerge(IconButtonClass, size === "md" && "mastra:p-0.5", size === "lg" && "mastra:p-1"),
1333
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size, children })
1334
+ }
1335
+ ) }),
1336
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltip })
1337
+ ] });
1338
+ };
1339
+
1340
+ const CodeBlockClass = "mastra:rounded-lg mastra:[&>pre]:p-4 mastra:overflow-hidden mastra:[&>pre]:!bg-surface4 mastra:[&>pre>code]:leading-5 mastra:relative";
1341
+ const CodeBlock = ({ code, language, className, cta }) => {
1342
+ const [nodes, setNodes] = react.useState(null);
1343
+ react.useLayoutEffect(() => {
1344
+ void highlight(code, language).then(setNodes);
1345
+ }, [language]);
1346
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className || CodeBlockClass, children: [
1347
+ nodes ?? null,
1348
+ cta
1349
+ ] });
1350
+ };
1351
+ const CodeCopyButton = ({ code }) => {
1352
+ const [isCopied, setIsCopied] = react.useState(false);
1353
+ const handleCopy = () => {
1354
+ navigator.clipboard.writeText(code);
1355
+ setIsCopied(true);
1356
+ setTimeout(() => setIsCopied(false), 2e3);
1357
+ };
1358
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mastra:absolute mastra:top-2 mastra:right-2", children: /* @__PURE__ */ jsxRuntime.jsx(IconButton, { tooltip: "Copy", onClick: handleCopy, children: isCopied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) }) });
1359
+ };
1360
+
1361
+ const AgentIcon = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
1362
+ "svg",
1363
+ {
1364
+ width: "17",
1365
+ height: "16",
1366
+ viewBox: "0 0 17 16",
1367
+ fill: "none",
1368
+ xmlns: "http://www.w3.org/2000/svg",
1369
+ ...props,
1370
+ className: tailwindMerge.twMerge("mastra-icon", className),
1371
+ children: [
1372
+ /* @__PURE__ */ jsxRuntime.jsx(
1373
+ "path",
1374
+ {
1375
+ fillRule: "evenodd",
1376
+ clipRule: "evenodd",
1377
+ d: "M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",
1378
+ fill: "currentColor"
1379
+ }
1380
+ ),
1381
+ /* @__PURE__ */ jsxRuntime.jsx(
1382
+ "path",
1383
+ {
1384
+ d: "M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",
1385
+ fill: "currentColor"
1386
+ }
1387
+ )
1388
+ ]
1389
+ }
1390
+ );
1391
+
1392
+ const ToolsIcon = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1393
+ "svg",
1394
+ {
1395
+ width: "17",
1396
+ height: "16",
1397
+ viewBox: "0 0 17 16",
1398
+ fill: "none",
1399
+ xmlns: "http://www.w3.org/2000/svg",
1400
+ ...props,
1401
+ className: tailwindMerge.twMerge("mastra-icon", className),
1402
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1403
+ "path",
1404
+ {
1405
+ fillRule: "evenodd",
1406
+ clipRule: "evenodd",
1407
+ d: "M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",
1408
+ fill: "currentColor"
1409
+ }
1410
+ )
1411
+ }
1412
+ );
1413
+
1414
+ const WorkflowIcon = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1415
+ "svg",
1416
+ {
1417
+ width: "17",
1418
+ height: "16",
1419
+ viewBox: "0 0 17 16",
1420
+ fill: "none",
1421
+ xmlns: "http://www.w3.org/2000/svg",
1422
+ ...props,
1423
+ className: tailwindMerge.twMerge("mastra-icon", className),
1424
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1425
+ "path",
1426
+ {
1427
+ fillRule: "evenodd",
1428
+ clipRule: "evenodd",
1429
+ d: "M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",
1430
+ fill: "currentColor"
1431
+ }
1432
+ )
1433
+ }
1434
+ );
1435
+
1436
+ const MessageClass = "mastra:flex mastra:flex-col mastra:w-full mastra:py-4 mastra:gap-2 mastra:group";
1437
+ const Message = ({ position, className, children, ...props }) => {
1438
+ return /* @__PURE__ */ jsxRuntime.jsx(
1439
+ "div",
1440
+ {
1441
+ className: className || tailwindMerge.twMerge(
1442
+ MessageClass,
1443
+ position === "left" ? "" : "mastra:items-end mastra:[&_.mastra-message-content]:bg-surface4 mastra:[&_.mastra-message-content]:px-4"
1444
+ ),
1445
+ ...props,
1446
+ children
1447
+ }
1448
+ );
1449
+ };
1450
+ const MessageContentClass = "mastra:max-w-4/5 mastra:py-2 mastra:text-text6 mastra:rounded-lg mastra-message-content mastra:text-md";
1451
+ const MessageContent = ({ children, className, isStreaming, ...props }) => {
1452
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className || MessageContentClass, ...props, children: [
1453
+ children,
1454
+ isStreaming && /* @__PURE__ */ jsxRuntime.jsx(MessageStreaming, {})
1455
+ ] });
1456
+ };
1457
+ const MessageActionsClass = "mastra:gap-2 mastra:flex mastra:opacity-0 mastra:group-hover:opacity-100 mastra:group-focus-within:opacity-100 mastra:items-center";
1458
+ const MessageActions = ({ children, className, ...props }) => {
1459
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || MessageActionsClass, ...props, children });
1460
+ };
1461
+ const MessageUsagesClass = "mastra:flex mastra:gap-2 mastra:items-center";
1462
+ const MessageUsages = ({ children, className, ...props }) => {
1463
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || MessageUsagesClass, ...props, children });
1464
+ };
1465
+ const MessageUsageClass = "mastra:flex mastra:gap-2 mastra:items-center mastra:font-mono mastra:text-xs mastra:bg-surface3 mastra:rounded-lg mastra:px-2 mastra:py-1";
1466
+ const MessageUsage = ({ children, className, ...props }) => {
1467
+ return /* @__PURE__ */ jsxRuntime.jsx("dl", { className: className || MessageUsageClass, ...props, children });
1468
+ };
1469
+ const MessageUsageEntryClass = "mastra:text-text3 mastra:text-xs mastra:flex mastra:gap-1 mastra:items-center";
1470
+ const MessageUsageEntry = ({ children, className, ...props }) => {
1471
+ return /* @__PURE__ */ jsxRuntime.jsx("dt", { className: className || MessageUsageEntryClass, ...props, children });
1472
+ };
1473
+ const MessageUsageValueClass = "mastra:text-text6 mastra:text-xs";
1474
+ const MessageUsageValue = ({ children, className, ...props }) => {
1475
+ return /* @__PURE__ */ jsxRuntime.jsx("dd", { className: className || MessageUsageValueClass, ...props, children });
1476
+ };
1477
+ const MessageListClass = "mastra:overflow-y-auto mastra:h-full mastra-list";
1478
+ const MessageList = ({ children, className, ...props }) => {
1479
+ const listRef = react.useRef(null);
1480
+ react.useEffect(() => {
1481
+ const scrollToBottom = () => {
1482
+ if (!listRef.current) return;
1483
+ listRef.current.scrollTo({ top: listRef.current.scrollHeight, behavior: "smooth" });
1484
+ };
1485
+ requestAnimationFrame(scrollToBottom);
1486
+ });
1487
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className || MessageListClass, ...props, ref: listRef, children });
1488
+ };
1489
+ const MessageStreamingClass = "mastra:inline-block mastra:w-[2px] mastra:h-[1em] mastra:bg-text5 mastra:ml-0.5 mastra:align-text-bottom mastra:animate-pulse";
1490
+ const MessageStreaming = ({ className, ...props }) => {
1491
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: className || MessageStreamingClass, ...props });
1492
+ };
1493
+
1494
+ exports.AgentIcon = AgentIcon;
1495
+ exports.CodeBlock = CodeBlock;
1496
+ exports.CodeBlockClass = CodeBlockClass;
1497
+ exports.CodeCopyButton = CodeCopyButton;
1498
+ exports.Entity = Entity;
1499
+ exports.EntityCaret = EntityCaret;
1500
+ exports.EntityContent = EntityContent;
1501
+ exports.EntityContentClass = EntityContentClass;
1502
+ exports.EntityTrigger = EntityTrigger;
1503
+ exports.EntityTriggerClass = EntityTriggerClass;
1504
+ exports.EntityTriggerVariantClasses = EntityTriggerVariantClasses;
1505
+ exports.Entry = Entry;
1506
+ exports.EntryClass = EntryClass;
1507
+ exports.EntryTitle = EntryTitle;
1508
+ exports.EntryTitleClass = EntryTitleClass;
1509
+ exports.Icon = Icon;
1510
+ exports.IconButton = IconButton;
1511
+ exports.IconButtonClass = IconButtonClass;
1512
+ exports.IconSizes = IconSizes;
1513
+ exports.MastraReactProvider = MastraReactProvider;
1514
+ exports.Message = Message;
1515
+ exports.MessageActions = MessageActions;
1516
+ exports.MessageActionsClass = MessageActionsClass;
1517
+ exports.MessageClass = MessageClass;
1518
+ exports.MessageContent = MessageContent;
1519
+ exports.MessageContentClass = MessageContentClass;
1520
+ exports.MessageList = MessageList;
1521
+ exports.MessageListClass = MessageListClass;
1522
+ exports.MessageStreaming = MessageStreaming;
1523
+ exports.MessageStreamingClass = MessageStreamingClass;
1524
+ exports.MessageUsage = MessageUsage;
1525
+ exports.MessageUsageClass = MessageUsageClass;
1526
+ exports.MessageUsageEntry = MessageUsageEntry;
1527
+ exports.MessageUsageEntryClass = MessageUsageEntryClass;
1528
+ exports.MessageUsageValue = MessageUsageValue;
1529
+ exports.MessageUsageValueClass = MessageUsageValueClass;
1530
+ exports.MessageUsages = MessageUsages;
1531
+ exports.MessageUsagesClass = MessageUsagesClass;
1532
+ exports.ToolApproval = ToolApproval;
1533
+ exports.ToolApprovalActions = ToolApprovalActions;
1534
+ exports.ToolApprovalActionsClass = ToolApprovalActionsClass;
1535
+ exports.ToolApprovalClass = ToolApprovalClass;
1536
+ exports.ToolApprovalContent = ToolApprovalContent;
1537
+ exports.ToolApprovalContentClass = ToolApprovalContentClass;
1538
+ exports.ToolApprovalHeader = ToolApprovalHeader;
1539
+ exports.ToolApprovalHeaderClass = ToolApprovalHeaderClass;
1540
+ exports.ToolApprovalTitle = ToolApprovalTitle;
1541
+ exports.ToolApprovalTitleClass = ToolApprovalTitleClass;
1542
+ exports.ToolsIcon = ToolsIcon;
1543
+ exports.Tooltip = Tooltip;
1544
+ exports.TooltipContent = TooltipContent;
1545
+ exports.TooltipContentClass = TooltipContentClass;
1546
+ exports.TooltipTrigger = TooltipTrigger;
1547
+ exports.WorkflowIcon = WorkflowIcon;
1548
+ exports.mapWorkflowStreamChunkToWatchResult = mapWorkflowStreamChunkToWatchResult;
1549
+ exports.toAssistantUIMessage = toAssistantUIMessage;
1550
+ exports.toUIMessage = toUIMessage;
1551
+ exports.useChat = useChat;
1552
+ exports.useEntity = useEntity;
1553
+ exports.useMastraClient = useMastraClient;
1554
+ //# sourceMappingURL=index.cjs.map