diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap index dd621b34b8..98ef98fcad 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap @@ -277,6 +277,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -284,6 +286,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -297,6 +302,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap index 3b8f357e8c..e665309432 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap @@ -174,6 +174,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -181,6 +183,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -194,6 +199,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap index 719e7f0ea7..bf9a0ef02f 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap @@ -348,6 +348,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -355,6 +357,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -368,6 +373,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap index 9f3ad102e8..7b3e18690c 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap @@ -348,6 +348,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -355,6 +357,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -368,6 +373,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap index 2c7e9ec165..b77b77e1e2 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap @@ -304,6 +304,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -311,6 +313,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -324,6 +329,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap index b4220ce2e8..2f2a41916d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap @@ -299,6 +299,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -306,6 +308,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap index 6248770325..1cf0529e19 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap @@ -352,6 +352,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -359,6 +361,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -372,6 +377,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap index b4220ce2e8..2f2a41916d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap @@ -299,6 +299,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -306,6 +308,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap index 1fce8bf785..6612df745e 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap @@ -387,6 +387,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -394,6 +396,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -407,6 +412,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap index b4220ce2e8..2f2a41916d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap @@ -299,6 +299,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -306,6 +308,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap index d07dc1d874..28b31eefcf 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap @@ -352,6 +352,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -359,6 +361,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -372,6 +377,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap index 9f3ad102e8..7b3e18690c 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap @@ -348,6 +348,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -355,6 +357,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -368,6 +373,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap index b4220ce2e8..2f2a41916d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap @@ -299,6 +299,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -306,6 +308,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -319,6 +324,16 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + + + ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. diff --git a/src/core/prompts/tools/ask-followup-question.ts b/src/core/prompts/tools/ask-followup-question.ts index 7ece1e311d..c69e5a697f 100644 --- a/src/core/prompts/tools/ask-followup-question.ts +++ b/src/core/prompts/tools/ask-followup-question.ts @@ -7,6 +7,8 @@ Parameters: 1. Be provided in its own tag 2. Be specific, actionable, and directly related to the completed task 3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details. DO NOT include placeholders with brackets or parentheses. + 4. Optionally include a mode attribute to switch to a specific mode when the suggestion is selected: suggestion text + - When using the mode attribute, focus the suggestion text on the action to be taken rather than mentioning the mode switch, as the mode change is handled automatically and indicated by a visual badge Usage: Your question here @@ -14,6 +16,9 @@ Usage: Your suggested answer here + +Implement the solution + @@ -25,5 +30,15 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil ./config/frontend-config.json ./frontend-config.json + + +Example: Asking a question with mode switching options + +How would you like to proceed with this task? + +Start implementing the solution +Plan the architecture first +Continue with more details + ` } diff --git a/src/core/tools/__tests__/askFollowupQuestionTool.spec.ts b/src/core/tools/__tests__/askFollowupQuestionTool.spec.ts new file mode 100644 index 0000000000..fbb9ef9eb3 --- /dev/null +++ b/src/core/tools/__tests__/askFollowupQuestionTool.spec.ts @@ -0,0 +1,108 @@ +import { describe, it, expect, vi } from "vitest" +import { askFollowupQuestionTool } from "../askFollowupQuestionTool" +import { ToolUse } from "../../../shared/tools" + +describe("askFollowupQuestionTool", () => { + let mockCline: any + let mockPushToolResult: any + let toolResult: any + + beforeEach(() => { + vi.clearAllMocks() + + mockCline = { + ask: vi.fn().mockResolvedValue({ text: "Test response" }), + say: vi.fn().mockResolvedValue(undefined), + consecutiveMistakeCount: 0, + } + + mockPushToolResult = vi.fn((result) => { + toolResult = result + }) + }) + + it("should parse suggestions without mode attributes", async () => { + const block: ToolUse = { + type: "tool_use", + name: "ask_followup_question", + params: { + question: "What would you like to do?", + follow_up: "Option 1Option 2", + }, + partial: false, + } + + await askFollowupQuestionTool( + mockCline, + block, + vi.fn(), + vi.fn(), + mockPushToolResult, + vi.fn((tag, content) => content), + ) + + expect(mockCline.ask).toHaveBeenCalledWith( + "followup", + expect.stringContaining('"suggest":[{"answer":"Option 1"},{"answer":"Option 2"}]'), + false, + ) + }) + + it("should parse suggestions with mode attributes", async () => { + const block: ToolUse = { + type: "tool_use", + name: "ask_followup_question", + params: { + question: "What would you like to do?", + follow_up: 'Write codeDebug issue', + }, + partial: false, + } + + await askFollowupQuestionTool( + mockCline, + block, + vi.fn(), + vi.fn(), + mockPushToolResult, + vi.fn((tag, content) => content), + ) + + expect(mockCline.ask).toHaveBeenCalledWith( + "followup", + expect.stringContaining( + '"suggest":[{"answer":"Write code","mode":"code"},{"answer":"Debug issue","mode":"debug"}]', + ), + false, + ) + }) + + it("should handle mixed suggestions with and without mode attributes", async () => { + const block: ToolUse = { + type: "tool_use", + name: "ask_followup_question", + params: { + question: "What would you like to do?", + follow_up: 'Regular optionPlan architecture', + }, + partial: false, + } + + await askFollowupQuestionTool( + mockCline, + block, + vi.fn(), + vi.fn(), + mockPushToolResult, + vi.fn((tag, content) => content), + ) + + expect(mockCline.ask).toHaveBeenCalledWith( + "followup", + expect.stringContaining( + '"suggest":[{"answer":"Regular option"},{"answer":"Plan architecture","mode":"architect"}]', + ), + false, + ) + }) +}) diff --git a/src/core/tools/askFollowupQuestionTool.ts b/src/core/tools/askFollowupQuestionTool.ts index d5adf6d4cd..e736936887 100644 --- a/src/core/tools/askFollowupQuestionTool.ts +++ b/src/core/tools/askFollowupQuestionTool.ts @@ -26,7 +26,7 @@ export async function askFollowupQuestionTool( return } - type Suggest = { answer: string } + type Suggest = { answer: string; mode?: string } let follow_up_json = { question, @@ -34,12 +34,17 @@ export async function askFollowupQuestionTool( } if (follow_up) { + // Define the actual structure returned by the XML parser + type ParsedSuggestion = string | { "#text": string; "@_mode"?: string } + let parsedSuggest: { - suggest: Suggest[] | Suggest + suggest: ParsedSuggestion[] | ParsedSuggestion } try { - parsedSuggest = parseXml(follow_up, ["suggest"]) as { suggest: Suggest[] | Suggest } + parsedSuggest = parseXml(follow_up, ["suggest"]) as { + suggest: ParsedSuggestion[] | ParsedSuggestion + } } catch (error) { cline.consecutiveMistakeCount++ cline.recordToolError("ask_followup_question") @@ -48,9 +53,24 @@ export async function askFollowupQuestionTool( return } - const normalizedSuggest = Array.isArray(parsedSuggest?.suggest) + const rawSuggestions = Array.isArray(parsedSuggest?.suggest) ? parsedSuggest.suggest - : [parsedSuggest?.suggest].filter((sug): sug is Suggest => sug !== undefined) + : [parsedSuggest?.suggest].filter((sug): sug is ParsedSuggestion => sug !== undefined) + + // Transform parsed XML to our Suggest format + const normalizedSuggest: Suggest[] = rawSuggestions.map((sug) => { + if (typeof sug === "string") { + // Simple string suggestion (no mode attribute) + return { answer: sug } + } else { + // XML object with text content and optional mode attribute + const result: Suggest = { answer: sug["#text"] } + if (sug["@_mode"]) { + result.mode = sug["@_mode"] + } + return result + } + }) follow_up_json.suggest = normalizedSuggest } diff --git a/webview-ui/src/components/chat/FollowUpSuggest.tsx b/webview-ui/src/components/chat/FollowUpSuggest.tsx index 9f4c017e74..6e1ec58814 100644 --- a/webview-ui/src/components/chat/FollowUpSuggest.tsx +++ b/webview-ui/src/components/chat/FollowUpSuggest.tsx @@ -2,11 +2,17 @@ import { useCallback } from "react" import { Edit } from "lucide-react" import { Button, StandardTooltip } from "@/components/ui" +import { vscode } from "@/utils/vscode" import { useAppTranslation } from "@src/i18n/TranslationContext" +interface SuggestionItem { + answer: string + mode?: string +} + interface FollowUpSuggestProps { - suggestions?: string[] + suggestions?: (string | SuggestionItem)[] onSuggestionClick?: (answer: string, event?: React.MouseEvent) => void ts: number } @@ -14,8 +20,19 @@ interface FollowUpSuggestProps { export const FollowUpSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: FollowUpSuggestProps) => { const { t } = useAppTranslation() const handleSuggestionClick = useCallback( - (suggestion: string, event: React.MouseEvent) => { - onSuggestionClick?.(suggestion, event) + (suggestion: string | SuggestionItem, event: React.MouseEvent) => { + const suggestionText = typeof suggestion === "string" ? suggestion : suggestion.answer + const mode = typeof suggestion === "object" ? suggestion.mode : undefined + + // If there's a mode switch and it's not a shift-click (which just copies to input), switch modes first + if (mode && !event.shiftKey) { + vscode.postMessage({ + type: "mode", + text: mode, + }) + } + + onSuggestionClick?.(suggestionText, event) }, [onSuggestionClick], ) @@ -27,30 +44,41 @@ export const FollowUpSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: return (
- {suggestions.map((suggestion) => ( -
- - -
{ - e.stopPropagation() - // Simulate shift-click by directly calling the handler with shiftKey=true. - onSuggestionClick?.(suggestion, { ...e, shiftKey: true }) - }}> - -
-
-
- ))} + {suggestions.map((suggestion) => { + const suggestionText = typeof suggestion === "string" ? suggestion : suggestion.answer + const mode = typeof suggestion === "object" ? suggestion.mode : undefined + + return ( +
+ + {mode && ( +
+ + {mode} +
+ )} + +
{ + e.stopPropagation() + // Simulate shift-click by directly calling the handler with shiftKey=true. + onSuggestionClick?.(suggestionText, { ...e, shiftKey: true }) + }}> + +
+
+
+ ) + })}
) }