npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nelsonlongxiang/dsh-tool-hash-line-edit

v0.2.1

Published

Hash-anchored line editing tool (hash_line_edit) for DeepSeek Harness: PUT/CUT line patches validated by a [path#TAG] content tag from a complete read

Downloads

127

Readme

@nelsonlongxiang/dsh-tool-hash-line-edit

A DeepSeek Harness (DSH) host plugin that adds the model-facing hash_line_edit tool: line-addressed file edits validated by a [path#TAG] content tag, with a built-in [path#????] probe that returns the complete line-numbered content and its tag.

What it does

The plugin registers one tool (hash_line_edit) plus its system-prompt guidance into the host composition:

  • Probe — patch [<path>#????] (header only) reads the target file and returns its complete line-numbered content with the [path#TAG] anchor line (rendered text); the canonical value also carries the four-hex tag field, so code-dispatch callers that see the value rather than the render can quote the anchor. The tag uses the same xxHash32 low-word algorithm as the original hashline tool (line1\nline2\nline3\n34E9; trailing [ \t\r] per line is normalized away — different file content yields a correspondingly different tag). The probe records the read observation, so the following edit passes the observation policy's read-before-edit gate without any other read tool. Files above 2 MiB are refused (FS_TOO_LARGE) — hash-anchored editing targets small, fully quoted files.
  • Edit — a patch carries the header [path#TAG] on its own line, followed by operations:
    • PUT N.=M: then + payload lines — replace lines N–M
    • CUT N.=M — delete lines N–M
    • PUT <N: then + payload lines — insert before line N
    • PUT >N: / PUT >$: then + payload lines — insert after line N / append at EOF
  • Execution parses the patch, verifies the tag against current file contents (stale_tag on mismatch → re-probe), resolves per-call sandbox policy, obtains the fs/edit-intent version guard from the mounted observation policy, and commits through ctx.fs.writeText — so sandbox confinement, escalation (sandbox_permissions/justification under a confining backend), read-before-edit, and stale-version protection all behave like the built-in filesystem tools.
  • Results carry before/after text and diff-card presentation metadata; successful writes emit fs/observed.

Coordinates are 1-based and refer to the complete pre-edit probe result. Overlapping replace/delete ranges and malformed hunks are rejected before any mutation. New files are not supported — use the built-in write tool.

Requirements

The profile must already provide the standard filesystem stack: a ctx.fs provider (e.g. dsh-fs-local) and, for guarded mutations, dsh-fs-observation-policy. The plugin injects tools, fs, and systemPrompt.

Install

npx -p @deepseek-ai/dsh dsh plugin --profile <name> add @nelsonlongxiang/dsh-tool-hash-line-edit

Restart the profile after installing. The plugin is host-only (no client face).

Config

| Key | Default | Meaning | |---|---|---| | enabled | true | Register the tool and its prompt section; false contributes nothing. |

Development

pnpm install
pnpm verify   # typecheck + tests + build

Tests run the plugin through a real Cordis composition (in-memory ctx.fs provider plus the observation policy) and pin the tag vector, grammar, guarded-mutation, and stale-tag behavior.

scripts/inspect-transcript.mjs is a local development/diagnostic helper: it decodes a DSH .jsonl.zstd session log and prints events mentioning the tool (smoke-test evidence extraction). It is intentionally not shipped with the package — files only exports lib, cordis.patch.yml, and this README.

Origin

Extracted from the DeepSeek Harness monorepo's packages/fs/tool-fs hash_line_edit implementation (PR #21) into an independently installable plugin; tag compatibility with the original ai-native-expect-agents hashline tool is preserved.