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

@a2p/sdk

v0.1.0

Published

TypeScript SDK for the a2p (Agent 2 Profile) protocol

Readme

@a2p/sdk

TypeScript SDK for the a2p (Agent 2 Profile) protocol.

Installation

npm install @a2p/sdk
# or
pnpm add @a2p/sdk
# or
yarn add @a2p/sdk

Quick Start

For Agent Developers

import { A2PClient, createAgentClient } from '@a2p/sdk';

// Create a client for your agent
const client = createAgentClient({
  agentDid: 'did:a2p:agent:my-assistant',
  privateKey: process.env.A2P_PRIVATE_KEY,
});

// Request access to a user's profile
const profile = await client.getProfile({
  userDid: 'did:a2p:user:alice',
  scopes: ['a2p:preferences', 'a2p:interests'],
});

console.log(profile.common?.preferences?.communication?.style);

// Propose a new memory
await client.proposeMemory({
  userDid: 'did:a2p:user:alice',
  content: 'Prefers TypeScript over JavaScript',
  category: 'a2p:professional.preferences',
  confidence: 0.85,
  context: 'User mentioned this during our conversation',
});

For Users

import { A2PUserClient, createUserClient } from '@a2p/sdk';

// Create a user client
const user = createUserClient();

// Create a new profile
const profile = await user.createProfile({
  displayName: 'Alice',
});

// Add a memory manually
await user.addMemory({
  content: 'I work as a software engineer at Acme Corp',
  category: 'a2p:professional',
  sensitivity: 'standard',
});

// Review pending proposals
const proposals = user.getPendingProposals();
for (const proposal of proposals) {
  console.log(`${proposal.proposedBy.agentName}: ${proposal.memory.content}`);
  
  // Approve or reject
  await user.approveProposal(proposal.id);
  // or: await user.rejectProposal(proposal.id, 'Not accurate');
}

// Export your profile
const json = user.exportProfile();

Core Concepts

Profiles

A profile contains:

  • Identity: DID, display name, pronouns
  • Common: Shared preferences across all contexts
  • Memories: Structured and episodic memories
  • Sub-Profiles: Context-specific variations (work, personal, etc.)
  • Access Policies: Who can access what

Scopes

Scopes control what data an agent can access:

import { STANDARD_SCOPES } from '@a2p/sdk';

// Common scopes
STANDARD_SCOPES.PREFERENCES          // 'a2p:preferences'
STANDARD_SCOPES.INTERESTS            // 'a2p:interests'
STANDARD_SCOPES.PROFESSIONAL         // 'a2p:professional'
STANDARD_SCOPES.HEALTH               // 'a2p:health' (sensitive)

Proposals

Agents can propose memories, but users must approve:

// Agent proposes
await client.proposeMemory({
  userDid: 'did:a2p:user:alice',
  content: 'Likes jazz music',
  category: 'a2p:interests.music',
  confidence: 0.75,
});

// User reviews
const proposals = user.getPendingProposals();
await user.approveProposal(proposals[0].id);

API Reference

A2PClient (for agents)

| Method | Description | |--------|-------------| | getProfile(options) | Get filtered user profile | | proposeMemory(request) | Propose a new memory | | checkPermission(userDid, permission, scope?) | Check if agent has permission | | setAgentProfile(profile) | Set agent profile for trust evaluation |

A2PUserClient (for users)

| Method | Description | |--------|-------------| | createProfile(options?) | Create a new profile | | loadProfile(did) | Load existing profile | | addMemory(memory) | Add a memory manually | | getPendingProposals() | Get proposals awaiting review | | approveProposal(id, options?) | Approve a proposal | | rejectProposal(id, reason?) | Reject a proposal | | exportProfile() | Export to JSON | | importProfile(json) | Import from JSON |

License

EUPL-1.2