Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ 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", args.creatorMode)
await sidebarProvider.postStateToWebview()
await sidebarProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })

await sidebarProvider.initClineWithTask(args.text, undefined, args.creatorMode)
}
},
"roo-cline.executeCreatorPlan": async (args: any) => {
const sidebarProvider = ClineProvider.getSidebarInstance()
if (sidebarProvider) {
Expand All @@ -52,6 +65,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
await sidebarProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })

// Create the template message using the args
// Todo: add structure to it i.e. You should have these sections: Architecutre, Features, etc.
let executePlanTemplate = `This file contains detailed plan to my task. please read it and Execute the plan accordingly.
File: ${args.filePath || "No file specified"}`

Expand All @@ -66,11 +80,9 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
executePlanTemplate += `Additional context: ${args.context}`
}

await sidebarProvider.postMessageToWebview({
type: "invoke",
invoke: "sendMessage",
text: executePlanTemplate,
})
args.text = executePlanTemplate

await sidebarProvider.initClineWithTask(args.text, undefined, true)
}
},
}
Expand Down
27 changes: 13 additions & 14 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ export class ClineProvider implements vscode.WebviewViewProvider {
private latestAnnouncementId = "jan-21-2025-custom-modes" // update to some unique identifier when we add a new announcement
configManager: ConfigManager
customModesManager: CustomModesManager
private isCreator: boolean = false
private isCreatorView: boolean = false

constructor(
readonly context: vscode.ExtensionContext,
private readonly outputChannel: vscode.OutputChannel,
isCreator: boolean = false,
isCreatorView: boolean = false,
) {
this.outputChannel.appendLine(`creator = ${isCreator}`)
this.isCreator = isCreator
this.outputChannel.appendLine(`creator = ${isCreatorView}`)
this.isCreatorView = isCreatorView
console.dir("CREATOR")
console.dir(this.isCreator)
console.dir(this.isCreatorView)
this.outputChannel.appendLine("ClineProvider instantiated")
ClineProvider.activeInstances.add(this)
this.workspaceTracker = new WorkspaceTracker(this)
Expand Down Expand Up @@ -135,7 +135,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
}

public static getSidebarInstance(): ClineProvider | undefined {
const sidebar = Array.from(this.activeInstances).find((instance) => !instance.isCreator)
const sidebar = Array.from(this.activeInstances).find((instance) => !instance.isCreatorView)

if (!sidebar?.view?.visible) {
vscode.commands.executeCommand("pearai-roo-cline.SidebarProvider.focus")
Expand Down Expand Up @@ -334,7 +334,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
this.outputChannel.appendLine("Webview view resolved")
}

public async initClineWithTask(task?: string, images?: string[]) {
public async initClineWithTask(task?: string, images?: string[], creatorMode?: boolean) {
await this.clearTask()
const {
apiConfiguration,
Expand All @@ -353,7 +353,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
provider: this,
apiConfiguration: {
...apiConfiguration,
creatorMode: mode === "creator",
creatorMode: creatorMode,
},
customInstructions: effectiveInstructions,
enableDiff: diffEnabled,
Expand All @@ -365,7 +365,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
})
}

public async initClineWithHistoryItem(historyItem: HistoryItem) {
public async initClineWithHistoryItem(historyItem: HistoryItem, creatorMode?: boolean) {
await this.clearTask()

const {
Expand All @@ -386,7 +386,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
provider: this,
apiConfiguration: {
...apiConfiguration,
creatorMode: mode === "creator",
creatorMode: creatorMode,
},
customInstructions: effectiveInstructions,
enableDiff: diffEnabled,
Expand Down Expand Up @@ -436,7 +436,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
window.$RefreshReg$ = () => {}
window.$RefreshSig$ = () => (type) => type
window.__vite_plugin_react_preamble_installed__ = true
window.isCreator="${this.isCreator}";
window.isCreator="${this.isCreatorView}";
</script>
`

Expand All @@ -450,7 +450,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
]

console.dir("CREATORRRRRR")
console.dir(this.isCreator)
console.dir(this.isCreatorView)
return /*html*/ `
<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -1663,7 +1663,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
* Handle switching to a new mode, including updating the associated API configuration
* @param newMode The mode to switch to
*/
public async handleModeSwitch(newMode: Mode) {
public async handleModeSwitch(newMode: Mode, creatorMode?: boolean) {
await this.updateGlobalState("mode", newMode)

// Load the saved API config for the new mode if it exists
Expand Down Expand Up @@ -1816,7 +1816,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
if (this.cline) {
this.cline.api = buildApiHandler({
...apiConfiguration,
creatorMode: mode === "creator",
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/integrations/editor/DiffViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class DiffViewProvider {
Getting diagnostics before and after the file edit is a better approach than
automatically tracking problems in real-time. This method ensures we only
report new problems that are a direct result of this specific edit.
Since these are new problems resulting from Roo's edit, we know they're
Since these are new problems resulting from Agent's edit, we know they're
directly related to the work he's doing. This eliminates the risk of Roo
going off-task or getting distracted by unrelated issues, which was a problem
with the previous auto-debug approach. Some users' machines may be slow to
Expand Down Expand Up @@ -294,7 +294,7 @@ export class DiffViewProvider {
query: Buffer.from(this.originalContent ?? "").toString("base64"),
}),
uri,
`${fileName}: ${fileExists ? "Original ↔ Roo's Changes" : "New File"} (Editable)`,
`${fileName}: ${fileExists ? "Original ↔ Agent's Changes" : "New File"} (Editable)`,
)
// This may happen on very slow machines ie project idx
setTimeout(() => {
Expand Down
1 change: 1 addition & 0 deletions src/shared/creator-mode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CREATOR_MODE_PLANNING_PROMPT = `Depending on the user's request, you may need to do some information gathering (for example using read_file or search_files) to get more context about the task. You may also ask the user clarifying questions to get a better understanding of the task. Once you've gained more context about the user's request, you should create a detailed plan for how to accomplish the task. Focus on breaking down complex tasks into manageable steps, considering technical requirements, potential challenges, and best practices. The plan should be clear enough that it can be directly implemented by switching to Code mode afterward. (Directly write the plan to a markdown file instead of showing it as normal response.)\n\nOnce you create and write the plan, you mark the task as completed. You only make plans and you should not ask or switch to any other mode.`
2 changes: 2 additions & 0 deletions src/shared/modes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from "vscode"
import { TOOL_GROUPS, ToolGroup, ALWAYS_AVAILABLE_TOOLS } from "./tool-groups"
import { addCustomInstructions } from "../core/prompts/sections/custom-instructions"
import { CREATOR_MODE_PLANNING_PROMPT } from "./creator-mode"

// Mode types
export type Mode = string
Expand Down Expand Up @@ -80,6 +81,7 @@ export const modes: readonly ModeConfig[] = [
roleDefinition:
"You are PearAI Agent (Powered by Roo Code / Cline), a creative and systematic software architect focused on turning high-level ideas into actionable plans. Your primary goal is to help users transform their ideas into structured action plans.",
groups: ["read", ["edit", { fileRegex: "\\.md$", description: "Markdown files only" }], "browser", "mcp"],
customInstructions: CREATOR_MODE_PLANNING_PROMPT,
},
{
slug: "code",
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/components/mcp/McpEnabledToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const McpEnabledToggle = () => {
color: "var(--vscode-descriptionForeground)",
}}>
When enabled, Roo will be able to interact with MCP servers for advanced functionality. If you're not
using MCP, you can disable this to reduce Roo's token usage.
using MCP, you can disable this to reduce Agent's token usage.
</p>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/components/mcp/McpView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const McpView = ({ onDone }: McpViewProps) => {
Model Context Protocol
</VSCodeLink>{" "}
enables communication with locally running MCP servers that provide additional tools and resources
to extend Roo's capabilities. You can use{" "}
to extend Agent's capabilities. You can use{" "}
<VSCodeLink href="https://github.com/modelcontextprotocol/servers" style={{ display: "inline" }}>
community-made servers
</VSCodeLink>{" "}
Expand Down Expand Up @@ -91,7 +91,7 @@ const McpView = ({ onDone }: McpViewProps) => {
color: "var(--vscode-descriptionForeground)",
}}>
When enabled, Roo can help you create new MCP servers via commands like "add a new tool
to...". If you don't need to create MCP servers you can disable this to reduce Roo's
to...". If you don't need to create MCP servers you can disable this to reduce Agent's
token usage.
</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/components/prompts/PromptsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
)}
</div>
<div className="text-sm text-vscode-descriptionForeground mb-2">
Define Roo's expertise and personality for this mode. This description shapes how Roo
Define Agent's expertise and personality for this mode. This description shapes how Roo
presents itself and approaches tasks.
</div>
<VSCodeTextArea
Expand Down Expand Up @@ -1255,7 +1255,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
color: "var(--vscode-descriptionForeground)",
marginBottom: "8px",
}}>
Define Roo's expertise and personality for this mode.
Define Agent's expertise and personality for this mode.
</div>
<VSCodeTextArea
value={newModeRoleDefinition}
Expand Down
Loading