vite-plugin-agent-presence
Vite dev overlay for Pi agent presence
Package details
Install vite-plugin-agent-presence from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:vite-plugin-agent-presence- Package
vite-plugin-agent-presence- Version
0.0.3- Published
- May 18, 2026
- Downloads
- not available
- Author
- lajoskvcs
- License
- MIT
- Types
- extension
- Size
- 35 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./dist/pi/index.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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:
VITE_AGENT_PRESENCE_URLenvironment variable (VITE_AGENT_PRESENCE_TOKENoptional)node_modules/.vite/agent-presence.jsonin the current workspace- fallback scan of
localhostports5173-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/startPOST /__agent_presence/updatePOST /__agent_presence/heartbeatPOST /__agent_presence/doneGET /__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.