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

strale-fallback

v0.1.0

Published

Automatic API fallback via Strale — when your primary API fails, Strale picks up the call

Readme

strale-fallback

When your agent's primary API fails, Strale picks up the call.

strale-fallback wraps any async function in your agent pipeline. When the primary call fails (timeout, 429, 503, malformed response), it automatically finds a matching Strale capability and executes it — returning structured JSON with a quality score.

Install

npm install strale-fallback

Usage

import { withFallback } from 'strale-fallback';

const validateIban = withFallback(
  async (iban: string) => myPrimaryApi.validateIban(iban),
  {
    taskDescription: 'validate IBAN number',
    straleApiKey: process.env.STRALE_API_KEY,
  }
);

const result = await validateIban('SE3550000000054910000003');
console.log(result.source);          // "primary" or "strale_fallback"
console.log(result.data);            // structured JSON either way
console.log(result.capabilityUsed);  // e.g. "iban-validate"

How it works

  1. Your primary function is called normally
  2. If it throws (any HTTP error, timeout, or exception), strale-fallback calls POST /v1/suggest with your taskDescription to find the best matching Strale capability
  3. It executes that capability with your function's arguments as inputs
  4. Returns a FallbackResult with source: "strale_fallback" so you know which path was taken

FallbackResult

| Field | Type | Description | |---|---|---| | success | boolean | Whether a result was obtained | | data | T or null | The result data | | source | string | "primary" or "strale_fallback" | | capabilityUsed | string? | Strale capability slug if fallback used | | straleSqs | number? | Quality score (0-100) if fallback used | | error | string? | Error message if both paths failed |

Quality threshold

const checkSanctions = withFallback(
  async (name: string) => primaryApi.checkSanctions(name),
  {
    taskDescription: 'check company sanctions',
    minSqs: 80,  // only use Strale if quality score >= 80
  }
);

Environment

Set STRALE_API_KEY — or pass it directly via straleApiKey. Get a free key with trial credits: https://strale.dev/signup

Free capabilities (no key needed)

iban-validate, email-validate, dns-lookup, json-repair, url-to-markdown — these work even without an API key.

Full capability catalog: https://strale.dev/capabilities

License

MIT