@mastra/playground-ui 6.2.4 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -0
- package/dist/index.cjs.js +312 -1364
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +313 -1362
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/agents/components/agent-metadata/agent-metadata-model-switcher.d.ts +1 -1
- package/dist/src/domains/workflows/runs/workflow-runs.d.ts +4 -2
- package/dist/src/domains/workflows/workflow/workflow-input-data.d.ts +2 -1
- package/dist/src/domains/workflows/workflow/workflow-trigger.d.ts +8 -7
- package/dist/src/ds/components/Alert/Alert.d.ts +17 -0
- package/dist/src/ds/components/Alert/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/types.d.ts +1 -2
- package/package.json +7 -7
- package/dist/src/components/assistant-ui/network-threads.d.ts +0 -10
- package/dist/src/domains/networks/components/network-table/columns.d.ts +0 -3
- package/dist/src/domains/networks/components/network-table/network-table.d.ts +0 -8
- package/dist/src/domains/networks/components/network-table/types.d.ts +0 -9
- package/dist/src/domains/networks/index.d.ts +0 -3
- package/dist/src/domains/networks/network-context.d.ts +0 -16
- package/dist/src/domains/networks/tool-fallback.d.ts +0 -2
- package/dist/src/domains/networks/v-next/network-chat.d.ts +0 -9
- package/dist/src/domains/networks/v-next/step-dropdown.d.ts +0 -1
- package/dist/src/domains/networks/v-next/tool-fallback.d.ts +0 -0
- package/dist/src/domains/networks/v-next/wrapped-assistant-message.d.ts +0 -5
- package/dist/src/services/vnext-network-chat-provider.d.ts +0 -17
- package/dist/src/services/vnext-network-runtime-provider.d.ts +0 -9
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useMessagePart, useMessage, MessagePrimitive, ActionBarPrimitive, useAttachment, AttachmentPrimitive, useComposerRuntime, ComposerPrimitive, useComposer, ThreadPrimitive, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechSynthesisAdapter, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
3
|
-
import { CheckIcon as CheckIcon$1, CopyIcon, AlertCircle, Check, Copy, ChevronUpIcon, X, Share2, Braces, Loader2, Network, ChevronDown, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Plus, Maximize, Workflow, AlertCircleIcon, ChevronDownIcon, CirclePause, CalendarIcon, Brackets, PlusIcon, TrashIcon, Circle, StopCircle, BrainIcon, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, XIcon, ChevronsRightIcon, ArrowUpIcon, ArrowDownIcon, AlignLeftIcon, AlignJustifyIcon, CircleAlertIcon, GaugeIcon, HashIcon, Info, GripVertical,
|
|
3
|
+
import { CheckIcon as CheckIcon$1, CopyIcon, AlertCircle, Check, Copy, ChevronUpIcon, X, Share2, Braces, Loader2, Network, ChevronDown, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Plus, Maximize, Workflow, AlertCircleIcon, ChevronDownIcon, CirclePause, CalendarIcon, Brackets, PlusIcon, TrashIcon, Circle, StopCircle, ChevronLeftIcon, BrainIcon, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, XIcon, ChevronsRightIcon, ArrowUpIcon, ArrowDownIcon, AlignLeftIcon, AlignJustifyIcon, CircleAlertIcon, GaugeIcon, HashIcon, TriangleAlert, Info, GripVertical, SearchIcon, NetworkIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, AlertTriangleIcon, FrownIcon, ChevronUp, ChevronsLeftRight, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, ListTreeIcon, ArrowRightToLineIcon, CoinsIcon, EyeIcon, ChevronsLeftRightEllipsisIcon, PanelTopIcon, PanelLeftIcon } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { forwardRef, memo, useState, useEffect, useRef, useCallback, useMemo, createContext, useContext, Fragment as Fragment$1, isValidElement, useId, startTransition } from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -24,7 +24,7 @@ import Dagre from '@dagrejs/dagre';
|
|
|
24
24
|
import { Highlight, themes } from 'prism-react-renderer';
|
|
25
25
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
26
26
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
27
|
-
import {
|
|
27
|
+
import { I as IconColors } from './colors-DrbbnW3f.js';
|
|
28
28
|
import prettier from 'prettier';
|
|
29
29
|
import prettierPluginBabel from 'prettier/plugins/babel';
|
|
30
30
|
import prettierPluginEstree from 'prettier/plugins/estree';
|
|
@@ -47,7 +47,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
|
|
|
47
47
|
import { ZodProvider, getFieldConfigInZodStack, getDefaultValueInZodStack } from '@autoform/zod/v4';
|
|
48
48
|
import { z as z$1 } from 'zod/v3';
|
|
49
49
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
50
|
-
import { useMastraClient, useChat } from '@mastra/react';
|
|
50
|
+
import { useMastraClient, useChat, toAssistantUIMessage } from '@mastra/react';
|
|
51
51
|
import { useQuery, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
52
52
|
import './index.css';export * from '@tanstack/react-query';
|
|
53
53
|
import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
@@ -63,7 +63,6 @@ import * as HoverCard from '@radix-ui/react-hover-card';
|
|
|
63
63
|
import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd';
|
|
64
64
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
65
65
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
66
|
-
import { RuntimeContext as RuntimeContext$2 } from '@mastra/core/runtime-context';
|
|
67
66
|
import { format as format$1 } from 'date-fns/format';
|
|
68
67
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
69
68
|
|
|
@@ -4313,7 +4312,7 @@ const SyntaxHighlighter$2 = ({
|
|
|
4313
4312
|
] });
|
|
4314
4313
|
};
|
|
4315
4314
|
|
|
4316
|
-
const variantClasses$
|
|
4315
|
+
const variantClasses$3 = {
|
|
4317
4316
|
default: "text-icon3",
|
|
4318
4317
|
success: "text-accent1",
|
|
4319
4318
|
error: "text-accent2",
|
|
@@ -4326,12 +4325,12 @@ const Badge$1 = ({ icon, variant = "default", className, children, ...props }) =
|
|
|
4326
4325
|
className: clsx(
|
|
4327
4326
|
"bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
|
|
4328
4327
|
icon ? "pl-md pr-1.5" : "px-1.5",
|
|
4329
|
-
icon || variant === "default" ? "text-icon5" : variantClasses$
|
|
4328
|
+
icon || variant === "default" ? "text-icon5" : variantClasses$3[variant],
|
|
4330
4329
|
className
|
|
4331
4330
|
),
|
|
4332
4331
|
...props,
|
|
4333
4332
|
children: [
|
|
4334
|
-
icon && /* @__PURE__ */ jsx("span", { className: variantClasses$
|
|
4333
|
+
icon && /* @__PURE__ */ jsx("span", { className: variantClasses$3[variant], children: /* @__PURE__ */ jsx(Icon, { children: icon }) }),
|
|
4335
4334
|
children
|
|
4336
4335
|
]
|
|
4337
4336
|
}
|
|
@@ -4576,7 +4575,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4576
4575
|
workflowState: {
|
|
4577
4576
|
...prev?.payload?.workflowState,
|
|
4578
4577
|
status: "running",
|
|
4579
|
-
steps: {}
|
|
4578
|
+
steps: prev?.runId === chunk.runId ? prev?.payload?.workflowState?.steps ?? {} : {}
|
|
4580
4579
|
}
|
|
4581
4580
|
}
|
|
4582
4581
|
};
|
|
@@ -4585,6 +4584,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4585
4584
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4586
4585
|
return {
|
|
4587
4586
|
...prev,
|
|
4587
|
+
runId: chunk.runId,
|
|
4588
4588
|
payload: {
|
|
4589
4589
|
...prev.payload,
|
|
4590
4590
|
currentStep: {
|
|
@@ -4609,6 +4609,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4609
4609
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4610
4610
|
return {
|
|
4611
4611
|
...prev,
|
|
4612
|
+
runId: chunk.runId,
|
|
4612
4613
|
payload: {
|
|
4613
4614
|
...prev?.payload,
|
|
4614
4615
|
currentStep: {
|
|
@@ -4635,6 +4636,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4635
4636
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4636
4637
|
return {
|
|
4637
4638
|
...prev,
|
|
4639
|
+
runId: chunk.runId,
|
|
4638
4640
|
payload: {
|
|
4639
4641
|
...prev?.payload,
|
|
4640
4642
|
currentStep: {
|
|
@@ -4662,6 +4664,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4662
4664
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4663
4665
|
const next = {
|
|
4664
4666
|
...prev,
|
|
4667
|
+
runId: chunk.runId,
|
|
4665
4668
|
payload: {
|
|
4666
4669
|
...prev?.payload,
|
|
4667
4670
|
currentStep: {
|
|
@@ -4688,6 +4691,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4688
4691
|
if (chunk.type === "workflow-canceled") {
|
|
4689
4692
|
return {
|
|
4690
4693
|
...prev,
|
|
4694
|
+
runId: chunk.runId,
|
|
4691
4695
|
payload: {
|
|
4692
4696
|
...prev?.payload,
|
|
4693
4697
|
workflowState: {
|
|
@@ -4701,6 +4705,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4701
4705
|
if (chunk.type === "workflow-finish") {
|
|
4702
4706
|
return {
|
|
4703
4707
|
...prev,
|
|
4708
|
+
runId: chunk.runId,
|
|
4704
4709
|
payload: {
|
|
4705
4710
|
...prev?.payload,
|
|
4706
4711
|
currentStep: void 0,
|
|
@@ -4723,7 +4728,7 @@ function WorkflowRunProvider({
|
|
|
4723
4728
|
const [result, setResult] = useState(
|
|
4724
4729
|
() => snapshot ? convertWorkflowRunStateToWatchResult(snapshot) : null
|
|
4725
4730
|
);
|
|
4726
|
-
const [payload, setPayload] = useState(null);
|
|
4731
|
+
const [payload, setPayload] = useState(() => snapshot?.context?.input ?? null);
|
|
4727
4732
|
const clearData = () => {
|
|
4728
4733
|
setResult(null);
|
|
4729
4734
|
setPayload(null);
|
|
@@ -4731,6 +4736,7 @@ function WorkflowRunProvider({
|
|
|
4731
4736
|
useEffect(() => {
|
|
4732
4737
|
if (snapshot?.runId) {
|
|
4733
4738
|
setResult(convertWorkflowRunStateToWatchResult(snapshot));
|
|
4739
|
+
setPayload(snapshot.context?.input);
|
|
4734
4740
|
}
|
|
4735
4741
|
}, [snapshot]);
|
|
4736
4742
|
return /* @__PURE__ */ jsx(
|
|
@@ -5255,7 +5261,7 @@ const sizeClasses = {
|
|
|
5255
5261
|
md: "h-button-md gap-md",
|
|
5256
5262
|
lg: "h-button-lg gap-lg"
|
|
5257
5263
|
};
|
|
5258
|
-
const variantClasses$
|
|
5264
|
+
const variantClasses$2 = {
|
|
5259
5265
|
default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6",
|
|
5260
5266
|
light: "bg-surface3 hover:bg-surface5 text-icon6"
|
|
5261
5267
|
};
|
|
@@ -5266,7 +5272,7 @@ const Button$1 = ({ className, as, size = "md", variant = "default", ...props })
|
|
|
5266
5272
|
{
|
|
5267
5273
|
className: clsx(
|
|
5268
5274
|
"bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
|
|
5269
|
-
variantClasses$
|
|
5275
|
+
variantClasses$2[variant],
|
|
5270
5276
|
sizeClasses[size],
|
|
5271
5277
|
className,
|
|
5272
5278
|
{
|
|
@@ -5286,7 +5292,7 @@ const useCodemirrorTheme$1 = () => {
|
|
|
5286
5292
|
fontSize: "0.8rem",
|
|
5287
5293
|
lineHighlight: "transparent",
|
|
5288
5294
|
gutterBackground: "transparent",
|
|
5289
|
-
gutterForeground:
|
|
5295
|
+
gutterForeground: IconColors.icon3,
|
|
5290
5296
|
background: "transparent"
|
|
5291
5297
|
},
|
|
5292
5298
|
styles: [{ tag: [tags.className, tags.propertyName] }]
|
|
@@ -6225,20 +6231,20 @@ const alertVariants = cva(
|
|
|
6225
6231
|
}
|
|
6226
6232
|
}
|
|
6227
6233
|
);
|
|
6228
|
-
const Alert = React.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
6229
|
-
Alert.displayName = "Alert";
|
|
6230
|
-
const AlertTitle = React.forwardRef(
|
|
6234
|
+
const Alert$1 = React.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
6235
|
+
Alert$1.displayName = "Alert";
|
|
6236
|
+
const AlertTitle$1 = React.forwardRef(
|
|
6231
6237
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("h5", { ref, className: cn("mb-1 font-medium leading-none tracking-tight", className), ...props })
|
|
6232
6238
|
);
|
|
6233
|
-
AlertTitle.displayName = "AlertTitle";
|
|
6234
|
-
const AlertDescription = React.forwardRef(
|
|
6239
|
+
AlertTitle$1.displayName = "AlertTitle";
|
|
6240
|
+
const AlertDescription$1 = React.forwardRef(
|
|
6235
6241
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm [&_p]:leading-relaxed", className), ...props })
|
|
6236
6242
|
);
|
|
6237
|
-
AlertDescription.displayName = "AlertDescription";
|
|
6243
|
+
AlertDescription$1.displayName = "AlertDescription";
|
|
6238
6244
|
|
|
6239
|
-
const ErrorMessage = ({ error }) => /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
|
|
6245
|
+
const ErrorMessage = ({ error }) => /* @__PURE__ */ jsxs(Alert$1, { variant: "destructive", children: [
|
|
6240
6246
|
/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
6241
|
-
/* @__PURE__ */ jsx(AlertTitle, { children: error })
|
|
6247
|
+
/* @__PURE__ */ jsx(AlertTitle$1, { children: error })
|
|
6242
6248
|
] });
|
|
6243
6249
|
|
|
6244
6250
|
const SubmitButton = ({ children }) => /* @__PURE__ */ jsx(Button$2, { type: "submit", children });
|
|
@@ -6426,7 +6432,8 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
|
|
|
6426
6432
|
align,
|
|
6427
6433
|
sideOffset,
|
|
6428
6434
|
className: clsx(
|
|
6429
|
-
"z-50 w-72 rounded-md border bg-popover
|
|
6435
|
+
"z-50 w-72 rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
6436
|
+
className?.includes(` p-`) ? false : `p-4`,
|
|
6430
6437
|
className
|
|
6431
6438
|
),
|
|
6432
6439
|
...props
|
|
@@ -7055,6 +7062,7 @@ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
|
7055
7062
|
const WorkflowInputData = ({
|
|
7056
7063
|
schema,
|
|
7057
7064
|
defaultValues,
|
|
7065
|
+
withoutSubmit,
|
|
7058
7066
|
isSubmitLoading,
|
|
7059
7067
|
submitButtonLabel,
|
|
7060
7068
|
onSubmit
|
|
@@ -7093,7 +7101,7 @@ const WorkflowInputData = ({
|
|
|
7093
7101
|
defaultValues,
|
|
7094
7102
|
isSubmitLoading,
|
|
7095
7103
|
submitButtonLabel,
|
|
7096
|
-
onSubmit
|
|
7104
|
+
onSubmit: withoutSubmit ? void 0 : onSubmit
|
|
7097
7105
|
}
|
|
7098
7106
|
) : /* @__PURE__ */ jsx(
|
|
7099
7107
|
JSONInput,
|
|
@@ -7102,16 +7110,24 @@ const WorkflowInputData = ({
|
|
|
7102
7110
|
defaultValues,
|
|
7103
7111
|
isSubmitLoading,
|
|
7104
7112
|
submitButtonLabel,
|
|
7105
|
-
onSubmit
|
|
7113
|
+
onSubmit,
|
|
7114
|
+
withoutSubmit
|
|
7106
7115
|
}
|
|
7107
7116
|
)
|
|
7108
7117
|
}
|
|
7109
7118
|
)
|
|
7110
7119
|
] });
|
|
7111
7120
|
};
|
|
7112
|
-
const JSONInput = ({
|
|
7121
|
+
const JSONInput = ({
|
|
7122
|
+
schema,
|
|
7123
|
+
defaultValues,
|
|
7124
|
+
isSubmitLoading,
|
|
7125
|
+
submitButtonLabel,
|
|
7126
|
+
onSubmit,
|
|
7127
|
+
withoutSubmit
|
|
7128
|
+
}) => {
|
|
7113
7129
|
const [errors, setErrors] = useState([]);
|
|
7114
|
-
const [inputData, setInputData] = useState(JSON.stringify(defaultValues ?? {}, null, 2));
|
|
7130
|
+
const [inputData, setInputData] = useState(() => JSON.stringify(defaultValues ?? {}, null, 2));
|
|
7115
7131
|
const handleSubmit = () => {
|
|
7116
7132
|
setErrors([]);
|
|
7117
7133
|
try {
|
|
@@ -7134,7 +7150,7 @@ const JSONInput = ({ schema, defaultValues, isSubmitLoading, submitButtonLabel,
|
|
|
7134
7150
|
/* @__PURE__ */ jsx("ul", { className: "list-disc list-inside", children: errors.map((error, idx) => /* @__PURE__ */ jsx("li", { className: "text-ui-sm text-accent2", children: error }, idx)) })
|
|
7135
7151
|
] }),
|
|
7136
7152
|
/* @__PURE__ */ jsx(SyntaxHighlighter, { data: inputData, onChange: setInputData }),
|
|
7137
|
-
/* @__PURE__ */ jsx(Button$1, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : submitButtonLabel })
|
|
7153
|
+
withoutSubmit ? null : /* @__PURE__ */ jsx(Button$1, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : submitButtonLabel })
|
|
7138
7154
|
] });
|
|
7139
7155
|
};
|
|
7140
7156
|
const SyntaxHighlighter = ({ data, onChange }) => {
|
|
@@ -7145,23 +7161,27 @@ const SyntaxHighlighter = ({ data, onChange }) => {
|
|
|
7145
7161
|
] });
|
|
7146
7162
|
};
|
|
7147
7163
|
|
|
7164
|
+
const isObjectEmpty = (objectName) => {
|
|
7165
|
+
return objectName && Object.keys(objectName).length === 0 && objectName.constructor === Object;
|
|
7166
|
+
};
|
|
7167
|
+
|
|
7148
7168
|
function WorkflowTrigger({
|
|
7149
7169
|
workflowId,
|
|
7170
|
+
paramsRunId,
|
|
7150
7171
|
setRunId,
|
|
7151
7172
|
workflow,
|
|
7152
7173
|
isLoading,
|
|
7153
7174
|
createWorkflowRun,
|
|
7154
7175
|
resumeWorkflow,
|
|
7155
7176
|
streamWorkflow,
|
|
7177
|
+
observeWorkflowStream,
|
|
7156
7178
|
isStreamingWorkflow,
|
|
7157
7179
|
streamResult,
|
|
7158
|
-
isResumingWorkflow,
|
|
7159
7180
|
isCancellingWorkflowRun,
|
|
7160
7181
|
cancelWorkflowRun
|
|
7161
7182
|
}) {
|
|
7162
7183
|
const { runtimeContext } = usePlaygroundStore();
|
|
7163
7184
|
const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
7164
|
-
const [suspendedSteps, setSuspendedSteps] = useState([]);
|
|
7165
7185
|
const [isRunning, setIsRunning] = useState(false);
|
|
7166
7186
|
const [innerRunId, setInnerRunId] = useState("");
|
|
7167
7187
|
const [cancelResponse, setCancelResponse] = useState(null);
|
|
@@ -7199,19 +7219,21 @@ function WorkflowTrigger({
|
|
|
7199
7219
|
setCancelResponse(response);
|
|
7200
7220
|
};
|
|
7201
7221
|
const streamResultToUse = result ?? streamResult;
|
|
7222
|
+
const suspendedSteps = Object.entries(streamResultToUse?.payload?.workflowState?.steps || {}).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
7223
|
+
stepId,
|
|
7224
|
+
runId: streamResultToUse?.runId ?? "",
|
|
7225
|
+
suspendPayload: payload2,
|
|
7226
|
+
isLoading: false
|
|
7227
|
+
}));
|
|
7228
|
+
useEffect(() => {
|
|
7229
|
+
if (paramsRunId && observeWorkflowStream) {
|
|
7230
|
+
observeWorkflowStream({ workflowId, runId: paramsRunId });
|
|
7231
|
+
setInnerRunId(paramsRunId);
|
|
7232
|
+
}
|
|
7233
|
+
}, [paramsRunId]);
|
|
7202
7234
|
useEffect(() => {
|
|
7203
7235
|
setIsRunning(isStreamingWorkflow);
|
|
7204
7236
|
}, [isStreamingWorkflow]);
|
|
7205
|
-
useEffect(() => {
|
|
7206
|
-
if (!streamResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
|
|
7207
|
-
const suspended = Object.entries(streamResultToUse?.payload?.workflowState?.steps || {}).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
7208
|
-
stepId,
|
|
7209
|
-
runId: result.runId,
|
|
7210
|
-
suspendPayload: payload2,
|
|
7211
|
-
isLoading: false
|
|
7212
|
-
}));
|
|
7213
|
-
setSuspendedSteps(suspended);
|
|
7214
|
-
}, [streamResultToUse, result]);
|
|
7215
7237
|
useEffect(() => {
|
|
7216
7238
|
if (streamResult) {
|
|
7217
7239
|
setResult(streamResult);
|
|
@@ -7231,7 +7253,7 @@ function WorkflowTrigger({
|
|
|
7231
7253
|
const doneStatuses = ["success", "failed", "canceled"];
|
|
7232
7254
|
return /* @__PURE__ */ jsxs("div", { className: "h-full pt-3 pb-12", children: [
|
|
7233
7255
|
/* @__PURE__ */ jsxs("div", { className: "space-y-4 px-5 pb-5 border-b-sm border-border1", children: [
|
|
7234
|
-
|
|
7256
|
+
isSuspendedSteps && isStreamingWorkflow && /* @__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: [
|
|
7235
7257
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
|
|
7236
7258
|
/* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
|
|
7237
7259
|
] }),
|
|
@@ -7245,9 +7267,10 @@ function WorkflowTrigger({
|
|
|
7245
7267
|
onSubmit: (data) => {
|
|
7246
7268
|
setPayload(data);
|
|
7247
7269
|
handleExecuteWorkflow(data);
|
|
7248
|
-
}
|
|
7270
|
+
},
|
|
7271
|
+
withoutSubmit: !!paramsRunId
|
|
7249
7272
|
}
|
|
7250
|
-
) : /* @__PURE__ */ jsx(
|
|
7273
|
+
) : !!paramsRunId ? null : /* @__PURE__ */ jsx(
|
|
7251
7274
|
Button$1,
|
|
7252
7275
|
{
|
|
7253
7276
|
className: "w-full",
|
|
@@ -7275,7 +7298,7 @@ function WorkflowTrigger({
|
|
|
7275
7298
|
WorkflowInputData,
|
|
7276
7299
|
{
|
|
7277
7300
|
schema: stepSchema,
|
|
7278
|
-
isSubmitLoading:
|
|
7301
|
+
isSubmitLoading: isStreamingWorkflow,
|
|
7279
7302
|
submitButtonLabel: "Resume",
|
|
7280
7303
|
onSubmit: (data) => {
|
|
7281
7304
|
const stepIds = step.stepId?.split(".");
|
|
@@ -7313,7 +7336,7 @@ function WorkflowTrigger({
|
|
|
7313
7336
|
] })
|
|
7314
7337
|
] })
|
|
7315
7338
|
] }),
|
|
7316
|
-
result && /* @__PURE__ */ jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsx(WorkflowJsonDialog, { result }) })
|
|
7339
|
+
result && !isObjectEmpty(result) && /* @__PURE__ */ jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsx(WorkflowJsonDialog, { result }) })
|
|
7317
7340
|
] });
|
|
7318
7341
|
}
|
|
7319
7342
|
const WorkflowJsonDialog = ({ result }) => {
|
|
@@ -7341,7 +7364,14 @@ const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
|
|
|
7341
7364
|
});
|
|
7342
7365
|
};
|
|
7343
7366
|
|
|
7344
|
-
const WorkflowRuns = ({
|
|
7367
|
+
const WorkflowRuns = ({
|
|
7368
|
+
workflowId,
|
|
7369
|
+
runId,
|
|
7370
|
+
onPressRun,
|
|
7371
|
+
onPressBackToRuns,
|
|
7372
|
+
observeWorkflowStream,
|
|
7373
|
+
...triggerProps
|
|
7374
|
+
}) => {
|
|
7345
7375
|
const { isLoading, data: runs } = useWorkflowRuns(workflowId);
|
|
7346
7376
|
if (isLoading) {
|
|
7347
7377
|
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
|
|
@@ -7350,19 +7380,45 @@ const WorkflowRuns = ({ workflowId, runId, onPressRun }) => {
|
|
|
7350
7380
|
if (actualRuns.length === 0) {
|
|
7351
7381
|
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Txt, { variant: "ui-md", className: "text-icon6 text-center", children: "No previous run" }) });
|
|
7352
7382
|
}
|
|
7353
|
-
|
|
7383
|
+
const run = actualRuns.find((run2) => run2.runId === runId);
|
|
7384
|
+
const runSnapshot = run?.snapshot;
|
|
7385
|
+
const runResult = runSnapshot && typeof runSnapshot === "object" ? convertWorkflowRunStateToWatchResult(runSnapshot) : null;
|
|
7386
|
+
const runStatus = runResult?.payload?.workflowState?.status;
|
|
7387
|
+
if (runId) {
|
|
7388
|
+
return /* @__PURE__ */ jsxs("div", { className: "h-full grid grid-rows-[1fr_auto]", children: [
|
|
7389
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 space-y-2", children: /* @__PURE__ */ jsxs(Button$1, { onClick: onPressBackToRuns, variant: "light", children: [
|
|
7390
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronLeftIcon, {}) }),
|
|
7391
|
+
"Back to runs"
|
|
7392
|
+
] }) }),
|
|
7393
|
+
/* @__PURE__ */ jsx(
|
|
7394
|
+
WorkflowTrigger,
|
|
7395
|
+
{
|
|
7396
|
+
...triggerProps,
|
|
7397
|
+
streamResult: isObjectEmpty(triggerProps.streamResult ?? {}) ? runResult : triggerProps.streamResult,
|
|
7398
|
+
paramsRunId: runId,
|
|
7399
|
+
workflowId,
|
|
7400
|
+
observeWorkflowStream: () => {
|
|
7401
|
+
if (runStatus !== "success" && runStatus !== "failed" && runStatus !== "canceled") {
|
|
7402
|
+
observeWorkflowStream?.({ workflowId, runId });
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
}
|
|
7406
|
+
)
|
|
7407
|
+
] });
|
|
7408
|
+
}
|
|
7409
|
+
return /* @__PURE__ */ jsx("ol", { className: "pb-10", children: actualRuns.map((run2) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
7354
7410
|
"button",
|
|
7355
7411
|
{
|
|
7356
|
-
onClick: () => onPressRun({ workflowId, runId:
|
|
7412
|
+
onClick: () => onPressRun({ workflowId, runId: run2.runId }),
|
|
7357
7413
|
className: clsx("px-3 py-2 border-b-sm border-border1 block w-full hover:bg-surface4 text-left", {
|
|
7358
|
-
"bg-surface4":
|
|
7414
|
+
"bg-surface4": run2.runId === runId
|
|
7359
7415
|
}),
|
|
7360
7416
|
children: [
|
|
7361
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-lg", className: "font-medium text-icon6 truncate", as: "p", children:
|
|
7362
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "font-medium text-icon3 truncate", as: "p", children: typeof
|
|
7417
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-lg", className: "font-medium text-icon6 truncate", as: "p", children: run2.runId }),
|
|
7418
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "font-medium text-icon3 truncate", as: "p", children: typeof run2?.snapshot === "string" ? "" : run2?.snapshot?.timestamp ? formatDate(run2?.snapshot?.timestamp, "MMM d, yyyy h:mm a") : "" })
|
|
7363
7419
|
]
|
|
7364
7420
|
}
|
|
7365
|
-
) },
|
|
7421
|
+
) }, run2.runId)) });
|
|
7366
7422
|
};
|
|
7367
7423
|
|
|
7368
7424
|
const EmptyState = ({
|
|
@@ -7654,7 +7710,7 @@ const useLinkComponent = () => {
|
|
|
7654
7710
|
return ctx;
|
|
7655
7711
|
};
|
|
7656
7712
|
|
|
7657
|
-
const columns$
|
|
7713
|
+
const columns$2 = [
|
|
7658
7714
|
{
|
|
7659
7715
|
id: "name",
|
|
7660
7716
|
header: "Name",
|
|
@@ -7702,7 +7758,7 @@ function WorkflowTable({ workflows, isLoading }) {
|
|
|
7702
7758
|
}, [workflows]);
|
|
7703
7759
|
const table = useReactTable({
|
|
7704
7760
|
data: workflowData,
|
|
7705
|
-
columns: columns$
|
|
7761
|
+
columns: columns$2,
|
|
7706
7762
|
getCoreRowModel: getCoreRowModel()
|
|
7707
7763
|
});
|
|
7708
7764
|
if (isLoading) return /* @__PURE__ */ jsx(WorkflowTableSkeleton, {});
|
|
@@ -8485,11 +8541,11 @@ const AssistantMessage = ({ ToolFallback: ToolFallbackCustom, hasModelList }) =>
|
|
|
8485
8541
|
modelMetadata.modelId
|
|
8486
8542
|
] })
|
|
8487
8543
|
] }),
|
|
8488
|
-
/* @__PURE__ */ jsx(AssistantActionBar
|
|
8544
|
+
/* @__PURE__ */ jsx(AssistantActionBar, {})
|
|
8489
8545
|
] })
|
|
8490
8546
|
] });
|
|
8491
8547
|
};
|
|
8492
|
-
const AssistantActionBar
|
|
8548
|
+
const AssistantActionBar = () => {
|
|
8493
8549
|
return /* @__PURE__ */ jsxs(
|
|
8494
8550
|
ActionBarPrimitive.Root,
|
|
8495
8551
|
{
|
|
@@ -9078,28 +9134,28 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, hasModelList }) =
|
|
|
9078
9134
|
const WrappedAssistantMessage = (props) => {
|
|
9079
9135
|
return /* @__PURE__ */ jsx(AssistantMessage, { ...props, ToolFallback, hasModelList });
|
|
9080
9136
|
};
|
|
9081
|
-
return /* @__PURE__ */ jsxs(ThreadWrapper
|
|
9137
|
+
return /* @__PURE__ */ jsxs(ThreadWrapper, { children: [
|
|
9082
9138
|
/* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { ref: areaRef, autoScroll: false, className: "overflow-y-scroll scroll-smooth h-full", children: [
|
|
9083
|
-
/* @__PURE__ */ jsx(ThreadWelcome
|
|
9139
|
+
/* @__PURE__ */ jsx(ThreadWelcome, { agentName }),
|
|
9084
9140
|
/* @__PURE__ */ jsx("div", { className: "max-w-[568px] w-full mx-auto px-4 pb-7", children: /* @__PURE__ */ jsx(
|
|
9085
9141
|
ThreadPrimitive.Messages,
|
|
9086
9142
|
{
|
|
9087
9143
|
components: {
|
|
9088
9144
|
UserMessage,
|
|
9089
|
-
EditComposer
|
|
9145
|
+
EditComposer,
|
|
9090
9146
|
AssistantMessage: WrappedAssistantMessage
|
|
9091
9147
|
}
|
|
9092
9148
|
}
|
|
9093
9149
|
) }),
|
|
9094
9150
|
/* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
|
|
9095
9151
|
] }),
|
|
9096
|
-
/* @__PURE__ */ jsx(Composer
|
|
9152
|
+
/* @__PURE__ */ jsx(Composer, { hasMemory, agentId })
|
|
9097
9153
|
] });
|
|
9098
9154
|
};
|
|
9099
|
-
const ThreadWrapper
|
|
9155
|
+
const ThreadWrapper = ({ children }) => {
|
|
9100
9156
|
return /* @__PURE__ */ jsx(ThreadPrimitive.Root, { className: "grid grid-rows-[1fr_auto] h-full overflow-y-auto", children });
|
|
9101
9157
|
};
|
|
9102
|
-
const ThreadWelcome
|
|
9158
|
+
const ThreadWelcome = ({ agentName }) => {
|
|
9103
9159
|
const safeAgentName = agentName ?? "";
|
|
9104
9160
|
const words = safeAgentName.split(" ") ?? [];
|
|
9105
9161
|
let initials = "A";
|
|
@@ -9115,36 +9171,30 @@ const ThreadWelcome$1 = ({ agentName }) => {
|
|
|
9115
9171
|
/* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
9116
9172
|
] }) });
|
|
9117
9173
|
};
|
|
9118
|
-
const Composer
|
|
9174
|
+
const Composer = ({ hasMemory, agentId }) => {
|
|
9119
9175
|
const { setThreadInput } = useThreadInput();
|
|
9120
|
-
return /* @__PURE__ */
|
|
9121
|
-
/* @__PURE__ */
|
|
9122
|
-
|
|
9123
|
-
/* @__PURE__ */
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
/* @__PURE__ */
|
|
9136
|
-
|
|
9137
|
-
/* @__PURE__ */ jsx(ComposerAction$1, {})
|
|
9138
|
-
] })
|
|
9176
|
+
return /* @__PURE__ */ jsx("div", { className: "mx-4", children: /* @__PURE__ */ jsxs(ComposerPrimitive.Root, { children: [
|
|
9177
|
+
/* @__PURE__ */ jsx("div", { className: "max-w-[568px] w-full mx-auto pb-2", children: /* @__PURE__ */ jsx(ComposerAttachments, {}) }),
|
|
9178
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-surface3 rounded-lg border-sm border-border1 py-4 mt-auto max-w-[568px] w-full mx-auto px-4 focus-within:outline focus-within:outline-accent1 -outline-offset-2", children: [
|
|
9179
|
+
/* @__PURE__ */ jsx(ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(
|
|
9180
|
+
"textarea",
|
|
9181
|
+
{
|
|
9182
|
+
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none outline-none",
|
|
9183
|
+
autoFocus: document.activeElement === document.body,
|
|
9184
|
+
placeholder: "Enter your message...",
|
|
9185
|
+
name: "",
|
|
9186
|
+
id: "",
|
|
9187
|
+
onChange: (e) => setThreadInput?.(e.target.value)
|
|
9188
|
+
}
|
|
9189
|
+
) }),
|
|
9190
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9191
|
+
/* @__PURE__ */ jsx(SpeechInput, { agentId }),
|
|
9192
|
+
/* @__PURE__ */ jsx(ComposerAction, {})
|
|
9139
9193
|
] })
|
|
9140
|
-
] }),
|
|
9141
|
-
!hasMemory && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex gap-2 pt-1 max-w-[568px] w-full mx-auto border-t items-start", children: [
|
|
9142
|
-
/* @__PURE__ */ jsx(Icon, { className: "transform translate-y-[0.1rem]", children: /* @__PURE__ */ jsx(InfoIcon, {}) }),
|
|
9143
|
-
"Memory is not enabled. The conversation will not be persisted."
|
|
9144
9194
|
] })
|
|
9145
|
-
] });
|
|
9195
|
+
] }) });
|
|
9146
9196
|
};
|
|
9147
|
-
const SpeechInput
|
|
9197
|
+
const SpeechInput = ({ agentId }) => {
|
|
9148
9198
|
const composerRuntime = useComposerRuntime();
|
|
9149
9199
|
const { start, stop, isListening, transcript } = useSpeechRecognition({ agentId });
|
|
9150
9200
|
useEffect(() => {
|
|
@@ -9159,11 +9209,11 @@ const SpeechInput$1 = ({ agentId }) => {
|
|
|
9159
9209
|
variant: "ghost",
|
|
9160
9210
|
className: "rounded-full",
|
|
9161
9211
|
onClick: () => isListening ? stop() : start(),
|
|
9162
|
-
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon
|
|
9212
|
+
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsx(Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
9163
9213
|
}
|
|
9164
9214
|
);
|
|
9165
9215
|
};
|
|
9166
|
-
const ComposerAction
|
|
9216
|
+
const ComposerAction = () => {
|
|
9167
9217
|
const [isAddAttachmentDialogOpen, setIsAddAttachmentDialogOpen] = useState(false);
|
|
9168
9218
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9169
9219
|
/* @__PURE__ */ jsx(
|
|
@@ -9187,10 +9237,10 @@ const ComposerAction$1 = () => {
|
|
|
9187
9237
|
children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
9188
9238
|
}
|
|
9189
9239
|
) }) }),
|
|
9190
|
-
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsx(CircleStopIcon
|
|
9240
|
+
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsx(CircleStopIcon, {}) }) }) })
|
|
9191
9241
|
] });
|
|
9192
9242
|
};
|
|
9193
|
-
const EditComposer
|
|
9243
|
+
const EditComposer = () => {
|
|
9194
9244
|
return /* @__PURE__ */ jsxs(ComposerPrimitive.Root, { children: [
|
|
9195
9245
|
/* @__PURE__ */ jsx(ComposerPrimitive.Input, {}),
|
|
9196
9246
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -9199,7 +9249,7 @@ const EditComposer$1 = () => {
|
|
|
9199
9249
|
] })
|
|
9200
9250
|
] });
|
|
9201
9251
|
};
|
|
9202
|
-
const CircleStopIcon
|
|
9252
|
+
const CircleStopIcon = () => {
|
|
9203
9253
|
return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
9204
9254
|
};
|
|
9205
9255
|
|
|
@@ -10004,9 +10054,6 @@ const createRootToolAssistantMessage = ({
|
|
|
10004
10054
|
return [...conversation, newMessage];
|
|
10005
10055
|
};
|
|
10006
10056
|
|
|
10007
|
-
const convertMessage$1 = (message) => {
|
|
10008
|
-
return message;
|
|
10009
|
-
};
|
|
10010
10057
|
const handleFinishReason = (finishReason) => {
|
|
10011
10058
|
switch (finishReason) {
|
|
10012
10059
|
case "tool-calls":
|
|
@@ -10115,17 +10162,20 @@ function MastraRuntimeProvider({
|
|
|
10115
10162
|
runtimeContext,
|
|
10116
10163
|
modelVersion
|
|
10117
10164
|
}) {
|
|
10118
|
-
const
|
|
10165
|
+
const initializeMessages = () => memory ? initializeMessageState(initialMessages || []) : [];
|
|
10166
|
+
const [isLegacyRunning, setIsLegacyRunning] = useState(false);
|
|
10167
|
+
const [legacyMessages, setLegacyMessages] = useState(initializeMessages());
|
|
10119
10168
|
const {
|
|
10120
|
-
messages,
|
|
10121
10169
|
setMessages,
|
|
10122
|
-
|
|
10170
|
+
messages,
|
|
10171
|
+
generate,
|
|
10172
|
+
stream,
|
|
10123
10173
|
network,
|
|
10124
10174
|
cancelRun,
|
|
10125
|
-
isRunning:
|
|
10175
|
+
isRunning: isRunningStream
|
|
10126
10176
|
} = useChat({
|
|
10127
10177
|
agentId,
|
|
10128
|
-
initializeMessages
|
|
10178
|
+
initializeMessages
|
|
10129
10179
|
});
|
|
10130
10180
|
const { refetch: refreshWorkingMemory } = useWorkingMemory();
|
|
10131
10181
|
const abortControllerRef = useRef(null);
|
|
@@ -10139,8 +10189,8 @@ function MastraRuntimeProvider({
|
|
|
10139
10189
|
topK,
|
|
10140
10190
|
topP,
|
|
10141
10191
|
instructions,
|
|
10192
|
+
chatWithGenerateLegacy,
|
|
10142
10193
|
chatWithGenerate,
|
|
10143
|
-
chatWithGenerateVNext,
|
|
10144
10194
|
chatWithNetwork,
|
|
10145
10195
|
providerOptions
|
|
10146
10196
|
} = settings?.modelSettings ?? {};
|
|
@@ -10161,11 +10211,16 @@ function MastraRuntimeProvider({
|
|
|
10161
10211
|
providerOptions
|
|
10162
10212
|
};
|
|
10163
10213
|
const baseClient = useMastraClient();
|
|
10214
|
+
const isVNext = modelVersion === "v2";
|
|
10164
10215
|
const onNew = async (message) => {
|
|
10165
10216
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
10166
10217
|
const attachments = await convertToAIAttachments(message.attachments);
|
|
10167
10218
|
const input = message.content[0].text;
|
|
10168
|
-
|
|
10219
|
+
if (isVNext) {
|
|
10220
|
+
setMessages((s) => [...s, { role: "user", content: input, attachments: message.attachments }]);
|
|
10221
|
+
} else {
|
|
10222
|
+
setLegacyMessages((s) => [...s, { role: "user", content: input, attachments: message.attachments }]);
|
|
10223
|
+
}
|
|
10169
10224
|
const controller = new AbortController();
|
|
10170
10225
|
abortControllerRef.current = controller;
|
|
10171
10226
|
const clientWithAbort = new MastraClient({
|
|
@@ -10174,97 +10229,7 @@ function MastraRuntimeProvider({
|
|
|
10174
10229
|
});
|
|
10175
10230
|
const agent = clientWithAbort.getAgent(agentId);
|
|
10176
10231
|
try {
|
|
10177
|
-
|
|
10178
|
-
if (generatedResponse.response && "messages" in generatedResponse.response && generatedResponse.response.messages) {
|
|
10179
|
-
const latestMessage = generatedResponse.response.messages.reduce(
|
|
10180
|
-
(acc, message2) => {
|
|
10181
|
-
const _content = Array.isArray(acc.content) ? acc.content : [];
|
|
10182
|
-
if (typeof message2.content === "string") {
|
|
10183
|
-
return {
|
|
10184
|
-
...acc,
|
|
10185
|
-
content: [
|
|
10186
|
-
..._content,
|
|
10187
|
-
...generatedResponse.reasoning ? [{ type: "reasoning", text: generatedResponse.reasoning }] : [],
|
|
10188
|
-
{
|
|
10189
|
-
type: "text",
|
|
10190
|
-
text: message2.content
|
|
10191
|
-
}
|
|
10192
|
-
]
|
|
10193
|
-
};
|
|
10194
|
-
}
|
|
10195
|
-
if (message2.role === "assistant") {
|
|
10196
|
-
const toolCallContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "tool-call") : void 0;
|
|
10197
|
-
const reasoningContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "reasoning") : void 0;
|
|
10198
|
-
if (toolCallContent) {
|
|
10199
|
-
const newContent = message2.content.map((c) => {
|
|
10200
|
-
if (c.type === "tool-call" && c.toolCallId === toolCallContent?.toolCallId) {
|
|
10201
|
-
return {
|
|
10202
|
-
...c,
|
|
10203
|
-
toolCallId: toolCallContent.toolCallId,
|
|
10204
|
-
toolName: toolCallContent.toolName,
|
|
10205
|
-
args: toolCallContent.input
|
|
10206
|
-
};
|
|
10207
|
-
}
|
|
10208
|
-
return c;
|
|
10209
|
-
});
|
|
10210
|
-
const containsToolCall = newContent.some((c) => c.type === "tool-call");
|
|
10211
|
-
return {
|
|
10212
|
-
...acc,
|
|
10213
|
-
content: containsToolCall ? [...reasoningContent ? [reasoningContent] : [], ...newContent] : [..._content, ...reasoningContent ? [reasoningContent] : [], toolCallContent]
|
|
10214
|
-
};
|
|
10215
|
-
}
|
|
10216
|
-
const textContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "text" && content.text) : void 0;
|
|
10217
|
-
if (textContent) {
|
|
10218
|
-
return {
|
|
10219
|
-
...acc,
|
|
10220
|
-
content: [..._content, ...reasoningContent ? [reasoningContent] : [], textContent]
|
|
10221
|
-
};
|
|
10222
|
-
}
|
|
10223
|
-
}
|
|
10224
|
-
if (message2.role === "tool") {
|
|
10225
|
-
const toolResult = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "tool-result") : void 0;
|
|
10226
|
-
if (toolResult) {
|
|
10227
|
-
const newContent = _content.map((c) => {
|
|
10228
|
-
if (c.type === "tool-call" && c.toolCallId === toolResult?.toolCallId) {
|
|
10229
|
-
return { ...c, result: toolResult.output?.value };
|
|
10230
|
-
}
|
|
10231
|
-
return c;
|
|
10232
|
-
});
|
|
10233
|
-
const containsToolCall = newContent.some((c) => c.type === "tool-call");
|
|
10234
|
-
return {
|
|
10235
|
-
...acc,
|
|
10236
|
-
content: containsToolCall ? newContent : [
|
|
10237
|
-
..._content,
|
|
10238
|
-
{ type: "tool-result", toolCallId: toolResult.toolCallId, result: toolResult.output?.value }
|
|
10239
|
-
]
|
|
10240
|
-
};
|
|
10241
|
-
}
|
|
10242
|
-
return {
|
|
10243
|
-
...acc,
|
|
10244
|
-
content: [..._content, toolResult]
|
|
10245
|
-
};
|
|
10246
|
-
}
|
|
10247
|
-
return acc;
|
|
10248
|
-
},
|
|
10249
|
-
{ role: "assistant", content: [] }
|
|
10250
|
-
);
|
|
10251
|
-
setMessages((currentConversation) => [
|
|
10252
|
-
...currentConversation,
|
|
10253
|
-
{
|
|
10254
|
-
...latestMessage,
|
|
10255
|
-
metadata: {
|
|
10256
|
-
custom: {
|
|
10257
|
-
modelMetadata: generatedResponse.response.modelMetadata
|
|
10258
|
-
}
|
|
10259
|
-
}
|
|
10260
|
-
}
|
|
10261
|
-
]);
|
|
10262
|
-
if (generatedResponse.finishReason) {
|
|
10263
|
-
handleFinishReason(generatedResponse.finishReason);
|
|
10264
|
-
}
|
|
10265
|
-
}
|
|
10266
|
-
};
|
|
10267
|
-
if (modelVersion === "v2") {
|
|
10232
|
+
if (isVNext) {
|
|
10268
10233
|
if (chatWithNetwork) {
|
|
10269
10234
|
let currentEntityId;
|
|
10270
10235
|
await network({
|
|
@@ -10350,36 +10315,26 @@ function MastraRuntimeProvider({
|
|
|
10350
10315
|
}
|
|
10351
10316
|
});
|
|
10352
10317
|
} else {
|
|
10353
|
-
if (
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
messages: [
|
|
10318
|
+
if (chatWithGenerate) {
|
|
10319
|
+
await generate({
|
|
10320
|
+
coreUserMessages: [
|
|
10357
10321
|
{
|
|
10358
10322
|
role: "user",
|
|
10359
10323
|
content: input
|
|
10360
10324
|
},
|
|
10361
10325
|
...attachments
|
|
10362
10326
|
],
|
|
10363
|
-
runId: agentId,
|
|
10364
|
-
modelSettings: {
|
|
10365
|
-
frequencyPenalty,
|
|
10366
|
-
presencePenalty,
|
|
10367
|
-
maxRetries,
|
|
10368
|
-
temperature,
|
|
10369
|
-
topK,
|
|
10370
|
-
topP,
|
|
10371
|
-
maxOutputTokens: maxTokens
|
|
10372
|
-
},
|
|
10373
|
-
providerOptions,
|
|
10374
|
-
instructions,
|
|
10375
10327
|
runtimeContext: runtimeContextInstance,
|
|
10376
|
-
|
|
10328
|
+
threadId,
|
|
10329
|
+
modelSettings: modelSettingsArgs,
|
|
10330
|
+
signal: controller.signal,
|
|
10331
|
+
onFinish: (messages2) => {
|
|
10332
|
+
return messages2.map((message2) => toAssistantUIMessage(message2));
|
|
10333
|
+
}
|
|
10377
10334
|
});
|
|
10378
|
-
handleGenerateResponse(response);
|
|
10379
|
-
setIsRunning(false);
|
|
10380
10335
|
return;
|
|
10381
10336
|
} else {
|
|
10382
|
-
await
|
|
10337
|
+
await stream({
|
|
10383
10338
|
coreUserMessages: [
|
|
10384
10339
|
{
|
|
10385
10340
|
role: "user",
|
|
@@ -10403,9 +10358,9 @@ function MastraRuntimeProvider({
|
|
|
10403
10358
|
}
|
|
10404
10359
|
}
|
|
10405
10360
|
} else {
|
|
10406
|
-
if (
|
|
10407
|
-
|
|
10408
|
-
const generateResponse = await agent.
|
|
10361
|
+
if (chatWithGenerateLegacy) {
|
|
10362
|
+
setIsLegacyRunning(true);
|
|
10363
|
+
const generateResponse = await agent.generateLegacy({
|
|
10409
10364
|
messages: [
|
|
10410
10365
|
{
|
|
10411
10366
|
role: "user",
|
|
@@ -10495,12 +10450,13 @@ function MastraRuntimeProvider({
|
|
|
10495
10450
|
},
|
|
10496
10451
|
{ role: "assistant", content: [] }
|
|
10497
10452
|
);
|
|
10498
|
-
|
|
10453
|
+
setLegacyMessages((currentConversation) => [...currentConversation, latestMessage]);
|
|
10499
10454
|
handleFinishReason(generateResponse.finishReason);
|
|
10500
10455
|
}
|
|
10456
|
+
setIsLegacyRunning(false);
|
|
10501
10457
|
} else {
|
|
10502
10458
|
let updater = function() {
|
|
10503
|
-
|
|
10459
|
+
setLegacyMessages((currentConversation) => {
|
|
10504
10460
|
const message2 = {
|
|
10505
10461
|
role: "assistant",
|
|
10506
10462
|
content: [{ type: "text", text: content }]
|
|
@@ -10519,8 +10475,8 @@ function MastraRuntimeProvider({
|
|
|
10519
10475
|
return [...currentConversation.slice(0, -1), message2];
|
|
10520
10476
|
});
|
|
10521
10477
|
};
|
|
10522
|
-
|
|
10523
|
-
const response = await agent.
|
|
10478
|
+
setIsLegacyRunning(true);
|
|
10479
|
+
const response = await agent.streamLegacy({
|
|
10524
10480
|
messages: [
|
|
10525
10481
|
{
|
|
10526
10482
|
role: "user",
|
|
@@ -10560,7 +10516,7 @@ function MastraRuntimeProvider({
|
|
|
10560
10516
|
updater();
|
|
10561
10517
|
},
|
|
10562
10518
|
async onToolCallPart(value) {
|
|
10563
|
-
|
|
10519
|
+
setLegacyMessages((currentConversation) => {
|
|
10564
10520
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
10565
10521
|
if (lastMessage && lastMessage.role === "assistant") {
|
|
10566
10522
|
const updatedMessage = {
|
|
@@ -10606,7 +10562,7 @@ function MastraRuntimeProvider({
|
|
|
10606
10562
|
toolCallIdToName.current[value.toolCallId] = value.toolName;
|
|
10607
10563
|
},
|
|
10608
10564
|
async onToolResultPart(value) {
|
|
10609
|
-
|
|
10565
|
+
setLegacyMessages((currentConversation) => {
|
|
10610
10566
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
10611
10567
|
if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
|
|
10612
10568
|
const updatedContent = lastMessage.content.map((part) => {
|
|
@@ -10642,7 +10598,7 @@ function MastraRuntimeProvider({
|
|
|
10642
10598
|
handleFinishReason(finishReason);
|
|
10643
10599
|
},
|
|
10644
10600
|
onReasoningPart(value) {
|
|
10645
|
-
|
|
10601
|
+
setLegacyMessages((currentConversation) => {
|
|
10646
10602
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
10647
10603
|
if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
|
|
10648
10604
|
const updatedContent = lastMessage.content.map((part) => {
|
|
@@ -10675,21 +10631,28 @@ function MastraRuntimeProvider({
|
|
|
10675
10631
|
}
|
|
10676
10632
|
});
|
|
10677
10633
|
}
|
|
10634
|
+
setIsLegacyRunning(false);
|
|
10678
10635
|
}
|
|
10679
|
-
setIsRunning(false);
|
|
10680
10636
|
setTimeout(() => {
|
|
10681
10637
|
refreshThreadList?.();
|
|
10682
10638
|
}, 500);
|
|
10683
10639
|
} catch (error) {
|
|
10684
10640
|
console.error("Error occurred in MastraRuntimeProvider", error);
|
|
10685
|
-
|
|
10641
|
+
setIsLegacyRunning(false);
|
|
10686
10642
|
if (error.name === "AbortError") {
|
|
10687
10643
|
return;
|
|
10688
10644
|
}
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10645
|
+
if (isVNext) {
|
|
10646
|
+
setMessages((currentConversation) => [
|
|
10647
|
+
...currentConversation,
|
|
10648
|
+
{ role: "assistant", content: [{ type: "text", text: `${error}` }] }
|
|
10649
|
+
]);
|
|
10650
|
+
} else {
|
|
10651
|
+
setLegacyMessages((currentConversation) => [
|
|
10652
|
+
...currentConversation,
|
|
10653
|
+
{ role: "assistant", content: [{ type: "text", text: `${error}` }] }
|
|
10654
|
+
]);
|
|
10655
|
+
}
|
|
10693
10656
|
} finally {
|
|
10694
10657
|
abortControllerRef.current = null;
|
|
10695
10658
|
}
|
|
@@ -10698,15 +10661,15 @@ function MastraRuntimeProvider({
|
|
|
10698
10661
|
if (abortControllerRef.current) {
|
|
10699
10662
|
abortControllerRef.current.abort();
|
|
10700
10663
|
abortControllerRef.current = null;
|
|
10701
|
-
|
|
10664
|
+
setIsLegacyRunning(false);
|
|
10702
10665
|
cancelRun?.();
|
|
10703
10666
|
}
|
|
10704
10667
|
};
|
|
10705
10668
|
const { adapters, isReady } = useAdapters(agentId);
|
|
10706
10669
|
const runtime = useExternalStoreRuntime({
|
|
10707
|
-
isRunning:
|
|
10708
|
-
messages,
|
|
10709
|
-
convertMessage:
|
|
10670
|
+
isRunning: isLegacyRunning || isRunningStream,
|
|
10671
|
+
messages: isVNext ? messages : legacyMessages,
|
|
10672
|
+
convertMessage: (x) => x,
|
|
10710
10673
|
onNew,
|
|
10711
10674
|
onCancel,
|
|
10712
10675
|
adapters: isReady ? adapters : void 0
|
|
@@ -10725,8 +10688,8 @@ const defaultSettings = {
|
|
|
10725
10688
|
maxSteps: 5,
|
|
10726
10689
|
temperature: 0.5,
|
|
10727
10690
|
topP: 1,
|
|
10728
|
-
|
|
10729
|
-
|
|
10691
|
+
chatWithGenerateLegacy: false,
|
|
10692
|
+
chatWithGenerate: false
|
|
10730
10693
|
}
|
|
10731
10694
|
};
|
|
10732
10695
|
function useAgentSettingsState({ agentId }) {
|
|
@@ -11471,10 +11434,10 @@ const AgentSettings = ({ modelVersion, hasMemory = false, hasSubAgents = false }
|
|
|
11471
11434
|
if (settings?.modelSettings?.chatWithNetwork) {
|
|
11472
11435
|
radioValue = "network";
|
|
11473
11436
|
} else {
|
|
11474
|
-
radioValue = settings?.modelSettings?.
|
|
11437
|
+
radioValue = settings?.modelSettings?.chatWithGenerate ? "generate" : "stream";
|
|
11475
11438
|
}
|
|
11476
11439
|
} else {
|
|
11477
|
-
radioValue = settings?.modelSettings?.
|
|
11440
|
+
radioValue = settings?.modelSettings?.chatWithGenerateLegacy ? "generateLegacy" : "streamLegacy";
|
|
11478
11441
|
}
|
|
11479
11442
|
return /* @__PURE__ */ jsxs("div", { className: "px-5 text-xs py-2 pb-4", children: [
|
|
11480
11443
|
/* @__PURE__ */ jsxs("section", { className: "space-y-7", children: [
|
|
@@ -11487,29 +11450,28 @@ const AgentSettings = ({ modelVersion, hasMemory = false, hasSubAgents = false }
|
|
|
11487
11450
|
...settings,
|
|
11488
11451
|
modelSettings: {
|
|
11489
11452
|
...settings?.modelSettings,
|
|
11453
|
+
chatWithGenerateLegacy: value === "generateLegacy",
|
|
11490
11454
|
chatWithGenerate: value === "generate",
|
|
11491
|
-
chatWithGenerateVNext: value === "generateVNext",
|
|
11492
|
-
chatWithStreamVNext: value === "streamVNext",
|
|
11493
11455
|
chatWithNetwork: value === "network"
|
|
11494
11456
|
}
|
|
11495
11457
|
}),
|
|
11496
11458
|
className: "flex flex-row gap-4",
|
|
11497
11459
|
children: [
|
|
11498
11460
|
modelVersion !== "v2" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11499
|
-
/* @__PURE__ */ jsx(RadioGroupItem, { value: "
|
|
11500
|
-
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11461
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value: "generateLegacy", id: "generateLegacy", className: "text-icon6" }),
|
|
11462
|
+
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "generateLegacy", children: "Generate" })
|
|
11501
11463
|
] }),
|
|
11502
11464
|
modelVersion === "v2" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11503
|
-
/* @__PURE__ */ jsx(RadioGroupItem, { value: "
|
|
11504
|
-
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11465
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value: "generate", id: "generate", className: "text-icon6" }),
|
|
11466
|
+
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "generate", children: "Generate" })
|
|
11505
11467
|
] }),
|
|
11506
11468
|
modelVersion !== "v2" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11507
|
-
/* @__PURE__ */ jsx(RadioGroupItem, { value: "
|
|
11508
|
-
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11469
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value: "streamLegacy", id: "streamLegacy", className: "text-icon6" }),
|
|
11470
|
+
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "streamLegacy", children: "Stream" })
|
|
11509
11471
|
] }),
|
|
11510
11472
|
modelVersion === "v2" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11511
|
-
/* @__PURE__ */ jsx(RadioGroupItem, { value: "
|
|
11512
|
-
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11473
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value: "stream", id: "stream", className: "text-icon6" }),
|
|
11474
|
+
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "stream", children: "Stream" })
|
|
11513
11475
|
] }),
|
|
11514
11476
|
modelVersion === "v2" && /* @__PURE__ */ jsx(NetworkCheckbox, { hasMemory, hasSubAgents })
|
|
11515
11477
|
]
|
|
@@ -11569,7 +11531,7 @@ const NameCell$1 = ({ row }) => {
|
|
|
11569
11531
|
}
|
|
11570
11532
|
);
|
|
11571
11533
|
};
|
|
11572
|
-
const columns$
|
|
11534
|
+
const columns$1 = [
|
|
11573
11535
|
{
|
|
11574
11536
|
header: "Name",
|
|
11575
11537
|
accessorKey: "name",
|
|
@@ -11646,7 +11608,7 @@ function AgentsTable({ agents, isLoading }) {
|
|
|
11646
11608
|
);
|
|
11647
11609
|
const table = useReactTable({
|
|
11648
11610
|
data: projectData,
|
|
11649
|
-
columns: columns$
|
|
11611
|
+
columns: columns$1,
|
|
11650
11612
|
getCoreRowModel: getCoreRowModel()
|
|
11651
11613
|
});
|
|
11652
11614
|
if (isLoading) return /* @__PURE__ */ jsx(AgentsTableSkeleton, {});
|
|
@@ -13367,7 +13329,7 @@ const NameCell = ({ row }) => {
|
|
|
13367
13329
|
}
|
|
13368
13330
|
);
|
|
13369
13331
|
};
|
|
13370
|
-
const columns
|
|
13332
|
+
const columns = [
|
|
13371
13333
|
{
|
|
13372
13334
|
header: "Name",
|
|
13373
13335
|
accessorKey: "name",
|
|
@@ -13390,7 +13352,7 @@ function ScorersTable({ scorers, isLoading }) {
|
|
|
13390
13352
|
);
|
|
13391
13353
|
const table = useReactTable({
|
|
13392
13354
|
data: scorersData,
|
|
13393
|
-
columns
|
|
13355
|
+
columns,
|
|
13394
13356
|
getCoreRowModel: getCoreRowModel()
|
|
13395
13357
|
});
|
|
13396
13358
|
if (isLoading) return /* @__PURE__ */ jsx(ScorersTableSkeleton, {});
|
|
@@ -13432,20 +13394,41 @@ const EmptyScorersTable = () => /* @__PURE__ */ jsx("div", { className: "flex h-
|
|
|
13432
13394
|
}
|
|
13433
13395
|
) });
|
|
13434
13396
|
|
|
13397
|
+
const variantClasses$1 = {
|
|
13398
|
+
warning: "bg-yellow-900/20 border-sm border-yellow-200 text-yellow-200",
|
|
13399
|
+
destructive: "bg-red-900/20 border-sm border-red-200 text-red-200"
|
|
13400
|
+
};
|
|
13401
|
+
const variantIcons = {
|
|
13402
|
+
warning: TriangleAlert,
|
|
13403
|
+
destructive: AlertCircle
|
|
13404
|
+
};
|
|
13405
|
+
const Alert = ({ children, variant = "destructive" }) => {
|
|
13406
|
+
const Ico = variantIcons[variant];
|
|
13407
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(variantClasses$1[variant], "p-2 rounded-md"), children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
13408
|
+
/* @__PURE__ */ jsx(Icon, { className: "mt-0.5", children: /* @__PURE__ */ jsx(Ico, {}) }),
|
|
13409
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
13410
|
+
] }) });
|
|
13411
|
+
};
|
|
13412
|
+
const AlertTitle = ({ children, as: As = "h5" }) => {
|
|
13413
|
+
return /* @__PURE__ */ jsx(Txt, { as: As, variant: "ui-md", className: "font-semibold", children });
|
|
13414
|
+
};
|
|
13415
|
+
const AlertDescription = ({ children, as: As = "p" }) => {
|
|
13416
|
+
return /* @__PURE__ */ jsx(Txt, { as: As, variant: "ui-sm", children });
|
|
13417
|
+
};
|
|
13418
|
+
|
|
13435
13419
|
const AgentMetadataModelSwitcher = ({
|
|
13436
13420
|
defaultProvider,
|
|
13437
13421
|
defaultModel,
|
|
13438
13422
|
updateModel,
|
|
13439
|
-
apiUrl = "/api/agents/providers"
|
|
13440
|
-
autoSave = false,
|
|
13441
|
-
selectProviderPlaceholder = "Select provider"
|
|
13423
|
+
apiUrl = "/api/agents/providers"
|
|
13442
13424
|
}) => {
|
|
13443
13425
|
const [selectedModel, setSelectedModel] = useState(defaultModel);
|
|
13444
13426
|
const [showModelSuggestions, setShowModelSuggestions] = useState(false);
|
|
13445
13427
|
const [selectedProvider, setSelectedProvider] = useState(defaultProvider || "");
|
|
13446
13428
|
const [providerSearch, setProviderSearch] = useState("");
|
|
13447
13429
|
const [modelSearch, setModelSearch] = useState("");
|
|
13448
|
-
const [
|
|
13430
|
+
const [isSearchingProvider, setIsSearchingProvider] = useState(false);
|
|
13431
|
+
const [isSearchingModel, setIsSearchingModel] = useState(false);
|
|
13449
13432
|
const [showProviderSuggestions, setShowProviderSuggestions] = useState(false);
|
|
13450
13433
|
const [loading, setLoading] = useState(false);
|
|
13451
13434
|
const [providers, setProviders] = useState([]);
|
|
@@ -13489,7 +13472,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13489
13472
|
);
|
|
13490
13473
|
}, [providers]);
|
|
13491
13474
|
const filteredProviders = useMemo(() => {
|
|
13492
|
-
const searchTerm =
|
|
13475
|
+
const searchTerm = isSearchingProvider ? providerSearch : "";
|
|
13493
13476
|
let filtered = providers;
|
|
13494
13477
|
if (searchTerm) {
|
|
13495
13478
|
filtered = providers.filter(
|
|
@@ -13512,18 +13495,18 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13512
13495
|
}
|
|
13513
13496
|
return a.name.localeCompare(b.name);
|
|
13514
13497
|
});
|
|
13515
|
-
}, [providers, providerSearch,
|
|
13498
|
+
}, [providers, providerSearch, isSearchingProvider]);
|
|
13516
13499
|
const filteredModels = useMemo(() => {
|
|
13517
13500
|
let filtered = allModels;
|
|
13518
13501
|
if (currentModelProvider) {
|
|
13519
13502
|
filtered = filtered.filter((m) => m.provider === currentModelProvider);
|
|
13520
13503
|
}
|
|
13521
|
-
if (
|
|
13504
|
+
if (isSearchingModel && modelSearch) {
|
|
13522
13505
|
filtered = filtered.filter((m) => m.model.toLowerCase().includes(modelSearch.toLowerCase()));
|
|
13523
13506
|
}
|
|
13524
13507
|
filtered.sort((a, b) => a.model.localeCompare(b.model));
|
|
13525
13508
|
return filtered;
|
|
13526
|
-
}, [allModels, modelSearch, currentModelProvider,
|
|
13509
|
+
}, [allModels, modelSearch, currentModelProvider, isSearchingModel]);
|
|
13527
13510
|
const [infoMsg, setInfoMsg] = useState("");
|
|
13528
13511
|
const handleModelSelect = async (modelId) => {
|
|
13529
13512
|
setSelectedModel(modelId);
|
|
@@ -13549,7 +13532,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13549
13532
|
const handleProviderSelect = async (provider) => {
|
|
13550
13533
|
setSelectedProvider(provider.id);
|
|
13551
13534
|
setProviderSearch("");
|
|
13552
|
-
|
|
13535
|
+
setIsSearchingProvider(false);
|
|
13553
13536
|
setShowProviderSuggestions(false);
|
|
13554
13537
|
setHighlightedProviderIndex(-1);
|
|
13555
13538
|
if (provider.id !== currentModelProvider) {
|
|
@@ -13566,10 +13549,12 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13566
13549
|
const { registerResetFn } = useModelReset();
|
|
13567
13550
|
useEffect(() => {
|
|
13568
13551
|
const resetIfIncomplete = () => {
|
|
13552
|
+
if (modelInputRef.current === document.activeElement || providerInputRef.current === document.activeElement || showProviderSuggestions || showModelSuggestions) {
|
|
13553
|
+
return;
|
|
13554
|
+
}
|
|
13569
13555
|
const providerChanged = currentModelProvider && currentModelProvider !== defaultProvider;
|
|
13570
13556
|
const modelEmpty = !selectedModel || selectedModel === "";
|
|
13571
13557
|
if (providerChanged && modelEmpty) {
|
|
13572
|
-
console.log("Incomplete model selection detected, reverting to defaults");
|
|
13573
13558
|
setSelectedProvider(defaultProvider);
|
|
13574
13559
|
setSelectedModel(defaultModel);
|
|
13575
13560
|
if (defaultProvider && defaultModel) {
|
|
@@ -13586,7 +13571,16 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13586
13571
|
return () => {
|
|
13587
13572
|
registerResetFn(null);
|
|
13588
13573
|
};
|
|
13589
|
-
}, [
|
|
13574
|
+
}, [
|
|
13575
|
+
registerResetFn,
|
|
13576
|
+
currentModelProvider,
|
|
13577
|
+
selectedModel,
|
|
13578
|
+
defaultProvider,
|
|
13579
|
+
defaultModel,
|
|
13580
|
+
updateModel,
|
|
13581
|
+
showProviderSuggestions,
|
|
13582
|
+
showModelSuggestions
|
|
13583
|
+
]);
|
|
13590
13584
|
if (providersLoading) {
|
|
13591
13585
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13592
13586
|
/* @__PURE__ */ jsx(Spinner, {}),
|
|
@@ -13594,7 +13588,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13594
13588
|
] });
|
|
13595
13589
|
}
|
|
13596
13590
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13597
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13591
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col xl:flex-row items-stretch xl:items-center gap-2 w-full", children: [
|
|
13598
13592
|
/* @__PURE__ */ jsxs(
|
|
13599
13593
|
Popover,
|
|
13600
13594
|
{
|
|
@@ -13603,12 +13597,12 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13603
13597
|
setShowProviderSuggestions(open);
|
|
13604
13598
|
if (!open) {
|
|
13605
13599
|
setProviderSearch("");
|
|
13606
|
-
|
|
13600
|
+
setIsSearchingProvider(false);
|
|
13607
13601
|
}
|
|
13608
13602
|
},
|
|
13609
13603
|
children: [
|
|
13610
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "relative w-
|
|
13611
|
-
!
|
|
13604
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "relative w-full xl:w-2/5", children: [
|
|
13605
|
+
!isSearchingProvider && currentModelProvider && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13612
13606
|
/* @__PURE__ */ jsx("div", { className: "absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none z-10", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
13613
13607
|
/* @__PURE__ */ jsx(ProviderLogo, { providerId: currentModelProvider, size: 16 }),
|
|
13614
13608
|
(() => {
|
|
@@ -13647,15 +13641,15 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13647
13641
|
{
|
|
13648
13642
|
spellCheck: "false",
|
|
13649
13643
|
ref: providerInputRef,
|
|
13650
|
-
className: `w-full ${!
|
|
13644
|
+
className: `w-full ${!isSearchingProvider && currentModelProvider ? "pl-8 pr-8" : ""}`,
|
|
13651
13645
|
type: "text",
|
|
13652
|
-
value:
|
|
13646
|
+
value: isSearchingProvider ? providerSearch : providers.find((p) => p.id === cleanProviderId(currentModelProvider))?.name || currentModelProvider || "",
|
|
13653
13647
|
onKeyDown: (e) => {
|
|
13654
13648
|
const filteredProviders2 = providers.filter(
|
|
13655
13649
|
(provider) => provider.name.toLowerCase().includes(providerSearch.toLowerCase()) || provider.id.toLowerCase().includes(providerSearch.toLowerCase())
|
|
13656
13650
|
);
|
|
13657
|
-
if (!
|
|
13658
|
-
|
|
13651
|
+
if (!isSearchingProvider && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
|
|
13652
|
+
setIsSearchingProvider(true);
|
|
13659
13653
|
setProviderSearch("");
|
|
13660
13654
|
setHighlightedProviderIndex(0);
|
|
13661
13655
|
} else if (showProviderSuggestions) {
|
|
@@ -13691,7 +13685,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13691
13685
|
handleProviderSelect(provider);
|
|
13692
13686
|
} else {
|
|
13693
13687
|
setShowProviderSuggestions(false);
|
|
13694
|
-
|
|
13688
|
+
setIsSearchingProvider(false);
|
|
13695
13689
|
setProviderSearch("");
|
|
13696
13690
|
setHighlightedProviderIndex(-1);
|
|
13697
13691
|
}
|
|
@@ -13699,7 +13693,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13699
13693
|
break;
|
|
13700
13694
|
case "Escape":
|
|
13701
13695
|
e.preventDefault();
|
|
13702
|
-
|
|
13696
|
+
setIsSearchingProvider(false);
|
|
13703
13697
|
setProviderSearch("");
|
|
13704
13698
|
setHighlightedProviderIndex(-1);
|
|
13705
13699
|
setShowProviderSuggestions(false);
|
|
@@ -13721,7 +13715,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13721
13715
|
}
|
|
13722
13716
|
},
|
|
13723
13717
|
onChange: (e) => {
|
|
13724
|
-
|
|
13718
|
+
setIsSearchingProvider(true);
|
|
13725
13719
|
setProviderSearch(e.target.value);
|
|
13726
13720
|
setHighlightedProviderIndex(0);
|
|
13727
13721
|
},
|
|
@@ -13741,7 +13735,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13741
13735
|
PopoverContent,
|
|
13742
13736
|
{
|
|
13743
13737
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
13744
|
-
className: "flex flex-col gap-
|
|
13738
|
+
className: "flex flex-col gap-0.5 w-[var(--radix-popover-trigger-width)] max-h-[300px] overflow-y-auto p-2",
|
|
13745
13739
|
children: filteredProviders.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 p-2", children: "No providers found" }) : filteredProviders.map((provider, index) => {
|
|
13746
13740
|
const isSelected = provider.id === currentModelProvider;
|
|
13747
13741
|
const isHighlighted = index === highlightedProviderIndex;
|
|
@@ -13749,7 +13743,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13749
13743
|
"div",
|
|
13750
13744
|
{
|
|
13751
13745
|
"data-provider-highlighted": isHighlighted,
|
|
13752
|
-
className: `flex items-center gap-2 cursor-pointer hover:bg-surface5
|
|
13746
|
+
className: `flex items-center gap-2 cursor-pointer hover:bg-surface5 px-3 py-4 rounded ${isHighlighted ? "outline outline-2 outline-blue-500" : ""} ${isSelected ? "bg-surface5" : ""}`,
|
|
13753
13747
|
onClick: () => handleProviderSelect(provider),
|
|
13754
13748
|
children: [
|
|
13755
13749
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
@@ -13762,10 +13756,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13762
13756
|
}
|
|
13763
13757
|
)
|
|
13764
13758
|
] }),
|
|
13765
|
-
/* @__PURE__ */
|
|
13766
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: provider.name }),
|
|
13767
|
-
/* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: provider.id })
|
|
13768
|
-
] }),
|
|
13759
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: provider.name }) }),
|
|
13769
13760
|
/* @__PURE__ */ jsx(
|
|
13770
13761
|
Info,
|
|
13771
13762
|
{
|
|
@@ -13794,7 +13785,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13794
13785
|
setShowModelSuggestions(open);
|
|
13795
13786
|
if (!open) {
|
|
13796
13787
|
setModelSearch("");
|
|
13797
|
-
|
|
13788
|
+
setIsSearchingModel(false);
|
|
13798
13789
|
}
|
|
13799
13790
|
},
|
|
13800
13791
|
children: [
|
|
@@ -13803,13 +13794,13 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13803
13794
|
{
|
|
13804
13795
|
spellCheck: "false",
|
|
13805
13796
|
ref: modelInputRef,
|
|
13806
|
-
className: "
|
|
13797
|
+
className: "w-full xl:w-3/5",
|
|
13807
13798
|
type: "text",
|
|
13808
13799
|
value: modelSearch || selectedModel,
|
|
13809
13800
|
onChange: (e) => {
|
|
13810
13801
|
setSelectedModel(e.target.value);
|
|
13811
13802
|
setModelSearch(e.target.value);
|
|
13812
|
-
|
|
13803
|
+
setIsSearchingModel(true);
|
|
13813
13804
|
setHighlightedModelIndex(0);
|
|
13814
13805
|
},
|
|
13815
13806
|
onClick: (e) => {
|
|
@@ -13858,7 +13849,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13858
13849
|
if (highlightedModelIndex >= 0 && highlightedModelIndex < filteredModels.length) {
|
|
13859
13850
|
const model = filteredModels[highlightedModelIndex];
|
|
13860
13851
|
setModelSearch("");
|
|
13861
|
-
|
|
13852
|
+
setIsSearchingModel(false);
|
|
13862
13853
|
setShowModelSuggestions(false);
|
|
13863
13854
|
handleModelSelect(model.model);
|
|
13864
13855
|
setTimeout(() => {
|
|
@@ -13872,7 +13863,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13872
13863
|
}, 100);
|
|
13873
13864
|
} else if (selectedModel && selectedModel.trim()) {
|
|
13874
13865
|
setModelSearch("");
|
|
13875
|
-
|
|
13866
|
+
setIsSearchingModel(false);
|
|
13876
13867
|
setShowModelSuggestions(false);
|
|
13877
13868
|
handleModelSelect(selectedModel.trim());
|
|
13878
13869
|
setTimeout(() => {
|
|
@@ -13901,7 +13892,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13901
13892
|
allModels.length > 0 && /* @__PURE__ */ jsx(
|
|
13902
13893
|
PopoverContent,
|
|
13903
13894
|
{
|
|
13904
|
-
className: "flex flex-col gap-
|
|
13895
|
+
className: "flex flex-col gap-0 w-[var(--radix-popover-trigger-width)] max-h-[calc(var(--radix-popover-content-available-height)-50px)] overflow-y-auto p-2",
|
|
13905
13896
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
13906
13897
|
children: loading ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin mx-auto" }) }) : filteredModels.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No models found" }) : filteredModels.map((model, index) => {
|
|
13907
13898
|
const isHighlighted = index === highlightedModelIndex;
|
|
@@ -13910,11 +13901,11 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13910
13901
|
"div",
|
|
13911
13902
|
{
|
|
13912
13903
|
"data-model-highlighted": isHighlighted,
|
|
13913
|
-
className: `flex items-center gap-2 px-
|
|
13904
|
+
className: `flex items-center gap-2 px-4 py-3 cursor-pointer rounded hover:bg-surface5 ${isHighlighted ? "outline outline-2 outline-blue-500" : ""} ${isSelected ? "bg-surface5" : ""}`,
|
|
13914
13905
|
onMouseDown: (e) => {
|
|
13915
13906
|
e.preventDefault();
|
|
13916
13907
|
setModelSearch("");
|
|
13917
|
-
|
|
13908
|
+
setIsSearchingModel(false);
|
|
13918
13909
|
handleModelSelect(model.model);
|
|
13919
13910
|
modelInputRef.current?.blur();
|
|
13920
13911
|
setTimeout(() => {
|
|
@@ -13943,17 +13934,18 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13943
13934
|
(() => {
|
|
13944
13935
|
const currentProvider = providers.find((p) => p.id === currentModelProvider);
|
|
13945
13936
|
if (currentProvider && !currentProvider.connected) {
|
|
13946
|
-
return /* @__PURE__ */ jsx("div", { className: "
|
|
13947
|
-
/* @__PURE__ */ jsx(
|
|
13948
|
-
/* @__PURE__ */ jsxs(
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13937
|
+
return /* @__PURE__ */ jsx("div", { className: "pt-2 p-2", children: /* @__PURE__ */ jsxs(Alert, { variant: "warning", children: [
|
|
13938
|
+
/* @__PURE__ */ jsx(AlertTitle, { as: "h5", children: "Provider not connected" }),
|
|
13939
|
+
/* @__PURE__ */ jsxs(AlertDescription, { as: "p", children: [
|
|
13940
|
+
"Set the",
|
|
13941
|
+
" ",
|
|
13942
|
+
/* @__PURE__ */ jsx("code", { className: "px-1 py-0.5 bg-yellow-100 dark:bg-yellow-900/50 rounded", children: Array.isArray(currentProvider.envVar) ? currentProvider.envVar.join(", ") : currentProvider.envVar }),
|
|
13943
|
+
" ",
|
|
13944
|
+
"environment",
|
|
13945
|
+
" ",
|
|
13946
|
+
Array.isArray(currentProvider.envVar) && currentProvider.envVar.length > 1 ? "variables" : "variable",
|
|
13947
|
+
" ",
|
|
13948
|
+
"to use this provider."
|
|
13957
13949
|
] })
|
|
13958
13950
|
] }) });
|
|
13959
13951
|
}
|
|
@@ -14129,7 +14121,24 @@ const AgentMetadata = ({
|
|
|
14129
14121
|
link: "https://mastra.ai/en/docs/agents/agent-memory",
|
|
14130
14122
|
title: "Agent Memory documentation"
|
|
14131
14123
|
},
|
|
14132
|
-
children: /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(MemoryIcon, {}), variant:
|
|
14124
|
+
children: hasMemoryEnabled ? /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(MemoryIcon, {}), variant: "success", className: "font-medium", children: "On" }) : /* @__PURE__ */ jsxs(Alert, { variant: "warning", children: [
|
|
14125
|
+
/* @__PURE__ */ jsx(AlertTitle, { as: "h5", children: "Memory not enabled" }),
|
|
14126
|
+
/* @__PURE__ */ jsxs(AlertDescription, { as: "p", children: [
|
|
14127
|
+
"Thread messages will not be stored. To activate memory, see the",
|
|
14128
|
+
" ",
|
|
14129
|
+
/* @__PURE__ */ jsx(
|
|
14130
|
+
"a",
|
|
14131
|
+
{
|
|
14132
|
+
href: "https://mastra.ai/en/docs/agents/agent-memory",
|
|
14133
|
+
target: "_blank",
|
|
14134
|
+
rel: "noopener noreferrer",
|
|
14135
|
+
className: "underline",
|
|
14136
|
+
children: "documentation"
|
|
14137
|
+
}
|
|
14138
|
+
),
|
|
14139
|
+
"."
|
|
14140
|
+
] })
|
|
14141
|
+
] })
|
|
14133
14142
|
}
|
|
14134
14143
|
),
|
|
14135
14144
|
networkAgents.length > 0 && /* @__PURE__ */ jsx(
|
|
@@ -14234,7 +14243,7 @@ const ThreadLink = ({ children, as: Component = "a", href, className, prefetch,
|
|
|
14234
14243
|
href,
|
|
14235
14244
|
prefetch,
|
|
14236
14245
|
to,
|
|
14237
|
-
className: clsx("text-ui-sm flex h-full w-full flex-col justify-center font-medium", className),
|
|
14246
|
+
className: clsx("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer", className),
|
|
14238
14247
|
children
|
|
14239
14248
|
}
|
|
14240
14249
|
);
|
|
@@ -14247,7 +14256,7 @@ const ThreadItem = ({ children, isActive }) => {
|
|
|
14247
14256
|
"li",
|
|
14248
14257
|
{
|
|
14249
14258
|
className: clsx(
|
|
14250
|
-
"border-b-sm border-border1 hover:bg-surface3 group flex h-[54px] items-center justify-between gap-2
|
|
14259
|
+
"border-b-sm border-border1 hover:bg-surface3 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",
|
|
14251
14260
|
isActive && "bg-surface4"
|
|
14252
14261
|
),
|
|
14253
14262
|
children
|
|
@@ -14338,7 +14347,6 @@ const ChatThreads = ({ threads, isLoading, threadId, onDelete, resourceId, resou
|
|
|
14338
14347
|
if (isLoading) {
|
|
14339
14348
|
return /* @__PURE__ */ jsx(ChatThreadSkeleton, {});
|
|
14340
14349
|
}
|
|
14341
|
-
const reverseThreads = [...threads].reverse();
|
|
14342
14350
|
const newThreadLink = resourceType === "agent" ? paths.agentNewThreadLink(resourceId) : paths.networkNewThreadLink(resourceId);
|
|
14343
14351
|
return /* @__PURE__ */ jsxs("div", { className: "overflow-y-auto h-full w-full", children: [
|
|
14344
14352
|
/* @__PURE__ */ jsx(Threads, { children: /* @__PURE__ */ jsxs(ThreadList, { children: [
|
|
@@ -14346,8 +14354,8 @@ const ChatThreads = ({ threads, isLoading, threadId, onDelete, resourceId, resou
|
|
|
14346
14354
|
/* @__PURE__ */ jsx(Icon, { className: "bg-surface4 rounded-lg", size: "lg", children: /* @__PURE__ */ jsx(Plus, {}) }),
|
|
14347
14355
|
"New Chat"
|
|
14348
14356
|
] }) }) }),
|
|
14349
|
-
|
|
14350
|
-
|
|
14357
|
+
threads.length === 0 && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon3 py-3 px-5 max-w-[12rem]", children: "Your conversations will appear here once you start chatting!" }),
|
|
14358
|
+
threads.map((thread) => {
|
|
14351
14359
|
const isActive = thread.id === threadId;
|
|
14352
14360
|
const threadLink = resourceType === "agent" ? paths.agentThreadLink(resourceId, thread.id) : paths.networkThreadLink(resourceId, thread.id);
|
|
14353
14361
|
return /* @__PURE__ */ jsxs(ThreadItem, { isActive, children: [
|
|
@@ -14404,7 +14412,7 @@ function ThreadTitle({ title }) {
|
|
|
14404
14412
|
if (isDefaultThreadName(title)) {
|
|
14405
14413
|
return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Chat from" });
|
|
14406
14414
|
}
|
|
14407
|
-
return /* @__PURE__ */ jsx("span", { className: "truncate max-w-[14rem]", children: title });
|
|
14415
|
+
return /* @__PURE__ */ jsx("span", { className: "truncate max-w-[14rem] text-muted-foreground", children: title });
|
|
14408
14416
|
}
|
|
14409
14417
|
const formatDay = (date) => {
|
|
14410
14418
|
const options = {
|
|
@@ -14418,1063 +14426,6 @@ const formatDay = (date) => {
|
|
|
14418
14426
|
return new Date(date).toLocaleString("en-us", options).replace(",", " at");
|
|
14419
14427
|
};
|
|
14420
14428
|
|
|
14421
|
-
const defaultModelSettings = {
|
|
14422
|
-
maxRetries: 2,
|
|
14423
|
-
maxSteps: 5,
|
|
14424
|
-
temperature: 0.5,
|
|
14425
|
-
topP: 1
|
|
14426
|
-
};
|
|
14427
|
-
const NetworkContext = createContext({});
|
|
14428
|
-
function NetworkProvider({ children }) {
|
|
14429
|
-
const [modelSettings, setModelSettings] = useState(defaultModelSettings);
|
|
14430
|
-
const [chatWithLoop, setChatWithLoop] = useState(false);
|
|
14431
|
-
const [maxIterations, setMaxIterations] = useState(void 0);
|
|
14432
|
-
const resetModelSettings = () => {
|
|
14433
|
-
setModelSettings(defaultModelSettings);
|
|
14434
|
-
setChatWithLoop(false);
|
|
14435
|
-
setMaxIterations(void 0);
|
|
14436
|
-
};
|
|
14437
|
-
return /* @__PURE__ */ jsx(
|
|
14438
|
-
NetworkContext.Provider,
|
|
14439
|
-
{
|
|
14440
|
-
value: {
|
|
14441
|
-
modelSettings,
|
|
14442
|
-
setModelSettings,
|
|
14443
|
-
resetModelSettings,
|
|
14444
|
-
chatWithLoop,
|
|
14445
|
-
setChatWithLoop,
|
|
14446
|
-
maxIterations,
|
|
14447
|
-
setMaxIterations
|
|
14448
|
-
},
|
|
14449
|
-
children
|
|
14450
|
-
}
|
|
14451
|
-
);
|
|
14452
|
-
}
|
|
14453
|
-
|
|
14454
|
-
const VNextNetworkChatContext = createContext(void 0);
|
|
14455
|
-
const VNextNetworkChatProvider = ({ children }) => {
|
|
14456
|
-
const [state, setState] = useState({});
|
|
14457
|
-
const { chatWithLoop } = useContext(NetworkContext);
|
|
14458
|
-
const handleStep = (uuid, record) => {
|
|
14459
|
-
const addFinishStep = chatWithLoop && record.type === "step-finish" && record.payload?.id === "final-step" || record.type === "error";
|
|
14460
|
-
let id = record?.type === "finish" ? "finish" : record.type === "start" ? "start" : record.payload?.id;
|
|
14461
|
-
if (id?.includes("mapping_")) return;
|
|
14462
|
-
setState((prevState) => {
|
|
14463
|
-
const current = prevState[uuid];
|
|
14464
|
-
if (record.type === "error") {
|
|
14465
|
-
id = current?.executionSteps?.[current?.executionSteps.length - 1];
|
|
14466
|
-
}
|
|
14467
|
-
const currentMetadata = current?.steps?.[id]?.metadata;
|
|
14468
|
-
let startTime = currentMetadata?.startTime;
|
|
14469
|
-
let endTime = currentMetadata?.endTime;
|
|
14470
|
-
if (record.type === "step-start") {
|
|
14471
|
-
startTime = Date.now();
|
|
14472
|
-
}
|
|
14473
|
-
if (record.type === "step-finish" || record.type === "error") {
|
|
14474
|
-
endTime = Date.now();
|
|
14475
|
-
}
|
|
14476
|
-
return {
|
|
14477
|
-
...prevState,
|
|
14478
|
-
[uuid]: {
|
|
14479
|
-
...current,
|
|
14480
|
-
runId: current?.runId || record?.payload?.runId,
|
|
14481
|
-
executionSteps: current?.steps?.[id] ? [...current?.executionSteps, ...addFinishStep ? ["finish"] : []] : [...current?.executionSteps || [], id],
|
|
14482
|
-
steps: {
|
|
14483
|
-
...current?.steps,
|
|
14484
|
-
[id]: {
|
|
14485
|
-
...current?.steps?.[id] || {},
|
|
14486
|
-
[record.type]: record.payload || record?.error,
|
|
14487
|
-
metadata: {
|
|
14488
|
-
startTime,
|
|
14489
|
-
endTime
|
|
14490
|
-
}
|
|
14491
|
-
}
|
|
14492
|
-
}
|
|
14493
|
-
}
|
|
14494
|
-
};
|
|
14495
|
-
});
|
|
14496
|
-
};
|
|
14497
|
-
return /* @__PURE__ */ jsx(VNextNetworkChatContext.Provider, { value: { state, handleStep, setState }, children });
|
|
14498
|
-
};
|
|
14499
|
-
const useVNextNetworkChat = () => {
|
|
14500
|
-
const context = useContext(VNextNetworkChatContext);
|
|
14501
|
-
if (context === void 0) {
|
|
14502
|
-
throw new Error("useVNextNetworkChat must be used within a VNextNetworkChatProvider");
|
|
14503
|
-
}
|
|
14504
|
-
return context;
|
|
14505
|
-
};
|
|
14506
|
-
|
|
14507
|
-
const LabelMappings = {
|
|
14508
|
-
"Agent-Network-Outer-Workflow.routing-step": "Decision making process",
|
|
14509
|
-
"routing-step": "Decision making process",
|
|
14510
|
-
"agent-step": "Agent execution",
|
|
14511
|
-
"Agent-Network-Outer-Workflow.agent-step": "Agent execution",
|
|
14512
|
-
"workflow-step": "Workflow execution",
|
|
14513
|
-
"Agent-Network-Outer-Workflow.workflow-step": "Workflow execution",
|
|
14514
|
-
toolStep: "Tool execution",
|
|
14515
|
-
"Agent-Network-Outer-Workflow.toolStep": "Tool execution",
|
|
14516
|
-
"final-step": "Task completed"
|
|
14517
|
-
};
|
|
14518
|
-
const StepDropdown = () => {
|
|
14519
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
14520
|
-
const { state } = useVNextNetworkChat();
|
|
14521
|
-
const message = useMessage();
|
|
14522
|
-
const id = message?.metadata?.custom?.id;
|
|
14523
|
-
if (!id) return /* @__PURE__ */ jsx("div", { children: "Something is wrong" });
|
|
14524
|
-
const currentState = state[id];
|
|
14525
|
-
const latestStepId = currentState.executionSteps ? currentState.executionSteps?.[currentState.executionSteps.length - 1] : "";
|
|
14526
|
-
const hasFinished = latestStepId === "finish";
|
|
14527
|
-
const failed = Object.values(currentState?.steps || {}).some(
|
|
14528
|
-
(step) => step?.["error"] || step?.["step-result"]?.status === "failed"
|
|
14529
|
-
);
|
|
14530
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2 mb-2", children: [
|
|
14531
|
-
/* @__PURE__ */ jsxs(Button$1, { onClick: () => setIsExpanded(!isExpanded), children: [
|
|
14532
|
-
hasFinished ? /* @__PURE__ */ jsx(Fragment, { children: failed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14533
|
-
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }) }),
|
|
14534
|
-
"Failed"
|
|
14535
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14536
|
-
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }) }),
|
|
14537
|
-
"Done"
|
|
14538
|
-
] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14539
|
-
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Spinner, { className: "animate-spin" }) }),
|
|
14540
|
-
"Thinking..."
|
|
14541
|
-
] }),
|
|
14542
|
-
/* @__PURE__ */ jsx(Icon, { className: "ml-2", children: /* @__PURE__ */ jsx(ChevronDown, { className: clsx("transition-transform -rotate-90", isExpanded && "rotate-0") }) })
|
|
14543
|
-
] }),
|
|
14544
|
-
isExpanded ? /* @__PURE__ */ jsx(Steps, { id }) : null
|
|
14545
|
-
] });
|
|
14546
|
-
};
|
|
14547
|
-
const Steps = ({ id }) => {
|
|
14548
|
-
const { state } = useVNextNetworkChat();
|
|
14549
|
-
const currentState = state[id];
|
|
14550
|
-
return /* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-px rounded-lg overflow-hidden", children: currentState.executionSteps?.filter((stepId) => stepId !== "start").map((stepId, index) => /* @__PURE__ */ jsx(StepEntry, { stepId, step: currentState.steps[stepId] || {}, runId: currentState.runId }, index)) });
|
|
14551
|
-
};
|
|
14552
|
-
const StepEntry = ({ stepId, step, runId }) => {
|
|
14553
|
-
const [expanded, setExpanded] = useState(false);
|
|
14554
|
-
let stepResult = step["step-result"];
|
|
14555
|
-
const stepError = step["error"];
|
|
14556
|
-
if (stepId === "workflow-step" || stepId === "Agent-Network-Outer-Workflow.workflow-step") {
|
|
14557
|
-
const parsedResult = JSON.parse(stepResult?.output?.result ?? "{}") ?? {};
|
|
14558
|
-
if (!parsedResult?.runResult && stepResult?.status === "success") {
|
|
14559
|
-
stepResult = {
|
|
14560
|
-
...stepResult,
|
|
14561
|
-
status: "failed",
|
|
14562
|
-
error: "Something went wrong"
|
|
14563
|
-
};
|
|
14564
|
-
}
|
|
14565
|
-
}
|
|
14566
|
-
if (stepError) {
|
|
14567
|
-
stepResult = {
|
|
14568
|
-
...stepResult,
|
|
14569
|
-
status: "failed",
|
|
14570
|
-
error: stepError?.data?.error?.message
|
|
14571
|
-
};
|
|
14572
|
-
}
|
|
14573
|
-
if (stepId === "finish") {
|
|
14574
|
-
return /* @__PURE__ */ jsx("div", { className: "bg-surface4 py-2 px-3 text-icon6 flex items-center gap-4 justify-between", children: /* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: "Process completed" }) });
|
|
14575
|
-
}
|
|
14576
|
-
return /* @__PURE__ */ jsxs("li", { children: [
|
|
14577
|
-
/* @__PURE__ */ jsxs(
|
|
14578
|
-
"button",
|
|
14579
|
-
{
|
|
14580
|
-
className: "bg-surface4 py-2 px-3 text-icon6 flex items-center gap-4 justify-between w-full text-left",
|
|
14581
|
-
onClick: () => setExpanded((s) => !s),
|
|
14582
|
-
children: [
|
|
14583
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
14584
|
-
/* @__PURE__ */ jsx(StatusIcon, { status: stepResult ? stepResult?.status : "loading" }),
|
|
14585
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: LabelMappings[stepId] || stepId })
|
|
14586
|
-
] }),
|
|
14587
|
-
step.metadata?.startTime && /* @__PURE__ */ jsx(StepClock, { step })
|
|
14588
|
-
]
|
|
14589
|
-
}
|
|
14590
|
-
),
|
|
14591
|
-
(stepId === "routing-step" || stepId === "Agent-Network-Outer-Workflow.routing-step") && expanded && /* @__PURE__ */ jsxs("div", { className: "bg-surface1 p-3 space-y-4", children: [
|
|
14592
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
14593
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Selection reason:" }),
|
|
14594
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.selectionReason || "N/A" })
|
|
14595
|
-
] }),
|
|
14596
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
14597
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Resource ID" }),
|
|
14598
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.resourceId || "N/A" })
|
|
14599
|
-
] }),
|
|
14600
|
-
stepResult?.error ? /* @__PURE__ */ jsxs("div", { children: [
|
|
14601
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
14602
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.error || "N/A" })
|
|
14603
|
-
] }) : null
|
|
14604
|
-
] }),
|
|
14605
|
-
(stepId === "agent-step" || stepId === "Agent-Network-Outer-Workflow.agent-step") && (stepError || stepResult?.error) && expanded && /* @__PURE__ */ jsx("div", { className: "bg-surface1 p-3 space-y-4", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
14606
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
14607
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepError?.message || stepError?.data?.error?.message || stepResult?.error || "N/A" })
|
|
14608
|
-
] }) }),
|
|
14609
|
-
(stepId === "toolStep" || stepId === "Agent-Network-Outer-Workflow.toolStep") && (stepError || stepResult?.error) && expanded && /* @__PURE__ */ jsx("div", { className: "bg-surface1 p-3 space-y-4", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
14610
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
14611
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepError?.message || stepError?.data?.error?.message || stepResult?.error || "N/A" })
|
|
14612
|
-
] }) }),
|
|
14613
|
-
stepId === "final-step" && expanded && /* @__PURE__ */ jsxs("div", { className: "bg-surface1 p-3 space-y-4", children: [
|
|
14614
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
14615
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Task:" }),
|
|
14616
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.task || "N/A" })
|
|
14617
|
-
] }),
|
|
14618
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
14619
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Number of iterations:" }),
|
|
14620
|
-
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.iteration || "N/A" })
|
|
14621
|
-
] })
|
|
14622
|
-
] }),
|
|
14623
|
-
(stepId === "workflow-step" || stepId === "Agent-Network-Outer-Workflow.workflow-step") && stepResult?.output?.resourceId ? /* @__PURE__ */ jsx(
|
|
14624
|
-
WorkflowStepResultDialog,
|
|
14625
|
-
{
|
|
14626
|
-
open: expanded,
|
|
14627
|
-
onOpenChange: setExpanded,
|
|
14628
|
-
workflowId: stepResult?.output?.resourceId,
|
|
14629
|
-
runId
|
|
14630
|
-
}
|
|
14631
|
-
) : null
|
|
14632
|
-
] });
|
|
14633
|
-
};
|
|
14634
|
-
const WorkflowStepResultDialog = ({ open, onOpenChange, workflowId, runId }) => {
|
|
14635
|
-
const { data: runs } = useWorkflowRuns(workflowId);
|
|
14636
|
-
const { data: workflow, isLoading } = useWorkflow(workflowId);
|
|
14637
|
-
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
14638
|
-
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx(DialogPortal, { children: /* @__PURE__ */ jsx(DialogContent, { className: "h-[90vh] w-[90%] max-w-[unset]", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 h-full", children: [
|
|
14639
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Workflow details" }),
|
|
14640
|
-
/* @__PURE__ */ jsx(WorkflowRunProvider, { snapshot: typeof run?.snapshot === "object" ? run.snapshot : void 0, children: /* @__PURE__ */ jsx(WorkflowGraph, { workflowId, workflow, isLoading }) })
|
|
14641
|
-
] }) }) }) });
|
|
14642
|
-
};
|
|
14643
|
-
const StatusIcon = ({ status }) => {
|
|
14644
|
-
if (status === "failed") {
|
|
14645
|
-
return /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }) });
|
|
14646
|
-
}
|
|
14647
|
-
if (status === "success") {
|
|
14648
|
-
return /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }) });
|
|
14649
|
-
}
|
|
14650
|
-
return /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Spinner, { className: "animate-spin" }) });
|
|
14651
|
-
};
|
|
14652
|
-
const StepClock = ({ step }) => {
|
|
14653
|
-
return /* @__PURE__ */ jsx(Badge$1, { children: /* @__PURE__ */ jsx(Clock, { startedAt: step.metadata.startTime, endedAt: step.metadata?.endTime }) });
|
|
14654
|
-
};
|
|
14655
|
-
|
|
14656
|
-
const NextAssistantMessage = ({
|
|
14657
|
-
ToolFallback: ToolFallbackCustom
|
|
14658
|
-
}) => {
|
|
14659
|
-
const data = useMessage();
|
|
14660
|
-
const isSolelyToolCall = data.content.length === 1 && data.content[0].type === "tool-call";
|
|
14661
|
-
const content = data.content[0];
|
|
14662
|
-
if (!content) {
|
|
14663
|
-
return null;
|
|
14664
|
-
}
|
|
14665
|
-
const textContent = content.text;
|
|
14666
|
-
if (textContent === "start") {
|
|
14667
|
-
return /* @__PURE__ */ jsx(StepDropdown, {});
|
|
14668
|
-
}
|
|
14669
|
-
return /* @__PURE__ */ jsxs(MessagePrimitive.Root, { className: "max-w-full", children: [
|
|
14670
|
-
/* @__PURE__ */ jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsx(
|
|
14671
|
-
MessagePrimitive.Parts,
|
|
14672
|
-
{
|
|
14673
|
-
components: {
|
|
14674
|
-
Text: MarkdownText,
|
|
14675
|
-
tools: { Fallback: ToolFallbackCustom || ToolFallback }
|
|
14676
|
-
}
|
|
14677
|
-
}
|
|
14678
|
-
) }),
|
|
14679
|
-
/* @__PURE__ */ jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsx(AssistantActionBar, {}) })
|
|
14680
|
-
] });
|
|
14681
|
-
};
|
|
14682
|
-
const AssistantActionBar = () => {
|
|
14683
|
-
return /* @__PURE__ */ jsx(
|
|
14684
|
-
ActionBarPrimitive.Root,
|
|
14685
|
-
{
|
|
14686
|
-
hideWhenRunning: true,
|
|
14687
|
-
autohide: "always",
|
|
14688
|
-
autohideFloat: "single-branch",
|
|
14689
|
-
className: "flex gap-1 items-center transition-all",
|
|
14690
|
-
children: /* @__PURE__ */ jsx(ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxs(TooltipIconButton, { tooltip: "Copy", className: "bg-transparent text-icon3 hover:text-icon6", children: [
|
|
14691
|
-
/* @__PURE__ */ jsx(MessagePrimitive.If, { copied: true, children: /* @__PURE__ */ jsx(CheckIcon$1, {}) }),
|
|
14692
|
-
/* @__PURE__ */ jsx(MessagePrimitive.If, { copied: false, children: /* @__PURE__ */ jsx(CopyIcon, {}) })
|
|
14693
|
-
] }) })
|
|
14694
|
-
}
|
|
14695
|
-
);
|
|
14696
|
-
};
|
|
14697
|
-
|
|
14698
|
-
const NetworkThread = ({ ToolFallback, networkName, hasMemory }) => {
|
|
14699
|
-
const areaRef = useRef(null);
|
|
14700
|
-
useAutoscroll(areaRef, { enabled: true });
|
|
14701
|
-
const WrappedAssistantMessage = (props) => {
|
|
14702
|
-
return /* @__PURE__ */ jsx(NextAssistantMessage, { ...props, ToolFallback });
|
|
14703
|
-
};
|
|
14704
|
-
return /* @__PURE__ */ jsxs(ThreadWrapper, { children: [
|
|
14705
|
-
/* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
14706
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
14707
|
-
/* @__PURE__ */ jsx(ThreadWelcome, { networkName }),
|
|
14708
|
-
/* @__PURE__ */ jsx(
|
|
14709
|
-
ThreadPrimitive.Messages,
|
|
14710
|
-
{
|
|
14711
|
-
components: {
|
|
14712
|
-
UserMessage,
|
|
14713
|
-
EditComposer,
|
|
14714
|
-
AssistantMessage: WrappedAssistantMessage
|
|
14715
|
-
}
|
|
14716
|
-
}
|
|
14717
|
-
)
|
|
14718
|
-
] }),
|
|
14719
|
-
/* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
|
|
14720
|
-
] }),
|
|
14721
|
-
/* @__PURE__ */ jsx(Composer, { hasMemory })
|
|
14722
|
-
] });
|
|
14723
|
-
};
|
|
14724
|
-
const ThreadWrapper = ({ children }) => {
|
|
14725
|
-
const hasAttachments = useHasAttachments();
|
|
14726
|
-
return /* @__PURE__ */ jsx(
|
|
14727
|
-
ThreadPrimitive.Root,
|
|
14728
|
-
{
|
|
14729
|
-
className: clsx(
|
|
14730
|
-
"max-w-[568px] w-full mx-auto px-4",
|
|
14731
|
-
hasAttachments ? "h-[calc(100%-208px)]" : "h-[calc(100%-112px)]"
|
|
14732
|
-
),
|
|
14733
|
-
children
|
|
14734
|
-
}
|
|
14735
|
-
);
|
|
14736
|
-
};
|
|
14737
|
-
const ThreadWelcome = ({ networkName }) => {
|
|
14738
|
-
const safeNetworkName = networkName ?? "";
|
|
14739
|
-
const words = safeNetworkName.split(" ") ?? [];
|
|
14740
|
-
let initials = "A";
|
|
14741
|
-
if (words.length === 2) {
|
|
14742
|
-
initials = `${words[0][0]}${words[1][0]}`;
|
|
14743
|
-
} else if (safeNetworkName.length > 0) {
|
|
14744
|
-
initials = `${safeNetworkName[0]}`;
|
|
14745
|
-
} else {
|
|
14746
|
-
initials = "A";
|
|
14747
|
-
}
|
|
14748
|
-
return /* @__PURE__ */ jsx(ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
|
|
14749
|
-
/* @__PURE__ */ jsx(Avatar, { children: /* @__PURE__ */ jsx(AvatarFallback, { children: initials }) }),
|
|
14750
|
-
/* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
14751
|
-
] }) });
|
|
14752
|
-
};
|
|
14753
|
-
const Composer = ({ hasMemory }) => {
|
|
14754
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
14755
|
-
/* @__PURE__ */ jsxs(ComposerPrimitive.Root, { children: [
|
|
14756
|
-
/* @__PURE__ */ jsx(ComposerAttachments, {}),
|
|
14757
|
-
/* @__PURE__ */ jsxs("div", { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
|
|
14758
|
-
/* @__PURE__ */ jsx(ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(
|
|
14759
|
-
"textarea",
|
|
14760
|
-
{
|
|
14761
|
-
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent resize-none",
|
|
14762
|
-
autoFocus: true,
|
|
14763
|
-
placeholder: "Enter your message...",
|
|
14764
|
-
name: "",
|
|
14765
|
-
id: ""
|
|
14766
|
-
}
|
|
14767
|
-
) }),
|
|
14768
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
14769
|
-
/* @__PURE__ */ jsx(SpeechInput, {}),
|
|
14770
|
-
/* @__PURE__ */ jsx(ComposerAction, {})
|
|
14771
|
-
] })
|
|
14772
|
-
] })
|
|
14773
|
-
] }),
|
|
14774
|
-
!hasMemory && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
|
|
14775
|
-
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(InfoIcon, {}) }),
|
|
14776
|
-
"Memory is not enabled. The conversation will not be persisted."
|
|
14777
|
-
] })
|
|
14778
|
-
] });
|
|
14779
|
-
};
|
|
14780
|
-
const SpeechInput = () => {
|
|
14781
|
-
const composerRuntime = useComposerRuntime();
|
|
14782
|
-
const { start, stop, isListening, transcript } = useSpeechRecognition({});
|
|
14783
|
-
useEffect(() => {
|
|
14784
|
-
if (!transcript) return;
|
|
14785
|
-
composerRuntime.setText(transcript);
|
|
14786
|
-
}, [composerRuntime, transcript]);
|
|
14787
|
-
return /* @__PURE__ */ jsx(
|
|
14788
|
-
TooltipIconButton,
|
|
14789
|
-
{
|
|
14790
|
-
type: "button",
|
|
14791
|
-
tooltip: isListening ? "Stop dictation" : "Start dictation",
|
|
14792
|
-
variant: "ghost",
|
|
14793
|
-
className: "rounded-full",
|
|
14794
|
-
onClick: () => isListening ? stop() : start(),
|
|
14795
|
-
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsx(Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
14796
|
-
}
|
|
14797
|
-
);
|
|
14798
|
-
};
|
|
14799
|
-
const ComposerAction = () => {
|
|
14800
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14801
|
-
/* @__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]" }) }) }),
|
|
14802
|
-
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsx(ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
14803
|
-
TooltipIconButton,
|
|
14804
|
-
{
|
|
14805
|
-
tooltip: "Send",
|
|
14806
|
-
variant: "default",
|
|
14807
|
-
className: "rounded-full border-sm border-[#363636] bg-[#292929]",
|
|
14808
|
-
children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
14809
|
-
}
|
|
14810
|
-
) }) }),
|
|
14811
|
-
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsx(CircleStopIcon, {}) }) }) })
|
|
14812
|
-
] });
|
|
14813
|
-
};
|
|
14814
|
-
const EditComposer = () => {
|
|
14815
|
-
return /* @__PURE__ */ jsxs(ComposerPrimitive.Root, { children: [
|
|
14816
|
-
/* @__PURE__ */ jsx(ComposerPrimitive.Input, {}),
|
|
14817
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
14818
|
-
/* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(Button$2, { variant: "ghost", children: "Cancel" }) }),
|
|
14819
|
-
/* @__PURE__ */ jsx(ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsx(Button$2, { children: "Send" }) })
|
|
14820
|
-
] })
|
|
14821
|
-
] });
|
|
14822
|
-
};
|
|
14823
|
-
const CircleStopIcon = () => {
|
|
14824
|
-
return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
14825
|
-
};
|
|
14826
|
-
|
|
14827
|
-
const MessagesContext = createContext({
|
|
14828
|
-
messages: [],
|
|
14829
|
-
setMessages: () => {
|
|
14830
|
-
},
|
|
14831
|
-
appendToLastMessage: () => {
|
|
14832
|
-
}
|
|
14833
|
-
});
|
|
14834
|
-
const MessagesProvider = ({ children }) => {
|
|
14835
|
-
const [messages, setMessages] = useState([]);
|
|
14836
|
-
const appendToLastMessage = (partial) => setMessages((msgs) => {
|
|
14837
|
-
const lastMsg = msgs[msgs.length - 1];
|
|
14838
|
-
const content = typeof lastMsg.content === "string" ? lastMsg.content : (lastMsg.content?.[0]).text;
|
|
14839
|
-
return [
|
|
14840
|
-
...msgs.slice(0, -1),
|
|
14841
|
-
{
|
|
14842
|
-
...lastMsg,
|
|
14843
|
-
content: [{ type: "text", text: content + partial }]
|
|
14844
|
-
}
|
|
14845
|
-
];
|
|
14846
|
-
});
|
|
14847
|
-
return /* @__PURE__ */ jsx(MessagesContext.Provider, { value: { messages, setMessages, appendToLastMessage }, children });
|
|
14848
|
-
};
|
|
14849
|
-
const useMessages = () => useContext(MessagesContext);
|
|
14850
|
-
|
|
14851
|
-
const convertMessage = (message) => {
|
|
14852
|
-
return message;
|
|
14853
|
-
};
|
|
14854
|
-
function VNextMastraNetworkRuntimeProvider({
|
|
14855
|
-
children,
|
|
14856
|
-
networkId,
|
|
14857
|
-
memory,
|
|
14858
|
-
threadId,
|
|
14859
|
-
refreshThreadList,
|
|
14860
|
-
initialMessages,
|
|
14861
|
-
runtimeContext
|
|
14862
|
-
}) {
|
|
14863
|
-
const runIdRef = useRef(void 0);
|
|
14864
|
-
const [isRunning, setIsRunning] = useState(false);
|
|
14865
|
-
const { messages, setMessages, appendToLastMessage } = useMessages();
|
|
14866
|
-
const [currentThreadId, setCurrentThreadId] = useState(threadId);
|
|
14867
|
-
const { handleStep, state, setState } = useVNextNetworkChat();
|
|
14868
|
-
const { chatWithLoop, maxIterations } = useContext(NetworkContext);
|
|
14869
|
-
const id = runIdRef.current;
|
|
14870
|
-
const currentState = id ? state[id] : void 0;
|
|
14871
|
-
const runtimeContextInstance = new RuntimeContext$2();
|
|
14872
|
-
Object.entries(runtimeContext ?? {}).forEach(([key, value]) => {
|
|
14873
|
-
runtimeContextInstance.set(key, value);
|
|
14874
|
-
});
|
|
14875
|
-
useEffect(() => {
|
|
14876
|
-
if (!currentState) return;
|
|
14877
|
-
const hasFinished = Boolean(currentState?.steps?.["finish"]);
|
|
14878
|
-
if (!hasFinished) return;
|
|
14879
|
-
const workflowStep = currentState?.steps?.["workflow-step"];
|
|
14880
|
-
const toolStep = currentState?.steps?.["toolStep"];
|
|
14881
|
-
if (!workflowStep && !toolStep) return;
|
|
14882
|
-
const workflowStepResult = workflowStep?.["step-result"];
|
|
14883
|
-
const toolStepResult = toolStep?.["step-result"];
|
|
14884
|
-
if (!workflowStepResult && !toolStepResult) return;
|
|
14885
|
-
const workflowStepResultOutput = workflowStepResult?.output;
|
|
14886
|
-
const toolStepResultOutput = toolStepResult?.output;
|
|
14887
|
-
if (!workflowStepResultOutput && !toolStepResultOutput) return;
|
|
14888
|
-
const run = async () => {
|
|
14889
|
-
const parsedResult = workflowStepResult ? JSON.parse(workflowStepResult?.output?.result ?? "{}") ?? {} : { runResult: toolStepResultOutput?.result ?? {} };
|
|
14890
|
-
if (parsedResult?.runResult) {
|
|
14891
|
-
const runResult = parsedResult?.runResult ?? {};
|
|
14892
|
-
const formatted = await formatJSON(JSON.stringify(runResult));
|
|
14893
|
-
setMessages((msgs) => [
|
|
14894
|
-
...msgs,
|
|
14895
|
-
{ role: "assistant", content: [{ type: "text", text: `\`\`\`json
|
|
14896
|
-
${formatted}\`\`\`` }] }
|
|
14897
|
-
]);
|
|
14898
|
-
}
|
|
14899
|
-
};
|
|
14900
|
-
run();
|
|
14901
|
-
}, [currentState]);
|
|
14902
|
-
useEffect(() => {
|
|
14903
|
-
if (messages.length === 0 || currentThreadId !== threadId) {
|
|
14904
|
-
const run = async (result, messageId) => {
|
|
14905
|
-
const formatted = await formatJSON(result);
|
|
14906
|
-
const finalResponse = `\`\`\`json
|
|
14907
|
-
${formatted}\`\`\``;
|
|
14908
|
-
setMessages((currentConversation) => {
|
|
14909
|
-
return currentConversation.map((message) => {
|
|
14910
|
-
if (message.metadata?.custom?.id === messageId) {
|
|
14911
|
-
return { ...message, content: [{ type: "text", text: finalResponse }] };
|
|
14912
|
-
}
|
|
14913
|
-
return message;
|
|
14914
|
-
});
|
|
14915
|
-
});
|
|
14916
|
-
};
|
|
14917
|
-
if (initialMessages && threadId && memory) {
|
|
14918
|
-
let userMessage = "";
|
|
14919
|
-
let iteration = 1;
|
|
14920
|
-
const formattedMessages = [];
|
|
14921
|
-
let assistantStep = freshAssistantStep();
|
|
14922
|
-
for (let i = 0; i < initialMessages.length; i++) {
|
|
14923
|
-
const message = initialMessages[i];
|
|
14924
|
-
if (message.role === "user") {
|
|
14925
|
-
assistantStep = freshAssistantStep();
|
|
14926
|
-
userMessage = message.content;
|
|
14927
|
-
formattedMessages.push({
|
|
14928
|
-
role: "user",
|
|
14929
|
-
message
|
|
14930
|
-
});
|
|
14931
|
-
continue;
|
|
14932
|
-
}
|
|
14933
|
-
if (message.role === "assistant") {
|
|
14934
|
-
const responseArray = message.parts ?? [];
|
|
14935
|
-
let hasRoutingDecision = false;
|
|
14936
|
-
let hasTaskCompleteDecision = false;
|
|
14937
|
-
let directText = "";
|
|
14938
|
-
let jsonStringResponse = "";
|
|
14939
|
-
for (const part of responseArray) {
|
|
14940
|
-
if (part.type === "text" && part.text) {
|
|
14941
|
-
const parsed = safeParse(part.text);
|
|
14942
|
-
if (parsed?.resourceId && parsed?.resourceType) {
|
|
14943
|
-
hasRoutingDecision = true;
|
|
14944
|
-
assistantStep.routingDecision = parsed;
|
|
14945
|
-
}
|
|
14946
|
-
if (typeof parsed?.isComplete === "boolean") {
|
|
14947
|
-
hasTaskCompleteDecision = true;
|
|
14948
|
-
assistantStep.taskCompleteDecision = parsed;
|
|
14949
|
-
if (parsed?.isComplete) {
|
|
14950
|
-
assistantStep.finalResponse = parsed.finalResult;
|
|
14951
|
-
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
14952
|
-
assistantStep = freshAssistantStep();
|
|
14953
|
-
}
|
|
14954
|
-
}
|
|
14955
|
-
if (!parsed || !parsed.resourceId && !parsed.runResult && typeof parsed.isComplete !== "boolean") {
|
|
14956
|
-
directText = part.text;
|
|
14957
|
-
}
|
|
14958
|
-
if (parsed && !parsed.resourceId && typeof parsed.isComplete !== "boolean") {
|
|
14959
|
-
jsonStringResponse = part.text;
|
|
14960
|
-
}
|
|
14961
|
-
}
|
|
14962
|
-
}
|
|
14963
|
-
if (!hasRoutingDecision && !hasTaskCompleteDecision) {
|
|
14964
|
-
assistantStep.finalResponse = directText || jsonStringResponse;
|
|
14965
|
-
if (assistantStep.routingDecision || assistantStep.finalResponse) {
|
|
14966
|
-
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
14967
|
-
assistantStep = freshAssistantStep();
|
|
14968
|
-
}
|
|
14969
|
-
}
|
|
14970
|
-
}
|
|
14971
|
-
if (i === initialMessages.length - 1 && (assistantStep.routingDecision || assistantStep.finalResponse)) {
|
|
14972
|
-
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
14973
|
-
}
|
|
14974
|
-
}
|
|
14975
|
-
for (const formattedMessage of formattedMessages) {
|
|
14976
|
-
const { role, message } = formattedMessage;
|
|
14977
|
-
if (role === "user") {
|
|
14978
|
-
iteration = 1;
|
|
14979
|
-
userMessage = message.content;
|
|
14980
|
-
setMessages((currentConversation) => {
|
|
14981
|
-
if (currentConversation.some((m) => m.id === message.id)) {
|
|
14982
|
-
return currentConversation;
|
|
14983
|
-
}
|
|
14984
|
-
return [...currentConversation, message];
|
|
14985
|
-
});
|
|
14986
|
-
}
|
|
14987
|
-
if (role === "assistant") {
|
|
14988
|
-
const { id: id2, formattedMessageId, finalStepId, routingDecision, finalResponse, taskCompleteDecision } = message;
|
|
14989
|
-
let resourceStepId = "";
|
|
14990
|
-
if (routingDecision?.resourceType === "agent") resourceStepId = "agent-step";
|
|
14991
|
-
if (routingDecision?.resourceType === "tool") resourceStepId = "toolStep";
|
|
14992
|
-
if (routingDecision?.resourceType === "workflow") resourceStepId = "workflow-step";
|
|
14993
|
-
let runId = "";
|
|
14994
|
-
let runResult = {};
|
|
14995
|
-
let finalStep = null;
|
|
14996
|
-
let finalResult = "";
|
|
14997
|
-
if (resourceStepId === "workflow-step" || resourceStepId === "toolStep") {
|
|
14998
|
-
const parsedResult = JSON.parse(finalResponse ?? "{}") ?? {};
|
|
14999
|
-
runResult = resourceStepId === "workflow-step" ? parsedResult?.runResult ?? {} : parsedResult ?? {};
|
|
15000
|
-
runId = parsedResult?.runId ?? "";
|
|
15001
|
-
}
|
|
15002
|
-
if (taskCompleteDecision?.isComplete) {
|
|
15003
|
-
finalStep = {
|
|
15004
|
-
executionSteps: ["start", "routing-step", "final-step", "finish"],
|
|
15005
|
-
runId: "",
|
|
15006
|
-
steps: {
|
|
15007
|
-
start: {},
|
|
15008
|
-
"routing-step": {
|
|
15009
|
-
"step-result": {
|
|
15010
|
-
output: {
|
|
15011
|
-
selectionReason: taskCompleteDecision?.completionReason ?? ""
|
|
15012
|
-
},
|
|
15013
|
-
status: "success"
|
|
15014
|
-
}
|
|
15015
|
-
},
|
|
15016
|
-
"final-step": {
|
|
15017
|
-
"step-result": {
|
|
15018
|
-
output: {
|
|
15019
|
-
iteration,
|
|
15020
|
-
task: userMessage
|
|
15021
|
-
},
|
|
15022
|
-
status: "success"
|
|
15023
|
-
}
|
|
15024
|
-
},
|
|
15025
|
-
finish: {}
|
|
15026
|
-
}
|
|
15027
|
-
};
|
|
15028
|
-
finalResult = taskCompleteDecision?.finalResult;
|
|
15029
|
-
}
|
|
15030
|
-
const routingStepFailed = resourceStepId === "workflow-step" || resourceStepId === "toolStep" ? Object.keys(runResult).length === 0 : !finalResponse;
|
|
15031
|
-
setState((currentState2) => {
|
|
15032
|
-
return {
|
|
15033
|
-
...currentState2,
|
|
15034
|
-
...finalStep ? { [finalStepId]: finalStep } : {
|
|
15035
|
-
[id2]: {
|
|
15036
|
-
executionSteps: ["start", "routing-step", resourceStepId, "finish"],
|
|
15037
|
-
runId,
|
|
15038
|
-
steps: {
|
|
15039
|
-
start: {},
|
|
15040
|
-
"routing-step": {
|
|
15041
|
-
"step-result": {
|
|
15042
|
-
output: routingDecision,
|
|
15043
|
-
status: routingDecision ? "success" : "failed",
|
|
15044
|
-
...routingDecision ? {} : { error: "Something went wrong" }
|
|
15045
|
-
}
|
|
15046
|
-
},
|
|
15047
|
-
[resourceStepId]: {
|
|
15048
|
-
"step-result": {
|
|
15049
|
-
output: {
|
|
15050
|
-
resourceId: routingDecision?.resourceId,
|
|
15051
|
-
result: finalResponse ?? ""
|
|
15052
|
-
},
|
|
15053
|
-
status: routingStepFailed ? "failed" : "success",
|
|
15054
|
-
...routingStepFailed ? { error: "Something went wrong" } : {}
|
|
15055
|
-
}
|
|
15056
|
-
},
|
|
15057
|
-
finish: {}
|
|
15058
|
-
}
|
|
15059
|
-
}
|
|
15060
|
-
}
|
|
15061
|
-
};
|
|
15062
|
-
});
|
|
15063
|
-
setMessages((currentConversation) => {
|
|
15064
|
-
const assistantRoutingMessageExist = currentConversation.some(
|
|
15065
|
-
(message2) => message2.metadata?.custom?.id === id2
|
|
15066
|
-
);
|
|
15067
|
-
const assistantResponseMessageExist = currentConversation.some(
|
|
15068
|
-
(message2) => message2.metadata?.custom?.id === formattedMessageId
|
|
15069
|
-
);
|
|
15070
|
-
return [
|
|
15071
|
-
...currentConversation,
|
|
15072
|
-
...finalResult ? [
|
|
15073
|
-
{
|
|
15074
|
-
role: "assistant",
|
|
15075
|
-
metadata: {
|
|
15076
|
-
custom: {
|
|
15077
|
-
id: finalStepId
|
|
15078
|
-
}
|
|
15079
|
-
},
|
|
15080
|
-
content: [
|
|
15081
|
-
{
|
|
15082
|
-
type: "text",
|
|
15083
|
-
text: "start"
|
|
15084
|
-
}
|
|
15085
|
-
]
|
|
15086
|
-
},
|
|
15087
|
-
{
|
|
15088
|
-
role: "assistant",
|
|
15089
|
-
content: [{ type: "text", text: finalResult }]
|
|
15090
|
-
}
|
|
15091
|
-
] : [
|
|
15092
|
-
...assistantRoutingMessageExist ? [] : [
|
|
15093
|
-
{
|
|
15094
|
-
role: "assistant",
|
|
15095
|
-
metadata: {
|
|
15096
|
-
custom: {
|
|
15097
|
-
id: id2
|
|
15098
|
-
}
|
|
15099
|
-
},
|
|
15100
|
-
content: [
|
|
15101
|
-
{
|
|
15102
|
-
type: "text",
|
|
15103
|
-
text: "start"
|
|
15104
|
-
}
|
|
15105
|
-
]
|
|
15106
|
-
}
|
|
15107
|
-
],
|
|
15108
|
-
...assistantResponseMessageExist ? [] : [
|
|
15109
|
-
{
|
|
15110
|
-
role: "assistant",
|
|
15111
|
-
content: [
|
|
15112
|
-
{
|
|
15113
|
-
type: "text",
|
|
15114
|
-
text: resourceStepId === "workflow-step" || resourceStepId === "toolStep" ? "" : finalResponse
|
|
15115
|
-
}
|
|
15116
|
-
],
|
|
15117
|
-
metadata: {
|
|
15118
|
-
custom: {
|
|
15119
|
-
id: formattedMessageId
|
|
15120
|
-
}
|
|
15121
|
-
}
|
|
15122
|
-
}
|
|
15123
|
-
]
|
|
15124
|
-
]
|
|
15125
|
-
];
|
|
15126
|
-
});
|
|
15127
|
-
if ((resourceStepId === "workflow-step" || resourceStepId === "toolStep") && !routingStepFailed) {
|
|
15128
|
-
run(JSON.stringify(runResult), formattedMessageId);
|
|
15129
|
-
}
|
|
15130
|
-
iteration++;
|
|
15131
|
-
}
|
|
15132
|
-
}
|
|
15133
|
-
setCurrentThreadId(threadId);
|
|
15134
|
-
}
|
|
15135
|
-
}
|
|
15136
|
-
}, [initialMessages, threadId, memory, messages]);
|
|
15137
|
-
const mastra = useMastraClient();
|
|
15138
|
-
const network = mastra.getVNextNetwork(networkId);
|
|
15139
|
-
const onNew = async (message) => {
|
|
15140
|
-
runIdRef.current = void 0;
|
|
15141
|
-
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
15142
|
-
const input = message.content[0].text;
|
|
15143
|
-
setMessages((currentConversation) => [...currentConversation, { role: "user", content: input }]);
|
|
15144
|
-
setIsRunning(true);
|
|
15145
|
-
try {
|
|
15146
|
-
if (chatWithLoop) {
|
|
15147
|
-
const run = async (result, messageId) => {
|
|
15148
|
-
const formatted = await formatJSON(result);
|
|
15149
|
-
const finalResponse = `\`\`\`json
|
|
15150
|
-
${formatted}\`\`\``;
|
|
15151
|
-
setMessages((currentConversation) => {
|
|
15152
|
-
return currentConversation.map((message2) => {
|
|
15153
|
-
if (message2.metadata?.custom?.id === messageId) {
|
|
15154
|
-
return { ...message2, content: [{ type: "text", text: finalResponse }] };
|
|
15155
|
-
}
|
|
15156
|
-
return message2;
|
|
15157
|
-
});
|
|
15158
|
-
});
|
|
15159
|
-
};
|
|
15160
|
-
let isAgentNetworkOuterWorkflowCompleted = false;
|
|
15161
|
-
await network.loopStream(
|
|
15162
|
-
{
|
|
15163
|
-
message: input,
|
|
15164
|
-
threadId,
|
|
15165
|
-
resourceId: networkId,
|
|
15166
|
-
maxIterations,
|
|
15167
|
-
runtimeContext: runtimeContextInstance
|
|
15168
|
-
},
|
|
15169
|
-
async (record) => {
|
|
15170
|
-
if (record.type === "step-start" && record.payload?.id === "Agent-Network-Outer-Workflow") {
|
|
15171
|
-
const id2 = v4();
|
|
15172
|
-
runIdRef.current = id2;
|
|
15173
|
-
setMessages((currentConversation) => {
|
|
15174
|
-
return [
|
|
15175
|
-
...currentConversation,
|
|
15176
|
-
{
|
|
15177
|
-
role: "assistant",
|
|
15178
|
-
metadata: {
|
|
15179
|
-
custom: {
|
|
15180
|
-
id: id2
|
|
15181
|
-
}
|
|
15182
|
-
},
|
|
15183
|
-
content: [
|
|
15184
|
-
{
|
|
15185
|
-
type: "text",
|
|
15186
|
-
text: "start"
|
|
15187
|
-
}
|
|
15188
|
-
]
|
|
15189
|
-
}
|
|
15190
|
-
];
|
|
15191
|
-
});
|
|
15192
|
-
} else if (runIdRef.current) {
|
|
15193
|
-
if (record.type === "tool-call-delta") {
|
|
15194
|
-
appendToLastMessage(record.argsTextDelta);
|
|
15195
|
-
} else if (record.type === "tool-call-streaming-start") {
|
|
15196
|
-
setMessages((msgs) => [...msgs, { role: "assistant", content: [{ type: "text", text: "" }] }]);
|
|
15197
|
-
setTimeout(() => {
|
|
15198
|
-
refreshThreadList?.();
|
|
15199
|
-
}, 500);
|
|
15200
|
-
return;
|
|
15201
|
-
} else {
|
|
15202
|
-
if (record.type === "step-finish" && record.payload?.id === "Agent-Network-Outer-Workflow") {
|
|
15203
|
-
if (!isAgentNetworkOuterWorkflowCompleted) {
|
|
15204
|
-
handleStep(runIdRef.current, { ...record, type: "finish" });
|
|
15205
|
-
runIdRef.current = void 0;
|
|
15206
|
-
}
|
|
15207
|
-
} else if (record.type === "step-result" && (record.payload?.id === "Agent-Network-Outer-Workflow.workflow-step" || record.payload?.id === "Agent-Network-Outer-Workflow.toolStep")) {
|
|
15208
|
-
handleStep(runIdRef.current, record);
|
|
15209
|
-
const result = record?.payload?.output?.result;
|
|
15210
|
-
const parsedResult = typeof result === "string" ? JSON.parse(record?.payload?.output?.result ?? "{}") ?? {} : { runResult: result };
|
|
15211
|
-
const runResult = parsedResult?.runResult ?? {};
|
|
15212
|
-
const formatedOutputId = v4();
|
|
15213
|
-
setMessages((msgs) => [
|
|
15214
|
-
...msgs,
|
|
15215
|
-
{
|
|
15216
|
-
role: "assistant",
|
|
15217
|
-
content: [
|
|
15218
|
-
{
|
|
15219
|
-
type: "text",
|
|
15220
|
-
text: ""
|
|
15221
|
-
}
|
|
15222
|
-
],
|
|
15223
|
-
metadata: {
|
|
15224
|
-
custom: {
|
|
15225
|
-
id: formatedOutputId
|
|
15226
|
-
}
|
|
15227
|
-
}
|
|
15228
|
-
}
|
|
15229
|
-
]);
|
|
15230
|
-
run(JSON.stringify(runResult), formatedOutputId);
|
|
15231
|
-
} else if (record.payload?.id === "Agent-Network-Outer-Workflow" || record.payload?.id === "finish-step") {
|
|
15232
|
-
if (record.type === "step-result" && record.payload?.id === "Agent-Network-Outer-Workflow") {
|
|
15233
|
-
isAgentNetworkOuterWorkflowCompleted = record?.payload?.output?.isComplete;
|
|
15234
|
-
}
|
|
15235
|
-
} else {
|
|
15236
|
-
handleStep(runIdRef.current, record);
|
|
15237
|
-
}
|
|
15238
|
-
}
|
|
15239
|
-
}
|
|
15240
|
-
if (record.type === "step-result" && record.payload?.id === "final-step") {
|
|
15241
|
-
setMessages((msgs) => [
|
|
15242
|
-
...msgs,
|
|
15243
|
-
{ role: "assistant", content: [{ type: "text", text: record.payload?.output?.result }] }
|
|
15244
|
-
]);
|
|
15245
|
-
}
|
|
15246
|
-
if (record.type === "step-finish" && record.payload?.id === "final-step") {
|
|
15247
|
-
runIdRef.current = void 0;
|
|
15248
|
-
}
|
|
15249
|
-
if (record.type === "start" || record.type === "step-start" || record.type === "finish") {
|
|
15250
|
-
setTimeout(() => {
|
|
15251
|
-
refreshThreadList?.();
|
|
15252
|
-
}, 500);
|
|
15253
|
-
}
|
|
15254
|
-
}
|
|
15255
|
-
);
|
|
15256
|
-
} else {
|
|
15257
|
-
await network.stream(
|
|
15258
|
-
{
|
|
15259
|
-
message: input,
|
|
15260
|
-
threadId,
|
|
15261
|
-
resourceId: networkId,
|
|
15262
|
-
runtimeContext: runtimeContextInstance
|
|
15263
|
-
},
|
|
15264
|
-
(record) => {
|
|
15265
|
-
if (runIdRef.current) {
|
|
15266
|
-
if (record.type === "tool-call-delta") {
|
|
15267
|
-
appendToLastMessage(record.argsTextDelta);
|
|
15268
|
-
} else if (record.type === "tool-call-streaming-start") {
|
|
15269
|
-
setMessages((msgs) => [...msgs, { role: "assistant", content: [{ type: "text", text: "" }] }]);
|
|
15270
|
-
return;
|
|
15271
|
-
} else {
|
|
15272
|
-
handleStep(runIdRef.current, record);
|
|
15273
|
-
}
|
|
15274
|
-
} else if (record.type === "start") {
|
|
15275
|
-
const id2 = v4();
|
|
15276
|
-
runIdRef.current = id2;
|
|
15277
|
-
setMessages((currentConversation) => {
|
|
15278
|
-
return [
|
|
15279
|
-
...currentConversation,
|
|
15280
|
-
{
|
|
15281
|
-
role: "assistant",
|
|
15282
|
-
metadata: {
|
|
15283
|
-
custom: {
|
|
15284
|
-
id: id2
|
|
15285
|
-
}
|
|
15286
|
-
},
|
|
15287
|
-
content: [
|
|
15288
|
-
{
|
|
15289
|
-
type: "text",
|
|
15290
|
-
text: "start"
|
|
15291
|
-
}
|
|
15292
|
-
]
|
|
15293
|
-
}
|
|
15294
|
-
];
|
|
15295
|
-
});
|
|
15296
|
-
}
|
|
15297
|
-
if (record.type === "start" || record.type === "step-start" || record.type === "finish") {
|
|
15298
|
-
setTimeout(() => {
|
|
15299
|
-
refreshThreadList?.();
|
|
15300
|
-
}, 500);
|
|
15301
|
-
}
|
|
15302
|
-
}
|
|
15303
|
-
);
|
|
15304
|
-
}
|
|
15305
|
-
setIsRunning(false);
|
|
15306
|
-
} catch (error) {
|
|
15307
|
-
console.error("Error occurred in VNextMastraNetworkRuntimeProvider", error);
|
|
15308
|
-
setIsRunning(false);
|
|
15309
|
-
}
|
|
15310
|
-
};
|
|
15311
|
-
const runtime = useExternalStoreRuntime({
|
|
15312
|
-
isRunning,
|
|
15313
|
-
messages,
|
|
15314
|
-
convertMessage,
|
|
15315
|
-
onNew
|
|
15316
|
-
});
|
|
15317
|
-
return /* @__PURE__ */ jsxs(AssistantRuntimeProvider, { runtime, children: [
|
|
15318
|
-
" ",
|
|
15319
|
-
children,
|
|
15320
|
-
" "
|
|
15321
|
-
] });
|
|
15322
|
-
function safeParse(str) {
|
|
15323
|
-
try {
|
|
15324
|
-
return JSON.parse(str);
|
|
15325
|
-
} catch {
|
|
15326
|
-
return void 0;
|
|
15327
|
-
}
|
|
15328
|
-
}
|
|
15329
|
-
function freshAssistantStep() {
|
|
15330
|
-
return {
|
|
15331
|
-
id: v4(),
|
|
15332
|
-
formattedMessageId: v4(),
|
|
15333
|
-
finalStepId: v4(),
|
|
15334
|
-
finalResponse: ""
|
|
15335
|
-
};
|
|
15336
|
-
}
|
|
15337
|
-
}
|
|
15338
|
-
|
|
15339
|
-
const VNextNetworkChat = ({
|
|
15340
|
-
networkId,
|
|
15341
|
-
networkName,
|
|
15342
|
-
threadId,
|
|
15343
|
-
initialMessages,
|
|
15344
|
-
memory,
|
|
15345
|
-
refreshThreadList
|
|
15346
|
-
}) => {
|
|
15347
|
-
const { runtimeContext } = usePlaygroundStore();
|
|
15348
|
-
return /* @__PURE__ */ jsx(MessagesProvider, { children: /* @__PURE__ */ jsx(VNextNetworkChatProvider, { children: /* @__PURE__ */ jsx(
|
|
15349
|
-
VNextMastraNetworkRuntimeProvider,
|
|
15350
|
-
{
|
|
15351
|
-
networkId,
|
|
15352
|
-
initialMessages: initialMessages ?? [],
|
|
15353
|
-
threadId,
|
|
15354
|
-
memory,
|
|
15355
|
-
refreshThreadList,
|
|
15356
|
-
runtimeContext,
|
|
15357
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsx(NetworkThread, { hasMemory: memory, networkName }) })
|
|
15358
|
-
},
|
|
15359
|
-
threadId
|
|
15360
|
-
) }, threadId) }, threadId);
|
|
15361
|
-
};
|
|
15362
|
-
|
|
15363
|
-
const columns = [
|
|
15364
|
-
{
|
|
15365
|
-
id: "name",
|
|
15366
|
-
header: "Name",
|
|
15367
|
-
cell: ({ row }) => {
|
|
15368
|
-
const { Link } = useLinkComponent();
|
|
15369
|
-
return /* @__PURE__ */ jsx(
|
|
15370
|
-
EntryCell,
|
|
15371
|
-
{
|
|
15372
|
-
icon: /* @__PURE__ */ jsx(AgentIcon, {}),
|
|
15373
|
-
name: /* @__PURE__ */ jsx(Link, { className: "w-full space-y-0", href: `/networks/v-next/${row.original.id}/chat`, children: row.original.name }),
|
|
15374
|
-
description: row.original.instructions
|
|
15375
|
-
}
|
|
15376
|
-
);
|
|
15377
|
-
},
|
|
15378
|
-
meta: {
|
|
15379
|
-
width: "auto"
|
|
15380
|
-
}
|
|
15381
|
-
},
|
|
15382
|
-
{
|
|
15383
|
-
id: "agents",
|
|
15384
|
-
header: "Agents",
|
|
15385
|
-
cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(Users, {}), children: row.original.agentsSize }) })
|
|
15386
|
-
},
|
|
15387
|
-
{
|
|
15388
|
-
id: "workflows",
|
|
15389
|
-
header: "Workflows",
|
|
15390
|
-
cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(WorkflowIcon, {}), children: row.original.workflowsSize }) })
|
|
15391
|
-
},
|
|
15392
|
-
{
|
|
15393
|
-
id: "tools",
|
|
15394
|
-
header: "Tools",
|
|
15395
|
-
cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(ToolsIcon, {}), children: row.original.toolsSize }) })
|
|
15396
|
-
},
|
|
15397
|
-
{
|
|
15398
|
-
id: "model",
|
|
15399
|
-
header: "Routing Models",
|
|
15400
|
-
cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { className: "truncate", children: /* @__PURE__ */ jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(Brain, {}), children: row.original.routingModel }) })
|
|
15401
|
-
}
|
|
15402
|
-
];
|
|
15403
|
-
|
|
15404
|
-
const NetworkTable = ({ networks, isLoading }) => {
|
|
15405
|
-
const { navigate, paths } = useLinkComponent();
|
|
15406
|
-
const allNetworks = useMemo(
|
|
15407
|
-
() => [
|
|
15408
|
-
...networks?.map((network) => ({
|
|
15409
|
-
...network,
|
|
15410
|
-
routingModel: network.routingModel.modelId,
|
|
15411
|
-
agentsSize: network.agents.length,
|
|
15412
|
-
workflowsSize: network.workflows.length,
|
|
15413
|
-
toolsSize: network.tools.length
|
|
15414
|
-
})) ?? []
|
|
15415
|
-
],
|
|
15416
|
-
[networks]
|
|
15417
|
-
);
|
|
15418
|
-
const table = useReactTable({
|
|
15419
|
-
data: allNetworks,
|
|
15420
|
-
columns,
|
|
15421
|
-
getCoreRowModel: getCoreRowModel()
|
|
15422
|
-
});
|
|
15423
|
-
if (isLoading) return /* @__PURE__ */ jsx(NetworkTableSkeleton, {});
|
|
15424
|
-
const ths = table.getHeaderGroups()[0];
|
|
15425
|
-
const rows = table.getRowModel().rows.concat();
|
|
15426
|
-
if (rows.length === 0) {
|
|
15427
|
-
return /* @__PURE__ */ jsx(NetworkTableEmpty, {});
|
|
15428
|
-
}
|
|
15429
|
-
return /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
|
|
15430
|
-
/* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
|
|
15431
|
-
/* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(paths.networkLink(row.original.id)), className: "cursor-pointer", children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
|
|
15432
|
-
] }) });
|
|
15433
|
-
};
|
|
15434
|
-
const NetworkTableEmpty = () => {
|
|
15435
|
-
return /* @__PURE__ */ jsx(
|
|
15436
|
-
EmptyState,
|
|
15437
|
-
{
|
|
15438
|
-
iconSlot: /* @__PURE__ */ jsx(AgentNetworkCoinIcon, {}),
|
|
15439
|
-
titleSlot: "Configure Agent Networks",
|
|
15440
|
-
descriptionSlot: "Mastra agent networks are not configured yet. You can find more information in the documentation.",
|
|
15441
|
-
actionSlot: /* @__PURE__ */ jsxs(
|
|
15442
|
-
Button$1,
|
|
15443
|
-
{
|
|
15444
|
-
size: "lg",
|
|
15445
|
-
className: "w-full",
|
|
15446
|
-
variant: "light",
|
|
15447
|
-
as: "a",
|
|
15448
|
-
href: "https://mastra.ai/en/reference/networks/agent-network",
|
|
15449
|
-
target: "_blank",
|
|
15450
|
-
children: [
|
|
15451
|
-
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(NetworkIcon, {}) }),
|
|
15452
|
-
"Docs"
|
|
15453
|
-
]
|
|
15454
|
-
}
|
|
15455
|
-
)
|
|
15456
|
-
}
|
|
15457
|
-
);
|
|
15458
|
-
};
|
|
15459
|
-
const NetworkTableSkeleton = () => {
|
|
15460
|
-
return /* @__PURE__ */ jsxs(Table$1, { children: [
|
|
15461
|
-
/* @__PURE__ */ jsxs(Thead, { children: [
|
|
15462
|
-
/* @__PURE__ */ jsx(Th, { children: "Name" }),
|
|
15463
|
-
/* @__PURE__ */ jsx(Th, { width: 160, children: "Agents" }),
|
|
15464
|
-
/* @__PURE__ */ jsx(Th, { width: 160, children: "Workflows" }),
|
|
15465
|
-
/* @__PURE__ */ jsx(Th, { width: 160, children: "Tools" }),
|
|
15466
|
-
/* @__PURE__ */ jsx(Th, { width: 160, children: "Routing Models" })
|
|
15467
|
-
] }),
|
|
15468
|
-
/* @__PURE__ */ jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs(Row, { children: [
|
|
15469
|
-
/* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15470
|
-
/* @__PURE__ */ jsx(Cell, { width: 160, children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15471
|
-
/* @__PURE__ */ jsx(Cell, { width: 160, children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15472
|
-
/* @__PURE__ */ jsx(Cell, { width: 160, children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15473
|
-
/* @__PURE__ */ jsx(Cell, { width: 160, children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) })
|
|
15474
|
-
] }, index)) })
|
|
15475
|
-
] });
|
|
15476
|
-
};
|
|
15477
|
-
|
|
15478
14429
|
const themeClasses = {
|
|
15479
14430
|
light: "bg-gray-100 border-gray-300 text-gray-700",
|
|
15480
14431
|
dark: "bg-surface4 border-border1 text-icon6"
|
|
@@ -18799,5 +17750,5 @@ const parseError = (error) => {
|
|
|
18799
17750
|
}
|
|
18800
17751
|
};
|
|
18801
17752
|
|
|
18802
|
-
export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AgentsTableSkeleton, AiIcon, AlertDialog, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyAgentsTable, EmptyScorersTable, EmptyState, EmptyWorkflowsTable, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LinkComponentProvider, LogsIcon, MainContentContent, MainContentLayout, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, ModelResetProvider,
|
|
17753
|
+
export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AgentsTableSkeleton, AiIcon, Alert, AlertDescription, AlertDialog, AlertTitle, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyAgentsTable, EmptyScorersTable, EmptyState, EmptyWorkflowsTable, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LinkComponentProvider, LogsIcon, MainContentContent, MainContentLayout, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, ModelResetProvider, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreDialog, ScoreIcon, ScorersTable, ScorersTableSkeleton, ScoresTools, SearchField, Searchbar, SelectField, SettingsIcon, SideDialog, SideDialogCodeSection, SideDialogContent, SideDialogFooter, SideDialogFooterGroup, SideDialogHeader, SideDialogHeading, SideDialogKeyValueList, SideDialogSection, SideDialogTop, SlashIcon, SliderField, Tab, TabContent, TabList, Table$1 as Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, TextareaField, Th, Thead, ThreadDeleteButton, ThreadInputProvider, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolFallback, ToolList, ToolListEmpty, ToolListSkeleton, ToolsIcon, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowRuns, WorkflowTable, WorkflowTableSkeleton, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToWatchResult, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, mapWorkflowStreamChunkToWatchResult, parseError, providerMapToIcon, spanTypePrefixes, transformKey, useAgentSettings, useCurrentRun, useInView, useLinkComponent, useModelReset, usePlaygroundStore, usePolling, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSpeechRecognition, useThreadInput, useWorkflow, useWorkflowRuns, useWorkingMemory };
|
|
18803
17754
|
//# sourceMappingURL=index.es.js.map
|