Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(web): make the hero iPhones live and tappable

leepokaif3b7495e0225
diff --git a/web/app/components/hero.tsx b/web/app/components/hero.tsx
index fd62e949..09f4b462 100644
--- a/web/app/components/hero.tsx
+++ b/web/app/components/hero.tsx
@@ -1,9 +1,9 @@
"use client";
-import { motion, useReducedMotion } from "framer-motion";
+import { motion, MotionConfig } from "framer-motion";
import { AppleLogo, DeviceMobile, GithubLogo } from "@phosphor-icons/react";
import Halftone from "./halftone";
-import Phone from "./phone";
+import LivePhones from "./live-phone/live-phones";
import { APP_STORE, DMG, GITHUB, PRODUCT_HUNT } from "../links";
const ease = [0.16, 1, 0.3, 1] as const;
@@ -12,85 +12,74 @@ const button =
const secondary = "bg-neutral-900 text-neutral-100 hover:bg-neutral-800";
export default function Hero() {
- const reduce = useReducedMotion();
- const rise = (delay: number) =>
- reduce
- ? {}
- : { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.7, delay, ease } };
+ // Same markup on server and client (React keeps the server's opacity: 0 otherwise);
+ // MotionConfig drops the movement for reduced motion.
+ const rise = (delay: number) => ({
+ initial: { opacity: 0, y: 20 },
+ animate: { opacity: 1, y: 0 },
+ transition: { duration: 0.7, delay, ease },
+ });
return (
- <section className="relative overflow-hidden px-4 pt-12 pb-32 sm:px-6 md:pt-20 md:pb-44">
- <Halftone corner="top-right" className="w-[44rem] max-w-[90vw] text-neutral-50 opacity-[0.16]" />
- <Halftone corner="bottom-left" className="w-[22rem] max-w-[60vw] text-neutral-50 opacity-[0.12]" />
- <motion.a
- {...rise(0)}
- href={PRODUCT_HUNT}
- target="_blank"
- rel="noopener noreferrer"
- className="relative mx-auto mb-10 flex w-fit items-center gap-3 transition hover:opacity-80 md:mb-14"
- >
- {/* eslint-disable-next-line @next/next/no-img-element -- live badge served by Product Hunt */}
- <img
- src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1267264&theme=dark"
- alt="Codync on Product Hunt"
- width={250}
- height={54}
- className="h-10 w-auto"
- />
- <span className="text-sm font-medium text-neutral-300">#16 Product of the Day</span>
- </motion.a>
- <div className="relative mx-auto grid max-w-6xl grid-cols-1 items-center gap-14 md:grid-cols-[1.1fr_1fr] md:gap-8">
- <div>
- <motion.h1
- {...rise(0.04)}
- className="text-4xl font-semibold leading-[1.05] tracking-tighter text-neutral-50 sm:text-5xl lg:text-[3.5rem]"
- >
- The 100% free, <span className="whitespace-nowrap">open-source</span> Grok Bot / Muse alternative.
- </motion.h1>
- <motion.p {...rise(0.08)} className="mt-5 text-2xl font-medium tracking-tight text-neutral-300 md:text-3xl">
- Message your AI agents like teammates, for code and everyday life.
- </motion.p>
- <motion.p {...rise(0.12)} className="mt-5 max-w-[34rem] text-lg leading-relaxed text-neutral-400">
- Codync runs Claude Code, Codex and 40+ agents as named bots on your own computer. They write code,
- sort your inbox, plan your week and run routines with the apps you connect. Reply and approve from your
- iPhone, Mac, Linux desktop or a terminal over SSH. MIT licensed, no hidden fees.
- </motion.p>
- <motion.div {...rise(0.18)} className="mt-9 flex flex-wrap gap-3">
- <a href={DMG} className={`${button} bg-neutral-50 text-neutral-950 hover:bg-white`}>
- <AppleLogo size={18} weight="fill" />
- Download for Mac
- </a>
- <a href={APP_STORE} target="_blank" rel="noopener noreferrer" className={`${button} ${secondary}`}>
- <DeviceMobile size={18} weight="fill" />
- iPhone app
- </a>
- <a href={GITHUB} target="_blank" rel="noopener noreferrer" className={`${button} ${secondary}`}>
- <GithubLogo size={18} weight="fill" />
- Star on GitHub
- </a>
- </motion.div>
- </div>
+ <MotionConfig reducedMotion="user">
+ <section className="relative overflow-hidden px-4 pt-12 pb-32 sm:px-6 md:pt-20 md:pb-44">
+ <Halftone corner="top-right" className="w-[44rem] max-w-[90vw] text-neutral-50 opacity-[0.16]" />
+ <Halftone corner="bottom-left" className="w-[22rem] max-w-[60vw] text-neutral-50 opacity-[0.12]" />
+ <motion.a
+ {...rise(0)}
+ href={PRODUCT_HUNT}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="relative mx-auto mb-10 flex w-fit items-center gap-3 transition hover:opacity-80 md:mb-14"
+ >
+ {/* eslint-disable-next-line @next/next/no-img-element -- live badge served by Product Hunt */}
+ <img
+ src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1267264&theme=dark"
+ alt="Codync on Product Hunt"
+ width={250}
+ height={54}
+ className="h-10 w-auto"
+ />
+ <span className="text-sm font-medium text-neutral-300">#16 Product of the Day</span>
+ </motion.a>
+ <div className="relative mx-auto grid max-w-6xl grid-cols-1 items-center gap-14 md:grid-cols-[1.1fr_1fr] md:gap-8">
+ <div>
+ <motion.h1
+ {...rise(0.04)}
+ className="text-4xl font-semibold leading-[1.05] tracking-tighter text-neutral-50 sm:text-5xl lg:text-[3.5rem]"
+ >
+ The 100% free, <span className="whitespace-nowrap">open-source</span> Grok Bot / Muse alternative.
+ </motion.h1>
+ <motion.p {...rise(0.08)} className="mt-5 text-2xl font-medium tracking-tight text-neutral-300 md:text-3xl">
+ Message your AI agents like teammates, for code and everyday life.
+ </motion.p>
+ <motion.p {...rise(0.12)} className="mt-5 max-w-[34rem] text-lg leading-relaxed text-neutral-400">
+ Codync runs Claude Code, Codex and 40+ agents as named bots on your own computer. They write code,
+ sort your inbox, plan your week and run routines with the apps you connect. Reply and approve from your
+ iPhone, Mac, Linux desktop or a terminal over SSH. MIT licensed, no hidden fees.
+ </motion.p>
+ <motion.div {...rise(0.18)} className="mt-9 flex flex-wrap gap-3">
+ <a href={DMG} className={`${button} bg-neutral-50 text-neutral-950 hover:bg-white`}>
+ <AppleLogo size={18} weight="fill" />
+ Download for Mac
+ </a>
+ <a href={APP_STORE} target="_blank" rel="noopener noreferrer" className={`${button} ${secondary}`}>
+ <DeviceMobile size={18} weight="fill" />
+ iPhone app
+ </a>
+ <a href={GITHUB} target="_blank" rel="noopener noreferrer" className={`${button} ${secondary}`}>
+ <GithubLogo size={18} weight="fill" />
+ Star on GitHub
+ </a>
+ </motion.div>
+ </div>
- {/* The second phone hangs below this column, so reserve room for it. */}
- <div className="relative mx-auto mb-16 w-full max-w-[26rem] md:mb-20 md:max-w-none">
- <motion.div
- {...(reduce
- ? {}
- : { initial: { opacity: 0, y: 40 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.9, delay: 0.1, ease } })}
- className="relative w-[58%]"
- >
- <Phone src="/screens/roster.webp" alt="The Codync bot list: Pacer needs approval, the other bots have replied" eager />
- </motion.div>
- <motion.div
- {...(reduce
- ? {}
- : { initial: { opacity: 0, y: 60 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.9, delay: 0.25, ease } })}
- className="absolute top-[10%] right-0 z-10 w-[58%]"
- >
- <Phone src="/screens/approval.webp" alt="An approval card asking to edit src/pace.js with Allow once, Always allow and Deny" eager />
- </motion.div>
+ {/* The second phone hangs below this column, so reserve room for it. */}
+ <div className="relative mx-auto mb-16 w-full max-w-[26rem] md:mb-20 md:max-w-none">
+ <LivePhones />
+ </div>
</div>
- </div>
- </section>
+ </section>
+ </MotionConfig>
);
}
diff --git a/web/app/components/live-phone/avatar.tsx b/web/app/components/live-phone/avatar.tsx
new file mode 100644
index 00000000..73914c00
--- /dev/null
+++ b/web/app/components/live-phone/avatar.tsx
@@ -0,0 +1,253 @@
+"use client";
+
+import { useEffect, useMemo, useState } from "react";
+import { useReducedMotion } from "framer-motion";
+import { palette, swatch } from "./data";
+
+// Port of CodyncKit/Design/CharacterAvatar.swift: the halftone character, dot for dot.
+
+/** Rounded so server (Node) and browser math print the same SVG. */
+const q = (v: number) => Math.round(v * 1000) / 1000;
+
+export type Mood = "idle" | "working" | "needs";
+type Pt = [number, number];
+
+const ellipse = (x: number, y: number, w: number, h: number): Pt[] =>
+ Array.from({ length: 48 }, (_, i) => {
+ const a = (i / 48) * 2 * Math.PI;
+ return [x + w / 2 + (Math.cos(a) * w) / 2, y + h / 2 + (Math.sin(a) * h) / 2];
+ });
+
+const roundedRect = (x: number, y: number, w: number, h: number, r: number): Pt[] => {
+ const out: Pt[] = [];
+ const corners: [number, number, number][] = [
+ [x + w - r, y + r, -Math.PI / 2],
+ [x + w - r, y + h - r, 0],
+ [x + r, y + h - r, Math.PI / 2],
+ [x + r, y + r, Math.PI],
+ ];
+ for (const [cx, cy, start] of corners)
+ for (let i = 0; i <= 8; i++) {
+ const a = start + (i / 8) * (Math.PI / 2);
+ out.push([cx + Math.cos(a) * r, cy + Math.sin(a) * r]);
+ }
+ return out;
+};
+
+const quad = (p0: Pt, c: Pt, p1: Pt): Pt[] =>
+ Array.from({ length: 16 }, (_, i) => {
+ const t = (i + 1) / 16, u = 1 - t;
+ return [u * u * p0[0] + 2 * u * t * c[0] + t * t * p1[0], u * u * p0[1] + 2 * u * t * c[1] + t * t * p1[1]];
+ });
+
+const cubic = (p0: Pt, c1: Pt, c2: Pt, p1: Pt): Pt[] =>
+ Array.from({ length: 20 }, (_, i) => {
+ const t = (i + 1) / 20, u = 1 - t;
+ const k = [u * u * u, 3 * u * u * t, 3 * u * t * t, t * t * t];
+ return [
+ k[0] * p0[0] + k[1] * c1[0] + k[2] * c2[0] + k[3] * p1[0],
+ k[0] * p0[1] + k[1] * c1[1] + k[2] * c2[1] + k[3] * p1[1],
+ ];
+ });
+
+function inside(poly: Pt[], [x, y]: Pt) {
+ let hit = false;
+ for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
+ const [xi, yi] = poly[i], [xj, yj] = poly[j];
+ if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) hit = !hit;
+ }
+ return hit;
+}
+
+function nearEdge(poly: Pt[], [x, y]: Pt, d: number) {
+ for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
+ const [ax, ay] = poly[j], [bx, by] = poly[i];
+ const t = Math.max(0, Math.min(1, ((x - ax) * (bx - ax) + (y - ay) * (by - ay)) / ((bx - ax) ** 2 + (by - ay) ** 2)));
+ if (Math.hypot(x - ax - t * (bx - ax), y - ay - t * (by - ay)) <= d) return true;
+ }
+ return false;
+}
+
+/** CharacterShape: the eight silhouettes, as a point-in-shape test. */
+function contains(kind: string, s: number): (p: Pt) => boolean {
+ const w = s, h = s;
+ switch (kind) {
+ case "pebble": {
+ const p = ellipse(0, h * 0.1, w, h * 0.8);
+ return (pt) => inside(p, pt);
+ }
+ case "squircle": {
+ const p = roundedRect(w * 0.04, h * 0.04, w * 0.92, h * 0.92, w * 0.3);
+ return (pt) => inside(p, pt);
+ }
+ case "tablet": {
+ const p = roundedRect(w * 0.14, 0, w * 0.72, h, w * 0.22);
+ return (pt) => inside(p, pt);
+ }
+ case "wedge": {
+ const a: Pt = [w * 0.5, h * 0.04], b: Pt = [w * 0.98, h * 0.86], c: Pt = [w * 0.02, h * 0.86];
+ const p = [a, ...quad(a, [w * 0.9, h * 0.4], b), ...quad(b, [w * 0.5, h * 1.04], c), ...quad(c, [w * 0.1, h * 0.4], a)];
+ return (pt) => inside(p, pt);
+ }
+ case "hex": {
+ const p = Array.from({ length: 6 }, (_, i): Pt => {
+ const a = (i * Math.PI) / 3 - Math.PI / 2;
+ return [w / 2 + Math.cos(a) * w * 0.49, h / 2 + Math.sin(a) * h * 0.49];
+ });
+ // The polygon unioned with its round-joined stroke (width 0.08w).
+ return (pt) => inside(p, pt) || nearEdge(p, pt, w * 0.04);
+ }
+ case "cloud": {
+ const parts = [
+ ellipse(0, h * 0.3, w * 0.55, h * 0.55),
+ ellipse(w * 0.45, h * 0.3, w * 0.55, h * 0.55),
+ ellipse(w * 0.18, h * 0.08, w * 0.64, h * 0.64),
+ roundedRect(w * 0.1, h * 0.5, w * 0.8, h * 0.35, w * 0.15),
+ ];
+ return (pt) => parts.some((p) => inside(p, pt));
+ }
+ case "teardrop": {
+ const top: Pt = [w * 0.5, 0], right: Pt = [w * 0.94, h * 0.62], left: Pt = [w * 0.06, h * 0.62];
+ const arc = Array.from({ length: 24 }, (_, i): Pt => {
+ const a = ((i + 1) / 24) * Math.PI;
+ return [w * 0.5 + Math.cos(a) * w * 0.44, h * 0.62 + Math.sin(a) * w * 0.44];
+ });
+ const p = [top, ...cubic(top, [w * 0.62, h * 0.2], [w * 0.94, h * 0.38], right), ...arc, ...cubic(left, [w * 0.06, h * 0.38], [w * 0.38, h * 0.2], top)];
+ return (pt) => inside(p, pt);
+ }
+ default: {
+ const p = Array.from({ length: 64 }, (_, i): Pt => {
+ const a = (i / 64) * 2 * Math.PI;
+ const rr = 0.46 + 0.035 * Math.sin(a * 3 + 0.6);
+ return [w / 2 + Math.cos(a) * w * rr, h / 2 + Math.sin(a) * h * rr];
+ });
+ return (pt) => inside(p, pt);
+ }
+ }
+}
+
+type Dot = { row: number; col: number; x: number; y: number };
+
+function dotGrid(shape: string, size: number) {
+ const cells = size < 18 ? 7 : size < 28 ? 9 : 13;
+ const step = size / cells;
+ const test = contains(shape, size);
+ const dots: Dot[] = [];
+ for (let row = 0; row < cells; row++)
+ for (let col = 0; col < cells; col++) {
+ const x = (col + 0.5) * step, y = (row + 0.5) * step;
+ if (test([x, y])) dots.push({ row, col, x, y });
+ }
+ return {
+ cells,
+ step,
+ dots,
+ eyeColumns: cells === 7 ? [2, 4] : cells === 9 ? [3, 6] : [4, 8],
+ eyeRows: cells === 13 ? [4, 5, 6] : cells === 9 ? [3, 4] : [2, 3],
+ };
+}
+
+type Pose = { yaw: number; glance: number; blinking: boolean; ripple: number | null };
+
+/** DottedBody.inks: shades the dots as a lit ball, the eyes stay hollow. */
+function inks(g: ReturnType<typeof dotGrid>, size: number, pose: Pose) {
+ const eyeRows = pose.blinking ? g.eyeRows.slice(-1) : g.eyeRows;
+ const eyeCols = g.eyeColumns.map((c) => c + pose.glance);
+ const half = size / 2;
+ const lx = Math.sin(pose.yaw) * 0.8, ly = 0.55, lz = Math.cos(pose.yaw) * 0.5 + 0.6;
+ const ll = Math.hypot(lx, ly, lz);
+ return g.dots
+ .filter((d) => !(eyeCols.includes(d.col) && eyeRows.includes(d.row)))
+ .map((d) => {
+ const u = (d.x - half) / half, v = (half - d.y) / half;
+ const z = Math.sqrt(Math.max(0.2, 1 - u * u - v * v));
+ const nl = Math.hypot(u, v, z);
+ let shade = 0.3 + 0.7 * Math.max(0, (u * lx + v * ly + z * lz) / (nl * ll));
+ if (pose.ripple !== null) shade *= 0.6 + 0.4 * (0.5 + 0.5 * Math.sin(Math.hypot(u, v) * 9 - pose.ripple));
+ return {
+ d,
+ r: g.step * 0.42 * (0.55 + 0.45 * shade),
+ ink: g.cells < 13 ? 0.4 + 0.4 * shade : 0.2 + 0.4 * Math.min(1, shade / 0.7),
+ tint: shade > 0.6 ? (shade - 0.6) / 0.4 : 0,
+ };
+ });
+}
+
+/** Seconds since mount, ticking every frame while `run` (TimelineView(.animation)). */
+export function useClock(run: boolean) {
+ const [t, setT] = useState(0);
+ useEffect(() => {
+ if (!run) return;
+ let id = 0;
+ const start = performance.now();
+ const tick = (now: number) => {
+ setT((now - start) / 1000);
+ id = requestAnimationFrame(tick);
+ };
+ id = requestAnimationFrame(tick);
+ return () => cancelAnimationFrame(id);
+ }, [run]);
+ return run ? t : 0;
+}
+
+export function CharacterAvatar({ shape, color, size, mood = "idle" }: { shape: string; color: string; size: number; mood?: Mood }) {
+ const reduce = useReducedMotion();
+ const g = useMemo(() => dotGrid(shape, size), [shape, size]);
+ const still = mood === "idle" || !!reduce;
+ const t = useClock(!still);
+ const pose: Pose = {
+ yaw: mood === "working" ? t * 1.4 : -0.7,
+ glance: mood === "working" ? Math.round(Math.sin((t * 2 * Math.PI) / 3.2) * 1.4) : 0,
+ // t > 0: the first (server-rendered) frame never blinks, whatever Reduce Motion says.
+ blinking: !still && t > 0 && (t / 4.7) % 1 < 0.035,
+ ripple: mood === "needs" ? t * 5 : null,
+ };
+ const tint = swatch(color);
+ return (
+ <svg width={size} height={size} viewBox={`0 0 ${size} ${size}`} aria-hidden className="block shrink-0">
+ {inks(g, size, pose).map(({ d, r, ink, tint: k }) => (
+ <g key={d.row * 100 + d.col}>
+ <circle cx={q(d.x)} cy={q(d.y)} r={q(r)} fill={palette.text} fillOpacity={q(ink)} />
+ {k > 0 && <circle cx={q(d.x)} cy={q(d.y)} r={q(r)} fill={tint} fillOpacity={q(k)} />}
+ </g>
+ ))}
+ </svg>
+ );
+}
+
+export type Face = { shape: string; color: string; mood?: Mood };
+
+/** GroupAvatar for two members: tucked diagonally like iMessage. */
+export function GroupAvatar({ members, size }: { members: Face[]; size: number }) {
+ const side = size * 0.66;
+ return (
+ <div className="relative shrink-0" style={{ width: size, height: size }} aria-hidden>
+ <div className="absolute top-0 right-0">
+ <CharacterAvatar {...members[1]} size={side} />
+ </div>
+ <div className="absolute bottom-0 left-0">
+ <CharacterAvatar {...members[0]} size={side} />
+ </div>
+ </div>
+ );
+}
+
+/** AvatarWithStatus: amber "!" when it needs you, an ink dot when unread. */
+export function AvatarWithStatus({ face, members, unread, size }: { face: Face; members?: Face[]; unread: number; size: number }) {
+ const ring = { boxShadow: `0 0 0 2px ${palette.background}` };
+ return (
+ <div className="relative shrink-0" style={{ width: size, height: size }}>
+ {members ? <GroupAvatar members={members} size={size} /> : <CharacterAvatar {...face} size={size} />}
+ {face.mood === "needs" ? (
+ <span
+ className="absolute right-0 bottom-0 flex items-center justify-center rounded-full font-black text-white"
+ style={{ width: size * 0.36, height: size * 0.36, fontSize: size * 0.26, background: palette.warning, ...ring }}
+ >
+ !
+ </span>
+ ) : unread > 0 ? (
+ <span className="absolute right-0 bottom-0 rounded-full" style={{ width: size * 0.28, height: size * 0.28, background: palette.accentFill, ...ring }} />
+ ) : null}
+ </div>
+ );
+}
diff --git a/web/app/components/live-phone/data.ts b/web/app/components/live-phone/data.ts
new file mode 100644
index 00000000..031f3b62
--- /dev/null
+++ b/web/app/components/live-phone/data.ts
@@ -0,0 +1,166 @@
+// Colors from CodyncKit/Design/Theme.swift (light appearance) and the demo story the
+// App Store screenshots tell: a `pace` running app, an ISO week bug in src/pace.js.
+
+export const palette = {
+ background: "#FFFFFF",
+ surface: "#F4F4F4",
+ bubbleAgent: "#F0F0F0",
+ bubbleUser: "#E2E2E2",
+ border: "#E6E6E6",
+ text: "#141414",
+ secondary: "#6B6B6B",
+ tertiary: "#9B9B9B",
+ accentFill: "#000000",
+ accentDim: "#D9D9D9",
+ danger: "#C23A2B",
+ warning: "#F0A030",
+ codeBackground: "#F4F4F4",
+ added: "#2E7D32",
+ removed: "#C62828",
+};
+
+const swatches: Record<string, string> = {
+ black: "#2B2B2B", brown: "#936439", red: "#FF263C", orange: "#FF6700", yellow: "#FF9800", green: "#00C972",
+ cyan: "#00BCA6", blue: "#1084FE", violet: "#9159FE", magenta: "#FF309B", gray: "#777777",
+};
+export const swatch = (id: string) => swatches[id] ?? swatches.blue;
+
+export type Permission = {
+ title: string;
+ /** null while it waits for an answer. */
+ outcome: string | null;
+ answering: string | null;
+};
+
+export type Entry = { id: string } & (
+ | { kind: "separator"; text: string }
+ | { kind: "user"; text: string; queued?: boolean }
+ | { kind: "agent"; text: string; author?: string }
+ | { kind: "permission"; permission: Permission }
+);
+
+export type Chat = {
+ id: string;
+ name: string;
+ shape: string;
+ color: string;
+ members?: string[];
+ unread: number;
+ /** Minutes after midnight of the last message. */
+ at: number;
+ entries: Entry[];
+ /** The live activity line (WorkingIndicator), null when idle. */
+ activity: { text: string; needs: boolean } | null;
+};
+
+export const clock = (m: number) => `${Math.floor(m / 60) % 12 || 12}:${String(m % 60).padStart(2, "0")} ${m < 720 ? "AM" : "PM"}`;
+
+const sep = (id: string, m: number): Entry => ({ id, kind: "separator", text: `Today ${clock(m)}` });
+
+export const initialChats: Chat[] = [
+ {
+ id: "pacer", name: "Pacer", shape: "hex", color: "orange", unread: 1, at: 78,
+ activity: { text: "Needs approval: Edit src/pace.js", needs: true },
+ entries: [
+ sep("p0", 78),
+ { id: "p1", kind: "user", text: "Reviewer says late-evening runs can land in the wrong week. Can you fix it?" },
+ { id: "p2", kind: "permission", permission: { title: "Edit src/pace.js", outcome: null, answering: null } },
+ ],
+ },
+ {
+ id: "ship", name: "Ship room", shape: "blob", color: "gray", members: ["reviewer", "scout"], unread: 2, at: 73, activity: null,
+ entries: [
+ sep("s0", 72),
+ { id: "s1", kind: "user", text: "Is weeklyTotals ready to ship? One short sentence each." },
+ {
+ id: "s2", kind: "agent", author: "reviewer",
+ text: 'Almost: the week math is right and all 4 tests pass, but a bad date gets bucketed as `"NaN-WNaN"` instead of raising an error, and a late-evening run with a timezone offset can count toward the next week because grouping is in UTC. @Scout, can you add an invalid-date guard and confirm whether weeks should be UTC or the runner\'s local time?',
+ },
+ {
+ id: "s3", kind: "agent", author: "scout",
+ text: "I added the guard: `weeklyTotals` now throws a `RangeError` on an invalid date, and all 5 tests pass (4 old plus a new one for bad dates). Weeks are still grouped in UTC, which I chose myself, so the user needs to say whether that's right or weeks should follow the runner's local time. Nothing is committed yet.",
+ },
+ ],
+ },
+ {
+ id: "relay", name: "Relay", shape: "squircle", color: "blue", unread: 1, at: 72, activity: null,
+ entries: [
+ sep("r0", 70),
+ { id: "r1", kind: "user", text: "Show each runner's weekly totals in the group run digest." },
+ {
+ id: "r2", kind: "agent",
+ text: "Added weeklyTotals to group run distances in the digest, so each runner sees their km for the current ISO week. The digest test passes and nothing is committed yet.",
+ },
+ ],
+ },
+ {
+ id: "reviewer", name: "Reviewer", shape: "tablet", color: "violet", unread: 1, at: 67, activity: null,
+ entries: [
+ sep("v0", 66),
+ { id: "v1", kind: "user", text: "Review weeklyTotals in src/pace.js before we ship." },
+ {
+ id: "v2", kind: "agent",
+ text: "I found no blockers. The ISO week math matches the spec and the year-boundary test covers `2026-W53`. Two notes for later: bad dates aren't rejected yet, and weeks are grouped in UTC.",
+ },
+ ],
+ },
+ {
+ id: "scout", name: "Scout", shape: "cloud", color: "green", unread: 1, at: 64, activity: null,
+ entries: [
+ sep("c0", 63),
+ { id: "c1", kind: "user", text: "Add a weeklyTotals(runs) helper that sums distance and time per ISO week, with a test. Reply in two short sentences." },
+ {
+ id: "c2", kind: "agent",
+ text: 'I added `weeklyTotals(runs)` to `src/pace.js`: it takes runs shaped like `{ date, distance, time }`, groups them by ISO week in UTC (keys like `"2026-W53"`), and I added a test that checks the week that crosses into 2027. All 4 tests pass and nothing is committed yet.',
+ },
+ ],
+ },
+];
+
+/** The diff behind Pacer's approval card ("Details"). */
+export const paceDiff = [
+ "@@ function isoWeek(run) @@",
+ "- const d = new Date(run.date)",
+ "- const day = d.getUTCDay() || 7",
+ "+ const d = localDate(run.date, run.offset)",
+ "+ const day = d.getDay() || 7",
+ " d.setDate(d.getDate() + 4 - day)",
+];
+
+export const approvalReply: Record<string, string> = {
+ "Allowed once": "Fixed: `isoWeek` now reads the runner's local date, so a Sunday 11 PM run stays in its own week. All 6 tests pass and nothing is committed yet.",
+ "Always allowed": "Fixed: `isoWeek` now reads the runner's local date, so a Sunday 11 PM run stays in its own week. All 6 tests pass and nothing is committed yet.",
+ Denied: "Okay, I left `src/pace.js` as it is. Tell me if you want the fix done another way.",
+};
+
+/** Short scripted answers to whatever the visitor types, taken in turn. */
+const scripts: Record<string, string[]> = {
+ pacer: [
+ "On it. I'll keep the change inside `src/pace.js` and run the tests before I reply.",
+ "Done. The tests still pass and nothing is committed yet.",
+ ],
+ relay: [
+ "The digest now shows this week's km per runner. Want last week next to it for comparison?",
+ "Done, and the digest test still passes.",
+ ],
+ reviewer: [
+ "Looks good to me. The one case I'd still test is a run logged exactly at midnight.",
+ "No blockers from my side.",
+ ],
+ scout: [
+ "Added it to `src/pace.js` with a test. All tests pass and nothing is committed yet.",
+ "Checked: `weeklyTotals` handles an empty list and returns `{}`.",
+ ],
+ reviewer_group: ["From my side it ships once weeks follow the runner's local time."],
+ scout_group: ["Will do: I'll group weeks in the runner's local time and add a test for a Sunday 11 PM run."],
+};
+
+export function scriptedReply(chat: Chat, text: string, turn: number): { text: string; author?: string } {
+ if (chat.members) {
+ const author = /@scout/i.test(text) ? "scout" : "reviewer";
+ const lines = scripts[`${author}_group`];
+ return { text: lines[turn % lines.length], author };
+ }
+ const lines = scripts[chat.id] ?? scripts.scout;
+ return { text: lines[turn % lines.length] };
+}
diff --git a/web/app/components/live-phone/live-phones.tsx b/web/app/components/live-phone/live-phones.tsx
new file mode 100644
index 00000000..6f0c24ce
--- /dev/null
+++ b/web/app/components/live-phone/live-phones.tsx
@@ -0,0 +1,188 @@
+"use client";
+
+import { useEffect, useLayoutEffect, useRef, useState } from "react";
+import { AnimatePresence, motion, MotionConfig } from "framer-motion";
+import Phone from "../phone";
+import { approvalReply, initialChats, scriptedReply, type Chat, type Entry } from "./data";
+import { Roster, SCREEN, StatusBar, Thread } from "./screens";
+
+const ease = [0.16, 1, 0.3, 1] as const;
+/** iOS push/pop: the new screen slides in over the old one, which drifts left. */
+const push = { type: "spring", duration: 0.5, bounce: 0 } as const;
+
+/** Lays out the 402 x 874 pt screen and scales it to the frame's width. */
+function Screen({ children, label }: { children: React.ReactNode; label: string }) {
+ const box = useRef<HTMLDivElement>(null);
+ const [scale, setScale] = useState(0);
+ useLayoutEffect(() => {
+ const el = box.current;
+ if (!el) return;
+ const ro = new ResizeObserver(() => setScale(el.clientWidth / SCREEN.w));
+ ro.observe(el);
+ return () => ro.disconnect();
+ }, []);
+ return (
+ <section ref={box} aria-label={label} className="absolute inset-0" style={{ fontFamily: '-apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, sans-serif' }}>
+ <div
+ className="absolute top-0 left-0 overflow-hidden antialiased"
+ style={{ width: SCREEN.w, height: SCREEN.h, transform: `scale(${scale})`, transformOrigin: "0 0", visibility: scale ? "visible" : "hidden" }}
+ >
+ {children}
+ </div>
+ </section>
+ );
+}
+
+type Nav = { chat: string | null; dir: 1 | -1 };
+
+export default function LivePhones() {
+ const [chats, setChats] = useState<Chat[]>(initialChats);
+ const [front, setFront] = useState<Nav>({ chat: "pacer", dir: 1 });
+ const latest = useRef(chats);
+ const shown = useRef<string | null>("pacer");
+ useEffect(() => {
+ latest.current = chats;
+ shown.current = front.chat;
+ });
+ const timers = useRef<number[]>([]);
+ const turns = useRef<Record<string, number>>({});
+ const ids = useRef(0);
+ useEffect(() => () => timers.current.forEach(clearTimeout), []);
+
+ const later = (ms: number, fn: () => void) => timers.current.push(window.setTimeout(fn, ms));
+ const update = (id: string, fn: (c: Chat) => Chat) => setChats((all) => all.map((c) => (c.id === id ? fn(c) : c)));
+ const nextAt = (all: Chat[]) => Math.max(...all.map((c) => c.at)) + 1;
+ const newId = () => `live-${ids.current++}`;
+ const nextTurn = (id: string) => (turns.current[id] = (turns.current[id] ?? -1) + 1);
+
+ /** The bot shows "Typing…", then its reply pops in; queued messages get a turn after. */
+ const reply = (id: string, answer: (c: Chat) => { text: string; author?: string }) => {
+ update(id, (c) => ({ ...c, activity: { text: "Typing…", needs: false } }));
+ later(1600, () => {
+ const chat = latest.current.find((c) => c.id === id);
+ if (!chat) return;
+ const r = answer(chat);
+ const queued = chat.entries.filter((e) => e.kind === "user" && e.queued);
+ setChats((all) =>
+ all.map((c) =>
+ c.id !== id
+ ? c
+ : {
+ ...c,
+ at: nextAt(all),
+ unread: shown.current === id ? 0 : c.unread + 1,
+ activity: null,
+ entries: [
+ ...c.entries.map((e) => (e.kind === "user" && e.queued ? { ...e, queued: false } : e)),
+ { id: newId(), kind: "agent", text: r.text, author: r.author },
+ ],
+ },
+ ),
+ );
+ const last = queued.at(-1);
+ if (last && last.kind === "user") {
+ const turn = nextTurn(id);
+ later(500, () => reply(id, (c) => scriptedReply(c, last.text, turn)));
+ }
+ });
+ };
+
+ const send = (id: string, text: string) => {
+ const busy = latest.current.find((c) => c.id === id)?.activity != null;
+ setChats((all) =>
+ all.map((c) => (c.id === id ? { ...c, at: nextAt(all), entries: [...c.entries, { id: newId(), kind: "user", text, queued: busy || undefined }] } : c)),
+ );
+ if (!busy) {
+ const turn = nextTurn(id);
+ later(500, () => reply(id, (c) => scriptedReply(c, text, turn)));
+ }
+ };
+
+ const setPermission = (id: string, entryId: string, patch: Partial<Extract<Entry, { kind: "permission" }>["permission"]>) =>
+ update(id, (c) => ({
+ ...c,
+ entries: c.entries.map((e) => (e.id === entryId && e.kind === "permission" ? { ...e, permission: { ...e.permission, ...patch } } : e)),
+ }));
+
+ const respond = (id: string, entryId: string, outcome: string) => {
+ setPermission(id, entryId, { answering: outcome });
+ later(450, () => {
+ setPermission(id, entryId, { answering: null, outcome });
+ reply(id, () => ({ text: approvalReply[outcome] }));
+ });
+ };
+
+ const stop = (id: string) =>
+ update(id, (c) => ({
+ ...c,
+ activity: null,
+ entries: c.entries.map((e) =>
+ e.kind === "permission" && e.permission.outcome === null ? { ...e, permission: { ...e.permission, outcome: "Cancelled" } } : e,
+ ),
+ }));
+
+ const open = (setNav: (n: Nav) => void) => (id: string) => {
+ update(id, (c) => ({ ...c, unread: 0 }));
+ setNav({ chat: id, dir: 1 });
+ };
+
+ const screen = (nav: Nav, setNav: (n: Nav) => void) => {
+ const chat = chats.find((c) => c.id === nav.chat);
+ return (
+ <AnimatePresence initial={false} custom={nav.dir}>
+ <motion.div
+ key={nav.chat ?? "roster"}
+ custom={nav.dir}
+ className="absolute inset-0 shadow-[-8px_0_24px_rgba(0,0,0,0.06)]"
+ variants={{
+ enter: (d: number) => ({ x: d > 0 ? "100%" : "-30%", zIndex: d > 0 ? 2 : 0 }),
+ center: { x: 0, zIndex: 1 },
+ exit: (d: number) => ({ x: d > 0 ? "-30%" : "100%", zIndex: d > 0 ? 0 : 2 }),
+ }}
+ initial="enter"
+ animate="center"
+ exit="exit"
+ transition={push}
+ >
+ {chat ? (
+ <Thread
+ chat={chat}
+ chats={chats}
+ back={() => setNav({ chat: null, dir: -1 })}
+ send={(t) => send(chat.id, t)}
+ respond={(e, o) => respond(chat.id, e, o)}
+ stop={() => stop(chat.id)}
+ />
+ ) : (
+ <Roster chats={chats} open={open(setNav)} />
+ )}
+ </motion.div>
+ </AnimatePresence>
+ );
+ };
+
+ // Same markup on server and client; MotionConfig drops the movement under reduced motion.
+ const enter = (delay: number, y: number) => ({ initial: { opacity: 0, y }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.9, delay, ease } });
+
+ return (
+ <MotionConfig reducedMotion="user">
+ <motion.div {...enter(0.1, 40)} className="relative w-[58%]">
+ <Phone>
+ <Screen label="Codync iPhone app demo: bot list">
+ {/* Rows tapped here open their chat in the front phone. */}
+ <Roster chats={chats} open={open(setFront)} />
+ <StatusBar />
+ </Screen>
+ </Phone>
+ </motion.div>
+ <motion.div {...enter(0.25, 60)} className="absolute top-[10%] right-0 z-10 w-[58%]">
+ <Phone>
+ <Screen label="Codync iPhone app demo: chat">
+ {screen(front, setFront)}
+ <StatusBar />
+ </Screen>
+ </Phone>
+ </motion.div>
+ </MotionConfig>
+ );
+}
diff --git a/web/app/components/live-phone/screens.tsx b/web/app/components/live-phone/screens.tsx
new file mode 100644
index 00000000..b07cad13
--- /dev/null
+++ b/web/app/components/live-phone/screens.tsx
@@ -0,0 +1,495 @@
+"use client";
+
+import { useEffect, useRef, useState } from "react";
+import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
+import {
+ ArrowUp,
+ CaretDown,
+ CaretLeft,
+ CaretRight,
+ Chats,
+ CardsThree,
+ Desktop,
+ Plus,
+ Stop,
+ User,
+ Waveform,
+ WifiHigh,
+} from "@phosphor-icons/react";
+import { AvatarWithStatus, CharacterAvatar, GroupAvatar, type Face, type Mood } from "./avatar";
+import { clock, palette, paceDiff, swatch, type Chat, type Entry, type Permission } from "./data";
+
+// The iPhone app's two screens at their real size in points (402 x 874), from
+// CodyncUI/Bots/BotRow.swift, Thread/{ChatRows,PermissionCard,Composer}.swift and Chrome.swift.
+
+export const SCREEN = { w: 402, h: 874 };
+const mono = 'ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace';
+const glass = "bg-white shadow-[0_0_0_0.5px_rgba(0,0,0,0.1),0_6px_18px_rgba(0,0,0,0.07)]";
+const focus = "outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#1084FE]";
+const press = "transition-transform duration-[50ms] active:scale-[0.98]";
+/** Motion.conversation: a critically damped .42 s spring. */
+const conversation = { type: "spring", duration: 0.42, bounce: 0 } as const;
+
+export const moodOf = (c: Chat): Mood => (c.activity?.needs ? "needs" : c.activity ? "working" : "idle");
+export const faceOf = (c: Chat): Face => ({ shape: c.shape, color: c.color, mood: moodOf(c) });
+
+/** Inline Markdown the demo needs: `code` spans. */
+function Inline({ text }: { text: string }) {
+ return (
+ <>
+ {text.split("`").map((part, i) =>
+ i % 2 ? (
+ <code key={i} style={{ fontFamily: mono, fontSize: "0.94em" }}>
+ {part}
+ </code>
+ ) : (
+ part
+ ),
+ )}
+ </>
+ );
+}
+
+/** Stand-in for ThinkingOrb: a small turning ring of dots in the given ink. */
+function Orb({ color, size = 16 }: { color: string; size?: number }) {
+ const dots = Array.from({ length: 10 }, (_, i) => {
+ const a = (i / 10) * 2 * Math.PI;
+ return { x: (8 + Math.cos(a) * 6).toFixed(3), y: (8 + Math.sin(a) * 6).toFixed(3), o: (0.25 + 0.75 * (i / 9)).toFixed(3) };
+ });
+ return (
+ <svg width={size} height={size} viewBox="0 0 16 16" aria-hidden className="shrink-0 animate-[spin_1.4s_linear_infinite] motion-reduce:animate-none">
+ <circle cx={8} cy={8} r={1.6} fill={color} fillOpacity={0.6} />
+ {dots.map((d, i) => (
+ <circle key={i} cx={d.x} cy={d.y} r={1.15} fill={color} fillOpacity={d.o} />
+ ))}
+ </svg>
+ );
+}
+
+export function StatusBar() {
+ return (
+ <div aria-hidden className="absolute inset-x-0 top-0 z-30 flex h-[54px] items-center justify-between pr-[38px] pl-[62px] pt-[10px]">
+ <span className="text-[17px] font-semibold tracking-[-0.02em]" style={{ color: palette.text }}>
+ 9:41
+ </span>
+ <span className="flex items-center gap-[7px]">
+ <svg width="19" height="12" viewBox="0 0 19 12">
+ {[0, 1, 2, 3].map((i) => (
+ <rect key={i} x={i * 5} y={9 - i * 3} width="3.2" height={3 + i * 3} rx="1" fill={palette.text} />
+ ))}
+ </svg>
+ <WifiHigh size={18} weight="bold" color={palette.text} />
+ <svg width="27" height="13" viewBox="0 0 27 13">
+ <rect x="0.5" y="0.5" width="23" height="12" rx="3.8" fill="#34C759" />
+ <rect x="24.5" y="4" width="1.8" height="5" rx="0.9" fill="#34C759" fillOpacity="0.5" />
+ <path d="M13 2.2 8.6 7h3.2l-1 3.8L15.2 6H12z" fill="#fff" />
+ </svg>
+ </span>
+ </div>
+ );
+}
+
+function HomeIndicator() {
+ return <div aria-hidden className="absolute bottom-[8px] left-1/2 z-30 h-[5px] w-[139px] -translate-x-1/2 rounded-full bg-black" />;
+}
+
+/* ----------------------------------------------------------------- Roster */
+
+function preview(chat: Chat, chats: Chat[]) {
+ if (chat.activity?.needs)
+ return (
+ <span className="flex min-w-0 items-center gap-[6px]" style={{ color: palette.warning }}>
+ <Orb color={palette.warning} />
+ <span className="truncate">{chat.activity.text}</span>
+ </span>
+ );
+ if (chat.activity)
+ return (
+ <span className="flex min-w-0 items-center gap-[6px]" style={{ color: palette.secondary }}>
+ <Orb color={palette.secondary} size={13} />
+ <span className="truncate">{chat.activity.text}</span>
+ </span>
+ );
+ const last = [...chat.entries].reverse().find((e) => e.kind === "agent" || e.kind === "user");
+ const text = last && "text" in last ? last.text : "";
+ const author = last?.kind === "agent" && last.author ? chats.find((c) => c.id === last.author)?.name : undefined;
+ return (
+ <span className="truncate" style={{ color: palette.secondary }}>
+ {author ? `${author}: ${text}` : text}
+ </span>
+ );
+}
+
+export function Roster({ chats, open }: { chats: Chat[]; open: (id: string) => void }) {
+ const sorted = [...chats].sort((a, b) => b.at - a.at);
+ const members = (c: Chat) => c.members?.map((id) => faceOf(chats.find((m) => m.id === id)!));
+ return (
+ <div className="absolute inset-0 bg-white">
+ <div aria-hidden className="absolute inset-x-[16px] top-[62px] flex items-center justify-between">
+ <div className={`flex h-[44px] w-[70px] items-center justify-center gap-[8px] rounded-full ${glass}`}>
+ <span className="flex size-[26px] items-center justify-center rounded-full" style={{ background: palette.surface }}>
+ <User size={15} weight="fill" color={palette.secondary} />
+ </span>
+ <CaretDown size={14} weight="bold" color={palette.text} />
+ </div>
+ <span className="flex items-center gap-[5px] text-[15px] font-medium" style={{ color: palette.secondary }}>
+ 1 connected <CaretDown size={12} weight="bold" />
+ </span>
+ <div className={`flex size-[44px] items-center justify-center rounded-full ${glass}`}>
+ <Plus size={22} weight="bold" color={palette.text} />
+ </div>
+ </div>
+ <ul className="absolute inset-x-0 top-[116px]">
+ {sorted.map((c) => (
+ <motion.li key={c.id} layout transition={conversation}>
+ <button
+ type="button"
+ onClick={() => open(c.id)}
+ className={`flex w-full items-center gap-[12px] px-[16px] py-[10px] text-left ${focus} active:bg-black/[0.04]`}
+ >
+ <AvatarWithStatus face={faceOf(c)} members={members(c)} unread={c.unread} size={46} />
+ <span className="flex min-w-0 flex-1 flex-col gap-[4px]">
+ <span className="flex items-baseline gap-[8px]">
+ <span className="flex-1 truncate text-[17px] font-semibold" style={{ color: palette.text }}>
+ {c.name}
+ </span>
+ <span className="text-[15px]" style={{ color: c.unread > 0 ? palette.text : palette.tertiary }}>
+ {clock(c.at)}
+ </span>
+ </span>
+ <span className="flex items-center gap-[6px] text-[15px]">
+ <span className="flex min-w-0 flex-1">{preview(c, chats)}</span>
+ {c.unread > 0 && (
+ <span
+ className="flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-[6px] text-[11px] font-bold text-white"
+ style={{ background: palette.accentFill }}
+ aria-label={`${c.unread} unread`}
+ >
+ {c.unread}
+ </span>
+ )}
+ </span>
+ </span>
+ </button>
+ </motion.li>
+ ))}
+ </ul>
+ <div aria-hidden className={`absolute bottom-[39px] left-1/2 flex -translate-x-1/2 gap-[4px] rounded-full p-[5px] ${glass}`}>
+ {[
+ { t: "Bots", I: Chats, on: true },
+ { t: "State", I: CardsThree, on: false },
+ ].map(({ t, I, on }) => (
+ <span
+ key={t}
+ className="flex h-[50px] w-[76px] flex-col items-center justify-center gap-[3px] rounded-full text-[11px] font-medium"
+ style={{ color: on ? palette.text : palette.secondary, background: on ? "rgba(20,20,20,0.08)" : undefined }}
+ >
+ <I size={22} weight="fill" />
+ {t}
+ </span>
+ ))}
+ </div>
+ <HomeIndicator />
+ </div>
+ );
+}
+
+/* ----------------------------------------------------------------- Thread */
+
+function PermissionCard({ p, respond }: { p: Permission; respond: (outcome: string) => void }) {
+ const [expanded, setExpanded] = useState(false);
+ const pending = p.outcome === null;
+ const options = [
+ { label: "Allow once", outcome: "Allowed once", strong: true, color: palette.text },
+ { label: "Always allow", outcome: "Always allowed", strong: false, color: palette.text },
+ { label: "Deny", outcome: "Denied", strong: false, color: palette.danger },
+ ];
+ return (
+ <div className="mr-[40px] flex flex-col gap-[10px] rounded-[22px] p-[16px]" style={{ background: palette.bubbleAgent }}>
+ <div className="flex items-center gap-[8px]">
+ <span className="text-[17px] font-semibold" style={{ color: palette.text }}>
+ Wants to change files
+ </span>
+ {pending && <span className="size-[7px] rounded-full" style={{ background: palette.warning }} />}
+ </div>
+ <span className="text-[15px]" style={{ fontFamily: mono, color: palette.secondary }}>
+ {p.title}
+ </span>
+ <span className="flex items-center gap-[6px] text-[12px]" style={{ color: palette.tertiary }}>
+ <Desktop size={14} weight="fill" /> Runs on MacBook-Pro-3 · trailmix
+ </span>
+ <button
+ type="button"
+ aria-expanded={expanded}
+ onClick={() => setExpanded(!expanded)}
+ className={`flex items-center justify-between rounded-[6px] text-[12px] font-medium ${focus}`}
+ style={{ color: palette.secondary }}
+ >
+ Details
+ <CaretRight size={13} weight="bold" className={`transition-transform duration-200 ${expanded ? "rotate-90" : ""}`} />
+ </button>
+ <AnimatePresence initial={false}>
+ {expanded && (
+ <motion.div
+ initial={{ height: 0, opacity: 0 }}
+ animate={{ height: "auto", opacity: 1 }}
+ exit={{ height: 0, opacity: 0 }}
+ transition={{ type: "spring", duration: 0.3, bounce: 0 }}
+ className="overflow-hidden"
+ >
+ <div className="flex items-center gap-[6px] pb-[4px] text-[12px]" style={{ fontFamily: mono, color: palette.secondary }}>
+ <span className="flex-1">pace.js</span>
+ <span style={{ color: palette.added }}>+2</span>
+ <span style={{ color: palette.removed }}>−2</span>
+ </div>
+ <pre className="overflow-x-auto rounded-[8px] p-[8px] text-[11px] leading-[1.45]" style={{ fontFamily: mono, background: palette.background }}>
+ {paceDiff.map((l) => (
+ <div key={l} style={{ color: l[0] === "+" ? palette.added : l[0] === "-" ? palette.removed : palette.secondary }}>
+ {l}
+ </div>
+ ))}
+ </pre>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ {pending ? (
+ <div className="mt-[4px] overflow-hidden rounded-[14px]" style={{ background: palette.background }}>
+ {options.map((o, i) => (
+ <button
+ key={o.label}
+ type="button"
+ disabled={p.answering !== null}
+ onClick={() => respond(o.outcome)}
+ className={`flex min-h-[46px] w-full items-center px-[14px] text-left text-[17px] ${focus} -outline-offset-2 active:bg-black/[0.04]`}
+ style={{
+ color: o.color,
+ fontWeight: o.strong ? 600 : 400,
+ borderTop: i ? `0.5px solid ${palette.border}` : undefined,
+ opacity: p.answering === null || p.answering === o.outcome ? 1 : 0.4,
+ }}
+ >
+ <span className="flex-1">{o.label}</span>
+ {p.answering === o.outcome && (
+ <span className="size-[14px] animate-spin rounded-full border-2 border-black/15 border-t-black/60 motion-reduce:animate-none" />
+ )}
+ </button>
+ ))}
+ </div>
+ ) : (
+ <span className="text-[12px] font-medium" style={{ color: palette.secondary }}>
+ {p.outcome}
+ </span>
+ )}
+ </div>
+ );
+}
+
+/** WorkingIndicator: the live activity line with its timer. */
+function Working({ activity, since }: { activity: NonNullable<Chat["activity"]>; since: number }) {
+ const [s, setS] = useState(since);
+ useEffect(() => {
+ const id = setInterval(() => setS((v) => v + 1), 1000);
+ return () => clearInterval(id);
+ }, []);
+ const ink = activity.needs ? palette.warning : palette.secondary;
+ return (
+ <div className="mr-[40px] flex w-fit items-center gap-[8px] rounded-[22px] px-[16px] py-[12px]" style={{ background: palette.bubbleAgent }} role="status">
+ <Orb color={ink} />
+ <span className="truncate text-[15px]" style={{ color: ink }}>
+ {activity.text}
+ </span>
+ <span className="text-[13px] tabular-nums" style={{ color: palette.tertiary }}>
+ {Math.floor(s / 60)}:{String(s % 60).padStart(2, "0")}
+ </span>
+ </div>
+ );
+}
+
+function Row({ entry, prev, chats, respond }: { entry: Entry; prev?: Entry; chats: Chat[]; respond: (id: string, outcome: string) => void }) {
+ const start = !prev || prev.kind !== entry.kind || (prev.kind === "agent" && entry.kind === "agent" && prev.author !== entry.author);
+ switch (entry.kind) {
+ case "separator":
+ return (
+ <p className="pt-[10px] text-center text-[13px]" style={{ color: palette.tertiary }}>
+ {entry.text}
+ </p>
+ );
+ case "user":
+ return (
+ <div className={`flex flex-col items-end gap-[4px] pl-[56px] ${start ? "pt-[12px]" : "pt-[4px]"}`}>
+ <p className="rounded-[22px] px-[16px] py-[10px] text-[17px] leading-[22px] whitespace-pre-wrap" style={{ background: palette.bubbleUser, color: palette.text }}>
+ {entry.text}
+ </p>
+ {entry.queued && (
+ <span className="text-[11px]" style={{ color: palette.tertiary }}>
+ Queued until this response finishes
+ </span>
+ )}
+ </div>
+ );
+ case "agent": {
+ const author = entry.author ? chats.find((c) => c.id === entry.author) : undefined;
+ return (
+ <div className={`flex flex-col items-start gap-[4px] pr-[40px] ${start ? "pt-[12px]" : "pt-[4px]"}`}>
+ {author && start && (
+ <span className="flex items-center gap-[8px] text-[15px] font-medium" style={{ color: swatch(author.color) }}>
+ <CharacterAvatar shape={author.shape} color={author.color} size={26} />
+ {author.name}
+ </span>
+ )}
+ <p className="rounded-[22px] px-[16px] py-[10px] text-[17px] leading-[22px]" style={{ background: palette.bubbleAgent, color: palette.text }}>
+ <Inline text={entry.text} />
+ </p>
+ </div>
+ );
+ }
+ case "permission":
+ return (
+ <div className="pt-[12px]">
+ <PermissionCard p={entry.permission} respond={(o) => respond(entry.id, o)} />
+ </div>
+ );
+ }
+}
+
+function Composer({ chat, send, stop }: { chat: Chat; send: (text: string) => void; stop: () => void }) {
+ const [draft, setDraft] = useState("");
+ const busy = chat.activity !== null;
+ const group = !!chat.members;
+ const placeholder = group ? `Message ${chat.name} · @ to ask one bot` : busy ? `Queue a message for ${chat.name}` : `Ask ${chat.name}`;
+ const state = draft.trim() ? "send" : busy && !group ? "stop" : group ? "send" : "call";
+ const enabled = state !== "send" || !!draft.trim();
+ const submit = (e: React.FormEvent) => {
+ e.preventDefault();
+ if (state === "stop") return stop();
+ if (!draft.trim()) return;
+ send(draft.trim());
+ setDraft("");
+ };
+ const inputRef = useRef<HTMLInputElement>(null);
+ return (
+ <form onSubmit={submit} className="absolute inset-x-[16px] bottom-[49px] z-20 flex items-end gap-[8px]">
+ {!group && (
+ <button
+ type="button"
+ aria-label="Add files"
+ onClick={() => inputRef.current?.focus()}
+ className={`flex size-[47px] shrink-0 items-center justify-center rounded-full ${glass} ${focus} ${press}`}
+ >
+ <Plus size={20} color={palette.text} />
+ </button>
+ )}
+ <div className={`flex h-[54px] min-w-0 flex-1 items-center gap-[8px] rounded-[27px] pr-[6px] pl-[18px] ${glass} focus-within:shadow-[0_0_0_1px_rgba(0,0,0,0.25),0_6px_18px_rgba(0,0,0,0.07)]`}>
+ <input
+ ref={inputRef}
+ value={draft}
+ onChange={(e) => setDraft(e.target.value)}
+ placeholder={placeholder}
+ aria-label={placeholder}
+ className="min-w-0 flex-1 bg-transparent text-[17px] outline-none placeholder:text-[#B4B4B4]"
+ style={{ color: palette.text }}
+ />
+ <motion.button
+ type="submit"
+ layout
+ transition={{ duration: 0.2, ease: [0.22, 1, 0.36, 1] }}
+ disabled={!enabled}
+ aria-label={state === "stop" ? "Stop" : state === "call" ? "Call" : "Send"}
+ title={state === "call" ? "Voice call is in the app" : undefined}
+ onClick={state === "call" ? (e) => { e.preventDefault(); inputRef.current?.focus(); } : undefined}
+ className={`flex h-[34px] shrink-0 items-center justify-center rounded-full ${focus} ${press}`}
+ style={{
+ width: state === "call" ? 46 : 34,
+ background: state === "send" && !enabled ? palette.accentDim : palette.accentFill,
+ color: state === "send" && !enabled ? palette.tertiary : "#fff",
+ }}
+ >
+ {state === "stop" ? <Stop size={14} weight="fill" /> : state === "call" ? <Waveform size={17} weight="bold" /> : <ArrowUp size={16} weight="bold" />}
+ </motion.button>
+ </div>
+ </form>
+ );
+}
+
+export function Thread({
+ chat,
+ chats,
+ back,
+ send,
+ respond,
+ stop,
+}: {
+ chat: Chat;
+ chats: Chat[];
+ back: () => void;
+ send: (text: string) => void;
+ respond: (entryId: string, outcome: string) => void;
+ stop: () => void;
+}) {
+ const reduce = useReducedMotion();
+ const scroller = useRef<HTMLDivElement>(null);
+ const members = chat.members?.map((id) => faceOf(chats.find((m) => m.id === id)!));
+ const count = chat.entries.length;
+ useEffect(() => {
+ const el = scroller.current;
+ el?.scrollTo({ top: el.scrollHeight, behavior: reduce ? "auto" : "smooth" });
+ }, [count, chat.activity, reduce]);
+ // The approval was waiting 1:36 when the demo opens, like the screenshot.
+ const since = chat.activity?.needs ? 96 : 0;
+ return (
+ <div className="absolute inset-0 bg-white">
+ <div className="absolute inset-x-[16px] top-[62px] z-20 flex items-center justify-between">
+ <button type="button" onClick={back} aria-label="Back" className={`flex size-[44px] items-center justify-center rounded-full ${glass} ${focus} ${press}`}>
+ <CaretLeft size={22} weight="bold" color={palette.text} />
+ </button>
+ <div className="flex flex-col items-center">
+ <span className="flex items-center gap-[7px]">
+ {members ? <GroupAvatar members={members} size={22} /> : <CharacterAvatar {...faceOf(chat)} size={22} />}
+ <span className="text-[16px] font-semibold" style={{ color: palette.text }}>
+ {chat.name}
+ </span>
+ </span>
+ <span className="flex items-center gap-[5px] text-[12px] font-medium" style={{ color: palette.secondary }}>
+ <WifiHigh size={12} weight="bold" /> Connected
+ </span>
+ </div>
+ <div aria-hidden className={`flex size-[44px] items-center justify-center rounded-full ${glass}`}>
+ <Desktop size={24} weight="fill" color={palette.text} />
+ </div>
+ </div>
+ <div aria-hidden className="pointer-events-none absolute inset-x-0 top-0 z-10 h-[132px] bg-[linear-gradient(#fff_78%,rgba(255,255,255,0))]" />
+ <div
+ ref={scroller}
+ className="absolute inset-0 overflow-y-auto px-[16px] pt-[132px] pb-[112px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
+ aria-label={`Conversation with ${chat.name}`}
+ role="log"
+ >
+ <div className="flex min-h-full flex-col justify-end">
+ <AnimatePresence initial={false}>
+ {chat.entries.map((e, i) => (
+ <motion.div key={e.id} layout="position" initial={{ opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }} transition={conversation}>
+ <Row entry={e} prev={chat.entries[i - 1]} chats={chats} respond={respond} />
+ </motion.div>
+ ))}
+ {chat.activity && (
+ <motion.div
+ key={`activity-${chat.activity.text}`}
+ layout="position"
+ initial={{ opacity: 0, y: 12 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0 }}
+ transition={conversation}
+ className="pt-[12px]"
+ >
+ <Working activity={chat.activity} since={since} />
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </div>
+ </div>
+ <div aria-hidden className="pointer-events-none absolute inset-x-0 bottom-0 z-10 h-[96px] bg-[linear-gradient(rgba(255,255,255,0),#fff_45%)]" />
+ <Composer key={chat.id} chat={chat} send={send} stop={stop} />
+ <HomeIndicator />
+ </div>
+ );
+}
diff --git a/web/app/components/phone.tsx b/web/app/components/phone.tsx
index a0b50473..5eb13dea 100644
--- a/web/app/components/phone.tsx
+++ b/web/app/components/phone.tsx
@@ -1,30 +1,37 @@
import Image from "next/image";
-// Real iPhone screenshots (1206x2622, scaled to 780 wide) in a plain device frame.
+// Real iPhone screenshots (1206x2622, scaled to 780 wide) in a plain device frame,
+// or live content (`children`) in the same frame.
export default function Phone({
src,
- alt,
+ alt = "",
eager = false,
className = "",
+ children,
}: {
- src: string;
- alt: string;
+ src?: string;
+ alt?: string;
eager?: boolean;
className?: string;
+ children?: React.ReactNode;
}) {
return (
<div
className={`rounded-[2.75rem] bg-neutral-800 p-[7px] shadow-[0_40px_80px_-20px_rgba(0,0,0,0.8)] ${className}`}
>
- <Image
- src={src}
- alt={alt}
- width={780}
- height={1696}
- loading={eager ? "eager" : "lazy"}
- fetchPriority={eager ? "high" : "auto"}
- className="block h-auto w-full rounded-[2.35rem]"
- />
+ {src ? (
+ <Image
+ src={src}
+ alt={alt}
+ width={780}
+ height={1696}
+ loading={eager ? "eager" : "lazy"}
+ fetchPriority={eager ? "high" : "auto"}
+ className="block h-auto w-full rounded-[2.35rem]"
+ />
+ ) : (
+ <div className="relative aspect-[780/1696] w-full overflow-hidden rounded-[2.35rem] bg-white">{children}</div>
+ )}
</div>
);
}
diff --git a/web/app/components/reveal.tsx b/web/app/components/reveal.tsx
index 129c2673..8751660e 100644
--- a/web/app/components/reveal.tsx
+++ b/web/app/components/reveal.tsx
@@ -1,8 +1,10 @@
"use client";
-import { motion, useReducedMotion } from "framer-motion";
+import { motion, MotionConfig } from "framer-motion";
-// Fades a section in once as it scrolls into view; static under reduced motion.
+// Fades a section in once as it scrolls into view. The markup is the same on server and client
+// (branching on reduced motion left the server's opacity: 0 in place after hydration);
+// MotionConfig drops the movement for reduced motion.
export default function Reveal({
children,
delay = 0,
@@ -12,16 +14,17 @@ export default function Reveal({
delay?: number;
className?: string;
}) {
- const reduce = useReducedMotion();
return (
- <motion.div
- className={className}
- initial={reduce ? false : { opacity: 0, y: 24 }}
- whileInView={{ opacity: 1, y: 0 }}
- viewport={{ once: true, amount: 0.25 }}
- transition={{ duration: 0.6, delay, ease: [0.16, 1, 0.3, 1] }}
- >
- {children}
- </motion.div>
+ <MotionConfig reducedMotion="user">
+ <motion.div
+ className={className}
+ initial={{ opacity: 0, y: 24 }}
+ whileInView={{ opacity: 1, y: 0 }}
+ viewport={{ once: true, amount: 0.25 }}
+ transition={{ duration: 0.6, delay, ease: [0.16, 1, 0.3, 1] }}
+ >
+ {children}
+ </motion.div>
+ </MotionConfig>
);
}