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

@vreko/local-service-client

v1.0.1

Published

TypeScript client for Vreko local service (vrekod) via IPC

Readme


TypeScript client library for connecting to the Vreko local coordination service (vrekod) via IPC.

Features

  • Type-safe API: Full TypeScript support with typed method wrappers
  • Auto-reconnection: Exponential backoff reconnection strategy
  • Request correlation: Automatic request/response matching with timeout handling
  • Event-driven: Subscribe to connection state changes and server notifications
  • Cross-platform: Unix sockets (macOS/Linux) and named pipes (Windows)

Installation

pnpm add @vreko/local-service-client

Quick Start

import { VrekoLocalClient } from '@vreko/local-service-client';

// Create client
const client = new VrekoLocalClient();

// Connect to service
await client.connect();

// Initialize protocol
await client.initialize({
  protocolVersion: '1.0.0',
  clientInfo: {
    name: 'my-app',
    version: '1.0.0'
  }
});

// Use type-safe methods
const snapshot = await client.snapshot.create({
  filePath: '/path/to/file.ts',
  content: 'const x = 1;',
  trigger: 'save'
});

console.log('Created snapshot:', snapshot.id);

// Clean up
client.close();

API

Client Options

interface ClientOptions {
  socketPath?: string;           // Default: platform-specific
  timeout?: number;               // Default: 30000ms
  autoReconnect?: boolean;        // Default: true
  maxReconnectAttempts?: number;  // Default: 5
  reconnectDelay?: number;        // Default: 1000ms
  maxReconnectDelay?: number;     // Default: 30000ms
}

Method Namespaces

Health

// Check service health
const health = await client.health.check({ verbose: true });

// Simple ping
const pong = await client.health.ping();

Session

// Get current session
const { session } = await client.session.current();

// Start new session
const newSession = await client.session.start({
  workspacePath: '/path/to/workspace'
});

// End session
await client.session.end();

// List sessions
const { sessions } = await client.session.list({ limit: 10 });

Snapshot

// Create snapshot
const snapshot = await client.snapshot.create({
  filePath: '/path/to/file.ts',
  content: 'code here',
  trigger: 'save'
});

// Get snapshot
const vreko = await client.snapshot.get({
  snapshotId: 'vreko-123',
  includeContent: true
});

// List snapshots
const { snapshots } = await client.snapshot.list({
  filePath: '/path/to/file.ts',
  limit: 50
});

// Restore snapshot
const restored = await client.snapshot.restore({
  snapshotId: 'vreko-123',
  createBackup: true
});

// Diff snapshots
const diff = await client.snapshot.diff({
  baseSnapshotId: 'vreko-123',
  compareSnapshotId: 'vreko-456'
});

// Delete snapshots
await client.snapshot.delete({
  snapshotIds: ['vreko-123', 'vreko-456']
});

Protection

// Evaluate protection policy
const decision = await client.protection.evaluate({
  filePath: '/path/to/file.ts'
});

// Get protection levels
const { levels } = await client.protection.levels({
  filePaths: ['/path/to/file1.ts', '/path/to/file2.ts']
});

// Set protection level
await client.protection.set({
  filePath: '/path/to/file.ts',
  level: 'warn',
  scope: 'file'
});

Detection

// Check for AI activity
const result = await client.detection.check({
  filePath: '/path/to/file.ts',
  content: 'new content',
  previousContent: 'old content'
});

console.log('AI detected:', result.detected, 'confidence:', result.confidence);

Events

// Connection state changes
client.on('stateChange', (state) => {
  console.log('State:', state); // 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'closed'
});

// Connection established
client.on('connected', () => {
  console.log('Connected to service');
});

// Connection lost
client.on('disconnected', (error) => {
  console.log('Disconnected:', error?.message);
});

// Reconnection attempts
client.on('reconnecting', (attempt, maxAttempts) => {
  console.log(`Reconnecting (${attempt}/${maxAttempts})...`);
});

// Server notifications
client.on('notification', (method, params) => {
  console.log('Notification:', method, params);
});

// Errors
client.on('error', (error) => {
  console.error('Error:', error);
});

Error Handling

import { JsonRpcClientError, RequestTimeoutError, ConnectionTimeoutError } from '@vreko/local-service-client';

try {
  await client.snapshot.create({ ... });
} catch (error) {
  if (error instanceof JsonRpcClientError) {
    console.error('Server error:', error.code, error.message, error.data);
  } else if (error instanceof RequestTimeoutError) {
    console.error('Request timed out');
  } else if (error instanceof ConnectionTimeoutError) {
    console.error('Connection timed out');
  }
}

Development

# Install dependencies
pnpm install

# Build
pnpm build

# Run tests
pnpm test

# Type check
pnpm type-check

# Lint
pnpm lint

License

Apache-2.0