/**
 * Chat Service — facade over ChatV2Service.
 *
 * Phase 6 of the unified-chat-message-store spec
 * (`specs/2026-05-14-unified-chat-message-store.md`):
 * the legacy JSON-file storage at `~/.crewly/chat/` is retired.
 * All chat persistence and read paths now flow through the canonical
 * `ChatV2Service` (SQLite at `~/.crewly/chat.db`). This file remains
 * temporarily as a deprecation shim so the many legacy callers
 * (`chat.controller.ts`, `chat.gateway.ts`, `slack-orchestrator-bridge.ts`,
 * `notify-reconciliation.service.ts`, `message-replay.service.ts`,
 * `index.ts`) continue to compile and run while they are migrated to
 * call ChatV2Service directly. Each facade method translates between
 * the legacy `ChatMessage` / `ChatConversation` DTOs and chat-v2's
 * `ChatMessageDTO` / `ChatChannelDTO` so existing event subscribers
 * (chat.gateway.ts) see the same shapes they always have.
 *
 * @module services/chat/chat.service
 */
import { EventEmitter } from 'events';
import { ChatMessage, ChatConversation, ChatSender, ChatChannelType, SendMessageInput, SendMessageResult, ChatMessageFilter, ConversationFilter } from '../../types/chat.types.js';
export declare class ConversationNotFoundError extends Error {
    readonly conversationId: string;
    constructor(conversationId: string);
}
export declare class MessageValidationError extends Error {
    constructor(message: string);
}
export interface ChatServiceOptions {
    /** @deprecated Legacy filesystem path; ignored — storage is now SQLite. */
    chatDir?: string;
}
/**
 * Deprecated façade over ChatV2Service.
 *
 * Preserves the public surface of the original `ChatService` so the
 * remaining legacy callers compile unchanged. Internally every method
 * delegates to `ChatV2Service`. The original ~/.crewly/chat/*.json
 * storage layer has been removed.
 *
 * New code MUST NOT depend on this class; call `getChatV2Service()`
 * directly. Phase 6c of the spec deletes this file once all callers
 * are migrated.
 */
export declare class ChatService extends EventEmitter {
    private logger;
    private chatV2;
    constructor(_options?: ChatServiceOptions);
    initialize(): Promise<void>;
    isInitialized(): boolean;
    /**
     * Send a user message. Idempotency via legacy callers' own
     * metadata.clientMessageId when present.
     */
    sendMessage(input: SendMessageInput): Promise<SendMessageResult>;
    /**
     * Add an agent reply extracted from raw terminal output. The legacy
     * regex extraction (`[RESPONSE]` / `[CHAT_RESPONSE]` markers) is gone
     * — callers should pass already-clean content. Kept for source
     * compatibility with `chat.gateway.processTerminalOutput`, which has
     * no production callers post Phase 4 discovery.
     */
    addAgentMessage(conversationId: string, rawOutput: string, sender: ChatSender, metadata?: Record<string, unknown>): Promise<ChatMessage>;
    /**
     * Persist a pre-extracted markdown reply. Primary call site is the
     * PTY `[NOTIFY]` path in `chat.gateway.processNotifyMessage`.
     */
    addDirectMessage(conversationId: string, content: string, sender: ChatSender, metadata?: Record<string, unknown>): Promise<ChatMessage>;
    /**
     * Add a server-side system note (progress markers, errors, etc.).
     */
    addSystemMessage(conversationId: string, content: string, metadata?: Record<string, unknown>): Promise<ChatMessage>;
    private recordViaFacade;
    getMessages(filter: ChatMessageFilter): Promise<ChatMessage[]>;
    getMessageCount(filter: ChatMessageFilter): Promise<number>;
    getMessage(_conversationId: string, _messageId: string): Promise<ChatMessage | null>;
    updateMessageMetadata(_conversationId: string, messageId: string, metadataPatch: Record<string, unknown>): Promise<ChatMessage | null>;
    getMessagesWithPendingSlackDelivery(maxAgeMs: number): Promise<ChatMessage[]>;
    getConversations(_filter?: ConversationFilter): Promise<ChatConversation[]>;
    getConversation(id: string): Promise<ChatConversation | null>;
    createNewConversation(title?: string, idOverride?: string, _channelType?: ChatChannelType): Promise<ChatConversation>;
    updateConversationTitle(id: string, title: string): Promise<ChatConversation>;
    archiveConversation(id: string): Promise<void>;
    unarchiveConversation(id: string): Promise<void>;
    deleteConversation(id: string): Promise<void>;
    clearConversation(id: string): Promise<void>;
    getCurrentConversation(): Promise<ChatConversation | null>;
    emitTypingIndicator(conversationId: string, sender: ChatSender, isTyping: boolean): void;
    emitProgress(conversationId: string, text: string): void;
    getStatistics(): Promise<{
        totalConversations: number;
        activeConversations: number;
        archivedConversations: number;
        totalMessages: number;
    }>;
    /**
     * Generate a conversationId for a brand-new sendMessage call that
     * didn't supply one. Web-chat-style id; Slack callers always pass
     * their own slack-CHANNEL-TS identifier.
     */
    private synthesizeConversationId;
    /**
     * @deprecated Will be removed when the façade is retired.
     */
    ensureInitialized(): Promise<void>;
}
export declare function getChatService(options?: ChatServiceOptions): ChatService;
export declare function resetChatService(): void;
//# sourceMappingURL=chat.service.d.ts.map