Skip to main content

Module bridge

Module bridge 

Source
Expand description

Versioned JSON command bridge for embedded (mobile/FFI) consumers.

One entry point, bridge_call, accepts a JSON envelope and returns a JSON envelope. Request semantics live in the transport-free library services (starting with crate::solve_v1()); this module contains only the envelope contract, command dispatch, and panic containment. The C ABI wrapper lives in crate::bridge::ffi (feature ffi).

§Envelope contract (v1)

Request:

{ "api_version": 1, "command": "solve", "request": { ... } }

Success response:

{ "ok": true, "api_version": 1, "engine_version": "0.33.1",
  "command": "solve", "result": { ... } }

Error response (always in-band; the bridge never signals failure any other way):

{ "ok": false, "api_version": 1, "engine_version": "0.33.1",
  "error": { "code": "command_failed", "message": "...", "details": { ... } } }

Compatibility policy: the envelope itself rejects unknown fields (a caller that misspells command should hear about it), while inner request payloads follow each command’s own schema discipline (e.g. solve uses the solve-json v1 decoder, which also rejects unknown fields with location info). New commands and new OPTIONAL response fields may appear within api_version 1; anything that would break an existing well-formed caller bumps BRIDGE_API_VERSION. Callers feature-detect with meta.capabilities instead of sniffing versions.

Modules§

ffi
C ABI for the JSON command bridge — the entire mobile-facing surface.

Enums§

BridgeErrorCode
Machine-readable bridge error codes. Distinct from any command’s own error vocabulary: a command_failed carries the command’s typed error in details.

Constants§

BRIDGE_API_VERSION
Bridge envelope version. Bumped only for breaking envelope changes.
MAX_REQUEST_BYTES
Hard cap on request size, matching the solve-json transport.

Functions§

bridge_call
Process one bridge exchange. Never panics; every failure mode is an in-band error envelope. This is the function the C ABI wraps.