Insider.Protocol.Result (Insider v0.1.0)

Copy Markdown View Source

A typed outcome that keeps values, failures, effects, streams, and cleanup separate.

Non-success results may retain a bounded partial value when evidence became available before a later operational failure. The error remains authoritative for operational status; callers must not interpret a partial value as success.

Summary

Types

status()

@type status() :: :ok | :error | :timeout | :cancelled | :unsupported

t()

@type t() :: %Insider.Protocol.Result{
  cleanup: map(),
  code_fingerprint: String.t() | nil,
  compiler_events: [term()],
  confidence: atom(),
  consumption: map(),
  dependency_fingerprint: String.t() | nil,
  dropped: map(),
  duration_us: non_neg_integer(),
  effective_limits: map(),
  effects: [Insider.Protocol.Effect.t()],
  error: Insider.Protocol.Error.t() | nil,
  logger_events: [term()],
  operation: String.t(),
  policy_fingerprint: String.t() | nil,
  protocol: String.t(),
  redactions: [term()],
  request_id: String.t(),
  requested_limits: map(),
  runtime_fingerprint: String.t() | nil,
  schema: String.t(),
  status: status(),
  stderr: [term()],
  stdout: [term()],
  target: map(),
  target_fingerprint: String.t() | nil,
  trace_events: [term()],
  truncated: %{reason: atom(), dropped: non_neg_integer()} | nil,
  uncertainty: [String.t()],
  value: term(),
  warnings: [String.t()]
}

Functions

new(request, status, options \\ [])

@spec new(Insider.Protocol.Request.t(), status(), keyword()) :: t()

truncate(result, reason, dropped)

@spec truncate(t(), atom(), non_neg_integer()) :: t()