export type TransportMeta = {
    qos?: 0 | 1 | 2;
    retain?: boolean;
} & Record<string, unknown>;
export type MessageHandler = (topic: string, payload: string, meta?: TransportMeta) => void;
/**
 * Brand marker for compile-time type safety.
 * Topics are strings at runtime, but branded types prevent mixing semantics.
 */
declare const __brand: unique symbol;
/**
 * ExactTopic - Topic for exact-match subscriptions (backbone/mailbox).
 * No wildcards allowed: must not contain '+' or '#'.
 *
 * Used for:
 * - Mailbox ingress: <realm>.$ingress.<shard>
 * - Internal reply topics: <realm>.$reply.<msgId>
 */
export type ExactTopic = string & {
    readonly [__brand]: 'ExactTopic';
};
/**
 * TopicFilter - Topic pattern for filter-based subscriptions (local bus).
 * May contain wildcards: '+' (single level) or '#' (multi-level).
 *
 * Used for:
 * - Local bus wildcard subscriptions: component.+.emits.#
 * - SubscriptionForwarder source patterns
 */
export type TopicFilter = string & {
    readonly [__brand]: 'TopicFilter';
};
/**
 * Check if a topic string contains wildcards.
 */
export declare function hasWildcards(topic: string): boolean;
/**
 * Create an ExactTopic from a string. Throws if the string contains wildcards.
 */
export declare function exactTopic(topic: string): ExactTopic;
/**
 * Create a TopicFilter from a string. This is always valid (wildcards allowed).
 */
export declare function topicFilter(filter: string): TopicFilter;
/**
 * Assert that a topic is exact (for runtime validation at boundaries).
 * Returns the topic cast as ExactTopic, or throws.
 */
export declare function assertExactTopic(topic: string, context?: string): ExactTopic;
/**
 * Transport port (Hexagonal Architecture).
 *
 * - publish: fire-and-forget
 * - subscribe: registers a handler and returns an unsubscribe function
 *
 * Notes:
 * - `meta` is optional and adapter-defined. The core protocol layer does not
 *   depend on it, but it allows transport adapters to preserve QoS/retain.
 *
 * SEMANTIC NOTE (Issue #4 from critique):
 * This interface accepts raw strings for backward compatibility.
 * New code should use ExactTransport or FilterTransport for type safety.
 */
export interface Transport {
    publish(topic: string, payload: string, meta?: TransportMeta): void;
    subscribe(topic: string, handler: MessageHandler): () => void;
    /** Observe all messages unconditionally (optional). */
    tap?(handler: MessageHandler): () => void;
}
/**
 * Transport that only supports exact-match subscriptions (no wildcards).
 *
 * Use for backbone transports where wildcards are forbidden:
 * - Each realm subscribes to its own mailbox topic only
 * - No fan-out or pattern matching on the backbone
 *
 * This interface provides compile-time safety against wildcard misuse.
 */
export interface ExactTransport {
    publish(topic: ExactTopic, payload: string, meta?: TransportMeta): void;
    subscribeExact(topic: ExactTopic, handler: MessageHandler): () => void;
}
/**
 * Transport that supports filter subscriptions (wildcards allowed).
 *
 * Use for local bus transports where wildcard subscriptions are useful:
 * - Component pattern matching
 * - Event fan-out
 *
 * Includes both exact and filter methods for flexibility.
 */
export interface FilterTransport extends ExactTransport {
    subscribeFilter(filter: TopicFilter, handler: MessageHandler): () => void;
}
/**
 * Extended transport interface with subscription flush capability.
 *
 * Some brokers have a delay between
 * subscribe() and SUBACK. Messages published during this window may be lost.
 *
 * flushSubscriptions() waits for all pending SUBACKs before resolving.
 */
export interface FlushableTransport extends Transport {
    /**
     * Wait for all pending subscription acknowledgments (SUBACK) to complete.
     * Resolves when all subscriptions are active on the broker.
     * Rejects if any subscription fails.
     */
    flushSubscriptions(): Promise<void>;
}
/**
 * ExactOnlyTransportDecorator - Wraps any Transport to enforce exact-match only.
 *
 * ARCHITECTURAL FIX (Issue #4 from critique):
 * Use this decorator to wrap backbone transports and ensure no wildcards leak through.
 * This provides runtime protection even when using the generic Transport interface.
 *
 * Usage:
 *   const backbone = new ExactOnlyTransportDecorator(innerTransport, 'backbone');
 *   // Will throw if anyone tries to subscribe with wildcards
 */
export declare class ExactOnlyTransportDecorator implements Transport {
    private readonly inner;
    private readonly name;
    constructor(inner: Transport, name?: string);
    publish(topic: string, payload: string, meta?: TransportMeta): void;
    subscribe(topic: string, handler: MessageHandler): () => void;
}
/**
 * Adapt a generic Transport to ExactTransport interface.
 * Adds runtime validation that topics are exact.
 */
export declare function asExactTransport(transport: Transport, name?: string): ExactTransport & Transport;
export {};
//# sourceMappingURL=base.d.ts.map