@cognizant-ai-lab/ui-common 1.10.0 → 1.12.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 (56) hide show
  1. package/dist/components/AgentChat/ChatCommon/ChatCommon.d.ts +5 -0
  2. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +28 -7
  3. package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
  4. package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
  5. package/dist/components/AgentChat/ChatCommon/SlyDataDialog.d.ts +34 -0
  6. package/dist/components/AgentChat/ChatCommon/SlyDataDialog.js +187 -0
  7. package/dist/components/AgentChat/Common/LlmChatButton.d.ts +4 -6
  8. package/dist/components/AgentChat/Common/LlmChatButton.js +0 -2
  9. package/dist/components/Common/ConfirmationModal.d.ts +3 -2
  10. package/dist/components/Common/GoogleAnalytics.d.ts +16 -0
  11. package/dist/components/Common/GoogleAnalytics.js +32 -0
  12. package/dist/components/Common/Navbar.d.ts +2 -1
  13. package/dist/components/Common/Navbar.js +3 -3
  14. package/dist/components/ErrorPage/ErrorPage.js +4 -4
  15. package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.d.ts +7 -7
  16. package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +143 -390
  17. package/dist/components/MultiAgentAccelerator/Editor/AgentNodeEditor.d.ts +24 -0
  18. package/dist/components/MultiAgentAccelerator/Editor/AgentNodeEditor.js +128 -0
  19. package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.d.ts +21 -0
  20. package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.js +305 -0
  21. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +109 -62
  22. package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.d.ts +2 -0
  23. package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.js +38 -0
  24. package/dist/components/MultiAgentAccelerator/PanelSeparator.d.ts +5 -0
  25. package/dist/components/MultiAgentAccelerator/PanelSeparator.js +46 -0
  26. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +4 -3
  27. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +8 -6
  28. package/dist/components/MultiAgentAccelerator/const.d.ts +1 -0
  29. package/dist/components/MultiAgentAccelerator/const.js +2 -0
  30. package/dist/components/Settings/ApiKeyErrorBanner.d.ts +22 -0
  31. package/dist/components/Settings/ApiKeyErrorBanner.js +26 -0
  32. package/dist/components/Settings/ApiKeyInput.d.ts +5 -2
  33. package/dist/components/Settings/ApiKeyInput.js +10 -4
  34. package/dist/components/Settings/SettingsDialog.js +22 -5
  35. package/dist/const.d.ts +0 -1
  36. package/dist/const.js +0 -1
  37. package/dist/controller/llm/Providers.d.ts +19 -2
  38. package/dist/controller/llm/Providers.js +45 -31
  39. package/dist/state/Announcements.d.ts +24 -0
  40. package/dist/state/Announcements.js +29 -0
  41. package/dist/state/ChatHistory.d.ts +10 -1
  42. package/dist/state/ChatHistory.js +8 -0
  43. package/dist/state/Environment.d.ts +2 -0
  44. package/dist/state/Environment.js +2 -0
  45. package/dist/state/Settings.d.ts +14 -0
  46. package/dist/state/Settings.js +6 -2
  47. package/dist/tsconfig.build.tsbuildinfo +1 -1
  48. package/dist/utils/Authentication.d.ts +7 -0
  49. package/dist/utils/Authentication.js +19 -5
  50. package/dist/utils/SlyData.d.ts +56 -0
  51. package/dist/utils/SlyData.js +106 -0
  52. package/dist/utils/SlyDataSchema.d.ts +31 -0
  53. package/dist/utils/SlyDataSchema.js +149 -0
  54. package/package.json +9 -8
  55. package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +0 -30
  56. package/dist/components/MultiAgentAccelerator/AgentNodePopup.js +0 -80
@@ -14,27 +14,35 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  */
17
+ import Close from "@mui/icons-material/Close";
17
18
  import StopCircle from "@mui/icons-material/StopCircle";
18
19
  import Box from "@mui/material/Box";
19
- import Grid from "@mui/material/Grid";
20
+ import IconButton from "@mui/material/IconButton";
20
21
  import Slide from "@mui/material/Slide";
22
+ import Snackbar from "@mui/material/Snackbar";
21
23
  import { useTheme } from "@mui/material/styles";
22
24
  import Tooltip from "@mui/material/Tooltip";
23
25
  import Typography from "@mui/material/Typography";
24
26
  import { ReactFlowProvider } from "@xyflow/react";
25
27
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
26
28
  import { useJoyride } from "react-joyride";
29
+ import { Group, Panel, usePanelRef } from "react-resizable-panels";
27
30
  import { extractConversations } from "./AgentConversations.js";
28
31
  import { getUpdatedAgentCounts } from "./AgentCounts.js";
29
32
  import { AgentFlow } from "./AgentFlow/AgentFlow.js";
30
33
  import { extractAgentNetworkDesignerProgress } from "./AgentNetworkDesigner.js";
31
- import { AGENT_NETWORK_DEFINITION_KEY, AGENT_NETWORK_DESIGNER_ID, AGENT_NETWORK_HOCON, AGENT_NETWORK_NAME_KEY, EXPIRED_NETWORKS_CHECK_INTERVAL_MS, GRACE_PERIOD_MS, SHOW_TOUR_DELAY_MS, TRIGGER_APP_TOUR_EVENT_NAME, } from "./const.js";
34
+ import { AGENT_NETWORK_DEFINITION_KEY, AGENT_NETWORK_DESIGNER_ID, AGENT_NETWORK_HOCON, AGENT_NETWORK_NAME_KEY, EXPIRED_NETWORKS_CHECK_INTERVAL_MS, GRACE_PERIOD_MS, NEURO_SAN_CALLOUT_DELAY_MS, SHOW_TOUR_DELAY_MS, TRIGGER_APP_TOUR_EVENT_NAME, } from "./const.js";
35
+ import { NeuroSanStudioCallout } from "./NeuroSanStudioCallout.js";
36
+ import { PanelSeparator } from "./PanelSeparator.js";
37
+ import { BYOK } from "./Schema/SlyData.js";
32
38
  import { Sidebar } from "./Sidebar/Sidebar.js";
