From c6c49ec8ce20a76e4ef8bbfaec7ef589894f0488 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Thu, 27 Mar 2025 16:36:04 -0700 Subject: [PATCH] Rename plan_mode_response to plan_mode_respond (#2498) * Rename plan_mode_response to plan_mode_respond * Create good-carrots-tie.md --- .changeset/good-carrots-tie.md | 5 +++++ src/core/Cline.ts | 16 ++++++++-------- src/core/assistant-message/index.ts | 2 +- src/core/prompts/system.ts | 12 ++++++------ src/shared/ExtensionMessage.ts | 2 +- webview-ui/src/components/chat/ChatRow.tsx | 4 ++-- webview-ui/src/components/chat/ChatView.tsx | 6 +++--- 7 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 .changeset/good-carrots-tie.md diff --git a/.changeset/good-carrots-tie.md b/.changeset/good-carrots-tie.md new file mode 100644 index 00000000..5896d7a0 --- /dev/null +++ b/.changeset/good-carrots-tie.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Fix bug where Cline would use plan_mode_response bug without response parameter diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 01d0a115..8bae9086 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1038,7 +1038,7 @@ export class Cline { : "" }` + (responseText - ? `\n\n${this.chatSettings?.mode === "plan" ? "New message to respond to with plan_mode_response tool (be sure to provide your response in the parameter)" : "New instructions for task continuation"}:\n\n${responseText}\n` + ? `\n\n${this.chatSettings?.mode === "plan" ? "New message to respond to with plan_mode_respond tool (be sure to provide your response in the parameter)" : "New instructions for task continuation"}:\n\n${responseText}\n` : this.chatSettings.mode === "plan" ? "(The user did not provide a new message. Consider asking them how they'd like you to proceed, or to switch to Act mode to continue with the task.)" : ""), @@ -1572,7 +1572,7 @@ export class Cline { return `[${block.name} for '${block.params.server_name}']` case "ask_followup_question": return `[${block.name} for '${block.params.question}']` - case "plan_mode_response": + case "plan_mode_respond": return `[${block.name}]` case "attempt_completion": return `[${block.name}]` @@ -2802,7 +2802,7 @@ export class Cline { break } } - case "plan_mode_response": { + case "plan_mode_respond": { const response: string | undefined = block.params.response const optionsRaw: string | undefined = block.params.options const sharedMessage = { @@ -2811,12 +2811,12 @@ export class Cline { } satisfies ClinePlanModeResponse try { if (block.partial) { - await this.ask("plan_mode_response", JSON.stringify(sharedMessage), block.partial).catch(() => {}) + await this.ask("plan_mode_respond", JSON.stringify(sharedMessage), block.partial).catch(() => {}) break } else { if (!response) { this.consecutiveMistakeCount++ - pushToolResult(await this.sayAndCreateMissingParamError("plan_mode_response", "response")) + pushToolResult(await this.sayAndCreateMissingParamError("plan_mode_respond", "response")) // break } @@ -2830,7 +2830,7 @@ export class Cline { // } this.isAwaitingPlanResponse = true - let { text, images } = await this.ask("plan_mode_response", JSON.stringify(sharedMessage), false) + let { text, images } = await this.ask("plan_mode_respond", JSON.stringify(sharedMessage), false) this.isAwaitingPlanResponse = false // webview invoke sendMessage will send this marker in order to put webview into the proper state (responding to an ask) and as a flag to extension that the user switched to ACT mode. @@ -2842,7 +2842,7 @@ export class Cline { if (optionsRaw && text && parsePartialArrayString(optionsRaw).includes(text)) { // Valid option selected, don't show user message in UI // Update last followup message with selected option - const lastPlanMessage = findLast(this.clineMessages, (m) => m.ask === "plan_mode_response") + const lastPlanMessage = findLast(this.clineMessages, (m) => m.ask === "plan_mode_respond") if (lastPlanMessage) { lastPlanMessage.text = JSON.stringify({ ...sharedMessage, @@ -3740,7 +3740,7 @@ export class Cline { if (this.chatSettings.mode === "plan") { details += "\nPLAN MODE" details += - "\nIn this mode you should focus on information gathering, asking questions, and architecting a solution. Once you have a plan, use the plan_mode_response tool to engage in a conversational back and forth with the user. Do not use the plan_mode_response tool until you've gathered all the information you need e.g. with read_file or ask_followup_question." + "\nIn this mode you should focus on information gathering, asking questions, and architecting a solution. Once you have a plan, use the plan_mode_respond tool to engage in a conversational back and forth with the user. Do not use the plan_mode_respond tool until you've gathered all the information you need e.g. with read_file or ask_followup_question." details += '\n(Remember: If it seems the user wants you to use tools only available in Act Mode, you should ask the user to "toggle to Act mode" (use those words) - they will have to manually do this themselves with the Plan/Act toggle button below. You do not have the ability to switch to Act Mode yourself, and must wait for the user to do it themselves once they are satisfied with the plan. You also cannot present an option to toggle to Act mode, as this will be something you need to direct the user to do manually themselves.)' } else { diff --git a/src/core/assistant-message/index.ts b/src/core/assistant-message/index.ts index 613f9b18..a659fc85 100644 --- a/src/core/assistant-message/index.ts +++ b/src/core/assistant-message/index.ts @@ -20,7 +20,7 @@ export const toolUseNames = [ "use_mcp_tool", "access_mcp_resource", "ask_followup_question", - "plan_mode_response", + "plan_mode_respond", "attempt_completion", ] as const diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index c3b3739c..524f4712 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -239,18 +239,18 @@ Your final result description here Command to demonstrate result (optional) -## plan_mode_response +## plan_mode_respond Description: Respond to the user's inquiry in an effort to plan a solution to the user's task. This tool should be used when you need to provide a response to a question or statement from the user about how you plan to accomplish the task. This tool is only available in PLAN MODE. The environment_details will specify the current mode, if it is not PLAN MODE then you should not use this tool. Depending on the user's message, you may ask questions to get clarification about the user's request, architect a solution to the task, and to brainstorm ideas with the user. For example, if the user's task is to create a website, you may start by asking some clarifying questions, then present a detailed plan for how you will accomplish the task given the context, and perhaps engage in a back and forth to finalize the details before the user switches you to ACT MODE to implement the solution. Parameters: - response: (required) The response to provide to the user. Do not try to use tools in this parameter, this is simply a chat response. - options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible choice or path forward in the planning process. This can help guide the discussion and make it easier for the user to provide input on key decisions. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. Do NOT present an option to toggle to Act mode, as this will be something you need to direct the user to do manually themselves. Usage: - + Your response here Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"] - + # Tool Use Examples @@ -881,11 +881,11 @@ ACT MODE V.S. PLAN MODE In each user message, the environment_details will specify the current mode. There are two modes: -- ACT MODE: In this mode, you have access to all tools EXCEPT the plan_mode_response tool. +- ACT MODE: In this mode, you have access to all tools EXCEPT the plan_mode_respond tool. - In ACT MODE, you use tools to accomplish the user's task. Once you've completed the user's task, you use the attempt_completion tool to present the result of the task to the user. -- PLAN MODE: In this special mode, you have access to the plan_mode_response tool. +- PLAN MODE: In this special mode, you have access to the plan_mode_respond tool. - In PLAN MODE, the goal is to gather information and get context to create a detailed plan for accomplishing the task, which the user will review and approve before they switch you to ACT MODE to implement the solution. - - In PLAN MODE, when you need to converse with the user or present a plan, you should use the plan_mode_response tool to deliver your response directly, rather than using tags to analyze when to respond. Do not talk about using plan_mode_response - just use it directly to share your thoughts and provide helpful answers. + - In PLAN MODE, when you need to converse with the user or present a plan, you should use the plan_mode_respond tool to deliver your response directly, rather than using tags to analyze when to respond. Do not talk about using plan_mode_respond - just use it directly to share your thoughts and provide helpful answers. ## What is PLAN MODE? diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 1be79d4c..e6149322 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -130,7 +130,7 @@ export interface ClineMessage { export type ClineAsk = | "followup" - | "plan_mode_response" + | "plan_mode_respond" | "command" | "command_output" | "completion_result" diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 3a184cb1..759da75e 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1210,7 +1210,7 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi ) - case "plan_mode_response": { + case "plan_mode_respond": { let response: string | undefined let options: string[] | undefined let selected: string | undefined @@ -1229,7 +1229,7 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi ) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 7b41b880..596fba41 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -119,9 +119,9 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie // setPrimaryButtonText(undefined) // setSecondaryButtonText(undefined) break - case "plan_mode_response": + case "plan_mode_respond": setTextAreaDisabled(isPartial) - setClineAsk("plan_mode_response") + setClineAsk("plan_mode_respond") setEnableButtons(false) // setPrimaryButtonText(undefined) // setSecondaryButtonText(undefined) @@ -285,7 +285,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie } else if (clineAsk) { switch (clineAsk) { case "followup": - case "plan_mode_response": + case "plan_mode_respond": case "tool": case "browser_action_launch": case "command": // user can provide feedback to a tool or command use