dsh-model-provider-badge
界面增强 活跃维护

dsh-model-provider-badge

cKNKSnd/dsh-model-provider-badge

轻量级扩展组件,可在输入框区域自动展示对应模型的提供商徽章,无需复杂配置,安装后即可直观识别当前调用模型的服务归属。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
14 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:cKNKSnd/dsh-model-provider-badge
git clone https://github.com/cKNKSnd/dsh-model-provider-badge.git
git clone git@github.com:cKNKSnd/dsh-model-provider-badge.git
README.md master

dsh-model-provider-badge

A DeepSeek Harness (DSH) web client plugin that shows the active model
provider name
in the composer, beside the stock model selector — so when you
use a non-official model you can see at a glance which provider it comes from,
e.g. opencode-go.

It is a pure browser-side UI plugin (a dsh.client row). It adds a small
read-only badge into the additive conversation.input.right seat (bottom-right
of the input, next to the model selector, left of the send button) and reads the
same per-session model directory the stock selector uses, so it stays in sync
when you switch model/provider.

Requirements

  • A DeepSeek Harness install with the Web profile (the browser GUI).
  • The stock model-selection plugin @deepseek-ai/dsh-client-ui-model-selection
    (it is part of the default Web composition and provides the modelDirectories
    client service this badge reads). If that plugin is disabled the badge renders
    nothing rather than erroring.

What it looks like / where it appears

... model selector [ opencode-go ] [ send ]

The badge is styled to match the stock model label (13px / weight 500 /
var(--dsw-alias-label-secondary)), truncated with an ellipsis beyond 140px,
and its full value is available as a tooltip.

Package layout

dsh-model-provider-badge/
├── package.json          # dsh.client + dsh.bundle.patch declarations, exports["./client"]
├── cordis.patch.yml      # dsh.bundle.patch layer: auto-inserts the plugin row on install
├── lib/
│   ├── index.js          # host half: empty apply() so the host Loader sees the entry
│   └── client.js         # web half: window.__ModuleLoader__.load({ id, factory }) — 唯一实现
├── README.md / README.zh.md / LICENSE / .gitignore

lib/ is the single source of truth (no separate src/), mirroring the official
DeepSeek Harness client-plugin standard:

  • package.json declares "dsh": { "client": { "platform": "web" }, "bundle": { "patch": "./cordis.patch.yml" } }
    and exports["./client"] pointing at the web bundle.
  • cordis.patch.yml is the dsh.bundle.patch layer: the official CLI adds this
    package to the profile's bundle stack and the patch inserts the plugin row at
    startup — no manual profile editing.
  • lib/index.js provides an empty apply() so the package appears as a host
    Loader entry (see the node half of any shipped dsh-client-ui-* package).
  • lib/client.js registers itself with the shell module loader
    (window.__ModuleLoader__.load({ id, factory }), id = package name) and
    exports a Cordis plugin { inject: ["slots"], apply }.

安装 / 使用(另一台电脑同样适用)

前置要求:DSH 已安装(dsh web 可启动),Node.js ≥ 20,pnpm ≥ 10。

方式一:本地 tarball(无需发布)

在包目录打包:

cd dsh-model-provider-badge
pnpm pack

得到 dsh-model-provider-badge-0.1.0.tgz,复制到目标电脑后安装:

dsh plugin --profile web add ./dsh-model-provider-badge-0.1.0.tgz

方式二:发布到 npm 后安装

cd dsh-model-provider-badge
pnpm publish
dsh plugin --profile web add dsh-model-provider-badge

方式三:Git 仓库

dsh plugin --profile web add git+https://github.com/<you>/dsh-model-provider-badge.git

安装完成后重启 dsh web 进程,新的 client bundle 才会进入页面启动清单(window.__DSH_BOOT__)。
首次添加新浏览器插件时,首次会话可能在界面中需要批准该 Client 包。

卸载

dsh plugin --profile web remove dsh-model-provider-badge

然后重启 dsh web 进程。

Behavior details

  • Reads ctx.modelDirectories.directoryFor(sessionId).store and displays
    current.provider (e.g. opencode-go).
  • Subscribes to the directory store, so it updates when you change model/provider
    in the stock selector.
  • Loads the directory if it is idle, so the badge appears without you opening the
    selector first.
  • Works in normal (non-addressed) sessions. For addressed subagent sessions the
    directory is unavailable and the badge renders nothing.

License

MIT