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

@principal-ai/agent-monitoring

v0.3.22

Published

Agent event monitoring and processing system

Readme

@principal-ai/agent-monitoring

Agent event monitoring and processing system for AI coding assistants.

Overview

This package provides a unified monitoring and event processing system for various AI coding assistants including Claude, Cline, and OpenCode. It offers:

  • Normalized event types across different agents
  • Path normalization and file operation detection
  • Event processors for each supported agent
  • Hook configuration utilities
  • Type-safe event handling

Installation

bun install @principal-ai/agent-monitoring

Features

Supported Agents

  • Claude (Anthropic's CLI)
  • Cline (VS Code extension)
  • OpenCode (Open source CLI)
  • Droid (Factory AI)

Event Processing

  • Unified event normalization across agents
  • Tool usage tracking
  • File operation detection
  • Path context analysis

Hook Configuration

  • Agent-specific hook types
  • Configurable matchers
  • Event filtering

Usage

import {
  SupportedAgent,
  ClaudeEventProcessor,
  AgentEventPipeline,
  CLAUDE_HOOK_TYPES,
} from "@principal-ai/agent-monitoring";

// Process a raw Claude event
const processor = new ClaudeEventProcessor();
const universalEvent = processor.normalize(rawClaudeHookData);

// Or use the full pipeline with path normalization
const pipeline = new AgentEventPipeline(pathAdapter, {
  metrics: {
    onEventProcessed: (event, durationMs, agent) => {
      console.log(`Processed ${agent} event in ${durationMs}ms`);
    },
  },
});

const normalizedEvent = await pipeline.processRawEvent(
  SupportedAgent.CLAUDE,
  rawClaudeHookData
);

// Access normalized data
console.log(normalizedEvent.repository?.branch);
console.log(normalizedEvent.files?.map(f => f.displayPath));

API Reference

Types

  • SupportedAgent - Enum of supported AI agents (claude, cline, opencode, droid)
  • UniversalAgentSessionEvent - Agent-normalized event format (intermediate)
  • RepoNormalizedUniversalAgentSessionEvent - Final event format with repository context
  • NormalizedPathInfo - File path with repository metadata and context
  • PathContext - File classification enum (REPO_FILE, SYSTEM_FILE, USER_FILE, TEMP_FILE, CONFIG_FILE)
  • FileOperation - Operation type enum (READ, WRITE, CREATE, DELETE, EDIT, SEARCH, LIST)

Event Processors

  • ClaudeEventProcessor - Normalize Claude hook events
  • ClineEventProcessor - Normalize Cline hook events
  • OpenCodeEventProcessor - Normalize OpenCode hook events
  • DroidEventProcessor - Normalize Droid hook events

Pipeline

  • AgentEventPipeline - Full processing pipeline with path normalization
  • PathNormalizationService - Service for enriching paths with repository context

Hook Types

  • CLAUDE_HOOK_TYPES - Available Claude hook event types
  • CLINE_HOOK_TYPES - Available Cline hook event types
  • OPENCODE_HOOK_TYPES - Available OpenCode hook event types
  • DROID_HOOK_TYPES - Available Droid hook event types

Utility Functions

  • getAvailableHookTypes(agent) - Get hook types for a specific agent
  • getHookTypeDisplayName(hookType) - Get human-readable hook type name
  • getHookTypeDescription(hookType) - Get hook type description
  • isToolEvent(event) - Check if event is a tool use event
  • isStopEvent(event) - Check if event is a stop event
  • getEventFilePaths(event) - Extract file paths from an event
  • classifyPath(path) - Classify a file path into a PathContext

License

MIT