/**
 * Module: dialog
 *
 * Provides the `Dialog` object for orchestrating conversations:
 * - Tracks messages, agent identity, optional askerDialog/sideDialog relationships
 * - Receivers for streaming LLM output and tool results
 * - Helpers for spawning sideDialogs and prompting human input
 * - Persistence support for dialog state and message history
 *
 * Architecture (Phase 2):
 * - `Dialog` - Abstract base class for all dialogs
 * - `MainDialog` - Main dialog with sideDialog registry
 * - `SideDialog` - SideDialog with main dialog reference and dynamic askerDialog resolution
 */
import type { ContextHealthSnapshot } from '@longrun-ai/kernel/types/context-health';
import type { DialogEvent, NativeToolCallPayload, ReminderContent, WebSearchCallAction, WebSearchCallSource } from '@longrun-ai/kernel/types/dialog';
import type { DialogCalleeReplyTarget, DialogQueuedDeferredQ4HAnswerState, DialogQueuedPromptState, DialogQueuedUserGenerationBoundaryState, DialogRunControlSpec, DialogRuntimePrompt, DialogRuntimeSideDialogPrompt, DialogUserPrompt, DriveIntent } from '@longrun-ai/kernel/types/drive-intent';
import type { LanguageCode } from '@longrun-ai/kernel/types/language';
import type { ActiveCalleesFile, CalleeCourseNumber, CalleeGenerationSeqNumber, CallSiteCourseNo, CallSiteGenseqNo, DialogAskerStackState, DialogLatestFile, DialogMetadataFile, DialogNextStepTrigger, HumanQuestion, ProviderData, ReasoningPayload, TellaskCallRecordName, TellaskReplyDirective } from '@longrun-ai/kernel/types/storage';
import { ChatMessage, FuncResultMsg, TellaskCarryoverMsg, TellaskResultMsg } from './llm/client';
import type { ToolResultImageIngest, UserImageIngest } from './llm/gen';
import { type SharedReminderTarget } from './shared-reminders';
import type { JsonValue } from './tool';
import { Reminder, ReminderOptions, ReminderOwner } from './tool';
export declare class InvalidReminderIndexError extends Error {
    readonly index: number;
    readonly total: number;
    constructor(index: number, total: number);
}
type NewCourseHookResult = {
    kind: 'continue';
    prompt: DialogRuntimePrompt;
} | {
    kind: 'reject';
    errorText: string;
};
type NewCourseHook = (args: {
    dialog: Dialog;
    prompt: DialogRuntimePrompt;
    runControl?: DialogRunControlSpec;
}) => Promise<NewCourseHookResult>;
export declare class DialogID {
    readonly selfId: string;
    readonly rootId: string;
    constructor(selfId: string, rootId?: string);
    key(): string;
    valueOf(): string;
    /**
     * Pretty print representation for debugging and display
     */
    toString(): string;
    /**
     * Check equality with another DialogID
     */
    equals(other: DialogID): boolean;
    /**
     * Generate hash code for Map/Set usage
     */
    hashCode(): string;
}
/**
 * Phase 6: Active callee dispatch record.
 * Tracks a sideDialog that has been dispatched but not yet completed.
 */
export interface ActiveCalleeDispatch {
    calleeDialogId: DialogID;
    createdAt: string;
    mentionList?: string[];
    tellaskContent: string;
    targetAgentId: string;
    callId: string;
    callSiteCourse: CallSiteCourseNo;
    callSiteGenseq: CallSiteGenseqNo;
    callType: 'A' | 'B' | 'C';
    sessionSlug?: string;
}
/**
 * Phase 6: SideDialog response record for Type A sideDialog supply mechanism.
 * Tracks the response from a completed sideDialog.
 */
export interface SideDialogResponse {
    sideDialogId: DialogID;
    response: string;
    completedAt: string;
    callType: 'A' | 'B' | 'C';
}
export declare function scheduleGlobalDialogMutexCleanupForRoot(rootId: string): void;
/**
 * Common dialog initialization parameters (shared between MainDialog and SideDialog)
 */
