
omdsh-dev/dsh-tool-stat
40Last commit Aug 14, 2026
dsh-tool-stat DSH plugin
dsh-tool-stat is a zero-dependency, pure-function DSH plugin that provides deterministic statistical calculations on finite numeric arrays. It supports describe, percentile, frequency, and correlation actions with strong numerical stability and safety constraints.
How to install the dsh-tool-stat DSH plugin
dsh plugin --profile web add github:omdsh-dev/dsh-tool-statCopying does not run this command. Review the repository and version before installing the dsh-tool-stat DSH plugin.
dsh-tool-stat DSH plugin data source
dsh-tool-stat DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-tool-stat DSH plugin can do
- Compute descriptive statistics (count, sum, min, max, mean, median, variance, standard deviation, quartiles, IQR) with Neumaier compensated summation and Welford online algorithm.
- Calculate one or more percentiles using linear interpolation with robust handling of duplicate requests.
- Generate frequency distribution tables with value, count, and ratio, up to 10,000 distinct values.
- Compute Pearson or Spearman (midrank) correlation coefficient with zero-variance detection returning defined:false.
- Enforce strict finite number inputs (reject NaN/Infinity with index location), overflow check, and deterministic output.
Where the dsh-tool-stat DSH plugin fits
- Aggregate CSV/JSON numeric arrays inside DSH without external tools.
- Calculate percentiles (e.g., median, P90) for performance monitoring or data analysis.
- Build frequency distribution of categorical-like numeric data for insights.
- Compute correlation between two numeric series to assess relationships.
- Validate numerical computations with reproducible, verifiable results.
Who the dsh-tool-stat DSH plugin is for
- AI agent developers integrating statistical analysis into DSH workflows.
- Data analysts who need quick, reliable numeric summaries within a chat environment.
- DSH users who want deterministic, auditable calculations without external dependencies.
dsh-tool-stat DSH plugin limitations
- Only accepts finite numeric arrays (1 to 100,000 values); NaN/Infinity cause errors.
- Percentile and frequency requests capped: ≤100 percentiles, ≤10,000 distinct values.
- Correlation with zero variance returns undefined (defined:false) rather than NaN.
- Does not read files, access network, or create processes; operates solely on passed values.
- Tool parameters are logged in session history; avoid passing sensitive data.
dsh-tool-stat DSH plugin: from the repository README
Quoted from the omdsh-dev/dsh-tool-stat README, the upstream source of the dsh-tool-stat DSH plugin. Copyright remains with the original authors.
DSH 统计工具插件 —— 描述统计、百分位数、频数分布、相关性计算。零依赖、纯函数、确定性。 [](LICENSE) ## 动机 Agent 处理数值数据时,从 CSV / JSON 提取出数值数组后往往需要聚合分析(均值、分位数、分布、相关性)。现有工具链没有这类能力: 1. **`calculator` 只做单表达式求值**——一个表达式算不出分位数分布,更算不了相关系数 2. **`dsh-tool-csv` 的 `stats` 只报告行/列结构**——不提供对一组观测值的统计聚合 3. **模型"心算"统计不可验证**——均值、方差、百分位、相关性涉及大量浮点运算,手算错误率极高,且无法给用户展示可复现的过程 本插件接收显式传入的有限数值数组或成对观测值,提供确定性的统计计算:一次函数调用,毫秒级返回结构化 JSON 报告。不读取文件、不访问网络、不创建进程、不保存状态——相同输入永远得到相同输出。 ## 安全模型 - **零依赖**:Neumaier 补偿求和、Welford 在线方差、线性插值百分位、Spearman midrank 全部手写,无第三方数值库 - **有限数强约束**:拒绝 `NaN` / `Infinity`(错误信息带下标定位,如 `values[3] must be a finite number (got Infinity)`);`-0` 在输入与输出中均规范化为 `0` - **溢出回检**:所有结果在返回前再次做有限数检查,中间或最终结果溢出返回 `numeric-overflow` 错误——canonical 输出**绝不含**非有限值 - **纯函数**:输入数组永不被修改(只读遍历;需要排序时先拷贝) - **零方差语义**:`correlation` 遇零方差配对返回 `defined: false` + `reason: "zero-variance"`,而不是 NaN 或 ±Infinity - **预算**: - 观测值 1..100,000(超限直接报错) - 百分位请求 ≤ 100 个 - distinct 输出 ≤ 10,000(超出按确定规则截断并标注) - `timeoutMs: 2000` - 工具参数会记入会话日志,不要传入敏感数据 ## 工具声明 注册 `stat` 工具(`@deepseek-ai/dsh-tool-stat`,row id `tool-stat`),统一输出 JSON 文本字符串。 | action | 作用 | 输出 | |---|---|---| | `describe` | 描述统计 | count / s
Read the full READMERepository license: MIT
dsh-tool-stat DSH plugin questions
How do I install dsh-tool-stat in DSH?
Run `dsh plugin --profile web add github:omdsh-dev/dsh-tool-stat` to install it into your web profile. For headless profile, use `--profile headless` instead. You can also use a tarball from `npm pack` and add it with `dsh plugin --profile web add ./dsh-tool-stat-<version>.tgz`.
What actions does dsh-tool-stat support?
It supports four actions: `describe` for descriptive statistics, `percentile` for computing percentiles, `frequency` for frequency distribution, and `correlation` for Pearson or Spearman correlation coefficient. Each action returns a structured JSON result.
How do I handle missing values or NaN in my data?
The plugin strictly rejects NaN and Infinity values. If your data contains invalid numbers, the call will return an error with a message like `values[3] must be a finite number (got Infinity)`. You must clean your data (e.g., remove or impute missing values) before passing it to the tool.
What is the difference between 'sample' and 'population' variance?
The `sample` parameter controls the denominator for variance calculation. When `sample` is true, the plugin uses the sample variance formula (dividing by n-1) for unbiased estimation. When false (default), it uses the population variance formula (dividing by n). This affects the `variance` and `standardDeviation` fields in the `describe` output.
Can I compute correlation between two arrays with different lengths?
No, the `other` array must have the same length as `values` (both must have at least 2 elements). If lengths differ, the plugin will likely return an error. The correlation action requires paired observations.