Skip to content

Commit 40abb7c

Browse files
authored
Merge pull request #8 from RooVetGit/merge/latestCline2RooCline
Updating Roo-Cline with the latest cline/cline
2 parents cfed4ce + c6c0099 commit 40abb7c

File tree

10 files changed

+144
-27
lines changed

10 files changed

+144
-27
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Change Log
22

3+
## [2.1.4]
4+
5+
- AWS Bedrock fixes (add missing regions, support for cross-region inference, and older Sonnet model for regions where new model is not available)
6+
7+
## [2.1.3]
8+
9+
- Add support for Claude 3.5 Haiku, 66% cheaper than Sonnet with similar intelligence
10+
11+
## [2.1.2]
12+
13+
- Misc. bug fixes
14+
- Update README with new browser feature
15+
316
## [2.1.1]
417

518
- Add stricter prompt to prevent Cline from editing files during a browser session without first closing the browser

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ All changes made by Cline are recorded in your file's Timeline, providing an eas
110110

111111
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
112112

113-
<img align="left" width="350" src="https://github.com/user-attachments/assets/50019dba-a63d-41f0-ab0f-fd35ebcdd4c5">
113+
<img align="left" width="370" src="https://github.com/user-attachments/assets/bc2e85ba-dfeb-4fe6-9942-7cfc4703cbe5">
114114

115-
### Analyze Images and Browser Screenshots
115+
### Use the Browser
116116

117-
Models like Claude 3.5 Sonnet can now understand and analyze images, allowing for exciting possibilities of multimodal workflows. Paste images directly in chat to give Cline context that can't be explained in words, and turn mockups into apps, fix bugs with screenshots, and more.
117+
With Claude 3.5 Sonnet's new [Computer Use](https://www.anthropic.com/news/3-5-models-and-computer-use) capability, Cline can launch a browser, click elements, type text, and scroll, capturing screenshots and console logs at each step. This allows for interactive debugging, end-to-end testing, and even general web use! This gives him autonomy to fixing visual bugs and runtime issues without you needing to handhold and copy-pasting error logs yourself.
118118

