How ekkolearnai/hermes-web-ui works
1. Overall shape
- This is a two-tier monorepo: a Vue 3 SPA frontend in packages/client and a Koa-based BFF/server in packages/server.
- The BFF is the main integration boundary between the browser and the local Hermes Agent ecosystem.
2. Primary runtime flow
- Browser → BFF (:8648) → Hermes Gateway (:8642) is the core request path.
- The frontend never talks directly to Hermes services; it calls the BFF through typed API wrappers under packages/client/src/api.
- The BFF then proxies, rewrites paths, streams SSE responses, and performs local system operations when needed.
3. Frontend application boundary
- The client is organized around a standard SPA stack: main.ts, router, Pinia stores, i18n, theme/styles, and feature views.
- Most Hermes-specific UI is namespaced under packages/client/src/components/hermes, views/hermes, and stores/hermes, which is a clear architectural boundary for agent-related features.
4. Frontend feature domains
- The UI is split into distinct panels/views for Chat, Jobs, Models, Profiles, Skills, Usage, Logs, Memory, Settings, Terminal, and Channels.
- Shared layout controls like profile/model/language selectors sit in components/layout, while reusable chat rendering and message components live under components/hermes/chat.
5. Client data access pattern
- The client uses a typed API layer in packages/client/src/api/client.ts plus feature modules for chat, sessions, logs, profiles, jobs, config, skills, and system.
- Pinia stores in packages/client/src/stores/hermes act as the stateful middle layer between API calls and the views.
- This makes the UI stateful by feature, but the authoritative state lives on the backend and in Hermes files.
6. BFF responsibilities
- The server is not a generic REST backend; it is an orchestration layer that integrates Hermes CLI, Hermes Gateway, local config files, log files, file upload, and terminal sessions.
- It also serves the built frontend assets and exposes the API surface used by the SPA.
7. Local Hermes integration
- Server services under packages/server/src/services wrap Hermes-specific operations:
- hermes.ts and hermes-cli.ts for agent/gateway/CLI interactions
- hermes-profile.ts for profile management
- auth.ts for credential/auth-related logic
- These services are the bridge from web UI actions to the local Hermes installation and user environment.
8. Persistent configuration and state
- The system reads and writes to files under ~/.hermes/, especially:
- config.yaml for channel behavior and gateway configuration
- auth.json for provider credential pools and model discovery
- .env for channel credentials
- The README indicates the BFF may auto-fill missing config, back up modified config, and start/repair the gateway on startup.
9. Platform/channel management
- packages/server/src/routes/hermes contains routes for channel/config/profiles/sessions/logs/filesystem/terminal/proxy/weixin.
- This is where platform integrations such as Telegram, Discord, Slack, WhatsApp, Matrix, Feishu, WeChat, and WeCom are managed.
- WeChat login is special: it involves QR-based browser login and an external Tencent iLink API path.
10. Real-time and interactive channels
- Chat uses SSE streaming for live agent responses and async runs.
- The terminal feature uses node-pty on the server and a WebSocket stream to the browser for PTY input/output and resize events.
- These are the two main bidirectional interactive subsystems in the architecture.
11. Analytics, logs, and operational views
- Usage analytics, logs, and system/status pages are driven by backend data sources rather than client-only computation.
- Logs are read from local files and parsed for structured display; usage metrics are aggregated for charts and cost/token summaries.
- The UI therefore acts as an operational console for Hermes rather than just a chat surface.
12. File and extension handling
- The BFF also exposes upload handling, filesystem access, webhook endpoints, and a proxy layer for Hermes-related external calls.
- This suggests the server is the central policy and access point for all side effects: file IO, credentials, session control, and external service integration.
13. Packaging and entrypoints
- bin/hermes-web-ui.mjs is the CLI entry, with scripts/setup.sh supporting bootstrap/installation.
- The app is designed to be installed and run locally as a desktop-like web dashboard, not deployed as a typical remote SaaS backend.
14. Diagram takeaway
- The key boxes to draw are:
- Browser SPA
- Local BFF server
- Hermes Gateway / Hermes CLI
- Local Hermes config/auth files
- External provider APIs and WeChat/Tencent integration
- The most important arrows are: SPA API calls to BFF, BFF proxy/streaming to Hermes Gateway, and BFF read/write access to local Hermes state and terminal processes.
Main entry points: index.ts Hermes routes · main.ts App shell · ChatView.vue Feature views · proxy.ts Proxy layer
Components 21
Client SPA
Vue 3 frontend and feature state
- App shell · Bootstraps the frontend app, router, i18n, theme, and layout.
packages/client/src/main.ts - Router · Routes the SPA into login and Hermes feature views.
packages/client/src/router/index.ts - API layer · Typed wrappers for browser requests into Hermes feature endpoints.
packages/client/src/api/client.ts - State stores · Feature state for chat, jobs, models, profiles, settings, and usage.
packages/client/src/stores/hermes/chat.ts - Feature views · Main operational screens for chat, jobs, models, profiles, logs, memory, settings, terminal, channels, and usage.
packages/client/src/views/hermes/ChatView.vue - Chat UI · Message list, input, and rendering components for live agent conversations.
packages/client/src/components/hermes/chat/ChatPanel.vue - Layout controls · Sidebar and global selectors for language, profile, and model context.
packages/client/src/components/layout/AppSidebar.vue - i18n/theme · Localization and visual styling for the application shell.
packages/client/src/i18n/index.ts
BFF Server
Koa orchestration layer and integrations
- Server entry · Starts the local BFF server and serves the built frontend.
packages/server/src/index.ts - Hermes routes · Main API surface for config, profiles, sessions, logs, filesystem, terminal, proxy, and Weixin.
packages/server/src/routes/hermes/index.ts - Config & profiles · Reads and updates Hermes configuration and profile state.
packages/server/src/routes/hermes/config.ts - Sessions & terminal · Handles chat/session control and PTY-backed terminal streaming.
packages/server/src/routes/hermes/sessions.ts - Proxy layer · Rewrites and streams requests between the SPA and Hermes Gateway.
packages/server/src/routes/hermes/proxy.ts - File access · Filesystem, logs, upload, and webhook side effects managed by the BFF.
packages/server/src/routes/hermes/filesystem.ts - Hermes services · Service layer for Hermes CLI, gateway, profile, and auth operations.
packages/server/src/services/hermes.ts - Auth service · Credential and provider authentication logic used by channel and model setup.
packages/server/src/services/auth.ts
Local Runtime
Hermes gateway, CLI, files, terminals, and external services
- Gateway · Local Hermes gateway that receives proxied API and streaming calls.
- CLI · Local Hermes command-line integration used for setup and control.
- Hermes files · Configuration and auth state under ~/.hermes such as config.yaml, auth.json, and .env.
- PTY session · Interactive terminal processes streamed to the browser over WebSocket.
- Providers · Provider APIs and channel platforms including Telegram, Discord, Slack, WhatsApp, Matrix, Feishu, WeChat, WeCom, and Tencent iLink.
Connections 21
- App shell → Router: loads · The app shell mounts the router and view hierarchy.
- App shell → Layout controls: uses · Global shell controls are composed into the SPA frame.
- App shell → i18n/theme: configures · Localization and theme are initialized during startup.
- Router → Feature views: navigates · Routes dispatch into Hermes feature screens.
- Feature views → State stores: reads state · Views consume Pinia state for each feature domain.
- State stores → API layer: calls · Stores mediate all feature API access.
- Feature views → Chat UI: renders · Chat views assemble message and input components.
- API layer → Hermes routes: requests · Browser calls are sent to the BFF API surface.
- Server entry → Hermes routes: mounts · The server entry wires the Hermes route tree into the Koa app.
- Hermes routes → Config & profiles: delegates · Config and profile endpoints are handled by dedicated route modules.
- Hermes routes → Sessions & terminal: delegates · Session and terminal interactions are handled by interactive route modules.
- Hermes routes → Proxy layer: streams · Proxy routes forward and rewrite requests to the local gateway.
- Hermes routes → File access: side effects · File, log, upload, and webhook endpoints access local resources.
- Config & profiles → Hermes services: uses · Route handlers rely on Hermes service wrappers.
- Sessions & terminal → PTY session: controls · The terminal route manages PTY-backed browser sessions.
- Proxy layer → Gateway: forwards to · Proxied chat and async traffic reaches the Hermes Gateway.
- Hermes services → CLI: invokes · Hermes services shell out or coordinate with the local CLI.
- Hermes services → Hermes files: reads/writes · Services manage config, auth, and profile state on disk.
- Auth service → Hermes files: reads/writes · Credential pools and model metadata are stored locally.
- Auth service → Providers: authenticates · Provider credentials are validated against external APIs and platforms.
- Proxy layer → Providers: connects · Gateway traffic ultimately reaches provider and channel integrations.