DeepSeek Harness 插件

dsh-smart-model-router

Task- and quota-aware virtual Auto model router for DeepSeek Harness(英文原文)

跳到安装方式

来源信息

GitHub 仓库
chuankris/dsh-smart-model-router
最近更新
2026年8月19日
分类
模型与服务商
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-21

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/chuankris/dsh-smart-model-router
插件名:dsh-smart-model-router
作者:chuankris

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-smart-model-router

A host-plane Cordis plugin for DeepSeek Harness that adds a virtual Auto model. Explicit model selections pass through unchanged. Selecting Auto chooses a real provider/model for each step from task difficulty and optional quota pressure.

Why

Model catalogs make manual selection easy, but a useful default must answer two separate questions:

1. How much capability does this task need? 2. Which quota pool should be conserved right now?

This plugin answers both at the agent/request extension point. The resolved real provider, model, and reasoning effort are then written by DSH to the normal request/header, so replay and audit observe the route actually used rather than the virtual Auto alias.

Behavior

The default candidate set targets the ChatGPT subscription adapter: Spark, 5.4 Mini, and 5.6 Sol. Each candidate declares operator-estimated quality, speed, economy, task affinities, modalities, and quota bucket.

Routing is a multi-stage utility decision rather than a four-tier keyword lookup:

1. Extract semantic and structural features for coding, analysis, writing, risk, agentic work, long context, images, constraints, tool history, and step depth. 2. Query the live DSH model registry and reject unavailable or modality-incompatible candidates. 3. Score eligible candidates across quality, speed, economy, task affinity, quota headroom, and reserve pressure. 4. Select deterministically and log the winner, score, demand, quota, alternatives, and rejected candidates.

Quality receives more weight as demand rises; speed and economy receive more weight for low-demand work. If quota retrieval fails, capability and task routing continue. See [the routing design](docs/routing-design.md) for the formula, open-source references, evidence policy, and evaluation limits.

Explicit selection always wins

The plugin only rewrites this exact virtual route:

dsh-auto/dynamic

Any concrete selection—Codex, DeepSeek, Kimi, GLM, or another registered provider—is returned by identity and is never overridden.

Install

dsh plugin --profile web add dsh-smart-model-router

Restart DSH Web, then choose Auto (difficulty + quota) from the model selector. To make Auto the default for new sessions, set:

agent-default-model:
  provider: dsh-auto
  model: dynamic

in ~/.dsh/settings.yaml.

Configuration

The bundle inserts one host plugin row. Override it in your profile's cordis.patch.yml:

- id: smart-model-router
  config:
    displayName: Auto (capability + quota)
    quotaStatusUrl: http://127.0.0.1:3080/api/dsh-chatgpt-subscription/status
    quotaCacheMs: 60000
    policy:
      qualityWeight: 1
      speedWeight: 0.36
      economyWeight: 0.44
      quotaWeight: 0.65
      reservePercent: 8
      reservePenalty: 1.4
    quota:
      enabled: true
    # candidates is an array of provider/model, modalities, quotaBucketId,
    # quality/speed/economy estimates, and per-task affinity weights.

All candidates, estimates, affinities, policy weights, quota reserves, and endpoint settings are Cordis config; deployments do not need to edit source. The complete default candidate objects are in src/core.js.

Architecture

  • Host plane: routing and quota state are shared across sessions.
  • Virtual adapter: registers Auto in the standard model catalog and fails closed if unresolved.
  • agent/request waterfall: calls next(), preserves explicit selections, and replaces only the Auto alias.
  • Reconstructability: DSH logs the resolved concrete route in request/header before dispatch.
  • Lifecycle: adapter and event registrations belong to the plugin Fiber and disappear on unload/HMR.

Quota integration

Version 0.2 reads the authenticated dsh-chatgpt-subscription status endpoint through loopback HTTP. This keeps the plugin standalone but is the main upstream-integration limitation: a provider-neutral read-only quota Service would remove the HTTP and fixed-port coupling. The router deliberately treats the signal as optional.

Development

npm install --ignore-scripts
npm run check
npm run benchmark
npm run smoke:real-dsh
npm run pack:check

The test suite covers feature extraction, utility scoring, capability rejection, quota reserves, explicit-selection precedence, missing quota, virtual model registration, routing, and real DSH mount/unload lifecycle. The transparent regression corpus currently contains 12 representative tasks; it is a policy drift check, not a scientific model-quality benchmark.

Security and privacy

The plugin sends no task text to a classifier service. Classification is local. The optional quota fetch targets the configured URL and reads only quota percentages. Configure a trusted loopback or authenticated endpoint.

Known limitations and upstream path

  • Local semantic features remain a deterministic approximation; trained routers such as RouteLLM or RoRF can outperform them when representative preference labels exist.
  • Default quality, speed, economy, and affinity values are operator estimates, not vendor benchmark facts. Deployments should calibrate them on their workloads.
  • The current quota source follows the community ChatGPT subscription plugin's HTTP API rather than a DSH quota capability.
  • The virtual adapter is a compatibility technique until DSH has a first-class virtual route registry.

The intended upstream path is to propose a provider-neutral quota-status capability and a first-class virtual model route abstraction, then migrate this plugin onto those APIs. The policy engine and tests are intentionally independent of the HTTP transport to support that migration.

License

MIT