-
-
-
+
+
+ 1 · One definition, and the app runs · 2 · An agent creates a record over MCP · 3 · A read-only identity is refused ▶ Watch: ObjectStack in 90 Seconds
diff --git a/docs/screenshots/readme-demo.gif b/docs/screenshots/readme-demo.gif
new file mode 100644
index 00000000000..2575202e73e
Binary files /dev/null and b/docs/screenshots/readme-demo.gif differ
diff --git a/docs/screenshots/render-readme-demo.mjs b/docs/screenshots/render-readme-demo.mjs
new file mode 100644
index 00000000000..5cd6c8aca10
--- /dev/null
+++ b/docs/screenshots/render-readme-demo.mjs
@@ -0,0 +1,659 @@
+#!/usr/bin/env node
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+//
+// render-readme-demo — record the README's demo GIF from a really running app,
+// then assemble it into the committed `docs/screenshots/readme-demo.gif`.
+//
+// node docs/screenshots/render-readme-demo.mjs # write the committed GIF
+// node docs/screenshots/render-readme-demo.mjs --out # preview: GIF + every frame into , touch nothing committed
+//
+// Prerequisites are the ones `pnpm dev` itself has, and it checks them itself:
+// a built workspace (`pnpm build`) and a built Console (`pnpm objectui:build`).
+// Plus `ffmpeg` on PATH, which assembles the GIF.
+//
+// ## What it records — three beats and a closing frame
+//
+// 1. The app runs. The Team object exactly as `examples/app-showcase` defines
+// it (comment lines omitted, and the frame says so), then
+// `pnpm dev:showcase -- --fresh -p ` booting it, then the Console's
+// Team list.
+// 2. An agent creates a record over MCP. A JSON-RPC `tools/call` of
+// `create_record` against the running app's `/api/v1/mcp`, sent with an
+// API key minted for the seeded dev admin; then the Console list showing
+// the new row, and the record page's "Created by".
+// 3. A read-only identity is refused. The byte-identical call sent with a key
+// minted for the showcase's Auditor persona (it reads every Team row and
+// holds no create grant); then the Console list, unchanged.
+// Closing frame: the slogan and the four promises, verbatim from README.md.
+//
+// How: boot the showcase on an ephemeral state root (`--fresh`: a temp OS_HOME
+// and database, deleted on exit), sign in through the real auth API, mint both
+// keys through the documented `POST /api/v1/keys` (content/docs/ai/connect-mcp.mdx),
+// make the two MCP calls with `fetch`, screenshot the real Console with the
+// preinstalled Chromium, render every frame as an HTML page and screenshot it,
+// and hand the frames to ffmpeg (palettegen + paletteuse).
+//
+// Only packages the repository already holds are used, resolved from the
+// packages that declare them: Playwright's `chromium` from
+// `examples/app-showcase` (`@playwright/test`) and `sharp` from the docs app's
+// Next dependency. The browser binary is the preinstalled one under
+// `PLAYWRIGHT_BROWSERS_PATH` (default `/opt/pw-browsers`); this script never
+// runs `playwright install`. ffmpeg is the system binary.
+//
+// Typography: the frames this script draws (code, terminal, MCP panels,
+// captions, the closing frame) use Inter and IBM Plex Mono from Google Fonts,
+// the hero cover's pair (`hero-cover-dark.html`); the Console screenshots carry
+// the Console's own fonts. No font file is committed for this.
+//
+// ## Honesty rules this script enforces rather than trusts
+//
+// - Every browser frame is a screenshot of the real Console against the app
+// this run booted. The outline drawn around the new row and around the
+// record count is the only thing added on top of a screenshot.
+// - The request panel shows the bytes that were sent (the body is sent
+// pretty-printed, exactly as shown; the API key is masked after its public
+// prefix). The response panel shows the bytes that came back, with one
+// re-layout for legibility: the escapes inside `result.content[0].text`
+// (backslash-n, backslash-quote) are drawn as the characters they encode.
+// - Terminal output is lines this run's dev server printed, picked by pattern
+// in their original order; a dim ellipsis marks every gap. A pattern that
+// no longer matches is a refusal, never a stand-in line.
+// - No assistant chat transcript, no model identifier, no record the run did
+// not create. The caller is "an agent" / "any MCP client".
+//
+// ## Refusals — each one loud, because a demo that lies ships to every visitor
+//
+// exit 2 no preinstalled Chromium, or no ffmpeg on PATH;
+// exit 3 the web fonts (Inter, IBM Plex Mono — the hero cover's) did not
+// load: the committed GIF is not written, `--out` previews the
+// system fallback (Liberation Sans / DejaVu Sans Mono);
+// exit 4 the dev server did not come up, or a sign-in or key mint failed;
+// exit 5 the story is not what this run observed: the admin's call did not
+// create the row, the read-only identity cannot read the object (so
+// "read-only" would mislabel it), its create was NOT refused, a pinned
+// terminal line is missing, or the record count moved on the refusal;
+// exit 6 the GIF is out of spec: not 1200 px wide, outside 20-35 s, or over
+// the 4,000,000-byte hard cap (over 3,000,000 bytes only warns).
+//
+// Byte-identity across runs is not a goal (ids, timestamps and the port
+// differ); the beats are. The showcase's own external datasource file under
+// `examples/app-showcase/.objectstack/` (gitignored) outlives the run, as
+// `--fresh` documents for any app-relative path.
+
+import { spawn, spawnSync } from 'node:child_process';
+import { createRequire } from 'node:module';
+import { createServer } from 'node:net';
+import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { dirname, join, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const HERE = dirname(fileURLToPath(import.meta.url));
+const REPO = resolve(HERE, '..', '..');
+const GIF = join(HERE, 'readme-demo.gif');
+const OBJECT_SOURCE = join(REPO, 'examples', 'app-showcase', 'src', 'data', 'objects', 'team.object.ts');
+const OBJECT_SOURCE_LABEL = 'examples/app-showcase/src/data/objects/team.object.ts';
+
+const W = 1200;
+const H = 675;
+const MIN_SECONDS = 20;
+const MAX_SECONDS = 35;
+const SOFT_BYTES = 3_000_000;
+const HARD_BYTES = 4_000_000;
+
+const APP_ID = 'com.example.showcase';
+const OBJECT = 'showcase_team';
+// The dev admin `--fresh` seeds (packages/cli `dev --seed-admin`) and the
+// showcase's Auditor persona (examples/app-showcase/src/security/demo-personas.ts:
+// `auditor` position only, so `showcase_auditor` plus the member baseline, which
+// grants Team read and no create). Both are dev-only, well-known credentials.
+const ADMIN = { email: 'admin@objectos.ai', password: 'admin123' };
+const READ_ONLY = { email: 'auditor.demo@example.com', password: 'showcase123' };
+const NEW_TEAM = { name: 'Data Guild', lead: 'ada@example.com', capacity_hours: 120 };
+
+// Sent exactly as written, and drawn exactly as written.
+const CALL_BODY = `{
+ "jsonrpc": "2.0",
+ "id": 1,
+ "method": "tools/call",
+ "params": {
+ "name": "create_record",
+ "arguments": {
+ "objectName": "${OBJECT}",
+ "data": {
+ "name": "${NEW_TEAM.name}",
+ "lead": "${NEW_TEAM.lead}",
+ "capacity_hours": ${NEW_TEAM.capacity_hours}
+ }
+ }
+ }
+}`;
+
+// Terminal lines the boot frame shows, matched against this run's output in
+// order. `through` extends a match to the line that satisfies it.
+const BOOT_LINES = [
+ { re: /Fresh OS_HOME: /, through: /Database: file:/ },
+ { re: /✓ Server is ready$/, through: /➜\s+MCP:\s+http/ },
+ { re: /^Plugins:\s+\d+ loaded$/ },
+ { re: /^Seeds:\s+\S+ \d+ rows$/ },
+];
+
+class Refusal extends Error {
+ constructor(code, message) { super(message); this.code = code; }
+}
+
+const args = process.argv.slice(2);
+const opt = (name) => { const i = args.indexOf(name); return i >= 0 ? args[i + 1] : undefined; };
+const outDir = opt('--out') ? resolve(opt('--out')) : undefined;
+const gifOut = outDir ? join(outDir, 'readme-demo.gif') : GIF;
+const workDir = outDir ?? mkdtempSync(join(tmpdir(), 'readme-demo-'));
+const framesDir = join(workDir, 'frames');
+mkdirSync(framesDir, { recursive: true });
+
+const playwrightRequire = createRequire(join(REPO, 'examples', 'app-showcase', 'package.json'));
+const { chromium } = playwrightRequire('@playwright/test');
+const nextManifest = createRequire(join(REPO, 'apps', 'docs', 'package.json')).resolve('next/package.json');
+const sharp = createRequire(nextManifest)('sharp');
+
+const log = (line) => console.log(line);
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+const esc = (s) => String(s).replace(/&/g, '&').replace(//g, '>');
+// ANSI escape sequences (FORCE_COLOR=0 should leave none; this is the belt).
+const stripAnsi = (s) => s.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, '');
+
+// ── the dev server ───────────────────────────────────────────────────────────
+
+let server;
+let serverOutput = '';
+let serverExited = false;
+
+function freePort() {
+ return new Promise((ok, fail) => {
+ const s = createServer();
+ s.once('error', fail);
+ s.listen(0, '127.0.0.1', () => { const { port } = s.address(); s.close(() => ok(port)); });
+ });
+}
+
+function killServer(signal) {
+ if (!server || serverExited) return;
+ try { process.kill(-server.pid, signal); } catch { /* group already gone */ }
+}
+
+async function stopServer() {
+ if (!server || serverExited) return;
+ killServer('SIGTERM');
+ for (let i = 0; i < 60 && !serverExited; i++) await sleep(250);
+ if (!serverExited) killServer('SIGKILL');
+}
+
+process.on('exit', () => killServer('SIGKILL'));
+for (const sig of ['SIGINT', 'SIGTERM']) {
+ process.on(sig, () => { killServer('SIGTERM'); process.exit(130); });
+}
+
+async function bootServer(port) {
+ const argv = ['dev:showcase', '--', '--fresh', '-p', String(port)];
+ log(`→ pnpm ${argv.join(' ')}`);
+ server = spawn('pnpm', argv, {
+ cwd: REPO,
+ detached: true, // its own process group, so teardown reaches the serve child too
+ stdio: ['ignore', 'pipe', 'pipe'],
+ env: { ...process.env, FORCE_COLOR: '0', NO_COLOR: '1' },
+ });
+ server.stdout.on('data', (d) => { serverOutput += d; });
+ server.stderr.on('data', (d) => { serverOutput += d; });
+ server.on('exit', () => { serverExited = true; });
+ const deadline = Date.now() + 300_000;
+ while (Date.now() < deadline) {
+ if (serverExited) break;
+ if (/Press Ctrl\+C to stop/.test(serverOutput)) {
+ const res = await fetch(`http://localhost:${port}/api/v1/ready`).catch(() => undefined);
+ if (res?.ok) return `pnpm ${argv.join(' ')}`;
+ }
+ await sleep(500);
+ }
+ const tail = stripAnsi(serverOutput).split('\n').slice(-25).join('\n');
+ throw new Refusal(4, `the dev server did not come up on :${port}${serverExited ? ' (it exited)' : ''}:\n${tail}`);
+}
+
+function pickBootLines() {
+ const lines = stripAnsi(serverOutput).split('\n').map((l) => l.replace(/\s+$/, ''));
+ const picked = [];
+ let from = 0;
+ for (const { re, through } of BOOT_LINES) {
+ const at = lines.findIndex((l, i) => i >= from && re.test(l.trim()));
+ if (at < 0) throw new Refusal(5, `no line of this run's dev-server output matches ${re} — the boot frame shows only printed lines`);
+ let end = at;
+ if (through) {
+ end = lines.findIndex((l, i) => i > at && through.test(l.trim()));
+ if (end < 0) throw new Refusal(5, `no line after "${lines[at].trim()}" matches ${through}`);
+ }
+ if (picked.length && at > picked[picked.length - 1].index + 1) picked.push({ gap: true });
+ for (let i = at; i <= end; i++) picked.push({ index: i, text: lines[i] });
+ from = end + 1;
+ }
+ return picked;
+}
+
+// ── the API: sign-in, keys, MCP ──────────────────────────────────────────────
+
+async function signIn(browser, base, who) {
+ const ctx = await browser.newContext();
+ const res = await ctx.request.post(`${base}/api/v1/auth/sign-in/email`, { data: who });
+ if (!res.ok()) throw new Refusal(4, `sign-in as ${who.email} answered ${res.status()}: ${await res.text()}`);
+ const user = (await res.json()).user;
+ const token = res.headers()['set-auth-token'];
+ const mint = await ctx.request.post(`${base}/api/v1/keys`, { data: { name: 'readme-demo' } });
+ if (!mint.ok()) throw new Refusal(4, `POST /api/v1/keys as ${who.email} answered ${mint.status()}: ${await mint.text()}`);
+ const key = (await mint.json()).data;
+ if (!key?.key?.startsWith('osk_') || !key.prefix) throw new Refusal(4, `POST /api/v1/keys as ${who.email} returned no osk_ key`);
+ const state = await ctx.storageState();
+ await ctx.close();
+ return {
+ user,
+ key: key.key,
+ prefix: key.prefix,
+ storageState: { cookies: state.cookies, origins: [{ origin: base, localStorage: [{ name: 'auth-session-token', value: token }] }] },
+ };
+}
+
+async function mcpCall(base, key, body) {
+ JSON.parse(body); // never send what is not JSON
+ const started = Date.now();
+ const res = await fetch(`${base}/api/v1/mcp`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', accept: 'application/json, text/event-stream', 'x-api-key': key },
+ body,
+ });
+ const raw = await res.text();
+ const ms = Date.now() - started;
+ let rpc;
+ try { rpc = JSON.parse(raw); } catch { throw new Refusal(5, `the MCP endpoint answered non-JSON (${res.status}): ${raw.slice(0, 300)}`); }
+ return { status: res.status, statusText: res.statusText, contentType: res.headers.get('content-type'), raw, ms, rpc };
+}
+
+async function countRows(base, key) {
+ const res = await fetch(`${base}/api/v1/data/${OBJECT}`, { headers: { 'x-api-key': key } });
+ if (!res.ok) throw new Refusal(5, `GET /api/v1/data/${OBJECT} answered ${res.status}`);
+ return (await res.json()).records.length;
+}
+
+// ── the Console ──────────────────────────────────────────────────────────────
+
+const SHOT = { width: 1152, height: 540, scale: 1.125 }; // a 1024 x 480 viewport, drawn at 1152 x 540
+
+async function consoleShot(page, url, name, { waitText, outline }) {
+ await page.goto(url, { waitUntil: 'domcontentloaded' });
+ await page.getByText(waitText, { exact: true }).first().waitFor({ timeout: 60_000 });
+ await page.waitForLoadState('networkidle').catch(() => {});
+ const nav = page.getByRole('link', { name: 'Teams', exact: true }).first();
+ if (await nav.count()) await nav.scrollIntoViewIfNeeded().catch(() => {});
+ await page.waitForTimeout(800);
+ const path = join(framesDir, `console-${name}.png`);
+ await page.screenshot({ path, animations: 'disabled', caret: 'hide' });
+ const meta = await sharp(path).metadata();
+ if (meta.width !== SHOT.width || meta.height !== SHOT.height) {
+ throw new Refusal(6, `Console screenshot ${name} measures ${meta.width} x ${meta.height}, expected ${SHOT.width} x ${SHOT.height}`);
+ }
+ let box;
+ if (outline) {
+ const b = await outline(page).boundingBox();
+ if (b) box = { x: b.x * SHOT.scale, y: b.y * SHOT.scale, w: b.width * SHOT.scale, h: b.height * SHOT.scale };
+ }
+ log(` console ${name}: ${page.url()}`);
+ return { src: `data:image/png;base64,${readFileSync(path).toString('base64')}`, url: page.url(), box };
+}
+
+// ── frames ───────────────────────────────────────────────────────────────────
+
+const CSS = `
+ :root {
+ --bg: #08080f; --card: #12131f; --bar: #171824; --line: #2a2a30;
+ --fg: #f5f6fa; --fg-2: #c7cad6; --fg-3: #9598ab;
+ --indigo: #818cf8; --violet: #a78bfa; --purple: #bd84fc; --amber: #f5a623;
+ --green: #34d399; --red: #f87171;
+ --font-sans: Inter, 'Liberation Sans', 'DejaVu Sans', sans-serif;
+ --font-mono: 'IBM Plex Mono', 'DejaVu Sans Mono', 'Liberation Mono', monospace;
+ }
+ * { box-sizing: border-box; margin: 0; padding: 0; }
+ html, body { width: ${W}px; height: ${H}px; overflow: hidden; background: var(--bg); color: var(--fg);
+ font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
+ #stage { position: absolute; left: 23px; top: 18px; width: 1154px; height: 576px; }
+ .win { position: absolute; inset: 0; border-radius: 12px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
+ .bar { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--bar);
+ border-bottom: 1px solid var(--line); font: 500 14px var(--font-mono); color: var(--fg-3); white-space: nowrap; }
+ .bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a3b4a; flex: none; }
+ .bar .title { margin-left: 10px; }
+ .bar .url { margin-left: 18px; padding: 3px 14px; border-radius: 7px; background: #0b0c14; color: var(--fg-2); }
+ .bar .note { margin-left: auto; color: var(--fg-3); }
+ .code, .term { padding: 20px 26px; font: 19px/28px var(--font-mono); white-space: pre; color: var(--fg-2); }
+ .term { font-size: 18px; line-height: 26px; }
+ .k { color: var(--violet); } .s { color: var(--indigo); } .fn { color: var(--amber); }
+ .prompt { color: var(--indigo); } .cmd { color: var(--fg); } .gap { color: #55586b; }
+ .ok { color: var(--green); }
+ .shot { position: absolute; left: 0; top: 34px; width: 1152px; height: 540px; display: block; }
+ .ring { position: absolute; border: 3px solid var(--amber); border-radius: 8px;
+ box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.22); }
+ .cols { position: absolute; top: 34px; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; }
+ .col { padding: 14px 22px; overflow: hidden; }
+ .col + .col { border-left: 1px solid var(--line); }
+ .lbl { display: flex; align-items: center; gap: 10px; height: 26px; margin-bottom: 8px;
+ font: 600 13px var(--font-sans); letter-spacing: 0.12em; color: var(--fg-3); }
+ .who { font: 500 14px var(--font-sans); letter-spacing: 0; color: var(--fg-2); }
+ .badge { padding: 3px 10px; border-radius: 6px; font: 600 13px var(--font-mono); letter-spacing: 0; }
+ .badge.ok { color: var(--green); background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.4); }
+ .badge.no { color: var(--red); background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.45); }
+ .badge.ro { color: var(--amber); background: rgba(245, 166, 35, 0.12); border: 1px solid rgba(245, 166, 35, 0.45); }
+ .http { font: 15px/21px var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-2); }
+ .http .h { color: var(--fg-3); }
+ .http .hl { background: rgba(129, 140, 248, 0.16); color: var(--fg); border-radius: 3px; }
+ .http .hk { background: rgba(245, 166, 35, 0.16); color: var(--fg); border-radius: 3px; }
+ .http .err { background: rgba(248, 113, 113, 0.14); color: #fecaca; border-radius: 3px; }
+ .cap { position: absolute; left: 24px; right: 24px; top: 606px; height: 56px; display: flex; align-items: center; gap: 16px; }
+ .cap .n { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
+ background: linear-gradient(135deg, #6d6cf5, #9b6cf6); font: 700 20px var(--font-sans); color: #fff; }
+ .cap .t { font: 700 25px var(--font-sans); letter-spacing: -0.015em; white-space: nowrap; }
+ .cap .sub { font: 400 16px var(--font-sans); color: var(--fg-3); white-space: nowrap; }
+ .cap .dots { margin-left: auto; display: flex; gap: 8px; }
+ .cap .dot { width: 30px; height: 6px; border-radius: 3px; background: #262735; }
+ .cap .dot.on { background: var(--indigo); }
+ .close { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px;
+ background: radial-gradient(900px 520px at 50% 30%, rgba(99, 102, 241, 0.22), transparent 70%); }
+ .brand { display: flex; align-items: center; gap: 14px; font: 700 30px var(--font-sans); letter-spacing: -0.02em; }
+ .brand svg { width: 40px; height: 40px; }
+ .slogan { font: 800 78px/1.05 var(--font-sans); letter-spacing: -0.035em; text-align: center; }
+ .slogan .accent { background: linear-gradient(90deg, var(--indigo) 0%, var(--violet) 55%, var(--purple) 100%);
+ -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: 0.06em; }
+ .chips { display: flex; gap: 14px; }
+ .chip { height: 50px; padding: 0 22px; display: inline-flex; align-items: center; border-radius: 12px;
+ background: #19191f; border: 1.5px solid var(--line); font: 500 22px var(--font-sans); color: var(--fg-2); }
+`;
+
+const LOGO = ``;
+
+const CAPTIONS = {
+ 1: '1 · One definition. The app runs.',
+ 2: '2 · An agent creates a record over MCP.',
+ 3: '3 · A read-only identity is refused.',
+};
+
+function caption(beat, sub) {
+ if (!beat) return '';
+ const dots = [1, 2, 3].map((n) => ``).join('');
+ return `
${beat}
${esc(CAPTIONS[beat].slice(4))}
${esc(sub)}
${dots}
`;
+}
+
+function highlightTs(line) {
+ return esc(line)
+ .replace(/'[^']*'/g, (m) => `${m}`)
+ .replace(/\b(import|from|export|const)\b/g, '$1')
+ .replace(/\bField\.(\w+)/g, 'Field.$1');
+}
+
+function readObjectExcerpt() {
+ const lines = readFileSync(OBJECT_SOURCE, 'utf8').split('\n');
+ const imp = lines.find((l) => l.startsWith('import { ObjectSchema, Field }'));
+ const start = lines.findIndex((l) => l.startsWith('export const Team = ObjectSchema.create({'));
+ const end = lines.findIndex((l, i) => i > start && l === '});');
+ if (!imp || start < 0 || end < 0) throw new Refusal(5, `${OBJECT_SOURCE_LABEL} no longer declares \`export const Team = ObjectSchema.create({ … });\` — update the excerpt`);
+ const body = lines.slice(start, end + 1).filter((l) => !/^\s*\/\//.test(l));
+ return [imp, '', ...body];
+}
+
+const win = (bar, inner) => `