@mastra/playground-ui 5.1.12-alpha.0 → 5.1.13-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/index.cjs.js +1024 -56
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +1018 -58
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/src/components/assistant-ui/messages/reasoning.d.ts +3 -0
  6. package/dist/src/components/scrollable-container.d.ts +9 -0
  7. package/dist/src/domains/agents/components/agent-table/agent-table.d.ts +10 -0
  8. package/dist/src/domains/agents/components/agent-table/columns.d.ts +22 -0
  9. package/dist/src/domains/agents/components/agent-table/types.d.ts +12 -0
  10. package/dist/src/domains/agents/context/agent-working-memory-context.d.ts +21 -0
  11. package/dist/src/domains/agents/context/index.d.ts +2 -0
  12. package/dist/src/domains/agents/hooks/use-agent-working-memory.d.ts +10 -0
  13. package/dist/src/domains/agents/index.d.ts +2 -1
  14. package/dist/src/ds/components/Button/Button.d.ts +1 -0
  15. package/dist/src/ds/icons/AmazonIcon.d.ts +3 -0
  16. package/dist/src/ds/icons/AnthropicChatIcon.d.ts +3 -0
  17. package/dist/src/ds/icons/AnthropicMessagesIcon.d.ts +3 -0
  18. package/dist/src/ds/icons/AzureIcon.d.ts +3 -0
  19. package/dist/src/ds/icons/CohereIcon.d.ts +3 -0
  20. package/dist/src/ds/icons/GroqIcon.d.ts +3 -0
  21. package/dist/src/ds/icons/MistralIcon.d.ts +3 -0
  22. package/dist/src/ds/icons/OpenaiChatIcon.d.ts +3 -0
  23. package/dist/src/ds/icons/XGroqIcon.d.ts +3 -0
  24. package/dist/src/index.d.ts +1 -0
  25. package/dist/src/lib/framework.d.ts +12 -0
  26. package/dist/src/services/vnext-network-runtime-provider.d.ts +1 -1
  27. package/dist/src/types.d.ts +12 -2
  28. package/package.json +6 -5
package/dist/index.cjs.js CHANGED
@@ -33,6 +33,10 @@ const SliderPrimitive = require('@radix-ui/react-slider');
33
33
  const LabelPrimitive = require('@radix-ui/react-label');
34
34
  const RadioGroupPrimitive = require('@radix-ui/react-radio-group');
35
35
  const CollapsiblePrimitive = require('@radix-ui/react-collapsible');
36
+ const prettier = require('prettier');
37
+ const prettierPluginBabel = require('prettier/plugins/babel');
38
+ const prettierPluginEstree = require('prettier/plugins/estree');
39
+ const reactTable = require('@tanstack/react-table');
36
40
  const uiUtils = require('@ai-sdk/ui-utils');
37
41
  const Markdown = require('react-markdown');
38
42
  const react$2 = require('@xyflow/react');
@@ -40,11 +44,9 @@ require('@xyflow/react/dist/style.css');
40
44
  const Dagre = require('@dagrejs/dagre');
41
45
  const prismReactRenderer = require('prism-react-renderer');
42
46
  const ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
43
- const prettier = require('prettier');
44
- const prettierPluginBabel = require('prettier/plugins/babel');
45
- const prettierPluginEstree = require('prettier/plugins/estree');
46
47
  const useDebounce = require('use-debounce');
47
48
  const uuid = require('@lukeed/uuid');
49
+ const runtimeContext = require('@mastra/core/runtime-context');
48
50
  const jsonSchemaToZod = require('json-schema-to-zod');
49
51
  const superjson = require('superjson');
50
52
  const z = require('zod');
@@ -55,7 +57,6 @@ const PopoverPrimitive = require('@radix-ui/react-popover');
55
57
  const SelectPrimitive = require('@radix-ui/react-select');
56
58
  const zod = require('@autoform/zod');
57
59
  const reactCodeBlock = require('react-code-block');
58
- const reactTable = require('@tanstack/react-table');
59
60
 
60
61
  function _interopNamespaceDefault(e) {
61
62
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -4367,7 +4368,7 @@ const ToolFallback$1 = ({ toolName, argsText, result }) => {
4367
4368
  } catch {
4368
4369
  argSlot = /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: argsText });
4369
4370
  }
4370
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4371
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
4371
4372
  /* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: () => setIsCollapsed((s) => !s), className: "flex items-center gap-2", children: [
4372
4373
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: cn("transition-all", isCollapsed ? "rotate-90" : "rotate-180") }) }),
4373
4374
  /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, { className: "text-[#ECB047]" }), children: toolName })
@@ -4385,20 +4386,35 @@ const ToolFallback$1 = ({ toolName, argsText, result }) => {
4385
4386
  ] });
4386
4387
  };
4387
4388
 
4389
+ const Reasoning = ({ text }) => {
4390
+ const [isCollapsed, setIsCollapsed] = React.useState(false);
4391
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2 space-y-2", children: [
4392
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: () => setIsCollapsed((s) => !s), className: "flex items-center gap-2", children: [
4393
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: cn("transition-all", isCollapsed ? "rotate-90" : "rotate-180") }) }),
4394
+ /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BrainIcon, {}), children: [
4395
+ isCollapsed ? "Show" : "Hide",
4396
+ " reasoning"
4397
+ ] })
4398
+ ] }),
4399
+ !isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg bg-surface4 p-2 border-sm border-border-1", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap text-ui-sm leading-ui-sm text-icon6", children: text }) }) : null
4400
+ ] });
4401
+ };
4402
+
4388
4403
  const AssistantMessage = ({ ToolFallback: ToolFallbackCustom }) => {
4389
4404
  const data = react.useMessage();
4390
- const isSolelyToolCall = data.content.length === 1 && data.content[0].type === "tool-call";
4405
+ const isToolCallAndOrReasoning = data.content.every(({ type }) => type === "tool-call" || type === "reasoning");
4391
4406
  return /* @__PURE__ */ jsxRuntime.jsxs(react.MessagePrimitive.Root, { className: "max-w-full", children: [
4392
4407
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
4393
4408
  react.MessagePrimitive.Content,
4394
4409
  {
4395
4410
  components: {
4396
4411
  Text: MarkdownText,
4397
- tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
4412
+ tools: { Fallback: ToolFallbackCustom || ToolFallback$1 },
4413
+ Reasoning
4398
4414
  }
4399
4415
  }
4400
4416
  ) }),
4401
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar$1, {}) })
4417
+ !isToolCallAndOrReasoning && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar$1, {}) })
4402
4418
  ] });
4403
4419
  };
