@cognizant-ai-lab/ui-common 1.7.0 → 1.9.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 (98) hide show
  1. package/README.md +3 -3
  2. package/dist/Theme/Palettes.d.ts +0 -9
  3. package/dist/Theme/Palettes.js +0 -18
  4. package/dist/components/AgentChat/ChatCommon/ChatCommon.d.ts +13 -4
  5. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +131 -38
  6. package/dist/components/AgentChat/ChatCommon/ChatHistory.d.ts +7 -0
  7. package/dist/components/AgentChat/ChatCommon/ChatHistory.js +1 -1
  8. package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
  9. package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
  10. package/dist/components/AgentChat/ChatCommon/ControlButtons.d.ts +5 -3
  11. package/dist/components/AgentChat/ChatCommon/ControlButtons.js +13 -4
  12. package/dist/components/AgentChat/ChatCommon/ConversationTurn.d.ts +5 -5
  13. package/dist/components/AgentChat/ChatCommon/ConversationTurn.js +1 -0
  14. package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.js +3 -0
  15. package/dist/components/AgentChat/ChatCommon/SendButton.js +7 -6
  16. package/dist/components/AgentChat/ChatCommon/SyntaxHighlighterThemes.js +1 -1
  17. package/dist/components/AgentChat/ChatCommon/Thinking.d.ts +1 -0
  18. package/dist/components/AgentChat/ChatCommon/Thinking.js +10 -7
  19. package/dist/components/AgentChat/Common/LlmChatButton.d.ts +0 -2
  20. package/dist/components/AgentChat/Common/LlmChatButton.js +6 -9
  21. package/dist/components/AgentChat/Common/Utils.d.ts +4 -0
  22. package/dist/components/AgentChat/Common/Utils.js +5 -1
  23. package/dist/components/AgentChat/VoiceChat/MicrophoneButton.js +12 -10
  24. package/dist/components/Common/Breadcrumbs.js +1 -1
  25. package/dist/components/Common/Navbar.js +24 -22
  26. package/dist/components/Common/StatusLight.d.ts +9 -0
  27. package/dist/components/Common/StatusLight.js +21 -0
  28. package/dist/components/Common/notification.d.ts +4 -4
  29. package/dist/components/ErrorPage/ErrorBoundary.js +1 -1
  30. package/dist/components/ErrorPage/ErrorPage.d.ts +3 -3
  31. package/dist/components/ErrorPage/ErrorPage.js +4 -3
  32. package/dist/components/Logo/Common.d.ts +4 -0
  33. package/dist/components/Logo/Common.js +8 -0
  34. package/dist/components/Logo/CustomerLogo.d.ts +23 -0
  35. package/dist/components/Logo/CustomerLogo.js +41 -0
  36. package/dist/components/MultiAgentAccelerator/AgentConversations.js +0 -1
  37. package/dist/components/MultiAgentAccelerator/{AgentFlow.d.ts → AgentFlow/AgentFlow.d.ts} +15 -5
  38. package/dist/components/MultiAgentAccelerator/{AgentFlow.js → AgentFlow/AgentFlow.js} +125 -84
  39. package/dist/components/MultiAgentAccelerator/{AgentNode.d.ts → AgentFlow/AgentNode.d.ts} +1 -1
  40. package/dist/components/MultiAgentAccelerator/{AgentNode.js → AgentFlow/AgentNode.js} +26 -30
  41. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphLayouts.d.ts +43 -0
  42. package/dist/components/MultiAgentAccelerator/{GraphLayouts.js → AgentFlow/GraphLayouts.js} +10 -41
  43. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.d.ts +21 -0
  44. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.js +27 -0
  45. package/dist/components/MultiAgentAccelerator/AgentFlow/PlasmaEdge.d.ts +7 -0
  46. package/dist/components/MultiAgentAccelerator/{PlasmaEdge.js → AgentFlow/PlasmaEdge.js} +13 -8
  47. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +3 -9
  48. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +137 -103
  49. package/dist/components/MultiAgentAccelerator/Schema/SlyData.d.ts +17 -0
  50. package/dist/components/MultiAgentAccelerator/Schema/SlyData.js +23 -0
  51. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +0 -5
  52. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +38 -28
  53. package/dist/components/MultiAgentAccelerator/Sidebar/ImportNetworkModal.d.ts +67 -0
  54. package/dist/components/MultiAgentAccelerator/Sidebar/ImportNetworkModal.js +585 -0
  55. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +5 -4
  56. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +77 -168
  57. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +31 -13
  58. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +177 -100
  59. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +22 -0
  60. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +74 -3
  61. package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.d.ts → ThoughtBubbles/ThoughtBubbleEdge.d.ts} +1 -1
  62. package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.js → ThoughtBubbles/ThoughtBubbleOverlay.js} +1 -1
  63. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +15 -8
  64. package/dist/components/MultiAgentAccelerator/const.d.ts +3 -0
  65. package/dist/components/MultiAgentAccelerator/const.js +6 -0
  66. package/dist/components/Settings/ApiKeyInput.js +7 -8
  67. package/dist/components/Settings/InfoTip.d.ts +8 -0
  68. package/dist/components/Settings/InfoTip.js +14 -0
  69. package/dist/components/Settings/SettingsDialog.js +373 -183
  70. package/dist/components/Settings/SettingsRow.d.ts +18 -0
  71. package/dist/components/Settings/SettingsRow.js +35 -0
  72. package/dist/controller/agent/Agent.d.ts +16 -25
  73. package/dist/controller/agent/Agent.js +24 -54
  74. package/dist/controller/agent/IconSuggestions.d.ts +35 -0
  75. package/dist/controller/agent/IconSuggestions.js +85 -0
  76. package/dist/index.d.ts +1 -3
  77. package/dist/index.js +1 -3
  78. package/dist/state/IconSuggestions.d.ts +27 -0
  79. package/dist/state/IconSuggestions.js +50 -0
  80. package/dist/state/Settings.d.ts +97 -6
  81. package/dist/state/Settings.js +110 -8
  82. package/dist/tsconfig.build.tsbuildinfo +1 -1
  83. package/dist/utils/BrowserNavigation.js +2 -0
  84. package/dist/utils/File.d.ts +4 -1
  85. package/dist/utils/File.js +4 -9
  86. package/dist/utils/text.js +3 -7
  87. package/dist/utils/title.js +1 -1
  88. package/package.json +9 -6
  89. package/dist/components/Common/CustomerLogo.d.ts +0 -17
  90. package/dist/components/Common/CustomerLogo.js +0 -47
  91. package/dist/components/Common/MUIAccordion.d.ts +0 -17
  92. package/dist/components/Common/MUIAccordion.js +0 -66
  93. package/dist/components/MultiAgentAccelerator/GraphLayouts.d.ts +0 -36
  94. package/dist/components/MultiAgentAccelerator/PlasmaEdge.d.ts +0 -3
  95. package/dist/utils/useLocalStorage.d.ts +0 -1
  96. package/dist/utils/useLocalStorage.js +0 -55
  97. /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.js → ThoughtBubbles/ThoughtBubbleEdge.js} +0 -0
  98. /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.d.ts → ThoughtBubbles/ThoughtBubbleOverlay.d.ts} +0 -0
