import { type OfficialModuleIdentity, type OfficialModuleKind, type OfficialModuleRuntimeError, type OfficialModuleRuntimeGate } from "./officialModuleRuntimeSurface.js";
export type OfficialModuleEventVisibility = "runtime" | "official-module" | "inspection" | "debug";
export type OfficialModuleEvent = {
    runtimeId: string;
    type: string;
    source: OfficialModuleIdentity;
    payload?: unknown;
    visibility: OfficialModuleEventVisibility;
    scopes: readonly string[];
    timestamp: number;
    governanceChecked: true;
    unsafeSideEffects: false;
};
export type OfficialModuleEventFilter = {
    runtimeId?: string;
    moduleKinds?: readonly OfficialModuleKind[];
    moduleIds?: readonly string[];
    eventTypes?: readonly string[];
    scopes?: readonly string[];
};
export type OfficialModuleEventSubscriber = {
    id: string;
    filter?: OfficialModuleEventFilter;
    onEvent?: (event: OfficialModuleEvent) => void;
};
export type OfficialModuleEventBusRequest = {
    runtimeId?: string;
    runtimeReady?: boolean;
    subscribers?: readonly OfficialModuleEventSubscriber[];
    governance?: OfficialModuleRuntimeGate;
    now?: () => number;
};
export type OfficialModuleEventPublishRequest = {
    runtimeId?: string;
    type?: string;
    source?: Partial<OfficialModuleIdentity>;
    payload?: unknown;
    visibility?: OfficialModuleEventVisibility;
    scopes?: readonly string[];
    governance?: OfficialModuleRuntimeGate;
};
export type OfficialModuleEventDelivery = {
    subscriberId: string;
    eventType: string;
    delivered: boolean;
};
export type OfficialModuleEventBusPublishResult = {
    ok: true;
    event: OfficialModuleEvent;
    deliveries: readonly OfficialModuleEventDelivery[];
    events: readonly string[];
} | {
    ok: false;
    error: OfficialModuleRuntimeError;
    events: readonly string[];
};
export type OfficialModuleEventBusSubscriptionResult = {
    ok: true;
    subscriberId: string;
    unsubscribe: () => void;
    events: readonly string[];
} | {
    ok: false;
    error: OfficialModuleRuntimeError;
    events: readonly string[];
};
export type OfficialModuleEventBus = {
    runtimeId: string;
    publish: (request: OfficialModuleEventPublishRequest) => OfficialModuleEventBusPublishResult;
    subscribe: (subscriber: OfficialModuleEventSubscriber) => OfficialModuleEventBusSubscriptionResult;
    snapshot: () => readonly OfficialModuleEvent[];
};
export type OfficialModuleEventBusResult = {
    ok: true;
    bus: OfficialModuleEventBus;
    events: readonly string[];
} | {
    ok: false;
    error: OfficialModuleRuntimeError;
    events: readonly string[];
};
export declare function createOfficialModuleEventBus(request?: OfficialModuleEventBusRequest): OfficialModuleEventBusResult;
