@cognizant-ai-lab/ui-common 1.10.0 → 1.11.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 (51) hide show
  1. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +27 -6
  2. package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
  3. package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
  4. package/dist/components/AgentChat/ChatCommon/SlyDataDialog.d.ts +29 -0
  5. package/dist/components/AgentChat/ChatCommon/SlyDataDialog.js +150 -0
  6. package/dist/components/AgentChat/Common/LlmChatButton.d.ts +4 -6
  7. package/dist/components/AgentChat/Common/LlmChatButton.js +0 -2
  8. package/dist/components/Common/ConfirmationModal.d.ts +3 -2
  9. package/dist/components/Common/Navbar.d.ts +2 -1
  10. package/dist/components/Common/Navbar.js +3 -3
  11. package/dist/components/ErrorPage/ErrorPage.js +4 -4
  12. package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.d.ts +7 -7
  13. package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +143 -390
  14. package/dist/components/MultiAgentAccelerator/Editor/AgentNodeEditor.d.ts +24 -0
  15. package/dist/components/MultiAgentAccelerator/Editor/AgentNodeEditor.js +128 -0
  16. package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.d.ts +21 -0
  17. package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.js +305 -0
  18. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +105 -62
  19. package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.d.ts +2 -0
  20. package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.js +38 -0
  21. package/dist/components/MultiAgentAccelerator/PanelSeparator.d.ts +5 -0
  22. package/dist/components/MultiAgentAccelerator/PanelSeparator.js +46 -0
  23. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +4 -3
  24. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +8 -6
  25. package/dist/components/MultiAgentAccelerator/const.d.ts +1 -0
  26. package/dist/components/MultiAgentAccelerator/const.js +2 -0
  27. package/dist/components/Settings/ApiKeyErrorBanner.d.ts +22 -0
  28. package/dist/components/Settings/ApiKeyErrorBanner.js +26 -0
  29. package/dist/components/Settings/ApiKeyInput.d.ts +5 -2
  30. package/dist/components/Settings/ApiKeyInput.js +10 -4
  31. package/dist/components/Settings/SettingsDialog.js +22 -5
  32. package/dist/const.d.ts +0 -1
  33. package/dist/const.js +0 -1
  34. package/dist/controller/llm/Providers.d.ts +19 -2
  35. package/dist/controller/llm/Providers.js +45 -31
  36. package/dist/state/Announcements.d.ts +24 -0
  37. package/dist/state/Announcements.js +29 -0
  38. package/dist/state/ChatHistory.d.ts +10 -1
  39. package/dist/state/ChatHistory.js +8 -0
  40. package/dist/state/Environment.d.ts +2 -0
  41. package/dist/state/Environment.js +2 -0
  42. package/dist/state/Settings.d.ts +14 -0
  43. package/dist/state/Settings.js +6 -2
  44. package/dist/tsconfig.build.tsbuildinfo +1 -1
  45. package/dist/utils/Authentication.d.ts +7 -0
  46. package/dist/utils/Authentication.js +19 -5
  47. package/dist/utils/SlyData.d.ts +56 -0
  48. package/dist/utils/SlyData.js +106 -0
  49. package/package.json +7 -6
  50. package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +0 -30
  51. 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
  /**
@@ -105,7 +109,7 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
105
109
  const [tourModalOpen, setTourModalOpen] = useState(false);
106
110
  const [haveShownTourModal, setHaveShownTourModal] = useState(false);
107
111
  // 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
112
+ // when sorting/other operations on the "agents" list
109
113
  const agentNamesKey = useMemo(() => agentsInNetwork
110
114
  .map((agent) => agent.origin)
111
115
  .sort()
@@ -136,12 +140,18 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
136
140
  skip: "Exit Tour",
137
141
  },
138
142
  });
143
+ // Neuro SAN Studio callout
144
+ const [neuroSanCalloutOpen, setNeuroSanCalloutOpen] = useState(false);
145
+ const haveShownNeuroSanCallout = useAnnouncementsStore((state) => state.hasShown(AnnouncementId.NeuroSanStudioGithubStar));
146
+ const markAnnouncementShown = useAnnouncementsStore((state) => state.markShown);
139
147
  const resetState = useCallback(() => {
140
148
  setThoughtBubbleEdges(new Map());
141
149
  setIsStreaming(false);
142
150
  }, []);
143
151
  // Reference to the ChatCommon component to allow external stop button to call its handleStop method
144
152
  const chatRef = useRef(null);
153
+ const leftPanelRef = usePanelRef();
154
+ const rightPanelRef = usePanelRef();
145
155
  // Clear chat whenever the user navigates to the Agent Network Designer, so they start fresh each time
146
156
  useEffect(() => {
147
157
  if (selectedNetwork === AGENT_NETWORK_DESIGNER_ID) {
@@ -446,7 +456,7 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
446
456
  }, [isNetworkDesignerMode]);
447
457
  /**
448
458
  * 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.
459
+ * collects reservations from each chunk, then upserts the result, and navigates if the network changed.
450
460
  */
