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

@kb-labs/adapters-transport

v2.34.0

Published

Transport adapters for inter-process communication (IPC, Unix Sockets)

Downloads

2,265

Readme

@kb-labs/adapters-transport

Part of KB Labs ecosystem. Works exclusively within KB Labs platform.

Transport layer for inter-process communication between parent and child processes. Supports IPC and Unix Sockets.

Overview

| Property | Value | |----------|-------| | Implements | ITransport | | Type | Infrastructure | | Requires | None | | Category | IPC / Networking |

Features

  • Multiple Transports - IPC, Unix Sockets, or auto-select
  • Serialization - Handle Buffer, Date, Error, and complex objects
  • Auto-Reconnect - Automatic reconnection for Unix sockets
  • Timeout Support - Configurable request timeouts
  • Protocol Versioning - Backward-compatible protocol

Installation

pnpm add @kb-labs/adapters-transport

Configuration

Auto Mode (Recommended)

import { createAdapter } from '@kb-labs/adapters-transport';

// Auto-select best transport (Unix Socket with IPC fallback)
const transport = createAdapter({ type: 'auto' });

IPC Transport

// Force IPC (legacy compatibility)
const transport = createAdapter({
  type: 'ipc',
  timeout: 30000
});

Unix Socket Transport

// Force Unix Socket (max performance)
const transport = createAdapter({
  type: 'unix-socket',
  socketPath: '/tmp/kb-ipc.sock',
  timeout: 30000,
  autoReconnect: true
});

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | type | 'ipc' \| 'unix-socket' \| 'auto' | - | Transport type | | socketPath | string | '/tmp/kb-ipc.sock' | Unix socket path | | timeout | number | 30000 | Request timeout in ms | | autoReconnect | boolean | true | Auto-reconnect (Unix socket only) |

Usage

Sending Adapter Calls

import { createAdapter } from '@kb-labs/adapters-transport';
import type { AdapterCall, AdapterResponse } from '@kb-labs/adapters-transport';

const transport = createAdapter({ type: 'auto' });

// Connect
await transport.connect();

// Send call
const call: AdapterCall = {
  version: 2,
  type: 'adapter:call',
  requestId: 'req-123',
  adapter: 'cache',
  method: 'get',
  args: ['key'],
  timeout: 5000
};

const response: AdapterResponse = await transport.send(call);

// Disconnect
await transport.disconnect();

Unix Socket Server

import { UnixSocketServer } from '@kb-labs/adapters-transport';

const server = new UnixSocketServer({
  socketPath: '/tmp/kb-ipc.sock'
});

server.on('call', async (call, respond) => {
  // Handle adapter call
  const result = await processCall(call);
  respond({ type: 'adapter:response', requestId: call.requestId, result });
});

await server.start();

Serializable Types

The transport layer handles special types:

// Buffer
{ __type: 'Buffer', data: 'base64-encoded' }

// Date
{ __type: 'Date', iso: '2024-01-01T00:00:00.000Z' }

// Error
{ __type: 'Error', name: 'Error', message: 'Something failed', stack: '...' }

Transport Comparison

| Feature | IPC | Unix Socket | |---------|-----|-------------| | Performance | Good | Better | | Streaming | Limited | Full support | | Cross-process | Child only | Any process | | Reconnection | No | Yes | | Platform | All | Unix/macOS |

FAQ

  • Use IPC when spawning child processes with child_process.fork()
  • Use Unix Socket for daemon processes or higher throughput
  • Use auto to let the system choose the best option

With autoReconnect: true, Unix Socket transport will automatically reconnect when the server becomes available again.

Related Packages

| Package | Use Case | |---------|----------| | @kb-labs/core-runtime | Uses transport for plugin sandbox IPC | | @kb-labs/plugin-execution | Plugin execution with transport layer |

License

KB Public License v1.1 - KB Labs Team