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

@countersign-ai/react

v0.0.4

Published

Drop-in approval inbox components for LangGraph human-in-the-loop agents

Readme

@countersign-ai/react

Typed data primitives and accessible, styled review components for approval queues. The package does not require a particular backend: swap the in-memory demo store for any adapter implementing ApprovalStore.

Styled inbox

Import the component stylesheet once, then give ApprovalInbox a store:

"use client";

import { ApprovalInbox, HttpApprovalStore } from "@countersign-ai/react";
import "@countersign-ai/react/styles.css";
import { useMemo } from "react";

export function AgentReviews() {
  const store = useMemo(
    () => new HttpApprovalStore({ baseUrl: "/api/approvals" }),
    [],
  );

  return <ApprovalInbox pollIntervalMs={5_000} store={store} />;
}

ApprovalInbox includes the fleet queue, status/agent/environment filters, responsive detail navigation, and a complete ApprovalCard. The card honors the request's allow_accept, allow_ignore, allow_edit, and allow_respond flags and records every decision through the supplied store.

Use individual pieces when composing your own layout:

<ApprovalCard record={record} store={store} />
<ActionDiff
  action={record.action_request}
  beforeArgs={previousArgs}
  sensitivePaths={["/payment/token"]}
/>
<SchemaEditForm record={record} onSubmit={saveEditedArgs} />
<AuditTimeline events={events} />

The theme follows the nearest data-theme="dark" or data-countersign-theme="dark" ancestor. Every critical action remains available on narrow screens, focus states are keyboard-visible, status does not rely on color alone, and reduced-motion preferences are honored.

Run the interactive component reference locally with pnpm storybook from the repository root. Stories cover new and changed actions, redaction, decision history, critical requests, resolved requests, full queues, empty states, light/dark themes, and automated accessibility checks.

Headless hooks

"use client";

import {
  createDemoStore,
  useApprovalAction,
  useApprovalQueue,
} from "@countersign-ai/react";
import { useMemo } from "react";

export function Queue() {
  const store = useMemo(createDemoStore, []);
  const { records, loading, error, refresh } = useApprovalQueue({
    store,
    status: "pending",
  });
  const first = records[0];
  const { submit, pending } = useApprovalAction(store, first?.id ?? "");

  if (loading) return <p>Loading approvals…</p>;
  if (error) return <p role="alert">{error.message}</p>;
  return (
    <button
      disabled={!first || pending}
      onClick={() => void submit({ type: "approve" }).then(refresh)}
    >
      Approve
    </button>
  );
}

ApprovalRequest preserves Agent Inbox's HumanInterrupt fields, while ApprovalRecord adds the queue status and persistence fields needed by a reviewer UI. InMemoryApprovalStore is useful for demos and Storybook; it keeps a small audit timeline, rejects a second decision on the same request, and enforces action controls and edit-schema validation.

Filter a fleet view by agent, environment, action, or age:

useApprovalQueue({
  store,
  filters: {
    graph_id: "refund-agent",
    environment: "production",
    older_than_seconds: 300,
  },
});

For an HTTP approval service, pass an HttpApprovalStore instead:

const store = new HttpApprovalStore({ baseUrl: "/api/approvals" });

HttpApprovalStore sends requests with credentials: "include" by default so the adapter works with HttpOnly application sessions. Override the credentials option for a bearer-only integration. A separately hosted API must allow the application's explicit CORS origin. The store subscribes to the resumable /v0/events SSE feed when the API provides it. Set pollIntervalMs on ApprovalInbox or useApprovalQueue to retain polling as a compatibility fallback: polling stays off while SSE is healthy and starts only when the API does not expose the event route. Authentication and other client errors stop reconnection and surface through the queue hook's error state.

The queue hook keeps one subscription for its mounted lifetime, so constructing an equivalent store inline does not reconnect on every render. When an application intentionally switches to a different store during the same mount, pass a changed storeKey to useApprovalQueue; ApprovalInbox users should remount the inbox or keep the store memoized at that boundary.

For a short-lived bearer integration, provide the token once and it is forwarded for every queue/action request:

const store = new HttpApprovalStore({
  baseUrl: "/api/approvals",
  headers: { Authorization: `Bearer ${token}` },
});

For structured edits, attach a JSON Schema as context.edit_schema to the request and build the decision with createValidatedEditDecision. It throws ApprovalEditValidationError instead of allowing invalid arguments to reach the API:

const decision = createValidatedEditDecision(record, {
  order_id: "ord_4821",
  amount_usd: 99,
});
await store.decide(record.id, decision);

For a reviewer-friendly field-level change model, use diffProposedAction. Paths use JSON Pointer internally and a readable label for rendering; sensitive paths can be redacted before passing the result into an audit or UI:

const diff = diffProposedAction(
  record.action_request,
  { order_id: "ord_4821", amount_usd: 99 },
  {
    sensitivePaths: ["/payment_token"],
  },
);
// diff.fields => [{ path: "/amount_usd", label: "amount_usd", kind: "changed", before: 129, after: 99, ... }]