# `Mobus.Stepwise.Runtime`
[🔗](https://github.com/fosferon/mobus_stepwise/blob/main/lib/mobus/stepwise/runtime.ex#L1)

Stable accessor helpers for stepwise runtime maps.

Provides deterministic inspection and mutation of runtime state
without depending on internal map structure. Orchestrators should
prefer these helpers over direct map access.

## Meta

The `:meta` field is an open map for orchestration metadata
(session IDs, DAG coordinates, tags, etc.). It survives
checkpoint/restore cycles and is passed read-only to capabilities.

    runtime = Runtime.put_meta(runtime, :session_id, "sess-123")
    Runtime.get_meta(runtime, :session_id)
    #=> "sess-123"

# `artifacts`

```elixir
@spec artifacts(map()) :: map()
```

Returns the `:artifacts` map from the runtime.

# `context`

```elixir
@spec context(map()) :: map()
```

Returns the `:context` map from the runtime.

# `current_state`

```elixir
@spec current_state(map()) :: atom() | String.t() | nil
```

Returns the `:current_state`.

# `execution_id`

```elixir
@spec execution_id(map()) :: String.t() | nil
```

Returns the `:execution_id`.

# `get_meta`

```elixir
@spec get_meta(map(), term(), term()) :: term()
```

Gets a single key from `:meta`, with optional default.

# `merge_context`

```elixir
@spec merge_context(map(), map()) :: map()
```

Shallow-merges a map into `:context`.

# `merge_meta`

```elixir
@spec merge_meta(map(), map()) :: map()
```

Shallow-merges a map into `:meta`.

# `meta`

```elixir
@spec meta(map()) :: map()
```

Returns the full `:meta` map from the runtime.

# `overlay_artifacts`

```elixir
@spec overlay_artifacts(map(), term(), term()) :: map()
```

Puts a single key into `:artifacts` (normalized via `Artifacts.merge/2`).

# `overlay_context`

```elixir
@spec overlay_context(map(), term(), term()) :: map()
```

Puts a single key into `:context`.

# `put_meta`

```elixir
@spec put_meta(map(), term(), term()) :: map()
```

Puts a single key into `:meta`.

# `tenant_id`

```elixir
@spec tenant_id(map()) :: String.t() | nil
```

Returns the `:tenant_id`.

---

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