@cognizant-ai-lab/ui-common 1.4.2 → 1.5.0-main.0068ed2.127

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 (160) 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/Theme/Theme.js +3 -3
  5. package/dist/components/AgentChat/{ChatCommon.d.ts → ChatCommon/ChatCommon.d.ts} +34 -10
  6. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +723 -0
  7. package/dist/components/AgentChat/ChatCommon/ChatHistory.d.ts +18 -0
  8. package/dist/components/AgentChat/ChatCommon/ChatHistory.js +38 -0
  9. package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
  10. package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
  11. package/dist/components/AgentChat/{ControlButtons.d.ts → ChatCommon/ControlButtons.d.ts} +5 -3
  12. package/dist/components/AgentChat/ChatCommon/ControlButtons.js +35 -0
  13. package/dist/components/AgentChat/ChatCommon/Conversation.d.ts +13 -0
  14. package/dist/components/AgentChat/ChatCommon/Conversation.js +80 -0
  15. package/dist/components/AgentChat/ChatCommon/ConversationTurn.d.ts +23 -0
  16. package/dist/components/AgentChat/ChatCommon/ConversationTurn.js +12 -0
  17. package/dist/components/AgentChat/{FormattedMarkdown.js → ChatCommon/FormattedMarkdown.js} +9 -4
  18. package/dist/components/AgentChat/ChatCommon/SampleQueries.d.ts +19 -0
  19. package/dist/components/AgentChat/ChatCommon/SampleQueries.js +32 -0
  20. package/dist/components/AgentChat/{SendButton.js → ChatCommon/SendButton.js} +8 -7
  21. package/dist/components/AgentChat/{SyntaxHighlighterThemes.js → ChatCommon/SyntaxHighlighterThemes.js} +1 -1
  22. package/dist/components/AgentChat/ChatCommon/Thinking.d.ts +13 -0
  23. package/dist/components/AgentChat/ChatCommon/Thinking.js +54 -0
  24. package/dist/components/AgentChat/Common/LlmChatButton.d.ts +4 -0
  25. package/dist/components/AgentChat/{LlmChatButton.js → Common/LlmChatButton.js} +4 -9
  26. package/dist/components/AgentChat/{Types.d.ts → Common/Types.d.ts} +6 -5
  27. package/dist/components/AgentChat/{Types.js → Common/Types.js} +5 -0
  28. package/dist/components/AgentChat/Common/Utils.d.ts +5 -0
  29. package/dist/components/AgentChat/{Utils.js → Common/Utils.js} +15 -21
  30. package/dist/components/AgentChat/VoiceChat/MicrophoneButton.js +13 -11
  31. package/dist/components/ChatBot/ChatBot.d.ts +0 -4
  32. package/dist/components/ChatBot/ChatBot.js +4 -4
  33. package/dist/components/Common/AccordionLite.d.ts +14 -0
  34. package/dist/components/Common/AccordionLite.js +25 -0
  35. package/dist/components/Common/Breadcrumbs.js +1 -1
  36. package/dist/components/Common/ConfirmationModal.d.ts +3 -1
  37. package/dist/components/Common/ConfirmationModal.js +1 -1
  38. package/dist/components/Common/Footer.js +4 -0
  39. package/dist/components/Common/MUIAlert.d.ts +1 -0
  40. package/dist/components/Common/MUIAlert.js +3 -4
  41. package/dist/components/Common/MUIDialog.d.ts +1 -0
  42. package/dist/components/Common/MUIDialog.js +2 -2
  43. package/dist/components/Common/Navbar.d.ts +2 -1
  44. package/dist/components/Common/Navbar.js +30 -24
  45. package/dist/components/Common/StatusLight.d.ts +9 -0
  46. package/dist/components/Common/StatusLight.js +21 -0
  47. package/dist/components/Common/notification.d.ts +5 -5
  48. package/dist/components/Common/notification.js +17 -12
  49. package/dist/components/ErrorPage/ErrorBoundary.js +1 -1
  50. package/dist/components/ErrorPage/ErrorPage.d.ts +3 -3
  51. package/dist/components/ErrorPage/ErrorPage.js +4 -3
  52. package/dist/components/Logo/Common.d.ts +4 -0
  53. package/dist/components/Logo/Common.js +8 -0
  54. package/dist/components/Logo/CustomerLogo.d.ts +23 -0
  55. package/dist/components/Logo/CustomerLogo.js +41 -0
  56. package/dist/components/MultiAgentAccelerator/AgentConversations.js +0 -1
  57. package/dist/components/MultiAgentAccelerator/AgentCounts.d.ts +2 -2
  58. package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.d.ts +53 -0
  59. package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +761 -0
  60. package/dist/components/MultiAgentAccelerator/{AgentNode.d.ts → AgentFlow/AgentNode.d.ts} +4 -1
  61. package/dist/components/MultiAgentAccelerator/{AgentNode.js → AgentFlow/AgentNode.js} +87 -48
  62. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphLayouts.d.ts +43 -0
  63. package/dist/components/MultiAgentAccelerator/{GraphLayouts.js → AgentFlow/GraphLayouts.js} +41 -55
  64. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.d.ts +21 -0
  65. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.js +27 -0
  66. package/dist/components/MultiAgentAccelerator/AgentFlow/PlasmaEdge.d.ts +7 -0
  67. package/dist/components/MultiAgentAccelerator/{PlasmaEdge.js → AgentFlow/PlasmaEdge.js} +13 -8
  68. package/dist/components/MultiAgentAccelerator/AgentNetworkDesigner.d.ts +10 -0
  69. package/dist/components/MultiAgentAccelerator/AgentNetworkDesigner.js +20 -0
  70. package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +30 -0
  71. package/dist/components/MultiAgentAccelerator/AgentNodePopup.js +80 -0
  72. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +4 -9
  73. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +467 -103
  74. package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.d.ts +2 -0
  75. package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.js +38 -0
  76. package/dist/components/MultiAgentAccelerator/Schema/SlyData.d.ts +17 -0
  77. package/dist/components/MultiAgentAccelerator/Schema/SlyData.js +23 -0
  78. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +3 -5
  79. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +66 -48
  80. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +4 -3
  81. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +106 -174
  82. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +32 -13
  83. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +179 -96
  84. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +39 -0
  85. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +109 -1
  86. package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.d.ts → ThoughtBubbles/ThoughtBubbleEdge.d.ts} +1 -1
  87. package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.js → ThoughtBubbles/ThoughtBubbleOverlay.js} +35 -21
  88. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.d.ts +7 -0
  89. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +96 -0
  90. package/dist/components/MultiAgentAccelerator/const.d.ts +28 -3
  91. package/dist/components/MultiAgentAccelerator/const.js +32 -6
  92. package/dist/components/Settings/ApiKeyInput.d.ts +16 -0
  93. package/dist/components/Settings/ApiKeyInput.js +69 -0
  94. package/dist/components/Settings/InfoTip.d.ts +8 -0
  95. package/dist/components/Settings/InfoTip.js +14 -0
  96. package/dist/components/Settings/SettingsDialog.js +396 -179
  97. package/dist/components/Settings/SettingsRow.d.ts +18 -0
  98. package/dist/components/Settings/SettingsRow.js +35 -0
  99. package/dist/const.d.ts +5 -1
  100. package/dist/const.js +5 -2
  101. package/dist/controller/agent/Agent.d.ts +19 -18
  102. package/dist/controller/agent/Agent.js +36 -50
  103. package/dist/controller/agent/IconSuggestions.d.ts +35 -0
  104. package/dist/controller/agent/IconSuggestions.js +85 -0
  105. package/dist/controller/llm/LlmChat.js +3 -3
  106. package/dist/controller/llm/Providers.d.ts +2 -0
  107. package/dist/controller/llm/Providers.js +41 -0
  108. package/dist/index.d.ts +9 -11
  109. package/dist/index.js +9 -11
  110. package/dist/state/Announcements.d.ts +24 -0
  111. package/dist/state/Announcements.js +29 -0
  112. package/dist/state/ChatHistory.d.ts +50 -0
  113. package/dist/state/ChatHistory.js +98 -0
  114. package/dist/state/IconSuggestions.d.ts +27 -0
  115. package/dist/state/IconSuggestions.js +50 -0
  116. package/dist/state/IndexedDBStorage.d.ts +14 -0
  117. package/dist/state/IndexedDBStorage.js +65 -0
  118. package/dist/state/Settings.d.ts +98 -5
  119. package/dist/state/Settings.js +111 -8
  120. package/dist/state/TemporaryNetworks.d.ts +13 -0
  121. package/dist/state/TemporaryNetworks.js +15 -0
  122. package/dist/state/Tour.d.ts +29 -0
  123. package/dist/state/Tour.js +22 -0
  124. package/dist/state/UserInfo.d.ts +2 -1
  125. package/dist/tsconfig.build.tsbuildinfo +1 -1
  126. package/dist/utils/AgentName.d.ts +17 -0
  127. package/dist/utils/AgentName.js +46 -0
  128. package/dist/utils/Authentication.js +12 -3
  129. package/dist/utils/BrowserNavigation.js +2 -0
  130. package/dist/utils/File.d.ts +11 -1
  131. package/dist/utils/File.js +18 -12
  132. package/dist/utils/text.js +4 -8
  133. package/dist/utils/title.js +2 -2
  134. package/dist/utils/zIndexLayers.js +3 -0
  135. package/package.json +26 -13
  136. package/dist/components/AgentChat/ChatCommon.js +0 -617
  137. package/dist/components/AgentChat/ControlButtons.js +0 -26
  138. package/dist/components/AgentChat/Greetings.d.ts +0 -1
  139. package/dist/components/AgentChat/Greetings.js +0 -38
  140. package/dist/components/AgentChat/LlmChatButton.d.ts +0 -8
  141. package/dist/components/AgentChat/UserQueryDisplay.d.ts +0 -5
  142. package/dist/components/AgentChat/UserQueryDisplay.js +0 -31
  143. package/dist/components/AgentChat/Utils.d.ts +0 -12
  144. package/dist/components/Common/CustomerLogo.d.ts +0 -17
  145. package/dist/components/Common/CustomerLogo.js +0 -49
  146. package/dist/components/Common/LlmChatOptionsButton.d.ts +0 -6
  147. package/dist/components/Common/LlmChatOptionsButton.js +0 -31
  148. package/dist/components/Common/MUIAccordion.d.ts +0 -17
  149. package/dist/components/Common/MUIAccordion.js +0 -66
  150. package/dist/components/MultiAgentAccelerator/AgentFlow.d.ts +0 -23
  151. package/dist/components/MultiAgentAccelerator/AgentFlow.js +0 -315
  152. package/dist/components/MultiAgentAccelerator/GraphLayouts.d.ts +0 -36
  153. package/dist/components/MultiAgentAccelerator/PlasmaEdge.d.ts +0 -3
  154. package/dist/utils/useLocalStorage.d.ts +0 -1
  155. package/dist/utils/useLocalStorage.js +0 -55
  156. /package/dist/components/AgentChat/{FormattedMarkdown.d.ts → ChatCommon/FormattedMarkdown.d.ts} +0 -0
  157. /package/dist/components/AgentChat/{SendButton.d.ts → ChatCommon/SendButton.d.ts} +0 -0
  158. /package/dist/components/AgentChat/{SyntaxHighlighterThemes.d.ts → ChatCommon/SyntaxHighlighterThemes.d.ts} +0 -0
  159. /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.js → ThoughtBubbles/ThoughtBubbleEdge.js} +0 -0
  160. /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.d.ts → ThoughtBubbles/ThoughtBubbleOverlay.d.ts} +0 -0
