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

opencode-tool-repair

v0.1.1

Published

OpenCode plugin that fixes tool calls local models send in another agent's format

Readme

opencode-tool-repair

An OpenCode 2.x plugin that fixes tool calls local models send in another agent's format, before OpenCode rejects them.

Some local models (Flint, for one) were trained on agents whose tools take different argument names. In OpenCode their edits fail with "oldString: Missing key", the model sends the same call again, and nothing changes. This plugin rewrites those calls:

  • edit with an edits list ([{oldText, newText}, …], as an array or a JSON string): one change becomes a normal edit. Several are written together when each old text is found exactly once, Windows line endings included. Otherwise the first is applied and the model is told to send the rest one per call.
  • Other names for the same argument: oldText/old_string become oldString, newText/new_string become newString, file_path/filePath become path, contents becomes content, and replace_all becomes replaceAll.
  • Garbled edit keys. Flint sometimes splits newString into "new": "String" plus an empty "" key holding the text, or writes edString for oldString; both are put back. An edit with no newString at all can't be recovered, so the model is told to send all three fields in one call, or to use write for a large change.
  • Bad optional values, like "offset": "", "limit": "10" or "replaceAll": "true", and an empty "" key.
  • Mistyped paths. Some models drop or add an underscore (cloudsave for cloud_save) or lose a couple of letters in a long folder name. When a path in read, edit, write, glob or grep doesn't exist, and exactly one existing path differs from it only that way, that path is used and the model is told. A shell workdir is corrected only when it's the project folder misspelled. Paths inside shell commands are never changed, so rm -rf on a missing folder fails instead of hitting a real folder with a similar name. A write keeps its new file name; only the folders above it are corrected, only for an underscore or dash slip, and never onto a file that already exists. Paths that could mean two things, short names, and paths with no close match are left alone.

Whenever it changes a call, it adds a line to the tool result naming the right form, so the model can switch to it.

OpenCode drops argument names a tool doesn't declare before plugins see a call. So the plugin rebuilds the edit and write tools' input as the same JSON Schema (same fields, types, descriptions and required list) that also lets extra fields through. The fields models are shown don't change. If a future OpenCode gives those tools fields that aren't plain text or true/false, the plugin leaves their schema as it is.

Install

Add it to opencode.json:

{ "plugins": ["opencode-tool-repair"] }

or copy index.js to ~/.config/opencode/plugins/tool-repair.js. Restart OpenCode. To turn it off, remove it from the list or delete that file.

Test

npm test