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

sammy-sdk-client

v0.2.2

Published

Zero-dependency JavaScript client for the Sammy AI agent runtime (SSE streaming, conversations, attachments).

Readme

sammy-sdk-client

Zero-dependency JavaScript client for the Sammy AI agent runtime. Works in any framework — React, Vue, Svelte, vanilla — and in any modern JavaScript runtime (browser, Node 18+, edge).

sammy-sdk-client is the framework-agnostic transport layer. It speaks to the chat endpoint your server exposes (typically backed by sammy-sdk's createSammyRouteHandler) and handles JSON requests, conversation IDs, and SSE streaming.

For React-specific helpers see sammy-sdk-react. For a drop-in chat widget see sammy-sdk-ui.

Install

npm install sammy-sdk-client

You'll also need a chat endpoint on your backend. The fastest way is createSammyRouteHandler from sammy-sdk:

// app/api/chat/route.ts (Next.js App Router)
import { Sammy, createSammyRouteHandler } from "sammy-sdk";
const sammy = new Sammy();
export const POST = createSammyRouteHandler(sammy);

Usage

import { SammyClient } from "sammy-sdk-client";

const client = new SammyClient({
  endpoint: "/api/chat",
  // Optional: custom headers (object or async function)
  headers: async () => ({ Authorization: `Bearer ${await getToken()}` }),
});

// One-shot request/response (returns the full ChatResponse)
const reply = await client.chat("List all open deals");
console.log(reply.message);

// Streaming
const stream = client.stream("Summarise this week's pipeline");
stream
  .on("text", (chunk) => process.stdout.write(chunk))
  .on("tool_call", (call) => console.log("calling tool:", call.name))
  .on("tool_result", (r) => console.log("tool", r.name, "->", r.result.success))
  .on("agent_handoff", (h) => console.log("handed off to:", h.targetAgent))
  .on("done", (final) => console.log("\ntools used:", final.toolsUsed.length))
  .on("error", (err) => console.error(err));

Conversations

client.conversation(id?) gives you a scoped object that re-uses the same conversationId across calls — useful for chat threads.

const thread = client.conversation();
await thread.send("hi");
await thread.send("what did I just say?");

API surface

  • new SammyClient(config)
  • client.chat(message, options?)Promise<ChatResponse> (one-shot JSON; the server must speak JSON for this path — createSammyRouteHandler does)
  • client.stream(message, options?)SammyStream (event emitter)
  • client.conversation(id?) — convenience scope for a single conversation

SammyStream events:

| Event | Handler argument | |---|---| | text | string chunk to append to the assistant message | | tool_call | ToolCallEvent{ id, name, params } | | tool_result | ToolResultEvent{ id, name, result: { success, data?, error? } } | | agent_handoff | AgentHandoffEvent{ fromAgent, targetAgent, reason } (multi-agent only) | | done | the full ChatResponse | | error | a real Error instance |

All exported types — SammyClientConfig, ChatOptions, ChatResponse, SammyStream, ToolCallEvent, ToolResultEvent, ToolResult, ToolCallResult, AgentHandoffEvent, Attachment — are exported from the package root.

License

MIT