@mastra/playground-ui 6.1.4-alpha.2 → 6.2.0-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/CHANGELOG.md +22 -0
- package/dist/index.cjs.js +340 -783
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +340 -783
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/agents/components/agent-metadata/agent-metadata.d.ts +9 -1
- package/dist/src/domains/networks/components/network-table/network-table.d.ts +3 -4
- package/dist/src/domains/networks/components/network-table/types.d.ts +0 -1
- package/dist/src/domains/networks/index.d.ts +0 -1
- package/dist/src/domains/scores/components/scorers-table/columns.d.ts +3 -0
- package/dist/src/domains/scores/components/scorers-table/scorers-table.d.ts +9 -0
- package/dist/src/domains/scores/components/scorers-table/types.d.ts +5 -0
- package/dist/src/domains/scores/index.d.ts +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/store/playground-store.d.ts +5 -3
- package/package.json +6 -6
- package/dist/src/components/ui/data-table.d.ts +0 -39
- package/dist/src/domains/networks/network-chat.d.ts +0 -2
- package/dist/src/domains/scores/components/scorer-list.d.ts +0 -7
- package/dist/src/services/network-runtime-provider.d.ts +0 -7
package/dist/index.cjs.js
CHANGED
|
@@ -16,7 +16,7 @@ const remarkGfm = require('remark-gfm');
|
|
|
16
16
|
const reactSyntaxHighlighter = require('@assistant-ui/react-syntax-highlighter');
|
|
17
17
|
const prism = require('react-syntax-highlighter/dist/cjs/styles/prism');
|
|
18
18
|
const langJson = require('@codemirror/lang-json');
|
|
19
|
-
const highlight
|
|
19
|
+
const highlight = require('@lezer/highlight');
|
|
20
20
|
const codemirrorThemeDracula = require('@uiw/codemirror-theme-dracula');
|
|
21
21
|
const CodeMirror = require('@uiw/react-codemirror');
|
|
22
22
|
const sonner = require('sonner');
|
|
@@ -60,10 +60,9 @@ const react$3 = require('motion/react');
|
|
|
60
60
|
const TabsPrimitive = require('@radix-ui/react-tabs');
|
|
61
61
|
const VisuallyHidden = require('@radix-ui/react-visually-hidden');
|
|
62
62
|
const HoverCard = require('@radix-ui/react-hover-card');
|
|
63
|
-
const
|
|
63
|
+
const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
64
64
|
const runtimeContext = require('@mastra/core/runtime-context');
|
|
65
65
|
const format = require('date-fns/format');
|
|
66
|
-
const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
67
66
|
|
|
68
67
|
function _interopNamespaceDefault(e) {
|
|
69
68
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -4317,7 +4316,7 @@ const useCodemirrorTheme$2 = () => {
|
|
|
4317
4316
|
background: "transparent",
|
|
4318
4317
|
gutterForeground: "#939393"
|
|
4319
4318
|
},
|
|
4320
|
-
styles: [{ tag: [highlight
|
|
4319
|
+
styles: [{ tag: [highlight.tags.className, highlight.tags.propertyName] }]
|
|
4321
4320
|
}),
|
|
4322
4321
|
[]
|
|
4323
4322
|
);
|
|
@@ -4330,19 +4329,6 @@ const SyntaxHighlighter$2 = ({ data, className }) => {
|
|
|
4330
4329
|
/* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: formattedCode, theme, extensions: [langJson.jsonLanguage] })
|
|
4331
4330
|
] });
|
|
4332
4331
|
};
|
|
4333
|
-
async function highlight(code, language) {
|
|
4334
|
-
const { codeToTokens, bundledLanguages } = await import('shiki');
|
|
4335
|
-
if (!(language in bundledLanguages)) return null;
|
|
4336
|
-
const { tokens } = await codeToTokens(code, {
|
|
4337
|
-
lang: language,
|
|
4338
|
-
defaultColor: false,
|
|
4339
|
-
themes: {
|
|
4340
|
-
light: "github-light",
|
|
4341
|
-
dark: "github-dark"
|
|
4342
|
-
}
|
|
4343
|
-
});
|
|
4344
|
-
return tokens;
|
|
4345
|
-
}
|
|
4346
4332
|
|
|
4347
4333
|
const variantClasses$2 = {
|
|
4348
4334
|
default: "text-icon3",
|
|
@@ -5818,7 +5804,7 @@ const useCodemirrorTheme$1 = () => {
|
|
|
5818
5804
|
gutterForeground: colors.Colors.surface3,
|
|
5819
5805
|
background: "transparent"
|
|
5820
5806
|
},
|
|
5821
|
-
styles: [{ tag: [highlight
|
|
5807
|
+
styles: [{ tag: [highlight.tags.className, highlight.tags.propertyName] }]
|
|
5822
5808
|
}),
|
|
5823
5809
|
[]
|
|
5824
5810
|
);
|
|
@@ -8522,7 +8508,7 @@ const useLinkComponent = () => {
|
|
|
8522
8508
|
return ctx;
|
|
8523
8509
|
};
|
|
8524
8510
|
|
|
8525
|
-
const columns$
|
|
8511
|
+
const columns$3 = [
|
|
8526
8512
|
{
|
|
8527
8513
|
id: "name",
|
|
8528
8514
|
header: "Name",
|
|
@@ -8584,7 +8570,7 @@ function WorkflowTable({ workflows, legacyWorkflows, isLoading, computeLink }) {
|
|
|
8584
8570
|
}, [workflows, legacyWorkflows]);
|
|
8585
8571
|
const table = reactTable.useReactTable({
|
|
8586
8572
|
data: workflowData,
|
|
8587
|
-
columns: columns$
|
|
8573
|
+
columns: columns$3,
|
|
8588
8574
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
8589
8575
|
});
|
|
8590
8576
|
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(WorkflowTableSkeleton, {});
|
|
@@ -8708,7 +8694,7 @@ const AgentBadge = ({ agentId, messages = [], networkMetadata }) => {
|
|
|
8708
8694
|
}
|
|
8709
8695
|
const result = typeof message.toolOutput === "string" ? JSON.parse(message.toolOutput) : message.toolOutput;
|
|
8710
8696
|
return /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8711
|
-
ToolFallback
|
|
8697
|
+
ToolFallback,
|
|
8712
8698
|
{
|
|
8713
8699
|
toolName: message.toolName,
|
|
8714
8700
|
argsText: typeof message.args === "string" ? message.args : JSON.stringify(message.args),
|
|
@@ -8726,7 +8712,7 @@ const AgentBadge = ({ agentId, messages = [], networkMetadata }) => {
|
|
|
8726
8712
|
);
|
|
8727
8713
|
};
|
|
8728
8714
|
|
|
8729
|
-
const ToolFallback
|
|
8715
|
+
const ToolFallback = ({ toolName, result, args, ...props }) => {
|
|
8730
8716
|
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowRunProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackInner, { toolName, result, args, ...props }) });
|
|
8731
8717
|
};
|
|
8732
8718
|
const ToolFallbackInner = ({ toolName, result, args }) => {
|
|
@@ -8791,7 +8777,7 @@ const AssistantMessage = ({ ToolFallback: ToolFallbackCustom }) => {
|
|
|
8791
8777
|
{
|
|
8792
8778
|
components: {
|
|
8793
8779
|
Text: MarkdownText,
|
|
8794
|
-
tools: { Fallback: ToolFallbackCustom || ToolFallback
|
|
8780
|
+
tools: { Fallback: ToolFallbackCustom || ToolFallback },
|
|
8795
8781
|
Reasoning
|
|
8796
8782
|
}
|
|
8797
8783
|
}
|
|
@@ -10297,7 +10283,7 @@ const createRootToolAssistantMessage = ({
|
|
|
10297
10283
|
});
|
|
10298
10284
|
};
|
|
10299
10285
|
|
|
10300
|
-
const convertMessage$
|
|
10286
|
+
const convertMessage$1 = (message) => {
|
|
10301
10287
|
return message;
|
|
10302
10288
|
};
|
|
10303
10289
|
const handleFinishReason = (finishReason) => {
|
|
@@ -11011,7 +10997,7 @@ function MastraRuntimeProvider({
|
|
|
11011
10997
|
const runtime = react$2.useExternalStoreRuntime({
|
|
11012
10998
|
isRunning,
|
|
11013
10999
|
messages,
|
|
11014
|
-
convertMessage: convertMessage$
|
|
11000
|
+
convertMessage: convertMessage$1,
|
|
11015
11001
|
onNew,
|
|
11016
11002
|
onCancel,
|
|
11017
11003
|
adapters: isReady ? adapters : void 0
|
|
@@ -12241,7 +12227,7 @@ const providerMapToIcon = {
|
|
|
12241
12227
|
MISTRAL: /* @__PURE__ */ jsxRuntime.jsx(MistralIcon, {})
|
|
12242
12228
|
};
|
|
12243
12229
|
|
|
12244
|
-
const NameCell = ({ row }) => {
|
|
12230
|
+
const NameCell$1 = ({ row }) => {
|
|
12245
12231
|
const { Link } = useLinkComponent();
|
|
12246
12232
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12247
12233
|
EntryCell,
|
|
@@ -12252,11 +12238,11 @@ const NameCell = ({ row }) => {
|
|
|
12252
12238
|
}
|
|
12253
12239
|
);
|
|
12254
12240
|
};
|
|
12255
|
-
const columns$
|
|
12241
|
+
const columns$2 = [
|
|
12256
12242
|
{
|
|
12257
12243
|
header: "Name",
|
|
12258
12244
|
accessorKey: "name",
|
|
12259
|
-
cell: NameCell
|
|
12245
|
+
cell: NameCell$1
|
|
12260
12246
|
},
|
|
12261
12247
|
{
|
|
12262
12248
|
header: "Model",
|
|
@@ -12311,7 +12297,7 @@ function AgentsTable({ agents, isLoading, computeLink }) {
|
|
|
12311
12297
|
);
|
|
12312
12298
|
const table = reactTable.useReactTable({
|
|
12313
12299
|
data: projectData,
|
|
12314
|
-
columns: columns$
|
|
12300
|
+
columns: columns$2,
|
|
12315
12301
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
12316
12302
|
});
|
|
12317
12303
|
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(AgentsTableSkeleton, {});
|
|
@@ -12466,176 +12452,6 @@ const AgentMetadataWrapper = ({ children }) => {
|
|
|
12466
12452
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 overflow-y-auto h-full px-5", children });
|
|
12467
12453
|
};
|
|
12468
12454
|
|
|
12469
|
-
const useScoresByEntityId = (entityId, entityType, page = 0) => {
|
|
12470
|
-
const client = useMastraClient();
|
|
12471
|
-
const [scores, setScores] = React.useState(null);
|
|
12472
|
-
const [isLoading, setIsLoading] = React.useState(true);
|
|
12473
|
-
React.useEffect(() => {
|
|
12474
|
-
const fetchScores = async () => {
|
|
12475
|
-
setIsLoading(true);
|
|
12476
|
-
try {
|
|
12477
|
-
const res = await client.getScoresByEntityId({
|
|
12478
|
-
entityId,
|
|
12479
|
-
entityType,
|
|
12480
|
-
page: page || 0,
|
|
12481
|
-
perPage: 10
|
|
12482
|
-
});
|
|
12483
|
-
setScores(res);
|
|
12484
|
-
setIsLoading(false);
|
|
12485
|
-
} catch (error) {
|
|
12486
|
-
setScores(null);
|
|
12487
|
-
setIsLoading(false);
|
|
12488
|
-
}
|
|
12489
|
-
};
|
|
12490
|
-
fetchScores();
|
|
12491
|
-
}, [entityId, entityType, page]);
|
|
12492
|
-
return { scores, isLoading };
|
|
12493
|
-
};
|
|
12494
|
-
const useScoresByScorerId = ({ scorerId, page = 0, entityId, entityType }) => {
|
|
12495
|
-
const client = useMastraClient();
|
|
12496
|
-
const [scores, setScores] = React.useState(null);
|
|
12497
|
-
const [isLoading, setIsLoading] = React.useState(true);
|
|
12498
|
-
React.useEffect(() => {
|
|
12499
|
-
const fetchScores = async () => {
|
|
12500
|
-
setIsLoading(true);
|
|
12501
|
-
try {
|
|
12502
|
-
const res = await client.getScoresByScorerId({
|
|
12503
|
-
scorerId,
|
|
12504
|
-
page: page || 0,
|
|
12505
|
-
entityId: entityId || void 0,
|
|
12506
|
-
entityType: entityType || void 0,
|
|
12507
|
-
perPage: 10
|
|
12508
|
-
});
|
|
12509
|
-
setScores(res);
|
|
12510
|
-
setIsLoading(false);
|
|
12511
|
-
} catch (error) {
|
|
12512
|
-
setScores(null);
|
|
12513
|
-
setIsLoading(false);
|
|
12514
|
-
}
|
|
12515
|
-
};
|
|
12516
|
-
fetchScores();
|
|
12517
|
-
}, [scorerId, page, entityId, entityType]);
|
|
12518
|
-
return { scores, isLoading };
|
|
12519
|
-
};
|
|
12520
|
-
const useScorer = (scorerId) => {
|
|
12521
|
-
const client = useMastraClient();
|
|
12522
|
-
const [scorer, setScorer] = React.useState(null);
|
|
12523
|
-
const [isLoading, setIsLoading] = React.useState(true);
|
|
12524
|
-
React.useEffect(() => {
|
|
12525
|
-
const fetchScorer = async () => {
|
|
12526
|
-
setIsLoading(true);
|
|
12527
|
-
try {
|
|
12528
|
-
const res = await client.getScorer(scorerId);
|
|
12529
|
-
setScorer(res);
|
|
12530
|
-
} catch (error) {
|
|
12531
|
-
setScorer(null);
|
|
12532
|
-
console.error("Error fetching scorer", error);
|
|
12533
|
-
sonner.toast.error("Error fetching scorer");
|
|
12534
|
-
} finally {
|
|
12535
|
-
setIsLoading(false);
|
|
12536
|
-
}
|
|
12537
|
-
};
|
|
12538
|
-
fetchScorer();
|
|
12539
|
-
}, [scorerId]);
|
|
12540
|
-
return { scorer, isLoading };
|
|
12541
|
-
};
|
|
12542
|
-
const useScorers = () => {
|
|
12543
|
-
const client = useMastraClient();
|
|
12544
|
-
const [scorers, setScorers] = React.useState({});
|
|
12545
|
-
const [isLoading, setIsLoading] = React.useState(true);
|
|
12546
|
-
React.useEffect(() => {
|
|
12547
|
-
const fetchScorers = async () => {
|
|
12548
|
-
setIsLoading(true);
|
|
12549
|
-
try {
|
|
12550
|
-
const res = await client.getScorers();
|
|
12551
|
-
setScorers(res);
|
|
12552
|
-
} catch (error) {
|
|
12553
|
-
setScorers({});
|
|
12554
|
-
console.error("Error fetching agents", error);
|
|
12555
|
-
sonner.toast.error("Error fetching agents");
|
|
12556
|
-
} finally {
|
|
12557
|
-
setIsLoading(false);
|
|
12558
|
-
}
|
|
12559
|
-
};
|
|
12560
|
-
fetchScorers();
|
|
12561
|
-
}, []);
|
|
12562
|
-
return { scorers, isLoading };
|
|
12563
|
-
};
|
|
12564
|
-
|
|
12565
|
-
const Entity = ({ children, className, onClick }) => {
|
|
12566
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12567
|
-
"div",
|
|
12568
|
-
{
|
|
12569
|
-
tabIndex: onClick ? 0 : void 0,
|
|
12570
|
-
onKeyDown: (e) => {
|
|
12571
|
-
if (!onClick) return;
|
|
12572
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
12573
|
-
e.preventDefault();
|
|
12574
|
-
onClick?.();
|
|
12575
|
-
}
|
|
12576
|
-
},
|
|
12577
|
-
className: clsx(
|
|
12578
|
-
"flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
|
|
12579
|
-
onClick && "cursor-pointer hover:bg-surface4 transition-all",
|
|
12580
|
-
className
|
|
12581
|
-
),
|
|
12582
|
-
onClick,
|
|
12583
|
-
children
|
|
12584
|
-
}
|
|
12585
|
-
);
|
|
12586
|
-
};
|
|
12587
|
-
const EntityIcon = ({ children, className }) => {
|
|
12588
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
|
|
12589
|
-
};
|
|
12590
|
-
const EntityName = ({ children, className }) => {
|
|
12591
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
|
|
12592
|
-
};
|
|
12593
|
-
const EntityDescription = ({ children, className }) => {
|
|
12594
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
|
|
12595
|
-
};
|
|
12596
|
-
const EntityContent = ({ children, className }) => {
|
|
12597
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
12598
|
-
};
|
|
12599
|
-
|
|
12600
|
-
const ScorerList = ({ entityId, entityType }) => {
|
|
12601
|
-
const { scorers, isLoading } = useScorers();
|
|
12602
|
-
if (isLoading) {
|
|
12603
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ScorerSkeleton, {});
|
|
12604
|
-
}
|
|
12605
|
-
const scorerList = Object.keys(scorers).filter((scorerKey) => {
|
|
12606
|
-
const scorer = scorers[scorerKey];
|
|
12607
|
-
if (entityType === "AGENT") {
|
|
12608
|
-
return scorer.agentIds.includes(entityId);
|
|
12609
|
-
}
|
|
12610
|
-
return scorer.workflowIds.includes(entityId);
|
|
12611
|
-
}).map((scorerKey) => ({ ...scorers[scorerKey], id: scorerKey }));
|
|
12612
|
-
if (scorerList.length === 0) {
|
|
12613
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No scorers were attached to this agent." });
|
|
12614
|
-
}
|
|
12615
|
-
return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2", children: scorerList.map((scorer) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(ScorerEntity, { scorer }) }, scorer.id)) });
|
|
12616
|
-
};
|
|
12617
|
-
const ScorerSkeleton = () => {
|
|
12618
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
12619
|
-
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-24" }),
|
|
12620
|
-
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-24" })
|
|
12621
|
-
] });
|
|
12622
|
-
};
|
|
12623
|
-
const ScorerEntity = ({ scorer }) => {
|
|
12624
|
-
const { Link } = useLinkComponent();
|
|
12625
|
-
const linkRef = React.useRef(null);
|
|
12626
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Entity, { onClick: () => linkRef.current?.click(), children: [
|
|
12627
|
-
/* @__PURE__ */ jsxRuntime.jsx(EntityIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GaugeIcon, { className: "group-hover/entity:text-accent3" }) }),
|
|
12628
|
-
/* @__PURE__ */ jsxRuntime.jsxs(EntityContent, { children: [
|
|
12629
|
-
/* @__PURE__ */ jsxRuntime.jsx(EntityName, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { ref: linkRef, href: `/scorers/${scorer.id}`, children: scorer.scorer.config.name }) }),
|
|
12630
|
-
/* @__PURE__ */ jsxRuntime.jsx(EntityDescription, { children: scorer.scorer.config.description }),
|
|
12631
|
-
scorer.sampling?.type === "ratio" && /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { children: [
|
|
12632
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-icon3", children: "Sample rate:" }),
|
|
12633
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-icon6", children: scorer.sampling.rate })
|
|
12634
|
-
] })
|
|
12635
|
-
] })
|
|
12636
|
-
] });
|
|
12637
|
-
};
|
|
12638
|
-
|
|
12639
12455
|
function SearchField(props) {
|
|
12640
12456
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12641
12457
|
InputField,
|
|
@@ -13524,7 +13340,7 @@ const useCodemirrorTheme = () => {
|
|
|
13524
13340
|
gutterForeground: "#939393",
|
|
13525
13341
|
background: "transparent"
|
|
13526
13342
|
},
|
|
13527
|
-
styles: [{ tag: [highlight
|
|
13343
|
+
styles: [{ tag: [highlight.tags.className, highlight.tags.propertyName] }]
|
|
13528
13344
|
}),
|
|
13529
13345
|
[]
|
|
13530
13346
|
);
|
|
@@ -14097,92 +13913,264 @@ function ScoresTools({ onEntityChange, onReset, selectedEntity, entityOptions, i
|
|
|
14097
13913
|
] });
|
|
14098
13914
|
}
|
|
14099
13915
|
|
|
14100
|
-
const
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
const
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
13916
|
+
const useScoresByEntityId = (entityId, entityType, page = 0) => {
|
|
13917
|
+
const client = useMastraClient();
|
|
13918
|
+
const [scores, setScores] = React.useState(null);
|
|
13919
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
13920
|
+
React.useEffect(() => {
|
|
13921
|
+
const fetchScores = async () => {
|
|
13922
|
+
setIsLoading(true);
|
|
13923
|
+
try {
|
|
13924
|
+
const res = await client.getScoresByEntityId({
|
|
13925
|
+
entityId,
|
|
13926
|
+
entityType,
|
|
13927
|
+
page: page || 0,
|
|
13928
|
+
perPage: 10
|
|
13929
|
+
});
|
|
13930
|
+
setScores(res);
|
|
13931
|
+
setIsLoading(false);
|
|
13932
|
+
} catch (error) {
|
|
13933
|
+
setScores(null);
|
|
13934
|
+
setIsLoading(false);
|
|
13935
|
+
}
|
|
13936
|
+
};
|
|
13937
|
+
fetchScores();
|
|
13938
|
+
}, [entityId, entityType, page]);
|
|
13939
|
+
return { scores, isLoading };
|
|
13940
|
+
};
|
|
13941
|
+
const useScoresByScorerId = ({ scorerId, page = 0, entityId, entityType }) => {
|
|
13942
|
+
const client = useMastraClient();
|
|
13943
|
+
const [scores, setScores] = React.useState(null);
|
|
13944
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
13945
|
+
React.useEffect(() => {
|
|
13946
|
+
const fetchScores = async () => {
|
|
13947
|
+
setIsLoading(true);
|
|
13948
|
+
try {
|
|
13949
|
+
const res = await client.getScoresByScorerId({
|
|
13950
|
+
scorerId,
|
|
13951
|
+
page: page || 0,
|
|
13952
|
+
entityId: entityId || void 0,
|
|
13953
|
+
entityType: entityType || void 0,
|
|
13954
|
+
perPage: 10
|
|
13955
|
+
});
|
|
13956
|
+
setScores(res);
|
|
13957
|
+
setIsLoading(false);
|
|
13958
|
+
} catch (error) {
|
|
13959
|
+
setScores(null);
|
|
13960
|
+
setIsLoading(false);
|
|
13961
|
+
}
|
|
13962
|
+
};
|
|
13963
|
+
fetchScores();
|
|
13964
|
+
}, [scorerId, page, entityId, entityType]);
|
|
13965
|
+
return { scores, isLoading };
|
|
13966
|
+
};
|
|
13967
|
+
const useScorer = (scorerId) => {
|
|
13968
|
+
const client = useMastraClient();
|
|
13969
|
+
const [scorer, setScorer] = React.useState(null);
|
|
13970
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
13971
|
+
React.useEffect(() => {
|
|
13972
|
+
const fetchScorer = async () => {
|
|
13973
|
+
setIsLoading(true);
|
|
13974
|
+
try {
|
|
13975
|
+
const res = await client.getScorer(scorerId);
|
|
13976
|
+
setScorer(res);
|
|
13977
|
+
} catch (error) {
|
|
13978
|
+
setScorer(null);
|
|
13979
|
+
console.error("Error fetching scorer", error);
|
|
13980
|
+
sonner.toast.error("Error fetching scorer");
|
|
13981
|
+
} finally {
|
|
13982
|
+
setIsLoading(false);
|
|
13983
|
+
}
|
|
13984
|
+
};
|
|
13985
|
+
fetchScorer();
|
|
13986
|
+
}, [scorerId]);
|
|
13987
|
+
return { scorer, isLoading };
|
|
13988
|
+
};
|
|
13989
|
+
const useScorers = () => {
|
|
13990
|
+
const client = useMastraClient();
|
|
13991
|
+
const [scorers, setScorers] = React.useState({});
|
|
13992
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
13993
|
+
React.useEffect(() => {
|
|
13994
|
+
const fetchScorers = async () => {
|
|
13995
|
+
setIsLoading(true);
|
|
13996
|
+
try {
|
|
13997
|
+
const res = await client.getScorers();
|
|
13998
|
+
setScorers(res);
|
|
13999
|
+
} catch (error) {
|
|
14000
|
+
setScorers({});
|
|
14001
|
+
console.error("Error fetching agents", error);
|
|
14002
|
+
sonner.toast.error("Error fetching agents");
|
|
14003
|
+
} finally {
|
|
14004
|
+
setIsLoading(false);
|
|
14005
|
+
}
|
|
14006
|
+
};
|
|
14007
|
+
fetchScorers();
|
|
14008
|
+
}, []);
|
|
14009
|
+
return { scorers, isLoading };
|
|
14010
|
+
};
|
|
14011
|
+
|
|
14012
|
+
const NameCell = ({ row }) => {
|
|
14013
|
+
const { Link } = useLinkComponent();
|
|
14014
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14015
|
+
EntryCell,
|
|
14016
|
+
{
|
|
14017
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GaugeIcon, {}),
|
|
14018
|
+
name: /* @__PURE__ */ jsxRuntime.jsx(Link, { className: "w-full space-y-0", href: row.original.id, children: row.original.name }),
|
|
14019
|
+
description: row.original.description
|
|
14020
|
+
}
|
|
14021
|
+
);
|
|
14022
|
+
};
|
|
14023
|
+
const columns$1 = [
|
|
14024
|
+
{
|
|
14025
|
+
header: "Name",
|
|
14026
|
+
accessorKey: "name",
|
|
14027
|
+
cell: NameCell
|
|
14028
|
+
}
|
|
14029
|
+
];
|
|
14030
|
+
|
|
14031
|
+
function ScorersTable({ scorers, isLoading, computeScorerLink }) {
|
|
14032
|
+
const { navigate } = useLinkComponent();
|
|
14033
|
+
const scorersData = React.useMemo(
|
|
14034
|
+
() => Object.keys(scorers).map((key) => {
|
|
14035
|
+
const scorer = scorers[key];
|
|
14036
|
+
return {
|
|
14037
|
+
id: key,
|
|
14038
|
+
name: scorer.scorer.config.name,
|
|
14039
|
+
description: scorer.scorer.config.description
|
|
14040
|
+
};
|
|
14041
|
+
}),
|
|
14042
|
+
[scorers]
|
|
14043
|
+
);
|
|
14044
|
+
const table = reactTable.useReactTable({
|
|
14045
|
+
data: scorersData,
|
|
14046
|
+
columns: columns$1,
|
|
14047
|
+
getCoreRowModel: reactTable.getCoreRowModel()
|
|
14048
|
+
});
|
|
14049
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(ScorersTableSkeleton, {});
|
|
14050
|
+
const ths = table.getHeaderGroups()[0];
|
|
14051
|
+
const rows = table.getRowModel().rows.concat();
|
|
14052
|
+
if (rows.length === 0) {
|
|
14053
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EmptyScorersTable, {});
|
|
14054
|
+
}
|
|
14055
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
|
|
14056
|
+
/* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
|
|
14057
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => navigate(computeScorerLink(row.original.id)), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
|
|
14058
|
+
] }) });
|
|
14059
|
+
}
|
|
14060
|
+
const ScorersTableSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
|
|
14061
|
+
/* @__PURE__ */ jsxRuntime.jsx(Thead, { children: /* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Name" }) }),
|
|
14062
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(Row, { children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }) }, index)) })
|
|
14063
|
+
] });
|
|
14064
|
+
const EmptyScorersTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14065
|
+
EmptyState,
|
|
14066
|
+
{
|
|
14067
|
+
iconSlot: /* @__PURE__ */ jsxRuntime.jsx(AgentCoinIcon, {}),
|
|
14068
|
+
titleSlot: "Configure Scorers",
|
|
14069
|
+
descriptionSlot: "Mastra scorers are not configured yet. You can find more information in the documentation.",
|
|
14070
|
+
actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14071
|
+
Button$1,
|
|
14072
|
+
{
|
|
14073
|
+
size: "lg",
|
|
14074
|
+
className: "w-full",
|
|
14075
|
+
variant: "light",
|
|
14076
|
+
as: "a",
|
|
14077
|
+
href: "https://mastra.ai/en/docs/scorers/overview",
|
|
14078
|
+
target: "_blank",
|
|
14079
|
+
children: [
|
|
14080
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}) }),
|
|
14081
|
+
"Docs"
|
|
14082
|
+
]
|
|
14083
|
+
}
|
|
14084
|
+
)
|
|
14085
|
+
}
|
|
14086
|
+
) });
|
|
14087
|
+
|
|
14088
|
+
const openaiModels = [
|
|
14089
|
+
"o1",
|
|
14090
|
+
"o1-2024-12-17",
|
|
14091
|
+
"o3-mini",
|
|
14092
|
+
"o3-mini-2025-01-31",
|
|
14093
|
+
"o3",
|
|
14094
|
+
"o3-2025-04-16",
|
|
14095
|
+
"o4-mini",
|
|
14096
|
+
"o4-mini-2025-04-16",
|
|
14097
|
+
"codex-mini-latest",
|
|
14098
|
+
"computer-use-preview",
|
|
14099
|
+
"gpt-4.1",
|
|
14100
|
+
"gpt-4.1-2025-04-14",
|
|
14101
|
+
"gpt-4.1-mini",
|
|
14102
|
+
"gpt-4.1-mini-2025-04-14",
|
|
14103
|
+
"gpt-4.1-nano",
|
|
14104
|
+
"gpt-4.1-nano-2025-04-14",
|
|
14105
|
+
"gpt-4o",
|
|
14106
|
+
"gpt-4o-2024-05-13",
|
|
14107
|
+
"gpt-4o-2024-08-06",
|
|
14108
|
+
"gpt-4o-2024-11-20",
|
|
14109
|
+
"gpt-4o-audio-preview",
|
|
14110
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
14111
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
14112
|
+
"gpt-4o-search-preview",
|
|
14113
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
14114
|
+
"gpt-4o-mini-search-preview",
|
|
14115
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
14116
|
+
"gpt-4o-mini",
|
|
14117
|
+
"gpt-4o-mini-2024-07-18",
|
|
14118
|
+
"gpt-4-turbo",
|
|
14119
|
+
"gpt-4-turbo-2024-04-09",
|
|
14120
|
+
"gpt-4-turbo-preview",
|
|
14121
|
+
"gpt-4-0125-preview",
|
|
14122
|
+
"gpt-4-1106-preview",
|
|
14123
|
+
"gpt-4",
|
|
14124
|
+
"gpt-4-0613",
|
|
14125
|
+
"gpt-4.5-preview",
|
|
14126
|
+
"gpt-4.5-preview-2025-02-27",
|
|
14127
|
+
"gpt-3.5-turbo-0125",
|
|
14128
|
+
"gpt-3.5-turbo",
|
|
14129
|
+
"gpt-3.5-turbo-1106",
|
|
14130
|
+
"chatgpt-4o-latest",
|
|
14131
|
+
"gpt-5",
|
|
14132
|
+
"gpt-5-2025-08-07",
|
|
14133
|
+
"gpt-5-mini",
|
|
14134
|
+
"gpt-5-mini-2025-08-07",
|
|
14135
|
+
"gpt-5-nano",
|
|
14136
|
+
"gpt-5-nano-2025-08-07",
|
|
14137
|
+
"gpt-5-chat-latest"
|
|
14138
|
+
];
|
|
14139
|
+
const anthropicModels = [
|
|
14140
|
+
"claude-opus-4-20250514",
|
|
14141
|
+
"claude-sonnet-4-20250514",
|
|
14142
|
+
"claude-3-7-sonnet-20250219",
|
|
14143
|
+
"claude-3-5-sonnet-latest",
|
|
14144
|
+
"claude-3-5-sonnet-20241022",
|
|
14145
|
+
"claude-3-5-sonnet-20240620",
|
|
14146
|
+
"claude-3-5-haiku-latest",
|
|
14147
|
+
"claude-3-5-haiku-20241022",
|
|
14148
|
+
"claude-3-opus-latest",
|
|
14149
|
+
"claude-3-opus-20240229",
|
|
14150
|
+
"claude-3-sonnet-20240229",
|
|
14151
|
+
"claude-3-haiku-20240307"
|
|
14152
|
+
];
|
|
14153
|
+
const googleModels = [
|
|
14154
|
+
"gemini-1.5-flash",
|
|
14155
|
+
"gemini-1.5-flash-latest",
|
|
14156
|
+
"gemini-1.5-flash-001",
|
|
14157
|
+
"gemini-1.5-flash-002",
|
|
14158
|
+
"gemini-1.5-flash-8b",
|
|
14159
|
+
"gemini-1.5-flash-8b-latest",
|
|
14160
|
+
"gemini-1.5-flash-8b-001",
|
|
14161
|
+
"gemini-1.5-pro",
|
|
14162
|
+
"gemini-1.5-pro-latest",
|
|
14163
|
+
"gemini-1.5-pro-001",
|
|
14164
|
+
"gemini-1.5-pro-002",
|
|
14165
|
+
"gemini-2.0-flash",
|
|
14166
|
+
"gemini-2.0-flash-001",
|
|
14167
|
+
"gemini-2.0-flash-live-001",
|
|
14168
|
+
"gemini-2.0-flash-lite",
|
|
14169
|
+
"gemini-2.0-pro-exp-02-05",
|
|
14170
|
+
"gemini-2.0-flash-thinking-exp-01-21",
|
|
14171
|
+
"gemini-2.0-flash-exp",
|
|
14172
|
+
"gemini-2.5-pro",
|
|
14173
|
+
"gemini-2.5-flash",
|
|
14186
14174
|
"gemini-2.5-flash-lite",
|
|
14187
14175
|
"gemini-2.5-pro-exp-03-25",
|
|
14188
14176
|
"gemini-2.5-flash-preview-04-17",
|
|
@@ -14365,6 +14353,7 @@ const AgentMetadata = ({
|
|
|
14365
14353
|
computeAgentLink,
|
|
14366
14354
|
computeToolLink,
|
|
14367
14355
|
computeWorkflowLink,
|
|
14356
|
+
computeScorerLink,
|
|
14368
14357
|
updateModel,
|
|
14369
14358
|
modelProviders
|
|
14370
14359
|
}) => {
|
|
@@ -14443,7 +14432,7 @@ const AgentMetadata = ({
|
|
|
14443
14432
|
children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataWorkflowList, { workflows, computeWorkflowLink })
|
|
14444
14433
|
}
|
|
14445
14434
|
),
|
|
14446
|
-
/* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "Scorers", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14435
|
+
/* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "Scorers", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataScorerList, { entityId: agent.name, entityType: "AGENT", computeScorerLink }) }),
|
|
14447
14436
|
/* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "System Prompt", children: promptSlot })
|
|
14448
14437
|
] });
|
|
14449
14438
|
};
|
|
@@ -14461,6 +14450,24 @@ const AgentMetadataWorkflowList = ({ workflows, computeWorkflowLink }) => {
|
|
|
14461
14450
|
}
|
|
14462
14451
|
return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: workflows.map((workflow) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: computeWorkflowLink(workflow.id, workflow), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, { className: "text-accent3" }), children: workflow.name }) }) }, workflow.id)) });
|
|
14463
14452
|
};
|
|
14453
|
+
const AgentMetadataScorerList = ({ entityId, entityType, computeScorerLink }) => {
|
|
14454
|
+
const { Link } = useLinkComponent();
|
|
14455
|
+
const { scorers, isLoading } = useScorers();
|
|
14456
|
+
const scorerList = Object.keys(scorers).filter((scorerKey) => {
|
|
14457
|
+
const scorer = scorers[scorerKey];
|
|
14458
|
+
if (entityType === "AGENT") {
|
|
14459
|
+
return scorer.agentIds.includes(entityId);
|
|
14460
|
+
}
|
|
14461
|
+
return scorer.workflowIds.includes(entityId);
|
|
14462
|
+
}).map((scorerKey) => ({ ...scorers[scorerKey], id: scorerKey }));
|
|
14463
|
+
if (isLoading) {
|
|
14464
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LoadingBadge, {});
|
|
14465
|
+
}
|
|
14466
|
+
if (scorerList.length === 0) {
|
|
14467
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No Scorers" });
|
|
14468
|
+
}
|
|
14469
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: scorerList.map((scorer) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: computeScorerLink(scorer.id), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GaugeIcon, { className: "text-icon3" }), children: scorer.scorer.config.name }) }) }, scorer.id)) });
|
|
14470
|
+
};
|
|
14464
14471
|
|
|
14465
14472
|
const AgentMetadataPrompt = ({ prompt }) => {
|
|
14466
14473
|
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-md", className: "bg-surface4 text-icon6 whitespace-pre-wrap rounded-lg px-2 py-1.5 text-sm", children: prompt });
|
|
@@ -14683,379 +14690,6 @@ const formatDay = (date) => {
|
|
|
14683
14690
|
return new Date(date).toLocaleString("en-us", options).replace(",", " at");
|
|
14684
14691
|
};
|
|
14685
14692
|
|
|
14686
|
-
const convertMessage$1 = (message) => {
|
|
14687
|
-
return message;
|
|
14688
|
-
};
|
|
14689
|
-
function MastraNetworkRuntimeProvider({
|
|
14690
|
-
children,
|
|
14691
|
-
agentId,
|
|
14692
|
-
initialMessages,
|
|
14693
|
-
memory,
|
|
14694
|
-
threadId,
|
|
14695
|
-
modelSettings
|
|
14696
|
-
}) {
|
|
14697
|
-
const [isRunning, setIsRunning] = React.useState(false);
|
|
14698
|
-
const [messages, setMessages] = React.useState(initialMessages || []);
|
|
14699
|
-
const [currentThreadId, setCurrentThreadId] = React.useState(threadId);
|
|
14700
|
-
const { frequencyPenalty, presencePenalty, maxRetries, maxSteps, maxTokens, temperature, topK, topP, instructions } = modelSettings;
|
|
14701
|
-
React.useEffect(() => {
|
|
14702
|
-
if (messages.length === 0 || currentThreadId !== threadId) {
|
|
14703
|
-
if (initialMessages && threadId && memory) {
|
|
14704
|
-
setMessages(initialMessages);
|
|
14705
|
-
setCurrentThreadId(threadId);
|
|
14706
|
-
}
|
|
14707
|
-
}
|
|
14708
|
-
}, [initialMessages, threadId, memory, messages]);
|
|
14709
|
-
const mastra = useMastraClient();
|
|
14710
|
-
const network = mastra.getNetwork(agentId);
|
|
14711
|
-
const onNew = async (message) => {
|
|
14712
|
-
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
14713
|
-
const input = message.content[0].text;
|
|
14714
|
-
setMessages((currentConversation) => [...currentConversation, { role: "user", content: input }]);
|
|
14715
|
-
setIsRunning(true);
|
|
14716
|
-
try {
|
|
14717
|
-
let updater = function() {
|
|
14718
|
-
setMessages((currentConversation) => {
|
|
14719
|
-
const message2 = {
|
|
14720
|
-
role: "assistant",
|
|
14721
|
-
content: [{ type: "text", text: content }]
|
|
14722
|
-
};
|
|
14723
|
-
if (!assistantMessageAdded) {
|
|
14724
|
-
assistantMessageAdded = true;
|
|
14725
|
-
return [...currentConversation, message2];
|
|
14726
|
-
}
|
|
14727
|
-
return [...currentConversation.slice(0, -1), message2];
|
|
14728
|
-
});
|
|
14729
|
-
};
|
|
14730
|
-
const response = await network.stream({
|
|
14731
|
-
messages: [
|
|
14732
|
-
{
|
|
14733
|
-
role: "user",
|
|
14734
|
-
content: input
|
|
14735
|
-
}
|
|
14736
|
-
],
|
|
14737
|
-
runId: agentId,
|
|
14738
|
-
frequencyPenalty,
|
|
14739
|
-
presencePenalty,
|
|
14740
|
-
maxRetries,
|
|
14741
|
-
maxSteps,
|
|
14742
|
-
maxTokens,
|
|
14743
|
-
temperature,
|
|
14744
|
-
topK,
|
|
14745
|
-
topP,
|
|
14746
|
-
instructions,
|
|
14747
|
-
...memory ? { threadId, resourceId: agentId } : {}
|
|
14748
|
-
});
|
|
14749
|
-
if (!response.body) {
|
|
14750
|
-
throw new Error("No response body");
|
|
14751
|
-
}
|
|
14752
|
-
const parts = [];
|
|
14753
|
-
let content = "";
|
|
14754
|
-
let currentTextPart = null;
|
|
14755
|
-
let assistantMessageAdded = false;
|
|
14756
|
-
await uiUtils.processDataStream({
|
|
14757
|
-
stream: response.body,
|
|
14758
|
-
onTextPart(value) {
|
|
14759
|
-
if (currentTextPart == null) {
|
|
14760
|
-
currentTextPart = {
|
|
14761
|
-
type: "text",
|
|
14762
|
-
text: value
|
|
14763
|
-
};
|
|
14764
|
-
parts.push(currentTextPart);
|
|
14765
|
-
} else {
|
|
14766
|
-
currentTextPart.text += value;
|
|
14767
|
-
}
|
|
14768
|
-
content += value;
|
|
14769
|
-
updater();
|
|
14770
|
-
},
|
|
14771
|
-
async onToolCallPart(value) {
|
|
14772
|
-
console.log("Tool call received:", value);
|
|
14773
|
-
setMessages((currentConversation) => {
|
|
14774
|
-
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
14775
|
-
if (lastMessage && lastMessage.role === "assistant") {
|
|
14776
|
-
const updatedMessage = {
|
|
14777
|
-
...lastMessage,
|
|
14778
|
-
content: Array.isArray(lastMessage.content) ? [
|
|
14779
|
-
...lastMessage.content,
|
|
14780
|
-
{
|
|
14781
|
-
type: "tool-call",
|
|
14782
|
-
toolCallId: value.toolCallId,
|
|
14783
|
-
toolName: value.toolName,
|
|
14784
|
-
args: value.args
|
|
14785
|
-
}
|
|
14786
|
-
] : [
|
|
14787
|
-
...typeof lastMessage.content === "string" ? [{ type: "text", text: lastMessage.content }] : [],
|
|
14788
|
-
{
|
|
14789
|
-
type: "tool-call",
|
|
14790
|
-
toolCallId: value.toolCallId,
|
|
14791
|
-
toolName: value.toolName,
|
|
14792
|
-
args: value.args
|
|
14793
|
-
}
|
|
14794
|
-
]
|
|
14795
|
-
};
|
|
14796
|
-
return [...currentConversation.slice(0, -1), updatedMessage];
|
|
14797
|
-
}
|
|
14798
|
-
const newMessage = {
|
|
14799
|
-
role: "assistant",
|
|
14800
|
-
content: [
|
|
14801
|
-
{ type: "text", text: content },
|
|
14802
|
-
{
|
|
14803
|
-
type: "tool-call",
|
|
14804
|
-
toolCallId: value.toolCallId,
|
|
14805
|
-
toolName: value.toolName,
|
|
14806
|
-
args: value.args
|
|
14807
|
-
}
|
|
14808
|
-
]
|
|
14809
|
-
};
|
|
14810
|
-
return [...currentConversation, newMessage];
|
|
14811
|
-
});
|
|
14812
|
-
},
|
|
14813
|
-
async onToolResultPart(value) {
|
|
14814
|
-
console.log("Tool call result received:", value);
|
|
14815
|
-
setMessages((currentConversation) => {
|
|
14816
|
-
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
14817
|
-
if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
|
|
14818
|
-
const updatedContent = lastMessage.content.map((part) => {
|
|
14819
|
-
if (typeof part === "object" && part.type === "tool-call" && part.toolCallId === value.toolCallId) {
|
|
14820
|
-
return {
|
|
14821
|
-
...part,
|
|
14822
|
-
result: value.result
|
|
14823
|
-
};
|
|
14824
|
-
}
|
|
14825
|
-
return part;
|
|
14826
|
-
});
|
|
14827
|
-
const updatedMessage = {
|
|
14828
|
-
...lastMessage,
|
|
14829
|
-
content: updatedContent
|
|
14830
|
-
};
|
|
14831
|
-
return [...currentConversation.slice(0, -1), updatedMessage];
|
|
14832
|
-
}
|
|
14833
|
-
return currentConversation;
|
|
14834
|
-
});
|
|
14835
|
-
},
|
|
14836
|
-
onErrorPart(error) {
|
|
14837
|
-
throw new Error(error);
|
|
14838
|
-
}
|
|
14839
|
-
});
|
|
14840
|
-
console.log(messages);
|
|
14841
|
-
setIsRunning(false);
|
|
14842
|
-
} catch (error) {
|
|
14843
|
-
console.error("Error occurred in MastraRuntimeProvider", error);
|
|
14844
|
-
setIsRunning(false);
|
|
14845
|
-
}
|
|
14846
|
-
};
|
|
14847
|
-
const runtime = react$2.useExternalStoreRuntime({
|
|
14848
|
-
isRunning,
|
|
14849
|
-
messages,
|
|
14850
|
-
convertMessage: convertMessage$1,
|
|
14851
|
-
onNew
|
|
14852
|
-
});
|
|
14853
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react$2.AssistantRuntimeProvider, { runtime, children: [
|
|
14854
|
-
" ",
|
|
14855
|
-
children,
|
|
14856
|
-
" "
|
|
14857
|
-
] });
|
|
14858
|
-
}
|
|
14859
|
-
|
|
14860
|
-
function MarkdownRenderer({ children }) {
|
|
14861
|
-
const processedText = children.replace(/\\n/g, "\n");
|
|
14862
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins: [remarkGfm], components: COMPONENTS, className: "space-y-3", children: processedText });
|
|
14863
|
-
}
|
|
14864
|
-
const HighlightedPre = React.memo(({ children, language, ...props }) => {
|
|
14865
|
-
const [tokens, setTokens] = React.useState([]);
|
|
14866
|
-
React.useEffect(() => {
|
|
14867
|
-
highlight(children, language).then((tokens2) => {
|
|
14868
|
-
if (tokens2) setTokens(tokens2);
|
|
14869
|
-
});
|
|
14870
|
-
}, [children, language]);
|
|
14871
|
-
if (!tokens.length) {
|
|
14872
|
-
return /* @__PURE__ */ jsxRuntime.jsx("pre", { ...props, children });
|
|
14873
|
-
}
|
|
14874
|
-
return /* @__PURE__ */ jsxRuntime.jsx("pre", { ...props, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: tokens.map((line, lineIndex) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14875
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: line.map((token, tokenIndex) => {
|
|
14876
|
-
const style = typeof token.htmlStyle === "string" ? void 0 : token.htmlStyle;
|
|
14877
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14878
|
-
"span",
|
|
14879
|
-
{
|
|
14880
|
-
className: "text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",
|
|
14881
|
-
style,
|
|
14882
|
-
children: token.content
|
|
14883
|
-
},
|
|
14884
|
-
tokenIndex
|
|
14885
|
-
);
|
|
14886
|
-
}) }, lineIndex),
|
|
14887
|
-
lineIndex !== tokens.length - 1 && "\n"
|
|
14888
|
-
] })) }) });
|
|
14889
|
-
});
|
|
14890
|
-
HighlightedPre.displayName = "HighlightedCode";
|
|
14891
|
-
const CodeBlock = ({ children, className, language, ...restProps }) => {
|
|
14892
|
-
const code = typeof children === "string" ? children : childrenTakeAllStringContents(children);
|
|
14893
|
-
const preClass = cn(
|
|
14894
|
-
"overflow-x-scroll rounded-md border bg-background/50 p-4 font-mono text-sm [scrollbar-width:none]",
|
|
14895
|
-
className
|
|
14896
|
-
);
|
|
14897
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/code relative mb-4", children: [
|
|
14898
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14899
|
-
React.Suspense,
|
|
14900
|
-
{
|
|
14901
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: preClass, ...restProps, children }),
|
|
14902
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(HighlightedPre, { language, className: preClass, children: code })
|
|
14903
|
-
}
|
|
14904
|
-
),
|
|
14905
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "invisible absolute right-2 top-2 flex space-x-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100", children: /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: code, copyMessage: "Copied code to clipboard" }) })
|
|
14906
|
-
] });
|
|
14907
|
-
};
|
|
14908
|
-
function childrenTakeAllStringContents(element) {
|
|
14909
|
-
if (typeof element === "string") {
|
|
14910
|
-
return element;
|
|
14911
|
-
}
|
|
14912
|
-
if (element?.props?.children) {
|
|
14913
|
-
let children = element.props.children;
|
|
14914
|
-
if (Array.isArray(children)) {
|
|
14915
|
-
return children.map((child) => childrenTakeAllStringContents(child)).join("");
|
|
14916
|
-
} else {
|
|
14917
|
-
return childrenTakeAllStringContents(children);
|
|
14918
|
-
}
|
|
14919
|
-
}
|
|
14920
|
-
return "";
|
|
14921
|
-
}
|
|
14922
|
-
const COMPONENTS = {
|
|
14923
|
-
h1: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold", ...props, children }),
|
|
14924
|
-
h2: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-xl", ...props, children }),
|
|
14925
|
-
h3: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-lg", ...props, children }),
|
|
14926
|
-
h4: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold text-base", ...props, children }),
|
|
14927
|
-
h5: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h5", { className: "font-medium", ...props, children }),
|
|
14928
|
-
strong: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-semibold", ...props, children }),
|
|
14929
|
-
a: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("a", { className: "underline underline-offset-2", ...props, children }),
|
|
14930
|
-
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "border-l-2 border-primary pl-4", ...props, children }),
|
|
14931
|
-
code: ({ children, className, ...rest }) => {
|
|
14932
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
14933
|
-
return match ? /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { className, language: match[1], ...rest, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
14934
|
-
"code",
|
|
14935
|
-
{
|
|
14936
|
-
className: cn(
|
|
14937
|
-
"font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-background/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5"
|
|
14938
|
-
),
|
|
14939
|
-
...rest,
|
|
14940
|
-
children
|
|
14941
|
-
}
|
|
14942
|
-
);
|
|
14943
|
-
},
|
|
14944
|
-
pre: ({ children }) => children,
|
|
14945
|
-
ol: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "list-decimal space-y-2 pl-6", ...props, children }),
|
|
14946
|
-
ul: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc space-y-2 pl-6", ...props, children }),
|
|
14947
|
-
li: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "my-1.5", ...props, children }),
|
|
14948
|
-
table: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full border-collapse overflow-y-auto rounded-md border border-foreground/20", ...props, children }),
|
|
14949
|
-
th: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
14950
|
-
"th",
|
|
14951
|
-
{
|
|
14952
|
-
className: "border border-foreground/20 px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right",
|
|
14953
|
-
...props,
|
|
14954
|
-
children
|
|
14955
|
-
}
|
|
14956
|
-
),
|
|
14957
|
-
td: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
14958
|
-
"td",
|
|
14959
|
-
{
|
|
14960
|
-
className: "border border-foreground/20 px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right",
|
|
14961
|
-
...props,
|
|
14962
|
-
children
|
|
14963
|
-
}
|
|
14964
|
-
),
|
|
14965
|
-
tr: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "m-0 border-t p-0 even:bg-muted", ...props, children }),
|
|
14966
|
-
p: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-wrap leading-relaxed", ...props, children }),
|
|
14967
|
-
hr: ({ ...props }) => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-foreground/20", ...props })
|
|
14968
|
-
};
|
|
14969
|
-
|
|
14970
|
-
const purpleClasses = {
|
|
14971
|
-
bg: "bg-[rgba(124,80,175,0.25)]",
|
|
14972
|
-
text: "text-[rgb(180,140,230)]",
|
|
14973
|
-
hover: "hover:text-[rgb(200,160,250)]"};
|
|
14974
|
-
const ToolFallback = (props) => {
|
|
14975
|
-
const { toolCallId, toolName, args, argsText, result, status } = props;
|
|
14976
|
-
const [expandedAgents, setExpandedAgents] = React.useState({});
|
|
14977
|
-
const actions = args?.actions || [];
|
|
14978
|
-
if (actions.length === 0) {
|
|
14979
|
-
return null;
|
|
14980
|
-
}
|
|
14981
|
-
const toggleAgent = (agentId) => {
|
|
14982
|
-
setExpandedAgents((prev) => ({
|
|
14983
|
-
...prev,
|
|
14984
|
-
[agentId]: !prev[agentId]
|
|
14985
|
-
}));
|
|
14986
|
-
};
|
|
14987
|
-
const extractUrls = (text) => {
|
|
14988
|
-
if (typeof text !== "string") return [];
|
|
14989
|
-
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
|
14990
|
-
return text.match(urlRegex) || [];
|
|
14991
|
-
};
|
|
14992
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 w-full rounded-lg border border-gray-700 overflow-hidden shadow-md", children: actions.map((action, index) => {
|
|
14993
|
-
const agentId = `${toolCallId || "tool"}-${action.agent}-${index}`;
|
|
14994
|
-
const isExpanded = expandedAgents[agentId] || false;
|
|
14995
|
-
const urls = result ? extractUrls(result) : [];
|
|
14996
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `border-b border-gray-700 ${index === actions.length - 1 ? "border-b-0" : ""}`, children: [
|
|
14997
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14998
|
-
"div",
|
|
14999
|
-
{
|
|
15000
|
-
className: "flex items-center justify-between px-4 py-3 bg-gray-900 hover:bg-gray-800 cursor-pointer",
|
|
15001
|
-
onClick: () => toggleAgent(agentId),
|
|
15002
|
-
children: [
|
|
15003
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
15004
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex h-6 w-6 items-center justify-center rounded-full", purpleClasses.bg), children: status?.type === "running" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LoaderCircle, { className: cn("h-4 w-4 animate-spin", purpleClasses.text) }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: cn("h-4 w-4", purpleClasses.text) }) }),
|
|
15005
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-sm text-gray-100", children: action.agent?.replaceAll("_", " ") }) })
|
|
15006
|
-
] }),
|
|
15007
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
15008
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs px-2 py-1 rounded-full", purpleClasses.bg, purpleClasses.text), children: status?.type === "running" ? "Processing..." : "Complete" }),
|
|
15009
|
-
isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: "h-4 w-4 text-gray-300" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "h-4 w-4 text-gray-300" })
|
|
15010
|
-
] })
|
|
15011
|
-
]
|
|
15012
|
-
}
|
|
15013
|
-
),
|
|
15014
|
-
isExpanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 py-3 bg-[#111]", children: [
|
|
15015
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
|
|
15016
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold text-gray-300 mb-1", children: "Query:" }),
|
|
15017
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 bg-gray-900 rounded border border-gray-700", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-200 whitespace-pre-wrap", children: action.input }) })
|
|
15018
|
-
] }),
|
|
15019
|
-
result && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
15020
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold text-gray-300 mb-1", children: "Result:" }),
|
|
15021
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 bg-gray-900 rounded border border-gray-700 max-h-60 overflow-auto", children: typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-200", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownRenderer, { children: result }) }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-200 whitespace-pre-wrap", children: JSON.stringify(result, null, 2) }) }),
|
|
15022
|
-
urls.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2", children: [
|
|
15023
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold text-gray-300 mb-1", children: "Sources:" }),
|
|
15024
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
15025
|
-
urls.slice(0, 3).map((url, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15026
|
-
"a",
|
|
15027
|
-
{
|
|
15028
|
-
href: url,
|
|
15029
|
-
target: "_blank",
|
|
15030
|
-
rel: "noopener noreferrer",
|
|
15031
|
-
className: cn(
|
|
15032
|
-
"inline-flex items-center gap-1 text-xs hover:underline",
|
|
15033
|
-
purpleClasses.text,
|
|
15034
|
-
purpleClasses.hover
|
|
15035
|
-
),
|
|
15036
|
-
children: [
|
|
15037
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
15038
|
-
"Source ",
|
|
15039
|
-
i + 1
|
|
15040
|
-
] }),
|
|
15041
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "h-3 w-3" })
|
|
15042
|
-
]
|
|
15043
|
-
},
|
|
15044
|
-
i
|
|
15045
|
-
)),
|
|
15046
|
-
urls.length > 3 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-gray-400", children: [
|
|
15047
|
-
"+",
|
|
15048
|
-
urls.length - 3,
|
|
15049
|
-
" more"
|
|
15050
|
-
] })
|
|
15051
|
-
] })
|
|
15052
|
-
] })
|
|
15053
|
-
] })
|
|
15054
|
-
] })
|
|
15055
|
-
] }, agentId);
|
|
15056
|
-
}) });
|
|
15057
|
-
};
|
|
15058
|
-
|
|
15059
14693
|
const defaultModelSettings = {
|
|
15060
14694
|
maxRetries: 2,
|
|
15061
14695
|
maxSteps: 5,
|
|
@@ -15089,11 +14723,6 @@ function NetworkProvider({ children }) {
|
|
|
15089
14723
|
);
|
|
15090
14724
|
}
|
|
15091
14725
|
|
|
15092
|
-
const NetworkChat = ({ agentId, memory }) => {
|
|
15093
|
-
const { modelSettings } = React.useContext(NetworkContext);
|
|
15094
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MastraNetworkRuntimeProvider, { agentId, memory, modelSettings, children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { ToolFallback }) });
|
|
15095
|
-
};
|
|
15096
|
-
|
|
15097
14726
|
const VNextNetworkChatContext = React.createContext(void 0);
|
|
15098
14727
|
const VNextNetworkChatProvider = ({ children }) => {
|
|
15099
14728
|
const [state, setState] = React.useState({});
|
|
@@ -15315,7 +14944,7 @@ const NextAssistantMessage = ({
|
|
|
15315
14944
|
{
|
|
15316
14945
|
components: {
|
|
15317
14946
|
Text: MarkdownText,
|
|
15318
|
-
tools: { Fallback: ToolFallbackCustom || ToolFallback
|
|
14947
|
+
tools: { Fallback: ToolFallbackCustom || ToolFallback }
|
|
15319
14948
|
}
|
|
15320
14949
|
}
|
|
15321
14950
|
) }),
|
|
@@ -16013,14 +15642,7 @@ const columns = [
|
|
|
16013
15642
|
EntryCell,
|
|
16014
15643
|
{
|
|
16015
15644
|
icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}),
|
|
16016
|
-
name: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16017
|
-
Link,
|
|
16018
|
-
{
|
|
16019
|
-
className: "w-full space-y-0",
|
|
16020
|
-
href: `/networks${row.original.isVNext ? "/v-next" : ""}/${row.original.id}/chat`,
|
|
16021
|
-
children: row.original.name
|
|
16022
|
-
}
|
|
16023
|
-
),
|
|
15645
|
+
name: /* @__PURE__ */ jsxRuntime.jsx(Link, { className: "w-full space-y-0", href: `/networks/v-next/${row.original.id}/chat`, children: row.original.name }),
|
|
16024
15646
|
description: row.original.instructions
|
|
16025
15647
|
}
|
|
16026
15648
|
);
|
|
@@ -16047,33 +15669,23 @@ const columns = [
|
|
|
16047
15669
|
{
|
|
16048
15670
|
id: "model",
|
|
16049
15671
|
header: "Routing Models",
|
|
16050
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.
|
|
16051
|
-
/* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Brain, {}), children: row.original.routingModel }),
|
|
16052
|
-
row.original.isVNext ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { className: "!text-accent1 ml-2", children: "vNext" }) : null
|
|
16053
|
-
] })
|
|
15672
|
+
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { className: "truncate", children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Brain, {}), children: row.original.routingModel }) })
|
|
16054
15673
|
}
|
|
16055
15674
|
];
|
|
16056
15675
|
|
|
16057
|
-
const NetworkTable = ({
|
|
15676
|
+
const NetworkTable = ({ networks, isLoading, computeLink }) => {
|
|
16058
15677
|
const { navigate } = useLinkComponent();
|
|
16059
15678
|
const allNetworks = React.useMemo(
|
|
16060
15679
|
() => [
|
|
16061
|
-
...legacyNetworks?.map((network) => ({
|
|
16062
|
-
...network,
|
|
16063
|
-
routingModel: network.routingModel.modelId,
|
|
16064
|
-
agentsSize: network.agents.length,
|
|
16065
|
-
isVNext: false
|
|
16066
|
-
})) ?? [],
|
|
16067
15680
|
...networks?.map((network) => ({
|
|
16068
15681
|
...network,
|
|
16069
15682
|
routingModel: network.routingModel.modelId,
|
|
16070
15683
|
agentsSize: network.agents.length,
|
|
16071
15684
|
workflowsSize: network.workflows.length,
|
|
16072
|
-
toolsSize: network.tools.length
|
|
16073
|
-
isVNext: true
|
|
15685
|
+
toolsSize: network.tools.length
|
|
16074
15686
|
})) ?? []
|
|
16075
15687
|
],
|
|
16076
|
-
[networks
|
|
15688
|
+
[networks]
|
|
16077
15689
|
);
|
|
16078
15690
|
const table = reactTable.useReactTable({
|
|
16079
15691
|
data: allNetworks,
|
|
@@ -16088,15 +15700,7 @@ const NetworkTable = ({ legacyNetworks, networks, isLoading, computeLink }) => {
|
|
|
16088
15700
|
}
|
|
16089
15701
|
return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
|
|
16090
15702
|
/* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
|
|
16091
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
16092
|
-
Row,
|
|
16093
|
-
{
|
|
16094
|
-
onClick: () => navigate(computeLink(row.original.id, row.original.isVNext || false)),
|
|
16095
|
-
className: "cursor-pointer",
|
|
16096
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
16097
|
-
},
|
|
16098
|
-
row.id
|
|
16099
|
-
)) })
|
|
15703
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => navigate(computeLink(row.original.id)), className: "cursor-pointer", children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
|
|
16100
15704
|
] }) });
|
|
16101
15705
|
};
|
|
16102
15706
|
const NetworkTableEmpty = () => {
|
|
@@ -16202,6 +15806,41 @@ const Searchbar = ({ onSearch, label, placeholder }) => {
|
|
|
16202
15806
|
);
|
|
16203
15807
|
};
|
|
16204
15808
|
|
|
15809
|
+
const Entity = ({ children, className, onClick }) => {
|
|
15810
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15811
|
+
"div",
|
|
15812
|
+
{
|
|
15813
|
+
tabIndex: onClick ? 0 : void 0,
|
|
15814
|
+
onKeyDown: (e) => {
|
|
15815
|
+
if (!onClick) return;
|
|
15816
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
15817
|
+
e.preventDefault();
|
|
15818
|
+
onClick?.();
|
|
15819
|
+
}
|
|
15820
|
+
},
|
|
15821
|
+
className: clsx(
|
|
15822
|
+
"flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
|
|
15823
|
+
onClick && "cursor-pointer hover:bg-surface4 transition-all",
|
|
15824
|
+
className
|
|
15825
|
+
),
|
|
15826
|
+
onClick,
|
|
15827
|
+
children
|
|
15828
|
+
}
|
|
15829
|
+
);
|
|
15830
|
+
};
|
|
15831
|
+
const EntityIcon = ({ children, className }) => {
|
|
15832
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
|
|
15833
|
+
};
|
|
15834
|
+
const EntityName = ({ children, className }) => {
|
|
15835
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
|
|
15836
|
+
};
|
|
15837
|
+
const EntityDescription = ({ children, className }) => {
|
|
15838
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
|
|
15839
|
+
};
|
|
15840
|
+
const EntityContent = ({ children, className }) => {
|
|
15841
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
15842
|
+
};
|
|
15843
|
+
|
|
16205
15844
|
const ToolList = ({ tools, agents, isLoading, computeLink, computeAgentLink }) => {
|
|
16206
15845
|
const toolsWithAgents = React.useMemo(() => prepareAgents(tools, agents), [tools, agents]);
|
|
16207
15846
|
if (isLoading)
|
|
@@ -18549,88 +18188,6 @@ function TracesTools({
|
|
|
18549
18188
|
] });
|
|
18550
18189
|
}
|
|
18551
18190
|
|
|
18552
|
-
const DataTable = ({
|
|
18553
|
-
columns,
|
|
18554
|
-
data,
|
|
18555
|
-
pagination,
|
|
18556
|
-
gotoNextPage,
|
|
18557
|
-
gotoPreviousPage,
|
|
18558
|
-
getRowId,
|
|
18559
|
-
selectedRowId,
|
|
18560
|
-
isLoading,
|
|
18561
|
-
emptyText,
|
|
18562
|
-
onClick
|
|
18563
|
-
}) => {
|
|
18564
|
-
const [sorting, setSorting] = React.useState([]);
|
|
18565
|
-
const [{ pageIndex, pageSize }, setPagination] = React.useState({
|
|
18566
|
-
pageIndex: pagination ? Math.floor(pagination.offset / pagination.limit) : 0,
|
|
18567
|
-
pageSize: pagination?.limit ?? 10
|
|
18568
|
-
});
|
|
18569
|
-
const [rowSelection, setRowSelection] = React.useState({});
|
|
18570
|
-
const table = reactTable.useReactTable({
|
|
18571
|
-
data,
|
|
18572
|
-
columns,
|
|
18573
|
-
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
18574
|
-
manualPagination: true,
|
|
18575
|
-
pageCount: pagination ? Math.ceil(pagination.total / pagination.limit) : -1,
|
|
18576
|
-
state: {
|
|
18577
|
-
sorting,
|
|
18578
|
-
pagination: {
|
|
18579
|
-
pageIndex,
|
|
18580
|
-
pageSize
|
|
18581
|
-
},
|
|
18582
|
-
rowSelection
|
|
18583
|
-
},
|
|
18584
|
-
getRowId,
|
|
18585
|
-
onPaginationChange: setPagination,
|
|
18586
|
-
onSortingChange: setSorting,
|
|
18587
|
-
enableRowSelection: true,
|
|
18588
|
-
enableMultiRowSelection: false,
|
|
18589
|
-
onRowSelectionChange: setRowSelection
|
|
18590
|
-
});
|
|
18591
|
-
const emptyNode = /* @__PURE__ */ jsxRuntime.jsx(Row, { children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { colSpan: columns.length, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-12 text-center w-full", children: [
|
|
18592
|
-
"No ",
|
|
18593
|
-
emptyText || "results"
|
|
18594
|
-
] }) }) });
|
|
18595
|
-
const ths = table.getHeaderGroups()[0];
|
|
18596
|
-
const rows = table.getRowModel().rows;
|
|
18597
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
18598
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
|
|
18599
|
-
/* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0 bg-surface2", children: ths.headers.map((header) => {
|
|
18600
|
-
const size = header.column.getSize();
|
|
18601
|
-
const meta = header.column.columnDef.meta;
|
|
18602
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
18603
|
-
}) }),
|
|
18604
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => {
|
|
18605
|
-
}, children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
18606
|
-
Row,
|
|
18607
|
-
{
|
|
18608
|
-
"data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected",
|
|
18609
|
-
onClick: () => onClick?.(row.original),
|
|
18610
|
-
children: row.getVisibleCells().map((cell) => reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()))
|
|
18611
|
-
},
|
|
18612
|
-
row.id
|
|
18613
|
-
)) : emptyNode })
|
|
18614
|
-
] }),
|
|
18615
|
-
pagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
|
|
18616
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground text-sm", children: [
|
|
18617
|
-
"Showing ",
|
|
18618
|
-
pagination.offset + 1,
|
|
18619
|
-
" to ",
|
|
18620
|
-
Math.min(pagination.offset + data.length, pagination.total),
|
|
18621
|
-
" of",
|
|
18622
|
-
" ",
|
|
18623
|
-
pagination.total,
|
|
18624
|
-
" results"
|
|
18625
|
-
] }),
|
|
18626
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-6 lg:space-x-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
18627
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "outline", size: "sm", onClick: gotoPreviousPage, disabled: !pagination.offset, children: "Previous" }),
|
|
18628
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "outline", size: "sm", onClick: gotoNextPage, disabled: !pagination.hasMore, children: "Next" })
|
|
18629
|
-
] }) })
|
|
18630
|
-
] })
|
|
18631
|
-
] });
|
|
18632
|
-
};
|
|
18633
|
-
|
|
18634
18191
|
function MainContentLayout({
|
|
18635
18192
|
children,
|
|
18636
18193
|
className,
|
|
@@ -19162,6 +18719,7 @@ exports.AgentMetadataListEmpty = AgentMetadataListEmpty;
|
|
|
19162
18719
|
exports.AgentMetadataListItem = AgentMetadataListItem;
|
|
19163
18720
|
exports.AgentMetadataNetworkList = AgentMetadataNetworkList;
|
|
19164
18721
|
exports.AgentMetadataPrompt = AgentMetadataPrompt;
|
|
18722
|
+
exports.AgentMetadataScorerList = AgentMetadataScorerList;
|
|
19165
18723
|
exports.AgentMetadataSection = AgentMetadataSection;
|
|
19166
18724
|
exports.AgentMetadataToolList = AgentMetadataToolList;
|
|
19167
18725
|
exports.AgentMetadataWorkflowList = AgentMetadataWorkflowList;
|
|
@@ -19190,7 +18748,6 @@ exports.CommitIcon = CommitIcon;
|
|
|
19190
18748
|
exports.CrossIcon = CrossIcon;
|
|
19191
18749
|
exports.Crumb = Crumb;
|
|
19192
18750
|
exports.DarkLogo = DarkLogo;
|
|
19193
|
-
exports.DataTable = DataTable;
|
|
19194
18751
|
exports.DateTimeCell = DateTimeCell;
|
|
19195
18752
|
exports.DateTimePicker = DateTimePicker;
|
|
19196
18753
|
exports.DateTimePickerContent = DateTimePickerContent;
|
|
@@ -19202,6 +18759,7 @@ exports.DividerIcon = DividerIcon;
|
|
|
19202
18759
|
exports.DocsIcon = DocsIcon;
|
|
19203
18760
|
exports.DynamicForm = DynamicForm;
|
|
19204
18761
|
exports.EmptyAgentsTable = EmptyAgentsTable;
|
|
18762
|
+
exports.EmptyScorersTable = EmptyScorersTable;
|
|
19205
18763
|
exports.EmptyState = EmptyState;
|
|
19206
18764
|
exports.EmptyWorkflowsTable = EmptyWorkflowsTable;
|
|
19207
18765
|
exports.Entity = Entity;
|
|
@@ -19251,7 +18809,6 @@ exports.McpCoinIcon = McpCoinIcon;
|
|
|
19251
18809
|
exports.McpServerIcon = McpServerIcon;
|
|
19252
18810
|
exports.MemoryIcon = MemoryIcon;
|
|
19253
18811
|
exports.MemorySearch = MemorySearch;
|
|
19254
|
-
exports.NetworkChat = NetworkChat;
|
|
19255
18812
|
exports.NetworkContext = NetworkContext;
|
|
19256
18813
|
exports.NetworkProvider = NetworkProvider;
|
|
19257
18814
|
exports.NetworkTable = NetworkTable;
|
|
@@ -19271,8 +18828,8 @@ exports.RuntimeContext = RuntimeContext;
|
|
|
19271
18828
|
exports.RuntimeContextWrapper = RuntimeContextWrapper;
|
|
19272
18829
|
exports.ScoreDialog = ScoreDialog;
|
|
19273
18830
|
exports.ScoreIcon = ScoreIcon;
|
|
19274
|
-
exports.
|
|
19275
|
-
exports.
|
|
18831
|
+
exports.ScorersTable = ScorersTable;
|
|
18832
|
+
exports.ScorersTableSkeleton = ScorersTableSkeleton;
|
|
19276
18833
|
exports.ScoresTools = ScoresTools;
|
|
19277
18834
|
exports.SearchField = SearchField;
|
|
19278
18835
|
exports.Searchbar = Searchbar;
|