/// <reference types="node" />
import * as events from 'events';
import type * as Tp from 'thingpedia';
import * as ThingTalk from 'thingtalk';
import { PlatformData } from './user-input';
import ValueCategory from './value-category';
import { Message, RDL } from './protocol';
import { EntityMap } from '../utils/entity-utils';
import type Engine from '../engine';
import { DialogueTurn } from "../dataset-tools/parsers";
export interface AssistantUser {
    id: string;
    account: string;
}
export interface ConversationOptions {
    nluServerUrl?: string;
    nlgServerUrl?: string;
    anonymous?: boolean;
    debug?: boolean;
    rng?: () => number;
    inactivityTimeout?: number;
    contextResetTimeout?: number;
    showWelcome?: boolean;
    deleteWhenInactive?: boolean;
    log?: boolean;
}
interface Statistics {
    hit(key: string): void;
}
interface Context {
    code: string[];
    entities: EntityMap;
}
export interface ConversationDelegate {
    setHypothesis(hyp: string): void;
    setExpected(expect: string | null, ctx: Context): void;
    addMessage(msg: Message): Promise<void>;
}
interface ResultLike {
    toLocaleString(locale?: string): string;
}
export declare class DialogueTurnLog {
    private readonly _turn;
    private _done;
    constructor();
    get turn(): DialogueTurn;
    get done(): boolean;
    finish(): void;
    update(field: keyof DialogueTurn, value: string): void;
}
/**
 * A single session of conversation in Almond.
 *
 * This object is responsible for maintaining the history of the conversation
 * to support clients reconnecting to the same conversation later, as well
 * as tracking connected clients and inactivity timeouts.
 *
 * The actual conversation logic is in {@link DialogueLoop}.
 */
export default class Conversation extends events.EventEmitter {
    private _engine;
    private _user;
    private _conversationId;
    private _locale;
    _: (x: string) => string;
    private _stats;
    private _options;
    private _debug;
    rng: () => number;
    private _loop;
    private _expecting;
    private _context;
    private _delegates;
    private _history;
    private _nextMsgId;
    private _inactivityTimeout;
    private _inactivityTimeoutSec;
    private _contextResetTimeout;
    private _contextResetTimeoutSec;
    private _log;
    constructor(engine: Engine, conversationId: string, user: AssistantUser, options?: ConversationOptions);
    get isAnonymous(): boolean;
    get id(): string;
    get user(): AssistantUser;
    get platform(): Tp.BasePlatform;
    get locale(): string;
    get timezone(): string;
    get stats(): Statistics;
    get apps(): import("../engine/apps/database").default;
    get schemas(): ThingTalk.SchemaRetriever;
    get thingpedia(): Tp.BaseClient;
    get history(): Message[];
    get inRecordingMode(): boolean;
    startRecording(): void;
    endRecording(): void;
    notify(appId: string, icon: string | null, outputType: string, outputValue: Record<string, unknown>): void;
    notifyError(appId: string, icon: string | null, error: Error): void;
    setExpected(expecting: ValueCategory | null, context: Context): void;
    start(): Promise<void>;
    stop(): Promise<void>;
    private _resetInactivityTimeout;
    addOutput(out: ConversationDelegate, replayHistory?: boolean): Promise<void>;
    removeOutput(out: ConversationDelegate): Promise<void>;
    private _addMessage;
    handleCommand(command: string, platformData?: PlatformData): Promise<void>;
    handleParsedCommand(root: any, title?: string, platformData?: PlatformData): Promise<void>;
    handleThingTalk(program: string, platformData?: PlatformData): Promise<void>;
    setHypothesis(hypothesis: string): Promise<void>;
    sendAskSpecial(): Promise<void>;
    sendReply(message: string, icon: string | null): Promise<void>;
    sendResult(message: ResultLike, icon: string | null): Promise<void>;
    sendPicture(url: string, icon: string | null): Promise<void>;
    sendRDL(rdl: RDL, icon: string | null): Promise<void>;
    sendChoice(idx: number, title: string): Promise<void>;
    sendButton(title: string, json: string): Promise<void>;
    sendLink(title: string, url: string): Promise<void>;
    private get _lastDialogue();
    private get _lastTurn();
    appendNewDialogue(): void;
    dialogueFinished(): void;
    turnFinished(): void;
    appendNewTurn(turn: DialogueTurnLog): void;
    voteLast(vote: 'up' | 'down'): void;
    commentLast(comment: string): void;
    updateLog(field: keyof DialogueTurn, value: string): void;
    saveLog(): Promise<void>;
    get log(): string | null;
}
export {};
