@cognizant-ai-lab/ui-common 1.3.3 → 1.4.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 (114) hide show
  1. package/README.md +287 -0
  2. package/dist/Theme/Palettes.d.ts +18 -0
  3. package/dist/Theme/Palettes.js +94 -0
  4. package/dist/Theme/Theme.d.ts +22 -0
  5. package/dist/Theme/Theme.js +58 -0
  6. package/dist/components/AgentChat/ChatCommon.d.ts +4 -2
  7. package/dist/components/AgentChat/ChatCommon.js +141 -105
  8. package/dist/components/AgentChat/ControlButtons.js +3 -1
  9. package/dist/components/AgentChat/FormattedMarkdown.d.ts +4 -4
  10. package/dist/components/AgentChat/FormattedMarkdown.js +5 -7
  11. package/dist/components/AgentChat/LlmChatButton.d.ts +2 -6
  12. package/dist/components/AgentChat/LlmChatButton.js +3 -3
  13. package/dist/components/AgentChat/UserQueryDisplay.js +2 -4
  14. package/dist/components/AgentChat/Utils.d.ts +2 -1
  15. package/dist/components/AgentChat/Utils.js +4 -1
  16. package/dist/components/AgentChat/VoiceChat/MicrophoneButton.d.ts +2 -2
  17. package/dist/components/AgentChat/VoiceChat/VoiceChat.d.ts +3 -3
  18. package/dist/components/AgentChat/VoiceChat/VoiceChat.js +5 -5
  19. package/dist/components/ChatBot/ChatBot.js +2 -2
  20. package/dist/components/Common/Breadcrumbs.js +1 -1
  21. package/dist/components/Common/{confirmationModal.js → ConfirmationModal.js} +2 -5
  22. package/dist/components/Common/CustomerLogo.d.ts +17 -0
  23. package/dist/components/Common/CustomerLogo.js +49 -0
  24. package/dist/components/Common/Footer.d.ts +18 -0
  25. package/dist/components/Common/Footer.js +59 -0
  26. package/dist/components/Common/LlmChatOptionsButton.d.ts +1 -4
  27. package/dist/components/Common/LlmChatOptionsButton.js +4 -4
  28. package/dist/components/Common/LoadingSpinner.js +1 -1
  29. package/dist/components/Common/MUIAccordion.d.ts +2 -2
  30. package/dist/components/Common/MUIAccordion.js +2 -12
  31. package/dist/components/Common/MUIAlert.d.ts +2 -1
  32. package/dist/components/Common/MUIAlert.js +4 -1
  33. package/dist/components/Common/MUIDialog.d.ts +1 -1
  34. package/dist/components/Common/MUIDialog.js +1 -1
  35. package/dist/components/Common/Navbar.d.ts +3 -1
  36. package/dist/components/Common/Navbar.js +60 -35
  37. package/dist/components/Common/PageLoader.js +3 -4
  38. package/dist/components/Common/Snackbar.d.ts +4 -1
  39. package/dist/components/Common/Snackbar.js +11 -19
  40. package/dist/components/Common/notification.d.ts +3 -3
  41. package/dist/components/Common/notification.js +6 -6
  42. package/dist/components/ErrorPage/ErrorBoundary.d.ts +2 -2
  43. package/dist/components/ErrorPage/ErrorBoundary.js +1 -1
  44. package/dist/components/ErrorPage/ErrorPage.js +6 -5
  45. package/dist/components/MultiAgentAccelerator/AgentConversations.d.ts +17 -0
  46. package/dist/components/MultiAgentAccelerator/AgentConversations.js +77 -0
  47. package/dist/components/MultiAgentAccelerator/AgentCounts.d.ts +12 -0
  48. package/dist/components/MultiAgentAccelerator/AgentCounts.js +21 -0
  49. package/dist/components/MultiAgentAccelerator/AgentFlow.d.ts +6 -4
  50. package/dist/components/MultiAgentAccelerator/AgentFlow.js +106 -185
  51. package/dist/components/MultiAgentAccelerator/AgentNode.d.ts +7 -5
  52. package/dist/components/MultiAgentAccelerator/AgentNode.js +93 -50
  53. package/dist/components/MultiAgentAccelerator/GraphLayouts.d.ts +20 -17
  54. package/dist/components/MultiAgentAccelerator/GraphLayouts.js +16 -14
  55. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +2 -3
  56. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +214 -55
  57. package/dist/components/MultiAgentAccelerator/PlasmaEdge.d.ts +1 -1
  58. package/dist/components/MultiAgentAccelerator/PlasmaEdge.js +14 -12
  59. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +15 -0
  60. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +104 -0
  61. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +17 -0
  62. package/dist/components/MultiAgentAccelerator/{Sidebar.js → Sidebar/Sidebar.js} +146 -59
  63. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +19 -0
  64. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +113 -0
  65. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +26 -0
  66. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +20 -0
  67. package/dist/components/MultiAgentAccelerator/ThoughtBubbleEdge.d.ts +10 -8
  68. package/dist/components/MultiAgentAccelerator/ThoughtBubbleEdge.js +1 -1
  69. package/dist/components/MultiAgentAccelerator/ThoughtBubbleOverlay.d.ts +3 -2
  70. package/dist/components/MultiAgentAccelerator/ThoughtBubbleOverlay.js +10 -13
  71. package/dist/components/MultiAgentAccelerator/const.d.ts +1 -3
  72. package/dist/components/MultiAgentAccelerator/const.js +4 -18
  73. package/dist/components/Settings/FadingCheckmark.d.ts +14 -0
  74. package/dist/components/Settings/FadingCheckmark.js +43 -0
  75. package/dist/components/Settings/SettingsDialog.d.ts +9 -0
  76. package/dist/components/Settings/SettingsDialog.js +265 -0
  77. package/dist/const.d.ts +1 -2
  78. package/dist/const.js +2 -3
  79. package/dist/controller/Types/AgentIconSuggestions.d.ts +4 -0
  80. package/dist/controller/Types/AgentIconSuggestions.js +1 -0
  81. package/dist/controller/Types/Branding.d.ts +12 -0
  82. package/dist/controller/Types/Branding.js +1 -0
  83. package/dist/controller/Types/NetworkIconSuggestions.d.ts +4 -0
  84. package/dist/controller/Types/NetworkIconSuggestions.js +1 -0
  85. package/dist/controller/agent/Agent.d.ts +32 -12
  86. package/dist/controller/agent/Agent.js +71 -19
  87. package/dist/controller/llm/LlmChat.d.ts +1 -1
  88. package/dist/controller/llm/LlmChat.js +2 -2
  89. package/dist/index.d.ts +10 -5
  90. package/dist/index.js +10 -5
  91. package/dist/state/{environment.d.ts → Environment.d.ts} +2 -0
  92. package/dist/state/{environment.js → Environment.js} +2 -0
  93. package/dist/state/Settings.d.ts +62 -0
  94. package/dist/state/Settings.js +62 -0
  95. package/dist/state/TemporaryNetworks.d.ts +32 -0
  96. package/dist/state/TemporaryNetworks.js +26 -0
  97. package/dist/tsconfig.build.tsbuildinfo +1 -1
  98. package/dist/utils/Authentication.d.ts +2 -2
  99. package/dist/utils/Authentication.js +6 -6
  100. package/dist/utils/text.d.ts +2 -2
  101. package/dist/utils/text.js +3 -5
  102. package/dist/utils/title.d.ts +1 -1
  103. package/dist/utils/title.js +2 -2
  104. package/dist/utils/useLocalStorage.d.ts +1 -1
  105. package/dist/utils/useLocalStorage.js +3 -3
  106. package/dist/utils/zIndexLayers.d.ts +1 -1
  107. package/dist/utils/zIndexLayers.js +3 -15
  108. package/package.json +23 -21
  109. package/dist/components/MultiAgentAccelerator/Sidebar.d.ts +0 -12
  110. package/dist/utils/Theme.d.ts +0 -7
  111. package/dist/utils/Theme.js +0 -7
  112. package/dist/utils/agentConversations.d.ts +0 -24
  113. package/dist/utils/agentConversations.js +0 -113
  114. /package/dist/components/Common/{confirmationModal.d.ts → ConfirmationModal.d.ts} +0 -0
