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-handoff

v0.1.0

Published

Core types, utilities, and configuration for the Agent Handoff Protocol

Readme

@reaatech/agent-handoff

npm version License: MIT CI

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

Core types, utilities, and configuration for the Agent Handoff Protocol. This package is the foundation that all other @reaatech/agent-handoff-* packages build on.

Installation

npm install @reaatech/agent-handoff
# or
pnpm add @reaatech/agent-handoff

Feature Overview

  • 35+ exported types — every handoff domain concept has a corresponding type: payloads, agents, routing decisions, triggers, messages, and more
  • 7 typed error classesHandoffError hierarchy with TransportError, ValidationError, TimeoutError, RejectionError, RoutingError, CompressionError, ConfigurationError
  • Typed event emitterTypedEventEmitter<EventMap> with type-safe on/off/once/emit for lifecycle observability
  • Retry utilitywithRetry with configurable exponential/linear backoff and full jitter
  • Config factorycreateHandoffConfig with deeply merged sensible defaults
  • Zero runtime dependencies — everything is built-in or injected by the consumer
  • Dual ESM/CJS output — works with import and require

Quick Start

import {
  createHandoffConfig,
  defaultHandoffConfig,
  HandoffError,
  TypedEventEmitter,
  withRetry,
  pickDefined,
} from '@reaatech/agent-handoff';
import type {
  HandoffPayload,
  AgentCapabilities,
  RoutingDecision,
  HandoffConfig,
  Message,
} from '@reaatech/agent-handoff';

// Create a configuration with defaults
const config = createHandoffConfig({
  routing: { minConfidenceThreshold: 0.6 },
});

// Use the typed event emitter
const emitter = new TypedEventEmitter<{ update: { id: string } }>();
emitter.on('update', ({ id }) => console.log(id));

// Retry with backoff
const result = await withRetry(() => fetchSomething(), {
  maxRetries: 3,
  backoff: 'exponential',
  baseDelayMs: 100,
  maxDelayMs: 5000,
  shouldRetry: (err) => err instanceof Error,
});

Exports

Types

| Export | Description | |---|---| | HandoffPayload | Complete handoff data: session history, compressed context, metadata | | CompressedContext | Compression output: summary, key facts, intents, entities, open items | | AgentCapabilities | Agent descriptor: skills, domains, load, languages, availability | | RoutingDecision | Discriminated union: PrimaryRoute | ClarificationRoute | FallbackRoute | | HandoffConfig | Compression, routing, transport, and trigger configuration | | HandoffTrigger | Discriminated union of 5 trigger types | | HandoffContext | Input context for HandoffManager.executeHandoff() | | HandoffOptions | Optional overrides: source agent, timeout, transport preference | | HandoffResult | Result type: success/failure, receiving agent, routing decision | | Message | Conversation message: id, role, content, timestamp | | TransportLayer | Interface: sendHandoff, validateConnection, getCapabilities | | ContextCompressor | Interface: compress + estimateTokens | | HandoffRouter | Interface: route returning a RoutingDecision | | DeepPartial | Recursive partial utility type |

Errors

All errors extend HandoffError which includes code: HandoffErrorCode, message: string, and optional details.

| Class | Code | When | |---|---|---| | HandoffError | (custom) | Base class for all handoff errors | | TransportError | transport_error | Transport layer failure | | ValidationError | validation_error | Payload incompatible with target agent; includes validationErrors[] | | TimeoutError | timeout_error | Handoff exceeded timeout; includes timeoutMs | | RejectionError | rejection_error | Target agent rejected; includes rejectionReason | | RoutingError | routing_error | No suitable agent found | | CompressionError | compression_error | Context compression failed | | ConfigurationError | configuration_error | Invalid configuration |

Utilities

| Export | Description | |---|---| | TypedEventEmitter<EventMap> | Type-safe event emitter with on, off, once, emit | | withRetry | Async retry with exponential/linear backoff + full jitter | | pickDefined | Build object from key-value pairs, omitting undefined values | | createHandoffConfig | Deep-merge partial config with defaultHandoffConfig | | defaultHandoffConfig | Sensible defaults for compression, routing, transport, triggers |

Related Packages

License

MIT