From 28c1ed1ee61ac12c7d71ef741c92c567e46178c9 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Sun, 1 Nov 2026 13:21:18 -0600 Subject: [PATCH 1/2] docs(id): specify plaza guest ABI v1 --- pkgs/id/examples/roc-counter/counter.wasm | Bin 59951 -> 59977 bytes pkgs/id/examples/roc-world/ABI.md | 152 ++++++++++++++++++ pkgs/id/examples/roc-world/README.md | 3 + pkgs/id/examples/roc-world/host/src/host.zig | 6 + pkgs/id/examples/roc-world/platform.roc | 2 +- pkgs/id/examples/tic-tac-toe/tic-tac-toe.wasm | Bin 69319 -> 69345 bytes pkgs/id/src/sandbox.rs | 21 +++ 7 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 pkgs/id/examples/roc-world/ABI.md diff --git a/pkgs/id/examples/roc-counter/counter.wasm b/pkgs/id/examples/roc-counter/counter.wasm index 4ca1d8f23835b45abb096f155af2a32c2d715e66..0495b36ff48427ab140b0ddc785097fb79a87607 100644 GIT binary patch delta 3701 zcmbVP2~bo=8lHad%^}0c(~N+eJ>Vc-h?;;$5_t~+aS#Cql6%W$Eqj_ zwpY{`(IhCSkUWfd>`JnxqVZ0&5~E2aRcr08m8hvQRT{9|uV;qCUAJm$hoaB_{QCd@ z?$>Z#JbzuR8s()UE3)(}_^&!4Q_aqjh>3`jK@ueVyab~l2xcORI#Du{ZlWLx2EBm@ zMx7USj25Fo-(4g+QS=dwG7(KCQ}vw@;@^l5vym&-9)%0Ci?cJcXXj-uo%iPAyoCk2 z(d+^7_a2)(J>8pFy*8f}vzRR;NQ)LK3}hxdWqJkeW0OWQ*^zEDNv3A@T4zGHwdXE9 zy21Xl1Y^1)D<(Nk+Zu2|BHgsC&?_Rk=y1~jlEFr#29wEbTIx$^D^s&boOUnua}gUK zr~QC-^W*?*)J^8wKTXaiaqM1d1k0U5NfKK>C72|z+9_fFNt7sMWo7G%VuVOa)F--F zky4$UzeZVz2luh1->DvR(Xte>$M>S`Yf-%0uvms z2N06Xa;ATT){?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_fZ{msYuEoqO zv>DH}h1%wE=i_9F~R&adQ%L`@fOA@^@CRzRQK9ss?pJruH~JqV^3+V4Xizf^-z znU@7ZCMx+?+Sw!WS`LR4Dz6u!;r@I*#zVGRtvXSM4~S04R>z%eoRh7z^5!a|@HQHx zOiORBM<|~!hVdkorr(M~^i8+y(2w1k32FcGq#;*CFQrefNBbb84Iu~UM2V!Zz>>f& rnFDTz;!c!tdjLzO_^YKh*^0kc1XnNJa|BMs>&`p4<10mfxoG__qx>Y8 diff --git a/pkgs/id/examples/roc-world/ABI.md b/pkgs/id/examples/roc-world/ABI.md new file mode 100644 index 0000000000..865cd69d9b --- /dev/null +++ b/pkgs/id/examples/roc-world/ABI.md @@ -0,0 +1,152 @@ +# Plaza guest ABI — version 1 + +This document specifies the byte-level boundary between an `id` world host and +a Roc world compiled for Wasm32. Version 1 is the interface implemented by +[`host/src/host.zig`](host/src/host.zig), [`platform.roc`](platform.roc), and +the import-free guest runner in [`../../src/sandbox.rs`](../../src/sandbox.rs). +The Roc platform's module-level functions are described in the +[world-platform README](README.md). + +`plaza_abi_version() -> i32` returns `1` for this specification. A semantic +change to an existing export or to its wire contract needs an explicit ABI +version decision; adding optional exports does not change the meaning of the +existing ones. The current runner accepts modules without this getter for +backward compatibility and allowlists it when present; it does not yet use the +returned value to negotiate versions. + +## Module and value conventions + +- The guest is an import-free Wasm32 module. It exports its linear memory as + `memory`; the runner provides no WASI, filesystem, network, clock, or random + imports. Each world has a persistent instance and its model pointer remains + in that instance's linear memory. +- Wasm `i32` values carry pointers, byte lengths, and participant IDs; Wasm + `i64` values carry seeds and dimensions. In the Roc/Zig source these are + represented as `usize` or `u64`. Pointers are byte offsets into this + instance's memory, not host addresses. +- Strings and event/snapshot payloads are UTF-8 byte sequences. Lengths are + byte counts, not character counts. Pointer/length ranges must be valid in + the exported memory. The runner bounds-checks copied output and enforces its + configured message and memory limits. +- A model pointer is opaque to the host. `init`, `update`, and `restore` + produce the model pointer used by later calls; projection calls must not + consume or replace it. +- Unless noted otherwise, optional exports may be absent. `memory`, + `plaza_alloc`, `plaza_free`, `plaza_init`, `plaza_update`, `plaza_view`, and + `plaza_out_len` are required. `plaza_snapshot` and `plaza_restore` must either + both be present or both be absent. The diagnostic getters are independently + optional in the runner, but the Roc host exports them as a pair. + +## Exports + +Signatures below are Wasm signatures; `i32` pointers and lengths refer to the +guest's linear memory. + +| Export | Signature | Contract | +| --- | --- | --- | +| `plaza_abi_version` | `() -> i32` | Returns `1` for this ABI specification. New v1 host builds export it; older guest modules may omit it. | +| `plaza_alloc` | `(i32 byte_len) -> i32 ptr` | Allocates guest-owned memory for host-provided input bytes. The host writes the input before calling the guest operation and releases the allocation with `plaza_free`. | +| `plaza_free` | `(i32 ptr, i32 allocation_len) -> ()` | Releases a matching allocation made by `plaza_alloc`. The length is the allocation length; for an empty logical input the runner allocates and later frees one byte while passing logical length zero to the operation. | +| `plaza_init` | `(i64 seed) -> i32 model` | Creates the initial model from the host-provided `u64` seed. Called once for a newly instantiated world. | +| `plaza_update` | `(i32 model, i32 participant, i32 event_ptr, i32 event_len) -> i32 model` | Applies one UTF-8 serialized world event and returns the next model. `participant` is the sender's ID; host-generated events use participant `0`. The runner commits the returned model only when the call succeeds. | +| `plaza_view` | `(i32 model) -> i32 output_ptr` | Returns UTF-8 text or a portable screen JSON document for the current model. | +| `plaza_layout` | `(i32 model, i64 width, i64 height) -> i32 output_ptr` | Optional viewport-specific rendering. Width and height are the connection's viewport dimensions. When absent, the host falls back to `plaza_view`. | +| `plaza_records` | `(i32 model) -> i32 output_ptr` | Optional structured projection. The returned bytes are a JSON object of string keys to JSON values; the host validates and publishes it. | +| `plaza_wants` | `(i32 model) -> i32 output_ptr` | Optional capability request/subscription document, as specified below. | +| `plaza_snapshot` | `(i32 model) -> i32 output_ptr` | Optional UTF-8 serialization of the model for a journal checkpoint. Must be paired with `plaza_restore`. | +| `plaza_restore` | `(i32 snapshot_ptr, i32 snapshot_len) -> i32 model` | Reconstructs a model from bytes produced by `plaza_snapshot`. The input is allocated by the host and released after the call. A Roc program should return a sensible model for invalid snapshot text rather than trap. | +| `plaza_out_len` | `() -> i32 byte_len` | Returns the byte length of the most recent output from `view`, `layout`, `records`, `wants`, or `snapshot`. It is one shared output slot. | +| `plaza_error_ptr` | `() -> i32 ptr` | Optional diagnostic pointer exposed after a guest trap. In the Roc host it points to the captured Roc crash message in guest memory. | +| `plaza_error_len` | `() -> i32 byte_len` | Optional diagnostic length paired with `plaza_error_ptr`; the Roc host captures at most 4096 bytes. The bytes are not NUL-terminated and are diagnostic only, not a result/status channel. | + +### Buffer lifetime and errors + +For an input call, the host allocates in guest memory, writes the bytes, calls +the guest with the pointer and logical byte length, and frees that allocation +after the call. The guest must not retain the input pointer. The returned model +pointer is retained by the host; it is not a `plaza_alloc` buffer. + +Snapshot support is an all-or-nothing pair. Before trimming a journal, the +host restores the snapshot into a probe instance and refuses the trim unless +the probe produces byte-identical snapshot text and identical published +records. A module without the pair keeps its full journal. The host replaces +the probe's initial model when it applies `plaza_restore`; modules should make +restore total for malformed or unsupported snapshot text. + +Every output-producing export returns a pointer and leaves its byte length in +`plaza_out_len`. The host reads and copies that range immediately. The Roc +adapter reuses one output slot: the next output-producing call releases the +previous `RocStr`, so consumers must not retain an output pointer across such a +call. The host validates the pointer/length range before reading it. + +Guest traps and fuel exhaustion are failures, not successful ABI return +values. The Roc host's `roc_crashed` callback captures up to 4096 bytes and +traps; after a trap the runner may read the optional diagnostic pointer/length +pair. A missing or unusable diagnostic is still a guest failure. The runner +does not use the diagnostic exports for normal return values. + +## Capability protocol + +When exported, `plaza_wants` returns a UTF-8 JSON document of the current +subscriptions and outstanding one-shot requests. Version 1 uses this shape: + +```json +{ + "v": 1, + "subscribe": ["players", "time.tick:5000"], + "requests": [{"id": "r1", "cap": "time.now"}] +} +``` + +The `v` field is optional for compatibility; when present it must be `1`. +`subscribe` and `requests` may be omitted when empty. The complete document is +limited to 64 KiB, with at most 64 subscriptions and 64 requests. Subscription +specs and capability names are 1–64 bytes. A request has a unique +program-chosen `id` (1–64 bytes, no control characters), a `cap` name, and +optional `args` (at most 8 KiB of serialized JSON; absent means `null`). At +most four distinct tick intervals may be requested. A malformed or over-limit +document is a guest-program failure. The host answers a request with a +participant-0 event such as +`{"cap":"result","id":"r1","ok":true,"value":{"now":123}}`; +failures use `"ok":false` and a stable `"error"` code. Refusal codes include +`cap_denied`, `unknown_cap`, `bad_args`, `failed`, `actor_denied`, +`outside_ceiling`, and `result_too_large`. Subscription events include +`{"cap":"time.tick","interval":5000,"now":123}` and player joined/left +events; refused subscriptions use a `cap: "subscription"` event with `spec`, +`ok: false`, and an error code. Host events are journaled when the program +accepts them, so replay feeds the same events back through `plaza_update`. + +The runtime provider catalog is: + +| Capability | Behavior | +| --- | --- | +| `time.now` | One-shot current Unix time in milliseconds (`{"now": ...}`). | +| `time.tick` | Subscribe as `time.tick:` with a positive interval; periodic host events while a participant is present, subject to the world's configured minimum interval and the four-interval limit. | +| `random.u64` | One-shot random unsigned 64-bit value (`{"value": ...}`). | +| `players` | Subscribe to participant join/leave events. | +| `players.list` | One-shot participant list, including ID, display name, and presence. | +| `chat.say` | Commit a chat line from `args.text`; result contains its sequence. | +| `chat.history` | Read recent chat lines; `args.count` defaults to 16 and is capped at 64. | +| `records.read` | Read a byte-bounded, key-ordered page of published records. `args.prefix` filters keys and `args.after` is an exclusive cursor; continue with `next_after`. | +| `schedule.at` | Schedule one event using printable-ASCII `args.id` (1–64 bytes) and Unix-millisecond `args.at`; at most 64 schedules may be pending, past times fire on the next wakeup, and times more than 30 days ahead are refused. | +| `schedule.cancel` | Cancel a pending schedule by printable-ASCII `args.id`; result reports `{"cancelled": bool}`. | +| `world.info` | Read the world ID and current sequence. | + +The `Key`, `Screen`, `RocJson`, `RocGrid`, `RocCap`, and `RocText` names are +platform modules exposed to Roc source, not runtime request providers. The +server's grant/ceiling policy still applies to runtime capabilities; a known +but ungranted request is returned as a refusal event, not silently executed. +`wants` is a pure projection of the model: the program stores pending request +state in its model (and, when needed, in snapshots) so it can re-announce +outstanding requests after replay. + +## Source references + +- Export implementation and memory/output ownership: [`host/src/host.zig`](host/src/host.zig). +- Wasm export list and Roc-to-host declarations: [`platform.roc`](platform.roc). +- Required/optional export checks, memory marshalling, and result handling: + [`../../src/sandbox.rs`](../../src/sandbox.rs). +- Capability schema, limits, and catalog: + [`../../crates/id-core/src/world_caps.rs`](../../crates/id-core/src/world_caps.rs). +- Capability execution and result values: + [`../../src/world/actor.rs`](../../src/world/actor.rs). diff --git a/pkgs/id/examples/roc-world/README.md b/pkgs/id/examples/roc-world/README.md index cedcd4baf5..67eee193e4 100644 --- a/pkgs/id/examples/roc-world/README.md +++ b/pkgs/id/examples/roc-world/README.md @@ -12,6 +12,9 @@ examples/tic-tac-toe/ app: a two-player game ## The module ABI +The host/guest boundary is specified in [ABI v1](ABI.md), including the +`plaza_*` exports, buffer ownership, and capability protocol. + A world program provides these functions: ``` diff --git a/pkgs/id/examples/roc-world/host/src/host.zig b/pkgs/id/examples/roc-world/host/src/host.zig index 20a50f04f8..5aa9d4ff8f 100644 --- a/pkgs/id/examples/roc-world/host/src/host.zig +++ b/pkgs/id/examples/roc-world/host/src/host.zig @@ -30,6 +30,12 @@ fn hostExpectFailed(_: [*]const u8, _: usize) callconv(.c) void {} var last_crash: [4096]u8 = undefined; var last_crash_len: usize = 0; +const PLAZA_ABI_VERSION: u32 = 1; + +export fn plaza_abi_version() u32 { + return PLAZA_ABI_VERSION; +} + fn hostCrashed(bytes: [*]const u8, len: usize) callconv(.c) void { last_crash_len = @min(len, last_crash.len); @memcpy(last_crash[0..last_crash_len], bytes[0..last_crash_len]); diff --git a/pkgs/id/examples/roc-world/platform.roc b/pkgs/id/examples/roc-world/platform.roc index da03b0c977..b3ff3bcb9a 100644 --- a/pkgs/id/examples/roc-world/platform.roc +++ b/pkgs/id/examples/roc-world/platform.roc @@ -26,7 +26,7 @@ platform "" targets: { inputs_dir: "targets/", x64musl: { inputs: ["crt1.o", "libhost.a", app, "libc.a", "libzigc.a", "libcompiler_rt.a"] }, - wasm32: { inputs: ["host.wasm", app], output: Shared, exports: ["plaza_alloc", "plaza_free", "plaza_init", "plaza_update", "plaza_view", "plaza_layout", "plaza_records", "plaza_wants", "plaza_snapshot", "plaza_restore", "plaza_out_len", "plaza_error_ptr", "plaza_error_len"] }, + wasm32: { inputs: ["host.wasm", app], output: Shared, exports: ["plaza_abi_version", "plaza_alloc", "plaza_free", "plaza_init", "plaza_update", "plaza_view", "plaza_layout", "plaza_records", "plaza_wants", "plaza_snapshot", "plaza_restore", "plaza_out_len", "plaza_error_ptr", "plaza_error_len"] }, } import Screen diff --git a/pkgs/id/examples/tic-tac-toe/tic-tac-toe.wasm b/pkgs/id/examples/tic-tac-toe/tic-tac-toe.wasm index 90a00d97d90b0985c4a16a111ab66984ac4fc514..388d2c35e191b799281ba780726b3abc4cb14ed1 100644 GIT binary patch delta 5411 zcmb7I4OmoV+Mf5EGs6rsz)?ZKK|F(q{EK}8%7!v1;>b^+LSRDz>VlKIu0QKvCD5i> zqM$E{wU(5+^rQh!ToS6V)ul=r1uj@T8=REK8 z-0%JTyw5vFUy?4qB-N&RYFI_Fwu1hx&$MfQJ6mFg^*aNZ=lY|HXfPPoUmGi4Vm>^Q zwT$Wahq)!oOJM3edHcxy`VTS(jT{*g7c(OEp`59+ zvQ5m_^ZB*XY+mdWPD1ss<3KAYtf}l|Z+0K{f#^UQ9T`3#S13iXd zKE`7o#ycJ%ER_f7OE6!qFTmG!{Vcp0ZLneflp)41tFJbpf?KW(aGo~k8MANg^klN# zT3K1Sda2Q(wT4^ua*DId_=CheonOl>A|CJh{!bK}!QV<*!-}2B*6kAh_$n^T#sdpkZ@nCY!*oWe#D5+>kXG?}ulF41xj|zy#rStWUkCNfe<-Bd7D3 zS;L`XO%|!xo|OX?KV+qe4=aq9RQU0!*=9DG&&v)NW-~&^Zov_vkxN`~M13zfasjlJ z@*UY_@peUHt*VqBl2Yzp5g`PqR%ru@BV5p^U<5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/src/sandbox.rs +++ b/pkgs/id/src/sandbox.rs @@ -178,6 +178,7 @@ impl Sandbox { matches!( export.name(), "memory" + | "plaza_abi_version" | "plaza_alloc" | "plaza_init" | "plaza_update" @@ -935,6 +936,26 @@ mod tests { assert_eq!(world.view().unwrap(), b"hello"); } + #[test] + fn checked_in_roc_examples_export_abi_version_one() { + for wasm in [ + include_bytes!("../examples/roc-counter/counter.wasm").as_slice(), + include_bytes!("../examples/tic-tac-toe/tic-tac-toe.wasm").as_slice(), + ] { + let runner = Sandbox::compile(wasm, SandboxLimits::default()).unwrap(); + let mut store = Store::new(&runner.engine, ()); + store.set_fuel(runner.limits.fuel).unwrap(); + let instance = Instance::new(&mut store, &runner.module, &[]).unwrap(); + let abi_version = instance + .get_typed_func::<(), i32>(&mut store, "plaza_abi_version") + .unwrap() + .call(&mut store, ()) + .unwrap(); + + assert_eq!(abi_version, 1); + } + } + #[test] fn checked_in_roc_counter_compiles_and_initializes_in_the_import_free_sandbox() { let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); From f6d140e19314e0eb3fc16c1a72b00c488de23915 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Tue, 3 Nov 2026 08:09:28 -0600 Subject: [PATCH 2/2] fix(id): point the ABI version test at the moved tic-tac-toe module main moved pkgs/id/examples/tic-tac-toe to pkgs/id/apps/tic-tac-toe/program; the new test added here still referenced the old path, which git merged cleanly because the paths differ. --- pkgs/id/src/sandbox.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/id/src/sandbox.rs b/pkgs/id/src/sandbox.rs index 250ed38eda..9f2013c897 100644 --- a/pkgs/id/src/sandbox.rs +++ b/pkgs/id/src/sandbox.rs @@ -940,7 +940,7 @@ mod tests { fn checked_in_roc_examples_export_abi_version_one() { for wasm in [ include_bytes!("../examples/roc-counter/counter.wasm").as_slice(), - include_bytes!("../examples/tic-tac-toe/tic-tac-toe.wasm").as_slice(), + include_bytes!("../apps/tic-tac-toe/program/tic-tac-toe.wasm").as_slice(), ] { let runner = Sandbox::compile(wasm, SandboxLimits::default()).unwrap(); let mut store = Store::new(&runner.engine, ());