export interface DialogInitParams {
    taskDocPath: string;
    agentId: string;
    initialState?: {
        messages?: ChatMessage[];
        reminders?: Reminder[];
        currentCourse?: number;
        createdAt?: string;
        updatedAt?: string;
        contextHealth?: ContextHealthSnapshot;
        pendingRuntimePrompt?: DialogRuntimePrompt;
    };
}
export type VisibleReminderTarget = Readonly<{
    source: 'dialog';
    index: number;
    reminder: Reminder;
}> | Readonly<{
    source: 'runtime';
    index: number;
    reminder: Reminder;
    target: SharedReminderTarget;
}>;
/**
 * Assignment from askerDialog for sideDialogs
 */
export interface AssignmentFromAsker {
    callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
    mentionList?: string[];
    tellaskContent: string;
    originMemberId: string;
    askerDialogId: string;
    callId: string;
    callSiteCourse: CallSiteCourseNo;
    callSiteGenseq: CallSiteGenseqNo;
    collectiveTargets?: string[];
    effectiveFbrEffort?: number;
}
export declare function buildSideDialogAskerStack(args: {
    askerDialogId: string;
    assignment: AssignmentFromAsker;
}): DialogAskerStackState;
export declare function buildSideDialogAssignmentPromptMeta(sideDialog: SideDialog): Pick<DialogRuntimeSideDialogPrompt, 'tellaskReplyDirective' | 'calleeDialogReplyTarget'>;
/**
 * Abstract base class for all dialog types.
 * Contains common properties and methods shared between MainDialog and SideDialog.
 */
