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

@zhtmike/pi-minimal-dispatch

v0.7.1

Published

Minimal detached lane dispatch with visible state for the pi coding agent

Readme

pi-minimal-dispatch

Minimal detached lane dispatch with visible state for the pi coding agent.

Lanes are detached pi --mode json processes in their own process groups: they survive the dispatcher's death, and their live state is derived from their event streams — never guessed from empty files.

wave 'survey':
  docs [glm-4.6 think:high] · running · 2 turns · tok 5703in/90out, $0.0009 · stop:toolUse · last 3.1s ago
  review [glm-5.3-flash] · settled · 4 turns · tok 12021in/310out, $0.0041 · stop:stop · last 12s ago

Why

pi ships no sub-agents by design — its README: "install a package that does it your way." Most packages that answer grow an agent cast: persona rosters and per-role system-prompt markdown, concurrency pools and spawn budgets, fleet UIs, hub servers or daemons that must stay alive. pi-minimal-dispatch takes the other end of the trade:

  • No personas, no role play — a lane is a brief — inline (brief) or a file (briefPath) — plus optional model/thinking pins; the dispatching agent writes each brief, so it keeps the judgment.
  • The filesystem is the whole protocol — briefs in, JSONL events, persisted sessions, one manifest, artifacts out; no server, no in-memory state, re-adoptable by any later session.
  • The caller decides scale — no queue, no pool, no cap; external limits are the caller's discipline.
  • Zero runtime dependencies — Node builtins and a small host-API surface; CI typechecks the pi 1.7.0 floor and latest pi.

The full design rationale, positioning, and origin story: docs/design.md.

Requirements

  • pi ≥ 1.7.0, macOS or Linux (POSIX process groups, timeout, process start times — Windows is not supported): Linux reads /proc/<pid>/stat; macOS needs ps -o lstart=
  • GNU timeout: preinstalled on Linux; on macOS brew install coreutils or set timeoutBin: "gtimeout" (Configuration)

Install

pi install npm:@zhtmike/pi-minimal-dispatch            # official (registry)
pi install git:github.com/zhtmike/pi-minimal-dispatch  # tracks main
pi -e ./src/index.ts                                   # try it for one invocation

Quick start

Write one brief per lane — inline (brief) or as a file (briefPath) — the lane's whole prompt: goal, scope, expected deliverable. Then ask in plain language:

Dispatch two lanes: docs summarizes the request-handling module, review audits src/auth.
Wait for them to settle and collect the artifacts.

A real session:

> dispatch  wave="survey" lanes=[{name:"docs", briefPath:".pi/work/s/<session-id>/survey-docs-brief.md",
            model:"zai/glm-5.3-flash"},
            {name:"review", briefPath:".pi/work/s/<session-id>/survey-review-brief.md", mcp:true,
            tools:"read,grep,find,ls,codemode"}]
  wave 'survey' dispatched — 2/2 lanes spawned
    docs: pid 99015 (deadline 900s)
    review: pid 99016 (deadline 900s)
  manifest: /abs/path/to/.pi/work/survey-manifest.json
  [next: lanes(wave='survey', action='wait') — blocks until every lane settles or any fails; waitSec caps it; action='status' to peek]

