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

@doclight/node

v0.1.0

Published

Node.js HTTP transport and lifecycle integration for the Doclight Agent Observability SDK

Readme

@doclight/node

Node.js HTTP transport and process lifecycle integration for Doclight. Depends on @doclight/core for schemas, client, queue, and flusher.

Install

npm install @doclight/node

Environment variables

| Variable | Required | Description | | --- | --- | --- | | DOCLIGHT_API_KEY | yes | API key from the doclight.app dashboard | | DOCLIGHT_PROJECT_ID | yes | Project ID from the doclight.app dashboard | | DOCLIGHT_ENDPOINT | no | Override ingest endpoint (default: https://ingest.doclight.app) |

Quickstart

import { createDoclight } from "@doclight/node"

const client = createDoclight({
  apiKey: process.env.DOCLIGHT_API_KEY!,
  projectId: process.env.DOCLIGHT_PROJECT_ID!,
})

const sessionId = client.startSession("checkout fix")
client.trackToolCall({ sessionId, toolName: "grep", status: "success", durationMs: 12 })
client.endSession(sessionId, "success")

await client.shutdown()
console.log("sent:", client.getStats().sent) // verify >= 1

createDoclight() wires HttpTransport, sets sdk to @doclight/node/<version>, and registers process lifecycle hooks by default.

What is tracked / what is never tracked

| Tracked | Never tracked | | --- | --- | | Tool name, duration, outcome | Tool input arguments | | Session ID, session goal | User messages or prompts | | HTTP status codes | Request/response bodies | | Error types and retry counts | API keys or credentials | | Timing and counts | File contents or PII |

HTTP transport

POST {endpoint}/v1/events/batch with JSON IngestBatchRequest body.

Production endpoint: https://ingest.doclight.app. For local development against the Python ingest service in apps/api, use http://localhost:8787.

Headers:

  • Authorization: Bearer <apiKey>
  • Content-Type: application/json
  • x-doclight-sdk: @doclight/node/<version>

Retryable status mapping

| HTTP outcome | Retryable | | --- | --- | | 2xx | — (success) | | 408 Request Timeout | yes | | 429 Too Many Requests | yes | | 5xx | yes | | Network error / abort / timeout | yes | | Other 4xx (400, 401, 413, …) | no |

Non-retryable 4xx means the payload or credentials will not fix themselves on retry.

Lifecycle hooks

By default createDoclight() registers hooks once per process:

  • beforeExit: calls shutdown() on all clients created with hooks enabled
  • SIGTERM / SIGINT: await shutdown() on all clients, then re-delivers the signal via process.kill(process.pid, signal) so the process still exits normally

Pass lifecycleHooks: false to opt out (recommended in tests).

Advanced

import { HttpTransport, Doclight } from "@doclight/node"

const client = new Doclight({
  apiKey: "...",
  projectId: "...",
  sender: new HttpTransport({ apiKey: "...", endpoint: "https://ingest.doclight.app" }),
})

All @doclight/core types and exports are re-exported from this package.


For MCP server instrumentation, see @doclight/mcp.

Full documentation →