/** * Ask User Tool - Gather input from user via questions with options * * This tool allows the agent to ask the user questions with predefined options. * The default implementation uses Node.js readline for basic CLI interaction. * Consumers (like CLI apps) can override with custom UI implementations. * * Features: * - Multiple questions in a single call * - Options with labels, values, and descriptions * - Multi-select support * - Factory function for custom implementations */ import type { Tool } from '../types.js'; /** * A single option for a question */ export interface AskUserOption { /** Display text for the option */ label: string; /** Value returned when this option is selected */ value: string; /** Optional description/explanation */ description?: string; } /** * A question to ask the user */ export interface AskUserQuestion { /** Unique identifier for this question */ id: string; /** The question text */ question: string; /** Available options to choose from */ options: AskUserOption[]; /** Allow multiple selections (default: false) */ multiSelect?: boolean; } /** * Input parameters for ask_user tool */ export interface AskUserInput { /** Questions to ask the user (1-4 questions) */ questions: AskUserQuestion[]; } /** * Result from ask_user tool */ export interface AskUserResult { /** Answers keyed by question ID */ answers: Record; /** Question IDs that were skipped */ skipped: string[]; } /** * Options for creating custom ask_user tool */ export interface AskUserToolOptions { /** * Custom handler for asking questions. * If not provided, uses readline-based implementation. */ onAsk?: (questions: AskUserQuestion[]) => Promise; } /** * Default ask_user tool using readline for basic CLI interaction. * Use createAskUserTool() for custom implementations. */ export declare const askUserTool: Tool; /** * Create a custom ask_user tool with your own UI implementation. * * @example * ```typescript * const customAskUser = createAskUserTool({ * onAsk: async (questions) => { * // Show fancy UI overlay * const overlay = new AskUserOverlay({ questions }); * return await ui.showOverlay(overlay); * } * }); * agent.registerTool(customAskUser); * ``` */ export declare function createAskUserTool(options?: AskUserToolOptions): Tool;