# `SquidMesh`
[🔗](https://github.com/ccarvalho-eng/squid_mesh/blob/main/lib/squid_mesh.ex#L1)

Public entrypoint for the Squid Mesh runtime.

The API exposed here stays focused on declarative workflow operations. Host
applications start, inspect, and later control runs through this surface
without needing to work directly with persistence internals.

# `approve_run`

```elixir
@spec approve_run(Ecto.UUID.t(), map(), keyword()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.transition_error()
     | term()}
```

Approves a paused approval step and resumes the run through its success path.

# `cancel_run`

```elixir
@spec cancel_run(
  Ecto.UUID.t(),
  keyword()
) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.transition_error()}
```

Requests cancellation for an eligible workflow run.

# `config`

```elixir
@spec config(keyword()) ::
  {:ok, SquidMesh.Config.t()} | {:error, {:missing_config, [atom()]}}
```

Loads Squid Mesh configuration from the application environment with optional
runtime overrides.

# `config!`

```elixir
@spec config!(keyword()) :: SquidMesh.Config.t()
```

Loads Squid Mesh configuration and raises if required keys are missing.

# `inspect_run`

```elixir
@spec inspect_run(
  Ecto.UUID.t(),
  keyword()
) ::
  {:ok, SquidMesh.Run.t()} | {:error, :not_found | {:missing_config, [atom()]}}
```

Fetches one workflow run by id.

# `list_runs`

```elixir
@spec list_runs(
  SquidMesh.RunStore.list_filters(),
  keyword()
) :: {:ok, [SquidMesh.Run.t()]} | {:error, {:missing_config, [atom()]}}
```

Lists workflow runs with optional filters.

# `reject_run`

```elixir
@spec reject_run(Ecto.UUID.t(), map(), keyword()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.transition_error()
     | term()}
```

Rejects a paused approval step and resumes the run through its rejection path.

# `replay_run`

```elixir
@spec replay_run(
  Ecto.UUID.t(),
  keyword()
) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.replay_error()}
  | {:error, {:dispatch_failed, term()}}
```

Creates a new run from a prior run and links it to the original run.

# `start_run`

```elixir
@spec start_run(module(), map()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error, {:missing_config, [atom()]}}
  | {:error, SquidMesh.RunStore.create_error()}
  | {:error, {:dispatch_failed, term()}}
```

Starts a new workflow run with the given payload through the workflow's
default trigger.

# `start_run`

```elixir
@spec start_run(module(), map(), keyword()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error, {:missing_config, [atom()]}}
  | {:error, SquidMesh.RunStore.create_error()}
  | {:error, {:dispatch_failed, term()}}
@spec start_run(module(), atom(), map()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error, {:missing_config, [atom()]}}
  | {:error, SquidMesh.RunStore.create_error()}
  | {:error, {:dispatch_failed, term()}}
```

Starts a new workflow run through a named trigger with the given payload.

# `start_run`

```elixir
@spec start_run(module(), atom(), map(), keyword()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error, {:missing_config, [atom()]}}
  | {:error, SquidMesh.RunStore.create_error()}
  | {:error, {:dispatch_failed, term()}}
```

# `unblock_run`

```elixir
@spec unblock_run(Ecto.UUID.t()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.transition_error()
     | term()}
```

Resumes a run that is intentionally paused for manual intervention.

# `unblock_run`

```elixir
@spec unblock_run(
  Ecto.UUID.t(),
  keyword()
) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.transition_error()
     | term()}
@spec unblock_run(Ecto.UUID.t(), map()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.transition_error()
     | term()}
```

# `unblock_run`

```elixir
@spec unblock_run(Ecto.UUID.t(), map(), keyword()) ::
  {:ok, SquidMesh.Run.t()}
  | {:error,
     :not_found
     | {:missing_config, [atom()]}
     | SquidMesh.RunStore.transition_error()
     | term()}
```

---

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