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

@pushary/durable

v0.3.1

Published

Phone approvals for Inngest, Temporal and Vercel Workflow runs. Your workflow asks, your user taps Approve or Deny.

Readme

@pushary/durable

Phone approvals for Inngest, Temporal and Vercel Workflow runs. Your workflow asks, your user taps Approve or Deny.

Human in the loop for AI agents · Durable workflows guide · Report a problem

CI npm license

What you need

What your customer gets

  1. They open your connect link once. It shows your product's name and logo and connects their phone.
  2. When your workflow reaches the approval step, a push notification titled with your product name arrives, such as Acme needs your approval. The run is parked and uses no compute while they decide, for minutes or hours.
  3. They tap Approve or Deny. Pushary posts the signed answer to your callback, and your code runs the action only on a yes.

Pushary hosts the phone delivery, the decision record and the audit log. Inngest, Temporal or Vercel Workflow keeps the parked run. Your app keeps its own sign-in, the correlationId to run mapping and the action itself.

Quick start

npm i @pushary/durable
import { connect, createApproval, deterministicKey, resolveTimestampedApproval } from '@pushary/durable'

const config = { apiKey: process.env.PUSHARY_API_KEY! }
const { universalLink } = await connect(config, user.id) // once per user: show them this link

const { correlationId, status } = await createApproval(config, {
  externalId: user.id,
  question: 'Approve a $480 refund?',
  callbackUrl: `${process.env.PUBLIC_URL}/pushary/callback`,
  idempotencyKey: deterministicKey([runId, 'refund-approval']),
})
if (status === 'stopped') throw new Error('The agent was stopped in Pushary.') // nobody was asked, nothing to wait for
// Save correlationId against the run, then park it. Nothing runs while it waits.

const approval = resolveTimestampedApproval(rawBody, request.headers.get('pushary-signature'), process.env.PUSHARY_WEBHOOK_SECRET!)
if (approval?.approved) await resumeRun(approval.correlationId)

The last two lines go in your callback route. PUSHARY_WEBHOOK_SECRET comes from decisions.getWebhookSecret().

Works with Inngest, Temporal, and Vercel Workflow, or any runner that can wait on an external event. It adds no framework dependency of its own, so it drops into whichever one you already run.

The shape

  1. connect(config, externalId) once per end-user. Show them the link, they tap to connect their phone.
  2. createApproval(config, { callbackUrl, idempotencyKey, ... }) opens a durable decision and returns immediately. Store the correlationId against your run and park the workflow.
  3. When the human answers, Pushary POSTs your callbackUrl. resolveTimestampedApproval(raw, request.headers.get('pushary-signature'), secret) verifies the timestamped signature, refuses a replay, and hands you { approved, answer }. Look up the parked run by correlationId and resume it.

The wait is durable on Pushary's side (a decisions ledger) and on yours (the orchestrator's snapshot), so nothing is lost across a restart.

Try the refund callback locally

A store asks its customer to approve a refund. The customer taps Approve, but the delivery service sends that same answer twice. How many refunds does the store record?

From a clone of this repository, run the following with Node 24 or later:

npm install
npm run build
node examples/refund-receipt.mjs

The example signs test answers locally and reopens a temporary SQLite database for each delivery. Two approvals for the same decision record one simulated refund. A denial or a missing answer records zero. No phone, account, model or payment provider is needed. In a live app, enroll the customer through Partner and give your payment provider a stable refund idempotency key as well.

Inngest

import { createApproval, resolveTimestampedApproval, deterministicKey } from '@pushary/durable'

export const refund = inngest.createFunction(
  { id: 'refund', triggers: { event: 'app/refund.requested' } },
  async ({ event, step }) => {
    const { correlationId, status } = await step.run('ask-human', () =>
      createApproval(
        { apiKey: process.env.PUSHARY_API_KEY! },
        {
          externalId: event.data.userId,
          question: `Approve a $${event.data.amount} refund?`,
          callbackUrl: `${process.env.PUBLIC_URL}/api/inngest/pushary`,
          idempotencyKey: deterministicKey([event.id, 'refund-approval']),
        },
      ),
    )
    if (status === 'stopped') return

    const answered = await step.waitForEvent('wait-for-answer', {
      event: 'pushary/decision.resolved',
      timeout: '1d',
      // the correlationId is generated inside the step, so match on it with `if`
      if: `async.data.correlationId == "${correlationId}"`,
    })

    if (answered?.data.approved) await step.run('refund', () => issueRefund(event.data))
  },
)

