Skip to content

feat: Enable CC Switch to recognize Hermes as the sixth AppType and be able to read and write its configuration file for switching#2120

Closed
CodeGetters wants to merge 15 commits intofarion1231:mainfrom
CodeGetters:feat/hermes-support
Closed

feat: Enable CC Switch to recognize Hermes as the sixth AppType and be able to read and write its configuration file for switching#2120
CodeGetters wants to merge 15 commits intofarion1231:mainfrom
CodeGetters:feat/hermes-support

Conversation

@CodeGetters
Copy link
Copy Markdown

@CodeGetters CodeGetters commented Apr 15, 2026

provider

Summary / 概述

Enable CC Switch to recognize Hermes as the sixth AppType and be able to read and write its configuration file for switching

Related Issue / 关联 Issue

Fixes #2113

Screenshots / 截图

Before / 修改前 After / 修改后

|
image
|
image
|

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查
  • pnpm format:check passes / 通过代码格式检查
  • cargo clippy passes (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)
  • Updated i18n files if user-facing text changed / 如修改了用户可见文本,已更新国际化文件

@CodeGetters CodeGetters changed the title feat: 让 CC Switch 能识别 Hermes 作为第 6 个 AppType,并能读写它的配置文件来切换 feat: Enable CC Switch to recognize Hermes as the sixth AppType and be able to read and write its configuration file for switching Apr 15, 2026
chan-yuu and others added 4 commits April 16, 2026 10:05
### Done
- [x] Comprehensive frontend type updates (AppId, AppType, etc.)
- [x] UI integration for Hermes in sidebar and settings
- [x] i18n support for English, Chinese, and Japanese
- [x] Verified backend configuration logic with unit tests
- [x] Fixed all TypeScript type errors related to Hermes integration

### Pending
- [ ] Database migration for 'enabled_hermes' field in 'mcp_servers' and 'skills' tables
- [ ] Implementation of Hermes-specific MCP sync logic in services/mcp.rs
- [ ] Dedicated Hermes application icon

---

### 已完成
- [x] 全面的前端类型更新(AppId, AppType 等)
- [x] 侧边栏及设置页面的 Hermes UI 集成
- [x] 中、英、日三语的 i18n 支持
- [x] 通过单元测试验证了后端配置逻辑
- [x] 修复了所有与 Hermes 集成相关的 TypeScript 类型错误

### 待处理
- [ ] 数据库 Schema 迁移(为 mcp_servers 和 skills 表增加 enabled_hermes 字段)
- [ ] 实现 Hermes 专用的 MCP 同步逻辑
- [ ] 增加 Hermes 专用应用图标
@chan-yuu
Copy link
Copy Markdown

Hi @CodeGetters, I've implemented the missing frontend parts and fixed all TypeScript type errors for Hermes support. I've also verified the backend logic with unit tests.

I've submitted a PR to your fork here: https://github.com/CodeGetters/cc-switch/pull/1

Done

  • Comprehensive frontend type updates (AppId, AppType, etc.)
  • UI integration for Hermes in sidebar and settings
  • i18n support for English, Chinese, and Japanese
  • Verified backend configuration logic with unit tests
  • Fixed all TypeScript type errors related to Hermes integration

Pending

  • Database migration for 'enabled_hermes' field in 'mcp_servers' and 'skills' tables
  • Implementation of Hermes-specific MCP sync logic in services/mcp.rs

Feel free to merge the PR in your fork to update this main PR!


你好 @CodeGetters,我为您补全了 Hermes 支持中缺失的前端部分,并修复了所有的 TypeScript 类型错误。我也通过单元测试验证了后端的配置读写逻辑。

我已经向您的 Fork 仓库发起了 PR:https://github.com/CodeGetters/cc-switch/pull/1

欢迎将该 PR 合并到您的分支中,以更新此主仓库的 Pull Request!

@CodeGetters CodeGetters reopened this Apr 16, 2026
@CodeGetters
Copy link
Copy Markdown
Author

hi @chan-yuu I have merged this part of the content and solve the duplicate declarations after merge. Thank you for your contribution. I sincerely hope that we can complete this PR quickly!

yuanxin02 added 7 commits April 16, 2026 11:44
   - Add build_hermes_settings() in deeplink with correct snake_case format
   - Implement sync_hermes_live() in ConfigService (previously placeholder)
   - Add check_hermes_stream() for stream health checks
   - Fix model extraction to read from settings_config.model field
   - Remove duplicate i18n entries
Copy link
Copy Markdown
Author

@CodeGetters CodeGetters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

概述

将 Hermes 作为第 6 个 AppType 集成到 CC Switch,实现 Provider 配置与 ~/.hermes/config.yaml 的双向同步。

核心功能

