Skip to content

feat(moa): 新增 Mixture of Agents 支持(多模型参考 fan-out + 聚合)#45

Open
guantoubaozi wants to merge 15 commits into
clickzetta:mainfrom
guantoubaozi:feature/moa-mixture-of-agents
Open

feat(moa): 新增 Mixture of Agents 支持(多模型参考 fan-out + 聚合)#45
guantoubaozi wants to merge 15 commits into
clickzetta:mainfrom
guantoubaozi:feature/moa-mixture-of-agents

Conversation

@guantoubaozi

@guantoubaozi guantoubaozi commented Jul 3, 2026

Copy link
Copy Markdown

概述

为 cz-cli 引入 Mixture of Agents(MoA):多个「参考模型」并行给出建议,再由一个「聚合模型」综合这些建议,作为正常的 acting model 执行工具并产出最终答案。MoA 注册成一个虚拟 moa provider,每个 preset 就是 /model 里一个可选的 model——不新增命令,不改动交互流程。

  • 参考模型并行 fan-out(带并发上限),各自只返回文字策略建议;它们能看到工具清单,但不执行工具。
  • 聚合模型拿到参考建议作为注入上下文,以正常 acting model 运行(完整工具 schema、多轮迭代、流式输出)。
  • 单个参考模型或聚合调用失败时优雅降级,不中断整轮。
  • 配置位于 profiles.toml 的顶层 [moa] 段,与 preset 引用的 [llm.*] entry 同文件。

配置示例

[moa]
default_preset = "balanced"
reference_concurrency = 8

[moa.presets.balanced]
reference_models = ["deepseek/deepseek/deepseek-v4-pro", "qwen/qwen/qwen3.6-plus"]
aggregator = "glm/z-ai/glm-5.2"

改动内容

  • session/moa.ts — 纯函数:preset 归一化、slot 解析、参考 fan-out、上下文注入/合成
  • provider.ts — 合成虚拟 moa provider(每个 preset 一个 model)
  • session/llm.ts — 在 LLM 循环里做参考 fan-out + 上下文注入
  • config.ts / profiles-llm.ts — MoA 配置从 profiles.toml 的 [moa] 读取
  • TUI model picker 展示 MoA presets
  • 规格:openspec/specs/moa-config/spec.md;设计文档见 docs/superpowers/specs/

测试计划

  • 单元:preset 归一化、slot 解析、fan-out、注入(test/session/moa.test.tsmoa-integration.test.ts)
  • provider 合成(test/provider/moa-provider.test.ts)
  • LLM 循环 fan-out/注入(test/session/llm.test.ts)
  • 配置从 profiles.toml 读取(test/config/profiles-llm.test.ts)
  • 全工作区 bun typecheck 通过
  • 手动 e2e:moa/glm preset(deepseek + qwen 参考 + glm-5.2 聚合)通过真实二进制端到端跑通

guanyang.wang and others added 15 commits July 1, 2026 21:35
Design for porting hermes-agent's Mixture of Agents into cz-cli as a
virtual `moa` provider (approach A2): preset selection through the normal
model system, reference fan-out + tool-aware context injection in llm.ts,
aggregator as the acting model. Classic MoA / variant 1 scope.

Co-Authored-By: Claude <noreply@anthropic.com>
The test asserted project config.model overrides the default_llm bridge,
but 8fa9e5a made model exclusively owned by profiles.toml. Update the
test to reflect current design: profiles.toml model wins.

Co-Authored-By: Claude <noreply@anthropic.com>
The model selection dialog built its option list solely from llm_entries
(profiles.toml [llm.*]), so the synthesized virtual `moa` provider — though
correctly registered on the backend — never appeared in /model. Append the
moa provider's presets to the picker options so MoA presets are selectable
like any other model.

Co-Authored-By: cz-cli <noreply@clickzetta.com>
…i.json

Parse a top-level [moa] section from profiles.toml so MoA presets live in
the same file as the [llm.*] entries they reference. czcli.json's moa field
is now ignored (deleted on load, like model). Downstream provider synthesis
and llm-loop consumers are unchanged; they read cfg.moa regardless of source.

Co-Authored-By: cz-cli <noreply@clickzetta.com>
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.

1 participant