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

@biroai/agent-events-openclaw

v2026.513.0

Published

**P1.4** from `ROADMAP-NEXT.md` — third runtime adapter for the universal Biro event bus.

Downloads

214

Readme

@biroai/agent-events-openclaw

P1.4 from ROADMAP-NEXT.md — third runtime adapter for the universal Biro event bus.

Translates OpenClaw Gateway hook payloads into normalized BiroAgentEvent objects from @biroai/agent-events.

Relationship to the Gateway adapter

@biroai/adapter-openclaw-gateway invokes the Gateway over WebSocket and handles connection auth, session routing, and result extraction.

This package is a pure translator — no HTTP server, no WebSocket client. It sits in the delivery path after a webhook receiver parses req.body:

OpenClaw Gateway  →  HTTP POST  →  your server receiver
                                        │
                             parseOpenClawHookPayload()
                                        │
                             translateOpenClawEvent()
                                        │
                              BiroAgentEvent[]  →  event bus

Hook payload assumptions

The canonical discriminator field is event, matching the GatewayEventFrame wire format observed in packages/adapters/openclaw-gateway/src/server/execute.ts:

type GatewayEventFrame = { type: "event"; event: string; payload?: unknown }

As a webhook subscriber, the outer envelope is typically unwrapped before delivery, leaving just the inner object. parseOpenClawHookPayload also tolerates type and eventType as fallback discriminators and normalises them to event before translation.

Session identity is resolved from sessionId → runId → generated UUID.

Event mapping

| OpenClaw hook event | BiroAgentEvent type | Notes | |---------------------------|-----------------------------|-------| | session.started | agent.session.started | permissionMode always "unknown"; cwd always null | | session.ended | agent.session.ended | status mapped via END_REASON_MAP | | heartbeat.tick | (dropped — returns []) | Ticks fire on schedule, not on agent turns; emitting session.started per tick would produce misleading duplicates | | tool.call.requested | agent.tool.requested | | | tool.call.completed | agent.tool.completed | | | subagent.spawned | agent.subagent.spawned | | | subagent.completed | agent.subagent.completed | | | channel.message.received| (dropped — returns []) | Channels are P5; not part of the event bus yet | | (unknown) | (dropped — returns []) | Forward-compatible with new hook types |

Compaction events do not exist at the Gateway hook surface. Compaction is internal to the underlying model session and is not surfaced as a hook. No agent.compacted events are emitted by this translator.

Usage

import { parseOpenClawHookPayload, translateOpenClawEvent, translateOpenClawBatch } from "@biroai/agent-events-openclaw";

// Single payload (e.g. from Express req.body)
const raw = parseOpenClawHookPayload(req.body);
if (raw) {
  const events = translateOpenClawEvent(raw, {
    companyId: "co-123",
    agentId:   "agent-456",
    issueId:   "issue-789",
    generateEventId: () => crypto.randomUUID(),
  });
  // events is BiroAgentEvent[]
}

// Batch (buffered payloads)
const events = translateOpenClawBatch(payloads, ctx);

Out of scope for P1.4

  • channel.message.received — channels live in P5.
  • HTTP delivery / webhook receiving — write your own Express/Fastify route that calls into this translator.
  • Compaction events — not surfaced at the Gateway hook layer.
  • File-based state (SOUL.md, MEMORY.md, cookies.md) — OpenClaw's internal source of truth; not part of the hook event surface.

Wire-format TODOs

The following are inferred from the existing adapter rather than official public docs. Verify against live Gateway traces before relying on them in production:

  • Exact field names for token counts on session.ended (totalTokens vs tokenCount vs nested usage.total).
  • Whether heartbeat.tick carries a model field.
  • Whether subagent.spawned uses inheritsBudget or a numeric budget field.
  • The exact set of status values on session.ended beyond success, error, timeout, completed.
  • Whether tool.call.requested nests the input under toolInput or input.