跳到正文

dongsheng123132/dsh-switch

30最近提交 2026年8月14日

dsh-switch DSH 插件

dsh-switch 是一个 DSH 插件,完成两个独立任务:其 DSH 包暴露工具来检查已注册的 provider 路由、通过 ctx.llm 验证精确的 provider/model,并为新会话保存默认选择;独立的 CLI 探测 OpenAI 兼容的 /models 端点并报告可达性、延迟和凭据状态。它不拦截模型请求,也不实现另一个适配器。

如何安装 dsh-switch DSH 插件

dsh plugin --profile web add github:dongsheng123132/dsh-switch#<commit>

来源命令需要人工核对。复制不会执行命令。

dsh-switch DSH 插件数据来源

dsh-switch DSH 插件快照日期:2026年8月16日

discovered

dsh-switch DSH 插件能做什么

  • 提供 dsh_switch_status 工具,显示默认选择、列出的 provider 路由以及可选广告模型。
  • 提供 dsh_switch_default 工具,通过 ctx.llm.resolveModelInfo() 验证路由,拒绝不支持的 reasoning effort,并仅为新会话保存选择。
  • 支持乐观并发期望对(expectedProvider, expectedModel)以防止竞态条件。
  • CLI 提供 validate、check、best 命令,支持 JSON 输出,用于探测 provider 端点。
  • 拒绝 apiKey 字段和嵌入在 URL 中的凭据;输出仅包含 'configured'、'missing' 或 'not-required',不泄露密钥值。

dsh-switch DSH 插件适合哪些场景

  • 检查新 DSH 会话的默认 provider/model 是什么。
  • 列出所有已注册的 provider 路由及其广告模型。
  • 在切换之前验证特定的 provider/model 路由是否可用。
  • 从 CLI 探测 OpenAI 兼容端点的可达性和延迟。
  • 为未来会话设置新的默认模型,而不影响正在进行的会话。

dsh-switch DSH 插件适合谁

  • 需要管理模型路由和默认模型配置的 DSH 用户。
  • 调试 provider 连接性或验证端点健康状况的开发者。

dsh-switch DSH 插件的限制

  • 模型切换仅影响新会话;已有会话保留其日志中记录的路由。
  • v0.1 不包含自动回退或基于成本的路由。
  • CLI 探测仅发送 GET 到 /models 端点,不发送聊天完成,因此不测试端到端生成正确性。
  • 需要 Node.js 22+ 以及官方 DSH 运行时包可解析才能运行插件冒烟测试。

dsh-switch DSH 插件的仓库 README 摘录

以下文字摘自 dsh-switch DSH 插件的上游仓库 dongsheng123132/dsh-switch 的 README,版权归原作者,仅作引用。

> Evidence-first model control plane for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness). [中文](README.zh-CN.md) `dsh-switch` does two deliberately separate jobs: 1. The DSH bundle exposes model-facing tools that inspect registered provider routes, validate an exact provider/model through the official `ctx.llm` seam, and save the default for **new sessions** through `ctx.agentDefaultModel`. 2. The standalone CLI probes OpenAI-compatible `/models` endpoints and reports reachability, HTTP status, latency, model count, and whether a credential environment variable is configured. It does not intercept model requests, implement another OpenAI adapter, or silently reroute an active session. Projects such as `dsh-polyglot` and `dsh-llm-fallbacks` own adapter/fallback behavior; this project is the observable control plane around routes DSH already knows. ## Install the DSH bundle Pin a reviewed commit when installing from GitHub: ```bash dsh plugin --profile web add github:dongsheng123132/dsh-switch#<commit> dsh --profile web --dump-config ``` The bundle ships JavaScript and has no install/build lifecycle script. ### Tools `dsh_switch_status({ includeModels? })

阅读完整 README仓库许可: MIT

dsh-switch DSH 插件常见问题

如何安装 dsh-switch?

固定一个已审核的提交,运行:`dsh plugin --profile web add github:dongsheng123132/dsh-switch#<commit>`。然后通过 `dsh --profile web --dump-config` 验证。该插件是 JavaScript 模块,没有安装或构建生命周期脚本。

dsh-switch 会影响我当前的聊天会话吗?

不会。该插件仅为新会话保存默认模型。已有会话保持其启动时记录的路由。更改不会追溯应用。

如何查看当前的默认模型?

使用 dsh_switch_status 工具。它会显示新会话使用的默认选择、列出已注册的 provider 路由,并可选择询问每个适配器其广告模型。不会执行 provider 网络健康请求。

如何设置新的默认模型?

调用 dsh_switch_default,传入想要的 provider 和 model。它通过 ctx.llm.resolveModelInfo() 验证精确路由,拒绝不支持的 reasoning effort,并通过 ctx.agentDefaultModel.saveSelection() 保存。它会回读该值,如果写入不可观察则失败。

如果 provider 宕机,dsh-switch 会自动回退吗?

v0.1 不包含自动回退或基于成本的路由。该插件是一个控制平面,用于检查路由和设置默认值,但不拦截模型请求或重新路由活动会话。像 dsh-polyglot 和 dsh-llm-fallbacks 这样的项目处理适配器/回退行为。