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

@hitl-kit/ai-sdk

v0.7.0

Published

Vercel AI SDK adapter for HITL Kit. Typed tool() wrappers that return schema-conformant HITL events so <HitlEventRenderer /> can dispatch them client-side.

Downloads

396

Readme

@hitl-kit/ai-sdk

Vercel AI SDK adapter for HITL Kit. Typed tool() wrappers that return schema-conformant HITL events, so <HitlEventRenderer /> can dispatch them client-side.

pnpm add @hitl-kit/core @hitl-kit/react @hitl-kit/ai-sdk ai zod

ai and zod are peer dependencies; the versions you install are up to you (AI SDK v4+, Zod v3+).


Why this adapter exists

Unlike LangGraph, Vercel AI SDK doesn't have a native interrupt() / Command primitive. The canonical way for an agent to "ask the human something" in AI SDK is to call a tool. This adapter gives you 15 typed tool() wrappers — one per HITL Kit primitive — whose input schemas mirror the primitive's event shape and whose return values are validated HITL events ready to pass to <HitlEventRenderer />.

Flow:

  1. Agent calls a HITL Kit tool
  2. Tool returns a validated HitlEvent as the tool result
  3. Your UI filters tool results and renders them via <HitlEventRenderer />
  4. Human acts on the rendered primitive
  5. Your app sends the decision back to the agent as a follow-up user message (AI SDK's canonical resume pattern)

Usage

Server: add the tools to a generateText or streamText call

import { generateText } from "ai";
import { hitlCardTool } from "@hitl-kit/ai-sdk";

const result = await generateText({
  model,
  messages,
  tools: {
    requestHumanReview: hitlCardTool({
      description:
        "Request human review of a citation before writing to the draft.",
    }),
  },
});
// If the model calls requestHumanReview, the tool result is a
// validated HitlCardEvent.

Client: render tool results via <HitlEventRenderer />

import { HitlEventRenderer } from "@hitl-kit/react";
import { isHitlToolResult } from "@hitl-kit/ai-sdk";
import { HitlCard } from "@/components/hitl/HitlCard";

// inside your chat UI, after streaming:
toolResults.filter(isHitlToolResult).map((r) => (
  <HitlEventRenderer
    key={r.result.id ?? r.result.kind}
    event={r.result}
    registry={{
      "hitl.card": (ev) => <HitlCard config={...} />,
    }}
  />
));

Or just import everything at once

import { generateText } from "ai";
import { allHitlTools } from "@hitl-kit/ai-sdk";

await generateText({ model, messages, tools: allHitlTools });

Tools (one per primitive)

| Factory | Event kind | Returns | |---|---|---| | hitlCardTool | hitl.card | HitlCardEvent | | subagentStatusTool | subagent.status | SubagentStatusEvent | | miniTraceTool | trace.mini | MiniTraceEvent | | aiGenerationScaleTool | scale.ai_generation | AiGenerationScaleEvent | | contextChipsTool | chips.context | ContextChipsEvent | | qaFlowTool | qa.flow | QAFlowEvent | | writingAgentTool | agent.writing | WritingAgentEvent | | researchAgentTool | agent.research | ResearchAgentEvent | | batchQueueTool | batch.queue | BatchQueueEvent | | searchResultTool | result.search | SearchResultEvent | | approveRejectTool | approval.binary | ApproveRejectEvent | | diffResultTool (v0.6a) | result.diff | DiffResultEvent | | citationResultTool (v0.6a) | result.citation | CitationResultEvent | | editablePlanTool (v0.6a) | plan.editable | EditablePlanEvent | | toolCallPreviewTool (v0.6a) | tool.call | ToolCallPreviewEvent |

Each factory accepts { description?: string } so you can shape the agent's mental model of when to call the tool. The validation happens inside execute via the core Zod schema — malformed tool calls throw before the result ever reaches the UI.


Resume pattern

AI SDK has no Command({ resume }). When the human acts on a primitive, your app sends a new user message back to the agent with the result embedded:

const handleApproval = (approved: boolean) => {
  append({
    role: "user",
    content: approved
      ? "Approved. Continue and write to the draft."
      : "Rejected. Do not write the citation.",
  });
};

The agent reads the new message, understands the decision, and continues. Less elegant than LangGraph's typed resume, but works with any AI SDK agent without special infrastructure.


Part of HITL Kit

MIT © Ieuan King.