import { DomainBridge } from './domain-bridge.js';
export { DomainBridge } from './domain-bridge.js';
/**
 * Create and attach domain instrumentation to a RuntimeEventBus.
 *
 * Subscribes to all domain channels (plugin, mcp, transport, task, agent,
 * permission, session, compaction) and creates OTel spans for each
 * lifecycle state machine transition.
 *
 * @param tracer - The RuntimeTracer to use for span creation.
 * @param bus - The RuntimeEventBus to subscribe to.
 * @returns An InstrumentationHandle for cleanup and cascade recording.
 */
export function createInstrumentation(tracer, bus) {
    const bridge = new DomainBridge(tracer);
    const detach = bridge.attach(bus);
    return {
        detach,
        recordCascade: (event, traceId) => bridge.recordCascade(event, traceId),
    };
}
