Skip to content

widgets: native pages from .t27 replace tool.js for jtag-verdict and race-the-bee (t27 epic 10937) #1707

Open

Description

@gHashTag

Move the first two WIDGETS tools from hand-written tool.js to pages written in .t27 and built to wasm. The epic is Trinity-S-AI-DNA/t27#10937: 28 tools carry 22833 hand-written lines (JavaScript, CSS, Node data builders, Python card renderers); the logic and the page of each are being ported to .t27, proven equal to the hand-written version by a differential, and driven by one shared host.

This change, for jtag-verdict and race-the-bee:

  • public/widgets/host.js (32 lines): the one host every native widget shares; it forwards events and data to widget.wasm and sets the HTML the wasm writes.
  • widget.wasm per tool, built from the native spec (the tool's words plus its page, t27c gen and zig, wasm32-freestanding), 9269 and 13014 bytes.
  • scripts/widget-pages-from-spec.mjs: a folder with widget.wasm and no tool.js is a native tool; its page loads ../host.js; every other byte of the generated page is unchanged.
  • the vendored public/t27/t27_compiler.wasm is rebuilt from the t27 repo, because the old build rejects module-level var in a spec.
  • tool.js of both tools is deleted (171 and 105 lines).

Boundary

  • apps/website/scripts/widget-pages-from-spec.mjs
  • apps/website/scripts/widget-pages-from-spec.test.mjs
  • apps/website/public/widgets/host.js
  • apps/website/public/widgets/jtag-verdict/widget.wasm
  • apps/website/public/widgets/race-the-bee/widget.wasm
  • apps/website/specs/widgets/jtag-verdict.t27
  • apps/website/specs/widgets/race-the-bee.t27
  • apps/website/public/t27/t27_compiler.wasm

User Scenarios

  • Given a native tool folder, when the page generator runs, then its page differs from the committed one only in the script tag and the content stamps.
  • Given the migrated pages, when the same actions drive them and the original pages, then their DOM is identical after each.

Requirements

  • FR-001: A native tool MUST have widget.wasm and no tool.js, and the generator MUST refuse a tool with neither.
  • FR-002: The shared host MUST load nothing from another host and keep no browser state.

Success Criteria

  • node scripts/widget-pages-from-spec.mjs --check exits 0 with 82 pages.
  • Net hand-written JavaScript in the change is -207 lines.

Activity

  1. added 7 commits that reference this issue on Oct 19, 2026
    e90c60c
    3b9f1fe
    9bf618f
    387cab9
    8880db1
    f7a957a
    908be12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions