@mastra/playground-ui 7.0.0-beta.14 → 7.0.0-beta.16

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/dist/index.cjs.js +1054 -420
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.es.js +1050 -423
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/src/components/ui/combobox.d.ts +3 -3
  7. package/dist/src/components/ui/containers/MainContent.d.ts +7 -0
  8. package/dist/src/domains/agents/components/agent-combobox.d.ts +1 -3
  9. package/dist/src/domains/agents/components/agent-layout.d.ts +7 -0
  10. package/dist/src/domains/agents/index.d.ts +1 -0
  11. package/dist/src/domains/configuration/components/mastra-version-footer.d.ts +17 -0
  12. package/dist/src/domains/configuration/hooks/use-mastra-packages.d.ts +1 -0
  13. package/dist/src/domains/configuration/hooks/use-package-updates.d.ts +18 -0
  14. package/dist/src/domains/configuration/index.d.ts +3 -0
  15. package/dist/src/domains/mcps/components/mcp-server-combobox.d.ts +1 -3
  16. package/dist/src/domains/observability/components/helpers.d.ts +11 -3
  17. package/dist/src/domains/observability/components/span-dialog.d.ts +2 -1
  18. package/dist/src/domains/observability/components/span-score-list.d.ts +1 -1
  19. package/dist/src/domains/observability/components/span-tabs.d.ts +2 -1
  20. package/dist/src/domains/observability/components/trace-span-usage.d.ts +1 -1
  21. package/dist/src/domains/observability/components/traces-list.d.ts +1 -1
  22. package/dist/src/domains/observability/components/traces-tools.d.ts +10 -1
  23. package/dist/src/domains/observability/context/tracing-settings-context.d.ts +1 -0
  24. package/dist/src/domains/observability/hooks/use-tracing-settings-state.d.ts +1 -0
  25. package/dist/src/domains/scores/components/score-dialog.d.ts +2 -2
  26. package/dist/src/domains/scores/components/scorer-combobox.d.ts +1 -3
  27. package/dist/src/domains/scores/hooks/use-trace-span-scores.d.ts +41 -1
  28. package/dist/src/domains/tools/components/tool-combobox.d.ts +1 -3
  29. package/dist/src/domains/workflows/components/workflow-combobox.d.ts +1 -3
  30. package/dist/src/domains/workflows/components/workflow-layout.d.ts +7 -0
  31. package/dist/src/domains/workflows/context/workflow-run-context.d.ts +3 -1
  32. package/dist/src/domains/workflows/hooks/use-workflows-actions.d.ts +6 -2
  33. package/dist/src/domains/workflows/index.d.ts +1 -0
  34. package/dist/src/domains/workflows/workflow/workflow-default-node.d.ts +2 -1
  35. package/dist/src/domains/workflows/workflow/workflow-nested-node.d.ts +2 -1
  36. package/dist/src/domains/workflows/workflow/workflow-run-options.d.ts +1 -0
  37. package/dist/src/domains/workflows/workflow/workflow-step-action-bar.d.ts +4 -2
  38. package/dist/src/domains/workflows/workflow/workflow-time-travel-form.d.ts +5 -1
  39. package/dist/src/domains/workflows/workflow/workflow-trigger.d.ts +4 -2
  40. package/dist/src/lib/resize/collapsible-panel.d.ts +5 -0
  41. package/dist/src/lib/resize/separator.d.ts +1 -0
  42. package/package.json +14 -11
package/dist/index.cjs.js CHANGED
@@ -73,6 +73,8 @@ const languageData = require('@codemirror/language-data');
73
73
  const codemirrorThemeGithub = require('@uiw/codemirror-theme-github');
74
74
  const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
75
75
  const TabsPrimitive = require('@radix-ui/react-tabs');
76
+ const reactResizablePanels = require('react-resizable-panels');
77
+ const semver = require('semver');
76
78
 
