export declare const TRACEPARENT_HEADER = "traceparent"; export type Traceparent = { version: string; traceId: string; parentId: string; flags: string; }; /** A `traceparent` header value parsed strictly, or null: malformed, version `ff`, or an all-zero * trace-id or parent-id is no trace at all (the spec: such a header is ignored). */ export declare function parseTraceparent(value: unknown): Traceparent | null; /** The value itself when it is a valid traceparent (normalized: trimmed), else undefined. */ export declare function validTraceparent(value: unknown): string | undefined; /** Run `fn` with `traceparent` as the request's trace context; an invalid value runs `fn` outside any. */ export declare function runWithTraceparent(traceparent: string | undefined, fn: () => T): T; /** The trace context of the request being handled, when it carried a valid traceparent. */ export declare function currentTraceparent(): string | undefined; /** Run `fn` inside the trace context `request` carries (its `traceparent` header), if any. */ export declare function runWithRequestTrace(request: Request, fn: () => T): T; /** A new trace's `traceparent` (version 00, a fresh trace-id and parent-id, sampled): for a request that carried none, * so what it causes can be told apart and joined to it. */ export declare function newTraceparent(): string; /** * The `traceparent` an outbound delivery carries: a CHILD of its cause — the same trace-id and * flags, a new parent-id — so the receiving handler continues the cause's trace. The cause is the * given traceparent, or an entry's recorded one, or (omitted) the trace context of the request * being handled. No valid cause, no traceparent: a delivery never invents a trace. */ export declare function traceparentForDelivery(cause?: string | { traceparent?: unknown; } | null): string | undefined; /** `traceparentForDelivery` as headers to spread into a delivery's own: `{ traceparent }` or `{}`. */ export declare function deliveryTraceHeaders(cause?: string | { traceparent?: unknown; } | null): Record;