@cognizant-ai-lab/ui-common 1.8.0 → 1.10.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 (59) hide show
  1. package/README.md +3 -3
  2. package/dist/components/AgentChat/ChatCommon/ChatCommon.d.ts +9 -3
  3. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +94 -27
  4. package/dist/components/AgentChat/ChatCommon/ChatHistory.d.ts +7 -0
  5. package/dist/components/AgentChat/ChatCommon/ChatHistory.js +1 -1
  6. package/dist/components/AgentChat/ChatCommon/ControlButtons.d.ts +4 -2
  7. package/dist/components/AgentChat/ChatCommon/ControlButtons.js +8 -2
  8. package/dist/components/AgentChat/ChatCommon/ConversationTurn.d.ts +5 -5
  9. package/dist/components/AgentChat/ChatCommon/ConversationTurn.js +1 -0
  10. package/dist/components/AgentChat/ChatCommon/Thinking.js +2 -2
  11. package/dist/components/AgentChat/Common/Utils.d.ts +0 -7
  12. package/dist/components/AgentChat/Common/Utils.js +0 -12
  13. package/dist/components/Common/Breadcrumbs.js +1 -1
  14. package/dist/components/Common/Footer.js +4 -0
  15. package/dist/components/Common/notification.d.ts +4 -4
  16. package/dist/components/MultiAgentAccelerator/{AgentFlow.d.ts → AgentFlow/AgentFlow.d.ts} +15 -5
  17. package/dist/components/MultiAgentAccelerator/{AgentFlow.js → AgentFlow/AgentFlow.js} +99 -58
  18. package/dist/components/MultiAgentAccelerator/{AgentNode.d.ts → AgentFlow/AgentNode.d.ts} +1 -1
  19. package/dist/components/MultiAgentAccelerator/{AgentNode.js → AgentFlow/AgentNode.js} +11 -9
  20. package/dist/components/MultiAgentAccelerator/{GraphLayouts.d.ts → AgentFlow/GraphLayouts.d.ts} +4 -4
  21. package/dist/components/MultiAgentAccelerator/{GraphLayouts.js → AgentFlow/GraphLayouts.js} +15 -41
  22. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.d.ts +21 -0
  23. package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.js +27 -0
  24. package/dist/components/MultiAgentAccelerator/AgentFlow/PlasmaEdge.d.ts +7 -0
  25. package/dist/components/MultiAgentAccelerator/{PlasmaEdge.js → AgentFlow/PlasmaEdge.js} +13 -8
  26. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +74 -83
  27. package/dist/components/MultiAgentAccelerator/Schema/SlyData.d.ts +17 -0
  28. package/dist/components/MultiAgentAccelerator/Schema/SlyData.js +23 -0
  29. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +2 -0
  30. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +22 -25
  31. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +16 -22
  32. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +1 -0
  33. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +27 -7
  34. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +8 -0
  35. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +61 -13
  36. package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.d.ts → ThoughtBubbles/ThoughtBubbleEdge.d.ts} +1 -1
  37. package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.js → ThoughtBubbles/ThoughtBubbleOverlay.js} +1 -1
  38. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +7 -2
  39. package/dist/components/MultiAgentAccelerator/const.d.ts +11 -10
  40. package/dist/components/MultiAgentAccelerator/const.js +22 -20
  41. package/dist/components/Settings/SettingsDialog.js +26 -10
  42. package/dist/controller/agent/Agent.d.ts +14 -6
  43. package/dist/controller/agent/Agent.js +18 -14
  44. package/dist/index.d.ts +1 -1
  45. package/dist/index.js +1 -1
  46. package/dist/state/Settings.d.ts +81 -4
  47. package/dist/state/Settings.js +87 -7
  48. package/dist/state/TemporaryNetworks.js +12 -21
  49. package/dist/tsconfig.build.tsbuildinfo +1 -1
  50. package/dist/utils/AgentName.d.ts +17 -0
  51. package/dist/utils/AgentName.js +46 -0
  52. package/dist/utils/BrowserNavigation.js +2 -0
  53. package/dist/utils/File.d.ts +4 -1
  54. package/dist/utils/File.js +4 -9
  55. package/dist/utils/text.js +3 -7
  56. package/package.json +9 -10
  57. package/dist/components/MultiAgentAccelerator/PlasmaEdge.d.ts +0 -3
  58. /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.js → ThoughtBubbles/ThoughtBubbleEdge.js} +0 -0
  59. /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.d.ts → ThoughtBubbles/ThoughtBubbleOverlay.d.ts} +0 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Strip a trailing UUID appended to an agent name or reservation_id, e.g.