> lanes     wave="survey" action="wait"
  docs [glm-5.3-flash] · settled · 2 turns · tok 5703in/90out, $0.0009 · stop:stop · last 0.8s ago
  review [glm-4.6] · settled · 4 turns · tok 12021in/310out, $0.0041 · stop:stop · last 2.1s ago
  [next: lanes(wave='survey', action='collect') — writes each lane's final message to an artifact; release the wave when done]

> lanes     wave="survey" action="collect"
  collect wave 'survey':
    docs: /abs/path/to/.pi/work/survey-docs.md stop:stop
    review: /abs/path/to/.pi/work/survey-review.md stop:stop
  [next: lanes(wave='survey', action='release') — deletes the wave's files including the artifacts; copy out anything you still need]

The ceremony: write briefs → dispatch → wait (or poll status) → collect → release. dispatch never blocks; waiting is an explicit, bounded wait call that returns the status table the moment every lane is settled or any has failed (surfaced at the poll cadence) — no sleep-then-poll guessing. In the TUI, a collect result expands (ctrl+o / click) to render each lane's artifact in place. release deletes exactly the wave's own files and refuses unsettled, foreign-owned, and unconsumed waves — collect first, and a human may always delete by hand (details). Steering is kill + redispatch: refine the brief, run a new wave (slugs are single-use). Hang detection: lastEventAgeSec is the signal — no event growth for ~2× the lane's normal turn latency ⇒ kill and redispatch. Failed lanes: wait wakes at the first failure — waitMode: "hold" sees the running siblings through, steer: kill + redispatch under a new slug, or continue the lane — a new wave's lane with resume: "<wave>/<lane>" forks its persisted session and takes the follow-up brief (details).

When to dispatch — a drop-in policy block

The tool schemas deliberately carry no usage policy: when to fan out is your layer, not the package's, and shipped descriptions are identical for everyone while policy is per-repo taste. The mechanics (dispatch never blocks; waiting is the bounded wait call) live in the schemas — the judgment belongs in your agent instructions. Copy and adapt:

- Dispatch a sub-task when it deserves its own context: read-only
  exploration before implementing, parallel investigation lanes. Research
  fan-out is the classic pattern; whether implementation dispatches is your
  policy — the tools support write-capable lanes the same way.
- One brief per lane — inline (`brief`) or a file (`briefPath`) — is its
  entire prompt: goal, scope, expected deliverable and format, what not to
  do, and lines stating the addressee is a dispatched leaf with no shared
  context and that the lane's final message is its deliverable. Park briefs
  under a per-session subdirectory (.pi/work/s/<session-id>/ — your session
  id where the harness exposes it, else any unique per-session marker).
- Tier the lane to the job — mechanical recon and investigation on a cheap
  fast model (pin `model`, add `thinking` — or make that model the config's
  `defaultLaneModel` and pin only the exceptions), judgment and verdict work
  on the strong model. Shape `tools` to the role: verification lanes take
  bash (run tests, edit nothing), implementation lanes take
  bash/edit/write, and any lane needing online resources takes
  `mcp: true` + `codemode`. Name the covering tests in the brief — a lane
  set to run an unscoped full suite eats its own deadline.
  Valid `model` ids: `pi --list-models`.
- Scope a lane's searches to the paths its brief names — global or
  systematic sweeps burn the lane's own deadline.
- Consume waves: wait (bounded) → collect → release; never hand-delete
  workDir contents while a lane may still be running.

API

Two tools — full parameter, output, and configuration reference in docs/api.md:

  • dispatch — validate briefs, claim the wave slug, spawn every lane detached in its own process group; returns in under a second.
  • lanes — stateless status / wait / kill / collect / release over the wave's manifest; any session can re-adopt a wave, including after the dispatcher exited.

Web/MCP reach: the default lane is offline — set mcp: true to connect MCP servers; connecting grants nothing by themselves, and a lane reaches their tools only through codemode or tool_search named in its tools. Rules and examples: MCP and web reach.

Configuration

The lane protocol is fixed; every variable knob — deadlines, default lane model, kill grace, poll interval, working directory, binaries — is configurable via user or project JSON, merged defaults → user → project → per-call parameters. Invalid files fail loudly. Full table and precedence rules: docs/api.md.

Status bar & /lanes

While any tracked lane runs — or has failed and the wave is not yet released — the footer shows one line. A session starting in a new process (pi --session, /resume after an exit) adopts the default workDir's waves at start, so its live lanes reach the footer without a lanes call:

[lanes: 2 running · 1 failed (deadline) · 1 settled]
[lanes: survey/docs running (turn 3 · bash · last 12s)]   ← one lane running

A lane gone quiet badges (1 idle 75s); a lane past its deadline badges (1 overdue) — signals, not verdicts. /lanes inspects waves without spending model tokens: bare /lanes lists every wave (with exactly one readable wave it shows that wave's table directly), /lanes <wave> prints the full table, /lanes <wave> <lane> shows one lane in detail — its trace, its artifact, its failure. Failed lanes link their transcript and .err where the terminal supports it. Full reference: docs/api.md.

State model

Derived on every call from the event stream, PID liveness, and the deadline — never stored, never stale. settled means the agent_settled event was seen — success is collect with suspect: false.

| State | Meaning | |---|---| | starting | spawned, no session header yet | | running | events flowing (overdue: true once past deadline) | | settled | agent_settled emitted (any stop reason — success is collect with suspect: false) | | failed | cause: spawn (nothing ran) · killed (tombstoned) · deadline (leash fired) · crashed (.err tail attached) |

How lanes are spawned, what the manifest records, and why state is never stored: Mechanics in docs/design.md.

Testing

npm test runs the unit suites (config, derive, format, lane, release).

Contributing · License

CONTRIBUTING.md · agent instructions in AGENTS.md · MIT