@cognizant-ai-lab/ui-common 1.12.0 → 1.13.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 (61) hide show
  1. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +9 -3
  2. package/dist/components/AgentChat/ChatCommon/Const.js +1 -1
  3. package/dist/components/AgentChat/ChatCommon/SlyDataDialog.js +6 -2
  4. package/dist/components/Common/Snackbar.js +12 -12
  5. package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +12 -5
  6. package/dist/components/MultiAgentAccelerator/Editor/Const.d.ts +2 -0
  7. package/dist/components/MultiAgentAccelerator/Editor/Const.js +5 -0
  8. package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.d.ts +0 -1
  9. package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.js +3 -5
  10. package/dist/components/MultiAgentAccelerator/PanelSeparator.js +2 -2
  11. package/dist/components/MultiAgentAccelerator/Publish/Publish.d.ts +36 -0
  12. package/dist/components/MultiAgentAccelerator/Publish/Publish.js +99 -0
  13. package/dist/components/MultiAgentAccelerator/Publish/PublishButton.d.ts +16 -0
  14. package/dist/components/MultiAgentAccelerator/Publish/PublishButton.js +98 -0
  15. package/dist/components/MultiAgentAccelerator/Publish/PublishConfirmation.d.ts +15 -0
  16. package/dist/components/MultiAgentAccelerator/Publish/PublishConfirmation.js +8 -0
  17. package/dist/components/MultiAgentAccelerator/Publish/PublishIconButton.d.ts +17 -0
  18. package/dist/components/MultiAgentAccelerator/Publish/PublishIconButton.js +72 -0
  19. package/dist/components/MultiAgentAccelerator/Publish/PublishPanel.d.ts +13 -0
  20. package/dist/components/MultiAgentAccelerator/Publish/PublishPanel.js +28 -0
  21. package/dist/components/MultiAgentAccelerator/Publish/PublishedNetworkUrl.d.ts +11 -0
  22. package/dist/components/MultiAgentAccelerator/Publish/PublishedNetworkUrl.js +64 -0
  23. package/dist/components/MultiAgentAccelerator/Publish/usePublishTarget.d.ts +6 -0
  24. package/dist/components/MultiAgentAccelerator/Publish/usePublishTarget.js +33 -0
  25. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +9 -2
  26. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +2 -0
  27. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +2 -0
  28. package/dist/components/Settings/ApiKeyInput.d.ts +1 -0
  29. package/dist/components/Settings/ApiKeyInput.js +8 -3
  30. package/dist/components/Settings/Byok/ByokDialog.d.ts +24 -0
  31. package/dist/components/Settings/Byok/ByokDialog.js +42 -0
  32. package/dist/components/Settings/Byok/ByokInputs.d.ts +38 -0
  33. package/dist/components/Settings/Byok/ByokInputs.js +35 -0
  34. package/dist/components/Settings/Byok/ByokStorageTooltip.d.ts +7 -0
  35. package/dist/components/Settings/Byok/ByokStorageTooltip.js +41 -0
  36. package/dist/components/Settings/Byok/ByokUnsavedChangesModal.d.ts +23 -0
  37. package/dist/components/Settings/Byok/ByokUnsavedChangesModal.js +19 -0
  38. package/dist/components/Settings/Byok/index.d.ts +5 -0
  39. package/dist/components/Settings/Byok/index.js +20 -0
  40. package/dist/components/Settings/Byok/useByokKeyManager.d.ts +59 -0
  41. package/dist/components/Settings/Byok/useByokKeyManager.js +135 -0
  42. package/dist/components/Settings/PublishSettings.d.ts +15 -0
  43. package/dist/components/Settings/PublishSettings.js +109 -0
  44. package/dist/components/Settings/SettingsDialog.js +17 -133
  45. package/dist/components/Settings/SettingsLayout.d.ts +13 -0
  46. package/dist/components/Settings/SettingsLayout.js +59 -0
  47. package/dist/controller/publish/Publish.d.ts +29 -0
  48. package/dist/controller/publish/Publish.js +94 -0
  49. package/dist/generated/neuro-san/NeuroSanClient.d.ts +9 -0
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.js +1 -0
  52. package/dist/state/Environment.d.ts +4 -0
  53. package/dist/state/Environment.js +4 -0
  54. package/dist/state/Publish.d.ts +39 -0
  55. package/dist/state/Publish.js +41 -0
  56. package/dist/state/Settings.d.ts +18 -0
  57. package/dist/state/Settings.js +4 -0
  58. package/dist/tsconfig.build.tsbuildinfo +1 -1
  59. package/dist/utils/Url.d.ts +12 -0
  60. package/dist/utils/Url.js +32 -0
  61. package/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ import { TestConnectionResult } from "../agent/Agent.js";
