Skip to content

Commit b60dbc6

Browse files
committed
Merge branch 'main' of github.com:taylorwilsdon/Roo-Code into add_streamable_http_support
2 parents 48f4957 + 7cd89ed commit b60dbc6

File tree

15 files changed

+133
-129
lines changed

15 files changed

+133
-129
lines changed

.github/workflows/changeset-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
REPO_PATH: ${{ github.repository }}
1111
GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }}
12-
NODE_VERSION: 20.18.1
12+
NODE_VERSION: 20.19.2
1313
PNPM_VERSION: 10.8.1
1414

1515
jobs:

.github/workflows/code-qa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches: [main]
1010

1111
env:
12-
NODE_VERSION: 20.18.1
12+
NODE_VERSION: 20.19.2
1313
PNPM_VERSION: 10.8.1
1414

1515
jobs:

.github/workflows/marketplace-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }}
10-
NODE_VERSION: 20.18.1
10+
NODE_VERSION: 20.19.2
1111
PNPM_VERSION: 10.8.1
1212

1313
jobs:

.github/workflows/nightly-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
workflow_dispatch: # Allows manual triggering.
1010

1111
env:
12-
NODE_VERSION: 20.18.1
12+
NODE_VERSION: 20.19.2
1313
PNPM_VERSION: 10.8.1
1414

1515
jobs:

.github/workflows/update-contributors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch: # Allows manual triggering
88

99
env:
10-
NODE_VERSION: 20.18.1
10+
NODE_VERSION: 20.19.2
1111
PNPM_VERSION: 10.8.1
1212

1313
jobs:

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.19.2
1+
v20.19.2

evals/scripts/setup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,16 @@ for i in "${!options[@]}"; do
176176
case "${plugin}" in
177177
"nodejs")
178178
if ! command -v node &>/dev/null; then
179-
asdf install nodejs 20.18.1 || exit 1
180-
asdf set nodejs 20.18.1 || exit 1
179+
asdf install nodejs 20.19.2 || exit 1
180+
asdf set nodejs 20.19.2 || exit 1
181181
NODE_VERSION=$(node --version)
182182
echo "✅ Node.js is installed ($NODE_VERSION)"
183183
else
184184
NODE_VERSION=$(node --version)
185185
echo "✅ Node.js is installed ($NODE_VERSION)"
186186
fi
187187

188-
if [[ $(node --version) != "v20.18.1" ]]; then
188+
if [[ $(node --version) != "v20.19.2" ]]; then
189189
NODE_VERSION=$(node --version)
190190
echo "🚨 You have the wrong version of node installed ($NODE_VERSION)."
191191
echo "💡 If you are using nvm then run 'nvm install' to install the version specified by the repo's .nvmrc."

src/api/providers/fetchers/litellm.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export async function getLiteLLMModels(apiKey: string, baseUrl: string): Promise
5858
outputPrice: modelInfo.output_cost_per_token
5959
? modelInfo.output_cost_per_token * 1000000
6060
: undefined,
61+
cacheWritesPrice: modelInfo.cache_creation_input_token_cost ? modelInfo.cache_creation_input_token_cost * 1000000 : undefined,
62+
cacheReadsPrice: modelInfo.cache_read_input_token_cost ? modelInfo.cache_read_input_token_cost * 1000000 : undefined,
6163
description: `${modelName} via LiteLLM proxy`,
6264
}
6365
}

src/api/providers/lite-llm.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Anthropic } from "@anthropic-ai/sdk" // Keep for type usage only
33

44
import { litellmDefaultModelId, litellmDefaultModelInfo } from "@roo-code/types"
55

6+
import { calculateApiCostOpenAI } from "../../shared/cost"
7+
68
import { ApiHandlerOptions } from "../../shared/api"
79

810
import { ApiStream, ApiStreamUsageChunk } from "../transform/stream"
@@ -66,7 +68,7 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa
6668

