Skip to main content

Module state_exports

Module state_exports 

Source
Expand description

SPEC-019 R.7: the state-layer exports, as one implementation every binding wraps (SPEC-010 REQ-002: a binding adds term translation and crash containment, never semantics).

Frames are S-expressions, like every other export; state, schema, and rejections come back as canonical JSON (SPEC-019 R.3), a canonical act as its wire text, and a self-address as f1220<hex>.

(fold               <dialect> <thread> (acts (<signer> <message>) …))        → state JSON
(intend             <dialect> <thread> (acts …) <signer> <verb> (:k v …))    → canonical act
(verify-state-shape <dialect> <message>)                                     → "ok"
(state-schema       <dialect>)                                               → schema JSON
(may-send           <dialect> <thread> (acts …) <signer>)                    → JSON array of verbs
(frontier           <dialect> <thread> (acts …))                             → {"instance","frontier"}
(admit              <dialect> <thread> (acts …) (<signer> <message>))        → {"verdict":…}
(define …)                                                                   → f1220<hex>   (dialect_hash)

<dialect> is a (define …) or a (dialects <ancestor>* <leaf>) chain, installed through the full R1–R7 pipeline by parse_and_install_dialect; the leaf is the dialect judged. Each act entry is the complete received message with the signer the host authenticated; the cast is read from the root among the acts and never supplied.

Enums§

Admission
One message’s admission verdict against an accepted set.

Functions§

admit
Admission as a consumer runs it (SPEC-019 R.4; SPEC-002 R5; SPEC-014 R6): the shape stage judges the message alone (R5 shape, R7 state shape); the causal stage judges it against the accepted set of its thread, under the cast when the thread has an accepted root, and is Pending while a predecessor is missing. accepted is the accepted set so far; the caller retries Pending messages as it grows. One implementation for every binding and for the corpus runner, so the accepted set a consumer folds is the one the corpus expects.
admit_str
(admit <dialect> <thread> (acts …) (<signer> <message>)) → JSON {"verdict":"accepted"}, {"verdict":"pending"}, or {"verdict":"rejected","reason":…}. The acts are the accepted set so far.
dialect_hash_str
A (define …) → its self-addressed name f1220<hex> (SPEC-019 R.6).
fold_str
(fold <dialect> <thread> (acts …)) → the state as canonical JSON.
frontier_str
(frontier <dialect> <thread> (acts …)) → {"instance":…,"frontier":[…]}.
intend_str
(intend <dialect> <thread> (acts …) <signer> <verb> (:k v …)) → the canonical act for the host to sign, or Err with a JSON rejection.
may_send_str
(may-send <dialect> <thread> (acts …) <signer>) → a JSON array of verbs.
parse_and_install_dialect
Parse a dialect S-expression, or a (dialects <ancestor>* <leaf>) chain, and install each into a fresh registry through the full R1–R7 pipeline, checking a declared :hash against the canonical hash of the installed dialect. Ancestors precede the leaf so R5 resolves parent performatives.
resource_check_str
Pure escrow authorization, separate from admit. Both are required before an external effect. Supplied history and signer identities must already be authenticated by the host. A locally ready result does not rule out a fork that a remote owner has withheld.
resource_check_value
The native result before JSON rendering, for hosts with limited integer precision.
state_schema_str
(state-schema <dialect>) → the schema as JSON.
verify_state_shape_str
(verify-state-shape <dialect> <message>) → "ok", or Err with a REQ-233 blame S-expression.