# `Squidie.ReadModel.Inspection`
[🔗](https://github.com/dark-trench/squidie/blob/main/lib/squidie/read_model/inspection.ex#L1)

Projection-backed inspection for the journal-backed runtime.

The current public `Squidie.inspect_run/2` API reads the durable Jido
journal through the configured `Jido.Storage`. This module is the read-model
boundary for the journal-backed runtime: it rebuilds workflow and dispatch
agents from journal entries, combines their projections, and returns a
factual snapshot of one run.

The snapshot is intentionally read-only. It does not recover missing dispatch
entries, apply completed results, or mutate checkpoints. Recovery remains
owned by `Squidie.Runtime.AgentRecovery`; inspection reports what the
durable journals currently prove.

# `snapshot_error`

```elixir
@type snapshot_error() ::
  :not_found
  | {:invalid_option,
     {:now, :invalid}
     | {:queue, :invalid}
     | {:run_id, :invalid}
     | {:opts, :invalid}
     | {:option, atom()}}
  | term()
```

# `snapshot_option`

```elixir
@type snapshot_option() :: {:queue, atom() | String.t()} | {:now, DateTime.t()}
```

# `storage_config`

```elixir
@type storage_config() :: Squidie.Runtime.Journal.storage_config()
```

# `snapshot`

```elixir
@spec snapshot(storage_config(), Squidie.Runtime.WorkflowAgent.run_id(), [
  snapshot_option()
]) ::
  {:ok, Squidie.ReadModel.Inspection.Snapshot.t()} | {:error, snapshot_error()}
```

Builds a projection-backed inspection snapshot for one workflow run.

Options:

- `:queue` selects the dispatch queue projection to join with the run
  projection. It defaults to `"default"`.
- `:now` controls visibility and lease-expiry calculations. It defaults to
  `DateTime.utc_now/0`.

Missing run threads return `{:error, :not_found}`. A missing dispatch thread is
treated as an empty queue projection because a run can be planned before its
dispatch intents have been recovered.

# `timeline`

```elixir
@spec timeline(Squidie.ReadModel.Inspection.Snapshot.t()) ::
  {:ok, Squidie.ReadModel.Timeline.t()}
```

Builds a chronological, redaction-safe operator timeline from an inspection snapshot.

---

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