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

@ai-matrx/agents

v0.3.0

Published

Portable AI Matrx agent stream protocol, event projection, and safe result-presentation primitives.

Readme

@ai-matrx/agents

Portable client-side primitives for AI Matrx agent applications. The package standardizes the stream wire, pure request/workflow projection, and safe Creator-facing result boundaries without importing React, Redux, Next.js, or application code.

Install

pnpm add @ai-matrx/agents

Read an agent stream

import { readMatrxNdjsonStream } from "@ai-matrx/agents/stream/ndjson";

for await (const envelope of readMatrxNdjsonStream(response.body!, {
  onMalformedLine: reportProtocolDamage,
  onUnknownEnvelope: reportUnknownEnvelope,
})) {
  handleEvent(envelope);
}

The reader preserves split UTF-8, drains the network independently of consumer work up to the configurable maxReadAhead bound, supports cancellation, normalizes full and compact Matrx envelopes, and reports malformed or unknown input through explicit callbacks. onValidEnvelope observes the exact parsed wire value before normalization without consuming it. Full-envelope stream_seq is preserved for projector replay suppression.

Frame non-ReadableStream transports

import { createMatrxNdjsonFramer } from "@ai-matrx/agents/stream/ndjson";

const framer = createMatrxNdjsonFramer({
  onMalformedLine: reportProtocolDamage,
  onValidEnvelope: persistRawEnvelope,
});

handleEvents(framer.pushBytes(extensionMessageBytes));
handleEvents(framer.pushText(desktopBridgeFragment));
handleEvents(framer.finish());

The same incremental framer works with browser-extension messages, desktop bridges, WebSockets, and tests. finish() flushes split UTF-8 and diagnoses an invalid unterminated final line with atCompletion: true.

Present a settled result safely

import { projectAgentResultForDisplay } from "@ai-matrx/agents/presentation/result";

const displayValue = projectAgentResultForDisplay(persistedExecutionValue);

The projection removes provider-private reasoning blocks and signature material without mutating the execution value. It is only for display, JSON views, and exports. Never persist the projected result or use it to continue an agent run.

Project workflow live output

import {
  createWorkflowNodeProjection,
  projectWorkflowNodeEvent,
} from "@ai-matrx/agents/projection/workflow";

let node = createWorkflowNodeProjection({ runId, nodeId });
node = projectWorkflowNodeEvent(node, nodeStreamFrame);

This is the single workflow presentation inlet. It keeps answer and private reasoning separate, rejects replayed frames, assembles bounded server render_block snapshots, and prevents shadowed text from being interpreted as a second copy of the same content. Configure maxOpenFrameSets, maxFramesPerBlock, and maxBytesPerBlock when creating the projection; rejected or malformed blocks are observable through lastRenderBlockIssue.

Runtime support

The package is framework-free ESM targeting modern browsers, browser-based desktop shells, extensions, Next.js client or server modules, and Node 20+. It has no runtime dependencies and performs no work at import time.

Development

pnpm typecheck
pnpm test
pnpm check:package

check:package builds JavaScript and declarations, validates the manifest, packs the release artifact, checks its public types, installs it into an empty project, and imports every entry point.

Never publish directly from this working directory. Release the verified tarball produced by pnpm pack; prepublishOnly blocks the unsafe path.