yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
agent_session.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_AGENT_AGENT_SESSION_H_
2#define YAZE_APP_EDITOR_AGENT_AGENT_SESSION_H_
3
4#include <functional>
5#include <memory>
6#include <string>
7#include <vector>
8
10
11namespace yaze {
12namespace editor {
13
23 std::string agent_id; // Unique ID (e.g., "agent_1", "agent_2")
24 std::string display_name; // User-visible name (e.g., "Agent 1", "Code Review")
25 AgentUIContext context; // Chat history, config, state (shared between views)
26 bool is_active = false; // Currently selected in sidebar tabs
27 bool has_card_open = false; // Full card visible in docking space
28
29 // Callbacks for this session (set by parent controller)
33};
34
49 public:
50 using SessionCreatedCallback = std::function<void(const std::string& agent_id)>;
51 using SessionClosedCallback = std::function<void(const std::string& agent_id)>;
52 using PanelOpenedCallback = std::function<void(const std::string& agent_id)>;
53 using PanelClosedCallback = std::function<void(const std::string& agent_id)>;
54
57
58 // ============================================================================
59 // Session Lifecycle
60 // ============================================================================
61
67 std::string CreateSession(const std::string& name = "");
68
76 void CloseSession(const std::string& agent_id);
77
83 void RenameSession(const std::string& agent_id, const std::string& new_name);
84
85 // ============================================================================
86 // Active Session Management
87 // ============================================================================
88
94 const AgentSession* GetActiveSession() const;
95
100 void SetActiveSession(const std::string& agent_id);
101
107 AgentSession* GetSession(const std::string& agent_id);
108 const AgentSession* GetSession(const std::string& agent_id) const;
109
110 // ============================================================================
111 // Panel Management (Pop-out Dockable Panels)
112 // ============================================================================
113
120 void OpenPanelForSession(const std::string& agent_id);
121
128 void ClosePanelForSession(const std::string& agent_id);
129
135 bool IsPanelOpenForSession(const std::string& agent_id) const;
136
141 std::vector<std::string> GetOpenPanelSessionIds() const;
142
143 // ============================================================================
144 // Iteration
145 // ============================================================================
146
151 std::vector<AgentSession>& GetAllSessions() { return sessions_; }
152 const std::vector<AgentSession>& GetAllSessions() const { return sessions_; }
153
157 size_t GetSessionCount() const { return sessions_.size(); }
158
162 bool HasSessions() const { return !sessions_.empty(); }
163
164 // ============================================================================
165 // Callbacks
166 // ============================================================================
167
175 on_card_opened_ = std::move(cb);
176 }
178 on_card_closed_ = std::move(cb);
179 }
180
181 private:
182 std::vector<AgentSession> sessions_;
184 int next_session_number_ = 1; // For auto-generating names
185
186 // Callbacks
191
195 std::string GenerateAgentId();
196
201 int FindSessionIndex(const std::string& agent_id) const;
202};
203
204} // namespace editor
205} // namespace yaze
206
207#endif // YAZE_APP_EDITOR_AGENT_AGENT_SESSION_H_
Manages multiple agent sessions with dual-view support.
AgentSession * GetActiveSession()
Get the currently active session (shown in sidebar)
std::function< void(const std::string &agent_id)> PanelOpenedCallback
std::vector< std::string > GetOpenPanelSessionIds() const
Get list of session IDs with open cards.
void SetActiveSession(const std::string &agent_id)
Set the active session by ID.
void CloseSession(const std::string &agent_id)
Close and remove a session.
std::function< void(const std::string &agent_id)> PanelClosedCallback
std::vector< AgentSession > sessions_
bool IsPanelOpenForSession(const std::string &agent_id) const
Check if a session has an open card.
SessionCreatedCallback on_session_created_
PanelClosedCallback on_card_closed_
const std::vector< AgentSession > & GetAllSessions() const
std::string CreateSession(const std::string &name="")
Create a new agent session.
void RenameSession(const std::string &agent_id, const std::string &new_name)
Rename a session.
void SetSessionClosedCallback(SessionClosedCallback cb)
bool HasSessions() const
Check if any sessions exist.
void SetPanelClosedCallback(PanelClosedCallback cb)
std::vector< AgentSession > & GetAllSessions()
Get all sessions (for iteration)
std::function< void(const std::string &agent_id)> SessionClosedCallback
int FindSessionIndex(const std::string &agent_id) const
Find session index by ID.
void SetSessionCreatedCallback(SessionCreatedCallback cb)
SessionClosedCallback on_session_closed_
std::string GenerateAgentId()
Generate a unique agent ID.
void OpenPanelForSession(const std::string &agent_id)
Open a full dockable card for a session.
AgentSession * GetSession(const std::string &agent_id)
Get a session by ID.
void ClosePanelForSession(const std::string &agent_id)
Close the dockable card for a session.
PanelOpenedCallback on_card_opened_
size_t GetSessionCount() const
Get total number of sessions.
std::function< void(const std::string &agent_id)> SessionCreatedCallback
void SetPanelOpenedCallback(PanelOpenedCallback cb)
Unified context for agent UI components.
Represents a single agent session with its own chat history and config.
CollaborationCallbacks collaboration_callbacks
ProposalCallbacks proposal_callbacks
Callbacks for chat operations.
Callbacks for collaboration operations.
Callbacks for proposal operations.