Skip to content

Commit 23c2154

Browse files
committed
Merge branch 'main' of github.com:NyxJae/Roo-Code into human-relay
2 parents fee34c4 + 878b382 commit 23c2154

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+781
-425
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
// for the documentation about the extensions.json format
44
"recommendations": [
55
"dbaeumer.vscode-eslint",
6-
"connor4312.esbuild-problem-matchers",
7-
"ms-vscode.extension-test-runner",
6+
"esbenp.prettier-vscode",
87
"csstools.postcss",
98
"bradlc.vscode-tailwindcss",
10-
"tobermory.es6-string-html"
9+
"connor4312.esbuild-problem-matchers"
1110
]
1211
}

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/activate/registerCommands.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,11 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
9595
}
9696

9797
const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => {
98-
outputChannel.appendLine("Opening Roo Code in new tab")
99-
10098
// (This example uses webviewProvider activation event which is necessary to
10199
// deserialize cached webview, but since we use retainContextWhenHidden, we
102100
// don't need to use that event).
103101
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts
104-
const tabProvider = new ClineProvider(context, outputChannel)
105-
// const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined
102+
const tabProvider = new ClineProvider(context, outputChannel, "editor")
106103
const lastCol = Math.max(...vscode.window.visibleTextEditors.map((editor) => editor.viewColumn || 0))
107104

108105
// Check if there are any visible text editors, otherwise open a new group
@@ -121,10 +118,10 @@ const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterComman
121118
localResourceRoots: [context.extensionUri],
122119
})
123120

124-
// Save as tab type panel
121+
// Save as tab type panel.
125122
setPanel(newPanel, "tab")
126123

127-
// TODO: use better svg icon with light and dark variants (see
124+
// TODO: Use better svg icon with light and dark variants (see
128125
// https://stackoverflow.com/questions/58365687/vscode-extension-iconpath).
129126
newPanel.iconPath = {
130127
light: vscode.Uri.joinPath(context.extensionUri, "assets", "icons", "rocket.png"),
@@ -133,12 +130,12 @@ const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterComman
133130

134131
await tabProvider.resolveWebviewView(newPanel)
135132

136-
// Handle panel closing events
133+
// Handle panel closing events.
137134
newPanel.onDidDispose(() => {
138135
setPanel(undefined, "tab")
139136
})
140137

141-
// Lock the editor group so clicking on files doesn't open them over the panel
138+
// Lock the editor group so clicking on files doesn't open them over the panel.
142139
await delay(100)
143140
await vscode.commands.executeCommand("workbench.action.lockEditorGroup")
144141
}

