# `MingaAgent.Session.SubscriberAttachment`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_agent/session/subscriber_attachment.ex#L1)

Canonical identity for one process attached to an agent session.

The role and monitor reference travel with the PID so subscriber membership cannot exist without its OTP monitor identity.

# `role`

```elixir
@type role() :: :driver | :viewer
```

Remote attachment role.

# `t`

```elixir
@type t() :: %MingaAgent.Session.SubscriberAttachment{
  monitor_ref: reference(),
  pid: pid(),
  role: role()
}
```

# `assign_role`

```elixir
@spec assign_role(t(), role()) :: t()
```

Assigns a new role while preserving subscriber and monitor identity.

# `new`

```elixir
@spec new(pid(), role(), reference()) :: t()
```

Builds a monitored subscriber attachment.

---

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