import type { PostHog } from 'posthog-node'; import type { BeforeSendFn, Event, McpEvent } from '../types'; import { type LoggerFn } from './logger'; import { type PostHogCaptureEvent } from './posthog-events'; /** Per-event toggles consulted by the sink when fanning out an event. */ export interface McpCaptureOptions { enableExceptionAutocapture: boolean; /** Inspect/modify/drop hook applied to each fanned-out payload before capture. */ beforeSend?: BeforeSendFn; } /** * Runs an MCP event through the full transform: sanitize → truncate → fan out * into the `$mcp_*` / `$exception` capture payloads → `beforeSend`. Returns * `null` (and logs) if a transform stage throws, so the event is dropped rather * than partially sent. Individual payloads dropped by `beforeSend` are filtered * out of the returned `captures`. * * This is the single source of truth for the pipeline — both {@link McpEventSink} * and the test harness call it, so tests assert on exactly the payloads that * reach `posthog.capture()`. */ export declare function processMcpEvent(event: McpEvent, options: McpCaptureOptions, logger?: LoggerFn): Promise<{ event: Event; captures: PostHogCaptureEvent[]; } | null>; /** * Wraps a user-supplied `posthog-node` client: runs every MCP event through * {@link processMcpEvent} and hands each surviving payload to `posthog.capture()`. * * The SDK does not own the client lifecycle — the host application constructs * the `PostHog` instance and is responsible for `shutdown()` (matching * `@posthog/ai`). */ export declare class McpEventSink { private readonly posthog; private readonly logger; constructor(posthog: PostHog, logger?: LoggerFn); /** * Errors at any stage are logged and the event is dropped, never re-thrown * into tool code. */ capture(event: McpEvent, options: McpCaptureOptions): Promise; } //# sourceMappingURL=sink.d.ts.map