mirror of
https://github.com/R0m1k3/EveFlow.git
synced 2026-10-24 15:48:13 +02:00
feat!: rebuild EveFlow as a JARVIS-style voice HUD for Hermes Agent (v2.0.0)
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
This commit is contained in:
239 files changed
+11351
-86495
No files matched your search
@@ -0,0 +1,73 @@
|
||||
export interface SseMessage {
|
||||
event: string;
|
||||
data: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Incremental Server-Sent Events parser (spec-compliant subset: event/data/id/comments,
|
||||
* multi-line data joined with "\n", CRLF tolerant). Feed arbitrary text chunks.
|
||||
*/
|
||||
export class SseParser {
|
||||
private buffer = '';
|
||||
private event = '';
|
||||
private data: string[] = [];
|
||||
private id: string | undefined;
|
||||
|
||||
constructor(private readonly onMessage: (message: SseMessage) => void) {}
|
||||
|
||||
feed(chunk: string): void {
|
||||
this.buffer += chunk;
|
||||
let index: number;
|
||||
while ((index = this.buffer.search(/\r\n|\n|\r/)) !== -1) {
|
||||
const line = this.buffer.slice(0, index);
|
||||
const sepLength = this.buffer.startsWith('\r\n', index) ? 2 : 1;
|
||||
this.buffer = this.buffer.slice(index + sepLength);
|
||||
this.processLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
/** Flush any pending message (call when the stream ends). */
|
||||
end(): void {
|
||||
if (this.buffer.length) {
|
||||
const rest = this.buffer;
|
||||
this.buffer = '';
|
||||
this.processLine(rest);
|
||||
}
|
||||
this.dispatch();
|
||||
}
|
||||
|
||||
private processLine(line: string): void {
|
||||
if (line === '') {
|
||||
this.dispatch();
|
||||
return;
|
||||
}
|
||||
if (line.startsWith(':')) return;
|
||||
const colon = line.indexOf(':');
|
||||
const field = colon === -1 ? line : line.slice(0, colon);
|
||||
let value = colon === -1 ? '' : line.slice(colon + 1);
|
||||
if (value.startsWith(' ')) value = value.slice(1);
|
||||
switch (field) {
|
||||
case 'event': this.event = value; break;
|
||||
case 'data': this.data.push(value); break;
|
||||
case 'id': this.id = value; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
private dispatch(): void {
|
||||
if (this.data.length === 0 && !this.event) return;
|
||||
const message: SseMessage = { event: this.event || 'message', data: this.data.join('\n'), id: this.id };
|
||||
this.event = '';
|
||||
this.data = [];
|
||||
this.onMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
export function tryParseJson<T = unknown>(text: string): T | null {
|
||||
try {
|
||||
return JSON.parse(text) as T;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user