# `ASM.Extensions.Persistence`
[🔗](https://github.com/nshkrdotcom/agent_session_manager/blob/v0.9.2/lib/asm/extensions/persistence.ex#L1)

Public persistence extension API.

This domain adds optional persistence paths and async integration hooks without
coupling core runtime modules to extension internals.

# `store_kind`

```elixir
@type store_kind() :: :memory | :file
```

Known persistence store implementations shipped by this extension.

# `store_ref`

```elixir
@type store_ref() :: pid()
```

Store process reference implementing the `ASM.Store` callbacks.

# `append_event`

```elixir
@spec append_event(store_ref(), ASM.Event.t()) :: :ok | {:error, ASM.Error.t()}
```

# `flush_writer`

```elixir
@spec flush_writer(pid(), timeout()) :: :ok | {:error, ASM.Error.t()}
```

# `list_events`

```elixir
@spec list_events(store_ref(), String.t()) ::
  {:ok, [ASM.Event.t()]} | {:error, ASM.Error.t()}
```

# `rebuild_run`

```elixir
@spec rebuild_run(store_ref(), String.t(), String.t()) ::
  {:ok,
   %{state: ASM.Run.State.t(), result: ASM.Result.t(), events: [ASM.Event.t()]}}
  | {:error, ASM.Error.t()}
```

# `replay_session`

```elixir
@spec replay_session(store_ref(), String.t(), term(), (term(), ASM.Event.t() -&gt;
                                                   term())) ::
  {:ok, term()} | {:error, ASM.Error.t()}
```

# `reset_session`

```elixir
@spec reset_session(store_ref(), String.t()) :: :ok | {:error, ASM.Error.t()}
```

# `start_store`

```elixir
@spec start_store(
  store_kind(),
  keyword()
) :: GenServer.on_start() | {:error, ASM.Error.t()}
```

# `start_writer`

```elixir
@spec start_writer(keyword()) :: GenServer.on_start()
```

# `writer_plug`

```elixir
@spec writer_plug(
  pid(),
  keyword()
) :: {module(), keyword()}
```

---

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