package/README.md CHANGED
@@ -72,7 +72,7 @@ via the chat interface, and visualize the agent network flow.
72
72
  Among the technologies and libraries used in this package are:
73
73
 
74
74
  - ESLint and Prettier (for code quality)
75
- - Jest and React Testing Library (for testing)
75
+ - Vitest and React Testing Library (for testing)
76
76
  - MUI
77
77
  - next-auth (for authentication)
78
78
  - React
@@ -160,9 +160,9 @@ async function checkServer() {
160
160
  const result = await testConnection("https://api.example.com")
161
161
 
162
162
  if (result.success) {
163
- console.log(`Connected! Version: ${result.version}`)
163
+ console.log(`Connected!`)
164
164
  } else {
165
- console.error(`Connection failed: ${result.status}`)
165
+ console.error(`Connection failed: ${result.statusText}`)
166
166
  }
167
167
  }
168
168
  ```
@@ -7,12 +7,3 @@ export declare const PALETTES: {
7
7
  coldToHot: string[];
8
8
  visionImpaired: string[];
9
9
  };
10
- export type PaletteKey = keyof typeof PALETTES | "brand";
11
- /**
12
- * Custom hook to get the current color palette based on user settings.
13
- * If the user has selected custom branding, it will return the palette for that.
14
- * Otherwise, it will return one of the predefined palettes from the PALETTES object based on the user's selection.
15
- *
16
- * @returns An array of color hex codes representing the current color palette.
17
- */
18
- export declare const usePalette: () => string[];
@@ -1,5 +1,4 @@
1
1
  // Palettes for progressive coloring of nodes based on depth or heatmap value
2
- import { useSettingsStore } from "../state/Settings.js";
3
2
  export const PALETTES = {
4
3
  blue: [
5
4
  "#f7fbff",
@@ -75,20 +74,3 @@ export const PALETTES = {
75
74
  "#b6dbff",
76
75
  ],
77
76
  };
78
- /**
79
- * Custom hook to get the current color palette based on user settings.
80
- * If the user has selected custom branding, it will return the palette for that.
81
- * Otherwise, it will return one of the predefined palettes from the PALETTES object based on the user's selection.
82
- *
83
- * @returns An array of color hex codes representing the current color palette.
84
- */
85
- export const usePalette = () => {
86
- const brandPalette = useSettingsStore((state) => state.settings.branding.rangePalette);
87
- const paletteKey = useSettingsStore((state) => state.settings.appearance.rangePalette);
88
- if (paletteKey === "brand" && brandPalette) {
89
- return brandPalette;
90
- }
91
- else {
92
- return PALETTES[paletteKey];
93
- }
94
- };
@@ -48,9 +48,9 @@ export const isLightColor = (color) => {
48
48
  // Remove # if present
49
49
  const colorWithoutHash = hexColor.replace("#", "");
50
50
  // Convert to RGB
51
- const r = parseInt(colorWithoutHash.substring(0, 2), 16);
52
- const g = parseInt(colorWithoutHash.substring(2, 4), 16);
53
- const b = parseInt(colorWithoutHash.substring(4, 6), 16);
51
+ const r = parseInt(colorWithoutHash.slice(0, 2), 16);
52
+ const g = parseInt(colorWithoutHash.slice(2, 4), 16);
53
+ const b = parseInt(colorWithoutHash.slice(4, 6), 16);
54
54
  // Calculate relative luminance (perceived brightness)
55
55
  const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
56
56
  // Return true if light (threshold 0.5)
@@ -1,5 +1,6 @@
1
1
  import { Dispatch, Ref, SetStateAction } from "react";
2
- import { CombinedAgentType } from "./Types.js";
2
+ import { MessageRole } from "./ConversationTurn.js";
3
+ import { CombinedAgentType } from "../Common/Types.js";
3
4
  export interface ChatCommonProps {
4
5
  /**
5
6
  * HTML id to use for the outer component
@@ -9,10 +10,6 @@ export interface ChatCommonProps {
9
10
  * The current username of the logged-in user. Used for fetching things from APIs mainly
10
11
  */
11
12
  readonly currentUser: string;
12
- /**
13
- * Path to image for user avatar
14
- */
15
- readonly userImage: string;
16
13
  /**
17
14
  * Function to set the state of the component to indicate whether we are awaiting a response from the LLM
18
15
  */
@@ -22,9 +19,13 @@ export interface ChatCommonProps {
22
19
  */
23
20
  readonly isAwaitingLlm: boolean;
24
21
  /**
25
- * The agent to send the request to.
22
+ * The network to send the request to.
23
+ */
24
+ readonly selectedNetwork: string | null;
25
+ /**
26
+ * Setter for changing the selected network.
26
27
  */
27
- readonly targetAgent: string;
28
+ readonly setSelectedNetwork?: (network: string | null) => void;
28
29
  /**
29
30
  * Special endpoint for legacy agents since they do not have a single unified endpoint like Neuro-san agents.
30
31
  */
@@ -57,10 +58,9 @@ export interface ChatCommonProps {
57
58
  */
58
59
  readonly agentPlaceholders?: Partial<Record<CombinedAgentType, string>>;
59
60
  /**
60
- * Whether to clear the chat window and history when the user starts chatting with a new agent or network.
61
- * Defaults to not clearing the chat.
61
+ * Optional greetings for specific agents to display
62
62
  */
63
- readonly clearChatOnNewAgent?: boolean;
63
+ readonly customAgentGreetings?: Partial<Record<CombinedAgentType, string>>;
64
64
  /**
65
65
  * Extra parameters to send to the server to be forwarded to the agent or used by the server.
66
66
  * @note This is only used for legacy agents to aid in UI consolidation, only Neuro-san agents.
@@ -82,10 +82,34 @@ export interface ChatCommonProps {
82
82
  * The neuro-san server URL
83
83
  */
84
84
  readonly neuroSanURL?: string;
85
+ /**
86
+ * Extra sly_data entries to merge into each outgoing request. Used by parent components (e.g. temp networks)
87
+ * to re-supply data that lives outside the IndexedDB slyData store (e.g. localStorage).
88
+ */
89
+ readonly extraSlyData?: Record<string, unknown>;
90
+ /**
91
+ * Optional description of the network to display in the UI.
92
+ */
93
+ readonly networkDescription?: string;
94
+ /**
95
+ * Sample queries for the current network that the user can "click to send"
96
+ */
97
+ readonly sampleQueries?: string[];
98
+ /**
99
+ * If true, indicates that the user is missing API keys for one or more LLM providers.
100
+ */
101
+ readonly hasMissingApiKeys?: boolean;
85
102
  }
86
103
  export type ChatCommonHandle = {
87
104
  handleStop: () => void;
105
+ handleClearChat: () => void;
88
106
  };
107
+ /**
108
+ * Helper function to convert a message role to a label for exporting chat history.
109
+ * @param role The message role to convert
110
+ * @returns The label for the message role
111
+ */
112
+ export declare const roleToExportLabel: (role: MessageRole) => string;
89
113
  /**
90
114
  * Common chat component for agent chat. This component is used by all agent chat components to provide a consistent
91
115
  * experience for users when chatting with agents. It handles user input as well as displaying and nicely formatting