33
39
  import { extractTemporaryNetworksFromMessage, isTemporaryNetwork, notifySaveError, streamNetworkDesignerUpsert, } from "./TemporaryNetworks.js";
34
40
  import { MAIN_TOUR_STEPS } from "./Tour/MainTourSteps.js";
35
41
  import { getAgentFunction, getAgentNetworks, getConnectivity } from "../../controller/agent/Agent.js";
36
42
  import { getAgentIconSuggestions, getNetworkIconSuggestions } from "../../controller/agent/IconSuggestions.js";
43
+ import { AnnouncementId, useAnnouncementsStore } from "../../state/Announcements.js";
37
44
  import { useAgentChatHistoryStore } from "../../state/ChatHistory.js";
45
+ import { getApiKey, LLM_PROVIDER_API_KEY_FIELD, useSettingsStore } from "../../state/Settings.js";
38
46
  import { useTempNetworksStore } from "../../state/TemporaryNetworks.js";
39
47
  import { TourPromptState, useTourStore } from "../../state/Tour.js";
40
48
  import { toDisplayName } from "../../utils/AgentName.js";
@@ -47,10 +55,6 @@ import { ConfirmationModal, StyledButton } from "../Common/ConfirmationModal.js"
47
55
  import { MUIAlert } from "../Common/MUIAlert.js";
48
56
  import { MUIDialog } from "../Common/MUIDialog.js";
49
57
  import { closeNotification, NotificationType, sendNotification } from "../Common/notification.js";
50
- import { BYOK } from "./Schema/SlyData.js";
51
- import { getApiKey, LLM_PROVIDER_API_KEY_FIELD, useSettingsStore } from "../../state/Settings.js";
52
- // Animation time for the left and right panels to slide in or out when launching the animation
53
- const GROW_ANIMATION_TIME_MS = 800;
54
58
  // Optimization to avoid creating a new empty map on every render
55
59
  const EMPTY_THOUGHT_BUBBLE_EDGES = new Map();
56
60
  /**
@@ -88,6 +92,8 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
88
92
  const networkDisplayName = useMemo(() => toDisplayName(selectedNetwork, useNativeNames), [selectedNetwork, useNativeNames]);
89
93
  // LLM providers for which BYOK keys are supported by the current network
90
94
  const [supportedByokProviders, setSupportedByokProviders] = useState(new Set());
95
+ // The sly_data_schema advertised by the current network, if any. Drives schema hints in the sly_data dialog.
96
+ const [slyDataSchema, setSlyDataSchema] = useState(undefined);
91
97
  const neuroSanURL = useSettingsStore((state) => state.settings.externalServices.neuroSanUrl) ?? defaultNeuroSanUrl;
92
98
  // Tracks how many times each agent has been involved in the conversation
93
99
  const [agentCounts, setAgentCounts] = useState(new Map());
@@ -105,7 +111,7 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
105
111
  const [tourModalOpen, setTourModalOpen] = useState(false);
106
112
  const [haveShownTourModal, setHaveShownTourModal] = useState(false);
107
113
  // Memoized key for agent names to trigger icon suggestion updates when the set of agents changes, not just
108
- // when sorting/other operations on the agents list
114
+ // when sorting/other operations on the "agents" list
109
115
  const agentNamesKey = useMemo(() => agentsInNetwork
110
116
  .map((agent) => agent.origin)
111
117
  .sort()
@@ -136,12 +142,18 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
136
142
  skip: "Exit Tour",
137
143
  },
138
144
  });
145
+ // Neuro SAN Studio callout
146
+ const [neuroSanCalloutOpen, setNeuroSanCalloutOpen] = useState(false);
147
+ const haveShownNeuroSanCallout = useAnnouncementsStore((state) => state.hasShown(AnnouncementId.NeuroSanStudioGithubStar));
148
+ const markAnnouncementShown = useAnnouncementsStore((state) => state.markShown);
139
149
  const resetState = useCallback(() => {
140
150
  setThoughtBubbleEdges(new Map());
141
151
  setIsStreaming(false);
142
152
  }, []);
143
153
  // Reference to the ChatCommon component to allow external stop button to call its handleStop method
144
154
  const chatRef = useRef(null);
155
+ const leftPanelRef = usePanelRef();
156
+ const rightPanelRef = usePanelRef();
145
157
  // Clear chat whenever the user navigates to the Agent Network Designer, so they start fresh each time
146
158
  useEffect(() => {
147
159
  if (selectedNetwork === AGENT_NETWORK_DESIGNER_ID) {
@@ -269,11 +281,13 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
269
281
  // Reset before fetching
270
282
  setNetworkDescription("");
271
283
  setSupportedByokProviders(new Set());
284
+ setSlyDataSchema(undefined);
272
285
  // Get agent function from server
273
286
  const agentFunction = await getAgentFunction(neuroSanURL, selectedNetwork, username);
274
287
  setNetworkDescription(agentFunction?.function?.description || "");
275
288
  const schema = agentFunction?.function?.sly_data_schema;
276
289
  setSupportedByokProviders(getSupportedLlmProviders(schema));
290
+ setSlyDataSchema(schema);
277
291
  }
278
292
  catch (e) {
279
293
  console.warn(`Unable to get agent details for network ${selectedNetwork}:`, e);
@@ -446,7 +460,7 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
446
460
  }, [isNetworkDesignerMode]);
447
461
  /**
448
462
  * Handles a save from the AgentFlow popup: streams the updated definition to the network designer,
449
- * collects reservations from each chunk, then upserts the result and navigates if the network changed.
463
+ * collects reservations from each chunk, then upserts the result, and navigates if the network changed.
450
464
  */
