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

@kennyfrc/pi-str-replace-editor

v0.1.1

Published

Model-facing str_replace_editor (view/create/str_replace/insert) for DeepSeek-family models on Pi; replaces read/edit/write for those models

Readme

pi-str-replace-editor

Model-facing str_replace_editor (view / create / str_replace / insert) for Pi, enabled only for DeepSeek-family models, where it replaces the built-in read, edit, and write tools.

Why

DeepSeek-family models are tuned on the canonical Claude Code str_replace_editor surface (cat -n views, unique literal old_str, insert-after-line). Serving them pi's edit/write JSON contract wastes tokens and turns. This extension gives DeepSeek models the tool they were trained for and removes the three built-in tools that become redundant (view covers read, create covers write, str_replace/insert cover edit). bash, grep, find, ls stay active.

Semantics are a faithful port of the reference RL harness's str_replace_editor tool; its benchmark suite (tools.spec.ts) is re-characterized in test/engine.test.ts.

Gating

  • A model is "deepseek" when its id, provider, or display name matches /deepseek/i (case-insensitive, router-robust).
  • session_start + model_select swap the active tool set:
    • deepseek: read/edit/write removed, str_replace_editor added, and grep/find/ls removed by default — leaving bash + str_replace_editor, the harness minimal-preset shape those models were tuned on. Search goes through bash grep -rn/find/ls or str_replace_editor view on a directory.
    • everyone else: str_replace_editor removed, read/edit/write and grep/find/ls restored. GPT-family models keep edit/write exactly as-is (pi-apply-patch owns them there), so the two extensions never fight.
  • Defense in depth: tool_call blocks a deepseek model that somehow calls read/edit/write (pointer at str_replace_editor) and any other model that calls str_replace_editor (pointer at read/edit/write). No ordering race between extensions can produce a wrong write.

Config file ~/.pi/agent/pi-str-replace-editor.json (optional):

{
  "mode": "auto",
  "deepseekPatterns": ["deepseek"],
  "extraDisabledTools": ["grep", "find", "ls"]
}
  • mode: auto (default) | on (editor for every model) | off.
  • deepseekPatterns: regex list tested against id/provider/name.
  • extraDisabledTools: additional tool names hidden for deepseek models (default ["grep", "find", "ls"]; set to [] to keep those three).

Improvements over the harness

  • Syntax highlighting in the TUI for view results (pi's highlighter), plus a display diff for str_replace results.
  • Better errors / fallbacks:
    • old_str not found → closest lines with their line numbers + CRLF hint.
    • relative paths → the cwd-resolved absolute suggestion (Maybe you meant /abs/path?).
    • missing parent directory → mkdir -p hint; vanished files → FS_NOT_FOUND.
    • binary files → refused with a bash/xxd fallback hint.
    • view on an image returns the image as an attachment.
    • prepareArguments accepts legacy shapes (unadvertised): file_path, file:// prefixes, backtick-wrapped paths, replace_all: true.
  • Concurrency: every mutation runs inside pi's withFileMutationQueue, so parallel tool calls on the same file serialize instead of losing updates.
  • Error codes (FS_NOT_FOUND, FS_EDIT_NOT_FOUND, FS_AMBIGUOUS_EDIT, …) mirror the harness vocabulary.

Development

npm run check:str-replace-editor   # typecheck
npm run test:str-replace-editor    # benchmark port + adversarial battery