77
79
  function _interopNamespaceDefault(e) {
78
80
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -4491,6 +4493,7 @@ const BadgeWrapper = ({
4491
4493
  };
4492
4494
 
4493
4495
  const Dialog = DialogPrimitive__namespace.Root;
4496
+ const DialogTrigger = DialogPrimitive__namespace.Trigger;
4494
4497
  const DialogPortal = DialogPrimitive__namespace.Portal;
4495
4498
  const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4496
4499
  DialogPrimitive__namespace.Overlay,
@@ -4988,7 +4991,8 @@ function useTracingSettingsState({ entityId, entityType }) {
4988
4991
  return {
4989
4992
  settings,
4990
4993
  setSettings,
4991
- resetAll
4994
+ resetAll,
4995
+ entityType
4992
4996
  };
4993
4997
  }
4994
4998
 
@@ -4997,7 +5001,8 @@ const TracingSettingsContext = React.createContext({
4997
5001
  },
4998
5002
  resetAll: () => {
4999
5003
  },
5000
- settings: void 0
5004
+ settings: void 0,
5005
+ entityType: void 0
5001
5006
  });
5002
5007
  const TracingSettingsProvider = ({ children, entityId, entityType }) => {
5003
5008
  const state = useTracingSettingsState({ entityId, entityType });
@@ -5070,7 +5075,7 @@ const useExecuteWorkflow = () => {
5070
5075
  startAsyncWorkflowRun
5071
5076
  };
5072
5077
  };
5073
- const useStreamWorkflow = () => {
5078
+ const useStreamWorkflow = ({ debugMode }) => {
5074
5079
  const client = react$1.useMastraClient();
5075
5080
  const { settings } = useTracingSettings();
5076
5081
  const [streamResult, setStreamResult] = React.useState({});
@@ -5126,6 +5131,10 @@ const useStreamWorkflow = () => {
5126
5131
  if (value.type === "workflow-finish") {
5127
5132
  const streamStatus = value.payload?.workflowStatus;
5128
5133
  const metadata = value.payload?.metadata;
5134
+ setStreamResult((prev) => ({
5135
+ ...prev,
5136
+ status: streamStatus
5137
+ }));
5129
5138
  if (streamStatus === "failed") {
5130
5139
  throw new Error(metadata?.errorMessage || "Workflow execution failed");
5131
5140
  }
@@ -5136,7 +5145,8 @@ const useStreamWorkflow = () => {
5136
5145
  workflowId,
5137
5146
  runId,
5138
5147
  inputData,
5139
- requestContext: playgroundRequestContext
5148
+ requestContext: playgroundRequestContext,
5149
+ perStep
5140
5150
  }) => {
5141
5151
  if (readerRef.current) {
5142
5152
  readerRef.current.releaseLock();
@@ -5154,7 +5164,8 @@ const useStreamWorkflow = () => {
5154
5164
  inputData,
5155
5165
  requestContext: requestContext$1,
5156
5166
  closeOnSuspend: true,
5157
- tracingOptions: settings?.tracingOptions
5167
+ tracingOptions: settings?.tracingOptions,
5168
+ perStep: perStep ?? debugMode
5158
5169
  });
5159
5170
  if (!stream) {
5160
5171
  return handleStreamError(new Error("No stream returned"), "No stream returned", setIsStreaming);
@@ -5259,7 +5270,8 @@ const useStreamWorkflow = () => {
5259
5270
  runId,
5260
5271
  step,
5261
5272
  resumeData,
5262
- requestContext: playgroundRequestContext
5273
+ requestContext: playgroundRequestContext,
5274
+ perStep
5263
5275
  }) => {
5264
5276
  if (resumeStreamRef.current) {
5265
5277
  resumeStreamRef.current.releaseLock();
@@ -5276,7 +5288,8 @@ const useStreamWorkflow = () => {
5276
5288
  step,
5277
5289
  resumeData,
5278
5290
  requestContext: requestContext$1,
5279
- tracingOptions: settings?.tracingOptions
5291
+ tracingOptions: settings?.tracingOptions,
5292
+ perStep: perStep ?? debugMode
5280
5293
  });
5281
5294
  if (!stream) {
5282
5295
  return handleStreamError(new Error("No stream returned"), "No stream returned", setIsStreaming);
@@ -5322,6 +5335,7 @@ const useStreamWorkflow = () => {
5322
5335
  workflowId,
5323
5336
  requestContext: playgroundRequestContext,
5324
5337
  runId,
5338
+ perStep,
5325
5339
  ...params
5326
5340
  }) => {
5327
5341
  if (timeTravelStreamRef.current) {
@@ -5337,6 +5351,7 @@ const useStreamWorkflow = () => {
5337
5351
  const run = await workflow.createRun({ runId });
5338
5352
  const stream = await run.timeTravelStream({
5339
5353
  ...params,
5354
+ perStep: perStep ?? debugMode,
5340
5355
  requestContext: requestContext$1,
5341
5356
  tracingOptions: settings?.tracingOptions
5342
5357
  });
@@ -5588,6 +5603,7 @@ function WorkflowRunProvider({
5588
5603
  const [payload, setPayload] = React.useState(() => snapshot?.context?.input ?? null);
5589
5604
  const [runId, setRunId] = React.useState(() => initialRunId ?? "");
5590
5605
  const [isRunning, setIsRunning] = React.useState(false);
5606
+ const [debugMode, setDebugMode] = React.useState(false);
5591
5607
  const refetchExecResultInterval = isRunning ? void 0 : ["success", "failed", "canceled", "bailed"].includes(result?.status ?? "") ? void 0 : 5e3;
5592
5608
  const { isLoading: isLoadingRunExecutionResult, data: runExecutionResult } = useWorkflowRunExecutionResult(
5593
5609
  workflowId,
@@ -5617,7 +5633,7 @@ function WorkflowRunProvider({
5617
5633
  closeStreamsAndReset,
5618
5634
  resumeWorkflowStream,
5619
5635
  timeTravelWorkflowStream
5620
- } = useStreamWorkflow();
5636
+ } = useStreamWorkflow({ debugMode });
5621
5637
  const { mutateAsync: cancelWorkflowRun, isPending: isCancellingWorkflowRun } = useCancelWorkflowRun();
5622
5638
  const clearData = () => {
5623
5639
  setResult(null);
@@ -5673,7 +5689,9 @@ function WorkflowRunProvider({
5673
5689
  },
5674
5690
  runSnapshot,
5675
5691
  isLoadingRunExecutionResult,
5676
- withoutTimeTravel
5692
+ withoutTimeTravel,
5693
+ debugMode,
5694
+ setDebugMode
5677
5695
  },
5678
5696
  children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowStepDetailProvider, { children })
5679
5697
  }
@@ -7851,17 +7869,24 @@ const JsonField = ({
7851
7869
  ] })
7852
7870
  ] });
7853
7871
  };
7854
- const WorkflowTimeTravelForm = ({ stepKey, closeModal }) => {
7872
+ const WorkflowTimeTravelForm = ({
7873
+ stepKey,
7874
+ closeModal,
7875
+ isPerStepRun,
7876
+ isContinueRun,
7877
+ buttonText = "Start time travel",
7878
+ inputData
7879
+ }) => {
7855
7880
  const {
7856
7881
  result,
7857
7882
  workflow,
7858
7883
  timeTravelWorkflowStream,
7859
- createWorkflowRun,
7860
7884
  runId: prevRunId,
7861
- workflowId
7885
+ workflowId,
7886
+ setDebugMode
7862
7887
  } = React.useContext(WorkflowRunContext);
7863
7888
  const { requestContext } = usePlaygroundStore();
7864
- const stepResult = result?.steps?.[stepKey];
7889
+ const stepResult = inputData ? { payload: inputData } : result?.steps?.[stepKey];
7865
7890
  const [resumeData, setResumeData] = React.useState(() => "{}");
7866
7891
  const [contextValue, setContextValue] = React.useState(() => "{}");
7867
7892
  const [nestedContextValue, setNestedContextValue] = React.useState(() => "{}");
@@ -7887,17 +7912,20 @@ const WorkflowTimeTravelForm = ({ stepKey, closeModal }) => {
7887
7912
  const parsedResume = resumeData.trim() ? JSON.parse(resumeData) : {};
7888
7913
  const parsedContext = contextValue.trim() ? JSON.parse(contextValue) : {};
7889
7914
  const parsedNestedContext = nestedContextValue.trim() ? JSON.parse(nestedContextValue) : {};
7890
- const run = await createWorkflowRun({ workflowId, prevRunId });
7891
7915
  const payload = {
7892
- runId: run.runId,
7916
+ runId: prevRunId,
7893
7917
  workflowId,
7894
7918
  step: stepKey,
7895
7919
  inputData: data,
7896
7920
  resumeData: Object.keys(parsedResume)?.length > 0 ? parsedResume : void 0,
7897
7921
  context: Object.keys(parsedContext)?.length > 0 ? parsedContext : void 0,
7898
7922
  nestedStepsContext: Object.keys(parsedNestedContext)?.length > 0 ? parsedNestedContext : void 0,
7899
- requestContext
7923
+ requestContext,
7924
+ ...isContinueRun ? { perStep: false } : {}
7900
7925
  };
7926
+ if (isContinueRun) {
7927
+ setDebugMode(false);
7928
+ }
7901
7929
  timeTravelWorkflowStream(payload);
7902
7930
  closeModal();
7903
7931
  } catch (error) {
@@ -7921,47 +7949,27 @@ const WorkflowTimeTravelForm = ({ stepKey, closeModal }) => {
7921
7949
  schema: stepSchema,
7922
7950
  defaultValues: stepResult?.payload,
7923
7951
  isSubmitLoading: isSubmitting,
7924
- submitButtonLabel: "Start time travel",
7952
+ submitButtonLabel: buttonText,
7925
7953
  onSubmit: handleSubmit,
7926
7954
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pb-4", children: [
7927
- /* @__PURE__ */ jsxRuntime.jsx(
7928
- JsonField,
7929
- {
7930
- label: "Resume Data (JSON)",
7931
- value: resumeData,
7932
- onChange: setResumeData,
7933
- helperText: "Provide any resume payloads that should be passed to the step."
7934
- }
7935
- ),
7936
- /* @__PURE__ */ jsxRuntime.jsx(
7937
- JsonField,
7938
- {
7939
- label: "Context (JSON)",
7940
- value: contextValue,
7941
- onChange: setContextValue,
7942
- helperText: "Only include top level steps (no nested workflow steps) that are required in the time travel execution.",
7943
- exampleCode: prettyJson({
7944
- stepId: {
7945
- status: "success",
7946
- payload: {
7947
- value: "test value"
7948
- },
7949
- output: {
7950
- value: "test output"
7951
- }
7952
- }
7953
- })
7954
- }
7955
- ),
7956
- /* @__PURE__ */ jsxRuntime.jsx(
7957
- JsonField,
7958
- {
7959
- label: "Nested Step Context (JSON)",
7960
- value: nestedContextValue,
7961
- onChange: setNestedContextValue,
7962
- helperText: "Includes nested workflow steps that are required in the time travel execution.",
7963
- exampleCode: prettyJson({
7964
- nestedWorkflowId: {
7955
+ isPerStepRun || isContinueRun ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7956
+ /* @__PURE__ */ jsxRuntime.jsx(
7957
+ JsonField,
7958
+ {
7959
+ label: "Resume Data (JSON)",
7960
+ value: resumeData,
7961
+ onChange: setResumeData,
7962
+ helperText: "Provide any resume payloads that should be passed to the step."
7963
+ }
7964
+ ),
7965
+ /* @__PURE__ */ jsxRuntime.jsx(
7966
+ JsonField,
7967
+ {
7968
+ label: "Context (JSON)",
7969
+ value: contextValue,
7970
+ onChange: setContextValue,
7971
+ helperText: "Only include top level steps (no nested workflow steps) that are required in the time travel execution.",
7972
+ exampleCode: prettyJson({
7965
7973
  stepId: {
7966
7974
  status: "success",
7967
7975
  payload: {
@@ -7971,10 +7979,32 @@ const WorkflowTimeTravelForm = ({ stepKey, closeModal }) => {
7971
7979
  value: "test output"
7972
7980
  }
7973
7981
  }
7974
- }
7975
- })
7976
- }
7977
- ),
7982
+ })
7983
+ }
7984
+ ),
7985
+ /* @__PURE__ */ jsxRuntime.jsx(
7986
+ JsonField,
7987
+ {
7988
+ label: "Nested Step Context (JSON)",
7989
+ value: nestedContextValue,
7990
+ onChange: setNestedContextValue,
7991
+ helperText: "Includes nested workflow steps that are required in the time travel execution.",
7992
+ exampleCode: prettyJson({
7993
+ nestedWorkflowId: {
7994
+ stepId: {
7995
+ status: "success",
7996
+ payload: {
7997
+ value: "test value"
7998
+ },
7999
+ output: {
8000
+ value: "test output"
8001
+ }
8002
+ }
8003
+ }
8004
+ })
8005
+ }
8006
+ )
8007
+ ] }),
7978
8008
  formError && /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-accent2", children: formError })
7979
8009
  ] })
7980
8010
  }
@@ -7994,7 +8024,8 @@ const WorkflowStepActionBar = ({
7994
8024
  stepId,
7995
8025
  onShowNestedGraph,
7996
8026
  status,
7997
- stepKey
8027
+ stepKey,
8028
+ stepsFlow
7998
8029
  }) => {
7999
8030
  const [isInputOpen, setIsInputOpen] = React.useState(false);
8000
8031
  const [isOutputOpen, setIsOutputOpen] = React.useState(false);
@@ -8002,11 +8033,53 @@ const WorkflowStepActionBar = ({
8002
8033
  const [isErrorOpen, setIsErrorOpen] = React.useState(false);
8003
8034
  const [isTripwireOpen, setIsTripwireOpen] = React.useState(false);
8004
8035
  const [isTimeTravelOpen, setIsTimeTravelOpen] = React.useState(false);
8005
- const { withoutTimeTravel } = React.useContext(WorkflowRunContext);
8036
+ const [isContinueRunOpen, setIsContinueRunOpen] = React.useState(false);
8037
+ const [isPerStepRunOpen, setIsPerStepRunOpen] = React.useState(false);
8038
+ const {
8039
+ withoutTimeTravel,
8040
+ debugMode,
8041
+ result,
8042
+ runSnapshot,
8043
+ timeTravelWorkflowStream,
8044
+ runId: prevRunId,
8045
+ workflowId,
8046
+ setDebugMode
8047
+ } = React.useContext(WorkflowRunContext);
8006
8048
  const { showMapConfig, stepDetail, closeStepDetail } = useWorkflowStepDetail();
8049
+ const { requestContext } = usePlaygroundStore();
8050
+ const workflowStatus = result?.status ?? runSnapshot?.status;
8007
8051
  const dialogContentClass = "bg-surface2 rounded-lg border-sm border-border1 max-w-4xl w-full px-0";
8008
8052
  const dialogTitleClass = "border-b-sm border-border1 pb-4 px-6";
8009
- const showTimeTravel = !withoutTimeTravel && stepKey && !mapConfig;
8053
+ const showTimeTravel = !withoutTimeTravel && stepKey && !mapConfig && workflowStatus !== "running" && workflowStatus !== "paused";
8054
+ const inDebugMode = stepKey && debugMode && workflowStatus === "paused";
8055
+ const stepPayload = React.useMemo(() => {
8056
+ if (!stepKey || !inDebugMode) return void 0;
8057
+ const previousSteps = stepsFlow?.[stepKey] ?? [];
8058
+ if (previousSteps.length === 0) return void 0;
8059
+ if (previousSteps.length > 1) {
8060
+ return {
8061
+ hasMultiSteps: true,
8062
+ input: previousSteps.reduce(
8063
+ (acc, stepId2) => {
8064
+ if (result?.steps?.[stepId2]?.status === "success") {
8065
+ acc[stepId2] = result?.steps?.[stepId2].output;
8066
+ }
8067
+ return acc;
8068
+ },
8069
+ {}
8070
+ )
8071
+ };
8072
+ }
8073
+ const prevStepId = previousSteps[0];
8074
+ if (result?.steps?.[prevStepId]?.status === "success") {
8075
+ return {
8076
+ hasMultiSteps: false,
8077
+ input: result?.steps?.[prevStepId].output
8078
+ };
8079
+ }
8080
+ return void 0;
8081
+ }, [stepKey, stepsFlow, inDebugMode, result]);
8082
+ const showDebugMode = inDebugMode && stepPayload && !result?.steps[stepKey];
8010
8083
  const isMapConfigOpen = stepDetail?.type === "map-config" && stepDetail?.stepName === stepName;
8011
8084
  const isNestedGraphOpen = stepDetail?.type === "nested-graph" && stepDetail?.stepName === stepName;
8012
8085
  const activeButtonClass = "ring-2 ring-accent1 ring-offset-1 ring-offset-transparent";
@@ -8024,7 +8097,32 @@ const WorkflowStepActionBar = ({
8024
8097
  onShowNestedGraph?.();
8025
8098
  }
8026
8099
  };
8027
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: (input || output || error || tripwire || mapConfig || resumeData || onShowNestedGraph || showTimeTravel) && /* @__PURE__ */ jsxRuntime.jsxs(
8100
+ const handleRunMapStep = (isContinueRun) => {
8101
+ const payload = {
8102
+ runId: prevRunId,
8103
+ workflowId,
8104
+ step: stepKey,
8105
+ inputData: stepPayload?.hasMultiSteps ? void 0 : stepPayload?.input,
8106
+ requestContext,
8107
+ ...isContinueRun ? { perStep: false } : {},
8108
+ ...stepPayload?.hasMultiSteps ? {
8109
+ context: Object.keys(stepPayload.input)?.reduce(
8110
+ (acc, stepId2) => {
8111
+ acc[stepId2] = {
8112
+ output: stepPayload.input[stepId2]
8113
+ };
8114
+ return acc;
8115
+ },
8116
+ {}
8117
+ )
8118
+ } : {}
8119
+ };
8120
+ if (isContinueRun) {
8121
+ setDebugMode(false);
8122
+ }
8123
+ timeTravelWorkflowStream(payload);
8124
+ };
8125
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: (input || output || error || tripwire || mapConfig || resumeData || onShowNestedGraph || showTimeTravel || showDebugMode) && /* @__PURE__ */ jsxRuntime.jsxs(
8028
8126
  "div",
8029
8127
  {
8030
8128
  className: cn(
@@ -8048,6 +8146,66 @@ const WorkflowStepActionBar = ({
8048
8146
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 overflow-scroll max-h-[600px]", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowTimeTravelForm, { stepKey, closeModal: () => setIsTimeTravelOpen(false) }) })
8049
8147
  ] }) })
8050
8148
  ] }),
8149
+ showDebugMode && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8150
+ /* @__PURE__ */ jsxRuntime.jsx(
8151
+ Button$1,
8152
+ {
8153
+ onClick: () => {
8154
+ if (mapConfig) {
8155
+ handleRunMapStep();
8156
+ } else {
8157
+ setIsPerStepRunOpen(true);
8158
+ }
8159
+ },
8160
+ children: "Run step"
8161
+ }
8162
+ ),
8163
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isPerStepRunOpen, onOpenChange: setIsPerStepRunOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8164
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8165
+ "Run step ",
8166
+ stepKey
8167
+ ] }),
8168
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 overflow-scroll max-h-[600px]", children: /* @__PURE__ */ jsxRuntime.jsx(
8169
+ WorkflowTimeTravelForm,
8170
+ {
8171
+ stepKey,
8172
+ closeModal: () => setIsPerStepRunOpen(false),
8173
+ isPerStepRun: true,
8174
+ buttonText: "Run step",
8175
+ inputData: stepPayload?.input
8176
+ }
8177
+ ) })
8178
+ ] }) }),
8179
+ /* @__PURE__ */ jsxRuntime.jsx(
8180
+ Button$1,
8181
+ {
8182
+ onClick: () => {
8183
+ if (mapConfig) {
8184
+ handleRunMapStep(true);
8185
+ } else {
8186
+ setIsContinueRunOpen(true);
8187
+ }
8188
+ },
8189
+ children: "Continue run"
8190
+ }
8191
+ ),
8192
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isContinueRunOpen, onOpenChange: setIsContinueRunOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8193
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8194
+ "Continue run ",
8195
+ stepKey
8196
+ ] }),
8197
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 overflow-scroll max-h-[600px]", children: /* @__PURE__ */ jsxRuntime.jsx(
8198
+ WorkflowTimeTravelForm,
8199
+ {
8200
+ stepKey,
8201
+ closeModal: () => setIsContinueRunOpen(false),
8202
+ isContinueRun: true,
8203
+ buttonText: "Continue run",
8204
+ inputData: stepPayload?.input
8205
+ }
8206
+ ) })
8207
+ ] }) })
8208
+ ] }),
8051
8209
  mapConfig && /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: handleMapConfigClick, className: cn(isMapConfigOpen && activeButtonClass), children: "Map config" }),
