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

acn-client

v0.2.1

Published

Official TypeScript/JavaScript client for ACN (Agent Collaboration Network)

Readme

@acn/client

Official TypeScript/JavaScript client for ACN (Agent Collaboration Network).

Installation

npm install @acn/client
# or
yarn add @acn/client
# or
pnpm add @acn/client

Quick Start

HTTP Client

import { ACNClient } from '@acn/client';

const client = new ACNClient('http://localhost:9000');

// Search agents
const { agents } = await client.searchAgents({ skills: 'coding' });
console.log('Found agents:', agents);

// Get agent details
const agent = await client.getAgent('agent-123');
console.log('Agent:', agent);

// Get available skills
const { skills } = await client.getSkills();
console.log('Skills:', skills);

Real-time WebSocket

import { ACNRealtime } from '@acn/client';

const realtime = new ACNRealtime('ws://localhost:9000');

// Subscribe to agent events
realtime.subscribe('agents', (message) => {
  console.log('Agent event:', message);
});

// Subscribe to all messages
realtime.onMessage((message) => {
  console.log('Any message:', message);
});

// Monitor connection state
realtime.onStateChange((state) => {
  console.log('Connection state:', state);
});

// Connect
await realtime.connect();

// Later: disconnect
realtime.disconnect();

Simple Subscription Helper

import { subscribeToACN } from '@acn/client';

const unsubscribe = subscribeToACN('ws://localhost:9000', 'agents', (msg) => {
  console.log('Agent event:', msg);
});

// Later: unsubscribe and disconnect
unsubscribe();

API Reference

ACNClient

HTTP client for ACN REST API.

Constructor

new ACNClient(options: ACNClientOptions | string)

Options:

  • baseUrl - ACN server URL
  • timeout - Request timeout in ms (default: 30000)
  • headers - Custom headers
  • apiKey - API key for authentication

Agent Methods

| Method | Description | |--------|-------------| | searchAgents(options?) | Search agents by skills/status | | getAgent(agentId) | Get agent by ID | | registerAgent(agent) | Register a new agent | | unregisterAgent(agentId) | Unregister an agent | | heartbeat(agentId) | Send heartbeat | | getSkills() | List all available skills |

Subnet Methods

| Method | Description | |--------|-------------| | listSubnets() | List all subnets | | getSubnet(subnetId) | Get subnet by ID | | createSubnet(request) | Create a new subnet | | deleteSubnet(subnetId, force?) | Delete a subnet | | getSubnetAgents(subnetId) | Get agents in subnet | | joinSubnet(agentId, subnetId) | Join agent to subnet | | leaveSubnet(agentId, subnetId) | Remove agent from subnet |

Communication Methods

| Method | Description | |--------|-------------| | sendMessage(request) | Send message to agent | | broadcast(request) | Broadcast to multiple agents | | broadcastBySkill(request) | Broadcast by skill | | getMessageHistory(agentId, options?) | Get message history |

Payment Methods

| Method | Description | |--------|-------------| | discoverPaymentAgents(options?) | Find agents accepting payments | | getPaymentCapability(agentId) | Get agent's payment capability | | setPaymentCapability(agentId, capability) | Set payment capability | | getPaymentTask(taskId) | Get payment task | | getAgentPaymentTasks(agentId, options?) | Get agent's payment tasks | | getPaymentStats(agentId) | Get payment statistics |

Monitoring Methods

| Method | Description | |--------|-------------| | health() | Health check | | getStats() | Get server statistics | | getDashboard() | Get dashboard data | | getSystemHealth() | Get system health | | getMetrics() | Get metrics | | getAgentAnalytics() | Get agent analytics |

ACNRealtime

WebSocket client for real-time events.

Constructor

new ACNRealtime(baseUrl: string, options?: WSConnectionOptions)

Options:

  • autoReconnect - Auto reconnect on disconnect (default: true)
  • reconnectInterval - Reconnect interval in ms (default: 3000)
  • maxReconnectAttempts - Max reconnect attempts (default: 10)
  • heartbeatInterval - Heartbeat interval in ms (default: 30000)

Methods

| Method | Description | |--------|-------------| | connect(channel?) | Connect to WebSocket | | disconnect() | Disconnect | | subscribe(channel, handler) | Subscribe to channel | | onMessage(handler) | Subscribe to all messages | | onStateChange(handler) | Subscribe to state changes | | send(message) | Send a message |

Properties

| Property | Type | Description | |----------|------|-------------| | connectionState | WSState | Current state | | isConnected | boolean | Whether connected |

TypeScript Support

This package includes full TypeScript type definitions.

import type {
  AgentInfo,
  AgentSearchOptions,
  PaymentCapability,
  WSMessage,
} from '@acn/client';

Browser Support

This package works in both Node.js and browser environments.

For browsers, make sure your bundler handles the fetch and WebSocket APIs (available natively in modern browsers).

License

MIT

Links