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

@a2aletheia/a2a

v0.3.2

Published

Aletheia trust-layer wrapper for the A2A (Agent-to-Agent) protocol

Readme

@a2aletheia/a2a

Server-side client and peer-agent utilities for working with Aletheia-registered A2A agents.

This package wraps @a2a-js/sdk with Aletheia registry lookup, trust checks, connection reuse, and optional context persistence.

Installation

pnpm add @a2aletheia/a2a

Exports

The main entry point exports:

  • AletheiaA2A for outbound discovery, connection, send, and stream flows
  • PeerAgent for full-duplex agents that both host an A2A server and call other agents
  • TrustedAgent for connection reuse and task operations
  • built-in selectors: HighestTrustSelector, RandomSelector, FirstMatchSelector
  • redisContextStore for persisting contextId and taskId
  • sender identity, user delegation, and flow helper utilities

Quick Start

import { AletheiaA2A } from "@a2aletheia/a2a";

const client = new AletheiaA2A();

const result = await client.sendByCapability(
  "translate-text",
  "Translate 'hello' to Spanish.",
);

console.log(result.agentName);
console.log(result.trustInfo);
console.log(result.response);

Connection API

import { AletheiaA2A } from "@a2aletheia/a2a";

const client = new AletheiaA2A();

const agent = await client.connect("did:key:z6MkExample");
const response = await agent.send("Summarize this document.");

console.log(agent.contextId);
console.log(response.trustInfo);

connectByUrl() is also available, but it resolves a registered agent by URL through the Aletheia registry before connecting. It does not open arbitrary URLs directly.

const agent = await client.connectByUrl("https://agent.example.com");

Trust Behavior

AletheiaA2A applies the package trust pipeline before establishing a reusable connection:

  • optional identity verification
  • optional liveness requirement
  • minimum trust score filtering

The resulting TrustInfo is attached to TrustedResponse and streamed events.

Context Persistence

TrustedAgent tracks the latest contextId and taskId. If you provide a contextStore, that state is restored across process restarts.

import Redis from "ioredis";
import { AletheiaA2A, redisContextStore } from "@a2aletheia/a2a";

const redis = new Redis(process.env.REDIS_URL!);

const client = new AletheiaA2A({
  contextStore: redisContextStore(redis, { ttlSeconds: 3600 }),
});

PeerAgent

PeerAgent combines the SDK agent host with the outbound AletheiaA2A client.

import { PeerAgent } from "@a2aletheia/a2a";

const peer = new PeerAgent({
  name: "Orchestrator",
  version: "1.0.0",
  url: "https://orchestrator.example.com",
  description: "Routes tasks to specialist agents",
  skills: [
    {
      id: "orchestrate",
      name: "Orchestrate",
      description: "Coordinate work across agents",
      tags: [],
    },
  ],
});

peer.handle(async (context, response) => {
  const result = await peer.sendByCapability("translate-text", context.textContent);
  response.text(`Handled by ${result.agentName}`);
});

Selected Configuration

Common AletheiaA2A options:

  • registryUrl
  • agentSelector
  • minTrustScore
  • requireLive
  • livenessCheckBeforeSend
  • verifyIdentity
  • authToken
  • contextStore
  • preferredTransports
  • authenticationHandler
  • interceptors
  • polling
  • signOutboundMessages
  • signingIdentity

Task and Connection Operations

TrustedAgent exposes:

  • send()
  • stream()
  • getTask()
  • cancelTask()
  • resubscribeTask()
  • push notification config helpers
  • refreshCard()
  • refreshTrust()
  • resetContext()

Error Types

The package exports structured errors including:

  • AgentNotFoundError
  • DIDResolutionError
  • AgentNotLiveError
  • TrustScoreBelowThresholdError
  • A2AProtocolError

License

Licensed under MIT.