@mastra/playground-ui 0.0.0-vnext-inngest-20250508122351 → 0.0.0-vnextAgentNetwork-20250527091247

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 (240) hide show
  1. package/dist/index.cjs.js +1164 -466
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.css +2 -2
  4. package/dist/index.d.ts +1 -22
  5. package/dist/index.es.js +1155 -469
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/src/components/assistant-ui/image-with-fallback.d.ts +3 -0
  8. package/dist/{components → src/components}/assistant-ui/thread.d.ts +3 -1
  9. package/dist/src/components/assistant-ui/use-has-attachments.d.ts +1 -0
  10. package/dist/{components → src/components}/ui/data-table.d.ts +2 -1
  11. package/dist/src/domains/agents/agent/agent-chat.d.ts +3 -0
  12. package/dist/{domains → src/domains}/agents/agent/context/agent-context.d.ts +4 -3
  13. package/dist/{domains → src/domains}/traces/types.d.ts +9 -4
  14. package/dist/src/domains/traces/utils/createSpanTree.d.ts +3 -0
  15. package/dist/src/domains/workflows/context/legacy-workflow-nested-graph-context.d.ts +13 -0
  16. package/dist/{domains → src/domains}/workflows/context/workflow-nested-graph-context.d.ts +4 -3
  17. package/dist/{domains → src/domains}/workflows/context/workflow-run-context.d.ts +4 -4
  18. package/dist/{domains → src/domains}/workflows/index.d.ts +3 -3
  19. package/dist/src/domains/workflows/workflow/legacy-workflow-graph-inner.d.ts +5 -0
  20. package/dist/{domains/workflows/workflow/v-next-workflow-graph.d.ts → src/domains/workflows/workflow/legacy-workflow-graph.d.ts} +1 -1
  21. package/dist/{domains/workflows/workflow/workflow-nested-graph.d.ts → src/domains/workflows/workflow/legacy-workflow-nested-graph.d.ts} +1 -1
  22. package/dist/src/domains/workflows/workflow/legacy-workflow-nested-node.d.ts +12 -0
  23. package/dist/src/domains/workflows/workflow/legacy-workflow-status.d.ts +6 -0
  24. package/dist/{domains/workflows/workflow/v-next-workflow-trigger.d.ts → src/domains/workflows/workflow/legacy-workflow-trigger.d.ts} +1 -1
  25. package/dist/{domains → src/domains}/workflows/workflow/utils.d.ts +5 -5
  26. package/dist/src/domains/workflows/workflow/workflow-card.d.ts +6 -0
  27. package/dist/{domains → src/domains}/workflows/workflow/workflow-graph-inner.d.ts +2 -2
  28. package/dist/src/domains/workflows/workflow/workflow-nested-graph.d.ts +6 -0
  29. package/dist/{domains → src/domains}/workflows/workflow/workflow-nested-node.d.ts +2 -2
  30. package/dist/src/domains/workflows/workflow/workflow-result.d.ts +5 -0
  31. package/dist/src/domains/workflows/workflow/workflow-status.d.ts +5 -0
  32. package/dist/src/ds/components/Entity/Entity.d.ts +10 -0
  33. package/dist/src/ds/components/Entity/index.d.ts +1 -0
  34. package/dist/{ds → src/ds}/components/TraceTree/Span.d.ts +3 -1
  35. package/dist/{ds → src/ds}/components/TraceTree/Time.d.ts +2 -1
  36. package/dist/{ds → src/ds}/components/TraceTree/Trace.d.ts +2 -1
  37. package/dist/src/ds/icons/AgentNetworkCoinIcon.d.ts +1 -0
  38. package/dist/src/ds/icons/FolderIcon.d.ts +3 -0
  39. package/dist/{ds → src/ds}/icons/Icon.d.ts +1 -1
  40. package/dist/src/ds/icons/McpCoinIcon.d.ts +3 -0
  41. package/dist/src/ds/icons/McpServerIcon.d.ts +3 -0
  42. package/dist/src/ds/icons/ToolCoinIcon.d.ts +3 -0
  43. package/dist/{ds → src/ds}/icons/index.d.ts +5 -0
  44. package/dist/{ds → src/ds}/tokens/sizes.d.ts +1 -0
  45. package/dist/src/hooks/use-speech-recognition.d.ts +15 -0
  46. package/dist/src/hooks/use-workflows.d.ts +91 -0
  47. package/dist/src/index.d.ts +26 -0
  48. package/dist/src/lib/file.d.ts +1 -0
  49. package/dist/{services → src/services}/mastra-runtime-provider.d.ts +1 -1
  50. package/dist/src/store/agent-store.d.ts +20 -0
  51. package/dist/src/store/playground-store.d.ts +16 -0
  52. package/dist/{types.d.ts → src/types.d.ts} +3 -4
  53. package/dist/tokens.cjs.js +1 -0
  54. package/dist/tokens.cjs.js.map +1 -1
  55. package/dist/tokens.d.ts +1 -1
  56. package/dist/tokens.es.js +1 -0
  57. package/dist/tokens.es.js.map +1 -1
  58. package/package.json +6 -5
  59. package/dist/domains/agents/agent/agent-chat.d.ts +0 -3
  60. package/dist/domains/workflows/context/v-next-workflow-nested-graph-context.d.ts +0 -14
  61. package/dist/domains/workflows/workflow/v-next-workflow-graph-inner.d.ts +0 -5
  62. package/dist/domains/workflows/workflow/v-next-workflow-nested-graph.d.ts +0 -6
  63. package/dist/domains/workflows/workflow/v-next-workflow-nested-node.d.ts +0 -11
  64. package/dist/ds/components/TraceTree/Trace.context.d.ts +0 -9
  65. package/dist/hooks/use-workflows.d.ts +0 -90
  66. /package/dist/{components → src/components}/assistant-ui/assistant-message.d.ts +0 -0
  67. /package/dist/{components → src/components}/assistant-ui/assistant-modal.d.ts +0 -0
  68. /package/dist/{components → src/components}/assistant-ui/attachment.d.ts +0 -0
  69. /package/dist/{components → src/components}/assistant-ui/markdown-text.d.ts +0 -0
  70. /package/dist/{components → src/components}/assistant-ui/syntax-highlighter.d.ts +0 -0
  71. /package/dist/{components → src/components}/assistant-ui/thread-list.d.ts +0 -0
  72. /package/dist/{components → src/components}/assistant-ui/tool-fallback.d.ts +0 -0
  73. /package/dist/{components → src/components}/assistant-ui/tooltip-icon-button.d.ts +0 -0
  74. /package/dist/{components → src/components}/assistant-ui/user-message.d.ts +0 -0
  75. /package/dist/{components → src/components}/dynamic-form/index.d.ts +0 -0
  76. /package/dist/{components → src/components}/dynamic-form/utils.d.ts +0 -0
  77. /package/dist/{components → src/components}/icons/agent-icon.d.ts +0 -0
  78. /package/dist/{components → src/components}/icons/automation-icon.d.ts +0 -0
  79. /package/dist/{components → src/components}/syntax-highlighter.d.ts +0 -0
  80. /package/dist/{components → src/components}/threads.d.ts +0 -0
  81. /package/dist/{components → src/components}/ui/alert.d.ts +0 -0
  82. /package/dist/{components → src/components}/ui/autoform/AutoForm.d.ts +0 -0
  83. /package/dist/{components → src/components}/ui/autoform/components/ArrayElementWrapper.d.ts +0 -0
  84. /package/dist/{components → src/components}/ui/autoform/components/ArrayWrapper.d.ts +0 -0
  85. /package/dist/{components → src/components}/ui/autoform/components/BooleanField.d.ts +0 -0
  86. /package/dist/{components → src/components}/ui/autoform/components/DateField.d.ts +0 -0
  87. /package/dist/{components → src/components}/ui/autoform/components/ErrorMessage.d.ts +0 -0
  88. /package/dist/{components → src/components}/ui/autoform/components/FieldWrapper.d.ts +0 -0
  89. /package/dist/{components → src/components}/ui/autoform/components/Form.d.ts +0 -0
  90. /package/dist/{components → src/components}/ui/autoform/components/NumberField.d.ts +0 -0
  91. /package/dist/{components → src/components}/ui/autoform/components/ObjectWrapper.d.ts +0 -0
  92. /package/dist/{components → src/components}/ui/autoform/components/RecordField.d.ts +0 -0
  93. /package/dist/{components → src/components}/ui/autoform/components/SelectField.d.ts +0 -0
  94. /package/dist/{components → src/components}/ui/autoform/components/StringField.d.ts +0 -0
  95. /package/dist/{components → src/components}/ui/autoform/components/SubmitButton.d.ts +0 -0
  96. /package/dist/{components → src/components}/ui/autoform/index.d.ts +0 -0
  97. /package/dist/{components → src/components}/ui/autoform/types.d.ts +0 -0
  98. /package/dist/{components → src/components}/ui/autoform/utils.d.ts +0 -0
  99. /package/dist/{components → src/components}/ui/autoform/zodProvider/field-type-inference.d.ts +0 -0
  100. /package/dist/{components → src/components}/ui/autoform/zodProvider/index.d.ts +0 -0
  101. /package/dist/{components → src/components}/ui/avatar.d.ts +0 -0
  102. /package/dist/{components → src/components}/ui/badge.d.ts +0 -0
  103. /package/dist/{components → src/components}/ui/button.d.ts +0 -0
  104. /package/dist/{components → src/components}/ui/calendar.d.ts +0 -0
  105. /package/dist/{components → src/components}/ui/card.d.ts +0 -0
  106. /package/dist/{components → src/components}/ui/checkbox.d.ts +0 -0
  107. /package/dist/{components → src/components}/ui/code-block.d.ts +0 -0
  108. /package/dist/{components → src/components}/ui/collapsible.d.ts +0 -0
  109. /package/dist/{components → src/components}/ui/command.d.ts +0 -0
  110. /package/dist/{components → src/components}/ui/copy-button.d.ts +0 -0
  111. /package/dist/{components → src/components}/ui/copyable-content.d.ts +0 -0
  112. /package/dist/{components → src/components}/ui/date-picker.d.ts +0 -0
  113. /package/dist/{components → src/components}/ui/dialog.d.ts +0 -0
  114. /package/dist/{components → src/components}/ui/form.d.ts +0 -0
  115. /package/dist/{components → src/components}/ui/formatted-date.d.ts +0 -0
  116. /package/dist/{components → src/components}/ui/input.d.ts +0 -0
  117. /package/dist/{components → src/components}/ui/label.d.ts +0 -0
  118. /package/dist/{components → src/components}/ui/markdown-renderer.d.ts +0 -0
  119. /package/dist/{components → src/components}/ui/popover.d.ts +0 -0
  120. /package/dist/{components → src/components}/ui/resizable.d.ts +0 -0
  121. /package/dist/{components → src/components}/ui/score-indicator.d.ts +0 -0
  122. /package/dist/{components → src/components}/ui/scroll-area.d.ts +0 -0
  123. /package/dist/{components → src/components}/ui/select.d.ts +0 -0
  124. /package/dist/{components → src/components}/ui/skeleton.d.ts +0 -0
  125. /package/dist/{components → src/components}/ui/spinner.d.ts +0 -0
  126. /package/dist/{components → src/components}/ui/switch.d.ts +0 -0
  127. /package/dist/{components → src/components}/ui/syntax-highlighter.d.ts +0 -0
  128. /package/dist/{components → src/components}/ui/table.d.ts +0 -0
  129. /package/dist/{components → src/components}/ui/tabs.d.ts +0 -0
  130. /package/dist/{components → src/components}/ui/text.d.ts +0 -0
  131. /package/dist/{components → src/components}/ui/textarea.d.ts +0 -0
  132. /package/dist/{components → src/components}/ui/toggle.d.ts +0 -0
  133. /package/dist/{components → src/components}/ui/tooltip.d.ts +0 -0
  134. /package/dist/{domains → src/domains}/agents/agent/agent-evals.d.ts +0 -0
  135. /package/dist/{domains → src/domains}/agents/agent/agent-traces.d.ts +0 -0
  136. /package/dist/{domains → src/domains}/agents/index.d.ts +0 -0
  137. /package/dist/{domains → src/domains}/networks/index.d.ts +0 -0
  138. /package/dist/{domains → src/domains}/networks/network-chat.d.ts +0 -0
  139. /package/dist/{domains → src/domains}/networks/network-context.d.ts +0 -0
  140. /package/dist/{domains → src/domains}/networks/tool-fallback.d.ts +0 -0
  141. /package/dist/{domains → src/domains}/resizable-panel.d.ts +0 -0
  142. /package/dist/{domains → src/domains}/traces/context/trace-context.d.ts +0 -0
  143. /package/dist/{domains → src/domains}/traces/hooks/use-open-trace.d.ts +0 -0
  144. /package/dist/{domains → src/domains}/traces/mock-data.d.ts +0 -0
  145. /package/dist/{domains → src/domains}/traces/trace-details.d.ts +0 -0
  146. /package/dist/{domains → src/domains}/traces/trace-span-details.d.ts +0 -0
  147. /package/dist/{domains → src/domains}/traces/trace-span-view.d.ts +0 -0
  148. /package/dist/{domains → src/domains}/traces/traces-sidebar.d.ts +0 -0
  149. /package/dist/{domains → src/domains}/traces/traces-table.d.ts +0 -0
  150. /package/dist/{domains → src/domains}/traces/utils/getSpanVariant.d.ts +0 -0
  151. /package/dist/{domains → src/domains}/traces/utils.d.ts +0 -0
  152. /package/dist/{domains → src/domains}/workflows/workflow/workflow-after-node.d.ts +0 -0
  153. /package/dist/{domains → src/domains}/workflows/workflow/workflow-condition-node.d.ts +0 -0
  154. /package/dist/{domains → src/domains}/workflows/workflow/workflow-default-node.d.ts +0 -0
  155. /package/dist/{domains → src/domains}/workflows/workflow/workflow-graph.d.ts +0 -0
  156. /package/dist/{domains → src/domains}/workflows/workflow/workflow-loop-result-node.d.ts +0 -0
  157. /package/dist/{domains → src/domains}/workflows/workflow/workflow-traces.d.ts +0 -0
  158. /package/dist/{domains → src/domains}/workflows/workflow/workflow-trigger.d.ts +0 -0
  159. /package/dist/{ds → src/ds}/components/Avatar/Avatar.d.ts +0 -0
  160. /package/dist/{ds → src/ds}/components/Avatar/index.d.ts +0 -0
  161. /package/dist/{ds → src/ds}/components/Badge/Badge.d.ts +0 -0
  162. /package/dist/{ds → src/ds}/components/Badge/index.d.ts +0 -0
  163. /package/dist/{ds → src/ds}/components/Breadcrumb/Breadcrumb.d.ts +0 -0
  164. /package/dist/{ds → src/ds}/components/Breadcrumb/index.d.ts +0 -0
  165. /package/dist/{ds → src/ds}/components/Button/Button.d.ts +0 -0
  166. /package/dist/{ds → src/ds}/components/Button/index.d.ts +0 -0
  167. /package/dist/{ds → src/ds}/components/EmptyState/EmptyState.d.ts +0 -0
  168. /package/dist/{ds → src/ds}/components/EmptyState/index.d.ts +0 -0
  169. /package/dist/{ds → src/ds}/components/Header/Header.d.ts +0 -0
  170. /package/dist/{ds → src/ds}/components/Header/index.d.ts +0 -0
  171. /package/dist/{ds → src/ds}/components/Logo/MastraLogo.d.ts +0 -0
  172. /package/dist/{ds → src/ds}/components/Logo/index.d.ts +0 -0
  173. /package/dist/{ds → src/ds}/components/Table/Cells.d.ts +0 -0
  174. /package/dist/{ds → src/ds}/components/Table/Table.d.ts +0 -0
  175. /package/dist/{ds → src/ds}/components/Table/index.d.ts +0 -0
  176. /package/dist/{ds → src/ds}/components/Table/utils.d.ts +0 -0
  177. /package/dist/{ds → src/ds}/components/TraceTree/Spans.d.ts +0 -0
  178. /package/dist/{ds → src/ds}/components/TraceTree/TraceTree.d.ts +0 -0
  179. /package/dist/{ds → src/ds}/components/TraceTree/index.d.ts +0 -0
  180. /package/dist/{ds → src/ds}/components/Txt/Txt.d.ts +0 -0
  181. /package/dist/{ds → src/ds}/components/Txt/index.d.ts +0 -0
  182. /package/dist/{ds → src/ds}/components/types.d.ts +0 -0
  183. /package/dist/{ds → src/ds}/icons/AgentCoinIcon.d.ts +0 -0
  184. /package/dist/{ds → src/ds}/icons/AgentIcon.d.ts +0 -0
  185. /package/dist/{ds → src/ds}/icons/AiIcon.d.ts +0 -0
  186. /package/dist/{ds → src/ds}/icons/ApiIcon.d.ts +0 -0
  187. /package/dist/{ds → src/ds}/icons/BranchIcon.d.ts +0 -0
  188. /package/dist/{ds → src/ds}/icons/CheckIcon.d.ts +0 -0
  189. /package/dist/{ds → src/ds}/icons/ChevronIcon.d.ts +0 -0
  190. /package/dist/{ds → src/ds}/icons/CommitIcon.d.ts +0 -0
  191. /package/dist/{ds → src/ds}/icons/CrossIcon.d.ts +0 -0
  192. /package/dist/{ds → src/ds}/icons/DbIcon.d.ts +0 -0
  193. /package/dist/{ds → src/ds}/icons/DebugIcon.d.ts +0 -0
  194. /package/dist/{ds → src/ds}/icons/DeploymentIcon.d.ts +0 -0
  195. /package/dist/{ds → src/ds}/icons/DividerIcon.d.ts +0 -0
  196. /package/dist/{ds → src/ds}/icons/DocsIcon.d.ts +0 -0
  197. /package/dist/{ds → src/ds}/icons/EnvIcon.d.ts +0 -0
  198. /package/dist/{ds → src/ds}/icons/EvaluatorCoinIcon.d.ts +0 -0
  199. /package/dist/{ds → src/ds}/icons/FiltersIcon.d.ts +0 -0
  200. /package/dist/{ds → src/ds}/icons/GithubCoinIcon.d.ts +0 -0
  201. /package/dist/{ds → src/ds}/icons/GithubIcon.d.ts +0 -0
  202. /package/dist/{ds → src/ds}/icons/GoogleIcon.d.ts +0 -0
  203. /package/dist/{ds → src/ds}/icons/HomeIcon.d.ts +0 -0
  204. /package/dist/{ds → src/ds}/icons/InfoIcon.d.ts +0 -0
  205. /package/dist/{ds → src/ds}/icons/JudgeIcon.d.ts +0 -0
  206. /package/dist/{ds → src/ds}/icons/LatencyIcon.d.ts +0 -0
  207. /package/dist/{ds → src/ds}/icons/LogsIcon.d.ts +0 -0
  208. /package/dist/{ds → src/ds}/icons/MemoryIcon.d.ts +0 -0
  209. /package/dist/{ds → src/ds}/icons/OpenAIIcon.d.ts +0 -0
  210. /package/dist/{ds → src/ds}/icons/PromptIcon.d.ts +0 -0
  211. /package/dist/{ds → src/ds}/icons/RepoIcon.d.ts +0 -0
  212. /package/dist/{ds → src/ds}/icons/ScoreIcon.d.ts +0 -0
  213. /package/dist/{ds → src/ds}/icons/SettingsIcon.d.ts +0 -0
  214. /package/dist/{ds → src/ds}/icons/SlashIcon.d.ts +0 -0
  215. /package/dist/{ds → src/ds}/icons/ToolsIcon.d.ts +0 -0
  216. /package/dist/{ds → src/ds}/icons/TraceIcon.d.ts +0 -0
  217. /package/dist/{ds → src/ds}/icons/TsIcon.d.ts +0 -0
  218. /package/dist/{ds → src/ds}/icons/VariablesIcon.d.ts +0 -0
  219. /package/dist/{ds → src/ds}/icons/WorkflowCoinIcon.d.ts +0 -0
  220. /package/dist/{ds → src/ds}/icons/WorkflowIcon.d.ts +0 -0
  221. /package/dist/{ds → src/ds}/tokens/borders.d.ts +0 -0
  222. /package/dist/{ds → src/ds}/tokens/colors.d.ts +0 -0
  223. /package/dist/{ds → src/ds}/tokens/fonts.d.ts +0 -0
  224. /package/dist/{ds → src/ds}/tokens/index.d.ts +0 -0
  225. /package/dist/{ds → src/ds}/tokens/spacings.d.ts +0 -0
  226. /package/dist/{hooks → src/hooks}/index.d.ts +0 -0
  227. /package/dist/{hooks → src/hooks}/use-autoscroll.d.ts +0 -0
  228. /package/dist/{hooks → src/hooks}/use-copy-to-clipboard.d.ts +0 -0
  229. /package/dist/{hooks → src/hooks}/use-evals.d.ts +0 -0
  230. /package/dist/{hooks → src/hooks}/use-resize-column.d.ts +0 -0
  231. /package/dist/{hooks → src/hooks}/use-traces.d.ts +0 -0
  232. /package/dist/{lib → src/lib}/mastra-client.d.ts +0 -0
  233. /package/dist/{lib → src/lib}/number.d.ts +0 -0
  234. /package/dist/{lib → src/lib}/object.d.ts +0 -0
  235. /package/dist/{lib → src/lib}/pagination/types.d.ts +0 -0
  236. /package/dist/{lib → src/lib}/polls.d.ts +0 -0
  237. /package/dist/{lib → src/lib}/string.d.ts +0 -0
  238. /package/dist/{lib → src/lib}/utils.d.ts +0 -0
  239. /package/dist/{main.d.ts → src/main.d.ts} +0 -0
  240. /package/dist/{services → src/services}/network-runtime-provider.d.ts +0 -0
