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

vite-plugin-agent-presence

v0.0.3

Published

Vite dev overlay for Pi agent presence

Downloads

574

Readme

vite-plugin-agent-presence

Dev-only Vite overlay that shows when a Pi coding agent is active in your project.

Install

pnpm add -D vite-plugin-agent-presence

Vite setup

// vite.config.ts
import { defineConfig } from "vite";
import agentPresence from "vite-plugin-agent-presence";

export default defineConfig({
  plugins: [agentPresence()],
});

The plugin only applies during vite serve. It registers JSON endpoints under /__agent_presence, keeps active agents in memory, broadcasts updates through Vite HMR (server.ws.send), and injects a small browser overlay.

Pi extension setup

Install the extension as a Pi package from npm:

pi install npm:vite-plugin-agent-presence

For project-local installation, add -l:

pi install -l npm:vite-plugin-agent-presence

The package declares a Pi manifest:

{
  "pi": {
    "extensions": ["./dist/pi/index.js"]
  }
}

You can also wire it manually:

// .pi/extensions/agent-presence.ts
export { default } from "vite-plugin-agent-presence/pi";

Or customize options:

import { piAgentPresence } from "vite-plugin-agent-presence/pi";
export default piAgentPresence({ heartbeatMs: 5000, ttlMs: 15000 });

The extension uses Pi lifecycle hooks. It sends start on agent start, update for turns/tool calls/edits, periodic heartbeat, and done on agent end or session shutdown. The LLM never needs to call a tool.

Discovery

When Vite starts, the plugin writes:

node_modules/.vite/agent-presence.json

Example:

{
  "url": "http://localhost:5173/__agent_presence",
  "projectRoot": "/absolute/path/to/project",
  "pid": 12345,
  "token": "random-dev-token"
}

Pi discovery order:

  1. VITE_AGENT_PRESENCE_URL environment variable (VITE_AGENT_PRESENCE_TOKEN optional)
  2. node_modules/.vite/agent-presence.json in the current workspace
  3. fallback scan of localhost ports 5173-5183

If no Vite dev server is running, the extension fails silently.

HTTP protocol

Payload:

export type AgentPresence = {
  id: string;
  name?: string;
  tool?: string;
  task?: string;
  status?: "working" | "thinking" | "editing" | "done";
  startedAt?: number;
  updatedAt?: number;
  ttlMs?: number;
};

Endpoints:

  • POST /__agent_presence/start
  • POST /__agent_presence/update
  • POST /__agent_presence/heartbeat
  • POST /__agent_presence/done
  • GET /__agent_presence/state

Pi sends IDs like pi:<sessionId> and { "name": "Pi", "tool": "pi-agent" }.

Security

This is dev-only and localhost-oriented. POST endpoints require the random token from the discovery file when available. Do not expose your Vite dev server publicly.