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

@ola-893/agentpay-core

v0.4.0

Published

Guarded paid API sessions for agents: deterministic policy and native NEAR payments

Readme

AgentPay Core

Native NEAR USDC payment-stream guardrails for agents. Install with npm install @ola-893/[email protected]. This release lets the caller pin the signed quote before requesting OPEN. The vault contract is unchanged.

import { createNearGateway } from '@ola-893/agentpay-core/near';
import { guardedFetch } from '@ola-893/agentpay-core';

const client = await createNearGateway({
  configPath: '/private/profile/deployment.json',
  stateRoot: '/private/agentpay/state',
  paymentsEnabled: true,
});
try {
  const request = guardedFetch(fetch, { client, tier: 'basic' });
  const url = new URL(client.service.requestPath, client.serviceUrl);
  url.searchParams.set('q', 'payment streams');
  const response = await request(url);
  console.log(response.status, await response.json());
} finally {
  await client.close();
  await client.dispose();
}

Configure financial limits, service paths, tiers, inference and host guardrails with the CLI. A service must implement AgentPay's NEAR quote/health/402/session protocol; ordinary third-party 402 APIs need adapters. There is no generic payment-origin discovery. Requests allow GET/HEAD, forbid redirects and foreign origins, and retry a supported payment challenge once.

createNearGateway verifies the chain, vault and exact restricted agent key. Its executor persists session context and uncertain transaction intents, rechecks permits before submission, and reuses only the matching service/tier/recipient/active chain session. Host observations drive configurable failure thresholds; they are not exposed as model tools. A separate policy worker signs exact OPEN/CLOSE permits. The contract independently enforces financial limits.

Use createToolHandlers/definitionsFor from @ola-893/agentpay-core/tools, or agentPayTools(client) from @ola-893/agentpay-core/vercel-ai (Vercel AI SDK 6). Both use the same four MCP-compatible tools: check, open, fetch, close. Fetch accepts a configured tier and optional URL query string. It returns untrusted provider content plus actual payment decisions/receipts.

Long-running hosts should use startMonitor(client, { onEvent, onError }) from @ola-893/agentpay-core/monitor and await monitor.stop() before closing/disposal. Monitoring requires a running process; on-chain lease expiry always caps accrual. dispose() stops the worker and does not by itself submit CLOSE.

The exported OfflineGateway is a deterministic test double used by unit/protocol tests. It is not wired into the CLI or advertised as an agent payment run. Local process separation assumes a trusted OS user. TEE isolation, sponsorship, multi-service routing and production security assurance are not implemented.