/** * Transport lifecycle span helpers. * * Tracks the full transport state machine: * TRANSPORT_INITIALIZING → TRANSPORT_AUTHENTICATING → TRANSPORT_CONNECTED * → TRANSPORT_SYNCING → TRANSPORT_DEGRADED → TRANSPORT_RECONNECTING * Terminal states: TRANSPORT_DISCONNECTED | TRANSPORT_TERMINAL_FAILURE * * One span per transport connection session. */ import type { Span, SpanAttributes } from '../types.js'; import type { RuntimeTracer } from '../tracer.js'; /** Context supplied when starting a transport lifecycle span. */ export interface TransportSpanContext { /** Transport ID. */ readonly transportId: string; /** Protocol name (e.g. 'websocket', 'stdio', 'http'). */ readonly protocol: string; /** Trace ID for cross-span correlation. */ readonly traceId: string; } /** Phase transitions recordable on a transport lifecycle span. */ export type TransportPhase = 'authenticating' | 'connected' | 'syncing' | 'degraded' | 'reconnecting'; /** Result context supplied when ending a transport lifecycle span. */ export interface TransportSpanEndContext { /** Final outcome of the transport lifecycle. */ readonly outcome: 'connected' | 'disconnected' | 'terminal_failure'; /** Disconnect or failure reason if applicable. */ readonly reason?: string | undefined; /** Whether a reconnect will be attempted. */ readonly willRetry?: boolean | undefined; /** Remote endpoint address when outcome is 'connected'. */ readonly endpoint?: string | undefined; } /** * Start a transport lifecycle span. * * @param tracer - RuntimeTracer instance. * @param ctx - Context from TRANSPORT_INITIALIZING event. */ export declare function startTransportSpan(tracer: RuntimeTracer, ctx: TransportSpanContext): Span; /** * Record a transport phase transition event. * * @param span - The active transport lifecycle span. * @param phase - The phase reached. * @param attrs - Optional additional attributes. */ export declare function recordTransportPhase(span: Span, phase: TransportPhase, attrs?: SpanAttributes): void; /** * End a transport lifecycle span. * * @param span - The span returned by `startTransportSpan`. * @param ctx - Transport lifecycle end context. */ export declare function endTransportSpan(span: Span, ctx: TransportSpanEndContext): void; //# sourceMappingURL=transport.d.ts.map