diff --git a/apps/epiphany-gui/scripts/visual-smoke.mjs b/apps/epiphany-gui/scripts/visual-smoke.mjs index 67e94834..3a90c3d9 100644 --- a/apps/epiphany-gui/scripts/visual-smoke.mjs +++ b/apps/epiphany-gui/scripts/visual-smoke.mjs @@ -49,7 +49,7 @@ async function smokeViewport(browser, viewport, screenshotPath) { const page = await browser.newPage({ viewport }); await page.goto(url, { waitUntil: "networkidle" }); await page.getByRole("heading", { name: "Operator Console" }).waitFor(); - await page.getByRole("heading", { name: "Agent State", exact: true }).waitFor(); + await page.locator(".immersiveShell").waitFor(); await page.getByRole("button", { name: "Self prepareCheckpoint" }).waitFor(); await page.locator(".agentSmokeCanvas").waitFor(); await page.waitForTimeout(350); @@ -81,16 +81,10 @@ async function smokeViewport(browser, viewport, screenshotPath) { if (!canvasProbe.nonBlank) { throw new Error(`agent smoke canvas did not render: ${canvasProbe.reason}`); } - await page.getByRole("heading", { name: "Environment" }).waitFor(); - await page.getByText("Unity Editor").waitFor(); - await page.getByRole("heading", { name: "Rider", exact: true }).waitFor(); - await page.getByText("Aetheria.sln").waitFor(); - await page.getByRole("heading", { name: "Planning", exact: true }).waitFor(); - await page.getByRole("heading", { name: "Build the planning dashboard slice", exact: true }).waitFor(); - await page.getByRole("heading", { name: "State Graph", exact: true }).waitFor(); - await page.getByText("Epiphany Typed Graph").waitFor(); - await page.getByText("Role Lanes").waitFor(); - await page.getByText("Artifact Bundles").waitFor(); + await page.getByRole("button", { name: "Command" }).waitFor(); + await page.getByRole("button", { name: "State" }).waitFor(); + await page.getByRole("button", { name: "Agents" }).waitFor(); + await page.getByRole("button", { name: "Artifacts" }).waitFor(); await page.getByRole("button", { name: "Prepare Checkpoint" }).waitFor(); await page.getByRole("button", { name: "Inspect Rider" }).waitFor(); await page.getByRole("button", { name: "Adopt Draft" }).waitFor(); @@ -103,6 +97,25 @@ async function smokeViewport(browser, viewport, screenshotPath) { await page.getByRole("button", { name: "Launch Reorient" }).waitFor(); await page.getByRole("button", { name: "Read Reorient" }).waitFor(); await page.getByRole("button", { name: "Accept Reorient" }).waitFor(); + await page.getByRole("button", { name: "State" }).click(); + await page.getByRole("button", { name: "environment" }).waitFor(); + await page.getByText("Unity Editor").waitFor(); + await page.getByRole("heading", { name: "Rider", exact: true }).waitFor(); + await page.getByText("Aetheria.sln").waitFor(); + await page.getByRole("button", { name: "planning" }).click(); + await page.getByRole("heading", { name: "Build the planning dashboard slice", exact: true }).waitFor(); + await page.getByRole("button", { name: "graph" }).click(); + await page.getByText("Epiphany Typed Graph").waitFor(); + await page.getByRole("button", { name: "Agents" }).click(); + await page.getByRole("button", { name: "lanes" }).waitFor(); + await page.getByRole("heading", { name: "Implementation", exact: true }).waitFor(); + await page.getByRole("button", { name: "findings" }).click(); + await page.getByRole("heading", { name: "Imagination / Planning", exact: true }).waitFor(); + await page.getByRole("button", { name: "jobs" }).click(); + await page.getByText("retrieval-index").waitFor(); + await page.getByRole("button", { name: "Artifacts" }).click(); + await page.getByText("runtime/unity-inspect-sample").waitFor(); + await page.getByRole("button", { name: "Command" }).click(); if (viewport.width >= 900) { await page.getByRole("button", { name: "Status Snapshot" }).click(); await page.getByText("statusSnapshot sample completed.").waitFor(); @@ -124,15 +137,35 @@ async function smokeViewport(browser, viewport, screenshotPath) { const result = await page.evaluate(() => { const elements = Array.from(document.querySelectorAll("h1, h2, h3, p, dd, code, button, input, .pill")); const overlaps = []; + function isPaintedAtSample(element, rect) { + const style = window.getComputedStyle(element); + if (style.visibility === "hidden" || style.display === "none" || Number(style.opacity) === 0) { + return false; + } + const points = [ + [rect.left + rect.width / 2, rect.top + rect.height / 2], + [rect.left + Math.min(8, rect.width / 2), rect.top + rect.height / 2], + [rect.right - Math.min(8, rect.width / 2), rect.top + rect.height / 2], + [rect.left + rect.width / 2, rect.top + Math.min(8, rect.height / 2)], + [rect.left + rect.width / 2, rect.bottom - Math.min(8, rect.height / 2)], + ]; + return points.some(([x, y]) => { + if (x < 0 || y < 0 || x > window.innerWidth || y > window.innerHeight) return false; + const hit = document.elementFromPoint(x, y); + return hit === element || Boolean(hit && element.contains(hit)); + }); + } for (let index = 0; index < elements.length; index += 1) { const left = elements[index]; const a = elements[index].getBoundingClientRect(); if (a.width === 0 || a.height === 0) continue; + if (!isPaintedAtSample(left, a)) continue; for (let other = index + 1; other < elements.length; other += 1) { const right = elements[other]; if (left.contains(right) || right.contains(left)) continue; const b = elements[other].getBoundingClientRect(); if (b.width === 0 || b.height === 0) continue; + if (!isPaintedAtSample(right, b)) continue; const x = Math.min(a.right, b.right) - Math.max(a.left, b.left); const y = Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top); if (x > 2 && y > 2) { diff --git a/apps/epiphany-gui/src/App.tsx b/apps/epiphany-gui/src/App.tsx index a56dad74..23e27cb7 100644 --- a/apps/epiphany-gui/src/App.tsx +++ b/apps/epiphany-gui/src/App.tsx @@ -129,13 +129,22 @@ const constellationSpecs = [ ] as const; const compactConstellationPositions: Record = { - coordinator: { x: 50, y: 10 }, - imagination: { x: 14, y: 20 }, - research: { x: 86, y: 20 }, - reorientation: { x: 50, y: 29 }, - modeling: { x: 14, y: 38 }, - verification: { x: 86, y: 38 }, - implementation: { x: 50, y: 48 }, + coordinator: { x: 50, y: 25 }, + imagination: { x: 14, y: 34 }, + research: { x: 86, y: 34 }, + reorientation: { x: 50, y: 43 }, + modeling: { x: 14, y: 52 }, + verification: { x: 86, y: 52 }, + implementation: { x: 50, y: 61 }, +}; +const fullscreenConstellationPositions: Record = { + coordinator: { x: 70, y: 30 }, + imagination: { x: 60, y: 18 }, + research: { x: 90, y: 24 }, + reorientation: { x: 82, y: 42 }, + modeling: { x: 64, y: 55 }, + verification: { x: 92, y: 58 }, + implementation: { x: 76, y: 66 }, }; type ConstellationSpec = (typeof constellationSpecs)[number]; @@ -148,6 +157,19 @@ type ProjectedAgent = ConstellationSpec & { jobs: number; review: string; }; +const deckSubmenus = { + command: ["run", "connection", "signals"], + state: ["environment", "planning", "graph"], + agents: ["lanes", "findings", "jobs"], + artifacts: ["bundles"], +} as const; +const deckLabels: Record = { + command: "Command", + state: "State", + agents: "Agents", + artifacts: "Artifacts", +}; +type DeckId = keyof typeof deckSubmenus; const actionButtons: Array<{ action: OperatorAction; label: string; @@ -507,6 +529,13 @@ function useSnapshot() { export function App() { const { snapshot, loading, error, request, setRequest, refresh, actionResult, runningAction, runAction } = useSnapshot(); const [selectedCodeRef, setSelectedCodeRef] = useState(null); + const [activeDeck, setActiveDeck] = useState("command"); + const [subdeckByDeck, setSubdeckByDeck] = useState>({ + command: "run", + state: "environment", + agents: "lanes", + artifacts: "bundles", + }); const status = snapshot?.status; const scene = status?.scene?.scene ?? {}; const pressure = status?.pressure?.pressure ?? {}; @@ -574,6 +603,71 @@ export function App() { const riderInstallations = latestRiderAudit?.installations ?? []; const riderSearchRoots = latestRiderAudit?.searchRoots ?? []; const riderChangedFiles = latestRiderAudit?.vcs?.changedFiles ?? []; + const activeSubdeck = subdeckByDeck[activeDeck]; + const activeDeckTitle = deckLabels[activeDeck]; + const graphMenuActive = activeDeck === "state" && activeSubdeck === "graph"; + + function selectDeck(deck: DeckId) { + setActiveDeck(deck); + } + + function selectSubdeck(deck: DeckId, subdeck: string) { + setSubdeckByDeck((current) => ({ ...current, [deck]: subdeck })); + } + + const actionControls = actionButtons.map((button) => { + const needsThread = button.requiresThread && !currentThreadId; + const needsState = button.requiresReadyState && !readyState; + const needsImagination = button.requiresImaginationPatch && !canAcceptImagination; + const needsModeling = button.requiresModelingPatch && !canAcceptModeling; + const needsVerification = button.requiresVerificationResult && !canAcceptVerification; + const needsReorient = button.requiresReorientResult && !canAcceptReorient; + const needsPlanningDraft = button.requiresPlanningDraft && !canAdoptDraft; + const needsImplementation = button.requiresContinueImplementation && !canContinueImplementation; + const needsNoDiffReview = button.requiresContinueImplementation && implementationNoDiffPending; + const disabled = + runningAction !== null || + needsThread || + needsState || + needsImagination || + needsModeling || + needsVerification || + needsReorient || + needsPlanningDraft || + needsImplementation || + needsNoDiffReview; + const title = needsThread + ? "Prepare a checkpoint or enter a persisted thread id first" + : needsState + ? "Prepare Epiphany state before launching this lane" + : needsImagination + ? "Read a completed imagination result with a planning patch before accepting it" + : needsModeling + ? "Read a completed modeling result with a state patch before accepting it" + : needsVerification + ? "Read a completed verification result before accepting it" + : needsReorient + ? "Read a completed reorient result before accepting it" + : needsPlanningDraft + ? "Select a draft objective that has not already been adopted" + : needsImplementation + ? "Run the coordinator and clear review gates before continuing implementation" + : needsNoDiffReview + ? "Review the latest no-diff implementation artifact or run another lane before retrying" + : button.title; + return ( + + ); + }); useEffect(() => { if (objectiveDrafts.length === 0) return; @@ -590,136 +684,7 @@ export function App() { }, [objectiveDrafts, setRequest]); return ( -
-
-
-

Epiphany MVP

-

Operator Console

-
- -
- -
- - -
- -
- {actionButtons.map((button) => { - const needsThread = button.requiresThread && !currentThreadId; - const needsState = button.requiresReadyState && !readyState; - const needsImagination = button.requiresImaginationPatch && !canAcceptImagination; - const needsModeling = button.requiresModelingPatch && !canAcceptModeling; - const needsVerification = button.requiresVerificationResult && !canAcceptVerification; - const needsReorient = button.requiresReorientResult && !canAcceptReorient; - const needsPlanningDraft = button.requiresPlanningDraft && !canAdoptDraft; - const needsImplementation = button.requiresContinueImplementation && !canContinueImplementation; - const needsNoDiffReview = button.requiresContinueImplementation && implementationNoDiffPending; - const disabled = - runningAction !== null || - needsThread || - needsState || - needsImagination || - needsModeling || - needsVerification || - needsReorient || - needsPlanningDraft || - needsImplementation || - needsNoDiffReview; - const title = needsThread - ? "Prepare a checkpoint or enter a persisted thread id first" - : needsState - ? "Prepare Epiphany state before launching this lane" - : needsImagination - ? "Read a completed imagination result with a planning patch before accepting it" - : needsModeling - ? "Read a completed modeling result with a state patch before accepting it" - : needsVerification - ? "Read a completed verification result before accepting it" - : needsReorient - ? "Read a completed reorient result before accepting it" - : needsPlanningDraft - ? "Select a draft objective that has not already been adopted" - : needsImplementation - ? "Run the coordinator and clear review gates before continuing implementation" - : needsNoDiffReview - ? "Review the latest no-diff implementation artifact or run another lane before retrying" - : button.title; - return ( - - ); - })} - {actionResult && ( -

- {actionResult.summary} {actionResult.artifactPath} -

- )} -
- - {error && ( -
-
- )} - - {latestImplementationAudit && ( -
- {latestImplementationAudit.workspaceChanged ? ( -
- )} - - {latestRuntimeAudit && ( -
- {latestRuntimeAudit.status === "ready" ? ( -
- )} - +
+
); } @@ -1050,6 +1133,7 @@ function AgentConstellation({ pressure, reorient, jobs, + variant = "band", }: { roles: any[]; roleResults: any; @@ -1059,6 +1143,7 @@ function AgentConstellation({ pressure: any; reorient: any; jobs: any[]; + variant?: "band" | "fullscreen"; }) { const rootRef = useRef(null); const canvasRef = useRef(null); @@ -1139,10 +1224,11 @@ function AgentConstellation({ function projectAgent(agent: (typeof agentData)[number], time: number, width: number, height: number) { const compactPosition = width < 540 ? compactConstellationPositions[agent.id] : undefined; - const baseX = compactPosition?.x ?? agent.baseX; - const baseY = compactPosition?.y ?? agent.baseY; + const fullscreenPosition = variant === "fullscreen" ? fullscreenConstellationPositions[agent.id] : undefined; + const baseY = compactPosition?.y ?? fullscreenPosition?.y ?? agent.baseY; + const resolvedBaseX = compactPosition?.x ?? fullscreenPosition?.x ?? agent.baseX; const x = - (baseX / 100) * width + + (resolvedBaseX / 100) * width + Math.sin(time * 0.42 + agent.phase) * agent.driftX * 2.8 + Math.cos(time * 0.19 + agent.phase * 0.7) * agent.activity * 4.5; const y = @@ -1336,20 +1422,22 @@ void main() { gl.deleteVertexArray(vao); gl.deleteProgram(program); }; - }, [agents]); + }, [agents, variant]); return ( -
-
- } /> -
- - {text(coordinator?.action ?? crrc?.action, "unknown")} - - pressure {text(pressure?.level, "unknown")} - continuity {text(reorient?.action, "unknown")} +
+ {variant === "band" && ( +
+ } /> +
+ + {text(coordinator?.action ?? crrc?.action, "unknown")} + + pressure {text(pressure?.level, "unknown")} + continuity {text(reorient?.action, "unknown")} +
-
+ )}