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

@telegraphic-dev/openclaw-gateway-client

v0.1.3

Published

TypeScript WebSocket client for the OpenClaw Gateway with device auth, pairing recovery, RPC, chat, sessions, and event streaming.

Readme

@telegraphic-dev/openclaw-gateway-client

Reusable TypeScript client for the OpenClaw Gateway WebSocket protocol, aligned with OpenClaw 2026.4.2.

Features

  • challenge-based connect handshake
  • Ed25519 device identity generation/signing
  • stored device token persistence + retry recovery
  • typed request/response map for known Gateway methods
  • exported method/scope constants from current OpenClaw scope model
  • scope authorization helpers
  • event streaming helpers
  • reusable file-backed state adapter
  • high-level helpers for sessions, chat, pairing, login, config, logs, cron, tools, agents

Install

npm install @telegraphic-dev/openclaw-gateway-client

Quick start

import {
  OpenClawGatewayClient,
  ROLE_SCOPE_MAP,
  fileStoreAdapter,
} from '@telegraphic-dev/openclaw-gateway-client';

const client = new OpenClawGatewayClient({
  url: 'https://gateway.example.com',
  token: process.env.OPENCLAW_GATEWAY_TOKEN,
  store: fileStoreAdapter('.openclaw-gateway-client'),
  client: {
    id: 'my-app',
    version: '0.1.0',
    platform: 'node',
    mode: 'backend',
  },
  role: 'operator',
  scopes: ROLE_SCOPE_MAP.operator,
});

await client.connect();
const sessions = await client.listSessions({ limit: 5 });
console.log(sessions.sessions);
await client.close();

Exported protocol metadata

import {
  METHOD_SCOPE_GROUPS,
  METHOD_SCOPE_BY_NAME,
  ROLE_SCOPE_MAP,
  resolveRequiredOperatorScopeForMethod,
  resolveLeastPrivilegeOperatorScopesForMethod,
  authorizeOperatorScopesForMethod,
} from '@telegraphic-dev/openclaw-gateway-client';

This lets other projects:

  • build UI around supported methods
  • enforce least-privilege client scopes
  • show scope badges/explanations
  • gate operations before sending RPC requests

Included known method wrappers

  • Core: health, status, modelsList, gatewayIdentityGet
  • Agents/tools: agentsList, agentIdentityGet, toolsCatalog, toolsEffective, skillsStatus, waitForAgentRun
  • Sessions: listSessions, createSession, getSession, sendSessionMessage, patchSession, deleteSession, resetSession, compactSession
  • Chat: chatHistory, chatSend, chatAbort, chatInject
  • Device pairing: devicePairList, devicePairApprove, devicePairReject, deviceTokenRotate, deviceTokenRevoke
  • Web/login: webLoginStart, webLoginWait
  • Config/logs/cron: configGet, configSchema, logsTail, cronStatus, cronList, cronRuns
  • Channel/system: channelsStatus, channelsLogout, systemPresence, nodeList

Example: session-based review flow

const created = await client.createSession({
  key: 'main:repo:pr-123:review',
  label: 'PR review',
});

const sent = await client.sendSessionMessage({
  key: created.key ?? 'main:repo:pr-123:review',
  message: 'Review this PR',
});

if (sent.runId) {
  const wait = await client.waitForAgentRun({ runId: sent.runId, timeoutMs: 30_000 });
  console.log(wait.status);
}

const transcript = await client.getSession({
  key: created.key ?? 'main:repo:pr-123:review',
  limit: 50,
});

console.log(transcript.messages);

Local inspector against a real Gateway

There are now two inspector modes:

1) Web inspector UI

MCP-inspector-style local app for interactive debugging.

npm run inspector

Then open:

http://127.0.0.1:6274

Current features:

  • connect/disconnect to a real Gateway
  • invoke arbitrary methods with JSON params
  • live event stream
  • raw traffic log
  • saved connection fields in localStorage
  • quick presets for common methods

Note: the default client id is gateway-client because the current Gateway schema validates client.id against the canonical client identifier.

This uses a local proxy server (inspector/server/index.mjs) so the browser UI does not need to implement Gateway auth/device-token handling directly.

2) CLI inspector

Useful for scripts and quick probes.

# one-off call
OPENCLAW_GATEWAY_URL=ws://127.0.0.1:18789 \
OPENCLAW_GATEWAY_TOKEN=... \
npm run inspect -- call health

# call with params
npm run inspect -- call sessions.list --params '{"limit":5}'

# stream all events
npm run inspect -- events

# send chat
npm run inspect -- chat --sessionKey main --message 'hello from inspector'

# interactive REPL
npm run inspect -- repl

Published binary name:

openclaw-gateway-inspector call health

What this gives us:

  • real handshake testing against an actual Gateway
  • event stream inspection
  • ad hoc RPC invocation
  • reproducible debugging for pairing/auth/scope problems
  • a foundation for a richer MCPJam-style inspector app

CI / publish

Included:

  • GitHub Actions CI: typecheck + build + tests
  • GitHub Actions publish workflow for npm releases

Still needed in GitHub repo settings:

  • NPM_TOKEN secret for publish workflow

Notes

  • Scope/method constants are extracted from the current OpenClaw scope model and included directly in the package.
  • Some Gateway methods are intentionally still typed as Record<string, unknown> results where the upstream payload is broad or evolving.
  • The package is Node-first today (ws transport). Browser transport can be added later behind an adapter.