@mastra/playground-ui 6.1.2 → 6.1.3-alpha.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.es.js CHANGED
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import React__default, { createContext, useContext, forwardRef, memo, useState, useEffect, useRef, useCallback, useMemo, Fragment as Fragment$1, Suspense, useId, startTransition, isValidElement } from 'react';
4
4
  import { MastraClient } from '@mastra/client-js';
5
5
  import { useMessage, MessagePrimitive, ActionBarPrimitive, useAttachment, AttachmentPrimitive, useComposerRuntime, ComposerPrimitive, useComposer, ThreadPrimitive, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechSynthesisAdapter, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
6
- import { CheckIcon as CheckIcon$1, CopyIcon, Check, Copy, ChevronUpIcon, X, Braces, Loader2, Network, ChevronDown, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Brackets, PlusIcon, TrashIcon, Plus, ChevronDownIcon, Minus, Maximize, CirclePause, Circle, StopCircle, BrainIcon, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, GaugeIcon, EditIcon, LoaderCircle, ExternalLinkIcon, Users, Brain, NetworkIcon, SearchIcon, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, XIcon, ChevronsRightIcon, ArrowUpIcon, ArrowDownIcon, AlignLeftIcon, AlignJustifyIcon, CircleAlertIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, AlertTriangleIcon, FrownIcon, ChevronUp, ChevronsLeftRight, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, ListTreeIcon, ArrowRightToLineIcon, CoinsIcon, EyeIcon, ChevronsLeftRightEllipsisIcon, PanelTopIcon, HashIcon, PanelLeftIcon } from 'lucide-react';
6
+ import { CheckIcon as CheckIcon$1, CopyIcon, Check, Copy, ChevronUpIcon, X, Share2, Braces, Loader2, Network, ChevronDown, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Brackets, PlusIcon, TrashIcon, Plus, ChevronDownIcon, Minus, Maximize, CirclePause, Circle, StopCircle, BrainIcon, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, GaugeIcon, EditIcon, LoaderCircle, ExternalLinkIcon, Users, Brain, NetworkIcon, SearchIcon, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, XIcon, ChevronsRightIcon, ArrowUpIcon, ArrowDownIcon, AlignLeftIcon, AlignJustifyIcon, CircleAlertIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, AlertTriangleIcon, FrownIcon, ChevronUp, ChevronsLeftRight, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, ListTreeIcon, ArrowRightToLineIcon, CoinsIcon, EyeIcon, ChevronsLeftRightEllipsisIcon, PanelTopIcon, HashIcon, PanelLeftIcon } from 'lucide-react';
7
7
  import { Slot } from '@radix-ui/react-slot';
8
8
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
9
9
  import { TooltipProvider as TooltipProvider$1 } from '@radix-ui/react-tooltip';
@@ -18,6 +18,7 @@ import { tags } from '@lezer/highlight';
18
18
  import { draculaInit } from '@uiw/codemirror-theme-dracula';
19
19
  import CodeMirror, { EditorView } from '@uiw/react-codemirror';
20
20
  import { toast } from 'sonner';
21
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
21
22
  import { useDebouncedCallback } from 'use-debounce';
22
23
  import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';
23
24
  import './index.css';export * from '@tanstack/react-query';
@@ -26,7 +27,6 @@ import '@xyflow/react/dist/style.css';
26
27
  import Dagre from '@dagrejs/dagre';
27
28
  import { Highlight, themes } from 'prism-react-renderer';
28
29
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
29
- import * as DialogPrimitive from '@radix-ui/react-dialog';
30
30
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
31
31
  import prettier from 'prettier';
32
32
  import prettierPluginBabel from 'prettier/plugins/babel';
@@ -4340,45 +4340,173 @@ const BadgeWrapper = ({
4340
4340
  initialCollapsed = true,
4341
4341
  icon,
4342
4342
  title,
4343
- collapsible = true
4343
+ collapsible = true,
4344
+ extraInfo
4344
4345
  }) => {
4345
4346
  const [isCollapsed, setIsCollapsed] = useState(initialCollapsed);
4346
- return /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
4347
- /* @__PURE__ */ jsxs(
4348
- "button",
4347
+ return /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
4348
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-2 items-center justify-between", children: [
4349
+ /* @__PURE__ */ jsxs(
4350
+ "button",
4351
+ {
4352
+ onClick: collapsible ? () => setIsCollapsed((s) => !s) : void 0,
4353
+ className: "flex items-center gap-2 disabled:cursor-not-allowed",
4354
+ disabled: !collapsible,
4355
+ type: "button",
4356
+ children: [
4357
+ /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: cn("transition-all", isCollapsed ? "rotate-90" : "rotate-180") }) }),
4358
+ /* @__PURE__ */ jsx(Badge$1, { icon, children: title })
4359
+ ]
4360
+ }
4361
+ ),
4362
+ extraInfo
4363
+ ] }),
4364
+ !isCollapsed && /* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx("div", { className: "p-4 rounded-lg bg-surface2 flex flex-col gap-4", children }) })
4365
+ ] });
4366
+ };
4367
+
4368
+ const Dialog = DialogPrimitive.Root;
4369
+ const DialogPortal = DialogPrimitive.Portal;
4370
+ const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4371
+ DialogPrimitive.Overlay,
4372
+ {
4373
+ ref,
4374
+ className: cn(
4375
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
4376
+ className
4377
+ ),
4378
+ ...props
4379
+ }
4380
+ ));
4381
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
4382
+ const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
4383
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
4384
+ /* @__PURE__ */ jsxs(
4385
+ DialogPrimitive.Content,
4386
+ {
4387
+ ref,
4388
+ className: cn(
4389
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
4390
+ className
4391
+ ),
4392
+ ...props,
4393
+ children: [
4394
+ children,
4395
+ /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
4396
+ /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
4397
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
4398
+ ] })
4399
+ ]
4400
+ }
4401
+ )
4402
+ ] }));
4403
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
4404
+ const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
4405
+ DialogHeader.displayName = "DialogHeader";
4406
+ const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4407
+ DialogPrimitive.Title,
4408
+ {
4409
+ ref,
4410
+ className: clsx("text-lg font-semibold leading-none tracking-tight", className),
4411
+ ...props
4412
+ }
4413
+ ));
4414
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
4415
+ const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
4416
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
4417
+
4418
+ const variants = {
4419
+ "header-md": "text-header-md leading-header-md",
4420
+ "ui-lg": "text-ui-lg leading-ui-lg",
4421
+ "ui-md": "text-ui-md leading-ui-md",
4422
+ "ui-sm": "text-ui-sm leading-ui-sm",
4423
+ "ui-xs": "text-ui-xs leading-ui-xs"
4424
+ };
4425
+ const fonts = {
4426
+ mono: "font-mono"
4427
+ };
4428
+ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
4429
+ return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
4430
+ };
4431
+
4432
+ const NetworkChoiceMetadata = ({ selectionReason, open, onOpenChange, input }) => {
4433
+ let inputSlot = null;
4434
+ if (input) {
4435
+ try {
4436
+ inputSlot = typeof input === "object" ? /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: input }) : /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: JSON.parse(input) });
4437
+ } catch {
4438
+ inputSlot = /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: input });
4439
+ }
4440
+ }
4441
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "border-border1 border-sm bg-surface3 p-0 gap-0", children: [
4442
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "p-4", children: [
4443
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Agent Network Metadata" }),
4444
+ /* @__PURE__ */ jsx(DialogDescription, { children: "View the metadata of the agent's network choice." })
4445
+ ] }),
4446
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 p-4 border-t-sm border-border1", children: [
4447
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
4448
+ /* @__PURE__ */ jsx(Txt, { className: "text-icon3", children: "Selection Reason" }),
4449
+ /* @__PURE__ */ jsx("div", { className: "text-icon6 text-ui-md", children: selectionReason })
4450
+ ] }),
4451
+ inputSlot && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
4452
+ /* @__PURE__ */ jsx(Txt, { className: "text-icon3", children: "Input" }),
4453
+ /* @__PURE__ */ jsx("div", { className: "text-icon6 text-ui-md", children: inputSlot })
4454
+ ] })
4455
+ ] })
4456
+ ] }) });
4457
+ };
4458
+ const NetworkChoiceMetadataDialogTrigger = ({
4459
+ selectionReason,
4460
+ input
4461
+ }) => {
4462
+ const [isOpen, setIsOpen] = useState(false);
4463
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4464
+ /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Show selection reason", side: "top", onClick: () => setIsOpen((s) => !s), children: /* @__PURE__ */ jsx(Share2, { className: "text-icon3 size-5" }) }),
4465
+ /* @__PURE__ */ jsx(
4466
+ NetworkChoiceMetadata,
4349
4467
  {
4350
- onClick: collapsible ? () => setIsCollapsed((s) => !s) : void 0,
4351
- className: "flex items-center gap-2 disabled:cursor-not-allowed",
4352
- disabled: !collapsible,
4353
- type: "button",
4354
- children: [
4355
- /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: cn("transition-all", isCollapsed ? "rotate-90" : "rotate-180") }) }),
4356
- /* @__PURE__ */ jsx(Badge$1, { icon, children: title })
4357
- ]
4468
+ selectionReason: selectionReason || "",
4469
+ open: isOpen,
4470
+ onOpenChange: setIsOpen,
4471
+ input
4358
4472
  }
