manifold:world 0.2.0
Contract reference · Payloads · contract.json (crates/manifold-wasm-abi/wit/contract.json)
Contract 0.2.0, track 0.2: open, unreleased. Nothing on track 0.2 is released yet, so any item may still change in place (spec §7.2).
| Interface | Kind | Consent | Sides | Owner |
|---|---|---|---|---|
block-read | import | listed | both | enki |
block-transaction | import | listed | server | enki |
block-types | types-only | silent | both | enki |
block-world | import | listed | server | enki |
Interface block-read
import · consent listed · sides both · owner enki · kernel profiles read-windows · since 0.2.0
Block reads (Enki B §1). Both sides: the server reads the authoritative
world live at the step the call runs in; the client reads its streamed
chunk cache, which may be a round trip stale and never trusted by the
server. A read never loads a chunk. Consent class listed.
Reads work inside the mod’s own systems, where the host lends the world
(the read window, Enki B §1.3); outside one, get-block is none and the
others fail with outside-system.
Functions
chunk-states
chunk-states: func(volume: volume-ref, bounds: block-box) -> result<list<tuple<chunk-coord, chunk-state>>, read-error>
The state of every chunk intersecting bounds.
- Kernel profiles:
read-windows.
get-block
get-block: func(volume: volume-ref, pos: block-pos) -> option<block-value>
The value at pos; none when its chunk is not resident or the volume
does not exist.
- Kernel profiles:
read-windows.
read-region
read-region: func(volume: volume-ref, bounds: block-box, options: read-options) -> result<region-data, read-error>
- Kernel profiles:
read-windows.
registry-hash
registry-hash: func() -> list<u8>
SHA-256 of registry-snapshot, 32 bytes.
- Kernel profiles:
read-windows. result: packed layoutsha256-digest.
registry-snapshot
registry-snapshot: func() -> list<u8>
The compiled block model (Enki A), layout block-model-snapshot.
Mods rebuild it with BlockModel::from_snapshot.
- Kernel profiles:
read-windows. result: packed layoutblock-model-snapshot.
Types
block-box (alias)
= core/types.block-box
block-pos (alias)
= core/types.block-pos
block-value (alias)
= world/block-types.block-value
chunk-coord (alias)
= world/block-types.chunk-coord
chunk-state (enum)
| Index | Case | About |
|---|---|---|
| 0 | resident | |
| 1 | loading | |
| 2 | absent |
read-error (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | too-large | u64 | More cells than one call may read; the limit. |
| 1 | volume-not-found | none | |
| 2 | unsupported-volume | none | A Daedalus assembly before its block storage implements reads. |
| 3 | invalid-box | none | |
| 4 | unknown-layer | u32 | A layer id this world does not have. |
| 5 | wrong-side | none | |
| 6 | outside-system | none |
read-options (record)
| Field | Type | About |
|---|---|---|
layers | list<u32> | Enki A layer ids. Empty means the solid layer only. |
unknown-value | block-value | Written into cells whose chunk is not resident. |
width | value-width |
region-data (record)
| Field | Type | About |
|---|---|---|
bounds | block-box | |
width | value-width | |
values | list<u8> | Packed cell buffer (layout cell-buffer): one plane per requested layer, solid first, x fastest, then y, then z. |
missing | list<chunk-coord> | Chunks intersecting the box that were not resident. |
values: packed layoutcell-buffer.
value-width (alias)
= world/block-types.value-width
volume-ref (alias)
= core/types.volume-ref
Interface block-transaction
import · consent listed · sides server · owner enki · since 0.2.0
Transactional bulk block edits (Enki B §2) over the host’s one native
submission API (§2.9). Server side; consent class listed.
A transaction is a list of ops submitted in one call and always atomic:
it validates as a unit at the host’s apply slot, applies without
interleaving, replicates as chunk deltas and optionally writes an undo
record. submit follows core/ops (contract foundation §5.3); results
arrive through take-results on this or a later tick. The host submits
during the call, inside the mod’s server systems, where it lends the world
(Enki B §3.4); outside one, submit fails with
other("outside-system").
Functions
cancel
cancel: func(id: batch-id) -> bool
Cancel a transaction before its first chunk applies. False when it is unknown, not this mod’s, finished or already applying.
submit
submit: func(options: txn-options, ops: list<u8>) -> result<batch-id, submit-error>
Submit one transaction. ops is a sequence of [u32 length][postcard TxnOp] records (schema txn-ops), applied in order: a later op sees
earlier ops’ output. Only broken framing fails the call
(malformed(index)); an op this host does not implement, or a
malformed op record, rejects the transaction in its result
(unsupported(kind), malformed).
ops: schema payloadtxn-ops.
supports-op
supports-op: func(kind: op-kind) -> bool
Whether this host implements op kind (the TxnOp variant index:
0 fill, 1 write, 2 write-sparse, 3 write-if-unchanged, 4 map,
5 set-component, 6 remove-component, 7 props, 8 revert, 9 reapply,
10 expect).
take-results
take-results: func() -> list<u8>
This mod’s transaction results since the last call (schema
txn-results).
result: schema payloadtxn-results.
Types
actor (alias)
= core/types.actor
batch-id (alias)
= core/ops.batch-id
blob-key (alias)
= storage/storage-types.blob-key
op-kind (alias)
= core/ops.op-kind
record-mode (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | none | none | |
| 1 | to-blob | blob-key | The host writes the undo record straight to blob storage, in the calling mod’s namespace. |
reveal (enum)
When other players see a transaction that applies over several ticks.
| Index | Case | About |
|---|---|---|
| 0 | progressive | |
| 1 | at-commit |
submit-error (alias)
= core/ops.submit-error
txn-options (record)
| Field | Type | About |
|---|---|---|
volume | volume-ref | |
actor | actor | |
requires | list<string> | Permission nodes the actor must hold beyond the intrinsic ones (Enki B §8.5). At most 8. |
unloaded | unloaded-policy | |
neighbor-updates | bool | Water wakes and Enki A derived-state updates. Off needs build.no-updates. |
undo | record-mode | |
reveal-mode | reveal | |
label | string | Diagnostic text for logs and review hooks, at most 64 bytes. |
unloaded-policy (enum)
What to do when a touched chunk is not resident.
| Index | Case | About |
|---|---|---|
| 0 | reject | |
| 1 | load |
volume-ref (alias)
= core/types.volume-ref
Interface block-types
types-only · consent silent · sides both · owner enki · since 0.2.0
Block values and the records block-read and block-transaction share
(Enki A, “Registry snapshot for mods”; contract foundation §4.5 rule 3,
§15.1). Types only: importing this interface links nothing and needs no
consent.
Types
block-value (alias)
A block value: an index into the world’s value table (Enki A). The
numbers are session-local and never persisted; state strings name
values durably (registry-snapshot maps between the two).
= u32
chunk-coord (record)
A chunk coordinate: block coordinates divided by 32, rounded down.
| Field | Type | About |
|---|---|---|
x | s32 | |
y | s32 | |
z | s32 |
value-width (enum)
Bytes per cell in a packed cell buffer: 2 today, 4 if Enki A widens values. Readers check it.
| Index | Case | About |
|---|---|---|
| 0 | two | |
| 1 | four |
Interface block-world
import · consent listed · sides server · owner enki · since 0.2.0
Server-side voxel-edit decision ABI of the player-edit handler (Enki B
§3.4). Moved from manifold:game@0.1.0 with its records taken from
core/types.
The engine net-inbound phase fills the pending edit-request queue; the
guest drains it and decides each edit. A decided edit is submitted during
the call as a one-cell transaction of the host’s native write path; it
validates first in this tick’s apply slot, commits the same tick and
replicates as a block update. Its outcome arrives through take-results.
get-block (voxel read) is intentionally deferred to its first consumer.
Functions
queue-edit
queue-edit: func(edit: decided-edit) -> result<batch-id, submit-error>
Queue a decided edit: a one-cell transaction, submitted now, that
validates first in this tick’s apply slot. Fails only with the shared
submit-error: malformed for a value wider than a block id,
actor-unknown when the peer is not a connected player (the client is
told of both), and other("not-handler") / other("outside-server-tick")
when the caller is not the handler or calls outside a server-tick
system.
- Reports
other("not-handler"): the caller is not the player-edit handler. - Reports
other("outside-server-tick"): called outside a server-tick system.
reject-edit
reject-edit: func(peer: u64, client-seq: u32, reason: localized-text)
Reject a request for a game reason, routed back to the peer. The reason is shown in the requesting player’s language.
take-edit-requests
take-edit-requests: func() -> list<edit-request>
Drain this tick’s pending inbound edit requests.
take-results
take-results: func() -> list<u8>
Schema payload: the TxnResult records queue-edit’s batch ids resolve
to, oldest first, with an Overflow record when some were dropped.
An edit that writes the value already there is Committed with
changed-cells 0; a refusal is Rejected.
result: schema payloadtxn-results.
Types
batch-id (alias)
= core/ops.batch-id
block-pos (alias)
= core/types.block-pos
decided-edit (record)
A decided edit. Carries the origin so an apply-failure rejection
routes back to the requesting client. new-block is AIR for a break.
| Field | Type | About |
|---|---|---|
peer | u64 | |
client-seq | u32 | |
pos | block-pos | |
world-space | world-space-id | |
new-block | u32 |
edit-action (variant)
Mirror of net-protocol’s EditAction. place carries the block id.
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | break | none | |
| 1 | place | u32 |
edit-request (record)
An inbound client edit request, pre-staged by the host this tick.
| Field | Type | About |
|---|---|---|
peer | u64 | |
client-seq | u32 | |
pos | block-pos | |
world-space | world-space-id | |
action | edit-action |
localized-text (alias)
= core/text.localized-text
submit-error (alias)
= core/ops.submit-error
world-space-id (alias)
= core/types.world-space-id