Compare commits

..
Author SHA1 Message Date
Claude 5e79a98206 chore: version 2.5.4 (la 2.5.3 est prise par master)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMpgFriwxiBgurUVb21oCE
2026-09-05 09:24:19 +00:00
Claude 27985c0740 Merge remote-tracking branch 'origin/master' into claude/french-voice-system-16jr85 2026-09-05 09:23:30 +00:00
LogiFlow e57340b124 Merge pull request #25 from R0m1k3/main
fix: use configurable assistant name in all Hermes conversations (2.5.3)
2026-09-05 10:48:22 +02:00
Claude e6437f4bb2 feat: effort de raisonnement Hermes complet sur les trois transports (v2.5.3)
- Huit niveaux (none, minimal, low, medium, high, xhigh, max, ultra) au lieu de
  low / medium / high, avec libellés explicatifs dans Paramètres → Hermes.
- model_options.reasoning_effort envoyé sur runs, sessions et chat completions ;
  il ne l'était qu'en chat completions.
- Test des trois transports (effort présent, absent quand laissé au serveur).
- Le sélecteur de modèle par fournisseur ayant été livré sur master en 2.5.2,
  cette branche ne garde que l'effort de raisonnement.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMpgFriwxiBgurUVb21oCE
2026-09-05 08:20:48 +00:00
Michael 992693c9cf fix: use configurable assistant name in all Hermes conversations (2.5.3) 2026-09-05 09:39:06 +02:00
LogiFlow 5991410685 Merge pull request #23 from R0m1k3/main
Main
2026-09-05 09:18:23 +02:00
Michael 9f95f79943 ci: publish Windows releases from main 2026-09-05 09:18:06 +02:00
Michael c9b44433ac fix: discover actual Hermes provider models and route selections (2.5.2) 2026-09-05 09:06:36 +02:00
14 changed files with 195 additions and 39 deletions

No files matched your search