8052
8210
  input && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8053
8211
  /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsInputOpen(true), children: "Input" }),
@@ -8280,7 +8438,11 @@ const Clock = ({ startedAt, endedAt }) => {
8280
8438
  ] });
8281
8439
  };
8282
8440
 
8283
- function WorkflowDefaultNode({ data, parentWorkflowName }) {
8441
+ function WorkflowDefaultNode({
8442
+ data,
8443
+ parentWorkflowName,
8444
+ stepsFlow
8445
+ }) {
8284
8446
  const { steps } = useCurrentRun();
8285
8447
  const {
8286
8448
  label,
@@ -8380,7 +8542,8 @@ function WorkflowDefaultNode({ data, parentWorkflowName }) {
8380
8542
  tripwire: isTripwire ? step?.tripwire : void 0,
8381
8543
  mapConfig,
8382
8544
  status: displayStatus,
8383
- stepKey
8545
+ stepKey,
8546
+ stepsFlow
8384
8547
  }
8385
8548
  )
8386
8549
  ]
@@ -8443,36 +8606,13 @@ function WorkflowLoopResultNode({ data }) {
8443
8606
  );
8444
8607
  }
8445
8608
 
8446
- const WorkflowNestedGraphContext = React.createContext(
8447
- {}
8448
- );
8449
- function WorkflowNestedGraphProvider({ children }) {
8450
- const { showNestedGraph: showNestedGraphInPanel, closeStepDetail } = useWorkflowStepDetail();
8451
- const showNestedGraph = ({
8452
- label,
8453
- stepGraph,
8454
- fullStep
8455
- }) => {
8456
- showNestedGraphInPanel({ label, stepGraph, fullStep });
8457
- };
8458
- const closeNestedGraph = () => {
8459
- closeStepDetail();
8460
- };
8461
- return /* @__PURE__ */ jsxRuntime.jsx(
8462
- WorkflowNestedGraphContext.Provider,
8463
- {
8464
- value: {
8465
- showNestedGraph,
8466
- closeNestedGraph
8467
- },
8468
- children
8469
- }
8470
- );
8471
- }
8472
-
8473
- function WorkflowNestedNode({ data, parentWorkflowName }) {
8609
+ function WorkflowNestedNode({
8610
+ data,
8611
+ parentWorkflowName,
8612
+ stepsFlow
8613
+ }) {
8474
8614
  const { steps } = useCurrentRun();
8475
- const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
8615
+ const { showNestedGraph } = useWorkflowStepDetail();
8476
8616
  const {
8477
8617
  label,
8478
8618
  stepId,
@@ -8554,7 +8694,8 @@ function WorkflowNestedNode({ data, parentWorkflowName }) {
8554
8694
  mapConfig,
8555
8695
  onShowNestedGraph: () => showNestedGraph({ label, fullStep: fullLabel, stepGraph }),
8556
8696
  status: displayStatus,
8557
- stepKey
8697
+ stepKey,
8698
+ stepsFlow
8558
8699
  }
8559
8700
  )
8560
8701
  ]
@@ -8611,12 +8752,28 @@ function WorkflowGraphInner({ workflow }) {
8611
8752
  const [nodes, _, onNodesChange] = react$2.useNodesState(initialNodes);
8612
8753
  const [edges] = react$2.useEdgesState(initialEdges);
8613
8754
  const { steps } = useCurrentRun();
8755
+ const stepsFlow = React.useMemo(() => {
8756
+ return initialEdges.reduce(
8757
+ (acc, edge) => {
8758
+ if (edge.data) {
8759
+ const stepId = edge.data.nextStepId;
8760
+ const prevStepId = edge.data.previousStepId;
8761
+ return {
8762
+ ...acc,
8763
+ [stepId]: [.../* @__PURE__ */ new Set([...acc[stepId] || [], prevStepId])]
8764
+ };
8765
+ }
8766
+ return acc;
8767
+ },
8768
+ {}
8769
+ );
8770
+ }, [initialEdges]);
8614
8771
  const nodeTypes = {
8615
- "default-node": WorkflowDefaultNode,
8772
+ "default-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowDefaultNode, { ...props, stepsFlow }),
8616
8773
  "condition-node": WorkflowConditionNode,
8617
8774
  "after-node": WorkflowAfterNode,
8618
8775
  "loop-result-node": WorkflowLoopResultNode,
8619
- "nested-node": WorkflowNestedNode
8776
+ "nested-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedNode, { ...props, stepsFlow })
8620
8777
  };
8621
8778
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsxs(
8622
8779
  react$2.ReactFlow,
@@ -8645,6 +8802,33 @@ function WorkflowGraphInner({ workflow }) {
8645
8802
  ) });
8646
8803
  }
8647
8804
 
8805
+ const WorkflowNestedGraphContext = React.createContext(
8806
+ {}
8807
+ );
8808
+ function WorkflowNestedGraphProvider({ children }) {
8809
+ const { showNestedGraph: showNestedGraphInPanel, closeStepDetail } = useWorkflowStepDetail();
8810
+ const showNestedGraph = ({
8811
+ label,
8812
+ stepGraph,
8813
+ fullStep
8814
+ }) => {
8815
+ showNestedGraphInPanel({ label, stepGraph, fullStep });
8816
+ };
8817
+ const closeNestedGraph = () => {
8818
+ closeStepDetail();
8819
+ };
8820
+ return /* @__PURE__ */ jsxRuntime.jsx(
8821
+ WorkflowNestedGraphContext.Provider,
8822
+ {
8823
+ value: {
8824
+ showNestedGraph,
8825
+ closeNestedGraph
8826
+ },
8827
+ children
8828
+ }
8829
+ );
8830
+ }
8831
+
8648
8832
  function WorkflowGraph({ workflowId, workflow, isLoading }) {
8649
8833
  const { snapshot } = React.useContext(WorkflowRunContext);
8650
8834
  if (isLoading) {
@@ -9533,7 +9717,7 @@ const PlaygroundTabs = ({
9533
9717
  setInternalTab(typedValue);
9534
9718
  }
9535
9719
  };
9536
- return /* @__PURE__ */ jsxRuntime.jsx(Tabs$1, { value: currentTab, onValueChange: handleTabChange, className: cn("h-full", className), children });
9720
+ return /* @__PURE__ */ jsxRuntime.jsx(Tabs$1, { value: currentTab, onValueChange: handleTabChange, className: cn("h-full overflow-x-auto", className), children });
9537
9721
  };
9538
9722
  const TabList$1 = ({ children, className }) => {
9539
9723
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full overflow-x-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: "border-b border-border1 flex min-w-full shrink-0", children }) });
@@ -9567,9 +9751,17 @@ const TabContent$1 = ({ children, value }) => {
9567
9751
  return /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value, className: "h-full overflow-auto flex flex-col", children });
9568
9752
  };
9569
9753
 
9754
+ const WorkflowRunOptions = () => {
9755
+ const { debugMode, setDebugMode } = React.useContext(WorkflowRunContext);
9756
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9757
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "h3", variant: "ui-md", className: "text-icon3", children: "Debug Mode" }),
9758
+ /* @__PURE__ */ jsxRuntime.jsx(Checkbox, { checked: debugMode, onCheckedChange: (value) => setDebugMode(value) })
9759
+ ] });
9760
+ };
9761
+
9570
9762
  const TracingRunOptions = () => {
9571
9763
  const theme = useCodemirrorTheme$1();
9572
- const { settings, setSettings } = useTracingSettings();
9764
+ const { settings, setSettings, entityType } = useTracingSettings();
9573
9765
  const handleChange = (value) => {
9574
9766
  if (!value) {
9575
9767
  return setSettings({ ...settings, tracingOptions: void 0 });
@@ -9598,7 +9790,8 @@ const TracingRunOptions = () => {
9598
9790
  extensions: [langJson.jsonLanguage],
9599
9791
  className: "h-[400px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"
9600
9792
  }
9601
- )
9793
+ ),
9794
+ entityType === "workflow" && /* @__PURE__ */ jsxRuntime.jsx(WorkflowRunOptions, {})
9602
9795
  ] });
9603
9796
  };
9604
9797
 
@@ -9629,12 +9822,28 @@ function WorkflowNestedGraph({ stepGraph, open, workflowName }) {
9629
9822
  const [nodes, _, onNodesChange] = react$2.useNodesState(initialNodes);
9630
9823
  const [edges] = react$2.useEdgesState(initialEdges);
9631
9824
  const { steps } = useCurrentRun();
9825
+ const stepsFlow = React.useMemo(() => {
9826
+ return initialEdges.reduce(
9827
+ (acc, edge) => {
9828
+ if (edge.data) {
9829
+ const stepId = edge.data.nextStepId;
9830
+ const prevStepId = edge.data.previousStepId;
9831
+ return {
9832
+ ...acc,
9833
+ [stepId]: [.../* @__PURE__ */ new Set([...acc[stepId] || [], prevStepId])]
9834
+ };
9835
+ }
9836
+ return acc;
9837
+ },
9838
+ {}
9839
+ );
9840
+ }, [initialEdges]);
9632
9841
  const nodeTypes = {
9633
- "default-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowDefaultNode, { parentWorkflowName: workflowName, ...props }),
9842
+ "default-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowDefaultNode, { parentWorkflowName: workflowName, ...props, stepsFlow }),
9634
9843
  "condition-node": WorkflowConditionNode,
9635
9844
  "after-node": WorkflowAfterNode,
9636
9845
  "loop-result-node": WorkflowLoopResultNode,
9637
- "nested-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedNode, { parentWorkflowName: workflowName, ...props })
9846
+ "nested-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedNode, { parentWorkflowName: workflowName, ...props, stepsFlow })
9638
9847
  };
9639
9848
  React.useEffect(() => {
9640
9849
  if (open) {
@@ -9704,7 +9913,7 @@ function WorkflowStepDetailContent() {
9704
9913
  open: true,
9705
9914
  workflowName: stepDetail.nestedGraph.fullStep
9706
9915
  }
9707
- ) }) })
9916
+ ) }, stepDetail.nestedGraph.fullStep) })
9708
9917
  ] })
9709
9918
  ] });
9710
9919
  }
@@ -9844,8 +10053,7 @@ function Combobox({
9844
10053
  emptyText = "No option found.",
9845
10054
  className,
9846
10055
  disabled = false,
9847
- buttonClassName,
9848
- contentClassName
10056
+ variant = "default"
9849
10057
  }) {
9850
10058
  const [open, setOpen] = React__namespace.useState(false);
9851
10059
  const [search, setSearch] = React__namespace.useState("");
@@ -9923,78 +10131,71 @@ function Combobox({
9923
10131
  Button$2,
9924
10132
  {
9925
10133
  ref: triggerRef,
9926
- variant: "outline",
10134
+ variant,
9927
10135
  role: "combobox",
9928
10136
  "aria-expanded": open,
9929
- className: cn("w-full justify-between", buttonClassName, className),
10137
+ className: cn("w-full justify-between", className),
9930
10138
  disabled,
10139
+ size: "sm",
9931
10140
  children: [
9932
10141
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-ui-lg", children: selectedOption ? selectedOption.label : placeholder }),
9933
10142
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
9934
10143
  ]
9935
10144
  }
9936
10145
  ) }),
