manifold:core 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 |
|---|---|---|---|---|
logging | import | silent | both | contract-foundation |
ops | types-only | silent | both | contract-foundation |
plugin-lifecycle | export | silent | both | contract-foundation |
text | types-only | silent | both | contract-foundation |
types | types-only | silent | both | contract-foundation |
Interface logging
import · consent silent · sides both · owner contract-foundation · kernel profiles pure, read-windows · since 0.2.0
Guest log lines, forwarded to the host’s logger. Consent class: silent.
Functions
log
log: func(level: log-level, target: string, message: string)
- Kernel profiles:
pure,read-windows.
Types
log-level (enum)
| Index | Case | About |
|---|---|---|
| 0 | trace | |
| 1 | debug | |
| 2 | info | |
| 3 | warn | |
| 4 | error |
Interface ops
types-only · consent silent · sides both · owner contract-foundation · since 0.2.0
Shared shapes for deferred mutations, event rings and op support.
Types only. Each interface that mutates through deferred ops declares its
own submit, take-results, subscribe, unsubscribe, take-events and
supports-op over these types.
Types
batch-id (alias)
= u64
batch-mode (enum)
| Index | Case | About |
|---|---|---|
| 0 | atomic | |
| 1 | independent |
localized-text (alias)
= core/text.localized-text
op-kind (alias)
= u16
submit-error (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | malformed | u32 | Index of the first record whose framing is broken. |
| 1 | too-many-ops | u32 | |
| 2 | not-declared | none | The calling system did not declare write access. |
| 3 | queue-full | none | |
| 4 | actor-unknown | none | A player actor names no connected player, or a mismatched one. |
| 5 | other | string | A condition added after this track opened: a stable kebab-case code documented by the owning spec. Diagnostic. |
subscribe-error (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | too-many | none | |
| 1 | scope-too-large | none | |
| 2 | invalid | localized-text | |
| 3 | other | string | As submit-error.other. |
subscription-id (alias)
= u32
Interface plugin-lifecycle
export · consent silent · sides both · owner contract-foundation · since 0.2.0
The one export every mod implements (contract foundation spec §5.5).
Designed to its end state: an export cannot gain a function within a
track, so everything expected to grow grows inside the two schema
payloads (ModDeclarations and StartContext in manifold-mod-types,
each Envelope-versioned), and a new lifecycle hook is a new export
interface.
Functions
declarations
declarations: func() -> list<u8>
Everything the mod declares, as one postcard ModDeclarations
payload. Pure: it may call logging and nothing else, and returns
the same bytes on every instance and side.
result: schema payloadmod-declarations.
start
start: func(context: list<u8>) -> result<_, string>
The world is ready on this instance. context is a postcard
StartContext payload, encoded at the version the mod’s
declarations named. The error is a diagnostic for logs, not player
text.
context: schema payloadstart-context.
Interface text
types-only · consent silent · sides both · owner contract-foundation · since 0.2.0
Player-facing text: a message key plus typed arguments, never a finished
sentence. Each client resolves it through the catalogs of its player’s
language, so players on one server each read their own language. Mirrors
manifold_l10n_types::LocalizedText. Keys are <mod-id>.<segment>...;
a mod’s catalogs live at locales/<bcp47>/*.ftl in its package.
WIT forbids recursive types, so a message nested inside another travels
in the side table localized-text.nested: text(i) in the root
arguments may name any entry, and text(i) inside nested[j] must have
i > j. At most 16 nested messages and a nesting depth of 4. A host that
receives text breaking these rules shows engine.text.malformed instead;
text shown to a player never makes a call fail.
Types
currency-amount (record)
A currency amount in minor units (cents) with its ISO 4217 code.
| Field | Type | About |
|---|---|---|
minor | s64 | |
code | string |
loc-arg (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | str | string | Untranslated text (bidi-isolated when substituted). |
| 1 | int | s64 | |
| 2 | float | f64 | |
| 3 | key | string | Another message key, resolved without arguments. |
| 4 | text | u32 | Another message with its own arguments: an index into the enclosing localized-text.nested. |
| 5 | item | string | A namespaced item or block id; resolves to its display name. |
| 6 | player | string | A player’s display name (user text, isolated). |
| 7 | duration-ms | u64 | |
| 8 | timestamp-ms | s64 | Milliseconds since the Unix epoch, UTC. |
| 9 | currency | currency-amount |
loc-entry (record)
| Field | Type | About |
|---|---|---|
name | string | |
value | loc-arg |
loc-message (record)
| Field | Type | About |
|---|---|---|
key | string | |
args | list<loc-entry> |
localized-text (record)
| Field | Type | About |
|---|---|---|
key | string | |
args | list<loc-entry> | |
nested | list<loc-message> |
Interface types
types-only · consent silent · sides both · owner contract-foundation · since 0.2.0
Identity and spatial primitives shared by every package. Types only: importing this interface links nothing and needs no consent.
Types
actor (variant)
Who asks. rule actors are server-only Rust and never cross.
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | player | player-ref | |
| 1 | mod-self | none |
block-box (record)
Inclusive on both corners.
| Field | Type | About |
|---|---|---|
min | block-pos | |
max | block-pos |
block-pos (record)
| Field | Type | About |
|---|---|---|
x | s32 | |
y | s32 | |
z | s32 |
dvec3 (record)
––––– geometry (world positions are always f64) –––––
| Field | Type | About |
|---|---|---|
x | f64 | |
y | f64 | |
z | f64 |
entity-ref (record)
Session handle plus durable id (PersistentEntity.id; 0 = none).
| Field | Type | About |
|---|---|---|
entity | u64 | |
id | u64 |
owner (variant)
Who pays.
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | world | none | |
| 1 | player | player-id | |
| 2 | mod | string |
permission-level (alias)
A ladder: higher is more privileged; compare with >=.
0 = player, 200 = admin. Values between are reserved for levels added
in later releases.
= u8
player-id (record)
––––– identity –––––
PlayerRecord.uuid (PlayerUuid): stable across reconnects and
restarts. high is bytes 0..8 and low bytes 8..16, big-endian.
| Field | Type | About |
|---|---|---|
high | u64 | |
low | u64 |
player-ref (record)
A connected player. peer is valid for the connection only.
| Field | Type | About |
|---|---|---|
peer | u64 | |
id | player-id |
pose (record)
| Field | Type | About |
|---|---|---|
position | dvec3 | |
rotation | quat |
quat (record)
Unit quaternion.
| Field | Type | About |
|---|---|---|
x | f32 | |
y | f32 | |
z | f32 | |
w | f32 |
rights (alias)
A set of rights, one bit each. Bits 0-4: interact, operate, command, modify, structure. Other bits are reserved.
= u32
vec3 (record)
| Field | Type | About |
|---|---|---|
x | f32 | |
y | f32 | |
z | f32 |
volume-ref (variant)
A block volume: a world space, or a Daedalus assembly by its durable id.
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | world | world-space-id | |
| 1 | assembly | u64 |
world-space-id (record)
––––– worlds and blocks –––––
Fixed-width mirror of the engine’s opaque 128-bit WorldSpaceId,
split into halves because WIT has no u128 scalar.
| Field | Type | About |
|---|---|---|
high | u64 | |
low | u64 |