dsh-plugin-archive-reader: Read-only browsing of asar / zip archives in DSH

Introduction

When troubleshooting Electron applications or local packaged artifacts in DeepSeek Harness (DSH), it’s often necessary to open app.asar or .zip files to inspect their README, configuration, or source code snippets. The common approach is to write a temporary parsing script: calculating asar header offsets yourself, controlling the output so tens of thousands of entries don’t flood the conversation, and avoiding accidental disk writes. dsh-plugin-archive-reader consolidates “list entries, read individual entries, search content by regex” into three model-side tool calls, and declares itself zero-dependency, read-only, and offline.

The following sections describe what it is, how to install it, how the three tools work, and the supported scope along with configuration limits.

What is this

dsh-plugin-archive-reader is a DSH Host plugin provided by maintainer XHXnb123 (GitHub repository: XHXnb123/dsh-plugin-archive-reader). It is classified as a “networking tool” in the community directory skillhub.cn; however, the plugin itself explicitly states in its README that it is offline and read-only, performing all parsing locally using Node’s built-in modules.

The plugin registers three tools with the session: archive_list, archive_read, and archive_grep. The current package.json version is 0.1.0, licensed under MIT, requires Node >= 20 at runtime, and declares peerDependencies: { "@deepseek-ai/dsh": ">=0.2.0-rc.1" }.

Core Features

Three Read-Only Tools

Tool Purpose Key Parameters
archive_list List entries, supports filtering by regex/substring path, pattern?, limit?, format?
archive_read Read text content of a single entry path, entry, maxBytes?, format?
archive_grep Search content by regex across all text entries path, pattern, maxMatches?, maxEntryBytes?, format?

Common behaviors (from README):

  • Only opens archives to read data; does not write to disk or modify any profile state.
  • pattern is first interpreted as a case-insensitive regex; if parsing fails (e.g., x(1), it automatically falls back to substring matching, and the returned matcherKind indicates which method was used.
  • archive_read detects binary files (starting with a NUL byte) and only reports the size with binary: true, without returning content.
  • entry must match exactly (case-insensitive exact match is also accepted); when not found, similar candidates are listed.

Typical Usage Examples

The motivation example given in the README: searching for documentation titles inside app.asar without writing a custom offset script:

archive_grep { path: "...\\app.asar", pattern: "版本兼容性与豁免" }
→ dsh/node_modules/@deepseek-ai/dsh-plugin-manager/README.zh.md:61: ### 版本兼容性与豁免

Installation and Activation

The official installation methods are as follows (choose either the npm name or a local path; use the local path when the npm package is not yet published):

dsh plugin --profile web add dsh-plugin-archive-reader   # npm install (use the local path below when not yet published)
dsh plugin --profile web add D:\path\to\dsh-plugin-archive-reader

After installation, fully restart dsh (not just refresh the page) for the three tools to appear in the session.

If your local dsh version does not match peerDependencies, the Harness compatibility check may refuse to load it; you can use dsh plugin allow-version to write an exact version exemption (the README notes that the plugin itself does not import Harness packages and does not depend on package resolution from the dsh installation tree).

Supported Formats and Limitations

  • Supported: .asar (Electron packaging format) and .zip (store / deflate).
  • Not supported: ZIP64, encrypted entries, tar/gz/7z/rar — encountering these will produce explicit errors, with no silent degradation.
  • When a zip entry name is not declared as UTF-8 (historical CP437), it is decoded as best-effort UTF-8, which may produce garbled characters.
  • Truncation is done by byte offset, which may cut through multi-byte characters, resulting in replacement characters after decoding.
  • archive_grep decompresses and scans entries one by one, subject to a total scan budget (default 64 MB; when exceeded, stoppedEarly indicates this); large archives will cause noticeable CPU usage.
  • unpacked entries in asar are read from the <archive-name>.unpacked/ directory.

Configuration (cordis.patch.yml)

The plugin entry’s config in cordis.patch.yml supports the following fields (all have hard constant limits):

Field Default Meaning
maxEntries 200 Default number of entries returned by archive_list
hardMaxEntries 5000 Maximum number of entries that can be requested in a single call
maxReadBytes 65536 Default bytes returned by archive_read
hardMaxReadBytes 1048576 Maximum bytes that can be requested in a single call
maxMatches 50 Default number of matching lines returned by archive_grep
hardMaxMatches 500 Maximum matches that can be requested in a single call
maxEntryBytes 4 MB Size of a single entry that archive_grep will skip
maxScanBytes 64 MB Total scan budget for archive_grep
maxLineChars 400 Maximum length of matched text per line
timeoutMs 30000 Tool-level timeout for all three tools

Dependencies and Security

  • Zero runtime dependencies: Only uses node:fs and node:zlib; no install scripts, no postinstall, no third-party packages.
  • Offline: All parsing is local.
  • Read-only: The README states there are no file-writing calls in the code (fs.open(..., 'r') and fs.readFile).

The plugin runs with the permissions of the current dsh process; before installing, it is recommended to review the repository source code and MIT license yourself to confirm that the paths and archive sources are trustworthy. The DSH community directory is an independent site and has no official affiliation with DeepSeek / High-Flyer.

For those who prefer not to read the source code, the repository provides a one-page explanation at PLAIN.zh.md; on Windows, you can double-click verify.bat, or run node scripts/verify.mjs for a self-test summary.

Use Cases

  1. Quickly listing paths inside Electron app.asar or zip packages within a Harness session, then reading specific README files or configurations.
  2. Using archive_grep to locate lines by keywords or regex in large archives, avoiding importing the entire package’s entries into the conversation.
  3. Troubleshooting local plugins or packaged artifacts: combined with the read-only strategy, reducing the need for temporary scripts and the risk of accidental writes.

Not suitable for: scenarios requiring ZIP64, encrypted zips, tar/gz/7z/rar, or where the plugin must fetch archives over the network — this plugin will either report an error directly or not provide the capability.

Conclusion

dsh-plugin-archive-reader consolidates asar/zip directory listing, single-file reading, and regex search into three DSH tools, with zero dependencies, read-only operation, offline capability, and configurable limits on entries, scan bytes, and timeouts. Directory page: skillhub.cn/plugins/XHXnb123/dsh-plugin-archive-reader; source code and detailed documentation: github.com/XHXnb123/dsh-plugin-archive-reader.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye