/* * DWN - Desktop Window Manager * retoor * AI Integration (OpenRouter API) */ #ifndef DWN_AI_H #define DWN_AI_H #include "dwn.h" #include /* AI request states */ typedef enum { AI_STATE_IDLE, AI_STATE_PENDING, AI_STATE_COMPLETED, AI_STATE_ERROR } AIState; /* AI request structure */ typedef struct AIRequest { char *prompt; char *response; AIState state; void (*callback)(struct AIRequest *req); void *user_data; struct AIRequest *next; } AIRequest; /* AI context for window analysis */ typedef struct { char focused_window[256]; char focused_class[64]; char workspace_windows[1024]; int window_count; } AIContext; /* Initialization */ bool ai_init(void); void ai_cleanup(void); bool ai_is_available(void); /* API calls */ AIRequest *ai_send_request(const char *prompt, void (*callback)(AIRequest *)); void ai_cancel_request(AIRequest *req); void ai_process_pending(void); /* Context analysis */ void ai_update_context(void); const char *ai_analyze_task(void); const char *ai_suggest_window(void); const char *ai_suggest_app(void); /* Command palette */ void ai_show_command_palette(void); void ai_execute_command(const char *command); /* Smart features */ void ai_auto_organize_workspace(void); void ai_suggest_layout(void); void ai_analyze_workflow(void); /* Notification intelligence */ bool ai_should_show_notification(const char *app, const char *summary); int ai_notification_priority(const char *app, const char *summary); /* Performance monitoring */ void ai_monitor_performance(void); const char *ai_performance_suggestion(void); /* Exa semantic search */ typedef struct { char title[256]; char url[512]; char snippet[1024]; float score; } ExaSearchResult; typedef struct ExaRequest { char *query; ExaSearchResult results[10]; int result_count; int state; /* Uses AIState enum */ void (*callback)(struct ExaRequest *req); void *user_data; struct ExaRequest *next; } ExaRequest; bool exa_is_available(void); ExaRequest *exa_search(const char *query, void (*callback)(ExaRequest *)); void exa_process_pending(void); void exa_show_app_launcher(void); #endif /* DWN_AI_H */