# `PtcRunner.PreludeCandidate`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/prelude_candidate.ex#L1)

Versioned, source-bearing prelude candidate stored by `PtcRunner.PreludeStore`.

The compiled field is intentionally Elixir-only. Lisp-facing and transport
surfaces must project through `public_view/2` so the compiled prelude struct
and private environment are never exposed.

# `origin`

```elixir
@type origin() :: {:file, Path.t()} | {:memory, term()} | {:upstream, term()} | nil
```

# `t`

```elixir
@type t() :: %PtcRunner.PreludeCandidate{
  compiled: PtcRunner.Lisp.Prelude.t(),
  created_at: DateTime.t(),
  id: String.t(),
  metadata: map(),
  origin: origin(),
  source: String.t(),
  version: non_neg_integer()
}
```

# `checksum`

```elixir
@spec checksum(t()) :: String.t()
```

The candidate checksum. This is the compiled prelude source hash.

# `export_names`

```elixir
@spec export_names(t()) :: [String.t()]
```

Public export names without the namespace prefix, sorted.

# `public_metadata`

```elixir
@spec public_metadata(
  map(),
  keyword()
) :: map()
```

Filters untrusted metadata to documented public keys and byte bounds.

# `public_origin`

```elixir
@spec public_origin(
  origin(),
  keyword()
) :: String.t() | nil
```

Returns a bounded, JSON-safe provenance tag for a candidate origin.

# `public_view`

```elixir
@spec public_view(
  t(),
  keyword()
) :: map()
```

Returns a bounded, public map view of a candidate.

The view keeps source text because editor workflows need it, but bounds the
bytes by option. It never includes the compiled prelude or private env.

---

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