feat(hermes): add delegation model override config

This commit is contained in:
晴天
2026-05-26 06:11:25 +08:00
parent 56519808d7
commit c19d6e80d9
6 changed files with 134 additions and 6 deletions

View File

@@ -288,6 +288,8 @@ test('Hermes 配置页会暴露执行与委派限制结构化配置字段', () =
'hm-delegation-child-timeout-seconds',
'hm-delegation-max-concurrent-children',
'hm-delegation-max-spawn-depth',
'hm-delegation-model',
'hm-delegation-provider',
'hm-delegation-orchestrator-enabled',
'hm-delegation-subagent-auto-approve',
'hm-delegation-inherit-mcp-toolsets',

View File

@@ -20,6 +20,8 @@ test('Hermes 执行与委派限制读取会提供上游默认值', () => {
delegationOrchestratorEnabled: true,
delegationSubagentAutoApprove: false,
delegationInheritMcpToolsets: true,
delegationModel: '',
delegationProvider: '',
})
})
@@ -38,6 +40,8 @@ test('Hermes 执行与委派限制读取会回显 YAML 字段', () => {
orchestrator_enabled: false,
subagent_auto_approve: true,
inherit_mcp_toolsets: false,
model: 'google/gemini-3-flash-preview',
provider: 'openrouter',
},
})
@@ -51,6 +55,8 @@ test('Hermes 执行与委派限制读取会回显 YAML 字段', () => {
assert.equal(values.delegationOrchestratorEnabled, false)
assert.equal(values.delegationSubagentAutoApprove, true)
assert.equal(values.delegationInheritMcpToolsets, false)
assert.equal(values.delegationModel, 'google/gemini-3-flash-preview')
assert.equal(values.delegationProvider, 'openrouter')
})
test('Hermes 执行与委派限制保存会保留未知字段并写入上游结构', () => {
@@ -77,6 +83,8 @@ test('Hermes 执行与委派限制保存会保留未知字段并写入上游结
delegationOrchestratorEnabled: false,
delegationSubagentAutoApprove: true,
delegationInheritMcpToolsets: false,
delegationModel: 'anthropic/claude-haiku-4.6',
delegationProvider: 'anthropic',
})
assert.deepEqual(next.model, { provider: 'anthropic' })
@@ -92,8 +100,25 @@ test('Hermes 执行与委派限制保存会保留未知字段并写入上游结
assert.equal(next.delegation.orchestrator_enabled, false)
assert.equal(next.delegation.subagent_auto_approve, true)
assert.equal(next.delegation.inherit_mcp_toolsets, false)
assert.equal(next.delegation.model, 'child-model')
assert.equal(next.delegation.provider, 'openrouter')
assert.equal(next.delegation.model, 'anthropic/claude-haiku-4.6')
assert.equal(next.delegation.provider, 'anthropic')
assert.equal(next.delegation.custom_flag, 'keep-delegation')
})
test('Hermes 执行与委派限制保存空子 Agent 模型覆盖会删除对应字段', () => {
const next = mergeHermesExecutionLimitsConfig({
delegation: {
model: 'child-model',
provider: 'openrouter',
custom_flag: 'keep-delegation',
},
}, {
delegationModel: ' ',
delegationProvider: '',
})
assert.equal(Object.hasOwn(next.delegation, 'model'), false)
assert.equal(Object.hasOwn(next.delegation, 'provider'), false)
assert.equal(next.delegation.custom_flag, 'keep-delegation')
})