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

@ventus-software-solutions/task-queue

v0.2.0

Published

File-based stateless-facade task queue with pluggable storage.

Readme

@ventus-software-solutions/task-queue

File-based stateless-facade task queue with pluggable storage.

Quick start

import { FileStorage, TaskQueue } from '@ventus-software-solutions/task-queue';

const queue = new TaskQueue({
  storage: new FileStorage('./tasks.json'),
  maxEvents: 1000,
});

await queue.enqueue('send digest email', {
  priority: 'high',
  source: 'application',
  metadata: { accountId: 'acct_123' },
});

const task = await queue.claimNext();
if (task) {
  await queue.completeCurrent({ ok: true });
}

API surface

class TaskQueue {
  constructor(options: { storage: Storage; maxEvents?: number });

  enqueue(description: string, opts?: EnqueueOptions): Promise<Task>;
  changePriority(taskId: string, newPriority: TaskPriority): Promise<Task | null>;
  claimNext(): Promise<Task | null>;
  completeCurrent(result?: unknown): Promise<CompletedTask | null>;
  failCurrent(error: Error | string): Promise<CompletedTask | null>;
  retry(taskId: string, opts?: RetryOptions): Promise<Task | null>;
  cancel(taskId: string, reason?: string): Promise<CompletedTask | null>;
  supersede(taskId: string, replacement: EnqueueReplacement): Promise<Task | null>;
  get(taskId: string): Promise<Task | CompletedTask | null>;
  list(filter?: TaskFilter): Promise<FilteredTasks>;
  peek(): Promise<TaskQueueState>;
}

interface Storage {
  read(): Promise<TaskQueueState>;
  write(state: TaskQueueState): Promise<void>;
  withLock<T>(fn: () => Promise<T>): Promise<T>;
}

FileStorage is the included Storage implementation. It stores JSON on disk, serializes mutations with proper-lockfile, and writes via atomic temp-file rename.

The public Task type carries id, description, priority, source, addedAt, attempt, optional availableAt, optional parentTaskId, and optional metadata: Record<string, unknown> for application-specific data. AIDE-specific fields such as agreement state and source references are intentionally excluded.

Lifecycle behavior

  • claimNext() returns the existing current task if one is active; otherwise it claims the highest-priority pending task whose availableAt is not in the future.
  • completeCurrent(result) moves the current task to done with outcome completed.
  • failCurrent(error) moves the current task to done with outcome failed and serializes Error.cause recursively when present.
  • retry(taskId, { delayMs }) creates a new pending task for a failed or superseded done task, links it with parentTaskId, increments attempt, and sets availableAt when delayed.
  • cancel(taskId, reason) moves a pending or current task to done with outcome cancelled.
  • supersede(taskId, replacement) moves a pending or current task to done with outcome superseded and enqueues the replacement task.
  • get(taskId) reads a task across current, pending, and done states.
  • list(filter) returns FilteredTasks and can filter by status, priority, source, outcome, and includeUnavailable.

Lifecycle events are stored in TaskQueueState.events and bounded by maxEvents (default 1000; pass Infinity for an unbounded in-state audit history). This keeps v0.2.0 storage simple while preserving enough lifecycle history for package consumers.