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

@agentgazer/server

v0.5.5

Published

AgentGazer local server with Express and SQLite

Readme

@agentgazer/server

Express + SQLite API server for AgentGazer. Handles event ingestion, agent management, statistics, alerting, and serves the web dashboard.

Usage

As part of the CLI (typical)

npx agentgazer
# Server starts on port 8080

Programmatic

import { startServer } from "@agentgazer/server";

const { server, shutdown } = await startServer({
  port: 8080,
  token: "your-auth-token",
  dbPath: "/path/to/data.db",
  dashboardDir: "/path/to/dashboard/dist",  // optional
  retentionDays: 30,                        // optional
});

// Later
await shutdown();

API endpoints

All endpoints except /health and /api/auth/verify require Authorization: Bearer <token>.

Health & auth

  • GET /health — Server health check
  • POST /api/auth/verify — Verify auth token

Events

  • POST /api/events — Ingest a batch of events (rate-limited: 1000/min per key)
  • GET /api/events — Query events with filters (agent_id, from, to, provider, model, trace_id, search)
  • GET /api/events/export — Export events as CSV or JSON

Agents

  • GET /api/agents — List registered agents
  • POST /api/agents/register — Register or update an agent
  • POST /api/agents/heartbeat — Record a heartbeat

Statistics

  • GET /api/stats/summary — Aggregated stats (total calls, tokens, cost, errors)
  • GET /api/stats/timeseries — Time-bucketed stats (minute, hour, day)

Alerts

  • GET /api/alerts — List alert rules
  • POST /api/alerts — Create an alert rule
  • PUT /api/alerts/:id — Update an alert rule
  • DELETE /api/alerts/:id — Delete an alert rule
  • PATCH /api/alerts/:id/toggle — Toggle enabled status
  • GET /api/alert-history — View alert delivery history

See openapi.yaml in this package for the full OpenAPI specification.

Alert rule types

| Type | Config | Description | |------|--------|-------------| | agent_down | { duration_minutes: number } | No heartbeat within duration | | error_rate | { window_minutes: number, threshold: number } | Error % exceeds threshold | | budget | { threshold: number } | Daily USD spend exceeds threshold |

Alerts are delivered via webhook and/or email. Webhooks retry up to 3 times with exponential backoff. Email requires SMTP environment variables (SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS).

A 15-minute cooldown prevents duplicate alerts for the same rule.

Data retention

Old events and alert history are automatically purged based on retentionDays (default: 30). Cleanup runs on startup and every 24 hours.

License

Apache-2.0