Manages multiple agent sessions with dual-view support. More...
#include <agent_session.h>
Public Types | |
| using | SessionCreatedCallback = std::function<void(const std::string& agent_id)> |
| using | SessionClosedCallback = std::function<void(const std::string& agent_id)> |
| using | PanelOpenedCallback = std::function<void(const std::string& agent_id)> |
| using | PanelClosedCallback = std::function<void(const std::string& agent_id)> |
Public Member Functions | |
| AgentSessionManager () | |
| ~AgentSessionManager ()=default | |
| std::string | CreateSession (const std::string &name="") |
| Create a new agent session. | |
| void | CloseSession (const std::string &agent_id) |
| Close and remove a session. | |
| void | RenameSession (const std::string &agent_id, const std::string &new_name) |
| Rename a session. | |
| AgentSession * | GetActiveSession () |
| Get the currently active session (shown in sidebar) | |
| const AgentSession * | GetActiveSession () const |
| void | SetActiveSession (const std::string &agent_id) |
| Set the active session by ID. | |
| AgentSession * | GetSession (const std::string &agent_id) |
| Get a session by ID. | |
| const AgentSession * | GetSession (const std::string &agent_id) const |
| void | OpenPanelForSession (const std::string &agent_id) |
| Open a full dockable card for a session. | |
| void | ClosePanelForSession (const std::string &agent_id) |
| Close the dockable card for a session. | |
| bool | IsPanelOpenForSession (const std::string &agent_id) const |
| Check if a session has an open card. | |
| std::vector< std::string > | GetOpenPanelSessionIds () const |
| Get list of session IDs with open cards. | |
| std::vector< AgentSession > & | GetAllSessions () |
| Get all sessions (for iteration) | |
| const std::vector< AgentSession > & | GetAllSessions () const |
| size_t | GetSessionCount () const |
| Get total number of sessions. | |
| bool | HasSessions () const |
| Check if any sessions exist. | |
| void | SetSessionCreatedCallback (SessionCreatedCallback cb) |
| void | SetSessionClosedCallback (SessionClosedCallback cb) |
| void | SetPanelOpenedCallback (PanelOpenedCallback cb) |
| void | SetPanelClosedCallback (PanelClosedCallback cb) |
Private Member Functions | |
| std::string | GenerateAgentId () |
| Generate a unique agent ID. | |
| int | FindSessionIndex (const std::string &agent_id) const |
| Find session index by ID. | |
Private Attributes | |
| std::vector< AgentSession > | sessions_ |
| std::string | active_session_id_ |
| int | next_session_number_ = 1 |
| SessionCreatedCallback | on_session_created_ |
| SessionClosedCallback | on_session_closed_ |
| PanelOpenedCallback | on_card_opened_ |
| PanelClosedCallback | on_card_closed_ |
Manages multiple agent sessions with dual-view support.
Provides lifecycle management for agent sessions, supporting:
The sidebar shows all sessions as tabs, with the active session's chat displayed in the compact view. Each session can also have a full dockable card open simultaneously.
Definition at line 48 of file agent_session.h.
| using yaze::editor::AgentSessionManager::SessionCreatedCallback = std::function<void(const std::string& agent_id)> |
Definition at line 50 of file agent_session.h.
| using yaze::editor::AgentSessionManager::SessionClosedCallback = std::function<void(const std::string& agent_id)> |
Definition at line 51 of file agent_session.h.
| using yaze::editor::AgentSessionManager::PanelOpenedCallback = std::function<void(const std::string& agent_id)> |
Definition at line 52 of file agent_session.h.
| using yaze::editor::AgentSessionManager::PanelClosedCallback = std::function<void(const std::string& agent_id)> |
Definition at line 53 of file agent_session.h.
| yaze::editor::AgentSessionManager::AgentSessionManager | ( | ) |
Definition at line 11 of file agent_session.cc.
References CreateSession().

|
default |
| std::string yaze::editor::AgentSessionManager::CreateSession | ( | const std::string & | name = "" | ) |
Create a new agent session.
| name | Optional display name (auto-generated if empty) |
Definition at line 16 of file agent_session.cc.
References active_session_id_, yaze::editor::AgentSession::agent_id, yaze::editor::AgentSession::display_name, GenerateAgentId(), yaze::editor::AgentSession::is_active, LOG_INFO, next_session_number_, on_session_created_, and sessions_.
Referenced by AgentSessionManager().

| void yaze::editor::AgentSessionManager::CloseSession | ( | const std::string & | agent_id | ) |
Close and remove a session.
| agent_id | The session to close |
If the session has an open card, it will be closed first. If this was the active session, another session will be activated.
Definition at line 42 of file agent_session.cc.
References active_session_id_, ClosePanelForSession(), FindSessionIndex(), LOG_INFO, LOG_WARN, on_session_closed_, and sessions_.

