yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
agent_collaboration_coordinator.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_AGENT_AGENT_COLLABORATION_COORDINATOR_H_
2#define YAZE_APP_EDITOR_AGENT_AGENT_COLLABORATION_COORDINATOR_H_
3
4#include <filesystem>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "absl/status/statusor.h"
10
11namespace yaze {
12namespace editor {
13
14// Coordinates lightweight collaboration features for the agent chat widget.
15// This implementation uses the local filesystem as a shared backing store so
16// multiple editor instances on the same machine can experiment with
17// collaborative sessions while a full backend service is under development.
19 public:
20 struct SessionInfo {
21 std::string session_id;
22 std::string session_name;
23 std::vector<std::string> participants;
24 };
25
27
28 absl::StatusOr<SessionInfo> HostSession(const std::string& session_name);
29 absl::StatusOr<SessionInfo> JoinSession(const std::string& session_code);
30 absl::Status LeaveSession();
31 absl::StatusOr<SessionInfo> RefreshSession();
32
33 bool active() const { return active_; }
34 const std::string& session_id() const { return session_id_; }
35 const std::string& session_name() const { return session_name_; }
36
37 private:
39 std::string session_name;
40 std::string session_code;
41 std::string host;
42 std::vector<std::string> participants;
43 };
44
45 absl::Status EnsureDirectory() const;
46 std::string LocalUserName() const;
47 std::string NormalizeSessionCode(const std::string& input) const;
48 std::string GenerateSessionCode() const;
49 std::filesystem::path SessionsDirectory() const;
50 std::filesystem::path SessionFilePath(const std::string& code) const;
51 absl::StatusOr<SessionFileData> LoadSessionFile(
52 const std::filesystem::path& path) const;
53 absl::Status WriteSessionFile(const std::filesystem::path& path,
54 const SessionFileData& data) const;
55
56 bool active_ = false;
57 bool hosting_ = false;
58 std::string session_id_;
59 std::string session_name_;
60 std::string local_user_;
61};
62
63} // namespace editor
64} // namespace yaze
65
66#endif // YAZE_APP_EDITOR_AGENT_AGENT_COLLABORATION_COORDINATOR_H_
absl::StatusOr< SessionInfo > JoinSession(const std::string &session_code)
absl::StatusOr< SessionFileData > LoadSessionFile(const std::filesystem::path &path) const
std::string NormalizeSessionCode(const std::string &input) const
absl::Status WriteSessionFile(const std::filesystem::path &path, const SessionFileData &data) const
absl::StatusOr< SessionInfo > HostSession(const std::string &session_name)
std::filesystem::path SessionFilePath(const std::string &code) const
Main namespace for the application.