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

@verica-app/observability

v0.1.6

Published

Two-line LLM tracing for Verica: init(token) and your OpenAI/Anthropic calls land as evaluable traces.

Readme

@verica-app/observability

Two-line LLM tracing for Verica: your OpenAI/Anthropic calls land as evaluable traces.

Install

npm install @verica-app/observability

Use (CommonJS / bundled apps)

const { init, wrapGoogleGenAI } = require('@verica-app/observability');

init({
  token: process.env.VERICA_TOKEN, // ingest-scoped API token
});

// Require the clients AFTER init. OpenAI and Anthropic are auto-traced:
const OpenAI = require('openai');
const Anthropic = require('@anthropic-ai/sdk');

// Gemini (@google/genai) has no community instrumentation, so wrap it:
const { GoogleGenAI } = require('@google/genai');
const ai = wrapGoogleGenAI(new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY }));

Use (ESM)

ESM imports cannot be monkey-patched after the fact; pass the module in:

import { init } from '@verica-app/observability';
import * as openai from 'openai';

init({ token: process.env.VERICA_TOKEN, openaiModule: openai });

Google Gemini

wrapGoogleGenAI returns the client with models.generateContent traced (see the CommonJS example above); use it in ESM too by passing the constructed client. Streaming (generateContentStream) passes through untraced for now.

Sessions (multi-turn)

Traces sharing a conversationId reassemble into a Verica session, one turn per request.

Resend history exactly as sent. Turns are stored as deltas: at ingest, Verica matches the history you resend against what previous turns already stored, and that match is exact (byte-identical text). If your app mutates prior messages between requests (for example, appending "Respond in JSON" to the last user message and stripping it from earlier turns when rebuilding the history), no prefix ever matches and every turn falls back to storing, and showing, the full conversation again. Keep injected instructions in the system prompt, or resend them exactly as originally sent.

Agent loops

By default each LLM call lands as its own single-span trace. Wrap a whole agent run in withSpan so every auto-instrumented call inside it (and any nested withSpan / withTool) becomes a child: one trace per run. withTool does the same and marks the span as a tool execution (the GenAI semconv gen_ai.operation.name = execute_tool + gen_ai.tool.name, which Verica detects for tool-span counting and span_check).

const { withSpan, withTool } = require('@verica-app/observability');

const answer = await withSpan('agent.run', async () => {
  await client.chat.completions.create({ ... }); // child span
  const weather = withTool('lookup_weather', () => lookupWeather('Cordoba'));
  return client.chat.completions.create({ ... }); // child span
});

Both take a name and a callback (sync or async) and return its value/promise untouched. The span name is your string verbatim. On a thrown error the span is marked with ERROR status and the exception re-raises unchanged. Fail-open: without init() (or if tracing is broken) the callback just runs and nothing is emitted. See examples/agent.cjs for a full run with two tools.

Tags

Tags land on each trace (traces.tags): filter the workbench by them, and bind criteria to them so evaluation preselects the right criteria per tag.

await init({ token: process.env.VERICA_TOKEN!, tags: ['web', 'prod'] });

const reply = await withTags(['chat', 'premium'], () =>
  withConversation(`chat-${chatId}`, () => openai.chat.completions.create({ ... })),
);

Per-request tags UNION with the globals (dedup, order preserved); nested calls accumulate. Scoping uses AsyncLocalStorage, so it survives awaits and never leaks between concurrent requests. withConversation scopes the session id the same way (overrides the global conversationId; null suppresses it). The server caps at 20 tags x 120 chars.

Serverless

Call await flush() (or await shutdown()) before the runtime freezes so the span batch is exported.

Options

| Option / env var | Default | Notes | | ------------------------------------------- | ---------- | ------------------------------------------------------ | | token / VERICA_TOKEN | (required) | ingest-scoped API token | | captureContent / VERICA_CAPTURE_CONTENT | true | send prompt/response content | | conversationId | (none) | stamps gen_ai.conversation.id | | tags | [] | trace tags; scope with withTags / withConversation | | serviceName / OTEL_SERVICE_NAME | app | resource service.name | | debug / VERICA_DEBUG | false | log export errors |

Fail-open by design: if Verica is unreachable or the token is invalid, spans are dropped and your app is never affected. Export errors are silent unless debug is on.