返回目录
Agent 与会话 插件

dsh-model-vendor-badge

Townrain/dsh-model-vendor-badge

Vendor logo seat in the DSH web composer: shows which provider serves the current model, live from the official per-session ModelDirectory.

Stars
1
Forks
0
Issues
0
更新
11 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:Townrain/dsh-model-vendor-badge

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-model-vendor-badge

English | 简体中文

A vendor logo seat for the DeepSeek Harness web composer: it shows which provider serves the current model, right next to the model selector, live off the official per-session ModelDirectory.

[🐳 DeepSeek]  [deepseek-v4-pro · High ▾]  [Send]

What it does

  • Registers a small badge into conversation.input.right — the composer tool row seat immediately left of the model selector.
  • Reads the same per-session ModelDirectory the model seat renders from (ctx.modelDirectories), so a selection change anywhere — the seat menu, the /model popup, the host — updates the badge live.
  • 119 provider routes, monochrome: every glyph is normalized to a currentColor path so the theme owns the tone, exactly like the other controls in that row.
  • The whole DeepSeek family (deepseek, deepseek-official, deepseek-account, deepseek-reasoner) paints the same whale — one vendor, different transports.
  • Unknown routes fall back to a brand-colored letter tile rather than nothing.
  • Pure client presentation: no host code, no RPC, no settings, no session events. Uninstalling leaves nothing behind.

Where the icons come from

The icons are not hand-written into the source. They are a declarative registry plus a generator:

File Role
icons/sources.json route -> icon source, display label, fallback color. The only file to edit when adding a vendor.
icons/cache/opencode-sprite.json opencode's official provider sprite, minus the generic sparkle placeholders upstream ships for vendors it has no mark for
icons/cache/simple-icons.json Simple Icons (CC0) supplements: Anthropic, Google Gemini, Qwen, Ollama, GitHub Copilot, Hugging Face, Kimi, and more
icons/local/deepseek-whale.svg the DeepSeek whale, maintained here
src/client/official-icons.generated.ts generated output — do not edit

After editing icons/sources.json:

node scripts/generate-icons.mjs      # regenerate
node verify-icons.mjs                # coverage + placeholders + up-to-date check

A route the generator cannot resolve is a hard error, never a silent fallback: in production a silent fallback means an invisible badge.

Install

dsh plugin --profile web add github:Townrain/dsh-model-vendor-badge

Or from a local clone:

dsh plugin --profile web add /path/to/dsh-model-vendor-badge

Refresh the page after installation.

Build

DSH_CHECKOUT=/path/to/deepseek-harness node build.mjs

build.mjs resolves the checkout's esbuild + typescript, junctions the client type dependencies into node_modules/, and emits lib/index.js (host, no-op) + lib/client.js (browser bundle, __ModuleLoader__ format) + lib/types/ declarations.

When only client rendering changed and no checkout with built declarations is at hand, rebuild the bundle alone:

node build-client-only.mjs --esbuild <path/to/esbuild/>

Verify

npm run verify        # verify-client.mjs + verify-icons.mjs
npm run audit:startup # static startup-safety audit
npm run icons:check   # generated module in sync with sources.json
  • verify-client.mjs loads lib/client.js and asserts the __ModuleLoader__ registration, the absence of a module-level inject gate, that the healthy path really registers into conversation.input.right, and that a missing service only warns instead of parking the entry.
  • verify-icons.mjs asserts the DeepSeek family shares one whale, that no route is wired to an upstream placeholder, that every route the pi-ai catalog can report has a glyph or an explicit fallback identity, and that the generated module matches the registry.

Package format (dsh 0.2.x)

This package declares the fields defined by @deepseek-ai/dsh-package-manifest (shipped inside the installed app.asar, runtime 0.2.2-rc.2):

{
  "icon": "icon.svg",                 // package-root icon, <=256 KiB, realpath must stay inside
  "engines": { "dsh": ">=0.1.5-rc.1", "node": ">=20.0.0" },
  "dsh": {
    "manifestVersion": 1,             // format version, independent of npm and Session versions
    "bundle": {
      "patch": "./cordis.patch.yml",
      "platforms": ["darwin", "linux", "win32", "wsl"],
      "listedByDefault": true
    },
    "client": { "platform": "web", "inject": [ "..." ] }
  }
}

Which of these are actually enforced

Two of the four are hard gates, not documentation — worth knowing before you copy the block:

Field Reader When it does not hold
dsh.bundle.platforms assertBundlePlatform (boot + plugin manager) throws and skips the bundle; the list must be nonempty and contain only Node platform names or wsl
engines.dsh evaluatePluginCompatibility (boot + install) every row of the plugin is disabled and installation is refused; recovery needs a dsh plugin allow-version exact-version exemption
dsh.manifestVersion no enforcing reader today declarative only
dsh.bundle.listedByDefault Plugin Manager GUI lists visibility only (false = hidden by default, still manageable)

One more engines.dsh detail: when present it decides alone and peerDependencies are ignored entirely. This package therefore does not lean on a peerDependencies: { "@deepseek-ai/dsh-*": "*" } safety net — those entries are for tooling only.

npm run verify:manifest   # checks icon / platforms / engines.dsh / client against the reader rules

Startup safety: why this plugin exports no inject

This was the one way this plugin could stop dsh from booting at all; it is deliberately eliminated.

dsh treats "every plugin activated" as a precondition for starting:

  • host — dsh-app-boot: assertEntriesLoaded / assertEntriesActivated
  • browser — @deepseek-ai/dsh-client-web boot.ts: assertEntriesActive

A cordis fiber whose inject list names a service that is not (or is no longer) provided stays at state 0 (PENDING) forever:

Form If a service name is renamed or removed
export const inject = ['slots','sessions','modelDirectories'] entry stays PENDING → dsh fails to boot ("Failed to load plugins")
ctx.inject([...], scope => …) entry activates immediately, callback simply never runs → the badge is missing, one console warning

This plugin uses the second form, matching what dsh's own client packages do (dsh-client-ui-model-selection: ctx.inject(['slots','modelDirectories'], …)). The three service names are resolved inside the callback through scope, and the readout warns loudly rather than failing silently when they are absent.

Guard it on every rebuild:

npm run audit:startup

The audit asserts (static, no running instance required) that the bundle exports no hard inject gate and that its runtime require() surface stays inside the platform seed words — both derived from the running dsh rather than hardcoded. It exits non-zero if either regresses.

What this does NOT protect against

An adversarial review of this hardening confirmed the activation-gate claim and falsified the absolute form of it. Two whole-surface paths remain, and neither is fixable from a plugin:

  1. The platform seed words themselves. The bundle's only runtime require() calls are react and react/jsx-runtime. They resolve against a frozen 9-word table (PLATFORM_MODULES in packages/client/web/src/platform.ts). If a future dsh drops or renames react in that table, this bundle fails to materialize exactly as hard as the old inject list did. The audit catches the change; only a rebuild can act on it.
  2. A synchronous throw in apply(). apply runs on the entry's own fiber, so a throw there still marks the entry FAILED. The whole body is wrapped in try/catch precisely because ctx.inject is a cordis registry mixin, not a Context method — the same class of rename that 0.1.5 already performed on dsh-client-runtime. Anything thrown outside that wrapper would still be fatal.

Known drift

  • dsh.plugin.json is not read by the current dsh — no consumer exists in the @deepseek-ai/dsh package tree. The authoritative manifest is package.json (dsh.bundle, dsh.client). The file is retained only for compatibility with older tooling, with its version kept in step.

License

MIT

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类Agent 与会话
规则置信度低

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: session。