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

@weaveintel/human-tasks

v0.1.2

Published

Human-in-the-loop orchestration — approval tasks, review queues, escalation, SLA enforcement

Readme

@weaveintel/human-tasks

Pause an automated workflow to wait for a person's decision — approvals, reviews, and escalations — then resume once they've answered.

Why it exists

Some choices shouldn't be made by a machine alone: refunding a big charge, publishing to production, deleting a customer's data. This package lets an agent stop mid-flight and hand the decision to a human, the way a cashier calls a manager over for the void key. The work waits in a queue, someone claims it, decides, and the decision is recorded — so the agent picks up exactly where it left off, with an auditable trail of who approved what.

When to reach for it

Reach for it when an agent or workflow needs a human gate — sign-off before a risky action, a review step before something ships, an escalation when confidence is low or an SLA is about to slip. If your step is fully autonomous and every outcome is safe to take without oversight, skip this and just run the step; a policy guardrail may be a lighter fit than a full human task.

How to use it

import { createApprovalTask, InMemoryTaskQueue, createDecision } from '@weaveintel/human-tasks';

const queue = new InMemoryTaskQueue();

const task = createApprovalTask({
  title: 'Refund $840 to customer',
  action: 'issue_refund',
  context: { orderId: 'ord_123', amount: 840 },
  riskLevel: 'high',
});
const { id } = await queue.enqueue(task);

// ...a reviewer claims and decides...
const claimed = await queue.dequeue('[email protected]');
await queue.complete(id, createDecision(id, '[email protected]', 'approve'));

Store tasks in a real database (Postgres)

Tasks that a person needs to act on must not vanish on a restart, and — importantly — two workers must never be handed the same task. createPostgresHumanTaskRepository is the same HumanTaskRepository port backed by Postgres, built for exactly that. Hand it a pg.Pool (share one across your app — e.g. from weaveSharedPostgres); it creates its table on first use.

import pg from 'pg';
import { createPostgresHumanTaskRepository } from '@weaveintel/human-tasks';

const repo = createPostgresHumanTaskRepository({ pool: new pg.Pool({ connectionString: process.env.DATABASE_URL }) });

await repo.save({ id: 't1', type: 'approval', title: 'Approve the refund', status: 'pending', priority: 'high', createdAt: new Date().toISOString() });

// A worker asks for the next thing to do — highest-priority, oldest first — and it's assigned to them alone.
const mine = await repo.claimNextPending('[email protected]');

The claim is the heart of it. It uses Postgres' FOR UPDATE SKIP LOCKED — the standard, race-free way to build a work queue on Postgres — so when a hundred workers ask for work at once, each gets a different task and none is ever double-claimed (a crashed worker's task simply returns to the pool). We prove this: 200 workers claiming 200 tasks concurrently, every task claimed exactly once.

The full task (including nested data and provenance) is stored as one JSON document so it round-trips exactly, while the fields you filter on (status, type, assignee, priority) are indexed columns for fast lookups. The same contract test runs against the in-memory, JSON-file, and Postgres versions, so they're guaranteed to behave the same:

import { humanTaskRepositoryContract, createPostgresHumanTaskRepository } from '@weaveintel/human-tasks';
humanTaskRepositoryContract(() => createPostgresHumanTaskRepository({ pool }), { describe, it, beforeEach, expect });

What's in the box

  • createHumanTask, createApprovalTask, createReviewTask, createEscalationTask — build a typed task for the decision you need.
  • InMemoryTaskQueue, RepositoryBackedTaskQueue — enqueue, dequeue (claim), complete, and list tasks with SLA tracking.
  • InMemoryHumanTaskRepository, JsonFileHumanTaskRepository, createDurableHumanTaskRepository, createPostgresHumanTaskRepository — where tasks live, from throwaway to durable Postgres storage (with race-free claiming).
  • humanTaskRepositoryContract — the shared conformance test every repository adapter passes.
  • createDecision, DecisionLog — record and audit who decided what, and when.
  • PolicyEvaluator, createPolicy — decide automatically whether a task even needs a human.
  • createActionItem, completeActionItem, cancelActionItem — track lightweight follow-up items.

License

MIT.