import type { ICopilotMessage, ICopilotStreamRequest, ICopilotThinkingMode, } from '../../service/copilot/copilot.interface'; /** What one turn sends besides the words. */ export interface TurnInput { history: ICopilotMessage[]; route: string; thinking: ICopilotThinkingMode; /** The page sent it (a job landing, a checkup item), not the merchant. */ hidden: boolean; logoImage?: string; } /** * The body of one turn. A hidden turn goes as an internal event: the agent * does not bill it and opens nothing over what the merchant was reading, * as the platform's panel asks of it. * * @param {string} message - The words of the turn. * @param {TurnInput} input - History, route, mode and who sent it. * @returns {ICopilotStreamRequest} The request. */ export const turnRequest = ( message: string, input: TurnInput ): ICopilotStreamRequest => ({ message, history: input.history, context: { route: input.route, platform: 'WORDPRESS' }, thinking: input.thinking, internal_event: input.hidden, logo_image: input.logoImage, });