2
+ export interface PublishedNetwork {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly url: string;
6
+ }
7
+ interface PublishNetworkRequest {
8
+ readonly serverUrl: string;
9
+ readonly orgName: string;
10
+ readonly networkName: string;
11
+ readonly hocon: string;
12
+ }
13
+ /**
14
+ * Checks that a publish server is up.
15
+ */
16
+ export declare const checkHealth: (serverUrl: string) => Promise<TestConnectionResult>;
17
+ /**
18
+ * Lists the org's live networks.
19
+ */
20
+ export declare const listPublishedNetworks: (serverUrl: string, orgName: string) => Promise<PublishedNetwork[]>;
21
+ /**
22
+ * Uploads the HOCON and waits until the network is live.
23
+ */
24
+ export declare const publishNetwork: ({ serverUrl, orgName, networkName, hocon, }: PublishNetworkRequest) => Promise<PublishedNetwork>;
25
+ /**
26
+ * Takes a published network offline.
27
+ */
28
+ export declare const unpublishNetwork: (serverUrl: string, publishId: string) => Promise<void>;
29
+ export {};
@@ -0,0 +1,94 @@
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
+ * Client for the publish server. Requests go through our `/api/publish` route because the server doesn't allow
18
+ * requests from browsers.
19
+ */
20
+ import httpStatus from "http-status";
21
+ import { testConnection } from "../agent/Agent.js";
22
+ //#endregion Types
23
+ //#region Constants
24
+ // How long each /wait request holds open waiting for the build to finish
25
+ const WAIT_TIMEOUT_SECONDS = 60;
26
+ //#endregion Constants
27
+ const publishRouteUrl = (serverUrl, path, query = {}) => `/api/publish/${path}?${new URLSearchParams({ server: serverUrl, ...query })}`;
28
+ /**
29
+ * Throws with the server's explanation if the response isn't OK.
30
+ * @param action What we were doing, for the error message
31
+ */
32
+ const throwIfNotOk = async (response, action) => {
33
+ if (response.ok)
34
+ return;
35
+ let reason = response.statusText;
36
+ try {
37
+ // The server is FastAPI, which explains errors in `detail`
38
+ const { detail } = await response.json();
39
+ reason = typeof detail === "string" ? detail : JSON.stringify(detail);
40
+ }
41
+ catch {
42
+ // Not JSON, so keep the status text
43
+ }
44
+ throw new Error(`${action} failed (${response.status}): ${reason}`);
45
+ };
46
+ /**
47
+ * Checks that a publish server is up.
48
+ */
49
+ export const checkHealth = (serverUrl) => testConnection(publishRouteUrl(serverUrl, "health"));
50
+ /**
51
+ * Lists the org's live networks.
52
+ */
53
+ export const listPublishedNetworks = async (serverUrl, orgName) => {
54
+ const response = await fetch(publishRouteUrl(serverUrl, "deployments"));
55
+ await throwIfNotOk(response, "Listing published networks");
56
+ const { deployments: networks } = await response.json();
57
+ return networks.flatMap((network) => network.org_name === orgName && network.status === "ready" && network.url
58
+ ? [{ id: network.id, name: network.name, url: network.url }]
59
+ : []);
60
+ };
61
+ /**
62
+ * Uploads the HOCON and waits until the network is live.
63
+ */
64
+ export const publishNetwork = async ({ serverUrl, orgName, networkName, hocon, }) => {
65
+ const form = new FormData();
66
+ form.append("file", new Blob([hocon], { type: "text/plain" }), `${networkName}.hocon`);
67
+ form.append("name", networkName);
68
+ form.append("org_name", orgName);
69
+ // Without theme the server makes a plain page. theme_refresh=false keeps a theme it already made for this network.
70
+ form.append("theme", "true");
71
+ form.append("theme_refresh", "false");
72
+ const createResponse = await fetch(publishRouteUrl(serverUrl, "deployments"), { method: "POST", body: form });
73
+ await throwIfNotOk(createResponse, "Publishing");
74
+ let network = await createResponse.json();
75
+ while (network.status === "queued" || network.status === "building") {
76
+ const waitResponse = await fetch(publishRouteUrl(serverUrl, `deployments/${network.id}/wait`, { timeout: String(WAIT_TIMEOUT_SECONDS) }));
77
+ // A timeout means it's still building, so ask again
78
+ if (waitResponse.status !== httpStatus.GATEWAY_TIMEOUT) {
79
+ await throwIfNotOk(waitResponse, "Waiting for it to go live");
80
+ network = await waitResponse.json();
81
+ }
82
+ }
83
+ if (network.status !== "ready" || !network.url) {
84
+ throw new Error(network.error || `Publishing ended as ${network.status}`);
85
+ }
86
+ return { id: network.id, name: network.name, url: network.url };
87
+ };
88
+ /**
89
+ * Takes a published network offline.
90
+ */
91
+ export const unpublishNetwork = async (serverUrl, publishId) => {
92
+ const response = await fetch(publishRouteUrl(serverUrl, `deployments/${publishId}`), { method: "DELETE" });
93
+ await throwIfNotOk(response, "Unpublishing");
94
+ };
@@ -151,6 +151,7 @@ export interface components {
151
151
  readonly tool_result_origin?: readonly components["schemas"]["Origin"][];
152
152
  /** @description This is an entirely optional map whose keys refer to data that is better left out of the LLM chat stream. The keys themselves might appear in the chat stream, referring to the data, but the data itself does not. The intent is for the key references to be passed to tools, which then grab the values by programmatic means, but these tools might also have private data to send back to the client as well. */
153
153
  readonly sly_data?: Record<string, unknown>;
154
+ readonly content_blocks?: components["schemas"]["ContentBlocks"];
154
155
  };