6769
for await (const chunk of completion) {
6870
const delta = chunk.choices[0]?.delta
69-
const usage = chunk.usage as OpenAI.CompletionUsage
71+
const usage = chunk.usage as LiteLLMUsage
7072

7173
if (delta?.content) {
7274
yield { type: "text", text: delta.content }
@@ -82,8 +84,12 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa
8284
type: "usage",
8385
inputTokens: lastUsage.prompt_tokens || 0,
8486
outputTokens: lastUsage.completion_tokens || 0,
87+
cacheWriteTokens: lastUsage.cache_creation_input_tokens || 0,
88+
cacheReadTokens: lastUsage.prompt_tokens_details?.cached_tokens || 0,
8589
}
8690

91+
usageData.totalCost = calculateApiCostOpenAI(info, usageData.inputTokens, usageData.outputTokens, usageData.cacheWriteTokens, usageData.cacheReadTokens)
92+
8793
yield usageData
8894
}
8995
} catch (error) {
@@ -119,3 +125,8 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa
119125
}
120126
}
121127
}
128+
129+
// LiteLLM usage may include an extra field for Anthropic use cases.
130+
interface LiteLLMUsage extends OpenAI.CompletionUsage {
131+
cache_creation_input_tokens?: number
132+
}

src/core/tools/applyDiffTool.ts

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Task } from "../task/Task"
99
import { ToolUse, RemoveClosingTag, AskApproval, HandleError, PushToolResult } from "../../shared/tools"
1010
import { formatResponse } from "../prompts/responses"
1111
import { fileExistsAtPath } from "../../utils/fs"
12+
import { addLineNumbers } from "../../integrations/misc/extract-text"
1213
import { RecordSource } from "../context-tracking/FileContextTrackerTypes"
1314
import { unescapeHtmlEntities } from "../../utils/text-normalization"
1415

@@ -162,8 +163,7 @@ export async function applyDiffTool(
162163
return
163164
}
164165

165-
// Call saveChanges to update the DiffViewProvider properties
166-
await cline.diffViewProvider.saveChanges()
166+
const { newProblemsMessage, userEdits, finalContent } = await cline.diffViewProvider.saveChanges()
167167

168168
// Track file edit operation
169169
if (relPath) {
@@ -178,13 +178,33 @@ export async function applyDiffTool(
178178
partFailHint = `But unable to apply all diff parts to file: ${absolutePath}, silently use <read_file> tool to check newest file version and re-apply diffs\n`
179179
}
180180

181-
// Get the formatted response message
182-
const message = await cline.diffViewProvider.pushToolWriteResult(cline, cline.cwd, !fileExists)
183-
184-
if (partFailHint) {
185-
pushToolResult(partFailHint + message)
181+
if (userEdits) {
182+
await cline.say(
183+
"user_feedback_diff",
184+
JSON.stringify({
185+
tool: fileExists ? "editedExistingFile" : "newFileCreated",
186+
path: getReadablePath(cline.cwd, relPath),
187+
diff: userEdits,
188+
} satisfies ClineSayTool),
189+
)
190+
191+
pushToolResult(
192+
`The user made the following updates to your content:\n\n${userEdits}\n\n` +
193+
partFailHint +
194+
`The updated content, which includes both your original modifications and the user's edits, has been successfully saved to ${relPath.toPosix()}. Here is the full, updated content of the file, including line numbers:\n\n` +
195+
`<final_file_content path="${relPath.toPosix()}">\n${addLineNumbers(
196+
finalContent || "",
197+
)}\n</final_file_content>\n\n` +
198+
`Please note:\n` +
199+
`1. You do not need to re-write the file with these changes, as they have already been applied.\n` +
200+
`2. Proceed with the task using this updated file content as the new baseline.\n` +
201+
`3. If the user's edits have addressed part of the task or changed the requirements, adjust your approach accordingly.` +
202+
`${newProblemsMessage}`,
203+
)
186204
} else {
187-
pushToolResult(message)
205+
pushToolResult(
206+
`Changes successfully applied to ${relPath.toPosix()}:\n\n${newProblemsMessage}\n` + partFailHint,
207+
)
188208
}
189209

190210
await cline.diffViewProvider.reset()

0 commit comments

Comments
 (0)