@mastra/playground-ui 6.1.1-alpha.0 → 6.1.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs.js +389 -186
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +391 -190
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/assistant-ui/tools/badges/badge-wrapper.d.ts +8 -0
- package/dist/src/components/assistant-ui/tools/badges/loading-badge.d.ts +1 -0
- package/dist/src/components/assistant-ui/tools/badges/workflow-badge.d.ts +5 -6
- package/dist/src/components/ui/elements/entry-list/entry-list.d.ts +2 -1
- package/dist/src/domains/observability/components/trace-timeline-span.d.ts +2 -1
- package/dist/src/domains/workflows/hooks/use-handle-agent-workflow-stream.d.ts +3 -0
- package/dist/src/domains/workflows/index.d.ts +1 -0
- package/dist/src/domains/workflows/utils.d.ts +2 -0
- package/dist/src/hooks/use-workflow-runs.d.ts +1 -4
- package/dist/src/hooks/use-workflows.d.ts +1 -4
- package/dist/src/types.d.ts +6 -0
- package/package.json +4 -4
- package/dist/src/components/assistant-ui/context/agent-provider.d.ts +0 -12
package/dist/index.cjs.js
CHANGED
|
@@ -21,6 +21,7 @@ const codemirrorThemeDracula = require('@uiw/codemirror-theme-dracula');
|
|
|
21
21
|
const CodeMirror = require('@uiw/react-codemirror');
|
|
22
22
|
const sonner = require('sonner');
|
|
23
23
|
const useDebounce = require('use-debounce');
|
|
24
|
+
const reactQuery = require('@tanstack/react-query');
|
|
24
25
|
const react = require('@xyflow/react');
|
|
25
26
|
require('@xyflow/react/dist/style.css');
|
|
26
27
|
const Dagre = require('@dagrejs/dagre');
|
|
@@ -53,6 +54,7 @@ const RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
|
53
54
|
const reactTable = require('@tanstack/react-table');
|
|
54
55
|
const shallow = require('zustand/shallow');
|
|
55
56
|
const di = require('@mastra/core/di');
|
|
57
|
+
const reactDom = require('react-dom');
|
|
56
58
|
const react$3 = require('motion/react');
|
|
57
59
|
const TabsPrimitive = require('@radix-ui/react-tabs');
|
|
58
60
|
const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
@@ -62,7 +64,6 @@ const runtimeContext = require('@mastra/core/runtime-context');
|
|
|
62
64
|
const VisuallyHidden = require('@radix-ui/react-visually-hidden');
|
|
63
65
|
const HoverCard = require('@radix-ui/react-hover-card');
|
|
64
66
|
const format = require('date-fns/format');
|
|
65
|
-
const reactQuery = require('@tanstack/react-query');
|
|
66
67
|
|
|
67
68
|
function _interopNamespaceDefault(e) {
|
|
68
69
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -3471,54 +3472,6 @@ const defaultComponents = reactMarkdown.unstable_memoizeMarkdownComponents({
|
|
|
3471
3472
|
img: ImageWithFallback
|
|
3472
3473
|
});
|
|
3473
3474
|
|
|
3474
|
-
const AgentContext = React.createContext({ isLoading: true, agentDetails: null });
|
|
3475
|
-
function AgentProvider({ agentId, children }) {
|
|
3476
|
-
const [agentDetails, setAgentDetails] = React.useState({ isLoading: true, agentDetails: null });
|
|
3477
|
-
const client = useMastraClient();
|
|
3478
|
-
React.useEffect(() => {
|
|
3479
|
-
if (!agentId) return;
|
|
3480
|
-
client.getAgent(agentId).details().then((agentDetails2) => setAgentDetails({ isLoading: false, agentDetails: agentDetails2 }));
|
|
3481
|
-
}, [agentId]);
|
|
3482
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AgentContext.Provider, { value: agentDetails, children });
|
|
3483
|
-
}
|
|
3484
|
-
function useAgent() {
|
|
3485
|
-
return React.useContext(AgentContext);
|
|
3486
|
-
}
|
|
3487
|
-
|
|
3488
|
-
const sizes = {
|
|
3489
|
-
sm: "[&>svg]:h-icon-sm [&>svg]:w-icon-sm",
|
|
3490
|
-
default: "[&>svg]:h-icon-default [&>svg]:w-icon-default",
|
|
3491
|
-
lg: "[&>svg]:h-icon-lg [&>svg]:w-icon-lg"
|
|
3492
|
-
};
|
|
3493
|
-
const Icon = ({ children, className, size = "default", ...props }) => {
|
|
3494
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: clsx("block", sizes[size], className), ...props, children });
|
|
3495
|
-
};
|
|
3496
|
-
|
|
3497
|
-
const variantClasses$2 = {
|
|
3498
|
-
default: "text-icon3",
|
|
3499
|
-
success: "text-accent1",
|
|
3500
|
-
error: "text-accent2",
|
|
3501
|
-
info: "text-accent3"
|
|
3502
|
-
};
|
|
3503
|
-
const Badge$1 = ({ icon, variant = "default", className, children, ...props }) => {
|
|
3504
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3505
|
-
"div",
|
|
3506
|
-
{
|
|
3507
|
-
className: clsx(
|
|
3508
|
-
"bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
|
|
3509
|
-
icon ? "pl-md pr-1.5" : "px-1.5",
|
|
3510
|
-
icon || variant === "default" ? "text-icon5" : variantClasses$2[variant],
|
|
3511
|
-
className
|
|
3512
|
-
),
|
|
3513
|
-
...props,
|
|
3514
|
-
children: [
|
|
3515
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses$2[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
|
|
3516
|
-
children
|
|
3517
|
-
]
|
|
3518
|
-
}
|
|
3519
|
-
);
|
|
3520
|
-
};
|
|
3521
|
-
|
|
3522
3475
|
const AgentIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3523
3476
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3524
3477
|
"path",
|
|
@@ -3931,6 +3884,15 @@ const HomeIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13"
|
|
|
3931
3884
|
)
|
|
3932
3885
|
] });
|
|
3933
3886
|
|
|
3887
|
+
const sizes = {
|
|
3888
|
+
sm: "[&>svg]:h-icon-sm [&>svg]:w-icon-sm",
|
|
3889
|
+
default: "[&>svg]:h-icon-default [&>svg]:w-icon-default",
|
|
3890
|
+
lg: "[&>svg]:h-icon-lg [&>svg]:w-icon-lg"
|
|
3891
|
+
};
|
|
3892
|
+
const Icon = ({ children, className, size = "default", ...props }) => {
|
|
3893
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: clsx("block", sizes[size], className), ...props, children });
|
|
3894
|
+
};
|
|
3895
|
+
|
|
3934
3896
|
const InfoIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3935
3897
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3936
3898
|
"path",
|
|
@@ -4364,7 +4326,7 @@ const SyntaxHighlighter$2 = ({ data, className }) => {
|
|
|
4364
4326
|
const formattedCode = JSON.stringify(data, null, 2);
|
|
4365
4327
|
const theme = useCodemirrorTheme$2();
|
|
4366
4328
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("rounded-md bg-surface4 p-1 font-mono relative", className), children: [
|
|
4367
|
-
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: formattedCode, className: "absolute top-2 right-2" }),
|
|
4329
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: formattedCode, className: "absolute top-2 right-2 z-[9999]" }),
|
|
4368
4330
|
/* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: formattedCode, theme, extensions: [langJson.jsonLanguage] })
|
|
4369
4331
|
] });
|
|
4370
4332
|
};
|
|
@@ -4382,8 +4344,58 @@ async function highlight(code, language) {
|
|
|
4382
4344
|
return tokens;
|
|
4383
4345
|
}
|
|
4384
4346
|
|
|
4347
|
+
const variantClasses$2 = {
|
|
4348
|
+
default: "text-icon3",
|
|
4349
|
+
success: "text-accent1",
|
|
4350
|
+
error: "text-accent2",
|
|
4351
|
+
info: "text-accent3"
|
|
4352
|
+
};
|
|
4353
|
+
const Badge$1 = ({ icon, variant = "default", className, children, ...props }) => {
|
|
4354
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4355
|
+
"div",
|
|
4356
|
+
{
|
|
4357
|
+
className: clsx(
|
|
4358
|
+
"bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
|
|
4359
|
+
icon ? "pl-md pr-1.5" : "px-1.5",
|
|
4360
|
+
icon || variant === "default" ? "text-icon5" : variantClasses$2[variant],
|
|
4361
|
+
className
|
|
4362
|
+
),
|
|
4363
|
+
...props,
|
|
4364
|
+
children: [
|
|
4365
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses$2[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
|
|
4366
|
+
children
|
|
4367
|
+
]
|
|
4368
|
+
}
|
|
4369
|
+
);
|
|
4370
|
+
};
|
|
4371
|
+
|
|
4372
|
+
const BadgeWrapper = ({
|
|
4373
|
+
children,
|
|
4374
|
+
initialCollapsed = true,
|
|
4375
|
+
icon,
|
|
4376
|
+
title,
|
|
4377
|
+
collapsible = true
|
|
4378
|
+
}) => {
|
|
4379
|
+
const [isCollapsed, setIsCollapsed] = React.useState(initialCollapsed);
|
|
4380
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
4381
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4382
|
+
"button",
|
|
4383
|
+
{
|
|
4384
|
+
onClick: collapsible ? () => setIsCollapsed((s) => !s) : void 0,
|
|
4385
|
+
className: "flex items-center gap-2 disabled:cursor-not-allowed",
|
|
4386
|
+
disabled: !collapsible,
|
|
4387
|
+
type: "button",
|
|
4388
|
+
children: [
|
|
4389
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: cn("transition-all", isCollapsed ? "rotate-90" : "rotate-180") }) }),
|
|
4390
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon, children: title })
|
|
4391
|
+
]
|
|
4392
|
+
}
|
|
4393
|
+
),
|
|
4394
|
+
!isCollapsed && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 rounded-lg bg-surface2", children }) })
|
|
4395
|
+
] });
|
|
4396
|
+
};
|
|
4397
|
+
|
|
4385
4398
|
const ToolBadge = ({ toolName, argsText, result }) => {
|
|
4386
|
-
const [isCollapsed, setIsCollapsed] = React.useState(true);
|
|
4387
4399
|
let argSlot;
|
|
4388
4400
|
try {
|
|
4389
4401
|
const parsedArgs = JSON.parse(argsText);
|
|
@@ -4391,51 +4403,16 @@ const ToolBadge = ({ toolName, argsText, result }) => {
|
|
|
4391
4403
|
} catch {
|
|
4392
4404
|
argSlot = /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: argsText });
|
|
4393
4405
|
}
|
|
4394
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
4395
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
4396
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4397
|
-
|
|
4406
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BadgeWrapper, { icon: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, { className: "text-[#ECB047]" }), title: toolName, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
4407
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4408
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool arguments" }),
|
|
4409
|
+
argSlot
|
|
4398
4410
|
] }),
|
|
4399
|
-
|
|
4400
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
result !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 py-2", children: [
|
|
4405
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
|
|
4406
|
-
typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result })
|
|
4407
|
-
] })
|
|
4408
|
-
] }) })
|
|
4409
|
-
] });
|
|
4410
|
-
};
|
|
4411
|
-
|
|
4412
|
-
const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
|
|
4413
|
-
const [runs, setRuns] = React.useState(null);
|
|
4414
|
-
const [isLoading, setIsLoading] = React.useState(true);
|
|
4415
|
-
const client = useMastraClient();
|
|
4416
|
-
React.useEffect(() => {
|
|
4417
|
-
if (!enabled) return;
|
|
4418
|
-
const fetchWorkflow = async () => {
|
|
4419
|
-
setIsLoading(true);
|
|
4420
|
-
try {
|
|
4421
|
-
if (!workflowId) {
|
|
4422
|
-
setRuns(null);
|
|
4423
|
-
setIsLoading(false);
|
|
4424
|
-
return;
|
|
4425
|
-
}
|
|
4426
|
-
const res = await client.getWorkflow(workflowId).runs({ limit: 50 });
|
|
4427
|
-
setRuns(res);
|
|
4428
|
-
} catch (error) {
|
|
4429
|
-
setRuns(null);
|
|
4430
|
-
console.error("Error fetching workflow", error);
|
|
4431
|
-
sonner.toast.error("Error fetching workflow");
|
|
4432
|
-
} finally {
|
|
4433
|
-
setIsLoading(false);
|
|
4434
|
-
}
|
|
4435
|
-
};
|
|
4436
|
-
fetchWorkflow();
|
|
4437
|
-
}, [workflowId, enabled]);
|
|
4438
|
-
return { runs, isLoading };
|
|
4411
|
+
result !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4412
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
|
|
4413
|
+
typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result })
|
|
4414
|
+
] })
|
|
4415
|
+
] }) });
|
|
4439
4416
|
};
|
|
4440
4417
|
|
|
4441
4418
|
function Skeleton({ className, ...props }) {
|
|
@@ -4443,37 +4420,12 @@ function Skeleton({ className, ...props }) {
|
|
|
4443
4420
|
}
|
|
4444
4421
|
|
|
4445
4422
|
const useWorkflow = (workflowId) => {
|
|
4446
|
-
const [workflow, setWorkflow] = React.useState(null);
|
|
4447
|
-
const [isLoading, setIsLoading] = React.useState(true);
|
|
4448
4423
|
const client = useMastraClient();
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
setWorkflow(null);
|
|
4455
|
-
setIsLoading(false);
|
|
4456
|
-
return;
|
|
4457
|
-
}
|
|
4458
|
-
const res = await client.getWorkflow(workflowId).details();
|
|
4459
|
-
if (!res) {
|
|
4460
|
-
setWorkflow(null);
|
|
4461
|
-
console.error("Error fetching workflow");
|
|
4462
|
-
sonner.toast.error("Error fetching workflow");
|
|
4463
|
-
return;
|
|
4464
|
-
}
|
|
4465
|
-
setWorkflow(res);
|
|
4466
|
-
} catch (error) {
|
|
4467
|
-
setWorkflow(null);
|
|
4468
|
-
console.error("Error fetching workflow", error);
|
|
4469
|
-
sonner.toast.error("Error fetching workflow");
|
|
4470
|
-
} finally {
|
|
4471
|
-
setIsLoading(false);
|
|
4472
|
-
}
|
|
4473
|
-
};
|
|
4474
|
-
fetchWorkflow();
|
|
4475
|
-
}, [workflowId]);
|
|
4476
|
-
return { workflow, isLoading };
|
|
4424
|
+
return reactQuery.useQuery({
|
|
4425
|
+
queryKey: ["workflow", workflowId],
|
|
4426
|
+
queryFn: () => client.getWorkflow(workflowId).details(),
|
|
4427
|
+
retry: false
|
|
4428
|
+
});
|
|
4477
4429
|
};
|
|
4478
4430
|
const useLegacyWorkflow = (workflowId) => {
|
|
4479
4431
|
const [legacyWorkflow, setLegacyWorkflow] = React.useState(null);
|
|
@@ -5525,6 +5477,154 @@ function determineWorkflowStatus(steps) {
|
|
|
5525
5477
|
}
|
|
5526
5478
|
return "running";
|
|
5527
5479
|
}
|
|
5480
|
+
const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
5481
|
+
if (chunk.type === "workflow-start") {
|
|
5482
|
+
return {
|
|
5483
|
+
...prev,
|
|
5484
|
+
runId: chunk.runId,
|
|
5485
|
+
eventTimestamp: /* @__PURE__ */ new Date(),
|
|
5486
|
+
payload: {
|
|
5487
|
+
...prev?.payload || {},
|
|
5488
|
+
workflowState: {
|
|
5489
|
+
...prev?.payload?.workflowState,
|
|
5490
|
+
status: "running",
|
|
5491
|
+
steps: {}
|
|
5492
|
+
}
|
|
5493
|
+
}
|
|
5494
|
+
};
|
|
5495
|
+
}
|
|
5496
|
+
if (chunk.type === "workflow-step-start") {
|
|
5497
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5498
|
+
return {
|
|
5499
|
+
...prev,
|
|
5500
|
+
payload: {
|
|
5501
|
+
...prev.payload,
|
|
5502
|
+
currentStep: {
|
|
5503
|
+
id: chunk.payload.id,
|
|
5504
|
+
...chunk.payload
|
|
5505
|
+
},
|
|
5506
|
+
workflowState: {
|
|
5507
|
+
...prev.payload.workflowState,
|
|
5508
|
+
steps: {
|
|
5509
|
+
...prev.payload.workflowState.steps,
|
|
5510
|
+
[chunk.payload.id]: {
|
|
5511
|
+
...current || {},
|
|
5512
|
+
...chunk.payload
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
}
|
|
5516
|
+
},
|
|
5517
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5518
|
+
};
|
|
5519
|
+
}
|
|
5520
|
+
if (chunk.type === "workflow-step-suspended") {
|
|
5521
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5522
|
+
return {
|
|
5523
|
+
...prev,
|
|
5524
|
+
payload: {
|
|
5525
|
+
...prev.payload,
|
|
5526
|
+
currentStep: {
|
|
5527
|
+
id: chunk.payload.id,
|
|
5528
|
+
...prev?.payload?.currentStep || {},
|
|
5529
|
+
...chunk.payload
|
|
5530
|
+
},
|
|
5531
|
+
workflowState: {
|
|
5532
|
+
...prev.payload.workflowState,
|
|
5533
|
+
status: "suspended",
|
|
5534
|
+
steps: {
|
|
5535
|
+
...prev.payload.workflowState.steps,
|
|
5536
|
+
[chunk.payload.id]: {
|
|
5537
|
+
...current || {},
|
|
5538
|
+
...chunk.payload
|
|
5539
|
+
}
|
|
5540
|
+
}
|
|
5541
|
+
}
|
|
5542
|
+
},
|
|
5543
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5544
|
+
};
|
|
5545
|
+
}
|
|
5546
|
+
if (chunk.type === "workflow-step-waiting") {
|
|
5547
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5548
|
+
return {
|
|
5549
|
+
...prev,
|
|
5550
|
+
payload: {
|
|
5551
|
+
...prev.payload,
|
|
5552
|
+
currentStep: {
|
|
5553
|
+
id: chunk.payload.id,
|
|
5554
|
+
...prev?.payload?.currentStep || {},
|
|
5555
|
+
...chunk.payload
|
|
5556
|
+
},
|
|
5557
|
+
workflowState: {
|
|
5558
|
+
...prev.payload.workflowState,
|
|
5559
|
+
status: "waiting",
|
|
5560
|
+
steps: {
|
|
5561
|
+
...prev.payload.workflowState.steps,
|
|
5562
|
+
[chunk.payload.id]: {
|
|
5563
|
+
...current,
|
|
5564
|
+
...chunk.payload
|
|
5565
|
+
}
|
|
5566
|
+
}
|
|
5567
|
+
}
|
|
5568
|
+
},
|
|
5569
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5570
|
+
};
|
|
5571
|
+
}
|
|
5572
|
+
if (chunk.type === "workflow-step-result") {
|
|
5573
|
+
const status = chunk.payload.status;
|
|
5574
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5575
|
+
return {
|
|
5576
|
+
...prev,
|
|
5577
|
+
payload: {
|
|
5578
|
+
...prev.payload,
|
|
5579
|
+
currentStep: {
|
|
5580
|
+
id: chunk.payload.id,
|
|
5581
|
+
...prev?.payload?.currentStep || {},
|
|
5582
|
+
...chunk.payload
|
|
5583
|
+
},
|
|
5584
|
+
workflowState: {
|
|
5585
|
+
...prev.payload.workflowState,
|
|
5586
|
+
status,
|
|
5587
|
+
steps: {
|
|
5588
|
+
...prev.payload.workflowState.steps,
|
|
5589
|
+
[chunk.payload.id]: {
|
|
5590
|
+
...current,
|
|
5591
|
+
...chunk.payload
|
|
5592
|
+
}
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
},
|
|
5596
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5597
|
+
};
|
|
5598
|
+
}
|
|
5599
|
+
if (chunk.type === "workflow-canceled") {
|
|
5600
|
+
return {
|
|
5601
|
+
...prev,
|
|
5602
|
+
payload: {
|
|
5603
|
+
...prev.payload,
|
|
5604
|
+
workflowState: {
|
|
5605
|
+
...prev.payload.workflowState,
|
|
5606
|
+
status: "canceled"
|
|
5607
|
+
}
|
|
5608
|
+
},
|
|
5609
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5610
|
+
};
|
|
5611
|
+
}
|
|
5612
|
+
if (chunk.type === "workflow-finish") {
|
|
5613
|
+
return {
|
|
5614
|
+
...prev,
|
|
5615
|
+
payload: {
|
|
5616
|
+
...prev.payload,
|
|
5617
|
+
currentStep: void 0,
|
|
5618
|
+
workflowState: {
|
|
5619
|
+
...prev.payload.workflowState,
|
|
5620
|
+
status: chunk.payload.workflowStatus
|
|
5621
|
+
}
|
|
5622
|
+
},
|
|
5623
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5624
|
+
};
|
|
5625
|
+
}
|
|
5626
|
+
return prev;
|
|
5627
|
+
};
|
|
5528
5628
|
|
|
5529
5629
|
const WorkflowRunContext = React.createContext({});
|
|
5530
5630
|
function WorkflowRunProvider({
|
|
@@ -6133,7 +6233,7 @@ function Spinner({ color = "#fff", className }) {
|
|
|
6133
6233
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6134
6234
|
"svg",
|
|
6135
6235
|
{
|
|
6136
|
-
className:
|
|
6236
|
+
className: clsx("animate-spin duration-700", className),
|
|
6137
6237
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6138
6238
|
width: "24",
|
|
6139
6239
|
height: "24",
|
|
@@ -6184,7 +6284,6 @@ function LegacyWorkflowNestedGraph({
|
|
|
6184
6284
|
onNodesChange,
|
|
6185
6285
|
children: [
|
|
6186
6286
|
/* @__PURE__ */ jsxRuntime.jsx(react.Controls, {}),
|
|
6187
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
6188
6287
|
/* @__PURE__ */ jsxRuntime.jsx(react.Background, { variant: react.BackgroundVariant.Lines, gap: 12, size: 0.5 })
|
|
6189
6288
|
]
|
|
6190
6289
|
}
|
|
@@ -6287,7 +6386,6 @@ function LegacyWorkflowGraphInner({ workflow }) {
|
|
|
6287
6386
|
},
|
|
6288
6387
|
children: [
|
|
6289
6388
|
/* @__PURE__ */ jsxRuntime.jsx(react.Controls, {}),
|
|
6290
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
6291
6389
|
/* @__PURE__ */ jsxRuntime.jsx(react.Background, { variant: react.BackgroundVariant.Dots, gap: 12, size: 0.5 })
|
|
6292
6390
|
]
|
|
6293
6391
|
}
|
|
@@ -7485,7 +7583,6 @@ function WorkflowNestedGraph({
|
|
|
7485
7583
|
onNodesChange,
|
|
7486
7584
|
children: [
|
|
7487
7585
|
/* @__PURE__ */ jsxRuntime.jsx(ZoomSlider, { position: "bottom-left" }),
|
|
7488
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
7489
7586
|
/* @__PURE__ */ jsxRuntime.jsx(react.Background, { variant: react.BackgroundVariant.Lines, gap: 12, size: 0.5 })
|
|
7490
7587
|
]
|
|
7491
7588
|
}
|
|
@@ -7663,7 +7760,6 @@ function WorkflowGraphInner({ workflow, onShowTrace, onSendEvent }) {
|
|
|
7663
7760
|
maxZoom: 1,
|
|
7664
7761
|
children: [
|
|
7665
7762
|
/* @__PURE__ */ jsxRuntime.jsx(ZoomSlider, { position: "bottom-left" }),
|
|
7666
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
7667
7763
|
/* @__PURE__ */ jsxRuntime.jsx(react.Background, { variant: react.BackgroundVariant.Dots, gap: 12, size: 0.5 })
|
|
7668
7764
|
]
|
|
7669
7765
|
}
|
|
@@ -8442,44 +8538,83 @@ const EmptyWorkflowsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { classN
|
|
|
8442
8538
|
}
|
|
8443
8539
|
) });
|
|
8444
8540
|
|
|
8445
|
-
const
|
|
8446
|
-
const [
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8541
|
+
const useHandleAgentWorkflowStream = (workflowOutput) => {
|
|
8542
|
+
const [streamResult, setStreamResult] = React.useState({});
|
|
8543
|
+
React.useEffect(() => {
|
|
8544
|
+
if (!workflowOutput) return;
|
|
8545
|
+
setStreamResult((prev) => mapWorkflowStreamChunkToWatchResult(prev, workflowOutput));
|
|
8546
|
+
}, [workflowOutput]);
|
|
8547
|
+
return streamResult;
|
|
8548
|
+
};
|
|
8549
|
+
|
|
8550
|
+
const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
|
|
8551
|
+
const client = useMastraClient();
|
|
8552
|
+
return reactQuery.useQuery({
|
|
8553
|
+
queryKey: ["workflow-runs", workflowId],
|
|
8554
|
+
queryFn: () => client.getWorkflow(workflowId).runs({ limit: 50 }),
|
|
8555
|
+
enabled
|
|
8556
|
+
});
|
|
8557
|
+
};
|
|
8558
|
+
|
|
8559
|
+
const WorkflowBadge = ({ workflow, runId, workflowId, isStreaming }) => {
|
|
8560
|
+
const { data: runs, isLoading: isRunsLoading } = useWorkflowRuns(workflowId, {
|
|
8561
|
+
enabled: Boolean(runId) && !isStreaming
|
|
8562
|
+
});
|
|
8563
|
+
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
8564
|
+
const isLoading = isRunsLoading || !run;
|
|
8565
|
+
const snapshot = typeof run?.snapshot === "object" ? run?.snapshot : void 0;
|
|
8566
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(BadgeWrapper, { icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, { className: "text-accent3" }), title: workflow.name, initialCollapsed: false, children: [
|
|
8567
|
+
!isStreaming && !isLoading && /* @__PURE__ */ jsxRuntime.jsx(WorkflowRunProvider, { snapshot, children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowBadgeExtended, { workflowId, workflow, runId }) }),
|
|
8568
|
+
isStreaming && /* @__PURE__ */ jsxRuntime.jsx(WorkflowBadgeExtended, { workflowId, workflow, runId })
|
|
8461
8569
|
] });
|
|
8462
8570
|
};
|
|
8463
8571
|
const WorkflowBadgeExtended = ({ workflowId, workflow, runId }) => {
|
|
8464
8572
|
const { Link } = useLinkComponent();
|
|
8465
|
-
|
|
8466
|
-
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
8467
|
-
const isLoading = isRunsLoading || !run;
|
|
8468
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-sm border-border1 rounded-lg bg-surface4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 border-b-sm border-border1", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[50vh]", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8573
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8469
8574
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 pb-2", children: [
|
|
8470
8575
|
/* @__PURE__ */ jsxRuntime.jsx(Button$1, { as: Link, href: `/workflows/${workflowId}/graph`, children: "Go to workflow" }),
|
|
8471
8576
|
/* @__PURE__ */ jsxRuntime.jsx(Button$1, { as: Link, href: `/workflows/${workflowId}/graph/${runId}`, children: "See run" })
|
|
8472
8577
|
] }),
|
|
8473
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md overflow-hidden h-[60vh] w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8474
|
-
] })
|
|
8578
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md overflow-hidden h-[60vh] w-full", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraph, { workflowId, workflow }) })
|
|
8579
|
+
] });
|
|
8580
|
+
};
|
|
8581
|
+
const useWorkflowStream = (partialWorkflowOutput) => {
|
|
8582
|
+
const streamResult = useHandleAgentWorkflowStream(partialWorkflowOutput);
|
|
8583
|
+
const { setResult } = React.useContext(WorkflowRunContext);
|
|
8584
|
+
React.useEffect(() => {
|
|
8585
|
+
if (!streamResult) return;
|
|
8586
|
+
setResult(streamResult);
|
|
8587
|
+
}, [streamResult]);
|
|
8475
8588
|
};
|
|
8476
8589
|
|
|
8477
|
-
const
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8590
|
+
const LoadingBadge = () => {
|
|
8591
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8592
|
+
BadgeWrapper,
|
|
8593
|
+
{
|
|
8594
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { color: colors.IconColors.icon3 }),
|
|
8595
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "ml-2 w-12 h-2" }),
|
|
8596
|
+
collapsible: false
|
|
8597
|
+
}
|
|
8598
|
+
);
|
|
8599
|
+
};
|
|
8600
|
+
|
|
8601
|
+
const ToolFallback$1 = ({ toolName, argsText, result, args, ...props }) => {
|
|
8602
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowRunProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackInner, { toolName, argsText, result, args, ...props }) });
|
|
8603
|
+
};
|
|
8604
|
+
const ToolFallbackInner = ({ toolName, argsText, result, args }) => {
|
|
8605
|
+
useWorkflowStream(args.__mastraMetadata?.partialChunk);
|
|
8606
|
+
const { data: workflow, isLoading } = useWorkflow(toolName);
|
|
8607
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(LoadingBadge, {});
|
|
8481
8608
|
if (workflow) {
|
|
8482
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8609
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8610
|
+
WorkflowBadge,
|
|
8611
|
+
{
|
|
8612
|
+
workflowId: toolName,
|
|
8613
|
+
workflow,
|
|
8614
|
+
isStreaming: args.__mastraMetadata?.isStreaming,
|
|
8615
|
+
runId: result?.runId
|
|
8616
|
+
}
|
|
8617
|
+
);
|
|
8483
8618
|
}
|
|
8484
8619
|
return /* @__PURE__ */ jsxRuntime.jsx(ToolBadge, { toolName, argsText, result });
|
|
8485
8620
|
};
|
|
@@ -9091,7 +9226,7 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, onInputChange })
|
|
|
9091
9226
|
const WrappedAssistantMessage = (props) => {
|
|
9092
9227
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
|
|
9093
9228
|
};
|
|
9094
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
9229
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper$1, { children: [
|
|
9095
9230
|
/* @__PURE__ */ jsxRuntime.jsxs(react$2.ThreadPrimitive.Viewport, { ref: areaRef, autoScroll: false, className: "overflow-y-scroll scroll-smooth h-full", children: [
|
|
9096
9231
|
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome$1, { agentName }),
|
|
9097
9232
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[568px] w-full mx-auto px-4 pb-7", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -9107,7 +9242,7 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, onInputChange })
|
|
|
9107
9242
|
/* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
9108
9243
|
] }),
|
|
9109
9244
|
/* @__PURE__ */ jsxRuntime.jsx(Composer$1, { hasMemory, onInputChange, agentId })
|
|
9110
|
-
] })
|
|
9245
|
+
] });
|
|
9111
9246
|
};
|
|
9112
9247
|
const ThreadWrapper$1 = ({ children }) => {
|
|
9113
9248
|
return /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.Root, { className: "grid grid-rows-[1fr_auto] h-full overflow-y-auto", children });
|
|
@@ -9793,6 +9928,37 @@ function MastraRuntimeProvider({
|
|
|
9793
9928
|
updater();
|
|
9794
9929
|
break;
|
|
9795
9930
|
}
|
|
9931
|
+
case "tool-output": {
|
|
9932
|
+
if (!chunk.payload.output?.type.startsWith("workflow-")) return;
|
|
9933
|
+
reactDom.flushSync(() => {
|
|
9934
|
+
setMessages((currentConversation) => {
|
|
9935
|
+
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
9936
|
+
const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
|
|
9937
|
+
const newMessage = {
|
|
9938
|
+
...lastMessage,
|
|
9939
|
+
content: contentArray.map((part) => {
|
|
9940
|
+
if (part.type === "tool-call") {
|
|
9941
|
+
return {
|
|
9942
|
+
...part,
|
|
9943
|
+
...chunk.payload,
|
|
9944
|
+
args: {
|
|
9945
|
+
...part.args,
|
|
9946
|
+
__mastraMetadata: {
|
|
9947
|
+
...part.args?.__mastraMetadata,
|
|
9948
|
+
partialChunk: chunk?.payload?.output,
|
|
9949
|
+
isStreaming: true
|
|
9950
|
+
}
|
|
9951
|
+
}
|
|
9952
|
+
};
|
|
9953
|
+
}
|
|
9954
|
+
return part;
|
|
9955
|
+
})
|
|
9956
|
+
};
|
|
9957
|
+
return [...currentConversation.slice(0, -1), newMessage];
|
|
9958
|
+
});
|
|
9959
|
+
});
|
|
9960
|
+
break;
|
|
9961
|
+
}
|
|
9796
9962
|
case "tool-call": {
|
|
9797
9963
|
setMessages((currentConversation) => {
|
|
9798
9964
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
@@ -9805,7 +9971,13 @@ function MastraRuntimeProvider({
|
|
|
9805
9971
|
type: "tool-call",
|
|
9806
9972
|
toolCallId: chunk.payload.toolCallId,
|
|
9807
9973
|
toolName: chunk.payload.toolName,
|
|
9808
|
-
args:
|
|
9974
|
+
args: {
|
|
9975
|
+
...chunk.payload.args,
|
|
9976
|
+
__mastraMetadata: {
|
|
9977
|
+
...chunk.payload.args?.__mastraMetadata,
|
|
9978
|
+
isStreaming: true
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9809
9981
|
}
|
|
9810
9982
|
] : [
|
|
9811
9983
|
...typeof lastMessage.content === "string" ? [{ type: "text", text: lastMessage.content }] : [],
|
|
@@ -9813,7 +9985,13 @@ function MastraRuntimeProvider({
|
|
|
9813
9985
|
type: "tool-call",
|
|
9814
9986
|
toolCallId: chunk.payload.toolCallId,
|
|
9815
9987
|
toolName: chunk.payload.toolName,
|
|
9816
|
-
args:
|
|
9988
|
+
args: {
|
|
9989
|
+
...chunk.payload.args,
|
|
9990
|
+
__mastraMetadata: {
|
|
9991
|
+
...chunk.payload.args?.__mastraMetadata,
|
|
9992
|
+
isStreaming: true
|
|
9993
|
+
}
|
|
9994
|
+
}
|
|
9817
9995
|
}
|
|
9818
9996
|
]
|
|
9819
9997
|
};
|
|
@@ -9829,7 +10007,10 @@ function MastraRuntimeProvider({
|
|
|
9829
10007
|
type: "tool-call",
|
|
9830
10008
|
toolCallId: chunk.payload.toolCallId,
|
|
9831
10009
|
toolName: chunk.payload.toolName,
|
|
9832
|
-
args:
|
|
10010
|
+
args: {
|
|
10011
|
+
...chunk.payload.args,
|
|
10012
|
+
__mastraMetadata: { ...chunk.payload.args?.__mastraMetadata, isStreaming: true }
|
|
10013
|
+
}
|
|
9833
10014
|
}
|
|
9834
10015
|
]
|
|
9835
10016
|
};
|
|
@@ -12992,8 +13173,8 @@ const StepEntry = ({ stepId, step, runId }) => {
|
|
|
12992
13173
|
] });
|
|
12993
13174
|
};
|
|
12994
13175
|
const WorkflowStepResultDialog = ({ open, onOpenChange, workflowId, runId }) => {
|
|
12995
|
-
const { runs } = useWorkflowRuns(workflowId);
|
|
12996
|
-
const { workflow, isLoading } = useWorkflow(workflowId);
|
|
13176
|
+
const { data: runs } = useWorkflowRuns(workflowId);
|
|
13177
|
+
const { data: workflow, isLoading } = useWorkflow(workflowId);
|
|
12997
13178
|
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
12998
13179
|
return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: "h-[90vh] w-[90%] max-w-[unset]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 h-full", children: [
|
|
12999
13180
|
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Workflow details" }),
|
|
@@ -14603,7 +14784,8 @@ function EntryList({
|
|
|
14603
14784
|
perPage,
|
|
14604
14785
|
columns,
|
|
14605
14786
|
searchTerm,
|
|
14606
|
-
setEndOfListElement
|
|
14787
|
+
setEndOfListElement,
|
|
14788
|
+
errorMsg
|
|
14607
14789
|
}) {
|
|
14608
14790
|
const loadingItems = Array.from({ length: 3 }).map((_, index) => {
|
|
14609
14791
|
return {
|
|
@@ -14627,8 +14809,24 @@ function EntryList({
|
|
|
14627
14809
|
children: columns?.map((col) => /* @__PURE__ */ jsxRuntime.jsx("span", { children: col.label || col.name }, col.name))
|
|
14628
14810
|
}
|
|
14629
14811
|
) }),
|
|
14630
|
-
|
|
14631
|
-
|
|
14812
|
+
errorMsg && !isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid border border-border1 border-t-0 bg-surface3 rounded-xl rounded-t-none", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14813
|
+
"p",
|
|
14814
|
+
{
|
|
14815
|
+
className: cn(
|
|
14816
|
+
"text-[0.875rem] text-center items-center flex justify-center p-[2.5rem] gap-[1rem] text-icon3",
|
|
14817
|
+
"[&>svg]:w-[1.5em]",
|
|
14818
|
+
"[&>svg]:h-[1.5em]",
|
|
14819
|
+
"[&>svg]:text-red-500"
|
|
14820
|
+
),
|
|
14821
|
+
children: [
|
|
14822
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlertIcon, {}),
|
|
14823
|
+
" ",
|
|
14824
|
+
errorMsg || "Something went wrong while fetching the data."
|
|
14825
|
+
]
|
|
14826
|
+
}
|
|
14827
|
+
) }),
|
|
14828
|
+
!isLoading && !errorMsg && items?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid border border-border1 border-t-0 bg-surface3 rounded-xl rounded-t-none", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-icon3 text-[0.875rem] text-center h-[3.5rem] items-center flex justify-center", children: searchTerm ? `No results found for "${searchTerm}"` : "No entries found" }) }),
|
|
14829
|
+
!errorMsg && items?.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14632
14830
|
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "grid border border-border1 border-t-0 bg-surface3 rounded-xl rounded-t-none overflow-y-auto", children: items.map((item) => {
|
|
14633
14831
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14634
14832
|
EntryListItem,
|
|
@@ -14961,8 +15159,8 @@ function SideDialogHeading({ children, className, as = "h1" }) {
|
|
|
14961
15159
|
HeadingTag,
|
|
14962
15160
|
{
|
|
14963
15161
|
className: cn(
|
|
14964
|
-
"flex items-start text-icon4 text-[1.125rem] font-semibold gap-[
|
|
14965
|
-
"[&>svg]:w-[1.
|
|
15162
|
+
"flex items-start text-icon4 text-[1.125rem] font-semibold gap-[.5rem]",
|
|
15163
|
+
"[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:shrink-0 [&>svg]:mt-[.2em] [&>svg]:opacity-70",
|
|
14966
15164
|
{
|
|
14967
15165
|
"text-[1.125rem]": as === "h1",
|
|
14968
15166
|
"text-[1rem]": as === "h2"
|
|
@@ -15367,7 +15565,7 @@ const DefaultTrigger = React__namespace.forwardRef(
|
|
|
15367
15565
|
({ value, placeholder, className, ...props }, ref) => {
|
|
15368
15566
|
return /* @__PURE__ */ jsxRuntime.jsxs(Button, { ref, variant: "outline", className: cn("justify-start", className), ...props, children: [
|
|
15369
15567
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "h-4 w-4" }),
|
|
15370
|
-
value ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white", children: dateFns.format(value, "
|
|
15568
|
+
value ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white", children: dateFns.format(value, "PP p") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray", children: placeholder ?? "Pick a date" })
|
|
15371
15569
|
] });
|
|
15372
15570
|
}
|
|
15373
15571
|
);
|
|
@@ -15377,8 +15575,8 @@ function TextAndIcon({ children, className }) {
|
|
|
15377
15575
|
"span",
|
|
15378
15576
|
{
|
|
15379
15577
|
className: cn(
|
|
15380
|
-
"flex items-center gap-[0.
|
|
15381
|
-
"[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",
|
|
15578
|
+
"flex items-center gap-[0.5em] text-icon4 text-[0.875rem]",
|
|
15579
|
+
"[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50 [&_svg]:flex-shrink-0",
|
|
15382
15580
|
className
|
|
15383
15581
|
),
|
|
15384
15582
|
children
|
|
@@ -16856,7 +17054,8 @@ function TraceTimelineSpan({
|
|
|
16856
17054
|
selectedSpanId,
|
|
16857
17055
|
isLastChild,
|
|
16858
17056
|
overallLatency,
|
|
16859
|
-
overallStartTime
|
|
17057
|
+
overallStartTime,
|
|
17058
|
+
overallEndTime
|
|
16860
17059
|
}) {
|
|
16861
17060
|
const { Link } = useLinkComponent();
|
|
16862
17061
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
@@ -16911,7 +17110,7 @@ function TraceTimelineSpan({
|
|
|
16911
17110
|
onMouseEnter: () => setIsHovered(true),
|
|
16912
17111
|
onMouseLeave: () => setIsHovered(false),
|
|
16913
17112
|
children: [
|
|
16914
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-left text-[0.75rem] relative w-full h-[1.4rem] ", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17113
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-left text-[0.75rem] relative w-full h-[1.4rem] min-w-[6rem]", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16915
17114
|
"span",
|
|
16916
17115
|
{
|
|
16917
17116
|
className: cn(
|
|
@@ -17066,6 +17265,7 @@ function TraceTimeline({
|
|
|
17066
17265
|
}) {
|
|
17067
17266
|
const overallLatency = hierarchicalSpans?.[0]?.latency || 0;
|
|
17068
17267
|
const overallStartTime = hierarchicalSpans?.[0]?.startTime || "";
|
|
17268
|
+
const overallEndTime = hierarchicalSpans?.[0]?.endTime || "";
|
|
17069
17269
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("grid gap-[1rem]", className), children: [
|
|
17070
17270
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full justify-between pr-[2.5rem]", children: [
|
|
17071
17271
|
/* @__PURE__ */ jsxRuntime.jsxs(SideDialogHeading, { as: "h2", children: [
|
|
@@ -17089,10 +17289,10 @@ function TraceTimeline({
|
|
|
17089
17289
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
17090
17290
|
"div",
|
|
17091
17291
|
{
|
|
17092
|
-
className: cn(
|
|
17093
|
-
"
|
|
17094
|
-
"xl:grid-cols-[3fr_2fr]
|
|
17095
|
-
),
|
|
17292
|
+
className: cn("grid items-start content-start gap-y-[2px]", "xl:gap-x-[1rem] xl:py-[1rem]", {
|
|
17293
|
+
"xl:grid-cols-[3fr_auto]": !overallEndTime,
|
|
17294
|
+
"xl:grid-cols-[3fr_2fr]": overallEndTime
|
|
17295
|
+
}),
|
|
17096
17296
|
children: hierarchicalSpans?.map((span) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17097
17297
|
TraceTimelineSpan,
|
|
17098
17298
|
{
|
|
@@ -17100,7 +17300,8 @@ function TraceTimeline({
|
|
|
17100
17300
|
onSpanClick,
|
|
17101
17301
|
selectedSpanId,
|
|
17102
17302
|
overallLatency,
|
|
17103
|
-
overallStartTime
|
|
17303
|
+
overallStartTime,
|
|
17304
|
+
overallEndTime
|
|
17104
17305
|
},
|
|
17105
17306
|
span.id
|
|
17106
17307
|
))
|
|
@@ -17290,7 +17491,7 @@ function getSpanInfo({ span, withTraceId = true, withSpanId = true }) {
|
|
|
17290
17491
|
if (withSpanId) {
|
|
17291
17492
|
baseInfo.unshift({
|
|
17292
17493
|
key: "spanId",
|
|
17293
|
-
label: "
|
|
17494
|
+
label: "#",
|
|
17294
17495
|
value: span?.spanId
|
|
17295
17496
|
});
|
|
17296
17497
|
}
|
|
@@ -17327,7 +17528,7 @@ function SpanDialog({
|
|
|
17327
17528
|
isOpen,
|
|
17328
17529
|
onClose,
|
|
17329
17530
|
hasCloseButton: true,
|
|
17330
|
-
className: cn("w-[calc(100vw-
|
|
17531
|
+
className: cn("w-[calc(100vw-25rem)] max-w-[65%]", "3xl:max-w-[50%]", "4xl:max-w-[40%]"),
|
|
17331
17532
|
children: [
|
|
17332
17533
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between pr-[1.5rem]", children: [
|
|
17333
17534
|
/* @__PURE__ */ jsxRuntime.jsx(SideDialogTop, { onNext, onPrevious, showInnerNav: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-[1rem] text-icon4 text-[0.875rem]", children: [
|
|
@@ -17435,7 +17636,7 @@ function TraceDialog({
|
|
|
17435
17636
|
isOpen,
|
|
17436
17637
|
onClose,
|
|
17437
17638
|
hasCloseButton: !dialogIsOpen || combinedView,
|
|
17438
|
-
className: cn("w-[calc(100vw-20rem)] max-w-[
|
|
17639
|
+
className: cn("w-[calc(100vw-20rem)] max-w-[80%]", "3xl:max-w-[65%]", "4xl:max-w-[55%]"),
|
|
17439
17640
|
children: [
|
|
17440
17641
|
/* @__PURE__ */ jsxRuntime.jsx(SideDialogTop, { onNext, onPrevious, showInnerNav: true, children: /* @__PURE__ */ jsxRuntime.jsxs(TextAndIcon, { children: [
|
|
17441
17642
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeIcon, {}),
|
|
@@ -17461,7 +17662,7 @@ function TraceDialog({
|
|
|
17461
17662
|
traceId
|
|
17462
17663
|
] })
|
|
17463
17664
|
] }),
|
|
17464
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-y-auto pb-[2.5rem]", children: [
|
|
17665
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("overflow-y-auto pb-[2.5rem]"), children: [
|
|
17465
17666
|
traceDetails?.metadata?.usage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17466
17667
|
TraceSpanUsage,
|
|
17467
17668
|
{
|
|
@@ -17501,7 +17702,7 @@ function TraceDialog({
|
|
|
17501
17702
|
] }),
|
|
17502
17703
|
"›",
|
|
17503
17704
|
/* @__PURE__ */ jsxRuntime.jsxs(TextAndIcon, { children: [
|
|
17504
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.
|
|
17705
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeftRightEllipsisIcon, {}),
|
|
17505
17706
|
" ",
|
|
17506
17707
|
getShortId(selectedSpanId)
|
|
17507
17708
|
] })
|
|
@@ -17588,7 +17789,7 @@ function TracesTools({
|
|
|
17588
17789
|
value: selectedDateFrom,
|
|
17589
17790
|
maxValue: selectedDateTo,
|
|
17590
17791
|
onValueChange: (date) => onDateChange?.(date, "from"),
|
|
17591
|
-
className: "min-w-[
|
|
17792
|
+
className: "min-w-[13rem]",
|
|
17592
17793
|
defaultTimeStrValue: "12:00 AM",
|
|
17593
17794
|
disabled: isLoading
|
|
17594
17795
|
}
|
|
@@ -17600,7 +17801,7 @@ function TracesTools({
|
|
|
17600
17801
|
value: selectedDateTo,
|
|
17601
17802
|
minValue: selectedDateFrom,
|
|
17602
17803
|
onValueChange: (date) => onDateChange?.(date, "to"),
|
|
17603
|
-
className: "min-w-[
|
|
17804
|
+
className: "min-w-[13rem]",
|
|
17604
17805
|
defaultTimeStrValue: "11:59 PM",
|
|
17605
17806
|
disabled: isLoading
|
|
17606
17807
|
}
|
|
@@ -18406,6 +18607,7 @@ exports.WorkingMemoryContext = WorkingMemoryContext;
|
|
|
18406
18607
|
exports.WorkingMemoryProvider = WorkingMemoryProvider;
|
|
18407
18608
|
exports.allowedAiSpanAttributes = allowedAiSpanAttributes;
|
|
18408
18609
|
exports.cleanString = cleanString;
|
|
18610
|
+
exports.convertWorkflowRunStateToWatchResult = convertWorkflowRunStateToWatchResult;
|
|
18409
18611
|
exports.formatDuration = formatDuration;
|
|
18410
18612
|
exports.formatHierarchicalSpans = formatHierarchicalSpans;
|
|
18411
18613
|
exports.formatOtelTimestamp = formatOtelTimestamp;
|
|
@@ -18413,6 +18615,7 @@ exports.formatOtelTimestamp2 = formatOtelTimestamp2;
|
|
|
18413
18615
|
exports.getColumnTemplate = getColumnTemplate;
|
|
18414
18616
|
exports.getShortId = getShortId;
|
|
18415
18617
|
exports.getSpanTypeUi = getSpanTypeUi;
|
|
18618
|
+
exports.mapWorkflowStreamChunkToWatchResult = mapWorkflowStreamChunkToWatchResult;
|
|
18416
18619
|
exports.providerMapToIcon = providerMapToIcon;
|
|
18417
18620
|
exports.spanTypePrefixes = spanTypePrefixes;
|
|
18418
18621
|
exports.transformKey = transformKey;
|