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

@jini-ai/protocol

v0.3.1

Published

The Jini wire contract: run, event, journal, registry, and error types shared by every other package. Zod-validated, no other dependencies.

Readme

@jini-ai/protocol

The Jini wire contract: run, event, journal, registry, and error types shared by every other package in the engine. Everything here is a plain TypeScript type/interface or a small zod schema — there is no runtime behavior beyond a handful of pure helper functions (createApiError, isTerminalRunState). Its only dependency is zod, and it must never import another @jini-ai/* package, so every consumer — an HTTP route, a CLI renderer, an MCP tool, a browser UI — can agree on the same RunEvent/RunStatus/ApiError shapes without pulling in Node-only or product-specific code.

Install

npm install @jini-ai/protocol

No peer dependencies. zod is a regular dependency, installed automatically.

What you get

  • Run lifecycle — RunState/RUN_STATES, TERMINAL_RUN_STATES/isTerminalRunState, RunStatus, and RunCancelRequest for an explicit cancellation contract.
  • Run events — RunEvent<Name, Payload> (the transport-neutral envelope, not tied to SSE), RunProtocolEvent, and the concrete lifecycle/agent payloads (RunStartPayload, RunChunkPayload, RunEndPayload, RunAgentPayload).
  • Errors — ApiError/ApiErrorResponse/ApiValidationIssue, GENERIC_ERROR_CODES/ GenericErrorCode/ApiErrorCode (open union — a pack's own codes type-check without a kernel edit), createApiError/createApiErrorResponse, and RunErrorPayload.
  • Durable event log port — EventLog, EventLogEntry, EventLogAppendInput, EventLogReplayResult (the async, dedupe-aware, gap-detecting log interface that @jini-ai/daemon's in-memory implementation and @jini-ai/sqlite's durable adapter both implement).
  • Agent catalog vocabulary — AgentDefinition, ModelProvider, ModelCatalogOption, CredentialStatus, AgentDiagnostic/AgentDiagnosticReason/AgentDiagnosticSeverity, AgentFixIntent — what a coding agent, its model list, and its unavailability diagnostics look like on the wire, shared between @jini-ai/agent-runtime and any UI that renders a model picker or an agent-health card.
  • Registry schemas — zod schemas + inferred types for a package registry's manifest, entries, versions, trust/signature metadata, and publish/search/doctor/yank request-response shapes (RegistryEntrySchema, RegistryManifestSchema, ResolvedRegistryEntrySchema, RegistryBackend/RegistryBackendFactory, etc.).
  • Journal — JournalEntry/JournalProvenance for provenance-tagged records.
  • Run-context encoding — RunContextPayload, encodeRunContextRef/decodeRunContextRef: a shared, optional {prompt, history} encoding for RunCreateRequest.contextRef, so a host driving a chat-shaped agent doesn't have to invent its own encoding (contextRef itself stays an opaque string as far as the kernel is concerned — using this helper is never required).
  • Common shapes — JsonValue, BoundedJsonConstraints, OkResponse, IdResponse, EntityResponse/EntityListResponse, Nullable.

Usage

import {
  createApiError,
  isTerminalRunState,
  type RunStatus,
  type RunEvent,
  type RunChunkPayload,
  type EventLogEntry,
} from '@jini-ai/protocol';

function handleEvent(evt: RunEvent<'stdout', RunChunkPayload>) {
  if (isTerminalRunState(status.state)) {
    // flush and close the transport
  }
}

const status: RunStatus = { id: 'run_123', state: 'running' } as RunStatus;

const err = createApiError('NOT_FOUND', 'run not found', { details: { runId: 'run_123' } });

function toEntry(e: EventLogEntry): { cursor: string; event: string } {
  return { cursor: e.id, event: e.event };
}

What's swappable

This package defines contracts only — nothing to inject. EventLog is the one interface meant to be implemented by other packages (@jini-ai/daemon's in-memory log, @jini-ai/sqlite's durable adapter, RegistryBackend/RegistryBackendFactory similarly for a registry storage backend) rather than by protocol itself, which only carries the shapes.

Runtime

Universal — no Node/browser-specific APIs. ESM only — ships "type": "module" with no CommonJS require build.

Provenance

See source-map.md for per-file provenance and scope decisions. Apache-2.0.