diff --git a/apps/epiphany-gui/scripts/visual-smoke.mjs b/apps/epiphany-gui/scripts/visual-smoke.mjs index e2c51f55..ed3009df 100644 --- a/apps/epiphany-gui/scripts/visual-smoke.mjs +++ b/apps/epiphany-gui/scripts/visual-smoke.mjs @@ -147,6 +147,27 @@ async function smokeViewport(browser, viewport, screenshotPath, exerciseFluidPan if (!hoverProbe.ok) { throw new Error(`DOM hover did not reach aquarium projection at ${viewport.width}x${viewport.height}: ${hoverProbe.reason}`); } + const optionProbe = await page.evaluate(() => { + const halo = document.querySelector('[data-agent-options="research"]'); + if (!(halo instanceof HTMLElement)) return { ok: false, reason: "research options missing" }; + const style = window.getComputedStyle(halo); + const buttons = [...halo.querySelectorAll("button")].filter((button) => button instanceof HTMLButtonElement); + const labels = buttons.map((button) => button.textContent?.trim()).filter(Boolean); + const firstRect = buttons[0]?.getBoundingClientRect(); + const firstStyle = buttons[0] ? window.getComputedStyle(buttons[0]) : null; + return { + ok: + style.opacity !== "0" && + firstStyle?.pointerEvents !== "none" && + labels.includes("State") && + labels.includes("Artifacts") && + Boolean(firstRect && firstRect.width > 20 && firstRect.height > 16), + reason: `opacity=${style.opacity} haloPointer=${style.pointerEvents} buttonPointer=${firstStyle?.pointerEvents} labels=${labels.join(",")}`, + }; + }); + if (!optionProbe.ok) { + throw new Error(`DOM agent options did not open for research: ${optionProbe.reason}`); + } } let audioProbe = null; if (viewport.width >= 720) { diff --git a/apps/epiphany-gui/src/App.tsx b/apps/epiphany-gui/src/App.tsx index fc8dae53..bdaec609 100644 --- a/apps/epiphany-gui/src/App.tsx +++ b/apps/epiphany-gui/src/App.tsx @@ -1454,7 +1454,9 @@ function AgentConstellation({ const rendererRef = useRef(null); const agentNodeRefs = useRef(new globalThis.Map()); const thoughtNodeRefs = useRef(new globalThis.Map()); + const optionHaloNodeRefs = useRef(new globalThis.Map()); const [selectedAgentId, setSelectedAgentId] = useState("coordinator"); + const [hoveredAgentId, setHoveredAgentId] = useState(null); const agents = useMemo(() => { return constellationSpecs.map((spec) => { const lane = roles.find((role) => text(role.id).toLowerCase() === spec.laneId); @@ -1583,10 +1585,19 @@ function AgentConstellation({ } }, []); + const bindOptionHaloNode = useCallback((id: string, node: HTMLDivElement | null) => { + if (node) { + optionHaloNodeRefs.current.set(id, node); + } else { + optionHaloNodeRefs.current.delete(id); + } + }, []); + const applyProjectionFrame = useCallback((projections: AquariumAgentProjection[]) => { for (const projection of projections) { const agentNode = agentNodeRefs.current.get(projection.id); const thoughtNode = thoughtNodeRefs.current.get(projection.id); + const optionHaloNode = optionHaloNodeRefs.current.get(projection.id); const properties: Array<[string, string]> = [ ["--agent-x", `${projection.xPercent}%`], ["--agent-y", `${projection.yPercent}%`], @@ -1603,7 +1614,9 @@ function AgentConstellation({ for (const [name, value] of properties) { agentNode?.style.setProperty(name, value); thoughtNode?.style.setProperty(name, value); + optionHaloNode?.style.setProperty(name, value); } + optionHaloNode?.toggleAttribute("data-agent-hot", projection.hover > 0.2); } }, []); @@ -1640,6 +1653,7 @@ function AgentConstellation({ } function handleAgentPointerEnter(agentId: string, event: React.PointerEvent) { + setHoveredAgentId(agentId); rendererRef.current?.setPointerClient(event.clientX, event.clientY); rendererRef.current?.setHoveredAgent(agentId); } @@ -1649,6 +1663,7 @@ function AgentConstellation({ } function handleAgentPointerLeave() { + setHoveredAgentId(null); rendererRef.current?.setHoveredAgent(null); } @@ -1657,6 +1672,25 @@ function AgentConstellation({ rendererRef.current?.acknowledgeAgent(agentId, "touch"); } + function handleOptionClick(event: React.MouseEvent, optionKey: string) { + event.stopPropagation(); + const option = optionByKeyRef.current.get(optionKey); + if (option) { + onAgentOption?.(option); + } + } + + function optionPositionStyle(index: number, count: number): React.CSSProperties { + const arc = Math.min(Math.PI * 1.2, Math.max(Math.PI * 0.7, count * 0.34)); + const start = -Math.PI / 2 - arc / 2; + const angle = start + (arc * (index + 0.5)) / Math.max(count, 1); + const radius = 92; + return { + left: `calc(50% + ${Math.cos(angle) * radius}px)`, + top: `calc(50% + ${Math.sin(angle) * radius}px)`, + }; + } + function handleCanvasClick() { const optionKey = rendererRef.current?.pickOption(); if (optionKey) { @@ -1724,6 +1758,7 @@ function AgentConstellation({ onPointerMove={handleAgentPointerMove} onPointerLeave={handleAgentPointerLeave} onMouseEnter={(event) => { + setHoveredAgentId(agent.id); rendererRef.current?.setPointerClient(event.clientX, event.clientY); rendererRef.current?.setHoveredAgent(agent.id); }} @@ -1769,6 +1804,48 @@ function AgentConstellation({ {agent.thought} ))} + {aquariumAgents.map((agent) => { + const options = agent.options ?? []; + if (!options.length) return null; + const open = selectedAgentId === agent.id || hoveredAgentId === agent.id; + return ( +
bindOptionHaloNode(agent.id, node)} + data-agent-options={agent.id} + onPointerEnter={(event) => { + setHoveredAgentId(agent.id); + rendererRef.current?.setPointerClient(event.clientX, event.clientY); + rendererRef.current?.setHoveredAgent(agent.id); + }} + onPointerMove={(event) => rendererRef.current?.setPointerClient(event.clientX, event.clientY)} + onPointerLeave={handleAgentPointerLeave} + style={ + { + "--agent-x": `${agent.baseX}%`, + "--agent-y": `${agent.baseY}%`, + "--agent-color": agent.color, + "--agent-glow": agent.glow, + } as React.CSSProperties + } + > + {options.map((option, index) => ( + + ))} +
+ ); + })}
{selectedAgent.title} diff --git a/apps/epiphany-gui/src/aquariumFluid.ts b/apps/epiphany-gui/src/aquariumFluid.ts index 4fd483dc..1ef61329 100644 --- a/apps/epiphany-gui/src/aquariumFluid.ts +++ b/apps/epiphany-gui/src/aquariumFluid.ts @@ -1006,8 +1006,6 @@ class WebglAquariumRenderer implements AquariumRenderer { } if (activeAgent && paintAgentChrome) { this.drawThoughtSource(ctx, activeAgent); - } - if (activeAgent) { this.drawOptionsSource(ctx, activeAgent, paintAgentChrome); } this.drawParameterImpulseSource(ctx, time); diff --git a/apps/epiphany-gui/src/styles.css b/apps/epiphany-gui/src/styles.css index 38df37ac..39d1c89e 100644 --- a/apps/epiphany-gui/src/styles.css +++ b/apps/epiphany-gui/src/styles.css @@ -936,7 +936,8 @@ body:has(.immersiveShell) { } .agentCharacter, -.thoughtBubble { +.thoughtBubble, +.agentOptionHalo { left: var(--agent-x); top: var(--agent-y); } @@ -1117,6 +1118,81 @@ body:has(.immersiveShell) { -webkit-line-clamp: 3; } +.agentOptionHalo { + position: absolute; + z-index: 6; + width: 220px; + height: 220px; + border: 0; + background: transparent; + box-shadow: none; + opacity: 0; + pointer-events: none; + contain: layout style; + transform: + translate(-50%, -50%) + rotate(calc(var(--agent-tilt, 0deg) * 0.18)) + scale(calc(0.92 + var(--agent-hover, 0) * 0.04)); + transition: + opacity 150ms ease, + filter 150ms ease, + transform 150ms ease; + filter: drop-shadow(0 0 12px color-mix(in srgb, var(--agent-glow) 34%, transparent)); +} + +.agentStage .agentOptionHalo.open, +.agentStage .agentOptionHalo[data-agent-hot] { + opacity: 1 !important; +} + +.agentOptionButton { + appearance: none; + position: absolute; + display: block; + pointer-events: auto; + min-width: 74px; + height: 29px; + border: 1px solid color-mix(in srgb, var(--agent-glow) 58%, rgba(255, 255, 255, 0.36)); + border-radius: 999px; + padding: 0 12px; + color: #fbfff8; + background: + radial-gradient(circle at 32% 20%, rgba(255, 255, 255, 0.18), transparent 18px), + color-mix(in srgb, var(--agent-color) 56%, rgba(5, 12, 9, 0.74)); + box-shadow: + 0 0 16px color-mix(in srgb, var(--agent-color) 28%, transparent), + inset 0 -7px 12px rgba(3, 8, 6, 0.26); + cursor: pointer; + font-size: 0.62rem; + font-weight: 900; + letter-spacing: 0; + line-height: 1; + text-transform: uppercase; + text-shadow: 0 1px 7px rgba(3, 8, 6, 0.76); + white-space: nowrap; + transform: translate(-50%, -50%); + transition: + border-color 140ms ease, + box-shadow 140ms ease, + opacity 140ms ease, + transform 140ms ease; +} + +.agentOptionButton:hover, +.agentOptionButton:focus-visible { + border-color: rgba(255, 255, 255, 0.82); + box-shadow: + 0 0 24px color-mix(in srgb, var(--agent-glow) 52%, transparent), + inset 0 -7px 12px rgba(3, 8, 6, 0.2); + outline: none; + transform: translate(-50%, -50%) scale(1.04); +} + +.agentOptionButton:disabled { + cursor: default; + opacity: 0.38; +} + .constellationInspector { position: absolute; z-index: 5;