4404
4420
  const AssistantActionBar$1 = () => {
@@ -4965,6 +4981,108 @@ const CircleStopIcon$1 = () => {
4965
4981
  return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
4966
4982
  };
4967
4983
 
4984
+ function parseJsonString(jsonString) {
4985
+ try {
4986
+ return JSON.stringify(JSON.parse(jsonString), null, 2);
4987
+ } catch {
4988
+ return jsonString;
4989
+ }
4990
+ }
4991
+ function useAgentWorkingMemory(agentId, threadId, resourceId) {
4992
+ const client = useMastraClient();
4993
+ const [threadExists, setThreadExists] = React.useState(false);
4994
+ const [workingMemoryData, setWorkingMemoryData] = React.useState(null);
4995
+ const [workingMemorySource, setWorkingMemorySource] = React.useState("thread");
4996
+ const [workingMemoryFormat, setWorkingMemoryFormat] = React.useState("markdown");
4997
+ const [isLoading, setIsLoading] = React.useState(true);
4998
+ const [isUpdating, setIsUpdating] = React.useState(false);
4999
+ const refetch = React.useCallback(async () => {
5000
+ setIsLoading(true);
5001
+ try {
5002
+ if (!agentId || !threadId) {
5003
+ setWorkingMemoryData(null);
5004
+ setIsLoading(false);
5005
+ return;
5006
+ }
5007
+ const res = await client.getWorkingMemory({ agentId, threadId, resourceId });
5008
+ const { workingMemory, source, workingMemoryTemplate, threadExists: threadExists2 } = res;
5009
+ setThreadExists(threadExists2);
5010
+ setWorkingMemoryData(workingMemory);
5011
+ setWorkingMemorySource(source);
5012
+ setWorkingMemoryFormat(workingMemoryTemplate?.format || "markdown");
5013
+ if (workingMemoryTemplate?.format === "json") {
5014
+ let dataToSet = "";
5015
+ if (workingMemory) {
5016
+ dataToSet = parseJsonString(workingMemory);
5017
+ } else if (workingMemoryTemplate?.content) {
5018
+ dataToSet = parseJsonString(workingMemoryTemplate.content);
5019
+ } else {
5020
+ dataToSet = "";
5021
+ }
5022
+ setWorkingMemoryData(dataToSet);
5023
+ } else {
5024
+ setWorkingMemoryData(workingMemory || workingMemoryTemplate?.content || "");
5025
+ }
5026
+ } catch (error) {
5027
+ setWorkingMemoryData(null);
5028
+ console.error("Error fetching working memory", error);
5029
+ } finally {
5030
+ setIsLoading(false);
5031
+ }
5032
+ }, [agentId, threadId, resourceId]);
5033
+ React.useEffect(() => {
5034
+ refetch();
5035
+ }, [refetch]);
5036
+ const updateWorkingMemory = async (newMemory) => {
5037
+ setIsUpdating(true);
5038
+ try {
5039
+ if (workingMemoryFormat === "json") {
5040
+ try {
5041
+ JSON.parse(newMemory);
5042
+ } catch (e) {
5043
+ throw new Error("Invalid JSON working memory");
5044
+ }
5045
+ }
5046
+ await client.updateWorkingMemory({ agentId, threadId, workingMemory: newMemory, resourceId });
5047
+ refetch();
5048
+ } catch (error) {
5049
+ console.error("Error updating working memory", error);
5050
+ throw error;
5051
+ } finally {
5052
+ setIsUpdating(false);
5053
+ }
5054
+ };
5055
+ return {
5056
+ threadExists,
5057
+ workingMemoryData,
5058
+ workingMemorySource,
5059
+ workingMemoryFormat,
5060
+ isLoading,
5061
+ isUpdating,
5062
+ refetch,
5063
+ updateWorkingMemory
5064
+ };
5065
+ }
5066
+
5067
+ const WorkingMemoryContext = React.createContext({
5068
+ threadExists: false,
5069
+ workingMemoryData: null,
5070
+ workingMemorySource: "thread",
5071
+ isLoading: false,
5072
+ isUpdating: false,
5073
+ updateWorkingMemory: () => Promise.resolve(),
5074
+ refetch: () => Promise.resolve()
5075
+ });
5076
+ function WorkingMemoryProvider({ agentId, threadId, resourceId, children }) {
5077
+ const value = useAgentWorkingMemory(agentId, threadId, resourceId);
5078
+ return /* @__PURE__ */ jsxRuntime.jsx(WorkingMemoryContext.Provider, { value, children });
5079
+ }
5080
+ function useWorkingMemory() {
5081
+ const ctx = React.useContext(WorkingMemoryContext);
5082
+ if (!ctx) throw new Error("useWorkingMemory must be used within a WorkingMemoryProvider");
5083
+ return ctx;
5084
+ }
5085
+
4968
5086
  class PDFAttachmentAdapter {
4969
5087
  accept = "application/pdf";
4970
5088
  async add({ file }) {
@@ -5076,6 +5194,7 @@ function MastraRuntimeProvider({
5076
5194
  const [isRunning, setIsRunning] = React.useState(false);
5077
5195
  const [messages, setMessages] = React.useState([]);
5078
5196
  const [currentThreadId, setCurrentThreadId] = React.useState(threadId);
5197
+ const { refetch: refreshWorkingMemory } = useWorkingMemory();
5079
5198
  const {
5080
5199
  frequencyPenalty,
5081
5200
  presencePenalty,
@@ -5086,8 +5205,10 @@ function MastraRuntimeProvider({
5086
5205
  topK,
5087
5206
  topP,
5088
5207
  instructions,
5089
- chatWithGenerate
5208
+ chatWithGenerate,
5209
+ providerOptions
5090
5210
  } = settings?.modelSettings ?? {};
5211
+ const toolCallIdToName = React.useRef({});
5091
5212
  const runtimeContextInstance = new di.RuntimeContext();
5092
5213
  Object.entries(runtimeContext ?? {}).forEach(([key, value]) => {
5093
5214
  runtimeContextInstance.set(key, value);
@@ -5109,9 +5230,11 @@ function MastraRuntimeProvider({
5109
5230
  mimeType: image.contentType,
5110
5231
  image: image.url
5111
5232
  }));
5233
+ const reasoning = message?.parts?.find(({ type }) => type === "reasoning")?.details?.map((detail) => detail?.text)?.join(" ");
5112
5234
  return {
5113
5235
  ...message,
5114
5236
  content: [
5237
+ ...reasoning ? [{ type: "reasoning", text: reasoning }] : [],
5115
5238
  ...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
5116
5239
  ...toolInvocationsAsContentParts,
5117
5240
  ...attachmentsAsContentParts
@@ -5155,7 +5278,8 @@ function MastraRuntimeProvider({
5155
5278
  topP,
5156
5279
  instructions,
5157
5280
  runtimeContext: runtimeContextInstance,
5158
- ...memory ? { threadId, resourceId: agentId } : {}
5281
+ ...memory ? { threadId, resourceId: agentId } : {},
5282
+ providerOptions
5159
5283
  });
5160
5284
  if (generateResponse.response) {
5161
5285
  const latestMessage = generateResponse.response.messages.reduce(
@@ -5166,6 +5290,7 @@ function MastraRuntimeProvider({
5166
5290
  ...acc,
5167
5291
  content: [
5168
5292
  ..._content,
5293
+ ...generateResponse.reasoning ? [{ type: "reasoning", text: generateResponse.reasoning }] : [],
5169
5294
  {
5170
5295
  type: "text",
5171
5296
  text: message2.content
@@ -5175,6 +5300,7 @@ function MastraRuntimeProvider({
5175
5300
  }
5176
5301
  if (message2.role === "assistant") {
5177
5302
  const toolCallContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "tool-call") : void 0;
5303
+ const reasoningContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "reasoning") : void 0;
5178
5304
  if (toolCallContent) {
5179
5305
  const newContent = _content.map((c) => {
5180
5306
  if (c.type === "tool-call" && c.toolCallId === toolCallContent?.toolCallId) {
@@ -5185,14 +5311,14 @@ function MastraRuntimeProvider({
5185
5311
  const containsToolCall = newContent.some((c) => c.type === "tool-call");
5186
5312
  return {
5187
5313
  ...acc,
5188
- content: containsToolCall ? newContent : [..._content, toolCallContent]
5314
+ content: containsToolCall ? [...reasoningContent ? [reasoningContent] : [], ...newContent] : [..._content, ...reasoningContent ? [reasoningContent] : [], toolCallContent]
5189
5315
  };
5190
5316
  }
5191
5317
  const textContent = Array.isArray(message2.content) ? message2.content.find((content) => content.type === "text" && content.text) : void 0;
5192
5318
  if (textContent) {
5193
5319
  return {
5194
5320
  ...acc,
5195
- content: [..._content, textContent]
5321
+ content: [..._content, ...reasoningContent ? [reasoningContent] : [], textContent]
5196
5322
  };
5197
5323
  }
5198
5324
  }
@@ -5266,7 +5392,8 @@ function MastraRuntimeProvider({
5266
5392
  topP,
5267
5393
  instructions,
5268
5394
  runtimeContext: runtimeContextInstance,
5269
- ...memory ? { threadId, resourceId: agentId } : {}
5395
+ ...memory ? { threadId, resourceId: agentId } : {},
5396
+ providerOptions
5270
5397
  });
5271
5398
  if (!response.body) {
5272
5399
  throw new Error("No response body");
@@ -5329,6 +5456,7 @@ function MastraRuntimeProvider({
5329
5456
  assistantToolCallAddedForContent = true;
5330
5457
  return [...currentConversation, newMessage];
5331
5458
  });
5459
+ toolCallIdToName.current[value.toolCallId] = value.toolName;
5332
5460
  },
5333
5461
  async onToolResultPart(value) {
5334
5462
  setMessages((currentConversation) => {
@@ -5351,12 +5479,52 @@ function MastraRuntimeProvider({
5351
5479
  }
5352
5480
  return currentConversation;
5353
5481
  });
5482
+ try {
5483
+ const toolName = toolCallIdToName.current[value.toolCallId];
5484
+ if (toolName === "updateWorkingMemory" && value.result?.success) {
5485
+ await refreshWorkingMemory?.();
5486
+ }
5487
+ } finally {
5488
+ delete toolCallIdToName.current[value.toolCallId];
5489
+ }
5354
5490
  },
5355
5491
  onErrorPart(error) {
5356
5492
  throw new Error(error);
5357
5493
  },
5358
5494
  onFinishMessagePart({ finishReason }) {
5359
5495
  handleFinishReason(finishReason);
5496
+ },
5497
+ onReasoningPart(value) {
5498
+ setMessages((currentConversation) => {
5499
+ const lastMessage = currentConversation[currentConversation.length - 1];
5500
+ if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
5501
+ const updatedContent = lastMessage.content.map((part) => {
5502
+ if (typeof part === "object" && part.type === "reasoning") {
5503
+ return {
5504
+ ...part,
5505
+ text: part.text + value
5506
+ };
5507
+ }
5508
+ return part;
5509
+ });
5510
+ const updatedMessage = {
5511
+ ...lastMessage,
5512
+ content: updatedContent
5513
+ };
5514
+ return [...currentConversation.slice(0, -1), updatedMessage];
5515
+ }
5516
+ const newMessage = {
5517
+ role: "assistant",
5518
+ content: [
5519
+ {
5520
+ type: "reasoning",
5521
+ text: value
5522
+ },
5523
+ { type: "text", text: content }
5524
+ ]
5525
+ };
5526
+ return [...currentConversation, newMessage];
5527
+ });
5360
5528
  }
5361
5529
  });
5362
5530
  }
@@ -6709,13 +6877,79 @@ const Collapsible = CollapsiblePrimitive__namespace.Root;
6709
6877
  const CollapsibleTrigger = CollapsiblePrimitive__namespace.CollapsibleTrigger;
6710
6878
  const CollapsibleContent = CollapsiblePrimitive__namespace.CollapsibleContent;
6711
6879
 
6880
+ const formatJSON = async (code) => {
6881
+ const formatted = await prettier.format(code, {
6882
+ semi: false,
6883
+ parser: "json",
6884
+ printWidth: 80,
6885
+ tabWidth: 2,
6886
+ plugins: [prettierPluginBabel, prettierPluginEstree]
6887
+ });
6888
+ return formatted;
6889
+ };
6890
+ const isValidJson = (str) => {
6891
+ try {
6892
+ const obj = JSON.parse(str);
6893
+ return !!obj && typeof obj === "object";
6894
+ } catch (e) {
6895
+ return false;
6896
+ }
6897
+ };
6898
+
6712
6899
  const AgentAdvancedSettings = () => {
6713
6900
  const { settings, setSettings } = useAgentSettings();
6714
6901
  const [isOpen, setIsOpen] = React.useState(false);
6902
+ const [providerOptionsValue, setProviderOptionsValue] = React.useState("");
6903
+ const [saved, setSaved] = React.useState(false);
6904
+ const [error, setError] = React.useState(null);
6905
+ const theme = useCodemirrorTheme();
6906
+ const { handleCopy } = useCopyToClipboard({ text: providerOptionsValue });
6907
+ const providerOptionsStr = JSON.stringify(settings?.modelSettings?.providerOptions ?? {});
6908
+ React.useEffect(() => {
6909
+ const run = async () => {
6910
+ if (!isValidJson(providerOptionsStr)) {
6911
+ setError("Invalid JSON");
6912
+ return;
6913
+ }
6914
+ const formatted = await formatJSON(providerOptionsStr);
6915
+ setProviderOptionsValue(formatted);
6916
+ };
6917
+ run();
6918
+ }, [providerOptionsStr]);
6919
+ const formatProviderOptions = async () => {
6920
+ setError(null);
6921
+ if (!isValidJson(providerOptionsValue)) {
6922
+ setError("Invalid JSON");
6923
+ return;
6924
+ }
6925
+ const formatted = await formatJSON(providerOptionsValue);
6926
+ setProviderOptionsValue(formatted);
6927
+ };
6928
+ const saveProviderOptions = async () => {
6929
+ try {
6930
+ setError(null);
6931
+ const parsedContext = JSON.parse(providerOptionsValue);
6932
+ setSettings({
6933
+ ...settings,
6934
+ modelSettings: {
6935
+ ...settings?.modelSettings,
6936
+ providerOptions: parsedContext
6937
+ }
6938
+ });
6939
+ setSaved(true);
6940
+ setTimeout(() => {
6941
+ setSaved(false);
6942
+ }, 1e3);
6943
+ } catch (error2) {
6944
+ console.error("error", error2);
6945
+ setError("Invalid JSON");
6946
+ }
6947
+ };
6715
6948
  const collapsibleClassName = "rounded-lg border-sm border-border1 bg-surface3 overflow-clip";
6716
6949
  const collapsibleTriggerClassName = "text-icon3 text-ui-lg font-medium flex items-center gap-2 w-full p-[10px] justify-between";
6717
6950
  const collapsibleContentClassName = "bg-surface2 p-[10px] grid grid-cols-2 gap-[10px]";
6718
- return /* @__PURE__ */ jsxRuntime.jsxs(Collapsible, { className: collapsibleClassName, open: isOpen, onOpenChange: setIsOpen, children: [
6951
+ const buttonClass = "text-icon3 hover:text-icon6";
6952
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Collapsible, { className: collapsibleClassName, open: isOpen, onOpenChange: setIsOpen, children: [
6719
6953
  /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleTrigger, { className: collapsibleTriggerClassName, children: [
6720
6954
  "Advanced Settings",
6721
6955
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: cn("transition-transform", isOpen ? "rotate-0" : "-rotate-90"), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {}) })
@@ -6828,9 +7062,39 @@ const AgentAdvancedSettings = () => {
6828
7062
  })
6829
7063
  }
6830
7064
  )
7065
+ ] }),
7066
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 col-span-2", children: [
7067
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
7068
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "provider-options", children: "Provider Options" }),
7069
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
7070
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
7071
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: formatProviderOptions, className: buttonClass, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {}) }) }) }),
7072
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Format the Provider Options JSON" })
7073
+ ] }),
7074
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
7075
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleCopy, className: buttonClass, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) }) }) }),
7076
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Copy Provider Options" })
7077
+ ] }),
7078
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
7079
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: saveProviderOptions, className: buttonClass, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: saved ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SaveIcon, {}) }) }) }),
7080
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: saved ? "Saved" : "Save Provider Options" })
7081
+ ] })
7082
+ ] })
7083
+ ] }),
7084
+ /* @__PURE__ */ jsxRuntime.jsx(
7085
+ CodeMirror,
7086
+ {
7087
+ value: providerOptionsValue,
7088
+ onChange: setProviderOptionsValue,
7089
+ theme,
7090
+ extensions: [langJson.jsonLanguage],
7091
+ className: "h-[300px] overflow-scroll rounded-lg border bg-transparent shadow-sm focus-visible:ring-ring transition-colors focus-visible:outline-none focus-visible:ring-1 p-2"
7092
+ }
7093
+ ),
7094
+ error && /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-md", className: "text-accent2", children: error })
6831
7095
  ] })
