dshbase

插件目录 / Data / dsh-units

dsh-units

已验证 · 实测可装 TYEclipse

✓ 持续维护

查看 GitHub ↗ ← 返回插件目录

3Stars
0Forks
0未关闭 issue
—语言
2026-08-22最近推送
跨平台平台

功能简介

Unit conversion toolbox for DeepSeek Harness (dsh): 17 categories — power (3 horsepower definitions), force, torque, typography (px/pt/em/rem), fuel economy (mpg ↔ L/100km), data sizes (MB vs MiB) — zero runtime dependencies

✅
我们的评价
可用 — 实测通过,早期项目

Unit conversion toolbox for DeepSeek Harness (dsh): 17 categories — power (3 horsepower definitions), force, torque, typography (px/pt/em/rem), fuel economy (mpg ↔ L/100km), data sizes (MB vs MiB) — zero runtime dependencies 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

dsh-units 📐

Unit conversion toolbox for DeepSeek Harness (dsh) — 17 categories, zero runtime dependencies, pure arithmetic over a static unit table (no network, no filesystem, no code execution).

When your agent needs to answer "how many miles is 100 km?", "is 1 MB bigger than 1 MiB?", "what's 350°F in Celsius?", "how many tablespoons in 2 cups?", "16px is how many pt?", "20 mpg in L/100km?" or "150 kW is how much mechanical horsepower?" — instead of doing error-prone mental math, it can call these tools and read exact results.

中文简介:dsh-units 是 DeepSeek Harness 的单位换算工具箱插件,覆盖长度、质量、温度、面积、体积(含美制烹饪单位)、速度、时长、数据大小(十进制 MB 与二进制 MiB 严格区分)、压强、能量、角度、频率、功率(机械/公制/电动马力严格区分)、力、扭矩、排版印刷(px/pt/em/rem)、油耗(L/100km ↔ mpg ↔ km/L)共 17 个类别,零运行时依赖、纯算术实现,无网络无副作用。让 Agent 不再心算——特别是"MB/MiB 混淆""华氏摄氏互转""加仑换升""mpg 与 L/100km 互算""三种马力混淆"这类高频出错点,直接调用工具拿精确结果。

Why it exists

  • LLMs are unreliable at unit math. Temperatures are affine (offset), data sizes mix decimal and binary prefixes, fuel economy is reciprocal (mpg vs. L/100km), and compound units (km/h, psi, kcal) hide awkward factors. A wrong conversion silently corrupts reports, recipes, travel plans, and capacity math.
  • Fully deterministic and offline. Every factor lives in the static table in src/units.ts — no API keys, no lookup services, nothing to drift.
  • Structured results. Each conversion returns the original value, both units (symbol + full name), the result, the formula applied, and the category — so the agent can explain its math instead of just asserting it.

Tools

Tool What it does
convert_unit Convert value from one unit to another within a category. Accepts symbols or full names (case-insensitive, °C, m², "miles", "MiB" all work). Rejects unknown units and cross-category pairs with clear errors.
list_units List all 17 categories with every unit symbol and full name (optionally one category, e.g. "data" or "temperature") — for discovering the exact symbols to pass to convert_unit.

Supported categories

Category Units (symbols)
length km, m, cm, mm, um, nm, in, ft, yd, mi, nmi
mass t (metric tonne), kg, g, mg, lb, oz
temperature c, f, k — affine conversion with offsets
area km2, ha, m2, cm2, mm2, mi2, acre, yd2, ft2, in2
volume (incl. cooking) m3, l, ml, cm3, gal, qt, pint, cup, floz, tbsp, tsp (US units)
speed km/h, m/s, mph, knot, ft/s
time duration yr (Julian, 365.25 d), wk, d, h, min, s, ms
data size / transfer tbit…bit, pb…b (decimal), pib…kib (binary) — MB ≠ MiB
pressure mpa, kpa, bar, atm, psi, mmhg, torr, pa
energy kwh, wh, kcal, kj, cal, j, ev
angle deg, rad, grad
frequency / rotation ghz, mhz, khz, hz, rpm
typography (CSS / print) px, pt, pc (pica), em, rem — 96 dpi reference, 16 px base font for em/rem
fuel economy l/100km, l/km, mpg (US), mpg(uk) (imperial), km/l — reciprocal, mpg ≠ linear
power mw, kw, w, hp (mechanical = 550 ft·lbf/s), hp(m) (metric PS), hp(e) (electric 746 W), btu/h (IT), ftlb/s — three different horsepower definitions
force kn, n, dyn, lbf, kgf (kp), gf — lbf/kgf are weight-based at standard gravity 9.80665 m/s²
torque n.m, kgf.m, lbfft (pound-force foot), lbfin (pound-force inch) — force × length

v0.2.0 note: pt now means the typography point (previously the US pint). Use pint for pints — convert_unit { value: 1, from: "pint", to: "l" } still works. em/rem assume the common 16 px browser default base font size; px assumes 96 dpi (documented assumptions, not physical absolutes).

v0.3.0 note (symbol disambiguation): typed input kn resolves to knot (speed) — reach kilonewton by its full name (convert_unit { value: 1, from: "kilonewton", to: "n" }). Likewise nm is the nanometer (length); the torque newton meter uses the symbol n.m (also n·m or full names).

Install

dsh plugin --profile default add github:TYEclipse/dsh-units

or clone and build locally:

git clone https://github.com/TYEclipse/dsh-units.git
cd dsh-units && pnpm install && pnpm build

Usage

The agent just calls the tools — no setup beyond installation:

convert_unit { value: 100, from: "km", to: "mi" }
→ 100 km = 62.137119 mi (length, × 0.621371)

convert_unit { value: 500, from: "MiB", to: "MB" }
→ 500 MiB = 524.288 MB (data size / transfer, × 1.048576)

convert_unit { value: 350, from: "fahrenheit", to: "celsius" }
→ 350 f = 176.666667 c (temperature, (x − 32) × 5/9)

convert_unit { value: 16, from: "px", to: "pt" }
→ 16 px = 12 pt (typography (CSS / print), × 0.75)

convert_unit { value: 20, from: "mpg", to: "l/100km" }
→ 20 mpg = 11.760729 l/100km (fuel economy, 235.214583 ÷ x → x)

convert_unit { value: 150, from: "kw", to: "hp" }
→ 150 kw = 201.153313 hp (power, × 1.341022)

convert_unit { value: 1, from: "lbfft", to: "n.m" }
→ 1 lbfft = 1.355818 n.m (torque, × 1.355818)

list_units { category: "volume" }
→ volume (volume (incl. cooking), base: liter): m3 = cubic meter | l = liter | ...

Configuration

plugins:
  dsh-units:
    maxDecimals: 6   # display rounding: decimals ≥ 1, significant digits below (1–12)

Safety model

  • Pure math. No network, no filesystem access, no subprocesses, no code execution.
  • Strict input validation. Unknown units, cross-category pairs, and non-finite values throw descriptive errors instead of returning garbage.
  • Display-only rounding. Internal computation keeps full float precision; rounding applies to the returned result only.
  • No opinions about validity. Converting -10 K returns the arithmetic result; physical plausibility is the caller's business (documented so agents don't over-trust the tool).

Development

pnpm install
pnpm build   # tsc, strict
pnpm test    # vitest, fully offline fixtures
pnpm lint    # oxlint (src + test only)

License

MIT © 2026 TYEclipse

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-units」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:TYEclipse/dsh-units

Headless(CLI)profile:

dsh plugin --profile headless add github:TYEclipse/dsh-units

实测报告

验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Data 里更多

浏览全部 7819 个插件 →