package/dist/index.cjs.js CHANGED
@@ -18,7 +18,12 @@ const langJson = require('@codemirror/lang-json');
18
18
  const highlight$1 = require('@lezer/highlight');
19
19
  const codemirrorThemeDracula = require('@uiw/codemirror-theme-dracula');
20
20
  const CodeMirror = require('@uiw/react-codemirror');
21
+ const DialogPrimitive = require('@radix-ui/react-dialog');
22
+ const shallow = require('zustand/shallow');
23
+ const di = require('@mastra/core/di');
21
24
  const clientJs = require('@mastra/client-js');
25
+ const zustand = require('zustand');
26
+ const middleware = require('zustand/middleware');
22
27
  const dateFns = require('date-fns');
23
28
  const TabsPrimitive = require('@radix-ui/react-tabs');
24
29
  const sonner = require('sonner');
@@ -26,24 +31,24 @@ const react$1 = require('motion/react');
26
31
  const uiUtils = require('@ai-sdk/ui-utils');
27
32
  const Markdown = require('react-markdown');
28
33
  const useDebounce = require('use-debounce');
34
+ const runtimeContext = require('@mastra/core/runtime-context');
29
35
  const react$2 = require('@xyflow/react');
30
36
  require('@xyflow/react/dist/style.css');
31
37
  const Dagre = require('@dagrejs/dagre');
32
38
  const prismReactRenderer = require('prism-react-renderer');
33
39
  const CollapsiblePrimitive = require('@radix-ui/react-collapsible');
34
- const DialogPrimitive = require('@radix-ui/react-dialog');
35
40
  const ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
36
41
  const jsonSchemaToZod = require('json-schema-to-zod');
37
42
  const superjson = require('superjson');
38
43
  const z = require('zod');
39
44
  const react$3 = require('@autoform/react');
40
- const LabelPrimitive = require('@radix-ui/react-label');
41
45
  const CheckboxPrimitive = require('@radix-ui/react-checkbox');
42
46
  const reactDayPicker = require('react-day-picker');
43
47
  const PopoverPrimitive = require('@radix-ui/react-popover');
44
48
  const SelectPrimitive = require('@radix-ui/react-select');
45
49
  const uuid = require('@lukeed/uuid');
46
50
  const zod = require('@autoform/zod');
51
+ const LabelPrimitive = require('@radix-ui/react-label');
47
52
  const reactCodeBlock = require('react-code-block');
48
53
  const reactTable = require('@tanstack/react-table');
49
54
 
@@ -67,14 +72,14 @@ function _interopNamespaceDefault(e) {
67
72
  const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
68
73
  const TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TooltipPrimitive);
69
74
  const AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(AvatarPrimitive);
75
+ const DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
70
76
  const TabsPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TabsPrimitive);
71
77
  const CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CollapsiblePrimitive);
72
- const DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
73
78
  const ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(ScrollAreaPrimitive);
74
- const LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(LabelPrimitive);
75
79
  const CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CheckboxPrimitive);
76
80
  const PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(PopoverPrimitive);
77
81
  const SelectPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(SelectPrimitive);
82
+ const LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(LabelPrimitive);
78
83
 
79
84
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
80
85
 
@@ -2918,6 +2923,46 @@ const AvatarFallback = React__namespace.forwardRef(({ className, ...props }, ref
2918
2923
  ));
2919
2924
  AvatarFallback.displayName = AvatarPrimitive__namespace.Fallback.displayName;
2920
2925
 
2926
+ const ImageWithFallback = ({ alt, src, ...rest }) => {
2927
+ const [error, setError] = React.useState(false);
2928
+ React.useEffect(() => {
2929
+ setError(false);
2930
+ }, [src]);
2931
+ return error || !src ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2932
+ /* @__PURE__ */ jsxRuntime.jsx(
2933
+ "svg",
2934
+ {
2935
+ xmlns: "http://www.w3.org/2000/svg",
2936
+ fill: "none",
2937
+ viewBox: "0 0 24 24",
2938
+ strokeWidth: "1.5",
2939
+ stroke: "currentColor",
2940
+ width: "150",
2941
+ height: "150",
2942
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2943
+ "path",
2944
+ {
2945
+ strokeLinecap: "round",
2946
+ strokeLinejoin: "round",
2947
+ d: "m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"
2948
+ }
2949
+ )
2950
+ }
2951
+ ),
2952
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs italic text-muted-foreground -mt-[0.625rem] mb-[0.625rem]", children: "Image link is broken" })
2953
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
2954
+ "img",
2955
+ {
2956
+ src,
2957
+ alt,
2958
+ ...rest,
2959
+ onError: () => {
2960
+ setError(true);
2961
+ }
2962
+ }
2963
+ );
2964
+ };
2965
+
2921
2966
  const SyntaxHighlighter$2 = reactSyntaxHighlighter.makePrismAsyncSyntaxHighlighter({
2922
2967
  style: prism.coldarkDark,
2923
2968
  customStyle: {
@@ -3137,10 +3182,12 @@ const defaultComponents = reactMarkdown.unstable_memoizeMarkdownComponents({
3137
3182
  );
3138
3183
  },
3139
3184
  CodeHeader,
3140
- SyntaxHighlighter: SyntaxHighlighter$2
3185
+ SyntaxHighlighter: SyntaxHighlighter$2,
3186
+ img: ImageWithFallback
3141
3187
  });
3142
3188
 
3143
3189
  const sizes = {
3190
+ sm: "[&>svg]:h-icon-sm [&>svg]:w-icon-sm",
3144
3191
  default: "[&>svg]:h-icon-default [&>svg]:w-icon-default",
3145
3192
  lg: "[&>svg]:h-icon-lg [&>svg]:w-icon-lg"
3146
3193
  };
@@ -3519,10 +3566,10 @@ const GithubIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "1
3519
3566
  "path",
3520
3567
  {
3521
3568
  d: "M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",
3522
- fill: "white"
3569
+ fill: "currentColor"
3523
3570
  }
3524
3571
  ) }),
3525
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "14", height: "14", fill: "white", transform: "translate(0.5 0.75)" }) }) })
3572
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "14", height: "14", fill: "currentColor", transform: "translate(0.5 0.75)" }) }) })
3526
3573
  ] });
3527
3574
 
3528
3575
  const GoogleIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
@@ -3751,7 +3798,7 @@ const WorkflowIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "
3751
3798
  fillRule: "evenodd",
3752
3799
  clipRule: "evenodd",
3753
3800
  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",
3754
- fill: "white"
3801
+ fill: "currentColor"
3755
3802
  }
3756
3803
  ) });
3757
3804
 
@@ -3813,6 +3860,149 @@ const LatencyIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "
3813
3860
  )
3814
3861
  ] });
3815
3862
 
3863
+ const McpServerIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3864
+ /* @__PURE__ */ jsxRuntime.jsx(
3865
+ "path",
3866
+ {
3867
+ d: "M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",
3868
+ fill: "currentColor"
3869
+ }
3870
+ ),
3871
+ /* @__PURE__ */ jsxRuntime.jsx(
3872
+ "path",
3873
+ {
3874
+ d: "M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",
3875
+ fill: "currentColor"
3876
+ }
3877
+ )
3878
+ ] });
3879
+
3880
+ const FolderIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
3881
+ "path",
3882
+ {
3883
+ d: "M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",
3884
+ stroke: "currentColor",
3885
+ strokeLinecap: "round",
3886
+ strokeLinejoin: "round"
3887
+ }
3888
+ ) });
3889
+
3890
+ const McpCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3891
+ /* @__PURE__ */ jsxRuntime.jsx(
3892
+ "path",
3893
+ {
3894
+ d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",
3895
+ fill: "#2E2E2E",
3896
+ fillOpacity: "0.9"
3897
+ }
3898
+ ),
3899
+ /* @__PURE__ */ jsxRuntime.jsx(
3900
+ "path",
3901
+ {
3902
+ d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",
3903
+ stroke: "#424242"
3904
+ }
3905
+ ),
3906
+ /* @__PURE__ */ jsxRuntime.jsx(
3907
+ "path",
3908
+ {
3909
+ d: "M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",
3910
+ stroke: "#707070"
3911
+ }
3912
+ ),
3913
+ /* @__PURE__ */ jsxRuntime.jsx(
3914
+ "path",
3915
+ {
3916
+ d: "M51.5215 39.9726C50.5464 40.4477 48.9738 40.4435 48.009 39.9634C47.0442 39.4833 47.0526 38.709 48.0277 38.2339L69.7191 27.6672C72.7243 26.2032 72.7347 23.8181 69.7605 22.3476L69.6898 22.313C66.6927 20.8686 61.8895 20.8864 58.9368 22.3528L30.3946 36.5278C29.4288 37.0074 27.8561 37.0107 26.882 36.5352C25.9078 36.0597 25.901 35.2853 26.8668 34.8057L55.4092 20.6308C60.2847 18.2094 68.2157 18.1801 73.1645 20.5651L73.2814 20.6222C76.1808 22.0558 77.3624 24.0157 76.8227 25.8782C80.6339 25.5828 84.6694 26.1476 87.6364 27.5775C92.6525 29.9949 92.7059 33.962 87.7554 36.4119L61.5441 49.3836C61.282 49.5133 61.281 49.7227 61.5417 49.853L67.0252 52.5932C67.988 53.0743 67.9763 53.8486 66.9992 54.3226C66.0221 54.7966 64.4495 54.7909 63.4867 54.3098L58.0033 51.5695C55.8306 50.4838 55.8392 48.7391 58.0226 47.6585L84.2339 34.6868C87.2382 33.2 87.2058 30.7925 84.1617 29.3254C81.1488 27.8734 76.1811 27.9317 73.2127 29.4058L51.5215 39.9726Z",
3917
+ fill: "#A9A9A9"
3918
+ }
3919
+ ),
3920
+ /* @__PURE__ */ jsxRuntime.jsx(
3921
+ "path",
3922
+ {
3923
+ d: "M63.0028 23.8809C64.0019 23.4098 65.5873 23.4146 66.5747 23.8972C67.562 24.3798 67.5831 25.1603 66.6338 25.6556L66.5879 25.679L45.1511 36.3113C42.2204 37.7649 42.2292 40.1117 45.1707 41.56C48.1228 43.0135 52.91 43.0118 55.8578 41.5563L76.8564 31.1875L76.9037 31.1648C77.9049 30.6949 79.4903 30.7013 80.4755 31.185C81.4763 31.6764 81.4785 32.4741 80.4806 32.9669L59.4821 43.3356C54.5363 45.7777 46.5044 45.7806 41.5516 43.342C36.6166 40.9121 36.602 36.9747 41.519 34.5359L62.9558 23.9037L63.0028 23.8809Z",
3924
+ fill: "#A9A9A9"
3925
+ }
3926
+ )
3927
+ ] });
3928
+
3929
+ const ToolCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3930
+ /* @__PURE__ */ jsxRuntime.jsx(
3931
+ "path",
3932
+ {
3933
+ d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",
3934
+ fill: "#2E2E2E",
3935
+ fillOpacity: "0.9"
3936
+ }
3937
+ ),
3938
+ /* @__PURE__ */ jsxRuntime.jsx(
3939
+ "path",
3940
+ {
3941
+ d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",
3942
+ stroke: "#424242"
3943
+ }
3944
+ ),
3945
+ /* @__PURE__ */ jsxRuntime.jsx(
3946
+ "path",
3947
+ {
3948
+ d: "M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",
3949
+ stroke: "#707070"
3950
+ }
3951
+ ),
3952
+ /* @__PURE__ */ jsxRuntime.jsx(
3953
+ "path",
3954
+ {
3955
+ fillRule: "evenodd",
3956
+ clipRule: "evenodd",
3957
+ d: "M95.8997 32.6647C98.4806 33.9355 98.4744 36.0012 95.8997 37.2689L89.6657 40.3384C87.0848 41.6091 82.8892 41.6061 80.3146 40.3384L74.0805 37.2689C71.4996 35.9981 71.5059 33.9324 74.0805 32.6647L80.3146 29.5952C82.8955 28.3244 87.091 28.3275 89.6657 29.5952L95.8997 32.6647ZM74.0805 21.9215C76.6614 23.1923 76.6552 25.258 74.0805 26.5257L67.8465 29.5952C65.2656 30.866 61.0701 30.8629 58.4954 29.5952L52.2613 26.5257C49.6804 25.255 49.6867 23.1892 52.2613 21.9215L58.4954 18.852C61.0763 17.5813 65.2718 17.5843 67.8465 18.852L74.0805 21.9215ZM74.0805 43.4079C76.6614 44.6786 76.6552 46.7444 74.0805 48.0121L67.8465 51.0816C65.2656 52.3523 61.0701 52.3493 58.4954 51.0816L52.2613 48.0121C49.6804 46.7413 49.6867 44.6756 52.2613 43.4079L58.4954 40.3384C61.0763 39.0676 65.2718 39.0707 67.8465 40.3384L74.0805 43.4079ZM52.2613 32.6647C54.8422 33.9355 54.836 36.0012 52.2613 37.2689L46.0273 40.3384C43.4464 41.6091 39.2509 41.6061 36.6762 40.3384L30.4422 37.2689C27.8613 35.9981 27.8675 33.9324 30.4422 32.6647L36.6762 29.5952C39.2571 28.3244 43.4526 28.3275 46.0273 29.5952L52.2613 32.6647Z",
3958
+ fill: "#A9A9A9"
3959
+ }
3960
+ )
3961
+ ] });
3962
+
3963
+ const AgentNetworkCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3964
+ /* @__PURE__ */ jsxRuntime.jsx(
3965
+ "path",
3966
+ {
3967
+ d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",
3968
+ fill: "#2E2E2E",
3969
+ fillOpacity: "0.9"
3970
+ }
3971
+ ),
3972
+ /* @__PURE__ */ jsxRuntime.jsx(
3973
+ "path",
3974
+ {
3975
+ d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",
3976
+ stroke: "#424242"
3977
+ }
3978
+ ),
3979
+ /* @__PURE__ */ jsxRuntime.jsx(
3980
+ "path",
3981
+ {
3982
+ d: "M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",
3983
+ stroke: "#707070"
3984
+ }
3985
+ ),
3986
+ /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip0_23333_14744)", children: /* @__PURE__ */ jsxRuntime.jsx(
3987
+ "path",
3988
+ {
3989
+ fillRule: "evenodd",
3990
+ clipRule: "evenodd",
3991
+ d: "M79.2946 17.9539C83.0143 19.7854 83.016 22.7559 79.2979 24.5879C77.0214 25.7087 73.8794 26.1385 70.9301 25.8878L67.5296 30.2202C68.0944 30.3987 68.6321 30.6075 69.1262 30.8507C71.0847 31.815 72.0009 33.0948 71.8979 34.3581L77.2504 35.1977C77.6452 34.8727 78.1174 34.5635 78.6856 34.2835C82.4066 32.4514 88.4403 32.4485 92.1623 34.2803C95.8842 36.1128 95.8805 39.0851 92.159 40.9175C88.4373 42.7488 82.4002 42.7513 78.679 40.9191C76.7415 39.9647 75.8248 38.7009 75.9073 37.4506L70.5219 36.6045C70.1354 36.9168 69.6777 37.2145 69.1295 37.4846C68.345 37.8708 67.4527 38.1705 66.5059 38.3939L67.9312 41.984C70.1507 42.0573 72.3276 42.5087 74.0244 43.3438C77.7444 45.1754 77.7467 48.1458 74.0277 49.9778C70.3071 51.8092 64.2712 51.8095 60.551 49.9778C56.8323 48.1459 56.8351 45.1755 60.5543 43.3438C61.3581 42.9482 62.2741 42.6414 63.247 42.4167L61.8282 38.8428C59.5803 38.7777 57.3696 38.3299 55.6527 37.4846C54.1264 36.7327 53.2395 35.7882 52.9666 34.8103L43.924 34.0469C43.4596 34.6259 42.7547 35.1702 41.8041 35.6385C38.0834 37.4696 32.0473 37.4701 28.3273 35.6385C24.6089 33.8068 24.6123 30.8363 28.3306 29.0046C32.0508 27.1737 38.0806 27.1737 41.8008 29.0046C43.3459 29.7653 44.2412 30.7224 44.5033 31.7129L53.5098 32.4747C53.9742 31.8832 54.6868 31.3279 55.656 30.8507C57.6687 29.8601 60.357 29.4079 62.9902 29.4892L66.5783 24.9218C66.3174 24.8179 66.0637 24.7073 65.8212 24.5879C62.1022 22.7559 62.1045 19.7856 65.8245 17.9539C69.5447 16.1235 75.5747 16.1232 79.2946 17.9539ZM38.4299 30.6643C36.5715 29.75 33.5599 29.75 31.7015 30.6643C29.8447 31.5793 29.8414 33.0638 31.6982 33.9788C33.5565 34.8938 36.5742 34.8933 38.4332 33.9788C40.2906 33.0635 40.2883 31.5793 38.4299 30.6643ZM70.6536 45.0035C68.7951 44.0893 65.7836 44.0893 63.9251 45.0035C62.0676 45.9185 62.0647 47.4029 63.9218 48.318C65.7804 49.2332 68.7979 49.2329 70.6569 48.3181C72.5142 47.4027 72.5119 45.9185 70.6536 45.0035ZM65.7553 32.5104C63.8969 31.5961 60.8853 31.5961 59.0269 32.5104C57.1685 33.4254 57.1662 34.9096 59.0236 35.8249C60.8824 36.7402 63.8998 36.7402 65.7586 35.8249C67.616 34.9096 67.6137 33.4254 65.7553 32.5104ZM88.7915 35.94C86.9338 35.0261 83.9184 35.0264 82.0564 35.9432C80.1965 36.8601 80.1945 38.3451 82.0498 39.2594C83.9067 40.1736 86.9255 40.1738 88.7882 39.2578C90.6507 38.3407 90.649 36.8546 88.7915 35.94ZM75.9238 19.6136C74.0656 18.6995 71.0538 18.6998 69.1953 19.6136C67.3369 20.5286 67.3347 22.0129 69.192 22.9282C71.0509 23.8434 74.0682 23.8434 75.9271 22.9282C77.7836 22.0128 77.7818 20.5285 75.9238 19.6136Z",
3992
+ fill: "#A9A9A9"
3993
+ }
3994
+ ) }),
3995
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_23333_14744", children: /* @__PURE__ */ jsxRuntime.jsx(
3996
+ "rect",
3997
+ {
3998
+ width: "59.3185",
3999
+ height: "59.3185",
4000
+ fill: "white",
4001
+ transform: "matrix(0.897148 0.441731 -0.897148 0.441731 65.3042 6.51953)"
4002
+ }
4003
+ ) }) })
4004
+ ] });
4005
+
3816
4006
  const useCodemirrorTheme$1 = () => {
3817
4007
  return React.useMemo(
3818
4008
  () => codemirrorThemeDracula.draculaInit({
@@ -3884,7 +4074,10 @@ const AssistantMessage = ({
3884
4074
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
3885
4075
  react.MessagePrimitive.Content,
3886
4076
  {
3887
- components: { Text: MarkdownText, tools: { Fallback: ToolFallbackCustom || ToolFallback$1 } }
4077
+ components: {
4078
+ Text: MarkdownText,
4079
+ tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
4080
+ }
3888
4081
  }
3889
4082
  ) }),
3890
4083
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar, {}) })
@@ -3906,8 +4099,156 @@ const AssistantActionBar = () => {
3906
4099
  );
