Expand description
Checked BRIDGE packet runtime for SIM model exchanges.
sim-lib-bridge is the send/receive guard around the reversible BRIDGE packet
codec (sim-codec-bridge). It runs packets: validation, capability ceilings,
content-addressed request identity, model-request construction, response
decoding, the shared frontier engine, and the four profile helpers. It targets
EvalFabric and the provider-neutral runner
contracts; it does not own transports or model providers.
§One checker, both directions
There is exactly one receive checker (rx_check), and transmit runs it on its
own output before anything leaves SIM – so a peer never bounces a packet its
author believed well-formed.
TX `bridge_tx` / `run_bridge`:
canonicalize -> stamp cid -> assert_roundtrip -> render_model_face
-> assert_total_ownership -> rx_check (the self-check gate)
-> ModelRequest in EvalRequest.expr -> realize_final
RX `bridge_rx` / `bridge_rx_response`:
terminal_response_packet (LAST content item) -> decode -> rx_check:
move legality + from/to inversion + parent-`Return` reply legality
+ per-part shape checks -> BridgeReport (accepted, obligations, repair menus)effective_caps resolves the header ceiling and every acting step runs under
diminish(current, ceiling). verify_warrant turns a stale-book packet into a
Fetch obligation instead of a hard failure or a silent accept.
§Profiles (helpers over the one packet)
- ASK –
ask_packet/run_ask/run_ask_with_policy: a typed model call whose arguments are fenced data and whose reply is validated against the declaredReturnshape, with boundedRepairPolicyon anAskFailure. - BRIEF –
bridge_brief/render_brief_sentences: controlled instruction frames rendered as fluent cited sentences. - LOOM –
validate_weave/weave_row_by_rowoverfrontier/FrontierMenu: model-authored program bodies, checked row by row against a flat menu, withLoomObligations carrying the valid replacement. - COLLAB –
merge_bridge_replies/MergePolicy: typed reviews, votes, and patches merged by exact parent cid and target path;receipt_packet_for_reportserializes the report lens back onto the wire.
materialize_given / fetch_obligation implement budgeted context with the
Fetch affordance; install_bridge_lib / BridgeLib register the runtime
verbs (bridge/tx, bridge/rx, bridge/ask, bridge/run-ask,
bridge/brief, …). bridge/run-ask accepts any object exposing
EvalFabric, a packet expression, and an optional
bounded retry count.
Structs§
- Bridge
Function - Runtime callable implementing one BRIDGE export.
- Bridge
Lib - Loadable BRIDGE runtime library.
- Bridge
Obligation - One validation defect produced by BRIDGE receive checks.
- Bridge
Report - Receive-check report for one BRIDGE packet.
- Frontier
Menu - Legal next heads plus in-scope slot shapes for a BRIDGE packet.
- Given
Materialization - Materialized data returned from a
Givenpart under an explicit budget. - Loom
Obligation - One row-scoped LOOM validation defect.
- Repair
Policy - Bounded ASK repair policy.
Enums§
- AskFailure
- ASK failure data that can be fed back to a model as repair context.
- Bridge
Function Kind - Runtime callable kind for BRIDGE exports.
- Merge
Policy - Declared policy for combining collaboration contributions.
Statics§
- RECIPES
- Cookbook recipes embedded from this crate’s
recipes/directory.
Functions§
- ask_
default_ codec - Default codec for packing ASK call arguments and answers.
- ask_
packet - Builds an ASK request packet with model parameters omitted.
- ask_
packet_ with_ model_ params - Builds an ASK request packet.
- bridge_
ask_ symbol - Runtime symbol for
bridge/ask. - bridge_
brief - Builds a BRIEF request packet from one typed frame.
- bridge_
brief_ symbol - Runtime symbol for
bridge/brief. - bridge_
fetch_ capability - Capability required to expand context through a typed
Fetchrequest. - bridge_
given_ materialize_ capability - Capability required to materialize a
Givenpayload. - bridge_
report_ symbol - Runtime symbol for
bridge/report. - bridge_
request_ content_ key - Derives the content key for a checked BRIDGE model request.
- bridge_
run_ ask_ symbol - Runtime symbol for
bridge/run-ask. - bridge_
rx - Decodes and checks a model response expression.
- bridge_
rx_ response - Decodes and checks the last content item of a model response.
- bridge_
rx_ symbol - Runtime symbol for
bridge/rx. - bridge_
tx - Builds an eval request for a packet after running the TX self-check gate.
- bridge_
tx_ symbol - Runtime symbol for
bridge/tx. - effective_
caps - Resolves a packet’s declared capability ceiling against the current context.
- fetch_
obligation - Builds the typed obligation used when context must be fetched explicitly.
- frontier
- Computes the shared BRIDGE frontier for BRIEF, ASK, LOOM, and COLLAB views.
- install_
bridge_ lib - Installs the BRIDGE runtime library into a context.
- manifest_
name - Manifest symbol for the BRIDGE runtime library.
- materialize_
given - Materializes one
Givenpart. Callers must opt in and supply a budget. - merge_
bridge_ replies - Merge patch replies by exact parent content id and target path.
- next_
frontier_ menu - Computes the next LOOM frontier menu from the shared BRIDGE frontier engine.
- output_
contract_ for_ packet - Builds the model output contract declared by a packet’s output part.
- prepare_
packet - Canonicalizes, stamps, and locally validates a packet before transmission.
- receipt_
packet_ for_ report - Builds a receipt packet carrying a report as a normal BRIDGE packet.
- receipt_
symbol - Runtime symbol for the receipt function.
- render_
brief_ sentences - Renders every
bridge/Framepart as a cited BRIEF sentence. - render_
model_ face - Renders the model-facing BRIDGE line face and ownership spans.
- run_ask
- Runs an ASK packet with the default bounded repair policy.
- run_
ask_ with_ policy - Runs an ASK packet with an explicit bounded repair policy.
- run_
bridge - Runs one checked BRIDGE exchange over a target eval fabric.
- rx_
check - Checks a BRIDGE packet against the local book and optional parent packet.
- terminal_
bridge_ text - Returns the terminal BRIDGE text from a model response.
- terminal_
response_ packet - Decodes the terminal content item of a model response as a BRIDGE packet.
- validate_
weave - Validates one LOOM weave payload against the shared frontier.
- validate_
woven_ row - Validates one candidate woven row by appending it to the accepted prefix and running the shared LOOM checker.
- verify_
warrant - Verifies a packet warrant against the local bridge book.
- weave_
row_ by_ row - Runs LOOM woven mode, requesting and committing one row at a time.