Cross-host
Intent programs on several kinds of host. Where a program is evaluated and where its λ is drawn are two separate places.
Evaluation and presentation
An Intent is evaluated where its program and its Choices are kept: a Web Worker, a server, a process. λ is drawn by a host: a web page, a terminal, a native screen. Between the two pass only data: λ as a tree of host nodes and the actions a person takes on it. In the Web Worker, the server and the terminal, new versions of a program arrive as source too. The host holds neither the Intent nor its Choices, and the evaluator draws nothing.
Every frame has a number. A host acknowledges the frame it drew and sends each event with that frame's number, so an event from an older frame is refused. A new version of a program is tried under the current Choices before it replaces the running one, and a person's decisions carry over by the identity of their choice.
The labs
Over-the-Air
A trip's two choices on three installed hosts, a phone, a tablet and a terminal that prints λ as text, each evaluated in a Web Worker beside the page. Push a version of the program to all three, or write one on the page: each device installs it or refuses it by the kinds it draws, and its decisions stay. Run it.
Server OTA
The same page with the evaluator in a Cloudflare Worker: sessions in Durable Objects, programs deployed as source while the server runs. It is verified on a local workerd; a public deployment waits for its configuration. In review in #340.
Terminal
A terminal host: λ is printed as lines, and numbers are typed back. On the site it is the third device in Over-the-Air, with its evaluator in a Web Worker. In labs/terminal the same host is a Node process with no React and no DOM, the evaluator in a worker thread; its tests replay the shared scenario message for message.
Native
SwiftUI on iOS and Jetpack Compose on Android draw a bear and its controls through the session protocol. The evaluator is one JavaScript bundle, run in JavaScriptCore on iOS and in JavaScriptSandbox on Android, with a precompiled program and a stand-in model; programs are not deployed as source here. In softoyai/softoy#69.
What they share
All four labs speak the same session protocol: numbered frames, acknowledgements, node kinds a host declares (the base ones, plus its own, such as the bear), and actions as data. Each brings its own program and its own checks.
- The Web Worker, the server and the terminal run the trip program and replay one trip scenario: each step, and the exact messages both sides send.
- The native hosts run the bear program, precompiled, with a stand-in model, and check it with their own 21-frame VM replay. Programs are not deployed to them as source.
Last updated on
Edit on GitHub