@@ -16,27 +16,33 @@ limitations under the License.
16
16
  /**
17
17
  * Controller module for interacting with the Agent LLM API.
18
18
  */
19
+ import { TEMPORARY_NETWORK_FOLDER } from "../../components/MultiAgentAccelerator/const.js";
19
20
  import { ApiPaths,
20
21
  // eslint-disable-next-line camelcase
21
22
  ChatFilterChat_filter_type, ChatMessageType, } from "../../generated/neuro-san/NeuroSanClient.js";
22
23
  import { sendLlmRequest } from "../llm/LlmChat.js";
23
24
  /**
24
25
  * Insert the target agent name into the path. The paths Api enum contains values like:
25
- * <code>"/api/v1/{agent_name}/connectivity"</code> so unfortunately we need to do a replace() to insert the target
26
+ * <code>"/api/v1/{agent_name}/connectivity"</code> so unfortunately we need to do a `replace()` to insert the target
26
27
  * agent.
27
28
  * @param agent The agent to send the request to.
28
29
  * @param path The API path to insert the target agent into.
29
30
  * @returns The path with the target agent name inserted.
30
31
  */
31
32
  const insertTargetAgent = (agent, path) => {
32
- return path.replace("{agent_name}", agent);
33
+ let agentTmp = agent;
34
+ // Remove "temporary" prefix from network name if it exists since the server doesn't know about that convention
35
+ if (agentTmp.startsWith(`${TEMPORARY_NETWORK_FOLDER}/`)) {
36
+ agentTmp = agentTmp.replace(`${TEMPORARY_NETWORK_FOLDER}/`, "");
37
+ }
38
+ return path.replace("{agent_name}", agentTmp);
33
39
  };