4359
- ),
4360
- !isCollapsed && /* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx("div", { className: "p-4 rounded-lg bg-surface2", children }) })
4473
+ )
4361
4474
  ] });
4362
4475
  };
4363
4476
 
4364
- const ToolBadge = ({ toolName, argsText, result }) => {
4365
- let argSlot;
4477
+ const ToolBadge = ({ toolName, args, result, networkMetadata }) => {
4478
+ let argSlot = null;
4366
4479
  try {
4367
- const parsedArgs = JSON.parse(argsText);
4368
- argSlot = /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: parsedArgs });
4480
+ const { __mastraMetadata: _, ...formattedArgs } = typeof args === "object" ? args : JSON.parse(args);
4481
+ argSlot = /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: formattedArgs });
4369
4482
  } catch {
4370
- argSlot = /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: argsText });
4483
+ argSlot = /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: args });
4371
4484
  }
4372
- return /* @__PURE__ */ jsx(BadgeWrapper, { icon: /* @__PURE__ */ jsx(ToolsIcon, { className: "text-[#ECB047]" }), title: toolName, children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
4373
- /* @__PURE__ */ jsxs("div", { children: [
4374
- /* @__PURE__ */ jsx("p", { className: "font-medium pb-2", children: "Tool arguments" }),
4375
- argSlot
4376
- ] }),
4377
- result !== void 0 && /* @__PURE__ */ jsxs("div", { children: [
4378
- /* @__PURE__ */ jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
4379
- typeof result === "string" ? /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: result })
4380
- ] })
4381
- ] }) });
4485
+ let resultSlot = typeof result === "string" ? /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: result });
4486
+ return /* @__PURE__ */ jsx(
4487
+ BadgeWrapper,
4488
+ {
4489
+ icon: /* @__PURE__ */ jsx(ToolsIcon, { className: "text-[#ECB047]" }),
4490
+ title: toolName,
4491
+ extraInfo: networkMetadata && /* @__PURE__ */ jsx(
4492
+ NetworkChoiceMetadataDialogTrigger,
4493
+ {
4494
+ selectionReason: networkMetadata?.selectionReason || "",
4495
+ input: networkMetadata?.input
4496
+ }
4497
+ ),
4498
+ children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
4499
+ /* @__PURE__ */ jsxs("div", { children: [
4500
+ /* @__PURE__ */ jsx("p", { className: "font-medium pb-2", children: "Tool arguments" }),
4501
+ argSlot
4502
+ ] }),
4503
+ result !== void 0 && /* @__PURE__ */ jsxs("div", { children: [
4504
+ /* @__PURE__ */ jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
4505
+ resultSlot
4506
+ ] })
4507
+ ] })
4508
+ }
4509
+ );
4382
4510
  };
4383
4511
 
