@cognizant-ai-lab/ui-common 1.14.0 → 1.15.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.
- package/dist/Theme/Palettes.d.ts +1 -0
- package/dist/Theme/Palettes.js +13 -0
- package/dist/Theme/sheen.d.ts +172 -0
- package/dist/Theme/sheen.js +219 -0
- package/dist/components/AgentChat/ChatCommon/ChatCommon.js +111 -32
- package/dist/components/AgentChat/ChatCommon/ChatHistory.js +4 -3
- package/dist/components/AgentChat/ChatCommon/ControlButtons.js +27 -1
- package/dist/components/AgentChat/ChatCommon/Conversation.d.ts +2 -0
- package/dist/components/AgentChat/ChatCommon/Conversation.js +174 -18
- package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.d.ts +12 -1
- package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.js +20 -9
- package/dist/components/AgentChat/ChatCommon/SampleQueries.d.ts +1 -1
- package/dist/components/AgentChat/ChatCommon/SampleQueries.js +74 -17
- package/dist/components/AgentChat/ChatCommon/SendButton.js +32 -1
- package/dist/components/AgentChat/ChatCommon/SyntaxHighlighterThemes.d.ts +6 -0
- package/dist/components/AgentChat/ChatCommon/SyntaxHighlighterThemes.js +4 -1
- package/dist/components/AgentChat/Common/LlmChatButton.js +4 -2
- package/dist/components/AgentChat/VoiceChat/MicrophoneButton.js +5 -0
- package/dist/components/ChatBot/ChatBot.js +79 -25
- package/dist/components/CommandPalette/CommandPalette.d.ts +21 -0
- package/dist/components/CommandPalette/CommandPalette.js +411 -0
- package/dist/components/Common/ConfirmationModal.d.ts +2 -0
- package/dist/components/Common/ConfirmationModal.js +2 -2
- package/dist/components/Common/Footer.d.ts +2 -2
- package/dist/components/Common/Footer.js +86 -32
- package/dist/components/Common/LoadingSpinner.d.ts +2 -1
- package/dist/components/Common/LoadingSpinner.js +24 -3
- package/dist/components/Common/MUIDialog.js +1 -1
- package/dist/components/Common/Navbar.d.ts +4 -1
- package/dist/components/Common/Navbar.js +235 -43
- package/dist/components/Common/Snackbar.d.ts +1 -1
- package/dist/components/Common/Snackbar.js +81 -48
- package/dist/components/Common/Spotlight.d.ts +31 -0
- package/dist/components/Common/Spotlight.js +76 -0
- package/dist/components/ErrorPage/ErrorPage.js +1 -1
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.d.ts +14 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +169 -96
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentNode.js +100 -23
- package/dist/components/MultiAgentAccelerator/AgentFlow/NetworkHud.d.ts +19 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow/NetworkHud.js +128 -0
- package/dist/components/MultiAgentAccelerator/Editor/Const.d.ts +2 -1
- package/dist/components/MultiAgentAccelerator/Editor/Const.js +4 -2
- package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.js +62 -33
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +2 -0
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +279 -72
- package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.js +38 -22
- package/dist/components/MultiAgentAccelerator/PanelSeparator.d.ts +7 -1
- package/dist/components/MultiAgentAccelerator/PanelSeparator.js +44 -36
- package/dist/components/MultiAgentAccelerator/Publish/Publish.d.ts +30 -10
- package/dist/components/MultiAgentAccelerator/Publish/Publish.js +137 -42
- package/dist/components/MultiAgentAccelerator/Publish/PublishButton.d.ts +5 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishButton.js +45 -19
- package/dist/components/MultiAgentAccelerator/Publish/PublishConfirmation.d.ts +8 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishConfirmation.js +31 -4
- package/dist/components/MultiAgentAccelerator/Publish/PublishIconButton.d.ts +4 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishIconButton.js +17 -16
- package/dist/components/MultiAgentAccelerator/Publish/PublishPanel.d.ts +4 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishPanel.js +32 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishedNetworkUrl.js +3 -2
- package/dist/components/MultiAgentAccelerator/Publish/usePublishTarget.d.ts +2 -2
- package/dist/components/MultiAgentAccelerator/Publish/usePublishTarget.js +14 -7
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +81 -53
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +40 -20
- package/dist/components/MultiAgentAccelerator/ThoughtBubbles/ThoughtBubbleOverlay.d.ts +4 -0
- package/dist/components/MultiAgentAccelerator/ThoughtBubbles/ThoughtBubbleOverlay.js +49 -28
- package/dist/components/MultiAgentAccelerator/Workspace/FloatingPanel.d.ts +21 -0
- package/dist/components/MultiAgentAccelerator/Workspace/FloatingPanel.js +57 -0
- package/dist/components/Settings/ApiKeyErrorBanner.d.ts +1 -0
- package/dist/components/Settings/ApiKeyErrorBanner.js +1 -1
- package/dist/components/Settings/ApiKeyInput.d.ts +2 -1
- package/dist/components/Settings/ApiKeyInput.js +31 -4
- package/dist/components/Settings/Byok/ByokInputs.d.ts +1 -1
- package/dist/components/Settings/Byok/ByokInputs.js +3 -1
- package/dist/components/Settings/Byok/ByokStorageTooltip.js +3 -2
- package/dist/components/Settings/Byok/ByokUnsavedChangesModal.d.ts +4 -0
- package/dist/components/Settings/Byok/ByokUnsavedChangesModal.js +3 -2
- package/dist/components/Settings/Byok/useByokKeyManager.d.ts +3 -2
- package/dist/components/Settings/Byok/useByokKeyManager.js +97 -27
- package/dist/components/Settings/FadingCheckmark.js +1 -1
- package/dist/components/Settings/PublishSettings.d.ts +4 -4
- package/dist/components/Settings/PublishSettings.js +33 -44
- package/dist/components/Settings/SettingsDialog.js +95 -41
- package/dist/components/Settings/SettingsLayout.d.ts +1 -3
- package/dist/components/Settings/SettingsLayout.js +41 -12
- package/dist/components/Settings/SettingsNav.d.ts +14 -0
- package/dist/components/Settings/SettingsNav.js +229 -0
- package/dist/components/Settings/SettingsRow.js +4 -1
- package/dist/controller/llm/Providers.d.ts +1 -0
- package/dist/controller/llm/Providers.js +4 -0
- package/dist/controller/publish/Publish.d.ts +34 -9
- package/dist/controller/publish/Publish.js +83 -23
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/state/Publish.d.ts +25 -11
- package/dist/state/Publish.js +38 -3
- package/dist/state/Settings.d.ts +5 -79
- package/dist/state/Settings.js +36 -6
- package/dist/state/TemporaryNetworks.d.ts +12 -1
- package/dist/state/TemporaryNetworks.js +15 -8
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } 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 HubOutlinedIcon from "@mui/icons-material/HubOutlined";
|
|
18
|
+
import Box from "@mui/material/Box";
|
|
19
|
+
import { useTheme } from "@mui/material/styles";
|
|
20
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
21
|
+
import Typography from "@mui/material/Typography";
|
|
22
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
23
|
+
import { getSheen, glassSurface, gradientBorder, SHEEN_EASE, SHEEN_FONT_DISPLAY, sheenGradient, spinningBorder, } from "../../../Theme/sheen.js";
|
|
24
|
+
import { getZIndex } from "../../../utils/zIndexLayers.js";
|
|
25
|
+
const STATUS_LABELS = {
|
|
26
|
+
idle: "Idle",
|
|
27
|
+
thinking: "Thinking",
|
|
28
|
+
streaming: "Streaming",
|
|
29
|
+
};
|
|
30
|
+
const PILL_RADIUS = 999;
|
|
31
|
+
/**
|
|
32
|
+
* Three dots that ripple through the sheen gradient while the network is working.
|
|
33
|
+
*/
|
|
34
|
+
const ThinkingDots = ({ id }) => {
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
const reduceMotion = useReducedMotion();
|
|
37
|
+
return (_jsx(Box, { "aria-hidden": true, id: id, sx: { alignItems: "center", display: "inline-flex", gap: "3px" }, children: [0, 1, 2].map((i) => (_jsx(motion.span, { animate: reduceMotion ? undefined : { opacity: [0.35, 1, 0.35], y: [0, -3, 0] }, style: {
|
|
38
|
+
backgroundImage: sheenGradient(theme),
|
|
39
|
+
backgroundSize: "300% 100%",
|
|
40
|
+
backgroundPosition: `${i * 50}% 50%`,
|
|
41
|
+
borderRadius: "50%",
|
|
42
|
+
display: "inline-block",
|
|
43
|
+
height: 6,
|
|
44
|
+
width: 6,
|
|
45
|
+
}, transition: { duration: 1.1, ease: "easeInOut", repeat: Infinity, delay: i * 0.16 } }, i))) }));
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Floating top-center "mission control" HUD over the agent canvas: the current network's name in the display font,
|
|
49
|
+
* its live status (idle / thinking / streaming) and how many agents it has. Edit / Publish actions sit beside it.
|
|
50
|
+
*/
|
|
51
|
+
export const NetworkHud = ({ agentCount, centerOffset, children, id, networkDisplayName, status: hudStatus, top: topPx, }) => {
|
|
52
|
+
const theme = useTheme();
|
|
53
|
+
const themeVars = theme.vars ?? theme;
|
|
54
|
+
const sheen = getSheen(theme);
|
|
55
|
+
const isBusy = hudStatus !== "idle";
|
|
56
|
+
return (_jsxs(Box, { id: `${id}-network-title-bar`, sx: {
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
display: "flex",
|
|
59
|
+
gap: 1,
|
|
60
|
+
left: `calc(50% + ${centerOffset}px)`,
|
|
61
|
+
maxWidth: "min(720px, 90%)",
|
|
62
|
+
pointerEvents: "none",
|
|
63
|
+
position: "absolute",
|
|
64
|
+
top: `${topPx}px`,
|
|
65
|
+
transform: "translateX(-50%)",
|
|
66
|
+
transition: `left 0.55s ${SHEEN_EASE}, top 0.55s ${SHEEN_EASE}`,
|
|
67
|
+
zIndex: getZIndex(2, theme),
|
|
68
|
+
}, children: [_jsxs(Box, { id: `${id}-hud`, role: "status", "aria-live": "polite", "aria-label": `${networkDisplayName}: ${STATUS_LABELS[hudStatus]}, ${agentCount} agents`, sx: {
|
|
69
|
+
...glassSurface(theme, PILL_RADIUS),
|
|
70
|
+
...(isBusy ? spinningBorder(theme, PILL_RADIUS, 1.5) : gradientBorder(theme, PILL_RADIUS, 1, 0.45)),
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
animation: `sheenRise 0.6s ${SHEEN_EASE} both`,
|
|
73
|
+
border: 0,
|
|
74
|
+
boxShadow: isBusy
|
|
75
|
+
? `inset 0 1px 0 ${sheen.highlight}, 0 0 36px -8px ${sheen.glow}`
|
|
76
|
+
: `inset 0 1px 0 ${sheen.highlight}, 0 18px 50px -18px rgba(0, 0, 0, 0.6)`,
|
|
77
|
+
display: "flex",
|
|
78
|
+
gap: 1.25,
|
|
79
|
+
minWidth: 0,
|
|
80
|
+
pointerEvents: "auto",
|
|
81
|
+
pl: 1.75,
|
|
82
|
+
pr: 1.25,
|
|
83
|
+
py: 0.6,
|
|
84
|
+
transition: `box-shadow 0.4s ${SHEEN_EASE}`,
|
|
85
|
+
}, children: [_jsx(Tooltip, { title: networkDisplayName, placement: "bottom", children: _jsx(Typography, { id: `${id}-network-title`, variant: "subtitle1", sx: {
|
|
86
|
+
color: themeVars.palette.text.primary,
|
|
87
|
+
fontFamily: SHEEN_FONT_DISPLAY,
|
|
88
|
+
fontSize: "1.15rem",
|
|
89
|
+
fontWeight: 500,
|
|
90
|
+
letterSpacing: "0.01em",
|
|
91
|
+
lineHeight: 1.3,
|
|
92
|
+
maxWidth: 360,
|
|
93
|
+
minWidth: 0,
|
|
94
|
+
overflow: "hidden",
|
|
95
|
+
textOverflow: "ellipsis",
|
|
96
|
+
whiteSpace: "nowrap",
|
|
97
|
+
}, children: networkDisplayName }) }), _jsx(Box, { "aria-hidden": true, sx: { alignSelf: "stretch", backgroundColor: sheen.glassBorder, my: 0.25, width: "1px" } }), _jsxs(Box, { id: `${id}-hud-agent-count`, sx: {
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
color: themeVars.palette.text.secondary,
|
|
100
|
+
display: "flex",
|
|
101
|
+
fontSize: "0.75rem",
|
|
102
|
+
fontVariantNumeric: "tabular-nums",
|
|
103
|
+
gap: 0.5,
|
|
104
|
+
whiteSpace: "nowrap",
|
|
105
|
+
}, children: [_jsx(HubOutlinedIcon, { sx: { fontSize: "0.95rem" } }), agentCount, " ", agentCount === 1 ? "agent" : "agents"] }), _jsxs(Box, { id: `${id}-hud-status`, "data-status": hudStatus, sx: {
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
backgroundColor: isBusy ? sheen.tint : "transparent",
|
|
108
|
+
borderRadius: `${PILL_RADIUS}px`,
|
|
109
|
+
color: isBusy ? themeVars.palette.text.primary : themeVars.palette.text.secondary,
|
|
110
|
+
display: "flex",
|
|
111
|
+
fontSize: "0.72rem",
|
|
112
|
+
fontWeight: 600,
|
|
113
|
+
gap: 0.75,
|
|
114
|
+
letterSpacing: "0.06em",
|
|
115
|
+
px: 1,
|
|
116
|
+
py: 0.35,
|
|
117
|
+
textTransform: "uppercase",
|
|
118
|
+
transition: `background-color 0.3s ${SHEEN_EASE}, color 0.3s ${SHEEN_EASE}`,
|
|
119
|
+
whiteSpace: "nowrap",
|
|
120
|
+
}, children: [_jsx(AnimatePresence, { initial: false, mode: "wait", children: isBusy ? (_jsx(motion.span, { animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.6 }, initial: { opacity: 0, scale: 0.6 }, style: { display: "inline-flex" }, children: _jsx(ThinkingDots, { id: `${id}-hud-dots` }) }, "busy")) : (_jsx(motion.span, { animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.6 }, initial: { opacity: 0, scale: 0.6 }, style: {
|
|
121
|
+
backgroundColor: themeVars.palette.success.main,
|
|
122
|
+
borderRadius: "50%",
|
|
123
|
+
boxShadow: `0 0 8px ${themeVars.palette.success.main}`,
|
|
124
|
+
display: "inline-block",
|
|
125
|
+
height: 7,
|
|
126
|
+
width: 7,
|
|
127
|
+
} }, "idle")) }), STATUS_LABELS[hudStatus]] })] }), children] }));
|
|
128
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
export const
|
|
1
|
+
// When to first ask whether the user wants to keep waiting for a network edit.
|
|
2
|
+
export const INITIAL_WAIT_REMINDER_MS = 3 * 60 * 1000;
|
|
3
|
+
// How often to ask again after the user chooses to continue waiting.
|
|
4
|
+
export const REPEATED_WAIT_REMINDER_MS = 60 * 1000;
|
|
3
5
|
// How long the dock's status banner stays visible before auto-dismissing. Error banners persist until dismissed.
|
|
4
6
|
// Exported for tests.
|
|
5
7
|
export const BANNER_AUTO_DISMISS_MS = 5_000;
|
|
@@ -13,13 +13,15 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
13
13
|
import { sendChatQuery } from "../../../controller/agent/Agent.js";
|
|
14
14
|
import { StreamingUnit } from "../../../controller/llm/LlmChat.js";
|
|
15
15
|
import { useAgentChatHistoryStore } from "../../../state/ChatHistory.js";
|
|
16
|
+
import { usePublishStore } from "../../../state/Publish.js";
|
|
16
17
|
import { useTempNetworksStore } from "../../../state/TemporaryNetworks.js";
|
|
18
|
+
import { getSheen, glassSurface, gradientBorder, sheenGradient } from "../../../Theme/sheen.js";
|
|
17
19
|
import { getZIndex } from "../../../utils/zIndexLayers.js";
|
|
18
20
|
import { chatMessageFromChunk } from "../../AgentChat/Common/Utils.js";
|
|
19
21
|
import { MUIAlert } from "../../Common/MUIAlert.js";
|
|
20
22
|
import { AGENT_NETWORK_DEFINITION_KEY, AGENT_NETWORK_DESIGNER_ID, AGENT_NETWORK_NAME_KEY, } from "../const.js";
|
|
21
23
|
import { convertReservationsToNetworks, extractNetworkHocon, extractReservations, mergeNetworks, } from "../TemporaryNetworks.js";
|
|
22
|
-
import { BANNER_AUTO_DISMISS_MS,
|
|
24
|
+
import { BANNER_AUTO_DISMISS_MS, INITIAL_WAIT_REMINDER_MS, REPEATED_WAIT_REMINDER_MS } from "./Const.js";
|
|
23
25
|
//#region Constants
|
|
24
26
|
const PROMPT_PLACEHOLDER = "Describe a change to the network";
|
|
25
27
|
//#endregion Interfaces and Types
|
|
@@ -29,15 +31,23 @@ const PROMPT_PLACEHOLDER = "Describe a change to the network";
|
|
|
29
31
|
*/
|
|
30
32
|
export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id, isEditingNetwork, networkId, setIsEditingNetwork, setSelectedNetwork, tempNetworks, }) => {
|
|
31
33
|
const theme = useTheme();
|
|
34
|
+
const themeVars = theme.vars ?? theme;
|
|
32
35
|
// Inline status banner shown above the dock header after an "apply" succeeds, is canceled, or fails.
|
|
33
36
|
const [banner, setBanner] = useState(null);
|
|
34
37
|
const bannerTimeoutRef = useRef(null);
|
|
35
38
|
// Dock (edit-mode prompt bar) state
|
|
36
39
|
const [dockPrompt, setDockPrompt] = useState("");
|
|
37
|
-
// "idle" = no apply in flight
|
|
40
|
+
// "idle" = no apply in flight; the other states describe the active apply overlay.
|
|
38
41
|
const [state, setState] = useState("idle");
|
|
39
42
|
const isPending = state !== "idle";
|
|
40
43
|
const abortControllerRef = useRef(null);
|
|
44
|
+
const waitReminderTimeoutRef = useRef(null);
|
|
45
|
+
const scheduleWaitReminder = useCallback((delay) => {
|
|
46
|
+
clearTimeout(waitReminderTimeoutRef.current);
|
|
47
|
+
waitReminderTimeoutRef.current = setTimeout(() => {
|
|
48
|
+
setState("confirmingWait");
|
|
49
|
+
}, delay);
|
|
50
|
+
}, []);
|
|
41
51
|
// Show a dock banner. Success/cancel banners auto-dismiss; error banners persist until dismissed.
|
|
42
52
|
const showBanner = useCallback((bannerInfo) => {
|
|
43
53
|
clearTimeout(bannerTimeoutRef.current);
|
|
@@ -47,16 +57,23 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
47
57
|
}
|
|
48
58
|
}, []);
|
|
49
59
|
const handleStopClick = useCallback(() => {
|
|
60
|
+
clearTimeout(waitReminderTimeoutRef.current);
|
|
50
61
|
setState("confirmingStop");
|
|
51
62
|
}, []);
|
|
52
63
|
const handleKeepApplying = useCallback(() => {
|
|
53
64
|
setState("applying");
|
|
54
|
-
|
|
65
|
+
scheduleWaitReminder(INITIAL_WAIT_REMINDER_MS);
|
|
66
|
+
}, [scheduleWaitReminder]);
|
|
67
|
+
const handleContinueWaiting = useCallback(() => {
|
|
68
|
+
setState("applying");
|
|
69
|
+
scheduleWaitReminder(REPEATED_WAIT_REMINDER_MS);
|
|
70
|
+
}, [scheduleWaitReminder]);
|
|
55
71
|
const handleDismissBanner = useCallback(() => {
|
|
56
72
|
clearTimeout(bannerTimeoutRef.current);
|
|
57
73
|
setBanner(null);
|
|
58
74
|
}, []);
|
|
59
75
|
const handleStopAndDiscard = useCallback(() => {
|
|
76
|
+
clearTimeout(waitReminderTimeoutRef.current);
|
|
60
77
|
abortControllerRef.current?.abort();
|
|
61
78
|
abortControllerRef.current = null;
|
|
62
79
|
setState("idle");
|
|
@@ -68,6 +85,7 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
68
85
|
}, [showBanner]);
|
|
69
86
|
const handleExitEditMode = useCallback(() => {
|
|
70
87
|
if (isPending) {
|
|
88
|
+
clearTimeout(waitReminderTimeoutRef.current);
|
|
71
89
|
abortControllerRef.current?.abort();
|
|
72
90
|
abortControllerRef.current = null;
|
|
73
91
|
setState("idle");
|
|
@@ -107,6 +125,9 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
107
125
|
useTempNetworksStore.getState().upsertTempNetworks(newNetworksFromSave);
|
|
108
126
|
if (networkId) {
|
|
109
127
|
useAgentChatHistoryStore.getState().copyHistory(networkId, replacement.agentInfo.agent_name);
|
|
128
|
+
// Move the publish state to the edited network, which has a new id. A publish that's still running
|
|
129
|
+
// finishes on the edited network.
|
|
130
|
+
usePublishStore.getState().replaceNetwork(networkId, replacement.agentInfo.agent_name);
|
|
110
131
|
setSelectedNetwork(replacement.agentInfo.agent_name);
|
|
111
132
|
}
|
|
112
133
|
return true;
|
|
@@ -159,11 +180,7 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
159
180
|
setState("applying");
|
|
160
181
|
const controller = new AbortController();
|
|
161
182
|
abortControllerRef.current = controller;
|
|
162
|
-
|
|
163
|
-
const timeoutId = setTimeout(() => {
|
|
164
|
-
hasTimedOut = true;
|
|
165
|
-
controller.abort();
|
|
166
|
-
}, STREAM_TIMEOUT_MS);
|
|
183
|
+
scheduleWaitReminder(INITIAL_WAIT_REMINDER_MS);
|
|
167
184
|
try {
|
|
168
185
|
const newNetworks = await applyNetworkDesignerChanges(controller.signal, dockPrompt, currentDefinition, currentTempNetwork?.agentNetworkName);
|
|
169
186
|
const appliedSuccess = saveUpdates(newNetworks, currentTempNetwork?.agentNetworkName);
|
|
@@ -178,21 +195,12 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
178
195
|
}
|
|
179
196
|
catch (e) {
|
|
180
197
|
const isAbort = e instanceof DOMException && e.name === "AbortError";
|
|
181
|
-
if (isAbort) {
|
|
182
|
-
if (hasTimedOut) {
|
|
183
|
-
showBanner({
|
|
184
|
-
severity: "error",
|
|
185
|
-
title: "Failed to apply network change.",
|
|
186
|
-
detail: "The request timed out. Please try again.",
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
198
|
+
if (!isAbort) {
|
|
191
199
|
showBanner({ severity: "error", title: "Failed to apply network change.", detail: String(e) });
|
|
192
200
|
}
|
|
193
201
|
}
|
|
194
202
|
finally {
|
|
195
|
-
clearTimeout(
|
|
203
|
+
clearTimeout(waitReminderTimeoutRef.current);
|
|
196
204
|
abortControllerRef.current = null;
|
|
197
205
|
setState("idle");
|
|
198
206
|
}
|
|
@@ -203,6 +211,7 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
203
211
|
networkId,
|
|
204
212
|
neuroSanURL,
|
|
205
213
|
saveUpdates,
|
|
214
|
+
scheduleWaitReminder,
|
|
206
215
|
showBanner,
|
|
207
216
|
tempNetworks,
|
|
208
217
|
]);
|
|
@@ -210,40 +219,50 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
210
219
|
useEffect(() => {
|
|
211
220
|
return () => {
|
|
212
221
|
clearTimeout(bannerTimeoutRef.current);
|
|
222
|
+
clearTimeout(waitReminderTimeoutRef.current);
|
|
213
223
|
abortControllerRef.current?.abort();
|
|
214
224
|
abortControllerRef.current = null;
|
|
215
225
|
};
|
|
216
226
|
}, []);
|
|
217
|
-
const getBackdrop = () => isPending && (_jsx(Backdrop, { id: "network-editor-dock-backdrop", open: isPending, sx: { zIndex: (t) => t.zIndex.modal + 1 }, children: state === "confirmingStop" ? (_jsxs(Paper, { elevation: 6, sx: {
|
|
227
|
+
const getBackdrop = () => isPending && (_jsx(Backdrop, { id: "network-editor-dock-backdrop", open: isPending, sx: { zIndex: (t) => t.zIndex.modal + 1 }, children: state === "confirmingStop" || state === "confirmingWait" ? (_jsxs(Paper, { elevation: 6, sx: {
|
|
228
|
+
...glassSurface(theme),
|
|
229
|
+
...gradientBorder(theme, undefined, 1, 0.5),
|
|
230
|
+
boxShadow: theme.shadows[6],
|
|
218
231
|
display: "flex",
|
|
219
232
|
flexDirection: "column",
|
|
220
233
|
gap: 2,
|
|
221
234
|
px: 4,
|
|
222
235
|
py: 3,
|
|
223
|
-
borderRadius: 2,
|
|
224
236
|
maxWidth: 420,
|
|
225
|
-
}, children: [_jsx(Typography, { variant: "body1", sx: { fontWeight: "bold" }, children:
|
|
237
|
+
}, children: [_jsx(Typography, { variant: "body1", sx: { fontWeight: "bold" }, children: state === "confirmingWait"
|
|
238
|
+
? "This operation is taking longer than expected."
|
|
239
|
+
: "Abort changes?" }), _jsx(Typography, { variant: "body2", color: "text.secondary", children: state === "confirmingWait"
|
|
240
|
+
? "Would you like to continue waiting or cancel?"
|
|
241
|
+
: "The in-progress update will be cancelled and discarded. Your network will not be " +
|
|
242
|
+
"modified." }), _jsxs(Box, { sx: {
|
|
226
243
|
display: "flex",
|
|
227
244
|
gap: 1.5,
|
|
228
245
|
justifyContent: "flex-end",
|
|
229
|
-
}, children: [_jsx(Button, { variant: "outlined", onClick: handleKeepApplying, children: "Keep applying" }), _jsx(Button, { variant: "contained", color: "error", startIcon: _jsx("span", { style: { fontSize: "0.7rem" }, children: "\u25A0" }), onClick: handleStopAndDiscard, children: "Stop & discard" })] })] })) : (_jsxs(Paper, { elevation: 6, sx: {
|
|
246
|
+
}, children: [state === "confirmingWait" ? (_jsx(Button, { variant: "outlined", onClick: handleStopAndDiscard, children: "Cancel" })) : (_jsx(Button, { variant: "outlined", onClick: handleKeepApplying, children: "Keep applying" })), _jsx(Button, { variant: "contained", color: state === "confirmingWait" ? "primary" : "error", startIcon: state === "confirmingWait" ? undefined : (_jsx("span", { style: { fontSize: "0.7rem" }, children: "\u25A0" })), onClick: state === "confirmingWait" ? handleContinueWaiting : handleStopAndDiscard, children: state === "confirmingWait" ? "Continue waiting" : "Stop & discard" })] })] })) : (_jsxs(Paper, { elevation: 6, sx: {
|
|
247
|
+
...glassSurface(theme),
|
|
248
|
+
...gradientBorder(theme, undefined, 1, 0.5),
|
|
249
|
+
boxShadow: theme.shadows[6],
|
|
230
250
|
display: "flex",
|
|
231
251
|
alignItems: "center",
|
|
232
252
|
gap: 2,
|
|
233
253
|
px: 4,
|
|
234
254
|
py: 2.5,
|
|
235
|
-
borderRadius: 2,
|
|
236
255
|
maxWidth: 480,
|
|
237
256
|
width: "calc(100% - 32px)",
|
|
238
257
|
}, children: [_jsx(CircularProgress, { size: 24 }), _jsxs(Box, { sx: { flex: 1, minWidth: 0 }, children: [_jsx(Typography, { variant: "body1", sx: { fontWeight: "bold" }, children: "Applying changes to network" }), dockPrompt && (_jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mt: 0.25, overflowWrap: "anywhere" }, children: dockPrompt }))] }), _jsx(Button, { variant: "outlined", size: "small", startIcon: _jsx("span", { style: { fontSize: "0.65rem" }, children: "\u25A0" }), onClick: handleStopClick, sx: {
|
|
239
258
|
whiteSpace: "nowrap",
|
|
240
259
|
flexShrink: 0,
|
|
241
|
-
color:
|
|
242
|
-
borderColor:
|
|
260
|
+
color: themeVars.palette.text.primary,
|
|
261
|
+
borderColor: themeVars.palette.text.secondary,
|
|
243
262
|
fontWeight: "bold",
|
|
244
263
|
"&:hover": {
|
|
245
|
-
borderColor:
|
|
246
|
-
color:
|
|
264
|
+
borderColor: themeVars.palette.error.main,
|
|
265
|
+
color: themeVars.palette.error.main,
|
|
247
266
|
backgroundColor: alpha(theme.palette.error.main, 0.08),
|
|
248
267
|
},
|
|
249
268
|
}, children: "Stop" })] })) }));
|
|
@@ -266,15 +285,25 @@ export const NetworkEditorDock = ({ neuroSanURL, currentUser, extraSlyData, id,
|
|
|
266
285
|
},
|
|
267
286
|
}, children: _jsxs(Typography, { variant: "caption", component: "span", children: [_jsx("strong", { children: banner.title }), ` ${banner.detail}`] }) }));
|
|
268
287
|
const getEditDock = () => isEditingNetwork && (_jsxs(Box, { sx: {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
borderTop: `2px solid ${theme.palette.primary.main}`,
|
|
288
|
+
...glassSurface(theme, 0),
|
|
289
|
+
borderWidth: 0,
|
|
272
290
|
flexShrink: 0,
|
|
273
291
|
position: "relative",
|
|
274
292
|
zIndex: getZIndex(2, theme),
|
|
293
|
+
// Glowing iridescent rule along the top edge marks the dock as "live" edit mode
|
|
294
|
+
"&::before": {
|
|
295
|
+
background: sheenGradient(theme, 90),
|
|
296
|
+
boxShadow: `0 0 16px 1px ${getSheen(theme).glow}`,
|
|
297
|
+
content: '""',
|
|
298
|
+
height: "2px",
|
|
299
|
+
left: 0,
|
|
300
|
+
pointerEvents: "none",
|
|
301
|
+
position: "absolute",
|
|
302
|
+
right: 0,
|
|
303
|
+
top: 0,
|
|
304
|
+
},
|
|
275
305
|
}, children: [banner && getBanner(), _jsxs(Box, { sx: {
|
|
276
|
-
|
|
277
|
-
borderBottom: "1px solid divider",
|
|
306
|
+
borderBottom: `1px solid ${getSheen(theme).glassBorder}`,
|
|
278
307
|
display: "flex",
|
|
279
308
|
alignItems: "center",
|
|
280
309
|
justifyContent: "space-between",
|
|
@@ -2,6 +2,8 @@ import { FC } from "react";
|
|
|
2
2
|
export interface MultiAgentAcceleratorProps {
|
|
3
3
|
readonly username: string;
|
|
4
4
|
readonly defaultNeuroSanUrl: string;
|
|
5
|
+
/** Start the tour as soon as the networks have loaded (e.g. "Take a tour" clicked on another page) */
|
|
6
|
+
readonly startTour?: boolean;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Main Multi-Agent Accelerator component that contains the sidebar, agent flow, and chat components.
|