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

pi-double-esc

v1.0.1

Published

Prevent accidental Escape from aborting the LLM — requires double-press to interrupt while streaming

Readme

⏏️ pi-double-esc

Prevent accidental Escape aborts in pi

Require a second Escape press within 500ms to confirm any abort action.

pi extension license


What It Does

When the LLM is streaming a response:

  • First Escape press: Shows an esc again to abort hint on the editor border — does not abort
  • Second Escape within the debounce window: Actually aborts the streaming response
  • If the debounce window expires, the hint clears and escape resets

When the LLM is not streaming, Escape works normally (immediate) — no debounce applied. Autocomplete dismissal always works on a single Escape.

Installation

Option 1: Install via pi package (Recommended)

Install directly from GitHub as a pi package:

pi install https://github.com/monotykamary/pi-double-esc@main

Or add to your settings.json:

{
  "packages": [
    "https://github.com/monotykamary/pi-double-esc@main"
  ]
}

Option 2: Global Installation

Copy the extension to pi's global extensions directory:

cp double-esc.ts ~/.pi/agent/extensions/

Option 3: Project-Local Installation

Copy to your project's .pi/extensions/ directory:

mkdir -p .pi/extensions
cp double-esc.ts .pi/extensions/

Option 4: Quick Test

pi -e ./double-esc.ts

Configuration

Set the PI_DOUBLE_ESC_MS environment variable to change the debounce timeout (default: 1500ms):

PI_DOUBLE_ESC_MS=2000 pi

How It Works

The extension replaces pi's editor component with a CustomEditor subclass that intercepts Escape key presses:

  1. On each session_start, ctx.ui.setEditorComponent() installs the custom editor
  2. The editor uses ctx.isIdle() (which reflects !session.isStreaming) to detect streaming state
  3. While streaming, the first Escape shows a visual hint and starts a debounce timer
  4. A second Escape within the window calls super.handleInput(data) to perform the actual abort
  5. Any other keypress or timeout expiry dismisses the hint

The debounce logic lives in src/double-esc-logic.ts as pure functions for testability.

Development

npm install          # install dev dependencies
npm test            # run tests
npm run typecheck   # type check
npm run lint:dead   # check for unused exports

License

MIT