@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.es.js
CHANGED
|
@@ -19,7 +19,9 @@ import { draculaInit } from '@uiw/codemirror-theme-dracula';
|
|
|
19
19
|
import CodeMirror, { EditorView } from '@uiw/react-codemirror';
|
|
20
20
|
import { toast } from 'sonner';
|
|
21
21
|
import { useDebouncedCallback } from 'use-debounce';
|
|
22
|
-
import {
|
|
22
|
+
import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
23
|
+
import './index.css';export * from '@tanstack/react-query';
|
|
24
|
+
import { MarkerType, Handle, Position, useNodesState, useEdgesState, ReactFlow, Controls, Background, BackgroundVariant, ReactFlowProvider, useViewport, useReactFlow, Panel } from '@xyflow/react';
|
|
23
25
|
import '@xyflow/react/dist/style.css';
|
|
24
26
|
import Dagre from '@dagrejs/dagre';
|
|
25
27
|
import { Highlight, themes } from 'prism-react-renderer';
|
|
@@ -29,7 +31,7 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
|
29
31
|
import prettier from 'prettier';
|
|
30
32
|
import prettierPluginBabel from 'prettier/plugins/babel';
|
|
31
33
|
import prettierPluginEstree from 'prettier/plugins/estree';
|
|
32
|
-
import { C as Colors } from './colors-DrbbnW3f.js';
|
|
34
|
+
import { C as Colors, I as IconColors } from './colors-DrbbnW3f.js';
|
|
33
35
|
import jsonSchemaToZod from 'json-schema-to-zod';
|
|
34
36
|
import { parse } from 'superjson';
|
|
35
37
|
import z$2, { z, ZodObject } from 'zod';
|
|
@@ -51,6 +53,7 @@ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
|
51
53
|
import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
52
54
|
import { useShallow } from 'zustand/shallow';
|
|
53
55
|
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/di';
|
|
56
|
+
import { flushSync } from 'react-dom';
|
|
54
57
|
import { AnimatePresence } from 'motion/react';
|
|
55
58
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
56
59
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
@@ -61,8 +64,6 @@ import * as VisuallyHidden from '@radix-ui/react-visually-hidden';
|
|
|
61
64
|
import { VisuallyHidden as VisuallyHidden$1 } from '@radix-ui/react-visually-hidden';
|
|
62
65
|
import * as HoverCard from '@radix-ui/react-hover-card';
|
|
63
66
|
import { format as format$1 } from 'date-fns/format';
|
|
64
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
65
|
-
import './index.css';export * from '@tanstack/react-query';
|
|
66
67
|
|
|
67
68
|
const createMastraClient = (baseUrl, mastraClientHeaders = {}) => {
|
|
68
69
|
return new MastraClient({
|
|
@@ -3437,54 +3438,6 @@ const defaultComponents = unstable_memoizeMarkdownComponents({
|
|
|
3437
3438
|
img: ImageWithFallback
|
|
3438
3439
|
});
|
|
3439
3440
|
|
|
3440
|
-
const AgentContext = createContext({ isLoading: true, agentDetails: null });
|
|
3441
|
-
function AgentProvider({ agentId, children }) {
|
|
3442
|
-
const [agentDetails, setAgentDetails] = useState({ isLoading: true, agentDetails: null });
|
|
3443
|
-
const client = useMastraClient();
|
|
3444
|
-
useEffect(() => {
|
|
3445
|
-
if (!agentId) return;
|
|
3446
|
-
client.getAgent(agentId).details().then((agentDetails2) => setAgentDetails({ isLoading: false, agentDetails: agentDetails2 }));
|
|
3447
|
-
}, [agentId]);
|
|
3448
|
-
return /* @__PURE__ */ jsx(AgentContext.Provider, { value: agentDetails, children });
|
|
3449
|
-
}
|
|
3450
|
-
function useAgent() {
|
|
3451
|
-
return useContext(AgentContext);
|
|
3452
|
-
}
|
|
3453
|
-
|
|
3454
|
-
const sizes = {
|
|
3455
|
-
sm: "[&>svg]:h-icon-sm [&>svg]:w-icon-sm",
|
|
3456
|
-
default: "[&>svg]:h-icon-default [&>svg]:w-icon-default",
|
|
3457
|
-
lg: "[&>svg]:h-icon-lg [&>svg]:w-icon-lg"
|
|
3458
|
-
};
|
|
3459
|
-
const Icon = ({ children, className, size = "default", ...props }) => {
|
|
3460
|
-
return /* @__PURE__ */ jsx("span", { className: clsx("block", sizes[size], className), ...props, children });
|
|
3461
|
-
};
|
|
3462
|
-
|
|
3463
|
-
const variantClasses$2 = {
|
|
3464
|
-
default: "text-icon3",
|
|
3465
|
-
success: "text-accent1",
|
|
3466
|
-
error: "text-accent2",
|
|
3467
|
-
info: "text-accent3"
|
|
3468
|
-
};
|
|
3469
|
-
const Badge$1 = ({ icon, variant = "default", className, children, ...props }) => {
|
|
3470
|
-
return /* @__PURE__ */ jsxs(
|
|
3471
|
-
"div",
|
|
3472
|
-
{
|
|
3473
|
-
className: clsx(
|
|
3474
|
-
"bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
|
|
3475
|
-
icon ? "pl-md pr-1.5" : "px-1.5",
|
|
3476
|
-
icon || variant === "default" ? "text-icon5" : variantClasses$2[variant],
|
|
3477
|
-
className
|
|
3478
|
-
),
|
|
3479
|
-
...props,
|
|
3480
|
-
children: [
|
|
3481
|
-
icon && /* @__PURE__ */ jsx("span", { className: variantClasses$2[variant], children: /* @__PURE__ */ jsx(Icon, { children: icon }) }),
|
|
3482
|
-
children
|
|
3483
|
-
]
|
|
3484
|
-
}
|
|
3485
|
-
);
|
|
3486
|
-
};
|
|
3487
|
-
|
|
3488
3441
|
const AgentIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3489
3442
|
/* @__PURE__ */ jsx(
|
|
3490
3443
|
"path",
|
|
@@ -3897,6 +3850,15 @@ const HomeIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "13", height: "
|
|
|
3897
3850
|
)
|
|
3898
3851
|
] });
|
|
3899
3852
|
|
|
3853
|
+
const sizes = {
|
|
3854
|
+
sm: "[&>svg]:h-icon-sm [&>svg]:w-icon-sm",
|
|
3855
|
+
default: "[&>svg]:h-icon-default [&>svg]:w-icon-default",
|
|
3856
|
+
lg: "[&>svg]:h-icon-lg [&>svg]:w-icon-lg"
|
|
3857
|
+
};
|
|
3858
|
+
const Icon = ({ children, className, size = "default", ...props }) => {
|
|
3859
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("block", sizes[size], className), ...props, children });
|
|
3860
|
+
};
|
|
3861
|
+
|
|
3900
3862
|
const InfoIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3901
3863
|
/* @__PURE__ */ jsx(
|
|
3902
3864
|
"path",
|
|
@@ -4330,7 +4292,7 @@ const SyntaxHighlighter$2 = ({ data, className }) => {
|
|
|
4330
4292
|
const formattedCode = JSON.stringify(data, null, 2);
|
|
4331
4293
|
const theme = useCodemirrorTheme$2();
|
|
4332
4294
|
return /* @__PURE__ */ jsxs("div", { className: clsx("rounded-md bg-surface4 p-1 font-mono relative", className), children: [
|
|
4333
|
-
/* @__PURE__ */ jsx(CopyButton, { content: formattedCode, className: "absolute top-2 right-2" }),
|
|
4295
|
+
/* @__PURE__ */ jsx(CopyButton, { content: formattedCode, className: "absolute top-2 right-2 z-[9999]" }),
|
|
4334
4296
|
/* @__PURE__ */ jsx(CodeMirror, { value: formattedCode, theme, extensions: [jsonLanguage] })
|
|
4335
4297
|
] });
|
|
4336
4298
|
};
|
|
@@ -4348,8 +4310,58 @@ async function highlight(code, language) {
|
|
|
4348
4310
|
return tokens;
|
|
4349
4311
|
}
|
|
4350
4312
|
|
|
4313
|
+
const variantClasses$2 = {
|
|
4314
|
+
default: "text-icon3",
|
|
4315
|
+
success: "text-accent1",
|
|
4316
|
+
error: "text-accent2",
|
|
4317
|
+
info: "text-accent3"
|
|
4318
|
+
};
|
|
4319
|
+
const Badge$1 = ({ icon, variant = "default", className, children, ...props }) => {
|
|
4320
|
+
return /* @__PURE__ */ jsxs(
|
|
4321
|
+
"div",
|
|
4322
|
+
{
|
|
4323
|
+
className: clsx(
|
|
4324
|
+
"bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
|
|
4325
|
+
icon ? "pl-md pr-1.5" : "px-1.5",
|
|
4326
|
+
icon || variant === "default" ? "text-icon5" : variantClasses$2[variant],
|
|
4327
|
+
className
|
|
4328
|
+
),
|
|
4329
|
+
...props,
|
|
4330
|
+
children: [
|
|
4331
|
+
icon && /* @__PURE__ */ jsx("span", { className: variantClasses$2[variant], children: /* @__PURE__ */ jsx(Icon, { children: icon }) }),
|
|
4332
|
+
children
|
|
4333
|
+
]
|
|
4334
|
+
}
|
|
4335
|
+
);
|
|
4336
|
+
};
|
|
4337
|
+
|
|
4338
|
+
const BadgeWrapper = ({
|
|
4339
|
+
children,
|
|
4340
|
+
initialCollapsed = true,
|
|
4341
|
+
icon,
|
|
4342
|
+
title,
|
|
4343
|
+
collapsible = true
|
|
4344
|
+
}) => {
|
|
4345
|
+
const [isCollapsed, setIsCollapsed] = useState(initialCollapsed);
|
|
4346
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
4347
|
+
/* @__PURE__ */ jsxs(
|
|
4348
|
+
"button",
|
|
4349
|
+
{
|
|
4350
|
+
onClick: collapsible ? () => setIsCollapsed((s) => !s) : void 0,
|
|
4351
|
+
className: "flex items-center gap-2 disabled:cursor-not-allowed",
|
|
4352
|
+
disabled: !collapsible,
|
|
4353
|
+
type: "button",
|
|
4354
|
+
children: [
|
|
4355
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: cn("transition-all", isCollapsed ? "rotate-90" : "rotate-180") }) }),
|
|
4356
|
+
/* @__PURE__ */ jsx(Badge$1, { icon, children: title })
|
|
4357
|
+
]
|
|
4358
|
+
}
|
|
4359
|
+
),
|
|
4360
|
+
!isCollapsed && /* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx("div", { className: "p-4 rounded-lg bg-surface2", children }) })
|
|
4361
|
+
] });
|
|
4362
|
+
};
|
|
4363
|
+
|
|
4351
4364
|
const ToolBadge = ({ toolName, argsText, result }) => {
|
|
4352
|
-
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
4353
4365
|
let argSlot;
|
|
4354
4366
|
try {
|
|
4355
4367
|
const parsedArgs = JSON.parse(argsText);
|
|
@@ -4357,51 +4369,16 @@ const ToolBadge = ({ toolName, argsText, result }) => {
|
|
|
4357
4369
|
} catch {
|
|
4358
4370
|
argSlot = /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: argsText });
|
|
4359
4371
|
}
|
|
4360
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
4361
|
-
/* @__PURE__ */ jsxs("
|
|
4362
|
-
/* @__PURE__ */ jsx(
|
|
4363
|
-
|
|
4372
|
+
return /* @__PURE__ */ jsx(BadgeWrapper, { icon: /* @__PURE__ */ jsx(ToolsIcon, { className: "text-[#ECB047]" }), title: toolName, children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
4373
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4374
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium pb-2", children: "Tool arguments" }),
|
|
4375
|
+
argSlot
|
|
4364
4376
|
] }),
|
|
4365
|
-
|
|
4366
|
-
/* @__PURE__ */
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
result !== void 0 && /* @__PURE__ */ jsxs("div", { className: "px-4 py-2", children: [
|
|
4371
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
|
|
4372
|
-
typeof result === "string" ? /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: result })
|
|
4373
|
-
] })
|
|
4374
|
-
] }) })
|
|
4375
|
-
] });
|
|
4376
|
-
};
|
|
4377
|
-
|
|
4378
|
-
const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
|
|
4379
|
-
const [runs, setRuns] = useState(null);
|
|
4380
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
4381
|
-
const client = useMastraClient();
|
|
4382
|
-
useEffect(() => {
|
|
4383
|
-
if (!enabled) return;
|
|
4384
|
-
const fetchWorkflow = async () => {
|
|
4385
|
-
setIsLoading(true);
|
|
4386
|
-
try {
|
|
4387
|
-
if (!workflowId) {
|
|
4388
|
-
setRuns(null);
|
|
4389
|
-
setIsLoading(false);
|
|
4390
|
-
return;
|
|
4391
|
-
}
|
|
4392
|
-
const res = await client.getWorkflow(workflowId).runs({ limit: 50 });
|
|
4393
|
-
setRuns(res);
|
|
4394
|
-
} catch (error) {
|
|
4395
|
-
setRuns(null);
|
|
4396
|
-
console.error("Error fetching workflow", error);
|
|
4397
|
-
toast.error("Error fetching workflow");
|
|
4398
|
-
} finally {
|
|
4399
|
-
setIsLoading(false);
|
|
4400
|
-
}
|
|
4401
|
-
};
|
|
4402
|
-
fetchWorkflow();
|
|
4403
|
-
}, [workflowId, enabled]);
|
|
4404
|
-
return { runs, isLoading };
|
|
4377
|
+
result !== void 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
4378
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
|
|
4379
|
+
typeof result === "string" ? /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsx(SyntaxHighlighter$2, { data: result })
|
|
4380
|
+
] })
|
|
4381
|
+
] }) });
|
|
4405
4382
|
};
|
|
4406
4383
|
|
|
4407
4384
|
function Skeleton({ className, ...props }) {
|
|
@@ -4409,37 +4386,12 @@ function Skeleton({ className, ...props }) {
|
|
|
4409
4386
|
}
|
|
4410
4387
|
|
|
4411
4388
|
const useWorkflow = (workflowId) => {
|
|
4412
|
-
const [workflow, setWorkflow] = useState(null);
|
|
4413
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
4414
4389
|
const client = useMastraClient();
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
setWorkflow(null);
|
|
4421
|
-
setIsLoading(false);
|
|
4422
|
-
return;
|
|
4423
|
-
}
|
|
4424
|
-
const res = await client.getWorkflow(workflowId).details();
|
|
4425
|
-
if (!res) {
|
|
4426
|
-
setWorkflow(null);
|
|
4427
|
-
console.error("Error fetching workflow");
|
|
4428
|
-
toast.error("Error fetching workflow");
|
|
4429
|
-
return;
|
|
4430
|
-
}
|
|
4431
|
-
setWorkflow(res);
|
|
4432
|
-
} catch (error) {
|
|
4433
|
-
setWorkflow(null);
|
|
4434
|
-
console.error("Error fetching workflow", error);
|
|
4435
|
-
toast.error("Error fetching workflow");
|
|
4436
|
-
} finally {
|
|
4437
|
-
setIsLoading(false);
|
|
4438
|
-
}
|
|
4439
|
-
};
|
|
4440
|
-
fetchWorkflow();
|
|
4441
|
-
}, [workflowId]);
|
|
4442
|
-
return { workflow, isLoading };
|
|
4390
|
+
return useQuery({
|
|
4391
|
+
queryKey: ["workflow", workflowId],
|
|
4392
|
+
queryFn: () => client.getWorkflow(workflowId).details(),
|
|
4393
|
+
retry: false
|
|
4394
|
+
});
|
|
4443
4395
|
};
|
|
4444
4396
|
const useLegacyWorkflow = (workflowId) => {
|
|
4445
4397
|
const [legacyWorkflow, setLegacyWorkflow] = useState(null);
|
|
@@ -5491,6 +5443,154 @@ function determineWorkflowStatus(steps) {
|
|
|
5491
5443
|
}
|
|
5492
5444
|
return "running";
|
|
5493
5445
|
}
|
|
5446
|
+
const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
5447
|
+
if (chunk.type === "workflow-start") {
|
|
5448
|
+
return {
|
|
5449
|
+
...prev,
|
|
5450
|
+
runId: chunk.runId,
|
|
5451
|
+
eventTimestamp: /* @__PURE__ */ new Date(),
|
|
5452
|
+
payload: {
|
|
5453
|
+
...prev?.payload || {},
|
|
5454
|
+
workflowState: {
|
|
5455
|
+
...prev?.payload?.workflowState,
|
|
5456
|
+
status: "running",
|
|
5457
|
+
steps: {}
|
|
5458
|
+
}
|
|
5459
|
+
}
|
|
5460
|
+
};
|
|
5461
|
+
}
|
|
5462
|
+
if (chunk.type === "workflow-step-start") {
|
|
5463
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5464
|
+
return {
|
|
5465
|
+
...prev,
|
|
5466
|
+
payload: {
|
|
5467
|
+
...prev.payload,
|
|
5468
|
+
currentStep: {
|
|
5469
|
+
id: chunk.payload.id,
|
|
5470
|
+
...chunk.payload
|
|
5471
|
+
},
|
|
5472
|
+
workflowState: {
|
|
5473
|
+
...prev.payload.workflowState,
|
|
5474
|
+
steps: {
|
|
5475
|
+
...prev.payload.workflowState.steps,
|
|
5476
|
+
[chunk.payload.id]: {
|
|
5477
|
+
...current || {},
|
|
5478
|
+
...chunk.payload
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
},
|
|
5483
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5484
|
+
};
|
|
5485
|
+
}
|
|
5486
|
+
if (chunk.type === "workflow-step-suspended") {
|
|
5487
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5488
|
+
return {
|
|
5489
|
+
...prev,
|
|
5490
|
+
payload: {
|
|
5491
|
+
...prev.payload,
|
|
5492
|
+
currentStep: {
|
|
5493
|
+
id: chunk.payload.id,
|
|
5494
|
+
...prev?.payload?.currentStep || {},
|
|
5495
|
+
...chunk.payload
|
|
5496
|
+
},
|
|
5497
|
+
workflowState: {
|
|
5498
|
+
...prev.payload.workflowState,
|
|
5499
|
+
status: "suspended",
|
|
5500
|
+
steps: {
|
|
5501
|
+
...prev.payload.workflowState.steps,
|
|
5502
|
+
[chunk.payload.id]: {
|
|
5503
|
+
...current || {},
|
|
5504
|
+
...chunk.payload
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
}
|
|
5508
|
+
},
|
|
5509
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5510
|
+
};
|
|
5511
|
+
}
|
|
5512
|
+
if (chunk.type === "workflow-step-waiting") {
|
|
5513
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5514
|
+
return {
|
|
5515
|
+
...prev,
|
|
5516
|
+
payload: {
|
|
5517
|
+
...prev.payload,
|
|
5518
|
+
currentStep: {
|
|
5519
|
+
id: chunk.payload.id,
|
|
5520
|
+
...prev?.payload?.currentStep || {},
|
|
5521
|
+
...chunk.payload
|
|
5522
|
+
},
|
|
5523
|
+
workflowState: {
|
|
5524
|
+
...prev.payload.workflowState,
|
|
5525
|
+
status: "waiting",
|
|
5526
|
+
steps: {
|
|
5527
|
+
...prev.payload.workflowState.steps,
|
|
5528
|
+
[chunk.payload.id]: {
|
|
5529
|
+
...current,
|
|
5530
|
+
...chunk.payload
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
},
|
|
5535
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5536
|
+
};
|
|
5537
|
+
}
|
|
5538
|
+
if (chunk.type === "workflow-step-result") {
|
|
5539
|
+
const status = chunk.payload.status;
|
|
5540
|
+
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
5541
|
+
return {
|
|
5542
|
+
...prev,
|
|
5543
|
+
payload: {
|
|
5544
|
+
...prev.payload,
|
|
5545
|
+
currentStep: {
|
|
5546
|
+
id: chunk.payload.id,
|
|
5547
|
+
...prev?.payload?.currentStep || {},
|
|
5548
|
+
...chunk.payload
|
|
5549
|
+
},
|
|
5550
|
+
workflowState: {
|
|
5551
|
+
...prev.payload.workflowState,
|
|
5552
|
+
status,
|
|
5553
|
+
steps: {
|
|
5554
|
+
...prev.payload.workflowState.steps,
|
|
5555
|
+
[chunk.payload.id]: {
|
|
5556
|
+
...current,
|
|
5557
|
+
...chunk.payload
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5561
|
+
},
|
|
5562
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5563
|
+
};
|
|
5564
|
+
}
|
|
5565
|
+
if (chunk.type === "workflow-canceled") {
|
|
5566
|
+
return {
|
|
5567
|
+
...prev,
|
|
5568
|
+
payload: {
|
|
5569
|
+
...prev.payload,
|
|
5570
|
+
workflowState: {
|
|
5571
|
+
...prev.payload.workflowState,
|
|
5572
|
+
status: "canceled"
|
|
5573
|
+
}
|
|
5574
|
+
},
|
|
5575
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5576
|
+
};
|
|
5577
|
+
}
|
|
5578
|
+
if (chunk.type === "workflow-finish") {
|
|
5579
|
+
return {
|
|
5580
|
+
...prev,
|
|
5581
|
+
payload: {
|
|
5582
|
+
...prev.payload,
|
|
5583
|
+
currentStep: void 0,
|
|
5584
|
+
workflowState: {
|
|
5585
|
+
...prev.payload.workflowState,
|
|
5586
|
+
status: chunk.payload.workflowStatus
|
|
5587
|
+
}
|
|
5588
|
+
},
|
|
5589
|
+
eventTimestamp: /* @__PURE__ */ new Date()
|
|
5590
|
+
};
|
|
5591
|
+
}
|
|
5592
|
+
return prev;
|
|
5593
|
+
};
|
|
5494
5594
|
|
|
5495
5595
|
const WorkflowRunContext = createContext({});
|
|
5496
5596
|
function WorkflowRunProvider({
|
|
@@ -6099,7 +6199,7 @@ function Spinner({ color = "#fff", className }) {
|
|
|
6099
6199
|
return /* @__PURE__ */ jsx(
|
|
6100
6200
|
"svg",
|
|
6101
6201
|
{
|
|
6102
|
-
className:
|
|
6202
|
+
className: clsx("animate-spin duration-700", className),
|
|
6103
6203
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6104
6204
|
width: "24",
|
|
6105
6205
|
height: "24",
|
|
@@ -6150,7 +6250,6 @@ function LegacyWorkflowNestedGraph({
|
|
|
6150
6250
|
onNodesChange,
|
|
6151
6251
|
children: [
|
|
6152
6252
|
/* @__PURE__ */ jsx(Controls, {}),
|
|
6153
|
-
/* @__PURE__ */ jsx(MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
6154
6253
|
/* @__PURE__ */ jsx(Background, { variant: BackgroundVariant.Lines, gap: 12, size: 0.5 })
|
|
6155
6254
|
]
|
|
6156
6255
|
}
|
|
@@ -6253,7 +6352,6 @@ function LegacyWorkflowGraphInner({ workflow }) {
|
|
|
6253
6352
|
},
|
|
6254
6353
|
children: [
|
|
6255
6354
|
/* @__PURE__ */ jsx(Controls, {}),
|
|
6256
|
-
/* @__PURE__ */ jsx(MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
6257
6355
|
/* @__PURE__ */ jsx(Background, { variant: BackgroundVariant.Dots, gap: 12, size: 0.5 })
|
|
6258
6356
|
]
|
|
6259
6357
|
}
|
|
@@ -7451,7 +7549,6 @@ function WorkflowNestedGraph({
|
|
|
7451
7549
|
onNodesChange,
|
|
7452
7550
|
children: [
|
|
7453
7551
|
/* @__PURE__ */ jsx(ZoomSlider, { position: "bottom-left" }),
|
|
7454
|
-
/* @__PURE__ */ jsx(MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
7455
7552
|
/* @__PURE__ */ jsx(Background, { variant: BackgroundVariant.Lines, gap: 12, size: 0.5 })
|
|
7456
7553
|
]
|
|
7457
7554
|
}
|
|
@@ -7629,7 +7726,6 @@ function WorkflowGraphInner({ workflow, onShowTrace, onSendEvent }) {
|
|
|
7629
7726
|
maxZoom: 1,
|
|
7630
7727
|
children: [
|
|
7631
7728
|
/* @__PURE__ */ jsx(ZoomSlider, { position: "bottom-left" }),
|
|
7632
|
-
/* @__PURE__ */ jsx(MiniMap, { pannable: true, zoomable: true, maskColor: "#121212", bgColor: "#171717", nodeColor: "#2c2c2c" }),
|
|
7633
7729
|
/* @__PURE__ */ jsx(Background, { variant: BackgroundVariant.Dots, gap: 12, size: 0.5 })
|
|
7634
7730
|
]
|
|
7635
7731
|
}
|
|
@@ -8408,44 +8504,83 @@ const EmptyWorkflowsTable = () => /* @__PURE__ */ jsx("div", { className: "flex
|
|
|
8408
8504
|
}
|
|
8409
8505
|
) });
|
|
8410
8506
|
|
|
8411
|
-
const
|
|
8412
|
-
const [
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8507
|
+
const useHandleAgentWorkflowStream = (workflowOutput) => {
|
|
8508
|
+
const [streamResult, setStreamResult] = useState({});
|
|
8509
|
+
useEffect(() => {
|
|
8510
|
+
if (!workflowOutput) return;
|
|
8511
|
+
setStreamResult((prev) => mapWorkflowStreamChunkToWatchResult(prev, workflowOutput));
|
|
8512
|
+
}, [workflowOutput]);
|
|
8513
|
+
return streamResult;
|
|
8514
|
+
};
|
|
8515
|
+
|
|
8516
|
+
const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
|
|
8517
|
+
const client = useMastraClient();
|
|
8518
|
+
return useQuery({
|
|
8519
|
+
queryKey: ["workflow-runs", workflowId],
|
|
8520
|
+
queryFn: () => client.getWorkflow(workflowId).runs({ limit: 50 }),
|
|
8521
|
+
enabled
|
|
8522
|
+
});
|
|
8523
|
+
};
|
|
8524
|
+
|
|
8525
|
+
const WorkflowBadge = ({ workflow, runId, workflowId, isStreaming }) => {
|
|
8526
|
+
const { data: runs, isLoading: isRunsLoading } = useWorkflowRuns(workflowId, {
|
|
8527
|
+
enabled: Boolean(runId) && !isStreaming
|
|
8528
|
+
});
|
|
8529
|
+
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
8530
|
+
const isLoading = isRunsLoading || !run;
|
|
8531
|
+
const snapshot = typeof run?.snapshot === "object" ? run?.snapshot : void 0;
|
|
8532
|
+
return /* @__PURE__ */ jsxs(BadgeWrapper, { icon: /* @__PURE__ */ jsx(WorkflowIcon, { className: "text-accent3" }), title: workflow.name, initialCollapsed: false, children: [
|
|
8533
|
+
!isStreaming && !isLoading && /* @__PURE__ */ jsx(WorkflowRunProvider, { snapshot, children: /* @__PURE__ */ jsx(WorkflowBadgeExtended, { workflowId, workflow, runId }) }),
|
|
8534
|
+
isStreaming && /* @__PURE__ */ jsx(WorkflowBadgeExtended, { workflowId, workflow, runId })
|
|
8427
8535
|
] });
|
|
8428
8536
|
};
|
|
8429
8537
|
const WorkflowBadgeExtended = ({ workflowId, workflow, runId }) => {
|
|
8430
8538
|
const { Link } = useLinkComponent();
|
|
8431
|
-
|
|
8432
|
-
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
8433
|
-
const isLoading = isRunsLoading || !run;
|
|
8434
|
-
return /* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx("div", { className: "border-sm border-border1 rounded-lg bg-surface4", children: /* @__PURE__ */ jsx("div", { className: "p-4 border-b-sm border-border1", children: isLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[50vh]", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8539
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8435
8540
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pb-2", children: [
|
|
8436
8541
|
/* @__PURE__ */ jsx(Button$1, { as: Link, href: `/workflows/${workflowId}/graph`, children: "Go to workflow" }),
|
|
8437
8542
|
/* @__PURE__ */ jsx(Button$1, { as: Link, href: `/workflows/${workflowId}/graph/${runId}`, children: "See run" })
|
|
8438
8543
|
] }),
|
|
8439
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden h-[60vh] w-full", children: /* @__PURE__ */ jsx(
|
|
8440
|
-
] })
|
|
8544
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden h-[60vh] w-full", children: /* @__PURE__ */ jsx(WorkflowGraph, { workflowId, workflow }) })
|
|
8545
|
+
] });
|
|
8546
|
+
};
|
|
8547
|
+
const useWorkflowStream = (partialWorkflowOutput) => {
|
|
8548
|
+
const streamResult = useHandleAgentWorkflowStream(partialWorkflowOutput);
|
|
8549
|
+
const { setResult } = useContext(WorkflowRunContext);
|
|
8550
|
+
useEffect(() => {
|
|
8551
|
+
if (!streamResult) return;
|
|
8552
|
+
setResult(streamResult);
|
|
8553
|
+
}, [streamResult]);
|
|
8441
8554
|
};
|
|
8442
8555
|
|
|
8443
|
-
const
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8556
|
+
const LoadingBadge = () => {
|
|
8557
|
+
return /* @__PURE__ */ jsx(
|
|
8558
|
+
BadgeWrapper,
|
|
8559
|
+
{
|
|
8560
|
+
icon: /* @__PURE__ */ jsx(Spinner, { color: IconColors.icon3 }),
|
|
8561
|
+
title: /* @__PURE__ */ jsx(Skeleton, { className: "ml-2 w-12 h-2" }),
|
|
8562
|
+
collapsible: false
|
|
8563
|
+
}
|
|
8564
|
+
);
|
|
8565
|
+
};
|
|
8566
|
+
|
|
8567
|
+
const ToolFallback$1 = ({ toolName, argsText, result, args, ...props }) => {
|
|
8568
|
+
return /* @__PURE__ */ jsx(WorkflowRunProvider, { children: /* @__PURE__ */ jsx(ToolFallbackInner, { toolName, argsText, result, args, ...props }) });
|
|
8569
|
+
};
|
|
8570
|
+
const ToolFallbackInner = ({ toolName, argsText, result, args }) => {
|
|
8571
|
+
useWorkflowStream(args.__mastraMetadata?.partialChunk);
|
|
8572
|
+
const { data: workflow, isLoading } = useWorkflow(toolName);
|
|
8573
|
+
if (isLoading) return /* @__PURE__ */ jsx(LoadingBadge, {});
|
|
8447
8574
|
if (workflow) {
|
|
8448
|
-
return /* @__PURE__ */ jsx(
|
|
8575
|
+
return /* @__PURE__ */ jsx(
|
|
8576
|
+
WorkflowBadge,
|
|
8577
|
+
{
|
|
8578
|
+
workflowId: toolName,
|
|
8579
|
+
workflow,
|
|
8580
|
+
isStreaming: args.__mastraMetadata?.isStreaming,
|
|
8581
|
+
runId: result?.runId
|
|
8582
|
+
}
|
|
8583
|
+
);
|
|
8449
8584
|
}
|
|
8450
8585
|
return /* @__PURE__ */ jsx(ToolBadge, { toolName, argsText, result });
|
|
8451
8586
|
};
|
|
@@ -9057,7 +9192,7 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, onInputChange })
|
|
|
9057
9192
|
const WrappedAssistantMessage = (props) => {
|
|
9058
9193
|
return /* @__PURE__ */ jsx(AssistantMessage, { ...props, ToolFallback });
|
|
9059
9194
|
};
|
|
9060
|
-
return /* @__PURE__ */
|
|
9195
|
+
return /* @__PURE__ */ jsxs(ThreadWrapper$1, { children: [
|
|
9061
9196
|
/* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { ref: areaRef, autoScroll: false, className: "overflow-y-scroll scroll-smooth h-full", children: [
|
|
9062
9197
|
/* @__PURE__ */ jsx(ThreadWelcome$1, { agentName }),
|
|
9063
9198
|
/* @__PURE__ */ jsx("div", { className: "max-w-[568px] w-full mx-auto px-4 pb-7", children: /* @__PURE__ */ jsx(
|
|
@@ -9073,7 +9208,7 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, onInputChange })
|
|
|
9073
9208
|
/* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
|
|
9074
9209
|
] }),
|
|
9075
9210
|
/* @__PURE__ */ jsx(Composer$1, { hasMemory, onInputChange, agentId })
|
|
9076
|
-
] })
|
|
9211
|
+
] });
|
|
9077
9212
|
};
|
|
9078
9213
|
const ThreadWrapper$1 = ({ children }) => {
|
|
9079
9214
|
return /* @__PURE__ */ jsx(ThreadPrimitive.Root, { className: "grid grid-rows-[1fr_auto] h-full overflow-y-auto", children });
|
|
@@ -9759,6 +9894,37 @@ function MastraRuntimeProvider({
|
|
|
9759
9894
|
updater();
|
|
9760
9895
|
break;
|
|
9761
9896
|
}
|
|
9897
|
+
case "tool-output": {
|
|
9898
|
+
if (!chunk.payload.output?.type.startsWith("workflow-")) return;
|
|
9899
|
+
flushSync(() => {
|
|
9900
|
+
setMessages((currentConversation) => {
|
|
9901
|
+
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
9902
|
+
const contentArray = Array.isArray(lastMessage.content) ? lastMessage.content : [{ type: "text", text: lastMessage.content }];
|
|
9903
|
+
const newMessage = {
|
|
9904
|
+
...lastMessage,
|
|
9905
|
+
content: contentArray.map((part) => {
|
|
9906
|
+
if (part.type === "tool-call") {
|
|
9907
|
+
return {
|
|
9908
|
+
...part,
|
|
9909
|
+
...chunk.payload,
|
|
9910
|
+
args: {
|
|
9911
|
+
...part.args,
|
|
9912
|
+
__mastraMetadata: {
|
|
9913
|
+
...part.args?.__mastraMetadata,
|
|
9914
|
+
partialChunk: chunk?.payload?.output,
|
|
9915
|
+
isStreaming: true
|
|
9916
|
+
}
|
|
9917
|
+
}
|
|
9918
|
+
};
|
|
9919
|
+
}
|
|
9920
|
+
return part;
|
|
9921
|
+
})
|
|
9922
|
+
};
|
|
9923
|
+
return [...currentConversation.slice(0, -1), newMessage];
|
|
9924
|
+
});
|
|
9925
|
+
});
|
|
9926
|
+
break;
|
|
9927
|
+
}
|
|
9762
9928
|
case "tool-call": {
|
|
9763
9929
|
setMessages((currentConversation) => {
|
|
9764
9930
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
@@ -9771,7 +9937,13 @@ function MastraRuntimeProvider({
|
|
|
9771
9937
|
type: "tool-call",
|
|
9772
9938
|
toolCallId: chunk.payload.toolCallId,
|
|
9773
9939
|
toolName: chunk.payload.toolName,
|
|
9774
|
-
args:
|
|
9940
|
+
args: {
|
|
9941
|
+
...chunk.payload.args,
|
|
9942
|
+
__mastraMetadata: {
|
|
9943
|
+
...chunk.payload.args?.__mastraMetadata,
|
|
9944
|
+
isStreaming: true
|
|
9945
|
+
}
|
|
9946
|
+
}
|
|
9775
9947
|
}
|
|
9776
9948
|
] : [
|
|
9777
9949
|
...typeof lastMessage.content === "string" ? [{ type: "text", text: lastMessage.content }] : [],
|
|
@@ -9779,7 +9951,13 @@ function MastraRuntimeProvider({
|
|
|
9779
9951
|
type: "tool-call",
|
|
9780
9952
|
toolCallId: chunk.payload.toolCallId,
|
|
9781
9953
|
toolName: chunk.payload.toolName,
|
|
9782
|
-
args:
|
|
9954
|
+
args: {
|
|
9955
|
+
...chunk.payload.args,
|
|
9956
|
+
__mastraMetadata: {
|
|
9957
|
+
...chunk.payload.args?.__mastraMetadata,
|
|
9958
|
+
isStreaming: true
|
|
9959
|
+
}
|
|
9960
|
+
}
|
|
9783
9961
|
}
|
|
9784
9962
|
]
|
|
9785
9963
|
};
|
|
@@ -9795,7 +9973,10 @@ function MastraRuntimeProvider({
|
|
|
9795
9973
|
type: "tool-call",
|
|
9796
9974
|
toolCallId: chunk.payload.toolCallId,
|
|
9797
9975
|
toolName: chunk.payload.toolName,
|
|
9798
|
-
args:
|
|
9976
|
+
args: {
|
|
9977
|
+
...chunk.payload.args,
|
|
9978
|
+
__mastraMetadata: { ...chunk.payload.args?.__mastraMetadata, isStreaming: true }
|
|
9979
|
+
}
|
|
9799
9980
|
}
|
|
9800
9981
|
]
|
|
9801
9982
|
};
|
|
@@ -12958,8 +13139,8 @@ const StepEntry = ({ stepId, step, runId }) => {
|
|
|
12958
13139
|
] });
|
|
12959
13140
|
};
|
|
12960
13141
|
const WorkflowStepResultDialog = ({ open, onOpenChange, workflowId, runId }) => {
|
|
12961
|
-
const { runs } = useWorkflowRuns(workflowId);
|
|
12962
|
-
const { workflow, isLoading } = useWorkflow(workflowId);
|
|
13142
|
+
const { data: runs } = useWorkflowRuns(workflowId);
|
|
13143
|
+
const { data: workflow, isLoading } = useWorkflow(workflowId);
|
|
12963
13144
|
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
12964
13145
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx(DialogPortal, { children: /* @__PURE__ */ jsx(DialogContent, { className: "h-[90vh] w-[90%] max-w-[unset]", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 h-full", children: [
|
|
12965
13146
|
/* @__PURE__ */ jsx(DialogTitle, { children: "Workflow details" }),
|
|
@@ -14569,7 +14750,8 @@ function EntryList({
|
|
|
14569
14750
|
perPage,
|
|
14570
14751
|
columns,
|
|
14571
14752
|
searchTerm,
|
|
14572
|
-
setEndOfListElement
|
|
14753
|
+
setEndOfListElement,
|
|
14754
|
+
errorMsg
|
|
14573
14755
|
}) {
|
|
14574
14756
|
const loadingItems = Array.from({ length: 3 }).map((_, index) => {
|
|
14575
14757
|
return {
|
|
@@ -14593,8 +14775,24 @@ function EntryList({
|
|
|
14593
14775
|
children: columns?.map((col) => /* @__PURE__ */ jsx("span", { children: col.label || col.name }, col.name))
|
|
14594
14776
|
}
|
|
14595
14777
|
) }),
|
|
14596
|
-
|
|
14597
|
-
|
|
14778
|
+
errorMsg && !isLoading && /* @__PURE__ */ jsx("div", { className: "grid border border-border1 border-t-0 bg-surface3 rounded-xl rounded-t-none", children: /* @__PURE__ */ jsxs(
|
|
14779
|
+
"p",
|
|
14780
|
+
{
|
|
14781
|
+
className: cn(
|
|
14782
|
+
"text-[0.875rem] text-center items-center flex justify-center p-[2.5rem] gap-[1rem] text-icon3",
|
|
14783
|
+
"[&>svg]:w-[1.5em]",
|
|
14784
|
+
"[&>svg]:h-[1.5em]",
|
|
14785
|
+
"[&>svg]:text-red-500"
|
|
14786
|
+
),
|
|
14787
|
+
children: [
|
|
14788
|
+
/* @__PURE__ */ jsx(TriangleAlertIcon, {}),
|
|
14789
|
+
" ",
|
|
14790
|
+
errorMsg || "Something went wrong while fetching the data."
|
|
14791
|
+
]
|
|
14792
|
+
}
|
|
14793
|
+
) }),
|
|
14794
|
+
!isLoading && !errorMsg && items?.length === 0 && /* @__PURE__ */ jsx("div", { className: "grid border border-border1 border-t-0 bg-surface3 rounded-xl rounded-t-none", children: /* @__PURE__ */ 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" }) }),
|
|
14795
|
+
!errorMsg && items?.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14598
14796
|
/* @__PURE__ */ jsx("ul", { className: "grid border border-border1 border-t-0 bg-surface3 rounded-xl rounded-t-none overflow-y-auto", children: items.map((item) => {
|
|
14599
14797
|
return /* @__PURE__ */ jsx(
|
|
14600
14798
|
EntryListItem,
|
|
@@ -14927,8 +15125,8 @@ function SideDialogHeading({ children, className, as = "h1" }) {
|
|
|
14927
15125
|
HeadingTag,
|
|
14928
15126
|
{
|
|
14929
15127
|
className: cn(
|
|
14930
|
-
"flex items-start text-icon4 text-[1.125rem] font-semibold gap-[
|
|
14931
|
-
"[&>svg]:w-[1.
|
|
15128
|
+
"flex items-start text-icon4 text-[1.125rem] font-semibold gap-[.5rem]",
|
|
15129
|
+
"[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:shrink-0 [&>svg]:mt-[.2em] [&>svg]:opacity-70",
|
|
14932
15130
|
{
|
|
14933
15131
|
"text-[1.125rem]": as === "h1",
|
|
14934
15132
|
"text-[1rem]": as === "h2"
|
|
@@ -15333,7 +15531,7 @@ const DefaultTrigger = React.forwardRef(
|
|
|
15333
15531
|
({ value, placeholder, className, ...props }, ref) => {
|
|
15334
15532
|
return /* @__PURE__ */ jsxs(Button, { ref, variant: "outline", className: cn("justify-start", className), ...props, children: [
|
|
15335
15533
|
/* @__PURE__ */ jsx(CalendarIcon, { className: "h-4 w-4" }),
|
|
15336
|
-
value ? /* @__PURE__ */ jsx("span", { className: "text-white", children: format(value, "
|
|
15534
|
+
value ? /* @__PURE__ */ jsx("span", { className: "text-white", children: format(value, "PP p") }) : /* @__PURE__ */ jsx("span", { className: "text-gray", children: placeholder ?? "Pick a date" })
|
|
15337
15535
|
] });
|
|
15338
15536
|
}
|
|
15339
15537
|
);
|
|
@@ -15343,8 +15541,8 @@ function TextAndIcon({ children, className }) {
|
|
|
15343
15541
|
"span",
|
|
15344
15542
|
{
|
|
15345
15543
|
className: cn(
|
|
15346
|
-
"flex items-center gap-[0.
|
|
15347
|
-
"[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",
|
|
15544
|
+
"flex items-center gap-[0.5em] text-icon4 text-[0.875rem]",
|
|
15545
|
+
"[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50 [&_svg]:flex-shrink-0",
|
|
15348
15546
|
className
|
|
15349
15547
|
),
|
|
15350
15548
|
children
|
|
@@ -16822,7 +17020,8 @@ function TraceTimelineSpan({
|
|
|
16822
17020
|
selectedSpanId,
|
|
16823
17021
|
isLastChild,
|
|
16824
17022
|
overallLatency,
|
|
16825
|
-
overallStartTime
|
|
17023
|
+
overallStartTime,
|
|
17024
|
+
overallEndTime
|
|
16826
17025
|
}) {
|
|
16827
17026
|
const { Link } = useLinkComponent();
|
|
16828
17027
|
const [isHovered, setIsHovered] = useState(false);
|
|
@@ -16877,7 +17076,7 @@ function TraceTimelineSpan({
|
|
|
16877
17076
|
onMouseEnter: () => setIsHovered(true),
|
|
16878
17077
|
onMouseLeave: () => setIsHovered(false),
|
|
16879
17078
|
children: [
|
|
16880
|
-
/* @__PURE__ */ jsx("div", { className: "text-left text-[0.75rem] relative w-full h-[1.4rem] ", children: /* @__PURE__ */ jsxs(
|
|
17079
|
+
/* @__PURE__ */ jsx("div", { className: "text-left text-[0.75rem] relative w-full h-[1.4rem] min-w-[6rem]", children: /* @__PURE__ */ jsxs(
|
|
16881
17080
|
"span",
|
|
16882
17081
|
{
|
|
16883
17082
|
className: cn(
|
|
@@ -17032,6 +17231,7 @@ function TraceTimeline({
|
|
|
17032
17231
|
}) {
|
|
17033
17232
|
const overallLatency = hierarchicalSpans?.[0]?.latency || 0;
|
|
17034
17233
|
const overallStartTime = hierarchicalSpans?.[0]?.startTime || "";
|
|
17234
|
+
const overallEndTime = hierarchicalSpans?.[0]?.endTime || "";
|
|
17035
17235
|
return /* @__PURE__ */ jsxs("div", { className: cn("grid gap-[1rem]", className), children: [
|
|
17036
17236
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full justify-between pr-[2.5rem]", children: [
|
|
17037
17237
|
/* @__PURE__ */ jsxs(SideDialogHeading, { as: "h2", children: [
|
|
@@ -17055,10 +17255,10 @@ function TraceTimeline({
|
|
|
17055
17255
|
) : /* @__PURE__ */ jsx(
|
|
17056
17256
|
"div",
|
|
17057
17257
|
{
|
|
17058
|
-
className: cn(
|
|
17059
|
-
"
|
|
17060
|
-
"xl:grid-cols-[3fr_2fr]
|
|
17061
|
-
),
|
|
17258
|
+
className: cn("grid items-start content-start gap-y-[2px]", "xl:gap-x-[1rem] xl:py-[1rem]", {
|
|
17259
|
+
"xl:grid-cols-[3fr_auto]": !overallEndTime,
|
|
17260
|
+
"xl:grid-cols-[3fr_2fr]": overallEndTime
|
|
17261
|
+
}),
|
|
17062
17262
|
children: hierarchicalSpans?.map((span) => /* @__PURE__ */ jsx(
|
|
17063
17263
|
TraceTimelineSpan,
|
|
17064
17264
|
{
|
|
@@ -17066,7 +17266,8 @@ function TraceTimeline({
|
|
|
17066
17266
|
onSpanClick,
|
|
17067
17267
|
selectedSpanId,
|
|
17068
17268
|
overallLatency,
|
|
17069
|
-
overallStartTime
|
|
17269
|
+
overallStartTime,
|
|
17270
|
+
overallEndTime
|
|
17070
17271
|
},
|
|
17071
17272
|
span.id
|
|
17072
17273
|
))
|
|
@@ -17256,7 +17457,7 @@ function getSpanInfo({ span, withTraceId = true, withSpanId = true }) {
|
|
|
17256
17457
|
if (withSpanId) {
|
|
17257
17458
|
baseInfo.unshift({
|
|
17258
17459
|
key: "spanId",
|
|
17259
|
-
label: "
|
|
17460
|
+
label: "#",
|
|
17260
17461
|
value: span?.spanId
|
|
17261
17462
|
});
|
|
17262
17463
|
}
|
|
@@ -17293,7 +17494,7 @@ function SpanDialog({
|
|
|
17293
17494
|
isOpen,
|
|
17294
17495
|
onClose,
|
|
17295
17496
|
hasCloseButton: true,
|
|
17296
|
-
className: cn("w-[calc(100vw-
|
|
17497
|
+
className: cn("w-[calc(100vw-25rem)] max-w-[65%]", "3xl:max-w-[50%]", "4xl:max-w-[40%]"),
|
|
17297
17498
|
children: [
|
|
17298
17499
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pr-[1.5rem]", children: [
|
|
17299
17500
|
/* @__PURE__ */ jsx(SideDialogTop, { onNext, onPrevious, showInnerNav: true, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[1rem] text-icon4 text-[0.875rem]", children: [
|
|
@@ -17401,7 +17602,7 @@ function TraceDialog({
|
|
|
17401
17602
|
isOpen,
|
|
17402
17603
|
onClose,
|
|
17403
17604
|
hasCloseButton: !dialogIsOpen || combinedView,
|
|
17404
|
-
className: cn("w-[calc(100vw-20rem)] max-w-[
|
|
17605
|
+
className: cn("w-[calc(100vw-20rem)] max-w-[80%]", "3xl:max-w-[65%]", "4xl:max-w-[55%]"),
|
|
17405
17606
|
children: [
|
|
17406
17607
|
/* @__PURE__ */ jsx(SideDialogTop, { onNext, onPrevious, showInnerNav: true, children: /* @__PURE__ */ jsxs(TextAndIcon, { children: [
|
|
17407
17608
|
/* @__PURE__ */ jsx(EyeIcon, {}),
|
|
@@ -17427,7 +17628,7 @@ function TraceDialog({
|
|
|
17427
17628
|
traceId
|
|
17428
17629
|
] })
|
|
17429
17630
|
] }),
|
|
17430
|
-
/* @__PURE__ */ jsxs("div", { className: "overflow-y-auto pb-[2.5rem]", children: [
|
|
17631
|
+
/* @__PURE__ */ jsxs("div", { className: cn("overflow-y-auto pb-[2.5rem]"), children: [
|
|
17431
17632
|
traceDetails?.metadata?.usage && /* @__PURE__ */ jsx(
|
|
17432
17633
|
TraceSpanUsage,
|
|
17433
17634
|
{
|
|
@@ -17467,7 +17668,7 @@ function TraceDialog({
|
|
|
17467
17668
|
] }),
|
|
17468
17669
|
"›",
|
|
17469
17670
|
/* @__PURE__ */ jsxs(TextAndIcon, { children: [
|
|
17470
|
-
/* @__PURE__ */ jsx(
|
|
17671
|
+
/* @__PURE__ */ jsx(ChevronsLeftRightEllipsisIcon, {}),
|
|
17471
17672
|
" ",
|
|
17472
17673
|
getShortId(selectedSpanId)
|
|
17473
17674
|
] })
|
|
@@ -17554,7 +17755,7 @@ function TracesTools({
|
|
|
17554
17755
|
value: selectedDateFrom,
|
|
17555
17756
|
maxValue: selectedDateTo,
|
|
17556
17757
|
onValueChange: (date) => onDateChange?.(date, "from"),
|
|
17557
|
-
className: "min-w-[
|
|
17758
|
+
className: "min-w-[13rem]",
|
|
17558
17759
|
defaultTimeStrValue: "12:00 AM",
|
|
17559
17760
|
disabled: isLoading
|
|
17560
17761
|
}
|
|
@@ -17566,7 +17767,7 @@ function TracesTools({
|
|
|
17566
17767
|
value: selectedDateTo,
|
|
17567
17768
|
minValue: selectedDateFrom,
|
|
17568
17769
|
onValueChange: (date) => onDateChange?.(date, "to"),
|
|
17569
|
-
className: "min-w-[
|
|
17770
|
+
className: "min-w-[13rem]",
|
|
17570
17771
|
defaultTimeStrValue: "11:59 PM",
|
|
17571
17772
|
disabled: isLoading
|
|
17572
17773
|
}
|
|
@@ -18181,5 +18382,5 @@ const MemorySearch = ({
|
|
|
18181
18382
|
] });
|
|
18182
18383
|
};
|
|
18183
18384
|
|
|
18184
|
-
export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AgentsTableSkeleton, AiIcon, AlertDialog, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyAgentsTable, EmptyScorerList, EmptyState, EmptyWorkflowsTable, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LinkComponentProvider, LogsIcon, MainContentContent, MainContentLayout, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, NetworkChat, NetworkContext, NetworkProvider, NetworkTable, NetworkTableEmpty, NetworkTableSkeleton, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreIcon, ScorerList, ScorerSkeleton, SearchField, Searchbar, SelectField, SettingsIcon, SideDialog, SideDialogCodeSection, SideDialogContent, SideDialogFooter, SideDialogFooterGroup, SideDialogHeader, SideDialogHeading, SideDialogKeyValueList, SideDialogSection, SideDialogTop, SlashIcon, SliderField, Tab, TabContent, TabList, Table$1 as Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, TextareaField, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolList, ToolListEmpty, ToolListSkeleton, ToolsIcon, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VNextNetworkChat, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowRuns, WorkflowTable, WorkflowTableSkeleton, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, providerMapToIcon, spanTypePrefixes, transformKey, useAgentSettings, useCurrentRun, useInView, useLinkComponent, useMastraClient, usePlaygroundStore, usePolling, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSpeechRecognition, useWorkingMemory };
|
|
18385
|
+
export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AgentsTableSkeleton, AiIcon, AlertDialog, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyAgentsTable, EmptyScorerList, EmptyState, EmptyWorkflowsTable, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LinkComponentProvider, LogsIcon, MainContentContent, MainContentLayout, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, NetworkChat, NetworkContext, NetworkProvider, NetworkTable, NetworkTableEmpty, NetworkTableSkeleton, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreIcon, ScorerList, ScorerSkeleton, SearchField, Searchbar, SelectField, SettingsIcon, SideDialog, SideDialogCodeSection, SideDialogContent, SideDialogFooter, SideDialogFooterGroup, SideDialogHeader, SideDialogHeading, SideDialogKeyValueList, SideDialogSection, SideDialogTop, SlashIcon, SliderField, Tab, TabContent, TabList, Table$1 as Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, TextareaField, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolList, ToolListEmpty, ToolListSkeleton, ToolsIcon, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VNextNetworkChat, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowRuns, WorkflowTable, WorkflowTableSkeleton, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToWatchResult, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, mapWorkflowStreamChunkToWatchResult, providerMapToIcon, spanTypePrefixes, transformKey, useAgentSettings, useCurrentRun, useInView, useLinkComponent, useMastraClient, usePlaygroundStore, usePolling, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSpeechRecognition, useWorkingMemory };
|
|
18185
18386
|
//# sourceMappingURL=index.es.js.map
|