strawberry/app/daemon_client.hpp
trvon 76ec40e4f5
Replace web UI with a Qt tray app
Remove the browser UI, its Python server and the web API contract test.
Add the Qt6 tray app (status, findings, process search, policy
controls, notifications) and EvidenceStore, the read-only view of the
daemon's evidence that the app and MCP server share. The GUI demo
config becomes strawberry.demo.conf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:17:03 -06:00

49 lines
1.3 KiB
C++

#ifndef STRAWBERRY_APP_DAEMON_CLIENT_HPP
#define STRAWBERRY_APP_DAEMON_CLIENT_HPP
#include "tray_state.hpp"
#include <QJsonObject>
#include <QObject>
#include <QString>
class QLocalSocket;
namespace strawberry::app {
/**
* @brief Asynchronous client for the daemon's control socket.
*
* One verb per connection, matching the daemon protocol. Never blocks the UI.
*/
class DaemonClient : public QObject {
Q_OBJECT
public:
explicit DaemonClient(QString socket_path, QObject* parent = nullptr);
const QString& socket_path() const { return socket_path_; }
/// Send an argument-free verb (`status`, `policy`, `reload-rules`,
/// `rescan`, `update-rules`).
void send(const QString& verb);
/// Send a payload verb (`allowlist-add`, `feed-add`, ...) with its JSON.
void send_with_payload(const QString& verb, const QJsonObject& payload);
/// Turn a `status` reply's data object into a snapshot.
static DaemonSnapshot snapshot_from_status(const QJsonObject& data);
signals:
/// ok=false means transport failure or `{"ok":false}`; `error` explains.
void replied(const QString& verb, bool ok, const QJsonObject& data, const QString& error);
private:
void send_raw(const QString& verb, const QByteArray& request);
QString socket_path_;
};
} // namespace strawberry::app
#endif // STRAWBERRY_APP_DAEMON_CLIENT_HPP