export declare abstract class Dialog {
    readonly dlgStore: DialogStore;
    readonly taskDocPath: string;
    readonly id: DialogID;
    readonly agentId: string;
    readonly reminders: Reminder[];
    readonly msgs: ChatMessage[];
    protected _currentCourse: number;
    protected _remindersVer: number;
    protected _activeGenSeq?: number;
    protected _activeGenCourse?: number;
    protected _createdAt: string;
    protected _updatedAt: string;
    protected _uiLanguage: LanguageCode;
    protected _lastUserLanguageCode: LanguageCode;
    protected _lastContextHealth?: ContextHealthSnapshot;
    protected _lastContextHealthGenseq?: number;
    protected _queuedPrompts: DialogQueuedPromptState[];
    protected _driveIntents: DriveIntent[];
    protected _activeRunControlSpec?: DialogRunControlSpec;
    protected _newCourseHook?: NewCourseHook;
    protected _driveIntentMode: 'legacy' | 'kernel';
    protected _coursePrefixMsgs: ChatMessage[];
    protected _courseRuntimeNoticeMsgs: ChatMessage[];
    protected _generationStarted: boolean;
    protected _generationStartedGenseq: number;
    protected _activeCalleeDialogIds: DialogID[];
    protected _suspensionState: 'active' | 'suspended' | 'resumed';
    diligencePushRemainingBudget: number;
    disableDiligencePush: boolean;
    private readonly _mutex;
    protected _currentCallId: string | null;
    constructor(dlgStore: DialogStore, taskDocPath: string, id: DialogID | undefined, agentId: string, initialState?: DialogInitParams['initialState']);
    setLastContextHealth(snapshot: ContextHealthSnapshot): void;
    getLastContextHealth(): ContextHealthSnapshot | undefined;
    getLastContextHealthGenseq(): number | undefined;
    get remindersVer(): number;
    touchReminders(): void;
    get askerDialog(): Dialog | undefined;
    getUiLanguage(): LanguageCode;
    setUiLanguage(language: LanguageCode): void;
    getLastUserLanguageCode(): LanguageCode;
    setLastUserLanguageCode(language: LanguageCode): void;
    private buildCourseRuntimeNotice;
    resetCourseLanguageNotice(): void;
    appendCourseLanguageChangedNotice(previousLanguage: LanguageCode, nextLanguage: LanguageCode): void;
    /**
     * Get the current callId for tellask call correlation
     *
     * Call Types:
     * - tellask-special function call: callId is set when call results are finalized and used for inline result correlation
     * - SideDialog response bubbles: use calleeDialogId instead of callId
     *
     * @returns The current callId for call correlation, or null if no active call
     */
    getCurrentCallId(): string | null;
    /**
     * Set the current callId for tellask-special inline result correlation
     *
     * @param callId - The function-call correlation ID
     */
    setCurrentCallId(callId: string): void;
    /**
     * Clear the current callId (called after tool response is sent)
     */
    clearCurrentCallId(): void;
    /**
     * Acquire the dialog mutex. Returns a release callback.
     * FIFO queue ensures fairness when multiple callers wait.
     */
    acquire(): Promise<() => void>;
    /**
     * Run an async function while holding the dialog mutex.
     * Prefer this over manually acquiring/releasing to avoid leaks on exceptions.
     */
    withLock<T>(fn: () => Promise<T>): Promise<T>;
    /**
     * Check if the dialog mutex is currently locked.
     */
    isLocked(): boolean;
    /**
     * Check if dialog has pending Q4H questions.
     * Reads the dialog latest user-wait state; q4h.yaml remains the detailed question payload store.
     */
    hasPendingQ4H(): Promise<boolean>;
    /**
     * Check if dialog has active callee dispatches.
     */
    hasActiveCalleeDispatches(): Promise<boolean>;
    /**
     * Check if dialog can be driven.
     *
     * Active callee dispatches are background callee work: they are observable, but they must not
     * block the caller dialog from continuing when some other concrete drive source exists.
     */
    canDrive(): Promise<boolean>;
    /**
     * Get suspension status for logging/debugging.
     */
    getSuspensionStatus(): Promise<{
        q4h: boolean;
        backgroundCalleeDialogs: boolean;
        canDrive: boolean;
    }>;
    get activeCalleeDialogIds(): ReadonlyArray<DialogID>;
    addActiveCalleeDialogs(ids: DialogID[]): void;
    clearActiveCalleeDialogs(): void;
    /**
     * Load active callee dispatches from persistence into memory.
     */
    loadActiveCalleeDispatchesFromPersistence(): Promise<void>;
    /**
     * Abstract method for creating sideDialogs.
     * Implemented by MainDialog to create SideDialog instances.
     */
    abstract createSideDialog(targetAgentId: string, mentionList: string[] | undefined, tellaskContent: string, options: {
        callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
        originMemberId: string;
        askerDialogId: string;
        callId: string;
        callSiteCourse: CallSiteCourseNo;
        callSiteGenseq: CallSiteGenseqNo;
        sessionSlug?: string;
        collectiveTargets?: string[];
        effectiveFbrEffort?: number;
    }): Promise<SideDialog>;
    /**
     * Post a dialog event using the standard event registry.
     */
    postEvent(event: DialogEvent): void;
    addReminder(content: string, owner?: ReminderOwner, meta?: JsonValue, position?: number, options?: ReminderOptions): Reminder;
    deleteReminder(index: number): Reminder;
    updateReminder(index: number, content: string, meta?: JsonValue, options?: ReminderOptions): Reminder;
    clearReminders(): void;
    listVisibleReminderTargets(): Promise<VisibleReminderTarget[]>;
    listVisibleReminders(): Promise<Reminder[]>;
    resolveReminderTargetById(reminderId: string): Promise<VisibleReminderTarget | null>;
    private processReminderCollection;
    private buildVisibleReminderContents;
    private emitFullRemindersUpdate;
    /**
     * Emits current visible reminders without reconciling tool-owned state or writing persistence.
     * This is for read-only dialog display, especially completed/archived dialogs opened from old tabs.
     */
    emitReminderSnapshot(): Promise<ReminderContent[]>;
    /**
     * Process reminder updates before LLM generation.
     * Calls updateReminder on each tool that owns reminders to allow them to update/drop/keep their reminders.
     * Returns reminder contents with metadata for the frontend.
     */
    processReminderUpdates(): Promise<ReminderContent[]>;
    setCoursePrefixMsgs(msgs: ReadonlyArray<ChatMessage>): void;
    getCoursePrefixMsgs(): ReadonlyArray<ChatMessage>;
    addChatMessages(...msgs: ChatMessage[]): Promise<void>;
    /**
     * Get current persistence status
     */
    abstract get status(): 'running' | 'completed' | 'archived';
    /**
     * Get current course number
     */
    get currentCourse(): number;
    /**
     * Get current generation sequence number
     */
    get activeGenSeq(): number;
    get activeGenSeqOrUndefined(): number | undefined;
    get activeGenCourseOrUndefined(): number | undefined;
    get hasActiveGeneration(): boolean;
    /**
     * Check if generation has started for the current course.
     * Used to ensure sideDialog_final_response_evt arrives after parent events.
     */
    get generationStarted(): boolean;
    /**
     * Mark generation as started (after user_text event has been emitted).
     * This ensures sideDialog_final_response_evt waits for this signal.
     * @param genseq The generation sequence number when this flag is set
     */
    markGenerationStarted(genseq?: number): void;
    /**
     * Get the genseq when generation was marked as started
     */
    get generationStartedGenseq(): number;
    /**
     * Phase 11: Get current suspension state
     * @returns 'active' | 'suspended' | 'resumed'
     */
    getSuspensionState(): 'active' | 'suspended' | 'resumed';
    /**
     * Phase 11: Set suspension state
     * @param state The new suspension state
     */
    setSuspensionState(state: 'active' | 'suspended' | 'resumed'): void;
    get createdAt(): string;
    get updatedAt(): string;
    private replaceQueuedPromptState;
    private setPendingRuntimePrompt;
    private mergePromptQ4HAnswerCallId;
    private enqueueQueuedPromptState;
    private peekLatestQueuedPrompt;
    queueUserPromptAtGenerationBoundary(options: {
        prompt: string;
        contentItems?: DialogQueuedUserGenerationBoundaryState['contentItems'];
        msgId: string;
        grammar: 'markdown';
        userLanguageCode?: LanguageCode;
        q4hAnswerCallId?: string;
    }): DialogQueuedPromptState;
    queueDeferredQ4HAnswerPrompt(options: {
        prompt: string;
        contentItems?: DialogQueuedDeferredQ4HAnswerState['contentItems'];
        msgId: string;
        grammar: 'markdown';
        userLanguageCode?: LanguageCode;
        q4hAnswerCallId?: string;
    }): DialogQueuedPromptState;
    queueRegisteredAssignmentUpdatePrompt(options: {
        prompt: string;
        msgId: string;
        grammar: 'markdown';
        userLanguageCode?: LanguageCode;
        tellaskReplyDirective: TellaskReplyDirective;
        skipTaskdoc?: boolean;
        calleeDialogReplyTarget: DialogCalleeReplyTarget;
    }): DialogQueuedPromptState;
    private persistPendingRuntimePrompt;
    private runtimePromptCommon;
    queueRuntimeReplyPrompt(options: {
        prompt: string;
        msgId: string;
        grammar: 'markdown';
        userLanguageCode?: LanguageCode;
        tellaskReplyDirective: TellaskReplyDirective;
        skipTaskdoc?: boolean;
    }): Promise<DialogQueuedPromptState>;
    queueRuntimeSideDialogPrompt(options: {
        prompt: string;
        msgId: string;
        grammar: 'markdown';
        userLanguageCode?: LanguageCode;
        tellaskReplyDirective: TellaskReplyDirective;
        skipTaskdoc?: boolean;
        calleeDialogReplyTarget: DialogCalleeReplyTarget;
    }): Promise<DialogQueuedPromptState>;
    hasQueuedPrompt(): boolean;
    peekQueuedPrompt(): DialogQueuedPromptState | undefined;
    takeQueuedPrompt(): DialogQueuedPromptState | undefined;
    removeQueuedPromptByMsgId(msgId: string): boolean;
    removeQueuedPromptsMatching(predicate: (prompt: DialogQueuedPromptState) => boolean): number;
    setActiveRunControlSpec(spec?: DialogRunControlSpec): void;
    getActiveRunControlSpec(): DialogRunControlSpec | undefined;
    setNewCourseHook(hook?: NewCourseHook): void;
    enqueueDriveIntent(intent: DriveIntent): void;
    takeDriveIntent(): DriveIntent | undefined;
    hasDriveIntents(): boolean;
    clearDriveIntents(): void;
    /**
     * Start a new course - clears conversational noise, Q4H, and increments course counter.
     * Queues a new-course prompt for the driver to consume on the next drive cycle.
     * This is the single entry point for mental clarity operations that start a new course.
     */
    startNewCourse(newCoursePrompt: string, options?: {
        runControl?: DialogRunControlSpec;
        reason?: string;
        skipRunControlHook?: boolean;
        skipEnqueueIntent?: boolean;
    }): Promise<DialogRuntimePrompt>;
    receiveFuncResult(result: FuncResultMsg): Promise<void>;
    receiveTellaskResult(result: TellaskResultMsg): Promise<void>;
    receiveTellaskCarryover(result: TellaskCarryoverMsg): Promise<void>;
    receiveTellaskCallResult(responderId: string, callName: 'tellaskBack' | 'tellask' | 'tellaskSessionless' | 'askHuman' | 'freshBootsReasoning', mentionList: string[] | undefined, tellaskContent: string, result: string, status: 'completed' | 'failed', callId: string, options?: {
        callSiteCourse?: CallSiteCourseNo;
        callSiteGenseq?: CallSiteGenseqNo;
    }): Promise<void>;
    receiveTellaskResponse(responderId: string, callName: 'tellaskBack' | 'tellask' | 'tellaskSessionless' | 'askHuman' | 'freshBootsReasoning', mentionList: string[] | undefined, tellaskContent: string, status: 'completed' | 'failed', sideDialogId: DialogID | undefined, options: {
        response: string;
        agentId: string;
        callId: string;
        originMemberId: string;
        callSiteCourse?: CallSiteCourseNo;
        callSiteGenseq?: CallSiteGenseqNo;
        carryoverContent?: string;
        contentItems?: DialogUserPrompt['contentItems'];
        sessionSlug?: string;
        calleeCourse?: CalleeCourseNumber;
        calleeGenseq?: CalleeGenerationSeqNumber;
    }): Promise<TellaskResultMsg | TellaskCarryoverMsg>;
    notifyGeneratingStart(msgId?: string): Promise<readonly DialogNextStepTrigger[]>;
    notifyGeneratingFinish(contextHealth?: ContextHealthSnapshot, llmGenModel?: string): Promise<void>;
    streamError(error: string): Promise<void>;
    thinkingStart(): Promise<void>;
    thinkingChunk(chunk: string): Promise<void>;
    markdownStart(): Promise<void>;
    markdownChunk(chunk: string): Promise<void>;
    thinkingFinish(reasoning?: ReasoningPayload, provider_data?: ProviderData): Promise<void>;
    markdownFinish(): Promise<void>;
    sayingStart(): Promise<void>;
    sayingChunk(chunk: string): Promise<void>;
    sayingFinish(): Promise<void>;
    webSearchCall(payload: {
        source?: WebSearchCallSource;
        phase: 'added' | 'done';
        itemId: string;
        status?: string;
        action?: WebSearchCallAction;
    }): Promise<void>;
    nativeToolCall(payload: NativeToolCallPayload): Promise<void>;
    toolResultImageIngest(payload: ToolResultImageIngest): Promise<void>;
    userImageIngest(payload: UserImageIngest): Promise<void>;
    callingStart(payload: {
        callName: 'tellaskBack' | 'tellask' | 'tellaskSessionless' | 'askHuman' | 'freshBootsReasoning';
        callId: string;
        mentionList?: string[];
        sessionSlug?: string;
        tellaskContent: string;
    }): Promise<void>;
    updateQuestions4Human(questions: HumanQuestion[]): Promise<void>;
    persistUserMessage(content: string, msgId: string, grammar: 'markdown', origin: 'user' | 'diligence_push' | 'runtime' | undefined, userLanguageCode?: LanguageCode, q4hAnswerCallId?: string, tellaskReplyDirective?: TellaskReplyDirective, contentItems?: DialogUserPrompt['contentItems']): Promise<void>;
    receiveHumanReply(args: {
        content: string;
        userLanguageCode?: LanguageCode;
        q4hAnswerCallId: string;
    }): Promise<void>;
    appendTellaskReplyResolution(payload: {
        callId: string;
        replyCallName: 'replyTellask' | 'replyTellaskSessionless' | 'replyTellaskBack';
        targetCallId: string;
    }): Promise<void>;
    persistAgentMessage(content: string, genseq: number, type: 'thinking_msg' | 'saying_msg', provider_data?: ProviderData, reasoning?: ReasoningPayload): Promise<void>;
    persistUiOnlyMarkdown(content: string, genseq: number): Promise<void>;
    persistFunctionCall(id: string, name: string, rawArgumentsText: string, genseq: number, rawId?: string): Promise<void>;
    persistTellaskCall(id: string, name: TellaskCallRecordName, rawArgumentsText: string, genseq: number, options?: {
        deliveryMode?: 'tellask_call_start' | 'func_call_requested';
        replyDirective?: TellaskReplyDirective;
    }): Promise<void>;
    /**
     * Post sideDialog completion response to this dialog.
     * Phase 14: No wait - emit immediately with virtual gen markers for Type C sideDialogs
     */
    postSideDialogResponse(sideDialogId: DialogID, response: string): Promise<void>;
}
/**
 * SideDialog - A sideDialog created by a MainDialog for autonomous tellask Side Dialog work.
 * Stores the main dialog for registry and lookup, and resolves its effective askerDialog dynamically.
 */
