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

@agent-relay/session

v11.8.5

Published

Cross-harness session continuity and attribution for Agent Relay

Readme

@agent-relay/session

Portable session continuity for Agent Relay. The SDK keeps one stable Relay session ID across machines and AI harnesses while preserving the immutable owner, current steerer, and full control-transfer audit trail.

Install

npm install @agent-relay/session

Set RELAYHISTORY_URL to the Relayhistory deployment. The client accepts a URL with or without the /v1 suffix.

export RELAYHISTORY_URL=https://history.agentrelay.com
export RELAYHISTORY_TOKEN=...

RELAYHISTORY_ACCESS_TOKEN and RELAY_AGENT_TOKEN are supported as token fallbacks.

Completed-session replay also joins the workspace-wide Relaycast conversation. Set RELAY_WORKSPACE_KEY (or AGENT_RELAY_WORKSPACE_KEY) and, for a non-default deployment, RELAY_BASE_URL. The relay session replay CLI uses the workspace already selected for the current project when neither workspace-key variable is set.

Start and journal a session

import { SessionClient } from '@agent-relay/session';

const sessions = new SessionClient({ cli: 'claude', node: 'danny-mac' });
const owner = {
  userId: 'usr_danny',
  email: '[email protected]',
  displayName: 'Danny',
};

const session = await sessions.createSession({
  cli: 'claude',
  node: 'danny-mac',
  owner,
});

// Best effort: failures do not interrupt the harness. Pass onWriteError to
// SessionClient when the host wants logging or telemetry for failed writes.
void sessions.writeTurn({
  sessionId: session.sessionId,
  role: 'user',
  content: 'Continue the migration.',
  actor: owner,
});

Resume from another harness

const sessions = new SessionClient({ cli: 'codex', node: 'dev-mac' });
const { session, turns, resume } = await sessions.resumeSession(relaySessionId);

if (resume.mode === 'native') {
  // Only selected for a Claude-origin session resumed by Claude.
  launchClaude(['--resume', resume.nativeResumeId]);
} else {
  // Codex, OpenCode, Grok, Cursor, and every cross-CLI handoff use this path.
  launchHarness({ prompt: resume.contextPrompt });
}

The injected prompt contains the ordered, attributed Relayhistory journal and marks it as quoted prior context. Codex sessions are journal-only, including Codex-to-Codex handoffs.

Replay a completed multi-agent session

const replay = await sessions.replaySession(relaySessionId);

console.log(replay.contextPrompt);
console.log(replay.conversation.availability);
console.log(replay.conversation.retention);

replaySession joins Relayhistory turns with Relaycast messages stamped with the same session reference, fetches every Relaycast page, and orders the joined timeline by timestamp. Relaycast is workspace-wide, so the conversation slice continues across nodes even though Relayhistory journals are per-node. A missing node journal can still omit that node's private harness turns; the replay labels that limitation and does not infer cross-node Relayhistory completeness.

Every replay prints the effective Relaycast retention boundary. partial, aged_out, missing credentials, and unknown/query-failure results are marked INCOMPLETE rather than presenting an empty conversation as proof that agents did not communicate. The reachable conversation therefore extends only as far back as the workspace plan's effective retention policy.

Record steering and attribute commits

await sessions.recordSteering({
  sessionId: relaySessionId,
  actor: {
    userId: 'usr_dev',
    email: '[email protected]',
    displayName: 'Dev',
  },
  relayMessageId: '213570121302978560',
});

const trailers = await sessions.getGitTrailers(relaySessionId);
// Append trailers.join('\n') to the commit message.

Trailers include de-duplicated Co-authored-by identities plus stable Relay-Session-*, active-actor, origin-CLI, and origin-node attribution.

Relayhistory wire contract

The SDK uses the existing Relayhistory journal endpoints:

  • POST /v1/sessions/:sessionId/turns
  • GET /v1/sessions/:sessionId/turns

Creation and steering are durable system turns whose metadata carries the full RelaySession snapshot. Ordinary user, assistant, and system turns use the same ordered journal. This makes the backend journal the single source of truth for conversation context and the identity audit trail.