451
461
  const onSaveAgent = useCallback(async (agentName, updated, agentNetworkName, signal) => {
452
462
  try {
@@ -482,14 +492,24 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
482
492
  setAgentsInNetworkDesigner([]);
483
493
  // Mark that streaming has started
484
494
  setIsStreaming(true);
485
- }, []);
495
+ // Collapse outer panels for Zen mode
496
+ if (enableZenMode) {
497
+ leftPanelRef?.current?.collapse();
498
+ rightPanelRef?.current?.collapse();
499
+ }
500
+ }, [enableZenMode, leftPanelRef, rightPanelRef]);
486
501
  const onStreamingComplete = useCallback(() => {
487
502
  // When streaming is complete, clean up any refs and state
488
503
  conversationsRef.current = null;
489
504
  setCurrentConversations(null);
490
505
  setAgentsInNetworkDesigner([]);
491
506
  resetState();
492
- }, [resetState]);
507
+ // Un-collapse outer panels for Zen mode
508
+ if (enableZenMode) {
509
+ leftPanelRef?.current?.expand();
510
+ rightPanelRef?.current?.expand();
511
+ }
512
+ }, [enableZenMode, leftPanelRef, resetState, rightPanelRef]);
493
513
  const handleDeleteNetwork = (networkId, isExpired) => {
494
514
  if (isExpired) {
495
515
  // It's expired, so just delete it without confirmation
@@ -524,6 +544,19 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
524
544
  clearTimeout(timer);
525
545
  };
526
546
  }, [haveShownTourModal, tourRequested, tourStatus]);
