Skip to main content

Module behavior

Module behavior 

Source
Expand description

Behavior ABI — the sandboxed interactivity layer (behavior-abi-v0.1).

A world’s WASM behavior module receives events (a player interacts, a tick) and returns declarative Actions — intents the browser performs. The module never touches IO: it can’t open a URL, buy something, or veilwalk directly; it asks the host to, so the sandbox stays pure and the host stays authoritative. That’s the whole safety model, and it’s what lets a world be interactive without a browser trusting its code.

This module is the transport-agnostic core: the Action/InteractEvent types (the wire between module and host) and the Behavior seam. The actual WASM execution is a feature-gated binding (behaviors, see [crate::behavior_wasm]); tests here use a plain-Rust Behavior, so the ABI and the dispatch model are verified with no WASM runtime.

Structs§

ActionList
The return of thread_on_interact — the effects a behavior wants performed.
Actor
Who triggered an event (the interacting player), as far as a behavior may know.
InteractEvent
host → module when a player interacts with a bound placement.

Enums§

Action
A declarative effect a behavior asks the host to perform (module → host). The host — never the module — carries it out, so the sandbox never touches IO.

Traits§

Behavior
One instantiated behavior module (a WASM instance, or a plain-Rust one in tests). The browser owns a Behavior per manifest behavior id and dispatches events to it, then performs the Actions it returns.

Functions§

parse_actions
Parse an ActionList from a behavior’s JSON return (empty on malformed — a misbehaving module must never break the world; the super-stable tenet).