3907
4100
  };
3908
4101
 
4102
+ const Dialog = DialogPrimitive__namespace.Root;
4103
+ const DialogTrigger = DialogPrimitive__namespace.Trigger;
4104
+ const DialogPortal = DialogPrimitive__namespace.Portal;
4105
+ const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4106
+ DialogPrimitive__namespace.Overlay,
4107
+ {
4108
+ ref,
4109
+ className: cn(
4110
+ "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",
4111
+ className
4112
+ ),
4113
+ ...props
4114
+ }
4115
+ ));
4116
+ DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
4117
+ const DialogContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
4118
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
4119
+ /* @__PURE__ */ jsxRuntime.jsxs(
4120
+ DialogPrimitive__namespace.Content,
4121
+ {
4122
+ ref,
4123
+ className: cn(
4124
+ "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",
4125
+ className
4126
+ ),
4127
+ ...props,
4128
+ children: [
4129
+ children,
4130
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
4131
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
4132
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
4133
+ ] })
4134
+ ]
4135
+ }
4136
+ )
4137
+ ] }));
4138
+ DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
4139
+ const DialogTitle = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4140
+ DialogPrimitive__namespace.Title,
4141
+ {
4142
+ ref,
4143
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
4144
+ ...props
4145
+ }
4146
+ ));
4147
+ DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
4148
+ const DialogDescription = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
4149
+ DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
4150
+
4151
+ const useHasAttachments = () => {
4152
+ const composer = react.useComposerRuntime();
4153
+ const [hasAttachments, setHasAttachments] = React.useState(false);
4154
+ React.useEffect(() => {
4155
+ composer.subscribe(() => {
4156
+ const attachments = composer.getState().attachments;
4157
+ setHasAttachments(attachments.length > 0);
4158
+ });
4159
+ }, [composer]);
4160
+ return hasAttachments;
4161
+ };
4162
+
4163
+ const useFileSrc = (file) => {
4164
+ const [src, setSrc] = React.useState(void 0);
4165
+ React.useEffect(() => {
4166
+ if (!file) {
4167
+ setSrc(void 0);
4168
+ return;
4169
+ }
4170
+ const objectUrl = URL.createObjectURL(file);
4171
+ setSrc(objectUrl);
4172
+ return () => {
4173
+ URL.revokeObjectURL(objectUrl);
4174
+ };
4175
+ }, [file]);
4176
+ return src;
4177
+ };
4178
+ const useAttachmentSrc = () => {
4179
+ const { file, src } = react.useAttachment(
4180
+ shallow.useShallow((a) => {
4181
+ if (a.type !== "image") return {};
4182
+ if (a.file) return { file: a.file };
4183
+ const src2 = a.content?.filter((c) => c.type === "image")[0]?.image;
4184
+ if (!src2) return {};
4185
+ return { src: src2 };
4186
+ })
4187
+ );
4188
+ return useFileSrc(file) ?? src;
4189
+ };
4190
+ const AttachmentPreview = ({ src }) => {
4191
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden w-full", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src, className: "object-contain aspect-ratio h-full w-full", alt: "Preview" }) });
4192
+ };
4193
+ const AttachmentPreviewDialog = ({ children }) => {
4194
+ const src = useAttachmentSrc();
4195
+ if (!src) return children;
4196
+ return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { children: [
4197
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTrigger, { className: "hover:bg-accent/50 cursor-pointer transition-colors", asChild: true, children }),
4198
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
4199
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
4200
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-w-5xl w-full max-h-[80%]", children: [
4201
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "aui-sr-only", children: "Image Attachment Preview" }),
4202
+ /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreview, { src })
4203
+ ] })
4204
+ ] })
4205
+ ] });
4206
+ };
4207
+ const AttachmentThumbnail = () => {
4208
+ const isImage = react.useAttachment((a) => a.type === "image");
4209
+ const src = useAttachmentSrc();
4210
+ const canRemove = react.useAttachment((a) => a.source !== "message");
4211
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
4212
+ /* @__PURE__ */ jsxRuntime.jsxs(react.AttachmentPrimitive.Root, { className: "relative", children: [
4213
+ /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src, className: "object-cover aspect-ratio size-16", alt: "Preview", height: 64, width: 64 }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileIcon, { className: "text-icon3" }) }) }) }) }),
4214
+ canRemove && /* @__PURE__ */ jsxRuntime.jsx(AttachmentRemove, {})
4215
+ ] }),
4216
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Name, {}) })
4217
+ ] }) });
4218
+ };
4219
+ const AttachmentRemove = () => {
4220
+ return /* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Remove, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
4221
+ TooltipIconButton,
4222
+ {
4223
+ tooltip: "Remove file",
4224
+ className: "absolute -right-3 -top-3 hover:bg-transparent rounded-full bg-surface1 rounded-full p-1",
4225
+ side: "top",
4226
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleXIcon, {}) })
4227
+ }
4228
+ ) });
4229
+ };
4230
+ const UserMessageAttachments = () => {
4231
+ return /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Attachments, { components: { Attachment: InMessageAttachment } });
4232
+ };
4233
+ const InMessageAttachment = () => {
4234
+ const isImage = react.useAttachment((a) => a.type === "image");
4235
+ const src = useAttachmentSrc();
4236
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
4237
+ /* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Root, { className: "relative pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src, className: "object-cover aspect-ratio max-h-[140px] max-w-[320px]", alt: "Preview" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileIcon, { className: "text-icon3" }) }) }) }) }) }),
4238
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Name, {}) })
4239
+ ] }) });
4240
+ };
4241
+ const ComposerAttachments = () => {
4242
+ const hasAttachments = useHasAttachments();
4243
+ if (!hasAttachments) return null;
4244
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-row items-center gap-4 h-24", children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Attachments, { components: { Attachment: AttachmentThumbnail } }) });
4245
+ };
4246
+
3909
4247
  const UserMessage = () => {
3910
- return /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Root, { className: "w-full flex justify-end pb-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Content, {}) }) });
4248
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.MessagePrimitive.Root, { className: "w-full flex items-end pb-4 flex-col", children: [
4249
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Content, {}) }),
4250
+ /* @__PURE__ */ jsxRuntime.jsx(UserMessageAttachments, {})
4251
+ ] });
3911
4252
  };
3912
4253
 
3913
4254
  const useAutoscroll = (ref, { enabled = true }) => {
@@ -3948,13 +4289,77 @@ const useAutoscroll = (ref, { enabled = true }) => {
3948
4289
  }, [enabled, ref]);
3949
4290
  };
3950
4291
 
3951
- const Thread = ({ ToolFallback, agentName }) => {
4292
+ const variants = {
4293
+ "header-md": "text-header-md leading-header-md",
4294
+ "ui-lg": "text-ui-lg leading-ui-lg",
4295
+ "ui-md": "text-ui-md leading-ui-md",
4296
+ "ui-sm": "text-ui-sm leading-ui-sm",
4297
+ "ui-xs": "text-ui-xs leading-ui-xs"
4298
+ };
4299
+ const fonts = {
4300
+ mono: "font-mono"
4301
+ };
4302
+ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
4303
+ return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
4304
+ };
4305
+
4306
+ const useSpeechRecognition = ({ language = "en-US" } = {}) => {
4307
+ const speechRecognitionRef = React.useRef(null);
4308
+ const [state, setState] = React.useState({
4309
+ isListening: false,
4310
+ transcript: "",
4311
+ error: null
4312
+ });
4313
+ const start = () => {
4314
+ if (!speechRecognitionRef.current) return;
4315
+ speechRecognitionRef.current.start();
4316
+ };
4317
+ const stop = () => {
4318
+ if (!speechRecognitionRef.current) return;
4319
+ speechRecognitionRef.current.stop();
4320
+ };
4321
+ React.useEffect(() => {
4322
+ if (!("webkitSpeechRecognition" in window) && !("SpeechRecognition" in window)) {
4323
+ setState((prev) => ({ ...prev, error: "Speech Recognition not supported in this browser" }));
4324
+ return;
4325
+ }
4326
+ const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
4327
+ const recognition = new SpeechRecognition();
4328
+ speechRecognitionRef.current = recognition;
4329
+ recognition.continuous = true;
4330
+ recognition.lang = language;
4331
+ recognition.onstart = () => {
4332
+ setState((prev) => ({ ...prev, isListening: true }));
4333
+ };
4334
+ recognition.onresult = (event) => {
4335
+ let finalTranscript = "";
4336
+ for (let i = event.resultIndex; i < event.results.length; i++) {
4337
+ const transcript = event.results[i][0].transcript;
4338
+ if (event.results[i].isFinal) {
4339
+ finalTranscript += transcript + " ";
4340
+ }
4341
+ }
4342
+ setState((prev) => ({ ...prev, transcript: finalTranscript }));
4343
+ };
4344
+ recognition.onerror = (event) => {
4345
+ setState((prev) => ({ ...prev, error: `Error: ${event.error}` }));
4346
+ };
4347
+ recognition.onend = () => setState((prev) => ({ ...prev, isListening: false }));
4348
+ }, [language]);
4349
+ return {
4350
+ ...state,
4351
+ start,
4352
+ stop
4353
+ };
4354
+ };
4355
+
4356
+ const Thread = ({ ToolFallback, agentName, hasMemory, showFileSupport }) => {
3952
4357
  const areaRef = React.useRef(null);
3953
4358
  useAutoscroll(areaRef, { enabled: true });
3954
4359
  const WrappedAssistantMessage = (props) => {
3955
4360
  return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
3956
4361
  };
3957
- return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)] px-4", children: [
4362
+ return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper, { children: [
3958
4363
  /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
3959
4364
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3960
4365
  /* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
@@ -3971,9 +4376,22 @@ const Thread = ({ ToolFallback, agentName }) => {
3971
4376
  ] }),
3972
4377
  /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
3973
4378
  ] }),
3974
- /* @__PURE__ */ jsxRuntime.jsx(Composer, {})
4379
+ /* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory, showFileSupport })
3975
4380
  ] });
3976
4381
  };
4382
+ const ThreadWrapper = ({ children }) => {
4383
+ const hasAttachments = useHasAttachments();
4384
+ return /* @__PURE__ */ jsxRuntime.jsx(
4385
+ react.ThreadPrimitive.Root,
4386
+ {
4387
+ className: clsx(
4388
+ "max-w-[568px] w-full mx-auto px-4",
4389
+ hasAttachments ? "h-[calc(100%-208px)]" : "h-[calc(100%-112px)]"
4390
+ ),
4391
+ children
4392
+ }
4393
+ );
4394
+ };
3977
4395
  const ThreadWelcome = ({ agentName }) => {
3978
4396
  const safeAgentName = agentName ?? "";
3979
4397
  const words = safeAgentName.split(" ") ?? [];
@@ -3990,23 +4408,55 @@ const ThreadWelcome = ({ agentName }) => {
3990
4408
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
3991
4409
  ] }) });
3992
4410
  };
3993
- const Composer = () => {
3994
- return /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
3995
- /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
3996
- "textarea",
3997
- {
3998
- className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
3999
- autoFocus: true,
4000
- placeholder: "Enter your message...",
4001
- name: "",
4002
- id: ""
4003
- }
4004
- ) }),
4005
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {}) })
4411
+ const Composer = ({ hasMemory, showFileSupport }) => {
4412
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4413
+ /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
4414
+ /* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}),
4415
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
4416
+ /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
4417
+ "textarea",
4418
+ {
4419
+ className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
4420
+ autoFocus: true,
4421
+ placeholder: "Enter your message...",
4422
+ name: "",
4423
+ id: ""
4424
+ }
4425
+ ) }),
4426
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
4427
+ /* @__PURE__ */ jsxRuntime.jsx(SpeechInput, {}),
4428
+ /* @__PURE__ */ jsxRuntime.jsx(ComposerAction, { showFileSupport })
4429
+ ] })
4430
+ ] })
4431
+ ] }),
4432
+ !hasMemory && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
4433
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, {}) }),
4434
+ "Memory is not enabled. The conversation will not be persisted."
4435
+ ] })
4006
4436
  ] });
