Expand description
BRIDGE packet line codec for SIM.
This crate provides codec:bridge, the strict reversible text face for one
BRIDGE packet per frame. BRIDGE is a single packet protocol for exchanges
between SIM, humans, and models; this crate owns the packet record model and
its codec, and nothing that runs, sends, or repairs a packet (that is
sim-lib-bridge).
§The packet
BridgePacket
header move, from, to, role, parents, task, output, ceiling, provenance
body an ordered list of typed parts (a closed part book):
Given Frame Call Weave Check Evidence Review Vote Patch
Fetch Return Receipt Attest
warrant content ids of the books/specs the packet was built againstBRIEF, ASK, LOOM, and COLLAB are not separate protocols – they are
BridgeProfileSpec shapes over the body (frame-led, call-led, weave-led, and
review/vote/patch-led). A packet body must derive exactly one profile; there
is one codec and one checker for all four (standard_profile_book).
§What this crate guarantees
- Reversible identity.
packet_content_id/stamp_packet_cid/verify_packet_cidgive a packet a content-addressed cid, andassert_roundtripproves the line form (encode_bridge_text/decode_bridge_text) decodes back to the identical record. - Move, profile, and part legality.
BridgeBook::validate_packetchecks every packet before text decode or expression encode returns canonical data.BridgeMoveBook/standard_move_booksay which move may answer which explicit parent#move=<intent>evidence (avotemay not answer arequest);BridgeProfileBook/standard_profile_bookrequire BRIEF, ASK, LOOM, or COLLAB to be the single body match; andBridgePartBook/standard_part_booksay which typed parts are legal and whether an unknown part is rejected or preserved as inert data (UnknownPolicy,AuthorityClass). - Total text ownership.
assert_total_ownershipproves every rendered byte a model sees belongs to a structural token, a frame sentence (render_frame_part), a part line, or a nonce-fenced datum – there is no free-prose channel for a hidden instruction. AFramerenders both a checked record and a fluent cited sentence. - Warrants.
warrant_for_packetrecords the move/frame/part-spec content ids so a receiver can validate a packet against its own books across a trust or version boundary. The standard codec accepts missing warrants under shared trust; a book configured withBridgeWarrantPolicy::Verifyrequires and checks a matching warrant.
The runtime side – send/receive checking, capability ceilings, model
requests, the frontier engine, and the profile helpers – lives in
sim-lib-bridge; the human review surface lives in sim-lib-view-bridge.
Structs§
- Bridge
Attest Payload - Attestation payload citing evidence for a claim.
- Bridge
Book - A BRIDGE book bundles the part book and move book used for a packet.
- Bridge
Call Argument - One packed argument in a
bridge/Callpayload. - Bridge
Call Payload - Typed payload for a
bridge/Callpart. - Bridge
Codec - The
codec:bridgedecoder/encoder. - Bridge
Codec Lib - Host-registered lib that installs
BridgeCodecascodec:bridge. - Bridge
Evidence Payload - Evidence payload attached to a collaboration packet.
- Bridge
Frame Book - Registry of BRIDGE frame specifications.
- Bridge
Frame Payload - Typed payload for a
bridge/Framepart. - Bridge
Header - Fixed, fast-scan BRIDGE packet header.
- Bridge
Move Book - Registry of legal BRIDGE moves.
- Bridge
Move Spec - Registered dialogue move specification.
- Bridge
Packet - One BRIDGE packet, carrying a header, ordered typed parts, and optional warrant.
- Bridge
Part - One typed body part in a BRIDGE packet.
- Bridge
Part Book - Registry of BRIDGE part-kind specifications.
- Bridge
Part Spec - Registered BRIDGE part-kind specification.
- Bridge
Patch Payload - Patch payload targeting an exact parent packet and path.
- Bridge
Profile Book - Registry of BRIDGE profile specifications.
- Bridge
Profile Spec - Registered BRIDGE profile.
- Bridge
Provenance - Provenance carried in the BRIDGE header.
- Bridge
Receipt Payload - Receipt payload for an accepted or rejected collaboration step.
- Bridge
Review Payload - Review payload targeting one packet path.
- Bridge
Score - One axis in a structured collaboration vote.
- Bridge
Vote Payload - Vote payload with one or more structured score axes.
- Bridge
Warrant - Content ids of protocol books and part specs that build a packet.
- Bridge
Weave Payload - Typed payload for a
bridge/Weavepart. - Bridge
Weave Row - One operation-led LOOM row.
- Frame
Hole Spec - One named typed hole in a frame template.
- Frame
Spec - Registered frame specification.
- Profile
Part Rule - One part-kind rule in a BRIDGE profile.
Enums§
- Authority
Class - Authority class for a registered BRIDGE part kind.
- Bridge
Warrant Policy - Policy for checking packet warrants at receive time.
- Call
Argument Media - Media kind carried by a packed ASK call argument.
- Frame
Hole Kind - Hole kind for a typed BRIDGE frame slot.
- Frame
Kind - Illocutionary kind for a BRIDGE frame.
- Owned
Span - A rendered byte span owned by one BRIDGE packet component.
- Profile
Part Count - Repetition rule for a profile part kind.
- Render
Class - Rendering class for a registered BRIDGE part kind.
- Reply
Rule - Parent-intent rule for a BRIDGE move.
- Unknown
Policy - Policy for preserving a part kind that is not in the standard normative book.
Statics§
- RECIPES
- Cookbook recipes for this codec, embedded at build time.
Functions§
- ask_
profile_ spec - Builds the ASK profile spec:
Given* Frame* Call+ Return. - ask_
profile_ symbol - Profile id for ASK packets.
- assert_
roundtrip - Asserts that encoding then decoding reproduces the same packet.
- assert_
total_ ownership - Asserts that spans exactly cover the full rendered face in order.
- bridge_
packet_ shape_ symbol - Returns the packet shape symbol owned by the BRIDGE codec.
- bridge_
profile_ shape_ expr - Shape descriptor for the registered BRIDGE profile catalog.
- brief_
profile_ spec - Builds the BRIEF profile spec:
Given* Frame+ Return?. - brief_
profile_ symbol - Profile id for BRIEF packets.
- canonical_
packet_ datum - Builds the canonical datum for hashing a packet with
cidcleared. - collab_
profile_ spec - Builds the COLLAB profile spec:
(Review|Vote|Patch|Evidence|Receipt|Attest)+. - collab_
profile_ symbol - Profile id for COLLAB packets.
- content_
id_ string - Returns the stable text form of a content id.
- decode_
bridge_ text - Decodes the strict
BRIDGE/1line face to a BRIDGE packet. - decode_
bridge_ text_ with_ limits - Decodes the strict
BRIDGE/1line face under caller-supplied decode limits. - derive_
weave_ result_ shape - Derives the public result Shape descriptor for a sequence of weave rows.
- encode_
bridge_ text - Encodes a BRIDGE packet to the strict
BRIDGE/1line face. - expr_
to_ packet - Validate a canonical packet expression back into a typed packet.
- frame_
book_ content_ id - Computes the content id for a fluent frame book registry record.
- loom_
profile_ spec - Builds the LOOM profile spec:
Given* Frame* Weave+ Return. - loom_
profile_ symbol - Profile id for LOOM packets.
- move_
book_ content_ id - Computes the content id for a dialogue move book registry record.
- packet_
content_ id - Computes the canonical content id for a packet with
cidcleared. - packet_
to_ expr - Project a packet to the canonical expression record used by
codec:bridge. - part_
spec_ content_ id - Computes the content id for one part-kind registry record.
- render_
frame - Renders a frame payload through its deterministic sentence template.
- render_
frame_ part - Renders a
bridge/Framepart as a cited fluent sentence. - render_
frame_ part_ with_ prose - Renders a
bridge/Framepart as a cited fluent sentence, delegating prose holes torender_prose. - render_
frame_ with_ prose - Renders a frame payload, delegating prose holes to
render_prose. - stamp_
packet_ cid - Returns a packet with its canonical cid stamped into the header.
- standard_
frame_ book - Builds the standard BRIDGE frame book.
- standard_
move_ book - Builds the standard BRIDGE move book.
- standard_
part_ book - Builds the standard BRIDGE part book.
- standard_
profile_ book - Builds the standard BRIDGE profile book.
- validate_
call_ payload - Parses and validates a
bridge/Callpayload. - validate_
collab_ payload - Validates a collaboration part payload for its registered part kind.
- validate_
weave_ payload - Parses and validates a
bridge/Weavepayload. - verify_
packet_ cid - Verifies that a packet’s stamped cid matches its canonical content.
- warrant_
for_ packet - Builds the warrant for
packetfrom the local bridge book.
Type Aliases§
- Weave
Part - Roadmap-facing alias for a typed weave part payload.