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

@makaio/sdk

v1.0.0-dev-1779051654000

Published

TypeScript SDK for the Makaio bus protocol

Downloads

53

Readme

@makaio/sdk

TypeScript SDK for the Makaio bus protocol. Framework-native facade that wraps @makaio/bus-core and @makaio/bus-transport-websocket into a single developer-friendly API for external consumers building integrations, automation scripts, and tooling on top of a running Makaio instance.

Pre-release. This package is not yet published to npm.

How It Differs from the Python and Rust SDKs

The TypeScript SDK is framework-native: it uses the framework's bus packages directly (@makaio/bus-core, @makaio/bus-transport-websocket) rather than reimplementing the bus protocol. This means it participates in the same bus abstractions (subject types, payload filters, handler priorities) as first-party framework code.

The Python and Rust SDKs reimplement the bus protocol in their respective languages. They support the same logical surface — local-first dispatch, request middleware chaining, HMAC auth, typed subject descriptors — but through standalone implementations rather than framework package wrappers. They also offer stdio transport for detached extension processes.

Quick Start

import { BusClient, SessionSubjects, AgentSubjects } from '@makaio/sdk';

const client = new BusClient();
// URL defaults to ws://127.0.0.1:6252/bus, or set MAKAIO_BUS_URL.
// Auth is resolved automatically from MAKAIO_BUS_SECRET when required.
await client.connect();

// Subscribe to all agent events
const unsubscribe = client.subscribe(AgentSubjects.$all, (ctx) => {
  console.info(ctx.subject, ctx.payload);
});

// Send a message and wait for the response
const response = await client.request(SessionSubjects.sendMessage, {
  sessionId: crypto.randomUUID(),
  agent: { kind: 'canonical-model', model: 'gpt-5.2' },
  message: 'Hello from the SDK!',
});

unsubscribe();
client.close();

API Reference

BusClient

const client = new BusClient(url?: string);

url defaults to MAKAIO_BUS_URL or ws://127.0.0.1:6252/bus.

| Method | Signature | Description | |--------|-----------|-------------| | connect | (options?: BusClientOptions) => Promise<void> | Open the WebSocket connection. Auto-resolves HMAC auth from MAKAIO_BUS_SECRET when the server requires it | | subscribe | (subject, handler, options?) => () => void | Subscribe to events. Returns an unsubscribe function | | onRequest | (subject, handler, options?) => () => void | Register a request handler. Returns an unsubscribe function | | request | (subject, payload, options?) => Promise<TRes> | Send a request and wait for the response | | emit | (subject, payload) => Promise<void> | Fire a one-way event | | once | (subject, options?) => Promise<EventContext<T>> | Wait for a single matching event | | close | () => void | Disconnect and release resources | | getBus | () => IMakaioBus | Access the underlying bus instance (throws if not connected) |

probeHealth

const health = await probeHealth('ws://localhost:6252/bus');
// => { auth: true } | null

Probes the server's /health endpoint. Returns null when the server is unreachable. Use this before connect() to check whether auth is required before presenting credentials.

Connection Options (BusClientOptions)

| Option | Type | Description | |--------|------|-------------| | auth | TransportAuth | Explicit auth strategy. When omitted, HMAC auth is resolved from MAKAIO_BUS_SECRET if the server requires it | | createWebSocket | (url) => WebSocketLike | Custom WebSocket factory (tests, browser, custom impl) | | autoReconnect | boolean \| WebSocketClientTransportReconnectOptions | Auto-reconnect config. true uses transport defaults | | connectTimeoutMs | number | Connection timeout in milliseconds (default: 5000) | | debug | boolean | Enable transport debug logging (default: false) |

Subject Namespaces

The SDK re-exports the framework's subject namespaces so consumers never import @makaio/contracts directly:

| Export | Subjects | |--------|---------| | AgentSubjects | agent.started, agent.message, agent.tool.use, agent.complete, AgentSubjects.$all … | | SessionSubjects | session.sendMessage, session.turn.completed, SessionSubjects.$all … | | AdapterSubjects | Adapter lifecycle and config subjects | | ToolSubjects | Tool registration and invocation subjects | | ApprovalSubjects | Human-in-the-loop approval subjects |

Environment Variables

| Variable | Description | |----------|-------------| | MAKAIO_BUS_URL | WebSocket URL for the bus server (default: ws://127.0.0.1:6252/bus) | | MAKAIO_BUS_SECRET | HMAC shared secret used when the server requires authentication | | MAKAIO_DEBUG | Set to 'true' to enable transport debug logging |

Installation

This package is not yet published. Reference it locally via workspace protocol while the project is in pre-release:

{
  "dependencies": {
    "@makaio/sdk": "workspace:*"
  }
}