4007
4437
  };
4008
- const ComposerAction = () => {
4438
+ const SpeechInput = () => {
4439
+ const composerRuntime = react.useComposerRuntime();
4440
+ const { start, stop, isListening, transcript } = useSpeechRecognition();
4441
+ React.useEffect(() => {
4442
+ if (!transcript) return;
4443
+ composerRuntime.setText(transcript);
4444
+ }, [composerRuntime, transcript]);
4445
+ return /* @__PURE__ */ jsxRuntime.jsx(
4446
+ TooltipIconButton,
4447
+ {
4448
+ type: "button",
4449
+ tooltip: isListening ? "Stop dictation" : "Start dictation",
4450
+ variant: "ghost",
4451
+ className: "rounded-full",
4452
+ onClick: () => isListening ? stop() : start(),
4453
+ children: isListening ? /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
4454
+ }
4455
+ );
4456
+ };
4457
+ const ComposerAction = ({ showFileSupport }) => {
4009
4458
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4459
+ showFileSupport && /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.AddAttachment, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Add attachment", variant: "ghost", className: "rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" }) }) }),
4010
4460
  /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
4011
4461
  TooltipIconButton,
4012
4462
  {
@@ -4040,9 +4490,40 @@ const createMastraClient = (baseUrl) => {
4040
4490
  });
4041
4491
  };
4042
4492
 
4493
+ const fileToBase64 = async (file) => {
4494
+ return new Promise((resolve, reject) => {
4495
+ const reader = new FileReader();
4496
+ reader.onload = () => {
4497
+ const result = reader.result;
4498
+ if (typeof result === "string") {
4499
+ resolve(result);
4500
+ } else {
4501
+ reject(new Error("Failed to convert file to base64."));
4502
+ }
4503
+ };
4504
+ reader.onerror = (error) => {
4505
+ reject(error);
4506
+ };
4507
+ reader.readAsDataURL(file);
4508
+ });
4509
+ };
4510
+
4043
4511
  const convertMessage$1 = (message) => {
4044
4512
  return message;
4045
4513
  };
4514
+ const convertToAIAttachments = async (attachments) => {
4515
+ const promises = attachments.filter((attachment) => attachment.file).map(async (attachment) => ({
4516
+ role: "user",
4517
+ content: [
4518
+ {
4519
+ type: "image",
4520
+ image: await fileToBase64(attachment.file),
4521
+ mimeType: attachment.file.type
4522
+ }
4523
+ ]
4524
+ }));
4525
+ return Promise.all(promises);
4526
+ };
4046
4527
  function MastraRuntimeProvider({
4047
4528
  children,
4048
4529
  agentId,
@@ -4053,12 +4534,17 @@ function MastraRuntimeProvider({
4053
4534
  baseUrl,
4054
4535
  refreshThreadList,
4055
4536
  modelSettings = {},
4056
- chatWithGenerate
4537
+ chatWithGenerate,
4538
+ runtimeContext
4057
4539
  }) {
4058
4540
  const [isRunning, setIsRunning] = React.useState(false);
4059
4541
  const [messages, setMessages] = React.useState([]);
4060
4542
  const [currentThreadId, setCurrentThreadId] = React.useState(threadId);
4061
4543
  const { frequencyPenalty, presencePenalty, maxRetries, maxSteps, maxTokens, temperature, topK, topP, instructions } = modelSettings;
4544
+ const runtimeContextInstance = new di.RuntimeContext();
4545
+ Object.entries(runtimeContext ?? {}).forEach(([key, value]) => {
4546
+ runtimeContextInstance.set(key, value);
4547
+ });
4062
4548
  React.useEffect(() => {
4063
4549
  const hasNewInitialMessages = initialMessages && initialMessages?.length > messages?.length;
4064
4550
  if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
@@ -4067,13 +4553,16 @@ function MastraRuntimeProvider({
4067
4553
  if (message?.toolInvocations?.length > 0) {
4068
4554
  return {
4069
4555
  ...message,
4070
- content: message.toolInvocations.map((toolInvocation) => ({
4071
- type: "tool-call",
4072
- toolCallId: toolInvocation?.toolCallId,
4073
- toolName: toolInvocation?.toolName,
4074
- args: toolInvocation?.args,
4075
- result: toolInvocation?.result
4076
- }))
4556
+ content: [
4557
+ ...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
4558
+ ...message.toolInvocations.map((toolInvocation) => ({
4559
+ type: "tool-call",
4560
+ toolCallId: toolInvocation?.toolCallId,
4561
+ toolName: toolInvocation?.toolName,
4562
+ args: toolInvocation?.args,
4563
+ result: toolInvocation?.result
4564
+ }))
4565
+ ]
4077
4566
  };
4078
4567
  }
4079
4568
  return message;
@@ -4087,8 +4576,12 @@ function MastraRuntimeProvider({
4087
4576
  const agent = mastra.getAgent(agentId);
4088
4577
  const onNew = async (message) => {
4089
4578
  if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
4579
+ const attachments = await convertToAIAttachments(message.attachments);
4090
4580
  const input = message.content[0].text;
4091
- setMessages((currentConversation) => [...currentConversation, { role: "user", content: input }]);
4581
+ setMessages((currentConversation) => [
4582
+ ...currentConversation,
4583
+ { role: "user", content: input, attachments: message.attachments }
4584
+ ]);
4092
4585
  setIsRunning(true);
4093
4586
  try {
4094
4587
  if (chatWithGenerate) {
@@ -4097,7 +4590,8 @@ function MastraRuntimeProvider({
4097
4590
  {
4098
4591
  role: "user",
4099
4592
  content: input
4100
- }
4593
+ },
4594
+ ...attachments
4101
4595
  ],
4102
4596
  runId: agentId,
4103
4597
  frequencyPenalty,
@@ -4109,6 +4603,7 @@ function MastraRuntimeProvider({
4109
4603
  topK,
4110
4604
  topP,
4111
4605
  instructions,
4606
+ runtimeContext: runtimeContextInstance,
4112
4607
  ...memory ? { threadId, resourceId: agentId } : {}
4113
4608
  });
4114
4609
  if (generateResponse.response) {
@@ -4188,6 +4683,13 @@ function MastraRuntimeProvider({
4188
4683
  };
4189
4684
  if (!assistantMessageAdded) {
4190
4685
  assistantMessageAdded = true;
4686
+ if (assistantToolCallAddedForUpdater) {
4687
+ assistantToolCallAddedForUpdater = false;
4688
+ }
4689
+ return [...currentConversation, message2];
4690
+ }
4691
+ if (assistantToolCallAddedForUpdater) {
4692
+ assistantToolCallAddedForUpdater = false;
4191
4693
  return [...currentConversation, message2];
4192
4694
  }
4193
4695
  return [...currentConversation.slice(0, -1), message2];
@@ -4198,7 +4700,8 @@ function MastraRuntimeProvider({
4198
4700
  {
4199
4701
  role: "user",
4200
4702
  content: input
4201
- }
4703
+ },
4704
+ ...attachments
4202
4705
  ],
4203
4706
  runId: agentId,
4204
4707
  frequencyPenalty,
@@ -4210,27 +4713,24 @@ function MastraRuntimeProvider({
4210
4713
  topK,
4211
4714
  topP,
4212
4715
  instructions,
4716
+ runtimeContext: runtimeContextInstance,
4213
4717
  ...memory ? { threadId, resourceId: agentId } : {}
4214
4718
  });
4215
4719
  if (!response.body) {
4216
4720
  throw new Error("No response body");
4217
4721
  }
4218
- const parts = [];
4219
4722
  let content = "";
4220
- let currentTextPart = null;
4221
4723
  let assistantMessageAdded = false;
4724
+ let assistantToolCallAddedForUpdater = false;
4725
+ let assistantToolCallAddedForContent = false;
4222
4726
  await response.processDataStream({
4223
4727
  onTextPart(value) {
4224
- if (currentTextPart == null) {
4225
- currentTextPart = {
4226
- type: "text",
4227
- text: value
4228
- };
4229
- parts.push(currentTextPart);
4728
+ if (assistantToolCallAddedForContent) {
4729
+ assistantToolCallAddedForContent = false;
4730
+ content = value;
4230
4731
  } else {
4231
- currentTextPart.text += value;
4732
+ content += value;
4232
4733
  }
4233
- content += value;
4234
4734
  updater();
4235
4735
  },
4236
4736
  async onToolCallPart(value) {
@@ -4257,6 +4757,8 @@ function MastraRuntimeProvider({
4257
4757
  }
4258
4758
  ]
4259
4759
  };
4760
+ assistantToolCallAddedForUpdater = true;
4761
+ assistantToolCallAddedForContent = true;
4260
4762
  return [...currentConversation.slice(0, -1), updatedMessage];
4261
4763
  }
4262
4764
  const newMessage = {
@@ -4271,6 +4773,8 @@ function MastraRuntimeProvider({
4271
4773
  }
4272
4774
  ]
4273
4775
  };
4776
+ assistantToolCallAddedForUpdater = true;
4777
+ assistantToolCallAddedForContent = true;
4274
4778
  return [...currentConversation, newMessage];
4275
4779
  });
4276
4780
  },
@@ -4318,7 +4822,10 @@ function MastraRuntimeProvider({
4318
4822
  isRunning,
4319
4823
  messages,
4320
4824
  convertMessage: convertMessage$1,
4321
- onNew
4825
+ onNew,
4826
+ adapters: {
4827
+ attachments: new react.CompositeAttachmentAdapter([new react.SimpleImageAttachmentAdapter()])
4828
+ }
4322
4829
  });
4323
4830
  return /* @__PURE__ */ jsxRuntime.jsxs(react.AssistantRuntimeProvider, { runtime, children: [
4324
4831
  " ",
@@ -4327,6 +4834,20 @@ function MastraRuntimeProvider({
4327
4834
  ] });
4328
4835
  }
4329
4836
 
4837
+ const useAgentStore = zustand.create()(
4838
+ middleware.persist(
4839
+ (set) => ({
4840
+ modelSettings: {},
4841
+ setModelSettings: (modelSettings) => set((state) => ({ modelSettings: { ...state.modelSettings, ...modelSettings } })),
4842
+ chatWithGenerate: {},
4843
+ setChatWithGenerate: (chatWithGenerate) => set((state) => ({ chatWithGenerate: { ...state.chatWithGenerate, ...chatWithGenerate } }))
4844
+ }),
4845
+ {
4846
+ name: "mastra-agent-store"
4847
+ }
4848
+ )
4849
+ );
4850
+
4330
4851
  const defaultModelSettings$1 = {
4331
4852
  maxRetries: 2,
4332
4853
  maxSteps: 5,
@@ -4334,12 +4855,24 @@ const defaultModelSettings$1 = {
4334
4855
  topP: 1
4335
4856
  };
4336
4857
  const AgentContext = React.createContext({});
4337
- function AgentProvider({ children }) {
4338
- const [modelSettings, setModelSettings] = React.useState(defaultModelSettings$1);
4339
- const [chatWithGenerate, setChatWithGenerate] = React.useState(false);
4858
+ function AgentProvider({ agentId, children }) {
4859
+ const {
4860
+ modelSettings: modelSettingsStore,
4861
+ setModelSettings: setModelSettingsStore,
4862
+ chatWithGenerate: chatWithGenerateStore,
4863
+ setChatWithGenerate: setChatWithGenerateStore
4864
+ } = useAgentStore();
4865
+ const modelSettings = modelSettingsStore[agentId] || defaultModelSettings$1;
4866
+ const setModelSettings = (modelSettings2) => {
4867
+ setModelSettingsStore({ [agentId]: modelSettings2 });
4868
+ };
4340
4869
  const resetModelSettings = () => {
4341
4870
  setModelSettings(defaultModelSettings$1);
4342
4871
  };
4872
+ const chatWithGenerate = chatWithGenerateStore[agentId] || false;
4873
+ const setChatWithGenerate = (chatWithGenerate2) => {
4874
+ setChatWithGenerateStore({ [agentId]: chatWithGenerate2 });
4875
+ };
4343
4876
  return /* @__PURE__ */ jsxRuntime.jsx(
4344
4877
  AgentContext.Provider,
4345
4878
  {
@@ -4355,6 +4888,18 @@ function AgentProvider({ children }) {
4355
4888
  );
4356
4889
  }
4357
4890
 
4891
+ const usePlaygroundStore = zustand.create()(
4892
+ middleware.persist(
4893
+ (set) => ({
4894
+ runtimeContext: {},
4895
+ setRuntimeContext: (runtimeContext) => set({ runtimeContext })
4896
+ }),
4897
+ {
4898
+ name: "mastra-playground-store"
4899
+ }
4900
+ )
4901
+ );
4902
+
4358
4903
  const AgentChat = ({
4359
4904
  agentId,
4360
4905
  agentName,
@@ -4362,9 +4907,11 @@ const AgentChat = ({
4362
4907
  initialMessages,
4363
4908
  memory,
4364
4909
  baseUrl,
4365
- refreshThreadList
4910
+ refreshThreadList,
4911
+ showFileSupport
4366
4912
  }) => {
4367
4913
  const { modelSettings, chatWithGenerate } = React.useContext(AgentContext);
4914
+ const { runtimeContext } = usePlaygroundStore();
4368
4915
  return /* @__PURE__ */ jsxRuntime.jsx(
4369
4916
  MastraRuntimeProvider,
4370
4917
  {
@@ -4377,7 +4924,8 @@ const AgentChat = ({
4377
4924
  refreshThreadList,
4378
4925
  modelSettings,
4379
4926
  chatWithGenerate,
4380
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "" }) })
4927
+ runtimeContext,
4928
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, showFileSupport }) })
4381
4929
  }
4382
4930
  );
4383
4931
  };
@@ -4437,18 +4985,18 @@ function FormattedDate({ date }) {
4437
4985
  }
4438
4986
 
4439
4987
  const inputVariants = cva(
4440
- "flex w-full text-mastra-el-6 rounded-sm border bg-transparent shadow-sm focus-visible:ring-ring transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",
4988
+ "flex w-full text-icon6 rounded-lg border bg-transparent shadow-sm focus-visible:ring-ring transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",
4441
4989
  {
4442
4990
  variants: {
4443
4991
  variant: {
4444
- default: "border-mastra-border-1 border-border-1 placeholder:text-muted-foreground",
4445
- filled: "bg-inputFill border-border-1 placeholder:text-muted-foreground",
4446
- unstyled: "border-0 bg-transparent placeholder:text-muted-foreground focus-visible:ring-transparent focus-visible:outline-none"
4992
+ default: "border-sm border-border1 placeholder:text-icon3",
4993
+ filled: "border-sm bg-inputFill border-border1 placeholder:text-icon3",
4994
+ unstyled: "border-0 bg-transparent placeholder:text-icon3 focus-visible:ring-transparent focus-visible:outline-none"
4447
4995
  },
4448
4996
  customSize: {
4449
- default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-[34px]",
4997
+ default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-8",
4450
4998
  sm: "h-[30px] px-[13px] text-xs",
4451
- lg: "h-10 px-[17px] rounded-md text-[calc(13_/_16_*_1rem)]"
4999
+ lg: "h-10 px-[17px] text-[calc(13_/_16_*_1rem)]"
4452
5000
  }
4453
5001
  },
4454
5002
  defaultVariants: {
@@ -4927,20 +5475,6 @@ const Row = ({ className, children, selected = false, onClick }) => {
4927
5475
  );
4928
5476
  };
4929
5477
 
4930
- const variants = {
4931
- "header-md": "text-header-md leading-header-md",
4932
- "ui-lg": "text-ui-lg leading-ui-lg",
4933
- "ui-md": "text-ui-md leading-ui-md",
4934
- "ui-sm": "text-ui-sm leading-ui-sm",
4935
- "ui-xs": "text-ui-xs leading-ui-xs"
4936
- };
4937
- const fonts = {
4938
- mono: "font-mono"
4939
- };
4940
- const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
4941
- return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
4942
- };
4943
-
4944
5478
  const formatDateCell = (date) => {
4945
5479
  const month = new Intl.DateTimeFormat("en-US", { month: "short" }).format(date).toUpperCase();
4946
5480
  const day = date.getDate();
@@ -5163,11 +5697,17 @@ const TraceTree = ({ children }) => {
5163
5697
  const variantClasses = {
5164
5698
  agent: "bg-accent1"
5165
5699
  };
5166
- const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
5700
+ const Time = ({ durationMs, tokenCount, variant, progressPercent, offsetPercent }) => {
5167
5701
  const variantClass = variant ? variantClasses[variant] : "bg-accent3";
5168
5702
  const percent = Math.min(100, progressPercent);
5169
5703
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[80px] xl:w-[166px] shrink-0", children: [
5170
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("absolute h-1 rounded-full", variantClass), style: { width: `${percent}%` } }) }),
5704
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
5705
+ "div",
5706
+ {
5707
+ className: clsx("absolute h-1 rounded-full", variantClass),
5708
+ style: { width: `${percent}%`, left: `${offsetPercent}%` }
5709
+ }
5710
+ ) }),
5171
5711
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
5172
5712
  /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
5173
5713
  toSigFigs(durationMs, 3),
@@ -5181,14 +5721,6 @@ const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
5181
5721
  ] });
5182
5722
  };
5183
5723
 
5184
- const TraceDurationContext = React.createContext(0);
5185
- const useTraceDuration = () => {
5186
- return React.useContext(TraceDurationContext);
5187
- };
5188
- const TraceDurationProvider = ({ children, durationMs }) => {
5189
- return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationContext.Provider, { value: durationMs, children });
5190
- };
5191
-
5192
5724
  const spanIconMap = {
5193
5725
  tool: ToolsIcon,
5194
5726
  agent: AgentIcon,
@@ -5209,14 +5741,25 @@ const spanVariantClasses = {
5209
5741
  eval: "text-accent4",
5210
5742
  other: "text-icon6"
5211
5743
  };
5212
- const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClick, isActive }) => {
5744
+ const Span = ({
5745
+ children,
5746
+ durationMs,
5747
+ variant,
5748
+ tokenCount,
5749
+ spans,
5750
+ isRoot,
5751
+ onClick,
5752
+ isActive,
5753
+ offsetMs,
5754
+ totalDurationMs
5755
+ }) => {
5213
5756
  const [isExpanded, setIsExpanded] = React.useState(true);
5214
- const traceDuration = useTraceDuration();
5215
5757
  const VariantIcon = spanIconMap[variant];
5216
5758
  const variantClass = spanVariantClasses[variant];
5217
- const progressPercent = durationMs / traceDuration * 100;
5759
+ const progressPercent = durationMs / totalDurationMs * 100;
5760
+ const offsetPercent = offsetMs / totalDurationMs * 100;
5218
5761
  const TextEl = onClick ? "button" : "div";
5219
- return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationProvider, { durationMs, children: /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
5762
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
5220
5763
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("flex justify-between items-center gap-2 rounded-md pl-2", isActive && "bg-surface4"), children: [
5221
5764
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-8 items-center gap-1 min-w-0", children: [
5222
5765
  spans ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -5241,20 +5784,30 @@ const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClic
5241
5784
  durationMs,
5242
5785
  tokenCount,
5243
5786
  variant: variant === "agent" ? "agent" : void 0,
5244
- progressPercent
5787
+ progressPercent,
5788
+ offsetPercent
5245
5789
  }
5246
5790
  )
5247
5791
  ] }),
5248
5792
  isExpanded && spans && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4", children: spans })
5249
- ] }) });
5793
+ ] });
5250
5794
  };
