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

@ff-terminal/sdk

v0.1.0-beta.0

Published

Embeddable TypeScript SDK for FF Terminal daemon turn streaming

Downloads

10

Readme

@ff-terminal/sdk

Embeddable Node.js SDK for interacting with FF Terminal through the daemon WebSocket protocol.

  • Node.js: >=20
  • Package: @ff-terminal/sdk
  • MVP surface: createClient, listTools, runTurn (streaming), cancelTurn, close

Documentation Suite

Canonical SDK docs for architecture, operations, and release process live in:

  • docs/sdk/README.md

High-value pages:

  • docs/sdk/03-client-api-reference.md
  • docs/sdk/05-daemon-lifecycle-managed-vs-external.md
  • docs/sdk/06-providers-models-profiles.md
  • docs/sdk/07-tool-policy-security.md
  • docs/sdk/10-testing-and-runtime-truth.md

Install

npm install @ff-terminal/sdk@beta

Managed mode runtime note:

  • @ff-terminal/sdk depends on @ff-terminal/runtime.
  • daemon endpoint is still required (managed launch or external daemon URL).

Quickstart

import { createClient } from "@ff-terminal/sdk";

const client = createClient(); // managed daemon by default

const tools = await client.listTools();
console.log(tools);

for await (const event of client.runTurn("Summarize this repo")) {
  if (event.type === "content") process.stdout.write(event.delta);
  if (event.type === "turn_finished") console.log("\nDone", event.ok);
}

await client.close();

Local CLI Agent Test

From this repository:

npm run build
npm run sdk:agent

Example:

sdk-agent> /tools
sdk-agent> Hello
sdk-agent> /session
sdk-agent> /session reset
sdk-agent> /exit

Commands:

  • /tools list available tools (policy-filtered)
  • /session show current session ID
  • /session reset clear persisted session state
  • /exit close and quit

Lifecycle Modes

Managed daemon (default)

The SDK starts and manages a local daemon sidecar.

const client = createClient({
  daemon: {
    mode: "managed"
  }
});

Optional overrides:

const client = createClient({
  daemon: {
    mode: "managed",
    command: process.execPath,
    args: ["/absolute/path/to/dist/bin/ff-terminal.js", "daemon"],
    startupTimeoutMs: 15000
  }
});

Managed mode resolution order when command is not provided:

  1. FF_TERMINAL_DAEMON_JS (absolute path to ff-terminal.js)
  2. Local dist/bin/ff-terminal.js discovered from cwd / repo ancestry
  3. @ff-terminal/runtime daemon launcher from dependency graph
  4. ff-terminal from PATH

External daemon

Connect to an existing daemon process.

const client = createClient({
  daemon: {
    mode: "external",
    url: "ws://127.0.0.1:28888"
  }
});

Security Defaults and Tool Policy

Default policy is safe-default, which blocks high-risk tools unless explicitly allowed.

const client = createClient({
  toolPolicy: "safe-default" // default
});

Other policy modes:

// full: no restrictions (SDK prints a startup warning)
createClient({ toolPolicy: "full" });

// custom: explicit allow/deny
createClient({
  toolPolicy: {
    mode: "custom",
    allowTools: ["glob", "read_file"],
    denyTools: ["run_command"] // deny always wins
  }
});

API

createClient(options)

Creates an SDK client using managed or external daemon mode.

listTools(): Promise<string[]>

Returns daemon tool names filtered by the configured tool policy.

runTurn(input, { sessionId?, signal? }): AsyncIterable<SDKEvent>

Starts a turn and streams events. Pass AbortSignal to cancel.

cancelTurn(turnId): Promise<void>

Explicitly cancel an in-flight turn.

close(): Promise<void>

Closes websocket resources and stops the managed daemon if SDK started it.

Compatibility and Deprecation

  • Versioning: semantic versioning.
  • Node support: Node.js 20+ only.
  • Runtime protocol: backward-compatible additive changes for minor releases.
  • Deprecation window: deprecated APIs remain for at least one minor release before removal in a major release.

Provider and Profile Boundary

  • SDK does not currently accept provider, model, or profile as first-class client options.
  • Provider/model/profile are selected by daemon runtime env/config.
  • See docs/sdk/06-providers-models-profiles.md for operational recipes.

Migration Notes

  • Existing daemon clients without toolPolicy remain supported.
  • SDK clients send toolPolicy on start_turn to enforce client-side security defaults.
  • safe-default may hide tools that were previously visible in unrestricted clients.