9937
- /* @__PURE__ */ jsxRuntime.jsx(
9938
- PopoverContent,
9939
- {
9940
- className: cn("p-0", contentClassName),
9941
- align: "start",
9942
- style: { width: triggerWidth ? `${triggerWidth}px` : void 0 },
9943
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", children: [
9944
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3 py-2", children: [
9945
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
9946
- /* @__PURE__ */ jsxRuntime.jsx(
9947
- "input",
10146
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "p-0 w-fit", align: "start", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", children: [
10147
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3 py-2", children: [
10148
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
10149
+ /* @__PURE__ */ jsxRuntime.jsx(
10150
+ "input",
10151
+ {
10152
+ ref: inputRef,
10153
+ className: "flex h-8 w-full rounded-md bg-transparent py-1 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 outline-none",
10154
+ placeholder: searchPlaceholder,
10155
+ value: search,
10156
+ onChange: (e) => setSearch(e.target.value),
10157
+ onKeyDown: handleKeyDown,
10158
+ role: "combobox",
10159
+ "aria-autocomplete": "list",
10160
+ "aria-controls": "combobox-options",
10161
+ "aria-expanded": open
10162
+ }
10163
+ )
10164
+ ] }),
10165
+ /* @__PURE__ */ jsxRuntime.jsx(
10166
+ "div",
10167
+ {
10168
+ ref: listRef,
10169
+ id: "combobox-options",
10170
+ role: "listbox",
10171
+ className: "max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",
10172
+ children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-6 text-center text-sm", children: emptyText }) : filteredOptions.map((option, index) => {
10173
+ const isSelected = value === option.value;
10174
+ const isHighlighted = index === highlightedIndex;
10175
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10176
+ "div",
9948
10177
  {
9949
- ref: inputRef,
9950
- className: "flex h-8 w-full rounded-md bg-transparent py-1 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 outline-none",
9951
- placeholder: searchPlaceholder,
9952
- value: search,
9953
- onChange: (e) => setSearch(e.target.value),
9954
- onKeyDown: handleKeyDown,
9955
- role: "combobox",
9956
- "aria-autocomplete": "list",
9957
- "aria-controls": "combobox-options",
9958
- "aria-expanded": open
9959
- }
9960
- )
9961
- ] }),
9962
- /* @__PURE__ */ jsxRuntime.jsx(
9963
- "div",
9964
- {
9965
- ref: listRef,
9966
- id: "combobox-options",
9967
- role: "listbox",
9968
- className: "max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",
9969
- children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-6 text-center text-sm", children: emptyText }) : filteredOptions.map((option, index) => {
9970
- const isSelected = value === option.value;
9971
- const isHighlighted = index === highlightedIndex;
9972
- return /* @__PURE__ */ jsxRuntime.jsxs(
9973
- "div",
9974
- {
9975
- role: "option",
9976
- "aria-selected": isSelected,
9977
- className: cn(
9978
- "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm transition-colors",
9979
- "hover:bg-accent hover:text-accent-foreground",
9980
- isHighlighted && "bg-accent text-accent-foreground",
9981
- isSelected && !isHighlighted && "bg-accent/50"
9982
- ),
9983
- onClick: () => handleSelect(option.value),
9984
- onMouseEnter: () => setHighlightedIndex(index),
9985
- children: [
9986
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: cn("mr-2 h-4 w-4", isSelected ? "opacity-100" : "opacity-0") }),
9987
- option.label
9988
- ]
9989
- },
9990
- option.value
9991
- );
9992
- })
9993
- }
9994
- )
9995
- ] })
9996
- }
9997
- )
10178
+ role: "option",
10179
+ "aria-selected": isSelected,
10180
+ className: cn(
10181
+ "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm transition-colors",
10182
+ "hover:bg-accent hover:text-accent-foreground",
10183
+ isHighlighted && "bg-accent text-accent-foreground",
10184
+ isSelected && !isHighlighted && "bg-accent/50"
10185
+ ),
10186
+ onClick: () => handleSelect(option.value),
10187
+ onMouseEnter: () => setHighlightedIndex(index),
10188
+ children: [
10189
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: cn("mr-2 h-4 w-4", isSelected ? "opacity-100" : "opacity-0") }),
10190
+ option.label
10191
+ ]
10192
+ },
10193
+ option.value
10194
+ );
10195
+ })
10196
+ }
10197
+ )
10198
+ ] }) })
9998
10199
  ] });
9999
10200
  }
10000
10201
 
@@ -10005,9 +10206,7 @@ function WorkflowCombobox({
10005
10206
  searchPlaceholder = "Search workflows...",
10006
10207
  emptyText = "No workflows found.",
10007
10208
  className,
10008
- disabled = false,
10009
- buttonClassName = "h-8",
10010
- contentClassName
10209
+ disabled = false
10011
10210
  }) {
10012
10211
  const { data: workflows = {}, isLoading, isError, error } = useWorkflows();
10013
10212
  const { navigate, paths } = useLinkComponent();
@@ -10039,12 +10238,167 @@ function WorkflowCombobox({
10039
10238
  emptyText,
10040
10239
  className,
10041
10240
  disabled: disabled || isLoading || isError,
10042
- buttonClassName,
10043
- contentClassName
10241
+ variant: "ghost"
10044
10242
  }
10045
10243
  );
10046
10244
  }
10047
10245
 
10246
+ function MainContentLayout({
10247
+ children,
10248
+ className,
10249
+ style
10250
+ }) {
10251
+ const devStyleRequested = devUIStyleRequested("MainContentLayout");
10252
+ return /* @__PURE__ */ jsxRuntime.jsx(
10253
+ "main",
10254
+ {
10255
+ className: cn(`grid grid-rows-[auto_1fr] h-full items-start content-start`, className),
10256
+ style: { ...style, ...devStyleRequested ? { border: "3px dotted red" } : {} },
10257
+ children
10258
+ }
10259
+ );
10260
+ }
10261
+ function MainContentContent({
10262
+ children,
10263
+ className,
10264
+ isCentered = false,
10265
+ isDivided = false,
10266
+ hasLeftServiceColumn = false,
10267
+ style
10268
+ }) {
10269
+ const devStyleRequested = devUIStyleRequested("MainContentContent");
10270
+ const contentClassName = getMainContentContentClassName({ isCentered, isDivided, hasLeftServiceColumn, className });
10271
+ return /* @__PURE__ */ jsxRuntime.jsx(
10272
+ "div",
10273
+ {
10274
+ className: contentClassName,
10275
+ style: { ...style, ...devStyleRequested ? { border: "3px dotted orange" } : {} },
10276
+ children
10277
+ }
10278
+ );
10279
+ }
10280
+ const getMainContentContentClassName = ({
10281
+ isCentered,
10282
+ isDivided,
10283
+ hasLeftServiceColumn,
10284
+ className
10285
+ }) => {
10286
+ return cn(
10287
+ `grid overflow-y-auto h-full `,
10288
+ `overflow-x-auto min-w-[min-content]`,
10289
+ {
10290
+ "items-start content-start": !isCentered && !isDivided && !hasLeftServiceColumn,
10291
+ "grid place-items-center": isCentered,
10292
+ "grid-cols-[1fr_1fr]": isDivided && !hasLeftServiceColumn,
10293
+ "grid-cols-[12rem_1fr_1fr]": isDivided && hasLeftServiceColumn,
10294
+ "grid-cols-[auto_1fr]": !isDivided && hasLeftServiceColumn
10295
+ },
10296
+ className
10297
+ );
10298
+ };
10299
+ function devUIStyleRequested(name) {
10300
+ try {
10301
+ const raw = localStorage.getItem("add-dev-style-to-components");
10302
+ if (!raw) return false;
10303
+ const components = raw.split(",").map((c) => c.trim()).filter(Boolean);
10304
+ return components.includes(name);
10305
+ } catch (error) {
10306
+ console.error("Error reading or parsing localStorage:", error);
10307
+ return false;
10308
+ }
10309
+ }
10310
+
10311
+ const PanelSeparator = () => {
10312
+ return /* @__PURE__ */ jsxRuntime.jsx(
10313
+ reactResizablePanels.Separator,
10314
+ {
10315
+ className: clsx(
10316
+ "w-1.5 bg-surface3",
10317
+ "[&[data-separator='hover']]:!bg-surface4",
10318
+ "[&[data-separator='active']]:!bg-surface5",
10319
+ "focus:outline-none"
10320
+ )
10321
+ }
10322
+ );
10323
+ };
10324
+
10325
+ const CollapsiblePanel = ({ collapsedSize, children, direction, ...props }) => {
10326
+ const [collapsed, setCollapsed] = React.useState(false);
10327
+ const panelRef = reactResizablePanels.usePanelRef();
10328
+ const expand = () => {
10329
+ if (!panelRef.current) return;
10330
+ panelRef.current.expand();
10331
+ };
10332
+ return /* @__PURE__ */ jsxRuntime.jsx(
10333
+ reactResizablePanels.Panel,
10334
+ {
10335
+ panelRef,
10336
+ collapsedSize,
10337
+ ...props,
10338
+ onResize: (size) => {
10339
+ if (!collapsedSize) return;
10340
+ if (typeof collapsedSize !== "number") return;
10341
+ if (size.inPixels <= collapsedSize) {
10342
+ setCollapsed(true);
10343
+ } else if (collapsed) {
10344
+ setCollapsed(false);
10345
+ }
10346
+ },
10347
+ children: collapsed ? /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
10348
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: expand, className: "!h-48 border-none", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: direction === "left" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, {}) }) }) }) }),
10349
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Expand" })
10350
+ ] }) : children
10351
+ }
10352
+ );
10353
+ };
10354
+
10355
+ const WorkflowLayout = ({ workflowId, children, leftSlot, rightSlot }) => {
10356
+ const { defaultLayout, onLayoutChange } = reactResizablePanels.useDefaultLayout({
10357
+ id: `workflow-layout-${workflowId}`,
10358
+ storage: localStorage
10359
+ });
10360
+ const computedClassName = getMainContentContentClassName({
10361
+ isCentered: false,
10362
+ isDivided: true,
10363
+ hasLeftServiceColumn: Boolean(leftSlot)
10364
+ });
10365
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactResizablePanels.Group, { className: computedClassName, defaultLayout, onLayoutChange, children: [
10366
+ leftSlot && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10367
+ /* @__PURE__ */ jsxRuntime.jsx(
10368
+ CollapsiblePanel,
10369
+ {
10370
+ direction: "left",
10371
+ id: "left-slot",
10372
+ minSize: 200,
10373
+ maxSize: "30%",
10374
+ defaultSize: 200,
10375
+ collapsedSize: 60,
10376
+ collapsible: true,
10377
+ children: leftSlot
10378
+ }
10379
+ ),
10380
+ /* @__PURE__ */ jsxRuntime.jsx(PanelSeparator, {})
10381
+ ] }),
10382
+ /* @__PURE__ */ jsxRuntime.jsx(reactResizablePanels.Panel, { id: "main-slot", children }),
10383
+ rightSlot && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10384
+ /* @__PURE__ */ jsxRuntime.jsx(PanelSeparator, {}),
10385
+ /* @__PURE__ */ jsxRuntime.jsx(
10386
+ CollapsiblePanel,
10387
+ {
10388
+ direction: "right",
10389
+ id: "right-slot",
10390
+ minSize: 300,
10391
+ maxSize: "50%",
10392
+ defaultSize: 300,
10393
+ collapsedSize: 60,
10394
+ collapsible: true,
10395
+ children: rightSlot
10396
+ }
10397
+ )
10398
+ ] })
10399
+ ] });
10400
+ };
10401
+
10048
10402
  const LoadingBadge = () => {
10049
10403
  return /* @__PURE__ */ jsxRuntime.jsx(
10050
10404
  BadgeWrapper,
@@ -11317,7 +11671,7 @@ const Thread = ({ agentName, agentId, hasMemory, hasModelList }) => {
11317
11671
  return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper, { children: [
11318
11672
  /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { ref: areaRef, autoScroll: false, className: "overflow-y-scroll scroll-smooth h-full", children: [
11319
11673
  /* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
11320
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[568px] w-full mx-auto px-4 pb-7", children: /* @__PURE__ */ jsxRuntime.jsx(
11674
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-3xl w-full mx-auto px-4 pb-7", children: /* @__PURE__ */ jsxRuntime.jsx(
11321
11675
  react.ThreadPrimitive.Messages,
11322
11676
  {
11323
11677
  components: {
@@ -11355,11 +11709,11 @@ const Composer = ({ hasMemory, agentId }) => {
11355
11709
  const { setThreadInput } = useThreadInput();
11356
11710
  const textareaRef = React.useRef(null);
11357
11711
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4", children: /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
11358
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[568px] w-full mx-auto pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}) }),
11712
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-3xl w-full mx-auto pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}) }),
11359
11713
  /* @__PURE__ */ jsxRuntime.jsxs(
11360
11714
  "div",
11361
11715
  {
11362
- 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",
11716
+ className: "bg-surface3 rounded-lg border-sm border-border1 py-4 mt-auto max-w-3xl w-full mx-auto px-4 focus-within:outline focus-within:outline-accent1 -outline-offset-2",
11363
11717
  onClick: () => {
11364
11718
  textareaRef.current?.focus();
11365
11719
  },
@@ -12526,149 +12880,151 @@ const AgentAdvancedSettings = () => {
12526
12880
  setError("Invalid JSON");
12527
12881
  }
12528
12882
  };
12529
- const collapsibleClassName = "rounded-lg border-sm border-border1 bg-surface3 overflow-clip";
12530
- const collapsibleTriggerClassName = "text-icon3 text-ui-lg font-medium flex items-center gap-2 w-full p-[10px] justify-between";
12531
- const collapsibleContentClassName = "bg-surface2 p-[10px] grid grid-cols-2 gap-[10px]";
12532
- const buttonClass = "text-icon3 hover:text-icon6";
12533
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Collapsible, { className: collapsibleClassName, open: isOpen, onOpenChange: setIsOpen, children: [
12534
- /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleTrigger, { className: collapsibleTriggerClassName, children: [
12535
- "Advanced Settings",
12536
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: cn("transition-transform", isOpen ? "rotate-0" : "-rotate-90"), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {}) })
12537
- ] }),
12538
- /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleContent, { className: collapsibleContentClassName, children: [
12539
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12540
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "frequency-penalty", children: "Frequency Penalty" }),
12541
- /* @__PURE__ */ jsxRuntime.jsx(
12542
- Input,
12543
- {
12544
- id: "frequency-penalty",
12545
- type: "number",
12546
- step: "0.1",
12547
- min: "-1",
12548
- max: "1",
12549
- value: settings?.modelSettings?.frequencyPenalty ?? "",
12550
- onChange: (e) => setSettings({
12551
- ...settings,
12552
- modelSettings: {
12553
- ...settings?.modelSettings,
12554
- frequencyPenalty: e.target.value ? Number(e.target.value) : void 0
12555
- }
12556
- })
12557
- }
12558
- )
12559
- ] }),
12560
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12561
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "presence-penalty", children: "Presence Penalty" }),
12562
- /* @__PURE__ */ jsxRuntime.jsx(
12563
- Input,
12564
- {
12565
- id: "presence-penalty",
12566
- type: "number",
12567
- step: "0.1",
12568
- min: "-1",
12569
- max: "1",
12570
- value: settings?.modelSettings?.presencePenalty ?? "",
12571
- onChange: (e) => setSettings({
12572
- ...settings,
12573
- modelSettings: {
12574
- ...settings?.modelSettings,
12575
- presencePenalty: e.target.value ? Number(e.target.value) : void 0
12576
- }
12577
- })
12578
- }
12579
- )
12580
- ] }),
12581
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12582
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "top-k", children: "Top K" }),
12583
- /* @__PURE__ */ jsxRuntime.jsx(
12584
- Input,
12585
- {
12586
- id: "top-k",
12587
- type: "number",
12588
- value: settings?.modelSettings?.topK || "",
12589
- onChange: (e) => setSettings({
12590
- ...settings,
12591
- modelSettings: {
12592
- ...settings?.modelSettings,
12593
- topK: e.target.value ? Number(e.target.value) : void 0
12594
- }
12595
- })
12596
- }
12597
- )
12598
- ] }),
12599
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12600
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-tokens", children: "Max Tokens" }),
12601
- /* @__PURE__ */ jsxRuntime.jsx(
12602
- Input,
12603
- {
12604
- id: "max-tokens",
12605
- type: "number",
12606
- value: settings?.modelSettings?.maxTokens || "",
12607
- onChange: (e) => setSettings({
12608
- ...settings,
12609
- modelSettings: {
12610
- ...settings?.modelSettings,
12611
- maxTokens: e.target.value ? Number(e.target.value) : void 0
12612
- }
12613
- })
12614
- }
12615
- )
12616
- ] }),
12617
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12618
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-steps", children: "Max Steps" }),
12619
- /* @__PURE__ */ jsxRuntime.jsx(
12620
- Input,
12621
- {
12622
- id: "max-steps",
12623
- type: "number",
12624
- value: settings?.modelSettings?.maxSteps || "",
12625
- onChange: (e) => setSettings({
12626
- ...settings,
12627
- modelSettings: {
12628
- ...settings?.modelSettings,
12629
- maxSteps: e.target.value ? Number(e.target.value) : void 0
12630
- }
12631
- })
12632
- }
12633
- )
12634
- ] }),
12635
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12636
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-retries", children: "Max Retries" }),
12637
- /* @__PURE__ */ jsxRuntime.jsx(
12638
- Input,
12639
- {
12640
- id: "max-retries",
12641
- type: "number",
12642
- value: settings?.modelSettings?.maxRetries || "",
12643
- onChange: (e) => setSettings({
12644
- ...settings,
12645
- modelSettings: {
12646
- ...settings?.modelSettings,
12647
- maxRetries: e.target.value ? Number(e.target.value) : void 0
12648
- }
12649
- })
12650
- }
12651
- )
12883
+ const collapsibleClassName = "rounded-lg border-sm border-border1 bg-surface3 overflow-clip";
12884
+ const collapsibleTriggerClassName = "text-icon3 text-ui-lg font-medium flex items-center gap-2 w-full p-[10px] justify-between";
12885
+ const collapsibleContentClassName = "bg-surface2 p-[10px] @container/collapsible";
12886
+ const buttonClass = "text-icon3 hover:text-icon6";
12887
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Collapsible, { className: collapsibleClassName, open: isOpen, onOpenChange: setIsOpen, children: [
12888
+ /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleTrigger, { className: collapsibleTriggerClassName, children: [
12889
+ "Advanced Settings",
12890
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: cn("transition-transform", isOpen ? "rotate-0" : "-rotate-90"), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {}) })
12891
+ ] }),
12892
+ /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleContent, { className: collapsibleContentClassName, children: [
12893
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-2 pb-2 @xs/collapsible:grid-cols-2", children: [
12894
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12895
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "frequency-penalty", children: "Frequency Penalty" }),
12896
+ /* @__PURE__ */ jsxRuntime.jsx(
12897
+ Input,
12898
+ {
12899
+ id: "frequency-penalty",
12900
+ type: "number",
12901
+ step: "0.1",
12902
+ min: "-1",
12903
+ max: "1",
12904
+ value: settings?.modelSettings?.frequencyPenalty ?? "",
12905
+ onChange: (e) => setSettings({
12906
+ ...settings,
12907
+ modelSettings: {
12908
+ ...settings?.modelSettings,
12909
+ frequencyPenalty: e.target.value ? Number(e.target.value) : void 0
12910
+ }
12911
+ })
12912
+ }
12913
+ )
12914
+ ] }),
12915
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12916
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "presence-penalty", children: "Presence Penalty" }),
12917
+ /* @__PURE__ */ jsxRuntime.jsx(
12918
+ Input,
12919
+ {
12920
+ id: "presence-penalty",
12921
+ type: "number",
12922
+ step: "0.1",
12923
+ min: "-1",
12924
+ max: "1",
12925
+ value: settings?.modelSettings?.presencePenalty ?? "",
12926
+ onChange: (e) => setSettings({
12927
+ ...settings,
12928
+ modelSettings: {
12929
+ ...settings?.modelSettings,
12930
+ presencePenalty: e.target.value ? Number(e.target.value) : void 0
12931
+ }
12932
+ })
12933
+ }
12934
+ )
12935
+ ] }),
12936
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12937
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "top-k", children: "Top K" }),
12938
+ /* @__PURE__ */ jsxRuntime.jsx(
12939
+ Input,
12940
+ {
12941
+ id: "top-k",
12942
+ type: "number",
12943
+ value: settings?.modelSettings?.topK || "",
12944
+ onChange: (e) => setSettings({
12945
+ ...settings,
12946
+ modelSettings: {
12947
+ ...settings?.modelSettings,
12948
+ topK: e.target.value ? Number(e.target.value) : void 0
12949
+ }
12950
+ })
12951
+ }
12952
+ )
12953
+ ] }),
12954
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12955
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-tokens", children: "Max Tokens" }),
12956
+ /* @__PURE__ */ jsxRuntime.jsx(
12957
+ Input,
12958
+ {
12959
+ id: "max-tokens",
12960
+ type: "number",
12961
+ value: settings?.modelSettings?.maxTokens || "",
12962
+ onChange: (e) => setSettings({
12963
+ ...settings,
12964
+ modelSettings: {
12965
+ ...settings?.modelSettings,
12966
+ maxTokens: e.target.value ? Number(e.target.value) : void 0
12967
+ }
12968
+ })
12969
+ }
12970
+ )
12971
+ ] }),
12972
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12973
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-steps", children: "Max Steps" }),
12974
+ /* @__PURE__ */ jsxRuntime.jsx(
12975
+ Input,
12976
+ {
12977
+ id: "max-steps",
12978
+ type: "number",
12979
+ value: settings?.modelSettings?.maxSteps || "",
12980
+ onChange: (e) => setSettings({
12981
+ ...settings,
12982
+ modelSettings: {
12983
+ ...settings?.modelSettings,
12984
+ maxSteps: e.target.value ? Number(e.target.value) : void 0
12985
+ }
12986
+ })
12987
+ }
12988
+ )
12989
+ ] }),
12990
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12991
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-retries", children: "Max Retries" }),
12992
+ /* @__PURE__ */ jsxRuntime.jsx(
12993
+ Input,
12994
+ {
12995
+ id: "max-retries",
12996
+ type: "number",
12997
+ value: settings?.modelSettings?.maxRetries || "",
12998
+ onChange: (e) => setSettings({
12999
+ ...settings,
13000
+ modelSettings: {
13001
+ ...settings?.modelSettings,
13002
+ maxRetries: e.target.value ? Number(e.target.value) : void 0
13003
+ }
13004
+ })
13005
+ }
13006
+ )
13007
+ ] }),
13008
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
13009
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "seed", children: "Seed" }),
13010
+ /* @__PURE__ */ jsxRuntime.jsx(
13011
+ Input,
13012
+ {
13013
+ id: "seed",
13014
+ type: "number",
13015
+ value: settings?.modelSettings?.seed || "",
13016
+ onChange: (e) => setSettings({
13017
+ ...settings,
13018
+ modelSettings: {
13019
+ ...settings?.modelSettings,
13020
+ seed: e.target.value ? Number(e.target.value) : void 0
13021
+ }
13022
+ })
13023
+ }
13024
+ )
13025
+ ] })
12652
13026
  ] }),
12653
13027
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
12654
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "seed", children: "Seed" }),
12655
- /* @__PURE__ */ jsxRuntime.jsx(
12656
- Input,
12657
- {
12658
- id: "seed",
12659
- type: "number",
12660
- value: settings?.modelSettings?.seed || "",
12661
- onChange: (e) => setSettings({
12662
- ...settings,
12663
- modelSettings: {
12664
- ...settings?.modelSettings,
12665
- seed: e.target.value ? Number(e.target.value) : void 0
12666
- }
12667
- })
12668
- }
12669
- )
12670
- ] }),
12671
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 col-span-2", children: [
12672
13028
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
12673
13029
  /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "provider-options", children: "Provider Options" }),
12674
13030
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -12855,7 +13211,7 @@ const AgentSettings = ({ agentId }) => {
12855
13211
  radioValue = settings?.modelSettings?.chatWithGenerateLegacy ? "generateLegacy" : "streamLegacy";
12856
13212
  }