6832
7096
  ] })
6833
- ] });
7097
+ ] }) });
6834
7098
  };
6835
7099
 
6836
7100
  const AgentSettings = () => {
@@ -6902,6 +7166,728 @@ const AgentSettings = () => {
6902
7166
  ] });
6903
7167
  };
6904
7168
 
7169
+ const EmptyState = ({
7170
+ iconSlot,
7171
+ titleSlot,
7172
+ descriptionSlot,
7173
+ actionSlot,
7174
+ as: Component = "div"
7175
+ }) => {
7176
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[340px] flex-col items-center justify-center text-center", children: [
7177
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-auto [&>svg]:w-[126px]", children: iconSlot }),
7178
+ /* @__PURE__ */ jsxRuntime.jsx(Component, { className: "text-icon6 pt-[34px] font-serif text-[1.75rem] font-semibold", children: titleSlot }),
7179
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-lg", className: "text-icon3 pb-[34px]", children: descriptionSlot }),
7180
+ actionSlot
7181
+ ] });
7182
+ };
7183
+
7184
+ const INDICATOR_WIDTH = 40;
7185
+ const INDICATOR_HEIGHT = 150;
7186
+ const INDICATOR_SPACE = 10;
7187
+ const ScrollableContainer = ({
7188
+ className,
7189
+ children,
7190
+ scrollSpeed = 100,
7191
+ scrollIntervalTime = 20
7192
+ }) => {
7193
+ const containerRef = React.useRef(null);
7194
+ const scrollInterval = React.useRef(null);
7195
+ const [containerHeight, setContainerHeight] = React.useState(0);
7196
+ const [containerRight, setContainerRight] = React.useState(0);
7197
+ const [containerTop, setContainerTop] = React.useState(0);
7198
+ const [containerLeft, setContainerLeft] = React.useState(0);
7199
+ const [showRightIndicator, setShowRightIndicator] = React.useState(false);
7200
+ const [showLeftIndicator, setShowLeftIndicator] = React.useState(false);
7201
+ React.useEffect(() => {
7202
+ const updatePositions = () => {
7203
+ if (!containerRef.current) return;
7204
+ const canScrollRight = containerRef.current.scrollLeft < containerRef.current.scrollWidth - containerRef.current.clientWidth;
7205
+ setShowRightIndicator(canScrollRight);
7206
+ setContainerHeight(containerRef.current.clientHeight);
7207
+ const rect = containerRef.current.getBoundingClientRect();
7208
+ setContainerRight(rect.right);
7209
+ setContainerLeft(rect.left);
7210
+ setContainerTop(rect.top);
7211
+ };
7212
+ updatePositions();
7213
+ const resizeObserver = new ResizeObserver(updatePositions);
7214
+ if (containerRef.current) {
7215
+ resizeObserver.observe(containerRef.current);
7216
+ }
7217
+ const handleScroll = () => {
7218
+ if (!containerRef.current) return;
7219
+ const canScrollLeft = containerRef.current.scrollLeft > 0;
7220
+ const canScrollRight = containerRef.current.scrollLeft < containerRef.current.scrollWidth - containerRef.current.clientWidth;
7221
+ setShowLeftIndicator(canScrollLeft);
7222
+ setShowRightIndicator(canScrollRight);
7223
+ updatePositions();
7224
+ };
7225
+ containerRef?.current?.addEventListener("scroll", handleScroll);
7226
+ const container = containerRef.current;
7227
+ return () => {
7228
+ if (container) {
7229
+ resizeObserver.unobserve(container);
7230
+ container.removeEventListener("scroll", handleScroll);
7231
+ }
7232
+ };
7233
+ }, []);
7234
+ const ScrollIndicator = ({
7235
+ isVisible,
7236
+ position,
7237
+ containerHeight: containerHeight2,
7238
+ containerTop: containerTop2,
7239
+ containerRight: containerRight2,
7240
+ onStartScrolling,
7241
+ onStopScrolling
7242
+ }) => {
7243
+ if (!isVisible) return null;
7244
+ const styles = {
7245
+ top: containerHeight2 < INDICATOR_HEIGHT ? containerTop2 : containerTop2 + (containerHeight2 - INDICATOR_HEIGHT) / 2,
7246
+ width: INDICATOR_WIDTH,
7247
+ height: containerHeight2 < INDICATOR_HEIGHT ? `${containerHeight2}px` : `${INDICATOR_HEIGHT}px`
7248
+ };
7249
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7250
+ "button",
7251
+ {
7252
+ onMouseDown: onStartScrolling,
7253
+ onTouchStart: onStartScrolling,
7254
+ onMouseUp: onStopScrolling,
7255
+ onTouchEnd: onStopScrolling,
7256
+ onTouchCancel: onStopScrolling,
7257
+ className: "bg-surface4 text-muted-foreground border-surface5 hover:border-muted-foreground fixed z-10 flex items-center justify-center rounded-lg border text-2xl hover:text-white",
7258
+ style: {
7259
+ ...styles,
7260
+ left: position === "left" ? containerLeft + INDICATOR_SPACE : containerRight2 - INDICATOR_WIDTH - INDICATOR_SPACE
7261
+ },
7262
+ children: [
7263
+ " ",
7264
+ position === "left" ? "«" : "»"
7265
+ ]
7266
+ }
7267
+ );
7268
+ };
7269
+ const startScrolling = React.useCallback(
7270
+ (direction, e) => {
7271
+ e?.preventDefault();
7272
+ e?.stopPropagation();
7273
+ if (scrollInterval.current) {
7274
+ clearInterval(scrollInterval.current);
7275
+ scrollInterval.current = null;
7276
+ }
7277
+ if (containerRef.current) {
7278
+ containerRef.current.scrollBy({
7279
+ left: direction === "right" ? scrollSpeed * 2 : -scrollSpeed * 2,
7280
+ behavior: "smooth"
7281
+ });
7282
+ }
7283
+ scrollInterval.current = setInterval(() => {
7284
+ if (containerRef.current) {
7285
+ containerRef.current.scrollBy({
7286
+ left: direction === "right" ? scrollSpeed : -scrollSpeed,
7287
+ behavior: "smooth"
7288
+ });
7289
+ }
7290
+ }, scrollIntervalTime);
7291
+ },
7292
+ [scrollSpeed, scrollIntervalTime]
7293
+ );
7294
+ const stopScrolling = React.useCallback(() => {
7295
+ if (scrollInterval.current) {
7296
+ clearInterval(scrollInterval.current);
7297
+ scrollInterval.current = null;
7298
+ }
7299
+ }, []);
7300
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: clsx("relative max-h-full overflow-auto", className), children: [
7301
+ children,
7302
+ /* @__PURE__ */ jsxRuntime.jsx(
7303
+ ScrollIndicator,
7304
+ {
7305
+ isVisible: showLeftIndicator,
7306
+ position: "left",
7307
+ containerHeight,
7308
+ containerTop,
7309
+ containerRight,
7310
+ onStartScrolling: (e) => startScrolling("left", e),
7311
+ onStopScrolling: stopScrolling
7312
+ }
7313
+ ),
7314
+ /* @__PURE__ */ jsxRuntime.jsx(
7315
+ ScrollIndicator,
7316
+ {
7317
+ isVisible: showRightIndicator,
7318
+ position: "right",
7319
+ containerHeight,
7320
+ containerTop,
7321
+ containerRight,
7322
+ onStartScrolling: (e) => startScrolling("right", e),
7323
+ onStopScrolling: stopScrolling
7324
+ }
7325
+ )
7326
+ ] });
7327
+ };
7328
+
7329
+ function Skeleton({ className, ...props }) {
7330
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("animate-pulse rounded-md bg-muted/50", className), ...props });
7331
+ }
7332
+
7333
+ const OpenaiChatIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "h-3 w-3", viewBox: "0 0 320 320", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z" }) });
7334
+
7335
+ const AnthropicChatIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "h-3 w-3", viewBox: "0 0 320 320", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z" }) });
7336
+
7337
+ const AnthropicMessagesIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
7338
+ "svg",
7339
+ {
7340
+ className: "h-3 w-3",
7341
+ fill: "white",
7342
+ height: "78",
7343
+ strokeLinejoin: "round",
7344
+ viewBox: "0 0 16 16",
7345
+ width: "78",
7346
+ style: { color: "currentcolor" },
7347
+ ...props,
7348
+ children: /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(0,2)", children: /* @__PURE__ */ jsxRuntime.jsx(
7349
+ "path",
7350
+ {
7351
+ d: "M11.375 0h-2.411L13.352 11.13h2.411L11.375 0ZM4.4 0 0 11.13h2.46l0.9-2.336h4.604l0.9 2.336h2.46L6.924 0H4.4Zm-0.244 6.723 1.506-3.909 1.506 3.909H4.156Z",
7352
+ fill: "currentColor"
7353
+ }
7354
+ ) })
7355
+ }
7356
+ );
7357
+
7358
+ const AzureIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
7359
+ "svg",
7360
+ {
7361
+ className: "h-3 w-3",
7362
+ xmlns: "http://www.w3.org/2000/svg",
7363
+ width: "16",
7364
+ height: "16",
7365
+ viewBox: "0 0 16 16",
7366
+ fill: "none",
7367
+ ...props,
7368
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7369
+ "path",
7370
+ {
7371
+ d: "M7.402 13.8777C9.45763 13.4674 11.1555 13.128 11.175 13.1233L11.2104 13.1148L9.2697 10.507C8.2023 9.07276 7.32898 7.8937 7.32898 7.88691C7.32898 7.87404 9.33293 1.63997 9.3442 1.61779C9.34797 1.61037 10.7117 4.27017 12.65 8.06532C14.4647 11.6184 15.9608 14.5479 15.9747 14.5754L16 14.6253L9.83224 14.6244L3.66449 14.6235L7.402 13.8777ZM0 13.0824C0 13.0787 0.914457 11.2855 2.03212 9.09735L4.06425 5.11896L6.43245 2.87384C7.73497 1.63902 8.80417 0.627201 8.80845 0.625356C8.81274 0.623511 8.79561 0.672228 8.77038 0.733617C8.74515 0.795006 7.58796 3.59893 6.19884 6.96455L3.67317 13.0839L1.83659 13.0865C0.826464 13.0879 0 13.0861 0 13.0824Z",
7372
+ fill: "#0089D6",
7373
+ style: { fill: "#0089D6", fillOpacity: 1 }
7374
+ }
7375
+ )
7376
+ }
7377
+ );
7378
+
7379
+ const AmazonIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
7380
+ "svg",
7381
+ {
7382
+ className: "h-3 w-3",
7383
+ width: "16",
7384
+ height: "16",
7385
+ viewBox: "0 0 181 108",
7386
+ fill: "none",
7387
+ xmlns: "http://www.w3.org/2000/svg",
7388
+ ...props,
7389
+ children: [
7390
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_1480_1723)", children: [
7391
+ /* @__PURE__ */ jsxRuntime.jsx(
7392
+ "path",
7393
+ {
7394
+ d: "M51.2203 39.3158C51.2203 41.5066 51.4572 43.2829 51.8717 44.5856C52.3453 45.8882 52.9374 47.3093 53.7664 48.8487C54.0624 49.3224 54.1809 49.7961 54.1809 50.2106C54.1809 50.8027 53.8256 51.3948 53.0559 51.9869L49.3256 54.4737C48.7927 54.829 48.2598 55.0066 47.7861 55.0066C47.194 55.0066 46.6019 54.7106 46.0098 54.1777C45.1809 53.2895 44.4703 52.3422 43.8782 51.3948C43.2861 50.3882 42.694 49.2632 42.0427 47.9014C37.4243 53.3487 31.6217 56.0724 24.6348 56.0724C19.6611 56.0724 15.694 54.6514 12.7927 51.8093C9.8914 48.9672 8.41113 45.1777 8.41113 40.4408C8.41113 35.4079 10.1874 31.3224 13.7993 28.2435C17.4111 25.1645 22.2072 23.6251 28.3059 23.6251C30.319 23.6251 32.3914 23.8027 34.5822 24.0987C36.773 24.3948 39.023 24.8685 41.3914 25.4014V21.079C41.3914 16.579 40.444 13.4408 38.6085 11.6053C36.7138 9.76979 33.5164 8.88163 28.9572 8.88163C26.8848 8.88163 24.7532 9.11847 22.5624 9.65137C20.3717 10.1843 18.2401 10.8356 16.1677 11.6645C15.2203 12.079 14.5098 12.3158 14.0953 12.4343C13.6809 12.5527 13.3848 12.6119 13.148 12.6119C12.319 12.6119 11.9046 12.0198 11.9046 10.7764V7.87505C11.9046 6.92768 12.023 6.21716 12.319 5.80268C12.6151 5.38821 13.148 4.97374 13.9769 4.55926C16.0493 3.49347 18.5361 2.60531 21.4374 1.89479C24.3388 1.12505 27.4177 0.769788 30.6743 0.769788C37.7203 0.769788 42.8717 2.36847 46.1875 5.56584C49.444 8.76321 51.1019 13.6185 51.1019 20.1316V39.3158H51.2203ZM27.1809 48.3158C29.1348 48.3158 31.148 47.9606 33.2796 47.2501C35.4111 46.5395 37.3059 45.2369 38.9046 43.4606C39.8519 42.3356 40.5625 41.0922 40.9177 39.6711C41.273 38.2501 41.5098 36.5329 41.5098 34.5198V32.0329C39.7927 31.6185 37.9572 31.2632 36.0624 31.0264C34.1677 30.7895 32.3322 30.6711 30.4967 30.6711C26.5296 30.6711 23.6282 31.4408 21.6743 33.0395C19.7203 34.6382 18.773 36.8882 18.773 39.8487C18.773 42.6316 19.4835 44.704 20.9638 46.1251C22.3848 47.6053 24.4572 48.3158 27.1809 48.3158ZM74.7269 54.7106C73.6611 54.7106 72.9506 54.5329 72.4769 54.1185C72.0032 53.7632 71.5888 52.9343 71.2335 51.8093L57.319 6.03953C56.9638 4.85531 56.7861 4.08558 56.7861 3.6711C56.7861 2.72374 57.2598 2.19084 58.2072 2.19084H64.0098C65.1348 2.19084 65.9046 2.36847 66.319 2.78295C66.7927 3.13821 67.148 3.96716 67.5032 5.09216L77.4506 44.2895L86.6874 5.09216C86.9835 3.90795 87.3388 3.13821 87.8124 2.78295C88.2861 2.42768 89.1151 2.19084 90.1809 2.19084H94.9177C96.0427 2.19084 96.8124 2.36847 97.2861 2.78295C97.7598 3.13821 98.1743 3.96716 98.4111 5.09216L107.766 44.7632L118.01 5.09216C118.365 3.90795 118.78 3.13821 119.194 2.78295C119.668 2.42768 120.437 2.19084 121.503 2.19084H127.01C127.957 2.19084 128.49 2.66453 128.49 3.6711C128.49 3.96716 128.431 4.26321 128.372 4.61847C128.312 4.97374 128.194 5.44742 127.957 6.09874L113.687 51.8685C113.332 53.0527 112.918 53.8224 112.444 54.1777C111.97 54.5329 111.201 54.7698 110.194 54.7698H105.102C103.977 54.7698 103.207 54.5922 102.733 54.1777C102.26 53.7632 101.845 52.9935 101.608 51.8093L92.4309 13.6185L83.3125 51.7501C83.0164 52.9343 82.6611 53.704 82.1874 54.1185C81.7138 54.5329 80.8848 54.7106 79.819 54.7106H74.7269ZM150.812 56.3093C147.734 56.3093 144.655 55.954 141.694 55.2435C138.733 54.5329 136.424 53.7632 134.885 52.8751C133.937 52.3422 133.286 51.7501 133.049 51.2172C132.812 50.6843 132.694 50.0922 132.694 49.5593V46.5395C132.694 45.2961 133.168 44.704 134.056 44.704C134.411 44.704 134.766 44.7632 135.122 44.8816C135.477 45.0001 136.01 45.2369 136.602 45.4737C138.615 46.3619 140.806 47.0724 143.115 47.5461C145.484 48.0198 147.793 48.2566 150.161 48.2566C153.891 48.2566 156.793 47.6053 158.806 46.3027C160.819 45 161.885 43.1053 161.885 40.6777C161.885 39.0198 161.352 37.6579 160.286 36.5329C159.22 35.4079 157.207 34.4014 154.306 33.454L145.72 30.7895C141.398 29.4277 138.201 27.4145 136.247 24.7501C134.293 22.1448 133.286 19.2435 133.286 16.1645C133.286 13.6777 133.819 11.4869 134.885 9.59216C135.951 7.69742 137.372 6.03953 139.148 4.73689C140.924 3.37505 142.937 2.36847 145.306 1.65795C147.674 0.94742 150.161 0.651367 152.766 0.651367C154.069 0.651367 155.431 0.710578 156.734 0.888209C158.095 1.06584 159.339 1.30268 160.582 1.53953C161.766 1.83558 162.891 2.13163 163.957 2.48689C165.023 2.84216 165.852 3.19742 166.444 3.55268C167.273 4.02637 167.865 4.50005 168.22 5.03295C168.576 5.50663 168.753 6.15795 168.753 6.98689V9.76979C168.753 11.0132 168.28 11.6645 167.391 11.6645C166.918 11.6645 166.148 11.4277 165.141 10.954C161.766 9.41453 157.977 8.64479 153.773 8.64479C150.398 8.64479 147.734 9.17768 145.898 10.3027C144.062 11.4277 143.115 13.1448 143.115 15.5724C143.115 17.2303 143.707 18.6514 144.891 19.7764C146.076 20.9014 148.266 22.0264 151.405 23.0329L159.812 25.6974C164.076 27.0593 167.155 28.954 168.99 31.3816C170.826 33.8093 171.714 36.5922 171.714 39.6711C171.714 42.2172 171.181 44.5264 170.174 46.5395C169.108 48.5527 167.687 50.329 165.852 51.7501C164.016 53.2303 161.826 54.2961 159.28 55.0658C156.615 55.8948 153.832 56.3093 150.812 56.3093Z",
7395
+ fill: "currentColor"
7396
+ }
7397
+ ),
7398
+ /* @__PURE__ */ jsxRuntime.jsx(
7399
+ "path",
7400
+ {
7401
+ fillRule: "evenodd",
7402
+ clipRule: "evenodd",
7403
+ d: "M162.004 85.0856C142.524 99.4738 114.221 107.112 89.8855 107.112C55.7803 107.112 25.05 94.5001 1.83948 73.5396C0.00394917 71.8817 1.66184 69.6317 3.85263 70.9343C28.9579 85.5001 59.925 94.3225 91.9579 94.3225C113.57 94.3225 137.313 89.8225 159.162 80.5856C162.418 79.1054 165.201 82.7172 162.004 85.0856Z",
7404
+ fill: "#FF9900"
7405
+ }
7406
+ ),
7407
+ /* @__PURE__ */ jsxRuntime.jsx(
7408
+ "path",
7409
+ {
7410
+ fillRule: "evenodd",
7411
+ clipRule: "evenodd",
7412
+ d: "M170.115 75.8487C167.628 72.6513 153.654 74.3092 147.319 75.079C145.424 75.3158 145.128 73.6579 146.845 72.4145C157.976 64.5987 176.272 66.8487 178.404 69.454C180.536 72.1184 177.812 90.4145 167.391 99.1776C165.792 100.539 164.253 99.8289 164.963 98.0526C167.332 92.1908 172.601 78.9868 170.115 75.8487Z",
7413
+ fill: "#FF9900"
7414
+ }
7415
+ )
7416
+ ] }),
7417
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_1480_1723", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "180", height: "107.763", fill: "white", transform: "translate(0.0625)" }) }) })
7418
+ ]
7419
+ }
7420
+ );
7421
+
7422
+ const CohereIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "h-3 w-3", xmlns: "http://www.w3.org/2000/svg", width: "17", height: "18", fill: "none", ...props, children: [
7423
+ /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "mask0_174_2406", maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "17", height: "18", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 0.5H0V17.5H17V0.5Z", fill: "white" }) }),
7424
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#mask0_174_2406)", children: [
7425
+ /* @__PURE__ */ jsxRuntime.jsx(
7426
+ "path",
7427
+ {
7428
+ fillRule: "evenodd",
7429
+ clipRule: "evenodd",
7430
+ d: "M5.50773 10.6219C5.9653 10.6219 6.8755 10.5968 8.13362 10.0788C9.59973 9.47518 12.5166 8.37942 14.6208 7.2539C16.0924 6.46668 16.7375 5.42553 16.7375 4.02344C16.7375 2.07751 15.16 0.5 13.2141 0.5H5.06095C2.26586 0.5 0 2.76586 0 5.56095C0 8.35604 2.12151 10.6219 5.50773 10.6219Z",
7431
+ fill: "#39594D"
7432
+ }
7433
+ ),
7434
+ /* @__PURE__ */ jsxRuntime.jsx(
7435
+ "path",
7436
+ {
7437
+ fillRule: "evenodd",
7438
+ clipRule: "evenodd",
7439
+ d: "M6.88672 14.107C6.88672 12.7369 7.71155 11.5016 8.97699 10.9764L11.5446 9.9108C14.1417 8.83294 17.0003 10.7415 17.0003 13.5535C17.0003 15.732 15.2339 17.4979 13.0553 17.4973L10.2754 17.4966C8.40372 17.4961 6.88672 15.9787 6.88672 14.107Z",
7440
+ fill: "#D18EE2"
7441
+ }
7442
+ ),
7443
+ /* @__PURE__ */ jsxRuntime.jsx(
7444
+ "path",
7445
+ {
7446
+ d: "M2.91749 11.2891C1.30623 11.2891 0 12.5952 0 14.2065V14.5844C0 16.1956 1.30618 17.5018 2.91744 17.5018C4.5287 17.5018 5.83493 16.1956 5.83493 14.5844V14.2065C5.83493 12.5952 4.52875 11.2891 2.91749 11.2891Z",
7447
+ fill: "#FF7759"
7448
+ }
7449
+ )
7450
+ ] })
7451
+ ] });
7452
+
7453
+ const GroqIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
7454
+ "svg",
7455
+ {
7456
+ className: "h-3 w-3",
7457
+ "data-testid": "geist-icon",
7458
+ height: "78",
7459
+ strokeLinejoin: "round",
7460
+ viewBox: "0 0 160 59",
7461
+ width: "104",
7462
+ style: {
7463
+ color: "currentcolor"
7464
+ },
7465
+ ...props,
7466
+ children: [
7467
+ /* @__PURE__ */ jsxRuntime.jsx(
7468
+ "mask",
7469
+ {
7470
+ id: "mask0_4345_1846",
7471
+ maskUnits: "userSpaceOnUse",
7472
+ x: "0",
7473
+ y: "0",
7474
+ width: "160",
7475
+ height: "59",
7476
+ style: {
7477
+ maskType: "luminance"
7478
+ },
7479
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0.273438 0.219727H159.216V58.1817H0.273438V0.219727Z", fill: "white" })
7480
+ }
7481
+ ),
7482
+ /* @__PURE__ */ jsxRuntime.jsx("g", { mask: "url(#mask0_4345_1846)", children: /* @__PURE__ */ jsxRuntime.jsx(
7483
+ "path",
7484
+ {
7485
+ d: "M95.4635 0.314595C84.4822 0.314595 75.5599 9.19525 75.5599 20.1677C75.5599 31.1402 84.4632 40.0208 95.4635 40.0208C106.464 40.0208 115.367 31.1402 115.367 20.1677C115.348 9.21427 106.445 0.333611 95.4635 0.314595ZM95.4635 32.5664C88.6002 32.5664 83.0333 27.0136 83.0333 20.1677C83.0333 13.3218 88.6002 7.76902 95.4635 7.76902C102.327 7.76902 107.894 13.3218 107.894 20.1677C107.894 27.0136 102.327 32.5664 95.4635 32.5664ZM67.9912 0.39066C67.3049 0.314595 66.6376 0.276562 65.9513 0.276562C65.6081 0.276562 65.284 0.276562 64.9599 0.295578C64.6358 0.314595 64.2926 0.333611 63.9685 0.352628C62.634 0.44771 61.2995 0.675906 60.0031 1.03722C57.3531 1.74082 54.8556 2.99591 52.7013 4.68836C50.4898 6.43787 48.7358 8.68181 47.5347 11.23C46.9437 12.5041 46.5052 13.8543 46.2193 15.2234C46.0858 15.908 45.9905 16.5926 45.9142 17.2772C45.8952 17.6195 45.857 17.9618 45.857 18.3041L45.838 18.8175V19.293L45.8761 32.5854L45.9142 39.2221H53.3685L53.4067 32.5854L53.4448 19.293V18.5893C53.4448 18.3802 53.4829 18.171 53.4829 17.9618C53.5211 17.5434 53.5973 17.1441 53.6736 16.7257C53.8452 15.9271 54.093 15.1474 54.4362 14.4057C55.1225 12.9225 56.152 11.6293 57.4293 10.6025C58.7639 9.53755 60.3081 8.75787 61.9477 8.3205C62.7865 8.0923 63.6635 7.94017 64.5405 7.8641C64.7693 7.84509 64.979 7.82607 65.2078 7.82607C65.4365 7.82607 65.6653 7.80705 65.875 7.80705C66.2944 7.80705 66.7329 7.82607 67.1524 7.8641C68.8491 8.03525 70.4887 8.54869 71.9948 9.38541L75.7124 2.93886C73.3484 1.56968 70.7175 0.694923 67.9912 0.39066ZM20.3484 0.219513C9.36711 0.124431 0.36855 8.92902 0.273226 19.8825C0.177902 30.8359 9.00488 39.8116 19.9862 39.9067H26.8876V32.4713H20.3484C13.4851 32.5474 7.84193 27.0707 7.76567 20.2057C7.68941 13.3408 13.1801 7.73099 20.0624 7.65492H20.3484C27.2117 7.65492 32.7786 13.2077 32.8167 20.0536V38.3284C32.8167 45.1172 27.2689 50.651 20.4819 50.7271C17.2218 50.708 14.1142 49.3959 11.8265 47.0949L6.54553 52.3625C10.206 56.0326 15.1628 58.1244 20.3484 58.1625H20.6153C31.4632 58.0103 40.1757 49.2248 40.2329 38.4044V19.5592C39.966 8.81492 31.1391 0.238529 20.3484 0.219513ZM139.389 0.314595C128.407 0.314595 119.485 9.19525 119.504 20.1677C119.504 31.1212 128.407 40.0018 139.389 40.0018H146.195V32.5664H139.389C132.525 32.5664 126.958 27.0136 126.958 20.1677C126.958 13.3218 132.525 7.76902 139.389 7.76902C145.833 7.76902 151.209 12.6943 151.781 19.1028H151.762V57.2116H159.216V20.1677C159.216 9.21427 150.351 0.314595 139.389 0.314595Z",
7486
+ fill: "currentColor"
7487
+ }
7488
+ ) })
7489
+ ]
7490
+ }
7491
+ );
7492
+
7493
+ const XGroqIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
7494
+ "svg",
7495
+ {
7496
+ className: "h-3 w-3",
7497
+ xmlns: "http://www.w3.org/2000/svg",
7498
+ viewBox: "0 0 1000 1000",
7499
+ width: "78",
7500
+ height: "78",
7501
+ style: {
7502
+ color: "currentcolor"
7503
+ },
7504
+ ...props,
7505
+ children: /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
7506
+ /* @__PURE__ */ jsxRuntime.jsx(
7507
+ "polygon",
7508
+ {
7509
+ fill: "currentColor",
7510
+ points: "226.83 411.15 501.31 803.15 623.31 803.15 348.82 411.15 226.83 411.15"
7511
+ }
7512
+ ),
7513
+ /* @__PURE__ */ jsxRuntime.jsx(
7514
+ "polygon",
7515
+ {
7516
+ fill: "currentColor",
7517
+ points: "348.72 628.87 226.69 803.15 348.77 803.15 409.76 716.05 348.72 628.87"
7518
+ }
7519
+ ),
7520
+ /* @__PURE__ */ jsxRuntime.jsx(
7521
+ "polygon",
7522
+ {
7523
+ fill: "currentColor",
7524
+ points: "651.23 196.85 440.28 498.12 501.32 585.29 773.31 196.85 651.23 196.85"
7525
+ }
7526
+ ),
7527
+ /* @__PURE__ */ jsxRuntime.jsx(
7528
+ "polygon",
7529
+ {
7530
+ fill: "currentColor",
7531
+ points: "673.31 383.25 673.31 803.15 773.31 803.15 773.31 240.44 673.31 383.25"
7532
+ }
7533
+ )
7534
+ ] })
7535
+ }
7536
+ );
7537
+
7538
+ const MistralIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
7539
+ "svg",
7540
+ {
7541
+ className: "h-3 w-3",
7542
+ xmlns: "http://www.w3.org/2000/svg",
7543
+ width: "176",
7544
+ height: "162",
7545
+ viewBox: "0 0 176 162",
7546
+ fill: "none",
7547
+ ...props,
7548
+ children: [
7549
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "15", y: "1", width: "32", height: "32", fill: "#FFCD00", stroke: "#636363", "stroke-opacity": "0.2", "stroke-width": "0.5" }),
7550
+ /* @__PURE__ */ jsxRuntime.jsx(
7551
+ "rect",
7552
+ {
7553
+ x: "143",
7554
+ y: "1",
7555
+ width: "32",
7556
+ height: "32",
7557
+ fill: "#FFCD00",
7558
+ stroke: "#636363",
7559
+ "stroke-opacity": "0.2",
7560
+ "stroke-width": "0.5"
7561
+ }
7562
+ ),
7563
+ /* @__PURE__ */ jsxRuntime.jsx(
7564
+ "rect",
7565
+ {
7566
+ x: "15",
7567
+ y: "33",
7568
+ width: "32",
7569
+ height: "32",
7570
+ fill: "#FFA400",
7571
+ stroke: "#636363",
7572
+ "stroke-opacity": "0.2",
7573
+ "stroke-width": "0.5"
7574
+ }
7575
+ ),
7576
+ /* @__PURE__ */ jsxRuntime.jsx(
7577
+ "rect",
7578
+ {
7579
+ x: "47",
7580
+ y: "33",
7581
+ width: "32",
7582
+ height: "32",
7583
+ fill: "#FFA400",
7584
+ stroke: "#636363",
7585
+ "stroke-opacity": "0.2",
7586
+ "stroke-width": "0.5"
7587
+ }
7588
+ ),
7589
+ /* @__PURE__ */ jsxRuntime.jsx(
7590
+ "rect",
7591
+ {
7592
+ x: "111",
7593
+ y: "33",
7594
+ width: "32",
7595
+ height: "32",
7596
+ fill: "#FFA400",
7597
+ stroke: "#636363",
7598
+ "stroke-opacity": "0.2",
7599
+ "stroke-width": "0.5"
7600
+ }
7601
+ ),
7602
+ /* @__PURE__ */ jsxRuntime.jsx(
7603
+ "rect",
7604
+ {
7605
+ x: "143",
7606
+ y: "33",
7607
+ width: "32",
7608
+ height: "32",
7609
+ fill: "#FFA400",
7610
+ stroke: "#636363",
7611
+ "stroke-opacity": "0.2",
7612
+ "stroke-width": "0.5"
7613
+ }
7614
+ ),
7615
+ /* @__PURE__ */ jsxRuntime.jsx(
7616
+ "rect",
7617
+ {
7618
+ x: "15",
7619
+ y: "65",
7620
+ width: "32",
7621
+ height: "32",
7622
+ fill: "#FF7100",
7623
+ stroke: "#636363",
7624
+ "stroke-opacity": "0.2",
7625
+ "stroke-width": "0.5"
7626
+ }
7627
+ ),
7628
+ /* @__PURE__ */ jsxRuntime.jsx(
7629
+ "rect",
7630
+ {
7631
+ x: "47",
7632
+ y: "65",
7633
+ width: "32",
7634
+ height: "32",
7635
+ fill: "#FF7100",
7636
+ stroke: "#636363",
7637
+ "stroke-opacity": "0.2",
7638
+ "stroke-width": "0.5"
7639
+ }
7640
+ ),
7641
+ /* @__PURE__ */ jsxRuntime.jsx(
7642
+ "rect",
7643
+ {
7644
+ x: "79",
7645
+ y: "65",
7646
+ width: "32",
7647
+ height: "32",
7648
+ fill: "#FF7100",
7649
+ stroke: "#636363",
7650
+ "stroke-opacity": "0.2",
7651
+ "stroke-width": "0.5"
7652
+ }
7653
+ ),
7654
+ /* @__PURE__ */ jsxRuntime.jsx(
7655
+ "rect",
7656
+ {
7657
+ x: "111",
7658
+ y: "65",
7659
+ width: "32",
7660
+ height: "32",
7661
+ fill: "#FF7100",
7662
+ stroke: "#636363",
7663
+ "stroke-opacity": "0.2",
7664
+ "stroke-width": "0.5"
7665
+ }
7666
+ ),
7667
+ /* @__PURE__ */ jsxRuntime.jsx(
7668
+ "rect",
7669
+ {
7670
+ x: "143",
7671
+ y: "65",
7672
+ width: "32",
7673
+ height: "32",
7674
+ fill: "#FF7100",
7675
+ stroke: "#636363",
7676
+ "stroke-opacity": "0.2",
7677
+ "stroke-width": "0.5"
7678
+ }
7679
+ ),
7680
+ /* @__PURE__ */ jsxRuntime.jsx(
7681
+ "rect",
7682
+ {
7683
+ x: "15",
7684
+ y: "97",
7685
+ width: "32",
7686
+ height: "32",
7687
+ fill: "#FF4902",
7688
+ stroke: "#636363",
7689
+ "stroke-opacity": "0.2",
7690
+ "stroke-width": "0.5"
7691
+ }
7692
+ ),
7693
+ /* @__PURE__ */ jsxRuntime.jsx(
7694
+ "rect",
7695
+ {
7696
+ x: "79",
7697
+ y: "97",
7698
+ width: "32",
7699
+ height: "32",
7700
+ fill: "#FF4902",
7701
+ stroke: "#636363",
7702
+ "stroke-opacity": "0.2",
7703
+ "stroke-width": "0.5"
7704
+ }
7705
+ ),
7706
+ /* @__PURE__ */ jsxRuntime.jsx(
7707
+ "rect",
7708
+ {
7709
+ x: "143",
7710
+ y: "97",
7711
+ width: "32",
7712
+ height: "32",
7713
+ fill: "#FF4902",
7714
+ stroke: "#636363",
7715
+ "stroke-opacity": "0.2",
7716
+ "stroke-width": "0.5"
7717
+ }
7718
+ ),
7719
+ /* @__PURE__ */ jsxRuntime.jsx(
7720
+ "rect",
7721
+ {
7722
+ x: "15",
7723
+ y: "129",
7724
+ width: "32",
7725
+ height: "32",
7726
+ fill: "#FF0006",
7727
+ stroke: "#636363",
7728
+ "stroke-opacity": "0.2",
7729
+ "stroke-width": "0.5"
7730
+ }
7731
+ ),
7732
+ /* @__PURE__ */ jsxRuntime.jsx(
7733
+ "rect",
7734
+ {
7735
+ x: "143",
7736
+ y: "129",
7737
+ width: "32",
7738
+ height: "32",
7739
+ fill: "#FF0006",
7740
+ stroke: "#636363",
7741
+ "stroke-opacity": "0.2",
7742
+ "stroke-width": "0.5"
7743
+ }
7744
+ ),
7745
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "1", width: "16", height: "160", fill: "black" }),
7746
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "63", y: "97", width: "16", height: "32", fill: "black" }),
7747
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "95", y: "33", width: "16", height: "32", fill: "black" }),
7748
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "127", y: "1", width: "16", height: "32", fill: "black" }),
7749
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "127", y: "97", width: "16", height: "64", fill: "black" })
7750
+ ]
7751
+ }
7752
+ );
7753
+
7754
+ const LinkComponentContext = React.createContext({
7755
+ Link: React.forwardRef(() => null)
7756
+ });
7757
+ const LinkComponentProvider = ({ children, Link }) => {
7758
+ return /* @__PURE__ */ jsxRuntime.jsx(LinkComponentContext.Provider, { value: { Link }, children });
7759
+ };
7760
+ const useLinkComponent = () => {
7761
+ return React.useContext(LinkComponentContext);
7762
+ };
7763
+
7764
+ const providerMapToIcon = {
7765
+ "openai.chat": /* @__PURE__ */ jsxRuntime.jsx(OpenaiChatIcon, {}),
7766
+ "anthropic.chat": /* @__PURE__ */ jsxRuntime.jsx(AnthropicChatIcon, {}),
7767
+ "anthropic.messages": /* @__PURE__ */ jsxRuntime.jsx(AnthropicMessagesIcon, {}),
7768
+ AZURE: /* @__PURE__ */ jsxRuntime.jsx(AzureIcon, {}),
7769
+ AMAZON: /* @__PURE__ */ jsxRuntime.jsx(AmazonIcon, {}),
7770
+ GOOGLE: /* @__PURE__ */ jsxRuntime.jsx(GoogleIcon, {}),
7771
+ COHERE: /* @__PURE__ */ jsxRuntime.jsx(CohereIcon, {}),
7772
+ GROQ: /* @__PURE__ */ jsxRuntime.jsx(GroqIcon, {}),
7773
+ X_GROK: /* @__PURE__ */ jsxRuntime.jsx(XGroqIcon, {}),
7774
+ MISTRAL: /* @__PURE__ */ jsxRuntime.jsx(MistralIcon, {})
7775
+ };
7776
+ const NameCell = ({ row }) => {
7777
+ const { Link } = useLinkComponent();
7778
+ return /* @__PURE__ */ jsxRuntime.jsx(
7779
+ EntryCell,
7780
+ {
7781
+ icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}),
7782
+ name: /* @__PURE__ */ jsxRuntime.jsx(Link, { className: "w-full space-y-0", href: row.original.link, children: row.original.name }),
7783
+ description: row.original.instructions
7784
+ }
7785
+ );
7786
+ };
7787
+ const columns = [
7788
+ {
7789
+ header: "Name",
7790
+ accessorKey: "name",
7791
+ cell: NameCell
7792
+ },
7793
+ {
7794
+ header: "Model",
7795
+ accessorKey: "model",
7796
+ size: 160,
7797
+ cell: ({ row }) => {
7798
+ return /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
7799
+ Badge$1,
7800
+ {
7801
+ variant: "default",
7802
+ icon: providerMapToIcon[row.original.provider] || /* @__PURE__ */ jsxRuntime.jsx(OpenAIIcon, {}),
7803
+ children: row.original.modelId || "N/A"
7804
+ }
7805
+ ) });
7806
+ }
7807
+ },
7808
+ {
7809
+ size: 160,
7810
+ header: "Tools",
7811
+ accessorKey: "tools",
7812
+ cell: ({ row }) => {
7813
+ const toolsCount = row.original.tools ? Object.keys(row.original.tools).length : 0;
7814
+ return /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsxRuntime.jsx(ApiIcon, {}), children: [
7815
+ toolsCount,
7816
+ " tool",
7817
+ toolsCount > 1 ? "s" : ""
7818
+ ] }) });
7819
+ }
7820
+ }
7821
+ ];
7822
+
7823
+ function AgentsTable({ agents, isLoading, onClickRow }) {
7824
+ const _agents = agents || {};
7825
+ const projectData = Object.keys(_agents).map((key) => {
7826
+ const agent = _agents[key];
7827
+ return {
7828
+ id: key,
7829
+ name: agent.name,
7830
+ instructions: agent.instructions,
7831
+ provider: agent.provider,
7832
+ branch: void 0,
7833
+ executedAt: void 0,
7834
+ repoUrl: void 0,
7835
+ tools: agent.tools,
7836
+ modelId: agent.modelId
7837
+ };
7838
+ });
7839
+ const table = reactTable.useReactTable({
7840
+ data: projectData,
7841
+ columns,
7842
+ getCoreRowModel: reactTable.getCoreRowModel()
7843
+ });
7844
+ if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(AgentsTableSkeleton, {});
7845
+ const ths = table.getHeaderGroups()[0];
7846
+ const rows = table.getRowModel().rows.concat();
7847
+ if (rows.length === 0) {
7848
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptyAgentsTable, {});
7849
+ }
7850
+ return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
7851
+ /* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
7852
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => onClickRow(row.original.id), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
7853
+ ] }) });
7854
+ }
7855
+ const AgentsTableSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
7856
+ /* @__PURE__ */ jsxRuntime.jsxs(Thead, { children: [
7857
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Name" }),
7858
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Model" }),
7859
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Tools" })
7860
+ ] }),
7861
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs(Row, { children: [
7862
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
7863
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
7864
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) })
7865
+ ] }, index)) })
7866
+ ] });
7867
+ const EmptyAgentsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
7868
+ EmptyState,
7869
+ {
7870
+ iconSlot: /* @__PURE__ */ jsxRuntime.jsx(AgentCoinIcon, {}),
7871
+ titleSlot: "Configure Agents",
7872
+ descriptionSlot: "Mastra agents are not configured yet. You can find more information in the documentation.",
7873
+ actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
7874
+ Button,
7875
+ {
7876
+ size: "lg",
7877
+ className: "w-full",
7878
+ variant: "light",
7879
+ as: "a",
7880
+ href: "https://mastra.ai/en/docs/agents/overview",
7881
+ target: "_blank",
7882
+ children: [
7883
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}) }),
7884
+ "Docs"
7885
+ ]
7886
+ }
7887
+ )
7888
+ }
7889
+ ) });
7890
+
6905
7891
  const convertMessage$1 = (message) => {
6906
7892
  return message;
6907
7893
  };
