/** * Ask Tool - Interactive user prompting during execution * * Use this tool when you need to ask the user questions during execution. * This allows you to: * 1. Gather user preferences or requirements * 2. Clarify ambiguous instructions * 3. Get decisions on implementation choices as you work * 4. Offer choices to the user about what direction to take * * Usage notes: * - Users will always be able to select "Other" to provide custom text input * - Use multi: true to allow multiple answers to be selected for a question * - Use recommended: to mark the default option; "(Recommended)" suffix is added automatically * - Questions may time out and auto-select the recommended option (configurable, disabled in plan mode) */ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@gajae-code/agent-core"; import type { RawArgumentValidationResult } from "@gajae-code/ai/types"; import { type Component } from "@gajae-code/tui"; import type { RenderResultOptions } from "../extensibility/custom-tools/types"; import { type Theme } from "../modes/theme/theme"; import type { AskRemoteControl, AskRemoteInteraction, AskSettlement, AskSettlementResult, ToolSession } from "."; import { type AskParametersSchema, type AskToolInput } from "./ask-contract"; export { askSchema } from "./ask-contract"; /** Result for a single question */ export interface QuestionResult { id: string; question: string; options: string[]; multi: boolean; selectedOptions: string[]; customInput?: string; clarificationQuestion?: string; } export interface AskToolDetails { question?: string; options?: string[]; multi?: boolean; selectedOptions?: string[]; customInput?: string; clarificationQuestion?: string; /** Multi-part question mode */ results?: QuestionResult[]; } export declare const OTHER_OPTION = "Other (type your own)"; export declare const ASK_CLARIFICATION_OPTION = "Ask about these choices"; export declare const RECOMMENDED_SUFFIX = " (Recommended)"; /** The only remote navigation control; labels are presentation, never protocol. */ export declare function askRemoteControls(input: { multi: boolean; questionIndex: number; questionCount: number; selectedCount: number; hasNonWhitespaceCustom: boolean; }): readonly AskRemoteControl[]; /** Classify remote input without looking at option labels used for controls. */ export declare function classifyAskRemoteInteraction(input: { interaction: AskRemoteInteraction; options: readonly string[]; controls: readonly AskRemoteControl[]; multi: boolean; selectedCount: number; customInput?: string; clarification?: boolean; }): AskSettlement; /** A one-shot local receipt used to normalize legacy string answer sources. */ export declare function legacyAskReceipt(value: string): { source: "remote"; interaction: AskRemoteInteraction; settle(settlement: AskSettlement): Promise; }; type AskParams = AskToolInput; /** * Ask tool for interactive user prompting during execution. * * Allows gathering user preferences, clarifying instructions, and getting decisions * on implementation choices as the agent works. */ export declare class AskTool implements AgentTool { #private; private readonly session; readonly name = "ask"; readonly label = "Ask"; readonly summary = "Ask the user a clarifying question"; readonly description: string; get parameters(): AskParametersSchema; readonly rawArgumentValidation: (arguments_: Record) => RawArgumentValidationResult; readonly strict = true; readonly loadMode = "discoverable"; constructor(session: ToolSession); static createIf(session: ToolSession): AskTool | null; execute(_toolCallId: string, params: AskParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback, context?: AgentToolContext): Promise>; } interface AskRenderArgs { question?: string; options?: Array<{ label: string; }>; multi?: boolean; questions?: Array<{ id: string; question: string; options: Array<{ label: string; }>; multi?: boolean; }>; } export declare const askToolRenderer: { renderCall(args: AskRenderArgs, _options: RenderResultOptions, uiTheme: Theme): Component; renderResult(result: { content: Array<{ type: string; text?: string; }>; details?: AskToolDetails; }, _options: RenderResultOptions, uiTheme: Theme): Component; };