llw-livive-net

LodaLiteWeb Concepts

This document is the current conceptual map of the project: what the Rust machine owns, how a host discovers it, how time and policy work, and how the browser demo fits on top.


Core idea

LodaLiteWeb is a deterministic, inspectable no_std state machine that emits:

A host loads the machine, reads its emitted shape, and drives it through semantic actions. The host does not need an external schema for the machine.

Host
  reads manifest / help / manual
  sends action ids and arguments
  reads screen / report / state
Machine
  owns state, layout, timing, policy, comparison, and output

Layers

lodalite-web-rs
  no_std core
  scenario model
  reducer
  view rendering
  screen buffer
  logical clock
  policy primitives
  contract

lodalite-web-wasm
  no_std Wasm adapter
  manifest / help / manual projection
  screen composition
  action dispatch
  golden comparison
  report generation
  build provenance

browser-demo
  JS hypervisor
  Wasm loading
  manifest ingestion
  icon nav / menus / resolution / DevTools generation
  key/input forwarding
  screen painting
  telemetry inspection

serve.py
  local static file server only

Self-describing contract

The machine emits its shape from lodalite-web-rs/src/contract.rs.

The contract contains:

The manifest is a line-oriented projection of the contract:

schema|contract|1
abi|16
title|LodaLiteWeb — browser TTY
screen|100|36
screen_bounds|40|240|12|80
browser|startup|about:start
rate_action|2
rate|1000|1000 Hz|1
nav|←|button|13|Back|
nav|★|menu|0|Favorites|favorites
nav|▤|devtools|0|DevTools|
action|0|Run|R|button|primary
action|17|Display profile||hidden|secondary
arg|2|hz|rate|required|rates
arg|12|cols|u32|required|40..240
arg|12|rows|u32|required|12..80
buffer|meta|4096
buffer|event|256|32768
buffer|gc|512
buffer|engine|512
state|0|idle

The full generated manifest and manual.txt are the source of truth; this excerpt is illustrative.

The contract also produces:

Both are generated by Rust.


Action model

Actions are numeric ids with declared arguments and domains.

Current actions:

id name role
0 run run the scenario
1 reset reset the machine
2 set_timebase select a logical clock rate
3 previous_view previous view
4 next_view next view
5 scroll_up scroll the viewer
6 scroll_down scroll the viewer
7 open open the address / enter viewer
8 show_help enter help mode
9 edit_address edit the browser address
10 quit enter the closed screen
11 startup return to startup
12 set_screen_size resize the character grid
13 back browser back
14 forward browser forward
15 refresh browser refresh
16 cancel cancel editing / return to startup
17 set_display_profile select a display profile

The args are declared:

set_timebase   hz: rate
set_screen_size cols: 40..240
set_screen_size rows: 12..80
set_display_profile profile: 0..5

Browser modes

The state machine currently models:

Startup
Viewer
Help
Page
Quit

The startup state is the default.

The UI chrome is an icon navigation bar: Back, Forward, Refresh, Cancel, Address, Favorites, and Resolution. Resolution opens a menu of display profiles. The host page uses a full-viewport shell: the browser pane fills the available space, the screen font is fitted to the pane, and the DevTools inspector docks below with a draggable splitter. The Address button clears the field for entry; Enter loads the typed URL through the host text proxy. Favorites opens a menu whose entries come from the Rust contract.

Startup

Startup keys:

Enter  Open address
e      Edit address
?      Show keyboard help
Esc    Return to startup
q      Quit

The address is stored in a fixed buffer. Text input and backspace update it.

Viewer

The viewer holds the six existing text snapshots and timing metadata.

Viewer keys:

R  run
X  reset
A  previous view
D  next view
W  scroll up
S  scroll down
1  1000 Hz
2  60 Hz
3  10 Hz
4  1 Hz

Page

Favorites load through the local page-text proxy. The fetched text is written into Rust page memory; the machine switches to Page mode and owns the viewport, scroll position, URL display, and frame.

