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

acpreact

v1.0.7

Published

ACP SDK for monitoring and reacting to chat conversations

Readme

acpreact - ACP SDK

A lightweight SDK for setting up tools and managing ACP protocol communication. Allows opencode and kilo CLI to call registered tools via the ACP protocol.

Features

  • ACPProtocol: Core ACP protocol implementation with JSON-RPC 2.0 support
  • Tool Registration: Register custom tools with descriptions and input schemas
  • Tool Whitelist: Built-in security model for controlling tool access
  • Tool Execution: Execute whitelisted tools with validation
  • ES Module: Pure ES modules, no build step required

Installation

npm install acpreact

Quick Start

Creating an ACP Server with Custom Tools

import { ACPProtocol } from 'acpreact';

const acp = new ACPProtocol();

// Register a custom tool
acp.registerTool(
  'weather',
  'Get weather information for a location',
  {
    type: 'object',
    properties: {
      location: { type: 'string', description: 'City name' }
    },
    required: ['location']
  },
  async (params) => {
    return {
      location: params.location,
      temperature: 72,
      condition: 'sunny'
    };
  }
);

// Initialize protocol response
const response = acp.createInitializeResponse();

// Execute tool
const result = await acp.callTool('weather', { location: 'San Francisco' });
console.log(result);

Using System Instructions

Pass a system instruction to the ACPProtocol constructor. The instruction will be included in the initialization response and communicated to opencode or kilo CLI:

import { ACPProtocol } from 'acpreact';

const instruction = 'You are a helpful weather assistant. Always provide temperature in Fahrenheit.';
const acp = new ACPProtocol(instruction);

// Register tools as usual
acp.registerTool(
  'weather',
  'Get weather information for a location',
  {
    type: 'object',
    properties: {
      location: { type: 'string', description: 'City name' }
    },
    required: ['location']
  },
  async (params) => {
    return {
      location: params.location,
      temperature: 72,
      condition: 'sunny'
    };
  }
);

// The instruction is included in the initialization response
const response = acp.createInitializeResponse();
console.log(response.result.instruction);
// Output: "You are a helpful weather assistant. Always provide temperature in Fahrenheit."

API

ACPProtocol

Main class for setting up ACP protocol communication.

Constructor:

  • new ACPProtocol(instruction): Initialize the protocol
    • instruction (optional): String - system instruction to communicate to opencode or kilo CLI

Methods:

  • registerTool(name, description, inputSchema, handler): Register a custom tool

    • name: String - tool identifier
    • description: String - tool description
    • inputSchema: Object - JSON Schema for tool inputs
    • handler: Async function - receives params object, returns result
    • Returns: Tool definition object
  • createInitializeResponse(): Generate protocol initialization response

  • createJsonRpcRequest(method, params): Create JSON-RPC request object

  • createJsonRpcResponse(id, result): Create JSON-RPC response object

  • createJsonRpcError(id, error): Create JSON-RPC error object

  • validateToolCall(toolName): Check if tool is whitelisted

  • async callTool(toolName, params): Execute a registered tool

Properties:

  • instruction: String (optional) - system instruction communicated to opencode or kilo CLI
  • toolWhitelist: Set of registered tool names
  • toolCallLog: Array of executed tool calls with timestamps
  • rejectedCallLog: Array of rejected tool attempts

Example: Multiple Tools

import { ACPProtocol } from 'acpreact';

const acp = new ACPProtocol();

// Register database tool
acp.registerTool(
  'query_database',
  'Query the application database',
  {
    type: 'object',
    properties: {
      query: { type: 'string' }
    },
    required: ['query']
  },
  async (params) => {
    // Your database logic here
    return { data: [] };
  }
);

// Register API tool
acp.registerTool(
  'call_api',
  'Call an external API',
  {
    type: 'object',
    properties: {
      endpoint: { type: 'string' },
      method: { type: 'string', enum: ['GET', 'POST'] }
    },
    required: ['endpoint', 'method']
  },
  async (params) => {
    // Your API logic here
    return { response: {} };
  }
);

// Initialize and use
const initResponse = acp.createInitializeResponse();
console.log(initResponse.result.agentCapabilities);

License

ISC