export declare class SideDialog extends Dialog {
    readonly mainDialog: MainDialog;
    readonly sessionSlug?: string;
    askerStack: DialogAskerStackState;
    private _fbrConclusionToolsEnabled;
    constructor(dlgStore: DialogStore, mainDialog: MainDialog, taskDocPath: string, id: DialogID | undefined, agentId: string, askerStack: DialogAskerStackState, sessionSlug?: string, initialState?: DialogInitParams['initialState']);
    get assignmentFromAsker(): AssignmentFromAsker;
    set assignmentFromAsker(assignment: AssignmentFromAsker);
    get askerDialog(): Dialog;
    get status(): 'running' | 'completed' | 'archived';
    setFbrConclusionToolsEnabled(enabled: boolean): void;
    areFbrConclusionToolsEnabled(): boolean;
    /**
     * Create a sideDialog under the same main dialog tree.
     * The new sideDialog's effective askerDialog is resolved via AssignmentFromAsker.askerDialogId.
     */
    createSideDialog(targetAgentId: string, mentionList: string[] | undefined, tellaskContent: string, options: {
        callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
        originMemberId: string;
        askerDialogId: string;
        callId: string;
        callSiteCourse: CallSiteCourseNo;
        callSiteGenseq: CallSiteGenseqNo;
        sessionSlug?: string;
        collectiveTargets?: string[];
        effectiveFbrEffort?: number;
    }): Promise<SideDialog>;
}
/**
 * MainDialog - The main/main dialog that can create and manage sideDialogs.
 * Uses in-memory registries for O(1) dialog and Type B lookup.
 */
