@mastra/playground-ui 5.0.1-alpha.2 → 5.0.1-alpha.3
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/index.cjs.js +53 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +52 -17
- package/dist/index.es.js.map +1 -1
- package/dist/services/network-runtime-provider.d.ts +1 -1
- package/package.json +3 -3
|
@@ -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 {};
|
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,
|
|
@@ -5361,7 +5361,7 @@ const variantClasses = {
|
|
|
5361
5361
|
};
|
|
5362
5362
|
const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
|
|
5363
5363
|
const variantClass = variant ? variantClasses[variant] : "bg-accent3";
|
|
5364
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5364
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[166px] shrink-0", children: [
|
|
5365
5365
|
/* @__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
5366
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
|
|
5367
5367
|
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
|
|
@@ -5412,8 +5412,8 @@ const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClic
|
|
|
5412
5412
|
const progressPercent = durationMs / traceDuration * 100;
|
|
5413
5413
|
const TextEl = onClick ? "button" : "div";
|
|
5414
5414
|
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: [
|
|
5415
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("flex justify-between items-center gap-2 rounded-md pl-2", isActive && "bg-surface4"), children: [
|
|
5416
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-8 items-center gap-1 min-w-0", children: [
|
|
5417
5417
|
spans ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5418
5418
|
"button",
|
|
5419
5419
|
{
|
|
@@ -5716,15 +5716,15 @@ const TracesSidebar = ({ onResize }) => {
|
|
|
5716
5716
|
);
|
|
5717
5717
|
};
|
|
5718
5718
|
|
|
5719
|
-
function AgentTraces({ agentName, baseUrl }) {
|
|
5720
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { agentName, baseUrl }) });
|
|
5719
|
+
function AgentTraces({ agentName, baseUrl, className }) {
|
|
5720
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { agentName, baseUrl, className }) });
|
|
5721
5721
|
}
|
|
5722
|
-
function AgentTracesInner({ agentName, baseUrl }) {
|
|
5722
|
+
function AgentTracesInner({ agentName, baseUrl, className }) {
|
|
5723
5723
|
const [sidebarWidth, setSidebarWidth] = React.useState(100);
|
|
5724
5724
|
const { traces, firstCallLoading, error } = useTraces(agentName, baseUrl);
|
|
5725
5725
|
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 }) }),
|
|
5726
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("h-full relative overflow-hidden flex", className), children: [
|
|
5727
|
+
/* @__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
5728
|
open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
|
|
5729
5729
|
] });
|
|
5730
5730
|
}
|
|
@@ -5739,11 +5739,13 @@ function MastraNetworkRuntimeProvider({
|
|
|
5739
5739
|
memory,
|
|
5740
5740
|
threadId,
|
|
5741
5741
|
baseUrl,
|
|
5742
|
-
refreshThreadList
|
|
5742
|
+
refreshThreadList,
|
|
5743
|
+
modelSettings = {}
|
|
5743
5744
|
}) {
|
|
5744
5745
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
5745
5746
|
const [messages, setMessages] = React.useState(initialMessages || []);
|
|
5746
5747
|
const [currentThreadId, setCurrentThreadId] = React.useState(threadId);
|
|
5748
|
+
const { frequencyPenalty, presencePenalty, maxRetries, maxSteps, maxTokens, temperature, topK, topP, instructions } = modelSettings;
|
|
5747
5749
|
React.useEffect(() => {
|
|
5748
5750
|
if (messages.length === 0 || currentThreadId !== threadId) {
|
|
5749
5751
|
if (initialMessages && threadId && memory) {
|
|
@@ -5753,8 +5755,6 @@ function MastraNetworkRuntimeProvider({
|
|
|
5753
5755
|
}
|
|
5754
5756
|
}, [initialMessages, threadId, memory, messages]);
|
|
5755
5757
|
const mastra = createMastraClient(baseUrl);
|
|
5756
|
-
console.log("MastraClient initialized");
|
|
5757
|
-
console.log(messages, "###");
|
|
5758
5758
|
const network = mastra.getNetwork(agentId);
|
|
5759
5759
|
const onNew = async (message) => {
|
|
5760
5760
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
@@ -5783,6 +5783,15 @@ function MastraNetworkRuntimeProvider({
|
|
|
5783
5783
|
}
|
|
5784
5784
|
],
|
|
5785
5785
|
runId: agentId,
|
|
5786
|
+
frequencyPenalty,
|
|
5787
|
+
presencePenalty,
|
|
5788
|
+
maxRetries,
|
|
5789
|
+
maxSteps,
|
|
5790
|
+
maxTokens,
|
|
5791
|
+
temperature,
|
|
5792
|
+
topK,
|
|
5793
|
+
topP,
|
|
5794
|
+
instructions,
|
|
5786
5795
|
...memory ? { threadId, resourceId: agentId } : {}
|
|
5787
5796
|
});
|
|
5788
5797
|
if (!response.body) {
|
|
@@ -6137,8 +6146,34 @@ const ToolFallback = (props) => {
|
|
|
6137
6146
|
}) });
|
|
6138
6147
|
};
|
|
6139
6148
|
|
|
6149
|
+
const defaultModelSettings = {
|
|
6150
|
+
maxRetries: 2,
|
|
6151
|
+
maxSteps: 5,
|
|
6152
|
+
temperature: 0.5,
|
|
6153
|
+
topP: 1
|
|
6154
|
+
};
|
|
6155
|
+
const NetworkContext = React.createContext({});
|
|
6156
|
+
function NetworkProvider({ children }) {
|
|
6157
|
+
const [modelSettings, setModelSettings] = React.useState(defaultModelSettings);
|
|
6158
|
+
const resetModelSettings = () => {
|
|
6159
|
+
setModelSettings(defaultModelSettings);
|
|
6160
|
+
};
|
|
6161
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6162
|
+
NetworkContext.Provider,
|
|
6163
|
+
{
|
|
6164
|
+
value: {
|
|
6165
|
+
modelSettings,
|
|
6166
|
+
setModelSettings,
|
|
6167
|
+
resetModelSettings
|
|
6168
|
+
},
|
|
6169
|
+
children
|
|
6170
|
+
}
|
|
6171
|
+
);
|
|
6172
|
+
}
|
|
6173
|
+
|
|
6140
6174
|
const NetworkChat = ({ agentId, memory }) => {
|
|
6141
|
-
|
|
6175
|
+
const { modelSettings } = React.useContext(NetworkContext);
|
|
6176
|
+
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
6177
|
};
|
|
6143
6178
|
|
|
6144
6179
|
function WorkflowTraces({ workflowName, baseUrl }) {
|
|
@@ -8679,7 +8714,7 @@ function VNextWorkflowTrigger({
|
|
|
8679
8714
|
] }) }, stepId) });
|
|
8680
8715
|
}) })
|
|
8681
8716
|
] }),
|
|
8682
|
-
isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8717
|
+
!isWatchingVNextWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8683
8718
|
const stepDefinition = vNextWorkflow.steps[step.stepId];
|
|
8684
8719
|
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.resumeSchema))) : z.z.record(z.z.string(), z.z.any());
|
|
8685
8720
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4", children: [
|
|
@@ -8926,6 +8961,8 @@ exports.LogsIcon = LogsIcon;
|
|
|
8926
8961
|
exports.MastraResizablePanel = MastraResizablePanel;
|
|
8927
8962
|
exports.MemoryIcon = MemoryIcon;
|
|
8928
8963
|
exports.NetworkChat = NetworkChat;
|
|
8964
|
+
exports.NetworkContext = NetworkContext;
|
|
8965
|
+
exports.NetworkProvider = NetworkProvider;
|
|
8929
8966
|
exports.OpenAIIcon = OpenAIIcon;
|
|
8930
8967
|
exports.PromptIcon = PromptIcon;
|
|
8931
8968
|
exports.RepoIcon = RepoIcon;
|