Tyapkin
Архитектура

Core State

CAP runtime state-machine core after the breaking rewrite.

Core State

The Rust core models a deterministic CAP machine:

State + Input + Capability + GuardSet -> State' + Output + Commitment

Current implementation:

  • crates/protocol-core: MachineContract, capability checks, guarded transitions and deterministic hashes;
  • crates/cap-cli: local runtime, HTTP runner, SQLite store and trace projection;
  • proto/cap/v1: compiled machine, scenario and trace contracts.

Trace

Runtime persists ordered TraceCommitment rows:

CapabilityCommitted
InputCommitted
GuardEvaluated
TransitionCommitted
OutputCommitted

Every row includes:

commitment_id
commitment_hash
commitment_type
trace_id
machine_id
sequence
principal_id
state_before
state_after
input_type
guard_id
output_type
payload_hash
payload_ref
previous_commitment_hash
schema_version

Projection

trace_projection materializes the latest status per trace:

input_committed
guard_evaluated
transition_committed
output_committed

The projection is a read model. Protocol truth remains the ordered trace.

On this page