import type { AgenticActivityEvents } from './ai-activity-channel';
/**
 * Configuration for {@link AgenticActivityBus}.
 *
 * @beta
 */
export interface AgenticActivityBusConfig {
    /** Events that should also be forwarded via BroadcastChannel to other tabs. */
    crossTabEvents?: (keyof AgenticActivityEvents)[];
    /** BroadcastChannel name. Only used when crossTabEvents is non-empty. */
    channelName?: string;
    /**
     * Lazy alternative to {@link AgenticActivityBusConfig.channelName}: called the first
     * time a cross-tab channel is actually needed, in a browser only. Deferring the name
     * computation keeps side effects (e.g. `sessionStorage` reads) out of module-eval and
     * off the non-browser path. Ignored if `channelName` is also set.
     */
    channelNameFactory?: () => string;
}
/**
 * Minimal activity-bus surface the drivers depend on. `ChatDriver`/`OrchestratingDriver`
 * only ever *publish* — accepting this narrow interface (rather than importing the module
 * singleton) lets a headless/server or unit-test host omit the bus entirely, so no live
 * `BroadcastChannel` is ever opened on that path. See {@link NOOP_ACTIVITY_BUS}.
 *
 * @beta
 */
export interface ActivityBus {
    publish<K extends keyof AgenticActivityEvents>(type: K, detail: AgenticActivityEvents[K]): void;
}
/**
 * No-op {@link ActivityBus}. The default when no bus is injected (Node, tests, headless
 * server use) — publishing goes nowhere and nothing is left open to tear down.
 *
 * @beta
 */
export declare const NOOP_ACTIVITY_BUS: ActivityBus;
/**
 * Typed in-process event bus for AI assistant activity events.
 *
 * Dispatches events synchronously to all local subscribers in the same JS module instance
 * (i.e. the same browser tab). Events listed in `crossTabEvents` are additionally forwarded
 * via a shared `BroadcastChannel` so that other tabs on the same origin receive them.
 *
 * @remarks
 * The pre-instantiated {@link agenticActivityBus} singleton covers all platform use cases.
 * App developers can extend the event map using TypeScript declaration merging on
 * {@link AgenticActivityEvents} and subscribe/publish custom events without any platform changes.
 *
 * @beta
 */
export declare class AgenticActivityBus {
    private readonly subscribers;
    private readonly crossTabEvents;
    private readonly channelNameFactory?;
    private channel?;
    private channelInitialised;
    /**
     * @param config - Optional configuration. Omit to create an in-memory-only bus.
     * @beta
     */
    constructor(config?: AgenticActivityBusConfig);
    /**
     * Lazily open the cross-tab `BroadcastChannel` on first use. Deferred (rather than
     * created in the constructor) so that importing this module, or constructing the bus
     * off-browser (Node, tests, headless server), never opens a live channel or reads
     * `sessionStorage` — both would keep a Node event loop alive and hang the process.
     * Cross-tab forwarding is inherently browser-only, so channel creation is gated on a
     * browser environment; elsewhere the bus stays purely in-process.
     */
    private ensureChannel;
    /**
     * Subscribe to an event. Returns an unsubscribe function — call it in
     * `disconnectedCallback` to avoid memory leaks.
     *
     * @beta
     */
    subscribe<K extends keyof AgenticActivityEvents>(type: K, handler: (detail: AgenticActivityEvents[K]) => void): () => void;
    /**
     * Publish an event to all local subscribers and, if configured, to other tabs
     * via BroadcastChannel.
     *
     * @beta
     */
    publish<K extends keyof AgenticActivityEvents>(type: K, detail: AgenticActivityEvents[K]): void;
    /**
     * Add an event type to the cross-tab forwarding set at runtime.
     * Must be called before the first {@link AgenticActivityBus.publish} of that event type.
     *
     * @beta
     */
    addCrossTabEvent(type: keyof AgenticActivityEvents): void;
    /**
     * Close the underlying BroadcastChannel. Call once on application teardown if needed.
     *
     * @beta
     */
    close(): void;
    private notifyLocal;
}
/**
 * Pre-instantiated singleton event bus for AI assistant activity.
 *
 * - `halo-start` / `halo-stop` are forwarded via a tab-scoped `BroadcastChannel` so that
 *   popout windows opened from this tab show halo animations, while remaining isolated from
 *   unrelated tabs on the same origin (tab-scoped channel name).
 * - `tool-loop-start` / `tool-loop-end` are cross-tab for the same reason: they describe the
 *   assistant's lifecycle (a turn beginning / ending), and the most common subscribers
 *   (workspace transitions, post-turn deferred recomputation, UI gates tied to the assistant
 *   being idle) need the event regardless of whether the user is interacting with the chat
 *   in the main tab or a popout window. Tab-local-only telemetry can subscribe and filter.
 * - `chat-popout` / `chat-popin` are in-memory only — they must only affect the tab where the
 *   user clicked.
 *
 * @beta
 */
export declare const agenticActivityBus: AgenticActivityBus;
//# sourceMappingURL=ai-activity-bus.d.ts.map