5251
5795
 
5252
5796
  const Spans = ({ children }) => {
5253
5797
  return /* @__PURE__ */ jsxRuntime.jsx("ol", { children });
5254
5798
  };
5255
5799
 
5256
- const Trace = ({ name, spans, durationMs, tokenCount, onClick, variant, isActive }) => {
5257
- return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationProvider, { durationMs, children: /* @__PURE__ */ jsxRuntime.jsx(
5800
+ const Trace = ({
5801
+ name,
5802
+ spans,
5803
+ durationMs,
5804
+ tokenCount,
5805
+ onClick,
5806
+ variant,
5807
+ isActive,
5808
+ totalDurationMs
5809
+ }) => {
5810
+ return /* @__PURE__ */ jsxRuntime.jsx(
5258
5811
  Span,
5259
5812
  {
5260
5813
  isRoot: true,
@@ -5263,9 +5816,11 @@ const Trace = ({ name, spans, durationMs, tokenCount, onClick, variant, isActive
5263
5816
  spans: /* @__PURE__ */ jsxRuntime.jsx(Spans, { children: spans }),
5264
5817
  onClick,
5265
5818
  isActive,
5819
+ offsetMs: 0,
5820
+ totalDurationMs,
5266
5821
  children: name
5267
5822
  }
5268
- ) });
5823
+ );
5269
5824
  };
5270
5825
 
5271
5826
  const getSpanVariant = (span) => {
@@ -5290,40 +5845,71 @@ const getSpanVariant = (span) => {
5290
5845
  return "other";
5291
5846
  };
5292
5847
 
5293
- function buildTree(items, parentSpanId = null) {
5294
- return items.filter((item) => item.parentSpanId === parentSpanId).map((item) => ({
5295
- ...item,
5296
- children: buildTree(items, item.id)
5297
- }));
5848
+ function buildTree(spans, minStartTime, totalDurationMs, parentSpanId = null) {
5849
+ return spans.filter((span) => span.parentSpanId === parentSpanId).map((span) => {
5850
+ return {
5851
+ ...span,
5852
+ children: buildTree(spans, minStartTime, totalDurationMs, span.id),
5853
+ offset: (span.startTime - minStartTime) / 1e3,
5854
+ // ns to ms
5855
+ duration: span.duration / 1e3,
5856
+ totalDurationMs
5857
+ };
5858
+ });
5298
5859
  }
5299
- const NestedSpans = ({ spans }) => {
5860
+ const createSpanTree = (spans) => {
5861
+ if (spans.length === 0) return [];
5862
+ let minStartTime;
5863
+ let maxEndTime;
5864
+ const orderedTree = [];
5865
+ const listSize = spans.length;
5866
+ for (let i = listSize - 1; i >= 0; i--) {
5867
+ const span = spans[i];
5868
+ if (!minStartTime || span.startTime < minStartTime) {
5869
+ minStartTime = span.startTime;
5870
+ }
5871
+ if (!maxEndTime || span.endTime > maxEndTime) {
5872
+ maxEndTime = span.endTime;
5873
+ }
5874
+ if (span.name !== ".insert" && span.name !== "mastra.getStorage") {
5875
+ orderedTree.push(span);
5876
+ }
5877
+ }
5878
+ if (!minStartTime || !maxEndTime) return [];
5879
+ const totalDurationMs = (maxEndTime - minStartTime) / 1e3;
5880
+ return buildTree(orderedTree, minStartTime, totalDurationMs);
5881
+ };
5882
+
5883
+ const NestedSpans = ({ spanNodes }) => {
5300
5884
  const { span: activeSpan, setSpan } = React.useContext(TraceContext);
5301
- return /* @__PURE__ */ jsxRuntime.jsx(Spans, { children: spans.map((span) => {
5302
- const isActive = span.id === activeSpan?.id;
5885
+ return /* @__PURE__ */ jsxRuntime.jsx(Spans, { children: spanNodes.map((spanNode) => {
5886
+ const isActive = spanNode.id === activeSpan?.id;
5303
5887
  return /* @__PURE__ */ jsxRuntime.jsx(
5304
5888
  Span,
5305
5889
  {
5306
- spans: span.children.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spans: span.children }),
5307
- durationMs: span.duration / 1e3,
5308
- variant: getSpanVariant(span),
5890
+ spans: spanNode.children.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spanNodes: spanNode.children }),
5891
+ durationMs: spanNode.duration,
5892
+ offsetMs: spanNode.offset,
5893
+ variant: getSpanVariant(spanNode),
5309
5894
  isActive,
5310
- onClick: () => setSpan(span),
5311
- children: span.name
5895
+ onClick: () => setSpan(spanNode),
5896
+ totalDurationMs: spanNode.totalDurationMs,
5897
+ children: spanNode.name
5312
5898
  },
5313
- span.id
5899
+ spanNode.id
5314
5900
  );
5315
5901
  }) });
5316
5902
  };
5317
5903
  function SpanView({ trace }) {
5318
- const shallowCopy = [...trace];
5319
- const tree = buildTree(shallowCopy.reverse());
5320
5904
  const { span: activeSpan, setSpan } = React.useContext(TraceContext);
5905
+ const tree = createSpanTree(trace);
5321
5906
  return /* @__PURE__ */ jsxRuntime.jsx(TraceTree, { children: tree.map((node) => /* @__PURE__ */ jsxRuntime.jsx(
5322
5907
  Trace,
5323
5908
  {
5324
5909
  name: node.name,
5325
- durationMs: node.duration / 1e3,
5326
- spans: /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spans: node.children }),
5910
+ durationMs: node.duration,
5911
+ totalDurationMs: node.totalDurationMs,
5912
+ spans: /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spanNodes: node.children }),
5327
5913
  variant: getSpanVariant(node),
5328
5914
  isActive: node.id === activeSpan?.id,
5329
5915
  onClick: () => setSpan(node)
@@ -5459,8 +6045,7 @@ const refineTraces = (traces, isWorkflow = false) => {
5459
6045
  const parentSpan = value.find((span) => !span.parentSpanId || !listOfSpanIds.has(span.parentSpanId));
5460
6046
  const enrichedSpans = value.map((span) => ({
5461
6047
  ...span,
5462
- parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId,
5463
- relativePercentage: parentSpan ? span.duration / parentSpan.duration : 0
6048
+ parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
5464
6049
  }));
5465
6050
  const failedStatus = value.find((span) => span.status.code !== 0)?.status;
5466
6051
  return {
@@ -6071,7 +6656,7 @@ function WorkflowTracesInner({ traces, isLoading, error }) {
6071
6656
  ] });
6072
6657
  }
6073
6658
 
6074
- const sanitizeVNexWorkflowWatchResult = (record) => {
6659
+ const sanitizeWorkflowWatchResult = (record) => {
6075
6660
  const formattedResults = Object.entries(record.payload.workflowState.steps || {}).reduce(
6076
6661
  (acc, [key, value]) => {
6077
6662
  let output = value.status === "success" ? value.output : void 0;
@@ -6106,8 +6691,8 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
6106
6691
  };
6107
6692
  return sanitizedRecord;
6108
6693
  };
6109
- const useWorkflow = (workflowId, baseUrl) => {
6110
- const [workflow, setWorkflow] = React.useState(null);
6694
+ const useLegacyWorkflow = (workflowId, baseUrl) => {
6695
+ const [legacyWorkflow, setLegacyWorkflow] = React.useState(null);
6111
6696
  const [isLoading, setIsLoading] = React.useState(true);
6112
6697
  const client = createMastraClient(baseUrl);
6113
6698
  React.useEffect(() => {
@@ -6115,22 +6700,22 @@ const useWorkflow = (workflowId, baseUrl) => {
6115
6700
  setIsLoading(true);
6116
6701
  try {
6117
6702
  if (!workflowId) {
6118
- setWorkflow(null);
6703
+ setLegacyWorkflow(null);
6119
6704
  setIsLoading(false);
6120
6705
  return;
6121
6706
  }
6122
- const res = await client.getWorkflow(workflowId).details();
6707
+ const res = await client.getLegacyWorkflow(workflowId).details();
6123
6708
  if (!res) {
6124
- setWorkflow(null);
6125
- console.error("Error fetching workflow");
6126
- sonner.toast.error("Error fetching workflow");
6709
+ setLegacyWorkflow(null);
6710
+ console.error("Error fetching legacy workflow");
6711
+ sonner.toast.error("Error fetching legacy workflow");
6127
6712
  return;
6128
6713
  }
6129
6714
  const steps = res.steps;
6130
6715
  const stepsWithWorkflow = await Promise.all(
6131
6716
  Object.values(steps)?.map(async (step) => {
6132
6717
  if (!step.workflowId) return step;
6133
- const wFlow = await client.getWorkflow(step.workflowId).details();
6718
+ const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
6134
6719
  if (!wFlow) return step;
6135
6720
  return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
6136
6721
  })
@@ -6138,21 +6723,21 @@ const useWorkflow = (workflowId, baseUrl) => {
6138
6723
  const _steps = stepsWithWorkflow.reduce((acc, b) => {
6139
6724
  return { ...acc, [b.id]: b };
6140
6725
  }, {});
6141
- setWorkflow({ ...res, steps: _steps });
6726
+ setLegacyWorkflow({ ...res, steps: _steps });
6142
6727
  } catch (error) {
6143
- setWorkflow(null);
6144
- console.error("Error fetching workflow", error);
6145
- sonner.toast.error("Error fetching workflow");
6728
+ setLegacyWorkflow(null);
6729
+ console.error("Error fetching legacy workflow", error);
6730
+ sonner.toast.error("Error fetching legacy workflow");
6146
6731
  } finally {
6147
6732
  setIsLoading(false);
6148
6733
  }
6149
6734
  };
6150
6735
  fetchWorkflow();
6151
6736
  }, [workflowId]);
6152
- return { workflow, isLoading };
6737
+ return { legacyWorkflow, isLoading };
6153
6738
  };
6154
- const useVNextWorkflow = (workflowId, baseUrl) => {
6155
- const [vNextWorkflow, setVNextWorkflow] = React.useState(null);
6739
+ const useWorkflow = (workflowId, baseUrl) => {
6740
+ const [workflow, setWorkflow] = React.useState(null);
6156
6741
  const [isLoading, setIsLoading] = React.useState(true);
6157
6742
  const client = createMastraClient(baseUrl);
6158
6743
  React.useEffect(() => {
@@ -6160,14 +6745,14 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
6160
6745
  setIsLoading(true);
6161
6746
  try {
6162
6747
  if (!workflowId) {
6163
- setVNextWorkflow(null);
6748
+ setWorkflow(null);
6164
6749
  setIsLoading(false);
6165
6750
  return;
6166
6751
  }
6167
- const res = await client.getVNextWorkflow(workflowId).details();
6168
- setVNextWorkflow(res);
6752
+ const res = await client.getWorkflow(workflowId).details();
6753
+ setWorkflow(res);
6169
6754
  } catch (error) {
6170
- setVNextWorkflow(null);
6755
+ setWorkflow(null);
6171
6756
  console.error("Error fetching workflow", error);
6172
6757
  sonner.toast.error("Error fetching workflow");
6173
6758
  } finally {
@@ -6176,13 +6761,13 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
6176
6761
  };
6177
6762
  fetchWorkflow();
6178
6763
  }, [workflowId]);
6179
- return { vNextWorkflow, isLoading };
6764
+ return { workflow, isLoading };
6180
6765
  };
6181
6766
  const useExecuteWorkflow = (baseUrl) => {
6182
6767
  const client = createMastraClient(baseUrl);
6183
- const createWorkflowRun = async ({ workflowId, prevRunId }) => {
6768
+ const createLegacyWorkflowRun = async ({ workflowId, prevRunId }) => {
6184
6769
  try {
6185
- const workflow = client.getWorkflow(workflowId);
6770
+ const workflow = client.getLegacyWorkflow(workflowId);
6186
6771
  const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
6187
6772
  return { runId: newRunId };
6188
6773
  } catch (error) {
@@ -6190,9 +6775,9 @@ const useExecuteWorkflow = (baseUrl) => {
6190
6775
  throw error;
6191
6776
  }
6192
6777
  };
6193
- const createVNextWorkflowRun = async ({ workflowId, prevRunId }) => {
6778
+ const createWorkflowRun = async ({ workflowId, prevRunId }) => {
6194
6779
  try {
6195
- const workflow = client.getVNextWorkflow(workflowId);
6780
+ const workflow = client.getWorkflow(workflowId);
6196
6781
  const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
6197
6782
  return { runId: newRunId };
6198
6783
  } catch (error) {
@@ -6200,36 +6785,50 @@ const useExecuteWorkflow = (baseUrl) => {
6200
6785
  throw error;
6201
6786
  }
6202
6787
  };
6203
- const startWorkflowRun = async ({ workflowId, runId, input }) => {
6788
+ const startLegacyWorkflowRun = async ({
6789
+ workflowId,
6790
+ runId,
6791
+ input
6792
+ }) => {
6204
6793
  try {
6205
- const workflow = client.getWorkflow(workflowId);
6794
+ const workflow = client.getLegacyWorkflow(workflowId);
6206
6795
  await workflow.start({ runId, triggerData: input || {} });
6207
6796
  } catch (error) {
6208
6797
  console.error("Error starting workflow run:", error);
6209
6798
  throw error;
6210
6799
  }
6211
6800
  };
6212
- const startVNextWorkflowRun = async ({
6801
+ const startWorkflowRun = async ({
6213
6802
  workflowId,
6214
6803
  runId,
6215
- input
6804
+ input,
6805
+ runtimeContext: playgroundRuntimeContext
6216
6806
  }) => {
6217
6807
  try {
6218
- const workflow = client.getVNextWorkflow(workflowId);
6219
- await workflow.start({ runId, inputData: input || {} });
6808
+ const runtimeContext$1 = new runtimeContext.RuntimeContext();
6809
+ Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6810
+ runtimeContext$1.set(key, value);
6811
+ });
6812
+ const workflow = client.getWorkflow(workflowId);
6813
+ await workflow.start({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
6220
6814
  } catch (error) {
6221
6815
  console.error("Error starting workflow run:", error);
6222
6816
  throw error;
6223
6817
  }
6224
6818
  };
6225
- const startAsyncVNextWorkflowRun = async ({
6819
+ const startAsyncWorkflowRun = async ({
6226
6820
  workflowId,
6227
6821
  runId,
6228
- input
6822
+ input,
6823
+ runtimeContext: playgroundRuntimeContext
6229
6824
  }) => {
6230
6825
  try {
6231
- const workflow = client.getVNextWorkflow(workflowId);
6232
- const result = await workflow.startAsync({ runId, inputData: input || {} });
6826
+ const runtimeContext$1 = new runtimeContext.RuntimeContext();
6827
+ Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6828
+ runtimeContext$1.set(key, value);
6829
+ });
6830
+ const workflow = client.getWorkflow(workflowId);
6831
+ const result = await workflow.startAsync({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
6233
6832
  return result;
6234
6833
  } catch (error) {
6235
6834
  console.error("Error starting workflow run:", error);
@@ -6239,17 +6838,17 @@ const useExecuteWorkflow = (baseUrl) => {
6239
6838
  return {
6240
6839
  startWorkflowRun,
6241
6840
  createWorkflowRun,
6242
- startVNextWorkflowRun,
6243
- createVNextWorkflowRun,
6244
- startAsyncVNextWorkflowRun
6841
+ startLegacyWorkflowRun,
6842
+ createLegacyWorkflowRun,
6843
+ startAsyncWorkflowRun
6245
6844
  };
6246
6845
  };
6247
6846
  const useWatchWorkflow = (baseUrl) => {
6847
+ const [isWatchingLegacyWorkflow, setIsWatchingLegacyWorkflow] = React.useState(false);
6248
6848
  const [isWatchingWorkflow, setIsWatchingWorkflow] = React.useState(false);
6249
- const [isWatchingVNextWorkflow, setIsWatchingVNextWorkflow] = React.useState(false);
6849
+ const [legacyWatchResult, setLegacyWatchResult] = React.useState(null);
6250
6850
  const [watchResult, setWatchResult] = React.useState(null);
6251
- const [watchVNextResult, setWatchVNextResult] = React.useState(null);
6252
- const debouncedSetWatchResult = useDebounce.useDebouncedCallback((record) => {
6851
+ const debouncedSetLegacyWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
6253
6852
  const formattedResults = Object.entries(record.results || {}).reduce(
6254
6853
  (acc, [key, value]) => {
6255
6854
  let output = value.status === "success" ? value.output : void 0;
@@ -6272,19 +6871,19 @@ const useWatchWorkflow = (baseUrl) => {
6272
6871
  ...record,
6273
6872
  sanitizedOutput: record ? JSON.stringify({ ...record, results: formattedResults }, null, 2).slice(0, 5e4) : null
6274
6873
  };
6275
- setWatchResult(sanitizedRecord);
6874
+ setLegacyWatchResult(sanitizedRecord);
6276
6875
  }, 100);
6277
- const watchWorkflow = async ({ workflowId, runId }) => {
6876
+ const watchLegacyWorkflow = async ({ workflowId, runId }) => {
6278
6877
  try {
6279
- setIsWatchingWorkflow(true);
6878
+ setIsWatchingLegacyWorkflow(true);
6280
6879
  const client = createMastraClient(baseUrl);
6281
- const workflow = client.getWorkflow(workflowId);
6880
+ const workflow = client.getLegacyWorkflow(workflowId);
6282
6881
  await workflow.watch({ runId }, (record) => {
6283
6882
  try {
6284
- debouncedSetWatchResult(record);
6883
+ debouncedSetLegacyWorkflowWatchResult(record);
6285
6884
  } catch (err) {
6286
6885
  console.error("Error processing workflow record:", err);
6287
- setWatchResult({
6886
+ setLegacyWatchResult({
6288
6887
  ...record
6289
6888
  });
6290
6889
  }
@@ -6293,24 +6892,24 @@ const useWatchWorkflow = (baseUrl) => {
6293
6892
  console.error("Error watching workflow:", error);
6294
6893
  throw error;
6295
6894
  } finally {
6296
- setIsWatchingWorkflow(false);
6895
+ setIsWatchingLegacyWorkflow(false);
6297
6896
  }
6298
6897
  };
6299
- const debouncedSetVNextWatchResult = useDebounce.useDebouncedCallback((record) => {
6300
- const sanitizedRecord = sanitizeVNexWorkflowWatchResult(record);
6301
- setWatchVNextResult(sanitizedRecord);
6898
+ const debouncedSetWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
6899
+ const sanitizedRecord = sanitizeWorkflowWatchResult(record);
6900
+ setWatchResult(sanitizedRecord);
6302
6901
  }, 100);
6303
- const watchVNextWorkflow = async ({ workflowId, runId }) => {
6902
+ const watchWorkflow = async ({ workflowId, runId }) => {
6304
6903
  try {
6305
- setIsWatchingVNextWorkflow(true);
6904
+ setIsWatchingWorkflow(true);
6306
6905
  const client = createMastraClient(baseUrl);
6307
- const workflow = client.getVNextWorkflow(workflowId);
6906
+ const workflow = client.getWorkflow(workflowId);
6308
6907
  await workflow.watch({ runId }, (record) => {
6309
6908
  try {
6310
- debouncedSetVNextWatchResult(record);
6909
+ debouncedSetWorkflowWatchResult(record);
6311
6910
  } catch (err) {
6312
6911
  console.error("Error processing workflow record:", err);
6313
- setWatchVNextResult({
6912
+ setWatchResult({
6314
6913
  ...record
6315
6914
  });
6316
6915
  }
@@ -6319,63 +6918,67 @@ const useWatchWorkflow = (baseUrl) => {
6319
6918
  console.error("Error watching workflow:", error);
6320
6919
  throw error;
6321
6920
  } finally {
6322
- setIsWatchingVNextWorkflow(false);
6921
+ setIsWatchingWorkflow(false);
6323
6922
  }
6324
6923
  };
6325
6924
  return {
6925
+ watchLegacyWorkflow,
6926
+ isWatchingLegacyWorkflow,
6927
+ legacyWatchResult,
6326
6928
  watchWorkflow,
6327
6929
  isWatchingWorkflow,
6328
- watchResult,
6329
- watchVNextWorkflow,
6330
- isWatchingVNextWorkflow,
6331
- watchVNextResult
6930
+ watchResult
6332
6931
  };
6333
6932
  };
6334
6933
  const useResumeWorkflow = (baseUrl) => {
6934
+ const [isResumingLegacyWorkflow, setIsResumingLegacyWorkflow] = React.useState(false);
6335
6935
  const [isResumingWorkflow, setIsResumingWorkflow] = React.useState(false);
6336
- const [isResumingVNextWorkflow, setIsResumingVNextWorkflow] = React.useState(false);
6337
- const resumeWorkflow = async ({
6936
+ const resumeLegacyWorkflow = async ({
6338
6937
  workflowId,
6339
6938
  stepId,
6340
6939
  runId,
6341
6940
  context
6342
6941
  }) => {
6343
6942
  try {
6344
- setIsResumingWorkflow(true);
6943
+ setIsResumingLegacyWorkflow(true);
6345
6944
  const client = createMastraClient(baseUrl);
6346
- const response = await client.getWorkflow(workflowId).resume({ stepId, runId, context });
6945
+ const response = await client.getLegacyWorkflow(workflowId).resume({ stepId, runId, context });
6347
6946
  return response;
6348
6947
  } catch (error) {
6349
6948
  console.error("Error resuming workflow:", error);
6350
6949
  throw error;
6351
6950
  } finally {
6352
- setIsResumingWorkflow(false);
6951
+ setIsResumingLegacyWorkflow(false);
6353
6952
  }
6354
6953
  };
6355
- const resumeVNextWorkflow = async ({
6954
+ const resumeWorkflow = async ({
6356
6955
  workflowId,
6357
6956
  step,
6358
6957
  runId,
6359
6958
  resumeData,
6360
- runtimeContext
6959
+ runtimeContext: playgroundRuntimeContext
6361
6960
  }) => {
6362
6961
  try {
6363
- setIsResumingVNextWorkflow(true);
6962
+ setIsResumingWorkflow(true);
6364
6963
  const client = createMastraClient(baseUrl);
6365
- const response = await client.getVNextWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext });
6964
+ const runtimeContext$1 = new runtimeContext.RuntimeContext();
6965
+ Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6966
+ runtimeContext$1.set(key, value);
6967
+ });
6968
+ const response = await client.getWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext: runtimeContext$1 });
6366
6969
  return response;
6367
6970
  } catch (error) {
6368
6971
  console.error("Error resuming workflow:", error);
6369
6972
  throw error;
6370
6973
  } finally {
6371
- setIsResumingVNextWorkflow(false);
6974
+ setIsResumingWorkflow(false);
6372
6975
  }
6373
6976
  };
6374
6977
  return {
6978
+ resumeLegacyWorkflow,
6979
+ isResumingLegacyWorkflow,
6375
6980
  resumeWorkflow,
6376
- isResumingWorkflow,
6377
- resumeVNextWorkflow,
6378
- isResumingVNextWorkflow
6981
+ isResumingWorkflow
6379
6982
  };
6380
6983
  };
6381
6984
 
@@ -6462,7 +7065,7 @@ const defaultEdgeOptions = {
6462
7065
  color: "#8e8e8e"
6463
7066
  }
6464
7067
  };
6465
- const contructNodesAndEdges = ({
7068
+ const contructLegacyNodesAndEdges = ({
6466
7069
  stepGraph,
6467
7070
  stepSubscriberGraph,
6468
7071
  steps: mainSteps = {}
@@ -6913,7 +7516,7 @@ const getStepNodeAndEdge = ({
6913
7516
  }
6914
7517
  return { nodes: [], edges: [], nextPrevNodeIds: [] };
6915
7518
  };
6916
- const constructVNextNodesAndEdges = ({
7519
+ const constructNodesAndEdges = ({
6917
7520
  stepGraph
6918
7521
  }) => {
6919
7522
  if (!stepGraph) {
@@ -6984,54 +7587,6 @@ const Collapsible = CollapsiblePrimitive__namespace.Root;
6984
7587
  const CollapsibleTrigger = CollapsiblePrimitive__namespace.CollapsibleTrigger;
6985
7588
  const CollapsibleContent = CollapsiblePrimitive__namespace.CollapsibleContent;
6986
7589
 
6987
- const Dialog = DialogPrimitive__namespace.Root;
6988
- const DialogPortal = DialogPrimitive__namespace.Portal;
6989
- const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
6990
- DialogPrimitive__namespace.Overlay,
6991
- {
6992
- ref,
6993
- className: cn(
6994
- "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",
6995
- className
6996
- ),
6997
- ...props
6998
- }
6999
- ));
7000
- DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
7001
- const DialogContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
7002
- /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
7003
- /* @__PURE__ */ jsxRuntime.jsxs(
7004
- DialogPrimitive__namespace.Content,
7005
- {
7006
- ref,
7007
- className: cn(
7008
- "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",
7009
- className
7010
- ),
7011
- ...props,
7012
- children: [
7013
- children,
7014
- /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
7015
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
7016
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
7017
- ] })
7018
- ]
7019
- }
7020
- )
7021
- ] }));
7022
- DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
7023
- const DialogTitle = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
7024
- DialogPrimitive__namespace.Title,
7025
- {
7026
- ref,
7027
- className: cn("text-lg font-semibold leading-none tracking-tight", className),
7028
- ...props
7029
- }
7030
- ));
7031
- DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
7032
- const DialogDescription = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
7033
- DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
7034
-
7035
7590
  const ScrollArea = React__namespace.forwardRef(
7036
7591
  ({ className, children, viewPortClassName, maxHeight, autoScroll = false, ...props }, ref) => {
7037
7592
  const areaRef = React__namespace.useRef(null);
@@ -7252,12 +7807,12 @@ function Spinner({ color = "#fff", className }) {
7252
7807
  );
7253
7808
  }
7254
7809
 
7255
- function WorkflowNestedGraph({
7810
+ function LegacyWorkflowNestedGraph({
7256
7811
  stepGraph,
7257
7812
  stepSubscriberGraph,
7258
7813
  open
7259
7814
  }) {
7260
- const { nodes: initialNodes, edges: initialEdges } = contructNodesAndEdges({
7815
+ const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
7261
7816
  stepGraph,
7262
7817
  stepSubscriberGraph
7263
7818
  });
@@ -7295,10 +7850,10 @@ function WorkflowNestedGraph({
7295
7850
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
7296
7851
  }
7297
7852
 
7298
- const WorkflowNestedGraphContext = React.createContext(
7853
+ const LegacyWorkflowNestedGraphContext = React.createContext(
7299
7854
  {}
7300
7855
  );
7301
- function WorkflowNestedGraphProvider({ children }) {
7856
+ function LegacyWorkflowNestedGraphProvider({ children }) {
7302
7857
  const [stepGraph, setStepGraph] = React.useState(null);
7303
7858
  const [stepSubscriberGraph, setStepSubscriberGraph] = React.useState(null);
7304
7859
  const [openDialog, setOpenDialog] = React.useState(false);
@@ -7320,7 +7875,7 @@ function WorkflowNestedGraphProvider({ children }) {
7320
7875
  setOpenDialog(true);
7321
7876
  };
7322
7877
  return /* @__PURE__ */ jsxRuntime.jsxs(
7323
- WorkflowNestedGraphContext.Provider,
7878
+ LegacyWorkflowNestedGraphContext.Provider,
7324
7879
  {
7325
7880
  value: {
7326
7881
  showNestedGraph,
@@ -7336,16 +7891,23 @@ function WorkflowNestedGraphProvider({ children }) {
7336
7891
  " workflow"
7337
7892
  ] })
7338
7893
  ] }),
7339
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraph, { stepGraph, open: openDialog, stepSubscriberGraph }) })
7894
+ /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
7895
+ LegacyWorkflowNestedGraph,
7896
+ {
7897
+ stepGraph,
7898
+ open: openDialog,
7899
+ stepSubscriberGraph
7900
+ }
7901
+ ) })
7340
7902
  ] }) }) })
7341
7903
  ]
7342
7904
  }
7343
7905
  );
7344
7906
  }
7345
7907
 
7346
- function WorkflowNestedNode({ data }) {
7908
+ function LegacyWorkflowNestedNode({ data }) {
7347
7909
  const { label, withoutTopHandle, withoutBottomHandle, stepGraph, stepSubscriberGraph } = data;
7348
- const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
7910
+ const { showNestedGraph } = React.useContext(LegacyWorkflowNestedGraphContext);
7349
7911
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
7350
7912
  !withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
7351
7913
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph, stepSubscriberGraph }), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
@@ -7356,8 +7918,8 @@ function WorkflowNestedNode({ data }) {
7356
7918
  ] });
7357
7919
  }
7358
7920
 
7359
- function WorkflowGraphInner({ workflow }) {
7360
- const { nodes: initialNodes, edges: initialEdges } = contructNodesAndEdges({
7921
+ function LegacyWorkflowGraphInner({ workflow }) {
7922
+ const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
7361
7923
  stepGraph: workflow.serializedStepGraph || workflow.stepGraph,
7362
7924
  stepSubscriberGraph: workflow.serializedStepSubscriberGraph || workflow.stepSubscriberGraph,
7363
7925
  steps: workflow.steps
@@ -7369,7 +7931,7 @@ function WorkflowGraphInner({ workflow }) {
7369
7931
  "condition-node": WorkflowConditionNode,
7370
7932
  "after-node": WorkflowAfterNode,
7371
7933
  "loop-result-node": WorkflowLoopResultNode,
7372
- "nested-node": WorkflowNestedNode
7934
+ "nested-node": LegacyWorkflowNestedNode
7373
7935
  };
7374
7936
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
7375
7937
  react$2.ReactFlow,
@@ -7396,12 +7958,12 @@ const lodashTitleCase = (str) => {
7396
7958
  return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
7397
7959
  };
7398
7960
 
7399
- function WorkflowGraph({ workflowId, baseUrl }) {
7400
- const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
7961
+ function LegacyWorkflowGraph({ workflowId, baseUrl }) {
7962
+ const { legacyWorkflow, isLoading } = useLegacyWorkflow(workflowId, baseUrl);
7401
7963
  if (isLoading) {
7402
7964
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
7403
7965
  }
7404
- if (!workflow) {
7966
+ if (!legacyWorkflow) {
7405
7967
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
7406
7968
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
7407
7969
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -7411,28 +7973,24 @@ function WorkflowGraph({ workflowId, baseUrl }) {
7411
7973
  ] })
7412
7974
  ] }) });
7413
7975
  }
7414
- return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraphInner, { workflow }) }) });
7976
+ return /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowGraphInner, { workflow: legacyWorkflow }) }) });
7415
7977
  }
7416
7978
 
7417
7979
  const Form = React.forwardRef(({ children, ...props }, ref) => {
7418
7980
  return /* @__PURE__ */ jsxRuntime.jsx("form", { ref, className: "space-y-4", ...props, children });
7419
7981
  });
7420
7982
 
7421
- const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
7422
- const Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref, className: cn(labelVariants(), className), ...props }));
7423
- Label.displayName = LabelPrimitive__namespace.Root.displayName;
7424
-
7425
7983
  const DISABLED_LABELS = ["boolean", "object", "array"];
7426
7984
  const FieldWrapper = ({ label, children, id, field, error }) => {
7427
7985
  const isDisabled = DISABLED_LABELS.includes(field.type);
7428
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7429
- !isDisabled && /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: id, children: [
7986
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pb-4 last:pb-0", children: [
7987
+ !isDisabled && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3 pb-1 block", htmlFor: id, children: [
7430
7988
  label,
7431
- field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: " *" })
7989
+ field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
7432
7990
  ] }),
7433
7991
  children,
7434
- field.fieldConfig?.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: field.fieldConfig.description }),
7435
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: error })
7992
+ field.fieldConfig?.description && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon6", children: field.fieldConfig.description }),
7993
+ error && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-accent2", children: error })
7436
7994
  ] });
