Back to home

V-dev-388

DSH-plugin-market

DSH 插件市场:管理 HTTPS 插件仓库、校验下载并管理静态插件插拔。

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

DSH 插件市场

这是一个 DSH 插件包,包名为 @deepseek-ai/dsh-host-plugin-market。它同时提供 Host 插件市场和 Web 设置页:用户可以在设置页添加 HTTPS 插件仓库、刷新目录、安装/移除插件,并对静态插件做启用/停用管理。

功能

  • 管理用户添加的插件仓库,仓库状态保存在 $DSH_HOME/plugins/market/repositories.json
  • 下载前验证 HTTPS、manifest 字段、entry 路径和 SHA-256 校验和。
  • 静态插件默认展示插拔状态,安装后默认停用,启用/停用写入 $DSH_HOME/plugins/market/static.patch.yml,下次启动 DSH 时生效。
  • 动态插件默认只展示运行/停止状态;只有 manifest 声明 controllable: true,且 Host 显式注入可释放的生命周期控制器时,才提供手动启动/停止。
  • 不自动执行下载的插件代码;下载内容只写入已校验的安装目录。

仓库格式

仓库是一个 HTTPS JSON 文件,当前 schema 版本为 1

{
  "version": 1,
  "plugins": [
    {
      "id": "example-static",
      "name": "示例静态插件",
      "version": "1.0.0",
      "description": "一个经过校验的静态插件。",
      "type": "static",
      "downloadUrl": "https://example.com/plugins/example-static/index.js",
      "checksum": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
      "entry": "index.js",
      "permissions": ["settings.read"],
      "config": {
        "example": true
      }
    }
  ]
}

字段要求:

  • id[a-z0-9][a-z0-9._-]{0,63}
  • typestaticdynamic
  • downloadUrl:必须为 HTTPS。
  • checksum:小写 SHA-256 十六进制摘要。
  • entry:相对路径,禁止绝对路径、反斜杠和 ..
  • permissionsconfigcontrollable 为可选字段。

安装

当前 DSH 主线还没有合并本插件所需的 Host 挂载逻辑。首次接入前,请先阅读 核心集成补丁,并把对应改动合入 DSH 核心。

核心补丁就绪后,把本仓库作为依赖加入 DSH 的 profile 或 web bundle,并让 dsh.bundle.patch 指向本包的 cordis.patch.yml

{
  "dependencies": {
    "@deepseek-ai/dsh-host-plugin-market": "github:V-dev-388/DSH-plugin-market"
  }
}

然后在本包的 cordis.patch.yml 加入对应 bundle 层,或按你的 DSH profile 配置直接挂载 @deepseek-ai/dsh-host-plugin-market 行。

安全边界

  • 仓库和下载地址都必须是 HTTPS。
  • manifest 会校验版本、重复 ID、字段类型、路径穿越和 SHA-256。
  • 下载先写临时目录,校验成功后原子替换安装目录。
  • 静态插件只通过 Host 生成的 Loader patch 加载;动态插件不会自动启动任意下载代码。

开发与验证

npm run test
npm run verify

npm run verify 会先运行静态验证,再执行 npm pack --dry-run 检查发布内容。本仓库的 lib/ 是已经生成的发布产物,vendor/upstream/ 保留可对照的 Host/Client 源码。