547
+ // Show Neuro SAN Studio callout after a delay if the user hasn't seen it yet
548
+ useEffect(() => {
549
+ // If it's already open, or we've already shown it, just return
550
+ if (neuroSanCalloutOpen || haveShownNeuroSanCallout)
551
+ return undefined;
552
+ // Show callout after a delay
553
+ const timer = setTimeout(() => {
554
+ setNeuroSanCalloutOpen(true);
555
+ }, NEURO_SAN_CALLOUT_DELAY_MS);
556
+ return () => {
557
+ clearTimeout(timer);
558
+ };
559
+ }, [haveShownNeuroSanCallout, neuroSanCalloutOpen]);
527
560
  useEffect(() => {
528
561
  if (!tourRequested)
529
562
  return;
@@ -541,49 +574,31 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
541
574
  return intersection.size === 0 ? supportedByokProviders : new Set();
542
575
  };
543
576
  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: {
577
+ 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 }) }));
578
+ 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: {
579
+ display: "flex",
580
+ justifyContent: "center",
581
+ alignItems: "center",
582
+ width: "100%",
568
583
  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
- };
584
+ margin: "0 auto",
585
+ }, 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") }) }) }));
586
+ const getRightPanel = () => (_jsx(Panel, { collapsible: true, defaultSize: "35%", id: "multi-agent-accelerator-right-panel", minSize: "15%", panelRef: rightPanelRef, children: _jsx(ChatCommon, { agentPlaceholders: {
587
+ [AGENT_NETWORK_DESIGNER_ID]: "Describe in plain language the network you would like to build.",
588
+ }, currentUser: username, customAgentGreetings: {
589
+ [AGENT_NETWORK_DESIGNER_ID]: "Let's build a network together!",
590
+ }, 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") }));
591
+ const getStopButton = () => isAwaitingLlm &&
592
+ enableZenMode && (_jsx(Box, { id: "stop-button-container", sx: {
593
+ position: "absolute",
594
+ bottom: "1rem",
595
+ right: "1rem",
596
+ zIndex: getZIndex(2, theme),
597
+ }, children: _jsx(Tooltip, { title: "Stop response (Esc)", children: _jsx(LlmChatButton, { "aria-label": "Stop", id: "stop-output-button", onClick: handleExternalStop, sx: {
598
+ "&:hover": {
599
+ backgroundColor: "error.main",
600
+ },
601
+ }, children: _jsx(StopCircle, { fontSize: "large", id: "stop-button-icon" }) }) }) }));
587
602
  const getDeleteNetworkConfirmationModal = () => confirmationModalOpen ? (_jsx(ConfirmationModal, { id: "delete-network-confirmation-modal", content: `The network "${toDisplayName(networkToBeDeleted)}" will be deleted. ` +
588
603
  "This action cannot be undone. Are you sure you want to proceed?", handleCancel: () => {
589
604
  setConfirmationModalOpen(false);
@@ -619,8 +634,8 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
619
634
  * Popper to show real-time progress of the Agent Network Designer output as we receive it from the backend.
620
635
  * Only displayed when Agent Network Designer is active.
621
636
  */
622
- const getProgressPopper = () => (_jsx(Box, { sx: {
623
- display: isStreaming && isNetworkDesignerMode ? "block" : "none",
637
+ const getProgressPopper = () => isStreaming &&
638
+ isNetworkDesignerMode && (_jsx(Box, { sx: {
624
639
  position: "absolute",
625
640
  top: 0,
626
641
  left: 0,
@@ -647,13 +662,41 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
647
662
  textAlign: "center",
648
663
  },
649
664
  }, 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",
665
+ const getNeuroSanStudioCallout = () => (_jsx(Snackbar, { anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: neuroSanCalloutOpen, slotProps: {
666
+ clickAwayListener: {
667
+ onClickAway: (event) => {
668
+ ;
669
+ event.defaultMuiPrevented =
670
+ true;
671
+ },
672
+ },
673
+ transition: {
674
+ timeout: {
675
+ enter: 500,
676
+ exit: 250,
677
+ },
678
+ },
679
+ }, slots: { transition: Slide }, sx: { mb: 2 }, children: _jsxs(Box, { sx: {
680
+ position: "relative",
681
+ maxWidth: 340,
682
+ }, children: [_jsx(IconButton, { "aria-label": "Close Neuro SAN Studio callout", onClick: (event) => {
683
+ event.preventDefault();
684
+ event.stopPropagation();
685
+ setNeuroSanCalloutOpen(false);
686
+ markAnnouncementShown(AnnouncementId.NeuroSanStudioGithubStar);
687
+ }, role: "button", size: "small", sx: {
688
+ bgcolor: "background.paper",
689
+ position: "absolute",
690
+ right: 4,
691
+ top: 20,
692
+ "&:hover": {
693
+ bgcolor: "action.hover",
694
+ },
695
+ }, children: _jsx(Close, { fontSize: "small" }) }), _jsx(NeuroSanStudioCallout, {})] }) }));
696
+ return (_jsxs(_Fragment, { children: [getNeuroSanStudioCallout(), getMissingApiKeysAlert(), Tour, getTourModal(), getProgressPopper(), getDeleteNetworkConfirmationModal(), _jsxs(Box, { id: "multi-agent-accelerator-container", sx: {
657
697
  position: "relative",
658
- }, children: [getLeftPanel(), getCenterPanel(), getRightPanel(), getStopButton()] })] }));
698
+ width: "100%",
699
+ height: "100%",
700
+ minHeight: 0,
701
+ }, children: [_jsxs(Group, { children: [getLeftPanel(), _jsx(PanelSeparator, {}), getCenterPanel(), _jsx(PanelSeparator, {}), getRightPanel()] }), getStopButton()] })] }));
659
702
  };
@@ -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: () => {