//#region src/propagation.d.ts /** * @deprecated No effect on provider wrappers. `propagateContext` is resolved * per instance: from the wrapper's own `propagateContext` option, or from the * `AIConfig` of the `AmplitudeAI` it wraps. Kept for backward compatibility. */ declare function setDefaultPropagateContext(enabled: boolean): void; /** @deprecated See {@link setDefaultPropagateContext}. */ declare function getDefaultPropagateContext(): boolean; /** * Resolve a provider wrapper's `propagateContext` flag without any * process-global state: an explicit option wins, otherwise inherit from the * wrapped `AmplitudeAI`'s config. A raw Amplitude client defaults to off. */ declare function resolvePropagateContext(explicit: boolean | undefined, amplitude: unknown): boolean; /** * Build propagation headers for an outbound call to a first-party service * you operate. The output includes the end-user ID (`x-amplitude-user-id`), * so never forward it to a third-party host; provider wrappers use * {@link providerPropagationHeaders} instead. */ declare function injectContext(headers?: Record): Record; /** * Propagation headers that are safe to send to a third-party LLM provider: * W3C `traceparent` plus the session and agent IDs. End-user and device IDs * are never included. Returns `null` when there is no active context or the * headers cannot be built; never throws. */ declare function providerPropagationHeaders(): Record | null; /** * Call a provider SDK method (`create(body, options?)`), passing propagation * headers through the SDK's request options rather than the JSON body. When * propagation is off or there is nothing to send, the method is called with * the body only, exactly as the caller would. */ declare function invokeWithPropagation(fn: (...args: unknown[]) => R, thisArg: unknown, params: Record, enabled: boolean, requestOptions?: Record): R; /** * Parse a W3C `traceparent` header and return its trace-id, or `null` when * the header is malformed, too long, uses version `ff`, or carries an * all-zero trace-id or parent-id. */ declare function parseTraceparent(value: unknown): string | null; /** * Validate a caller-supplied trace ID (e.g. an `x-trace-id` header). Accepts * a short token of letters, digits and `._:-` (covers W3C 32-hex trace-ids * and UUIDs) up to 64 characters; returns `null` for anything else. */ declare function normalizeTraceId(value: unknown): string | null; /** * Read propagation headers written by {@link injectContext}. * * Every value here is controlled by whoever sent the request. Only call this * on traffic from services you operate (e.g. an internal queue consumer), * never on requests that reach you from end users or the public internet — * otherwise a caller can choose the `userId` / `sessionId` their events are * attributed to. The trace ID is validated (W3C `traceparent`, else a short * `x-trace-id` token); other values longer than 256 characters or containing * control characters are dropped. */ declare function extractContext(headers: Record): Record; //#endregion export { extractContext, getDefaultPropagateContext, injectContext, invokeWithPropagation, normalizeTraceId, parseTraceparent, providerPropagationHeaders, resolvePropagateContext, setDefaultPropagateContext }; //# sourceMappingURL=propagation.d.ts.map