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

@codmir/sdk

v1.0.6

Published

Official Codmir SDK - TypeScript/JavaScript library for the Codmir API

Readme

@codmir/sdk

Official TypeScript/JavaScript SDK for the Codmir platform.

npm version License

Installation

npm install @codmir/sdk

Platform Imports

| Use case | Import | |----------|--------| | AI monitoring | @codmir/sdk/ai | | Error tracking | @codmir/sdk/overseer | | Next.js | @codmir/sdk/nextjs | | Express | @codmir/sdk/express | | React Native | @codmir/sdk/react-native | | Browser (vanilla) | @codmir/sdk/browser | | Remix | @codmir/sdk/remix | | Serverless | @codmir/sdk/serverless | | API client | @codmir/sdk | | Setup verification | @codmir/sdk/verify |

AI Monitoring

Track every LLM call across providers with two lines of setup. Token usage, cost, latency, and errors are captured automatically.

Wrap OpenAI

import * as Codmir from '@codmir/sdk/ai';
import OpenAI from 'openai';

Codmir.init({
  dsn: process.env.CODMIR_DSN,
});

const openai = Codmir.wrapOpenAI(new OpenAI());

// Every call is now tracked — tokens, cost, latency
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Hello' }],
});

Wrap Anthropic

import * as Codmir from '@codmir/sdk/ai';
import Anthropic from '@anthropic-ai/sdk';

Codmir.init({ dsn: process.env.CODMIR_DSN });

const anthropic = Codmir.wrapAnthropic(new Anthropic());

const response = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello' }],
});

Generic provider

import { trackAICall } from '@codmir/sdk/ai';

const result = await trackAICall('custom', { model: 'llama-3' }, async () => {
  return await myProvider.generate('Hello');
});

Usage summary

const summary = Codmir.getAIUsageSummary();
console.log(`Total cost: $${summary.totalCost.toFixed(4)}`);
console.log(`Calls: ${summary.totalCalls}`);
console.log(`Avg latency: ${summary.avgLatencyMs}ms`);

Agent Session Tracing

Correlate LLM calls into replayable agent sessions. Every tool call, decision, and error is captured in a timeline you can debug like a video.

import * as Codmir from '@codmir/sdk/ai';

Codmir.init({ dsn: process.env.CODMIR_DSN });

// Start a session
const session = Codmir.startSession({
  agent: 'support-bot',
  metadata: { userId: 'u_123', ticket: 'T-456' },
});

// All LLM calls are automatically correlated
await openai.chat.completions.create({ ... });

// Add custom decision events
Codmir.addSessionEvent('decision', {
  action: 'escalate_to_human',
  reason: 'confidence_below_threshold',
  confidence: 0.42,
});

// Group related work into spans
Codmir.startSessionSpan('tool_execution');
// ... tool work ...
Codmir.endSessionSpan();

// End and flush to your dashboard
const completed = Codmir.endSession();
await Codmir.flushSession(completed);

Error Tracking

Next.js

// instrumentation-client.ts
import * as Codmir from '@codmir/sdk/nextjs';

Codmir.init({
  dsn: process.env.NEXT_PUBLIC_OVERSEER_DSN,
  environment: process.env.NODE_ENV,
  release: process.env.NEXT_PUBLIC_APP_VERSION,
});

React Native

import * as Codmir from '@codmir/sdk/react-native';

Codmir.init({
  dsn: 'https://your-project.codmir.com/api/overseer',
});

Codmir.trackScreenView('HomeScreen');

Browser

import { init, captureException } from '@codmir/sdk/browser';

init({
  dsn: 'https://your-project.codmir.com/api/overseer',
  trackClicks: true,
  trackRequests: true,
});

Verify Your Setup

After installing, confirm the SDK can reach your project:

import { verify, printVerifyResult } from '@codmir/sdk/verify';

const result = await verify({
  dsn: process.env.CODMIR_DSN,
  onProgress: (step) => console.log(`[${step.status}] ${step.message}`),
});

console.log(printVerifyResult(result));

Or the one-liner:

import { quickVerify } from '@codmir/sdk/verify';

const ok = await quickVerify(process.env.CODMIR_DSN);

API Client

import { CodmirClient } from '@codmir/sdk';

const client = new CodmirClient({
  apiKey: process.env.CODMIR_API_KEY,
});

// Projects
const projects = await client.listProjects();

// Tickets
const ticket = await client.createTicket({
  title: 'Fix login bug',
  type: 'bug',
  priority: 'high',
  projectId: 'project-123',
});

// AI chat
const response = await client.chat('How is auth implemented?', {
  projectId: 'project-123',
});

// Agent tasks
const task = await client.createAgentTask({
  type: 'code_review',
  prompt: 'Review this PR for security issues',
  projectId: 'project-123',
});

Configuration

Codmir.init({
  dsn: process.env.CODMIR_DSN,
  environment: 'production',
  release: '1.2.0',
  sampleRate: 1.0,

  // AI monitoring options
  trackTokenUsage: true,
  trackCosts: true,
  trackLatency: true,
  capturePrompts: false,       // privacy-sensitive
  captureResponses: false,     // privacy-sensitive
  redactPatterns: [/sk-[a-zA-Z0-9]+/g],
});

Error Handling

import { CodmirClient, CodmirApiError } from '@codmir/sdk';

try {
  await client.getTicket('project-id', 'invalid-id');
} catch (error) {
  if (error instanceof CodmirApiError) {
    console.error(`${error.code}: ${error.message} (${error.statusCode})`);
  }
}

TypeScript

Full type exports:

import type {
  AIMonitorConfig,
  AIUsageSummary,
  AgentSession,
  SessionEvent,
  SessionSpan,
  Ticket,
  AgentTask,
} from '@codmir/sdk';

Requirements

  • Node.js >= 18.0.0
  • TypeScript >= 5.0 (optional)

License

Apache-2.0