mixle.experimental.typed_runtime.boundary module

Versioned, duplicate-safe messages across structured shard boundaries.

class BoundaryInbox(graph, *, run_id, model_id)[source]

Bases: object

Validate versions, order, approximation, and exactly-once delivery.

Parameters:
  • graph (UpdateGraph)

  • run_id (str)

  • model_id (str)

property receipts: tuple[BoundaryReceipt, ...]

Return an immutable snapshot of receive decisions.

receive(message, versions)[source]

Validate and consume one message without applying its runtime payload.

Parameters:
  • message (BoundaryMessage)

  • versions (RuntimeVersions)

Return type:

BoundaryReceipt

next_sequence(message)[source]

Return the next expected sequence number for a message’s stream.

Parameters:

message (BoundaryMessage)

Return type:

int

as_dict()[source]

Return replay-relevant inbox state and receipts.

Return type:

dict[str, Any]

class BoundaryMessage(message_id, run_id, model_id, node_id, source_shard, target_shard, model_version, node_version, dependency_versions, sequence_number, kind, payload, observations=0.0, tokens=0, responsibility_mass=0.0, precision=None, approximate=False, error_bound=None, payload_hash='')[source]

Bases: object

One immutable versioned shard-boundary payload.

Parameters:
  • message_id (str)

  • run_id (str)

  • model_id (str)

  • node_id (str)

  • source_shard (str)

  • target_shard (str)

  • model_version (int)

  • node_version (int)

  • dependency_versions (tuple[tuple[str, int], ...])

  • sequence_number (int)

  • kind (BoundaryMessageKind)

  • payload (Any)

  • observations (float)

  • tokens (int)

  • responsibility_mass (float)

  • precision (str | None)

  • approximate (bool)

  • error_bound (float | None)

  • payload_hash (str)

property stream_key: tuple[str, str, str, str, str, BoundaryMessageKind]

Ordering domain for this message.

property dependency_version_map: dict[str, int]

Return the declared dependency vector as a fresh mapping.

as_dict()[source]

Return metadata and payload fingerprint, never the runtime payload.

Return type:

dict[str, Any]

class BoundaryMessageKind(*values)[source]

Bases: StrEnum

Semantic payload crossing a model, graph, cache, or provider boundary.

class BoundaryReceipt(message_id, run_id, model_id, node_id, accepted, reason, expected_sequence, observed_sequence, current_model_version, current_node_version, declared_dependency_versions, current_dependency_versions, payload_hash)[source]

Bases: object

Accepted/rejected boundary message with expected and observed versions.

Parameters:
as_dict()[source]

Return a JSON-compatible boundary receipt.

Return type:

dict[str, Any]