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

@agent_vaults/api-client

v0.1.0

Published

Type-safe AgentVault SDK for identity, verifiable memory, and x402 payment flows

Readme

@agent_vaults/api-client

Type-safe JavaScript/TypeScript SDK for AgentVault.

This package is designed as a product SDK interface (identity, verifiable memory, payment-assisted storage flow).

Install

npm install @agent_vaults/api-client

Exposed Interface

  • AgentVaultClient: main SDK client
  • AgentVaultError: structured SDK errors
  • ViemX402PaymentSigner: drop-in signer for paid operations
  • Signing utilities for registration and payment payload creation

Quick Start

import {
  AgentVaultClient,
  ViemX402PaymentSigner,
} from "@agentvault/api-client";

const client = new AgentVaultClient({
  baseUrl: "http://localhost:3500",
  paymentSigner: new ViemX402PaymentSigner(process.env.PRIVATE_KEY as `0x${string}`),
});

const health = await client.getHealth();
console.log(health.status);

Core Interface

1) Agent identity

import {
  AgentVaultClient,
  createSignedRegisterAgentRequest,
} from "@agentvault/api-client";

const client = new AgentVaultClient({ baseUrl: "http://localhost:3500" });

const registration = await createSignedRegisterAgentRequest(
  process.env.PRIVATE_KEY as `0x${string}`,
  {
    name: "ResearchAgent",
    version: "1.0.0",
    x402Support: true,
    capabilities: ["analyze", "store"],
  },
);

const agent = await client.registerAgent(registration);

2) Store and retrieve memory

const stored = await client.store({
  agentId: agent.agentId,
  data: JSON.stringify({ summary: "daily run", ts: Date.now() }),
  metadata: { type: "state", tags: ["daily", "ops"] },
});

const recalled = await client.retrieve(stored.vaultId);
console.log(recalled.data);

3) Verification and audit

const verify = await client.verify(stored.pieceCid);
const vaults = await client.listVaults(agent.agentId);
const audit = await client.getAuditTrail(agent.agentId);

4) Settlement visibility

const settlements = await client.listSettlements();

Signer Utilities

Registration helpers

  • createRegistrationMessage(address)
  • signRegistrationMessage(privateKey)
  • createSignedRegisterAgentRequest(privateKey, agentCard)

Payment helpers

  • signX402Payment(requirements, privateKey, options)
  • toPaymentHeader(payment)
  • ViemX402PaymentSigner

Use signer options if your verifier expects custom domain values:

const signer = new ViemX402PaymentSigner(PRIVATE_KEY, {
  tokenName: "USDFC",
  tokenVersion: "1",
});

Error Handling

The SDK throws AgentVaultError for non-success responses.

import { AgentVaultError } from "@agentvault/api-client";

try {
  await client.store({ agentId, data: "payload" });
} catch (error) {
  if (error instanceof AgentVaultError) {
    console.error(error.status, error.code, error.reason);
  }
}

Environment Notes

AgentVaultClient resolves base URL in this order:

  1. config.baseUrl
  2. process.env.BaseAgentVaultUrl
  3. http://localhost:3500

Demo-Style E2E Run

This package includes an integration flow test with optional narrated logs.

cd packages/agentvault-api
npm install
npm run test:demo

Test env template:

  • .env.example in this package

API Surface

Main exports from this package:

  • AgentVaultClient
  • AgentVaultError
  • ViemX402PaymentSigner
  • createRegistrationMessage
  • signRegistrationMessage
  • createSignedRegisterAgentRequest
  • signX402Payment
  • toPaymentHeader

Backward-compatible aliases are also exported:

  • AgentVaultApiClient
  • AgentVaultApiError

Build and Publish

cd packages/agentvault-api
npm run clean
npm run typecheck
npm run build
npm pack

Then publish from this directory:

npm publish --access public