diff --git a/README.md b/README.md index db2322fb0..e3adf3fa4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- Simlock by Callstack. Your own simulator cloud. One device per agent. + Simlock by Callstack. Turn your Mac into a simulator cloud that manages itself.

### A control plane so parallel coding agents stop fighting over the same simulator diff --git a/docs/internal/BRAND.md b/docs/internal/BRAND.md index 8f8921d49..b8984be62 100644 --- a/docs/internal/BRAND.md +++ b/docs/internal/BRAND.md @@ -53,7 +53,7 @@ orange and nothing else. - Switzer (ITF Free Font License) and Geist Mono (OFL) are self-hosted from `website/src/fonts/`. - Headlines have two beats, the second in the accent, with no italics. The - motto: "Your own simulator cloud. *One device per agent.*" + motto: "Turn your Mac into a simulator cloud *that manages itself.*" - Mono is for labels, commands, ids and metadata, never for sentences. - Platforms always run iOS, then Android. Hosts run macOS, then Linux. @@ -108,10 +108,11 @@ on top of it have solid `bg` fills. Never use photos, gradients, landscapes or A leased phone's screen shows app-like rows at full accent. A free phone's screen is dark. Slow waves move in toward the focus, leasing and releasing phones, and a phone flashes full accent for a moment as it boots. Phone size - follows the scene's shorter side. It sits behind the hero, the social card - and the banner. + follows the scene's shorter side. It sits behind the social card and the + banner. - **Flow.** Soft diagonal bands, capped near the midtone. The quiet backdrop - behind code, tabs and the drawn console. + behind code, tabs, the hero's stage (at half strength, so its wires read) + and the drawn console. - **Hollow.** The fleet with the phone at the focus missing: a dark socket with a dashed stepped outline that pulses. Only on the 404 page. @@ -130,12 +131,14 @@ The scenes are generated in `website/src/components/site/dither.ts`. - Short and plain, one colleague to another. Name the reader: "your agents", "you". No marketing adjectives, and no "just", "simply" or "easy". -- Lead with the self-hosted simulator cloud. One machine is where it starts. +- Lead with one Mac, then the cloud it grows into: Simlock on one machine + first, more machines behind a gateway second. - Page titles: `Simlock: Self-hosted simulator cloud for coding agents` on the home page, `Page title | Simlock` everywhere else, 60 characters at most. Built only by `website/src/site/meta.ts`. - Every command, field and number comes from the user docs. Agents on other - machines lease over the HTTP API; only the local daemon speaks to the CLI. + machines lease over the HTTP API or agent-device; the CLI speaks only to + daemons on its own machine (`--gateway` reaches a gateway running there). ## Social card and banner @@ -157,10 +160,19 @@ The scenes are generated in `website/src/components/site/dither.ts`. - **Home** (`src/pages/index.astro`): nav, hero, marquee, then [01] How it works, [02] Fleet, [03] Console, [04] What you get, [05] Safe by default, [06] FAQ, closing. The hero (`src/components/home/Hero.astro`, `hero.ts`, - `story.ts`) shows three agents sending one lease request to one gateway URL, - the gateway's table of where each went and why, and the three workers' - phones lighting up. The console section draws the console's Overview - (`ConsoleView.astro`). + `story.ts`) is the centred headline, the lede and one button, then a stage + that plays two steps in a loop, read left to right: agents, then the + gateway, then machines. Two buttons above it name the steps and jump to + either; the playing one fills with the accent as it runs, and a two-line + caption under them says what is happening. [01] One machine: three agents + lease from your Mac three ways, the simlock CLI, agent-device (whose + device streams its screen) and HTTP. [02] A fleet of them: a gateway on + your Mac and two more machines; every agent leases through the gateway, + each sent to a different machine. Wires are measured from the boxes, start + and end on an edge and never cross; boxes appear by fading, never by + moving, and every changing label keeps its size, so nothing shifts while it + plays. Below 60rem the stage stacks, with dashed connectors for wires. The + console section draws the console's Overview (`ConsoleView.astro`). - **404** (`src/pages/404.astro`): the hollow scene behind a card, "This device was never leased. *The rest of Simlock is.*" - **Docs:** Starlight, dark by default. The reference pages are copied from diff --git a/lefthook.yml b/lefthook.yml index e7e483249..f32012c03 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -4,7 +4,11 @@ pre-commit: # Formats what is staged and stages the result, so nobody runs a formatter by hand. format: glob: "*.{ts,tsx,js,mjs,json,md,yml,yaml}" - exclude: "docs/**" + # website/ is its own package and oxfmt skips it, so a commit with only website/ files would + # hand oxfmt nothing and fail. + exclude: + - "docs/**" + - "website/**" run: pnpm exec oxfmt {staged_files} stage_fixed: true lint: diff --git a/website/README.md b/website/README.md index 12b79da6b..3f23138a7 100644 --- a/website/README.md +++ b/website/README.md @@ -34,7 +34,7 @@ pnpm og # public/og-image.jpg, banner.jpg, favicon.svg, favicon-32.png | `src/site/brand.ts` | The accent; injected as CSS variables everywhere | | `src/site/meta.ts` | Page titles: `Name: subtitle` on home, `Page | Name` everywhere else; never write a separator by hand | | `src/pages/index.astro` | Home page layout; reorder sections with `order` | -| `src/components/home/Hero.astro`, `hero.ts`, `story.ts` | The hero: agents, the gateway table, the workers; the animation and its data | +| `src/components/home/Hero.astro`, `hero.ts`, `story.ts` | The hero: copy, then a two-step stage (one machine, then a fleet of them behind a gateway); its animation and data | | `src/components/home/ConsoleView.astro`, `console-view.ts`, `console-story.ts` | The drawn console in the Console section | | `src/components/site/dither.ts` | Dithered scenes: `fleet` (the signature), `hollow` (404), `flow`, `mark` | | `src/components/site/` | Nav, Lockup, Mark, Window, CodeBlock, CopyCommand, Tabs, Marquee, Faq, PixelIcon, Closing, Footer | diff --git a/website/og/og.html b/website/og/og.html index 76977fb09..6afce56c8 100644 --- a/website/og/og.html +++ b/website/og/og.html @@ -82,6 +82,7 @@ h1 { margin: 32px 56px 0; max-width: 1000px; + text-wrap: balance; font-weight: 500; font-size: 70px; line-height: 1.04; diff --git a/website/public/banner.jpg b/website/public/banner.jpg index 116c623e3..a3e16b23c 100644 Binary files a/website/public/banner.jpg and b/website/public/banner.jpg differ diff --git a/website/public/og-image.jpg b/website/public/og-image.jpg index e4a8a15d8..8578e68af 100644 Binary files a/website/public/og-image.jpg and b/website/public/og-image.jpg differ diff --git a/website/scripts/og.mjs b/website/scripts/og.mjs index f0592c55d..4b7c4986b 100644 --- a/website/scripts/og.mjs +++ b/website/scripts/og.mjs @@ -11,7 +11,7 @@ import { chromium } from "playwright-core"; import sharp from "sharp"; import { accent, accentRgb, brandCss } from "../src/site/brand.ts"; -import { gatewayUrl, lanes } from "../src/components/home/story.ts"; +import { gatewayUrl, steps } from "../src/components/home/story.ts"; import { site } from "../src/site/content.ts"; const root = fileURLToPath(new URL("..", import.meta.url)); @@ -30,8 +30,10 @@ const card = { install: site.install, platforms: site.platforms, mark: site.mark ?? [], - gateway: gatewayUrl.replace(/^https?:\/\//, ""), - lanes: lanes.map((l) => ({ agent: l.agent, device: l.device, worker: l.worker.label })), + gateway: gatewayUrl, + // why: the card's table is the hero's second step: each agent, its device and the worker + // the gateway sent it to. + lanes: steps[1].agents.map((a) => ({ agent: a.agent, device: a.device, worker: a.worker })), rgb: accentRgb.split(" ").map(Number), }; diff --git a/website/src/components/home/Hero.astro b/website/src/components/home/Hero.astro index ca8e4f021..f4d6db76a 100644 --- a/website/src/components/home/Hero.astro +++ b/website/src/components/home/Hero.astro @@ -1,117 +1,179 @@ --- -import CopyCommand from '../site/CopyCommand.astro'; +// why: the hero tells the product's story in two steps: one machine that agents lease from three +// ways, then a fleet of them behind a gateway. The copy is in content.ts and the steps in story.ts; +// hero.ts plays them. import Dither from '../site/Dither.astro'; -import Window from '../site/Window.astro'; -import { docs, home, site } from '../../site/content'; -import { gatewayUrl, lanes, stageLabel } from './story'; +import { docs, site } from '../../site/content'; +import { gatewayUrl, prompt, stageLabel, steps, tokens } from './story'; -const body = (l: (typeof lanes)[number]) => `{"platform":"${l.platform}","device":"${l.device}"}`; +const num = (i: number) => String(i + 1).padStart(2, '0'); +// why: the server HTML is the first step's finished frame (BRAND.md, Motion); hero.ts resets it +// before it plays. One stage holds both steps: the fleet's machines are a superset of the first +// step's, so the second step only shows what the first hides. +const [first, fleet] = steps; +const machines = fleet!.machines; +const holder = (mi: number, si: number) => first!.agents.find((a) => mi === 0 && a.slot === si); +const streams = (mi: number, si: number) => + steps.some((s) => s.agents.some((a) => a.via === 'AGENT-DEVICE' && a.worker === machines[mi]!.name && a.slot === si)); ---
-
-
-

