diff --git a/packages/website/e2e/mockups.spec.ts b/packages/website/e2e/mockups.spec.ts index 82a440fa1..8ae8a9c27 100644 --- a/packages/website/e2e/mockups.spec.ts +++ b/packages/website/e2e/mockups.spec.ts @@ -6,7 +6,7 @@ const desktopName = async function openHomepage(page: Page) { await page.setViewportSize({ width: 1512, height: 930 }); await page.goto("/"); - await expect(page.getByRole("button", { name: "Parallel agents", exact: true })).toBeVisible(); + await expect(page.getByRole("button", { name: "Orchestration", exact: true })).toBeVisible(); } async function viewPhones(page: Page) { @@ -60,6 +60,227 @@ test("desktop mockup corners shrink in proportion on a phone", async ({ page }) await expect.poll(() => cornerProportion(mockup)).toBeCloseTo(desktopCorner, 3); }); +/** Each hero pill and one thing only its finished scene draws. */ +const HERO_SCENES = [ + { pill: "Orchestration", shows: "Pi · GLM-5.2" }, + { pill: "Remote", shows: "Tailscale" }, + { pill: "Code review", shows: "Feedback sent to Codex" }, + { pill: "Pull requests", shows: "https://github.com/getpaseo/paseo/pull/3981" }, + { pill: "Plugins", shows: "app-tests (macos)" }, +]; + +/** Clicks a hero pill until its scene starts. A click before hydration selects nothing. */ +async function playScene(page: Page, pill: string, opensWith: Locator) { + await expect(async () => { + await page.getByRole("button", { name: pill, exact: true }).click(); + await expect(opensWith).toBeVisible({ timeout: 500 }); + }).toPass({ timeout: 10_000 }); +} + +test("each hero pill shows its finished scene when motion is reduced", async ({ page }) => { + await page.emulateMedia({ reducedMotion: "reduce" }); + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + await mockup.scrollIntoViewIfNeeded(); + // Last to first, so the opening scene is also reached by a click. + for (const scene of HERO_SCENES.toReversed()) { + await playScene(page, scene.pill, mockup.getByText(scene.shows, { exact: true }).first()); + } +}); + +test("the hero opens on orchestration across providers and machines", async ({ page }) => { + await page.emulateMedia({ reducedMotion: "reduce" }); + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + await expect(page.getByRole("button", { name: "Orchestration", exact: true })).toHaveAttribute( + "aria-pressed", + "true", + ); + for (const agent of ["Codex · GPT-5.6-Sol", "OpenCode · Kimi K3", "Pi · GLM-5.2"]) { + await expect(mockup.getByText(agent, { exact: true })).toBeVisible(); + } + // The task on another machine carries that host's badge in its tool call and its subagent row. + for (const remoteTask of ["OpenCode · fix/menu-bar-icon", "OpenCode · Kimi K3"]) { + const row = mockup.getByText(remoteTask, { exact: true }).locator("xpath=.."); + await expect(row.getByText("mac-mini", { exact: true })).toBeVisible(); + } +}); + +test("the orchestration scene plays from an empty chat to the open roster of subagents", async ({ + page, +}) => { + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + const composer = mockup.getByText("Message the agent, tag @files, or use /commands and /skills"); + await playScene(page, "Orchestration", composer); + await expect(mockup.getByText("Create agent", { exact: true })).toHaveCount(0); + await expect(mockup.getByText("3 subagents", { exact: true })).toHaveCount(0); + + // The orchestrator lists the issues and the agent profiles, launches three agents and says so, + // then the pointer clicks the pill and the roster opens. + await expect(mockup.getByText("3 subagents", { exact: true })).toBeVisible({ timeout: 20_000 }); + await expect(mockup.getByText("gh issue list --label ready", { exact: true })).toBeVisible(); + await expect(mockup.getByText("List agent profiles", { exact: true })).toBeVisible(); + await expect( + mockup.getByText( + "I will launch the UI agent on your mac-mini, because that issue is specific to macOS.", + ), + ).toBeVisible(); + await expect(mockup.getByText("Create agent", { exact: true })).toHaveCount(3); + await expect( + mockup.getByText("All three are launched. Paseo will notify me when each one finishes."), + ).toBeVisible(); + await expect(mockup.getByText("Pi · GLM-5.2", { exact: true })).toBeVisible({ timeout: 10_000 }); +}); + +test("the opening scene waits until most of the mockup is on screen", async ({ page }) => { + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + const request = mockup.getByText("Fix the issues labeled ready, one worktree each."); + await expect(mockup).not.toBeInViewport({ ratio: 0.6 }); + + // A scene that started at load sends the request within three seconds. + await page.waitForTimeout(4500); + await expect(request).toHaveCount(0); + + await mockup.scrollIntoViewIfNeeded(); + await expect(request).toBeVisible({ timeout: 10_000 }); +}); + +test("the opening scene starts in a window shorter than most of the mockup", async ({ page }) => { + await page.setViewportSize({ width: 1400, height: 400 }); + await page.goto("/"); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + const request = mockup.getByText("Fix the issues labeled ready, one worktree each."); + await mockup.scrollIntoViewIfNeeded(); + await expect(mockup).not.toBeInViewport({ ratio: 0.6 }); + await expect(request).toBeVisible({ timeout: 10_000 }); +}); + +test("the plugins scene installs the panel, then changes it on request", async ({ page }) => { + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + const changesPanel = mockup.getByText("Uncommitted", { exact: true }); + const pluginPanel = mockup.getByText("Recently merged", { exact: true }); + const failingCheck = mockup.getByText("app-tests (macos)", { exact: true }); + await playScene(page, "Plugins", page.getByRole("button", { name: "Plugins", pressed: true })); + await expect(changesPanel).toBeVisible(); + await expect(pluginPanel).toHaveCount(0); + + // Installing the plugin swaps the docked panel for the one the agent built. + await expect(pluginPanel).toBeVisible({ timeout: 20_000 }); + await expect(changesPanel).toHaveCount(0); + await expect(failingCheck).toHaveCount(0); + + // The second request reloads the plugin and the open panel lists the failing check. + await expect(failingCheck).toBeVisible({ timeout: 15_000 }); + await expect( + mockup.getByText("paseo plugin reload release-radar", { exact: true }), + ).toBeVisible(); +}); + +test("the code review scene comments on a line and sends the feedback to an agent", async ({ + page, +}) => { + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + const comment = mockup.getByText("Add “write”. The agent edits files too.", { exact: true }); + const sendFeedback = mockup.getByText("Send feedback (1)", { exact: true }); + await playScene( + page, + "Code review", + page.getByRole("button", { name: "Code review", pressed: true }), + ); + await expect(comment).toHaveCount(0); + + // The pointer opens the editor on a line, and the typed comment is saved under that line. + await expect(sendFeedback).toBeVisible({ timeout: 10_000 }); + await expect(comment).toBeVisible(); + + // Send feedback asks which agent, and the sent comment leaves the diff. + await expect(mockup.getByText("Claude Code", { exact: true })).toHaveCount(2, { + timeout: 10_000, + }); + await expect(mockup.getByText("Feedback sent to Codex", { exact: true })).toBeVisible({ + timeout: 10_000, + }); + await expect(sendFeedback).toHaveCount(0); + await expect(comment).toHaveCount(0); +}); + +test("picking a scene brings the pills and the whole mockup on screen", async ({ page }) => { + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + await expect(mockup).not.toBeInViewport({ ratio: 0.9 }); + + await playScene(page, "Remote", page.getByRole("button", { name: "Remote", pressed: true })); + await expect(mockup).toBeInViewport({ ratio: 0.99 }); + await expect(page.getByRole("button", { name: "Remote", exact: true })).toBeInViewport({ + ratio: 1, + }); +}); + +test("picking a scene in a window too short for the mockup keeps the pills on screen", async ({ + page, +}) => { + await openHomepage(page); + await page.setViewportSize({ width: 1280, height: 600 }); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + await expect(mockup).not.toBeInViewport(); + + await playScene(page, "Remote", page.getByRole("button", { name: "Remote", pressed: true })); + await expect(mockup).toBeInViewport({ ratio: 0.7 }); + await expect(page.getByRole("button", { name: "Remote", exact: true })).toBeInViewport({ + ratio: 1, + }); +}); + +test("picking a scene while the hero is still sliding in keeps the pills on screen", async ({ + page, +}) => { + // Reduced motion makes the scroll instant, so the test does not wait for one to settle. + await page.emulateMedia({ reducedMotion: "reduce" }); + await page.setViewportSize({ width: 1280, height: 700 }); + await page.goto("/"); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + await playScene(page, "Remote", page.getByRole("button", { name: "Remote", pressed: true })); + + // The hero slides up 40px as it enters. The test waits for that to end, puts the same 40px back + // on the container, picks a scene, and lets the slide end again. A click during a real slide + // does the same, but only inside the first second after load. + const sliding = page + .getByRole("button", { name: "Remote", exact: true }) + .locator("xpath=../../../.."); + await expect(sliding).toHaveCSS("transform", "none"); + await page.evaluate(() => window.scrollTo(0, 0)); + await expect(mockup).not.toBeInViewport({ ratio: 0.99 }); + const slideBy = (pixels: number) => + sliding.evaluate((container, y) => { + container.style.transform = y === 0 ? "none" : `translateY(${y}px)`; + }, pixels); + + const codeReview = page.getByRole("button", { name: "Code review", exact: true }); + await slideBy(40); + await codeReview.click(); + await slideBy(0); + expect(await page.evaluate(() => window.scrollY)).toBeGreaterThan(0); + await expect(codeReview).toBeInViewport({ ratio: 1 }); +}); + +test("the remote scene lists hosts with how each connects and its round trip time", async ({ + page, +}) => { + await openHomepage(page); + const mockup = page.getByRole("img", { name: desktopName, exact: true }); + await expect(async () => { + await page.getByRole("button", { name: "Remote", exact: true }).click(); + await expect(mockup.getByText("Hosts", { exact: true })).toBeVisible({ timeout: 500 }); + }).toPass({ timeout: 10_000 }); + for (const fact of ["Local", "Relay", "Tailscale", "SSH", "38ms", "mo@workstation"]) { + await expect(mockup.getByText(fact, { exact: true })).toBeVisible(); + } +}); + /** Opacity as rendered: the element's own times every ancestor's. */ async function renderedOpacity(locator: Locator) { return locator.evaluate((element) => { diff --git a/packages/website/src/components/hero-mockup.tsx b/packages/website/src/components/hero-mockup.tsx index 1249d5c3d..6a3e0a219 100644 --- a/packages/website/src/components/hero-mockup.tsx +++ b/packages/website/src/components/hero-mockup.tsx @@ -1,24 +1,57 @@ -import { motion } from "framer-motion"; -import { useCallback, useState } from "react"; +import { motion, useInView, useReducedMotion } from "framer-motion"; +import { useCallback, useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { - DEFAULT_MOCKUP_STATE, + createMockupPlayer, DESIGN_HEIGHT, DESIGN_WIDTH, MOCKUP_STATES, type MockupStateId, MockupWindow, ScaledMockup, + useMockupScene, } from "~/components/mockup"; +const IN_VIEW = { once: true }; +/** How far down the mockup its start line sits. */ +const START_LINE = "60%"; +/** The space left between the top or bottom of the window and the pills or the mockup. */ +const PAGE_MARGIN = 16; +const START_LINE_STYLE = { top: START_LINE }; const PILL_TRANSITION = { duration: 0.34, ease: [0.22, 0.61, 0.36, 1] as const }; export function HeroMockup() { const { t } = useTranslation(); - const [state, setState] = useState(DEFAULT_MOCKUP_STATE); + const [player] = useState(createMockupPlayer); + const state = useMockupScene(player); + + // The opening scene plays once most of the mockup is on screen, so a visitor who scrolls to it + // sees it from the start. "Most" is a line 60% of the way down the mockup. A window shorter than + // 60% of the mockup still reaches the line, which a share of the mockup on screen would not. + // With reduced motion there is nothing to miss, so the finished scene shows at once. + const frame = useRef(null); + const startLine = useRef(null); + const reduceMotion = useReducedMotion(); + const onScreen = useInView(startLine, IN_VIEW); + const ready = onScreen || reduceMotion === true; + useEffect(() => { + if (ready) player.start(); + }, [ready, player]); + useEffect(() => player.stop, [player]); + + // The pills can sit above a mockup that is partly below the fold, most of all on a phone. + // Picking a scene brings the pills and the mockup on screen together. A window too short for + // both keeps the pills at its top edge, so the next pill is still in reach. + const select = useCallback( + (scene: MockupStateId) => { + player.select(scene); + if (frame.current) scrollOnScreen(frame.current, reduceMotion ? "auto" : "smooth"); + }, + [player, reduceMotion], + ); return ( -
+
{MOCKUP_STATES.map((option) => ( ))}
- - - +
+
); } +/** Where an element sits in the window, from layout alone. A slide-in that is still running does not count. */ +function layoutRect(element: HTMLElement) { + let top = -window.scrollY; + for (let node: Element | null = element; node instanceof HTMLElement; node = node.offsetParent) { + top += node.offsetTop; + } + return { top, bottom: top + element.offsetHeight }; +} + +/** + * Scrolls the least that shows all of an element, and never past the point where its top edge is + * at the top of the window. The element is measured where it settles, because the hero slides up + * as it enters and a click can come before it stops. + */ +function scrollOnScreen(element: HTMLElement, behavior: ScrollBehavior) { + const { top, bottom } = layoutRect(element); + const aboveWindow = top - PAGE_MARGIN; + const belowWindow = bottom + PAGE_MARGIN - window.innerHeight; + const distance = aboveWindow < 0 ? aboveWindow : Math.min(Math.max(belowWindow, 0), aboveWindow); + if (distance !== 0) window.scrollBy({ top: distance, behavior }); +} + function StatePill({ id, label, diff --git a/packages/website/src/components/landing-page.tsx b/packages/website/src/components/landing-page.tsx index 77869e737..d6fa15f3d 100644 --- a/packages/website/src/components/landing-page.tsx +++ b/packages/website/src/components/landing-page.tsx @@ -714,8 +714,8 @@ function AutomationDetail({ kind }: { kind: AutomationKind }) { } const MCP_AGENT_CALLS: ToolCall[] = [ - { kind: "paseo", label: "Create agent", detail: "Fix #412: retry flaky relay handshake" }, - { kind: "paseo", label: "Create agent", detail: "Fix #417: group schedules by project" }, + { kind: "paseo", label: "Create agent", detail: "Fix #412: relay handshake race" }, + { kind: "paseo", label: "Create agent", detail: "Fix #417: menu bar icon on macOS" }, ]; function McpAutomationTranscript() { diff --git a/packages/website/src/components/mockup/atoms.tsx b/packages/website/src/components/mockup/atoms.tsx index c90310be7..02f060b33 100644 --- a/packages/website/src/components/mockup/atoms.tsx +++ b/packages/website/src/components/mockup/atoms.tsx @@ -18,6 +18,13 @@ export function DiffStat({ add, remove }: { add: string; remove: string }) { ); } +/** The text caret of an input that has focus. */ +export function Caret({ className }: { className: string }) { + return ( + + ); +} + export type DotTone = "success" | "danger" | "warning" | "running" | "idle"; const DOT_TONE: Record = { diff --git a/packages/website/src/components/mockup/chat.tsx b/packages/website/src/components/mockup/chat.tsx index dc951a851..167d55acb 100644 --- a/packages/website/src/components/mockup/chat.tsx +++ b/packages/website/src/components/mockup/chat.tsx @@ -15,15 +15,19 @@ import { SquareTerminal, Zap, } from "lucide-react"; +import { motion } from "framer-motion"; import type * as React from "react"; import { useTranslation } from "react-i18next"; -import { DiffStat } from "./atoms"; -import { CodexIcon, PaseoMark } from "./icons"; - -// Icons passed as props are hoisted so they are not rebuilt on every render. -const MODEL_ICON = ; -const EFFORT_ICON = ; -const ACCESS_ICON = ; +import { Caret, DiffStat } from "./atoms"; +import { HostBadge } from "./hosts"; +import { PaseoMark } from "./icons"; +import { FADE_IN, FADE_OUT } from "./motion"; +import { DELEGATED_TASKS, SUBAGENTS_CLICK, tasksDelegated } from "./orchestration"; +import { useSceneClock } from "./player"; +import { Pointer } from "./pointer"; +import { PROVIDERS, type ProviderId } from "./providers"; +import { COMPOSER, type SceneScript, type ToolCall, type TranscriptEntry } from "./script"; +import type { MockupStateId } from "./states"; // --- transcript ------------------------------------------------------------- @@ -62,6 +66,38 @@ function TurnFooter({ duration }: { duration: string }) { ); } +const BUILT_IN_LABELS = { read: "Read", write: "Write", shell: "Shell" } as const; + +function toolCallLabel(call: ToolCall): string { + return call.kind === "paseo" ? call.label : BUILT_IN_LABELS[call.kind]; +} + +function ToolCallIcon({ kind }: { kind: ToolCall["kind"] }) { + if (kind === "read") return ; + if (kind === "write") return ; + if (kind === "paseo") return ; + return ; +} + +/** + * One tool call row, drawn like the app's collapsed timeline item + * (`packages/app/src/components/message.tsx`): icon, label, then the summary, + * all muted and in the UI font. A Paseo call that targets another machine ends + * with that host's badge, which the app's row does not draw. + */ +export function ToolCallRow({ call }: { call: ToolCall }) { + return ( +
+ + + + {toolCallLabel(call)} + {call.detail ? {call.detail} : null} + {call.kind === "paseo" && call.host ? : null} +
+ ); +} + export function AgentTranscript() { return (
@@ -88,161 +124,273 @@ export function AgentTranscript() { Includes responsive mobile proof and the supporting homepage story. Formatting, typecheck, and lint are clean.
- Ready for review.
); } -/** - * A collapsed tool call as the app's timeline shows it. Built-in tools carry a - * fixed label; Paseo MCP tools name their action, such as "Create agent". - */ -export type ToolCall = - | { kind: "read" | "write" | "shell"; detail: string } - | { kind: "paseo"; label: string; detail: string }; - -const BUILT_IN_LABELS = { read: "Read", write: "Write", shell: "Shell" } as const; - -function toolCallLabel(call: ToolCall): string { - return call.kind === "paseo" ? call.label : BUILT_IN_LABELS[call.kind]; -} - -const PLUGIN_TOOL_CALLS: ToolCall[] = [ - { kind: "read", detail: "paseo-plugin/SKILL.md" }, - { kind: "shell", detail: "paseo plugin init ~/dev/release-radar" }, - { kind: "write", detail: "~/dev/release-radar/index.ts" }, - { kind: "write", detail: "~/dev/release-radar/release-radar.client.tsx" }, - { kind: "shell", detail: "npm install && npm run typecheck" }, - { kind: "shell", detail: "paseo plugin install ~/dev/release-radar" }, -]; - -const PLUGIN_DISCOVERY_CALLS = PLUGIN_TOOL_CALLS.slice(0, 1); -const PLUGIN_BUILD_CALLS = PLUGIN_TOOL_CALLS.slice(1, 4); -const PLUGIN_INSTALL_CALLS = PLUGIN_TOOL_CALLS.slice(4); - -function ToolCallIcon({ kind }: { kind: ToolCall["kind"] }) { - if (kind === "read") return ; - if (kind === "write") return ; - if (kind === "paseo") return ; - return ; -} - -/** - * One tool call row, drawn like the app's collapsed timeline item - * (`packages/app/src/components/message.tsx`): icon, label, then the summary, - * all muted and in the UI font. - */ -export function ToolCallRow({ call }: { call: ToolCall }) { +/** Something that fades in when the script reaches it. */ +function Entering({ children }: { children: React.ReactNode }) { return ( -
- - - - {toolCallLabel(call)} - {call.detail} -
+ + {children} + ); } -function PluginToolGroup({ calls }: { calls: ToolCall[] }) { +interface ScriptedProps { + scene: MockupStateId; + script: SceneScript; +} + +function StreamedText({ scene, script, entry }: ScriptedProps & { entry: TranscriptEntry }) { + const text = useSceneClock(scene, (ms) => script.streamed(entry, ms)); + return {text}; +} + +function LandedTools({ + scene, + script, + entry, + calls, +}: ScriptedProps & { entry: TranscriptEntry; calls: ToolCall[] }) { + const landed = useSceneClock(scene, (ms) => script.landed(entry, ms)); return (
- {calls.map((call) => ( - + {calls.slice(0, landed).map((call) => ( + + + ))}
); } -export function PluginBuildTranscript() { +function TranscriptEntryView({ scene, script, entry }: ScriptedProps & { entry: TranscriptEntry }) { + const { beat } = entry; + if (beat.kind === "agent") return ; + if (beat.kind === "tools") { + return ; + } + if (beat.kind === "user") { + return ( + + {beat.text} + + ); + } + return ( + + + + ); +} + +/** The transcript of a scripted scene, as far as its script has played. */ +export function ScriptedTranscript({ scene, script }: ScriptedProps) { + const entered = useSceneClock(scene, script.entered); return (
- - Build me a release radar for Paseo. I want an explorer panel showing merged PRs, changes in - review, failing checks, and seven-day activity, accessible from the sidebar. - - - I’ll scaffold a local plugin, add the explorer surface, and wire it into the sidebar. - - - - The plugin API exposes Paseo’s live project and workspace state, so the radar - doesn’t need a separate service. - - - The surface is wired. I’m checking the project and installing it now. - - Release Radar is live. It should now be visible in the right sidebar. - + {script.entries.slice(0, entered).map((entry) => ( + + ))}
); } // --- composer --------------------------------------------------------------- -function ControlPill({ icon, label }: { icon: React.ReactNode; label: string }) { +/** One composer control: its icon as the child, then the current value. */ +function ControlPill({ label, children }: { label: string; children: React.ReactNode }) { return ( - - {icon} + + {children} {label} ); } -/** A rounded pill that floats above the composer — task tracker, subagents, diff. */ -function ComposerPill({ children }: { children: React.ReactNode }) { +/** + * A rounded pill that floats above the composer — task tracker, subagents, diff. An open pill is + * the one whose panel is showing. + */ +function ComposerPill({ children, open = false }: { children: React.ReactNode; open?: boolean }) { return ( - + {children} ); } +function SubagentsPill({ count, open = false }: { count: number; open?: boolean }) { + const { t } = useTranslation(); + return ( + + + {t("landing.mockup.app.subagents", { count })} + + ); +} + +/** The row of pills above the composer input. */ +function ComposerTrack({ children }: { children: React.ReactNode }) { + return
{children}
; +} + +/** The trackers of a turn in progress: tasks, subagents, and the diff so far. */ +export function ProgressTrack() { + const { t } = useTranslation(); + return ( + +
+ + {t("landing.mockup.app.tasksProgress", { completed: 6, total: 6 })} + + + + + +
+
+ ); +} + +function SubagentRow({ task }: { task: (typeof DELEGATED_TASKS)[number] }) { + const provider = PROVIDERS[task.provider]; + return ( +
+ + + + + + {task.title} + + + {provider.name} · {provider.model} + + {task.host ? ( + <> + · + + + ) : null} + + +
+ ); +} + +// Where the pointer sets off from, in design pixels from the spot it clicks. +const POINTER_TO_PILL = { x: 236, y: -128 }; +const POINTER_TO_COMPOSER = { x: 230, y: -140 }; + +const ROSTER_CLOSED = { opacity: 0, scale: 0.97, y: 6 }; +const ROSTER_OPEN = { opacity: 1, scale: 1, y: 0 }; + +/** + * The Subagents track of the orchestration scene. Its pill appears with the first subagent and + * counts each one the orchestrator launches. When the pointer clicks the pill, the roster opens: + * one row per agent, drawn like the app's track rows (`packages/app/src/subagents/track.tsx`). + * The title is the task and the line under it names the provider and model. An agent on another + * machine ends that line with the host's badge, where the app writes the host's name in plain text. + */ +export function SubagentsTrack() { + const launched = useSceneClock("orchestrate", tasksDelegated); + const pressed = useSceneClock("orchestrate", SUBAGENTS_CLICK.pressed); + const open = useSceneClock("orchestrate", SUBAGENTS_CLICK.done); + if (launched === 0) return null; + return ( + + {open ? ( + + {DELEGATED_TASKS.map((task) => ( + + ))} + + ) : null} + + + + + + + + ); +} + /** The amber ring the app shows while a turn is streaming. */ function BusyRing() { return ; } export function Composer({ - showProgress = true, - busy = true, + track, + agent = "codex", + busy = false, + draft = "", + focused = false, + children, }: { - showProgress?: boolean; + /** The composer track shown above the input, such as `ProgressTrack`. It brings its own spacing. */ + track?: React.ReactNode; + /** Which provider's agent this composer talks to. */ + agent?: ProviderId; busy?: boolean; + /** What the user has typed and not yet sent. Empty shows the placeholder. */ + draft?: string; + /** Whether the caret is in the input. */ + focused?: boolean; + /** Something drawn over the input box, such as the pointer that clicks it. */ + children?: React.ReactNode; }) { const { t } = useTranslation(); + const provider = PROVIDERS[agent]; return (
-
- {showProgress ? ( -
- - {t("landing.mockup.app.tasksProgress", { completed: 6, total: 6 })} - - - - {t("landing.mockup.app.subagents", { count: 3 })} - - - - -
- ) : null} -
-
+ {track} +
+ {children}
- - {t("landing.mockup.app.composerPlaceholder")} - + {draft ? ( + + {draft} + + + ) : ( + + {/* The caret takes no room, so the placeholder does not move when it appears. */} + {focused ? : null} + {t("landing.mockup.app.composerPlaceholder")} + + )}
- - - + + + + + + + + + @@ -255,3 +403,29 @@ export function Composer({
); } + +/** + * The composer of a scripted scene. The pointer clicks it, which puts the caret in it. Then the + * script types into it and says when a turn is running. + */ +export function ScriptedComposer({ + scene, + script, + agent, + track, +}: ScriptedProps & { agent: ProviderId; track?: React.ReactNode }) { + const click = script.click(COMPOSER); + const draft = useSceneClock(scene, script.draft); + const busy = useSceneClock(scene, script.busy); + const focused = useSceneClock(scene, (ms) => click.pressed(ms) || click.done(ms)); + return ( + + + + ); +} diff --git a/packages/website/src/components/mockup/diff.tsx b/packages/website/src/components/mockup/diff.tsx index 9a0d3a5f2..abc32d4d3 100644 --- a/packages/website/src/components/mockup/diff.tsx +++ b/packages/website/src/components/mockup/diff.tsx @@ -9,6 +9,8 @@ import { RefreshCw, Rows3, } from "lucide-react"; +import { Fragment } from "react"; +import type * as React from "react"; import { useTranslation } from "react-i18next"; import { Code, DiffStat } from "./atoms"; import { TABBAR_H } from "./geometry"; @@ -29,7 +31,7 @@ const SUBHEADER_STYLE = { height: TABBAR_H }; export type DiffRow = | { kind: "file"; name: string; path?: string; add: string; remove: string } | { kind: "hunk"; label: string } - | { kind: "line"; n: string; text: string; mark?: DiffMark } + | { kind: "line"; n: string; text: string; mark?: DiffMark; reviewed?: boolean } | { kind: "scrollbar" } | { kind: "gap" }; @@ -47,16 +49,35 @@ const NUMBER_COLOR: Record = { remove: "text-mock-danger", }; -function DiffLine({ n, text, mark }: { n: string; text: string; mark?: DiffMark }) { +/** What a review adds to the line it comments on. Rows mark that line with `reviewed`. */ +export interface LineReview { + /** Drawn on the line's gutter, such as the button that adds a comment. */ + action: React.ReactNode; + /** Drawn under the line: the thread of comments. */ + thread: React.ReactNode; +} + +function DiffLine({ + n, + text, + mark, + action, +}: { + n: string; + text: string; + mark?: DiffMark; + action?: React.ReactNode; +}) { const fill = mark ? ROW_FILL[mark] : ""; const number = mark ? NUMBER_COLOR[mark] : "text-mock-fg-muted"; return (
{n} + {action} @@ -88,7 +109,15 @@ function FileRow({ ); } -export function DiffRows({ rows, flush }: { rows: DiffRow[]; flush?: boolean }) { +export function DiffRows({ + rows, + flush, + review, +}: { + rows: DiffRow[]; + flush?: boolean; + review?: LineReview; +}) { return (
{rows.map((row, index) => { @@ -110,6 +139,14 @@ export function DiffRows({ rows, flush }: { rows: DiffRow[]; flush?: boolean })
); + if (row.reviewed && review) { + return ( + + + {review.thread} + + ); + } return ; })} {!flush ? ( @@ -333,6 +370,7 @@ export const REVIEW_DIFF_ROWS: DiffRow[] = [ n: "23", text: 'type ToolKind = "read" | "shell";', mark: "add", + reviewed: true, }, { kind: "line", n: "24", text: "" }, { diff --git a/packages/website/src/components/mockup/geometry.ts b/packages/website/src/components/mockup/geometry.ts index be8e6c43b..6485fe077 100644 --- a/packages/website/src/components/mockup/geometry.ts +++ b/packages/website/src/components/mockup/geometry.ts @@ -4,14 +4,17 @@ * plain px number you can reason about directly, and nothing has to change when * the hero column gets wider or narrower. * - * The numbers come from measuring public/homepage-hero.png (a 2x capture of a - * 2249x1289 window region) and dividing by 1.5617 so the window lands at 1440 - * wide — the widest the hero column ever renders it. + * The window is 1280 wide, the widest the hero column ever renders it, so on a + * wide screen one design pixel is one CSS pixel and the text is as large as the + * app's. The type and control sizes come from measuring public/homepage-hero.png + * (a 2x capture of a 2249x1289 window region) and dividing by 1.5617. */ -export const DESIGN_WIDTH = 1440; -export const DESIGN_HEIGHT = 826; +export const DESIGN_WIDTH = 1280; +export const DESIGN_HEIGHT = 734; export const TITLEBAR_H = 39; export const TABBAR_H = 31; export const SIDEBAR_W = 262; -export const RIGHT_PANEL_W = 424; +// The docked panel is as wide as the file tree needs. A pull request or a plugin panel gets more room. +export const RIGHT_PANEL_W = 300; +export const RIGHT_PANEL_WIDE_W = 424; diff --git a/packages/website/src/components/mockup/hosts.tsx b/packages/website/src/components/mockup/hosts.tsx new file mode 100644 index 000000000..2fefb7a20 --- /dev/null +++ b/packages/website/src/components/mockup/hosts.tsx @@ -0,0 +1,157 @@ +import { Computer, Globe, Laptop, Monitor, PcCase, Plus, Server, Terminal, X } from "lucide-react"; +import type * as React from "react"; +import { useTranslation } from "react-i18next"; +import { TailscaleMark } from "./icons"; + +/** + * The machines the mockup's workspaces live on. A host's name is the label its owner gave it, and + * its color is the identity color they picked for its badge. The local machine draws no badge, as + * a host set to hide its badge does in the app. + */ +export type RemoteHostId = "devbox" | "mac-mini"; + +/** Badge ink per host, as the app's `HostBadge` paints glyph and label in one identity color. */ +const HOST_TONE: Record = { + devbox: "text-mock-host-teal", + "mac-mini": "text-mock-host-violet", +}; + +/** + * The mark that says which machine something runs on: the server glyph and the host's name in its + * identity color. It inherits its text size, so it sits in a sidebar row, a tool call, or a + * subagent row alike. + */ +export function HostBadge({ host, glyph = 12 }: { host: RemoteHostId; glyph?: number }) { + return ( + + + {host} + + ); +} + +// --- hosts modal -------------------------------------------------------------- + +type IconComponent = React.ComponentType<{ size?: number; className?: string }>; + +/** How the app reaches a host. Tailscale is a direct TCP connection to a tailnet name. */ +type HostLink = "local" | "relay" | "tailscale" | "ssh"; + +const LINK_ICON: Record = { + local: Monitor, + relay: Globe, + tailscale: TailscaleMark, + ssh: Terminal, +}; + +interface ConnectedHost { + name: string; + device: IconComponent; + tone: string; + link: HostLink; + /** The address in use. The local daemon has none worth showing. */ + endpoint?: string; + /** Round trip time, formatted as the app's `formatLatency` prints it. */ + latency: string; + agents: number; +} + +const CONNECTED_HOSTS: ConnectedHost[] = [ + { + name: "MacBook Pro", + device: Laptop, + tone: "text-mock-fg-muted", + link: "local", + latency: "1ms", + agents: 4, + }, + { + name: "devbox", + device: Server, + tone: HOST_TONE.devbox, + link: "relay", + endpoint: "relay.paseo.sh", + latency: "38ms", + agents: 6, + }, + { + name: "mac-mini", + device: Computer, + tone: HOST_TONE["mac-mini"], + link: "tailscale", + endpoint: "mac-mini:6767", + latency: "12ms", + agents: 3, + }, + { + name: "workstation", + device: PcCase, + tone: "text-mock-host-orange", + link: "ssh", + endpoint: "mo@workstation", + latency: "24ms", + agents: 2, + }, +]; + +function HostRow({ host }: { host: ConnectedHost }) { + const { t } = useTranslation(); + const Device = host.device; + const LinkIcon = LINK_ICON[host.link]; + return ( +
+ + + + + + + {host.name} + + + + {t(`landing.mockup.app.hostLinks.${host.link}`)} + {host.endpoint ? {host.endpoint} : null} + + + + + {host.latency} + + + {t("landing.mockup.app.agentCount", { count: host.agents })} + + +
+ ); +} + +/** + * Every machine this window is connected to: what kind of machine it is, how the app reaches it, + * the round trip time, and how many agents it runs. + */ +export function HostsModal() { + const { t } = useTranslation(); + return ( +
+
+ + {t("landing.mockup.app.hosts")} + + +
+ {CONNECTED_HOSTS.map((host) => ( + + ))} +
+ {/* The plus sits on the center line of the device tiles above it. */} + + + + {t("landing.mockup.app.addHost")} +
+
+ ); +} diff --git a/packages/website/src/components/mockup/icons.tsx b/packages/website/src/components/mockup/icons.tsx index 9b4cd39e0..260aeefd0 100644 --- a/packages/website/src/components/mockup/icons.tsx +++ b/packages/website/src/components/mockup/icons.tsx @@ -1,5 +1,7 @@ // Exact SVG paths from packages/app/src/components/icons/ +import { OpenCodeIcon as OpenCodeBrandIcon, PiIcon as PiBrandIcon } from "../agent-icons"; + /** The Paseo brand swirl — public/logo.svg, drawn as a small sidebar avatar mark. */ export function PaseoMark({ size = 13, className }: { size?: number; className?: string }) { return ( @@ -112,3 +114,65 @@ export function SourceControlIcon({ size = 14, className }: { size?: number; cla ); } + +export function OpenCodeIcon({ size = 13, className }: { size?: number; className?: string }) { + return ; +} + +export function PiIcon({ size = 13, className }: { size?: number; className?: string }) { + return ; +} + +const TAILSCALE_DOTS = [3, 12, 21].flatMap((cy, row) => + [3, 12, 21].map((cx, column) => ({ + cx, + cy, + // The mark is a T: the middle row and the dot under its center are solid. + solid: row === 1 || (row === 2 && column === 1), + })), +); + +/** The Tailscale mark: a three by three dot grid with a solid T. */ +export function TailscaleMark({ size = 12, className }: { size?: number; className?: string }) { + return ( + + ); +} + +/** A mouse pointer. Its tip is the top left corner of the glyph. */ +export function PointerArrow({ size = 24, className }: { size?: number; className?: string }) { + return ( + + ); +} diff --git a/packages/website/src/components/mockup/index.ts b/packages/website/src/components/mockup/index.ts index d07c4d1f5..8b624ff1f 100644 --- a/packages/website/src/components/mockup/index.ts +++ b/packages/website/src/components/mockup/index.ts @@ -1,10 +1,11 @@ export { ClaudeIcon, CodexIcon, SourceControlIcon } from "./icons"; -export { type ToolCall, ToolCallRow } from "./chat"; +export { ToolCallRow } from "./chat"; +export type { ToolCall } from "./script"; export { DESIGN_HEIGHT, DESIGN_WIDTH } from "./geometry"; export { PhoneFrame } from "./mobile/frame"; export { MobileChat } from "./mobile/chat"; export { MobileDiff } from "./mobile/diff"; export { MobileSidebar } from "./mobile/sidebar"; -export { DEFAULT_MOCKUP_STATE, MOCKUP_STATES, type MockupStateId } from "./states"; -export { MockupWindow } from "./window"; +export { MOCKUP_STATES, type MockupStateId } from "./states"; +export { createMockupPlayer, MockupWindow, useMockupScene } from "./window"; export { ScaledMockup } from "./scaled-mockup"; diff --git a/packages/website/src/components/mockup/orchestration.ts b/packages/website/src/components/mockup/orchestration.ts new file mode 100644 index 000000000..0d913527f --- /dev/null +++ b/packages/website/src/components/mockup/orchestration.ts @@ -0,0 +1,102 @@ +import type { RemoteHostId } from "./hosts"; +import { PROVIDERS, type ProviderId } from "./providers"; +import { COMPOSER, script, type ToolCall } from "./script"; + +/** + * The work the orchestrating agent hands out in the orchestration scene. The sidebar draws one + * workspace per task and the chat draws the tool calls and the subagent rows from the same list. + */ +export const DELEGATED_TASKS: { + id: string; + title: string; + branch: string; + provider: Exclude; + host?: RemoteHostId; +}[] = [ + { + id: "issue-412", + title: "Fix #412: relay handshake race", + branch: "fix/relay-handshake-race", + provider: "codex", + }, + { + id: "issue-417", + title: "Fix #417: menu bar icon on macOS", + branch: "fix/menu-bar-icon", + provider: "opencode", + host: "mac-mini", + }, + { + id: "issue-421", + title: "Fix #421: stale Docker setup docs", + branch: "docs/docker-setup", + provider: "pi", + }, +]; + +/** + * The orchestrator's Paseo tool calls, one per delegated task. One call creates the worktree + * workspace and starts the agent in it. + */ +const DELEGATION_CALLS: ToolCall[] = DELEGATED_TASKS.map((task) => ({ + kind: "paseo", + label: "Create agent", + detail: `${PROVIDERS[task.provider].name} · ${task.branch}`, + host: task.host, +})); + +/** + * What the orchestrator looks up before it delegates: the issues to fix, and the agent profiles + * the user set up, which say which model takes which kind of work. + */ +const LOOKUP_CALLS: ToolCall[] = [ + { kind: "shell", detail: "gh issue list --label ready" }, + { kind: "paseo", label: "List agent profiles" }, +]; + +const REQUEST = "Fix the issues labeled ready, one worktree each."; + +/** + * The orchestration scene: the user asks Claude to fix the ready issues, each in a worktree. Claude + * lists the issues and the user's agent profiles, picks a model for each issue, and puts the one + * that needs macOS on another machine. It says that Paseo will notify it when the agents finish. + * Then the pointer opens the subagents roster. + */ +export const ORCHESTRATION = script([ + { kind: "wait", ms: 200 }, + { kind: "click", target: COMPOSER }, + { kind: "wait", ms: 250 }, + { kind: "type", text: REQUEST }, + { kind: "user", text: REQUEST }, + { kind: "tools", calls: LOOKUP_CALLS }, + { + kind: "agent", + text: `I loaded your orchestration preferences: ${PROVIDERS.codex.model} for the hard bug, ${PROVIDERS.opencode.model} for UI, ${PROVIDERS.pi.model} for docs.`, + }, + { + kind: "agent", + text: "I will launch the UI agent on your mac-mini, because that issue is specific to macOS.", + }, + { kind: "tools", calls: DELEGATION_CALLS }, + { + kind: "agent", + text: "All three are launched. Paseo will notify me when each one finishes.", + }, + // No footer: with it, the transcript and the open roster do not both fit in the pane. + { kind: "turnEnd" }, + { kind: "click", target: "subagents" }, +]); + +/** The pointer's click on the subagents pill. It opens the roster of subagents. */ +export const SUBAGENTS_CLICK = ORCHESTRATION.click("subagents"); + +/** + * How many tasks the orchestrator delegated so far. Each one adds a workspace to the sidebar and a + * subagent to the composer's pill. + */ +export function tasksDelegated(ms: number): number { + const delegation = ORCHESTRATION.entries.find( + (entry) => entry.beat.kind === "tools" && entry.beat.calls === DELEGATION_CALLS, + ); + return delegation ? ORCHESTRATION.landed(delegation, ms) : 0; +} diff --git a/packages/website/src/components/mockup/panes.tsx b/packages/website/src/components/mockup/panes.tsx index 3f0554f40..32831b582 100644 --- a/packages/website/src/components/mockup/panes.tsx +++ b/packages/website/src/components/mockup/panes.tsx @@ -1,15 +1,86 @@ -import { DiffRows, REVIEW_DIFF_ROWS, ScopeRow } from "./diff"; +import { DiffRows, type LineReview, REVIEW_DIFF_ROWS, ScopeRow } from "./diff"; +import { AddCommentAction, ReviewFeedback, ReviewThread } from "./review-thread"; import { useTranslation } from "react-i18next"; // --- review ----------------------------------------------------------------- -/** The selected Changes-tree file, open in its own workspace tab. */ +const LINE_REVIEW: LineReview = { action: , thread: }; + +/** + * The selected Changes-tree file, open in its own workspace tab. The review scene comments on one + * of its lines and sends that feedback to an agent. + */ export function DiffReviewPane() { const { t } = useTranslation(); return ( -
+
- + + +
+ ); +} + +// --- remote ----------------------------------------------------------------- + +function ShellPrompt() { + return ( + <> + mo@devbox: + ~/dev/paseo${" "} + + ); +} + +function ViteArrow() { + return {" ➜ "}; +} + +function HmrLine({ time, file }: { time: string; file: string }) { + return ( +
+ {time}{" "} + [vite]{" "} + hmr update{" "} + {file} +
+ ); +} + +/** + * The workspace's terminal tab. The workspace lives on devbox, so the shell does too: the prompt + * names the remote machine while the pane sits in the same window as every local workspace. + */ +export function RemoteTerminalPane() { + return ( +
+
+ + npm run dev +
+
+
> @getpaseo/website dev
+
> vite
+
+
+ {" "} + VITE v7.3.3 + {" ready in "}412 ms +
+
+
+ + {"Local: "} + http://localhost:3000/ +
+
+ + press h + enter to show help +
+
+ + +
); } diff --git a/packages/website/src/components/mockup/player.test.ts b/packages/website/src/components/mockup/player.test.ts new file mode 100644 index 000000000..73732638f --- /dev/null +++ b/packages/website/src/components/mockup/player.test.ts @@ -0,0 +1,71 @@ +import { describe, expect, it } from "vitest"; +import { createScenePlayer, type Frames } from "./player"; + +/** A page clock that moves only when the test turns it. */ +function handClock() { + let time = 0; + let nextId = 0; + const waiting = new Map void>(); + const frames: Frames = { + now: () => time, + request(callback) { + nextId += 1; + waiting.set(nextId, callback); + return nextId; + }, + cancel: (id) => waiting.delete(id), + reducedMotion: () => false, + }; + return { + frames, + /** Moves the clock on and runs the frames that were waiting for it. */ + advance(ms: number) { + time += ms; + const due = [...waiting.values()]; + waiting.clear(); + for (const callback of due) callback(time); + }, + framesWaiting: () => waiting.size, + }; +} + +function setUp() { + const clock = handClock(); + const player = createScenePlayer("orchestrate", { orchestrate: 1000, review: 500 }, clock.frames); + return { clock, player }; +} + +describe("scene player", () => { + it("plays the opening scene from the start when the page starts it", () => { + const { clock, player } = setUp(); + player.start(); + clock.advance(16); + clock.advance(16); + expect(player.elapsed("orchestrate")).toBe(32); + }); + + it("keeps the place of a scene that a pill click started before the page did", () => { + const { clock, player } = setUp(); + player.select("review"); + clock.advance(16); + clock.advance(16); + expect(player.elapsed("review")).toBe(32); + + player.start(); + expect(player.scene()).toBe("review"); + expect(player.elapsed("review")).toBe(32); + expect(player.elapsed("orchestrate")).toBe(0); + }); + + it("stops the clock", () => { + const { clock, player } = setUp(); + player.start(); + clock.advance(16); + expect(clock.framesWaiting()).toBe(1); + + player.stop(); + expect(clock.framesWaiting()).toBe(0); + clock.advance(16); + expect(player.elapsed("orchestrate")).toBe(16); + }); +}); diff --git a/packages/website/src/components/mockup/player.ts b/packages/website/src/components/mockup/player.ts new file mode 100644 index 000000000..30828d015 --- /dev/null +++ b/packages/website/src/components/mockup/player.ts @@ -0,0 +1,130 @@ +import { createContext, useContext, useSyncExternalStore } from "react"; +import type { MockupStateId } from "./states"; + +/** + * Which scene the mockup shows and how far into its script each scene is. The player owns the + * clock. Components read the time through `useSceneClock` and never keep time themselves. + */ +export interface ScenePlayer { + scene(): MockupStateId; + /** Milliseconds into a scene's script. Each scene keeps its own, so a scene that is fading out holds its last frame. */ + elapsed(scene: MockupStateId): number; + /** Shows a scene and plays its script from the start. */ + select(scene: MockupStateId): void; + /** + * Plays the opening scene from the start, unless a scene has played already. A pill click can + * come before the page decides to start, and that scene keeps its place. + */ + start(): void; + /** Stops the clock. A scene that is playing holds its last frame. */ + stop(): void; + subscribe(listener: () => void): () => void; +} + +// A background tab stops animation frames. On return the script resumes where it paused. +const LONGEST_FRAME_MS = 64; + +/** What the player needs from the page to keep time. Tests pass a clock they turn by hand. */ +export interface Frames { + now(): number; + request(callback: (now: number) => void): number; + cancel(id: number): void; + reducedMotion(): boolean; +} + +const browserFrames: Frames = { + now: () => performance.now(), + request: (callback) => requestAnimationFrame(callback), + cancel: (id) => cancelAnimationFrame(id), + // Visitors who ask for reduced motion get the finished scene. + reducedMotion: () => window.matchMedia("(prefers-reduced-motion: reduce)").matches, +}; + +/** + * @param durations How long each scene's script runs. A scene without a script has no entry and is + * always at its finished state. + */ +export function createScenePlayer( + initial: MockupStateId, + durations: Partial>, + frames: Frames = browserFrames, +): ScenePlayer { + let scene = initial; + const times = new Map(); + const listeners = new Set<() => void>(); + let frame = 0; + let lastFrameAt = 0; + let played = false; + + function emit() { + for (const listener of listeners) listener(); + } + + function stop() { + if (frame) frames.cancel(frame); + frame = 0; + } + + function tick(now: number) { + const end = durations[scene] ?? 0; + const next = Math.min( + end, + (times.get(scene) ?? 0) + Math.min(now - lastFrameAt, LONGEST_FRAME_MS), + ); + lastFrameAt = now; + times.set(scene, next); + frame = next < end ? frames.request(tick) : 0; + emit(); + } + + function play() { + played = true; + stop(); + const end = durations[scene] ?? 0; + const animated = end > 0 && !frames.reducedMotion(); + times.set(scene, animated ? 0 : end); + if (animated) { + lastFrameAt = frames.now(); + frame = frames.request(tick); + } + emit(); + } + + return { + scene: () => scene, + elapsed: (of) => times.get(of) ?? 0, + select(next) { + scene = next; + play(); + }, + start() { + if (!played) play(); + }, + stop, + subscribe(listener) { + listeners.add(listener); + return () => listeners.delete(listener); + }, + }; +} + +export const ScenePlayerContext = createContext(null); + +/** The scene a player shows. */ +export function usePlayerScene(player: ScenePlayer): MockupStateId { + return useSyncExternalStore(player.subscribe, player.scene, player.scene); +} + +/** + * Reads one fact about a scene at its current time, such as how many tool calls have landed. + * The component renders again only when that fact changes, so `select` must return a primitive. + */ +export function useSceneClock( + scene: MockupStateId, + select: (ms: number) => Fact, +): Fact { + const player = useContext(ScenePlayerContext); + if (!player) throw new Error("useSceneClock needs a ScenePlayerContext"); + const read = () => select(player.elapsed(scene)); + return useSyncExternalStore(player.subscribe, read, read); +} diff --git a/packages/website/src/components/mockup/plugin-build.ts b/packages/website/src/components/mockup/plugin-build.ts new file mode 100644 index 000000000..99a6c747e --- /dev/null +++ b/packages/website/src/components/mockup/plugin-build.ts @@ -0,0 +1,55 @@ +import { COMPOSER, script } from "./script"; + +const BUILD_REQUEST = "Build a release radar panel for merged PRs and failing checks."; +const CHANGE_REQUEST = "Show which check is failing."; + +/** + * The plugins scene: the user asks for a panel, the agent builds and installs a plugin, and the + * panel opens. Then the user asks for a change and the open panel shows it. + */ +export const PLUGIN_BUILD = script([ + { kind: "wait", ms: 200 }, + { kind: "click", target: COMPOSER }, + { kind: "wait", ms: 250 }, + { kind: "type", text: BUILD_REQUEST }, + { kind: "user", text: BUILD_REQUEST }, + { + kind: "agent", + text: "I’ll scaffold a local plugin, add the explorer surface, and wire it into the sidebar.", + }, + { + kind: "tools", + calls: [ + { kind: "read", detail: "paseo-plugin/SKILL.md" }, + { kind: "shell", detail: "paseo plugin init ~/dev/release-radar" }, + { kind: "write", detail: "~/dev/release-radar/release-radar.client.tsx" }, + { kind: "shell", detail: "paseo plugin install ~/dev/release-radar" }, + ], + }, + { kind: "mark", name: "installed", ms: 500 }, + { kind: "agent", text: "Release Radar is live. It should now be visible in the right sidebar." }, + { kind: "turnEnd", worked: "2m 14s" }, + { kind: "wait", ms: 900 }, + { kind: "type", text: CHANGE_REQUEST }, + { kind: "user", text: CHANGE_REQUEST }, + { + kind: "tools", + calls: [ + { kind: "write", detail: "~/dev/release-radar/release-radar.client.tsx" }, + { kind: "shell", detail: "paseo plugin reload release-radar" }, + ], + }, + { kind: "mark", name: "revised", ms: 500 }, + { kind: "agent", text: "Reloaded. The radar now lists the failing check under the tiles." }, + { kind: "turnEnd", worked: "19s" }, +]); + +/** Whether the plugin is installed: its panel is open and its item is in the sidebar. */ +export function pluginInstalled(ms: number): boolean { + return PLUGIN_BUILD.reached("installed", ms); +} + +/** Whether the reloaded plugin lists the failing check. */ +export function failingCheckListed(ms: number): boolean { + return PLUGIN_BUILD.reached("revised", ms); +} diff --git a/packages/website/src/components/mockup/pointer.tsx b/packages/website/src/components/mockup/pointer.tsx new file mode 100644 index 000000000..23086c023 --- /dev/null +++ b/packages/website/src/components/mockup/pointer.tsx @@ -0,0 +1,45 @@ +import { useMemo } from "react"; +import { PointerArrow } from "./icons"; +import { useSceneClock } from "./player"; +import type { PointerClick } from "./script"; +import type { MockupStateId } from "./states"; + +/** + * The visitor's stand-in: a mouse pointer that glides to a spot and clicks it. The spot is where + * `className` places the pointer in its nearest positioned ancestor. + */ +export function Pointer({ + scene, + click, + from, + className, +}: { + scene: MockupStateId; + click: PointerClick; + /** Where the pointer sets off from, in design pixels from the spot it clicks. */ + from: { x: number; y: number }; + className: string; +}) { + const opacity = useSceneClock(scene, click.opacity); + const approach = useSceneClock(scene, click.approach); + const pressed = useSceneClock(scene, click.pressed); + const style = useMemo( + () => ({ + opacity, + transform: `translate(${(1 - approach) * from.x}px, ${(1 - approach) * from.y}px)`, + }), + [opacity, approach, from], + ); + if (opacity === 0) return null; + return ( + + + + ); +} diff --git a/packages/website/src/components/mockup/providers.ts b/packages/website/src/components/mockup/providers.ts new file mode 100644 index 000000000..167438ff7 --- /dev/null +++ b/packages/website/src/components/mockup/providers.ts @@ -0,0 +1,11 @@ +import { ClaudeIcon, CodexIcon, OpenCodeIcon, PiIcon } from "./icons"; + +/** Each agent provider the mockup shows: its name, its mark, and the model it runs. */ +export const PROVIDERS = { + claude: { name: "Claude Code", Icon: ClaudeIcon, model: "Opus 5.5" }, + codex: { name: "Codex", Icon: CodexIcon, model: "GPT-5.6-Sol" }, + opencode: { name: "OpenCode", Icon: OpenCodeIcon, model: "Kimi K3" }, + pi: { name: "Pi", Icon: PiIcon, model: "GLM-5.2" }, +}; + +export type ProviderId = keyof typeof PROVIDERS; diff --git a/packages/website/src/components/mockup/review-thread.tsx b/packages/website/src/components/mockup/review-thread.tsx new file mode 100644 index 000000000..dffb3993a --- /dev/null +++ b/packages/website/src/components/mockup/review-thread.tsx @@ -0,0 +1,231 @@ +import { AnimatePresence, motion } from "framer-motion"; +import { CircleCheck, Pencil, Plus, Send, Trash2 } from "lucide-react"; +import { useTranslation } from "react-i18next"; +import { Caret } from "./atoms"; +import { FADE_IN, FADE_OUT, MOCKUP_TRANSITION } from "./motion"; +import { useSceneClock } from "./player"; +import { Pointer } from "./pointer"; +import { PROVIDERS, type ProviderId } from "./providers"; +import { + ADD_COMMENT_CLICK, + lineHovered, + RECIPIENT_CLICK, + recipientHovered, + REVIEW, + REVIEW_COMMENT, + reviewPhase, + SEND_FEEDBACK_CLICK, +} from "./review"; + +// The review scene, drawn like the app's review module (`packages/app/src/review`): the add +// button of a hovered line, the inline editor, the saved comment, and Send feedback. + +// --- on the line ------------------------------------------------------------ + +const POINTER_TO_LINE = { x: 240, y: 150 }; + +/** + * The add button a hovered line shows across its gutter's edge, and the pointer that clicks it. + * Goes in the line's gutter. + */ +export function AddCommentAction() { + const hovered = useSceneClock("review", lineHovered); + const pressed = useSceneClock("review", ADD_COMMENT_CLICK.pressed); + return ( + + {hovered ? ( + + + + ) : null} + + + ); +} + +function CommentEditor() { + const { t } = useTranslation(); + const body = useSceneClock("review", REVIEW.draft); + return ( +
+
+ {body ? ( + + {body} + + + ) : ( + + + {t("landing.mockup.app.reviewCommentPlaceholder")} + + )} +
+
+ + {t("landing.mockup.app.reviewCancel")} + + + {t("landing.mockup.app.reviewSave")} + +
+
+ ); +} + +function SavedComment() { + return ( +
+ {REVIEW_COMMENT} + + +
+ ); +} + +// The thread is as tall as what it holds plus 8 of padding above and below. +const THREAD_CLOSED = { height: 0, opacity: 0 }; +const THREAD_WRITING = { height: 110, opacity: 1 }; +const THREAD_COMMENTED = { height: 58, opacity: 1 }; + +/** The comment thread under the line: the editor first, then the saved comment until it is sent. */ +export function ReviewThread() { + const phase = useSceneClock("review", reviewPhase); + const writing = phase === "writing"; + const open = writing || phase === "commented" || phase === "choosing"; + return ( + + {open ? ( + +
{writing ? : }
+
+ ) : null} +
+ ); +} + +// --- over the diff ---------------------------------------------------------- + +function RecipientRow({ agent, lit = false }: { agent: ProviderId; lit?: boolean }) { + const provider = PROVIDERS[agent]; + return ( + + + + + {provider.name} + + ); +} + +/** Who gets the feedback. The workspace has two agent tabs, so Send feedback asks which one. */ +const RECIPIENT: ProviderId = "codex"; + +// Where the pointer sets off for Send feedback, and how far the picked agent's row is from there. +// The button is 32 high. The list floats 6 above it, with 4 of padding around two rows of 30. +const POINTER_TO_SEND = { x: -190, y: -170 }; +const POINTER_TO_RECIPIENT = { x: -6, y: 73 }; + +const FLOATING = "pointer-events-none absolute inset-x-0 bottom-[16px] flex justify-center"; +const FLOATING_SHADOW = "shadow-[0_8px_24px_rgba(0,0,0,0.4)]"; + +/** + * What floats over the bottom of the diff: Send feedback while a comment waits, the list of + * agents it opens, and the toast that says who got the feedback. + */ +export function ReviewFeedback() { + const { t } = useTranslation(); + const phase = useSceneClock("review", reviewPhase); + const pressed = useSceneClock("review", SEND_FEEDBACK_CLICK.pressed); + const recipientLit = useSceneClock("review", recipientHovered); + return ( + <> + + {phase === "commented" || phase === "choosing" ? ( + + + {phase === "choosing" ? ( + + + + + ) : null} + + + {t("landing.mockup.app.sendFeedback", { count: 1 })} + + + + ) : null} + {phase === "sent" ? ( + + + + {t("landing.mockup.app.feedbackSent", { recipient: PROVIDERS[RECIPIENT].name })} + + + ) : null} + + {/* Both spots are measured from the middle of the button's bottom edge. */} + + + + + + ); +} diff --git a/packages/website/src/components/mockup/review.ts b/packages/website/src/components/mockup/review.ts new file mode 100644 index 000000000..858d633e2 --- /dev/null +++ b/packages/website/src/components/mockup/review.ts @@ -0,0 +1,54 @@ +import { script } from "./script"; + +/** What the reviewer writes on the line. */ +export const REVIEW_COMMENT = "Add “write”. The agent edits files too."; + +/** + * The code review scene: the pointer adds a comment on a line of the diff and the user types it. + * Then the pointer sends the feedback and picks the agent that gets it. + */ +export const REVIEW = script([ + { kind: "wait", ms: 300 }, + { kind: "click", target: "addComment" }, + { kind: "wait", ms: 250 }, + { kind: "type", text: REVIEW_COMMENT }, + { kind: "mark", name: "saved", ms: 450 }, + { kind: "click", target: "sendFeedback" }, + { kind: "click", target: "recipient" }, +]); + +/** The click on the add button of the line. It opens the comment editor. */ +export const ADD_COMMENT_CLICK = REVIEW.click("addComment"); +/** The click on Send feedback. It opens the list of agents. */ +export const SEND_FEEDBACK_CLICK = REVIEW.click("sendFeedback"); +/** The click on the agent that gets the feedback. */ +export const RECIPIENT_CLICK = REVIEW.click("recipient"); + +/** + * Where the review stands. + * + * - `reading`: no comment yet. + * - `writing`: the comment editor is open. + * - `commented`: the comment is saved and waits to be sent. + * - `choosing`: the list of agents is open. + * - `sent`: an agent has the feedback, and the saved comment is gone. + */ +export type ReviewPhase = "reading" | "writing" | "commented" | "choosing" | "sent"; + +export function reviewPhase(ms: number): ReviewPhase { + if (RECIPIENT_CLICK.done(ms)) return "sent"; + if (SEND_FEEDBACK_CLICK.done(ms)) return "choosing"; + if (REVIEW.reached("saved", ms)) return "commented"; + if (ADD_COMMENT_CLICK.done(ms)) return "writing"; + return "reading"; +} + +/** Whether the pointer is over the line. A hovered line shows its add button. */ +export function lineHovered(ms: number): boolean { + return ADD_COMMENT_CLICK.approach(ms) > 0.93 && !ADD_COMMENT_CLICK.done(ms); +} + +/** Whether the pointer is over the agent it is about to pick. */ +export function recipientHovered(ms: number): boolean { + return RECIPIENT_CLICK.approach(ms) > 0.8; +} diff --git a/packages/website/src/components/mockup/right-panel.tsx b/packages/website/src/components/mockup/right-panel.tsx index dc4e30068..32997a3fb 100644 --- a/packages/website/src/components/mockup/right-panel.tsx +++ b/packages/website/src/components/mockup/right-panel.tsx @@ -1,5 +1,6 @@ import { CircleCheck, + CircleX, ChevronDown, ExternalLink, FileDiff, @@ -14,12 +15,26 @@ import type { TFunction } from "i18next"; import type * as React from "react"; import { useTranslation } from "react-i18next"; import { ChangesBranchRow, ChangesCommitsRow, ChangesScopeRow, ExplorerChangesTree } from "./diff"; -import { RIGHT_PANEL_W, TABBAR_H, TITLEBAR_H } from "./geometry"; -import type { MockupStateId } from "./states"; +import { RIGHT_PANEL_W, RIGHT_PANEL_WIDE_W, TABBAR_H, TITLEBAR_H } from "./geometry"; +import { AnimatePresence, motion } from "framer-motion"; +import { useSceneClock } from "./player"; +import { failingCheckListed } from "./plugin-build"; const TABBAR_STYLE = { height: TITLEBAR_H }; const SUBHEADER_STYLE = { height: TABBAR_H }; -const PANEL_STYLE = { width: RIGHT_PANEL_W }; + +export type PanelId = "changes" | "ship" | "plugin"; + +/** How wide the docked panel is for what it shows. Only the file tree fits the narrow width. */ +export function panelWidth(panel: PanelId): number { + return panel === "changes" ? RIGHT_PANEL_W : RIGHT_PANEL_WIDE_W; +} + +const PANEL_STYLES: Record = { + changes: { width: panelWidth("changes") }, + ship: { width: panelWidth("ship") }, + plugin: { width: panelWidth("plugin") }, +}; interface PanelTab { label: string; @@ -52,10 +67,12 @@ function PanelTabs({ tabs, active }: { tabs: PanelTab[]; active: number }) { } function PanelShell({ + panel, tabs, active, children, }: { + panel: PanelId; tabs: PanelTab[]; active: number; children: React.ReactNode; @@ -63,7 +80,7 @@ function PanelShell({ return (
{children} @@ -88,7 +105,7 @@ function changesTabs(t: TFunction): PanelTab[] { function ChangesPanel({ selectedFile }: { selectedFile?: string }) { const { t } = useTranslation(); return ( - + @@ -118,7 +135,7 @@ function CheckGlyph() { function ShipPanel() { const { t } = useTranslation(); return ( - +
+ +
+ {t("landing.mockup.app.failing")} +
+
+ + + + app-tests (macos) + + + #3976 · Honor configured commit signing + + + 5m 02s +
+
+ ); +} + +function PluginDashboard() { + const { t } = useTranslation(); + const listsFailingCheck = useSceneClock("extend", failingCheckListed); + return ( +
+ + {listsFailingCheck ? : null} + +
{t("landing.mockup.app.mergesWeek")} @@ -307,8 +356,8 @@ function PluginDashboard() { ); } -export function RightPanel({ state }: { state: MockupStateId }) { - if (state === "ship") return ; - if (state === "extend") return ; +export function RightPanel({ panel }: { panel: PanelId }) { + if (panel === "ship") return ; + if (panel === "plugin") return ; return ; } diff --git a/packages/website/src/components/mockup/script.test.ts b/packages/website/src/components/mockup/script.test.ts new file mode 100644 index 000000000..10d27775d --- /dev/null +++ b/packages/website/src/components/mockup/script.test.ts @@ -0,0 +1,177 @@ +import { describe, expect, it } from "vitest"; +import { script } from "./script"; + +const REQUEST = "Rename the panel."; +const REPLY = "Renamed. The panel is now called Radar."; + +const scene = script([ + { kind: "wait", ms: 500 }, + { kind: "type", text: REQUEST }, + { kind: "user", text: REQUEST }, + { + kind: "tools", + calls: [ + { kind: "read", detail: "panel.tsx" }, + { kind: "write", detail: "panel.tsx" }, + ], + }, + { kind: "mark", name: "renamed", ms: 400 }, + { kind: "agent", text: REPLY }, + { kind: "turnEnd", worked: "8s" }, +]); + +const [sent, tools, reply, turnEnd] = scene.entries; + +function midway(entry: { start: number; end: number }): number { + return (entry.start + entry.end) / 2; +} + +const POINTER_ENTERS = 200; +const PAUSE_BEFORE_TYPING = 100; + +const pointed = script([ + { kind: "wait", ms: POINTER_ENTERS }, + { kind: "click", target: "composer" }, + { kind: "wait", ms: PAUSE_BEFORE_TYPING }, + { kind: "type", text: REQUEST }, + { kind: "user", text: REQUEST }, + { kind: "click", target: "pill" }, + { kind: "click", target: "menu" }, +]); +const composerClick = pointed.click("composer"); +const pillClick = pointed.click("pill"); +const menuClick = pointed.click("menu"); + +/** The first millisecond of the pointed scene at which something is true. */ +function firstMs(holds: (ms: number) => boolean): number { + for (let ms = 0; ms <= pointed.duration; ms += 1) { + if (holds(ms)) return ms; + } + throw new Error("It never holds"); +} + +describe("script", () => { + it("starts with an empty composer, an empty transcript, and no turn running", () => { + expect(scene.draft(0)).toBe(""); + expect(scene.entered(0)).toBe(0); + expect(scene.busy(0)).toBe(false); + }); + + it("types the request into the composer, then clears it when the message is sent", () => { + const typing = { start: 500, end: sent.start }; + const partial = scene.draft(typing.start + 200); + expect(partial.length).toBeGreaterThan(0); + expect(partial.length).toBeLessThan(REQUEST.length); + expect(REQUEST.startsWith(partial)).toBe(true); + + expect(scene.draft(typing.end - 1)).toBe(REQUEST); + expect(scene.draft(sent.start)).toBe(""); + expect(scene.entered(midway(sent))).toBe(1); + }); + + it("runs the turn from the sent message until the turn ends", () => { + expect(scene.busy(sent.start - 1)).toBe(false); + expect(scene.busy(sent.start)).toBe(true); + expect(scene.busy(midway(reply))).toBe(true); + expect(scene.busy(turnEnd.start)).toBe(false); + }); + + it("lands tool calls one at a time", () => { + expect(scene.landed(tools, tools.start)).toBe(0); + expect(scene.landed(tools, tools.start + 1)).toBe(1); + expect(scene.landed(tools, tools.end)).toBe(2); + }); + + it("streams the agent's text", () => { + expect(scene.streamed(reply, reply.start)).toBe(""); + const partial = scene.streamed(reply, midway(reply)); + expect(partial.length).toBeGreaterThan(0); + expect(partial.length).toBeLessThan(REPLY.length); + expect(REPLY.startsWith(partial)).toBe(true); + expect(scene.streamed(reply, reply.end)).toBe(REPLY); + }); + + it("reaches a mark after the beats before it and reports progress through it", () => { + expect(scene.reached("renamed", tools.end)).toBe(false); + expect(scene.reached("renamed", tools.end + 1)).toBe(true); + expect(scene.progress("renamed", tools.end + 100)).toBeCloseTo(0.25); + expect(scene.progress("renamed", reply.start)).toBe(1); + }); + + it("glides the pointer to its target, presses, and lets go", () => { + const pressedAt = firstMs(composerClick.pressed); + const doneAt = firstMs(composerClick.done); + + expect(composerClick.opacity(POINTER_ENTERS)).toBe(0); + expect(composerClick.approach(POINTER_ENTERS)).toBe(0); + + const gliding = (POINTER_ENTERS + pressedAt) / 2; + expect(composerClick.opacity(gliding)).toBe(1); + expect(composerClick.approach(gliding)).toBeGreaterThan(0); + expect(composerClick.approach(gliding)).toBeLessThan(1); + expect(composerClick.pressed(gliding)).toBe(false); + + expect(composerClick.approach(pressedAt)).toBe(1); + expect(composerClick.done(pressedAt)).toBe(false); + + expect(doneAt).toBeGreaterThan(pressedAt); + expect(composerClick.pressed(doneAt)).toBe(false); + }); + + it("keeps the pointer where it clicked until the user types", () => { + const typingAt = firstMs(composerClick.done) + PAUSE_BEFORE_TYPING; + expect(composerClick.opacity(typingAt - 1)).toBe(1); + expect(pointed.draft(typingAt - 1)).toBe(""); + + // The pointer fades away while the first characters land. + expect(pointed.draft(typingAt + 1)).not.toBe(""); + expect(composerClick.opacity(typingAt + 1)).toBeLessThan(1); + expect(composerClick.opacity(typingAt + 500)).toBe(0); + expect(composerClick.done(typingAt + 500)).toBe(true); + }); + + it("fades the pointer in when it comes back after typing", () => { + const setsOffAt = firstMs((ms) => pillClick.approach(ms) > 0); + expect(pillClick.opacity(setsOffAt)).toBeGreaterThan(0); + expect(pillClick.opacity(setsOffAt)).toBeLessThan(1); + }); + + it("moves one pointer from a click to the click after it", () => { + const handoffAt = firstMs(pillClick.done); + expect(pillClick.opacity(handoffAt - 1)).toBe(1); + expect(menuClick.opacity(handoffAt - 1)).toBe(0); + + expect(pillClick.opacity(handoffAt)).toBe(0); + expect(menuClick.opacity(handoffAt)).toBe(1); + expect(menuClick.approach(handoffAt)).toBe(0); + }); + + it("leaves the pointer on the last thing it clicked", () => { + expect(menuClick.opacity(pointed.duration)).toBe(1); + expect(menuClick.approach(pointed.duration)).toBe(1); + expect(menuClick.done(pointed.duration)).toBe(true); + expect(composerClick.opacity(pointed.duration)).toBe(0); + expect(composerClick.done(pointed.duration)).toBe(true); + }); + + it("ends a turn without a footer when the beat gives no time worked", () => { + const quiet = script([ + { kind: "user", text: REQUEST }, + { kind: "agent", text: REPLY }, + { kind: "turnEnd" }, + { kind: "wait", ms: 300 }, + ]); + const [, quietReply] = quiet.entries; + expect(quiet.entries.map((entry) => entry.beat.kind)).toEqual(["user", "agent"]); + expect(quiet.busy(quietReply.end - 1)).toBe(true); + expect(quiet.busy(quietReply.end)).toBe(false); + }); + + it("shows the finished scene at its duration", () => { + expect(scene.duration).toBe(turnEnd.end); + expect(scene.entered(scene.duration)).toBe(scene.entries.length); + expect(scene.draft(scene.duration)).toBe(""); + expect(scene.busy(scene.duration)).toBe(false); + expect(scene.reached("renamed", scene.duration)).toBe(true); + }); +}); diff --git a/packages/website/src/components/mockup/script.ts b/packages/website/src/components/mockup/script.ts new file mode 100644 index 000000000..7079a587f --- /dev/null +++ b/packages/website/src/components/mockup/script.ts @@ -0,0 +1,267 @@ +import type { RemoteHostId } from "./hosts"; + +/** + * A collapsed tool call as the app's timeline shows it. Built-in tools carry a + * fixed label; Paseo MCP tools name their action, such as "Create agent". + */ +export type ToolCall = + | { kind: "read" | "write" | "shell"; detail: string } + | { kind: "paseo"; label: string; detail?: string; host?: RemoteHostId }; + +/** + * One step of a scripted scene. Beats play in order, each after the one before it ends. + * + * - `wait`: nothing happens. + * - `click`: the pointer glides to a named target and clicks it. + * - `type`: the user types into the composer. + * - `user`: the typed message is sent and joins the transcript. + * - `agent`: the agent's text streams into the transcript. + * - `tools`: the agent's tool calls land one at a time. + * - `turnEnd`: the turn finishes. With `worked`, its footer joins the transcript. + * - `mark`: a named moment the rest of the window reacts to, such as a panel opening. + */ +export type Beat = + | { kind: "wait"; ms: number } + | { kind: "click"; target: Target } + | { kind: "type"; text: string } + | { kind: "user"; text: string } + | { kind: "agent"; text: string } + | { kind: "tools"; calls: ToolCall[] } + | { kind: "turnEnd"; worked?: string } + | { kind: "mark"; name: Mark; ms: number }; + +type TranscriptBeat = + | Extract + | { kind: "turnEnd"; worked: string }; + +/** A beat that leaves something in the transcript, with the span of time it plays over. */ +export interface TranscriptEntry { + id: string; + start: number; + end: number; + beat: TranscriptBeat; +} + +/** One click of the pointer: it glides to its target, presses the button, and lets go. */ +export interface PointerClick { + /** + * How visible the pointer is for this click, from 0 to 1. It fades in on its way, and fades out + * when the user types. A click right after another one takes the same pointer over, with no fade. + */ + opacity(ms: number): number; + /** How far the pointer has come on its way to the target, from 0 to 1. */ + approach(ms: number): number; + /** Whether the pointer's button is down on the target. */ + pressed(ms: number): boolean; + /** Whether the click has happened: the button went down and came back up. */ + done(ms: number): boolean; +} + +/** The click target every scripted chat has. Clicking it puts the caret in the composer. */ +export const COMPOSER = "composer"; + +/** What a chat pane reads from a script: the composer and the transcript at a point in time. */ +export interface SceneScript { + /** The length of the whole script. At this time the scene shows its finished state. */ + duration: number; + entries: TranscriptEntry[]; + /** What the user is typing: the text so far, until it is sent. */ + draft(ms: number): string; + /** Whether a turn is running: from the user's message until the turn ends. */ + busy(ms: number): boolean; + /** How many transcript entries have started. */ + entered(ms: number): number; + /** How much of an agent entry's text has streamed in. */ + streamed(entry: TranscriptEntry, ms: number): string; + /** How many of a tools entry's calls have landed. */ + landed(entry: TranscriptEntry, ms: number): number; + /** The script's click on a target. */ + click(target: string): PointerClick; +} + +export interface Script extends SceneScript { + click(target: Target): PointerClick; + /** Whether a mark has started. */ + reached(mark: Mark, ms: number): boolean; + /** How far through a mark the scene is, from 0 to 1. */ + progress(mark: Mark, ms: number): number; +} + +// A demo types and streams faster than a person or a model does, and still reads as both. +const TYPING_MS_PER_CHARACTER = 14; +const SHORTEST_TYPING_MS = 700; +const PAUSE_BEFORE_SEND_MS = 320; +const SEND_MS = 420; +const STREAM_MS_PER_CHARACTER = 8; +const TOOL_CALL_MS = 320; +const TURN_END_MS = 420; +const POINTER_APPROACH_MS = 900; +const POINTER_PRESS_MS = 240; +const POINTER_FADE_MS = 150; + +function typingMs(text: string): number { + return Math.max(SHORTEST_TYPING_MS, text.length * TYPING_MS_PER_CHARACTER); +} + +function beatMs(beat: Beat): number { + switch (beat.kind) { + case "wait": + case "mark": + return beat.ms; + case "click": + return POINTER_APPROACH_MS + POINTER_PRESS_MS; + case "type": + return typingMs(beat.text) + PAUSE_BEFORE_SEND_MS; + case "user": + return SEND_MS; + case "agent": + return beat.text.length * STREAM_MS_PER_CHARACTER; + case "tools": + return beat.calls.length * TOOL_CALL_MS; + case "turnEnd": + return TURN_END_MS; + } +} + +function isTranscriptBeat(beat: Beat): beat is TranscriptBeat { + if (beat.kind === "turnEnd") return beat.worked !== undefined; + return beat.kind === "user" || beat.kind === "agent" || beat.kind === "tools"; +} + +function fraction(start: number, end: number, ms: number): number { + if (ms <= start) return 0; + if (ms >= end) return 1; + return (ms - start) / (end - start); +} + +// A hand speeds a mouse up and slows it down again. +function easeInOut(linear: number): number { + return linear < 0.5 ? 2 * linear * linear : 1 - (-2 * linear + 2) ** 2 / 2; +} + +function hundredths(value: number): number { + return Math.round(value * 100) / 100; +} + +/** How a click's pointer comes and goes. */ +interface PointerPresence { + /** When the pointer sets off. */ + start: number; + /** Whether the pointer is already on screen, at the click before this one. */ + continues: boolean; + /** When the pointer goes away, or `Infinity` when it stays to the end of the scene. */ + leaves: number; + /** Whether the next click takes the pointer over. Otherwise typing fades it out. */ + handsOver: boolean; +} + +function pointerClick({ start, continues, leaves, handsOver }: PointerPresence): PointerClick { + const pressStart = start + POINTER_APPROACH_MS; + const pressEnd = pressStart + POINTER_PRESS_MS; + return { + opacity(ms) { + if (ms >= leaves) { + return handsOver ? 0 : hundredths(1 - fraction(leaves, leaves + POINTER_FADE_MS, ms)); + } + if (continues) return ms >= start ? 1 : 0; + return hundredths(fraction(start, start + POINTER_FADE_MS, ms)); + }, + approach: (ms) => Math.round(easeInOut(fraction(start, pressStart, ms)) * 1000) / 1000, + pressed: (ms) => ms >= pressStart && ms < pressEnd, + done: (ms) => ms >= pressEnd, + }; +} + +/** Lays beats end to end and answers what the scene shows at any time. */ +export function script( + beats: Beat[], +): Script { + let clock = 0; + const timed = beats.map((beat, index) => { + const start = clock; + clock += beatMs(beat); + return { id: `${index}:${beat.kind}`, start, end: clock, beat }; + }); + const duration = clock; + + const entries: TranscriptEntry[] = []; + const typing: { start: number; end: number; text: string }[] = []; + const turns: { start: number; end: number }[] = []; + const marks = new Map(); + const clicks = new Map(); + // A hand that types is off the mouse, and the pointer has one place at a time. So typing takes + // the pointer off screen, and a click that follows a click takes the pointer over from it. + let pointerOnScreen = false; + timed.forEach(({ start, beat }, index) => { + if (beat.kind === "type") pointerOnScreen = false; + if (beat.kind !== "click") return; + const next = timed + .slice(index + 1) + .find((later) => later.beat.kind === "type" || later.beat.kind === "click"); + clicks.set( + beat.target, + pointerClick({ + start, + continues: pointerOnScreen, + leaves: next ? next.start : Infinity, + handsOver: next?.beat.kind === "click", + }), + ); + pointerOnScreen = true; + }); + for (const { id, start, end, beat } of timed) { + if (isTranscriptBeat(beat)) entries.push({ id, start, end, beat }); + if (beat.kind === "type") typing.push({ start, end, text: beat.text }); + if (beat.kind === "user") turns.push({ start, end: duration }); + if (beat.kind === "turnEnd") { + const turn = turns.at(-1); + if (turn) turn.end = start; + } + if (beat.kind === "mark") marks.set(beat.name, { start, end }); + } + + function span(mark: Mark) { + const found = marks.get(mark); + if (!found) throw new Error(`The script has no mark named ${mark}`); + return found; + } + + return { + duration, + entries, + draft(ms) { + const beat = typing.find(({ start, end }) => ms >= start && ms < end); + if (!beat) return ""; + const typed = fraction(beat.start, beat.start + typingMs(beat.text), ms); + return beat.text.slice(0, Math.ceil(typed * beat.text.length)); + }, + busy(ms) { + return turns.some(({ start, end }) => ms >= start && ms < end); + }, + entered(ms) { + // The last entry enters at the end of a script that closes on it, so the end counts. + return entries.filter(({ start }) => ms > start || ms >= duration).length; + }, + streamed(entry, ms) { + if (entry.beat.kind !== "agent") return ""; + const { text } = entry.beat; + return text.slice(0, Math.ceil(fraction(entry.start, entry.end, ms) * text.length)); + }, + landed(entry, ms) { + if (entry.beat.kind !== "tools") return 0; + return Math.ceil(fraction(entry.start, entry.end, ms) * entry.beat.calls.length); + }, + reached(mark, ms) { + return ms > span(mark).start || ms >= duration; + }, + progress(mark, ms) { + const { start, end } = span(mark); + return fraction(start, end, ms); + }, + click(target) { + const found = clicks.get(target); + if (!found) throw new Error(`The script has no click on ${target}`); + return found; + }, + }; +} diff --git a/packages/website/src/components/mockup/sidebar.tsx b/packages/website/src/components/mockup/sidebar.tsx index f1e5eeeed..b536a760b 100644 --- a/packages/website/src/components/mockup/sidebar.tsx +++ b/packages/website/src/components/mockup/sidebar.tsx @@ -6,7 +6,6 @@ import { CircleHelp, GitPullRequest, History, - House, PanelBottom, PanelLeft, Plus, @@ -18,10 +17,15 @@ import { SquarePlus, } from "lucide-react"; import type * as React from "react"; +import { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { SIDEBAR_W, TITLEBAR_H } from "./geometry"; +import { HostBadge, type RemoteHostId } from "./hosts"; import { PaseoMark } from "./icons"; import { FADE_IN, FADE_OUT } from "./motion"; +import { DELEGATED_TASKS, tasksDelegated } from "./orchestration"; +import { useSceneClock } from "./player"; +import { pluginInstalled } from "./plugin-build"; import type { MockupStateId } from "./states"; const SIDEBAR_STYLE = { width: SIDEBAR_W }; @@ -41,7 +45,7 @@ interface WorkspaceRow { title: string; avatar: Avatar; time: string; - host?: string; + host?: RemoteHostId; pr?: string; passed?: boolean; running?: boolean; @@ -65,6 +69,7 @@ const WORKING_ROWS: WorkspaceRow[] = [ id: "safe-area", title: "Fix commit safe area in emulators", avatar: PASEO, + host: "mac-mini", time: "4m", running: true, }, @@ -82,6 +87,7 @@ const READY_TO_REVIEW_ROWS: WorkspaceRow[] = [ id: "lineage", title: "Paseo homepage", avatar: PASEO, + host: "devbox", pr: "3981", passed: true, time: "now", @@ -97,6 +103,16 @@ const READY_TO_REVIEW_ROWS: WorkspaceRow[] = [ }, ]; +/** The workspaces the orchestrating agent created, one per delegated task. */ +const DELEGATED_ROWS: WorkspaceRow[] = DELEGATED_TASKS.map((task) => ({ + id: task.id, + title: task.title, + avatar: PASEO, + host: task.host, + time: "now", + running: true, +})); + const DONE_ROWS: WorkspaceRow[] = [ { id: "beta", title: "Release v0.7.0-beta.2", avatar: PASEO, time: "2h" }, { @@ -111,7 +127,7 @@ const DONE_ROWS: WorkspaceRow[] = [ id: "perms", title: "Design semantic permission sy…", avatar: PASEO, - host: "my-server", + host: "devbox", pr: "3981", passed: true, time: "7h", @@ -120,6 +136,7 @@ const DONE_ROWS: WorkspaceRow[] = [ id: "modules", title: "Plan modules and abstractions", avatar: PASEO, + host: "mac-mini", pr: "3884", passed: true, time: "1d", @@ -202,12 +219,7 @@ function RowMeta({ row }: { row: WorkspaceRow }) { if (row.host || row.pr) { return ( - {row.host ? ( - - - {row.host} - - ) : null} + {row.host ? : null} {row.host && row.pr ? · : null} {row.pr ? ( @@ -267,7 +279,18 @@ function GroupHeader({ icon, label }: { icon: React.ReactNode; label: string }) export function Sidebar({ state }: { state: MockupStateId }) { const { t } = useTranslation(); - const extending = state === "extend"; + // The plugin's item joins the nav when the plugin is installed, and each delegated workspace + // joins Working when the orchestrator creates it. + const pluginIsInstalled = useSceneClock("extend", pluginInstalled); + const delegated = useSceneClock("orchestrate", tasksDelegated); + const extending = state === "extend" && pluginIsInstalled; + const workingRows = useMemo( + () => + state === "orchestrate" + ? [...DELEGATED_ROWS.slice(0, delegated), ...WORKING_ROWS] + : WORKING_ROWS, + [state, delegated], + ); return (
@@ -321,7 +344,7 @@ export function Sidebar({ state }: { state: MockupStateId }) { - {WORKING_ROWS.map((row) => ( + {workingRows.map((row) => ( @@ -340,7 +363,7 @@ export function Sidebar({ state }: { state: MockupStateId }) { {t("landing.mockup.app.addProject")} - +
diff --git a/packages/website/src/components/mockup/states.ts b/packages/website/src/components/mockup/states.ts index 392244c26..c78033c8a 100644 --- a/packages/website/src/components/mockup/states.ts +++ b/packages/website/src/components/mockup/states.ts @@ -1,13 +1,9 @@ -/** - * The states the hero mockup can be in, in pill order. Labels are copy — edit - * them here and nothing else has to change. - */ -/** The scenes the hero mockup can show; each pill's label is `landing.mockup.`. */ -export const MOCKUP_STATES = ["build", "review", "ship", "extend"] as const; +/** The scenes the hero mockup can show, in pill order. Each pill's label is `landing.mockup.`. */ +export const MOCKUP_STATES = ["orchestrate", "remote", "review", "ship", "extend"] as const; export type MockupStateId = (typeof MOCKUP_STATES)[number]; -export const DEFAULT_MOCKUP_STATE: MockupStateId = "build"; +export const DEFAULT_MOCKUP_STATE: MockupStateId = "orchestrate"; /** Which states keep a panel docked to the right of the workspace. */ export function hasRightPanel(_state: MockupStateId): boolean { diff --git a/packages/website/src/components/mockup/titlebar.tsx b/packages/website/src/components/mockup/titlebar.tsx index de99f4db7..849519739 100644 --- a/packages/website/src/components/mockup/titlebar.tsx +++ b/packages/website/src/components/mockup/titlebar.tsx @@ -106,9 +106,17 @@ const WORKSPACE_TABS: Tab[] = [ const DIFF_TAB: Tab = { id: "diff", label: "Diff", icon: }; +/** The tab a scene has in front. The orchestrating agent is Claude; the remote scene is a terminal. */ +function activeTabId(state: MockupStateId): string { + if (state === "review") return DIFF_TAB.id; + if (state === "orchestrate") return "claude"; + if (state === "remote") return "terminal"; + return "codex"; +} + export function TabStrip({ state }: { state: MockupStateId }) { - const review = state === "review"; - const tabs = review ? [...WORKSPACE_TABS, DIFF_TAB] : WORKSPACE_TABS; + const tabs = state === "review" ? [...WORKSPACE_TABS, DIFF_TAB] : WORKSPACE_TABS; + const activeId = activeTabId(state); return (
{tab.icon} diff --git a/packages/website/src/components/mockup/window.tsx b/packages/website/src/components/mockup/window.tsx index ae95b6886..b2cf07bb3 100644 --- a/packages/website/src/components/mockup/window.tsx +++ b/packages/website/src/components/mockup/window.tsx @@ -1,57 +1,123 @@ import { AnimatePresence, MotionConfig, motion, useReducedMotion } from "framer-motion"; -import { AgentTranscript, Composer, PluginBuildTranscript } from "./chat"; -import { DESIGN_HEIGHT, DESIGN_WIDTH, RIGHT_PANEL_W } from "./geometry"; +import type * as React from "react"; +import { useMemo } from "react"; +import { + AgentTranscript, + Composer, + ProgressTrack, + ScriptedComposer, + ScriptedTranscript, + SubagentsTrack, +} from "./chat"; +import { DESIGN_HEIGHT, DESIGN_WIDTH } from "./geometry"; +import { HostsModal } from "./hosts"; import { FADE_IN, FADE_OUT, INSTANT_TRANSITION, MOCKUP_TRANSITION } from "./motion"; -import { DiffReviewPane } from "./panes"; -import { RightPanel } from "./right-panel"; +import { ORCHESTRATION } from "./orchestration"; +import { DiffReviewPane, RemoteTerminalPane } from "./panes"; +import { + createScenePlayer, + type ScenePlayer, + ScenePlayerContext, + usePlayerScene, + useSceneClock, +} from "./player"; +import { PLUGIN_BUILD, pluginInstalled } from "./plugin-build"; +import { REVIEW } from "./review"; +import type { ProviderId } from "./providers"; +import { type PanelId, panelWidth, RightPanel } from "./right-panel"; +import type { SceneScript } from "./script"; import { Sidebar } from "./sidebar"; -import { hasRightPanel, type MockupStateId } from "./states"; +import { DEFAULT_MOCKUP_STATE, hasRightPanel, type MockupStateId } from "./states"; import { TabStrip, TitleBar } from "./titlebar"; const WINDOW_STYLE = { width: DESIGN_WIDTH, height: DESIGN_HEIGHT }; -const PANEL_STYLE = { width: RIGHT_PANEL_W }; const PANEL_COLLAPSED = { width: 0, opacity: 0 }; -const PANEL_OPEN = { width: RIGHT_PANEL_W + 1, opacity: 1 }; -/** Which center pane a state shows. States sharing a key keep it mounted. */ -function centerKey(state: MockupStateId): string { - if (state === "review") return "review"; - if (state === "extend") return "extend"; - return "chat"; +/** Which panel is docked on the right. The plugin's panel exists once the plugin is installed. */ +function dockedPanel(state: MockupStateId, pluginIsInstalled: boolean): PanelId { + if (state === "ship") return "ship"; + if (state === "extend" && pluginIsInstalled) return "plugin"; + return "changes"; } -function panelKey(state: MockupStateId): string { - if (state === "ship") return "ship"; - if (state === "extend") return "extend"; - return "changes"; +// Elements passed as props are hoisted so they are not rebuilt on every render. +const PROGRESS_TRACK = ; + +/** The scenes that play a script, with the agent the user talks to and that agent's composer track. */ +const SCRIPTED_SCENES: Partial< + Record +> = { + orchestrate: { script: ORCHESTRATION, agent: "claude", track: }, + extend: { script: PLUGIN_BUILD, agent: "codex" }, +}; + +/** A player for the mockup's scenes. It opens on the default scene. */ +export function createMockupPlayer(): ScenePlayer { + return createScenePlayer(DEFAULT_MOCKUP_STATE, { + orchestrate: ORCHESTRATION.duration, + extend: PLUGIN_BUILD.duration, + review: REVIEW.duration, + }); +} + +export { usePlayerScene as useMockupScene }; + +/** What the agent tab in front says in each scene. */ +function Transcript({ state }: { state: MockupStateId }) { + const scripted = SCRIPTED_SCENES[state]; + if (scripted) return ; + return ; +} + +/** The composer under that transcript: whose agent it is, its track, and whether a turn runs. */ +function ChatComposer({ state }: { state: MockupStateId }) { + const scripted = SCRIPTED_SCENES[state]; + if (scripted) { + return ( + + ); + } + return ; } function CenterPane({ state }: { state: MockupStateId }) { if (state === "review") return ; + if (state === "remote") return ; return (
- {/* Bottom-anchored: the newest turn sits on the composer, older text clips. */} -
- {state === "extend" ? : } + {/* A chat scrolls like this: a short transcript starts at the top, and one taller than the + pane keeps its newest turn on the composer while older text clips. The reversed column + pins the bottom, and the auto margin lifts a short transcript to the top. */} +
+
+ +
- +
); } -/** The docked panel keeps its width while its contents swap. */ -function PanelCrossfade({ state }: { state: MockupStateId }) { +/** The docked panel's contents cross-fade when the panel it shows changes. */ +function PanelCrossfade({ panel }: { panel: PanelId }) { return ( -
+
+ {/* Each panel keeps its own width and the dock clips it, so nothing inside a panel + reflows while the dock resizes. */} - +
@@ -67,7 +133,7 @@ function CenterColumn({ state }: { state: MockupStateId }) {
({ width: panelWidth(panel) + 1, opacity: 1 }), [panel]); return (
- + ); } -export function MockupWindow({ state }: { state: MockupStateId }) { +export function MockupWindow({ player }: { player: ScenePlayer }) { const reduceMotion = useReducedMotion(); + const state = usePlayerScene(player); return ( - -
- {/* Three full-height columns, each owning its own header. The middle + + +
+ {/* Three full-height columns, each owning its own header. The middle header stops at the divider — it never spans over the right panel. */} - -
- - - {hasRightPanel(state) ? : null} - -
- + +
+ + + {hasRightPanel(state) ? : null} + + {/* The remote scene opens the hosts modal over the whole window, as the app dims + everything behind a modal. */} + + {state === "remote" ? ( + + + + ) : null} + +
+ + ); } diff --git a/packages/website/src/i18n/resources/en.json b/packages/website/src/i18n/resources/en.json index b179f2632..9326886f4 100644 --- a/packages/website/src/i18n/resources/en.json +++ b/packages/website/src/i18n/resources/en.json @@ -446,7 +446,8 @@ }, "mockup": { "alt": "Paseo desktop app with coding agents, a conversation, and a code diff open side by side", - "build": "Parallel agents", + "orchestrate": "Orchestration", + "remote": "Remote", "review": "Code review", "ship": "Pull requests", "extend": "Plugins", @@ -459,6 +460,15 @@ "working": "Working", "done": "Done", "addProject": "Add project", + "addHost": "Add host", + "hosts": "Hosts", + "agentCount": "{{count}} agents", + "hostLinks": { + "local": "Local", + "relay": "Relay", + "tailscale": "Tailscale", + "ssh": "SSH" + }, "files": "Files", "changes": "Changes", "uncommitted": "Uncommitted", @@ -473,6 +483,11 @@ "tasksProgress": "{{completed}}/{{total}} tasks", "composerPlaceholder": "Message the agent, tag @files, or use /commands and /skills", "mobileComposerPlaceholder": "Message, @files, /commands", + "reviewCommentPlaceholder": "Leave a comment", + "reviewCancel": "Cancel", + "reviewSave": "Comment", + "sendFeedback": "Send feedback ({{count}})", + "feedbackSent": "Feedback sent to {{recipient}}", "plugin": "plugin", "mergedWeek": "Merged · 7d", "inReview": "In review", @@ -482,7 +497,8 @@ "minutesAgo": "{{count}}m ago", "hoursAgo": "{{count}}h ago", "reviewing": "reviewing", - "subagents": "{{count}} subagents", + "subagents_one": "{{count}} subagent", + "subagents_other": "{{count}} subagents", "checksPassedShort": "passed" } } diff --git a/packages/website/src/i18n/resources/zh-CN.json b/packages/website/src/i18n/resources/zh-CN.json index cc20bdb43..7c1d8d961 100644 --- a/packages/website/src/i18n/resources/zh-CN.json +++ b/packages/website/src/i18n/resources/zh-CN.json @@ -446,7 +446,8 @@ }, "mockup": { "alt": "Paseo 桌面应用,并排打开了编程 Agent、一段对话和一份代码 diff", - "build": "并行 Agent", + "orchestrate": "编排", + "remote": "远程", "review": "代码审查", "ship": "Pull Request", "extend": "插件", @@ -459,6 +460,15 @@ "working": "运行中", "done": "已完成", "addProject": "添加 project", + "addHost": "添加主机", + "hosts": "主机", + "agentCount": "{{count}} 个 Agent", + "hostLinks": { + "local": "本地", + "relay": "中继", + "tailscale": "Tailscale", + "ssh": "SSH" + }, "files": "文件", "changes": "变更", "uncommitted": "未 commit", @@ -473,6 +483,11 @@ "tasksProgress": "{{completed}}/{{total}} 项任务", "composerPlaceholder": "给 Agent 发消息,标记 @files,或使用 /commands 和 /skills", "mobileComposerPlaceholder": "发消息,@files,/commands", + "reviewCommentPlaceholder": "留下评论", + "reviewCancel": "取消", + "reviewSave": "评论", + "sendFeedback": "发送反馈 ({{count}})", + "feedbackSent": "已向 {{recipient}} 发送反馈", "plugin": "插件", "mergedWeek": "已合并 · 7 天", "inReview": "审查中", @@ -482,7 +497,8 @@ "minutesAgo": "{{count}} 分钟前", "hoursAgo": "{{count}} 小时前", "reviewing": "审查中", - "subagents": "{{count}} 个 subagent", + "subagents_one": "{{count}} 个 subagent", + "subagents_other": "{{count}} 个 subagent", "checksPassedShort": "通过" } } diff --git a/packages/website/src/styles.css b/packages/website/src/styles.css index cadcce2b6..8d007eb5d 100644 --- a/packages/website/src/styles.css +++ b/packages/website/src/styles.css @@ -770,7 +770,11 @@ --color-mock-tile-violet: #7a6aa8; --color-mock-tile-amber: #8f7838; --color-mock-tile-teal: #368080; + /* Host badge ink — the identity colors as foreground, IDENTITY_FOREGROUND_DARK in the + same file. */ --color-mock-host-teal: #6cacab; + --color-mock-host-violet: #a392d5; + --color-mock-host-orange: #cc8f64; /* Status *dot* band (dark: L=0.72, chroma 90%). Sidebar row state dots only. theme.ts:198-204. */