119-
Cline can also use a headless browser to launch and interact with any website, e.g., localhost, allowing him to capture screenshots and console logs. This gives him autonomy to fixing visual bugs and runtime issues without you needing to handhold and copy-pasting error logs yourself.
119+
Try asking Cline to "test the app", and watch as he runs a command like `npm run dev`, launches your locally running dev server in a browser, and performs a series of tests to confirm that everything works. [See a demo here.](https://x.com/sdrzn/status/1850880547825823989)
120120

121121
<!-- Transparent pixel to create line break after floating image -->
122122

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "roo-cline",
33
"displayName": "Roo Cline",
44
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, running commands, using the browser, and more with your permission every step of the way.",
5-
"version": "1.0.5",
5+
"version": "2.0.0",
66
"icon": "assets/icons/icon.png",
77
"galleryBanner": {
88
"color": "#617A91",

src/api/providers/anthropic.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class AnthropicHandler implements ApiHandler {
2828
switch (modelId) {
2929
// 'latest' alias does not support cache_control
3030
case "claude-3-5-sonnet-20241022":
31+
case "claude-3-5-haiku-20241022":
3132
case "claude-3-opus-20240229":
3233
case "claude-3-haiku-20240307": {
3334
/*
@@ -78,11 +79,8 @@ export class AnthropicHandler implements ApiHandler {
7879
// https://github.com/anthropics/anthropic-sdk-typescript/commit/c920b77fc67bd839bfeb6716ceab9d7c9bbe7393
7980
switch (modelId) {
8081
case "claude-3-5-sonnet-20241022":
81-
return {
82-
headers: {
83-
"anthropic-beta": "prompt-caching-2024-07-31",
84-
},
85-
}
82+
case "claude-3-5-haiku-20241022":
83+
case "claude-3-opus-20240229":
8684
case "claude-3-haiku-20240307":
8785
return {
8886
headers: { "anthropic-beta": "prompt-caching-2024-07-31" },

src/api/providers/bedrock.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,28 @@ export class AwsBedrockHandler implements ApiHandler {
2525
}
2626

2727
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
28+
// cross region inference requires prefixing the model id with the region
29+
let modelId: string
30+
if (this.options.awsUseCrossRegionInference) {
31+
let regionPrefix = (this.options.awsRegion || "").slice(0, 3)
32+
switch (regionPrefix) {
33+
case "us-":
34+
modelId = `us.${this.getModel().id}`
35+
break
36+
case "eu-":
37+
modelId = `eu.${this.getModel().id}`
38+
break
39+
default:
40+
// cross region inference is not supported in this region, falling back to default model
41+
modelId = this.getModel().id
42+
break
43+
}
44+
} else {
45+
modelId = this.getModel().id
46+
}
47+
2848
const stream = await this.client.messages.create({
29-
model: this.getModel().id,
49+
model: modelId,
3050
max_tokens: this.getModel().info.maxTokens || 8192,
3151
temperature: 0,
3252
system: systemPrompt,

src/core/Cline.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export class Cline {
9999
private userMessageContent: (Anthropic.TextBlockParam | Anthropic.ImageBlockParam)[] = []
100100
private userMessageContentReady = false
101101
private didRejectTool = false
102+
private didAlreadyUseTool = false
102103
private didCompleteReadingStream = false
103104

104105
constructor(
@@ -860,7 +861,7 @@ export class Cline {
860861
const block = cloneDeep(this.assistantMessageContent[this.currentStreamingContentIndex]) // need to create copy bc while stream is updating the array, it could be updating the reference block properties too
861862
switch (block.type) {
862863
case "text": {
863-
if (this.didRejectTool) {
864+
if (this.didRejectTool || this.didAlreadyUseTool) {
864865
break
865866
}
866867
let content = block.content
@@ -947,6 +948,15 @@ export class Cline {
947948
break
948949
}
949950

951+
if (this.didAlreadyUseTool) {
952+
// ignore any content after a tool has already been used
953+
this.userMessageContent.push({
954+
type: "text",
955+
text: `Tool [${block.name}] was not executed because a tool has already been used in this message. Only one tool may be used per message. You must assess the first tool's result before proceeding to use the next tool.`,
956+
})
957+
break
958+
}
959+
950960
const pushToolResult = (content: ToolResponse) => {
951961
this.userMessageContent.push({
952962
type: "text",
@@ -960,6 +970,8 @@ export class Cline {
960970
} else {
961971
this.userMessageContent.push(...content)
962972
}
973+
// once a tool result has been collected, ignore all other tool uses since we should only ever present one tool result per message
974+
this.didAlreadyUseTool = true
963975
}
964976

965977
const askApproval = async (type: ClineAsk, partialMessage?: string) => {
@@ -1064,16 +1076,18 @@ export class Cline {
10641076
newContent = newContent.split("\n").slice(0, -1).join("\n").trim()
10651077
}
10661078

1067-
// it seems not just llama models are doing this, but also gemini and potentially others
1068-
if (
1069-
newContent.includes("&gt;") ||
1070-
newContent.includes("&lt;") ||
1071-
newContent.includes("&quot;")
1072-
) {
1073-
newContent = newContent
1074-
.replace(/&gt;/g, ">")
1075-
.replace(/&lt;/g, "<")
1076-
.replace(/&quot;/g, '"')
1079+
if (!this.api.getModel().id.includes("claude")) {
1080+
// it seems not just llama models are doing this, but also gemini and potentially others
1081+
if (
1082+
newContent.includes("&gt;") ||
1083+
newContent.includes("&lt;") ||
1084+
newContent.includes("&quot;")
1085+
) {
1086+
newContent = newContent
1087+
.replace(/&gt;/g, ">")
1088+
.replace(/&lt;/g, "<")
1089+
.replace(/&quot;/g, '"')
1090+
}
10771091
}
10781092

10791093
const sharedMessageProps: ClineSayTool = {
@@ -1736,7 +1750,7 @@ export class Cline {
17361750
*/
17371751
this.presentAssistantMessageLocked = false // this needs to be placed here, if not then calling this.presentAssistantMessage below would fail (sometimes) since it's locked
17381752
// NOTE: when tool is rejected, iterator stream is interrupted and it waits for userMessageContentReady to be true. Future calls to present will skip execution since didRejectTool and iterate until contentIndex is set to message length and it sets userMessageContentReady to true itself (instead of preemptively doing it in iterator)
1739-
if (!block.partial || this.didRejectTool) {
1753+
if (!block.partial || this.didRejectTool || this.didAlreadyUseTool) {
17401754
// block is finished streaming and executing
17411755
if (this.currentStreamingContentIndex === this.assistantMessageContent.length - 1) {
17421756
// its okay that we increment if !didCompleteReadingStream, it'll just return bc out of bounds and as streaming continues it will call presentAssitantMessage if a new block is ready. if streaming is finished then we set userMessageContentReady to true when out of bounds. This gracefully allows the stream to continue on and all potential content blocks be presented.
@@ -1896,6 +1910,7 @@ export class Cline {
18961910
this.userMessageContent = []
18971911
this.userMessageContentReady = false
18981912
this.didRejectTool = false
1913+
this.didAlreadyUseTool = false
18991914
this.presentAssistantMessageLocked = false
19001915
this.presentAssistantMessageHasPendingUpdates = false
19011916
await this.diffViewProvider.reset()
@@ -1940,6 +1955,14 @@ export class Cline {
19401955
// this.userMessageContentReady = true // instead of setting this premptively, we allow the present iterator to finish and set userMessageContentReady when its ready
19411956
break
19421957
}
1958+
1959+
// PREV: we need to let the request finish for openrouter to get generation details
1960+
// UPDATE: it's better UX to interrupt the request at the cost of the api cost not being retrieved
1961+
if (this.didAlreadyUseTool) {
1962+
assistantMessage +=
1963+
"\n\n[Response interrupted by a tool use result. Only one tool may be used at a time and should be placed at the end of the message.]"
1964+
break
1965+
}
19431966
}
19441967
} catch (error) {
19451968
// abandoned happens when extension is no longer waiting for the cline instance to finish aborting (error is thrown here when any function in the for loop throws due to this.abort)

src/core/webview/ClineProvider.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type GlobalStateKey =
4040
| "apiProvider"
4141
| "apiModelId"
4242
| "awsRegion"
43+
| "awsUseCrossRegionInference"
4344
| "vertexProjectId"
4445
| "vertexRegion"
4546
| "lastShownAnnouncementId"
@@ -354,6 +355,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
354355
awsSecretKey,
355356
awsSessionToken,
356357
awsRegion,
358+
awsUseCrossRegionInference,
357359
vertexProjectId,
358360
vertexRegion,
359361
openAiBaseUrl,
@@ -376,6 +378,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
376378
await this.storeSecret("awsSecretKey", awsSecretKey)
377379
await this.storeSecret("awsSessionToken", awsSessionToken)
378380
await this.updateGlobalState("awsRegion", awsRegion)
381+
await this.updateGlobalState("awsUseCrossRegionInference", awsUseCrossRegionInference)
379382
await this.updateGlobalState("vertexProjectId", vertexProjectId)
380383
await this.updateGlobalState("vertexRegion", vertexRegion)
381384
await this.updateGlobalState("openAiBaseUrl", openAiBaseUrl)
@@ -638,6 +641,18 @@ export class ClineProvider implements vscode.WebviewViewProvider {
638641
modelInfo.cacheWritesPrice = 3.75
639642
modelInfo.cacheReadsPrice = 0.3
640643
break
644+
case "anthropic/claude-3-5-haiku":
645+
case "anthropic/claude-3-5-haiku:beta":
646+
case "anthropic/claude-3-5-haiku-20241022":
647+
case "anthropic/claude-3-5-haiku-20241022:beta":
648+
case "anthropic/claude-3.5-haiku":
649+
case "anthropic/claude-3.5-haiku:beta":
650+
case "anthropic/claude-3.5-haiku-20241022":
651+
case "anthropic/claude-3.5-haiku-20241022:beta":
652+
modelInfo.supportsPromptCache = true
653+
modelInfo.cacheWritesPrice = 1.25
654+
modelInfo.cacheReadsPrice = 0.1
655+
break
641656
case "anthropic/claude-3-opus":
642657
case "anthropic/claude-3-opus:beta":
643658
modelInfo.supportsPromptCache = true
@@ -832,6 +847,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
832847
awsSecretKey,
833848
awsSessionToken,
834849
awsRegion,
850+
awsUseCrossRegionInference,
835851
vertexProjectId,
836852
vertexRegion,
837853
openAiBaseUrl,
@@ -860,6 +876,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
860876
this.getSecret("awsSecretKey") as Promise<string | undefined>,
861877
this.getSecret("awsSessionToken") as Promise<string | undefined>,
862878
this.getGlobalState("awsRegion") as Promise<string | undefined>,
879+
this.getGlobalState("awsUseCrossRegionInference") as Promise<boolean | undefined>,
863880
this.getGlobalState("vertexProjectId") as Promise<string | undefined>,
864881
this.getGlobalState("vertexRegion") as Promise<string | undefined>,
865882
this.getGlobalState("openAiBaseUrl") as Promise<string | undefined>,
@@ -905,6 +922,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
905922
awsSecretKey,
906923
awsSessionToken,
907924
awsRegion,
925+
awsUseCrossRegionInference,
908926
vertexProjectId,
909927
vertexRegion,
910928
openAiBaseUrl,

src/shared/api.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface ApiHandlerOptions {
1919
awsSecretKey?: string
2020
awsSessionToken?: string
2121
awsRegion?: string
22+
awsUseCrossRegionInference?: boolean
2223
vertexProjectId?: string
2324
vertexRegion?: string
2425
openAiBaseUrl?: string
@@ -66,6 +67,16 @@ export const anthropicModels = {
6667
cacheWritesPrice: 3.75, // $3.75 per million tokens
6768
cacheReadsPrice: 0.3, // $0.30 per million tokens
6869
},
70+
"claude-3-5-haiku-20241022": {
71+
maxTokens: 8192,
72+
contextWindow: 200_000,
73+
supportsImages: false,
74+
supportsPromptCache: true,
75+
inputPrice: 1.0,
76+
outputPrice: 5.0,
77+
cacheWritesPrice: 1.25,
78+
cacheReadsPrice: 0.1,
79+
},
6980
"claude-3-opus-20240229": {
7081
maxTokens: 4096,
7182
contextWindow: 200_000,
@@ -102,6 +113,14 @@ export const bedrockModels = {
102113
inputPrice: 3.0,
103114
outputPrice: 15.0,
104115
},
116+
"anthropic.claude-3-5-haiku-20241022-v1:0": {
117+
maxTokens: 8192,
118+
contextWindow: 200_000,
119+
supportsImages: false,
120+
supportsPromptCache: false,
121+
inputPrice: 1.0,
122+
outputPrice: 5.0,
123+
},
105124
"anthropic.claude-3-5-sonnet-20240620-v1:0": {
106125
maxTokens: 8192,
107126
contextWindow: 200_000,
@@ -118,6 +137,14 @@ export const bedrockModels = {
118137
inputPrice: 15.0,
119138
outputPrice: 75.0,
120139
},
140+
"anthropic.claude-3-sonnet-20240229-v1:0": {
141+
maxTokens: 4096,
142+
contextWindow: 200_000,
143+
supportsImages: true,
144+
supportsPromptCache: false,
145+
inputPrice: 3.0,
146+
outputPrice: 15.0,
147+
},
121148
"anthropic.claude-3-haiku-20240307-v1:0": {
122149
maxTokens: 4096,
123150
contextWindow: 200_000,
@@ -167,6 +194,14 @@ export const vertexModels = {
167194
inputPrice: 3.0,
168195
outputPrice: 15.0,
169196
},
197+
"claude-3-5-haiku@20241022": {
198+
maxTokens: 8192,
199+
contextWindow: 200_000,
200+
supportsImages: false,
201+
supportsPromptCache: false,
202+
inputPrice: 1.0,
203+
outputPrice: 5.0,
204+
},
170205
"claude-3-opus@20240229": {
171206
maxTokens: 4096,
172207
contextWindow: 200_000,

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,14 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage }:
284284
<VSCodeOption value="">Select a region...</VSCodeOption>
285285
{/* The user will have to choose a region that supports the model they use, but this shouldn't be a problem since they'd have to request access for it in that region in the first place. */}
286286
<VSCodeOption value="us-east-1">us-east-1</VSCodeOption>
287-
{/* <VSCodeOption value="us-east-2">us-east-2</VSCodeOption> */}
287+
<VSCodeOption value="us-east-2">us-east-2</VSCodeOption>
288288
{/* <VSCodeOption value="us-west-1">us-west-1</VSCodeOption> */}
289289
<VSCodeOption value="us-west-2">us-west-2</VSCodeOption>
290290
{/* <VSCodeOption value="af-south-1">af-south-1</VSCodeOption> */}
291291
{/* <VSCodeOption value="ap-east-1">ap-east-1</VSCodeOption> */}
292292
<VSCodeOption value="ap-south-1">ap-south-1</VSCodeOption>
293293
<VSCodeOption value="ap-northeast-1">ap-northeast-1</VSCodeOption>
294-
{/* <VSCodeOption value="ap-northeast-2">ap-northeast-2</VSCodeOption> */}
294+
<VSCodeOption value="ap-northeast-2">ap-northeast-2</VSCodeOption>
295295
{/* <VSCodeOption value="ap-northeast-3">ap-northeast-3</VSCodeOption> */}
296296
<VSCodeOption value="ap-southeast-1">ap-southeast-1</VSCodeOption>
297297
<VSCodeOption value="ap-southeast-2">ap-southeast-2</VSCodeOption>
@@ -303,8 +303,18 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage }:
303303
{/* <VSCodeOption value="eu-north-1">eu-north-1</VSCodeOption> */}
304304
{/* <VSCodeOption value="me-south-1">me-south-1</VSCodeOption> */}
305305
<VSCodeOption value="sa-east-1">sa-east-1</VSCodeOption>
306+
<VSCodeOption value="us-gov-west-1">us-gov-west-1</VSCodeOption>
307+
{/* <VSCodeOption value="us-gov-east-1">us-gov-east-1</VSCodeOption> */}
306308
</VSCodeDropdown>
307309
</div>
310+
<VSCodeCheckbox
311+
checked={apiConfiguration?.awsUseCrossRegionInference || false}
312+
onChange={(e: any) => {
313+
const isChecked = e.target.checked === true
314+
setApiConfiguration({ ...apiConfiguration, awsUseCrossRegionInference: isChecked })
315+
}}>
316+
Use cross-region inference
317+
</VSCodeCheckbox>
308318
<p
309319
style={{
310320
fontSize: "12px",

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
131131
marginTop: "5px",
132132
color: "var(--vscode-descriptionForeground)",
133133
}}>
134-
When enabled, Cline will automatically read files, view directories, and inspect sites without
135-
requiring you to click the Approve button.
134+
When enabled, Cline will automatically view directory contents and read files without requiring
135+
you to click the Approve button.
136136
</p>
137137
</div>
138138

0 commit comments

Comments
 (0)