yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::AgentSessionManager Class Reference

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.
 
AgentSessionGetActiveSession ()
 Get the currently active session (shown in sidebar)
 
const AgentSessionGetActiveSession () const
 
void SetActiveSession (const std::string &agent_id)
 Set the active session by ID.
 
AgentSessionGetSession (const std::string &agent_id)
 Get a session by ID.
 
const AgentSessionGetSession (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< AgentSessionsessions_
 
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_
 

Detailed Description

Manages multiple agent sessions with dual-view support.

Provides lifecycle management for agent sessions, supporting:

  • Multiple concurrent agents (tab system in sidebar)
  • Pop-out cards for detailed interaction (dockable in main space)
  • State synchronization between compact and full views

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.

Member Typedef Documentation

◆ SessionCreatedCallback

using yaze::editor::AgentSessionManager::SessionCreatedCallback = std::function<void(const std::string& agent_id)>

Definition at line 50 of file agent_session.h.

◆ SessionClosedCallback

using yaze::editor::AgentSessionManager::SessionClosedCallback = std::function<void(const std::string& agent_id)>

Definition at line 51 of file agent_session.h.

◆ PanelOpenedCallback

using yaze::editor::AgentSessionManager::PanelOpenedCallback = std::function<void(const std::string& agent_id)>

Definition at line 52 of file agent_session.h.

◆ PanelClosedCallback

using yaze::editor::AgentSessionManager::PanelClosedCallback = std::function<void(const std::string& agent_id)>

Definition at line 53 of file agent_session.h.

Constructor & Destructor Documentation

◆ AgentSessionManager()

yaze::editor::AgentSessionManager::AgentSessionManager ( )

Definition at line 11 of file agent_session.cc.

References CreateSession().

Here is the call graph for this function:

◆ ~AgentSessionManager()

yaze::editor::AgentSessionManager::~AgentSessionManager ( )
default

Member Function Documentation

◆ CreateSession()

std::string yaze::editor::AgentSessionManager::CreateSession ( const std::string & name = "")

Create a new agent session.

Parameters
nameOptional display name (auto-generated if empty)
Returns
The new session's agent_id

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().

Here is the call graph for this function:

◆ CloseSession()

void yaze::editor::AgentSessionManager::CloseSession ( const std::string & agent_id)

Close and remove a session.

Parameters
agent_idThe 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_.

Here is the call graph for this function:

◆ RenameSession()

void yaze::editor::AgentSessionManager::RenameSession ( const std::string & agent_id,
const std::string & new_name )

Rename a session.

Parameters
agent_idThe session to rename
new_nameThe new display name

Definition at line 77 of file agent_session.cc.

References yaze::editor::AgentSession::display_name, GetSession(), and LOG_INFO.

Here is the call graph for this function:

◆ GetActiveSession() [1/2]

AgentSession * yaze::editor::AgentSessionManager::GetActiveSession ( )

Get the currently active session (shown in sidebar)

Returns
Pointer to active session, or nullptr if none

Definition at line 87 of file agent_session.cc.

References active_session_id_, and GetSession().

Here is the call graph for this function:

◆ GetActiveSession() [2/2]

const AgentSession * yaze::editor::AgentSessionManager::GetActiveSession ( ) const

Definition at line 94 of file agent_session.cc.

References active_session_id_, and GetSession().

Here is the call graph for this function:

◆ SetActiveSession()

void yaze::editor::AgentSessionManager::SetActiveSession ( const std::string & agent_id)

Set the active session by ID.

Parameters
agent_idThe session to activate

Definition at line 101 of file agent_session.cc.

References active_session_id_, GetSession(), and LOG_DEBUG.

Here is the call graph for this function:

◆ GetSession() [1/2]

AgentSession * yaze::editor::AgentSessionManager::GetSession ( const std::string & agent_id)

Get a session by ID.

Parameters
agent_idThe session ID
Returns
Pointer to session, or nullptr if not found

Definition at line 116 of file agent_session.cc.

References sessions_.

Referenced by ClosePanelForSession(), GetActiveSession(), GetActiveSession(), IsPanelOpenForSession(), OpenPanelForSession(), RenameSession(), and SetActiveSession().

◆ GetSession() [2/2]

const AgentSession * yaze::editor::AgentSessionManager::GetSession ( const std::string & agent_id) const

Definition at line 125 of file agent_session.cc.

References sessions_.

◆ OpenPanelForSession()

void yaze::editor::AgentSessionManager::OpenPanelForSession ( const std::string & agent_id)

Open a full dockable card for a session.

Parameters
agent_idThe 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_.

Here is the call graph for this function:

◆ ClosePanelForSession()

void yaze::editor::AgentSessionManager::ClosePanelForSession ( const std::string & agent_id)

Close the dockable card for a session.

Parameters
agent_idThe 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().

Here is the call graph for this function:

◆ IsPanelOpenForSession()

bool yaze::editor::AgentSessionManager::IsPanelOpenForSession ( const std::string & agent_id) const

Check if a session has an open card.

Parameters
agent_idThe session to check
Returns
true if card is open

Definition at line 178 of file agent_session.cc.

References GetSession(), and yaze::editor::AgentSession::has_card_open.

Here is the call graph for this function:

◆ GetOpenPanelSessionIds()

std::vector< std::string > yaze::editor::AgentSessionManager::GetOpenPanelSessionIds ( ) const

Get list of session IDs with open cards.

Returns
Vector of agent_ids that have cards open

Definition at line 184 of file agent_session.cc.

References sessions_.

◆ GetAllSessions() [1/2]

std::vector< AgentSession > & yaze::editor::AgentSessionManager::GetAllSessions ( )
inline

Get all sessions (for iteration)

Returns
Reference to sessions vector

Definition at line 151 of file agent_session.h.

References sessions_.

◆ GetAllSessions() [2/2]

const std::vector< AgentSession > & yaze::editor::AgentSessionManager::GetAllSessions ( ) const
inline

Definition at line 152 of file agent_session.h.

References sessions_.

◆ GetSessionCount()

size_t yaze::editor::AgentSessionManager::GetSessionCount ( ) const
inline

Get total number of sessions.

Definition at line 157 of file agent_session.h.

References sessions_.

◆ HasSessions()

bool yaze::editor::AgentSessionManager::HasSessions ( ) const
inline

Check if any sessions exist.

Definition at line 162 of file agent_session.h.

References sessions_.

◆ SetSessionCreatedCallback()

void yaze::editor::AgentSessionManager::SetSessionCreatedCallback ( SessionCreatedCallback cb)
inline

Definition at line 168 of file agent_session.h.

References on_session_created_.

◆ SetSessionClosedCallback()

void yaze::editor::AgentSessionManager::SetSessionClosedCallback ( SessionClosedCallback cb)
inline

Definition at line 171 of file agent_session.h.

References on_session_closed_.

◆ SetPanelOpenedCallback()

void yaze::editor::AgentSessionManager::SetPanelOpenedCallback ( PanelOpenedCallback cb)
inline

Definition at line 174 of file agent_session.h.

References on_card_opened_.

◆ SetPanelClosedCallback()

void yaze::editor::AgentSessionManager::SetPanelClosedCallback ( PanelClosedCallback cb)
inline

Definition at line 177 of file agent_session.h.

References on_card_closed_.

◆ GenerateAgentId()

std::string yaze::editor::AgentSessionManager::GenerateAgentId ( )
private

Generate a unique agent ID.

Definition at line 194 of file agent_session.cc.

Referenced by CreateSession().

◆ FindSessionIndex()

int yaze::editor::AgentSessionManager::FindSessionIndex ( const std::string & agent_id) const
private

Find session index by ID.

Returns
Index in sessions_ vector, or -1 if not found

Definition at line 199 of file agent_session.cc.

References sessions_.

Referenced by CloseSession().

Member Data Documentation

◆ sessions_

std::vector<AgentSession> yaze::editor::AgentSessionManager::sessions_
private

◆ active_session_id_

std::string yaze::editor::AgentSessionManager::active_session_id_
private

◆ next_session_number_

int yaze::editor::AgentSessionManager::next_session_number_ = 1
private

Definition at line 184 of file agent_session.h.

Referenced by CreateSession().

◆ on_session_created_

SessionCreatedCallback yaze::editor::AgentSessionManager::on_session_created_
private

Definition at line 187 of file agent_session.h.

Referenced by CreateSession(), and SetSessionCreatedCallback().

◆ on_session_closed_

SessionClosedCallback yaze::editor::AgentSessionManager::on_session_closed_
private

Definition at line 188 of file agent_session.h.

Referenced by CloseSession(), and SetSessionClosedCallback().

◆ on_card_opened_

PanelOpenedCallback yaze::editor::AgentSessionManager::on_card_opened_
private

Definition at line 189 of file agent_session.h.

Referenced by OpenPanelForSession(), and SetPanelOpenedCallback().

◆ on_card_closed_

PanelClosedCallback yaze::editor::AgentSessionManager::on_card_closed_
private

Definition at line 190 of file agent_session.h.

Referenced by ClosePanelForSession(), and SetPanelClosedCallback().


The documentation for this class was generated from the following files: