Skip to main content

Crate sim_lib_bridge

Crate sim_lib_bridge 

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

  • ASKask_packet / run_ask / run_ask_with_policy: a typed model call whose arguments are fenced data and whose reply is validated against the declared Return shape, with bounded RepairPolicy on an AskFailure.
  • BRIEFbridge_brief / render_brief_sentences: controlled instruction frames rendered as fluent cited sentences.
  • LOOMvalidate_weave / weave_row_by_row over frontier / FrontierMenu: model-authored program bodies, checked row by row against a flat menu, with LoomObligations carrying the valid replacement.
  • COLLABmerge_bridge_replies / MergePolicy: typed reviews, votes, and patches merged by exact parent cid and target path; receipt_packet_for_report serializes 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/brief, …).

Structs§

BridgeFunction
Runtime callable implementing one BRIDGE export.
BridgeLib
Loadable BRIDGE runtime library.
BridgeObligation
One validation defect produced by BRIDGE receive checks.
BridgeReport
Receive-check report for one BRIDGE packet.
FrontierMenu
Legal next heads plus in-scope slot shapes for a BRIDGE packet.
GivenMaterialization
Materialized data returned from a Given part under an explicit budget.
LoomObligation
One row-scoped LOOM validation defect.
RepairPolicy
Bounded ASK repair policy.

Enums§

AskFailure
ASK failure data that can be fed back to a model as repair context.
BridgeFunctionKind
Runtime callable kind for BRIDGE exports.
MergePolicy
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 Fetch request.
bridge_given_materialize_capability
Capability required to materialize a Given payload.
bridge_report_symbol
Runtime symbol for bridge/report.
bridge_request_content_key
Derives the content key for a checked BRIDGE model request.
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 Given part. 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/Frame part 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.