src/core/Cline.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ export class Cline extends EventEmitter<ClineEvents> {
10331033
),
10341034
]
10351035
} else if (completed) {
1036-
let exitStatus: string
1036+
let exitStatus: string = ""
10371037
if (exitDetails !== undefined) {
10381038
if (exitDetails.signal) {
10391039
exitStatus = `Process terminated by signal ${exitDetails.signal} (${exitDetails.signalName})`
@@ -1044,13 +1044,22 @@ export class Cline extends EventEmitter<ClineEvents> {
10441044
result += "<VSCE exit code is undefined: terminal output and command execution status is unknown.>"
10451045
exitStatus = `Exit code: <undefined, notify user>`
10461046
} else {
1047-
exitStatus = `Exit code: ${exitDetails.exitCode}`
1047+
if (exitDetails.exitCode !== 0) {
1048+
exitStatus += "Command execution was not successful, inspect the cause and adjust as needed.\n"
1049+
}
1050+
exitStatus += `Exit code: ${exitDetails.exitCode}`
10481051
}
10491052
} else {
10501053
result += "<VSCE exitDetails == undefined: terminal output and command execution status is unknown.>"
10511054
exitStatus = `Exit code: <undefined, notify user>`
10521055
}
1053-
const workingDirInfo = workingDir ? ` from '${workingDir.toPosix()}'` : ""
1056+
1057+
let workingDirInfo: string = workingDir ? ` within working directory '${workingDir.toPosix()}'` : ""
1058+
const newWorkingDir = terminalInfo.getCurrentWorkingDirectory()
1059+
1060+
if (newWorkingDir !== workingDir) {
1061+
workingDirInfo += `; command changed working directory for this terminal to '${newWorkingDir.toPosix()} so be aware that future commands will be executed from this directory`
1062+
}
10541063

10551064
const outputInfo = `\nOutput:\n${result}`
10561065
return [

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 30 additions & 15 deletions
Large diffs are not rendered by default.

src/core/prompts/sections/rules.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { DiffStrategy } from "../../diff/DiffStrategy"
2-
import { modes, ModeConfig } from "../../../shared/modes"
3-
import * as vscode from "vscode"
4-
import * as path from "path"
52

63
function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Record<string, boolean>): string {
74
const instructions: string[] = []
@@ -64,7 +61,8 @@ export function getRulesSection(
6461
6562
RULES
6663
67-
- Your current working directory is: ${cwd.toPosix()}
64+
- The project base directory is: ${cwd.toPosix()}
65+
- All file paths must be relative to this directory. However, commands may change directories in terminals, so respect working directory specified by the response to <execute_command>.
6866
- You cannot \`cd\` into a different directory to complete a task. You are stuck operating from '${cwd.toPosix()}', so be sure to pass in the correct 'path' parameter when using tools that require a path.
6967
- Do not use the ~ character or $HOME to refer to the home directory.
7068
- Before using the execute_command tool, you must first think about the SYSTEM INFORMATION context provided to understand the user's environment and tailor your commands to ensure they are compatible with their system. You must also consider if the command you need to run should be executed in a specific directory outside of the current working directory '${cwd.toPosix()}', and if so prepend with \`cd\`'ing into that directory && then executing the command (as one command since you are stuck operating from '${cwd.toPosix()}'). For example, if you needed to run \`npm install\` in a project outside of '${cwd.toPosix()}', you would need to prepend with a \`cd\` i.e. pseudocode for this would be \`cd (path to project) && (command, in this case npm install)\`.

src/core/webview/ClineProvider.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { Mode, PromptComponent, defaultModeSlug, ModeConfig } from "../../shared
2727
import { checkExistKey } from "../../shared/checkExistApiConfig"
2828
import { EXPERIMENT_IDS, experiments as Experiments, experimentDefault, ExperimentId } from "../../shared/experiments"
2929
import { formatLanguage } from "../../shared/language"
30+
import { Terminal, TERMINAL_SHELL_INTEGRATION_TIMEOUT } from "../../integrations/terminal/Terminal"
3031
import { downloadTask } from "../../integrations/misc/export-markdown"
3132
import { openFile, openImage } from "../../integrations/misc/open-file"
3233
import { selectImages } from "../../integrations/misc/process-images"
@@ -94,6 +95,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
9495
constructor(
9596
readonly context: vscode.ExtensionContext,
9697
private readonly outputChannel: vscode.OutputChannel,
98+
private readonly renderContext: "sidebar" | "editor" = "sidebar",
9799
) {
98100
super()
99101

@@ -355,9 +357,10 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
355357
setPanel(webviewView, "sidebar")
356358
}
357359

358-
// Initialize sound enabled state
359-
this.getState().then(({ soundEnabled }) => {
360+
// Initialize out-of-scope variables that need to recieve persistent global state values
361+
this.getState().then(({ soundEnabled, terminalShellIntegrationTimeout }) => {
360362
setSoundEnabled(soundEnabled ?? false)
363+
Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT)
361364
})
362365

363366
// Initialize tts enabled state
@@ -1407,6 +1410,13 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
14071410
await this.updateGlobalState("terminalOutputLineLimit", message.value)
14081411
await this.postStateToWebview()
14091412
break
1413+
case "terminalShellIntegrationTimeout":
1414+
await this.updateGlobalState("terminalShellIntegrationTimeout", message.value)
1415+
await this.postStateToWebview()
1416+
if (message.value !== undefined) {
1417+
Terminal.setShellIntegrationTimeout(message.value)
1418+
}
1419+
break
14101420
case "mode":
14111421
await this.handleModeSwitch(message.text as Mode)
14121422
break
@@ -2373,6 +2383,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
23732383
remoteBrowserEnabled,
23742384
writeDelayMs,
23752385
terminalOutputLineLimit,
2386+
terminalShellIntegrationTimeout,
23762387
fuzzyMatchThreshold,
23772388
mcpEnabled,
23782389
enableMcpServerCreation,
@@ -2394,11 +2405,10 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
23942405
showRooIgnoredFiles,
23952406
language,
23962407
} = await this.getState()
2408+
23972409
const telemetryKey = process.env.POSTHOG_API_KEY
23982410
const machineId = vscode.env.machineId
2399-
24002411
const allowedCommands = vscode.workspace.getConfiguration("roo-cline").get<string[]>("allowedCommands") || []
2401-
24022412
const cwd = this.cwd
24032413

24042414
return {
@@ -2436,6 +2446,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
24362446
remoteBrowserEnabled: remoteBrowserEnabled ?? false,
24372447
writeDelayMs: writeDelayMs ?? 1000,
24382448
terminalOutputLineLimit: terminalOutputLineLimit ?? 500,
2449+
terminalShellIntegrationTimeout: terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT,
24392450
fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0,
24402451
mcpEnabled: mcpEnabled ?? true,
24412452
enableMcpServerCreation: enableMcpServerCreation ?? true,
@@ -2461,6 +2472,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
24612472
machineId,
24622473
showRooIgnoredFiles: showRooIgnoredFiles ?? true,
24632474
language,
2475+
renderContext: this.renderContext,
24642476
}
24652477
}
24662478

@@ -2595,6 +2607,8 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
25952607
fuzzyMatchThreshold: stateValues.fuzzyMatchThreshold ?? 1.0,
25962608
writeDelayMs: stateValues.writeDelayMs ?? 1000,
25972609
terminalOutputLineLimit: stateValues.terminalOutputLineLimit ?? 500,
2610+
terminalShellIntegrationTimeout:
2611+
stateValues.terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT,
25982612
mode: stateValues.mode ?? defaultModeSlug,
25992613
language: stateValues.language ?? formatLanguage(vscode.env.language),
26002614
mcpEnabled: stateValues.mcpEnabled ?? true,

src/core/webview/__tests__/ClineProvider.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ describe("ClineProvider", () => {
531531
browserToolEnabled: true,
532532
telemetrySetting: "unset",
533533
showRooIgnoredFiles: true,
534+
renderContext: "sidebar",
534535
}
535536

536537
const message: ExtensionMessage = {

src/exports/roo-code.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ export type GlobalStateKey =
220220
| "fuzzyMatchThreshold"
221221
| "writeDelayMs"
222222
| "terminalOutputLineLimit"
223+
| "terminalShellIntegrationTimeout"
223224
| "mcpEnabled"
224225
| "enableMcpServerCreation"
225226
| "alwaysApproveResubmit"

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function activate(context: vscode.ExtensionContext) {
5656
context.globalState.update("allowedCommands", defaultCommands)
5757
}
5858

59-
const provider = new ClineProvider(context, outputChannel)
59+
const provider = new ClineProvider(context, outputChannel, "sidebar")
6060
telemetryService.setProvider(provider)
6161

6262
// Validate task history on extension activation

0 commit comments

Comments
 (0)