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

primeorbit

v0.1.3

Published

Official PrimeOrbit SDK for Node.js - Track conversations, model responses, user feedback, and custom analytics

Readme

PrimeOrbit JavaScript SDK

Track conversations, model responses, user feedback, and custom analytics through a simple event-based API.

Installation

npm install primeorbit

Quick Start

import { PrimeOrbitClient } from 'primeorbit';

const po = new PrimeOrbitClient(
  'np_live_abc123', // Your API Key
  'https://sdk.primeorbit.ai', // Endpoint
);

// Set base properties once
po.add_properties({
  agentId: 'agent_456',
  conversationId: 'conv_789',
  userId: 'user_123',
});

// Record events
po.record_raw_event('user_message', {
  content: 'Hello, I need help!',
});

Configuration

API Key and Endpoint

You can provide credentials in two ways:

  1. Direct parameters:
const po = new PrimeOrbitClient('your-api-key', 'https://sdk.primeorbit.ai');
  1. Environment variables:
PRIMEORBIT_API_KEY=your-api-key
PRIMEORBIT_ENDPOINT=https://sdk.primeorbit.ai
const po = new PrimeOrbitClient(); // Uses env variables

Logging

Control SDK logging verbosity:

import { setLogLevel } from 'primeorbit';

// Available levels: 'debug', 'info', 'warn', 'error', 'silent'
setLogLevel('debug'); // Show all logs including debug
setLogLevel('error'); // Only show errors
setLogLevel('silent'); // Disable all logging

Base Properties

Set properties once to include in all events:

po.add_properties({
  agentId: 'agent_456',
  conversationId: 'conv_789',
  userId: 'user_123',
  sessionId: 'sess_001',
  platform: 'web',
});

Event Types

Message Events

  • user_message - User sends a message
  • agent_response - Agent/bot responds

Feedback Events

  • user_feedback - Free text feedback

Required Fields

| Field | Type | Description | | ---------------- | ------ | --------------------------------------- | | conversationId | string | Unique ID representing the conversation | | userId | string | ID of the end user | | content | string | Message text or feedback content |

Optional Fields

| Field | Type | Description | | -------------- | ------ | ------------------------------------------------ | | eventId | string | Unique event identifier | | agentId | string | ID of the agent/app/model that handled the event | | sessionId | string | Session identifier | | messageId | string | Message ID for tracking within conversation | | inputMode | string | e.g., "text", "voice", "button" | | experimentId | string | A/B test or experiment tracking | | appId | string | Application identifier | | device | string | Device type (mobile, desktop) | | country | string | User's country (ISO code) | | platform | string | Platform (web, ios, android) | | model | string | Model name for agent_response events |

Any additional fields are captured in additional_properties.

Event Examples

User Message

po.record_raw_event('user_message', {
  content: 'Hello, I need help!',
});

Agent Response

po.record_raw_event('agent_response', {
  content: 'Sure! What can I help you with?',
  model: 'gpt-4',
});

User Feedback

po.record_raw_event('user_feedback', {
  content: "The answer wasn't very helpful.",
});

Latency Tracking

Wrap functions to automatically track execution time:

import { wrapToRecordLatency } from 'primeorbit';

// Wrap any function
const wrappedFn = wrapToRecordLatency(myFunction, 'agent-id', 'action-name');

// For type-safe async/sync wrappers
import { wrapAsyncToRecordLatency, wrapSyncToRecordLatency } from 'primeorbit';

const wrappedAsync = wrapAsyncToRecordLatency(myAsyncFn, 'agent-id');
const wrappedSync = wrapSyncToRecordLatency(mySyncFn, 'agent-id');

Standalone Feedback Functions

import { record_star_rating, record_thumbs_feedback } from 'primeorbit';

// Star rating (1-5)
record_star_rating('agent-id', 5, 'task-name', 'user-id');

// Thumbs feedback
record_thumbs_feedback('agent-id', true, 'task-name', 'user-id'); // thumbs up
record_thumbs_feedback('agent-id', false, 'task-name', 'user-id'); // thumbs down

Complete Example

import { PrimeOrbitClient, setLogLevel } from 'primeorbit';

// Configure logging (optional)
setLogLevel('info');

// Initialize the client
const po = new PrimeOrbitClient('YOUR_API_KEY', 'https://sdk.primeorbit.ai');

// Set conversation metadata
po.add_properties({
  userId: 'user_123',
  agentId: 'agent_001',
  conversationId: 'conv_456',
  sessionId: 'session_789',
});

async function handleConversation() {
  const userMessage = 'Hello, I need help!';

  // Record user message
  await po.record_raw_event('user_message', {
    content: userMessage,
  });

  // Get bot response (your logic here)
  const botResponse = await getBotResponse(userMessage);

  // Record agent response
  await po.record_raw_event('agent_response', {
    content: botResponse,
    model: 'gpt-4',
  });
}

handleConversation();

TypeScript Support

The SDK is written in TypeScript and includes full type definitions.

import { PrimeOrbitClient, LogLevel, setLogLevel } from 'primeorbit';

const level: LogLevel = 'debug';
setLogLevel(level);

const client = new PrimeOrbitClient('api-key');

API Reference

PrimeOrbitClient

  • constructor(apiKey?: string, endpoint?: string) - Create a new client
  • add_properties(props: Record<string, unknown>) - Set base properties
  • record_raw_event(eventType, params) - Record an event

Logging

  • setLogLevel(level: LogLevel) - Set log level
  • getLogLevel(): LogLevel - Get current log level
  • logger - Direct access to logger instance

Latency Tracking

  • wrapToRecordLatency(fn, agentId, actionId?) - Wrap any function
  • wrapSyncToRecordLatency(fn, agentId, actionId?) - Wrap sync function
  • wrapAsyncToRecordLatency(fn, agentId, actionId?) - Wrap async function

Feedback

  • record_star_rating(agentId, rating, taskName, userId?) - Record star rating
  • record_thumbs_feedback(agentId, isThumbsUp, taskName, userId?) - Record thumbs

License

MIT