1. Provider 配置同步

操作 行为
新增 Provider 写入 custom_providers 列表 + 更新 model.provider/default
切换 Provider 更新 model.providermodel.default
删除 Provider custom_providers 中移除(不可删除当前 provider)
导入 custom_providers 读取当前激活的 provider

配置文件结构 (~/.hermes/config.yaml):

model:
  default: claude-sonnet-4-6
  provider: "My Provider"

custom_providers:
  - name: "My Provider"
    base_url: "https://api.example.com/v1"
    api_key: "sk-xxx"
    model: "claude-sonnet-4-6"
    transport: "openai_chat"

2. MCP 同步支持

  • 支持 mcp_servers 字段读写
  • 统一 MCP 管理面板集成 Hermes

3. 前端完整集成

  • Hermes Provider 表单组件
  • 预设配置:Anthropic Official, OpenRouter, Custom
  • App Switcher 支持 Hermes 切换
  • 代理面板集成

@CodeGetters
Copy link
Copy Markdown
Author

I'm adding some key information:

关键实现

后端 Rust

hermes_config.rs 核心函数:

// 读取配置
pub fn read_hermes_config() -> Result<serde_yaml::Value, AppError>
pub fn read_hermes_live_settings() -> Result<JsonValue, AppError>

// 写入配置
pub fn write_hermes_live(provider: &Provider) -> Result<(), AppError>
pub fn write_hermes_config_atomic(yaml: &serde_yaml::Value) -> Result<(), AppError>

// 删除 Provider
pub fn remove_hermes_provider_from_live(provider_name: &str) -> Result<(), AppError>

// 切换当前 Provider
pub fn set_current_hermes_provider(provider_name: &str, model: Option<&str>) -> Result<(), AppError>

mcp/hermes.rs 核心函数:

pub fn sync_enabled_to_hermes(config: &MultiAppConfig) -> Result<(), AppError>
pub fn import_from_hermes(config: &mut MultiAppConfig) -> Result<usize, AppError>
pub fn sync_single_server_to_hermes(config: &MultiAppConfig, id: &str, server_spec: &Value) -> Result<(), AppError>
pub fn remove_server_from_hermes(id: &str) -> Result<(), AppError>

前端 React

配置格式 (蛇形命名,匹配后端):

interface HermesSettingsConfig {
  name: string;        // Provider 名称
  model: string;       // 模型名称
  base_url: string;    // API 端点
  api_key: string;     // API 密钥
  transport: string;   // 传输类型,默认 "openai_chat"
}

测试覆盖

测试 描述
test_read_write_hermes_config 配置文件读写
test_write_hermes_live Provider 写入
test_remove_hermes_provider_from_live Provider 删除
test_set_current_hermes_provider Provider 切换
test_write_hermes_env_preserves_other_keys .env 文件保留其他键
import_default_config_hermes_reads_from_custom_providers 导入逻辑验证

@CodeGetters
Copy link
Copy Markdown
Author

hi @chan-yuu , I have implemented most of the functions. Please remember to check if there is any repetitive development content to avoid opening. Also, you are welcome to pull the latest code.🥰

@CodeGetters
Copy link
Copy Markdown
Author

hi @farion1231 ,do you have time to review this pr? Could support for hermes be launched as soon as possible? After all, there are also many people using hermes nowadays.🥰

@farion1231
Copy link
Copy Markdown
Owner

farion1231 commented Apr 19, 2026 via email

@CodeGetters
Copy link
Copy Markdown
Author

Actually, I’ve been working on adding support for Hermes Agent recently. It’s turned out to be more work than I expected, because Hermes Agent is still not very mature, especially when it comes to its support for the third-party Anthropic Messages format. I believe it should be finished and released within the next two or three days. Simon Johnson @.> 于2026年4月19日周日 16:12写道:

CodeGetters left a comment (farion1231/cc-switch#2120) <#2120?email_source=notifications&email_token=AKW3RFHCCY75E2UAXP6YDGL4WSC7ZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGU2DQNZYGQ42M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4275487849> hi @farion1231 https://github.com/farion1231 ,do you have time to review this pr? Could support for hermes be launched as soon as possible? After all, there are also many people using hermes nowadays.🥰 — Reply to this email directly, view it on GitHub <#2120?email_source=notifications&email_token=AKW3RFHCCY75E2UAXP6YDGL4WSC7ZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGU2DQNZYGQ42M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4275487849>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKW3RFGIDNKFQS53IDGQHPD4WSC7ZAVCNFSM6AAAAACX23HP3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENZVGQ4DOOBUHE . You are receiving this because you were mentioned.Message ID: @.
>

I'm very glad to hear such words. I'm looking forward to the latest version.🤩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

增加 hermes 配置

3 participants