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

@reaatech/agent-replay-shared

v0.1.0

Published

Shared types and utilities for Agent Replay

Readme

@reaatech/agent-replay-shared

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

Shared types, interfaces, error classes, and configuration for the Agent Replay ecosystem. This package is the canonical source of truth for all trace model shapes, LLM provider abstractions, and storage contracts used by every other @reaatech/agent-replay-* package.

Installation

npm install @reaatech/agent-replay-shared
# or
pnpm add @reaatech/agent-replay-shared

Feature Overview

  • 100+ exported types and interfaces — complete trace model, LLM abstractions, storage contracts, and configuration shapes
  • 7 typed error classesRecordingFailedError, ReplayFailedError, StateCaptureError, and more — all extending a serializable AgentReplayError base
  • Zero runtime dependencies — pure TypeScript types and abstract interfaces, fully tree-shakeable
  • Dual ESM/CJS output — works with import and require

Quick Start

import {
  type Trace,
  type Span,
  type LLMRequest,
  type LLMResponse,
  type RecordingConfig,
  type ReplayConfig,
  TraceNotFoundError,
  AgentReplayError,
} from "@reaatech/agent-replay-shared";

This package is a dependency of every other Agent Replay package. Most consumers will get these types transitively through @reaatech/agent-replay-core or the convenience @reaatech/agent-replay package.

Exports

Trace Data Model

The trace is the fundamental unit — a complete record of an agent interaction.

| Export | Description | |--------|-------------| | Trace | Top-level container: version, metadata, spans, checkpoints, indexes | | TraceMetadata | Trace identity: id, name, createdAt, agentVersion, environment, tags, summary | | TraceSummary | Lightweight header for list/search operations | | TraceHeader | Serialization header with schema version and format info | | TraceIndexes | Fast lookup indexes: byId (span id → array index) and byKind | | Span | A single unit of work: id, parentId, name, kind, timestamps, status, events, attributes, links | | SpanLink | Cross-trace reference: traceId, spanId, optional attributes | | Event | A timestamped data point within a span: timestamp, type, name, attributes, data | | Checkpoint | Serialized agent state at a point in time: id, spanId, timestamp, state, context, metadata | | CheckpointMetadata | Name and optional description for a checkpoint | | SerializedState | Full state snapshot: variables, memory, conversation, toolRegistry | | MemorySnapshot / MemoryEntry | Key-value memory entries with timestamps | | ConversationState | Array of Message objects representing chat history | | Message | A chat message: role ("system" | "user" | "assistant" | "tool"), content, toolCalls?, toolCallId? | | ToolCall | A tool invocation: id, name, arguments | | ToolDefinition | A declared tool: name, description, parameters | | ToolRegistrySnapshot | Array of ToolDefinition available at capture time | | AgentContext | Session-scoped context for checkpoints: sessionId, variables | | CaptureContext | Options for captureEvent: spanId?, timestamp? |

Enumerated Types

| Type | Values | |------|--------| | SpanKind | "llm_call" | "tool_call" | "agent_step" | "routing_decision" | "state_change" | "error" | | SpanStatus | "ok" | "error" | "in_progress" | | EventType | "request" | "response" | "error" | "state_snapshot" | "checkpoint" | "annotation" |

LLM Provider Abstractions

Provider-agnostic types that all interceptors normalize into.

| Export | Description | |--------|-------------| | LLMRequest | Normalized request: provider, model, messages, tools?, temperature?, maxTokens?, topP?, stopSequences?, raw | | LLMResponse | Normalized response: id, model, content, toolCalls?, usage?, finishReason, raw | | StreamChunk | A single streaming delta: index, delta, toolCallDelta?, finishReason?, usage? | | RecordedStream | Complete stream recording: chunks array, aggregatedContent, aggregatedToolCalls?, duration, totalChunks | | TokenUsage | Prompt, completion, and total token counts |

Error Hierarchy

All errors extend the abstract AgentReplayError base class, which provides machine-readable code, optional cause, and JSON serialization via toJSON().

| Error Class | Code | When | |-------------|------|------| | AgentReplayError | (base) | Base class for all errors | | RecordingFailedError | RECORDING_FAILED | Recording session could not start or complete | | TraceNotFoundError | TRACE_NOT_FOUND | Requested trace file does not exist | | InvalidTraceError | INVALID_TRACE | Trace data failed validation with ValidationError[] | | ReplayFailedError | REPLAY_FAILED | Replay failed at a specific step | | StateCaptureError | STATE_CAPTURE_FAILED | State serialization failed for a given state type | | DivergenceError | DIVERGENCE_DETECTED | Live replay diverged from the recorded trace | | InterceptorError | INTERCEPTOR_FAILED | LLM provider interceptor could not be installed |

Storage Abstractions

| Export | Description | |--------|-------------| | TraceStorage | Pluggable interface: save, load, list, delete, search | | StorageOptions | Compression and encryption flags | | TraceFilter | Filter traces by tags, date range, or status | | SearchQuery | Full-text search with limit and offset | | TraceSearchResult | Paginated results with total count |

Configuration

| Export | Description | |--------|-------------| | RecordingConfig | Recording options: name, providers?, outputPath?, captureState?, checkpointInterval?, tags? | | ReplayConfig | Base replay config: mode, checkpointId?, maxSteps?, timeout?, onProgress?, signal? | | PartialReplayConfig | Extends ReplayConfig with mode: "partial" and required checkpointId | | DiffReplayConfig | Extends ReplayConfig with mode: "diff" and optional diffOptions | | ReplayProgress | Progress callback payload: percent, currentStep, totalSteps | | ReplayResult | Replay output: trace, outputs, duration, divergence? | | DivergenceReport | When live replay diverges: step, expected, actual, path | | DiffOptions | Diff configuration: includeSemantic?, includeStructural?, similarityThreshold? | | DiffResult | Diff output: diffs[], statistics, report, severity | | TraceDiff | Individual difference: type, severity, message, details | | DiffStatistics | Summary: totalDifferences, semanticChanges, structuralChanges |

Related Packages

License

MIT