PtcRunner.Kernel.CommandOutcome (PtcRunner v0.14.0)

Copy Markdown View Source

Sealed command result returned to frontends.

It carries a validated V3 envelope and status. Frontends must call to_map/1 at the rendering boundary so a mutated or caller-authored struct cannot be emitted. Outcomes never write a stream, raise through Mix, halt the VM, or exit the operating-system process.

Summary

Functions

Returns the validated V3 envelope for rendering.

Checks the complete sealed outcome, including its exact fields, V3 envelope, command mode, exit status, and in-VM construction attestation.

Types

command_mode()

@type command_mode() ::
  :help
  | :version
  | :docs
  | :init
  | :validate
  | :run
  | :doctor
  | {:doctor, :connect}
  | :models
  | :unknown

t()

@type t() :: %PtcRunner.Kernel.CommandOutcome{
  attestation: binary(),
  command_mode: command_mode(),
  envelope: map(),
  exit_status: 0 | 2 | 3 | 4 | 5 | 6 | 7 | 70
}

Functions

error(command, run_ref, diagnostic, secondary \\ [])

run_error(run_ref, diagnostic, artifact_state, secondary \\ [])

@spec run_error(
  binary(),
  PtcRunner.Kernel.CommandDiagnostic.t(),
  %{required(binary()) => binary()},
  [PtcRunner.Kernel.CommandDiagnostic.t()]
) :: t()

success(command_mode, run_ref, result)

@spec success(command_mode(), binary(), map()) :: t()

to_map(outcome)

@spec to_map(t()) :: map()

Returns the validated V3 envelope for rendering.

valid?(outcome)

@spec valid?(term()) :: boolean()

Checks the complete sealed outcome, including its exact fields, V3 envelope, command mode, exit status, and in-VM construction attestation.