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-claude-code

v2026.513.0

Published

**P1.2** from `ROADMAP-NEXT.md` — the first runtime adapter for the Biro universal agent event bus.

Readme

@biroai/agent-events-claude-code

P1.2 from ROADMAP-NEXT.md — the first runtime adapter for the Biro universal agent event bus.

Parses Claude Code --output-format stream-json NDJSON events and emits normalized BiroAgentEvent objects from @biroai/agent-events. Pure: no I/O, no subprocess management, no Anthropic SDK dependency — input is an event object or async line stream, output is validated schema events.

Usage

Per-line (sync)

import { parseClaudeStreamLine, translateClaudeEvent } from "@biroai/agent-events-claude-code";
import { randomUUID } from "node:crypto";

const ctx = {
  companyId: "co-abc",
  agentId: "agent-xyz",
  issueId: null,
  generateEventId: () => randomUUID(),
  inFlightTools: new Map(), // reuse across lines for durationMs tracking
};

for (const line of rawLines) {
  const raw = parseClaudeStreamLine(line);
  if (!raw) continue;
  const events = translateClaudeEvent(raw, ctx);
  for (const ev of events) {
    // ev is a validated BiroAgentEvent — safe to persist or broadcast
    console.log(ev.type, ev.eventId);
  }
}

Async streaming

import { translateClaudeStream } from "@biroai/agent-events-claude-code";
import { createInterface } from "node:readline";
import { randomUUID } from "node:crypto";

async function processStream(readable: NodeJS.ReadableStream) {
  const rl = createInterface({ input: readable, crlfDelay: Infinity });
  const ctx = { companyId: "co-abc", agentId: "agent-xyz", issueId: null, generateEventId: randomUUID };

  for await (const ev of translateClaudeStream(rl, ctx)) {
    await persistEvent(ev); // your downstream
  }
}

Event type coverage

| Raw event | Emitted BiroAgentEvent(s) | |-----------|--------------------------| | system/init | agent.session.started | | assistant (tool_use blocks) | agent.tool.requested × N | | assistant (Task tool) | agent.tool.requested + agent.subagent.spawned | | assistant (any content) | agent.turn.completed | | user (tool_result blocks) | agent.tool.completed × N | | result | agent.session.ended | | system/compact_summary or compact_boundary | agent.compacted | | Unknown types | (empty — dropped silently) |

Pointer

Schema types and Zod validators: @biroai/agent-events

Limitations

  • agent.subagent.completed is not emitted. Correlating a Task tool result back to the sub-agent's session would require cross-stream state that belongs upstream of this package.
  • durationMs on agent.tool.completed is wall-clock from translation time (not tool execution start), because stream-json tool_use blocks carry no timestamp. Pass a shared inFlightTools map across lines to get a reasonable approximation; without it, durationMs is 0.
  • toolName on agent.tool.completed is populated with the tool_use_id because tool_result blocks do not repeat the tool name. Downstream consumers can join on toolUseId.

Schema TODOs

  • Compaction event shape is not fully documented as of 2026-05. Fields tokens_before, tokens_after, and summary are inferred from community observation for compact_summary; compact_boundary appears to carry no token data. Both default to 0 when absent. See comment in src/translate.ts.
  • agent.subagent.completed exists in @biroai/agent-events but is not emitted here. The wire format would require the parent to track tool_use_id → sub-session mapping across event boundaries.