@mastra/playground-ui 7.0.0-beta.8 → 7.0.0-beta.9
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 +20 -0
- package/dist/index.cjs.js +836 -422
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +837 -424
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/ui/elements/buttons/button.d.ts +1 -0
- package/dist/src/components/ui/elements/buttons/combined-buttons.d.ts +6 -0
- package/dist/src/components/ui/elements/buttons/index.d.ts +1 -0
- package/dist/src/components/ui/elements/form-fields/search-field.d.ts +4 -1
- package/dist/src/components/ui/elements/side-dialog/side-dialog-top.d.ts +1 -2
- package/dist/src/domains/configuration/components/playground-config-guard.d.ts +1 -0
- package/dist/src/domains/configuration/context/studio-config-context.d.ts +2 -1
- package/dist/src/domains/configuration/hooks/use-mastra-instance-status.d.ts +4 -0
- package/dist/src/domains/configuration/index.d.ts +1 -0
- package/dist/src/domains/observability/components/helpers.d.ts +1 -3
- package/dist/src/domains/observability/components/index.d.ts +1 -1
- package/dist/src/domains/observability/components/shared.d.ts +2 -5
- package/dist/src/domains/observability/components/span-dialog.d.ts +4 -2
- package/dist/src/domains/observability/components/span-scoring.d.ts +4 -1
- package/dist/src/domains/observability/components/span-tabs.d.ts +4 -2
- package/dist/src/domains/observability/components/span-type-icon.d.ts +6 -0
- package/dist/src/domains/observability/components/timeline-expand-col.d.ts +13 -0
- package/dist/src/domains/observability/components/timeline-name-col.d.ts +16 -0
- package/dist/src/domains/observability/components/timeline-structure-sign.d.ts +7 -0
- package/dist/src/domains/observability/components/timeline-timing-col.d.ts +12 -0
- package/dist/src/domains/observability/components/trace-dialog.d.ts +4 -1
- package/dist/src/domains/observability/components/trace-timeline-span.d.ts +6 -1
- package/dist/src/domains/observability/components/trace-timeline-tools.d.ts +12 -0
- package/dist/src/domains/observability/components/trace-timeline.d.ts +5 -1
- package/dist/src/domains/observability/types.d.ts +13 -0
- package/dist/src/domains/observability/utils/get-descendant-ids.d.ts +2 -0
- package/package.json +8 -8
- package/dist/src/domains/observability/components/trace-timeline-legend.d.ts +0 -6
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, useComposerRuntime, useAttachment, ComposerPrimitive, AttachmentPrimitive, useComposer, ThreadPrimitive, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechSynthesisAdapter, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
3
|
-
import { CheckIcon as CheckIcon$1, CopyIcon, InfoIcon as InfoIcon$1, AlertCircle, TriangleAlert, ChevronUpIcon, X, Share2, Check, PlayCircle, Workflow, Layers, List, Clock as Clock$1, CalendarClock, Timer, CornerDownRight, GitBranch, RefreshCw, Repeat, Repeat1, Network, CalendarIcon, ChevronDown, Braces, ChevronDownIcon, Brackets, PlusIcon, TrashIcon, Plus, Loader2, Circle, EyeOffIcon, EyeIcon, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Maximize, AlertCircleIcon, CirclePause, StopCircle, SearchIcon, ChevronsUpDown, Search, BrainIcon, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, SaveIcon, ExternalLink, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, ChevronsRightIcon, AlignLeftIcon, AlignJustifyIcon, ArrowUpIcon, ArrowDownIcon, CircleAlertIcon,
|
|
3
|
+
import { CheckIcon as CheckIcon$1, CopyIcon, InfoIcon as InfoIcon$1, AlertCircle, TriangleAlert, ChevronUpIcon, X, Share2, Check, PlayCircle, Workflow, Layers, List, Clock as Clock$1, CalendarClock, Timer, CornerDownRight, GitBranch, RefreshCw, Repeat, Repeat1, Network, CalendarIcon, ChevronDown, Braces, ChevronDownIcon, Brackets, PlusIcon, TrashIcon, Plus, Loader2, Circle, EyeOffIcon, EyeIcon, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Maximize, AlertCircleIcon, CirclePause, StopCircle, SearchIcon, ChevronsUpDown, Search, BrainIcon, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, SaveIcon, ExternalLink, XIcon, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, ChevronsRightIcon, AlignLeftIcon, AlignJustifyIcon, ArrowUpIcon, ArrowDownIcon, CircleAlertIcon, PanelRightIcon, KeyboardIcon, GaugeIcon, ChevronsLeftRightEllipsisIcon, CalculatorIcon, HashIcon, FileInputIcon, FileOutputIcon, ReceiptText, Info, RotateCcw, GripVertical, RefreshCcwIcon, AlertTriangleIcon, ChevronRight, NetworkIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, FrownIcon, CircleChevronUpIcon, CircleChevronDownIcon, FileIcon, ChevronsUpIcon, ChevronsDownIcon, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, CircleDashedIcon, ArrowRightToLineIcon, CoinsIcon, BracesIcon, CircleGaugeIcon, PanelTopIcon, ListTreeIcon, PanelLeftIcon, CircleSlash, Trash, Link2 } 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, useId, Suspense, useLayoutEffect } from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -34,7 +34,7 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
|
34
34
|
import { EditorView } from '@codemirror/view';
|
|
35
35
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
36
36
|
import { format, isValid, formatDate, isToday } from 'date-fns';
|
|
37
|
-
import { useDebouncedCallback } from 'use-debounce';
|
|
37
|
+
import { useDebouncedCallback, useThrottledCallback } from 'use-debounce';
|
|
38
38
|
import { DayPicker } from 'react-day-picker';
|
|
39
39
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
40
40
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -6270,13 +6270,6 @@ const StringField = ({ inputProps, error, field, id }) => {
|
|
|
6270
6270
|
|
|
6271
6271
|
const NumberField = ({ inputProps, error, field, id }) => {
|
|
6272
6272
|
const { key, ...props } = inputProps;
|
|
6273
|
-
useEffect(() => {
|
|
6274
|
-
if (field.default !== void 0) {
|
|
6275
|
-
props.onChange({
|
|
6276
|
-
target: { value: Number(field.default), name: inputProps.name }
|
|
6277
|
-
});
|
|
6278
|
-
}
|
|
6279
|
-
}, [field.default]);
|
|
6280
6273
|
return /* @__PURE__ */ jsx(
|
|
6281
6274
|
Input,
|
|
6282
6275
|
{
|
|
@@ -8550,7 +8543,7 @@ const WorkflowCard = ({ header, children, footer }) => {
|
|
|
8550
8543
|
/* @__PURE__ */ jsx("div", { className: "w-full", children: header }),
|
|
8551
8544
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("text-icon3 transition-transform -rotate-90", expanded && "rotate-0") }) })
|
|
8552
8545
|
] }),
|
|
8553
|
-
children && expanded && /* @__PURE__ */ jsx("div", { className: "border-t-sm border-border1", children }),
|
|
8546
|
+
children && expanded && /* @__PURE__ */ jsx("div", { className: "border-t-sm border-border1 max-h-[400px] overflow-y-auto", children }),
|
|
8554
8547
|
footer && /* @__PURE__ */ jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
|
|
8555
8548
|
] });
|
|
8556
8549
|
};
|
|
@@ -8669,7 +8662,7 @@ function WorkflowTrigger({
|
|
|
8669
8662
|
const workflowActivePaths = streamResultToUse?.steps ?? {};
|
|
8670
8663
|
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
8671
8664
|
const doneStatuses = ["success", "failed", "canceled"];
|
|
8672
|
-
return /* @__PURE__ */ jsxs("div", { className: "h-full pt-3 pb-12", children: [
|
|
8665
|
+
return /* @__PURE__ */ jsxs("div", { className: "h-full pt-3 pb-12 overflow-y-auto", children: [
|
|
8673
8666
|
/* @__PURE__ */ jsxs("div", { className: "space-y-4 px-5 pb-5 border-b-sm border-border1", children: [
|
|
8674
8667
|
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: [
|
|
8675
8668
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
|
|
@@ -12761,19 +12754,31 @@ const AgentMetadataWrapper = ({ children }) => {
|
|
|
12761
12754
|
return /* @__PURE__ */ jsx("div", { className: "py-2 overflow-y-auto h-full px-5", children });
|
|
12762
12755
|
};
|
|
12763
12756
|
|
|
12764
|
-
function SearchField(props) {
|
|
12765
|
-
return /* @__PURE__ */
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12757
|
+
function SearchField({ onReset, ...props }) {
|
|
12758
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
12759
|
+
/* @__PURE__ */ jsx(
|
|
12760
|
+
InputField,
|
|
12761
|
+
{
|
|
12762
|
+
labelIsHidden: true,
|
|
12763
|
+
...props,
|
|
12764
|
+
className: "[&>input]:pl-[2.5rem]",
|
|
12765
|
+
style: {
|
|
12766
|
+
background: `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='gray' viewBox='0 0 24 24'><path d='M21 20l-5.6-5.6a7 7 0 1 0-1.4 1.4L20 21zM4 10a6 6 0 1 1 12 0 6 6 0 0 1-12 0z'/></svg>") no-repeat 8px center`,
|
|
12767
|
+
backgroundSize: "1.5rem 1.5rem",
|
|
12768
|
+
paddingRight: onReset ? "3rem" : void 0
|
|
12769
|
+
}
|
|
12774
12770
|
}
|
|
12775
|
-
|
|
12776
|
-
|
|
12771
|
+
),
|
|
12772
|
+
onReset && props.value && /* @__PURE__ */ jsx(
|
|
12773
|
+
"button",
|
|
12774
|
+
{
|
|
12775
|
+
type: "button",
|
|
12776
|
+
onClick: onReset,
|
|
12777
|
+
className: cn("absolute top-1/2 right-2 -translate-y-1/2 p-1", "[&:hover>svg]:text-icon5"),
|
|
12778
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "text-icon3 w-[1rem] h-[1rem]" })
|
|
12779
|
+
}
|
|
12780
|
+
)
|
|
12781
|
+
] });
|
|
12777
12782
|
}
|
|
12778
12783
|
|
|
12779
12784
|
function InputField({
|
|
@@ -13263,7 +13268,7 @@ function SideDialogRoot({
|
|
|
13263
13268
|
}
|
|
13264
13269
|
|
|
13265
13270
|
const Button = React__default.forwardRef(
|
|
13266
|
-
({ className, variant = "outline", ...props }, ref) => {
|
|
13271
|
+
({ className, variant = "outline", isFaded, ...props }, ref) => {
|
|
13267
13272
|
return /* @__PURE__ */ jsx(
|
|
13268
13273
|
"button",
|
|
13269
13274
|
{
|
|
@@ -13279,7 +13284,8 @@ const Button = React__default.forwardRef(
|
|
|
13279
13284
|
"bg-ui-primaryBtnBg text-ui-primaryBtnText hover:bg-surface6 leading-[0] font-semibold": variant === "primary",
|
|
13280
13285
|
"min-h-[2rem]": variant === "ghost",
|
|
13281
13286
|
"min-h-[2.5rem]": variant !== "ghost",
|
|
13282
|
-
"border-[rgba(255,255,255,0.15)]": variant === "outline"
|
|
13287
|
+
"border-[rgba(255,255,255,0.15)]": variant === "outline",
|
|
13288
|
+
"opacity-40": isFaded
|
|
13283
13289
|
}
|
|
13284
13290
|
),
|
|
13285
13291
|
...props
|
|
@@ -13289,6 +13295,21 @@ const Button = React__default.forwardRef(
|
|
|
13289
13295
|
);
|
|
13290
13296
|
Button.displayName = "Button";
|
|
13291
13297
|
|
|
13298
|
+
const CombinedButtons = ({ className, children }) => {
|
|
13299
|
+
return /* @__PURE__ */ jsx(
|
|
13300
|
+
"div",
|
|
13301
|
+
{
|
|
13302
|
+
className: cn(
|
|
13303
|
+
"flex items-center text-[0.75rem] border border-border1 rounded-lg overflow-hidden",
|
|
13304
|
+
"[&>button]:border-0 [&>button:not(:first-child)]:border-l [&>button:not(:first-child)]:border-border1",
|
|
13305
|
+
"[&>button]:rounded-none [&>button:first-child]:rounded-l-lg [&>button:last-child]:rounded-r-lg",
|
|
13306
|
+
className
|
|
13307
|
+
),
|
|
13308
|
+
children
|
|
13309
|
+
}
|
|
13310
|
+
);
|
|
13311
|
+
};
|
|
13312
|
+
|
|
13292
13313
|
function MainContentLayout({
|
|
13293
13314
|
children,
|
|
13294
13315
|
className,
|
|
@@ -13462,16 +13483,13 @@ function SideDialogHeader({ children, className }) {
|
|
|
13462
13483
|
return /* @__PURE__ */ jsx("div", { className: cn("flex justify-between items-center pb-[1rem]", className), children });
|
|
13463
13484
|
}
|
|
13464
13485
|
|
|
13465
|
-
function SideDialogTop({ children,
|
|
13486
|
+
function SideDialogTop({ children, className }) {
|
|
13466
13487
|
return /* @__PURE__ */ jsx(
|
|
13467
13488
|
"div",
|
|
13468
13489
|
{
|
|
13469
13490
|
className: cn(
|
|
13470
13491
|
`flex h-[3.5rem] items-center text-icon5 text-[.875rem] pl-[1.5rem] relative gap-[1rem]`,
|
|
13471
13492
|
'[&:after]:content-[""] [&:after]:absolute [&:after]:left-[1.5rem] [&:after]:right-[1.5rem] [&:after]:bottom-0 [&:after]:border-b [&:after]:border-border1',
|
|
13472
|
-
{
|
|
13473
|
-
'[&:before]:content-[""] [&:before]:absolute [&:before]:left-[1.5rem] [&:before]:right-[1.5rem] [&:before]:top-0 [&:before]:border-t [&:before]:border-border1': withTopSeparator
|
|
13474
|
-
},
|
|
13475
13493
|
className
|
|
13476
13494
|
),
|
|
13477
13495
|
children
|
|
@@ -17695,7 +17713,8 @@ const formatHierarchicalSpans = (spans) => {
|
|
|
17695
17713
|
latency: endDate ? endDate.getTime() - startDate.getTime() : 0,
|
|
17696
17714
|
startTime: startDate.toISOString(),
|
|
17697
17715
|
endTime: endDate ? endDate.toISOString() : void 0,
|
|
17698
|
-
spans: []
|
|
17716
|
+
spans: [],
|
|
17717
|
+
parentSpanId: spanRecord.parentSpanId
|
|
17699
17718
|
};
|
|
17700
17719
|
spanMap.set(spanRecord.spanId, uiSpan);
|
|
17701
17720
|
});
|
|
@@ -17734,198 +17753,410 @@ const formatHierarchicalSpans = (spans) => {
|
|
|
17734
17753
|
return sortedRootSpans;
|
|
17735
17754
|
};
|
|
17736
17755
|
|
|
17737
|
-
const spanTypePrefixes = ["agent", "workflow", "
|
|
17756
|
+
const spanTypePrefixes = ["agent", "workflow", "model", "tool", "other"];
|
|
17738
17757
|
function getSpanTypeUi(type) {
|
|
17739
17758
|
const typePrefix = type?.toLowerCase().split("_")[0];
|
|
17740
17759
|
const spanTypeToUiElements = {
|
|
17741
17760
|
agent: {
|
|
17742
17761
|
icon: /* @__PURE__ */ jsx(AgentIcon, {}),
|
|
17743
17762
|
color: "oklch(0.75 0.15 250)",
|
|
17744
|
-
label: "Agent"
|
|
17763
|
+
label: "Agent",
|
|
17764
|
+
bgColor: "bg-oklch(0.75 0.15 250 / 0.1)",
|
|
17765
|
+
typePrefix: "agent"
|
|
17745
17766
|
},
|
|
17746
17767
|
workflow: {
|
|
17747
17768
|
icon: /* @__PURE__ */ jsx(WorkflowIcon, {}),
|
|
17748
17769
|
color: "oklch(0.75 0.15 200)",
|
|
17749
|
-
label: "Workflow"
|
|
17770
|
+
label: "Workflow",
|
|
17771
|
+
bgColor: "bg-oklch(0.75 0.15 200 / 0.1)",
|
|
17772
|
+
typePrefix: "workflow"
|
|
17750
17773
|
},
|
|
17751
|
-
|
|
17774
|
+
model: {
|
|
17752
17775
|
icon: /* @__PURE__ */ jsx(BrainIcon, {}),
|
|
17753
17776
|
color: "oklch(0.75 0.15 320)",
|
|
17754
|
-
label: "
|
|
17777
|
+
label: "Model",
|
|
17778
|
+
bgColor: "bg-oklch(0.75 0.15 320 / 0.1)",
|
|
17779
|
+
typePrefix: "model"
|
|
17755
17780
|
},
|
|
17756
17781
|
tool: {
|
|
17757
17782
|
icon: /* @__PURE__ */ jsx(ToolsIcon, {}),
|
|
17758
17783
|
color: "oklch(0.75 0.15 100)",
|
|
17759
|
-
label: "Tool"
|
|
17784
|
+
label: "Tool",
|
|
17785
|
+
bgColor: "bg-oklch(0.75 0.15 100 / 0.1)",
|
|
17786
|
+
typePrefix: "tool"
|
|
17760
17787
|
}
|
|
17761
17788
|
};
|
|
17762
17789
|
if (typePrefix in spanTypeToUiElements) {
|
|
17763
17790
|
return spanTypeToUiElements[typePrefix];
|
|
17791
|
+
} else {
|
|
17792
|
+
return {
|
|
17793
|
+
typePrefix: "other"
|
|
17794
|
+
};
|
|
17764
17795
|
}
|
|
17765
|
-
return null;
|
|
17766
17796
|
}
|
|
17767
17797
|
|
|
17768
|
-
function
|
|
17798
|
+
function getSpanDescendantIds(span) {
|
|
17799
|
+
if (!span.spans || span.spans.length === 0) {
|
|
17800
|
+
return [];
|
|
17801
|
+
}
|
|
17802
|
+
const descendantIds = [];
|
|
17803
|
+
span.spans.forEach((childSpan) => {
|
|
17804
|
+
descendantIds.push(childSpan.id);
|
|
17805
|
+
descendantIds.push(...getSpanDescendantIds(childSpan));
|
|
17806
|
+
});
|
|
17807
|
+
return descendantIds;
|
|
17808
|
+
}
|
|
17809
|
+
|
|
17810
|
+
function TimelineStructureSign({
|
|
17811
|
+
isLastChild,
|
|
17812
|
+
hasChildren = false,
|
|
17813
|
+
expanded = false
|
|
17814
|
+
}) {
|
|
17815
|
+
return /* @__PURE__ */ jsx(
|
|
17816
|
+
"div",
|
|
17817
|
+
{
|
|
17818
|
+
className: cn(
|
|
17819
|
+
"w-[3rem] h-[2.8rem] relative opacity-100",
|
|
17820
|
+
'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-[0px] after:border-l-[1px] after:border-icon3 after:border-dashed ',
|
|
17821
|
+
'before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-[0px] before:border-b-[1px] before:border-icon3 before:border-dashed',
|
|
17822
|
+
"[&_svg]:transition-all",
|
|
17823
|
+
"[&:hover_svg]:text-yellow-500 [&:hover_svg]:scale-[1.3] [&:hover_svg]:opacity-100",
|
|
17824
|
+
{
|
|
17825
|
+
"after:bottom-[50%]": isLastChild
|
|
17826
|
+
}
|
|
17827
|
+
),
|
|
17828
|
+
children: hasChildren && /* @__PURE__ */ jsx(
|
|
17829
|
+
"span",
|
|
17830
|
+
{
|
|
17831
|
+
className: cn(
|
|
17832
|
+
"flex absolute left-[50%] top-[50%] translate-y-[-50%] translate-x-[-50%] items-center justify-center bg-surface2 p-[0.25rem]",
|
|
17833
|
+
"[&>svg]:shrink-0 [&>svg]:opacity-60 [&>svg]:w-[0.8rem] [&>svg]:h-[0.8rem]"
|
|
17834
|
+
),
|
|
17835
|
+
children: expanded ? /* @__PURE__ */ jsx(CircleChevronUpIcon, {}) : /* @__PURE__ */ jsx(CircleChevronDownIcon, {})
|
|
17836
|
+
}
|
|
17837
|
+
)
|
|
17838
|
+
}
|
|
17839
|
+
);
|
|
17840
|
+
}
|
|
17841
|
+
|
|
17842
|
+
function SpanTypeIcon({ icon, color }) {
|
|
17843
|
+
return /* @__PURE__ */ jsx(
|
|
17844
|
+
"span",
|
|
17845
|
+
{
|
|
17846
|
+
className: cn(
|
|
17847
|
+
"flex w-[1.1rem] h-[1.1rem] shrink-0 rounded-md items-center justify-center",
|
|
17848
|
+
"[&>svg]:w-[.9rem] [&>svg]:h-[.9rem] [&>svg]:text-surface2"
|
|
17849
|
+
),
|
|
17850
|
+
style: { backgroundColor: color },
|
|
17851
|
+
children: icon
|
|
17852
|
+
}
|
|
17853
|
+
);
|
|
17854
|
+
}
|
|
17855
|
+
|
|
17856
|
+
function TimelineNameCol({
|
|
17769
17857
|
span,
|
|
17858
|
+
spanUI,
|
|
17859
|
+
isFaded,
|
|
17770
17860
|
depth = 0,
|
|
17771
17861
|
onSpanClick,
|
|
17772
17862
|
selectedSpanId,
|
|
17773
17863
|
isLastChild,
|
|
17864
|
+
hasChildren,
|
|
17865
|
+
isRootSpan,
|
|
17866
|
+
isExpanded,
|
|
17867
|
+
toggleChildren
|
|
17868
|
+
}) {
|
|
17869
|
+
return /* @__PURE__ */ jsxs(
|
|
17870
|
+
"div",
|
|
17871
|
+
{
|
|
17872
|
+
"aria-label": `View details for span ${span.name}`,
|
|
17873
|
+
className: cn(
|
|
17874
|
+
"rounded-md transition-colors flex opacity-80 min-h-[3rem] items-center rounded-l-lg",
|
|
17875
|
+
"mt-[1rem] xl:mt-0",
|
|
17876
|
+
{
|
|
17877
|
+
"opacity-30 [&:hover]:opacity-60": isFaded,
|
|
17878
|
+
"bg-surface4": selectedSpanId === span.id
|
|
17879
|
+
}
|
|
17880
|
+
),
|
|
17881
|
+
style: { paddingLeft: `${depth * 1.5}rem` },
|
|
17882
|
+
children: [
|
|
17883
|
+
!isRootSpan && /* @__PURE__ */ jsx(
|
|
17884
|
+
"button",
|
|
17885
|
+
{
|
|
17886
|
+
onClick: () => toggleChildren?.(),
|
|
17887
|
+
disabled: !hasChildren,
|
|
17888
|
+
className: cn({
|
|
17889
|
+
"cursor-default": !hasChildren,
|
|
17890
|
+
"cursor-pointer": hasChildren
|
|
17891
|
+
}),
|
|
17892
|
+
children: /* @__PURE__ */ jsx(TimelineStructureSign, { isLastChild, hasChildren: Boolean(hasChildren), expanded: isExpanded })
|
|
17893
|
+
}
|
|
17894
|
+
),
|
|
17895
|
+
/* @__PURE__ */ jsxs(
|
|
17896
|
+
"button",
|
|
17897
|
+
{
|
|
17898
|
+
onClick: () => onSpanClick?.(span.id),
|
|
17899
|
+
className: cn(
|
|
17900
|
+
"text-[0.875rem] flex items-center text-left break-all gap-[0.5rem] text-white w-full rounded-lg h-full px-3 py-2 transition-colors",
|
|
17901
|
+
"[&>svg]:transition-all [&>svg]:shrink-0 [&>svg]:opacity-0 [&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:ml-auto",
|
|
17902
|
+
"hover:bg-surface4 [&:hover>svg]:opacity-60"
|
|
17903
|
+
),
|
|
17904
|
+
children: [
|
|
17905
|
+
spanUI?.icon && /* @__PURE__ */ jsx(SpanTypeIcon, { icon: spanUI.icon, color: spanUI.color ? spanUI.color : void 0 }),
|
|
17906
|
+
/* @__PURE__ */ jsx("span", { className: cn("p-0 px-1 rounded-md"), children: span.name }),
|
|
17907
|
+
/* @__PURE__ */ jsx(FileIcon, {})
|
|
17908
|
+
]
|
|
17909
|
+
}
|
|
17910
|
+
)
|
|
17911
|
+
]
|
|
17912
|
+
}
|
|
17913
|
+
);
|
|
17914
|
+
}
|
|
17915
|
+
|
|
17916
|
+
function TimelineExpandCol({
|
|
17917
|
+
isSelected,
|
|
17918
|
+
isFaded,
|
|
17919
|
+
isExpanded,
|
|
17920
|
+
toggleChildren,
|
|
17921
|
+
expandAllDescendants,
|
|
17922
|
+
totalDescendants = 0,
|
|
17923
|
+
allDescendantsExpanded,
|
|
17924
|
+
numOfChildren
|
|
17925
|
+
}) {
|
|
17926
|
+
return /* @__PURE__ */ jsx(
|
|
17927
|
+
"div",
|
|
17928
|
+
{
|
|
17929
|
+
className: cn("flex items-center justify-end h-full px-3", {
|
|
17930
|
+
"opacity-30 [&:hover]:opacity-60": isFaded,
|
|
17931
|
+
"bg-surface4": isSelected
|
|
17932
|
+
}),
|
|
17933
|
+
children: numOfChildren && numOfChildren > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
17934
|
+
/* @__PURE__ */ jsxs(ExpandButton, { onClick: () => toggleChildren?.(), children: [
|
|
17935
|
+
allDescendantsExpanded ? totalDescendants : numOfChildren,
|
|
17936
|
+
" ",
|
|
17937
|
+
isExpanded ? allDescendantsExpanded ? /* @__PURE__ */ jsx(ChevronsUpIcon, {}) : /* @__PURE__ */ jsx(ChevronUpIcon, {}) : /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
17938
|
+
] }),
|
|
17939
|
+
totalDescendants > numOfChildren && !allDescendantsExpanded && /* @__PURE__ */ jsxs(ExpandButton, { onClick: () => expandAllDescendants?.(), children: [
|
|
17940
|
+
totalDescendants,
|
|
17941
|
+
" ",
|
|
17942
|
+
/* @__PURE__ */ jsx(ChevronsDownIcon, {})
|
|
17943
|
+
] })
|
|
17944
|
+
] }) : null
|
|
17945
|
+
}
|
|
17946
|
+
);
|
|
17947
|
+
}
|
|
17948
|
+
function ExpandButton({ onClick, children, className }) {
|
|
17949
|
+
return /* @__PURE__ */ jsx("button", { onClick, className: cn("h-full", className), children: /* @__PURE__ */ jsx(
|
|
17950
|
+
"div",
|
|
17951
|
+
{
|
|
17952
|
+
className: cn(
|
|
17953
|
+
"flex items-center gap-[0.1rem] text-[0.75rem] text-icon5 border border-border1 pl-2 pr-1 rounded-lg transition-all",
|
|
17954
|
+
"hover:text-yellow-500",
|
|
17955
|
+
"[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-[1rem] [&>svg]:h-[1rem] [&>svg]:transition-all"
|
|
17956
|
+
),
|
|
17957
|
+
children
|
|
17958
|
+
}
|
|
17959
|
+
) });
|
|
17960
|
+
}
|
|
17961
|
+
|
|
17962
|
+
function TimelineTimingCol({
|
|
17963
|
+
span,
|
|
17964
|
+
selectedSpanId,
|
|
17965
|
+
isFaded,
|
|
17774
17966
|
overallLatency,
|
|
17775
17967
|
overallStartTime,
|
|
17776
|
-
|
|
17968
|
+
color
|
|
17777
17969
|
}) {
|
|
17778
17970
|
const { Link } = useLinkComponent();
|
|
17779
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
17780
|
-
const hasChildren = span.spans && span.spans.length > 0;
|
|
17781
|
-
const isRootSpan = depth === 0;
|
|
17782
17971
|
const percentageSpanLatency = overallLatency ? Math.ceil(span.latency / overallLatency * 100) : 0;
|
|
17783
17972
|
const overallStartTimeDate = overallStartTime ? new Date(overallStartTime) : null;
|
|
17784
17973
|
const spanStartTimeDate = span.startTime ? new Date(span.startTime) : null;
|
|
17785
17974
|
const spanStartTimeShift = spanStartTimeDate && overallStartTimeDate ? spanStartTimeDate.getTime() - overallStartTimeDate.getTime() : 0;
|
|
17786
17975
|
const percentageSpanStartTime = overallLatency && Math.floor(spanStartTimeShift / overallLatency * 100);
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
|
|
17790
|
-
"button",
|
|
17976
|
+
return /* @__PURE__ */ jsxs(HoverCard.Root, { openDelay: 250, children: [
|
|
17977
|
+
/* @__PURE__ */ jsxs(
|
|
17978
|
+
HoverCard.Trigger,
|
|
17791
17979
|
{
|
|
17792
|
-
onClick: () => onSpanClick?.(span.id),
|
|
17793
|
-
onMouseEnter: () => setIsHovered(true),
|
|
17794
|
-
onMouseLeave: () => setIsHovered(false),
|
|
17795
|
-
type: "button",
|
|
17796
|
-
"aria-label": `View details for span ${span.name}`,
|
|
17797
17980
|
className: cn(
|
|
17798
|
-
"
|
|
17799
|
-
"
|
|
17981
|
+
"h-[3rem] p-[0.5rem] grid grid-cols-[1fr_auto] gap-4 items-center cursor-help pr-3 rounded-r-lg col-span-2 xl:col-span-1",
|
|
17982
|
+
"[&:hover>div]:bg-surface5",
|
|
17800
17983
|
{
|
|
17801
|
-
"
|
|
17802
|
-
"bg-
|
|
17984
|
+
"opacity-30 [&:hover]:opacity-60": isFaded,
|
|
17985
|
+
"bg-surface4": selectedSpanId === span.id
|
|
17803
17986
|
}
|
|
17804
17987
|
),
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17988
|
+
children: [
|
|
17989
|
+
/* @__PURE__ */ jsx("div", { className: cn("w-full p-[0.6rem] rounded-lg bg-surface4 transition-colors duration-[1s]"), children: /* @__PURE__ */ jsx("div", { className: "relative w-full h-[0.4rem] rounded-sm", children: /* @__PURE__ */ jsx(
|
|
17990
|
+
"div",
|
|
17991
|
+
{
|
|
17992
|
+
className: cn("bg-icon1 absolute rounded-sm h-[0.4rem] top-0"),
|
|
17993
|
+
style: {
|
|
17994
|
+
width: percentageSpanLatency ? `${percentageSpanLatency}%` : "2px",
|
|
17995
|
+
left: `${percentageSpanStartTime || 0}%`,
|
|
17996
|
+
backgroundColor: color
|
|
17997
|
+
}
|
|
17998
|
+
}
|
|
17999
|
+
) }) }),
|
|
18000
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex justify-end text-icon3 text-[0.75rem]"), children: [
|
|
18001
|
+
(span.latency / 1e3).toFixed(3),
|
|
18002
|
+
" s"
|
|
17811
18003
|
] })
|
|
17812
|
-
]
|
|
18004
|
+
]
|
|
17813
18005
|
}
|
|
17814
18006
|
),
|
|
17815
|
-
/* @__PURE__ */
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
18007
|
+
/* @__PURE__ */ jsx(HoverCard.Portal, { children: /* @__PURE__ */ jsxs(
|
|
18008
|
+
HoverCard.Content,
|
|
18009
|
+
{
|
|
18010
|
+
className: "z-[100] w-auto max-w-[25rem] rounded-md bg-[#222] p-[.5rem] px-[1rem] pr-[1.5rem] text-[.75rem] text-icon5 text-center border border-border1",
|
|
18011
|
+
sideOffset: 5,
|
|
18012
|
+
side: "top",
|
|
18013
|
+
children: [
|
|
18014
|
+
/* @__PURE__ */ jsxs(
|
|
18015
|
+
"div",
|
|
17824
18016
|
{
|
|
17825
|
-
|
|
18017
|
+
className: cn(
|
|
18018
|
+
"text-[0.875rem] flex items-center gap-[0.5rem] mb-[1rem]",
|
|
18019
|
+
"[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:shrink-0 [&>svg]:opacity-50"
|
|
18020
|
+
),
|
|
18021
|
+
children: [
|
|
18022
|
+
/* @__PURE__ */ jsx(TimerIcon, {}),
|
|
18023
|
+
" Span Timing"
|
|
18024
|
+
]
|
|
17826
18025
|
}
|
|
17827
18026
|
),
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
|
|
17845
|
-
|
|
17846
|
-
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
/* @__PURE__ */ jsx("div", { className: "relative w-full bg-surface5 h-[3px] ", children: /* @__PURE__ */ jsx(
|
|
17857
|
-
"div",
|
|
17858
|
-
{
|
|
17859
|
-
className: cn("bg-icon1 h-full absolute rounded-full"),
|
|
17860
|
-
style: {
|
|
17861
|
-
width: percentageSpanLatency ? `${percentageSpanLatency}%` : "2px",
|
|
17862
|
-
left: `${percentageSpanStartTime}%`,
|
|
17863
|
-
backgroundColor: spanUI?.color
|
|
18027
|
+
/* @__PURE__ */ jsx(
|
|
18028
|
+
KeyValueList,
|
|
18029
|
+
{
|
|
18030
|
+
className: " [&>dd]:text-[0.875rem] [&>dt]:text-[0.875rem] [&>dt]:min-h-0 [&>dd]:min-h-0",
|
|
18031
|
+
data: [
|
|
18032
|
+
{
|
|
18033
|
+
key: "Latency",
|
|
18034
|
+
label: "Latency",
|
|
18035
|
+
value: `${span.latency} ms`,
|
|
18036
|
+
icon: /* @__PURE__ */ jsx(ChevronsLeftRightIcon, {})
|
|
18037
|
+
},
|
|
18038
|
+
{
|
|
18039
|
+
key: "startTime",
|
|
18040
|
+
label: "Started at",
|
|
18041
|
+
value: span.startTime ? format$1(new Date(span.startTime), "hh:mm:ss:SSS a") : "-",
|
|
18042
|
+
icon: /* @__PURE__ */ jsx(ChevronFirstIcon, {})
|
|
18043
|
+
},
|
|
18044
|
+
{
|
|
18045
|
+
key: "endTime",
|
|
18046
|
+
label: "Ended at",
|
|
18047
|
+
value: span.endTime ? format$1(new Date(span.endTime), "hh:mm:ss:SSS a") : "-",
|
|
18048
|
+
icon: /* @__PURE__ */ jsx(ChevronLastIcon, {})
|
|
18049
|
+
},
|
|
18050
|
+
{
|
|
18051
|
+
key: "startShift",
|
|
18052
|
+
label: "Start Shift",
|
|
18053
|
+
value: `${spanStartTimeShift}ms`,
|
|
18054
|
+
icon: /* @__PURE__ */ jsx(ChevronsRightIcon, {})
|
|
17864
18055
|
}
|
|
17865
|
-
|
|
17866
|
-
|
|
17867
|
-
|
|
17868
|
-
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
|
|
17873
|
-
|
|
17874
|
-
|
|
17875
|
-
|
|
17876
|
-
|
|
17877
|
-
|
|
17878
|
-
|
|
17879
|
-
|
|
17880
|
-
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
17896
|
-
|
|
17897
|
-
|
|
17898
|
-
|
|
17899
|
-
|
|
17900
|
-
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
17915
|
-
|
|
17916
|
-
|
|
17917
|
-
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
18056
|
+
],
|
|
18057
|
+
LinkComponent: Link
|
|
18058
|
+
}
|
|
18059
|
+
),
|
|
18060
|
+
/* @__PURE__ */ jsx(HoverCard.Arrow, { className: "fill-surface5" })
|
|
18061
|
+
]
|
|
18062
|
+
}
|
|
18063
|
+
) })
|
|
18064
|
+
] });
|
|
18065
|
+
}
|
|
18066
|
+
|
|
18067
|
+
function TraceTimelineSpan({
|
|
18068
|
+
span,
|
|
18069
|
+
depth = 0,
|
|
18070
|
+
onSpanClick,
|
|
18071
|
+
selectedSpanId,
|
|
18072
|
+
isLastChild,
|
|
18073
|
+
overallLatency,
|
|
18074
|
+
overallStartTime,
|
|
18075
|
+
overallEndTime,
|
|
18076
|
+
fadedTypes,
|
|
18077
|
+
searchPhrase,
|
|
18078
|
+
featuredSpanIds,
|
|
18079
|
+
expandedSpanIds,
|
|
18080
|
+
setExpandedSpanIds
|
|
18081
|
+
}) {
|
|
18082
|
+
const hasChildren = span.spans && span.spans.length > 0;
|
|
18083
|
+
const numOfChildren = span.spans ? span.spans.length : 0;
|
|
18084
|
+
const allDescendantIds = getSpanDescendantIds(span);
|
|
18085
|
+
const totalDescendants = allDescendantIds.length;
|
|
18086
|
+
const isRootSpan = depth === 0;
|
|
18087
|
+
const spanUI = getSpanTypeUi(span?.type);
|
|
18088
|
+
const isExpanded = expandedSpanIds ? expandedSpanIds.includes(span.id) : false;
|
|
18089
|
+
const isFadedBySearch = featuredSpanIds && featuredSpanIds.length > 0 ? !featuredSpanIds.includes(span.id) : false;
|
|
18090
|
+
const isFadedByType = fadedTypes && fadedTypes.length > 0 ? fadedTypes.includes(spanUI?.typePrefix || "") : false;
|
|
18091
|
+
const isFaded = isFadedByType || isFadedBySearch;
|
|
18092
|
+
useEffect(() => {
|
|
18093
|
+
isRootSpan && setExpandedSpanIds?.([span.id]);
|
|
18094
|
+
}, [isRootSpan, span.id, setExpandedSpanIds]);
|
|
18095
|
+
useEffect(() => {
|
|
18096
|
+
if (!featuredSpanIds || !span.spans || span.spans.length === 0) return;
|
|
18097
|
+
const hasFeaturedChildren = span.spans.some((childSpan) => featuredSpanIds.includes(childSpan.id));
|
|
18098
|
+
if (!isExpanded && hasFeaturedChildren) {
|
|
18099
|
+
toggleChildren();
|
|
18100
|
+
}
|
|
18101
|
+
}, [featuredSpanIds, span.spans, span.id, isExpanded, setExpandedSpanIds, expandedSpanIds]);
|
|
18102
|
+
const toggleChildren = () => {
|
|
18103
|
+
if (!setExpandedSpanIds || !expandedSpanIds) return;
|
|
18104
|
+
if (isExpanded) {
|
|
18105
|
+
const idsToRemove = [span.id, ...allDescendantIds];
|
|
18106
|
+
setExpandedSpanIds(expandedSpanIds.filter((id) => !idsToRemove.includes(id)));
|
|
18107
|
+
} else {
|
|
18108
|
+
setExpandedSpanIds([...expandedSpanIds, span.id]);
|
|
18109
|
+
}
|
|
18110
|
+
};
|
|
18111
|
+
const expandAllDescendants = () => {
|
|
18112
|
+
if (!setExpandedSpanIds || !expandedSpanIds) return;
|
|
18113
|
+
setExpandedSpanIds([...expandedSpanIds, span.id, ...allDescendantIds]);
|
|
18114
|
+
};
|
|
18115
|
+
const allDescendantsExpanded = allDescendantIds.every((id) => expandedSpanIds?.includes(id));
|
|
18116
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18117
|
+
/* @__PURE__ */ jsx(
|
|
18118
|
+
TimelineNameCol,
|
|
18119
|
+
{
|
|
18120
|
+
span,
|
|
18121
|
+
spanUI,
|
|
18122
|
+
isFaded,
|
|
18123
|
+
depth,
|
|
18124
|
+
onSpanClick,
|
|
18125
|
+
selectedSpanId,
|
|
18126
|
+
isLastChild,
|
|
18127
|
+
hasChildren,
|
|
18128
|
+
isRootSpan,
|
|
18129
|
+
isExpanded,
|
|
18130
|
+
toggleChildren
|
|
18131
|
+
}
|
|
18132
|
+
),
|
|
18133
|
+
/* @__PURE__ */ jsx(
|
|
18134
|
+
TimelineExpandCol,
|
|
18135
|
+
{
|
|
18136
|
+
isSelected: selectedSpanId === span.id,
|
|
18137
|
+
isFaded,
|
|
18138
|
+
isExpanded,
|
|
18139
|
+
toggleChildren,
|
|
18140
|
+
expandAllDescendants,
|
|
18141
|
+
expandedSpanIds,
|
|
18142
|
+
totalDescendants,
|
|
18143
|
+
allDescendantsExpanded,
|
|
18144
|
+
numOfChildren
|
|
18145
|
+
}
|
|
18146
|
+
),
|
|
18147
|
+
/* @__PURE__ */ jsx(
|
|
18148
|
+
TimelineTimingCol,
|
|
18149
|
+
{
|
|
18150
|
+
span,
|
|
18151
|
+
selectedSpanId,
|
|
18152
|
+
isFaded,
|
|
18153
|
+
overallLatency,
|
|
18154
|
+
overallStartTime,
|
|
18155
|
+
overallEndTime,
|
|
18156
|
+
color: spanUI?.color
|
|
18157
|
+
}
|
|
18158
|
+
),
|
|
18159
|
+
hasChildren && isExpanded && span.spans?.map((childSpan, idx, array) => {
|
|
17929
18160
|
const isLastChild2 = idx === array.length - 1;
|
|
17930
18161
|
return /* @__PURE__ */ jsx(
|
|
17931
18162
|
TraceTimelineSpan,
|
|
@@ -17936,31 +18167,29 @@ function TraceTimelineSpan({
|
|
|
17936
18167
|
selectedSpanId,
|
|
17937
18168
|
isLastChild: isLastChild2,
|
|
17938
18169
|
overallLatency,
|
|
17939
|
-
overallStartTime
|
|
18170
|
+
overallStartTime,
|
|
18171
|
+
fadedTypes,
|
|
18172
|
+
searchPhrase,
|
|
18173
|
+
expandedSpanIds,
|
|
18174
|
+
setExpandedSpanIds,
|
|
18175
|
+
featuredSpanIds
|
|
17940
18176
|
},
|
|
17941
18177
|
childSpan.id
|
|
17942
18178
|
);
|
|
17943
18179
|
})
|
|
17944
18180
|
] });
|
|
17945
18181
|
}
|
|
17946
|
-
function TreePositionMark({ isLastChild, hasChildren = false }) {
|
|
17947
|
-
return /* @__PURE__ */ jsx(
|
|
17948
|
-
"div",
|
|
17949
|
-
{
|
|
17950
|
-
className: cn(
|
|
17951
|
-
"w-[1.5rem] h-[2.2rem] relative opacity-50 ",
|
|
17952
|
-
'after:content-[""] after:absolute after:left-0 after:top-0 after:bottom-0 after:w-[0px] after:border-r-[0.5px] after:border-white after:border-dashed',
|
|
17953
|
-
'before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-[0px] before:border-b-[0.5px] before:border-white before:border-dashed',
|
|
17954
|
-
{
|
|
17955
|
-
"after:bottom-[50%]": isLastChild
|
|
17956
|
-
}
|
|
17957
|
-
),
|
|
17958
|
-
children: hasChildren && /* @__PURE__ */ jsx("div", { className: "absolute -right-[1px] top-[50%] bottom-0 w-[0px] border-r-[0.5px] border-white border-dashed" })
|
|
17959
|
-
}
|
|
17960
|
-
);
|
|
17961
|
-
}
|
|
17962
18182
|
|
|
17963
|
-
function TraceTimeline({
|
|
18183
|
+
function TraceTimeline({
|
|
18184
|
+
hierarchicalSpans = [],
|
|
18185
|
+
onSpanClick,
|
|
18186
|
+
selectedSpanId,
|
|
18187
|
+
isLoading,
|
|
18188
|
+
fadedTypes,
|
|
18189
|
+
expandedSpanIds,
|
|
18190
|
+
setExpandedSpanIds,
|
|
18191
|
+
featuredSpanIds
|
|
18192
|
+
}) {
|
|
17964
18193
|
const overallLatency = hierarchicalSpans?.[0]?.latency || 0;
|
|
17965
18194
|
const overallStartTime = hierarchicalSpans?.[0]?.startTime || "";
|
|
17966
18195
|
const overallEndTime = hierarchicalSpans?.[0]?.endTime || "";
|
|
@@ -17979,10 +18208,13 @@ function TraceTimeline({ hierarchicalSpans = [], onSpanClick, selectedSpanId, is
|
|
|
17979
18208
|
) : /* @__PURE__ */ jsx(
|
|
17980
18209
|
"div",
|
|
17981
18210
|
{
|
|
17982
|
-
className: cn(
|
|
17983
|
-
"
|
|
17984
|
-
|
|
17985
|
-
|
|
18211
|
+
className: cn(
|
|
18212
|
+
"grid items-start content-start gap-y-[2px] overflow-hidden grid-cols-[1fr_auto] xl:py-[1rem]",
|
|
18213
|
+
{
|
|
18214
|
+
"xl:grid-cols-[1fr_auto_auto]": !overallEndTime,
|
|
18215
|
+
"xl:grid-cols-[2fr_auto_1fr]": overallEndTime
|
|
18216
|
+
}
|
|
18217
|
+
),
|
|
17986
18218
|
children: hierarchicalSpans?.map((span) => /* @__PURE__ */ jsx(
|
|
17987
18219
|
TraceTimelineSpan,
|
|
17988
18220
|
{
|
|
@@ -17991,7 +18223,11 @@ function TraceTimeline({ hierarchicalSpans = [], onSpanClick, selectedSpanId, is
|
|
|
17991
18223
|
selectedSpanId,
|
|
17992
18224
|
overallLatency,
|
|
17993
18225
|
overallStartTime,
|
|
17994
|
-
overallEndTime
|
|
18226
|
+
overallEndTime,
|
|
18227
|
+
fadedTypes,
|
|
18228
|
+
featuredSpanIds,
|
|
18229
|
+
expandedSpanIds,
|
|
18230
|
+
setExpandedSpanIds
|
|
17995
18231
|
},
|
|
17996
18232
|
span.id
|
|
17997
18233
|
))
|
|
@@ -17999,19 +18235,235 @@ function TraceTimeline({ hierarchicalSpans = [], onSpanClick, selectedSpanId, is
|
|
|
17999
18235
|
) });
|
|
18000
18236
|
}
|
|
18001
18237
|
|
|
18002
|
-
function
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18010
|
-
|
|
18011
|
-
|
|
18012
|
-
|
|
18238
|
+
function TraceTimelineTools({
|
|
18239
|
+
spans = [],
|
|
18240
|
+
fadedTypes,
|
|
18241
|
+
onLegendClick,
|
|
18242
|
+
onLegendReset,
|
|
18243
|
+
onSearchPhraseChange,
|
|
18244
|
+
traceId
|
|
18245
|
+
}) {
|
|
18246
|
+
const [localSearchPhrase, setLocalSearchPhrase] = useState("");
|
|
18247
|
+
useEffect(() => {
|
|
18248
|
+
setLocalSearchPhrase("");
|
|
18249
|
+
}, [traceId]);
|
|
18250
|
+
const usedSpanTypes = spanTypePrefixes.filter((typePrefix) => spans.some((span) => span?.spanType?.startsWith(typePrefix))) || [];
|
|
18251
|
+
const hasOtherSpanTypes = spans.some((span) => {
|
|
18252
|
+
const isKnownType = spanTypePrefixes.some((typePrefix) => span?.spanType?.startsWith(typePrefix));
|
|
18253
|
+
return !isKnownType;
|
|
18254
|
+
});
|
|
18255
|
+
const handleToggle = (type) => {
|
|
18256
|
+
onLegendClick?.(type);
|
|
18257
|
+
};
|
|
18258
|
+
useEffect(() => {
|
|
18259
|
+
handleSearchPhraseChange(localSearchPhrase);
|
|
18260
|
+
}, [localSearchPhrase, onSearchPhraseChange]);
|
|
18261
|
+
const handleSearchPhraseChange = useThrottledCallback((value) => {
|
|
18262
|
+
onSearchPhraseChange?.(value);
|
|
18263
|
+
}, 1e3);
|
|
18264
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-center justify-between", children: [
|
|
18265
|
+
/* @__PURE__ */ jsx("div", { className: "flex", children: /* @__PURE__ */ jsx(
|
|
18266
|
+
SearchField,
|
|
18267
|
+
{
|
|
18268
|
+
value: localSearchPhrase,
|
|
18269
|
+
onChange: (e) => {
|
|
18270
|
+
setLocalSearchPhrase(e.target.value);
|
|
18271
|
+
},
|
|
18272
|
+
label: "Find span by name",
|
|
18273
|
+
placeholder: "Look for span name",
|
|
18274
|
+
onReset: () => setLocalSearchPhrase("")
|
|
18275
|
+
}
|
|
18276
|
+
) }),
|
|
18277
|
+
/* @__PURE__ */ jsxs(CombinedButtons, { children: [
|
|
18278
|
+
usedSpanTypes.map((item, idx) => {
|
|
18279
|
+
const spanUI = getSpanTypeUi(item);
|
|
18280
|
+
const isFaded = fadedTypes?.includes(item);
|
|
18281
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs(
|
|
18282
|
+
Button,
|
|
18283
|
+
{
|
|
18284
|
+
onClick: () => handleToggle(item),
|
|
18285
|
+
isFaded,
|
|
18286
|
+
style: { color: !isFaded ? spanUI?.color : void 0, backgroundColor: spanUI?.bgColor },
|
|
18287
|
+
children: [
|
|
18288
|
+
spanUI?.icon && spanUI.icon,
|
|
18289
|
+
spanUI?.label
|
|
18290
|
+
]
|
|
18291
|
+
}
|
|
18292
|
+
) }, item);
|
|
18293
|
+
}),
|
|
18294
|
+
hasOtherSpanTypes && /* @__PURE__ */ jsxs(
|
|
18295
|
+
Button,
|
|
18296
|
+
{
|
|
18297
|
+
onClick: () => handleToggle("other"),
|
|
18298
|
+
isFaded: fadedTypes?.includes("other"),
|
|
18299
|
+
style: { color: !fadedTypes?.includes("other") ? void 0 : void 0, backgroundColor: void 0 },
|
|
18300
|
+
children: [
|
|
18301
|
+
/* @__PURE__ */ jsx(CircleDashedIcon, {}),
|
|
18302
|
+
"Other"
|
|
18303
|
+
]
|
|
18304
|
+
}
|
|
18305
|
+
),
|
|
18306
|
+
/* @__PURE__ */ jsx(Button, { onClick: onLegendReset, disabled: fadedTypes?.length === 0, children: /* @__PURE__ */ jsx(XIcon, {}) })
|
|
18307
|
+
] })
|
|
18308
|
+
] });
|
|
18013
18309
|
}
|
|
18014
18310
|
|
|
18311
|
+
function useTraceInfo(trace) {
|
|
18312
|
+
const { paths } = useLinkComponent();
|
|
18313
|
+
if (!trace) {
|
|
18314
|
+
return [];
|
|
18315
|
+
}
|
|
18316
|
+
const agentsLink = paths.agentsLink();
|
|
18317
|
+
const workflowsLink = paths.workflowsLink();
|
|
18318
|
+
const agentLink = paths.agentLink(trace?.metadata?.resourceId);
|
|
18319
|
+
const workflowLink = paths.workflowLink(trace?.attributes?.workflowId);
|
|
18320
|
+
return [
|
|
18321
|
+
{
|
|
18322
|
+
key: "entityId",
|
|
18323
|
+
label: "Entity Id",
|
|
18324
|
+
value: [
|
|
18325
|
+
{
|
|
18326
|
+
id: trace?.metadata?.resourceId,
|
|
18327
|
+
name: trace?.attributes?.agentId || trace?.attributes?.workflowId || "-",
|
|
18328
|
+
path: trace?.attributes?.agentId ? agentLink : trace?.attributes?.workflowId ? workflowLink : void 0
|
|
18329
|
+
}
|
|
18330
|
+
]
|
|
18331
|
+
},
|
|
18332
|
+
{
|
|
18333
|
+
key: "entityType",
|
|
18334
|
+
label: "Entity Type",
|
|
18335
|
+
value: [
|
|
18336
|
+
{
|
|
18337
|
+
id: trace?.attributes?.agentId || trace?.attributes?.workflowId,
|
|
18338
|
+
name: trace?.attributes?.agentId ? "Agent" : trace?.attributes?.workflowId ? "Workflow" : "-",
|
|
18339
|
+
path: trace?.attributes?.agentId ? agentsLink : trace?.attributes?.workflowId ? workflowsLink : void 0
|
|
18340
|
+
}
|
|
18341
|
+
]
|
|
18342
|
+
},
|
|
18343
|
+
{
|
|
18344
|
+
key: "status",
|
|
18345
|
+
label: "Status",
|
|
18346
|
+
value: trace?.attributes?.status || "-"
|
|
18347
|
+
},
|
|
18348
|
+
{
|
|
18349
|
+
key: "startedAt",
|
|
18350
|
+
label: "Started at",
|
|
18351
|
+
value: trace?.startedAt ? format(new Date(trace?.startedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18352
|
+
},
|
|
18353
|
+
{
|
|
18354
|
+
key: "endedAt",
|
|
18355
|
+
label: "Ended at",
|
|
18356
|
+
value: trace?.endedAt ? format(new Date(trace?.endedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18357
|
+
}
|
|
18358
|
+
];
|
|
18359
|
+
}
|
|
18360
|
+
function getSpanInfo({ span }) {
|
|
18361
|
+
if (!span) {
|
|
18362
|
+
return [];
|
|
18363
|
+
}
|
|
18364
|
+
const baseInfo = [
|
|
18365
|
+
{
|
|
18366
|
+
key: "spanType",
|
|
18367
|
+
label: "Span Type",
|
|
18368
|
+
value: span?.spanType
|
|
18369
|
+
},
|
|
18370
|
+
{
|
|
18371
|
+
key: "startedAt",
|
|
18372
|
+
label: "Started At",
|
|
18373
|
+
value: span?.startedAt ? format(new Date(span.startedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18374
|
+
},
|
|
18375
|
+
{
|
|
18376
|
+
key: "endedAt",
|
|
18377
|
+
label: "Ended At",
|
|
18378
|
+
value: span?.endedAt ? format(new Date(span.endedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18379
|
+
}
|
|
18380
|
+
];
|
|
18381
|
+
if (span?.attributes?.finishReason) {
|
|
18382
|
+
baseInfo.push({
|
|
18383
|
+
key: "finishReason",
|
|
18384
|
+
label: "Finish Reason",
|
|
18385
|
+
value: span.attributes.finishReason
|
|
18386
|
+
});
|
|
18387
|
+
}
|
|
18388
|
+
return baseInfo;
|
|
18389
|
+
}
|
|
18390
|
+
|
|
18391
|
+
const TabsRoot = ({
|
|
18392
|
+
children,
|
|
18393
|
+
defaultTab,
|
|
18394
|
+
value,
|
|
18395
|
+
onValueChange,
|
|
18396
|
+
className
|
|
18397
|
+
}) => {
|
|
18398
|
+
const [internalTab, setInternalTab] = useState(defaultTab);
|
|
18399
|
+
const isControlled = value !== void 0 && onValueChange !== void 0;
|
|
18400
|
+
const currentTab = isControlled ? value : internalTab;
|
|
18401
|
+
const handleTabChange = (newValue) => {
|
|
18402
|
+
const typedValue = newValue;
|
|
18403
|
+
if (isControlled) {
|
|
18404
|
+
onValueChange(typedValue);
|
|
18405
|
+
} else {
|
|
18406
|
+
setInternalTab(typedValue);
|
|
18407
|
+
}
|
|
18408
|
+
};
|
|
18409
|
+
return /* @__PURE__ */ jsx(
|
|
18410
|
+
TabsPrimitive.Root,
|
|
18411
|
+
{
|
|
18412
|
+
value: currentTab,
|
|
18413
|
+
onValueChange: handleTabChange,
|
|
18414
|
+
className: cn("grid gap-8 overflow-y-auto", className),
|
|
18415
|
+
children
|
|
18416
|
+
}
|
|
18417
|
+
);
|
|
18418
|
+
};
|
|
18419
|
+
|
|
18420
|
+
const TabList = ({ children, variant = "default", className }) => {
|
|
18421
|
+
return /* @__PURE__ */ jsx("div", { className: cn("w-full overflow-x-auto", className), children: /* @__PURE__ */ jsx(
|
|
18422
|
+
TabsPrimitive.List,
|
|
18423
|
+
{
|
|
18424
|
+
className: cn(
|
|
18425
|
+
"flex items-center",
|
|
18426
|
+
{
|
|
18427
|
+
// variant: default
|
|
18428
|
+
"text-[0.9375rem]": variant === "default",
|
|
18429
|
+
"[&>button]:py-[0.5rem] [&>button]:px-[1.5rem] [&>button]:font-normal [&>button]:text-icon3 [&>button]:flex-1 [&>button]:border-b [&>button]:border-border1": variant === "default",
|
|
18430
|
+
"[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:transition-colors [&>button[data-state=active]]:duration-200 [&>button[data-state=active]]:border-icon3": variant === "default",
|
|
18431
|
+
// variant: buttons
|
|
18432
|
+
"border border-border1 flex justify-stretch rounded-md overflow-hidden text-[0.875rem] min-h-[2.5rem]": variant === "buttons",
|
|
18433
|
+
"[&>button]:flex-1 [&>button]:py-[0.5rem] [&>button]:px-[1rem] [&>button]:text-icon3": variant === "buttons",
|
|
18434
|
+
"[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:bg-[#222]": variant === "buttons"
|
|
18435
|
+
},
|
|
18436
|
+
className
|
|
18437
|
+
),
|
|
18438
|
+
children
|
|
18439
|
+
}
|
|
18440
|
+
) });
|
|
18441
|
+
};
|
|
18442
|
+
|
|
18443
|
+
const Tab = ({ children, value, onClick, className }) => {
|
|
18444
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { value, className: cn("hover:text-icon5", className), onClick, children });
|
|
18445
|
+
};
|
|
18446
|
+
|
|
18447
|
+
const TabContent = ({ children, value, className }) => {
|
|
18448
|
+
return /* @__PURE__ */ jsx(
|
|
18449
|
+
TabsPrimitive.Content,
|
|
18450
|
+
{
|
|
18451
|
+
value,
|
|
18452
|
+
className: cn(
|
|
18453
|
+
"grid overflow-y-auto ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:none",
|
|
18454
|
+
className
|
|
18455
|
+
),
|
|
18456
|
+
children
|
|
18457
|
+
}
|
|
18458
|
+
);
|
|
18459
|
+
};
|
|
18460
|
+
|
|
18461
|
+
const Tabs = Object.assign(TabsRoot, {
|
|
18462
|
+
List: TabList,
|
|
18463
|
+
Tab,
|
|
18464
|
+
Content: TabContent
|
|
18465
|
+
});
|
|
18466
|
+
|
|
18015
18467
|
function TraceSpanUsage({ traceUsage, traceSpans = [], spanUsage, className }) {
|
|
18016
18468
|
if (!traceUsage && !spanUsage) {
|
|
18017
18469
|
console.warn("No usage data available");
|
|
@@ -18174,169 +18626,6 @@ function TraceSpanUsage({ traceUsage, traceSpans = [], spanUsage, className }) {
|
|
|
18174
18626
|
)) });
|
|
18175
18627
|
}
|
|
18176
18628
|
|
|
18177
|
-
function useTraceInfo(trace) {
|
|
18178
|
-
const { paths } = useLinkComponent();
|
|
18179
|
-
if (!trace) {
|
|
18180
|
-
return [];
|
|
18181
|
-
}
|
|
18182
|
-
const agentsLink = paths.agentsLink();
|
|
18183
|
-
const workflowsLink = paths.workflowsLink();
|
|
18184
|
-
const agentLink = paths.agentLink(trace?.metadata?.resourceId);
|
|
18185
|
-
const workflowLink = paths.workflowLink(trace?.attributes?.workflowId);
|
|
18186
|
-
return [
|
|
18187
|
-
{
|
|
18188
|
-
key: "entityId",
|
|
18189
|
-
label: "Entity Id",
|
|
18190
|
-
value: [
|
|
18191
|
-
{
|
|
18192
|
-
id: trace?.metadata?.resourceId,
|
|
18193
|
-
name: trace?.attributes?.agentId || trace?.attributes?.workflowId || "-",
|
|
18194
|
-
path: trace?.attributes?.agentId ? agentLink : trace?.attributes?.workflowId ? workflowLink : void 0
|
|
18195
|
-
}
|
|
18196
|
-
]
|
|
18197
|
-
},
|
|
18198
|
-
{
|
|
18199
|
-
key: "entityType",
|
|
18200
|
-
label: "Entity Type",
|
|
18201
|
-
value: [
|
|
18202
|
-
{
|
|
18203
|
-
id: trace?.attributes?.agentId || trace?.attributes?.workflowId,
|
|
18204
|
-
name: trace?.attributes?.agentId ? "Agent" : trace?.attributes?.workflowId ? "Workflow" : "-",
|
|
18205
|
-
path: trace?.attributes?.agentId ? agentsLink : trace?.attributes?.workflowId ? workflowsLink : void 0
|
|
18206
|
-
}
|
|
18207
|
-
]
|
|
18208
|
-
},
|
|
18209
|
-
{
|
|
18210
|
-
key: "status",
|
|
18211
|
-
label: "Status",
|
|
18212
|
-
value: trace?.attributes?.status || "-"
|
|
18213
|
-
},
|
|
18214
|
-
{
|
|
18215
|
-
key: "startedAt",
|
|
18216
|
-
label: "Started at",
|
|
18217
|
-
value: trace?.startedAt ? format(new Date(trace?.startedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18218
|
-
},
|
|
18219
|
-
{
|
|
18220
|
-
key: "endedAt",
|
|
18221
|
-
label: "Ended at",
|
|
18222
|
-
value: trace?.endedAt ? format(new Date(trace?.endedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18223
|
-
}
|
|
18224
|
-
];
|
|
18225
|
-
}
|
|
18226
|
-
function getSpanInfo({ span, withTraceId = true, withSpanId = true }) {
|
|
18227
|
-
if (!span) {
|
|
18228
|
-
return [];
|
|
18229
|
-
}
|
|
18230
|
-
const baseInfo = [
|
|
18231
|
-
{
|
|
18232
|
-
key: "spanType",
|
|
18233
|
-
label: "Span Type",
|
|
18234
|
-
value: span?.spanType
|
|
18235
|
-
},
|
|
18236
|
-
{
|
|
18237
|
-
key: "startedAt",
|
|
18238
|
-
label: "Started At",
|
|
18239
|
-
value: span?.startedAt ? format(new Date(span.startedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18240
|
-
},
|
|
18241
|
-
{
|
|
18242
|
-
key: "endedAt",
|
|
18243
|
-
label: "Ended At",
|
|
18244
|
-
value: span?.endedAt ? format(new Date(span.endedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
|
|
18245
|
-
}
|
|
18246
|
-
];
|
|
18247
|
-
if (span?.attributes?.finishReason) {
|
|
18248
|
-
baseInfo.push({
|
|
18249
|
-
key: "finishReason",
|
|
18250
|
-
label: "Finish Reason",
|
|
18251
|
-
value: span.attributes.finishReason
|
|
18252
|
-
});
|
|
18253
|
-
}
|
|
18254
|
-
if (withSpanId) {
|
|
18255
|
-
baseInfo.unshift({
|
|
18256
|
-
key: "spanId",
|
|
18257
|
-
label: "#",
|
|
18258
|
-
value: span?.spanId
|
|
18259
|
-
});
|
|
18260
|
-
}
|
|
18261
|
-
return baseInfo;
|
|
18262
|
-
}
|
|
18263
|
-
|
|
18264
|
-
const TabsRoot = ({
|
|
18265
|
-
children,
|
|
18266
|
-
defaultTab,
|
|
18267
|
-
value,
|
|
18268
|
-
onValueChange,
|
|
18269
|
-
className
|
|
18270
|
-
}) => {
|
|
18271
|
-
const [internalTab, setInternalTab] = useState(defaultTab);
|
|
18272
|
-
const isControlled = value !== void 0 && onValueChange !== void 0;
|
|
18273
|
-
const currentTab = isControlled ? value : internalTab;
|
|
18274
|
-
const handleTabChange = (newValue) => {
|
|
18275
|
-
const typedValue = newValue;
|
|
18276
|
-
if (isControlled) {
|
|
18277
|
-
onValueChange(typedValue);
|
|
18278
|
-
} else {
|
|
18279
|
-
setInternalTab(typedValue);
|
|
18280
|
-
}
|
|
18281
|
-
};
|
|
18282
|
-
return /* @__PURE__ */ jsx(
|
|
18283
|
-
TabsPrimitive.Root,
|
|
18284
|
-
{
|
|
18285
|
-
value: currentTab,
|
|
18286
|
-
onValueChange: handleTabChange,
|
|
18287
|
-
className: cn("grid gap-[3rem] overflow-y-auto", className),
|
|
18288
|
-
children
|
|
18289
|
-
}
|
|
18290
|
-
);
|
|
18291
|
-
};
|
|
18292
|
-
|
|
18293
|
-
const TabList = ({ children, variant = "default", className }) => {
|
|
18294
|
-
return /* @__PURE__ */ jsx("div", { className: cn("w-full overflow-x-auto", className), children: /* @__PURE__ */ jsx(
|
|
18295
|
-
TabsPrimitive.List,
|
|
18296
|
-
{
|
|
18297
|
-
className: cn(
|
|
18298
|
-
"flex items-center",
|
|
18299
|
-
{
|
|
18300
|
-
// variant: default
|
|
18301
|
-
"text-[0.9375rem]": variant === "default",
|
|
18302
|
-
"[&>button]:py-[0.5rem] [&>button]:px-[1.5rem] [&>button]:font-normal [&>button]:text-icon3 [&>button]:flex-1 [&>button]:border-b [&>button]:border-border1": variant === "default",
|
|
18303
|
-
"[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:transition-colors [&>button[data-state=active]]:duration-200 [&>button[data-state=active]]:border-icon3": variant === "default",
|
|
18304
|
-
// variant: buttons
|
|
18305
|
-
"border border-border1 flex justify-stretch rounded-md overflow-hidden text-[0.875rem] min-h-[2.5rem]": variant === "buttons",
|
|
18306
|
-
"[&>button]:flex-1 [&>button]:py-[0.5rem] [&>button]:px-[1rem] [&>button]:text-icon3": variant === "buttons",
|
|
18307
|
-
"[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:bg-[#222]": variant === "buttons"
|
|
18308
|
-
},
|
|
18309
|
-
className
|
|
18310
|
-
),
|
|
18311
|
-
children
|
|
18312
|
-
}
|
|
18313
|
-
) });
|
|
18314
|
-
};
|
|
18315
|
-
|
|
18316
|
-
const Tab = ({ children, value, onClick, className }) => {
|
|
18317
|
-
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { value, className: cn("hover:text-icon5", className), onClick, children });
|
|
18318
|
-
};
|
|
18319
|
-
|
|
18320
|
-
const TabContent = ({ children, value, className }) => {
|
|
18321
|
-
return /* @__PURE__ */ jsx(
|
|
18322
|
-
TabsPrimitive.Content,
|
|
18323
|
-
{
|
|
18324
|
-
value,
|
|
18325
|
-
className: cn(
|
|
18326
|
-
"grid overflow-y-auto ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:none",
|
|
18327
|
-
className
|
|
18328
|
-
),
|
|
18329
|
-
children
|
|
18330
|
-
}
|
|
18331
|
-
);
|
|
18332
|
-
};
|
|
18333
|
-
|
|
18334
|
-
const Tabs = Object.assign(TabsRoot, {
|
|
18335
|
-
List: TabList,
|
|
18336
|
-
Tab,
|
|
18337
|
-
Content: TabContent
|
|
18338
|
-
});
|
|
18339
|
-
|
|
18340
18629
|
function isTokenLimitExceeded(span) {
|
|
18341
18630
|
return span?.attributes?.finishReason === "length";
|
|
18342
18631
|
}
|
|
@@ -18413,7 +18702,9 @@ function SpanTabs({
|
|
|
18413
18702
|
spanInfo = [],
|
|
18414
18703
|
defaultActiveTab = "details",
|
|
18415
18704
|
initialScoreId,
|
|
18416
|
-
computeTraceLink
|
|
18705
|
+
computeTraceLink,
|
|
18706
|
+
scorers,
|
|
18707
|
+
isLoadingScorers
|
|
18417
18708
|
}) {
|
|
18418
18709
|
const { Link } = useLinkComponent();
|
|
18419
18710
|
let entityType;
|
|
@@ -18447,7 +18738,9 @@ function SpanTabs({
|
|
|
18447
18738
|
traceId: trace?.traceId,
|
|
18448
18739
|
isTopLevelSpan: span?.parentSpanId === null,
|
|
18449
18740
|
spanId: span?.spanId,
|
|
18450
|
-
entityType
|
|
18741
|
+
entityType,
|
|
18742
|
+
scorers,
|
|
18743
|
+
isLoadingScorers
|
|
18451
18744
|
}
|
|
18452
18745
|
)
|
|
18453
18746
|
] }),
|
|
@@ -18487,7 +18780,9 @@ function SpanDialog({
|
|
|
18487
18780
|
spanInfo = [],
|
|
18488
18781
|
defaultActiveTab = "details",
|
|
18489
18782
|
initialScoreId,
|
|
18490
|
-
computeTraceLink
|
|
18783
|
+
computeTraceLink,
|
|
18784
|
+
scorers,
|
|
18785
|
+
isLoadingScorers
|
|
18491
18786
|
}) {
|
|
18492
18787
|
return /* @__PURE__ */ jsxs(
|
|
18493
18788
|
SideDialog,
|
|
@@ -18540,7 +18835,9 @@ function SpanDialog({
|
|
|
18540
18835
|
spanInfo,
|
|
18541
18836
|
defaultActiveTab,
|
|
18542
18837
|
initialScoreId,
|
|
18543
|
-
computeTraceLink
|
|
18838
|
+
computeTraceLink,
|
|
18839
|
+
scorers,
|
|
18840
|
+
isLoadingScorers
|
|
18544
18841
|
}
|
|
18545
18842
|
)
|
|
18546
18843
|
] })
|
|
@@ -18558,12 +18855,12 @@ function TraceDialog({
|
|
|
18558
18855
|
onNext,
|
|
18559
18856
|
onPrevious,
|
|
18560
18857
|
isLoadingSpans,
|
|
18561
|
-
computeAgentsLink,
|
|
18562
|
-
computeWorkflowsLink,
|
|
18563
18858
|
computeTraceLink,
|
|
18564
18859
|
initialSpanId,
|
|
18565
18860
|
initialSpanTab,
|
|
18566
|
-
initialScoreId
|
|
18861
|
+
initialScoreId,
|
|
18862
|
+
scorers,
|
|
18863
|
+
isLoadingScorers
|
|
18567
18864
|
}) {
|
|
18568
18865
|
const { Link, navigate } = useLinkComponent();
|
|
18569
18866
|
const [dialogIsOpen, setDialogIsOpen] = useState(Boolean(initialSpanId));
|
|
@@ -18573,6 +18870,19 @@ function TraceDialog({
|
|
|
18573
18870
|
const selectedSpan = traceSpans.find((span) => span.spanId === selectedSpanId);
|
|
18574
18871
|
const traceInfo = useTraceInfo(traceDetails);
|
|
18575
18872
|
const [spanScoresPage, setSpanScoresPage] = useState(0);
|
|
18873
|
+
const [searchPhrase, setSearchPhrase] = useState("");
|
|
18874
|
+
const [fadedSpanTypes, setFadedSpanTypes] = useState([]);
|
|
18875
|
+
const [featuredSpanIds, setFeaturedSpanIds] = useState([]);
|
|
18876
|
+
const [expandedSpanIds, setExpandedSpanIds] = useState([]);
|
|
18877
|
+
useEffect(() => {
|
|
18878
|
+
if (searchPhrase.trim() === "") {
|
|
18879
|
+
setFeaturedSpanIds([]);
|
|
18880
|
+
return;
|
|
18881
|
+
}
|
|
18882
|
+
const lowerCaseSearch = searchPhrase.toLowerCase();
|
|
18883
|
+
const newFeaturedSpanIds = traceSpans.filter((span) => span.name.toLowerCase().includes(lowerCaseSearch)).map((span) => span.spanId);
|
|
18884
|
+
setFeaturedSpanIds(newFeaturedSpanIds);
|
|
18885
|
+
}, [searchPhrase]);
|
|
18576
18886
|
useEffect(() => {
|
|
18577
18887
|
if (initialSpanId) {
|
|
18578
18888
|
setSelectedSpanId(initialSpanId);
|
|
@@ -18607,9 +18917,13 @@ function TraceDialog({
|
|
|
18607
18917
|
page: spanScoresPage
|
|
18608
18918
|
});
|
|
18609
18919
|
const handleSpanClick = (id) => {
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18920
|
+
if (selectedSpanId === id) {
|
|
18921
|
+
setSelectedSpanId(void 0);
|
|
18922
|
+
} else {
|
|
18923
|
+
setSelectedSpanId(id);
|
|
18924
|
+
setSpanDialogDefaultTab("details");
|
|
18925
|
+
setDialogIsOpen(true);
|
|
18926
|
+
}
|
|
18613
18927
|
};
|
|
18614
18928
|
const handleToScoring = () => {
|
|
18615
18929
|
setSelectedSpanId(hierarchicalSpans[0]?.id);
|
|
@@ -18630,9 +18944,53 @@ function TraceDialog({
|
|
|
18630
18944
|
);
|
|
18631
18945
|
}
|
|
18632
18946
|
};
|
|
18633
|
-
const
|
|
18634
|
-
|
|
18635
|
-
|
|
18947
|
+
const handleLegendClick = (type) => {
|
|
18948
|
+
setFadedSpanTypes((prev) => {
|
|
18949
|
+
if (prev.includes(type)) {
|
|
18950
|
+
return prev.filter((t) => t !== type);
|
|
18951
|
+
} else {
|
|
18952
|
+
return [...prev, type];
|
|
18953
|
+
}
|
|
18954
|
+
});
|
|
18955
|
+
};
|
|
18956
|
+
const handleLegendReset = () => {
|
|
18957
|
+
setFadedSpanTypes([]);
|
|
18958
|
+
};
|
|
18959
|
+
const selectedSpanInfo = getSpanInfo({ span: selectedSpan });
|
|
18960
|
+
const getVisibleSpans = () => {
|
|
18961
|
+
const visibleSpans = [];
|
|
18962
|
+
const collectVisibleSpans = (spans, parentId) => {
|
|
18963
|
+
spans.forEach((span) => {
|
|
18964
|
+
const isVisible = !parentId || parentId === null || expandedSpanIds.includes(parentId);
|
|
18965
|
+
if (isVisible) {
|
|
18966
|
+
visibleSpans.push(span);
|
|
18967
|
+
if (expandedSpanIds.includes(span.id) && span.spans) {
|
|
18968
|
+
collectVisibleSpans(span.spans, span.id);
|
|
18969
|
+
}
|
|
18970
|
+
}
|
|
18971
|
+
});
|
|
18972
|
+
};
|
|
18973
|
+
collectVisibleSpans(hierarchicalSpans);
|
|
18974
|
+
return visibleSpans;
|
|
18975
|
+
};
|
|
18976
|
+
const toNextSpan = () => {
|
|
18977
|
+
if (!selectedSpanId) return void 0;
|
|
18978
|
+
const visibleSpans = getVisibleSpans();
|
|
18979
|
+
const currentIndex = visibleSpans.findIndex((span) => span.id === selectedSpanId);
|
|
18980
|
+
if (currentIndex >= 0 && currentIndex < visibleSpans.length - 1) {
|
|
18981
|
+
return () => setSelectedSpanId(visibleSpans[currentIndex + 1].id);
|
|
18982
|
+
}
|
|
18983
|
+
return void 0;
|
|
18984
|
+
};
|
|
18985
|
+
const toPreviousSpan = () => {
|
|
18986
|
+
if (!selectedSpanId) return void 0;
|
|
18987
|
+
const visibleSpans = getVisibleSpans();
|
|
18988
|
+
const currentIndex = visibleSpans.findIndex((span) => span.id === selectedSpanId);
|
|
18989
|
+
if (currentIndex > 0) {
|
|
18990
|
+
return () => setSelectedSpanId(visibleSpans[currentIndex - 1].id);
|
|
18991
|
+
}
|
|
18992
|
+
return void 0;
|
|
18993
|
+
};
|
|
18636
18994
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18637
18995
|
/* @__PURE__ */ jsxs(
|
|
18638
18996
|
SideDialog,
|
|
@@ -18694,57 +19052,66 @@ function TraceDialog({
|
|
|
18694
19052
|
] })
|
|
18695
19053
|
] }),
|
|
18696
19054
|
/* @__PURE__ */ jsxs(Section, { children: [
|
|
18697
|
-
/* @__PURE__ */
|
|
18698
|
-
/* @__PURE__ */
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
19055
|
+
/* @__PURE__ */ jsx(Section.Header, { children: /* @__PURE__ */ jsxs(Section.Heading, { children: [
|
|
19056
|
+
/* @__PURE__ */ jsx(ListTreeIcon, {}),
|
|
19057
|
+
" Timeline"
|
|
19058
|
+
] }) }),
|
|
19059
|
+
/* @__PURE__ */ jsx(
|
|
19060
|
+
TraceTimelineTools,
|
|
19061
|
+
{
|
|
19062
|
+
spans: traceSpans,
|
|
19063
|
+
fadedTypes: fadedSpanTypes,
|
|
19064
|
+
onLegendClick: handleLegendClick,
|
|
19065
|
+
onLegendReset: handleLegendReset,
|
|
19066
|
+
searchPhrase,
|
|
19067
|
+
onSearchPhraseChange: setSearchPhrase,
|
|
19068
|
+
traceId
|
|
19069
|
+
}
|
|
19070
|
+
),
|
|
18704
19071
|
/* @__PURE__ */ jsx(
|
|
18705
19072
|
TraceTimeline,
|
|
18706
19073
|
{
|
|
18707
19074
|
hierarchicalSpans,
|
|
18708
19075
|
onSpanClick: handleSpanClick,
|
|
18709
19076
|
selectedSpanId,
|
|
18710
|
-
isLoading: isLoadingSpans
|
|
19077
|
+
isLoading: isLoadingSpans,
|
|
19078
|
+
fadedTypes: fadedSpanTypes,
|
|
19079
|
+
expandedSpanIds,
|
|
19080
|
+
setExpandedSpanIds,
|
|
19081
|
+
featuredSpanIds
|
|
18711
19082
|
}
|
|
18712
19083
|
)
|
|
18713
19084
|
] })
|
|
18714
19085
|
] })
|
|
18715
19086
|
] }),
|
|
18716
|
-
selectedSpan && combinedView && /* @__PURE__ */ jsxs("div", { className: "grid grid-rows-[auto_1fr] relative overflow-y-auto", children: [
|
|
18717
|
-
/* @__PURE__ */ jsxs(SideDialog.Top, {
|
|
19087
|
+
selectedSpan && combinedView && /* @__PURE__ */ jsxs("div", { className: "grid grid-rows-[auto_1fr] relative overflow-y-auto rounded-xl mx-[2rem] mb-[2rem] bg-surface4", children: [
|
|
19088
|
+
/* @__PURE__ */ jsxs(SideDialog.Top, { children: [
|
|
18718
19089
|
/* @__PURE__ */ jsxs(TextAndIcon, { children: [
|
|
18719
19090
|
/* @__PURE__ */ jsx(ChevronsLeftRightEllipsisIcon, {}),
|
|
18720
19091
|
" ",
|
|
18721
19092
|
getShortId(selectedSpanId)
|
|
18722
19093
|
] }),
|
|
18723
19094
|
"|",
|
|
18724
|
-
/* @__PURE__ */ jsx(SideDialog.Nav, { onNext: toNextSpan, onPrevious: toPreviousSpan }),
|
|
19095
|
+
/* @__PURE__ */ jsx(SideDialog.Nav, { onNext: toNextSpan(), onPrevious: toPreviousSpan() }),
|
|
18725
19096
|
/* @__PURE__ */ jsxs("button", { className: "ml-auto mr-[2rem]", onClick: () => setCombinedView(false), children: [
|
|
18726
19097
|
/* @__PURE__ */ jsx(PanelLeftIcon, {}),
|
|
18727
19098
|
" ",
|
|
18728
19099
|
/* @__PURE__ */ jsx(VisuallyHidden$1, { children: "Switch to dialog view" })
|
|
18729
19100
|
] })
|
|
18730
19101
|
] }),
|
|
18731
|
-
/* @__PURE__ */
|
|
18732
|
-
/* @__PURE__ */ jsxs(
|
|
18733
|
-
/* @__PURE__ */ jsxs(SideDialog.Heading, {
|
|
18734
|
-
/* @__PURE__ */ jsx(
|
|
18735
|
-
" ",
|
|
19102
|
+
/* @__PURE__ */ jsx("div", { className: cn("h-full overflow-y-auto pb-[2rem] pl-[2rem]"), children: /* @__PURE__ */ jsxs("div", { className: "overflow-y-auto pr-[2rem] pt-[2rem] h-full", children: [
|
|
19103
|
+
/* @__PURE__ */ jsxs(SideDialog.Header, { children: [
|
|
19104
|
+
/* @__PURE__ */ jsxs(SideDialog.Heading, { children: [
|
|
19105
|
+
/* @__PURE__ */ jsx(EyeIcon, {}),
|
|
18736
19106
|
selectedSpan?.name
|
|
18737
19107
|
] }),
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
}
|
|
18744
|
-
),
|
|
18745
|
-
/* @__PURE__ */ jsx(KeyValueList, { data: selectedSpanInfo, LinkComponent: Link })
|
|
19108
|
+
/* @__PURE__ */ jsxs(TextAndIcon, { children: [
|
|
19109
|
+
/* @__PURE__ */ jsx(HashIcon, {}),
|
|
19110
|
+
" ",
|
|
19111
|
+
selectedSpanId
|
|
19112
|
+
] })
|
|
18746
19113
|
] }),
|
|
18747
|
-
/* @__PURE__ */ jsx(
|
|
19114
|
+
/* @__PURE__ */ jsx(
|
|
18748
19115
|
SpanTabs,
|
|
18749
19116
|
{
|
|
18750
19117
|
trace: traceDetails,
|
|
@@ -18757,8 +19124,8 @@ function TraceDialog({
|
|
|
18757
19124
|
initialScoreId,
|
|
18758
19125
|
computeTraceLink
|
|
18759
19126
|
}
|
|
18760
|
-
)
|
|
18761
|
-
] })
|
|
19127
|
+
)
|
|
19128
|
+
] }) })
|
|
18762
19129
|
] })
|
|
18763
19130
|
]
|
|
18764
19131
|
}
|
|
@@ -18778,15 +19145,16 @@ function TraceDialog({
|
|
|
18778
19145
|
onClose: () => {
|
|
18779
19146
|
navigate(computeTraceLink(traceId || ""));
|
|
18780
19147
|
setDialogIsOpen(false);
|
|
18781
|
-
setSelectedSpanId(void 0);
|
|
18782
19148
|
},
|
|
18783
|
-
onNext: toNextSpan,
|
|
18784
|
-
onPrevious: toPreviousSpan,
|
|
19149
|
+
onNext: toNextSpan(),
|
|
19150
|
+
onPrevious: toPreviousSpan(),
|
|
18785
19151
|
onViewToggle: () => setCombinedView(!combinedView),
|
|
18786
19152
|
spanInfo: selectedSpanInfo,
|
|
18787
19153
|
defaultActiveTab: spanDialogDefaultTab,
|
|
18788
19154
|
initialScoreId,
|
|
18789
|
-
computeTraceLink
|
|
19155
|
+
computeTraceLink,
|
|
19156
|
+
scorers,
|
|
19157
|
+
isLoadingScorers
|
|
18790
19158
|
}
|
|
18791
19159
|
)
|
|
18792
19160
|
] });
|
|
@@ -19046,8 +19414,14 @@ const useTriggerScorer = () => {
|
|
|
19046
19414
|
});
|
|
19047
19415
|
};
|
|
19048
19416
|
|
|
19049
|
-
const SpanScoring = ({
|
|
19050
|
-
|
|
19417
|
+
const SpanScoring = ({
|
|
19418
|
+
traceId,
|
|
19419
|
+
spanId,
|
|
19420
|
+
entityType,
|
|
19421
|
+
isTopLevelSpan,
|
|
19422
|
+
scorers,
|
|
19423
|
+
isLoadingScorers
|
|
19424
|
+
}) => {
|
|
19051
19425
|
const [selectedScorer, setSelectedScorer] = useState(null);
|
|
19052
19426
|
const { mutate: triggerScorer, isPending, isSuccess } = useTriggerScorer();
|
|
19053
19427
|
const [notificationIsVisible, setNotificationIsVisible] = useState(false);
|
|
@@ -19056,7 +19430,7 @@ const SpanScoring = ({ traceId, spanId, entityType, isTopLevelSpan }) => {
|
|
|
19056
19430
|
setNotificationIsVisible(true);
|
|
19057
19431
|
}
|
|
19058
19432
|
}, [isSuccess]);
|
|
19059
|
-
let scorerList = Object.entries(scorers).map(([key, scorer]) => ({
|
|
19433
|
+
let scorerList = Object.entries(scorers || {}).map(([key, scorer]) => ({
|
|
19060
19434
|
id: key,
|
|
19061
19435
|
name: scorer.scorer.config.name,
|
|
19062
19436
|
description: scorer.scorer.config.description,
|
|
@@ -19066,7 +19440,7 @@ const SpanScoring = ({ traceId, spanId, entityType, isTopLevelSpan }) => {
|
|
|
19066
19440
|
if (entityType !== "Agent" || !isTopLevelSpan) {
|
|
19067
19441
|
scorerList = scorerList.filter((scorer) => scorer.type !== "agent");
|
|
19068
19442
|
}
|
|
19069
|
-
const isWaiting = isPending ||
|
|
19443
|
+
const isWaiting = isPending || isLoadingScorers;
|
|
19070
19444
|
const handleStartScoring = () => {
|
|
19071
19445
|
if (selectedScorer) {
|
|
19072
19446
|
setNotificationIsVisible(false);
|
|
@@ -19082,11 +19456,10 @@ const SpanScoring = ({ traceId, spanId, entityType, isTopLevelSpan }) => {
|
|
|
19082
19456
|
setNotificationIsVisible(false);
|
|
19083
19457
|
};
|
|
19084
19458
|
const selectedScorerDescription = scorerList.find((s) => s.name === selectedScorer)?.description || "";
|
|
19085
|
-
if (
|
|
19459
|
+
if (scorers === void 0 && !isLoadingScorers) {
|
|
19086
19460
|
return /* @__PURE__ */ jsxs(Notification, { isVisible: true, autoDismiss: false, type: "error", children: [
|
|
19087
19461
|
/* @__PURE__ */ jsx(InfoIcon$1, {}),
|
|
19088
|
-
" "
|
|
19089
|
-
error?.message ? error.message : "Failed to load scorers."
|
|
19462
|
+
" Failed to load scorers."
|
|
19090
19463
|
] });
|
|
19091
19464
|
}
|
|
19092
19465
|
if (scorerList.length === 0) {
|
|
@@ -19695,6 +20068,22 @@ function MCPServerCombobox({
|
|
|
19695
20068
|
);
|
|
19696
20069
|
}
|
|
19697
20070
|
|
|
20071
|
+
const getMastraInstanceStatus = async (endpoint = "http://localhost:4111") => {
|
|
20072
|
+
try {
|
|
20073
|
+
const response = await fetch(endpoint);
|
|
20074
|
+
return { status: response.ok ? "active" : "inactive" };
|
|
20075
|
+
} catch {
|
|
20076
|
+
return { status: "inactive" };
|
|
20077
|
+
}
|
|
20078
|
+
};
|
|
20079
|
+
const useMastraInstanceStatus = (endpoint = "http://localhost:4111") => {
|
|
20080
|
+
return useQuery({
|
|
20081
|
+
queryKey: ["mastra-instance-status", endpoint],
|
|
20082
|
+
queryFn: () => getMastraInstanceStatus(endpoint),
|
|
20083
|
+
retry: false
|
|
20084
|
+
});
|
|
20085
|
+
};
|
|
20086
|
+
|
|
19698
20087
|
const StudioConfigContext = createContext({
|
|
19699
20088
|
baseUrl: "",
|
|
19700
20089
|
headers: {},
|
|
@@ -19706,13 +20095,16 @@ const useStudioConfig = () => {
|
|
|
19706
20095
|
return useContext(StudioConfigContext);
|
|
19707
20096
|
};
|
|
19708
20097
|
const LOCAL_STORAGE_KEY = "mastra-studio-config";
|
|
19709
|
-
const StudioConfigProvider = ({ children }) => {
|
|
20098
|
+
const StudioConfigProvider = ({ children, endpoint = "http://localhost:4111" }) => {
|
|
20099
|
+
const { data: instanceStatus } = useMastraInstanceStatus(endpoint);
|
|
19710
20100
|
const [config, setConfig] = useState({
|
|
19711
20101
|
baseUrl: "",
|
|
19712
20102
|
headers: {},
|
|
19713
20103
|
isLoading: true
|
|
19714
20104
|
});
|
|
20105
|
+
console.log("instanceStatus", instanceStatus);
|
|
19715
20106
|
useLayoutEffect(() => {
|
|
20107
|
+
if (!instanceStatus?.status) return;
|
|
19716
20108
|
const storedConfig = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
19717
20109
|
if (storedConfig) {
|
|
19718
20110
|
const parsedConfig = JSON.parse(storedConfig);
|
|
@@ -19720,8 +20112,11 @@ const StudioConfigProvider = ({ children }) => {
|
|
|
19720
20112
|
return setConfig({ ...parsedConfig, isLoading: false });
|
|
19721
20113
|
}
|
|
19722
20114
|
}
|
|
20115
|
+
if (instanceStatus.status === "active") {
|
|
20116
|
+
return setConfig((prev) => ({ ...prev, baseUrl: endpoint, isLoading: false }));
|
|
20117
|
+
}
|
|
19723
20118
|
return setConfig({ baseUrl: "", headers: {}, isLoading: false });
|
|
19724
|
-
}, []);
|
|
20119
|
+
}, [instanceStatus, endpoint]);
|
|
19725
20120
|
const doSetConfig = (partialNewConfig) => {
|
|
19726
20121
|
setConfig((prev) => {
|
|
19727
20122
|
const nextConfig = { ...prev, ...partialNewConfig };
|
|
@@ -19803,13 +20198,14 @@ const StudioConfigForm = ({ initialConfig }) => {
|
|
|
19803
20198
|
const handleSubmit = (e) => {
|
|
19804
20199
|
e.preventDefault();
|
|
19805
20200
|
const formData = new FormData(e.target);
|
|
20201
|
+
const url = formData.get("url");
|
|
19806
20202
|
const formHeaders = {};
|
|
19807
20203
|
for (let i = 0; i < headers.length; i++) {
|
|
19808
20204
|
const headerName = formData.get(`headers.${i}.name`);
|
|
19809
20205
|
const headerValue = formData.get(`headers.${i}.value`);
|
|
19810
20206
|
formHeaders[headerName] = headerValue;
|
|
19811
20207
|
}
|
|
19812
|
-
setConfig({ headers: formHeaders });
|
|
20208
|
+
setConfig({ headers: formHeaders, baseUrl: url });
|
|
19813
20209
|
toast$1.success("Configuration saved");
|
|
19814
20210
|
};
|
|
19815
20211
|
const handleAddHeader = (header) => {
|
|
@@ -19819,6 +20215,16 @@ const StudioConfigForm = ({ initialConfig }) => {
|
|
|
19819
20215
|
setHeaders((prev) => prev.filter((_, i) => i !== index));
|
|
19820
20216
|
};
|
|
19821
20217
|
return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
20218
|
+
/* @__PURE__ */ jsx(
|
|
20219
|
+
InputField,
|
|
20220
|
+
{
|
|
20221
|
+
name: "url",
|
|
20222
|
+
label: "Mastra instance URL",
|
|
20223
|
+
placeholder: "e.g: http://localhost:4111",
|
|
20224
|
+
required: true,
|
|
20225
|
+
defaultValue: initialConfig?.baseUrl
|
|
20226
|
+
}
|
|
20227
|
+
),
|
|
19822
20228
|
/* @__PURE__ */ jsx(HeaderListForm, { headers, onAddHeader: handleAddHeader, onRemoveHeader: handleRemoveHeader }),
|
|
19823
20229
|
/* @__PURE__ */ jsxs(Button$1, { type: "submit", variant: "light", className: "w-full", size: "lg", children: [
|
|
19824
20230
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Link2, {}) }),
|
|
@@ -19827,5 +20233,12 @@ const StudioConfigForm = ({ initialConfig }) => {
|
|
|
19827
20233
|
] });
|
|
19828
20234
|
};
|
|
19829
20235
|
|
|
19830
|
-
|
|
20236
|
+
const PlaygroundConfigGuard = () => {
|
|
20237
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col h-screen w-full items-center justify-center bg-surface1", children: /* @__PURE__ */ jsxs("div", { className: "max-w-md w-full mx-auto px-4 pt-4", children: [
|
|
20238
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center pb-4", children: /* @__PURE__ */ jsx(LogoWithoutText, { className: "size-32" }) }),
|
|
20239
|
+
/* @__PURE__ */ jsx(StudioConfigForm, {})
|
|
20240
|
+
] }) });
|
|
20241
|
+
};
|
|
20242
|
+
|
|
20243
|
+
export { AgentChat, AgentCoinIcon, AgentCombobox, AgentEntityHeader, AgentIcon, AgentInformation, AgentInformationLayout, AgentInformationTabLayout, AgentMemory, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentPromptExperimentProvider, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentToolPanel, AgentsTable, AiIcon, Alert$1 as Alert, AlertDescription$1 as AlertDescription, AlertDialog, AlertTitle$1 as AlertTitle, ApiIcon, Badge, BranchIcon, Breadcrumb, Button$1 as Button, ButtonsGroup, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, CommitIcon, CrossIcon, Crumb, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityName, Entry, EntryCell, EntryList, EntryListSkeleton, EnvIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LinkComponentProvider, LogoWithoutText, LogsIcon, MCPDetail, MCPServerCombobox, MCPTable, MCPToolPanel, MainContentContent, MainContentLayout, MainSidebar, MainSidebarProvider, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, Notification, OpenAIIcon, PageHeader, PlaygroundConfigGuard, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupItem, RepoIcon, RequestContext, RequestContextWrapper, Row, ScoreDialog, ScorerCombobox, ScorersTable, ScoresList, ScoresTools, SearchField, Searchbar, SearchbarWrapper, Section, Sections, SelectField, SettingsIcon, SideDialog, Skeleton, SlashIcon, SpanScoreList, SpanScoring, SpanTabs, StudioConfigContext, StudioConfigForm, StudioConfigProvider, Tab$1 as Tab, TabContent$1 as TabContent, TabList$1 as TabList, Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, Th, Thead, ThreadDeleteButton, ThreadInputProvider, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolCombobox, ToolFallback, ToolIconMap, ToolInformation, ToolPanel, ToolTable, ToolsIcon, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineSpan, TraceTimelineTools, TracesList, TracesTools, TracingSettingsContext, TracingSettingsProvider, TsIcon, Txt, TxtCell, VariablesIcon, WorkflowCoinIcon, WorkflowCombobox, WorkflowGraph, WorkflowIcon, WorkflowInformation, WorkflowRunContext, WorkflowRunDetail, WorkflowRunList, WorkflowRunProvider, WorkflowTable, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, convertWorkflowRunStateToStreamResult, extractPrompt, formatHierarchicalSpans, getColumnTemplate, getShortId, getSpanTypeUi, getToNextEntryFn, getToPreviousEntryFn, parseError, providerMapToIcon, scoresListColumns, spanTypePrefixes, toast, traceScoresListColumns, tracesListColumns, useAgent, useAgentInformationSettings, useAgentInformationTab, useAgentPromptExperiment, useAgentSettings, useAgents, useCancelWorkflowRun, useCurrentRun, useDeleteThread, useExecuteAgentTool, useExecuteMCPTool, useExecuteTool, useExecuteWorkflow, useInView, useLinkComponent, useMCPServerTool, useMCPServerTools, useMCPServers, useMainSidebar, useMemory, useMemoryConfig, useMemorySearch, usePlaygroundStore, useReorderModelList, useResetAgentModel, useScorer, useScorers, useScoresByScorerId, useSpeechRecognition, useStreamWorkflow, useStudioConfig, useThreadInput, useThreads, useTool, useTools, useTraceSpanScores, useTracingSettings, useUpdateAgentModel, useUpdateModelInModelList, useWorkflow, useWorkflowRunExecutionResult, useWorkflowRuns, useWorkflows, useWorkingMemory };
|
|
19831
20244
|
//# sourceMappingURL=index.es.js.map
|