Introduction¶
In DSH agent workflows, unit conversion seems simple, but it is actually prone to errors: there is an offset between Celsius and Fahrenheit, decimal MB and binary MiB cannot be mixed, mpg and L/100km have an inverse relationship, and mechanical horsepower, metric horsepower, and electric horsepower do not equal the same “hp”. If the agent relies on mental arithmetic or temporary inference, the result might directly enter reports, scripts, configurations, and explanation texts.
dsh-units is the unit conversion toolbox plugin for DeepSeek Harness (DSH). It provides two tools, convert_unit and list_units, allowing the agent to directly call static unit tables for conversion instead of guessing coefficients.
What is this¶
TYEclipse/dsh-units is a DSH plugin maintained by TYEclipse with an MIT license. The version mentioned in current documentation is 0.3.0, and the runtime environment requires node >=20.
Its scope is narrow: performing unit conversion. It covers 17 categories including length, mass, temperature, area, volume (including cooking units), speed, time, data size, pressure, energy, angle, frequency, power, force, torque, typography, and fuel consumption. Implementation-wise, it does not depend on the network, access the file system, or execute code; it is primarily pure arithmetic on static unit tables.
Core Features¶
Below are two verified main capabilities.
convert_unit¶
convert_unit is used to convert value from one unit to another within the same category. It can accept symbols or full names, for example, °C, m², "miles", and "MiB" all work.
It will reject unknown units, cross-category conversions, and non-finite values, providing clear error messages. Internal calculations retain floating-point precision, and rounding is done at the time of display.
The returned content includes the original value, symbols and full names of source and target units, the conversion result, the formula used, and the category. This way, when the agent explains the result, it can describe the calculation path rather than just giving a number.
list_units¶
list_units is used to view categories and units. It can list all 17 categories, or only a specific category, such as "data" or "temperature".
This tool is suitable for use before calling convert_unit to confirm the correct unit symbol or full name.
Installation and Enablement¶
In the DSH environment, you can use the following plugin installation command:
dsh plugin --profile default add github:TYEclipse/dsh-units
If local building is required, you can use the development process in the repository:
git clone https://github.com/TYEclipse/dsh-units.git
cd dsh-units && pnpm install && pnpm build
The build script uses tsc, the test script uses vitest, and the lint script uses oxlint. These development tools only appear in devDependencies and scripts, and are not runtime dependencies.
Typical Usage¶
The following examples are reproducible calls from the plugin documentation.
Converting kilometers to miles:
convert_unit { value: 100, from: "km", to: "mi" }
→ 100 km = 62.137119 mi (length, × 0.621371)
Distinguishing binary MiB from decimal MB:
convert_unit { value: 500, from: "MiB", to: "MB" }
→ 500 MiB = 524.288 MB (data size / transfer, × 1.048576)
Converting Fahrenheit to Celsius:
convert_unit { value: 350, from: "fahrenheit", to: "celsius" }
→ 350 f = 176.666667 c (temperature, (x − 32) × 5/9)
Pixels and points in CSS and typography:
convert_unit { value: 16, from: "px", to: "pt" }
→ 16 px = 12 pt (typography (CSS / print), × 0.75)
Fuel economy unit conversion:
convert_unit { value: 20, from: "mpg", to: "l/100km" }
→ 20 mpg = 11.760729 l/100km (fuel economy, 235.214583 ÷ x → x)
Power conversion:
convert_unit { value: 150, from: "kw", to: "hp" }
→ 150 kw = 201.153313 hp (power, × 1.341022)
Torque conversion:
convert_unit { value: 1, from: "lbfft", to: "n.m" }
→ 1 lbfft = 1.355818 n.m (torque, × 1.355818)
Viewing the volume category:
list_units { category: "volume" }
→ volume (volume (incl. cooking), base: liter): m3 = cubic meter | l = liter | ...
Points to Note on Unit Symbols¶
Several easily confused symbols have been explicitly defined in the new version.
pt represents the point in typography, no longer the US pint. To convert pints to liters, you should use pint:
convert_unit { value: 1, from: "pint", to: "l" }
kn is parsed as knot, the speed unit nautical mile per hour. If kilonewtons are needed, you should call via the full name:
convert_unit { value: 1, from: "kilonewton", to: "n" }
nm represents nanometer, a length unit. Newton-meters in torque use the symbol n.m:
convert_unit { value: 1, from: "lbfft", to: "n.m" }
Typography units have some convention values: px assumes 96 dpi; em and rem assume the common 16 px browser default base font size. These are implementation details, not physical absolute values.
Configuration¶
The plugin provides a display rounding configuration:
plugins:
dsh-units:
maxDecimals: 6
Here, maxDecimals: 6 only affects the display rounding of the returned result, such as decimal places or significant figure display. Internal calculations still retain full floating-point precision.
Suitable Scenarios and Notes¶
Scenarios suitable for using this plugin include:
- DSH agents need to answer questions about standard units like length, mass, temperature, area, volume, speed, time, etc.
- Need to strictly distinguish
MBfromMiBwhen handling data sizes. - Need to convert between
mpg,l/100km, etc., when handling fuel economy. - Need to convert between
kw,w, and different horsepower definitions when handling power. - Need to use
list_unitsto confirm unit symbols before calling.
Points to note before use:
- The plugin runs with the DSH plugin mechanism; the actual execution environment depends on the current DSH process permissions. You should check the source code, dependencies, and license before installation.
- The plugin provides arithmetic conversion and does not judge whether the input has physical meaning. For example, converting
-10 Kwill return an arithmetic result; the physical validity is the responsibility of the caller. - This plugin has no network, file system access, subprocess, or code execution. This security model description comes from the plugin documentation; actual risks should still be assessed based on the DSH host environment.
- Do not treat it as a general-purpose calculation engine; its scope is unit conversion and listing units within a category.
Conclusion¶
dsh-units solves a very specific problem in DSH agents: taking high-frequency, error-prone, and explanatory unit conversions out of mental arithmetic. Its scope is not broad, but its boundaries are clear: static unit tables, intra-category conversion, strict validation, structured results, and zero runtime dependencies.
GitHub repository: