Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

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).

InterfaceKindConsentSidesOwner
loggingimportsilentbothcontract-foundation
opstypes-onlysilentbothcontract-foundation
plugin-lifecycleexportsilentbothcontract-foundation
texttypes-onlysilentbothcontract-foundation
typestypes-onlysilentbothcontract-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)

IndexCaseAbout
0trace
1debug
2info
3warn
4error

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)

IndexCaseAbout
0atomic
1independent

localized-text (alias)

= core/text.localized-text

op-kind (alias)

= u16

submit-error (variant)

IndexCasePayloadAbout
0malformedu32Index of the first record whose framing is broken.
1too-many-opsu32
2not-declarednoneThe calling system did not declare write access.
3queue-fullnone
4actor-unknownnoneA player actor names no connected player, or a mismatched one.
5otherstringA condition added after this track opened: a stable kebab-case code documented by the owning spec. Diagnostic.

subscribe-error (variant)

IndexCasePayloadAbout
0too-manynone
1scope-too-largenone
2invalidlocalized-text
3otherstringAs 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.

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.

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.

FieldTypeAbout
minors64
codestring

loc-arg (variant)

IndexCasePayloadAbout
0strstringUntranslated text (bidi-isolated when substituted).
1ints64
2floatf64
3keystringAnother message key, resolved without arguments.
4textu32Another message with its own arguments: an index into the enclosing localized-text.nested.
5itemstringA namespaced item or block id; resolves to its display name.
6playerstringA player’s display name (user text, isolated).
7duration-msu64
8timestamp-mss64Milliseconds since the Unix epoch, UTC.
9currencycurrency-amount

loc-entry (record)

FieldTypeAbout
namestring
valueloc-arg

loc-message (record)

FieldTypeAbout
keystring
argslist<loc-entry>

localized-text (record)

FieldTypeAbout
keystring
argslist<loc-entry>
nestedlist<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.

IndexCasePayloadAbout
0playerplayer-ref
1mod-selfnone

block-box (record)

Inclusive on both corners.

FieldTypeAbout
minblock-pos
maxblock-pos

block-pos (record)

FieldTypeAbout
xs32
ys32
zs32

dvec3 (record)

––––– geometry (world positions are always f64) –––––

FieldTypeAbout
xf64
yf64
zf64

entity-ref (record)

Session handle plus durable id (PersistentEntity.id; 0 = none).

FieldTypeAbout
entityu64
idu64

owner (variant)

Who pays.

IndexCasePayloadAbout
0worldnone
1playerplayer-id
2modstring

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.

FieldTypeAbout
highu64
lowu64

player-ref (record)

A connected player. peer is valid for the connection only.

FieldTypeAbout
peeru64
idplayer-id

pose (record)

FieldTypeAbout
positiondvec3
rotationquat

quat (record)

Unit quaternion.

FieldTypeAbout
xf32
yf32
zf32
wf32

rights (alias)

A set of rights, one bit each. Bits 0-4: interact, operate, command, modify, structure. Other bits are reserved.

= u32

vec3 (record)

FieldTypeAbout
xf32
yf32
zf32

volume-ref (variant)

A block volume: a world space, or a Daedalus assembly by its durable id.

IndexCasePayloadAbout
0worldworld-space-id
1assemblyu64

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.

FieldTypeAbout
highu64
lowu64