@@ -17,6 +17,8 @@ limitations under the License.
17
17
  * Navigate to the specified URL by setting window.location.href
18
18
  * @param url The URL to navigate to
19
19
  */
20
+ // See: https://github.com/jsdom/jsdom/issues/2112
21
+ /* istanbul ignore next -- JSDom doesn't support simulated navigation */
20
22
  export const navigateToUrl = (url) => {
21
23
  window.location.href = url;
22
24
  };
@@ -1,3 +1,4 @@
1
+ type MimeType = `${string}/${string}`;
1
2
  /**
2
3
  * // Sanitize filename for saving
3
4
  * @param input Filename as string
@@ -32,5 +33,7 @@ export declare const getFileName: (path: string) => string;
32
33
  * Downloads a file containing the supplied content with the specified filename
33
34
  * @param messageContents The contents of the file to be downloaded
34
35
  * @param fileName Local filename for the file to be downloaded
36
+ * @param mimeType Optional MIME type for the file to be downloaded, defaults to "application/octet-stream"
35
37
  */
36
- export declare const downloadFile: (messageContents: string | Uint8Array, fileName: string) => void;
38
+ export declare const downloadFile: (messageContents: string | Uint8Array, fileName: string, mimeType?: MimeType) => void;
39
+ export {};
@@ -46,21 +46,16 @@ export const splitFilename = (filename) => {
46
46
  * @param path The path to be parsed
47
47
  * @return The filename part of the path only
48
48
  */
49
- export const getFileName = (path) =>
50
- // conflicts with ESLint newline-per-chained-call rule
51
- // prettier-ignore
52
- path.split("\\")
53
- .pop()
54
- .split("/")
55
- .pop();
49
+ export const getFileName = (path) => path.split("\\").pop().split("/").pop();
56
50
  /**
57
51
  * Downloads a file containing the supplied content with the specified filename
58
52
  * @param messageContents The contents of the file to be downloaded
59
53
  * @param fileName Local filename for the file to be downloaded
54
+ * @param mimeType Optional MIME type for the file to be downloaded, defaults to "application/octet-stream"
60
55
  */
61
- export const downloadFile = (messageContents, fileName) => {
56
+ export const downloadFile = (messageContents, fileName, mimeType = "application/octet-stream") => {
62
57
  const downloadLink = document.createElement("a");
63
- const blob = new Blob([messageContents]);
58
+ const blob = new Blob([messageContents], { type: mimeType });
64
59
  // Apply the url and filename to the anchor tag
65
60
  downloadLink.href = URL.createObjectURL(blob);
66
61
  downloadLink.download = fileName;
@@ -41,9 +41,8 @@ export const extractId = (modelId, modelType) => {
41
41
  if (!modelId || !modelType || !modelId.includes(modelType)) {
42
42
  return "";
43
43
  }
44
- // conflicts with ESLint newline-per-chained-call rule
45
- // prettier-ignore
46
- return modelId.slice(`${modelType}-`.length) // remove the model type
44
+ return modelId
45
+ .slice(`${modelType}-`.length) // remove the model type
47
46
  .split("-") // split by hyphens
48
47
  .slice(0, -1) // remove the last element
49
48
  .join("-"); // join with hyphens
@@ -55,8 +54,5 @@ export const extractId = (modelId, modelType) => {
55
54
  * @returns Hashed string
56
55
  */
57
56
  export const hashString = (input) => {
58
- // prettier-ignore
59
- return createHash("md5")
60
- .update(input)
61
- .digest("hex");
57
+ return createHash("md5").update(input).digest("hex");
62
58
  };
@@ -15,6 +15,6 @@ limitations under the License.
15
15
  */
16
16
  // Miscellaneous utilities for dealing with browser tab title
17
17
  export const getTitleBase = () => {
18
- const subdomain = window.location.host.split(".")[0];
18
+ const subdomain = window.location.host.split(".", 1)[0];
19
19
  return `${subdomain[0].toUpperCase()}${subdomain.slice(1)}`;
20
20
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cognizant-ai-lab/ui-common",
3
3
  "description": "A shared UI component library for Cognizant AI Labs projects",
4
- "version": "1.7.0",
4
+ "version": "1.9.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "yarn clean && yarn generate && yarn run --top-level tsc --project tsconfig.build.json && fix-esm-import-path dist > /dev/null",
@@ -23,27 +23,30 @@
23
23
  "rehype-slug": "6.0.0",
24
24
  "remark-gfm": "4.0.1",
25
25
  "uuid": "14.0.0",
26
+ "zod": "4.4.3",
26
27
  "zustand": "4.5.7"
27
28
  },
28
29
  "devDependencies": {
29
- "@babel/core": "7.29.0",
30
- "@babel/preset-env": "7.29.5",
30
+ "@mui/icons-material": "9.0.1",
31
+ "@mui/material": "9.0.1",
32
+ "@mui/system": "9.1.2",
33
+ "@mui/x-tree-view": "9.1.0",
31
34
  "@testing-library/dom": "10.4.1",
32
35
  "@testing-library/react": "16.3.0",
33
36
  "@testing-library/user-event": "14.6.1",
34
37
  "@types/lodash-es": "4.17.12",
35
- "@types/node": "22.17.1",
38
+ "@types/node": "26.1.1",
36
39
  "@types/react": "19.2.14",
37
40
  "@types/react-dom": "19.2.3",
38
41
  "@types/react-syntax-highlighter": "15.5.13",
39
- "babel-jest": "30.4.0",
40
42
  "fake-indexeddb": "6.2.5",
41
43
  "fix-esm-import-path": "1.10.3",
42
44
  "globals": "17.4.0",
43
45
  "openapi-typescript": "7.8.0",
44
46
  "react": "19.2.4",
45
47
  "react-dom": "19.2.4",
46
- "typescript": "5.9.3"
48
+ "typescript": "5.9.3",
49
+ "vitest": "4.1.10"
47
50
  },
48
51
  "peerDependencies": {
49
52
  "@emotion/react": "^11.14.0",
@@ -1,17 +0,0 @@
1
- import { FC, ReactElement } from "react";
2
- interface CustomerLogoProps {
3
- readonly fallbackElement?: ReactElement | string;
4
- readonly logoServiceToken?: string;
5
- }
6
- /**
7
- * Returns a JSX element for the Cognizant logo, wrapped in a link to the Cognizant website.
8
- */
9
- export declare const getCognizantLogoImage: () => import("react/jsx-runtime").JSX.Element;
10
- /**
11
- * Component to display the customer's logo based on the settings.
12
- * @param logoServiceToken - Optional token for fetching the logo from logo.dev
13
- * @returns JSX element representing the customer's logo, MUI icon, or Cognizant fallback, or null if no logo
14
- * should be displayed or if the logo.dev token is missing/invalid.
15
- */
16
- export declare const CustomerLogo: FC<CustomerLogoProps>;
17
- export {};
@@ -1,47 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // Have to suppress this lint error to allow dynamic access of MUI icons
3
- // eslint-disable-next-line no-restricted-imports
4
- import * as MuiIcons from "@mui/icons-material";
5
- import { useSettingsStore } from "../../state/Settings.js";
6
- /**
7
- * Returns a JSX element for the Cognizant logo, wrapped in a link to the Cognizant website.
8
- */
9
- export const getCognizantLogoImage = () => (_jsx("a", { id: "splash-logo-link", href: "https://www.cognizant.com/us/en", style: {
10
- display: "flex",
11
- paddingLeft: "0.15rem",
12
- }, target: "_blank", rel: "noopener noreferrer", children: _jsx("img", { id: "logo-img", width: "200", height: "45", src: "/cognizant-logo-white.svg", alt: "Cognizant Logo" }) }));
13
- /**
14
- * Component to display the customer's logo based on the settings.
15
- * @param logoServiceToken - Optional token for fetching the logo from logo.dev
16
- * @returns JSX element representing the customer's logo, MUI icon, or Cognizant fallback, or null if no logo
17
- * should be displayed or if the logo.dev token is missing/invalid.
18
- */
19
- export const CustomerLogo = ({ fallbackElement, logoServiceToken }) => {
20
- const customer = useSettingsStore((state) => state.settings.branding.customer);
21
- const iconSuggestion = useSettingsStore((state) => state.settings.branding.iconSuggestion);
22
- const logoSource = useSettingsStore((state) => state.settings.branding.logoSource);
23
- // null: render Cognizant logo (default)
24
- if (logoSource === null) {
25
- return customer?.trim().length ? null : getCognizantLogoImage();
26
- }
27
- // "none": explicitly render no logo
28
- if (logoSource === "none") {
29
- return fallbackElement;
30
- }
31
- // "generic": try MUI icon, then Cognizant fallback
32
- if (logoSource === "generic") {
33
- const MuiIcon = MuiIcons[iconSuggestion];
34
- if (MuiIcon) {
35
- return _jsx(MuiIcon, { sx: { fontSize: "2rem" } });
36
- }
37
- else {
38
- console.warn(`Icon "${iconSuggestion}" not found in MUI icons. Falling back to default.`);
39
- return fallbackElement;
40
- }
41
- }
42
- // "auto": use logo.dev service
43
- const logoUrl = logoServiceToken && customer?.trim().length > 0
44
- ? `https://img.logo.dev/name/${encodeURIComponent(customer)}?token=${logoServiceToken}&theme=dark&format=png&size=75`
45
- : null;
46
- return logoUrl ? (_jsx("img", { src: logoUrl, alt: `${customer} Logo`, width: 40, height: 40, style: { borderRadius: "50%" } })) : (fallbackElement);
47
- };
@@ -1,17 +0,0 @@
1
- import { SxProps } from "@mui/material/styles";
2
- import { FC, ReactNode } from "react";
3
- interface MUIAccordionItem {
4
- content: ReactNode;
5
- disabled?: boolean;
6
- title: ReactNode;
7
- }
8
- interface MUIAccordionProps {
9
- arrowPosition?: "left" | "right";
10
- defaultExpandedPanelKey?: number;
11
- expandOnlyOnePanel?: boolean;
12
- id: string;
13
- items: MUIAccordionItem[];
14
- sx?: SxProps;
15
- }
16
- export declare const MUIAccordion: FC<MUIAccordionProps>;
17
- export {};
@@ -1,66 +0,0 @@
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 ArrowForwardIosSharpIcon from "@mui/icons-material/ArrowForwardIosSharp";
18
- import MuiAccordion from "@mui/material/Accordion";
19
- import MuiAccordionDetails from "@mui/material/AccordionDetails";
20
- import MuiAccordionSummary, { accordionSummaryClasses } from "@mui/material/AccordionSummary";
21
- import { styled } from "@mui/material/styles";
22
- import Typography from "@mui/material/Typography";
23
- import { useCallback, useState } from "react";
24
- // #region: Styled Components
25
- const Accordion = styled((props) => (_jsx(MuiAccordion, { disableGutters: true, elevation: 0, id: "mui-accordion", ...props })))(({ theme }) => ({
26
- border: `1px solid ${theme.palette.divider}`,
27
- "&::before": {
28
- display: "none",
29
- },
30
- }));
31
- const AccordionSummary = styled((props) => (_jsx(MuiAccordionSummary, { id: "mui-accordion-summary", expandIcon: _jsx(ArrowForwardIosSharpIcon, { id: "arrow-forward", sx: { fontSize: "0.9rem" } }), ...props })))(({ theme }) => ({
32
- [`& .${accordionSummaryClasses.expandIconWrapper}.${accordionSummaryClasses.expanded}`]: {
33
- transform: "rotate(90deg)",
34
- },
35
- [`& .${accordionSummaryClasses.content}`]: {
36
- marginLeft: theme.spacing(1),
37
- },
38
- }));
39
- const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({
40
- borderTop: "1px solid rgba(0, 0, 0, .125)",
41
- padding: theme.spacing(2),
42
- }));
43
- // #endregion: Types
44
- export const MUIAccordion = ({ arrowPosition = "left", defaultExpandedPanelKey, expandOnlyOnePanel = false, id, items, sx, }) => {
45
- const [expandedList, setExpandedList] = useState(defaultExpandedPanelKey ? [defaultExpandedPanelKey] : []);
46
- const handleChange = useCallback((panelKey) => (_event, newExpanded) => {
47
- setExpandedList((prevExpandedList) => {
48
- if (!expandOnlyOnePanel) {
49
- return newExpanded
50
- ? [...prevExpandedList, panelKey]
51
- : prevExpandedList.filter((key) => key !== panelKey);
52
- }
53
- else {
54
- return newExpanded ? [panelKey] : [];
55
- }
56
- });
57
- }, [expandOnlyOnePanel]);
58
- const isExpanded = useCallback((panelKey) => expandedList.includes(panelKey), [expandedList]);
59
- return (_jsx(_Fragment, { children: items.map(({ content, disabled = false, title }, index) => {
60
- const panelKey = index + 1; // Start with index 1
61
- const baseIdAndPanelKey = `${id}-${panelKey}`;
62
- return (_jsxs(Accordion, { disabled: disabled, expanded: isExpanded(panelKey), id: `${baseIdAndPanelKey}-accordion`, onChange: handleChange(panelKey), sx: sx, children: [_jsx(AccordionSummary, { "aria-controls": `${baseIdAndPanelKey}-summary`, id: `${baseIdAndPanelKey}-summary`, sx: {
63
- flexDirection: arrowPosition === "left" ? "row-reverse" : undefined,
64
- }, children: _jsx(Typography, { component: "span", id: `${baseIdAndPanelKey}-summary-typography`, sx: { fontSize: "0.9rem" }, children: title }) }), _jsx(AccordionDetails, { id: `${baseIdAndPanelKey}-details`, children: _jsx(Typography, { component: "span", id: `${baseIdAndPanelKey}-details-typography`, sx: { fontSize: "0.85rem" }, children: content }) })] }, `${baseIdAndPanelKey}-accordion`));
65
- }) }));
66
- };
@@ -1,36 +0,0 @@
1
- import { Edge, Node as RFNode } from "@xyflow/react";
2
- import { AgentConversation } from "./AgentConversations.js";
3
- import { AgentNodeProps } from "./AgentNode.js";
4
- import { ThoughtBubbleEdgeShape } from "./ThoughtBubbleEdge.js";
5
- import { AgentIconSuggestions } from "../../controller/Types/AgentIconSuggestions.js";
6
- import { ConnectivityInfo } from "../../generated/neuro-san/NeuroSanClient.js";
7
- export declare const MAX_GLOBAL_THOUGHT_BUBBLES = 5;
8
- /**
9
- * Result of the layout algorithms, containing the nodes and edges with their computed positions and properties.
10
- */
11
- export type LayoutResult = {
12
- nodes: RFNode<AgentNodeProps>[];
13
- edges: Edge[];
14
- };
15
- export declare const addThoughtBubbleEdge: (thoughtBubbleEdges: Map<string, {
16
- edge: ThoughtBubbleEdgeShape;
17
- timestamp: number;
18
- }>, conversationId: string, edge: ThoughtBubbleEdgeShape) => void;
19
- export declare const removeThoughtBubbleEdge: (thoughtBubbleEdges: Map<string, {
20
- edge: ThoughtBubbleEdgeShape;
21
- timestamp: number;
22
- }>, conversationId: string) => void;
23
- export declare const getThoughtBubbleEdges: (thoughtBubbleEdges: Map<string, {
24
- edge: ThoughtBubbleEdgeShape;
25
- timestamp: number;
26
- }>) => ThoughtBubbleEdgeShape[];
27
- export declare const layoutRadial: (agentCounts: Map<string, number>, agentsInNetwork: ConnectivityInfo[], currentConversations: AgentConversation[] | null, // For plasma edges (live) and node highlighting
28
- isAwaitingLlm: boolean, isAgentNetworkDesignerMode: boolean, thoughtBubbleEdges: Map<string, {
29
- edge: ThoughtBubbleEdgeShape;
30
- timestamp: number;
31
- }>, agentIconSuggestions?: AgentIconSuggestions, isTemporaryNetwork?: boolean) => LayoutResult;
32
- export declare const layoutLinear: (agentCounts: Map<string, number>, agentsInNetwork: ConnectivityInfo[], currentConversations: AgentConversation[] | null, // For plasma edges (live) and node highlighting
33
- isAwaitingLlm: boolean, isAgentNetworkDesignerMode: boolean, thoughtBubbleEdges: Map<string, {
34
- edge: ThoughtBubbleEdgeShape;
35
- timestamp: number;
36
- }>, agentIconSuggestions?: AgentIconSuggestions, isTemporaryNetwork?: boolean) => LayoutResult;
@@ -1,3 +0,0 @@
1
- import { EdgeProps } from "@xyflow/react";
2
- import { FC } from "react";
3
- export declare const PlasmaEdge: FC<EdgeProps>;
@@ -1 +0,0 @@
1
- export declare const useLocalStorage: (key: string, initialValue: unknown) => any[];
@@ -1,55 +0,0 @@
1
- /*
2
- Copyright 2025 Cognizant Technology Solutions Corp, www.cognizant.com.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
- import { useState } from "react";
17
- export const useLocalStorage = (key, initialValue) => {
18
- // State to store our value
19
- // Pass initial state function to useState so logic is only executed once
20
- const [storedValue, setStoredValue] = useState(() => {
21
- if (typeof window === "undefined") {
22
- return initialValue;
23
- }
24
- try {
25
- // Get from local storage by key
26
- const item = window.localStorage.getItem(key);
27
- // Parse stored JSON or if none return initialValue
28
- return item ? JSON.parse(item) : initialValue;
29
- }
30
- catch (error) {
31
- // If error also return initialValue
32
- console.error(error);
33
- return initialValue;
34
- }
35
- });
36
- // Return a wrapped version of useState's setter function that ...
37
- // ... persists the new value to localStorage.
38
- const setValue = (value) => {
39
- try {
40
- // Allow value to be a function so we have same API as useState
41
- const valueToStore = typeof value === "function" ? value(storedValue) : value;
42
- // Save state
43
- setStoredValue(valueToStore);
44
- // Save to local storage
45
- if (typeof window !== "undefined") {
46
- window.localStorage.setItem(key, JSON.stringify(valueToStore));
47
- }
48
- }
49
- catch (error) {
50
- // A more advanced implementation would handle the error case
51
- console.error(error);
52
- }
53
- };
54
- return [storedValue, setValue];
55
- };