From a041e871be2afd0708b1bdcd88366958b9217ce9 Mon Sep 17 00:00:00 2001 From: nang-dev Date: Sat, 29 Mar 2025 12:32:59 -0400 Subject: [PATCH 01/12] Progress --- src/activate/registerCommands.ts | 18 ++++++++ webview-ui/src/creator/Creator.tsx | 74 +++++++++++++++++++++--------- 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/src/activate/registerCommands.ts b/src/activate/registerCommands.ts index 4a48fbb9b65..4c6b6bd2302 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -41,6 +41,24 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt "roo-cline.helpButtonClicked": () => { vscode.env.openExternal(vscode.Uri.parse("https://docs.roocode.com")) }, + "roo-cline.createInAgent": async (args: any) => { + const sidebarProvider = ClineProvider.getSidebarInstance() + if (sidebarProvider) { + // Start a new chat in the sidebar + vscode.commands.executeCommand("pearai-roo-cline.SidebarProvider.focus") + await sidebarProvider.clearTask() + await sidebarProvider.handleModeSwitch("code") + await sidebarProvider.postStateToWebview() + await sidebarProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" }) + + // Send the completion result directly + await sidebarProvider.postMessageToWebview({ + type: "invoke", + invoke: "sendMessage", + text: args.text, + }) + } + }, "roo-cline.executeCreatorPlan": async (args: any) => { const sidebarProvider = ClineProvider.getSidebarInstance() if (sidebarProvider) { diff --git a/webview-ui/src/creator/Creator.tsx b/webview-ui/src/creator/Creator.tsx index fa2b8c439b4..3d9de90d815 100644 --- a/webview-ui/src/creator/Creator.tsx +++ b/webview-ui/src/creator/Creator.tsx @@ -88,6 +88,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie const [wasStreaming, setWasStreaming] = useState(false) const [editingFilePath, setEditingFilePath] = useState(null) + const [includePlanningPhase, setIncludePlanningPhase] = useState(true) // 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 @@ -403,16 +404,28 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie break case "completion_result": case "resume_completed_task": - vscode.postMessage({ - type: "invoke", - invoke: "executeCommand", - command: "roo-cline.executeCreatorPlan", - args: { - filePath: editingFilePath, - // code: 'function test() { return true; }', - // context: 'This is a test context' - }, - }) + if (includePlanningPhase) { + vscode.postMessage({ + type: "invoke", + invoke: "executeCommand", + command: "roo-cline.executeCreatorPlan", + args: { + filePath: editingFilePath, + includePlanning: true + }, + }) + } else { + // When skipping planning, send directly to agent sidebar + vscode.postMessage({ + type: "invoke", + invoke: "executeCommand", + command: "roo-cline.createInAgent", + args: { + text: lastMessage?.text || "", + mode: "code" + }, + }) + } break } setTextAreaDisabled(true) @@ -1018,6 +1031,25 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie overflow: "hidden", }} className={`min-w-2xl ${task ? "max-w-2xl" : "max-w-5xl"} mx-auto flex justify-center borderr border-solid`}> +
+ setIncludePlanningPhase(e.target.checked)} + style={{ cursor: 'pointer' }} + /> + +
+ {!task && (
@@ -1158,19 +1190,19 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie padding: `${primaryButtonText || secondaryButtonText || isStreaming ? "10" : "0"}px 0px 0px 0px`, }}> {primaryButtonText && !isStreaming && ( - + marginRight: secondaryButtonText ? "6px" : "0", + borderRadius: 8, + }} + onClick={(e) => handlePrimaryButtonClick(inputValue, selectedImages)}> + {primaryButtonText} + )} {(secondaryButtonText || isStreaming) && ( + marginRight: secondaryButtonText ? "6px" : "0", + borderRadius: 8, + }} + onClick={(e) => handlePrimaryButtonClick(inputValue, selectedImages)}> + {primaryButtonText} + )} {(secondaryButtonText || isStreaming) && (
@@ -1280,8 +1275,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie /> )}
- {editingFilePath && { - }} />} + {editingFilePath && {}} />} ) } @@ -1307,4 +1301,3 @@ const ScrollToBottomButton = styled.div` ` export default ChatView - From dcc73f626240dc030927463c09999979afd6bc72 Mon Sep 17 00:00:00 2001 From: nang-dev Date: Sun, 30 Mar 2025 00:25:30 -0400 Subject: [PATCH 12/12] Removed prints --- src/activate/registerCommands.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/activate/registerCommands.ts b/src/activate/registerCommands.ts index 26ac39eb95a..1875c55e4ed 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -45,12 +45,9 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt const sidebarProvider = ClineProvider.getSidebarInstance() if (sidebarProvider) { // Start a new chat in the sidebar - console.log("I AM IN createInAgent and creatorMode is", args.creatorMode) vscode.commands.executeCommand("pearai-roo-cline.SidebarProvider.focus") await sidebarProvider.clearTask() - console.log("I AM IN about to call handleModeSwitch", args.creatorMode) await sidebarProvider.handleModeSwitch("code", args.creatorMode) - console.log("I AM IN just called handleModeSwitch", args.creatorMode) await sidebarProvider.postStateToWebview() await sidebarProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })