mixle.experimental.typed_runtime.context_execution module

Transactional execution adapters for context graph actions.

class ContextActionExecutor(graph, adapters=None)[source]

Bases: object

Apply adapter results atomically to a versioned context graph.

Parameters:
  • graph (ContextGraph)

  • adapters (Mapping[ContextActionKind, ContextActionAdapter] | None)

register(kind, adapter)[source]

Register or deliberately replace one action adapter.

Parameters:
  • kind (ContextActionKind)

  • adapter (Callable[[ContextAction, ContextGraphView], ContextActionResult])

Return type:

None

execute(action)[source]

Execute one context action and return success or rollback receipt.

Parameters:

action (ContextAction)

Return type:

ContextActionReceipt

as_dict()[source]

Return graph and action ledger.

Return type:

dict[str, Any]

class ContextActionResult(nodes=(), edges=(), verifications=(), remove_nodes=(), external_latency_seconds=0.0, materialized_tokens=0, tool_calls=0, monetary_cost=0.0, measured_information_gain=None, outcome='completed')[source]

Bases: object

Pure graph mutations and actual external work returned by an adapter.

Parameters:
  • nodes (tuple[ContextNode, ...])

  • edges (tuple[ContextEdge, ...])

  • verifications (tuple[VerificationUpdate, ...])

  • remove_nodes (tuple[str, ...])

  • external_latency_seconds (float)

  • materialized_tokens (int)

  • tool_calls (int)

  • monetary_cost (float)

  • measured_information_gain (float | None)

  • outcome (str)

class ContextGraphView(version, nodes, edges)[source]

Bases: object

Detached, read-only graph snapshot supplied to action adapters.

Parameters:
classmethod from_snapshot(snapshot)[source]

Create a view whose mappings and values are detached from the live graph.

Parameters:

snapshot (tuple[int, dict[str, ContextNode], dict[str, ContextEdge]])

Return type:

ContextGraphView

neighbors(node_id)[source]

Return both incoming and outgoing neighbors from this fixed snapshot.

Parameters:

node_id (str)

Return type:

tuple[str, …]

class VerificationUpdate(node_id, status, provenance=(), confidence=None)[source]

Bases: object

Proposed evidence-status transition for an existing graph node.

Parameters:
  • node_id (str)

  • status (EvidenceStatus)

  • provenance (tuple[Provenance, ...])

  • confidence (float | None)