Preparing your workspace...

assistant-chat.tsx2.5k
utils.ts850
button.tsx720
Quick Actions
codmir
Docs
Discord
Get started
API
  • Introduction
  • Installation
  • Your First Project
  • Your First Agent
  • Overview
  • OverseerClient
  • Error Tracking
  • Session Replay
  • Incidents
  • Deployments
  • Orchestrator

Browser and desktop SDK client for error tracking, session replay, voice tracking, and incident creation

OverseerClient

The OverseerClient is the primary SDK for integrating Overseer into browser and desktop (Electron/Tauri) applications. It provides error tracking, session replay, voice command tracking, performance monitoring, and automatic incident creation for the self-healing loop.

Installation

import { OverseerClient, createOverseerClient, init } from "@codmir/overseer";

Initialization

init(config: OverseerClientConfig): OverseerClient

Creates and stores a global client instance. Use this for most applications.

import { init } from "@codmir/overseer";

const overseer = init({
  dsn: "https://api.codmir.com/overseer",
  service: "web-app",
  environment: "production",
  apiKey: "osk_...",
  projectId: "proj_abc123",

  // Sampling
  errorSampleRate: 1,
  replaySampleRate: 0.1,

  // Features
  enableReplay: true,
  enableVoiceTracking: true,
  enablePerformance: true,
  enableIncidents: true,

  // Privacy
  maskAllInputs: true,
  maskSelectors: [".sensitive", "[data-private]"],

  // Hooks
  beforeSend: (event) => {
    if (event.message.includes("ResizeObserver")) return null;
    return event;
  },
  onIncidentCreated: (incident) => {
    console.log(`Incident ${incident.code} created`);
  },
});

createOverseerClient(config: OverseerClientConfig): OverseerClient

Creates a standalone client instance without setting the global reference.

import { createOverseerClient } from "@codmir/overseer";

const client = createOverseerClient({
  dsn: "https://api.codmir.com/overseer",
  service: "desktop-app",
  environment: "production",
});

getClient(): OverseerClient | null

Returns the global client created by init(), or null if not initialized.

Configuration

OverseerClientConfig

PropertyTypeDefaultDescription
dsnstringrequiredAPI endpoint URL
servicestringrequiredService name (e.g., "web-app")
environmentstringrequiredEnvironment ("production", "staging", etc.)
releasestringundefinedBuild version / release tag
apiKeystringundefinedAPI key for authenticating with the ingest endpoint (osk_...)
projectIdstringundefinedProject ID for incident creation
errorSampleRatenumber1Error sampling rate (0-1)
replaySampleRatenumber0.1Session replay sampling rate (0-1)
replayOnErrorSampleRatenumber1Replay sample rate when an error occurs (0-1)
enableReplaybooleantrueEnable session replay recording
enableVoiceTrackingbooleantrueEnable voice command tracking
enablePerformancebooleanfalseEnable automatic Web Vitals tracking
enableIncidentsbooleantrueAuto-create incidents from errors
maskAllInputsbooleanfalseMask all input values in replay
maskSelectorsstring[][]CSS selectors to mask in replay
maxBatchSizenumber100Max events per flush batch
flushIntervalnumber30000Flush interval in milliseconds
beforeSend(event: ErrorEvent) => ErrorEvent | nullidentityHook to modify or drop events before sending
onIncidentCreated(incident: { id: string; code: string }) => voidundefinedCalled when an incident is created from an error

Error Tracking

captureError(error, options?): string | null

Captures an error and returns the event ID, or null if the event was sampled out or dropped by beforeSend.

captureError(
  error: Error | string,
  options?: {
    level?: "fatal" | "error" | "warning" | "info" | "debug";
    tags?: Record<string, string>;
    extra?: Record<string, unknown>;
  }
): string | null
try {
  await riskyOperation();
} catch (error) {
  overseer.captureError(error, {
    level: "error",
    tags: { module: "checkout" },
    extra: { cartId: "abc123" },
  });
}

captureMessage(message, level?): string | null

Captures a message event.

captureMessage(message: string, level?: "fatal" | "error" | "warning" | "info" | "debug"): string | null
overseer.captureMessage("User completed checkout", "info");

addBreadcrumb(breadcrumb): void

Adds a breadcrumb for context. Breadcrumbs are included with subsequent error events.

addBreadcrumb(breadcrumb: {
  type?: string;
  category?: string;
  message?: string;
  data?: Record<string, unknown>;
  level?: "fatal" | "error" | "warning" | "info" | "debug";
}): void
overseer.addBreadcrumb({
  type: "navigation",
  category: "route",
  message: "/dashboard",
  level: "info",
});

setUser(user): void

Sets user context for all subsequent events.

setUser(user: { id?: string; email?: string; username?: string; ip_address?: string } | undefined): void
overseer.setUser({
  id: "user_123",
  email: "[email protected]",
  username: "jdoe",
});

// Clear user on logout
overseer.setUser(undefined);

setTags(tags): void

Sets global tags included with all events.

overseer.setTags({ version: "2.1.0", region: "us-east-1" });

setExtra(extra): void

Sets extra context data included with all events.

overseer.setExtra({ featureFlags: { newCheckout: true } });

setConversationId(conversationId): void

Sets the conversation ID for correlating errors with AI chat sessions.

overseer.setConversationId("conv_abc123");

getConversationId(): string | null

Returns the current conversation ID.

Session Replay

startReplay(): string | null

Starts session replay recording. Returns the replay session ID, or null if replay could not start.

const replayId = overseer.startReplay();

stopReplay(): ReplaySession | null

Stops replay recording and returns the completed session.

const session = overseer.stopReplay();

isReplayActive(): boolean

Returns whether replay is currently recording.

getReplaySessionId(): string | null

Returns the current replay session ID, or null if not recording.

Chrome extension offloading: When the Codmir Chrome extension is installed, replay recording is automatically offloaded to the extension. The extension maintains a 15-second DVR buffer and flushes it on error. The client detects the extension via a DOM marker or custom event and stops its in-process recorder.

Voice Command Tracking

trackVoiceCommand(command, options): void

Tracks a voice command execution. Automatically adds a breadcrumb and queues the event for sending. If the command failed, a warning message is also captured.

trackVoiceCommand(
  command: string,
  options: {
    transcript: string;
    confidence: number;
    duration: number;
    result?: "success" | "failure" | "partial";
    errorMessage?: string;
    metadata?: Record<string, unknown>;
  }
): void
overseer.trackVoiceCommand("navigate", {
  transcript: "go to the dashboard",
  confidence: 0.95,
  duration: 1200,
  result: "success",
  metadata: { page: "dashboard" },
});

startVoiceSession(): void

Marks the beginning of a continuous voice session.

endVoiceSession(): VoiceCommand[]

Ends the voice session and returns all commands recorded during it.

isVoiceSessionActive(): boolean

Returns whether a voice session is currently active.

Performance Tracking

trackMetric(name, value, unit?, tags?): void

Tracks a custom performance metric.

trackMetric(name: string, value: number, unit?: string, tags?: Record<string, string>): void
overseer.trackMetric("api_latency", 142, "ms", { endpoint: "/api/users" });

timeOperation<T>(name, operation, tags?): Promise<T>

Times an async operation and records the duration as a metric.

const result = await overseer.timeOperation(
  "fetch_users",
  () => fetch("/api/users").then((r) => r.json()),
  { source: "dashboard" },
);

When enablePerformance is true, the client automatically tracks:

  • LCP (Largest Contentful Paint)
  • FID (First Input Delay)
  • CLS (Cumulative Layout Shift)
  • TTFB (Time to First Byte)
  • DOM Load and Page Load times

Lifecycle

flush(): Promise<void>

Immediately sends all queued events to the Overseer API. Error events are flushed immediately by default; other event types batch on the flushInterval.

await overseer.flush();

close(): Promise<void>

Stops replay, disconnects the performance observer, flushes remaining events, and cleans up timers.

await overseer.close();

Automatic Behaviors

The client automatically:

  1. Captures unhandled errors via window.onerror
  2. Captures unhandled promise rejections via unhandledrejection
  3. Tracks navigation via popstate events (breadcrumbs)
  4. Tracks clicks as UI breadcrumbs (element tag, id, class, inner text)
  5. Flushes on page unload via beforeunload
  6. Creates incidents from errors when enableIncidents is true (first occurrence per error group per session)
  7. Starts replay on error if not already recording, based on replayOnErrorSampleRate

Types

VoiceCommand

interface VoiceCommand {
  id: string;
  command: string;
  transcript: string;
  confidence: number;
  timestamp: Date;
  duration: number;
  result?: "success" | "failure" | "partial";
  errorMessage?: string;
  metadata?: Record<string, unknown>;
}

PerformanceMetric

interface PerformanceMetric {
  name: string;
  value: number;
  unit: string;
  timestamp: Date;
  tags?: Record<string, string>;
}
Open in ChatGPTOpen in ClaudeConnect MCP on CursorConnect MCP on WindsurfEdit on GitHub
codmir
Products
Desktop AppMobile AppIDE ExtensionAI AgentsOverseerVoice ModeCortex ProtocolHive MindGame Dev (Godat)PricingDownload
Solutions
AI Code AgentsCode ReviewError TrackingSelf-HealingDeploy TrackingAI Tracking SDKWorkflow AutomationTesting FrameworkTime TrackingVoice Control
Platform
ProjectsTickets & BoardsAgent MarketplaceIntegrationsTemplatesApp HubAdmin PanelAnalytics
Integrations
GitHubSlackDiscordVercelSentryRailwayLinearAll Integrations
Developers
DocumentationAPI ReferenceSDKCLIDeveloper PortalMarketplaceMCP ConnectorsWebhooksExamplesnpm Packages
Resources
BlogChangelogCommunityTutorialsGet StartedSupportStatusFeedback
Company
AboutCareersContact SalesKickstarterReferral Program
Legal
Terms of UsePrivacy PolicyEULATrademarkSecurity
Download on the App StoreGet it on Google Play

Codmir™ 2026. All rights reserved.

Free & open source SDK — Apache 2.0 License