Skip to content

Commit e9f6cb4

Browse files
authored
Merge branch 'RooVetGit:main' into mistral
2 parents b5b6a58 + ffec4c6 commit e9f6cb4

File tree

15 files changed

+121
-28
lines changed

15 files changed

+121
-28
lines changed

.changeset/clever-news-arrive.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Roo Code Changelog
22

3+
## [3.3.20]
4+
5+
- Support project-specific custom modes in a .roomodes file
6+
- Add more Mistral models (thanks @d-oit and @bramburn!)
7+
- By popular request, make it so Ask mode can't write to Markdown files and is purely for chatting with
8+
- Add a setting to control the number of open editor tabs to tell the model about (665 is probably too many!)
9+
- Fix race condition bug with entering API key on the welcome screen
10+
311
## [3.3.19]
412

513
- Fix a bug where aborting in the middle of file writes would not revert the write

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<a href="https://marketplace.visualstudio.com/items?itemName=RooVeterinaryInc.roo-cline" target="_blank"><img src="https://img.shields.io/badge/Download%20on%20VS%20Marketplace-blue?style=for-the-badge&logo=visualstudiocode&logoColor=white" alt="Download on VS Marketplace"></a>
1616
<a href="https://github.com/RooVetGit/Roo-Code/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank"><img src="https://img.shields.io/badge/Feature%20Requests-yellow?style=for-the-badge" alt="Feature Requests"></a>
1717
<a href="https://marketplace.visualstudio.com/items?itemName=RooVeterinaryInc.roo-cline&ssr=false#review-details" target="_blank"><img src="https://img.shields.io/badge/Rate%20%26%20Review-green?style=for-the-badge" alt="Rate & Review"></a>
18+
<a href="https://docs.roocode.com" target="_blank"><img src="https://img.shields.io/badge/Documentation-6B46C1?style=for-the-badge&logo=readthedocs&logoColor=white" alt="Documentation"></a>
19+
1820
</div>
1921

2022
**Roo Code** is an AI-powered **autonomous coding agent** that lives in your editor. It can:

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "roo-cline",
33
"displayName": "Roo Code (prev. Roo Cline)",
4-
"description": "A VS Code plugin that enhances coding with AI-powered automation, multi-model support, and experimental features.",
4+
"description": "An AI-powered autonomous coding agent that lives in your editor.",
55
"publisher": "RooVeterinaryInc",
6-
"version": "3.3.19",
6+
"version": "3.3.20",
77
"icon": "assets/icons/rocket.png",
88
"galleryBanner": {
99
"color": "#617A91",

src/api/providers/__tests__/openai-native.test.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,20 @@ describe("OpenAiNativeHandler", () => {
130130
})
131131

132132
mockCreate.mockResolvedValueOnce({
133-
choices: [{ message: { content: null } }],
134-
usage: {
135-
prompt_tokens: 0,
136-
completion_tokens: 0,
137-
total_tokens: 0,
133+
[Symbol.asyncIterator]: async function* () {
134+
yield {
135+
choices: [
136+
{
137+
delta: { content: null },
138+
index: 0,
139+
},
140+
],
141+
usage: {
142+
prompt_tokens: 0,
143+
completion_tokens: 0,
144+
total_tokens: 0,
145+
},
146+
}
138147
},
139148
})
140149

@@ -144,10 +153,7 @@ describe("OpenAiNativeHandler", () => {
144153
results.push(result)
145154
}
146155

147-
expect(results).toEqual([
148-
{ type: "text", text: "" },
149-
{ type: "usage", inputTokens: 0, outputTokens: 0 },
150-
])
156+
expect(results).toEqual([{ type: "usage", inputTokens: 0, outputTokens: 0 }])
151157

152158
// Verify developer role is used for system prompt with o1 model
153159
expect(mockCreate).toHaveBeenCalledWith({
@@ -156,6 +162,8 @@ describe("OpenAiNativeHandler", () => {
156162
{ role: "developer", content: "Formatting re-enabled\n" + systemPrompt },
157163
{ role: "user", content: "Hello!" },
158164
],
165+
stream: true,
166+
stream_options: { include_usage: true },
159167
})
160168
})
161169

src/api/providers/openai-native.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ export class OpenAiNativeHandler implements ApiHandler, SingleCompletionHandler
5656
},
5757
...convertToOpenAiMessages(messages),
5858
],
59+
stream: true,
60+
stream_options: { include_usage: true },
5961
})
6062

61-
yield* this.yieldResponseData(response)
63+
yield* this.handleStreamResponse(response)
6264
}
6365