12857
13213
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-5 text-xs py-2 pb-4", children: [
12858
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-7", children: [
13214
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-7 @container", children: [
12859
13215
  /* @__PURE__ */ jsxRuntime.jsx(Entry, { label: "Chat Method", children: /* @__PURE__ */ jsxRuntime.jsxs(
12860
13216
  RadioGroup,
12861
13217
  {
@@ -12870,7 +13226,7 @@ const AgentSettings = ({ agentId }) => {
12870
13226
  chatWithNetwork: value === "network"
12871
13227
  }
12872
13228
  }),
12873
- className: "flex flex-row gap-4",
13229
+ className: "flex flex-col gap-4 @xs:flex-row",
12874
13230
  children: [
12875
13231
  !isSupportedModel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12876
13232
  /* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "generateLegacy", id: "generateLegacy", className: "text-icon6" }),
@@ -12902,7 +13258,7 @@ const AgentSettings = ({ agentId }) => {
12902
13258
  })
12903
13259
  }
12904
13260
  ) }),
12905
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8", children: [
13261
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 @xs:grid-cols-2 gap-8", children: [
12906
13262
  /* @__PURE__ */ jsxRuntime.jsx(Entry, { label: "Temperature", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row justify-between items-center gap-2", children: [
12907
13263
  /* @__PURE__ */ jsxRuntime.jsx(
12908
13264
  Slider,
@@ -13742,62 +14098,6 @@ const CombinedButtons = ({ className, children }) => {
13742
14098
  );
13743
14099
  };
13744
14100
 
13745
- function MainContentLayout({
13746
- children,
13747
- className,
13748
- style
13749
- }) {
13750
- const devStyleRequested = devUIStyleRequested("MainContentLayout");
13751
- return /* @__PURE__ */ jsxRuntime.jsx(
13752
- "main",
13753
- {
13754
- className: cn(`grid grid-rows-[auto_1fr] h-full items-start content-start`, className),
13755
- style: { ...style, ...devStyleRequested ? { border: "3px dotted red" } : {} },
13756
- children
13757
- }
13758
- );
13759
- }
13760
- function MainContentContent({
13761
- children,
13762
- className,
13763
- isCentered = false,
13764
- isDivided = false,
13765
- hasLeftServiceColumn = false,
13766
- style
13767
- }) {
13768
- const devStyleRequested = devUIStyleRequested("MainContentContent");
13769
- return /* @__PURE__ */ jsxRuntime.jsx(
13770
- "div",
13771
- {
13772
- className: cn(
13773
- `grid overflow-y-auto h-full `,
13774
- `overflow-x-auto min-w-[min-content]`,
13775
- {
13776
- "items-start content-start": !isCentered && !isDivided && !hasLeftServiceColumn,
13777
- "grid place-items-center": isCentered,
13778
- "grid-cols-[1fr_1fr]": isDivided && !hasLeftServiceColumn,
13779
- "grid-cols-[12rem_1fr_1fr]": isDivided && hasLeftServiceColumn,
13780
- "grid-cols-[auto_1fr]": !isDivided && hasLeftServiceColumn
13781
- },
13782
- className
13783
- ),
13784
- style: { ...style, ...devStyleRequested ? { border: "3px dotted orange" } : {} },
13785
- children
13786
- }
13787
- );
13788
- }
13789
- function devUIStyleRequested(name) {
13790
- try {
13791
- const raw = localStorage.getItem("add-dev-style-to-components");
13792
- if (!raw) return false;
13793
- const components = raw.split(",").map((c) => c.trim()).filter(Boolean);
13794
- return components.includes(name);
13795
- } catch (error) {
13796
- console.error("Error reading or parsing localStorage:", error);
13797
- return false;
13798
- }
13799
- }
13800
-
13801
14101
  function ButtonsGroup({ children, className }) {
13802
14102
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(`flex gap-2 items-center`, "[&>button]:flex-grow", className), children });
13803
14103
  }
@@ -14945,9 +15245,7 @@ function ScorerCombobox({
14945
15245
  searchPlaceholder = "Search scorers...",
14946
15246
  emptyText = "No scorers found.",
14947
15247
  className,
14948
- disabled = false,
14949
- buttonClassName = "h-8",
14950
- contentClassName
15248
+ disabled = false
14951
15249
  }) {
14952
15250
  const { data: scorers = {}, isLoading, isError, error } = useScorers();
14953
15251
  const { navigate, paths } = useLinkComponent();
@@ -14979,8 +15277,7 @@ function ScorerCombobox({
14979
15277
  emptyText,
14980
15278
  className,
14981
15279
  disabled: disabled || isLoading || isError,
14982
- buttonClassName,
14983
- contentClassName
15280
+ variant: "ghost"
14984
15281
  }
14985
15282
  );
14986
15283
  }
@@ -15274,8 +15571,8 @@ const AgentMetadataModelSwitcher = ({
15274
15571
  setLoading(false);
15275
15572
  }
15276
15573
  };
15277
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15278
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col xl:flex-row items-stretch xl:items-center gap-2 w-full", children: [
15574
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "@container", children: [
15575
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col @xs:flex-row items-stretch @xs:items-center gap-2 w-full", children: [
15279
15576
  /* @__PURE__ */ jsxRuntime.jsxs(
15280
15577
  Popover,
15281
15578
  {
@@ -15288,7 +15585,7 @@ const AgentMetadataModelSwitcher = ({
15288
15585
  }
15289
15586
  },
15290
15587
  children: [
15291
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full xl:w-2/5", children: [
15588
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full @xs:w-2/5", children: [
15292
15589
  !isSearchingProvider && currentModelProvider && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15293
15590
  /* @__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: [
15294
15591
  /* @__PURE__ */ jsxRuntime.jsx(ProviderLogo, { providerId: currentModelProvider, size: 16 }),
@@ -15467,7 +15764,7 @@ const AgentMetadataModelSwitcher = ({
15467
15764
  "aria-label": "Search models",
15468
15765
  spellCheck: "false",
15469
15766
  ref: modelInputRef,
15470
- className: "w-full xl:w-3/5",
15767
+ className: "w-full @xs:w-3/5",
15471
15768
  type: "text",
15472
15769
  value: modelSearch || selectedModel,
15473
15770
  onChange: (e) => {
@@ -16091,7 +16388,7 @@ const AgentEntityHeader = ({ agentId }) => {
16091
16388
  };
16092
16389
 
16093
16390
  const Threads = ({ children }) => {
16094
- return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "bg-surface2 border-r-sm border-border1 min-h-full overflow-hidden", children });
16391
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "bg-surface2 min-h-full overflow-hidden", children });
16095
16392
  };
16096
16393
  const ThreadLink = ({ children, as: Component = "a", href, className, prefetch, to }) => {
16097
16394
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -16294,9 +16591,7 @@ function AgentCombobox({
16294
16591
  searchPlaceholder = "Search agents...",
16295
16592
  emptyText = "No agents found.",
16296
16593
  className,
16297
- disabled = false,
16298
- buttonClassName = "h-8",
16299
- contentClassName
16594
+ disabled = false
16300
16595
  }) {
16301
16596
  const { data: agents = {}, isLoading, isError, error } = useAgents();
16302
16597
  const { navigate, paths } = useLinkComponent();
@@ -16328,8 +16623,7 @@ function AgentCombobox({
16328
16623
  emptyText,
16329
16624
  className,
16330
16625
  disabled: disabled || isLoading || isError,
16331
- buttonClassName,
16332
- contentClassName
16626
+ variant: "ghost"
16333
16627
  }
16334
16628
  );
16335
16629
  }
@@ -17205,7 +17499,7 @@ const useAgentInformationSettings = ({ modelId }) => {
17205
17499
  const AgentInformationLayout = ({ children, agentId }) => {
17206
17500
  const { data: agent } = useAgent(agentId);
17207
17501
  useAgentInformationSettings({ modelId: agent?.modelId || "" });
17208
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-rows-[auto_1fr] h-full items-start overflow-y-auto border-l-sm border-border1", children });
17502
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-rows-[auto_1fr] h-full items-start overflow-y-auto", children });
17209
17503
  };
17210
17504
  const AgentInformationTabLayout = ({ children, agentId }) => {
17211
17505
  const { data: memory, isLoading: isMemoryLoading } = useMemory(agentId);
@@ -17217,6 +17511,53 @@ const AgentInformationTabLayout = ({ children, agentId }) => {
17217
17511
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden border-t-sm border-border1 flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx(PlaygroundTabs, { defaultTab: "overview", value: selectedTab, onValueChange: handleTabChange, children }) });
17218
17512
  };
17219
17513
 
17514
+ const AgentLayout = ({ agentId, children, leftSlot, rightSlot }) => {
17515
+ const { defaultLayout, onLayoutChange } = reactResizablePanels.useDefaultLayout({
17516
+ id: `agent-layout-${agentId}`,
17517
+ storage: localStorage
17518
+ });
17519
+ const computedClassName = getMainContentContentClassName({
17520
+ isCentered: false,
17521
+ isDivided: true,
17522
+ hasLeftServiceColumn: Boolean(leftSlot)
17523
+ });
17524
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactResizablePanels.Group, { className: computedClassName, defaultLayout, onLayoutChange, children: [
17525
+ leftSlot && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17526
+ /* @__PURE__ */ jsxRuntime.jsx(
17527
+ CollapsiblePanel,
17528
+ {
17529
+ direction: "left",
17530
+ id: "left-slot",
17531
+ minSize: 200,
17532
+ maxSize: "30%",
17533
+ defaultSize: 200,
17534
+ collapsedSize: 60,
17535
+ collapsible: true,
17536
+ children: leftSlot
17537
+ }
17538
+ ),
17539
+ /* @__PURE__ */ jsxRuntime.jsx(PanelSeparator, {})
17540
+ ] }),
17541
+ /* @__PURE__ */ jsxRuntime.jsx(reactResizablePanels.Panel, { id: "main-slot", className: "grid overflow-y-auto relative bg-surface1 py-4", children }),
17542
+ rightSlot && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17543
+ /* @__PURE__ */ jsxRuntime.jsx(PanelSeparator, {}),
17544
+ /* @__PURE__ */ jsxRuntime.jsx(
17545
+ CollapsiblePanel,
17546
+ {
17547
+ direction: "right",
17548
+ id: "right-slot",
17549
+ minSize: 300,
17550
+ maxSize: "50%",
17551
+ defaultSize: 300,
17552
+ collapsedSize: 60,
17553
+ collapsible: true,
17554
+ children: rightSlot
17555
+ }
17556
+ )
17557
+ ] })
17558
+ ] });
17559
+ };
17560
+
17220
17561
  const NameCell$1 = ({ row }) => {
17221
17562
  const { Link, paths } = useLinkComponent();
17222
17563
  const tool = row.original;
@@ -17444,9 +17785,7 @@ function ToolCombobox({
17444
17785
  searchPlaceholder = "Search tools...",
17445
17786
  emptyText = "No tools found.",
17446
17787
  className,
17447
- disabled = false,
17448
- buttonClassName = "h-8",
17449
- contentClassName
17788
+ disabled = false
17450
17789
  }) {
17451
17790
  const { data: tools = {}, isLoading: isLoadingTools, isError: isErrorTools, error: errorTools } = useTools();
17452
17791
  const { data: agents = {}, isLoading: isLoadingAgents, isError: isErrorAgents, error: errorAgents } = useAgents();
@@ -17500,8 +17839,7 @@ function ToolCombobox({
17500
17839
  emptyText,
17501
17840
  className,
17502
17841
  disabled: disabled || isLoadingTools || isLoadingAgents || isErrorTools || isErrorAgents,
17503
- buttonClassName,
17504
- contentClassName
17842
+ variant: "ghost"
17505
17843
  }
17506
17844
  );
17507
17845
  }
@@ -18184,7 +18522,7 @@ const formatHierarchicalSpans = (spans) => {
18184
18522
  });
