@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.
- package/dist/index.cjs.js +1164 -466
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.d.ts +1 -22
- package/dist/index.es.js +1155 -469
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/assistant-ui/image-with-fallback.d.ts +3 -0
- package/dist/{components → src/components}/assistant-ui/thread.d.ts +3 -1
- package/dist/src/components/assistant-ui/use-has-attachments.d.ts +1 -0
- package/dist/{components → src/components}/ui/data-table.d.ts +2 -1
- package/dist/src/domains/agents/agent/agent-chat.d.ts +3 -0
- package/dist/{domains → src/domains}/agents/agent/context/agent-context.d.ts +4 -3
- package/dist/{domains → src/domains}/traces/types.d.ts +9 -4
- package/dist/src/domains/traces/utils/createSpanTree.d.ts +3 -0
- package/dist/src/domains/workflows/context/legacy-workflow-nested-graph-context.d.ts +13 -0
- package/dist/{domains → src/domains}/workflows/context/workflow-nested-graph-context.d.ts +4 -3
- package/dist/{domains → src/domains}/workflows/context/workflow-run-context.d.ts +4 -4
- package/dist/{domains → src/domains}/workflows/index.d.ts +3 -3
- package/dist/src/domains/workflows/workflow/legacy-workflow-graph-inner.d.ts +5 -0
- package/dist/{domains/workflows/workflow/v-next-workflow-graph.d.ts → src/domains/workflows/workflow/legacy-workflow-graph.d.ts} +1 -1
- package/dist/{domains/workflows/workflow/workflow-nested-graph.d.ts → src/domains/workflows/workflow/legacy-workflow-nested-graph.d.ts} +1 -1
- package/dist/src/domains/workflows/workflow/legacy-workflow-nested-node.d.ts +12 -0
- package/dist/src/domains/workflows/workflow/legacy-workflow-status.d.ts +6 -0
- package/dist/{domains/workflows/workflow/v-next-workflow-trigger.d.ts → src/domains/workflows/workflow/legacy-workflow-trigger.d.ts} +1 -1
- package/dist/{domains → src/domains}/workflows/workflow/utils.d.ts +5 -5
- package/dist/src/domains/workflows/workflow/workflow-card.d.ts +6 -0
- package/dist/{domains → src/domains}/workflows/workflow/workflow-graph-inner.d.ts +2 -2
- package/dist/src/domains/workflows/workflow/workflow-nested-graph.d.ts +6 -0
- package/dist/{domains → src/domains}/workflows/workflow/workflow-nested-node.d.ts +2 -2
- package/dist/src/domains/workflows/workflow/workflow-result.d.ts +5 -0
- package/dist/src/domains/workflows/workflow/workflow-status.d.ts +5 -0
- package/dist/src/ds/components/Entity/Entity.d.ts +10 -0
- package/dist/src/ds/components/Entity/index.d.ts +1 -0
- package/dist/{ds → src/ds}/components/TraceTree/Span.d.ts +3 -1
- package/dist/{ds → src/ds}/components/TraceTree/Time.d.ts +2 -1
- package/dist/{ds → src/ds}/components/TraceTree/Trace.d.ts +2 -1
- package/dist/src/ds/icons/AgentNetworkCoinIcon.d.ts +1 -0
- package/dist/src/ds/icons/FolderIcon.d.ts +3 -0
- package/dist/{ds → src/ds}/icons/Icon.d.ts +1 -1
- package/dist/src/ds/icons/McpCoinIcon.d.ts +3 -0
- package/dist/src/ds/icons/McpServerIcon.d.ts +3 -0
- package/dist/src/ds/icons/ToolCoinIcon.d.ts +3 -0
- package/dist/{ds → src/ds}/icons/index.d.ts +5 -0
- package/dist/{ds → src/ds}/tokens/sizes.d.ts +1 -0
- package/dist/src/hooks/use-speech-recognition.d.ts +15 -0
- package/dist/src/hooks/use-workflows.d.ts +91 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/lib/file.d.ts +1 -0
- package/dist/{services → src/services}/mastra-runtime-provider.d.ts +1 -1
- package/dist/src/store/agent-store.d.ts +20 -0
- package/dist/src/store/playground-store.d.ts +16 -0
- package/dist/{types.d.ts → src/types.d.ts} +3 -4
- package/dist/tokens.cjs.js +1 -0
- package/dist/tokens.cjs.js.map +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/tokens.es.js +1 -0
- package/dist/tokens.es.js.map +1 -1
- package/package.json +6 -5
- package/dist/domains/agents/agent/agent-chat.d.ts +0 -3
- package/dist/domains/workflows/context/v-next-workflow-nested-graph-context.d.ts +0 -14
- package/dist/domains/workflows/workflow/v-next-workflow-graph-inner.d.ts +0 -5
- package/dist/domains/workflows/workflow/v-next-workflow-nested-graph.d.ts +0 -6
- package/dist/domains/workflows/workflow/v-next-workflow-nested-node.d.ts +0 -11
- package/dist/ds/components/TraceTree/Trace.context.d.ts +0 -9
- package/dist/hooks/use-workflows.d.ts +0 -90
- /package/dist/{components → src/components}/assistant-ui/assistant-message.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/assistant-modal.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/attachment.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/markdown-text.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/syntax-highlighter.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/thread-list.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/tool-fallback.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/tooltip-icon-button.d.ts +0 -0
- /package/dist/{components → src/components}/assistant-ui/user-message.d.ts +0 -0
- /package/dist/{components → src/components}/dynamic-form/index.d.ts +0 -0
- /package/dist/{components → src/components}/dynamic-form/utils.d.ts +0 -0
- /package/dist/{components → src/components}/icons/agent-icon.d.ts +0 -0
- /package/dist/{components → src/components}/icons/automation-icon.d.ts +0 -0
- /package/dist/{components → src/components}/syntax-highlighter.d.ts +0 -0
- /package/dist/{components → src/components}/threads.d.ts +0 -0
- /package/dist/{components → src/components}/ui/alert.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/AutoForm.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/ArrayElementWrapper.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/ArrayWrapper.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/BooleanField.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/DateField.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/ErrorMessage.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/FieldWrapper.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/Form.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/NumberField.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/ObjectWrapper.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/RecordField.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/SelectField.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/StringField.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/components/SubmitButton.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/index.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/utils.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/zodProvider/field-type-inference.d.ts +0 -0
- /package/dist/{components → src/components}/ui/autoform/zodProvider/index.d.ts +0 -0
- /package/dist/{components → src/components}/ui/avatar.d.ts +0 -0
- /package/dist/{components → src/components}/ui/badge.d.ts +0 -0
- /package/dist/{components → src/components}/ui/button.d.ts +0 -0
- /package/dist/{components → src/components}/ui/calendar.d.ts +0 -0
- /package/dist/{components → src/components}/ui/card.d.ts +0 -0
- /package/dist/{components → src/components}/ui/checkbox.d.ts +0 -0
- /package/dist/{components → src/components}/ui/code-block.d.ts +0 -0
- /package/dist/{components → src/components}/ui/collapsible.d.ts +0 -0
- /package/dist/{components → src/components}/ui/command.d.ts +0 -0
- /package/dist/{components → src/components}/ui/copy-button.d.ts +0 -0
- /package/dist/{components → src/components}/ui/copyable-content.d.ts +0 -0
- /package/dist/{components → src/components}/ui/date-picker.d.ts +0 -0
- /package/dist/{components → src/components}/ui/dialog.d.ts +0 -0
- /package/dist/{components → src/components}/ui/form.d.ts +0 -0
- /package/dist/{components → src/components}/ui/formatted-date.d.ts +0 -0
- /package/dist/{components → src/components}/ui/input.d.ts +0 -0
- /package/dist/{components → src/components}/ui/label.d.ts +0 -0
- /package/dist/{components → src/components}/ui/markdown-renderer.d.ts +0 -0
- /package/dist/{components → src/components}/ui/popover.d.ts +0 -0
- /package/dist/{components → src/components}/ui/resizable.d.ts +0 -0
- /package/dist/{components → src/components}/ui/score-indicator.d.ts +0 -0
- /package/dist/{components → src/components}/ui/scroll-area.d.ts +0 -0
- /package/dist/{components → src/components}/ui/select.d.ts +0 -0
- /package/dist/{components → src/components}/ui/skeleton.d.ts +0 -0
- /package/dist/{components → src/components}/ui/spinner.d.ts +0 -0
- /package/dist/{components → src/components}/ui/switch.d.ts +0 -0
- /package/dist/{components → src/components}/ui/syntax-highlighter.d.ts +0 -0
- /package/dist/{components → src/components}/ui/table.d.ts +0 -0
- /package/dist/{components → src/components}/ui/tabs.d.ts +0 -0
- /package/dist/{components → src/components}/ui/text.d.ts +0 -0
- /package/dist/{components → src/components}/ui/textarea.d.ts +0 -0
- /package/dist/{components → src/components}/ui/toggle.d.ts +0 -0
- /package/dist/{components → src/components}/ui/tooltip.d.ts +0 -0
- /package/dist/{domains → src/domains}/agents/agent/agent-evals.d.ts +0 -0
- /package/dist/{domains → src/domains}/agents/agent/agent-traces.d.ts +0 -0
- /package/dist/{domains → src/domains}/agents/index.d.ts +0 -0
- /package/dist/{domains → src/domains}/networks/index.d.ts +0 -0
- /package/dist/{domains → src/domains}/networks/network-chat.d.ts +0 -0
- /package/dist/{domains → src/domains}/networks/network-context.d.ts +0 -0
- /package/dist/{domains → src/domains}/networks/tool-fallback.d.ts +0 -0
- /package/dist/{domains → src/domains}/resizable-panel.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/context/trace-context.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/hooks/use-open-trace.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/mock-data.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/trace-details.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/trace-span-details.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/trace-span-view.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/traces-sidebar.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/traces-table.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/utils/getSpanVariant.d.ts +0 -0
- /package/dist/{domains → src/domains}/traces/utils.d.ts +0 -0
- /package/dist/{domains → src/domains}/workflows/workflow/workflow-after-node.d.ts +0 -0
- /package/dist/{domains → src/domains}/workflows/workflow/workflow-condition-node.d.ts +0 -0
- /package/dist/{domains → src/domains}/workflows/workflow/workflow-default-node.d.ts +0 -0
- /package/dist/{domains → src/domains}/workflows/workflow/workflow-graph.d.ts +0 -0
- /package/dist/{domains → src/domains}/workflows/workflow/workflow-loop-result-node.d.ts +0 -0
- /package/dist/{domains → src/domains}/workflows/workflow/workflow-traces.d.ts +0 -0
- /package/dist/{domains → src/domains}/workflows/workflow/workflow-trigger.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Avatar/Avatar.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Avatar/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Badge/Badge.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Badge/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Breadcrumb/Breadcrumb.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Breadcrumb/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Button/Button.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Button/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/EmptyState/EmptyState.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/EmptyState/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Header/Header.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Header/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Logo/MastraLogo.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Logo/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Table/Cells.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Table/Table.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Table/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Table/utils.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/TraceTree/Spans.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/TraceTree/TraceTree.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/TraceTree/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Txt/Txt.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/Txt/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/components/types.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/AgentCoinIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/AgentIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/AiIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/ApiIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/BranchIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/CheckIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/ChevronIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/CommitIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/CrossIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/DbIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/DebugIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/DeploymentIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/DividerIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/DocsIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/EnvIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/EvaluatorCoinIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/FiltersIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/GithubCoinIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/GithubIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/GoogleIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/HomeIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/InfoIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/JudgeIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/LatencyIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/LogsIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/MemoryIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/OpenAIIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/PromptIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/RepoIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/ScoreIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/SettingsIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/SlashIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/ToolsIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/TraceIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/TsIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/VariablesIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/WorkflowCoinIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/icons/WorkflowIcon.d.ts +0 -0
- /package/dist/{ds → src/ds}/tokens/borders.d.ts +0 -0
- /package/dist/{ds → src/ds}/tokens/colors.d.ts +0 -0
- /package/dist/{ds → src/ds}/tokens/fonts.d.ts +0 -0
- /package/dist/{ds → src/ds}/tokens/index.d.ts +0 -0
- /package/dist/{ds → src/ds}/tokens/spacings.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/use-autoscroll.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/use-copy-to-clipboard.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/use-evals.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/use-resize-column.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/use-traces.d.ts +0 -0
- /package/dist/{lib → src/lib}/mastra-client.d.ts +0 -0
- /package/dist/{lib → src/lib}/number.d.ts +0 -0
- /package/dist/{lib → src/lib}/object.d.ts +0 -0
- /package/dist/{lib → src/lib}/pagination/types.d.ts +0 -0
- /package/dist/{lib → src/lib}/polls.d.ts +0 -0
- /package/dist/{lib → src/lib}/string.d.ts +0 -0
- /package/dist/{lib → src/lib}/utils.d.ts +0 -0
- /package/dist/{main.d.ts → src/main.d.ts} +0 -0
- /package/dist/{services → src/services}/network-runtime-provider.d.ts +0 -0
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useMessage, MessagePrimitive, ActionBarPrimitive,
|
|
3
|
-
import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc,
|
|
2
|
+
import { useMessage, MessagePrimitive, ActionBarPrimitive, useComposerRuntime, ComposerPrimitive, useAttachment, AttachmentPrimitive, ThreadPrimitive, useExternalStoreRuntime, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
3
|
+
import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, X, FileIcon, CircleXIcon, Mic, PlusIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, Check, ChevronUp, ChevronDown, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Braces, Brackets, TrashIcon, Plus, Loader2, CirclePause } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default, { forwardRef,
|
|
5
|
+
import React__default, { forwardRef, useState, useEffect, memo, useMemo, useRef, createContext, useContext, useCallback, Suspense, Fragment as Fragment$1 } from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
8
|
+
import { TooltipProvider as TooltipProvider$1 } from '@radix-ui/react-tooltip';
|
|
8
9
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
9
10
|
import { unstable_memoizeMarkdownComponents, useIsMarkdownCodeBlock, MarkdownTextPrimitive } from '@assistant-ui/react-markdown';
|
|
10
11
|
import '@assistant-ui/react-markdown/styles/dot.css';
|
|
@@ -15,7 +16,12 @@ import { jsonLanguage } from '@codemirror/lang-json';
|
|
|
15
16
|
import { tags } from '@lezer/highlight';
|
|
16
17
|
import { draculaInit } from '@uiw/codemirror-theme-dracula';
|
|
17
18
|
import CodeMirror from '@uiw/react-codemirror';
|
|
19
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
20
|
+
import { useShallow } from 'zustand/shallow';
|
|
21
|
+
import { RuntimeContext } from '@mastra/core/di';
|
|
18
22
|
import { MastraClient } from '@mastra/client-js';
|
|
23
|
+
import { create } from 'zustand';
|
|
24
|
+
import { persist } from 'zustand/middleware';
|
|
19
25
|
import { format, formatDistanceToNow, isValid } from 'date-fns';
|
|
20
26
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
21
27
|
import { toast } from 'sonner';
|
|
@@ -23,24 +29,24 @@ import { AnimatePresence } from 'motion/react';
|
|
|
23
29
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
24
30
|
import Markdown from 'react-markdown';
|
|
25
31
|
import { useDebouncedCallback } from 'use-debounce';
|
|
32
|
+
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/runtime-context';
|
|
26
33
|
import { MarkerType, Handle, Position, useNodesState, useEdgesState, ReactFlow, Controls, MiniMap, Background, BackgroundVariant, ReactFlowProvider } from '@xyflow/react';
|
|
27
34
|
import '@xyflow/react/dist/style.css';
|
|
28
35
|
import Dagre from '@dagrejs/dagre';
|
|
29
36
|
import { Highlight, themes } from 'prism-react-renderer';
|
|
30
37
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
31
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
32
38
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
33
39
|
import jsonSchemaToZod from 'json-schema-to-zod';
|
|
34
40
|
import { parse } from 'superjson';
|
|
35
41
|
import z$1, { z, ZodObject } from 'zod';
|
|
36
42
|
import { AutoForm as AutoForm$1, buildZodFieldConfig } from '@autoform/react';
|
|
37
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
38
43
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
39
44
|
import { DayPicker } from 'react-day-picker';
|
|
40
45
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
41
46
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
42
47
|
import { v4 } from '@lukeed/uuid';
|
|
43
48
|
import { ZodProvider, getFieldConfigInZodStack, getDefaultValueInZodStack } from '@autoform/zod';
|
|
49
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
44
50
|
import { CodeBlock as CodeBlock$1 } from 'react-code-block';
|
|
45
51
|
import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
46
52
|
|
|
@@ -2886,6 +2892,46 @@ const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
2886
2892
|
));
|
|
2887
2893
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
2888
2894
|
|
|
2895
|
+
const ImageWithFallback = ({ alt, src, ...rest }) => {
|
|
2896
|
+
const [error, setError] = useState(false);
|
|
2897
|
+
useEffect(() => {
|
|
2898
|
+
setError(false);
|
|
2899
|
+
}, [src]);
|
|
2900
|
+
return error || !src ? /* @__PURE__ */ jsxs("div", { children: [
|
|
2901
|
+
/* @__PURE__ */ jsx(
|
|
2902
|
+
"svg",
|
|
2903
|
+
{
|
|
2904
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2905
|
+
fill: "none",
|
|
2906
|
+
viewBox: "0 0 24 24",
|
|
2907
|
+
strokeWidth: "1.5",
|
|
2908
|
+
stroke: "currentColor",
|
|
2909
|
+
width: "150",
|
|
2910
|
+
height: "150",
|
|
2911
|
+
children: /* @__PURE__ */ jsx(
|
|
2912
|
+
"path",
|
|
2913
|
+
{
|
|
2914
|
+
strokeLinecap: "round",
|
|
2915
|
+
strokeLinejoin: "round",
|
|
2916
|
+
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"
|
|
2917
|
+
}
|
|
2918
|
+
)
|
|
2919
|
+
}
|
|
2920
|
+
),
|
|
2921
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs italic text-muted-foreground -mt-[0.625rem] mb-[0.625rem]", children: "Image link is broken" })
|
|
2922
|
+
] }) : /* @__PURE__ */ jsx(
|
|
2923
|
+
"img",
|
|
2924
|
+
{
|
|
2925
|
+
src,
|
|
2926
|
+
alt,
|
|
2927
|
+
...rest,
|
|
2928
|
+
onError: () => {
|
|
2929
|
+
setError(true);
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
);
|
|
2933
|
+
};
|
|
2934
|
+
|
|
2889
2935
|
const SyntaxHighlighter$2 = makePrismAsyncSyntaxHighlighter({
|
|
2890
2936
|
style: coldarkDark,
|
|
2891
2937
|
customStyle: {
|
|
@@ -3105,10 +3151,12 @@ const defaultComponents = unstable_memoizeMarkdownComponents({
|
|
|
3105
3151
|
);
|
|
3106
3152
|
},
|
|
3107
3153
|
CodeHeader,
|
|
3108
|
-
SyntaxHighlighter: SyntaxHighlighter$2
|
|
3154
|
+
SyntaxHighlighter: SyntaxHighlighter$2,
|
|
3155
|
+
img: ImageWithFallback
|
|
3109
3156
|
});
|
|
3110
3157
|
|
|
3111
3158
|
const sizes = {
|
|
3159
|
+
sm: "[&>svg]:h-icon-sm [&>svg]:w-icon-sm",
|
|
3112
3160
|
default: "[&>svg]:h-icon-default [&>svg]:w-icon-default",
|
|
3113
3161
|
lg: "[&>svg]:h-icon-lg [&>svg]:w-icon-lg"
|
|
3114
3162
|
};
|
|
@@ -3487,10 +3535,10 @@ const GithubIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "15", height:
|
|
|
3487
3535
|
"path",
|
|
3488
3536
|
{
|
|
3489
3537
|
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",
|
|
3490
|
-
fill: "
|
|
3538
|
+
fill: "currentColor"
|
|
3491
3539
|
}
|
|
3492
3540
|
) }),
|
|
3493
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsx("rect", { width: "14", height: "14", fill: "
|
|
3541
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsx("rect", { width: "14", height: "14", fill: "currentColor", transform: "translate(0.5 0.75)" }) }) })
|
|
3494
3542
|
] });
|
|
3495
3543
|
|
|
3496
3544
|
const GoogleIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
@@ -3719,7 +3767,7 @@ const WorkflowIcon = (props) => /* @__PURE__ */ jsx("svg", { width: "17", height
|
|
|
3719
3767
|
fillRule: "evenodd",
|
|
3720
3768
|
clipRule: "evenodd",
|
|
3721
3769
|
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",
|
|
3722
|
-
fill: "
|
|
3770
|
+
fill: "currentColor"
|
|
3723
3771
|
}
|
|
3724
3772
|
) });
|
|
3725
3773
|
|
|
@@ -3781,6 +3829,149 @@ const LatencyIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "12", height
|
|
|
3781
3829
|
)
|
|
3782
3830
|
] });
|
|
3783
3831
|
|
|
3832
|
+
const McpServerIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3833
|
+
/* @__PURE__ */ jsx(
|
|
3834
|
+
"path",
|
|
3835
|
+
{
|
|
3836
|
+
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",
|
|
3837
|
+
fill: "currentColor"
|
|
3838
|
+
}
|
|
3839
|
+
),
|
|
3840
|
+
/* @__PURE__ */ jsx(
|
|
3841
|
+
"path",
|
|
3842
|
+
{
|
|
3843
|
+
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",
|
|
3844
|
+
fill: "currentColor"
|
|
3845
|
+
}
|
|
3846
|
+
)
|
|
3847
|
+
] });
|
|
3848
|
+
|
|
3849
|
+
const FolderIcon = (props) => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx(
|
|
3850
|
+
"path",
|
|
3851
|
+
{
|
|
3852
|
+
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",
|
|
3853
|
+
stroke: "currentColor",
|
|
3854
|
+
strokeLinecap: "round",
|
|
3855
|
+
strokeLinejoin: "round"
|
|
3856
|
+
}
|
|
3857
|
+
) });
|
|
3858
|
+
|
|
3859
|
+
const McpCoinIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3860
|
+
/* @__PURE__ */ jsx(
|
|
3861
|
+
"path",
|
|
3862
|
+
{
|
|
3863
|
+
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",
|
|
3864
|
+
fill: "#2E2E2E",
|
|
3865
|
+
fillOpacity: "0.9"
|
|
3866
|
+
}
|
|
3867
|
+
),
|
|
3868
|
+
/* @__PURE__ */ jsx(
|
|
3869
|
+
"path",
|
|
3870
|
+
{
|
|
3871
|
+
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",
|
|
3872
|
+
stroke: "#424242"
|
|
3873
|
+
}
|
|
3874
|
+
),
|
|
3875
|
+
/* @__PURE__ */ jsx(
|
|
3876
|
+
"path",
|
|
3877
|
+
{
|
|
3878
|
+
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",
|
|
3879
|
+
stroke: "#707070"
|
|
3880
|
+
}
|
|
3881
|
+
),
|
|
3882
|
+
/* @__PURE__ */ jsx(
|
|
3883
|
+
"path",
|
|
3884
|
+
{
|
|
3885
|
+
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",
|
|
3886
|
+
fill: "#A9A9A9"
|
|
3887
|
+
}
|
|
3888
|
+
),
|
|
3889
|
+
/* @__PURE__ */ jsx(
|
|
3890
|
+
"path",
|
|
3891
|
+
{
|
|
3892
|
+
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",
|
|
3893
|
+
fill: "#A9A9A9"
|
|
3894
|
+
}
|
|
3895
|
+
)
|
|
3896
|
+
] });
|
|
3897
|
+
|
|
3898
|
+
const ToolCoinIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3899
|
+
/* @__PURE__ */ 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.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",
|
|
3903
|
+
fill: "#2E2E2E",
|
|
3904
|
+
fillOpacity: "0.9"
|
|
3905
|
+
}
|
|
3906
|
+
),
|
|
3907
|
+
/* @__PURE__ */ jsx(
|
|
3908
|
+
"path",
|
|
3909
|
+
{
|
|
3910
|
+
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",
|
|
3911
|
+
stroke: "#424242"
|
|
3912
|
+
}
|
|
3913
|
+
),
|
|
3914
|
+
/* @__PURE__ */ jsx(
|
|
3915
|
+
"path",
|
|
3916
|
+
{
|
|
3917
|
+
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",
|
|
3918
|
+
stroke: "#707070"
|
|
3919
|
+
}
|
|
3920
|
+
),
|
|
3921
|
+
/* @__PURE__ */ jsx(
|
|
3922
|
+
"path",
|
|
3923
|
+
{
|
|
3924
|
+
fillRule: "evenodd",
|
|
3925
|
+
clipRule: "evenodd",
|
|
3926
|
+
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",
|
|
3927
|
+
fill: "#A9A9A9"
|
|
3928
|
+
}
|
|
3929
|
+
)
|
|
3930
|
+
] });
|
|
3931
|
+
|
|
3932
|
+
const AgentNetworkCoinIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3933
|
+
/* @__PURE__ */ jsx(
|
|
3934
|
+
"path",
|
|
3935
|
+
{
|
|
3936
|
+
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",
|
|
3937
|
+
fill: "#2E2E2E",
|
|
3938
|
+
fillOpacity: "0.9"
|
|
3939
|
+
}
|
|
3940
|
+
),
|
|
3941
|
+
/* @__PURE__ */ jsx(
|
|
3942
|
+
"path",
|
|
3943
|
+
{
|
|
3944
|
+
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",
|
|
3945
|
+
stroke: "#424242"
|
|
3946
|
+
}
|
|
3947
|
+
),
|
|
3948
|
+
/* @__PURE__ */ jsx(
|
|
3949
|
+
"path",
|
|
3950
|
+
{
|
|
3951
|
+
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",
|
|
3952
|
+
stroke: "#707070"
|
|
3953
|
+
}
|
|
3954
|
+
),
|
|
3955
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_23333_14744)", children: /* @__PURE__ */ jsx(
|
|
3956
|
+
"path",
|
|
3957
|
+
{
|
|
3958
|
+
fillRule: "evenodd",
|
|
3959
|
+
clipRule: "evenodd",
|
|
3960
|
+
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",
|
|
3961
|
+
fill: "#A9A9A9"
|
|
3962
|
+
}
|
|
3963
|
+
) }),
|
|
3964
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_23333_14744", children: /* @__PURE__ */ jsx(
|
|
3965
|
+
"rect",
|
|
3966
|
+
{
|
|
3967
|
+
width: "59.3185",
|
|
3968
|
+
height: "59.3185",
|
|
3969
|
+
fill: "white",
|
|
3970
|
+
transform: "matrix(0.897148 0.441731 -0.897148 0.441731 65.3042 6.51953)"
|
|
3971
|
+
}
|
|
3972
|
+
) }) })
|
|
3973
|
+
] });
|
|
3974
|
+
|
|
3784
3975
|
const useCodemirrorTheme$1 = () => {
|
|
3785
3976
|
return useMemo(
|
|
3786
3977
|
() => draculaInit({
|
|
@@ -3852,7 +4043,10 @@ const AssistantMessage = ({
|
|
|
3852
4043
|
/* @__PURE__ */ jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsx(
|
|
3853
4044
|
MessagePrimitive.Content,
|
|
3854
4045
|
{
|
|
3855
|
-
components: {
|
|
4046
|
+
components: {
|
|
4047
|
+
Text: MarkdownText,
|
|
4048
|
+
tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
|
|
4049
|
+
}
|
|
3856
4050
|
}
|
|
3857
4051
|
) }),
|
|
3858
4052
|
/* @__PURE__ */ jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsx(AssistantActionBar, {}) })
|
|
@@ -3874,8 +4068,156 @@ const AssistantActionBar = () => {
|
|
|
3874
4068
|
);
|
|
3875
4069
|
};
|
|
3876
4070
|
|
|
4071
|
+
const Dialog = DialogPrimitive.Root;
|
|
4072
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
4073
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
4074
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4075
|
+
DialogPrimitive.Overlay,
|
|
4076
|
+
{
|
|
4077
|
+
ref,
|
|
4078
|
+
className: cn(
|
|
4079
|
+
"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",
|
|
4080
|
+
className
|
|
4081
|
+
),
|
|
4082
|
+
...props
|
|
4083
|
+
}
|
|
4084
|
+
));
|
|
4085
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
4086
|
+
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
4087
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
4088
|
+
/* @__PURE__ */ jsxs(
|
|
4089
|
+
DialogPrimitive.Content,
|
|
4090
|
+
{
|
|
4091
|
+
ref,
|
|
4092
|
+
className: cn(
|
|
4093
|
+
"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",
|
|
4094
|
+
className
|
|
4095
|
+
),
|
|
4096
|
+
...props,
|
|
4097
|
+
children: [
|
|
4098
|
+
children,
|
|
4099
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.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: [
|
|
4100
|
+
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
4101
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
4102
|
+
] })
|
|
4103
|
+
]
|
|
4104
|
+
}
|
|
4105
|
+
)
|
|
4106
|
+
] }));
|
|
4107
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
4108
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4109
|
+
DialogPrimitive.Title,
|
|
4110
|
+
{
|
|
4111
|
+
ref,
|
|
4112
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
4113
|
+
...props
|
|
4114
|
+
}
|
|
4115
|
+
));
|
|
4116
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
4117
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
4118
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
4119
|
+
|
|
4120
|
+
const useHasAttachments = () => {
|
|
4121
|
+
const composer = useComposerRuntime();
|
|
4122
|
+
const [hasAttachments, setHasAttachments] = useState(false);
|
|
4123
|
+
useEffect(() => {
|
|
4124
|
+
composer.subscribe(() => {
|
|
4125
|
+
const attachments = composer.getState().attachments;
|
|
4126
|
+
setHasAttachments(attachments.length > 0);
|
|
4127
|
+
});
|
|
4128
|
+
}, [composer]);
|
|
4129
|
+
return hasAttachments;
|
|
4130
|
+
};
|
|
4131
|
+
|
|
4132
|
+
const useFileSrc = (file) => {
|
|
4133
|
+
const [src, setSrc] = useState(void 0);
|
|
4134
|
+
useEffect(() => {
|
|
4135
|
+
if (!file) {
|
|
4136
|
+
setSrc(void 0);
|
|
4137
|
+
return;
|
|
4138
|
+
}
|
|
4139
|
+
const objectUrl = URL.createObjectURL(file);
|
|
4140
|
+
setSrc(objectUrl);
|
|
4141
|
+
return () => {
|
|
4142
|
+
URL.revokeObjectURL(objectUrl);
|
|
4143
|
+
};
|
|
4144
|
+
}, [file]);
|
|
4145
|
+
return src;
|
|
4146
|
+
};
|
|
4147
|
+
const useAttachmentSrc = () => {
|
|
4148
|
+
const { file, src } = useAttachment(
|
|
4149
|
+
useShallow((a) => {
|
|
4150
|
+
if (a.type !== "image") return {};
|
|
4151
|
+
if (a.file) return { file: a.file };
|
|
4152
|
+
const src2 = a.content?.filter((c) => c.type === "image")[0]?.image;
|
|
4153
|
+
if (!src2) return {};
|
|
4154
|
+
return { src: src2 };
|
|
4155
|
+
})
|
|
4156
|
+
);
|
|
4157
|
+
return useFileSrc(file) ?? src;
|
|
4158
|
+
};
|
|
4159
|
+
const AttachmentPreview = ({ src }) => {
|
|
4160
|
+
return /* @__PURE__ */ jsx("div", { className: "overflow-hidden w-full", children: /* @__PURE__ */ jsx("img", { src, className: "object-contain aspect-ratio h-full w-full", alt: "Preview" }) });
|
|
4161
|
+
};
|
|
4162
|
+
const AttachmentPreviewDialog = ({ children }) => {
|
|
4163
|
+
const src = useAttachmentSrc();
|
|
4164
|
+
if (!src) return children;
|
|
4165
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [
|
|
4166
|
+
/* @__PURE__ */ jsx(DialogTrigger, { className: "hover:bg-accent/50 cursor-pointer transition-colors", asChild: true, children }),
|
|
4167
|
+
/* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
4168
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
4169
|
+
/* @__PURE__ */ jsxs(DialogContent, { className: "max-w-5xl w-full max-h-[80%]", children: [
|
|
4170
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "aui-sr-only", children: "Image Attachment Preview" }),
|
|
4171
|
+
/* @__PURE__ */ jsx(AttachmentPreview, { src })
|
|
4172
|
+
] })
|
|
4173
|
+
] })
|
|
4174
|
+
] });
|
|
4175
|
+
};
|
|
4176
|
+
const AttachmentThumbnail = () => {
|
|
4177
|
+
const isImage = useAttachment((a) => a.type === "image");
|
|
4178
|
+
const src = useAttachmentSrc();
|
|
4179
|
+
const canRemove = useAttachment((a) => a.source !== "message");
|
|
4180
|
+
return /* @__PURE__ */ jsx(TooltipProvider$1, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4181
|
+
/* @__PURE__ */ jsxs(AttachmentPrimitive.Root, { className: "relative", children: [
|
|
4182
|
+
/* @__PURE__ */ jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsx("img", { src, className: "object-cover aspect-ratio size-16", alt: "Preview", height: 64, width: 64 }) }) : /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsx(FileIcon, { className: "text-icon3" }) }) }) }) }),
|
|
4183
|
+
canRemove && /* @__PURE__ */ jsx(AttachmentRemove, {})
|
|
4184
|
+
] }),
|
|
4185
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsx(AttachmentPrimitive.Name, {}) })
|
|
4186
|
+
] }) });
|
|
4187
|
+
};
|
|
4188
|
+
const AttachmentRemove = () => {
|
|
4189
|
+
return /* @__PURE__ */ jsx(AttachmentPrimitive.Remove, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4190
|
+
TooltipIconButton,
|
|
4191
|
+
{
|
|
4192
|
+
tooltip: "Remove file",
|
|
4193
|
+
className: "absolute -right-3 -top-3 hover:bg-transparent rounded-full bg-surface1 rounded-full p-1",
|
|
4194
|
+
side: "top",
|
|
4195
|
+
children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CircleXIcon, {}) })
|
|
4196
|
+
}
|
|
4197
|
+
) });
|
|
4198
|
+
};
|
|
4199
|
+
const UserMessageAttachments = () => {
|
|
4200
|
+
return /* @__PURE__ */ jsx(MessagePrimitive.Attachments, { components: { Attachment: InMessageAttachment } });
|
|
4201
|
+
};
|
|
4202
|
+
const InMessageAttachment = () => {
|
|
4203
|
+
const isImage = useAttachment((a) => a.type === "image");
|
|
4204
|
+
const src = useAttachmentSrc();
|
|
4205
|
+
return /* @__PURE__ */ jsx(TooltipProvider$1, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4206
|
+
/* @__PURE__ */ jsx(AttachmentPrimitive.Root, { className: "relative pt-4", children: /* @__PURE__ */ jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsx("img", { src, className: "object-cover aspect-ratio max-h-[140px] max-w-[320px]", alt: "Preview" }) }) : /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsx(FileIcon, { className: "text-icon3" }) }) }) }) }) }),
|
|
4207
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsx(AttachmentPrimitive.Name, {}) })
|
|
4208
|
+
] }) });
|
|
4209
|
+
};
|
|
4210
|
+
const ComposerAttachments = () => {
|
|
4211
|
+
const hasAttachments = useHasAttachments();
|
|
4212
|
+
if (!hasAttachments) return null;
|
|
4213
|
+
return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-row items-center gap-4 h-24", children: /* @__PURE__ */ jsx(ComposerPrimitive.Attachments, { components: { Attachment: AttachmentThumbnail } }) });
|
|
4214
|
+
};
|
|
4215
|
+
|
|
3877
4216
|
const UserMessage = () => {
|
|
3878
|
-
return /* @__PURE__ */
|
|
4217
|
+
return /* @__PURE__ */ jsxs(MessagePrimitive.Root, { className: "w-full flex items-end pb-4 flex-col", children: [
|
|
4218
|
+
/* @__PURE__ */ jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsx(MessagePrimitive.Content, {}) }),
|
|
4219
|
+
/* @__PURE__ */ jsx(UserMessageAttachments, {})
|
|
4220
|
+
] });
|
|
3879
4221
|
};
|
|
3880
4222
|
|
|
3881
4223
|
const useAutoscroll = (ref, { enabled = true }) => {
|
|
@@ -3916,13 +4258,77 @@ const useAutoscroll = (ref, { enabled = true }) => {
|
|
|
3916
4258
|
}, [enabled, ref]);
|
|
3917
4259
|
};
|
|
3918
4260
|
|
|
3919
|
-
const
|
|
4261
|
+
const variants = {
|
|
4262
|
+
"header-md": "text-header-md leading-header-md",
|
|
4263
|
+
"ui-lg": "text-ui-lg leading-ui-lg",
|
|
4264
|
+
"ui-md": "text-ui-md leading-ui-md",
|
|
4265
|
+
"ui-sm": "text-ui-sm leading-ui-sm",
|
|
4266
|
+
"ui-xs": "text-ui-xs leading-ui-xs"
|
|
4267
|
+
};
|
|
4268
|
+
const fonts = {
|
|
4269
|
+
mono: "font-mono"
|
|
4270
|
+
};
|
|
4271
|
+
const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
|
|
4272
|
+
return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
4273
|
+
};
|
|
4274
|
+
|
|
4275
|
+
const useSpeechRecognition = ({ language = "en-US" } = {}) => {
|
|
4276
|
+
const speechRecognitionRef = useRef(null);
|
|
4277
|
+
const [state, setState] = useState({
|
|
4278
|
+
isListening: false,
|
|
4279
|
+
transcript: "",
|
|
4280
|
+
error: null
|
|
4281
|
+
});
|
|
4282
|
+
const start = () => {
|
|
4283
|
+
if (!speechRecognitionRef.current) return;
|
|
4284
|
+
speechRecognitionRef.current.start();
|
|
4285
|
+
};
|
|
4286
|
+
const stop = () => {
|
|
4287
|
+
if (!speechRecognitionRef.current) return;
|
|
4288
|
+
speechRecognitionRef.current.stop();
|
|
4289
|
+
};
|
|
4290
|
+
useEffect(() => {
|
|
4291
|
+
if (!("webkitSpeechRecognition" in window) && !("SpeechRecognition" in window)) {
|
|
4292
|
+
setState((prev) => ({ ...prev, error: "Speech Recognition not supported in this browser" }));
|
|
4293
|
+
return;
|
|
4294
|
+
}
|
|
4295
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
4296
|
+
const recognition = new SpeechRecognition();
|
|
4297
|
+
speechRecognitionRef.current = recognition;
|
|
4298
|
+
recognition.continuous = true;
|
|
4299
|
+
recognition.lang = language;
|
|
4300
|
+
recognition.onstart = () => {
|
|
4301
|
+
setState((prev) => ({ ...prev, isListening: true }));
|
|
4302
|
+
};
|
|
4303
|
+
recognition.onresult = (event) => {
|
|
4304
|
+
let finalTranscript = "";
|
|
4305
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
4306
|
+
const transcript = event.results[i][0].transcript;
|
|
4307
|
+
if (event.results[i].isFinal) {
|
|
4308
|
+
finalTranscript += transcript + " ";
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
setState((prev) => ({ ...prev, transcript: finalTranscript }));
|
|
4312
|
+
};
|
|
4313
|
+
recognition.onerror = (event) => {
|
|
4314
|
+
setState((prev) => ({ ...prev, error: `Error: ${event.error}` }));
|
|
4315
|
+
};
|
|
4316
|
+
recognition.onend = () => setState((prev) => ({ ...prev, isListening: false }));
|
|
4317
|
+
}, [language]);
|
|
4318
|
+
return {
|
|
4319
|
+
...state,
|
|
4320
|
+
start,
|
|
4321
|
+
stop
|
|
4322
|
+
};
|
|
4323
|
+
};
|
|
4324
|
+
|
|
4325
|
+
const Thread = ({ ToolFallback, agentName, hasMemory, showFileSupport }) => {
|
|
3920
4326
|
const areaRef = useRef(null);
|
|
3921
4327
|
useAutoscroll(areaRef, { enabled: true });
|
|
3922
4328
|
const WrappedAssistantMessage = (props) => {
|
|
3923
4329
|
return /* @__PURE__ */ jsx(AssistantMessage, { ...props, ToolFallback });
|
|
3924
4330
|
};
|
|
3925
|
-
return /* @__PURE__ */ jsxs(
|
|
4331
|
+
return /* @__PURE__ */ jsxs(ThreadWrapper, { children: [
|
|
3926
4332
|
/* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
3927
4333
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
3928
4334
|
/* @__PURE__ */ jsx(ThreadWelcome, { agentName }),
|
|
@@ -3939,9 +4345,22 @@ const Thread = ({ ToolFallback, agentName }) => {
|
|
|
3939
4345
|
] }),
|
|
3940
4346
|
/* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
|
|
3941
4347
|
] }),
|
|
3942
|
-
/* @__PURE__ */ jsx(Composer, {})
|
|
4348
|
+
/* @__PURE__ */ jsx(Composer, { hasMemory, showFileSupport })
|
|
3943
4349
|
] });
|
|
3944
4350
|
};
|
|
4351
|
+
const ThreadWrapper = ({ children }) => {
|
|
4352
|
+
const hasAttachments = useHasAttachments();
|
|
4353
|
+
return /* @__PURE__ */ jsx(
|
|
4354
|
+
ThreadPrimitive.Root,
|
|
4355
|
+
{
|
|
4356
|
+
className: clsx(
|
|
4357
|
+
"max-w-[568px] w-full mx-auto px-4",
|
|
4358
|
+
hasAttachments ? "h-[calc(100%-208px)]" : "h-[calc(100%-112px)]"
|
|
4359
|
+
),
|
|
4360
|
+
children
|
|
4361
|
+
}
|
|
4362
|
+
);
|
|
4363
|
+
};
|
|
3945
4364
|
const ThreadWelcome = ({ agentName }) => {
|
|
3946
4365
|
const safeAgentName = agentName ?? "";
|
|
3947
4366
|
const words = safeAgentName.split(" ") ?? [];
|
|
@@ -3958,23 +4377,55 @@ const ThreadWelcome = ({ agentName }) => {
|
|
|
3958
4377
|
/* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
3959
4378
|
] }) });
|
|
3960
4379
|
};
|
|
3961
|
-
const Composer = () => {
|
|
3962
|
-
return /* @__PURE__ */ jsxs(
|
|
3963
|
-
/* @__PURE__ */
|
|
3964
|
-
|
|
3965
|
-
{
|
|
3966
|
-
className: "
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
}
|
|
3976
|
-
|
|
3977
|
-
|
|
4380
|
+
const Composer = ({ hasMemory, showFileSupport }) => {
|
|
4381
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4382
|
+
/* @__PURE__ */ jsxs(ComposerPrimitive.Root, { children: [
|
|
4383
|
+
/* @__PURE__ */ jsx(ComposerAttachments, {}),
|
|
4384
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
|
|
4385
|
+
/* @__PURE__ */ jsx(ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(
|
|
4386
|
+
"textarea",
|
|
4387
|
+
{
|
|
4388
|
+
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
|
|
4389
|
+
autoFocus: true,
|
|
4390
|
+
placeholder: "Enter your message...",
|
|
4391
|
+
name: "",
|
|
4392
|
+
id: ""
|
|
4393
|
+
}
|
|
4394
|
+
) }),
|
|
4395
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
4396
|
+
/* @__PURE__ */ jsx(SpeechInput, {}),
|
|
4397
|
+
/* @__PURE__ */ jsx(ComposerAction, { showFileSupport })
|
|
4398
|
+
] })
|
|
4399
|
+
] })
|
|
4400
|
+
] }),
|
|
4401
|
+
!hasMemory && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
|
|
4402
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(InfoIcon, {}) }),
|
|
4403
|
+
"Memory is not enabled. The conversation will not be persisted."
|
|
4404
|
+
] })
|
|
4405
|
+
] });
|
|
4406
|
+
};
|
|
4407
|
+
const SpeechInput = () => {
|
|
4408
|
+
const composerRuntime = useComposerRuntime();
|
|
4409
|
+
const { start, stop, isListening, transcript } = useSpeechRecognition();
|
|
4410
|
+
useEffect(() => {
|
|
4411
|
+
if (!transcript) return;
|
|
4412
|
+
composerRuntime.setText(transcript);
|
|
4413
|
+
}, [composerRuntime, transcript]);
|
|
4414
|
+
return /* @__PURE__ */ jsx(
|
|
4415
|
+
TooltipIconButton,
|
|
4416
|
+
{
|
|
4417
|
+
type: "button",
|
|
4418
|
+
tooltip: isListening ? "Stop dictation" : "Start dictation",
|
|
4419
|
+
variant: "ghost",
|
|
4420
|
+
className: "rounded-full",
|
|
4421
|
+
onClick: () => isListening ? stop() : start(),
|
|
4422
|
+
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsx(Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
4423
|
+
}
|
|
4424
|
+
);
|
|
4425
|
+
};
|
|
4426
|
+
const ComposerAction = ({ showFileSupport }) => {
|
|
4427
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4428
|
+
showFileSupport && /* @__PURE__ */ jsx(ComposerPrimitive.AddAttachment, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Add attachment", variant: "ghost", className: "rounded-full", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" }) }) }),
|
|
3978
4429
|
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsx(ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3979
4430
|
TooltipIconButton,
|
|
3980
4431
|
{
|
|
@@ -4008,9 +4459,40 @@ const createMastraClient = (baseUrl) => {
|
|
|
4008
4459
|
});
|
|
4009
4460
|
};
|
|
4010
4461
|
|
|
4462
|
+
const fileToBase64 = async (file) => {
|
|
4463
|
+
return new Promise((resolve, reject) => {
|
|
4464
|
+
const reader = new FileReader();
|
|
4465
|
+
reader.onload = () => {
|
|
4466
|
+
const result = reader.result;
|
|
4467
|
+
if (typeof result === "string") {
|
|
4468
|
+
resolve(result);
|
|
4469
|
+
} else {
|
|
4470
|
+
reject(new Error("Failed to convert file to base64."));
|
|
4471
|
+
}
|
|
4472
|
+
};
|
|
4473
|
+
reader.onerror = (error) => {
|
|
4474
|
+
reject(error);
|
|
4475
|
+
};
|
|
4476
|
+
reader.readAsDataURL(file);
|
|
4477
|
+
});
|
|
4478
|
+
};
|
|
4479
|
+
|
|
4011
4480
|
const convertMessage$1 = (message) => {
|
|
4012
4481
|
return message;
|
|
4013
4482
|
};
|
|
4483
|
+
const convertToAIAttachments = async (attachments) => {
|
|
4484
|
+
const promises = attachments.filter((attachment) => attachment.file).map(async (attachment) => ({
|
|
4485
|
+
role: "user",
|
|
4486
|
+
content: [
|
|
4487
|
+
{
|
|
4488
|
+
type: "image",
|
|
4489
|
+
image: await fileToBase64(attachment.file),
|
|
4490
|
+
mimeType: attachment.file.type
|
|
4491
|
+
}
|
|
4492
|
+
]
|
|
4493
|
+
}));
|
|
4494
|
+
return Promise.all(promises);
|
|
4495
|
+
};
|
|
4014
4496
|
function MastraRuntimeProvider({
|
|
4015
4497
|
children,
|
|
4016
4498
|
agentId,
|
|
@@ -4021,12 +4503,17 @@ function MastraRuntimeProvider({
|
|
|
4021
4503
|
baseUrl,
|
|
4022
4504
|
refreshThreadList,
|
|
4023
4505
|
modelSettings = {},
|
|
4024
|
-
chatWithGenerate
|
|
4506
|
+
chatWithGenerate,
|
|
4507
|
+
runtimeContext
|
|
4025
4508
|
}) {
|
|
4026
4509
|
const [isRunning, setIsRunning] = useState(false);
|
|
4027
4510
|
const [messages, setMessages] = useState([]);
|
|
4028
4511
|
const [currentThreadId, setCurrentThreadId] = useState(threadId);
|
|
4029
4512
|
const { frequencyPenalty, presencePenalty, maxRetries, maxSteps, maxTokens, temperature, topK, topP, instructions } = modelSettings;
|
|
4513
|
+
const runtimeContextInstance = new RuntimeContext();
|
|
4514
|
+
Object.entries(runtimeContext ?? {}).forEach(([key, value]) => {
|
|
4515
|
+
runtimeContextInstance.set(key, value);
|
|
4516
|
+
});
|
|
4030
4517
|
useEffect(() => {
|
|
4031
4518
|
const hasNewInitialMessages = initialMessages && initialMessages?.length > messages?.length;
|
|
4032
4519
|
if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
|
|
@@ -4035,13 +4522,16 @@ function MastraRuntimeProvider({
|
|
|
4035
4522
|
if (message?.toolInvocations?.length > 0) {
|
|
4036
4523
|
return {
|
|
4037
4524
|
...message,
|
|
4038
|
-
content:
|
|
4039
|
-
type: "
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4525
|
+
content: [
|
|
4526
|
+
...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
|
|
4527
|
+
...message.toolInvocations.map((toolInvocation) => ({
|
|
4528
|
+
type: "tool-call",
|
|
4529
|
+
toolCallId: toolInvocation?.toolCallId,
|
|
4530
|
+
toolName: toolInvocation?.toolName,
|
|
4531
|
+
args: toolInvocation?.args,
|
|
4532
|
+
result: toolInvocation?.result
|
|
4533
|
+
}))
|
|
4534
|
+
]
|
|
4045
4535
|
};
|
|
4046
4536
|
}
|
|
4047
4537
|
return message;
|
|
@@ -4055,8 +4545,12 @@ function MastraRuntimeProvider({
|
|
|
4055
4545
|
const agent = mastra.getAgent(agentId);
|
|
4056
4546
|
const onNew = async (message) => {
|
|
4057
4547
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
4548
|
+
const attachments = await convertToAIAttachments(message.attachments);
|
|
4058
4549
|
const input = message.content[0].text;
|
|
4059
|
-
setMessages((currentConversation) => [
|
|
4550
|
+
setMessages((currentConversation) => [
|
|
4551
|
+
...currentConversation,
|
|
4552
|
+
{ role: "user", content: input, attachments: message.attachments }
|
|
4553
|
+
]);
|
|
4060
4554
|
setIsRunning(true);
|
|
4061
4555
|
try {
|
|
4062
4556
|
if (chatWithGenerate) {
|
|
@@ -4065,7 +4559,8 @@ function MastraRuntimeProvider({
|
|
|
4065
4559
|
{
|
|
4066
4560
|
role: "user",
|
|
4067
4561
|
content: input
|
|
4068
|
-
}
|
|
4562
|
+
},
|
|
4563
|
+
...attachments
|
|
4069
4564
|
],
|
|
4070
4565
|
runId: agentId,
|
|
4071
4566
|
frequencyPenalty,
|
|
@@ -4077,6 +4572,7 @@ function MastraRuntimeProvider({
|
|
|
4077
4572
|
topK,
|
|
4078
4573
|
topP,
|
|
4079
4574
|
instructions,
|
|
4575
|
+
runtimeContext: runtimeContextInstance,
|
|
4080
4576
|
...memory ? { threadId, resourceId: agentId } : {}
|
|
4081
4577
|
});
|
|
4082
4578
|
if (generateResponse.response) {
|
|
@@ -4156,6 +4652,13 @@ function MastraRuntimeProvider({
|
|
|
4156
4652
|
};
|
|
4157
4653
|
if (!assistantMessageAdded) {
|
|
4158
4654
|
assistantMessageAdded = true;
|
|
4655
|
+
if (assistantToolCallAddedForUpdater) {
|
|
4656
|
+
assistantToolCallAddedForUpdater = false;
|
|
4657
|
+
}
|
|
4658
|
+
return [...currentConversation, message2];
|
|
4659
|
+
}
|
|
4660
|
+
if (assistantToolCallAddedForUpdater) {
|
|
4661
|
+
assistantToolCallAddedForUpdater = false;
|
|
4159
4662
|
return [...currentConversation, message2];
|
|
4160
4663
|
}
|
|
4161
4664
|
return [...currentConversation.slice(0, -1), message2];
|
|
@@ -4166,7 +4669,8 @@ function MastraRuntimeProvider({
|
|
|
4166
4669
|
{
|
|
4167
4670
|
role: "user",
|
|
4168
4671
|
content: input
|
|
4169
|
-
}
|
|
4672
|
+
},
|
|
4673
|
+
...attachments
|
|
4170
4674
|
],
|
|
4171
4675
|
runId: agentId,
|
|
4172
4676
|
frequencyPenalty,
|
|
@@ -4178,27 +4682,24 @@ function MastraRuntimeProvider({
|
|
|
4178
4682
|
topK,
|
|
4179
4683
|
topP,
|
|
4180
4684
|
instructions,
|
|
4685
|
+
runtimeContext: runtimeContextInstance,
|
|
4181
4686
|
...memory ? { threadId, resourceId: agentId } : {}
|
|
4182
4687
|
});
|
|
4183
4688
|
if (!response.body) {
|
|
4184
4689
|
throw new Error("No response body");
|
|
4185
4690
|
}
|
|
4186
|
-
const parts = [];
|
|
4187
4691
|
let content = "";
|
|
4188
|
-
let currentTextPart = null;
|
|
4189
4692
|
let assistantMessageAdded = false;
|
|
4693
|
+
let assistantToolCallAddedForUpdater = false;
|
|
4694
|
+
let assistantToolCallAddedForContent = false;
|
|
4190
4695
|
await response.processDataStream({
|
|
4191
4696
|
onTextPart(value) {
|
|
4192
|
-
if (
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
text: value
|
|
4196
|
-
};
|
|
4197
|
-
parts.push(currentTextPart);
|
|
4697
|
+
if (assistantToolCallAddedForContent) {
|
|
4698
|
+
assistantToolCallAddedForContent = false;
|
|
4699
|
+
content = value;
|
|
4198
4700
|
} else {
|
|
4199
|
-
|
|
4701
|
+
content += value;
|
|
4200
4702
|
}
|
|
4201
|
-
content += value;
|
|
4202
4703
|
updater();
|
|
4203
4704
|
},
|
|
4204
4705
|
async onToolCallPart(value) {
|
|
@@ -4225,6 +4726,8 @@ function MastraRuntimeProvider({
|
|
|
4225
4726
|
}
|
|
4226
4727
|
]
|
|
4227
4728
|
};
|
|
4729
|
+
assistantToolCallAddedForUpdater = true;
|
|
4730
|
+
assistantToolCallAddedForContent = true;
|
|
4228
4731
|
return [...currentConversation.slice(0, -1), updatedMessage];
|
|
4229
4732
|
}
|
|
4230
4733
|
const newMessage = {
|
|
@@ -4239,6 +4742,8 @@ function MastraRuntimeProvider({
|
|
|
4239
4742
|
}
|
|
4240
4743
|
]
|
|
4241
4744
|
};
|
|
4745
|
+
assistantToolCallAddedForUpdater = true;
|
|
4746
|
+
assistantToolCallAddedForContent = true;
|
|
4242
4747
|
return [...currentConversation, newMessage];
|
|
4243
4748
|
});
|
|
4244
4749
|
},
|
|
@@ -4286,7 +4791,10 @@ function MastraRuntimeProvider({
|
|
|
4286
4791
|
isRunning,
|
|
4287
4792
|
messages,
|
|
4288
4793
|
convertMessage: convertMessage$1,
|
|
4289
|
-
onNew
|
|
4794
|
+
onNew,
|
|
4795
|
+
adapters: {
|
|
4796
|
+
attachments: new CompositeAttachmentAdapter([new SimpleImageAttachmentAdapter()])
|
|
4797
|
+
}
|
|
4290
4798
|
});
|
|
4291
4799
|
return /* @__PURE__ */ jsxs(AssistantRuntimeProvider, { runtime, children: [
|
|
4292
4800
|
" ",
|
|
@@ -4295,6 +4803,20 @@ function MastraRuntimeProvider({
|
|
|
4295
4803
|
] });
|
|
4296
4804
|
}
|
|
4297
4805
|
|
|
4806
|
+
const useAgentStore = create()(
|
|
4807
|
+
persist(
|
|
4808
|
+
(set) => ({
|
|
4809
|
+
modelSettings: {},
|
|
4810
|
+
setModelSettings: (modelSettings) => set((state) => ({ modelSettings: { ...state.modelSettings, ...modelSettings } })),
|
|
4811
|
+
chatWithGenerate: {},
|
|
4812
|
+
setChatWithGenerate: (chatWithGenerate) => set((state) => ({ chatWithGenerate: { ...state.chatWithGenerate, ...chatWithGenerate } }))
|
|
4813
|
+
}),
|
|
4814
|
+
{
|
|
4815
|
+
name: "mastra-agent-store"
|
|
4816
|
+
}
|
|
4817
|
+
)
|
|
4818
|
+
);
|
|
4819
|
+
|
|
4298
4820
|
const defaultModelSettings$1 = {
|
|
4299
4821
|
maxRetries: 2,
|
|
4300
4822
|
maxSteps: 5,
|
|
@@ -4302,12 +4824,24 @@ const defaultModelSettings$1 = {
|
|
|
4302
4824
|
topP: 1
|
|
4303
4825
|
};
|
|
4304
4826
|
const AgentContext = createContext({});
|
|
4305
|
-
function AgentProvider({ children }) {
|
|
4306
|
-
const
|
|
4307
|
-
|
|
4827
|
+
function AgentProvider({ agentId, children }) {
|
|
4828
|
+
const {
|
|
4829
|
+
modelSettings: modelSettingsStore,
|
|
4830
|
+
setModelSettings: setModelSettingsStore,
|
|
4831
|
+
chatWithGenerate: chatWithGenerateStore,
|
|
4832
|
+
setChatWithGenerate: setChatWithGenerateStore
|
|
4833
|
+
} = useAgentStore();
|
|
4834
|
+
const modelSettings = modelSettingsStore[agentId] || defaultModelSettings$1;
|
|
4835
|
+
const setModelSettings = (modelSettings2) => {
|
|
4836
|
+
setModelSettingsStore({ [agentId]: modelSettings2 });
|
|
4837
|
+
};
|
|
4308
4838
|
const resetModelSettings = () => {
|
|
4309
4839
|
setModelSettings(defaultModelSettings$1);
|
|
4310
4840
|
};
|
|
4841
|
+
const chatWithGenerate = chatWithGenerateStore[agentId] || false;
|
|
4842
|
+
const setChatWithGenerate = (chatWithGenerate2) => {
|
|
4843
|
+
setChatWithGenerateStore({ [agentId]: chatWithGenerate2 });
|
|
4844
|
+
};
|
|
4311
4845
|
return /* @__PURE__ */ jsx(
|
|
4312
4846
|
AgentContext.Provider,
|
|
4313
4847
|
{
|
|
@@ -4323,6 +4857,18 @@ function AgentProvider({ children }) {
|
|
|
4323
4857
|
);
|
|
4324
4858
|
}
|
|
4325
4859
|
|
|
4860
|
+
const usePlaygroundStore = create()(
|
|
4861
|
+
persist(
|
|
4862
|
+
(set) => ({
|
|
4863
|
+
runtimeContext: {},
|
|
4864
|
+
setRuntimeContext: (runtimeContext) => set({ runtimeContext })
|
|
4865
|
+
}),
|
|
4866
|
+
{
|
|
4867
|
+
name: "mastra-playground-store"
|
|
4868
|
+
}
|
|
4869
|
+
)
|
|
4870
|
+
);
|
|
4871
|
+
|
|
4326
4872
|
const AgentChat = ({
|
|
4327
4873
|
agentId,
|
|
4328
4874
|
agentName,
|
|
@@ -4330,9 +4876,11 @@ const AgentChat = ({
|
|
|
4330
4876
|
initialMessages,
|
|
4331
4877
|
memory,
|
|
4332
4878
|
baseUrl,
|
|
4333
|
-
refreshThreadList
|
|
4879
|
+
refreshThreadList,
|
|
4880
|
+
showFileSupport
|
|
4334
4881
|
}) => {
|
|
4335
4882
|
const { modelSettings, chatWithGenerate } = useContext(AgentContext);
|
|
4883
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
4336
4884
|
return /* @__PURE__ */ jsx(
|
|
4337
4885
|
MastraRuntimeProvider,
|
|
4338
4886
|
{
|
|
@@ -4345,7 +4893,8 @@ const AgentChat = ({
|
|
|
4345
4893
|
refreshThreadList,
|
|
4346
4894
|
modelSettings,
|
|
4347
4895
|
chatWithGenerate,
|
|
4348
|
-
|
|
4896
|
+
runtimeContext,
|
|
4897
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, showFileSupport }) })
|
|
4349
4898
|
}
|
|
4350
4899
|
);
|
|
4351
4900
|
};
|
|
@@ -4405,18 +4954,18 @@ function FormattedDate({ date }) {
|
|
|
4405
4954
|
}
|
|
4406
4955
|
|
|
4407
4956
|
const inputVariants = cva(
|
|
4408
|
-
"flex w-full text-
|
|
4957
|
+
"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",
|
|
4409
4958
|
{
|
|
4410
4959
|
variants: {
|
|
4411
4960
|
variant: {
|
|
4412
|
-
default: "border-
|
|
4413
|
-
filled: "bg-inputFill border-
|
|
4414
|
-
unstyled: "border-0 bg-transparent placeholder:text-
|
|
4961
|
+
default: "border-sm border-border1 placeholder:text-icon3",
|
|
4962
|
+
filled: "border-sm bg-inputFill border-border1 placeholder:text-icon3",
|
|
4963
|
+
unstyled: "border-0 bg-transparent placeholder:text-icon3 focus-visible:ring-transparent focus-visible:outline-none"
|
|
4415
4964
|
},
|
|
4416
4965
|
customSize: {
|
|
4417
|
-
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-
|
|
4966
|
+
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-8",
|
|
4418
4967
|
sm: "h-[30px] px-[13px] text-xs",
|
|
4419
|
-
lg: "h-10 px-[17px]
|
|
4968
|
+
lg: "h-10 px-[17px] text-[calc(13_/_16_*_1rem)]"
|
|
4420
4969
|
}
|
|
4421
4970
|
},
|
|
4422
4971
|
defaultVariants: {
|
|
@@ -4895,20 +5444,6 @@ const Row = ({ className, children, selected = false, onClick }) => {
|
|
|
4895
5444
|
);
|
|
4896
5445
|
};
|
|
4897
5446
|
|
|
4898
|
-
const variants = {
|
|
4899
|
-
"header-md": "text-header-md leading-header-md",
|
|
4900
|
-
"ui-lg": "text-ui-lg leading-ui-lg",
|
|
4901
|
-
"ui-md": "text-ui-md leading-ui-md",
|
|
4902
|
-
"ui-sm": "text-ui-sm leading-ui-sm",
|
|
4903
|
-
"ui-xs": "text-ui-xs leading-ui-xs"
|
|
4904
|
-
};
|
|
4905
|
-
const fonts = {
|
|
4906
|
-
mono: "font-mono"
|
|
4907
|
-
};
|
|
4908
|
-
const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
|
|
4909
|
-
return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
4910
|
-
};
|
|
4911
|
-
|
|
4912
5447
|
const formatDateCell = (date) => {
|
|
4913
5448
|
const month = new Intl.DateTimeFormat("en-US", { month: "short" }).format(date).toUpperCase();
|
|
4914
5449
|
const day = date.getDate();
|
|
@@ -5131,11 +5666,17 @@ const TraceTree = ({ children }) => {
|
|
|
5131
5666
|
const variantClasses = {
|
|
5132
5667
|
agent: "bg-accent1"
|
|
5133
5668
|
};
|
|
5134
|
-
const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
|
|
5669
|
+
const Time = ({ durationMs, tokenCount, variant, progressPercent, offsetPercent }) => {
|
|
5135
5670
|
const variantClass = variant ? variantClasses[variant] : "bg-accent3";
|
|
5136
5671
|
const percent = Math.min(100, progressPercent);
|
|
5137
5672
|
return /* @__PURE__ */ jsxs("div", { className: "w-[80px] xl:w-[166px] shrink-0", children: [
|
|
5138
|
-
/* @__PURE__ */ jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
5673
|
+
/* @__PURE__ */ jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
5674
|
+
"div",
|
|
5675
|
+
{
|
|
5676
|
+
className: clsx("absolute h-1 rounded-full", variantClass),
|
|
5677
|
+
style: { width: `${percent}%`, left: `${offsetPercent}%` }
|
|
5678
|
+
}
|
|
5679
|
+
) }),
|
|
5139
5680
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
|
|
5140
5681
|
/* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
|
|
5141
5682
|
toSigFigs(durationMs, 3),
|
|
@@ -5149,14 +5690,6 @@ const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
|
|
|
5149
5690
|
] });
|
|
5150
5691
|
};
|
|
5151
5692
|
|
|
5152
|
-
const TraceDurationContext = createContext(0);
|
|
5153
|
-
const useTraceDuration = () => {
|
|
5154
|
-
return useContext(TraceDurationContext);
|
|
5155
|
-
};
|
|
5156
|
-
const TraceDurationProvider = ({ children, durationMs }) => {
|
|
5157
|
-
return /* @__PURE__ */ jsx(TraceDurationContext.Provider, { value: durationMs, children });
|
|
5158
|
-
};
|
|
5159
|
-
|
|
5160
5693
|
const spanIconMap = {
|
|
5161
5694
|
tool: ToolsIcon,
|
|
5162
5695
|
agent: AgentIcon,
|
|
@@ -5177,14 +5710,25 @@ const spanVariantClasses = {
|
|
|
5177
5710
|
eval: "text-accent4",
|
|
5178
5711
|
other: "text-icon6"
|
|
5179
5712
|
};
|
|
5180
|
-
const Span = ({
|
|
5713
|
+
const Span = ({
|
|
5714
|
+
children,
|
|
5715
|
+
durationMs,
|
|
5716
|
+
variant,
|
|
5717
|
+
tokenCount,
|
|
5718
|
+
spans,
|
|
5719
|
+
isRoot,
|
|
5720
|
+
onClick,
|
|
5721
|
+
isActive,
|
|
5722
|
+
offsetMs,
|
|
5723
|
+
totalDurationMs
|
|
5724
|
+
}) => {
|
|
5181
5725
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
5182
|
-
const traceDuration = useTraceDuration();
|
|
5183
5726
|
const VariantIcon = spanIconMap[variant];
|
|
5184
5727
|
const variantClass = spanVariantClasses[variant];
|
|
5185
|
-
const progressPercent = durationMs /
|
|
5728
|
+
const progressPercent = durationMs / totalDurationMs * 100;
|
|
5729
|
+
const offsetPercent = offsetMs / totalDurationMs * 100;
|
|
5186
5730
|
const TextEl = onClick ? "button" : "div";
|
|
5187
|
-
return /* @__PURE__ */
|
|
5731
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
5188
5732
|
/* @__PURE__ */ jsxs("div", { className: clsx("flex justify-between items-center gap-2 rounded-md pl-2", isActive && "bg-surface4"), children: [
|
|
5189
5733
|
/* @__PURE__ */ jsxs("div", { className: "flex h-8 items-center gap-1 min-w-0", children: [
|
|
5190
5734
|
spans ? /* @__PURE__ */ jsx(
|
|
@@ -5209,20 +5753,30 @@ const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClic
|
|
|
5209
5753
|
durationMs,
|
|
5210
5754
|
tokenCount,
|
|
5211
5755
|
variant: variant === "agent" ? "agent" : void 0,
|
|
5212
|
-
progressPercent
|
|
5756
|
+
progressPercent,
|
|
5757
|
+
offsetPercent
|
|
5213
5758
|
}
|
|
5214
5759
|
)
|
|
5215
5760
|
] }),
|
|
5216
5761
|
isExpanded && spans && /* @__PURE__ */ jsx("div", { className: "ml-4", children: spans })
|
|
5217
|
-
] })
|
|
5762
|
+
] });
|
|
5218
5763
|
};
|
|
5219
5764
|
|
|
5220
5765
|
const Spans = ({ children }) => {
|
|
5221
5766
|
return /* @__PURE__ */ jsx("ol", { children });
|
|
5222
5767
|
};
|
|
5223
5768
|
|
|
5224
|
-
const Trace = ({
|
|
5225
|
-
|
|
5769
|
+
const Trace = ({
|
|
5770
|
+
name,
|
|
5771
|
+
spans,
|
|
5772
|
+
durationMs,
|
|
5773
|
+
tokenCount,
|
|
5774
|
+
onClick,
|
|
5775
|
+
variant,
|
|
5776
|
+
isActive,
|
|
5777
|
+
totalDurationMs
|
|
5778
|
+
}) => {
|
|
5779
|
+
return /* @__PURE__ */ jsx(
|
|
5226
5780
|
Span,
|
|
5227
5781
|
{
|
|
5228
5782
|
isRoot: true,
|
|
@@ -5231,9 +5785,11 @@ const Trace = ({ name, spans, durationMs, tokenCount, onClick, variant, isActive
|
|
|
5231
5785
|
spans: /* @__PURE__ */ jsx(Spans, { children: spans }),
|
|
5232
5786
|
onClick,
|
|
5233
5787
|
isActive,
|
|
5788
|
+
offsetMs: 0,
|
|
5789
|
+
totalDurationMs,
|
|
5234
5790
|
children: name
|
|
5235
5791
|
}
|
|
5236
|
-
)
|
|
5792
|
+
);
|
|
5237
5793
|
};
|
|
5238
5794
|
|
|
5239
5795
|
const getSpanVariant = (span) => {
|
|
@@ -5258,40 +5814,71 @@ const getSpanVariant = (span) => {
|
|
|
5258
5814
|
return "other";
|
|
5259
5815
|
};
|
|
5260
5816
|
|
|
5261
|
-
function buildTree(
|
|
5262
|
-
return
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5817
|
+
function buildTree(spans, minStartTime, totalDurationMs, parentSpanId = null) {
|
|
5818
|
+
return spans.filter((span) => span.parentSpanId === parentSpanId).map((span) => {
|
|
5819
|
+
return {
|
|
5820
|
+
...span,
|
|
5821
|
+
children: buildTree(spans, minStartTime, totalDurationMs, span.id),
|
|
5822
|
+
offset: (span.startTime - minStartTime) / 1e3,
|
|
5823
|
+
// ns to ms
|
|
5824
|
+
duration: span.duration / 1e3,
|
|
5825
|
+
totalDurationMs
|
|
5826
|
+
};
|
|
5827
|
+
});
|
|
5266
5828
|
}
|
|
5267
|
-
const
|
|
5829
|
+
const createSpanTree = (spans) => {
|
|
5830
|
+
if (spans.length === 0) return [];
|
|
5831
|
+
let minStartTime;
|
|
5832
|
+
let maxEndTime;
|
|
5833
|
+
const orderedTree = [];
|
|
5834
|
+
const listSize = spans.length;
|
|
5835
|
+
for (let i = listSize - 1; i >= 0; i--) {
|
|
5836
|
+
const span = spans[i];
|
|
5837
|
+
if (!minStartTime || span.startTime < minStartTime) {
|
|
5838
|
+
minStartTime = span.startTime;
|
|
5839
|
+
}
|
|
5840
|
+
if (!maxEndTime || span.endTime > maxEndTime) {
|
|
5841
|
+
maxEndTime = span.endTime;
|
|
5842
|
+
}
|
|
5843
|
+
if (span.name !== ".insert" && span.name !== "mastra.getStorage") {
|
|
5844
|
+
orderedTree.push(span);
|
|
5845
|
+
}
|
|
5846
|
+
}
|
|
5847
|
+
if (!minStartTime || !maxEndTime) return [];
|
|
5848
|
+
const totalDurationMs = (maxEndTime - minStartTime) / 1e3;
|
|
5849
|
+
return buildTree(orderedTree, minStartTime, totalDurationMs);
|
|
5850
|
+
};
|
|
5851
|
+
|
|
5852
|
+
const NestedSpans = ({ spanNodes }) => {
|
|
5268
5853
|
const { span: activeSpan, setSpan } = useContext(TraceContext);
|
|
5269
|
-
return /* @__PURE__ */ jsx(Spans, { children:
|
|
5270
|
-
const isActive =
|
|
5854
|
+
return /* @__PURE__ */ jsx(Spans, { children: spanNodes.map((spanNode) => {
|
|
5855
|
+
const isActive = spanNode.id === activeSpan?.id;
|
|
5271
5856
|
return /* @__PURE__ */ jsx(
|
|
5272
5857
|
Span,
|
|
5273
5858
|
{
|
|
5274
|
-
spans:
|
|
5275
|
-
durationMs:
|
|
5276
|
-
|
|
5859
|
+
spans: spanNode.children.length > 0 && /* @__PURE__ */ jsx(NestedSpans, { spanNodes: spanNode.children }),
|
|
5860
|
+
durationMs: spanNode.duration,
|
|
5861
|
+
offsetMs: spanNode.offset,
|
|
5862
|
+
variant: getSpanVariant(spanNode),
|
|
5277
5863
|
isActive,
|
|
5278
|
-
onClick: () => setSpan(
|
|
5279
|
-
|
|
5864
|
+
onClick: () => setSpan(spanNode),
|
|
5865
|
+
totalDurationMs: spanNode.totalDurationMs,
|
|
5866
|
+
children: spanNode.name
|
|
5280
5867
|
},
|
|
5281
|
-
|
|
5868
|
+
spanNode.id
|
|
5282
5869
|
);
|
|
5283
5870
|
}) });
|
|
5284
5871
|
};
|
|
5285
5872
|
function SpanView({ trace }) {
|
|
5286
|
-
const shallowCopy = [...trace];
|
|
5287
|
-
const tree = buildTree(shallowCopy.reverse());
|
|
5288
5873
|
const { span: activeSpan, setSpan } = useContext(TraceContext);
|
|
5874
|
+
const tree = createSpanTree(trace);
|
|
5289
5875
|
return /* @__PURE__ */ jsx(TraceTree, { children: tree.map((node) => /* @__PURE__ */ jsx(
|
|
5290
5876
|
Trace,
|
|
5291
5877
|
{
|
|
5292
5878
|
name: node.name,
|
|
5293
|
-
durationMs: node.duration
|
|
5294
|
-
|
|
5879
|
+
durationMs: node.duration,
|
|
5880
|
+
totalDurationMs: node.totalDurationMs,
|
|
5881
|
+
spans: /* @__PURE__ */ jsx(NestedSpans, { spanNodes: node.children }),
|
|
5295
5882
|
variant: getSpanVariant(node),
|
|
5296
5883
|
isActive: node.id === activeSpan?.id,
|
|
5297
5884
|
onClick: () => setSpan(node)
|
|
@@ -5427,8 +6014,7 @@ const refineTraces = (traces, isWorkflow = false) => {
|
|
|
5427
6014
|
const parentSpan = value.find((span) => !span.parentSpanId || !listOfSpanIds.has(span.parentSpanId));
|
|
5428
6015
|
const enrichedSpans = value.map((span) => ({
|
|
5429
6016
|
...span,
|
|
5430
|
-
parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
|
|
5431
|
-
relativePercentage: parentSpan ? span.duration / parentSpan.duration : 0
|
|
6017
|
+
parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
|
|
5432
6018
|
}));
|
|
5433
6019
|
const failedStatus = value.find((span) => span.status.code !== 0)?.status;
|
|
5434
6020
|
return {
|
|
@@ -6039,7 +6625,7 @@ function WorkflowTracesInner({ traces, isLoading, error }) {
|
|
|
6039
6625
|
] });
|
|
6040
6626
|
}
|
|
6041
6627
|
|
|
6042
|
-
const
|
|
6628
|
+
const sanitizeWorkflowWatchResult = (record) => {
|
|
6043
6629
|
const formattedResults = Object.entries(record.payload.workflowState.steps || {}).reduce(
|
|
6044
6630
|
(acc, [key, value]) => {
|
|
6045
6631
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6074,8 +6660,8 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
|
|
|
6074
6660
|
};
|
|
6075
6661
|
return sanitizedRecord;
|
|
6076
6662
|
};
|
|
6077
|
-
const
|
|
6078
|
-
const [
|
|
6663
|
+
const useLegacyWorkflow = (workflowId, baseUrl) => {
|
|
6664
|
+
const [legacyWorkflow, setLegacyWorkflow] = useState(null);
|
|
6079
6665
|
const [isLoading, setIsLoading] = useState(true);
|
|
6080
6666
|
const client = createMastraClient(baseUrl);
|
|
6081
6667
|
useEffect(() => {
|
|
@@ -6083,22 +6669,22 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6083
6669
|
setIsLoading(true);
|
|
6084
6670
|
try {
|
|
6085
6671
|
if (!workflowId) {
|
|
6086
|
-
|
|
6672
|
+
setLegacyWorkflow(null);
|
|
6087
6673
|
setIsLoading(false);
|
|
6088
6674
|
return;
|
|
6089
6675
|
}
|
|
6090
|
-
const res = await client.
|
|
6676
|
+
const res = await client.getLegacyWorkflow(workflowId).details();
|
|
6091
6677
|
if (!res) {
|
|
6092
|
-
|
|
6093
|
-
console.error("Error fetching workflow");
|
|
6094
|
-
toast.error("Error fetching workflow");
|
|
6678
|
+
setLegacyWorkflow(null);
|
|
6679
|
+
console.error("Error fetching legacy workflow");
|
|
6680
|
+
toast.error("Error fetching legacy workflow");
|
|
6095
6681
|
return;
|
|
6096
6682
|
}
|
|
6097
6683
|
const steps = res.steps;
|
|
6098
6684
|
const stepsWithWorkflow = await Promise.all(
|
|
6099
6685
|
Object.values(steps)?.map(async (step) => {
|
|
6100
6686
|
if (!step.workflowId) return step;
|
|
6101
|
-
const wFlow = await client.
|
|
6687
|
+
const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
|
|
6102
6688
|
if (!wFlow) return step;
|
|
6103
6689
|
return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
|
|
6104
6690
|
})
|
|
@@ -6106,21 +6692,21 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6106
6692
|
const _steps = stepsWithWorkflow.reduce((acc, b) => {
|
|
6107
6693
|
return { ...acc, [b.id]: b };
|
|
6108
6694
|
}, {});
|
|
6109
|
-
|
|
6695
|
+
setLegacyWorkflow({ ...res, steps: _steps });
|
|
6110
6696
|
} catch (error) {
|
|
6111
|
-
|
|
6112
|
-
console.error("Error fetching workflow", error);
|
|
6113
|
-
toast.error("Error fetching workflow");
|
|
6697
|
+
setLegacyWorkflow(null);
|
|
6698
|
+
console.error("Error fetching legacy workflow", error);
|
|
6699
|
+
toast.error("Error fetching legacy workflow");
|
|
6114
6700
|
} finally {
|
|
6115
6701
|
setIsLoading(false);
|
|
6116
6702
|
}
|
|
6117
6703
|
};
|
|
6118
6704
|
fetchWorkflow();
|
|
6119
6705
|
}, [workflowId]);
|
|
6120
|
-
return {
|
|
6706
|
+
return { legacyWorkflow, isLoading };
|
|
6121
6707
|
};
|
|
6122
|
-
const
|
|
6123
|
-
const [
|
|
6708
|
+
const useWorkflow = (workflowId, baseUrl) => {
|
|
6709
|
+
const [workflow, setWorkflow] = useState(null);
|
|
6124
6710
|
const [isLoading, setIsLoading] = useState(true);
|
|
6125
6711
|
const client = createMastraClient(baseUrl);
|
|
6126
6712
|
useEffect(() => {
|
|
@@ -6128,14 +6714,14 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6128
6714
|
setIsLoading(true);
|
|
6129
6715
|
try {
|
|
6130
6716
|
if (!workflowId) {
|
|
6131
|
-
|
|
6717
|
+
setWorkflow(null);
|
|
6132
6718
|
setIsLoading(false);
|
|
6133
6719
|
return;
|
|
6134
6720
|
}
|
|
6135
|
-
const res = await client.
|
|
6136
|
-
|
|
6721
|
+
const res = await client.getWorkflow(workflowId).details();
|
|
6722
|
+
setWorkflow(res);
|
|
6137
6723
|
} catch (error) {
|
|
6138
|
-
|
|
6724
|
+
setWorkflow(null);
|
|
6139
6725
|
console.error("Error fetching workflow", error);
|
|
6140
6726
|
toast.error("Error fetching workflow");
|
|
6141
6727
|
} finally {
|
|
@@ -6144,13 +6730,13 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6144
6730
|
};
|
|
6145
6731
|
fetchWorkflow();
|
|
6146
6732
|
}, [workflowId]);
|
|
6147
|
-
return {
|
|
6733
|
+
return { workflow, isLoading };
|
|
6148
6734
|
};
|
|
6149
6735
|
const useExecuteWorkflow = (baseUrl) => {
|
|
6150
6736
|
const client = createMastraClient(baseUrl);
|
|
6151
|
-
const
|
|
6737
|
+
const createLegacyWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6152
6738
|
try {
|
|
6153
|
-
const workflow = client.
|
|
6739
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6154
6740
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6155
6741
|
return { runId: newRunId };
|
|
6156
6742
|
} catch (error) {
|
|
@@ -6158,9 +6744,9 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6158
6744
|
throw error;
|
|
6159
6745
|
}
|
|
6160
6746
|
};
|
|
6161
|
-
const
|
|
6747
|
+
const createWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6162
6748
|
try {
|
|
6163
|
-
const workflow = client.
|
|
6749
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6164
6750
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6165
6751
|
return { runId: newRunId };
|
|
6166
6752
|
} catch (error) {
|
|
@@ -6168,36 +6754,50 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6168
6754
|
throw error;
|
|
6169
6755
|
}
|
|
6170
6756
|
};
|
|
6171
|
-
const
|
|
6757
|
+
const startLegacyWorkflowRun = async ({
|
|
6758
|
+
workflowId,
|
|
6759
|
+
runId,
|
|
6760
|
+
input
|
|
6761
|
+
}) => {
|
|
6172
6762
|
try {
|
|
6173
|
-
const workflow = client.
|
|
6763
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6174
6764
|
await workflow.start({ runId, triggerData: input || {} });
|
|
6175
6765
|
} catch (error) {
|
|
6176
6766
|
console.error("Error starting workflow run:", error);
|
|
6177
6767
|
throw error;
|
|
6178
6768
|
}
|
|
6179
6769
|
};
|
|
6180
|
-
const
|
|
6770
|
+
const startWorkflowRun = async ({
|
|
6181
6771
|
workflowId,
|
|
6182
6772
|
runId,
|
|
6183
|
-
input
|
|
6773
|
+
input,
|
|
6774
|
+
runtimeContext: playgroundRuntimeContext
|
|
6184
6775
|
}) => {
|
|
6185
6776
|
try {
|
|
6186
|
-
const
|
|
6187
|
-
|
|
6777
|
+
const runtimeContext = new RuntimeContext$1();
|
|
6778
|
+
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6779
|
+
runtimeContext.set(key, value);
|
|
6780
|
+
});
|
|
6781
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6782
|
+
await workflow.start({ runId, inputData: input || {}, runtimeContext });
|
|
6188
6783
|
} catch (error) {
|
|
6189
6784
|
console.error("Error starting workflow run:", error);
|
|
6190
6785
|
throw error;
|
|
6191
6786
|
}
|
|
6192
6787
|
};
|
|
6193
|
-
const
|
|
6788
|
+
const startAsyncWorkflowRun = async ({
|
|
6194
6789
|
workflowId,
|
|
6195
6790
|
runId,
|
|
6196
|
-
input
|
|
6791
|
+
input,
|
|
6792
|
+
runtimeContext: playgroundRuntimeContext
|
|
6197
6793
|
}) => {
|
|
6198
6794
|
try {
|
|
6199
|
-
const
|
|
6200
|
-
|
|
6795
|
+
const runtimeContext = new RuntimeContext$1();
|
|
6796
|
+
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6797
|
+
runtimeContext.set(key, value);
|
|
6798
|
+
});
|
|
6799
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6800
|
+
const result = await workflow.startAsync({ runId, inputData: input || {}, runtimeContext });
|
|
6201
6801
|
return result;
|
|
6202
6802
|
} catch (error) {
|
|
6203
6803
|
console.error("Error starting workflow run:", error);
|
|
@@ -6207,17 +6807,17 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6207
6807
|
return {
|
|
6208
6808
|
startWorkflowRun,
|
|
6209
6809
|
createWorkflowRun,
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6810
|
+
startLegacyWorkflowRun,
|
|
6811
|
+
createLegacyWorkflowRun,
|
|
6812
|
+
startAsyncWorkflowRun
|
|
6213
6813
|
};
|
|
6214
6814
|
};
|
|
6215
6815
|
const useWatchWorkflow = (baseUrl) => {
|
|
6816
|
+
const [isWatchingLegacyWorkflow, setIsWatchingLegacyWorkflow] = useState(false);
|
|
6216
6817
|
const [isWatchingWorkflow, setIsWatchingWorkflow] = useState(false);
|
|
6217
|
-
const [
|
|
6818
|
+
const [legacyWatchResult, setLegacyWatchResult] = useState(null);
|
|
6218
6819
|
const [watchResult, setWatchResult] = useState(null);
|
|
6219
|
-
const
|
|
6220
|
-
const debouncedSetWatchResult = useDebouncedCallback((record) => {
|
|
6820
|
+
const debouncedSetLegacyWorkflowWatchResult = useDebouncedCallback((record) => {
|
|
6221
6821
|
const formattedResults = Object.entries(record.results || {}).reduce(
|
|
6222
6822
|
(acc, [key, value]) => {
|
|
6223
6823
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6240,19 +6840,19 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6240
6840
|
...record,
|
|
6241
6841
|
sanitizedOutput: record ? JSON.stringify({ ...record, results: formattedResults }, null, 2).slice(0, 5e4) : null
|
|
6242
6842
|
};
|
|
6243
|
-
|
|
6843
|
+
setLegacyWatchResult(sanitizedRecord);
|
|
6244
6844
|
}, 100);
|
|
6245
|
-
const
|
|
6845
|
+
const watchLegacyWorkflow = async ({ workflowId, runId }) => {
|
|
6246
6846
|
try {
|
|
6247
|
-
|
|
6847
|
+
setIsWatchingLegacyWorkflow(true);
|
|
6248
6848
|
const client = createMastraClient(baseUrl);
|
|
6249
|
-
const workflow = client.
|
|
6849
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6250
6850
|
await workflow.watch({ runId }, (record) => {
|
|
6251
6851
|
try {
|
|
6252
|
-
|
|
6852
|
+
debouncedSetLegacyWorkflowWatchResult(record);
|
|
6253
6853
|
} catch (err) {
|
|
6254
6854
|
console.error("Error processing workflow record:", err);
|
|
6255
|
-
|
|
6855
|
+
setLegacyWatchResult({
|
|
6256
6856
|
...record
|
|
6257
6857
|
});
|
|
6258
6858
|
}
|
|
@@ -6261,24 +6861,24 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6261
6861
|
console.error("Error watching workflow:", error);
|
|
6262
6862
|
throw error;
|
|
6263
6863
|
} finally {
|
|
6264
|
-
|
|
6864
|
+
setIsWatchingLegacyWorkflow(false);
|
|
6265
6865
|
}
|
|
6266
6866
|
};
|
|
6267
|
-
const
|
|
6268
|
-
const sanitizedRecord =
|
|
6269
|
-
|
|
6867
|
+
const debouncedSetWorkflowWatchResult = useDebouncedCallback((record) => {
|
|
6868
|
+
const sanitizedRecord = sanitizeWorkflowWatchResult(record);
|
|
6869
|
+
setWatchResult(sanitizedRecord);
|
|
6270
6870
|
}, 100);
|
|
6271
|
-
const
|
|
6871
|
+
const watchWorkflow = async ({ workflowId, runId }) => {
|
|
6272
6872
|
try {
|
|
6273
|
-
|
|
6873
|
+
setIsWatchingWorkflow(true);
|
|
6274
6874
|
const client = createMastraClient(baseUrl);
|
|
6275
|
-
const workflow = client.
|
|
6875
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6276
6876
|
await workflow.watch({ runId }, (record) => {
|
|
6277
6877
|
try {
|
|
6278
|
-
|
|
6878
|
+
debouncedSetWorkflowWatchResult(record);
|
|
6279
6879
|
} catch (err) {
|
|
6280
6880
|
console.error("Error processing workflow record:", err);
|
|
6281
|
-
|
|
6881
|
+
setWatchResult({
|
|
6282
6882
|
...record
|
|
6283
6883
|
});
|
|
6284
6884
|
}
|
|
@@ -6287,63 +6887,67 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6287
6887
|
console.error("Error watching workflow:", error);
|
|
6288
6888
|
throw error;
|
|
6289
6889
|
} finally {
|
|
6290
|
-
|
|
6890
|
+
setIsWatchingWorkflow(false);
|
|
6291
6891
|
}
|
|
6292
6892
|
};
|
|
6293
6893
|
return {
|
|
6894
|
+
watchLegacyWorkflow,
|
|
6895
|
+
isWatchingLegacyWorkflow,
|
|
6896
|
+
legacyWatchResult,
|
|
6294
6897
|
watchWorkflow,
|
|
6295
6898
|
isWatchingWorkflow,
|
|
6296
|
-
watchResult
|
|
6297
|
-
watchVNextWorkflow,
|
|
6298
|
-
isWatchingVNextWorkflow,
|
|
6299
|
-
watchVNextResult
|
|
6899
|
+
watchResult
|
|
6300
6900
|
};
|
|
6301
6901
|
};
|
|
6302
6902
|
const useResumeWorkflow = (baseUrl) => {
|
|
6903
|
+
const [isResumingLegacyWorkflow, setIsResumingLegacyWorkflow] = useState(false);
|
|
6303
6904
|
const [isResumingWorkflow, setIsResumingWorkflow] = useState(false);
|
|
6304
|
-
const
|
|
6305
|
-
const resumeWorkflow = async ({
|
|
6905
|
+
const resumeLegacyWorkflow = async ({
|
|
6306
6906
|
workflowId,
|
|
6307
6907
|
stepId,
|
|
6308
6908
|
runId,
|
|
6309
6909
|
context
|
|
6310
6910
|
}) => {
|
|
6311
6911
|
try {
|
|
6312
|
-
|
|
6912
|
+
setIsResumingLegacyWorkflow(true);
|
|
6313
6913
|
const client = createMastraClient(baseUrl);
|
|
6314
|
-
const response = await client.
|
|
6914
|
+
const response = await client.getLegacyWorkflow(workflowId).resume({ stepId, runId, context });
|
|
6315
6915
|
return response;
|
|
6316
6916
|
} catch (error) {
|
|
6317
6917
|
console.error("Error resuming workflow:", error);
|
|
6318
6918
|
throw error;
|
|
6319
6919
|
} finally {
|
|
6320
|
-
|
|
6920
|
+
setIsResumingLegacyWorkflow(false);
|
|
6321
6921
|
}
|
|
6322
6922
|
};
|
|
6323
|
-
const
|
|
6923
|
+
const resumeWorkflow = async ({
|
|
6324
6924
|
workflowId,
|
|
6325
6925
|
step,
|
|
6326
6926
|
runId,
|
|
6327
6927
|
resumeData,
|
|
6328
|
-
runtimeContext
|
|
6928
|
+
runtimeContext: playgroundRuntimeContext
|
|
6329
6929
|
}) => {
|
|
6330
6930
|
try {
|
|
6331
|
-
|
|
6931
|
+
setIsResumingWorkflow(true);
|
|
6332
6932
|
const client = createMastraClient(baseUrl);
|
|
6333
|
-
const
|
|
6933
|
+
const runtimeContext = new RuntimeContext$1();
|
|
6934
|
+
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6935
|
+
runtimeContext.set(key, value);
|
|
6936
|
+
});
|
|
6937
|
+
const response = await client.getWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext });
|
|
6334
6938
|
return response;
|
|
6335
6939
|
} catch (error) {
|
|
6336
6940
|
console.error("Error resuming workflow:", error);
|
|
6337
6941
|
throw error;
|
|
6338
6942
|
} finally {
|
|
6339
|
-
|
|
6943
|
+
setIsResumingWorkflow(false);
|
|
6340
6944
|
}
|
|
6341
6945
|
};
|
|
6342
6946
|
return {
|
|
6947
|
+
resumeLegacyWorkflow,
|
|
6948
|
+
isResumingLegacyWorkflow,
|
|
6343
6949
|
resumeWorkflow,
|
|
6344
|
-
isResumingWorkflow
|
|
6345
|
-
resumeVNextWorkflow,
|
|
6346
|
-
isResumingVNextWorkflow
|
|
6950
|
+
isResumingWorkflow
|
|
6347
6951
|
};
|
|
6348
6952
|
};
|
|
6349
6953
|
|
|
@@ -6430,7 +7034,7 @@ const defaultEdgeOptions = {
|
|
|
6430
7034
|
color: "#8e8e8e"
|
|
6431
7035
|
}
|
|
6432
7036
|
};
|
|
6433
|
-
const
|
|
7037
|
+
const contructLegacyNodesAndEdges = ({
|
|
6434
7038
|
stepGraph,
|
|
6435
7039
|
stepSubscriberGraph,
|
|
6436
7040
|
steps: mainSteps = {}
|
|
@@ -6881,7 +7485,7 @@ const getStepNodeAndEdge = ({
|
|
|
6881
7485
|
}
|
|
6882
7486
|
return { nodes: [], edges: [], nextPrevNodeIds: [] };
|
|
6883
7487
|
};
|
|
6884
|
-
const
|
|
7488
|
+
const constructNodesAndEdges = ({
|
|
6885
7489
|
stepGraph
|
|
6886
7490
|
}) => {
|
|
6887
7491
|
if (!stepGraph) {
|
|
@@ -6952,54 +7556,6 @@ const Collapsible = CollapsiblePrimitive.Root;
|
|
|
6952
7556
|
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
6953
7557
|
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
6954
7558
|
|
|
6955
|
-
const Dialog = DialogPrimitive.Root;
|
|
6956
|
-
const DialogPortal = DialogPrimitive.Portal;
|
|
6957
|
-
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6958
|
-
DialogPrimitive.Overlay,
|
|
6959
|
-
{
|
|
6960
|
-
ref,
|
|
6961
|
-
className: cn(
|
|
6962
|
-
"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",
|
|
6963
|
-
className
|
|
6964
|
-
),
|
|
6965
|
-
...props
|
|
6966
|
-
}
|
|
6967
|
-
));
|
|
6968
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
6969
|
-
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
6970
|
-
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
6971
|
-
/* @__PURE__ */ jsxs(
|
|
6972
|
-
DialogPrimitive.Content,
|
|
6973
|
-
{
|
|
6974
|
-
ref,
|
|
6975
|
-
className: cn(
|
|
6976
|
-
"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",
|
|
6977
|
-
className
|
|
6978
|
-
),
|
|
6979
|
-
...props,
|
|
6980
|
-
children: [
|
|
6981
|
-
children,
|
|
6982
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.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: [
|
|
6983
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
6984
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
6985
|
-
] })
|
|
6986
|
-
]
|
|
6987
|
-
}
|
|
6988
|
-
)
|
|
6989
|
-
] }));
|
|
6990
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
6991
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6992
|
-
DialogPrimitive.Title,
|
|
6993
|
-
{
|
|
6994
|
-
ref,
|
|
6995
|
-
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
6996
|
-
...props
|
|
6997
|
-
}
|
|
6998
|
-
));
|
|
6999
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
7000
|
-
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
7001
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
7002
|
-
|
|
7003
7559
|
const ScrollArea = React.forwardRef(
|
|
7004
7560
|
({ className, children, viewPortClassName, maxHeight, autoScroll = false, ...props }, ref) => {
|
|
7005
7561
|
const areaRef = React.useRef(null);
|
|
@@ -7220,12 +7776,12 @@ function Spinner({ color = "#fff", className }) {
|
|
|
7220
7776
|
);
|
|
7221
7777
|
}
|
|
7222
7778
|
|
|
7223
|
-
function
|
|
7779
|
+
function LegacyWorkflowNestedGraph({
|
|
7224
7780
|
stepGraph,
|
|
7225
7781
|
stepSubscriberGraph,
|
|
7226
7782
|
open
|
|
7227
7783
|
}) {
|
|
7228
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7784
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7229
7785
|
stepGraph,
|
|
7230
7786
|
stepSubscriberGraph
|
|
7231
7787
|
});
|
|
@@ -7263,10 +7819,10 @@ function WorkflowNestedGraph({
|
|
|
7263
7819
|
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) });
|
|
7264
7820
|
}
|
|
7265
7821
|
|
|
7266
|
-
const
|
|
7822
|
+
const LegacyWorkflowNestedGraphContext = createContext(
|
|
7267
7823
|
{}
|
|
7268
7824
|
);
|
|
7269
|
-
function
|
|
7825
|
+
function LegacyWorkflowNestedGraphProvider({ children }) {
|
|
7270
7826
|
const [stepGraph, setStepGraph] = useState(null);
|
|
7271
7827
|
const [stepSubscriberGraph, setStepSubscriberGraph] = useState(null);
|
|
7272
7828
|
const [openDialog, setOpenDialog] = useState(false);
|
|
@@ -7288,7 +7844,7 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7288
7844
|
setOpenDialog(true);
|
|
7289
7845
|
};
|
|
7290
7846
|
return /* @__PURE__ */ jsxs(
|
|
7291
|
-
|
|
7847
|
+
LegacyWorkflowNestedGraphContext.Provider,
|
|
7292
7848
|
{
|
|
7293
7849
|
value: {
|
|
7294
7850
|
showNestedGraph,
|
|
@@ -7304,16 +7860,23 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7304
7860
|
" workflow"
|
|
7305
7861
|
] })
|
|
7306
7862
|
] }),
|
|
7307
|
-
/* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
7863
|
+
/* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
7864
|
+
LegacyWorkflowNestedGraph,
|
|
7865
|
+
{
|
|
7866
|
+
stepGraph,
|
|
7867
|
+
open: openDialog,
|
|
7868
|
+
stepSubscriberGraph
|
|
7869
|
+
}
|
|
7870
|
+
) })
|
|
7308
7871
|
] }) }) })
|
|
7309
7872
|
]
|
|
7310
7873
|
}
|
|
7311
7874
|
);
|
|
7312
7875
|
}
|
|
7313
7876
|
|
|
7314
|
-
function
|
|
7877
|
+
function LegacyWorkflowNestedNode({ data }) {
|
|
7315
7878
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph, stepSubscriberGraph } = data;
|
|
7316
|
-
const { showNestedGraph } = useContext(
|
|
7879
|
+
const { showNestedGraph } = useContext(LegacyWorkflowNestedGraphContext);
|
|
7317
7880
|
return /* @__PURE__ */ jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
7318
7881
|
!withoutTopHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }),
|
|
7319
7882
|
/* @__PURE__ */ jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph, stepSubscriberGraph }), children: /* @__PURE__ */ jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
|
|
@@ -7324,8 +7887,8 @@ function WorkflowNestedNode({ data }) {
|
|
|
7324
7887
|
] });
|
|
7325
7888
|
}
|
|
7326
7889
|
|
|
7327
|
-
function
|
|
7328
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7890
|
+
function LegacyWorkflowGraphInner({ workflow }) {
|
|
7891
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7329
7892
|
stepGraph: workflow.serializedStepGraph || workflow.stepGraph,
|
|
7330
7893
|
stepSubscriberGraph: workflow.serializedStepSubscriberGraph || workflow.stepSubscriberGraph,
|
|
7331
7894
|
steps: workflow.steps
|
|
@@ -7337,7 +7900,7 @@ function WorkflowGraphInner({ workflow }) {
|
|
|
7337
7900
|
"condition-node": WorkflowConditionNode,
|
|
7338
7901
|
"after-node": WorkflowAfterNode,
|
|
7339
7902
|
"loop-result-node": WorkflowLoopResultNode,
|
|
7340
|
-
"nested-node":
|
|
7903
|
+
"nested-node": LegacyWorkflowNestedNode
|
|
7341
7904
|
};
|
|
7342
7905
|
return /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxs(
|
|
7343
7906
|
ReactFlow,
|
|
@@ -7364,12 +7927,12 @@ const lodashTitleCase = (str) => {
|
|
|
7364
7927
|
return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
|
|
7365
7928
|
};
|
|
7366
7929
|
|
|
7367
|
-
function
|
|
7368
|
-
const {
|
|
7930
|
+
function LegacyWorkflowGraph({ workflowId, baseUrl }) {
|
|
7931
|
+
const { legacyWorkflow, isLoading } = useLegacyWorkflow(workflowId, baseUrl);
|
|
7369
7932
|
if (isLoading) {
|
|
7370
7933
|
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
|
|
7371
7934
|
}
|
|
7372
|
-
if (!
|
|
7935
|
+
if (!legacyWorkflow) {
|
|
7373
7936
|
return /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
7374
7937
|
/* @__PURE__ */ jsx(AlertCircleIcon, {}),
|
|
7375
7938
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -7379,28 +7942,24 @@ function WorkflowGraph({ workflowId, baseUrl }) {
|
|
|
7379
7942
|
] })
|
|
7380
7943
|
] }) });
|
|
7381
7944
|
}
|
|
7382
|
-
return /* @__PURE__ */ jsx(
|
|
7945
|
+
return /* @__PURE__ */ jsx(LegacyWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(LegacyWorkflowGraphInner, { workflow: legacyWorkflow }) }) });
|
|
7383
7946
|
}
|
|
7384
7947
|
|
|
7385
7948
|
const Form = React__default.forwardRef(({ children, ...props }, ref) => {
|
|
7386
7949
|
return /* @__PURE__ */ jsx("form", { ref, className: "space-y-4", ...props, children });
|
|
7387
7950
|
});
|
|
7388
7951
|
|
|
7389
|
-
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
7390
|
-
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
7391
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
7392
|
-
|
|
7393
7952
|
const DISABLED_LABELS = ["boolean", "object", "array"];
|
|
7394
7953
|
const FieldWrapper = ({ label, children, id, field, error }) => {
|
|
7395
7954
|
const isDisabled = DISABLED_LABELS.includes(field.type);
|
|
7396
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
7397
|
-
!isDisabled && /* @__PURE__ */ jsxs(
|
|
7955
|
+
return /* @__PURE__ */ jsxs("div", { className: "pb-4 last:pb-0", children: [
|
|
7956
|
+
!isDisabled && /* @__PURE__ */ jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3 pb-1 block", htmlFor: id, children: [
|
|
7398
7957
|
label,
|
|
7399
|
-
field.required && /* @__PURE__ */ jsx("span", { className: "text-
|
|
7958
|
+
field.required && /* @__PURE__ */ jsx("span", { className: "text-accent2", children: " *" })
|
|
7400
7959
|
] }),
|
|
7401
7960
|
children,
|
|
7402
|
-
field.fieldConfig?.description && /* @__PURE__ */ jsx("p",
|
|
7403
|
-
error && /* @__PURE__ */ jsx("p",
|
|
7961
|
+
field.fieldConfig?.description && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon6", children: field.fieldConfig.description }),
|
|
7962
|
+
error && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-accent2", children: error })
|
|
7404
7963
|
] });
|
|
7405
7964
|
};
|
|
7406
7965
|
|
|
@@ -7509,9 +8068,9 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
|
|
|
7509
8068
|
defaultChecked: field.default
|
|
7510
8069
|
}
|
|
7511
8070
|
),
|
|
7512
|
-
/* @__PURE__ */ jsxs(
|
|
8071
|
+
/* @__PURE__ */ jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", htmlFor: id, children: [
|
|
7513
8072
|
label,
|
|
7514
|
-
field.required && /* @__PURE__ */ jsx("span", { className: "text-
|
|
8073
|
+
field.required && /* @__PURE__ */ jsx("span", { className: "text-accent2", children: " *" })
|
|
7515
8074
|
] })
|
|
7516
8075
|
] });
|
|
7517
8076
|
|
|
@@ -7858,34 +8417,53 @@ const SelectField = ({ field, inputProps, error, id, value }) => {
|
|
|
7858
8417
|
};
|
|
7859
8418
|
|
|
7860
8419
|
const ObjectWrapper = ({ label, children }) => {
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
children
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
const ArrayWrapper = ({ label, children, onAddItem }) => {
|
|
7868
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
7869
|
-
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: label }),
|
|
7870
|
-
children,
|
|
8420
|
+
const hasLabel = label !== "" && label !== "";
|
|
8421
|
+
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
8422
|
+
hasLabel && /* @__PURE__ */ jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 flex items-center gap-1 pb-2", children: [
|
|
8423
|
+
/* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(Braces, {}) }),
|
|
8424
|
+
label
|
|
8425
|
+
] }),
|
|
7871
8426
|
/* @__PURE__ */ jsx(
|
|
7872
|
-
|
|
8427
|
+
"div",
|
|
7873
8428
|
{
|
|
7874
|
-
className: "
|
|
7875
|
-
|
|
7876
|
-
variant: "outline",
|
|
7877
|
-
size: "sm",
|
|
7878
|
-
type: "button",
|
|
7879
|
-
children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4" })
|
|
8429
|
+
className: hasLabel ? "flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4" : "",
|
|
8430
|
+
children
|
|
7880
8431
|
}
|
|
7881
8432
|
)
|
|
7882
8433
|
] });
|
|
7883
8434
|
};
|
|
7884
8435
|
|
|
8436
|
+
const ArrayWrapper = ({ label, children, onAddItem }) => {
|
|
8437
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
8438
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 justify-between", children: [
|
|
8439
|
+
/* @__PURE__ */ jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 pb-2 flex items-center gap-1", children: [
|
|
8440
|
+
/* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(Brackets, {}) }),
|
|
8441
|
+
label
|
|
8442
|
+
] }),
|
|
8443
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
|
|
8444
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
8445
|
+
"button",
|
|
8446
|
+
{
|
|
8447
|
+
onClick: onAddItem,
|
|
8448
|
+
type: "button",
|
|
8449
|
+
className: "text-icon3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-icon6 h-icon-sm w-icon-sm",
|
|
8450
|
+
children: /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(PlusIcon, {}) })
|
|
8451
|
+
}
|
|
8452
|
+
) }),
|
|
8453
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Add item" })
|
|
8454
|
+
] }) })
|
|
8455
|
+
] }),
|
|
8456
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children })
|
|
8457
|
+
] });
|
|
8458
|
+
};
|
|
8459
|
+
|
|
7885
8460
|
const ArrayElementWrapper = ({ children, onRemove }) => {
|
|
7886
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
7887
|
-
|
|
7888
|
-
children
|
|
8461
|
+
return /* @__PURE__ */ jsxs("div", { className: "pl-4 border-l border-border1", children: [
|
|
8462
|
+
children,
|
|
8463
|
+
/* @__PURE__ */ jsxs(Button, { onClick: onRemove, type: "button", children: [
|
|
8464
|
+
/* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(TrashIcon, {}) }),
|
|
8465
|
+
"Delete"
|
|
8466
|
+
] })
|
|
7889
8467
|
] });
|
|
7890
8468
|
};
|
|
7891
8469
|
|
|
@@ -8084,6 +8662,10 @@ class CustomZodProvider extends ZodProvider {
|
|
|
8084
8662
|
}
|
|
8085
8663
|
}
|
|
8086
8664
|
|
|
8665
|
+
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
8666
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
8667
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
8668
|
+
|
|
8087
8669
|
function isEmptyZodObject(schema) {
|
|
8088
8670
|
if (schema instanceof ZodObject) {
|
|
8089
8671
|
return Object.keys(schema.shape).length === 0;
|
|
@@ -8095,7 +8677,7 @@ function DynamicForm({
|
|
|
8095
8677
|
onSubmit,
|
|
8096
8678
|
defaultValues,
|
|
8097
8679
|
isSubmitLoading,
|
|
8098
|
-
submitButtonLabel
|
|
8680
|
+
submitButtonLabel
|
|
8099
8681
|
}) {
|
|
8100
8682
|
if (!schema) {
|
|
8101
8683
|
console.error("no form schema found");
|
|
@@ -8117,17 +8699,17 @@ function DynamicForm({
|
|
|
8117
8699
|
},
|
|
8118
8700
|
defaultValues: defaultValues ? { "": defaultValues } : void 0,
|
|
8119
8701
|
formProps: {
|
|
8120
|
-
className: "
|
|
8702
|
+
className: ""
|
|
8121
8703
|
},
|
|
8122
8704
|
uiComponents: {
|
|
8123
|
-
SubmitButton: ({ children }) => /* @__PURE__ */ jsx(Button
|
|
8705
|
+
SubmitButton: ({ children }) => /* @__PURE__ */ jsx(Button, { variant: "light", className: "w-full", size: "lg", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : submitButtonLabel || children })
|
|
8124
8706
|
},
|
|
8125
8707
|
formComponents: {
|
|
8126
8708
|
Label: ({ value }) => /* @__PURE__ */ jsx(Label, { className: "text-sm font-normal", children: value })
|
|
8127
8709
|
},
|
|
8128
8710
|
withSubmit: true
|
|
8129
8711
|
};
|
|
8130
|
-
return /* @__PURE__ */ jsx(
|
|
8712
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx(AutoForm, { ...formProps }) });
|
|
8131
8713
|
}
|
|
8132
8714
|
|
|
8133
8715
|
function resolveSerializedZodOutput(obj) {
|
|
@@ -8157,22 +8739,22 @@ function CodeBlockDemo({
|
|
|
8157
8739
|
|
|
8158
8740
|
const WorkflowRunContext = createContext({});
|
|
8159
8741
|
function WorkflowRunProvider({ children }) {
|
|
8742
|
+
const [legacyResult, setLegacyResult] = useState(null);
|
|
8160
8743
|
const [result, setResult] = useState(null);
|
|
8161
|
-
const [vNextResult, setVNextResult] = useState(null);
|
|
8162
8744
|
const [payload, setPayload] = useState(null);
|
|
8163
8745
|
const clearData = () => {
|
|
8746
|
+
setLegacyResult(null);
|
|
8164
8747
|
setResult(null);
|
|
8165
|
-
setVNextResult(null);
|
|
8166
8748
|
setPayload(null);
|
|
8167
8749
|
};
|
|
8168
8750
|
return /* @__PURE__ */ jsx(
|
|
8169
8751
|
WorkflowRunContext.Provider,
|
|
8170
8752
|
{
|
|
8171
8753
|
value: {
|
|
8754
|
+
legacyResult,
|
|
8755
|
+
setLegacyResult,
|
|
8172
8756
|
result,
|
|
8173
8757
|
setResult,
|
|
8174
|
-
vNextResult,
|
|
8175
|
-
setVNextResult,
|
|
8176
8758
|
payload,
|
|
8177
8759
|
setPayload,
|
|
8178
8760
|
clearData
|
|
@@ -8182,16 +8764,81 @@ function WorkflowRunProvider({ children }) {
|
|
|
8182
8764
|
);
|
|
8183
8765
|
}
|
|
8184
8766
|
|
|
8185
|
-
|
|
8767
|
+
const WorkflowCard = ({ header, children, footer }) => {
|
|
8768
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface4", children: [
|
|
8769
|
+
/* @__PURE__ */ jsx("div", { className: "py-1 px-2 flex items-center gap-3", children: header }),
|
|
8770
|
+
children && /* @__PURE__ */ jsx("div", { className: "border-t-sm border-border1", children }),
|
|
8771
|
+
footer && /* @__PURE__ */ jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
|
|
8772
|
+
] });
|
|
8773
|
+
};
|
|
8774
|
+
|
|
8775
|
+
const LegacyWorkflowStatus = ({ stepId, pathStatus, path }) => {
|
|
8776
|
+
const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : pathStatus === "executing" ? "Executing" : "Completed";
|
|
8777
|
+
return /* @__PURE__ */ jsx(
|
|
8778
|
+
WorkflowCard,
|
|
8779
|
+
{
|
|
8780
|
+
header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
8781
|
+
/* @__PURE__ */ jsxs(Icon, { children: [
|
|
8782
|
+
status === "Completed" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
|
|
8783
|
+
status === "Failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
|
|
8784
|
+
status === "Executing" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon3 animate-spin" })
|
|
8785
|
+
] }),
|
|
8786
|
+
/* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: path })
|
|
8787
|
+
] })
|
|
8788
|
+
}
|
|
8789
|
+
);
|
|
8790
|
+
};
|
|
8791
|
+
|
|
8792
|
+
const WorkflowResult = ({ jsonResult, sanitizedJsonResult }) => {
|
|
8793
|
+
const { handleCopy } = useCopyToClipboard({ text: jsonResult });
|
|
8794
|
+
const [expanded, setExpanded] = useState(false);
|
|
8795
|
+
return /* @__PURE__ */ jsx(
|
|
8796
|
+
WorkflowCard,
|
|
8797
|
+
{
|
|
8798
|
+
header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-between w-full", children: [
|
|
8799
|
+
/* @__PURE__ */ jsxs(Txt, { variant: "ui-lg", className: "text-icon6 flex items-center gap-3 font-medium", children: [
|
|
8800
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(DeploymentIcon, {}) }),
|
|
8801
|
+
"Results"
|
|
8802
|
+
] }),
|
|
8803
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8804
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
8805
|
+
"button",
|
|
8806
|
+
{
|
|
8807
|
+
className: "p-2 rounded-lg hover:bg-surface5 transition-colors duration-150 ease-in-out text-icon3 hover:text-icon6",
|
|
8808
|
+
onClick: () => handleCopy(),
|
|
8809
|
+
children: /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(CopyIcon, {}) })
|
|
8810
|
+
}
|
|
8811
|
+
) }),
|
|
8812
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Copy result" })
|
|
8813
|
+
] })
|
|
8814
|
+
] }),
|
|
8815
|
+
footer: /* @__PURE__ */ jsx(
|
|
8816
|
+
"button",
|
|
8817
|
+
{
|
|
8818
|
+
className: "w-full h-full text-center text-icon2 hover:text-icon6 text-ui-md",
|
|
8819
|
+
onClick: () => setExpanded((s) => !s),
|
|
8820
|
+
children: expanded ? "collapse" : "expand"
|
|
8821
|
+
}
|
|
8822
|
+
),
|
|
8823
|
+
children: expanded ? /* @__PURE__ */ jsx(CodeBlockDemo, { className: "w-full overflow-x-auto", code: sanitizedJsonResult || jsonResult, language: "json" }) : null
|
|
8824
|
+
}
|
|
8825
|
+
);
|
|
8826
|
+
};
|
|
8827
|
+
|
|
8828
|
+
function LegacyWorkflowTrigger({
|
|
8186
8829
|
workflowId,
|
|
8187
8830
|
baseUrl,
|
|
8188
8831
|
setRunId
|
|
8189
8832
|
}) {
|
|
8190
|
-
const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
8191
|
-
const { isLoading, workflow } =
|
|
8192
|
-
const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8193
|
-
const {
|
|
8194
|
-
|
|
8833
|
+
const { legacyResult: result, setLegacyResult: setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
8834
|
+
const { isLoading, legacyWorkflow: workflow } = useLegacyWorkflow(workflowId, baseUrl);
|
|
8835
|
+
const { createLegacyWorkflowRun: createWorkflowRun, startLegacyWorkflowRun: startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8836
|
+
const {
|
|
8837
|
+
watchLegacyWorkflow: watchWorkflow,
|
|
8838
|
+
legacyWatchResult: watchResult,
|
|
8839
|
+
isWatchingLegacyWorkflow: isWatchingWorkflow
|
|
8840
|
+
} = useWatchWorkflow(baseUrl);
|
|
8841
|
+
const { resumeLegacyWorkflow: resumeWorkflow, isResumingLegacyWorkflow: isResumingWorkflow } = useResumeWorkflow(baseUrl);
|
|
8195
8842
|
const [suspendedSteps, setSuspendedSteps] = useState([]);
|
|
8196
8843
|
const [isRunning, setIsRunning] = useState(false);
|
|
8197
8844
|
const triggerSchema = workflow?.triggerSchema;
|
|
@@ -8222,7 +8869,7 @@ function WorkflowTrigger({
|
|
|
8222
8869
|
});
|
|
8223
8870
|
};
|
|
8224
8871
|
const watchResultToUse = result ?? watchResult;
|
|
8225
|
-
const workflowActivePaths = watchResultToUse?.activePaths ??
|
|
8872
|
+
const workflowActivePaths = watchResultToUse?.activePaths ?? {};
|
|
8226
8873
|
useEffect(() => {
|
|
8227
8874
|
setIsRunning(isWatchingWorkflow);
|
|
8228
8875
|
}, [isWatchingWorkflow]);
|
|
@@ -8250,50 +8897,34 @@ function WorkflowTrigger({
|
|
|
8250
8897
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8251
8898
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
|
|
8252
8899
|
const { sanitizedOutput, ...restResult } = result ?? {};
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8259
|
-
" Resuming workflow"
|
|
8260
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
8261
|
-
] }),
|
|
8262
|
-
/* @__PURE__ */ jsx(
|
|
8263
|
-
DynamicForm,
|
|
8264
|
-
{
|
|
8265
|
-
schema: zodInputSchema,
|
|
8266
|
-
defaultValues: payload,
|
|
8267
|
-
isSubmitLoading: isWatchingWorkflow,
|
|
8268
|
-
onSubmit: (data) => {
|
|
8269
|
-
setPayload(data);
|
|
8270
|
-
handleExecuteWorkflow(data);
|
|
8271
|
-
}
|
|
8272
|
-
}
|
|
8273
|
-
)
|
|
8274
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "px-4 space-y-4", children: [
|
|
8275
|
-
isResumingWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
8276
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8277
|
-
" Resuming workflow"
|
|
8278
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {}),
|
|
8279
|
-
/* @__PURE__ */ jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
|
|
8280
|
-
] }) }),
|
|
8281
|
-
Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8282
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8283
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
|
|
8284
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
|
|
8285
|
-
const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : "Completed";
|
|
8286
|
-
const statusIcon = status === "Completed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "Failed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
|
|
8287
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between p-3`, children: [
|
|
8288
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: path.charAt(0).toUpperCase() + path.slice(1) }),
|
|
8289
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8290
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
|
|
8291
|
-
status
|
|
8292
|
-
] })
|
|
8293
|
-
] }) }, idx);
|
|
8294
|
-
}) });
|
|
8295
|
-
}) })
|
|
8900
|
+
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
8901
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8902
|
+
isResumingWorkflow && /* @__PURE__ */ jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
|
|
8903
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
|
|
8904
|
+
/* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
|
|
8296
8905
|
] }),
|
|
8906
|
+
!isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsx(
|
|
8907
|
+
DynamicForm,
|
|
8908
|
+
{
|
|
8909
|
+
schema: zodInputSchema,
|
|
8910
|
+
defaultValues: payload,
|
|
8911
|
+
isSubmitLoading: isWatchingWorkflow,
|
|
8912
|
+
submitButtonLabel: "Run",
|
|
8913
|
+
onSubmit: (data) => {
|
|
8914
|
+
setPayload(data);
|
|
8915
|
+
handleExecuteWorkflow(data);
|
|
8916
|
+
}
|
|
8917
|
+
}
|
|
8918
|
+
) : /* @__PURE__ */ jsx(
|
|
8919
|
+
Button,
|
|
8920
|
+
{
|
|
8921
|
+
className: "w-full",
|
|
8922
|
+
variant: "light",
|
|
8923
|
+
disabled: isRunning,
|
|
8924
|
+
onClick: () => handleExecuteWorkflow(null),
|
|
8925
|
+
children: isRunning ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : "Trigger"
|
|
8926
|
+
}
|
|
8927
|
+
) }),
|
|
8297
8928
|
isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8298
8929
|
const stepDefinition = workflow.steps[step.stepId];
|
|
8299
8930
|
const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.inputSchema))) : z.record(z.string(), z.any());
|
|
@@ -8325,29 +8956,23 @@ function WorkflowTrigger({
|
|
|
8325
8956
|
)
|
|
8326
8957
|
] });
|
|
8327
8958
|
}),
|
|
8328
|
-
|
|
8329
|
-
/* @__PURE__ */ jsx(
|
|
8330
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
/* @__PURE__ */ jsx(
|
|
8338
|
-
|
|
8339
|
-
{
|
|
8340
|
-
className: "w-full overflow-x-auto",
|
|
8341
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8342
|
-
language: "json"
|
|
8343
|
-
}
|
|
8344
|
-
)
|
|
8959
|
+
hasWorkflowActivePaths && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8960
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8961
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
|
|
8962
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
|
|
8963
|
+
return /* @__PURE__ */ jsx(LegacyWorkflowStatus, { stepId, pathStatus, path }, idx);
|
|
8964
|
+
}) }, stepId);
|
|
8965
|
+
}) })
|
|
8966
|
+
] }),
|
|
8967
|
+
result && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8968
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8969
|
+
/* @__PURE__ */ jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
|
|
8345
8970
|
] })
|
|
8346
8971
|
] }) });
|
|
8347
8972
|
}
|
|
8348
8973
|
|
|
8349
|
-
function
|
|
8350
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
8974
|
+
function WorkflowNestedGraph({ stepGraph, open }) {
|
|
8975
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
|
|
8351
8976
|
stepGraph
|
|
8352
8977
|
});
|
|
8353
8978
|
const [isMounted, setIsMounted] = useState(false);
|
|
@@ -8358,7 +8983,7 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8358
8983
|
"condition-node": WorkflowConditionNode,
|
|
8359
8984
|
"after-node": WorkflowAfterNode,
|
|
8360
8985
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8361
|
-
"nested-node":
|
|
8986
|
+
"nested-node": WorkflowNestedNode
|
|
8362
8987
|
};
|
|
8363
8988
|
useEffect(() => {
|
|
8364
8989
|
if (open) {
|
|
@@ -8385,10 +9010,10 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8385
9010
|
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) });
|
|
8386
9011
|
}
|
|
8387
9012
|
|
|
8388
|
-
const
|
|
9013
|
+
const WorkflowNestedGraphContext = createContext(
|
|
8389
9014
|
{}
|
|
8390
9015
|
);
|
|
8391
|
-
function
|
|
9016
|
+
function WorkflowNestedGraphProvider({ children }) {
|
|
8392
9017
|
const [stepGraph, setStepGraph] = useState(null);
|
|
8393
9018
|
const [parentStepGraphList, setParentStepGraphList] = useState([]);
|
|
8394
9019
|
const [openDialog, setOpenDialog] = useState(false);
|
|
@@ -8426,7 +9051,7 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8426
9051
|
}, 500);
|
|
8427
9052
|
};
|
|
8428
9053
|
return /* @__PURE__ */ jsxs(
|
|
8429
|
-
|
|
9054
|
+
WorkflowNestedGraphContext.Provider,
|
|
8430
9055
|
{
|
|
8431
9056
|
value: {
|
|
8432
9057
|
showNestedGraph,
|
|
@@ -8442,16 +9067,16 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8442
9067
|
" workflow"
|
|
8443
9068
|
] })
|
|
8444
9069
|
] }),
|
|
8445
|
-
switching ? /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
9070
|
+
switching ? /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowNestedGraph, { stepGraph, open: openDialog }) })
|
|
8446
9071
|
] }) }) })
|
|
8447
9072
|
]
|
|
8448
9073
|
}
|
|
8449
9074
|
);
|
|
8450
9075
|
}
|
|
8451
9076
|
|
|
8452
|
-
function
|
|
9077
|
+
function WorkflowNestedNode({ data }) {
|
|
8453
9078
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph } = data;
|
|
8454
|
-
const { showNestedGraph } = useContext(
|
|
9079
|
+
const { showNestedGraph } = useContext(WorkflowNestedGraphContext);
|
|
8455
9080
|
return /* @__PURE__ */ jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
8456
9081
|
!withoutTopHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }),
|
|
8457
9082
|
/* @__PURE__ */ jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph }), children: /* @__PURE__ */ jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
|
|
@@ -8462,8 +9087,8 @@ function VNextWorkflowNestedNode({ data }) {
|
|
|
8462
9087
|
] });
|
|
8463
9088
|
}
|
|
8464
9089
|
|
|
8465
|
-
function
|
|
8466
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
9090
|
+
function WorkflowGraphInner({ workflow }) {
|
|
9091
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
|
|
8467
9092
|
const [nodes, _, onNodesChange] = useNodesState(initialNodes);
|
|
8468
9093
|
const [edges] = useEdgesState(initialEdges);
|
|
8469
9094
|
const nodeTypes = {
|
|
@@ -8471,7 +9096,7 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8471
9096
|
"condition-node": WorkflowConditionNode,
|
|
8472
9097
|
"after-node": WorkflowAfterNode,
|
|
8473
9098
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8474
|
-
"nested-node":
|
|
9099
|
+
"nested-node": WorkflowNestedNode
|
|
8475
9100
|
};
|
|
8476
9101
|
return /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxs(
|
|
8477
9102
|
ReactFlow,
|
|
@@ -8493,12 +9118,12 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8493
9118
|
) });
|
|
8494
9119
|
}
|
|
8495
9120
|
|
|
8496
|
-
function
|
|
8497
|
-
const {
|
|
9121
|
+
function WorkflowGraph({ workflowId, baseUrl }) {
|
|
9122
|
+
const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
|
|
8498
9123
|
if (isLoading) {
|
|
8499
9124
|
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
|
|
8500
9125
|
}
|
|
8501
|
-
if (!
|
|
9126
|
+
if (!workflow) {
|
|
8502
9127
|
return /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
8503
9128
|
/* @__PURE__ */ jsx(AlertCircleIcon, {}),
|
|
8504
9129
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -8508,120 +9133,126 @@ function VNextWorkflowGraph({ workflowId, baseUrl }) {
|
|
|
8508
9133
|
] })
|
|
8509
9134
|
] }) });
|
|
8510
9135
|
}
|
|
8511
|
-
return /* @__PURE__ */ jsx(
|
|
9136
|
+
return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowGraphInner, { workflow }) }) });
|
|
8512
9137
|
}
|
|
8513
9138
|
|
|
8514
|
-
|
|
9139
|
+
const WorkflowStatus = ({ stepId, status }) => {
|
|
9140
|
+
return /* @__PURE__ */ jsx(
|
|
9141
|
+
WorkflowCard,
|
|
9142
|
+
{
|
|
9143
|
+
header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
9144
|
+
/* @__PURE__ */ jsxs(Icon, { children: [
|
|
9145
|
+
status === "success" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
|
|
9146
|
+
status === "failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
|
|
9147
|
+
status === "suspended" && /* @__PURE__ */ jsx(CirclePause, { className: "text-icon3" }),
|
|
9148
|
+
status === "running" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon3 animate-spin" })
|
|
9149
|
+
] }),
|
|
9150
|
+
/* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) })
|
|
9151
|
+
] })
|
|
9152
|
+
}
|
|
9153
|
+
);
|
|
9154
|
+
};
|
|
9155
|
+
|
|
9156
|
+
function WorkflowTrigger({
|
|
8515
9157
|
workflowId,
|
|
8516
9158
|
baseUrl,
|
|
8517
9159
|
setRunId
|
|
8518
9160
|
}) {
|
|
8519
|
-
const {
|
|
8520
|
-
const {
|
|
8521
|
-
const {
|
|
8522
|
-
const {
|
|
8523
|
-
const {
|
|
9161
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
9162
|
+
const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
9163
|
+
const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
|
|
9164
|
+
const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
9165
|
+
const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
|
|
9166
|
+
const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
|
|
8524
9167
|
const [suspendedSteps, setSuspendedSteps] = useState([]);
|
|
8525
9168
|
const [isRunning, setIsRunning] = useState(false);
|
|
8526
|
-
const triggerSchema =
|
|
9169
|
+
const triggerSchema = workflow?.inputSchema;
|
|
8527
9170
|
const handleExecuteWorkflow = async (data) => {
|
|
8528
9171
|
try {
|
|
8529
|
-
if (!
|
|
9172
|
+
if (!workflow) return;
|
|
8530
9173
|
setIsRunning(true);
|
|
8531
|
-
|
|
8532
|
-
const { runId } = await
|
|
9174
|
+
setResult(null);
|
|
9175
|
+
const { runId } = await createWorkflowRun({ workflowId });
|
|
8533
9176
|
setRunId?.(runId);
|
|
8534
|
-
|
|
8535
|
-
|
|
9177
|
+
watchWorkflow({ workflowId, runId });
|
|
9178
|
+
startWorkflowRun({ workflowId, runId, input: data, runtimeContext });
|
|
8536
9179
|
} catch (err) {
|
|
8537
9180
|
setIsRunning(false);
|
|
8538
9181
|
toast.error("Error executing workflow");
|
|
8539
9182
|
}
|
|
8540
9183
|
};
|
|
8541
9184
|
const handleResumeWorkflow = async (step) => {
|
|
8542
|
-
if (!
|
|
9185
|
+
if (!workflow) return;
|
|
8543
9186
|
const { stepId, runId: prevRunId, resumeData } = step;
|
|
8544
|
-
const { runId } = await
|
|
8545
|
-
|
|
8546
|
-
await
|
|
9187
|
+
const { runId } = await createWorkflowRun({ workflowId, prevRunId });
|
|
9188
|
+
watchWorkflow({ workflowId, runId });
|
|
9189
|
+
await resumeWorkflow({
|
|
8547
9190
|
step: stepId,
|
|
8548
9191
|
runId,
|
|
8549
9192
|
resumeData,
|
|
8550
|
-
workflowId
|
|
9193
|
+
workflowId,
|
|
9194
|
+
runtimeContext
|
|
8551
9195
|
});
|
|
8552
9196
|
};
|
|
8553
|
-
const watchResultToUse =
|
|
9197
|
+
const watchResultToUse = result ?? watchResult;
|
|
8554
9198
|
const workflowActivePaths = watchResultToUse?.payload?.workflowState?.steps ?? {};
|
|
8555
9199
|
useEffect(() => {
|
|
8556
|
-
setIsRunning(
|
|
8557
|
-
}, [
|
|
9200
|
+
setIsRunning(isWatchingWorkflow);
|
|
9201
|
+
}, [isWatchingWorkflow]);
|
|
8558
9202
|
useEffect(() => {
|
|
8559
|
-
if (!watchResultToUse?.payload?.workflowState?.steps || !
|
|
9203
|
+
if (!watchResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
|
|
8560
9204
|
const suspended = Object.entries(watchResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
8561
9205
|
stepId,
|
|
8562
|
-
runId:
|
|
9206
|
+
runId: result.runId,
|
|
8563
9207
|
suspendPayload: payload2
|
|
8564
9208
|
}));
|
|
8565
9209
|
setSuspendedSteps(suspended);
|
|
8566
|
-
}, [watchResultToUse,
|
|
9210
|
+
}, [watchResultToUse, result]);
|
|
8567
9211
|
useEffect(() => {
|
|
8568
|
-
if (
|
|
8569
|
-
|
|
9212
|
+
if (watchResult) {
|
|
9213
|
+
setResult(watchResult);
|
|
8570
9214
|
}
|
|
8571
|
-
}, [
|
|
9215
|
+
}, [watchResult]);
|
|
8572
9216
|
if (isLoading) {
|
|
8573
9217
|
return /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8574
9218
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-10" }),
|
|
8575
9219
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-10" })
|
|
8576
9220
|
] }) });
|
|
8577
9221
|
}
|
|
8578
|
-
if (!
|
|
9222
|
+
if (!workflow) return null;
|
|
8579
9223
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8580
9224
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
|
|
8581
|
-
const { sanitizedOutput, ...restResult } =
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8588
|
-
" Resuming workflow"
|
|
8589
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
8590
|
-
] }),
|
|
8591
|
-
/* @__PURE__ */ jsx(
|
|
8592
|
-
DynamicForm,
|
|
8593
|
-
{
|
|
8594
|
-
schema: zodInputSchema,
|
|
8595
|
-
defaultValues: payload,
|
|
8596
|
-
isSubmitLoading: isWatchingVNextWorkflow,
|
|
8597
|
-
onSubmit: (data) => {
|
|
8598
|
-
setPayload(data);
|
|
8599
|
-
handleExecuteWorkflow(data);
|
|
8600
|
-
}
|
|
8601
|
-
}
|
|
8602
|
-
)
|
|
8603
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "px-4 space-y-4", children: [
|
|
8604
|
-
isResumingVNextWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
8605
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8606
|
-
" Resuming workflow"
|
|
8607
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {}),
|
|
8608
|
-
/* @__PURE__ */ jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
|
|
8609
|
-
] }) }),
|
|
8610
|
-
Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8611
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8612
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
|
|
8613
|
-
const statusIcon = status === "success" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "failed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
|
|
8614
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between p-3`, children: [
|
|
8615
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) }),
|
|
8616
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 capitalize", children: [
|
|
8617
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
|
|
8618
|
-
status
|
|
8619
|
-
] })
|
|
8620
|
-
] }) }, stepId) });
|
|
8621
|
-
}) })
|
|
9225
|
+
const { sanitizedOutput, ...restResult } = result ?? {};
|
|
9226
|
+
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
9227
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
9228
|
+
isResumingWorkflow && /* @__PURE__ */ jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
|
|
9229
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
|
|
9230
|
+
/* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
|
|
8622
9231
|
] }),
|
|
8623
|
-
!
|
|
8624
|
-
|
|
9232
|
+
!isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsx(
|
|
9233
|
+
DynamicForm,
|
|
9234
|
+
{
|
|
9235
|
+
schema: zodInputSchema,
|
|
9236
|
+
defaultValues: payload,
|
|
9237
|
+
isSubmitLoading: isWatchingWorkflow,
|
|
9238
|
+
submitButtonLabel: "Run",
|
|
9239
|
+
onSubmit: (data) => {
|
|
9240
|
+
setPayload(data);
|
|
9241
|
+
handleExecuteWorkflow(data);
|
|
9242
|
+
}
|
|
9243
|
+
}
|
|
9244
|
+
) : /* @__PURE__ */ jsx(
|
|
9245
|
+
Button,
|
|
9246
|
+
{
|
|
9247
|
+
className: "w-full",
|
|
9248
|
+
variant: "light",
|
|
9249
|
+
disabled: isRunning,
|
|
9250
|
+
onClick: () => handleExecuteWorkflow(null),
|
|
9251
|
+
children: isRunning ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : "Trigger"
|
|
9252
|
+
}
|
|
9253
|
+
) }),
|
|
9254
|
+
!isWatchingWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
9255
|
+
const stepDefinition = workflow.steps[step.stepId];
|
|
8625
9256
|
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.resumeSchema))) : z.record(z.string(), z.any());
|
|
8626
9257
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-4", children: [
|
|
8627
9258
|
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
|
|
@@ -8637,7 +9268,7 @@ function VNextWorkflowTrigger({
|
|
|
8637
9268
|
DynamicForm,
|
|
8638
9269
|
{
|
|
8639
9270
|
schema: stepSchema,
|
|
8640
|
-
isSubmitLoading:
|
|
9271
|
+
isSubmitLoading: isResumingWorkflow,
|
|
8641
9272
|
submitButtonLabel: "Resume",
|
|
8642
9273
|
onSubmit: (data) => {
|
|
8643
9274
|
handleResumeWorkflow({
|
|
@@ -8651,23 +9282,18 @@ function VNextWorkflowTrigger({
|
|
|
8651
9282
|
)
|
|
8652
9283
|
] });
|
|
8653
9284
|
}),
|
|
8654
|
-
|
|
8655
|
-
/* @__PURE__ */ jsx(
|
|
8656
|
-
/* @__PURE__ */
|
|
8657
|
-
|
|
8658
|
-
{
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
className: "w-full overflow-x-auto",
|
|
8667
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8668
|
-
language: "json"
|
|
8669
|
-
}
|
|
8670
|
-
)
|
|
9285
|
+
hasWorkflowActivePaths && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9286
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
9287
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
9288
|
+
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
9289
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
|
|
9290
|
+
return /* @__PURE__ */ jsx(WorkflowStatus, { stepId, status });
|
|
9291
|
+
}) })
|
|
9292
|
+
] })
|
|
9293
|
+
] }),
|
|
9294
|
+
result && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9295
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
9296
|
+
/* @__PURE__ */ jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
|
|
8671
9297
|
] })
|
|
8672
9298
|
] }) });
|
|
8673
9299
|
}
|
|
@@ -8681,7 +9307,8 @@ const DataTable = ({
|
|
|
8681
9307
|
getRowId,
|
|
8682
9308
|
selectedRowId,
|
|
8683
9309
|
isLoading,
|
|
8684
|
-
emptyText
|
|
9310
|
+
emptyText,
|
|
9311
|
+
onClick
|
|
8685
9312
|
}) => {
|
|
8686
9313
|
const [sorting, setSorting] = useState([]);
|
|
8687
9314
|
const [{ pageIndex, pageSize }, setPagination] = useState({
|
|
@@ -8723,7 +9350,16 @@ const DataTable = ({
|
|
|
8723
9350
|
const meta = header.column.columnDef.meta;
|
|
8724
9351
|
return /* @__PURE__ */ jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
8725
9352
|
}) }),
|
|
8726
|
-
/* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsx(Row, {
|
|
9353
|
+
/* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsx(Row, { onClick: () => {
|
|
9354
|
+
}, children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsx(
|
|
9355
|
+
Row,
|
|
9356
|
+
{
|
|
9357
|
+
"data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected",
|
|
9358
|
+
onClick: () => onClick?.(row.original),
|
|
9359
|
+
children: row.getVisibleCells().map((cell) => flexRender(cell.column.columnDef.cell, cell.getContext()))
|
|
9360
|
+
},
|
|
9361
|
+
row.id
|
|
9362
|
+
)) : emptyNode })
|
|
8727
9363
|
] }),
|
|
8728
9364
|
pagination && /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
|
|
8729
9365
|
/* @__PURE__ */ jsxs("div", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -8860,6 +9496,56 @@ const DarkLogo = (props) => /* @__PURE__ */ jsxs("svg", { width: "100", height:
|
|
|
8860
9496
|
)
|
|
8861
9497
|
] });
|
|
8862
9498
|
|
|
9499
|
+
const Entity = ({ children, className, onClick }) => {
|
|
9500
|
+
return /* @__PURE__ */ jsx(
|
|
9501
|
+
"div",
|
|
9502
|
+
{
|
|
9503
|
+
tabIndex: onClick ? 0 : void 0,
|
|
9504
|
+
onKeyDown: (e) => {
|
|
9505
|
+
if (!onClick) return;
|
|
9506
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
9507
|
+
e.preventDefault();
|
|
9508
|
+
onClick?.();
|
|
9509
|
+
}
|
|
9510
|
+
},
|
|
9511
|
+
className: clsx(
|
|
9512
|
+
"flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
|
|
9513
|
+
onClick && "cursor-pointer hover:bg-surface4 transition-all",
|
|
9514
|
+
className
|
|
9515
|
+
),
|
|
9516
|
+
onClick,
|
|
9517
|
+
children
|
|
9518
|
+
}
|
|
9519
|
+
);
|
|
9520
|
+
};
|
|
9521
|
+
const EntityIcon = ({ children, className }) => {
|
|
9522
|
+
return /* @__PURE__ */ jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
|
|
9523
|
+
};
|
|
9524
|
+
const EntityName = ({ children, className }) => {
|
|
9525
|
+
return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
|
|
9526
|
+
};
|
|
9527
|
+
const EntityDescription = ({ children, className }) => {
|
|
9528
|
+
return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
|
|
9529
|
+
};
|
|
9530
|
+
const EntityContent = ({ children, className }) => {
|
|
9531
|
+
return /* @__PURE__ */ jsx("div", { className, children });
|
|
9532
|
+
};
|
|
9533
|
+
|
|
9534
|
+
const EmptyState = ({
|
|
9535
|
+
iconSlot,
|
|
9536
|
+
titleSlot,
|
|
9537
|
+
descriptionSlot,
|
|
9538
|
+
actionSlot,
|
|
9539
|
+
as: Component = "div"
|
|
9540
|
+
}) => {
|
|
9541
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-[340px] flex-col items-center justify-center text-center", children: [
|
|
9542
|
+
/* @__PURE__ */ jsx("div", { className: "h-auto [&>svg]:w-[126px]", children: iconSlot }),
|
|
9543
|
+
/* @__PURE__ */ jsx(Component, { className: "text-icon6 pt-[34px] font-serif text-[1.75rem] font-semibold", children: titleSlot }),
|
|
9544
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-lg", className: "text-icon3 pb-[34px]", children: descriptionSlot }),
|
|
9545
|
+
actionSlot
|
|
9546
|
+
] });
|
|
9547
|
+
};
|
|
9548
|
+
|
|
8863
9549
|
function usePolling({
|
|
8864
9550
|
fetchFn,
|
|
8865
9551
|
interval = 3e3,
|
|
@@ -9014,5 +9700,5 @@ const useTraces = (componentName, baseUrl, isWorkflow = false) => {
|
|
|
9014
9700
|
return { traces, firstCallLoading, error };
|
|
9015
9701
|
};
|
|
9016
9702
|
|
|
9017
|
-
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LogsIcon, MastraResizablePanel, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell,
|
|
9703
|
+
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentNetworkCoinIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, usePlaygroundStore, usePolling, useSpeechRecognition, useTraces };
|
|
9018
9704
|
//# sourceMappingURL=index.es.js.map
|