import { type Span } from "@opentelemetry/api";
import type { SpanOptions } from "../types/index.js";
export declare function withSpan<T>(options: SpanOptions, fn: (span: Span) => Promise<T>): Promise<T>;
export declare function withClientSpan<T>(options: Omit<SpanOptions, "kind">, fn: (span: Span) => Promise<T>): Promise<T>;
/**
 * Span wrapper for streaming operations.
 *
 * Unlike {@link withSpan}, which ends the span when `fn` resolves, this
 * helper extends the span's lifetime until the **consumer** of the returned
 * iterable reaches end-of-stream (success), throws (error), or aborts.
 *
 * Required for any operation whose result is a producer (`StreamResult`,
 * `AsyncIterable`-returning function, etc.) — ending the span on `fn`
 * resolution would capture only the setup phase and report zero tokens /
 * meaningless duration.
 *
 * @param options       Span options (name, tracer, attributes, kind).
 * @param fn            Callback that produces the result. Must NOT depend on
 *                      the iterable being consumed before returning.
 * @param getIterable   Selector that picks the `AsyncIterable` out of the
 *                      result for wrapping.
 * @param setIterable   Setter that returns a new result with the iterable
 *                      replaced by the wrapped (span-lifetime-extending)
 *                      iterable. Should be a pure function — clone the
 *                      result rather than mutating in place.
 *
 * @example
 * ```ts
 * return withStreamSpan(
 *   { name: "neurolink.provider.stream", tracer, attributes: {...} },
 *   async () => this.executeStreamInner(options),
 *   (r) => r.stream,
 *   (r, wrapped) => ({ ...r, stream: wrapped }),
 * );
 * ```
 */
export declare function withStreamSpan<TResult, TChunk>(options: SpanOptions, fn: (span: Span) => Promise<TResult>, getIterable: (result: TResult) => AsyncIterable<TChunk>, setIterable: (result: TResult, wrapped: AsyncGenerator<TChunk>) => TResult): Promise<TResult>;
/** Convenience CLIENT-kind alias matching `withClientSpan`. */
export declare function withClientStreamSpan<TResult, TChunk>(options: Omit<SpanOptions, "kind">, fn: (span: Span) => Promise<TResult>, getIterable: (result: TResult) => AsyncIterable<TChunk>, setIterable: (result: TResult, wrapped: AsyncGenerator<TChunk>) => TResult): Promise<TResult>;
