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-mastracode-inprocess

v0.2.1

Published

@agentproto/adapter-mastracode-inprocess — AIP-45 AGENT-CLI adapter for Mastra Code driven in-process via the `mastracode`/`mastracode/headless` SDK, instead of spawning a subprocess. Implements the `protocol: "proprietary"` arm contract directly.

Readme

@agentproto/adapter-mastracode-inprocess

Mastra Code driven in-process via its mastracode / mastracode/headless SDK, instead of spawning npx mastracode as a subprocess. Implements the AIP-45 protocol: "proprietary" arm contract directly — no child process, no argv, no JSONL pipe.

import { mastracodeInprocessRuntime } from "@agentproto/adapter-mastracode-inprocess"

const runtime = mastracodeInprocessRuntime()
const session = await runtime.start({ cwd: process.cwd() })

for await (const evt of session.send("Fix the failing test in src/foo.ts")) {
  console.log(evt)
}
await session.close()

// Resume later — same process or a fresh one — via the sessionId the
// first session returned:
const resumed = await runtime.start({ resumeSessionId: session.sessionId })

See @agentproto/driver-agent-cli's createAgentCliRuntime for the generic AgentCliRuntime/AgentCliClient contract this package implements.

How it works

manifest (src/index.ts, protocol: "proprietary")
        │ createAgentCliRuntime skips the subprocess spawn
        ▼
createProprietaryProtocolArm  ──dynamic import──▶  this package
        │                                                │
        │                              createAgentCliClient(definition)
        ▼                                                ▼
   AgentCliClient  ◀── src/client.ts ── createMastraCode() + runMC()
        │
        │ mapMastraEvent (reused from @agentproto/driver-agent-cli's print arm)
        ▼
    StreamEvent

Why this is a separate package from @agentproto/adapter-mastracode

That package spawns the CLI (protocol: "print") per turn; this one holds a live in-process AgentController across turns and never shells out. Different dependency surface, different process lifecycle, different session-id shape — see MASTRACODE-INPROCESS.md for the full rationale.

Session ids

sessionId is a composite "<resourceId>:<threadId>" string — an implementation detail of how Mastra Code resolves threads for a live AgentController, documented in full in MASTRACODE-INPROCESS.md. Hosts should treat it as an opaque string: persist whatever sessionId returns and pass it back as resumeSessionId to resume, including across a process restart.

Isolation

Storage and Mastra Code's global home-dir config discovery are both redirected to a dedicated location under $AGENTPROTO_HOME (default ~/.agentproto/mastracode-inprocess/), so this arm's sessions never collide with — or leak into — a developer's own interactive mastracode usage. See MASTRACODE-INPROCESS.md for specifics and a known limitation around homeDir propagation.

Modes and options

modes (plan / build / fast) and options (model / effort) are declared on the manifest; see MASTRACODE-INPROCESS.md for how they reach client.ts (env-carried mode selection, direct model/effort passthrough).

Spec

See AIP-45.