# `Codex.GovernedAuthority`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.18.1/lib/codex/governed_authority.ex#L1)

Exact, transient Codex launch materialization for a governed account.

The struct is the provider-family boundary between a credential materializer
and Codex. It deliberately contains the secret-bearing child environment, so
it is redacted from inspection and cannot be JSON encoded. Callers may not
supplement any of its command, account, routing, root, or environment fields.

# `t`

```elixir
@type t() :: %Codex.GovernedAuthority{
  account_namespace: String.t(),
  auth_root: String.t(),
  authority_ref: String.t(),
  base_url: String.t(),
  clear_env?: true,
  command: String.t(),
  config_root: String.t(),
  connector_binding_ref: String.t(),
  connector_instance_ref: String.t(),
  credential_lease_ref: String.t(),
  cwd: String.t(),
  endpoint_ref: String.t(),
  env: %{required(String.t()) =&gt; String.t()},
  expires_at: DateTime.t(),
  fence: non_neg_integer(),
  generation: pos_integer(),
  issued_at: DateTime.t(),
  materialization_ref: String.t(),
  native_auth_assertion_ref: String.t(),
  operation_policy_ref: String.t(),
  operation_ref: String.t(),
  provider_account_ref: String.t(),
  target_ref: String.t()
}
```

# `child_cwd`

```elixir
@spec child_cwd(t()) :: String.t()
```

# `child_env`

```elixir
@spec child_env(t()) :: map()
```

# `command`

```elixir
@spec command(t()) :: String.t()
```

# `fetch`

```elixir
@spec fetch(map() | keyword()) :: {:ok, t() | nil} | {:error, term()}
```

# `governed_child_env`

```elixir
@spec governed_child_env(
  keyword(),
  atom()
) :: {:ok, map()} | {:error, term()}
```

# `new`

```elixir
@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}
```

# `new`

```elixir
@spec new(map() | struct(), map() | struct(), map() | keyword()) ::
  {:ok, t()} | {:error, term()}
```

Builds a Codex launch materialization from the frozen Jido request and secret
material contracts plus provider-specific launch fields.

# `normalize`

```elixir
@spec normalize(term()) :: {:ok, t() | nil} | {:error, term()}
```

# `present?`

```elixir
@spec present?(term()) :: boolean()
```

# `redacted`

```elixir
@spec redacted(t() | nil) :: map() | nil
```

# `reject_config_overrides`

```elixir
@spec reject_config_overrides(t() | nil, list() | nil, atom()) ::
  :ok | {:error, term()}
```

# `reject_option_supplementation`

```elixir
@spec reject_option_supplementation(t() | nil, keyword(), atom()) ::
  :ok | {:error, term()}
```

# `to_cli_core`

```elixir
@spec to_cli_core(t() | nil) ::
  {:ok, CliSubprocessCore.GovernedAuthority.t() | nil} | {:error, term()}
```

Projects a validated Codex materialization into the narrower governed
authority accepted by the shared CLI runtime.

Provider-specific identity, lifecycle, and account fields intentionally do
not cross this boundary. Maps and unrelated structs must first pass through
`new/1`; this function never treats them as CLI runtime authority.

# `validate_clear_env`

```elixir
@spec validate_clear_env(t() | nil, term(), atom()) :: :ok | {:error, term()}
```

# `validate_command_override`

```elixir
@spec validate_command_override(t() | nil, String.t() | nil, atom()) ::
  :ok | {:error, term()}
```

# `validate_current`

```elixir
@spec validate_current(t() | nil) :: :ok | {:error, term()}
```

# `validate_cwd`

```elixir
@spec validate_cwd(t() | nil, term(), atom()) :: :ok | {:error, term()}
```

# `validate_execution_surface`

```elixir
@spec validate_execution_surface(t() | nil, term()) :: :ok | {:error, term()}
```

# `validate_runtime_env`

```elixir
@spec validate_runtime_env(t() | nil, map()) :: :ok | {:error, term()}
```

---

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