npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-plugin-litmus

v0.1.0

Published

Automated acceptance testing for DeepSeek Harness plugins: declarative scenarios, isolated runs, assertions and LLM judging.

Readme

dsh-plugin-litmus

DeepSeek Harness 插件的自动化验收测试工具:用声明式场景(scenario.yaml)在隔离的 DSH_HOME 中真实驱动 headless agent 跑一遍,再对会话日志做断言与 LLM 评分,输出报告。CLI 命令名为 dsh-litmus。

安装

npm i -g dsh-plugin-litmus
# 或免安装直接跑
npx dsh-plugin-litmus run <dir>

前置条件

  • Node.js ≥ 22.15(会话日志解码依赖 node:zlib 的 zstdDecompressSync)。
  • 本机有 dsh 可执行(定位优先级:DEEPSEEK_HARNESS_CLI > $DSH_REPO/apps/cli/lib/bin.js(DSH_REPO 默认 D:\deepseek-harness)> PATH 中的 dsh > npx @deepseek-ai/dsh)。Windows 上若 PATH 命中 dsh.cmd/npx 无法直接执行(execFile 对 .cmd 的限制),请设置 DEEPSEEK_HARNESS_CLI 环境变量指向 dsh 的 bin.js(例如 D:\deepseek-harness\apps\cli\lib\bin.js)。
    • .cmd 路由(PATH 命中 dsh.cmd 或 npx 兜底)会经 cmd.exe shell 执行:工具会对每个参数做双引号包裹 + 内部引号转义,&、|、>、^ 等元字符不会被解释;但 cmd 批处理中 % 仍会触发环境变量展开(无法靠引号保护),prompt 含 %VAR% 样式文本时可能被改写。需要完全规避时请设置 DEEPSEEK_HARNESS_CLI 走 node bin.js 直调路径(不经 shell)。
  • DEEPSEEK_API_KEY 已导出(agent 运行与 LLM judge 都需要)。
  • 访问外网(npm 安装插件、DeepSeek API)需 HTTPS_PROXY=http://127.0.0.1:7897(按本机代理调整)。

scenario.yaml 契约

每个场景是 <dir>/<场景名>/scenario.yaml(只扫一层子目录),场景目录内其余文件会在运行时拷贝到隔离工作目录。

完整示例:

name: bib 补全与引用对账          # 必填,场景名
plugins: [dsh-latex-guard]        # 可选,默认 [];逐个 dsh plugin add(npm 包名或本地路径)
workdir: .                        # 可选;场景目录下要拷入隔离工作目录的子路径
prompt: 把 refs.bib 缺的字段补全,然后检查 main.tex 的引用是否完整。已有内容不要动。  # 必填,非空
timeout: 600                      # 可选,默认 600 秒
assertions:                       # 必填,至少 1 条
  - tool_called: bib_fill
  - file_contains: [refs.bib, "year = {2015}"]
  - tool_called: cite_audit
judge:                            # 可选;配置后用 DEEPSEEK_API_KEY 调 deepseek-chat 按 rubric 打分
  rubric:
    - 任务完成度
    - 工具选择正确性

8 种断言:

| 断言 | 写法 | 语义 | |---|---|---| | tool_called | - tool_called: <tool> | 会话中调用过该工具 | | tool_not_called | - tool_not_called: <tool> | 会话中未调用该工具 | | tool_args_contains | - tool_args_contains: [<tool>, <substr>] | 该工具某次调用的参数 JSON 包含子串 | | output_matches | - output_matches: <regex> | 最终回答匹配正则(载入时校验可编译) | | output_not_matches | - output_not_matches: <regex> | 最终回答不匹配正则 | | file_contains | - file_contains: [<path>, <substr>] | 隔离工作目录中的文件包含子串 | | file_not_contains | - file_not_contains: [<path>, <substr>] | 文件不包含子串 | | exit_code | - exit_code: <int> | headless 进程退出码等于该值 |

文件路径相对于隔离工作目录;断言全部通过场景才算 passed。校验失败报 INVALID_SCENARIO(消息含 zod 字段路径,如 assertions.0)。

headless 进程非零退出不会让场景直接 error:仍会尝试解码会话日志,交由 exit_code 等断言自行裁决(此时报告的错误栏会注明 headless exited <code>: <stderr>)。只有插件安装失败、workdir 拷贝失败才会直接判 error,超时被杀判 timeout。

用法

# 初始化两个示例场景(s1-lit-search / s2-file-workflow)
dsh-litmus init [dir]

# 运行 <dir> 下所有场景
dsh-litmus run <dir> [--report <path>] [--keep-all]

run 的行为:逐场景创建临时隔离工作目录(拷入场景文件、独立 DSH_HOME、DSH_PERMISSION_MODE=danger-full-access;子进程环境会剔除 ambient 的 DSH_* 变量,防止本机配置渗入隔离运行)→ 安装 plugins → 以 --profile headless 跑 prompt → 解码最新会话日志 → 执行断言与可选 judge → 输出 console 汇总并写 report.md(默认 <dir>/report.md)。失败场景的隔离目录保留并打印路径(--keep-all 保留全部);注意通过场景的临时目录当前也不自动删除,积累在系统临时目录(dsh-eval-*)下可自行清理。

退出码

  • 0:全部场景 passed。
  • 1:有场景 failed / timeout / error。
  • 2:用法或输入错误(场景文件不合法、目录下没有任何 scenario.yaml)。

judge 说明

场景配置 judge.rubric 后,会把工具调用序列与最终回答(截断 8000 字符)发给 deepseek-chat,按每个 rubric 维度打 0/1/2 分(0 失败 / 1 部分 / 2 达标)并附评语。judge 需要 DEEPSEEK_API_KEY;未配置 key 或请求失败时静默跳过,不影响断言判定(judge 分数只进报告,不参与 passed/failed)。

License

MIT © 2026 Flan246