# `PtcRunner.Upstream.Result`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/upstream/result.ex#L1)

Transport-neutral upstream call result helpers.

# `json`

```elixir
@type json() ::
  nil
  | boolean()
  | number()
  | binary()
  | [json()]
  | %{optional(binary()) =&gt; json()}
```

# `reason`

```elixir
@type reason() ::
  :upstream_unavailable
  | :upstream_error
  | :tool_error
  | :auth_failed
  | :rate_limited
  | :timeout
  | :response_too_large
  | :cap_exhausted
  | :run_context_closed
```

# `t`

```elixir
@type t() :: {:ok, json()} | {:error, reason(), String.t()}
```

# `compact_result_entries`

```elixir
@spec compact_result_entries([map()]) :: [map()]
```

Projects raw upstream-call entries to compact result summaries.

# `decorate_payload`

```elixir
@spec decorate_payload(map(), [map()]) :: map()
```

Decorates a structured payload with upstream call diagnostics.

# `error`

```elixir
@spec error(atom(), String.t()) :: map()
```

Builds the PTC-Lisp-visible tagged recoverable failure shape.

# `result_overview`

```elixir
@spec result_overview(term(), atom()) :: map()
```

Builds a compact, LLM-facing overview of an upstream result value.

# `success`

```elixir
@spec success(term()) :: map()
```

Builds the PTC-Lisp-visible tagged success shape.

# `value_kind`

```elixir
@spec value_kind(term()) :: :json | :text | :none
```

---

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