{site.headline[0]} {site.headline[1]}

-

{site.lede}

- +
+

{site.headline[0]} {site.headline[1]}

+

{site.lede}

+ - -
- {home.setup.map((l) => ('cmd' in l ?
$ {l.cmd}
:
# {l.comment}
))} -
-
-
@@ -119,146 +181,329 @@ const body = (l: (typeof lanes)[number]) => `{"platform":"${l.platform}","device diff --git a/website/src/components/home/hero.ts b/website/src/components/home/hero.ts index a8e91d9d6..f8f092b80 100644 --- a/website/src/components/home/hero.ts +++ b/website/src/components/home/hero.ts @@ -1,92 +1,320 @@ -import { sendPacket, sleep, whenVisible } from "../site/anim"; -import { lanes } from "./story"; +import { sleep } from "../site/anim"; +import { type Agent, prompt, steps, tokens } from "./story"; -type PhoneState = "idle" | "provisioning" | "booting" | "leased"; +// why: each step runs for a fixed time, so its button can fill in step with it. +const DUR = [9500, 11500]; +const FPS = 12; -export default function runFleetHero(viz: HTMLElement) { - const q = (sel: string) => viz.querySelector(sel); - const parts = lanes.map((lane, i) => { - const term = q(`[data-lane="${i}"]`)!; - const t = term.querySelector("[data-t]")!; - const worker = q(`[data-worker="${i}"]`)!; - const gw = q(`[data-gw="${i}"]`)!; - const up = q(`[data-up="${i}"]`)!; - const down = q(`[data-down="${i}"]`)!; - return { - lane, - text: t.textContent ?? "", - t, - steps: [...term.querySelectorAll("[data-step]")], - state: term.querySelector("[data-state]")!, - phone: worker.querySelector("[data-phone]")!, - wstate: worker.querySelector("[data-wstate]")!, - gw, - gwState: gw.querySelector("[data-gw-state]")!, - up, - down, - }; - }); - if (parts.some((p) => !p.t)) return; +class Aborted extends Error {} + +export default function runHero(root: HTMLElement) { + const stage = root.querySelector(".st-stage")!; + const svg = root.querySelector("[data-wires]")!; + const buttons = [...root.querySelectorAll("[data-goto]")]; + const caps = [...root.querySelectorAll("[data-cap]")]; + const chips = [...root.querySelectorAll("[data-agent]")]; + const gw = root.querySelector("[data-gw]")!; + const machines = [...root.querySelectorAll("[data-machine]")]; + const dev = (mi: number, si: number) => machines[mi]!.querySelectorAll("[data-dev]")[si]!; + const fleetMachines = steps[1]!.machines; + const machineOf = (a: Agent) => fleetMachines.findIndex((m) => m.name === a.worker); + + // why: a run checks its generation after every wait, so a click or the stage leaving the + // viewport stops it between steps. + let gen = 0; + let current = 0; + const waiter = (g: number) => async (ms: number) => { + await sleep(ms); + if (g !== gen) throw new Aborted(); + }; + type Wait = ReturnType; + const quiet = (p: Promise) => + void p.catch((e: unknown) => { + if (!(e instanceof Aborted)) throw e; + }); - const setPhone = (p: (typeof parts)[number], s: PhoneState) => { - p.phone.dataset.state = s; - p.wstate.innerHTML = - s === "leased" - ? `leased ${p.lane.agent}` - : s === "idle" - ? 'idle' - : s; + // why: every line is built from text nodes, so no text is ever parsed as markup. + const span = (text: string, cls = "") => { + const s = document.createElement("span"); + if (cls) s.className = cls; + s.textContent = text; + return s; + }; + const say = (el: HTMLElement, word: string, cls: string, rest = "") => { + el.replaceChildren(span(word, cls), ...(rest ? [` ${rest}`] : [])); }; - const reset = () => { - for (const p of parts) { - p.t.innerHTML = `${p.text}`; - for (const s of p.steps) s.classList.add("is-pending"); - p.gw.classList.remove("is-on"); - setPhone(p, "idle"); + // why: wires are measured from the boxes, so they always start and end on an edge. Each box + // spreads its wires along that edge, so no two wires meet at one point; with a gateway, every + // agent goes through it. + type End = { x: number; y: number }; + const edge = (el: Element, side: "l" | "r", i = 0, n = 1): End => { + const r = el.getBoundingClientRect(); + return { x: side === "r" ? r.right : r.left, y: r.top + (r.height * (i + 1)) / (n + 1) }; + }; + let up: SVGPathElement[] = []; + let down: SVGPathElement[] = []; + const path = (a: End, b: End) => { + const o = svg.getBoundingClientRect(); + const [x1, y1, x2, y2] = [a.x - o.left, a.y - o.top, b.x - o.left, b.y - o.top]; + const mx = Math.round((x1 + x2) / 2); + const p = document.createElementNS("http://www.w3.org/2000/svg", "path"); + p.setAttribute("d", `M${x1} ${y1} H${mx} V${y2} H${x2}`); + svg.append(p); + return p; + }; + const wired = () => getComputedStyle(svg).display !== "none"; + const draw = () => { + svg.replaceChildren(); + up = []; + down = []; + if (!wired()) return; + if (current === 0) { + up = chips.map((c, i) => path(edge(c, "r"), edge(machines[0]!, "l", i, chips.length))); + return; + } + up = chips.map((c, i) => path(edge(c, "r"), edge(gw, "l", i, chips.length))); + down = machines.map((m, i) => path(edge(gw, "r", i, machines.length), edge(m, "l"))); + }; + const route = (a: Agent) => (current === 0 ? [up] : [up, down]).map((ps, k) => ps[k === 0 ? steps[current]!.agents.indexOf(a) : machineOf(a)]); + + // why: a packet hops along a wire at the dither's 12 fps, starting and stopping clear of the + // boxes at its ends. + const packet = async (p: SVGPathElement | undefined, back: boolean, ms: number, w: Wait) => { + if (!p || !p.isConnected) return; + const k = span("", back ? "st-pkt is-back" : "st-pkt"); + stage.append(k); + p.classList.add("is-live"); + const len = p.getTotalLength(); + const n = Math.max(4, Math.round((ms / 1000) * FPS)); + try { + for (let i = 0; i <= n; i++) { + if (!p.isConnected) break; + const f = back ? 1 - i / n : i / n; + const pt = p.getPointAtLength(Math.min(len - 5, Math.max(5, len * f))); + k.style.left = `${pt.x}px`; + k.style.top = `${pt.y}px`; + await w(ms / n); + } + } finally { + k.remove(); + p.classList.remove("is-live"); + } + }; + + // why: the untyped rest stays in the line as an invisible ghost, so typing never reflows. + const command = (el: HTMLElement, a: Agent, typed: number) => { + const parts = tokens(a.cmd); + const out: Node[] = [span(`${prompt(a.via)} `, "p")]; + let left = typed; + for (const t of parts) { + const shown = t.text.slice(0, Math.max(0, left)); + left -= t.text.length; + if (shown) out.push(span(shown, t.cls)); + } + out.push(span(a.cmd.slice(Math.max(0, typed)), "ghost")); + el.replaceChildren(...out); + }; + const type = async (el: HTMLElement, a: Agent, w: Wait) => { + for (let i = 1; i <= a.cmd.length; i++) { + command(el, a, i); + await w(18); } }; + const granted = (a: Agent) => (a.via === "AGENT-DEVICE" ? "streaming" : "granted"); - const type = async (p: (typeof parts)[number]) => { - const [typed, rest] = [...p.t.children] as HTMLElement[]; - for (let i = 1; i <= p.text.length; i++) { - typed!.textContent = p.text.slice(0, i); - rest!.textContent = p.text.slice(i); - await sleep(26); + const setDev = (d: HTMLElement, state: string, label?: [string, string]) => { + d.querySelector(".st-phone")!.dataset.state = state; + const l = d.querySelector("[data-dstate]")!; + if (label) say(l, label[0], label[1]); + else l.textContent = state; + }; + const flash = async (el: HTMLElement, ms: number, w: Wait) => { + el.classList.add("is-flash"); + try { + await w(ms); + } finally { + el.classList.remove("is-flash"); + } + }; + // why: the app the agent drives, as its screen streams: it opens, signs in and searches. + const stream = (d: HTMLElement, view: "splash" | "signin" | "home", typed = 1) => { + const s = d.querySelector(".st-stream"); + if (!s) return; + s.dataset.view = view; + const q = s.querySelector("[data-q]")!; + q.classList.toggle("is-focus", typed > 0); + q.style.setProperty("--typed", `${Math.round(typed * 45)}%`); + for (const r of s.querySelectorAll("[data-f]")) r.classList.toggle("is-gone", typed >= 1); + }; + const tap = async (d: HTMLElement, target: HTMLElement, w: Wait) => { + const t = d.querySelector(".st-tap")!; + const box = d.querySelector(".st-stream")!.getBoundingClientRect(); + const r = target.getBoundingClientRect(); + t.style.left = `${r.left - box.left + r.width / 2}px`; + t.style.top = `${r.top - box.top + r.height / 2}px`; + t.classList.remove("is-on"); + void t.offsetWidth; + t.classList.add("is-on"); + await w(400); + }; + const live = async (d: HTMLElement, a: Agent, w: Wait, act: { on: boolean }) => { + d.classList.add("is-live"); + stream(d, "splash", 0); + // why: frames flow back to the agent along its route while the step lasts. + const frames = async () => { + while (act.on) { + const r = route(a); + await packet(r[r.length - 1], true, 400, w); + if (r.length > 1) await packet(r[0], true, 400, w); + await w(300); + } + }; + quiet(frames()); + await w(600); + stream(d, "signin", 0); + await w(1400); + await tap(d, d.querySelector("[data-tap]")!, w); + stream(d, "home", 0); + await w(1000); + for (let i = 1; i <= 5; i++) { + stream(d, "home", i / 5 - 0.001); + await w(110); } + await w(300); + stream(d, "home", 1); }; - const setState = (p: (typeof parts)[number], s: string) => { - p.state.textContent = s; - p.gwState.textContent = s; + const setAgents = (si: number, frame: boolean) => { + steps[si]!.agents.forEach((a, i) => { + const c = chips[i]!; + c.querySelector("[data-via]")!.textContent = a.via; + c.querySelector("[data-title]")!.textContent = `${a.agent} · ${a.where}`; + command(c.querySelector("[data-cmd]")!, a, frame ? a.cmd.length : 0); + const r = c.querySelector("[data-result]")!; + if (frame) say(r, granted(a), "st-live", a.result); + else r.replaceChildren(span(`${granted(a)} ${a.result}`, "ghost")); + }); + }; + // why: a step's devices before anyone leases (start) or once every agent holds one (frame). + const setDevices = (si: number, frame: boolean) => { + fleetMachines.forEach((m, mi) => + m.devices.forEach((d, di) => { + const el = dev(mi, di); + el.classList.remove("is-live"); + const a = frame ? steps[si]!.agents.find((x) => machineOf(x) === mi && x.slot === di) : undefined; + if (!a) return setDev(el, d.start); + setDev(el, "leased", [a.agent, "st-live"]); + if (a.via === "AGENT-DEVICE") { + el.classList.add("is-live"); + stream(el, "home", 1); + } + }), + ); + }; + const show = (si: number, frame: boolean, playing: boolean) => { + current = si; + stage.dataset.step = String(si); + for (const m of machines) m.classList.remove("is-joining", "is-joined", "is-flash"); + buttons.forEach((b, i) => { + b.classList.remove("is-on", "is-playing", "is-done"); + b.setAttribute("aria-pressed", String(i === si)); + if (i !== si) return; + b.style.setProperty("--dur", `${DUR[si]}ms`); + // why: reading layout between removing and adding the class restarts the fill. + void b.offsetWidth; + b.classList.add("is-on", playing ? "is-playing" : "is-done"); + }); + caps.forEach((c, i) => { + c.classList.toggle("is-on", i === si); + if (i === si) c.removeAttribute("aria-hidden"); + else c.setAttribute("aria-hidden", "true"); + }); + setAgents(si, frame); + setDevices(si, frame); + draw(); }; - const run = async (p: (typeof parts)[number]) => { - await type(p); - p.steps[0]!.classList.remove("is-pending"); - await sendPacket(p.up, p.up.querySelector(".pkt")!, false, 520); - setState(p, p.lane.stages[0] ?? "granted"); - p.gw.classList.add("is-on"); - await sendPacket(p.down, p.down.querySelector(".pkt")!, false, 520); - for (const stage of p.lane.stages) { - setState(p, stage); - p.steps[1]!.classList.remove("is-pending"); - setPhone(p, stage); - await sleep(stage === "provisioning" ? 2200 : 1300); + const lane = async (a: Agent, i: number, w: Wait, act: { on: boolean }) => { + const c = chips[i]!; + const result = c.querySelector("[data-result]")!; + const d = dev(machineOf(a), a.slot); + await type(c.querySelector("[data-cmd]")!, a, w); + say(result, "waiting", "st-dim"); + for (const p of route(a)) await packet(p, false, 400, w); + if (!a.warm) { + setDev(d, "booting"); + say(result, "booting", "st-dim"); + await w(1300); } - setPhone(p, "leased"); - await sendPacket(p.down, p.down.querySelector(".pkt--back")!, true, 520); - await sendPacket(p.up, p.up.querySelector(".pkt--back")!, true, 520); - setState(p, "granted"); - for (const s of p.steps) s.classList.remove("is-pending"); + setDev(d, "leased", [a.agent, "st-live"]); + quiet(flash(d.querySelector(".st-phone")!, 160, w)); + if (a.via === "AGENT-DEVICE") quiet(live(d, a, w, act)); + else for (const p of route(a).reverse()) await packet(p, true, 400, w); + say(result, granted(a), "st-live", a.result); }; - const play = async () => { - reset(); - await sleep(700); - await Promise.all(parts.map((p, i) => sleep(i * 1500).then(() => run(p)))); - await sleep(4200); + // why: after step one, the fleet starts with your-mac's leases ending: each device is cleaned, + // and only the iPhone is kept ready. Started by a click, they are simply ready. + const play = async (si: number, w: Wait, after: boolean) => { + const act = { on: true }; + const start = performance.now(); + show(si, false, true); + try { + if (si === 1) { + if (after) { + fleetMachines[0]!.devices.forEach((_, di) => setDev(dev(0, di), "cleaning")); + quiet( + w(1200).then(() => fleetMachines[0]!.devices.forEach((d, di) => setDev(dev(0, di), d.start))), + ); + } + machines.slice(1).forEach((m) => m.classList.add("is-joined", "is-joining")); + for (const m of machines.slice(1)) { + await w(650); + m.classList.remove("is-joining"); + await flash(m, 240, w); + } + } + await w(si === 0 ? 400 : 300); + await Promise.all(steps[si]!.agents.map((a, i) => w(i * 1300).then(() => lane(a, i, w, act)))); + await w(Math.max(800, DUR[si]! - (performance.now() - start))); + } finally { + act.on = false; + } }; - whenVisible(viz, play, () => {}); + const still = matchMedia("(prefers-reduced-motion: reduce)").matches; + let visible = false; + + const run = (from: number) => { + const w = waiter(++gen); + if (still || !visible) { + show(from, true, false); + return; + } + quiet( + (async () => { + for (let si = from, after = false; ; si = (si + 1) % steps.length, after = true) { + await play(si, w, after && si === 1); + } + })(), + ); + }; + + buttons.forEach((b, i) => b.addEventListener("click", () => run(i))); + // why: boxes that fade in, fonts that load and a resized window all move the boxes, so the + // wires are drawn again whenever the stage changes size or a box finishes appearing. + stage.addEventListener("animationend", (e) => { + if ((e.target as Element).matches(".st-gw, .st-machine")) draw(); + }); + new ResizeObserver(() => draw()).observe(stage); + void document.fonts.ready.then(draw); + new IntersectionObserver(([entry]) => { + const now = !!entry?.isIntersecting; + if (now === visible) return; + visible = now; + // why: off screen the run stops; back on screen, the step it was on plays again from the start. + if (!visible) gen++; + run(current); + }).observe(root); } diff --git a/website/src/components/home/story.ts b/website/src/components/home/story.ts index 23d01f20d..c46df2acf 100644 --- a/website/src/components/home/story.ts +++ b/website/src/components/home/story.ts @@ -1,53 +1,87 @@ -// why: routing reasons follow gateway.routing in docs/CONFIGURATION.md (warm device first, then -// the most free capacity), so the story never claims a placement Simlock would not make. +// why: the hero tells one story in two steps, so its words stay in one place: one machine +// leasing to agents that reach it three ways (the simlock CLI, agent-device, HTTP), then a +// fleet of them behind a gateway that every agent goes through. The social card +// (scripts/og.mjs) reads the second step for its gateway table. +// +// why: every command is in the user docs. The CLI talks only to daemons on its own machine +// (docs/CLI.md); your-mac runs the gateway, so `simlock --gateway lease` reaches it there. +// agent-device leases through Simlock's /v1/agent-device (docs/HTTP-API.md), and remote agents +// use POST /v1/lease-requests. A worker listens on 4701 and a gateway on 4700 +// (docs/CONFIGURATION.md, http.port). +// +// why: routing follows gateway.routing in docs/CONFIGURATION.md (a worker with a ready device +// first, then the most free capacity): claude code gets your-mac's ready iPhone; codex's iPhone +// goes to mac-studio, which then has the most free slots; the Pixel goes to linux-box, which has +// the most after that. A slot that is "free" has no device running. -export const gatewayUrl = "https://gw.example"; +export const gatewayUrl = "gw.example"; -export type Stage = "provisioning" | "booting"; +export type Via = "CLI" | "AGENT-DEVICE" | "HTTP"; -export type Lane = { - where: string; +export type Device = { name: string; start: "ready" | "free" }; + +export type Machine = { name: string; host: string; devices: Device[] }; + +export type Agent = { + via: Via; agent: string; - platform: "ios" | "android"; + where: string; + cmd: string; device: string; - worker: { id: string; label: string; host: string; platforms: string }; - lease: string; - why: string; - stages: Stage[]; + worker: string; + slot: number; + // why: a warm device is granted at once; the others boot first. + warm: boolean; + result: string; }; -export const lanes: Lane[] = [ - { - where: "laptop", - agent: "agent-1", - platform: "ios", - device: "iPhone 17 Pro", - worker: { id: "9b07de11", label: "mac-studio-1", host: "macOS", platforms: "iOS · Android" }, - lease: "9b07de11.lse_4a1d", - why: "warm device", - stages: [], - }, - { - where: "ci", - agent: "agent-2", - platform: "ios", - device: "iPhone 17 Pro", - worker: { id: "3f81a2c4", label: "mac-studio-2", host: "macOS", platforms: "iOS · Android" }, - lease: "3f81a2c4.lse_9f2c", - why: "most free capacity", - stages: ["provisioning", "booting"], - }, - { - where: "claude code", - agent: "agent-3", - platform: "android", - device: "Pixel 8", - worker: { id: "5c2e90b7", label: "linux-ci-1", host: "Linux", platforms: "Android" }, - lease: "5c2e90b7.lse_77b0", - why: "most free capacity", - stages: ["booting"], - }, -]; +export type Step = { label: string; caption: [string, string, string]; machines: Machine[]; agents: Agent[] }; + +const ready = (name: string): Device => ({ name, start: "ready" }); +const free = (name = ""): Device => ({ name, start: "free" }); + +const yourMac: Machine = { name: "your-mac", host: "macOS", devices: [ready("iPhone 17 Pro"), free("iPhone 17 Pro"), free("Pixel 8")] }; + +const one: Step = { + label: "One machine", + caption: ["One machine.", "Your agents lease its devices three ways:", "the simlock CLI, agent-device, or HTTP."], + machines: [yourMac], + agents: [ + { via: "CLI", agent: "claude code", where: "on your-mac", cmd: "simlock lease --platform ios", device: "iPhone 17 Pro", worker: "your-mac", slot: 0, warm: true, result: "iPhone 17 Pro · warm" }, + { via: "AGENT-DEVICE", agent: "codex", where: "on your-mac", cmd: "agent-device open MyApp --platform ios", device: "iPhone 17 Pro", worker: "your-mac", slot: 1, warm: false, result: "iPhone 17 Pro" }, + { via: "HTTP", agent: "ci", where: "→ your-mac:4701", cmd: "POST /v1/lease-requests", device: "Pixel 8", worker: "your-mac", slot: 2, warm: false, result: "Pixel 8" }, + ], +}; + +const fleet: Step = { + label: "A fleet of them", + caption: ["A fleet of them.", "Add Macs and Linux boxes behind a gateway.", "Agents anywhere lease through its one URL."], + machines: [ + yourMac, + { name: "mac-studio", host: "macOS", devices: [free("iPhone 17 Pro"), free("iPhone 17 Pro"), free()] }, + { name: "linux-box", host: "Linux", devices: [free("Pixel 8"), free("Pixel 8"), free()] }, + ], + agents: [ + { via: "CLI", agent: "claude code", where: "on your-mac", cmd: "simlock --gateway lease --platform ios", device: "iPhone 17 Pro", worker: "your-mac", slot: 0, warm: true, result: "iPhone 17 Pro · your-mac" }, + { via: "AGENT-DEVICE", agent: "codex", where: "on a laptop", cmd: "agent-device open MyApp --platform ios", device: "iPhone 17 Pro", worker: "mac-studio", slot: 0, warm: false, result: "iPhone 17 Pro · mac-studio" }, + { via: "HTTP", agent: "ci", where: `→ ${gatewayUrl}:4700`, cmd: "POST /v1/lease-requests", device: "Pixel 8", worker: "linux-box", slot: 0, warm: false, result: "Pixel 8 · linux-box" }, + ], +}; + +export const steps = [one, fleet]; export const stageLabel = - "Three agents send lease requests to one gateway URL. The gateway sends each to a different worker: mac-studio-1 grants a warm iPhone 17 Pro at once, mac-studio-2 provisions and boots one, and linux-ci-1 boots an Android Pixel 8. Each agent gets its own device and never picks a machine."; + "First, three agents lease devices from one Mac: one with the simlock CLI, one through agent-device, whose iPhone streams its screen, and one over HTTP. Then two more machines join a gateway on that Mac, and every agent leases through the gateway, each sent to a different machine."; + +// why: BRAND.md colours shell this way: options dimmed, quoted strings in the accent, the rest +// white. The hero renders and types a command from these pieces, as text, never as markup. +export type Token = { text: string; cls: "" | "opt" | "str" }; +export function tokens(cmd: string): Token[] { + return cmd + .split(/(--[a-z-]+|"[^"]*")/) + .filter(Boolean) + .map((text) => ({ text, cls: text.startsWith("--") ? "opt" : text.startsWith('"') ? "str" : "" })); +} + +// why: a shell command starts with $; an HTTP request is drawn as an arrow, since no shell runs it. +export const prompt = (via: Via) => (via === "HTTP" ? "→" : "$"); diff --git a/website/src/site/content.ts b/website/src/site/content.ts index 6e6ebc8d4..e210bcd33 100644 --- a/website/src/site/content.ts +++ b/website/src/site/content.ts @@ -17,14 +17,14 @@ export const site = { // why: the home page title is "Name: subtitle" (src/site/meta.ts), and it must stay within // 60 characters in all. subtitle: "Self-hosted simulator cloud for coding agents", - headline: ["Your own simulator cloud.", "One device per agent."], - lede: "Simlock leases iOS simulators and Android emulators to your coding agents, one device each, booted and checked. Start on one Mac, then put your Macs and Linux machines behind one URL.", + headline: ["Turn your Mac into a simulator cloud", "that manages itself."], + lede: "Simlock leases, serves and manages iOS and Android devices for your coding agents. Start on one Mac, then add machines behind a gateway when you need more. Free and open source.", // why: 160 characters at most, so search results show it whole. description: "Simlock leases iOS simulators and Android emulators to parallel coding agents, from one Mac or a self-hosted fleet of Macs and Linux machines behind one URL.", install: "npm i -g simlock", skill: undefined as string | undefined, - ogAlt: "Simlock by Callstack. Your own simulator cloud. One device per agent.", + ogAlt: "Simlock by Callstack. Turn your Mac into a simulator cloud that manages itself.", owner: "Callstack", callstack: "https://callstack.com/?utm_source=simlock&utm_medium=referral", license: { @@ -149,12 +149,6 @@ simlock release --all`, }; export const home = { - setup: [ - { cmd: site.install }, - { cmd: 'simlock lease --platform ios --device "iPhone 16"' }, - { comment: "a booted device, yours until you release it" }, - ] as ({ cmd: string } | { comment: string })[], - how: { label: "How it works", headline: ["Start on one Mac.", "Grow into a fleet."],