Skip to content

Commit b4465a5

Browse files
committed
🤖 feat: add ask_user_question interactive plan-mode tool
Change-Id: I84e7c504ff312915a9e0fdeae4e6d4e30e1d9aa1 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 3e9740e commit b4465a5

File tree

14 files changed

+1112
-2
lines changed

14 files changed

+1112
-2
lines changed

src/browser/components/Messages/ToolMessage.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { GenericToolCall } from "../tools/GenericToolCall";
55
import { BashToolCall } from "../tools/BashToolCall";
66
import { FileEditToolCall } from "../tools/FileEditToolCall";
77
import { FileReadToolCall } from "../tools/FileReadToolCall";
8+
import { AskUserQuestionToolCall } from "../tools/AskUserQuestionToolCall";
89
import { ProposePlanToolCall } from "../tools/ProposePlanToolCall";
910
import { TodoToolCall } from "../tools/TodoToolCall";
1011
import { StatusSetToolCall } from "../tools/StatusSetToolCall";
@@ -29,6 +30,8 @@ import type {
2930
FileEditReplaceStringToolResult,
3031
FileEditReplaceLinesToolArgs,
3132
FileEditReplaceLinesToolResult,
33+
AskUserQuestionToolArgs,
34+
AskUserQuestionToolResult,
3235
ProposePlanToolArgs,
3336
ProposePlanToolResult,
3437
TodoWriteToolArgs,
@@ -90,6 +93,11 @@ function isFileEditInsertTool(toolName: string, args: unknown): args is FileEdit
9093
return TOOL_DEFINITIONS.file_edit_insert.schema.safeParse(args).success;
9194
}
9295

96+
function isAskUserQuestionTool(toolName: string, args: unknown): args is AskUserQuestionToolArgs {
97+
if (toolName !== "ask_user_question") return false;
98+
return TOOL_DEFINITIONS.ask_user_question.schema.safeParse(args).success;
99+
}
100+
93101
function isProposePlanTool(toolName: string, args: unknown): args is ProposePlanToolArgs {
94102
if (toolName !== "propose_plan") return false;
95103
return TOOL_DEFINITIONS.propose_plan.schema.safeParse(args).success;
@@ -213,6 +221,20 @@ export const ToolMessage: React.FC<ToolMessageProps> = ({
213221
);
214222
}
215223

224+
if (isAskUserQuestionTool(message.toolName, message.args)) {
225+
return (
226+
<div className={className}>
227+
<AskUserQuestionToolCall
228+
args={message.args}
229+
result={(message.result as AskUserQuestionToolResult | undefined) ?? null}
230+
status={message.status}
231+
toolCallId={message.toolCallId}
232+
workspaceId={workspaceId}
233+
/>
234+
</div>
235+
);
236+
}
237+
216238
if (isProposePlanTool(message.toolName, message.args)) {
217239
return (
218240
<div className={className}>

0 commit comments

Comments
 (0)