Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
def4018
Don't do partial reads on binary files (#1886)
mrubens Mar 21, 2025
81692a4
fix: escape section markers in apply_diff
Mar 21, 2025
1b8bac6
fix: pass multi-block flag to getDiffStrategy in system instructions
Mar 21, 2025
c7321b0
fix: reject apply_diff when search matches replace content
Mar 21, 2025
4b3f711
fix: enforce newlines between diff section separators
Mar 22, 2025
2032c9e
test: add validateMarkerSequencing test cases
Mar 22, 2025
04854ea
test: add tests for escaped marker handling in multi-search-replace
Mar 22, 2025
4338f64
Update contributors list (#1884)
github-actions[bot] Mar 22, 2025
92dee31
fix: make dropdown menu background fully opaque (#1907)
KJ7LNW Mar 22, 2025
2597347
Use openrouter stream_options include_usage (#1905)
mrubens Mar 23, 2025
b41dd73
fix: prevent negative line index when maxReadFileLine is zero (#1915)
mrubens Mar 23, 2025
87b9b72
Corrected bug in openrouter.ts and pre-commit and pre-push husky scri…
Jdo300 Mar 23, 2025
2ab5aad
Fixes for prompts suite unit tests on windows (#1879)
diarmidmackenzie Mar 23, 2025
3c3dd9d
Merge pull request #1861 from KJ7LNW/roo-fix-apply-diff-collisions
mrubens Mar 23, 2025
003388a
Fix maxTokens to 8192 only for compatible Anthropic models (#1862)
pugazhendhi-m Mar 23, 2025
e810a88
Welcome page OAuth (#1913)
mrubens Mar 23, 2025
a866a1c
fix add line wrong index (#1927)
samhvw8 Mar 23, 2025
f07c7e6
Fix question display logic when not streaming (#1931)
mrubens Mar 24, 2025
29d7846
Update suggestion button variant to make it work in all themes (#1932)
mrubens Mar 24, 2025
5720b6b
Tweaks to file read auto-truncate (#1934)
mrubens Mar 24, 2025
5026aae
changeset version bump
github-actions[bot] Mar 24, 2025
d07af73
Update CHANGELOG.md
mrubens Mar 24, 2025
51fd5d3
Merge tag 'v3.10.3' of https://github.com/RooVetGit/Roo-Code into ups…
nang-dev Apr 9, 2025
395d0b7
Fixed link
nang-dev Apr 9, 2025
920c057
Working
nang-dev Apr 9, 2025
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
5 changes: 0 additions & 5 deletions .changeset/wise-icons-sort.md

This file was deleted.

9 changes: 8 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ branch="$(git rev-parse --abbrev-ref HEAD)"
# exit 1
# fi

npx lint-staged
# Detect if running on Windows and use npx.cmd, otherwise use npx
if [ "$OS" = "Windows_NT" ]; then
npx_cmd="npx.cmd"
else
npx_cmd="npx"
fi

"$npx_cmd" lint-staged
9 changes: 8 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ branch="$(git rev-parse --abbrev-ref HEAD)"
# exit 1
# fi

npm run compile
# Detect if running on Windows and use npm.cmd, otherwise use npm
if [ "$OS" = "Windows_NT" ]; then
npm_cmd="npm.cmd"
else
npm_cmd="npm"
fi

"$npm_cmd" run compile

# Check for new changesets.
NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')
Expand Down
3 changes: 2 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ webview-ui/node_modules/**
# Include default themes JSON files used in getTheme
!src/integrations/theme/default-themes/**

# Include icons
# Include icons and images
!assets/icons/**
!assets/images/**

# Include .env file for telemetry
!.env
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Roo Code Changelog

## [3.10.3] - 2025-03-23

- Update the welcome page to provide 1-click OAuth flows with LLM routers (thanks @dtrugman!)
- Switch to a more direct method of tracking OpenRouter tokens/spend
- Make partial file reads backwards-compatible with custom system prompts and give users more control over the chunk size
- Fix issues where questions and suggestions weren’t showing up for non-streaming models and were hard to read in some themes
- A variety of fixes and improvements to experimental multi-block diff (thanks @KJ7LNW!)
- Fix opacity of drop-down menus in settings (thanks @KJ7LNW!)
- Fix bugs with reading and mentioning binary files like PDFs
- Fix the pricing information for OpenRouter free models (thanks @Jdo300!)
- Fix an issue with our unit tests on Windows (thanks @diarmidmackenzie!)
- Fix a maxTokens issue for the Outbound provider (thanks @pugazhendhi-m!)
- Fix a line number issue with partial file reads (thanks @samhvw8!)

## [3.10.2] - 2025-03-21

- Fixes to context mentions on Windows
Expand Down
Binary file added assets/images/openrouter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/requesty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions locales/ca/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/de/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/es/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/fr/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/hi/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/it/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/ja/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/ko/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/pl/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/pt-BR/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/tr/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/vi/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/zh-CN/README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions locales/zh-TW/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "PearAI's integration of Roo Code / Cline, a coding agent.",
"publisher": "PearAI",
"icon": "assets/icons/pear.png",
"version": "3.10.2",
"version": "3.10.3",
"galleryBanner": {
"color": "#617A91",
"theme": "dark"
Expand Down
8 changes: 7 additions & 1 deletion src/activate/handleUri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const handleUri = async (uri: vscode.Uri) => {
const path = uri.path
const query = new URLSearchParams(uri.query.replace(/\+/g, "%2B"))
const visibleProvider = ClineProvider.getVisibleInstance()

if (!visibleProvider) {
return
}
Expand All @@ -26,6 +25,13 @@ export const handleUri = async (uri: vscode.Uri) => {
}
break
}
case "/requesty": {
const code = query.get("code")
if (code) {
await visibleProvider.handleRequestyCallback(code)
}
break
}
default:
break
}
Expand Down
22 changes: 10 additions & 12 deletions src/api/providers/__tests__/openrouter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ describe("OpenRouterHandler", () => {
},
],
}
// Add usage information in the stream response
yield {
id: "test-id",
choices: [{ delta: {} }],
usage: {
prompt_tokens: 10,
completion_tokens: 20,
cost: 0.001,
},
}
},
}

Expand All @@ -121,17 +131,6 @@ describe("OpenRouterHandler", () => {
completions: { create: mockCreate },
} as any

// Mock axios.get for generation details
;(axios.get as jest.Mock).mockResolvedValue({
data: {
data: {
native_tokens_prompt: 10,
native_tokens_completion: 20,
total_cost: 0.001,
},
},
})

const systemPrompt = "test system prompt"
const messages: Anthropic.Messages.MessageParam[] = [{ role: "user" as const, content: "test message" }]

Expand All @@ -153,7 +152,6 @@ describe("OpenRouterHandler", () => {
inputTokens: 10,
outputTokens: 20,
totalCost: 0.001,
fullResponseText: "test response",
})

// Verify OpenAI client was called with correct parameters
Expand Down
64 changes: 50 additions & 14 deletions src/api/providers/__tests__/requesty.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Anthropic } from "@anthropic-ai/sdk"
import OpenAI from "openai"
import { ApiHandlerOptions, ModelInfo, requestyModelInfoSaneDefaults } from "../../../shared/api"
import { ApiHandlerOptions, ModelInfo, requestyDefaultModelInfo } from "../../../shared/api"
import { RequestyHandler } from "../requesty"
import { convertToOpenAiMessages } from "../../transform/openai-format"
import { convertToR1Format } from "../../transform/r1-format"
Expand All @@ -18,14 +18,17 @@ describe("RequestyHandler", () => {
requestyApiKey: "test-key",
requestyModelId: "test-model",
requestyModelInfo: {
maxTokens: 1000,
contextWindow: 4000,
supportsPromptCache: false,
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
inputPrice: 1,
outputPrice: 10,
cacheReadsPrice: 0.1,
cacheWritesPrice: 1.5,
supportsComputerUse: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
description:
"Claude 3.7 Sonnet is an advanced large language model with improved reasoning, coding, and problem-solving capabilities. It introduces a hybrid reasoning approach, allowing users to choose between rapid responses and extended, step-by-step processing for complex tasks. The model demonstrates notable improvements in coding, particularly in front-end development and full-stack updates, and excels in agentic workflows, where it can autonomously navigate multi-step processes. Claude 3.7 Sonnet maintains performance parity with its predecessor in standard mode while offering an extended reasoning mode for enhanced accuracy in math, coding, and instruction-following tasks. Read more at the [blog post here](https://www.anthropic.com/news/claude-3-7-sonnet)",
},
openAiStreamingEnabled: true,
includeMaxTokens: true, // Add this to match the implementation
Expand Down Expand Up @@ -115,16 +118,38 @@ describe("RequestyHandler", () => {
outputTokens: 10,
cacheWriteTokens: 5,
cacheReadTokens: 15,
totalCost: 0.000119, // (10 * 1 / 1,000,000) + (5 * 1.5 / 1,000,000) + (15 * 0.1 / 1,000,000) + (10 * 10 / 1,000,000)
totalCost: 0.00020325000000000003, // (10 * 3 / 1,000,000) + (5 * 3.75 / 1,000,000) + (15 * 0.3 / 1,000,000) + (10 * 15 / 1,000,000) (the ...0 is a fp skew)
},
])

expect(mockCreate).toHaveBeenCalledWith({
model: defaultOptions.requestyModelId,
temperature: 0,
messages: [
{ role: "system", content: systemPrompt },
{ role: "user", content: "Hello" },
{
role: "system",
content: [
{
cache_control: {
type: "ephemeral",
},
text: systemPrompt,
type: "text",
},
],
},
{
role: "user",
content: [
{
cache_control: {
type: "ephemeral",
},
text: "Hello",
type: "text",
},
],
},
],
stream: true,
stream_options: { include_usage: true },
Expand Down Expand Up @@ -191,15 +216,26 @@ describe("RequestyHandler", () => {
outputTokens: 5,
cacheWriteTokens: 0,
cacheReadTokens: 0,
totalCost: 0.00006, // (10 * 1 / 1,000,000) + (5 * 10 / 1,000,000)
totalCost: 0.000105, // (10 * 3 / 1,000,000) + (5 * 15 / 1,000,000)
},
])

expect(mockCreate).toHaveBeenCalledWith({
model: defaultOptions.requestyModelId,
messages: [
{ role: "user", content: systemPrompt },
{ role: "user", content: "Hello" },
{
role: "user",
content: [
{
cache_control: {
type: "ephemeral",
},
text: "Hello",
type: "text",
},
],
},
],
})
})
Expand All @@ -224,7 +260,7 @@ describe("RequestyHandler", () => {
const result = handler.getModel()
expect(result).toEqual({
id: defaultOptions.requestyModelId,
info: requestyModelInfoSaneDefaults,
info: defaultOptions.requestyModelInfo,
})
})
})
Expand Down
64 changes: 16 additions & 48 deletions src/api/providers/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ type OpenRouterChatCompletionParams = OpenAI.Chat.ChatCompletionCreateParams & {
thinking?: BetaThinkingConfigParam
}

// Add custom interface for OpenRouter usage chunk.
interface OpenRouterApiStreamUsageChunk extends ApiStreamUsageChunk {
fullResponseText: string
}

export class OpenRouterHandler extends BaseProvider implements SingleCompletionHandler {
protected options: ApiHandlerOptions
private client: OpenAI
Expand Down Expand Up @@ -110,7 +105,7 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
top_p: topP,
messages: openAiMessages,
stream: true,
include_reasoning: true,
stream_options: { include_usage: true },
// Only include provider if openRouterSpecificProvider is not "[default]".
...(this.options.openRouterSpecificProvider &&
this.options.openRouterSpecificProvider !== OPENROUTER_DEFAULT_PROVIDER_NAME && {
Expand All @@ -122,7 +117,7 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH

const stream = await this.client.chat.completions.create(completionParams)

let genId: string | undefined
let lastUsage

for await (const chunk of stream as unknown as AsyncIterable<OpenAI.Chat.Completions.ChatCompletionChunk>) {
// OpenRouter returns an error object instead of the OpenAI SDK throwing an error.
Expand All @@ -132,10 +127,6 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
throw new Error(`OpenRouter API Error ${error?.code}: ${error?.message}`)
}

if (!genId && chunk.id) {
genId = chunk.id
}

const delta = chunk.choices[0]?.delta

if ("reasoning" in delta && delta.reasoning) {
Expand All @@ -146,47 +137,23 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
fullResponseText += delta.content
yield { type: "text", text: delta.content } as ApiStreamChunk
}
}

const endpoint = `${this.client.baseURL}/generation?id=${genId}`

const config: AxiosRequestConfig = {
headers: { Authorization: `Bearer ${this.options.openRouterApiKey}` },
timeout: 3_000,
if (chunk.usage) {
lastUsage = chunk.usage
}
}

let attempt = 0
let lastError: Error | undefined
const startTime = Date.now()

while (attempt++ < 10) {
await delay(attempt * 100) // Give OpenRouter some time to produce the generation metadata.

try {
const response = await axios.get(endpoint, config)
const generation = response.data?.data

yield {
type: "usage",
inputTokens: generation?.native_tokens_prompt || 0,
outputTokens: generation?.native_tokens_completion || 0,
totalCost: generation?.total_cost || 0,
fullResponseText,
} as OpenRouterApiStreamUsageChunk

break
} catch (error: unknown) {
if (error instanceof Error) {
lastError = error
}
}
if (lastUsage) {
yield this.processUsageMetrics(lastUsage)
}
}

if (lastError) {
console.error(
`Failed to fetch OpenRouter generation details after attempt #${attempt} (${Date.now() - startTime}ms) [${genId}]`,
lastError,
)
processUsageMetrics(usage: any): ApiStreamUsageChunk {
return {
type: "usage",
inputTokens: usage?.prompt_tokens || 0,
outputTokens: usage?.completion_tokens || 0,
totalCost: usage?.cost || 0,
}
}

Expand Down Expand Up @@ -289,12 +256,13 @@ export async function getOpenRouterModels(options?: ApiHandlerOptions) {
modelInfo.maxTokens = 8192
break
case rawModel.id.startsWith("anthropic/claude-3-haiku"):
default:
modelInfo.supportsPromptCache = true
modelInfo.cacheWritesPrice = 0.3
modelInfo.cacheReadsPrice = 0.03
modelInfo.maxTokens = 8192
break
default:
break
}

models[rawModel.id] = modelInfo
Expand Down
Loading
Loading