import type { FunctionCall } from '@google/genai';
import { PolicyEngine } from '../policy/policy-engine.js';
import { MessageBusType, type MessageBusMessage } from './types.js';
import { ToolConfirmationOutcome, type ToolConfirmationPayload } from '../tools/tool-confirmation-types.js';
type MessageHandler<T extends MessageBusMessage = MessageBusMessage> = (message: T) => void;
/**
 * MessageBus provides event-driven communication for tool confirmations and policy decisions.
 * Uses EventEmitter for pub/sub pattern and integrates with PolicyEngine for authorization.
 */
export declare class MessageBus {
    private readonly emitter;
    private readonly policyEngine;
    private readonly debugMode;
    constructor(policyEngine: PolicyEngine, debugMode?: boolean);
    /**
     * Publishes a message to all subscribers of the message type.
     *
     * @param message - The message to publish
     */
    publish(message: MessageBusMessage): void;
    /**
     * Subscribes to messages of a specific type.
     *
     * @param type - The message type to subscribe to
     * @param handler - The handler function to call when a message is received
     * @returns Unsubscribe function
     */
    subscribe<T extends MessageBusMessage>(type: MessageBusType, handler: MessageHandler<T>): () => void;
    /**
     * Requests confirmation for a tool execution through the policy engine.
     * If policy allows, returns immediately. If policy asks user, publishes confirmation request.
     *
     * @param toolCall - The tool call to evaluate
     * @param args - The tool arguments
     * @param serverName - Optional MCP server name
     * @returns Promise<boolean> - true if approved, false if denied
     */
    requestConfirmation(toolCall: FunctionCall, args: Record<string, unknown>, serverName?: string): Promise<boolean>;
    /**
     * Responds to a confirmation request.
     *
     * @param correlationId - The correlation ID from the request
     * @param outcome - The ToolConfirmationOutcome to apply
     * @param payload - Optional payload for inline modifications
     * @param requiresUserConfirmation - Whether legacy UI should be used
     */
    respondToConfirmation(correlationId: string, outcome: ToolConfirmationOutcome, payload?: ToolConfirmationPayload, requiresUserConfirmation?: boolean): void;
    /**
     * Requests confirmation for OAuth bucket authentication.
     * Publishes a confirmation request and waits for user response.
     *
     * @param provider - The provider name (e.g., 'anthropic')
     * @param bucket - The bucket name (e.g., 'work@company.com')
     * @param bucketIndex - Current bucket index (1-based)
     * @param totalBuckets - Total number of buckets
     * @returns Promise<boolean> - true if approved, false if denied
     */
    requestBucketAuthConfirmation(provider: string, bucket: string, bucketIndex: number, totalBuckets: number): Promise<boolean>;
    /**
     * Responds to a bucket auth confirmation request.
     *
     * @param correlationId - The correlation ID from the request
     * @param confirmed - Whether the user confirmed
     */
    respondToBucketAuthConfirmation(correlationId: string, confirmed: boolean): void;
    /**
     * Removes all event listeners (for cleanup).
     */
    removeAllListeners(): void;
    /**
     * Returns the number of listeners for a specific message type.
     *
     * @param type - The message type
     * @returns Number of listeners
     */
    listenerCount(type: MessageBusType): number;
}
export {};
