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

@pi-unipi/background-tasks

v2.16.1

Published

Background tasks for UniPi — durable shell jobs, delegated agents, attested Pi runs, and fixed-purpose Fusion workflows

Readme

@pi-unipi/background-tasks

Background tasks for UniPi — a full adoption of pi-background-tasks into the unipi conventions: durable background shell jobs, read-only delegated agents, attested Pi runs, fixed-purpose multi-model Fusion workflows, and package-owned Anthropic subscription attribution.

Master toggle

One config key disables the entire module — no tools, no commands, no hooks, no UI:

// ~/.unipi/config/background-tasks.json (global)
// <workspace>/.unipi/config/background-tasks.json (override; workspace wins)
{
  "enabled": true
}

Open /unipi:bg-settings for the interactive settings overlay (master toggle, defaults, output caps, delegate/fusion defaults).

Surfaces

Tools (reference names kept)

| Tool | Purpose | | --- | --- | | bg_run | Start a named long-running shell command; terminal notification wakes a follow-up turn by default | | bg_status / bg_logs / bg_kill | Point-in-time inspection, bounded log reads, stop — never polling primitives | | bg_delegate + bg_result | One read-only child Pi agent seeded with a frozen projection of this conversation; hash-verified answer retrieval | | bg_run_pi_attested | Evidence-oriented direct Pi spawn with local hashes and route attestation | | fusion_reason | 3 candidates → blind evaluator → merger on the session projection | | fusion_investigate / fusion_research / fusion_validate | Fixed-purpose multi-model workflows on clean-task input (inspect tools / caller-URL research / advisory review) |

Commands (our namespace)

/unipi:bg, /unipi:bg-clear, /unipi:bg-tasks, /unipi:bg-update, /unipi:tasks, /unipi:jobs, /unipi:kill, /unipi:logs, /unipi:bg-settings, /unipi:fusion, /unipi:fusion-models, /unipi:claude-cache.

Shortcuts: Shift↓ opens the task manager dock; Ctrl+Alt+C clears finished notices.

Storage layout (ours — never .pi/)

  • Runtime artifacts (task output/metadata): $TMPDIR/unipi-bg-tasks/<session>-<pid>-<nonce>/
  • Durable delegate artifacts: <workspace>/.unipi/delegate/<session>-<pid>/<task-id>/
  • Durable fusion artifacts: <workspace>/.unipi/fusion/<session>-<pid>/<run-id>/
  • Config: ~/.unipi/config/background-tasks.json + workspace override
  • Fusion model config: five-slot selector persisted through /unipi:fusion-models

Environment

UNIPI_BG_* prefix (replaces the reference PI_BG_*): UNIPI_BG_TMP_DIR, UNIPI_BG_MAX_OUTPUT_BYTES, UNIPI_BG_SHELL, UNIPI_BG_SHELL_PATH, UNIPI_BG_DISABLE_PI_TELEMETRY, UNIPI_BG_DELEGATE_*.

Completion delivery

| notifyOnCompletion | triggerOnCompletion | Mode | | --- | --- | --- | | true (default) | true (bg_run default) | Durable terminal notification + automatic follow-up turn | | true | false (/unipi:bg default) | Notification only | | false | — | Manual monitoring |

Treat <background-task-notification> as durable terminal truth — do not poll.

Attribution

extensions/anthropic-attribution.ts loads first (provider-gated): Claude Code subscription OAuth attribution, exact-match system-prompt sanitization, and cache-retention policy for Anthropic routes. Duplicate installed copies resolve ownership through an EventBus claim; later copies go inert.

Shared registry (for sibling extensions)

Other packages can read the live task registry synchronously — no events, no polling:

import { getSharedTaskRegistry } from "@pi-unipi/background-tasks";

const tasks = getSharedTaskRegistry()?.allTasks() ?? [];
const running = tasks.filter((t) => t.status === "running").length;

The registry is published on globalThis under a Symbol.for key at extension init and session_start, and cleared on session_shutdown (counts are per-session). Returns undefined when the module is disabled — callers must treat that as "no data", e.g. the footer's glance process line does.

Differences from the reference

  • Commands live in the /unipi:* namespace; env prefix is UNIPI_BG_*.
  • Runtime artifacts under the OS temp root (per-registry nonce) and durable delegate/fusion artifacts under workspace .unipi/ — never .pi/.
  • The reference's update-check footer surface is dropped (unipi's updater module owns updates).
  • agent_settled / before_provider_headers hooks register defensively on our pi SDK with an agent_end settlement fallback.

ISC-licensed reference: Copyright Ismail [email protected].