451
465
  const onSaveAgent = useCallback(async (agentName, updated, agentNetworkName, signal) => {
452
466
  try {
@@ -482,14 +496,24 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
482
496
  setAgentsInNetworkDesigner([]);
483
497
  // Mark that streaming has started
484
498
  setIsStreaming(true);
485
- }, []);
499
+ // Collapse outer panels for Zen mode
500
+ if (enableZenMode) {
501
+ leftPanelRef?.current?.collapse();
502
+ rightPanelRef?.current?.collapse();
503
+ }
504
+ }, [enableZenMode, leftPanelRef, rightPanelRef]);
486
505
  const onStreamingComplete = useCallback(() => {
487
506
  // When streaming is complete, clean up any refs and state
488
507
  conversationsRef.current = null;
489
508
  setCurrentConversations(null);
490
509
  setAgentsInNetworkDesigner([]);
491
510
  resetState();
492
- }, [resetState]);
511
+ // Un-collapse outer panels for Zen mode
512
+ if (enableZenMode) {
513
+ leftPanelRef?.current?.expand();
514
+ rightPanelRef?.current?.expand();
515
+ }
516
+ }, [enableZenMode, leftPanelRef, resetState, rightPanelRef]);
493
517
  const handleDeleteNetwork = (networkId, isExpired) => {
494
518
  if (isExpired) {
495
519
  // It's expired, so just delete it without confirmation
@@ -524,6 +548,19 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
524
548
  clearTimeout(timer);
525
549
  };
526
550
  }, [haveShownTourModal, tourRequested, tourStatus]);
