Files
penguin-harness/packages/landing/scripts/capture-game-mockup.mjs
T
Yaowei Zheng d4faee3a1e Changelog, dev startup, README, AgentHub 0.4.0, model catalog, and landing site (#7)
Branch-length batch covering tooling, the model layer, the Web App and the public
surfaces. Highlights:

- Changelog: a per-release `changelog/<version>/` tree, grouped by the surface each
  change touches, with a root CHANGELOG.md holding one line per release.
- Dev startup: `scripts/dev-prebuild.mjs` serializes the skills+core prebuild behind a
  lock and keeps `pnpm install` current; `pnpm dev` runs server+web together.
- AgentHub 0.3.3 -> 0.4.0: OmniMessage complete payloads carry one opaque `fidelity`
  object in place of item-level `signature`/`phase`, threaded verbatim through Trace,
  replay and resume; malformed classification adapted to the new error types.
- Model layer: a model is always referenced by an explicit `(provider, model_id)` pair.
  The provider is never inferred, guessed or defaulted -- both the catalog inference and
  the unique-match config resolution are gone, and CLI, SDK, server routes and
  run_subagent all require the complete pair. Catalog gains the Qwen Token Plan, Qwen
  Pay-As-You-Go and Fireworks AI gateways, plus an expanded OpenRouter group.
- Web App: catalog preset sync and per-group speed test on the Models page, positional
  slash commands, a markdown renderer, skill-library update reminders, and a vertically
  centred draft page whose upward menus size themselves to the room available.
- Public surfaces: restructured READMEs, the penguin.ooo landing site and blog, refreshed
  benchmark results for both suites, and the demo videos playing on the landing page.

Includes the fixes from a full review of the branch: 23 confirmed findings, among them a
provider-inference bug that could send one vendor's API key to another vendor's endpoint,
and an Escape handler that destroyed the composer's contents unrecoverably.

Verified on the branch head: pnpm test (1127 passing, 7 packages), pnpm typecheck and
pnpm format:check clean, Playwright e2e 14/14.
2026-07-21 17:43:31 +08:00

63 lines
2.4 KiB
JavaScript

/**
* Render the landing Cases tab's "penguin sled game" finished-product shot.
*
* Same pattern as capture-readme-demo.mjs: penguin-game-mockup.html is a static,
* dependency-free mockup of the example game's play screen, captured per language
* (zh / en) and theme (light = polar day / dark = polar night) into
* packages/landing/src/assets as game-<lang>-<theme>.webp.
*
* Prereqs: Playwright's chromium only (no server, no build). Run:
* `node scripts/capture-game-mockup.mjs [--png-dir <dir>]`.
*/
import { mkdirSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { chromium } from "@playwright/test";
const HERE = path.dirname(fileURLToPath(import.meta.url));
const OUT_DIR = path.resolve(HERE, "../src/assets");
const PAGE = pathToFileURL(path.join(HERE, "penguin-game-mockup.html")).href;
const pngDirArg = process.argv.indexOf("--png-dir");
const PNG_DIR = pngDirArg >= 0 ? process.argv[pngDirArg + 1] : null;
mkdirSync(OUT_DIR, { recursive: true });
if (PNG_DIR) mkdirSync(PNG_DIR, { recursive: true });
const browser = await chromium.launch();
const encoderPage = await browser.newPage();
async function saveWebp(pngBuffer, fileName) {
const dataUrl = await encoderPage.evaluate(async (b64) => {
const img = new Image();
img.src = `data:image/png;base64,${b64}`;
await img.decode();
const canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext("2d").drawImage(img, 0, 0);
return canvas.toDataURL("image/webp", 0.9);
}, pngBuffer.toString("base64"));
writeFileSync(path.join(OUT_DIR, fileName), Buffer.from(dataUrl.split(",")[1], "base64"));
console.log(`[game] ${fileName}`);
}
for (const lang of ["en", "zh"]) {
for (const theme of ["light", "dark"]) {
const context = await browser.newContext({
viewport: { width: 1280, height: 760 },
deviceScaleFactor: 1.5,
locale: lang === "zh" ? "zh-CN" : "en-US",
});
const page = await context.newPage();
await page.goto(`${PAGE}?lang=${lang}&theme=${theme}`);
await page.waitForTimeout(300);
const png = await page.screenshot();
if (PNG_DIR) writeFileSync(path.join(PNG_DIR, `game-${lang}-${theme}.png`), png);
await saveWebp(png, `game-${lang}-${theme}.webp`);
await context.close();
}
}
await browser.close();
console.log("[game] done");