/** * Plugin lifecycle span helpers. * * Tracks the full plugin state machine: * PLUGIN_DISCOVERED → PLUGIN_LOADING → PLUGIN_LOADED → PLUGIN_ACTIVE * Terminal states: PLUGIN_ERROR | PLUGIN_UNLOADING → PLUGIN_DISABLED * * One span per plugin lifecycle: starts on PLUGIN_DISCOVERED, ends on terminal state. */ import type { Span, SpanAttributes } from '../types.js'; import type { RuntimeTracer } from '../tracer.js'; /** Context supplied when starting a plugin lifecycle span. */ export interface PluginSpanContext { /** Plugin ID (unique identifier). */ readonly pluginId: string; /** File system path to the plugin. */ readonly path: string; /** Plugin version string. */ readonly version: string; /** Trace ID for cross-span correlation. */ readonly traceId: string; } /** Phase transitions that can be recorded on a plugin lifecycle span. */ export type PluginPhase = 'loading' | 'loaded' | 'active' | 'degraded' | 'unloading'; /** Result context supplied when ending a plugin lifecycle span. */ export interface PluginSpanEndContext { /** Final outcome of the plugin lifecycle. */ readonly outcome: 'active' | 'error' | 'disabled'; /** Error description when outcome is 'error'. */ readonly error?: string | undefined; /** Reason for disabling when outcome is 'disabled'. */ readonly reason?: string | undefined; /** Capabilities registered by the plugin (populated on 'active'). */ readonly capabilities?: string[] | undefined; } /** * Start a plugin lifecycle span. * * @param tracer - RuntimeTracer instance. * @param ctx - Context from PLUGIN_DISCOVERED event. */ export declare function startPluginSpan(tracer: RuntimeTracer, ctx: PluginSpanContext): Span; /** * Record a plugin phase transition event on the active span. * * @param span - The active plugin lifecycle span. * @param phase - The phase reached. * @param attrs - Optional additional attributes for this phase. */ export declare function recordPluginPhase(span: Span, phase: PluginPhase, attrs?: SpanAttributes): void; /** * End a plugin lifecycle span. * * @param span - The span returned by `startPluginSpan`. * @param ctx - Plugin lifecycle end context. */ export declare function endPluginSpan(span: Span, ctx: PluginSpanEndContext): void; //# sourceMappingURL=plugin.d.ts.map