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

@cimulate/agentforce-sdk

v1.0.7

Published

A lightweight TypeScript SDK for Salesforce SCRT2 Agentforce Messaging APIs

Readme

@cimulate/agentforce-sdk

A lightweight TypeScript SDK for Salesforce SCRT2 (Messaging for In-App and Web) APIs. Zero runtime dependencies beyond tslib.

Installation

npm install @cimulate/agentforce-sdk

Quick Start

import { CimulateAgentforceClient } from "@cimulate/agentforce-sdk";

const client = new CimulateAgentforceClient({
  baseURL: "https://your-instance.salesforce-scrt.com",
  orgId: "00DQZ...",
  esDeveloperName: "Agentforce",
  options: { enableLogging: true },
});

// Register event handlers
client.on("message", (event) => {
  console.log(`Agent: ${event.content}`);
});

client.on("streaming_token", (event) => {
  process.stdout.write(event.token);
});

client.on("typing_started", () => {
  console.log("Agent is typing...");
});

client.on("error", (event) => {
  console.error(`Error: ${event.message}`);
});

// Connect and start a conversation
await client.connect();
await client.createConversation();
await client.sendMessage("Hello!");

// When done
await client.endConversation();
client.disconnect();

API

Constructor

new CimulateAgentforceClient(options: AgentforceClientOptions)

| Option | Type | Required | Description | |--------|------|----------|-------------| | baseURL | string | Yes | SCRT2 instance URL | | orgId | string | Yes | Salesforce Organization ID | | esDeveloperName | string | Yes | Embedded Service developer name | | options.maxRetries | number | No | Max retries for REST requests (default: 3) | | options.timeout | number | No | Request timeout in ms (default: 15000) | | options.maxReconnectAttempts | number | No | Max SSE reconnect attempts (default: 5) | | options.reconnectDelay | number | No | Base reconnect delay in ms (default: 2000) | | options.enableLogging | boolean | No | Enable debug logging (default: false) |

Methods

| Method | Returns | Description | |--------|---------|-------------| | connect() | Promise<void> | Acquire token and open SSE stream | | createConversation(routingAttributes?) | Promise<string> | Create a new conversation, returns its ID | | sendMessage(text) | Promise<void> | Send a text message | | endConversation() | Promise<void> | End the current conversation | | disconnect() | void | Close SSE stream and clean up |

Events

| Event | Payload | Description | |-------|---------|-------------| | connected | void | SSE stream successfully opened | | disconnected | { reason } | SSE stream closed | | reconnecting | { attempt, maxAttempts } | Reconnection attempt started | | message | { conversationId, messageId, content, sender, timestamp } | Complete message received | | streaming_token | { conversationId, token } | Streaming token chunk | | typing_started | { conversationId, participant? } | Agent started typing | | typing_stopped | { conversationId, participant? } | Agent stopped typing | | progress_indicator | { conversationId, message, indicatorType?, raw? } | Action progress text (e.g. "Searching products...") while an agent action runs | | routing_result | { conversationId, isSuccessful, failureType? } | Routing completed | | participant_changed | { conversationId, participant, action } | Participant joined/left | | conversation_closed | { conversationId } | Conversation ended server-side | | error | { code?, message, recoverable } | Error occurred |

Properties

| Property | Type | Description | |----------|------|-------------| | isConnected | boolean | Whether SSE stream is active | | conversationId | string \| null | Current conversation ID | | accessToken | string \| null | Current access token |

Features

  • Zero external dependencies — uses native fetch and ReadableStream for SSE
  • Automatic token management — acquires and refreshes tokens transparently
  • Exponential backoff reconnection — recovers from network drops automatically
  • Full TypeScript support — complete type definitions for all events and options
  • Lean bundle — ESM, CJS, and UMD outputs with tree-shaking support