open-standards/wai/wai-app/README.md
Transaction Science 608cd843e9 wai-app: Create's crate, a library with no binary, whose export wai create writes
wai/wai-ui becomes wai/wai-app, the library `wai_app`, with no binary and no `cli`
feature: `wai`, built with its feature `app`, is its command line and its MCP
server. Its served files are named wai-app-* (the WebAssembly package wai_app),
the recordings wai-app-*.json.

- export.rs gives the files of a starter project for a program and the facts its
  project file holds (title, summary, `wai dev`'s mode for the app's room, a watch
  room's file, a show's audience); `wai create --from app.oui` writes them, the
  project file and the licence. The export no longer writes app.json, room.toml,
  relay.toml, package.json, check.mjs or serve.mjs: wai.json names the room, `wai
  dev` runs it and `wai app check` checks the project. Its README and AGENTS.md
  say so, and the README its licence.
- runtime.rs reads a Create runtime by its listing (create/wai-app-runtime.json),
  checking each file's SHA-256.
- bridge.rs keeps the bridge on 127.0.0.1 a coding agent streams a program into
  the page through, with a stream helper; the stdio server, its tools and the
  binary's test go (`wai mcp --toolset app` serves them).
- The page's Export hands over app.oui, the program in its canonical form, and the
  command that makes it a project; the ZIP writer and the page's export in
  WebAssembly go. The page names `wai mcp --toolset app` for the coding agent.
- joule-ui/docs/create.md §4 and §5: the export as `wai create --from app.oui`, and
  the agent's tools app_guide, app_check, app_stream and app_export.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 05:13:27 -04:00

4.1 KiB

wai-app

WAI's widgets for joule-ui, and Create: describe a WAI app, watch it build itself from WAI widgets while a model writes it, try its room, and take it away as a project. A library with no binary of its own: wai, built with its feature app, is its command line and its MCP server. The design is in joule-ui/docs/create.md; the line language a model writes the app in is joule-ui's (joule-ui/SPEC.md §11).

The widgets

A joule-ui registry (src/registry.rs), each widget backed by the room client of joule-moq-web (web/components.js):

Widget What it is Holds
App(children, title) the app one room; Text, Receipts, EnergyMeter
Room(children, title) a live room: join with camera and microphone, or watch Player, Chat, and any room's widgets
WatchTogether(source, children, title) a watch room: one file, watched in sync any room's widgets (a watch room keeps the shared controls alone)
Show(children, title, audience) a show: hosts on camera, an audience that votes Player, Chat, Poll, and any room's widgets
Player(title) the room's video, laid out from its signed record
Chat(title) the room's chat, each message a signed, verified event
Poll(question, options, seconds) a vote the show's lead opens and its clock closes and signs
Participants(title) who is present, from the room's lifecycle
Receipts(title) the page's sealed log of every action, verified
EnergyMeter(title) each action's energy, and how it was obtained
Text(text) a paragraph

Any room's widgets: Participants, Receipts, EnergyMeter, Text. An app holds one room; a poll has 2 to 32 options; a show's audience is 1 to 255; a watch room's source is a file within the app (src/plan.rs). A line that breaks a rule is refused with its line and a reason code, and does not render.

The pieces

  • src/guide.rs: what a model is told before it writes an app, made from the registry (wai app guide, the tool app_guide).
  • src/lib.rs: check and Create, a program as a snapshot the page renders, whole or as it streams, with the room the app needs (wai app check, the tool app_check).
  • src/export.rs: the files of a starter project for a program, and the facts its project file holds: app.oui, index.html, README.md, AGENTS.md, .gitignore, vendor.json, vendor/ (the runtime), and for a watch room media/README.md. wai create <dir> --from app.oui writes them, with wai.json and LICENSE from the writer every wai create project has. No key is ever in it: wai dev makes development keys in .wai/ at run time.
  • src/runtime.rs: the runtime an export carries, read by its listing (create/wai-app-runtime.json) and checked file by file.
  • src/bridge.rs: the bridge on 127.0.0.1 that carries a program from a coding agent into the person's open Create page (wai mcp --toolset app, the tool app_stream).
  • src/web.rs (feature web): the page's WebAssembly surface, with the interaction log every action on the page is sealed into (joule-ui-interaction).
  • web/: the streaming renderer, the components, the room frame, the Create page and the exported app's page; web/runtime.mjs lays the runtime out as the site serves it.

Run it

cargo test                                      # registry, plan, guide, export, runtime, bridge
node --test web/web.test.mjs                    # the renderer and the model streams
e2e/run.sh                                      # Create in a browser, with wai dev, wai create --from and wai app check
wai app guide                                   # what a model is told (wai built with --features app)
wai app check app.oui                           # a program's tree, errors and room
wai create my-app --from app.oui --runtime <dir> # a starter project; then wai app check and wai dev in it
wai mcp --toolset app                           # Create's tools, for a coding agent

Licence

Apache-2.0, and every project wai create writes from an app is too.