From 99f02e907fba4d1f4d13ea5f26b9066d146ee23b Mon Sep 17 00:00:00 2001 From: sam hoang Date: Fri, 21 Feb 2025 10:10:36 +0700 Subject: [PATCH 01/16] feat: add next step suggestions and XML utilities - Add NextStepSuggest component for displaying suggested next steps - Add XML utilities for improved XML parsing - Update ChatView and ChatRow to handle next step suggestions - Add fast-xml-parser dependency - Update package dependencies update snapshoot feat(ui): enhance next step suggestions UX and documentation - Improve next step UI with collapsible view and show more/less toggle - Add type validation and error handling for suggestion parsing - Update documentation with clearer formatting guidelines and examples - Enhance button styling and accessibility for better user interaction update snapshot refactor: move next step suggestions into chat row for better UX feat: enhance next step suggestions with mode selection - Make next_step parameter required in attempt_completion tool - Update suggestion format to include task and mode fields - Enhance UI to display mode alongside task description - Update parsing logic to handle new suggestion format - Improve error handling for missing or invalid suggestions refactor(NextStepSuggest): improve component with shadcn UI and better styling - Replace native buttons with shadcn Button component - Increase button dimensions for better readability - Add proper text wrapping and overflow handling - Style mode text as VSCode badge - Improve hover and active states - Maintain VSCode theming integration - Show 3 suggestions in non-expanded mode --- package-lock.json | 30 +++++- package.json | 1 + src/core/Cline.ts | 43 +++++++- src/core/assistant-message/index.ts | 3 +- .../__snapshots__/system.test.ts.snap | 72 ++++++------- src/core/prompts/responses.ts | 9 +- src/core/prompts/sections/objective.ts | 4 +- src/core/prompts/sections/rules.ts | 2 +- src/core/prompts/system.ts | 2 +- src/core/prompts/tools/attempt-completion.ts | 96 +++++++++++++++-- src/core/prompts/tools/index.ts | 3 +- src/core/prompts/tools/types.ts | 1 + src/shared/ExtensionMessage.ts | 2 + src/shared/experiments.ts | 7 ++ src/utils/xml.ts | 30 ++++++ webview-ui/src/components/chat/ChatRow.tsx | 15 +++ webview-ui/src/components/chat/ChatView.tsx | 40 ++++++- .../src/components/chat/NextStepSuggest.tsx | 100 ++++++++++++++++++ 18 files changed, 401 insertions(+), 59 deletions(-) create mode 100644 src/utils/xml.ts create mode 100644 webview-ui/src/components/chat/NextStepSuggest.tsx diff --git a/package-lock.json b/package-lock.json index 0e3e29d44e..b888400875 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "diff": "^5.2.0", "diff-match-patch": "^1.0.5", "fast-deep-equal": "^3.1.3", + "fast-xml-parser": "^4.5.1", "fastest-levenshtein": "^1.0.16", "get-folder-size": "^5.0.0", "globby": "^14.0.2", @@ -1450,6 +1451,28 @@ "node": ">=16.0.0" } }, + "node_modules/@aws-sdk/core/node_modules/fast-xml-parser": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", + "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/@aws-sdk/core/node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -8618,9 +8641,9 @@ "dev": true }, "node_modules/fast-xml-parser": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", - "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.1.tgz", + "integrity": "sha512-y655CeyUQ+jj7KBbYMc4FG01V8ZQqjN+gDYGJ50RtfsUB8iG9AmwmwoAgeKLJdmueKKMrH1RJ7yXHTSoczdv5w==", "funding": [ { "type": "github", @@ -8631,6 +8654,7 @@ "url": "https://paypal.me/naturalintelligence" } ], + "license": "MIT", "dependencies": { "strnum": "^1.0.5" }, diff --git a/package.json b/package.json index 5e75c57ad4..64e17efb37 100644 --- a/package.json +++ b/package.json @@ -331,6 +331,7 @@ "diff": "^5.2.0", "diff-match-patch": "^1.0.5", "fast-deep-equal": "^3.1.3", + "fast-xml-parser": "^4.5.1", "fastest-levenshtein": "^1.0.16", "get-folder-size": "^5.0.0", "globby": "^14.0.2", diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 2b98f387b8..034329edc3 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -64,6 +64,7 @@ import { McpHub } from "../services/mcp/McpHub" import crypto from "crypto" import { insertGroups } from "./diff/insert-groups" import { EXPERIMENT_IDS, experiments as Experiments, ExperimentId } from "../shared/experiments" +import { parseXml } from "../utils/xml" const cwd = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ?? path.join(os.homedir(), "Desktop") // may or may not exist but fs checking existence would immediately ask for permission which would be bad UX, need to come up with a better solution @@ -2659,6 +2660,7 @@ export class Cline { */ const result: string | undefined = block.params.result const command: string | undefined = block.params.command + const next_step: string | undefined = block.params.next_step try { const lastMessage = this.clineMessages.at(-1) if (block.partial) { @@ -2707,8 +2709,44 @@ export class Cline { ) break } + + if (!next_step) { + this.consecutiveMistakeCount++ + pushToolResult( + await this.sayAndCreateMissingParamError("attempt_completion", "next_step"), + ) + break + } + + let normalizedSuggest = null + + type Suggest = { + task: string + mode: string + } + + let parsedSuggest: { + suggest: Suggest[] | Suggest + } + + try { + parsedSuggest = parseXml(next_step, ["suggest.task", "suggest.mode"]) as { + suggest: Suggest[] | Suggest + } + console.log("next_step", next_step) + } catch (error) { + this.consecutiveMistakeCount++ + await this.say("error", `Failed to parse operations: ${error.message}`) + pushToolResult(formatResponse.toolError("Invalid operations xml format")) + break + } + this.consecutiveMistakeCount = 0 + normalizedSuggest = Array.isArray(parsedSuggest?.suggest) + ? parsedSuggest.suggest + : [parsedSuggest?.suggest].filter((sug): sug is Suggest => sug !== undefined) + let commandResult: ToolResponse | undefined if (command) { if (lastMessage && lastMessage.ask !== "command") { @@ -2733,6 +2771,10 @@ export class Cline { await this.say("completion_result", result, undefined, false) } + const toolResults: (Anthropic.TextBlockParam | Anthropic.ImageBlockParam)[] = [] + + await this.say("next_step_suggest", JSON.stringify(normalizedSuggest)) + // we already sent completion_result says, an empty string asks relinquishes control over button and field const { response, text, images } = await this.ask("completion_result", "", false) if (response === "yesButtonClicked") { @@ -2741,7 +2783,6 @@ export class Cline { } await this.say("user_feedback", text ?? "", images) - const toolResults: (Anthropic.TextBlockParam | Anthropic.ImageBlockParam)[] = [] if (commandResult) { if (typeof commandResult === "string") { toolResults.push({ type: "text", text: commandResult }) diff --git a/src/core/assistant-message/index.ts b/src/core/assistant-message/index.ts index f1c49f85ab..6c3532025b 100644 --- a/src/core/assistant-message/index.ts +++ b/src/core/assistant-message/index.ts @@ -56,6 +56,7 @@ export const toolParamNames = [ "operations", "mode", "message", + "next_step", ] as const export type ToolParamName = (typeof toolParamNames)[number] @@ -126,7 +127,7 @@ export interface AskFollowupQuestionToolUse extends ToolUse { export interface AttemptCompletionToolUse extends ToolUse { name: "attempt_completion" - params: Partial, "result" | "command">> + params: Partial, "result" | "command" | "next_step">> } export interface SwitchModeToolUse extends ToolUse { diff --git a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap index 291745fcd1..1cc7e0aed6 100644 --- a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap +++ b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap @@ -173,10 +173,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -306,7 +306,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -496,10 +496,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -629,7 +629,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -819,10 +819,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -952,7 +952,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -1188,10 +1188,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -1324,7 +1324,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -1563,10 +1563,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -2060,7 +2060,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -2296,10 +2296,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -2432,7 +2432,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -2682,10 +2682,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -2817,7 +2817,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -3007,10 +3007,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -3140,7 +3140,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -3421,10 +3421,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -3564,7 +3564,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -3755,10 +3755,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -3888,7 +3888,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -4040,10 +4040,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -4173,7 +4173,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -4445,10 +4445,10 @@ Your final result description here Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS +I've updated the CSS styling for the navigation menu open index.html @@ -4942,7 +4942,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/responses.ts b/src/core/prompts/responses.ts index f06dff3d88..26a71f62e3 100644 --- a/src/core/prompts/responses.ts +++ b/src/core/prompts/responses.ts @@ -127,10 +127,9 @@ Tool uses are formatted using XML-style tags. The tool name is enclosed in openi For example: - - -I have completed the task... - - +Example: Requesting to read frontend-config.json + +frontend-config.json + Always adhere to this format for all tool uses to ensure proper parsing and execution.` diff --git a/src/core/prompts/sections/objective.ts b/src/core/prompts/sections/objective.ts index 66cefce885..3e0add3c7f 100644 --- a/src/core/prompts/sections/objective.ts +++ b/src/core/prompts/sections/objective.ts @@ -1,4 +1,4 @@ -export function getObjectiveSection(): string { +export function getObjectiveSection(experiments?: Record): string { return `==== OBJECTIVE @@ -8,6 +8,6 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. ${experiments?.["next_step_suggest"] ? "You must provide next step for user via attempt_completion tool by suggest next step" : ""} 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.` } diff --git a/src/core/prompts/sections/rules.ts b/src/core/prompts/sections/rules.ts index 86e554a157..97ff96d96d 100644 --- a/src/core/prompts/sections/rules.ts +++ b/src/core/prompts/sections/rules.ts @@ -75,7 +75,7 @@ ${getEditingInstructions(diffStrategy, experiments)} - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. ${experiments?.["next_step_suggest"] ? "You must provide for user next step with attempt_completion tool. " : ""}The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index 90791f6358..101fc50f12 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -86,7 +86,7 @@ ${getRulesSection(cwd, supportsComputerUse, effectiveDiffStrategy, experiments)} ${getSystemInfoSection(cwd, mode, customModeConfigs)} -${getObjectiveSection()} +${getObjectiveSection(experiments)} ${await addCustomInstructions(promptComponent?.customInstructions || modeConfig.customInstructions || "", globalCustomInstructions || "", cwd, mode, { preferredLanguage })}` diff --git a/src/core/prompts/tools/attempt-completion.ts b/src/core/prompts/tools/attempt-completion.ts index 4418c8dc71..b7ca19ce5f 100644 --- a/src/core/prompts/tools/attempt-completion.ts +++ b/src/core/prompts/tools/attempt-completion.ts @@ -1,23 +1,105 @@ -export function getAttemptCompletionDescription(): string { +import { ToolArgs } from "./types" + +export function getAttemptCompletionDescription({ experiments }: ToolArgs): string { return `## 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. Optionally you may provide a CLI command to showcase the result of your work. 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. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. -- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.${ + experiments?.["next_step_suggest"] + ? ` +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions` + : `` + } Usage: Your final result description here - +${ + experiments?.["next_step_suggest"] + ? ` + + +Implement authentication service tests +code + +` + : `` + } Command to demonstrate result (optional) -Example: Requesting to attempt completion with a result and command +Example: Basic completion with result and command -I've updated the CSS - +I've updated the CSS styling for the navigation menu +${ + experiments?.["next_step_suggest"] + ? ` + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + +` + : "" + } open index.html -` +${ + experiments?.["next_step_suggest"] + ? ` + +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type` + : `` + }` } diff --git a/src/core/prompts/tools/index.ts b/src/core/prompts/tools/index.ts index 1b9b9a43d9..8719f8dff0 100644 --- a/src/core/prompts/tools/index.ts +++ b/src/core/prompts/tools/index.ts @@ -29,7 +29,7 @@ const toolDescriptionMap: Record string | undefined> list_code_definition_names: (args) => getListCodeDefinitionNamesDescription(args), browser_action: (args) => getBrowserActionDescription(args), ask_followup_question: () => getAskFollowupQuestionDescription(), - attempt_completion: () => getAttemptCompletionDescription(), + attempt_completion: (args) => getAttemptCompletionDescription(args), use_mcp_tool: (args) => getUseMcpToolDescription(args), access_mcp_resource: (args) => getAccessMcpResourceDescription(args), switch_mode: () => getSwitchModeDescription(), @@ -57,6 +57,7 @@ export function getToolDescriptionsForMode( diffStrategy, browserViewportSize, mcpHub, + experiments, } const tools = new Set() diff --git a/src/core/prompts/tools/types.ts b/src/core/prompts/tools/types.ts index 2c2a60dd2a..9c1da644a2 100644 --- a/src/core/prompts/tools/types.ts +++ b/src/core/prompts/tools/types.ts @@ -8,4 +8,5 @@ export type ToolArgs = { browserViewportSize?: string mcpHub?: McpHub toolOptions?: any + experiments?: Record } diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 34abd38dbf..1635e351ad 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -156,6 +156,7 @@ export type ClineAsk = | "mistake_limit_reached" | "browser_action_launch" | "use_mcp_server" + | "next_step_suggest" export type ClineSay = | "task" @@ -181,6 +182,7 @@ export type ClineSay = | "new_task_started" | "new_task" | "checkpoint_saved" + | "next_step_suggest" export interface ClineSayTool { tool: diff --git a/src/shared/experiments.ts b/src/shared/experiments.ts index 2f946283c0..46c9b0d1d0 100644 --- a/src/shared/experiments.ts +++ b/src/shared/experiments.ts @@ -3,6 +3,7 @@ export const EXPERIMENT_IDS = { SEARCH_AND_REPLACE: "search_and_replace", INSERT_BLOCK: "insert_content", POWER_STEERING: "powerSteering", + NEXT_STEP_SUGGEST: "next_step_suggest", } as const export type ExperimentKey = keyof typeof EXPERIMENT_IDS @@ -42,6 +43,12 @@ export const experimentConfigsMap: Record = { "When enabled, Roo will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message.", enabled: false, }, + NEXT_STEP_SUGGEST: { + name: "Use experimental next step suggest tool", + description: + "Enable the experimental next step suggest tool, allowing Roo to suggest prompts at task complete for you.", + enabled: false, + }, } export const experimentDefault = Object.fromEntries( diff --git a/src/utils/xml.ts b/src/utils/xml.ts new file mode 100644 index 0000000000..8ccd6e77ae --- /dev/null +++ b/src/utils/xml.ts @@ -0,0 +1,30 @@ +import { XMLParser } from "fast-xml-parser" + +/** + * Parses an XML string into a JavaScript object + * @param xmlString The XML string to parse + * @returns Parsed JavaScript object representation of the XML + * @throws Error if the XML is invalid or parsing fails + */ +export function parseXml(xmlString: string, stopNodes?: string[]): unknown { + const _stopNodes = stopNodes ?? [] + try { + const parser = new XMLParser({ + // Preserve attribute types (don't convert numbers/booleans) + ignoreAttributes: false, + attributeNamePrefix: "@_", + // Parse numbers and booleans in text nodes + parseAttributeValue: true, + parseTagValue: true, + // Trim whitespace from text nodes + trimValues: true, + stopNodes: _stopNodes, + }) + + return parser.parse(xmlString) + } catch (error) { + // Enhance error message for better debugging + const errorMessage = error instanceof Error ? error.message : "Unknown error" + throw new Error(`Failed to parse XML: ${errorMessage}`) + } +} diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 1533bba3a8..ea73b7f943 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -22,6 +22,7 @@ import McpResourceRow from "../mcp/McpResourceRow" import McpToolRow from "../mcp/McpToolRow" import { highlightMentions } from "./TaskHeader" import { CheckpointSaved } from "./checkpoints/CheckpointSaved" +import NextStepSuggest from "./NextStepSuggest" interface ChatRowProps { message: ClineMessage @@ -31,6 +32,8 @@ interface ChatRowProps { isStreaming: boolean onToggleExpand: () => void onHeightChange: (isTaller: boolean) => void + onSuggestionClick?: (task: string, mode: string) => void + suggestions?: { task: string; mode: string }[] } interface ChatRowContentProps extends Omit {} @@ -77,6 +80,8 @@ export const ChatRowContent = ({ isLast, isStreaming, onToggleExpand, + onSuggestionClick, + suggestions, }: ChatRowContentProps) => { const { mcpServers, alwaysAllowMcp, currentCheckpoint } = useExtensionState() const [reasoningCollapsed, setReasoningCollapsed] = useState(true) @@ -215,6 +220,14 @@ export const ChatRowContent = ({ style={{ color: normalColor, marginBottom: "-1.5px" }}>, Roo has a question:, ] + case "next_step_suggest": { + return [ + , + Roo has suggest prompt:, + ] + } default: return [null, null] } @@ -738,6 +751,8 @@ export const ChatRowContent = ({ checkpoint={message.checkpoint} /> ) + case "next_step_suggest": + return default: return ( <> diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index fe0dc7e168..f88b627475 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -88,6 +88,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie const [isAtBottom, setIsAtBottom] = useState(false) const [wasStreaming, setWasStreaming] = useState(false) + const [nextStepSuggest, setNextStepSuggest] = useState<{ task: string; mode: string }[]>([]) // UI layout depends on the last 2 messages // (since it relies on the content of these messages, we are deep comparing. i.e. the button state after hitting button sets enableButtons to false, and this effect otherwise would have to true again even if messages didn't change @@ -225,9 +226,31 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setTextAreaDisabled(true) setSelectedImages([]) setClineAsk(undefined) + setNextStepSuggest([]) setEnableButtons(false) } break + case "next_step_suggest": { + const isPartial = lastMessage.partial === true + if (!isPartial) { + let suggestions: { task: string; mode: string }[] = [] + try { + const parsed = JSON.parse(lastMessage.text ?? "[]") + if (Array.isArray(parsed)) { + suggestions = parsed.filter( + (item) => typeof item === "object" && item.task && item.mode, + ) + } else { + console.warn("Next step suggestions must be an array of strings") + } + } catch (error) { + console.error("Failed to parse next step suggestions:", error) + suggestions = [] + } + setNextStepSuggest(suggestions) + } + break + } case "api_req_finished": case "task": case "error": @@ -257,6 +280,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie if (messages.length === 0) { setTextAreaDisabled(false) setClineAsk(undefined) + setNextStepSuggest([]) setEnableButtons(false) setPrimaryButtonText(undefined) setSecondaryButtonText(undefined) @@ -331,6 +355,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setSelectedImages([]) setClineAsk(undefined) setEnableButtons(false) + setNextStepSuggest([]) // Do not reset mode here as it should persist // setPrimaryButtonText(undefined) // setSecondaryButtonText(undefined) @@ -394,6 +419,11 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie case "completion_result": case "resume_completed_task": // extension waiting for feedback. but we can just present a new task button + if (inputValue.trim() !== "") { + vscode.postMessage({ type: "newTask", text: inputValue }) + setInputValue("") + break + } startNewTask() break } @@ -401,8 +431,9 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setClineAsk(undefined) setEnableButtons(false) disableAutoScrollRef.current = false + setNextStepSuggest([]) }, - [clineAsk, startNewTask], + [clineAsk, inputValue, startNewTask], ) const handleSecondaryButtonClick = useCallback( @@ -447,6 +478,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setTextAreaDisabled(true) setClineAsk(undefined) setEnableButtons(false) + setNextStepSuggest([]) disableAutoScrollRef.current = false }, [clineAsk, startNewTask, isStreaming], @@ -923,6 +955,10 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie isLast={index === groupedMessages.length - 1} onHeightChange={handleRowHeightChange} isStreaming={isStreaming} + onSuggestionClick={(task: string, mode: string) => { + handleSendMessage(`create new task for ${task} by using new_task tool in ${mode} mode`, []) + }} + suggestions={nextStepSuggest} /> ) }, @@ -932,7 +968,9 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie groupedMessages.length, handleRowHeightChange, isStreaming, + nextStepSuggest, toggleRowExpansion, + handleSendMessage, ], ) diff --git a/webview-ui/src/components/chat/NextStepSuggest.tsx b/webview-ui/src/components/chat/NextStepSuggest.tsx new file mode 100644 index 0000000000..b1be17998a --- /dev/null +++ b/webview-ui/src/components/chat/NextStepSuggest.tsx @@ -0,0 +1,100 @@ +import { useCallback, useState } from "react" +import { cn } from "../../lib/utils" +import { Button } from "../ui/button" + +interface NextStepSuggestProps { + suggestions?: { task: string; mode: string }[] + onSuggestionClick?: (task: string, mode: string) => void +} + +const NextStepSuggest = ({ suggestions, onSuggestionClick }: NextStepSuggestProps) => { + const [isExpanded, setIsExpanded] = useState(false) + + const handleSuggestionClick = useCallback( + (suggestion: { task: string; mode: string }) => { + onSuggestionClick?.(suggestion.task, suggestion.mode) + }, + [onSuggestionClick], + ) + + const toggleExpanded = useCallback(() => { + setIsExpanded((prev) => !prev) + }, []) + + // Don't render if there are no suggestions or no click handler + if (!suggestions?.length || !onSuggestionClick) { + return null + } + + const displaySuggestions = isExpanded ? suggestions : suggestions.slice(0, 3) + const showToggle = suggestions.length > 2 + + return ( + + ) +} + +export default NextStepSuggest From 1818ecdde98ceb06ac409a6f3e64e28e8741d048 Mon Sep 17 00:00:00 2001 From: sam hoang Date: Fri, 21 Feb 2025 15:49:00 +0700 Subject: [PATCH 02/16] feat: make next step suggestions official - Remove next_step_suggest from experiments - Make next step suggestions a required parameter in attempt_completion - Update documentation to reflect next step suggestions as core functionality - Remove experimental conditionals from objective and rules sections --- src/core/prompts/sections/objective.ts | 4 +-- src/core/prompts/sections/rules.ts | 2 +- src/core/prompts/tools/attempt-completion.ts | 33 ++++++-------------- src/shared/experiments.ts | 7 ----- 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/core/prompts/sections/objective.ts b/src/core/prompts/sections/objective.ts index 3e0add3c7f..1d9222f360 100644 --- a/src/core/prompts/sections/objective.ts +++ b/src/core/prompts/sections/objective.ts @@ -1,4 +1,4 @@ -export function getObjectiveSection(experiments?: Record): string { +export function getObjectiveSection(_?: Record): string { return `==== OBJECTIVE @@ -8,6 +8,6 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. ${experiments?.["next_step_suggest"] ? "You must provide next step for user via attempt_completion tool by suggest next step" : ""} +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.` } diff --git a/src/core/prompts/sections/rules.ts b/src/core/prompts/sections/rules.ts index 97ff96d96d..12b98e7403 100644 --- a/src/core/prompts/sections/rules.ts +++ b/src/core/prompts/sections/rules.ts @@ -75,7 +75,7 @@ ${getEditingInstructions(diffStrategy, experiments)} - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. ${experiments?.["next_step_suggest"] ? "You must provide for user next step with attempt_completion tool. " : ""}The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. diff --git a/src/core/prompts/tools/attempt-completion.ts b/src/core/prompts/tools/attempt-completion.ts index b7ca19ce5f..046aa1e01d 100644 --- a/src/core/prompts/tools/attempt-completion.ts +++ b/src/core/prompts/tools/attempt-completion.ts @@ -1,38 +1,31 @@ import { ToolArgs } from "./types" -export function getAttemptCompletionDescription({ experiments }: ToolArgs): string { +export function getAttemptCompletionDescription(_: ToolArgs): string { return `## 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. Optionally you may provide a CLI command to showcase the result of your work. 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. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. -- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.${ - experiments?.["next_step_suggest"] - ? ` +- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. - next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: 1. Be provided in its own tag with two fields: - task: The description of the suggested task - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") 2. Be specific, actionable, and directly related to the completed task 3. Be ordered by priority or logical sequence - 4. Provide minimum 2-4 suggestions and maximum 12 suggestions` - : `` - } + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here -${ - experiments?.["next_step_suggest"] - ? ` + Implement authentication service tests code -` - : `` - } + Command to demonstrate result (optional) @@ -40,9 +33,7 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu -${ - experiments?.["next_step_suggest"] - ? ` + Add responsive design breakpoints for mobile devices @@ -56,13 +47,9 @@ I've updated the CSS styling for the navigation menu Create documentation for styling guidelines architect -` - : "" - } + open index.html -${ - experiments?.["next_step_suggest"] - ? ` + Example: Completion with next step suggestions @@ -100,6 +87,4 @@ Note: When providing next step suggestions: 3. Provide minimum 2-4 suggestions and maximum 12 suggestions 4. Make each suggestion specific and actionable 5. Include appropriate mode for each suggestion based on the task type` - : `` - }` } diff --git a/src/shared/experiments.ts b/src/shared/experiments.ts index 46c9b0d1d0..2f946283c0 100644 --- a/src/shared/experiments.ts +++ b/src/shared/experiments.ts @@ -3,7 +3,6 @@ export const EXPERIMENT_IDS = { SEARCH_AND_REPLACE: "search_and_replace", INSERT_BLOCK: "insert_content", POWER_STEERING: "powerSteering", - NEXT_STEP_SUGGEST: "next_step_suggest", } as const export type ExperimentKey = keyof typeof EXPERIMENT_IDS @@ -43,12 +42,6 @@ export const experimentConfigsMap: Record = { "When enabled, Roo will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message.", enabled: false, }, - NEXT_STEP_SUGGEST: { - name: "Use experimental next step suggest tool", - description: - "Enable the experimental next step suggest tool, allowing Roo to suggest prompts at task complete for you.", - enabled: false, - }, } export const experimentDefault = Object.fromEntries( From 659ad383fc3a9e74d5e8f27656cbb006bb1c459d Mon Sep 17 00:00:00 2001 From: sam hoang Date: Fri, 21 Feb 2025 16:17:28 +0700 Subject: [PATCH 03/16] update snapshoot --- .../__snapshots__/system.test.ts.snap | 828 +++++++++++++++++- 1 file changed, 804 insertions(+), 24 deletions(-) diff --git a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap index 1cc7e0aed6..ab4446167c 100644 --- a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap +++ b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap @@ -165,11 +165,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -178,9 +192,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -273,7 +338,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -306,7 +371,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -488,11 +553,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -501,9 +580,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -596,7 +726,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -629,7 +759,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -811,11 +941,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -824,9 +968,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -919,7 +1114,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -952,7 +1147,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -1180,11 +1375,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -1193,9 +1402,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -1290,7 +1550,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -1324,7 +1584,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -1555,11 +1815,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -1568,9 +1842,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -2027,7 +2352,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -2060,7 +2385,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -2288,11 +2613,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -2301,9 +2640,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -2398,7 +2788,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -2432,7 +2822,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -2674,11 +3064,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -2687,9 +3091,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -2784,7 +3239,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -2817,7 +3272,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -2999,11 +3454,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -3012,9 +3481,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -3107,7 +3627,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -3140,7 +3660,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -3413,11 +3933,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -3426,9 +3960,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -3531,7 +4116,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -3564,7 +4149,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -3747,11 +4332,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -3760,9 +4359,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -3855,7 +4505,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -3888,7 +4538,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -4032,11 +4682,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -4045,9 +4709,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -4140,7 +4855,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -4173,7 +4888,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. @@ -4437,11 +5152,25 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. - command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must: + 1. Be provided in its own tag with two fields: + - task: The description of the suggested task + - mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask") + 2. Be specific, actionable, and directly related to the completed task + 3. Be ordered by priority or logical sequence + 4. Provide minimum 2-4 suggestions and maximum 12 suggestions + Usage: Your final result description here + + +Implement authentication service tests +code + + Command to demonstrate result (optional) @@ -4450,9 +5179,60 @@ Example: Basic completion with result and command I've updated the CSS styling for the navigation menu + + +Add responsive design breakpoints for mobile devices +code + + +Implement dark mode theme variations +code + + +Create documentation for styling guidelines +architect + + open index.html +Example: Completion with next step suggestions + + +I've implemented the user authentication feature + + + +Implement authentication service tests +code + + +Add password reset functionality +code + + +Design social login integration architecture +architect + + +Create user authentication documentation +architect + + +Implement session management +code + + +npm run dev + + +Note: When providing next step suggestions: +1. Keep suggestions focused and directly related to the completed task +2. Order suggestions by priority or logical sequence +3. Provide minimum 2-4 suggestions and maximum 12 suggestions +4. Make each suggestion specific and actionable +5. Include appropriate mode for each suggestion based on the task type + ## switch_mode Description: Request to switch to a different mode. This tool allows modes to request switching to another mode when needed, such as switching to Code mode to make code changes. The user must approve the mode switch. Parameters: @@ -4909,7 +5689,7 @@ RULES - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write. * For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$" - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices. -- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again. +- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again. - You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves. - When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you. - The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it. @@ -4942,7 +5722,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. -4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. +4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide next step for user via attempt_completion tool by suggest next step. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. From e9ce3b391ea5753add638cfdd49a6a868e757a90 Mon Sep 17 00:00:00 2001 From: sam hoang Date: Sun, 23 Feb 2025 21:34:20 +0700 Subject: [PATCH 04/16] update UI UX --- .../src/components/chat/NextStepSuggest.tsx | 79 +++++-------------- 1 file changed, 21 insertions(+), 58 deletions(-) diff --git a/webview-ui/src/components/chat/NextStepSuggest.tsx b/webview-ui/src/components/chat/NextStepSuggest.tsx index b1be17998a..c74e0390fe 100644 --- a/webview-ui/src/components/chat/NextStepSuggest.tsx +++ b/webview-ui/src/components/chat/NextStepSuggest.tsx @@ -1,4 +1,4 @@ -import { useCallback, useState } from "react" +import { useCallback } from "react" import { cn } from "../../lib/utils" import { Button } from "../ui/button" @@ -8,8 +8,6 @@ interface NextStepSuggestProps { } const NextStepSuggest = ({ suggestions, onSuggestionClick }: NextStepSuggestProps) => { - const [isExpanded, setIsExpanded] = useState(false) - const handleSuggestionClick = useCallback( (suggestion: { task: string; mode: string }) => { onSuggestionClick?.(suggestion.task, suggestion.mode) @@ -17,80 +15,45 @@ const NextStepSuggest = ({ suggestions, onSuggestionClick }: NextStepSuggestProp [onSuggestionClick], ) - const toggleExpanded = useCallback(() => { - setIsExpanded((prev) => !prev) - }, []) - // Don't render if there are no suggestions or no click handler if (!suggestions?.length || !onSuggestionClick) { return null } - const displaySuggestions = isExpanded ? suggestions : suggestions.slice(0, 3) - const showToggle = suggestions.length > 2 - return ( From 3e5e0a677eddfea416156890af6f9ee0a123e9af Mon Sep 17 00:00:00 2001 From: sam hoang Date: Sun, 23 Feb 2025 21:35:57 +0700 Subject: [PATCH 05/16] update UI UX --- webview-ui/src/components/chat/NextStepSuggest.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/webview-ui/src/components/chat/NextStepSuggest.tsx b/webview-ui/src/components/chat/NextStepSuggest.tsx index c74e0390fe..a1c0d07cc1 100644 --- a/webview-ui/src/components/chat/NextStepSuggest.tsx +++ b/webview-ui/src/components/chat/NextStepSuggest.tsx @@ -3,11 +3,11 @@ import { cn } from "../../lib/utils" import { Button } from "../ui/button" interface NextStepSuggestProps { - suggestions?: { task: string; mode: string }[] + suggestions?: { task: string; mode: string; id?: string }[] onSuggestionClick?: (task: string, mode: string) => void } -const NextStepSuggest = ({ suggestions, onSuggestionClick }: NextStepSuggestProps) => { +const NextStepSuggest = ({ suggestions = [], onSuggestionClick }: NextStepSuggestProps) => { const handleSuggestionClick = useCallback( (suggestion: { task: string; mode: string }) => { onSuggestionClick?.(suggestion.task, suggestion.mode) @@ -24,8 +24,8 @@ const NextStepSuggest = ({ suggestions, onSuggestionClick }: NextStepSuggestProp From b9a9d4fabd07550eb071ac04d69ff40ff521a357 Mon Sep 17 00:00:00 2001 From: sam hoang Date: Mon, 24 Feb 2025 20:27:20 +0700 Subject: [PATCH 10/16] refactor: move next step suggestions parsing to wrapper component - Add NextStepSuggestionsWrapper to handle suggestion parsing - Remove suggestion state management from ChatView - Update ChatRow to use wrapper component - Clean up NextStepSuggest component props --- webview-ui/src/components/chat/ChatRow.tsx | 13 ++++-- webview-ui/src/components/chat/ChatView.tsx | 32 +------------- .../src/components/chat/NextStepSuggest.tsx | 6 +-- .../chat/NextStepSuggestionsWrapper.tsx | 42 +++++++++++++++++++ 4 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 webview-ui/src/components/chat/NextStepSuggestionsWrapper.tsx diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index ea73b7f943..9336e9d639 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -22,7 +22,7 @@ import McpResourceRow from "../mcp/McpResourceRow" import McpToolRow from "../mcp/McpToolRow" import { highlightMentions } from "./TaskHeader" import { CheckpointSaved } from "./checkpoints/CheckpointSaved" -import NextStepSuggest from "./NextStepSuggest" +import NextStepSuggestionsWrapper from "./NextStepSuggestionsWrapper" interface ChatRowProps { message: ClineMessage @@ -33,7 +33,6 @@ interface ChatRowProps { onToggleExpand: () => void onHeightChange: (isTaller: boolean) => void onSuggestionClick?: (task: string, mode: string) => void - suggestions?: { task: string; mode: string }[] } interface ChatRowContentProps extends Omit {} @@ -81,7 +80,6 @@ export const ChatRowContent = ({ isStreaming, onToggleExpand, onSuggestionClick, - suggestions, }: ChatRowContentProps) => { const { mcpServers, alwaysAllowMcp, currentCheckpoint } = useExtensionState() const [reasoningCollapsed, setReasoningCollapsed] = useState(true) @@ -752,7 +750,14 @@ export const ChatRowContent = ({ /> ) case "next_step_suggest": - return + return ( + + ) default: return ( <> diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index c05cf9a2b5..8ac6d8479b 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -88,7 +88,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie const [isAtBottom, setIsAtBottom] = useState(false) const [wasStreaming, setWasStreaming] = useState(false) - const [nextStepSuggest, setNextStepSuggest] = useState<{ task: string; mode: string }[]>([]) // UI layout depends on the last 2 messages // (since it relies on the content of these messages, we are deep comparing. i.e. the button state after hitting button sets enableButtons to false, and this effect otherwise would have to true again even if messages didn't change @@ -226,32 +225,10 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setTextAreaDisabled(true) setSelectedImages([]) setClineAsk(undefined) - setNextStepSuggest([]) setEnableButtons(false) } break - case "next_step_suggest": { - const isPartial = lastMessage.partial === true - if (!isPartial) { - setNextStepSuggest([]) - let suggestions: { task: string; mode: string }[] = [] - try { - const parsed = JSON.parse(lastMessage.text ?? "[]") - if (Array.isArray(parsed)) { - suggestions = parsed.filter( - (item) => typeof item === "object" && item.task && item.mode, - ) - } else { - console.warn("Next step suggestions must be an array of strings") - } - } catch (error) { - console.error("Failed to parse next step suggestions:", error) - suggestions = [] - } - setNextStepSuggest(suggestions) - } - break - } + case "next_step_suggest": case "api_req_finished": case "task": case "error": @@ -281,7 +258,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie if (messages.length === 0) { setTextAreaDisabled(false) setClineAsk(undefined) - setNextStepSuggest([]) setEnableButtons(false) setPrimaryButtonText(undefined) setSecondaryButtonText(undefined) @@ -356,7 +332,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setSelectedImages([]) setClineAsk(undefined) setEnableButtons(false) - setNextStepSuggest([]) // Do not reset mode here as it should persist // setPrimaryButtonText(undefined) // setSecondaryButtonText(undefined) @@ -432,7 +407,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setClineAsk(undefined) setEnableButtons(false) disableAutoScrollRef.current = false - setNextStepSuggest([]) }, [clineAsk, inputValue, startNewTask], ) @@ -479,7 +453,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie setTextAreaDisabled(true) setClineAsk(undefined) setEnableButtons(false) - setNextStepSuggest([]) disableAutoScrollRef.current = false }, [clineAsk, startNewTask, isStreaming], @@ -959,7 +932,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie onSuggestionClick={(task: string, mode: string) => { handleSendMessage(`create new task for ${task} by using new_task tool in ${mode} mode`, []) }} - suggestions={nextStepSuggest} /> ) }, @@ -969,7 +941,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie groupedMessages.length, handleRowHeightChange, isStreaming, - nextStepSuggest, + toggleRowExpansion, handleSendMessage, ], diff --git a/webview-ui/src/components/chat/NextStepSuggest.tsx b/webview-ui/src/components/chat/NextStepSuggest.tsx index 7ac9d4ba91..77e4679bb4 100644 --- a/webview-ui/src/components/chat/NextStepSuggest.tsx +++ b/webview-ui/src/components/chat/NextStepSuggest.tsx @@ -6,10 +6,10 @@ import { ChevronDown, ChevronUp } from "lucide-react" interface NextStepSuggestProps { suggestions?: { task: string; mode: string; id?: string }[] onSuggestionClick?: (task: string, mode: string) => void - instanceId?: string + ts: number } -const NextStepSuggest = ({ suggestions = [], onSuggestionClick, instanceId = "default" }: NextStepSuggestProps) => { +const NextStepSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: NextStepSuggestProps) => { const [isExpanded, setIsExpanded] = useState(false) const handleSuggestionClick = useCallback( @@ -35,7 +35,7 @@ const NextStepSuggest = ({ suggestions = [], onSuggestionClick, instanceId = "de
{displayedSuggestions.map((suggestion) => ( -
+
@@ -66,7 +69,7 @@ const NextStepSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: NextSt
- +
) } diff --git a/webview-ui/src/components/ui/button.tsx b/webview-ui/src/components/ui/button.tsx index 9f60dfedee..94d67a07f4 100644 --- a/webview-ui/src/components/ui/button.tsx +++ b/webview-ui/src/components/ui/button.tsx @@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xs text-base font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", + "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xs text-base font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&>.start]:mr-2 [&>.content]:flex", { variants: { variant: { @@ -21,12 +21,20 @@ const buttonVariants = cva( link: "text-primary underline-offset-4 hover:underline cursor-pointer", combobox: "text-vscode-font-size font-normal text-popover-foreground bg-vscode-input-background border border-vscode-dropdown-border hover:bg-vscode-input-background/80 cursor-pointer", + "ui-toolkit-primary": + "font-display text-vscode-button-foreground bg-vscode-button-background border border-vscode-button-border rounded-[var(--size-cornerRadiusRound)] hover:bg-vscode-button-hoverBackground active:bg-vscode-button-background focus-visible:outline focus-visible:outline-[var(--size-borderWidth)] focus-visible:outline-vscode-focusBorder focus-visible:outline-offset-[calc(var(--size-borderWidth)*2)] disabled:opacity-[var(--opacity-disabled)] disabled:bg-vscode-button-background disabled:cursor-not-allowed cursor-pointer [&>svg]:w-[calc(var(--size-designUnit)*4px)] [&>svg]:h-[calc(var(--size-designUnit)*4px)] [&>.start]:mr-2 [&>.content]:flex", + "ui-toolkit-secondary": + "font-display text-vscode-button-secondaryForeground bg-vscode-button-secondaryBackground border border-vscode-button-border rounded-[var(--size-cornerRadiusRound)] hover:bg-vscode-button-secondaryHoverBackground active:bg-vscode-button-secondaryBackground focus-visible:outline focus-visible:outline-[var(--size-borderWidth)] focus-visible:outline-vscode-focusBorder focus-visible:outline-offset-[calc(var(--size-borderWidth)*2)] disabled:opacity-[var(--opacity-disabled)] disabled:bg-vscode-button-secondaryBackground disabled:cursor-not-allowed cursor-pointer [&>svg]:w-[calc(var(--size-designUnit)*4px)] [&>svg]:h-[calc(var(--size-designUnit)*4px)] [&>.start]:mr-2 [&>.content]:flex", + "ui-toolkit-icon": + "font-display text-vscode-foreground bg-vscode-button-iconBackground border-none rounded-[var(--size-button-iconCornerRadius)] hover:bg-vscode-button-iconHoverBackground hover:outline hover:outline-1 hover:outline-dotted hover:outline-vscode-contrastActiveBorder hover:outline-offset-[-1px] active:bg-vscode-button-iconHoverBackground focus-visible:outline focus-visible:outline-[var(--size-borderWidth)] focus-visible:outline-vscode-focusBorder focus-visible:outline-offset-[var(--size-button-iconFocusBorderOffset)] disabled:opacity-[var(--opacity-disabled)] disabled:bg-vscode-button-iconBackground disabled:cursor-not-allowed cursor-pointer [&>svg]:w-[calc(var(--size-designUnit)*4px)] [&>svg]:h-[calc(var(--size-designUnit)*4px)] [&>.content]:flex", }, size: { default: "h-7 px-3", sm: "h-6 px-2 text-sm", lg: "h-8 px-4 text-lg", icon: "h-7 w-7", + "ui-toolkit": "text-base p-[var(--size-button-paddingVertical)_var(--size-button-paddingHorizontal)]", + "ui-toolkit-icon": "p-[var(--size-button-iconPadding)]", }, }, defaultVariants: { @@ -45,7 +53,25 @@ export interface ButtonProps const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { const Comp = asChild ? Slot : "button" - return + + // Set size to "ui-toolkit" when using ui-toolkit variants if no size is specified + const adjustedSize = + !size && variant?.includes("ui-toolkit") + ? variant === "ui-toolkit-icon" + ? "ui-toolkit-icon" + : "ui-toolkit" + : size + + return ( + + ) }, ) Button.displayName = "Button" diff --git a/webview-ui/src/index.css b/webview-ui/src/index.css index fd058872a6..aef11223a8 100644 --- a/webview-ui/src/index.css +++ b/webview-ui/src/index.css @@ -96,6 +96,42 @@ --color-vscode-list-hoverForeground: var(--vscode-list-hoverForeground); --color-vscode-list-hoverBackground: var(--vscode-list-hoverBackground); --color-vscode-list-focusBackground: var(--vscode-list-focusBackground); + + /* Additional VSCode WebView UI Toolkit color tokens */ + --color-vscode-contrastActiveBorder: var(--vscode-contrastActiveBorder); + --color-vscode-contrastBorder: var(--vscode-contrastBorder); + --color-vscode-scrollbarSlider-background: var(--vscode-scrollbarSlider-background); + --color-vscode-scrollbarSlider-hoverBackground: var(--vscode-scrollbarSlider-hoverBackground); + --color-vscode-scrollbarSlider-activeBackground: var(--vscode-scrollbarSlider-activeBackground); + --color-vscode-checkbox-background: var(--vscode-checkbox-background); + --color-vscode-checkbox-border: var(--vscode-checkbox-border); + --color-vscode-checkbox-foreground: var(--vscode-checkbox-foreground); + --color-vscode-list-activeSelectionBackground: var(--vscode-list-activeSelectionBackground); + --color-vscode-list-activeSelectionForeground: var(--vscode-list-activeSelectionForeground); + --color-vscode-settings-dropdownListBorder: var(--vscode-settings-dropdownListBorder); + --color-vscode-progressBar-background: var(--vscode-progressBar-background); + --color-vscode-panelTitle-activeBorder: var(--vscode-panelTitle-activeBorder); + --color-vscode-panelTitle-activeForeground: var(--vscode-panelTitle-activeForeground); + --color-vscode-panelTitle-inactiveForeground: var(--vscode-panelTitle-inactiveForeground); + --color-vscode-panel-background: var(--vscode-panel-background); + --color-vscode-panel-border: var(--vscode-panel-border); + + /* Additional VSCode WebView UI Toolkit button tokens */ + --color-vscode-button-border: var(--vscode-button-border); + --color-vscode-button-hoverBackground: var(--vscode-button-hoverBackground); + --color-vscode-button-secondaryHoverBackground: var(--vscode-button-secondaryHoverBackground); + --color-vscode-button-iconBackground: var(--vscode-button-iconBackground, transparent); + --color-vscode-button-iconHoverBackground: var(--vscode-button-iconHoverBackground, rgba(90, 93, 94, 0.31)); + + /* Additional VSCode WebView UI Toolkit layout tokens */ + --size-cornerRadiusRound: calc(var(--vscode-cornerRadiusRound, 2px) * 1px); + --size-borderWidth: calc(var(--vscode-borderWidth, 1px) * 1px); + --size-button-iconCornerRadius: var(--vscode-button-iconCornerRadius, 5px); + --size-button-iconFocusBorderOffset: var(--vscode-button-iconFocusBorderOffset, 0px); + --size-button-paddingVertical: var(--vscode-button-paddingVertical, 4px); + --size-button-paddingHorizontal: var(--vscode-button-paddingHorizontal, 11px); + --size-button-iconPadding: var(--vscode-button-iconPadding, 3px); + --opacity-disabled: var(--vscode-disabledOpacity, 0.4); } @layer base { From 610e029ba3f0c939600a0f51c26cf924300963d5 Mon Sep 17 00:00:00 2001 From: sam hoang Date: Thu, 27 Feb 2025 01:08:33 +0700 Subject: [PATCH 12/16] feat(ui): add toolkit badge variant and apply to NextStepSuggest component --- webview-ui/src/components/chat/NextStepSuggest.tsx | 2 +- webview-ui/src/components/ui/badge.tsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/components/chat/NextStepSuggest.tsx b/webview-ui/src/components/chat/NextStepSuggest.tsx index 1307d08e47..81c1b889b3 100644 --- a/webview-ui/src/components/chat/NextStepSuggest.tsx +++ b/webview-ui/src/components/chat/NextStepSuggest.tsx @@ -57,7 +57,7 @@ const NextStepSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: NextSt {suggestion.mode} diff --git a/webview-ui/src/components/ui/badge.tsx b/webview-ui/src/components/ui/badge.tsx index 32447ef41c..282980007a 100644 --- a/webview-ui/src/components/ui/badge.tsx +++ b/webview-ui/src/components/ui/badge.tsx @@ -12,6 +12,8 @@ const badgeVariants = cva( secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/80", outline: "text-muted-foreground border-vscode-input-border", + toolkit: + "bg-vscode-badge-background text-vscode-badge-foreground border border-vscode-button-border rounded-full text-xs font-normal", }, }, defaultVariants: { From f06f68526d7ba6def2a99b1bfc9969fae9eb429f Mon Sep 17 00:00:00 2001 From: sam hoang Date: Thu, 27 Feb 2025 01:43:33 +0700 Subject: [PATCH 13/16] Improve NextStepSuggest component UX by adding auto-scroll to toggle button and fixing text alignment --- .../src/components/chat/NextStepSuggest.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/webview-ui/src/components/chat/NextStepSuggest.tsx b/webview-ui/src/components/chat/NextStepSuggest.tsx index 81c1b889b3..7ab51abc1f 100644 --- a/webview-ui/src/components/chat/NextStepSuggest.tsx +++ b/webview-ui/src/components/chat/NextStepSuggest.tsx @@ -1,4 +1,4 @@ -import { useCallback, useState } from "react" +import { useCallback, useRef, useState } from "react" import { cn } from "../../lib/utils" import { Button } from "../ui/button" import { ChevronDown, ChevronUp } from "lucide-react" @@ -12,6 +12,7 @@ interface NextStepSuggestProps { const NextStepSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: NextStepSuggestProps) => { const [isExpanded, setIsExpanded] = useState(false) + const buttonRef = useRef(null) const handleSuggestionClick = useCallback( (suggestion: { task: string; mode: string }) => { @@ -22,6 +23,14 @@ const NextStepSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: NextSt const toggleExpand = useCallback(() => { setIsExpanded((prev) => !prev) + + // Use setTimeout to ensure the DOM has updated before scrolling + setTimeout(() => { + if (buttonRef.current) { + // Use scrollIntoView to ensure the button is visible + buttonRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" }) + } + }, 100) // Increased timeout to ensure DOM updates }, []) // Don't render if there are no suggestions or no click handler @@ -43,16 +52,16 @@ const NextStepSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: NextSt "text-left transition-colors duration-200", "focus:outline-none", "shadow-sm hover:shadow-md shadow-vscode-widget-shadow/50", - "rounded-lg overflow-hidden", + "overflow-hidden", "w-full", "min-h-[80px]", "group", )} onClick={() => handleSuggestionClick(suggestion)} aria-label={`Execute task: ${suggestion.task} in ${suggestion.mode} mode`}> -
-
-
+
+
+
{suggestion.task}
@@ -67,6 +76,7 @@ const NextStepSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: NextSt ))} {suggestions.length > 1 && (