import { Schedule } from "agents"; import { UIMessage } from "ai"; import { AuthorizationPendingInterrupt, AuthorizationPollingInterrupt } from "@auth0/ai/interrupts"; type Constructor = new (...args: any[]) => T; type ScheduledParamsType = { interrupt: AuthorizationPendingInterrupt | AuthorizationPollingInterrupt; context: { threadID: string; toolCallID: string; toolName: string; }; }; interface ChatAgent { schedule(when: Date | string | number, callback: keyof this, payload?: T): Promise>; messages: UIMessage[]; saveMessages(messages: UIMessage[]): Promise; get name(): string; } /** * Mixin to add Async User Confirmation resuming functionality to AIChatAgent. * * This class extends the AIChatAgent to handle asynchronous user confirmation * resuming using the CIBA (Client Initiated Backchannel Authentication) flow. * * It schedules a check for user confirmation and updates the message state * accordingly. * * Call the `scheduleAsyncUserConfirmationCheck` method to initiate the scheduling from * within the `onAuthorizationInterrupt` callback of the authorizer. * * auth0AI.withAsyncAuthorization({ * onAuthorizationInterrupt: async (interrupt, context) => { * const { agent } = getCurrentAgent(); * agent?.schedulePoller({ interrupt, context }); * }, * }); * * @param Base - The base class to extend, typically an AIChatAgent. * @returns A new class that extends the base class with additional functionality. */ export declare const AsyncUserConfirmationResumer: >(Base: TBase) => { new (...args: any[]): { /** * Schedules an asynchronous user confirmation check. * * @param params - The parameters for the scheduled task, including the interrupt and context. * @param delayInSeconds - The delay in seconds before the check is executed (default to Auth request polling interval). * @returns A promise that resolves to a Schedule object for the scheduled task. */ scheduleAsyncUserConfirmationCheck(params: ScheduledParamsType, delayInSeconds?: number): Promise>; /** * Method run by the scheduler to check for user confirmation. * @param params - The parameters for the scheduled task, including the interrupt and context. * @returns */ asyncUserConfirmationCheck(params: { interrupt: AuthorizationPendingInterrupt | AuthorizationPollingInterrupt; context: { threadID: string; toolCallID: string; toolName: string; }; }): Promise; schedule(when: Date | string | number, callback: keyof /*elided*/ any, payload?: T | undefined): Promise>; messages: UIMessage[]; saveMessages(messages: UIMessage[]): Promise; readonly name: string; }; } & TBase; export {}; //# sourceMappingURL=AsyncUserConfirmationResumer.d.ts.map