PG playground

Edit. Compile. Inspect. All in your browser.

The real aihu-compile compiler, built to WebAssembly and running on this page. Type .aihu source on the left; every keystroke recompiles it and mounts the result — a live custom element — in the sandboxed frame on the right. No server round-trip, no install.

Start from a recipe

Every preset is a real recipe from thecookbook corpus — the same source the docs, the MCP aihu_example index, and the agent exports are generated from. Each link deep-links the playground straight to that preset.

How it works

  • The compiler is the real one. public/wasm/ is built from this checkout's Rust sources with wasm-packat build time, never fetched from a release — so the grammar the playground accepts is exactly the grammar this commit ships.
  • The preview is sandboxed. Compiled output runs in an iframe with sandbox="allow-scripts" and noallow-same-origin, so it cannot reach this page, its storage, or its cookies. The frame's only channel back is apostMessage height handshake.
  • Your draft is the URL. Picking a preset writes?preset=<id>; editing it switches to?src=<source>, so any state you can see is a link you can share.

If the editor reports that the WASM bundle is unavailable, the build ran without wasm-pack and thewasm32-unknown-unknown target. Install both and re-runbun run prebuild.