New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

house-client

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

house-client

Minimal Node.js client SDK for the LLM Logging System

latest
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

house-client

Minimal Node.js client SDK for the LLM Logging System.

Features

  • Non-blocking: Log sending doesn't block your main process
  • Batch sending: Multiple operations sent together for efficiency
  • Graceful shutdown: Ensures all logs are sent before process exit
  • TypeScript support: Full type definitions included
  • Minimal dependencies: Works in Node 18+ and Bun

Installation

npm install house-client
# or
yarn add house-client
# or
bun add house-client

Usage

import { LogClient } from 'house-client'

const logClient = new LogClient({
  baseUrl: 'http://localhost:9001',
  apiKey: 'sk_your_api_key_here',
  onError: ({ error }) => {
    console.error('Log send failed:', error.message)
  },
})

// Start a generation (non-blocking - returns immediately)
// generationId and requestId are auto-generated
const gen = logClient.generationStart({
  // Required
  threadId: 'thread-456',
  userId: 'user-789',
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'What is the capital of France?' }],
  // Optional
  tenantId: 'tenant-123', // Tenant ID (auto-created if not exists)
  requestId: 'req-001', // Request ID (defaults to generationId)
  threadTitle: 'Chat about Paris', // Thread title (auto-upserts thread)
  name: 'chat', // Generation name
})

console.log(gen.generationId) // Auto-generated ID

try {
  const result = await streamText({
    // ... your LLM call
    onFinish: ({ usage, response }) => {
      // End generation (non-blocking)
      // latencyMs is auto-calculated
      gen.end({
        responseMessages: response.messages,
        usage,
      })
    },
  })
} catch (error) {
  // Record error (non-blocking)
  gen.error({
    kind: 'error',
    message: error.message,
    stack: error.stack,
  })
}

// Upload a file (sent immediately)
await gen.uploadFile({
  file: fileBuffer,
  filename: 'diagram.png',
  contentType: 'image/png',
})

Graceful Shutdown

Ensure all pending logs are sent before your process exits:

process.on('SIGTERM', async () => {
  await logClient.shutdown()
  process.exit(0)
})

// Or manually flush
await logClient.flush()

API Reference

LogClient

new LogClient({
  baseUrl: string,           // Server URL
  apiKey: string,            // API key
  concurrency?: number,      // Max concurrent requests (default: 5)
  onError?: (params) => void // Error callback
})
MethodReturnsDescription
generationStart(params)GenerationStart a new generation. Non-blocking.
flush()Promise<void>Force send all pending logs
shutdown()Promise<void>Graceful shutdown (flush + stop accepting)
getQueueStatus(){ pending, inFlight }Get queue status

Generation

PropertyTypeDescription
generationIdstringAuto-generated unique ID
MethodReturnsDescription
end(params)voidComplete generation. Non-blocking.
error(params)voidRecord an error. Non-blocking.
uploadFile(params)Promise<{ fileId }>Upload a file (sent immediately)

Publishing to npm

Prerequisites

  • npm account with publish access
  • Logged in to npm: npm login

Publish steps

# 1. Navigate to client-sdk directory
cd packages/client-sdk

# 2. Update version (choose one)
npm version patch  # 0.1.0 -> 0.1.1
npm version minor  # 0.1.0 -> 0.2.0
npm version major  # 0.1.0 -> 1.0.0

# 3. Build (runs automatically via prepublishOnly)
bun run build

# 4. Dry run to verify package contents
npm publish --dry-run

# 5. Publish to npm
npm publish

# 6. (Optional) Push version tag to git
git push && git push --tags

Verify published package

# Check package info
npm info house-client

# Install in a test project
npm install house-client

CI/CD Publishing

For automated publishing, set the NPM_TOKEN environment variable:

# In CI environment
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish

Keywords

llm

FAQs

Package last updated on 20 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts