dshbase

插件目录 / Developer / dsh-agent-preset-router

dsh-agent-preset-router

已验证 · 实测可装 CTWCTW9999

✓ 持续维护

查看 GitHub ↗ ← 返回插件目录

0Stars
0Forks
0未关闭 issue
—语言
2026-08-18最近推送
跨平台平台

功能简介

Auto Mode for DeepSeek Harness: a flash-model router that auto-picks the best agent preset (standard/code/minimal/cordis) for each new session — judge and run, no confirmation

✅
我们的评价
可用 — 实测通过,早期项目

Auto Mode for DeepSeek Harness: a flash-model router that auto-picks the best agent preset (standard/code/minimal/cordis) for each new session — judge and run, no confirmation 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

dsh-agent-preset-router

自动模式 (Auto Mode) — an AI pre-judgment layer for DeepSeek Harness (DSH).

Adds a selectable 自动模式 / Auto agent preset. When you start a new session in Auto mode and send your first request, a flash-class model first judges which built-in agent preset fits your intent — 标准模式 (standard) / PTC 模式 (code) / 极简模式 (minimal) / 创造模式 (cordis) — then switches and executes automatically, with no confirmation. A glowing info bar above the input shows the decision for 3 seconds and dismisses itself.

你发送需求 ──► Flash 分类 ──► 自动切换 preset 并执行(无需确认)──► 决策提示条 3 秒后自动消失

Why "per new session"? DSH fixes a session's agent preset the moment the session produces anything (its first turn/start). Re-routing inside one session after the first message is a platform-level lock (agent-preset-locked). Auto Mode therefore routes every new session's first message — the flash judgment happens before anything is sent, so the session is still blank and the preset can be switched. Once routed, the session is pinned to the chosen preset, exactly like a session you created directly in that preset.

Features

  • ✨ Selectable Auto preset — appears as 自动模式 in the preset picker (new session), with a compact toolset as a safety net if routing is ever unavailable.
  • 🤖 Flash pre-judgment — a deepseek-v4-flash classifier scores the request against the four built-in presets and returns preset + reason + confidence.
  • ⚡ Judge and run — the session is switched to the recommended preset and the message is sent immediately, no confirmation; an animated info bar (moving gradient diffuse glow, futuristic styling) shows the routed decision above the input and auto-dismisses after 3 seconds.
  • 🛡️ Honest fallbacks — on any classifier failure the session falls back to a configured default preset (standard) and tells you so, instead of silently mis-routing.
  • 🔌 Zero config to start — the classifier reuses the session's own provider/model (falls back to your first registered provider), so it works out of the box.

Install

Requires DSH with the web app installed. Install into your web profile — from npm when published, or directly from GitHub:

# npm (once published)
dsh plugin --profile web add dsh-agent-preset-router

# or straight from this repository
dsh plugin --profile web add "https://github.com/CTWCTW9999/dsh-agent-preset-router"

(If you develop locally: dsh plugin --profile web add <path-to-this-repo>.)

Restart the web app (or reload the GUI page) so the new bundle row and preset are picked up.

Verify

  • The preset picker for a new session now lists 自动模式.
  • The installed preset lives at $DSH_HOME/.agent-presets/auto with a .dsh-preset-owner.json marker owned by this plugin.

Usage

  1. Create a new session.
  2. Pick 自动模式 as its agent preset.
  3. Type your request and send.
  4. An animated bar appears above the input: first "picking the best preset…", then "Auto-routed to xxx — reason". The session is switched and your message is sent automatically; the bar dismisses itself after 3 seconds.
  5. No confirmation needed — execution starts on the chosen preset immediately.

Slash commands (e.g. /help) bypass routing and execute directly.

How it works

Layer Piece Role
Host lib/index.js Installs the auto preset into the user preset root; exposes an HTTP RPC (POST /agent-preset-router/rpc, method classify) that runs the flash classifier through ctx.llm.
Client lib/client.js Wraps api.sessions.prompt; for blank Auto sessions it calls the classify RPC, then automatically calls api.agentPresets.select and forwards the prompt once the judgment lands, while rendering a 3-second self-dismissing animated info bar in the composer dock (conversation.input.dock).
Preset presets/auto/ The 自动模式 composition — a compact, safe toolset used as the session's preset when Auto is selected (routing normally switches away before the first turn).

Architecture constraints that shaped the design

  • Preset lock: agentPresets.select only works on blank sessions. Routing must happen client-side before the first session.prompt — hence the prompt wrapper.
  • The info bar is display-only: no buttons, no waiting — routing executes the moment the judgment lands, and the bar fades out on its own after 3 seconds.
  • RPC dispatch is fixed: plugins cannot add RPC methods to the harness protocol, so classification rides an HTTP route with a same-origin check.
  • Inject contract: the host declares inject: ['agents', 'llm']; the client injects connection, sessions, slots, locale.

Configuration

All settings are optional. Configure the plugin via the profile's patch layer (cordis.patch.yml in $DSH_HOME/profiles/web/) or by patching the bundle row:

- config:
    classifier:
      provider: leihuo      # default: the session's own provider, else the first registered
      model: deepseek-v4-flash
      temperature: 0
      maxTokens: 256
    fallbackPreset: standard  # used when classification fails (standard|code|minimal|cordis)
  id: agent-preset-router
Key Default Meaning
classifier.provider session provider → first registered LLM provider for the classifier
classifier.model deepseek-v4-flash Classifier model (session model overrides when default)
classifier.temperature 0 Sampling temperature
classifier.maxTokens 256 Max output tokens for the classification JSON
fallbackPreset standard Preset used when classification fails

The classifier prompt is a strict JSON contract: {"preset","reason","confidence"} with the four preset ids, in Chinese, plus a 30s timeout.

Security notes

  • The classify route is POST-only, rejects cross-origin requests, and caps request bodies at 256 KiB.
  • The classifier may send your request text to the configured LLM provider — same trust model as the harness itself.

Limitations

  • Routing applies to the first message of each new session, not per-message inside an ongoing session (platform preset lock).
  • The classifier's judgment is heuristic; routing completes automatically before the message is sent. If it picked wrong, start a new session (or create one directly in the target preset) — there is no in-flight cancel.
  • The auto preset itself is a compact fallback toolset; if you want richer behavior when Auto is the final preset, extend presets/auto/agent.cordis.yml (installed into $DSH_HOME/.agent-presets/auto).

Development

npm test           # run all three test suites (no DSH needed)
npm pack           # build the publishable tarball
# install the tarball: dsh plugin --profile web add ./dsh-agent-preset-router-0.1.0.tgz

Run the test suites individually (no DSH needed):

node test/host.test.mjs   # parseClassification + preset installer
node test/rpc.test.mjs    # classify RPC handler (stubbed ctx)
node test/client.test.mjs # client bundle load + prompt wrap + HMR

Publishing

npm publish        # publish to npm (runs "prepublishOnly" checks if configured)
# after publishing, install with: dsh plugin --profile web add dsh-agent-preset-router

Credits

License

MIT

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-agent-preset-router」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:CTWCTW9999/dsh-agent-preset-router

Headless(CLI)profile:

dsh plugin --profile headless add github:CTWCTW9999/dsh-agent-preset-router

实测报告

验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7819 个插件 →