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

@agentproto/adapter-pi

v0.3.7

Published

@agentproto/adapter-pi — AIP-45 AGENT-CLI adapter for earendil-works/pi (@earendil-works/pi-coding-agent), driven over pi's persistent JSON-over-stdio RPC mode (`pi --mode rpc`). Implements the `protocol: "proprietary"` arm contract. NOTE: pi has no MCP s

Downloads

1,126

Readme

@agentproto/adapter-pi

AIP-45 AGENT-CLI adapter for earendil-works/pi (@earendil-works/pi-coding-agent) — an MIT, headless TypeScript coding agent. This adapter drives pi over its persistent JSON-over-stdio RPC mode (pi --mode rpc), spawned as a real child process.

import { pi, piRuntime } from "@agentproto/adapter-pi"

const session = await piRuntime().start()
for await (const evt of session.send({ role: "user", content: "list the files" })) {
  console.log(evt.kind)
}
await session.close()

MCP support — bridged into pi tools

Pi ships no native MCP client — but this adapter closes that gap. When the host injects mcpServers into connect() (the daemon's orchestration gateway, or any scoped toolset), the adapter bridges them into pi by exploiting pi's own TypeScript extension system:

  1. At connect(), it enumerates each server's tools (tools/list), writes a per-session config JSON, and spawns pi with -e <mcp-bridge-extension.mjs> plus PI_MCP_BRIDGE_CONFIG.
  2. The bundled extension registers one pi tool per MCP tool (namespaced mcp__<server>__<tool>); each tool's execute proxies the call to the MCP server over @modelcontextprotocol/sdk.

Net result: pi gains agentproto's full injected toolset, including agent_start when the daemon injects its gateway (--orchestrator flag), enabling sub-agent orchestration (capabilities.sub_agents: true). When no MCP servers are injected, behavior is unchanged (pi runs only its own built-in file/shell tools). Full mechanism, limitations, and caveats (image/binary-content, cancellation): MCP-BRIDGE.md.

What it is

Because pi has no native ACP/MCP protocol surface, this is a protocol: "proprietary" manifest: createAgentCliRuntime skips the built-in ACP/print subprocess plumbing and instead dynamic-imports this package's createAgentCliClient(definition) factory (see createProprietaryProtocolArm in @agentproto/driver-agent-cli). Unlike @agentproto/adapter-mastracode-inprocess (the in-process proprietary arm), this arm spawns a real child (pi --mode rpc) and translates pi's RPC event stream into the canonical StreamEvent taxonomy.

  • Multi-provider — Anthropic, OpenAI, Google (Gemini), Moonshot AI. One provider key minimum. See SECRETS.md.
  • Streaming — text + thinking deltas, tool-call/result lifecycle.
  • Live duplex — pi's RPC mode supports steer / follow_up / abort mid-turn (capabilities.bidirectional: true).
  • Resumable — pi persists sessions; the client captures pi's session id from get_state and reattaches via --session <id> (continuation.default: "native-resume").

Configuration

| Option | Type | Notes | | -------- | ------ | ----- | | model | string | Passed to pi's --model (accepts provider/id, e.g. anthropic/claude-sonnet-4-5, moonshotai/kimi-k2.7-code). | | effort | enum | Thinking level, mapped 1:1 to pi's set_thinking_level: off \| minimal \| low \| medium \| high \| xhigh. |

The pi binary is resolved from definition.bin (pi), overridable via the AGENTPROTO_PI_BIN env var (used by the gated smoke test to point at a local install without a global pi on PATH).

Safety

Pi has no built-in permission system — file, process, network and credential access run with the launching user's permissions, and non-interactive modes (including --mode rpc) show no trust prompt. Treat a pi session as arbitrary code execution. See SANDBOX.md.

Docs in this package

  • PI.md — AIP-45 manifest overview.
  • PI-RPC.md — the reverse-engineered RPC wire profile + the pi-event → StreamEvent mapping table.
  • SECRETS.md — provider env slots.
  • SANDBOX.md — no built-in permissions; containerization.

Built against pi 0.80.3. The event/command wire profile was reverse-engineered from pi source (packages/coding-agent/src/modes/rpc/* + core/agent-session.ts); see PI-RPC.md.