dsh-market/plugin/ui

42Stars1Forks5Issues0Watchers

DSH 侧边栏插件版:在 DSH 侧边栏注入「插件市场」入口与 6-Tab 面板,提供浏览/搜索/个性化推荐/一键安装/已装管理/GitHub 加星等能力。

Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki

This plugin is a sub-package of the 2BingLing/dsh-market monorepo — stars and activity count the whole repository.

Language
TypeScript
License
NOASSERTION
Branch
master
deepseek-harnessdeepseek-harness-plugindeepseek-harness-pluginsdshdsh-bundledsh-marketdsh-plugindsh-plugins

Install

$ dsh plugin --profile web add github:2BingLing/dsh-market/plugin/ui

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin 2BingLing/dsh-market/plugin/ui for me: review the repository at https://github.com/2BingLing/dsh-market.git first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

一句话定位

DSH 生态的「插件市场」cordis 插件版:把整个市场搬进 DSH 侧边栏——浏览、搜索、个性化推荐、一键安装/卸载、GitHub 加星,6-Tab 面板随叫随到,零 token 常驻。

核心能力

  • 侧边栏入口与全屏面板:注册 sidebar.footer.action 槽位显示「插件市场」按钮,shell.overlay 槽位挂载 6-Tab 全屏浮层面板,按钮与面板开关状态用 store 跨 slot 共享(plugin/ui/src/client/index.ts:13-61)
  • 浏览与搜索:从 plugins.json 拉全量已收录插件,本地 Fuse.js 关键词检索、中文标签筛选、类型/无需配置过滤;面板里 200+ 结果分页展示
  • 个性化推荐(5 路):冷启动问卷 / 已装插件 / GitHub 加星 / 本地收藏 / 场景推荐(读会话标题+最近消息+工具名,零 token)共同构成画像,每条推荐附「为什么推荐」理由
  • 一键安装与卸载:skill 型 git clone 到 skills 目录,cordis 型 dsh plugin --profile X add <pkg>;每步带快照、失败重试(最多 2 次)、失败自动回滚;卸载时按依赖键名精确移除(pnpm 大小写敏感)
  • 已装管理与自更新:自动扫描 ~/.agents/skills 和 profile package.json 识别已装项;通过 npm registry(cordis 型)与 GitHub pushedAt(skill 型)给出更新提示;面板内可对插件自身发起自更新
  • GitHub 集成:设置页支持设备流(GitHub App)或 PAT 两种绑定方式,PAT 模式下可直接在面板给市场里的插件仓库加星/取消加星,并把星标仓库同步进画像

技术实现

  • 语言: TypeScript(ESM,Node half + 浏览器 half 双入口;浏览器侧用 React 18 + React.createElement 无 JSX 写法)
  • 关键依赖: @dsh-market/core(纯 Node 逻辑层:搜索/画像/安装/更新/GitHub)、@dsh-market/schema(共享类型)、fuse.js(本地模糊搜索)、react ^18(浏览器侧面板)
  • 架构模式: cordis 双半插件 — Node half (apply(ctx)) 注册 /market/api 的 POST JSON-RPC 路由并向 harness 拿 agents/subagents/sessionQuery/llm 服务;Browser half 用 ctx.slots.inject 把触发器塞进 sidebar.footer.action、把面板塞进 shell.overlay;包级声明 dsh.bundle.patch: ./cordis.patch.yml + dsh.client.inject 三个平台种子模块让宿主加载并服务化
  • 入口文件: plugin/ui/src/index.ts(Node half,导出 name = 'dsh-market'inject = ['webServer'])/ plugin/ui/src/client/index.ts(浏览器 half,导出 inject = ['slots'])/ plugin/ui/cordis.patch.yml(bundle 注入声明)

适用场景

刚装好 DSH 不确定该装什么的人——插件版用「冷启动问卷+精选+场景推荐」让新手 3 分钟就能挑到合适的插件;想免记命令的人——一键安装免去手敲 dsh plugin addgit clone;插件越装越多需要统一管理的人——已装 Tab 自动检测 skill 目录和 profile 依赖,给出更新与卸载入口;想按自己偏好被推荐的人——画像随使用自动更新,越用越懂你。

前置依赖与兼容性

依赖最低版本说明
DeepSeek Harness (cordis web profile)未声明plugin/ui/package.json 未声明 peerDependencies;通过 dsh.bundle.patch + dsh.client.inject 注入;宿主 web profile 必须启用 @deepseek-ai/dsh-client-runtime / -locale / -ui-slots 三个平台种子模块
Node>=20仓库根 package.json 的 engines 字段(plugin/ui 与 plugin/core 自身未声明 engines)
平台macOS / Windows / LinuxNode half 命令执行器在 Windows 上走 ComSpec ?? cmd.exe,目录删除内置 5 次重试 + rmdir /s /q 兜底;其他平台走默认 shell
原生模块仅依赖 Node 内建模块(node:fs / node:child_process / node:http / node:path)与浏览器 fetch,未引入 native binding

安装方式

dsh plugin --profile web add github:2BingLing/dsh-market/plugin/ui

安装后重启 harness,DSH 侧边栏底部会出现「插件市场」图标按钮,点击打开 6-Tab 面板:推荐 / 搜索 / 整合包 / 收藏 / 已装 / 设置。

配置项

