@mastra/playground-ui 6.2.4 → 6.3.0-alpha.0
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 +51 -0
- package/dist/index.cjs.js +312 -1364
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +313 -1362
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/agents/components/agent-metadata/agent-metadata-model-switcher.d.ts +1 -1
- package/dist/src/domains/workflows/runs/workflow-runs.d.ts +4 -2
- package/dist/src/domains/workflows/workflow/workflow-input-data.d.ts +2 -1
- package/dist/src/domains/workflows/workflow/workflow-trigger.d.ts +8 -7
- package/dist/src/ds/components/Alert/Alert.d.ts +17 -0
- package/dist/src/ds/components/Alert/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/types.d.ts +1 -2
- package/package.json +7 -7
- package/dist/src/components/assistant-ui/network-threads.d.ts +0 -10
- package/dist/src/domains/networks/components/network-table/columns.d.ts +0 -3
- package/dist/src/domains/networks/components/network-table/network-table.d.ts +0 -8
- package/dist/src/domains/networks/components/network-table/types.d.ts +0 -9
- package/dist/src/domains/networks/index.d.ts +0 -3
- package/dist/src/domains/networks/network-context.d.ts +0 -16
- package/dist/src/domains/networks/tool-fallback.d.ts +0 -2
- package/dist/src/domains/networks/v-next/network-chat.d.ts +0 -9
- package/dist/src/domains/networks/v-next/step-dropdown.d.ts +0 -1
- package/dist/src/domains/networks/v-next/tool-fallback.d.ts +0 -0
- package/dist/src/domains/networks/v-next/wrapped-assistant-message.d.ts +0 -5
- package/dist/src/services/vnext-network-chat-provider.d.ts +0 -17
- package/dist/src/services/vnext-network-runtime-provider.d.ts +0 -9
package/dist/index.cjs.js
CHANGED
|
@@ -63,7 +63,6 @@ const HoverCard = require('@radix-ui/react-hover-card');
|
|
|
63
63
|
const dnd = require('@hello-pangea/dnd');
|
|
64
64
|
const SwitchPrimitives = require('@radix-ui/react-switch');
|
|
65
65
|
const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
66
|
-
const runtimeContext = require('@mastra/core/runtime-context');
|
|
67
66
|
const format = require('date-fns/format');
|
|
68
67
|
const DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
69
68
|
|
|
@@ -4349,7 +4348,7 @@ const SyntaxHighlighter$2 = ({
|
|
|
4349
4348
|
] });
|
|
4350
4349
|
};
|
|
4351
4350
|
|
|
4352
|
-
const variantClasses$
|
|
4351
|
+
const variantClasses$3 = {
|
|
4353
4352
|
default: "text-icon3",
|
|
4354
4353
|
success: "text-accent1",
|
|
4355
4354
|
error: "text-accent2",
|
|
@@ -4362,12 +4361,12 @@ const Badge$1 = ({ icon, variant = "default", className, children, ...props }) =
|
|
|
4362
4361
|
className: clsx(
|
|
4363
4362
|
"bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
|
|
4364
4363
|
icon ? "pl-md pr-1.5" : "px-1.5",
|
|
4365
|
-
icon || variant === "default" ? "text-icon5" : variantClasses$
|
|
4364
|
+
icon || variant === "default" ? "text-icon5" : variantClasses$3[variant],
|
|
4366
4365
|
className
|
|
4367
4366
|
),
|
|
4368
4367
|
...props,
|
|
4369
4368
|
children: [
|
|
4370
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses$
|
|
4369
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses$3[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
|
|
4371
4370
|
children
|
|
4372
4371
|
]
|
|
4373
4372
|
}
|
|
@@ -4612,7 +4611,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4612
4611
|
workflowState: {
|
|
4613
4612
|
...prev?.payload?.workflowState,
|
|
4614
4613
|
status: "running",
|
|
4615
|
-
steps: {}
|
|
4614
|
+
steps: prev?.runId === chunk.runId ? prev?.payload?.workflowState?.steps ?? {} : {}
|
|
4616
4615
|
}
|
|
4617
4616
|
}
|
|
4618
4617
|
};
|
|
@@ -4621,6 +4620,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4621
4620
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4622
4621
|
return {
|
|
4623
4622
|
...prev,
|
|
4623
|
+
runId: chunk.runId,
|
|
4624
4624
|
payload: {
|
|
4625
4625
|
...prev.payload,
|
|
4626
4626
|
currentStep: {
|
|
@@ -4645,6 +4645,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4645
4645
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4646
4646
|
return {
|
|
4647
4647
|
...prev,
|
|
4648
|
+
runId: chunk.runId,
|
|
4648
4649
|
payload: {
|
|
4649
4650
|
...prev?.payload,
|
|
4650
4651
|
currentStep: {
|
|
@@ -4671,6 +4672,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4671
4672
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4672
4673
|
return {
|
|
4673
4674
|
...prev,
|
|
4675
|
+
runId: chunk.runId,
|
|
4674
4676
|
payload: {
|
|
4675
4677
|
...prev?.payload,
|
|
4676
4678
|
currentStep: {
|
|
@@ -4698,6 +4700,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4698
4700
|
const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
|
|
4699
4701
|
const next = {
|
|
4700
4702
|
...prev,
|
|
4703
|
+
runId: chunk.runId,
|
|
4701
4704
|
payload: {
|
|
4702
4705
|
...prev?.payload,
|
|
4703
4706
|
currentStep: {
|
|
@@ -4724,6 +4727,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4724
4727
|
if (chunk.type === "workflow-canceled") {
|
|
4725
4728
|
return {
|
|
4726
4729
|
...prev,
|
|
4730
|
+
runId: chunk.runId,
|
|
4727
4731
|
payload: {
|
|
4728
4732
|
...prev?.payload,
|
|
4729
4733
|
workflowState: {
|
|
@@ -4737,6 +4741,7 @@ const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
|
|
|
4737
4741
|
if (chunk.type === "workflow-finish") {
|
|
4738
4742
|
return {
|
|
4739
4743
|
...prev,
|
|
4744
|
+
runId: chunk.runId,
|
|
4740
4745
|
payload: {
|
|
4741
4746
|
...prev?.payload,
|
|
4742
4747
|
currentStep: void 0,
|
|
@@ -4759,7 +4764,7 @@ function WorkflowRunProvider({
|
|
|
4759
4764
|
const [result, setResult] = React.useState(
|
|
4760
4765
|
() => snapshot ? convertWorkflowRunStateToWatchResult(snapshot) : null
|
|
4761
4766
|
);
|
|
4762
|
-
const [payload, setPayload] = React.useState(null);
|
|
4767
|
+
const [payload, setPayload] = React.useState(() => snapshot?.context?.input ?? null);
|
|
4763
4768
|
const clearData = () => {
|
|
4764
4769
|
setResult(null);
|
|
4765
4770
|
setPayload(null);
|
|
@@ -4767,6 +4772,7 @@ function WorkflowRunProvider({
|
|
|
4767
4772
|
React.useEffect(() => {
|
|
4768
4773
|
if (snapshot?.runId) {
|
|
4769
4774
|
setResult(convertWorkflowRunStateToWatchResult(snapshot));
|
|
4775
|
+
setPayload(snapshot.context?.input);
|
|
4770
4776
|
}
|
|
4771
4777
|
}, [snapshot]);
|
|
4772
4778
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5291,7 +5297,7 @@ const sizeClasses = {
|
|
|
5291
5297
|
md: "h-button-md gap-md",
|
|
5292
5298
|
lg: "h-button-lg gap-lg"
|
|
5293
5299
|
};
|
|
5294
|
-
const variantClasses$
|
|
5300
|
+
const variantClasses$2 = {
|
|
5295
5301
|
default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6",
|
|
5296
5302
|
light: "bg-surface3 hover:bg-surface5 text-icon6"
|
|
5297
5303
|
};
|
|
@@ -5302,7 +5308,7 @@ const Button$1 = ({ className, as, size = "md", variant = "default", ...props })
|
|
|
5302
5308
|
{
|
|
5303
5309
|
className: clsx(
|
|
5304
5310
|
"bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
|
|
5305
|
-
variantClasses$
|
|
5311
|
+
variantClasses$2[variant],
|
|
5306
5312
|
sizeClasses[size],
|
|
5307
5313
|
className,
|
|
5308
5314
|
{
|
|
@@ -5322,7 +5328,7 @@ const useCodemirrorTheme$1 = () => {
|
|
|
5322
5328
|
fontSize: "0.8rem",
|
|
5323
5329
|
lineHighlight: "transparent",
|
|
5324
5330
|
gutterBackground: "transparent",
|
|
5325
|
-
gutterForeground: colors.
|
|
5331
|
+
gutterForeground: colors.IconColors.icon3,
|
|
5326
5332
|
background: "transparent"
|
|
5327
5333
|
},
|
|
5328
5334
|
styles: [{ tag: [highlight.tags.className, highlight.tags.propertyName] }]
|
|
@@ -6261,20 +6267,20 @@ const alertVariants = cva(
|
|
|
6261
6267
|
}
|
|
6262
6268
|
}
|
|
6263
6269
|
);
|
|
6264
|
-
const Alert = React__namespace.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
6265
|
-
Alert.displayName = "Alert";
|
|
6266
|
-
const AlertTitle = React__namespace.forwardRef(
|
|
6270
|
+
const Alert$1 = React__namespace.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
6271
|
+
Alert$1.displayName = "Alert";
|
|
6272
|
+
const AlertTitle$1 = React__namespace.forwardRef(
|
|
6267
6273
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h5", { ref, className: cn("mb-1 font-medium leading-none tracking-tight", className), ...props })
|
|
6268
6274
|
);
|
|
6269
|
-
AlertTitle.displayName = "AlertTitle";
|
|
6270
|
-
const AlertDescription = React__namespace.forwardRef(
|
|
6275
|
+
AlertTitle$1.displayName = "AlertTitle";
|
|
6276
|
+
const AlertDescription$1 = React__namespace.forwardRef(
|
|
6271
6277
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("text-sm [&_p]:leading-relaxed", className), ...props })
|
|
6272
6278
|
);
|
|
6273
|
-
AlertDescription.displayName = "AlertDescription";
|
|
6279
|
+
AlertDescription$1.displayName = "AlertDescription";
|
|
6274
6280
|
|
|
6275
|
-
const ErrorMessage = ({ error }) => /* @__PURE__ */ jsxRuntime.jsxs(Alert, { variant: "destructive", children: [
|
|
6281
|
+
const ErrorMessage = ({ error }) => /* @__PURE__ */ jsxRuntime.jsxs(Alert$1, { variant: "destructive", children: [
|
|
6276
6282
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4" }),
|
|
6277
|
-
/* @__PURE__ */ jsxRuntime.jsx(AlertTitle, { children: error })
|
|
6283
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertTitle$1, { children: error })
|
|
6278
6284
|
] });
|
|
6279
6285
|
|
|
6280
6286
|
const SubmitButton = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button$2, { type: "submit", children });
|
|
@@ -6462,7 +6468,8 @@ const PopoverContent = React__namespace.forwardRef(({ className, align = "center
|
|
|
6462
6468
|
align,
|
|
6463
6469
|
sideOffset,
|
|
6464
6470
|
className: clsx(
|
|
6465
|
-
"z-50 w-72 rounded-md border bg-popover
|
|
6471
|
+
"z-50 w-72 rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
6472
|
+
className?.includes(` p-`) ? false : `p-4`,
|
|
6466
6473
|
className
|
|
6467
6474
|
),
|
|
6468
6475
|
...props
|
|
@@ -7091,6 +7098,7 @@ RadioGroupItem.displayName = RadioGroupPrimitive__namespace.Item.displayName;
|
|
|
7091
7098
|
const WorkflowInputData = ({
|
|
7092
7099
|
schema,
|
|
7093
7100
|
defaultValues,
|
|
7101
|
+
withoutSubmit,
|
|
7094
7102
|
isSubmitLoading,
|
|
7095
7103
|
submitButtonLabel,
|
|
7096
7104
|
onSubmit
|
|
@@ -7129,7 +7137,7 @@ const WorkflowInputData = ({
|
|
|
7129
7137
|
defaultValues,
|
|
7130
7138
|
isSubmitLoading,
|
|
7131
7139
|
submitButtonLabel,
|
|
7132
|
-
onSubmit
|
|
7140
|
+
onSubmit: withoutSubmit ? void 0 : onSubmit
|
|
7133
7141
|
}
|
|
7134
7142
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
7135
7143
|
JSONInput,
|
|
@@ -7138,16 +7146,24 @@ const WorkflowInputData = ({
|
|
|
7138
7146
|
defaultValues,
|
|
7139
7147
|
isSubmitLoading,
|
|
7140
7148
|
submitButtonLabel,
|
|
7141
|
-
onSubmit
|
|
7149
|
+
onSubmit,
|
|
7150
|
+
withoutSubmit
|
|
7142
7151
|
}
|
|
7143
7152
|
)
|
|
7144
7153
|
}
|
|
7145
7154
|
)
|
|
7146
7155
|
] });
|
|
7147
7156
|
};
|
|
7148
|
-
const JSONInput = ({
|
|
7157
|
+
const JSONInput = ({
|
|
7158
|
+
schema,
|
|
7159
|
+
defaultValues,
|
|
7160
|
+
isSubmitLoading,
|
|
7161
|
+
submitButtonLabel,
|
|
7162
|
+
onSubmit,
|
|
7163
|
+
withoutSubmit
|
|
7164
|
+
}) => {
|
|
7149
7165
|
const [errors, setErrors] = React.useState([]);
|
|
7150
|
-
const [inputData, setInputData] = React.useState(JSON.stringify(defaultValues ?? {}, null, 2));
|
|
7166
|
+
const [inputData, setInputData] = React.useState(() => JSON.stringify(defaultValues ?? {}, null, 2));
|
|
7151
7167
|
const handleSubmit = () => {
|
|
7152
7168
|
setErrors([]);
|
|
7153
7169
|
try {
|
|
@@ -7170,7 +7186,7 @@ const JSONInput = ({ schema, defaultValues, isSubmitLoading, submitButtonLabel,
|
|
|
7170
7186
|
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc list-inside", children: errors.map((error, idx) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-ui-sm text-accent2", children: error }, idx)) })
|
|
7171
7187
|
] }),
|
|
7172
7188
|
/* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter, { data: inputData, onChange: setInputData }),
|
|
7173
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button$1, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) : submitButtonLabel })
|
|
7189
|
+
withoutSubmit ? null : /* @__PURE__ */ jsxRuntime.jsx(Button$1, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) : submitButtonLabel })
|
|
7174
7190
|
] });
|
|
7175
7191
|
};
|
|
7176
7192
|
const SyntaxHighlighter = ({ data, onChange }) => {
|
|
@@ -7181,23 +7197,27 @@ const SyntaxHighlighter = ({ data, onChange }) => {
|
|
|
7181
7197
|
] });
|
|
7182
7198
|
};
|
|
7183
7199
|
|
|
7200
|
+
const isObjectEmpty = (objectName) => {
|
|
7201
|
+
return objectName && Object.keys(objectName).length === 0 && objectName.constructor === Object;
|
|
7202
|
+
};
|
|
7203
|
+
|
|
7184
7204
|
function WorkflowTrigger({
|
|
7185
7205
|
workflowId,
|
|
7206
|
+
paramsRunId,
|
|
7186
7207
|
setRunId,
|
|
7187
7208
|
workflow,
|
|
7188
7209
|
isLoading,
|
|
7189
7210
|
createWorkflowRun,
|
|
7190
7211
|
resumeWorkflow,
|
|
7191
7212
|
streamWorkflow,
|
|
7213
|
+
observeWorkflowStream,
|
|
7192
7214
|
isStreamingWorkflow,
|
|
7193
7215
|
streamResult,
|
|
7194
|
-
isResumingWorkflow,
|
|
7195
7216
|
isCancellingWorkflowRun,
|
|
7196
7217
|
cancelWorkflowRun
|
|
7197
7218
|
}) {
|
|
7198
7219
|
const { runtimeContext } = usePlaygroundStore();
|
|
7199
7220
|
const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
|
|
7200
|
-
const [suspendedSteps, setSuspendedSteps] = React.useState([]);
|
|
7201
7221
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
7202
7222
|
const [innerRunId, setInnerRunId] = React.useState("");
|
|
7203
7223
|
const [cancelResponse, setCancelResponse] = React.useState(null);
|
|
@@ -7235,19 +7255,21 @@ function WorkflowTrigger({
|
|
|
7235
7255
|
setCancelResponse(response);
|
|
7236
7256
|
};
|
|
7237
7257
|
const streamResultToUse = result ?? streamResult;
|
|
7258
|
+
const suspendedSteps = Object.entries(streamResultToUse?.payload?.workflowState?.steps || {}).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
7259
|
+
stepId,
|
|
7260
|
+
runId: streamResultToUse?.runId ?? "",
|
|
7261
|
+
suspendPayload: payload2,
|
|
7262
|
+
isLoading: false
|
|
7263
|
+
}));
|
|
7264
|
+
React.useEffect(() => {
|
|
7265
|
+
if (paramsRunId && observeWorkflowStream) {
|
|
7266
|
+
observeWorkflowStream({ workflowId, runId: paramsRunId });
|
|
7267
|
+
setInnerRunId(paramsRunId);
|
|
7268
|
+
}
|
|
7269
|
+
}, [paramsRunId]);
|
|
7238
7270
|
React.useEffect(() => {
|
|
7239
7271
|
setIsRunning(isStreamingWorkflow);
|
|
7240
7272
|
}, [isStreamingWorkflow]);
|
|
7241
|
-
React.useEffect(() => {
|
|
7242
|
-
if (!streamResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
|
|
7243
|
-
const suspended = Object.entries(streamResultToUse?.payload?.workflowState?.steps || {}).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
7244
|
-
stepId,
|
|
7245
|
-
runId: result.runId,
|
|
7246
|
-
suspendPayload: payload2,
|
|
7247
|
-
isLoading: false
|
|
7248
|
-
}));
|
|
7249
|
-
setSuspendedSteps(suspended);
|
|
7250
|
-
}, [streamResultToUse, result]);
|
|
7251
7273
|
React.useEffect(() => {
|
|
7252
7274
|
if (streamResult) {
|
|
7253
7275
|
setResult(streamResult);
|
|
@@ -7267,7 +7289,7 @@ function WorkflowTrigger({
|
|
|
7267
7289
|
const doneStatuses = ["success", "failed", "canceled"];
|
|
7268
7290
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full pt-3 pb-12", children: [
|
|
7269
7291
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 px-5 pb-5 border-b-sm border-border1", children: [
|
|
7270
|
-
|
|
7292
|
+
isSuspendedSteps && isStreamingWorkflow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
|
|
7271
7293
|
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
|
|
7272
7294
|
/* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
|
|
7273
7295
|
] }),
|
|
@@ -7281,9 +7303,10 @@ function WorkflowTrigger({
|
|
|
7281
7303
|
onSubmit: (data) => {
|
|
7282
7304
|
setPayload(data);
|
|
7283
7305
|
handleExecuteWorkflow(data);
|
|
7284
|
-
}
|
|
7306
|
+
},
|
|
7307
|
+
withoutSubmit: !!paramsRunId
|
|
7285
7308
|
}
|
|
7286
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
7309
|
+
) : !!paramsRunId ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
7287
7310
|
Button$1,
|
|
7288
7311
|
{
|
|
7289
7312
|
className: "w-full",
|
|
@@ -7311,7 +7334,7 @@ function WorkflowTrigger({
|
|
|
7311
7334
|
WorkflowInputData,
|
|
7312
7335
|
{
|
|
7313
7336
|
schema: stepSchema,
|
|
7314
|
-
isSubmitLoading:
|
|
7337
|
+
isSubmitLoading: isStreamingWorkflow,
|
|
7315
7338
|
submitButtonLabel: "Resume",
|
|
7316
7339
|
onSubmit: (data) => {
|
|
7317
7340
|
const stepIds = step.stepId?.split(".");
|
|
@@ -7349,7 +7372,7 @@ function WorkflowTrigger({
|
|
|
7349
7372
|
] })
|
|
7350
7373
|
] })
|
|
7351
7374
|
] }),
|
|
7352
|
-
result && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowJsonDialog, { result }) })
|
|
7375
|
+
result && !isObjectEmpty(result) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowJsonDialog, { result }) })
|
|
7353
7376
|
] });
|
|
7354
7377
|
}
|
|
7355
7378
|
const WorkflowJsonDialog = ({ result }) => {
|
|
@@ -7377,7 +7400,14 @@ const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
|
|
|
7377
7400
|
});
|
|
7378
7401
|
};
|
|
7379
7402
|
|
|
7380
|
-
const WorkflowRuns = ({
|
|
7403
|
+
const WorkflowRuns = ({
|
|
7404
|
+
workflowId,
|
|
7405
|
+
runId,
|
|
7406
|
+
onPressRun,
|
|
7407
|
+
onPressBackToRuns,
|
|
7408
|
+
observeWorkflowStream,
|
|
7409
|
+
...triggerProps
|
|
7410
|
+
}) => {
|
|
7381
7411
|
const { isLoading, data: runs } = useWorkflowRuns(workflowId);
|
|
7382
7412
|
if (isLoading) {
|
|
7383
7413
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
|
|
@@ -7386,19 +7416,45 @@ const WorkflowRuns = ({ workflowId, runId, onPressRun }) => {
|
|
|
7386
7416
|
if (actualRuns.length === 0) {
|
|
7387
7417
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-md", className: "text-icon6 text-center", children: "No previous run" }) });
|
|
7388
7418
|
}
|
|
7389
|
-
|
|
7419
|
+
const run = actualRuns.find((run2) => run2.runId === runId);
|
|
7420
|
+
const runSnapshot = run?.snapshot;
|
|
7421
|
+
const runResult = runSnapshot && typeof runSnapshot === "object" ? convertWorkflowRunStateToWatchResult(runSnapshot) : null;
|
|
7422
|
+
const runStatus = runResult?.payload?.workflowState?.status;
|
|
7423
|
+
if (runId) {
|
|
7424
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full grid grid-rows-[1fr_auto]", children: [
|
|
7425
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-5 space-y-2", children: /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { onClick: onPressBackToRuns, variant: "light", children: [
|
|
7426
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, {}) }),
|
|
7427
|
+
"Back to runs"
|
|
7428
|
+
] }) }),
|
|
7429
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7430
|
+
WorkflowTrigger,
|
|
7431
|
+
{
|
|
7432
|
+
...triggerProps,
|
|
7433
|
+
streamResult: isObjectEmpty(triggerProps.streamResult ?? {}) ? runResult : triggerProps.streamResult,
|
|
7434
|
+
paramsRunId: runId,
|
|
7435
|
+
workflowId,
|
|
7436
|
+
observeWorkflowStream: () => {
|
|
7437
|
+
if (runStatus !== "success" && runStatus !== "failed" && runStatus !== "canceled") {
|
|
7438
|
+
observeWorkflowStream?.({ workflowId, runId });
|
|
7439
|
+
}
|
|
7440
|
+
}
|
|
7441
|
+
}
|
|
7442
|
+
)
|
|
7443
|
+
] });
|
|
7444
|
+
}
|
|
7445
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pb-10", children: actualRuns.map((run2) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7390
7446
|
"button",
|
|
7391
7447
|
{
|
|
7392
|
-
onClick: () => onPressRun({ workflowId, runId:
|
|
7448
|
+
onClick: () => onPressRun({ workflowId, runId: run2.runId }),
|
|
7393
7449
|
className: clsx("px-3 py-2 border-b-sm border-border1 block w-full hover:bg-surface4 text-left", {
|
|
7394
|
-
"bg-surface4":
|
|
7450
|
+
"bg-surface4": run2.runId === runId
|
|
7395
7451
|
}),
|
|
7396
7452
|
children: [
|
|
7397
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-lg", className: "font-medium text-icon6 truncate", as: "p", children:
|
|
7398
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "font-medium text-icon3 truncate", as: "p", children: typeof
|
|
7453
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-lg", className: "font-medium text-icon6 truncate", as: "p", children: run2.runId }),
|
|
7454
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "font-medium text-icon3 truncate", as: "p", children: typeof run2?.snapshot === "string" ? "" : run2?.snapshot?.timestamp ? dateFns.formatDate(run2?.snapshot?.timestamp, "MMM d, yyyy h:mm a") : "" })
|
|
7399
7455
|
]
|
|
7400
7456
|
}
|
|
7401
|
-
) },
|
|
7457
|
+
) }, run2.runId)) });
|
|
7402
7458
|
};
|
|
7403
7459
|
|
|
7404
7460
|
const EmptyState = ({
|
|
@@ -7690,7 +7746,7 @@ const useLinkComponent = () => {
|
|
|
7690
7746
|
return ctx;
|
|
7691
7747
|
};
|
|
7692
7748
|
|
|
7693
|
-
const columns$
|
|
7749
|
+
const columns$2 = [
|
|
7694
7750
|
{
|
|
7695
7751
|
id: "name",
|
|
7696
7752
|
header: "Name",
|
|
@@ -7738,7 +7794,7 @@ function WorkflowTable({ workflows, isLoading }) {
|
|
|
7738
7794
|
}, [workflows]);
|
|
7739
7795
|
const table = reactTable.useReactTable({
|
|
7740
7796
|
data: workflowData,
|
|
7741
|
-
columns: columns$
|
|
7797
|
+
columns: columns$2,
|
|
7742
7798
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
7743
7799
|
});
|
|
7744
7800
|
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(WorkflowTableSkeleton, {});
|
|
@@ -8521,11 +8577,11 @@ const AssistantMessage = ({ ToolFallback: ToolFallbackCustom, hasModelList }) =>
|
|
|
8521
8577
|
modelMetadata.modelId
|
|
8522
8578
|
] })
|
|
8523
8579
|
] }),
|
|
8524
|
-
/* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar
|
|
8580
|
+
/* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar, {})
|
|
8525
8581
|
] })
|
|
8526
8582
|
] });
|
|
8527
8583
|
};
|
|
8528
|
-
const AssistantActionBar
|
|
8584
|
+
const AssistantActionBar = () => {
|
|
8529
8585
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8530
8586
|
react.ActionBarPrimitive.Root,
|
|
8531
8587
|
{
|
|
@@ -9114,28 +9170,28 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, hasModelList }) =
|
|
|
9114
9170
|
const WrappedAssistantMessage = (props) => {
|
|
9115
9171
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback, hasModelList });
|
|
9116
9172
|
};
|
|
9117
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper
|
|
9173
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper, { children: [
|
|
9118
9174
|
/* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { ref: areaRef, autoScroll: false, className: "overflow-y-scroll scroll-smooth h-full", children: [
|
|
9119
|
-
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome
|
|
9175
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
|
|
9120
9176
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[568px] w-full mx-auto px-4 pb-7", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9121
9177
|
react.ThreadPrimitive.Messages,
|
|
9122
9178
|
{
|
|
9123
9179
|
components: {
|
|
9124
9180
|
UserMessage,
|
|
9125
|
-
EditComposer
|
|
9181
|
+
EditComposer,
|
|
9126
9182
|
AssistantMessage: WrappedAssistantMessage
|
|
9127
9183
|
}
|
|
9128
9184
|
}
|
|
9129
9185
|
) }),
|
|
9130
9186
|
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
9131
9187
|
] }),
|
|
9132
|
-
/* @__PURE__ */ jsxRuntime.jsx(Composer
|
|
9188
|
+
/* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory, agentId })
|
|
9133
9189
|
] });
|
|
9134
9190
|
};
|
|
9135
|
-
const ThreadWrapper
|
|
9191
|
+
const ThreadWrapper = ({ children }) => {
|
|
9136
9192
|
return /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.Root, { className: "grid grid-rows-[1fr_auto] h-full overflow-y-auto", children });
|
|
9137
9193
|
};
|
|
9138
|
-
const ThreadWelcome
|
|
9194
|
+
const ThreadWelcome = ({ agentName }) => {
|
|
9139
9195
|
const safeAgentName = agentName ?? "";
|
|
9140
9196
|
const words = safeAgentName.split(" ") ?? [];
|
|
9141
9197
|
let initials = "A";
|
|
@@ -9151,36 +9207,30 @@ const ThreadWelcome$1 = ({ agentName }) => {
|
|
|
9151
9207
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
9152
9208
|
] }) });
|
|
9153
9209
|
};
|
|
9154
|
-
const Composer
|
|
9210
|
+
const Composer = ({ hasMemory, agentId }) => {
|
|
9155
9211
|
const { setThreadInput } = useThreadInput();
|
|
9156
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
9157
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9158
|
-
|
|
9159
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9172
|
-
|
|
9173
|
-
/* @__PURE__ */ jsxRuntime.jsx(ComposerAction$1, {})
|
|
9174
|
-
] })
|
|
9212
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4", children: /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
|
|
9213
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[568px] w-full mx-auto pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}) }),
|
|
9214
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface3 rounded-lg border-sm border-border1 py-4 mt-auto max-w-[568px] w-full mx-auto px-4 focus-within:outline focus-within:outline-accent1 -outline-offset-2", children: [
|
|
9215
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9216
|
+
"textarea",
|
|
9217
|
+
{
|
|
9218
|
+
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none outline-none",
|
|
9219
|
+
autoFocus: document.activeElement === document.body,
|
|
9220
|
+
placeholder: "Enter your message...",
|
|
9221
|
+
name: "",
|
|
9222
|
+
id: "",
|
|
9223
|
+
onChange: (e) => setThreadInput?.(e.target.value)
|
|
9224
|
+
}
|
|
9225
|
+
) }),
|
|
9226
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9227
|
+
/* @__PURE__ */ jsxRuntime.jsx(SpeechInput, { agentId }),
|
|
9228
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {})
|
|
9175
9229
|
] })
|
|
9176
|
-
] }),
|
|
9177
|
-
!hasMemory && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex gap-2 pt-1 max-w-[568px] w-full mx-auto border-t items-start", children: [
|
|
9178
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "transform translate-y-[0.1rem]", children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, {}) }),
|
|
9179
|
-
"Memory is not enabled. The conversation will not be persisted."
|
|
9180
9230
|
] })
|
|
9181
|
-
] });
|
|
9231
|
+
] }) });
|
|
9182
9232
|
};
|
|
9183
|
-
const SpeechInput
|
|
9233
|
+
const SpeechInput = ({ agentId }) => {
|
|
9184
9234
|
const composerRuntime = react.useComposerRuntime();
|
|
9185
9235
|
const { start, stop, isListening, transcript } = useSpeechRecognition({ agentId });
|
|
9186
9236
|
React.useEffect(() => {
|
|
@@ -9195,11 +9245,11 @@ const SpeechInput$1 = ({ agentId }) => {
|
|
|
9195
9245
|
variant: "ghost",
|
|
9196
9246
|
className: "rounded-full",
|
|
9197
9247
|
onClick: () => isListening ? stop() : start(),
|
|
9198
|
-
children: isListening ? /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon
|
|
9248
|
+
children: isListening ? /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
9199
9249
|
}
|
|
9200
9250
|
);
|
|
9201
9251
|
};
|
|
9202
|
-
const ComposerAction
|
|
9252
|
+
const ComposerAction = () => {
|
|
9203
9253
|
const [isAddAttachmentDialogOpen, setIsAddAttachmentDialogOpen] = React.useState(false);
|
|
9204
9254
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9205
9255
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -9223,10 +9273,10 @@ const ComposerAction$1 = () => {
|
|
|
9223
9273
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
9224
9274
|
}
|
|
9225
9275
|
) }) }),
|
|
9226
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon
|
|
9276
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) }) }) })
|
|
9227
9277
|
] });
|
|
9228
9278
|
};
|
|
9229
|
-
const EditComposer
|
|
9279
|
+
const EditComposer = () => {
|
|
9230
9280
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
|
|
9231
9281
|
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, {}),
|
|
9232
9282
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -9235,7 +9285,7 @@ const EditComposer$1 = () => {
|
|
|
9235
9285
|
] })
|
|
9236
9286
|
] });
|
|
9237
9287
|
};
|
|
9238
|
-
const CircleStopIcon
|
|
9288
|
+
const CircleStopIcon = () => {
|
|
9239
9289
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
9240
9290
|
};
|
|
9241
9291
|
|
|
@@ -10040,9 +10090,6 @@ const createRootToolAssistantMessage = ({
|
|
|
10040
10090
|
return [...conversation, newMessage];
|
|
10041
10091
|
};
|
|
10042
10092
|
|
|
10043
|
-
const convertMessage$1 = (message) => {
|
|
10044
|
-
return message;
|
|
10045
|
-
};
|
|
10046
10093
|
const handleFinishReason = (finishReason) => {
|
|
10047
10094
|
switch (finishReason) {
|
|
10048
10095
|
case "tool-calls":
|
|
@@ -10151,17 +10198,20 @@ function MastraRuntimeProvider({
|
|
|
10151
10198
|
runtimeContext,
|
|
10152
10199
|
modelVersion
|
|
10153
10200
|
}) {
|
|
10154
|
-
const
|
|
10201
|
+
const initializeMessages = () => memory ? initializeMessageState(initialMessages || []) : [];
|
|
10202
|
+
const [isLegacyRunning, setIsLegacyRunning] = React.useState(false);
|
|
10203
|
+
const [legacyMessages, setLegacyMessages] = React.useState(initializeMessages());
|
|
10155
10204
|
const {
|
|
10156
|
-
messages,
|
|
10157
10205
|
setMessages,
|
|
10158
|
-
|
|
10206
|
+
messages,
|
|
10207
|
+
generate,
|
|
10208
|
+
stream,
|
|
10159
10209
|
network,
|
|
10160
10210
|
cancelRun,
|
|
10161
|
-
isRunning:
|
|
10211
|
+
isRunning: isRunningStream
|
|
10162
10212
|
} = react$3.useChat({
|
|
10163
10213
|
agentId,
|
|
10164
|
-
initializeMessages
|
|
10214
|
+
initializeMessages
|
|
10165
10215
|
});
|
|
10166
10216
|
const { refetch: refreshWorkingMemory } = useWorkingMemory();
|
|
10167
10217
|
const abortControllerRef = React.useRef(null);
|
|
@@ -10175,8 +10225,8 @@ function MastraRuntimeProvider({
|
|
|
10175
10225
|
topK,
|
|
10176
10226
|
topP,
|
|
10177
10227
|
instructions,
|
|
10228
|
+
chatWithGenerateLegacy,
|
|
10178
10229
|
chatWithGenerate,
|
|
10179
|
-
chatWithGenerateVNext,
|
|
10180
10230
|
chatWithNetwork,
|
|
10181
10231
|
providerOptions
|
|
10182
10232
|
} = settings?.modelSettings ?? {};
|
|
@@ -10197,11 +10247,16 @@ function MastraRuntimeProvider({
|
|
|
10197
10247
|
providerOptions
|
|
10198
10248
|
};
|
|
10199
10249
|
const baseClient = react$3.useMastraClient();
|
|
10250
|
+
const isVNext = modelVersion === "v2";
|
|
10200
10251
|
const onNew = async (message) => {
|
|
10201
10252
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
10202
10253
|
const attachments = await convertToAIAttachments(message.attachments);
|
|
10203
10254
|
const input = message.content[0].text;
|
|
10204
|
-
|
|
10255
|
+
if (isVNext) {
|
|
10256
|
+
setMessages((s) => [...s, { role: "user", content: input, attachments: message.attachments }]);
|
|
10257
|
+
} else {
|
|
10258
|
+
setLegacyMessages((s) => [...s, { role: "user", content: input, attachments: message.attachments }]);
|
|
10259
|
+
}
|
|
10205
10260
|
const controller = new AbortController();
|
|
10206
10261
|
abortControllerRef.current = controller;
|
|
10207
10262
|
const clientWithAbort = new clientJs.MastraClient({
|
|
@@ -10210,97 +10265,7 @@ function MastraRuntimeProvider({
|
|
|
10210
10265
|
});
|
|
10211
10266
|
const agent = clientWithAbort.getAgent(agentId);
|
|
10212
10267
|
try {
|
|
10213
|
-
|
|
10214
|
-
if (generatedResponse.response && "messages" in generatedResponse.response && generatedResponse.response.messages) {
|
|
10215
|
-
const latestMessage = generatedResponse.response.messages.reduce(
|
|
10216
|
-
(acc, message2) => {
|
|
10217
|
-
const _content = Array.isArray(acc.content) ? acc.content : [];
|
|
10218
|
-
if (typeof message2.content === "string") {
|
|
10219
|
-
return {
|
|
10220
|
-
...acc,
|
|
10221
|
-
content: [
|
|
10222
|
-
..._content,
|
|
10223
|
-
...generatedResponse.reasoning ? [{ type: "reasoning", text: generatedResponse.reasoning }] : [],
|
|
10224
|
-
{
|
|
10225
|
-
type: "text",
|
|
10226
|
-
text: message2.content
|
|
10227
|
-
}
|
|
10228
|
-
]
|
|
10229
|
-
};
|
|
10230
|
-
}
|
|
10231
|
-
if (message2.role === "assistant") {
|
|
10232
|
-
const toolCallContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "tool-call") : void 0;
|
|
10233
|
-
const reasoningContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "reasoning") : void 0;
|
|
10234
|
-
if (toolCallContent) {
|
|
10235
|
-
const newContent = message2.content.map((c) => {
|
|
10236
|
-
if (c.type === "tool-call" && c.toolCallId === toolCallContent?.toolCallId) {
|
|
10237
|
-
return {
|
|
10238
|
-
...c,
|
|
10239
|
-
toolCallId: toolCallContent.toolCallId,
|
|
10240
|
-
toolName: toolCallContent.toolName,
|
|
10241
|
-
args: toolCallContent.input
|
|
10242
|
-
};
|
|
10243
|
-
}
|
|
10244
|
-
return c;
|
|
10245
|
-
});
|
|
10246
|
-
const containsToolCall = newContent.some((c) => c.type === "tool-call");
|
|
10247
|
-
return {
|
|
10248
|
-
...acc,
|
|
10249
|
-
content: containsToolCall ? [...reasoningContent ? [reasoningContent] : [], ...newContent] : [..._content, ...reasoningContent ? [reasoningContent] : [], toolCallContent]
|
|
10250
|
-
};
|
|
10251
|
-
}
|
|
10252
|
-
const textContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "text" && content.text) : void 0;
|
|
10253
|
-
if (textContent) {
|
|
10254
|
-
return {
|
|
10255
|
-
...acc,
|
|
10256
|
-
content: [..._content, ...reasoningContent ? [reasoningContent] : [], textContent]
|
|
10257
|
-
};
|
|
10258
|
-
}
|
|
10259
|
-
}
|
|
10260
|
-
if (message2.role === "tool") {
|
|
10261
|
-
const toolResult = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "tool-result") : void 0;
|
|
10262
|
-
if (toolResult) {
|
|
10263
|
-
const newContent = _content.map((c) => {
|
|
10264
|
-
if (c.type === "tool-call" && c.toolCallId === toolResult?.toolCallId) {
|
|
10265
|
-
return { ...c, result: toolResult.output?.value };
|
|
10266
|
-
}
|
|
10267
|
-
return c;
|
|
10268
|
-
});
|
|
10269
|
-
const containsToolCall = newContent.some((c) => c.type === "tool-call");
|
|
10270
|
-
return {
|
|
10271
|
-
...acc,
|
|
10272
|
-
content: containsToolCall ? newContent : [
|
|
10273
|
-
..._content,
|
|
10274
|
-
{ type: "tool-result", toolCallId: toolResult.toolCallId, result: toolResult.output?.value }
|
|
10275
|
-
]
|
|
10276
|
-
};
|
|
10277
|
-
}
|
|
10278
|
-
return {
|
|
10279
|
-
...acc,
|
|
10280
|
-
content: [..._content, toolResult]
|
|
10281
|
-
};
|
|
10282
|
-
}
|
|
10283
|
-
return acc;
|
|
10284
|
-
},
|
|
10285
|
-
{ role: "assistant", content: [] }
|
|
10286
|
-
);
|
|
10287
|
-
setMessages((currentConversation) => [
|
|
10288
|
-
...currentConversation,
|
|
10289
|
-
{
|
|
10290
|
-
...latestMessage,
|
|
10291
|
-
metadata: {
|
|
10292
|
-
custom: {
|
|
10293
|
-
modelMetadata: generatedResponse.response.modelMetadata
|
|
10294
|
-
}
|
|
10295
|
-
}
|
|
10296
|
-
}
|
|
10297
|
-
]);
|
|
10298
|
-
if (generatedResponse.finishReason) {
|
|
10299
|
-
handleFinishReason(generatedResponse.finishReason);
|
|
10300
|
-
}
|
|
10301
|
-
}
|
|
10302
|
-
};
|
|
10303
|
-
if (modelVersion === "v2") {
|
|
10268
|
+
if (isVNext) {
|
|
10304
10269
|
if (chatWithNetwork) {
|
|
10305
10270
|
let currentEntityId;
|
|
10306
10271
|
await network({
|
|
@@ -10386,36 +10351,26 @@ function MastraRuntimeProvider({
|
|
|
10386
10351
|
}
|
|
10387
10352
|
});
|
|
10388
10353
|
} else {
|
|
10389
|
-
if (
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
messages: [
|
|
10354
|
+
if (chatWithGenerate) {
|
|
10355
|
+
await generate({
|
|
10356
|
+
coreUserMessages: [
|
|
10393
10357
|
{
|
|
10394
10358
|
role: "user",
|
|
10395
10359
|
content: input
|
|
10396
10360
|
},
|
|
10397
10361
|
...attachments
|
|
10398
10362
|
],
|
|
10399
|
-
runId: agentId,
|
|
10400
|
-
modelSettings: {
|
|
10401
|
-
frequencyPenalty,
|
|
10402
|
-
presencePenalty,
|
|
10403
|
-
maxRetries,
|
|
10404
|
-
temperature,
|
|
10405
|
-
topK,
|
|
10406
|
-
topP,
|
|
10407
|
-
maxOutputTokens: maxTokens
|
|
10408
|
-
},
|
|
10409
|
-
providerOptions,
|
|
10410
|
-
instructions,
|
|
10411
10363
|
runtimeContext: runtimeContextInstance,
|
|
10412
|
-
|
|
10364
|
+
threadId,
|
|
10365
|
+
modelSettings: modelSettingsArgs,
|
|
10366
|
+
signal: controller.signal,
|
|
10367
|
+
onFinish: (messages2) => {
|
|
10368
|
+
return messages2.map((message2) => react$3.toAssistantUIMessage(message2));
|
|
10369
|
+
}
|
|
10413
10370
|
});
|
|
10414
|
-
handleGenerateResponse(response);
|
|
10415
|
-
setIsRunning(false);
|
|
10416
10371
|
return;
|
|
10417
10372
|
} else {
|
|
10418
|
-
await
|
|
10373
|
+
await stream({
|
|
10419
10374
|
coreUserMessages: [
|
|
10420
10375
|
{
|
|
10421
10376
|
role: "user",
|
|
@@ -10439,9 +10394,9 @@ function MastraRuntimeProvider({
|
|
|
10439
10394
|
}
|
|
10440
10395
|
}
|
|
10441
10396
|
} else {
|
|
10442
|
-
if (
|
|
10443
|
-
|
|
10444
|
-
const generateResponse = await agent.
|
|
10397
|
+
if (chatWithGenerateLegacy) {
|
|
10398
|
+
setIsLegacyRunning(true);
|
|
10399
|
+
const generateResponse = await agent.generateLegacy({
|
|
10445
10400
|
messages: [
|
|
10446
10401
|
{
|
|
10447
10402
|
role: "user",
|
|
@@ -10531,12 +10486,13 @@ function MastraRuntimeProvider({
|
|
|
10531
10486
|
},
|
|
10532
10487
|
{ role: "assistant", content: [] }
|
|
10533
10488
|
);
|
|
10534
|
-
|
|
10489
|
+
setLegacyMessages((currentConversation) => [...currentConversation, latestMessage]);
|
|
10535
10490
|
handleFinishReason(generateResponse.finishReason);
|
|
10536
10491
|
}
|
|
10492
|
+
setIsLegacyRunning(false);
|
|
10537
10493
|
} else {
|
|
10538
10494
|
let updater = function() {
|
|
10539
|
-
|
|
10495
|
+
setLegacyMessages((currentConversation) => {
|
|
10540
10496
|
const message2 = {
|
|
10541
10497
|
role: "assistant",
|
|
10542
10498
|
content: [{ type: "text", text: content }]
|
|
@@ -10555,8 +10511,8 @@ function MastraRuntimeProvider({
|
|
|
10555
10511
|
return [...currentConversation.slice(0, -1), message2];
|
|
10556
10512
|
});
|
|
10557
10513
|
};
|
|
10558
|
-
|
|
10559
|
-
const response = await agent.
|
|
10514
|
+
setIsLegacyRunning(true);
|
|
10515
|
+
const response = await agent.streamLegacy({
|
|
10560
10516
|
messages: [
|
|
10561
10517
|
{
|
|
10562
10518
|
role: "user",
|
|
@@ -10596,7 +10552,7 @@ function MastraRuntimeProvider({
|
|
|
10596
10552
|
updater();
|
|
10597
10553
|
},
|
|
10598
10554
|
async onToolCallPart(value) {
|
|
10599
|
-
|
|
10555
|
+
setLegacyMessages((currentConversation) => {
|
|
10600
10556
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
10601
10557
|
if (lastMessage && lastMessage.role === "assistant") {
|
|
10602
10558
|
const updatedMessage = {
|
|
@@ -10642,7 +10598,7 @@ function MastraRuntimeProvider({
|
|
|
10642
10598
|
toolCallIdToName.current[value.toolCallId] = value.toolName;
|
|
10643
10599
|
},
|
|
10644
10600
|
async onToolResultPart(value) {
|
|
10645
|
-
|
|
10601
|
+
setLegacyMessages((currentConversation) => {
|
|
10646
10602
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
10647
10603
|
if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
|
|
10648
10604
|
const updatedContent = lastMessage.content.map((part) => {
|
|
@@ -10678,7 +10634,7 @@ function MastraRuntimeProvider({
|
|
|
10678
10634
|
handleFinishReason(finishReason);
|
|
10679
10635
|
},
|
|
10680
10636
|
onReasoningPart(value) {
|
|
10681
|
-
|
|
10637
|
+
setLegacyMessages((currentConversation) => {
|
|
10682
10638
|
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
10683
10639
|
if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
|
|
10684
10640
|
const updatedContent = lastMessage.content.map((part) => {
|
|
@@ -10711,21 +10667,28 @@ function MastraRuntimeProvider({
|
|
|
10711
10667
|
}
|
|
10712
10668
|
});
|
|
10713
10669
|
}
|
|
10670
|
+
setIsLegacyRunning(false);
|
|
10714
10671
|
}
|
|
10715
|
-
setIsRunning(false);
|
|
10716
10672
|
setTimeout(() => {
|
|
10717
10673
|
refreshThreadList?.();
|
|
10718
10674
|
}, 500);
|
|
10719
10675
|
} catch (error) {
|
|
10720
10676
|
console.error("Error occurred in MastraRuntimeProvider", error);
|
|
10721
|
-
|
|
10677
|
+
setIsLegacyRunning(false);
|
|
10722
10678
|
if (error.name === "AbortError") {
|
|
10723
10679
|
return;
|
|
10724
10680
|
}
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10681
|
+
if (isVNext) {
|
|
10682
|
+
setMessages((currentConversation) => [
|
|
10683
|
+
...currentConversation,
|
|
10684
|
+
{ role: "assistant", content: [{ type: "text", text: `${error}` }] }
|
|
10685
|
+
]);
|
|
10686
|
+
} else {
|
|
10687
|
+
setLegacyMessages((currentConversation) => [
|
|
10688
|
+
...currentConversation,
|
|
10689
|
+
{ role: "assistant", content: [{ type: "text", text: `${error}` }] }
|
|
10690
|
+
]);
|
|
10691
|
+
}
|
|
10729
10692
|
} finally {
|
|
10730
10693
|
abortControllerRef.current = null;
|
|
10731
10694
|
}
|
|
@@ -10734,15 +10697,15 @@ function MastraRuntimeProvider({
|
|
|
10734
10697
|
if (abortControllerRef.current) {
|
|
10735
10698
|
abortControllerRef.current.abort();
|
|
10736
10699
|
abortControllerRef.current = null;
|
|
10737
|
-
|
|
10700
|
+
setIsLegacyRunning(false);
|
|
10738
10701
|
cancelRun?.();
|
|
10739
10702
|
}
|
|
10740
10703
|
};
|
|
10741
10704
|
const { adapters, isReady } = useAdapters(agentId);
|
|
10742
10705
|
const runtime = react.useExternalStoreRuntime({
|
|
10743
|
-
isRunning:
|
|
10744
|
-
messages,
|
|
10745
|
-
convertMessage:
|
|
10706
|
+
isRunning: isLegacyRunning || isRunningStream,
|
|
10707
|
+
messages: isVNext ? messages : legacyMessages,
|
|
10708
|
+
convertMessage: (x) => x,
|
|
10746
10709
|
onNew,
|
|
10747
10710
|
onCancel,
|
|
10748
10711
|
adapters: isReady ? adapters : void 0
|
|
@@ -10761,8 +10724,8 @@ const defaultSettings = {
|
|
|
10761
10724
|
maxSteps: 5,
|
|
10762
10725
|
temperature: 0.5,
|
|
10763
10726
|
topP: 1,
|
|
10764
|
-
|
|
10765
|
-
|
|
10727
|
+
chatWithGenerateLegacy: false,
|
|
10728
|
+
chatWithGenerate: false
|
|
10766
10729
|
}
|
|
10767
10730
|
};
|
|
10768
10731
|
function useAgentSettingsState({ agentId }) {
|
|
@@ -11507,10 +11470,10 @@ const AgentSettings = ({ modelVersion, hasMemory = false, hasSubAgents = false }
|
|
|
11507
11470
|
if (settings?.modelSettings?.chatWithNetwork) {
|
|
11508
11471
|
radioValue = "network";
|
|
11509
11472
|
} else {
|
|
11510
|
-
radioValue = settings?.modelSettings?.
|
|
11473
|
+
radioValue = settings?.modelSettings?.chatWithGenerate ? "generate" : "stream";
|
|
11511
11474
|
}
|
|
11512
11475
|
} else {
|
|
11513
|
-
radioValue = settings?.modelSettings?.
|
|
11476
|
+
radioValue = settings?.modelSettings?.chatWithGenerateLegacy ? "generateLegacy" : "streamLegacy";
|
|
11514
11477
|
}
|
|
11515
11478
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-5 text-xs py-2 pb-4", children: [
|
|
11516
11479
|
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-7", children: [
|
|
@@ -11523,29 +11486,28 @@ const AgentSettings = ({ modelVersion, hasMemory = false, hasSubAgents = false }
|
|
|
11523
11486
|
...settings,
|
|
11524
11487
|
modelSettings: {
|
|
11525
11488
|
...settings?.modelSettings,
|
|
11489
|
+
chatWithGenerateLegacy: value === "generateLegacy",
|
|
11526
11490
|
chatWithGenerate: value === "generate",
|
|
11527
|
-
chatWithGenerateVNext: value === "generateVNext",
|
|
11528
|
-
chatWithStreamVNext: value === "streamVNext",
|
|
11529
11491
|
chatWithNetwork: value === "network"
|
|
11530
11492
|
}
|
|
11531
11493
|
}),
|
|
11532
11494
|
className: "flex flex-row gap-4",
|
|
11533
11495
|
children: [
|
|
11534
11496
|
modelVersion !== "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11535
|
-
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "
|
|
11536
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11497
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "generateLegacy", id: "generateLegacy", className: "text-icon6" }),
|
|
11498
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "generateLegacy", children: "Generate" })
|
|
11537
11499
|
] }),
|
|
11538
11500
|
modelVersion === "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11539
|
-
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "
|
|
11540
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11501
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "generate", id: "generate", className: "text-icon6" }),
|
|
11502
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "generate", children: "Generate" })
|
|
11541
11503
|
] }),
|
|
11542
11504
|
modelVersion !== "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11543
|
-
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "
|
|
11544
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11505
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "streamLegacy", id: "streamLegacy", className: "text-icon6" }),
|
|
11506
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "streamLegacy", children: "Stream" })
|
|
11545
11507
|
] }),
|
|
11546
11508
|
modelVersion === "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11547
|
-
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "
|
|
11548
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "
|
|
11509
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "stream", id: "stream", className: "text-icon6" }),
|
|
11510
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "stream", children: "Stream" })
|
|
11549
11511
|
] }),
|
|
11550
11512
|
modelVersion === "v2" && /* @__PURE__ */ jsxRuntime.jsx(NetworkCheckbox, { hasMemory, hasSubAgents })
|
|
11551
11513
|
]
|
|
@@ -11605,7 +11567,7 @@ const NameCell$1 = ({ row }) => {
|
|
|
11605
11567
|
}
|
|
11606
11568
|
);
|
|
11607
11569
|
};
|
|
11608
|
-
const columns$
|
|
11570
|
+
const columns$1 = [
|
|
11609
11571
|
{
|
|
11610
11572
|
header: "Name",
|
|
11611
11573
|
accessorKey: "name",
|
|
@@ -11682,7 +11644,7 @@ function AgentsTable({ agents, isLoading }) {
|
|
|
11682
11644
|
);
|
|
11683
11645
|
const table = reactTable.useReactTable({
|
|
11684
11646
|
data: projectData,
|
|
11685
|
-
columns: columns$
|
|
11647
|
+
columns: columns$1,
|
|
11686
11648
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
11687
11649
|
});
|
|
11688
11650
|
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(AgentsTableSkeleton, {});
|
|
@@ -13403,7 +13365,7 @@ const NameCell = ({ row }) => {
|
|
|
13403
13365
|
}
|
|
13404
13366
|
);
|
|
13405
13367
|
};
|
|
13406
|
-
const columns
|
|
13368
|
+
const columns = [
|
|
13407
13369
|
{
|
|
13408
13370
|
header: "Name",
|
|
13409
13371
|
accessorKey: "name",
|
|
@@ -13426,7 +13388,7 @@ function ScorersTable({ scorers, isLoading }) {
|
|
|
13426
13388
|
);
|
|
13427
13389
|
const table = reactTable.useReactTable({
|
|
13428
13390
|
data: scorersData,
|
|
13429
|
-
columns
|
|
13391
|
+
columns,
|
|
13430
13392
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
13431
13393
|
});
|
|
13432
13394
|
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(ScorersTableSkeleton, {});
|
|
@@ -13468,20 +13430,41 @@ const EmptyScorersTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { classNam
|
|
|
13468
13430
|
}
|
|
13469
13431
|
) });
|
|
13470
13432
|
|
|
13433
|
+
const variantClasses$1 = {
|
|
13434
|
+
warning: "bg-yellow-900/20 border-sm border-yellow-200 text-yellow-200",
|
|
13435
|
+
destructive: "bg-red-900/20 border-sm border-red-200 text-red-200"
|
|
13436
|
+
};
|
|
13437
|
+
const variantIcons = {
|
|
13438
|
+
warning: lucideReact.TriangleAlert,
|
|
13439
|
+
destructive: lucideReact.AlertCircle
|
|
13440
|
+
};
|
|
13441
|
+
const Alert = ({ children, variant = "destructive" }) => {
|
|
13442
|
+
const Ico = variantIcons[variant];
|
|
13443
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(variantClasses$1[variant], "p-2 rounded-md"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
13444
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "mt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(Ico, {}) }),
|
|
13445
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children })
|
|
13446
|
+
] }) });
|
|
13447
|
+
};
|
|
13448
|
+
const AlertTitle = ({ children, as: As = "h5" }) => {
|
|
13449
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: As, variant: "ui-md", className: "font-semibold", children });
|
|
13450
|
+
};
|
|
13451
|
+
const AlertDescription = ({ children, as: As = "p" }) => {
|
|
13452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: As, variant: "ui-sm", children });
|
|
13453
|
+
};
|
|
13454
|
+
|
|
13471
13455
|
const AgentMetadataModelSwitcher = ({
|
|
13472
13456
|
defaultProvider,
|
|
13473
13457
|
defaultModel,
|
|
13474
13458
|
updateModel,
|
|
13475
|
-
apiUrl = "/api/agents/providers"
|
|
13476
|
-
autoSave = false,
|
|
13477
|
-
selectProviderPlaceholder = "Select provider"
|
|
13459
|
+
apiUrl = "/api/agents/providers"
|
|
13478
13460
|
}) => {
|
|
13479
13461
|
const [selectedModel, setSelectedModel] = React.useState(defaultModel);
|
|
13480
13462
|
const [showModelSuggestions, setShowModelSuggestions] = React.useState(false);
|
|
13481
13463
|
const [selectedProvider, setSelectedProvider] = React.useState(defaultProvider || "");
|
|
13482
13464
|
const [providerSearch, setProviderSearch] = React.useState("");
|
|
13483
13465
|
const [modelSearch, setModelSearch] = React.useState("");
|
|
13484
|
-
const [
|
|
13466
|
+
const [isSearchingProvider, setIsSearchingProvider] = React.useState(false);
|
|
13467
|
+
const [isSearchingModel, setIsSearchingModel] = React.useState(false);
|
|
13485
13468
|
const [showProviderSuggestions, setShowProviderSuggestions] = React.useState(false);
|
|
13486
13469
|
const [loading, setLoading] = React.useState(false);
|
|
13487
13470
|
const [providers, setProviders] = React.useState([]);
|
|
@@ -13525,7 +13508,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13525
13508
|
);
|
|
13526
13509
|
}, [providers]);
|
|
13527
13510
|
const filteredProviders = React.useMemo(() => {
|
|
13528
|
-
const searchTerm =
|
|
13511
|
+
const searchTerm = isSearchingProvider ? providerSearch : "";
|
|
13529
13512
|
let filtered = providers;
|
|
13530
13513
|
if (searchTerm) {
|
|
13531
13514
|
filtered = providers.filter(
|
|
@@ -13548,18 +13531,18 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13548
13531
|
}
|
|
13549
13532
|
return a.name.localeCompare(b.name);
|
|
13550
13533
|
});
|
|
13551
|
-
}, [providers, providerSearch,
|
|
13534
|
+
}, [providers, providerSearch, isSearchingProvider]);
|
|
13552
13535
|
const filteredModels = React.useMemo(() => {
|
|
13553
13536
|
let filtered = allModels;
|
|
13554
13537
|
if (currentModelProvider) {
|
|
13555
13538
|
filtered = filtered.filter((m) => m.provider === currentModelProvider);
|
|
13556
13539
|
}
|
|
13557
|
-
if (
|
|
13540
|
+
if (isSearchingModel && modelSearch) {
|
|
13558
13541
|
filtered = filtered.filter((m) => m.model.toLowerCase().includes(modelSearch.toLowerCase()));
|
|
13559
13542
|
}
|
|
13560
13543
|
filtered.sort((a, b) => a.model.localeCompare(b.model));
|
|
13561
13544
|
return filtered;
|
|
13562
|
-
}, [allModels, modelSearch, currentModelProvider,
|
|
13545
|
+
}, [allModels, modelSearch, currentModelProvider, isSearchingModel]);
|
|
13563
13546
|
const [infoMsg, setInfoMsg] = React.useState("");
|
|
13564
13547
|
const handleModelSelect = async (modelId) => {
|
|
13565
13548
|
setSelectedModel(modelId);
|
|
@@ -13585,7 +13568,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13585
13568
|
const handleProviderSelect = async (provider) => {
|
|
13586
13569
|
setSelectedProvider(provider.id);
|
|
13587
13570
|
setProviderSearch("");
|
|
13588
|
-
|
|
13571
|
+
setIsSearchingProvider(false);
|
|
13589
13572
|
setShowProviderSuggestions(false);
|
|
13590
13573
|
setHighlightedProviderIndex(-1);
|
|
13591
13574
|
if (provider.id !== currentModelProvider) {
|
|
@@ -13602,10 +13585,12 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13602
13585
|
const { registerResetFn } = useModelReset();
|
|
13603
13586
|
React.useEffect(() => {
|
|
13604
13587
|
const resetIfIncomplete = () => {
|
|
13588
|
+
if (modelInputRef.current === document.activeElement || providerInputRef.current === document.activeElement || showProviderSuggestions || showModelSuggestions) {
|
|
13589
|
+
return;
|
|
13590
|
+
}
|
|
13605
13591
|
const providerChanged = currentModelProvider && currentModelProvider !== defaultProvider;
|
|
13606
13592
|
const modelEmpty = !selectedModel || selectedModel === "";
|
|
13607
13593
|
if (providerChanged && modelEmpty) {
|
|
13608
|
-
console.log("Incomplete model selection detected, reverting to defaults");
|
|
13609
13594
|
setSelectedProvider(defaultProvider);
|
|
13610
13595
|
setSelectedModel(defaultModel);
|
|
13611
13596
|
if (defaultProvider && defaultModel) {
|
|
@@ -13622,7 +13607,16 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13622
13607
|
return () => {
|
|
13623
13608
|
registerResetFn(null);
|
|
13624
13609
|
};
|
|
13625
|
-
}, [
|
|
13610
|
+
}, [
|
|
13611
|
+
registerResetFn,
|
|
13612
|
+
currentModelProvider,
|
|
13613
|
+
selectedModel,
|
|
13614
|
+
defaultProvider,
|
|
13615
|
+
defaultModel,
|
|
13616
|
+
updateModel,
|
|
13617
|
+
showProviderSuggestions,
|
|
13618
|
+
showModelSuggestions
|
|
13619
|
+
]);
|
|
13626
13620
|
if (providersLoading) {
|
|
13627
13621
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13628
13622
|
/* @__PURE__ */ jsxRuntime.jsx(Spinner, {}),
|
|
@@ -13630,7 +13624,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13630
13624
|
] });
|
|
13631
13625
|
}
|
|
13632
13626
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13633
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13627
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col xl:flex-row items-stretch xl:items-center gap-2 w-full", children: [
|
|
13634
13628
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13635
13629
|
Popover,
|
|
13636
13630
|
{
|
|
@@ -13639,12 +13633,12 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13639
13633
|
setShowProviderSuggestions(open);
|
|
13640
13634
|
if (!open) {
|
|
13641
13635
|
setProviderSearch("");
|
|
13642
|
-
|
|
13636
|
+
setIsSearchingProvider(false);
|
|
13643
13637
|
}
|
|
13644
13638
|
},
|
|
13645
13639
|
children: [
|
|
13646
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-
|
|
13647
|
-
!
|
|
13640
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full xl:w-2/5", children: [
|
|
13641
|
+
!isSearchingProvider && currentModelProvider && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13648
13642
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none z-10", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
13649
13643
|
/* @__PURE__ */ jsxRuntime.jsx(ProviderLogo, { providerId: currentModelProvider, size: 16 }),
|
|
13650
13644
|
(() => {
|
|
@@ -13683,15 +13677,15 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13683
13677
|
{
|
|
13684
13678
|
spellCheck: "false",
|
|
13685
13679
|
ref: providerInputRef,
|
|
13686
|
-
className: `w-full ${!
|
|
13680
|
+
className: `w-full ${!isSearchingProvider && currentModelProvider ? "pl-8 pr-8" : ""}`,
|
|
13687
13681
|
type: "text",
|
|
13688
|
-
value:
|
|
13682
|
+
value: isSearchingProvider ? providerSearch : providers.find((p) => p.id === cleanProviderId(currentModelProvider))?.name || currentModelProvider || "",
|
|
13689
13683
|
onKeyDown: (e) => {
|
|
13690
13684
|
const filteredProviders2 = providers.filter(
|
|
13691
13685
|
(provider) => provider.name.toLowerCase().includes(providerSearch.toLowerCase()) || provider.id.toLowerCase().includes(providerSearch.toLowerCase())
|
|
13692
13686
|
);
|
|
13693
|
-
if (!
|
|
13694
|
-
|
|
13687
|
+
if (!isSearchingProvider && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
|
|
13688
|
+
setIsSearchingProvider(true);
|
|
13695
13689
|
setProviderSearch("");
|
|
13696
13690
|
setHighlightedProviderIndex(0);
|
|
13697
13691
|
} else if (showProviderSuggestions) {
|
|
@@ -13727,7 +13721,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13727
13721
|
handleProviderSelect(provider);
|
|
13728
13722
|
} else {
|
|
13729
13723
|
setShowProviderSuggestions(false);
|
|
13730
|
-
|
|
13724
|
+
setIsSearchingProvider(false);
|
|
13731
13725
|
setProviderSearch("");
|
|
13732
13726
|
setHighlightedProviderIndex(-1);
|
|
13733
13727
|
}
|
|
@@ -13735,7 +13729,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13735
13729
|
break;
|
|
13736
13730
|
case "Escape":
|
|
13737
13731
|
e.preventDefault();
|
|
13738
|
-
|
|
13732
|
+
setIsSearchingProvider(false);
|
|
13739
13733
|
setProviderSearch("");
|
|
13740
13734
|
setHighlightedProviderIndex(-1);
|
|
13741
13735
|
setShowProviderSuggestions(false);
|
|
@@ -13757,7 +13751,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13757
13751
|
}
|
|
13758
13752
|
},
|
|
13759
13753
|
onChange: (e) => {
|
|
13760
|
-
|
|
13754
|
+
setIsSearchingProvider(true);
|
|
13761
13755
|
setProviderSearch(e.target.value);
|
|
13762
13756
|
setHighlightedProviderIndex(0);
|
|
13763
13757
|
},
|
|
@@ -13777,7 +13771,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13777
13771
|
PopoverContent,
|
|
13778
13772
|
{
|
|
13779
13773
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
13780
|
-
className: "flex flex-col gap-
|
|
13774
|
+
className: "flex flex-col gap-0.5 w-[var(--radix-popover-trigger-width)] max-h-[300px] overflow-y-auto p-2",
|
|
13781
13775
|
children: filteredProviders.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-500 p-2", children: "No providers found" }) : filteredProviders.map((provider, index) => {
|
|
13782
13776
|
const isSelected = provider.id === currentModelProvider;
|
|
13783
13777
|
const isHighlighted = index === highlightedProviderIndex;
|
|
@@ -13785,7 +13779,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13785
13779
|
"div",
|
|
13786
13780
|
{
|
|
13787
13781
|
"data-provider-highlighted": isHighlighted,
|
|
13788
|
-
className: `flex items-center gap-2 cursor-pointer hover:bg-surface5
|
|
13782
|
+
className: `flex items-center gap-2 cursor-pointer hover:bg-surface5 px-3 py-4 rounded ${isHighlighted ? "outline outline-2 outline-blue-500" : ""} ${isSelected ? "bg-surface5" : ""}`,
|
|
13789
13783
|
onClick: () => handleProviderSelect(provider),
|
|
13790
13784
|
children: [
|
|
13791
13785
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
@@ -13798,10 +13792,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13798
13792
|
}
|
|
13799
13793
|
)
|
|
13800
13794
|
] }),
|
|
13801
|
-
/* @__PURE__ */ jsxRuntime.
|
|
13802
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium", children: provider.name }),
|
|
13803
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500", children: provider.id })
|
|
13804
|
-
] }),
|
|
13795
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium", children: provider.name }) }),
|
|
13805
13796
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13806
13797
|
lucideReact.Info,
|
|
13807
13798
|
{
|
|
@@ -13830,7 +13821,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13830
13821
|
setShowModelSuggestions(open);
|
|
13831
13822
|
if (!open) {
|
|
13832
13823
|
setModelSearch("");
|
|
13833
|
-
|
|
13824
|
+
setIsSearchingModel(false);
|
|
13834
13825
|
}
|
|
13835
13826
|
},
|
|
13836
13827
|
children: [
|
|
@@ -13839,13 +13830,13 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13839
13830
|
{
|
|
13840
13831
|
spellCheck: "false",
|
|
13841
13832
|
ref: modelInputRef,
|
|
13842
|
-
className: "
|
|
13833
|
+
className: "w-full xl:w-3/5",
|
|
13843
13834
|
type: "text",
|
|
13844
13835
|
value: modelSearch || selectedModel,
|
|
13845
13836
|
onChange: (e) => {
|
|
13846
13837
|
setSelectedModel(e.target.value);
|
|
13847
13838
|
setModelSearch(e.target.value);
|
|
13848
|
-
|
|
13839
|
+
setIsSearchingModel(true);
|
|
13849
13840
|
setHighlightedModelIndex(0);
|
|
13850
13841
|
},
|
|
13851
13842
|
onClick: (e) => {
|
|
@@ -13894,7 +13885,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13894
13885
|
if (highlightedModelIndex >= 0 && highlightedModelIndex < filteredModels.length) {
|
|
13895
13886
|
const model = filteredModels[highlightedModelIndex];
|
|
13896
13887
|
setModelSearch("");
|
|
13897
|
-
|
|
13888
|
+
setIsSearchingModel(false);
|
|
13898
13889
|
setShowModelSuggestions(false);
|
|
13899
13890
|
handleModelSelect(model.model);
|
|
13900
13891
|
setTimeout(() => {
|
|
@@ -13908,7 +13899,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13908
13899
|
}, 100);
|
|
13909
13900
|
} else if (selectedModel && selectedModel.trim()) {
|
|
13910
13901
|
setModelSearch("");
|
|
13911
|
-
|
|
13902
|
+
setIsSearchingModel(false);
|
|
13912
13903
|
setShowModelSuggestions(false);
|
|
13913
13904
|
handleModelSelect(selectedModel.trim());
|
|
13914
13905
|
setTimeout(() => {
|
|
@@ -13937,7 +13928,7 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13937
13928
|
allModels.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13938
13929
|
PopoverContent,
|
|
13939
13930
|
{
|
|
13940
|
-
className: "flex flex-col gap-
|
|
13931
|
+
className: "flex flex-col gap-0 w-[var(--radix-popover-trigger-width)] max-h-[calc(var(--radix-popover-content-available-height)-50px)] overflow-y-auto p-2",
|
|
13941
13932
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
13942
13933
|
children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin mx-auto" }) }) : filteredModels.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No models found" }) : filteredModels.map((model, index) => {
|
|
13943
13934
|
const isHighlighted = index === highlightedModelIndex;
|
|
@@ -13946,11 +13937,11 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13946
13937
|
"div",
|
|
13947
13938
|
{
|
|
13948
13939
|
"data-model-highlighted": isHighlighted,
|
|
13949
|
-
className: `flex items-center gap-2 px-
|
|
13940
|
+
className: `flex items-center gap-2 px-4 py-3 cursor-pointer rounded hover:bg-surface5 ${isHighlighted ? "outline outline-2 outline-blue-500" : ""} ${isSelected ? "bg-surface5" : ""}`,
|
|
13950
13941
|
onMouseDown: (e) => {
|
|
13951
13942
|
e.preventDefault();
|
|
13952
13943
|
setModelSearch("");
|
|
13953
|
-
|
|
13944
|
+
setIsSearchingModel(false);
|
|
13954
13945
|
handleModelSelect(model.model);
|
|
13955
13946
|
modelInputRef.current?.blur();
|
|
13956
13947
|
setTimeout(() => {
|
|
@@ -13979,17 +13970,18 @@ const AgentMetadataModelSwitcher = ({
|
|
|
13979
13970
|
(() => {
|
|
13980
13971
|
const currentProvider = providers.find((p) => p.id === currentModelProvider);
|
|
13981
13972
|
if (currentProvider && !currentProvider.connected) {
|
|
13982
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
13983
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13984
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13973
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-2 p-2", children: /* @__PURE__ */ jsxRuntime.jsxs(Alert, { variant: "warning", children: [
|
|
13974
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertTitle, { as: "h5", children: "Provider not connected" }),
|
|
13975
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AlertDescription, { as: "p", children: [
|
|
13976
|
+
"Set the",
|
|
13977
|
+
" ",
|
|
13978
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { className: "px-1 py-0.5 bg-yellow-100 dark:bg-yellow-900/50 rounded", children: Array.isArray(currentProvider.envVar) ? currentProvider.envVar.join(", ") : currentProvider.envVar }),
|
|
13979
|
+
" ",
|
|
13980
|
+
"environment",
|
|
13981
|
+
" ",
|
|
13982
|
+
Array.isArray(currentProvider.envVar) && currentProvider.envVar.length > 1 ? "variables" : "variable",
|
|
13983
|
+
" ",
|
|
13984
|
+
"to use this provider."
|
|
13993
13985
|
] })
|
|
13994
13986
|
] }) });
|
|
13995
13987
|
}
|
|
@@ -14165,7 +14157,24 @@ const AgentMetadata = ({
|
|
|
14165
14157
|
link: "https://mastra.ai/en/docs/agents/agent-memory",
|
|
14166
14158
|
title: "Agent Memory documentation"
|
|
14167
14159
|
},
|
|
14168
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(MemoryIcon, {}), variant:
|
|
14160
|
+
children: hasMemoryEnabled ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(MemoryIcon, {}), variant: "success", className: "font-medium", children: "On" }) : /* @__PURE__ */ jsxRuntime.jsxs(Alert, { variant: "warning", children: [
|
|
14161
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertTitle, { as: "h5", children: "Memory not enabled" }),
|
|
14162
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AlertDescription, { as: "p", children: [
|
|
14163
|
+
"Thread messages will not be stored. To activate memory, see the",
|
|
14164
|
+
" ",
|
|
14165
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14166
|
+
"a",
|
|
14167
|
+
{
|
|
14168
|
+
href: "https://mastra.ai/en/docs/agents/agent-memory",
|
|
14169
|
+
target: "_blank",
|
|
14170
|
+
rel: "noopener noreferrer",
|
|
14171
|
+
className: "underline",
|
|
14172
|
+
children: "documentation"
|
|
14173
|
+
}
|
|
14174
|
+
),
|
|
14175
|
+
"."
|
|
14176
|
+
] })
|
|
14177
|
+
] })
|
|
14169
14178
|
}
|
|
14170
14179
|
),
|
|
14171
14180
|
networkAgents.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14270,7 +14279,7 @@ const ThreadLink = ({ children, as: Component = "a", href, className, prefetch,
|
|
|
14270
14279
|
href,
|
|
14271
14280
|
prefetch,
|
|
14272
14281
|
to,
|
|
14273
|
-
className: clsx("text-ui-sm flex h-full w-full flex-col justify-center font-medium", className),
|
|
14282
|
+
className: clsx("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer", className),
|
|
14274
14283
|
children
|
|
14275
14284
|
}
|
|
14276
14285
|
);
|
|
@@ -14283,7 +14292,7 @@ const ThreadItem = ({ children, isActive }) => {
|
|
|
14283
14292
|
"li",
|
|
14284
14293
|
{
|
|
14285
14294
|
className: clsx(
|
|
14286
|
-
"border-b-sm border-border1 hover:bg-surface3 group flex h-[54px] items-center justify-between gap-2
|
|
14295
|
+
"border-b-sm border-border1 hover:bg-surface3 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",
|
|
14287
14296
|
isActive && "bg-surface4"
|
|
14288
14297
|
),
|
|
14289
14298
|
children
|
|
@@ -14374,7 +14383,6 @@ const ChatThreads = ({ threads, isLoading, threadId, onDelete, resourceId, resou
|
|
|
14374
14383
|
if (isLoading) {
|
|
14375
14384
|
return /* @__PURE__ */ jsxRuntime.jsx(ChatThreadSkeleton, {});
|
|
14376
14385
|
}
|
|
14377
|
-
const reverseThreads = [...threads].reverse();
|
|
14378
14386
|
const newThreadLink = resourceType === "agent" ? paths.agentNewThreadLink(resourceId) : paths.networkNewThreadLink(resourceId);
|
|
14379
14387
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-y-auto h-full w-full", children: [
|
|
14380
14388
|
/* @__PURE__ */ jsxRuntime.jsx(Threads, { children: /* @__PURE__ */ jsxRuntime.jsxs(ThreadList, { children: [
|
|
@@ -14382,8 +14390,8 @@ const ChatThreads = ({ threads, isLoading, threadId, onDelete, resourceId, resou
|
|
|
14382
14390
|
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "bg-surface4 rounded-lg", size: "lg", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}) }),
|
|
14383
14391
|
"New Chat"
|
|
14384
14392
|
] }) }) }),
|
|
14385
|
-
|
|
14386
|
-
|
|
14393
|
+
threads.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon3 py-3 px-5 max-w-[12rem]", children: "Your conversations will appear here once you start chatting!" }),
|
|
14394
|
+
threads.map((thread) => {
|
|
14387
14395
|
const isActive = thread.id === threadId;
|
|
14388
14396
|
const threadLink = resourceType === "agent" ? paths.agentThreadLink(resourceId, thread.id) : paths.networkThreadLink(resourceId, thread.id);
|
|
14389
14397
|
return /* @__PURE__ */ jsxRuntime.jsxs(ThreadItem, { isActive, children: [
|
|
@@ -14440,7 +14448,7 @@ function ThreadTitle({ title }) {
|
|
|
14440
14448
|
if (isDefaultThreadName(title)) {
|
|
14441
14449
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Chat from" });
|
|
14442
14450
|
}
|
|
14443
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate max-w-[14rem]", children: title });
|
|
14451
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate max-w-[14rem] text-muted-foreground", children: title });
|
|
14444
14452
|
}
|
|
14445
14453
|
const formatDay = (date) => {
|
|
14446
14454
|
const options = {
|
|
@@ -14454,1063 +14462,6 @@ const formatDay = (date) => {
|
|
|
14454
14462
|
return new Date(date).toLocaleString("en-us", options).replace(",", " at");
|
|
14455
14463
|
};
|
|
14456
14464
|
|
|
14457
|
-
const defaultModelSettings = {
|
|
14458
|
-
maxRetries: 2,
|
|
14459
|
-
maxSteps: 5,
|
|
14460
|
-
temperature: 0.5,
|
|
14461
|
-
topP: 1
|
|
14462
|
-
};
|
|
14463
|
-
const NetworkContext = React.createContext({});
|
|
14464
|
-
function NetworkProvider({ children }) {
|
|
14465
|
-
const [modelSettings, setModelSettings] = React.useState(defaultModelSettings);
|
|
14466
|
-
const [chatWithLoop, setChatWithLoop] = React.useState(false);
|
|
14467
|
-
const [maxIterations, setMaxIterations] = React.useState(void 0);
|
|
14468
|
-
const resetModelSettings = () => {
|
|
14469
|
-
setModelSettings(defaultModelSettings);
|
|
14470
|
-
setChatWithLoop(false);
|
|
14471
|
-
setMaxIterations(void 0);
|
|
14472
|
-
};
|
|
14473
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14474
|
-
NetworkContext.Provider,
|
|
14475
|
-
{
|
|
14476
|
-
value: {
|
|
14477
|
-
modelSettings,
|
|
14478
|
-
setModelSettings,
|
|
14479
|
-
resetModelSettings,
|
|
14480
|
-
chatWithLoop,
|
|
14481
|
-
setChatWithLoop,
|
|
14482
|
-
maxIterations,
|
|
14483
|
-
setMaxIterations
|
|
14484
|
-
},
|
|
14485
|
-
children
|
|
14486
|
-
}
|
|
14487
|
-
);
|
|
14488
|
-
}
|
|
14489
|
-
|
|
14490
|
-
const VNextNetworkChatContext = React.createContext(void 0);
|
|
14491
|
-
const VNextNetworkChatProvider = ({ children }) => {
|
|
14492
|
-
const [state, setState] = React.useState({});
|
|
14493
|
-
const { chatWithLoop } = React.useContext(NetworkContext);
|
|
14494
|
-
const handleStep = (uuid, record) => {
|
|
14495
|
-
const addFinishStep = chatWithLoop && record.type === "step-finish" && record.payload?.id === "final-step" || record.type === "error";
|
|
14496
|
-
let id = record?.type === "finish" ? "finish" : record.type === "start" ? "start" : record.payload?.id;
|
|
14497
|
-
if (id?.includes("mapping_")) return;
|
|
14498
|
-
setState((prevState) => {
|
|
14499
|
-
const current = prevState[uuid];
|
|
14500
|
-
if (record.type === "error") {
|
|
14501
|
-
id = current?.executionSteps?.[current?.executionSteps.length - 1];
|
|
14502
|
-
}
|
|
14503
|
-
const currentMetadata = current?.steps?.[id]?.metadata;
|
|
14504
|
-
let startTime = currentMetadata?.startTime;
|
|
14505
|
-
let endTime = currentMetadata?.endTime;
|
|
14506
|
-
if (record.type === "step-start") {
|
|
14507
|
-
startTime = Date.now();
|
|
14508
|
-
}
|
|
14509
|
-
if (record.type === "step-finish" || record.type === "error") {
|
|
14510
|
-
endTime = Date.now();
|
|
14511
|
-
}
|
|
14512
|
-
return {
|
|
14513
|
-
...prevState,
|
|
14514
|
-
[uuid]: {
|
|
14515
|
-
...current,
|
|
14516
|
-
runId: current?.runId || record?.payload?.runId,
|
|
14517
|
-
executionSteps: current?.steps?.[id] ? [...current?.executionSteps, ...addFinishStep ? ["finish"] : []] : [...current?.executionSteps || [], id],
|
|
14518
|
-
steps: {
|
|
14519
|
-
...current?.steps,
|
|
14520
|
-
[id]: {
|
|
14521
|
-
...current?.steps?.[id] || {},
|
|
14522
|
-
[record.type]: record.payload || record?.error,
|
|
14523
|
-
metadata: {
|
|
14524
|
-
startTime,
|
|
14525
|
-
endTime
|
|
14526
|
-
}
|
|
14527
|
-
}
|
|
14528
|
-
}
|
|
14529
|
-
}
|
|
14530
|
-
};
|
|
14531
|
-
});
|
|
14532
|
-
};
|
|
14533
|
-
return /* @__PURE__ */ jsxRuntime.jsx(VNextNetworkChatContext.Provider, { value: { state, handleStep, setState }, children });
|
|
14534
|
-
};
|
|
14535
|
-
const useVNextNetworkChat = () => {
|
|
14536
|
-
const context = React.useContext(VNextNetworkChatContext);
|
|
14537
|
-
if (context === void 0) {
|
|
14538
|
-
throw new Error("useVNextNetworkChat must be used within a VNextNetworkChatProvider");
|
|
14539
|
-
}
|
|
14540
|
-
return context;
|
|
14541
|
-
};
|
|
14542
|
-
|
|
14543
|
-
const LabelMappings = {
|
|
14544
|
-
"Agent-Network-Outer-Workflow.routing-step": "Decision making process",
|
|
14545
|
-
"routing-step": "Decision making process",
|
|
14546
|
-
"agent-step": "Agent execution",
|
|
14547
|
-
"Agent-Network-Outer-Workflow.agent-step": "Agent execution",
|
|
14548
|
-
"workflow-step": "Workflow execution",
|
|
14549
|
-
"Agent-Network-Outer-Workflow.workflow-step": "Workflow execution",
|
|
14550
|
-
toolStep: "Tool execution",
|
|
14551
|
-
"Agent-Network-Outer-Workflow.toolStep": "Tool execution",
|
|
14552
|
-
"final-step": "Task completed"
|
|
14553
|
-
};
|
|
14554
|
-
const StepDropdown = () => {
|
|
14555
|
-
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
14556
|
-
const { state } = useVNextNetworkChat();
|
|
14557
|
-
const message = react.useMessage();
|
|
14558
|
-
const id = message?.metadata?.custom?.id;
|
|
14559
|
-
if (!id) return /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Something is wrong" });
|
|
14560
|
-
const currentState = state[id];
|
|
14561
|
-
const latestStepId = currentState.executionSteps ? currentState.executionSteps?.[currentState.executionSteps.length - 1] : "";
|
|
14562
|
-
const hasFinished = latestStepId === "finish";
|
|
14563
|
-
const failed = Object.values(currentState?.steps || {}).some(
|
|
14564
|
-
(step) => step?.["error"] || step?.["step-result"]?.status === "failed"
|
|
14565
|
-
);
|
|
14566
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 mb-2", children: [
|
|
14567
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Button$1, { onClick: () => setIsExpanded(!isExpanded), children: [
|
|
14568
|
-
hasFinished ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: failed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14569
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }) }),
|
|
14570
|
-
"Failed"
|
|
14571
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14572
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }) }),
|
|
14573
|
-
"Done"
|
|
14574
|
-
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14575
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { className: "animate-spin" }) }),
|
|
14576
|
-
"Thinking..."
|
|
14577
|
-
] }),
|
|
14578
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "ml-2", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: clsx("transition-transform -rotate-90", isExpanded && "rotate-0") }) })
|
|
14579
|
-
] }),
|
|
14580
|
-
isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(Steps, { id }) : null
|
|
14581
|
-
] });
|
|
14582
|
-
};
|
|
14583
|
-
const Steps = ({ id }) => {
|
|
14584
|
-
const { state } = useVNextNetworkChat();
|
|
14585
|
-
const currentState = state[id];
|
|
14586
|
-
return /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "flex flex-col gap-px rounded-lg overflow-hidden", children: currentState.executionSteps?.filter((stepId) => stepId !== "start").map((stepId, index) => /* @__PURE__ */ jsxRuntime.jsx(StepEntry, { stepId, step: currentState.steps[stepId] || {}, runId: currentState.runId }, index)) });
|
|
14587
|
-
};
|
|
14588
|
-
const StepEntry = ({ stepId, step, runId }) => {
|
|
14589
|
-
const [expanded, setExpanded] = React.useState(false);
|
|
14590
|
-
let stepResult = step["step-result"];
|
|
14591
|
-
const stepError = step["error"];
|
|
14592
|
-
if (stepId === "workflow-step" || stepId === "Agent-Network-Outer-Workflow.workflow-step") {
|
|
14593
|
-
const parsedResult = JSON.parse(stepResult?.output?.result ?? "{}") ?? {};
|
|
14594
|
-
if (!parsedResult?.runResult && stepResult?.status === "success") {
|
|
14595
|
-
stepResult = {
|
|
14596
|
-
...stepResult,
|
|
14597
|
-
status: "failed",
|
|
14598
|
-
error: "Something went wrong"
|
|
14599
|
-
};
|
|
14600
|
-
}
|
|
14601
|
-
}
|
|
14602
|
-
if (stepError) {
|
|
14603
|
-
stepResult = {
|
|
14604
|
-
...stepResult,
|
|
14605
|
-
status: "failed",
|
|
14606
|
-
error: stepError?.data?.error?.message
|
|
14607
|
-
};
|
|
14608
|
-
}
|
|
14609
|
-
if (stepId === "finish") {
|
|
14610
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 py-2 px-3 text-icon6 flex items-center gap-4 justify-between", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: "Process completed" }) });
|
|
14611
|
-
}
|
|
14612
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
14613
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14614
|
-
"button",
|
|
14615
|
-
{
|
|
14616
|
-
className: "bg-surface4 py-2 px-3 text-icon6 flex items-center gap-4 justify-between w-full text-left",
|
|
14617
|
-
onClick: () => setExpanded((s) => !s),
|
|
14618
|
-
children: [
|
|
14619
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
14620
|
-
/* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { status: stepResult ? stepResult?.status : "loading" }),
|
|
14621
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: LabelMappings[stepId] || stepId })
|
|
14622
|
-
] }),
|
|
14623
|
-
step.metadata?.startTime && /* @__PURE__ */ jsxRuntime.jsx(StepClock, { step })
|
|
14624
|
-
]
|
|
14625
|
-
}
|
|
14626
|
-
),
|
|
14627
|
-
(stepId === "routing-step" || stepId === "Agent-Network-Outer-Workflow.routing-step") && expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface1 p-3 space-y-4", children: [
|
|
14628
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14629
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Selection reason:" }),
|
|
14630
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.selectionReason || "N/A" })
|
|
14631
|
-
] }),
|
|
14632
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14633
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Resource ID" }),
|
|
14634
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.resourceId || "N/A" })
|
|
14635
|
-
] }),
|
|
14636
|
-
stepResult?.error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14637
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
14638
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.error || "N/A" })
|
|
14639
|
-
] }) : null
|
|
14640
|
-
] }),
|
|
14641
|
-
(stepId === "agent-step" || stepId === "Agent-Network-Outer-Workflow.agent-step") && (stepError || stepResult?.error) && expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface1 p-3 space-y-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14642
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
14643
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepError?.message || stepError?.data?.error?.message || stepResult?.error || "N/A" })
|
|
14644
|
-
] }) }),
|
|
14645
|
-
(stepId === "toolStep" || stepId === "Agent-Network-Outer-Workflow.toolStep") && (stepError || stepResult?.error) && expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface1 p-3 space-y-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14646
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
14647
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepError?.message || stepError?.data?.error?.message || stepResult?.error || "N/A" })
|
|
14648
|
-
] }) }),
|
|
14649
|
-
stepId === "final-step" && expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface1 p-3 space-y-4", children: [
|
|
14650
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Task:" }),
|
|
14652
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.task || "N/A" })
|
|
14653
|
-
] }),
|
|
14654
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14655
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Number of iterations:" }),
|
|
14656
|
-
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.iteration || "N/A" })
|
|
14657
|
-
] })
|
|
14658
|
-
] }),
|
|
14659
|
-
(stepId === "workflow-step" || stepId === "Agent-Network-Outer-Workflow.workflow-step") && stepResult?.output?.resourceId ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
14660
|
-
WorkflowStepResultDialog,
|
|
14661
|
-
{
|
|
14662
|
-
open: expanded,
|
|
14663
|
-
onOpenChange: setExpanded,
|
|
14664
|
-
workflowId: stepResult?.output?.resourceId,
|
|
14665
|
-
runId
|
|
14666
|
-
}
|
|
14667
|
-
) : null
|
|
14668
|
-
] });
|
|
14669
|
-
};
|
|
14670
|
-
const WorkflowStepResultDialog = ({ open, onOpenChange, workflowId, runId }) => {
|
|
14671
|
-
const { data: runs } = useWorkflowRuns(workflowId);
|
|
14672
|
-
const { data: workflow, isLoading } = useWorkflow(workflowId);
|
|
14673
|
-
const run = runs?.runs.find((run2) => run2.runId === runId);
|
|
14674
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: "h-[90vh] w-[90%] max-w-[unset]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 h-full", children: [
|
|
14675
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Workflow details" }),
|
|
14676
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowRunProvider, { snapshot: typeof run?.snapshot === "object" ? run.snapshot : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraph, { workflowId, workflow, isLoading }) })
|
|
14677
|
-
] }) }) }) });
|
|
14678
|
-
};
|
|
14679
|
-
const StatusIcon = ({ status }) => {
|
|
14680
|
-
if (status === "failed") {
|
|
14681
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }) });
|
|
14682
|
-
}
|
|
14683
|
-
if (status === "success") {
|
|
14684
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }) });
|
|
14685
|
-
}
|
|
14686
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { className: "animate-spin" }) });
|
|
14687
|
-
};
|
|
14688
|
-
const StepClock = ({ step }) => {
|
|
14689
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { children: /* @__PURE__ */ jsxRuntime.jsx(Clock, { startedAt: step.metadata.startTime, endedAt: step.metadata?.endTime }) });
|
|
14690
|
-
};
|
|
14691
|
-
|
|
14692
|
-
const NextAssistantMessage = ({
|
|
14693
|
-
ToolFallback: ToolFallbackCustom
|
|
14694
|
-
}) => {
|
|
14695
|
-
const data = react.useMessage();
|
|
14696
|
-
const isSolelyToolCall = data.content.length === 1 && data.content[0].type === "tool-call";
|
|
14697
|
-
const content = data.content[0];
|
|
14698
|
-
if (!content) {
|
|
14699
|
-
return null;
|
|
14700
|
-
}
|
|
14701
|
-
const textContent = content.text;
|
|
14702
|
-
if (textContent === "start") {
|
|
14703
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StepDropdown, {});
|
|
14704
|
-
}
|
|
14705
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.MessagePrimitive.Root, { className: "max-w-full", children: [
|
|
14706
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14707
|
-
react.MessagePrimitive.Parts,
|
|
14708
|
-
{
|
|
14709
|
-
components: {
|
|
14710
|
-
Text: MarkdownText,
|
|
14711
|
-
tools: { Fallback: ToolFallbackCustom || ToolFallback }
|
|
14712
|
-
}
|
|
14713
|
-
}
|
|
14714
|
-
) }),
|
|
14715
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar, {}) })
|
|
14716
|
-
] });
|
|
14717
|
-
};
|
|
14718
|
-
const AssistantActionBar = () => {
|
|
14719
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14720
|
-
react.ActionBarPrimitive.Root,
|
|
14721
|
-
{
|
|
14722
|
-
hideWhenRunning: true,
|
|
14723
|
-
autohide: "always",
|
|
14724
|
-
autohideFloat: "single-branch",
|
|
14725
|
-
className: "flex gap-1 items-center transition-all",
|
|
14726
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipIconButton, { tooltip: "Copy", className: "bg-transparent text-icon3 hover:text-icon6", children: [
|
|
14727
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.If, { copied: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) }),
|
|
14728
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.If, { copied: false, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
|
|
14729
|
-
] }) })
|
|
14730
|
-
}
|
|
14731
|
-
);
|
|
14732
|
-
};
|
|
14733
|
-
|
|
14734
|
-
const NetworkThread = ({ ToolFallback, networkName, hasMemory }) => {
|
|
14735
|
-
const areaRef = React.useRef(null);
|
|
14736
|
-
useAutoscroll(areaRef, { enabled: true });
|
|
14737
|
-
const WrappedAssistantMessage = (props) => {
|
|
14738
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NextAssistantMessage, { ...props, ToolFallback });
|
|
14739
|
-
};
|
|
14740
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper, { children: [
|
|
14741
|
-
/* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
14742
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14743
|
-
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { networkName }),
|
|
14744
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14745
|
-
react.ThreadPrimitive.Messages,
|
|
14746
|
-
{
|
|
14747
|
-
components: {
|
|
14748
|
-
UserMessage,
|
|
14749
|
-
EditComposer,
|
|
14750
|
-
AssistantMessage: WrappedAssistantMessage
|
|
14751
|
-
}
|
|
14752
|
-
}
|
|
14753
|
-
)
|
|
14754
|
-
] }),
|
|
14755
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
14756
|
-
] }),
|
|
14757
|
-
/* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory })
|
|
14758
|
-
] });
|
|
14759
|
-
};
|
|
14760
|
-
const ThreadWrapper = ({ children }) => {
|
|
14761
|
-
const hasAttachments = useHasAttachments();
|
|
14762
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14763
|
-
react.ThreadPrimitive.Root,
|
|
14764
|
-
{
|
|
14765
|
-
className: clsx(
|
|
14766
|
-
"max-w-[568px] w-full mx-auto px-4",
|
|
14767
|
-
hasAttachments ? "h-[calc(100%-208px)]" : "h-[calc(100%-112px)]"
|
|
14768
|
-
),
|
|
14769
|
-
children
|
|
14770
|
-
}
|
|
14771
|
-
);
|
|
14772
|
-
};
|
|
14773
|
-
const ThreadWelcome = ({ networkName }) => {
|
|
14774
|
-
const safeNetworkName = networkName ?? "";
|
|
14775
|
-
const words = safeNetworkName.split(" ") ?? [];
|
|
14776
|
-
let initials = "A";
|
|
14777
|
-
if (words.length === 2) {
|
|
14778
|
-
initials = `${words[0][0]}${words[1][0]}`;
|
|
14779
|
-
} else if (safeNetworkName.length > 0) {
|
|
14780
|
-
initials = `${safeNetworkName[0]}`;
|
|
14781
|
-
} else {
|
|
14782
|
-
initials = "A";
|
|
14783
|
-
}
|
|
14784
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
|
|
14785
|
-
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: initials }) }),
|
|
14786
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
14787
|
-
] }) });
|
|
14788
|
-
};
|
|
14789
|
-
const Composer = ({ hasMemory }) => {
|
|
14790
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14791
|
-
/* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
|
|
14792
|
-
/* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}),
|
|
14793
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
|
|
14794
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14795
|
-
"textarea",
|
|
14796
|
-
{
|
|
14797
|
-
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent resize-none",
|
|
14798
|
-
autoFocus: true,
|
|
14799
|
-
placeholder: "Enter your message...",
|
|
14800
|
-
name: "",
|
|
14801
|
-
id: ""
|
|
14802
|
-
}
|
|
14803
|
-
) }),
|
|
14804
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
14805
|
-
/* @__PURE__ */ jsxRuntime.jsx(SpeechInput, {}),
|
|
14806
|
-
/* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {})
|
|
14807
|
-
] })
|
|
14808
|
-
] })
|
|
14809
|
-
] }),
|
|
14810
|
-
!hasMemory && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
|
|
14811
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, {}) }),
|
|
14812
|
-
"Memory is not enabled. The conversation will not be persisted."
|
|
14813
|
-
] })
|
|
14814
|
-
] });
|
|
14815
|
-
};
|
|
14816
|
-
const SpeechInput = () => {
|
|
14817
|
-
const composerRuntime = react.useComposerRuntime();
|
|
14818
|
-
const { start, stop, isListening, transcript } = useSpeechRecognition({});
|
|
14819
|
-
React.useEffect(() => {
|
|
14820
|
-
if (!transcript) return;
|
|
14821
|
-
composerRuntime.setText(transcript);
|
|
14822
|
-
}, [composerRuntime, transcript]);
|
|
14823
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14824
|
-
TooltipIconButton,
|
|
14825
|
-
{
|
|
14826
|
-
type: "button",
|
|
14827
|
-
tooltip: isListening ? "Stop dictation" : "Start dictation",
|
|
14828
|
-
variant: "ghost",
|
|
14829
|
-
className: "rounded-full",
|
|
14830
|
-
onClick: () => isListening ? stop() : start(),
|
|
14831
|
-
children: isListening ? /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
14832
|
-
}
|
|
14833
|
-
);
|
|
14834
|
-
};
|
|
14835
|
-
const ComposerAction = () => {
|
|
14836
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14837
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.AddAttachment, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Add attachment", variant: "ghost", className: "rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" }) }) }),
|
|
14838
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14839
|
-
TooltipIconButton,
|
|
14840
|
-
{
|
|
14841
|
-
tooltip: "Send",
|
|
14842
|
-
variant: "default",
|
|
14843
|
-
className: "rounded-full border-sm border-[#363636] bg-[#292929]",
|
|
14844
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
14845
|
-
}
|
|
14846
|
-
) }) }),
|
|
14847
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) }) }) })
|
|
14848
|
-
] });
|
|
14849
|
-
};
|
|
14850
|
-
const EditComposer = () => {
|
|
14851
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
|
|
14852
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, {}),
|
|
14853
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14854
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", children: "Cancel" }) }),
|
|
14855
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { children: "Send" }) })
|
|
14856
|
-
] })
|
|
14857
|
-
] });
|
|
14858
|
-
};
|
|
14859
|
-
const CircleStopIcon = () => {
|
|
14860
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
14861
|
-
};
|
|
14862
|
-
|
|
14863
|
-
const MessagesContext = React.createContext({
|
|
14864
|
-
messages: [],
|
|
14865
|
-
setMessages: () => {
|
|
14866
|
-
},
|
|
14867
|
-
appendToLastMessage: () => {
|
|
14868
|
-
}
|
|
14869
|
-
});
|
|
14870
|
-
const MessagesProvider = ({ children }) => {
|
|
14871
|
-
const [messages, setMessages] = React.useState([]);
|
|
14872
|
-
const appendToLastMessage = (partial) => setMessages((msgs) => {
|
|
14873
|
-
const lastMsg = msgs[msgs.length - 1];
|
|
14874
|
-
const content = typeof lastMsg.content === "string" ? lastMsg.content : (lastMsg.content?.[0]).text;
|
|
14875
|
-
return [
|
|
14876
|
-
...msgs.slice(0, -1),
|
|
14877
|
-
{
|
|
14878
|
-
...lastMsg,
|
|
14879
|
-
content: [{ type: "text", text: content + partial }]
|
|
14880
|
-
}
|
|
14881
|
-
];
|
|
14882
|
-
});
|
|
14883
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MessagesContext.Provider, { value: { messages, setMessages, appendToLastMessage }, children });
|
|
14884
|
-
};
|
|
14885
|
-
const useMessages = () => React.useContext(MessagesContext);
|
|
14886
|
-
|
|
14887
|
-
const convertMessage = (message) => {
|
|
14888
|
-
return message;
|
|
14889
|
-
};
|
|
14890
|
-
function VNextMastraNetworkRuntimeProvider({
|
|
14891
|
-
children,
|
|
14892
|
-
networkId,
|
|
14893
|
-
memory,
|
|
14894
|
-
threadId,
|
|
14895
|
-
refreshThreadList,
|
|
14896
|
-
initialMessages,
|
|
14897
|
-
runtimeContext: runtimeContext$1
|
|
14898
|
-
}) {
|
|
14899
|
-
const runIdRef = React.useRef(void 0);
|
|
14900
|
-
const [isRunning, setIsRunning] = React.useState(false);
|
|
14901
|
-
const { messages, setMessages, appendToLastMessage } = useMessages();
|
|
14902
|
-
const [currentThreadId, setCurrentThreadId] = React.useState(threadId);
|
|
14903
|
-
const { handleStep, state, setState } = useVNextNetworkChat();
|
|
14904
|
-
const { chatWithLoop, maxIterations } = React.useContext(NetworkContext);
|
|
14905
|
-
const id = runIdRef.current;
|
|
14906
|
-
const currentState = id ? state[id] : void 0;
|
|
14907
|
-
const runtimeContextInstance = new runtimeContext.RuntimeContext();
|
|
14908
|
-
Object.entries(runtimeContext$1 ?? {}).forEach(([key, value]) => {
|
|
14909
|
-
runtimeContextInstance.set(key, value);
|
|
14910
|
-
});
|
|
14911
|
-
React.useEffect(() => {
|
|
14912
|
-
if (!currentState) return;
|
|
14913
|
-
const hasFinished = Boolean(currentState?.steps?.["finish"]);
|
|
14914
|
-
if (!hasFinished) return;
|
|
14915
|
-
const workflowStep = currentState?.steps?.["workflow-step"];
|
|
14916
|
-
const toolStep = currentState?.steps?.["toolStep"];
|
|
14917
|
-
if (!workflowStep && !toolStep) return;
|
|
14918
|
-
const workflowStepResult = workflowStep?.["step-result"];
|
|
14919
|
-
const toolStepResult = toolStep?.["step-result"];
|
|
14920
|
-
if (!workflowStepResult && !toolStepResult) return;
|
|
14921
|
-
const workflowStepResultOutput = workflowStepResult?.output;
|
|
14922
|
-
const toolStepResultOutput = toolStepResult?.output;
|
|
14923
|
-
if (!workflowStepResultOutput && !toolStepResultOutput) return;
|
|
14924
|
-
const run = async () => {
|
|
14925
|
-
const parsedResult = workflowStepResult ? JSON.parse(workflowStepResult?.output?.result ?? "{}") ?? {} : { runResult: toolStepResultOutput?.result ?? {} };
|
|
14926
|
-
if (parsedResult?.runResult) {
|
|
14927
|
-
const runResult = parsedResult?.runResult ?? {};
|
|
14928
|
-
const formatted = await formatJSON(JSON.stringify(runResult));
|
|
14929
|
-
setMessages((msgs) => [
|
|
14930
|
-
...msgs,
|
|
14931
|
-
{ role: "assistant", content: [{ type: "text", text: `\`\`\`json
|
|
14932
|
-
${formatted}\`\`\`` }] }
|
|
14933
|
-
]);
|
|
14934
|
-
}
|
|
14935
|
-
};
|
|
14936
|
-
run();
|
|
14937
|
-
}, [currentState]);
|
|
14938
|
-
React.useEffect(() => {
|
|
14939
|
-
if (messages.length === 0 || currentThreadId !== threadId) {
|
|
14940
|
-
const run = async (result, messageId) => {
|
|
14941
|
-
const formatted = await formatJSON(result);
|
|
14942
|
-
const finalResponse = `\`\`\`json
|
|
14943
|
-
${formatted}\`\`\``;
|
|
14944
|
-
setMessages((currentConversation) => {
|
|
14945
|
-
return currentConversation.map((message) => {
|
|
14946
|
-
if (message.metadata?.custom?.id === messageId) {
|
|
14947
|
-
return { ...message, content: [{ type: "text", text: finalResponse }] };
|
|
14948
|
-
}
|
|
14949
|
-
return message;
|
|
14950
|
-
});
|
|
14951
|
-
});
|
|
14952
|
-
};
|
|
14953
|
-
if (initialMessages && threadId && memory) {
|
|
14954
|
-
let userMessage = "";
|
|
14955
|
-
let iteration = 1;
|
|
14956
|
-
const formattedMessages = [];
|
|
14957
|
-
let assistantStep = freshAssistantStep();
|
|
14958
|
-
for (let i = 0; i < initialMessages.length; i++) {
|
|
14959
|
-
const message = initialMessages[i];
|
|
14960
|
-
if (message.role === "user") {
|
|
14961
|
-
assistantStep = freshAssistantStep();
|
|
14962
|
-
userMessage = message.content;
|
|
14963
|
-
formattedMessages.push({
|
|
14964
|
-
role: "user",
|
|
14965
|
-
message
|
|
14966
|
-
});
|
|
14967
|
-
continue;
|
|
14968
|
-
}
|
|
14969
|
-
if (message.role === "assistant") {
|
|
14970
|
-
const responseArray = message.parts ?? [];
|
|
14971
|
-
let hasRoutingDecision = false;
|
|
14972
|
-
let hasTaskCompleteDecision = false;
|
|
14973
|
-
let directText = "";
|
|
14974
|
-
let jsonStringResponse = "";
|
|
14975
|
-
for (const part of responseArray) {
|
|
14976
|
-
if (part.type === "text" && part.text) {
|
|
14977
|
-
const parsed = safeParse(part.text);
|
|
14978
|
-
if (parsed?.resourceId && parsed?.resourceType) {
|
|
14979
|
-
hasRoutingDecision = true;
|
|
14980
|
-
assistantStep.routingDecision = parsed;
|
|
14981
|
-
}
|
|
14982
|
-
if (typeof parsed?.isComplete === "boolean") {
|
|
14983
|
-
hasTaskCompleteDecision = true;
|
|
14984
|
-
assistantStep.taskCompleteDecision = parsed;
|
|
14985
|
-
if (parsed?.isComplete) {
|
|
14986
|
-
assistantStep.finalResponse = parsed.finalResult;
|
|
14987
|
-
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
14988
|
-
assistantStep = freshAssistantStep();
|
|
14989
|
-
}
|
|
14990
|
-
}
|
|
14991
|
-
if (!parsed || !parsed.resourceId && !parsed.runResult && typeof parsed.isComplete !== "boolean") {
|
|
14992
|
-
directText = part.text;
|
|
14993
|
-
}
|
|
14994
|
-
if (parsed && !parsed.resourceId && typeof parsed.isComplete !== "boolean") {
|
|
14995
|
-
jsonStringResponse = part.text;
|
|
14996
|
-
}
|
|
14997
|
-
}
|
|
14998
|
-
}
|
|
14999
|
-
if (!hasRoutingDecision && !hasTaskCompleteDecision) {
|
|
15000
|
-
assistantStep.finalResponse = directText || jsonStringResponse;
|
|
15001
|
-
if (assistantStep.routingDecision || assistantStep.finalResponse) {
|
|
15002
|
-
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
15003
|
-
assistantStep = freshAssistantStep();
|
|
15004
|
-
}
|
|
15005
|
-
}
|
|
15006
|
-
}
|
|
15007
|
-
if (i === initialMessages.length - 1 && (assistantStep.routingDecision || assistantStep.finalResponse)) {
|
|
15008
|
-
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
15009
|
-
}
|
|
15010
|
-
}
|
|
15011
|
-
for (const formattedMessage of formattedMessages) {
|
|
15012
|
-
const { role, message } = formattedMessage;
|
|
15013
|
-
if (role === "user") {
|
|
15014
|
-
iteration = 1;
|
|
15015
|
-
userMessage = message.content;
|
|
15016
|
-
setMessages((currentConversation) => {
|
|
15017
|
-
if (currentConversation.some((m) => m.id === message.id)) {
|
|
15018
|
-
return currentConversation;
|
|
15019
|
-
}
|
|
15020
|
-
return [...currentConversation, message];
|
|
15021
|
-
});
|
|
15022
|
-
}
|
|
15023
|
-
if (role === "assistant") {
|
|
15024
|
-
const { id: id2, formattedMessageId, finalStepId, routingDecision, finalResponse, taskCompleteDecision } = message;
|
|
15025
|
-
let resourceStepId = "";
|
|
15026
|
-
if (routingDecision?.resourceType === "agent") resourceStepId = "agent-step";
|
|
15027
|
-
if (routingDecision?.resourceType === "tool") resourceStepId = "toolStep";
|
|
15028
|
-
if (routingDecision?.resourceType === "workflow") resourceStepId = "workflow-step";
|
|
15029
|
-
let runId = "";
|
|
15030
|
-
let runResult = {};
|
|
15031
|
-
let finalStep = null;
|
|
15032
|
-
let finalResult = "";
|
|
15033
|
-
if (resourceStepId === "workflow-step" || resourceStepId === "toolStep") {
|
|
15034
|
-
const parsedResult = JSON.parse(finalResponse ?? "{}") ?? {};
|
|
15035
|
-
runResult = resourceStepId === "workflow-step" ? parsedResult?.runResult ?? {} : parsedResult ?? {};
|
|
15036
|
-
runId = parsedResult?.runId ?? "";
|
|
15037
|
-
}
|
|
15038
|
-
if (taskCompleteDecision?.isComplete) {
|
|
15039
|
-
finalStep = {
|
|
15040
|
-
executionSteps: ["start", "routing-step", "final-step", "finish"],
|
|
15041
|
-
runId: "",
|
|
15042
|
-
steps: {
|
|
15043
|
-
start: {},
|
|
15044
|
-
"routing-step": {
|
|
15045
|
-
"step-result": {
|
|
15046
|
-
output: {
|
|
15047
|
-
selectionReason: taskCompleteDecision?.completionReason ?? ""
|
|
15048
|
-
},
|
|
15049
|
-
status: "success"
|
|
15050
|
-
}
|
|
15051
|
-
},
|
|
15052
|
-
"final-step": {
|
|
15053
|
-
"step-result": {
|
|
15054
|
-
output: {
|
|
15055
|
-
iteration,
|
|
15056
|
-
task: userMessage
|
|
15057
|
-
},
|
|
15058
|
-
status: "success"
|
|
15059
|
-
}
|
|
15060
|
-
},
|
|
15061
|
-
finish: {}
|
|
15062
|
-
}
|
|
15063
|
-
};
|
|
15064
|
-
finalResult = taskCompleteDecision?.finalResult;
|
|
15065
|
-
}
|
|
15066
|
-
const routingStepFailed = resourceStepId === "workflow-step" || resourceStepId === "toolStep" ? Object.keys(runResult).length === 0 : !finalResponse;
|
|
15067
|
-
setState((currentState2) => {
|
|
15068
|
-
return {
|
|
15069
|
-
...currentState2,
|
|
15070
|
-
...finalStep ? { [finalStepId]: finalStep } : {
|
|
15071
|
-
[id2]: {
|
|
15072
|
-
executionSteps: ["start", "routing-step", resourceStepId, "finish"],
|
|
15073
|
-
runId,
|
|
15074
|
-
steps: {
|
|
15075
|
-
start: {},
|
|
15076
|
-
"routing-step": {
|
|
15077
|
-
"step-result": {
|
|
15078
|
-
output: routingDecision,
|
|
15079
|
-
status: routingDecision ? "success" : "failed",
|
|
15080
|
-
...routingDecision ? {} : { error: "Something went wrong" }
|
|
15081
|
-
}
|
|
15082
|
-
},
|
|
15083
|
-
[resourceStepId]: {
|
|
15084
|
-
"step-result": {
|
|
15085
|
-
output: {
|
|
15086
|
-
resourceId: routingDecision?.resourceId,
|
|
15087
|
-
result: finalResponse ?? ""
|
|
15088
|
-
},
|
|
15089
|
-
status: routingStepFailed ? "failed" : "success",
|
|
15090
|
-
...routingStepFailed ? { error: "Something went wrong" } : {}
|
|
15091
|
-
}
|
|
15092
|
-
},
|
|
15093
|
-
finish: {}
|
|
15094
|
-
}
|
|
15095
|
-
}
|
|
15096
|
-
}
|
|
15097
|
-
};
|
|
15098
|
-
});
|
|
15099
|
-
setMessages((currentConversation) => {
|
|
15100
|
-
const assistantRoutingMessageExist = currentConversation.some(
|
|
15101
|
-
(message2) => message2.metadata?.custom?.id === id2
|
|
15102
|
-
);
|
|
15103
|
-
const assistantResponseMessageExist = currentConversation.some(
|
|
15104
|
-
(message2) => message2.metadata?.custom?.id === formattedMessageId
|
|
15105
|
-
);
|
|
15106
|
-
return [
|
|
15107
|
-
...currentConversation,
|
|
15108
|
-
...finalResult ? [
|
|
15109
|
-
{
|
|
15110
|
-
role: "assistant",
|
|
15111
|
-
metadata: {
|
|
15112
|
-
custom: {
|
|
15113
|
-
id: finalStepId
|
|
15114
|
-
}
|
|
15115
|
-
},
|
|
15116
|
-
content: [
|
|
15117
|
-
{
|
|
15118
|
-
type: "text",
|
|
15119
|
-
text: "start"
|
|
15120
|
-
}
|
|
15121
|
-
]
|
|
15122
|
-
},
|
|
15123
|
-
{
|
|
15124
|
-
role: "assistant",
|
|
15125
|
-
content: [{ type: "text", text: finalResult }]
|
|
15126
|
-
}
|
|
15127
|
-
] : [
|
|
15128
|
-
...assistantRoutingMessageExist ? [] : [
|
|
15129
|
-
{
|
|
15130
|
-
role: "assistant",
|
|
15131
|
-
metadata: {
|
|
15132
|
-
custom: {
|
|
15133
|
-
id: id2
|
|
15134
|
-
}
|
|
15135
|
-
},
|
|
15136
|
-
content: [
|
|
15137
|
-
{
|
|
15138
|
-
type: "text",
|
|
15139
|
-
text: "start"
|
|
15140
|
-
}
|
|
15141
|
-
]
|
|
15142
|
-
}
|
|
15143
|
-
],
|
|
15144
|
-
...assistantResponseMessageExist ? [] : [
|
|
15145
|
-
{
|
|
15146
|
-
role: "assistant",
|
|
15147
|
-
content: [
|
|
15148
|
-
{
|
|
15149
|
-
type: "text",
|
|
15150
|
-
text: resourceStepId === "workflow-step" || resourceStepId === "toolStep" ? "" : finalResponse
|
|
15151
|
-
}
|
|
15152
|
-
],
|
|
15153
|
-
metadata: {
|
|
15154
|
-
custom: {
|
|
15155
|
-
id: formattedMessageId
|
|
15156
|
-
}
|
|
15157
|
-
}
|
|
15158
|
-
}
|
|
15159
|
-
]
|
|
15160
|
-
]
|
|
15161
|
-
];
|
|
15162
|
-
});
|
|
15163
|
-
if ((resourceStepId === "workflow-step" || resourceStepId === "toolStep") && !routingStepFailed) {
|
|
15164
|
-
run(JSON.stringify(runResult), formattedMessageId);
|
|
15165
|
-
}
|
|
15166
|
-
iteration++;
|
|
15167
|
-
}
|
|
15168
|
-
}
|
|
15169
|
-
setCurrentThreadId(threadId);
|
|
15170
|
-
}
|
|
15171
|
-
}
|
|
15172
|
-
}, [initialMessages, threadId, memory, messages]);
|
|
15173
|
-
const mastra = react$3.useMastraClient();
|
|
15174
|
-
const network = mastra.getVNextNetwork(networkId);
|
|
15175
|
-
const onNew = async (message) => {
|
|
15176
|
-
runIdRef.current = void 0;
|
|
15177
|
-
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
15178
|
-
const input = message.content[0].text;
|
|
15179
|
-
setMessages((currentConversation) => [...currentConversation, { role: "user", content: input }]);
|
|
15180
|
-
setIsRunning(true);
|
|
15181
|
-
try {
|
|
15182
|
-
if (chatWithLoop) {
|
|
15183
|
-
const run = async (result, messageId) => {
|
|
15184
|
-
const formatted = await formatJSON(result);
|
|
15185
|
-
const finalResponse = `\`\`\`json
|
|
15186
|
-
${formatted}\`\`\``;
|
|
15187
|
-
setMessages((currentConversation) => {
|
|
15188
|
-
return currentConversation.map((message2) => {
|
|
15189
|
-
if (message2.metadata?.custom?.id === messageId) {
|
|
15190
|
-
return { ...message2, content: [{ type: "text", text: finalResponse }] };
|
|
15191
|
-
}
|
|
15192
|
-
return message2;
|
|
15193
|
-
});
|
|
15194
|
-
});
|
|
15195
|
-
};
|
|
15196
|
-
let isAgentNetworkOuterWorkflowCompleted = false;
|
|
15197
|
-
await network.loopStream(
|
|
15198
|
-
{
|
|
15199
|
-
message: input,
|
|
15200
|
-
threadId,
|
|
15201
|
-
resourceId: networkId,
|
|
15202
|
-
maxIterations,
|
|
15203
|
-
runtimeContext: runtimeContextInstance
|
|
15204
|
-
},
|
|
15205
|
-
async (record) => {
|
|
15206
|
-
if (record.type === "step-start" && record.payload?.id === "Agent-Network-Outer-Workflow") {
|
|
15207
|
-
const id2 = uuid.v4();
|
|
15208
|
-
runIdRef.current = id2;
|
|
15209
|
-
setMessages((currentConversation) => {
|
|
15210
|
-
return [
|
|
15211
|
-
...currentConversation,
|
|
15212
|
-
{
|
|
15213
|
-
role: "assistant",
|
|
15214
|
-
metadata: {
|
|
15215
|
-
custom: {
|
|
15216
|
-
id: id2
|
|
15217
|
-
}
|
|
15218
|
-
},
|
|
15219
|
-
content: [
|
|
15220
|
-
{
|
|
15221
|
-
type: "text",
|
|
15222
|
-
text: "start"
|
|
15223
|
-
}
|
|
15224
|
-
]
|
|
15225
|
-
}
|
|
15226
|
-
];
|
|
15227
|
-
});
|
|
15228
|
-
} else if (runIdRef.current) {
|
|
15229
|
-
if (record.type === "tool-call-delta") {
|
|
15230
|
-
appendToLastMessage(record.argsTextDelta);
|
|
15231
|
-
} else if (record.type === "tool-call-streaming-start") {
|
|
15232
|
-
setMessages((msgs) => [...msgs, { role: "assistant", content: [{ type: "text", text: "" }] }]);
|
|
15233
|
-
setTimeout(() => {
|
|
15234
|
-
refreshThreadList?.();
|
|
15235
|
-
}, 500);
|
|
15236
|
-
return;
|
|
15237
|
-
} else {
|
|
15238
|
-
if (record.type === "step-finish" && record.payload?.id === "Agent-Network-Outer-Workflow") {
|
|
15239
|
-
if (!isAgentNetworkOuterWorkflowCompleted) {
|
|
15240
|
-
handleStep(runIdRef.current, { ...record, type: "finish" });
|
|
15241
|
-
runIdRef.current = void 0;
|
|
15242
|
-
}
|
|
15243
|
-
} else if (record.type === "step-result" && (record.payload?.id === "Agent-Network-Outer-Workflow.workflow-step" || record.payload?.id === "Agent-Network-Outer-Workflow.toolStep")) {
|
|
15244
|
-
handleStep(runIdRef.current, record);
|
|
15245
|
-
const result = record?.payload?.output?.result;
|
|
15246
|
-
const parsedResult = typeof result === "string" ? JSON.parse(record?.payload?.output?.result ?? "{}") ?? {} : { runResult: result };
|
|
15247
|
-
const runResult = parsedResult?.runResult ?? {};
|
|
15248
|
-
const formatedOutputId = uuid.v4();
|
|
15249
|
-
setMessages((msgs) => [
|
|
15250
|
-
...msgs,
|
|
15251
|
-
{
|
|
15252
|
-
role: "assistant",
|
|
15253
|
-
content: [
|
|
15254
|
-
{
|
|
15255
|
-
type: "text",
|
|
15256
|
-
text: ""
|
|
15257
|
-
}
|
|
15258
|
-
],
|
|
15259
|
-
metadata: {
|
|
15260
|
-
custom: {
|
|
15261
|
-
id: formatedOutputId
|
|
15262
|
-
}
|
|
15263
|
-
}
|
|
15264
|
-
}
|
|
15265
|
-
]);
|
|
15266
|
-
run(JSON.stringify(runResult), formatedOutputId);
|
|
15267
|
-
} else if (record.payload?.id === "Agent-Network-Outer-Workflow" || record.payload?.id === "finish-step") {
|
|
15268
|
-
if (record.type === "step-result" && record.payload?.id === "Agent-Network-Outer-Workflow") {
|
|
15269
|
-
isAgentNetworkOuterWorkflowCompleted = record?.payload?.output?.isComplete;
|
|
15270
|
-
}
|
|
15271
|
-
} else {
|
|
15272
|
-
handleStep(runIdRef.current, record);
|
|
15273
|
-
}
|
|
15274
|
-
}
|
|
15275
|
-
}
|
|
15276
|
-
if (record.type === "step-result" && record.payload?.id === "final-step") {
|
|
15277
|
-
setMessages((msgs) => [
|
|
15278
|
-
...msgs,
|
|
15279
|
-
{ role: "assistant", content: [{ type: "text", text: record.payload?.output?.result }] }
|
|
15280
|
-
]);
|
|
15281
|
-
}
|
|
15282
|
-
if (record.type === "step-finish" && record.payload?.id === "final-step") {
|
|
15283
|
-
runIdRef.current = void 0;
|
|
15284
|
-
}
|
|
15285
|
-
if (record.type === "start" || record.type === "step-start" || record.type === "finish") {
|
|
15286
|
-
setTimeout(() => {
|
|
15287
|
-
refreshThreadList?.();
|
|
15288
|
-
}, 500);
|
|
15289
|
-
}
|
|
15290
|
-
}
|
|
15291
|
-
);
|
|
15292
|
-
} else {
|
|
15293
|
-
await network.stream(
|
|
15294
|
-
{
|
|
15295
|
-
message: input,
|
|
15296
|
-
threadId,
|
|
15297
|
-
resourceId: networkId,
|
|
15298
|
-
runtimeContext: runtimeContextInstance
|
|
15299
|
-
},
|
|
15300
|
-
(record) => {
|
|
15301
|
-
if (runIdRef.current) {
|
|
15302
|
-
if (record.type === "tool-call-delta") {
|
|
15303
|
-
appendToLastMessage(record.argsTextDelta);
|
|
15304
|
-
} else if (record.type === "tool-call-streaming-start") {
|
|
15305
|
-
setMessages((msgs) => [...msgs, { role: "assistant", content: [{ type: "text", text: "" }] }]);
|
|
15306
|
-
return;
|
|
15307
|
-
} else {
|
|
15308
|
-
handleStep(runIdRef.current, record);
|
|
15309
|
-
}
|
|
15310
|
-
} else if (record.type === "start") {
|
|
15311
|
-
const id2 = uuid.v4();
|
|
15312
|
-
runIdRef.current = id2;
|
|
15313
|
-
setMessages((currentConversation) => {
|
|
15314
|
-
return [
|
|
15315
|
-
...currentConversation,
|
|
15316
|
-
{
|
|
15317
|
-
role: "assistant",
|
|
15318
|
-
metadata: {
|
|
15319
|
-
custom: {
|
|
15320
|
-
id: id2
|
|
15321
|
-
}
|
|
15322
|
-
},
|
|
15323
|
-
content: [
|
|
15324
|
-
{
|
|
15325
|
-
type: "text",
|
|
15326
|
-
text: "start"
|
|
15327
|
-
}
|
|
15328
|
-
]
|
|
15329
|
-
}
|
|
15330
|
-
];
|
|
15331
|
-
});
|
|
15332
|
-
}
|
|
15333
|
-
if (record.type === "start" || record.type === "step-start" || record.type === "finish") {
|
|
15334
|
-
setTimeout(() => {
|
|
15335
|
-
refreshThreadList?.();
|
|
15336
|
-
}, 500);
|
|
15337
|
-
}
|
|
15338
|
-
}
|
|
15339
|
-
);
|
|
15340
|
-
}
|
|
15341
|
-
setIsRunning(false);
|
|
15342
|
-
} catch (error) {
|
|
15343
|
-
console.error("Error occurred in VNextMastraNetworkRuntimeProvider", error);
|
|
15344
|
-
setIsRunning(false);
|
|
15345
|
-
}
|
|
15346
|
-
};
|
|
15347
|
-
const runtime = react.useExternalStoreRuntime({
|
|
15348
|
-
isRunning,
|
|
15349
|
-
messages,
|
|
15350
|
-
convertMessage,
|
|
15351
|
-
onNew
|
|
15352
|
-
});
|
|
15353
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.AssistantRuntimeProvider, { runtime, children: [
|
|
15354
|
-
" ",
|
|
15355
|
-
children,
|
|
15356
|
-
" "
|
|
15357
|
-
] });
|
|
15358
|
-
function safeParse(str) {
|
|
15359
|
-
try {
|
|
15360
|
-
return JSON.parse(str);
|
|
15361
|
-
} catch {
|
|
15362
|
-
return void 0;
|
|
15363
|
-
}
|
|
15364
|
-
}
|
|
15365
|
-
function freshAssistantStep() {
|
|
15366
|
-
return {
|
|
15367
|
-
id: uuid.v4(),
|
|
15368
|
-
formattedMessageId: uuid.v4(),
|
|
15369
|
-
finalStepId: uuid.v4(),
|
|
15370
|
-
finalResponse: ""
|
|
15371
|
-
};
|
|
15372
|
-
}
|
|
15373
|
-
}
|
|
15374
|
-
|
|
15375
|
-
const VNextNetworkChat = ({
|
|
15376
|
-
networkId,
|
|
15377
|
-
networkName,
|
|
15378
|
-
threadId,
|
|
15379
|
-
initialMessages,
|
|
15380
|
-
memory,
|
|
15381
|
-
refreshThreadList
|
|
15382
|
-
}) => {
|
|
15383
|
-
const { runtimeContext } = usePlaygroundStore();
|
|
15384
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MessagesProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(VNextNetworkChatProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15385
|
-
VNextMastraNetworkRuntimeProvider,
|
|
15386
|
-
{
|
|
15387
|
-
networkId,
|
|
15388
|
-
initialMessages: initialMessages ?? [],
|
|
15389
|
-
threadId,
|
|
15390
|
-
memory,
|
|
15391
|
-
refreshThreadList,
|
|
15392
|
-
runtimeContext,
|
|
15393
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(NetworkThread, { hasMemory: memory, networkName }) })
|
|
15394
|
-
},
|
|
15395
|
-
threadId
|
|
15396
|
-
) }, threadId) }, threadId);
|
|
15397
|
-
};
|
|
15398
|
-
|
|
15399
|
-
const columns = [
|
|
15400
|
-
{
|
|
15401
|
-
id: "name",
|
|
15402
|
-
header: "Name",
|
|
15403
|
-
cell: ({ row }) => {
|
|
15404
|
-
const { Link } = useLinkComponent();
|
|
15405
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15406
|
-
EntryCell,
|
|
15407
|
-
{
|
|
15408
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}),
|
|
15409
|
-
name: /* @__PURE__ */ jsxRuntime.jsx(Link, { className: "w-full space-y-0", href: `/networks/v-next/${row.original.id}/chat`, children: row.original.name }),
|
|
15410
|
-
description: row.original.instructions
|
|
15411
|
-
}
|
|
15412
|
-
);
|
|
15413
|
-
},
|
|
15414
|
-
meta: {
|
|
15415
|
-
width: "auto"
|
|
15416
|
-
}
|
|
15417
|
-
},
|
|
15418
|
-
{
|
|
15419
|
-
id: "agents",
|
|
15420
|
-
header: "Agents",
|
|
15421
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Users, {}), children: row.original.agentsSize }) })
|
|
15422
|
-
},
|
|
15423
|
-
{
|
|
15424
|
-
id: "workflows",
|
|
15425
|
-
header: "Workflows",
|
|
15426
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, {}), children: row.original.workflowsSize }) })
|
|
15427
|
-
},
|
|
15428
|
-
{
|
|
15429
|
-
id: "tools",
|
|
15430
|
-
header: "Tools",
|
|
15431
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, {}), children: row.original.toolsSize }) })
|
|
15432
|
-
},
|
|
15433
|
-
{
|
|
15434
|
-
id: "model",
|
|
15435
|
-
header: "Routing Models",
|
|
15436
|
-
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 }) })
|
|
15437
|
-
}
|
|
15438
|
-
];
|
|
15439
|
-
|
|
15440
|
-
const NetworkTable = ({ networks, isLoading }) => {
|
|
15441
|
-
const { navigate, paths } = useLinkComponent();
|
|
15442
|
-
const allNetworks = React.useMemo(
|
|
15443
|
-
() => [
|
|
15444
|
-
...networks?.map((network) => ({
|
|
15445
|
-
...network,
|
|
15446
|
-
routingModel: network.routingModel.modelId,
|
|
15447
|
-
agentsSize: network.agents.length,
|
|
15448
|
-
workflowsSize: network.workflows.length,
|
|
15449
|
-
toolsSize: network.tools.length
|
|
15450
|
-
})) ?? []
|
|
15451
|
-
],
|
|
15452
|
-
[networks]
|
|
15453
|
-
);
|
|
15454
|
-
const table = reactTable.useReactTable({
|
|
15455
|
-
data: allNetworks,
|
|
15456
|
-
columns,
|
|
15457
|
-
getCoreRowModel: reactTable.getCoreRowModel()
|
|
15458
|
-
});
|
|
15459
|
-
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(NetworkTableSkeleton, {});
|
|
15460
|
-
const ths = table.getHeaderGroups()[0];
|
|
15461
|
-
const rows = table.getRowModel().rows.concat();
|
|
15462
|
-
if (rows.length === 0) {
|
|
15463
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NetworkTableEmpty, {});
|
|
15464
|
-
}
|
|
15465
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
|
|
15466
|
-
/* @__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)) }),
|
|
15467
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => navigate(paths.networkLink(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)) })
|
|
15468
|
-
] }) });
|
|
15469
|
-
};
|
|
15470
|
-
const NetworkTableEmpty = () => {
|
|
15471
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15472
|
-
EmptyState,
|
|
15473
|
-
{
|
|
15474
|
-
iconSlot: /* @__PURE__ */ jsxRuntime.jsx(AgentNetworkCoinIcon, {}),
|
|
15475
|
-
titleSlot: "Configure Agent Networks",
|
|
15476
|
-
descriptionSlot: "Mastra agent networks are not configured yet. You can find more information in the documentation.",
|
|
15477
|
-
actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15478
|
-
Button$1,
|
|
15479
|
-
{
|
|
15480
|
-
size: "lg",
|
|
15481
|
-
className: "w-full",
|
|
15482
|
-
variant: "light",
|
|
15483
|
-
as: "a",
|
|
15484
|
-
href: "https://mastra.ai/en/reference/networks/agent-network",
|
|
15485
|
-
target: "_blank",
|
|
15486
|
-
children: [
|
|
15487
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.NetworkIcon, {}) }),
|
|
15488
|
-
"Docs"
|
|
15489
|
-
]
|
|
15490
|
-
}
|
|
15491
|
-
)
|
|
15492
|
-
}
|
|
15493
|
-
);
|
|
15494
|
-
};
|
|
15495
|
-
const NetworkTableSkeleton = () => {
|
|
15496
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
|
|
15497
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Thead, { children: [
|
|
15498
|
-
/* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Name" }),
|
|
15499
|
-
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Agents" }),
|
|
15500
|
-
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Workflows" }),
|
|
15501
|
-
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Tools" }),
|
|
15502
|
-
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Routing Models" })
|
|
15503
|
-
] }),
|
|
15504
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs(Row, { children: [
|
|
15505
|
-
/* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15506
|
-
/* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15507
|
-
/* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15508
|
-
/* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
15509
|
-
/* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) })
|
|
15510
|
-
] }, index)) })
|
|
15511
|
-
] });
|
|
15512
|
-
};
|
|
15513
|
-
|
|
15514
14465
|
const themeClasses = {
|
|
15515
14466
|
light: "bg-gray-100 border-gray-300 text-gray-700",
|
|
15516
14467
|
dark: "bg-surface4 border-border1 text-icon6"
|
|
@@ -18858,7 +17809,10 @@ exports.AgentSettingsProvider = AgentSettingsProvider;
|
|
|
18858
17809
|
exports.AgentsTable = AgentsTable;
|
|
18859
17810
|
exports.AgentsTableSkeleton = AgentsTableSkeleton;
|
|
18860
17811
|
exports.AiIcon = AiIcon;
|
|
17812
|
+
exports.Alert = Alert;
|
|
17813
|
+
exports.AlertDescription = AlertDescription;
|
|
18861
17814
|
exports.AlertDialog = AlertDialog;
|
|
17815
|
+
exports.AlertTitle = AlertTitle;
|
|
18862
17816
|
exports.ApiIcon = ApiIcon;
|
|
18863
17817
|
exports.Badge = Badge$1;
|
|
18864
17818
|
exports.BranchIcon = BranchIcon;
|
|
@@ -18934,11 +17888,6 @@ exports.McpServerIcon = McpServerIcon;
|
|
|
18934
17888
|
exports.MemoryIcon = MemoryIcon;
|
|
18935
17889
|
exports.MemorySearch = MemorySearch;
|
|
18936
17890
|
exports.ModelResetProvider = ModelResetProvider;
|
|
18937
|
-
exports.NetworkContext = NetworkContext;
|
|
18938
|
-
exports.NetworkProvider = NetworkProvider;
|
|
18939
|
-
exports.NetworkTable = NetworkTable;
|
|
18940
|
-
exports.NetworkTableEmpty = NetworkTableEmpty;
|
|
18941
|
-
exports.NetworkTableSkeleton = NetworkTableSkeleton;
|
|
18942
17891
|
exports.OpenAIIcon = OpenAIIcon;
|
|
18943
17892
|
exports.PageHeader = PageHeader;
|
|
18944
17893
|
exports.PlaygroundQueryClient = PlaygroundQueryClient;
|
|
@@ -19012,7 +17961,6 @@ exports.TsIcon = TsIcon;
|
|
|
19012
17961
|
exports.Txt = Txt;
|
|
19013
17962
|
exports.TxtCell = TxtCell;
|
|
19014
17963
|
exports.UnitCell = UnitCell;
|
|
19015
|
-
exports.VNextNetworkChat = VNextNetworkChat;
|
|
19016
17964
|
exports.VariablesIcon = VariablesIcon;
|
|
19017
17965
|
exports.WorkflowCoinIcon = WorkflowCoinIcon;
|
|
19018
17966
|
exports.WorkflowGraph = WorkflowGraph;
|