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-js-tools

v0.1.0

Published

DSH (DeepSeek Harness) 通用测量工具插件:text_stats 精确字数统计 + evaluate_expression 安全表达式求值,适配 DSH 0.2.1-alpha.3

Readme

dsh-js-tools

DSH(DeepSeek Harness)通用测量工具插件。给 DSH 会话里的模型装上"精确测量"能力:字数统计与数学表达式求值,专治判分/评测 rubric 里的目测问题。

适配版本:DSH 0.2.1-alpha.3(依赖 @deepseek-ai/dsh-tools 同版本对齐)

工具清单

1. text_stats — 精确字数统计

统计一段文本的精确字数,不要目测。判分中涉及「字数上限/下限」「篇幅」「长度」类 Rubric 时,模型会先调用本工具拿到精确数字再下结论。

返回字段:

| 字段 | 说明 | |---|---| | characters | 字符数(含空白) | | bytes | UTF-8 字节数 | | lines | 行数 | | nonEmptyLines | 非空行数 | | words | 单词数(按空白切分) | | cjkCharacters | 汉字数(CJK 统一表意文字) | | whitespace | 空白字符数 | | nonAsciiCharacters | 非 ASCII 字符数 | | estimatedTokens | 估算 token 数(CJK 0.6/字符,其他 0.25/字符) |

超大文本(>10 万字符)请先分段再逐段调用。

2. evaluate_expression — 安全表达式求值

计算数学表达式,返回数值结果。支持四则运算、括号、幂(^)、百分号(%)。判分中涉及数字计算、比例换算、金额/权重计算的 Rubric 精确判定。

示例:3 * 4 + 2、(85 + 90) / 2、7 * 30、1200 * 0.2

安全设计:输入白名单过滤(仅数字/运算符/括号/小数点),禁止任何标识符,防注入。

安装

# 在 DSH profile 目录下
dsh plugin --profile xeval add -w dsh-js-tools

安装后可用 dsh plugin --profile xeval dump-config 确认插件进入依赖树。

使用

插件通过 ctx.tools.register 注册工具,DSH 会话内模型可自动调用。判分/评测场景建议在 prompt 中追加工具提示段,声明可用工具及"字数类/数值类 rubric 必须调用工具精确实测、禁止目测"的约束,模型才会主动调用。

可用工具:
- text_stats:精确统计文本字数(字符/行/词/CJK/token),涉及字数类 Rubric 必须先调用再判定,禁止目测。
- evaluate_expression:计算数学表达式,涉及数值计算类 Rubric 必须先调用再判定。

验证

已在 $OMB(OneMillion-Bench)判分链路实测通过:

  • q_293 字数 rubric(超 2000 字扣分):模型调用 text_stats 实测 2836 字符(CJK 2287) 后精确判定,不再目测
  • 无字数/数值类 rubric 的题目,模型按需判断不调用工具,正常判分

为什么自写

社区同类插件存在兼容性问题:

  • dsh-text-stats:cannot set property "textStats" without provide(缺 provide 声明)
  • dsh-plugin-calculator:依赖旧版 @deepseek-ai/[email protected],与 DSH 0.2.1-alpha.3 不兼容

本插件按 DSH 0.2.1-alpha.3 的 defineTool API 编写,版本对齐。

License

MIT