dsh-tool-qrcode: Capacity planning, SVG QR code generation, and optional decoding in DSH

Introduction

Asking the model to “generate a QR code” in DeepSeek Harness (DSH) often implies more than just exporting an image. For the same URL, choosing between numeric or byte mode, error correction level L or H, or version 1 versus version 40 directly determines whether the data fits and how large it must be printed to be scannable. If a tool only offers “generation” without “calculation first,” guessing the cause after a failure wastes conversational turns.

Below is the introduction to the community plugin dsh-tool-qrcode (Maintainer: yuehancn, Category: Model Inference). It provides four tools in DSH: planning symbol capacity first, then generating SVG with a built-in encoder with zero dependencies; optionally configuring external programs for PNG output or decoding. The plugin is tested on GitHub against the dsh 0.2.0-rc.2 (preview) build; the apply(ctx) specification is relatively stable, but you should verify compatibility yourself if using a newer version.

What is this

dsh-tool-qrcode is a self-contained tool plugin for DeepSeek Harness: it features a built-in QR encoder implemented from scratch, allowing SVG generation without installing extra dependencies. Simultaneously, it separates “can it fit, which mode to use, error correction level, how much margin is left” into an independent planning tool, distinct from the image generation step.

The DSH ecosystem philosophy is “everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer.

Core Features

The plugin exposes four tools. For long tasks, you can check the environment first, then plan, and finally generate or read the code.

qrcode_status

Reports current capabilities: the built-in SVG encoder is always available; it also indicates whether external encoders (for PNG, etc.) and decoders (for reading) are configured. This avoids discovering that qrencode is not installed only after a failed call.

qrcode_plan(text, level?)

Calculates only, without drawing. Returns the automatically determined encoding mode (numeric / alphanumeric / byte / kanji), the minimum version that fits, error correction level, capacity margin, and remediation suggestions if it doesn’t fit. Mode selection significantly affects size (e.g., the README example: 36 pure digits can fit into version 1, while the same content in byte mode only fits 17 digits).

qrcode_make(text, level?, …)

Generates the image, defaulting to SVG, using the built-in encoder with zero external dependencies.

Parameter Description
level l / m / q / h, default l; auto-downgrades if it doesn’t fit and explains in notes
outputName Filename, defaults to content-based generation
scale Pixels per module, default 8
quietZone Quiet zone modules, default 4 (standard requirement, not recommended to reduce)
lightColor / darkColor Foreground/background colors, default #ffffff / #000000
margin Whether to leave white space

PNG/JPEG requires configuring an external encoder; if not configured, the plugin will clearly report an error and explain how to configure it, rather than silently returning a renamed SVG.

qrcode_read(path, format?)

Reads text back from a QR code image; requires a configured decoder (e.g., zbarimg, zxing). On failure, it lists possible reasons (quiet zone cropped, image too small or blurry, color inverted, etc.), allowing the model to adjust parameters even without seeing the image.

Design point: qrcode_plan is an independent tool, not a parameter of qrcode_make—“whether it fits and how big to print” belongs to decision-making, while generation belongs to execution.

Installation and Activation

Supported profiles: desktop, web. Restart dsh after installation.

dsh plugin --profile desktop add github:yuehancn/dsh-tool-qrcode

For the Web version, simply replace --profile desktop with --profile web.

Optional configuration is written in ~/.dsh/profiles/<profile>/cordis.patch.yml, for example:

- id: tool-qrcode
  config:
    outputDir: C:/Users/you/Pictures/qrcode-output
    encodeCommand: qrencode            # Optional: required for PNG output
    encodeArgs: ["-o", "{output}", "-t", "PNG", "-l", "{level}", "{text}"]
    decodeCommand: zbarimg             # Optional: required for reading codes
    decodeArgs: ["--raw", "-q", "{input}"]

Common configuration fields (see repository README for the rest):

Field Default Description
outputDir qrcode-output Output directory
encodeCommand "" External encoder, empty means SVG only
decodeCommand "" External decoder, empty means qrcode_read is unavailable
scale 8 Default pixels per module
quietZone 4 Default quiet zone modules
timeoutMs 60000 Timeout for single call
status/plan/make/read true Can disable individual tools as needed

encodeCommand can be written as an interpreter plus script (e.g., node + script path); qrcode_status will penetrate the interpreter to detect script capabilities.

Typical Usage

The call relationship in the README can be summarized in two steps: plan first, then generate.

qrcode_plan(text="https://...")  →  byte mode / version 3 / error correction L / 12 bits margin left
qrcode_make(text="https://...")  →  29×29 SVG, no external dependencies

In DSH conversations, let the model call qrcode_status first to confirm the environment, call qrcode_plan for long URLs or Chinese payloads, and then call qrcode_make with the required level and scale. When reading existing images, use qrcode_read after configuring decodeCommand.

Use Cases and Notes

Who it is for: Developers who need to stably produce scannable QR codes in agent workflows; those who want the model to know if the version and error correction are suitable before generating; scenarios where only SVG is needed by default and installing system tools just for encoding is undesirable.

Runtime and Security (from README):

  • External commands are called only via spawn(command, argsArray), without concatenating shell strings.
  • The built-in encoder does not access the network; SVG is written to disk as plain text; overwriting existing artifacts is rejected (unless filenames do not conflict).
  • The plugin runs with the permissions of the current dsh process; please review the source code and MIT license yourself before installation to ensure external codec command paths and arguments comply with your environment policies.

Implementation and Quality: Encoding follows ISO/IEC 18004; the repository provides a Node test suite (README claims 268 assertions) and a Python independent verification script _test/verify-qr.py, which can be compared against OpenCV and the qrcode library.

Conclusion

dsh-tool-qrcode decouples QR capacity planning from SVG generation. The built-in encoder ensures zero-dependency image output, while optional external tools extend PNG and reading capabilities. If you frequently process links, Wi-Fi passwords, or short text into codes in DSH, you can install the plugin first, use qrcode_plan to see constraints clearly, and then use qrcode_make to generate the image.

  • Directory Page: https://www.skillhub.cn/plugins/yuehancn/dsh-tool-qrcode
  • GitHub: https://github.com/yuehancn/dsh-tool-qrcode
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye