fix(plan): make question type required in AskUser tool (#18959)

This commit is contained in:
Adib234
2026-02-13 10:03:52 -05:00
committed by GitHub
parent b61a123da8
commit d5dfae6bbf
5 changed files with 77 additions and 29 deletions
+4 -6
View File
@@ -42,7 +42,7 @@ export class AskUserTool extends BaseDeclarativeTool<
maxItems: 4,
items: {
type: 'object',
required: ['question', 'header'],
required: ['question', 'header', 'type'],
properties: {
question: {
type: 'string',
@@ -111,7 +111,7 @@ export class AskUserTool extends BaseDeclarativeTool<
for (let i = 0; i < params.questions.length; i++) {
const q = params.questions[i];
const questionType = q.type ?? QuestionType.CHOICE;
const questionType = q.type;
// Validate that 'choice' type has options
if (questionType === QuestionType.CHOICE) {
@@ -186,7 +186,7 @@ export class AskUserInvocation extends BaseToolInvocation<
): Promise<ToolAskUserConfirmationDetails | false> {
const normalizedQuestions = this.params.questions.map((q) => ({
...q,
type: q.type ?? QuestionType.CHOICE,
type: q.type,
}));
return {
@@ -210,9 +210,7 @@ export class AskUserInvocation extends BaseToolInvocation<
}
async execute(_signal: AbortSignal): Promise<ToolResult> {
const questionTypes = this.params.questions.map(
(q) => q.type ?? QuestionType.CHOICE,
);
const questionTypes = this.params.questions.map((q) => q.type);
if (this.confirmationOutcome === ToolConfirmationOutcome.Cancel) {
return {