import { Cause } from 'effect'; import { LogRecord } from '@voltro/logger'; import { Subject } from '@voltro/protocol'; import { VoltroPlugin } from '@voltro/protocol'; export declare interface Breadcrumb { /** Unix SECONDS (Sentry breadcrumb convention). */ readonly timestamp: number; readonly level: 'debug' | 'info' | 'warning' | 'error' | 'fatal'; readonly category?: string; readonly message: string; readonly data?: Record; } declare interface BreadcrumbRing { /** Record a log line under its trace. */ readonly add: (traceId: string, record: LogRecord) => void; /** Return + REMOVE a trace's breadcrumbs (chronological). */ readonly take: (traceId: string) => ReadonlyArray; readonly drop: (traceId: string) => void; readonly size: () => number; } declare interface BreadcrumbRingOptions { readonly maxPerTrace?: number; readonly maxTraces?: number; readonly ttlMs?: number; } declare interface CaptureContext { readonly tag: string; readonly kind: string; readonly subject: Subject; readonly traceId: string; readonly spanId?: string; } export declare const captureToSentry: (sentry: SentryLike, cause: Cause.Cause, ctx: CaptureContext, breadcrumbs: ReadonlyArray) => void; /** Unwrap an Effect `Cause` to the underlying error value (Error | tagged * error | defect). `Cause.squash` returns the most informative throwable. */ export declare const causeToError: (cause: Cause.Cause) => unknown; export declare const makeBreadcrumbRing: (opts?: BreadcrumbRingOptions, now?: () => number) => BreadcrumbRing; export declare const parseDsn: (dsn: string | undefined) => SentryDsn | null; declare interface SentryDsn { readonly protocol: string; readonly publicKey: string; readonly host: string; readonly projectId: string; } /** Extra `Sentry.init` options passed through verbatim — the escape hatch for * everything the first-class options don't cover: `beforeSend` / * `beforeBreadcrumb` (PII/event scrubbing), `ignoreErrors`, error * `sampleRate`, `maxValueLength`, … Structural (not `NodeOptions`) so * `@sentry/node` stays an optional dependency. * * Merge contract: the bag is spread FIRST, then the plugin's own keys — so * the plugin stays authoritative for everything it manages (`dsn`, * `skipOpenTelemetrySetup`, `tracesSampleRate`, and `environment` / * `release` / `profilesSampleRate` when set). `integrations` is the one * exception: user integrations are APPENDED to the plugin's own, never * replacing them. */ export declare interface SentryInitOverrides { /** Extra Sentry integrations, appended AFTER the plugin's own. */ readonly integrations?: ReadonlyArray; readonly [key: string]: unknown; } export declare interface SentryLike { withScope(callback: (scope: SentryScopeLike) => void): unknown; captureException(exception: unknown): unknown; } export declare const sentryPlugin: (options?: SentryPluginOptions) => VoltroPlugin; export declare interface SentryPluginOptions { /** Sentry DSN. Default `SENTRY_DSN` env. Without a valid DSN the plugin is a no-op. */ readonly dsn?: string; /** `environment` tag (Sentry env). Default `SENTRY_ENVIRONMENT` env. */ readonly environment?: string; /** Release identifier (Sentry release health + source maps). Default `SENTRY_RELEASE` env. */ readonly release?: string; /** Performance-trace sample rate (0..1). Default 1.0. Only relevant with `traces`. */ readonly tracesSampleRate?: number; /** Route the framework's OTel spans to Sentry as transactions. Default false * (errors + breadcrumbs only — no performance traces). */ readonly traces?: boolean; /** Continuous CPU profiling via @sentry/profiling-node. Default false. */ readonly profiling?: boolean; /** Profile sample rate (0..1) when `profiling`. Default 1.0. */ readonly profilesSampleRate?: number; /** Max breadcrumbs retained per trace. Default 50. */ readonly maxBreadcrumbs?: number; /** Disambiguates multiple instances. */ readonly name?: string; /** Escape hatch: extra `Sentry.init` options (`beforeSend`, `ignoreErrors`, * `sampleRate`, extra `integrations`, …). Plugin-managed keys win; user * `integrations` are appended. See {@link SentryInitOverrides}. */ readonly init?: SentryInitOverrides; } declare interface SentryScopeLike { setContext(key: string, context: Record | null): unknown; setTag(key: string, value: string): unknown; addBreadcrumb(breadcrumb: Breadcrumb): unknown; } export declare const toBreadcrumb: (r: LogRecord) => Breadcrumb; export { }