34
40
  /**
35
41
  * Test connection for a neuro-san server.
36
42
  * @param url The neuro-san server URL.
37
43
  * @returns A boolean indicating whether the connection was successful.
38
44
  */
39
- export async function testConnection(url) {
45
+ export const testConnection = async (url) => {
40
46
  const controller = new AbortController();
41
47
  const timeout = setTimeout(() => controller.abort(), 2500); // 2.5s timeout
42
48
  try {
@@ -60,30 +66,76 @@ export async function testConnection(url) {
60
66
  finally {
61
67
  clearTimeout(timeout);
62
68
  }
63
- }
69
+ };
70
+ /**
71
+ * Utility function to send POST requests with JSON body and handle errors.
72
+ * Used for getting LLM suggestions for icons and branding colors.
73
+ * @template T The expected response type from the server.
74
+ * @param endpoint The API endpoint to send the request to.
75
+ * @param body The request body to send, which will be stringified to JSON.
76
+ * @returns The response from the server parsed as JSON.
77
+ * @throws An error if the request fails or the response is not ok.
78
+ */
79
+ const postJsonRequest = async (endpoint, body) => {
80
+ const response = await fetch(endpoint, {
81
+ method: "POST",
82
+ headers: {
83
+ "Content-Type": "application/json",
84
+ },
85
+ body: JSON.stringify(body),
86
+ });
87
+ const jsonResponse = await response.json();
88
+ if (!response.ok || jsonResponse.error) {
89
+ throw new Error(jsonResponse.error || response.statusText);
90
+ }
91
+ return jsonResponse;
92
+ };
93
+ /**
94
+ * Get LLM suggestions for network icons.
95
+ * @param networks The list of networks to get icon suggestions for.
96
+ * @returns A promise that resolves to a record mapping network names to icon names.
97
+ */
98
+ export const getNetworkIconSuggestions = async (networks) => postJsonRequest("/api/networkIconSuggestions", { networks });
99
+ /**
100
+ * Get LLM suggestions for agent icons based on their descriptions from Neuro-san
101
+ * @param connectivity The connectivity information for the agents in the network, including their descriptions,
102
+ * tools, and connections.
103
+ * @return A promise that resolves to a record mapping agent names to suggested icon names.
104
+ */
105
+ export const getAgentIconSuggestions = async (connectivity) => postJsonRequest("/api/agentIconSuggestions", {
106
+ connectivity_info: connectivity.connectivity_info,
107
+ metadata: connectivity.metadata,
108
+ });
109
+ /**
110
+ * Get LLM suggestions for branding colors based on the company name. This is used to customize the UI colors
111
+ * to match the user's company branding.
112
+ * @param company The name of the company to get branding color suggestions for.
113
+ * @returns A promise that resolves to a record mapping color types (e.g. "primary", "secondary") to hex color codes.
114
+ */
115
+ export const getBrandingSuggestions = async (company) => postJsonRequest("/api/branding", { company });
64
116
  /**
65
117
  * Get the list of available agent networks from the concierge service.
66
118
  * @param url The neuro-san server URL
67
- * @returns A promise that resolves to an array of agent network names.
119
+ * @returns A promise that resolves to an array of AgentInfo objects.
68
120
  */
69
- export async function getAgentNetworks(url) {
121
+ export const getAgentNetworks = async (url) => {
70
122
  const path = `${url}${ApiPaths.ConciergeService_List}`;
71
123
  const response = await fetch(path);
72
124
  const conciergeResponse = (await response.json());
73
- return conciergeResponse.agents.map((network) => network.agent_name);
74
- }
125
+ return conciergeResponse.agents;
126
+ };
75
127
  // Function to split each chunk by newline and call the real callback. The server can send multiple JSON objects per
76
128
  // chunk delimited by newline.
77
- function handleJsonLines(chunk, callback) {
129
+ const handleJsonLines = (chunk, callback) => {
78
130
  chunk.split("\n").forEach((line) => {
79
131
  const trimmed = line.trim();
80
132
  if (trimmed) {
81
133
  callback(trimmed);
82
134
  }
83
135
  });
84
- }
136
+ };
85
137
  /**
86
- * Send a chat query to the Agent LLM API. This opens a session with the agent network..
138
+ * Send a chat query to the Agent LLM API. This opens a session with the agent network.
87
139
  * @param url The neuro-san server URL
88
140
  * @param signal The AbortSignal to use for the request. Used to cancel the request on user demand
89
141
  * @param userInput The user input to send to the agent.
@@ -93,11 +145,11 @@ function handleJsonLines(chunk, callback) {
93
145
  * @param callback The callback function to be called when a chunk of data is received from the server.
94
146
  * @param chatContext "Opaque" conversation context for maintaining conversation state with the server. Neuro-san
95
147
  * agents do not use ChatHistory directly, but rather, ChatContext, which is a collection of ChatHistory objects.
96
- * @param slyData Data items that should not be send to the LLM. Generated by the server.
148
+ * @param slyData Data items that should not be sent to the LLM. Generated by the server.
97
149
  * @param userId Current user ID in the session.
98
150
  * @returns The response from the agent network.
99
151
  */
100
- export async function sendChatQuery(url, signal, userInput, targetAgent, callback, chatContext, slyData, userId) {
152
+ export const sendChatQuery = async (url, signal, userInput, targetAgent, callback, chatContext, slyData, userId) => {
101
153
  // Create request
102
154
  const userMessage = {
103
155
  type: ChatMessageType.HUMAN,
@@ -113,7 +165,7 @@ export async function sendChatQuery(url, signal, userInput, targetAgent, callbac
113
165
  const fetchUrl = `${url}${insertTargetAgent(targetAgent, ApiPaths.AgentService_StreamingChat)}`;
114
166
  const requestRecord = Object.entries(agentChatRequest).reduce((acc, [key, value]) => (value ? { ...acc, [key]: value } : acc), {});
115
167
  return sendLlmRequest((chunk) => handleJsonLines(chunk, callback), signal, fetchUrl, requestRecord, null, null, userId);
116
- }
168
+ };
117
169
  /**
118
170
  * Gets information on the agent and tool connections within a network
119
171
  * @param url The neuro-san server URL
@@ -123,7 +175,7 @@ export async function sendChatQuery(url, signal, userInput, targetAgent, callbac
123
175
  * @throws Various exceptions if anything goes wrong such as network issues or invalid agent type.
124
176
  * Caller is responsible for try-catch.
125
177
  */
126
- export async function getConnectivity(url, network, userId) {
178
+ export const getConnectivity = async (url, network, userId) => {
127
179
  const fetchUrl = `${url}${insertTargetAgent(network, ApiPaths.AgentService_Connectivity)}`;
128
180
  const response = await fetch(fetchUrl, {
129
181
  method: "GET",
@@ -133,11 +185,11 @@ export async function getConnectivity(url, network, userId) {
133
185
  },
134
186
  });
135
187
  if (!response.ok) {
136
- console.debug(`response: ${JSON.stringify(response)}`);
188
+ console.error(`response: ${JSON.stringify(response)}`);
137
189
  throw new Error(`Failed to send connectivity request: ${response.statusText}`);
138
190
  }
139
191
  return response.json();
140
- }
192
+ };
141
193
  /**
142
194
  * Get the function of a specified agent meaning its brief description
143
195
  * @param url The neuro-san server URL
@@ -146,7 +198,7 @@ export async function getConnectivity(url, network, userId) {
146
198
  * @returns The function info as a <code>FunctionResponse</code> object
147
199
  * @throws Various exceptions if anything goes wrong such as network issues or invalid agent type.
148
200
  */
149
- export async function getAgentFunction(url, agent, userId) {
201
+ export const getAgentFunction = async (url, agent, userId) => {
150
202
  const fetchUrl = `${url}${insertTargetAgent(agent, ApiPaths.AgentService_Function)}`;
151
203
  const response = await fetch(fetchUrl, {
152
204
  method: "GET",
@@ -159,4 +211,4 @@ export async function getAgentFunction(url, agent, userId) {
159
211
  throw new Error(`Failed to send agent function request: ${response.statusText}`);
160
212
  }
161
213
  return response.json();
162
- }
214
+ };
@@ -15,4 +15,4 @@ import { BaseMessage } from "@langchain/core/messages";
15
15
  * @returns Either the JSON result of the call, or, if a callback is provided, nothing, but tokens are streamed
16
16
  * to the callback as they are received from the server.
17
17
  */
18
- export declare function sendLlmRequest(callback: (token: string) => void, signal: AbortSignal, fetchUrl: string, params: Record<string, unknown>, userQuery?: string, chatHistory?: BaseMessage[], userId?: string): Promise<any>;
18
+ export declare const sendLlmRequest: (callback: (token: string) => void, signal: AbortSignal, fetchUrl: string, params: Record<string, unknown>, userQuery?: string, chatHistory?: BaseMessage[], userId?: string) => Promise<any>;
@@ -25,7 +25,7 @@ limitations under the License.
25
25
  * @returns Either the JSON result of the call, or, if a callback is provided, nothing, but tokens are streamed
26
26
  * to the callback as they are received from the server.
27
27
  */
28
- export async function sendLlmRequest(callback, signal, fetchUrl, params, userQuery, chatHistory, userId) {
28
+ export const sendLlmRequest = async (callback, signal, fetchUrl, params, userQuery, chatHistory, userId) => {
29
29
  const res = await fetch(fetchUrl, {
30
30
  method: "POST",
31
31
  headers: {
@@ -62,4 +62,4 @@ export async function sendLlmRequest(callback, signal, fetchUrl, params, userQue
62
62
  else {
63
63
  return res.json();
64
64
  }
65
- }
65
+ };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Export modules so they can be imported with simpler paths in the consumer
3
3
  */
4
+ export * from "./Theme/Theme.js";
4
5
  export * from "./components/AgentChat/ChatCommon.js";
5
6
  export * from "./components/AgentChat/ControlButtons.js";
6
7
  export * from "./components/AgentChat/LlmChatButton.js";
@@ -10,26 +11,30 @@ export * from "./components/AgentChat/Types.js";
10
11
  export * from "./components/AgentChat/Utils.js";
11
12
  export * from "./components/Authentication/Auth.js";
12
13
  export * from "./components/Common/Breadcrumbs.js";
13
- export * from "./components/Common/confirmationModal.js";
14
+ export * from "./components/Common/ConfirmationModal.js";
15
+ export * from "./components/Common/Footer.js";
14
16
  export * from "./components/Common/LlmChatOptionsButton.js";
15
17
  export * from "./components/Common/LoadingSpinner.js";
16
18
  export * from "./components/Common/MUIAccordion.js";
17
19
  export * from "./components/Common/MUIAlert.js";
18
20
  export * from "./components/Common/MUIDialog.js";
19
21
  export * from "./components/Common/Navbar.js";
20
- export * from "./components/Common/notification.js";
21
22
  export * from "./components/Common/PageLoader.js";
22
23
  export * from "./components/Common/Snackbar.js";
24
+ export * from "./components/Common/notification.js";
23
25
  export * from "./components/ErrorPage/ErrorBoundary.js";
26
+ export * from "./components/MultiAgentAccelerator/AgentConversations.js";
27
+ export * from "./components/MultiAgentAccelerator/AgentCounts.js";
24
28
  export * from "./components/MultiAgentAccelerator/AgentFlow.js";
25
29
  export * from "./components/MultiAgentAccelerator/MultiAgentAccelerator.js";
26
- export * from "./components/MultiAgentAccelerator/Sidebar.js";
30
+ export * from "./components/MultiAgentAccelerator/Sidebar/Sidebar.js";
31
+ export * from "./components/MultiAgentAccelerator/TemporaryNetworks.js";
27
32
  export * from "./controller/agent/Agent.js";
28
33
  export * from "./controller/llm/LlmChat.js";
29
34
  export * from "./generated/neuro-san/NeuroSanClient.js";
30
- export * from "./state/environment.js";
35
+ export * from "./state/Environment.js";
36
+ export * from "./state/Settings.js";
31
37
  export * from "./state/UserInfo.js";
32
- export * from "./utils/agentConversations.js";
33
38
  export * from "./utils/Authentication.js";
34
39
  export * from "./utils/text.js";
35
40
  export * from "./utils/title.js";
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ limitations under the License.
16
16
  /**
17
17
  * Export modules so they can be imported with simpler paths in the consumer
18
18
  */
19
+ export * from "./Theme/Theme.js";
19
20
  export * from "./components/AgentChat/ChatCommon.js";
20
21
  export * from "./components/AgentChat/ControlButtons.js";
21
22
  export * from "./components/AgentChat/LlmChatButton.js";
@@ -25,26 +26,30 @@ export * from "./components/AgentChat/Types.js";
25
26
  export * from "./components/AgentChat/Utils.js";
26
27
  export * from "./components/Authentication/Auth.js";
27
28
  export * from "./components/Common/Breadcrumbs.js";
28
- export * from "./components/Common/confirmationModal.js";
29
+ export * from "./components/Common/ConfirmationModal.js";
30
+ export * from "./components/Common/Footer.js";
29
31
  export * from "./components/Common/LlmChatOptionsButton.js";
30
32
  export * from "./components/Common/LoadingSpinner.js";
31
33
  export * from "./components/Common/MUIAccordion.js";
32
34
  export * from "./components/Common/MUIAlert.js";
33
35
  export * from "./components/Common/MUIDialog.js";
34
36
  export * from "./components/Common/Navbar.js";
35
- export * from "./components/Common/notification.js";
36
37
  export * from "./components/Common/PageLoader.js";
37
38
  export * from "./components/Common/Snackbar.js";
39
+ export * from "./components/Common/notification.js";
38
40
  export * from "./components/ErrorPage/ErrorBoundary.js";
41
+ export * from "./components/MultiAgentAccelerator/AgentConversations.js";
42
+ export * from "./components/MultiAgentAccelerator/AgentCounts.js";
39
43
  export * from "./components/MultiAgentAccelerator/AgentFlow.js";
40
44
  export * from "./components/MultiAgentAccelerator/MultiAgentAccelerator.js";
41
- export * from "./components/MultiAgentAccelerator/Sidebar.js";
45
+ export * from "./components/MultiAgentAccelerator/Sidebar/Sidebar.js";
46
+ export * from "./components/MultiAgentAccelerator/TemporaryNetworks.js";
42
47
  export * from "./controller/agent/Agent.js";
43
48
  export * from "./controller/llm/LlmChat.js";
44
49
  export * from "./generated/neuro-san/NeuroSanClient.js";
45
- export * from "./state/environment.js";
50
+ export * from "./state/Environment.js";
51
+ export * from "./state/Settings.js";
46
52
  export * from "./state/UserInfo.js";
47
- export * from "./utils/agentConversations.js";
48
53
  export * from "./utils/Authentication.js";
49
54
  export * from "./utils/text.js";
50
55
  export * from "./utils/title.js";
@@ -10,6 +10,8 @@ interface EnvironmentStore {
10
10
  setAuth0Domain: (auth0Domain: string) => void;
11
11
  supportEmailAddress: string;
12
12
  setSupportEmailAddress: (supportEmailAddress: string) => void;
13
+ logoServiceToken: string;
14
+ setLogoServiceToken: (logoServiceToken: string) => void;
13
15
  }
14
16
  /**
15
17
  * The hook that lets apps use the store
@@ -30,4 +30,6 @@ export const useEnvironmentStore = create((set) => ({
30
30
  setAuth0Domain: (auth0Domain) => set(() => ({ auth0Domain })),
31
31
  supportEmailAddress: null,
32
32
  setSupportEmailAddress: (supportEmailAddress) => set(() => ({ supportEmailAddress })),
33
+ logoServiceToken: null,
34
+ setLogoServiceToken: (logoServiceToken) => set(() => ({ logoServiceToken })),
33
35
  }));
@@ -0,0 +1,62 @@
1
+ import { PaletteKey } from "../Theme/Palettes.js";
2
+ /**
3
+ * A utility type that makes all properties in T deeply optional, since TypeScript's built-in Partial<T>
4
+ * only makes the top-level properties optional.
5
+ *
6
+ * We use it in conjunction with `lodash.merge` to allow partial updates to nested settings objects. TypeScript doesn't
7
+ * know that `lodash.merge` will fill in the missing properties at runtime, so we need this shim to avoid type errors.
8
+ */
9
+ type DeepPartial<T> = {
10
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
11
+ };
12
+ /**
13
+ * User preference settings
14
+ */
15
+ interface Settings {
16
+ readonly appearance: {
17
+ readonly agentIconColor: string;
18
+ readonly agentNodeColor: string;
19
+ readonly autoAgentIconColor: boolean;
20
+ readonly plasmaColor: string;
21
+ readonly rangePalette: PaletteKey;
22
+ };
23
+ readonly branding: {
24
+ readonly customer: string | null;
25
+ readonly primary: string | null;
26
+ readonly secondary: string | null;
27
+ readonly background: string | null;
28
+ readonly rangePalette: string[] | null;
29
+ readonly iconSuggestion: string | null;
30
+ readonly logoSource: "none" | "generic" | "auto" | null;
31
+ };
32
+ readonly behavior: {
33
+ readonly enableZenMode: boolean;
34
+ };
35
+ }
36
+ /**
37
+ * Zustand state store for user preferences/Settings
38
+ */
39
+ export interface SettingsStore {
40
+ readonly settings: Settings;
41
+ readonly updateSettings: (updates: DeepPartial<Settings>) => void;
42
+ readonly resetSettings: () => void;
43
+ }
44
+ /**
45
+ * Default settings, used on first load and on reset
46
+ */
47
+ export declare const DEFAULT_SETTINGS: Settings;
48
+ /**
49
+ * The hook that lets apps use the store
50
+ */
51
+ export declare const useSettingsStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SettingsStore>, "persist"> & {
52
+ persist: {
53
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SettingsStore, SettingsStore>>) => void;
54
+ clearStorage: () => void;
55
+ rehydrate: () => Promise<void> | void;
56
+ hasHydrated: () => boolean;
57
+ onHydrate: (fn: (state: SettingsStore) => void) => () => void;
58
+ onFinishHydration: (fn: (state: SettingsStore) => void) => () => void;
59
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<SettingsStore, SettingsStore>>;
60
+ };
61
+ }>;
62
+ export {};
@@ -0,0 +1,62 @@
1
+ /*
2
+ Copyright 2026 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 { merge } from "lodash-es";
17
+ import { create } from "zustand";
18
+ import { persist } from "zustand/middleware";
19
+ /**
20
+ * Default settings, used on first load and on reset
21
+ */
22
+ export const DEFAULT_SETTINGS = {
23
+ appearance: {
24
+ // CSS variables like --bs-green don't work here. TBD why.
25
+ agentNodeColor: "#2db81f",
26
+ agentIconColor: "black",
27
+ autoAgentIconColor: true,
28
+ rangePalette: "blue",
29
+ plasmaColor: "#2db81f",
30
+ },
31
+ branding: {
32
+ background: null,
33
+ customer: null,
34
+ iconSuggestion: null,
35
+ logoSource: null,
36
+ primary: null,
37
+ rangePalette: null,
38
+ secondary: null,
39
+ },
40
+ behavior: {
41
+ enableZenMode: true,
42
+ },
43
+ };
44
+ /**
45
+ * The hook that lets apps use the store
46
+ */
47
+ export const useSettingsStore = create()(persist((set) => ({
48
+ settings: DEFAULT_SETTINGS,
49
+ updateSettings: (updates) => set((state) => ({
50
+ settings: merge({}, state.settings, updates),
51
+ })),
52
+ resetSettings: () => set({ settings: DEFAULT_SETTINGS }),
53
+ }), {
54
+ name: "app-settings",
55
+ merge: (persistedState, currentState) => {
56
+ // Merge persisted settings with defaults to fill in any missing fields
57
+ return {
58
+ ...currentState,
59
+ settings: merge({}, DEFAULT_SETTINGS, persistedState.settings),
60
+ };
61
+ },
62
+ }));
@@ -0,0 +1,32 @@
1
+ import { AgentInfo } from "../generated/neuro-san/NeuroSanClient.js";
2
+ type AgentReservation = {
3
+ readonly reservation_id: string;
4
+ readonly lifetime_in_seconds: number;
5
+ readonly expiration_time_in_seconds: number;
6
+ };
7
+ export type TemporaryNetwork = {
8
+ readonly reservation: AgentReservation;
9
+ readonly agentInfo: AgentInfo;
10
+ };
11
+ /**
12
+ * Zustand state store for temporary networks, such as vibe coded networks created by the user.
13
+ */
14
+ interface TempNetworksStore {
15
+ readonly tempNetworks: TemporaryNetwork[];
16
+ readonly setTempNetworks: (tempNetworks: TemporaryNetwork[]) => void;
17
+ }
18
+ /**
19
+ * The hook that lets apps use the store.
20
+ */
21
+ export declare const useTempNetworksStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TempNetworksStore>, "persist"> & {
22
+ persist: {
23
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<TempNetworksStore, TempNetworksStore>>) => void;
24
+ clearStorage: () => void;
25
+ rehydrate: () => Promise<void> | void;
26
+ hasHydrated: () => boolean;
27
+ onHydrate: (fn: (state: TempNetworksStore) => void) => () => void;
28
+ onFinishHydration: (fn: (state: TempNetworksStore) => void) => () => void;
29
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<TempNetworksStore, TempNetworksStore>>;
30
+ };
31
+ }>;
32
+ export {};
@@ -0,0 +1,26 @@
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 { create } from "zustand";
17
+ import { persist } from "zustand/middleware";
18
+ /**
19
+ * The hook that lets apps use the store.
20
+ */
21
+ export const useTempNetworksStore = create()(persist((set) => ({
22
+ tempNetworks: [],
23
+ setTempNetworks: (tempNetworks) => set({ tempNetworks }),
24
+ }), {
25
+ name: "temp-networks",
26
+ }));