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-in-go/pigpen-pi-typesafe-api

v0.1.0

Published

Typed Go API for extension authors, a port of pi-typesafe's library half: one admission rule, request and spend caps, key store and auth state, judgment backends (TypeSafe, OpenRouter, Command Code, custom endpoint, own model), Ask, batching, calibration.

Readme

pi-typesafe-api (typed Go API)

The library half of the pi-typesafe port: what an extension author imports to ask Jev typed questions safely. Go module github.com/MichaelKinsy/pigpen/components/pi-typesafe-api, package pitypesafe, over the shared client components/typesafe. A consumer extension's go.mod requires it at v0.0.0 (no replace) and its directory has a go.work with use ( . ../../../pi-typesafe-api ../../../typesafe ).

client, err := pitypesafe.New(pitypesafe.Options{MaxRequests: 5, MaxUSDPerDay: 1}) // key: TYPESAFE_API_KEY, else the login store
answer := pitypesafe.Ask(ctx, client, typesafe.SystemOneRequest{
	State: typesafe.Text("I was charged twice."),
	Questions: typesafe.Questions{typesafe.Ask("billing", typesafe.Noul("Is this about billing?"))},
}, pitypesafe.AskOptions{Timeout: 5 * time.Second})
if !answer.OK { /* answer.ErrorCode == pitypesafe.CodeBudget: stop asking; never an error value */ }

| Piece | Where | |---|---| | Admission (PrepareEvaluationRequest: normalize model near-misses, validate, byte budget), EvaluationSchema | schema.go, evaluation_schema.json | | Client with request budget, day caps, ledger, auth recording (New, Evaluate, EvaluateRaw, ListModels, GetSpend) | client.go, usage.go, auth.go | | Backends: typesafe, openrouter, commandcode, a caller-supplied endpoint, and ownmodel | backends.go | | Key store, key situations, AgentDir (PiG's directory) | credentials.go | | Ask, EvaluateMany, EvaluateAll, ChunkRequest, FanOut | ask.go, batch.go | | Calibration kit (Calibrate, Replay, AUC, ...) | calibrate.go | | Own model on the PiG SDK's model access | hostmodel/ | | Hidden-input key prompt, LoginWithPrompt, EnsureAPIKey | ui/ |

Where content goes. TypeSafe, OpenRouter, Command Code and custom-endpoint backends send it to that host (BackendHost names it for consent text); the ownmodel backend sends it to the provider of the model PiG is configured with. A key for one backend is never sent to another. Credit and license: CREDITS.md. Mapping: port/PORT.md.