@@ -7381,10 +8367,6 @@ const Clock = ({ startedAt, endedAt }) => {
7381
8367
  ] });
7382
8368
  };
7383
8369
 
7384
- function Skeleton({ className, ...props }) {
7385
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("animate-pulse rounded-md bg-muted/50", className), ...props });
7386
- }
7387
-
7388
8370
  const lodashTitleCase = (str) => {
7389
8371
  const camelCased = str.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^(.)/, (char) => char.toLowerCase());
7390
8372
  return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
@@ -8267,25 +9249,6 @@ const CodeDialogContent = ({ data }) => {
8267
9249
  }
8268
9250
  };
8269
9251
 
8270
- const formatJSON = async (code) => {
8271
- const formatted = await prettier.format(code, {
8272
- semi: false,
8273
- parser: "json",
8274
- printWidth: 80,
8275
- tabWidth: 2,
8276
- plugins: [prettierPluginBabel, prettierPluginEstree]
8277
- });
8278
- return formatted;
8279
- };
8280
- const isValidJson = (str) => {
8281
- try {
8282
- const obj = JSON.parse(str);
8283
- return !!obj && typeof obj === "object";
8284
- } catch (e) {
8285
- return false;
8286
- }
8287
- };
8288
-
8289
9252
  const WorkflowRunEventForm = ({ event, runId, onSendEvent }) => {
8290
9253
  const [eventData, setEventData] = React.useState("");
8291
9254
  const [isLoading, setIsLoading] = React.useState(false);
@@ -8297,6 +9260,7 @@ const WorkflowRunEventForm = ({ event, runId, onSendEvent }) => {
8297
9260
  setIsLoading(true);
8298
9261
  setError(null);
8299
9262
  try {
9263
+ setError(null);
8300
9264
  data = JSON.parse(eventData);
8301
9265
  } catch (error2) {
8302
9266
  setError("Invalid JSON");
@@ -8304,6 +9268,7 @@ const WorkflowRunEventForm = ({ event, runId, onSendEvent }) => {
8304
9268
  return;
8305
9269
  }
8306
9270
  try {
9271
+ setError(null);
8307
9272
  const result = await onSendEvent({ event, data, runId });
8308
9273
  sonner.toast.success(result.message);
8309
9274
  } catch (error2) {
@@ -8315,6 +9280,7 @@ const WorkflowRunEventForm = ({ event, runId, onSendEvent }) => {
8315
9280
  };
8316
9281
  const buttonClass = "text-icon3 hover:text-icon6";
8317
9282
  const formatEventData = async () => {
9283
+ setError(null);
8318
9284
  if (!isValidJson(eventData)) {
8319
9285
  setError("Invalid JSON");
8320
9286
  return;
@@ -9553,7 +10519,8 @@ function VNextMastraNetworkRuntimeProvider({
9553
10519
  memory,
9554
10520
  threadId,
9555
10521
  refreshThreadList,
9556
- initialMessages
10522
+ initialMessages,
10523
+ runtimeContext: runtimeContext$1
9557
10524
  }) {
9558
10525
  const runIdRef = React.useRef(void 0);
9559
10526
  const [isRunning, setIsRunning] = React.useState(false);
@@ -9563,6 +10530,10 @@ function VNextMastraNetworkRuntimeProvider({
9563
10530
  const { chatWithLoop, maxIterations } = React.useContext(NetworkContext);
9564
10531
  const id = runIdRef.current;
9565
10532
  const currentState = id ? state[id] : void 0;
10533
+ const runtimeContextInstance = new runtimeContext.RuntimeContext();
10534
+ Object.entries(runtimeContext$1 ?? {}).forEach(([key, value]) => {
10535
+ runtimeContextInstance.set(key, value);
10536
+ });
9566
10537
  React.useEffect(() => {
9567
10538
  if (!currentState) return;
9568
10539
  const hasFinished = Boolean(currentState?.steps?.["finish"]);
@@ -9854,7 +10825,8 @@ ${formatted}\`\`\``;
9854
10825
  message: input,
9855
10826
  threadId,
9856
10827
  resourceId: networkId,
9857
- maxIterations
10828
+ maxIterations,
10829
+ runtimeContext: runtimeContextInstance
9858
10830
  },
9859
10831
  async (record) => {
9860
10832
  if (record.type === "step-start" && record.payload?.id === "Agent-Network-Outer-Workflow") {
@@ -9948,7 +10920,8 @@ ${formatted}\`\`\``;
9948
10920
  {
9949
10921
  message: input,
9950
10922
  threadId,
9951
- resourceId: networkId
10923
+ resourceId: networkId,
10924
+ runtimeContext: runtimeContextInstance
9952
10925
  },
9953
10926
  (record) => {
9954
10927
  if (runIdRef.current) {
@@ -10033,6 +11006,7 @@ const VNextNetworkChat = ({
10033
11006
  memory,
10034
11007
  refreshThreadList
10035
11008
  }) => {
11009
+ const { runtimeContext } = usePlaygroundStore();
10036
11010
  return /* @__PURE__ */ jsxRuntime.jsx(MessagesProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(VNextNetworkChatProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
10037
11011
  VNextMastraNetworkRuntimeProvider,
10038
11012
  {
@@ -10041,6 +11015,7 @@ const VNextNetworkChat = ({
10041
11015
  threadId,
10042
11016
  memory,
10043
11017
  refreshThreadList,
11018
+ runtimeContext,
10044
11019
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(NetworkThread, { hasMemory: memory, networkName }) })
10045
11020
  },
10046
11021
  threadId
@@ -11839,21 +12814,6 @@ const EntityContent = ({ children, className }) => {
11839
12814
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
11840
12815
  };
11841
12816
 
11842
- const EmptyState = ({
11843
- iconSlot,
11844
- titleSlot,
11845
- descriptionSlot,
11846
- actionSlot,
11847
- as: Component = "div"
11848
- }) => {
11849
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[340px] flex-col items-center justify-center text-center", children: [
11850
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-auto [&>svg]:w-[126px]", children: iconSlot }),
11851
- /* @__PURE__ */ jsxRuntime.jsx(Component, { className: "text-icon6 pt-[34px] font-serif text-[1.75rem] font-semibold", children: titleSlot }),
11852
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-lg", className: "text-icon3 pb-[34px]", children: descriptionSlot }),
11853
- actionSlot
11854
- ] });
11855
- };
11856
-
11857
12817
  function usePolling({
11858
12818
  fetchFn,
11859
12819
  interval = 3e3,
@@ -11970,6 +12930,8 @@ exports.AgentSettings = AgentSettings;
11970
12930
  exports.AgentSettingsContext = AgentSettingsContext;
11971
12931
  exports.AgentSettingsProvider = AgentSettingsProvider;
11972
12932
  exports.AgentTraces = AgentTraces;
12933
+ exports.AgentsTable = AgentsTable;
12934
+ exports.AgentsTableSkeleton = AgentsTableSkeleton;
11973
12935
  exports.AiIcon = AiIcon;
11974
12936
  exports.ApiIcon = ApiIcon;
11975
12937
  exports.Badge = Badge$1;
@@ -11991,6 +12953,7 @@ exports.DeploymentIcon = DeploymentIcon;
11991
12953
  exports.DividerIcon = DividerIcon;
11992
12954
  exports.DocsIcon = DocsIcon;
11993
12955
  exports.DynamicForm = DynamicForm;
12956
+ exports.EmptyAgentsTable = EmptyAgentsTable;
11994
12957
  exports.EmptyState = EmptyState;
11995
12958
  exports.Entity = Entity;
11996
12959
  exports.EntityContent = EntityContent;
@@ -12017,6 +12980,7 @@ exports.JudgeIcon = JudgeIcon;
12017
12980
  exports.LatencyIcon = LatencyIcon;
12018
12981
  exports.LegacyWorkflowGraph = LegacyWorkflowGraph;
12019
12982
  exports.LegacyWorkflowTrigger = LegacyWorkflowTrigger;
12983
+ exports.LinkComponentProvider = LinkComponentProvider;
12020
12984
  exports.LogsIcon = LogsIcon;
12021
12985
  exports.MainContentContent = MainContentContent;
12022
12986
  exports.MainContentLayout = MainContentLayout;
@@ -12063,10 +13027,14 @@ exports.WorkflowRunProvider = WorkflowRunProvider;
12063
13027
  exports.WorkflowRuns = WorkflowRuns;
12064
13028
  exports.WorkflowTraces = WorkflowTraces;
12065
13029
  exports.WorkflowTrigger = WorkflowTrigger;
13030
+ exports.WorkingMemoryContext = WorkingMemoryContext;
13031
+ exports.WorkingMemoryProvider = WorkingMemoryProvider;
12066
13032
  exports.useAgentSettings = useAgentSettings;
12067
13033
  exports.useCurrentRun = useCurrentRun;
13034
+ exports.useLinkComponent = useLinkComponent;
12068
13035
  exports.useMastraClient = useMastraClient;
12069
13036
  exports.usePlaygroundStore = usePlaygroundStore;
12070
13037
  exports.usePolling = usePolling;
12071
13038
  exports.useSpeechRecognition = useSpeechRecognition;
13039
+ exports.useWorkingMemory = useWorkingMemory;
12072
13040
  //# sourceMappingURL=index.cjs.js.map