/**
 * ObservabilityPort — cross-cutting telemetry for Vauban Integration Spine.
 *
 * Implements S0 §6 (ObservabilityPort, port #14): OpenTelemetry-compatible spans,
 * structured event logging, metrics, and graceful shutdown. Adapters emit to
 * Prometheus, Sentry, audit logs, or custom backends.
 *
 * Design: structured types only — no hard dependency on @opentelemetry/api.
 * Real OTel Spans satisfy the structural Span interface.
 *
 * Reference: S0 §6 type definition + createTracedBrainPort pattern in brain.ts
 */
// ─── Noop implementation (for tests, fallback, or offline mode) ──────────────
/**
 * NoopObservabilityPort — no-op implementation for tests or offline mode.
 * All calls are discarded; span operations succeed silently.
 */
export class NoopObservabilityPort {
    noopSpan = {
        setAttribute: () => { },
        recordException: () => { },
        setStatus: () => { },
        end: () => { },
    };
    startSpan(_name, _attrs) {
        return this.noopSpan;
    }
    recordEvent(_event) {
        // no-op
    }
    recordMetric(_metric) {
        // no-op
    }
    async flush() {
        // no-op
    }
}
// ─── Typed errors ────────────────────────────────────────────────────────────
export class ObservabilityError extends Error {
    cause;
    constructor(message, cause) {
        super(message);
        this.cause = cause;
        this.name = "ObservabilityError";
        Object.setPrototypeOf(this, new.target.prototype);
    }
}
export class ObservabilityFlushTimeoutError extends Error {
    timeoutMs;
    cause;
    constructor(timeoutMs, cause) {
        super(`Observability flush timed out after ${timeoutMs}ms`);
        this.timeoutMs = timeoutMs;
        this.cause = cause;
        this.name = "ObservabilityFlushTimeoutError";
        Object.setPrototypeOf(this, new.target.prototype);
    }
}
//# sourceMappingURL=observability.js.map