7437
7995
  };
7438
7996
 
@@ -7541,9 +8099,9 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
7541
8099
  defaultChecked: field.default
7542
8100
  }
7543
8101
  ),
7544
- /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: id, children: [
8102
+ /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", htmlFor: id, children: [
7545
8103
  label,
7546
- field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: " *" })
8104
+ field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
7547
8105
  ] })
7548
8106
  ] });
7549
8107
 
@@ -7890,34 +8448,53 @@ const SelectField = ({ field, inputProps, error, id, value }) => {
7890
8448
  };
7891
8449
 
7892
8450
  const ObjectWrapper = ({ label, children }) => {
7893
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 border p-2 rounded-md", children: [
7894
- label === "​" ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium", children: label }),
7895
- children
7896
- ] });
7897
- };
7898
-
7899
- const ArrayWrapper = ({ label, children, onAddItem }) => {
7900
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
7901
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium", children: label }),
7902
- children,
8451
+ const hasLabel = label !== "" && label !== "";
8452
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "", children: [
8453
+ hasLabel && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 flex items-center gap-1 pb-2", children: [
8454
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {}) }),
8455
+ label
8456
+ ] }),
7903
8457
  /* @__PURE__ */ jsxRuntime.jsx(
7904
- Button$1,
8458
+ "div",
7905
8459
  {
7906
- className: "w-full flex items-center justify-center",
7907
- onClick: onAddItem,
7908
- variant: "outline",
7909
- size: "sm",
7910
- type: "button",
7911
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-4 w-4" })
8460
+ className: hasLabel ? "flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4" : "",
8461
+ children
7912
8462
  }
7913
8463
  )