18185
18523
  spans.forEach((spanRecord) => {
18186
18524
  const uiSpan = spanMap.get(spanRecord.spanId);
18187
- if (spanRecord?.parentSpanId === null) {
18525
+ if (spanRecord?.parentSpanId == null) {
18188
18526
  if (overallEndDate && uiSpan.endTime && overallEndDate > new Date(uiSpan.endTime)) {
18189
18527
  uiSpan.endTime = overallEndDate.toISOString();
18190
18528
  const overallEndTime = new Date(overallEndDate).getTime();
@@ -18779,17 +19117,21 @@ function useTraceInfo(trace) {
18779
19117
  }
18780
19118
  const agentsLink = paths.agentsLink();
18781
19119
  const workflowsLink = paths.workflowsLink();
18782
- const agentLink = paths.agentLink(trace?.metadata?.resourceId);
18783
- const workflowLink = paths.workflowLink(trace?.attributes?.workflowId);
19120
+ const entityId = trace.entityId;
19121
+ const entityType = trace.entityType;
19122
+ const entityName = trace.entityName;
19123
+ const isAgent = entityType === "agent";
19124
+ const isWorkflow = entityType === "workflow_run";
19125
+ const entityLink = isAgent && entityId ? paths.agentLink(entityId) : isWorkflow && entityId ? paths.workflowLink(entityId) : void 0;
18784
19126
  return [
18785
19127
  {
18786
19128
  key: "entityId",
18787
19129
  label: "Entity Id",
18788
19130
  value: [
18789
19131
  {
18790
- id: trace?.metadata?.resourceId,
18791
- name: trace?.attributes?.agentId || trace?.attributes?.workflowId || "-",
18792
- path: trace?.attributes?.agentId ? agentLink : trace?.attributes?.workflowId ? workflowLink : void 0
19132
+ id: entityId ?? "unknown",
19133
+ name: entityName || entityId || "-",
19134
+ path: entityLink
18793
19135
  }
18794
19136
  ]
18795
19137
  },
@@ -18798,9 +19140,9 @@ function useTraceInfo(trace) {
18798
19140
  label: "Entity Type",
18799
19141
  value: [
18800
19142
  {
18801
- id: trace?.attributes?.agentId || trace?.attributes?.workflowId,
18802
- name: trace?.attributes?.agentId ? "Agent" : trace?.attributes?.workflowId ? "Workflow" : "-",
18803
- path: trace?.attributes?.agentId ? agentsLink : trace?.attributes?.workflowId ? workflowsLink : void 0
19143
+ id: entityType ?? "unknown",
19144
+ name: entityType ?? "-",
19145
+ path: isAgent ? agentsLink : isWorkflow ? workflowsLink : void 0
18804
19146
  }
18805
19147
  ]
18806
19148
  },
@@ -18842,11 +19184,12 @@ function getSpanInfo({ span }) {
18842
19184
  value: span?.endedAt ? dateFns.format(new Date(span.endedAt), "MMM dd, h:mm:ss.SSS aaa") : "-"
18843
19185
  }
18844
19186
  ];
18845
- if (span?.attributes?.finishReason) {
19187
+ const finishReason = span?.attributes?.finishReason;
19188
+ if (finishReason) {
18846
19189
  baseInfo.push({
18847
19190
  key: "finishReason",
18848
19191
  label: "Finish Reason",
18849
- value: span.attributes.finishReason
19192
+ value: finishReason
18850
19193
  });
18851
19194
  }
18852
19195
  return baseInfo;
@@ -18949,9 +19292,10 @@ function TraceSpanUsage({ traceUsage, traceSpans = [], spanUsage, className }) {
18949
19292
  return null;
18950
19293
  }
18951
19294
  const generationSpans = traceSpans.filter((span) => span.spanType === "model_generation");
18952
- const hasV5Format = generationSpans.some(
18953
- (span) => span.attributes?.usage?.inputTokens !== void 0 || span.attributes?.usage?.outputTokens !== void 0
18954
- );
19295
+ const hasV5Format = generationSpans.some((span) => {
19296
+ const usage = span.attributes?.usage;
19297
+ return usage && "inputTokens" in usage;
19298
+ });
18955
19299
  const tokensByProvider = generationSpans.reduce(
18956
19300
  (acc, span) => {
18957
19301
  const spanUsage2 = span.attributes?.usage || {};
@@ -18979,8 +19323,8 @@ function TraceSpanUsage({ traceUsage, traceSpans = [], spanUsage, className }) {
18979
19323
  const v5Acc = acc[spanModelProvider];
18980
19324
  v5Acc.inputTokens += inputTokens;
18981
19325
  v5Acc.outputTokens += outputTokens;
18982
- v5Acc.reasoningTokens += reasoningTokens;
18983
- v5Acc.cachedInputTokens += cachedInputTokens;
19326
+ v5Acc.reasoningTokens = (v5Acc.reasoningTokens ?? 0) + reasoningTokens;
19327
+ v5Acc.cachedInputTokens = (v5Acc.cachedInputTokens ?? 0) + cachedInputTokens;
18984
19328
  v5Acc.totalTokens += spanUsage2.totalTokens || inputTokens + outputTokens;
18985
19329
  } else if ("promptTokens" in acc[spanModelProvider] && !hasV5Format) {
18986
19330
  const promptTokens = spanUsage2.promptTokens ?? 0;
@@ -19237,7 +19581,7 @@ function SpanTabs({
19237
19581
  ] })
19238
19582
  ] }),
19239
19583
  /* @__PURE__ */ jsxRuntime.jsx(Tabs.Content, { value: "details", children: /* @__PURE__ */ jsxRuntime.jsxs(Sections, { children: [
19240
- span?.attributes?.usage && /* @__PURE__ */ jsxRuntime.jsx(TraceSpanUsage, { spanUsage: span.attributes.usage }),
19584
+ span?.attributes?.usage ? /* @__PURE__ */ jsxRuntime.jsx(TraceSpanUsage, { spanUsage: span.attributes.usage }) : null,
19241
19585
  /* @__PURE__ */ jsxRuntime.jsx(KeyValueList, { data: spanInfo, LinkComponent: Link }),
19242
19586
  /* @__PURE__ */ jsxRuntime.jsx(SpanDetails, { span })
19243
19587
  ] }) }),
@@ -19771,7 +20115,7 @@ function TracesList({
19771
20115
  date: isTodayDate ? "Today" : dateFns.format(createdAtDate, "MMM dd"),
19772
20116
  time: dateFns.format(createdAtDate, "h:mm:ss aaa"),
19773
20117
  name: trace?.name,
19774
- entityId: trace?.attributes?.agentId || trace?.attributes?.workflowId,
20118
+ entityId: trace?.entityName || trace?.entityId || trace?.attributes?.agentId || trace?.attributes?.workflowId,
19775
20119
  status: trace?.attributes?.status
19776
20120
  };
19777
20121
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -19877,7 +20221,7 @@ function SpanScoreList({
19877
20221
  entry,
19878
20222
  children: traceScoresListColumns.map((col) => {
19879
20223
  const key = `col-${col.name}`;
19880
- return /* @__PURE__ */ jsxRuntime.jsx(EntryList.EntryText, { children: entry?.[col.name] }, key);
20224
+ return /* @__PURE__ */ jsxRuntime.jsx(EntryList.EntryText, { children: String(entry?.[col.name] ?? "") }, key);
19881
20225
  })
19882
20226
  },
19883
20227
  score.id
@@ -20515,9 +20859,7 @@ function MCPServerCombobox({
20515
20859
  searchPlaceholder = "Search MCP servers...",
20516
20860
  emptyText = "No MCP servers found.",
20517
20861
  className,
20518
- disabled = false,
20519
- buttonClassName = "h-8",
20520
- contentClassName
20862
+ disabled = false
20521
20863
  }) {
20522
20864
  const { data: mcpServers = [], isLoading, isError, error } = useMCPServers();
20523
20865
  const { navigate, paths } = useLinkComponent();
@@ -20549,8 +20891,7 @@ function MCPServerCombobox({
20549
20891
  emptyText,
20550
20892
  className,
20551
20893
  disabled: disabled || isLoading || isError,
20552
- buttonClassName,
20553
- contentClassName
20894
+ variant: "ghost"
20554
20895
  }
20555
20896
  );
20556
20897
  }
@@ -20719,6 +21060,292 @@ const StudioConfigForm = ({ initialConfig }) => {
20719
21060
  ] });
20720
21061
  };
20721
21062
 
21063
+ const useMastraPackages = () => {
21064
+ const client = react$1.useMastraClient();
21065
+ return reactQuery.useQuery({
21066
+ queryKey: ["mastra-packages"],
21067
+ queryFn: () => {
21068
+ return client.getSystemPackages();
21069
+ }
21070
+ });
21071
+ };
21072
+
21073
+ async function fetchPackageInfo(packageName, installedVersion) {
21074
+ const prereleaseComponents = semver.prerelease(installedVersion);
21075
+ const prereleaseTag = prereleaseComponents ? String(prereleaseComponents[0]) : null;
21076
+ try {
21077
+ const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}`);
21078
+ if (!response.ok) {
21079
+ return {
21080
+ name: packageName,
21081
+ version: installedVersion,
21082
+ latestVersion: null,
21083
+ isOutdated: false,
21084
+ isDeprecated: false,
21085
+ prereleaseTag,
21086
+ targetPrereleaseTag: null
21087
+ };
21088
+ }
21089
+ const data = await response.json();
21090
+ const latestVersion = data["dist-tags"]?.latest ?? null;
21091
+ const versionInfo = data.versions?.[installedVersion];
21092
+ const deprecationMessage = versionInfo?.deprecated;
21093
+ const targetPrereleaseComponents = latestVersion ? semver.prerelease(latestVersion) : null;
21094
+ const targetPrereleaseTag = targetPrereleaseComponents ? String(targetPrereleaseComponents[0]) : null;
21095
+ let isOutdated = false;
21096
+ if (latestVersion !== null && semver.valid(installedVersion) && semver.valid(latestVersion)) {
21097
+ isOutdated = semver.gt(latestVersion, installedVersion);
21098
+ }
21099
+ return {
21100
+ name: packageName,
21101
+ version: installedVersion,
21102
+ latestVersion,
21103
+ isOutdated,
21104
+ isDeprecated: !!deprecationMessage,
21105
+ prereleaseTag,
21106
+ targetPrereleaseTag,
21107
+ deprecationMessage
21108
+ };
21109
+ } catch {
21110
+ return {
21111
+ name: packageName,
21112
+ version: installedVersion,
21113
+ latestVersion: null,
21114
+ isOutdated: false,
21115
+ isDeprecated: false,
21116
+ prereleaseTag,
21117
+ targetPrereleaseTag: null
21118
+ };
21119
+ }
21120
+ }
21121
+ function usePackageUpdates(packages) {
21122
+ const queries = reactQuery.useQueries({
21123
+ queries: packages.map((pkg) => ({
21124
+ queryKey: ["package-update", pkg.name, pkg.version],
21125
+ queryFn: () => fetchPackageInfo(pkg.name, pkg.version),
21126
+ staleTime: 1e3 * 60 * 60,
21127
+ // 1 hour - latest versions don't change often
21128
+ gcTime: 1e3 * 60 * 60 * 24
21129
+ // 24 hours
21130
+ }))
21131
+ });
21132
+ const isLoading = queries.some((q) => q.isLoading);
21133
+ const packageUpdates = queries.map((q) => q.data).filter((p) => p !== void 0);
21134
+ const allComplete = !isLoading && packageUpdates.length === packages.length;
21135
+ const outdatedCount = allComplete ? packageUpdates.filter((p) => p.isOutdated && !p.isDeprecated).length : 0;
21136
+ const deprecatedCount = allComplete ? packageUpdates.filter((p) => p.isDeprecated).length : 0;
21137
+ return {
21138
+ packages: packageUpdates,
21139
+ isLoading,
21140
+ outdatedCount,
21141
+ deprecatedCount
21142
+ };
21143
+ }
21144
+
21145
+ const packageManagerCommands = {
21146
+ pnpm: "pnpm add",
21147
+ npm: "npm install",
21148
+ yarn: "yarn add",
21149
+ bun: "bun add"
21150
+ };
21151
+ const MastraVersionFooter = ({ collapsed }) => {
21152
+ const { data, isLoading: isLoadingPackages } = useMastraPackages();
21153
+ const installedPackages = data?.packages ?? [];
21154
+ const {
21155
+ packages: packageUpdates,
21156
+ isLoading: isLoadingUpdates,
21157
+ outdatedCount,
21158
+ deprecatedCount
21159
+ } = usePackageUpdates(installedPackages);
21160
+ const [packageManager, setPackageManager] = React.useState("pnpm");
21161
+ if (collapsed) {
21162
+ return null;
21163
+ }
21164
+ if (isLoadingPackages) {
21165
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-pulse h-4 bg-surface2 rounded w-16" }) });
21166
+ }
21167
+ const mastraCorePackage = installedPackages.find((pkg) => pkg.name === "@mastra/core");
21168
+ if (!mastraCorePackage && installedPackages.length === 0) {
21169
+ return null;
21170
+ }
21171
+ const mainVersion = mastraCorePackage?.version ?? installedPackages[0]?.version ?? "";
21172
+ const updateCommand = generateUpdateCommand(packageUpdates, packageManager);
21173
+ return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { children: [
21174
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "px-3 py-2 hover:bg-surface2 transition-colors rounded w-full text-left", children: [
21175
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1.5", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-sm", className: "text-accent1 font-mono", children: "mastra version:" }) }),
21176
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
21177
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-sm", className: "text-icon3 font-mono", children: mainVersion }),
21178
+ isLoadingUpdates && /* @__PURE__ */ jsxRuntime.jsx(Spinner, { className: "w-3 h-3", color: "currentColor" }),
21179
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center -space-x-1.5", children: [
21180
+ outdatedCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(CountBadge, { count: outdatedCount, variant: "warning" }),
21181
+ deprecatedCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(CountBadge, { count: deprecatedCount, variant: "error" })
21182
+ ] })
21183
+ ] })
21184
+ ] }) }),
21185
+ /* @__PURE__ */ jsxRuntime.jsx(
21186
+ PackagesModalContent,
21187
+ {
21188
+ packages: packageUpdates,
21189
+ isLoadingUpdates,
21190
+ outdatedCount,
21191
+ deprecatedCount,
21192
+ updateCommand,
21193
+ packageManager,
21194
+ onPackageManagerChange: setPackageManager
21195
+ }
21196
+ )
21197
+ ] });
21198
+ };
21199
+ function generateUpdateCommand(packages, packageManager) {
21200
+ const outdatedPackages = packages.filter((p) => p.isOutdated || p.isDeprecated);
21201
+ if (outdatedPackages.length === 0) return null;
21202
+ const command = packageManagerCommands[packageManager];
21203
+ const packageArgs = outdatedPackages.map((p) => `${p.name}@${p.targetPrereleaseTag ?? "latest"}`).join(" ");
21204
+ return `${command} ${packageArgs}`;
21205
+ }
21206
+ function CountBadge({ count, variant }) {
21207
+ return /* @__PURE__ */ jsxRuntime.jsx(
21208
+ "span",
21209
+ {
21210
+ className: cn(
21211
+ "inline-flex items-center justify-center min-w-[1.125rem] h-[1.125rem] px-1 rounded-full text-[0.625rem] font-bold text-black",
21212
+ variant === "error" ? "bg-red-700" : "bg-yellow-700"
21213
+ ),
21214
+ children: count
21215
+ }
21216
+ );
21217
+ }
21218
+ function StatusBadge({ value, variant }) {
21219
+ return /* @__PURE__ */ jsxRuntime.jsx(
21220
+ "span",
21221
+ {
21222
+ className: cn(
21223
+ "inline-flex font-bold rounded-md px-1.5 py-0.5 items-center justify-center text-black text-xs min-w-[1.25rem]",
21224
+ variant === "error" ? "bg-red-700" : "bg-yellow-700"
21225
+ ),
21226
+ children: value
21227
+ }
21228
+ );
21229
+ }
21230
+ const PackagesModalContent = ({
21231
+ packages,
21232
+ isLoadingUpdates,
21233
+ outdatedCount,
21234
+ deprecatedCount,
21235
+ updateCommand,
21236
+ packageManager,
21237
+ onPackageManagerChange
21238
+ }) => {
21239
+ const hasUpdates = outdatedCount > 0 || deprecatedCount > 0;
21240
+ const packagesText = packages.map((pkg) => `${pkg.name}@${pkg.version}`).join("\n");
21241
+ const { isCopied: isCopiedAll, handleCopy: handleCopyAll } = useCopyToClipboard({
21242
+ text: packagesText,
21243
+ copyMessage: "Copied package versions!"
21244
+ });
21245
+ const { isCopied: isCopiedCommand, handleCopy: handleCopyCommand } = useCopyToClipboard({
21246
+ text: updateCommand ?? "",
21247
+ copyMessage: "Copied update command!"
21248
+ });
21249
+ return /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "bg-surface1 border-border1 max-w-2xl", children: [
21250
+ /* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-text1", children: "Installed Mastra Packages" }) }),
21251
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-icon3 py-2", children: isLoadingUpdates ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-icon3", children: "Checking for updates..." }) : !hasUpdates ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent1", children: "✓ All packages are up to date" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
21252
+ outdatedCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
21253
+ /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { value: outdatedCount, variant: "warning" }),
21254
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
21255
+ "package",
21256
+ outdatedCount !== 1 ? "s" : "",
21257
+ " outdated"
21258
+ ] })
21259
+ ] }),
21260
+ deprecatedCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
21261
+ /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { value: deprecatedCount, variant: "error" }),
21262
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
21263
+ "package",
21264
+ deprecatedCount !== 1 ? "s" : "",
21265
+ " deprecated"
21266
+ ] })
21267
+ ] })
21268
+ ] }) }),
21269
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-64 overflow-y-auto border border-border1 rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-[1fr_auto_auto] text-sm", children: packages.map((pkg, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("contents", index > 0 && "[&>div]:border-t [&>div]:border-border1"), children: [
21270
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 px-3 font-mono text-text1 truncate min-w-0", children: /* @__PURE__ */ jsxRuntime.jsxs(
21271
+ "a",
21272
+ {
21273
+ href: `https://www.npmjs.com/package/${pkg.name}`,
21274
+ target: "_blank",
21275
+ rel: "noopener noreferrer",
21276
+ className: "hover:text-accent1 hover:underline inline-flex items-center gap-1 group",
21277
+ children: [
21278
+ pkg.name,
21279
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity" })
21280
+ ]
21281
+ }
21282
+ ) }),
21283
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 px-3 font-mono text-icon3 flex items-center gap-1.5", children: pkg.isOutdated || pkg.isDeprecated ? /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
21284
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
21285
+ "span",
21286
+ {
21287
+ className: cn(
21288
+ "cursor-help",
21289
+ pkg.isDeprecated ? "text-red-500" : pkg.isOutdated ? "text-yellow-500" : ""
21290
+ ),
21291
+ children: pkg.version
21292
+ }
21293
+ ) }),
21294
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: pkg.isDeprecated ? pkg.deprecationMessage || "This version is deprecated" : "Newer version available" })
21295
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: pkg.version }) }),
21296
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 px-3 font-mono text-icon3 flex items-center", children: (pkg.isOutdated || pkg.isDeprecated) && pkg.latestVersion && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
21297
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoveRight, { className: "w-4 h-4 mx-2 text-icon3" }),
21298
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent1", children: pkg.latestVersion })
21299
+ ] }) })
21300
+ ] }, pkg.name)) }) }),
21301
+ /* @__PURE__ */ jsxRuntime.jsxs(
21302
+ "button",
21303
+ {
21304
+ onClick: handleCopyAll,
21305
+ className: "flex items-center justify-center gap-2 w-full py-2 px-3 rounded bg-surface2 hover:bg-surface3 text-icon3 hover:text-icon1 transition-colors",
21306
+ children: [
21307
+ isCopiedAll ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-4 h-4 text-accent1" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-4 h-4" }),
21308
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-sm", children: isCopiedAll ? "Copied!" : "Copy current versions" })
21309
+ ]
21310
+ }
21311
+ ),
21312
+ hasUpdates && updateCommand && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 pt-2 border-t border-border1", children: [
21313
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-icon3 pt-3", children: [
21314
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "w-4 h-4" }),
21315
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Use the command below to update your packages" })
21316
+ ] }),
21317
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-center", children: [
21318
+ /* @__PURE__ */ jsxRuntime.jsx(
21319
+ SelectField,
21320
+ {
21321
+ value: packageManager,
21322
+ onValueChange: (value) => onPackageManagerChange(value),
21323
+ options: [
21324
+ { label: "pnpm", value: "pnpm" },
21325
+ { label: "npm", value: "npm" },
21326
+ { label: "yarn", value: "yarn" },
21327
+ { label: "bun", value: "bun" }
21328
+ ]
21329
+ }
21330
+ ),
21331
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "flex-1 text-sm text-icon3 bg-surface2 rounded-md px-3 py-1.5 overflow-x-auto whitespace-pre-wrap break-all", children: updateCommand })
21332
+ ] }),
21333
+ /* @__PURE__ */ jsxRuntime.jsxs(
21334
+ "button",
21335
+ {
21336
+ onClick: handleCopyCommand,
21337
+ className: "flex items-center justify-center gap-2 w-full py-2 px-3 rounded bg-surface2 hover:bg-surface3 text-icon3 hover:text-icon1 transition-colors",
21338
+ children: [
21339
+ isCopiedCommand ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-4 h-4 text-accent1" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-4 h-4" }),
21340
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-sm", children: isCopiedCommand ? "Copied!" : "Copy command" })
21341
+ ]
21342
+ }
21343
+ )
21344
+ ] })
21345
+ ] });
21346
+ };
21347
+ const MastraPackagesInfo = MastraVersionFooter;
21348
+
20722
21349
  const PlaygroundConfigGuard = () => {
20723
21350
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col h-screen w-full items-center justify-center bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-md w-full mx-auto px-4 pt-4", children: [
20724
21351
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(LogoWithoutText, { className: "size-32" }) }),
@@ -20738,6 +21365,7 @@ exports.AgentIcon = AgentIcon;
20738
21365
  exports.AgentInformation = AgentInformation;