3
+ * `copy_cat-hello_world-14ecb260-4389-44f3-afad-ea315dfa1966` → `copy_cat-hello_world`.
4
+ */
5
+ export declare const removeTrailingUuid: (agentName: string) => string;
6
+ /**
7
+ * Convert FOO_BAR to more human "Foo Bar".
8
+ * @param agentName Agent name in SNAKE_CASE format.
9
+ * @returns User-friendly agent name.
10
+ */
11
+ export declare const cleanUpAgentName: (agentName: string) => string;
12
+ /**
13
+ * Beautify a raw agent name for display: strip any trailing UUID and title-case the rest
14
+ * (e.g. `my_network_683b0dfb_4816_464d_9c83_7e59ce6497d3` → `My Network`). With `useNativeNames`
15
+ * on, the raw name is returned verbatim to match the appearance preference honored across the app.
16
+ */
17
+ export declare const toDisplayName: (rawName: string, useNativeNames?: boolean) => string;
@@ -0,0 +1,46 @@
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
+ /**
17
+ * One-stop shop for turning a raw agent-network name (or reservation_id) into the beautified name
18
+ * shown in the UI.
19
+ */
20
+ import startCase from "lodash-es/startCase";
21
+ /**
22
+ * Trailing UUID on an agent name or reservation_id.
23
+ *
24
+ * Each separator is `[_-]` because the canonical form is hyphen-delimited (e.g.
25
+ * `copy_cat-hello_world-14ecb260-4389-44f3-afad-ea315dfa1966`), but filename sanitization
26
+ * (`toSafeFilename`, neuro-san exports) flattens those hyphens to underscores. Matching either
27
+ * separator strips the UUID in both forms.
28
+ */
29
+ const TRAILING_UUID_PATTERN = /[_-][0-9a-fA-F]{8}[_-][0-9a-fA-F]{4}[_-][0-9a-fA-F]{4}[_-][0-9a-fA-F]{4}[_-][0-9a-fA-F]{12}$/u;
30
+ /**
31
+ * Strip a trailing UUID appended to an agent name or reservation_id, e.g.
32
+ * `copy_cat-hello_world-14ecb260-4389-44f3-afad-ea315dfa1966` → `copy_cat-hello_world`.
33
+ */
34
+ export const removeTrailingUuid = (agentName) => agentName?.replace(TRAILING_UUID_PATTERN, "");
35
+ /**
36
+ * Convert FOO_BAR to more human "Foo Bar".
37
+ * @param agentName Agent name in SNAKE_CASE format.
38
+ * @returns User-friendly agent name.
39
+ */
40
+ export const cleanUpAgentName = (agentName) => startCase(agentName);
41
+ /**
42
+ * Beautify a raw agent name for display: strip any trailing UUID and title-case the rest
43
+ * (e.g. `my_network_683b0dfb_4816_464d_9c83_7e59ce6497d3` → `My Network`). With `useNativeNames`
44
+ * on, the raw name is returned verbatim to match the appearance preference honored across the app.
45
+ */
46
+ export const toDisplayName = (rawName, useNativeNames = false) => useNativeNames ? rawName : cleanUpAgentName(removeTrailingUuid(rawName));
@@ -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
  };
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.8.0",
4
+ "version": "1.10.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",
@@ -12,10 +12,6 @@
12
12
  "dependencies": {
13
13
  "@dagrejs/dagre": "1.0.4",
14
14
  "@langchain/core": "1.1.17",
15
- "@mui/icons-material": "9.0.1",
16
- "@mui/material": "9.0.1",
17
- "@mui/system": "9.0.1",
18
- "@mui/x-tree-view": "9.1.0",
19
15
  "@xyflow/react": "12.10.1",
20
16
  "http-status": "1.7.3",
21
17
  "lodash-es": "4.18.1",
@@ -27,27 +23,30 @@
27
23
  "rehype-slug": "6.0.0",
28
24
  "remark-gfm": "4.0.1",
29
25
  "uuid": "14.0.0",
26
+ "zod": "4.4.3",
30
27
  "zustand": "4.5.7"
31
28
  },
32
29
  "devDependencies": {
33
- "@babel/core": "7.29.0",
34
- "@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",
35
34
  "@testing-library/dom": "10.4.1",
36
35
  "@testing-library/react": "16.3.0",
37
36
  "@testing-library/user-event": "14.6.1",
38
37
  "@types/lodash-es": "4.17.12",
39
- "@types/node": "22.17.1",
38
+ "@types/node": "26.1.1",
40
39
  "@types/react": "19.2.14",
41
40
  "@types/react-dom": "19.2.3",
42
41
  "@types/react-syntax-highlighter": "15.5.13",
43
- "babel-jest": "30.4.0",
44
42
  "fake-indexeddb": "6.2.5",
45
43
  "fix-esm-import-path": "1.10.3",
46
44
  "globals": "17.4.0",
47
45
  "openapi-typescript": "7.8.0",
48
46
  "react": "19.2.4",
49
47
  "react-dom": "19.2.4",
50
- "typescript": "5.9.3"
48
+ "typescript": "5.9.3",
49
+ "vitest": "4.1.10"
51
50
  },
52
51
  "peerDependencies": {
53
52
  "@emotion/react": "^11.14.0",
@@ -1,3 +0,0 @@
1
- import { EdgeProps } from "@xyflow/react";
2
- import { FC } from "react";
3
- export declare const PlasmaEdge: FC<EdgeProps>;