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

@fidesbuild/router

v0.2.0

Published

FIDES ROUTER: an agent hands over every way to do a job; each is checked against the signed FIDES and simulated, and only the best valid one runs.

Readme

@fidesbuild/router

FIDES ROUTER for agents on Robinhood Chain: an agent hands over every way it could do a job, each one is checked against the FIDES its owner signed and simulated, and only the best valid one runs.

npm install @fidesbuild/router @fidesbuild/sdk viem
npx @fidesbuild/router        # what it is, and how to try it

How a route is chosen

  1. Build. Each candidate becomes its own execution plan. A candidate that cannot be built is out.
  2. Check. Every action of every candidate is checked against the signed FIDES. A route is authorized as a whole: if one action is outside the FIDES (SPEND_LIMIT_EXCEEDED, SELECTOR_NOT_ALLOWED, TARGET_NOT_ALLOWED, …) the whole route is out. There are no half-routes.
  3. Floor. A candidate can carry the output it expects and the least it will accept (expectedOut, minOut). Expected below the minimum is out.
  4. Simulate. Every route left is simulated against the chain. A route that would fail is out, with the revert reason. Gas and each asset's outflow are measured from the simulation.
  5. Rank. Best output, then least spent, then fewest transactions, then least gas, then least risk. Risk counts steps that may fail without reverting the plan, plus offchain calls and x402 payments. Slippage is scored against the best quote in the set, in basis points. Pass compare to rank your own way.
  6. Run. Only the winner. Nothing valid, nothing runs (NO_VALID_ROUTE).

The router chooses inside the FIDES. It can never choose a route the FIDES does not allow.

Use

import { route } from "@fidesbuild/router"

const r = await route({ client, fides, agent }, [
  { name: "v3", actions: swapActions(quoteV3), expectedOut: quoteV3.quotedOut },
  { name: "v2", actions: swapActions(quoteV2), expectedOut: quoteV2.quotedOut },
])

for (const m of r.ranked) console.log(m.name, m.valid ? "valid" : m.reasons.join("; "), m.gas, m.totalOutflow, m.slippageBps)

// send the winner through the hosted relayer, which pays the gas
const plan = r.plan(r.best.name)
await fetch("https://api.fidesbuilder.xyz/v1/plans/build", { method: "POST", body: toJson({ fides, actions: winnerActions }) })
await fetch(`https://api.fidesbuilder.xyz/v1/plans/${plan.planHash}/execute`, { method: "POST", body: toJson({ bundles: await plan.signedBundles() }) })

With your own relayer account in the context, r.execute() sends the winner directly.

| Field | Meaning | | --- | --- | | ranked | Every candidate, valid first, best first, with valid, reasons, transactions, gas, outflow, totalOutflow, expectedOut, slippageBps, risk | | best | The winner's metrics, or undefined when nothing is valid | | plan(name) | A candidate's built plan | | execute() | Sends the winner with the context's relayer |

Docs: https://fidesbuilder.xyz/docs/#/router