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

@agenomics/action-runtime

v0.1.0

Published

AEP action-definition runtime: Result type, ok/err constructors, wrap helper, and the defineAction builder used by AEP capabilities.

Readme

@agenomics/action-runtime

A tiny Result type and defineAction builder for AEP capability handlers.

The runtime contract for capabilities advertised in an AEP capability manifest (ADR-060). Provides a typed Result<T, E> discriminated union with ok / err constructors, a wrap helper that converts any Promise-returning function into a Result-returning one (so exceptions never escape the action boundary), and a defineAction builder that takes a plain async handler and produces an Action with a uniform run(input) shape. Zero runtime dependencies — drop it into any AEP capability without pulling Solana code into the action surface.

Install

npm install @agenomics/action-runtime

Not yet on npm; pre-publish 0.1.0. See docs/SDK_PUBLISH.md for the publish path.

Quick example

import { defineAction, ok, err } from "@agenomics/action-runtime";
import type { Result } from "@agenomics/action-runtime";

const addAction = defineAction({
  name: "add",
  description: "Adds two numbers",
  handler: async (input: { a: number; b: number }) => input.a + input.b,
});

const result: Result<number, Error> = await addAction.run({ a: 3, b: 4 });
if (result.ok) {
  console.log("sum:", result.value); // sum: 7
} else {
  console.error("failed:", result.error.message);
}

// Manual constructors when you don't need a wrapped handler:
const success: Result<string> = ok("done");
const failure: Result<never, Error> = err(new Error("nope"));

Key exports

  • Result<T, E = Error> — discriminated union: { ok: true; value: T } | { ok: false; error: E }. Narrows cleanly via result.ok.
  • ok(value) / err(error) — single-line constructors for the two variants.
  • wrap(fn) — runs a () => Promise<T>, captures any throw, and returns Promise<Result<T, ActionError>>. The thrown value is never returned verbatim: it is converted to a redacted ActionError (see Security boundary).
  • ActionSpec<TInput, TOutput>{ name, description, validate?, handler }.
  • Action<TInput, TOutput>{ name, description, run: (input: unknown) => Promise<Result<TOutput, Error>> }.
  • defineAction(spec) — builds an Action from a spec. The handler is wrapped with wrap, so run never throws.
  • ActionErrorextends Error, adds a stable machine code. The only error type that ever crosses the action boundary back to a caller.
  • ValidationError — throw from validate for invalid input; surfaces as ActionError with code: "VALIDATION_ERROR".
  • setInternalErrorSink(fn) — register a trusted server-side logger that receives the raw, unredacted error. Never wire this anywhere reachable by an untrusted caller.

Security boundary (SDK-F3 — cycle-4 audit)

defineAction is a capability runtime, not a validator. Two contracts are now explicit:

  1. No implicit input validation. Without a validate hook the handler receives whatever the (possibly untrusted) caller passed — TInput is erased at runtime. For any handler that moves funds or touches signing material, supply validate; it runs before handler and must throw (e.g. ValidationError) on bad input.

  2. Error redaction. RPC URLs, filesystem (keypair) paths, and key/secret-shaped blobs are stripped from the error.message returned to callers; the message is length-bounded; the raw Error/.stack is never returned; non-Error throws are reduced to a type tag (no value leak). The unredacted error is delivered only to setInternalErrorSink if one is registered.

Related packages

  • @agenomics/client — call on-chain reads (e.g. fetchProfile, fetchVault) inside an action handler; throws inside the handler become typed err results.
  • @agenomics/idl — pull cluster-keyed program IDs into the same handler when you need to dispatch by network.
  • @agenomics/capability-manifest-validator — declare each defineAction you ship in your published manifest's capabilities[] array; the validator confirms the manifest matches the on-chain commitment.
  • @agenomics/sas-resolver — fetch reputation context for the requesting agent before running the action handler.

Status

0.1.0 — pre-publish; private until license + READMEs land per docs/SDK_PUBLISH.md.