6466
private async *handleO3FamilyMessage(

src/core/mentions/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { extractTextFromFile } from "../../integrations/misc/extract-text"
88
import { isBinaryFile } from "isbinaryfile"
99
import { diagnosticsToProblemsString } from "../../integrations/diagnostics"
1010
import { getCommitInfo, getWorkingState } from "../../utils/git"
11+
import { getLatestTerminalOutput } from "../../integrations/terminal/get-latest-output"
1112

1213
export async function openMention(mention?: string): Promise<void> {
1314
if (!mention) {
@@ -29,6 +30,8 @@ export async function openMention(mention?: string): Promise<void> {
2930
}
3031
} else if (mention === "problems") {
3132
vscode.commands.executeCommand("workbench.actions.view.problems")
33+
} else if (mention === "terminal") {
34+
vscode.commands.executeCommand("workbench.action.terminal.focus")
3235
} else if (mention.startsWith("http")) {
3336
vscode.env.openExternal(vscode.Uri.parse(mention))
3437
}
@@ -51,6 +54,8 @@ export async function parseMentions(text: string, cwd: string, urlContentFetcher
5154
return `Working directory changes (see below for details)`
5255
} else if (/^[a-f0-9]{7,40}$/.test(mention)) {
5356
return `Git commit '${mention}' (see below for commit info)`
57+
} else if (mention === "terminal") {
58+
return `Terminal Output (see below for output)`
5459
}
5560
return match
5661
})
@@ -118,6 +123,13 @@ export async function parseMentions(text: string, cwd: string, urlContentFetcher
118123
} catch (error) {
119124
parsedText += `\n\n<git_commit hash="${mention}">\nError fetching commit info: ${error.message}\n</git_commit>`
120125
}
126+
} else if (mention === "terminal") {
127+
try {
128+
const terminalOutput = await getLatestTerminalOutput()
129+
parsedText += `\n\n<terminal_output>\n${terminalOutput}\n</terminal_output>`
130+
} catch (error) {
131+
parsedText += `\n\n<terminal_output>\nError fetching terminal output: ${error.message}\n</terminal_output>`
132+
}
121133
}
122134
}
123135

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import * as vscode from "vscode"
2+
3+
/**
4+
* Gets the contents of the active terminal
5+
* @returns The terminal contents as a string
6+
*/
7+
export async function getLatestTerminalOutput(): Promise<string> {
8+
// Store original clipboard content to restore later
9+
const originalClipboard = await vscode.env.clipboard.readText()
10+
11+
try {
12+
// Select terminal content
13+
await vscode.commands.executeCommand("workbench.action.terminal.selectAll")
14+
15+
// Copy selection to clipboard
16+
await vscode.commands.executeCommand("workbench.action.terminal.copySelection")
17+
18+
// Clear the selection
19+
await vscode.commands.executeCommand("workbench.action.terminal.clearSelection")
20+
21+
// Get terminal contents from clipboard
22+
let terminalContents = (await vscode.env.clipboard.readText()).trim()
23+
24+
// Check if there's actually a terminal open
25+
if (terminalContents === originalClipboard) {
26+
return ""
27+
}
28+
29+
// Clean up command separation
30+
const lines = terminalContents.split("\n")
31+
const lastLine = lines.pop()?.trim()
32+
if (lastLine) {
33+
let i = lines.length - 1
34+
while (i >= 0 && !lines[i].trim().startsWith(lastLine)) {
35+
i--
36+
}
37+
terminalContents = lines.slice(Math.max(i, 0)).join("\n")
38+
}
39+
40+
return terminalContents
41+
} finally {
42+
// Restore original clipboard content
43+
await vscode.env.clipboard.writeText(originalClipboard)
44+
}
45+
}

src/shared/context-mentions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ Mention regex:
2626
- **Exact Word ('problems')**: Matches the exact word 'problems'.
2727
- **Word Boundary (`\b`)**: Ensures that 'problems' is matched as a whole word and not as part of another word (e.g., 'problematic').
2828
- `|`: Logical OR.
29-
- `problems\b`:
30-
- **Exact Word ('git-changes')**: Matches the exact word 'git-changes'.
31-
- **Word Boundary (`\b`)**: Ensures that 'git-changes' is matched as a whole word and not as part of another word.
32-
29+
- `terminal\b`:
30+
- **Exact Word ('terminal')**: Matches the exact word 'terminal'.
31+
- **Word Boundary (`\b`)**: Ensures that 'terminal' is matched as a whole word and not as part of another word (e.g., 'terminals').
3332
- `(?=[.,;:!?]?(?=[\s\r\n]|$))`:
3433
- **Positive Lookahead (`(?=...)`)**: Ensures that the match is followed by specific patterns without including them in the match.
3534
- `[.,;:!?]?`:
@@ -43,14 +42,15 @@ Mention regex:
4342
- URLs that start with a protocol (like 'http://') followed by any non-whitespace characters (including query parameters).
4443
- The exact word 'problems'.
4544
- The exact word 'git-changes'.
45+
- The exact word 'terminal'.
4646
- It ensures that any trailing punctuation marks (such as ',', '.', '!', etc.) are not included in the matched mention, allowing the punctuation to follow the mention naturally in the text.
4747
4848
- **Global Regex**:
4949
- `mentionRegexGlobal`: Creates a global version of the `mentionRegex` to find all matches within a given string.
5050
5151
*/
5252
export const mentionRegex =
53-
/@((?:\/|\w+:\/\/)[^\s]+?|[a-f0-9]{7,40}\b|problems\b|git-changes\b)(?=[.,;:!?]?(?=[\s\r\n]|$))/
53+
/@((?:\/|\w+:\/\/)[^\s]+?|[a-f0-9]{7,40}\b|problems\b|git-changes\b|terminal\b)(?=[.,;:!?]?(?=[\s\r\n]|$))/
5454
export const mentionRegexGlobal = new RegExp(mentionRegex.source, "g")
5555

5656
export interface MentionSuggestion {

0 commit comments

Comments
 (0)