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

@ailog/cli

v0.4.1

Published

CLI to run the ailog LLM logging dashboard

Readme

ailog

Local devtools for inspecting LLM calls. Records generateText / streamText (or any provider you instrument by hand) to disk and serves it in a live web viewer.

Local development only. Throws if NODE_ENV=production.

Install

bun add -D @ailog/cli
# or
npm install -D @ailog/cli

Usage

AI SDK middleware

import { wrapLanguageModel } from 'ai';
import { aiSdkMiddleware } from '@ailog/cli';

const model = wrapLanguageModel({
  middleware: aiSdkMiddleware(),
  model: anthropic('claude-opus-4-7'),
});

Provider-agnostic logger

For non-AI-SDK providers, record runs manually:

import { createLogger } from '@ailog/cli';

const run = await createLogger({ functionId: 'chat' });
const step = await run.step({
  modelId: 'claude-opus-4-7',
  provider: 'anthropic',
  input: { messages },
});
try {
  const res = await callAnthropic(messages);
  await step.end({ output: res, usage: res.usage });
} catch (err) {
  await step.end({ error: err });
  throw err;
}

Threads

Tag a run with a threadId to group it with other runs from the same logical conversation / session / workflow. The viewer renders the id as a small #thread-id pill on each run card, and a Thread record (id, created_at, updated_at, run_count) is persisted in .ailog/index.json for future thread-list features.

await createLogger({
  threadId: 'chat-42',
  functionId: 'message',
});
  • threadId is honored only on the first writer that creates a given run (first-writer-wins, like functionId / metadata).
  • Runs without a threadId simply don't appear in any thread.

Metadata

Attach arbitrary fields to a run. Child runs (subagents) inherit metadata automatically — shallow-merged, with metadata: null to opt out:

await createLogger({
  metadata: { userId: 'u_42', organizationId: 'o_lr' },
});

Rendered as key: value pills on the run header.

Subagents (shared threadId)

Each aiSdkMiddleware instance owns one Run automatically. To group orchestrator and subagent calls — each constructed with its own wrapped model — share a threadId. They show up side-by-side under the same Thread in the viewer.

import { aiSdkMiddleware } from '@ailog/cli';

const orchestrator = wrapLanguageModel({
  middleware: aiSdkMiddleware({
    threadId: 'tokyo',
    functionId: 'orchestrator',
    metadata: { userId: '...' },
  }),
  model,
});

const tools = {
  research: tool({
    execute: async ({ question }) => {
      const sub = wrapLanguageModel({
        // Share only the threadId — each tool call gets its own Run in the same Thread.
        middleware: aiSdkMiddleware({ threadId: 'tokyo', functionId: 'researcher' }),
        model,
      });
      return { answer: (await generateText({ model: sub, prompt: question })).text };
    },
  }),
};

await generateText({ model: orchestrator, tools, ... });

Rules:

  • threadId is auto-generated (auto-<short>) when omitted, so every run still belongs to a Thread.
  • metadata lives on the Thread record (not the Run). First-writer-wins: only the call that creates the Thread sets it.
  • Run ids are always auto-generated; you can't reuse one across loggers. Share a Thread, not a Run.

Viewer

bunx ailog   # → http://localhost:4985  (override via AILOG_PORT)

How it works

your code → middleware / createLogger → .ailog/{index, runs/*, blobs/*} → Hono API → React UI

Each step write touches only its run's small JSON file plus the index — never the whole history. Large raw_* fields are externalized into .ailog/blobs/. Aborted requests (Ctrl-C) close in-flight steps with error: 'Request aborted' before exit.

License

Apache-2.0. Structure and viewer code derived from @ai-sdk/devtools (Apache-2.0). See NOTICE for attribution.