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-reservoir

v0.1.0

Published

Quota-aware proactive model routing for Pi, Senpi, and omo-native.

Readme

pi-reservoir

Quota-aware proactive model routing for Pi, Senpi, and omo-native.

Reservoir watches provider/model quota headroom and proactively spreads the next turn across the models you declared to be interchangeable — before a limit error ever happens. It complements (never replaces) your host's reactive retry fallback.

Why

  • Native retry.fallbackChains switch models after a quota/rate-limit error.
  • pi-quotas reads quota telemetry but never switches models.
  • Task routers pick what kind of model to use; Reservoir picks which provider/model inside a pool you defined should carry the next turn.

Install

Drop the source into your host's extensions directory:

git clone <this repo> ~/.omo/agent/extensions/pi-reservoir   # omo
# or: ~/.senpi/agent/extensions/pi-reservoir                 # senpi / pi

The host extension loader picks up extensions/<dir>/index.ts automatically.

Configure pools in <agentDir>/reservoir.json:

{
  "mode": "advisory",
  "freshnessTtlMs": 120000,
  "refreshIntervalMs": 60000,
  "pools": {
    "frontier": {
      "reservePercent": 15,
      "hysteresisPercent": 10,
      "billingOrder": ["subscription", "free", "paid_credit", "unknown"],
      "models": [
        { "id": "anthropic/claude-fable-5", "billingClass": "subscription" },
        { "id": "kimi-coding/k3", "billingClass": "subscription" }
      ]
    }
  }
}

One model belongs to exactly one pool; duplicate membership is a config error. billingClass is per-model-candidate (a single OpenRouter account can hold both free and paid models). Start with "mode": "advisory" — it records what it would do without switching anything.

Commands

| Command | Effect | |---|---| | /reservoir why | Print the last decision receipt (reason + candidates). | | /reservoir refresh | Force quota refresh (15s max timeout). | | /reservoir auto\|advisory\|off | Switch session routing mode. | | /reservoir pin / unpin | Respect / release manual model choice. | | /reservoir doctor | Config schema, duplicate pools, missing/unavailable/scoped models, capability probe, Bifrost conflict, quota freshness. |

Commands never write the config file.

Safety model

  • Auto switching uses only pi.setSessionModel() — the persisted default is never mutated; hosts without that API are advisory-only.
  • Routing hook is input, only when the session is idle, cache-only (no network in the hot path).
  • While native fallback is active, Reservoir fully yields (suppressed-native-fallback).
  • Manual set/cycle pins the model until /reservoir unpin.
  • If Bifrost is loaded, Reservoir refuses auto (ERROR competing-router:bifrost) — two auto-routers cannot coexist by load order.
  • Stale/unknown quota is treated as unknown capacity, never assumed healthy.
  • No tokens, prompts, or raw error bodies are ever logged; receipts are sanitized.

Docs: architecture, host contract, provider matrix.

Development

bun install          # dev deps only (@types/bun, typescript)
bun test             # unit + contract suites
bunx tsc --noEmit    # typecheck
npm pack --dry-run   # package audit
bun scripts/smoke-load.ts   # no-network fake-host load smoke

Zero runtime dependencies. Source-only TypeScript extension.

License

MIT — see LICENSE and NOTICE.