4384
4512
  function Skeleton({ className, ...props }) {
@@ -4390,7 +4518,8 @@ const useWorkflow = (workflowId) => {
4390
4518
  return useQuery({
4391
4519
  queryKey: ["workflow", workflowId],
4392
4520
  queryFn: () => client.getWorkflow(workflowId).details(),
4393
- retry: false
4521
+ retry: false,
4522
+ refetchOnWindowFocus: false
4394
4523
  });
4395
4524
  };
4396
4525
  const useLegacyWorkflow = (workflowId) => {
@@ -5269,56 +5398,6 @@ const CollapsibleTrigger = (props) => {
5269
5398
  };
5270
5399
  const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
5271
5400
 
5272
- const Dialog = DialogPrimitive.Root;
5273
- const DialogPortal = DialogPrimitive.Portal;
5274
- const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5275
- DialogPrimitive.Overlay,
5276
- {
5277
- ref,
5278
- className: cn(
5279
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
5280
- className
5281
- ),
5282
- ...props
5283
- }
5284
- ));
5285
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
5286
- const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
5287
- /* @__PURE__ */ jsx(DialogOverlay, {}),
5288
- /* @__PURE__ */ jsxs(
5289
- DialogPrimitive.Content,
5290
- {
5291
- ref,
5292
- className: cn(
5293
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
5294
- className
5295
- ),
5296
- ...props,
5297
- children: [
5298
- children,
5299
- /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
5300
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
5301
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
5302
- ] })
5303
- ]
5304
- }
5305
- )
5306
- ] }));
5307
- DialogContent.displayName = DialogPrimitive.Content.displayName;
5308
- const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
5309
- DialogHeader.displayName = "DialogHeader";
5310
- const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5311
- DialogPrimitive.Title,
5312
- {
5313
- ref,
5314
- className: clsx("text-lg font-semibold leading-none tracking-tight", className),
5315
- ...props
5316
- }
5317
- ));
5318
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
5319
- const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
5320
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
5321
-
5322
5401
  const useAutoscroll = (ref, { enabled = true }) => {
5323
5402
  const shouldScrollRef = useRef(enabled);
5324
5403
  React__default.useEffect(() => {
@@ -5470,9 +5549,9 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
5470
5549
  ...chunk.payload
5471
5550
  },
5472
5551
  workflowState: {
5473
- ...prev.payload.workflowState,
5552
+ ...prev?.payload?.workflowState,
5474
5553
  steps: {
5475
- ...prev.payload.workflowState.steps,
5554
+ ...prev?.payload?.workflowState?.steps,
5476
5555
  [chunk.payload.id]: {
5477
5556
  ...current || {},
5478
5557
  ...chunk.payload
@@ -5488,17 +5567,17 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
5488
5567
  return {
5489
5568
  ...prev,
5490
5569
  payload: {
5491
- ...prev.payload,
5570
+ ...prev?.payload,
5492
5571
  currentStep: {
5493
5572
  id: chunk.payload.id,
5494
- ...prev?.payload?.currentStep || {},
5573
+ ...prev?.payload?.currentStep,
5495
5574
  ...chunk.payload
5496
5575
  },
5497
5576
  workflowState: {
5498
- ...prev.payload.workflowState,
5577
+ ...prev?.payload?.workflowState,
5499
5578
  status: "suspended",
5500
5579
  steps: {
5501
- ...prev.payload.workflowState.steps,
5580
+ ...prev?.payload?.workflowState?.steps,
5502
5581
  [chunk.payload.id]: {
5503
5582
  ...current || {},
5504
5583
  ...chunk.payload
@@ -5514,17 +5593,17 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
5514
5593
  return {
5515
5594
  ...prev,
5516
5595
  payload: {
5517
- ...prev.payload,
5596
+ ...prev?.payload,
5518
5597
  currentStep: {
5519
5598
  id: chunk.payload.id,
5520
5599
  ...prev?.payload?.currentStep || {},
5521
5600
  ...chunk.payload
5522
5601
  },
5523
5602
  workflowState: {
5524
- ...prev.payload.workflowState,
5603
+ ...prev?.payload?.workflowState,
5525
5604
  status: "waiting",
5526
5605
  steps: {
5527
- ...prev.payload.workflowState.steps,
5606
+ ...prev?.payload?.workflowState?.steps,
5528
5607
  [chunk.payload.id]: {
5529
5608
  ...current,
5530
5609
  ...chunk.payload
@@ -5538,20 +5617,20 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
5538
5617
  if (chunk.type === "workflow-step-result") {
5539
5618
  const status = chunk.payload.status;
5540
5619
  const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
5541
- return {
5620
+ const next = {
5542
5621
  ...prev,
5543
5622
  payload: {
5544
- ...prev.payload,
5623
+ ...prev?.payload,
5545
5624
  currentStep: {
5546
5625
  id: chunk.payload.id,
5547
5626
  ...prev?.payload?.currentStep || {},
5548
5627
  ...chunk.payload
5549
5628
  },
5550
5629
  workflowState: {
5551
- ...prev.payload.workflowState,
5630
+ ...prev?.payload?.workflowState,
5552
5631
  status,
5553
5632
  steps: {
5554
- ...prev.payload.workflowState.steps,
5633
+ ...prev?.payload?.workflowState?.steps,
5555
5634
  [chunk.payload.id]: {
5556
5635
  ...current,
5557
5636
  ...chunk.payload
@@ -5561,14 +5640,15 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
5561
5640
  },
5562
5641
  eventTimestamp: /* @__PURE__ */ new Date()
5563
5642
  };
5643
+ return next;
5564
5644
  }
5565
5645
  if (chunk.type === "workflow-canceled") {
5566
5646
  return {
5567
5647
  ...prev,
5568
5648
  payload: {
5569
- ...prev.payload,
5649
+ ...prev?.payload,
5570
5650
  workflowState: {
5571
- ...prev.payload.workflowState,
5651
+ ...prev?.payload?.workflowState,
5572
5652
  status: "canceled"
5573
5653
  }
5574
5654
  },
@@ -5579,10 +5659,10 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
5579
5659
  return {
5580
5660
  ...prev,
5581
5661
  payload: {
5582
- ...prev.payload,
5662
+ ...prev?.payload,
5583
5663
  currentStep: void 0,
5584
5664
  workflowState: {
5585
- ...prev.payload.workflowState,
5665
+ ...prev?.payload?.workflowState,
5586
5666
  status: chunk.payload.workflowStatus
5587
5667
  }
5588
5668
  },
@@ -5610,10 +5690,8 @@ function WorkflowRunProvider({
5610
5690
  useEffect(() => {
5611
5691
  if (snapshot?.runId) {
5612
5692
  setResult(convertWorkflowRunStateToWatchResult(snapshot));
5613
- } else {
5614
- setResult(null);
5615
5693
  }
5616
- }, [snapshot?.runId ?? ""]);
5694
+ }, [snapshot]);
5617
5695
  return /* @__PURE__ */ jsx(
5618
5696
  WorkflowRunContext.Provider,
5619
5697
  {
@@ -5723,20 +5801,6 @@ const CodeDialogContent = ({ data }) => {
5723
5801
  }
5724
5802
  };
5725
5803
 
5726
- const variants = {
5727
- "header-md": "text-header-md leading-header-md",
5728
- "ui-lg": "text-ui-lg leading-ui-lg",
5729
- "ui-md": "text-ui-md leading-ui-md",
5730
- "ui-sm": "text-ui-sm leading-ui-sm",
5731
- "ui-xs": "text-ui-xs leading-ui-xs"
5732
- };
5733
- const fonts = {
5734
- mono: "font-mono"
5735
- };
5736
- const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
5737
- return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
5738
- };
5739
-
5740
5804
  const formatJSON = async (code) => {
5741
5805
  const formatted = await prettier.format(code, {
5742
5806
  semi: false,
@@ -6613,7 +6677,7 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
6613
6677
  ref,
6614
6678
  align,
6615
6679
  sideOffset,
6616
- className: cn(
6680
+ className: clsx(
6617
6681
  "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
6618
6682
  className
6619
6683
  ),
@@ -7971,7 +8035,7 @@ function WorkflowTrigger({
7971
8035
  }, [isStreamingWorkflow]);
7972
8036
  useEffect(() => {
7973
8037
  if (!streamResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
7974
- const suspended = Object.entries(streamResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
8038
+ const suspended = Object.entries(streamResultToUse?.payload?.workflowState?.steps || {}).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
7975
8039
  stepId,
7976
8040
  runId: result.runId,
7977
8041
  suspendPayload: payload2,
@@ -8504,15 +8568,6 @@ const EmptyWorkflowsTable = () => /* @__PURE__ */ jsx("div", { className: "flex
8504
8568
  }
8505
8569
  ) });
8506
8570
 
8507
- const useHandleAgentWorkflowStream = (workflowOutput) => {
8508
- const [streamResult, setStreamResult] = useState({});
8509
- useEffect(() => {
8510
- if (!workflowOutput) return;
8511
- setStreamResult((prev) => mapWorkflowStreamChunkToWatchResult(prev, workflowOutput));
8512
- }, [workflowOutput]);
8513
- return streamResult;
8514
- };
8515
-
8516
8571
  const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
8517
8572
  const client = useMastraClient();
8518
8573
  return useQuery({
@@ -8522,17 +8577,32 @@ const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
8522
8577
  });
8523
8578
  };
8524
8579
 
8525
- const WorkflowBadge = ({ workflow, runId, workflowId, isStreaming }) => {
8580
+ const WorkflowBadge = ({ workflow, runId, workflowId, isStreaming, networkMetadata }) => {
8526
8581
  const { data: runs, isLoading: isRunsLoading } = useWorkflowRuns(workflowId, {
8527
8582
  enabled: Boolean(runId) && !isStreaming
8528
8583
  });
8529
8584
  const run = runs?.runs.find((run2) => run2.runId === runId);
8530
8585
  const isLoading = isRunsLoading || !run;
8531
8586
  const snapshot = typeof run?.snapshot === "object" ? run?.snapshot : void 0;
8532
- return /* @__PURE__ */ jsxs(BadgeWrapper, { icon: /* @__PURE__ */ jsx(WorkflowIcon, { className: "text-accent3" }), title: workflow.name, initialCollapsed: false, children: [
8533
- !isStreaming && !isLoading && /* @__PURE__ */ jsx(WorkflowRunProvider, { snapshot, children: /* @__PURE__ */ jsx(WorkflowBadgeExtended, { workflowId, workflow, runId }) }),
8534
- isStreaming && /* @__PURE__ */ jsx(WorkflowBadgeExtended, { workflowId, workflow, runId })
8535
- ] });
8587
+ return /* @__PURE__ */ jsxs(
8588
+ BadgeWrapper,
8589
+ {
8590
+ icon: /* @__PURE__ */ jsx(WorkflowIcon, { className: "text-accent3" }),
8591
+ title: workflow.name,
8592
+ initialCollapsed: false,
8593
+ extraInfo: networkMetadata && /* @__PURE__ */ jsx(
8594
+ NetworkChoiceMetadataDialogTrigger,
8595
+ {
8596
+ selectionReason: networkMetadata?.selectionReason || "",
8597
+ input: networkMetadata?.input
8598
+ }
8599
+ ),
8600
+ children: [
8601
+ !isStreaming && !isLoading && /* @__PURE__ */ jsx(WorkflowRunProvider, { snapshot, children: /* @__PURE__ */ jsx(WorkflowBadgeExtended, { workflowId, workflow, runId }) }),
8602
+ isStreaming && /* @__PURE__ */ jsx(WorkflowBadgeExtended, { workflowId, workflow, runId })
8603
+ ]
8604
+ }
8605
+ );
8536
8606
  };
8537
8607
  const WorkflowBadgeExtended = ({ workflowId, workflow, runId }) => {
8538
8608
  const { Link } = useLinkComponent();
@@ -8544,13 +8614,12 @@ const WorkflowBadgeExtended = ({ workflowId, workflow, runId }) => {
8544
8614
  /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden h-[60vh] w-full", children: /* @__PURE__ */ jsx(WorkflowGraph, { workflowId, workflow }) })
8545
8615
  ] });
8546
8616
  };
8547
- const useWorkflowStream = (partialWorkflowOutput) => {
8548
- const streamResult = useHandleAgentWorkflowStream(partialWorkflowOutput);
8617
+ const useWorkflowStream = (workflowFullState) => {
8549
8618
  const { setResult } = useContext(WorkflowRunContext);
8550
8619
  useEffect(() => {
8551
- if (!streamResult) return;
8552
- setResult(streamResult);
8553
- }, [streamResult]);
8620
+ if (!workflowFullState) return;
8621
+ setResult(workflowFullState);
8622
+ }, [workflowFullState]);
8554
8623
  };
8555
8624
 
8556
8625
  const LoadingBadge = () => {
@@ -8564,12 +8633,61 @@ const LoadingBadge = () => {
8564
8633
  );
8565
8634
  };
8566
8635
 
8567
- const ToolFallback$1 = ({ toolName, argsText, result, args, ...props }) => {
8568
- return /* @__PURE__ */ jsx(WorkflowRunProvider, { children: /* @__PURE__ */ jsx(ToolFallbackInner, { toolName, argsText, result, args, ...props }) });
8636
+ const AgentBadge = ({ agentId, messages = [], networkMetadata }) => {
8637
+ return /* @__PURE__ */ jsx(
8638
+ BadgeWrapper,
8639
+ {
8640
+ icon: /* @__PURE__ */ jsx(AgentIcon, { className: "text-accent1" }),
8641
+ title: agentId,
8642
+ initialCollapsed: false,
8643
+ extraInfo: networkMetadata && /* @__PURE__ */ jsx(
8644
+ NetworkChoiceMetadataDialogTrigger,
8645
+ {
8646
+ selectionReason: networkMetadata?.selectionReason || "",
8647
+ input: networkMetadata?.input
8648
+ }
8649
+ ),
8650
+ children: messages.map((message, index) => {
8651
+ if (message.type === "text") {
8652
+ return /* @__PURE__ */ jsx(React__default.Fragment, { children: message.content }, index);
8653
+ }
8654
+ const result = typeof message.toolOutput === "string" ? JSON.parse(message.toolOutput) : message.toolOutput;
8655
+ return /* @__PURE__ */ jsx(React__default.Fragment, { children: /* @__PURE__ */ jsx(
8656
+ ToolFallback$1,
8657
+ {
8658
+ toolName: message.toolName,
8659
+ argsText: typeof message.args === "string" ? message.args : JSON.stringify(message.args),
8660
+ result,
8661
+ args: message.args,
8662
+ status: { type: "complete" },
8663
+ type: "tool-call",
8664
+ toolCallId: message.toolCallId,
8665
+ addResult: () => {
8666
+ }
8667
+ }
8668
+ ) }, index);
8669
+ })
8670
+ }
8671
+ );
8672
+ };
8673
+
8674
+ const ToolFallback$1 = ({ toolName, result, args, ...props }) => {
8675
+ return /* @__PURE__ */ jsx(WorkflowRunProvider, { children: /* @__PURE__ */ jsx(ToolFallbackInner, { toolName, result, args, ...props }) });
8569
8676
  };
8570
- const ToolFallbackInner = ({ toolName, argsText, result, args }) => {
8571
- useWorkflowStream(args.__mastraMetadata?.partialChunk);
8677
+ const ToolFallbackInner = ({ toolName, result, args }) => {
8678
+ useWorkflowStream(args.__mastraMetadata?.workflowFullState);
8572
8679
  const { data: workflow, isLoading } = useWorkflow(toolName);
8680
+ const isAgent = args.__mastraMetadata?.from === "AGENT";
8681
+ if (isAgent) {
8682
+ return /* @__PURE__ */ jsx(
8683
+ AgentBadge,
8684
+ {
8685
+ agentId: toolName,
8686
+ messages: args?.__mastraMetadata?.messages,
8687
+ networkMetadata: args?.__mastraMetadata?.networkMetadata
8688
+ }
8689
+ );
8690
+ }
8573
8691
  if (isLoading) return /* @__PURE__ */ jsx(LoadingBadge, {});
8574
8692
  if (workflow) {
8575
8693
  return /* @__PURE__ */ jsx(
@@ -8578,11 +8696,20 @@ const ToolFallbackInner = ({ toolName, argsText, result, args }) => {
8578
8696
  workflowId: toolName,
8579
8697
  workflow,
8580
8698
  isStreaming: args.__mastraMetadata?.isStreaming,
8581
- runId: result?.runId
8699
+ runId: result?.runId,
8700
+ networkMetadata: args?.__mastraMetadata?.networkMetadata
8582
8701
  }
8583
8702
  );
8584
8703
  }
8585
- return /* @__PURE__ */ jsx(ToolBadge, { toolName, argsText, result });
8704
+ return /* @__PURE__ */ jsx(
8705
+ ToolBadge,
8706
+ {
8707
+ toolName,
8708
+ args,
8709
+ result,
8710
+ networkMetadata: args?.__mastraMetadata?.networkMetadata
8711
+ }
8712
+ );
8586
8713
  };
8587
8714
 
8588
8715
  const Reasoning = ({ text }) => {
@@ -9186,7 +9313,20 @@ const AttachFileDialog = ({ onOpenChange, open }) => {
9186
9313
  ] }) });
9187
9314
  };
9188
9315
 
9189
- const Thread = ({ ToolFallback, agentName, agentId, hasMemory, onInputChange }) => {
9316
+ const ThreadInputContext = createContext({
9317
+ threadInput: "",
9318
+ setThreadInput: () => {
9319
+ }
9320
+ });
9321
+ const ThreadInputProvider = ({ children }) => {
9322
+ const [threadInput, setThreadInput] = useState("");
9323
+ return /* @__PURE__ */ jsx(ThreadInputContext.Provider, { value: { threadInput, setThreadInput }, children });
9324
+ };
9325
+ const useThreadInput = () => {
9326
+ return useContext(ThreadInputContext);
9327
+ };
9328
+
9329
+ const Thread = ({ ToolFallback, agentName, agentId, hasMemory }) => {
9190
9330
  const areaRef = useRef(null);
9191
9331
  useAutoscroll(areaRef, { enabled: true });
9192
9332
  const WrappedAssistantMessage = (props) => {
@@ -9207,7 +9347,7 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, onInputChange })
9207
9347
  ) }),
9208
9348
  /* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
9209
9349
  ] }),
9210
- /* @__PURE__ */ jsx(Composer$1, { hasMemory, onInputChange, agentId })
9350
+ /* @__PURE__ */ jsx(Composer$1, { hasMemory, agentId })
9211
9351
  ] });
9212
9352
  };
9213
9353
  const ThreadWrapper$1 = ({ children }) => {
@@ -9229,7 +9369,8 @@ const ThreadWelcome$1 = ({ agentName }) => {
9229
9369
  /* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
9230
9370
  ] }) });
9231
9371
  };
9232
- const Composer$1 = ({ hasMemory, onInputChange, agentId }) => {
9372
+ const Composer$1 = ({ hasMemory, agentId }) => {
9373
+ const { setThreadInput } = useThreadInput();
9233
9374
  return /* @__PURE__ */ jsxs("div", { className: "mx-4", children: [
9234
9375
  /* @__PURE__ */ jsxs(ComposerPrimitive.Root, { children: [
9235
9376
  /* @__PURE__ */ jsx("div", { className: "max-w-[568px] w-full mx-auto pb-2", children: /* @__PURE__ */ jsx(ComposerAttachments, {}) }),
@@ -9242,7 +9383,7 @@ const Composer$1 = ({ hasMemory, onInputChange, agentId }) => {
9242
9383
  placeholder: "Enter your message...",
9243
9384
  name: "",
9244
9385
  id: "",
9245
- onChange: (e) => onInputChange?.(e.target.value)
9386
+ onChange: (e) => setThreadInput?.(e.target.value)
9246
9387
  }
9247
9388
  ) }),
9248
9389
  /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
@@ -9570,15 +9711,544 @@ const useAdapters = (agentId) => {
9570
9711
  };
9571
9712
  };
9572
9713
 
9573
- const convertMessage$2 = (message) => {
9574
- return message;
9575
- };
9576
- const handleFinishReason = (finishReason) => {
9577
- switch (finishReason) {
9578
- case "tool-calls":
9579
- throw new Error("Stream finished with reason tool-calls, try increasing maxSteps");
9714
+ const handleNetworkMessageFromMemory = (content) => {
9715
+ if (content.resourceType === "workflow") {
9716
+ return {
9717
+ role: "assistant",
9718
+ content: [
9719
+ {
9720
+ type: "tool-call",
9721
+ toolCallId: content.finalResult.runId,
9722
+ toolName: content.resourceId,
9723
+ result: { runId: content.finalResult.runId },
9724
+ args: {
9725
+ __mastraMetadata: {
9726
+ from: "WORKFLOW",
9727
+ networkMetadata: {
9728
+ selectionReason: content?.selectionReason,
9729
+ input: content?.input
9730
+ }
9731
+ }
9732
+ }
9733
+ }
9734
+ ]
9735
+ };
9580
9736
  }
9581
- };
9737
+ if (content.resourceType === "agent") {
9738
+ const badgeMessages = [];
9739
+ let toolCalls = {};
9740
+ const messages = content.finalResult.messages.slice(1);
9741
+ for (const message of messages) {
9742
+ if (typeof message.content === "string") {
9743
+ badgeMessages.push({
9744
+ type: "text",
9745
+ content: message.content
9746
+ });
9747
+ continue;
9748
+ }
9749
+ for (const part of message.content) {
9750
+ if (part.type === "text") {
9751
+ badgeMessages.push({
9752
+ type: "text",
9753
+ content: part.content
9754
+ });
9755
+ } else if (part.type === "tool-result") {
9756
+ badgeMessages.push({
9757
+ type: "tool",
9758
+ toolName: part.toolName,
9759
+ toolOutput: part.result,
9760
+ // tool output
9761
+ toolCallId: part.toolCallId,
9762
+ args: toolCalls?.[part.toolCallId]?.args || {}
9763
+ });
9764
+ } else if (part.type === "tool-call") {
9765
+ toolCalls[part.toolCallId] = part;
9766
+ }
9767
+ }
9768
+ }
9769
+ return {
9770
+ role: "assistant",
9771
+ content: [
9772
+ {
9773
+ type: "tool-call",
9774
+ toolCallId: content.finalResult.runId,
9775
+ toolName: content.resourceId,
9776
+ result: { runId: content.finalResult.runId },
9777
+ args: {
9778
+ __mastraMetadata: {
9779
+ from: "AGENT",
9780
+ networkMetadata: {
9781
+ selectionReason: content?.selectionReason || "",
9782
+ input: content?.input || ""
9783
+ },
9784
+ messages: badgeMessages
9785
+ }
9786
+ }
9787
+ }
9788
+ ]
9789
+ };
9790
+ }
9791
+ if (content.resourceType === "tool") {
9792
+ return {
9793
+ role: "assistant",
9794
+ content: [
9795
+ {
9796
+ type: "tool-call",
9797
+ toolCallId: content.finalResult.toolCallId,
9798
+ toolName: content.resourceId,
9799
+ result: content.finalResult.result,
9800
+ args: {
9801
+ ...content?.input,
9802
+ __mastraMetadata: {
9803
+ networkMetadata: {
9804
+ selectionReason: content?.selectionReason || "",
9805
+ input: content?.input || ""
9806
+ }
9807
+ }
9808
+ }
9809
+ }
9810
+ ]
9811
+ };
9812
+ }
9813
+ return { role: "assistant", content: [{ type: "text", text: "Unknown response" }] };
9814
+ };
9815
+
9816
+ const handleStreamChunk = async ({
9817
+ chunk,
9818
+ setMessages,
9819
+ refreshWorkingMemory,
9820
+ _sideEffects
9821
+ }) => {
9822
+ function updater() {
9823
+ setMessages((currentConversation) => {
9824
+ const message = {
9825
+ role: "assistant",
9826
+ content: [{ type: "text", text: _sideEffects.content }]
9827
+ };
9828
+ if (!_sideEffects.assistantMessageAdded) {
9829
+ _sideEffects.assistantMessageAdded = true;
9830
+ if (_sideEffects.assistantToolCallAddedForUpdater) {
9831
+ _sideEffects.assistantToolCallAddedForUpdater = false;
9832
+ }
9833
+ return [...currentConversation, message];
9834
+ }
9835
+ if (_sideEffects.assistantToolCallAddedForUpdater) {
9836
+ _sideEffects.assistantToolCallAddedForUpdater = false;
9837
+ return [...currentConversation, message];
9838
+ }
9839
+ return [...currentConversation.slice(0, -1), message];
9840
+ });
9841
+ }
9842
+ switch (chunk.type) {
9843
+ case "text-delta": {
9844
+ if (_sideEffects.assistantToolCallAddedForContent) {
9845
+ _sideEffects.assistantToolCallAddedForContent = false;
9846
+ _sideEffects.content = chunk.payload.text;
9847
+ } else {
9848
+ _sideEffects.content += chunk.payload.text;
9849
+ }
9850
+ updater();
9851
+ break;
9852
+ }
9853
+ case "tool-output": {
9854
+ if (chunk.payload.output?.type.startsWith("workflow-")) {
9855
+ handleWorkflowChunk({ workflowChunk: chunk.payload.output, setMessages, entityName: chunk.payload.toolName });
9856
+ }
9857
+ break;
9858
+ }
9859
+ case "tool-call": {
9860
+ setMessages((currentConversation) => {
9861
+ const lastMessage = currentConversation[currentConversation.length - 1];
9862
+ if (lastMessage && lastMessage.role === "assistant") {
9863
+ const updatedMessage = {
9864
+ ...lastMessage,
9865
+ content: Array.isArray(lastMessage.content) ? [
9866
+ ...lastMessage.content,
9867
+ {
9868
+ type: "tool-call",
9869
+ toolCallId: chunk.payload.toolCallId,
9870
+ toolName: chunk.payload.toolName,
9871
+ args: {
9872
+ ...chunk.payload.args,
9873
+ __mastraMetadata: {
9874
+ ...chunk.payload.args?.__mastraMetadata,
9875
+ isStreaming: true
9876
+ }
9877
+ }
9878
+ }
9879
+ ] : [
9880
+ ...typeof lastMessage.content === "string" ? [{ type: "text", text: lastMessage.content }] : [],
9881
+ {
9882
+ type: "tool-call",
9883
+ toolCallId: chunk.payload.toolCallId,
9884
+ toolName: chunk.payload.toolName,
9885
+ args: {
9886
+ ...chunk.payload.args,
9887
+ __mastraMetadata: {
9888
+ ...chunk.payload.args?.__mastraMetadata,
9889
+ isStreaming: true
9890
+ }
9891
+ }
9892
+ }
9893
+ ]
9894
+ };
9895
+ _sideEffects.assistantToolCallAddedForUpdater = true;
9896
+ _sideEffects.assistantToolCallAddedForContent = true;
9897
+ return [...currentConversation.slice(0, -1), updatedMessage];
9898
+ }
9899
+ const newMessage = {
9900
+ role: "assistant",
9901
+ content: [
9902
+ { type: "text", text: _sideEffects.content },
9903
+ {
9904
+ type: "tool-call",
9905
+ toolCallId: chunk.payload.toolCallId,
9906
+ toolName: chunk.payload.toolName,
9907
+ args: {
9908
+ ...chunk.payload.args,
9909
+ __mastraMetadata: { ...chunk.payload.args?.__mastraMetadata, isStreaming: true }
9910
+ }
9911
+ }
9912
+ ]
9913
+ };
9914
+ _sideEffects.assistantToolCallAddedForUpdater = true;
9915
+ _sideEffects.assistantToolCallAddedForContent = true;
9916
+ return [...currentConversation, newMessage];
9917
+ });
9918
+ _sideEffects.toolCallIdToName.current[chunk.payload.toolCallId] = chunk.payload.toolName;
9919
+ break;
9920
+ }
9921
+ case "tool-result": {
9922
+ setMessages((currentConversation) => {
9923
+ const lastMessage = currentConversation[currentConversation.length - 1];
9924
+ if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
9925
+ const updatedContent = lastMessage.content.map((part) => {
9926
+ if (typeof part === "object" && part.type === "tool-call" && part.toolCallId === chunk.payload.toolCallId) {
9927
+ return {
9928
+ ...part,
9929
+ result: chunk.payload.result
9930
+ };
9931
+ }
9932
+ return part;
9933
+ });
9934
+ const updatedMessage = {
9935
+ ...lastMessage,
9936
+ content: updatedContent
9937
+ };
9938
+ return [...currentConversation.slice(0, -1), updatedMessage];
9939
+ }
9940
+ return currentConversation;
9941
+ });
9942
+ try {
9943
+ const toolName = _sideEffects.toolCallIdToName.current[chunk.payload.toolCallId];
9944
+ if (toolName === "updateWorkingMemory" && chunk.payload.result?.success) {
9945
+ await refreshWorkingMemory?.();
9946
+ }
9947
+ } finally {
9948
+ delete _sideEffects.toolCallIdToName.current[chunk.payload.toolCallId];
9949
+ }
9950
+ break;
9951
+ }
9952
+ case "error": {
9953
+ if (typeof chunk.payload.error === "string") {
9954
+ throw new Error(chunk.payload.error);
9955
+ }
9956
+ break;
9957
+ }
9958
+ case "finish": {
9959
+ handleFinishReason$1(chunk.payload.finishReason);
9960
+ break;
9961
+ }
9962
+ case "reasoning-delta": {
9963
+ setMessages((currentConversation) => {
9964
+ const lastMessage = currentConversation[currentConversation.length - 1];
9965
+ if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
9966
+ const updatedContent = lastMessage.content.map((part) => {
9967
+ if (typeof part === "object" && part.type === "reasoning") {
9968
+ return {
9969
+ ...part,
9970
+ text: part.text + chunk.payload.text
9971
+ };
9972
+ }
9973
+ return part;
9974
+ });
9975
+ const updatedMessage = {
9976
+ ...lastMessage,
9977
+ content: updatedContent
9978
+ };
9979
+ return [...currentConversation.slice(0, -1), updatedMessage];
9980
+ }
9981
+ const newMessage = {
9982
+ role: "assistant",
9983
+ content: [
9984
+ {
9985
+ type: "reasoning",
9986
+ text: chunk.payload.text
9987
+ },
9988
+ { type: "text", text: _sideEffects.content }
9989
+ ]
9990
+ };
9991
+ return [...currentConversation, newMessage];
9992
+ });
9993
+ break;
9994
+ }
9995
+ }
9996
+ };
9997
+ const handleFinishReason$1 = (finishReason) => {
9998
+ switch (finishReason) {
9999
+ case "tool-calls":
10000
+ throw new Error("Stream finished with reason tool-calls, try increasing maxSteps");
10001
+ }
10002
+ };
10003
+ const handleWorkflowChunk = ({ workflowChunk, setMessages, entityName }) => {
10004
+ flushSync(() => {
10005
+ setMessages((currentConversation) => {
10006
+ const lastMessage = currentConversation[currentConversation.length - 1];
10007
+ const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
10008
+ const newMessage = {
10009
+ ...lastMessage,
10010
+ content: contentArray.map((part) => {
10011
+ if (part.type === "tool-call") {
10012
+ return {
10013
+ ...part,
10014
+ toolName: part?.entityName || entityName,
10015
+ args: {
10016
+ ...part.args,
10017
+ __mastraMetadata: {
10018
+ ...part.args?.__mastraMetadata,
10019
+ workflowFullState: mapWorkflowStreamChunkToWatchResult(
10020
+ part.args?.__mastraMetadata?.workflowFullState || {},
10021
+ workflowChunk
10022
+ ),
10023
+ isStreaming: true
10024
+ }
10025
+ }
10026
+ };
10027
+ }
10028
+ return part;
10029
+ })
10030
+ };
10031
+ return [...currentConversation.slice(0, -1), newMessage];
10032
+ });
10033
+ });
10034
+ };
10035
+ const handleAgentChunk = ({ agentChunk, setMessages, entityName }) => {
10036
+ switch (agentChunk.type) {
10037
+ case "tool-result": {
10038
+ setMessages((currentConversation) => {
10039
+ const lastMessage = currentConversation[currentConversation.length - 1];
10040
+ const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
10041
+ const newMessage = {
10042
+ ...lastMessage,
10043
+ content: contentArray.map((part) => {
10044
+ if (part.type === "tool-call") {
10045
+ const messages = part.args?.__mastraMetadata?.messages || [];
10046
+ const next = {
10047
+ ...part,
10048
+ toolName: part?.entityName || entityName,
10049
+ args: {
10050
+ ...part.args,
10051
+ __mastraMetadata: {
10052
+ ...part.args?.__mastraMetadata,
10053
+ isStreaming: true,
10054
+ messages: [
10055
+ ...messages.slice(0, -1),
10056
+ {
10057
+ ...messages[messages.length - 1],
10058
+ type: "tool",
10059
+ toolName: agentChunk.payload.toolName,
10060
+ args: agentChunk.payload.args,
10061
+ toolOutput: agentChunk.payload.result
10062
+ }
10063
+ ]
10064
+ }
10065
+ }
10066
+ };
10067
+ return next;
10068
+ }
10069
+ return part;
10070
+ })
10071
+ };
10072
+ return [...currentConversation.slice(0, -1), newMessage];
10073
+ });
10074
+ break;
10075
+ }
10076
+ case "tool-call": {
10077
+ setMessages((currentConversation) => {
10078
+ const lastMessage = currentConversation[currentConversation.length - 1];
10079
+ const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
10080
+ const newMessage = {
10081
+ ...lastMessage,
10082
+ content: contentArray.map((part) => {
10083
+ if (part.type === "tool-call") {
10084
+ const messages = part.args?.__mastraMetadata?.messages || [];
10085
+ const next = {
10086
+ ...part,
10087
+ toolName: part?.entityName || entityName,
10088
+ args: {
10089
+ ...part.args,
10090
+ __mastraMetadata: {
10091
+ ...part.args?.__mastraMetadata,
10092
+ isStreaming: true,
10093
+ messages: [
10094
+ ...messages,
10095
+ {
10096
+ type: "tool",
10097
+ toolCallId: agentChunk.payload.toolCallId,
10098
+ toolName: agentChunk.payload.toolName,
10099
+ args: {
10100
+ ...agentChunk.payload.args,
10101
+ __mastraMetadata: {
10102
+ ...agentChunk.payload.args?.__mastraMetadata,
10103
+ isStreaming: true
10104
+ }
10105
+ }
10106
+ }
10107
+ ]
10108
+ }
10109
+ }
10110
+ };
10111
+ return next;
10112
+ }
10113
+ return part;
10114
+ })
10115
+ };
10116
+ return [...currentConversation.slice(0, -1), newMessage];
10117
+ });
10118
+ break;
10119
+ }
10120
+ case "text-delta": {
10121
+ setMessages((currentConversation) => {
10122
+ const lastMessage = currentConversation[currentConversation.length - 1];
10123
+ const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
10124
+ const newMessage = {
10125
+ ...lastMessage,
10126
+ content: contentArray.map((part) => {
10127
+ if (part.type === "tool-call") {
10128
+ const messages = part.args?.__mastraMetadata?.messages || [];
10129
+ const lastMastraMessage = messages[messages.length - 1];
10130
+ const nextMessages = lastMastraMessage?.type === "text" ? [
10131
+ ...messages.slice(0, -1),
10132
+ { type: "text", content: (lastMastraMessage?.content || "") + agentChunk.payload.text }
10133
+ ] : [...messages, { type: "text", content: agentChunk.payload.text }];
10134
+ return {
10135
+ ...part,
10136
+ toolName: part?.entityName || entityName,
10137
+ args: {
10138
+ ...part.args,
10139
+ __mastraMetadata: {
10140
+ ...part.args?.__mastraMetadata,
10141
+ isStreaming: true,
10142
+ messages: nextMessages
10143
+ }
10144
+ }
10145
+ };
10146
+ }
10147
+ return part;
10148
+ })
10149
+ };
10150
+ return [...currentConversation.slice(0, -1), newMessage];
10151
+ });
10152
+ break;
10153
+ }
10154
+ case "tool-output": {
10155
+ flushSync(() => {
10156
+ setMessages((currentConversation) => {
10157
+ if (!agentChunk.payload.output.type.startsWith("workflow-")) return currentConversation;
10158
+ const lastMessage = currentConversation[currentConversation.length - 1];
10159
+ const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
10160
+ const newMessage = {
10161
+ ...lastMessage,
10162
+ content: contentArray.map((part) => {
10163
+ if (part.type === "tool-call") {
10164
+ const messages = part.args?.__mastraMetadata?.messages || [];
10165
+ const lastMastraMessage = messages[messages.length - 1];
10166
+ const nextMessages = lastMastraMessage?.type === "tool" ? [
10167
+ ...messages.slice(0, -1),
10168
+ {
10169
+ ...lastMastraMessage,
10170
+ args: {
10171
+ ...agentChunk.payload.args,
10172
+ __mastraMetadata: {
10173
+ ...agentChunk.payload.args?.__mastraMetadata,
10174
+ workflowFullState: mapWorkflowStreamChunkToWatchResult(
10175
+ lastMastraMessage.args?.__mastraMetadata?.workflowFullState || {},
10176
+ agentChunk.payload.output
10177
+ ),
10178
+ isStreaming: true
10179
+ }
10180
+ }
10181
+ }
10182
+ ] : messages;
10183
+ return {
10184
+ ...part,
10185
+ toolName: part?.entityName || entityName,
10186
+ args: {
10187
+ ...part.args,
10188
+ __mastraMetadata: {
10189
+ ...part.args?.__mastraMetadata,
10190
+ isStreaming: true,
10191
+ messages: nextMessages
10192
+ }
10193
+ }
10194
+ };
10195
+ }
10196
+ return part;
10197
+ })
10198
+ };
10199
+ return [...currentConversation.slice(0, -1), newMessage];
10200
+ });
10201
+ });
10202
+ break;
10203
+ }
10204
+ }
10205
+ };
10206
+ const createRootToolAssistantMessage = ({
10207
+ chunk,
10208
+ entityName,
10209
+ setMessages,
10210
+ runId,
10211
+ _sideEffects,
10212
+ from,
10213
+ networkMetadata
10214
+ }) => {
10215
+ setMessages((currentConversation) => {
10216
+ if (!entityName || !runId) return currentConversation;
10217
+ const newMessage = {
10218
+ role: "assistant",
10219
+ content: [
10220
+ { type: "text", text: _sideEffects.content },
10221
+ {
10222
+ type: "tool-call",
10223
+ toolCallId: runId,
10224
+ toolName: entityName,
10225
+ args: {
10226
+ ...chunk?.payload?.args,
10227
+ __mastraMetadata: {
10228
+ from,
10229
+ networkMetadata,
10230
+ ...chunk.payload.args?.__mastraMetadata,
10231
+ isStreaming: true
10232
+ }
10233
+ }
10234
+ }
10235
+ ]
10236
+ };
10237
+ _sideEffects.assistantToolCallAddedForUpdater = true;
10238
+ _sideEffects.assistantToolCallAddedForContent = true;
10239
+ return [...currentConversation, newMessage];
10240
+ });
10241
+ };
10242
+
10243
+ const convertMessage$2 = (message) => {
10244
+ return message;
10245
+ };
10246
+ const handleFinishReason = (finishReason) => {
10247
+ switch (finishReason) {
10248
+ case "tool-calls":
10249
+ throw new Error("Stream finished with reason tool-calls, try increasing maxSteps");
10250
+ }
10251
+ };
9582
10252
  const convertToAIAttachments = async (attachments) => {
9583
10253
  const promises = (attachments ?? []).filter((attachment) => attachment.type === "image" || attachment.type === "document").map(async (attachment) => {
9584
10254
  const isFileFromURL = attachment.name.startsWith("https://");
@@ -9644,7 +10314,7 @@ function MastraRuntimeProvider({
9644
10314
  instructions,
9645
10315
  chatWithGenerate,
9646
10316
  chatWithGenerateVNext,
9647
- chatWithStreamVNext,
10317
+ chatWithNetwork,
9648
10318
  providerOptions
9649
10319
  } = settings?.modelSettings ?? {};
9650
10320
  const toolCallIdToName = useRef({});
@@ -9657,6 +10327,14 @@ function MastraRuntimeProvider({
9657
10327
  if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
9658
10328
  if (initialMessages && threadId && memory) {
9659
10329
  const convertedMessages = initialMessages?.map((message) => {
10330
+ let content;
10331
+ try {
10332
+ content = JSON.parse(message.content);
10333
+ if (content.isNetwork) {
10334
+ return handleNetworkMessageFromMemory(content);
10335
+ }
10336
+ } catch (e) {
10337
+ }
9660
10338
  const attachmentsAsContentParts = (message.experimental_attachments || []).map((image) => ({
9661
10339
  type: image.contentType.startsWith(`image/`) ? "image" : image.contentType.startsWith(`audio/`) ? "audio" : "file",
9662
10340
  mimeType: image.contentType,
@@ -9803,63 +10481,15 @@ function MastraRuntimeProvider({
9803
10481
  }
9804
10482
  };
9805
10483
  if (modelVersion === "v2") {
9806
- if (chatWithGenerateVNext) {
9807
- const response = await agent.generateVNext({
10484
+ if (chatWithNetwork) {
10485
+ const response = await agent.network({
9808
10486
  messages: [
9809
10487
  {
9810
10488
  role: "user",
9811
10489
  content: input
9812
- },
9813
- ...attachments
9814
- ],
9815
- runId: agentId,
9816
- modelSettings: {
9817
- frequencyPenalty,
9818
- presencePenalty,
9819
- maxRetries,
9820
- temperature,
9821
- topK,
9822
- topP,
9823
- maxOutputTokens: maxTokens
9824
- },
9825
- providerOptions,
9826
- instructions,
9827
- runtimeContext: runtimeContextInstance,
9828
- ...memory ? { threadId, resourceId: agentId } : {}
9829
- });
9830
- handleGenerateResponse(response);
9831
- setIsRunning(false);
9832
- return;
9833
- } else {
9834
- let updater = function() {
9835
- setMessages((currentConversation) => {
9836
- const message2 = {
9837
- role: "assistant",
9838
- content: [{ type: "text", text: content }]
9839
- };
9840
- if (!assistantMessageAdded) {
9841
- assistantMessageAdded = true;
9842
- if (assistantToolCallAddedForUpdater) {
9843
- assistantToolCallAddedForUpdater = false;
9844
- }
9845
- return [...currentConversation, message2];
9846
- }
9847
- if (assistantToolCallAddedForUpdater) {
9848
- assistantToolCallAddedForUpdater = false;
9849
- return [...currentConversation, message2];
9850
10490
  }
9851
- return [...currentConversation.slice(0, -1), message2];
9852
- });
9853
- };
9854
- const response = await agent.streamVNext({
9855
- messages: [
9856
- {
9857
- role: "user",
9858
- content: input
9859
- },
9860
- ...attachments
9861
10491
  ],
9862
- runId: agentId,
10492
+ maxSteps,
9863
10493
  modelSettings: {
9864
10494
  frequencyPenalty,
9865
10495
  presencePenalty,
@@ -9869,203 +10499,159 @@ function MastraRuntimeProvider({
9869
10499
  topK,
9870
10500
  topP
9871
10501
  },
9872
- instructions,
10502
+ runId: agentId,
9873
10503
  runtimeContext: runtimeContextInstance,
9874
- ...memory ? { threadId, resourceId: agentId } : {},
9875
- providerOptions
10504
+ ...memory ? { thread: threadId, resourceId: agentId } : {}
9876
10505
  });
9877
- if (!response.body) {
9878
- throw new Error("No response body");
9879
- }
9880
- let content = "";
9881
- let assistantMessageAdded = false;
9882
- let assistantToolCallAddedForUpdater = false;
9883
- let assistantToolCallAddedForContent = false;
10506
+ const _sideEffects = {
10507
+ assistantMessageAdded: false,
10508
+ assistantToolCallAddedForUpdater: false,
10509
+ assistantToolCallAddedForContent: false,
10510
+ content: "",
10511
+ toolCallIdToName
10512
+ };
10513
+ let currentEntityId;
9884
10514
  await response.processDataStream({
9885
10515
  onChunk: async (chunk) => {
9886
- switch (chunk.type) {
9887
- case "text-delta": {
9888
- if (assistantToolCallAddedForContent) {
9889
- assistantToolCallAddedForContent = false;
9890
- content = chunk.payload.text;
9891
- } else {
9892
- content += chunk.payload.text;
9893
- }
9894
- updater();
9895
- break;
9896
- }
9897
- case "tool-output": {
9898
- if (!chunk.payload.output?.type.startsWith("workflow-")) return;
9899
- flushSync(() => {
9900
- setMessages((currentConversation) => {
9901
- const lastMessage = currentConversation[currentConversation.length - 1];
9902
- const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
9903
- const newMessage = {
9904
- ...lastMessage,
9905
- content: contentArray.map((part) => {
9906
- if (part.type === "tool-call") {
9907
- return {
9908
- ...part,
9909
- ...chunk.payload,
9910
- args: {
9911
- ...part.args,
9912
- __mastraMetadata: {
9913
- ...part.args?.__mastraMetadata,
9914
- partialChunk: chunk?.payload?.output,
9915
- isStreaming: true
9916
- }
9917
- }
9918
- };
9919
- }
9920
- return part;
9921
- })
9922
- };
9923
- return [...currentConversation.slice(0, -1), newMessage];
9924
- });
9925
- });
9926
- break;
9927
- }
9928
- case "tool-call": {
9929
- setMessages((currentConversation) => {
9930
- const lastMessage = currentConversation[currentConversation.length - 1];
9931
- if (lastMessage && lastMessage.role === "assistant") {
9932
- const updatedMessage = {
9933
- ...lastMessage,
9934
- content: Array.isArray(lastMessage.content) ? [
9935
- ...lastMessage.content,
9936
- {
9937
- type: "tool-call",
9938
- toolCallId: chunk.payload.toolCallId,
9939
- toolName: chunk.payload.toolName,
9940
- args: {
9941
- ...chunk.payload.args,
9942
- __mastraMetadata: {
9943
- ...chunk.payload.args?.__mastraMetadata,
9944
- isStreaming: true
9945
- }
9946
- }
9947
- }
9948
- ] : [
9949
- ...typeof lastMessage.content === "string" ? [{ type: "text", text: lastMessage.content }] : [],
9950
- {
9951
- type: "tool-call",
9952
- toolCallId: chunk.payload.toolCallId,
9953
- toolName: chunk.payload.toolName,
9954
- args: {
9955
- ...chunk.payload.args,
9956
- __mastraMetadata: {
9957
- ...chunk.payload.args?.__mastraMetadata,
9958
- isStreaming: true
9959
- }
9960
- }
9961
- }
9962
- ]
9963
- };
9964
- assistantToolCallAddedForUpdater = true;
9965
- assistantToolCallAddedForContent = true;
9966
- return [...currentConversation.slice(0, -1), updatedMessage];
9967
- }
9968
- const newMessage = {
9969
- role: "assistant",
9970
- content: [
9971
- { type: "text", text: content },
9972
- {
9973
- type: "tool-call",
9974
- toolCallId: chunk.payload.toolCallId,
9975
- toolName: chunk.payload.toolName,
9976
- args: {
9977
- ...chunk.payload.args,
9978
- __mastraMetadata: { ...chunk.payload.args?.__mastraMetadata, isStreaming: true }
10516
+ if (chunk.type.startsWith("agent-execution-event-")) {
10517
+ const agentChunk = chunk.payload;
10518
+ if (!currentEntityId) return;
10519
+ await handleAgentChunk({ agentChunk, setMessages, entityName: currentEntityId });
10520
+ } else if (chunk.type === "tool-execution-start") {
10521
+ await handleStreamChunk({
10522
+ chunk: {
10523
+ ...chunk,
10524
+ type: "tool-call",
10525
+ payload: {
10526
+ ...chunk?.payload,
10527
+ toolCallId: chunk?.payload?.args?.toolCallId,
10528
+ toolName: chunk?.payload?.args?.toolName,
10529
+ args: {
10530
+ ...chunk?.payload?.args?.args,
10531
+ __mastraMetadata: {
10532
+ ...chunk?.payload?.args?.__mastraMetadata,
10533
+ networkMetadata: {
10534
+ selectionReason: chunk?.payload?.args?.selectionReason || "",
10535
+ input: chunk?.payload?.args?.args
9979
10536
  }
9980
10537
  }
9981
- ]
9982
- };
9983
- assistantToolCallAddedForUpdater = true;
9984
- assistantToolCallAddedForContent = true;
9985
- return [...currentConversation, newMessage];
9986
- });
9987
- toolCallIdToName.current[chunk.payload.toolCallId] = chunk.payload.toolName;
9988
- break;
9989
- }
9990
- case "tool-result": {
9991
- setMessages((currentConversation) => {
9992
- const lastMessage = currentConversation[currentConversation.length - 1];
9993
- if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
9994
- const updatedContent = lastMessage.content.map((part) => {
9995
- if (typeof part === "object" && part.type === "tool-call" && part.toolCallId === chunk.payload.toolCallId) {
9996
- return {
9997
- ...part,
9998
- result: chunk.payload.result
9999
- };
10000
- }
10001
- return part;
10002
- });
10003
- const updatedMessage = {
10004
- ...lastMessage,
10005
- content: updatedContent
10006
- };
10007
- return [...currentConversation.slice(0, -1), updatedMessage];
10008
- }
10009
- return currentConversation;
10010
- });
10011
- try {
10012
- const toolName = toolCallIdToName.current[chunk.payload.toolCallId];
10013
- if (toolName === "updateWorkingMemory" && chunk.payload.result?.success) {
10014
- await refreshWorkingMemory?.();
10538
+ }
10015
10539
  }
10016
- } finally {
10017
- delete toolCallIdToName.current[chunk.payload.toolCallId];
10018
- }
10019
- break;
10020
- }
10021
- case "error": {
10022
- if (typeof chunk.payload.error === "string") {
10023
- throw new Error(chunk.payload.error);
10540
+ },
10541
+ setMessages,
10542
+ refreshWorkingMemory,
10543
+ _sideEffects
10544
+ });
10545
+ } else if (chunk.type === "tool-execution-end") {
10546
+ await handleStreamChunk({
10547
+ chunk: { ...chunk, type: "tool-result" },
10548
+ setMessages,
10549
+ refreshWorkingMemory,
10550
+ _sideEffects
10551
+ });
10552
+ } else if (chunk.type.startsWith("workflow-execution-event-")) {
10553
+ const workflowChunk = chunk.payload;
10554
+ if (!currentEntityId) return;
10555
+ await handleWorkflowChunk({ workflowChunk, setMessages, entityName: currentEntityId });
10556
+ } else if (chunk.type === "workflow-execution-start" || chunk.type === "agent-execution-start") {
10557
+ currentEntityId = chunk.payload?.args?.resourceId;
10558
+ const runId = chunk.payload.runId;
10559
+ if (!currentEntityId || !runId) return;
10560
+ createRootToolAssistantMessage({
10561
+ entityName: currentEntityId,
10562
+ setMessages,
10563
+ runId,
10564
+ _sideEffects,
10565
+ chunk,
10566
+ from: chunk.type === "agent-execution-start" ? "AGENT" : "WORKFLOW",
10567
+ networkMetadata: {
10568
+ selectionReason: chunk?.payload?.args?.selectionReason || "",
10569
+ input: chunk?.payload?.args?.prompt
10024
10570
  }
10025
- break;
10026
- }
10027
- case "finish": {
10028
- handleFinishReason(chunk.payload.finishReason);
10029
- break;
10030
- }
10031
- case "reasoning-delta": {
10032
- setMessages((currentConversation) => {
10033
- const lastMessage = currentConversation[currentConversation.length - 1];
10034
- if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
10035
- const updatedContent = lastMessage.content.map((part) => {
10036
- if (typeof part === "object" && part.type === "reasoning") {
10037
- return {
10038
- ...part,
10039
- text: part.text + chunk.payload.text
10040
- };
10041
- }
10042
- return part;
10043
- });
10044
- const updatedMessage = {
10045
- ...lastMessage,
10046
- content: updatedContent
10047
- };
10048
- return [...currentConversation.slice(0, -1), updatedMessage];
10049
- }
10050
- const newMessage = {
10051
- role: "assistant",
10052
- content: [
10053
- {
10054
- type: "reasoning",
10055
- text: chunk.payload.text
10056
- },
10057
- { type: "text", text: content }
10058
- ]
10059
- };
10060
- return [...currentConversation, newMessage];
10061
- });
10062
- break;
10063
- }
10571
+ });
10572
+ _sideEffects.toolCallIdToName.current[runId] = currentEntityId;
10573
+ } else if (chunk.type === "network-execution-event-step-finish") {
10574
+ setMessages((currentConversation) => {
10575
+ return [
10576
+ ...currentConversation,
10577
+ { role: "assistant", content: [{ type: "text", text: chunk?.payload?.result || "" }] }
10578
+ ];
10579
+ });
10580
+ } else {
10581
+ await handleStreamChunk({ chunk, setMessages, refreshWorkingMemory, _sideEffects });
10064
10582
  }
10065
10583
  }
10066
10584
  });
10067
- setIsRunning(false);
10068
- return;
10585
+ } else {
10586
+ if (chatWithGenerateVNext) {
10587
+ const response = await agent.generateVNext({
10588
+ messages: [
10589
+ {
10590
+ role: "user",
10591
+ content: input
10592
+ },
10593
+ ...attachments
10594
+ ],
10595
+ runId: agentId,
10596
+ modelSettings: {
10597
+ frequencyPenalty,
10598
+ presencePenalty,
10599
+ maxRetries,
10600
+ temperature,
10601
+ topK,
10602
+ topP,
10603
+ maxOutputTokens: maxTokens
10604
+ },
10605
+ providerOptions,
10606
+ instructions,
10607
+ runtimeContext: runtimeContextInstance,
10608
+ ...memory ? { threadId, resourceId: agentId } : {}
10609
+ });
10610
+ handleGenerateResponse(response);
10611
+ setIsRunning(false);
10612
+ return;
10613
+ } else {
10614
+ const response = await agent.streamVNext({
10615
+ messages: [
10616
+ {
10617
+ role: "user",
10618
+ content: input
10619
+ },
10620
+ ...attachments
10621
+ ],
10622
+ runId: agentId,
10623
+ modelSettings: {
10624
+ frequencyPenalty,
10625
+ presencePenalty,
10626
+ maxRetries,
10627
+ maxOutputTokens: maxTokens,
10628
+ temperature,
10629
+ topK,
10630
+ topP
10631
+ },
10632
+ instructions,
10633
+ runtimeContext: runtimeContextInstance,
10634
+ ...memory ? { threadId, resourceId: agentId } : {},
10635
+ providerOptions
10636
+ });
10637
+ if (!response.body) {
10638
+ throw new Error("No response body");
10639
+ }
10640
+ const _sideEffects = {
10641
+ assistantMessageAdded: false,
10642
+ assistantToolCallAddedForUpdater: false,
10643
+ assistantToolCallAddedForContent: false,
10644
+ content: "",
10645
+ toolCallIdToName
10646
+ };
10647
+ await response.processDataStream({
10648
+ onChunk: async (chunk) => {
10649
+ await handleStreamChunk({ chunk, setMessages, refreshWorkingMemory, _sideEffects });
10650
+ }
10651
+ });
10652
+ setIsRunning(false);
10653
+ return;
10654
+ }
10069
10655
  }
10070
10656
  } else {
10071
10657
  if (chatWithGenerate) {
@@ -10448,7 +11034,6 @@ const AgentChat = ({
10448
11034
  initialMessages,
10449
11035
  memory,
10450
11036
  refreshThreadList,
10451
- onInputChange,
10452
11037
  modelVersion
10453
11038
  }) => {
10454
11039
  const { settings } = useAgentSettings();
@@ -10465,7 +11050,7 @@ const AgentChat = ({
10465
11050
  refreshThreadList,
10466
11051
  settings,
10467
11052
  runtimeContext,
10468
- children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, onInputChange, agentId })
11053
+ children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, agentId })
10469
11054
  }
10470
11055
  );
10471
11056
  };
@@ -11072,7 +11657,11 @@ const AgentSettings = ({ modelVersion }) => {
11072
11657
  const { settings, setSettings, resetAll } = useAgentSettings();
11073
11658
  let radioValue;
11074
11659
  if (modelVersion === "v2") {
11075
- radioValue = settings?.modelSettings?.chatWithGenerateVNext ? "generateVNext" : "streamVNext";
11660
+ if (settings?.modelSettings?.chatWithNetwork) {
11661
+ radioValue = "network";
11662
+ } else {
11663
+ radioValue = settings?.modelSettings?.chatWithGenerateVNext ? "generateVNext" : "streamVNext";
11664
+ }
11076
11665
  } else {
11077
11666
  radioValue = settings?.modelSettings?.chatWithGenerate ? "generate" : "stream";
11078
11667
  }
@@ -11089,7 +11678,8 @@ const AgentSettings = ({ modelVersion }) => {
11089
11678
  ...settings?.modelSettings,
11090
11679
  chatWithGenerate: value === "generate",
11091
11680
  chatWithGenerateVNext: value === "generateVNext",
11092
- chatWithStreamVNext: value === "streamVNext"
11681
+ chatWithStreamVNext: value === "streamVNext",
11682
+ chatWithNetwork: value === "network"
11093
11683
  }
11094
11684
  }),
11095
11685
  className: "flex flex-row gap-4",
@@ -11109,6 +11699,10 @@ const AgentSettings = ({ modelVersion }) => {
11109
11699
  modelVersion === "v2" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11110
11700
  /* @__PURE__ */ jsx(RadioGroupItem, { value: "streamVNext", id: "streamVNext", className: "text-icon6" }),
11111
11701
  /* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "streamVNext", children: "Stream vNext" })
11702
+ ] }),
11703
+ modelVersion === "v2" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11704
+ /* @__PURE__ */ jsx(RadioGroupItem, { value: "network", id: "network", className: "text-icon6" }),
11705
+ /* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "network", children: "Network" })
11112
11706
  ] })
11113
11707
  ]
11114
11708
  }
@@ -12242,10 +12836,18 @@ const AgentMetadataModelSwitcher = ({
12242
12836
  ] }) });
12243
12837
  };
12244
12838
 
12839
+ const AgentMetadataNetworkList = ({ agents, computeAgentLink }) => {
12840
+ const { Link } = useLinkComponent();
12841
+ if (agents.length === 0) {
12842
+ return /* @__PURE__ */ jsx(AgentMetadataListEmpty, { children: "No tools" });
12843
+ }
12844
+ return /* @__PURE__ */ jsx(AgentMetadataList, { children: agents.map((agent) => /* @__PURE__ */ jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsx(Link, { href: computeAgentLink(agent), children: /* @__PURE__ */ jsx(Badge$1, { variant: "success", icon: /* @__PURE__ */ jsx(AgentIcon, {}), children: agent.name }) }) }, agent.id)) });
12845
+ };
12245
12846
  const AgentMetadata = ({
12246
12847
  agent,
12247
12848
  promptSlot,
12248
12849
  hasMemoryEnabled,
12850
+ computeAgentLink,
12249
12851
  computeToolLink,
12250
12852
  computeWorkflowLink,
12251
12853
  updateModel,
@@ -12253,6 +12855,8 @@ const AgentMetadata = ({
12253
12855
  }) => {
12254
12856
  const [isEditingModel, setIsEditingModel] = useState(false);
12255
12857
  const providerIcon = providerMapToIcon[agent.provider || "openai.chat"];
12858
+ const networkAgentsMap = agent.agents ?? {};
12859
+ const networkAgents = Object.values(networkAgentsMap);
12256
12860
  const agentTools = agent.tools ?? {};
12257
12861
  const tools = Object.keys(agentTools).map((key) => agentTools[key]);
12258
12862
  const agentWorkflows = agent.workflows ?? {};
@@ -12269,7 +12873,16 @@ const AgentMetadata = ({
12269
12873
  }
12270
12874
  ) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
12271
12875
  /* @__PURE__ */ jsx(Badge$1, { icon: providerIcon, className: "font-medium", children: agent.modelId || "N/A" }),
12272
- /* @__PURE__ */ jsx("button", { onClick: () => setIsEditingModel(true), className: "text-icon3 hover:text-icon6", children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(EditIcon, {}) }) })
12876
+ /* @__PURE__ */ jsx(
12877
+ "button",
12878
+ {
12879
+ title: "Edit model",
12880
+ type: "button",
12881
+ onClick: () => setIsEditingModel(true),
12882
+ className: "text-icon3 hover:text-icon6",
12883
+ children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(EditIcon, {}) })
12884
+ }
12885
+ )
12273
12886
  ] }) }),
12274
12887
  /* @__PURE__ */ jsx(
12275
12888
  AgentMetadataSection,
@@ -12282,6 +12895,17 @@ const AgentMetadata = ({
12282
12895
  children: /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(MemoryIcon, {}), variant: hasMemoryEnabled ? "success" : "error", className: "font-medium", children: hasMemoryEnabled ? "On" : "Off" })
12283
12896
  }
12284
12897
  ),
12898
+ networkAgents.length > 0 && /* @__PURE__ */ jsx(
12899
+ AgentMetadataSection,
12900
+ {
12901
+ title: "Agents",
12902
+ hint: {
12903
+ link: "https://mastra.ai/en/docs/agents/overview",
12904
+ title: "Agents documentation"
12905
+ },
12906
+ children: /* @__PURE__ */ jsx(AgentMetadataNetworkList, { agents: networkAgents, computeAgentLink })
12907
+ }
12908
+ ),
12285
12909
  /* @__PURE__ */ jsx(
12286
12910
  AgentMetadataSection,
12287
12911
  {
@@ -15749,42 +16373,31 @@ function TemplateInfo({
15749
16373
  }) {
15750
16374
  const branchName = templateSlug ? `feat/install-template-${templateSlug}` : "feat/install-template-[slug]";
15751
16375
  return /* @__PURE__ */ jsxs(Fragment, { children: [
15752
- /* @__PURE__ */ jsxs("div", { className: cn("grid lg:grid-cols-[1fr_1fr] gap-x-[6rem] mt-[2rem] lg:min-h-[4rem] items-center "), children: [
15753
- /* @__PURE__ */ jsxs(
15754
- "div",
15755
- {
15756
- className: cn(
15757
- "text-[1.5rem] flex items-center gap-[0.75rem] ",
15758
- "[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",
16376
+ /* @__PURE__ */ jsx("div", { className: cn("grid mt-[2rem] items-center"), children: /* @__PURE__ */ jsxs(
16377
+ "div",
16378
+ {
16379
+ className: cn(
16380
+ "text-[1.5rem] flex items-center gap-[0.75rem]",
16381
+ "[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",
16382
+ {
16383
+ "[&>svg]:opacity-20": isLoading
16384
+ }
16385
+ ),
16386
+ children: [
16387
+ /* @__PURE__ */ jsx(PackageIcon, {}),
16388
+ /* @__PURE__ */ jsx(
16389
+ "h2",
15759
16390
  {
15760
- "[&>svg]:opacity-20": isLoading
16391
+ className: cn({
16392
+ "bg-surface4 flex rounded-lg min-w-[50%]": isLoading
16393
+ }),
16394
+ children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: " " }) : title
15761
16395
  }
15762
- ),
15763
- children: [
15764
- /* @__PURE__ */ jsx(PackageIcon, {}),
15765
- /* @__PURE__ */ jsx(
15766
- "h2",
15767
- {
15768
- className: cn({
15769
- "bg-surface4 flex rounded-lg min-w-[50%]": isLoading
15770
- }),
15771
- children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: " " }) : title
15772
- }
15773
- )
15774
- ]
15775
- }
15776
- ),
15777
- /* @__PURE__ */ jsx(
15778
- "div",
15779
- {
15780
- className: "w-full h-full bg-cover bg-center transition-scale duration-150 rounded-lg overflow-hidden min-h-[2rem] mt-[2rem] lg:mt-0",
15781
- style: {
15782
- backgroundImage: `url(${imageURL})`
15783
- }
15784
- }
15785
- )
15786
- ] }),
15787
- /* @__PURE__ */ jsxs("div", { className: "grid lg:grid-cols-[1fr_1fr] gap-x-[6rem] mt-[2rem] ", children: [
16396
+ )
16397
+ ]
16398
+ }
16399
+ ) }),
16400
+ /* @__PURE__ */ jsxs("div", { className: "grid lg:grid-cols-[1fr_1fr] gap-x-[6rem] ", children: [
15788
16401
  /* @__PURE__ */ jsxs("div", { className: "grid", children: [
15789
16402
  /* @__PURE__ */ jsx(
15790
16403
  "p",
@@ -18382,5 +18995,5 @@ const MemorySearch = ({
18382
18995
  ] });
18383
18996
  };
18384
18997
 
18385
- export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AgentsTableSkeleton, AiIcon, AlertDialog, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyAgentsTable, EmptyScorerList, EmptyState, EmptyWorkflowsTable, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LinkComponentProvider, LogsIcon, MainContentContent, MainContentLayout, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, NetworkChat, NetworkContext, NetworkProvider, NetworkTable, NetworkTableEmpty, NetworkTableSkeleton, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreIcon, ScorerList, ScorerSkeleton, SearchField, Searchbar, SelectField, SettingsIcon, SideDialog, SideDialogCodeSection, SideDialogContent, SideDialogFooter, SideDialogFooterGroup, SideDialogHeader, SideDialogHeading, SideDialogKeyValueList, SideDialogSection, SideDialogTop, SlashIcon, SliderField, Tab, TabContent, TabList, Table$1 as Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, TextareaField, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolList, ToolListEmpty, ToolListSkeleton, ToolsIcon, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VNextNetworkChat, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowRuns, WorkflowTable, WorkflowTableSkeleton, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToWatchResult, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, mapWorkflowStreamChunkToWatchResult, providerMapToIcon, spanTypePrefixes, transformKey, useAgentSettings, useCurrentRun, useInView, useLinkComponent, useMastraClient, usePlaygroundStore, usePolling, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSpeechRecognition, useWorkingMemory };
18998
+ export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AgentsTableSkeleton, AiIcon, AlertDialog, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyAgentsTable, EmptyScorerList, EmptyState, EmptyWorkflowsTable, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LinkComponentProvider, LogsIcon, MainContentContent, MainContentLayout, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, NetworkChat, NetworkContext, NetworkProvider, NetworkTable, NetworkTableEmpty, NetworkTableSkeleton, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreIcon, ScorerList, ScorerSkeleton, SearchField, Searchbar, SelectField, SettingsIcon, SideDialog, SideDialogCodeSection, SideDialogContent, SideDialogFooter, SideDialogFooterGroup, SideDialogHeader, SideDialogHeading, SideDialogKeyValueList, SideDialogSection, SideDialogTop, SlashIcon, SliderField, Tab, TabContent, TabList, Table$1 as Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, TextareaField, Th, Thead, ThreadDeleteButton, ThreadInputProvider, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolList, ToolListEmpty, ToolListSkeleton, ToolsIcon, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VNextNetworkChat, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowRuns, WorkflowTable, WorkflowTableSkeleton, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToWatchResult, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, mapWorkflowStreamChunkToWatchResult, providerMapToIcon, spanTypePrefixes, transformKey, useAgentSettings, useCurrentRun, useInView, useLinkComponent, useMastraClient, usePlaygroundStore, usePolling, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSpeechRecognition, useThreadInput, useWorkingMemory };
18386
18999
  //# sourceMappingURL=index.es.js.map