| void yaze::editor::AgentSessionManager::RenameSession | ( | const std::string & | agent_id, |
| const std::string & | new_name ) |
Rename a session.
| agent_id | The session to rename |
| new_name | The new display name |
Definition at line 77 of file agent_session.cc.
References yaze::editor::AgentSession::display_name, GetSession(), and LOG_INFO.

| AgentSession * yaze::editor::AgentSessionManager::GetActiveSession | ( | ) |
Get the currently active session (shown in sidebar)
Definition at line 87 of file agent_session.cc.
References active_session_id_, and GetSession().

| const AgentSession * yaze::editor::AgentSessionManager::GetActiveSession | ( | ) | const |
Definition at line 94 of file agent_session.cc.
References active_session_id_, and GetSession().

| void yaze::editor::AgentSessionManager::SetActiveSession | ( | const std::string & | agent_id | ) |
Set the active session by ID.
| agent_id | The session to activate |
Definition at line 101 of file agent_session.cc.
References active_session_id_, GetSession(), and LOG_DEBUG.

| AgentSession * yaze::editor::AgentSessionManager::GetSession | ( | const std::string & | agent_id | ) |
Get a session by ID.
| agent_id | The session ID |
Definition at line 116 of file agent_session.cc.
References sessions_.
Referenced by ClosePanelForSession(), GetActiveSession(), GetActiveSession(), IsPanelOpenForSession(), OpenPanelForSession(), RenameSession(), and SetActiveSession().
| const AgentSession * yaze::editor::AgentSessionManager::GetSession | ( | const std::string & | agent_id | ) | const |
Definition at line 125 of file agent_session.cc.
References sessions_.
| void yaze::editor::AgentSessionManager::OpenPanelForSession | ( | const std::string & | agent_id | ) |
Open a full dockable card for a session.
| agent_id | The session to pop out |
The card shares state with the sidebar view.
Definition at line 135 of file agent_session.cc.
References yaze::editor::AgentSession::display_name, GetSession(), yaze::editor::AgentSession::has_card_open, LOG_DEBUG, LOG_INFO, LOG_WARN, and on_card_opened_.

| void yaze::editor::AgentSessionManager::ClosePanelForSession | ( | const std::string & | agent_id | ) |
Close the dockable card for a session.
| agent_id | The session whose card to close |
The session remains in the sidebar; only the card is closed.
Definition at line 159 of file agent_session.cc.
References GetSession(), yaze::editor::AgentSession::has_card_open, LOG_INFO, and on_card_closed_.
Referenced by CloseSession().

| bool yaze::editor::AgentSessionManager::IsPanelOpenForSession | ( | const std::string & | agent_id | ) | const |
Check if a session has an open card.
| agent_id | The session to check |
Definition at line 178 of file agent_session.cc.
References GetSession(), and yaze::editor::AgentSession::has_card_open.

| std::vector< std::string > yaze::editor::AgentSessionManager::GetOpenPanelSessionIds | ( | ) | const |
Get list of session IDs with open cards.
Definition at line 184 of file agent_session.cc.
References sessions_.
|
inline |
Get all sessions (for iteration)
Definition at line 151 of file agent_session.h.
References sessions_.
|
inline |
Definition at line 152 of file agent_session.h.
References sessions_.
|
inline |
|
inline |
|
inline |
Definition at line 168 of file agent_session.h.
References on_session_created_.
|
inline |
Definition at line 171 of file agent_session.h.
References on_session_closed_.
|
inline |
Definition at line 174 of file agent_session.h.
References on_card_opened_.
|
inline |
Definition at line 177 of file agent_session.h.
References on_card_closed_.
|
private |
Generate a unique agent ID.
Definition at line 194 of file agent_session.cc.
Referenced by CreateSession().
|
private |
Find session index by ID.
Definition at line 199 of file agent_session.cc.
References sessions_.
Referenced by CloseSession().
|
private |
Definition at line 182 of file agent_session.h.
Referenced by CloseSession(), CreateSession(), FindSessionIndex(), GetAllSessions(), GetAllSessions(), GetOpenPanelSessionIds(), GetSession(), GetSession(), GetSessionCount(), and HasSessions().
|
private |
Definition at line 183 of file agent_session.h.
Referenced by CloseSession(), CreateSession(), GetActiveSession(), GetActiveSession(), and SetActiveSession().
|
private |
Definition at line 184 of file agent_session.h.
Referenced by CreateSession().
|
private |
Definition at line 187 of file agent_session.h.
Referenced by CreateSession(), and SetSessionCreatedCallback().
|
private |
Definition at line 188 of file agent_session.h.
Referenced by CloseSession(), and SetSessionClosedCallback().
|
private |
Definition at line 189 of file agent_session.h.
Referenced by OpenPanelForSession(), and SetPanelOpenedCallback().
|
private |
Definition at line 190 of file agent_session.h.
Referenced by ClosePanelForSession(), and SetPanelClosedCallback().