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

@gnsx/genesys.agent.client

v0.3.4

Published

TypeScript client library for Genesys Agent Server

Readme

Genesys Agent Client

Summary

The Genesys Agent Client (@gnsx/genesys.agent.client) is a TypeScript/JavaScript library for integrating AI-powered development agents into web applications and browser-based tools. It provides a WebSocket-based client for real-time communication with Genesys Agent Server instances.

Key Features

  • Real-Time Communication: WebSocket-based connection for instant bidirectional communication with agent servers
  • Session Management: Automatic session creation, connection, and lifecycle management
  • Event-Driven Architecture: Comprehensive event system for handling agent messages, tool calls, and state changes
  • Auto-Reconnection: Built-in automatic reconnection with exponential backoff and configurable retry limits
  • Full TypeScript Support: Complete type definitions for all APIs, events, and messages
  • Browser & Node.js Compatible: Works in both browser and Node.js environments
  • Lightweight: Minimal dependencies, optimized for web applications

Installation

Prerequisites

  • Node.js: Version 18 or higher (for development)
  • Browser: Modern browser with WebSocket support (for runtime)
  • Package Manager: npm, yarn, or pnpm

Installation

Install the client library using your preferred package manager:

npm:

npm install @gnsx/genesys.agent.client

pnpm:

pnpm add @gnsx/genesys.agent.client

yarn:

yarn add @gnsx/genesys.agent.client

Usage

Basic Example

import { GenesysAgentClient, ClientEventType, AgentEventType } from '@gnsx/genesys.agent.client';

const client = new GenesysAgentClient({ autoReconnect: true });

// Connect to server
await client.connect({
  serverAddress: 'http://localhost:3000',
  specPath: 'coder.yaml'
});

// Listen for agent responses
client.on(ClientEventType.SERVER_MESSAGE, (message) => {
  if (message.type === 'agentEvent') {
    switch (message.event.type) {
      case AgentEventType.AGENT_MESSAGE:
        console.log('Agent:', message.event.data.message);
        break;
      case AgentEventType.STREAM_CHUNK:
        console.log('Chunk:', message.event.data.chunk);
        break;
      case AgentEventType.TOOL_CALL:
        console.log('Tool:', message.event.data.toolName);
        break;
    }
  }
});

// Send messages
client.sendInput('Write a hello world function');

// Disconnect when done
client.disconnect();

Configuration Options

const client = new GenesysAgentClient({
  autoReconnect: true,              // Enable automatic reconnection (default: true)
  maxReconnectAttempts: 5,          // Max reconnection attempts (default: 5)
  reconnectInterval: 1000,          // Initial interval in ms, uses exponential backoff (default: 1000)
  debug: false                      // Enable debug logging (default: false)
});

await client.connect({
  serverAddress: 'http://localhost:3000',  // Agent server HTTP address
  specPath: 'coder.yaml'                   // Agent specification file path
});

Error Handling

try {
  await client.connect(config);
} catch (error) {
  console.error('Connection failed:', error);
}

client.on(ClientEventType.DISCONNECTED, (reason) => {
  console.log('Disconnected:', reason);
});

Event Types

The client emits events for:

  • SERVER_MESSAGE - All messages from the server (agent responses, tool calls, errors, etc.)
  • STATE_CHANGE - Connection state changes (connecting, connected, reconnecting, disconnected)
  • DISCONNECTED - Connection closed
  • CONTROL_MESSAGE - Status messages (e.g., reconnection attempts)