import { type AnswerToHumanItem, type DialogReplyDeliveryState, type TellaskReplyDirective } from '@longrun-ai/kernel/types/storage';
import { Dialog } from '../../dialog';
import type { ChatMessage, FuncCallMsg, FuncResultMsg } from '../client';
import type { KernelDriverDriveCallbacks } from './types';
export type TellaskRoutingParseResult = {
    type: 'A';
    agentId: string;
} | {
    type: 'B';
    agentId: string;
    sessionSlug: string;
} | {
    type: 'C';
    agentId: string;
};
declare const TELLASK_SPECIAL_FUNCTION_NAMES: readonly ["tellaskBack", "tellask", "tellaskSessionless", "replyTellask", "replyTellaskSessionless", "replyTellaskBack", "askHuman", "answerHuman", "freshBootsReasoning"];
export type TellaskCallFunctionName = (typeof TELLASK_SPECIAL_FUNCTION_NAMES)[number];
export type TellaskCall = Readonly<{
    callId: string;
    callName: 'tellaskBack';
    tellaskContent: string;
}> | Readonly<{
    callId: string;
    callName: 'tellask';
    targetAgentId: string;
    sessionSlug: string;
    mentionList: string[];
    tellaskContent: string;
}> | Readonly<{
    callId: string;
    callName: 'tellaskSessionless';
    targetAgentId: string;
    mentionList: string[];
    tellaskContent: string;
}> | Readonly<{
    callId: string;
    callName: 'replyTellask';
    replyContent: string;
}> | Readonly<{
    callId: string;
    callName: 'replyTellaskSessionless';
    replyContent: string;
}> | Readonly<{
    callId: string;
    callName: 'replyTellaskBack';
    replyContent: string;
}> | Readonly<{
    callId: string;
    callName: 'askHuman';
    tellaskContent: string;
}> | Readonly<{
    callId: string;
    callName: 'answerHuman';
    answerContent: string;
}> | Readonly<{
    callId: string;
    callName: 'freshBootsReasoning';
    tellaskContent: string;
    effort?: number;
}>;
export type ResolvedTellaskFunctionCall = Readonly<{
    originalCall: FuncCallMsg;
    call: TellaskCall;
}>;
export type InvalidTellaskFunctionCall = Readonly<{
    originalCall: FuncCallMsg;
    error: string;
    rawArgumentsText: string;
}>;
export declare function isTellaskCallFunctionName(name: string): name is TellaskCallFunctionName;
export declare function loadActiveTellaskReplyDirective(dialog: Dialog): Promise<TellaskReplyDirective | undefined>;
type TellaskBackReplyDeliveryResult = Readonly<{
    kind: 'delivered';
} | {
    kind: 'already_resolved';
}>;
export declare function deliverTellaskBackReplyFromDirective(args: {
    replyingDialog: Dialog;
    directive: Extract<TellaskReplyDirective, {
        expectedReplyCallName: 'replyTellaskBack';
    }>;
    replyContent: string;
    callbacks: KernelDriverDriveCallbacks;
    deliveryMode?: 'reply_tool' | 'direct_fallback';
    directFallbackSource?: 'saying' | 'thinking_only';
}): Promise<TellaskBackReplyDeliveryResult>;
export declare function recoverPendingReplyDelivery(args: {
    dlg: Dialog;
    replyDelivery: DialogReplyDeliveryState;
    callbacks: KernelDriverDriveCallbacks;
}): Promise<number>;
export declare function resolveTellaskFunctionCalls(funcCalls: readonly FuncCallMsg[], options?: {
    allowedSpecials?: ReadonlySet<TellaskCallFunctionName>;
}): {
    validCalls: ResolvedTellaskFunctionCall[];
    invalidCalls: InvalidTellaskFunctionCall[];
    normalCalls: FuncCallMsg[];
};
export declare function formatTellaskInvalidCallResult(args: {
    call: FuncCallMsg;
    error: string;
}): FuncResultMsg;
export declare function formatPendingTellaskFuncResultContent(name: TellaskCallFunctionName, startedAtMs: number | null, callId?: string): string;
export declare function formatResolvedTellaskFuncResultContent(args: {
    name: TellaskCallFunctionName;
    callId: string;
    status: 'pending' | 'completed' | 'failed';
}): string;
export declare function formatResolvedAskHumanResultContent(): string;
export type AnswerHumanStructuredOutput = Readonly<{
    callId: string;
    answerContent: string;
    course: number;
    genseq: number;
    answer: AnswerToHumanItem;
}>;
export declare function recordAnswerToHuman(args: {
    dlg: Dialog;
    answerContent: string;
    course: number;
    genseq: number;
    answerIdSource: string;
}): Promise<AnswerToHumanItem>;
export declare function executeTellaskCalls(args: {
    dlg: Dialog;
    calls: readonly TellaskCall[];
    callbacks: KernelDriverDriveCallbacks;
    activePromptReplyDirective?: TellaskReplyDirective;
}): Promise<{
    toolOutputs: ChatMessage[];
    successfulReplyCallIds: string[];
    failedReplyCallIds: string[];
    answerHumanOutputs: AnswerHumanStructuredOutput[];
}>;
export type TellaskFunctionRoundResult = Readonly<{
    normalCalls: readonly FuncCallMsg[];
    tellaskCallMessages: readonly FuncCallMsg[];
    tellaskResults: readonly FuncResultMsg[];
    toolOutputs: readonly ChatMessage[];
    handledCallIds: readonly string[];
    hasInvalidTellaskCalls: boolean;
    hasImmediateTellaskOutputs: boolean;
    immediateTellaskOutputCallIds: readonly string[];
    invalidTellaskCallIds: readonly string[];
    answerHumanOutputs: readonly AnswerHumanStructuredOutput[];
    shouldStopAfterReplyTool: boolean;
    shouldStopAfterPendingTellaskWait: boolean;
}>;
export declare function processTellaskFunctionRound(args: {
    dlg: Dialog;
    funcCalls: readonly FuncCallMsg[];
    allowedSpecials: ReadonlySet<TellaskCallFunctionName>;
    callbacks: KernelDriverDriveCallbacks;
    activePromptReplyDirective?: TellaskReplyDirective;
}): Promise<TellaskFunctionRoundResult>;
export {};