155
156
  /** @description Request structure for Chat gRPC method */
156
157
  readonly ChatRequest: {
@@ -187,6 +188,13 @@ export interface components {
187
188
  /** @description Metadata for the network as a whole. This comes as a free-form dictionary which can have agent-network defined semantics. Some key/value pairs might eventually become standardized as part of the neuro-san API as time goes on, for instance for network-level Responsible AI (RAI) scores. As those keys become standardized, they will be added here in the docs. */
188
189
  readonly metadata?: Record<string, unknown>;
189
190
  };
191
+ /** @description Optional structured content of a ChatMessage, tagged with the schema its blocks follow so the format can evolve without breaking clients. */
192
+ readonly ContentBlocks: {
193
+ /** @description Identifies the schema of the blocks, for example "langchain_v1". Clients that do not recognize a format should ignore the blocks and fall back to the text field of the ChatMessage. The server does the same: a message with blocks but no format is treated as an unknown format, its blocks are ignored and only the text is used. */
194
+ readonly format?: string;
195
+ /** @description The blocks themselves: text, reasoning or thinking summaries, images, audio, files and provider-specific extras such as signatures. */
196
+ readonly blocks?: readonly Record<string, unknown>[];
197
+ };
190
198
  /** @description Description of an agent's function */
191
199
  readonly Function: {
192
200
  /** @description Outward-facing description of what the agent does. */
@@ -257,6 +265,7 @@ export type ChatResponse = components['schemas']['ChatResponse'];
257
265
  export type ConciergeResponse = components['schemas']['ConciergeResponse'];
258
266
  export type ConnectivityInfo = components['schemas']['ConnectivityInfo'];
259
267
  export type ConnectivityResponse = components['schemas']['ConnectivityResponse'];
268
+ export type ContentBlocks = components['schemas']['ContentBlocks'];
260
269
  export type Function = components['schemas']['Function'];
261
270
  export type FunctionResponse = components['schemas']['FunctionResponse'];
262
271
  export type GoogleProtobufAny = components['schemas']['GoogleProtobufAny'];
package/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export * from "./components/MultiAgentAccelerator/AgentFlow/AgentFlow.js";
27
27
  export * from "./components/MultiAgentAccelerator/MultiAgentAccelerator.js";
28
28
  export * from "./components/MultiAgentAccelerator/Sidebar/Sidebar.js";
29
29
  export * from "./components/MultiAgentAccelerator/TemporaryNetworks.js";
30
+ export * from "./components/Settings/Byok/ByokDialog.js";
30
31
  export * from "./controller/agent/Agent.js";
31
32
  export * from "./controller/llm/LlmChat.js";
32
33
  export * from "./generated/neuro-san/NeuroSanClient.js";
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ export * from "./components/MultiAgentAccelerator/AgentFlow/AgentFlow.js";
42
42
  export * from "./components/MultiAgentAccelerator/MultiAgentAccelerator.js";
43
43
  export * from "./components/MultiAgentAccelerator/Sidebar/Sidebar.js";
44
44
  export * from "./components/MultiAgentAccelerator/TemporaryNetworks.js";
45
+ export * from "./components/Settings/Byok/ByokDialog.js";
45
46
  export * from "./controller/agent/Agent.js";
46
47
  export * from "./controller/llm/LlmChat.js";
47
48
  export * from "./generated/neuro-san/NeuroSanClient.js";
@@ -14,6 +14,10 @@ interface EnvironmentStore {
14
14
  setSupportEmailAddress: (supportEmailAddress: string) => void;
15
15
  logoServiceToken: string;
16
16
  setLogoServiceToken: (logoServiceToken: string) => void;
17
+ enablePublishing: boolean | undefined;
18
+ setEnablePublishing: (enablePublishing: boolean) => void;
19
+ publishServerUrl: string | null;
20
+ setPublishServerUrl: (publishServerUrl: string) => void;
17
21
  }
18
22
  /**
19
23
  * The hook that lets apps use the store
@@ -34,4 +34,8 @@ export const useEnvironmentStore = create((set) => ({
34
34
  setSupportEmailAddress: (supportEmailAddress) => set(() => ({ supportEmailAddress })),
35
35
  logoServiceToken: null,
36
36
  setLogoServiceToken: (logoServiceToken) => set(() => ({ logoServiceToken })),
37
+ enablePublishing: undefined,
38
+ setEnablePublishing: (enablePublishing) => set(() => ({ enablePublishing })),
39
+ publishServerUrl: null,
40
+ setPublishServerUrl: (publishServerUrl) => set(() => ({ publishServerUrl })),
37
41
  }));
@@ -0,0 +1,39 @@
1
+ import { PublishedNetwork } from "../controller/publish/Publish.js";
2
+ export declare enum PublishStatus {
3
+ Publishing = "Publishing",
4
+ Published = "Published"
5
+ }
6
+ interface Publishing {
7
+ readonly status: PublishStatus.Publishing;
8
+ }
9
+ export interface Published {
10
+ readonly status: PublishStatus.Published;
11
+ /** The publish server it's published on, so it's unpublished from the same one */
12
+ readonly serverUrl: string;
13
+ /** The server's id for it, needed to unpublish */
14
+ readonly publishId: string;
15
+ readonly url: string;
16
+ }
17
+ export type PublishState = Publishing | Published;
18
+ /** The org's published networks on a server, as one request every network can share */
19
+ interface PublishedList {
20
+ /** Which server and org the list is for */
21
+ readonly key: string;
22
+ readonly request: Promise<PublishedNetwork[]>;
23
+ }
24
+ /**
25
+ * Zustand state store for networks that are publishing or live, keyed by network id. Kept in memory only.
26
+ */
27
+ interface PublishStore {
28
+ readonly networks: Readonly<Record<string, PublishState>>;
29
+ readonly setPublishState: (networkId: string, publishState: PublishState) => void;
30
+ readonly clearPublishState: (networkId: string) => void;
31
+ readonly publishedList: PublishedList | null;
32
+ readonly setPublishedList: (publishedList: PublishedList | null) => void;
33
+ }
34
+ export declare const usePublishStore: import("zustand").UseBoundStore<import("zustand").StoreApi<PublishStore>>;
35
+ /**
36
+ * The publish server to use: the one set in Settings, otherwise the default from the environment.
37
+ */
38
+ export declare const usePublishServerUrl: () => string | null;
39
+ export {};
@@ -0,0 +1,41 @@
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 { create } from "zustand";
17
+ import { useEnvironmentStore } from "./Environment.js";
18
+ import { useSettingsStore } from "./Settings.js";
19
+ export var PublishStatus;
20
+ (function (PublishStatus) {
21
+ PublishStatus["Publishing"] = "Publishing";
22
+ PublishStatus["Published"] = "Published";
23
+ })(PublishStatus || (PublishStatus = {}));
24
+ export const usePublishStore = create()((set) => ({
25
+ networks: {},
26
+ publishedList: null,
27
+ setPublishedList: (publishedList) => set({ publishedList }),
28
+ setPublishState: (networkId, publishState) => set(({ networks }) => ({ networks: { ...networks, [networkId]: publishState } })),
29
+ clearPublishState: (networkId) => set(({ networks }) => {
30
+ const { [networkId]: _removed, ...rest } = networks;
31
+ return { networks: rest };
32
+ }),
33
+ }));
34
+ /**
35
+ * The publish server to use: the one set in Settings, otherwise the default from the environment.
36
+ */
37
+ export const usePublishServerUrl = () => {
38
+ const settingsServerUrl = useSettingsStore((state) => state.settings.publish.serverUrl);
39
+ const defaultServerUrl = useEnvironmentStore((state) => state.publishServerUrl);
40
+ return settingsServerUrl ?? defaultServerUrl;
41
+ };
@@ -52,6 +52,12 @@ interface Settings {
52
52
  readonly externalServices: {
53
53
  neuroSanUrl: string | null;
54
54
  };
55
+ readonly publish: {
56
+ /** Publish server that networks are published to. Overrides the default from the environment when set. */
57
+ readonly serverUrl: string | null;
58
+ /** Sent as org_name with every publish. Required to publish. */
59
+ readonly orgName: string | null;
60
+ };
55
61
  }
56
62
  /**
57
63
  * Zustand state store for user preferences/Settings
@@ -114,6 +120,12 @@ export declare const useSettingsStore: import("zustand").UseBoundStore<Omit<impo
114
120
  externalServices: {
115
121
  neuroSanUrl: string | null;
116
122
  };
123
+ publish: {
124
+ /** Publish server that networks are published to. Overrides the default from the environment when set. */
125
+ readonly serverUrl: string | null;
126
+ /** Sent as org_name with every publish. Required to publish. */
127
+ readonly orgName: string | null;
128
+ };
117
129
  };
118
130
  updateSettings: (updates: DeepPartial<Settings>) => void;
119
131
  resetSettings: () => void;
@@ -152,6 +164,12 @@ export declare const useSettingsStore: import("zustand").UseBoundStore<Omit<impo
152
164
  externalServices: {
153
165
  neuroSanUrl: string | null;
154
166
  };
167
+ publish: {
168
+ /** Publish server that networks are published to. Overrides the default from the environment when set. */
169
+ readonly serverUrl: string | null;
170
+ /** Sent as org_name with every publish. Required to publish. */
171
+ readonly orgName: string | null;
172
+ };
155
173
  };
156
174
  updateSettings: (updates: DeepPartial<Settings>) => void;
157
175
  resetSettings: () => void;
@@ -57,6 +57,10 @@ export const DEFAULT_SETTINGS = {
57
57
  externalServices: {
58
58
  neuroSanUrl: null,
59
59
  },
60
+ publish: {
61
+ serverUrl: null,
62
+ orgName: null,
63
+ },
60
64
  };
61
65
  // Name for key where main app settings are saved
62
66
  export const APP_SETTINGS_STORAGE_KEY = "app-settings";