feat(hermes): P1-4 hermes_read_config_full 全字段解析 - 解锁 14+ Gateway 高价值配置

之前 hermes_read_config 只读 5 字段(model/base_url/provider/api_key/config_exists),
为「快速面板」服务。Hermes Gateway 实际有 14+ 个顶层配置项,ClawPanel 完全没读到。

本次新增 hermes_read_config_full 命令,作为高级配置编辑器的数据源。

## 后端实现
- 加 serde_yaml 0.9 依赖
- 新命令 hermes_read_config_full:
  · 用 serde_yaml 完整解析 config.yaml
  · 转 JSON 返回 { exists, raw, config, highlights }
  · highlights 字段单独抽出 14 个高价值顶层字段:
    streaming / stt_enabled / quick_commands / reset_triggers /
    default_reset_policy / unauthorized_dm_behavior /
    session_store_max_age_days / always_log_local /
    group_sessions_per_user / thread_sessions_per_user /
    platforms / dashboard / memory / skills
  · 已注册到 lib.rs

## 前端
- tauri-api.js 加 hermesReadConfigFull wrapper

## Web 模式
- dev-api.js 加 hermes_read_config_full handler(Web 模式不强制 yaml 解析,
  返回 raw + null highlights,前端按需 fallback)

## 后续
- 实际「高级配置编辑器」UI 后续单独开 — 本次仅打通数据通道
- 与轻量版 hermes_read_config 互补共存,model 配置页继续用轻量版
This commit is contained in:
晴天
2026-05-14 03:56:17 +08:00
parent 7eababad4a
commit c4bf769eab
6 changed files with 127 additions and 0 deletions

View File

@@ -7159,6 +7159,28 @@ const handlers = {
return { model: displayModel, model_raw: modelName, base_url: baseUrl, provider, api_key: apiKey, config_exists: fs.existsSync(configPath) }
},
// P1-4完整解析 config.yaml让前端能读 14+ 高价值字段
// Web 模式不引入 yaml 依赖,简单返回 raw + null highlights前端按需渲染
hermes_read_config_full() {
const configPath = path.join(hermesHome(), 'config.yaml')
if (!fs.existsSync(configPath)) {
return { exists: false, raw: '', config: {}, highlights: {} }
}
let raw = ''
try { raw = fs.readFileSync(configPath, 'utf8') } catch {}
// Web 模式下不强制 yaml 解析(避免新增依赖),前端可走 raw 自己 parse 或者 fallback 到桌面端
const highlightKeys = [
'streaming', 'stt_enabled', 'quick_commands', 'reset_triggers',
'default_reset_policy', 'unauthorized_dm_behavior',
'session_store_max_age_days', 'always_log_local',
'group_sessions_per_user', 'thread_sessions_per_user',
'platforms', 'dashboard', 'memory', 'skills',
]
const highlights = {}
highlightKeys.forEach(k => { highlights[k] = null })
return { exists: true, raw, config: {}, highlights }
},
hermes_list_providers() {
return HERMES_PROVIDER_REGISTRY.map(p => ({
...p,