@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
@@ -99,6 +99,11 @@ export interface ChatCommonProps {
99
99
  * If true, indicates that the user is missing API keys for one or more LLM providers.
100
100
  */
101
101
  readonly hasMissingApiKeys?: boolean;
102
+ /**
103
+ * The sly_data_schema the selected network's front man advertises, if any. Enables schema hints in the
104
+ * sly_data dialog.
105
+ */
106
+ readonly slyDataSchema?: Record<string, unknown>;
102
107
  }
103
108
  export type ChatCommonHandle = {
104
109
  handleStop: () => void;
@@ -21,6 +21,7 @@ import { AIMessage, HumanMessage } from "@langchain/core/messages";
21
21
  import AddBoxRounded from "@mui/icons-material/AddBoxRounded";
22
22
  import ClearIcon from "@mui/icons-material/Clear";
23
23
  import CloseIcon from "@mui/icons-material/Close";
24
+ import DataObjectIcon from "@mui/icons-material/DataObject";
24
25
  import TuneIcon from "@mui/icons-material/Tune";
25
26
  import Box from "@mui/material/Box";
26
27
  import Checkbox from "@mui/material/Checkbox";
@@ -38,12 +39,13 @@ import { isEmpty } from "lodash-es";
38
39
  import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
39
40
  import { v4 as uuid } from "uuid";
40
41
  import { ChatHistory, toTurns } from "./ChatHistory.js";
41
- import { MAX_TURNS } from "./Const.js";
42
+ import { MAX_TURNS, SLY_DATA_LOGIN_KEY } from "./Const.js";
42
43
  import { ControlButtons } from "./ControlButtons.js";
43
44
  import { Conversation } from "./Conversation.js";
44
45
  import { MessageRole } from "./ConversationTurn.js";
45
46
  import { SampleQueries } from "./SampleQueries.js";
46
47
  import { SendButton } from "./SendButton.js";
48
+ import { SlyDataDialog } from "./SlyDataDialog.js";
47
49
  import { Thinking } from "./Thinking.js";
48
50
  import { sendChatQuery } from "../../../controller/agent/Agent.js";
49
51
  import { sendLlmRequest, StreamingUnit } from "../../../controller/llm/LlmChat.js";
@@ -95,7 +97,7 @@ export const roleToExportLabel = (role) => EXPORT_ROLE_LABELS[role];
95
97
  * agent responses. Customization for inputs and outputs is provided via event handlers-like props.
96
98
  */
97
99
  export const ChatCommon = ({ ref, ...props }) => {
98
- const { agentPlaceholders = EMPTY, backgroundColor, currentUser, customAgentGreetings = EMPTY, extraParams, extraSlyData, id, isAwaitingLlm, legacyAgentEndpoint, hasMissingApiKeys = false, networkDescription, neuroSanURL, onChunkReceived, onClose, onSend, onStreamingComplete, onStreamingStarted, sampleQueries, selectedNetwork, setIsAwaitingLlm, setPreviousResponse, setSelectedNetwork, title, } = props;
100
+ const { agentPlaceholders = EMPTY, backgroundColor, currentUser, customAgentGreetings = EMPTY, extraParams, extraSlyData, id, isAwaitingLlm, legacyAgentEndpoint, hasMissingApiKeys = false, networkDescription, neuroSanURL, onChunkReceived, onClose, onSend, onStreamingComplete, onStreamingStarted, sampleQueries, selectedNetwork, setIsAwaitingLlm, setPreviousResponse, setSelectedNetwork, slyDataSchema, title, } = props;
99
101
  // MUI theme
100
102
  const theme = useTheme();
101
103
  // User LLM chat input
@@ -120,6 +122,8 @@ export const ChatCommon = ({ ref, ...props }) => {
120
122
  // Options menu control
121
123
  const [optionsMenuAnchorEl, setOptionsMenuAnchorEl] = useState(null);
122
124
  const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
125
+ // Whether the sly_data editor is showing
126
+ const [slyDataDialogOpen, setSlyDataDialogOpen] = useState(false);
123
127
  // Persistent agent chat history store, which is where we store both kinds of chat histories
124
128
  // (see store implementation for details)
125
129
  const storedChatHistory = useAgentChatHistoryStore((state) => selectedNetwork ? state?.history?.[selectedNetwork] : undefined);
@@ -223,9 +227,12 @@ export const ChatCommon = ({ ref, ...props }) => {
223
227
  // But don't want to spam output by logging errors for every bad message.
224
228
  return;
225
229
  }
226
- // Shallow merge existing slyData with incoming chatMessage.sly_data
230
+ // Shallow merge existing slyData with incoming chatMessage.sly_data.
231
+ // Defense in depth: never let BYOK API keys enter the persistent store, even if a network echoes
232
+ // them back -- the store is displayed and exportable via the sly_data editor.
227
233
  if (chatMessage.sly_data) {
228
- updateSlyData(selectedNetwork, chatMessage.sly_data);
234
+ const { llm_config: _, ...echoedSlyData } = chatMessage.sly_data;
235
+ updateSlyData(selectedNetwork, echoedSlyData);
229
236
  }
230
237
  // It's a ChatMessage. Does it have chat context? Only AGENT_FRAMEWORK messages can have chat context.
231
238
  if (chatMessage.type === ChatMessageType.AGENT_FRAMEWORK && chatMessage.chat_context) {
@@ -311,7 +318,11 @@ export const ChatCommon = ({ ref, ...props }) => {
311
318
  else {
312
319
  // It's a Neuro-san agent.
313
320
  // Some coded tools (data generator...) expect the username provided in slyData.
314
- const slyDataWithUsername = { ...agentChatHistory?.slyData, ...extraSlyData, login: currentUser };
321
+ const slyDataWithUsername = {
322
+ ...agentChatHistory?.slyData,
323
+ ...extraSlyData,
324
+ [SLY_DATA_LOGIN_KEY]: currentUser,
325
+ };
315
326
  await sendChatQuery(neuroSanURL, controller?.current.signal, query, selectedNetwork, handleChunk, agentChatHistory.chatContext, slyDataWithUsername, currentUser, StreamingUnit.Line);
316
327
  }
317
328
  }
@@ -605,6 +616,16 @@ export const ChatCommon = ({ ref, ...props }) => {
605
616
  const handleToggleWrapOutput = () => {
606
617
  setShouldWrapOutput((prev) => !prev);
607
618
  };
619
+ const handleShowSlyData = () => {
620
+ handleOptionsMenuClose();
621
+ setSlyDataDialogOpen(true);
622
+ };
623
+ /**
624
+ * The sly_data keys that this component merges in on every request, on top of whatever is in the store. The
625
+ * sly_data editor lists them so that the user isn't surprised by keys arriving at the server that they never
626
+ * typed -- and, for the API keys among them, so that we never have to display their values.
627
+ */
628
+ const getMergedSlyDataKeys = () => [...Object.keys(extraSlyData ?? {}), SLY_DATA_LOGIN_KEY];
608
629
  const getOptionsMenu = () => (_jsxs(Menu, { id: `${id}-options-menu`, anchorEl: optionsMenuAnchorEl, open: optionsMenuOpen, onClose: handleOptionsMenuClose, slotProps: {
609
630
  list: {
610
631
  dense: true,
@@ -615,7 +636,7 @@ export const ChatCommon = ({ ref, ...props }) => {
615
636
  "& .MuiListItemText-primary": { fontSize: "smaller" },
616
637
  },
617
638
  },
618
- }, children: [_jsxs(MenuItem, { onClick: handleToggleAutoScroll, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: autoScrollEnabled, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Auto-scroll output" })] }), _jsxs(MenuItem, { onClick: handleToggleWrapOutput, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: shouldWrapOutput, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Wrap output" })] })] }));
639
+ }, children: [_jsxs(MenuItem, { onClick: handleToggleAutoScroll, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: autoScrollEnabled, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Auto-scroll output" })] }), _jsxs(MenuItem, { onClick: handleToggleWrapOutput, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: shouldWrapOutput, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Wrap output" })] }), !isLegacyAgentType(selectedNetwork) && (_jsxs(MenuItem, { id: `${id}-sly-data-menu-item`, onClick: handleShowSlyData, children: [_jsx(ListItemIcon, { children: _jsx(DataObjectIcon, { fontSize: "small" }) }), _jsx(ListItemText, { primary: "Sly data..." })] }))] }));
619
640
  const getNetworkIntro = () => (_jsxs(Box, { sx: { marginBottom: "0.5rem", marginTop: "1rem" }, children: [_jsxs(Typography, { component: "span", sx: { fontWeight: 700 }, variant: "inherit", children: [networkDisplayName, networkDescription && ":"] }), networkDescription && (_jsxs(Typography, { component: "span", sx: { ml: 0.5 }, variant: "inherit", children: [" ", networkDescription] }))] }));