export declare class MainDialog extends Dialog {
    private _status;
    private _localRegistry;
    private _sideDialogRegistry;
    constructor(dlgStore: DialogStore, taskDocPath: string, id: DialogID | undefined, agentId: string, initialState?: DialogInitParams['initialState']);
    get status(): 'running' | 'completed' | 'archived';
    setPersistenceStatus(status: 'running' | 'completed' | 'archived'): void;
    /**
     * Register a dialog (self or sideDialog) in the local registry.
     */
    registerDialog(dialog: Dialog): void;
    /**
     * Lookup a dialog by selfId in the local registry.
     */
    lookupDialog(selfId: string): Dialog | undefined;
    /**
     * Get all registered dialogs in this dialog tree.
     */
    getAllDialogs(): Dialog[];
    /**
     * Remove a dialog from the local registry.
     */
    unregisterDialog(selfId: string): void;
    /**
     * Generate a registry key from agentId and sessionSlug.
     */
    static makeSideDialogKey(agentId: string, sessionSlug: string): string;
    /**
     * Register a Type-B sideDialog for resumption.
     */
    registerSideDialog(sideDialog: SideDialog): void;
    /**
     * Lookup a Type-B sideDialog by agentId and sessionSlug.
     */
    lookupSideDialog(agentId: string, sessionSlug: string): SideDialog | undefined;
    /**
     * Remove a Type-B sideDialog from registry.
     */
    unregisterSideDialog(agentId: string, sessionSlug: string): boolean;
    /**
     * Get all registered sideDialogs.
     */
    getRegisteredSideDialogs(): SideDialog[];
    /**
     * Create a new sideDialog for autonomous tellask Side Dialog work.
     */
    createSideDialog(targetAgentId: string, mentionList: string[] | undefined, tellaskContent: string, options: {
        callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
        originMemberId: string;
        askerDialogId: string;
        callId: string;
        callSiteCourse: CallSiteCourseNo;
        callSiteGenseq: CallSiteGenseqNo;
        sessionSlug?: string;
        collectiveTargets?: string[];
        effectiveFbrEffort?: number;
    }): Promise<SideDialog>;
    /**
     * Save sideDialog registry to disk (registry.yaml).
     */
    saveSideDialogRegistry(): Promise<void>;
    /**
     * Load sideDialog registry from disk (registry.yaml).
     */
    loadSideDialogRegistry(): Promise<void>;
}
/**
 * The UI showing a dialog in realtime
 */
