@agentmark-ai/ui-components 0.1.0 → 0.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/dist/index.d.mts +381 -2
- package/dist/index.d.ts +381 -2
- package/dist/index.js +1911 -286
- package/dist/index.mjs +1813 -200
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -206,7 +206,7 @@ var require_react_is_development = __commonJS({
|
|
|
206
206
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
207
207
|
var Element = REACT_ELEMENT_TYPE;
|
|
208
208
|
var ForwardRef2 = REACT_FORWARD_REF_TYPE;
|
|
209
|
-
var
|
|
209
|
+
var Fragment5 = REACT_FRAGMENT_TYPE;
|
|
210
210
|
var Lazy = REACT_LAZY_TYPE;
|
|
211
211
|
var Memo2 = REACT_MEMO_TYPE;
|
|
212
212
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -265,7 +265,7 @@ var require_react_is_development = __commonJS({
|
|
|
265
265
|
exports.ContextProvider = ContextProvider;
|
|
266
266
|
exports.Element = Element;
|
|
267
267
|
exports.ForwardRef = ForwardRef2;
|
|
268
|
-
exports.Fragment =
|
|
268
|
+
exports.Fragment = Fragment5;
|
|
269
269
|
exports.Lazy = Lazy;
|
|
270
270
|
exports.Memo = Memo2;
|
|
271
271
|
exports.Portal = Portal;
|
|
@@ -3510,7 +3510,7 @@ function createBox(options = {}) {
|
|
|
3510
3510
|
const BoxRoot = styled2("div", {
|
|
3511
3511
|
shouldForwardProp: (prop) => prop !== "theme" && prop !== "sx" && prop !== "as"
|
|
3512
3512
|
})(styleFunctionSx_default);
|
|
3513
|
-
const
|
|
3513
|
+
const Box29 = /* @__PURE__ */ React3.forwardRef(function Box30(inProps, ref) {
|
|
3514
3514
|
const theme2 = useTheme_default(defaultTheme2);
|
|
3515
3515
|
const {
|
|
3516
3516
|
className,
|
|
@@ -3525,7 +3525,7 @@ function createBox(options = {}) {
|
|
|
3525
3525
|
...other
|
|
3526
3526
|
});
|
|
3527
3527
|
});
|
|
3528
|
-
return
|
|
3528
|
+
return Box29;
|
|
3529
3529
|
}
|
|
3530
3530
|
|
|
3531
3531
|
// ../../node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js
|
|
@@ -3589,29 +3589,29 @@ var Box_default = Box7;
|
|
|
3589
3589
|
|
|
3590
3590
|
// ../../node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js
|
|
3591
3591
|
var import_react_is2 = __toESM(require_react_is2(), 1);
|
|
3592
|
-
function getFunctionComponentName(
|
|
3593
|
-
return
|
|
3592
|
+
function getFunctionComponentName(Component2, fallback = "") {
|
|
3593
|
+
return Component2.displayName || Component2.name || fallback;
|
|
3594
3594
|
}
|
|
3595
3595
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
3596
3596
|
const functionName = getFunctionComponentName(innerType);
|
|
3597
3597
|
return outerType.displayName || (functionName !== "" ? `${wrapperName}(${functionName})` : wrapperName);
|
|
3598
3598
|
}
|
|
3599
|
-
function getDisplayName(
|
|
3600
|
-
if (
|
|
3599
|
+
function getDisplayName(Component2) {
|
|
3600
|
+
if (Component2 == null) {
|
|
3601
3601
|
return void 0;
|
|
3602
3602
|
}
|
|
3603
|
-
if (typeof
|
|
3604
|
-
return
|
|
3603
|
+
if (typeof Component2 === "string") {
|
|
3604
|
+
return Component2;
|
|
3605
3605
|
}
|
|
3606
|
-
if (typeof
|
|
3607
|
-
return getFunctionComponentName(
|
|
3606
|
+
if (typeof Component2 === "function") {
|
|
3607
|
+
return getFunctionComponentName(Component2, "Component");
|
|
3608
3608
|
}
|
|
3609
|
-
if (typeof
|
|
3610
|
-
switch (
|
|
3609
|
+
if (typeof Component2 === "object") {
|
|
3610
|
+
switch (Component2.$$typeof) {
|
|
3611
3611
|
case import_react_is2.ForwardRef:
|
|
3612
|
-
return getWrappedName(
|
|
3612
|
+
return getWrappedName(Component2, Component2.render, "ForwardRef");
|
|
3613
3613
|
case import_react_is2.Memo:
|
|
3614
|
-
return getWrappedName(
|
|
3614
|
+
return getWrappedName(Component2, Component2.type, "memo");
|
|
3615
3615
|
default:
|
|
3616
3616
|
return void 0;
|
|
3617
3617
|
}
|
|
@@ -3825,14 +3825,14 @@ function createStyled(input = {}) {
|
|
|
3825
3825
|
expressionsHead.unshift(outputStrings);
|
|
3826
3826
|
}
|
|
3827
3827
|
const expressions = [...expressionsHead, ...expressionsBody, ...expressionsTail];
|
|
3828
|
-
const
|
|
3828
|
+
const Component2 = defaultStyledResolver(...expressions);
|
|
3829
3829
|
if (tag.muiName) {
|
|
3830
|
-
|
|
3830
|
+
Component2.muiName = tag.muiName;
|
|
3831
3831
|
}
|
|
3832
3832
|
if (process.env.NODE_ENV !== "production") {
|
|
3833
|
-
|
|
3833
|
+
Component2.displayName = generateDisplayName(componentName, componentSlot, tag);
|
|
3834
3834
|
}
|
|
3835
|
-
return
|
|
3835
|
+
return Component2;
|
|
3836
3836
|
};
|
|
3837
3837
|
if (defaultStyledResolver.withConfig) {
|
|
3838
3838
|
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
|
@@ -4096,7 +4096,7 @@ function createStack(options = {}) {
|
|
|
4096
4096
|
return composeClasses(slots, (slot) => generateUtilityClass(componentName, slot), {});
|
|
4097
4097
|
};
|
|
4098
4098
|
const StackRoot = createStyledComponent(style3);
|
|
4099
|
-
const
|
|
4099
|
+
const Stack14 = /* @__PURE__ */ React4.forwardRef(function Grid(inProps, ref) {
|
|
4100
4100
|
const themeProps = useThemeProps2(inProps);
|
|
4101
4101
|
const props = extendSxProp(themeProps);
|
|
4102
4102
|
const {
|
|
@@ -4124,14 +4124,14 @@ function createStack(options = {}) {
|
|
|
4124
4124
|
children: divider ? joinChildren(children, divider) : children
|
|
4125
4125
|
});
|
|
4126
4126
|
});
|
|
4127
|
-
process.env.NODE_ENV !== "production" ?
|
|
4127
|
+
process.env.NODE_ENV !== "production" ? Stack14.propTypes = {
|
|
4128
4128
|
children: import_prop_types3.default.node,
|
|
4129
4129
|
direction: import_prop_types3.default.oneOfType([import_prop_types3.default.oneOf(["column-reverse", "column", "row-reverse", "row"]), import_prop_types3.default.arrayOf(import_prop_types3.default.oneOf(["column-reverse", "column", "row-reverse", "row"])), import_prop_types3.default.object]),
|
|
4130
4130
|
divider: import_prop_types3.default.node,
|
|
4131
4131
|
spacing: import_prop_types3.default.oneOfType([import_prop_types3.default.arrayOf(import_prop_types3.default.oneOfType([import_prop_types3.default.number, import_prop_types3.default.string])), import_prop_types3.default.number, import_prop_types3.default.object, import_prop_types3.default.string]),
|
|
4132
4132
|
sx: import_prop_types3.default.oneOfType([import_prop_types3.default.arrayOf(import_prop_types3.default.oneOfType([import_prop_types3.default.func, import_prop_types3.default.object, import_prop_types3.default.bool])), import_prop_types3.default.func, import_prop_types3.default.object])
|
|
4133
4133
|
} : void 0;
|
|
4134
|
-
return
|
|
4134
|
+
return Stack14;
|
|
4135
4135
|
}
|
|
4136
4136
|
|
|
4137
4137
|
// ../../node_modules/@mui/system/esm/Stack/Stack.js
|
|
@@ -19924,7 +19924,7 @@ var TraceDrawerCloseButton = ({
|
|
|
19924
19924
|
return /* @__PURE__ */ jsx26(IconButton, { onClick: onClose, size: "small", children: /* @__PURE__ */ jsx26(Iconify, { icon: "eva:close-fill" }) });
|
|
19925
19925
|
};
|
|
19926
19926
|
var TraceDrawerHeader = ({ children }) => {
|
|
19927
|
-
return /* @__PURE__ */ jsx26(Box9, { p: 2, children });
|
|
19927
|
+
return /* @__PURE__ */ jsx26(Box9, { p: 2, sx: { flexShrink: 0, borderBottom: 1, borderColor: "divider" }, children });
|
|
19928
19928
|
};
|
|
19929
19929
|
|
|
19930
19930
|
// src/sections/traces/trace-drawer/trace-drawer-main.tsx
|
|
@@ -20047,22 +20047,33 @@ var TraceInfoSkeleton = () => /* @__PURE__ */ jsxs16(
|
|
|
20047
20047
|
);
|
|
20048
20048
|
|
|
20049
20049
|
// src/sections/traces/trace-drawer/trace-drawer-container.tsx
|
|
20050
|
-
import {
|
|
20050
|
+
import { Box as Box12 } from "@mui/material";
|
|
20051
20051
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
20052
20052
|
var TraceDrawerContainer = ({
|
|
20053
20053
|
children
|
|
20054
20054
|
}) => {
|
|
20055
|
-
return /* @__PURE__ */ jsx30(
|
|
20055
|
+
return /* @__PURE__ */ jsx30(
|
|
20056
|
+
Box12,
|
|
20057
|
+
{
|
|
20058
|
+
sx: {
|
|
20059
|
+
height: "100%",
|
|
20060
|
+
display: "flex",
|
|
20061
|
+
flexDirection: "column",
|
|
20062
|
+
overflow: "hidden"
|
|
20063
|
+
},
|
|
20064
|
+
children
|
|
20065
|
+
}
|
|
20066
|
+
);
|
|
20056
20067
|
};
|
|
20057
20068
|
|
|
20058
20069
|
// src/sections/traces/trace-drawer/trace-tree/trace-tree.tsx
|
|
20059
20070
|
import { SimpleTreeView } from "@mui/x-tree-view";
|
|
20060
|
-
import { Box as
|
|
20071
|
+
import { Box as Box15, Stack as Stack9 } from "@mui/material";
|
|
20061
20072
|
|
|
20062
20073
|
// src/sections/traces/trace-drawer/trace-tree/trace-tree-item.tsx
|
|
20063
20074
|
import * as React6 from "react";
|
|
20064
20075
|
import { styled as styled4, useTheme as useTheme4, alpha as alpha3 } from "@mui/material/styles";
|
|
20065
|
-
import
|
|
20076
|
+
import Box13 from "@mui/material/Box";
|
|
20066
20077
|
import Typography6 from "@mui/material/Typography";
|
|
20067
20078
|
import {
|
|
20068
20079
|
TreeItemContent,
|
|
@@ -20161,7 +20172,7 @@ var TraceTreeItem = React6.forwardRef(function TraceTreeItem2({ hasChildren, ...
|
|
|
20161
20172
|
})
|
|
20162
20173
|
}),
|
|
20163
20174
|
children: /* @__PURE__ */ jsxs17(
|
|
20164
|
-
|
|
20175
|
+
Box13,
|
|
20165
20176
|
{
|
|
20166
20177
|
sx: {
|
|
20167
20178
|
display: "flex",
|
|
@@ -20172,7 +20183,7 @@ var TraceTreeItem = React6.forwardRef(function TraceTreeItem2({ hasChildren, ...
|
|
|
20172
20183
|
},
|
|
20173
20184
|
children: [
|
|
20174
20185
|
/* @__PURE__ */ jsx31(
|
|
20175
|
-
|
|
20186
|
+
Box13,
|
|
20176
20187
|
{
|
|
20177
20188
|
component: LabelIcon,
|
|
20178
20189
|
color: "inherit",
|
|
@@ -20216,7 +20227,7 @@ var TraceTreeItem = React6.forwardRef(function TraceTreeItem2({ hasChildren, ...
|
|
|
20216
20227
|
});
|
|
20217
20228
|
|
|
20218
20229
|
// src/sections/traces/trace-drawer/trace-tree/trace-label.tsx
|
|
20219
|
-
import { Stack as
|
|
20230
|
+
import { Stack as Stack8, Typography as Typography7, Box as Box14, Tooltip } from "@mui/material";
|
|
20220
20231
|
import { useTheme as useTheme5 } from "@mui/material/styles";
|
|
20221
20232
|
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
20222
20233
|
var TraceLabel = ({
|
|
@@ -20228,8 +20239,8 @@ var TraceLabel = ({
|
|
|
20228
20239
|
}) => {
|
|
20229
20240
|
const theme2 = useTheme5();
|
|
20230
20241
|
const { t } = useTraceDrawerContext();
|
|
20231
|
-
return /* @__PURE__ */ jsxs18(
|
|
20232
|
-
/* @__PURE__ */ jsxs18(
|
|
20242
|
+
return /* @__PURE__ */ jsxs18(Stack8, { spacing: 0.3, children: [
|
|
20243
|
+
/* @__PURE__ */ jsxs18(Stack8, { direction: "row", alignItems: "center", spacing: 1, children: [
|
|
20233
20244
|
/* @__PURE__ */ jsx32(
|
|
20234
20245
|
Typography7,
|
|
20235
20246
|
{
|
|
@@ -20238,7 +20249,7 @@ var TraceLabel = ({
|
|
|
20238
20249
|
children: label
|
|
20239
20250
|
}
|
|
20240
20251
|
),
|
|
20241
|
-
/* @__PURE__ */ jsx32(
|
|
20252
|
+
/* @__PURE__ */ jsx32(Box14, { minWidth: 16, maxHeight: 16, children: /* @__PURE__ */ jsx32(
|
|
20242
20253
|
Iconify,
|
|
20243
20254
|
{
|
|
20244
20255
|
width: 16,
|
|
@@ -20247,7 +20258,7 @@ var TraceLabel = ({
|
|
|
20247
20258
|
}
|
|
20248
20259
|
) })
|
|
20249
20260
|
] }),
|
|
20250
|
-
/* @__PURE__ */ jsxs18(
|
|
20261
|
+
/* @__PURE__ */ jsxs18(Stack8, { direction: "row", spacing: 0.5, flexWrap: "wrap", children: [
|
|
20251
20262
|
/* @__PURE__ */ jsx32(Tooltip, { title: t("latency"), children: /* @__PURE__ */ jsxs18(
|
|
20252
20263
|
label_default,
|
|
20253
20264
|
{
|
|
@@ -20281,7 +20292,7 @@ var renderTree = (node, findCostAndTokens) => {
|
|
|
20281
20292
|
return null;
|
|
20282
20293
|
}
|
|
20283
20294
|
const { cost, tokens } = findCostAndTokens(node);
|
|
20284
|
-
return /* @__PURE__ */ jsx33(
|
|
20295
|
+
return /* @__PURE__ */ jsx33(Stack9, { children: /* @__PURE__ */ jsx33(
|
|
20285
20296
|
TraceTreeItem,
|
|
20286
20297
|
{
|
|
20287
20298
|
itemId: node.id,
|
|
@@ -20310,13 +20321,12 @@ var TraceTree = () => {
|
|
|
20310
20321
|
setSelectedSpanId,
|
|
20311
20322
|
traces,
|
|
20312
20323
|
findCostAndTokens,
|
|
20313
|
-
traceId
|
|
20314
|
-
treeHeight
|
|
20324
|
+
traceId
|
|
20315
20325
|
} = useTraceDrawerContext();
|
|
20316
20326
|
const tree = useMemo3(() => {
|
|
20317
20327
|
return spanTree.map((node) => renderTree(node, findCostAndTokens));
|
|
20318
20328
|
}, [spanTree]);
|
|
20319
|
-
return /* @__PURE__ */ jsx33(
|
|
20329
|
+
return /* @__PURE__ */ jsx33(Box15, { sx: { height: "100%", overflowY: "auto", p: 2 }, children: selectedSpan?.id && /* @__PURE__ */ jsx33(
|
|
20320
20330
|
SimpleTreeView,
|
|
20321
20331
|
{
|
|
20322
20332
|
expansionTrigger: "iconContainer",
|
|
@@ -20338,7 +20348,7 @@ var TraceTree = () => {
|
|
|
20338
20348
|
};
|
|
20339
20349
|
|
|
20340
20350
|
// src/sections/traces/trace-drawer/trace-graph/trace-graph-canvas.tsx
|
|
20341
|
-
import { Box as
|
|
20351
|
+
import { Box as Box17, CircularProgress, useTheme as useTheme8 } from "@mui/material";
|
|
20342
20352
|
import { useCallback as useCallback3, useEffect as useEffect3, useState as useState5, useMemo as useMemo6 } from "react";
|
|
20343
20353
|
|
|
20344
20354
|
// src/sections/traces/trace-drawer/trace-graph/use-trace-graph.ts
|
|
@@ -20638,7 +20648,7 @@ import {
|
|
|
20638
20648
|
// src/sections/traces/trace-drawer/trace-graph/trace-node.tsx
|
|
20639
20649
|
import { memo } from "react";
|
|
20640
20650
|
import { Handle, Position } from "@xyflow/react";
|
|
20641
|
-
import { Box as
|
|
20651
|
+
import { Box as Box16, Typography as Typography8, useTheme as useTheme6 } from "@mui/material";
|
|
20642
20652
|
import { Fragment as Fragment2, jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
20643
20653
|
function TraceNodeComponent(props) {
|
|
20644
20654
|
const { id, data } = props;
|
|
@@ -20667,7 +20677,7 @@ function TraceNodeComponent(props) {
|
|
|
20667
20677
|
}
|
|
20668
20678
|
),
|
|
20669
20679
|
/* @__PURE__ */ jsx34(
|
|
20670
|
-
|
|
20680
|
+
Box16,
|
|
20671
20681
|
{
|
|
20672
20682
|
sx: {
|
|
20673
20683
|
width: 40,
|
|
@@ -20711,7 +20721,7 @@ function TraceNodeComponent(props) {
|
|
|
20711
20721
|
}
|
|
20712
20722
|
),
|
|
20713
20723
|
/* @__PURE__ */ jsxs19(
|
|
20714
|
-
|
|
20724
|
+
Box16,
|
|
20715
20725
|
{
|
|
20716
20726
|
sx: {
|
|
20717
20727
|
minWidth: 120,
|
|
@@ -20743,7 +20753,7 @@ function TraceNodeComponent(props) {
|
|
|
20743
20753
|
style: { flexShrink: 0 }
|
|
20744
20754
|
}
|
|
20745
20755
|
),
|
|
20746
|
-
/* @__PURE__ */ jsxs19(
|
|
20756
|
+
/* @__PURE__ */ jsxs19(Box16, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
20747
20757
|
/* @__PURE__ */ jsx34(
|
|
20748
20758
|
Typography8,
|
|
20749
20759
|
{
|
|
@@ -20989,7 +20999,7 @@ function TraceGraphCanvas({
|
|
|
20989
20999
|
}, [focusedNodeIndex, nodes.length]);
|
|
20990
21000
|
if (isLoading) {
|
|
20991
21001
|
return /* @__PURE__ */ jsx35(
|
|
20992
|
-
|
|
21002
|
+
Box17,
|
|
20993
21003
|
{
|
|
20994
21004
|
sx: {
|
|
20995
21005
|
display: "flex",
|
|
@@ -21003,7 +21013,7 @@ function TraceGraphCanvas({
|
|
|
21003
21013
|
}
|
|
21004
21014
|
if (!nodes.length) {
|
|
21005
21015
|
return /* @__PURE__ */ jsx35(
|
|
21006
|
-
|
|
21016
|
+
Box17,
|
|
21007
21017
|
{
|
|
21008
21018
|
sx: {
|
|
21009
21019
|
display: "flex",
|
|
@@ -21017,7 +21027,7 @@ function TraceGraphCanvas({
|
|
|
21017
21027
|
);
|
|
21018
21028
|
}
|
|
21019
21029
|
return /* @__PURE__ */ jsx35(
|
|
21020
|
-
|
|
21030
|
+
Box17,
|
|
21021
21031
|
{
|
|
21022
21032
|
sx: {
|
|
21023
21033
|
flexGrow: 1,
|
|
@@ -21030,7 +21040,7 @@ function TraceGraphCanvas({
|
|
|
21030
21040
|
minHeight: 0
|
|
21031
21041
|
},
|
|
21032
21042
|
children: /* @__PURE__ */ jsx35(
|
|
21033
|
-
|
|
21043
|
+
Box17,
|
|
21034
21044
|
{
|
|
21035
21045
|
sx: { width: "100%", height: "100%" },
|
|
21036
21046
|
tabIndex: 0,
|
|
@@ -21095,31 +21105,1622 @@ function TraceGraphCanvas({
|
|
|
21095
21105
|
);
|
|
21096
21106
|
}
|
|
21097
21107
|
|
|
21108
|
+
// src/sections/traces/trace-drawer/trace-timeline/timeline-types.ts
|
|
21109
|
+
var TIMELINE_CONSTANTS = {
|
|
21110
|
+
/** Height of each span row in pixels */
|
|
21111
|
+
ROW_HEIGHT: 28,
|
|
21112
|
+
/** Minimum bar width in pixels (for very short spans) */
|
|
21113
|
+
MIN_BAR_WIDTH: 4,
|
|
21114
|
+
/** Indentation per depth level in pixels */
|
|
21115
|
+
DEPTH_INDENT: 16,
|
|
21116
|
+
/** Bar height as ratio of row height */
|
|
21117
|
+
BAR_HEIGHT_RATIO: 0.7,
|
|
21118
|
+
/** Minimum zoom scale */
|
|
21119
|
+
MIN_SCALE: 0.5,
|
|
21120
|
+
/** Maximum zoom scale */
|
|
21121
|
+
MAX_SCALE: 10,
|
|
21122
|
+
/** Height of the time ruler in pixels */
|
|
21123
|
+
RULER_HEIGHT: 24,
|
|
21124
|
+
/** Padding around the timeline content */
|
|
21125
|
+
PADDING: 8,
|
|
21126
|
+
/** Label area width for span names */
|
|
21127
|
+
LABEL_WIDTH: 120
|
|
21128
|
+
};
|
|
21129
|
+
|
|
21130
|
+
// src/sections/traces/trace-drawer/trace-timeline/compute-timeline-layout.ts
|
|
21131
|
+
function formatDuration(ms) {
|
|
21132
|
+
if (ms < 1e3) {
|
|
21133
|
+
return `${Math.round(ms)}ms`;
|
|
21134
|
+
}
|
|
21135
|
+
if (ms < 6e4) {
|
|
21136
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
21137
|
+
}
|
|
21138
|
+
const minutes = Math.floor(ms / 6e4);
|
|
21139
|
+
const seconds = Math.round(ms % 6e4 / 1e3);
|
|
21140
|
+
return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
21141
|
+
}
|
|
21142
|
+
function calculateTickIntervals(totalMs) {
|
|
21143
|
+
const targetMajorTicks = 6;
|
|
21144
|
+
const idealInterval = totalMs / targetMajorTicks;
|
|
21145
|
+
const niceIntervals = [
|
|
21146
|
+
1,
|
|
21147
|
+
2,
|
|
21148
|
+
5,
|
|
21149
|
+
10,
|
|
21150
|
+
20,
|
|
21151
|
+
50,
|
|
21152
|
+
100,
|
|
21153
|
+
200,
|
|
21154
|
+
500,
|
|
21155
|
+
1e3,
|
|
21156
|
+
2e3,
|
|
21157
|
+
5e3,
|
|
21158
|
+
1e4,
|
|
21159
|
+
2e4,
|
|
21160
|
+
3e4,
|
|
21161
|
+
6e4,
|
|
21162
|
+
12e4,
|
|
21163
|
+
3e5,
|
|
21164
|
+
6e5
|
|
21165
|
+
];
|
|
21166
|
+
let major = niceIntervals[0];
|
|
21167
|
+
for (const interval of niceIntervals) {
|
|
21168
|
+
if (interval >= idealInterval) {
|
|
21169
|
+
major = interval;
|
|
21170
|
+
break;
|
|
21171
|
+
}
|
|
21172
|
+
major = interval;
|
|
21173
|
+
}
|
|
21174
|
+
const minor = major / 5;
|
|
21175
|
+
return { major, minor };
|
|
21176
|
+
}
|
|
21177
|
+
function hasErrorStatus(span) {
|
|
21178
|
+
const status = span.data?.status?.toLowerCase();
|
|
21179
|
+
return status === "error" || status === "failed" || status === "failure";
|
|
21180
|
+
}
|
|
21181
|
+
function buildSpanLookup(spans) {
|
|
21182
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
21183
|
+
for (const span of spans) {
|
|
21184
|
+
lookup.set(span.id, span);
|
|
21185
|
+
}
|
|
21186
|
+
return lookup;
|
|
21187
|
+
}
|
|
21188
|
+
function buildChildrenMap(spans) {
|
|
21189
|
+
const childrenMap = /* @__PURE__ */ new Map();
|
|
21190
|
+
for (const span of spans) {
|
|
21191
|
+
const parentId = span.parentId;
|
|
21192
|
+
const children = childrenMap.get(parentId) || [];
|
|
21193
|
+
children.push(span);
|
|
21194
|
+
childrenMap.set(parentId, children);
|
|
21195
|
+
}
|
|
21196
|
+
for (const [, children] of childrenMap) {
|
|
21197
|
+
children.sort((a, b) => a.timestamp - b.timestamp);
|
|
21198
|
+
}
|
|
21199
|
+
return childrenMap;
|
|
21200
|
+
}
|
|
21201
|
+
function spanHasChildren(spanId, childrenMap) {
|
|
21202
|
+
const children = childrenMap.get(spanId);
|
|
21203
|
+
return children !== void 0 && children.length > 0;
|
|
21204
|
+
}
|
|
21205
|
+
function sanitizeSpan(span) {
|
|
21206
|
+
if (!span || typeof span.id !== "string" || !span.id) {
|
|
21207
|
+
return null;
|
|
21208
|
+
}
|
|
21209
|
+
const timestamp = typeof span.timestamp === "number" && Number.isFinite(span.timestamp) ? span.timestamp : Date.now();
|
|
21210
|
+
const duration = typeof span.duration === "number" && Number.isFinite(span.duration) && span.duration >= 0 ? span.duration : 0;
|
|
21211
|
+
const name = typeof span.name === "string" ? span.name : String(span.id);
|
|
21212
|
+
return {
|
|
21213
|
+
...span,
|
|
21214
|
+
timestamp,
|
|
21215
|
+
duration,
|
|
21216
|
+
name
|
|
21217
|
+
};
|
|
21218
|
+
}
|
|
21219
|
+
function computeTimelineLayout(spans) {
|
|
21220
|
+
if (!Array.isArray(spans) || spans.length === 0) {
|
|
21221
|
+
return {
|
|
21222
|
+
layouts: [],
|
|
21223
|
+
metrics: {
|
|
21224
|
+
totalDurationMs: 0,
|
|
21225
|
+
startTimeMs: 0,
|
|
21226
|
+
endTimeMs: 0,
|
|
21227
|
+
spanCount: 0,
|
|
21228
|
+
maxDepth: 0,
|
|
21229
|
+
typeBreakdown: {}
|
|
21230
|
+
},
|
|
21231
|
+
rulerTicks: []
|
|
21232
|
+
};
|
|
21233
|
+
}
|
|
21234
|
+
const sanitizedSpans = spans.map(sanitizeSpan).filter((span) => span !== null);
|
|
21235
|
+
if (sanitizedSpans.length === 0) {
|
|
21236
|
+
return {
|
|
21237
|
+
layouts: [],
|
|
21238
|
+
metrics: {
|
|
21239
|
+
totalDurationMs: 0,
|
|
21240
|
+
startTimeMs: 0,
|
|
21241
|
+
endTimeMs: 0,
|
|
21242
|
+
spanCount: 0,
|
|
21243
|
+
maxDepth: 0,
|
|
21244
|
+
typeBreakdown: {}
|
|
21245
|
+
},
|
|
21246
|
+
rulerTicks: []
|
|
21247
|
+
};
|
|
21248
|
+
}
|
|
21249
|
+
const spanLookup = buildSpanLookup(sanitizedSpans);
|
|
21250
|
+
const childrenMap = buildChildrenMap(sanitizedSpans);
|
|
21251
|
+
let minTimestamp = Infinity;
|
|
21252
|
+
let maxEndTime = -Infinity;
|
|
21253
|
+
for (const span of sanitizedSpans) {
|
|
21254
|
+
const startTime = span.timestamp;
|
|
21255
|
+
const endTime = span.timestamp + Math.max(0, span.duration);
|
|
21256
|
+
if (startTime < minTimestamp) {
|
|
21257
|
+
minTimestamp = startTime;
|
|
21258
|
+
}
|
|
21259
|
+
if (endTime > maxEndTime) {
|
|
21260
|
+
maxEndTime = endTime;
|
|
21261
|
+
}
|
|
21262
|
+
}
|
|
21263
|
+
const totalDurationMs = maxEndTime - minTimestamp;
|
|
21264
|
+
const normalizeTime = (timestamp) => {
|
|
21265
|
+
if (totalDurationMs === 0) return 0;
|
|
21266
|
+
return (timestamp - minTimestamp) / totalDurationMs;
|
|
21267
|
+
};
|
|
21268
|
+
const normalizeDuration = (duration) => {
|
|
21269
|
+
if (totalDurationMs === 0) return 1;
|
|
21270
|
+
return Math.max(0, duration) / totalDurationMs;
|
|
21271
|
+
};
|
|
21272
|
+
const layouts = [];
|
|
21273
|
+
let rowIndex = 0;
|
|
21274
|
+
let maxDepth = 0;
|
|
21275
|
+
const typeBreakdown = {};
|
|
21276
|
+
function traverse(parentId, depth) {
|
|
21277
|
+
const children = childrenMap.get(parentId) || [];
|
|
21278
|
+
for (const span of children) {
|
|
21279
|
+
if (depth > maxDepth) {
|
|
21280
|
+
maxDepth = depth;
|
|
21281
|
+
}
|
|
21282
|
+
const hasChildren = spanHasChildren(span.id, childrenMap);
|
|
21283
|
+
const nodeType = inferNodeType(
|
|
21284
|
+
{
|
|
21285
|
+
spanId: span.id,
|
|
21286
|
+
parentSpanId: span.parentId,
|
|
21287
|
+
name: span.name,
|
|
21288
|
+
startTime: span.timestamp,
|
|
21289
|
+
type: span.data?.type,
|
|
21290
|
+
data: span.data
|
|
21291
|
+
},
|
|
21292
|
+
hasChildren
|
|
21293
|
+
);
|
|
21294
|
+
typeBreakdown[nodeType] = (typeBreakdown[nodeType] || 0) + 1;
|
|
21295
|
+
const startTimeMs = span.timestamp - minTimestamp;
|
|
21296
|
+
const durationMs = Math.max(0, span.duration);
|
|
21297
|
+
const percentOfTrace = totalDurationMs > 0 ? durationMs / totalDurationMs * 100 : 100;
|
|
21298
|
+
const layout = {
|
|
21299
|
+
spanId: span.id,
|
|
21300
|
+
name: span.name,
|
|
21301
|
+
x: normalizeTime(span.timestamp),
|
|
21302
|
+
width: normalizeDuration(durationMs),
|
|
21303
|
+
row: rowIndex,
|
|
21304
|
+
depth,
|
|
21305
|
+
durationMs,
|
|
21306
|
+
startTimeMs,
|
|
21307
|
+
percentOfTrace,
|
|
21308
|
+
nodeType,
|
|
21309
|
+
hasError: hasErrorStatus(span),
|
|
21310
|
+
span
|
|
21311
|
+
};
|
|
21312
|
+
layouts.push(layout);
|
|
21313
|
+
rowIndex++;
|
|
21314
|
+
traverse(span.id, depth + 1);
|
|
21315
|
+
}
|
|
21316
|
+
}
|
|
21317
|
+
traverse(void 0, 0);
|
|
21318
|
+
for (const span of sanitizedSpans) {
|
|
21319
|
+
if (span.parentId && !spanLookup.has(span.parentId)) {
|
|
21320
|
+
const hasChildren = spanHasChildren(span.id, childrenMap);
|
|
21321
|
+
const nodeType = inferNodeType(
|
|
21322
|
+
{
|
|
21323
|
+
spanId: span.id,
|
|
21324
|
+
parentSpanId: span.parentId,
|
|
21325
|
+
name: span.name,
|
|
21326
|
+
startTime: span.timestamp,
|
|
21327
|
+
type: span.data?.type,
|
|
21328
|
+
data: span.data
|
|
21329
|
+
},
|
|
21330
|
+
hasChildren
|
|
21331
|
+
);
|
|
21332
|
+
if (!layouts.find((l) => l.spanId === span.id)) {
|
|
21333
|
+
typeBreakdown[nodeType] = (typeBreakdown[nodeType] || 0) + 1;
|
|
21334
|
+
const startTimeMs = span.timestamp - minTimestamp;
|
|
21335
|
+
const durationMs = Math.max(0, span.duration);
|
|
21336
|
+
const percentOfTrace = totalDurationMs > 0 ? durationMs / totalDurationMs * 100 : 100;
|
|
21337
|
+
layouts.push({
|
|
21338
|
+
spanId: span.id,
|
|
21339
|
+
name: span.name,
|
|
21340
|
+
x: normalizeTime(span.timestamp),
|
|
21341
|
+
width: normalizeDuration(durationMs),
|
|
21342
|
+
row: rowIndex,
|
|
21343
|
+
depth: 0,
|
|
21344
|
+
// Treat as root since parent is missing
|
|
21345
|
+
durationMs,
|
|
21346
|
+
startTimeMs,
|
|
21347
|
+
percentOfTrace,
|
|
21348
|
+
nodeType,
|
|
21349
|
+
hasError: hasErrorStatus(span),
|
|
21350
|
+
span
|
|
21351
|
+
});
|
|
21352
|
+
rowIndex++;
|
|
21353
|
+
traverse(span.id, 1);
|
|
21354
|
+
}
|
|
21355
|
+
}
|
|
21356
|
+
}
|
|
21357
|
+
const { major, minor } = calculateTickIntervals(totalDurationMs);
|
|
21358
|
+
const rulerTicks = [];
|
|
21359
|
+
if (totalDurationMs > 0) {
|
|
21360
|
+
for (let time = 0; time <= totalDurationMs; time += minor) {
|
|
21361
|
+
const isMajor = time % major === 0;
|
|
21362
|
+
rulerTicks.push({
|
|
21363
|
+
position: time / totalDurationMs,
|
|
21364
|
+
label: isMajor ? formatDuration(time) : "",
|
|
21365
|
+
isMajor
|
|
21366
|
+
});
|
|
21367
|
+
}
|
|
21368
|
+
if (rulerTicks.length === 0 || rulerTicks[rulerTicks.length - 1].position < 1) {
|
|
21369
|
+
rulerTicks.push({
|
|
21370
|
+
position: 1,
|
|
21371
|
+
label: formatDuration(totalDurationMs),
|
|
21372
|
+
isMajor: true
|
|
21373
|
+
});
|
|
21374
|
+
}
|
|
21375
|
+
}
|
|
21376
|
+
const metrics = {
|
|
21377
|
+
totalDurationMs,
|
|
21378
|
+
startTimeMs: minTimestamp,
|
|
21379
|
+
endTimeMs: maxEndTime,
|
|
21380
|
+
spanCount: sanitizedSpans.length,
|
|
21381
|
+
maxDepth,
|
|
21382
|
+
typeBreakdown
|
|
21383
|
+
};
|
|
21384
|
+
return { layouts, metrics, rulerTicks };
|
|
21385
|
+
}
|
|
21386
|
+
|
|
21387
|
+
// src/sections/traces/trace-drawer/trace-timeline/use-timeline-layout.ts
|
|
21388
|
+
import { useMemo as useMemo7 } from "react";
|
|
21389
|
+
function useTimelineLayout(spans) {
|
|
21390
|
+
return useMemo7(() => computeTimelineLayout(spans), [spans]);
|
|
21391
|
+
}
|
|
21392
|
+
|
|
21393
|
+
// src/sections/traces/trace-drawer/trace-timeline/use-timeline-zoom.ts
|
|
21394
|
+
import { useState as useState6, useCallback as useCallback4, useRef } from "react";
|
|
21395
|
+
var { MIN_SCALE, MAX_SCALE } = TIMELINE_CONSTANTS;
|
|
21396
|
+
var ZOOM_FACTOR = 1.2;
|
|
21397
|
+
function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
|
|
21398
|
+
const [viewState, setViewState] = useState6(() => ({
|
|
21399
|
+
viewBox: {
|
|
21400
|
+
x: 0,
|
|
21401
|
+
y: 0,
|
|
21402
|
+
width: contentWidth,
|
|
21403
|
+
height: contentHeight
|
|
21404
|
+
},
|
|
21405
|
+
scale: 1,
|
|
21406
|
+
isPanning: false
|
|
21407
|
+
}));
|
|
21408
|
+
const panStartRef = useRef(
|
|
21409
|
+
null
|
|
21410
|
+
);
|
|
21411
|
+
const clampScale = useCallback4((scale) => {
|
|
21412
|
+
return Math.max(MIN_SCALE, Math.min(MAX_SCALE, scale));
|
|
21413
|
+
}, []);
|
|
21414
|
+
const zoomIn = useCallback4(() => {
|
|
21415
|
+
setViewState((prev) => {
|
|
21416
|
+
const newScale = clampScale(prev.scale * ZOOM_FACTOR);
|
|
21417
|
+
const scaleRatio = prev.scale / newScale;
|
|
21418
|
+
const centerX = prev.viewBox.x + prev.viewBox.width / 2;
|
|
21419
|
+
const centerY = prev.viewBox.y + prev.viewBox.height / 2;
|
|
21420
|
+
const newWidth = prev.viewBox.width * scaleRatio;
|
|
21421
|
+
const newHeight = prev.viewBox.height * scaleRatio;
|
|
21422
|
+
return {
|
|
21423
|
+
...prev,
|
|
21424
|
+
viewBox: {
|
|
21425
|
+
x: centerX - newWidth / 2,
|
|
21426
|
+
y: centerY - newHeight / 2,
|
|
21427
|
+
width: newWidth,
|
|
21428
|
+
height: newHeight
|
|
21429
|
+
},
|
|
21430
|
+
scale: newScale
|
|
21431
|
+
};
|
|
21432
|
+
});
|
|
21433
|
+
}, [clampScale]);
|
|
21434
|
+
const zoomOut = useCallback4(() => {
|
|
21435
|
+
setViewState((prev) => {
|
|
21436
|
+
const newScale = clampScale(prev.scale / ZOOM_FACTOR);
|
|
21437
|
+
const scaleRatio = prev.scale / newScale;
|
|
21438
|
+
const centerX = prev.viewBox.x + prev.viewBox.width / 2;
|
|
21439
|
+
const centerY = prev.viewBox.y + prev.viewBox.height / 2;
|
|
21440
|
+
const newWidth = prev.viewBox.width * scaleRatio;
|
|
21441
|
+
const newHeight = prev.viewBox.height * scaleRatio;
|
|
21442
|
+
return {
|
|
21443
|
+
...prev,
|
|
21444
|
+
viewBox: {
|
|
21445
|
+
x: centerX - newWidth / 2,
|
|
21446
|
+
y: centerY - newHeight / 2,
|
|
21447
|
+
width: newWidth,
|
|
21448
|
+
height: newHeight
|
|
21449
|
+
},
|
|
21450
|
+
scale: newScale
|
|
21451
|
+
};
|
|
21452
|
+
});
|
|
21453
|
+
}, [clampScale]);
|
|
21454
|
+
const resetZoom = useCallback4(() => {
|
|
21455
|
+
setViewState({
|
|
21456
|
+
viewBox: {
|
|
21457
|
+
x: 0,
|
|
21458
|
+
y: 0,
|
|
21459
|
+
width: contentWidth,
|
|
21460
|
+
height: contentHeight
|
|
21461
|
+
},
|
|
21462
|
+
scale: 1,
|
|
21463
|
+
isPanning: false
|
|
21464
|
+
});
|
|
21465
|
+
}, [contentWidth, contentHeight]);
|
|
21466
|
+
const setScale = useCallback4(
|
|
21467
|
+
(scale) => {
|
|
21468
|
+
setViewState((prev) => {
|
|
21469
|
+
const newScale = clampScale(scale);
|
|
21470
|
+
const scaleRatio = prev.scale / newScale;
|
|
21471
|
+
const centerX = prev.viewBox.x + prev.viewBox.width / 2;
|
|
21472
|
+
const centerY = prev.viewBox.y + prev.viewBox.height / 2;
|
|
21473
|
+
const newWidth = prev.viewBox.width * scaleRatio;
|
|
21474
|
+
const newHeight = prev.viewBox.height * scaleRatio;
|
|
21475
|
+
return {
|
|
21476
|
+
...prev,
|
|
21477
|
+
viewBox: {
|
|
21478
|
+
x: centerX - newWidth / 2,
|
|
21479
|
+
y: centerY - newHeight / 2,
|
|
21480
|
+
width: newWidth,
|
|
21481
|
+
height: newHeight
|
|
21482
|
+
},
|
|
21483
|
+
scale: newScale
|
|
21484
|
+
};
|
|
21485
|
+
});
|
|
21486
|
+
},
|
|
21487
|
+
[clampScale]
|
|
21488
|
+
);
|
|
21489
|
+
const onWheel = useCallback4(
|
|
21490
|
+
(event) => {
|
|
21491
|
+
if (!event.ctrlKey && !event.metaKey) {
|
|
21492
|
+
return;
|
|
21493
|
+
}
|
|
21494
|
+
try {
|
|
21495
|
+
event.preventDefault();
|
|
21496
|
+
} catch {
|
|
21497
|
+
}
|
|
21498
|
+
const svg2 = event.currentTarget;
|
|
21499
|
+
if (!svg2) return;
|
|
21500
|
+
const rect = svg2.getBoundingClientRect();
|
|
21501
|
+
if (!rect || rect.width === 0 || rect.height === 0) return;
|
|
21502
|
+
const delta = event.deltaY;
|
|
21503
|
+
const zoomDirection = delta > 0 ? -1 : 1;
|
|
21504
|
+
setViewState((prev) => {
|
|
21505
|
+
const factor = zoomDirection > 0 ? ZOOM_FACTOR : 1 / ZOOM_FACTOR;
|
|
21506
|
+
const newScale = clampScale(prev.scale * factor);
|
|
21507
|
+
if (newScale === prev.scale) {
|
|
21508
|
+
return prev;
|
|
21509
|
+
}
|
|
21510
|
+
const scaleRatio = prev.scale / newScale;
|
|
21511
|
+
const mouseX = event.clientX - rect.left;
|
|
21512
|
+
const mouseY = event.clientY - rect.top;
|
|
21513
|
+
const viewBoxMouseX = prev.viewBox.x + mouseX / rect.width * prev.viewBox.width;
|
|
21514
|
+
const viewBoxMouseY = prev.viewBox.y + mouseY / rect.height * prev.viewBox.height;
|
|
21515
|
+
const newWidth = prev.viewBox.width * scaleRatio;
|
|
21516
|
+
const newHeight = prev.viewBox.height * scaleRatio;
|
|
21517
|
+
const newX = viewBoxMouseX - mouseX / rect.width * newWidth;
|
|
21518
|
+
const newY = viewBoxMouseY - mouseY / rect.height * newHeight;
|
|
21519
|
+
return {
|
|
21520
|
+
...prev,
|
|
21521
|
+
viewBox: {
|
|
21522
|
+
x: newX,
|
|
21523
|
+
y: newY,
|
|
21524
|
+
width: newWidth,
|
|
21525
|
+
height: newHeight
|
|
21526
|
+
},
|
|
21527
|
+
scale: newScale
|
|
21528
|
+
};
|
|
21529
|
+
});
|
|
21530
|
+
},
|
|
21531
|
+
[clampScale]
|
|
21532
|
+
);
|
|
21533
|
+
const onMouseDown = useCallback4((event) => {
|
|
21534
|
+
if (event.button !== 0) return;
|
|
21535
|
+
event.preventDefault();
|
|
21536
|
+
setViewState((prev) => {
|
|
21537
|
+
panStartRef.current = {
|
|
21538
|
+
x: event.clientX,
|
|
21539
|
+
y: event.clientY,
|
|
21540
|
+
viewBoxX: prev.viewBox.x,
|
|
21541
|
+
viewBoxY: prev.viewBox.y
|
|
21542
|
+
};
|
|
21543
|
+
return {
|
|
21544
|
+
...prev,
|
|
21545
|
+
isPanning: true
|
|
21546
|
+
};
|
|
21547
|
+
});
|
|
21548
|
+
}, []);
|
|
21549
|
+
const onMouseMove = useCallback4((event) => {
|
|
21550
|
+
if (!panStartRef.current) return;
|
|
21551
|
+
const svg2 = event.currentTarget;
|
|
21552
|
+
const rect = svg2.getBoundingClientRect();
|
|
21553
|
+
const deltaX = event.clientX - panStartRef.current.x;
|
|
21554
|
+
const deltaY = event.clientY - panStartRef.current.y;
|
|
21555
|
+
setViewState((prev) => {
|
|
21556
|
+
const viewBoxDeltaX = deltaX / rect.width * prev.viewBox.width;
|
|
21557
|
+
const viewBoxDeltaY = deltaY / rect.height * prev.viewBox.height;
|
|
21558
|
+
return {
|
|
21559
|
+
...prev,
|
|
21560
|
+
viewBox: {
|
|
21561
|
+
...prev.viewBox,
|
|
21562
|
+
x: panStartRef.current.viewBoxX - viewBoxDeltaX,
|
|
21563
|
+
y: panStartRef.current.viewBoxY - viewBoxDeltaY
|
|
21564
|
+
}
|
|
21565
|
+
};
|
|
21566
|
+
});
|
|
21567
|
+
}, []);
|
|
21568
|
+
const onMouseUp = useCallback4(() => {
|
|
21569
|
+
panStartRef.current = null;
|
|
21570
|
+
setViewState((prev) => ({
|
|
21571
|
+
...prev,
|
|
21572
|
+
isPanning: false
|
|
21573
|
+
}));
|
|
21574
|
+
}, []);
|
|
21575
|
+
const onMouseLeave = useCallback4(() => {
|
|
21576
|
+
if (panStartRef.current) {
|
|
21577
|
+
panStartRef.current = null;
|
|
21578
|
+
setViewState((prev) => ({
|
|
21579
|
+
...prev,
|
|
21580
|
+
isPanning: false
|
|
21581
|
+
}));
|
|
21582
|
+
}
|
|
21583
|
+
}, []);
|
|
21584
|
+
return {
|
|
21585
|
+
viewState,
|
|
21586
|
+
zoomIn,
|
|
21587
|
+
zoomOut,
|
|
21588
|
+
resetZoom,
|
|
21589
|
+
setScale,
|
|
21590
|
+
onWheel,
|
|
21591
|
+
panHandlers: {
|
|
21592
|
+
onMouseDown,
|
|
21593
|
+
onMouseMove,
|
|
21594
|
+
onMouseUp,
|
|
21595
|
+
onMouseLeave
|
|
21596
|
+
}
|
|
21597
|
+
};
|
|
21598
|
+
}
|
|
21599
|
+
|
|
21600
|
+
// src/sections/traces/trace-drawer/trace-timeline/use-timeline-view-preference.ts
|
|
21601
|
+
import { useState as useState7, useCallback as useCallback5, useEffect as useEffect4 } from "react";
|
|
21602
|
+
var STORAGE_KEY = "agentmark-trace-view-preference";
|
|
21603
|
+
var DEFAULT_VIEW = "graph";
|
|
21604
|
+
function useTimelineViewPreference() {
|
|
21605
|
+
const [view, setViewState] = useState7(() => {
|
|
21606
|
+
if (typeof window !== "undefined") {
|
|
21607
|
+
try {
|
|
21608
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
21609
|
+
if (stored === "graph" || stored === "timeline") {
|
|
21610
|
+
return stored;
|
|
21611
|
+
}
|
|
21612
|
+
} catch {
|
|
21613
|
+
}
|
|
21614
|
+
}
|
|
21615
|
+
return DEFAULT_VIEW;
|
|
21616
|
+
});
|
|
21617
|
+
useEffect4(() => {
|
|
21618
|
+
if (typeof window !== "undefined") {
|
|
21619
|
+
try {
|
|
21620
|
+
localStorage.setItem(STORAGE_KEY, view);
|
|
21621
|
+
} catch {
|
|
21622
|
+
}
|
|
21623
|
+
}
|
|
21624
|
+
}, [view]);
|
|
21625
|
+
const setView = useCallback5((newView) => {
|
|
21626
|
+
setViewState(newView);
|
|
21627
|
+
}, []);
|
|
21628
|
+
const toggleView = useCallback5(() => {
|
|
21629
|
+
setViewState((current) => current === "graph" ? "timeline" : "graph");
|
|
21630
|
+
}, []);
|
|
21631
|
+
return {
|
|
21632
|
+
/** Current view type */
|
|
21633
|
+
view,
|
|
21634
|
+
/** Set view to specific type */
|
|
21635
|
+
setView,
|
|
21636
|
+
/** Toggle between graph and timeline */
|
|
21637
|
+
toggleView,
|
|
21638
|
+
/** Whether current view is timeline */
|
|
21639
|
+
isTimeline: view === "timeline",
|
|
21640
|
+
/** Whether current view is graph */
|
|
21641
|
+
isGraph: view === "graph"
|
|
21642
|
+
};
|
|
21643
|
+
}
|
|
21644
|
+
|
|
21645
|
+
// src/sections/traces/trace-drawer/trace-timeline/trace-timeline.tsx
|
|
21646
|
+
import { memo as memo6, useRef as useRef2, useState as useState8, useCallback as useCallback6, useEffect as useEffect5, useMemo as useMemo9 } from "react";
|
|
21647
|
+
import { Box as Box21, Skeleton as Skeleton3, Typography as Typography12, IconButton as IconButton3, Tooltip as Tooltip2 } from "@mui/material";
|
|
21648
|
+
import { useTheme as useTheme13 } from "@mui/material/styles";
|
|
21649
|
+
|
|
21650
|
+
// src/sections/traces/trace-drawer/trace-timeline/timeline-bar.tsx
|
|
21651
|
+
import { memo as memo2 } from "react";
|
|
21652
|
+
import { useTheme as useTheme9 } from "@mui/material/styles";
|
|
21653
|
+
import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
21654
|
+
var { ROW_HEIGHT, MIN_BAR_WIDTH, BAR_HEIGHT_RATIO } = TIMELINE_CONSTANTS;
|
|
21655
|
+
function formatBarDuration(ms) {
|
|
21656
|
+
if (ms < 1e3) {
|
|
21657
|
+
return `${Math.round(ms)}ms`;
|
|
21658
|
+
}
|
|
21659
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
21660
|
+
}
|
|
21661
|
+
var TimelineBar = memo2(function TimelineBar2({
|
|
21662
|
+
layout,
|
|
21663
|
+
isSelected,
|
|
21664
|
+
isFocused = false,
|
|
21665
|
+
onSelect,
|
|
21666
|
+
onMouseEnter,
|
|
21667
|
+
onMouseLeave,
|
|
21668
|
+
timelineWidth
|
|
21669
|
+
}) {
|
|
21670
|
+
const theme2 = useTheme9();
|
|
21671
|
+
const nodeStyle = getNodeTypeStyle(layout.nodeType, theme2);
|
|
21672
|
+
const barHeight = ROW_HEIGHT * BAR_HEIGHT_RATIO;
|
|
21673
|
+
const barY = layout.row * ROW_HEIGHT + (ROW_HEIGHT - barHeight) / 2;
|
|
21674
|
+
const xPixels = layout.x * timelineWidth;
|
|
21675
|
+
const widthPixels = Math.max(MIN_BAR_WIDTH, layout.width * timelineWidth);
|
|
21676
|
+
let barColor = nodeStyle.color;
|
|
21677
|
+
if (layout.hasError) {
|
|
21678
|
+
barColor = theme2.palette.error.main;
|
|
21679
|
+
}
|
|
21680
|
+
const strokeColor = isSelected ? theme2.palette.primary.main : isFocused ? theme2.palette.action.focus : "transparent";
|
|
21681
|
+
const strokeWidth = isSelected || isFocused ? 2 : 0;
|
|
21682
|
+
const opacity = layout.hasError ? 1 : 0.85;
|
|
21683
|
+
const handleClick = (event) => {
|
|
21684
|
+
event.stopPropagation();
|
|
21685
|
+
onSelect?.(layout.spanId);
|
|
21686
|
+
};
|
|
21687
|
+
const handleMouseEnter = (event) => {
|
|
21688
|
+
onMouseEnter?.(layout, event);
|
|
21689
|
+
};
|
|
21690
|
+
const showLabel = widthPixels > 60;
|
|
21691
|
+
const durationLabel = formatBarDuration(layout.durationMs);
|
|
21692
|
+
return /* @__PURE__ */ jsxs21(
|
|
21693
|
+
"g",
|
|
21694
|
+
{
|
|
21695
|
+
className: "timeline-bar",
|
|
21696
|
+
"data-span-id": layout.spanId,
|
|
21697
|
+
onClick: handleClick,
|
|
21698
|
+
onMouseEnter: handleMouseEnter,
|
|
21699
|
+
onMouseLeave,
|
|
21700
|
+
style: { cursor: "pointer" },
|
|
21701
|
+
role: "gridcell",
|
|
21702
|
+
"aria-label": `${layout.name}: ${durationLabel}, ${layout.percentOfTrace.toFixed(1)}% of trace`,
|
|
21703
|
+
tabIndex: -1,
|
|
21704
|
+
children: [
|
|
21705
|
+
/* @__PURE__ */ jsx36(
|
|
21706
|
+
"rect",
|
|
21707
|
+
{
|
|
21708
|
+
x: xPixels,
|
|
21709
|
+
y: barY,
|
|
21710
|
+
width: widthPixels,
|
|
21711
|
+
height: barHeight,
|
|
21712
|
+
rx: 3,
|
|
21713
|
+
ry: 3,
|
|
21714
|
+
fill: barColor,
|
|
21715
|
+
opacity,
|
|
21716
|
+
stroke: strokeColor,
|
|
21717
|
+
strokeWidth
|
|
21718
|
+
}
|
|
21719
|
+
),
|
|
21720
|
+
showLabel && /* @__PURE__ */ jsx36(
|
|
21721
|
+
"text",
|
|
21722
|
+
{
|
|
21723
|
+
x: xPixels + widthPixels / 2,
|
|
21724
|
+
y: barY + barHeight / 2,
|
|
21725
|
+
textAnchor: "middle",
|
|
21726
|
+
dominantBaseline: "central",
|
|
21727
|
+
fontSize: 10,
|
|
21728
|
+
fill: theme2.palette.getContrastText(barColor),
|
|
21729
|
+
style: { pointerEvents: "none", userSelect: "none" },
|
|
21730
|
+
children: durationLabel
|
|
21731
|
+
}
|
|
21732
|
+
),
|
|
21733
|
+
layout.hasError && /* @__PURE__ */ jsx36(
|
|
21734
|
+
"circle",
|
|
21735
|
+
{
|
|
21736
|
+
cx: xPixels + widthPixels - 8,
|
|
21737
|
+
cy: barY + barHeight / 2,
|
|
21738
|
+
r: 4,
|
|
21739
|
+
fill: theme2.palette.error.contrastText,
|
|
21740
|
+
style: { pointerEvents: "none" }
|
|
21741
|
+
}
|
|
21742
|
+
)
|
|
21743
|
+
]
|
|
21744
|
+
}
|
|
21745
|
+
);
|
|
21746
|
+
});
|
|
21747
|
+
|
|
21748
|
+
// src/sections/traces/trace-drawer/trace-timeline/timeline-ruler.tsx
|
|
21749
|
+
import { memo as memo3 } from "react";
|
|
21750
|
+
import { useTheme as useTheme10 } from "@mui/material/styles";
|
|
21751
|
+
import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
21752
|
+
var { RULER_HEIGHT } = TIMELINE_CONSTANTS;
|
|
21753
|
+
var TimelineRuler = memo3(function TimelineRuler2({
|
|
21754
|
+
ticks,
|
|
21755
|
+
width: width2,
|
|
21756
|
+
height: height2 = RULER_HEIGHT
|
|
21757
|
+
}) {
|
|
21758
|
+
const theme2 = useTheme10();
|
|
21759
|
+
const majorTickHeight = height2 * 0.6;
|
|
21760
|
+
const minorTickHeight = height2 * 0.3;
|
|
21761
|
+
return /* @__PURE__ */ jsxs22("g", { className: "timeline-ruler", role: "presentation", children: [
|
|
21762
|
+
/* @__PURE__ */ jsx37(
|
|
21763
|
+
"rect",
|
|
21764
|
+
{
|
|
21765
|
+
x: 0,
|
|
21766
|
+
y: 0,
|
|
21767
|
+
width: width2,
|
|
21768
|
+
height: height2,
|
|
21769
|
+
fill: theme2.palette.background.paper
|
|
21770
|
+
}
|
|
21771
|
+
),
|
|
21772
|
+
/* @__PURE__ */ jsx37(
|
|
21773
|
+
"line",
|
|
21774
|
+
{
|
|
21775
|
+
x1: 0,
|
|
21776
|
+
y1: height2,
|
|
21777
|
+
x2: width2,
|
|
21778
|
+
y2: height2,
|
|
21779
|
+
stroke: theme2.palette.divider,
|
|
21780
|
+
strokeWidth: 1
|
|
21781
|
+
}
|
|
21782
|
+
),
|
|
21783
|
+
ticks.map((tick, index) => {
|
|
21784
|
+
const x = tick.position * width2;
|
|
21785
|
+
const tickHeight = tick.isMajor ? majorTickHeight : minorTickHeight;
|
|
21786
|
+
const y1 = height2 - tickHeight;
|
|
21787
|
+
const y2 = height2;
|
|
21788
|
+
return /* @__PURE__ */ jsxs22("g", { children: [
|
|
21789
|
+
/* @__PURE__ */ jsx37(
|
|
21790
|
+
"line",
|
|
21791
|
+
{
|
|
21792
|
+
x1: x,
|
|
21793
|
+
y1,
|
|
21794
|
+
x2: x,
|
|
21795
|
+
y2,
|
|
21796
|
+
stroke: theme2.palette.text.secondary,
|
|
21797
|
+
strokeWidth: tick.isMajor ? 1 : 0.5,
|
|
21798
|
+
opacity: tick.isMajor ? 0.8 : 0.4
|
|
21799
|
+
}
|
|
21800
|
+
),
|
|
21801
|
+
tick.isMajor && tick.label && /* @__PURE__ */ jsx37(
|
|
21802
|
+
"text",
|
|
21803
|
+
{
|
|
21804
|
+
x,
|
|
21805
|
+
y: y1 - 4,
|
|
21806
|
+
textAnchor: "middle",
|
|
21807
|
+
fontSize: 10,
|
|
21808
|
+
fill: theme2.palette.text.secondary,
|
|
21809
|
+
style: { userSelect: "none" },
|
|
21810
|
+
children: tick.label
|
|
21811
|
+
}
|
|
21812
|
+
)
|
|
21813
|
+
] }, index);
|
|
21814
|
+
})
|
|
21815
|
+
] });
|
|
21816
|
+
});
|
|
21817
|
+
|
|
21818
|
+
// src/sections/traces/trace-drawer/trace-timeline/timeline-tooltip.tsx
|
|
21819
|
+
import { memo as memo4, useMemo as useMemo8 } from "react";
|
|
21820
|
+
import { Box as Box18, Typography as Typography9, Paper, Divider as Divider2, Chip as Chip2 } from "@mui/material";
|
|
21821
|
+
import { useTheme as useTheme11 } from "@mui/material/styles";
|
|
21822
|
+
import { Fragment as Fragment3, jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
21823
|
+
function formatDuration2(ms) {
|
|
21824
|
+
if (ms < 1) {
|
|
21825
|
+
return "<1ms";
|
|
21826
|
+
}
|
|
21827
|
+
if (ms < 1e3) {
|
|
21828
|
+
return `${Math.round(ms)}ms`;
|
|
21829
|
+
}
|
|
21830
|
+
if (ms < 6e4) {
|
|
21831
|
+
return `${(ms / 1e3).toFixed(2)}s`;
|
|
21832
|
+
}
|
|
21833
|
+
const minutes = Math.floor(ms / 6e4);
|
|
21834
|
+
const seconds = (ms % 6e4 / 1e3).toFixed(1);
|
|
21835
|
+
return `${minutes}m ${seconds}s`;
|
|
21836
|
+
}
|
|
21837
|
+
function formatStartTime(ms) {
|
|
21838
|
+
if (ms < 1e3) {
|
|
21839
|
+
return `+${Math.round(ms)}ms`;
|
|
21840
|
+
}
|
|
21841
|
+
return `+${(ms / 1e3).toFixed(2)}s`;
|
|
21842
|
+
}
|
|
21843
|
+
function formatCost(cost) {
|
|
21844
|
+
if (cost < 0.01) {
|
|
21845
|
+
return `$${cost.toFixed(6)}`;
|
|
21846
|
+
}
|
|
21847
|
+
if (cost < 1) {
|
|
21848
|
+
return `$${cost.toFixed(4)}`;
|
|
21849
|
+
}
|
|
21850
|
+
return `$${cost.toFixed(2)}`;
|
|
21851
|
+
}
|
|
21852
|
+
function formatTokens(tokens) {
|
|
21853
|
+
if (tokens >= 1e6) {
|
|
21854
|
+
return `${(tokens / 1e6).toFixed(1)}M`;
|
|
21855
|
+
}
|
|
21856
|
+
if (tokens >= 1e3) {
|
|
21857
|
+
return `${(tokens / 1e3).toFixed(1)}K`;
|
|
21858
|
+
}
|
|
21859
|
+
return String(tokens);
|
|
21860
|
+
}
|
|
21861
|
+
function truncateText(text, maxLength) {
|
|
21862
|
+
if (!text) return "";
|
|
21863
|
+
const cleanText = text.replace(/\n/g, " ").trim();
|
|
21864
|
+
if (cleanText.length <= maxLength) return cleanText;
|
|
21865
|
+
return cleanText.slice(0, maxLength) + "...";
|
|
21866
|
+
}
|
|
21867
|
+
var TimelineTooltip = memo4(function TimelineTooltip2({
|
|
21868
|
+
layout,
|
|
21869
|
+
position,
|
|
21870
|
+
visible
|
|
21871
|
+
}) {
|
|
21872
|
+
const theme2 = useTheme11();
|
|
21873
|
+
const parsedAttributes = useMemo8(() => {
|
|
21874
|
+
const attributes = layout?.span?.data?.attributes;
|
|
21875
|
+
if (!attributes) return null;
|
|
21876
|
+
try {
|
|
21877
|
+
return typeof attributes === "string" ? JSON.parse(attributes) : attributes;
|
|
21878
|
+
} catch {
|
|
21879
|
+
return null;
|
|
21880
|
+
}
|
|
21881
|
+
}, [layout?.span?.data?.attributes]);
|
|
21882
|
+
if (!visible || !layout || !position) {
|
|
21883
|
+
return null;
|
|
21884
|
+
}
|
|
21885
|
+
const nodeStyle = getNodeTypeStyle(layout.nodeType, theme2);
|
|
21886
|
+
const spanData = layout.span.data;
|
|
21887
|
+
const hasModelInfo = spanData.model || spanData.totalTokens || spanData.cost;
|
|
21888
|
+
const hasInputOutput = spanData.input || spanData.output;
|
|
21889
|
+
const hasToolCalls = spanData.toolCalls;
|
|
21890
|
+
const hasAttributes = parsedAttributes && Object.keys(parsedAttributes).length > 0;
|
|
21891
|
+
const tooltipWidth = 340;
|
|
21892
|
+
const tooltipHeight = 280;
|
|
21893
|
+
const padding2 = 12;
|
|
21894
|
+
let left = position.x + padding2;
|
|
21895
|
+
let top2 = position.y + padding2;
|
|
21896
|
+
if (typeof window !== "undefined") {
|
|
21897
|
+
if (left + tooltipWidth > window.innerWidth - padding2) {
|
|
21898
|
+
left = position.x - tooltipWidth - padding2;
|
|
21899
|
+
}
|
|
21900
|
+
if (top2 + tooltipHeight > window.innerHeight - padding2) {
|
|
21901
|
+
top2 = position.y - tooltipHeight - padding2;
|
|
21902
|
+
}
|
|
21903
|
+
left = Math.max(padding2, left);
|
|
21904
|
+
top2 = Math.max(padding2, top2);
|
|
21905
|
+
}
|
|
21906
|
+
return /* @__PURE__ */ jsxs23(
|
|
21907
|
+
Paper,
|
|
21908
|
+
{
|
|
21909
|
+
elevation: 8,
|
|
21910
|
+
sx: {
|
|
21911
|
+
position: "fixed",
|
|
21912
|
+
left,
|
|
21913
|
+
top: top2,
|
|
21914
|
+
zIndex: theme2.zIndex.tooltip,
|
|
21915
|
+
p: 1.5,
|
|
21916
|
+
maxWidth: tooltipWidth,
|
|
21917
|
+
maxHeight: 400,
|
|
21918
|
+
overflow: "auto",
|
|
21919
|
+
pointerEvents: "none",
|
|
21920
|
+
backgroundColor: theme2.palette.background.paper,
|
|
21921
|
+
border: `1px solid ${theme2.palette.divider}`
|
|
21922
|
+
},
|
|
21923
|
+
children: [
|
|
21924
|
+
/* @__PURE__ */ jsxs23(Box18, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 1 }, children: [
|
|
21925
|
+
/* @__PURE__ */ jsx38(
|
|
21926
|
+
Box18,
|
|
21927
|
+
{
|
|
21928
|
+
sx: {
|
|
21929
|
+
width: 8,
|
|
21930
|
+
height: 8,
|
|
21931
|
+
borderRadius: "50%",
|
|
21932
|
+
backgroundColor: nodeStyle.color,
|
|
21933
|
+
flexShrink: 0
|
|
21934
|
+
}
|
|
21935
|
+
}
|
|
21936
|
+
),
|
|
21937
|
+
/* @__PURE__ */ jsx38(
|
|
21938
|
+
Typography9,
|
|
21939
|
+
{
|
|
21940
|
+
variant: "subtitle2",
|
|
21941
|
+
sx: {
|
|
21942
|
+
fontWeight: 600,
|
|
21943
|
+
wordBreak: "break-word",
|
|
21944
|
+
color: theme2.palette.text.primary
|
|
21945
|
+
},
|
|
21946
|
+
children: layout.name
|
|
21947
|
+
}
|
|
21948
|
+
)
|
|
21949
|
+
] }),
|
|
21950
|
+
/* @__PURE__ */ jsxs23(
|
|
21951
|
+
Box18,
|
|
21952
|
+
{
|
|
21953
|
+
sx: {
|
|
21954
|
+
display: "grid",
|
|
21955
|
+
gridTemplateColumns: "auto 1fr",
|
|
21956
|
+
gap: 0.5,
|
|
21957
|
+
rowGap: 0.25
|
|
21958
|
+
},
|
|
21959
|
+
children: [
|
|
21960
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Duration:" }),
|
|
21961
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", fontWeight: 500, children: formatDuration2(layout.durationMs) }),
|
|
21962
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Start:" }),
|
|
21963
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", children: formatStartTime(layout.startTimeMs) }),
|
|
21964
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "% of trace:" }),
|
|
21965
|
+
/* @__PURE__ */ jsxs23(Typography9, { variant: "caption", children: [
|
|
21966
|
+
layout.percentOfTrace.toFixed(1),
|
|
21967
|
+
"%"
|
|
21968
|
+
] }),
|
|
21969
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Type:" }),
|
|
21970
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", sx: { textTransform: "capitalize" }, children: layout.nodeType }),
|
|
21971
|
+
layout.hasError && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
21972
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "error.main", children: "Status:" }),
|
|
21973
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "error.main", fontWeight: 500, children: spanData.statusMessage || "Error" })
|
|
21974
|
+
] })
|
|
21975
|
+
]
|
|
21976
|
+
}
|
|
21977
|
+
),
|
|
21978
|
+
hasModelInfo && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
21979
|
+
/* @__PURE__ */ jsx38(Divider2, { sx: { my: 1 } }),
|
|
21980
|
+
/* @__PURE__ */ jsxs23(
|
|
21981
|
+
Box18,
|
|
21982
|
+
{
|
|
21983
|
+
sx: {
|
|
21984
|
+
display: "grid",
|
|
21985
|
+
gridTemplateColumns: "auto 1fr",
|
|
21986
|
+
gap: 0.5,
|
|
21987
|
+
rowGap: 0.25
|
|
21988
|
+
},
|
|
21989
|
+
children: [
|
|
21990
|
+
spanData.model && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
21991
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Model:" }),
|
|
21992
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", fontWeight: 500, children: spanData.model })
|
|
21993
|
+
] }),
|
|
21994
|
+
(spanData.inputTokens || spanData.outputTokens) && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
21995
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Tokens:" }),
|
|
21996
|
+
/* @__PURE__ */ jsxs23(Typography9, { variant: "caption", children: [
|
|
21997
|
+
spanData.inputTokens ? `${formatTokens(spanData.inputTokens)} in` : "",
|
|
21998
|
+
spanData.inputTokens && spanData.outputTokens ? " / " : "",
|
|
21999
|
+
spanData.outputTokens ? `${formatTokens(spanData.outputTokens)} out` : "",
|
|
22000
|
+
spanData.totalTokens && ` (${formatTokens(spanData.totalTokens)} total)`
|
|
22001
|
+
] })
|
|
22002
|
+
] }),
|
|
22003
|
+
spanData.reasoningTokens && spanData.reasoningTokens > 0 && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
22004
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Reasoning:" }),
|
|
22005
|
+
/* @__PURE__ */ jsxs23(Typography9, { variant: "caption", children: [
|
|
22006
|
+
formatTokens(spanData.reasoningTokens),
|
|
22007
|
+
" tokens"
|
|
22008
|
+
] })
|
|
22009
|
+
] }),
|
|
22010
|
+
spanData.cost != null && spanData.cost > 0 && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
22011
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Cost:" }),
|
|
22012
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", fontWeight: 500, children: formatCost(spanData.cost) })
|
|
22013
|
+
] }),
|
|
22014
|
+
spanData.finishReason && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
22015
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", color: "text.secondary", children: "Finish:" }),
|
|
22016
|
+
/* @__PURE__ */ jsx38(Typography9, { variant: "caption", children: spanData.finishReason })
|
|
22017
|
+
] })
|
|
22018
|
+
]
|
|
22019
|
+
}
|
|
22020
|
+
)
|
|
22021
|
+
] }),
|
|
22022
|
+
hasInputOutput && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
22023
|
+
/* @__PURE__ */ jsx38(Divider2, { sx: { my: 1 } }),
|
|
22024
|
+
spanData.input && /* @__PURE__ */ jsxs23(Box18, { sx: { mb: 0.5 }, children: [
|
|
22025
|
+
/* @__PURE__ */ jsx38(
|
|
22026
|
+
Typography9,
|
|
22027
|
+
{
|
|
22028
|
+
variant: "caption",
|
|
22029
|
+
color: "text.secondary",
|
|
22030
|
+
sx: { display: "block", mb: 0.25 },
|
|
22031
|
+
children: "Input:"
|
|
22032
|
+
}
|
|
22033
|
+
),
|
|
22034
|
+
/* @__PURE__ */ jsx38(
|
|
22035
|
+
Typography9,
|
|
22036
|
+
{
|
|
22037
|
+
variant: "caption",
|
|
22038
|
+
sx: {
|
|
22039
|
+
display: "block",
|
|
22040
|
+
backgroundColor: theme2.palette.action.hover,
|
|
22041
|
+
borderRadius: 0.5,
|
|
22042
|
+
p: 0.5,
|
|
22043
|
+
fontFamily: "monospace",
|
|
22044
|
+
fontSize: "0.7rem",
|
|
22045
|
+
whiteSpace: "pre-wrap",
|
|
22046
|
+
wordBreak: "break-word"
|
|
22047
|
+
},
|
|
22048
|
+
children: truncateText(spanData.input, 100)
|
|
22049
|
+
}
|
|
22050
|
+
)
|
|
22051
|
+
] }),
|
|
22052
|
+
spanData.output && /* @__PURE__ */ jsxs23(Box18, { children: [
|
|
22053
|
+
/* @__PURE__ */ jsx38(
|
|
22054
|
+
Typography9,
|
|
22055
|
+
{
|
|
22056
|
+
variant: "caption",
|
|
22057
|
+
color: "text.secondary",
|
|
22058
|
+
sx: { display: "block", mb: 0.25 },
|
|
22059
|
+
children: "Output:"
|
|
22060
|
+
}
|
|
22061
|
+
),
|
|
22062
|
+
/* @__PURE__ */ jsx38(
|
|
22063
|
+
Typography9,
|
|
22064
|
+
{
|
|
22065
|
+
variant: "caption",
|
|
22066
|
+
sx: {
|
|
22067
|
+
display: "block",
|
|
22068
|
+
backgroundColor: theme2.palette.action.hover,
|
|
22069
|
+
borderRadius: 0.5,
|
|
22070
|
+
p: 0.5,
|
|
22071
|
+
fontFamily: "monospace",
|
|
22072
|
+
fontSize: "0.7rem",
|
|
22073
|
+
whiteSpace: "pre-wrap",
|
|
22074
|
+
wordBreak: "break-word"
|
|
22075
|
+
},
|
|
22076
|
+
children: truncateText(spanData.output, 100)
|
|
22077
|
+
}
|
|
22078
|
+
)
|
|
22079
|
+
] })
|
|
22080
|
+
] }),
|
|
22081
|
+
hasToolCalls && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
22082
|
+
/* @__PURE__ */ jsx38(Divider2, { sx: { my: 1 } }),
|
|
22083
|
+
/* @__PURE__ */ jsx38(
|
|
22084
|
+
Typography9,
|
|
22085
|
+
{
|
|
22086
|
+
variant: "caption",
|
|
22087
|
+
color: "text.secondary",
|
|
22088
|
+
sx: { display: "block", mb: 0.25 },
|
|
22089
|
+
children: "Tool Calls:"
|
|
22090
|
+
}
|
|
22091
|
+
),
|
|
22092
|
+
/* @__PURE__ */ jsx38(
|
|
22093
|
+
Typography9,
|
|
22094
|
+
{
|
|
22095
|
+
variant: "caption",
|
|
22096
|
+
sx: {
|
|
22097
|
+
display: "block",
|
|
22098
|
+
backgroundColor: theme2.palette.action.hover,
|
|
22099
|
+
borderRadius: 0.5,
|
|
22100
|
+
p: 0.5,
|
|
22101
|
+
fontFamily: "monospace",
|
|
22102
|
+
fontSize: "0.7rem",
|
|
22103
|
+
whiteSpace: "pre-wrap",
|
|
22104
|
+
wordBreak: "break-word"
|
|
22105
|
+
},
|
|
22106
|
+
children: truncateText(spanData.toolCalls, 80)
|
|
22107
|
+
}
|
|
22108
|
+
)
|
|
22109
|
+
] }),
|
|
22110
|
+
hasAttributes && /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
22111
|
+
/* @__PURE__ */ jsx38(Divider2, { sx: { my: 1 } }),
|
|
22112
|
+
/* @__PURE__ */ jsx38(
|
|
22113
|
+
Typography9,
|
|
22114
|
+
{
|
|
22115
|
+
variant: "caption",
|
|
22116
|
+
color: "text.secondary",
|
|
22117
|
+
sx: { display: "block", mb: 0.5 },
|
|
22118
|
+
children: "Attributes:"
|
|
22119
|
+
}
|
|
22120
|
+
),
|
|
22121
|
+
/* @__PURE__ */ jsxs23(Box18, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5 }, children: [
|
|
22122
|
+
Object.entries(parsedAttributes).slice(0, 5).map(([key, value]) => /* @__PURE__ */ jsx38(
|
|
22123
|
+
Chip2,
|
|
22124
|
+
{
|
|
22125
|
+
label: `${key}: ${truncateText(String(value), 20)}`,
|
|
22126
|
+
size: "small",
|
|
22127
|
+
variant: "outlined",
|
|
22128
|
+
sx: {
|
|
22129
|
+
height: 20,
|
|
22130
|
+
fontSize: "0.65rem",
|
|
22131
|
+
"& .MuiChip-label": { px: 0.75 }
|
|
22132
|
+
}
|
|
22133
|
+
},
|
|
22134
|
+
key
|
|
22135
|
+
)),
|
|
22136
|
+
Object.keys(parsedAttributes).length > 5 && /* @__PURE__ */ jsx38(
|
|
22137
|
+
Chip2,
|
|
22138
|
+
{
|
|
22139
|
+
label: `+${Object.keys(parsedAttributes).length - 5} more`,
|
|
22140
|
+
size: "small",
|
|
22141
|
+
sx: {
|
|
22142
|
+
height: 20,
|
|
22143
|
+
fontSize: "0.65rem",
|
|
22144
|
+
"& .MuiChip-label": { px: 0.75 }
|
|
22145
|
+
}
|
|
22146
|
+
}
|
|
22147
|
+
)
|
|
22148
|
+
] })
|
|
22149
|
+
] })
|
|
22150
|
+
]
|
|
22151
|
+
}
|
|
22152
|
+
);
|
|
22153
|
+
});
|
|
22154
|
+
|
|
22155
|
+
// src/sections/traces/trace-drawer/trace-timeline/timeline-legend.tsx
|
|
22156
|
+
import { memo as memo5 } from "react";
|
|
22157
|
+
import { Box as Box19, Typography as Typography10 } from "@mui/material";
|
|
22158
|
+
import { useTheme as useTheme12 } from "@mui/material/styles";
|
|
22159
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22160
|
+
var NODE_TYPE_LABELS = {
|
|
22161
|
+
llm: "LLM",
|
|
22162
|
+
tool: "Tool",
|
|
22163
|
+
agent: "Agent",
|
|
22164
|
+
retrieval: "Retrieval",
|
|
22165
|
+
router: "Router",
|
|
22166
|
+
memory: "Memory",
|
|
22167
|
+
default: "Other",
|
|
22168
|
+
start: "Start",
|
|
22169
|
+
end: "End"
|
|
22170
|
+
};
|
|
22171
|
+
var NODE_TYPE_ORDER = [
|
|
22172
|
+
"llm",
|
|
22173
|
+
"tool",
|
|
22174
|
+
"agent",
|
|
22175
|
+
"retrieval",
|
|
22176
|
+
"router",
|
|
22177
|
+
"memory",
|
|
22178
|
+
"default"
|
|
22179
|
+
];
|
|
22180
|
+
var TimelineLegend = memo5(function TimelineLegend2({
|
|
22181
|
+
typeBreakdown,
|
|
22182
|
+
showCounts = false
|
|
22183
|
+
}) {
|
|
22184
|
+
const theme2 = useTheme12();
|
|
22185
|
+
const visibleTypes = NODE_TYPE_ORDER.filter(
|
|
22186
|
+
(type) => typeBreakdown[type] !== void 0 && typeBreakdown[type] > 0
|
|
22187
|
+
);
|
|
22188
|
+
if (visibleTypes.length === 0) {
|
|
22189
|
+
return null;
|
|
22190
|
+
}
|
|
22191
|
+
return /* @__PURE__ */ jsx39(
|
|
22192
|
+
Box19,
|
|
22193
|
+
{
|
|
22194
|
+
sx: {
|
|
22195
|
+
display: "flex",
|
|
22196
|
+
flexWrap: "wrap",
|
|
22197
|
+
gap: 1.5,
|
|
22198
|
+
px: 1,
|
|
22199
|
+
py: 0.5,
|
|
22200
|
+
borderTop: `1px solid ${theme2.palette.divider}`,
|
|
22201
|
+
backgroundColor: theme2.palette.background.paper
|
|
22202
|
+
},
|
|
22203
|
+
role: "legend",
|
|
22204
|
+
"aria-label": "Span type legend",
|
|
22205
|
+
children: visibleTypes.map((type) => {
|
|
22206
|
+
const style4 = getNodeTypeStyle(type, theme2);
|
|
22207
|
+
const count = typeBreakdown[type] || 0;
|
|
22208
|
+
const label = NODE_TYPE_LABELS[type];
|
|
22209
|
+
return /* @__PURE__ */ jsxs24(
|
|
22210
|
+
Box19,
|
|
22211
|
+
{
|
|
22212
|
+
sx: {
|
|
22213
|
+
display: "flex",
|
|
22214
|
+
alignItems: "center",
|
|
22215
|
+
gap: 0.5
|
|
22216
|
+
},
|
|
22217
|
+
children: [
|
|
22218
|
+
/* @__PURE__ */ jsx39(
|
|
22219
|
+
Box19,
|
|
22220
|
+
{
|
|
22221
|
+
sx: {
|
|
22222
|
+
width: 12,
|
|
22223
|
+
height: 12,
|
|
22224
|
+
borderRadius: 0.5,
|
|
22225
|
+
backgroundColor: style4.color,
|
|
22226
|
+
flexShrink: 0
|
|
22227
|
+
}
|
|
22228
|
+
}
|
|
22229
|
+
),
|
|
22230
|
+
/* @__PURE__ */ jsxs24(
|
|
22231
|
+
Typography10,
|
|
22232
|
+
{
|
|
22233
|
+
variant: "caption",
|
|
22234
|
+
sx: {
|
|
22235
|
+
color: theme2.palette.text.secondary,
|
|
22236
|
+
lineHeight: 1,
|
|
22237
|
+
whiteSpace: "nowrap"
|
|
22238
|
+
},
|
|
22239
|
+
children: [
|
|
22240
|
+
label,
|
|
22241
|
+
showCounts && count > 0 && /* @__PURE__ */ jsxs24(
|
|
22242
|
+
Typography10,
|
|
22243
|
+
{
|
|
22244
|
+
component: "span",
|
|
22245
|
+
variant: "caption",
|
|
22246
|
+
sx: {
|
|
22247
|
+
color: theme2.palette.text.disabled,
|
|
22248
|
+
ml: 0.5
|
|
22249
|
+
},
|
|
22250
|
+
children: [
|
|
22251
|
+
"(",
|
|
22252
|
+
count,
|
|
22253
|
+
")"
|
|
22254
|
+
]
|
|
22255
|
+
}
|
|
22256
|
+
)
|
|
22257
|
+
]
|
|
22258
|
+
}
|
|
22259
|
+
)
|
|
22260
|
+
]
|
|
22261
|
+
},
|
|
22262
|
+
type
|
|
22263
|
+
);
|
|
22264
|
+
})
|
|
22265
|
+
}
|
|
22266
|
+
);
|
|
22267
|
+
});
|
|
22268
|
+
|
|
22269
|
+
// src/sections/traces/trace-drawer/trace-timeline/timeline-error-boundary.tsx
|
|
22270
|
+
import { Component } from "react";
|
|
22271
|
+
import { Box as Box20, Typography as Typography11, Button } from "@mui/material";
|
|
22272
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
22273
|
+
var TimelineErrorBoundary = class extends Component {
|
|
22274
|
+
constructor(props) {
|
|
22275
|
+
super(props);
|
|
22276
|
+
this.state = { hasError: false, error: null };
|
|
22277
|
+
}
|
|
22278
|
+
static getDerivedStateFromError(error) {
|
|
22279
|
+
return { hasError: true, error };
|
|
22280
|
+
}
|
|
22281
|
+
componentDidCatch(error, errorInfo) {
|
|
22282
|
+
console.error("Timeline rendering error:", error, errorInfo);
|
|
22283
|
+
}
|
|
22284
|
+
handleRetry = () => {
|
|
22285
|
+
this.setState({ hasError: false, error: null });
|
|
22286
|
+
};
|
|
22287
|
+
render() {
|
|
22288
|
+
if (this.state.hasError) {
|
|
22289
|
+
if (this.props.fallback) {
|
|
22290
|
+
return this.props.fallback;
|
|
22291
|
+
}
|
|
22292
|
+
return /* @__PURE__ */ jsxs25(
|
|
22293
|
+
Box20,
|
|
22294
|
+
{
|
|
22295
|
+
sx: {
|
|
22296
|
+
p: 3,
|
|
22297
|
+
display: "flex",
|
|
22298
|
+
flexDirection: "column",
|
|
22299
|
+
alignItems: "center",
|
|
22300
|
+
justifyContent: "center",
|
|
22301
|
+
height: "100%",
|
|
22302
|
+
minHeight: 200,
|
|
22303
|
+
color: "text.secondary",
|
|
22304
|
+
textAlign: "center"
|
|
22305
|
+
},
|
|
22306
|
+
children: [
|
|
22307
|
+
/* @__PURE__ */ jsx40(Typography11, { variant: "body1", color: "error", gutterBottom: true, children: "Failed to render timeline" }),
|
|
22308
|
+
/* @__PURE__ */ jsx40(Typography11, { variant: "body2", sx: { mb: 2 }, children: "There was an error processing the span data." }),
|
|
22309
|
+
/* @__PURE__ */ jsx40(
|
|
22310
|
+
Button,
|
|
22311
|
+
{
|
|
22312
|
+
variant: "outlined",
|
|
22313
|
+
size: "small",
|
|
22314
|
+
onClick: this.handleRetry,
|
|
22315
|
+
children: "Retry"
|
|
22316
|
+
}
|
|
22317
|
+
)
|
|
22318
|
+
]
|
|
22319
|
+
}
|
|
22320
|
+
);
|
|
22321
|
+
}
|
|
22322
|
+
return this.props.children;
|
|
22323
|
+
}
|
|
22324
|
+
};
|
|
22325
|
+
|
|
22326
|
+
// src/sections/traces/trace-drawer/trace-timeline/trace-timeline.tsx
|
|
22327
|
+
import { jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
22328
|
+
var { ROW_HEIGHT: ROW_HEIGHT2, RULER_HEIGHT: RULER_HEIGHT2, PADDING, LABEL_WIDTH } = TIMELINE_CONSTANTS;
|
|
22329
|
+
var VIRTUALIZATION_THRESHOLD = 100;
|
|
22330
|
+
var VIRTUALIZATION_OVERSCAN = 5;
|
|
22331
|
+
var TraceTimeline = memo6(function TraceTimeline2({
|
|
22332
|
+
spans,
|
|
22333
|
+
selectedSpanId,
|
|
22334
|
+
onSelectSpan,
|
|
22335
|
+
showRuler = true,
|
|
22336
|
+
showLegend = true,
|
|
22337
|
+
enableZoom = true,
|
|
22338
|
+
enablePan = true,
|
|
22339
|
+
sx,
|
|
22340
|
+
isLoading = false
|
|
22341
|
+
}) {
|
|
22342
|
+
const theme2 = useTheme13();
|
|
22343
|
+
const containerRef = useRef2(null);
|
|
22344
|
+
const [containerWidth, setContainerWidth] = useState8(800);
|
|
22345
|
+
const prevSelectedSpanIdRef = useRef2(void 0);
|
|
22346
|
+
const [tooltipData, setTooltipData] = useState8({ layout: null, position: null });
|
|
22347
|
+
const [scrollTop, setScrollTop] = useState8(0);
|
|
22348
|
+
const [containerHeight, setContainerHeight] = useState8(400);
|
|
22349
|
+
const { layouts, metrics, rulerTicks } = useTimelineLayout(spans);
|
|
22350
|
+
const timelineWidth = Math.max(400, containerWidth - LABEL_WIDTH - PADDING * 2);
|
|
22351
|
+
const contentHeight = layouts.length * ROW_HEIGHT2;
|
|
22352
|
+
const totalHeight = contentHeight + (showRuler ? RULER_HEIGHT2 : 0) + PADDING * 2;
|
|
22353
|
+
const {
|
|
22354
|
+
viewState,
|
|
22355
|
+
zoomIn,
|
|
22356
|
+
zoomOut,
|
|
22357
|
+
resetZoom,
|
|
22358
|
+
onWheel,
|
|
22359
|
+
panHandlers
|
|
22360
|
+
} = useTimelineZoom(timelineWidth, contentHeight);
|
|
22361
|
+
const { visibleLayouts } = useMemo9(() => {
|
|
22362
|
+
if (layouts.length < VIRTUALIZATION_THRESHOLD) {
|
|
22363
|
+
return {
|
|
22364
|
+
visibleLayouts: layouts,
|
|
22365
|
+
startIndex: 0,
|
|
22366
|
+
endIndex: layouts.length
|
|
22367
|
+
};
|
|
22368
|
+
}
|
|
22369
|
+
const headerOffset = showRuler ? RULER_HEIGHT2 : 0;
|
|
22370
|
+
const firstVisibleRow = Math.floor(
|
|
22371
|
+
(scrollTop - headerOffset - PADDING) / ROW_HEIGHT2
|
|
22372
|
+
);
|
|
22373
|
+
const visibleRowCount = Math.ceil(containerHeight / ROW_HEIGHT2);
|
|
22374
|
+
const start = Math.max(0, firstVisibleRow - VIRTUALIZATION_OVERSCAN);
|
|
22375
|
+
const end = Math.min(
|
|
22376
|
+
layouts.length,
|
|
22377
|
+
firstVisibleRow + visibleRowCount + VIRTUALIZATION_OVERSCAN
|
|
22378
|
+
);
|
|
22379
|
+
return {
|
|
22380
|
+
visibleLayouts: layouts.slice(start, end),
|
|
22381
|
+
startIndex: start,
|
|
22382
|
+
endIndex: end
|
|
22383
|
+
};
|
|
22384
|
+
}, [layouts, scrollTop, containerHeight, showRuler]);
|
|
22385
|
+
useEffect5(() => {
|
|
22386
|
+
const container = containerRef.current;
|
|
22387
|
+
if (!container) return;
|
|
22388
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
22389
|
+
for (const entry of entries) {
|
|
22390
|
+
setContainerWidth(entry.contentRect.width);
|
|
22391
|
+
setContainerHeight(entry.contentRect.height);
|
|
22392
|
+
}
|
|
22393
|
+
});
|
|
22394
|
+
const handleScroll = () => {
|
|
22395
|
+
setScrollTop(container.scrollTop);
|
|
22396
|
+
};
|
|
22397
|
+
resizeObserver.observe(container);
|
|
22398
|
+
container.addEventListener("scroll", handleScroll, { passive: true });
|
|
22399
|
+
setContainerWidth(container.offsetWidth);
|
|
22400
|
+
setContainerHeight(container.offsetHeight);
|
|
22401
|
+
return () => {
|
|
22402
|
+
resizeObserver.disconnect();
|
|
22403
|
+
container.removeEventListener("scroll", handleScroll);
|
|
22404
|
+
};
|
|
22405
|
+
}, []);
|
|
22406
|
+
useEffect5(() => {
|
|
22407
|
+
if (!selectedSpanId || selectedSpanId === prevSelectedSpanIdRef.current) {
|
|
22408
|
+
prevSelectedSpanIdRef.current = selectedSpanId;
|
|
22409
|
+
return;
|
|
22410
|
+
}
|
|
22411
|
+
prevSelectedSpanIdRef.current = selectedSpanId;
|
|
22412
|
+
const container = containerRef.current;
|
|
22413
|
+
if (!container) return;
|
|
22414
|
+
const selectedLayout = layouts.find((l) => l.spanId === selectedSpanId);
|
|
22415
|
+
if (!selectedLayout) return;
|
|
22416
|
+
const spanY = PADDING + (showRuler ? RULER_HEIGHT2 : 0) + selectedLayout.row * ROW_HEIGHT2;
|
|
22417
|
+
const containerRect = container.getBoundingClientRect();
|
|
22418
|
+
const scrollTop2 = container.scrollTop;
|
|
22419
|
+
const viewportTop = scrollTop2;
|
|
22420
|
+
const viewportBottom = scrollTop2 + containerRect.height;
|
|
22421
|
+
if (spanY < viewportTop || spanY + ROW_HEIGHT2 > viewportBottom) {
|
|
22422
|
+
container.scrollTo({
|
|
22423
|
+
top: spanY - containerRect.height / 2 + ROW_HEIGHT2 / 2,
|
|
22424
|
+
behavior: "smooth"
|
|
22425
|
+
});
|
|
22426
|
+
}
|
|
22427
|
+
}, [selectedSpanId, layouts, showRuler]);
|
|
22428
|
+
const handleSelectSpan = useCallback6(
|
|
22429
|
+
(spanId) => {
|
|
22430
|
+
onSelectSpan?.(spanId);
|
|
22431
|
+
},
|
|
22432
|
+
[onSelectSpan]
|
|
22433
|
+
);
|
|
22434
|
+
const handleBarMouseEnter = useCallback6(
|
|
22435
|
+
(layout, event) => {
|
|
22436
|
+
setTooltipData({
|
|
22437
|
+
layout,
|
|
22438
|
+
position: { x: event.clientX, y: event.clientY }
|
|
22439
|
+
});
|
|
22440
|
+
},
|
|
22441
|
+
[]
|
|
22442
|
+
);
|
|
22443
|
+
const handleBarMouseLeave = useCallback6(() => {
|
|
22444
|
+
setTooltipData({ layout: null, position: null });
|
|
22445
|
+
}, []);
|
|
22446
|
+
const [focusedIndex, setFocusedIndex] = useState8(-1);
|
|
22447
|
+
const handleKeyDown = useCallback6(
|
|
22448
|
+
(event) => {
|
|
22449
|
+
if (layouts.length === 0) return;
|
|
22450
|
+
switch (event.key) {
|
|
22451
|
+
case "ArrowDown":
|
|
22452
|
+
event.preventDefault();
|
|
22453
|
+
setFocusedIndex(
|
|
22454
|
+
(prev) => prev < layouts.length - 1 ? prev + 1 : prev
|
|
22455
|
+
);
|
|
22456
|
+
break;
|
|
22457
|
+
case "ArrowUp":
|
|
22458
|
+
event.preventDefault();
|
|
22459
|
+
setFocusedIndex((prev) => prev > 0 ? prev - 1 : 0);
|
|
22460
|
+
break;
|
|
22461
|
+
case "Enter":
|
|
22462
|
+
case " ":
|
|
22463
|
+
event.preventDefault();
|
|
22464
|
+
if (focusedIndex >= 0 && focusedIndex < layouts.length) {
|
|
22465
|
+
const focusedLayout = layouts[focusedIndex];
|
|
22466
|
+
if (focusedLayout) {
|
|
22467
|
+
handleSelectSpan(focusedLayout.spanId);
|
|
22468
|
+
}
|
|
22469
|
+
}
|
|
22470
|
+
break;
|
|
22471
|
+
case "Home":
|
|
22472
|
+
event.preventDefault();
|
|
22473
|
+
setFocusedIndex(0);
|
|
22474
|
+
break;
|
|
22475
|
+
case "End":
|
|
22476
|
+
event.preventDefault();
|
|
22477
|
+
setFocusedIndex(layouts.length - 1);
|
|
22478
|
+
break;
|
|
22479
|
+
}
|
|
22480
|
+
},
|
|
22481
|
+
[layouts, focusedIndex, handleSelectSpan]
|
|
22482
|
+
);
|
|
22483
|
+
if (isLoading) {
|
|
22484
|
+
return /* @__PURE__ */ jsx41(Box21, { sx: { p: 2, ...sx }, children: /* @__PURE__ */ jsx41(Skeleton3, { variant: "rectangular", height: 200 }) });
|
|
22485
|
+
}
|
|
22486
|
+
if (spans.length === 0) {
|
|
22487
|
+
return /* @__PURE__ */ jsx41(
|
|
22488
|
+
Box21,
|
|
22489
|
+
{
|
|
22490
|
+
sx: {
|
|
22491
|
+
p: 4,
|
|
22492
|
+
display: "flex",
|
|
22493
|
+
alignItems: "center",
|
|
22494
|
+
justifyContent: "center",
|
|
22495
|
+
color: "text.secondary",
|
|
22496
|
+
...sx
|
|
22497
|
+
},
|
|
22498
|
+
children: /* @__PURE__ */ jsx41(Typography12, { variant: "body2", children: "No spans to display" })
|
|
22499
|
+
}
|
|
22500
|
+
);
|
|
22501
|
+
}
|
|
22502
|
+
return /* @__PURE__ */ jsx41(TimelineErrorBoundary, { children: /* @__PURE__ */ jsxs26(
|
|
22503
|
+
Box21,
|
|
22504
|
+
{
|
|
22505
|
+
ref: containerRef,
|
|
22506
|
+
sx: {
|
|
22507
|
+
width: "100%",
|
|
22508
|
+
height: "100%",
|
|
22509
|
+
minHeight: 0,
|
|
22510
|
+
flex: 1,
|
|
22511
|
+
overflow: "auto",
|
|
22512
|
+
backgroundColor: theme2.palette.background.default,
|
|
22513
|
+
position: "relative",
|
|
22514
|
+
...sx
|
|
22515
|
+
},
|
|
22516
|
+
children: [
|
|
22517
|
+
enableZoom && /* @__PURE__ */ jsxs26(
|
|
22518
|
+
Box21,
|
|
22519
|
+
{
|
|
22520
|
+
sx: {
|
|
22521
|
+
position: "sticky",
|
|
22522
|
+
top: 4,
|
|
22523
|
+
right: 4,
|
|
22524
|
+
zIndex: 10,
|
|
22525
|
+
display: "flex",
|
|
22526
|
+
gap: 0.5,
|
|
22527
|
+
justifyContent: "flex-end",
|
|
22528
|
+
pr: 1,
|
|
22529
|
+
pt: 0.5
|
|
22530
|
+
},
|
|
22531
|
+
children: [
|
|
22532
|
+
/* @__PURE__ */ jsx41(Tooltip2, { title: "Zoom in", children: /* @__PURE__ */ jsx41(
|
|
22533
|
+
IconButton3,
|
|
22534
|
+
{
|
|
22535
|
+
size: "small",
|
|
22536
|
+
onClick: zoomIn,
|
|
22537
|
+
sx: {
|
|
22538
|
+
backgroundColor: theme2.palette.background.paper,
|
|
22539
|
+
"&:hover": { backgroundColor: theme2.palette.action.hover },
|
|
22540
|
+
fontSize: 16,
|
|
22541
|
+
fontWeight: "bold"
|
|
22542
|
+
},
|
|
22543
|
+
"aria-label": "Zoom in",
|
|
22544
|
+
children: "+"
|
|
22545
|
+
}
|
|
22546
|
+
) }),
|
|
22547
|
+
/* @__PURE__ */ jsx41(Tooltip2, { title: "Zoom out", children: /* @__PURE__ */ jsx41(
|
|
22548
|
+
IconButton3,
|
|
22549
|
+
{
|
|
22550
|
+
size: "small",
|
|
22551
|
+
onClick: zoomOut,
|
|
22552
|
+
sx: {
|
|
22553
|
+
backgroundColor: theme2.palette.background.paper,
|
|
22554
|
+
"&:hover": { backgroundColor: theme2.palette.action.hover },
|
|
22555
|
+
fontSize: 16,
|
|
22556
|
+
fontWeight: "bold"
|
|
22557
|
+
},
|
|
22558
|
+
"aria-label": "Zoom out",
|
|
22559
|
+
children: "\u2212"
|
|
22560
|
+
}
|
|
22561
|
+
) }),
|
|
22562
|
+
/* @__PURE__ */ jsx41(Tooltip2, { title: "Fit all", children: /* @__PURE__ */ jsx41(
|
|
22563
|
+
IconButton3,
|
|
22564
|
+
{
|
|
22565
|
+
size: "small",
|
|
22566
|
+
onClick: resetZoom,
|
|
22567
|
+
sx: {
|
|
22568
|
+
backgroundColor: theme2.palette.background.paper,
|
|
22569
|
+
"&:hover": { backgroundColor: theme2.palette.action.hover },
|
|
22570
|
+
fontSize: 12
|
|
22571
|
+
},
|
|
22572
|
+
"aria-label": "Fit all",
|
|
22573
|
+
children: "\u22A1"
|
|
22574
|
+
}
|
|
22575
|
+
) })
|
|
22576
|
+
]
|
|
22577
|
+
}
|
|
22578
|
+
),
|
|
22579
|
+
/* @__PURE__ */ jsxs26(
|
|
22580
|
+
"svg",
|
|
22581
|
+
{
|
|
22582
|
+
width: containerWidth,
|
|
22583
|
+
height: totalHeight,
|
|
22584
|
+
viewBox: viewState.scale !== 1 ? `${viewState.viewBox.x} ${viewState.viewBox.y} ${viewState.viewBox.width} ${viewState.viewBox.height}` : void 0,
|
|
22585
|
+
style: {
|
|
22586
|
+
display: "block",
|
|
22587
|
+
cursor: enablePan && viewState.isPanning ? "grabbing" : enablePan ? "grab" : "default",
|
|
22588
|
+
outline: "none"
|
|
22589
|
+
},
|
|
22590
|
+
role: "grid",
|
|
22591
|
+
"aria-label": "Trace timeline",
|
|
22592
|
+
tabIndex: 0,
|
|
22593
|
+
onKeyDown: handleKeyDown,
|
|
22594
|
+
onWheel: enableZoom ? onWheel : void 0,
|
|
22595
|
+
...enablePan ? panHandlers : {},
|
|
22596
|
+
children: [
|
|
22597
|
+
showRuler && /* @__PURE__ */ jsx41("g", { transform: `translate(${LABEL_WIDTH + PADDING}, ${PADDING})`, children: /* @__PURE__ */ jsx41(TimelineRuler, { ticks: rulerTicks, width: timelineWidth }) }),
|
|
22598
|
+
/* @__PURE__ */ jsx41(
|
|
22599
|
+
"g",
|
|
22600
|
+
{
|
|
22601
|
+
transform: `translate(${PADDING}, ${PADDING + (showRuler ? RULER_HEIGHT2 : 0)})`,
|
|
22602
|
+
children: visibleLayouts.map((layout) => /* @__PURE__ */ jsx41("g", { children: /* @__PURE__ */ jsx41(
|
|
22603
|
+
"text",
|
|
22604
|
+
{
|
|
22605
|
+
x: layout.depth * 12,
|
|
22606
|
+
y: layout.row * ROW_HEIGHT2 + ROW_HEIGHT2 / 2,
|
|
22607
|
+
dominantBaseline: "central",
|
|
22608
|
+
fontSize: 11,
|
|
22609
|
+
fill: theme2.palette.text.primary,
|
|
22610
|
+
style: {
|
|
22611
|
+
userSelect: "none",
|
|
22612
|
+
cursor: "pointer"
|
|
22613
|
+
},
|
|
22614
|
+
onClick: () => handleSelectSpan(layout.spanId),
|
|
22615
|
+
children: truncateLabel(layout.name, LABEL_WIDTH - layout.depth * 12 - 8)
|
|
22616
|
+
}
|
|
22617
|
+
) }, `label-${layout.spanId}`))
|
|
22618
|
+
}
|
|
22619
|
+
),
|
|
22620
|
+
/* @__PURE__ */ jsxs26(
|
|
22621
|
+
"g",
|
|
22622
|
+
{
|
|
22623
|
+
transform: `translate(${LABEL_WIDTH + PADDING}, ${PADDING + (showRuler ? RULER_HEIGHT2 : 0)})`,
|
|
22624
|
+
children: [
|
|
22625
|
+
rulerTicks.filter((tick) => tick.isMajor).map((tick, index) => /* @__PURE__ */ jsx41(
|
|
22626
|
+
"line",
|
|
22627
|
+
{
|
|
22628
|
+
x1: tick.position * timelineWidth,
|
|
22629
|
+
y1: 0,
|
|
22630
|
+
x2: tick.position * timelineWidth,
|
|
22631
|
+
y2: contentHeight,
|
|
22632
|
+
stroke: theme2.palette.divider,
|
|
22633
|
+
strokeWidth: 0.5,
|
|
22634
|
+
opacity: 0.5
|
|
22635
|
+
},
|
|
22636
|
+
`grid-${index}`
|
|
22637
|
+
)),
|
|
22638
|
+
visibleLayouts.map((layout) => /* @__PURE__ */ jsx41(
|
|
22639
|
+
"rect",
|
|
22640
|
+
{
|
|
22641
|
+
x: 0,
|
|
22642
|
+
y: layout.row * ROW_HEIGHT2,
|
|
22643
|
+
width: timelineWidth,
|
|
22644
|
+
height: ROW_HEIGHT2,
|
|
22645
|
+
fill: layout.row % 2 === 0 ? "transparent" : theme2.palette.action.hover,
|
|
22646
|
+
opacity: 0.3
|
|
22647
|
+
},
|
|
22648
|
+
`row-bg-${layout.spanId}`
|
|
22649
|
+
)),
|
|
22650
|
+
visibleLayouts.map((layout) => {
|
|
22651
|
+
const layoutIndex = layouts.findIndex((l) => l.spanId === layout.spanId);
|
|
22652
|
+
return /* @__PURE__ */ jsx41(
|
|
22653
|
+
TimelineBar,
|
|
22654
|
+
{
|
|
22655
|
+
layout,
|
|
22656
|
+
isSelected: selectedSpanId === layout.spanId,
|
|
22657
|
+
isFocused: focusedIndex === layoutIndex,
|
|
22658
|
+
onSelect: handleSelectSpan,
|
|
22659
|
+
onMouseEnter: handleBarMouseEnter,
|
|
22660
|
+
onMouseLeave: handleBarMouseLeave,
|
|
22661
|
+
timelineWidth
|
|
22662
|
+
},
|
|
22663
|
+
layout.spanId
|
|
22664
|
+
);
|
|
22665
|
+
})
|
|
22666
|
+
]
|
|
22667
|
+
}
|
|
22668
|
+
)
|
|
22669
|
+
]
|
|
22670
|
+
}
|
|
22671
|
+
),
|
|
22672
|
+
showLegend && /* @__PURE__ */ jsx41(
|
|
22673
|
+
TimelineLegend,
|
|
22674
|
+
{
|
|
22675
|
+
typeBreakdown: metrics.typeBreakdown,
|
|
22676
|
+
showCounts: true
|
|
22677
|
+
}
|
|
22678
|
+
),
|
|
22679
|
+
/* @__PURE__ */ jsx41(
|
|
22680
|
+
TimelineTooltip,
|
|
22681
|
+
{
|
|
22682
|
+
layout: tooltipData.layout,
|
|
22683
|
+
position: tooltipData.position,
|
|
22684
|
+
visible: tooltipData.layout !== null
|
|
22685
|
+
}
|
|
22686
|
+
)
|
|
22687
|
+
]
|
|
22688
|
+
}
|
|
22689
|
+
) });
|
|
22690
|
+
});
|
|
22691
|
+
function truncateLabel(label, maxWidth2) {
|
|
22692
|
+
const maxChars = Math.floor(maxWidth2 / 6);
|
|
22693
|
+
if (label.length <= maxChars) {
|
|
22694
|
+
return label;
|
|
22695
|
+
}
|
|
22696
|
+
return label.slice(0, maxChars - 3) + "...";
|
|
22697
|
+
}
|
|
22698
|
+
|
|
21098
22699
|
// src/sections/traces/trace-drawer/span-info/span-info-content.tsx
|
|
21099
|
-
import { Stack as
|
|
21100
|
-
import { jsx as
|
|
22700
|
+
import { Stack as Stack10, Typography as Typography13 } from "@mui/material";
|
|
22701
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
21101
22702
|
var SpanInfoTitle = ({ children }) => {
|
|
21102
|
-
return /* @__PURE__ */
|
|
22703
|
+
return /* @__PURE__ */ jsx42(Typography13, { variant: "h6", gutterBottom: true, children });
|
|
21103
22704
|
};
|
|
21104
22705
|
var SpanInfoContent = ({ children }) => {
|
|
21105
|
-
return /* @__PURE__ */
|
|
22706
|
+
return /* @__PURE__ */ jsx42(Stack10, { width: "100%", height: "100%", overflow: "hidden", children });
|
|
21106
22707
|
};
|
|
21107
22708
|
|
|
21108
22709
|
// src/sections/traces/trace-drawer/span-info/span-info-header.tsx
|
|
21109
|
-
import { Typography as
|
|
22710
|
+
import { Typography as Typography14, Stack as Stack11 } from "@mui/material";
|
|
21110
22711
|
|
|
21111
22712
|
// src/sections/traces/trace-drawer/span-info/span-info-provider.tsx
|
|
21112
22713
|
import { createContext as createContext3, useContext as useContext4 } from "react";
|
|
21113
22714
|
|
|
21114
22715
|
// src/sections/traces/trace-drawer/span-info/hooks/use-span-info.ts
|
|
21115
|
-
import { useState as
|
|
22716
|
+
import { useState as useState9, useEffect as useEffect6, useMemo as useMemo10 } from "react";
|
|
21116
22717
|
var useSpanInfo = ({ span }) => {
|
|
21117
|
-
const [activeTab, setActiveTab] =
|
|
21118
|
-
const [tabs, setTabs] =
|
|
21119
|
-
const isLLMCall =
|
|
22718
|
+
const [activeTab, setActiveTab] = useState9("attributes");
|
|
22719
|
+
const [tabs, setTabs] = useState9([]);
|
|
22720
|
+
const isLLMCall = useMemo10(() => {
|
|
21120
22721
|
return span?.data?.type === "GENERATION" || !!span?.data?.model;
|
|
21121
22722
|
}, [span?.data?.type, span?.data?.model]);
|
|
21122
|
-
|
|
22723
|
+
useEffect6(() => {
|
|
21123
22724
|
if (span?.id) {
|
|
21124
22725
|
const newTabs = [];
|
|
21125
22726
|
if (isLLMCall) {
|
|
@@ -21142,7 +22743,7 @@ var useSpanInfo = ({ span }) => {
|
|
|
21142
22743
|
setTabs(newTabs);
|
|
21143
22744
|
}
|
|
21144
22745
|
}, [span?.id, isLLMCall]);
|
|
21145
|
-
|
|
22746
|
+
useEffect6(() => {
|
|
21146
22747
|
const isTabValid = activeTab === "inputOutput" && isLLMCall || activeTab === "evaluation" || activeTab === "attributes";
|
|
21147
22748
|
if (!isTabValid) {
|
|
21148
22749
|
if (isLLMCall) {
|
|
@@ -21161,7 +22762,7 @@ var useSpanInfo = ({ span }) => {
|
|
|
21161
22762
|
};
|
|
21162
22763
|
|
|
21163
22764
|
// src/sections/traces/trace-drawer/span-info/span-info-provider.tsx
|
|
21164
|
-
import { jsx as
|
|
22765
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
21165
22766
|
var SpanInfoContext = createContext3(
|
|
21166
22767
|
void 0
|
|
21167
22768
|
);
|
|
@@ -21175,7 +22776,7 @@ var SpanInfoProvider = ({
|
|
|
21175
22776
|
if (!selectedSpan) {
|
|
21176
22777
|
return null;
|
|
21177
22778
|
}
|
|
21178
|
-
return /* @__PURE__ */
|
|
22779
|
+
return /* @__PURE__ */ jsx43(
|
|
21179
22780
|
SpanInfoContext.Provider,
|
|
21180
22781
|
{
|
|
21181
22782
|
value: {
|
|
@@ -21197,13 +22798,13 @@ var useSpanInfoContext = () => {
|
|
|
21197
22798
|
};
|
|
21198
22799
|
|
|
21199
22800
|
// src/sections/traces/trace-drawer/span-info/span-info-header.tsx
|
|
21200
|
-
import { jsxs as
|
|
22801
|
+
import { jsxs as jsxs27 } from "react/jsx-runtime";
|
|
21201
22802
|
var SpanInfoHeader = () => {
|
|
21202
22803
|
const { span } = useSpanInfoContext();
|
|
21203
22804
|
const { t } = useTraceDrawerContext();
|
|
21204
22805
|
const modelName = span.data.model;
|
|
21205
|
-
return /* @__PURE__ */
|
|
21206
|
-
|
|
22806
|
+
return /* @__PURE__ */ jsxs27(
|
|
22807
|
+
Stack11,
|
|
21207
22808
|
{
|
|
21208
22809
|
direction: "row",
|
|
21209
22810
|
spacing: 3,
|
|
@@ -21214,17 +22815,17 @@ var SpanInfoHeader = () => {
|
|
|
21214
22815
|
borderColor: "divider"
|
|
21215
22816
|
},
|
|
21216
22817
|
children: [
|
|
21217
|
-
/* @__PURE__ */
|
|
21218
|
-
/* @__PURE__ */
|
|
22818
|
+
/* @__PURE__ */ jsxs27(Typography14, { variant: "subtitle2", children: [
|
|
22819
|
+
/* @__PURE__ */ jsxs27(Typography14, { component: "span", color: "text.secondary", variant: "subtitle2", children: [
|
|
21219
22820
|
t("spanId"),
|
|
21220
22821
|
":"
|
|
21221
22822
|
] }),
|
|
21222
22823
|
" ",
|
|
21223
22824
|
span.id
|
|
21224
22825
|
] }),
|
|
21225
|
-
modelName && /* @__PURE__ */
|
|
21226
|
-
/* @__PURE__ */
|
|
21227
|
-
|
|
22826
|
+
modelName && /* @__PURE__ */ jsxs27(Typography14, { variant: "subtitle2", children: [
|
|
22827
|
+
/* @__PURE__ */ jsxs27(
|
|
22828
|
+
Typography14,
|
|
21228
22829
|
{
|
|
21229
22830
|
component: "span",
|
|
21230
22831
|
color: "text.secondary",
|
|
@@ -21246,17 +22847,17 @@ var SpanInfoHeader = () => {
|
|
|
21246
22847
|
// src/sections/traces/trace-drawer/span-info/span-info-tabs.tsx
|
|
21247
22848
|
import { Tab } from "@mui/material";
|
|
21248
22849
|
import { TabContext, TabList } from "@mui/lab";
|
|
21249
|
-
import { jsx as
|
|
22850
|
+
import { jsx as jsx44, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
21250
22851
|
var SpanInfoTabs = ({ children }) => {
|
|
21251
22852
|
const { activeTab, tabs, setActiveTab } = useSpanInfoContext();
|
|
21252
|
-
return /* @__PURE__ */
|
|
21253
|
-
/* @__PURE__ */
|
|
22853
|
+
return /* @__PURE__ */ jsxs28(TabContext, { value: activeTab, children: [
|
|
22854
|
+
/* @__PURE__ */ jsx44(
|
|
21254
22855
|
TabList,
|
|
21255
22856
|
{
|
|
21256
22857
|
onChange: (_, value) => setActiveTab(value),
|
|
21257
22858
|
scrollButtons: false,
|
|
21258
22859
|
sx: { borderBottom: 1, borderColor: "divider" },
|
|
21259
|
-
children: tabs.map((tab) => /* @__PURE__ */
|
|
22860
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsx44(Tab, { label: tab.label, value: tab.value }, tab.value))
|
|
21260
22861
|
}
|
|
21261
22862
|
),
|
|
21262
22863
|
children
|
|
@@ -21267,7 +22868,7 @@ var SpanInfoTabs = ({ children }) => {
|
|
|
21267
22868
|
import { TabPanel } from "@mui/lab";
|
|
21268
22869
|
|
|
21269
22870
|
// src/sections/traces/trace-drawer/span-info/tabs/hooks/use-span-attributes.ts
|
|
21270
|
-
import { useMemo as
|
|
22871
|
+
import { useMemo as useMemo11 } from "react";
|
|
21271
22872
|
|
|
21272
22873
|
// src/sections/traces/trace-drawer/span-info/tabs/attribute-transformer-registry.ts
|
|
21273
22874
|
var AttributeTransformerRegistry = class {
|
|
@@ -21573,7 +23174,7 @@ var transformAttributes = (attributes, normalizedData) => {
|
|
|
21573
23174
|
// src/sections/traces/trace-drawer/span-info/tabs/hooks/use-span-attributes.ts
|
|
21574
23175
|
var useSpanAttributes = () => {
|
|
21575
23176
|
const { selectedSpan } = useTraceDrawerContext();
|
|
21576
|
-
const rawAttributes =
|
|
23177
|
+
const rawAttributes = useMemo11(() => {
|
|
21577
23178
|
if (!selectedSpan?.data?.attributes) return {};
|
|
21578
23179
|
try {
|
|
21579
23180
|
return JSON.parse(selectedSpan.data.attributes);
|
|
@@ -21581,7 +23182,7 @@ var useSpanAttributes = () => {
|
|
|
21581
23182
|
return {};
|
|
21582
23183
|
}
|
|
21583
23184
|
}, [selectedSpan]);
|
|
21584
|
-
const transformedAttributes =
|
|
23185
|
+
const transformedAttributes = useMemo11(() => {
|
|
21585
23186
|
return transformAttributes(rawAttributes, selectedSpan?.data);
|
|
21586
23187
|
}, [rawAttributes, selectedSpan?.data]);
|
|
21587
23188
|
return {
|
|
@@ -21592,12 +23193,12 @@ var useSpanAttributes = () => {
|
|
|
21592
23193
|
};
|
|
21593
23194
|
|
|
21594
23195
|
// src/sections/traces/trace-drawer/span-info/tabs/attributes-tab/attributes-viewer.tsx
|
|
21595
|
-
import { Box as
|
|
23196
|
+
import { Box as Box22 } from "@mui/material";
|
|
21596
23197
|
import CodeMirror2 from "@uiw/react-codemirror";
|
|
21597
23198
|
import { json as json2 } from "@codemirror/lang-json";
|
|
21598
|
-
import { jsx as
|
|
21599
|
-
var AttributesViewer = ({ attributes }) => /* @__PURE__ */
|
|
21600
|
-
|
|
23199
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
23200
|
+
var AttributesViewer = ({ attributes }) => /* @__PURE__ */ jsx45(Box22, { position: "relative", children: /* @__PURE__ */ jsx45(
|
|
23201
|
+
Box22,
|
|
21601
23202
|
{
|
|
21602
23203
|
position: "absolute",
|
|
21603
23204
|
left: 0,
|
|
@@ -21612,7 +23213,7 @@ var AttributesViewer = ({ attributes }) => /* @__PURE__ */ jsx39(Box17, { positi
|
|
|
21612
23213
|
overflow: "hidden"
|
|
21613
23214
|
}
|
|
21614
23215
|
},
|
|
21615
|
-
children: /* @__PURE__ */
|
|
23216
|
+
children: /* @__PURE__ */ jsx45(
|
|
21616
23217
|
CodeMirror2,
|
|
21617
23218
|
{
|
|
21618
23219
|
value: JSON.stringify(attributes, null, 2),
|
|
@@ -21635,11 +23236,11 @@ var AttributesViewer = ({ attributes }) => /* @__PURE__ */ jsx39(Box17, { positi
|
|
|
21635
23236
|
) });
|
|
21636
23237
|
|
|
21637
23238
|
// src/sections/traces/trace-drawer/span-info/tabs/attributes-tab/attributes-tab.tsx
|
|
21638
|
-
import { jsx as
|
|
23239
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
21639
23240
|
var AttributesTab = () => {
|
|
21640
23241
|
const { transformedAttributes } = useSpanAttributes();
|
|
21641
23242
|
const Panel = ({ children }) => {
|
|
21642
|
-
return /* @__PURE__ */
|
|
23243
|
+
return /* @__PURE__ */ jsx46(
|
|
21643
23244
|
TabPanel,
|
|
21644
23245
|
{
|
|
21645
23246
|
value: "attributes",
|
|
@@ -21653,11 +23254,11 @@ var AttributesTab = () => {
|
|
|
21653
23254
|
}
|
|
21654
23255
|
);
|
|
21655
23256
|
};
|
|
21656
|
-
return /* @__PURE__ */
|
|
23257
|
+
return /* @__PURE__ */ jsx46(Panel, { children: /* @__PURE__ */ jsx46(AttributesViewer, { attributes: transformedAttributes }) });
|
|
21657
23258
|
};
|
|
21658
23259
|
|
|
21659
23260
|
// src/sections/traces/trace-drawer/span-info/tabs/hooks/use-span-prompts.ts
|
|
21660
|
-
import { useMemo as
|
|
23261
|
+
import { useMemo as useMemo12 } from "react";
|
|
21661
23262
|
var extractPromptsFromSpan = (span) => {
|
|
21662
23263
|
if (!span?.data?.input) return [];
|
|
21663
23264
|
try {
|
|
@@ -21700,10 +23301,10 @@ var extractOutputFromSpan = (span) => {
|
|
|
21700
23301
|
};
|
|
21701
23302
|
var useSpanPrompts = () => {
|
|
21702
23303
|
const { selectedSpan } = useTraceDrawerContext();
|
|
21703
|
-
const prompts =
|
|
23304
|
+
const prompts = useMemo12(() => {
|
|
21704
23305
|
return extractPromptsFromSpan(selectedSpan);
|
|
21705
23306
|
}, [selectedSpan]);
|
|
21706
|
-
const outputData =
|
|
23307
|
+
const outputData = useMemo12(() => {
|
|
21707
23308
|
return extractOutputFromSpan(selectedSpan);
|
|
21708
23309
|
}, [selectedSpan]);
|
|
21709
23310
|
return {
|
|
@@ -21714,24 +23315,24 @@ var useSpanPrompts = () => {
|
|
|
21714
23315
|
};
|
|
21715
23316
|
|
|
21716
23317
|
// src/sections/traces/trace-drawer/span-info/tabs/input-output-tab/prompt-list.tsx
|
|
21717
|
-
import { Box as
|
|
23318
|
+
import { Box as Box25 } from "@mui/material";
|
|
21718
23319
|
|
|
21719
23320
|
// src/sections/traces/trace-drawer/span-info/tabs/span-prompt.tsx
|
|
21720
23321
|
import {
|
|
21721
23322
|
Accordion,
|
|
21722
23323
|
AccordionDetails,
|
|
21723
23324
|
AccordionSummary,
|
|
21724
|
-
Typography as
|
|
21725
|
-
Box as
|
|
23325
|
+
Typography as Typography16,
|
|
23326
|
+
Box as Box24
|
|
21726
23327
|
} from "@mui/material";
|
|
21727
23328
|
|
|
21728
23329
|
// src/sections/traces/trace-drawer/span-info/tabs/markdown-renderer.tsx
|
|
21729
|
-
import { Box as
|
|
23330
|
+
import { Box as Box23, Typography as Typography15 } from "@mui/material";
|
|
21730
23331
|
import ReactMarkdown from "react-markdown";
|
|
21731
|
-
import { jsx as
|
|
23332
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
21732
23333
|
var CodeBlock = ({ children }) => {
|
|
21733
|
-
return /* @__PURE__ */
|
|
21734
|
-
|
|
23334
|
+
return /* @__PURE__ */ jsx47(
|
|
23335
|
+
Box23,
|
|
21735
23336
|
{
|
|
21736
23337
|
component: "pre",
|
|
21737
23338
|
sx: {
|
|
@@ -21746,16 +23347,16 @@ var CodeBlock = ({ children }) => {
|
|
|
21746
23347
|
display: "block"
|
|
21747
23348
|
}
|
|
21748
23349
|
},
|
|
21749
|
-
children: /* @__PURE__ */
|
|
23350
|
+
children: /* @__PURE__ */ jsx47("code", { children })
|
|
21750
23351
|
}
|
|
21751
23352
|
);
|
|
21752
23353
|
};
|
|
21753
|
-
var MarkdownRenderer = ({ content }) => /* @__PURE__ */
|
|
23354
|
+
var MarkdownRenderer = ({ content }) => /* @__PURE__ */ jsx47(
|
|
21754
23355
|
ReactMarkdown,
|
|
21755
23356
|
{
|
|
21756
23357
|
components: {
|
|
21757
|
-
p: ({ children }) => /* @__PURE__ */
|
|
21758
|
-
|
|
23358
|
+
p: ({ children }) => /* @__PURE__ */ jsx47(
|
|
23359
|
+
Typography15,
|
|
21759
23360
|
{
|
|
21760
23361
|
variant: "body2",
|
|
21761
23362
|
sx: {
|
|
@@ -21765,10 +23366,10 @@ var MarkdownRenderer = ({ content }) => /* @__PURE__ */ jsx41(
|
|
|
21765
23366
|
children
|
|
21766
23367
|
}
|
|
21767
23368
|
),
|
|
21768
|
-
pre: ({ children }) => /* @__PURE__ */
|
|
23369
|
+
pre: ({ children }) => /* @__PURE__ */ jsx47(CodeBlock, { children }),
|
|
21769
23370
|
code: (props) => {
|
|
21770
|
-
return /* @__PURE__ */
|
|
21771
|
-
|
|
23371
|
+
return /* @__PURE__ */ jsx47(
|
|
23372
|
+
Typography15,
|
|
21772
23373
|
{
|
|
21773
23374
|
component: "code",
|
|
21774
23375
|
sx: {
|
|
@@ -21781,8 +23382,8 @@ var MarkdownRenderer = ({ content }) => /* @__PURE__ */ jsx41(
|
|
|
21781
23382
|
}
|
|
21782
23383
|
);
|
|
21783
23384
|
},
|
|
21784
|
-
strong: ({ children }) => /* @__PURE__ */
|
|
21785
|
-
|
|
23385
|
+
strong: ({ children }) => /* @__PURE__ */ jsx47(
|
|
23386
|
+
Typography15,
|
|
21786
23387
|
{
|
|
21787
23388
|
component: "span",
|
|
21788
23389
|
sx: {
|
|
@@ -21798,7 +23399,7 @@ var MarkdownRenderer = ({ content }) => /* @__PURE__ */ jsx41(
|
|
|
21798
23399
|
);
|
|
21799
23400
|
|
|
21800
23401
|
// src/sections/traces/trace-drawer/span-info/tabs/span-prompt.tsx
|
|
21801
|
-
import { jsx as
|
|
23402
|
+
import { jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
21802
23403
|
var formatToolCall = (content) => {
|
|
21803
23404
|
if (content.type === "tool-call") {
|
|
21804
23405
|
return `**Tool Call**: \`${content.toolName}\`
|
|
@@ -21846,44 +23447,44 @@ var SpanPrompt = ({ prompt }) => {
|
|
|
21846
23447
|
return role;
|
|
21847
23448
|
}
|
|
21848
23449
|
};
|
|
21849
|
-
return /* @__PURE__ */
|
|
21850
|
-
/* @__PURE__ */
|
|
23450
|
+
return /* @__PURE__ */ jsxs29(Accordion, { sx: { backgroundColor: "white" }, defaultExpanded: true, children: [
|
|
23451
|
+
/* @__PURE__ */ jsx48(
|
|
21851
23452
|
AccordionSummary,
|
|
21852
23453
|
{
|
|
21853
|
-
expandIcon: /* @__PURE__ */
|
|
23454
|
+
expandIcon: /* @__PURE__ */ jsx48(Iconify, { icon: "mdi:chevron-down" }),
|
|
21854
23455
|
sx: {
|
|
21855
23456
|
"& .MuiAccordionSummary-content": {
|
|
21856
23457
|
alignItems: "center"
|
|
21857
23458
|
}
|
|
21858
23459
|
},
|
|
21859
|
-
children: /* @__PURE__ */
|
|
21860
|
-
/* @__PURE__ */
|
|
23460
|
+
children: /* @__PURE__ */ jsxs29(Box24, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
23461
|
+
/* @__PURE__ */ jsx48(
|
|
21861
23462
|
Iconify,
|
|
21862
23463
|
{
|
|
21863
23464
|
icon: prompt.role === "system" ? "mdi:cog" : prompt.role === "user" ? "mdi:account" : prompt.role === "assistant" ? "mdi:robot" : prompt.role === "tool" ? "mdi:tools" : "mdi:message"
|
|
21864
23465
|
}
|
|
21865
23466
|
),
|
|
21866
|
-
/* @__PURE__ */
|
|
23467
|
+
/* @__PURE__ */ jsx48(Typography16, { fontWeight: 700, variant: "body2", children: getTitle(prompt.role) })
|
|
21867
23468
|
] })
|
|
21868
23469
|
}
|
|
21869
23470
|
),
|
|
21870
|
-
/* @__PURE__ */
|
|
23471
|
+
/* @__PURE__ */ jsx48(AccordionDetails, { children: /* @__PURE__ */ jsx48(MarkdownRenderer, { content }) })
|
|
21871
23472
|
] });
|
|
21872
23473
|
};
|
|
21873
23474
|
|
|
21874
23475
|
// src/sections/traces/trace-drawer/span-info/tabs/input-output-tab/prompt-list.tsx
|
|
21875
|
-
import { jsx as
|
|
21876
|
-
var PromptList = ({ prompts }) => /* @__PURE__ */
|
|
23476
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
23477
|
+
var PromptList = ({ prompts }) => /* @__PURE__ */ jsx49(Box25, { children: prompts.map((prompt, index) => /* @__PURE__ */ jsx49(SpanPrompt, { prompt }, index)) });
|
|
21877
23478
|
|
|
21878
23479
|
// src/sections/traces/trace-drawer/span-info/tabs/output-accordion.tsx
|
|
21879
23480
|
import {
|
|
21880
23481
|
Accordion as Accordion2,
|
|
21881
23482
|
AccordionDetails as AccordionDetails2,
|
|
21882
23483
|
AccordionSummary as AccordionSummary2,
|
|
21883
|
-
Typography as
|
|
21884
|
-
Box as
|
|
23484
|
+
Typography as Typography17,
|
|
23485
|
+
Box as Box26
|
|
21885
23486
|
} from "@mui/material";
|
|
21886
|
-
import { jsx as
|
|
23487
|
+
import { jsx as jsx50, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
21887
23488
|
var formatToolCalls = (toolCallsStr) => {
|
|
21888
23489
|
if (!toolCallsStr) return null;
|
|
21889
23490
|
try {
|
|
@@ -21967,46 +23568,46 @@ var OutputAccordion = ({ outputData }) => {
|
|
|
21967
23568
|
const content = outputData?.text || toolCallsText || toolCallText || objectResponse;
|
|
21968
23569
|
const isObjectResponse = !!outputData?.objectResponse;
|
|
21969
23570
|
const isToolResponse = !!(outputData?.toolCall?.name || outputData?.toolCall?.toolName);
|
|
21970
|
-
return /* @__PURE__ */
|
|
21971
|
-
/* @__PURE__ */
|
|
23571
|
+
return /* @__PURE__ */ jsxs30(Accordion2, { sx: { backgroundColor: "white" }, defaultExpanded: true, children: [
|
|
23572
|
+
/* @__PURE__ */ jsx50(
|
|
21972
23573
|
AccordionSummary2,
|
|
21973
23574
|
{
|
|
21974
|
-
expandIcon: /* @__PURE__ */
|
|
23575
|
+
expandIcon: /* @__PURE__ */ jsx50(Iconify, { icon: "mdi:chevron-down" }),
|
|
21975
23576
|
sx: {
|
|
21976
23577
|
"& .MuiAccordionSummary-content": {
|
|
21977
23578
|
alignItems: "center"
|
|
21978
23579
|
}
|
|
21979
23580
|
},
|
|
21980
|
-
children: /* @__PURE__ */
|
|
21981
|
-
/* @__PURE__ */
|
|
23581
|
+
children: /* @__PURE__ */ jsxs30(Box26, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
23582
|
+
/* @__PURE__ */ jsx50(
|
|
21982
23583
|
Iconify,
|
|
21983
23584
|
{
|
|
21984
23585
|
icon: isToolResponse ? "mdi:tools" : isObjectResponse ? "mdi:code-json" : "mdi:robot"
|
|
21985
23586
|
}
|
|
21986
23587
|
),
|
|
21987
|
-
/* @__PURE__ */
|
|
23588
|
+
/* @__PURE__ */ jsx50(Typography17, { fontWeight: 700, variant: "body2", children: isToolResponse ? t("tool") : t("assistant") })
|
|
21988
23589
|
] })
|
|
21989
23590
|
}
|
|
21990
23591
|
),
|
|
21991
|
-
/* @__PURE__ */
|
|
23592
|
+
/* @__PURE__ */ jsx50(AccordionDetails2, { children: content ? /* @__PURE__ */ jsx50(MarkdownRenderer, { content }) : /* @__PURE__ */ jsx50(Typography17, { variant: "body2", children: t("noOutput") }) })
|
|
21992
23593
|
] });
|
|
21993
23594
|
};
|
|
21994
23595
|
|
|
21995
23596
|
// src/sections/traces/trace-drawer/span-info/tabs/input-output-tab/output-display.tsx
|
|
21996
|
-
import { jsx as
|
|
23597
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
21997
23598
|
var OutputDisplay = ({ outputData }) => {
|
|
21998
23599
|
if (!outputData) return null;
|
|
21999
|
-
return /* @__PURE__ */
|
|
23600
|
+
return /* @__PURE__ */ jsx51(OutputAccordion, { outputData });
|
|
22000
23601
|
};
|
|
22001
23602
|
|
|
22002
23603
|
// src/sections/traces/trace-drawer/span-info/tabs/input-output-tab/input-output-tab.tsx
|
|
22003
23604
|
import { TabPanel as TabPanel2 } from "@mui/lab";
|
|
22004
23605
|
import { Alert } from "@mui/material";
|
|
22005
|
-
import { jsx as
|
|
23606
|
+
import { jsx as jsx52, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
22006
23607
|
var InputOutputTab = () => {
|
|
22007
23608
|
const { prompts, outputData } = useSpanPrompts();
|
|
22008
23609
|
const { span } = useSpanInfoContext();
|
|
22009
|
-
return /* @__PURE__ */
|
|
23610
|
+
return /* @__PURE__ */ jsxs31(
|
|
22010
23611
|
TabPanel2,
|
|
22011
23612
|
{
|
|
22012
23613
|
sx: {
|
|
@@ -22019,9 +23620,9 @@ var InputOutputTab = () => {
|
|
|
22019
23620
|
},
|
|
22020
23621
|
value: "inputOutput",
|
|
22021
23622
|
children: [
|
|
22022
|
-
/* @__PURE__ */
|
|
22023
|
-
/* @__PURE__ */
|
|
22024
|
-
span.data.statusMessage && /* @__PURE__ */
|
|
23623
|
+
/* @__PURE__ */ jsx52(PromptList, { prompts }),
|
|
23624
|
+
/* @__PURE__ */ jsx52(OutputDisplay, { outputData }),
|
|
23625
|
+
span.data.statusMessage && /* @__PURE__ */ jsx52(Alert, { severity: "error", sx: { mt: 2 }, children: span.data.statusMessage })
|
|
22025
23626
|
]
|
|
22026
23627
|
}
|
|
22027
23628
|
);
|
|
@@ -22029,9 +23630,9 @@ var InputOutputTab = () => {
|
|
|
22029
23630
|
|
|
22030
23631
|
// src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/evaluation-tab.tsx
|
|
22031
23632
|
import { TabPanel as TabPanel3 } from "@mui/lab";
|
|
22032
|
-
import { jsx as
|
|
23633
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
22033
23634
|
var EvaluationTab = ({ children }) => {
|
|
22034
|
-
return /* @__PURE__ */
|
|
23635
|
+
return /* @__PURE__ */ jsx53(
|
|
22035
23636
|
TabPanel3,
|
|
22036
23637
|
{
|
|
22037
23638
|
value: "evaluation",
|
|
@@ -22048,20 +23649,20 @@ var EvaluationTab = ({ children }) => {
|
|
|
22048
23649
|
|
|
22049
23650
|
// src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/evaluation-list.tsx
|
|
22050
23651
|
import {
|
|
22051
|
-
Box as
|
|
23652
|
+
Box as Box28,
|
|
22052
23653
|
Table as Table4,
|
|
22053
23654
|
TableBody as TableBody4,
|
|
22054
23655
|
TableCell as TableCell9,
|
|
22055
23656
|
TableContainer as TableContainer4,
|
|
22056
23657
|
TableHead as TableHead3,
|
|
22057
23658
|
TableRow as TableRow9,
|
|
22058
|
-
Paper as
|
|
23659
|
+
Paper as Paper3
|
|
22059
23660
|
} from "@mui/material";
|
|
22060
23661
|
|
|
22061
23662
|
// src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/evaluation-item.tsx
|
|
22062
|
-
import { Chip as
|
|
23663
|
+
import { Chip as Chip3, TableCell as TableCell7 } from "@mui/material";
|
|
22063
23664
|
import { TableRow as TableRow7 } from "@mui/material";
|
|
22064
|
-
import { jsx as
|
|
23665
|
+
import { jsx as jsx54, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
22065
23666
|
var EvaluationItem = ({
|
|
22066
23667
|
name,
|
|
22067
23668
|
score,
|
|
@@ -22069,13 +23670,13 @@ var EvaluationItem = ({
|
|
|
22069
23670
|
reason,
|
|
22070
23671
|
source
|
|
22071
23672
|
}) => {
|
|
22072
|
-
return /* @__PURE__ */
|
|
22073
|
-
/* @__PURE__ */
|
|
22074
|
-
/* @__PURE__ */
|
|
22075
|
-
/* @__PURE__ */
|
|
22076
|
-
/* @__PURE__ */
|
|
22077
|
-
/* @__PURE__ */
|
|
22078
|
-
|
|
23673
|
+
return /* @__PURE__ */ jsxs32(TableRow7, { children: [
|
|
23674
|
+
/* @__PURE__ */ jsx54(TableCell7, { children: name || "-" }),
|
|
23675
|
+
/* @__PURE__ */ jsx54(TableCell7, { children: score }),
|
|
23676
|
+
/* @__PURE__ */ jsx54(TableCell7, { children: label }),
|
|
23677
|
+
/* @__PURE__ */ jsx54(TableCell7, { sx: { whiteSpace: "pre-wrap" }, children: reason }),
|
|
23678
|
+
/* @__PURE__ */ jsx54(TableCell7, { children: /* @__PURE__ */ jsx54(
|
|
23679
|
+
Chip3,
|
|
22079
23680
|
{
|
|
22080
23681
|
size: "small",
|
|
22081
23682
|
label: source || "eval",
|
|
@@ -22090,9 +23691,9 @@ var EvaluationItem = ({
|
|
|
22090
23691
|
import {
|
|
22091
23692
|
createContext as createContext4,
|
|
22092
23693
|
useContext as useContext5,
|
|
22093
|
-
useState as
|
|
23694
|
+
useState as useState10
|
|
22094
23695
|
} from "react";
|
|
22095
|
-
import { jsx as
|
|
23696
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
22096
23697
|
var EvaluationContext = createContext4(
|
|
22097
23698
|
void 0
|
|
22098
23699
|
);
|
|
@@ -22111,8 +23712,8 @@ var EvaluationProvider = ({
|
|
|
22111
23712
|
scores,
|
|
22112
23713
|
isLoading
|
|
22113
23714
|
}) => {
|
|
22114
|
-
const [openAddAnnotationDialog, setOpenAddAnnotationDialog] =
|
|
22115
|
-
return /* @__PURE__ */
|
|
23715
|
+
const [openAddAnnotationDialog, setOpenAddAnnotationDialog] = useState10(false);
|
|
23716
|
+
return /* @__PURE__ */ jsx55(
|
|
22116
23717
|
EvaluationContext.Provider,
|
|
22117
23718
|
{
|
|
22118
23719
|
value: {
|
|
@@ -22129,77 +23730,77 @@ var EvaluationProvider = ({
|
|
|
22129
23730
|
|
|
22130
23731
|
// src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/evaluation-skeleton.tsx
|
|
22131
23732
|
import {
|
|
22132
|
-
Box as
|
|
23733
|
+
Box as Box27,
|
|
22133
23734
|
Table as Table3,
|
|
22134
23735
|
TableBody as TableBody3,
|
|
22135
23736
|
TableCell as TableCell8,
|
|
22136
23737
|
TableContainer as TableContainer3,
|
|
22137
23738
|
TableHead as TableHead2,
|
|
22138
23739
|
TableRow as TableRow8,
|
|
22139
|
-
Paper,
|
|
22140
|
-
Stack as
|
|
22141
|
-
Skeleton as
|
|
23740
|
+
Paper as Paper2,
|
|
23741
|
+
Stack as Stack12,
|
|
23742
|
+
Skeleton as Skeleton4
|
|
22142
23743
|
} from "@mui/material";
|
|
22143
|
-
import { jsx as
|
|
23744
|
+
import { jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
22144
23745
|
var EvaluationSkeleton = () => {
|
|
22145
23746
|
const { canAddAnnotation, isLoading, scores } = useEvaluationContext();
|
|
22146
23747
|
const { t } = useTraceDrawerContext();
|
|
22147
23748
|
if (!isLoading || scores.length > 0) {
|
|
22148
23749
|
return null;
|
|
22149
23750
|
}
|
|
22150
|
-
return /* @__PURE__ */
|
|
22151
|
-
/* @__PURE__ */
|
|
22152
|
-
|
|
23751
|
+
return /* @__PURE__ */ jsxs33(Box27, { children: [
|
|
23752
|
+
/* @__PURE__ */ jsxs33(
|
|
23753
|
+
Stack12,
|
|
22153
23754
|
{
|
|
22154
23755
|
direction: "row",
|
|
22155
23756
|
justifyContent: "space-between",
|
|
22156
23757
|
alignItems: "center",
|
|
22157
23758
|
sx: { mb: 1 },
|
|
22158
23759
|
children: [
|
|
22159
|
-
/* @__PURE__ */
|
|
22160
|
-
canAddAnnotation && /* @__PURE__ */
|
|
23760
|
+
/* @__PURE__ */ jsx56(Box27, {}),
|
|
23761
|
+
canAddAnnotation && /* @__PURE__ */ jsx56(Skeleton4, { variant: "rounded", width: 120, height: 32 })
|
|
22161
23762
|
]
|
|
22162
23763
|
}
|
|
22163
23764
|
),
|
|
22164
|
-
/* @__PURE__ */
|
|
22165
|
-
/* @__PURE__ */
|
|
22166
|
-
/* @__PURE__ */
|
|
22167
|
-
/* @__PURE__ */
|
|
22168
|
-
/* @__PURE__ */
|
|
22169
|
-
/* @__PURE__ */
|
|
22170
|
-
/* @__PURE__ */
|
|
23765
|
+
/* @__PURE__ */ jsx56(TableContainer3, { component: Paper2, variant: "outlined", children: /* @__PURE__ */ jsxs33(Table3, { children: [
|
|
23766
|
+
/* @__PURE__ */ jsx56(TableHead2, { children: /* @__PURE__ */ jsxs33(TableRow8, { children: [
|
|
23767
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: t("evaluationName") }),
|
|
23768
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: t("evaluationScore") }),
|
|
23769
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: t("evaluationLabel") }),
|
|
23770
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: t("evaluationReason") }),
|
|
23771
|
+
/* @__PURE__ */ jsx56(TableCell8, { width: 120, children: "Source" })
|
|
22171
23772
|
] }) }),
|
|
22172
|
-
/* @__PURE__ */
|
|
22173
|
-
/* @__PURE__ */
|
|
22174
|
-
/* @__PURE__ */
|
|
22175
|
-
/* @__PURE__ */
|
|
22176
|
-
/* @__PURE__ */
|
|
22177
|
-
/* @__PURE__ */
|
|
23773
|
+
/* @__PURE__ */ jsx56(TableBody3, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs33(TableRow8, { children: [
|
|
23774
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: /* @__PURE__ */ jsx56(Skeleton4, { variant: "text", width: "60%" }) }),
|
|
23775
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: /* @__PURE__ */ jsx56(Skeleton4, { variant: "text", width: "40%" }) }),
|
|
23776
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: /* @__PURE__ */ jsx56(Skeleton4, { variant: "text", width: "50%" }) }),
|
|
23777
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: /* @__PURE__ */ jsx56(Skeleton4, { variant: "text", width: "80%" }) }),
|
|
23778
|
+
/* @__PURE__ */ jsx56(TableCell8, { children: /* @__PURE__ */ jsx56(Skeleton4, { variant: "text", width: "60%" }) })
|
|
22178
23779
|
] }, index)) })
|
|
22179
23780
|
] }) })
|
|
22180
23781
|
] });
|
|
22181
23782
|
};
|
|
22182
23783
|
|
|
22183
23784
|
// src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/evaluation-list.tsx
|
|
22184
|
-
import { jsx as
|
|
23785
|
+
import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
22185
23786
|
var EvaluationList = ({
|
|
22186
23787
|
emptyContentImgUrl
|
|
22187
23788
|
}) => {
|
|
22188
23789
|
const { scores, isLoading } = useEvaluationContext();
|
|
22189
23790
|
const { t } = useTraceDrawerContext();
|
|
22190
23791
|
if (isLoading) {
|
|
22191
|
-
return /* @__PURE__ */
|
|
22192
|
-
}
|
|
22193
|
-
return /* @__PURE__ */
|
|
22194
|
-
/* @__PURE__ */
|
|
22195
|
-
/* @__PURE__ */
|
|
22196
|
-
/* @__PURE__ */
|
|
22197
|
-
/* @__PURE__ */
|
|
22198
|
-
/* @__PURE__ */
|
|
22199
|
-
/* @__PURE__ */
|
|
23792
|
+
return /* @__PURE__ */ jsx57(EvaluationSkeleton, {});
|
|
23793
|
+
}
|
|
23794
|
+
return /* @__PURE__ */ jsx57(Box28, { children: /* @__PURE__ */ jsx57(TableContainer4, { component: Paper3, variant: "outlined", children: /* @__PURE__ */ jsxs34(Table4, { children: [
|
|
23795
|
+
/* @__PURE__ */ jsx57(TableHead3, { children: /* @__PURE__ */ jsxs34(TableRow9, { children: [
|
|
23796
|
+
/* @__PURE__ */ jsx57(TableCell9, { children: t("evaluationName") }),
|
|
23797
|
+
/* @__PURE__ */ jsx57(TableCell9, { children: t("evaluationScore") }),
|
|
23798
|
+
/* @__PURE__ */ jsx57(TableCell9, { children: t("evaluationLabel") }),
|
|
23799
|
+
/* @__PURE__ */ jsx57(TableCell9, { children: t("evaluationReason") }),
|
|
23800
|
+
/* @__PURE__ */ jsx57(TableCell9, { width: 120, children: "Source" })
|
|
22200
23801
|
] }) }),
|
|
22201
|
-
/* @__PURE__ */
|
|
22202
|
-
scores.map((scoreData, index) => /* @__PURE__ */
|
|
23802
|
+
/* @__PURE__ */ jsxs34(TableBody4, { children: [
|
|
23803
|
+
scores.map((scoreData, index) => /* @__PURE__ */ jsx57(
|
|
22203
23804
|
EvaluationItem,
|
|
22204
23805
|
{
|
|
22205
23806
|
name: scoreData.name,
|
|
@@ -22210,7 +23811,7 @@ var EvaluationList = ({
|
|
|
22210
23811
|
},
|
|
22211
23812
|
index
|
|
22212
23813
|
)),
|
|
22213
|
-
/* @__PURE__ */
|
|
23814
|
+
/* @__PURE__ */ jsx57(
|
|
22214
23815
|
TableNoData,
|
|
22215
23816
|
{
|
|
22216
23817
|
title: t("noEvaluationData"),
|
|
@@ -22224,8 +23825,8 @@ var EvaluationList = ({
|
|
|
22224
23825
|
};
|
|
22225
23826
|
|
|
22226
23827
|
// src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/add-annotations.tsx
|
|
22227
|
-
import { Button } from "@mui/material";
|
|
22228
|
-
import { Fragment as
|
|
23828
|
+
import { Button as Button2 } from "@mui/material";
|
|
23829
|
+
import { Fragment as Fragment4, jsx as jsx58 } from "react/jsx-runtime";
|
|
22229
23830
|
var AddAnnotations = () => {
|
|
22230
23831
|
const { t } = useTraceDrawerContext();
|
|
22231
23832
|
const { setOpenAddAnnotationDialog, canAddAnnotation } = useEvaluationContext();
|
|
@@ -22235,7 +23836,7 @@ var AddAnnotations = () => {
|
|
|
22235
23836
|
if (!canAddAnnotation) {
|
|
22236
23837
|
return null;
|
|
22237
23838
|
}
|
|
22238
|
-
return /* @__PURE__ */
|
|
23839
|
+
return /* @__PURE__ */ jsx58(Fragment4, { children: /* @__PURE__ */ jsx58(Button2, { size: "small", variant: "outlined", onClick: handleAddAnnotation, children: t("addAnnotation") }) });
|
|
22239
23840
|
};
|
|
22240
23841
|
|
|
22241
23842
|
// src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/add-annotation-dialog.tsx
|
|
@@ -22244,14 +23845,14 @@ import {
|
|
|
22244
23845
|
DialogTitle,
|
|
22245
23846
|
DialogContent,
|
|
22246
23847
|
DialogActions,
|
|
22247
|
-
Button as
|
|
22248
|
-
Stack as
|
|
23848
|
+
Button as Button3,
|
|
23849
|
+
Stack as Stack13
|
|
22249
23850
|
} from "@mui/material";
|
|
22250
23851
|
import { LoadingButton } from "@mui/lab";
|
|
22251
23852
|
import * as Yup from "yup";
|
|
22252
23853
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
22253
23854
|
import { useForm } from "react-hook-form";
|
|
22254
|
-
import { jsx as
|
|
23855
|
+
import { jsx as jsx59, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
22255
23856
|
function AddAnnotationDialog({ saveAnnotation }) {
|
|
22256
23857
|
const {
|
|
22257
23858
|
setOpenAddAnnotationDialog,
|
|
@@ -22298,7 +23899,7 @@ function AddAnnotationDialog({ saveAnnotation }) {
|
|
|
22298
23899
|
setOpenAddAnnotationDialog(false);
|
|
22299
23900
|
}
|
|
22300
23901
|
};
|
|
22301
|
-
return /* @__PURE__ */
|
|
23902
|
+
return /* @__PURE__ */ jsxs35(
|
|
22302
23903
|
Dialog,
|
|
22303
23904
|
{
|
|
22304
23905
|
open: openAddAnnotationDialog,
|
|
@@ -22306,10 +23907,10 @@ function AddAnnotationDialog({ saveAnnotation }) {
|
|
|
22306
23907
|
fullWidth: true,
|
|
22307
23908
|
maxWidth: "sm",
|
|
22308
23909
|
children: [
|
|
22309
|
-
/* @__PURE__ */
|
|
22310
|
-
/* @__PURE__ */
|
|
22311
|
-
/* @__PURE__ */
|
|
22312
|
-
/* @__PURE__ */
|
|
23910
|
+
/* @__PURE__ */ jsx59(DialogTitle, { children: t("addAnnotationTitle") }),
|
|
23911
|
+
/* @__PURE__ */ jsxs35(FormProvider, { methods, onSubmit, children: [
|
|
23912
|
+
/* @__PURE__ */ jsx59(DialogContent, { dividers: true, children: /* @__PURE__ */ jsxs35(Stack13, { spacing: 2, sx: { mt: 1 }, children: [
|
|
23913
|
+
/* @__PURE__ */ jsx59(
|
|
22313
23914
|
RHFTextField,
|
|
22314
23915
|
{
|
|
22315
23916
|
name: "name",
|
|
@@ -22317,7 +23918,7 @@ function AddAnnotationDialog({ saveAnnotation }) {
|
|
|
22317
23918
|
placeholder: t("annotationNamePlaceholder")
|
|
22318
23919
|
}
|
|
22319
23920
|
),
|
|
22320
|
-
/* @__PURE__ */
|
|
23921
|
+
/* @__PURE__ */ jsx59(
|
|
22321
23922
|
RHFTextField,
|
|
22322
23923
|
{
|
|
22323
23924
|
name: "label",
|
|
@@ -22325,7 +23926,7 @@ function AddAnnotationDialog({ saveAnnotation }) {
|
|
|
22325
23926
|
placeholder: t("annotationLabelPlaceholder")
|
|
22326
23927
|
}
|
|
22327
23928
|
),
|
|
22328
|
-
/* @__PURE__ */
|
|
23929
|
+
/* @__PURE__ */ jsx59(
|
|
22329
23930
|
RHFTextField,
|
|
22330
23931
|
{
|
|
22331
23932
|
name: "score",
|
|
@@ -22334,7 +23935,7 @@ function AddAnnotationDialog({ saveAnnotation }) {
|
|
|
22334
23935
|
inputProps: { step: "0.01" }
|
|
22335
23936
|
}
|
|
22336
23937
|
),
|
|
22337
|
-
/* @__PURE__ */
|
|
23938
|
+
/* @__PURE__ */ jsx59(
|
|
22338
23939
|
RHFTextField,
|
|
22339
23940
|
{
|
|
22340
23941
|
name: "reason",
|
|
@@ -22345,9 +23946,9 @@ function AddAnnotationDialog({ saveAnnotation }) {
|
|
|
22345
23946
|
}
|
|
22346
23947
|
)
|
|
22347
23948
|
] }) }),
|
|
22348
|
-
/* @__PURE__ */
|
|
22349
|
-
/* @__PURE__ */
|
|
22350
|
-
/* @__PURE__ */
|
|
23949
|
+
/* @__PURE__ */ jsxs35(DialogActions, { children: [
|
|
23950
|
+
/* @__PURE__ */ jsx59(Button3, { onClick: handleClose, disabled: isSubmitting, children: t("annotationCancel") }),
|
|
23951
|
+
/* @__PURE__ */ jsx59(
|
|
22351
23952
|
LoadingButton,
|
|
22352
23953
|
{
|
|
22353
23954
|
type: "submit",
|
|
@@ -22393,11 +23994,17 @@ export {
|
|
|
22393
23994
|
SpanInfoProvider,
|
|
22394
23995
|
SpanInfoTabs,
|
|
22395
23996
|
SpanInfoTitle,
|
|
23997
|
+
TIMELINE_CONSTANTS,
|
|
22396
23998
|
TableEmptyRows,
|
|
22397
23999
|
TableHeadCustom,
|
|
22398
24000
|
TablePaginationCustom,
|
|
22399
24001
|
TableSelectedAction,
|
|
22400
24002
|
TableSkeleton,
|
|
24003
|
+
TimelineBar,
|
|
24004
|
+
TimelineErrorBoundary,
|
|
24005
|
+
TimelineLegend,
|
|
24006
|
+
TimelineRuler,
|
|
24007
|
+
TimelineTooltip,
|
|
22401
24008
|
TraceDrawer,
|
|
22402
24009
|
TraceDrawerCloseButton,
|
|
22403
24010
|
TraceDrawerContainer,
|
|
@@ -22414,11 +24021,14 @@ export {
|
|
|
22414
24021
|
TraceLabel,
|
|
22415
24022
|
TraceListItem,
|
|
22416
24023
|
TraceListProvider,
|
|
24024
|
+
TraceTimeline,
|
|
22417
24025
|
TraceTree,
|
|
22418
24026
|
TraceTreeItem,
|
|
22419
24027
|
TracesList,
|
|
22420
24028
|
applyDagreLayout,
|
|
22421
24029
|
calculateBranchFamilies,
|
|
24030
|
+
computeTimelineLayout,
|
|
24031
|
+
formatDuration,
|
|
22422
24032
|
getBranchColor,
|
|
22423
24033
|
getDisplayName2 as getDisplayName,
|
|
22424
24034
|
getNodeTypeStyle,
|
|
@@ -22429,6 +24039,9 @@ export {
|
|
|
22429
24039
|
useEvaluationContext,
|
|
22430
24040
|
useSpanInfoContext,
|
|
22431
24041
|
useTable,
|
|
24042
|
+
useTimelineLayout,
|
|
24043
|
+
useTimelineViewPreference,
|
|
24044
|
+
useTimelineZoom,
|
|
22432
24045
|
useTraceDrawer,
|
|
22433
24046
|
useTraceDrawerContext,
|
|
22434
24047
|
useTraceListContext
|