620
641
  const getChatHistory = () => (_jsx(_Fragment, { children: agentChatHistory?.chatHistory?.length > 0 && (_jsx(Box, { sx: { my: "0.5rem" }, children: _jsx(ChatHistory, { id: id, messages: agentChatHistory.chatHistory }) })) }));
621
642
  const getAgentGreeting = () => _jsx(Box, { sx: { marginBottom: "0.5rem", marginTop: "1rem" }, children: agentGreeting });
@@ -649,7 +670,7 @@ export const ChatCommon = ({ ref, ...props }) => {
649
670
  resetHistory(selectedNetwork);
650
671
  setPreviousUserQuery("");
651
672
  currentResponse.current = "";
652
- }, okBtnLabel: "Yes, clear chat", title: `Clear all chat including history for ${networkDisplayName}?` })) : null, _jsxs(Box, { id: "llm-responses", ref: chatOutputRef, sx: {
673
+ }, okBtnLabel: "Yes, clear chat", title: `Clear all chat including history for ${networkDisplayName}?` })) : null, slyDataDialogOpen ? (_jsx(SlyDataDialog, { extraSlyDataKeys: getMergedSlyDataKeys(), id: `${id}-sly-data-dialog`, isOpen: slyDataDialogOpen, networkDisplayName: networkDisplayName, networkId: selectedNetwork, onClose: () => setSlyDataDialogOpen(false), slyDataSchema: slyDataSchema })) : null, _jsxs(Box, { id: "llm-responses", ref: chatOutputRef, sx: {
653
674
  backgroundColor,
654
675
  borderRadius: "0.5rem",
655
676
  fontSize: "16px",
@@ -1 +1,2 @@
1
1
  export declare const MAX_TURNS = 50;
2
+ export declare const SLY_DATA_LOGIN_KEY = "login";
@@ -1,2 +1,4 @@
1
1
  // Maximum number of turns to save
2
2
  export const MAX_TURNS = 50;
3
+ // The sly_data key under which we supply the current username. Some coded tools (data generator...) expect it.
4
+ export const SLY_DATA_LOGIN_KEY = "login";
@@ -0,0 +1,34 @@
1
+ import { FC } from "react";
2
+ export interface SlyDataDialogProps {
3
+ /**
4
+ * Names of the sly_data keys that the UI itself merges into each request (API keys, agent network definition,
5
+ * login...). Shown to the user as names only -- never values, since some of them are secrets.
6
+ */
7
+ readonly extraSlyDataKeys?: readonly string[];
8
+ /** HTML id to use for the outer component */
9
+ readonly id: string;
10
+ readonly isOpen: boolean;
11
+ /** The network whose sly_data is being edited. Sly data is stored per network. */
12
+ readonly networkId: string;
13
+ /** Human-readable name of the network, for display only */
14
+ readonly networkDisplayName: string;
15
+ readonly onClose: () => void;
16
+ /**
17
+ * The sly_data_schema the network's front man advertises, if any. When present and usable, the dialog lists
18
+ * the expected keys and offers to seed them as a template.
19
+ */
20
+ readonly slyDataSchema?: Record<string, unknown>;
21
+ }
22
+ /**
23
+ * Dialog for viewing and editing the sly_data of the selected agent network.
24
+ * <br>
25
+ * sly_data is the side-channel payload that rides along with every request: the server echoes it back as the
26
+ * conversation progresses, and the UI bounces it to the server on the next request. Until now it was invisible.
27
+ * This dialog exposes it as editable JSON, so a user can inspect what the agents are passing around and seed values
28
+ * of their own before the first turn.
29
+ * <br>
30
+ * Edits are written straight into the per-network chat history store, which is the same place the streaming code
31
+ * writes server-echoed sly_data and the same place the send path reads from. There is therefore no separate plumbing
32
+ * to the server: whatever is saved here goes out with the next request.
33
+ */
34
+ export declare const SlyDataDialog: FC<SlyDataDialogProps>;
@@ -0,0 +1,187 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ Copyright 2025 Cognizant Technology Solutions Corp, www.cognizant.com.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ */
17
+ import DataObjectIcon from "@mui/icons-material/DataObject";
18
+ import DeleteOutlined from "@mui/icons-material/DeleteOutlined";
19
+ import FileDownloadOutlined from "@mui/icons-material/FileDownloadOutlined";
20
+ import FileUploadOutlined from "@mui/icons-material/FileUploadOutlined";
21
+ import PlaylistAddOutlined from "@mui/icons-material/PlaylistAddOutlined";
22
+ import Alert from "@mui/material/Alert";
23
+ import Box from "@mui/material/Box";
24
+ import IconButton from "@mui/material/IconButton";
25
+ import { styled } from "@mui/material/styles";
26
+ import TextField from "@mui/material/TextField";
27
+ import Tooltip from "@mui/material/Tooltip";
28
+ import Typography from "@mui/material/Typography";
29
+ import { Fragment, useMemo, useRef, useState } from "react";
30
+ import { useAgentChatHistoryStore } from "../../../state/ChatHistory.js";
31
+ import { downloadFile, toSafeFilename } from "../../../utils/File.js";
32
+ import { findImageValues, formatSlyData, parseSlyData } from "../../../utils/SlyData.js";
33
+ import { buildSlyDataTemplate, describeSlyDataSchema } from "../../../utils/SlyDataSchema.js";
34
+ import { StyledButton } from "../../Common/ConfirmationModal.js";
35
+ import { MUIDialog } from "../../Common/MUIDialog.js";
36
+ import InfoTip from "../../Settings/InfoTip.js";
37
+ //#endregion: Types
38
+ //#region: Constants
39
+ // Avoids a new array literal as a default prop value on every render
40
+ const NO_EXTRA_KEYS = [];
41
+ // Height of the JSON editor, in rows. Big enough to see a realistic payload without dominating the screen.
42
+ const EDITOR_ROWS = 14;
43
+ // Edge length of the image previews, in pixels
44
+ const IMAGE_PREVIEW_SIZE = 96;
45
+ // Tooltip explaining what sly data is, in end-user terms: it exists to carry values (credentials included) that
46
+ // belong with the request but must stay out of the LLM conversation.
47
+ const SLY_DATA_EXPLAINER = "Data is sent to the agent network in a private channel with each request but kept out of the LLM.";
48
+ //#endregion: Constants
49
+ // A sly_data key name rendered as an inline code chip
50
+ const KeyChip = styled("code")(({ theme }) => ({
51
+ backgroundColor: theme.palette.action.hover,
52
+ borderRadius: `calc(${theme.shape.borderRadius}px * 0.5)`,
53
+ fontFamily: "monospace",
54
+ paddingLeft: theme.spacing(0.5),
55
+ paddingRight: theme.spacing(0.5),
56
+ }));
57
+ /**
58
+ * Renders the parenthetical qualifiers after a schema key name, eg. " (float, required)".
59
+ * Empty when the schema declares neither a type nor requiredness.
60
+ * @param entry The schema entry to describe.
61
+ * @returns The qualifier text, with a leading space, or an empty string.
62
+ */
63
+ const describeEntryQualifiers = (entry) => {
64
+ const qualifiers = [entry.type, entry.isRequired ? "required" : undefined].filter(Boolean);
65
+ return qualifiers.length > 0 ? ` (${qualifiers.join(", ")})` : "";
66
+ };
67
+ /**
68
+ * Dialog for viewing and editing the sly_data of the selected agent network.
69
+ * <br>
70
+ * sly_data is the side-channel payload that rides along with every request: the server echoes it back as the
71
+ * conversation progresses, and the UI bounces it to the server on the next request. Until now it was invisible.
72
+ * This dialog exposes it as editable JSON, so a user can inspect what the agents are passing around and seed values
73
+ * of their own before the first turn.
74
+ * <br>
75
+ * Edits are written straight into the per-network chat history store, which is the same place the streaming code
76
+ * writes server-echoed sly_data and the same place the send path reads from. There is therefore no separate plumbing
77
+ * to the server: whatever is saved here goes out with the next request.
78
+ */
79
+ export const SlyDataDialog = ({ extraSlyDataKeys = NO_EXTRA_KEYS, id, isOpen, networkId, networkDisplayName, onClose, slyDataSchema, }) => {
80
+ const storedSlyData = useAgentChatHistoryStore((state) => networkId ? state.history[networkId]?.slyData : undefined);
81
+ const setSlyData = useAgentChatHistoryStore((state) => state.setSlyData);
82
+ const storedText = useMemo(() => formatSlyData(storedSlyData), [storedSlyData]);
83
+ // The keys the network says it expects, minus the ones the app supplies on its own. Empty for the many
84
+ // networks that do not advertise a schema, in which case the dialog looks exactly as it always has.
85
+ const schemaEntries = useMemo(() => describeSlyDataSchema(slyDataSchema, extraSlyDataKeys), [slyDataSchema, extraSlyDataKeys]);
86
+ // The network's sly_data skeleton, pretty-printed, or null when it advertises no usable schema
87
+ const templateText = useMemo(() => schemaEntries.length > 0 ? formatSlyData(buildSlyDataTemplate(slyDataSchema, {}, extraSlyDataKeys)) : null, [schemaEntries, slyDataSchema, extraSlyDataKeys]);
88
+ // When the dialog opens onto an empty store and the network declares a schema, start from the template so
89
+ // the user fills in blanks instead of typing structure. It is an ordinary unsaved draft: nothing touches
90
+ // the store unless they save. The dialog is mounted fresh on every open, so this is per-open behavior.
91
+ const prefillText = storedText === "{}" ? templateText : null;
92
+ // The user's unsaved edit, or null while they have none. While null, the editor simply renders the store,
93
+ // so server-echoed updates show up without any syncing code. Once the user edits, their draft is what
94
+ // renders, and we offer a reload instead of overwriting it (see below).
95
+ const [draft, setDraft] = useState(prefillText);
96
+ // What the store held when the user started editing, so we can tell "the server changed sly_data" apart
97
+ // from "the user changed sly_data"
98
+ const [draftBaseline, setDraftBaseline] = useState(prefillText === null ? null : storedText);
99
+ const fileInputRef = useRef(null);
100
+ // Derived rather than stored: dirtiness is simply "a draft exists"
101
+ const isDirty = draft !== null;
102
+ const text = draft ?? storedText;
103
+ const parseResult = useMemo(() => parseSlyData(text), [text]);
104
+ const images = useMemo(() => findImageValues(parseResult.value), [parseResult]);
105
+ // The server echoed new sly_data while the user had unsaved edits. Saying so beats silently discarding
106
+ // either side's version.
107
+ const wasUpdatedByServer = isDirty && storedText !== draftBaseline;
108
+ /** Records a user edit, snapshotting what the store held when editing began. */
109
+ const startOrUpdateDraft = (newText) => {
110
+ if (draft === null) {
111
+ setDraftBaseline(storedText);
112
+ }
113
+ setDraft(newText);
114
+ };
115
+ const handleTextChange = (event) => {
116
+ startOrUpdateDraft(event.target.value);
117
+ };
118
+ const handleReload = () => {
119
+ setDraft(null);
120
+ setDraftBaseline(null);
121
+ };
122
+ // On a network with a schema, "clear" means back to the blank template rather than to nothing:
123
+ // stranding the user on {} would force them to rebuild the structure the network just told us about.
124
+ const handleClear = () => {
125
+ startOrUpdateDraft(templateText ?? "{}");
126
+ };
127
+ const handleFillTemplate = () => {
128
+ startOrUpdateDraft(formatSlyData(buildSlyDataTemplate(slyDataSchema, parseResult.value, extraSlyDataKeys)));
129
+ };
130
+ const handleExport = () => {
131
+ if (parseResult.error) {
132
+ return;
133
+ }
134
+ const filename = `${toSafeFilename(`${networkId}-sly-data`)}.json`;
135
+ downloadFile(formatSlyData(parseResult.value), filename, "application/json");
136
+ };
137
+ const handleFileSelected = async (event) => {
138
+ const file = event.target.files?.[0];
139
+ // Reset the input so that picking the same file again still fires a change event
140
+ event.target.value = "";
141
+ if (!file) {
142
+ return;
143
+ }
144
+ // Whatever the file contains goes into the editor as-is. If it isn't usable sly_data, the same validation
145
+ // that guards typing will explain why.
146
+ startOrUpdateDraft(await file.text());
147
+ };
148
+ const handleSave = () => {
149
+ if (parseResult.error) {
150
+ return;
151
+ }
152
+ setSlyData(networkId, parseResult.value);
153
+ onClose();
154
+ };
155
+ const getTitle = () => (_jsxs(Box, { sx: { alignItems: "center", display: "flex", gap: 0.75 }, children: [_jsx(DataObjectIcon, { fontSize: "small", id: `${id}-title-icon` }), _jsxs("span", { children: ["Sly data for ", networkDisplayName] }), _jsx(InfoTip, { title: SLY_DATA_EXPLAINER })] }));
156
+ const getToolbar = () => (_jsxs(Box, { sx: { display: "flex", gap: 0.5, justifyContent: "flex-end" }, children: [schemaEntries.length > 0 && (_jsx(Tooltip, { title: "Insert the keys this network expects (keeps your values)", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Fill sly data template", disabled: Boolean(parseResult.error), id: `${id}-template-button`, onClick: handleFillTemplate, size: "small", children: _jsx(PlaylistAddOutlined, { fontSize: "small" }) }) }) })), _jsx(Tooltip, { title: "Import from a JSON file", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Import sly data", id: `${id}-import-button`, onClick: () => fileInputRef.current?.click(), size: "small", children: _jsx(FileUploadOutlined, { fontSize: "small" }) }) }) }), _jsx(Tooltip, { title: "Export to a JSON file", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Export sly data", disabled: Boolean(parseResult.error), id: `${id}-export-button`, onClick: handleExport, size: "small", children: _jsx(FileDownloadOutlined, { fontSize: "small" }) }) }) }), _jsx(Tooltip, { title: templateText === null
157
+ ? "Clear all sly data (takes effect when you save)"
158
+ : "Reset to the network's expected keys (takes effect when you save)", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Clear sly data", id: `${id}-clear-button`, onClick: handleClear, size: "small", sx: { "&:hover": { color: "error.main" } }, children: _jsx(DeleteOutlined, { fontSize: "small" }) }) }) }), _jsx("input", { accept: "application/json, .json", "aria-label": "Sly data file", "data-testid": `${id}-file-input`, id: `${id}-file-input`, onChange: handleFileSelected, ref: fileInputRef, style: { display: "none" }, type: "file" })] }));
159
+ /**
160
+ * Lists the keys the network says it expects, so the user knows what to fill in without reading the
161
+ * network's source. Renders nothing when the network advertises no usable schema.
162
+ */
163
+ const getSchemaHints = () => schemaEntries.length > 0 && (_jsxs(Box, { "data-testid": `${id}-schema-hints`, id: `${id}-schema-hints`, sx: { mb: 0.5 }, children: [_jsx(Typography, { sx: { fontSize: "0.75rem" }, variant: "caption", children: "This network expects:" }), _jsx(Box, { component: "ul", sx: { listStyle: "none", m: 0, pl: 1.5 }, children: schemaEntries.map((entry) => (_jsxs(Typography, { component: "li", sx: { display: "block", fontSize: "0.75rem" }, variant: "caption", children: [_jsx(KeyChip, { children: entry.key }), describeEntryQualifiers(entry), entry.description ? `: ${entry.description}` : ""] }, entry.key))) })] }));
164
+ const getServerUpdateAlert = () => wasUpdatedByServer && (_jsx(Alert, { action: _jsx(StyledButton, { id: `${id}-reload-button`, onClick: handleReload, variant: "outlined", children: "Reload" }), id: `${id}-server-update-alert`, severity: "info", sx: { my: 1 }, children: "The agents updated sly data while you were editing. Reloading discards your changes." }));
165
+ /**
166
+ * Preview strip for any values that look like images. Read-only: the underlying value stays editable as text.
167
+ * Agent networks do not have a settled convention for passing images over sly_data yet, so this displays what
168
+ * it can recognize rather than assuming a shape.
169
+ */
170
+ const getImagePreviews = () => images.length > 0 && (_jsxs(Box, { id: `${id}-images`, children: [_jsx(Typography, { sx: { fontSize: "0.75rem", mt: 1 }, variant: "caption", children: "Images in sly data" }), _jsx(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mt: 0.5 }, children: images.map((image) => (_jsxs(Box, { sx: { maxWidth: IMAGE_PREVIEW_SIZE, textAlign: "center" }, children: [_jsx("img", { alt: image.path, loading: "lazy", referrerPolicy: "no-referrer", src: image.src, style: {
171
+ height: IMAGE_PREVIEW_SIZE,
172
+ objectFit: "contain",
173
+ width: IMAGE_PREVIEW_SIZE,
174
+ } }), _jsx(Typography, { sx: { display: "block", fontSize: "0.7rem", overflowWrap: "anywhere" }, variant: "caption", children: image.path })] }, image.path))) })] }));
175
+ /**
176
+ * Explains the keys that this dialog deliberately does not show, so that their absence doesn't look like a bug.
177
+ */
178
+ const getMergedKeysNote = () => extraSlyDataKeys.length > 0 && (_jsxs(Alert, { id: `${id}-merged-keys`, severity: "info", sx: { mt: 0.5, py: 0, "& .MuiAlert-message": { fontSize: "0.75rem" } }, children: ["Sent automatically with every request:", " ", [...extraSlyDataKeys].sort().map((key, index) => (_jsxs(Fragment, { children: [index > 0 && ", ", _jsx(KeyChip, { children: key })] }, key))), ". Supplied by the app, not from this editor."] }));
179
+ const getFooter = () => (_jsxs(_Fragment, { children: [_jsx(StyledButton, { id: `${id}-cancel-button`, onClick: onClose, variant: "outlined", children: "Cancel" }), _jsx(StyledButton, { disabled: Boolean(parseResult.error), id: `${id}-save-button`, onClick: handleSave, variant: "contained", children: "Save" })] }));
180
+ return (_jsxs(MUIDialog, { contentSx: { minWidth: "550px", paddingTop: "0" }, footer: getFooter(), id: id, isOpen: isOpen, onClose: onClose, paperProps: { maxWidth: "800px", width: "80vw" }, title: getTitle(), children: [getToolbar(), getSchemaHints(), getServerUpdateAlert(), _jsx(TextField, { error: Boolean(parseResult.error), fullWidth: true, helperText: parseResult.error ?? " ", id: `${id}-editor`, maxRows: EDITOR_ROWS, minRows: EDITOR_ROWS, multiline: true, onChange: handleTextChange, slotProps: {
181
+ htmlInput: {
182
+ "aria-label": "Sly data",
183
+ spellCheck: false,
184
+ style: { fontFamily: "monospace", fontSize: "0.8rem" },
185
+ },
186
+ }, value: text }), getImagePreviews(), getMergedKeysNote()] }));
187
+ };
@@ -1,6 +1,4 @@
1
- type LLMChatGroupConfigBtnProps = {
2
- disabled?: boolean;
3
- };
4
- export declare const LlmChatButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, keyof import("@mui/material/Button").ButtonOwnProps> & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, "tabIndex" | "type" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | keyof import("@mui/material/Button").ButtonOwnProps> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style" | "children" | "sx" | "className" | "tabIndex" | "color" | "href" | "type" | "classes" | "variant" | "action" | "size" | "disabled" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "loading" | "loadingIndicator" | "disableElevation" | "endIcon" | "fullWidth" | "loadingPosition" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & LLMChatGroupConfigBtnProps, {}, {}>;
5
- export declare const SmallLlmChatButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, keyof import("@mui/material/Button").ButtonOwnProps> & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, "tabIndex" | "type" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | keyof import("@mui/material/Button").ButtonOwnProps> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style" | "children" | "sx" | "className" | "tabIndex" | "color" | "href" | "type" | "classes" | "variant" | "action" | "size" | "disabled" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "loading" | "loadingIndicator" | "disableElevation" | "endIcon" | "fullWidth" | "loadingPosition" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & LLMChatGroupConfigBtnProps, {}, {}>;
6
- export {};
1
+ import { ButtonProps } from "@mui/material/Button";
2
+ import { ComponentType } from "react";
3
+ export declare const LlmChatButton: ComponentType<ButtonProps>;
4
+ export declare const SmallLlmChatButton: ComponentType<ButtonProps>;
@@ -15,8 +15,6 @@ limitations under the License.
15
15
  */
16
16
  import Button from "@mui/material/Button";
17
17
  import { styled } from "@mui/material/styles";
18
- //#endregion: Types
19
- // In LlmChatButton.tsx
20
18
  export const LlmChatButton = styled(Button)(({ disabled, theme }) => ({
21
19
  backgroundColor: theme.palette.background.paper,
22
20
  borderRadius: "var(--bs-border-radius)",
@@ -1,5 +1,6 @@
1
- import { FC, ReactNode } from "react";
2
- export declare const StyledButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, keyof import("@mui/material/Button").ButtonOwnProps> & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, "tabIndex" | "type" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | keyof import("@mui/material/Button").ButtonOwnProps> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style" | "children" | "sx" | "className" | "tabIndex" | "color" | "href" | "type" | "classes" | "variant" | "action" | "size" | "disabled" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "loading" | "loadingIndicator" | "disableElevation" | "endIcon" | "fullWidth" | "loadingPosition" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
1
+ import { ButtonProps } from "@mui/material/Button";
2
+ import { ComponentType, FC, ReactNode } from "react";
3
+ export declare const StyledButton: ComponentType<ButtonProps>;
3
4
  interface ConfirmationModalProps {
4
5
  cancelBtnLabel?: string;
5
6
  closeable?: boolean;
@@ -0,0 +1,16 @@
1
+ import { FC } from "react";
2
+ export declare const GOOGLE_ANALYTICS_URL = "https://www.googletagmanager.com/gtag/js";
3
+ declare global {
4
+ interface Window {
5
+ dataLayer: unknown[];
6
+ gtag: (...args: unknown[]) => void;
7
+ }
8
+ }
9
+ interface GoogleAnalyticsProps {
10
+ readonly gaMeasurementID: string;
11
+ }
12
+ /**
13
+ * This component injects the Google Analytics tracking script
14
+ */
15
+ export declare const GoogleAnalytics: FC<GoogleAnalyticsProps>;
16
+ export {};
@@ -0,0 +1,32 @@
1
+ import { useEffect } from "react";
2
+ // The URL for the Google Analytics script
3
+ export const GOOGLE_ANALYTICS_URL = "https://www.googletagmanager.com/gtag/js";
4
+ /**
5
+ * This component injects the Google Analytics tracking script
6
+ */
7
+ export const GoogleAnalytics = ({ gaMeasurementID }) => {
8
+ /*
9
+ Effect to inject the Google Analytics script into the document head.
10
+ This has to be an Effect because React intentionally does not run inline <script> elements that it creates
11
+ in the browser. By making this an Effect, we can create a <script> element and append it to the document head,
12
+ which will cause the browser to execute it.
13
+ */
14
+ useEffect(() => {
15
+ const script = document.createElement("script");
16
+ script.async = true;
17
+ script.src = `${GOOGLE_ANALYTICS_URL}?id=${gaMeasurementID}`;
18
+ document.head.append(script);
19
+ window.dataLayer = window.dataLayer || [];
20
+ window.gtag = function () {
21
+ // gtag must push the `arguments` object itself, not an array, for GA to process it
22
+ // eslint-disable-next-line prefer-rest-params
23
+ window.dataLayer.push(arguments);
24
+ };
25
+ window.gtag("js", new Date());
26
+ window.gtag("config", gaMeasurementID);
27
+ return () => {
28
+ script.remove();
29
+ };
30
+ }, [gaMeasurementID]);
31
+ return null;
32
+ };
@@ -8,6 +8,7 @@ export interface NavbarProps {
8
8
  name: string;
9
9
  image: string;
10
10
  };
11
+ readonly enableAuthentication: boolean;
11
12
  readonly authenticationType: string;
12
13
  readonly signOut: () => void;
13
14
  readonly supportEmailAddress: string;
@@ -15,4 +16,4 @@ export interface NavbarProps {
15
16
  readonly showSettingsButton?: boolean;
16
17
  readonly onStartTour?: () => void;
17
18
  }
18
- export declare const Navbar: ({ authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton, signOut, supportEmailAddress, userInfo, }: NavbarProps) => ReactJSX.Element;
19
+ export declare const Navbar: ({ enableAuthentication, authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton, signOut, supportEmailAddress, userInfo, }: NavbarProps) => ReactJSX.Element;
@@ -31,7 +31,7 @@ import Tooltip from "@mui/material/Tooltip";
31
31
  import Typography from "@mui/material/Typography";
32
32
  import { useState } from "react";
33
33
  import { ConfirmationModal } from "./ConfirmationModal.js";
34
- import { authenticationEnabled, DEFAULT_USER_IMAGE, getContactUsConfirmationText, NEURO_SAN_UI_VERSION, } from "../../const.js";
34
+ import { DEFAULT_USER_IMAGE, getContactUsConfirmationText, NEURO_SAN_UI_VERSION } from "../../const.js";
35
35
  import { useSettingsStore } from "../../state/Settings.js";
36
36
  import { isDarkMode } from "../../Theme/Theme.js";
37
37
  import { navigateToUrl } from "../../utils/BrowserNavigation.js";
@@ -53,7 +53,7 @@ const DISABLE_OUTLINE_PROPS = {
53
53
  outline: "none",
54
54
  },
55
55
  };
56
- export const Navbar = ({ authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton = true, signOut, supportEmailAddress, userInfo, }) => {
56
+ export const Navbar = ({ enableAuthentication, authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton = true, signOut, supportEmailAddress, userInfo, }) => {
57
57
  // For email dialog
58
58
  const [emailDialogOpen, setEmailDialogOpen] = useState(false);
59
59
  // Dark mode
@@ -149,7 +149,7 @@ export const Navbar = ({ authenticationType, id, logo, logoServiceToken, onStart
149
149
  whiteSpace: "normal",
150
150
  wordWrap: "break-word",
151
151
  fontSize: "smaller",
152
- }, children: userInfo.name }), _jsx(MenuItem, { id: "auth-type-title", disabled: true, sx: { fontWeight: "bold" }, children: "Authentication" }), _jsx(MenuItem, { id: "authentication-type-menu-item", disabled: true, sx: { fontSize: "smaller" }, children: authenticationType }), authenticationEnabled() && (_jsx(MenuItem, { id: "user-sign-out", sx: { ...DISABLE_OUTLINE_PROPS, fontWeight: "bold" }, onClick: signOut, children: "Sign out" }))] })] })) : null, _jsx(Tooltip, { id: "dark-mode-toggle", title: hasCustomer
152
+ }, children: userInfo.name }), _jsx(MenuItem, { id: "auth-type-title", disabled: true, sx: { fontWeight: "bold" }, children: "Authentication" }), _jsx(MenuItem, { id: "authentication-type-menu-item", disabled: true, sx: { fontSize: "smaller" }, children: authenticationType }), enableAuthentication && (_jsx(MenuItem, { id: "user-sign-out", sx: { ...DISABLE_OUTLINE_PROPS, fontWeight: "bold" }, onClick: signOut, children: "Sign out" }))] })] })) : null, _jsx(Tooltip, { id: "dark-mode-toggle", title: hasCustomer
153
153
  ? "Dark mode toggle is not available when customer branding is active. Reset via Settings menu."
154
154
  : "Toggle dark mode", children: _jsx(DarkModeIcon, { id: "dark-mode-icon", sx: {
155
155
  marginRight: "1rem",
@@ -19,7 +19,7 @@ import { useRouter } from "next/router.js";
19
19
  import { LOGO } from "../../const.js";
20
20
  import { useEnvironmentStore } from "../../state/Environment.js";
21
21
  import { useUserInfoStore } from "../../state/UserInfo.js";
22
- import { smartSignOut, useAuthentication } from "../../utils/Authentication.js";
22
+ import { getAuthenticationType, smartSignOut, useAuthentication } from "../../utils/Authentication.js";
23
23
  import { NeuroAIBreadcrumbs } from "../Common/Breadcrumbs.js";
24
24
  import { Footer } from "../Common/Footer.js";
25
25
  import { Navbar } from "../Common/Navbar.js";
@@ -29,13 +29,13 @@ import { Navbar } from "../Common/Navbar.js";
29
29
  * @param errorText Error text to be displayed
30
30
  */
31
31
  const ErrorPage = ({ id, errorText }) => {
32
- const { auth0ClientId, auth0Domain, supportEmailAddress, logoServiceToken } = useEnvironmentStore();
32
+ const { auth0ClientId, auth0Domain, enableAuthentication, logoServiceToken, supportEmailAddress } = useEnvironmentStore();
33
33
  // Access Next.js router
34
34
  const router = useRouter();
35
35
  // Access user info store
36
36
  const { currentUser, setCurrentUser, setPicture, oidcProvider } = useUserInfoStore();
37
37
  // Infer authentication type
38
- const authenticationType = currentUser ? `ALB using ${oidcProvider}` : "NextAuth";
38
+ const authenticationType = getAuthenticationType(enableAuthentication, currentUser, oidcProvider);
39
39
  const { data: { user: userInfo } = {} } = useAuthentication();
40
40
  const handleSignOut = async () => {
41
41
  // Clear our state storage variables
@@ -43,6 +43,6 @@ const ErrorPage = ({ id, errorText }) => {
43
43
  setPicture(undefined);
44
44
  await smartSignOut(currentUser, auth0Domain, auth0ClientId, oidcProvider);
45
45
  };
46
- return (_jsxs(_Fragment, { children: [_jsx(Navbar, { authenticationType: authenticationType, id: "nav-bar", logo: LOGO, logoServiceToken: logoServiceToken, pathname: router.pathname, query: router.query, signOut: handleSignOut, supportEmailAddress: supportEmailAddress, userInfo: userInfo }), _jsxs(Box, { id: id, sx: { marginLeft: "1rem" }, children: [_jsx(NeuroAIBreadcrumbs, {}), _jsx("h4", { id: "error-header", style: { color: "var(--bs-red)", marginTop: "1rem" }, children: "Oops, an internal error occurred on our end." }), _jsxs("div", { id: "error-div-1", children: [_jsxs(Box, { id: "no-need-to-worry", sx: { marginBottom: "1.5rem" }, children: [_jsx("b", { id: "bold-1", children: "There's no need to worry \u2013 you didn't do anything wrong." }), " This is a bug in our server and we'll fix it as soon as possible."] }), _jsx(Box, { id: "try-these-steps", sx: { marginBottom: "1.5rem" }, children: "To attempt to recover from the error, try these steps:" }), _jsx(Box, { id: "refresh-page", sx: { marginBottom: "1.5rem" }, children: _jsxs("ul", { id: "error-boundary-advice-list", className: "list-decimal list-inside", children: [_jsx("li", { id: "error-advice-refresh", children: "Refresh the page to see if the error goes away." }), _jsx("li", { id: "error-advice-reload", children: "Close and re-open your browser, then navigate back to the page where you encountered the error." })] }) }), "If none of that helps, please report the following error to the LEAF team:"] }), _jsx("div", { id: "error-text-div", style: { fontFamily: "monospace", marginTop: "1.5rem", marginBottom: "1.5rem" }, children: errorText }), "More information may be available in the browser console. Please include such information in your report if possible."] }), _jsx(Footer, { supportEmailAddress: supportEmailAddress, logoLinkUrl: "https://www.cognizant.com/", logoUrl: "/cognizant-logo-white.svg" })] }));
46
+ return (_jsxs(_Fragment, { children: [_jsx(Navbar, { enableAuthentication: enableAuthentication, authenticationType: authenticationType, id: "nav-bar", logo: LOGO, logoServiceToken: logoServiceToken, pathname: router.pathname, query: router.query, signOut: handleSignOut, supportEmailAddress: supportEmailAddress, userInfo: userInfo }), _jsxs(Box, { id: id, sx: { marginLeft: "1rem" }, children: [_jsx(NeuroAIBreadcrumbs, {}), _jsx("h4", { id: "error-header", style: { color: "var(--bs-red)", marginTop: "1rem" }, children: "Oops, an internal error occurred on our end." }), _jsxs("div", { id: "error-div-1", children: [_jsxs(Box, { id: "no-need-to-worry", sx: { marginBottom: "1.5rem" }, children: [_jsx("b", { id: "bold-1", children: "There's no need to worry \u2013 you didn't do anything wrong." }), " This is a bug in our server and we'll fix it as soon as possible."] }), _jsx(Box, { id: "try-these-steps", sx: { marginBottom: "1.5rem" }, children: "To attempt to recover from the error, try these steps:" }), _jsx(Box, { id: "refresh-page", sx: { marginBottom: "1.5rem" }, children: _jsxs("ul", { id: "error-boundary-advice-list", className: "list-decimal list-inside", children: [_jsx("li", { id: "error-advice-refresh", children: "Refresh the page to see if the error goes away." }), _jsx("li", { id: "error-advice-reload", children: "Close and re-open your browser, then navigate back to the page where you encountered the error." })] }) }), "If none of that helps, please report the following error to the LEAF team:"] }), _jsx("div", { id: "error-text-div", style: { fontFamily: "monospace", marginTop: "1.5rem", marginBottom: "1.5rem" }, children: errorText }), "More information may be available in the browser console. Please include such information in your report if possible."] }), _jsx(Footer, { supportEmailAddress: supportEmailAddress, logoLinkUrl: "https://www.cognizant.com/", logoUrl: "/cognizant-logo-white.svg" })] }));
47
47
  };
48
48
  export default ErrorPage;
@@ -15,9 +15,9 @@ export interface AgentFlowProps {
15
15
  readonly id: string;
16
16
  readonly isAwaitingLlm?: boolean;
17
17
  readonly isAgentNetworkDesignerMode?: boolean;
18
- readonly isEditMode?: boolean;
18
+ readonly isEditingNetwork?: boolean;
19
19
  readonly isStreaming?: boolean;
20
- readonly isSelectedNetworkTemporary?: boolean;
20
+ readonly isTemporaryNetwork?: boolean;
21
21
  /** The history key for the currently selected network (used to scope sly_data reads/writes per network). */
22
22
  readonly networkId?: string;
23
23
  readonly neuroSanURL?: string;
@@ -27,10 +27,11 @@ export interface AgentFlowProps {
27
27
  * @param newNetworkId The agent_name of the replacement network to navigate to.
28
28
  */
29
29
  readonly networkDisplayName?: string;
30
- readonly onEnterEditMode?: () => void;
31
- readonly onNetworkReplaced?: (oldNetworkId: string, newNetworkId: string) => void;
32
- /** Called when the user closes the edit-mode dock. */
33
- readonly onExitEditMode?: () => void;
30
+ /**
31
+ * Setter for changing the selected network.
32
+ */
33
+ readonly setSelectedNetwork?: (network: string | null) => void;
34
+ readonly setIsEditingNetwork?: (value: boolean) => void;
34
35
  readonly onSaveAgent?: (agentName: string, updated: AgentNetworkDefinitionEntry[], agentNetworkName: string | undefined, signal: AbortSignal) => Promise<void>;
35
36
  readonly thoughtBubbleEdges: Map<string, {
36
37
  edge: ThoughtBubbleEdgeShape;
@@ -41,7 +42,6 @@ export interface AgentFlowProps {
41
42
  timestamp: number;
42
43
  }>>>;
43
44
  }
44
- export declare const DOCK_BANNER_AUTO_DISMISS_MS = 5000;
45
45
  /**
46
46
  * Filters node events based on the current mode. Don't allow any topological-modifying events (adding, deleting nodes)
47
47
  * and in Agent Network Designer mode, don't allow dragging nodes (position changes) either.