Help

Help mode renders the generated help text inside the browser frame.

Quit

Quit shows a closed screen. Enter restarts at startup.


Screen model

The screen is a fixed character grid with a configurable visible size.

default: 100 x 36
minimum:  40 x 12
maximum: 160 x 60

The machine exports:

lod_screen_render
lod_screen_ptr / lod_screen_len
lod_screen_rows / lod_screen_cols
lod_set_screen_size
lod_action2(action, cols, rows)

The screen stores Unicode scalars, allowing the text snapshots to retain characters such as —, …, ←, and ·.

Screen rendering supports:


Logical time

Time is logical and explicit.

Timebase { ticks_per_second }
Clock { tick }

Supported rates:

1000 Hz
  60 Hz
  10 Hz
   1 Hz

View times are canonical milliseconds:

login                  0 ms
admin-dashboard      500 ms
admin-job-detail    1500 ms
technician-dashboard 2500 ms
customer-dashboard   3500 ms
customer-quote       4500 ms

They are converted to ticks with ceiling quantization.

At 1 Hz:

4500 ms -> tick 5 -> elapsed 5000 ms

The screen metadata changes; the rendered text does not.

No host wall clock is read inside Rust.


Execution policy

The contract announces:

mode:              as_fast_as_possible
pacing:            none
clock:             logical
rate limit:        token bucket, 10 per 1000 ms, burst 10
rate limit scope:  client
on exceed:         queue
reply timeout:     2000 ms
propagation:       500 ms
consistency:       eventual
wait policy:       await_reply
event order:       tick,phase,sequence

The no_std policy module includes:

The current demo executes the six views AFAP. The primitives and policy shape are in place for a host executor.


Provenance

lodalite-web-wasm/build.rs captures:

The manifest carries these fields.

Two identities are distinct:

build_id            changes when source/toolchain/target/build changes
contract_fingerprint changes only when declared shape changes

The contract fingerprint is an FNV-1a hash of the contract projection, excluding volatile build data.


Artifacts

The machine can emit:

screen.txt    current screen text
help.txt      short generated usage guide
manual.txt    full generated contract and policy manual
report.md     generated report with view text and timing

The machine emits these outputs. The current browser UI exposes only the manifest-generated navigation bar; a host or future UI can add download controls without changing the machine.


Host boundary

The JS hypervisor currently owns:

Rust owns:

Python is only the local static server.


Design rules

  1. The machine announces its shape.
  2. Action ids are stable and declared.
  3. Arguments declare their domains.
  4. Timing is logical and integer-based.
  5. Volatile build data is not part of the contract fingerprint.
  6. Screen layout is deterministic text, not DOM.
  7. Help and manual are generated from the same contract.
  8. Hosts adapt platform services; they do not invent machine semantics.
  9. Replay uses ABI, contract fingerprint, action ids, arguments, ticks, and policy.
  10. Screen output is inspectable at every tick.

Hosting

The demo is published at:

https://llw.livive.net/

GitHub Pages builds the Wasm guest and a static site. Local development uses serve.py for the /page proxy; Pages captures the favorites into pages/*.txt and falls back through pages.json.

Current verification

Rust core tests:         18 passed
Rust snapshot tests:     2 passed
Browser startup:         100x36
Browser resize:          80x24 verified
Browser viewer:          6/6 exact
Browser help:            generated and rendered
Browser edit address:    working
Browser quit/restart:    working
ABI:                     16
Wasm size:               ~279 KiB
Guest memory:            ~1.56 MiB

Repository map

lodalite-web-rs/       no_std core
lodalite-web-wasm/     Wasm adapter and build provenance
browser-demo/          JS hypervisor and local server
dont_take_no.md        design philosophy and migration seams
no_std_migration.md    historical migration analysis
browser_reduction.md   Playwright → happy-dom / HTTP experiment
memory_tiers*.svg      runtime footprint comparisons