feat: Hermes Agent 多引擎架构核心代码

- 新增 src/engines/hermes/ 完整引擎(仪表盘/服务管理/模型配置/Agent管理/对话)
- 新增 src/lib/engine-manager.js 引擎管理器(切换/检测/状态)
- 新增 src-tauri/src/commands/hermes.rs 后端命令(Gateway控制/配置读写/Agent Run SSE)
- sidebar 引擎切换器 UI
- i18n 新增 engine 模块(中/英/繁体)
- 多安装清理工具(gateway-ownership.js)
- 晴辰助手文件访问开关
- Hermes 对话工具调用可视化、SSE 流式输出
- Cargo.lock / dev-api.js 同步更新
This commit is contained in:
晴天
2026-04-13 04:09:00 +08:00
parent 32190c8f27
commit 5575566806
36 changed files with 6694 additions and 424 deletions

View File

@@ -3195,10 +3195,12 @@ const handlers = {
const normalizedAccountId = typeof accountId === 'string' ? accountId.trim() : ''
const setRootChannelEntry = (entry) => {
const current = cfg.channels?.[storageKey]
if (current && typeof current === 'object' && current.accounts && typeof current.accounts === 'object') {
entry.accounts = current.accounts
// 合并模式:保留用户通过 CLI 或手动编辑的自定义字段streaming, retry, dmPolicy 等)
if (current && typeof current === 'object') {
cfg.channels[storageKey] = { ...current, ...entry }
} else {
cfg.channels[storageKey] = entry
}
cfg.channels[storageKey] = entry
}
const setAccountChannelEntry = (entry) => {
const current = cfg.channels?.[storageKey] && typeof cfg.channels[storageKey] === 'object'
@@ -3233,7 +3235,6 @@ const handlers = {
if (form.allowedUsers) entry.allowFrom = form.allowedUsers.split(',').map(s => s.trim()).filter(Boolean)
} else if (platform === 'discord') {
entry.token = form.token
entry.groupPolicy = 'allowlist'
if (form.guildId) {
const ck = form.channelId || '*'
entry.guilds = { [form.guildId]: { users: ['*'], requireMention: true, channels: { [ck]: { allow: true, requireMention: true } } } }
@@ -3261,7 +3262,18 @@ const handlers = {
}
if (platform !== 'qqbot' && platform !== 'feishu' && platform !== 'dingtalk' && platform !== 'dingtalk-connector') {
cfg.channels[storageKey] = entry
// 合并模式:保留用户通过 CLI 或手动编辑的自定义字段
const existing = cfg.channels[storageKey]
cfg.channels[storageKey] = (existing && typeof existing === 'object')
? { ...existing, ...entry }
: entry
// Discord: 仅在首次创建时设置默认值,不覆盖用户已有的设置
if (platform === 'discord') {
const d = cfg.channels[storageKey]
if (!d.groupPolicy) d.groupPolicy = 'allowlist'
if (!d.dm) d.dm = { enabled: false }
if (!d.retry) d.retry = { attempts: 3, minDelayMs: 500, maxDelayMs: 30000, jitter: 0.1 }
}
}
writeOpenclawConfigFile(cfg)
@@ -3437,7 +3449,7 @@ const handlers = {
if (cfg.plugins.entries[pid]) cfg.plugins.entries[pid].enabled = false
}
fs.writeFileSync(CONFIG_PATH, JSON.stringify(cfg, null, 2), 'utf8')
writeOpenclawConfigFile(cfg)
return { ok: true, enabled, pluginId: pid }
},