7914
8464
  ] });
7915
8465
  };
7916
8466
 
8467
+ const ArrayWrapper = ({ label, children, onAddItem }) => {
8468
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
8469
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 justify-between", children: [
8470
+ /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 pb-2 flex items-center gap-1", children: [
8471
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Brackets, {}) }),
8472
+ label
8473
+ ] }),
8474
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { delayDuration: 0, children: [
8475
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8476
+ "button",
8477
+ {
8478
+ onClick: onAddItem,
8479
+ type: "button",
8480
+ className: "text-icon3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-icon6 h-icon-sm w-icon-sm",
8481
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, {}) })
8482
+ }
8483
+ ) }),
8484
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Add item" })
8485
+ ] }) })
8486
+ ] }),
8487
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children })
8488
+ ] });
8489
+ };
8490
+
7917
8491
  const ArrayElementWrapper = ({ children, onRemove }) => {
7918
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative border p-4 rounded-md mt-2", children: [
7919
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: onRemove, variant: "ghost", className: "absolute top-2 right-2", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, { className: "h-4 w-4" }) }),
7920
- children
8492
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pl-4 border-l border-border1", children: [
8493
+ children,
8494
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: onRemove, type: "button", children: [
8495
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, {}) }),
8496
+ "Delete"
8497
+ ] })
7921
8498
  ] });
7922
8499
  };
7923
8500
 
@@ -8116,6 +8693,10 @@ class CustomZodProvider extends zod.ZodProvider {
8116
8693
  }
8117
8694
  }
8118
8695
 
8696
+ const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
8697
+ const Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref, className: cn(labelVariants(), className), ...props }));
8698
+ Label.displayName = LabelPrimitive__namespace.Root.displayName;
8699
+
8119
8700
  function isEmptyZodObject(schema) {
8120
8701
  if (schema instanceof z.ZodObject) {
8121
8702
  return Object.keys(schema.shape).length === 0;
@@ -8127,7 +8708,7 @@ function DynamicForm({
8127
8708
  onSubmit,
8128
8709
  defaultValues,
8129
8710
  isSubmitLoading,
8130
- submitButtonLabel = "Submit"
8711
+ submitButtonLabel
8131
8712
  }) {
8132
8713
  if (!schema) {
8133
8714
  console.error("no form schema found");
@@ -8149,17 +8730,17 @@ function DynamicForm({
8149
8730
  },
8150
8731
  defaultValues: defaultValues ? { "​": defaultValues } : void 0,
8151
8732
  formProps: {
8152
- className: "space-y-4 p-4"
8733
+ className: ""
8153
8734
  },
8154
8735
  uiComponents: {
8155
- SubmitButton: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button$1, { className: "w-full", type: "submit", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : children || submitButtonLabel })
8736
+ SubmitButton: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "light", className: "w-full", size: "lg", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : submitButtonLabel || children })
8156
8737
  },
8157
8738
  formComponents: {
8158
8739
  Label: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-normal", children: value })
8159
8740
  },
8160
8741
  withSubmit: true
8161
8742
  };
8162
- return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsx(AutoForm, { ...formProps }) });
8743
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsx(AutoForm, { ...formProps }) });
8163
8744
  }
8164
8745
 
8165
8746
  function resolveSerializedZodOutput(obj) {
@@ -8189,22 +8770,22 @@ function CodeBlockDemo({
8189
8770
 
8190
8771
  const WorkflowRunContext = React.createContext({});
8191
8772
  function WorkflowRunProvider({ children }) {
8773
+ const [legacyResult, setLegacyResult] = React.useState(null);
8192
8774
  const [result, setResult] = React.useState(null);
8193
- const [vNextResult, setVNextResult] = React.useState(null);
8194
8775
  const [payload, setPayload] = React.useState(null);
8195
8776
  const clearData = () => {
8777
+ setLegacyResult(null);
8196
8778
  setResult(null);
8197
- setVNextResult(null);
8198
8779
  setPayload(null);
8199
8780
  };
8200
8781
  return /* @__PURE__ */ jsxRuntime.jsx(
8201
8782
  WorkflowRunContext.Provider,
8202
8783
  {
8203
8784
  value: {
8785
+ legacyResult,
8786
+ setLegacyResult,
8204
8787
  result,
8205
8788
  setResult,
8206
- vNextResult,
8207
- setVNextResult,
8208
8789
  payload,
8209
8790
  setPayload,
8210
8791
  clearData
@@ -8214,16 +8795,81 @@ function WorkflowRunProvider({ children }) {
8214
8795
  );
8215
8796
  }
8216
8797
 
8217
- function WorkflowTrigger({
8798
+ const WorkflowCard = ({ header, children, footer }) => {
8799
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface4", children: [
8800
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 px-2 flex items-center gap-3", children: header }),
8801
+ children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t-sm border-border1", children }),
8802
+ footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
8803
+ ] });
8804
+ };
8805
+
8806
+ const LegacyWorkflowStatus = ({ stepId, pathStatus, path }) => {
8807
+ const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : pathStatus === "executing" ? "Executing" : "Completed";
8808
+ return /* @__PURE__ */ jsxRuntime.jsx(
8809
+ WorkflowCard,
8810
+ {
8811
+ header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
8812
+ /* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
8813
+ status === "Completed" && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }),
8814
+ status === "Failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
8815
+ status === "Executing" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-icon3 animate-spin" })
8816
+ ] }),
8817
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: path })
8818
+ ] })
8819
+ }
8820
+ );
8821
+ };
8822
+
8823
+ const WorkflowResult = ({ jsonResult, sanitizedJsonResult }) => {
8824
+ const { handleCopy } = useCopyToClipboard({ text: jsonResult });
8825
+ const [expanded, setExpanded] = React.useState(false);
8826
+ return /* @__PURE__ */ jsxRuntime.jsx(
8827
+ WorkflowCard,
8828
+ {
8829
+ header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 justify-between w-full", children: [
8830
+ /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "text-icon6 flex items-center gap-3 font-medium", children: [
8831
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(DeploymentIcon, {}) }),
8832
+ "Results"
8833
+ ] }),
8834
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
8835
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8836
+ "button",
8837
+ {
8838
+ className: "p-2 rounded-lg hover:bg-surface5 transition-colors duration-150 ease-in-out text-icon3 hover:text-icon6",
8839
+ onClick: () => handleCopy(),
8840
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
8841
+ }
8842
+ ) }),
8843
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Copy result" })
8844
+ ] })
8845
+ ] }),
8846
+ footer: /* @__PURE__ */ jsxRuntime.jsx(
8847
+ "button",
8848
+ {
8849
+ className: "w-full h-full text-center text-icon2 hover:text-icon6 text-ui-md",
8850
+ onClick: () => setExpanded((s) => !s),
8851
+ children: expanded ? "collapse" : "expand"
8852
+ }
8853
+ ),
8854
+ children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(CodeBlockDemo, { className: "w-full overflow-x-auto", code: sanitizedJsonResult || jsonResult, language: "json" }) : null
8855
+ }
8856
+ );
8857
+ };
8858
+
8859
+ function LegacyWorkflowTrigger({
8218
8860
  workflowId,
8219
8861
  baseUrl,
8220
8862
  setRunId
8221
8863
  }) {
8222
- const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
8223
- const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
8224
- const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
8225
- const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
8226
- const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
8864
+ const { legacyResult: result, setLegacyResult: setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
8865
+ const { isLoading, legacyWorkflow: workflow } = useLegacyWorkflow(workflowId, baseUrl);
8866
+ const { createLegacyWorkflowRun: createWorkflowRun, startLegacyWorkflowRun: startWorkflowRun } = useExecuteWorkflow(baseUrl);
8867
+ const {
8868
+ watchLegacyWorkflow: watchWorkflow,
8869
+ legacyWatchResult: watchResult,
8870
+ isWatchingLegacyWorkflow: isWatchingWorkflow
8871
+ } = useWatchWorkflow(baseUrl);
8872
+ const { resumeLegacyWorkflow: resumeWorkflow, isResumingLegacyWorkflow: isResumingWorkflow } = useResumeWorkflow(baseUrl);
8227
8873
  const [suspendedSteps, setSuspendedSteps] = React.useState([]);
8228
8874
  const [isRunning, setIsRunning] = React.useState(false);
8229
8875
  const triggerSchema = workflow?.triggerSchema;
@@ -8254,7 +8900,7 @@ function WorkflowTrigger({
8254
8900
  });
8255
8901
  };
8256
8902
  const watchResultToUse = result ?? watchResult;
8257
- const workflowActivePaths = watchResultToUse?.activePaths ?? [];
8903
+ const workflowActivePaths = watchResultToUse?.activePaths ?? {};
8258
8904
  React.useEffect(() => {
8259
8905
  setIsRunning(isWatchingWorkflow);
8260
8906
  }, [isWatchingWorkflow]);
@@ -8282,50 +8928,34 @@ function WorkflowTrigger({
8282
8928
  const isSuspendedSteps = suspendedSteps.length > 0;
8283
8929
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
8284
8930
  const { sanitizedOutput, ...restResult } = result ?? {};
8285
- return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs w-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8286
- !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
8287
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
8288
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Input" }),
8289
- isResumingWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8290
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8291
- " Resuming workflow"
8292
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
8293
- ] }),
8294
- /* @__PURE__ */ jsxRuntime.jsx(
8295
- DynamicForm,
8296
- {
8297
- schema: zodInputSchema,
8298
- defaultValues: payload,
8299
- isSubmitLoading: isWatchingWorkflow,
8300
- onSubmit: (data) => {
8301
- setPayload(data);
8302
- handleExecuteWorkflow(data);
8303
- }
8304
- }
8305
- )
8306
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 space-y-4", children: [
8307
- isResumingWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8308
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8309
- " Resuming workflow"
8310
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
8311
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
8312
- ] }) }),
8313
- Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
8314
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8315
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
8316
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
8317
- const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : "Completed";
8318
- const statusIcon = status === "Completed" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "Failed" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
8319
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center justify-between p-3`, children: [
8320
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: path.charAt(0).toUpperCase() + path.slice(1) }),
8321
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
8322
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
8323
- status
8324
- ] })
8325
- ] }) }, idx);
8326
- }) });
8327
- }) })
8931
+ const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
8932
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8933
+ isResumingWorkflow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
8934
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
8935
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
8328
8936
  ] }),
8937
+ !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsx(
8938
+ DynamicForm,
8939
+ {
8940
+ schema: zodInputSchema,
8941
+ defaultValues: payload,
8942
+ isSubmitLoading: isWatchingWorkflow,
8943
+ submitButtonLabel: "Run",
8944
+ onSubmit: (data) => {
8945
+ setPayload(data);
8946
+ handleExecuteWorkflow(data);
8947
+ }
8948
+ }
8949
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
8950
+ Button,
8951
+ {
8952
+ className: "w-full",
8953
+ variant: "light",
8954
+ disabled: isRunning,
8955
+ onClick: () => handleExecuteWorkflow(null),
8956
+ children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : "Trigger"
8957
+ }
8958
+ ) }),
8329
8959
  isSuspendedSteps && suspendedSteps?.map((step) => {
8330
8960
  const stepDefinition = workflow.steps[step.stepId];
8331
8961
  const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.inputSchema))) : z.z.record(z.z.string(), z.z.any());
@@ -8357,29 +8987,23 @@ function WorkflowTrigger({
8357
8987
  )
8358
8988
  ] });
8359
8989
  }),
8360
- result && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col group relative", children: [
8361
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Output" }),
8362
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8363
- CopyButton,
8364
- {
8365
- classname: "absolute z-40 w-8 h-8 p-0 transition-opacity duration-150 ease-in-out opacity-0 top-4 right-4 group-hover:opacity-100",
8366
- content: JSON.stringify(restResult, null, 2)
8367
- }
8368
- ) }),
8369
- /* @__PURE__ */ jsxRuntime.jsx(
8370
- CodeBlockDemo,
8371
- {
8372
- className: "w-full overflow-x-auto",
8373
- code: sanitizedOutput || JSON.stringify(restResult, null, 2),
8374
- language: "json"
8375
- }
8376
- )
8990
+ hasWorkflowActivePaths && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8991
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
8992
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
8993
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
8994
+ return /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowStatus, { stepId, pathStatus, path }, idx);
8995
+ }) }, stepId);
8996
+ }) })
8997
+ ] }),
8998
+ result && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8999
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
9000
+ /* @__PURE__ */ jsxRuntime.jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
8377
9001
  ] })
8378
9002
  ] }) });
8379
9003
  }
8380
9004
 
8381
- function VNextWorkflowNestedGraph({ stepGraph, open }) {
8382
- const { nodes: initialNodes, edges: initialEdges } = constructVNextNodesAndEdges({
9005
+ function WorkflowNestedGraph({ stepGraph, open }) {
9006
+ const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
8383
9007
  stepGraph
8384
9008
  });
8385
9009
  const [isMounted, setIsMounted] = React.useState(false);
@@ -8390,7 +9014,7 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
8390
9014
  "condition-node": WorkflowConditionNode,
8391
9015
  "after-node": WorkflowAfterNode,
8392
9016
  "loop-result-node": WorkflowLoopResultNode,
8393
- "nested-node": VNextWorkflowNestedNode
9017
+ "nested-node": WorkflowNestedNode
8394
9018
  };
8395
9019
  React.useEffect(() => {
8396
9020
  if (open) {
@@ -8417,10 +9041,10 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
8417
9041
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
8418
9042
  }
8419
9043
 
8420
- const VNextWorkflowNestedGraphContext = React.createContext(
9044
+ const WorkflowNestedGraphContext = React.createContext(
8421
9045
  {}
8422
9046
  );
8423
- function VNextWorkflowNestedGraphProvider({ children }) {
9047
+ function WorkflowNestedGraphProvider({ children }) {
8424
9048
  const [stepGraph, setStepGraph] = React.useState(null);
8425
9049
  const [parentStepGraphList, setParentStepGraphList] = React.useState([]);
8426
9050
  const [openDialog, setOpenDialog] = React.useState(false);
@@ -8458,7 +9082,7 @@ function VNextWorkflowNestedGraphProvider({ children }) {
8458
9082
  }, 500);
8459
9083
  };
8460
9084
  return /* @__PURE__ */ jsxRuntime.jsxs(
8461
- VNextWorkflowNestedGraphContext.Provider,
9085
+ WorkflowNestedGraphContext.Provider,
8462
9086
  {
8463
9087
  value: {
8464
9088
  showNestedGraph,
@@ -8474,16 +9098,16 @@ function VNextWorkflowNestedGraphProvider({ children }) {
8474
9098
  " workflow"
8475
9099
  ] })
8476
9100
  ] }),
8477
- switching ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(VNextWorkflowNestedGraph, { stepGraph, open: openDialog }) })
9101
+ switching ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraph, { stepGraph, open: openDialog }) })
8478
9102
  ] }) }) })
8479
9103
  ]
8480
9104
  }
8481
9105
  );
8482
9106
  }
8483
9107
 
8484
- function VNextWorkflowNestedNode({ data }) {
9108
+ function WorkflowNestedNode({ data }) {
8485
9109
  const { label, withoutTopHandle, withoutBottomHandle, stepGraph } = data;
8486
- const { showNestedGraph } = React.useContext(VNextWorkflowNestedGraphContext);
9110
+ const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
8487
9111
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
8488
9112
  !withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
8489
9113
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph }), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
@@ -8494,8 +9118,8 @@ function VNextWorkflowNestedNode({ data }) {
8494
9118
  ] });
8495
9119
  }
8496
9120
 
8497
- function VNextWorkflowGraphInner({ workflow }) {
8498
- const { nodes: initialNodes, edges: initialEdges } = constructVNextNodesAndEdges(workflow);
9121
+ function WorkflowGraphInner({ workflow }) {
9122
+ const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
8499
9123
  const [nodes, _, onNodesChange] = react$2.useNodesState(initialNodes);
8500
9124
  const [edges] = react$2.useEdgesState(initialEdges);
8501
9125
  const nodeTypes = {
@@ -8503,7 +9127,7 @@ function VNextWorkflowGraphInner({ workflow }) {
8503
9127
  "condition-node": WorkflowConditionNode,
8504
9128
  "after-node": WorkflowAfterNode,
8505
9129
  "loop-result-node": WorkflowLoopResultNode,
8506
- "nested-node": VNextWorkflowNestedNode
9130
+ "nested-node": WorkflowNestedNode
8507
9131
  };
8508
9132
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
8509
9133
  react$2.ReactFlow,
@@ -8525,12 +9149,12 @@ function VNextWorkflowGraphInner({ workflow }) {
8525
9149
  ) });
8526
9150
  }
8527
9151
 
8528
- function VNextWorkflowGraph({ workflowId, baseUrl }) {
8529
- const { vNextWorkflow, isLoading } = useVNextWorkflow(workflowId, baseUrl);
9152
+ function WorkflowGraph({ workflowId, baseUrl }) {
9153
+ const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
8530
9154
  if (isLoading) {
8531
9155
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
8532
9156
  }
8533
- if (!vNextWorkflow) {
9157
+ if (!workflow) {
8534
9158
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
8535
9159
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
8536
9160
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -8540,120 +9164,126 @@ function VNextWorkflowGraph({ workflowId, baseUrl }) {
8540
9164
  ] })
8541
9165
  ] }) });
8542
9166
  }
8543
- return /* @__PURE__ */ jsxRuntime.jsx(VNextWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(VNextWorkflowGraphInner, { workflow: vNextWorkflow }) }) });
9167
+ return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraphInner, { workflow }) }) });
8544
9168
  }
8545
9169
 
8546
- function VNextWorkflowTrigger({
9170
+ const WorkflowStatus = ({ stepId, status }) => {
9171
+ return /* @__PURE__ */ jsxRuntime.jsx(
9172
+ WorkflowCard,
9173
+ {
9174
+ header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
9175
+ /* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
9176
+ status === "success" && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }),
9177
+ status === "failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
9178
+ status === "suspended" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CirclePause, { className: "text-icon3" }),
9179
+ status === "running" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-icon3 animate-spin" })
9180
+ ] }),
9181
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) })
9182
+ ] })
9183
+ }
9184
+ );
9185
+ };
9186
+
9187
+ function WorkflowTrigger({
8547
9188
  workflowId,
8548
9189
  baseUrl,
8549
9190
  setRunId
8550
9191
  }) {
8551
- const { vNextResult, setVNextResult, payload, setPayload } = React.useContext(WorkflowRunContext);
8552
- const { isLoading, vNextWorkflow } = useVNextWorkflow(workflowId, baseUrl);
8553
- const { createVNextWorkflowRun, startVNextWorkflowRun } = useExecuteWorkflow(baseUrl);
8554
- const { watchVNextWorkflow, watchVNextResult, isWatchingVNextWorkflow } = useWatchWorkflow(baseUrl);
8555
- const { resumeVNextWorkflow, isResumingVNextWorkflow } = useResumeWorkflow(baseUrl);
9192
+ const { runtimeContext } = usePlaygroundStore();
9193
+ const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
9194
+ const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
9195
+ const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
9196
+ const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
9197
+ const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
8556
9198
  const [suspendedSteps, setSuspendedSteps] = React.useState([]);
8557
9199
  const [isRunning, setIsRunning] = React.useState(false);
8558
- const triggerSchema = vNextWorkflow?.inputSchema;
9200
+ const triggerSchema = workflow?.inputSchema;
8559
9201
  const handleExecuteWorkflow = async (data) => {
8560
9202
  try {
8561
- if (!vNextWorkflow) return;
9203
+ if (!workflow) return;
8562
9204
  setIsRunning(true);
8563
- setVNextResult(null);
8564
- const { runId } = await createVNextWorkflowRun({ workflowId });
9205
+ setResult(null);
9206
+ const { runId } = await createWorkflowRun({ workflowId });
8565
9207
  setRunId?.(runId);
8566
- watchVNextWorkflow({ workflowId, runId });
8567
- startVNextWorkflowRun({ workflowId, runId, input: data });
9208
+ watchWorkflow({ workflowId, runId });
9209
+ startWorkflowRun({ workflowId, runId, input: data, runtimeContext });
8568
9210
  } catch (err) {
8569
9211
  setIsRunning(false);
8570
9212
  sonner.toast.error("Error executing workflow");
8571
9213
  }
8572
9214
  };
8573
9215
  const handleResumeWorkflow = async (step) => {
8574
- if (!vNextWorkflow) return;
9216
+ if (!workflow) return;
8575
9217
  const { stepId, runId: prevRunId, resumeData } = step;
8576
- const { runId } = await createVNextWorkflowRun({ workflowId, prevRunId });
8577
- watchVNextWorkflow({ workflowId, runId });
8578
- await resumeVNextWorkflow({
9218
+ const { runId } = await createWorkflowRun({ workflowId, prevRunId });
9219
+ watchWorkflow({ workflowId, runId });
9220
+ await resumeWorkflow({
8579
9221
  step: stepId,
8580
9222
  runId,
8581
9223
  resumeData,
8582
- workflowId
9224
+ workflowId,
9225
+ runtimeContext
8583
9226
  });
8584
9227
  };
8585
- const watchResultToUse = vNextResult ?? watchVNextResult;
9228
+ const watchResultToUse = result ?? watchResult;
8586
9229
  const workflowActivePaths = watchResultToUse?.payload?.workflowState?.steps ?? {};
8587
9230
  React.useEffect(() => {
8588
- setIsRunning(isWatchingVNextWorkflow);
8589
- }, [isWatchingVNextWorkflow]);
9231
+ setIsRunning(isWatchingWorkflow);
9232
+ }, [isWatchingWorkflow]);
8590
9233
  React.useEffect(() => {
8591
- if (!watchResultToUse?.payload?.workflowState?.steps || !vNextResult?.runId) return;
9234
+ if (!watchResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
8592
9235
  const suspended = Object.entries(watchResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
8593
9236
  stepId,
8594
- runId: vNextResult.runId,
9237
+ runId: result.runId,
8595
9238
  suspendPayload: payload2
8596
9239
  }));
8597
9240
  setSuspendedSteps(suspended);
8598
- }, [watchResultToUse, vNextResult]);
9241
+ }, [watchResultToUse, result]);
8599
9242
  React.useEffect(() => {
8600
- if (watchVNextResult) {
8601
- setVNextResult(watchVNextResult);
9243
+ if (watchResult) {
9244
+ setResult(watchResult);
8602
9245
  }
8603
- }, [watchVNextResult]);
9246
+ }, [watchResult]);
8604
9247
  if (isLoading) {
8605
9248
  return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8606
9249
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" }),
8607
9250
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" })
8608
9251
  ] }) });
8609
9252
  }
8610
- if (!vNextWorkflow) return null;
9253
+ if (!workflow) return null;
8611
9254
  const isSuspendedSteps = suspendedSteps.length > 0;
8612
9255
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
8613
- const { sanitizedOutput, ...restResult } = vNextResult ?? {};
8614
- return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs w-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8615
- !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
8616
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
8617
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Input" }),
8618
- isResumingVNextWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8619
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8620
- " Resuming workflow"
8621
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
8622
- ] }),
8623
- /* @__PURE__ */ jsxRuntime.jsx(
8624
- DynamicForm,
8625
- {
8626
- schema: zodInputSchema,
8627
- defaultValues: payload,
8628
- isSubmitLoading: isWatchingVNextWorkflow,
8629
- onSubmit: (data) => {
8630
- setPayload(data);
8631
- handleExecuteWorkflow(data);
8632
- }
8633
- }
8634
- )
8635
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 space-y-4", children: [
8636
- isResumingVNextWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8637
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8638
- " Resuming workflow"
8639
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
8640
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
8641
- ] }) }),
8642
- Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
8643
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8644
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
8645
- const statusIcon = status === "success" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "failed" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
8646
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center justify-between p-3`, children: [
8647
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) }),
8648
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2 capitalize", children: [
8649
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
8650
- status
8651
- ] })
8652
- ] }) }, stepId) });
8653
- }) })
9256
+ const { sanitizedOutput, ...restResult } = result ?? {};
9257
+ const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
9258
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
9259
+ isResumingWorkflow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
9260
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
9261
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
8654
9262
  ] }),
