omp packages

@meri-imperiumi/pi-uxn0.3.0

Pi extension: assemble, lint, headless-test and visually verify Uxn/Varvara ROMs in structured single-turn tool calls

GitHub Actions Published 2 days ago EUPL-1.2 ~384 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-uxn

Pi extension for developing Uxn/Varvara ROMs: it gives the coding agent structured, single-turn tools to assemble, lint, headlessly test and visually verify .tal sources — no shell parsing, no vision model, no external emulator needed at runtime.

What it does

The extension registers four agent tools:

  • uxn_lint — statically lints a .tal file and its ~include tree: stack signatures, zero-page placement, metadata header, module size, suspicious jumps. It also runs the vendored upstream linter ROMs on the built-in VM by default: uxnlin (redundant/unsafe token patterns) and uxnbal (declared stack effects vs actual routine balance), and degrades gracefully to structural checks alone when the ROMs are absent.
  • uxn_test — lints, assembles and headlessly executes a test ROM. Captures TAP assertions, stack-leak checks and memory snapshots from the reserved AgentTest device (0xd0); on failure returns the exact fault with resolved symbol, stack dumps and zero page.
  • uxn_ui_sim — runs a screen ROM headlessly, replays scripted key/mouse/frame events, and returns the screen as a compact 40x30 character grid (8x8 cell hashing against the ROM font), with idle-redraw metrics and optional PNG screenshot.
  • uxn_inspect_rom — parses an assembled .rom without running it: validates the Varvara metadata header and extracts the manifest text, version and field tags.

It also contributes the uxn-varvara skill (a compact opcode/port reference for the agent, plus a bundled full Varvara device reference at skills/uxn-varvara/references/varvara.md) and hooks file saves: every written .tal is linted and assembled immediately, and *-test.tal files get a full headless test run.

Upstream toolchain ROMs

The upstream toolchain builds by Devine Lu Linvega (drifblim assembler, uxnbal stack validator, uxnlin pattern linter — all MIT) are vendored under vendor/roms/ and executed on the built-in VM. Keeping them as ROMs means staying current with upstream is a re-download, not a port: refresh them with

npm run update-roms   # downloads from rabbits.srht.site and validates the metadata headers

Set PI_UXN_ROMS_DIR to look for toolchain ROMs elsewhere. The console-ROM driver (src/clitool.js) implements the upstream uxn2 CLI protocol (Console/type = has_args before boot, argument chars with type 0x2, \n separators with 0x3/0x4).

How it works

Everything is implemented in vanilla JavaScript with zero runtime npm dependencies:

  • src/cpu.js — complete Uxn VM (all 256 opcode forms) with deterministic cycle accounting and trap capture
  • src/devices.js, src/screen.js, src/file.js, src/agent-device.js — Varvara device bus with System, Console, Screen (dual-layer framebuffer, sprite blender, PNG encoder), Controller, Mouse, File (sandboxed) and Datetime devices, plus the reserved AgentTest device for TAP instrumentation
  • src/uxntal.js — zero-dependency two-pass Uxntal assembler, byte-identical with the reference uxnasm
  • src/assembler.js — assemble() with three engines: the built-in JS assembler (default), the external uxnasm binary (engine: 'uxnasm', located via PI_UXN_UXNASM or PATH), and the vendored upstream drifblim ROM (engine: 'drifblim'), all returning the same result shape with .sym symbols
  • src/roms.js, src/clitool.js, src/toolchain.js — toolchain ROM discovery/validation, the console-ROM CLI driver, and the uxnlin/uxnbal runners with output parsers
  • src/linter.js — static Uxntal linter
  • tal/ — reusable TAP library (tap.tal) and manifest template for your own ROM projects
  • vendor/roms/ — vendored upstream toolchain ROMs (see above)

See SPEC.md for the full design and implementation details.

Installation

Install it as a Pi package from npm, git or a local path:

pi install npm:@meri-imperiumi/pi-uxn
pi install git:github.com/meri-imperiumi/pi-uxn
pi install ./pi-uxn

Pi discovers the extension and the bundled skill via the pi.extensions field in package.json.

Development

npm test          # node:test suites (CPU, devices, integration, assembler, toolchain)
npm run check     # TypeScript checking of JSDoc-annotated sources
npm run format
npm run update-roms

License

EUPL-1.2