@mastra/playground-ui 5.0.1-alpha.2 → 5.0.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domains/agents/agent/agent-traces.d.ts +2 -1
- package/dist/domains/networks/index.d.ts +1 -0
- package/dist/domains/networks/network-context.d.ts +13 -0
- package/dist/ds/components/Table/Table.d.ts +2 -1
- package/dist/index.cjs.js +86 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +86 -28
- package/dist/index.es.js.map +1 -1
- package/dist/services/network-runtime-provider.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface AgentTracesProps {
|
|
2
2
|
agentName: string;
|
|
3
3
|
baseUrl: string;
|
|
4
|
+
className?: string;
|
|
4
5
|
}
|
|
5
|
-
export declare function AgentTraces({ agentName, baseUrl }: AgentTracesProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function AgentTraces({ agentName, baseUrl, className }: AgentTracesProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from '../../../node_modules/@types/react';
|
|
2
|
+
import { ModelSettings } from '../../types';
|
|
3
|
+
|
|
4
|
+
type NetworkContextType = {
|
|
5
|
+
modelSettings: ModelSettings;
|
|
6
|
+
setModelSettings: React.Dispatch<React.SetStateAction<ModelSettings>>;
|
|
7
|
+
resetModelSettings: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const NetworkContext: import('../../../node_modules/@types/react').Context<NetworkContextType>;
|
|
10
|
+
export declare function NetworkProvider({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -25,5 +25,6 @@ export interface RowProps {
|
|
|
25
25
|
className?: string;
|
|
26
26
|
children: React.ReactNode;
|
|
27
27
|
selected?: boolean;
|
|
28
|
+
onClick?: () => void;
|
|
28
29
|
}
|
|
29
|
-
export declare const Row: ({ className, children, selected }: RowProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const Row: ({ className, children, selected, onClick }: RowProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.cjs.js
CHANGED
|
@@ -4317,7 +4317,7 @@ function MastraRuntimeProvider({
|
|
|
4317
4317
|
] });
|
|
4318
4318
|
}
|
|
4319
4319
|
|
|
4320
|
-
const defaultModelSettings = {
|
|
4320
|
+
const defaultModelSettings$1 = {
|
|
4321
4321
|
maxRetries: 2,
|
|
4322
4322
|
maxSteps: 5,
|
|
4323
4323
|
temperature: 0.5,
|
|
@@ -4325,10 +4325,10 @@ const defaultModelSettings = {
|
|
|
4325
4325
|
};
|
|
4326
4326
|
const AgentContext = React.createContext({});
|
|
4327
4327
|
function AgentProvider({ children }) {
|
|
4328
|
-
const [modelSettings, setModelSettings] = React.useState(defaultModelSettings);
|
|
4328
|
+
const [modelSettings, setModelSettings] = React.useState(defaultModelSettings$1);
|
|
4329
4329
|
const [chatWithGenerate, setChatWithGenerate] = React.useState(false);
|
|
4330
4330
|
const resetModelSettings = () => {
|
|
4331
|
-
setModelSettings(defaultModelSettings);
|
|
4331
|
+
setModelSettings(defaultModelSettings$1);
|
|
4332
4332
|
};
|
|
4333
4333
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4334
4334
|
AgentContext.Provider,
|
|
@@ -5125,8 +5125,20 @@ const Th = ({ className, children, ...props }) => {
|
|
|
5125
5125
|
const Tbody = ({ className, children }) => {
|
|
5126
5126
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: clsx("", className), children });
|
|
5127
5127
|
};
|
|
5128
|
-
const Row = ({ className, children, selected = false }) => {
|
|
5129
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5128
|
+
const Row = ({ className, children, selected = false, onClick }) => {
|
|
5129
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5130
|
+
"tr",
|
|
5131
|
+
{
|
|
5132
|
+
className: clsx(
|
|
5133
|
+
"border-b-sm border-border1 hover:bg-surface3",
|
|
5134
|
+
selected && "bg-surface4",
|
|
5135
|
+
onClick && "cursor-pointer",
|
|
5136
|
+
className
|
|
5137
|
+
),
|
|
5138
|
+
onClick,
|
|
5139
|
+
children
|
|
5140
|
+
}
|
|
5141
|
+
);
|
|
5130
5142
|
};
|
|
5131
5143
|
|
|
5132
5144
|
const variants = {
|
|
@@ -5219,7 +5231,8 @@ const TracesTableError = ({ error, colsCount }) => {
|
|
|
5219
5231
|
};
|
|
5220
5232
|
const TraceRow = ({ trace, index, isActive }) => {
|
|
5221
5233
|
const { openTrace } = useOpenTrace();
|
|
5222
|
-
|
|
5234
|
+
const hasFailure = trace.trace.some((span) => span.status.code !== 0);
|
|
5235
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Row, { className: isActive ? "bg-surface4" : "", onClick: () => openTrace(trace.trace, index), children: [
|
|
5223
5236
|
/* @__PURE__ */ jsxRuntime.jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
|
|
5224
5237
|
/* @__PURE__ */ jsxRuntime.jsx(TxtCell, { children: trace.traceId }),
|
|
5225
5238
|
/* @__PURE__ */ jsxRuntime.jsx(UnitCell, { unit: "ms", children: trace.duration / 1e3 }),
|
|
@@ -5227,7 +5240,8 @@ const TraceRow = ({ trace, index, isActive }) => {
|
|
|
5227
5240
|
trace.trace.length,
|
|
5228
5241
|
" span",
|
|
5229
5242
|
trace.trace.length > 1 ? "s" : ""
|
|
5230
|
-
] }) }) })
|
|
5243
|
+
] }) }) }),
|
|
5244
|
+
/* @__PURE__ */ jsxRuntime.jsx(Cell, { children: hasFailure ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: "Failed" }) : /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}), variant: "success", children: "Success" }) })
|
|
5231
5245
|
] });
|
|
5232
5246
|
};
|
|
5233
5247
|
const TracesTable = ({ traces, isLoading, error }) => {
|
|
@@ -5239,7 +5253,8 @@ const TracesTable = ({ traces, isLoading, error }) => {
|
|
|
5239
5253
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Time" }),
|
|
5240
5254
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: "auto", children: "Trace Id" }),
|
|
5241
5255
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Duration" }),
|
|
5242
|
-
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Spans" })
|
|
5256
|
+
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Spans" }),
|
|
5257
|
+
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Status" })
|
|
5243
5258
|
] }),
|
|
5244
5259
|
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsxRuntime.jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) })
|
|
5245
5260
|
] });
|
|
@@ -5361,7 +5376,7 @@ const variantClasses = {
|
|
|
5361
5376
|
};
|
|
5362
5377
|
const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
|
|
5363
5378
|
const variantClass = variant ? variantClasses[variant] : "bg-accent3";
|
|
5364
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5379
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[166px] shrink-0", children: [
|
|
5365
5380
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("absolute h-1 rounded-full", variantClass), style: { width: `${progressPercent}%` } }) }),
|
|
5366
5381
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
|
|
5367
5382
|
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
|
|
@@ -5412,8 +5427,8 @@ const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClic
|
|
|
5412
5427
|
const progressPercent = durationMs / traceDuration * 100;
|
|
5413
5428
|
const TextEl = onClick ? "button" : "div";
|
|
5414
5429
|
return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationProvider, { durationMs, children: /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
5415
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("
|
|
5416
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-8 items-center gap-1", children: [
|
|
5430
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("flex justify-between items-center gap-2 rounded-md pl-2", isActive && "bg-surface4"), children: [
|
|
5431
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-8 items-center gap-1 min-w-0", children: [
|
|
5417
5432
|
spans ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5418
5433
|
"button",
|
|
5419
5434
|
{
|
|
@@ -5551,6 +5566,7 @@ function TraceDetails() {
|
|
|
5551
5566
|
const { trace, currentTraceIndex, prevTrace, nextTrace, traces, clearData } = React.useContext(TraceContext);
|
|
5552
5567
|
const actualTrace = traces[currentTraceIndex];
|
|
5553
5568
|
if (!actualTrace || !trace) return null;
|
|
5569
|
+
const hasFailure = trace.some((span) => span.status.code !== 0);
|
|
5554
5570
|
return /* @__PURE__ */ jsxRuntime.jsxs("aside", { children: [
|
|
5555
5571
|
/* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
|
|
5556
5572
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -5565,10 +5581,13 @@ function TraceDetails() {
|
|
|
5565
5581
|
}
|
|
5566
5582
|
)
|
|
5567
5583
|
] }),
|
|
5568
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5569
|
-
"
|
|
5570
|
-
|
|
5571
|
-
|
|
5584
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 justify-between w-full", children: [
|
|
5585
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5 shrink-0", children: [
|
|
5586
|
+
"Trace ",
|
|
5587
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 5) })
|
|
5588
|
+
] }),
|
|
5589
|
+
hasFailure && /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: "Failed" })
|
|
5590
|
+
] })
|
|
5572
5591
|
] }),
|
|
5573
5592
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5", children: /* @__PURE__ */ jsxRuntime.jsx(SpanView, { trace }) })
|
|
5574
5593
|
] });
|
|
@@ -5629,7 +5648,11 @@ function SpanDetail() {
|
|
|
5629
5648
|
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: "bg-surface4 p-1 rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(SpanIcon, { className: variantClass }) }),
|
|
5630
5649
|
span.name
|
|
5631
5650
|
] }),
|
|
5632
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 items-center", children: /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(LatencyIcon, {}), children: [
|
|
5651
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 items-center", children: span.status.code === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(LatencyIcon, {}), variant: "success", children: [
|
|
5652
|
+
formatDuration(span.duration),
|
|
5653
|
+
"ms"
|
|
5654
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: [
|
|
5655
|
+
"Failed in ",
|
|
5633
5656
|
formatDuration(span.duration),
|
|
5634
5657
|
"ms"
|
|
5635
5658
|
] }) }),
|
|
@@ -5716,15 +5739,15 @@ const TracesSidebar = ({ onResize }) => {
|
|
|
5716
5739
|
);
|
|
5717
5740
|
};
|
|
5718
5741
|
|
|
5719
|
-
function AgentTraces({ agentName, baseUrl }) {
|
|
5720
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { agentName, baseUrl }) });
|
|
5742
|
+
function AgentTraces({ agentName, baseUrl, className }) {
|
|
5743
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { agentName, baseUrl, className }) });
|
|
5721
5744
|
}
|
|
5722
|
-
function AgentTracesInner({ agentName, baseUrl }) {
|
|
5745
|
+
function AgentTracesInner({ agentName, baseUrl, className }) {
|
|
5723
5746
|
const [sidebarWidth, setSidebarWidth] = React.useState(100);
|
|
5724
5747
|
const { traces, firstCallLoading, error } = useTraces(agentName, baseUrl);
|
|
5725
5748
|
const { isOpen: open } = React.useContext(TraceContext);
|
|
5726
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("
|
|
5727
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("h-full", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
|
|
5749
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("h-full relative overflow-hidden flex", className), children: [
|
|
5750
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("h-full overflow-y-scroll", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
|
|
5728
5751
|
open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
|
|
5729
5752
|
] });
|
|
5730
5753
|
}
|
|
@@ -5739,11 +5762,13 @@ function MastraNetworkRuntimeProvider({
|
|
|
5739
5762
|
memory,
|
|
5740
5763
|
threadId,
|
|
5741
5764
|
baseUrl,
|
|
5742
|
-
refreshThreadList
|
|
5765
|
+
refreshThreadList,
|
|
5766
|
+
modelSettings = {}
|
|
5743
5767
|
}) {
|
|
5744
5768
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
5745
5769
|
const [messages, setMessages] = React.useState(initialMessages || []);
|
|
5746
5770
|
const [currentThreadId, setCurrentThreadId] = React.useState(threadId);
|
|
5771
|
+
const { frequencyPenalty, presencePenalty, maxRetries, maxSteps, maxTokens, temperature, topK, topP, instructions } = modelSettings;
|
|
5747
5772
|
React.useEffect(() => {
|
|
5748
5773
|
if (messages.length === 0 || currentThreadId !== threadId) {
|
|
5749
5774
|
if (initialMessages && threadId && memory) {
|
|
@@ -5753,8 +5778,6 @@ function MastraNetworkRuntimeProvider({
|
|
|
5753
5778
|
}
|
|
5754
5779
|
}, [initialMessages, threadId, memory, messages]);
|
|
5755
5780
|
const mastra = createMastraClient(baseUrl);
|
|
5756
|
-
console.log("MastraClient initialized");
|
|
5757
|
-
console.log(messages, "###");
|
|
5758
5781
|
const network = mastra.getNetwork(agentId);
|
|
5759
5782
|
const onNew = async (message) => {
|
|
5760
5783
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
@@ -5783,6 +5806,15 @@ function MastraNetworkRuntimeProvider({
|
|
|
5783
5806
|
}
|
|
5784
5807
|
],
|
|
5785
5808
|
runId: agentId,
|
|
5809
|
+
frequencyPenalty,
|
|
5810
|
+
presencePenalty,
|
|
5811
|
+
maxRetries,
|
|
5812
|
+
maxSteps,
|
|
5813
|
+
maxTokens,
|
|
5814
|
+
temperature,
|
|
5815
|
+
topK,
|
|
5816
|
+
topP,
|
|
5817
|
+
instructions,
|
|
5786
5818
|
...memory ? { threadId, resourceId: agentId } : {}
|
|
5787
5819
|
});
|
|
5788
5820
|
if (!response.body) {
|
|
@@ -6137,8 +6169,34 @@ const ToolFallback = (props) => {
|
|
|
6137
6169
|
}) });
|
|
6138
6170
|
};
|
|
6139
6171
|
|
|
6172
|
+
const defaultModelSettings = {
|
|
6173
|
+
maxRetries: 2,
|
|
6174
|
+
maxSteps: 5,
|
|
6175
|
+
temperature: 0.5,
|
|
6176
|
+
topP: 1
|
|
6177
|
+
};
|
|
6178
|
+
const NetworkContext = React.createContext({});
|
|
6179
|
+
function NetworkProvider({ children }) {
|
|
6180
|
+
const [modelSettings, setModelSettings] = React.useState(defaultModelSettings);
|
|
6181
|
+
const resetModelSettings = () => {
|
|
6182
|
+
setModelSettings(defaultModelSettings);
|
|
6183
|
+
};
|
|
6184
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6185
|
+
NetworkContext.Provider,
|
|
6186
|
+
{
|
|
6187
|
+
value: {
|
|
6188
|
+
modelSettings,
|
|
6189
|
+
setModelSettings,
|
|
6190
|
+
resetModelSettings
|
|
6191
|
+
},
|
|
6192
|
+
children
|
|
6193
|
+
}
|
|
6194
|
+
);
|
|
6195
|
+
}
|
|
6196
|
+
|
|
6140
6197
|
const NetworkChat = ({ agentId, memory }) => {
|
|
6141
|
-
|
|
6198
|
+
const { modelSettings } = React.useContext(NetworkContext);
|
|
6199
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MastraNetworkRuntimeProvider, { agentId, memory, modelSettings, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { ToolFallback }) }) });
|
|
6142
6200
|
};
|
|
6143
6201
|
|
|
6144
6202
|
function WorkflowTraces({ workflowName, baseUrl }) {
|
|
@@ -8679,7 +8737,7 @@ function VNextWorkflowTrigger({
|
|
|
8679
8737
|
] }) }, stepId) });
|
|
8680
8738
|
}) })
|
|
8681
8739
|
] }),
|
|
8682
|
-
isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8740
|
+
!isWatchingVNextWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8683
8741
|
const stepDefinition = vNextWorkflow.steps[step.stepId];
|
|
8684
8742
|
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.resumeSchema))) : z.z.record(z.z.string(), z.z.any());
|
|
8685
8743
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4", children: [
|
|
@@ -8926,6 +8984,8 @@ exports.LogsIcon = LogsIcon;
|
|
|
8926
8984
|
exports.MastraResizablePanel = MastraResizablePanel;
|
|
8927
8985
|
exports.MemoryIcon = MemoryIcon;
|
|
8928
8986
|
exports.NetworkChat = NetworkChat;
|
|
8987
|
+
exports.NetworkContext = NetworkContext;
|
|
8988
|
+
exports.NetworkProvider = NetworkProvider;
|
|
8929
8989
|
exports.OpenAIIcon = OpenAIIcon;
|
|
8930
8990
|
exports.PromptIcon = PromptIcon;
|
|
8931
8991
|
exports.RepoIcon = RepoIcon;
|