Skip to content

Commit 0c8e03c

Browse files
committed
Merge branch 'main' into cte/vertex-gemini-caching
2 parents 8b40a74 + 2075f26 commit 0c8e03c

File tree

34 files changed

+340
-91
lines changed

34 files changed

+340
-91
lines changed

.changeset/odd-ligers-press.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": minor
3+
---
4+
5+
Add Reasoning Effort setting for OpenAI Compatible provider

e2e/src/suite/subtasks.test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@ suite("Roo Code Subtasks", () => {
1717
}
1818
})
1919

20-
await api.setConfiguration({
21-
mode: "ask",
22-
alwaysAllowModeSwitch: true,
23-
alwaysAllowSubtasks: true,
24-
autoApprovalEnabled: true,
25-
enableCheckpoints: false,
26-
})
27-
2820
const childPrompt = "You are a calculator. Respond only with numbers. What is the square root of 9?"
2921

3022
// Start a parent task that will create a subtask.
3123
const parentTaskId = await api.startNewTask({
24+
configuration: {
25+
mode: "ask",
26+
alwaysAllowModeSwitch: true,
27+
alwaysAllowSubtasks: true,
28+
autoApprovalEnabled: true,
29+
enableCheckpoints: false,
30+
},
3231
text:
3332
"You are the parent task. " +
3433
`Create a subtask by using the new_task tool with the message '${childPrompt}'.` +

evals/packages/types/src/roo-code.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ export const clineAsks = [
706706
"mistake_limit_reached",
707707
"browser_action_launch",
708708
"use_mcp_server",
709-
"finishTask",
710709
] as const
711710

712711
export const clineAskSchema = z.enum(clineAsks)
@@ -716,7 +715,6 @@ export type ClineAsk = z.infer<typeof clineAskSchema>
716715
// ClineSay
717716

718717
export const clineSays = [
719-
"task",
720718
"error",
721719
"api_req_started",
722720
"api_req_finished",
@@ -729,15 +727,12 @@ export const clineSays = [
729727
"user_feedback",
730728
"user_feedback_diff",
731729
"command_output",
732-
"tool",
733730
"shell_integration_warning",
734731
"browser_action",
735732
"browser_action_result",
736-
"command",
737733
"mcp_server_request_started",
738734
"mcp_server_response",
739-
"new_task_started",
740-
"new_task",
735+
"subtask_result",
741736
"checkpoint_saved",
742737
"rooignore_error",
743738
"diff_error",

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@
468468
"@types/jest": "^29.5.14",
469469
"@types/mocha": "^10.0.10",
470470
"@types/node": "20.x",
471+
"@types/node-cache": "^4.1.3",
471472
"@types/node-ipc": "^9.2.3",
472473
"@types/string-similarity": "^4.0.2",
473474
"@typescript-eslint/eslint-plugin": "^7.14.1",

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// npx jest src/api/providers/__tests__/openai.test.ts
2+
13
import { OpenAiHandler } from "../openai"
24
import { ApiHandlerOptions } from "../../../shared/api"
35
import { Anthropic } from "@anthropic-ai/sdk"
@@ -155,6 +157,39 @@ describe("OpenAiHandler", () => {
155157
expect(textChunks).toHaveLength(1)
156158
expect(textChunks[0].text).toBe("Test response")
157159
})
160+
it("should include reasoning_effort when reasoning effort is enabled", async () => {
161+
const reasoningOptions: ApiHandlerOptions = {
162+
...mockOptions,
163+
enableReasoningEffort: true,
164+
openAiCustomModelInfo: { contextWindow: 128_000, supportsPromptCache: false, reasoningEffort: "high" },
165+
}
166+
const reasoningHandler = new OpenAiHandler(reasoningOptions)
167+
const stream = reasoningHandler.createMessage(systemPrompt, messages)
168+
// Consume the stream to trigger the API call
169+
for await (const _chunk of stream) {
170+
}
171+
// Assert the mockCreate was called with reasoning_effort
172+
expect(mockCreate).toHaveBeenCalled()
173+
const callArgs = mockCreate.mock.calls[0][0]
174+
expect(callArgs.reasoning_effort).toBe("high")
175+
})
176+
177+
it("should not include reasoning_effort when reasoning effort is disabled", async () => {
178+
const noReasoningOptions: ApiHandlerOptions = {
179+
...mockOptions,
180+
enableReasoningEffort: false,
181+
openAiCustomModelInfo: { contextWindow: 128_000, supportsPromptCache: false },
182+
}
183+
const noReasoningHandler = new OpenAiHandler(noReasoningOptions)
184+
const stream = noReasoningHandler.createMessage(systemPrompt, messages)
185+
// Consume the stream to trigger the API call
186+
for await (const _chunk of stream) {
187+
}
188+
// Assert the mockCreate was called without reasoning_effort
189+
expect(mockCreate).toHaveBeenCalled()
190+
const callArgs = mockCreate.mock.calls[0][0]
191+
expect(callArgs.reasoning_effort).toBeUndefined()
192+
})
158193
})
159194

160195
describe("error handling", () => {

src/exports/roo-code.d.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ type ProviderSettings = {
8787
openAiUseAzure?: boolean | undefined
8888
azureApiVersion?: string | undefined
8989
openAiStreamingEnabled?: boolean | undefined
90+
enableReasoningEffort?: boolean | undefined
9091
ollamaModelId?: string | undefined
9192
ollamaBaseUrl?: string | undefined
9293
vsCodeLmModelSelector?:
@@ -307,12 +308,10 @@ type ClineMessage = {
307308
| "mistake_limit_reached"
308309
| "browser_action_launch"
309310
| "use_mcp_server"
310-
| "finishTask"
311311
)
312312
| undefined
313313
say?:
314314
| (
315-
| "task"
316315
| "error"
317316
| "api_req_started"
318317
| "api_req_finished"
@@ -325,15 +324,11 @@ type ClineMessage = {
325324
| "user_feedback"
326325
| "user_feedback_diff"
327326
| "command_output"
328-
| "tool"
329327
| "shell_integration_warning"
330328
| "browser_action"
331329
| "browser_action_result"
332-
| "command"
333330
| "mcp_server_request_started"
334331
| "mcp_server_response"
335-
| "new_task_started"
336-
| "new_task"
337332
| "subtask_result"
338333
| "checkpoint_saved"
339334
| "rooignore_error"
@@ -388,12 +383,10 @@ type RooCodeEvents = {
388383
| "mistake_limit_reached"
389384
| "browser_action_launch"
390385
| "use_mcp_server"
391-
| "finishTask"
392386
)
393387
| undefined
394388
say?:
395389
| (
396-
| "task"
397390
| "error"
398391
| "api_req_started"
399392
| "api_req_finished"
@@ -406,15 +399,11 @@ type RooCodeEvents = {
406399
| "user_feedback"
407400
| "user_feedback_diff"
408401
| "command_output"
409-
| "tool"
410402
| "shell_integration_warning"
411403
| "browser_action"
412404
| "browser_action_result"
413-
| "command"
414405
| "mcp_server_request_started"
415406
| "mcp_server_response"
416-
| "new_task_started"
417-
| "new_task"
418407
| "subtask_result"
419408
| "checkpoint_saved"
420409
| "rooignore_error"

src/exports/types.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ type ProviderSettings = {
8888
openAiUseAzure?: boolean | undefined
8989
azureApiVersion?: string | undefined
9090
openAiStreamingEnabled?: boolean | undefined
91+
enableReasoningEffort?: boolean | undefined
9192
ollamaModelId?: string | undefined
9293
ollamaBaseUrl?: string | undefined
9394
vsCodeLmModelSelector?:
@@ -312,12 +313,10 @@ type ClineMessage = {
312313
| "mistake_limit_reached"
313314
| "browser_action_launch"
314315
| "use_mcp_server"
315-
| "finishTask"
316316
)
317317
| undefined
318318
say?:
319319
| (
320-
| "task"
321320
| "error"
322321
| "api_req_started"
323322
| "api_req_finished"
@@ -330,15 +329,11 @@ type ClineMessage = {
330329
| "user_feedback"
331330
| "user_feedback_diff"
332331
| "command_output"
333-
| "tool"
334332
| "shell_integration_warning"
335333
| "browser_action"
336334
| "browser_action_result"
337-
| "command"
338335
| "mcp_server_request_started"
339336
| "mcp_server_response"
340-
| "new_task_started"
341-
| "new_task"
342337
| "subtask_result"
343338
| "checkpoint_saved"
344339
| "rooignore_error"
@@ -397,12 +392,10 @@ type RooCodeEvents = {
397392
| "mistake_limit_reached"
398393
| "browser_action_launch"
399394
| "use_mcp_server"
400-
| "finishTask"
401395
)
402396
| undefined
403397
say?:
404398
| (
405-
| "task"
406399
| "error"
407400
| "api_req_started"
408401
| "api_req_finished"
@@ -415,15 +408,11 @@ type RooCodeEvents = {
415408
| "user_feedback"
416409
| "user_feedback_diff"
417410
| "command_output"
418-
| "tool"
419411
| "shell_integration_warning"
420412
| "browser_action"
421413
| "browser_action_result"
422-
| "command"
423414
| "mcp_server_request_started"
424415
| "mcp_server_response"
425-
| "new_task_started"
426-
| "new_task"
427416
| "subtask_result"
428417
| "checkpoint_saved"
429418
| "rooignore_error"

src/schemas/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ export const providerSettingsSchema = z.object({
355355
openAiUseAzure: z.boolean().optional(),
356356
azureApiVersion: z.string().optional(),
357357
openAiStreamingEnabled: z.boolean().optional(),
358+
enableReasoningEffort: z.boolean().optional(),
358359
// Ollama
359360
ollamaModelId: z.string().optional(),
360361
ollamaBaseUrl: z.string().optional(),
@@ -453,6 +454,7 @@ const providerSettingsRecord: ProviderSettingsRecord = {
453454
openAiUseAzure: undefined,
454455
azureApiVersion: undefined,
455456
openAiStreamingEnabled: undefined,
457+
enableReasoningEffort: undefined,
456458
// Ollama
457459
ollamaModelId: undefined,
458460
ollamaBaseUrl: undefined,
@@ -741,7 +743,6 @@ export const clineAsks = [
741743
"mistake_limit_reached",
742744
"browser_action_launch",
743745
"use_mcp_server",
744-
"finishTask",
745746
] as const
746747

747748
export const clineAskSchema = z.enum(clineAsks)
@@ -751,7 +752,6 @@ export type ClineAsk = z.infer<typeof clineAskSchema>
751752
// ClineSay
752753

753754
export const clineSays = [
754-
"task",
755755
"error",
756756
"api_req_started",
757757
"api_req_finished",
@@ -764,15 +764,11 @@ export const clineSays = [
764764
"user_feedback",
765765
"user_feedback_diff",
766766
"command_output",
767-
"tool",
768767
"shell_integration_warning",
769768
"browser_action",
770769
"browser_action_result",
771-
"command",
772770
"mcp_server_request_started",
773771
"mcp_server_response",
774-
"new_task_started",
775-
"new_task",
776772
"subtask_result",
777773
"checkpoint_saved",
778774
"rooignore_error",

src/shared/__tests__/combineApiRequests.test.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// npx jest src/shared/__tests__/combineApiRequests.test.ts
22

33
import { combineApiRequests } from "../combineApiRequests"
4-
import { ClineMessage } from "../ExtensionMessage"
4+
import { ClineMessage, ClineSay } from "../ExtensionMessage"
55

66
describe("combineApiRequests", () => {
77
// Helper function to create a basic api_req_started message
@@ -22,15 +22,10 @@ describe("combineApiRequests", () => {
2222

2323
// Helper function to create a non-API message
2424
const createOtherMessage = (
25-
say: "text" | "task" | "error" | "command" = "text",
25+
say: ClineSay = "text",
2626
text: string = "Hello world",
2727
ts: number = 999,
28-
): ClineMessage => ({
29-
type: "say",
30-
say,
31-
text,
32-
ts,
33-
})
28+
): ClineMessage => ({ type: "say", say, text, ts })
3429

3530
describe("Basic functionality", () => {
3631
it("should combine a pair of api_req_started and api_req_finished messages", () => {
@@ -141,7 +136,7 @@ describe("combineApiRequests", () => {
141136
it("should return original array when no API request messages exist", () => {
142137
const messages: ClineMessage[] = [
143138
createOtherMessage("text", "Message 1", 999),
144-
createOtherMessage("task", "Task message", 1000),
139+
createOtherMessage("text", "Task message", 1000),
145140
createOtherMessage("error", "Error message", 1001),
146141
]
147142

0 commit comments

Comments
 (0)