/**
 * Fleet telemetry envelope — agent-eval's portable observability shape.
 *
 * Designed so any consumer (Node CLI, Cloudflare Worker, Lambda, browser
 * extension) can emit structured rows describing one unit of work — a page
 * audit, a tool call, an evolve round, a full agent run — to a central sink.
 *
 * The schema is intentionally a strict superset of agent-eval's `Run` shape
 * so a future TraceStore adapter can promote envelopes into traces without
 * translation.
 */
declare const TELEMETRY_SCHEMA_VERSION = 1;
/** Discriminator for the unit of work this envelope describes. */
type TelemetryKind = 'agent-run' | 'design-audit-page' | 'design-audit-run' | 'design-evolve-round' | 'design-evolve-run' | 'gepa-trial' | 'gepa-generation' | 'tool-call' | 'judge-verdict' | 'custom';
interface TelemetryEnvelope {
    schemaVersion: typeof TELEMETRY_SCHEMA_VERSION;
    envelopeId: string;
    runId: string;
    timestamp: string;
    parentRunId?: string;
    source: TelemetrySource;
    model?: TelemetryModel;
    kind: TelemetryKind;
    ok: boolean;
    durationMs: number;
    data: Record<string, unknown>;
    metrics: Record<string, number>;
    tags?: Record<string, string>;
    error?: string;
}
interface TelemetrySource {
    /** Repo identity — basename of cwd plus git remote if discoverable. */
    repo: string;
    cwd: string;
    gitSha?: string;
    gitBranch?: string;
    cliVersion: string;
    /** What was invoked, e.g. `design-audit`, `bad run`, `gepa --target`. */
    invocation: string;
    /** Sanitised argv minus secrets. */
    argv?: string[];
    /**
     * Multi-tenant identity. Set when the consumer runs inside a hosted
     * product so a fleet rollup can group by tenant without leaking customer
     * URLs or PII.
     */
    tenantId?: string;
    /** Optional sub-tenant identity (project, suite, walkthrough, customer). */
    customerId?: string;
    /** SHA-256 (12 hex) of the API key used to authenticate this run, when applicable. */
    apiKeyHash?: string;
}
interface TelemetryModel {
    provider: string;
    name: string;
    /** SHA-256 (12 hex chars) of the prompt(s) used. */
    promptHash?: string;
    /** SHA-256 (12 hex chars) of the composed rubric body, if applicable. */
    rubricHash?: string;
}

/**
 * Workers-safe telemetry sinks — only `fetch` and pure JS. No `fs`, no
 * `child_process`. Safe to import from a Cloudflare Worker, Lambda, edge
 * function, or browser extension.
 *
 * For Node-only file persistence, import from '@tangle-network/agent-eval/telemetry/file'.
 */

interface TelemetrySink {
    emit(envelope: TelemetryEnvelope): Promise<void> | void;
    close?(): Promise<void> | void;
}
/** Best-effort POST to a remote collector. Fire-and-forget; never throws. */
declare class HttpTelemetrySink implements TelemetrySink {
    private readonly endpoint;
    private readonly bearer?;
    private inflight;
    constructor(endpoint: string, bearer?: string | undefined);
    emit(envelope: TelemetryEnvelope): void;
    close(): Promise<void>;
}
/** Fanout to multiple sinks — failures in one do not affect others. */
declare class FanoutTelemetrySink implements TelemetrySink {
    private readonly sinks;
    constructor(sinks: TelemetrySink[]);
    emit(envelope: TelemetryEnvelope): void;
    close(): Promise<void>;
}
/** No-op sink — used when telemetry is explicitly disabled. */
declare class NullTelemetrySink implements TelemetrySink {
    emit(): void;
}
/** In-memory sink — useful for tests + downstream adapters. */
declare class InMemoryTelemetrySink implements TelemetrySink {
    readonly envelopes: TelemetryEnvelope[];
    emit(envelope: TelemetryEnvelope): void;
    clear(): void;
}

export { FanoutTelemetrySink as F, HttpTelemetrySink as H, InMemoryTelemetrySink as I, NullTelemetrySink as N, type TelemetryKind as T, type TelemetryModel as a, type TelemetrySource as b, type TelemetrySink as c, TELEMETRY_SCHEMA_VERSION as d, type TelemetryEnvelope as e };