// mount one route that turns Pushary callbacks into Inngest events:
export async function POST(req: Request) {
  const raw = await req.text()
  const approval = resolveTimestampedApproval(raw, req.headers.get('pushary-signature'), process.env.PUSHARY_WEBHOOK_SECRET!)
  if (!approval) return new Response('bad signature', { status: 401 })
  await inngest.send({ id: deterministicKey([approval.correlationId, 'resolved']), name: 'pushary/decision.resolved', data: { ...approval } })
  return new Response('ok')
}

Temporal

// activity
export async function askHuman(userId: string, amount: number, runId: string) {
  return createApproval(
    { apiKey: process.env.PUSHARY_API_KEY! },
    {
      externalId: userId,
      question: `Approve a $${amount} refund?`,
      callbackUrl: `${process.env.PUBLIC_URL}/api/temporal/pushary`,
      idempotencyKey: deterministicKey([runId, 'refund-approval']),
    },
  )
}

// workflow: create in an activity, then wait for a signal
export async function refundWorkflow(userId: string, amount: number) {
  const approve = defineSignal<[{ answer: string; approved: boolean }]>('pushary_answer')
  let result: { approved: boolean } | null = null
  setHandler(approve, (a) => { result = a })
  const { status } = await askHuman(userId, amount, workflowInfo().workflowId)
  if (status === 'stopped') return
  await condition(() => result !== null, '1 day')
  if (result?.approved) await issueRefund(userId, amount)
}

// callback route signals the workflow (map correlationId -> workflowId in your store)

Vercel Workflow

import { createWebhook } from 'workflow'
import { createApproval, resolveTimestampedApproval, deterministicKey } from '@pushary/durable'

export async function refundWorkflow(userId: string, amount: number, runId: string) {
  'use workflow'
  using webhook = createWebhook()
  const { status } = await createApproval(
    { apiKey: process.env.PUSHARY_API_KEY! },
    {
      externalId: userId,
      question: `Approve a $${amount} refund?`,
      callbackUrl: webhook.url, // Pushary posts straight to the run's resume URL
      idempotencyKey: deterministicKey([runId, 'refund-approval']),
    },
  )
  if (status === 'stopped') return
  const request = await webhook // parks here until the callback arrives
  const approval = resolveTimestampedApproval(
    await request.text(),
    request.headers.get('pushary-signature'),
    process.env.PUSHARY_WEBHOOK_SECRET!,
  )
  if (approval?.approved) await issueRefund(userId, amount)
}

The resume URL is not authentication on its own, so always resolveTimestampedApproval (which verifies the timestamped HMAC signature) before you act.

API

  • connect(config, externalId): enroll an end-user's phone, returns EnrollResult.
  • createApproval(config, input): open a durable decision, returns { decisionId, correlationId, reachable, ... }.
  • createApproval returns status: 'stopped' when the agent was stopped. No decision was opened and no callback will come, so end the run instead of parking it.
  • resolveTimestampedApproval(rawBody, signature, secret): verify the Pushary-Signature header and parse the callback into { correlationId, answer, value, approved, context? }, or null if invalid. Refuses a body-only signature and a timestamp more than 300 seconds from now, so a captured callback cannot be replayed.
  • resolveApproval(rawBody, signature, secret): the same over the body-only X-Pushary-Signature, which has no replay protection. Kept for existing routes; move them to resolveTimestampedApproval.
  • isAffirmative(answer): fail-closed yes/no check for a confirm answer.
  • deterministicKey(parts): a stable idempotency key from your run + step ids.
  • Re-exports: verifyTimestampedWebhookSignature, TIMESTAMPED_SIGNATURE_HEADER, verifyWebhookSignature, parseDecisionCallback, SIGNATURE_HEADER.

Example

A runnable example is in examples/.

Links

License

MIT