export declare abstract class DialogStore {
    /**
     * almost certainly, the subclass should override this method to be (sub)dialog structure aware
     *
     * impl here serves for demo purpose only
     *
     * @param askerDialog
     * @param targetAgentId
     * @param mentionList
     * @param tellaskContent
     * @returns
     */
    createSideDialog(askerDialog: Dialog, targetAgentId: string, mentionList: string[] | undefined, tellaskContent: string, options: {
        callName: 'tellask' | 'tellaskSessionless' | 'freshBootsReasoning';
        originMemberId: string;
        askerDialogId: string;
        callId: string;
        callSiteCourse: CallSiteCourseNo;
        callSiteGenseq: CallSiteGenseqNo;
        sessionSlug?: string;
        collectiveTargets?: string[];
        effectiveFbrEffort?: number;
    }): Promise<SideDialog>;
    /**
     * Receive and handle LLM generation streams (Markdown stream + tellask call stream)
     */
    /**
     * Notify start of LLM generation lifecycle (generating_start_evt)
     */
    notifyGeneratingStart(_dialog: Dialog, _msgId?: string): Promise<readonly DialogNextStepTrigger[]>;
    /**
     * Notify end of LLM generation lifecycle (generating_finish_evt)
     */
    notifyGeneratingFinish(_dialog: Dialog, _contextHealth?: ContextHealthSnapshot, _llmGenModel?: string): Promise<void>;
    thinkingStart(_dialog: Dialog): void;
    thinkingChunk(_dialog: Dialog, _chunk: string): void;
    thinkingFinish(_dialog: Dialog, _reasoning?: ReasoningPayload, _provider_data?: ProviderData): void;
    markdownStart(_dialog: Dialog): void;
    markdownChunk(_dialog: Dialog, _chunk: string): void;
    markdownFinish(_dialog: Dialog): void;
    sayingStart(_dialog: Dialog): void;
    sayingChunk(_dialog: Dialog, _chunk: string): void;
    sayingFinish(_dialog: Dialog): void;
    receiveFuncResult(_dialog: Dialog, _funcResult: FuncResultMsg): Promise<void>;
    receiveTellaskResult(_dialog: Dialog, _funcResult: TellaskResultMsg): Promise<void>;
    receiveTellaskCarryover(_dialog: Dialog, _result: TellaskCarryoverMsg): Promise<void>;
    updateQuestions4Human(_dialog: Dialog, _questions: HumanQuestion[]): Promise<void>;
    /**
     * Load Questions for Human state from storage
     */
    loadQuestions4Human(_dialogId: DialogID, _status: 'running' | 'completed' | 'archived'): Promise<HumanQuestion[]>;
    loadDialogLatest(_dialogId: DialogID, _status: 'running' | 'completed' | 'archived'): Promise<DialogLatestFile | null>;
    loadDialogMetadata(_dialogId: DialogID, _status: 'running' | 'completed' | 'archived'): Promise<DialogMetadataFile | null>;
    loadSideDialogAssignmentFromAsker(_dialogId: DialogID, _status: 'running' | 'completed' | 'archived'): Promise<AssignmentFromAsker | null>;
    loadActiveCalleeDispatches(_dialogId: DialogID, _status: 'running' | 'completed' | 'archived'): Promise<ActiveCalleeDispatch[]>;
    loadActiveCallees(_dialogId: DialogID, _status: 'running' | 'completed' | 'archived'): Promise<ActiveCalleesFile>;
    saveSideDialogRegistry(_dialog: MainDialog, _mainDialogId: DialogID, _entries: Array<{
        key: string;
        sideDialogId: DialogID;
        agentId: string;
        sessionSlug?: string;
    }>, _status: 'running' | 'completed' | 'archived'): Promise<void>;
    loadSideDialogRegistry(_mainDialog: MainDialog, _status: 'running' | 'completed' | 'archived'): Promise<void>;
    /**
     * Clear Questions for Human state in storage
     */
    clearQuestions4Human(_dialog: Dialog): Promise<void>;
    callingStart(_dialog: Dialog, _payload: {
        callName: 'tellaskBack' | 'tellask' | 'tellaskSessionless' | 'askHuman' | 'freshBootsReasoning';
        callId: string;
        mentionList?: string[];
        sessionSlug?: string;
        tellaskContent: string;
    }): Promise<void>;
    webSearchCall(_dialog: Dialog, _payload: {
        source?: WebSearchCallSource;
        phase: 'added' | 'done';
        itemId: string;
        status?: string;
        action?: WebSearchCallAction;
    }): Promise<void>;
    nativeToolCall(_dialog: Dialog, _payload: NativeToolCallPayload): Promise<void>;
    toolResultImageIngest(_dialog: Dialog, _payload: ToolResultImageIngest): Promise<void>;
    userImageIngest(_dialog: Dialog, _payload: UserImageIngest): Promise<void>;
    /**
     * Load current course number from persisted metadata
     * This method should be implemented by subclasses to read from storage
     */
    loadCurrentCourse(_dialogId: DialogID): Promise<number>;
    /**
     * Get next sequence number for generation
     * This method should be implemented by subclasses for sequence allocation
     */
    getNextSeq(_dialogId: DialogID, _course: number): Promise<number>;
    /**
     * Persist reminders to storage (event emission handled by processReminderUpdates)
     */
    persistReminders(_dialog: Dialog, _reminders: Reminder[]): Promise<void>;
    /**
     * Persist a user message to storage
     */
    persistUserMessage(_dialog: Dialog, _content: string, _msgId: string, _grammar: 'markdown', _origin: 'user' | 'diligence_push' | 'runtime' | undefined, _userLanguageCode?: LanguageCode, _q4hAnswerCallId?: string, _tellaskReplyDirective?: TellaskReplyDirective, _contentItems?: DialogUserPrompt['contentItems']): Promise<void>;
    appendTellaskReplyResolution(_dialog: Dialog, _payload: {
        callId: string;
        replyCallName: 'replyTellask' | 'replyTellaskSessionless' | 'replyTellaskBack';
        targetCallId: string;
    }): Promise<void>;
    /**
     * Persist an assistant message to storage
     */
    persistAgentMessage(_dialog: Dialog, _content: string, _genseq: number, _type: 'thinking_msg' | 'saying_msg', _provider_data?: ProviderData, _reasoning?: ReasoningPayload): Promise<void>;
    /**
     * Persist an assistant markdown message that must be visible in UI + persistence,
     * but must never be injected into LLM context.
     */
    persistUiOnlyMarkdown(_dialog: Dialog, _content: string, _genseq: number): Promise<void>;
    /**
     * Persist a function call to storage
     */
    persistFunctionCall(_dialog: Dialog, _id: string, _name: string, _rawArgumentsText: string, _genseq: number, _rawId?: string): Promise<void>;
    persistTellaskCall(_dialog: Dialog, _id: string, _name: TellaskCallRecordName, _rawArgumentsText: string, _genseq: number, _options?: {
        deliveryMode?: 'tellask_call_start' | 'func_call_requested';
        replyDirective?: TellaskReplyDirective;
    }): Promise<void>;
    /**
     * Start a new course in storage
     */
    startNewCourse(_dialog: Dialog, _newCoursePrompt: DialogRuntimePrompt): Promise<void>;
    persistPendingRuntimePrompt(_dialog: Dialog, _prompt: DialogRuntimePrompt): Promise<void>;
    /**
     * Handle stream error
     */
    streamError(_dialog: Dialog, _error: string): Promise<void>;
}
export {};
