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

@fairway-kit/agent

v0.1.0

Published

Agent integration toolkit for fairway: the Runner contract, a normalized event pump, and adapters (Claude, ...) that turn any agent into durable protocol events

Downloads

25

Readme

@fairway-kit/agent

Claude Code native. The one bundled, tested runner is the Claude Agent SDK adapter; a small toolkit adapts any other harness in ~30 lines, and recipes give you a starting point.

The agent integration layer for fairway, a dev kit for building local, agent-backed applications with durable, resumable chat. Two things live here: the Runner contract (what you implement to drive a turn) and the adapter toolkit (helpers that turn any agent's stream into durable protocol events). @fairway-kit/server consumes a Runner — it never dictates how one is built, so you can plug in any agent framework or a remote agent service.

What we guarantee: the Claude Code adapter is dogfooded and tested. Recipes are honest starting points — copy, wire to your provider, and the same conformance harness that tests our adapter validates yours. We ship what we run; everything else is a recipe.

The Runner contract

A runner is async (ctx, emit) => TurnResult. Emit protocol events as the turn progresses (ctx carries history, the user message, attachments, an AbortSignal, and an optional permission gate); the host persists each event before fan-out, so live streaming and replay are byte-identical.

The toolkit

Most adapters don't touch emit directly — they map their framework's stream onto a normalized AgentEvent union and hand it to runnerFromStream, which owns coalescing, the authoritative-block supersede, tool-call metadata, the session-id round-trip, terminal handling, and cancellation:

import { runnerFromStream } from "@fairway-kit/agent";

const runner = runnerFromStream({
  start: async function* (ctx, signal) {
    for await (const part of myAgent(ctx.userContent, { signal })) {
      if (part.kind === "text") yield { type: "text-delta", text: part.text };
      if (part.kind === "tool") yield { type: "tool-call", id: part.id, name: part.name, input: part.args };
    }
  },
});

That is the whole adapter. AgentEvent covers text-delta, text-block (the authoritative block that supersedes the streamed run on fold), thinking-delta, tool-call, tool-result, session (round-tripped as the provider resume token), and error. Terminal is implicit: the stream ending is "done".

Also exported: Coalescer, DEFAULT_TOOL_META / resolveToolMeta, and the permission-gate helpers — requestToolPermission (for canUseTool-style hooks) and gateTool (wrap an app-owned tool's execute so it asks before running).

Bundled adapters

Adapters are subpath exports; their SDKs are optional peer dependencies, so you install only what you use.

import { claudeCodeRunner } from "@fairway-kit/agent/claude-code"; // needs @anthropic-ai/claude-agent-sdk

claudeCodeRunner maps the Claude Agent SDK's stream to protocol events, rounds the provider session id through resume, wires the human-in-the-loop permission gate into the SDK's canUseTool, and interrupts the live turn on stop. Auth modes: "api" (per-token via ANTHROPIC_API_KEY), "subscription" (the CLI's stored login, optionally a claude setup-token token), or "inherit".

Full docs and a complete example app live in the repository.