20739
21366
  exports.AgentInformationLayout = AgentInformationLayout;
20740
21367
  exports.AgentInformationTabLayout = AgentInformationTabLayout;
21368
+ exports.AgentLayout = AgentLayout;
20741
21369
  exports.AgentMemory = AgentMemory;
20742
21370
  exports.AgentMetadata = AgentMetadata;
20743
21371
  exports.AgentMetadataList = AgentMetadataList;
@@ -20828,6 +21456,8 @@ exports.MainContentContent = MainContentContent;
20828
21456
  exports.MainContentLayout = MainContentLayout;
20829
21457
  exports.MainSidebar = MainSidebar;
20830
21458
  exports.MainSidebarProvider = MainSidebarProvider;
21459
+ exports.MastraPackagesInfo = MastraPackagesInfo;
21460
+ exports.MastraVersionFooter = MastraVersionFooter;
20831
21461
  exports.McpCoinIcon = McpCoinIcon;
20832
21462
  exports.McpServerIcon = McpServerIcon;
20833
21463
  exports.MemoryIcon = MemoryIcon;
@@ -20917,6 +21547,7 @@ exports.WorkflowCombobox = WorkflowCombobox;
20917
21547
  exports.WorkflowGraph = WorkflowGraph;
20918
21548
  exports.WorkflowIcon = WorkflowIcon;
20919
21549
  exports.WorkflowInformation = WorkflowInformation;
21550
+ exports.WorkflowLayout = WorkflowLayout;
20920
21551
  exports.WorkflowRunContext = WorkflowRunContext;
20921
21552
  exports.WorkflowRunDetail = WorkflowRunDetail;
20922
21553
  exports.WorkflowRunList = WorkflowRunList;
@@ -20931,6 +21562,7 @@ exports.convertWorkflowRunStateToStreamResult = convertWorkflowRunStateToStreamR
20931
21562
  exports.extractPrompt = extractPrompt;
20932
21563
  exports.formatHierarchicalSpans = formatHierarchicalSpans;
20933
21564
  exports.getColumnTemplate = getColumnTemplate;
21565
+ exports.getMainContentContentClassName = getMainContentContentClassName;
20934
21566
  exports.getShortId = getShortId;
20935
21567
  exports.getSpanTypeUi = getSpanTypeUi;
20936
21568
  exports.getToNextEntryFn = getToNextEntryFn;
@@ -20962,9 +21594,11 @@ exports.useMCPServerTool = useMCPServerTool;
20962
21594
  exports.useMCPServerTools = useMCPServerTools;
20963
21595
  exports.useMCPServers = useMCPServers;
20964
21596
  exports.useMainSidebar = useMainSidebar;
21597
+ exports.useMastraPackages = useMastraPackages;
20965
21598
  exports.useMemory = useMemory;
20966
21599
  exports.useMemoryConfig = useMemoryConfig;
20967
21600
  exports.useMemorySearch = useMemorySearch;
21601
+ exports.usePackageUpdates = usePackageUpdates;
20968
21602
  exports.usePlaygroundStore = usePlaygroundStore;
20969
21603
  exports.useReorderModelList = useReorderModelList;
20970
21604
  exports.useResetAgentModel = useResetAgentModel;