LemonRouter. AgentDirectory
(lemon_router v0.1.0)
View Source
Discoverable directory for agent sessions and routing endpoints.
This module merges:
- Active sessions from
LemonRouter.Router - Durable session metadata from
LemonCore.Store(:sessions_index)
to provide a "phonebook" for agent/session addressing.
Summary
Functions
Returns the latest route-backed session (kind == :channel_peer) for an agent.
Returns the latest known session for an agent.
List agent directory entries with lightweight session/activity stats.
List known sessions.
List known channel targets for human-friendly routing.
Types
@type session_entry() :: %{ session_key: binary(), agent_id: binary(), kind: :main | :channel_peer | :unknown, channel_id: binary() | nil, account_id: binary() | nil, peer_kind: atom() | nil, peer_id: binary() | nil, thread_id: binary() | nil, peer_label: binary() | nil, peer_username: binary() | nil, topic_name: binary() | nil, chat_type: binary() | nil, sub_id: binary() | nil, created_at_ms: integer() | nil, updated_at_ms: integer() | nil, active?: boolean(), run_id: binary() | nil, run_count: non_neg_integer() | nil, origin: term() }
Functions
@spec latest_route_session( binary(), keyword() ) :: {:ok, session_entry()} | {:error, :not_found}
Returns the latest route-backed session (kind == :channel_peer) for an agent.
@spec latest_session( binary(), keyword() ) :: {:ok, session_entry()} | {:error, :not_found}
Returns the latest known session for an agent.
List agent directory entries with lightweight session/activity stats.
@spec list_sessions(keyword()) :: [session_entry()]
List known sessions.
Options:
:agent_id- optional agent filter:route- optional route filter map (channel_id,account_id,peer_kind,peer_id,thread_id):limit- optional max rows
List known channel targets for human-friendly routing.
This is intended for CLI/UI discovery before creating endpoint aliases.