2025-12-28 03:14:31 +01:00
|
|
|
/*
|
|
|
|
|
* DWN - Desktop Window Manager
|
2025-12-28 04:30:10 +01:00
|
|
|
* retoor <retoor@molodetz.nl>
|
2025-12-28 03:14:31 +01:00
|
|
|
* AI Integration (OpenRouter API)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef DWN_AI_H
|
|
|
|
|
#define DWN_AI_H
|
|
|
|
|
|
|
|
|
|
#include "dwn.h"
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
AI_STATE_IDLE,
|
|
|
|
|
AI_STATE_PENDING,
|
|
|
|
|
AI_STATE_COMPLETED,
|
|
|
|
|
AI_STATE_ERROR
|
|
|
|
|
} AIState;
|
|
|
|
|
|
|
|
|
|
typedef struct AIRequest {
|
|
|
|
|
char *prompt;
|
|
|
|
|
char *response;
|
|
|
|
|
AIState state;
|
|
|
|
|
void (*callback)(struct AIRequest *req);
|
|
|
|
|
void *user_data;
|
|
|
|
|
struct AIRequest *next;
|
|
|
|
|
} AIRequest;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char focused_window[256];
|
|
|
|
|
char focused_class[64];
|
|
|
|
|
char workspace_windows[1024];
|
|
|
|
|
int window_count;
|
|
|
|
|
} AIContext;
|
|
|
|
|
|
|
|
|
|
bool ai_init(void);
|
|
|
|
|
void ai_cleanup(void);
|
|
|
|
|
bool ai_is_available(void);
|
|
|
|
|
|
|
|
|
|
AIRequest *ai_send_request(const char *prompt, void (*callback)(AIRequest *));
|
|
|
|
|
void ai_cancel_request(AIRequest *req);
|
|
|
|
|
void ai_process_pending(void);
|
|
|
|
|
|
|
|
|
|
void ai_update_context(void);
|
|
|
|
|
const char *ai_analyze_task(void);
|
|
|
|
|
const char *ai_suggest_window(void);
|
|
|
|
|
const char *ai_suggest_app(void);
|
|
|
|
|
|
|
|
|
|
void ai_show_command_palette(void);
|
|
|
|
|
void ai_execute_command(const char *command);
|
|
|
|
|
|
|
|
|
|
void ai_auto_organize_workspace(void);
|
|
|
|
|
void ai_suggest_layout(void);
|
|
|
|
|
void ai_analyze_workflow(void);
|
|
|
|
|
|
|
|
|
|
bool ai_should_show_notification(const char *app, const char *summary);
|
|
|
|
|
int ai_notification_priority(const char *app, const char *summary);
|
|
|
|
|
|
|
|
|
|
void ai_monitor_performance(void);
|
|
|
|
|
const char *ai_performance_suggestion(void);
|
|
|
|
|
|
|
|
|
|
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;
|
2025-12-28 05:01:46 +01:00
|
|
|
int state;
|
2025-12-28 03:14:31 +01:00
|
|
|
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);
|
|
|
|
|
|
2025-12-28 05:01:46 +01:00
|
|
|
#endif
|