🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

agent-session-replayer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agent-session-replayer

Embeddable scripted agent session replayer for React

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Agent Session Replayer

agent-session-replayer is an SSR-safe React component for replaying a fixed, scripted implementer/reviewer session. It does not run a model, invoke tools, or execute code: the whole story comes from the data you provide.

Install

bun add agent-session-replayer

React 18 and 19 are peer dependencies. Import the precompiled stylesheet once; consumers do not need Tailwind CSS.

import { AgentSessionReplayer, type AgentSession, type AgentSessionReplayerProps } from "agent-session-replayer";
import "agent-session-replayer/styles.css";

Development

This repository uses Bun and commits bun.lock as its lockfile.

bun install
bun run dev
bun run test
bun run typecheck
bun run build:package
bun run build

Minimal complete replay

import { AgentSessionReplayer, type AgentSession, type AgentSessionReplayerProps } from "agent-session-replayer";
import "agent-session-replayer/styles.css";

const agents: AgentSessionReplayerProps["agents"] = {
  implementer: {
    id: "claude-code",
    name: "Claude",
    role: "Implementer",
    context: "the repository and approved task",
  },
  reviewer: {
    id: "reviewer",
    name: "Review agent",
    role: "Adversarial reviewer",
    context: "the diff and acceptance criteria",
  },
};

const cases: AgentSession[] = [{
  id: "checkout-fix",
  title: "Fix checkout total",
  summary: "A deterministic implementation and review replay.",
  repository: "acme/storefront",
  branch: "fix/checkout-total",
  events: [{
    id: "task",
    type: "task_received",
    actor: "implementer",
    title: "Read the task",
    summary: "Confirm the requested checkout behavior.",
    blocks: [{
      id: "request",
      kind: "message",
      content: "Correct the checkout total and add a regression test.",
    }],
  }],
}];

export function Demo() {
  return <AgentSessionReplayer agents={agents} cases={cases} />;
}

Props

All objects are strict at runtime: unknown keys are rejected. Required strings must be non-empty. Invalid props throw during render with an error beginning AgentSessionReplayer received invalid props:.

PropTypeRequired / defaultRules and behavior
agentsRecord<"implementer" | "reviewer", AgentIdentity>RequiredMust contain exactly implementer and reviewer identities.
casesAgentSession[]RequiredNon-empty sessions. Case IDs are unique across the array.
typingSpeednumber110Finite, greater than zero; graphemes revealed per second.
eventDelayMsnumber500Finite, zero or greater; delay between completed events.
heightnumber720Finite, greater than zero; rendered as pixels.
colorsAgentSessionColorsOptionalScoped CSS-variable overrides listed below.
caseIndexnumberOptionalControlled case index. It must be an integer in the cases bounds.
initialCaseIndexnumber0Uncontrolled starting index. It must be an integer in the cases bounds.
classNamestringOptionalAdded to the player root element.
onCaseChange(index, item) => voidOptionalCalled only for user navigation requests; controlled parents must update caseIndex.
onEventStart(event, item) => voidOptionalCalled once before an event reveals its first grapheme.
onEventComplete(event, item) => voidOptionalCalled once after the event finishes revealing. Interrupted events do not complete.
onCaseComplete(item) => voidOptionalCalled after the final event completion for a case.

Controlled and uncontrolled navigation

Omit caseIndex to let the component own navigation. Use initialCaseIndex to start at another case.

<AgentSessionReplayer agents={agents} cases={cases} initialCaseIndex={1} />

Supply caseIndex to control navigation. The callback reports a request; the parent updates the value.

import { useState } from "react";

const [caseIndex, setCaseIndex] = useState(0);

<AgentSessionReplayer
  agents={agents}
  cases={cases}
  caseIndex={caseIndex}
  onCaseChange={(nextIndex) => setCaseIndex(nextIndex)}
/>

Replay data schema

AgentIdentity

FieldTypeRules
idstringNon-empty identity ID.
namestringNon-empty visible name.
rolestringNon-empty visible role.
contextstringNon-empty description of the agent's working context.

AgentSession

FieldTypeRules
idstringNon-empty and unique across cases.
titlestringNon-empty case title.
summarystringNon-empty case summary.
repositorystringNon-empty repository label.
branchstringNon-empty branch label.
eventsAgentSessionEvent[]Non-empty. Event IDs are unique within the case.

AgentSessionEvent

FieldTypeRules
idstringNon-empty and unique within its case.
typeAgentEventTypeOne of the event literals below.
actor"implementer" | "reviewer"Agent that produced the event.
titlestringNon-empty event title.
summarystringNon-empty collapsed-event summary.
blocksAgentSessionBlock[]Non-empty. Block IDs are unique within the event.

AgentEventType is one of:

"task_received" | "plan" | "patch" | "review_request" | "review_start"
| "blocking_finding" | "revision" | "verification" | "approval"

AgentSessionBlock

FieldTypeRules
idstringNon-empty and unique within its event.
kindAgentBlockKindOne of the block literals below.
titlestringOptional; when supplied it must be non-empty.
contentstringNon-empty visible block content.
languagestringOptional; when supplied it must be non-empty.

AgentBlockKind is one of:

"message" | "code" | "tool_call" | "tool_output" | "finding" | "patch" | "git_diff" | "status" | "result"

Lifecycle ordering

For each replayed event, onEventStart(event, case) fires once before text starts revealing, then onEventComplete(event, case) fires after its final grapheme. On the final event, onEventComplete fires before onCaseComplete(case). Restarting or navigating to a case begins a new run and may fire the callbacks again for that run.

Validation failures

The component validates the resolved props, including defaults, immediately before playback starts. It reports all detected issues in one error with nested paths.

// Throws: AgentSessionReplayer received invalid props:
// cases[0].events[0].blocks[0].content: Too small: expected string to have >=1 characters
<AgentSessionReplayer agents={agents} cases={[{
  ...cases[0],
  events: [{ ...cases[0].events[0], blocks: [{ ...cases[0].events[0].blocks[0], content: "" }] }],
}]} />

Theme overrides

colors supplies scoped values for these CSS variables. Values can be any CSS color value accepted by the browser.

KeyCSS variable
background--asr-background
surface--asr-surface
border--asr-border
text--asr-text
muted--asr-muted
implementer--asr-implementer
reviewer--asr-reviewer
success--asr-success
danger--asr-danger
focus--asr-focus
<AgentSessionReplayer
  agents={agents}
  cases={cases}
  colors={{ background: "#080b12", reviewer: "#ff8a65", focus: "#8ab4f8" }}
/>

Rendering, motion, and accessibility

The package is safe to import and server-render: browser APIs and timers are accessed only in effects, so server markup and the initial client markup are deterministic. When prefers-reduced-motion: reduce is active, events complete without the typing and collapse animations.

Navigation uses labeled buttons and each expanded event is exposed as an article with its event title. Keep the supplied titles and summaries meaningful so the replay remains understandable to assistive technology.

The player always includes a quiet devos attribution link in its in-frame footer.

Bun development

This workspace uses Bun 1.3.8 and bun.lock.

bun install
bun run dev
bun run test
bun run typecheck
bun run build
bun run build:package

The root commands run the demo workspace. bun run build:package builds the embeddable package into packages/agent-session-replayer/dist.

Keywords

react

FAQs

Package last updated on 13 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts