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-evaluation/portable-runner

v0.1.12

Published

Host-independent runner for DSH Portable Case Plans

Downloads

1,557

Readme

@dsh-plugin-evaluation/portable-runner

English · 简体中文 · 日本語

与宿主环境无关的 DSH Portable Case Plan(可移植评测方案)执行器。

用途

Runner 负责创建临时工作区、执行准备步骤、调用宿主提供的插件函数、运行评测指标,并在结束后清理工作区。它不会启动 DSH、Web 服务或插件进程;进程隔离、凭证和网络权限由宿主负责。

安装

需要 Node.js 20 或更高版本:

npm install @dsh-plugin-evaluation/[email protected]

最小示例

import { runPortableCasePlan } from '@dsh-plugin-evaluation/portable-runner'

const report = await runPortableCasePlan({
  plan: {
    schemaVersion: 1,
    id: 'smoke',
    steps: [{ op: 'plugin.prompt', input: '返回 OK' }],
    metrics: [{ id: 'answer', type: 'output.equals', expected: 'OK' }],
  },
  runPlugin: async ({ input }) => ({ output: input === '返回 OK' ? 'OK' : 'FAIL' }),
})

console.log(report.status) // passed | failed

runPlugin 是宿主提供的回调,会收到输入、临时工作区、环境变量和会话记录。它可以返回 outputstdoutstderrexitCodetimedOutfilestoolCalls

CLI

npx portable-runner \
  --plan ./plan.json \
  --format json \
  --timeout-ms 30000 \
  --command node -- ./plugin-adapter.mjs

-- 后面的内容是外部命令。Runner 通过 PORTABLE_RUNNER_INPUT_DIRPORTABLE_RUNNER_OUTPUT_DIR 与适配器交换文件。退出码 0 表示通过,1 表示评测失败,2 表示协议或 CLI 错误,124 表示超时。

常用 API

  • runPortableCasePlan:执行单个评测方案并返回结构化报告。
  • defineFixturedefineCasedefineSuite:组合可复用的夹具、方案和测试套件。
  • createStepRegistry:注册自定义执行步骤。
  • createMetricRegistry:注册自定义评测规则。
  • createReporterRegistry:输出 JSON、Markdown、JUnit 或自定义格式。
  • limits:限制超时时间、最大步骤数和最大指标数。
  • errorMode: 'report':把插件异常转换成 execution-failed 检查项。

开发与文档

npm install
npm test
npm run docs:generate
npm run verify

快速文档在 docs/index.html,完整 API 文档由 TypeDoc 从 TypeScript 源码生成到 docs/api

发布

更新 package.json 版本并创建同名 tag 后推送:

npm version patch
git push origin main --follow-tags

推送 vX.Y.Z 后,GitHub Actions 会验证版本、运行测试并通过 npm Trusted Publishing 发布包。

安全边界

每次执行使用独立临时工作区,拒绝路径遍历和 NUL 字节,并对证据和输出进行大小限制及敏感值脱敏。宿主仍必须自行限制插件进程、凭证、网络和文件系统权限。

许可证

MIT