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

@hasna/agent-registry

v0.1.0

Published

One canonical, persistent implementation of the agent-lifecycle MCP tools (register_agent, heartbeat, set_focus, list_agents, send_feedback) exposed as a single registerAgentTools(server). SQLite-backed via @hasna/cloud, optional @hasna/events lifecycle e

Readme

@hasna/agent-registry

One canonical, persistent implementation of the agent-lifecycle tools every Hasna MCP server ships:

register_agent · heartbeat · set_focus · list_agents · send_feedback

It replaces the 43 divergent hand-rolled copies — some backed by an in-memory Map (presence lost on restart, not listable cross-process), four different id schemes, two incompatible identity contracts — with a single SQLite-backed core that syncs local ⇄ cloud through @hasna/cloud and delegates feedback to it (never reimplements it).

Install

bun add @hasna/agent-registry
# peers you already bundle:
bun add @modelcontextprotocol/sdk zod
# optional lifecycle events:
bun add @hasna/events

One-line service bootstrap

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { registerAgentTools } from "@hasna/agent-registry";

const server = new McpServer({ name: "my-service", version: "0.1.0" });
registerAgentTools(server); // register_agent, heartbeat, set_focus, list_agents, send_feedback

By default this persists to ~/.hasna/agent-registry/agent-registry.db (via @hasna/cloud's SqliteAdapter). Pass your own handle to share a database:

import { SqliteAdapter } from "@hasna/cloud";

const db = new SqliteAdapter("/path/to/service.db");
registerAgentTools(server, {
  db,
  service: "my-service",       // used for feedback delegation
  events: myEventsClient,      // optional @hasna/events client
  includeExtendedTools: true,  // get_focus / unfocus / rename_agent / remove_agent
  toolFilter: (name) => name !== "send_feedback",
});

Options (AgentToolsOptions)

| Option | Default | Meaning | | --- | --- | --- | | db | shared local SQLite | Injected DbAdapter (from @hasna/cloud) | | service | "agent-registry" | Service name for feedback delegation | | events | – | Optional @hasna/events client (best-effort lifecycle emit) | | agentFocus | – | Host-shared Map updated on set_focus/unfocus | | includeFeedback | true | Register send_feedback (delegated to @hasna/cloud) | | includeExtendedTools | false | Add the conversations-style superset | | toolFilter | – | (name) => boolean to skip specific tools |

Programmatic core

The store is a pure, DbAdapter-injectable module (@hasna/agent-registry/store):

import { SqliteAdapter } from "@hasna/cloud";
import {
  ensureAgentsTable, registerAgent, heartbeat, setFocus,
  listAgents, getAgent, getAgentByName, resolveAgent,
  releaseAgent, archiveAgent, autoReleaseStaleAgents, isAgentConflict,
} from "@hasna/agent-registry/store";

const db = new SqliteAdapter(":memory:");
ensureAgentsTable(db);

const result = registerAgent({ name: "brutus", session_id: "sess-1" }, db);
if (isAgentConflict(result)) {
  // structured descriptor — never thrown
  console.log(result.message, result.existing_id);
}

Canonical decisions

  • Persistence — always SQLite via an injected DbAdapter; the agents table participates in @hasna/cloud's syncPush/syncPull like every other table (no bespoke sync, no in-memory variants).
  • Idag_ + crypto.randomUUID().slice(0, 8) (greppable, sync-safe).
  • Resolution — accepts either agent_id or name everywhere, plus HASNA_AGENT_SESSION_ID env auto-detect.
  • Conflict policy — 30-min active window (HASNA_AGENT_TIMEOUT_MS to override), force takeover, same-session heartbeat, stale takeover; returns a structured AgentConflictError { conflict: true, ... } — never throws.
  • set_focus — persists active_project_id and updates an optional in-process focus Map.
  • send_feedback — delegated to @hasna/cloud's sendFeedback, not reimplemented.

CLI

agent-registry list [--online] [--archived] [--json]
agent-registry register <name> [--session <id>] [--role <role>] [--project <id>] [--force]
agent-registry heartbeat <id|name>
agent-registry focus <id|name> [<project_id>]
agent-registry remove <id|name>

Environment

Canonical prefix is HASNA_AGENT_REGISTRY_; the shorter HASNA_AGENT_ is accepted as an alias.

| Var | Default | Meaning | | --- | --- | --- | | HASNA_AGENT_REGISTRY_TIMEOUT_MS | 1800000 | Active window before an agent is stale | | HASNA_AGENT_REGISTRY_SESSION_ID | – | Auto-detected session id for resolution | | HASNA_AGENT_REGISTRY_AUTO_RELEASE | – | true enables autoReleaseStaleAgents() |

License

Apache-2.0