import type { LanguageModel } from 'ai';
import type { TelemetryCollector, OperationMetricSample } from './adapter';
import type { PostHogLLMConfig, PostHogTracingOptions } from './posthog-types';
export type { PostHogClient, PostHogLLMConfig, PostHogTracingOptions, } from './posthog-types';
/**
 * Wrap a Vercel AI SDK LanguageModel with PostHog LLM tracing.
 *
 * Requires `@posthog/ai` and `posthog-node` to be installed as peer deps.
 * Automatically captures `$ai_generation` events for every LLM call,
 * including token usage, latency, cost, input/output, and tool metadata.
 *
 * These events power PostHog's LLM Analytics dashboard (Traces, Generations)
 * and are the basis for server-side Evaluations.
 *
 * @param model - AI SDK LanguageModel to wrap
 * @param config - PostHog configuration
 * @param overrides - Per-call tracing option overrides
 * @returns Wrapped LanguageModel that auto-reports to PostHog
 *
 * @example
 * ```typescript
 * import { createPostHogTracedModel } from '@contractspec/lib.ai-agent/telemetry/posthog';
 *
 * const model = await createPostHogTracedModel(
 *   anthropic('claude-sonnet-4-20250514'),
 *   { apiKey: process.env.POSTHOG_API_KEY },
 *   { posthogDistinctId: 'user_123' },
 * );
 * ```
 */
export declare function createPostHogTracedModel(model: LanguageModel, config: PostHogLLMConfig, overrides?: PostHogTracingOptions): Promise<LanguageModel>;
/**
 * PostHog-backed telemetry collector.
 *
 * Implements the existing TelemetryCollector interface so it integrates
 * seamlessly with trackAgentStep(). Each OperationMetricSample is captured
 * as a PostHog $ai_generation event, bridging ContractSpec's evolution
 * engine with PostHog's LLM Analytics dashboard.
 *
 * @example
 * ```typescript
 * const collector = createPostHogTelemetryCollector({
 *   apiKey: process.env.POSTHOG_API_KEY,
 *   defaults: { posthogDistinctId: 'system' },
 * });
 * ```
 */
export declare class PostHogTelemetryCollector implements TelemetryCollector {
    private phClient;
    private readonly config;
    private initPromise;
    constructor(config: PostHogLLMConfig);
    collect(sample: OperationMetricSample): Promise<void>;
    /** Shut down the PostHog client (flushes pending events). */
    shutdown(): Promise<void>;
    private getClient;
}
/** Create a PostHog-backed telemetry collector. */
export declare function createPostHogTelemetryCollector(config: PostHogLLMConfig): PostHogTelemetryCollector;
/**
 * Composite telemetry collector that forwards samples to multiple collectors.
 *
 * Useful when you want both PostHog LLM Analytics and the existing
 * evolution engine to receive the same telemetry data.
 *
 * @example
 * ```typescript
 * const composite = createCompositeTelemetryCollector([
 *   evolutionCollector,
 *   createPostHogTelemetryCollector({ apiKey: '...' }),
 * ]);
 * ```
 */
export declare class CompositeTelemetryCollector implements TelemetryCollector {
    private readonly collectors;
    constructor(collectors: TelemetryCollector[]);
    collect(sample: OperationMetricSample): Promise<void>;
}
/** Create a composite telemetry collector. */
export declare function createCompositeTelemetryCollector(collectors: TelemetryCollector[]): CompositeTelemetryCollector;
