// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include #include #include #include #include namespace zen { /// RAII wrapper that combines host resolution, HTTP client creation, and session lifecycle. /// On construction, resolves the host, creates an HttpClient, and announces a session. /// On destruction, removes the session (best-effort). class ZenServiceClient { public: struct Options { std::string HostSpec; // Raw host spec (empty = auto-resolve) std::string CommandName; // e.g. "info", "gc" — used as session Mode HttpClientSettings HttpSettings; // Forwarded to HttpClient }; explicit ZenServiceClient(Options Opts); ~ZenServiceClient(); ZenServiceClient(const ZenServiceClient&) = delete; ZenServiceClient& operator=(const ZenServiceClient&) = delete; HttpClient& Http() { return m_Http; } const std::string& HostSpec() const { return m_HostSpec; } /// True if the resolved host spec targets a Unix domain socket /// (i.e. `unix:///...`). Useful for command paths that don't make /// sense over a unix transport (browser launches, WebSocket dialing /// without UnixSocketPath plumbing, etc.). bool IsUnixSocket() const; private: std::string m_HostSpec; HttpClient m_Http; std::unique_ptr m_Sessions; logging::SinkPtr m_LogSink; }; } // namespace zen