dsh-research:DSH 设置里的科研插件市场

前言

DSH 的扩展方式围绕插件展开。科研用户通常需要在文献检索、参考文献管理、写作与评审等工具之间做选择,再把选中的插件安装到当前使用的 profile。

dsh-research 是一个科研插件市场。它在 DSH 的 Settings sidebar 中提供 Research plugins 页面,列出用于文献检索、参考文献管理、写作与评审的精选插件,并提供 Install 按钮写入当前运行的 profile。它是独立维护的目录站点,不是官方应用商店。

这是什么

dsh-research 的 package.json author 字段为 ai4scholar,许可证为 MIT。

它解决的问题是:把科研相关插件集中到一个设置页面,并让设置面板和浏览器目录使用同一份 market.json,避免两处列表漂移。

核心功能

  • 在 Settings sidebar 提供 Research plugins 页面,列出用于文献检索、参考文献管理、写作与评审的精选插件。
  • 提供 Install 按钮,直接写入当前运行的 profile。
  • 目录位于 dsh-research.com,浏览器列表在 https://dsh-research.com/plugins/
  • 面板与 https://dsh-research.com/plugins/ 使用同一份 market.json,列表不会漂移。
  • 通过 allowlist、same-origin、one at a time 和 profile 参数约束安装行为。
  • 支持通过 cordis.patch.yml 覆盖 id 为 research-market 的配置行。
  • catalogUrl 可指向实现 DSH Community Market provider contract 的端点。

安装与启用

下面先安装 dsh-research 本身:

dsh plugin --profile web add dsh-research

该命令把插件装入 web profile。安装后重启 dsh web,然后打开:

Settings → Research plugins

新安装的插件需要重启后才能加载。

典型用法

浏览并安装目录中的插件

打开 Research plugins 页面后,选择目录中列出的插件并点击 Install。面板会执行当前 profile 的 dsh plugin add 命令。安装目标取自该 host 启动时的 --profile,因此测试 profile 不会修改真实 profile。

将面板设为只读

如果只想浏览,不希望页面触发安装,可以从 profile 的 cordis.patch.yml 覆盖 id 为 research-market 的配置:

- id: research-market
  config:
    allowInstall: false

cordis.patch.yml 的 patch 会替换整个 config。覆盖时需要重新声明要保留的每个 key;上面的示例只展示 allowInstall: false

指向自定义市场

catalogUrl 指向自定义端点后,面板可以列出自己的市场。该端点需要实现 DSH Community Market provider contract。

安装行为约束

  • allowlist:浏览器可以请求任意包名,但只有目录中列出的包会被启动;其他包名不会被启动。
  • same-origin:避免 state-changing route 被任意页面触发,从而避免从已访问站点向 profile 安装包。
  • one at a time:避免两个 dsh plugin add 并发运行导致 package.json 竞争并造成 profile 半写入。
  • profile:安装目标取自 host 启动时的 --profile

安全注意

安装会调用当前 DSH 主机可用的 dsh 命令,并影响当前 profile。插件以当前 dsh 进程权限运行,安装前应检查插件源码与许可证。dsh-research 本身的许可证为 MIT;目录中的其他插件需按其目录条目和许可证单独判断。

实现细节

进程层改编自 dsh-market(MIT)。其说明中记录了以下运行环境细节:

  • ctx.shell 无法写入 profile。
  • macOS 应用从 Dock 启动时,可能没有 Homebrew PATH。
  • pnpm v10 在无 TTY 场景下可能需要设置 CI
  • Windows 下 dsh.cmd shim。

结尾

dsh-research 的价值在于把科研插件的浏览、安装和配置收进 DSH 设置,并用同一份目录文件保持面板与浏览器列表一致。

目录页:

  • https://dsh-research.com/plugins/

GitHub:

  • https://github.com/dsh-research/dsh-research
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