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/agent-tracing

v2.94.0

Published

Tracing infrastructure for KB Labs Agents — NDJSON writer, privacy redaction, trace loading and analysis

Readme

@kb-labs/agent-tracing

Execution tracing and observability for KB Labs agents. Writes crash-safe NDJSON trace files with privacy redaction and provides tools for loading and analyzing traces.

Features

  • Crash-safe NDJSON — append-only writes, no data loss on crash
  • Incremental flushing — traces available in real-time during execution
  • Privacy redaction — strips API keys, tokens, personal paths
  • Trace indexing — fast lookups by event type, tool name, iteration
  • Helper factories — type-safe builders for all event types

Components

IncrementalTraceWriter

Main tracer for production. Writes events to NDJSON file with automatic flushing and indexing.

import { IncrementalTraceWriter } from '@kb-labs/agent-tracing';

const writer = new IncrementalTraceWriter({
  outputPath: './traces/run-001.ndjson',
  flushIntervalMs: 1000,
});

writer.write(traceAgentStart({ task, tier, maxIterations, toolCount }));
// ... agent execution ...
writer.write(traceAgentEnd({ success, summary, iterations, tokensUsed, durationMs }));

await writer.close();

FileTracer

In-memory tracer for tests and development.

TraceLoader

Loads and validates existing NDJSON trace files for CLI analysis commands.

import { loadTrace } from '@kb-labs/agent-tracing';

const result = loadTrace('./traces/run-001.ndjson');
if (result.ok) {
  console.log(`${result.events.length} events loaded`);
}

PrivacyRedactor

Redacts sensitive data before persistence:

  • API keys and tokens (sk-..., Bearer ...)
  • Personal file paths (/Users/name/...~/...)
  • Environment variables with secrets

Trace Helpers

Factory functions for all trace event types:

import {
  traceAgentStart,
  traceToolStart,
  traceToolEnd,
  traceLLMEnd,
} from '@kb-labs/agent-tracing';

Trace Format

Each line in an NDJSON file is a JSON object:

{"type":"agent:start","timestamp":"...","data":{"task":"Fix bug","tier":"medium"}}
{"type":"tool:start","timestamp":"...","data":{"toolName":"fs_read","input":{"path":"src/auth.ts"}}}
{"type":"tool:end","timestamp":"...","data":{"toolName":"fs_read","success":true,"durationMs":12}}

Default location: .kb/traces/incremental/.

Dependencies

  • @kb-labs/agent-contracts — event type definitions
  • @kb-labs/sdk — platform SDK