dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
把 cc-switch 的供应商与模型在保存的瞬间镜像进 DSH,并在输入框和设置卡片里显示各供应商的套餐窗口、账户余额或自定义用量脚本的结果。
A DeepSeek Harness (DSH) plugin that bridges cc-switch:
llm-pi-ai settings namespace the moment you hit save in cc-switch (a slow signature poll remains as a safety net). Whatever you configure or switch to in cc-switch is usable in DSH within a second; provider keys are stored in the DSH credentials service (settings only reference their names, values never land in settings.yaml). The sync is self-healing: externally lost or edited ccs-* entries are restored automatically. When you switch the current provider in cc-switch, the DSH agent-default-model follows — but only while that default is unset or already points at one of the synced ccs-* routes. A default you pinned to anything else (your own provider entry, or a third-party wrapper of our route such as modlens's modlens-ccs-… "(modlens vision)" twin) is never overwritten.anthropic-messages), Codex/GPT with API-key auth (→ openai-responses / openai-completions via wire_api), Gemini-shaped OpenAI-compatible relays (→ openai-completions), and DSH-shaped OpenClaw configs. OAuth-login providers (ChatGPT/Gemini official) and native-Gemini endpoints cannot be expressed as DSH routes and are listed as skipped with a reason.llm/adapters-updated), and the plugin's settings card + composer badge also re-read on DSH's forwarded settings/document-updated / llm/adapters-updated events. So a provider added, renamed, or given new models in cc-switch is visible in the DSH model picker and in this plugin's surfaces within about a second — no restart, no reopening the settings tab, no waiting for a poll tick. Each provider row additionally reports whether DSH already serves it (live in DSH / awaiting DSH) and how many of its models DSH lists, so a half-applied state is visible rather than silent.token_plan (Volcano Ark, MiniMax — CN/Intl detected from the base URL) or remaining balance for the built-in balance template (DeepSeek, StepFun, SiliconFlow CN/EN, OpenRouter, Novita AI — detected from the base URL, mirroring cc-switch's own balance service) and for general/newapi scripts (executed in a sandboxed node:vm with request/extractor from the cc-switch script, placeholder substitution for {{baseUrl}}/{{apiKey}}/{{accessToken}}/{{userId}}). Results are cached per route honoring the script's auto-query interval; error messages are scrubbed of every credential the row contributed. The badge follows the session's own model: it subscribes to the client's model-selection store, so picking a different model in the composer swaps the usage immediately (the last answer per provider is cached client-side, so flipping back and forth paints instantly). No badge is shown for providers without a usage query. Additionally, the plugin's settings card shows a usage line for every provider whose usage query is enabled in cc-switch (not just the one in use) — plan windows or remaining balance, with a per-line refresh button.# from a clone / local checkout
dsh plugin --profile desktop add link:/path/to/dsh-switch
# or straight from this repository (no build step — lib/ is committed)
dsh plugin --profile desktop add github:a981008/dsh-switch
(or add "dsh-switch": "link:/path/to/dsh-switch" to the profile package.json dependencies + dsh.profile.bundles, then pnpm install.)
lib/ (the built host + client bundles) is committed and the package declares no prepare script, so a git install needs no build step and pnpm never asks you to approve a build script. To rebuild after editing src/:
node build.mjs && node test/run.mjs # run.mjs typechecks first, then runs smoke + integration
Restart DSH Desktop afterwards so the next generation composes the new bundle.
Agent-oriented contributor guide: AGENTS.md — commands, architecture map, hard invariants, debugging paths, and the testing conventions. Coding agents should read it before the first edit (Claude-family tools are pointed there by CLAUDE.md).
dsh plugin --profile desktop remove dsh-switch
Removing the plugin leaves the synced ccs-* provider entries in your DSH settings; delete them by hand if unwanted. If DSH Desktop fails to start after installing, remove dsh-switch from both dependencies and dsh.profile.bundles in ~/.dsh/profiles/desktop/package.json, then relaunch.
~/.cc-switch/cc-switch.db)The database is opened read-only. Key values are never sent to the browser — the UI only shows the last 4 characters. Volcano AK/SK and every other usage-query credential are read from cc-switch's own usage_script config host-side only, never echoed (upstream error messages have the credentials scrubbed); nothing lands in settings.yaml.
一个打通 cc-switch 的 DeepSeek Harness(DSH)插件:
llm-pi-ai 设置命名空间(另有一个慢速签名轮询作为兜底)。保存后约一秒内 DSH 即可使用;API key 存入 DSH 凭据服务(配置只引用名称,明文不落 settings.yaml)。同步是自愈式的:外部丢失或被改动的 ccs-* 条目会自动恢复。在 cc-switch 中切换「当前供应商」时,DSH 的 agent-default-model 会自动跟随 —— 但仅当该默认模型未设置、或本就指向同步进来的 ccs-* 路由时。若你把它钉在别处(自己的供应商条目,或第三方对我们路由的包装,例如 modlens 的 modlens-ccs-…「(modlens vision)」变体),插件绝不会改写你的选择。anthropic-messages)、API key 方式的 Codex/GPT(→ 按 wire_api 映射 openai-responses / openai-completions)、Gemini 形状的 OpenAI 兼容中转(→ openai-completions)、以及本身就是 DSH 形状的 OpenClaw 配置。OAuth 登录类供应商(ChatGPT / Gemini 官方)与 Gemini 原生端点无法表达为 DSH 路由,会在列表中标出跳过原因。llm/adapters-updated,同时设置卡片与输入栏徽章也会在 DSH 转发的 settings/document-updated / llm/adapters-updated 事件上重新读取。因此在 cc-switch 中新增、改名或改了模型列表的供应商,约一秒内就会出现在 DSH 模型选择器和本插件的界面上 —— 无需重启、无需重新打开设置页、无需等轮询。每个供应商行还会显示 DSH 是否已经提供该路由(已在 DSH 生效 / 待 DSH 注册)以及 DSH 已加载的模型数量,半生效状态一眼可见。token_plan(火山方舟、MiniMax —— 按 base_url 自动区分国内/国际站)显示套餐窗口,内置 balance 模板(DeepSeek、StepFun、SiliconFlow 国内/国际、OpenRouter、Novita AI —— 按 base_url 自动识别,与 cc-switch 自带余额服务一致)和 general/newapi 脚本显示剩余余额(脚本在 node:vm 沙箱中执行 request/extractor,自动替换 {{baseUrl}}/{{apiKey}}/{{accessToken}}/{{userId}} 占位符)。结果按路由缓存(遵循脚本配置的自动查询间隔);错误信息中的所有凭据都会被脱敏。徽章跟随会话自己的模型:它订阅客户端的模型选择状态,在输入栏切换模型的瞬间即换成该供应商的用量(每个供应商的上次结果在客户端缓存,来回切换零等待)。未配置用量查询的供应商不显示徽章。此外,插件设置卡片会为每一个启用了用量查询的供应商显示一行用量(不限于正在使用的那个)—— 套餐窗口或剩余余额,每行带独立刷新按钮。# 本地目录
dsh plugin --profile desktop add link:/path/to/dsh-switch
# 或直接从本仓库安装(无需构建 —— lib/ 已提交入库)
dsh plugin --profile desktop add github:a981008/dsh-switch
(或手动在 profile 的 package.json 依赖中加入 "dsh-switch": "link:/path/to/dsh-switch" 并加入 dsh.profile.bundles,然后 pnpm install。)
lib/(构建后的宿主端与客户端 bundle)已提交入库,且包内没有 prepare 脚本 —— 从 git 安装无需额外构建,pnpm 也不会要求你审批构建脚本。修改 src/ 后重新构建:
node build.mjs && node test/run.mjs
安装后需重启 DSH Desktop,下一个 generation 才会组合新 bundle。
面向 coding agent 的贡献者指南见 AGENTS.md —— 构建与测试命令、架构与数据流、硬性不变量、调试路径与测试约定都在里面(Claude 系工具经 CLAUDE.md 指向它)。改代码前请先读它。
dsh plugin --profile desktop remove dsh-switch
卸载插件不会删除已同步到 DSH 设置里的 ccs-* 供应商条目;不需要的话请手动删除。如果安装后 DSH Desktop 无法启动:从 ~/.dsh/profiles/desktop/package.json 的 dependencies 与 dsh.profile.bundles 中移除 dsh-switch,再重新启动即可。
~/.cc-switch/cc-switch.db)数据库以只读方式打开。密钥值不会发送到浏览器 —— 界面只显示末 4 位。火山 AK/SK 及其他用量查询凭据一律自动读取 cc-switch 自带的「用量查询」配置,只在宿主侧使用,绝不下发(上游报错信息中的凭据也会被脱敏),绝不写入 settings.yaml。
pnpm install
pnpm build # 产出 lib/index.js(宿主)+ lib/client.js(浏览器,__ModuleLoader__ 包装)
pnpm watch # watch 模式
pnpm typecheck # tsc --noEmit:esbuild 只剥离类型不做检查,这一步能拦住接口形状写错
pnpm test # 先类型检查,再跑 smoke(多类型解析/同步引擎/签名)+ integration(mock ctx 驱动全部路由与自动同步循环)
可选:设置 DSH_SWITCH_TEST_AK/DSH_SWITCH_TEST_SK 环境变量可让 smoke 测试额外跑一次真实的火山方舟额度查询。
| 字段 | 说明 |
|---|---|
enabled | 总开关;关闭后同步暂停、路由返回 disabled |
dbPath | cc-switch 数据库路径覆盖(默认 ~/.cc-switch/cc-switch.db) |
syncInterval | 兜底轮询间隔(秒,1–3600,默认 30);保存 cc-switch 会通过文件监听立即触发同步,此间隔仅覆盖监听可能遗漏的事件 |
MIT