PtcRunner.Kernel.InspectionSink (PtcRunner v0.14.0)

Copy Markdown View Source

Required, bounded in-memory owner for sensitive developer inspection records.

Capture is host-enabled, fail-closed, and V8-only. The closed vocabulary contains capability input/exception/output, subordinate evaluation source and static prelude-call analysis, effective prelude source, correlated exact MCP request/response bodies, workflow execution prints/errors, one dedicated explicit-failure-value record, plus at most one strictly JSON terminal result bound to its deterministic canonical hash. Mission-owned source, analysis, capability, prelude, and MCP records require mission_name; workflow-owned records forbid it. Other record types normalize atom keys and enum values to JSON strings; the terminal result must already be strict JSON. The sink assigns the run identity, sequence, and UTC timestamp, and rejects a record before retention when either its retained or encoded size exceeds the installed bounds.

This sink is independent of Logger, Telemetry, EventSink policy, manifests, and Lisp. Records remain private until the host explicitly persists them as a 0600 .inspection.jsonl artifact.

Summary

Functions

Returns a specification to start this module under a supervisor.

Validates and retains one record from the sink's fixed vocabulary.

Returns retained records in sequence order while the required sink is healthy.

Starts one required sink for an exact run and trace identity.

Stops the sink; repeated or owner-driven stops are harmless.

Types

t()

@type t() :: %PtcRunner.Kernel.InspectionSink{pid: pid(), token: reference()}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

emit(sink, record_type, correlation, payload)

@spec emit(t(), binary(), map(), map()) :: :ok | {:error, :inspection_sink_error}

Validates and retains one record from the sink's fixed vocabulary.

records(sink)

@spec records(t()) :: {:ok, [map()]} | {:error, :inspection_sink_error}

Returns retained records in sequence order while the required sink is healthy.

start(opts)

@spec start(keyword()) :: {:ok, t()} | {:error, :invalid_inspection_sink}

Starts one required sink for an exact run and trace identity.

stop(sink)

@spec stop(t()) :: :ok

Stops the sink; repeated or owner-driven stops are harmless.