DSH Artifacts 工件库插件:侧边栏浏览与工件斜杠命令

前言

在 DeepSeek Harness(DSH)里用智能体产出独立 HTML「工件」(artifact)时,常见做法是依赖 artifact-create、artifact-store 等 skill 完成生成与落盘,但 Web 端缺少一个集中浏览、搜索、预览本地缓存的入口。命令与 skill 分散时,也要先弄清该用哪条斜杠命令、保存后缓存何时可见。

liush2yuxjtu/dsh-artifacts-extension 是 MIT 许可的社区客户端插件(npm 包名 @local/dsh-artifacts,当前资料记载版本 0.1.3)。它在 DSH Web 侧边栏增加只读的 Artifacts 面板,并把 artifact-create、artifact-store、artifact-tweaks 三类能力接到 /artifact-create、/artifact-store、/artifact-tweak 斜杠命令上。面板本身不写 store、不写 GitHub;读写仍由 artifact-store skill 完成。

这是什么

  • 仓库:https://github.com/liush2yuxjtu/dsh-artifacts-extension
  • 维护者:liush2yuxjtu(package.json 作者字段为 Liu Shiyu)
  • 分类:客户端(DSH dsh.client.platform 为 web)
  • 许可:MIT
  • 环境要求(README 声明):DSH >=0.2.1-rc.2,Node.js >=22,可用的 dsh web 安装

插件读取本地 artifact-store 缓存,支持按 slug、标题、描述、标签搜索与标签筛选,展示详情与预览,并提供复制 artifacts/<slug>/index.html 路径的按钮。

核心功能

侧边栏 Artifacts 面板

  • 面板插在 Plugins 与 Automation tasks 之间,order: 5。
  • 列表数据来自 ~/.dsh/cache/artifact-store/<owner>__<repo>/index.json,按更新时间排序。
  • 预览在 iframe 中使用 sandbox="allow-scripts" 加载 index.html;不含 allow-same-origin,与 DSH 既有 HTML 预览行为一致。需要 localStorage 的交互应在新标签页打开工件。
  • 独立查看路由为 /dsh-artifacts/view/<slug>,会注入 <base> 以便相对路径资源加载。
  • 通过 skill 写入缓存后,需在面板点击 Refresh;面板不是 GitHub 的实时视图。

斜杠命令(依赖外部 skill)

扩展不打包 artifact-create、artifact-store、artifact-tweaks skill,运行环境中须已具备这些 skill。命令结果写入 command lifecycle 日志,而非模型历史。

命令 行为(摘自 README)
/artifact-create <description> 入队不可变用户消息,要求智能体加载 artifact-create、构建并校验工件;空参数返回用法错误。
/artifact-store 仅从本地缓存列出工件,不启动模型轮次。
/artifact-store status 显示仓库、缓存位置与工件数量。
/artifact-store list 列出缓存中的工件。
/artifact-store save ... 启动轮次,由 skill 保存工件。
/artifact-store load <slug> 启动轮次,由 skill 加载工件。
/artifact-store history <slug> 启动轮次,查看版本历史。
/artifact-store restore <slug> <commit> 启动轮次,恢复旧版本。
/artifact-store help 显示命令用法。
/artifact-tweak <request> 入队不可变用户消息,要求加载 artifact-tweaks 并添加 Tweaks 面板;空参数返回用法错误。

宿主路由与安全

路由前缀为 /dsh-artifacts。对各路由会校验 Host、Origin 与浏览器 Cookie;无 Cookie 返回 401。路径经 realpath 边界检查;未知 slug、目录穿越与符号链接逃逸返回 404。工件来自用户私有 store,按本地可信内容处理。

主要路由:GET /dsh-artifacts/list(元数据 JSON)、preview/<slug>(preview.png)、html/<slug>(iframe srcdoc 用原始 index.html)、view/<slug>(带 <base> 的 index.html)、asset/<slug>/<path>(工件目录内相对资源)。

安装与启用

官方说明面向 web profile。包标记为 private: true,资料中的安装路径为 GitHub 而非假定 npm 公开发布。

1、进入 Web profile 目录并添加依赖:

cd ~/.dsh/profiles/web
pnpm add github:liush2yuxjtu/dsh-artifacts-extension

2、在该 profile 的 package.json 中,将 @local/dsh-artifacts 加入 dsh.profile.bundles,并保留原有 bundles 与依赖,例如:

{
  "dependencies": {
    "@local/dsh-artifacts": "github:liush2yuxjtu/dsh-artifacts-extension"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-web-app",
        "@local/dsh-artifacts"
      ]
    }
  }
}

3、安装 profile 依赖并重启或等待 HMR 重组 profile:

pnpm install

浏览工件前,须通过 artifact-store skill 的 init 流程配置 ~/.dsh/artifact-store.json;面板读取的是上述配置对应的本地缓存。

本地开发可用 link 安装(路径改为本机绝对路径):

cd ~/.dsh/profiles/web
pnpm add link:/absolute/path/to/dsh-artifacts-extension

卸载:pnpm remove @local/dsh-artifacts,并从 dsh.profile.bundles 中移除 @local/dsh-artifacts。

典型用法

1、完成 artifact-store 的 init,确保 ~/.dsh/artifact-store.json 与缓存目录有效。
2、重启或刷新 dsh web,在侧边栏打开 Artifacts,搜索 slug、标题、描述或标签,打开预览;保存新工件后点击 Refresh。
3、在已有 Client Session 中使用斜杠命令(空白页上第一条命令可能被当作普通提示;README 要求先进入已有会话)。例如列出缓存:/artifact-store list;创建工件:/artifact-create <描述>;微调:/artifact-tweak <需求>。
4、复制面板提供的 artifacts/<slug>/index.html 路径,或在需要完整交互时通过新标签打开 /dsh-artifacts/view/<slug>。

社区目录索引(format-1)位于仓库 market/index.json;若使用 DSH 实验性插件市场 bundle,可在 Plugins → Discover 添加索引 URL 后搜索中文标题 工件库(维护者自定义标签 Featured,不代表第三方背书)。索引示例配置见 README 中的 cordis.patch.yml 片段。

适用场景与注意

适合:在 DSH Web 中管理自成一体的 HTML 工件,需要只读库式浏览、搜索预览,并希望通过统一斜杠命令衔接 create/store/tweak 工作流的用户。

注意:

  • 插件以当前 DSH 进程权限运行;安装前应自行审阅源码与 MIT 许可证。
  • 声明的 DSH 版本范围为 >=0.2.1-rc.2,不保证与之后每个 DSH 版本兼容。
  • 面板为空或提示缺少 store:走 artifact-store skill 的 init。新保存不可见:执行写操作后点 Refresh。
  • DSH 插件生态强调「一切皆插件」;SkillHub 等社区目录为独立站点,与 DeepSeek / 幻方无官方从属关系,本文不作官方应用商店表述。

结尾

dsh-artifacts-extension 把本地 artifact 缓存接到 Web 侧边栏与三条斜杠命令,与 artifact-store 等 skill 分工明确:skill 负责读写与版本,插件负责浏览、预览与命令入口。更多说明见仓库 README(含简体中文 README.zh-CN.md)。

  • 目录页:https://www.skillhub.cn/plugins/liush2yuxjtu/dsh-artifacts-extension
  • GitHub:https://github.com/liush2yuxjtu/dsh-artifacts-extension
羽毛球分组比赛记分
小程序二维码

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

Xiaoye