Перейти к основному содержимому
S

dsh-multi-model-orchestrator

socool666/dsh-multi-model-orchestrator

多模型智能协同调度插件 for the agent runtime:模型池+能力标签、任务自动拆解、按强项智能路由、结果融合、人工指定模型、失败自动降级、图片生成与完整调用链路日志。DAG/路由算法复用 mmcp(MIT)。

Установка

dsh plugin --profile web add github:socool666/dsh-multi-model-orchestrator

README

Multi-model Orchestrator for the agent runtime

Feed one task in; it is split into subtasks, each routed to the model strongest at that kind of work, then fused into one coherent result. Code, images, prose, math, structured output, summarization, proofreading — heterogeneous models collaborating.

License: MIT DSH

English · 简体中文

What it does

No single model is best at everything. This plugin lets you assemble a "virtual team":

  1. You submit one task.
  2. It decomposes into subtasks (outline, body, image prompt, image generation, proofread...).
  3. Each subtask is routed by capability tags to the best model.
  4. A synthesizer checks consistency, resolves conflicts, unifies format, and fuses the outputs.

Use it from the normal conversation window (v1.2, easiest)

After adding models to the pool, a new "Multi-Model · 聚合模型" provider appears in the regular chat model selector with a model "聚合模型(自动多模型协作)" alongside DeepSeek / WorkBuddy models. Select it and just type your task as usual — no settings panel needed. Every request runs the full decompose → route → fuse pipeline. Chain logs remain in Settings → Multi-model Orchestrator. (The aggregate model cannot be a subtask model — recursion guard.)

Features

  • Model pool with enable/disable, capability tags (0–1), endpoint/key/params, synthesizer flag.
  • Task decomposition into a dependency DAG (default 5-step plan for a paper-illustration task; pluggable LLM planner).
  • Capability routing with bilingual keyword detection and epsilon-greedy/UCB-style learning from outcomes.
  • Result fusion in light (concat) or deep (synthesizer rewrite) mode.
  • Human override: force any subtask role to a specific model, and inspect the full chain (model per subtask, attempts, raw outputs).
  • Failover on timeout/error to the next-ranked model, with attempt logs.
  • Serial/parallel scheduling by dependency waves; chain logs for debugging and tuning the capability map.
  • Image subtasks via a user-configured OpenAI-compatible image API.

Reuse of open source (engineering-first)

Per the engineering-first strategy I searched and verified several projects:

  • mmcp-core (MIT, npm mmcp-core@2.2.0) — its DAG design (createContext/buildHistory/topologicalSort), per-domain scoring router (ε-greedy/UCB), observer events and state-machine retry ideas are reused as the algorithm basis in lib/. I did not depend on its runtime package because its adapters only target external HTTP endpoints and its AdapterResult is text-only, so it cannot call DSH's ctx.llm or generate images. The adapter layer was rewritten to stay self-contained.
  • Not adopted: dsh-model-router (a large routing workbench product, no custom fusion/image orchestration), astromesh (standalone Python runtime requiring REST deployment).

Install

  • Plugin Manager: Settings → Plugins → Add plugin → select this repo directory → open Settings → Multi-model Orchestrator.
  • CLI: dsh plugin --profile desktop add dsh-multi-model-orchestrator

Verified on the agent runtime 0.2.2-rc.3 (requires ≥ 0.2.2-rc.2), Node ≥ 20.

Quick start

  1. Add already-loaded models (recommended): open Settings → Multi-model Orchestrator → ① Model pool. The top dropdown lists every model DSH has already loaded (WorkBuddy's Hy4 / GLM-5.3 / Space-Bunny / MiniMax, DeepSeek account models, free models — with x0.29 / limited-time-free badges). Pick one, click "+ Add to pool", repeat for the models you want to aggregate. Added models show an "already loaded" badge — no key/endpoint needed; calls use DSH's own auth. Click capability chips to set 0.1/0.5/0.9 scores, and mark the strongest text model as synthesizer. Save.
  2. Or add your own: "+ Add custom model" lets you enter provider/model/endpoint/apiKey for models not loaded in DSH. Image subtasks need an OpenAI-compatible /images/generations endpoint in section ②.
  3. Run: type e.g. Write an essay about spring, add a cover image, then proofread and unify formatting. and submit. The scheduler dispatches each subtask to the best model among those you selected.
  4. Inspect: final text + image URLs; click "view chain" to see each subtask's domain, chosen model, attempts (including failovers) and raw output.

Programmatic use with human override:

await ctx.multiModelOrchestrator.run(task, {
  forced: { writer: 'my-favorite-prose-model' },
  fusion: 'light',
})

Cost & security

  • Every subtask is a real model call and costs money; parallel subtasks may bill concurrently. Use light fusion / fewer subtasks to control cost.
  • The image endpoint/key you configure receives your prompts — only use trusted providers.
  • Failover retries on backup models and may add calls; check the attempts log.
  • A timed-out upstream may still complete; retrying can double-bill. Set maxRetries with idempotency in mind.

Tests

node test/core.test.mjs      # 7 algorithm tests
node test/pipeline.test.mjs  # 2 end-to-end tests

Похожие плагины