Files
EveFlow/shared/ipc.ts
T
LogiFlowandClaude 6fc38d335b feat: serveur MCP, heures calmes, mode mission, widget glanceable, barge-in (v2.4.0) (#14)
Serveur MCP local
- Endpoint /mcp (JSON-RPC 2.0, Streamable HTTP, réponses JSON) sur le serveur
  webhook : initialize, tools/list, tools/call, ping. Même secret que le
  webhook. 14 outils : capture_screen (image MCP), lock_session, open_app,
  open_url, media_key, clipboard_get/set, find_files, speak_text,
  notify_user, set_hud_state, get_app_status, get_conversation_history,
  show_message. Les outils UI transitent par IPC vers le renderer.
- Les mêmes actions système sont proposées au modèle en chat completions.

Notifications
- Heures calmes (plage horaire, franchissement de minuit), mots prioritaires,
  échecs de crons toujours lus, résumé vocal des messages entrants (n premières
  phrases), thème nuit automatique, compteur de non-lus.

Conversation
- Mode mission : bouton dans la barre de commande, second modèle Hermes
  (hermes.missionModel) pour les tâches longues.
- Barge-in : la parole de l'utilisateur coupe la voix ; seuil d'énergie et
  ratio relevés pendant la synthèse pour ignorer l'écho.

Widget compact
- Bandeau glanceable : état, dernière phrase, non-lus, indicateurs heures
  calmes et mission.

Tests : 28 tests unitaires (heures calmes, priorité, résumé), e2e Electron
sous Xvfb : MCP initialize/tools/list/tools/call (presse-papiers, capture en
image, état et message via le renderer), bandeau compact, aucune erreur.


Claude-Session: https://claude.ai/code/session_017Wn5VX9HNbJ7N54hR24u9Y

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-04 00:47:34 +02:00

143 lines
3.4 KiB
TypeScript

/**
* Shared IPC contract between the Electron main process and the renderer.
* Imported by both tsconfig projects; must stay free of Node/DOM-specific types.
*/
export type WindowMode = 'hud' | 'compact';
export interface HttpProxyFile {
name: string;
type: string;
data: Uint8Array;
}
export interface HttpProxyRequest {
url: string;
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
headers?: Record<string, string>;
/** JSON/text body. Ignored when `multipart` is provided. */
body?: string;
/** Multipart form upload (used for speech-to-text). */
multipart?: { fields: Record<string, string>; file: HttpProxyFile; fileField?: string };
responseType?: 'text' | 'binary';
timeoutMs?: number;
}
export interface HttpProxyResponse {
ok: boolean;
status: number;
statusText: string;
headers: Record<string, string>;
/** Present when responseType is 'text' (default). */
text?: string;
/** Present when responseType is 'binary'. */
binary?: Uint8Array;
}
export interface HttpStreamStart {
id: string;
ok: boolean;
status: number;
statusText: string;
headers: Record<string, string>;
}
export type HttpStreamEvent =
| { id: string; type: 'chunk'; text: string }
| { id: string; type: 'end' }
| { id: string; type: 'error'; message: string };
export interface SystemMetrics {
hostname: string;
platform: string;
cpuModel: string;
cpuCores: number;
cpuLoad: number; // 0-100
cpuFreqMhz: number;
memUsedPct: number; // 0-100
memTotalGb: number;
uptimeSec: number;
}
export interface HermesPushEvent {
type: 'message' | 'job' | 'raw';
role: 'user' | 'assistant' | 'system';
text: string;
source: string;
images?: string[];
jobName?: string;
status?: string;
receivedAt: string;
raw?: unknown;
}
export interface LogEntry {
ts: string;
level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
tag: string;
message: string;
data?: unknown;
}
export interface WebhookStatus {
listening: boolean;
port: number;
path: string;
secretConfigured: boolean;
error?: string;
}
export interface AppInfo {
version: string;
platform: string;
isPackaged: boolean;
userDataPath: string;
sharedDir: string;
logPath: string;
}
export const IPC = {
windowControl: 'window:control',
windowSetMode: 'window:set-mode',
windowModeChanged: 'window:mode-changed',
windowVisibility: 'window:visibility',
log: 'log:write',
storeGet: 'store:get',
storeSet: 'store:set',
storeDelete: 'store:delete',
httpFetch: 'http:fetch',
httpStreamStart: 'http:stream:start',
httpStreamAbort: 'http:stream:abort',
httpStreamEvent: 'http:stream:event',
metrics: 'system:metrics',
appInfo: 'app:info',
screenCapture: 'system:screen-capture',
systemAction: 'system:action',
mcpRequest: 'mcp:request',
mcpResponse: 'mcp:response',
readLocalFile: 'files:read-local',
writeSharedFile: 'files:write-shared',
openPath: 'files:open-path',
showInFolder: 'files:show-in-folder',
hermesPush: 'hermes:push',
webhookStatus: 'webhook:status',
webhookRestart: 'webhook:restart',
hotkey: 'hotkey:event'
} as const;
export type HotkeyEvent = 'ptt-toggle' | 'toggle-window' | 'stop-speaking';
/** A tool call arriving from Hermes through the local MCP endpoint that needs the renderer (UI, voice, chat). */
export interface McpToolRequest {
id: string;
name: string;
args: Record<string, unknown>;
}
export interface McpToolResponse {
id: string;
ok: boolean;
result?: unknown;
error?: string;
}