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

@graelo/pi-defer-modal

v0.1.4

Published

Defer modal dialogs while the user is typing to prevent interruption

Readme

pi-defer-modal

A Pi extension that defers modal dialogs while you're typing, preventing interruptions to your workflow.

Problem

When extensions display modal dialogs (using ctx.ui.select(), ctx.ui.confirm(), or ctx.ui.input()), these modals grab keyboard focus immediately. If you're in the middle of typing a message, the modal interrupts your typing — keystrokes land in the modal instead of the editor, breaking your train of thought.

Solution

This extension intercepts modal calls from any extension and defers them until you pause typing or submit your input. The tool calls stay blocked (as they should), but the UI presentation is delayed until you're ready.

Features

  • Non-interrupting modals: Modals wait until you pause typing before appearing
  • Configurable modal types: Choose which modal types to defer (select, confirm, input, custom)
  • Adjustable timing: Configure how long to wait after your last keystroke
  • Safety ceiling: Maximum deferral time prevents tools from hanging indefinitely
  • Status indicator: Optional visual indicator when modals are being deferred
  • Works with any extension: Transparently intercepts modals from all extensions

Installation

From npm (recommended)

pnpm add pi-defer-modal

Manual installation

  1. Clone or download this repository
  2. Place the pi-defer-modal directory in one of Pi's extension locations:
    • Project-local: .pi/extensions/pi-defer-modal/
    • Global: ~/.pi/agent/extensions/pi-defer-modal/

Configuration

Create a config.json file in the extension directory:

{
  "enabled": true,
  "modalTypes": ["select", "confirm", "input", "custom"],
  "quietMs": 1500,
  "maxDeferMs": 30000,
  "showStatusIndicator": true,
  "statusText": "⏸ modal pending — pause to review"
}

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | enabled | boolean | false | Enable or disable modal deferral | | modalTypes | string[] | ["select", "confirm", "input", "custom"] | Which modal types to defer | | quietMs | number | 1500 | Milliseconds of inactivity before showing deferred modals | | maxDeferMs | number | 30000 | Maximum time to defer a modal (prevents hanging) | | showStatusIndicator | boolean | true | Show a status indicator when modals are deferred | | statusText | string | "⏸ modal pending — pause to review" | Text to show in the status indicator |

Configuration Locations

The extension checks for configuration in these locations (in order of priority):

  1. Project-local: .pi/extensions/pi-defer-modal/config.json
  2. Global: ~/.pi/agent/extensions/pi-defer-modal/config.json

Commands

/defer-modal-toggle

Toggle modal deferral on or off.

/defer-modal-toggle

/defer-modal-config

Show the current configuration.

/defer-modal-config

/defer-modal-reload

Reload configuration from file (useful after editing config.json).

/defer-modal-reload

How It Works

  1. Typing Tracking: The extension subscribes to ctx.ui.onTerminalInput to track when you type
  2. Modal Interception: It wraps the UI methods (select, confirm, input) to intercept modal calls
  3. Deferral Logic: When a modal is called, if you're actively typing, the extension waits until:
    • You pause typing for quietMs milliseconds, OR
    • You submit your input (press Enter), OR
    • The maximum deferral time (maxDeferMs) elapses
  4. Status Indicator: While waiting, an optional status message shows that modals are pending

Example Usage

With this extension enabled:

  1. You start typing a command: git commit -m "fix: ...
  2. An extension (like pi-permission-system) tries to show a permission modal
  3. Instead of interrupting you, the modal waits
  4. You finish typing and pause for 1.5 seconds (default quietMs)
  5. The permission modal appears, ready for your input

custom modal type

The custom type covers inline keybind dialogs rendered via ctx.ui.custom(). This is the method used by pi-permission-system for its permission prompts in TUI mode. Without wrapping custom, those prompts would interrupt your typing just like un-wrapped select/confirm/input would.

Compatibility

  • Works with Pi v0.2.0 and later
  • Compatible with all extensions that use standard UI modal methods
  • No changes required to existing extensions

Development

# Install dependencies
pnpm install

# Type check
pnpm run check

# Build
pnpm run build

License

MIT