feat: add usage statistics page, CLI improvements, and UI enhancements

- Add Usage Stats page with token breakdown, model distribution, and 30-day trend
- Pass through cache/cost token fields in BFF (cache_read/write_tokens, reasoning_tokens, actual_cost_usd)
- Add CLI commands: -v/--version, -h/--help, update/upgrade with auto-restart
- Auto-open browser on startup, auto-kill port conflicts (cross-platform)
- Validate all api_server config fields on startup (enabled, host, port, key, cors_origins)
- Add streaming thinking video animation with tool calls panel
- Add context token usage display (used / total) in chat header
- Sidebar: white logo area with shadow, dance video beside logo (canvas seamless loop)
- Fix sidebar nav scroll (app-main overflow-y: auto)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-04-14 14:47:18 +08:00
parent f8fc64ff5c
commit 9dd5fca9f9
24 changed files with 1433 additions and 137 deletions
+15 -7
View File
@@ -84,7 +84,7 @@ async function ensureApiServerConfig() {
const yaml = (await import('js-yaml')).default
const configPath = resolve(homedir(), '.hermes/config.yaml')
const apiServerConfig = {
const apiServerDefaults: Record<string, any> = {
enabled: true,
host: '127.0.0.1',
port: 8642,
@@ -101,8 +101,20 @@ async function ensureApiServerConfig() {
const content = readFileSync(configPath, 'utf-8')
const config = yaml.load(content) as any || {}
// Check if api_server is already correct
if (config.platforms?.api_server?.enabled === true) {
if (!config.platforms) config.platforms = {}
if (!config.platforms.api_server) config.platforms.api_server = {}
const api = config.platforms.api_server
let needsUpdate = false
for (const [key, value] of Object.entries(apiServerDefaults)) {
if (api[key] === undefined || api[key] === null) {
api[key] = value
needsUpdate = true
}
}
if (!needsUpdate) {
console.log(' ✓ api_server config is correct')
return
}
@@ -110,10 +122,6 @@ async function ensureApiServerConfig() {
// Backup before modifying
copyFileSync(configPath, configPath + '.bak')
// Ensure platforms.api_server with correct values
if (!config.platforms) config.platforms = {}
config.platforms.api_server = apiServerConfig
const updated = yaml.dump(config, { lineWidth: -1, noRefs: true, quotingType: '"' })
writeFileSync(configPath, updated, 'utf-8')
console.log(' ✓ api_server config ensured (backup saved to config.yaml.bak)')