AgentEyesAgentEyes

API Reference

Complete API reference for the AgentEyes class and event types.

AgentEyes

The main class that orchestrates all collectors.

Constructor

new AgentEyes(config?: AgentEyesConfig)

Methods

MethodReturnDescription
start()voidStart all enabled collectors
stop()voidStop all collectors and clean up
getEvents(type?)AgentEvent[]Get all events, optionally filtered by type
getRecent(n?)AgentEvent[]Get the last N events (default: 20)
subscribe(fn)() => voidSubscribe to real-time events. Returns unsubscribe function
clear()voidClear all captured events
snapshot()objectFull application state snapshot
toJSON()stringSerialized snapshot as JSON string

Properties

PropertyTypeDescription
isRunningbooleanWhether collectors are currently active
enabledbooleanWhether agent-eyes is enabled

Event Types

All events share a type discriminator and timestamp field.

LogEntry

{
  type: 'log';
  level: 'log' | 'warn' | 'error' | 'debug' | 'info';
  args: unknown[];
  timestamp: number;
  stack?: string;
}

NetworkEntry

{
  type: 'network';
  method: string;
  url: string;
  status?: number;
  requestHeaders?: Record<string, string>;
  responseHeaders?: Record<string, string>;
  requestBody?: unknown;
  responseBody?: unknown;
  duration?: number;
  timestamp: number;
  error?: string;
}

ErrorEntry

{
  type: 'error';
  message: string;
  stack?: string;
  source?: string;
  lineno?: number;
  colno?: number;
  timestamp: number;
}

DOMSnapshotEntry

{
  type: 'dom-snapshot';
  html: string;
  url: string;
  viewport: { width: number; height: number };
  timestamp: number;
}

PerformanceEntry

{
  type: 'performance';
  metrics: {
    domContentLoaded?: number;
    loadComplete?: number;
    firstPaint?: number;
    firstContentfulPaint?: number;
    largestContentfulPaint?: number;
    memoryUsage?: number;
  };
  timestamp: number;
}

ReactComponentEntry

{
  type: 'react-component';
  name: string;
  props: Record<string, unknown>;
  state?: Record<string, unknown>;
  renderCount: number;
  timestamp: number;
}

Exports

// Core
import { AgentEyes } from '@everkers/agent-eyes';

// React
import {
  AgentEyesProvider,
  useAgentEyes,
  useAgentEvents,
  useAgentSnapshot,
} from '@everkers/agent-eyes/react';

// Vite
import { agentEyesPlugin } from '@everkers/agent-eyes/vite';

// Types
import type {
  AgentEvent,
  AgentEyesConfig,
  LogEntry,
  NetworkEntry,
  ErrorEntry,
  DOMSnapshotEntry,
  PerformanceEntry,
  ReactComponentEntry,
} from '@everkers/agent-eyes';

On this page