PtcRunner.PreludeCandidate (PtcRunner v0.13.0)

Copy Markdown View Source

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.

Summary

Functions

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

Public export names without the namespace prefix, sorted.

Filters untrusted metadata to documented public keys and byte bounds.

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

Returns a bounded, public map view of a candidate.

Types

origin()

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

t()

@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()
}

Functions

checksum(prelude_candidate)

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

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

export_names(prelude_candidate)

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

Public export names without the namespace prefix, sorted.

public_metadata(metadata, opts \\ [])

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

Filters untrusted metadata to documented public keys and byte bounds.

public_origin(origin, opts \\ [])

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

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

public_view(candidate, opts \\ [])

@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.