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

@heysummon/consumer-sdk

v0.2.20

Published

TypeScript SDK for HeySummon consumers (AI agents)

Readme

@heysummon/consumer-sdk

TypeScript SDK for HeySummon consumers (AI agents). Submit help requests to human experts, poll for responses, and optionally encrypt messages end-to-end.

Install

pnpm install @heysummon/consumer-sdk

Quick Start

import { HeySummonClient } from "@heysummon/consumer-sdk";

const client = new HeySummonClient({
  baseUrl: "https://cloud.heysummon.ai",
  apiKey: process.env.HEYSUMMON_API_KEY!,
});

// Submit a help request
const result = await client.submitRequest({
  question: "Should I proceed with the database migration?",
});

// Poll for the response
const status = await client.getRequestStatus(result.requestId!);
console.log(status.response);

Client API

HeySummonClient

All methods authenticate via the x-api-key header using the API key provided at construction.

const client = new HeySummonClient({ baseUrl, apiKey });

| Method | Description | |--------|-------------| | whoami() | Identify which expert this API key is linked to | | submitRequest(opts) | Submit a help request to a human expert | | getRequestStatus(requestId) | Get the current status of a request | | getRequestByRef(refCode) | Look up a request by its HS-XXXX reference code | | getPendingEvents() | Poll for pending events (new messages, responses, etc.) | | ackEvent(requestId) | Acknowledge a specific event | | getMessages(requestId) | Fetch the full message history for a request | | reportTimeout(requestId) | Report that the client's poll timed out |

Submit Request Options

interface SubmitRequestOptions {
  question: string;
  messages?: Array<{ role: string; content: string }>;
  signPublicKey?: string;
  encryptPublicKey?: string;
  expertName?: string;
  requiresApproval?: boolean;
}

Approval Requests

Set requiresApproval: true to show Approve/Deny buttons to the expert instead of a free-text reply prompt. The decision is delivered as a message event:

const result = await client.submitRequest({
  question: "Should I proceed with the $5,000 purchase?",
  requiresApproval: true,
});

// Poll until the expert decides
const status = await client.getRequestStatus(result.requestId!);
if (status.status === "responded") {
  const messages = await client.getMessages(result.requestId!);
  // Expert message contains "approved" or "denied"
}

Error Handling

The client throws HeySummonHttpError for non-2xx responses:

import { HeySummonHttpError } from "@heysummon/consumer-sdk";

try {
  await client.submitRequest({ question: "..." });
} catch (err) {
  if (err instanceof HeySummonHttpError) {
    console.error(err.status, err.body);
    if (err.isAuthError) {
      // 401, 403, or 404
    }
  }
}

End-to-End Encryption

The SDK includes X25519 + AES-256-GCM encryption with Ed25519 signatures.

Ephemeral Keys (in-memory)

import { generateEphemeralKeys } from "@heysummon/consumer-sdk";

const keys = generateEphemeralKeys();
// { signPublicKey: "hex...", encryptPublicKey: "hex..." }

await client.submitRequest({
  question: "Sensitive question",
  signPublicKey: keys.signPublicKey,
  encryptPublicKey: keys.encryptPublicKey,
});

Persistent Keys (file-based)

import { generatePersistentKeys, loadPublicKeys } from "@heysummon/consumer-sdk";

// Generate and save to disk
const keys = generatePersistentKeys("/path/to/keys");

// Load existing keys without regenerating
const existing = loadPublicKeys("/path/to/keys");

Encrypt / Decrypt

import { encrypt, decrypt } from "@heysummon/consumer-sdk";

const encrypted = encrypt(
  "Hello, human!",
  "/path/to/recipient_encrypt_public.pem",
  "/path/to/own_sign_private.pem",
  "/path/to/own_encrypt_private.pem"
);

const plaintext = decrypt(
  encrypted,
  "/path/to/sender_encrypt_public.pem",
  "/path/to/sender_sign_public.pem",
  "/path/to/own_encrypt_private.pem"
);

Expert Store

Manage multiple expert registrations in a local JSON file:

import { ExpertStore } from "@heysummon/consumer-sdk";

const store = new ExpertStore("/path/to/experts.json");

store.add({
  name: "My Expert",
  apiKey: "hs_cli_...",
  expertId: "...",
  expertName: "Expert Name",
});

const expert = store.findByName("My Expert");
const defaultExpert = store.getDefault();

CLI

The package includes a CLI for use in shell scripts and automation:

pnpm dlx @heysummon/consumer-sdk <command> [options]

Commands

| Command | Description | |---------|-------------| | submit-and-poll | Submit a request and wait for a response | | add-expert | Register an expert by API key | | list-experts | List registered experts | | check-status | Check the status of an existing request | | keygen | Generate persistent encryption key pairs |

Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | HEYSUMMON_BASE_URL | Yes | Platform URL (e.g. https://cloud.heysummon.ai) | | HEYSUMMON_API_KEY | Varies | Consumer API key (not needed if using expert store) | | HEYSUMMON_EXPERTS_FILE | No | Path to experts.json for multi-expert setups | | HEYSUMMON_TIMEOUT | No | Poll timeout in seconds (default: 900) | | HEYSUMMON_POLL_INTERVAL | No | Poll interval in seconds (default: 3) |

Examples

# Submit and wait for a response
HEYSUMMON_BASE_URL=https://cloud.heysummon.ai \
HEYSUMMON_API_KEY=hs_cli_... \
pnpm dlx @heysummon/consumer-sdk submit-and-poll --question "Should I deploy?"

# Register an expert
HEYSUMMON_BASE_URL=https://cloud.heysummon.ai \
HEYSUMMON_EXPERTS_FILE=./experts.json \
pnpm dlx @heysummon/consumer-sdk add-expert --key hs_cli_... --alias "DevOps Lead"

# Check request status
HEYSUMMON_BASE_URL=https://cloud.heysummon.ai \
HEYSUMMON_API_KEY=hs_cli_... \
pnpm dlx @heysummon/consumer-sdk check-status --ref HS-1234

# Generate encryption keys
pnpm dlx @heysummon/consumer-sdk keygen --dir ./keys

License

Sustainable Use License (SUL) - see LICENSE.md