feat: add AskUser tool schema (#16988)

This commit is contained in:
Jack Wotherspoon
2026-01-22 12:12:13 -05:00
committed by GitHub
parent 24e80fd227
commit 8705cf3c7d
4 changed files with 477 additions and 0 deletions
@@ -22,6 +22,8 @@ export enum MessageBusType {
HOOK_EXECUTION_RESPONSE = 'hook-execution-response',
HOOK_POLICY_DECISION = 'hook-policy-decision',
TOOL_CALLS_UPDATE = 'tool-calls-update',
ASK_USER_REQUEST = 'ask-user-request',
ASK_USER_RESPONSE = 'ask-user-response',
}
export interface ToolCallsUpdateMessage {
@@ -141,6 +143,42 @@ export interface HookPolicyDecision {
reason?: string;
}
export interface QuestionOption {
label: string;
description: string;
}
export enum QuestionType {
CHOICE = 'choice',
TEXT = 'text',
YESNO = 'yesno',
}
export interface Question {
question: string;
header: string;
/** Question type: 'choice' renders selectable options, 'text' renders free-form input, 'yesno' renders a binary Yes/No choice. Defaults to 'choice'. */
type?: QuestionType;
/** Available choices. Required when type is 'choice' (or omitted), ignored for 'text'. */
options?: QuestionOption[];
/** Allow multiple selections. Only applies to 'choice' type. */
multiSelect?: boolean;
/** Placeholder hint text for 'text' type input field. */
placeholder?: string;
}
export interface AskUserRequest {
type: MessageBusType.ASK_USER_REQUEST;
questions: Question[];
correlationId: string;
}
export interface AskUserResponse {
type: MessageBusType.ASK_USER_RESPONSE;
correlationId: string;
answers: { [questionIndex: string]: string };
}
export type Message =
| ToolConfirmationRequest
| ToolConfirmationResponse
@@ -151,4 +189,6 @@ export type Message =
| HookExecutionRequest
| HookExecutionResponse
| HookPolicyDecision
| AskUserRequest
| AskUserResponse
| ToolCallsUpdateMessage;