配置类型说明默认值
DSH_HOME路径环境变量改写 DSH 主目录(skills / profiles / 数据子目录都从其下派生)~/.dsh
DSH_SKILLS_DIR路径环境变量skill 型插件的安装目录优先取 $DSH_HOME/skills,否则 ~/.agents/skills
DSH_PROFILES_DIR路径环境变量profile 依赖清单所在目录$DSH_HOME/profiles
DSH_MARKET_DATA_DIR路径环境变量本插件的数据目录(画像 / 设置 / GitHub 绑定 / 安装快照)$DSH_HOME/plugins/dsh-market
推荐模式(modeOverride)auto / novice / veterannovice 更偏精选通用款,veteran 放开个性化权重,auto 走画像自动档auto
目标 profile字符串一键安装 / 卸载 / 自更新落到哪个 profileweb
GitHub 绑定设备流 token 或 PAT用于同步加星列表与在面板里给仓库加星(PAT 才能直接加星)未绑定

本地配置文件落在 $DSH_MARKET_DATA_DIR/ 下:profile.json(画像)/ settings.json(模式 + profile 覆盖)/ binding.json(GitHub 凭据)/ snapshots/(每次安装的快照,失败时用于回滚)。

常见问题

Q: 这个子包和 dsh-market 根仓库是啥关系?我应该装哪个?

A: 根仓库是一个 monorepo(collector 数据管道 + web 静态站 + plugin/core 逻辑层 + plugin/ui 插件版)。装 plugin/ui 即可获得侧边栏面板;plugin/coreplugin/ui 的依赖,宿主在装 ui 时会自动带上。Web 版(dsh.market)和插件版仅共享同一份 plugins.json 数据,互相独立——装插件不影响 Web 站,反之亦然。

Q: 安装失败会不会留下半成品?

A: 不会。安装器在执行前会拍快照(旧 skill 目录备份到 .bak-<时间戳>、旧 profile package.json 内容),失败时自动回滚;克隆和 dsh plugin add 每步最多重试 2 次才放弃,UI 把每一步的状态(pending/running/done/failed/skipped)实时回显。

Q: 卸载插件后本插件的数据还在吗?

A: 本插件自己的本地数据(画像、设置、GitHub 绑定、收藏、安装快照)全部留在 ~/.dsh/plugins/dsh-market/,重装后画像能接着用;它只删你从市场里装的第三方插件(删 skill 目录或从 profile 依赖里移除包名)。

Q: 自更新弹「EPERM」怎么处理?

A: 因为 harness 正在运行,pnpm 替换插件目录里的文件可能被占用。UI 会给出可执行的修复指引:先停掉 harness,然后跑 npx @deepseek-ai/dsh plugin --profile <profile> add @dsh-market/plugin@latest,再重启 harness。

Q: 哪些功能需要联网,哪些能离线?

A: 浏览/搜索/推荐/一键安装/卸载/自更新/GitHub 加星都需要联网;本地画像、收藏、设置、Fuse 索引能离线复用上次缓存。设备流 token 不支持加星(GitHub API 不允许),需要 PAT。

Q: AI 语义搜索、AI 代理安装、场景推荐的前提是什么?

A: 这三项调用 harness 的内部服务——「场景推荐」要 sessionQuery、「AI 语义搜索」要 llm、「AI 代理安装」要 subagentsagents。宿主版本较旧或对应服务未注册时,UI 会降级或返回明确错误,不影响基础浏览/搜索/本地安装。

Q: 一键安装的原理是什么?失败能回滚吗?

A: skill 型 = git clone --depth 1 <repo> <skillsDir>/<name>-latest,已装则跳过;cordis 型 = dsh plugin --profile <target> add <pkg>,已装则跳过。每步执行前先做「安装前快照」,任何一步失败立即回滚(删新目录 / 恢复旧 package.json),最多重试 2 次。

上手难度

入门 — 默认零配置即可使用,进阶功能(GitHub 绑定、自更新、AI 代理安装)藏在「设置」里按需打开;不需要背任何命令。

已知问题与限制

  • 自更新 EPERM:harness 进程占着插件目录文件时 pnpm 覆盖会被拒,UI 必须提示用户先停 harness 再装 @latest 重启(plugin/ui/src/index.ts:179-202)
  • cordis 插件卸载依赖键名大小写敏感:市场里 plugin.name 是 GitHub 仓库原大小写(如 DSH-better-sidebar),直接推断会卸载失败,必须用 localName(已装项的实际依赖键名 / 目录名)才能正确移除(plugin/ui/src/index.ts:366-374 / plugin/core/src/installer.ts:329-333)
  • Windows 上删 skill 目录可能被占用:内置 5 次重试 + rmdir /s /q 系统命令兜底,但仍可能需要关闭占用进程才能完全删干净(plugin/core/src/installer.ts:289-310)
  • AI 语义搜索固定召回 60 个候选池:插件量增长时召回深度不会同步增加,避免 token 失控,但同时限制了长尾召回(plugin/ui/src/index.ts:286-337)
  • AI 代理安装与 AI 语义搜索需要宿主服务:依赖 harness 暴露 subagents / llm / sessionQuery 服务,老版本宿主可能缺失,UI 会返回明确错误(plugin/ui/src/index.ts:286-414)
  • GitHub 设备流 token 不能加星:设备流是 GitHub App OAuth,API 不开放 user/starred 端点,加星必须在「设置」里改用 PAT(plugin/ui/src/client/panel.tsx:175-179)
  • 整合包 Tab 是浏览入口,不直接装:v0.1 实现是「点击打开包作者仓库页,由包作者提供安装方式」,不直接接管整合包安装(plugin/ui/src/client/panel.tsx:1571-1574)

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/2BingLing/dsh-market/plugin/ui)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory