## New Modules - StorageModule: SQLite persistence for sessions, app usage, conversations - MonitoringModule: Cross-platform window tracking (Win32/X11) - AIModule: Multi-provider LLM integration with agentic tool loop - VoiceModule: TTS/STT coordination with speak queue ## Shared Libraries - AissiaLLM: ILLMProvider abstraction (Claude + OpenAI providers) - AissiaPlatform: IWindowTracker abstraction (Win32 + X11) - AissiaAudio: ITTSEngine (SAPI/espeak) + ISTTEngine (Whisper API) - HttpClient: Header-only HTTP client with OpenSSL ## Configuration - Added JSON configs for all modules (storage, monitoring, ai, voice) - Multi-provider LLM config with Claude and OpenAI support ## Dependencies - SQLite3, OpenSSL, cpp-httplib (FetchContent) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
92 lines
2.9 KiB
C++
92 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#include <grove/IModule.h>
|
|
#include <grove/JsonDataNode.h>
|
|
#include "../shared/platform/IWindowTracker.hpp"
|
|
|
|
#include <spdlog/spdlog.h>
|
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
#include <set>
|
|
|
|
namespace aissia {
|
|
|
|
/**
|
|
* @brief Monitoring Module - Tracking des applications actives
|
|
*
|
|
* Fonctionnalites:
|
|
* - Detection de l'application au premier plan
|
|
* - Classification productive/distracting
|
|
* - Detection d'inactivite utilisateur
|
|
* - Statistiques par application
|
|
*
|
|
* Publie sur:
|
|
* - "monitoring:app_changed" : Changement d'application
|
|
* - "monitoring:idle_detected" : Utilisateur inactif
|
|
* - "monitoring:activity_resumed" : Retour d'activite
|
|
* - "monitoring:productivity_update": Mise a jour des stats
|
|
*
|
|
* Souscrit a:
|
|
* - "scheduler:task_started" : Associer tracking a tache
|
|
* - "scheduler:task_completed" : Fin tracking tache
|
|
*/
|
|
class MonitoringModule : public grove::IModule {
|
|
public:
|
|
MonitoringModule();
|
|
~MonitoringModule() override = default;
|
|
|
|
// IModule interface
|
|
void process(const grove::IDataNode& input) override;
|
|
void setConfiguration(const grove::IDataNode& configNode, grove::IIO* io,
|
|
grove::ITaskScheduler* scheduler) override;
|
|
const grove::IDataNode& getConfiguration() override;
|
|
std::unique_ptr<grove::IDataNode> getHealthStatus() override;
|
|
void shutdown() override;
|
|
std::unique_ptr<grove::IDataNode> getState() override;
|
|
void setState(const grove::IDataNode& state) override;
|
|
std::string getType() const override { return "MonitoringModule"; }
|
|
bool isIdle() const override { return true; }
|
|
int getVersion() const override { return 1; }
|
|
|
|
private:
|
|
// Configuration
|
|
int m_pollIntervalMs = 1000;
|
|
int m_idleThresholdSeconds = 300;
|
|
std::set<std::string> m_productiveApps;
|
|
std::set<std::string> m_distractingApps;
|
|
bool m_enabled = true;
|
|
|
|
// State
|
|
std::string m_currentApp;
|
|
std::string m_currentWindowTitle;
|
|
float m_appStartTime = 0.0f;
|
|
bool m_isIdle = false;
|
|
std::map<std::string, int> m_appDurations; // seconds per app
|
|
int m_totalProductiveSeconds = 0;
|
|
int m_totalDistractingSeconds = 0;
|
|
|
|
// Services
|
|
grove::IIO* m_io = nullptr;
|
|
std::unique_ptr<IWindowTracker> m_tracker;
|
|
std::unique_ptr<grove::JsonDataNode> m_config;
|
|
std::shared_ptr<spdlog::logger> m_logger;
|
|
float m_lastPollTime = 0.0f;
|
|
|
|
// Helpers
|
|
void checkCurrentApp(float currentTime);
|
|
void checkIdleState(float currentTime);
|
|
bool isProductiveApp(const std::string& appName) const;
|
|
bool isDistractingApp(const std::string& appName) const;
|
|
void publishAppChanged(const std::string& oldApp, const std::string& newApp, int duration);
|
|
};
|
|
|
|
} // namespace aissia
|
|
|
|
extern "C" {
|
|
grove::IModule* createModule();
|
|
void destroyModule(grove::IModule* module);
|
|
}
|