# `SquidMesh.Runtime.DispatchProtocol`
[🔗](https://github.com/ccarvalho-eng/squid_mesh/blob/main/lib/squid_mesh/runtime/dispatch_protocol.ex#L1)

Defines the durable dispatch journal contract.

The protocol separates durable facts from live effects:

- run-thread entries record workflow lifecycle facts
- dispatch-thread entries record runnable intent, claims, leases, heartbeats,
  completions, failures, retries, and live wakeups
- run-index entries support rebuildable lookup projections

A live wakeup or action execution is valid only after the runnable intent is
appended. Claims are fenced by `claim_id` and `claim_token_hash`;
completions, failures, and heartbeats from stale claim owners are ignored by
the projection and surfaced as anomalies.

# `entry_type`

```elixir
@type entry_type() ::
  :run_started
  | :runnables_planned
  | :runnable_applied
  | :run_terminal
  | :run_indexed
  | :attempt_scheduled
  | :attempt_claimed
  | :attempt_heartbeat
  | :attempt_completed
  | :attempt_failed
  | :live_wakeup_emitted
```

# `new_entry`

```elixir
@spec new_entry(entry_type(), map() | keyword()) ::
  {:ok, SquidMesh.Runtime.DispatchProtocol.Entry.t()}
  | {:error, {:unknown_entry_type, atom()} | {:missing_fields, [atom()]}}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
