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

Executes declarative per-step actions for stepwise workflows.

A step action is expected to live under the current state's definition:

    states: %{
      step_1: %{action: %{type: :capability, handle: "cap.handle"}},
      ...
    }

## Action types

- `:capability` — executed via `Mobus.Stepwise.Capabilities` (delegates to
  the configured `:capability_runner_adapter`).
- `:conversation` — delegated to a host-provided conversation handler
  module configured via `:mobus_stepwise, :conversation_handler`. The
  handler must implement `handle_conversation/5` with signature
  `(event, runtime, trigger, payload, action_config) :: event`.

## Conversation completion

When a conversation action's trigger is NOT `:enter` or `:chat_message`,
the event payload is merged transparently into `runtime.context`. The
conversation handler is responsible for constructing whatever payload
shape its consumer's workflows expect — no hardcoded field names.

# `call`

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

Executes the declarative action defined for the current step, if any.

This is an ALF pipeline stage. Looks up the current state's `:action` definition
in `spec.states`, and if a `:capability` action is defined whose trigger matches
the current event, executes it via `Mobus.Stepwise.Capabilities`. On success,
merges context updates and artifacts into the runtime. On failure, sets error
status and populates `blocked_reasons`.

Skipped when the event has an error status or the event payload is not a map.

## Parameters

  * `event` — pipeline event map with `:spec`, `:runtime`, `:event`, `:payload`
  * `opts` — ALF stage options (unused)

## Returns

  * Updated event map, potentially with modified runtime context, artifacts,
    trace entries, or error status.

---

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