import type { DomindsAppReminderRenderedMessage, DomindsAppRunControlResult, DomindsKernelEndpoint } from '@longrun-ai/kernel/app-host-contract';
import type { DomindsAppDialogReminderRequestBatch, DomindsAppHostReminderUpdateResult, DomindsAppInstallJson, DomindsAppReminderApplyRequest, DomindsAppReminderApplyResult, DomindsAppReminderState } from '@longrun-ai/kernel/app-json';
import type { LanguageCode } from '@longrun-ai/kernel/types/language';
import type { ToolArguments, ToolCallOutput } from '../tool';
export type AppsHostKernelInitMessage = Readonly<{
    type: 'init';
    rtwsRootAbs: string;
    kernel: DomindsKernelEndpoint;
    apps: ReadonlyArray<Readonly<{
        appId: string;
        runtimePort: number | null;
        installJson: DomindsAppInstallJson;
    }>>;
}>;
export type AppsHostKernelToolCallMessage = Readonly<{
    type: 'tool_call';
    callId: string;
    toolName: string;
    args: ToolArguments;
    ctx: Readonly<{
        dialogId: string;
        mainDialogId: string;
        agentId: string;
        taskDocPath: string;
        sessionSlug?: string;
        callerId: string;
    }>;
}>;
export type AppsHostKernelDynamicToolsetsMessage = Readonly<{
    type: 'dynamic_toolsets';
    callId: string;
    ctx: Readonly<{
        memberId: string;
        taskDocPath: string;
        dialogId?: string;
        mainDialogId?: string;
        agentId?: string;
        sessionSlug?: string;
    }>;
}>;
export type AppsHostKernelRunControlApplyMessage = Readonly<{
    type: 'run_control_apply';
    callId: string;
    controlId: string;
    payload: Readonly<{
        dialog: Readonly<{
            selfId: string;
            rootId: string;
        }>;
        agentId: string;
        taskDocPath: string;
        genIterNo: number;
        prompt?: Readonly<{
            content: string;
            msgId: string;
            grammar: 'markdown';
            userLanguageCode: LanguageCode;
            origin?: 'user' | 'diligence_push' | 'runtime';
        }>;
        source: 'drive_dlg_by_user_msg' | 'drive_dialog_by_user_answer';
        input: Readonly<Record<string, unknown>>;
        q4h?: Readonly<{
            questionId: string;
            continuationType: 'answer' | 'followup' | 'retry' | 'new_message';
        }>;
    }>;
}>;
export type AppsHostKernelReminderApplyMessage = Readonly<{
    type: 'reminder_apply';
    callId: string;
    appId: string;
    ownerRef: string;
    request: DomindsAppReminderApplyRequest;
    ctx: Readonly<{
        dialogId: string;
        ownedReminders: ReadonlyArray<DomindsAppReminderState>;
    }>;
}>;
export type AppsHostKernelReminderUpdateMessage = Readonly<{
    type: 'reminder_update';
    callId: string;
    appId: string;
    ownerRef: string;
    ctx: Readonly<{
        dialogId: string;
        reminder: DomindsAppReminderState;
    }>;
}>;
export type AppsHostKernelReminderRenderMessage = Readonly<{
    type: 'reminder_render';
    callId: string;
    appId: string;
    ownerRef: string;
    ctx: Readonly<{
        dialogId: string;
        reminder: DomindsAppReminderState;
        reminderId: string;
        workLanguage: LanguageCode;
    }>;
}>;
export type AppsHostKernelShutdownMessage = Readonly<{
    type: 'shutdown';
}>;
export type AppsHostMessageFromKernel = AppsHostKernelInitMessage | AppsHostKernelToolCallMessage | AppsHostKernelDynamicToolsetsMessage | AppsHostKernelRunControlApplyMessage | AppsHostKernelReminderApplyMessage | AppsHostKernelReminderUpdateMessage | AppsHostKernelReminderRenderMessage | AppsHostKernelShutdownMessage;
export type AppsHostReadyMessage = Readonly<{
    type: 'ready';
    apps: ReadonlyArray<Readonly<{
        appId: string;
        frontend: Readonly<{
            port: number;
            baseUrl: string;
            wsUrl: string | null;
        }> | null;
    }>>;
}>;
export type AppsHostLogMessage = Readonly<{
    type: 'log';
    level: 'info' | 'warn' | 'error';
    msg: string;
    appId: string | null;
    data?: Readonly<Record<string, unknown>>;
}>;
export type AppsHostToolResultMessage = Readonly<{
    type: 'tool_result';
    callId: string;
} & (Readonly<{
    ok: true;
    output: ToolCallOutput;
    reminderRequests?: ReadonlyArray<DomindsAppReminderApplyRequest>;
    dialogReminderRequests?: ReadonlyArray<DomindsAppDialogReminderRequestBatch>;
}> | Readonly<{
    ok: false;
    errorText: string;
}>)>;
export type AppsHostDynamicToolsetsResultMessage = Readonly<{
    type: 'dynamic_toolsets_result';
    callId: string;
} & (Readonly<{
    ok: true;
    toolsetIds: ReadonlyArray<string>;
}> | Readonly<{
    ok: false;
    errorText: string;
}>)>;
export type AppsHostReminderApplyResultMessage = Readonly<{
    type: 'reminder_apply_result';
    callId: string;
} & (Readonly<{
    ok: true;
    result: DomindsAppReminderApplyResult;
}> | Readonly<{
    ok: false;
    errorText: string;
}>)>;
export type AppsHostReminderUpdateResultMessage = Readonly<{
    type: 'reminder_update_result';
    callId: string;
} & (Readonly<{
    ok: true;
    result: DomindsAppHostReminderUpdateResult;
}> | Readonly<{
    ok: false;
    errorText: string;
}>)>;
export type AppsHostReminderRenderResultMessage = Readonly<{
    type: 'reminder_render_result';
    callId: string;
} & (Readonly<{
    ok: true;
    message: DomindsAppReminderRenderedMessage;
}> | Readonly<{
    ok: false;
    errorText: string;
}>)>;
export type AppsHostRunControlResultMessage = Readonly<{
    type: 'run_control_result';
    callId: string;
} & (Readonly<{
    ok: true;
    result: DomindsAppRunControlResult;
}> | Readonly<{
    ok: false;
    errorText: string;
}>)>;
export type AppsHostMessageToKernel = AppsHostReadyMessage | AppsHostLogMessage | AppsHostToolResultMessage | AppsHostDynamicToolsetsResultMessage | AppsHostReminderApplyResultMessage | AppsHostReminderUpdateResultMessage | AppsHostReminderRenderResultMessage | AppsHostRunControlResultMessage;
export declare function parseAppsHostMessageFromKernel(v: unknown): AppsHostMessageFromKernel;