8655
- !isWatchingVNextWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
8656
- const stepDefinition = vNextWorkflow.steps[step.stepId];
9263
+ !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsx(
9264
+ DynamicForm,
9265
+ {
9266
+ schema: zodInputSchema,
9267
+ defaultValues: payload,
9268
+ isSubmitLoading: isWatchingWorkflow,
9269
+ submitButtonLabel: "Run",
9270
+ onSubmit: (data) => {
9271
+ setPayload(data);
9272
+ handleExecuteWorkflow(data);
9273
+ }
9274
+ }
9275
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
9276
+ Button,
9277
+ {
9278
+ className: "w-full",
9279
+ variant: "light",
9280
+ disabled: isRunning,
9281
+ onClick: () => handleExecuteWorkflow(null),
9282
+ children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : "Trigger"
9283
+ }
9284
+ ) }),
9285
+ !isWatchingWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
9286
+ const stepDefinition = workflow.steps[step.stepId];
8657
9287
  const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.resumeSchema))) : z.z.record(z.z.string(), z.z.any());
8658
9288
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4", children: [
8659
9289
  /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
@@ -8669,7 +9299,7 @@ function VNextWorkflowTrigger({
8669
9299
  DynamicForm,
8670
9300
  {
8671
9301
  schema: stepSchema,
8672
- isSubmitLoading: isResumingVNextWorkflow,
9302
+ isSubmitLoading: isResumingWorkflow,
8673
9303
  submitButtonLabel: "Resume",
8674
9304
  onSubmit: (data) => {
8675
9305
  handleResumeWorkflow({
@@ -8683,23 +9313,18 @@ function VNextWorkflowTrigger({
8683
9313
  )
8684
9314
  ] });
8685
9315
  }),
8686
- vNextResult && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col group relative", children: [
8687
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Output" }),
8688
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8689
- CopyButton,
8690
- {
8691
- classname: "absolute z-40 w-8 h-8 p-0 transition-opacity duration-150 ease-in-out opacity-0 top-4 right-4 group-hover:opacity-100",
8692
- content: JSON.stringify(restResult, null, 2)
8693
- }
8694
- ) }),
8695
- /* @__PURE__ */ jsxRuntime.jsx(
8696
- CodeBlockDemo,
8697
- {
8698
- className: "w-full overflow-x-auto",
8699
- code: sanitizedOutput || JSON.stringify(restResult, null, 2),
8700
- language: "json"
8701
- }
8702
- )
9316
+ hasWorkflowActivePaths && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9317
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
9318
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
9319
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
9320
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
9321
+ return /* @__PURE__ */ jsxRuntime.jsx(WorkflowStatus, { stepId, status });
9322
+ }) })
9323
+ ] })
9324
+ ] }),
9325
+ result && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9326
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
9327
+ /* @__PURE__ */ jsxRuntime.jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
8703
9328
  ] })
8704
9329
  ] }) });
8705
9330
  }
@@ -8713,7 +9338,8 @@ const DataTable = ({
8713
9338
  getRowId,
8714
9339
  selectedRowId,
8715
9340
  isLoading,
8716
- emptyText
9341
+ emptyText,
9342
+ onClick
8717
9343
  }) => {
8718
9344
  const [sorting, setSorting] = React.useState([]);
8719
9345
  const [{ pageIndex, pageSize }, setPagination] = React.useState({
@@ -8755,7 +9381,16 @@ const DataTable = ({
8755
9381
  const meta = header.column.columnDef.meta;
8756
9382
  return /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
8757
9383
  }) }),
8758
- /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(Row, { children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { "data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected", children: row.getVisibleCells().map((cell) => reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())) }, row.id)) : emptyNode })
9384
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => {
9385
+ }, children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
9386
+ Row,
9387
+ {
9388
+ "data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected",
9389
+ onClick: () => onClick?.(row.original),
9390
+ children: row.getVisibleCells().map((cell) => reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()))
9391
+ },
9392
+ row.id
9393
+ )) : emptyNode })
8759
9394
  ] }),
8760
9395
  pagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
8761
9396
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground text-sm", children: [
@@ -8892,6 +9527,56 @@ const DarkLogo = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "100
8892
9527
  )
8893
9528
  ] });
8894
9529
 
9530
+ const Entity = ({ children, className, onClick }) => {
9531
+ return /* @__PURE__ */ jsxRuntime.jsx(
9532
+ "div",
9533
+ {
9534
+ tabIndex: onClick ? 0 : void 0,
9535
+ onKeyDown: (e) => {
9536
+ if (!onClick) return;
9537
+ if (e.key === "Enter" || e.key === " ") {
9538
+ e.preventDefault();
9539
+ onClick?.();
9540
+ }
9541
+ },
9542
+ className: clsx(
9543
+ "flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
9544
+ onClick && "cursor-pointer hover:bg-surface4 transition-all",
9545
+ className
9546
+ ),
9547
+ onClick,
9548
+ children
9549
+ }
9550
+ );
9551
+ };
9552
+ const EntityIcon = ({ children, className }) => {
9553
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
9554
+ };
9555
+ const EntityName = ({ children, className }) => {
9556
+ return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
9557
+ };
9558
+ const EntityDescription = ({ children, className }) => {
9559
+ return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
9560
+ };
9561
+ const EntityContent = ({ children, className }) => {
9562
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
9563
+ };
9564
+
9565
+ const EmptyState = ({
9566
+ iconSlot,
9567
+ titleSlot,
9568
+ descriptionSlot,
9569
+ actionSlot,
9570
+ as: Component = "div"
9571
+ }) => {
9572
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[340px] flex-col items-center justify-center text-center", children: [
9573
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-auto [&>svg]:w-[126px]", children: iconSlot }),
9574
+ /* @__PURE__ */ jsxRuntime.jsx(Component, { className: "text-icon6 pt-[34px] font-serif text-[1.75rem] font-semibold", children: titleSlot }),
9575
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-lg", className: "text-icon3 pb-[34px]", children: descriptionSlot }),
9576
+ actionSlot
9577
+ ] });
9578
+ };
9579
+
8895
9580
  function usePolling({
8896
9581
  fetchFn,
8897
9582
  interval = 3e3,
@@ -9051,6 +9736,7 @@ exports.AgentCoinIcon = AgentCoinIcon;
9051
9736
  exports.AgentContext = AgentContext;
9052
9737
  exports.AgentEvals = AgentEvals;
9053
9738
  exports.AgentIcon = AgentIcon;
9739
+ exports.AgentNetworkCoinIcon = AgentNetworkCoinIcon;
9054
9740
  exports.AgentProvider = AgentProvider;
9055
9741
  exports.AgentTraces = AgentTraces;
9056
9742
  exports.AiIcon = AiIcon;
@@ -9074,10 +9760,17 @@ exports.DeploymentIcon = DeploymentIcon;
9074
9760
  exports.DividerIcon = DividerIcon;
9075
9761
  exports.DocsIcon = DocsIcon;
9076
9762
  exports.DynamicForm = DynamicForm;
9763
+ exports.EmptyState = EmptyState;
9764
+ exports.Entity = Entity;
9765
+ exports.EntityContent = EntityContent;
9766
+ exports.EntityDescription = EntityDescription;
9767
+ exports.EntityIcon = EntityIcon;
9768
+ exports.EntityName = EntityName;
9077
9769
  exports.EntryCell = EntryCell;
9078
9770
  exports.EnvIcon = EnvIcon;
9079
9771
  exports.EvaluatorCoinIcon = EvaluatorCoinIcon;
9080
9772
  exports.FiltersIcon = FiltersIcon;
9773
+ exports.FolderIcon = FolderIcon;
9081
9774
  exports.GithubCoinIcon = GithubCoinIcon;
9082
9775
  exports.GithubIcon = GithubIcon;
9083
9776
  exports.GoogleIcon = GoogleIcon;
@@ -9090,8 +9783,12 @@ exports.Icon = Icon;
9090
9783
  exports.InfoIcon = InfoIcon;
9091
9784
  exports.JudgeIcon = JudgeIcon;
9092
9785
  exports.LatencyIcon = LatencyIcon;
9786
+ exports.LegacyWorkflowGraph = LegacyWorkflowGraph;
9787
+ exports.LegacyWorkflowTrigger = LegacyWorkflowTrigger;
9093
9788
  exports.LogsIcon = LogsIcon;
9094
9789
  exports.MastraResizablePanel = MastraResizablePanel;
9790
+ exports.McpCoinIcon = McpCoinIcon;
9791
+ exports.McpServerIcon = McpServerIcon;
9095
9792
  exports.MemoryIcon = MemoryIcon;
9096
9793
  exports.NetworkChat = NetworkChat;
9097
9794
  exports.NetworkContext = NetworkContext;
@@ -9112,6 +9809,7 @@ exports.ThreadItem = ThreadItem;
9112
9809
  exports.ThreadLink = ThreadLink;
9113
9810
  exports.ThreadList = ThreadList;
9114
9811
  exports.Threads = Threads;
9812
+ exports.ToolCoinIcon = ToolCoinIcon;
9115
9813
  exports.ToolsIcon = ToolsIcon;
9116
9814
  exports.TraceContext = TraceContext;
9117
9815
  exports.TraceIcon = TraceIcon;
@@ -9120,8 +9818,6 @@ exports.TsIcon = TsIcon;
9120
9818
  exports.Txt = Txt;
9121
9819
  exports.TxtCell = TxtCell;
9122
9820
  exports.UnitCell = UnitCell;
9123
- exports.VNextWorkflowGraph = VNextWorkflowGraph;
9124
- exports.VNextWorkflowTrigger = VNextWorkflowTrigger;
9125
9821
  exports.VariablesIcon = VariablesIcon;
9126
9822
  exports.WorkflowCoinIcon = WorkflowCoinIcon;
9127
9823
  exports.WorkflowGraph = WorkflowGraph;
@@ -9131,6 +9827,8 @@ exports.WorkflowRunProvider = WorkflowRunProvider;
9131
9827
  exports.WorkflowTraces = WorkflowTraces;
9132
9828
  exports.WorkflowTrigger = WorkflowTrigger;
9133
9829
  exports.refineTraces = refineTraces;
9830
+ exports.usePlaygroundStore = usePlaygroundStore;
9134
9831
  exports.usePolling = usePolling;
9832
+ exports.useSpeechRecognition = useSpeechRecognition;
9135
9833
  exports.useTraces = useTraces;
9136
9834
  //# sourceMappingURL=index.cjs.js.map