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

openclaw-acp

v0.0.6

Published

ACP adapter for OpenClaw via Gateway

Downloads

643

Readme

openclaw-acp

Agent Client Protocol (ACP) adapter for OpenClaw via Gateway.

OpenClaw includes a native openclaw acp command, but it's a minimal implementation with limited features. This adapter provides a fuller ACP implementation by bridging through OpenClaw's local gateway, offering streaming support, session persistence, and reliable reconnection.

How It Works

┌──────────────┐      stdio      ┌───────────────┐     WebSocket     ┌─────────────────┐
│  ACP Client  │◄───────────────►│  openclaw-acp │◄──────────────────►│ OpenClaw Gateway│
│  (Zed, AFK)  │   ACP JSON-RPC  │               │  Gateway protocol  │  (localhost)    │
└──────────────┘                 └───────────────┘                    └─────────────────┘

Features

  • Full ACP protocol support: initialize, session/new, session/load, session/prompt, session/cancel
  • Streaming responses: Real-time text and tool call updates
  • Session persistence: Sessions are stored in the gateway and can be resumed
  • Automatic reconnection: Reconnects to gateway with exponential backoff
  • History replay: On session/load, replays full conversation history

Prerequisites

  • OpenClaw installed and gateway running (openclaw command available)
  • Gateway token configured in ~/.openclaw/openclaw.json

Usage

With Zed

Add to your Zed settings.json:

{
  "agent_servers": {
    "openclaw": {
      "type": "custom",
      "command": "npx",
      "args": ["-y", "openclaw-acp"],
      "env": {}
    }
  }
}

With AFK

The AFK host can use this adapter by configuring it in AcpAgents:

static const openclawAcp = AcpAgentConfig(
  id: 'openclaw',
  name: 'OpenClaw',
  command: 'npx',
  args: ['-y', 'openclaw-acp'],
  detectCommand: 'openclaw',
);

Development

npm install
npm run dev        # Run from source
npm run build      # Build for distribution
npm run typecheck  # Type check
npm test           # Run tests
npm run test:watch # Run tests in watch mode

Testing

The project includes comprehensive unit tests for:

  • SessionManager (test/session.test.ts): Session creation, loading, prompt handling, event translation
  • GatewayClient (test/gateway.test.ts): Connection, authentication, reconnection, event handling

Run tests:

npm test

Architecture

src/
├── index.ts              # Entry point
├── acp/
│   ├── server.ts         # ACP server using @agentclientprotocol/sdk
│   └── session.ts        # Session state management
└── gateway/
    ├── client.ts         # WebSocket client with reconnection
    └── types.ts          # Gateway protocol types

Key Components

GatewayClient (src/gateway/client.ts)

  • WebSocket connection to OpenClaw gateway
  • Automatic reconnection with exponential backoff
  • Request/response correlation
  • Event dispatching (chat, agent events)

SessionManager (src/acp/session.ts)

  • Maps ACP sessions to gateway sessions
  • Translates gateway events to ACP SessionUpdate notifications
  • Handles history replay for session/load

AcpServer (src/acp/server.ts)

  • Implements ACP Agent interface
  • Handles stdio communication via ndJsonStream
  • Orchestrates gateway client and session manager

Protocol Translation

| ACP Method | Gateway Action | |------------|----------------| | initialize | Connect to gateway (WebSocket auth) | | session/new | Generate UUID, store in memory | | session/load | Fetch history via chat.history, replay to client | | session/prompt | chat.send (streaming via events) | | session/cancel | chat.abort |

| Gateway Event | ACP Notification | |---------------|------------------| | chat (delta) | session/updateagent_message_chunk | | chat (thinking) | session/updateagent_thought_chunk | | agent (lifecycle start) | session/updatetool_call | | agent (lifecycle end) | session/updatetool_call_update |

License

MIT