+1 -1
View File
@@ -67,7 +67,7 @@ jobs:
out/latest.yml
if-no-files-found: error
- name: Publish GitHub release
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.ver.outputs.released == 'false')
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && steps.ver.outputs.released == 'false')
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.ver.outputs.version }}
+2 -1
View File
@@ -1,7 +1,7 @@
# EveFlow 2 — Interface vocale JARVIS pour Hermes Agent
[![Build](https://img.shields.io/github/actions/workflow/status/R0m1k3/EveFlow/windows-release.yml?style=flat-square)](https://github.com/R0m1k3/EveFlow/actions)
[![Version](https://img.shields.io/badge/version-2.5.0-brightgreen.svg?style=flat-square)](https://github.com/R0m1k3/EveFlow/releases)
[![Version](https://img.shields.io/badge/version-2.5.4-brightgreen.svg?style=flat-square)](https://github.com/R0m1k3/EveFlow/releases)
[![License](https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat-square)](LICENSE)
**EveFlow** est un compagnon de bureau Windows qui transforme [Hermes Agent](https://hermes-agent.nousresearch.com/) en assistant vocal à la JARVIS : un noyau holographique réactif au son, une conversation en streaming, les outils, sous-agents, approbations, crons, skills et sessions d'Hermes pilotés depuis un seul HUD.
@@ -46,6 +46,7 @@ La version 2 est une réécriture complète : plus de robot 3D, un pipeline voca
1. **Runs API** (`POST /v1/runs` + `GET /v1/runs/{id}/events`) : deltas, outils, sous-agents, `approval.request`, `run.completed`, arrêt (`/stop`) et injection de consignes en cours de run (`/steer`).
2. **Sessions API** (`/api/sessions/{id}/chat/stream`) : mémoire côté serveur, fork, suppression, relecture de l'historique.
3. **Chat completions** OpenAI (`/v1/chat/completions`) avec `hermes.tool.progress`, continuité de session (`X-Hermes-Session-Id`) et outils EveFlow côté client (état du HUD, fichiers partagés, notifications).
* **Effort de raisonnement** : les huit niveaux d'Hermes (none, minimal, low, medium, high, xhigh, max, ultra) au choix dans Paramètres → Hermes, envoyés dans `model_options.reasoning_effort` sur les trois transports (runs, sessions, chat completions).
* Mémoire longue durée via `X-Hermes-Session-Key`.
* **Approbations** d'outils affichées dans le HUD : une fois, pour la session, toujours, refuser.
* **Crons** : création en langage naturel (`every 1h`, `weekdays at 9am`, `in 30m`, expression cron), pause/reprise, exécution immédiate, édition, historique des résultats lus à voix haute.
+1
View File
@@ -84,6 +84,7 @@ Sources : [jarvis-desktop-ai](https://github.com/ccarloshenri/jarvis-desktop-ai)
| Correctifs 2.4.0.1 | réponse vide en chat completions désormais expliquée (JSON non streamé ou erreur HTTP 200), la liaison ne passe plus en « dégradé » quand seule l'API des crons échoue, transcriptions parasites (« (cliquant) », « *Claire* ») ignorées, préférence de voix masculine/féminine |
| Parakeet v3 vs Whisper base sur trois phrases Piper (fr) (2.4.1) | Parakeet : 3/3 exactes avec ponctuation, 0,4 à 0,5 s à chaud (6,7 s au premier appel) ; Whisper base : erreurs sur « Jarvis », « Peux-tu », 0,7 à 0,9 s |
| Worklets audio sous CSP stricte (2.4.1) | chargement des modules statiques OK dans l'application empaquetée |
| Effort de raisonnement Hermes (2.5.4) | huit niveaux (none → ultra) dans les réglages, transmis dans `model_options.reasoning_effort` sur runs, sessions et chat completions (auparavant chat completions seulement, trois niveaux) ; test des trois transports |
| Voix françaises (2.5.0) | Edge Henri : MP3 reçu de bout en bout (32 ko pour 4 s). Supertonic 3 en français : 10 voix, RTF 0,14 sur 4 cœurs (8,7 s d'audio en 1,3 s), genres déterminés par mesure de la fréquence fondamentale (voix 0-4 : 170-210 Hz, voix 5-9 : 92-137 Hz) ; le worker compilé accepte `language` et bascule sur l'anglais pour une langue inconnue |
| Reconnaissance française : Parakeet v3 vs Qwen3-ASR 0.6B int8 (2.5.0) | Six phrases Supertonic (3,8 s) : Parakeet WER 8,5 % (erreurs surtout de forme : « 14h30 »), 384 ms par phrase ; Qwen3-ASR WER 15,3 % (« mémoires vivres »), 1 477 ms, 940 Mo. Qwen3-ASR n'est pas ajouté au catalogue |
| Serveur MCP (2.4.0) | initialize, tools/list (14 outils), tools/call côté principal (presse-papiers, capture image) et côté renderer (état, message dans le fil) |
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "eveflow",
"version": "2.5.1",
"version": "2.5.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "eveflow",
"version": "2.5.1",
"version": "2.5.3",
"license": "MIT",
"dependencies": {
"@fontsource/orbitron": "^5.3.0",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "eveflow",
"version": "2.5.1",
"releaseVersion": "2.5.1",
"version": "2.5.4",
"releaseVersion": "2.5.4",
"description": "JARVIS-style desktop HUD for Hermes Agent: voice, streaming runs, scheduled jobs, skills and telemetry",
"main": "dist-electron/main.js",
"private": true,
+1 -1
View File
@@ -15,7 +15,7 @@ export function ModelSelect({ label, value, models, defaultLabel, onChange }: {
<select id={id} className="select" value={value} onChange={(e) => onChange(e.target.value)}>
<option value="">{defaultLabel}</option>
{value && !models.some((m) => m.id === value) && <option value={value}>{value} (configuré)</option>}
{models.map((m) => <option key={m.id} value={m.id}>{m.id}{m.provider || m.owned_by ? ` · ${m.provider || m.owned_by}` : ''}</option>)}
{models.map((m) => <option key={m.id} value={m.id} disabled={m.available === false}>{m.name || m.id}{m.provider || m.owned_by ? ` · ${m.provider || m.owned_by}` : ''}{m.available === false ? ' (indisponible)' : ''}</option>)}
</select>
<button type="button" className="btn small" aria-expanded={manual} onClick={() => setManual(!manual)}>
{manual ? 'Masquer la saisie manuelle' : 'Saisir un autre identifiant'}
+10 -9
View File
@@ -16,6 +16,7 @@ import { useVoice } from '../../state/voice';
import { installedModels, useVoiceModels } from '../../state/voiceModels';
import { ModelsSection } from './ModelsSection';
import { ModelSelect } from './ModelSelect';
import { REASONING_EFFORTS, isReasoningEffort } from '../../lib/hermesReasoning';
type Section = 'general' | 'hermes' | 'voice' | 'speech' | 'models' | 'webhook' | 'notifications' | 'ui';
@@ -81,6 +82,7 @@ export function SettingsDrawer({ onClose }: Props) {
const hermesModels = useHermes((s) => s.models);
const modelsLoading = useHermes((s) => s.modelsLoading);
const modelsError = useHermes((s) => s.modelsError);
const modelsNotice = useHermes((s) => s.modelsNotice);
const refreshHermesModels = useHermes((s) => s.refreshModels);
const hermesWebhook = useHermes((s) => s.webhook);
const hermesConnect = useHermes((s) => s.connect);
@@ -224,12 +226,12 @@ export function SettingsDrawer({ onClose }: Props) {
</div>
</div>
<div className="field">
<button className="btn small" disabled={modelsLoading} onClick={() => void refreshHermesModels()}>
<button className="btn small" disabled={modelsLoading} onClick={() => void refreshHermesModels(true)}>
{modelsLoading ? <Loader2 size={13} className="spin" /> : <RotateCcw size={13} />}
{modelsLoading ? 'Chargement des modèles…' : 'Actualiser les modèles'}
</button>
<span className="hint" role="status">{modelsLoading ? 'Interrogation du serveur Hermes…' : modelsError || (hermesModels.length ? `${hermesModels.length} modèle(s) disponible(s).` : 'Aucun modèle annoncé par le serveur.')}</span>
<span className="hint">Cette liste contient les modèles exposés par votre serveur Hermes. Si seul « hermes-agent » apparaît, les autres modèles doivent être configurés et exposés côté serveur.</span>
<span className={modelsNotice ? 'test-result fail' : 'hint'}>{modelsNotice || 'Modèles des fournisseurs configurés dans Hermes. Les modèles sans accès sont indiqués comme indisponibles.'}</span>
</div>
<div className="grid-2">
<div className="field">
@@ -243,12 +245,10 @@ export function SettingsDrawer({ onClose }: Props) {
</div>
<div className="field">
<label>Effort de raisonnement</label>
<select className="select" value={settings.hermes.reasoningEffort} onChange={(e) => update({ hermes: { reasoningEffort: e.target.value as typeof settings.hermes.reasoningEffort } })}>
<option value="">Défaut</option>
<option value="low">Low</option>
<option value="medium">Medium</option>
<option value="high">High</option>
<select className="select" value={settings.hermes.reasoningEffort} onChange={(e) => { if (isReasoningEffort(e.target.value)) update({ hermes: { reasoningEffort: e.target.value } }); }}>
{REASONING_EFFORTS.map((e) => <option key={e.value} value={e.value}>{e.label}</option>)}
</select>
<span className="hint">Envoyé à chaque requête (runs, sessions, chat completions) dans model_options.reasoning_effort. Plus c’est haut, plus la réponse est réfléchie et lente.</span>
</div>
</div>
<div className="field">
@@ -637,8 +637,9 @@ mcp_servers:
<div className="card">
<div className="grid-2">
<div className="field">
<label>Nom de l’assistant</label>
<input className="input" value={settings.assistantName} onChange={(e) => update({ assistantName: e.target.value.toUpperCase().slice(0, 18) || 'JARVIS' })} />
<label htmlFor="assistant-name">Nom de l’assistant</label>
<input id="assistant-name" className="input" value={settings.assistantName} maxLength={60} placeholder="Jarvis, Nova, Alfred…" onChange={(e) => update({ assistantName: e.target.value })} onBlur={() => update({ assistantName: settings.assistantName.trim() || DEFAULT_SETTINGS.assistantName })} />
<span className="hint">Choisissez le nom que vous voulez. Il est sauvegardé automatiquement et utilisé par l’assistant dès votre prochain message, y compris dans la conversation en cours.</span>
</div>
<div className="field">
<label>Votre nom</label>
+18
View File
@@ -0,0 +1,18 @@
/** Reasoning effort levels accepted by Hermes (`agent.reasoning_effort` / `model_options.reasoning_effort`). */
import type { HermesReasoningEffort } from '../services/hermes/types';
export const REASONING_EFFORTS: Array<{ value: HermesReasoningEffort; label: string }> = [
{ value: '', label: 'Défaut du serveur (medium)' },
{ value: 'none', label: 'none : pas de réflexion' },
{ value: 'minimal', label: 'minimal' },
{ value: 'low', label: 'low : rapide' },
{ value: 'medium', label: 'medium : équilibré' },
{ value: 'high', label: 'high : réponses plus fouillées' },
{ value: 'xhigh', label: 'xhigh' },
{ value: 'max', label: 'max' },
{ value: 'ultra', label: 'ultra : le plus lent' }
];
export function isReasoningEffort(value: string): value is HermesReasoningEffort {
return REASONING_EFFORTS.some((e) => e.value === value);
}
+43 -7
View File
@@ -31,6 +31,13 @@ const isRec = (v: unknown): v is Rec => !!v && typeof v === 'object' && !Array.i
export type ResolvedTransport = Exclude<HermesTransport, 'auto'>;
/** Stored picker IDs include the provider so identical model names remain distinct. */
export function modelSelection(value: string): { model?: string; provider?: string } {
const id = value.trim();
const separator = id.indexOf('::');
return separator > 0 ? { provider: id.slice(0, separator), model: id.slice(separator + 2) } : id ? { model: id } : {};
}
/**
* A web page (login portal, dashboard, reverse-proxy error) instead of JSON means the URL does not
* point at the Hermes API. Returns a human explanation, or null when the body is not HTML.
@@ -153,6 +160,11 @@ export class HermesClient {
return hermesBaseUrl(this.config.url);
}
/** `model_options.reasoning_effort`, accepted by runs, session chat and chat completions alike. */
private reasoningOptions(): Rec {
return this.config.reasoningEffort ? { model_options: { reasoning_effort: this.config.reasoningEffort } } : {};
}
private headers(extra: Record<string, string> = {}, json = true): Record<string, string> {
const h: Record<string, string> = { ...extra };
if (json) h['Content-Type'] = 'application/json';
@@ -217,6 +229,29 @@ export class HermesClient {
return [...models.values()];
}
async modelCatalog(refresh = false): Promise<{ models: HermesModel[]; notice: string | null }> {
let payload: unknown;
try {
payload = await this.request<unknown>(`/api/model/options${refresh ? '?refresh=true' : ''}`, { timeoutMs: 30_000 });
} catch (err) {
if (!(err instanceof HttpError) || ![404, 405].includes(err.status)) throw err;
return { models: await this.models(), notice: 'Ce serveur ne propose pas le catalogue IA (/api/model/options). Mettez Hermes à jour pour choisir le fournisseur et son modèle. La liste ci-dessous contient uniquement les alias de connexion.' };
}
if (!isRec(payload) || !Array.isArray(payload.providers)) throw new Error('Catalogue IA Hermes invalide : liste des fournisseurs absente.');
const models = new Map<string, HermesModel>();
for (const row of payload.providers) {
if (!isRec(row) || typeof row.slug !== 'string' || !row.slug.trim() || !Array.isArray(row.models)) continue;
const unavailable = Array.isArray(row.unavailable_models) ? row.unavailable_models : [];
for (const model of row.models) {
if (typeof model !== 'string' || !model.trim()) continue;
const id = `${row.slug}::${model}`;
models.set(id, { id, name: model, provider: typeof row.name === 'string' ? row.name : row.slug,
available: row.authenticated !== false && !unavailable.includes(model) });
}
}
return { models: [...models.values()], notice: null };
}
async skills(): Promise<HermesSkill[]> {
const payload = await this.request<unknown>('/v1/skills');
return extractArray<HermesSkill>(payload, ['skills', 'data', 'items']);
@@ -304,11 +339,12 @@ export class HermesClient {
// ── Runs ──────────────────────────────────────────────────────────────────
async startRun(body: { input: string; session_id?: string; instructions?: string; model?: string }): Promise<{ run_id: string; status: string }> {
const payload: Rec = { input: body.input };
async startRun(body: { input: string; session_id?: string; instructions?: string; model?: string; provider?: string }): Promise<{ run_id: string; status: string }> {
const payload: Rec = { input: body.input, ...this.reasoningOptions() };
if (body.session_id) payload.session_id = body.session_id;
if (body.instructions) payload.instructions = body.instructions;
if (body.model) payload.model = body.model;
if (body.provider) payload.provider = body.provider;
return this.request<{ run_id: string; status: string }>('/v1/runs', { method: 'POST', body: payload, timeoutMs: 30_000 });
}
@@ -402,7 +438,7 @@ export class HermesClient {
input: options.text,
session_id: plainSession(options.sessionId) || undefined,
instructions: this.config.instructions || undefined,
model: this.config.model || undefined
...modelSelection(this.config.model)
});
const runId = run.run_id;
if (isAborted()) {
@@ -464,9 +500,9 @@ export class HermesClient {
}
if (isAborted()) return '';
const realId = sessionId.slice(3);
const body: Rec = { input: options.text };
const body: Rec = { input: options.text, ...this.reasoningOptions() };
if (this.config.instructions) body.instructions = this.config.instructions;
if (this.config.model) body.model = this.config.model;
Object.assign(body, modelSelection(this.config.model));
let streamed = '';
let finalText = '';
@@ -503,12 +539,12 @@ export class HermesClient {
let fullText = '';
let toolsAllowed = useTools;
for (let iteration = 0; iteration < 6 && !aborted(); iteration++) {
const payload: Rec = { model: this.config.model || 'hermes-agent', messages, stream: true };
const payload: Rec = { model: 'hermes-agent', ...modelSelection(this.config.model), messages, stream: true };
if (toolsAllowed) {
payload.tools = options.localToolDefinitions;
payload.tool_choice = 'auto';
}
if (this.config.reasoningEffort) payload.model_options = { reasoning_effort: this.config.reasoningEffort };
Object.assign(payload, this.reasoningOptions());
const toolCalls = new Map<number, CompletionToolCallAccumulator>();
let finishReason: string | null = null;
+6 -1
View File
@@ -1,5 +1,8 @@
export type HermesTransport = 'auto' | 'runs' | 'sessions' | 'completions';
/** Thinking depth accepted by Hermes (`model_options.reasoning_effort`); empty = server default (medium). */
export type HermesReasoningEffort = '' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'ultra';
export interface HermesConfig {
url: string;
apiKey: string;
@@ -7,7 +10,7 @@ export interface HermesConfig {
/** Stable per-user key for long-term memory (X-Hermes-Session-Key). */
sessionKey: string;
transport: HermesTransport;
reasoningEffort: '' | 'low' | 'medium' | 'high';
reasoningEffort: HermesReasoningEffort;
/** Extra instructions layered on top of the Hermes system prompt. */
instructions: string;
/** Model used in "mission" mode (long tasks); empty = same as `model`. */
@@ -35,6 +38,8 @@ export interface HermesHealth {
export interface HermesModel {
id: string;
name?: string;
available?: boolean;
owned_by?: string;
provider?: string;
[key: string]: unknown;
+13 -9
View File
@@ -35,7 +35,8 @@ interface HermesStore {
models: HermesModel[];
modelsLoading: boolean;
modelsError: string | null;
refreshModels: () => Promise<void>;
modelsNotice: string | null;
refreshModels: (refresh?: boolean) => Promise<void>;
skills: HermesSkill[];
toolsets: HermesToolset[];
sessions: HermesSession[];
@@ -93,6 +94,7 @@ export const useHermes = create<HermesStore>((set, get) => ({
models: [],
modelsLoading: false,
modelsError: null,
modelsNotice: null,
skills: [],
toolsets: [],
sessions: [],
@@ -106,10 +108,12 @@ export const useHermes = create<HermesStore>((set, get) => ({
busy: false,
client: (modelOverride) => {
const config = useSettings.getState().settings.hermes;
// Without an explicit model, use the alias advertised by /v1/models (Hermes rejects unknown names).
const model = (modelOverride ?? '').trim() || config.model.trim() || get().models[0]?.id || '';
return new HermesClient({ ...config, model });
const settings = useSettings.getState().settings;
const config = settings.hermes;
const model = (modelOverride ?? '').trim() || config.model.trim();
const name = settings.assistantName.trim() || 'JARVIS';
const identity = `Identité de l'assistant dans cette conversation : ton nom est ${JSON.stringify(name)}. Utilise ce nom pour te présenter et parler de toi. EveFlow est le nom de l'application, pas ton nom. Cette identité remplace les anciens noms ou personas présents dans l'historique, la mémoire ou les instructions précédentes. Ne rappelle pas ton nom dans chaque réponse.`;
return new HermesClient({ ...config, model, instructions: [config.instructions.trim(), identity].filter(Boolean).join('\n\n') });
},
connect: () => {
@@ -166,17 +170,17 @@ export const useHermes = create<HermesStore>((set, get) => ({
return connectInflight;
},
refreshModels: async () => {
refreshModels: async (refresh = false) => {
const request = ++modelsRequest;
const config = useSettings.getState().settings.hermes;
const current = () => {
const now = useSettings.getState().settings.hermes;
return request === modelsRequest && now.url === config.url && now.apiKey === config.apiKey && now.sessionKey === config.sessionKey;
};
set({ models: [], modelsLoading: true, modelsError: null });
set({ models: [], modelsLoading: true, modelsError: null, modelsNotice: null });
try {
const models = await new HermesClient(config).models();
if (current()) set({ models });
const { models, notice } = await new HermesClient(config).modelCatalog(refresh);
if (current()) set({ models, modelsNotice: notice });
} catch (err) {
if (current()) set({ modelsError: (err as Error).message });
} finally {
+1 -1
View File
@@ -89,7 +89,7 @@ export const DEFAULT_SETTINGS: Settings = {
transport: 'auto',
reasoningEffort: '',
instructions:
"Tu es l'interface vocale EveFlow (style JARVIS). Réponds en français, de façon concise et orale quand la question est simple; utilise le Markdown uniquement pour le contenu structuré (code, listes, tableaux). Les images doivent être des URL http(s) ou des fichiers du dossier partagé.",
"Réponds en français, de façon concise et orale quand la question est simple; utilise le Markdown uniquement pour le contenu structuré (code, listes, tableaux). Les images doivent être des URL http(s) ou des fichiers du dossier partagé.",
localTools: true,
missionModel: ''
},
+53 -5
View File
@@ -1,13 +1,13 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import { HermesClient } from '../src/services/hermes/client';
import { httpFetch } from '../src/lib/transport';
import { httpFetch, httpStream } from '../src/lib/transport';
import { DEFAULT_SETTINGS, useSettings } from '../src/state/settings';
import { useHermes } from '../src/state/hermes';
import { createElement, act } from 'react';
import { createRoot } from 'react-dom/client';
import { ModelSelect } from '../src/components/settings/ModelSelect';
vi.mock('../src/lib/transport', async (original) => ({ ...await original<typeof import('../src/lib/transport')>(), httpFetch: vi.fn() }));
vi.mock('../src/lib/transport', async (original) => ({ ...await original<typeof import('../src/lib/transport')>(), httpFetch: vi.fn(), httpStream: vi.fn() }));
const config = { ...DEFAULT_SETTINGS.hermes, url: 'https://example.test/v1/', apiKey: ' test-key ' };
function respond(payload: unknown, status = 200) {
vi.mocked(httpFetch).mockResolvedValue({ ok: status === 200, status, statusText: '', headers: {}, text: JSON.stringify(payload) });
@@ -15,6 +15,54 @@ function respond(payload: unknown, status = 200) {
afterEach(() => { vi.restoreAllMocks(); useSettings.setState({ settings: DEFAULT_SETTINGS }); });
describe('Hermes models', () => {
it.each(['runs', 'sessions', 'completions'] as const)('sends the configured assistant identity over %s, including after a rename', async (transport) => {
const requests: Record<string, unknown>[] = [];
const capture = async (req: { body?: string }) => { requests.push(JSON.parse(req.body!)); throw new Error('stop'); };
vi.mocked(httpFetch).mockImplementation(capture);
vi.mocked(httpStream).mockImplementation(capture);
for (const name of ['Jarvis', 'Nova']) {
useSettings.setState({ settings: { ...DEFAULT_SETTINGS, assistantName: name, hermes: { ...config, instructions: 'Tu es Eve. Réponds en français.' } } });
const send = useHermes.getState().client().send({ text: 'Qui es-tu ?', sessionId: 'hs:test', history: [], onEvent: vi.fn() }, transport);
await expect(send.result).rejects.toThrow('stop');
const body = requests.at(-1)!;
const instructions = transport === 'completions' ? (body.messages as { content: string }[])[0].content : body.instructions as string;
expect(instructions).toContain(`ton nom est "${name}"`);
expect(instructions).toContain('Réponds en français.');
expect(instructions).toContain("EveFlow est le nom de l'application, pas ton nom");
}
expect(useSettings.getState().settings.hermes.instructions).toBe('Tu es Eve. Réponds en français.');
});
it('reads the real provider inventory, keeps providers distinct and marks inaccessible models', async () => {
respond({ providers: [
{ slug: 'first', name: 'First', authenticated: true, models: ['same', 'locked'], unavailable_models: ['locked'] },
{ slug: 'second', name: 'Second', authenticated: false, models: ['same'] }
] });
const result = await new HermesClient(config).modelCatalog(true);
expect(httpFetch).toHaveBeenCalledWith(expect.objectContaining({ url: 'https://example.test/api/model/options?refresh=true' }));
expect(result.models.map(m => [m.id, m.available])).toEqual([['first::same', true], ['first::locked', false], ['second::same', false]]);
expect(result.notice).toBeNull();
});
it('explains old servers instead of presenting the connection alias as an LLM catalog', async () => {
vi.mocked(httpFetch).mockResolvedValueOnce({ ok: false, status: 404, statusText: '', headers: {}, text: '' })
.mockResolvedValueOnce({ ok: true, status: 200, statusText: '', headers: {}, text: JSON.stringify({ data: [{ id: 'hermes-agent' }] }) });
const result = await new HermesClient(config).modelCatalog();
expect(result.models).toEqual([{ id: 'hermes-agent' }]);
expect(result.notice).toContain('Mettez Hermes à jour');
});
it.each(['runs', 'sessions', 'completions'] as const)('sends provider and actual model separately over %s', async (transport) => {
const requests: unknown[] = [];
vi.mocked(httpFetch).mockImplementation(async req => {
requests.push(JSON.parse(req.body as string));
throw new Error('stop');
});
vi.mocked(httpStream).mockImplementation(async req => {
requests.push(JSON.parse(req.body as string));
throw new Error('stop');
});
const send = new HermesClient({ ...config, model: 'custom:local::real-model' }).send({ text: 'Bonjour', sessionId: 'hs:test', history: [], onEvent: vi.fn() }, transport);
await expect(send.result).rejects.toThrow('stop');
expect(requests[0]).toMatchObject({ model: 'real-model', provider: 'custom:local' });
});
it('uses authenticated discovery and preserves provider labels, order and unique valid IDs', async () => {
respond({ data: [{ id: 'b', provider: 'provider-b' }, { id: 'a' }, { id: 'b' }, {}, ' c '] });
expect(await new HermesClient(config).models()).toEqual([{ id: 'b', provider: 'provider-b' }, { id: 'a' }, { id: 'c' }]);
@@ -38,12 +86,12 @@ describe('Hermes models', () => {
});
it('discards results from a previous server or an older refresh', async () => {
useSettings.setState({ settings: { ...DEFAULT_SETTINGS, hermes: config } });
let finish!: (value: { id: string }[]) => void;
vi.spyOn(HermesClient.prototype, 'models').mockImplementationOnce(() => new Promise(resolve => { finish = resolve; })).mockResolvedValue([{ id: 'new' }]);
let finish!: (value: { models: { id: string }[]; notice: null }) => void;
vi.spyOn(HermesClient.prototype, 'modelCatalog').mockImplementationOnce(() => new Promise(resolve => { finish = resolve; })).mockResolvedValue({ models: [{ id: 'new' }], notice: null });
const old = useHermes.getState().refreshModels();
useSettings.setState({ settings: { ...DEFAULT_SETTINGS, hermes: { ...config, url: 'https://new.test' } } });
await useHermes.getState().refreshModels();
finish([{ id: 'old' }]);
finish({ models: [{ id: 'old' }], notice: null });
await old;
expect(useHermes.getState().models).toEqual([{ id: 'new' }]);
});
+42
View File
@@ -0,0 +1,42 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import { HermesClient } from '../src/services/hermes/client';
import { httpFetch, httpStream } from '../src/lib/transport';
import { DEFAULT_SETTINGS } from '../src/state/settings';
import { REASONING_EFFORTS, isReasoningEffort } from '../src/lib/hermesReasoning';
vi.mock('../src/lib/transport', async (original) => ({ ...await original<typeof import('../src/lib/transport')>(), httpFetch: vi.fn(), httpStream: vi.fn() }));
const config = { ...DEFAULT_SETTINGS.hermes, url: 'https://example.test', apiKey: 'k' };
afterEach(() => vi.restoreAllMocks());
describe('reasoning effort levels', () => {
it('lists every level Hermes accepts, server default first', () => {
expect(REASONING_EFFORTS.map((e) => e.value)).toEqual(['', 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra']);
expect(isReasoningEffort('xhigh')).toBe(true);
expect(isReasoningEffort('')).toBe(true);
expect(isReasoningEffort('turbo')).toBe(false);
});
it.each(['runs', 'sessions', 'completions'] as const)('sends model_options.reasoning_effort over %s', async (transport) => {
const requests: Record<string, unknown>[] = [];
const capture = async (req: { body?: string }) => {
requests.push(JSON.parse(req.body ?? '{}') as Record<string, unknown>);
throw new Error('stop');
};
vi.mocked(httpFetch).mockImplementation(capture as never);
vi.mocked(httpStream).mockImplementation(capture as never);
const send = new HermesClient({ ...config, reasoningEffort: 'high' }).send({ text: 'Bonjour', sessionId: 'hs:test', history: [], onEvent: vi.fn() }, transport);
await expect(send.result).rejects.toThrow('stop');
expect(requests[0]).toMatchObject({ model_options: { reasoning_effort: 'high' } });
});
it('omits model_options when the effort is left to the server', async () => {
const requests: Record<string, unknown>[] = [];
vi.mocked(httpFetch).mockImplementation((async (req: { body?: string }) => {
requests.push(JSON.parse(req.body ?? '{}') as Record<string, unknown>);
throw new Error('stop');
}) as never);
const send = new HermesClient({ ...config, reasoningEffort: '' }).send({ text: 'Bonjour', sessionId: 'test', history: [], onEvent: vi.fn() }, 'runs');
await expect(send.result).rejects.toThrow('stop');
expect(requests[0]).not.toHaveProperty('model_options');
});
});