551
+ // Show Neuro SAN Studio callout after a delay if the user hasn't seen it yet
552
+ useEffect(() => {
553
+ // If it's already open, or we've already shown it, just return
554
+ if (neuroSanCalloutOpen || haveShownNeuroSanCallout)
555
+ return undefined;
556
+ // Show callout after a delay
557
+ const timer = setTimeout(() => {
558
+ setNeuroSanCalloutOpen(true);
559
+ }, NEURO_SAN_CALLOUT_DELAY_MS);
560
+ return () => {
561
+ clearTimeout(timer);
562
+ };
563
+ }, [haveShownNeuroSanCallout, neuroSanCalloutOpen]);
527
564
  useEffect(() => {
528
565
  if (!tourRequested)
529
566
  return;
@@ -541,49 +578,31 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
541
578
  return intersection.size === 0 ? supportedByokProviders : new Set();
542
579
  };
543
580
  const hasMissingApiKeys = getMissingApiKeys().size > 0;
544
- const getLeftPanel = () => {
545
- return (_jsx(Slide, { id: "multi-agent-accelerator-grid-sidebar-slide", in: !enableZenMode || !isAwaitingLlm, direction: "right", timeout: GROW_ANIMATION_TIME_MS, onExited: () => {
546
- setIsStreaming(true);
547
- }, children: _jsx(Grid, { id: "multi-agent-accelerator-grid-sidebar", size: enableZenMode && isStreaming ? 0 : 3.25, sx: {
548
- height: "100%",
549
- }, children: _jsx(Sidebar, { id: "multi-agent-accelerator-sidebar", isAwaitingLlm: isAwaitingLlm, networkIconSuggestions: networkIconSuggestions, networks: networks, neuroSanServerURL: neuroSanURL, newlyAddedTemporaryNetworks: newlyAddedTemporaryNetworks, onDeleteNetwork: handleDeleteNetwork, onEditNetwork: handleEditNetwork, setSelectedNetwork: (newNetwork) => changeSelectedNetwork(newNetwork), temporaryNetworks: temporaryNetworks }) }) }));
550
- };
551
- const getCenterPanel = () => {
552
- return (_jsx(Grid, { id: "multi-agent-accelerator-grid-agent-flow", size: enableZenMode && isStreaming ? 18 : 8.25, sx: {
553
- height: "100%",
554
- }, children: _jsx(ReactFlowProvider, { children: _jsx(Box, { id: "multi-agent-accelerator-agent-flow-container", sx: {
555
- display: "flex",
556
- justifyContent: "center",
557
- alignItems: "center",
558
- width: "100%",
559
- height: "100%",
560
- maxWidth: 1000,
561
- margin: "0 auto",
562
- }, children: _jsx(AgentFlow, { agentCounts: agentCounts, agentsInNetwork: agentsInNetwork, agentIconSuggestions: agentIconSuggestions, id: "multi-agent-accelerator-agent-flow", currentConversations: currentConversations, currentUser: username, isAwaitingLlm: isAwaitingLlm, isEditMode: isEditingNetwork, isStreaming: isStreaming, isSelectedNetworkTemporary: isSelectedNetworkTemporary, networkDisplayName: networkDisplayName || "", networkId: isSelectedNetworkTemporary ? selectedNetwork : "", neuroSanURL: neuroSanURL, onEnterEditMode: () => setIsEditingNetwork(true), onExitEditMode: () => setIsEditingNetwork(false), onNetworkReplaced: (_old, newId) => changeSelectedNetwork(newId), onSaveAgent: onSaveAgent, thoughtBubbleEdges: thoughtBubbleEdges, setThoughtBubbleEdges: setThoughtBubbleEdges }, "multi-agent-accelerator-agent-flow") }) }) }));
563
- };
564
- const getRightPanel = () => {
565
- return (_jsx(Slide, { id: "multi-agent-accelerator-grid-agent-chat-common-slide", in: !enableZenMode || !isAwaitingLlm, direction: "left", timeout: GROW_ANIMATION_TIME_MS, onExited: () => {
566
- setIsStreaming(true);
567
- }, children: _jsx(Grid, { id: "multi-agent-accelerator-grid-agent-chat-common", size: enableZenMode && isStreaming ? 0 : 6.5, sx: {
581
+ const getLeftPanel = () => (_jsx(Panel, { collapsible: true, defaultSize: "20%", id: "multi-agent-accelerator-left-panel", minSize: "10%", panelRef: leftPanelRef, children: _jsx(Sidebar, { id: "multi-agent-accelerator-sidebar", isAwaitingLlm: isAwaitingLlm, networkIconSuggestions: networkIconSuggestions, networks: networks, neuroSanServerURL: neuroSanURL, newlyAddedTemporaryNetworks: newlyAddedTemporaryNetworks, onDeleteNetwork: handleDeleteNetwork, onEditNetwork: handleEditNetwork, setSelectedNetwork: (newNetwork) => changeSelectedNetwork(newNetwork), temporaryNetworks: temporaryNetworks }) }));
582
+ const getCenterPanel = () => (_jsx(Panel, { collapsible: true, defaultSize: "45%", id: "multi-agent-accelerator-center-panel", minSize: "10%", children: _jsx(ReactFlowProvider, { children: _jsx(Box, { id: "multi-agent-accelerator-agent-flow-container", sx: {
583
+ display: "flex",
584
+ justifyContent: "center",
585
+ alignItems: "center",
586
+ width: "100%",
568
587
  height: "100%",
569
- }, children: _jsx(ChatCommon, { agentPlaceholders: {
570
- [AGENT_NETWORK_DESIGNER_ID]: "Describe in plain language the network you would like to build.",
571
- }, currentUser: username, customAgentGreetings: {
572
- [AGENT_NETWORK_DESIGNER_ID]: "Let's build a network together!",
573
- }, extraSlyData: extraSlyData, id: "agent-network-ui", isAwaitingLlm: isAwaitingLlm, hasMissingApiKeys: hasMissingApiKeys, networkDescription: networkDescription, neuroSanURL: neuroSanURL, onChunkReceived: onChunkReceived, onStreamingComplete: onStreamingComplete, onStreamingStarted: onStreamingStarted, ref: chatRef, sampleQueries: sampleQueries, setIsAwaitingLlm: setIsAwaitingLlm, selectedNetwork: selectedNetwork, setSelectedNetwork: changeSelectedNetwork }, selectedNetwork ?? "no-network") }) }));
574
- };
575
- const getStopButton = () => {
576
- return (_jsx(_Fragment, { children: isAwaitingLlm && enableZenMode && (_jsx(Box, { id: "stop-button-container", sx: {
577
- position: "absolute",
578
- bottom: "1rem",
579
- right: "1rem",
580
- zIndex: getZIndex(2, theme),
581
- }, children: _jsx(Tooltip, { title: "Stop response (Esc)", children: _jsx(LlmChatButton, { "aria-label": "Stop", id: "stop-output-button", onClick: handleExternalStop, sx: {
582
- "&:hover": {
583
- backgroundColor: "error.main",
584
- },
585
- }, children: _jsx(StopCircle, { fontSize: "large", id: "stop-button-icon" }) }) }) })) }));
586
- };
588
+ margin: "0 auto",
589
+ }, children: _jsx(AgentFlow, { agentCounts: agentCounts, agentsInNetwork: agentsInNetwork, agentIconSuggestions: agentIconSuggestions, id: "multi-agent-accelerator-agent-flow", currentConversations: currentConversations, currentUser: username, isAwaitingLlm: isAwaitingLlm, isEditingNetwork: isEditingNetwork, isStreaming: isStreaming, isTemporaryNetwork: isSelectedNetworkTemporary, networkDisplayName: networkDisplayName || "", networkId: isSelectedNetworkTemporary ? selectedNetwork : "", neuroSanURL: neuroSanURL, onSaveAgent: onSaveAgent, setIsEditingNetwork: setIsEditingNetwork, thoughtBubbleEdges: thoughtBubbleEdges, setSelectedNetwork: changeSelectedNetwork, setThoughtBubbleEdges: setThoughtBubbleEdges }, "multi-agent-accelerator-agent-flow") }) }) }));
590
+ const getRightPanel = () => (_jsx(Panel, { collapsible: true, defaultSize: "35%", id: "multi-agent-accelerator-right-panel", minSize: "15%", panelRef: rightPanelRef, children: _jsx(ChatCommon, { agentPlaceholders: {
591
+ [AGENT_NETWORK_DESIGNER_ID]: "Describe in plain language the network you would like to build.",
592
+ }, currentUser: username, customAgentGreetings: {
593
+ [AGENT_NETWORK_DESIGNER_ID]: "Let's build a network together!",
594
+ }, extraSlyData: extraSlyData, id: "agent-network-ui", isAwaitingLlm: isAwaitingLlm, hasMissingApiKeys: hasMissingApiKeys, networkDescription: networkDescription, neuroSanURL: neuroSanURL, onChunkReceived: onChunkReceived, onStreamingComplete: onStreamingComplete, onStreamingStarted: onStreamingStarted, ref: chatRef, sampleQueries: sampleQueries, setIsAwaitingLlm: setIsAwaitingLlm, selectedNetwork: selectedNetwork, setSelectedNetwork: changeSelectedNetwork, slyDataSchema: slyDataSchema }, selectedNetwork ?? "no-network") }));
595
+ const getStopButton = () => isAwaitingLlm &&
596
+ enableZenMode && (_jsx(Box, { id: "stop-button-container", sx: {
597
+ position: "absolute",
598
+ bottom: "1rem",
599
+ right: "1rem",
600
+ zIndex: getZIndex(2, theme),
601
+ }, children: _jsx(Tooltip, { title: "Stop response (Esc)", children: _jsx(LlmChatButton, { "aria-label": "Stop", id: "stop-output-button", onClick: handleExternalStop, sx: {
602
+ "&:hover": {
603
+ backgroundColor: "error.main",
604
+ },
605
+ }, children: _jsx(StopCircle, { fontSize: "large", id: "stop-button-icon" }) }) }) }));
587
606
  const getDeleteNetworkConfirmationModal = () => confirmationModalOpen ? (_jsx(ConfirmationModal, { id: "delete-network-confirmation-modal", content: `The network "${toDisplayName(networkToBeDeleted)}" will be deleted. ` +
588
607
  "This action cannot be undone. Are you sure you want to proceed?", handleCancel: () => {
589
608
  setConfirmationModalOpen(false);
@@ -619,8 +638,8 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
619
638
  * Popper to show real-time progress of the Agent Network Designer output as we receive it from the backend.
620
639
  * Only displayed when Agent Network Designer is active.
621
640
  */
622
- const getProgressPopper = () => (_jsx(Box, { sx: {
623
- display: isStreaming && isNetworkDesignerMode ? "block" : "none",
641
+ const getProgressPopper = () => isStreaming &&
642
+ isNetworkDesignerMode && (_jsx(Box, { sx: {
624
643
  position: "absolute",
625
644
  top: 0,
626
645
  left: 0,
@@ -647,13 +666,41 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
647
666
  textAlign: "center",
648
667
  },
649
668
  }, children: _jsxs(Typography, { sx: { fontSize: "larger" }, children: ["API key(s) required for at least one of these providers:", " ", _jsx("strong", { children: [...getMissingApiKeys()].join(", ") }), ". Please add the required key(s) in \"Settings\" to use this Network."] }) }));
650
- return (_jsxs(_Fragment, { children: [getMissingApiKeysAlert(), Tour, getTourModal(), getProgressPopper(), getDeleteNetworkConfirmationModal(), _jsxs(Grid, { id: "multi-agent-accelerator-grid", container: true, columns: 18, sx: {
651
- display: "flex",
652
- flex: 1,
653
- height: "85%",
654
- justifyContent: isAwaitingLlm ? "center" : "unset",
655
- marginTop: "1rem",
656
- overflow: "hidden",
669
+ const getNeuroSanStudioCallout = () => (_jsx(Snackbar, { anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: neuroSanCalloutOpen, slotProps: {
670
+ clickAwayListener: {
671
+ onClickAway: (event) => {
672
+ ;
673
+ event.defaultMuiPrevented =
674
+ true;
675
+ },
676
+ },
677
+ transition: {
678
+ timeout: {
679
+ enter: 500,
680
+ exit: 250,
681
+ },
682
+ },
683
+ }, slots: { transition: Slide }, sx: { mb: 2 }, children: _jsxs(Box, { sx: {
684
+ position: "relative",
685
+ maxWidth: 340,
686
+ }, children: [_jsx(IconButton, { "aria-label": "Close Neuro SAN Studio callout", onClick: (event) => {
687
+ event.preventDefault();
688
+ event.stopPropagation();
689
+ setNeuroSanCalloutOpen(false);
690
+ markAnnouncementShown(AnnouncementId.NeuroSanStudioGithubStar);
691
+ }, role: "button", size: "small", sx: {
692
+ bgcolor: "background.paper",
693
+ position: "absolute",
694
+ right: 4,
695
+ top: 20,
696
+ "&:hover": {
697
+ bgcolor: "action.hover",
698
+ },
699
+ }, children: _jsx(Close, { fontSize: "small" }) }), _jsx(NeuroSanStudioCallout, {})] }) }));
700
+ return (_jsxs(_Fragment, { children: [getNeuroSanStudioCallout(), getMissingApiKeysAlert(), Tour, getTourModal(), getProgressPopper(), getDeleteNetworkConfirmationModal(), _jsxs(Box, { id: "multi-agent-accelerator-container", sx: {
657
701
  position: "relative",
658
- }, children: [getLeftPanel(), getCenterPanel(), getRightPanel(), getStopButton()] })] }));
702
+ width: "100%",
703
+ height: "100%",
704
+ minHeight: 0,
705
+ }, children: [_jsxs(Group, { children: [getLeftPanel(), _jsx(PanelSeparator, {}), getCenterPanel(), _jsx(PanelSeparator, {}), getRightPanel()] }), getStopButton()] })] }));
659
706
  };
@@ -0,0 +1,2 @@
1
+ import { FC } from "react";
2
+ export declare const NeuroSanStudioCallout: FC;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Box from "@mui/material/Box";
3
+ import Paper from "@mui/material/Paper";
4
+ import { alpha } from "@mui/material/styles";
5
+ import Typography from "@mui/material/Typography";
6
+ export const NeuroSanStudioCallout = () => (_jsxs(Paper, { "aria-label": "neuro-san-studio GitHub repository", component: "a", elevation: 4, href: "https://github.com/cognizant-ai-lab/neuro-san-studio", rel: "noopener noreferrer", sx: (theme) => {
7
+ const paper = theme.palette.background.paper;
8
+ const primary = theme.palette.primary.main;
9
+ return {
10
+ "&:hover": {
11
+ backgroundImage: `linear-gradient(135deg, ${paper}, ${alpha(primary, 0.14)})`,
12
+ borderColor: "primary.main",
13
+ boxShadow: `0 0 0 3px ${alpha(primary, 0.22)}, ${theme.shadows[6]}`,
14
+ color: "secondary.main",
15
+ },
16
+ bgcolor: "background.paper",
17
+ backgroundImage: `linear-gradient(135deg, ${paper}, ${alpha(primary, 0.06)})`,
18
+ border: "1px solid",
19
+ borderColor: "divider",
20
+ borderRadius: 2,
21
+ color: "text.primary",
22
+ display: "block",
23
+ mt: 2,
24
+ p: 2,
25
+ textAlign: "center",
26
+ textDecoration: "none", // prevent underline on hover
27
+ transition: theme.transitions.create(["color", "border-color", "box-shadow"], {
28
+ duration: theme.transitions.duration.shortest,
29
+ }),
30
+ };
31
+ }, target: "_blank", children: [_jsx(Typography, { sx: { fontWeight: 700 }, variant: "body1", children: "\u2B50 Star us on GitHub!" }), _jsx(Typography, { sx: { mt: 0.5, mb: 1.25, opacity: 0.92 }, variant: "body2", children: "See the latest releases, explore examples, read the User Guide and help grow the community on GitHub." }), _jsx(Box, { alt: "GitHub Repo stars", component: "img", loading: "lazy", referrerPolicy: "no-referrer", src: "https://img.shields.io/github/stars/cognizant-ai-lab/neuro-san-studio?label=Neuro%20SAN%20Studio", sx: {
32
+ borderRadius: 1,
33
+ border: "1px solid",
34
+ borderColor: "divider",
35
+ display: "inline-block",
36
+ height: 20,
37
+ verticalAlign: "middle",
38
+ } })] }));
@@ -0,0 +1,5 @@
1
+ import { FC } from "react";
2
+ /**
3
+ * Styled Separator that wraps the default react-resizable-panels Separator component. It adds some visual flair.
4
+ */
5
+ export declare const PanelSeparator: FC;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import DragIndicator from "@mui/icons-material/DragIndicator";
3
+ import Box from "@mui/material/Box";
4
+ import { Separator } from "react-resizable-panels";
5
+ /**
6
+ * Styled Separator that wraps the default react-resizable-panels Separator component. It adds some visual flair.
7
+ */
8
+ export const PanelSeparator = () => (_jsx(Separator, { style: {
9
+ width: "14px",
10
+ cursor: "col-resize",
11
+ display: "flex",
12
+ alignItems: "center",
13
+ justifyContent: "center",
14
+ flexShrink: 0,
15
+ }, children: _jsx(Box, { sx: {
16
+ width: "14px",
17
+ height: "100%",
18
+ display: "flex",
19
+ alignItems: "center",
20
+ justifyContent: "center",
21
+ transition: "background-color 120ms ease",
22
+ "&:hover": {
23
+ backgroundColor: "action.hover",
24
+ },
25
+ "&:hover .separator-grip": {
26
+ borderColor: "primary.main",
27
+ backgroundColor: "background.paper",
28
+ color: "primary.main",
29
+ boxShadow: 2,
30
+ opacity: 1,
31
+ },
32
+ }, children: _jsx(Box, { className: "separator-grip", sx: {
33
+ width: "18px",
34
+ height: "44px",
35
+ borderRadius: "999px",
36
+ border: "1px solid",
37
+ borderColor: "divider",
38
+ backgroundColor: "background.default",
39
+ color: "text.secondary",
40
+ opacity: 0.75,
41
+ display: "flex",
42
+ alignItems: "center",
43
+ justifyContent: "center",
44
+ transition: "background-color 120ms ease, border-color 120ms ease, color 120ms ease, " +
45
+ "box-shadow 120ms ease, opacity 120ms ease",
46
+ }, children: _jsx(DragIndicator, { fontSize: "small", sx: { fontSize: "1rem" } }) }) }) }));
@@ -75,12 +75,13 @@ const NEURO_SAN_PING_INTERVAL_MS = 30_000;
75
75
  //#region: Styled Components
76
76
  // Styled component for Sidebar aside element, including styles for the sparkle highlight animation
77
77
  // when a new temporary network is added.
78
- const SidebarAside = styled("aside")({
78
+ const SidebarAside = styled("aside")(({ theme }) => ({
79
79
  borderRightStyle: "solid",
80
80
  borderRightWidth: "1px",
81
81
  height: "100%",
82
+ marginRight: theme.spacing(1),
82
83
  overflowY: "auto",
83
- paddingRight: "0.75rem",
84
+ paddingRight: theme.spacing(1.5),
84
85
  [`& .${SPARKLE_HIGHLIGHT_CLASS}`]: {
85
86
  background: "linear-gradient(90deg, gold, orange, cyan, magenta, gold)",
86
87
  backgroundSize: "400% 100%",
@@ -89,7 +90,7 @@ const SidebarAside = styled("aside")({
89
90
  borderRadius: "4px",
90
91
  opacity: 1,
91
92
  },
92
- });
93
+ }));
93
94
  // Styled component for the sidebar heading, which is sticky at the top of the sidebar.
94
95
  const SidebarHeading = styled("h2")(({ theme }) => ({
95
96
  alignItems: "center",
@@ -1,4 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Typography from "@mui/material/Typography";
3
+ import { NeuroSanStudioCallout } from "../NeuroSanStudioCallout.js";
2
4
  /**
3
5
  * This file defines the steps for the main tour of the Multi-Agent Accelerator application.
4
6
  *
@@ -9,13 +11,13 @@ export const MAIN_TOUR_STEPS = [
9
11
  // First step doesn't refer to any particular UI element, just a welcome message
10
12
  content: "Welcome to Cognizant AI Lab Multi-Agent Accelerator! This tour will give you a quick overview of " +
11
13
  "the application.",
12
- target: () => document.querySelector("#multi-agent-accelerator-grid"),
14
+ target: () => document.querySelector("#multi-agent-accelerator-center-panel"),
13
15
  placement: "center",
14
16
  },
15
17
  {
16
18
  content: "This is the list of agent networks available on the server. Select a network to see its agents and " +
17
19
  "start interacting with it!",
18
- target: () => document.querySelector("#multi-agent-accelerator-sidebar-heading"),
20
+ target: () => document.querySelector(".MuiRichTreeView-root"),
19
21
  placement: "bottom",
20
22
  },
21
23
  {
@@ -33,7 +35,7 @@ export const MAIN_TOUR_STEPS = [
33
35
  content: "These are the agents within the current network. The arrows show the flow of information between " +
34
36
  "them and the tools used by each agent. For networks you have created, you can click on an agent " +
35
37
  "to edit it",
36
- target: () => document.querySelector("#multi-agent-accelerator-grid-agent-flow"),
38
+ target: () => document.querySelector("#multi-agent-accelerator-center-panel"),
37
39
  placement: "auto",
38
40
  },
39
41
  {
@@ -63,7 +65,8 @@ export const MAIN_TOUR_STEPS = [
63
65
  placement: "top",
64
66
  },
65
67
  {
66
- content: "Click this button to display a menu that allows you to choose how content is displayed in the chat window",
68
+ content: "Click this button to display a menu that allows you to choose how content is displayed in the chat " +
69
+ "window. Here you can also enter any sly_data items required by the network (advanced).",
67
70
  target: () => document.querySelector("#agent-network-ui-options-menu-button-container"),
68
71
  placement: "bottom",
69
72
  },
@@ -87,8 +90,7 @@ export const MAIN_TOUR_STEPS = [
87
90
  placement: "top",
88
91
  },
89
92
  {
90
- content: "If you want to take the tour again, or if you have any questions or need help, click here to access " +
91
- "the help information or to contact the Cognizant AI Labs team. We'd love to hear from you!",
93
+ content: (_jsxs(_Fragment, { children: [_jsx(Typography, { sx: { mb: 1 }, variant: "body2", children: "Need help, want to retake the tour, or have feedback? Use this menu to find help resources and contact the Cognizant AI Labs team." }), _jsx(NeuroSanStudioCallout, {})] })),
92
94
  target: () => document.querySelector("#help-dropdown"),
93
95
  placement: "top",
94
96
  },
@@ -27,5 +27,6 @@ export declare const EXPIRED_NETWORKS_CHECK_INTERVAL_MS: number;
27
27
  export declare const GRACE_PERIOD_MS: number;
28
28
  export declare const LEVEL_SPACING = 150;
29
29
  export declare const SHOW_TOUR_DELAY_MS = 5000;
30
+ export declare const NEURO_SAN_CALLOUT_DELAY_MS = 5000;
30
31
  export declare const TEMPORARY_NETWORK_FOLDER = "temporary";
31
32
  export declare const TRIGGER_APP_TOUR_EVENT_NAME = "trigger-app-tour";
@@ -45,6 +45,8 @@ export const GRACE_PERIOD_MS = 5 * 60 * 1000; // 5 minutes
45
45
  export const LEVEL_SPACING = 150;
46
46
  // We show the tour modal after this amount of time so as not to "pounce" on the user when they first open the app
47
47
  export const SHOW_TOUR_DELAY_MS = 5000;
48
+ // Show the Neuro SAN Studio callout after this many MS
49
+ export const NEURO_SAN_CALLOUT_DELAY_MS = 5000;
48
50
  // Temporary folder name for networks created from agent reservations. These networks are not "in a folder" when
49
51
  // they come from the backend, but we need to put them somewhere in the UI, and this makes it clear that they're
50
52
  // temporary.
@@ -0,0 +1,22 @@
1
+ import { FC } from "react";
2
+ import { KeyValidationFailure } from "../../controller/llm/Providers.js";
3
+ import { LLMProvider } from "../../state/Settings.js";
4
+ interface ApiKeyErrorBannerProps {
5
+ readonly id: string;
6
+ readonly failures: readonly ApiKeyFailure[];
7
+ }
8
+ export interface ApiKeyFailure {
9
+ readonly vendor: LLMProvider;
10
+ readonly result: KeyValidationFailure;
11
+ }
12
+ /**
13
+ * The banner header for a failure: `<vendor> — <reason phrase> (<status>)`, falling back to
14
+ * `<vendor> — Request failed` when the status has no reason phrase, or `<vendor> — Request failed`
15
+ * with no code when the failure carries no status at all.
16
+ */
17
+ export declare const errorTitle: ({ vendor, result: { status: statusCode } }: ApiKeyFailure) => string;
18
+ /**
19
+ * A banner shown at the top of the API Keys section that aggregates all failing key-test results.
20
+ */
21
+ export declare const ApiKeyErrorBanner: FC<ApiKeyErrorBannerProps>;
22
+ export {};
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Box from "@mui/material/Box";
3
+ import Typography from "@mui/material/Typography";
4
+ import httpStatus from "http-status";
5
+ import { MUIAlert } from "../Common/MUIAlert.js";
6
+ /**
7
+ * The banner header for a failure: `<vendor> — <reason phrase> (<status>)`, falling back to
8
+ * `<vendor> — Request failed` when the status has no reason phrase, or `<vendor> — Request failed`
9
+ * with no code when the failure carries no status at all.
10
+ */
11
+ export const errorTitle = ({ vendor, result: { status: statusCode } }) => statusCode !== undefined
12
+ ? `${vendor} — ${httpStatus[statusCode] ?? "Unknown status"} (${statusCode})`
13
+ : `${vendor} — Request failed`;
14
+ const FailureRow = ({ id, failure }) => {
15
+ const { message } = failure.result;
16
+ return (_jsxs(Box, { "data-testid": `${id}-failure`, children: [_jsx(Typography, { sx: { fontWeight: 700 }, variant: "body2", children: errorTitle(failure) }), message ? (_jsx(Typography, { "data-testid": `${id}-message`, sx: { mt: 0.25, overflowWrap: "anywhere" }, variant: "body2", children: message })) : null] }));
17
+ };
18
+ /**
19
+ * A banner shown at the top of the API Keys section that aggregates all failing key-test results.
20
+ */
21
+ export const ApiKeyErrorBanner = ({ id, failures }) => {
22
+ if (failures.length === 0) {
23
+ return null;
24
+ }
25
+ return (_jsx(MUIAlert, { id: id, severity: "error", sx: { width: "100%" }, children: _jsx(Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5, minWidth: 0 }, children: failures.map((failure) => (_jsx(FailureRow, { failure: failure, id: `${id}-${failure.vendor.toLowerCase()}` }, failure.vendor))) }) }));
26
+ };
@@ -1,13 +1,16 @@
1
1
  import { FC } from "react";
2
+ import { KeyValidationFailure, KeyValidationResult } from "../../controller/llm/Providers.js";
3
+ import { LLMProvider } from "../../state/Settings.js";
2
4
  interface ApiKeyInputProps {
3
5
  readonly forgetKey: () => void;
4
6
  readonly id: string;
5
7
  readonly logo: string;
8
+ readonly onResultChange?: (vendor: LLMProvider, result: KeyValidationFailure | null) => void;
6
9
  readonly onSave: (key: string) => void;
7
- readonly onTest: (key: string) => Promise<boolean>;
10
+ readonly onTest: (key: string) => Promise<KeyValidationResult>;
8
11
  readonly persistedValue: string;
9
12
  readonly placeholder: string;
10
- readonly vendor: string;
13
+ readonly vendor: LLMProvider;
11
14
  }
12
15
  /**
13
16
  * Component for inputting an API key for a given vendor, with the ability to test the key and forget the saved key.
@@ -10,12 +10,13 @@ import InputAdornment from "@mui/material/InputAdornment";
10
10
  import TextField from "@mui/material/TextField";
11
11
  import Tooltip from "@mui/material/Tooltip";
12
12
  import { useEffect, useState } from "react";
13
+ import { isKeyValidationFailure } from "../../controller/llm/Providers.js";
13
14
  import { ConfirmationModal } from "../Common/ConfirmationModal.js";
14
15
  import { StatusLight } from "../Common/StatusLight.js";
15
16
  /**
16
17
  * Component for inputting an API key for a given vendor, with the ability to test the key and forget the saved key.
17
18
  */
18
- export const ApiKeyInput = ({ forgetKey, id, logo, onSave, onTest, persistedValue, placeholder, vendor, }) => {
19
+ export const ApiKeyInput = ({ forgetKey, id, logo, onResultChange, onSave, onTest, persistedValue, placeholder, vendor, }) => {
19
20
  const [inputValue, setInputValue] = useState(persistedValue ?? "");
20
21
  const [keyValidated, setKeyValidated] = useState(null);
21
22
  const [isValidating, setIsValidating] = useState(false);
@@ -23,14 +24,17 @@ export const ApiKeyInput = ({ forgetKey, id, logo, onSave, onTest, persistedValu
23
24
  const [showKey, setShowKey] = useState(false);
24
25
  const handleValueChange = (e) => {
25
26
  setKeyValidated(null);
27
+ onResultChange?.(vendor, null);
26
28
  setInputValue(e.target.value);
27
29
  };
28
30
  const handleOnTest = async () => {
29
31
  setIsValidating(true);
30
32
  setKeyValidated(null);
33
+ onResultChange?.(vendor, null);
31
34
  try {
32
- const isValid = await onTest(inputValue);
33
- setKeyValidated(isValid);
35
+ const result = await onTest(inputValue);
36
+ setKeyValidated(result.ok);
37
+ onResultChange?.(vendor, isKeyValidationFailure(result) ? result : null);
34
38
  }
35
39
  finally {
36
40
  setIsValidating(false);
@@ -41,10 +45,12 @@ export const ApiKeyInput = ({ forgetKey, id, logo, onSave, onTest, persistedValu
41
45
  useEffect(() => {
42
46
  setInputValue(persistedValue ?? "");
43
47
  setKeyValidated(null);
44
- }, [persistedValue]);
48
+ onResultChange?.(vendor, null);
49
+ }, [persistedValue, vendor, onResultChange]);
45
50
  const handleClearInput = () => {
46
51
  setInputValue("");
47
52
  setKeyValidated(null);
53
+ onResultChange?.(vendor, null);
48
54
  };
49
55
  return (_jsxs(Box, { "data-testid": `${id}-input`, sx: { display: "flex", alignItems: "center", width: "100%", gap: 2 }, children: [confirmationDialogOpen ? (_jsx(ConfirmationModal, { id: `${id}-forget-key-confirmation-modal`, content: `This will forget the currently saved API key for ${vendor} and you will need to enter ` +
50
56
  " the key again to use networks that require it. Are you sure you want to continue?", handleCancel: () => {