# `SnakeBridge.SessionManager`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.16.0/lib/snakebridge/session_manager.ex#L1)

Manages Python session lifecycle with process monitoring.

Sessions are automatically released when all owner processes die,
preventing memory leaks in long-running applications.

Cleanup logs are opt-in via config. Use
`config :snakebridge, session_cleanup_log_level: :debug` to enable.

# `ref`

```elixir
@type ref() :: map()
```

# `session_id`

```elixir
@type session_id() :: String.t()
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `list_refs`

```elixir
@spec list_refs(session_id()) :: [ref()]
```

Lists all refs in a session.

# `register_ref`

```elixir
@spec register_ref(session_id(), ref()) :: :ok | {:error, :session_not_found}
```

Registers a ref with its session for tracking.

# `register_session`

```elixir
@spec register_session(session_id(), pid()) :: :ok
```

Registers a session owner process.
The session will be released when the last owner dies.

# `release_session`

```elixir
@spec release_session(session_id()) :: :ok
```

Explicitly releases a session and all its refs.

# `session_exists?`

```elixir
@spec session_exists?(session_id()) :: boolean()
```

Checks if a session exists.

# `start_link`

# `unregister_session`

```elixir
@spec unregister_session(session_id()) :: :ok
```

Unregisters a session without releasing refs on the Python side.

Typically called when manually cleaning up before process death,
or when the caller has already released the session.

---

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