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

unswallow

v0.2.0

Published

Detect and recover tool calls trapped inside a model's reasoning channel — the reasoning-channel swallow bug class across vLLM, SGLang, and llama.cpp.

Downloads

77

Readme

unswallow

npm version CI License: MIT Zero runtime dependencies

Detect and recover tool calls trapped inside a model's reasoning channel.

unswallow demo

Your agent's model decided to call a tool. The server returned HTTP 200, finish_reason: stop, and tool_calls: []. Your agent loop read "no tool call" and silently stopped mid-task. No crash, no error, no log line pointing at the cause.

The tool call is sitting, fully formed, inside the reasoning / reasoning_content / thinking field. The parser never looked there. This package finds it and puts it back — across vLLM, SGLang, and llama.cpp.

npm i unswallow
npx unswallow check   # self-test demo, or --endpoint to probe your live server

30-second quickstart

import { checkAndRescue } from 'unswallow';

const result = checkAndRescue(rawProviderResponse, {
  engineHint: 'vllm',        // 'vllm' | 'sglang' | 'llama.cpp'
  engineVersion: '0.19.0',
});

if (result.recovered && result.recoveredResponse) {
  return result.recoveredResponse;  // tool_calls populated, finish_reason fixed
}

One call in your response-handling path. The original object is never mutated (deep copy); clean responses pass through untouched with confidence: 0.

What it covers

| Pattern | What happens | Example | |---|---|---| | A — Trapped inside | Tool call fully inside the reasoning block | vLLM #39056 | | B — Trailing after | Tool-call JSON in content with trailing text | pi #952 | | C — Field leak | Reasoning tags leak into the wrong field (detection-only) | MiniMax M3 <mm:think> leak |

Parallel calls are all recovered in order (toolCalls[]); exact duplicates collapse to one with a warning. A model merely discussing a tool call is never "recovered" — recovery requires a structurally complete envelope.

More ways to use it

// Streaming (delta-size-agnostic: never parses partial content)
import { checkAndRescueStream } from 'unswallow';
const result = await checkAndRescueStream(sseChunkStream, { engineHint: 'vllm' });

// History hygiene (Pattern D prevention)
import { sanitizeHistory } from 'unswallow';
const clean = sanitizeHistory(messages);

// OpenAI-compatible proxy that heals responses inline
// npx unswallow proxy --upstream http://localhost:8000/v1 --port 8787
import { createProxyServer } from 'unswallow';
createProxyServer({ upstream: 'http://localhost:8000/v1' }).listen(8787);
npx unswallow check --endpoint http://localhost:8000/v1 --model Qwen/Qwen3.5-35B-A3B-FP8 --engine vllm
npx unswallow matrix        # sourced engine/version behavior matrix

Python users: pip install unswallow — a 1:1 stdlib-only mirror with the same CLI.

Confidence, benchmarks, docs

Every detection carries a confidence score (matrix hit → 0.95, heuristic → 0.55, nothing → 0) plus a warnings[] array explaining exactly why. The engine/version behavior matrix ships as its own package (unswallow-matrix), every row sourced, refreshed weekly.

Full docs, benchmark reports (22 hash-pinned fixtures, measured latency tables, TS↔Python parity), and contributing guide: github.com/0DukePan/unswallow.

MIT © 2026 unswallow contributors.