mirror of
https://github.com/R0m1k3/EveFlow.git
synced 2026-10-11 17:29:03 +02:00
Complete rewrite of the application: - Toolchain: Electron 44, Vite 8, React 19, TypeScript 5.9, Zustand, Vitest; main process rewritten in TypeScript (electron/), typed IPC contract (shared/), sandboxed renderer with webSecurity on and an HTTP/SSE proxy in the main process. - Voice: AudioWorklet microphone capture at 16 kHz with adaptive energy VAD and auto-stop, WAV encoder, OpenAI-compatible STT, TTS queue with sentence-level streaming, prefetch and Web Audio playback feeding an analyser; hands-free mode, global push-to-talk hotkey, system-voice fallback. - Hermes: full API client (capabilities, health, models, skills, toolsets, sessions, jobs) with automatic transport selection: runs API (SSE lifecycle, approvals, steer, stop) > sessions stream > chat completions with local tools; tolerant event normalisation; webhook receiver hardened (secret, size limit). - UI: JARVIS arc-reactor core on Canvas 2D reacting to the real audio signal, holographic HUD layout (transcript, core, Hermes ops panel with tools/crons/ skills/sessions/link tabs, telemetry), settings drawer, approval modals, compact floating widget, four themes, tray icon and global shortcuts. - Removed the 3D Eve robot, three.js and legacy assets; migrated 1.x settings. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Wn5VX9HNbJ7N54hR24u9Y
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { app, ipcMain } from 'electron';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { IPC } from '../../shared/ipc';
|
|
|
|
type StoreData = Record<string, unknown>;
|
|
|
|
let cache: StoreData | null = null;
|
|
|
|
function storePath(): string {
|
|
return path.join(app.getPath('userData'), 'userdata.json');
|
|
}
|
|
|
|
function load(): StoreData {
|
|
if (cache) return cache;
|
|
try {
|
|
cache = JSON.parse(fs.readFileSync(storePath(), 'utf8')) as StoreData;
|
|
} catch {
|
|
cache = {};
|
|
}
|
|
return cache;
|
|
}
|
|
|
|
function persist(): void {
|
|
const target = storePath();
|
|
const tmp = target + '.tmp';
|
|
fs.writeFileSync(tmp, JSON.stringify(cache ?? {}, null, 2), 'utf8');
|
|
fs.renameSync(tmp, target);
|
|
}
|
|
|
|
export function storeGet<T = unknown>(key: string): T | null {
|
|
const data = load();
|
|
return (data[key] as T) ?? null;
|
|
}
|
|
|
|
export function storeSet(key: string, value: unknown): void {
|
|
const data = load();
|
|
data[key] = value;
|
|
persist();
|
|
}
|
|
|
|
export function registerStoreIpc(): void {
|
|
ipcMain.handle(IPC.storeGet, (_e, key: string) => storeGet(key));
|
|
ipcMain.handle(IPC.storeSet, (_e, key: string, value: unknown) => {
|
|
storeSet(key, value);
|
|
return true;
|
|
});
|
|
ipcMain.handle(IPC.storeDelete, (_e, key: string) => {
|
|
const data = load();
|
|
delete data[key];
|
|
persist();
|
|
return true;
|
|
});
|
|
}
|