@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
|
@@ -25,17 +25,18 @@ import { alpha, useTheme } from "@mui/material/styles";
|
|
|
25
25
|
import ToggleButton from "@mui/material/ToggleButton";
|
|
26
26
|
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
27
27
|
import Tooltip from "@mui/material/Tooltip";
|
|
28
|
-
import
|
|
29
|
-
import { applyNodeChanges, Background, ConnectionMode, ControlButton, Controls, ReactFlow, useReactFlow, useStore, } from "@xyflow/react";
|
|
28
|
+
import { applyNodeChanges, Background, BackgroundVariant, ConnectionMode, ControlButton, Controls, ReactFlow, useReactFlow, useStore, } from "@xyflow/react";
|
|
30
29
|
import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
31
30
|
import { AgentNode, NODE_HEIGHT, NODE_WIDTH } from "./AgentNode.js";
|
|
32
31
|
import { BASE_RADIUS, DEFAULT_FRONTMAN_X_POS, DEFAULT_FRONTMAN_Y_POS, LEVEL_SPACING, } from "../const.js";
|
|
33
32
|
import { addThoughtBubbleEdge, layoutLinear, layoutRadial } from "./GraphLayouts.js";
|
|
33
|
+
import { NetworkHud } from "./NetworkHud.js";
|
|
34
34
|
import { PlasmaEdge } from "./PlasmaEdge.js";
|
|
35
35
|
import { useEnvironmentStore } from "../../../state/Environment.js";
|
|
36
36
|
import { usePublishServerUrl } from "../../../state/Publish.js";
|
|
37
37
|
import { usePalette, useSettingsStore } from "../../../state/Settings.js";
|
|
38
38
|
import { useTempNetworksStore } from "../../../state/TemporaryNetworks.js";
|
|
39
|
+
import { auroraBackground, getSheen, glassSurface, gradientBorder, GRAIN_TEXTURE, SHEEN_EASE, SHEEN_RADIUS_SURFACE, } from "../../../Theme/sheen.js";
|
|
39
40
|
import { getZIndex } from "../../../utils/zIndexLayers.js";
|
|
40
41
|
import { AgentNodeEditor } from "../Editor/AgentNodeEditor.js";
|
|
41
42
|
import { NetworkEditorDock } from "../Editor/NetworkEditorDock.js";
|
|
@@ -46,6 +47,16 @@ import { ThoughtBubbleOverlay } from "../ThoughtBubbles/ThoughtBubbleOverlay.js"
|
|
|
46
47
|
//#endregion: Types
|
|
47
48
|
//#region: Constants
|
|
48
49
|
const THOUGHT_BUBBLE_TIMEOUT_MS = 10_000;
|
|
50
|
+
const NO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
51
|
+
// Gap between the safe-area edge and the floating HUD / toolbar (px)
|
|
52
|
+
const FLOATING_GAP = 12;
|
|
53
|
+
// Extra room reserved above and below the graph for the HUD and toolbar when fitting the view (px)
|
|
54
|
+
const HUD_CLEARANCE = 64;
|
|
55
|
+
const TOOLBAR_CLEARANCE = 72;
|
|
56
|
+
// Duration of animated fit-view transitions (ms)
|
|
57
|
+
const FIT_VIEW_DURATION_MS = 550;
|
|
58
|
+
// Specular highlight for the legend's color dots (same glossy look as the agent nodes)
|
|
59
|
+
const LEGEND_DOT_SPECULAR = "radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 55%)";
|
|
49
60
|
//#endregion: Constants
|
|
50
61
|
//#region: Helpers
|
|
51
62
|
/**
|
|
@@ -64,21 +75,38 @@ export const filterNodeEvents = (change, isAgentNetworkDesignerMode) => {
|
|
|
64
75
|
return !(change.type === "position" && isAgentNetworkDesignerMode);
|
|
65
76
|
};
|
|
66
77
|
//#endregion: Helpers
|
|
67
|
-
export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork, currentConversations, currentUser, extraSlyData, id, isAgentNetworkDesignerMode, isAwaitingLlm, isEditingNetwork, isStreaming, isTemporaryNetwork, networkDisplayName, networkId, neuroSanURL, onSaveAgent, thoughtBubbleEdges, setIsEditingNetwork, setSelectedNetwork, setThoughtBubbleEdges, }) => {
|
|
78
|
+
export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork, currentConversations, currentUser, extraSlyData, id, isAgentNetworkDesignerMode, isAwaitingLlm, isEditingNetwork, isStreaming, isTemporaryNetwork, networkDisplayName, networkId, neuroSanURL, onSaveAgent, safeArea = NO_INSETS, thoughtBubbleEdges, setIsEditingNetwork, setSelectedNetwork, setThoughtBubbleEdges, }) => {
|
|
68
79
|
const theme = useTheme();
|
|
80
|
+
// CSS-variable references when available, so colors follow the active color scheme
|
|
81
|
+
const themeVars = theme.vars ?? theme;
|
|
82
|
+
// Default (non-plasma) edges: the accent color at reduced strength, so active plasma edges stand out
|
|
83
|
+
const edgeColor = `color-mix(in srgb, ${themeVars.palette.primary.main} 45%, transparent)`;
|
|
69
84
|
const { fitView } = useReactFlow();
|
|
70
85
|
const flowWrapperRef = useRef(null);
|
|
71
86
|
const fitViewFrameRef = useRef(null);
|
|
72
87
|
const enablePublishing = useEnvironmentStore((state) => state.enablePublishing);
|
|
88
|
+
// Frame the graph inside the safe area, leaving room for the HUD (top) and toolbar (bottom)
|
|
89
|
+
const { top: safeTop, right: safeRight, bottom: safeBottom, left: safeLeft } = safeArea;
|
|
90
|
+
const fitViewOptions = useMemo(() => ({
|
|
91
|
+
duration: FIT_VIEW_DURATION_MS,
|
|
92
|
+
padding: {
|
|
93
|
+
top: `${safeTop + HUD_CLEARANCE}px`,
|
|
94
|
+
right: `${safeRight + FLOATING_GAP * 2}px`,
|
|
95
|
+
bottom: `${safeBottom + TOOLBAR_CLEARANCE}px`,
|
|
96
|
+
left: `${safeLeft + FLOATING_GAP * 2}px`,
|
|
97
|
+
},
|
|
98
|
+
}), [safeBottom, safeLeft, safeRight, safeTop]);
|
|
73
99
|
const scheduleFitView = useCallback(() => {
|
|
74
100
|
if (fitViewFrameRef.current !== null) {
|
|
75
101
|
window.cancelAnimationFrame(fitViewFrameRef.current);
|
|
76
102
|
}
|
|
77
103
|
fitViewFrameRef.current = window.requestAnimationFrame(() => {
|
|
78
104
|
fitViewFrameRef.current = null;
|
|
79
|
-
void fitView();
|
|
105
|
+
void fitView(fitViewOptions);
|
|
80
106
|
});
|
|
81
|
-
}, [fitView]);
|
|
107
|
+
}, [fitView, fitViewOptions]);
|
|
108
|
+
// Horizontal offset (px) of the safe area's center from the canvas center: floating chrome is centered on it
|
|
109
|
+
const safeCenterOffset = (safeLeft - safeRight) / 2;
|
|
82
110
|
useEffect(() => {
|
|
83
111
|
return () => {
|
|
84
112
|
if (fitViewFrameRef.current !== null) {
|
|
@@ -359,7 +387,7 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
359
387
|
}, [nodes]);
|
|
360
388
|
// Generate radial guides for the network to guide the eye in the radial layout
|
|
361
389
|
const getRadialGuides = () => {
|
|
362
|
-
const circles = Array.from({ length: maxDepth }).map((_, i) => (_jsx("circle", { id: `radial-guide-${BASE_RADIUS + (i + 1) * LEVEL_SPACING}`, cx: DEFAULT_FRONTMAN_X_POS + NODE_WIDTH / 2, cy: DEFAULT_FRONTMAN_Y_POS + NODE_HEIGHT / 2, r: BASE_RADIUS + (i + 1) * LEVEL_SPACING, stroke: "
|
|
390
|
+
const circles = Array.from({ length: maxDepth }).map((_, i) => (_jsx("circle", { id: `radial-guide-${BASE_RADIUS + (i + 1) * LEVEL_SPACING}`, cx: DEFAULT_FRONTMAN_X_POS + NODE_WIDTH / 2, cy: DEFAULT_FRONTMAN_Y_POS + NODE_HEIGHT / 2, r: BASE_RADIUS + (i + 1) * LEVEL_SPACING, stroke: themeVars.palette.primary.main, strokeDasharray: "2 7", strokeLinecap: "round", fill: "none", opacity: "0.35" }, `radial-guide-${BASE_RADIUS + (i + 1) * LEVEL_SPACING}`)));
|
|
363
391
|
return (_jsx("svg", { id: `${id}-radial-guides`, style: {
|
|
364
392
|
position: "absolute",
|
|
365
393
|
left: 0,
|
|
@@ -372,25 +400,23 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
372
400
|
const getLegend = () => {
|
|
373
401
|
const length = isHeatmap ? palette.length : Math.min(maxDepth, palette.length);
|
|
374
402
|
return (_jsxs(Box, { id: `${id}-legend`, sx: {
|
|
403
|
+
// Lives inside the floating toolbar, after the view controls
|
|
375
404
|
alignItems: "center",
|
|
376
|
-
backgroundColor: theme.palette.background.paper,
|
|
377
|
-
border: `1px solid ${theme.palette.divider}`,
|
|
378
|
-
boxShadow: `0 2px 8px ${alpha(theme.palette.text.primary, 0.18)}`,
|
|
379
|
-
borderRadius: "5px",
|
|
380
405
|
display: "flex",
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
right: theme.spacing(2),
|
|
384
|
-
top: theme.spacing(4),
|
|
385
|
-
zIndex: getZIndex(2, theme),
|
|
406
|
+
paddingLeft: theme.spacing(0.25),
|
|
407
|
+
paddingRight: theme.spacing(0.5),
|
|
386
408
|
}, children: [Array.from({ length }, (_, i) => (_jsx(Box, { id: `${id}-legend-depth-${i}`, sx: {
|
|
387
409
|
alignItems: "center",
|
|
388
410
|
backgroundColor: palette[i],
|
|
411
|
+
// Same glossy shading as the agent nodes
|
|
412
|
+
backgroundImage: LEGEND_DOT_SPECULAR,
|
|
389
413
|
borderRadius: "50%",
|
|
414
|
+
boxShadow: "inset 0 -1px 2px rgba(0, 0, 0, 0.25)",
|
|
390
415
|
color: theme.palette.getContrastText(palette[i]),
|
|
391
416
|
display: "flex",
|
|
392
417
|
fontSize: "0.5rem",
|
|
393
418
|
justifyContent: "center",
|
|
419
|
+
height: "15px",
|
|
394
420
|
marginLeft: theme.spacing(0.75),
|
|
395
421
|
width: "15px",
|
|
396
422
|
}, children: i }, i))), _jsxs(ToggleButtonGroup, { id: `${id}-coloring-toggle`, value: graphColoringOption, exclusive: true, onChange: (_, newValue) => {
|
|
@@ -398,115 +424,151 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
398
424
|
setGraphColoringOption(newValue);
|
|
399
425
|
}
|
|
400
426
|
}, size: "small", sx: {
|
|
401
|
-
marginLeft: theme.spacing(
|
|
427
|
+
marginLeft: theme.spacing(1.25),
|
|
402
428
|
"& .MuiToggleButton-root": {
|
|
403
|
-
borderColor: theme.
|
|
404
|
-
color:
|
|
405
|
-
minHeight:
|
|
406
|
-
px: 1,
|
|
429
|
+
borderColor: getSheen(theme).glassBorder,
|
|
430
|
+
color: themeVars.palette.text.secondary,
|
|
431
|
+
minHeight: 24,
|
|
432
|
+
px: 1.1,
|
|
407
433
|
"&:hover": {
|
|
408
|
-
backgroundColor:
|
|
434
|
+
backgroundColor: themeVars.palette.action.hover,
|
|
409
435
|
},
|
|
410
|
-
"&.Mui-selected": {
|
|
411
|
-
backgroundColor: theme.
|
|
412
|
-
borderColor:
|
|
413
|
-
|
|
414
|
-
"&.Mui-selected:hover": {
|
|
415
|
-
backgroundColor: theme.palette.action.selected,
|
|
416
|
-
borderColor: theme.palette.text.primary,
|
|
436
|
+
"&.Mui-selected, &.Mui-selected:hover": {
|
|
437
|
+
backgroundColor: getSheen(theme).tint,
|
|
438
|
+
borderColor: themeVars.palette.primary.main,
|
|
439
|
+
color: themeVars.palette.text.primary,
|
|
417
440
|
},
|
|
418
441
|
},
|
|
419
442
|
}, children: [_jsx(ToggleButton, { id: `${id}-depth-toggle`, value: "depth", sx: {
|
|
420
|
-
fontSize: "0.
|
|
421
|
-
height: "
|
|
443
|
+
fontSize: "0.55rem",
|
|
444
|
+
height: "1.2rem",
|
|
422
445
|
}, children: "Depth" }), _jsx(ToggleButton, { id: `${id}-heatmap-toggle`, value: "heatmap", sx: {
|
|
423
|
-
fontSize: "0.
|
|
424
|
-
height: "
|
|
446
|
+
fontSize: "0.55rem",
|
|
447
|
+
height: "1.2rem",
|
|
425
448
|
}, children: "Heatmap" })] })] }));
|
|
426
449
|
};
|
|
427
450
|
// Get the background color for the control buttons; differs based on whether the button is active or not
|
|
428
451
|
const getControlButtonBackgroundColor = (isActive) => {
|
|
429
|
-
return isActive ? theme.
|
|
452
|
+
return isActive ? getSheen(theme).tint : undefined;
|
|
430
453
|
};
|
|
431
454
|
// Only show radial guides if radial layout is selected, radial guides are enabled, and it's not just Frontman
|
|
432
455
|
const shouldShowRadialGuides = showRadialGuides && layout === "radial" && maxDepth > 1;
|
|
433
|
-
//
|
|
456
|
+
// The coloring legend rides along in the toolbar once there are agents to color
|
|
457
|
+
const showLegend = agentsInNetwork?.length > 0;
|
|
458
|
+
// Floating top-center HUD: network name, live status, agent count, plus the Edit / Publish actions
|
|
459
|
+
const getHud = () => {
|
|
460
|
+
if (!networkDisplayName)
|
|
461
|
+
return null;
|
|
462
|
+
const isPublishingSetUp = enablePublishing && Boolean(publishServerUrl);
|
|
463
|
+
const hoconToPublish = currentTempNetwork?.networkHocon;
|
|
464
|
+
const showPublishButton = isPublishingSetUp && !isAgentNetworkDesignerMode && currentTempNetwork?.agentNetworkName && hoconToPublish;
|
|
465
|
+
let hudStatus = "idle";
|
|
466
|
+
if (isAwaitingLlm) {
|
|
467
|
+
hudStatus = currentConversations?.length ? "streaming" : "thinking";
|
|
468
|
+
}
|
|
469
|
+
return (_jsxs(NetworkHud, { agentCount: agentsInNetwork?.length ?? 0, centerOffset: safeCenterOffset, id: id, networkDisplayName: networkDisplayName, status: hudStatus, top: safeTop + FLOATING_GAP, children: [isTemporaryNetwork && !isEditingNetwork && !isAwaitingLlm && (_jsx(Button, { id: `${id}-enter-edit-mode-btn`, variant: "contained", size: "small", onClick: () => setIsEditingNetwork(true), startIcon: _jsx(EditIcon, {}), sx: { borderRadius: 999, pointerEvents: "auto" }, children: "Edit" })), showPublishButton && (_jsx(Box, { sx: { pointerEvents: "auto" }, children: _jsx(PublishButton, { displayName: networkDisplayName, hocon: hoconToPublish, id: `${id}-publish-button`, networkId: currentTempNetwork.agentInfo.agent_name, networkName: currentTempNetwork.agentNetworkName }) }))] }));
|
|
470
|
+
};
|
|
471
|
+
// Thin vertical rule between groups of buttons in the toolbar
|
|
472
|
+
const getToolbarDivider = (key) => (_jsx(Box, { "aria-hidden": true, sx: {
|
|
473
|
+
alignSelf: "stretch",
|
|
474
|
+
backgroundColor: getSheen(theme).glassBorder,
|
|
475
|
+
marginX: theme.spacing(0.5),
|
|
476
|
+
marginY: theme.spacing(0.5),
|
|
477
|
+
width: "1px",
|
|
478
|
+
} }, key));
|
|
479
|
+
// Floating bottom-center toolbar ("glass pill"): zoom / fit view / lock (built into Controls), then the layout,
|
|
480
|
+
// radial guides and thought bubble toggles, then the coloring legend.
|
|
434
481
|
const getControls = () => {
|
|
435
|
-
return (_jsxs(Controls, { position: "
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
height: "auto",
|
|
440
|
-
width: "auto",
|
|
441
|
-
}, showInteractive: true, children: [_jsx(Tooltip, { id: "radial-layout-tooltip", title: "Radial layout", placement: "right", children: _jsx("span", { id: "radial-layout-span", children: _jsx(ControlButton, { id: "radial-layout-button", onClick: () => setLayout("radial"), style: {
|
|
482
|
+
return (_jsxs(Controls, { "aria-label": "Control Panel", fitViewOptions: fitViewOptions, orientation: "horizontal", position: "bottom-center", style: {
|
|
483
|
+
bottom: `${safeBottom + FLOATING_GAP}px`,
|
|
484
|
+
left: `calc(50% + ${safeCenterOffset}px)`,
|
|
485
|
+
}, showInteractive: true, children: [getToolbarDivider("view-divider"), _jsx(Tooltip, { id: "radial-layout-tooltip", title: "Radial layout", placement: "top", children: _jsx("span", { id: "radial-layout-span", children: _jsx(ControlButton, { "aria-label": "Radial layout", "aria-pressed": layout === "radial", id: "radial-layout-button", onClick: () => setLayout("radial"), style: {
|
|
442
486
|
backgroundColor: getControlButtonBackgroundColor(layout === "radial"),
|
|
443
|
-
}, children: _jsx(HubOutlinedIcon, { id: "radial-layout-icon" }) }) }) }), _jsx(Tooltip, { id: "linear-layout-tooltip", title: "Linear layout", placement: "
|
|
487
|
+
}, children: _jsx(HubOutlinedIcon, { id: "radial-layout-icon" }) }) }) }), _jsx(Tooltip, { id: "linear-layout-tooltip", title: "Linear layout", placement: "top", children: _jsx("span", { id: "linear-layout-span", children: _jsx(ControlButton, { "aria-label": "Linear layout", "aria-pressed": layout === "linear", id: "linear-layout-button", onClick: () => setLayout("linear"), style: {
|
|
444
488
|
backgroundColor: getControlButtonBackgroundColor(layout === "linear"),
|
|
445
|
-
}, children: _jsx(ScatterPlotOutlinedIcon, { id: "linear-layout-icon" }) }) }) }), _jsx(Tooltip, { id: "radial-guides-tooltip", title: `Enable/disable radial guides${layout === "radial" ? "" : " (only available in radial layout)"}`, placement: "
|
|
489
|
+
}, children: _jsx(ScatterPlotOutlinedIcon, { id: "linear-layout-icon" }) }) }) }), _jsx(Tooltip, { id: "radial-guides-tooltip", title: `Enable/disable radial guides${layout === "radial" ? "" : " (only available in radial layout)"}`, placement: "top", children: _jsx("span", { id: "radial-guides-span", children: _jsx(ControlButton, { "aria-label": "Radial guides", "aria-pressed": showRadialGuides, id: "radial-guides-button", onClick: () => setShowRadialGuides(!showRadialGuides), style: {
|
|
446
490
|
backgroundColor: getControlButtonBackgroundColor(showRadialGuides),
|
|
447
|
-
}, disabled: layout !== "radial", children: _jsx(AdjustRoundedIcon, { id: "radial-guides-icon" }) }) }) }), _jsx(Tooltip, { id: "thought-bubble-tooltip", title: `Toggle thought bubbles ${showThoughtBubbles ? "off" : "on"}`, placement: "
|
|
491
|
+
}, disabled: layout !== "radial", children: _jsx(AdjustRoundedIcon, { id: "radial-guides-icon" }) }) }) }), _jsx(Tooltip, { id: "thought-bubble-tooltip", title: `Toggle thought bubbles ${showThoughtBubbles ? "off" : "on"}`, placement: "top", children: _jsx("span", { id: "thought-bubble-span", children: _jsx(ControlButton, { "aria-label": "Thought bubbles", "aria-pressed": showThoughtBubbles, id: "thought-bubble-button", onClick: () => setShowThoughtBubbles(!showThoughtBubbles), style: {
|
|
448
492
|
backgroundColor: getControlButtonBackgroundColor(showThoughtBubbles),
|
|
449
|
-
}, children: _jsx(ChatBubbleOutlinedIcon, { id: "thought-bubble-icon" }) }) }) })] }));
|
|
450
|
-
};
|
|
451
|
-
const getTitle = () => {
|
|
452
|
-
if (!networkDisplayName)
|
|
453
|
-
return null;
|
|
454
|
-
const isPublishingSetUp = enablePublishing && Boolean(publishServerUrl);
|
|
455
|
-
const isViewingNetwork = !isAgentNetworkDesignerMode && !isEditingNetwork;
|
|
456
|
-
const hoconToPublish = currentTempNetwork?.networkHocon;
|
|
457
|
-
const showPublishButton = isPublishingSetUp && isViewingNetwork && currentTempNetwork?.agentNetworkName && hoconToPublish;
|
|
458
|
-
return (_jsxs(Box, { id: `${id}-network-title-bar`, sx: {
|
|
459
|
-
alignItems: "center",
|
|
460
|
-
display: "flex",
|
|
461
|
-
gap: 1,
|
|
462
|
-
left: "50%",
|
|
463
|
-
pointerEvents: "none",
|
|
464
|
-
position: "absolute",
|
|
465
|
-
top: theme.spacing(1),
|
|
466
|
-
transform: "translateX(-50%)",
|
|
467
|
-
zIndex: getZIndex(2, theme),
|
|
468
|
-
}, children: [_jsx(Tooltip, { title: networkDisplayName, placement: "top", children: _jsx(Typography, { id: `${id}-network-title`, variant: "subtitle1", sx: {
|
|
469
|
-
backdropFilter: "blur(6px)",
|
|
470
|
-
backgroundColor: alpha(theme.palette.background.paper, 0.75),
|
|
471
|
-
border: `1px solid ${alpha(theme.palette.divider, 0.75)}`,
|
|
472
|
-
borderRadius: 2,
|
|
473
|
-
boxShadow: theme.shadows[6],
|
|
474
|
-
color: theme.palette.text.primary,
|
|
475
|
-
fontWeight: 600,
|
|
476
|
-
letterSpacing: "0.01em",
|
|
477
|
-
lineHeight: 1.35,
|
|
478
|
-
maxWidth: 400,
|
|
479
|
-
overflow: "hidden",
|
|
480
|
-
pointerEvents: "auto",
|
|
481
|
-
px: 2,
|
|
482
|
-
py: 0.45,
|
|
483
|
-
textOverflow: "ellipsis",
|
|
484
|
-
whiteSpace: "nowrap",
|
|
485
|
-
}, children: networkDisplayName }) }), isTemporaryNetwork && !isEditingNetwork && !isAwaitingLlm && (_jsx(Button, { id: `${id}-enter-edit-mode-btn`, variant: "contained", size: "small", onClick: () => setIsEditingNetwork(true), startIcon: _jsx(EditIcon, {}), sx: {
|
|
486
|
-
pointerEvents: "auto",
|
|
487
|
-
"&:hover": { backgroundColor: theme.palette.primary.main },
|
|
488
|
-
}, children: "Edit" })), showPublishButton && (_jsx(Box, { sx: { pointerEvents: "auto" }, children: _jsx(PublishButton, { displayName: networkDisplayName, hocon: hoconToPublish, id: `${id}-publish-button`, networkId: currentTempNetwork.agentInfo.agent_name, networkName: currentTempNetwork.agentNetworkName }) }))] }));
|
|
493
|
+
}, children: _jsx(ChatBubbleOutlinedIcon, { id: "thought-bubble-icon" }) }) }) }), showLegend && getToolbarDivider("legend-divider"), showLegend && getLegend()] }));
|
|
489
494
|
};
|
|
495
|
+
const sheen = getSheen(theme);
|
|
490
496
|
return (_jsxs(Box, { id: `${id}-outer-box`, sx: {
|
|
491
497
|
display: "flex",
|
|
492
498
|
flexDirection: "column",
|
|
493
499
|
position: "relative",
|
|
494
500
|
height: "100%",
|
|
495
501
|
width: "100%",
|
|
496
|
-
|
|
502
|
+
overflow: "hidden",
|
|
503
|
+
backgroundColor: themeVars.palette.background.default,
|
|
504
|
+
backgroundImage: auroraBackground(theme),
|
|
505
|
+
// Vignette + film grain over the aurora: pulls the eye to the middle of the canvas
|
|
506
|
+
"&::before": {
|
|
507
|
+
backgroundImage: `radial-gradient(ellipse 75% 70% at 50% 50%, transparent 55%, ${alpha(theme.palette.background.default, 0.85)})`,
|
|
508
|
+
content: '""',
|
|
509
|
+
inset: 0,
|
|
510
|
+
pointerEvents: "none",
|
|
511
|
+
position: "absolute",
|
|
512
|
+
zIndex: 0,
|
|
513
|
+
},
|
|
514
|
+
"&::after": {
|
|
515
|
+
backgroundImage: GRAIN_TEXTURE,
|
|
516
|
+
content: '""',
|
|
517
|
+
inset: 0,
|
|
518
|
+
mixBlendMode: "overlay",
|
|
519
|
+
opacity: 0.18,
|
|
520
|
+
pointerEvents: "none",
|
|
521
|
+
position: "absolute",
|
|
522
|
+
zIndex: 0,
|
|
523
|
+
},
|
|
524
|
+
// Default (non-plasma) edges: translucent accent with a soft glow. Arrow markers match via
|
|
525
|
+
// defaultMarkerColor. Plasma edges draw their own glow.
|
|
526
|
+
"--xy-edge-stroke": edgeColor,
|
|
527
|
+
"& .react-flow__edge-default .react-flow__edge-path": {
|
|
528
|
+
filter: `drop-shadow(0 0 3px ${sheen.glow})`,
|
|
529
|
+
strokeLinecap: "round",
|
|
530
|
+
},
|
|
531
|
+
// Nodes are custom (glass discs + name pill); no wrapper chrome
|
|
497
532
|
"& .react-flow__node": {
|
|
498
|
-
border: "
|
|
533
|
+
border: "none",
|
|
499
534
|
},
|
|
500
535
|
"& .react-flow__panel, & .react-flow__controls-button": {
|
|
501
|
-
|
|
502
|
-
color: theme.palette.text.primary,
|
|
536
|
+
color: themeVars.palette.text.primary,
|
|
503
537
|
},
|
|
504
|
-
|
|
505
|
-
|
|
538
|
+
// Toolbar: a floating glass pill centered under the graph
|
|
539
|
+
"& .react-flow__controls": {
|
|
540
|
+
...glassSurface(theme, 999),
|
|
541
|
+
...gradientBorder(theme, 999, 1, 0.35),
|
|
542
|
+
// gradientBorder sets position: relative; React Flow panels must stay absolutely positioned
|
|
543
|
+
position: "absolute",
|
|
544
|
+
alignItems: "center",
|
|
545
|
+
animation: `sheenRise 0.6s ${SHEEN_EASE} both`,
|
|
546
|
+
border: 0,
|
|
547
|
+
boxShadow: `inset 0 1px 0 ${sheen.highlight}, 0 18px 50px -18px rgba(0, 0, 0, 0.6)`,
|
|
548
|
+
gap: "2px",
|
|
549
|
+
margin: 0,
|
|
550
|
+
padding: theme.spacing(0.5),
|
|
551
|
+
// Center with `translate` rather than `transform`: the sheenRise entrance animates transform and
|
|
552
|
+
// would otherwise wipe out the centering offset
|
|
553
|
+
transform: "none",
|
|
554
|
+
translate: "-50% 0",
|
|
555
|
+
transition: `left 0.55s ${SHEEN_EASE}, bottom 0.55s ${SHEEN_EASE}`,
|
|
506
556
|
},
|
|
507
557
|
"& .react-flow__controls-button": {
|
|
508
|
-
|
|
509
|
-
|
|
558
|
+
backgroundColor: "transparent",
|
|
559
|
+
border: "none",
|
|
560
|
+
borderRadius: "50%",
|
|
561
|
+
fill: themeVars.palette.text.primary,
|
|
562
|
+
height: 30,
|
|
563
|
+
transition: `background-color 0.2s ${SHEEN_EASE}, box-shadow 0.2s ${SHEEN_EASE}`,
|
|
564
|
+
width: 30,
|
|
565
|
+
"& svg": { maxHeight: 16, maxWidth: 16 },
|
|
566
|
+
"&:hover": { backgroundColor: sheen.tint, boxShadow: `0 0 14px -4px ${sheen.glow}` },
|
|
567
|
+
"&:focus-visible": { outline: `2px solid ${themeVars.palette.primary.main}`, outlineOffset: 1 },
|
|
568
|
+
},
|
|
569
|
+
// Dot grid: soft accent dots
|
|
570
|
+
"& .react-flow__background circle, & .react-flow__background path": {
|
|
571
|
+
opacity: 0.9,
|
|
510
572
|
},
|
|
511
573
|
}, children: [_jsxs(Box, { id: `${id}-react-flow-wrapper`, ref: flowWrapperRef, sx: {
|
|
512
574
|
display: "flex",
|
|
@@ -514,8 +576,19 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
514
576
|
flexDirection: "column",
|
|
515
577
|
minHeight: 0,
|
|
516
578
|
position: "relative",
|
|
517
|
-
|
|
518
|
-
}, children: [
|
|
519
|
-
|
|
520
|
-
|
|
579
|
+
zIndex: 1,
|
|
580
|
+
}, children: [getHud(), _jsx(ReactFlow, { connectionMode: ConnectionMode.Loose, defaultMarkerColor: edgeColor, edgeTypes: edgeTypes, edges: edges, fitView: true, id: `${id}-react-flow`, nodeTypes: nodeTypes, nodes: nodes, nodesDraggable: !isAgentNetworkDesignerMode, onKeyDown: handleNodeKeyDown, onNodeClick: handleNodeClick, onNodesChange: onNodesChange, children: !isAwaitingLlm && (_jsxs(_Fragment, { children: [_jsx(Background, { gap: 22, id: `${id}-background`, size: 1.4, variant: BackgroundVariant.Dots }), !isAgentNetworkDesignerMode && !isEditingNetwork && getControls(), shouldShowRadialGuides ? getRadialGuides() : null] })) }), _jsx(ThoughtBubbleOverlay, { nodes: nodes, edges: thoughtBubbleEdgesForOverlay, showThoughtBubbles: showThoughtBubbles, isStreaming: isStreaming, onBubbleHoverChange: handleBubbleHoverChange, rightInset: safeRight, topInset: safeTop })] }), isTemporaryNetwork && !isAwaitingLlm && (
|
|
581
|
+
// Floating glass card for the editor dock, kept inside the safe area. Hidden while the dock is closed.
|
|
582
|
+
_jsx(Box, { id: `${id}-network-editor-dock-card`, sx: {
|
|
583
|
+
borderRadius: `${SHEEN_RADIUS_SURFACE}px`,
|
|
584
|
+
bottom: `${safeBottom + FLOATING_GAP}px`,
|
|
585
|
+
boxShadow: `0 24px 60px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px ${sheen.glassBorder}`,
|
|
586
|
+
left: `${safeLeft + FLOATING_GAP}px`,
|
|
587
|
+
overflow: "hidden",
|
|
588
|
+
position: "absolute",
|
|
589
|
+
right: `${safeRight + FLOATING_GAP}px`,
|
|
590
|
+
transition: `left 0.55s ${SHEEN_EASE}, right 0.55s ${SHEEN_EASE}`,
|
|
591
|
+
zIndex: getZIndex(2, theme),
|
|
592
|
+
"&:empty": { display: "none" },
|
|
593
|
+
}, children: _jsx(NetworkEditorDock, { currentUser: currentUser, extraSlyData: extraSlyData, id: `${id}-network-editor-dock`, isEditingNetwork: isEditingNetwork, networkId: networkId, neuroSanURL: neuroSanURL, setIsEditingNetwork: setIsEditingNetwork, setSelectedNetwork: setSelectedNetwork, tempNetworks: tempNetworks }) })), selectedAgent && !isAwaitingLlm && (_jsx(AgentNodeEditor, { agentId: selectedAgent.agentId, agentName: selectedAgent.agentName, initialInstructions: selectedAgent.initialInstructions, initialDescription: selectedAgent.initialDescription, isOpen: isPopupOpen, networkId: networkId, onSaveAgent: onSaveAgent, setIsPopupOpen: setIsPopupOpen }))] }));
|
|
521
594
|
};
|
|
@@ -22,13 +22,14 @@ import EditIcon from "@mui/icons-material/Edit";
|
|
|
22
22
|
import HandymanIcon from "@mui/icons-material/Handyman";
|
|
23
23
|
import PersonIcon from "@mui/icons-material/Person";
|
|
24
24
|
import TravelExploreIcon from "@mui/icons-material/TravelExplore";
|
|
25
|
+
import Box from "@mui/material/Box";
|
|
25
26
|
import IconButton from "@mui/material/IconButton";
|
|
26
27
|
import { keyframes, styled, useTheme } from "@mui/material/styles";
|
|
27
28
|
import Tooltip from "@mui/material/Tooltip";
|
|
28
29
|
import Typography from "@mui/material/Typography";
|
|
29
30
|
import { Handle, Position } from "@xyflow/react";
|
|
30
31
|
import { usePalette, useSettingsStore } from "../../../state/Settings.js";
|
|
31
|
-
import {
|
|
32
|
+
import { getSheen, glassSurface, glowShadow, gradientBorder, SHEEN_EASE, SHEEN_FONT_DISPLAY, SHEEN_RADIUS, sheenConic, sheenGradient, } from "../../../Theme/sheen.js";
|
|
32
33
|
import { getZIndex } from "../../../utils/zIndexLayers.js";
|
|
33
34
|
import { DisplayAs } from "../const.js";
|
|
34
35
|
// A zero-width space character, used to give the browser a hint where to break long names
|
|
@@ -41,34 +42,67 @@ export const FRONTMAN_SIZE_MULTIPLIER = 1.25;
|
|
|
41
42
|
// These are used to set the size of the icons displayed in the agent nodes.
|
|
42
43
|
const AGENT_ICON_SIZE = "2.25rem";
|
|
43
44
|
const FRONTMAN_ICON_SIZE = "4.5rem";
|
|
44
|
-
//
|
|
45
|
+
// Glossy "glass disc" shading layered over the node's fill color: a specular hotspot near the top-left, a soft
|
|
46
|
+
// top-to-bottom sheen and a darker rim at the bottom for depth.
|
|
47
|
+
const NODE_SPECULAR = "radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 42%), " +
|
|
48
|
+
"linear-gradient(170deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, 0.22))";
|
|
49
|
+
// Inner bevel + resting drop shadow for the disc
|
|
50
|
+
const NODE_DEPTH_SHADOW = "inset 0 1px 1px rgba(255, 255, 255, 0.45), inset 0 -6px 14px rgba(0, 0, 0, 0.22), " +
|
|
51
|
+
"0 10px 24px -10px rgba(0, 0, 0, 0.55)";
|
|
52
|
+
// Pulsing glow animation for when an agent is active (keeps the disc's bevel while the halo breathes).
|
|
45
53
|
const glowKeyFrames = (color) => keyframes `
|
|
46
54
|
0% {
|
|
47
|
-
box-shadow: 0 0
|
|
48
|
-
opacity: 0.6;
|
|
55
|
+
box-shadow: ${NODE_DEPTH_SHADOW}, 0 0 12px 2px ${color};
|
|
49
56
|
}
|
|
50
57
|
50% {
|
|
51
|
-
box-shadow: 0 0
|
|
52
|
-
opacity: 0.9;
|
|
58
|
+
box-shadow: ${NODE_DEPTH_SHADOW}, 0 0 36px 12px ${color};
|
|
53
59
|
}
|
|
54
60
|
100% {
|
|
55
|
-
box-shadow: 0 0
|
|
56
|
-
opacity: 1.0;
|
|
61
|
+
box-shadow: ${NODE_DEPTH_SHADOW}, 0 0 12px 2px ${color};
|
|
57
62
|
}
|
|
58
63
|
`;
|
|
59
|
-
//
|
|
64
|
+
// Human-readable agent types for the hover card
|
|
65
|
+
const DISPLAY_AS_LABELS = {
|
|
66
|
+
[DisplayAs.LLM_AGENT]: "LLM agent",
|
|
67
|
+
[DisplayAs.CODED_TOOL]: "Coded tool",
|
|
68
|
+
[DisplayAs.LANGCHAIN_TOOL]: "LangChain tool",
|
|
69
|
+
[DisplayAs.EXTERNAL_AGENT]: "External agent",
|
|
70
|
+
};
|
|
71
|
+
// Width of the rotating iridescent ring around active nodes, and its gap from the disc (px)
|
|
72
|
+
const ACTIVE_RING_WIDTH = 3;
|
|
73
|
+
const ACTIVE_RING_OFFSET = 5;
|
|
74
|
+
// Styled component for the agent nodes: glossy glass disc; active agents get a rotating conic ring + glow pulse
|
|
60
75
|
const AnimatedNode = styled("div", {
|
|
61
76
|
shouldForwardProp: (prop) => prop !== "glowColor" && prop !== "isActive",
|
|
62
|
-
})(({ glowColor, isActive }) => ({
|
|
77
|
+
})(({ glowColor, isActive, theme }) => ({
|
|
63
78
|
alignItems: "center",
|
|
79
|
+
backgroundImage: NODE_SPECULAR,
|
|
64
80
|
borderRadius: "50%",
|
|
81
|
+
boxShadow: NODE_DEPTH_SHADOW,
|
|
65
82
|
display: "flex",
|
|
66
83
|
justifyContent: "center",
|
|
67
84
|
position: "relative",
|
|
68
85
|
shapeOutside: "circle(50%)",
|
|
69
86
|
textAlign: "center",
|
|
87
|
+
transition: `transform 0.25s ${SHEEN_EASE}`,
|
|
88
|
+
"&:hover": { transform: "scale(1.04)" },
|
|
70
89
|
...(isActive && {
|
|
71
90
|
animation: `${glowKeyFrames(glowColor)} 2s infinite`,
|
|
91
|
+
// Rotating iridescent ring (circular take on spinningBorder). Decorative only: no pointer events, so the
|
|
92
|
+
// node's hit area and handles are unaffected.
|
|
93
|
+
"&::before": {
|
|
94
|
+
content: '""',
|
|
95
|
+
position: "absolute",
|
|
96
|
+
inset: `-${ACTIVE_RING_OFFSET + ACTIVE_RING_WIDTH}px`,
|
|
97
|
+
padding: `${ACTIVE_RING_WIDTH}px`,
|
|
98
|
+
borderRadius: "50%",
|
|
99
|
+
background: sheenConic(theme),
|
|
100
|
+
animation: "sheenSpin 3s linear infinite",
|
|
101
|
+
pointerEvents: "none",
|
|
102
|
+
WebkitMask: "linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",
|
|
103
|
+
WebkitMaskComposite: "xor",
|
|
104
|
+
mask: "linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0)",
|
|
105
|
+
},
|
|
72
106
|
}),
|
|
73
107
|
}));
|
|
74
108
|
/**
|
|
@@ -149,10 +183,8 @@ export const AgentNode = (props) => {
|
|
|
149
183
|
};
|
|
150
184
|
// Determine icon color based on settings. If auto color is enabled, use contrasting color for readability.
|
|
151
185
|
const color = autoAgentIconColor ? theme.palette.getContrastText(backgroundColor) : agentNodeIconColor;
|
|
152
|
-
//
|
|
153
|
-
const glowColor =
|
|
154
|
-
? theme.palette.common.black
|
|
155
|
-
: theme.palette.common.white;
|
|
186
|
+
// Active agents pulse with the sheen accent glow (follows the active color scheme)
|
|
187
|
+
const glowColor = getSheen(theme).glow;
|
|
156
188
|
// Insert zero-width spaces into the agent name to give the browser hints where to wrap.
|
|
157
189
|
const wrappedAgentName = agentName
|
|
158
190
|
// Allow wrap after underscore
|
|
@@ -164,21 +196,18 @@ export const AgentNode = (props) => {
|
|
|
164
196
|
const height = NODE_HEIGHT * (isFrontman ? FRONTMAN_SIZE_MULTIPLIER : 1.0);
|
|
165
197
|
const width = height;
|
|
166
198
|
const getEditButton = () => (_jsx(Tooltip, { title: "Edit", placement: "top", disableInteractive: true, children: _jsx(IconButton, { className: "agent-node-edit-icon", "aria-hidden": true, tabIndex: -1, sx: {
|
|
199
|
+
...glassSurface(theme, 999),
|
|
167
200
|
position: "absolute",
|
|
168
201
|
top: 0,
|
|
169
202
|
right: 0,
|
|
170
|
-
backgroundColor: "rgba(0,0,0,0.45)",
|
|
171
|
-
borderRadius: "50%",
|
|
172
203
|
padding: "3px",
|
|
173
204
|
zIndex: 2,
|
|
174
205
|
cursor: "pointer",
|
|
175
|
-
"&:hover": {
|
|
176
|
-
}, children: _jsx(EditIcon, { id: `${agentId}-edit-icon`, sx: { fontSize: "1rem", color: "
|
|
206
|
+
"&:hover": { boxShadow: glowShadow(theme, 12) },
|
|
207
|
+
}, children: _jsx(EditIcon, { id: `${agentId}-edit-icon`, sx: { fontSize: "1rem", color: "text.primary" } }) }) }));
|
|
177
208
|
const getNodeName = () => (_jsx(Tooltip, { id: `${agentId}-tooltip`, title: agentName, placement: "top", disableInteractive: true, children: _jsx(Typography, { id: `${agentId}-name`, sx: {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
borderRadius: 1,
|
|
181
|
-
color: theme.palette.text.primary,
|
|
209
|
+
...glassSurface(theme, 8),
|
|
210
|
+
color: (theme.vars ?? theme).palette.text.primary,
|
|
182
211
|
display: "-webkit-box",
|
|
183
212
|
fontSize: "16px",
|
|
184
213
|
fontWeight: "700",
|
|
@@ -195,7 +224,42 @@ export const AgentNode = (props) => {
|
|
|
195
224
|
width,
|
|
196
225
|
zIndex: getZIndex(1, theme),
|
|
197
226
|
}, children: wrappedAgentName }) }));
|
|
198
|
-
|
|
227
|
+
// Rich glass hover card: type, name, depth, invocation count and live status
|
|
228
|
+
const agentTypeLabel = isFrontman ? "Front man" : (DISPLAY_AS_LABELS[displayAs] ?? "Agent");
|
|
229
|
+
const invocationCount = agentCounts?.get(agentId) ?? 0;
|
|
230
|
+
const getStat = (label, value) => (_jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [_jsx(Typography, { component: "span", sx: { color: "text.secondary", fontSize: "0.6rem", letterSpacing: "0.08em", textTransform: "uppercase" }, children: label }), _jsx(Typography, { component: "span", sx: { fontSize: "0.85rem", fontVariantNumeric: "tabular-nums", fontWeight: 600 }, children: value })] }));
|
|
231
|
+
const getHoverCard = () => (_jsxs(Box, { id: `${agentId}-hover-card`, sx: { display: "flex", flexDirection: "column", gap: 0.75, minWidth: 180, maxWidth: 260 }, children: [_jsxs(Box, { sx: { alignItems: "center", display: "flex", gap: 0.75 }, children: [_jsx(Box, { sx: {
|
|
232
|
+
backgroundColor,
|
|
233
|
+
backgroundImage: NODE_SPECULAR,
|
|
234
|
+
borderRadius: "50%",
|
|
235
|
+
flexShrink: 0,
|
|
236
|
+
height: 10,
|
|
237
|
+
width: 10,
|
|
238
|
+
} }), _jsx(Typography, { component: "span", sx: {
|
|
239
|
+
color: "text.secondary",
|
|
240
|
+
fontSize: "0.65rem",
|
|
241
|
+
letterSpacing: "0.1em",
|
|
242
|
+
textTransform: "uppercase",
|
|
243
|
+
}, children: agentTypeLabel }), isActiveAgent && (_jsx(Box, { component: "span", sx: {
|
|
244
|
+
backgroundImage: sheenGradient(theme),
|
|
245
|
+
borderRadius: 999,
|
|
246
|
+
color: (theme.vars ?? theme).palette.primary.contrastText,
|
|
247
|
+
fontSize: "0.6rem",
|
|
248
|
+
fontWeight: 700,
|
|
249
|
+
letterSpacing: "0.06em",
|
|
250
|
+
ml: "auto",
|
|
251
|
+
px: 0.75,
|
|
252
|
+
py: 0.1,
|
|
253
|
+
textTransform: "uppercase",
|
|
254
|
+
}, children: "Active" }))] }), _jsx(Typography, { component: "span", sx: {
|
|
255
|
+
color: "text.primary",
|
|
256
|
+
fontFamily: SHEEN_FONT_DISPLAY,
|
|
257
|
+
fontSize: "1.1rem",
|
|
258
|
+
fontWeight: 500,
|
|
259
|
+
lineHeight: 1.2,
|
|
260
|
+
overflowWrap: "anywhere",
|
|
261
|
+
}, children: agentName }), _jsxs(Box, { sx: { display: "flex", gap: 2 }, children: [getStat("Depth", String(depth)), isHeatmap && getStat("Calls", String(invocationCount))] }), isEditable && (_jsx(Typography, { component: "span", sx: { color: "primary.main", fontSize: "0.7rem", fontWeight: 600 }, children: "Click or press Enter to edit" }))] }));
|
|
262
|
+
const getAnimatedNode = () => (_jsxs(AnimatedNode, { id: agentId, "data-testid": agentId, glowColor: glowColor, isActive: isActiveAgent, sx: {
|
|
199
263
|
backgroundColor,
|
|
200
264
|
color,
|
|
201
265
|
cursor: isEditable ? "pointer" : "grab",
|
|
@@ -207,5 +271,18 @@ export const AgentNode = (props) => {
|
|
|
207
271
|
"&:hover .agent-node-edit-icon": { opacity: 1 },
|
|
208
272
|
".react-flow__node:focus-visible & .agent-node-edit-icon": { opacity: 1 },
|
|
209
273
|
}, children: [getDisplayAsIcon(), isEditable && getEditButton(), _jsx(Handle, { id: `${agentId}-left-handle`, position: Position.Left, type: "source", style: { visibility: handleVisibility } }), _jsx(Handle, { id: `${agentId}-right-handle`, position: Position.Right, type: "source", style: { visibility: handleVisibility } }), _jsx(Handle, { id: `${agentId}-top-handle`, position: Position.Top, type: "source", style: { visibility: handleVisibility } }), _jsx(Handle, { id: `${agentId}-bottom-handle`, position: Position.Bottom, type: "source", style: { visibility: handleVisibility } })] }));
|
|
274
|
+
const getNode = () => (_jsx(Tooltip, { enterDelay: 250, disableInteractive: true, placement: "right", slotProps: {
|
|
275
|
+
tooltip: {
|
|
276
|
+
sx: {
|
|
277
|
+
...glassSurface(theme, SHEEN_RADIUS),
|
|
278
|
+
...gradientBorder(theme, SHEEN_RADIUS, 1, 0.45),
|
|
279
|
+
border: 0,
|
|
280
|
+
boxShadow: `inset 0 1px 0 ${getSheen(theme).highlight}, 0 18px 50px -16px rgba(0, 0, 0, 0.6)`,
|
|
281
|
+
color: "text.primary",
|
|
282
|
+
maxWidth: "none",
|
|
283
|
+
padding: "10px 14px",
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
}, title: getHoverCard(), children: getAnimatedNode() }));
|
|
210
287
|
return (_jsxs(_Fragment, { children: [getNode(), getNodeName()] }));
|
|
211
288
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
export type NetworkHudStatus = "idle" | "thinking" | "streaming";
|
|
3
|
+
export interface NetworkHudProps {
|
|
4
|
+
readonly agentCount: number;
|
|
5
|
+
/** Horizontal offset (px) of the visible canvas center from the canvas center */
|
|
6
|
+
readonly centerOffset: number;
|
|
7
|
+
/** Actions (Edit, Publish) shown to the right of the pill */
|
|
8
|
+
readonly children?: ReactNode;
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly networkDisplayName: string;
|
|
11
|
+
readonly status: NetworkHudStatus;
|
|
12
|
+
/** Distance (px) from the top of the canvas */
|
|
13
|
+
readonly top: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Floating top-center "mission control" HUD over the agent canvas: the current network's name in the display font,
|
|
17
|
+
* its live status (idle / thinking / streaming) and how many agents it has. Edit / Publish actions sit beside it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const NetworkHud: FC<NetworkHudProps>;
|